diff options
239 files changed, 2042 insertions, 944 deletions
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/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt index ce6a1a072028..8a3c40829899 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt | |||
@@ -30,10 +30,6 @@ should only be used when a device has multiple interrupt parents. | |||
30 | Example: | 30 | Example: |
31 | interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; | 31 | interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; |
32 | 32 | ||
33 | A device node may contain either "interrupts" or "interrupts-extended", but not | ||
34 | both. If both properties are present, then the operating system should log an | ||
35 | error and use only the data in "interrupts". | ||
36 | |||
37 | 2) Interrupt controller nodes | 33 | 2) Interrupt controller nodes |
38 | ----------------------------- | 34 | ----------------------------- |
39 | 35 | ||
diff --git a/Documentation/devicetree/bindings/pci/pci.txt b/Documentation/devicetree/bindings/pci/pci.txt index 41aeed38926d..f8fbe9af7b2f 100644 --- a/Documentation/devicetree/bindings/pci/pci.txt +++ b/Documentation/devicetree/bindings/pci/pci.txt | |||
@@ -7,3 +7,14 @@ And for the interrupt mapping part: | |||
7 | 7 | ||
8 | Open Firmware Recommended Practice: Interrupt Mapping | 8 | Open Firmware Recommended Practice: Interrupt Mapping |
9 | http://www.openfirmware.org/1275/practice/imap/imap0_9d.pdf | 9 | http://www.openfirmware.org/1275/practice/imap/imap0_9d.pdf |
10 | |||
11 | Additionally to the properties specified in the above standards a host bridge | ||
12 | driver implementation may support the following properties: | ||
13 | |||
14 | - linux,pci-domain: | ||
15 | If present this property assigns a fixed PCI domain number to a host bridge, | ||
16 | otherwise an unstable (across boots) unique number will be assigned. | ||
17 | It is required to either not set this property at all or set it for all | ||
18 | host bridges in the system, otherwise potentially conflicting domain numbers | ||
19 | may be assigned to root buses behind different host bridges. The domain | ||
20 | number for each host bridge in the system must be unique. | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt index a186181c402b..51b943cc9770 100644 --- a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | TZ1090-PDC's pin configuration nodes act as a container for an abitrary number | 12 | TZ1090-PDC's pin configuration nodes act as a container for an arbitrary number |
13 | of subnodes. Each of these subnodes represents some desired configuration for a | 13 | of subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those pin(s)/group(s), and various pin configuration | 15 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt index 4b27c99f7f9d..49d0e6050940 100644 --- a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | TZ1090's pin configuration nodes act as a container for an abitrary number of | 12 | TZ1090's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those pin(s)/group(s), and various pin configuration | 15 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt b/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt index daa768956069..ac4da9fe07bd 100644 --- a/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt +++ b/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | Lantiq's pin configuration nodes act as a container for an abitrary number of | 12 | Lantiq's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those group(s), and two pin configuration parameters: | 15 | mux function to select on those group(s), and two pin configuration parameters: |
diff --git a/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt b/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt index b5469db1d7ad..e89b4677567d 100644 --- a/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt +++ b/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | Lantiq's pin configuration nodes act as a container for an abitrary number of | 12 | Lantiq's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those group(s), and two pin configuration parameters: | 15 | mux function to select on those group(s), and two pin configuration parameters: |
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt index 61e73cde9ae9..3c8ce28baad6 100644 --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | Tegra's pin configuration nodes act as a container for an abitrary number of | 12 | Tegra's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those pin(s)/group(s), and various pin configuration | 15 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt index c596a6ad3285..5f55be59d914 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt | |||
@@ -13,7 +13,7 @@ Optional properties: | |||
13 | Please refer to pinctrl-bindings.txt in this directory for details of the common | 13 | Please refer to pinctrl-bindings.txt in this directory for details of the common |
14 | pinctrl bindings used by client devices. | 14 | pinctrl bindings used by client devices. |
15 | 15 | ||
16 | SiRFprimaII's pinmux nodes act as a container for an abitrary number of subnodes. | 16 | SiRFprimaII's pinmux nodes act as a container for an arbitrary number of subnodes. |
17 | Each of these subnodes represents some desired configuration for a group of pins. | 17 | Each of these subnodes represents some desired configuration for a group of pins. |
18 | 18 | ||
19 | Required subnode-properties: | 19 | Required subnode-properties: |
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt index b4480d5c3aca..458615596946 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt | |||
@@ -32,7 +32,7 @@ Required properties: | |||
32 | Please refer to pinctrl-bindings.txt in this directory for details of the common | 32 | Please refer to pinctrl-bindings.txt in this directory for details of the common |
33 | pinctrl bindings used by client devices. | 33 | pinctrl bindings used by client devices. |
34 | 34 | ||
35 | SPEAr's pinmux nodes act as a container for an abitrary number of subnodes. Each | 35 | SPEAr's pinmux nodes act as a container for an arbitrary number of subnodes. Each |
36 | of these subnodes represents muxing for a pin, a group, or a list of pins or | 36 | of these subnodes represents muxing for a pin, a group, or a list of pins or |
37 | groups. | 37 | groups. |
38 | 38 | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt index 2fb90b37aa09..a7bde64798c7 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt | |||
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
18 | common pinctrl bindings used by client devices, including the meaning of the | 18 | common pinctrl bindings used by client devices, including the meaning of the |
19 | phrase "pin configuration node". | 19 | phrase "pin configuration node". |
20 | 20 | ||
21 | Qualcomm's pin configuration nodes act as a container for an abitrary number of | 21 | Qualcomm's pin configuration nodes act as a container for an arbitrary number of |
22 | subnodes. Each of these subnodes represents some desired configuration for a | 22 | subnodes. Each of these subnodes represents some desired configuration for a |
23 | pin, a group, or a list of pins or groups. This configuration can include the | 23 | pin, a group, or a list of pins or groups. This configuration can include the |
24 | mux function to select on those pin(s)/group(s), and various pin configuration | 24 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt index ffafa1990a30..c4ea61ac56f2 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt | |||
@@ -47,7 +47,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
47 | common pinctrl bindings used by client devices, including the meaning of the | 47 | common pinctrl bindings used by client devices, including the meaning of the |
48 | phrase "pin configuration node". | 48 | phrase "pin configuration node". |
49 | 49 | ||
50 | The pin configuration nodes act as a container for an abitrary number of | 50 | The pin configuration nodes act as a container for an arbitrary number of |
51 | subnodes. Each of these subnodes represents some desired configuration for a | 51 | subnodes. Each of these subnodes represents some desired configuration for a |
52 | pin, a group, or a list of pins or groups. This configuration can include the | 52 | pin, a group, or a list of pins or groups. This configuration can include the |
53 | mux function to select on those pin(s)/group(s), and various pin configuration | 53 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt index e33e4dcdce79..6e88e91feb11 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt | |||
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
18 | common pinctrl bindings used by client devices, including the meaning of the | 18 | common pinctrl bindings used by client devices, including the meaning of the |
19 | phrase "pin configuration node". | 19 | phrase "pin configuration node". |
20 | 20 | ||
21 | Qualcomm's pin configuration nodes act as a container for an abitrary number of | 21 | Qualcomm's pin configuration nodes act as a container for an arbitrary number of |
22 | subnodes. Each of these subnodes represents some desired configuration for a | 22 | subnodes. Each of these subnodes represents some desired configuration for a |
23 | pin, a group, or a list of pins or groups. This configuration can include the | 23 | pin, a group, or a list of pins or groups. This configuration can include the |
24 | mux function to select on those pin(s)/group(s), and various pin configuration | 24 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt index 93b7de91b9f6..eb8d8aa41f20 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt | |||
@@ -47,7 +47,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
47 | common pinctrl bindings used by client devices, including the meaning of the | 47 | common pinctrl bindings used by client devices, including the meaning of the |
48 | phrase "pin configuration node". | 48 | phrase "pin configuration node". |
49 | 49 | ||
50 | The pin configuration nodes act as a container for an abitrary number of | 50 | The pin configuration nodes act as a container for an arbitrary number of |
51 | subnodes. Each of these subnodes represents some desired configuration for a | 51 | subnodes. Each of these subnodes represents some desired configuration for a |
52 | pin, a group, or a list of pins or groups. This configuration can include the | 52 | pin, a group, or a list of pins or groups. This configuration can include the |
53 | mux function to select on those pin(s)/group(s), and various pin configuration | 53 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt index d2ea80dc43eb..e4d6a9d20f7d 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt | |||
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
18 | common pinctrl bindings used by client devices, including the meaning of the | 18 | common pinctrl bindings used by client devices, including the meaning of the |
19 | phrase "pin configuration node". | 19 | phrase "pin configuration node". |
20 | 20 | ||
21 | Qualcomm's pin configuration nodes act as a container for an abitrary number of | 21 | Qualcomm's pin configuration nodes act as a container for an arbitrary number of |
22 | subnodes. Each of these subnodes represents some desired configuration for a | 22 | subnodes. Each of these subnodes represents some desired configuration for a |
23 | pin, a group, or a list of pins or groups. This configuration can include the | 23 | pin, a group, or a list of pins or groups. This configuration can include the |
24 | mux function to select on those pin(s)/group(s), and various pin configuration | 24 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 723999d73744..a344ec2713a5 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -34,6 +34,7 @@ chipidea Chipidea, Inc | |||
34 | chrp Common Hardware Reference Platform | 34 | chrp Common Hardware Reference Platform |
35 | chunghwa Chunghwa Picture Tubes Ltd. | 35 | chunghwa Chunghwa Picture Tubes Ltd. |
36 | cirrus Cirrus Logic, Inc. | 36 | cirrus Cirrus Logic, Inc. |
37 | cnm Chips&Media, Inc. | ||
37 | cortina Cortina Systems, Inc. | 38 | cortina Cortina Systems, Inc. |
38 | crystalfontz Crystalfontz America, Inc. | 39 | crystalfontz Crystalfontz America, Inc. |
39 | dallas Maxim Integrated Products (formerly Dallas Semiconductor) | 40 | dallas Maxim Integrated Products (formerly Dallas Semiconductor) |
@@ -92,6 +93,7 @@ maxim Maxim Integrated Products | |||
92 | mediatek MediaTek Inc. | 93 | mediatek MediaTek Inc. |
93 | micrel Micrel Inc. | 94 | micrel Micrel Inc. |
94 | microchip Microchip Technology Inc. | 95 | microchip Microchip Technology Inc. |
96 | micron Micron Technology Inc. | ||
95 | mitsubishi Mitsubishi Electric Corporation | 97 | mitsubishi Mitsubishi Electric Corporation |
96 | mosaixtech Mosaix Technologies, Inc. | 98 | mosaixtech Mosaix Technologies, Inc. |
97 | moxa Moxa | 99 | moxa Moxa |
@@ -127,6 +129,7 @@ renesas Renesas Electronics Corporation | |||
127 | ricoh Ricoh Co. Ltd. | 129 | ricoh Ricoh Co. Ltd. |
128 | rockchip Fuzhou Rockchip Electronics Co., Ltd | 130 | rockchip Fuzhou Rockchip Electronics Co., Ltd |
129 | samsung Samsung Semiconductor | 131 | samsung Samsung Semiconductor |
132 | sandisk Sandisk Corporation | ||
130 | sbs Smart Battery System | 133 | sbs Smart Battery System |
131 | schindler Schindler | 134 | schindler Schindler |
132 | seagate Seagate Technology PLC | 135 | seagate Seagate Technology PLC |
@@ -138,7 +141,7 @@ silergy Silergy Corp. | |||
138 | sirf SiRF Technology, Inc. | 141 | sirf SiRF Technology, Inc. |
139 | sitronix Sitronix Technology Corporation | 142 | sitronix Sitronix Technology Corporation |
140 | smsc Standard Microsystems Corporation | 143 | smsc Standard Microsystems Corporation |
141 | snps Synopsys, Inc. | 144 | snps Synopsys, Inc. |
142 | solidrun SolidRun | 145 | solidrun SolidRun |
143 | sony Sony Corporation | 146 | sony Sony Corporation |
144 | spansion Spansion Inc. | 147 | spansion Spansion Inc. |
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/MAINTAINERS b/MAINTAINERS index 064d24191506..a545d68af54c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2752,6 +2752,13 @@ W: http://www.chelsio.com | |||
2752 | S: Supported | 2752 | S: Supported |
2753 | F: drivers/net/ethernet/chelsio/cxgb3/ | 2753 | F: drivers/net/ethernet/chelsio/cxgb3/ |
2754 | 2754 | ||
2755 | CXGB3 ISCSI DRIVER (CXGB3I) | ||
2756 | M: Karen Xie <kxie@chelsio.com> | ||
2757 | L: linux-scsi@vger.kernel.org | ||
2758 | W: http://www.chelsio.com | ||
2759 | S: Supported | ||
2760 | F: drivers/scsi/cxgbi/cxgb3i | ||
2761 | |||
2755 | CXGB3 IWARP RNIC DRIVER (IW_CXGB3) | 2762 | CXGB3 IWARP RNIC DRIVER (IW_CXGB3) |
2756 | M: Steve Wise <swise@chelsio.com> | 2763 | M: Steve Wise <swise@chelsio.com> |
2757 | L: linux-rdma@vger.kernel.org | 2764 | L: linux-rdma@vger.kernel.org |
@@ -2766,6 +2773,13 @@ W: http://www.chelsio.com | |||
2766 | S: Supported | 2773 | S: Supported |
2767 | F: drivers/net/ethernet/chelsio/cxgb4/ | 2774 | F: drivers/net/ethernet/chelsio/cxgb4/ |
2768 | 2775 | ||
2776 | CXGB4 ISCSI DRIVER (CXGB4I) | ||
2777 | M: Karen Xie <kxie@chelsio.com> | ||
2778 | L: linux-scsi@vger.kernel.org | ||
2779 | W: http://www.chelsio.com | ||
2780 | S: Supported | ||
2781 | F: drivers/scsi/cxgbi/cxgb4i | ||
2782 | |||
2769 | CXGB4 IWARP RNIC DRIVER (IW_CXGB4) | 2783 | CXGB4 IWARP RNIC DRIVER (IW_CXGB4) |
2770 | M: Steve Wise <swise@chelsio.com> | 2784 | M: Steve Wise <swise@chelsio.com> |
2771 | L: linux-rdma@vger.kernel.org | 2785 | L: linux-rdma@vger.kernel.org |
@@ -6617,6 +6631,23 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git | |||
6617 | S: Maintained | 6631 | S: Maintained |
6618 | F: arch/arm/*omap*/ | 6632 | F: arch/arm/*omap*/ |
6619 | F: drivers/i2c/busses/i2c-omap.c | 6633 | F: drivers/i2c/busses/i2c-omap.c |
6634 | F: drivers/irqchip/irq-omap-intc.c | ||
6635 | F: drivers/mfd/*omap*.c | ||
6636 | F: drivers/mfd/menelaus.c | ||
6637 | F: drivers/mfd/palmas.c | ||
6638 | F: drivers/mfd/tps65217.c | ||
6639 | F: drivers/mfd/tps65218.c | ||
6640 | F: drivers/mfd/tps65910.c | ||
6641 | F: drivers/mfd/twl-core.[ch] | ||
6642 | F: drivers/mfd/twl4030*.c | ||
6643 | F: drivers/mfd/twl6030*.c | ||
6644 | F: drivers/mfd/twl6040*.c | ||
6645 | F: drivers/regulator/palmas-regulator*.c | ||
6646 | F: drivers/regulator/pbias-regulator.c | ||
6647 | F: drivers/regulator/tps65217-regulator.c | ||
6648 | F: drivers/regulator/tps65218-regulator.c | ||
6649 | F: drivers/regulator/tps65910-regulator.c | ||
6650 | F: drivers/regulator/twl-regulator.c | ||
6620 | F: include/linux/i2c-omap.h | 6651 | F: include/linux/i2c-omap.h |
6621 | 6652 | ||
6622 | OMAP DEVICE TREE SUPPORT | 6653 | OMAP DEVICE TREE SUPPORT |
@@ -6627,6 +6658,9 @@ L: devicetree@vger.kernel.org | |||
6627 | S: Maintained | 6658 | S: Maintained |
6628 | F: arch/arm/boot/dts/*omap* | 6659 | F: arch/arm/boot/dts/*omap* |
6629 | F: arch/arm/boot/dts/*am3* | 6660 | F: arch/arm/boot/dts/*am3* |
6661 | F: arch/arm/boot/dts/*am4* | ||
6662 | F: arch/arm/boot/dts/*am5* | ||
6663 | F: arch/arm/boot/dts/*dra7* | ||
6630 | 6664 | ||
6631 | OMAP CLOCK FRAMEWORK SUPPORT | 6665 | OMAP CLOCK FRAMEWORK SUPPORT |
6632 | M: Paul Walmsley <paul@pwsan.com> | 6666 | M: Paul Walmsley <paul@pwsan.com> |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 18 | 2 | PATCHLEVEL = 18 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Diseased Newt | 5 | NAME = Diseased Newt |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -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/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/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/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/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/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/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/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/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/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h index e194f957ca8c..fdbff44e5482 100644 --- a/arch/mips/include/asm/jump_label.h +++ b/arch/mips/include/asm/jump_label.h | |||
@@ -20,9 +20,15 @@ | |||
20 | #define WORD_INSN ".word" | 20 | #define WORD_INSN ".word" |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef CONFIG_CPU_MICROMIPS | ||
24 | #define NOP_INSN "nop32" | ||
25 | #else | ||
26 | #define NOP_INSN "nop" | ||
27 | #endif | ||
28 | |||
23 | static __always_inline bool arch_static_branch(struct static_key *key) | 29 | static __always_inline bool arch_static_branch(struct static_key *key) |
24 | { | 30 | { |
25 | asm_volatile_goto("1:\tnop\n\t" | 31 | asm_volatile_goto("1:\t" NOP_INSN "\n\t" |
26 | "nop\n\t" | 32 | "nop\n\t" |
27 | ".pushsection __jump_table, \"aw\"\n\t" | 33 | ".pushsection __jump_table, \"aw\"\n\t" |
28 | WORD_INSN " 1b, %l[l_yes], %0\n\t" | 34 | WORD_INSN " 1b, %l[l_yes], %0\n\t" |
diff --git a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h index 7d28f95b0512..6d69332f21ec 100644 --- a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h | |||
@@ -41,10 +41,8 @@ | |||
41 | #define cpu_has_mcheck 0 | 41 | #define cpu_has_mcheck 0 |
42 | #define cpu_has_mdmx 0 | 42 | #define cpu_has_mdmx 0 |
43 | #define cpu_has_mips16 0 | 43 | #define cpu_has_mips16 0 |
44 | #define cpu_has_mips32r1 0 | ||
45 | #define cpu_has_mips32r2 0 | 44 | #define cpu_has_mips32r2 0 |
46 | #define cpu_has_mips3d 0 | 45 | #define cpu_has_mips3d 0 |
47 | #define cpu_has_mips64r1 0 | ||
48 | #define cpu_has_mips64r2 0 | 46 | #define cpu_has_mips64r2 0 |
49 | #define cpu_has_mipsmt 0 | 47 | #define cpu_has_mipsmt 0 |
50 | #define cpu_has_prefetch 0 | 48 | #define cpu_has_prefetch 0 |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index a10951090234..133678ab4eb8 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
@@ -301,7 +301,8 @@ do { \ | |||
301 | __get_kernel_common((x), size, __gu_ptr); \ | 301 | __get_kernel_common((x), size, __gu_ptr); \ |
302 | else \ | 302 | else \ |
303 | __get_user_common((x), size, __gu_ptr); \ | 303 | __get_user_common((x), size, __gu_ptr); \ |
304 | } \ | 304 | } else \ |
305 | (x) = 0; \ | ||
305 | \ | 306 | \ |
306 | __gu_err; \ | 307 | __gu_err; \ |
307 | }) | 308 | }) |
@@ -316,6 +317,7 @@ do { \ | |||
316 | " .insn \n" \ | 317 | " .insn \n" \ |
317 | " .section .fixup,\"ax\" \n" \ | 318 | " .section .fixup,\"ax\" \n" \ |
318 | "3: li %0, %4 \n" \ | 319 | "3: li %0, %4 \n" \ |
320 | " move %1, $0 \n" \ | ||
319 | " j 2b \n" \ | 321 | " j 2b \n" \ |
320 | " .previous \n" \ | 322 | " .previous \n" \ |
321 | " .section __ex_table,\"a\" \n" \ | 323 | " .section __ex_table,\"a\" \n" \ |
@@ -630,6 +632,7 @@ do { \ | |||
630 | " .insn \n" \ | 632 | " .insn \n" \ |
631 | " .section .fixup,\"ax\" \n" \ | 633 | " .section .fixup,\"ax\" \n" \ |
632 | "3: li %0, %4 \n" \ | 634 | "3: li %0, %4 \n" \ |
635 | " move %1, $0 \n" \ | ||
633 | " j 2b \n" \ | 636 | " j 2b \n" \ |
634 | " .previous \n" \ | 637 | " .previous \n" \ |
635 | " .section __ex_table,\"a\" \n" \ | 638 | " .section __ex_table,\"a\" \n" \ |
@@ -773,10 +776,11 @@ extern void __put_user_unaligned_unknown(void); | |||
773 | "jal\t" #destination "\n\t" | 776 | "jal\t" #destination "\n\t" |
774 | #endif | 777 | #endif |
775 | 778 | ||
776 | #ifndef CONFIG_CPU_DADDI_WORKAROUNDS | 779 | #if defined(CONFIG_CPU_DADDI_WORKAROUNDS) || (defined(CONFIG_EVA) && \ |
777 | #define DADDI_SCRATCH "$0" | 780 | defined(CONFIG_CPU_HAS_PREFETCH)) |
778 | #else | ||
779 | #define DADDI_SCRATCH "$3" | 781 | #define DADDI_SCRATCH "$3" |
782 | #else | ||
783 | #define DADDI_SCRATCH "$0" | ||
780 | #endif | 784 | #endif |
781 | 785 | ||
782 | extern size_t __copy_user(void *__to, const void *__from, size_t __n); | 786 | extern size_t __copy_user(void *__to, const void *__from, size_t __n); |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 94c4a0c0a577..d5a4f380b019 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -757,31 +757,34 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
757 | c->cputype = CPU_LOONGSON2; | 757 | c->cputype = CPU_LOONGSON2; |
758 | __cpu_name[cpu] = "ICT Loongson-2"; | 758 | __cpu_name[cpu] = "ICT Loongson-2"; |
759 | set_elf_platform(cpu, "loongson2e"); | 759 | set_elf_platform(cpu, "loongson2e"); |
760 | set_isa(c, MIPS_CPU_ISA_III); | ||
760 | break; | 761 | break; |
761 | case PRID_REV_LOONGSON2F: | 762 | case PRID_REV_LOONGSON2F: |
762 | c->cputype = CPU_LOONGSON2; | 763 | c->cputype = CPU_LOONGSON2; |
763 | __cpu_name[cpu] = "ICT Loongson-2"; | 764 | __cpu_name[cpu] = "ICT Loongson-2"; |
764 | set_elf_platform(cpu, "loongson2f"); | 765 | set_elf_platform(cpu, "loongson2f"); |
766 | set_isa(c, MIPS_CPU_ISA_III); | ||
765 | break; | 767 | break; |
766 | case PRID_REV_LOONGSON3A: | 768 | case PRID_REV_LOONGSON3A: |
767 | c->cputype = CPU_LOONGSON3; | 769 | c->cputype = CPU_LOONGSON3; |
768 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
769 | __cpu_name[cpu] = "ICT Loongson-3"; | 770 | __cpu_name[cpu] = "ICT Loongson-3"; |
770 | set_elf_platform(cpu, "loongson3a"); | 771 | set_elf_platform(cpu, "loongson3a"); |
772 | set_isa(c, MIPS_CPU_ISA_M64R1); | ||
771 | break; | 773 | break; |
772 | case PRID_REV_LOONGSON3B_R1: | 774 | case PRID_REV_LOONGSON3B_R1: |
773 | case PRID_REV_LOONGSON3B_R2: | 775 | case PRID_REV_LOONGSON3B_R2: |
774 | c->cputype = CPU_LOONGSON3; | 776 | c->cputype = CPU_LOONGSON3; |
775 | __cpu_name[cpu] = "ICT Loongson-3"; | 777 | __cpu_name[cpu] = "ICT Loongson-3"; |
776 | set_elf_platform(cpu, "loongson3b"); | 778 | set_elf_platform(cpu, "loongson3b"); |
779 | set_isa(c, MIPS_CPU_ISA_M64R1); | ||
777 | break; | 780 | break; |
778 | } | 781 | } |
779 | 782 | ||
780 | set_isa(c, MIPS_CPU_ISA_III); | ||
781 | c->options = R4K_OPTS | | 783 | c->options = R4K_OPTS | |
782 | MIPS_CPU_FPU | MIPS_CPU_LLSC | | 784 | MIPS_CPU_FPU | MIPS_CPU_LLSC | |
783 | MIPS_CPU_32FPR; | 785 | MIPS_CPU_32FPR; |
784 | c->tlbsize = 64; | 786 | c->tlbsize = 64; |
787 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
785 | break; | 788 | break; |
786 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ | 789 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ |
787 | decode_configs(c); | 790 | decode_configs(c); |
diff --git a/arch/mips/kernel/jump_label.c b/arch/mips/kernel/jump_label.c index 6001610cfe55..dda800e9e731 100644 --- a/arch/mips/kernel/jump_label.c +++ b/arch/mips/kernel/jump_label.c | |||
@@ -18,31 +18,53 @@ | |||
18 | 18 | ||
19 | #ifdef HAVE_JUMP_LABEL | 19 | #ifdef HAVE_JUMP_LABEL |
20 | 20 | ||
21 | #define J_RANGE_MASK ((1ul << 28) - 1) | 21 | /* |
22 | * Define parameters for the standard MIPS and the microMIPS jump | ||
23 | * instruction encoding respectively: | ||
24 | * | ||
25 | * - the ISA bit of the target, either 0 or 1 respectively, | ||
26 | * | ||
27 | * - the amount the jump target address is shifted right to fit in the | ||
28 | * immediate field of the machine instruction, either 2 or 1, | ||
29 | * | ||
30 | * - the mask determining the size of the jump region relative to the | ||
31 | * delay-slot instruction, either 256MB or 128MB, | ||
32 | * | ||
33 | * - the jump target alignment, either 4 or 2 bytes. | ||
34 | */ | ||
35 | #define J_ISA_BIT IS_ENABLED(CONFIG_CPU_MICROMIPS) | ||
36 | #define J_RANGE_SHIFT (2 - J_ISA_BIT) | ||
37 | #define J_RANGE_MASK ((1ul << (26 + J_RANGE_SHIFT)) - 1) | ||
38 | #define J_ALIGN_MASK ((1ul << J_RANGE_SHIFT) - 1) | ||
22 | 39 | ||
23 | void arch_jump_label_transform(struct jump_entry *e, | 40 | void arch_jump_label_transform(struct jump_entry *e, |
24 | enum jump_label_type type) | 41 | enum jump_label_type type) |
25 | { | 42 | { |
43 | union mips_instruction *insn_p; | ||
26 | union mips_instruction insn; | 44 | union mips_instruction insn; |
27 | union mips_instruction *insn_p = | ||
28 | (union mips_instruction *)(unsigned long)e->code; | ||
29 | 45 | ||
30 | /* Jump only works within a 256MB aligned region. */ | 46 | insn_p = (union mips_instruction *)msk_isa16_mode(e->code); |
31 | BUG_ON((e->target & ~J_RANGE_MASK) != (e->code & ~J_RANGE_MASK)); | 47 | |
48 | /* Jump only works within an aligned region its delay slot is in. */ | ||
49 | BUG_ON((e->target & ~J_RANGE_MASK) != ((e->code + 4) & ~J_RANGE_MASK)); | ||
32 | 50 | ||
33 | /* Target must have 4 byte alignment. */ | 51 | /* Target must have the right alignment and ISA must be preserved. */ |
34 | BUG_ON((e->target & 3) != 0); | 52 | BUG_ON((e->target & J_ALIGN_MASK) != J_ISA_BIT); |
35 | 53 | ||
36 | if (type == JUMP_LABEL_ENABLE) { | 54 | if (type == JUMP_LABEL_ENABLE) { |
37 | insn.j_format.opcode = j_op; | 55 | insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op; |
38 | insn.j_format.target = (e->target & J_RANGE_MASK) >> 2; | 56 | insn.j_format.target = e->target >> J_RANGE_SHIFT; |
39 | } else { | 57 | } else { |
40 | insn.word = 0; /* nop */ | 58 | insn.word = 0; /* nop */ |
41 | } | 59 | } |
42 | 60 | ||
43 | get_online_cpus(); | 61 | get_online_cpus(); |
44 | mutex_lock(&text_mutex); | 62 | mutex_lock(&text_mutex); |
45 | *insn_p = insn; | 63 | if (IS_ENABLED(CONFIG_CPU_MICROMIPS)) { |
64 | insn_p->halfword[0] = insn.word >> 16; | ||
65 | insn_p->halfword[1] = insn.word; | ||
66 | } else | ||
67 | *insn_p = insn; | ||
46 | 68 | ||
47 | flush_icache_range((unsigned long)insn_p, | 69 | flush_icache_range((unsigned long)insn_p, |
48 | (unsigned long)insn_p + sizeof(*insn_p)); | 70 | (unsigned long)insn_p + sizeof(*insn_p)); |
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index c17ef80cf65a..5d3238af9b5c 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S | |||
@@ -503,6 +503,7 @@ | |||
503 | STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) | 503 | STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) |
504 | .Ldone\@: | 504 | .Ldone\@: |
505 | jr ra | 505 | jr ra |
506 | nop | ||
506 | .if __memcpy == 1 | 507 | .if __memcpy == 1 |
507 | END(memcpy) | 508 | END(memcpy) |
508 | .set __memcpy, 0 | 509 | .set __memcpy, 0 |
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c index 37ed184398c6..42323bcc5d28 100644 --- a/arch/mips/loongson/loongson-3/numa.c +++ b/arch/mips/loongson/loongson-3/numa.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | static struct node_data prealloc__node_data[MAX_NUMNODES]; | 34 | static struct node_data prealloc__node_data[MAX_NUMNODES]; |
35 | unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; | 35 | unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; |
36 | EXPORT_SYMBOL(__node_distances); | ||
36 | struct node_data *__node_data[MAX_NUMNODES]; | 37 | struct node_data *__node_data[MAX_NUMNODES]; |
37 | EXPORT_SYMBOL(__node_data); | 38 | EXPORT_SYMBOL(__node_data); |
38 | 39 | ||
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index fa6ebd4bc9e9..c3917e251f59 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -299,6 +299,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) | |||
299 | 299 | ||
300 | local_irq_save(flags); | 300 | local_irq_save(flags); |
301 | 301 | ||
302 | htw_stop(); | ||
302 | pid = read_c0_entryhi() & ASID_MASK; | 303 | pid = read_c0_entryhi() & ASID_MASK; |
303 | address &= (PAGE_MASK << 1); | 304 | address &= (PAGE_MASK << 1); |
304 | write_c0_entryhi(address | pid); | 305 | write_c0_entryhi(address | pid); |
@@ -346,6 +347,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) | |||
346 | tlb_write_indexed(); | 347 | tlb_write_indexed(); |
347 | } | 348 | } |
348 | tlbw_use_hazard(); | 349 | tlbw_use_hazard(); |
350 | htw_start(); | ||
349 | flush_itlb_vm(vma); | 351 | flush_itlb_vm(vma); |
350 | local_irq_restore(flags); | 352 | local_irq_restore(flags); |
351 | } | 353 | } |
@@ -422,6 +424,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
422 | 424 | ||
423 | local_irq_save(flags); | 425 | local_irq_save(flags); |
424 | /* Save old context and create impossible VPN2 value */ | 426 | /* Save old context and create impossible VPN2 value */ |
427 | htw_stop(); | ||
425 | old_ctx = read_c0_entryhi(); | 428 | old_ctx = read_c0_entryhi(); |
426 | old_pagemask = read_c0_pagemask(); | 429 | old_pagemask = read_c0_pagemask(); |
427 | wired = read_c0_wired(); | 430 | wired = read_c0_wired(); |
@@ -443,6 +446,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
443 | 446 | ||
444 | write_c0_entryhi(old_ctx); | 447 | write_c0_entryhi(old_ctx); |
445 | write_c0_pagemask(old_pagemask); | 448 | write_c0_pagemask(old_pagemask); |
449 | htw_start(); | ||
446 | out: | 450 | out: |
447 | local_irq_restore(flags); | 451 | local_irq_restore(flags); |
448 | return ret; | 452 | return ret; |
diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c index 6854ed5097d2..83a1dfd8f0e3 100644 --- a/arch/mips/oprofile/backtrace.c +++ b/arch/mips/oprofile/backtrace.c | |||
@@ -92,7 +92,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame, | |||
92 | /* This marks the end of the previous function, | 92 | /* This marks the end of the previous function, |
93 | which means we overran. */ | 93 | which means we overran. */ |
94 | break; | 94 | break; |
95 | stack_size = (unsigned) stack_adjustment; | 95 | stack_size = (unsigned long) stack_adjustment; |
96 | } else if (is_ra_save_ins(&ip)) { | 96 | } else if (is_ra_save_ins(&ip)) { |
97 | int ra_slot = ip.i_format.simmediate; | 97 | int ra_slot = ip.i_format.simmediate; |
98 | if (ra_slot < 0) | 98 | if (ra_slot < 0) |
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index a95c00f5fb96..a304bcc37e4f 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c | |||
@@ -107,6 +107,7 @@ static void router_recurse(klrou_t *router_a, klrou_t *router_b, int depth) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; | 109 | unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; |
110 | EXPORT_SYMBOL(__node_distances); | ||
110 | 111 | ||
111 | static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) | 112 | static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) |
112 | { | 113 | { |
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/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index de40b48b460e..da08ed088157 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c | |||
@@ -361,7 +361,7 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, | |||
361 | cascade_data->virq = virt_msir; | 361 | cascade_data->virq = virt_msir; |
362 | msi->cascade_array[irq_index] = cascade_data; | 362 | msi->cascade_array[irq_index] = cascade_data; |
363 | 363 | ||
364 | ret = request_irq(virt_msir, fsl_msi_cascade, 0, | 364 | ret = request_irq(virt_msir, fsl_msi_cascade, IRQF_NO_THREAD, |
365 | "fsl-msi-cascade", cascade_data); | 365 | "fsl-msi-cascade", cascade_data); |
366 | if (ret) { | 366 | if (ret) { |
367 | dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", | 367 | dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", |
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/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/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 ded8a6774ac9..41a503c15862 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -144,7 +144,7 @@ config INSTRUCTION_DECODER | |||
144 | 144 | ||
145 | config PERF_EVENTS_INTEL_UNCORE | 145 | config PERF_EVENTS_INTEL_UNCORE |
146 | def_bool y | 146 | def_bool y |
147 | depends on PERF_EVENTS && SUP_SUP_INTEL && PCI | 147 | depends on PERF_EVENTS && CPU_SUP_INTEL && PCI |
148 | 148 | ||
149 | config OUTPUT_FORMAT | 149 | config OUTPUT_FORMAT |
150 | string | 150 | string |
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/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/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4b4f78c9ba19..cfa9b5b2c27a 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); | |||
146 | 146 | ||
147 | static int __init x86_xsave_setup(char *s) | 147 | static int __init x86_xsave_setup(char *s) |
148 | { | 148 | { |
149 | if (strlen(s)) | ||
150 | return 0; | ||
149 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); | 151 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); |
150 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); | 152 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); |
151 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); | 153 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); |
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.c b/arch/x86/kernel/cpu/microcode/core.c index dd9d6190b08d..2ce9051174e6 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c | |||
@@ -465,6 +465,14 @@ static void mc_bp_resume(void) | |||
465 | 465 | ||
466 | if (uci->valid && uci->mc) | 466 | if (uci->valid && uci->mc) |
467 | microcode_ops->apply_microcode(cpu); | 467 | microcode_ops->apply_microcode(cpu); |
468 | else if (!uci->mc) | ||
469 | /* | ||
470 | * We might resume and not have applied late microcode but still | ||
471 | * have a newer patch stashed from the early loader. We don't | ||
472 | * have it in uci->mc so we have to load it the same way we're | ||
473 | * applying patches early on the APs. | ||
474 | */ | ||
475 | load_ucode_ap(); | ||
468 | } | 476 | } |
469 | 477 | ||
470 | static struct syscore_ops mc_syscore_ops = { | 478 | static struct syscore_ops mc_syscore_ops = { |
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_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c index adf138eac85c..f9ed429d6e4f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | |||
@@ -486,14 +486,17 @@ static struct attribute_group snbep_uncore_qpi_format_group = { | |||
486 | .attrs = snbep_uncore_qpi_formats_attr, | 486 | .attrs = snbep_uncore_qpi_formats_attr, |
487 | }; | 487 | }; |
488 | 488 | ||
489 | #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ | 489 | #define __SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ |
490 | .init_box = snbep_uncore_msr_init_box, \ | ||
491 | .disable_box = snbep_uncore_msr_disable_box, \ | 490 | .disable_box = snbep_uncore_msr_disable_box, \ |
492 | .enable_box = snbep_uncore_msr_enable_box, \ | 491 | .enable_box = snbep_uncore_msr_enable_box, \ |
493 | .disable_event = snbep_uncore_msr_disable_event, \ | 492 | .disable_event = snbep_uncore_msr_disable_event, \ |
494 | .enable_event = snbep_uncore_msr_enable_event, \ | 493 | .enable_event = snbep_uncore_msr_enable_event, \ |
495 | .read_counter = uncore_msr_read_counter | 494 | .read_counter = uncore_msr_read_counter |
496 | 495 | ||
496 | #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ | ||
497 | __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), \ | ||
498 | .init_box = snbep_uncore_msr_init_box \ | ||
499 | |||
497 | static struct intel_uncore_ops snbep_uncore_msr_ops = { | 500 | static struct intel_uncore_ops snbep_uncore_msr_ops = { |
498 | SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), | 501 | SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), |
499 | }; | 502 | }; |
@@ -1919,6 +1922,30 @@ static struct intel_uncore_type hswep_uncore_cbox = { | |||
1919 | .format_group = &hswep_uncore_cbox_format_group, | 1922 | .format_group = &hswep_uncore_cbox_format_group, |
1920 | }; | 1923 | }; |
1921 | 1924 | ||
1925 | /* | ||
1926 | * Write SBOX Initialization register bit by bit to avoid spurious #GPs | ||
1927 | */ | ||
1928 | static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box) | ||
1929 | { | ||
1930 | unsigned msr = uncore_msr_box_ctl(box); | ||
1931 | |||
1932 | if (msr) { | ||
1933 | u64 init = SNBEP_PMON_BOX_CTL_INT; | ||
1934 | u64 flags = 0; | ||
1935 | int i; | ||
1936 | |||
1937 | for_each_set_bit(i, (unsigned long *)&init, 64) { | ||
1938 | flags |= (1ULL << i); | ||
1939 | wrmsrl(msr, flags); | ||
1940 | } | ||
1941 | } | ||
1942 | } | ||
1943 | |||
1944 | static struct intel_uncore_ops hswep_uncore_sbox_msr_ops = { | ||
1945 | __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), | ||
1946 | .init_box = hswep_uncore_sbox_msr_init_box | ||
1947 | }; | ||
1948 | |||
1922 | static struct attribute *hswep_uncore_sbox_formats_attr[] = { | 1949 | static struct attribute *hswep_uncore_sbox_formats_attr[] = { |
1923 | &format_attr_event.attr, | 1950 | &format_attr_event.attr, |
1924 | &format_attr_umask.attr, | 1951 | &format_attr_umask.attr, |
@@ -1944,7 +1971,7 @@ static struct intel_uncore_type hswep_uncore_sbox = { | |||
1944 | .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, | 1971 | .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, |
1945 | .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, | 1972 | .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, |
1946 | .msr_offset = HSWEP_SBOX_MSR_OFFSET, | 1973 | .msr_offset = HSWEP_SBOX_MSR_OFFSET, |
1947 | .ops = &snbep_uncore_msr_ops, | 1974 | .ops = &hswep_uncore_sbox_msr_ops, |
1948 | .format_group = &hswep_uncore_sbox_format_group, | 1975 | .format_group = &hswep_uncore_sbox_format_group, |
1949 | }; | 1976 | }; |
1950 | 1977 | ||
@@ -2025,13 +2052,27 @@ static struct intel_uncore_type hswep_uncore_imc = { | |||
2025 | SNBEP_UNCORE_PCI_COMMON_INIT(), | 2052 | SNBEP_UNCORE_PCI_COMMON_INIT(), |
2026 | }; | 2053 | }; |
2027 | 2054 | ||
2055 | static unsigned hswep_uncore_irp_ctrs[] = {0xa0, 0xa8, 0xb0, 0xb8}; | ||
2056 | |||
2057 | static u64 hswep_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event) | ||
2058 | { | ||
2059 | struct pci_dev *pdev = box->pci_dev; | ||
2060 | struct hw_perf_event *hwc = &event->hw; | ||
2061 | u64 count = 0; | ||
2062 | |||
2063 | pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx], (u32 *)&count); | ||
2064 | pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1); | ||
2065 | |||
2066 | return count; | ||
2067 | } | ||
2068 | |||
2028 | static struct intel_uncore_ops hswep_uncore_irp_ops = { | 2069 | static struct intel_uncore_ops hswep_uncore_irp_ops = { |
2029 | .init_box = snbep_uncore_pci_init_box, | 2070 | .init_box = snbep_uncore_pci_init_box, |
2030 | .disable_box = snbep_uncore_pci_disable_box, | 2071 | .disable_box = snbep_uncore_pci_disable_box, |
2031 | .enable_box = snbep_uncore_pci_enable_box, | 2072 | .enable_box = snbep_uncore_pci_enable_box, |
2032 | .disable_event = ivbep_uncore_irp_disable_event, | 2073 | .disable_event = ivbep_uncore_irp_disable_event, |
2033 | .enable_event = ivbep_uncore_irp_enable_event, | 2074 | .enable_event = ivbep_uncore_irp_enable_event, |
2034 | .read_counter = ivbep_uncore_irp_read_counter, | 2075 | .read_counter = hswep_uncore_irp_read_counter, |
2035 | }; | 2076 | }; |
2036 | 2077 | ||
2037 | static struct intel_uncore_type hswep_uncore_irp = { | 2078 | static struct intel_uncore_type hswep_uncore_irp = { |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 749b0e423419..e510618b2e91 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -1484,7 +1484,7 @@ unsigned long syscall_trace_enter_phase1(struct pt_regs *regs, u32 arch) | |||
1484 | */ | 1484 | */ |
1485 | if (work & _TIF_NOHZ) { | 1485 | if (work & _TIF_NOHZ) { |
1486 | user_exit(); | 1486 | user_exit(); |
1487 | work &= ~TIF_NOHZ; | 1487 | work &= ~_TIF_NOHZ; |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | #ifdef CONFIG_SECCOMP | 1490 | #ifdef CONFIG_SECCOMP |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 4d2128ac70bd..668d8f2a8781 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1303,10 +1303,14 @@ static void __ref remove_cpu_from_maps(int cpu) | |||
1303 | numa_remove_cpu(cpu); | 1303 | numa_remove_cpu(cpu); |
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
1307 | |||
1306 | void cpu_disable_common(void) | 1308 | void cpu_disable_common(void) |
1307 | { | 1309 | { |
1308 | int cpu = smp_processor_id(); | 1310 | int cpu = smp_processor_id(); |
1309 | 1311 | ||
1312 | init_completion(&per_cpu(die_complete, smp_processor_id())); | ||
1313 | |||
1310 | remove_siblinginfo(cpu); | 1314 | remove_siblinginfo(cpu); |
1311 | 1315 | ||
1312 | /* 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 */ |
@@ -1316,8 +1320,6 @@ void cpu_disable_common(void) | |||
1316 | fixup_irqs(); | 1320 | fixup_irqs(); |
1317 | } | 1321 | } |
1318 | 1322 | ||
1319 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
1320 | |||
1321 | int native_cpu_disable(void) | 1323 | int native_cpu_disable(void) |
1322 | { | 1324 | { |
1323 | int ret; | 1325 | int ret; |
@@ -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/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/init_64.c b/arch/x86/mm/init_64.c index 4cb8763868fc..4e5dfec750fc 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -1123,7 +1123,7 @@ void mark_rodata_ro(void) | |||
1123 | unsigned long end = (unsigned long) &__end_rodata_hpage_align; | 1123 | unsigned long end = (unsigned long) &__end_rodata_hpage_align; |
1124 | unsigned long text_end = PFN_ALIGN(&__stop___ex_table); | 1124 | unsigned long text_end = PFN_ALIGN(&__stop___ex_table); |
1125 | unsigned long rodata_end = PFN_ALIGN(&__end_rodata); | 1125 | unsigned long rodata_end = PFN_ALIGN(&__end_rodata); |
1126 | unsigned long all_end = PFN_ALIGN(&_end); | 1126 | unsigned long all_end; |
1127 | 1127 | ||
1128 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", | 1128 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", |
1129 | (end - start) >> 10); | 1129 | (end - start) >> 10); |
@@ -1134,7 +1134,16 @@ void mark_rodata_ro(void) | |||
1134 | /* | 1134 | /* |
1135 | * The rodata/data/bss/brk section (but not the kernel text!) | 1135 | * The rodata/data/bss/brk section (but not the kernel text!) |
1136 | * should also be not-executable. | 1136 | * should also be not-executable. |
1137 | * | ||
1138 | * We align all_end to PMD_SIZE because the existing mapping | ||
1139 | * is a full PMD. If we would align _brk_end to PAGE_SIZE we | ||
1140 | * split the PMD and the reminder between _brk_end and the end | ||
1141 | * of the PMD will remain mapped executable. | ||
1142 | * | ||
1143 | * Any PMD which was setup after the one which covers _brk_end | ||
1144 | * has been zapped already via cleanup_highmem(). | ||
1137 | */ | 1145 | */ |
1146 | all_end = roundup((unsigned long)_brk_end, PMD_SIZE); | ||
1138 | set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); | 1147 | set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); |
1139 | 1148 | ||
1140 | rodata_test(); | 1149 | rodata_test(); |
diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl new file mode 100644 index 000000000000..23210baade2d --- /dev/null +++ b/arch/x86/tools/calc_run_size.pl | |||
@@ -0,0 +1,39 @@ | |||
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 | # BFD linker shows the same file offset in ELF. | ||
23 | # Gold linker shows them as consecutive. | ||
24 | next if ($file_offset + $mem_size == $offset + $size); | ||
25 | |||
26 | printf STDERR "file_offset: 0x%lx\n", $file_offset; | ||
27 | printf STDERR "mem_size: 0x%lx\n", $mem_size; | ||
28 | printf STDERR "offset: 0x%lx\n", $offset; | ||
29 | printf STDERR "size: 0x%lx\n", $size; | ||
30 | |||
31 | die ".bss and .brk are non-contiguous\n"; | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | |||
36 | if ($file_offset == 0) { | ||
37 | die "Never found .bss or .brk file offset\n"; | ||
38 | } | ||
39 | 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/block/blk-merge.c b/block/blk-merge.c index b3ac40aef46b..89b97b5e0881 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -97,19 +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 | bool merge_not_need = bio->bi_vcnt < queue_max_segments(q); | 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; | ||
103 | 107 | ||
104 | if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) && | 108 | if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) && |
105 | merge_not_need) | 109 | (seg_cnt < queue_max_segments(q))) |
106 | bio->bi_phys_segments = bio->bi_vcnt; | 110 | bio->bi_phys_segments = seg_cnt; |
107 | else { | 111 | else { |
108 | struct bio *nxt = bio->bi_next; | 112 | struct bio *nxt = bio->bi_next; |
109 | 113 | ||
110 | bio->bi_next = NULL; | 114 | bio->bi_next = NULL; |
111 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, | 115 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, false); |
112 | no_sg_merge && merge_not_need); | ||
113 | bio->bi_next = nxt; | 116 | bio->bi_next = nxt; |
114 | } | 117 | } |
115 | 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/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 1e053d911240..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 | ||
@@ -531,9 +531,11 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
531 | } | 531 | } |
532 | 532 | ||
533 | error: | 533 | error: |
534 | blk_put_request(rq); | ||
535 | |||
536 | error_free_buffer: | ||
534 | kfree(buffer); | 537 | kfree(buffer); |
535 | if (rq) | 538 | |
536 | blk_put_request(rq); | ||
537 | return err; | 539 | return err; |
538 | } | 540 | } |
539 | 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/device_pm.c b/drivers/acpi/device_pm.c index 143ec6ea1468..7db193160766 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -878,7 +878,7 @@ int acpi_dev_suspend_late(struct device *dev) | |||
878 | return 0; | 878 | return 0; |
879 | 879 | ||
880 | target_state = acpi_target_system_state(); | 880 | target_state = acpi_target_system_state(); |
881 | wakeup = device_may_wakeup(dev); | 881 | wakeup = device_may_wakeup(dev) && acpi_device_can_wakeup(adev); |
882 | error = acpi_device_wakeup(adev, target_state, wakeup); | 882 | error = acpi_device_wakeup(adev, target_state, wakeup); |
883 | if (wakeup && error) | 883 | if (wakeup && error) |
884 | return error; | 884 | return error; |
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/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/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 23aaf40cf37f..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; |
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/dma/pl330.c b/drivers/dma/pl330.c index 4839bfa74a10..19a99743cf52 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -271,7 +271,7 @@ struct pl330_config { | |||
271 | #define DMAC_MODE_NS (1 << 0) | 271 | #define DMAC_MODE_NS (1 << 0) |
272 | unsigned int mode; | 272 | unsigned int mode; |
273 | unsigned int data_bus_width:10; /* In number of bits */ | 273 | unsigned int data_bus_width:10; /* In number of bits */ |
274 | unsigned int data_buf_dep:10; | 274 | unsigned int data_buf_dep:11; |
275 | unsigned int num_chan:4; | 275 | unsigned int num_chan:4; |
276 | unsigned int num_peri:6; | 276 | unsigned int num_peri:6; |
277 | u32 peri_ns; | 277 | u32 peri_ns; |
@@ -2336,7 +2336,7 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len) | |||
2336 | int burst_len; | 2336 | int burst_len; |
2337 | 2337 | ||
2338 | burst_len = pl330->pcfg.data_bus_width / 8; | 2338 | burst_len = pl330->pcfg.data_bus_width / 8; |
2339 | burst_len *= pl330->pcfg.data_buf_dep; | 2339 | burst_len *= pl330->pcfg.data_buf_dep / pl330->pcfg.num_chan; |
2340 | burst_len >>= desc->rqcfg.brst_size; | 2340 | burst_len >>= desc->rqcfg.brst_size; |
2341 | 2341 | ||
2342 | /* src/dst_burst_len can't be more than 16 */ | 2342 | /* src/dst_burst_len can't be more than 16 */ |
@@ -2459,16 +2459,25 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, | |||
2459 | /* Select max possible burst size */ | 2459 | /* Select max possible burst size */ |
2460 | burst = pl330->pcfg.data_bus_width / 8; | 2460 | burst = pl330->pcfg.data_bus_width / 8; |
2461 | 2461 | ||
2462 | while (burst > 1) { | 2462 | /* |
2463 | if (!(len % burst)) | 2463 | * Make sure we use a burst size that aligns with all the memcpy |
2464 | break; | 2464 | * parameters because our DMA programming algorithm doesn't cope with |
2465 | * transfers which straddle an entry in the DMA device's MFIFO. | ||
2466 | */ | ||
2467 | while ((src | dst | len) & (burst - 1)) | ||
2465 | burst /= 2; | 2468 | burst /= 2; |
2466 | } | ||
2467 | 2469 | ||
2468 | desc->rqcfg.brst_size = 0; | 2470 | desc->rqcfg.brst_size = 0; |
2469 | while (burst != (1 << desc->rqcfg.brst_size)) | 2471 | while (burst != (1 << desc->rqcfg.brst_size)) |
2470 | desc->rqcfg.brst_size++; | 2472 | desc->rqcfg.brst_size++; |
2471 | 2473 | ||
2474 | /* | ||
2475 | * If burst size is smaller than bus width then make sure we only | ||
2476 | * transfer one at a time to avoid a burst stradling an MFIFO entry. | ||
2477 | */ | ||
2478 | if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) | ||
2479 | desc->rqcfg.brst_len = 1; | ||
2480 | |||
2472 | desc->rqcfg.brst_len = get_burst_len(desc, len); | 2481 | desc->rqcfg.brst_len = get_burst_len(desc, len); |
2473 | 2482 | ||
2474 | desc->txd.flags = flags; | 2483 | desc->txd.flags = flags; |
@@ -2732,7 +2741,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2732 | 2741 | ||
2733 | 2742 | ||
2734 | dev_info(&adev->dev, | 2743 | dev_info(&adev->dev, |
2735 | "Loaded driver for PL330 DMAC-%d\n", adev->periphid); | 2744 | "Loaded driver for PL330 DMAC-%x\n", adev->periphid); |
2736 | dev_info(&adev->dev, | 2745 | dev_info(&adev->dev, |
2737 | "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", | 2746 | "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", |
2738 | pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan, | 2747 | pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan, |
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 3aa10b328254..91292f5513ff 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c | |||
@@ -230,30 +230,25 @@ static inline void sun6i_dma_dump_chan_regs(struct sun6i_dma_dev *sdev, | |||
230 | readl(pchan->base + DMA_CHAN_CUR_PARA)); | 230 | readl(pchan->base + DMA_CHAN_CUR_PARA)); |
231 | } | 231 | } |
232 | 232 | ||
233 | static inline int convert_burst(u32 maxburst, u8 *burst) | 233 | static inline s8 convert_burst(u32 maxburst) |
234 | { | 234 | { |
235 | switch (maxburst) { | 235 | switch (maxburst) { |
236 | case 1: | 236 | case 1: |
237 | *burst = 0; | 237 | return 0; |
238 | break; | ||
239 | case 8: | 238 | case 8: |
240 | *burst = 2; | 239 | return 2; |
241 | break; | ||
242 | default: | 240 | default: |
243 | return -EINVAL; | 241 | return -EINVAL; |
244 | } | 242 | } |
245 | |||
246 | return 0; | ||
247 | } | 243 | } |
248 | 244 | ||
249 | static inline int convert_buswidth(enum dma_slave_buswidth addr_width, u8 *width) | 245 | static inline s8 convert_buswidth(enum dma_slave_buswidth addr_width) |
250 | { | 246 | { |
251 | if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || | 247 | if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || |
252 | (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) | 248 | (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) |
253 | return -EINVAL; | 249 | return -EINVAL; |
254 | 250 | ||
255 | *width = addr_width >> 1; | 251 | return addr_width >> 1; |
256 | return 0; | ||
257 | } | 252 | } |
258 | 253 | ||
259 | static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, | 254 | static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, |
@@ -284,26 +279,25 @@ static inline int sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli, | |||
284 | struct dma_slave_config *config) | 279 | struct dma_slave_config *config) |
285 | { | 280 | { |
286 | u8 src_width, dst_width, src_burst, dst_burst; | 281 | u8 src_width, dst_width, src_burst, dst_burst; |
287 | int ret; | ||
288 | 282 | ||
289 | if (!config) | 283 | if (!config) |
290 | return -EINVAL; | 284 | return -EINVAL; |
291 | 285 | ||
292 | ret = convert_burst(config->src_maxburst, &src_burst); | 286 | src_burst = convert_burst(config->src_maxburst); |
293 | if (ret) | 287 | if (src_burst) |
294 | return ret; | 288 | return src_burst; |
295 | 289 | ||
296 | ret = convert_burst(config->dst_maxburst, &dst_burst); | 290 | dst_burst = convert_burst(config->dst_maxburst); |
297 | if (ret) | 291 | if (dst_burst) |
298 | return ret; | 292 | return dst_burst; |
299 | 293 | ||
300 | ret = convert_buswidth(config->src_addr_width, &src_width); | 294 | src_width = convert_buswidth(config->src_addr_width); |
301 | if (ret) | 295 | if (src_width) |
302 | return ret; | 296 | return src_width; |
303 | 297 | ||
304 | ret = convert_buswidth(config->dst_addr_width, &dst_width); | 298 | dst_width = convert_buswidth(config->dst_addr_width); |
305 | if (ret) | 299 | if (dst_width) |
306 | return ret; | 300 | return dst_width; |
307 | 301 | ||
308 | lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | | 302 | lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | |
309 | DMA_CHAN_CFG_SRC_WIDTH(src_width) | | 303 | DMA_CHAN_CFG_SRC_WIDTH(src_width) | |
@@ -542,11 +536,10 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
542 | { | 536 | { |
543 | struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); | 537 | struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); |
544 | struct sun6i_vchan *vchan = to_sun6i_vchan(chan); | 538 | struct sun6i_vchan *vchan = to_sun6i_vchan(chan); |
545 | struct dma_slave_config *sconfig = &vchan->cfg; | ||
546 | struct sun6i_dma_lli *v_lli; | 539 | struct sun6i_dma_lli *v_lli; |
547 | struct sun6i_desc *txd; | 540 | struct sun6i_desc *txd; |
548 | dma_addr_t p_lli; | 541 | dma_addr_t p_lli; |
549 | int ret; | 542 | s8 burst, width; |
550 | 543 | ||
551 | dev_dbg(chan2dev(chan), | 544 | dev_dbg(chan2dev(chan), |
552 | "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", | 545 | "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", |
@@ -565,14 +558,21 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
565 | goto err_txd_free; | 558 | goto err_txd_free; |
566 | } | 559 | } |
567 | 560 | ||
568 | ret = sun6i_dma_cfg_lli(v_lli, src, dest, len, sconfig); | 561 | v_lli->src = src; |
569 | if (ret) | 562 | v_lli->dst = dest; |
570 | goto err_dma_free; | 563 | v_lli->len = len; |
564 | v_lli->para = NORMAL_WAIT; | ||
571 | 565 | ||
566 | burst = convert_burst(8); | ||
567 | width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES); | ||
572 | v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | | 568 | v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | |
573 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | | 569 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | |
574 | DMA_CHAN_CFG_DST_LINEAR_MODE | | 570 | DMA_CHAN_CFG_DST_LINEAR_MODE | |
575 | DMA_CHAN_CFG_SRC_LINEAR_MODE; | 571 | DMA_CHAN_CFG_SRC_LINEAR_MODE | |
572 | DMA_CHAN_CFG_SRC_BURST(burst) | | ||
573 | DMA_CHAN_CFG_SRC_WIDTH(width) | | ||
574 | DMA_CHAN_CFG_DST_BURST(burst) | | ||
575 | DMA_CHAN_CFG_DST_WIDTH(width); | ||
576 | 576 | ||
577 | sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); | 577 | sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); |
578 | 578 | ||
@@ -580,8 +580,6 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
580 | 580 | ||
581 | return vchan_tx_prep(&vchan->vc, &txd->vd, flags); | 581 | return vchan_tx_prep(&vchan->vc, &txd->vd, flags); |
582 | 582 | ||
583 | err_dma_free: | ||
584 | dma_pool_free(sdev->pool, v_lli, p_lli); | ||
585 | err_txd_free: | 583 | err_txd_free: |
586 | kfree(txd); | 584 | kfree(txd); |
587 | return NULL; | 585 | return NULL; |
@@ -915,6 +913,7 @@ static int sun6i_dma_probe(struct platform_device *pdev) | |||
915 | sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; | 913 | sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; |
916 | sdc->slave.device_control = sun6i_dma_control; | 914 | sdc->slave.device_control = sun6i_dma_control; |
917 | sdc->slave.chancnt = NR_MAX_VCHANS; | 915 | sdc->slave.chancnt = NR_MAX_VCHANS; |
916 | sdc->slave.copy_align = 4; | ||
918 | 917 | ||
919 | sdc->slave.dev = &pdev->dev; | 918 | sdc->slave.dev = &pdev->dev; |
920 | 919 | ||
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/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index c57466edf45b..e5c4c6c8c967 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -495,6 +495,12 @@ static struct component_match *exynos_drm_match_add(struct device *dev) | |||
495 | 495 | ||
496 | mutex_lock(&drm_component_lock); | 496 | mutex_lock(&drm_component_lock); |
497 | 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 | |||
498 | list_for_each_entry(cdev, &drm_component_list, list) { | 504 | list_for_each_entry(cdev, &drm_component_list, list) { |
499 | /* | 505 | /* |
500 | * Add components to master only in case that crtc and | 506 | * Add components to master only in case that crtc and |
@@ -585,10 +591,21 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) | |||
585 | goto err_unregister_mixer_drv; | 591 | goto err_unregister_mixer_drv; |
586 | #endif | 592 | #endif |
587 | 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 | |||
588 | #ifdef CONFIG_DRM_EXYNOS_G2D | 605 | #ifdef CONFIG_DRM_EXYNOS_G2D |
589 | ret = platform_driver_register(&g2d_driver); | 606 | ret = platform_driver_register(&g2d_driver); |
590 | if (ret < 0) | 607 | if (ret < 0) |
591 | goto err_unregister_hdmi_drv; | 608 | goto err_del_component_master; |
592 | #endif | 609 | #endif |
593 | 610 | ||
594 | #ifdef CONFIG_DRM_EXYNOS_FIMC | 611 | #ifdef CONFIG_DRM_EXYNOS_FIMC |
@@ -619,23 +636,9 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) | |||
619 | goto err_unregister_ipp_drv; | 636 | goto err_unregister_ipp_drv; |
620 | #endif | 637 | #endif |
621 | 638 | ||
622 | match = exynos_drm_match_add(&pdev->dev); | ||
623 | if (IS_ERR(match)) { | ||
624 | ret = PTR_ERR(match); | ||
625 | goto err_unregister_resources; | ||
626 | } | ||
627 | |||
628 | ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, | ||
629 | match); | ||
630 | if (ret < 0) | ||
631 | goto err_unregister_resources; | ||
632 | |||
633 | return ret; | 639 | return ret; |
634 | 640 | ||
635 | err_unregister_resources: | ||
636 | |||
637 | #ifdef CONFIG_DRM_EXYNOS_IPP | 641 | #ifdef CONFIG_DRM_EXYNOS_IPP |
638 | exynos_platform_device_ipp_unregister(); | ||
639 | err_unregister_ipp_drv: | 642 | err_unregister_ipp_drv: |
640 | platform_driver_unregister(&ipp_driver); | 643 | platform_driver_unregister(&ipp_driver); |
641 | err_unregister_gsc_drv: | 644 | err_unregister_gsc_drv: |
@@ -658,9 +661,11 @@ err_unregister_g2d_drv: | |||
658 | 661 | ||
659 | #ifdef CONFIG_DRM_EXYNOS_G2D | 662 | #ifdef CONFIG_DRM_EXYNOS_G2D |
660 | platform_driver_unregister(&g2d_driver); | 663 | platform_driver_unregister(&g2d_driver); |
661 | err_unregister_hdmi_drv: | 664 | err_del_component_master: |
662 | #endif | 665 | #endif |
666 | component_master_del(&pdev->dev, &exynos_drm_ops); | ||
663 | 667 | ||
668 | err_unregister_hdmi_drv: | ||
664 | #ifdef CONFIG_DRM_EXYNOS_HDMI | 669 | #ifdef CONFIG_DRM_EXYNOS_HDMI |
665 | platform_driver_unregister(&hdmi_driver); | 670 | platform_driver_unregister(&hdmi_driver); |
666 | err_unregister_mixer_drv: | 671 | err_unregister_mixer_drv: |
@@ -741,6 +746,18 @@ static int exynos_drm_init(void) | |||
741 | { | 746 | { |
742 | int ret; | 747 | int ret; |
743 | 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 | |||
744 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, | 761 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, |
745 | NULL, 0); | 762 | NULL, 0); |
746 | if (IS_ERR(exynos_drm_pdev)) | 763 | if (IS_ERR(exynos_drm_pdev)) |
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/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 1403b01e8216..318ade9bb5af 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1670,15 +1670,17 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1670 | goto out_regs; | 1670 | goto out_regs; |
1671 | 1671 | ||
1672 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1672 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1673 | ret = i915_kick_out_vgacon(dev_priv); | 1673 | /* WARNING: Apparently we must kick fbdev drivers before vgacon, |
1674 | * otherwise the vga fbdev driver falls over. */ | ||
1675 | ret = i915_kick_out_firmware_fb(dev_priv); | ||
1674 | if (ret) { | 1676 | if (ret) { |
1675 | DRM_ERROR("failed to remove conflicting VGA console\n"); | 1677 | DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); |
1676 | goto out_gtt; | 1678 | goto out_gtt; |
1677 | } | 1679 | } |
1678 | 1680 | ||
1679 | ret = i915_kick_out_firmware_fb(dev_priv); | 1681 | ret = i915_kick_out_vgacon(dev_priv); |
1680 | if (ret) { | 1682 | if (ret) { |
1681 | DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); | 1683 | DRM_ERROR("failed to remove conflicting VGA console\n"); |
1682 | goto out_gtt; | 1684 | goto out_gtt; |
1683 | } | 1685 | } |
1684 | } | 1686 | } |
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_pm.c b/drivers/gpu/drm/i915/intel_pm.c index c27b6140bfd1..ad2fd605f76b 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -5469,11 +5469,6 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
5469 | I915_WRITE(_3D_CHICKEN, | 5469 | I915_WRITE(_3D_CHICKEN, |
5470 | _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); | 5470 | _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); |
5471 | 5471 | ||
5472 | /* WaSetupGtModeTdRowDispatch:snb */ | ||
5473 | if (IS_SNB_GT1(dev)) | ||
5474 | I915_WRITE(GEN6_GT_MODE, | ||
5475 | _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE)); | ||
5476 | |||
5477 | /* WaDisable_RenderCache_OperationalFlush:snb */ | 5472 | /* WaDisable_RenderCache_OperationalFlush:snb */ |
5478 | I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); | 5473 | I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
5479 | 5474 | ||
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/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index f6309bd23e01..b5c73df8e202 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -1256,7 +1256,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev) | |||
1256 | (mode_info->atom_context->bios + data_offset + | 1256 | (mode_info->atom_context->bios + data_offset + |
1257 | le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); | 1257 | le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); |
1258 | rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = | 1258 | rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = |
1259 | ppt->usMaximumPowerDeliveryLimit; | 1259 | le16_to_cpu(ppt->usMaximumPowerDeliveryLimit); |
1260 | pt = &ppt->power_tune_table; | 1260 | pt = &ppt->power_tune_table; |
1261 | } else { | 1261 | } else { |
1262 | ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) | 1262 | ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) |
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_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 9a19e52cc655..6b670b0bc47b 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -179,6 +179,9 @@ static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder, | |||
179 | (rdev->pdev->subsystem_vendor == 0x1734) && | 179 | (rdev->pdev->subsystem_vendor == 0x1734) && |
180 | (rdev->pdev->subsystem_device == 0x1107)) | 180 | (rdev->pdev->subsystem_device == 0x1107)) |
181 | use_bl = false; | 181 | use_bl = false; |
182 | /* disable native backlight control on older asics */ | ||
183 | else if (rdev->family < CHIP_R600) | ||
184 | use_bl = false; | ||
182 | else | 185 | else |
183 | use_bl = true; | 186 | use_bl = true; |
184 | } | 187 | } |
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/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 3effa931fce2..10641b7816f4 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -115,9 +115,12 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id, | |||
115 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; | 115 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; |
116 | /* | 116 | /* |
117 | * FIXME: Use devattr.max_sge - 2 for max_send_sge as | 117 | * FIXME: Use devattr.max_sge - 2 for max_send_sge as |
118 | * work-around for RDMA_READ.. | 118 | * work-around for RDMA_READs with ConnectX-2. |
119 | * | ||
120 | * Also, still make sure to have at least two SGEs for | ||
121 | * outgoing control PDU responses. | ||
119 | */ | 122 | */ |
120 | attr.cap.max_send_sge = device->dev_attr.max_sge - 2; | 123 | attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); |
121 | isert_conn->max_sge = attr.cap.max_send_sge; | 124 | isert_conn->max_sge = attr.cap.max_send_sge; |
122 | 125 | ||
123 | attr.cap.max_recv_sge = 1; | 126 | attr.cap.max_recv_sge = 1; |
@@ -225,12 +228,16 @@ isert_create_device_ib_res(struct isert_device *device) | |||
225 | struct isert_cq_desc *cq_desc; | 228 | struct isert_cq_desc *cq_desc; |
226 | struct ib_device_attr *dev_attr; | 229 | struct ib_device_attr *dev_attr; |
227 | int ret = 0, i, j; | 230 | int ret = 0, i, j; |
231 | int max_rx_cqe, max_tx_cqe; | ||
228 | 232 | ||
229 | dev_attr = &device->dev_attr; | 233 | dev_attr = &device->dev_attr; |
230 | ret = isert_query_device(ib_dev, dev_attr); | 234 | ret = isert_query_device(ib_dev, dev_attr); |
231 | if (ret) | 235 | if (ret) |
232 | return ret; | 236 | return ret; |
233 | 237 | ||
238 | max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe); | ||
239 | max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe); | ||
240 | |||
234 | /* asign function handlers */ | 241 | /* asign function handlers */ |
235 | if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && | 242 | if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && |
236 | dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) { | 243 | dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) { |
@@ -272,7 +279,7 @@ isert_create_device_ib_res(struct isert_device *device) | |||
272 | isert_cq_rx_callback, | 279 | isert_cq_rx_callback, |
273 | isert_cq_event_callback, | 280 | isert_cq_event_callback, |
274 | (void *)&cq_desc[i], | 281 | (void *)&cq_desc[i], |
275 | ISER_MAX_RX_CQ_LEN, i); | 282 | max_rx_cqe, i); |
276 | if (IS_ERR(device->dev_rx_cq[i])) { | 283 | if (IS_ERR(device->dev_rx_cq[i])) { |
277 | ret = PTR_ERR(device->dev_rx_cq[i]); | 284 | ret = PTR_ERR(device->dev_rx_cq[i]); |
278 | device->dev_rx_cq[i] = NULL; | 285 | device->dev_rx_cq[i] = NULL; |
@@ -284,7 +291,7 @@ isert_create_device_ib_res(struct isert_device *device) | |||
284 | isert_cq_tx_callback, | 291 | isert_cq_tx_callback, |
285 | isert_cq_event_callback, | 292 | isert_cq_event_callback, |
286 | (void *)&cq_desc[i], | 293 | (void *)&cq_desc[i], |
287 | ISER_MAX_TX_CQ_LEN, i); | 294 | max_tx_cqe, i); |
288 | if (IS_ERR(device->dev_tx_cq[i])) { | 295 | if (IS_ERR(device->dev_tx_cq[i])) { |
289 | ret = PTR_ERR(device->dev_tx_cq[i]); | 296 | ret = PTR_ERR(device->dev_tx_cq[i]); |
290 | device->dev_tx_cq[i] = NULL; | 297 | device->dev_tx_cq[i] = NULL; |
@@ -803,14 +810,25 @@ wake_up: | |||
803 | complete(&isert_conn->conn_wait); | 810 | complete(&isert_conn->conn_wait); |
804 | } | 811 | } |
805 | 812 | ||
806 | static void | 813 | static int |
807 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) | 814 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) |
808 | { | 815 | { |
809 | struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; | 816 | struct isert_conn *isert_conn; |
817 | |||
818 | if (!cma_id->qp) { | ||
819 | struct isert_np *isert_np = cma_id->context; | ||
820 | |||
821 | isert_np->np_cm_id = NULL; | ||
822 | return -1; | ||
823 | } | ||
824 | |||
825 | isert_conn = (struct isert_conn *)cma_id->context; | ||
810 | 826 | ||
811 | isert_conn->disconnect = disconnect; | 827 | isert_conn->disconnect = disconnect; |
812 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); | 828 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); |
813 | schedule_work(&isert_conn->conn_logout_work); | 829 | schedule_work(&isert_conn->conn_logout_work); |
830 | |||
831 | return 0; | ||
814 | } | 832 | } |
815 | 833 | ||
816 | static int | 834 | static int |
@@ -825,6 +843,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
825 | switch (event->event) { | 843 | switch (event->event) { |
826 | case RDMA_CM_EVENT_CONNECT_REQUEST: | 844 | case RDMA_CM_EVENT_CONNECT_REQUEST: |
827 | ret = isert_connect_request(cma_id, event); | 845 | ret = isert_connect_request(cma_id, event); |
846 | if (ret) | ||
847 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
848 | event->event, ret); | ||
828 | break; | 849 | break; |
829 | case RDMA_CM_EVENT_ESTABLISHED: | 850 | case RDMA_CM_EVENT_ESTABLISHED: |
830 | isert_connected_handler(cma_id); | 851 | isert_connected_handler(cma_id); |
@@ -834,7 +855,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
834 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ | 855 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ |
835 | disconnect = true; | 856 | disconnect = true; |
836 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ | 857 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ |
837 | isert_disconnected_handler(cma_id, disconnect); | 858 | ret = isert_disconnected_handler(cma_id, disconnect); |
838 | break; | 859 | break; |
839 | case RDMA_CM_EVENT_CONNECT_ERROR: | 860 | case RDMA_CM_EVENT_CONNECT_ERROR: |
840 | default: | 861 | default: |
@@ -842,12 +863,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
842 | break; | 863 | break; |
843 | } | 864 | } |
844 | 865 | ||
845 | if (ret != 0) { | ||
846 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
847 | event->event, ret); | ||
848 | dump_stack(); | ||
849 | } | ||
850 | |||
851 | return ret; | 866 | return ret; |
852 | } | 867 | } |
853 | 868 | ||
@@ -3190,7 +3205,8 @@ isert_free_np(struct iscsi_np *np) | |||
3190 | { | 3205 | { |
3191 | struct isert_np *isert_np = (struct isert_np *)np->np_context; | 3206 | struct isert_np *isert_np = (struct isert_np *)np->np_context; |
3192 | 3207 | ||
3193 | rdma_destroy_id(isert_np->np_cm_id); | 3208 | if (isert_np->np_cm_id) |
3209 | rdma_destroy_id(isert_np->np_cm_id); | ||
3194 | 3210 | ||
3195 | np->np_context = NULL; | 3211 | np->np_context = NULL; |
3196 | kfree(isert_np); | 3212 | kfree(isert_np); |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 7206547c13ce..dc829682701a 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -2092,6 +2092,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) | |||
2092 | if (!qp_init) | 2092 | if (!qp_init) |
2093 | goto out; | 2093 | goto out; |
2094 | 2094 | ||
2095 | retry: | ||
2095 | ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, | 2096 | ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, |
2096 | ch->rq_size + srp_sq_size, 0); | 2097 | ch->rq_size + srp_sq_size, 0); |
2097 | if (IS_ERR(ch->cq)) { | 2098 | if (IS_ERR(ch->cq)) { |
@@ -2115,6 +2116,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) | |||
2115 | ch->qp = ib_create_qp(sdev->pd, qp_init); | 2116 | ch->qp = ib_create_qp(sdev->pd, qp_init); |
2116 | if (IS_ERR(ch->qp)) { | 2117 | if (IS_ERR(ch->qp)) { |
2117 | ret = PTR_ERR(ch->qp); | 2118 | ret = PTR_ERR(ch->qp); |
2119 | if (ret == -ENOMEM) { | ||
2120 | srp_sq_size /= 2; | ||
2121 | if (srp_sq_size >= MIN_SRPT_SQ_SIZE) { | ||
2122 | ib_destroy_cq(ch->cq); | ||
2123 | goto retry; | ||
2124 | } | ||
2125 | } | ||
2118 | printk(KERN_ERR "failed to create_qp ret= %d\n", ret); | 2126 | printk(KERN_ERR "failed to create_qp ret= %d\n", ret); |
2119 | goto err_destroy_cq; | 2127 | goto err_destroy_cq; |
2120 | } | 2128 | } |
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/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/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/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index c1d7da427a3e..184c434ae305 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2470,7 +2470,8 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2470 | bond_slave_state_change(bond); | 2470 | bond_slave_state_change(bond); |
2471 | if (BOND_MODE(bond) == BOND_MODE_XOR) | 2471 | if (BOND_MODE(bond) == BOND_MODE_XOR) |
2472 | bond_update_slave_arr(bond, NULL); | 2472 | bond_update_slave_arr(bond, NULL); |
2473 | } else if (do_failover) { | 2473 | } |
2474 | if (do_failover) { | ||
2474 | block_netpoll_tx(); | 2475 | block_netpoll_tx(); |
2475 | bond_select_active_slave(bond); | 2476 | bond_select_active_slave(bond); |
2476 | unblock_netpoll_tx(); | 2477 | unblock_netpoll_tx(); |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 02492d241e4c..2cfe5012e4e5 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -110,7 +110,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, | |||
110 | long rate; | 110 | long rate; |
111 | u64 v64; | 111 | u64 v64; |
112 | 112 | ||
113 | /* Use CIA recommended sample points */ | 113 | /* Use CiA recommended sample points */ |
114 | if (bt->sample_point) { | 114 | if (bt->sample_point) { |
115 | sampl_pt = bt->sample_point; | 115 | sampl_pt = bt->sample_point; |
116 | } else { | 116 | } else { |
@@ -382,7 +382,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx) | |||
382 | BUG_ON(idx >= priv->echo_skb_max); | 382 | BUG_ON(idx >= priv->echo_skb_max); |
383 | 383 | ||
384 | if (priv->echo_skb[idx]) { | 384 | if (priv->echo_skb[idx]) { |
385 | kfree_skb(priv->echo_skb[idx]); | 385 | dev_kfree_skb_any(priv->echo_skb[idx]); |
386 | priv->echo_skb[idx] = NULL; | 386 | priv->echo_skb[idx] = NULL; |
387 | } | 387 | } |
388 | } | 388 | } |
diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig index fca5482c09ac..04f20dd39007 100644 --- a/drivers/net/can/m_can/Kconfig +++ b/drivers/net/can/m_can/Kconfig | |||
@@ -1,4 +1,5 @@ | |||
1 | config CAN_M_CAN | 1 | config CAN_M_CAN |
2 | depends on HAS_IOMEM | ||
2 | tristate "Bosch M_CAN devices" | 3 | tristate "Bosch M_CAN devices" |
3 | ---help--- | 4 | ---help--- |
4 | Say Y here if you want to support for Bosch M_CAN controller. | 5 | Say Y here if you want to support for Bosch M_CAN controller. |
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 10d571eaed85..d7bc462aafdc 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c | |||
@@ -105,14 +105,36 @@ enum m_can_mram_cfg { | |||
105 | MRAM_CFG_NUM, | 105 | MRAM_CFG_NUM, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | /* Fast Bit Timing & Prescaler Register (FBTP) */ | ||
109 | #define FBTR_FBRP_MASK 0x1f | ||
110 | #define FBTR_FBRP_SHIFT 16 | ||
111 | #define FBTR_FTSEG1_SHIFT 8 | ||
112 | #define FBTR_FTSEG1_MASK (0xf << FBTR_FTSEG1_SHIFT) | ||
113 | #define FBTR_FTSEG2_SHIFT 4 | ||
114 | #define FBTR_FTSEG2_MASK (0x7 << FBTR_FTSEG2_SHIFT) | ||
115 | #define FBTR_FSJW_SHIFT 0 | ||
116 | #define FBTR_FSJW_MASK 0x3 | ||
117 | |||
108 | /* Test Register (TEST) */ | 118 | /* Test Register (TEST) */ |
109 | #define TEST_LBCK BIT(4) | 119 | #define TEST_LBCK BIT(4) |
110 | 120 | ||
111 | /* CC Control Register(CCCR) */ | 121 | /* CC Control Register(CCCR) */ |
112 | #define CCCR_TEST BIT(7) | 122 | #define CCCR_TEST BIT(7) |
113 | #define CCCR_MON BIT(5) | 123 | #define CCCR_CMR_MASK 0x3 |
114 | #define CCCR_CCE BIT(1) | 124 | #define CCCR_CMR_SHIFT 10 |
115 | #define CCCR_INIT BIT(0) | 125 | #define CCCR_CMR_CANFD 0x1 |
126 | #define CCCR_CMR_CANFD_BRS 0x2 | ||
127 | #define CCCR_CMR_CAN 0x3 | ||
128 | #define CCCR_CME_MASK 0x3 | ||
129 | #define CCCR_CME_SHIFT 8 | ||
130 | #define CCCR_CME_CAN 0 | ||
131 | #define CCCR_CME_CANFD 0x1 | ||
132 | #define CCCR_CME_CANFD_BRS 0x2 | ||
133 | #define CCCR_TEST BIT(7) | ||
134 | #define CCCR_MON BIT(5) | ||
135 | #define CCCR_CCE BIT(1) | ||
136 | #define CCCR_INIT BIT(0) | ||
137 | #define CCCR_CANFD 0x10 | ||
116 | 138 | ||
117 | /* Bit Timing & Prescaler Register (BTP) */ | 139 | /* Bit Timing & Prescaler Register (BTP) */ |
118 | #define BTR_BRP_MASK 0x3ff | 140 | #define BTR_BRP_MASK 0x3ff |
@@ -204,6 +226,7 @@ enum m_can_mram_cfg { | |||
204 | 226 | ||
205 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ | 227 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ |
206 | #define M_CAN_RXESC_8BYTES 0x0 | 228 | #define M_CAN_RXESC_8BYTES 0x0 |
229 | #define M_CAN_RXESC_64BYTES 0x777 | ||
207 | 230 | ||
208 | /* Tx Buffer Configuration(TXBC) */ | 231 | /* Tx Buffer Configuration(TXBC) */ |
209 | #define TXBC_NDTB_OFF 16 | 232 | #define TXBC_NDTB_OFF 16 |
@@ -211,6 +234,7 @@ enum m_can_mram_cfg { | |||
211 | 234 | ||
212 | /* Tx Buffer Element Size Configuration(TXESC) */ | 235 | /* Tx Buffer Element Size Configuration(TXESC) */ |
213 | #define TXESC_TBDS_8BYTES 0x0 | 236 | #define TXESC_TBDS_8BYTES 0x0 |
237 | #define TXESC_TBDS_64BYTES 0x7 | ||
214 | 238 | ||
215 | /* Tx Event FIFO Con.guration (TXEFC) */ | 239 | /* Tx Event FIFO Con.guration (TXEFC) */ |
216 | #define TXEFC_EFS_OFF 16 | 240 | #define TXEFC_EFS_OFF 16 |
@@ -219,11 +243,11 @@ enum m_can_mram_cfg { | |||
219 | /* Message RAM Configuration (in bytes) */ | 243 | /* Message RAM Configuration (in bytes) */ |
220 | #define SIDF_ELEMENT_SIZE 4 | 244 | #define SIDF_ELEMENT_SIZE 4 |
221 | #define XIDF_ELEMENT_SIZE 8 | 245 | #define XIDF_ELEMENT_SIZE 8 |
222 | #define RXF0_ELEMENT_SIZE 16 | 246 | #define RXF0_ELEMENT_SIZE 72 |
223 | #define RXF1_ELEMENT_SIZE 16 | 247 | #define RXF1_ELEMENT_SIZE 72 |
224 | #define RXB_ELEMENT_SIZE 16 | 248 | #define RXB_ELEMENT_SIZE 16 |
225 | #define TXE_ELEMENT_SIZE 8 | 249 | #define TXE_ELEMENT_SIZE 8 |
226 | #define TXB_ELEMENT_SIZE 16 | 250 | #define TXB_ELEMENT_SIZE 72 |
227 | 251 | ||
228 | /* Message RAM Elements */ | 252 | /* Message RAM Elements */ |
229 | #define M_CAN_FIFO_ID 0x0 | 253 | #define M_CAN_FIFO_ID 0x0 |
@@ -231,11 +255,17 @@ enum m_can_mram_cfg { | |||
231 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) | 255 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) |
232 | 256 | ||
233 | /* Rx Buffer Element */ | 257 | /* Rx Buffer Element */ |
258 | /* R0 */ | ||
234 | #define RX_BUF_ESI BIT(31) | 259 | #define RX_BUF_ESI BIT(31) |
235 | #define RX_BUF_XTD BIT(30) | 260 | #define RX_BUF_XTD BIT(30) |
236 | #define RX_BUF_RTR BIT(29) | 261 | #define RX_BUF_RTR BIT(29) |
262 | /* R1 */ | ||
263 | #define RX_BUF_ANMF BIT(31) | ||
264 | #define RX_BUF_EDL BIT(21) | ||
265 | #define RX_BUF_BRS BIT(20) | ||
237 | 266 | ||
238 | /* Tx Buffer Element */ | 267 | /* Tx Buffer Element */ |
268 | /* R0 */ | ||
239 | #define TX_BUF_XTD BIT(30) | 269 | #define TX_BUF_XTD BIT(30) |
240 | #define TX_BUF_RTR BIT(29) | 270 | #define TX_BUF_RTR BIT(29) |
241 | 271 | ||
@@ -296,6 +326,7 @@ static inline void m_can_config_endisable(const struct m_can_priv *priv, | |||
296 | if (enable) { | 326 | if (enable) { |
297 | /* enable m_can configuration */ | 327 | /* enable m_can configuration */ |
298 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); | 328 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); |
329 | udelay(5); | ||
299 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ | 330 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ |
300 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); | 331 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); |
301 | } else { | 332 | } else { |
@@ -326,41 +357,67 @@ static inline void m_can_disable_all_interrupts(const struct m_can_priv *priv) | |||
326 | m_can_write(priv, M_CAN_ILE, 0x0); | 357 | m_can_write(priv, M_CAN_ILE, 0x0); |
327 | } | 358 | } |
328 | 359 | ||
329 | static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, | 360 | static void m_can_read_fifo(struct net_device *dev, u32 rxfs) |
330 | u32 rxfs) | ||
331 | { | 361 | { |
362 | struct net_device_stats *stats = &dev->stats; | ||
332 | struct m_can_priv *priv = netdev_priv(dev); | 363 | struct m_can_priv *priv = netdev_priv(dev); |
333 | u32 id, fgi; | 364 | struct canfd_frame *cf; |
365 | struct sk_buff *skb; | ||
366 | u32 id, fgi, dlc; | ||
367 | int i; | ||
334 | 368 | ||
335 | /* calculate the fifo get index for where to read data */ | 369 | /* calculate the fifo get index for where to read data */ |
336 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; | 370 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; |
371 | dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | ||
372 | if (dlc & RX_BUF_EDL) | ||
373 | skb = alloc_canfd_skb(dev, &cf); | ||
374 | else | ||
375 | skb = alloc_can_skb(dev, (struct can_frame **)&cf); | ||
376 | if (!skb) { | ||
377 | stats->rx_dropped++; | ||
378 | return; | ||
379 | } | ||
380 | |||
381 | if (dlc & RX_BUF_EDL) | ||
382 | cf->len = can_dlc2len((dlc >> 16) & 0x0F); | ||
383 | else | ||
384 | cf->len = get_can_dlc((dlc >> 16) & 0x0F); | ||
385 | |||
337 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); | 386 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); |
338 | if (id & RX_BUF_XTD) | 387 | if (id & RX_BUF_XTD) |
339 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; | 388 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; |
340 | else | 389 | else |
341 | cf->can_id = (id >> 18) & CAN_SFF_MASK; | 390 | cf->can_id = (id >> 18) & CAN_SFF_MASK; |
342 | 391 | ||
343 | if (id & RX_BUF_RTR) { | 392 | if (id & RX_BUF_ESI) { |
393 | cf->flags |= CANFD_ESI; | ||
394 | netdev_dbg(dev, "ESI Error\n"); | ||
395 | } | ||
396 | |||
397 | if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) { | ||
344 | cf->can_id |= CAN_RTR_FLAG; | 398 | cf->can_id |= CAN_RTR_FLAG; |
345 | } else { | 399 | } else { |
346 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | 400 | if (dlc & RX_BUF_BRS) |
347 | cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); | 401 | cf->flags |= CANFD_BRS; |
348 | *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, | 402 | |
349 | M_CAN_FIFO_DATA(0)); | 403 | for (i = 0; i < cf->len; i += 4) |
350 | *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, | 404 | *(u32 *)(cf->data + i) = |
351 | M_CAN_FIFO_DATA(1)); | 405 | m_can_fifo_read(priv, fgi, |
406 | M_CAN_FIFO_DATA(i / 4)); | ||
352 | } | 407 | } |
353 | 408 | ||
354 | /* acknowledge rx fifo 0 */ | 409 | /* acknowledge rx fifo 0 */ |
355 | m_can_write(priv, M_CAN_RXF0A, fgi); | 410 | m_can_write(priv, M_CAN_RXF0A, fgi); |
411 | |||
412 | stats->rx_packets++; | ||
413 | stats->rx_bytes += cf->len; | ||
414 | |||
415 | netif_receive_skb(skb); | ||
356 | } | 416 | } |
357 | 417 | ||
358 | static int m_can_do_rx_poll(struct net_device *dev, int quota) | 418 | static int m_can_do_rx_poll(struct net_device *dev, int quota) |
359 | { | 419 | { |
360 | struct m_can_priv *priv = netdev_priv(dev); | 420 | struct m_can_priv *priv = netdev_priv(dev); |
361 | struct net_device_stats *stats = &dev->stats; | ||
362 | struct sk_buff *skb; | ||
363 | struct can_frame *frame; | ||
364 | u32 pkts = 0; | 421 | u32 pkts = 0; |
365 | u32 rxfs; | 422 | u32 rxfs; |
366 | 423 | ||
@@ -374,18 +431,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota) | |||
374 | if (rxfs & RXFS_RFL) | 431 | if (rxfs & RXFS_RFL) |
375 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); | 432 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); |
376 | 433 | ||
377 | skb = alloc_can_skb(dev, &frame); | 434 | m_can_read_fifo(dev, rxfs); |
378 | if (!skb) { | ||
379 | stats->rx_dropped++; | ||
380 | return pkts; | ||
381 | } | ||
382 | |||
383 | m_can_read_fifo(dev, frame, rxfs); | ||
384 | |||
385 | stats->rx_packets++; | ||
386 | stats->rx_bytes += frame->can_dlc; | ||
387 | |||
388 | netif_receive_skb(skb); | ||
389 | 435 | ||
390 | quota--; | 436 | quota--; |
391 | pkts++; | 437 | pkts++; |
@@ -481,11 +527,23 @@ static int m_can_handle_lec_err(struct net_device *dev, | |||
481 | return 1; | 527 | return 1; |
482 | } | 528 | } |
483 | 529 | ||
530 | static int __m_can_get_berr_counter(const struct net_device *dev, | ||
531 | struct can_berr_counter *bec) | ||
532 | { | ||
533 | struct m_can_priv *priv = netdev_priv(dev); | ||
534 | unsigned int ecr; | ||
535 | |||
536 | ecr = m_can_read(priv, M_CAN_ECR); | ||
537 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
538 | bec->txerr = ecr & ECR_TEC_MASK; | ||
539 | |||
540 | return 0; | ||
541 | } | ||
542 | |||
484 | static int m_can_get_berr_counter(const struct net_device *dev, | 543 | static int m_can_get_berr_counter(const struct net_device *dev, |
485 | struct can_berr_counter *bec) | 544 | struct can_berr_counter *bec) |
486 | { | 545 | { |
487 | struct m_can_priv *priv = netdev_priv(dev); | 546 | struct m_can_priv *priv = netdev_priv(dev); |
488 | unsigned int ecr; | ||
489 | int err; | 547 | int err; |
490 | 548 | ||
491 | err = clk_prepare_enable(priv->hclk); | 549 | err = clk_prepare_enable(priv->hclk); |
@@ -498,9 +556,7 @@ static int m_can_get_berr_counter(const struct net_device *dev, | |||
498 | return err; | 556 | return err; |
499 | } | 557 | } |
500 | 558 | ||
501 | ecr = m_can_read(priv, M_CAN_ECR); | 559 | __m_can_get_berr_counter(dev, bec); |
502 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
503 | bec->txerr = ecr & ECR_TEC_MASK; | ||
504 | 560 | ||
505 | clk_disable_unprepare(priv->cclk); | 561 | clk_disable_unprepare(priv->cclk); |
506 | clk_disable_unprepare(priv->hclk); | 562 | clk_disable_unprepare(priv->hclk); |
@@ -544,7 +600,7 @@ static int m_can_handle_state_change(struct net_device *dev, | |||
544 | if (unlikely(!skb)) | 600 | if (unlikely(!skb)) |
545 | return 0; | 601 | return 0; |
546 | 602 | ||
547 | m_can_get_berr_counter(dev, &bec); | 603 | __m_can_get_berr_counter(dev, &bec); |
548 | 604 | ||
549 | switch (new_state) { | 605 | switch (new_state) { |
550 | case CAN_STATE_ERROR_ACTIVE: | 606 | case CAN_STATE_ERROR_ACTIVE: |
@@ -596,14 +652,14 @@ static int m_can_handle_state_errors(struct net_device *dev, u32 psr) | |||
596 | 652 | ||
597 | if ((psr & PSR_EP) && | 653 | if ((psr & PSR_EP) && |
598 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { | 654 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { |
599 | netdev_dbg(dev, "entered error warning state\n"); | 655 | netdev_dbg(dev, "entered error passive state\n"); |
600 | work_done += m_can_handle_state_change(dev, | 656 | work_done += m_can_handle_state_change(dev, |
601 | CAN_STATE_ERROR_PASSIVE); | 657 | CAN_STATE_ERROR_PASSIVE); |
602 | } | 658 | } |
603 | 659 | ||
604 | if ((psr & PSR_BO) && | 660 | if ((psr & PSR_BO) && |
605 | (priv->can.state != CAN_STATE_BUS_OFF)) { | 661 | (priv->can.state != CAN_STATE_BUS_OFF)) { |
606 | netdev_dbg(dev, "entered error warning state\n"); | 662 | netdev_dbg(dev, "entered error bus off state\n"); |
607 | work_done += m_can_handle_state_change(dev, | 663 | work_done += m_can_handle_state_change(dev, |
608 | CAN_STATE_BUS_OFF); | 664 | CAN_STATE_BUS_OFF); |
609 | } | 665 | } |
@@ -615,7 +671,7 @@ static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus) | |||
615 | { | 671 | { |
616 | if (irqstatus & IR_WDI) | 672 | if (irqstatus & IR_WDI) |
617 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); | 673 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); |
618 | if (irqstatus & IR_BEU) | 674 | if (irqstatus & IR_ELO) |
619 | netdev_err(dev, "Error Logging Overflow\n"); | 675 | netdev_err(dev, "Error Logging Overflow\n"); |
620 | if (irqstatus & IR_BEU) | 676 | if (irqstatus & IR_BEU) |
621 | netdev_err(dev, "Bit Error Uncorrected\n"); | 677 | netdev_err(dev, "Bit Error Uncorrected\n"); |
@@ -733,10 +789,23 @@ static const struct can_bittiming_const m_can_bittiming_const = { | |||
733 | .brp_inc = 1, | 789 | .brp_inc = 1, |
734 | }; | 790 | }; |
735 | 791 | ||
792 | static const struct can_bittiming_const m_can_data_bittiming_const = { | ||
793 | .name = KBUILD_MODNAME, | ||
794 | .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ | ||
795 | .tseg1_max = 16, | ||
796 | .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ | ||
797 | .tseg2_max = 8, | ||
798 | .sjw_max = 4, | ||
799 | .brp_min = 1, | ||
800 | .brp_max = 32, | ||
801 | .brp_inc = 1, | ||
802 | }; | ||
803 | |||
736 | static int m_can_set_bittiming(struct net_device *dev) | 804 | static int m_can_set_bittiming(struct net_device *dev) |
737 | { | 805 | { |
738 | struct m_can_priv *priv = netdev_priv(dev); | 806 | struct m_can_priv *priv = netdev_priv(dev); |
739 | const struct can_bittiming *bt = &priv->can.bittiming; | 807 | const struct can_bittiming *bt = &priv->can.bittiming; |
808 | const struct can_bittiming *dbt = &priv->can.data_bittiming; | ||
740 | u16 brp, sjw, tseg1, tseg2; | 809 | u16 brp, sjw, tseg1, tseg2; |
741 | u32 reg_btp; | 810 | u32 reg_btp; |
742 | 811 | ||
@@ -747,7 +816,17 @@ static int m_can_set_bittiming(struct net_device *dev) | |||
747 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | | 816 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | |
748 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); | 817 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); |
749 | m_can_write(priv, M_CAN_BTP, reg_btp); | 818 | m_can_write(priv, M_CAN_BTP, reg_btp); |
750 | netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp); | 819 | |
820 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
821 | brp = dbt->brp - 1; | ||
822 | sjw = dbt->sjw - 1; | ||
823 | tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1; | ||
824 | tseg2 = dbt->phase_seg2 - 1; | ||
825 | reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) | | ||
826 | (tseg1 << FBTR_FTSEG1_SHIFT) | | ||
827 | (tseg2 << FBTR_FTSEG2_SHIFT); | ||
828 | m_can_write(priv, M_CAN_FBTP, reg_btp); | ||
829 | } | ||
751 | 830 | ||
752 | return 0; | 831 | return 0; |
753 | } | 832 | } |
@@ -767,8 +846,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
767 | 846 | ||
768 | m_can_config_endisable(priv, true); | 847 | m_can_config_endisable(priv, true); |
769 | 848 | ||
770 | /* RX Buffer/FIFO Element Size 8 bytes data field */ | 849 | /* RX Buffer/FIFO Element Size 64 bytes data field */ |
771 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES); | 850 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES); |
772 | 851 | ||
773 | /* Accept Non-matching Frames Into FIFO 0 */ | 852 | /* Accept Non-matching Frames Into FIFO 0 */ |
774 | m_can_write(priv, M_CAN_GFC, 0x0); | 853 | m_can_write(priv, M_CAN_GFC, 0x0); |
@@ -777,8 +856,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
777 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | | 856 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | |
778 | priv->mcfg[MRAM_TXB].off); | 857 | priv->mcfg[MRAM_TXB].off); |
779 | 858 | ||
780 | /* only support 8 bytes firstly */ | 859 | /* support 64 bytes payload */ |
781 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES); | 860 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES); |
782 | 861 | ||
783 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | | 862 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | |
784 | priv->mcfg[MRAM_TXE].off); | 863 | priv->mcfg[MRAM_TXE].off); |
@@ -793,7 +872,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
793 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); | 872 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); |
794 | 873 | ||
795 | cccr = m_can_read(priv, M_CAN_CCCR); | 874 | cccr = m_can_read(priv, M_CAN_CCCR); |
796 | cccr &= ~(CCCR_TEST | CCCR_MON); | 875 | cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) | |
876 | (CCCR_CME_MASK << CCCR_CME_SHIFT)); | ||
797 | test = m_can_read(priv, M_CAN_TEST); | 877 | test = m_can_read(priv, M_CAN_TEST); |
798 | test &= ~TEST_LBCK; | 878 | test &= ~TEST_LBCK; |
799 | 879 | ||
@@ -805,6 +885,9 @@ static void m_can_chip_config(struct net_device *dev) | |||
805 | test |= TEST_LBCK; | 885 | test |= TEST_LBCK; |
806 | } | 886 | } |
807 | 887 | ||
888 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) | ||
889 | cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT; | ||
890 | |||
808 | m_can_write(priv, M_CAN_CCCR, cccr); | 891 | m_can_write(priv, M_CAN_CCCR, cccr); |
809 | m_can_write(priv, M_CAN_TEST, test); | 892 | m_can_write(priv, M_CAN_TEST, test); |
810 | 893 | ||
@@ -869,11 +952,13 @@ static struct net_device *alloc_m_can_dev(void) | |||
869 | 952 | ||
870 | priv->dev = dev; | 953 | priv->dev = dev; |
871 | priv->can.bittiming_const = &m_can_bittiming_const; | 954 | priv->can.bittiming_const = &m_can_bittiming_const; |
955 | priv->can.data_bittiming_const = &m_can_data_bittiming_const; | ||
872 | priv->can.do_set_mode = m_can_set_mode; | 956 | priv->can.do_set_mode = m_can_set_mode; |
873 | priv->can.do_get_berr_counter = m_can_get_berr_counter; | 957 | priv->can.do_get_berr_counter = m_can_get_berr_counter; |
874 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | | 958 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | |
875 | CAN_CTRLMODE_LISTENONLY | | 959 | CAN_CTRLMODE_LISTENONLY | |
876 | CAN_CTRLMODE_BERR_REPORTING; | 960 | CAN_CTRLMODE_BERR_REPORTING | |
961 | CAN_CTRLMODE_FD; | ||
877 | 962 | ||
878 | return dev; | 963 | return dev; |
879 | } | 964 | } |
@@ -956,8 +1041,9 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
956 | struct net_device *dev) | 1041 | struct net_device *dev) |
957 | { | 1042 | { |
958 | struct m_can_priv *priv = netdev_priv(dev); | 1043 | struct m_can_priv *priv = netdev_priv(dev); |
959 | struct can_frame *cf = (struct can_frame *)skb->data; | 1044 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; |
960 | u32 id; | 1045 | u32 id, cccr; |
1046 | int i; | ||
961 | 1047 | ||
962 | if (can_dropped_invalid_skb(dev, skb)) | 1048 | if (can_dropped_invalid_skb(dev, skb)) |
963 | return NETDEV_TX_OK; | 1049 | return NETDEV_TX_OK; |
@@ -976,11 +1062,28 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
976 | 1062 | ||
977 | /* message ram configuration */ | 1063 | /* message ram configuration */ |
978 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); | 1064 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); |
979 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16); | 1065 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16); |
980 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0)); | 1066 | |
981 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4)); | 1067 | for (i = 0; i < cf->len; i += 4) |
1068 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4), | ||
1069 | *(u32 *)(cf->data + i)); | ||
1070 | |||
982 | can_put_echo_skb(skb, dev, 0); | 1071 | can_put_echo_skb(skb, dev, 0); |
983 | 1072 | ||
1073 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
1074 | cccr = m_can_read(priv, M_CAN_CCCR); | ||
1075 | cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); | ||
1076 | if (can_is_canfd_skb(skb)) { | ||
1077 | if (cf->flags & CANFD_BRS) | ||
1078 | cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT; | ||
1079 | else | ||
1080 | cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT; | ||
1081 | } else { | ||
1082 | cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT; | ||
1083 | } | ||
1084 | m_can_write(priv, M_CAN_CCCR, cccr); | ||
1085 | } | ||
1086 | |||
984 | /* enable first TX buffer to start transfer */ | 1087 | /* enable first TX buffer to start transfer */ |
985 | m_can_write(priv, M_CAN_TXBTIE, 0x1); | 1088 | m_can_write(priv, M_CAN_TXBTIE, 0x1); |
986 | m_can_write(priv, M_CAN_TXBAR, 0x1); | 1089 | m_can_write(priv, M_CAN_TXBAR, 0x1); |
@@ -992,6 +1095,7 @@ static const struct net_device_ops m_can_netdev_ops = { | |||
992 | .ndo_open = m_can_open, | 1095 | .ndo_open = m_can_open, |
993 | .ndo_stop = m_can_close, | 1096 | .ndo_stop = m_can_close, |
994 | .ndo_start_xmit = m_can_start_xmit, | 1097 | .ndo_start_xmit = m_can_start_xmit, |
1098 | .ndo_change_mtu = can_change_mtu, | ||
995 | }; | 1099 | }; |
996 | 1100 | ||
997 | static int register_m_can_dev(struct net_device *dev) | 1101 | static int register_m_can_dev(struct net_device *dev) |
@@ -1009,7 +1113,7 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
1009 | struct resource *res; | 1113 | struct resource *res; |
1010 | void __iomem *addr; | 1114 | void __iomem *addr; |
1011 | u32 out_val[MRAM_CFG_LEN]; | 1115 | u32 out_val[MRAM_CFG_LEN]; |
1012 | int ret; | 1116 | int i, start, end, ret; |
1013 | 1117 | ||
1014 | /* message ram could be shared */ | 1118 | /* message ram could be shared */ |
1015 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); | 1119 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); |
@@ -1060,6 +1164,15 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
1060 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, | 1164 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, |
1061 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); | 1165 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); |
1062 | 1166 | ||
1167 | /* initialize the entire Message RAM in use to avoid possible | ||
1168 | * ECC/parity checksum errors when reading an uninitialized buffer | ||
1169 | */ | ||
1170 | start = priv->mcfg[MRAM_SIDF].off; | ||
1171 | end = priv->mcfg[MRAM_TXB].off + | ||
1172 | priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE; | ||
1173 | for (i = start; i < end; i += 4) | ||
1174 | writel(0x0, priv->mram_base + i); | ||
1175 | |||
1063 | return 0; | 1176 | return 0; |
1064 | } | 1177 | } |
1065 | 1178 | ||
diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c index 1abe133d1594..9718248e55f1 100644 --- a/drivers/net/can/rcar_can.c +++ b/drivers/net/can/rcar_can.c | |||
@@ -628,6 +628,7 @@ static const struct net_device_ops rcar_can_netdev_ops = { | |||
628 | .ndo_open = rcar_can_open, | 628 | .ndo_open = rcar_can_open, |
629 | .ndo_stop = rcar_can_close, | 629 | .ndo_stop = rcar_can_close, |
630 | .ndo_start_xmit = rcar_can_start_xmit, | 630 | .ndo_start_xmit = rcar_can_start_xmit, |
631 | .ndo_change_mtu = can_change_mtu, | ||
631 | }; | 632 | }; |
632 | 633 | ||
633 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) | 634 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) |
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c index 8ff3424d5147..15c00faeec61 100644 --- a/drivers/net/can/sja1000/kvaser_pci.c +++ b/drivers/net/can/sja1000/kvaser_pci.c | |||
@@ -214,7 +214,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
214 | struct net_device *dev; | 214 | struct net_device *dev; |
215 | struct sja1000_priv *priv; | 215 | struct sja1000_priv *priv; |
216 | struct kvaser_pci *board; | 216 | struct kvaser_pci *board; |
217 | int err, init_step; | 217 | int err; |
218 | 218 | ||
219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); | 219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); |
220 | if (dev == NULL) | 220 | if (dev == NULL) |
@@ -235,7 +235,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
235 | if (channel == 0) { | 235 | if (channel == 0) { |
236 | board->xilinx_ver = | 236 | board->xilinx_ver = |
237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; | 237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; |
238 | init_step = 2; | ||
239 | 238 | ||
240 | /* Assert PTADR# - we're in passive mode so the other bits are | 239 | /* Assert PTADR# - we're in passive mode so the other bits are |
241 | not important */ | 240 | not important */ |
@@ -264,8 +263,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
264 | priv->irq_flags = IRQF_SHARED; | 263 | priv->irq_flags = IRQF_SHARED; |
265 | dev->irq = pdev->irq; | 264 | dev->irq = pdev->irq; |
266 | 265 | ||
267 | init_step = 4; | ||
268 | |||
269 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", | 266 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", |
270 | priv->reg_base, board->conf_addr, dev->irq); | 267 | priv->reg_base, board->conf_addr, dev->irq); |
271 | 268 | ||
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 00f2534dde73..29d3f0938eb8 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
@@ -434,10 +434,9 @@ static void ems_usb_read_bulk_callback(struct urb *urb) | |||
434 | if (urb->actual_length > CPC_HEADER_SIZE) { | 434 | if (urb->actual_length > CPC_HEADER_SIZE) { |
435 | struct ems_cpc_msg *msg; | 435 | struct ems_cpc_msg *msg; |
436 | u8 *ibuf = urb->transfer_buffer; | 436 | u8 *ibuf = urb->transfer_buffer; |
437 | u8 msg_count, again, start; | 437 | u8 msg_count, start; |
438 | 438 | ||
439 | msg_count = ibuf[0] & ~0x80; | 439 | msg_count = ibuf[0] & ~0x80; |
440 | again = ibuf[0] & 0x80; | ||
441 | 440 | ||
442 | start = CPC_HEADER_SIZE; | 441 | start = CPC_HEADER_SIZE; |
443 | 442 | ||
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index b7c9e8b11460..c063a54ab8dd 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -464,7 +464,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
464 | { | 464 | { |
465 | struct esd_tx_urb_context *context = urb->context; | 465 | struct esd_tx_urb_context *context = urb->context; |
466 | struct esd_usb2_net_priv *priv; | 466 | struct esd_usb2_net_priv *priv; |
467 | struct esd_usb2 *dev; | ||
468 | struct net_device *netdev; | 467 | struct net_device *netdev; |
469 | size_t size = sizeof(struct esd_usb2_msg); | 468 | size_t size = sizeof(struct esd_usb2_msg); |
470 | 469 | ||
@@ -472,7 +471,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
472 | 471 | ||
473 | priv = context->priv; | 472 | priv = context->priv; |
474 | netdev = priv->netdev; | 473 | netdev = priv->netdev; |
475 | dev = priv->usb2; | ||
476 | 474 | ||
477 | /* free up our allocated buffer */ | 475 | /* free up our allocated buffer */ |
478 | usb_free_coherent(urb->dev, size, | 476 | usb_free_coherent(urb->dev, size, |
@@ -1143,6 +1141,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf) | |||
1143 | } | 1141 | } |
1144 | } | 1142 | } |
1145 | unlink_all_urbs(dev); | 1143 | unlink_all_urbs(dev); |
1144 | kfree(dev); | ||
1146 | } | 1145 | } |
1147 | } | 1146 | } |
1148 | 1147 | ||
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index 04b0f84612f0..009acc8641fc 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c | |||
@@ -718,6 +718,7 @@ static const struct net_device_ops gs_usb_netdev_ops = { | |||
718 | .ndo_open = gs_can_open, | 718 | .ndo_open = gs_can_open, |
719 | .ndo_stop = gs_can_close, | 719 | .ndo_stop = gs_can_close, |
720 | .ndo_start_xmit = gs_can_start_xmit, | 720 | .ndo_start_xmit = gs_can_start_xmit, |
721 | .ndo_change_mtu = can_change_mtu, | ||
721 | }; | 722 | }; |
722 | 723 | ||
723 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) | 724 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) |
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 5e8b5609c067..8a998e3884ce 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c | |||
@@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev) | |||
300 | static int xcan_chip_start(struct net_device *ndev) | 300 | static int xcan_chip_start(struct net_device *ndev) |
301 | { | 301 | { |
302 | struct xcan_priv *priv = netdev_priv(ndev); | 302 | struct xcan_priv *priv = netdev_priv(ndev); |
303 | u32 err, reg_msr, reg_sr_mask; | 303 | u32 reg_msr, reg_sr_mask; |
304 | int err; | ||
304 | unsigned long timeout; | 305 | unsigned long timeout; |
305 | 306 | ||
306 | /* Check if it is in reset mode */ | 307 | /* Check if it is in reset mode */ |
@@ -961,6 +962,7 @@ static const struct net_device_ops xcan_netdev_ops = { | |||
961 | .ndo_open = xcan_open, | 962 | .ndo_open = xcan_open, |
962 | .ndo_stop = xcan_close, | 963 | .ndo_stop = xcan_close, |
963 | .ndo_start_xmit = xcan_start_xmit, | 964 | .ndo_start_xmit = xcan_start_xmit, |
965 | .ndo_change_mtu = can_change_mtu, | ||
964 | }; | 966 | }; |
965 | 967 | ||
966 | /** | 968 | /** |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c index cca604994003..4fe33606f372 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | |||
@@ -1082,7 +1082,7 @@ static int cxgb4_cee_peer_getpg(struct net_device *dev, struct cee_pg *pg) | |||
1082 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); | 1082 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); |
1083 | 1083 | ||
1084 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) | 1084 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) |
1085 | pg->prio_pg[i] = (pgid >> (i * 4)) & 0xF; | 1085 | pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF; |
1086 | 1086 | ||
1087 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | 1087 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); |
1088 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; | 1088 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index d02fbc7694ea..9070b98e15c4 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4423,6 +4423,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, | |||
4423 | "Disabled VxLAN offloads for UDP port %d\n", | 4423 | "Disabled VxLAN offloads for UDP port %d\n", |
4424 | be16_to_cpu(port)); | 4424 | be16_to_cpu(port)); |
4425 | } | 4425 | } |
4426 | |||
4427 | static bool be_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
4428 | { | ||
4429 | return vxlan_gso_check(skb); | ||
4430 | } | ||
4426 | #endif | 4431 | #endif |
4427 | 4432 | ||
4428 | static const struct net_device_ops be_netdev_ops = { | 4433 | static const struct net_device_ops be_netdev_ops = { |
@@ -4452,6 +4457,7 @@ static const struct net_device_ops be_netdev_ops = { | |||
4452 | #ifdef CONFIG_BE2NET_VXLAN | 4457 | #ifdef CONFIG_BE2NET_VXLAN |
4453 | .ndo_add_vxlan_port = be_add_vxlan_port, | 4458 | .ndo_add_vxlan_port = be_add_vxlan_port, |
4454 | .ndo_del_vxlan_port = be_del_vxlan_port, | 4459 | .ndo_del_vxlan_port = be_del_vxlan_port, |
4460 | .ndo_gso_check = be_gso_check, | ||
4455 | #endif | 4461 | #endif |
4456 | }; | 4462 | }; |
4457 | 4463 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f3df9b350d87..89440cb25ad8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1693,7 +1693,7 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | 1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); |
1694 | 1694 | ||
1695 | #ifdef CONFIG_MLX4_EN_VXLAN | 1695 | #ifdef CONFIG_MLX4_EN_VXLAN |
1696 | if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) | 1696 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
1697 | vxlan_get_rx_port(dev); | 1697 | vxlan_get_rx_port(dev); |
1698 | #endif | 1698 | #endif |
1699 | priv->port_up = true; | 1699 | priv->port_up = true; |
@@ -2365,6 +2365,11 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev, | |||
2365 | 2365 | ||
2366 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); | 2366 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); |
2367 | } | 2367 | } |
2368 | |||
2369 | static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
2370 | { | ||
2371 | return vxlan_gso_check(skb); | ||
2372 | } | ||
2368 | #endif | 2373 | #endif |
2369 | 2374 | ||
2370 | static const struct net_device_ops mlx4_netdev_ops = { | 2375 | static const struct net_device_ops mlx4_netdev_ops = { |
@@ -2396,6 +2401,7 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
2396 | #ifdef CONFIG_MLX4_EN_VXLAN | 2401 | #ifdef CONFIG_MLX4_EN_VXLAN |
2397 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | 2402 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, |
2398 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | 2403 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, |
2404 | .ndo_gso_check = mlx4_en_gso_check, | ||
2399 | #endif | 2405 | #endif |
2400 | }; | 2406 | }; |
2401 | 2407 | ||
@@ -2426,6 +2432,11 @@ static const struct net_device_ops mlx4_netdev_ops_master = { | |||
2426 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, | 2432 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, |
2427 | #endif | 2433 | #endif |
2428 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, | 2434 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, |
2435 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2436 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | ||
2437 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | ||
2438 | .ndo_gso_check = mlx4_en_gso_check, | ||
2439 | #endif | ||
2429 | }; | 2440 | }; |
2430 | 2441 | ||
2431 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | 2442 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index f5e29f7bdae3..a913b3ad2f89 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -503,6 +503,11 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev, | |||
503 | 503 | ||
504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; | 504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; |
505 | } | 505 | } |
506 | |||
507 | static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
508 | { | ||
509 | return vxlan_gso_check(skb); | ||
510 | } | ||
506 | #endif | 511 | #endif |
507 | 512 | ||
508 | static const struct net_device_ops qlcnic_netdev_ops = { | 513 | static const struct net_device_ops qlcnic_netdev_ops = { |
@@ -526,6 +531,7 @@ static const struct net_device_ops qlcnic_netdev_ops = { | |||
526 | #ifdef CONFIG_QLCNIC_VXLAN | 531 | #ifdef CONFIG_QLCNIC_VXLAN |
527 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, | 532 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, |
528 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, | 533 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, |
534 | .ndo_gso_check = qlcnic_gso_check, | ||
529 | #endif | 535 | #endif |
530 | #ifdef CONFIG_NET_POLL_CONTROLLER | 536 | #ifdef CONFIG_NET_POLL_CONTROLLER |
531 | .ndo_poll_controller = qlcnic_poll_controller, | 537 | .ndo_poll_controller = qlcnic_poll_controller, |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index d8794488f80a..c560f9aeb55d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -129,9 +129,9 @@ do { \ | |||
129 | #define CPSW_VLAN_AWARE BIT(1) | 129 | #define CPSW_VLAN_AWARE BIT(1) |
130 | #define CPSW_ALE_VLAN_AWARE 1 | 130 | #define CPSW_ALE_VLAN_AWARE 1 |
131 | 131 | ||
132 | #define CPSW_FIFO_NORMAL_MODE (0 << 15) | 132 | #define CPSW_FIFO_NORMAL_MODE (0 << 16) |
133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 15) | 133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 16) |
134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 15) | 134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16) |
135 | 135 | ||
136 | #define CPSW_INTPACEEN (0x3f << 16) | 136 | #define CPSW_INTPACEEN (0x3f << 16) |
137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) | 137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) |
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index 1aff970be33e..1dc628ffce2b 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c | |||
@@ -506,7 +506,9 @@ static int pptp_getname(struct socket *sock, struct sockaddr *uaddr, | |||
506 | int len = sizeof(struct sockaddr_pppox); | 506 | int len = sizeof(struct sockaddr_pppox); |
507 | struct sockaddr_pppox sp; | 507 | struct sockaddr_pppox sp; |
508 | 508 | ||
509 | sp.sa_family = AF_PPPOX; | 509 | memset(&sp.sa_addr, 0, sizeof(sp.sa_addr)); |
510 | |||
511 | sp.sa_family = AF_PPPOX; | ||
510 | sp.sa_protocol = PX_PROTO_PPTP; | 512 | sp.sa_protocol = PX_PROTO_PPTP; |
511 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; | 513 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; |
512 | 514 | ||
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 22756db53dca..b8a82b86f909 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -780,6 +780,7 @@ static const struct usb_device_id products[] = { | |||
780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ | 780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ | 781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ |
782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ | 782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
783 | {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ | ||
783 | 784 | ||
784 | /* 4. Gobi 1000 devices */ | 785 | /* 4. Gobi 1000 devices */ |
785 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 786 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ec2a8b41ed41..b0bc8ead47de 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1673,6 +1673,40 @@ static const struct attribute_group virtio_net_mrg_rx_group = { | |||
1673 | }; | 1673 | }; |
1674 | #endif | 1674 | #endif |
1675 | 1675 | ||
1676 | static bool virtnet_fail_on_feature(struct virtio_device *vdev, | ||
1677 | unsigned int fbit, | ||
1678 | const char *fname, const char *dname) | ||
1679 | { | ||
1680 | if (!virtio_has_feature(vdev, fbit)) | ||
1681 | return false; | ||
1682 | |||
1683 | dev_err(&vdev->dev, "device advertises feature %s but not %s", | ||
1684 | fname, dname); | ||
1685 | |||
1686 | return true; | ||
1687 | } | ||
1688 | |||
1689 | #define VIRTNET_FAIL_ON(vdev, fbit, dbit) \ | ||
1690 | virtnet_fail_on_feature(vdev, fbit, #fbit, dbit) | ||
1691 | |||
1692 | static bool virtnet_validate_features(struct virtio_device *vdev) | ||
1693 | { | ||
1694 | if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) && | ||
1695 | (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX, | ||
1696 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1697 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN, | ||
1698 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1699 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE, | ||
1700 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1701 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") || | ||
1702 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR, | ||
1703 | "VIRTIO_NET_F_CTRL_VQ"))) { | ||
1704 | return false; | ||
1705 | } | ||
1706 | |||
1707 | return true; | ||
1708 | } | ||
1709 | |||
1676 | static int virtnet_probe(struct virtio_device *vdev) | 1710 | static int virtnet_probe(struct virtio_device *vdev) |
1677 | { | 1711 | { |
1678 | int i, err; | 1712 | int i, err; |
@@ -1680,6 +1714,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1680 | struct virtnet_info *vi; | 1714 | struct virtnet_info *vi; |
1681 | u16 max_queue_pairs; | 1715 | u16 max_queue_pairs; |
1682 | 1716 | ||
1717 | if (!virtnet_validate_features(vdev)) | ||
1718 | return -EINVAL; | ||
1719 | |||
1683 | /* Find if host supports multiqueue virtio_net device */ | 1720 | /* Find if host supports multiqueue virtio_net device */ |
1684 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, | 1721 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, |
1685 | struct virtio_net_config, | 1722 | struct virtio_net_config, |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 64d45fa3d997..e9f81d463659 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -67,12 +67,6 @@ | |||
67 | 67 | ||
68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ | 68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ |
69 | 69 | ||
70 | /* VXLAN protocol header */ | ||
71 | struct vxlanhdr { | ||
72 | __be32 vx_flags; | ||
73 | __be32 vx_vni; | ||
74 | }; | ||
75 | |||
76 | /* UDP port for VXLAN traffic. | 70 | /* UDP port for VXLAN traffic. |
77 | * The IANA assigned port is 4789, but the Linux default is 8472 | 71 | * The IANA assigned port is 4789, but the Linux default is 8472 |
78 | * for compatibility with early adopters. | 72 | * for compatibility with early adopters. |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 7c63976b5b0c..ebbbfc7a193b 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -996,9 +996,8 @@ void ath9k_calculate_iter_data(struct ath_softc *sc, | |||
996 | struct ath_vif *avp; | 996 | struct ath_vif *avp; |
997 | 997 | ||
998 | /* | 998 | /* |
999 | * Pick the MAC address of the first interface as the new hardware | 999 | * The hardware will use primary station addr together with the |
1000 | * MAC address. The hardware will use it together with the BSSID mask | 1000 | * BSSID mask when matching addresses. |
1001 | * when matching addresses. | ||
1002 | */ | 1001 | */ |
1003 | memset(iter_data, 0, sizeof(*iter_data)); | 1002 | memset(iter_data, 0, sizeof(*iter_data)); |
1004 | memset(&iter_data->mask, 0xff, ETH_ALEN); | 1003 | memset(&iter_data->mask, 0xff, ETH_ALEN); |
@@ -1228,6 +1227,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
1228 | list_add_tail(&avp->list, &avp->chanctx->vifs); | 1227 | list_add_tail(&avp->list, &avp->chanctx->vifs); |
1229 | } | 1228 | } |
1230 | 1229 | ||
1230 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
1231 | |||
1231 | ath9k_assign_hw_queues(hw, vif); | 1232 | ath9k_assign_hw_queues(hw, vif); |
1232 | 1233 | ||
1233 | an->sc = sc; | 1234 | an->sc = sc; |
@@ -1297,6 +1298,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1297 | 1298 | ||
1298 | ath_tx_node_cleanup(sc, &avp->mcast_node); | 1299 | ath_tx_node_cleanup(sc, &avp->mcast_node); |
1299 | 1300 | ||
1301 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
1302 | |||
1300 | mutex_unlock(&sc->mutex); | 1303 | mutex_unlock(&sc->mutex); |
1301 | } | 1304 | } |
1302 | 1305 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/of.c b/drivers/net/wireless/brcm80211/brcmfmac/of.c index eb3fce82a223..c824570ddea3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c | |||
@@ -40,8 +40,8 @@ void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev) | |||
40 | return; | 40 | return; |
41 | 41 | ||
42 | irq = irq_of_parse_and_map(np, 0); | 42 | irq = irq_of_parse_and_map(np, 0); |
43 | if (irq < 0) { | 43 | if (!irq) { |
44 | brcmf_err("interrupt could not be mapped: err=%d\n", irq); | 44 | brcmf_err("interrupt could not be mapped\n"); |
45 | devm_kfree(dev, sdiodev->pdata); | 45 | devm_kfree(dev, sdiodev->pdata); |
46 | return; | 46 | return; |
47 | } | 47 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c index b0ae7993e2e8..138691a1365a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/unaligned/access_ok.h> | ||
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | #include <linux/bcma/bcma.h> | 23 | #include <linux/bcma/bcma.h> |
25 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <asm/unaligned.h> | ||
26 | 26 | ||
27 | #include <soc.h> | 27 | #include <soc.h> |
28 | #include <chipcommon.h> | 28 | #include <chipcommon.h> |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 5265aa70b094..4572defc280f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -738,10 +738,12 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd, | |||
738 | goto finalize; | 738 | goto finalize; |
739 | } | 739 | } |
740 | 740 | ||
741 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) | 741 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) { |
742 | usb_kill_urb(devinfo->ctl_urb); | ||
742 | ret = -ETIMEDOUT; | 743 | ret = -ETIMEDOUT; |
743 | else | 744 | } else { |
744 | memcpy(buffer, tmpbuf, buflen); | 745 | memcpy(buffer, tmpbuf, buflen); |
746 | } | ||
745 | 747 | ||
746 | finalize: | 748 | finalize: |
747 | kfree(tmpbuf); | 749 | kfree(tmpbuf); |
diff --git a/drivers/of/address.c b/drivers/of/address.c index afdb78299f61..06af494184d6 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -450,6 +450,21 @@ static struct of_bus *of_match_bus(struct device_node *np) | |||
450 | return NULL; | 450 | return NULL; |
451 | } | 451 | } |
452 | 452 | ||
453 | static int of_empty_ranges_quirk(void) | ||
454 | { | ||
455 | if (IS_ENABLED(CONFIG_PPC)) { | ||
456 | /* To save cycles, we cache the result */ | ||
457 | static int quirk_state = -1; | ||
458 | |||
459 | if (quirk_state < 0) | ||
460 | quirk_state = | ||
461 | of_machine_is_compatible("Power Macintosh") || | ||
462 | of_machine_is_compatible("MacRISC"); | ||
463 | return quirk_state; | ||
464 | } | ||
465 | return false; | ||
466 | } | ||
467 | |||
453 | static int of_translate_one(struct device_node *parent, struct of_bus *bus, | 468 | static int of_translate_one(struct device_node *parent, struct of_bus *bus, |
454 | struct of_bus *pbus, __be32 *addr, | 469 | struct of_bus *pbus, __be32 *addr, |
455 | int na, int ns, int pna, const char *rprop) | 470 | int na, int ns, int pna, const char *rprop) |
@@ -475,12 +490,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
475 | * This code is only enabled on powerpc. --gcl | 490 | * This code is only enabled on powerpc. --gcl |
476 | */ | 491 | */ |
477 | ranges = of_get_property(parent, rprop, &rlen); | 492 | ranges = of_get_property(parent, rprop, &rlen); |
478 | #if !defined(CONFIG_PPC) | 493 | if (ranges == NULL && !of_empty_ranges_quirk()) { |
479 | if (ranges == NULL) { | ||
480 | pr_err("OF: no ranges; cannot translate\n"); | 494 | pr_err("OF: no ranges; cannot translate\n"); |
481 | return 1; | 495 | return 1; |
482 | } | 496 | } |
483 | #endif /* !defined(CONFIG_PPC) */ | ||
484 | if (ranges == NULL || rlen == 0) { | 497 | if (ranges == NULL || rlen == 0) { |
485 | offset = of_read_number(addr, na); | 498 | offset = of_read_number(addr, na); |
486 | memset(addr, 0, pna * 4); | 499 | memset(addr, 0, pna * 4); |
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index f297891d8529..d4994177dec2 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c | |||
@@ -247,7 +247,7 @@ void of_node_release(struct kobject *kobj) | |||
247 | * @allocflags: Allocation flags (typically pass GFP_KERNEL) | 247 | * @allocflags: Allocation flags (typically pass GFP_KERNEL) |
248 | * | 248 | * |
249 | * Copy a property by dynamically allocating the memory of both the | 249 | * Copy a property by dynamically allocating the memory of both the |
250 | * property stucture and the property name & contents. The property's | 250 | * property structure and the property name & contents. The property's |
251 | * flags have the OF_DYNAMIC bit set so that we can differentiate between | 251 | * flags have the OF_DYNAMIC bit set so that we can differentiate between |
252 | * dynamically allocated properties and not. | 252 | * dynamically allocated properties and not. |
253 | * Returns the newly allocated property or NULL on out of memory error. | 253 | * Returns the newly allocated property or NULL on out of memory error. |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d1ffca8b34ea..30e97bcc4f88 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -773,7 +773,7 @@ int __init early_init_dt_scan_chosen_serial(void) | |||
773 | if (offset < 0) | 773 | if (offset < 0) |
774 | return -ENODEV; | 774 | return -ENODEV; |
775 | 775 | ||
776 | while (match->compatible) { | 776 | while (match->compatible[0]) { |
777 | unsigned long addr; | 777 | unsigned long addr; |
778 | if (fdt_node_check_compatible(fdt, offset, match->compatible)) { | 778 | if (fdt_node_check_compatible(fdt, offset, match->compatible)) { |
779 | match++; | 779 | match++; |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 11b873c54a77..e2d79afa9dc6 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -896,10 +896,14 @@ static void selftest_data_remove(void) | |||
896 | return; | 896 | return; |
897 | } | 897 | } |
898 | 898 | ||
899 | while (last_node_index >= 0) { | 899 | while (last_node_index-- > 0) { |
900 | if (nodes[last_node_index]) { | 900 | if (nodes[last_node_index]) { |
901 | np = of_find_node_by_path(nodes[last_node_index]->full_name); | 901 | np = of_find_node_by_path(nodes[last_node_index]->full_name); |
902 | if (strcmp(np->full_name, "/aliases") != 0) { | 902 | if (np == nodes[last_node_index]) { |
903 | if (of_aliases == np) { | ||
904 | of_node_put(of_aliases); | ||
905 | of_aliases = NULL; | ||
906 | } | ||
903 | detach_node_and_children(np); | 907 | detach_node_and_children(np); |
904 | } else { | 908 | } else { |
905 | for_each_property_of_node(np, prop) { | 909 | for_each_property_of_node(np, prop) { |
@@ -908,7 +912,6 @@ static void selftest_data_remove(void) | |||
908 | } | 912 | } |
909 | } | 913 | } |
910 | } | 914 | } |
911 | last_node_index--; | ||
912 | } | 915 | } |
913 | } | 916 | } |
914 | 917 | ||
@@ -921,6 +924,8 @@ static int __init of_selftest(void) | |||
921 | res = selftest_data_add(); | 924 | res = selftest_data_add(); |
922 | if (res) | 925 | if (res) |
923 | return res; | 926 | return res; |
927 | if (!of_aliases) | ||
928 | of_aliases = of_find_node_by_path("/aliases"); | ||
924 | 929 | ||
925 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); | 930 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); |
926 | if (!np) { | 931 | if (!np) { |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index d292d7cb3417..49dd766852ba 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -444,7 +444,7 @@ static inline int pcie_cap_version(const struct pci_dev *dev) | |||
444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; | 444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; |
445 | } | 445 | } |
446 | 446 | ||
447 | static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | 447 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) |
448 | { | 448 | { |
449 | int type = pci_pcie_type(dev); | 449 | int type = pci_pcie_type(dev); |
450 | 450 | ||
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 9ecabfa8c634..2988fe136c1e 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c | |||
@@ -631,10 +631,15 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev) | |||
631 | if (ret) | 631 | if (ret) |
632 | return ret; | 632 | return ret; |
633 | 633 | ||
634 | bus = pci_scan_root_bus(&pdev->dev, 0, &xgene_pcie_ops, port, &res); | 634 | bus = pci_create_root_bus(&pdev->dev, 0, |
635 | &xgene_pcie_ops, port, &res); | ||
635 | if (!bus) | 636 | if (!bus) |
636 | return -ENOMEM; | 637 | return -ENOMEM; |
637 | 638 | ||
639 | pci_scan_child_bus(bus); | ||
640 | pci_assign_unassigned_bus_resources(bus); | ||
641 | pci_bus_add_devices(bus); | ||
642 | |||
638 | platform_set_drvdata(pdev, port); | 643 | platform_set_drvdata(pdev, port); |
639 | return 0; | 644 | return 0; |
640 | } | 645 | } |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 0601890db22d..4a3902d8e6fe 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | extern const unsigned char pcie_link_speed[]; | 7 | extern const unsigned char pcie_link_speed[]; |
8 | 8 | ||
9 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev); | ||
10 | |||
9 | /* Functions internal to the PCI core code */ | 11 | /* Functions internal to the PCI core code */ |
10 | 12 | ||
11 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); | 13 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5ed99309c758..c8ca98c2b480 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -407,15 +407,16 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
407 | { | 407 | { |
408 | struct pci_dev *dev = child->self; | 408 | struct pci_dev *dev = child->self; |
409 | u16 mem_base_lo, mem_limit_lo; | 409 | u16 mem_base_lo, mem_limit_lo; |
410 | unsigned long base, limit; | 410 | u64 base64, limit64; |
411 | dma_addr_t base, limit; | ||
411 | struct pci_bus_region region; | 412 | struct pci_bus_region region; |
412 | struct resource *res; | 413 | struct resource *res; |
413 | 414 | ||
414 | res = child->resource[2]; | 415 | res = child->resource[2]; |
415 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); | 416 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); |
416 | pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); | 417 | pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); |
417 | base = ((unsigned long) mem_base_lo & PCI_PREF_RANGE_MASK) << 16; | 418 | base64 = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16; |
418 | limit = ((unsigned long) mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; | 419 | limit64 = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; |
419 | 420 | ||
420 | if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { | 421 | if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { |
421 | u32 mem_base_hi, mem_limit_hi; | 422 | u32 mem_base_hi, mem_limit_hi; |
@@ -429,17 +430,20 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
429 | * this, just assume they are not being used. | 430 | * this, just assume they are not being used. |
430 | */ | 431 | */ |
431 | if (mem_base_hi <= mem_limit_hi) { | 432 | if (mem_base_hi <= mem_limit_hi) { |
432 | #if BITS_PER_LONG == 64 | 433 | base64 |= (u64) mem_base_hi << 32; |
433 | base |= ((unsigned long) mem_base_hi) << 32; | 434 | limit64 |= (u64) mem_limit_hi << 32; |
434 | limit |= ((unsigned long) mem_limit_hi) << 32; | ||
435 | #else | ||
436 | if (mem_base_hi || mem_limit_hi) { | ||
437 | dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n"); | ||
438 | return; | ||
439 | } | ||
440 | #endif | ||
441 | } | 435 | } |
442 | } | 436 | } |
437 | |||
438 | base = (dma_addr_t) base64; | ||
439 | limit = (dma_addr_t) limit64; | ||
440 | |||
441 | if (base != base64) { | ||
442 | dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", | ||
443 | (unsigned long long) base64); | ||
444 | return; | ||
445 | } | ||
446 | |||
443 | if (base <= limit) { | 447 | if (base <= limit) { |
444 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | | 448 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | |
445 | IORESOURCE_MEM | IORESOURCE_PREFETCH; | 449 | IORESOURCE_MEM | IORESOURCE_PREFETCH; |
@@ -1323,7 +1327,7 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) | |||
1323 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); | 1327 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); |
1324 | 1328 | ||
1325 | /* Initialize Link Control Register */ | 1329 | /* Initialize Link Control Register */ |
1326 | if (dev->subordinate) | 1330 | if (pcie_cap_has_lnkctl(dev)) |
1327 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, | 1331 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, |
1328 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); | 1332 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); |
1329 | 1333 | ||
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/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/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/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 ed0e16866dc7..dd5f4e088efe 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -830,6 +830,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
830 | if (status == CPL_ERR_RTX_NEG_ADVICE) | 830 | if (status == CPL_ERR_RTX_NEG_ADVICE) |
831 | goto rel_skb; | 831 | goto rel_skb; |
832 | 832 | ||
833 | module_put(THIS_MODULE); | ||
834 | |||
833 | if (status && status != CPL_ERR_TCAM_FULL && | 835 | if (status && status != CPL_ERR_TCAM_FULL && |
834 | status != CPL_ERR_CONN_EXIST && | 836 | status != CPL_ERR_CONN_EXIST && |
835 | status != CPL_ERR_ARP_MISS) | 837 | status != CPL_ERR_ARP_MISS) |
@@ -938,20 +940,23 @@ static void do_abort_req_rss(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
938 | cxgbi_sock_get(csk); | 940 | cxgbi_sock_get(csk); |
939 | spin_lock_bh(&csk->lock); | 941 | spin_lock_bh(&csk->lock); |
940 | 942 | ||
941 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) { | 943 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); |
942 | cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); | 944 | |
943 | cxgbi_sock_set_state(csk, CTP_ABORTING); | 945 | if (!cxgbi_sock_flag(csk, CTPF_TX_DATA_SENT)) { |
944 | goto done; | 946 | send_tx_flowc_wr(csk); |
947 | cxgbi_sock_set_flag(csk, CTPF_TX_DATA_SENT); | ||
945 | } | 948 | } |
946 | 949 | ||
947 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); | 950 | cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); |
951 | cxgbi_sock_set_state(csk, CTP_ABORTING); | ||
952 | |||
948 | send_abort_rpl(csk, rst_status); | 953 | send_abort_rpl(csk, rst_status); |
949 | 954 | ||
950 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { | 955 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { |
951 | csk->err = abort_status_to_errno(csk, req->status, &rst_status); | 956 | csk->err = abort_status_to_errno(csk, req->status, &rst_status); |
952 | cxgbi_sock_closed(csk); | 957 | cxgbi_sock_closed(csk); |
953 | } | 958 | } |
954 | done: | 959 | |
955 | spin_unlock_bh(&csk->lock); | 960 | spin_unlock_bh(&csk->lock); |
956 | cxgbi_sock_put(csk); | 961 | cxgbi_sock_put(csk); |
957 | rel_skb: | 962 | rel_skb: |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 674d498b46ab..7da59c38a69e 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -816,7 +816,7 @@ static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk) | |||
816 | read_lock_bh(&csk->callback_lock); | 816 | read_lock_bh(&csk->callback_lock); |
817 | if (csk->user_data) | 817 | if (csk->user_data) |
818 | iscsi_conn_failure(csk->user_data, | 818 | iscsi_conn_failure(csk->user_data, |
819 | ISCSI_ERR_CONN_FAILED); | 819 | ISCSI_ERR_TCP_CONN_CLOSE); |
820 | read_unlock_bh(&csk->callback_lock); | 820 | read_unlock_bh(&csk->callback_lock); |
821 | } | 821 | } |
822 | } | 822 | } |
@@ -905,18 +905,16 @@ void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *csk) | |||
905 | { | 905 | { |
906 | cxgbi_sock_get(csk); | 906 | cxgbi_sock_get(csk); |
907 | spin_lock_bh(&csk->lock); | 907 | spin_lock_bh(&csk->lock); |
908 | |||
909 | cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); | ||
908 | if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { | 910 | if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { |
909 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_RCVD)) | 911 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); |
910 | cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); | 912 | if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) |
911 | else { | 913 | pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", |
912 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_RCVD); | 914 | csk, csk->state, csk->flags, csk->tid); |
913 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); | 915 | cxgbi_sock_closed(csk); |
914 | if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) | ||
915 | pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", | ||
916 | csk, csk->state, csk->flags, csk->tid); | ||
917 | cxgbi_sock_closed(csk); | ||
918 | } | ||
919 | } | 916 | } |
917 | |||
920 | spin_unlock_bh(&csk->lock); | 918 | spin_unlock_bh(&csk->lock); |
921 | cxgbi_sock_put(csk); | 919 | cxgbi_sock_put(csk); |
922 | } | 920 | } |
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/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index b19e4329ba00..73e58d22e325 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3491,7 +3491,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, | |||
3491 | len = sprintf(buf, "TargetAddress=" | 3491 | len = sprintf(buf, "TargetAddress=" |
3492 | "%s:%hu,%hu", | 3492 | "%s:%hu,%hu", |
3493 | inaddr_any ? conn->local_ip : np->np_ip, | 3493 | inaddr_any ? conn->local_ip : np->np_ip, |
3494 | inaddr_any ? conn->local_port : np->np_port, | 3494 | np->np_port, |
3495 | tpg->tpgt); | 3495 | tpg->tpgt); |
3496 | len += 1; | 3496 | len += 1; |
3497 | 3497 | ||
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 8c60a1a1ae8d..9f93b8234095 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -2738,7 +2738,8 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2738 | struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; | 2738 | struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; |
2739 | struct t10_reservation *pr_tmpl = &dev->t10_pr; | 2739 | struct t10_reservation *pr_tmpl = &dev->t10_pr; |
2740 | u32 pr_res_mapped_lun = 0; | 2740 | u32 pr_res_mapped_lun = 0; |
2741 | int all_reg = 0, calling_it_nexus = 0, released_regs = 0; | 2741 | int all_reg = 0, calling_it_nexus = 0; |
2742 | bool sa_res_key_unmatched = sa_res_key != 0; | ||
2742 | int prh_type = 0, prh_scope = 0; | 2743 | int prh_type = 0, prh_scope = 0; |
2743 | 2744 | ||
2744 | if (!se_sess) | 2745 | if (!se_sess) |
@@ -2813,6 +2814,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2813 | if (!all_reg) { | 2814 | if (!all_reg) { |
2814 | if (pr_reg->pr_res_key != sa_res_key) | 2815 | if (pr_reg->pr_res_key != sa_res_key) |
2815 | continue; | 2816 | continue; |
2817 | sa_res_key_unmatched = false; | ||
2816 | 2818 | ||
2817 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; | 2819 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; |
2818 | pr_reg_nacl = pr_reg->pr_reg_nacl; | 2820 | pr_reg_nacl = pr_reg->pr_reg_nacl; |
@@ -2820,7 +2822,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2820 | __core_scsi3_free_registration(dev, pr_reg, | 2822 | __core_scsi3_free_registration(dev, pr_reg, |
2821 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : | 2823 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : |
2822 | NULL, calling_it_nexus); | 2824 | NULL, calling_it_nexus); |
2823 | released_regs++; | ||
2824 | } else { | 2825 | } else { |
2825 | /* | 2826 | /* |
2826 | * Case for any existing all registrants type | 2827 | * Case for any existing all registrants type |
@@ -2838,6 +2839,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2838 | if ((sa_res_key) && | 2839 | if ((sa_res_key) && |
2839 | (pr_reg->pr_res_key != sa_res_key)) | 2840 | (pr_reg->pr_res_key != sa_res_key)) |
2840 | continue; | 2841 | continue; |
2842 | sa_res_key_unmatched = false; | ||
2841 | 2843 | ||
2842 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; | 2844 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; |
2843 | if (calling_it_nexus) | 2845 | if (calling_it_nexus) |
@@ -2848,7 +2850,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2848 | __core_scsi3_free_registration(dev, pr_reg, | 2850 | __core_scsi3_free_registration(dev, pr_reg, |
2849 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : | 2851 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : |
2850 | NULL, 0); | 2852 | NULL, 0); |
2851 | released_regs++; | ||
2852 | } | 2853 | } |
2853 | if (!calling_it_nexus) | 2854 | if (!calling_it_nexus) |
2854 | core_scsi3_ua_allocate(pr_reg_nacl, | 2855 | core_scsi3_ua_allocate(pr_reg_nacl, |
@@ -2863,7 +2864,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2863 | * registered reservation key, then the device server shall | 2864 | * registered reservation key, then the device server shall |
2864 | * complete the command with RESERVATION CONFLICT status. | 2865 | * complete the command with RESERVATION CONFLICT status. |
2865 | */ | 2866 | */ |
2866 | if (!released_regs) { | 2867 | if (sa_res_key_unmatched) { |
2867 | spin_unlock(&dev->dev_reservation_lock); | 2868 | spin_unlock(&dev->dev_reservation_lock); |
2868 | core_scsi3_put_pr_reg(pr_reg_n); | 2869 | core_scsi3_put_pr_reg(pr_reg_n); |
2869 | return TCM_RESERVATION_CONFLICT; | 2870 | return TCM_RESERVATION_CONFLICT; |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 9ea0d5f03f7a..be877bf6f730 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2292,7 +2292,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2292 | * and let it call back once the write buffers are ready. | 2292 | * and let it call back once the write buffers are ready. |
2293 | */ | 2293 | */ |
2294 | target_add_to_state_list(cmd); | 2294 | target_add_to_state_list(cmd); |
2295 | if (cmd->data_direction != DMA_TO_DEVICE) { | 2295 | if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) { |
2296 | target_execute_cmd(cmd); | 2296 | target_execute_cmd(cmd); |
2297 | return 0; | 2297 | return 0; |
2298 | } | 2298 | } |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 69906cacd04f..a17f11850669 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1312,6 +1312,7 @@ static int | |||
1312 | vhost_scsi_set_endpoint(struct vhost_scsi *vs, | 1312 | vhost_scsi_set_endpoint(struct vhost_scsi *vs, |
1313 | struct vhost_scsi_target *t) | 1313 | struct vhost_scsi_target *t) |
1314 | { | 1314 | { |
1315 | struct se_portal_group *se_tpg; | ||
1315 | struct tcm_vhost_tport *tv_tport; | 1316 | struct tcm_vhost_tport *tv_tport; |
1316 | struct tcm_vhost_tpg *tpg; | 1317 | struct tcm_vhost_tpg *tpg; |
1317 | struct tcm_vhost_tpg **vs_tpg; | 1318 | struct tcm_vhost_tpg **vs_tpg; |
@@ -1359,6 +1360,21 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, | |||
1359 | ret = -EEXIST; | 1360 | ret = -EEXIST; |
1360 | goto out; | 1361 | goto out; |
1361 | } | 1362 | } |
1363 | /* | ||
1364 | * In order to ensure individual vhost-scsi configfs | ||
1365 | * groups cannot be removed while in use by vhost ioctl, | ||
1366 | * go ahead and take an explicit se_tpg->tpg_group.cg_item | ||
1367 | * dependency now. | ||
1368 | */ | ||
1369 | se_tpg = &tpg->se_tpg; | ||
1370 | ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
1371 | &se_tpg->tpg_group.cg_item); | ||
1372 | if (ret) { | ||
1373 | pr_warn("configfs_depend_item() failed: %d\n", ret); | ||
1374 | kfree(vs_tpg); | ||
1375 | mutex_unlock(&tpg->tv_tpg_mutex); | ||
1376 | goto out; | ||
1377 | } | ||
1362 | tpg->tv_tpg_vhost_count++; | 1378 | tpg->tv_tpg_vhost_count++; |
1363 | tpg->vhost_scsi = vs; | 1379 | tpg->vhost_scsi = vs; |
1364 | vs_tpg[tpg->tport_tpgt] = tpg; | 1380 | vs_tpg[tpg->tport_tpgt] = tpg; |
@@ -1401,6 +1417,7 @@ static int | |||
1401 | vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | 1417 | vhost_scsi_clear_endpoint(struct vhost_scsi *vs, |
1402 | struct vhost_scsi_target *t) | 1418 | struct vhost_scsi_target *t) |
1403 | { | 1419 | { |
1420 | struct se_portal_group *se_tpg; | ||
1404 | struct tcm_vhost_tport *tv_tport; | 1421 | struct tcm_vhost_tport *tv_tport; |
1405 | struct tcm_vhost_tpg *tpg; | 1422 | struct tcm_vhost_tpg *tpg; |
1406 | struct vhost_virtqueue *vq; | 1423 | struct vhost_virtqueue *vq; |
@@ -1449,6 +1466,13 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | |||
1449 | vs->vs_tpg[target] = NULL; | 1466 | vs->vs_tpg[target] = NULL; |
1450 | match = true; | 1467 | match = true; |
1451 | mutex_unlock(&tpg->tv_tpg_mutex); | 1468 | mutex_unlock(&tpg->tv_tpg_mutex); |
1469 | /* | ||
1470 | * Release se_tpg->tpg_group.cg_item configfs dependency now | ||
1471 | * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. | ||
1472 | */ | ||
1473 | se_tpg = &tpg->se_tpg; | ||
1474 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
1475 | &se_tpg->tpg_group.cg_item); | ||
1452 | } | 1476 | } |
1453 | if (match) { | 1477 | if (match) { |
1454 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1478 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
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/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/bitops.h b/include/linux/bitops.h index be5fd38bd5a0..5d858e02997f 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -18,8 +18,11 @@ | |||
18 | * position @h. For example | 18 | * position @h. For example |
19 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. | 19 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. |
20 | */ | 20 | */ |
21 | #define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) | 21 | #define GENMASK(h, l) \ |
22 | #define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) | 22 | (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) |
23 | |||
24 | #define GENMASK_ULL(h, l) \ | ||
25 | (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) | ||
23 | 26 | ||
24 | extern unsigned int __sw_hweight8(unsigned int w); | 27 | extern unsigned int __sw_hweight8(unsigned int w); |
25 | extern unsigned int __sw_hweight16(unsigned int w); | 28 | extern unsigned int __sw_hweight16(unsigned int w); |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 6992afc6ba7f..b37ea95bc348 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
@@ -99,6 +99,12 @@ inval_skb: | |||
99 | return 1; | 99 | return 1; |
100 | } | 100 | } |
101 | 101 | ||
102 | static inline bool can_is_canfd_skb(const struct sk_buff *skb) | ||
103 | { | ||
104 | /* the CAN specific type of skb is identified by its data length */ | ||
105 | return skb->len == CANFD_MTU; | ||
106 | } | ||
107 | |||
102 | /* get data length from can_dlc with sanitized can_dlc */ | 108 | /* get data length from can_dlc with sanitized can_dlc */ |
103 | u8 can_dlc2len(u8 can_dlc); | 109 | u8 can_dlc2len(u8 can_dlc); |
104 | 110 | ||
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 0068708161ff..0a21fbefdfbe 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -242,7 +242,7 @@ static inline void in_dev_put(struct in_device *idev) | |||
242 | static __inline__ __be32 inet_make_mask(int logmask) | 242 | static __inline__ __be32 inet_make_mask(int logmask) |
243 | { | 243 | { |
244 | if (logmask) | 244 | if (logmask) |
245 | return htonl(~((1<<(32-logmask))-1)); | 245 | return htonl(~((1U<<(32-logmask))-1)); |
246 | return 0; | 246 | return 0; |
247 | } | 247 | } |
248 | 248 | ||
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 8422b4ed6882..b9376cd5a187 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -77,11 +77,6 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) | |||
77 | return kstat_cpu(cpu).irqs_sum; | 77 | return kstat_cpu(cpu).irqs_sum; |
78 | } | 78 | } |
79 | 79 | ||
80 | /* | ||
81 | * Lock/unlock the current runqueue - to extract task statistics: | ||
82 | */ | ||
83 | extern unsigned long long task_delta_exec(struct task_struct *); | ||
84 | |||
85 | extern void account_user_time(struct task_struct *, cputime_t, cputime_t); | 80 | extern void account_user_time(struct task_struct *, cputime_t, cputime_t); |
86 | extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); | 81 | extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); |
87 | extern void account_steal_time(cputime_t); | 82 | extern void account_steal_time(cputime_t); |
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/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/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 845c596bf594..3ae969e3acf0 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -396,14 +396,12 @@ struct nft_rule { | |||
396 | /** | 396 | /** |
397 | * struct nft_trans - nf_tables object update in transaction | 397 | * struct nft_trans - nf_tables object update in transaction |
398 | * | 398 | * |
399 | * @rcu_head: rcu head to defer release of transaction data | ||
400 | * @list: used internally | 399 | * @list: used internally |
401 | * @msg_type: message type | 400 | * @msg_type: message type |
402 | * @ctx: transaction context | 401 | * @ctx: transaction context |
403 | * @data: internal information related to the transaction | 402 | * @data: internal information related to the transaction |
404 | */ | 403 | */ |
405 | struct nft_trans { | 404 | struct nft_trans { |
406 | struct rcu_head rcu_head; | ||
407 | struct list_head list; | 405 | struct list_head list; |
408 | int msg_type; | 406 | int msg_type; |
409 | struct nft_ctx ctx; | 407 | struct nft_ctx ctx; |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index d5f59f3fc35d..57cccd0052e5 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
@@ -8,6 +8,12 @@ | |||
8 | #define VNI_HASH_BITS 10 | 8 | #define VNI_HASH_BITS 10 |
9 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) | 9 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) |
10 | 10 | ||
11 | /* VXLAN protocol header */ | ||
12 | struct vxlanhdr { | ||
13 | __be32 vx_flags; | ||
14 | __be32 vx_vni; | ||
15 | }; | ||
16 | |||
11 | struct vxlan_sock; | 17 | struct vxlan_sock; |
12 | typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); | 18 | typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); |
13 | 19 | ||
@@ -45,6 +51,18 @@ int vxlan_xmit_skb(struct vxlan_sock *vs, | |||
45 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, | 51 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, |
46 | __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); | 52 | __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); |
47 | 53 | ||
54 | static inline bool vxlan_gso_check(struct sk_buff *skb) | ||
55 | { | ||
56 | if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) && | ||
57 | (skb->inner_protocol_type != ENCAP_TYPE_ETHER || | ||
58 | skb->inner_protocol != htons(ETH_P_TEB) || | ||
59 | (skb_inner_mac_header(skb) - skb_transport_header(skb) != | ||
60 | sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) | ||
61 | return false; | ||
62 | |||
63 | return true; | ||
64 | } | ||
65 | |||
48 | /* IP header + UDP + VXLAN + Ethernet header */ | 66 | /* IP header + UDP + VXLAN + Ethernet header */ |
49 | #define VXLAN_HEADROOM (20 + 8 + 8 + 14) | 67 | #define VXLAN_HEADROOM (20 + 8 + 8 + 14) |
50 | /* IPv6 header + UDP + VXLAN + Ethernet header */ | 68 | /* IPv6 header + UDP + VXLAN + Ethernet header */ |
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/kernel/events/core.c b/kernel/events/core.c index 2b02c9fda790..1cd5eef1fcdd 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1562,8 +1562,10 @@ static void perf_remove_from_context(struct perf_event *event, bool detach_group | |||
1562 | 1562 | ||
1563 | if (!task) { | 1563 | if (!task) { |
1564 | /* | 1564 | /* |
1565 | * Per cpu events are removed via an smp call and | 1565 | * Per cpu events are removed via an smp call. The removal can |
1566 | * the removal is always successful. | 1566 | * fail if the CPU is currently offline, but in that case we |
1567 | * already called __perf_remove_from_context from | ||
1568 | * perf_event_exit_cpu. | ||
1567 | */ | 1569 | */ |
1568 | cpu_function_call(event->cpu, __perf_remove_from_context, &re); | 1570 | cpu_function_call(event->cpu, __perf_remove_from_context, &re); |
1569 | return; | 1571 | return; |
@@ -8117,7 +8119,7 @@ static void perf_pmu_rotate_stop(struct pmu *pmu) | |||
8117 | 8119 | ||
8118 | static void __perf_event_exit_context(void *__info) | 8120 | static void __perf_event_exit_context(void *__info) |
8119 | { | 8121 | { |
8120 | struct remove_event re = { .detach_group = false }; | 8122 | struct remove_event re = { .detach_group = true }; |
8121 | struct perf_event_context *ctx = __info; | 8123 | struct perf_event_context *ctx = __info; |
8122 | 8124 | ||
8123 | perf_pmu_rotate_stop(ctx->pmu); | 8125 | perf_pmu_rotate_stop(ctx->pmu); |
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/sched/core.c b/kernel/sched/core.c index 240157c13ddc..24beb9bb4c3e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2475,44 +2475,6 @@ EXPORT_PER_CPU_SYMBOL(kstat); | |||
2475 | EXPORT_PER_CPU_SYMBOL(kernel_cpustat); | 2475 | EXPORT_PER_CPU_SYMBOL(kernel_cpustat); |
2476 | 2476 | ||
2477 | /* | 2477 | /* |
2478 | * Return any ns on the sched_clock that have not yet been accounted in | ||
2479 | * @p in case that task is currently running. | ||
2480 | * | ||
2481 | * Called with task_rq_lock() held on @rq. | ||
2482 | */ | ||
2483 | static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq) | ||
2484 | { | ||
2485 | u64 ns = 0; | ||
2486 | |||
2487 | /* | ||
2488 | * Must be ->curr _and_ ->on_rq. If dequeued, we would | ||
2489 | * project cycles that may never be accounted to this | ||
2490 | * thread, breaking clock_gettime(). | ||
2491 | */ | ||
2492 | if (task_current(rq, p) && task_on_rq_queued(p)) { | ||
2493 | update_rq_clock(rq); | ||
2494 | ns = rq_clock_task(rq) - p->se.exec_start; | ||
2495 | if ((s64)ns < 0) | ||
2496 | ns = 0; | ||
2497 | } | ||
2498 | |||
2499 | return ns; | ||
2500 | } | ||
2501 | |||
2502 | unsigned long long task_delta_exec(struct task_struct *p) | ||
2503 | { | ||
2504 | unsigned long flags; | ||
2505 | struct rq *rq; | ||
2506 | u64 ns = 0; | ||
2507 | |||
2508 | rq = task_rq_lock(p, &flags); | ||
2509 | ns = do_task_delta_exec(p, rq); | ||
2510 | task_rq_unlock(rq, p, &flags); | ||
2511 | |||
2512 | return ns; | ||
2513 | } | ||
2514 | |||
2515 | /* | ||
2516 | * Return accounted runtime for the task. | 2478 | * Return accounted runtime for the task. |
2517 | * In case the task is currently running, return the runtime plus current's | 2479 | * In case the task is currently running, return the runtime plus current's |
2518 | * pending runtime that have not been accounted yet. | 2480 | * pending runtime that have not been accounted yet. |
@@ -2521,7 +2483,7 @@ unsigned long long task_sched_runtime(struct task_struct *p) | |||
2521 | { | 2483 | { |
2522 | unsigned long flags; | 2484 | unsigned long flags; |
2523 | struct rq *rq; | 2485 | struct rq *rq; |
2524 | u64 ns = 0; | 2486 | u64 ns; |
2525 | 2487 | ||
2526 | #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) | 2488 | #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) |
2527 | /* | 2489 | /* |
@@ -2540,7 +2502,16 @@ unsigned long long task_sched_runtime(struct task_struct *p) | |||
2540 | #endif | 2502 | #endif |
2541 | 2503 | ||
2542 | rq = task_rq_lock(p, &flags); | 2504 | rq = task_rq_lock(p, &flags); |
2543 | ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq); | 2505 | /* |
2506 | * Must be ->curr _and_ ->on_rq. If dequeued, we would | ||
2507 | * project cycles that may never be accounted to this | ||
2508 | * thread, breaking clock_gettime(). | ||
2509 | */ | ||
2510 | if (task_current(rq, p) && task_on_rq_queued(p)) { | ||
2511 | update_rq_clock(rq); | ||
2512 | p->sched_class->update_curr(rq); | ||
2513 | } | ||
2514 | ns = p->se.sum_exec_runtime; | ||
2544 | task_rq_unlock(rq, p, &flags); | 2515 | task_rq_unlock(rq, p, &flags); |
2545 | 2516 | ||
2546 | return ns; | 2517 | return ns; |
@@ -6368,6 +6339,10 @@ static void sched_init_numa(void) | |||
6368 | if (!sched_debug()) | 6339 | if (!sched_debug()) |
6369 | break; | 6340 | break; |
6370 | } | 6341 | } |
6342 | |||
6343 | if (!level) | ||
6344 | return; | ||
6345 | |||
6371 | /* | 6346 | /* |
6372 | * 'level' contains the number of unique distances, excluding the | 6347 | * 'level' contains the number of unique distances, excluding the |
6373 | * identity distance node_distance(i,i). | 6348 | * identity distance node_distance(i,i). |
@@ -7444,8 +7419,12 @@ void sched_move_task(struct task_struct *tsk) | |||
7444 | if (unlikely(running)) | 7419 | if (unlikely(running)) |
7445 | put_prev_task(rq, tsk); | 7420 | put_prev_task(rq, tsk); |
7446 | 7421 | ||
7447 | tg = container_of(task_css_check(tsk, cpu_cgrp_id, | 7422 | /* |
7448 | lockdep_is_held(&tsk->sighand->siglock)), | 7423 | * All callers are synchronized by task_rq_lock(); we do not use RCU |
7424 | * which is pointless here. Thus, we pass "true" to task_css_check() | ||
7425 | * to prevent lockdep warnings. | ||
7426 | */ | ||
7427 | tg = container_of(task_css_check(tsk, cpu_cgrp_id, true), | ||
7449 | struct task_group, css); | 7428 | struct task_group, css); |
7450 | tg = autogroup_task_group(tsk, tg); | 7429 | tg = autogroup_task_group(tsk, tg); |
7451 | tsk->sched_task_group = tg; | 7430 | tsk->sched_task_group = tg; |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 5285332392d5..28fa9d9e9201 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -1701,4 +1701,6 @@ const struct sched_class dl_sched_class = { | |||
1701 | .prio_changed = prio_changed_dl, | 1701 | .prio_changed = prio_changed_dl, |
1702 | .switched_from = switched_from_dl, | 1702 | .switched_from = switched_from_dl, |
1703 | .switched_to = switched_to_dl, | 1703 | .switched_to = switched_to_dl, |
1704 | |||
1705 | .update_curr = update_curr_dl, | ||
1704 | }; | 1706 | }; |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 34baa60f8a7b..ef2b104b254c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -726,6 +726,11 @@ static void update_curr(struct cfs_rq *cfs_rq) | |||
726 | account_cfs_rq_runtime(cfs_rq, delta_exec); | 726 | account_cfs_rq_runtime(cfs_rq, delta_exec); |
727 | } | 727 | } |
728 | 728 | ||
729 | static void update_curr_fair(struct rq *rq) | ||
730 | { | ||
731 | update_curr(cfs_rq_of(&rq->curr->se)); | ||
732 | } | ||
733 | |||
729 | static inline void | 734 | static inline void |
730 | update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se) | 735 | update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se) |
731 | { | 736 | { |
@@ -1180,6 +1185,13 @@ static void task_numa_compare(struct task_numa_env *env, | |||
1180 | raw_spin_unlock_irq(&dst_rq->lock); | 1185 | raw_spin_unlock_irq(&dst_rq->lock); |
1181 | 1186 | ||
1182 | /* | 1187 | /* |
1188 | * Because we have preemption enabled we can get migrated around and | ||
1189 | * end try selecting ourselves (current == env->p) as a swap candidate. | ||
1190 | */ | ||
1191 | if (cur == env->p) | ||
1192 | goto unlock; | ||
1193 | |||
1194 | /* | ||
1183 | * "imp" is the fault differential for the source task between the | 1195 | * "imp" is the fault differential for the source task between the |
1184 | * source and destination node. Calculate the total differential for | 1196 | * source and destination node. Calculate the total differential for |
1185 | * the source task and potential destination task. The more negative | 1197 | * the source task and potential destination task. The more negative |
@@ -7949,6 +7961,8 @@ const struct sched_class fair_sched_class = { | |||
7949 | 7961 | ||
7950 | .get_rr_interval = get_rr_interval_fair, | 7962 | .get_rr_interval = get_rr_interval_fair, |
7951 | 7963 | ||
7964 | .update_curr = update_curr_fair, | ||
7965 | |||
7952 | #ifdef CONFIG_FAIR_GROUP_SCHED | 7966 | #ifdef CONFIG_FAIR_GROUP_SCHED |
7953 | .task_move_group = task_move_group_fair, | 7967 | .task_move_group = task_move_group_fair, |
7954 | #endif | 7968 | #endif |
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index d024e6ce30ba..20bca398084a 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -2128,6 +2128,8 @@ const struct sched_class rt_sched_class = { | |||
2128 | 2128 | ||
2129 | .prio_changed = prio_changed_rt, | 2129 | .prio_changed = prio_changed_rt, |
2130 | .switched_to = switched_to_rt, | 2130 | .switched_to = switched_to_rt, |
2131 | |||
2132 | .update_curr = update_curr_rt, | ||
2131 | }; | 2133 | }; |
2132 | 2134 | ||
2133 | #ifdef CONFIG_SCHED_DEBUG | 2135 | #ifdef CONFIG_SCHED_DEBUG |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 24156c8434d1..2df8ef067cc5 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -1135,6 +1135,8 @@ struct sched_class { | |||
1135 | unsigned int (*get_rr_interval) (struct rq *rq, | 1135 | unsigned int (*get_rr_interval) (struct rq *rq, |
1136 | struct task_struct *task); | 1136 | struct task_struct *task); |
1137 | 1137 | ||
1138 | void (*update_curr) (struct rq *rq); | ||
1139 | |||
1138 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1140 | #ifdef CONFIG_FAIR_GROUP_SCHED |
1139 | void (*task_move_group) (struct task_struct *p, int on_rq); | 1141 | void (*task_move_group) (struct task_struct *p, int on_rq); |
1140 | #endif | 1142 | #endif |
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index 492b986195d5..a16b67859e2a 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c | |||
@@ -553,7 +553,7 @@ static int cpu_timer_sample_group(const clockid_t which_clock, | |||
553 | *sample = cputime_to_expires(cputime.utime); | 553 | *sample = cputime_to_expires(cputime.utime); |
554 | break; | 554 | break; |
555 | case CPUCLOCK_SCHED: | 555 | case CPUCLOCK_SCHED: |
556 | *sample = cputime.sum_exec_runtime + task_delta_exec(p); | 556 | *sample = cputime.sum_exec_runtime; |
557 | break; | 557 | break; |
558 | } | 558 | } |
559 | return 0; | 559 | return 0; |
diff --git a/lib/Makefile b/lib/Makefile index 7512dc978f18..0211d2bd5e17 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -10,7 +10,7 @@ endif | |||
10 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ | 10 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ |
11 | rbtree.o radix-tree.o dump_stack.o timerqueue.o\ | 11 | rbtree.o radix-tree.o dump_stack.o timerqueue.o\ |
12 | idr.o int_sqrt.o extable.o \ | 12 | idr.o int_sqrt.o extable.o \ |
13 | sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ | 13 | sha1.o md5.o irq_regs.o argv_split.o \ |
14 | proportions.o flex_proportions.o ratelimit.o show_mem.o \ | 14 | proportions.o flex_proportions.o ratelimit.o show_mem.o \ |
15 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ | 15 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ |
16 | earlycpio.o | 16 | earlycpio.o |
@@ -26,7 +26,7 @@ obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | |||
26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ | 26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ |
27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ | 27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ |
28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ | 28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ |
29 | percpu-refcount.o percpu_ida.o hash.o rhashtable.o | 29 | percpu-refcount.o percpu_ida.o hash.o rhashtable.o reciprocal_div.o |
30 | obj-y += string_helpers.o | 30 | obj-y += string_helpers.o |
31 | obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o | 31 | obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o |
32 | obj-y += kstrtox.o | 32 | obj-y += kstrtox.o |
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/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 648d79ccf462..c465876c7861 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -813,10 +813,9 @@ static void __br_multicast_send_query(struct net_bridge *br, | |||
813 | return; | 813 | return; |
814 | 814 | ||
815 | if (port) { | 815 | if (port) { |
816 | __skb_push(skb, sizeof(struct ethhdr)); | ||
817 | skb->dev = port->dev; | 816 | skb->dev = port->dev; |
818 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, | 817 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, |
819 | dev_queue_xmit); | 818 | br_dev_queue_push_xmit); |
820 | } else { | 819 | } else { |
821 | br_multicast_select_own_querier(br, ip, skb); | 820 | br_multicast_select_own_querier(br, ip, skb); |
822 | netif_rx(skb); | 821 | netif_rx(skb); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c906c5f4bf69..92116dfe827c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -552,20 +552,13 @@ static void kfree_skbmem(struct sk_buff *skb) | |||
552 | case SKB_FCLONE_CLONE: | 552 | case SKB_FCLONE_CLONE: |
553 | fclones = container_of(skb, struct sk_buff_fclones, skb2); | 553 | fclones = container_of(skb, struct sk_buff_fclones, skb2); |
554 | 554 | ||
555 | /* Warning : We must perform the atomic_dec_and_test() before | 555 | /* The clone portion is available for |
556 | * setting skb->fclone back to SKB_FCLONE_FREE, otherwise | 556 | * fast-cloning again. |
557 | * skb_clone() could set clone_ref to 2 before our decrement. | ||
558 | * Anyway, if we are going to free the structure, no need to | ||
559 | * rewrite skb->fclone. | ||
560 | */ | 557 | */ |
561 | if (atomic_dec_and_test(&fclones->fclone_ref)) { | 558 | skb->fclone = SKB_FCLONE_FREE; |
559 | |||
560 | if (atomic_dec_and_test(&fclones->fclone_ref)) | ||
562 | kmem_cache_free(skbuff_fclone_cache, fclones); | 561 | kmem_cache_free(skbuff_fclone_cache, fclones); |
563 | } else { | ||
564 | /* The clone portion is available for | ||
565 | * fast-cloning again. | ||
566 | */ | ||
567 | skb->fclone = SKB_FCLONE_FREE; | ||
568 | } | ||
569 | break; | 562 | break; |
570 | } | 563 | } |
571 | } | 564 | } |
@@ -887,11 +880,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
887 | if (skb->fclone == SKB_FCLONE_ORIG && | 880 | if (skb->fclone == SKB_FCLONE_ORIG && |
888 | n->fclone == SKB_FCLONE_FREE) { | 881 | n->fclone == SKB_FCLONE_FREE) { |
889 | n->fclone = SKB_FCLONE_CLONE; | 882 | n->fclone = SKB_FCLONE_CLONE; |
890 | /* As our fastclone was free, clone_ref must be 1 at this point. | 883 | atomic_inc(&fclones->fclone_ref); |
891 | * We could use atomic_inc() here, but it is faster | ||
892 | * to set the final value. | ||
893 | */ | ||
894 | atomic_set(&fclones->fclone_ref, 2); | ||
895 | } else { | 884 | } else { |
896 | if (skb_pfmemalloc(skb)) | 885 | if (skb_pfmemalloc(skb)) |
897 | gfp_mask |= __GFP_MEMALLOC; | 886 | gfp_mask |= __GFP_MEMALLOC; |
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index ca11d283bbeb..93ea80196f0e 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -1080,13 +1080,13 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1080 | if (!app) | 1080 | if (!app) |
1081 | return -EMSGSIZE; | 1081 | return -EMSGSIZE; |
1082 | 1082 | ||
1083 | spin_lock(&dcb_lock); | 1083 | spin_lock_bh(&dcb_lock); |
1084 | list_for_each_entry(itr, &dcb_app_list, list) { | 1084 | list_for_each_entry(itr, &dcb_app_list, list) { |
1085 | if (itr->ifindex == netdev->ifindex) { | 1085 | if (itr->ifindex == netdev->ifindex) { |
1086 | err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), | 1086 | err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), |
1087 | &itr->app); | 1087 | &itr->app); |
1088 | if (err) { | 1088 | if (err) { |
1089 | spin_unlock(&dcb_lock); | 1089 | spin_unlock_bh(&dcb_lock); |
1090 | return -EMSGSIZE; | 1090 | return -EMSGSIZE; |
1091 | } | 1091 | } |
1092 | } | 1092 | } |
@@ -1097,7 +1097,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1097 | else | 1097 | else |
1098 | dcbx = -EOPNOTSUPP; | 1098 | dcbx = -EOPNOTSUPP; |
1099 | 1099 | ||
1100 | spin_unlock(&dcb_lock); | 1100 | spin_unlock_bh(&dcb_lock); |
1101 | nla_nest_end(skb, app); | 1101 | nla_nest_end(skb, app); |
1102 | 1102 | ||
1103 | /* get peer info if available */ | 1103 | /* get peer info if available */ |
@@ -1234,7 +1234,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | /* local app */ | 1236 | /* local app */ |
1237 | spin_lock(&dcb_lock); | 1237 | spin_lock_bh(&dcb_lock); |
1238 | app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); | 1238 | app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); |
1239 | if (!app) | 1239 | if (!app) |
1240 | goto dcb_unlock; | 1240 | goto dcb_unlock; |
@@ -1271,7 +1271,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1271 | else | 1271 | else |
1272 | dcbx = -EOPNOTSUPP; | 1272 | dcbx = -EOPNOTSUPP; |
1273 | 1273 | ||
1274 | spin_unlock(&dcb_lock); | 1274 | spin_unlock_bh(&dcb_lock); |
1275 | 1275 | ||
1276 | /* features flags */ | 1276 | /* features flags */ |
1277 | if (ops->getfeatcfg) { | 1277 | if (ops->getfeatcfg) { |
@@ -1326,7 +1326,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1326 | return 0; | 1326 | return 0; |
1327 | 1327 | ||
1328 | dcb_unlock: | 1328 | dcb_unlock: |
1329 | spin_unlock(&dcb_lock); | 1329 | spin_unlock_bh(&dcb_lock); |
1330 | nla_put_failure: | 1330 | nla_put_failure: |
1331 | return err; | 1331 | return err; |
1332 | } | 1332 | } |
@@ -1762,10 +1762,10 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app) | |||
1762 | struct dcb_app_type *itr; | 1762 | struct dcb_app_type *itr; |
1763 | u8 prio = 0; | 1763 | u8 prio = 0; |
1764 | 1764 | ||
1765 | spin_lock(&dcb_lock); | 1765 | spin_lock_bh(&dcb_lock); |
1766 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) | 1766 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) |
1767 | prio = itr->app.priority; | 1767 | prio = itr->app.priority; |
1768 | spin_unlock(&dcb_lock); | 1768 | spin_unlock_bh(&dcb_lock); |
1769 | 1769 | ||
1770 | return prio; | 1770 | return prio; |
1771 | } | 1771 | } |
@@ -1789,7 +1789,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) | |||
1789 | if (dev->dcbnl_ops->getdcbx) | 1789 | if (dev->dcbnl_ops->getdcbx) |
1790 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1790 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
1791 | 1791 | ||
1792 | spin_lock(&dcb_lock); | 1792 | spin_lock_bh(&dcb_lock); |
1793 | /* Search for existing match and replace */ | 1793 | /* Search for existing match and replace */ |
1794 | if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { | 1794 | if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { |
1795 | if (new->priority) | 1795 | if (new->priority) |
@@ -1804,7 +1804,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) | |||
1804 | if (new->priority) | 1804 | if (new->priority) |
1805 | err = dcb_app_add(new, dev->ifindex); | 1805 | err = dcb_app_add(new, dev->ifindex); |
1806 | out: | 1806 | out: |
1807 | spin_unlock(&dcb_lock); | 1807 | spin_unlock_bh(&dcb_lock); |
1808 | if (!err) | 1808 | if (!err) |
1809 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1809 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
1810 | return err; | 1810 | return err; |
@@ -1823,10 +1823,10 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app) | |||
1823 | struct dcb_app_type *itr; | 1823 | struct dcb_app_type *itr; |
1824 | u8 prio = 0; | 1824 | u8 prio = 0; |
1825 | 1825 | ||
1826 | spin_lock(&dcb_lock); | 1826 | spin_lock_bh(&dcb_lock); |
1827 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) | 1827 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) |
1828 | prio |= 1 << itr->app.priority; | 1828 | prio |= 1 << itr->app.priority; |
1829 | spin_unlock(&dcb_lock); | 1829 | spin_unlock_bh(&dcb_lock); |
1830 | 1830 | ||
1831 | return prio; | 1831 | return prio; |
1832 | } | 1832 | } |
@@ -1850,7 +1850,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new) | |||
1850 | if (dev->dcbnl_ops->getdcbx) | 1850 | if (dev->dcbnl_ops->getdcbx) |
1851 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1851 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
1852 | 1852 | ||
1853 | spin_lock(&dcb_lock); | 1853 | spin_lock_bh(&dcb_lock); |
1854 | /* Search for existing match and abort if found */ | 1854 | /* Search for existing match and abort if found */ |
1855 | if (dcb_app_lookup(new, dev->ifindex, new->priority)) { | 1855 | if (dcb_app_lookup(new, dev->ifindex, new->priority)) { |
1856 | err = -EEXIST; | 1856 | err = -EEXIST; |
@@ -1859,7 +1859,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new) | |||
1859 | 1859 | ||
1860 | err = dcb_app_add(new, dev->ifindex); | 1860 | err = dcb_app_add(new, dev->ifindex); |
1861 | out: | 1861 | out: |
1862 | spin_unlock(&dcb_lock); | 1862 | spin_unlock_bh(&dcb_lock); |
1863 | if (!err) | 1863 | if (!err) |
1864 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1864 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
1865 | return err; | 1865 | return err; |
@@ -1882,7 +1882,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del) | |||
1882 | if (dev->dcbnl_ops->getdcbx) | 1882 | if (dev->dcbnl_ops->getdcbx) |
1883 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1883 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
1884 | 1884 | ||
1885 | spin_lock(&dcb_lock); | 1885 | spin_lock_bh(&dcb_lock); |
1886 | /* Search for existing match and remove it. */ | 1886 | /* Search for existing match and remove it. */ |
1887 | if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { | 1887 | if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { |
1888 | list_del(&itr->list); | 1888 | list_del(&itr->list); |
@@ -1890,7 +1890,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del) | |||
1890 | err = 0; | 1890 | err = 0; |
1891 | } | 1891 | } |
1892 | 1892 | ||
1893 | spin_unlock(&dcb_lock); | 1893 | spin_unlock_bh(&dcb_lock); |
1894 | if (!err) | 1894 | if (!err) |
1895 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1895 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
1896 | return err; | 1896 | return err; |
@@ -1902,12 +1902,12 @@ static void dcb_flushapp(void) | |||
1902 | struct dcb_app_type *app; | 1902 | struct dcb_app_type *app; |
1903 | struct dcb_app_type *tmp; | 1903 | struct dcb_app_type *tmp; |
1904 | 1904 | ||
1905 | spin_lock(&dcb_lock); | 1905 | spin_lock_bh(&dcb_lock); |
1906 | list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { | 1906 | list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { |
1907 | list_del(&app->list); | 1907 | list_del(&app->list); |
1908 | kfree(app); | 1908 | kfree(app); |
1909 | } | 1909 | } |
1910 | spin_unlock(&dcb_lock); | 1910 | spin_unlock_bh(&dcb_lock); |
1911 | } | 1911 | } |
1912 | 1912 | ||
1913 | static int __init dcbnl_init(void) | 1913 | static int __init dcbnl_init(void) |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index f2e15738534d..8f7bd56955b0 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -62,6 +62,10 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) | |||
62 | else | 62 | else |
63 | res->tclassid = 0; | 63 | res->tclassid = 0; |
64 | #endif | 64 | #endif |
65 | |||
66 | if (err == -ESRCH) | ||
67 | err = -ENETUNREACH; | ||
68 | |||
65 | return err; | 69 | return err; |
66 | } | 70 | } |
67 | EXPORT_SYMBOL_GPL(__fib_lookup); | 71 | EXPORT_SYMBOL_GPL(__fib_lookup); |
diff --git a/net/ipv4/netfilter/nft_masq_ipv4.c b/net/ipv4/netfilter/nft_masq_ipv4.c index c1023c445920..665de06561cd 100644 --- a/net/ipv4/netfilter/nft_masq_ipv4.c +++ b/net/ipv4/netfilter/nft_masq_ipv4.c | |||
@@ -24,6 +24,7 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr, | |||
24 | struct nf_nat_range range; | 24 | struct nf_nat_range range; |
25 | unsigned int verdict; | 25 | unsigned int verdict; |
26 | 26 | ||
27 | memset(&range, 0, sizeof(range)); | ||
27 | range.flags = priv->flags; | 28 | range.flags = priv->flags; |
28 | 29 | ||
29 | verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, | 30 | verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d91436ba17ea..d22a31f27ab4 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5232,7 +5232,7 @@ slow_path: | |||
5232 | if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) | 5232 | if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) |
5233 | goto csum_error; | 5233 | goto csum_error; |
5234 | 5234 | ||
5235 | if (!th->ack && !th->rst) | 5235 | if (!th->ack && !th->rst && !th->syn) |
5236 | goto discard; | 5236 | goto discard; |
5237 | 5237 | ||
5238 | /* | 5238 | /* |
@@ -5651,7 +5651,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
5651 | goto discard; | 5651 | goto discard; |
5652 | } | 5652 | } |
5653 | 5653 | ||
5654 | if (!th->ack && !th->rst) | 5654 | if (!th->ack && !th->rst && !th->syn) |
5655 | goto discard; | 5655 | goto discard; |
5656 | 5656 | ||
5657 | if (!tcp_validate_incoming(sk, skb, th, 0)) | 5657 | if (!tcp_validate_incoming(sk, skb, th, 0)) |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 467f310dbbb3..722669754bbf 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1439,6 +1439,10 @@ reg_pernet_fail: | |||
1439 | 1439 | ||
1440 | void ip6_mr_cleanup(void) | 1440 | void ip6_mr_cleanup(void) |
1441 | { | 1441 | { |
1442 | rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE); | ||
1443 | #ifdef CONFIG_IPV6_PIMSM_V2 | ||
1444 | inet6_del_protocol(&pim6_protocol, IPPROTO_PIM); | ||
1445 | #endif | ||
1442 | unregister_netdevice_notifier(&ip6_mr_notifier); | 1446 | unregister_netdevice_notifier(&ip6_mr_notifier); |
1443 | unregister_pernet_subsys(&ip6mr_net_ops); | 1447 | unregister_pernet_subsys(&ip6mr_net_ops); |
1444 | kmem_cache_destroy(mrt_cachep); | 1448 | kmem_cache_destroy(mrt_cachep); |
diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c index 8a7ac685076d..529c119cbb14 100644 --- a/net/ipv6/netfilter/nft_masq_ipv6.c +++ b/net/ipv6/netfilter/nft_masq_ipv6.c | |||
@@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr, | |||
25 | struct nf_nat_range range; | 25 | struct nf_nat_range range; |
26 | unsigned int verdict; | 26 | unsigned int verdict; |
27 | 27 | ||
28 | memset(&range, 0, sizeof(range)); | ||
28 | range.flags = priv->flags; | 29 | range.flags = priv->flags; |
29 | 30 | ||
30 | verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); | 31 | verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index a0c75366c93b..97dc4320ac15 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1764,6 +1764,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1764 | struct ipxhdr *ipx = NULL; | 1764 | struct ipxhdr *ipx = NULL; |
1765 | struct sk_buff *skb; | 1765 | struct sk_buff *skb; |
1766 | int copied, rc; | 1766 | int copied, rc; |
1767 | bool locked = true; | ||
1767 | 1768 | ||
1768 | lock_sock(sk); | 1769 | lock_sock(sk); |
1769 | /* put the autobinding in */ | 1770 | /* put the autobinding in */ |
@@ -1790,6 +1791,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1790 | if (sock_flag(sk, SOCK_ZAPPED)) | 1791 | if (sock_flag(sk, SOCK_ZAPPED)) |
1791 | goto out; | 1792 | goto out; |
1792 | 1793 | ||
1794 | release_sock(sk); | ||
1795 | locked = false; | ||
1793 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 1796 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
1794 | flags & MSG_DONTWAIT, &rc); | 1797 | flags & MSG_DONTWAIT, &rc); |
1795 | if (!skb) { | 1798 | if (!skb) { |
@@ -1825,7 +1828,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1825 | out_free: | 1828 | out_free: |
1826 | skb_free_datagram(sk, skb); | 1829 | skb_free_datagram(sk, skb); |
1827 | out: | 1830 | out: |
1828 | release_sock(sk); | 1831 | if (locked) |
1832 | release_sock(sk); | ||
1829 | return rc; | 1833 | return rc; |
1830 | } | 1834 | } |
1831 | 1835 | ||
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 62ff7cfb2723..d013429af7ce 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -394,19 +394,16 @@ minstrel_ht_sort_best_tp_rates(struct minstrel_ht_sta *mi, u16 index, | |||
394 | cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; | 394 | cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; |
395 | cur_prob = mi->groups[cur_group].rates[cur_idx].probability; | 395 | cur_prob = mi->groups[cur_group].rates[cur_idx].probability; |
396 | 396 | ||
397 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; | 397 | do { |
398 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; | ||
399 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; | ||
400 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; | ||
401 | |||
402 | while (j > 0 && (cur_thr > tmp_thr || | ||
403 | (cur_thr == tmp_thr && cur_prob > tmp_prob))) { | ||
404 | j--; | ||
405 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; | 398 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; |
406 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; | 399 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; |
407 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; | 400 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; |
408 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; | 401 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; |
409 | } | 402 | if (cur_thr < tmp_thr || |
403 | (cur_thr == tmp_thr && cur_prob <= tmp_prob)) | ||
404 | break; | ||
405 | j--; | ||
406 | } while (j > 0); | ||
410 | 407 | ||
411 | if (j < MAX_THR_RATES - 1) { | 408 | if (j < MAX_THR_RATES - 1) { |
412 | memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * | 409 | memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 86f9d76b1464..d259da3ce67a 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
@@ -1863,6 +1863,12 @@ ip_set_sockfn_get(struct sock *sk, int optval, void __user *user, int *len) | |||
1863 | if (*op < IP_SET_OP_VERSION) { | 1863 | if (*op < IP_SET_OP_VERSION) { |
1864 | /* Check the version at the beginning of operations */ | 1864 | /* Check the version at the beginning of operations */ |
1865 | struct ip_set_req_version *req_version = data; | 1865 | struct ip_set_req_version *req_version = data; |
1866 | |||
1867 | if (*len < sizeof(struct ip_set_req_version)) { | ||
1868 | ret = -EINVAL; | ||
1869 | goto done; | ||
1870 | } | ||
1871 | |||
1866 | if (req_version->version != IPSET_PROTOCOL) { | 1872 | if (req_version->version != IPSET_PROTOCOL) { |
1867 | ret = -EPROTO; | 1873 | ret = -EPROTO; |
1868 | goto done; | 1874 | goto done; |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 437a3663ad03..bd90bf8107da 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
@@ -846,6 +846,8 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, | |||
846 | new_skb = skb_realloc_headroom(skb, max_headroom); | 846 | new_skb = skb_realloc_headroom(skb, max_headroom); |
847 | if (!new_skb) | 847 | if (!new_skb) |
848 | goto error; | 848 | goto error; |
849 | if (skb->sk) | ||
850 | skb_set_owner_w(new_skb, skb->sk); | ||
849 | consume_skb(skb); | 851 | consume_skb(skb); |
850 | skb = new_skb; | 852 | skb = new_skb; |
851 | } | 853 | } |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 5016a6929085..2c699757bccf 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -611,12 +611,16 @@ __nf_conntrack_confirm(struct sk_buff *skb) | |||
611 | */ | 611 | */ |
612 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); | 612 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); |
613 | pr_debug("Confirming conntrack %p\n", ct); | 613 | pr_debug("Confirming conntrack %p\n", ct); |
614 | /* We have to check the DYING flag inside the lock to prevent | 614 | |
615 | a race against nf_ct_get_next_corpse() possibly called from | 615 | /* We have to check the DYING flag after unlink to prevent |
616 | user context, else we insert an already 'dead' hash, blocking | 616 | * a race against nf_ct_get_next_corpse() possibly called from |
617 | further use of that particular connection -JM */ | 617 | * user context, else we insert an already 'dead' hash, blocking |
618 | * further use of that particular connection -JM. | ||
619 | */ | ||
620 | nf_ct_del_from_dying_or_unconfirmed_list(ct); | ||
618 | 621 | ||
619 | if (unlikely(nf_ct_is_dying(ct))) { | 622 | if (unlikely(nf_ct_is_dying(ct))) { |
623 | nf_ct_add_to_dying_list(ct); | ||
620 | nf_conntrack_double_unlock(hash, reply_hash); | 624 | nf_conntrack_double_unlock(hash, reply_hash); |
621 | local_bh_enable(); | 625 | local_bh_enable(); |
622 | return NF_ACCEPT; | 626 | return NF_ACCEPT; |
@@ -636,8 +640,6 @@ __nf_conntrack_confirm(struct sk_buff *skb) | |||
636 | zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) | 640 | zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) |
637 | goto out; | 641 | goto out; |
638 | 642 | ||
639 | nf_ct_del_from_dying_or_unconfirmed_list(ct); | ||
640 | |||
641 | /* Timer relative to confirmation time, not original | 643 | /* Timer relative to confirmation time, not original |
642 | setting time, otherwise we'd get timer wrap in | 644 | setting time, otherwise we'd get timer wrap in |
643 | weird delay cases. */ | 645 | weird delay cases. */ |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 11ab4b078f3b..66e8425dbfe7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -3484,13 +3484,8 @@ static void nft_chain_commit_update(struct nft_trans *trans) | |||
3484 | } | 3484 | } |
3485 | } | 3485 | } |
3486 | 3486 | ||
3487 | /* Schedule objects for release via rcu to make sure no packets are accesing | 3487 | static void nf_tables_commit_release(struct nft_trans *trans) |
3488 | * removed rules. | ||
3489 | */ | ||
3490 | static void nf_tables_commit_release_rcu(struct rcu_head *rt) | ||
3491 | { | 3488 | { |
3492 | struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); | ||
3493 | |||
3494 | switch (trans->msg_type) { | 3489 | switch (trans->msg_type) { |
3495 | case NFT_MSG_DELTABLE: | 3490 | case NFT_MSG_DELTABLE: |
3496 | nf_tables_table_destroy(&trans->ctx); | 3491 | nf_tables_table_destroy(&trans->ctx); |
@@ -3612,10 +3607,11 @@ static int nf_tables_commit(struct sk_buff *skb) | |||
3612 | } | 3607 | } |
3613 | } | 3608 | } |
3614 | 3609 | ||
3610 | synchronize_rcu(); | ||
3611 | |||
3615 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { | 3612 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { |
3616 | list_del(&trans->list); | 3613 | list_del(&trans->list); |
3617 | trans->ctx.nla = NULL; | 3614 | nf_tables_commit_release(trans); |
3618 | call_rcu(&trans->rcu_head, nf_tables_commit_release_rcu); | ||
3619 | } | 3615 | } |
3620 | 3616 | ||
3621 | nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); | 3617 | nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); |
@@ -3623,13 +3619,8 @@ static int nf_tables_commit(struct sk_buff *skb) | |||
3623 | return 0; | 3619 | return 0; |
3624 | } | 3620 | } |
3625 | 3621 | ||
3626 | /* Schedule objects for release via rcu to make sure no packets are accesing | 3622 | static void nf_tables_abort_release(struct nft_trans *trans) |
3627 | * aborted rules. | ||
3628 | */ | ||
3629 | static void nf_tables_abort_release_rcu(struct rcu_head *rt) | ||
3630 | { | 3623 | { |
3631 | struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); | ||
3632 | |||
3633 | switch (trans->msg_type) { | 3624 | switch (trans->msg_type) { |
3634 | case NFT_MSG_NEWTABLE: | 3625 | case NFT_MSG_NEWTABLE: |
3635 | nf_tables_table_destroy(&trans->ctx); | 3626 | nf_tables_table_destroy(&trans->ctx); |
@@ -3725,11 +3716,12 @@ static int nf_tables_abort(struct sk_buff *skb) | |||
3725 | } | 3716 | } |
3726 | } | 3717 | } |
3727 | 3718 | ||
3719 | synchronize_rcu(); | ||
3720 | |||
3728 | list_for_each_entry_safe_reverse(trans, next, | 3721 | list_for_each_entry_safe_reverse(trans, next, |
3729 | &net->nft.commit_list, list) { | 3722 | &net->nft.commit_list, list) { |
3730 | list_del(&trans->list); | 3723 | list_del(&trans->list); |
3731 | trans->ctx.nla = NULL; | 3724 | nf_tables_abort_release(trans); |
3732 | call_rcu(&trans->rcu_head, nf_tables_abort_release_rcu); | ||
3733 | } | 3725 | } |
3734 | 3726 | ||
3735 | return 0; | 3727 | return 0; |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 6c5a915cfa75..13c2e17bbe27 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -47,6 +47,8 @@ static const int nfnl_group2type[NFNLGRP_MAX+1] = { | |||
47 | [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, | 47 | [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, |
48 | [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, | 48 | [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, |
49 | [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, | 49 | [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, |
50 | [NFNLGRP_NFTABLES] = NFNL_SUBSYS_NFTABLES, | ||
51 | [NFNLGRP_ACCT_QUOTA] = NFNL_SUBSYS_ACCT, | ||
50 | }; | 52 | }; |
51 | 53 | ||
52 | void nfnl_lock(__u8 subsys_id) | 54 | void nfnl_lock(__u8 subsys_id) |
@@ -464,7 +466,12 @@ static void nfnetlink_rcv(struct sk_buff *skb) | |||
464 | static int nfnetlink_bind(int group) | 466 | static int nfnetlink_bind(int group) |
465 | { | 467 | { |
466 | const struct nfnetlink_subsystem *ss; | 468 | const struct nfnetlink_subsystem *ss; |
467 | int type = nfnl_group2type[group]; | 469 | int type; |
470 | |||
471 | if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX) | ||
472 | return -EINVAL; | ||
473 | |||
474 | type = nfnl_group2type[group]; | ||
468 | 475 | ||
469 | rcu_read_lock(); | 476 | rcu_read_lock(); |
470 | ss = nfnetlink_get_subsys(type); | 477 | ss = nfnetlink_get_subsys(type); |
@@ -514,6 +521,9 @@ static int __init nfnetlink_init(void) | |||
514 | { | 521 | { |
515 | int i; | 522 | int i; |
516 | 523 | ||
524 | for (i = NFNLGRP_NONE + 1; i <= NFNLGRP_MAX; i++) | ||
525 | BUG_ON(nfnl_group2type[i] == NFNL_SUBSYS_NONE); | ||
526 | |||
517 | for (i=0; i<NFNL_SUBSYS_COUNT; i++) | 527 | for (i=0; i<NFNL_SUBSYS_COUNT; i++) |
518 | mutex_init(&table[i].mutex); | 528 | mutex_init(&table[i].mutex); |
519 | 529 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 9d6d6f60a80f..265e190f2218 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -21,45 +21,17 @@ | |||
21 | #include <linux/netfilter_ipv6/ip6_tables.h> | 21 | #include <linux/netfilter_ipv6/ip6_tables.h> |
22 | #include <net/netfilter/nf_tables.h> | 22 | #include <net/netfilter/nf_tables.h> |
23 | 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, | 24 | static int nft_compat_chain_validate_dependency(const char *tablename, |
49 | const struct nft_chain *chain) | 25 | const struct nft_chain *chain) |
50 | { | 26 | { |
51 | enum nft_chain_type type; | ||
52 | const struct nft_base_chain *basechain; | 27 | const struct nft_base_chain *basechain; |
53 | 28 | ||
54 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) | 29 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) |
55 | return 0; | 30 | return 0; |
56 | 31 | ||
57 | type = nft_compat_table_to_chaintype(tablename); | ||
58 | if (type < 0) | ||
59 | return -EINVAL; | ||
60 | |||
61 | basechain = nft_base_chain(chain); | 32 | basechain = nft_base_chain(chain); |
62 | if (basechain->type->type != type) | 33 | if (strcmp(tablename, "nat") == 0 && |
34 | basechain->type->type != NFT_CHAIN_T_NAT) | ||
63 | return -EINVAL; | 35 | return -EINVAL; |
64 | 36 | ||
65 | return 0; | 37 | return 0; |
@@ -117,7 +89,7 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, | |||
117 | struct xt_target *target, void *info, | 89 | struct xt_target *target, void *info, |
118 | union nft_entry *entry, u8 proto, bool inv) | 90 | union nft_entry *entry, u8 proto, bool inv) |
119 | { | 91 | { |
120 | par->net = &init_net; | 92 | par->net = ctx->net; |
121 | par->table = ctx->table->name; | 93 | par->table = ctx->table->name; |
122 | switch (ctx->afi->family) { | 94 | switch (ctx->afi->family) { |
123 | case AF_INET: | 95 | case AF_INET: |
@@ -324,7 +296,7 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | |||
324 | struct xt_match *match, void *info, | 296 | struct xt_match *match, void *info, |
325 | union nft_entry *entry, u8 proto, bool inv) | 297 | union nft_entry *entry, u8 proto, bool inv) |
326 | { | 298 | { |
327 | par->net = &init_net; | 299 | par->net = ctx->net; |
328 | par->table = ctx->table->name; | 300 | par->table = ctx->table->name; |
329 | switch (ctx->afi->family) { | 301 | switch (ctx->afi->family) { |
330 | case AF_INET: | 302 | case AF_INET: |
@@ -374,7 +346,7 @@ nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
374 | union nft_entry e = {}; | 346 | union nft_entry e = {}; |
375 | int ret; | 347 | int ret; |
376 | 348 | ||
377 | ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); | 349 | ret = nft_compat_chain_validate_dependency(match->table, ctx->chain); |
378 | if (ret < 0) | 350 | if (ret < 0) |
379 | goto err; | 351 | goto err; |
380 | 352 | ||
@@ -448,7 +420,7 @@ static int nft_match_validate(const struct nft_ctx *ctx, | |||
448 | if (!(hook_mask & match->hooks)) | 420 | if (!(hook_mask & match->hooks)) |
449 | return -EINVAL; | 421 | return -EINVAL; |
450 | 422 | ||
451 | ret = nft_compat_chain_validate_dependency(match->name, | 423 | ret = nft_compat_chain_validate_dependency(match->table, |
452 | ctx->chain); | 424 | ctx->chain); |
453 | if (ret < 0) | 425 | if (ret < 0) |
454 | return ret; | 426 | return ret; |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 4e05ea1c2d11..764fdc39c63b 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -281,11 +281,11 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto, | |||
281 | { | 281 | { |
282 | int transport_len = skb->len - skb_transport_offset(skb); | 282 | int transport_len = skb->len - skb_transport_offset(skb); |
283 | 283 | ||
284 | if (l4_proto == IPPROTO_TCP) { | 284 | if (l4_proto == NEXTHDR_TCP) { |
285 | if (likely(transport_len >= sizeof(struct tcphdr))) | 285 | if (likely(transport_len >= sizeof(struct tcphdr))) |
286 | inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, | 286 | inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, |
287 | addr, new_addr, 1); | 287 | addr, new_addr, 1); |
288 | } else if (l4_proto == IPPROTO_UDP) { | 288 | } else if (l4_proto == NEXTHDR_UDP) { |
289 | if (likely(transport_len >= sizeof(struct udphdr))) { | 289 | if (likely(transport_len >= sizeof(struct udphdr))) { |
290 | struct udphdr *uh = udp_hdr(skb); | 290 | struct udphdr *uh = udp_hdr(skb); |
291 | 291 | ||
@@ -296,6 +296,10 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto, | |||
296 | uh->check = CSUM_MANGLED_0; | 296 | uh->check = CSUM_MANGLED_0; |
297 | } | 297 | } |
298 | } | 298 | } |
299 | } else if (l4_proto == NEXTHDR_ICMP) { | ||
300 | if (likely(transport_len >= sizeof(struct icmp6hdr))) | ||
301 | inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum, | ||
302 | skb, addr, new_addr, 1); | ||
299 | } | 303 | } |
300 | } | 304 | } |
301 | 305 | ||
@@ -815,8 +819,6 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
815 | 819 | ||
816 | case OVS_ACTION_ATTR_SAMPLE: | 820 | case OVS_ACTION_ATTR_SAMPLE: |
817 | err = sample(dp, skb, key, a); | 821 | err = sample(dp, skb, key, a); |
818 | if (unlikely(err)) /* skb already freed. */ | ||
819 | return err; | ||
820 | break; | 822 | break; |
821 | } | 823 | } |
822 | 824 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index f37ca3e5824c..332b5a031739 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -1316,7 +1316,7 @@ static size_t ovs_dp_cmd_msg_size(void) | |||
1316 | return msgsize; | 1316 | return msgsize; |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | /* Called with ovs_mutex or RCU read lock. */ | 1319 | /* Called with ovs_mutex. */ |
1320 | static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, | 1320 | static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, |
1321 | u32 portid, u32 seq, u32 flags, u8 cmd) | 1321 | u32 portid, u32 seq, u32 flags, u8 cmd) |
1322 | { | 1322 | { |
@@ -1604,7 +1604,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info) | |||
1604 | if (!reply) | 1604 | if (!reply) |
1605 | return -ENOMEM; | 1605 | return -ENOMEM; |
1606 | 1606 | ||
1607 | rcu_read_lock(); | 1607 | ovs_lock(); |
1608 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); | 1608 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); |
1609 | if (IS_ERR(dp)) { | 1609 | if (IS_ERR(dp)) { |
1610 | err = PTR_ERR(dp); | 1610 | err = PTR_ERR(dp); |
@@ -1613,12 +1613,12 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info) | |||
1613 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, | 1613 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, |
1614 | info->snd_seq, 0, OVS_DP_CMD_NEW); | 1614 | info->snd_seq, 0, OVS_DP_CMD_NEW); |
1615 | BUG_ON(err < 0); | 1615 | BUG_ON(err < 0); |
1616 | rcu_read_unlock(); | 1616 | ovs_unlock(); |
1617 | 1617 | ||
1618 | return genlmsg_reply(reply, info); | 1618 | return genlmsg_reply(reply, info); |
1619 | 1619 | ||
1620 | err_unlock_free: | 1620 | err_unlock_free: |
1621 | rcu_read_unlock(); | 1621 | ovs_unlock(); |
1622 | kfree_skb(reply); | 1622 | kfree_skb(reply); |
1623 | return err; | 1623 | return err; |
1624 | } | 1624 | } |
@@ -1630,8 +1630,8 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1630 | int skip = cb->args[0]; | 1630 | int skip = cb->args[0]; |
1631 | int i = 0; | 1631 | int i = 0; |
1632 | 1632 | ||
1633 | rcu_read_lock(); | 1633 | ovs_lock(); |
1634 | list_for_each_entry_rcu(dp, &ovs_net->dps, list_node) { | 1634 | list_for_each_entry(dp, &ovs_net->dps, list_node) { |
1635 | if (i >= skip && | 1635 | if (i >= skip && |
1636 | ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, | 1636 | ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, |
1637 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 1637 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
@@ -1639,7 +1639,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1639 | break; | 1639 | break; |
1640 | i++; | 1640 | i++; |
1641 | } | 1641 | } |
1642 | rcu_read_unlock(); | 1642 | ovs_unlock(); |
1643 | 1643 | ||
1644 | cb->args[0] = i; | 1644 | cb->args[0] = i; |
1645 | 1645 | ||
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index c8fccdded865..df3c7f20fcee 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
@@ -140,7 +140,7 @@ static bool match_validate(const struct sw_flow_match *match, | |||
140 | if (match->key->eth.type == htons(ETH_P_ARP) | 140 | if (match->key->eth.type == htons(ETH_P_ARP) |
141 | || match->key->eth.type == htons(ETH_P_RARP)) { | 141 | || match->key->eth.type == htons(ETH_P_RARP)) { |
142 | key_expected |= 1 << OVS_KEY_ATTR_ARP; | 142 | key_expected |= 1 << OVS_KEY_ATTR_ARP; |
143 | if (match->mask && (match->mask->key.eth.type == htons(0xffff))) | 143 | if (match->mask && (match->mask->key.tp.src == htons(0xff))) |
144 | mask_allowed |= 1 << OVS_KEY_ATTR_ARP; | 144 | mask_allowed |= 1 << OVS_KEY_ATTR_ARP; |
145 | } | 145 | } |
146 | 146 | ||
@@ -772,6 +772,13 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs, | |||
772 | ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); | 772 | ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); |
773 | return -EINVAL; | 773 | return -EINVAL; |
774 | } | 774 | } |
775 | |||
776 | if (!is_mask && ipv6_key->ipv6_label & htonl(0xFFF00000)) { | ||
777 | OVS_NLERR(log, "IPv6 flow label %x is out of range (max=%x).\n", | ||
778 | ntohl(ipv6_key->ipv6_label), (1 << 20) - 1); | ||
779 | return -EINVAL; | ||
780 | } | ||
781 | |||
775 | SW_FLOW_KEY_PUT(match, ipv6.label, | 782 | SW_FLOW_KEY_PUT(match, ipv6.label, |
776 | ipv6_key->ipv6_label, is_mask); | 783 | ipv6_key->ipv6_label, is_mask); |
777 | SW_FLOW_KEY_PUT(match, ip.proto, | 784 | SW_FLOW_KEY_PUT(match, ip.proto, |
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/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 172395465e8a..8fea1b86df25 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4520,6 +4520,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4520 | [ALC269_FIXUP_HEADSET_MODE] = { | 4520 | [ALC269_FIXUP_HEADSET_MODE] = { |
4521 | .type = HDA_FIXUP_FUNC, | 4521 | .type = HDA_FIXUP_FUNC, |
4522 | .v.func = alc_fixup_headset_mode, | 4522 | .v.func = alc_fixup_headset_mode, |
4523 | .chained = true, | ||
4524 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4523 | }, | 4525 | }, |
4524 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4526 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4525 | .type = HDA_FIXUP_FUNC, | 4527 | .type = HDA_FIXUP_FUNC, |
@@ -4709,6 +4711,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4709 | [ALC255_FIXUP_HEADSET_MODE] = { | 4711 | [ALC255_FIXUP_HEADSET_MODE] = { |
4710 | .type = HDA_FIXUP_FUNC, | 4712 | .type = HDA_FIXUP_FUNC, |
4711 | .v.func = alc_fixup_headset_mode_alc255, | 4713 | .v.func = alc_fixup_headset_mode_alc255, |
4714 | .chained = true, | ||
4715 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4712 | }, | 4716 | }, |
4713 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4717 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4714 | .type = HDA_FIXUP_FUNC, | 4718 | .type = HDA_FIXUP_FUNC, |
@@ -4744,8 +4748,6 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4744 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { | 4748 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { |
4745 | .type = HDA_FIXUP_FUNC, | 4749 | .type = HDA_FIXUP_FUNC, |
4746 | .v.func = alc_fixup_dell_wmi, | 4750 | .v.func = alc_fixup_dell_wmi, |
4747 | .chained_before = true, | ||
4748 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | ||
4749 | }, | 4751 | }, |
4750 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { | 4752 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { |
4751 | .type = HDA_FIXUP_PINS, | 4753 | .type = HDA_FIXUP_PINS, |
@@ -4783,10 +4785,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4783 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4785 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4784 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4786 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4785 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4787 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4786 | SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4787 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4788 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4788 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4789 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4789 | SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4790 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), | 4790 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), |
4791 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4791 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4792 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4792 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
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 2e4a9dbc51fa..6e354d326858 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -2033,10 +2033,11 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, | |||
2033 | cval->res = 1; | 2033 | cval->res = 1; |
2034 | cval->initialized = 1; | 2034 | cval->initialized = 1; |
2035 | 2035 | ||
2036 | if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) | 2036 | if (state->mixer->protocol == UAC_VERSION_1) |
2037 | cval->control = UAC2_CX_CLOCK_SELECTOR; | ||
2038 | else | ||
2039 | cval->control = 0; | 2037 | cval->control = 0; |
2038 | else /* UAC_VERSION_2 */ | ||
2039 | cval->control = (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) ? | ||
2040 | UAC2_CX_CLOCK_SELECTOR : UAC2_SU_SELECTOR; | ||
2040 | 2041 | ||
2041 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); | 2042 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); |
2042 | if (!namelist) { | 2043 | if (!namelist) { |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index d2aa45a8d895..a5941f80fc5b 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1146,6 +1146,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | |||
1146 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && | 1146 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && |
1147 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | 1147 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
1148 | mdelay(20); | 1148 | mdelay(20); |
1149 | |||
1150 | /* Marantz/Denon devices with USB DAC functionality need a delay | ||
1151 | * after each class compliant request | ||
1152 | */ | ||
1153 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && | ||
1154 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { | ||
1155 | |||
1156 | switch (le16_to_cpu(dev->descriptor.idProduct)) { | ||
1157 | case 0x3005: /* Marantz HD-DAC1 */ | ||
1158 | case 0x3006: /* Marantz SA-14S1 */ | ||
1159 | mdelay(20); | ||
1160 | break; | ||
1161 | } | ||
1162 | } | ||
1149 | } | 1163 | } |
1150 | 1164 | ||
1151 | /* | 1165 | /* |