diff options
743 files changed, 8864 insertions, 5763 deletions
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt index e6b72d355151..68c0f517c60e 100644 --- a/Documentation/device-mapper/cache.txt +++ b/Documentation/device-mapper/cache.txt | |||
@@ -124,12 +124,11 @@ the default being 204800 sectors (or 100MB). | |||
124 | Updating on-disk metadata | 124 | Updating on-disk metadata |
125 | ------------------------- | 125 | ------------------------- |
126 | 126 | ||
127 | On-disk metadata is committed every time a REQ_SYNC or REQ_FUA bio is | 127 | On-disk metadata is committed every time a FLUSH or FUA bio is written. |
128 | written. If no such requests are made then commits will occur every | 128 | If no such requests are made then commits will occur every second. This |
129 | second. This means the cache behaves like a physical disk that has a | 129 | means the cache behaves like a physical disk that has a volatile write |
130 | write cache (the same is true of the thin-provisioning target). If | 130 | cache. If power is lost you may lose some recent writes. The metadata |
131 | power is lost you may lose some recent writes. The metadata should | 131 | should always be consistent in spite of any crash. |
132 | always be consistent in spite of any crash. | ||
133 | 132 | ||
134 | The 'dirty' state for a cache block changes far too frequently for us | 133 | The 'dirty' state for a cache block changes far too frequently for us |
135 | to keep updating it on the fly. So we treat it as a hint. In normal | 134 | to keep updating it on the fly. So we treat it as a hint. In normal |
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt index 8a7a3d46e0da..05a27e9442bd 100644 --- a/Documentation/device-mapper/thin-provisioning.txt +++ b/Documentation/device-mapper/thin-provisioning.txt | |||
@@ -116,6 +116,35 @@ Resuming a device with a new table itself triggers an event so the | |||
116 | userspace daemon can use this to detect a situation where a new table | 116 | userspace daemon can use this to detect a situation where a new table |
117 | already exceeds the threshold. | 117 | already exceeds the threshold. |
118 | 118 | ||
119 | A low water mark for the metadata device is maintained in the kernel and | ||
120 | will trigger a dm event if free space on the metadata device drops below | ||
121 | it. | ||
122 | |||
123 | Updating on-disk metadata | ||
124 | ------------------------- | ||
125 | |||
126 | On-disk metadata is committed every time a FLUSH or FUA bio is written. | ||
127 | If no such requests are made then commits will occur every second. This | ||
128 | means the thin-provisioning target behaves like a physical disk that has | ||
129 | a volatile write cache. If power is lost you may lose some recent | ||
130 | writes. The metadata should always be consistent in spite of any crash. | ||
131 | |||
132 | If data space is exhausted the pool will either error or queue IO | ||
133 | according to the configuration (see: error_if_no_space). If metadata | ||
134 | space is exhausted or a metadata operation fails: the pool will error IO | ||
135 | until the pool is taken offline and repair is performed to 1) fix any | ||
136 | potential inconsistencies and 2) clear the flag that imposes repair. | ||
137 | Once the pool's metadata device is repaired it may be resized, which | ||
138 | will allow the pool to return to normal operation. Note that if a pool | ||
139 | is flagged as needing repair, the pool's data and metadata devices | ||
140 | cannot be resized until repair is performed. It should also be noted | ||
141 | that when the pool's metadata space is exhausted the current metadata | ||
142 | transaction is aborted. Given that the pool will cache IO whose | ||
143 | completion may have already been acknowledged to upper IO layers | ||
144 | (e.g. filesystem) it is strongly suggested that consistency checks | ||
145 | (e.g. fsck) be performed on those layers when repair of the pool is | ||
146 | required. | ||
147 | |||
119 | Thin provisioning | 148 | Thin provisioning |
120 | ----------------- | 149 | ----------------- |
121 | 150 | ||
@@ -258,10 +287,9 @@ ii) Status | |||
258 | should register for the event and then check the target's status. | 287 | should register for the event and then check the target's status. |
259 | 288 | ||
260 | held metadata root: | 289 | held metadata root: |
261 | The location, in sectors, of the metadata root that has been | 290 | The location, in blocks, of the metadata root that has been |
262 | 'held' for userspace read access. '-' indicates there is no | 291 | 'held' for userspace read access. '-' indicates there is no |
263 | held root. This feature is not yet implemented so '-' is | 292 | held root. |
264 | always returned. | ||
265 | 293 | ||
266 | discard_passdown|no_discard_passdown | 294 | discard_passdown|no_discard_passdown |
267 | Whether or not discards are actually being passed down to the | 295 | Whether or not discards are actually being passed down to the |
diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt index a6a352c2771e..5992dceec7af 100644 --- a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt +++ b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt | |||
@@ -21,9 +21,9 @@ Required Properties: | |||
21 | must appear in the same order as the output clocks. | 21 | must appear in the same order as the output clocks. |
22 | - #clock-cells: Must be 1 | 22 | - #clock-cells: Must be 1 |
23 | - clock-output-names: The name of the clocks as free-form strings | 23 | - clock-output-names: The name of the clocks as free-form strings |
24 | - renesas,indices: Indices of the gate clocks into the group (0 to 31) | 24 | - renesas,clock-indices: Indices of the gate clocks into the group (0 to 31) |
25 | 25 | ||
26 | The clocks, clock-output-names and renesas,indices properties contain one | 26 | The clocks, clock-output-names and renesas,clock-indices properties contain one |
27 | entry per gate clock. The MSTP groups are sparsely populated. Unimplemented | 27 | entry per gate clock. The MSTP groups are sparsely populated. Unimplemented |
28 | gate clocks must not be declared. | 28 | gate clocks must not be declared. |
29 | 29 | ||
diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt index 68b83ecc3850..ee9be9961524 100644 --- a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt | |||
@@ -1,12 +1,16 @@ | |||
1 | * Freescale Smart Direct Memory Access (SDMA) Controller for i.MX | 1 | * Freescale Smart Direct Memory Access (SDMA) Controller for i.MX |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : Should be "fsl,imx31-sdma", "fsl,imx31-to1-sdma", | 4 | - compatible : Should be one of |
5 | "fsl,imx31-to2-sdma", "fsl,imx35-sdma", "fsl,imx35-to1-sdma", | 5 | "fsl,imx25-sdma" |
6 | "fsl,imx35-to2-sdma", "fsl,imx51-sdma", "fsl,imx53-sdma" or | 6 | "fsl,imx31-sdma", "fsl,imx31-to1-sdma", "fsl,imx31-to2-sdma" |
7 | "fsl,imx6q-sdma". The -to variants should be preferred since they | 7 | "fsl,imx35-sdma", "fsl,imx35-to1-sdma", "fsl,imx35-to2-sdma" |
8 | allow to determnine the correct ROM script addresses needed for | 8 | "fsl,imx51-sdma" |
9 | the driver to work without additional firmware. | 9 | "fsl,imx53-sdma" |
10 | "fsl,imx6q-sdma" | ||
11 | The -to variants should be preferred since they allow to determnine the | ||
12 | correct ROM script addresses needed for the driver to work without additional | ||
13 | firmware. | ||
10 | - reg : Should contain SDMA registers location and length | 14 | - reg : Should contain SDMA registers location and length |
11 | - interrupts : Should contain SDMA interrupt | 15 | - interrupts : Should contain SDMA interrupt |
12 | - #dma-cells : Must be <3>. | 16 | - #dma-cells : Must be <3>. |
diff --git a/Documentation/devicetree/bindings/net/micrel-ks8851.txt b/Documentation/devicetree/bindings/net/micrel-ks8851.txt index 11ace3c3d805..4fc392763611 100644 --- a/Documentation/devicetree/bindings/net/micrel-ks8851.txt +++ b/Documentation/devicetree/bindings/net/micrel-ks8851.txt | |||
@@ -7,3 +7,4 @@ Required properties: | |||
7 | 7 | ||
8 | Optional properties: | 8 | Optional properties: |
9 | - local-mac-address : Ethernet mac address to use | 9 | - local-mac-address : Ethernet mac address to use |
10 | - vdd-supply: supply for Ethernet mac | ||
diff --git a/Documentation/devicetree/bindings/net/opencores-ethoc.txt b/Documentation/devicetree/bindings/net/opencores-ethoc.txt new file mode 100644 index 000000000000..2dc127c30d9b --- /dev/null +++ b/Documentation/devicetree/bindings/net/opencores-ethoc.txt | |||
@@ -0,0 +1,22 @@ | |||
1 | * OpenCores MAC 10/100 Mbps | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "opencores,ethoc". | ||
5 | - reg: two memory regions (address and length), | ||
6 | first region is for the device registers and descriptor rings, | ||
7 | second is for the device packet memory. | ||
8 | - interrupts: interrupt for the device. | ||
9 | |||
10 | Optional properties: | ||
11 | - clocks: phandle to refer to the clk used as per | ||
12 | Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
13 | |||
14 | Examples: | ||
15 | |||
16 | enet0: ethoc@fd030000 { | ||
17 | compatible = "opencores,ethoc"; | ||
18 | reg = <0xfd030000 0x4000 0xfd800000 0x4000>; | ||
19 | interrupts = <1>; | ||
20 | local-mac-address = [00 50 c2 13 6f 00]; | ||
21 | clocks = <&osc>; | ||
22 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt index 9e9e9ef9f852..c119debe6bab 100644 --- a/Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | Broadcom Capri Pin Controller | 1 | Broadcom BCM281xx Pin Controller |
2 | 2 | ||
3 | This is a pin controller for the Broadcom BCM281xx SoC family, which includes | 3 | This is a pin controller for the Broadcom BCM281xx SoC family, which includes |
4 | BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs. | 4 | BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs. |
@@ -7,14 +7,14 @@ BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs. | |||
7 | 7 | ||
8 | Required Properties: | 8 | Required Properties: |
9 | 9 | ||
10 | - compatible: Must be "brcm,capri-pinctrl". | 10 | - compatible: Must be "brcm,bcm11351-pinctrl" |
11 | - reg: Base address of the PAD Controller register block and the size | 11 | - reg: Base address of the PAD Controller register block and the size |
12 | of the block. | 12 | of the block. |
13 | 13 | ||
14 | For example, the following is the bare minimum node: | 14 | For example, the following is the bare minimum node: |
15 | 15 | ||
16 | pinctrl@35004800 { | 16 | pinctrl@35004800 { |
17 | compatible = "brcm,capri-pinctrl"; | 17 | compatible = "brcm,bcm11351-pinctrl"; |
18 | reg = <0x35004800 0x430>; | 18 | reg = <0x35004800 0x430>; |
19 | }; | 19 | }; |
20 | 20 | ||
@@ -119,7 +119,7 @@ Optional Properties (for HDMI pins): | |||
119 | Example: | 119 | Example: |
120 | // pin controller node | 120 | // pin controller node |
121 | pinctrl@35004800 { | 121 | pinctrl@35004800 { |
122 | compatible = "brcm,capri-pinctrl"; | 122 | compatible = "brcmbcm11351-pinctrl"; |
123 | reg = <0x35004800 0x430>; | 123 | reg = <0x35004800 0x430>; |
124 | 124 | ||
125 | // pin configuration node | 125 | // pin configuration node |
diff --git a/Documentation/devicetree/bindings/spi/efm32-spi.txt b/Documentation/devicetree/bindings/spi/efm32-spi.txt index a590ca51be75..8f081c96a4fa 100644 --- a/Documentation/devicetree/bindings/spi/efm32-spi.txt +++ b/Documentation/devicetree/bindings/spi/efm32-spi.txt | |||
@@ -3,24 +3,24 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - #address-cells: see spi-bus.txt | 4 | - #address-cells: see spi-bus.txt |
5 | - #size-cells: see spi-bus.txt | 5 | - #size-cells: see spi-bus.txt |
6 | - compatible: should be "efm32,spi" | 6 | - compatible: should be "energymicro,efm32-spi" |
7 | - reg: Offset and length of the register set for the controller | 7 | - reg: Offset and length of the register set for the controller |
8 | - interrupts: pair specifying rx and tx irq | 8 | - interrupts: pair specifying rx and tx irq |
9 | - clocks: phandle to the spi clock | 9 | - clocks: phandle to the spi clock |
10 | - cs-gpios: see spi-bus.txt | 10 | - cs-gpios: see spi-bus.txt |
11 | - location: Value to write to the ROUTE register's LOCATION bitfield to configure the pinmux for the device, see datasheet for values. | 11 | - efm32,location: Value to write to the ROUTE register's LOCATION bitfield to configure the pinmux for the device, see datasheet for values. |
12 | 12 | ||
13 | Example: | 13 | Example: |
14 | 14 | ||
15 | spi1: spi@0x4000c400 { /* USART1 */ | 15 | spi1: spi@0x4000c400 { /* USART1 */ |
16 | #address-cells = <1>; | 16 | #address-cells = <1>; |
17 | #size-cells = <0>; | 17 | #size-cells = <0>; |
18 | compatible = "efm32,spi"; | 18 | compatible = "energymicro,efm32-spi"; |
19 | reg = <0x4000c400 0x400>; | 19 | reg = <0x4000c400 0x400>; |
20 | interrupts = <15 16>; | 20 | interrupts = <15 16>; |
21 | clocks = <&cmu 20>; | 21 | clocks = <&cmu 20>; |
22 | cs-gpios = <&gpio 51 1>; // D3 | 22 | cs-gpios = <&gpio 51 1>; // D3 |
23 | location = <1>; | 23 | efm32,location = <1>; |
24 | status = "ok"; | 24 | status = "ok"; |
25 | 25 | ||
26 | ks8851@0 { | 26 | ks8851@0 { |
diff --git a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt new file mode 100644 index 000000000000..b82a268f1bd4 --- /dev/null +++ b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt | |||
@@ -0,0 +1,85 @@ | |||
1 | Qualcomm Universal Peripheral (QUP) Serial Peripheral Interface (SPI) | ||
2 | |||
3 | The QUP core is an AHB slave that provides a common data path (an output FIFO | ||
4 | and an input FIFO) for serial peripheral interface (SPI) mini-core. | ||
5 | |||
6 | SPI in master mode supports up to 50MHz, up to four chip selects, programmable | ||
7 | data path from 4 bits to 32 bits and numerous protocol variants. | ||
8 | |||
9 | Required properties: | ||
10 | - compatible: Should contain "qcom,spi-qup-v2.1.1" or "qcom,spi-qup-v2.2.1" | ||
11 | - reg: Should contain base register location and length | ||
12 | - interrupts: Interrupt number used by this controller | ||
13 | |||
14 | - clocks: Should contain the core clock and the AHB clock. | ||
15 | - clock-names: Should be "core" for the core clock and "iface" for the | ||
16 | AHB clock. | ||
17 | |||
18 | - #address-cells: Number of cells required to define a chip select | ||
19 | address on the SPI bus. Should be set to 1. | ||
20 | - #size-cells: Should be zero. | ||
21 | |||
22 | Optional properties: | ||
23 | - spi-max-frequency: Specifies maximum SPI clock frequency, | ||
24 | Units - Hz. Definition as per | ||
25 | Documentation/devicetree/bindings/spi/spi-bus.txt | ||
26 | |||
27 | SPI slave nodes must be children of the SPI master node and can contain | ||
28 | properties described in Documentation/devicetree/bindings/spi/spi-bus.txt | ||
29 | |||
30 | Example: | ||
31 | |||
32 | spi_8: spi@f9964000 { /* BLSP2 QUP2 */ | ||
33 | |||
34 | compatible = "qcom,spi-qup-v2"; | ||
35 | #address-cells = <1>; | ||
36 | #size-cells = <0>; | ||
37 | reg = <0xf9964000 0x1000>; | ||
38 | interrupts = <0 102 0>; | ||
39 | spi-max-frequency = <19200000>; | ||
40 | |||
41 | clocks = <&gcc GCC_BLSP2_QUP2_SPI_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; | ||
42 | clock-names = "core", "iface"; | ||
43 | |||
44 | pinctrl-names = "default"; | ||
45 | pinctrl-0 = <&spi8_default>; | ||
46 | |||
47 | device@0 { | ||
48 | compatible = "arm,pl022-dummy"; | ||
49 | #address-cells = <1>; | ||
50 | #size-cells = <1>; | ||
51 | reg = <0>; /* Chip select 0 */ | ||
52 | spi-max-frequency = <19200000>; | ||
53 | spi-cpol; | ||
54 | }; | ||
55 | |||
56 | device@1 { | ||
57 | compatible = "arm,pl022-dummy"; | ||
58 | #address-cells = <1>; | ||
59 | #size-cells = <1>; | ||
60 | reg = <1>; /* Chip select 1 */ | ||
61 | spi-max-frequency = <9600000>; | ||
62 | spi-cpha; | ||
63 | }; | ||
64 | |||
65 | device@2 { | ||
66 | compatible = "arm,pl022-dummy"; | ||
67 | #address-cells = <1>; | ||
68 | #size-cells = <1>; | ||
69 | reg = <2>; /* Chip select 2 */ | ||
70 | spi-max-frequency = <19200000>; | ||
71 | spi-cpol; | ||
72 | spi-cpha; | ||
73 | }; | ||
74 | |||
75 | device@3 { | ||
76 | compatible = "arm,pl022-dummy"; | ||
77 | #address-cells = <1>; | ||
78 | #size-cells = <1>; | ||
79 | reg = <3>; /* Chip select 3 */ | ||
80 | spi-max-frequency = <19200000>; | ||
81 | spi-cpol; | ||
82 | spi-cpha; | ||
83 | spi-cs-high; | ||
84 | }; | ||
85 | }; | ||
diff --git a/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt b/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt index a1fb3035a42b..5376de40f10b 100644 --- a/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt +++ b/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt | |||
@@ -10,6 +10,7 @@ Required properties: | |||
10 | - pinctrl-names: must contain a "default" entry. | 10 | - pinctrl-names: must contain a "default" entry. |
11 | - spi-num-chipselects : the number of the chipselect signals. | 11 | - spi-num-chipselects : the number of the chipselect signals. |
12 | - bus-num : the slave chip chipselect signal number. | 12 | - bus-num : the slave chip chipselect signal number. |
13 | - big-endian : if DSPI modudle is big endian, the bool will be set in node. | ||
13 | Example: | 14 | Example: |
14 | 15 | ||
15 | dspi0@4002c000 { | 16 | dspi0@4002c000 { |
@@ -24,6 +25,7 @@ dspi0@4002c000 { | |||
24 | bus-num = <0>; | 25 | bus-num = <0>; |
25 | pinctrl-names = "default"; | 26 | pinctrl-names = "default"; |
26 | pinctrl-0 = <&pinctrl_dspi0_1>; | 27 | pinctrl-0 = <&pinctrl_dspi0_1>; |
28 | big-endian; | ||
27 | status = "okay"; | 29 | status = "okay"; |
28 | 30 | ||
29 | sflash: at26df081a@0 { | 31 | sflash: at26df081a@0 { |
diff --git a/Documentation/devicetree/bindings/spi/spi-rspi.txt b/Documentation/devicetree/bindings/spi/spi-rspi.txt new file mode 100644 index 000000000000..d57d82a74054 --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi-rspi.txt | |||
@@ -0,0 +1,61 @@ | |||
1 | Device tree configuration for Renesas RSPI/QSPI driver | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : For Renesas Serial Peripheral Interface on legacy SH: | ||
5 | "renesas,rspi-<soctype>", "renesas,rspi" as fallback. | ||
6 | For Renesas Serial Peripheral Interface on RZ/A1H: | ||
7 | "renesas,rspi-<soctype>", "renesas,rspi-rz" as fallback. | ||
8 | For Quad Serial Peripheral Interface on R-Car Gen2: | ||
9 | "renesas,qspi-<soctype>", "renesas,qspi" as fallback. | ||
10 | Examples with soctypes are: | ||
11 | - "renesas,rspi-sh7757" (SH) | ||
12 | - "renesas,rspi-r7s72100" (RZ/A1H) | ||
13 | - "renesas,qspi-r8a7790" (R-Car H2) | ||
14 | - "renesas,qspi-r8a7791" (R-Car M2) | ||
15 | - reg : Address start and address range size of the device | ||
16 | - interrupts : A list of interrupt-specifiers, one for each entry in | ||
17 | interrupt-names. | ||
18 | If interrupt-names is not present, an interrupt specifier | ||
19 | for a single muxed interrupt. | ||
20 | - interrupt-names : A list of interrupt names. Should contain (if present): | ||
21 | - "error" for SPEI, | ||
22 | - "rx" for SPRI, | ||
23 | - "tx" to SPTI, | ||
24 | - "mux" for a single muxed interrupt. | ||
25 | - interrupt-parent : The phandle for the interrupt controller that | ||
26 | services interrupts for this device. | ||
27 | - num-cs : Number of chip selects. Some RSPI cores have more than 1. | ||
28 | - #address-cells : Must be <1> | ||
29 | - #size-cells : Must be <0> | ||
30 | |||
31 | Optional properties: | ||
32 | - clocks : Must contain a reference to the functional clock. | ||
33 | |||
34 | Pinctrl properties might be needed, too. See | ||
35 | Documentation/devicetree/bindings/pinctrl/renesas,*. | ||
36 | |||
37 | Examples: | ||
38 | |||
39 | spi0: spi@e800c800 { | ||
40 | compatible = "renesas,rspi-r7s72100", "renesas,rspi-rz"; | ||
41 | reg = <0xe800c800 0x24>; | ||
42 | interrupts = <0 238 IRQ_TYPE_LEVEL_HIGH>, | ||
43 | <0 239 IRQ_TYPE_LEVEL_HIGH>, | ||
44 | <0 240 IRQ_TYPE_LEVEL_HIGH>; | ||
45 | interrupt-names = "error", "rx", "tx"; | ||
46 | interrupt-parent = <&gic>; | ||
47 | num-cs = <1>; | ||
48 | #address-cells = <1>; | ||
49 | #size-cells = <0>; | ||
50 | }; | ||
51 | |||
52 | spi: spi@e6b10000 { | ||
53 | compatible = "renesas,qspi-r8a7791", "renesas,qspi"; | ||
54 | reg = <0 0xe6b10000 0 0x2c>; | ||
55 | interrupt-parent = <&gic>; | ||
56 | interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>; | ||
57 | clocks = <&mstp9_clks R8A7791_CLK_QSPI_MOD>; | ||
58 | num-cs = <1>; | ||
59 | #address-cells = <1>; | ||
60 | #size-cells = <0>; | ||
61 | }; | ||
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt index f3089d423515..0cbe6ec22d6f 100644 --- a/Documentation/networking/can.txt +++ b/Documentation/networking/can.txt | |||
@@ -554,12 +554,6 @@ solution for a couple of reasons: | |||
554 | not specified in the struct can_frame and therefore it is only valid in | 554 | not specified in the struct can_frame and therefore it is only valid in |
555 | CANFD_MTU sized CAN FD frames. | 555 | CANFD_MTU sized CAN FD frames. |
556 | 556 | ||
557 | As long as the payload length is <=8 the received CAN frames from CAN FD | ||
558 | capable CAN devices can be received and read by legacy sockets too. When | ||
559 | user-generated CAN FD frames have a payload length <=8 these can be send | ||
560 | by legacy CAN network interfaces too. Sending CAN FD frames with payload | ||
561 | length > 8 to a legacy CAN network interface returns an -EMSGSIZE error. | ||
562 | |||
563 | Implementation hint for new CAN applications: | 557 | Implementation hint for new CAN applications: |
564 | 558 | ||
565 | To build a CAN FD aware application use struct canfd_frame as basic CAN | 559 | To build a CAN FD aware application use struct canfd_frame as basic CAN |
diff --git a/Documentation/networking/netlink_mmap.txt b/Documentation/networking/netlink_mmap.txt index b26122973525..c6af4bac5aa8 100644 --- a/Documentation/networking/netlink_mmap.txt +++ b/Documentation/networking/netlink_mmap.txt | |||
@@ -226,9 +226,9 @@ Ring setup: | |||
226 | void *rx_ring, *tx_ring; | 226 | void *rx_ring, *tx_ring; |
227 | 227 | ||
228 | /* Configure ring parameters */ | 228 | /* Configure ring parameters */ |
229 | if (setsockopt(fd, NETLINK_RX_RING, &req, sizeof(req)) < 0) | 229 | if (setsockopt(fd, SOL_NETLINK, NETLINK_RX_RING, &req, sizeof(req)) < 0) |
230 | exit(1); | 230 | exit(1); |
231 | if (setsockopt(fd, NETLINK_TX_RING, &req, sizeof(req)) < 0) | 231 | if (setsockopt(fd, SOL_NETLINK, NETLINK_TX_RING, &req, sizeof(req)) < 0) |
232 | exit(1) | 232 | exit(1) |
233 | 233 | ||
234 | /* Calculate size of each individual ring */ | 234 | /* Calculate size of each individual ring */ |
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt index 1404674c0a02..6fea79efb4cb 100644 --- a/Documentation/networking/packet_mmap.txt +++ b/Documentation/networking/packet_mmap.txt | |||
@@ -453,7 +453,7 @@ TP_STATUS_COPY : This flag indicates that the frame (and associated | |||
453 | enabled previously with setsockopt() and | 453 | enabled previously with setsockopt() and |
454 | the PACKET_COPY_THRESH option. | 454 | the PACKET_COPY_THRESH option. |
455 | 455 | ||
456 | The number of frames than can be buffered to | 456 | The number of frames that can be buffered to |
457 | be read with recvfrom is limited like a normal socket. | 457 | be read with recvfrom is limited like a normal socket. |
458 | See the SO_RCVBUF option in the socket (7) man page. | 458 | See the SO_RCVBUF option in the socket (7) man page. |
459 | 459 | ||
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt index 661d3c316a17..048c92b487f6 100644 --- a/Documentation/networking/timestamping.txt +++ b/Documentation/networking/timestamping.txt | |||
@@ -21,26 +21,38 @@ has such a feature). | |||
21 | 21 | ||
22 | SO_TIMESTAMPING: | 22 | SO_TIMESTAMPING: |
23 | 23 | ||
24 | Instructs the socket layer which kind of information is wanted. The | 24 | Instructs the socket layer which kind of information should be collected |
25 | parameter is an integer with some of the following bits set. Setting | 25 | and/or reported. The parameter is an integer with some of the following |
26 | other bits is an error and doesn't change the current state. | 26 | bits set. Setting other bits is an error and doesn't change the current |
27 | 27 | state. | |
28 | SOF_TIMESTAMPING_TX_HARDWARE: try to obtain send time stamp in hardware | 28 | |
29 | SOF_TIMESTAMPING_TX_SOFTWARE: if SOF_TIMESTAMPING_TX_HARDWARE is off or | 29 | Four of the bits are requests to the stack to try to generate |
30 | fails, then do it in software | 30 | timestamps. Any combination of them is valid. |
31 | SOF_TIMESTAMPING_RX_HARDWARE: return the original, unmodified time stamp | 31 | |
32 | as generated by the hardware | 32 | SOF_TIMESTAMPING_TX_HARDWARE: try to obtain send time stamps in hardware |
33 | SOF_TIMESTAMPING_RX_SOFTWARE: if SOF_TIMESTAMPING_RX_HARDWARE is off or | 33 | SOF_TIMESTAMPING_TX_SOFTWARE: try to obtain send time stamps in software |
34 | fails, then do it in software | 34 | SOF_TIMESTAMPING_RX_HARDWARE: try to obtain receive time stamps in hardware |
35 | SOF_TIMESTAMPING_RAW_HARDWARE: return original raw hardware time stamp | 35 | SOF_TIMESTAMPING_RX_SOFTWARE: try to obtain receive time stamps in software |
36 | SOF_TIMESTAMPING_SYS_HARDWARE: return hardware time stamp transformed to | 36 | |
37 | the system time base | 37 | The other three bits control which timestamps will be reported in a |
38 | SOF_TIMESTAMPING_SOFTWARE: return system time stamp generated in | 38 | generated control message. If none of these bits are set or if none of |
39 | software | 39 | the set bits correspond to data that is available, then the control |
40 | 40 | message will not be generated: | |
41 | SOF_TIMESTAMPING_TX/RX determine how time stamps are generated. | 41 | |
42 | SOF_TIMESTAMPING_RAW/SYS determine how they are reported in the | 42 | SOF_TIMESTAMPING_SOFTWARE: report systime if available |
43 | following control message: | 43 | SOF_TIMESTAMPING_SYS_HARDWARE: report hwtimetrans if available |
44 | SOF_TIMESTAMPING_RAW_HARDWARE: report hwtimeraw if available | ||
45 | |||
46 | It is worth noting that timestamps may be collected for reasons other | ||
47 | than being requested by a particular socket with | ||
48 | SOF_TIMESTAMPING_[TR]X_(HARD|SOFT)WARE. For example, most drivers that | ||
49 | can generate hardware receive timestamps ignore | ||
50 | SOF_TIMESTAMPING_RX_HARDWARE. It is still a good idea to set that flag | ||
51 | in case future drivers pay attention. | ||
52 | |||
53 | If timestamps are reported, they will appear in a control message with | ||
54 | cmsg_level==SOL_SOCKET, cmsg_type==SO_TIMESTAMPING, and a payload like | ||
55 | this: | ||
44 | 56 | ||
45 | struct scm_timestamping { | 57 | struct scm_timestamping { |
46 | struct timespec systime; | 58 | struct timespec systime; |
diff --git a/MAINTAINERS b/MAINTAINERS index 85b3dd8008b7..82640e640f36 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -73,7 +73,8 @@ Descriptions of section entries: | |||
73 | L: Mailing list that is relevant to this area | 73 | L: Mailing list that is relevant to this area |
74 | W: Web-page with status/info | 74 | W: Web-page with status/info |
75 | Q: Patchwork web based patch tracking system site | 75 | Q: Patchwork web based patch tracking system site |
76 | T: SCM tree type and location. Type is one of: git, hg, quilt, stgit, topgit. | 76 | T: SCM tree type and location. |
77 | Type is one of: git, hg, quilt, stgit, topgit | ||
77 | S: Status, one of the following: | 78 | S: Status, one of the following: |
78 | Supported: Someone is actually paid to look after this. | 79 | Supported: Someone is actually paid to look after this. |
79 | Maintained: Someone actually looks after it. | 80 | Maintained: Someone actually looks after it. |
@@ -473,7 +474,7 @@ F: net/rxrpc/af_rxrpc.c | |||
473 | 474 | ||
474 | AGPGART DRIVER | 475 | AGPGART DRIVER |
475 | M: David Airlie <airlied@linux.ie> | 476 | M: David Airlie <airlied@linux.ie> |
476 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git | 477 | T: git git://people.freedesktop.org/~airlied/linux (part of drm maint) |
477 | S: Maintained | 478 | S: Maintained |
478 | F: drivers/char/agp/ | 479 | F: drivers/char/agp/ |
479 | F: include/linux/agp* | 480 | F: include/linux/agp* |
@@ -538,7 +539,7 @@ F: arch/alpha/ | |||
538 | ALTERA UART/JTAG UART SERIAL DRIVERS | 539 | ALTERA UART/JTAG UART SERIAL DRIVERS |
539 | M: Tobias Klauser <tklauser@distanz.ch> | 540 | M: Tobias Klauser <tklauser@distanz.ch> |
540 | L: linux-serial@vger.kernel.org | 541 | L: linux-serial@vger.kernel.org |
541 | L: nios2-dev@sopc.et.ntust.edu.tw (moderated for non-subscribers) | 542 | L: nios2-dev@lists.rocketboards.org (moderated for non-subscribers) |
542 | S: Maintained | 543 | S: Maintained |
543 | F: drivers/tty/serial/altera_uart.c | 544 | F: drivers/tty/serial/altera_uart.c |
544 | F: drivers/tty/serial/altera_jtaguart.c | 545 | F: drivers/tty/serial/altera_jtaguart.c |
@@ -910,11 +911,11 @@ F: arch/arm/include/asm/hardware/dec21285.h | |||
910 | F: arch/arm/mach-footbridge/ | 911 | F: arch/arm/mach-footbridge/ |
911 | 912 | ||
912 | ARM/FREESCALE IMX / MXC ARM ARCHITECTURE | 913 | ARM/FREESCALE IMX / MXC ARM ARCHITECTURE |
913 | M: Shawn Guo <shawn.guo@linaro.org> | 914 | M: Shawn Guo <shawn.guo@freescale.com> |
914 | M: Sascha Hauer <kernel@pengutronix.de> | 915 | M: Sascha Hauer <kernel@pengutronix.de> |
915 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 916 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
916 | S: Maintained | 917 | S: Maintained |
917 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git | 918 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git |
918 | F: arch/arm/mach-imx/ | 919 | F: arch/arm/mach-imx/ |
919 | F: arch/arm/boot/dts/imx* | 920 | F: arch/arm/boot/dts/imx* |
920 | F: arch/arm/configs/imx*_defconfig | 921 | F: arch/arm/configs/imx*_defconfig |
@@ -1612,11 +1613,11 @@ S: Maintained | |||
1612 | F: drivers/net/wireless/atmel* | 1613 | F: drivers/net/wireless/atmel* |
1613 | 1614 | ||
1614 | ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER | 1615 | ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER |
1615 | M: Bradley Grove <linuxdrivers@attotech.com> | 1616 | M: Bradley Grove <linuxdrivers@attotech.com> |
1616 | L: linux-scsi@vger.kernel.org | 1617 | L: linux-scsi@vger.kernel.org |
1617 | W: http://www.attotech.com | 1618 | W: http://www.attotech.com |
1618 | S: Supported | 1619 | S: Supported |
1619 | F: drivers/scsi/esas2r | 1620 | F: drivers/scsi/esas2r |
1620 | 1621 | ||
1621 | AUDIT SUBSYSTEM | 1622 | AUDIT SUBSYSTEM |
1622 | M: Eric Paris <eparis@redhat.com> | 1623 | M: Eric Paris <eparis@redhat.com> |
@@ -1737,6 +1738,7 @@ F: include/uapi/linux/bfs_fs.h | |||
1737 | BLACKFIN ARCHITECTURE | 1738 | BLACKFIN ARCHITECTURE |
1738 | M: Steven Miao <realmz6@gmail.com> | 1739 | M: Steven Miao <realmz6@gmail.com> |
1739 | L: adi-buildroot-devel@lists.sourceforge.net | 1740 | L: adi-buildroot-devel@lists.sourceforge.net |
1741 | T: git git://git.code.sf.net/p/adi-linux/code | ||
1740 | W: http://blackfin.uclinux.org | 1742 | W: http://blackfin.uclinux.org |
1741 | S: Supported | 1743 | S: Supported |
1742 | F: arch/blackfin/ | 1744 | F: arch/blackfin/ |
@@ -2159,7 +2161,7 @@ F: Documentation/zh_CN/ | |||
2159 | 2161 | ||
2160 | CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER | 2162 | CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER |
2161 | M: Peter Chen <Peter.Chen@freescale.com> | 2163 | M: Peter Chen <Peter.Chen@freescale.com> |
2162 | T: git://github.com/hzpeterchen/linux-usb.git | 2164 | T: git git://github.com/hzpeterchen/linux-usb.git |
2163 | L: linux-usb@vger.kernel.org | 2165 | L: linux-usb@vger.kernel.org |
2164 | S: Maintained | 2166 | S: Maintained |
2165 | F: drivers/usb/chipidea/ | 2167 | F: drivers/usb/chipidea/ |
@@ -2179,9 +2181,9 @@ S: Supported | |||
2179 | F: drivers/net/ethernet/cisco/enic/ | 2181 | F: drivers/net/ethernet/cisco/enic/ |
2180 | 2182 | ||
2181 | CISCO VIC LOW LATENCY NIC DRIVER | 2183 | CISCO VIC LOW LATENCY NIC DRIVER |
2182 | M: Upinder Malhi <umalhi@cisco.com> | 2184 | M: Upinder Malhi <umalhi@cisco.com> |
2183 | S: Supported | 2185 | S: Supported |
2184 | F: drivers/infiniband/hw/usnic | 2186 | F: drivers/infiniband/hw/usnic |
2185 | 2187 | ||
2186 | CIRRUS LOGIC EP93XX ETHERNET DRIVER | 2188 | CIRRUS LOGIC EP93XX ETHERNET DRIVER |
2187 | M: Hartley Sweeten <hsweeten@visionengravers.com> | 2189 | M: Hartley Sweeten <hsweeten@visionengravers.com> |
@@ -2378,20 +2380,20 @@ F: drivers/cpufreq/arm_big_little.c | |||
2378 | F: drivers/cpufreq/arm_big_little_dt.c | 2380 | F: drivers/cpufreq/arm_big_little_dt.c |
2379 | 2381 | ||
2380 | CPUIDLE DRIVER - ARM BIG LITTLE | 2382 | CPUIDLE DRIVER - ARM BIG LITTLE |
2381 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2383 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
2382 | M: Daniel Lezcano <daniel.lezcano@linaro.org> | 2384 | M: Daniel Lezcano <daniel.lezcano@linaro.org> |
2383 | L: linux-pm@vger.kernel.org | 2385 | L: linux-pm@vger.kernel.org |
2384 | L: linux-arm-kernel@lists.infradead.org | 2386 | L: linux-arm-kernel@lists.infradead.org |
2385 | T: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git | 2387 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git |
2386 | S: Maintained | 2388 | S: Maintained |
2387 | F: drivers/cpuidle/cpuidle-big_little.c | 2389 | F: drivers/cpuidle/cpuidle-big_little.c |
2388 | 2390 | ||
2389 | CPUIDLE DRIVERS | 2391 | CPUIDLE DRIVERS |
2390 | M: Rafael J. Wysocki <rjw@rjwysocki.net> | 2392 | M: Rafael J. Wysocki <rjw@rjwysocki.net> |
2391 | M: Daniel Lezcano <daniel.lezcano@linaro.org> | 2393 | M: Daniel Lezcano <daniel.lezcano@linaro.org> |
2392 | L: linux-pm@vger.kernel.org | 2394 | L: linux-pm@vger.kernel.org |
2393 | S: Maintained | 2395 | S: Maintained |
2394 | T: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git | 2396 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git |
2395 | F: drivers/cpuidle/* | 2397 | F: drivers/cpuidle/* |
2396 | F: include/linux/cpuidle.h | 2398 | F: include/linux/cpuidle.h |
2397 | 2399 | ||
@@ -2458,9 +2460,9 @@ S: Maintained | |||
2458 | F: sound/pci/cs5535audio/ | 2460 | F: sound/pci/cs5535audio/ |
2459 | 2461 | ||
2460 | CW1200 WLAN driver | 2462 | CW1200 WLAN driver |
2461 | M: Solomon Peachy <pizza@shaftnet.org> | 2463 | M: Solomon Peachy <pizza@shaftnet.org> |
2462 | S: Maintained | 2464 | S: Maintained |
2463 | F: drivers/net/wireless/cw1200/ | 2465 | F: drivers/net/wireless/cw1200/ |
2464 | 2466 | ||
2465 | CX18 VIDEO4LINUX DRIVER | 2467 | CX18 VIDEO4LINUX DRIVER |
2466 | M: Andy Walls <awalls@md.metrocast.net> | 2468 | M: Andy Walls <awalls@md.metrocast.net> |
@@ -2611,9 +2613,9 @@ DC395x SCSI driver | |||
2611 | M: Oliver Neukum <oliver@neukum.org> | 2613 | M: Oliver Neukum <oliver@neukum.org> |
2612 | M: Ali Akcaagac <aliakc@web.de> | 2614 | M: Ali Akcaagac <aliakc@web.de> |
2613 | M: Jamie Lenehan <lenehan@twibble.org> | 2615 | M: Jamie Lenehan <lenehan@twibble.org> |
2614 | W: http://twibble.org/dist/dc395x/ | ||
2615 | L: dc395x@twibble.org | 2616 | L: dc395x@twibble.org |
2616 | L: http://lists.twibble.org/mailman/listinfo/dc395x/ | 2617 | W: http://twibble.org/dist/dc395x/ |
2618 | W: http://lists.twibble.org/mailman/listinfo/dc395x/ | ||
2617 | S: Maintained | 2619 | S: Maintained |
2618 | F: Documentation/scsi/dc395x.txt | 2620 | F: Documentation/scsi/dc395x.txt |
2619 | F: drivers/scsi/dc395x.* | 2621 | F: drivers/scsi/dc395x.* |
@@ -2848,12 +2850,22 @@ F: lib/kobj* | |||
2848 | DRM DRIVERS | 2850 | DRM DRIVERS |
2849 | M: David Airlie <airlied@linux.ie> | 2851 | M: David Airlie <airlied@linux.ie> |
2850 | L: dri-devel@lists.freedesktop.org | 2852 | L: dri-devel@lists.freedesktop.org |
2851 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git | 2853 | T: git git://people.freedesktop.org/~airlied/linux |
2852 | S: Maintained | 2854 | S: Maintained |
2853 | F: drivers/gpu/drm/ | 2855 | F: drivers/gpu/drm/ |
2854 | F: include/drm/ | 2856 | F: include/drm/ |
2855 | F: include/uapi/drm/ | 2857 | F: include/uapi/drm/ |
2856 | 2858 | ||
2859 | RADEON DRM DRIVERS | ||
2860 | M: Alex Deucher <alexander.deucher@amd.com> | ||
2861 | M: Christian König <christian.koenig@amd.com> | ||
2862 | L: dri-devel@lists.freedesktop.org | ||
2863 | T: git git://people.freedesktop.org/~agd5f/linux | ||
2864 | S: Supported | ||
2865 | F: drivers/gpu/drm/radeon/ | ||
2866 | F: include/drm/radeon* | ||
2867 | F: include/uapi/drm/radeon* | ||
2868 | |||
2857 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) | 2869 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) |
2858 | M: Daniel Vetter <daniel.vetter@ffwll.ch> | 2870 | M: Daniel Vetter <daniel.vetter@ffwll.ch> |
2859 | M: Jani Nikula <jani.nikula@linux.intel.com> | 2871 | M: Jani Nikula <jani.nikula@linux.intel.com> |
@@ -3085,6 +3097,8 @@ F: fs/ecryptfs/ | |||
3085 | 3097 | ||
3086 | EDAC-CORE | 3098 | EDAC-CORE |
3087 | M: Doug Thompson <dougthompson@xmission.com> | 3099 | M: Doug Thompson <dougthompson@xmission.com> |
3100 | M: Borislav Petkov <bp@alien8.de> | ||
3101 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | ||
3088 | L: linux-edac@vger.kernel.org | 3102 | L: linux-edac@vger.kernel.org |
3089 | W: bluesmoke.sourceforge.net | 3103 | W: bluesmoke.sourceforge.net |
3090 | S: Supported | 3104 | S: Supported |
@@ -4531,6 +4545,7 @@ M: Greg Rose <gregory.v.rose@intel.com> | |||
4531 | M: Alex Duyck <alexander.h.duyck@intel.com> | 4545 | M: Alex Duyck <alexander.h.duyck@intel.com> |
4532 | M: John Ronciak <john.ronciak@intel.com> | 4546 | M: John Ronciak <john.ronciak@intel.com> |
4533 | M: Mitch Williams <mitch.a.williams@intel.com> | 4547 | M: Mitch Williams <mitch.a.williams@intel.com> |
4548 | M: Linux NICS <linux.nics@intel.com> | ||
4534 | L: e1000-devel@lists.sourceforge.net | 4549 | L: e1000-devel@lists.sourceforge.net |
4535 | W: http://www.intel.com/support/feedback.htm | 4550 | W: http://www.intel.com/support/feedback.htm |
4536 | W: http://e1000.sourceforge.net/ | 4551 | W: http://e1000.sourceforge.net/ |
@@ -4548,6 +4563,7 @@ F: Documentation/networking/ixgbevf.txt | |||
4548 | F: Documentation/networking/i40e.txt | 4563 | F: Documentation/networking/i40e.txt |
4549 | F: Documentation/networking/i40evf.txt | 4564 | F: Documentation/networking/i40evf.txt |
4550 | F: drivers/net/ethernet/intel/ | 4565 | F: drivers/net/ethernet/intel/ |
4566 | F: drivers/net/ethernet/intel/*/ | ||
4551 | 4567 | ||
4552 | INTEL-MID GPIO DRIVER | 4568 | INTEL-MID GPIO DRIVER |
4553 | M: David Cohen <david.a.cohen@linux.intel.com> | 4569 | M: David Cohen <david.a.cohen@linux.intel.com> |
@@ -4904,7 +4920,7 @@ F: drivers/staging/ktap/ | |||
4904 | KCONFIG | 4920 | KCONFIG |
4905 | M: "Yann E. MORIN" <yann.morin.1998@free.fr> | 4921 | M: "Yann E. MORIN" <yann.morin.1998@free.fr> |
4906 | L: linux-kbuild@vger.kernel.org | 4922 | L: linux-kbuild@vger.kernel.org |
4907 | T: git://gitorious.org/linux-kconfig/linux-kconfig | 4923 | T: git git://gitorious.org/linux-kconfig/linux-kconfig |
4908 | S: Maintained | 4924 | S: Maintained |
4909 | F: Documentation/kbuild/kconfig-language.txt | 4925 | F: Documentation/kbuild/kconfig-language.txt |
4910 | F: scripts/kconfig/ | 4926 | F: scripts/kconfig/ |
@@ -5461,11 +5477,11 @@ S: Maintained | |||
5461 | F: drivers/media/tuners/m88ts2022* | 5477 | F: drivers/media/tuners/m88ts2022* |
5462 | 5478 | ||
5463 | MA901 MASTERKIT USB FM RADIO DRIVER | 5479 | MA901 MASTERKIT USB FM RADIO DRIVER |
5464 | M: Alexey Klimov <klimov.linux@gmail.com> | 5480 | M: Alexey Klimov <klimov.linux@gmail.com> |
5465 | L: linux-media@vger.kernel.org | 5481 | L: linux-media@vger.kernel.org |
5466 | T: git git://linuxtv.org/media_tree.git | 5482 | T: git git://linuxtv.org/media_tree.git |
5467 | S: Maintained | 5483 | S: Maintained |
5468 | F: drivers/media/radio/radio-ma901.c | 5484 | F: drivers/media/radio/radio-ma901.c |
5469 | 5485 | ||
5470 | MAC80211 | 5486 | MAC80211 |
5471 | M: Johannes Berg <johannes@sipsolutions.net> | 5487 | M: Johannes Berg <johannes@sipsolutions.net> |
@@ -5501,6 +5517,11 @@ W: http://www.kernel.org/doc/man-pages | |||
5501 | L: linux-man@vger.kernel.org | 5517 | L: linux-man@vger.kernel.org |
5502 | S: Maintained | 5518 | S: Maintained |
5503 | 5519 | ||
5520 | MARVELL ARMADA DRM SUPPORT | ||
5521 | M: Russell King <rmk+kernel@arm.linux.org.uk> | ||
5522 | S: Maintained | ||
5523 | F: drivers/gpu/drm/armada/ | ||
5524 | |||
5504 | MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) | 5525 | MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) |
5505 | M: Mirko Lindner <mlindner@marvell.com> | 5526 | M: Mirko Lindner <mlindner@marvell.com> |
5506 | M: Stephen Hemminger <stephen@networkplumber.org> | 5527 | M: Stephen Hemminger <stephen@networkplumber.org> |
@@ -5621,7 +5642,7 @@ F: drivers/scsi/megaraid/ | |||
5621 | 5642 | ||
5622 | MELLANOX ETHERNET DRIVER (mlx4_en) | 5643 | MELLANOX ETHERNET DRIVER (mlx4_en) |
5623 | M: Amir Vadai <amirv@mellanox.com> | 5644 | M: Amir Vadai <amirv@mellanox.com> |
5624 | L: netdev@vger.kernel.org | 5645 | L: netdev@vger.kernel.org |
5625 | S: Supported | 5646 | S: Supported |
5626 | W: http://www.mellanox.com | 5647 | W: http://www.mellanox.com |
5627 | Q: http://patchwork.ozlabs.org/project/netdev/list/ | 5648 | Q: http://patchwork.ozlabs.org/project/netdev/list/ |
@@ -5662,7 +5683,7 @@ F: include/linux/mtd/ | |||
5662 | F: include/uapi/mtd/ | 5683 | F: include/uapi/mtd/ |
5663 | 5684 | ||
5664 | MEN A21 WATCHDOG DRIVER | 5685 | MEN A21 WATCHDOG DRIVER |
5665 | M: Johannes Thumshirn <johannes.thumshirn@men.de> | 5686 | M: Johannes Thumshirn <johannes.thumshirn@men.de> |
5666 | L: linux-watchdog@vger.kernel.org | 5687 | L: linux-watchdog@vger.kernel.org |
5667 | S: Supported | 5688 | S: Supported |
5668 | F: drivers/watchdog/mena21_wdt.c | 5689 | F: drivers/watchdog/mena21_wdt.c |
@@ -5718,20 +5739,20 @@ L: linux-rdma@vger.kernel.org | |||
5718 | W: http://www.mellanox.com | 5739 | W: http://www.mellanox.com |
5719 | Q: http://patchwork.ozlabs.org/project/netdev/list/ | 5740 | Q: http://patchwork.ozlabs.org/project/netdev/list/ |
5720 | Q: http://patchwork.kernel.org/project/linux-rdma/list/ | 5741 | Q: http://patchwork.kernel.org/project/linux-rdma/list/ |
5721 | T: git://openfabrics.org/~eli/connect-ib.git | 5742 | T: git git://openfabrics.org/~eli/connect-ib.git |
5722 | S: Supported | 5743 | S: Supported |
5723 | F: drivers/net/ethernet/mellanox/mlx5/core/ | 5744 | F: drivers/net/ethernet/mellanox/mlx5/core/ |
5724 | F: include/linux/mlx5/ | 5745 | F: include/linux/mlx5/ |
5725 | 5746 | ||
5726 | Mellanox MLX5 IB driver | 5747 | Mellanox MLX5 IB driver |
5727 | M: Eli Cohen <eli@mellanox.com> | 5748 | M: Eli Cohen <eli@mellanox.com> |
5728 | L: linux-rdma@vger.kernel.org | 5749 | L: linux-rdma@vger.kernel.org |
5729 | W: http://www.mellanox.com | 5750 | W: http://www.mellanox.com |
5730 | Q: http://patchwork.kernel.org/project/linux-rdma/list/ | 5751 | Q: http://patchwork.kernel.org/project/linux-rdma/list/ |
5731 | T: git://openfabrics.org/~eli/connect-ib.git | 5752 | T: git git://openfabrics.org/~eli/connect-ib.git |
5732 | S: Supported | 5753 | S: Supported |
5733 | F: include/linux/mlx5/ | 5754 | F: include/linux/mlx5/ |
5734 | F: drivers/infiniband/hw/mlx5/ | 5755 | F: drivers/infiniband/hw/mlx5/ |
5735 | 5756 | ||
5736 | MODULE SUPPORT | 5757 | MODULE SUPPORT |
5737 | M: Rusty Russell <rusty@rustcorp.com.au> | 5758 | M: Rusty Russell <rusty@rustcorp.com.au> |
@@ -5983,6 +6004,8 @@ F: include/linux/netdevice.h | |||
5983 | F: include/uapi/linux/in.h | 6004 | F: include/uapi/linux/in.h |
5984 | F: include/uapi/linux/net.h | 6005 | F: include/uapi/linux/net.h |
5985 | F: include/uapi/linux/netdevice.h | 6006 | F: include/uapi/linux/netdevice.h |
6007 | F: tools/net/ | ||
6008 | F: tools/testing/selftests/net/ | ||
5986 | 6009 | ||
5987 | NETWORKING [IPv4/IPv6] | 6010 | NETWORKING [IPv4/IPv6] |
5988 | M: "David S. Miller" <davem@davemloft.net> | 6011 | M: "David S. Miller" <davem@davemloft.net> |
@@ -6156,6 +6179,12 @@ S: Supported | |||
6156 | F: drivers/block/nvme* | 6179 | F: drivers/block/nvme* |
6157 | F: include/linux/nvme.h | 6180 | F: include/linux/nvme.h |
6158 | 6181 | ||
6182 | NXP TDA998X DRM DRIVER | ||
6183 | M: Russell King <rmk+kernel@arm.linux.org.uk> | ||
6184 | S: Supported | ||
6185 | F: drivers/gpu/drm/i2c/tda998x_drv.c | ||
6186 | F: include/drm/i2c/tda998x.h | ||
6187 | |||
6159 | OMAP SUPPORT | 6188 | OMAP SUPPORT |
6160 | M: Tony Lindgren <tony@atomide.com> | 6189 | M: Tony Lindgren <tony@atomide.com> |
6161 | L: linux-omap@vger.kernel.org | 6190 | L: linux-omap@vger.kernel.org |
@@ -8443,8 +8472,8 @@ TARGET SUBSYSTEM | |||
8443 | M: Nicholas A. Bellinger <nab@linux-iscsi.org> | 8472 | M: Nicholas A. Bellinger <nab@linux-iscsi.org> |
8444 | L: linux-scsi@vger.kernel.org | 8473 | L: linux-scsi@vger.kernel.org |
8445 | L: target-devel@vger.kernel.org | 8474 | L: target-devel@vger.kernel.org |
8446 | L: http://groups.google.com/group/linux-iscsi-target-dev | ||
8447 | W: http://www.linux-iscsi.org | 8475 | W: http://www.linux-iscsi.org |
8476 | W: http://groups.google.com/group/linux-iscsi-target-dev | ||
8448 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master | 8477 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master |
8449 | S: Supported | 8478 | S: Supported |
8450 | F: drivers/target/ | 8479 | F: drivers/target/ |
@@ -8685,17 +8714,17 @@ S: Maintained | |||
8685 | F: drivers/media/radio/radio-raremono.c | 8714 | F: drivers/media/radio/radio-raremono.c |
8686 | 8715 | ||
8687 | THERMAL | 8716 | THERMAL |
8688 | M: Zhang Rui <rui.zhang@intel.com> | 8717 | M: Zhang Rui <rui.zhang@intel.com> |
8689 | M: Eduardo Valentin <eduardo.valentin@ti.com> | 8718 | M: Eduardo Valentin <eduardo.valentin@ti.com> |
8690 | L: linux-pm@vger.kernel.org | 8719 | L: linux-pm@vger.kernel.org |
8691 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git | 8720 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git |
8692 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git | 8721 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git |
8693 | Q: https://patchwork.kernel.org/project/linux-pm/list/ | 8722 | Q: https://patchwork.kernel.org/project/linux-pm/list/ |
8694 | S: Supported | 8723 | S: Supported |
8695 | F: drivers/thermal/ | 8724 | F: drivers/thermal/ |
8696 | F: include/linux/thermal.h | 8725 | F: include/linux/thermal.h |
8697 | F: include/linux/cpu_cooling.h | 8726 | F: include/linux/cpu_cooling.h |
8698 | F: Documentation/devicetree/bindings/thermal/ | 8727 | F: Documentation/devicetree/bindings/thermal/ |
8699 | 8728 | ||
8700 | THINGM BLINK(1) USB RGB LED DRIVER | 8729 | THINGM BLINK(1) USB RGB LED DRIVER |
8701 | M: Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 8730 | M: Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
@@ -9797,7 +9826,7 @@ ZR36067 VIDEO FOR LINUX DRIVER | |||
9797 | L: mjpeg-users@lists.sourceforge.net | 9826 | L: mjpeg-users@lists.sourceforge.net |
9798 | L: linux-media@vger.kernel.org | 9827 | L: linux-media@vger.kernel.org |
9799 | W: http://mjpeg.sourceforge.net/driver-zoran/ | 9828 | W: http://mjpeg.sourceforge.net/driver-zoran/ |
9800 | T: Mercurial http://linuxtv.org/hg/v4l-dvb | 9829 | T: hg http://linuxtv.org/hg/v4l-dvb |
9801 | S: Odd Fixes | 9830 | S: Odd Fixes |
9802 | F: drivers/media/pci/zoran/ | 9831 | F: drivers/media/pci/zoran/ |
9803 | 9832 | ||
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 14 | 2 | PATCHLEVEL = 14 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc8 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -605,10 +605,11 @@ endif | |||
605 | ifdef CONFIG_CC_STACKPROTECTOR_REGULAR | 605 | ifdef CONFIG_CC_STACKPROTECTOR_REGULAR |
606 | stackp-flag := -fstack-protector | 606 | stackp-flag := -fstack-protector |
607 | ifeq ($(call cc-option, $(stackp-flag)),) | 607 | ifeq ($(call cc-option, $(stackp-flag)),) |
608 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR: \ | 608 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: \ |
609 | -fstack-protector not supported by compiler)) | 609 | -fstack-protector not supported by compiler) |
610 | endif | 610 | endif |
611 | else ifdef CONFIG_CC_STACKPROTECTOR_STRONG | 611 | else |
612 | ifdef CONFIG_CC_STACKPROTECTOR_STRONG | ||
612 | stackp-flag := -fstack-protector-strong | 613 | stackp-flag := -fstack-protector-strong |
613 | ifeq ($(call cc-option, $(stackp-flag)),) | 614 | ifeq ($(call cc-option, $(stackp-flag)),) |
614 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: \ | 615 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: \ |
@@ -618,6 +619,7 @@ else | |||
618 | # Force off for distro compilers that enable stack protector by default. | 619 | # Force off for distro compilers that enable stack protector by default. |
619 | stackp-flag := $(call cc-option, -fno-stack-protector) | 620 | stackp-flag := $(call cc-option, -fno-stack-protector) |
620 | endif | 621 | endif |
622 | endif | ||
621 | KBUILD_CFLAGS += $(stackp-flag) | 623 | KBUILD_CFLAGS += $(stackp-flag) |
622 | 624 | ||
623 | # This warning generated too much noise in a regular build. | 625 | # This warning generated too much noise in a regular build. |
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c index 6b58c1de7577..400c663b21c2 100644 --- a/arch/arc/mm/cache_arc700.c +++ b/arch/arc/mm/cache_arc700.c | |||
@@ -282,7 +282,7 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr, | |||
282 | #else | 282 | #else |
283 | /* if V-P const for loop, PTAG can be written once outside loop */ | 283 | /* if V-P const for loop, PTAG can be written once outside loop */ |
284 | if (full_page_op) | 284 | if (full_page_op) |
285 | write_aux_reg(ARC_REG_DC_PTAG, paddr); | 285 | write_aux_reg(aux_tag, paddr); |
286 | #endif | 286 | #endif |
287 | 287 | ||
288 | while (num_lines-- > 0) { | 288 | while (num_lines-- > 0) { |
@@ -296,7 +296,7 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr, | |||
296 | write_aux_reg(aux_cmd, vaddr); | 296 | write_aux_reg(aux_cmd, vaddr); |
297 | vaddr += L1_CACHE_BYTES; | 297 | vaddr += L1_CACHE_BYTES; |
298 | #else | 298 | #else |
299 | write_aux_reg(aux, paddr); | 299 | write_aux_reg(aux_cmd, paddr); |
300 | paddr += L1_CACHE_BYTES; | 300 | paddr += L1_CACHE_BYTES; |
301 | #endif | 301 | #endif |
302 | } | 302 | } |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e25419817791..15949459611f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1578,6 +1578,7 @@ config BL_SWITCHER_DUMMY_IF | |||
1578 | 1578 | ||
1579 | choice | 1579 | choice |
1580 | prompt "Memory split" | 1580 | prompt "Memory split" |
1581 | depends on MMU | ||
1581 | default VMSPLIT_3G | 1582 | default VMSPLIT_3G |
1582 | help | 1583 | help |
1583 | Select the desired split between kernel and user memory. | 1584 | Select the desired split between kernel and user memory. |
@@ -1595,6 +1596,7 @@ endchoice | |||
1595 | 1596 | ||
1596 | config PAGE_OFFSET | 1597 | config PAGE_OFFSET |
1597 | hex | 1598 | hex |
1599 | default PHYS_OFFSET if !MMU | ||
1598 | default 0x40000000 if VMSPLIT_1G | 1600 | default 0x40000000 if VMSPLIT_1G |
1599 | default 0x80000000 if VMSPLIT_2G | 1601 | default 0x80000000 if VMSPLIT_2G |
1600 | default 0xC0000000 | 1602 | default 0xC0000000 |
@@ -1903,6 +1905,7 @@ config XEN | |||
1903 | depends on ARM && AEABI && OF | 1905 | depends on ARM && AEABI && OF |
1904 | depends on CPU_V7 && !CPU_V6 | 1906 | depends on CPU_V7 && !CPU_V6 |
1905 | depends on !GENERIC_ATOMIC64 | 1907 | depends on !GENERIC_ATOMIC64 |
1908 | depends on MMU | ||
1906 | select ARM_PSCI | 1909 | select ARM_PSCI |
1907 | select SWIOTLB_XEN | 1910 | select SWIOTLB_XEN |
1908 | select ARCH_DMA_ADDR_T_64BIT | 1911 | select ARCH_DMA_ADDR_T_64BIT |
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore index 47279aa96a6a..0714e0334e33 100644 --- a/arch/arm/boot/compressed/.gitignore +++ b/arch/arm/boot/compressed/.gitignore | |||
@@ -1,4 +1,5 @@ | |||
1 | ashldi3.S | 1 | ashldi3.S |
2 | bswapsdi2.S | ||
2 | font.c | 3 | font.c |
3 | lib1funcs.S | 4 | lib1funcs.S |
4 | hyp-stub.S | 5 | hyp-stub.S |
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi index e491b82f8d67..792fde1b7f75 100644 --- a/arch/arm/boot/dts/bcm11351.dtsi +++ b/arch/arm/boot/dts/bcm11351.dtsi | |||
@@ -147,7 +147,7 @@ | |||
147 | }; | 147 | }; |
148 | 148 | ||
149 | pinctrl@35004800 { | 149 | pinctrl@35004800 { |
150 | compatible = "brcm,capri-pinctrl"; | 150 | compatible = "brcm,bcm11351-pinctrl"; |
151 | reg = <0x35004800 0x430>; | 151 | reg = <0x35004800 0x430>; |
152 | }; | 152 | }; |
153 | 153 | ||
diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi index 2363593e1050..ef58d1c24313 100644 --- a/arch/arm/boot/dts/keystone-clocks.dtsi +++ b/arch/arm/boot/dts/keystone-clocks.dtsi | |||
@@ -612,7 +612,7 @@ clocks { | |||
612 | compatible = "ti,keystone,psc-clock"; | 612 | compatible = "ti,keystone,psc-clock"; |
613 | clocks = <&chipclk13>; | 613 | clocks = <&chipclk13>; |
614 | clock-output-names = "vcp-3"; | 614 | clock-output-names = "vcp-3"; |
615 | reg = <0x0235000a8 0xb00>, <0x02350060 0x400>; | 615 | reg = <0x023500a8 0xb00>, <0x02350060 0x400>; |
616 | reg-names = "control", "domain"; | 616 | reg-names = "control", "domain"; |
617 | domain-id = <24>; | 617 | domain-id = <24>; |
618 | }; | 618 | }; |
diff --git a/arch/arm/boot/dts/omap3-gta04.dts b/arch/arm/boot/dts/omap3-gta04.dts index c551e4af4d83..d3b253bbc885 100644 --- a/arch/arm/boot/dts/omap3-gta04.dts +++ b/arch/arm/boot/dts/omap3-gta04.dts | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | / { | 14 | / { |
15 | model = "OMAP3 GTA04"; | 15 | model = "OMAP3 GTA04"; |
16 | compatible = "ti,omap3-gta04", "ti,omap3"; | 16 | compatible = "ti,omap3-gta04", "ti,omap36xx", "ti,omap3"; |
17 | 17 | ||
18 | cpus { | 18 | cpus { |
19 | cpu@0 { | 19 | cpu@0 { |
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts index 25a2b5f652fd..f2779ac75872 100644 --- a/arch/arm/boot/dts/omap3-igep0020.dts +++ b/arch/arm/boot/dts/omap3-igep0020.dts | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | / { | 15 | / { |
16 | model = "IGEPv2 (TI OMAP AM/DM37x)"; | 16 | model = "IGEPv2 (TI OMAP AM/DM37x)"; |
17 | compatible = "isee,omap3-igep0020", "ti,omap3"; | 17 | compatible = "isee,omap3-igep0020", "ti,omap36xx", "ti,omap3"; |
18 | 18 | ||
19 | leds { | 19 | leds { |
20 | pinctrl-names = "default"; | 20 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/omap3-igep0030.dts b/arch/arm/boot/dts/omap3-igep0030.dts index 145c58cfc8ac..2793749eb1ba 100644 --- a/arch/arm/boot/dts/omap3-igep0030.dts +++ b/arch/arm/boot/dts/omap3-igep0030.dts | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | / { | 14 | / { |
15 | model = "IGEP COM MODULE (TI OMAP AM/DM37x)"; | 15 | model = "IGEP COM MODULE (TI OMAP AM/DM37x)"; |
16 | compatible = "isee,omap3-igep0030", "ti,omap3"; | 16 | compatible = "isee,omap3-igep0030", "ti,omap36xx", "ti,omap3"; |
17 | 17 | ||
18 | leds { | 18 | leds { |
19 | pinctrl-names = "default"; | 19 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/sama5d36.dtsi b/arch/arm/boot/dts/sama5d36.dtsi index 6c31c26e6cc0..db58cad6acd3 100644 --- a/arch/arm/boot/dts/sama5d36.dtsi +++ b/arch/arm/boot/dts/sama5d36.dtsi | |||
@@ -8,8 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | #include "sama5d3.dtsi" | 9 | #include "sama5d3.dtsi" |
10 | #include "sama5d3_can.dtsi" | 10 | #include "sama5d3_can.dtsi" |
11 | #include "sama5d3_emac.dtsi" | ||
12 | #include "sama5d3_gmac.dtsi" | 11 | #include "sama5d3_gmac.dtsi" |
12 | #include "sama5d3_emac.dtsi" | ||
13 | #include "sama5d3_lcd.dtsi" | 13 | #include "sama5d3_lcd.dtsi" |
14 | #include "sama5d3_mci2.dtsi" | 14 | #include "sama5d3_mci2.dtsi" |
15 | #include "sama5d3_tcb1.dtsi" | 15 | #include "sama5d3_tcb1.dtsi" |
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi index 10666ca8aee1..d4d2763f4794 100644 --- a/arch/arm/boot/dts/sun4i-a10.dtsi +++ b/arch/arm/boot/dts/sun4i-a10.dtsi | |||
@@ -426,7 +426,7 @@ | |||
426 | }; | 426 | }; |
427 | 427 | ||
428 | rtp: rtp@01c25000 { | 428 | rtp: rtp@01c25000 { |
429 | compatible = "allwinner,sun4i-ts"; | 429 | compatible = "allwinner,sun4i-a10-ts"; |
430 | reg = <0x01c25000 0x100>; | 430 | reg = <0x01c25000 0x100>; |
431 | interrupts = <29>; | 431 | interrupts = <29>; |
432 | }; | 432 | }; |
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi index 64961595e8d6..79fd412005b0 100644 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi | |||
@@ -383,7 +383,7 @@ | |||
383 | }; | 383 | }; |
384 | 384 | ||
385 | rtp: rtp@01c25000 { | 385 | rtp: rtp@01c25000 { |
386 | compatible = "allwinner,sun4i-ts"; | 386 | compatible = "allwinner,sun4i-a10-ts"; |
387 | reg = <0x01c25000 0x100>; | 387 | reg = <0x01c25000 0x100>; |
388 | interrupts = <29>; | 388 | interrupts = <29>; |
389 | }; | 389 | }; |
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi index 320335abfccd..c463fd730c91 100644 --- a/arch/arm/boot/dts/sun5i-a13.dtsi +++ b/arch/arm/boot/dts/sun5i-a13.dtsi | |||
@@ -346,7 +346,7 @@ | |||
346 | }; | 346 | }; |
347 | 347 | ||
348 | rtp: rtp@01c25000 { | 348 | rtp: rtp@01c25000 { |
349 | compatible = "allwinner,sun4i-ts"; | 349 | compatible = "allwinner,sun4i-a10-ts"; |
350 | reg = <0x01c25000 0x100>; | 350 | reg = <0x01c25000 0x100>; |
351 | interrupts = <29>; | 351 | interrupts = <29>; |
352 | }; | 352 | }; |
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index 9ff09484847b..6f25cf559ad0 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi | |||
@@ -454,7 +454,7 @@ | |||
454 | rtc: rtc@01c20d00 { | 454 | rtc: rtc@01c20d00 { |
455 | compatible = "allwinner,sun7i-a20-rtc"; | 455 | compatible = "allwinner,sun7i-a20-rtc"; |
456 | reg = <0x01c20d00 0x20>; | 456 | reg = <0x01c20d00 0x20>; |
457 | interrupts = <0 24 1>; | 457 | interrupts = <0 24 4>; |
458 | }; | 458 | }; |
459 | 459 | ||
460 | sid: eeprom@01c23800 { | 460 | sid: eeprom@01c23800 { |
@@ -463,7 +463,7 @@ | |||
463 | }; | 463 | }; |
464 | 464 | ||
465 | rtp: rtp@01c25000 { | 465 | rtp: rtp@01c25000 { |
466 | compatible = "allwinner,sun4i-ts"; | 466 | compatible = "allwinner,sun4i-a10-ts"; |
467 | reg = <0x01c25000 0x100>; | 467 | reg = <0x01c25000 0x100>; |
468 | interrupts = <0 29 4>; | 468 | interrupts = <0 29 4>; |
469 | }; | 469 | }; |
@@ -596,10 +596,10 @@ | |||
596 | hstimer@01c60000 { | 596 | hstimer@01c60000 { |
597 | compatible = "allwinner,sun7i-a20-hstimer"; | 597 | compatible = "allwinner,sun7i-a20-hstimer"; |
598 | reg = <0x01c60000 0x1000>; | 598 | reg = <0x01c60000 0x1000>; |
599 | interrupts = <0 81 1>, | 599 | interrupts = <0 81 4>, |
600 | <0 82 1>, | 600 | <0 82 4>, |
601 | <0 83 1>, | 601 | <0 83 4>, |
602 | <0 84 1>; | 602 | <0 84 4>; |
603 | clocks = <&ahb_gates 28>; | 603 | clocks = <&ahb_gates 28>; |
604 | }; | 604 | }; |
605 | 605 | ||
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig index 00fe9e9710fd..27d69b558c5d 100644 --- a/arch/arm/configs/tegra_defconfig +++ b/arch/arm/configs/tegra_defconfig | |||
@@ -204,7 +204,10 @@ CONFIG_MMC_BLOCK_MINORS=16 | |||
204 | CONFIG_MMC_SDHCI=y | 204 | CONFIG_MMC_SDHCI=y |
205 | CONFIG_MMC_SDHCI_PLTFM=y | 205 | CONFIG_MMC_SDHCI_PLTFM=y |
206 | CONFIG_MMC_SDHCI_TEGRA=y | 206 | CONFIG_MMC_SDHCI_TEGRA=y |
207 | CONFIG_NEW_LEDS=y | ||
208 | CONFIG_LEDS_CLASS=y | ||
207 | CONFIG_LEDS_GPIO=y | 209 | CONFIG_LEDS_GPIO=y |
210 | CONFIG_LEDS_TRIGGERS=y | ||
208 | CONFIG_LEDS_TRIGGER_TIMER=y | 211 | CONFIG_LEDS_TRIGGER_TIMER=y |
209 | CONFIG_LEDS_TRIGGER_ONESHOT=y | 212 | CONFIG_LEDS_TRIGGER_ONESHOT=y |
210 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 213 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 8756e4bcdba0..4afb376d9c7c 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -30,14 +30,15 @@ | |||
30 | */ | 30 | */ |
31 | #define UL(x) _AC(x, UL) | 31 | #define UL(x) _AC(x, UL) |
32 | 32 | ||
33 | /* PAGE_OFFSET - the virtual address of the start of the kernel image */ | ||
34 | #define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET) | ||
35 | |||
33 | #ifdef CONFIG_MMU | 36 | #ifdef CONFIG_MMU |
34 | 37 | ||
35 | /* | 38 | /* |
36 | * PAGE_OFFSET - the virtual address of the start of the kernel image | ||
37 | * TASK_SIZE - the maximum size of a user space task. | 39 | * TASK_SIZE - the maximum size of a user space task. |
38 | * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area | 40 | * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area |
39 | */ | 41 | */ |
40 | #define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET) | ||
41 | #define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M)) | 42 | #define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M)) |
42 | #define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M) | 43 | #define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M) |
43 | 44 | ||
@@ -104,10 +105,6 @@ | |||
104 | #define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE) | 105 | #define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE) |
105 | #endif | 106 | #endif |
106 | 107 | ||
107 | #ifndef PAGE_OFFSET | ||
108 | #define PAGE_OFFSET PLAT_PHYS_OFFSET | ||
109 | #endif | ||
110 | |||
111 | /* | 108 | /* |
112 | * The module can be at any place in ram in nommu mode. | 109 | * The module can be at any place in ram in nommu mode. |
113 | */ | 110 | */ |
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S index 47cd974e57ea..c96ecacb2021 100644 --- a/arch/arm/kernel/head-common.S +++ b/arch/arm/kernel/head-common.S | |||
@@ -177,6 +177,18 @@ __lookup_processor_type_data: | |||
177 | .long __proc_info_end | 177 | .long __proc_info_end |
178 | .size __lookup_processor_type_data, . - __lookup_processor_type_data | 178 | .size __lookup_processor_type_data, . - __lookup_processor_type_data |
179 | 179 | ||
180 | __error_lpae: | ||
181 | #ifdef CONFIG_DEBUG_LL | ||
182 | adr r0, str_lpae | ||
183 | bl printascii | ||
184 | b __error | ||
185 | str_lpae: .asciz "\nError: Kernel with LPAE support, but CPU does not support LPAE.\n" | ||
186 | #else | ||
187 | b __error | ||
188 | #endif | ||
189 | .align | ||
190 | ENDPROC(__error_lpae) | ||
191 | |||
180 | __error_p: | 192 | __error_p: |
181 | #ifdef CONFIG_DEBUG_LL | 193 | #ifdef CONFIG_DEBUG_LL |
182 | adr r0, str_p1 | 194 | adr r0, str_p1 |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 914616e0bdcd..f5f381d91556 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -102,7 +102,7 @@ ENTRY(stext) | |||
102 | and r3, r3, #0xf @ extract VMSA support | 102 | and r3, r3, #0xf @ extract VMSA support |
103 | cmp r3, #5 @ long-descriptor translation table format? | 103 | cmp r3, #5 @ long-descriptor translation table format? |
104 | THUMB( it lo ) @ force fixup-able long branch encoding | 104 | THUMB( it lo ) @ force fixup-able long branch encoding |
105 | blo __error_p @ only classic page table format | 105 | blo __error_lpae @ only classic page table format |
106 | #endif | 106 | #endif |
107 | 107 | ||
108 | #ifndef CONFIG_XIP_KERNEL | 108 | #ifndef CONFIG_XIP_KERNEL |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 1d8248ea5669..bd18bb8b2770 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -878,7 +878,8 @@ static int hyp_init_cpu_pm_notifier(struct notifier_block *self, | |||
878 | unsigned long cmd, | 878 | unsigned long cmd, |
879 | void *v) | 879 | void *v) |
880 | { | 880 | { |
881 | if (cmd == CPU_PM_EXIT) { | 881 | if (cmd == CPU_PM_EXIT && |
882 | __hyp_get_vectors() == hyp_default_vectors) { | ||
882 | cpu_init_hyp_mode(NULL); | 883 | cpu_init_hyp_mode(NULL); |
883 | return NOTIFY_OK; | 884 | return NOTIFY_OK; |
884 | } | 885 | } |
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S index ddc15539bad2..0d68d4073068 100644 --- a/arch/arm/kvm/interrupts.S +++ b/arch/arm/kvm/interrupts.S | |||
@@ -220,6 +220,10 @@ after_vfp_restore: | |||
220 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are | 220 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are |
221 | * passed in r0 and r1. | 221 | * passed in r0 and r1. |
222 | * | 222 | * |
223 | * A function pointer with a value of 0xffffffff has a special meaning, | ||
224 | * and is used to implement __hyp_get_vectors in the same way as in | ||
225 | * arch/arm/kernel/hyp_stub.S. | ||
226 | * | ||
223 | * The calling convention follows the standard AAPCS: | 227 | * The calling convention follows the standard AAPCS: |
224 | * r0 - r3: caller save | 228 | * r0 - r3: caller save |
225 | * r12: caller save | 229 | * r12: caller save |
@@ -363,6 +367,11 @@ hyp_hvc: | |||
363 | host_switch_to_hyp: | 367 | host_switch_to_hyp: |
364 | pop {r0, r1, r2} | 368 | pop {r0, r1, r2} |
365 | 369 | ||
370 | /* Check for __hyp_get_vectors */ | ||
371 | cmp r0, #-1 | ||
372 | mrceq p15, 4, r0, c12, c0, 0 @ get HVBAR | ||
373 | beq 1f | ||
374 | |||
366 | push {lr} | 375 | push {lr} |
367 | mrs lr, SPSR | 376 | mrs lr, SPSR |
368 | push {lr} | 377 | push {lr} |
@@ -378,7 +387,7 @@ THUMB( orr lr, #1) | |||
378 | pop {lr} | 387 | pop {lr} |
379 | msr SPSR_csxf, lr | 388 | msr SPSR_csxf, lr |
380 | pop {lr} | 389 | pop {lr} |
381 | eret | 390 | 1: eret |
382 | 391 | ||
383 | guest_trap: | 392 | guest_trap: |
384 | load_vcpu @ Load VCPU pointer to r0 | 393 | load_vcpu @ Load VCPU pointer to r0 |
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c index 3b05aea56d1f..11ed9152e665 100644 --- a/arch/arm/mach-omap2/cclock3xxx_data.c +++ b/arch/arm/mach-omap2/cclock3xxx_data.c | |||
@@ -433,7 +433,9 @@ static const struct clk_ops dpll4_m5x2_ck_ops = { | |||
433 | .enable = &omap2_dflt_clk_enable, | 433 | .enable = &omap2_dflt_clk_enable, |
434 | .disable = &omap2_dflt_clk_disable, | 434 | .disable = &omap2_dflt_clk_disable, |
435 | .is_enabled = &omap2_dflt_clk_is_enabled, | 435 | .is_enabled = &omap2_dflt_clk_is_enabled, |
436 | .set_rate = &omap3_clkoutx2_set_rate, | ||
436 | .recalc_rate = &omap3_clkoutx2_recalc, | 437 | .recalc_rate = &omap3_clkoutx2_recalc, |
438 | .round_rate = &omap3_clkoutx2_round_rate, | ||
437 | }; | 439 | }; |
438 | 440 | ||
439 | static const struct clk_ops dpll4_m5x2_ck_3630_ops = { | 441 | static const struct clk_ops dpll4_m5x2_ck_3630_ops = { |
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index 4c158c838d40..01fc710c8181 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include "prm.h" | 23 | #include "prm.h" |
24 | #include "clockdomain.h" | 24 | #include "clockdomain.h" |
25 | 25 | ||
26 | #define MAX_CPUS 2 | ||
27 | |||
26 | /* Machine specific information */ | 28 | /* Machine specific information */ |
27 | struct idle_statedata { | 29 | struct idle_statedata { |
28 | u32 cpu_state; | 30 | u32 cpu_state; |
@@ -48,11 +50,11 @@ static struct idle_statedata omap4_idle_data[] = { | |||
48 | }, | 50 | }, |
49 | }; | 51 | }; |
50 | 52 | ||
51 | static struct powerdomain *mpu_pd, *cpu_pd[NR_CPUS]; | 53 | static struct powerdomain *mpu_pd, *cpu_pd[MAX_CPUS]; |
52 | static struct clockdomain *cpu_clkdm[NR_CPUS]; | 54 | static struct clockdomain *cpu_clkdm[MAX_CPUS]; |
53 | 55 | ||
54 | static atomic_t abort_barrier; | 56 | static atomic_t abort_barrier; |
55 | static bool cpu_done[NR_CPUS]; | 57 | static bool cpu_done[MAX_CPUS]; |
56 | static struct idle_statedata *state_ptr = &omap4_idle_data[0]; | 58 | static struct idle_statedata *state_ptr = &omap4_idle_data[0]; |
57 | 59 | ||
58 | /* Private functions */ | 60 | /* Private functions */ |
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c index 3185ced807c9..3c418ea54bbe 100644 --- a/arch/arm/mach-omap2/dpll3xxx.c +++ b/arch/arm/mach-omap2/dpll3xxx.c | |||
@@ -623,6 +623,32 @@ void omap3_dpll_deny_idle(struct clk_hw_omap *clk) | |||
623 | 623 | ||
624 | /* Clock control for DPLL outputs */ | 624 | /* Clock control for DPLL outputs */ |
625 | 625 | ||
626 | /* Find the parent DPLL for the given clkoutx2 clock */ | ||
627 | static struct clk_hw_omap *omap3_find_clkoutx2_dpll(struct clk_hw *hw) | ||
628 | { | ||
629 | struct clk_hw_omap *pclk = NULL; | ||
630 | struct clk *parent; | ||
631 | |||
632 | /* Walk up the parents of clk, looking for a DPLL */ | ||
633 | do { | ||
634 | do { | ||
635 | parent = __clk_get_parent(hw->clk); | ||
636 | hw = __clk_get_hw(parent); | ||
637 | } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC)); | ||
638 | if (!hw) | ||
639 | break; | ||
640 | pclk = to_clk_hw_omap(hw); | ||
641 | } while (pclk && !pclk->dpll_data); | ||
642 | |||
643 | /* clk does not have a DPLL as a parent? error in the clock data */ | ||
644 | if (!pclk) { | ||
645 | WARN_ON(1); | ||
646 | return NULL; | ||
647 | } | ||
648 | |||
649 | return pclk; | ||
650 | } | ||
651 | |||
626 | /** | 652 | /** |
627 | * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate | 653 | * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate |
628 | * @clk: DPLL output struct clk | 654 | * @clk: DPLL output struct clk |
@@ -637,27 +663,14 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, | |||
637 | unsigned long rate; | 663 | unsigned long rate; |
638 | u32 v; | 664 | u32 v; |
639 | struct clk_hw_omap *pclk = NULL; | 665 | struct clk_hw_omap *pclk = NULL; |
640 | struct clk *parent; | ||
641 | 666 | ||
642 | if (!parent_rate) | 667 | if (!parent_rate) |
643 | return 0; | 668 | return 0; |
644 | 669 | ||
645 | /* Walk up the parents of clk, looking for a DPLL */ | 670 | pclk = omap3_find_clkoutx2_dpll(hw); |
646 | do { | ||
647 | do { | ||
648 | parent = __clk_get_parent(hw->clk); | ||
649 | hw = __clk_get_hw(parent); | ||
650 | } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC)); | ||
651 | if (!hw) | ||
652 | break; | ||
653 | pclk = to_clk_hw_omap(hw); | ||
654 | } while (pclk && !pclk->dpll_data); | ||
655 | 671 | ||
656 | /* clk does not have a DPLL as a parent? error in the clock data */ | 672 | if (!pclk) |
657 | if (!pclk) { | ||
658 | WARN_ON(1); | ||
659 | return 0; | 673 | return 0; |
660 | } | ||
661 | 674 | ||
662 | dd = pclk->dpll_data; | 675 | dd = pclk->dpll_data; |
663 | 676 | ||
@@ -672,6 +685,55 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, | |||
672 | return rate; | 685 | return rate; |
673 | } | 686 | } |
674 | 687 | ||
688 | int omap3_clkoutx2_set_rate(struct clk_hw *hw, unsigned long rate, | ||
689 | unsigned long parent_rate) | ||
690 | { | ||
691 | return 0; | ||
692 | } | ||
693 | |||
694 | long omap3_clkoutx2_round_rate(struct clk_hw *hw, unsigned long rate, | ||
695 | unsigned long *prate) | ||
696 | { | ||
697 | const struct dpll_data *dd; | ||
698 | u32 v; | ||
699 | struct clk_hw_omap *pclk = NULL; | ||
700 | |||
701 | if (!*prate) | ||
702 | return 0; | ||
703 | |||
704 | pclk = omap3_find_clkoutx2_dpll(hw); | ||
705 | |||
706 | if (!pclk) | ||
707 | return 0; | ||
708 | |||
709 | dd = pclk->dpll_data; | ||
710 | |||
711 | /* TYPE J does not have a clkoutx2 */ | ||
712 | if (dd->flags & DPLL_J_TYPE) { | ||
713 | *prate = __clk_round_rate(__clk_get_parent(pclk->hw.clk), rate); | ||
714 | return *prate; | ||
715 | } | ||
716 | |||
717 | WARN_ON(!dd->enable_mask); | ||
718 | |||
719 | v = omap2_clk_readl(pclk, dd->control_reg) & dd->enable_mask; | ||
720 | v >>= __ffs(dd->enable_mask); | ||
721 | |||
722 | /* If in bypass, the rate is fixed to the bypass rate*/ | ||
723 | if (v != OMAP3XXX_EN_DPLL_LOCKED) | ||
724 | return *prate; | ||
725 | |||
726 | if (__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT) { | ||
727 | unsigned long best_parent; | ||
728 | |||
729 | best_parent = (rate / 2); | ||
730 | *prate = __clk_round_rate(__clk_get_parent(hw->clk), | ||
731 | best_parent); | ||
732 | } | ||
733 | |||
734 | return *prate * 2; | ||
735 | } | ||
736 | |||
675 | /* OMAP3/4 non-CORE DPLL clkops */ | 737 | /* OMAP3/4 non-CORE DPLL clkops */ |
676 | const struct clk_hw_omap_ops clkhwops_omap3_dpll = { | 738 | const struct clk_hw_omap_ops clkhwops_omap3_dpll = { |
677 | .allow_idle = omap3_dpll_allow_idle, | 739 | .allow_idle = omap3_dpll_allow_idle, |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 42d81885c700..1f33f5db10d5 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1947,29 +1947,31 @@ static int _ocp_softreset(struct omap_hwmod *oh) | |||
1947 | goto dis_opt_clks; | 1947 | goto dis_opt_clks; |
1948 | 1948 | ||
1949 | _write_sysconfig(v, oh); | 1949 | _write_sysconfig(v, oh); |
1950 | ret = _clear_softreset(oh, &v); | ||
1951 | if (ret) | ||
1952 | goto dis_opt_clks; | ||
1953 | |||
1954 | _write_sysconfig(v, oh); | ||
1955 | 1950 | ||
1956 | if (oh->class->sysc->srst_udelay) | 1951 | if (oh->class->sysc->srst_udelay) |
1957 | udelay(oh->class->sysc->srst_udelay); | 1952 | udelay(oh->class->sysc->srst_udelay); |
1958 | 1953 | ||
1959 | c = _wait_softreset_complete(oh); | 1954 | c = _wait_softreset_complete(oh); |
1960 | if (c == MAX_MODULE_SOFTRESET_WAIT) | 1955 | if (c == MAX_MODULE_SOFTRESET_WAIT) { |
1961 | pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", | 1956 | pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", |
1962 | oh->name, MAX_MODULE_SOFTRESET_WAIT); | 1957 | oh->name, MAX_MODULE_SOFTRESET_WAIT); |
1963 | else | 1958 | ret = -ETIMEDOUT; |
1959 | goto dis_opt_clks; | ||
1960 | } else { | ||
1964 | pr_debug("omap_hwmod: %s: softreset in %d usec\n", oh->name, c); | 1961 | pr_debug("omap_hwmod: %s: softreset in %d usec\n", oh->name, c); |
1962 | } | ||
1963 | |||
1964 | ret = _clear_softreset(oh, &v); | ||
1965 | if (ret) | ||
1966 | goto dis_opt_clks; | ||
1967 | |||
1968 | _write_sysconfig(v, oh); | ||
1965 | 1969 | ||
1966 | /* | 1970 | /* |
1967 | * XXX add _HWMOD_STATE_WEDGED for modules that don't come back from | 1971 | * XXX add _HWMOD_STATE_WEDGED for modules that don't come back from |
1968 | * _wait_target_ready() or _reset() | 1972 | * _wait_target_ready() or _reset() |
1969 | */ | 1973 | */ |
1970 | 1974 | ||
1971 | ret = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0; | ||
1972 | |||
1973 | dis_opt_clks: | 1975 | dis_opt_clks: |
1974 | if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) | 1976 | if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) |
1975 | _disable_optional_clocks(oh); | 1977 | _disable_optional_clocks(oh); |
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index 18f333c440db..810c205d668b 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c | |||
@@ -1365,11 +1365,10 @@ static struct omap_hwmod_class_sysconfig dra7xx_spinlock_sysc = { | |||
1365 | .rev_offs = 0x0000, | 1365 | .rev_offs = 0x0000, |
1366 | .sysc_offs = 0x0010, | 1366 | .sysc_offs = 0x0010, |
1367 | .syss_offs = 0x0014, | 1367 | .syss_offs = 0x0014, |
1368 | .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | | 1368 | .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP | |
1369 | SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | | 1369 | SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | |
1370 | SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), | 1370 | SYSS_HAS_RESET_STATUS), |
1371 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | 1371 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), |
1372 | SIDLE_SMART_WKUP), | ||
1373 | .sysc_fields = &omap_hwmod_sysc_type1, | 1372 | .sysc_fields = &omap_hwmod_sysc_type1, |
1374 | }; | 1373 | }; |
1375 | 1374 | ||
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 3d5b24dcd9a4..c33e07e2f0d4 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include "common-board-devices.h" | 22 | #include "common-board-devices.h" |
23 | #include "dss-common.h" | 23 | #include "dss-common.h" |
24 | #include "control.h" | 24 | #include "control.h" |
25 | #include "omap-secure.h" | ||
26 | #include "soc.h" | ||
25 | 27 | ||
26 | struct pdata_init { | 28 | struct pdata_init { |
27 | const char *compatible; | 29 | const char *compatible; |
@@ -169,6 +171,22 @@ static void __init am3517_evm_legacy_init(void) | |||
169 | omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET); | 171 | omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET); |
170 | omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */ | 172 | omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */ |
171 | } | 173 | } |
174 | |||
175 | static void __init nokia_n900_legacy_init(void) | ||
176 | { | ||
177 | hsmmc2_internal_input_clk(); | ||
178 | |||
179 | if (omap_type() == OMAP2_DEVICE_TYPE_SEC) { | ||
180 | if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) { | ||
181 | pr_info("RX-51: Enabling ARM errata 430973 workaround\n"); | ||
182 | /* set IBE to 1 */ | ||
183 | rx51_secure_update_aux_cr(BIT(6), 0); | ||
184 | } else { | ||
185 | pr_warning("RX-51: Not enabling ARM errata 430973 workaround\n"); | ||
186 | pr_warning("Thumb binaries may crash randomly without this workaround\n"); | ||
187 | } | ||
188 | } | ||
189 | } | ||
172 | #endif /* CONFIG_ARCH_OMAP3 */ | 190 | #endif /* CONFIG_ARCH_OMAP3 */ |
173 | 191 | ||
174 | #ifdef CONFIG_ARCH_OMAP4 | 192 | #ifdef CONFIG_ARCH_OMAP4 |
@@ -239,6 +257,7 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { | |||
239 | #endif | 257 | #endif |
240 | #ifdef CONFIG_ARCH_OMAP3 | 258 | #ifdef CONFIG_ARCH_OMAP3 |
241 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata), | 259 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata), |
260 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x480025a0, "480025a0.pinmux", &pcs_pdata), | ||
242 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata), | 261 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata), |
243 | /* Only on am3517 */ | 262 | /* Only on am3517 */ |
244 | OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), | 263 | OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), |
@@ -259,7 +278,7 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { | |||
259 | static struct pdata_init pdata_quirks[] __initdata = { | 278 | static struct pdata_init pdata_quirks[] __initdata = { |
260 | #ifdef CONFIG_ARCH_OMAP3 | 279 | #ifdef CONFIG_ARCH_OMAP3 |
261 | { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, }, | 280 | { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, }, |
262 | { "nokia,omap3-n900", hsmmc2_internal_input_clk, }, | 281 | { "nokia,omap3-n900", nokia_n900_legacy_init, }, |
263 | { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, | 282 | { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, |
264 | { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, | 283 | { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, |
265 | { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, | 284 | { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, |
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c index 6334b96b4097..280f3c58abe5 100644 --- a/arch/arm/mach-omap2/prminst44xx.c +++ b/arch/arm/mach-omap2/prminst44xx.c | |||
@@ -183,11 +183,11 @@ void omap4_prminst_global_warm_sw_reset(void) | |||
183 | OMAP4_PRM_RSTCTRL_OFFSET); | 183 | OMAP4_PRM_RSTCTRL_OFFSET); |
184 | v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK; | 184 | v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK; |
185 | omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION, | 185 | omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION, |
186 | OMAP4430_PRM_DEVICE_INST, | 186 | dev_inst, |
187 | OMAP4_PRM_RSTCTRL_OFFSET); | 187 | OMAP4_PRM_RSTCTRL_OFFSET); |
188 | 188 | ||
189 | /* OCP barrier */ | 189 | /* OCP barrier */ |
190 | v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, | 190 | v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, |
191 | OMAP4430_PRM_DEVICE_INST, | 191 | dev_inst, |
192 | OMAP4_PRM_RSTCTRL_OFFSET); | 192 | OMAP4_PRM_RSTCTRL_OFFSET); |
193 | } | 193 | } |
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h index f33679d2d3ee..50e1d850ee2e 100644 --- a/arch/arm/mach-sa1100/include/mach/collie.h +++ b/arch/arm/mach-sa1100/include/mach/collie.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef __ASM_ARCH_COLLIE_H | 13 | #ifndef __ASM_ARCH_COLLIE_H |
14 | #define __ASM_ARCH_COLLIE_H | 14 | #define __ASM_ARCH_COLLIE_H |
15 | 15 | ||
16 | #include "hardware.h" /* Gives GPIO_MAX */ | ||
17 | |||
16 | extern void locomolcd_power(int on); | 18 | extern void locomolcd_power(int on); |
17 | 19 | ||
18 | #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) | 20 | #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) |
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c index 2b3a56414271..ef69152f9b52 100644 --- a/arch/arm/mm/dump.c +++ b/arch/arm/mm/dump.c | |||
@@ -264,6 +264,9 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) | |||
264 | note_page(st, addr, 3, pmd_val(*pmd)); | 264 | note_page(st, addr, 3, pmd_val(*pmd)); |
265 | else | 265 | else |
266 | walk_pte(st, pmd, addr); | 266 | walk_pte(st, pmd, addr); |
267 | |||
268 | if (SECTION_SIZE < PMD_SIZE && pmd_large(pmd[1])) | ||
269 | note_page(st, addr + SECTION_SIZE, 3, pmd_val(pmd[1])); | ||
267 | } | 270 | } |
268 | } | 271 | } |
269 | 272 | ||
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index 13fb0b3efc5f..453a179469a3 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h | |||
@@ -16,6 +16,8 @@ | |||
16 | #ifndef __ASM_PERCPU_H | 16 | #ifndef __ASM_PERCPU_H |
17 | #define __ASM_PERCPU_H | 17 | #define __ASM_PERCPU_H |
18 | 18 | ||
19 | #ifdef CONFIG_SMP | ||
20 | |||
19 | static inline void set_my_cpu_offset(unsigned long off) | 21 | static inline void set_my_cpu_offset(unsigned long off) |
20 | { | 22 | { |
21 | asm volatile("msr tpidr_el1, %0" :: "r" (off) : "memory"); | 23 | asm volatile("msr tpidr_el1, %0" :: "r" (off) : "memory"); |
@@ -36,6 +38,12 @@ static inline unsigned long __my_cpu_offset(void) | |||
36 | } | 38 | } |
37 | #define __my_cpu_offset __my_cpu_offset() | 39 | #define __my_cpu_offset __my_cpu_offset() |
38 | 40 | ||
41 | #else /* !CONFIG_SMP */ | ||
42 | |||
43 | #define set_my_cpu_offset(x) do { } while (0) | ||
44 | |||
45 | #endif /* CONFIG_SMP */ | ||
46 | |||
39 | #include <asm-generic/percpu.h> | 47 | #include <asm-generic/percpu.h> |
40 | 48 | ||
41 | #endif /* __ASM_PERCPU_H */ | 49 | #endif /* __ASM_PERCPU_H */ |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index b524dcd17243..aa3917c8b623 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -136,11 +136,11 @@ extern struct page *empty_zero_page; | |||
136 | /* | 136 | /* |
137 | * The following only work if pte_present(). Undefined behaviour otherwise. | 137 | * The following only work if pte_present(). Undefined behaviour otherwise. |
138 | */ | 138 | */ |
139 | #define pte_present(pte) (pte_val(pte) & (PTE_VALID | PTE_PROT_NONE)) | 139 | #define pte_present(pte) (!!(pte_val(pte) & (PTE_VALID | PTE_PROT_NONE))) |
140 | #define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY) | 140 | #define pte_dirty(pte) (!!(pte_val(pte) & PTE_DIRTY)) |
141 | #define pte_young(pte) (pte_val(pte) & PTE_AF) | 141 | #define pte_young(pte) (!!(pte_val(pte) & PTE_AF)) |
142 | #define pte_special(pte) (pte_val(pte) & PTE_SPECIAL) | 142 | #define pte_special(pte) (!!(pte_val(pte) & PTE_SPECIAL)) |
143 | #define pte_write(pte) (pte_val(pte) & PTE_WRITE) | 143 | #define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE)) |
144 | #define pte_exec(pte) (!(pte_val(pte) & PTE_UXN)) | 144 | #define pte_exec(pte) (!(pte_val(pte) & PTE_UXN)) |
145 | 145 | ||
146 | #define pte_valid_user(pte) \ | 146 | #define pte_valid_user(pte) \ |
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index c3b6c63ea5fb..38f0558f0c0a 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c | |||
@@ -48,7 +48,11 @@ int unwind_frame(struct stackframe *frame) | |||
48 | 48 | ||
49 | frame->sp = fp + 0x10; | 49 | frame->sp = fp + 0x10; |
50 | frame->fp = *(unsigned long *)(fp); | 50 | frame->fp = *(unsigned long *)(fp); |
51 | frame->pc = *(unsigned long *)(fp + 8); | 51 | /* |
52 | * -4 here because we care about the PC at time of bl, | ||
53 | * not where the return will go. | ||
54 | */ | ||
55 | frame->pc = *(unsigned long *)(fp + 8) - 4; | ||
52 | 56 | ||
53 | return 0; | 57 | return 0; |
54 | } | 58 | } |
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S index 3b47c36e10ff..2c56012cb2d2 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S | |||
@@ -694,6 +694,24 @@ __hyp_panic_str: | |||
694 | 694 | ||
695 | .align 2 | 695 | .align 2 |
696 | 696 | ||
697 | /* | ||
698 | * u64 kvm_call_hyp(void *hypfn, ...); | ||
699 | * | ||
700 | * This is not really a variadic function in the classic C-way and care must | ||
701 | * be taken when calling this to ensure parameters are passed in registers | ||
702 | * only, since the stack will change between the caller and the callee. | ||
703 | * | ||
704 | * Call the function with the first argument containing a pointer to the | ||
705 | * function you wish to call in Hyp mode, and subsequent arguments will be | ||
706 | * passed as x0, x1, and x2 (a maximum of 3 arguments in addition to the | ||
707 | * function pointer can be passed). The function being called must be mapped | ||
708 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are | ||
709 | * passed in r0 and r1. | ||
710 | * | ||
711 | * A function pointer with a value of 0 has a special meaning, and is | ||
712 | * used to implement __hyp_get_vectors in the same way as in | ||
713 | * arch/arm64/kernel/hyp_stub.S. | ||
714 | */ | ||
697 | ENTRY(kvm_call_hyp) | 715 | ENTRY(kvm_call_hyp) |
698 | hvc #0 | 716 | hvc #0 |
699 | ret | 717 | ret |
@@ -737,7 +755,12 @@ el1_sync: // Guest trapped into EL2 | |||
737 | pop x2, x3 | 755 | pop x2, x3 |
738 | pop x0, x1 | 756 | pop x0, x1 |
739 | 757 | ||
740 | push lr, xzr | 758 | /* Check for __hyp_get_vectors */ |
759 | cbnz x0, 1f | ||
760 | mrs x0, vbar_el2 | ||
761 | b 2f | ||
762 | |||
763 | 1: push lr, xzr | ||
741 | 764 | ||
742 | /* | 765 | /* |
743 | * Compute the function address in EL2, and shuffle the parameters. | 766 | * Compute the function address in EL2, and shuffle the parameters. |
@@ -750,7 +773,7 @@ el1_sync: // Guest trapped into EL2 | |||
750 | blr lr | 773 | blr lr |
751 | 774 | ||
752 | pop lr, xzr | 775 | pop lr, xzr |
753 | eret | 776 | 2: eret |
754 | 777 | ||
755 | el1_trap: | 778 | el1_trap: |
756 | /* | 779 | /* |
diff --git a/arch/c6x/include/asm/cache.h b/arch/c6x/include/asm/cache.h index 09c5a0f5f4d1..86648c083bb4 100644 --- a/arch/c6x/include/asm/cache.h +++ b/arch/c6x/include/asm/cache.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define _ASM_C6X_CACHE_H | 12 | #define _ASM_C6X_CACHE_H |
13 | 13 | ||
14 | #include <linux/irqflags.h> | 14 | #include <linux/irqflags.h> |
15 | #include <linux/init.h> | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Cache line size | 18 | * Cache line size |
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h index 184066ceb1f6..053c17b36559 100644 --- a/arch/cris/include/asm/bitops.h +++ b/arch/cris/include/asm/bitops.h | |||
@@ -144,7 +144,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) | |||
144 | * definition, which doesn't have the same semantics. We don't want to | 144 | * definition, which doesn't have the same semantics. We don't want to |
145 | * use -fno-builtin, so just hide the name ffs. | 145 | * use -fno-builtin, so just hide the name ffs. |
146 | */ | 146 | */ |
147 | #define ffs kernel_ffs | 147 | #define ffs(x) kernel_ffs(x) |
148 | 148 | ||
149 | #include <asm-generic/bitops/fls.h> | 149 | #include <asm-generic/bitops/fls.h> |
150 | #include <asm-generic/bitops/__fls.h> | 150 | #include <asm-generic/bitops/__fls.h> |
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index a96bcf83a735..20e8a9b21d75 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c | |||
@@ -98,7 +98,7 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid) | |||
98 | /* attempt to allocate a granule's worth of cached memory pages */ | 98 | /* attempt to allocate a granule's worth of cached memory pages */ |
99 | 99 | ||
100 | page = alloc_pages_exact_node(nid, | 100 | page = alloc_pages_exact_node(nid, |
101 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 101 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
102 | IA64_GRANULE_SHIFT-PAGE_SHIFT); | 102 | IA64_GRANULE_SHIFT-PAGE_SHIFT); |
103 | if (!page) { | 103 | if (!page) { |
104 | mutex_unlock(&uc_pool->add_chunk_mutex); | 104 | mutex_unlock(&uc_pool->add_chunk_mutex); |
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 7cc8c364924d..6fb9e813a910 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
@@ -1,4 +1,4 @@ | |||
1 | 1 | generic-y += barrier.h | |
2 | generic-y += bitsperlong.h | 2 | generic-y += bitsperlong.h |
3 | generic-y += clkdev.h | 3 | generic-y += clkdev.h |
4 | generic-y += cputime.h | 4 | generic-y += cputime.h |
@@ -6,6 +6,7 @@ generic-y += device.h | |||
6 | generic-y += emergency-restart.h | 6 | generic-y += emergency-restart.h |
7 | generic-y += errno.h | 7 | generic-y += errno.h |
8 | generic-y += exec.h | 8 | generic-y += exec.h |
9 | generic-y += hash.h | ||
9 | generic-y += hw_irq.h | 10 | generic-y += hw_irq.h |
10 | generic-y += ioctl.h | 11 | generic-y += ioctl.h |
11 | generic-y += ipcbuf.h | 12 | generic-y += ipcbuf.h |
@@ -18,6 +19,7 @@ generic-y += local.h | |||
18 | generic-y += mman.h | 19 | generic-y += mman.h |
19 | generic-y += mutex.h | 20 | generic-y += mutex.h |
20 | generic-y += percpu.h | 21 | generic-y += percpu.h |
22 | generic-y += preempt.h | ||
21 | generic-y += resource.h | 23 | generic-y += resource.h |
22 | generic-y += scatterlist.h | 24 | generic-y += scatterlist.h |
23 | generic-y += sections.h | 25 | generic-y += sections.h |
@@ -31,5 +33,3 @@ generic-y += trace_clock.h | |||
31 | generic-y += types.h | 33 | generic-y += types.h |
32 | generic-y += word-at-a-time.h | 34 | generic-y += word-at-a-time.h |
33 | generic-y += xor.h | 35 | generic-y += xor.h |
34 | generic-y += preempt.h | ||
35 | generic-y += hash.h | ||
diff --git a/arch/m68k/include/asm/barrier.h b/arch/m68k/include/asm/barrier.h deleted file mode 100644 index 15c5f77c1614..000000000000 --- a/arch/m68k/include/asm/barrier.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #ifndef _M68K_BARRIER_H | ||
2 | #define _M68K_BARRIER_H | ||
3 | |||
4 | #define nop() do { asm volatile ("nop"); barrier(); } while (0) | ||
5 | |||
6 | #include <asm-generic/barrier.h> | ||
7 | |||
8 | #endif /* _M68K_BARRIER_H */ | ||
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 014f288fc813..9d38b73989eb 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <uapi/asm/unistd.h> | 4 | #include <uapi/asm/unistd.h> |
5 | 5 | ||
6 | 6 | ||
7 | #define NR_syscalls 349 | 7 | #define NR_syscalls 351 |
8 | 8 | ||
9 | #define __ARCH_WANT_OLD_READDIR | 9 | #define __ARCH_WANT_OLD_READDIR |
10 | #define __ARCH_WANT_OLD_STAT | 10 | #define __ARCH_WANT_OLD_STAT |
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h index 625f321001dc..b932dd470041 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h | |||
@@ -354,5 +354,7 @@ | |||
354 | #define __NR_process_vm_writev 346 | 354 | #define __NR_process_vm_writev 346 |
355 | #define __NR_kcmp 347 | 355 | #define __NR_kcmp 347 |
356 | #define __NR_finit_module 348 | 356 | #define __NR_finit_module 348 |
357 | #define __NR_sched_setattr 349 | ||
358 | #define __NR_sched_getattr 350 | ||
357 | 359 | ||
358 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ | 360 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index 3f04ea0ab802..b6223dc41d82 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -369,4 +369,6 @@ ENTRY(sys_call_table) | |||
369 | .long sys_process_vm_writev | 369 | .long sys_process_vm_writev |
370 | .long sys_kcmp | 370 | .long sys_kcmp |
371 | .long sys_finit_module | 371 | .long sys_finit_module |
372 | .long sys_sched_setattr | ||
373 | .long sys_sched_getattr /* 350 */ | ||
372 | 374 | ||
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index dcae3a7035db..95fa1f1d5c8b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1776,12 +1776,12 @@ endchoice | |||
1776 | 1776 | ||
1777 | config FORCE_MAX_ZONEORDER | 1777 | config FORCE_MAX_ZONEORDER |
1778 | int "Maximum zone order" | 1778 | int "Maximum zone order" |
1779 | range 14 64 if HUGETLB_PAGE && PAGE_SIZE_64KB | 1779 | range 14 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB |
1780 | default "14" if HUGETLB_PAGE && PAGE_SIZE_64KB | 1780 | default "14" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB |
1781 | range 13 64 if HUGETLB_PAGE && PAGE_SIZE_32KB | 1781 | range 13 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB |
1782 | default "13" if HUGETLB_PAGE && PAGE_SIZE_32KB | 1782 | default "13" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB |
1783 | range 12 64 if HUGETLB_PAGE && PAGE_SIZE_16KB | 1783 | range 12 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB |
1784 | default "12" if HUGETLB_PAGE && PAGE_SIZE_16KB | 1784 | default "12" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB |
1785 | range 11 64 | 1785 | range 11 64 |
1786 | default "11" | 1786 | default "11" |
1787 | help | 1787 | help |
@@ -2353,9 +2353,8 @@ config SECCOMP | |||
2353 | If unsure, say Y. Only embedded should say N here. | 2353 | If unsure, say Y. Only embedded should say N here. |
2354 | 2354 | ||
2355 | config MIPS_O32_FP64_SUPPORT | 2355 | config MIPS_O32_FP64_SUPPORT |
2356 | bool "Support for O32 binaries using 64-bit FP" | 2356 | bool "Support for O32 binaries using 64-bit FP (EXPERIMENTAL)" |
2357 | depends on 32BIT || MIPS32_O32 | 2357 | depends on 32BIT || MIPS32_O32 |
2358 | default y | ||
2359 | help | 2358 | help |
2360 | When this is enabled, the kernel will support use of 64-bit floating | 2359 | When this is enabled, the kernel will support use of 64-bit floating |
2361 | point registers with binaries using the O32 ABI along with the | 2360 | point registers with binaries using the O32 ABI along with the |
@@ -2367,7 +2366,14 @@ config MIPS_O32_FP64_SUPPORT | |||
2367 | of your kernel & potentially improve FP emulation performance by | 2366 | of your kernel & potentially improve FP emulation performance by |
2368 | saying N here. | 2367 | saying N here. |
2369 | 2368 | ||
2370 | If unsure, say Y. | 2369 | Although binutils currently supports use of this flag the details |
2370 | concerning its effect upon the O32 ABI in userland are still being | ||
2371 | worked on. In order to avoid userland becoming dependant upon current | ||
2372 | behaviour before the details have been finalised, this option should | ||
2373 | be considered experimental and only enabled by those working upon | ||
2374 | said details. | ||
2375 | |||
2376 | If unsure, say N. | ||
2371 | 2377 | ||
2372 | config USE_OF | 2378 | config USE_OF |
2373 | bool | 2379 | bool |
diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c index 9edc35ff8cf1..acf9a2a37f5a 100644 --- a/arch/mips/alchemy/board-gpr.c +++ b/arch/mips/alchemy/board-gpr.c | |||
@@ -53,10 +53,8 @@ void __init prom_init(void) | |||
53 | prom_init_cmdline(); | 53 | prom_init_cmdline(); |
54 | 54 | ||
55 | memsize_str = prom_getenv("memsize"); | 55 | memsize_str = prom_getenv("memsize"); |
56 | if (!memsize_str) | 56 | if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) |
57 | memsize = 0x04000000; | 57 | memsize = 0x04000000; |
58 | else | ||
59 | strict_strtoul(memsize_str, 0, &memsize); | ||
60 | add_memory_region(0, memsize, BOOT_MEM_RAM); | 58 | add_memory_region(0, memsize, BOOT_MEM_RAM); |
61 | } | 59 | } |
62 | 60 | ||
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c index 9969dbab19e3..25a59a23547e 100644 --- a/arch/mips/alchemy/board-mtx1.c +++ b/arch/mips/alchemy/board-mtx1.c | |||
@@ -52,10 +52,8 @@ void __init prom_init(void) | |||
52 | prom_init_cmdline(); | 52 | prom_init_cmdline(); |
53 | 53 | ||
54 | memsize_str = prom_getenv("memsize"); | 54 | memsize_str = prom_getenv("memsize"); |
55 | if (!memsize_str) | 55 | if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) |
56 | memsize = 0x04000000; | 56 | memsize = 0x04000000; |
57 | else | ||
58 | strict_strtoul(memsize_str, 0, &memsize); | ||
59 | add_memory_region(0, memsize, BOOT_MEM_RAM); | 57 | add_memory_region(0, memsize, BOOT_MEM_RAM); |
60 | } | 58 | } |
61 | 59 | ||
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c index 6d612e2b949b..cdd8246f92b3 100644 --- a/arch/mips/bcm47xx/board.c +++ b/arch/mips/bcm47xx/board.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/errno.h> | ||
1 | #include <linux/export.h> | 2 | #include <linux/export.h> |
2 | #include <linux/string.h> | 3 | #include <linux/string.h> |
3 | #include <bcm47xx_board.h> | 4 | #include <bcm47xx_board.h> |
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c index 6decb27cf48b..2bed73a684ae 100644 --- a/arch/mips/bcm47xx/nvram.c +++ b/arch/mips/bcm47xx/nvram.c | |||
@@ -196,7 +196,7 @@ int bcm47xx_nvram_gpio_pin(const char *name) | |||
196 | char nvram_var[10]; | 196 | char nvram_var[10]; |
197 | char buf[30]; | 197 | char buf[30]; |
198 | 198 | ||
199 | for (i = 0; i < 16; i++) { | 199 | for (i = 0; i < 32; i++) { |
200 | err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i); | 200 | err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i); |
201 | if (err <= 0) | 201 | if (err <= 0) |
202 | continue; | 202 | continue; |
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 25fbfae06c1f..c2bb4f896ce7 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c | |||
@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d, | |||
975 | if (ciu > 1 || bit > 63) | 975 | if (ciu > 1 || bit > 63) |
976 | return -EINVAL; | 976 | return -EINVAL; |
977 | 977 | ||
978 | /* These are the GPIO lines */ | ||
979 | if (ciu == 0 && bit >= 16 && bit < 32) | ||
980 | return -EINVAL; | ||
981 | |||
982 | *out_hwirq = (ciu << 6) | bit; | 978 | *out_hwirq = (ciu << 6) | bit; |
983 | *out_type = 0; | 979 | *out_type = 0; |
984 | 980 | ||
@@ -1007,6 +1003,10 @@ static int octeon_irq_ciu_map(struct irq_domain *d, | |||
1007 | if (!octeon_irq_virq_in_range(virq)) | 1003 | if (!octeon_irq_virq_in_range(virq)) |
1008 | return -EINVAL; | 1004 | return -EINVAL; |
1009 | 1005 | ||
1006 | /* Don't map irq if it is reserved for GPIO. */ | ||
1007 | if (line == 0 && bit >= 16 && bit <32) | ||
1008 | return 0; | ||
1009 | |||
1010 | if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) | 1010 | if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) |
1011 | return -EINVAL; | 1011 | return -EINVAL; |
1012 | 1012 | ||
@@ -1525,10 +1525,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d, | |||
1525 | ciu = intspec[0]; | 1525 | ciu = intspec[0]; |
1526 | bit = intspec[1]; | 1526 | bit = intspec[1]; |
1527 | 1527 | ||
1528 | /* Line 7 are the GPIO lines */ | ||
1529 | if (ciu > 6 || bit > 63) | ||
1530 | return -EINVAL; | ||
1531 | |||
1532 | *out_hwirq = (ciu << 6) | bit; | 1528 | *out_hwirq = (ciu << 6) | bit; |
1533 | *out_type = 0; | 1529 | *out_type = 0; |
1534 | 1530 | ||
@@ -1570,8 +1566,14 @@ static int octeon_irq_ciu2_map(struct irq_domain *d, | |||
1570 | if (!octeon_irq_virq_in_range(virq)) | 1566 | if (!octeon_irq_virq_in_range(virq)) |
1571 | return -EINVAL; | 1567 | return -EINVAL; |
1572 | 1568 | ||
1573 | /* Line 7 are the GPIO lines */ | 1569 | /* |
1574 | if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0) | 1570 | * Don't map irq if it is reserved for GPIO. |
1571 | * (Line 7 are the GPIO lines.) | ||
1572 | */ | ||
1573 | if (line == 7) | ||
1574 | return 0; | ||
1575 | |||
1576 | if (line > 7 || octeon_irq_ciu_to_irq[line][bit] != 0) | ||
1575 | return -EINVAL; | 1577 | return -EINVAL; |
1576 | 1578 | ||
1577 | if (octeon_irq_ciu2_is_edge(line, bit)) | 1579 | if (octeon_irq_ciu2_is_edge(line, bit)) |
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h index 3220c93ea981..4225e99bd7bf 100644 --- a/arch/mips/include/asm/asmmacro.h +++ b/arch/mips/include/asm/asmmacro.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define _ASM_ASMMACRO_H | 9 | #define _ASM_ASMMACRO_H |
10 | 10 | ||
11 | #include <asm/hazards.h> | 11 | #include <asm/hazards.h> |
12 | #include <asm/asm-offsets.h> | ||
12 | 13 | ||
13 | #ifdef CONFIG_32BIT | 14 | #ifdef CONFIG_32BIT |
14 | #include <asm/asmmacro-32.h> | 15 | #include <asm/asmmacro-32.h> |
@@ -54,11 +55,21 @@ | |||
54 | .endm | 55 | .endm |
55 | 56 | ||
56 | .macro local_irq_disable reg=t0 | 57 | .macro local_irq_disable reg=t0 |
58 | #ifdef CONFIG_PREEMPT | ||
59 | lw \reg, TI_PRE_COUNT($28) | ||
60 | addi \reg, \reg, 1 | ||
61 | sw \reg, TI_PRE_COUNT($28) | ||
62 | #endif | ||
57 | mfc0 \reg, CP0_STATUS | 63 | mfc0 \reg, CP0_STATUS |
58 | ori \reg, \reg, 1 | 64 | ori \reg, \reg, 1 |
59 | xori \reg, \reg, 1 | 65 | xori \reg, \reg, 1 |
60 | mtc0 \reg, CP0_STATUS | 66 | mtc0 \reg, CP0_STATUS |
61 | irq_disable_hazard | 67 | irq_disable_hazard |
68 | #ifdef CONFIG_PREEMPT | ||
69 | lw \reg, TI_PRE_COUNT($28) | ||
70 | addi \reg, \reg, -1 | ||
71 | sw \reg, TI_PRE_COUNT($28) | ||
72 | #endif | ||
62 | .endm | 73 | .endm |
63 | #endif /* CONFIG_MIPS_MT_SMTC */ | 74 | #endif /* CONFIG_MIPS_MT_SMTC */ |
64 | 75 | ||
@@ -106,7 +117,7 @@ | |||
106 | .endm | 117 | .endm |
107 | 118 | ||
108 | .macro fpu_save_double thread status tmp | 119 | .macro fpu_save_double thread status tmp |
109 | #if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2) | 120 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
110 | sll \tmp, \status, 5 | 121 | sll \tmp, \status, 5 |
111 | bgez \tmp, 10f | 122 | bgez \tmp, 10f |
112 | fpu_save_16odd \thread | 123 | fpu_save_16odd \thread |
@@ -159,7 +170,7 @@ | |||
159 | .endm | 170 | .endm |
160 | 171 | ||
161 | .macro fpu_restore_double thread status tmp | 172 | .macro fpu_restore_double thread status tmp |
162 | #if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2) | 173 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
163 | sll \tmp, \status, 5 | 174 | sll \tmp, \status, 5 |
164 | bgez \tmp, 10f # 16 register mode? | 175 | bgez \tmp, 10f # 16 register mode? |
165 | 176 | ||
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index 6b9749540edf..58e50cbdb1a6 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
@@ -57,7 +57,7 @@ static inline int __enable_fpu(enum fpu_mode mode) | |||
57 | return 0; | 57 | return 0; |
58 | 58 | ||
59 | case FPU_64BIT: | 59 | case FPU_64BIT: |
60 | #if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_MIPS64)) | 60 | #if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_64BIT)) |
61 | /* we only have a 32-bit FPU */ | 61 | /* we only have a 32-bit FPU */ |
62 | return SIGFPE; | 62 | return SIGFPE; |
63 | #endif | 63 | #endif |
diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h index ce35c9af0c28..992aaba603b5 100644 --- a/arch/mips/include/asm/ftrace.h +++ b/arch/mips/include/asm/ftrace.h | |||
@@ -22,12 +22,12 @@ extern void _mcount(void); | |||
22 | #define safe_load(load, src, dst, error) \ | 22 | #define safe_load(load, src, dst, error) \ |
23 | do { \ | 23 | do { \ |
24 | asm volatile ( \ | 24 | asm volatile ( \ |
25 | "1: " load " %[" STR(dst) "], 0(%[" STR(src) "])\n"\ | 25 | "1: " load " %[tmp_dst], 0(%[tmp_src])\n" \ |
26 | " li %[" STR(error) "], 0\n" \ | 26 | " li %[tmp_err], 0\n" \ |
27 | "2:\n" \ | 27 | "2:\n" \ |
28 | \ | 28 | \ |
29 | ".section .fixup, \"ax\"\n" \ | 29 | ".section .fixup, \"ax\"\n" \ |
30 | "3: li %[" STR(error) "], 1\n" \ | 30 | "3: li %[tmp_err], 1\n" \ |
31 | " j 2b\n" \ | 31 | " j 2b\n" \ |
32 | ".previous\n" \ | 32 | ".previous\n" \ |
33 | \ | 33 | \ |
@@ -35,8 +35,8 @@ do { \ | |||
35 | STR(PTR) "\t1b, 3b\n\t" \ | 35 | STR(PTR) "\t1b, 3b\n\t" \ |
36 | ".previous\n" \ | 36 | ".previous\n" \ |
37 | \ | 37 | \ |
38 | : [dst] "=&r" (dst), [error] "=r" (error)\ | 38 | : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\ |
39 | : [src] "r" (src) \ | 39 | : [tmp_src] "r" (src) \ |
40 | : "memory" \ | 40 | : "memory" \ |
41 | ); \ | 41 | ); \ |
42 | } while (0) | 42 | } while (0) |
@@ -44,12 +44,12 @@ do { \ | |||
44 | #define safe_store(store, src, dst, error) \ | 44 | #define safe_store(store, src, dst, error) \ |
45 | do { \ | 45 | do { \ |
46 | asm volatile ( \ | 46 | asm volatile ( \ |
47 | "1: " store " %[" STR(src) "], 0(%[" STR(dst) "])\n"\ | 47 | "1: " store " %[tmp_src], 0(%[tmp_dst])\n"\ |
48 | " li %[" STR(error) "], 0\n" \ | 48 | " li %[tmp_err], 0\n" \ |
49 | "2:\n" \ | 49 | "2:\n" \ |
50 | \ | 50 | \ |
51 | ".section .fixup, \"ax\"\n" \ | 51 | ".section .fixup, \"ax\"\n" \ |
52 | "3: li %[" STR(error) "], 1\n" \ | 52 | "3: li %[tmp_err], 1\n" \ |
53 | " j 2b\n" \ | 53 | " j 2b\n" \ |
54 | ".previous\n" \ | 54 | ".previous\n" \ |
55 | \ | 55 | \ |
@@ -57,8 +57,8 @@ do { \ | |||
57 | STR(PTR) "\t1b, 3b\n\t" \ | 57 | STR(PTR) "\t1b, 3b\n\t" \ |
58 | ".previous\n" \ | 58 | ".previous\n" \ |
59 | \ | 59 | \ |
60 | : [error] "=r" (error) \ | 60 | : [tmp_err] "=r" (error) \ |
61 | : [dst] "r" (dst), [src] "r" (src)\ | 61 | : [tmp_dst] "r" (dst), [tmp_src] "r" (src)\ |
62 | : "memory" \ | 62 | : "memory" \ |
63 | ); \ | 63 | ); \ |
64 | } while (0) | 64 | } while (0) |
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h index 33e8dbfc1b63..f35b131977e6 100644 --- a/arch/mips/include/asm/syscall.h +++ b/arch/mips/include/asm/syscall.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef __ASM_MIPS_SYSCALL_H | 13 | #ifndef __ASM_MIPS_SYSCALL_H |
14 | #define __ASM_MIPS_SYSCALL_H | 14 | #define __ASM_MIPS_SYSCALL_H |
15 | 15 | ||
16 | #include <linux/compiler.h> | ||
16 | #include <linux/audit.h> | 17 | #include <linux/audit.h> |
17 | #include <linux/elf-em.h> | 18 | #include <linux/elf-em.h> |
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
@@ -39,14 +40,14 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg, | |||
39 | 40 | ||
40 | #ifdef CONFIG_32BIT | 41 | #ifdef CONFIG_32BIT |
41 | case 4: case 5: case 6: case 7: | 42 | case 4: case 5: case 6: case 7: |
42 | return get_user(*arg, (int *)usp + 4 * n); | 43 | return get_user(*arg, (int *)usp + n); |
43 | #endif | 44 | #endif |
44 | 45 | ||
45 | #ifdef CONFIG_64BIT | 46 | #ifdef CONFIG_64BIT |
46 | case 4: case 5: case 6: case 7: | 47 | case 4: case 5: case 6: case 7: |
47 | #ifdef CONFIG_MIPS32_O32 | 48 | #ifdef CONFIG_MIPS32_O32 |
48 | if (test_thread_flag(TIF_32BIT_REGS)) | 49 | if (test_thread_flag(TIF_32BIT_REGS)) |
49 | return get_user(*arg, (int *)usp + 4 * n); | 50 | return get_user(*arg, (int *)usp + n); |
50 | else | 51 | else |
51 | #endif | 52 | #endif |
52 | *arg = regs->regs[4 + n]; | 53 | *arg = regs->regs[4 + n]; |
@@ -57,6 +58,8 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg, | |||
57 | default: | 58 | default: |
58 | BUG(); | 59 | BUG(); |
59 | } | 60 | } |
61 | |||
62 | unreachable(); | ||
60 | } | 63 | } |
61 | 64 | ||
62 | static inline long syscall_get_return_value(struct task_struct *task, | 65 | static inline long syscall_get_return_value(struct task_struct *task, |
@@ -83,11 +86,10 @@ static inline void syscall_get_arguments(struct task_struct *task, | |||
83 | unsigned int i, unsigned int n, | 86 | unsigned int i, unsigned int n, |
84 | unsigned long *args) | 87 | unsigned long *args) |
85 | { | 88 | { |
86 | unsigned long arg; | ||
87 | int ret; | 89 | int ret; |
88 | 90 | ||
89 | while (n--) | 91 | while (n--) |
90 | ret |= mips_get_syscall_arg(&arg, task, regs, i++); | 92 | ret |= mips_get_syscall_arg(args++, task, regs, i++); |
91 | 93 | ||
92 | /* | 94 | /* |
93 | * No way to communicate an error because this is a void function. | 95 | * No way to communicate an error because this is a void function. |
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index b39ba25b41cc..f25181b19941 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h | |||
@@ -163,8 +163,8 @@ enum cop1_sdw_func { | |||
163 | */ | 163 | */ |
164 | enum cop1x_func { | 164 | enum cop1x_func { |
165 | lwxc1_op = 0x00, ldxc1_op = 0x01, | 165 | lwxc1_op = 0x00, ldxc1_op = 0x01, |
166 | pfetch_op = 0x07, swxc1_op = 0x08, | 166 | swxc1_op = 0x08, sdxc1_op = 0x09, |
167 | sdxc1_op = 0x09, madd_s_op = 0x20, | 167 | pfetch_op = 0x0f, madd_s_op = 0x20, |
168 | madd_d_op = 0x21, madd_e_op = 0x22, | 168 | madd_d_op = 0x21, madd_e_op = 0x22, |
169 | msub_s_op = 0x28, msub_d_op = 0x29, | 169 | msub_s_op = 0x28, msub_d_op = 0x29, |
170 | msub_e_op = 0x2a, nmadd_s_op = 0x30, | 170 | msub_e_op = 0x2a, nmadd_s_op = 0x30, |
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c index 185ba258361b..374ed74cd516 100644 --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c | |||
@@ -111,11 +111,10 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1, | |||
111 | safe_store_code(new_code1, ip, faulted); | 111 | safe_store_code(new_code1, ip, faulted); |
112 | if (unlikely(faulted)) | 112 | if (unlikely(faulted)) |
113 | return -EFAULT; | 113 | return -EFAULT; |
114 | ip += 4; | 114 | safe_store_code(new_code2, ip + 4, faulted); |
115 | safe_store_code(new_code2, ip, faulted); | ||
116 | if (unlikely(faulted)) | 115 | if (unlikely(faulted)) |
117 | return -EFAULT; | 116 | return -EFAULT; |
118 | flush_icache_range(ip, ip + 8); /* original ip + 12 */ | 117 | flush_icache_range(ip, ip + 8); |
119 | return 0; | 118 | return 0; |
120 | } | 119 | } |
121 | #endif | 120 | #endif |
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S index 253b2fb52026..73b0ddf910d4 100644 --- a/arch/mips/kernel/r4k_fpu.S +++ b/arch/mips/kernel/r4k_fpu.S | |||
@@ -35,9 +35,9 @@ | |||
35 | LEAF(_save_fp_context) | 35 | LEAF(_save_fp_context) |
36 | cfc1 t1, fcr31 | 36 | cfc1 t1, fcr31 |
37 | 37 | ||
38 | #if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) | 38 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
39 | .set push | 39 | .set push |
40 | #ifdef CONFIG_MIPS32_R2 | 40 | #ifdef CONFIG_CPU_MIPS32_R2 |
41 | .set mips64r2 | 41 | .set mips64r2 |
42 | mfc0 t0, CP0_STATUS | 42 | mfc0 t0, CP0_STATUS |
43 | sll t0, t0, 5 | 43 | sll t0, t0, 5 |
@@ -146,11 +146,11 @@ LEAF(_save_fp_context32) | |||
146 | * - cp1 status/control register | 146 | * - cp1 status/control register |
147 | */ | 147 | */ |
148 | LEAF(_restore_fp_context) | 148 | LEAF(_restore_fp_context) |
149 | EX lw t0, SC_FPC_CSR(a0) | 149 | EX lw t1, SC_FPC_CSR(a0) |
150 | 150 | ||
151 | #if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) | 151 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
152 | .set push | 152 | .set push |
153 | #ifdef CONFIG_MIPS32_R2 | 153 | #ifdef CONFIG_CPU_MIPS32_R2 |
154 | .set mips64r2 | 154 | .set mips64r2 |
155 | mfc0 t0, CP0_STATUS | 155 | mfc0 t0, CP0_STATUS |
156 | sll t0, t0, 5 | 156 | sll t0, t0, 5 |
@@ -191,7 +191,7 @@ LEAF(_restore_fp_context) | |||
191 | EX ldc1 $f26, SC_FPREGS+208(a0) | 191 | EX ldc1 $f26, SC_FPREGS+208(a0) |
192 | EX ldc1 $f28, SC_FPREGS+224(a0) | 192 | EX ldc1 $f28, SC_FPREGS+224(a0) |
193 | EX ldc1 $f30, SC_FPREGS+240(a0) | 193 | EX ldc1 $f30, SC_FPREGS+240(a0) |
194 | ctc1 t0, fcr31 | 194 | ctc1 t1, fcr31 |
195 | jr ra | 195 | jr ra |
196 | li v0, 0 # success | 196 | li v0, 0 # success |
197 | END(_restore_fp_context) | 197 | END(_restore_fp_context) |
@@ -199,7 +199,7 @@ LEAF(_restore_fp_context) | |||
199 | #ifdef CONFIG_MIPS32_COMPAT | 199 | #ifdef CONFIG_MIPS32_COMPAT |
200 | LEAF(_restore_fp_context32) | 200 | LEAF(_restore_fp_context32) |
201 | /* Restore an o32 sigcontext. */ | 201 | /* Restore an o32 sigcontext. */ |
202 | EX lw t0, SC32_FPC_CSR(a0) | 202 | EX lw t1, SC32_FPC_CSR(a0) |
203 | 203 | ||
204 | mfc0 t0, CP0_STATUS | 204 | mfc0 t0, CP0_STATUS |
205 | sll t0, t0, 5 | 205 | sll t0, t0, 5 |
@@ -239,7 +239,7 @@ LEAF(_restore_fp_context32) | |||
239 | EX ldc1 $f26, SC32_FPREGS+208(a0) | 239 | EX ldc1 $f26, SC32_FPREGS+208(a0) |
240 | EX ldc1 $f28, SC32_FPREGS+224(a0) | 240 | EX ldc1 $f28, SC32_FPREGS+224(a0) |
241 | EX ldc1 $f30, SC32_FPREGS+240(a0) | 241 | EX ldc1 $f30, SC32_FPREGS+240(a0) |
242 | ctc1 t0, fcr31 | 242 | ctc1 t1, fcr31 |
243 | jr ra | 243 | jr ra |
244 | li v0, 0 # success | 244 | li v0, 0 # success |
245 | END(_restore_fp_context32) | 245 | END(_restore_fp_context32) |
diff --git a/arch/mips/kernel/rtlx-cmp.c b/arch/mips/kernel/rtlx-cmp.c index 56dc69635153..758fb3cd2326 100644 --- a/arch/mips/kernel/rtlx-cmp.c +++ b/arch/mips/kernel/rtlx-cmp.c | |||
@@ -112,5 +112,8 @@ void __exit rtlx_module_exit(void) | |||
112 | 112 | ||
113 | for (i = 0; i < RTLX_CHANNELS; i++) | 113 | for (i = 0; i < RTLX_CHANNELS; i++) |
114 | device_destroy(mt_class, MKDEV(major, i)); | 114 | device_destroy(mt_class, MKDEV(major, i)); |
115 | |||
115 | unregister_chrdev(major, RTLX_MODULE_NAME); | 116 | unregister_chrdev(major, RTLX_MODULE_NAME); |
117 | |||
118 | aprp_hook = NULL; | ||
116 | } | 119 | } |
diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c index 91d61ba422b4..9c1aca00fd54 100644 --- a/arch/mips/kernel/rtlx-mt.c +++ b/arch/mips/kernel/rtlx-mt.c | |||
@@ -144,5 +144,8 @@ void __exit rtlx_module_exit(void) | |||
144 | 144 | ||
145 | for (i = 0; i < RTLX_CHANNELS; i++) | 145 | for (i = 0; i < RTLX_CHANNELS; i++) |
146 | device_destroy(mt_class, MKDEV(major, i)); | 146 | device_destroy(mt_class, MKDEV(major, i)); |
147 | |||
147 | unregister_chrdev(major, RTLX_MODULE_NAME); | 148 | unregister_chrdev(major, RTLX_MODULE_NAME); |
149 | |||
150 | aprp_hook = NULL; | ||
148 | } | 151 | } |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 506925b2c3f3..0b4e2e38294b 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -1538,10 +1538,10 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
1538 | break; | 1538 | break; |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | case 0x7: /* 7 */ | 1541 | case 0x3: |
1542 | if (MIPSInst_FUNC(ir) != pfetch_op) { | 1542 | if (MIPSInst_FUNC(ir) != pfetch_op) |
1543 | return SIGILL; | 1543 | return SIGILL; |
1544 | } | 1544 | |
1545 | /* ignore prefx operation */ | 1545 | /* ignore prefx operation */ |
1546 | break; | 1546 | break; |
1547 | 1547 | ||
diff --git a/arch/mips/mti-malta/malta-amon.c b/arch/mips/mti-malta/malta-amon.c index 592ac0427426..84ac523b0ce0 100644 --- a/arch/mips/mti-malta/malta-amon.c +++ b/arch/mips/mti-malta/malta-amon.c | |||
@@ -72,7 +72,7 @@ int amon_cpu_start(int cpu, | |||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
75 | #ifdef CONFIG_MIPS_VPE_LOADER | 75 | #ifdef CONFIG_MIPS_VPE_LOADER_CMP |
76 | int vpe_run(struct vpe *v) | 76 | int vpe_run(struct vpe *v) |
77 | { | 77 | { |
78 | struct vpe_notifications *n; | 78 | struct vpe_notifications *n; |
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index ca3e3a46a42f..2242181a6284 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
@@ -119,7 +119,7 @@ static void malta_hw0_irqdispatch(void) | |||
119 | 119 | ||
120 | do_IRQ(MALTA_INT_BASE + irq); | 120 | do_IRQ(MALTA_INT_BASE + irq); |
121 | 121 | ||
122 | #ifdef MIPS_VPE_APSP_API | 122 | #ifdef CONFIG_MIPS_VPE_APSP_API_MT |
123 | if (aprp_hook) | 123 | if (aprp_hook) |
124 | aprp_hook(); | 124 | aprp_hook(); |
125 | #endif | 125 | #endif |
@@ -310,7 +310,7 @@ static void ipi_call_dispatch(void) | |||
310 | 310 | ||
311 | static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) | 311 | static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) |
312 | { | 312 | { |
313 | #ifdef MIPS_VPE_APSP_API | 313 | #ifdef CONFIG_MIPS_VPE_APSP_API_CMP |
314 | if (aprp_hook) | 314 | if (aprp_hook) |
315 | aprp_hook(); | 315 | aprp_hook(); |
316 | #endif | 316 | #endif |
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c index d37be36dc659..2b91b0e61566 100644 --- a/arch/mips/pci/msi-octeon.c +++ b/arch/mips/pci/msi-octeon.c | |||
@@ -150,6 +150,7 @@ msi_irq_allocated: | |||
150 | msg.address_lo = | 150 | msg.address_lo = |
151 | ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff; | 151 | ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff; |
152 | msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32; | 152 | msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32; |
153 | break; | ||
153 | case OCTEON_DMA_BAR_TYPE_BIG: | 154 | case OCTEON_DMA_BAR_TYPE_BIG: |
154 | /* When using big bar, Bar 0 is based at 0 */ | 155 | /* When using big bar, Bar 0 is based at 0 */ |
155 | msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff; | 156 | msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff; |
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h index 637fe031aa84..60d5d174dfe4 100644 --- a/arch/parisc/include/asm/page.h +++ b/arch/parisc/include/asm/page.h | |||
@@ -32,17 +32,6 @@ void copy_page_asm(void *to, void *from); | |||
32 | void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | 32 | void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, |
33 | struct page *pg); | 33 | struct page *pg); |
34 | 34 | ||
35 | /* #define CONFIG_PARISC_TMPALIAS */ | ||
36 | |||
37 | #ifdef CONFIG_PARISC_TMPALIAS | ||
38 | void clear_user_highpage(struct page *page, unsigned long vaddr); | ||
39 | #define clear_user_highpage clear_user_highpage | ||
40 | struct vm_area_struct; | ||
41 | void copy_user_highpage(struct page *to, struct page *from, | ||
42 | unsigned long vaddr, struct vm_area_struct *vma); | ||
43 | #define __HAVE_ARCH_COPY_USER_HIGHPAGE | ||
44 | #endif | ||
45 | |||
46 | /* | 35 | /* |
47 | * These are used to make use of C type-checking.. | 36 | * These are used to make use of C type-checking.. |
48 | */ | 37 | */ |
diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h index 3516e0b27044..64f2992e439f 100644 --- a/arch/parisc/include/asm/spinlock.h +++ b/arch/parisc/include/asm/spinlock.h | |||
@@ -191,8 +191,4 @@ static __inline__ int arch_write_can_lock(arch_rwlock_t *rw) | |||
191 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) | 191 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) |
192 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) | 192 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) |
193 | 193 | ||
194 | #define arch_spin_relax(lock) cpu_relax() | ||
195 | #define arch_read_relax(lock) cpu_relax() | ||
196 | #define arch_write_relax(lock) cpu_relax() | ||
197 | |||
198 | #endif /* __ASM_SPINLOCK_H */ | 194 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h index 42706794a36f..265ae5190b0a 100644 --- a/arch/parisc/include/uapi/asm/unistd.h +++ b/arch/parisc/include/uapi/asm/unistd.h | |||
@@ -828,13 +828,13 @@ | |||
828 | #define __NR_finit_module (__NR_Linux + 333) | 828 | #define __NR_finit_module (__NR_Linux + 333) |
829 | #define __NR_sched_setattr (__NR_Linux + 334) | 829 | #define __NR_sched_setattr (__NR_Linux + 334) |
830 | #define __NR_sched_getattr (__NR_Linux + 335) | 830 | #define __NR_sched_getattr (__NR_Linux + 335) |
831 | #define __NR_utimes (__NR_Linux + 336) | ||
831 | 832 | ||
832 | #define __NR_Linux_syscalls (__NR_sched_getattr + 1) | 833 | #define __NR_Linux_syscalls (__NR_utimes + 1) |
833 | 834 | ||
834 | 835 | ||
835 | #define __IGNORE_select /* newselect */ | 836 | #define __IGNORE_select /* newselect */ |
836 | #define __IGNORE_fadvise64 /* fadvise64_64 */ | 837 | #define __IGNORE_fadvise64 /* fadvise64_64 */ |
837 | #define __IGNORE_utimes /* utime */ | ||
838 | 838 | ||
839 | 839 | ||
840 | #define HPUX_GATEWAY_ADDR 0xC0000004 | 840 | #define HPUX_GATEWAY_ADDR 0xC0000004 |
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index ac87a40502e6..a6ffc775a9f8 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c | |||
@@ -581,67 +581,3 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long | |||
581 | __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); | 581 | __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); |
582 | } | 582 | } |
583 | } | 583 | } |
584 | |||
585 | #ifdef CONFIG_PARISC_TMPALIAS | ||
586 | |||
587 | void clear_user_highpage(struct page *page, unsigned long vaddr) | ||
588 | { | ||
589 | void *vto; | ||
590 | unsigned long flags; | ||
591 | |||
592 | /* Clear using TMPALIAS region. The page doesn't need to | ||
593 | be flushed but the kernel mapping needs to be purged. */ | ||
594 | |||
595 | vto = kmap_atomic(page); | ||
596 | |||
597 | /* The PA-RISC 2.0 Architecture book states on page F-6: | ||
598 | "Before a write-capable translation is enabled, *all* | ||
599 | non-equivalently-aliased translations must be removed | ||
600 | from the page table and purged from the TLB. (Note | ||
601 | that the caches are not required to be flushed at this | ||
602 | time.) Before any non-equivalent aliased translation | ||
603 | is re-enabled, the virtual address range for the writeable | ||
604 | page (the entire page) must be flushed from the cache, | ||
605 | and the write-capable translation removed from the page | ||
606 | table and purged from the TLB." */ | ||
607 | |||
608 | purge_kernel_dcache_page_asm((unsigned long)vto); | ||
609 | purge_tlb_start(flags); | ||
610 | pdtlb_kernel(vto); | ||
611 | purge_tlb_end(flags); | ||
612 | preempt_disable(); | ||
613 | clear_user_page_asm(vto, vaddr); | ||
614 | preempt_enable(); | ||
615 | |||
616 | pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */ | ||
617 | } | ||
618 | |||
619 | void copy_user_highpage(struct page *to, struct page *from, | ||
620 | unsigned long vaddr, struct vm_area_struct *vma) | ||
621 | { | ||
622 | void *vfrom, *vto; | ||
623 | unsigned long flags; | ||
624 | |||
625 | /* Copy using TMPALIAS region. This has the advantage | ||
626 | that the `from' page doesn't need to be flushed. However, | ||
627 | the `to' page must be flushed in copy_user_page_asm since | ||
628 | it can be used to bring in executable code. */ | ||
629 | |||
630 | vfrom = kmap_atomic(from); | ||
631 | vto = kmap_atomic(to); | ||
632 | |||
633 | purge_kernel_dcache_page_asm((unsigned long)vto); | ||
634 | purge_tlb_start(flags); | ||
635 | pdtlb_kernel(vto); | ||
636 | pdtlb_kernel(vfrom); | ||
637 | purge_tlb_end(flags); | ||
638 | preempt_disable(); | ||
639 | copy_user_page_asm(vto, vfrom, vaddr); | ||
640 | flush_dcache_page_asm(__pa(vto), vaddr); | ||
641 | preempt_enable(); | ||
642 | |||
643 | pagefault_enable(); /* kunmap_atomic(addr, KM_USER1); */ | ||
644 | pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */ | ||
645 | } | ||
646 | |||
647 | #endif /* CONFIG_PARISC_TMPALIAS */ | ||
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 8fa3fbb3e4d3..80e5dd248934 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -431,6 +431,7 @@ | |||
431 | ENTRY_SAME(finit_module) | 431 | ENTRY_SAME(finit_module) |
432 | ENTRY_SAME(sched_setattr) | 432 | ENTRY_SAME(sched_setattr) |
433 | ENTRY_SAME(sched_getattr) /* 335 */ | 433 | ENTRY_SAME(sched_getattr) /* 335 */ |
434 | ENTRY_COMP(utimes) | ||
434 | 435 | ||
435 | /* Nothing yet */ | 436 | /* Nothing yet */ |
436 | 437 | ||
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index 84fdf6857c31..a613d2c82fd9 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h | |||
@@ -200,10 +200,11 @@ static inline void __user *arch_compat_alloc_user_space(long len) | |||
200 | 200 | ||
201 | /* | 201 | /* |
202 | * We can't access below the stack pointer in the 32bit ABI and | 202 | * We can't access below the stack pointer in the 32bit ABI and |
203 | * can access 288 bytes in the 64bit ABI | 203 | * can access 288 bytes in the 64bit big-endian ABI, |
204 | * or 512 bytes with the new ELFv2 little-endian ABI. | ||
204 | */ | 205 | */ |
205 | if (!is_32bit_task()) | 206 | if (!is_32bit_task()) |
206 | usp -= 288; | 207 | usp -= USER_REDZONE_SIZE; |
207 | 208 | ||
208 | return (void __user *) (usp - len); | 209 | return (void __user *) (usp - len); |
209 | } | 210 | } |
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 40157e2ca691..ed82142a3251 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -816,8 +816,8 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, | |||
816 | int64_t opal_pci_poll(uint64_t phb_id); | 816 | int64_t opal_pci_poll(uint64_t phb_id); |
817 | int64_t opal_return_cpu(void); | 817 | int64_t opal_return_cpu(void); |
818 | 818 | ||
819 | int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, __be64 *val); | 819 | int64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val); |
820 | int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val); | 820 | int64_t opal_xscom_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val); |
821 | 821 | ||
822 | int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, | 822 | int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, |
823 | uint32_t addr, uint32_t data, uint32_t sz); | 823 | uint32_t addr, uint32_t data, uint32_t sz); |
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index becc08e6a65c..279b80f3bb29 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h | |||
@@ -28,11 +28,23 @@ | |||
28 | 28 | ||
29 | #ifdef __powerpc64__ | 29 | #ifdef __powerpc64__ |
30 | 30 | ||
31 | /* | ||
32 | * Size of redzone that userspace is allowed to use below the stack | ||
33 | * pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in | ||
34 | * the new ELFv2 little-endian ABI, so we allow the larger amount. | ||
35 | * | ||
36 | * For kernel code we allow a 288-byte redzone, in order to conserve | ||
37 | * kernel stack space; gcc currently only uses 288 bytes, and will | ||
38 | * hopefully allow explicit control of the redzone size in future. | ||
39 | */ | ||
40 | #define USER_REDZONE_SIZE 512 | ||
41 | #define KERNEL_REDZONE_SIZE 288 | ||
42 | |||
31 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ | 43 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ |
32 | #define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */ | 44 | #define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */ |
33 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265) | 45 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265) |
34 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \ | 46 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \ |
35 | STACK_FRAME_OVERHEAD + 288) | 47 | STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) |
36 | #define STACK_FRAME_MARKER 12 | 48 | #define STACK_FRAME_MARKER 12 |
37 | 49 | ||
38 | /* Size of dummy stack frame allocated when calling signal handler. */ | 50 | /* Size of dummy stack frame allocated when calling signal handler. */ |
@@ -41,6 +53,8 @@ | |||
41 | 53 | ||
42 | #else /* __powerpc64__ */ | 54 | #else /* __powerpc64__ */ |
43 | 55 | ||
56 | #define USER_REDZONE_SIZE 0 | ||
57 | #define KERNEL_REDZONE_SIZE 0 | ||
44 | #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ | 58 | #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ |
45 | #define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */ | 59 | #define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */ |
46 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) | 60 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 11c1d069d920..7a13f378ca2c 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -98,17 +98,19 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, | |||
98 | size_t csize, unsigned long offset, int userbuf) | 98 | size_t csize, unsigned long offset, int userbuf) |
99 | { | 99 | { |
100 | void *vaddr; | 100 | void *vaddr; |
101 | phys_addr_t paddr; | ||
101 | 102 | ||
102 | if (!csize) | 103 | if (!csize) |
103 | return 0; | 104 | return 0; |
104 | 105 | ||
105 | csize = min_t(size_t, csize, PAGE_SIZE); | 106 | csize = min_t(size_t, csize, PAGE_SIZE); |
107 | paddr = pfn << PAGE_SHIFT; | ||
106 | 108 | ||
107 | if ((min_low_pfn < pfn) && (pfn < max_pfn)) { | 109 | if (memblock_is_region_memory(paddr, csize)) { |
108 | vaddr = __va(pfn << PAGE_SHIFT); | 110 | vaddr = __va(paddr); |
109 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); | 111 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); |
110 | } else { | 112 | } else { |
111 | vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0); | 113 | vaddr = __ioremap(paddr, PAGE_SIZE, 0); |
112 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); | 114 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); |
113 | iounmap(vaddr); | 115 | iounmap(vaddr); |
114 | } | 116 | } |
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 9b27b293a922..b0ded97ee4e1 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
@@ -74,6 +74,7 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new) | |||
74 | */ | 74 | */ |
75 | static int test_24bit_addr(unsigned long ip, unsigned long addr) | 75 | static int test_24bit_addr(unsigned long ip, unsigned long addr) |
76 | { | 76 | { |
77 | addr = ppc_function_entry((void *)addr); | ||
77 | 78 | ||
78 | /* use the create_branch to verify that this offset can be branched */ | 79 | /* use the create_branch to verify that this offset can be branched */ |
79 | return create_branch((unsigned int *)ip, addr, 0); | 80 | return create_branch((unsigned int *)ip, addr, 0); |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 8d4c247f1738..af064d28b365 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -1048,6 +1048,15 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
1048 | flush_altivec_to_thread(src); | 1048 | flush_altivec_to_thread(src); |
1049 | flush_vsx_to_thread(src); | 1049 | flush_vsx_to_thread(src); |
1050 | flush_spe_to_thread(src); | 1050 | flush_spe_to_thread(src); |
1051 | /* | ||
1052 | * Flush TM state out so we can copy it. __switch_to_tm() does this | ||
1053 | * flush but it removes the checkpointed state from the current CPU and | ||
1054 | * transitions the CPU out of TM mode. Hence we need to call | ||
1055 | * tm_recheckpoint_new_task() (on the same task) to restore the | ||
1056 | * checkpointed state back and the TM mode. | ||
1057 | */ | ||
1058 | __switch_to_tm(src); | ||
1059 | tm_recheckpoint_new_task(src); | ||
1051 | 1060 | ||
1052 | *dst = *src; | 1061 | *dst = *src; |
1053 | 1062 | ||
diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S index 1482327cfeba..d88736fbece6 100644 --- a/arch/powerpc/kernel/reloc_64.S +++ b/arch/powerpc/kernel/reloc_64.S | |||
@@ -81,6 +81,7 @@ _GLOBAL(relocate) | |||
81 | 81 | ||
82 | 6: blr | 82 | 6: blr |
83 | 83 | ||
84 | .balign 8 | ||
84 | p_dyn: .llong __dynamic_start - 0b | 85 | p_dyn: .llong __dynamic_start - 0b |
85 | p_rela: .llong __rela_dyn_start - 0b | 86 | p_rela: .llong __rela_dyn_start - 0b |
86 | p_st: .llong _stext - 0b | 87 | p_st: .llong _stext - 0b |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index e35bf773df7a..8d253c29649b 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -65,8 +65,8 @@ struct rt_sigframe { | |||
65 | struct siginfo __user *pinfo; | 65 | struct siginfo __user *pinfo; |
66 | void __user *puc; | 66 | void __user *puc; |
67 | struct siginfo info; | 67 | struct siginfo info; |
68 | /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ | 68 | /* New 64 bit little-endian ABI allows redzone of 512 bytes below sp */ |
69 | char abigap[288]; | 69 | char abigap[USER_REDZONE_SIZE]; |
70 | } __attribute__ ((aligned (16))); | 70 | } __attribute__ ((aligned (16))); |
71 | 71 | ||
72 | static const char fmt32[] = KERN_INFO \ | 72 | static const char fmt32[] = KERN_INFO \ |
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index e66d4ec04d95..818dce344e82 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -1504,73 +1504,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |||
1504 | 1: addi r8,r8,16 | 1504 | 1: addi r8,r8,16 |
1505 | .endr | 1505 | .endr |
1506 | 1506 | ||
1507 | /* Save DEC */ | ||
1508 | mfspr r5,SPRN_DEC | ||
1509 | mftb r6 | ||
1510 | extsw r5,r5 | ||
1511 | add r5,r5,r6 | ||
1512 | std r5,VCPU_DEC_EXPIRES(r9) | ||
1513 | |||
1514 | BEGIN_FTR_SECTION | ||
1515 | b 8f | ||
1516 | END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) | ||
1517 | /* Turn on TM so we can access TFHAR/TFIAR/TEXASR */ | ||
1518 | mfmsr r8 | ||
1519 | li r0, 1 | ||
1520 | rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG | ||
1521 | mtmsrd r8 | ||
1522 | |||
1523 | /* Save POWER8-specific registers */ | ||
1524 | mfspr r5, SPRN_IAMR | ||
1525 | mfspr r6, SPRN_PSPB | ||
1526 | mfspr r7, SPRN_FSCR | ||
1527 | std r5, VCPU_IAMR(r9) | ||
1528 | stw r6, VCPU_PSPB(r9) | ||
1529 | std r7, VCPU_FSCR(r9) | ||
1530 | mfspr r5, SPRN_IC | ||
1531 | mfspr r6, SPRN_VTB | ||
1532 | mfspr r7, SPRN_TAR | ||
1533 | std r5, VCPU_IC(r9) | ||
1534 | std r6, VCPU_VTB(r9) | ||
1535 | std r7, VCPU_TAR(r9) | ||
1536 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | ||
1537 | mfspr r5, SPRN_TFHAR | ||
1538 | mfspr r6, SPRN_TFIAR | ||
1539 | mfspr r7, SPRN_TEXASR | ||
1540 | std r5, VCPU_TFHAR(r9) | ||
1541 | std r6, VCPU_TFIAR(r9) | ||
1542 | std r7, VCPU_TEXASR(r9) | ||
1543 | #endif | ||
1544 | mfspr r8, SPRN_EBBHR | ||
1545 | std r8, VCPU_EBBHR(r9) | ||
1546 | mfspr r5, SPRN_EBBRR | ||
1547 | mfspr r6, SPRN_BESCR | ||
1548 | mfspr r7, SPRN_CSIGR | ||
1549 | mfspr r8, SPRN_TACR | ||
1550 | std r5, VCPU_EBBRR(r9) | ||
1551 | std r6, VCPU_BESCR(r9) | ||
1552 | std r7, VCPU_CSIGR(r9) | ||
1553 | std r8, VCPU_TACR(r9) | ||
1554 | mfspr r5, SPRN_TCSCR | ||
1555 | mfspr r6, SPRN_ACOP | ||
1556 | mfspr r7, SPRN_PID | ||
1557 | mfspr r8, SPRN_WORT | ||
1558 | std r5, VCPU_TCSCR(r9) | ||
1559 | std r6, VCPU_ACOP(r9) | ||
1560 | stw r7, VCPU_GUEST_PID(r9) | ||
1561 | std r8, VCPU_WORT(r9) | ||
1562 | 8: | ||
1563 | |||
1564 | /* Save and reset AMR and UAMOR before turning on the MMU */ | ||
1565 | BEGIN_FTR_SECTION | ||
1566 | mfspr r5,SPRN_AMR | ||
1567 | mfspr r6,SPRN_UAMOR | ||
1568 | std r5,VCPU_AMR(r9) | ||
1569 | std r6,VCPU_UAMOR(r9) | ||
1570 | li r6,0 | ||
1571 | mtspr SPRN_AMR,r6 | ||
1572 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) | ||
1573 | |||
1574 | /* Unset guest mode */ | 1507 | /* Unset guest mode */ |
1575 | li r0, KVM_GUEST_MODE_NONE | 1508 | li r0, KVM_GUEST_MODE_NONE |
1576 | stb r0, HSTATE_IN_GUEST(r13) | 1509 | stb r0, HSTATE_IN_GUEST(r13) |
@@ -2203,7 +2136,7 @@ BEGIN_FTR_SECTION | |||
2203 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) | 2136 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) |
2204 | #endif | 2137 | #endif |
2205 | mfspr r6,SPRN_VRSAVE | 2138 | mfspr r6,SPRN_VRSAVE |
2206 | stw r6,VCPU_VRSAVE(r3) | 2139 | stw r6,VCPU_VRSAVE(r31) |
2207 | mtlr r30 | 2140 | mtlr r30 |
2208 | mtmsrd r5 | 2141 | mtmsrd r5 |
2209 | isync | 2142 | isync |
@@ -2240,7 +2173,7 @@ BEGIN_FTR_SECTION | |||
2240 | bl .load_vr_state | 2173 | bl .load_vr_state |
2241 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) | 2174 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) |
2242 | #endif | 2175 | #endif |
2243 | lwz r7,VCPU_VRSAVE(r4) | 2176 | lwz r7,VCPU_VRSAVE(r31) |
2244 | mtspr SPRN_VRSAVE,r7 | 2177 | mtspr SPRN_VRSAVE,r7 |
2245 | mtlr r30 | 2178 | mtlr r30 |
2246 | mr r4,r31 | 2179 | mr r4,r31 |
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c index 5ec1e47a0d77..e865d748179b 100644 --- a/arch/powerpc/platforms/cell/ras.c +++ b/arch/powerpc/platforms/cell/ras.c | |||
@@ -123,7 +123,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order) | |||
123 | 123 | ||
124 | area->nid = nid; | 124 | area->nid = nid; |
125 | area->order = order; | 125 | area->order = order; |
126 | area->pages = alloc_pages_exact_node(area->nid, GFP_KERNEL|GFP_THISNODE, | 126 | area->pages = alloc_pages_exact_node(area->nid, |
127 | GFP_KERNEL|__GFP_THISNODE, | ||
127 | area->order); | 128 | area->order); |
128 | 129 | ||
129 | if (!area->pages) { | 130 | if (!area->pages) { |
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c index f51474336460..253fefe3d1a0 100644 --- a/arch/powerpc/platforms/powernv/eeh-ioda.c +++ b/arch/powerpc/platforms/powernv/eeh-ioda.c | |||
@@ -114,6 +114,7 @@ DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get, | |||
114 | ioda_eeh_inbB_dbgfs_set, "0x%llx\n"); | 114 | ioda_eeh_inbB_dbgfs_set, "0x%llx\n"); |
115 | #endif /* CONFIG_DEBUG_FS */ | 115 | #endif /* CONFIG_DEBUG_FS */ |
116 | 116 | ||
117 | |||
117 | /** | 118 | /** |
118 | * ioda_eeh_post_init - Chip dependent post initialization | 119 | * ioda_eeh_post_init - Chip dependent post initialization |
119 | * @hose: PCI controller | 120 | * @hose: PCI controller |
@@ -221,6 +222,22 @@ static int ioda_eeh_set_option(struct eeh_pe *pe, int option) | |||
221 | return ret; | 222 | return ret; |
222 | } | 223 | } |
223 | 224 | ||
225 | static void ioda_eeh_phb_diag(struct pci_controller *hose) | ||
226 | { | ||
227 | struct pnv_phb *phb = hose->private_data; | ||
228 | long rc; | ||
229 | |||
230 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, | ||
231 | PNV_PCI_DIAG_BUF_SIZE); | ||
232 | if (rc != OPAL_SUCCESS) { | ||
233 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", | ||
234 | __func__, hose->global_number, rc); | ||
235 | return; | ||
236 | } | ||
237 | |||
238 | pnv_pci_dump_phb_diag_data(hose, phb->diag.blob); | ||
239 | } | ||
240 | |||
224 | /** | 241 | /** |
225 | * ioda_eeh_get_state - Retrieve the state of PE | 242 | * ioda_eeh_get_state - Retrieve the state of PE |
226 | * @pe: EEH PE | 243 | * @pe: EEH PE |
@@ -272,6 +289,9 @@ static int ioda_eeh_get_state(struct eeh_pe *pe) | |||
272 | result |= EEH_STATE_DMA_ACTIVE; | 289 | result |= EEH_STATE_DMA_ACTIVE; |
273 | result |= EEH_STATE_MMIO_ENABLED; | 290 | result |= EEH_STATE_MMIO_ENABLED; |
274 | result |= EEH_STATE_DMA_ENABLED; | 291 | result |= EEH_STATE_DMA_ENABLED; |
292 | } else if (!(pe->state & EEH_PE_ISOLATED)) { | ||
293 | eeh_pe_state_mark(pe, EEH_PE_ISOLATED); | ||
294 | ioda_eeh_phb_diag(hose); | ||
275 | } | 295 | } |
276 | 296 | ||
277 | return result; | 297 | return result; |
@@ -315,6 +335,15 @@ static int ioda_eeh_get_state(struct eeh_pe *pe) | |||
315 | __func__, fstate, hose->global_number, pe_no); | 335 | __func__, fstate, hose->global_number, pe_no); |
316 | } | 336 | } |
317 | 337 | ||
338 | /* Dump PHB diag-data for frozen PE */ | ||
339 | if (result != EEH_STATE_NOT_SUPPORT && | ||
340 | (result & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) != | ||
341 | (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE) && | ||
342 | !(pe->state & EEH_PE_ISOLATED)) { | ||
343 | eeh_pe_state_mark(pe, EEH_PE_ISOLATED); | ||
344 | ioda_eeh_phb_diag(hose); | ||
345 | } | ||
346 | |||
318 | return result; | 347 | return result; |
319 | } | 348 | } |
320 | 349 | ||
@@ -530,42 +559,6 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option) | |||
530 | } | 559 | } |
531 | 560 | ||
532 | /** | 561 | /** |
533 | * ioda_eeh_get_log - Retrieve error log | ||
534 | * @pe: EEH PE | ||
535 | * @severity: Severity level of the log | ||
536 | * @drv_log: buffer to store the log | ||
537 | * @len: space of the log buffer | ||
538 | * | ||
539 | * The function is used to retrieve error log from P7IOC. | ||
540 | */ | ||
541 | static int ioda_eeh_get_log(struct eeh_pe *pe, int severity, | ||
542 | char *drv_log, unsigned long len) | ||
543 | { | ||
544 | s64 ret; | ||
545 | unsigned long flags; | ||
546 | struct pci_controller *hose = pe->phb; | ||
547 | struct pnv_phb *phb = hose->private_data; | ||
548 | |||
549 | spin_lock_irqsave(&phb->lock, flags); | ||
550 | |||
551 | ret = opal_pci_get_phb_diag_data2(phb->opal_id, | ||
552 | phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE); | ||
553 | if (ret) { | ||
554 | spin_unlock_irqrestore(&phb->lock, flags); | ||
555 | pr_warning("%s: Can't get log for PHB#%x-PE#%x (%lld)\n", | ||
556 | __func__, hose->global_number, pe->addr, ret); | ||
557 | return -EIO; | ||
558 | } | ||
559 | |||
560 | /* The PHB diag-data is always indicative */ | ||
561 | pnv_pci_dump_phb_diag_data(hose, phb->diag.blob); | ||
562 | |||
563 | spin_unlock_irqrestore(&phb->lock, flags); | ||
564 | |||
565 | return 0; | ||
566 | } | ||
567 | |||
568 | /** | ||
569 | * ioda_eeh_configure_bridge - Configure the PCI bridges for the indicated PE | 562 | * ioda_eeh_configure_bridge - Configure the PCI bridges for the indicated PE |
570 | * @pe: EEH PE | 563 | * @pe: EEH PE |
571 | * | 564 | * |
@@ -646,22 +639,6 @@ static void ioda_eeh_hub_diag(struct pci_controller *hose) | |||
646 | } | 639 | } |
647 | } | 640 | } |
648 | 641 | ||
649 | static void ioda_eeh_phb_diag(struct pci_controller *hose) | ||
650 | { | ||
651 | struct pnv_phb *phb = hose->private_data; | ||
652 | long rc; | ||
653 | |||
654 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, | ||
655 | PNV_PCI_DIAG_BUF_SIZE); | ||
656 | if (rc != OPAL_SUCCESS) { | ||
657 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", | ||
658 | __func__, hose->global_number, rc); | ||
659 | return; | ||
660 | } | ||
661 | |||
662 | pnv_pci_dump_phb_diag_data(hose, phb->diag.blob); | ||
663 | } | ||
664 | |||
665 | static int ioda_eeh_get_phb_pe(struct pci_controller *hose, | 642 | static int ioda_eeh_get_phb_pe(struct pci_controller *hose, |
666 | struct eeh_pe **pe) | 643 | struct eeh_pe **pe) |
667 | { | 644 | { |
@@ -835,6 +812,20 @@ static int ioda_eeh_next_error(struct eeh_pe **pe) | |||
835 | } | 812 | } |
836 | 813 | ||
837 | /* | 814 | /* |
815 | * EEH core will try recover from fenced PHB or | ||
816 | * frozen PE. In the time for frozen PE, EEH core | ||
817 | * enable IO path for that before collecting logs, | ||
818 | * but it ruins the site. So we have to dump the | ||
819 | * log in advance here. | ||
820 | */ | ||
821 | if ((ret == EEH_NEXT_ERR_FROZEN_PE || | ||
822 | ret == EEH_NEXT_ERR_FENCED_PHB) && | ||
823 | !((*pe)->state & EEH_PE_ISOLATED)) { | ||
824 | eeh_pe_state_mark(*pe, EEH_PE_ISOLATED); | ||
825 | ioda_eeh_phb_diag(hose); | ||
826 | } | ||
827 | |||
828 | /* | ||
838 | * If we have no errors on the specific PHB or only | 829 | * If we have no errors on the specific PHB or only |
839 | * informative error there, we continue poking it. | 830 | * informative error there, we continue poking it. |
840 | * Otherwise, we need actions to be taken by upper | 831 | * Otherwise, we need actions to be taken by upper |
@@ -852,7 +843,6 @@ struct pnv_eeh_ops ioda_eeh_ops = { | |||
852 | .set_option = ioda_eeh_set_option, | 843 | .set_option = ioda_eeh_set_option, |
853 | .get_state = ioda_eeh_get_state, | 844 | .get_state = ioda_eeh_get_state, |
854 | .reset = ioda_eeh_reset, | 845 | .reset = ioda_eeh_reset, |
855 | .get_log = ioda_eeh_get_log, | ||
856 | .configure_bridge = ioda_eeh_configure_bridge, | 846 | .configure_bridge = ioda_eeh_configure_bridge, |
857 | .next_error = ioda_eeh_next_error | 847 | .next_error = ioda_eeh_next_error |
858 | }; | 848 | }; |
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c index 4fbf276ac99e..4cd2ea6c0dbe 100644 --- a/arch/powerpc/platforms/powernv/opal-xscom.c +++ b/arch/powerpc/platforms/powernv/opal-xscom.c | |||
@@ -71,11 +71,11 @@ static int opal_xscom_err_xlate(int64_t rc) | |||
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | static u64 opal_scom_unmangle(u64 reg) | 74 | static u64 opal_scom_unmangle(u64 addr) |
75 | { | 75 | { |
76 | /* | 76 | /* |
77 | * XSCOM indirect addresses have the top bit set. Additionally | 77 | * XSCOM indirect addresses have the top bit set. Additionally |
78 | * the reset of the top 3 nibbles is always 0. | 78 | * the rest of the top 3 nibbles is always 0. |
79 | * | 79 | * |
80 | * Because the debugfs interface uses signed offsets and shifts | 80 | * Because the debugfs interface uses signed offsets and shifts |
81 | * the address left by 3, we basically cannot use the top 4 bits | 81 | * the address left by 3, we basically cannot use the top 4 bits |
@@ -86,10 +86,13 @@ static u64 opal_scom_unmangle(u64 reg) | |||
86 | * conversion here. To leave room for further xscom address | 86 | * conversion here. To leave room for further xscom address |
87 | * expansion, we only clear out the top byte | 87 | * expansion, we only clear out the top byte |
88 | * | 88 | * |
89 | * For in-kernel use, we also support the real indirect bit, so | ||
90 | * we test for any of the top 5 bits | ||
91 | * | ||
89 | */ | 92 | */ |
90 | if (reg & (1ull << 59)) | 93 | if (addr & (0x1full << 59)) |
91 | reg = (reg & ~(0xffull << 56)) | (1ull << 63); | 94 | addr = (addr & ~(0xffull << 56)) | (1ull << 63); |
92 | return reg; | 95 | return addr; |
93 | } | 96 | } |
94 | 97 | ||
95 | static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) | 98 | static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) |
@@ -98,8 +101,8 @@ static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) | |||
98 | int64_t rc; | 101 | int64_t rc; |
99 | __be64 v; | 102 | __be64 v; |
100 | 103 | ||
101 | reg = opal_scom_unmangle(reg); | 104 | reg = opal_scom_unmangle(m->addr + reg); |
102 | rc = opal_xscom_read(m->chip, m->addr + reg, (__be64 *)__pa(&v)); | 105 | rc = opal_xscom_read(m->chip, reg, (__be64 *)__pa(&v)); |
103 | *value = be64_to_cpu(v); | 106 | *value = be64_to_cpu(v); |
104 | return opal_xscom_err_xlate(rc); | 107 | return opal_xscom_err_xlate(rc); |
105 | } | 108 | } |
@@ -109,8 +112,8 @@ static int opal_scom_write(scom_map_t map, u64 reg, u64 value) | |||
109 | struct opal_scom_map *m = map; | 112 | struct opal_scom_map *m = map; |
110 | int64_t rc; | 113 | int64_t rc; |
111 | 114 | ||
112 | reg = opal_scom_unmangle(reg); | 115 | reg = opal_scom_unmangle(m->addr + reg); |
113 | rc = opal_xscom_write(m->chip, m->addr + reg, value); | 116 | rc = opal_xscom_write(m->chip, reg, value); |
114 | return opal_xscom_err_xlate(rc); | 117 | return opal_xscom_err_xlate(rc); |
115 | } | 118 | } |
116 | 119 | ||
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 95633d79ef5d..8518817dcdfd 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -134,57 +134,72 @@ static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose, | |||
134 | pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n\n", | 134 | pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n\n", |
135 | hose->global_number, common->version); | 135 | hose->global_number, common->version); |
136 | 136 | ||
137 | pr_info(" brdgCtl: %08x\n", data->brdgCtl); | 137 | if (data->brdgCtl) |
138 | 138 | pr_info(" brdgCtl: %08x\n", | |
139 | pr_info(" portStatusReg: %08x\n", data->portStatusReg); | 139 | data->brdgCtl); |
140 | pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus); | 140 | if (data->portStatusReg || data->rootCmplxStatus || |
141 | pr_info(" busAgentStatus: %08x\n", data->busAgentStatus); | 141 | data->busAgentStatus) |
142 | 142 | pr_info(" UtlSts: %08x %08x %08x\n", | |
143 | pr_info(" deviceStatus: %08x\n", data->deviceStatus); | 143 | data->portStatusReg, data->rootCmplxStatus, |
144 | pr_info(" slotStatus: %08x\n", data->slotStatus); | 144 | data->busAgentStatus); |
145 | pr_info(" linkStatus: %08x\n", data->linkStatus); | 145 | if (data->deviceStatus || data->slotStatus || |
146 | pr_info(" devCmdStatus: %08x\n", data->devCmdStatus); | 146 | data->linkStatus || data->devCmdStatus || |
147 | pr_info(" devSecStatus: %08x\n", data->devSecStatus); | 147 | data->devSecStatus) |
148 | 148 | pr_info(" RootSts: %08x %08x %08x %08x %08x\n", | |
149 | pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus); | 149 | data->deviceStatus, data->slotStatus, |
150 | pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus); | 150 | data->linkStatus, data->devCmdStatus, |
151 | pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus); | 151 | data->devSecStatus); |
152 | pr_info(" tlpHdr1: %08x\n", data->tlpHdr1); | 152 | if (data->rootErrorStatus || data->uncorrErrorStatus || |
153 | pr_info(" tlpHdr2: %08x\n", data->tlpHdr2); | 153 | data->corrErrorStatus) |
154 | pr_info(" tlpHdr3: %08x\n", data->tlpHdr3); | 154 | pr_info(" RootErrSts: %08x %08x %08x\n", |
155 | pr_info(" tlpHdr4: %08x\n", data->tlpHdr4); | 155 | data->rootErrorStatus, data->uncorrErrorStatus, |
156 | pr_info(" sourceId: %08x\n", data->sourceId); | 156 | data->corrErrorStatus); |
157 | pr_info(" errorClass: %016llx\n", data->errorClass); | 157 | if (data->tlpHdr1 || data->tlpHdr2 || |
158 | pr_info(" correlator: %016llx\n", data->correlator); | 158 | data->tlpHdr3 || data->tlpHdr4) |
159 | pr_info(" p7iocPlssr: %016llx\n", data->p7iocPlssr); | 159 | pr_info(" RootErrLog: %08x %08x %08x %08x\n", |
160 | pr_info(" p7iocCsr: %016llx\n", data->p7iocCsr); | 160 | data->tlpHdr1, data->tlpHdr2, |
161 | pr_info(" lemFir: %016llx\n", data->lemFir); | 161 | data->tlpHdr3, data->tlpHdr4); |
162 | pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask); | 162 | if (data->sourceId || data->errorClass || |
163 | pr_info(" lemWOF: %016llx\n", data->lemWOF); | 163 | data->correlator) |
164 | pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus); | 164 | pr_info(" RootErrLog1: %08x %016llx %016llx\n", |
165 | pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus); | 165 | data->sourceId, data->errorClass, |
166 | pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0); | 166 | data->correlator); |
167 | pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1); | 167 | if (data->p7iocPlssr || data->p7iocCsr) |
168 | pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus); | 168 | pr_info(" PhbSts: %016llx %016llx\n", |
169 | pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus); | 169 | data->p7iocPlssr, data->p7iocCsr); |
170 | pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0); | 170 | if (data->lemFir || data->lemErrorMask || |
171 | pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1); | 171 | data->lemWOF) |
172 | pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus); | 172 | pr_info(" Lem: %016llx %016llx %016llx\n", |
173 | pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus); | 173 | data->lemFir, data->lemErrorMask, |
174 | pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0); | 174 | data->lemWOF); |
175 | pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1); | 175 | if (data->phbErrorStatus || data->phbFirstErrorStatus || |
176 | pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus); | 176 | data->phbErrorLog0 || data->phbErrorLog1) |
177 | pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus); | 177 | pr_info(" PhbErr: %016llx %016llx %016llx %016llx\n", |
178 | pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0); | 178 | data->phbErrorStatus, data->phbFirstErrorStatus, |
179 | pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1); | 179 | data->phbErrorLog0, data->phbErrorLog1); |
180 | if (data->mmioErrorStatus || data->mmioFirstErrorStatus || | ||
181 | data->mmioErrorLog0 || data->mmioErrorLog1) | ||
182 | pr_info(" OutErr: %016llx %016llx %016llx %016llx\n", | ||
183 | data->mmioErrorStatus, data->mmioFirstErrorStatus, | ||
184 | data->mmioErrorLog0, data->mmioErrorLog1); | ||
185 | if (data->dma0ErrorStatus || data->dma0FirstErrorStatus || | ||
186 | data->dma0ErrorLog0 || data->dma0ErrorLog1) | ||
187 | pr_info(" InAErr: %016llx %016llx %016llx %016llx\n", | ||
188 | data->dma0ErrorStatus, data->dma0FirstErrorStatus, | ||
189 | data->dma0ErrorLog0, data->dma0ErrorLog1); | ||
190 | if (data->dma1ErrorStatus || data->dma1FirstErrorStatus || | ||
191 | data->dma1ErrorLog0 || data->dma1ErrorLog1) | ||
192 | pr_info(" InBErr: %016llx %016llx %016llx %016llx\n", | ||
193 | data->dma1ErrorStatus, data->dma1FirstErrorStatus, | ||
194 | data->dma1ErrorLog0, data->dma1ErrorLog1); | ||
180 | 195 | ||
181 | for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) { | 196 | for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) { |
182 | if ((data->pestA[i] >> 63) == 0 && | 197 | if ((data->pestA[i] >> 63) == 0 && |
183 | (data->pestB[i] >> 63) == 0) | 198 | (data->pestB[i] >> 63) == 0) |
184 | continue; | 199 | continue; |
185 | 200 | ||
186 | pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]); | 201 | pr_info(" PE[%3d] A/B: %016llx %016llx\n", |
187 | pr_info(" PESTB: %016llx\n", data->pestB[i]); | 202 | i, data->pestA[i], data->pestB[i]); |
188 | } | 203 | } |
189 | } | 204 | } |
190 | 205 | ||
@@ -197,62 +212,77 @@ static void pnv_pci_dump_phb3_diag_data(struct pci_controller *hose, | |||
197 | data = (struct OpalIoPhb3ErrorData*)common; | 212 | data = (struct OpalIoPhb3ErrorData*)common; |
198 | pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n\n", | 213 | pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n\n", |
199 | hose->global_number, common->version); | 214 | hose->global_number, common->version); |
200 | 215 | if (data->brdgCtl) | |
201 | pr_info(" brdgCtl: %08x\n", data->brdgCtl); | 216 | pr_info(" brdgCtl: %08x\n", |
202 | 217 | data->brdgCtl); | |
203 | pr_info(" portStatusReg: %08x\n", data->portStatusReg); | 218 | if (data->portStatusReg || data->rootCmplxStatus || |
204 | pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus); | 219 | data->busAgentStatus) |
205 | pr_info(" busAgentStatus: %08x\n", data->busAgentStatus); | 220 | pr_info(" UtlSts: %08x %08x %08x\n", |
206 | 221 | data->portStatusReg, data->rootCmplxStatus, | |
207 | pr_info(" deviceStatus: %08x\n", data->deviceStatus); | 222 | data->busAgentStatus); |
208 | pr_info(" slotStatus: %08x\n", data->slotStatus); | 223 | if (data->deviceStatus || data->slotStatus || |
209 | pr_info(" linkStatus: %08x\n", data->linkStatus); | 224 | data->linkStatus || data->devCmdStatus || |
210 | pr_info(" devCmdStatus: %08x\n", data->devCmdStatus); | 225 | data->devSecStatus) |
211 | pr_info(" devSecStatus: %08x\n", data->devSecStatus); | 226 | pr_info(" RootSts: %08x %08x %08x %08x %08x\n", |
212 | 227 | data->deviceStatus, data->slotStatus, | |
213 | pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus); | 228 | data->linkStatus, data->devCmdStatus, |
214 | pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus); | 229 | data->devSecStatus); |
215 | pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus); | 230 | if (data->rootErrorStatus || data->uncorrErrorStatus || |
216 | pr_info(" tlpHdr1: %08x\n", data->tlpHdr1); | 231 | data->corrErrorStatus) |
217 | pr_info(" tlpHdr2: %08x\n", data->tlpHdr2); | 232 | pr_info(" RootErrSts: %08x %08x %08x\n", |
218 | pr_info(" tlpHdr3: %08x\n", data->tlpHdr3); | 233 | data->rootErrorStatus, data->uncorrErrorStatus, |
219 | pr_info(" tlpHdr4: %08x\n", data->tlpHdr4); | 234 | data->corrErrorStatus); |
220 | pr_info(" sourceId: %08x\n", data->sourceId); | 235 | if (data->tlpHdr1 || data->tlpHdr2 || |
221 | pr_info(" errorClass: %016llx\n", data->errorClass); | 236 | data->tlpHdr3 || data->tlpHdr4) |
222 | pr_info(" correlator: %016llx\n", data->correlator); | 237 | pr_info(" RootErrLog: %08x %08x %08x %08x\n", |
223 | 238 | data->tlpHdr1, data->tlpHdr2, | |
224 | pr_info(" nFir: %016llx\n", data->nFir); | 239 | data->tlpHdr3, data->tlpHdr4); |
225 | pr_info(" nFirMask: %016llx\n", data->nFirMask); | 240 | if (data->sourceId || data->errorClass || |
226 | pr_info(" nFirWOF: %016llx\n", data->nFirWOF); | 241 | data->correlator) |
227 | pr_info(" PhbPlssr: %016llx\n", data->phbPlssr); | 242 | pr_info(" RootErrLog1: %08x %016llx %016llx\n", |
228 | pr_info(" PhbCsr: %016llx\n", data->phbCsr); | 243 | data->sourceId, data->errorClass, |
229 | pr_info(" lemFir: %016llx\n", data->lemFir); | 244 | data->correlator); |
230 | pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask); | 245 | if (data->nFir || data->nFirMask || |
231 | pr_info(" lemWOF: %016llx\n", data->lemWOF); | 246 | data->nFirWOF) |
232 | pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus); | 247 | pr_info(" nFir: %016llx %016llx %016llx\n", |
233 | pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus); | 248 | data->nFir, data->nFirMask, |
234 | pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0); | 249 | data->nFirWOF); |
235 | pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1); | 250 | if (data->phbPlssr || data->phbCsr) |
236 | pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus); | 251 | pr_info(" PhbSts: %016llx %016llx\n", |
237 | pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus); | 252 | data->phbPlssr, data->phbCsr); |
238 | pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0); | 253 | if (data->lemFir || data->lemErrorMask || |
239 | pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1); | 254 | data->lemWOF) |
240 | pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus); | 255 | pr_info(" Lem: %016llx %016llx %016llx\n", |
241 | pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus); | 256 | data->lemFir, data->lemErrorMask, |
242 | pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0); | 257 | data->lemWOF); |
243 | pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1); | 258 | if (data->phbErrorStatus || data->phbFirstErrorStatus || |
244 | pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus); | 259 | data->phbErrorLog0 || data->phbErrorLog1) |
245 | pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus); | 260 | pr_info(" PhbErr: %016llx %016llx %016llx %016llx\n", |
246 | pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0); | 261 | data->phbErrorStatus, data->phbFirstErrorStatus, |
247 | pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1); | 262 | data->phbErrorLog0, data->phbErrorLog1); |
263 | if (data->mmioErrorStatus || data->mmioFirstErrorStatus || | ||
264 | data->mmioErrorLog0 || data->mmioErrorLog1) | ||
265 | pr_info(" OutErr: %016llx %016llx %016llx %016llx\n", | ||
266 | data->mmioErrorStatus, data->mmioFirstErrorStatus, | ||
267 | data->mmioErrorLog0, data->mmioErrorLog1); | ||
268 | if (data->dma0ErrorStatus || data->dma0FirstErrorStatus || | ||
269 | data->dma0ErrorLog0 || data->dma0ErrorLog1) | ||
270 | pr_info(" InAErr: %016llx %016llx %016llx %016llx\n", | ||
271 | data->dma0ErrorStatus, data->dma0FirstErrorStatus, | ||
272 | data->dma0ErrorLog0, data->dma0ErrorLog1); | ||
273 | if (data->dma1ErrorStatus || data->dma1FirstErrorStatus || | ||
274 | data->dma1ErrorLog0 || data->dma1ErrorLog1) | ||
275 | pr_info(" InBErr: %016llx %016llx %016llx %016llx\n", | ||
276 | data->dma1ErrorStatus, data->dma1FirstErrorStatus, | ||
277 | data->dma1ErrorLog0, data->dma1ErrorLog1); | ||
248 | 278 | ||
249 | for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { | 279 | for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { |
250 | if ((data->pestA[i] >> 63) == 0 && | 280 | if ((data->pestA[i] >> 63) == 0 && |
251 | (data->pestB[i] >> 63) == 0) | 281 | (data->pestB[i] >> 63) == 0) |
252 | continue; | 282 | continue; |
253 | 283 | ||
254 | pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]); | 284 | pr_info(" PE[%3d] A/B: %016llx %016llx\n", |
255 | pr_info(" PESTB: %016llx\n", data->pestB[i]); | 285 | i, data->pestA[i], data->pestB[i]); |
256 | } | 286 | } |
257 | } | 287 | } |
258 | 288 | ||
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 82789e79e539..0ea99e3d4815 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c | |||
@@ -35,12 +35,7 @@ | |||
35 | #include "offline_states.h" | 35 | #include "offline_states.h" |
36 | 36 | ||
37 | /* This version can't take the spinlock, because it never returns */ | 37 | /* This version can't take the spinlock, because it never returns */ |
38 | static struct rtas_args rtas_stop_self_args = { | 38 | static int rtas_stop_self_token = RTAS_UNKNOWN_SERVICE; |
39 | .token = RTAS_UNKNOWN_SERVICE, | ||
40 | .nargs = 0, | ||
41 | .nret = 1, | ||
42 | .rets = &rtas_stop_self_args.args[0], | ||
43 | }; | ||
44 | 39 | ||
45 | static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = | 40 | static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = |
46 | CPU_STATE_OFFLINE; | 41 | CPU_STATE_OFFLINE; |
@@ -93,15 +88,20 @@ void set_default_offline_state(int cpu) | |||
93 | 88 | ||
94 | static void rtas_stop_self(void) | 89 | static void rtas_stop_self(void) |
95 | { | 90 | { |
96 | struct rtas_args *args = &rtas_stop_self_args; | 91 | struct rtas_args args = { |
92 | .token = cpu_to_be32(rtas_stop_self_token), | ||
93 | .nargs = 0, | ||
94 | .nret = 1, | ||
95 | .rets = &args.args[0], | ||
96 | }; | ||
97 | 97 | ||
98 | local_irq_disable(); | 98 | local_irq_disable(); |
99 | 99 | ||
100 | BUG_ON(args->token == RTAS_UNKNOWN_SERVICE); | 100 | BUG_ON(rtas_stop_self_token == RTAS_UNKNOWN_SERVICE); |
101 | 101 | ||
102 | printk("cpu %u (hwid %u) Ready to die...\n", | 102 | printk("cpu %u (hwid %u) Ready to die...\n", |
103 | smp_processor_id(), hard_smp_processor_id()); | 103 | smp_processor_id(), hard_smp_processor_id()); |
104 | enter_rtas(__pa(args)); | 104 | enter_rtas(__pa(&args)); |
105 | 105 | ||
106 | panic("Alas, I survived.\n"); | 106 | panic("Alas, I survived.\n"); |
107 | } | 107 | } |
@@ -392,10 +392,10 @@ static int __init pseries_cpu_hotplug_init(void) | |||
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | rtas_stop_self_args.token = rtas_token("stop-self"); | 395 | rtas_stop_self_token = rtas_token("stop-self"); |
396 | qcss_tok = rtas_token("query-cpu-stopped-state"); | 396 | qcss_tok = rtas_token("query-cpu-stopped-state"); |
397 | 397 | ||
398 | if (rtas_stop_self_args.token == RTAS_UNKNOWN_SERVICE || | 398 | if (rtas_stop_self_token == RTAS_UNKNOWN_SERVICE || |
399 | qcss_tok == RTAS_UNKNOWN_SERVICE) { | 399 | qcss_tok == RTAS_UNKNOWN_SERVICE) { |
400 | printk(KERN_INFO "CPU Hotplug not supported by firmware " | 400 | printk(KERN_INFO "CPU Hotplug not supported by firmware " |
401 | "- disabling.\n"); | 401 | "- disabling.\n"); |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 59c8efce1b99..0248949a756d 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1421,5 +1421,5 @@ ENTRY(sys_sched_setattr_wrapper) | |||
1421 | ENTRY(sys_sched_getattr_wrapper) | 1421 | ENTRY(sys_sched_getattr_wrapper) |
1422 | lgfr %r2,%r2 # pid_t | 1422 | lgfr %r2,%r2 # pid_t |
1423 | llgtr %r3,%r3 # const char __user * | 1423 | llgtr %r3,%r3 # const char __user * |
1424 | llgfr %r3,%r3 # unsigned int | 1424 | llgfr %r4,%r4 # unsigned int |
1425 | jg sys_sched_getattr | 1425 | jg sys_sched_getattr |
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index 60c11a629d96..f91c03119804 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c | |||
@@ -206,11 +206,13 @@ static void dma_cleanup_tables(struct zpci_dev *zdev) | |||
206 | zdev->dma_table = NULL; | 206 | zdev->dma_table = NULL; |
207 | } | 207 | } |
208 | 208 | ||
209 | static unsigned long __dma_alloc_iommu(struct zpci_dev *zdev, unsigned long start, | 209 | static unsigned long __dma_alloc_iommu(struct zpci_dev *zdev, |
210 | int size) | 210 | unsigned long start, int size) |
211 | { | 211 | { |
212 | unsigned long boundary_size = 0x1000000; | 212 | unsigned long boundary_size; |
213 | 213 | ||
214 | boundary_size = ALIGN(dma_get_seg_boundary(&zdev->pdev->dev) + 1, | ||
215 | PAGE_SIZE) >> PAGE_SHIFT; | ||
214 | return iommu_area_alloc(zdev->iommu_bitmap, zdev->iommu_pages, | 216 | return iommu_area_alloc(zdev->iommu_bitmap, zdev->iommu_pages, |
215 | start, size, 0, boundary_size, 0); | 217 | start, size, 0, boundary_size, 0); |
216 | } | 218 | } |
diff --git a/arch/sh/include/cpu-sh2/cpu/cache.h b/arch/sh/include/cpu-sh2/cpu/cache.h index 673515bc4135..aa1b2b9088a7 100644 --- a/arch/sh/include/cpu-sh2/cpu/cache.h +++ b/arch/sh/include/cpu-sh2/cpu/cache.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #define SH_CACHE_ASSOC 8 | 18 | #define SH_CACHE_ASSOC 8 |
19 | 19 | ||
20 | #if defined(CONFIG_CPU_SUBTYPE_SH7619) | 20 | #if defined(CONFIG_CPU_SUBTYPE_SH7619) |
21 | #define CCR 0xffffffec | 21 | #define SH_CCR 0xffffffec |
22 | 22 | ||
23 | #define CCR_CACHE_CE 0x01 /* Cache enable */ | 23 | #define CCR_CACHE_CE 0x01 /* Cache enable */ |
24 | #define CCR_CACHE_WT 0x02 /* CCR[bit1=1,bit2=1] */ | 24 | #define CCR_CACHE_WT 0x02 /* CCR[bit1=1,bit2=1] */ |
diff --git a/arch/sh/include/cpu-sh2a/cpu/cache.h b/arch/sh/include/cpu-sh2a/cpu/cache.h index defb0baa5a06..b27ce92cb600 100644 --- a/arch/sh/include/cpu-sh2a/cpu/cache.h +++ b/arch/sh/include/cpu-sh2a/cpu/cache.h | |||
@@ -17,8 +17,8 @@ | |||
17 | #define SH_CACHE_COMBINED 4 | 17 | #define SH_CACHE_COMBINED 4 |
18 | #define SH_CACHE_ASSOC 8 | 18 | #define SH_CACHE_ASSOC 8 |
19 | 19 | ||
20 | #define CCR 0xfffc1000 /* CCR1 */ | 20 | #define SH_CCR 0xfffc1000 /* CCR1 */ |
21 | #define CCR2 0xfffc1004 | 21 | #define SH_CCR2 0xfffc1004 |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * Most of the SH-2A CCR1 definitions resemble the SH-4 ones. All others not | 24 | * Most of the SH-2A CCR1 definitions resemble the SH-4 ones. All others not |
diff --git a/arch/sh/include/cpu-sh3/cpu/cache.h b/arch/sh/include/cpu-sh3/cpu/cache.h index bee2d81c56bf..29700fd88c75 100644 --- a/arch/sh/include/cpu-sh3/cpu/cache.h +++ b/arch/sh/include/cpu-sh3/cpu/cache.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #define SH_CACHE_COMBINED 4 | 17 | #define SH_CACHE_COMBINED 4 |
18 | #define SH_CACHE_ASSOC 8 | 18 | #define SH_CACHE_ASSOC 8 |
19 | 19 | ||
20 | #define CCR 0xffffffec /* Address of Cache Control Register */ | 20 | #define SH_CCR 0xffffffec /* Address of Cache Control Register */ |
21 | 21 | ||
22 | #define CCR_CACHE_CE 0x01 /* Cache Enable */ | 22 | #define CCR_CACHE_CE 0x01 /* Cache Enable */ |
23 | #define CCR_CACHE_WT 0x02 /* Write-Through (for P0,U0,P3) (else writeback) */ | 23 | #define CCR_CACHE_WT 0x02 /* Write-Through (for P0,U0,P3) (else writeback) */ |
diff --git a/arch/sh/include/cpu-sh4/cpu/cache.h b/arch/sh/include/cpu-sh4/cpu/cache.h index 7bfb9e8b069c..92c4cd119b66 100644 --- a/arch/sh/include/cpu-sh4/cpu/cache.h +++ b/arch/sh/include/cpu-sh4/cpu/cache.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #define SH_CACHE_COMBINED 4 | 17 | #define SH_CACHE_COMBINED 4 |
18 | #define SH_CACHE_ASSOC 8 | 18 | #define SH_CACHE_ASSOC 8 |
19 | 19 | ||
20 | #define CCR 0xff00001c /* Address of Cache Control Register */ | 20 | #define SH_CCR 0xff00001c /* Address of Cache Control Register */ |
21 | #define CCR_CACHE_OCE 0x0001 /* Operand Cache Enable */ | 21 | #define CCR_CACHE_OCE 0x0001 /* Operand Cache Enable */ |
22 | #define CCR_CACHE_WT 0x0002 /* Write-Through (for P0,U0,P3) (else writeback)*/ | 22 | #define CCR_CACHE_WT 0x0002 /* Write-Through (for P0,U0,P3) (else writeback)*/ |
23 | #define CCR_CACHE_CB 0x0004 /* Copy-Back (for P1) (else writethrough) */ | 23 | #define CCR_CACHE_CB 0x0004 /* Copy-Back (for P1) (else writethrough) */ |
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c index ecf83cd158dc..0d7360d549c1 100644 --- a/arch/sh/kernel/cpu/init.c +++ b/arch/sh/kernel/cpu/init.c | |||
@@ -112,7 +112,7 @@ static void cache_init(void) | |||
112 | unsigned long ccr, flags; | 112 | unsigned long ccr, flags; |
113 | 113 | ||
114 | jump_to_uncached(); | 114 | jump_to_uncached(); |
115 | ccr = __raw_readl(CCR); | 115 | ccr = __raw_readl(SH_CCR); |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * At this point we don't know whether the cache is enabled or not - a | 118 | * At this point we don't know whether the cache is enabled or not - a |
@@ -189,7 +189,7 @@ static void cache_init(void) | |||
189 | 189 | ||
190 | l2_cache_init(); | 190 | l2_cache_init(); |
191 | 191 | ||
192 | __raw_writel(flags, CCR); | 192 | __raw_writel(flags, SH_CCR); |
193 | back_to_cached(); | 193 | back_to_cached(); |
194 | } | 194 | } |
195 | #else | 195 | #else |
diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c index 115725198038..777e50f33c00 100644 --- a/arch/sh/mm/cache-debugfs.c +++ b/arch/sh/mm/cache-debugfs.c | |||
@@ -36,7 +36,7 @@ static int cache_seq_show(struct seq_file *file, void *iter) | |||
36 | */ | 36 | */ |
37 | jump_to_uncached(); | 37 | jump_to_uncached(); |
38 | 38 | ||
39 | ccr = __raw_readl(CCR); | 39 | ccr = __raw_readl(SH_CCR); |
40 | if ((ccr & CCR_CACHE_ENABLE) == 0) { | 40 | if ((ccr & CCR_CACHE_ENABLE) == 0) { |
41 | back_to_cached(); | 41 | back_to_cached(); |
42 | 42 | ||
diff --git a/arch/sh/mm/cache-sh2.c b/arch/sh/mm/cache-sh2.c index defcf719f2e8..a74259f2f981 100644 --- a/arch/sh/mm/cache-sh2.c +++ b/arch/sh/mm/cache-sh2.c | |||
@@ -63,9 +63,9 @@ static void sh2__flush_invalidate_region(void *start, int size) | |||
63 | local_irq_save(flags); | 63 | local_irq_save(flags); |
64 | jump_to_uncached(); | 64 | jump_to_uncached(); |
65 | 65 | ||
66 | ccr = __raw_readl(CCR); | 66 | ccr = __raw_readl(SH_CCR); |
67 | ccr |= CCR_CACHE_INVALIDATE; | 67 | ccr |= CCR_CACHE_INVALIDATE; |
68 | __raw_writel(ccr, CCR); | 68 | __raw_writel(ccr, SH_CCR); |
69 | 69 | ||
70 | back_to_cached(); | 70 | back_to_cached(); |
71 | local_irq_restore(flags); | 71 | local_irq_restore(flags); |
diff --git a/arch/sh/mm/cache-sh2a.c b/arch/sh/mm/cache-sh2a.c index 949e2d3138a0..ee87d081259b 100644 --- a/arch/sh/mm/cache-sh2a.c +++ b/arch/sh/mm/cache-sh2a.c | |||
@@ -134,7 +134,8 @@ static void sh2a__flush_invalidate_region(void *start, int size) | |||
134 | 134 | ||
135 | /* If there are too many pages then just blow the cache */ | 135 | /* If there are too many pages then just blow the cache */ |
136 | if (((end - begin) >> PAGE_SHIFT) >= MAX_OCACHE_PAGES) { | 136 | if (((end - begin) >> PAGE_SHIFT) >= MAX_OCACHE_PAGES) { |
137 | __raw_writel(__raw_readl(CCR) | CCR_OCACHE_INVALIDATE, CCR); | 137 | __raw_writel(__raw_readl(SH_CCR) | CCR_OCACHE_INVALIDATE, |
138 | SH_CCR); | ||
138 | } else { | 139 | } else { |
139 | for (v = begin; v < end; v += L1_CACHE_BYTES) | 140 | for (v = begin; v < end; v += L1_CACHE_BYTES) |
140 | sh2a_invalidate_line(CACHE_OC_ADDRESS_ARRAY, v); | 141 | sh2a_invalidate_line(CACHE_OC_ADDRESS_ARRAY, v); |
@@ -167,7 +168,8 @@ static void sh2a_flush_icache_range(void *args) | |||
167 | /* I-Cache invalidate */ | 168 | /* I-Cache invalidate */ |
168 | /* If there are too many pages then just blow the cache */ | 169 | /* If there are too many pages then just blow the cache */ |
169 | if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) { | 170 | if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) { |
170 | __raw_writel(__raw_readl(CCR) | CCR_ICACHE_INVALIDATE, CCR); | 171 | __raw_writel(__raw_readl(SH_CCR) | CCR_ICACHE_INVALIDATE, |
172 | SH_CCR); | ||
171 | } else { | 173 | } else { |
172 | for (v = start; v < end; v += L1_CACHE_BYTES) | 174 | for (v = start; v < end; v += L1_CACHE_BYTES) |
173 | sh2a_invalidate_line(CACHE_IC_ADDRESS_ARRAY, v); | 175 | sh2a_invalidate_line(CACHE_IC_ADDRESS_ARRAY, v); |
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index 0e529285b28d..51d8f7f31d1d 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -133,9 +133,9 @@ static void flush_icache_all(void) | |||
133 | jump_to_uncached(); | 133 | jump_to_uncached(); |
134 | 134 | ||
135 | /* Flush I-cache */ | 135 | /* Flush I-cache */ |
136 | ccr = __raw_readl(CCR); | 136 | ccr = __raw_readl(SH_CCR); |
137 | ccr |= CCR_CACHE_ICI; | 137 | ccr |= CCR_CACHE_ICI; |
138 | __raw_writel(ccr, CCR); | 138 | __raw_writel(ccr, SH_CCR); |
139 | 139 | ||
140 | /* | 140 | /* |
141 | * back_to_cached() will take care of the barrier for us, don't add | 141 | * back_to_cached() will take care of the barrier for us, don't add |
diff --git a/arch/sh/mm/cache-shx3.c b/arch/sh/mm/cache-shx3.c index c0adbee97b5f..24c58b7dc022 100644 --- a/arch/sh/mm/cache-shx3.c +++ b/arch/sh/mm/cache-shx3.c | |||
@@ -19,7 +19,7 @@ void __init shx3_cache_init(void) | |||
19 | { | 19 | { |
20 | unsigned int ccr; | 20 | unsigned int ccr; |
21 | 21 | ||
22 | ccr = __raw_readl(CCR); | 22 | ccr = __raw_readl(SH_CCR); |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * If we've got cache aliases, resolve them in hardware. | 25 | * If we've got cache aliases, resolve them in hardware. |
@@ -40,5 +40,5 @@ void __init shx3_cache_init(void) | |||
40 | ccr |= CCR_CACHE_IBE; | 40 | ccr |= CCR_CACHE_IBE; |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | writel_uncached(ccr, CCR); | 43 | writel_uncached(ccr, SH_CCR); |
44 | } | 44 | } |
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index 616966a96cba..097c2cdd117f 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c | |||
@@ -285,8 +285,8 @@ void __init cpu_cache_init(void) | |||
285 | { | 285 | { |
286 | unsigned int cache_disabled = 0; | 286 | unsigned int cache_disabled = 0; |
287 | 287 | ||
288 | #ifdef CCR | 288 | #ifdef SH_CCR |
289 | cache_disabled = !(__raw_readl(CCR) & CCR_CACHE_ENABLE); | 289 | cache_disabled = !(__raw_readl(SH_CCR) & CCR_CACHE_ENABLE); |
290 | #endif | 290 | #endif |
291 | 291 | ||
292 | compute_alias(&boot_cpu_data.icache); | 292 | compute_alias(&boot_cpu_data.icache); |
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 32a280ec38c1..d7b4967f8fa6 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
@@ -58,9 +58,12 @@ void arch_cpu_idle(void) | |||
58 | { | 58 | { |
59 | if (tlb_type != hypervisor) { | 59 | if (tlb_type != hypervisor) { |
60 | touch_nmi_watchdog(); | 60 | touch_nmi_watchdog(); |
61 | local_irq_enable(); | ||
61 | } else { | 62 | } else { |
62 | unsigned long pstate; | 63 | unsigned long pstate; |
63 | 64 | ||
65 | local_irq_enable(); | ||
66 | |||
64 | /* The sun4v sleeping code requires that we have PSTATE.IE cleared over | 67 | /* The sun4v sleeping code requires that we have PSTATE.IE cleared over |
65 | * the cpu sleep hypervisor call. | 68 | * the cpu sleep hypervisor call. |
66 | */ | 69 | */ |
@@ -82,7 +85,6 @@ void arch_cpu_idle(void) | |||
82 | : "=&r" (pstate) | 85 | : "=&r" (pstate) |
83 | : "i" (PSTATE_IE)); | 86 | : "i" (PSTATE_IE)); |
84 | } | 87 | } |
85 | local_irq_enable(); | ||
86 | } | 88 | } |
87 | 89 | ||
88 | #ifdef CONFIG_HOTPLUG_CPU | 90 | #ifdef CONFIG_HOTPLUG_CPU |
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S index 87729fff13b9..33a17e7b3ccd 100644 --- a/arch/sparc/kernel/syscalls.S +++ b/arch/sparc/kernel/syscalls.S | |||
@@ -189,7 +189,8 @@ linux_sparc_syscall32: | |||
189 | mov %i0, %l5 ! IEU1 | 189 | mov %i0, %l5 ! IEU1 |
190 | 5: call %l7 ! CTI Group brk forced | 190 | 5: call %l7 ! CTI Group brk forced |
191 | srl %i5, 0, %o5 ! IEU1 | 191 | srl %i5, 0, %o5 ! IEU1 |
192 | ba,a,pt %xcc, 3f | 192 | ba,pt %xcc, 3f |
193 | sra %o0, 0, %o0 | ||
193 | 194 | ||
194 | /* Linux native system calls enter here... */ | 195 | /* Linux native system calls enter here... */ |
195 | .align 32 | 196 | .align 32 |
@@ -217,7 +218,6 @@ linux_sparc_syscall: | |||
217 | 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] | 218 | 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] |
218 | ret_sys_call: | 219 | ret_sys_call: |
219 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 | 220 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 |
220 | sra %o0, 0, %o0 | ||
221 | mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 | 221 | mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 |
222 | sllx %g2, 32, %g2 | 222 | sllx %g2, 32, %g2 |
223 | 223 | ||
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c index 3b3a360b429a..f5d506fdddad 100644 --- a/arch/sparc/mm/tsb.c +++ b/arch/sparc/mm/tsb.c | |||
@@ -273,7 +273,7 @@ void __init pgtable_cache_init(void) | |||
273 | prom_halt(); | 273 | prom_halt(); |
274 | } | 274 | } |
275 | 275 | ||
276 | for (i = 0; i < 8; i++) { | 276 | for (i = 0; i < ARRAY_SIZE(tsb_cache_names); i++) { |
277 | unsigned long size = 8192 << i; | 277 | unsigned long size = 8192 << i; |
278 | const char *name = tsb_cache_names[i]; | 278 | const char *name = tsb_cache_names[i]; |
279 | 279 | ||
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index c026cca5602c..f3aaf231b4e5 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
@@ -341,10 +341,6 @@ config X86_USE_3DNOW | |||
341 | def_bool y | 341 | def_bool y |
342 | depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML | 342 | depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML |
343 | 343 | ||
344 | config X86_OOSTORE | ||
345 | def_bool y | ||
346 | depends on (MWINCHIP3D || MWINCHIPC6) && MTRR | ||
347 | |||
348 | # | 344 | # |
349 | # P6_NOPs are a relatively minor optimization that require a family >= | 345 | # P6_NOPs are a relatively minor optimization that require a family >= |
350 | # 6 processor, except that it is broken on certain VIA chips. | 346 | # 6 processor, except that it is broken on certain VIA chips. |
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index 90a21f430117..4dbf967da50d 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c | |||
@@ -111,7 +111,7 @@ struct mem_vector { | |||
111 | }; | 111 | }; |
112 | 112 | ||
113 | #define MEM_AVOID_MAX 5 | 113 | #define MEM_AVOID_MAX 5 |
114 | struct mem_vector mem_avoid[MEM_AVOID_MAX]; | 114 | static struct mem_vector mem_avoid[MEM_AVOID_MAX]; |
115 | 115 | ||
116 | static bool mem_contains(struct mem_vector *region, struct mem_vector *item) | 116 | static bool mem_contains(struct mem_vector *region, struct mem_vector *item) |
117 | { | 117 | { |
@@ -180,7 +180,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size, | |||
180 | } | 180 | } |
181 | 181 | ||
182 | /* Does this memory vector overlap a known avoided area? */ | 182 | /* Does this memory vector overlap a known avoided area? */ |
183 | bool mem_avoid_overlap(struct mem_vector *img) | 183 | static bool mem_avoid_overlap(struct mem_vector *img) |
184 | { | 184 | { |
185 | int i; | 185 | int i; |
186 | 186 | ||
@@ -192,8 +192,9 @@ bool mem_avoid_overlap(struct mem_vector *img) | |||
192 | return false; | 192 | return false; |
193 | } | 193 | } |
194 | 194 | ||
195 | unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET / CONFIG_PHYSICAL_ALIGN]; | 195 | static unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET / |
196 | unsigned long slot_max = 0; | 196 | CONFIG_PHYSICAL_ALIGN]; |
197 | static unsigned long slot_max; | ||
197 | 198 | ||
198 | static void slots_append(unsigned long addr) | 199 | static void slots_append(unsigned long addr) |
199 | { | 200 | { |
diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h index 04a48903b2eb..69bbb4845020 100644 --- a/arch/x86/include/asm/barrier.h +++ b/arch/x86/include/asm/barrier.h | |||
@@ -85,11 +85,7 @@ | |||
85 | #else | 85 | #else |
86 | # define smp_rmb() barrier() | 86 | # define smp_rmb() barrier() |
87 | #endif | 87 | #endif |
88 | #ifdef CONFIG_X86_OOSTORE | 88 | #define smp_wmb() barrier() |
89 | # define smp_wmb() wmb() | ||
90 | #else | ||
91 | # define smp_wmb() barrier() | ||
92 | #endif | ||
93 | #define smp_read_barrier_depends() read_barrier_depends() | 89 | #define smp_read_barrier_depends() read_barrier_depends() |
94 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | 90 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) |
95 | #else /* !SMP */ | 91 | #else /* !SMP */ |
@@ -100,7 +96,7 @@ | |||
100 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | 96 | #define set_mb(var, value) do { var = value; barrier(); } while (0) |
101 | #endif /* SMP */ | 97 | #endif /* SMP */ |
102 | 98 | ||
103 | #if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) | 99 | #if defined(CONFIG_X86_PPRO_FENCE) |
104 | 100 | ||
105 | /* | 101 | /* |
106 | * For either of these options x86 doesn't have a strong TSO memory | 102 | * For either of these options x86 doesn't have a strong TSO memory |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 3d6b9f81cc68..acd86c850414 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -134,6 +134,7 @@ extern void efi_setup_page_tables(void); | |||
134 | extern void __init old_map_region(efi_memory_desc_t *md); | 134 | extern void __init old_map_region(efi_memory_desc_t *md); |
135 | extern void __init runtime_code_page_mkexec(void); | 135 | extern void __init runtime_code_page_mkexec(void); |
136 | extern void __init efi_runtime_mkexec(void); | 136 | extern void __init efi_runtime_mkexec(void); |
137 | extern void __init efi_apply_memmap_quirks(void); | ||
137 | 138 | ||
138 | struct efi_setup_data { | 139 | struct efi_setup_data { |
139 | u64 fw_vendor; | 140 | u64 fw_vendor; |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 34f69cb9350a..91d9c69a629e 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -237,7 +237,7 @@ memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) | |||
237 | 237 | ||
238 | static inline void flush_write_buffers(void) | 238 | static inline void flush_write_buffers(void) |
239 | { | 239 | { |
240 | #if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) | 240 | #if defined(CONFIG_X86_PPRO_FENCE) |
241 | asm volatile("lock; addl $0,0(%%esp)": : :"memory"); | 241 | asm volatile("lock; addl $0,0(%%esp)": : :"memory"); |
242 | #endif | 242 | #endif |
243 | } | 243 | } |
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index bf156ded74b5..0f62f5482d91 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h | |||
@@ -26,10 +26,9 @@ | |||
26 | # define LOCK_PTR_REG "D" | 26 | # define LOCK_PTR_REG "D" |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #if defined(CONFIG_X86_32) && \ | 29 | #if defined(CONFIG_X86_32) && (defined(CONFIG_X86_PPRO_FENCE)) |
30 | (defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE)) | ||
31 | /* | 30 | /* |
32 | * On PPro SMP or if we are using OOSTORE, we use a locked operation to unlock | 31 | * On PPro SMP, we use a locked operation to unlock |
33 | * (PPro errata 66, 92) | 32 | * (PPro errata 66, 92) |
34 | */ | 33 | */ |
35 | # define UNLOCK_LOCK_PREFIX LOCK_PREFIX | 34 | # define UNLOCK_LOCK_PREFIX LOCK_PREFIX |
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index fd972a3e4cbb..9fa8aa051f54 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/pci_ids.h> | 18 | #include <linux/pci_ids.h> |
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/bitops.h> | 20 | #include <linux/bitops.h> |
21 | #include <linux/ioport.h> | ||
22 | #include <linux/suspend.h> | 21 | #include <linux/suspend.h> |
23 | #include <asm/e820.h> | 22 | #include <asm/e820.h> |
24 | #include <asm/io.h> | 23 | #include <asm/io.h> |
@@ -54,18 +53,6 @@ int fallback_aper_force __initdata; | |||
54 | 53 | ||
55 | int fix_aperture __initdata = 1; | 54 | int fix_aperture __initdata = 1; |
56 | 55 | ||
57 | static struct resource gart_resource = { | ||
58 | .name = "GART", | ||
59 | .flags = IORESOURCE_MEM, | ||
60 | }; | ||
61 | |||
62 | static void __init insert_aperture_resource(u32 aper_base, u32 aper_size) | ||
63 | { | ||
64 | gart_resource.start = aper_base; | ||
65 | gart_resource.end = aper_base + aper_size - 1; | ||
66 | insert_resource(&iomem_resource, &gart_resource); | ||
67 | } | ||
68 | |||
69 | /* This code runs before the PCI subsystem is initialized, so just | 56 | /* This code runs before the PCI subsystem is initialized, so just |
70 | access the northbridge directly. */ | 57 | access the northbridge directly. */ |
71 | 58 | ||
@@ -96,7 +83,6 @@ static u32 __init allocate_aperture(void) | |||
96 | memblock_reserve(addr, aper_size); | 83 | memblock_reserve(addr, aper_size); |
97 | printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n", | 84 | printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n", |
98 | aper_size >> 10, addr); | 85 | aper_size >> 10, addr); |
99 | insert_aperture_resource((u32)addr, aper_size); | ||
100 | register_nosave_region(addr >> PAGE_SHIFT, | 86 | register_nosave_region(addr >> PAGE_SHIFT, |
101 | (addr+aper_size) >> PAGE_SHIFT); | 87 | (addr+aper_size) >> PAGE_SHIFT); |
102 | 88 | ||
@@ -444,12 +430,8 @@ int __init gart_iommu_hole_init(void) | |||
444 | 430 | ||
445 | out: | 431 | out: |
446 | if (!fix && !fallback_aper_force) { | 432 | if (!fix && !fallback_aper_force) { |
447 | if (last_aper_base) { | 433 | if (last_aper_base) |
448 | unsigned long n = (32 * 1024 * 1024) << last_aper_order; | ||
449 | |||
450 | insert_aperture_resource((u32)last_aper_base, n); | ||
451 | return 1; | 434 | return 1; |
452 | } | ||
453 | return 0; | 435 | return 0; |
454 | } | 436 | } |
455 | 437 | ||
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c index 8779edab684e..d8fba5c15fbd 100644 --- a/arch/x86/kernel/cpu/centaur.c +++ b/arch/x86/kernel/cpu/centaur.c | |||
@@ -8,236 +8,6 @@ | |||
8 | 8 | ||
9 | #include "cpu.h" | 9 | #include "cpu.h" |
10 | 10 | ||
11 | #ifdef CONFIG_X86_OOSTORE | ||
12 | |||
13 | static u32 power2(u32 x) | ||
14 | { | ||
15 | u32 s = 1; | ||
16 | |||
17 | while (s <= x) | ||
18 | s <<= 1; | ||
19 | |||
20 | return s >>= 1; | ||
21 | } | ||
22 | |||
23 | |||
24 | /* | ||
25 | * Set up an actual MCR | ||
26 | */ | ||
27 | static void centaur_mcr_insert(int reg, u32 base, u32 size, int key) | ||
28 | { | ||
29 | u32 lo, hi; | ||
30 | |||
31 | hi = base & ~0xFFF; | ||
32 | lo = ~(size-1); /* Size is a power of 2 so this makes a mask */ | ||
33 | lo &= ~0xFFF; /* Remove the ctrl value bits */ | ||
34 | lo |= key; /* Attribute we wish to set */ | ||
35 | wrmsr(reg+MSR_IDT_MCR0, lo, hi); | ||
36 | mtrr_centaur_report_mcr(reg, lo, hi); /* Tell the mtrr driver */ | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Figure what we can cover with MCR's | ||
41 | * | ||
42 | * Shortcut: We know you can't put 4Gig of RAM on a winchip | ||
43 | */ | ||
44 | static u32 ramtop(void) | ||
45 | { | ||
46 | u32 clip = 0xFFFFFFFFUL; | ||
47 | u32 top = 0; | ||
48 | int i; | ||
49 | |||
50 | for (i = 0; i < e820.nr_map; i++) { | ||
51 | unsigned long start, end; | ||
52 | |||
53 | if (e820.map[i].addr > 0xFFFFFFFFUL) | ||
54 | continue; | ||
55 | /* | ||
56 | * Don't MCR over reserved space. Ignore the ISA hole | ||
57 | * we frob around that catastrophe already | ||
58 | */ | ||
59 | if (e820.map[i].type == E820_RESERVED) { | ||
60 | if (e820.map[i].addr >= 0x100000UL && | ||
61 | e820.map[i].addr < clip) | ||
62 | clip = e820.map[i].addr; | ||
63 | continue; | ||
64 | } | ||
65 | start = e820.map[i].addr; | ||
66 | end = e820.map[i].addr + e820.map[i].size; | ||
67 | if (start >= end) | ||
68 | continue; | ||
69 | if (end > top) | ||
70 | top = end; | ||
71 | } | ||
72 | /* | ||
73 | * Everything below 'top' should be RAM except for the ISA hole. | ||
74 | * Because of the limited MCR's we want to map NV/ACPI into our | ||
75 | * MCR range for gunk in RAM | ||
76 | * | ||
77 | * Clip might cause us to MCR insufficient RAM but that is an | ||
78 | * acceptable failure mode and should only bite obscure boxes with | ||
79 | * a VESA hole at 15Mb | ||
80 | * | ||
81 | * The second case Clip sometimes kicks in is when the EBDA is marked | ||
82 | * as reserved. Again we fail safe with reasonable results | ||
83 | */ | ||
84 | if (top > clip) | ||
85 | top = clip; | ||
86 | |||
87 | return top; | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * Compute a set of MCR's to give maximum coverage | ||
92 | */ | ||
93 | static int centaur_mcr_compute(int nr, int key) | ||
94 | { | ||
95 | u32 mem = ramtop(); | ||
96 | u32 root = power2(mem); | ||
97 | u32 base = root; | ||
98 | u32 top = root; | ||
99 | u32 floor = 0; | ||
100 | int ct = 0; | ||
101 | |||
102 | while (ct < nr) { | ||
103 | u32 fspace = 0; | ||
104 | u32 high; | ||
105 | u32 low; | ||
106 | |||
107 | /* | ||
108 | * Find the largest block we will fill going upwards | ||
109 | */ | ||
110 | high = power2(mem-top); | ||
111 | |||
112 | /* | ||
113 | * Find the largest block we will fill going downwards | ||
114 | */ | ||
115 | low = base/2; | ||
116 | |||
117 | /* | ||
118 | * Don't fill below 1Mb going downwards as there | ||
119 | * is an ISA hole in the way. | ||
120 | */ | ||
121 | if (base <= 1024*1024) | ||
122 | low = 0; | ||
123 | |||
124 | /* | ||
125 | * See how much space we could cover by filling below | ||
126 | * the ISA hole | ||
127 | */ | ||
128 | |||
129 | if (floor == 0) | ||
130 | fspace = 512*1024; | ||
131 | else if (floor == 512*1024) | ||
132 | fspace = 128*1024; | ||
133 | |||
134 | /* And forget ROM space */ | ||
135 | |||
136 | /* | ||
137 | * Now install the largest coverage we get | ||
138 | */ | ||
139 | if (fspace > high && fspace > low) { | ||
140 | centaur_mcr_insert(ct, floor, fspace, key); | ||
141 | floor += fspace; | ||
142 | } else if (high > low) { | ||
143 | centaur_mcr_insert(ct, top, high, key); | ||
144 | top += high; | ||
145 | } else if (low > 0) { | ||
146 | base -= low; | ||
147 | centaur_mcr_insert(ct, base, low, key); | ||
148 | } else | ||
149 | break; | ||
150 | ct++; | ||
151 | } | ||
152 | /* | ||
153 | * We loaded ct values. We now need to set the mask. The caller | ||
154 | * must do this bit. | ||
155 | */ | ||
156 | return ct; | ||
157 | } | ||
158 | |||
159 | static void centaur_create_optimal_mcr(void) | ||
160 | { | ||
161 | int used; | ||
162 | int i; | ||
163 | |||
164 | /* | ||
165 | * Allocate up to 6 mcrs to mark as much of ram as possible | ||
166 | * as write combining and weak write ordered. | ||
167 | * | ||
168 | * To experiment with: Linux never uses stack operations for | ||
169 | * mmio spaces so we could globally enable stack operation wc | ||
170 | * | ||
171 | * Load the registers with type 31 - full write combining, all | ||
172 | * writes weakly ordered. | ||
173 | */ | ||
174 | used = centaur_mcr_compute(6, 31); | ||
175 | |||
176 | /* | ||
177 | * Wipe unused MCRs | ||
178 | */ | ||
179 | for (i = used; i < 8; i++) | ||
180 | wrmsr(MSR_IDT_MCR0+i, 0, 0); | ||
181 | } | ||
182 | |||
183 | static void winchip2_create_optimal_mcr(void) | ||
184 | { | ||
185 | u32 lo, hi; | ||
186 | int used; | ||
187 | int i; | ||
188 | |||
189 | /* | ||
190 | * Allocate up to 6 mcrs to mark as much of ram as possible | ||
191 | * as write combining, weak store ordered. | ||
192 | * | ||
193 | * Load the registers with type 25 | ||
194 | * 8 - weak write ordering | ||
195 | * 16 - weak read ordering | ||
196 | * 1 - write combining | ||
197 | */ | ||
198 | used = centaur_mcr_compute(6, 25); | ||
199 | |||
200 | /* | ||
201 | * Mark the registers we are using. | ||
202 | */ | ||
203 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
204 | for (i = 0; i < used; i++) | ||
205 | lo |= 1<<(9+i); | ||
206 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
207 | |||
208 | /* | ||
209 | * Wipe unused MCRs | ||
210 | */ | ||
211 | |||
212 | for (i = used; i < 8; i++) | ||
213 | wrmsr(MSR_IDT_MCR0+i, 0, 0); | ||
214 | } | ||
215 | |||
216 | /* | ||
217 | * Handle the MCR key on the Winchip 2. | ||
218 | */ | ||
219 | static void winchip2_unprotect_mcr(void) | ||
220 | { | ||
221 | u32 lo, hi; | ||
222 | u32 key; | ||
223 | |||
224 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
225 | lo &= ~0x1C0; /* blank bits 8-6 */ | ||
226 | key = (lo>>17) & 7; | ||
227 | lo |= key<<6; /* replace with unlock key */ | ||
228 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
229 | } | ||
230 | |||
231 | static void winchip2_protect_mcr(void) | ||
232 | { | ||
233 | u32 lo, hi; | ||
234 | |||
235 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
236 | lo &= ~0x1C0; /* blank bits 8-6 */ | ||
237 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
238 | } | ||
239 | #endif /* CONFIG_X86_OOSTORE */ | ||
240 | |||
241 | #define ACE_PRESENT (1 << 6) | 11 | #define ACE_PRESENT (1 << 6) |
242 | #define ACE_ENABLED (1 << 7) | 12 | #define ACE_ENABLED (1 << 7) |
243 | #define ACE_FCR (1 << 28) /* MSR_VIA_FCR */ | 13 | #define ACE_FCR (1 << 28) /* MSR_VIA_FCR */ |
@@ -362,20 +132,6 @@ static void init_centaur(struct cpuinfo_x86 *c) | |||
362 | fcr_clr = DPDC; | 132 | fcr_clr = DPDC; |
363 | printk(KERN_NOTICE "Disabling bugged TSC.\n"); | 133 | printk(KERN_NOTICE "Disabling bugged TSC.\n"); |
364 | clear_cpu_cap(c, X86_FEATURE_TSC); | 134 | clear_cpu_cap(c, X86_FEATURE_TSC); |
365 | #ifdef CONFIG_X86_OOSTORE | ||
366 | centaur_create_optimal_mcr(); | ||
367 | /* | ||
368 | * Enable: | ||
369 | * write combining on non-stack, non-string | ||
370 | * write combining on string, all types | ||
371 | * weak write ordering | ||
372 | * | ||
373 | * The C6 original lacks weak read order | ||
374 | * | ||
375 | * Note 0x120 is write only on Winchip 1 | ||
376 | */ | ||
377 | wrmsr(MSR_IDT_MCR_CTRL, 0x01F0001F, 0); | ||
378 | #endif | ||
379 | break; | 135 | break; |
380 | case 8: | 136 | case 8: |
381 | switch (c->x86_mask) { | 137 | switch (c->x86_mask) { |
@@ -392,40 +148,12 @@ static void init_centaur(struct cpuinfo_x86 *c) | |||
392 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| | 148 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| |
393 | E2MMX|EAMD3D; | 149 | E2MMX|EAMD3D; |
394 | fcr_clr = DPDC; | 150 | fcr_clr = DPDC; |
395 | #ifdef CONFIG_X86_OOSTORE | ||
396 | winchip2_unprotect_mcr(); | ||
397 | winchip2_create_optimal_mcr(); | ||
398 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
399 | /* | ||
400 | * Enable: | ||
401 | * write combining on non-stack, non-string | ||
402 | * write combining on string, all types | ||
403 | * weak write ordering | ||
404 | */ | ||
405 | lo |= 31; | ||
406 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
407 | winchip2_protect_mcr(); | ||
408 | #endif | ||
409 | break; | 151 | break; |
410 | case 9: | 152 | case 9: |
411 | name = "3"; | 153 | name = "3"; |
412 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| | 154 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| |
413 | E2MMX|EAMD3D; | 155 | E2MMX|EAMD3D; |
414 | fcr_clr = DPDC; | 156 | fcr_clr = DPDC; |
415 | #ifdef CONFIG_X86_OOSTORE | ||
416 | winchip2_unprotect_mcr(); | ||
417 | winchip2_create_optimal_mcr(); | ||
418 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
419 | /* | ||
420 | * Enable: | ||
421 | * write combining on non-stack, non-string | ||
422 | * write combining on string, all types | ||
423 | * weak write ordering | ||
424 | */ | ||
425 | lo |= 31; | ||
426 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
427 | winchip2_protect_mcr(); | ||
428 | #endif | ||
429 | break; | 157 | break; |
430 | default: | 158 | default: |
431 | name = "??"; | 159 | name = "??"; |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 895604f2e916..79f9f848bee4 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1192,6 +1192,9 @@ static void x86_pmu_del(struct perf_event *event, int flags) | |||
1192 | for (i = 0; i < cpuc->n_events; i++) { | 1192 | for (i = 0; i < cpuc->n_events; i++) { |
1193 | if (event == cpuc->event_list[i]) { | 1193 | if (event == cpuc->event_list[i]) { |
1194 | 1194 | ||
1195 | if (i >= cpuc->n_events - cpuc->n_added) | ||
1196 | --cpuc->n_added; | ||
1197 | |||
1195 | if (x86_pmu.put_event_constraints) | 1198 | if (x86_pmu.put_event_constraints) |
1196 | x86_pmu.put_event_constraints(cpuc, event); | 1199 | x86_pmu.put_event_constraints(cpuc, event); |
1197 | 1200 | ||
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index c88f7f4b03ee..047f540cf3f7 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -3334,6 +3334,8 @@ static int __init uncore_type_init(struct intel_uncore_type *type) | |||
3334 | if (!pmus) | 3334 | if (!pmus) |
3335 | return -ENOMEM; | 3335 | return -ENOMEM; |
3336 | 3336 | ||
3337 | type->pmus = pmus; | ||
3338 | |||
3337 | type->unconstrainted = (struct event_constraint) | 3339 | type->unconstrainted = (struct event_constraint) |
3338 | __EVENT_CONSTRAINT(0, (1ULL << type->num_counters) - 1, | 3340 | __EVENT_CONSTRAINT(0, (1ULL << type->num_counters) - 1, |
3339 | 0, type->num_counters, 0, 0); | 3341 | 0, type->num_counters, 0, 0); |
@@ -3369,7 +3371,6 @@ static int __init uncore_type_init(struct intel_uncore_type *type) | |||
3369 | } | 3371 | } |
3370 | 3372 | ||
3371 | type->pmu_group = &uncore_pmu_attr_group; | 3373 | type->pmu_group = &uncore_pmu_attr_group; |
3372 | type->pmus = pmus; | ||
3373 | return 0; | 3374 | return 0; |
3374 | fail: | 3375 | fail: |
3375 | uncore_type_exit(type); | 3376 | uncore_type_exit(type); |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 81ba27679f18..f36bd42d6f0c 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -544,6 +544,10 @@ ENDPROC(early_idt_handlers) | |||
544 | /* This is global to keep gas from relaxing the jumps */ | 544 | /* This is global to keep gas from relaxing the jumps */ |
545 | ENTRY(early_idt_handler) | 545 | ENTRY(early_idt_handler) |
546 | cld | 546 | cld |
547 | |||
548 | cmpl $2,(%esp) # X86_TRAP_NMI | ||
549 | je is_nmi # Ignore NMI | ||
550 | |||
547 | cmpl $2,%ss:early_recursion_flag | 551 | cmpl $2,%ss:early_recursion_flag |
548 | je hlt_loop | 552 | je hlt_loop |
549 | incl %ss:early_recursion_flag | 553 | incl %ss:early_recursion_flag |
@@ -594,8 +598,9 @@ ex_entry: | |||
594 | pop %edx | 598 | pop %edx |
595 | pop %ecx | 599 | pop %ecx |
596 | pop %eax | 600 | pop %eax |
597 | addl $8,%esp /* drop vector number and error code */ | ||
598 | decl %ss:early_recursion_flag | 601 | decl %ss:early_recursion_flag |
602 | is_nmi: | ||
603 | addl $8,%esp /* drop vector number and error code */ | ||
599 | iret | 604 | iret |
600 | ENDPROC(early_idt_handler) | 605 | ENDPROC(early_idt_handler) |
601 | 606 | ||
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index e1aabdb314c8..a468c0a65c42 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -343,6 +343,9 @@ early_idt_handlers: | |||
343 | ENTRY(early_idt_handler) | 343 | ENTRY(early_idt_handler) |
344 | cld | 344 | cld |
345 | 345 | ||
346 | cmpl $2,(%rsp) # X86_TRAP_NMI | ||
347 | je is_nmi # Ignore NMI | ||
348 | |||
346 | cmpl $2,early_recursion_flag(%rip) | 349 | cmpl $2,early_recursion_flag(%rip) |
347 | jz 1f | 350 | jz 1f |
348 | incl early_recursion_flag(%rip) | 351 | incl early_recursion_flag(%rip) |
@@ -405,8 +408,9 @@ ENTRY(early_idt_handler) | |||
405 | popq %rdx | 408 | popq %rdx |
406 | popq %rcx | 409 | popq %rcx |
407 | popq %rax | 410 | popq %rax |
408 | addq $16,%rsp # drop vector number and error code | ||
409 | decl early_recursion_flag(%rip) | 411 | decl early_recursion_flag(%rip) |
412 | is_nmi: | ||
413 | addq $16,%rsp # drop vector number and error code | ||
410 | INTERRUPT_RETURN | 414 | INTERRUPT_RETURN |
411 | ENDPROC(early_idt_handler) | 415 | ENDPROC(early_idt_handler) |
412 | 416 | ||
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index e8368c6dd2a2..d5dd80814419 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -86,10 +86,19 @@ EXPORT_SYMBOL(__kernel_fpu_begin); | |||
86 | 86 | ||
87 | void __kernel_fpu_end(void) | 87 | void __kernel_fpu_end(void) |
88 | { | 88 | { |
89 | if (use_eager_fpu()) | 89 | if (use_eager_fpu()) { |
90 | math_state_restore(); | 90 | /* |
91 | else | 91 | * For eager fpu, most the time, tsk_used_math() is true. |
92 | * Restore the user math as we are done with the kernel usage. | ||
93 | * At few instances during thread exit, signal handling etc, | ||
94 | * tsk_used_math() is false. Those few places will take proper | ||
95 | * actions, so we don't need to restore the math here. | ||
96 | */ | ||
97 | if (likely(tsk_used_math(current))) | ||
98 | math_state_restore(); | ||
99 | } else { | ||
92 | stts(); | 100 | stts(); |
101 | } | ||
93 | } | 102 | } |
94 | EXPORT_SYMBOL(__kernel_fpu_end); | 103 | EXPORT_SYMBOL(__kernel_fpu_end); |
95 | 104 | ||
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 4eabc160696f..679cef0791cd 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c | |||
@@ -279,5 +279,7 @@ void arch_crash_save_vmcoreinfo(void) | |||
279 | VMCOREINFO_SYMBOL(node_data); | 279 | VMCOREINFO_SYMBOL(node_data); |
280 | VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); | 280 | VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); |
281 | #endif | 281 | #endif |
282 | vmcoreinfo_append_str("KERNELOFFSET=%lx\n", | ||
283 | (unsigned long)&_text - __START_KERNEL); | ||
282 | } | 284 | } |
283 | 285 | ||
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 7c6acd4b8995..ff898bbf579d 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -529,7 +529,7 @@ static void quirk_amd_nb_node(struct pci_dev *dev) | |||
529 | return; | 529 | return; |
530 | 530 | ||
531 | pci_read_config_dword(nb_ht, 0x60, &val); | 531 | pci_read_config_dword(nb_ht, 0x60, &val); |
532 | node = val & 7; | 532 | node = pcibus_to_node(dev->bus) | (val & 7); |
533 | /* | 533 | /* |
534 | * Some hardware may return an invalid node ID, | 534 | * Some hardware may return an invalid node ID, |
535 | * so check it first: | 535 | * so check it first: |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 06853e670354..ce72964b2f46 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1239,14 +1239,8 @@ void __init setup_arch(char **cmdline_p) | |||
1239 | register_refined_jiffies(CLOCK_TICK_RATE); | 1239 | register_refined_jiffies(CLOCK_TICK_RATE); |
1240 | 1240 | ||
1241 | #ifdef CONFIG_EFI | 1241 | #ifdef CONFIG_EFI |
1242 | /* Once setup is done above, unmap the EFI memory map on | 1242 | if (efi_enabled(EFI_BOOT)) |
1243 | * mismatched firmware/kernel archtectures since there is no | 1243 | efi_apply_memmap_quirks(); |
1244 | * support for runtime services. | ||
1245 | */ | ||
1246 | if (efi_enabled(EFI_BOOT) && !efi_is_native()) { | ||
1247 | pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); | ||
1248 | efi_unmap_memmap(); | ||
1249 | } | ||
1250 | #endif | 1244 | #endif |
1251 | } | 1245 | } |
1252 | 1246 | ||
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index e50425d0f5f7..9b531351a587 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2672,6 +2672,7 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, | |||
2672 | break; | 2672 | break; |
2673 | } | 2673 | } |
2674 | 2674 | ||
2675 | drop_large_spte(vcpu, iterator.sptep); | ||
2675 | if (!is_shadow_present_pte(*iterator.sptep)) { | 2676 | if (!is_shadow_present_pte(*iterator.sptep)) { |
2676 | u64 base_addr = iterator.addr; | 2677 | u64 base_addr = iterator.addr; |
2677 | 2678 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index e81df8fce027..2de1bc09a8d4 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -3002,10 +3002,8 @@ static int cr8_write_interception(struct vcpu_svm *svm) | |||
3002 | u8 cr8_prev = kvm_get_cr8(&svm->vcpu); | 3002 | u8 cr8_prev = kvm_get_cr8(&svm->vcpu); |
3003 | /* instruction emulation calls kvm_set_cr8() */ | 3003 | /* instruction emulation calls kvm_set_cr8() */ |
3004 | r = cr_interception(svm); | 3004 | r = cr_interception(svm); |
3005 | if (irqchip_in_kernel(svm->vcpu.kvm)) { | 3005 | if (irqchip_in_kernel(svm->vcpu.kvm)) |
3006 | clr_cr_intercept(svm, INTERCEPT_CR8_WRITE); | ||
3007 | return r; | 3006 | return r; |
3008 | } | ||
3009 | if (cr8_prev <= kvm_get_cr8(&svm->vcpu)) | 3007 | if (cr8_prev <= kvm_get_cr8(&svm->vcpu)) |
3010 | return r; | 3008 | return r; |
3011 | kvm_run->exit_reason = KVM_EXIT_SET_TPR; | 3009 | kvm_run->exit_reason = KVM_EXIT_SET_TPR; |
@@ -3567,6 +3565,8 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) | |||
3567 | if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK)) | 3565 | if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK)) |
3568 | return; | 3566 | return; |
3569 | 3567 | ||
3568 | clr_cr_intercept(svm, INTERCEPT_CR8_WRITE); | ||
3569 | |||
3570 | if (irr == -1) | 3570 | if (irr == -1) |
3571 | return; | 3571 | return; |
3572 | 3572 | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a06f101ef64b..392752834751 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -6688,7 +6688,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) | |||
6688 | else if (is_page_fault(intr_info)) | 6688 | else if (is_page_fault(intr_info)) |
6689 | return enable_ept; | 6689 | return enable_ept; |
6690 | else if (is_no_device(intr_info) && | 6690 | else if (is_no_device(intr_info) && |
6691 | !(nested_read_cr0(vmcs12) & X86_CR0_TS)) | 6691 | !(vmcs12->guest_cr0 & X86_CR0_TS)) |
6692 | return 0; | 6692 | return 0; |
6693 | return vmcs12->exception_bitmap & | 6693 | return vmcs12->exception_bitmap & |
6694 | (1u << (intr_info & INTR_INFO_VECTOR_MASK)); | 6694 | (1u << (intr_info & INTR_INFO_VECTOR_MASK)); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 39c28f09dfd5..2b8578432d5b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6186,7 +6186,7 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu) | |||
6186 | frag->len -= len; | 6186 | frag->len -= len; |
6187 | } | 6187 | } |
6188 | 6188 | ||
6189 | if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { | 6189 | if (vcpu->mmio_cur_fragment >= vcpu->mmio_nr_fragments) { |
6190 | vcpu->mmio_needed = 0; | 6190 | vcpu->mmio_needed = 0; |
6191 | 6191 | ||
6192 | /* FIXME: return into emulator if single-stepping. */ | 6192 | /* FIXME: return into emulator if single-stepping. */ |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 6dea040cc3a1..a10c8c792161 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -1020,13 +1020,17 @@ static inline bool smap_violation(int error_code, struct pt_regs *regs) | |||
1020 | * This routine handles page faults. It determines the address, | 1020 | * This routine handles page faults. It determines the address, |
1021 | * and the problem, and then passes it off to one of the appropriate | 1021 | * and the problem, and then passes it off to one of the appropriate |
1022 | * routines. | 1022 | * routines. |
1023 | * | ||
1024 | * This function must have noinline because both callers | ||
1025 | * {,trace_}do_page_fault() have notrace on. Having this an actual function | ||
1026 | * guarantees there's a function trace entry. | ||
1023 | */ | 1027 | */ |
1024 | static void __kprobes | 1028 | static void __kprobes noinline |
1025 | __do_page_fault(struct pt_regs *regs, unsigned long error_code) | 1029 | __do_page_fault(struct pt_regs *regs, unsigned long error_code, |
1030 | unsigned long address) | ||
1026 | { | 1031 | { |
1027 | struct vm_area_struct *vma; | 1032 | struct vm_area_struct *vma; |
1028 | struct task_struct *tsk; | 1033 | struct task_struct *tsk; |
1029 | unsigned long address; | ||
1030 | struct mm_struct *mm; | 1034 | struct mm_struct *mm; |
1031 | int fault; | 1035 | int fault; |
1032 | unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; | 1036 | unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; |
@@ -1034,9 +1038,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
1034 | tsk = current; | 1038 | tsk = current; |
1035 | mm = tsk->mm; | 1039 | mm = tsk->mm; |
1036 | 1040 | ||
1037 | /* Get the faulting address: */ | ||
1038 | address = read_cr2(); | ||
1039 | |||
1040 | /* | 1041 | /* |
1041 | * Detect and handle instructions that would cause a page fault for | 1042 | * Detect and handle instructions that would cause a page fault for |
1042 | * both a tracked kernel page and a userspace page. | 1043 | * both a tracked kernel page and a userspace page. |
@@ -1248,32 +1249,50 @@ good_area: | |||
1248 | up_read(&mm->mmap_sem); | 1249 | up_read(&mm->mmap_sem); |
1249 | } | 1250 | } |
1250 | 1251 | ||
1251 | dotraplinkage void __kprobes | 1252 | dotraplinkage void __kprobes notrace |
1252 | do_page_fault(struct pt_regs *regs, unsigned long error_code) | 1253 | do_page_fault(struct pt_regs *regs, unsigned long error_code) |
1253 | { | 1254 | { |
1255 | unsigned long address = read_cr2(); /* Get the faulting address */ | ||
1254 | enum ctx_state prev_state; | 1256 | enum ctx_state prev_state; |
1255 | 1257 | ||
1258 | /* | ||
1259 | * We must have this function tagged with __kprobes, notrace and call | ||
1260 | * read_cr2() before calling anything else. To avoid calling any kind | ||
1261 | * of tracing machinery before we've observed the CR2 value. | ||
1262 | * | ||
1263 | * exception_{enter,exit}() contain all sorts of tracepoints. | ||
1264 | */ | ||
1265 | |||
1256 | prev_state = exception_enter(); | 1266 | prev_state = exception_enter(); |
1257 | __do_page_fault(regs, error_code); | 1267 | __do_page_fault(regs, error_code, address); |
1258 | exception_exit(prev_state); | 1268 | exception_exit(prev_state); |
1259 | } | 1269 | } |
1260 | 1270 | ||
1261 | static void trace_page_fault_entries(struct pt_regs *regs, | 1271 | #ifdef CONFIG_TRACING |
1272 | static void trace_page_fault_entries(unsigned long address, struct pt_regs *regs, | ||
1262 | unsigned long error_code) | 1273 | unsigned long error_code) |
1263 | { | 1274 | { |
1264 | if (user_mode(regs)) | 1275 | if (user_mode(regs)) |
1265 | trace_page_fault_user(read_cr2(), regs, error_code); | 1276 | trace_page_fault_user(address, regs, error_code); |
1266 | else | 1277 | else |
1267 | trace_page_fault_kernel(read_cr2(), regs, error_code); | 1278 | trace_page_fault_kernel(address, regs, error_code); |
1268 | } | 1279 | } |
1269 | 1280 | ||
1270 | dotraplinkage void __kprobes | 1281 | dotraplinkage void __kprobes notrace |
1271 | trace_do_page_fault(struct pt_regs *regs, unsigned long error_code) | 1282 | trace_do_page_fault(struct pt_regs *regs, unsigned long error_code) |
1272 | { | 1283 | { |
1284 | /* | ||
1285 | * The exception_enter and tracepoint processing could | ||
1286 | * trigger another page faults (user space callchain | ||
1287 | * reading) and destroy the original cr2 value, so read | ||
1288 | * the faulting address now. | ||
1289 | */ | ||
1290 | unsigned long address = read_cr2(); | ||
1273 | enum ctx_state prev_state; | 1291 | enum ctx_state prev_state; |
1274 | 1292 | ||
1275 | prev_state = exception_enter(); | 1293 | prev_state = exception_enter(); |
1276 | trace_page_fault_entries(regs, error_code); | 1294 | trace_page_fault_entries(address, regs, error_code); |
1277 | __do_page_fault(regs, error_code); | 1295 | __do_page_fault(regs, error_code, address); |
1278 | exception_exit(prev_state); | 1296 | exception_exit(prev_state); |
1279 | } | 1297 | } |
1298 | #endif /* CONFIG_TRACING */ | ||
diff --git a/arch/x86/net/bpf_jit.S b/arch/x86/net/bpf_jit.S index 877b9a1b2152..01495755701b 100644 --- a/arch/x86/net/bpf_jit.S +++ b/arch/x86/net/bpf_jit.S | |||
@@ -140,7 +140,7 @@ bpf_slow_path_byte_msh: | |||
140 | push %r9; \ | 140 | push %r9; \ |
141 | push SKBDATA; \ | 141 | push SKBDATA; \ |
142 | /* rsi already has offset */ \ | 142 | /* rsi already has offset */ \ |
143 | mov $SIZE,%ecx; /* size */ \ | 143 | mov $SIZE,%edx; /* size */ \ |
144 | call bpf_internal_load_pointer_neg_helper; \ | 144 | call bpf_internal_load_pointer_neg_helper; \ |
145 | test %rax,%rax; \ | 145 | test %rax,%rax; \ |
146 | pop SKBDATA; \ | 146 | pop SKBDATA; \ |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 1a201ac7cef8..b97acecf3fd9 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <asm/tlbflush.h> | 52 | #include <asm/tlbflush.h> |
53 | #include <asm/x86_init.h> | 53 | #include <asm/x86_init.h> |
54 | #include <asm/rtc.h> | 54 | #include <asm/rtc.h> |
55 | #include <asm/uv/uv.h> | ||
55 | 56 | ||
56 | #define EFI_DEBUG | 57 | #define EFI_DEBUG |
57 | 58 | ||
@@ -1210,3 +1211,22 @@ static int __init parse_efi_cmdline(char *str) | |||
1210 | return 0; | 1211 | return 0; |
1211 | } | 1212 | } |
1212 | early_param("efi", parse_efi_cmdline); | 1213 | early_param("efi", parse_efi_cmdline); |
1214 | |||
1215 | void __init efi_apply_memmap_quirks(void) | ||
1216 | { | ||
1217 | /* | ||
1218 | * Once setup is done earlier, unmap the EFI memory map on mismatched | ||
1219 | * firmware/kernel architectures since there is no support for runtime | ||
1220 | * services. | ||
1221 | */ | ||
1222 | if (!efi_is_native()) { | ||
1223 | pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); | ||
1224 | efi_unmap_memmap(); | ||
1225 | } | ||
1226 | |||
1227 | /* | ||
1228 | * UV doesn't support the new EFI pagetable mapping yet. | ||
1229 | */ | ||
1230 | if (is_uv_system()) | ||
1231 | set_bit(EFI_OLD_MEMMAP, &x86_efi_facility); | ||
1232 | } | ||
diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h index 7d01b8c56c00..cc04e67bfd05 100644 --- a/arch/x86/um/asm/barrier.h +++ b/arch/x86/um/asm/barrier.h | |||
@@ -40,11 +40,7 @@ | |||
40 | #define smp_rmb() barrier() | 40 | #define smp_rmb() barrier() |
41 | #endif /* CONFIG_X86_PPRO_FENCE */ | 41 | #endif /* CONFIG_X86_PPRO_FENCE */ |
42 | 42 | ||
43 | #ifdef CONFIG_X86_OOSTORE | ||
44 | #define smp_wmb() wmb() | ||
45 | #else /* CONFIG_X86_OOSTORE */ | ||
46 | #define smp_wmb() barrier() | 43 | #define smp_wmb() barrier() |
47 | #endif /* CONFIG_X86_OOSTORE */ | ||
48 | 44 | ||
49 | #define smp_read_barrier_depends() read_barrier_depends() | 45 | #define smp_read_barrier_depends() read_barrier_depends() |
50 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | 46 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index ba56e11cbf77..c87ae7c6e5f9 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -20,6 +20,7 @@ config XTENSA | |||
20 | select HAVE_FUNCTION_TRACER | 20 | select HAVE_FUNCTION_TRACER |
21 | select HAVE_IRQ_TIME_ACCOUNTING | 21 | select HAVE_IRQ_TIME_ACCOUNTING |
22 | select HAVE_PERF_EVENTS | 22 | select HAVE_PERF_EVENTS |
23 | select COMMON_CLK | ||
23 | help | 24 | help |
24 | Xtensa processors are 32-bit RISC machines designed by Tensilica | 25 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
25 | primarily for embedded systems. These processors are both | 26 | primarily for embedded systems. These processors are both |
@@ -80,7 +81,6 @@ choice | |||
80 | config XTENSA_VARIANT_FSF | 81 | config XTENSA_VARIANT_FSF |
81 | bool "fsf - default (not generic) configuration" | 82 | bool "fsf - default (not generic) configuration" |
82 | select MMU | 83 | select MMU |
83 | select HAVE_XTENSA_GPIO32 | ||
84 | 84 | ||
85 | config XTENSA_VARIANT_DC232B | 85 | config XTENSA_VARIANT_DC232B |
86 | bool "dc232b - Diamond 232L Standard Core Rev.B (LE)" | 86 | bool "dc232b - Diamond 232L Standard Core Rev.B (LE)" |
@@ -135,7 +135,6 @@ config HAVE_SMP | |||
135 | config SMP | 135 | config SMP |
136 | bool "Enable Symmetric multi-processing support" | 136 | bool "Enable Symmetric multi-processing support" |
137 | depends on HAVE_SMP | 137 | depends on HAVE_SMP |
138 | select USE_GENERIC_SMP_HELPERS | ||
139 | select GENERIC_SMP_IDLE_THREAD | 138 | select GENERIC_SMP_IDLE_THREAD |
140 | help | 139 | help |
141 | Enabled SMP Software; allows more than one CPU/CORE | 140 | Enabled SMP Software; allows more than one CPU/CORE |
diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi index 46b4f5eab421..e7370b11348e 100644 --- a/arch/xtensa/boot/dts/xtfpga.dtsi +++ b/arch/xtensa/boot/dts/xtfpga.dtsi | |||
@@ -35,6 +35,13 @@ | |||
35 | interrupt-controller; | 35 | interrupt-controller; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | clocks { | ||
39 | osc: main-oscillator { | ||
40 | #clock-cells = <0>; | ||
41 | compatible = "fixed-clock"; | ||
42 | }; | ||
43 | }; | ||
44 | |||
38 | serial0: serial@fd050020 { | 45 | serial0: serial@fd050020 { |
39 | device_type = "serial"; | 46 | device_type = "serial"; |
40 | compatible = "ns16550a"; | 47 | compatible = "ns16550a"; |
@@ -42,9 +49,7 @@ | |||
42 | reg = <0xfd050020 0x20>; | 49 | reg = <0xfd050020 0x20>; |
43 | reg-shift = <2>; | 50 | reg-shift = <2>; |
44 | interrupts = <0 1>; /* external irq 0 */ | 51 | interrupts = <0 1>; /* external irq 0 */ |
45 | /* Filled in by platform_setup from FPGA register | 52 | clocks = <&osc>; |
46 | * clock-frequency = <100000000>; | ||
47 | */ | ||
48 | }; | 53 | }; |
49 | 54 | ||
50 | enet0: ethoc@fd030000 { | 55 | enet0: ethoc@fd030000 { |
@@ -52,5 +57,6 @@ | |||
52 | reg = <0xfd030000 0x4000 0xfd800000 0x4000>; | 57 | reg = <0xfd030000 0x4000 0xfd800000 0x4000>; |
53 | interrupts = <1 1>; /* external irq 1 */ | 58 | interrupts = <1 1>; /* external irq 1 */ |
54 | local-mac-address = [00 50 c2 13 6f 00]; | 59 | local-mac-address = [00 50 c2 13 6f 00]; |
60 | clocks = <&osc>; | ||
55 | }; | 61 | }; |
56 | }; | 62 | }; |
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h index 2a042d430c25..74944207167e 100644 --- a/arch/xtensa/include/asm/io.h +++ b/arch/xtensa/include/asm/io.h | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #ifdef CONFIG_MMU | 26 | #ifdef CONFIG_MMU |
27 | 27 | ||
28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF | 28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF) |
29 | extern unsigned long xtensa_kio_paddr; | 29 | extern unsigned long xtensa_kio_paddr; |
30 | 30 | ||
31 | static inline unsigned long xtensa_get_kio_paddr(void) | 31 | static inline unsigned long xtensa_get_kio_paddr(void) |
diff --git a/arch/xtensa/include/asm/traps.h b/arch/xtensa/include/asm/traps.h index 8c194f6af45e..677bfcf4ee5d 100644 --- a/arch/xtensa/include/asm/traps.h +++ b/arch/xtensa/include/asm/traps.h | |||
@@ -23,25 +23,37 @@ void secondary_trap_init(void); | |||
23 | 23 | ||
24 | static inline void spill_registers(void) | 24 | static inline void spill_registers(void) |
25 | { | 25 | { |
26 | 26 | #if XCHAL_NUM_AREGS > 16 | |
27 | __asm__ __volatile__ ( | 27 | __asm__ __volatile__ ( |
28 | "movi a14, "__stringify((1 << PS_EXCM_BIT) | LOCKLEVEL)"\n\t" | 28 | " call12 1f\n" |
29 | "mov a12, a0\n\t" | 29 | " _j 2f\n" |
30 | "rsr a13, sar\n\t" | 30 | " retw\n" |
31 | "xsr a14, ps\n\t" | 31 | " .align 4\n" |
32 | "movi a0, _spill_registers\n\t" | 32 | "1:\n" |
33 | "rsync\n\t" | 33 | " _entry a1, 48\n" |
34 | "callx0 a0\n\t" | 34 | " addi a12, a0, 3\n" |
35 | "mov a0, a12\n\t" | 35 | #if XCHAL_NUM_AREGS > 32 |
36 | "wsr a13, sar\n\t" | 36 | " .rept (" __stringify(XCHAL_NUM_AREGS) " - 32) / 12\n" |
37 | "wsr a14, ps\n\t" | 37 | " _entry a1, 48\n" |
38 | : : | 38 | " mov a12, a0\n" |
39 | #if defined(CONFIG_FRAME_POINTER) | 39 | " .endr\n" |
40 | : "a2", "a3", "a4", "a11", "a12", "a13", "a14", "a15", | 40 | #endif |
41 | " _entry a1, 48\n" | ||
42 | #if XCHAL_NUM_AREGS % 12 == 0 | ||
43 | " mov a8, a8\n" | ||
44 | #elif XCHAL_NUM_AREGS % 12 == 4 | ||
45 | " mov a12, a12\n" | ||
46 | #elif XCHAL_NUM_AREGS % 12 == 8 | ||
47 | " mov a4, a4\n" | ||
48 | #endif | ||
49 | " retw\n" | ||
50 | "2:\n" | ||
51 | : : : "a12", "a13", "memory"); | ||
41 | #else | 52 | #else |
42 | : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", | 53 | __asm__ __volatile__ ( |
54 | " mov a12, a12\n" | ||
55 | : : : "memory"); | ||
43 | #endif | 56 | #endif |
44 | "memory"); | ||
45 | } | 57 | } |
46 | 58 | ||
47 | #endif /* _XTENSA_TRAPS_H */ | 59 | #endif /* _XTENSA_TRAPS_H */ |
diff --git a/arch/xtensa/include/asm/vectors.h b/arch/xtensa/include/asm/vectors.h index 5791b45d5a5d..f74ddfbb92ef 100644 --- a/arch/xtensa/include/asm/vectors.h +++ b/arch/xtensa/include/asm/vectors.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define XCHAL_KIO_DEFAULT_PADDR 0xf0000000 | 25 | #define XCHAL_KIO_DEFAULT_PADDR 0xf0000000 |
26 | #define XCHAL_KIO_SIZE 0x10000000 | 26 | #define XCHAL_KIO_SIZE 0x10000000 |
27 | 27 | ||
28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF | 28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF) |
29 | #define XCHAL_KIO_PADDR xtensa_get_kio_paddr() | 29 | #define XCHAL_KIO_PADDR xtensa_get_kio_paddr() |
30 | #else | 30 | #else |
31 | #define XCHAL_KIO_PADDR XCHAL_KIO_DEFAULT_PADDR | 31 | #define XCHAL_KIO_PADDR XCHAL_KIO_DEFAULT_PADDR |
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index 51940fec6990..b9395529f02d 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -734,7 +734,12 @@ __SYSCALL(332, sys_finit_module, 3) | |||
734 | #define __NR_accept4 333 | 734 | #define __NR_accept4 333 |
735 | __SYSCALL(333, sys_accept4, 4) | 735 | __SYSCALL(333, sys_accept4, 4) |
736 | 736 | ||
737 | #define __NR_syscall_count 334 | 737 | #define __NR_sched_setattr 334 |
738 | __SYSCALL(334, sys_sched_setattr, 2) | ||
739 | #define __NR_sched_getattr 335 | ||
740 | __SYSCALL(335, sys_sched_getattr, 3) | ||
741 | |||
742 | #define __NR_syscall_count 336 | ||
738 | 743 | ||
739 | /* | 744 | /* |
740 | * sysxtensa syscall handler | 745 | * sysxtensa syscall handler |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index 21dbe6bdb8ed..ef7f4990722b 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1081,196 +1081,53 @@ ENTRY(fast_syscall_spill_registers) | |||
1081 | 1081 | ||
1082 | rsr a0, sar | 1082 | rsr a0, sar |
1083 | s32i a3, a2, PT_AREG3 | 1083 | s32i a3, a2, PT_AREG3 |
1084 | s32i a4, a2, PT_AREG4 | 1084 | s32i a0, a2, PT_SAR |
1085 | s32i a0, a2, PT_AREG5 # store SAR to PT_AREG5 | ||
1086 | 1085 | ||
1087 | /* The spill routine might clobber a7, a11, and a15. */ | 1086 | /* The spill routine might clobber a4, a7, a8, a11, a12, and a15. */ |
1088 | 1087 | ||
1088 | s32i a4, a2, PT_AREG4 | ||
1089 | s32i a7, a2, PT_AREG7 | 1089 | s32i a7, a2, PT_AREG7 |
1090 | s32i a8, a2, PT_AREG8 | ||
1090 | s32i a11, a2, PT_AREG11 | 1091 | s32i a11, a2, PT_AREG11 |
1092 | s32i a12, a2, PT_AREG12 | ||
1091 | s32i a15, a2, PT_AREG15 | 1093 | s32i a15, a2, PT_AREG15 |
1092 | 1094 | ||
1093 | call0 _spill_registers # destroys a3, a4, and SAR | ||
1094 | |||
1095 | /* Advance PC, restore registers and SAR, and return from exception. */ | ||
1096 | |||
1097 | l32i a3, a2, PT_AREG5 | ||
1098 | l32i a4, a2, PT_AREG4 | ||
1099 | l32i a0, a2, PT_AREG0 | ||
1100 | wsr a3, sar | ||
1101 | l32i a3, a2, PT_AREG3 | ||
1102 | |||
1103 | /* Restore clobbered registers. */ | ||
1104 | |||
1105 | l32i a7, a2, PT_AREG7 | ||
1106 | l32i a11, a2, PT_AREG11 | ||
1107 | l32i a15, a2, PT_AREG15 | ||
1108 | |||
1109 | movi a2, 0 | ||
1110 | rfe | ||
1111 | |||
1112 | ENDPROC(fast_syscall_spill_registers) | ||
1113 | |||
1114 | /* Fixup handler. | ||
1115 | * | ||
1116 | * We get here if the spill routine causes an exception, e.g. tlb miss. | ||
1117 | * We basically restore WINDOWBASE and WINDOWSTART to the condition when | ||
1118 | * we entered the spill routine and jump to the user exception handler. | ||
1119 | * | ||
1120 | * a0: value of depc, original value in depc | ||
1121 | * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE | ||
1122 | * a3: exctable, original value in excsave1 | ||
1123 | */ | ||
1124 | |||
1125 | ENTRY(fast_syscall_spill_registers_fixup) | ||
1126 | |||
1127 | rsr a2, windowbase # get current windowbase (a2 is saved) | ||
1128 | xsr a0, depc # restore depc and a0 | ||
1129 | ssl a2 # set shift (32 - WB) | ||
1130 | |||
1131 | /* We need to make sure the current registers (a0-a3) are preserved. | ||
1132 | * To do this, we simply set the bit for the current window frame | ||
1133 | * in WS, so that the exception handlers save them to the task stack. | ||
1134 | */ | ||
1135 | |||
1136 | xsr a3, excsave1 # get spill-mask | ||
1137 | slli a3, a3, 1 # shift left by one | ||
1138 | |||
1139 | slli a2, a3, 32-WSBITS | ||
1140 | src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy...... | ||
1141 | wsr a2, windowstart # set corrected windowstart | ||
1142 | |||
1143 | srli a3, a3, 1 | ||
1144 | rsr a2, excsave1 | ||
1145 | l32i a2, a2, EXC_TABLE_DOUBLE_SAVE # restore a2 | ||
1146 | xsr a2, excsave1 | ||
1147 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE # save a3 | ||
1148 | l32i a3, a2, EXC_TABLE_PARAM # original WB (in user task) | ||
1149 | xsr a2, excsave1 | ||
1150 | |||
1151 | /* Return to the original (user task) WINDOWBASE. | ||
1152 | * We leave the following frame behind: | ||
1153 | * a0, a1, a2 same | ||
1154 | * a3: trashed (saved in EXC_TABLE_DOUBLE_SAVE) | ||
1155 | * depc: depc (we have to return to that address) | ||
1156 | * excsave_1: exctable | ||
1157 | */ | ||
1158 | |||
1159 | wsr a3, windowbase | ||
1160 | rsync | ||
1161 | |||
1162 | /* We are now in the original frame when we entered _spill_registers: | ||
1163 | * a0: return address | ||
1164 | * a1: used, stack pointer | ||
1165 | * a2: kernel stack pointer | ||
1166 | * a3: available | ||
1167 | * depc: exception address | ||
1168 | * excsave: exctable | ||
1169 | * Note: This frame might be the same as above. | ||
1170 | */ | ||
1171 | |||
1172 | /* Setup stack pointer. */ | ||
1173 | |||
1174 | addi a2, a2, -PT_USER_SIZE | ||
1175 | s32i a0, a2, PT_AREG0 | ||
1176 | |||
1177 | /* Make sure we return to this fixup handler. */ | ||
1178 | |||
1179 | movi a3, fast_syscall_spill_registers_fixup_return | ||
1180 | s32i a3, a2, PT_DEPC # setup depc | ||
1181 | |||
1182 | /* Jump to the exception handler. */ | ||
1183 | |||
1184 | rsr a3, excsave1 | ||
1185 | rsr a0, exccause | ||
1186 | addx4 a0, a0, a3 # find entry in table | ||
1187 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler | ||
1188 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1189 | jx a0 | ||
1190 | |||
1191 | ENDPROC(fast_syscall_spill_registers_fixup) | ||
1192 | |||
1193 | ENTRY(fast_syscall_spill_registers_fixup_return) | ||
1194 | |||
1195 | /* When we return here, all registers have been restored (a2: DEPC) */ | ||
1196 | |||
1197 | wsr a2, depc # exception address | ||
1198 | |||
1199 | /* Restore fixup handler. */ | ||
1200 | |||
1201 | rsr a2, excsave1 | ||
1202 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE | ||
1203 | movi a3, fast_syscall_spill_registers_fixup | ||
1204 | s32i a3, a2, EXC_TABLE_FIXUP | ||
1205 | rsr a3, windowbase | ||
1206 | s32i a3, a2, EXC_TABLE_PARAM | ||
1207 | l32i a2, a2, EXC_TABLE_KSTK | ||
1208 | |||
1209 | /* Load WB at the time the exception occurred. */ | ||
1210 | |||
1211 | rsr a3, sar # WB is still in SAR | ||
1212 | neg a3, a3 | ||
1213 | wsr a3, windowbase | ||
1214 | rsync | ||
1215 | |||
1216 | rsr a3, excsave1 | ||
1217 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1218 | |||
1219 | rfde | ||
1220 | |||
1221 | ENDPROC(fast_syscall_spill_registers_fixup_return) | ||
1222 | |||
1223 | /* | ||
1224 | * spill all registers. | ||
1225 | * | ||
1226 | * This is not a real function. The following conditions must be met: | ||
1227 | * | ||
1228 | * - must be called with call0. | ||
1229 | * - uses a3, a4 and SAR. | ||
1230 | * - the last 'valid' register of each frame are clobbered. | ||
1231 | * - the caller must have registered a fixup handler | ||
1232 | * (or be inside a critical section) | ||
1233 | * - PS_EXCM must be set (PS_WOE cleared?) | ||
1234 | */ | ||
1235 | |||
1236 | ENTRY(_spill_registers) | ||
1237 | |||
1238 | /* | 1095 | /* |
1239 | * Rotate ws so that the current windowbase is at bit 0. | 1096 | * Rotate ws so that the current windowbase is at bit 0. |
1240 | * Assume ws = xxxwww1yy (www1 current window frame). | 1097 | * Assume ws = xxxwww1yy (www1 current window frame). |
1241 | * Rotate ws right so that a4 = yyxxxwww1. | 1098 | * Rotate ws right so that a4 = yyxxxwww1. |
1242 | */ | 1099 | */ |
1243 | 1100 | ||
1244 | rsr a4, windowbase | 1101 | rsr a0, windowbase |
1245 | rsr a3, windowstart # a3 = xxxwww1yy | 1102 | rsr a3, windowstart # a3 = xxxwww1yy |
1246 | ssr a4 # holds WB | 1103 | ssr a0 # holds WB |
1247 | slli a4, a3, WSBITS | 1104 | slli a0, a3, WSBITS |
1248 | or a3, a3, a4 # a3 = xxxwww1yyxxxwww1yy | 1105 | or a3, a3, a0 # a3 = xxxwww1yyxxxwww1yy |
1249 | srl a3, a3 # a3 = 00xxxwww1yyxxxwww1 | 1106 | srl a3, a3 # a3 = 00xxxwww1yyxxxwww1 |
1250 | 1107 | ||
1251 | /* We are done if there are no more than the current register frame. */ | 1108 | /* We are done if there are no more than the current register frame. */ |
1252 | 1109 | ||
1253 | extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww | 1110 | extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww |
1254 | movi a4, (1 << (WSBITS-1)) | 1111 | movi a0, (1 << (WSBITS-1)) |
1255 | _beqz a3, .Lnospill # only one active frame? jump | 1112 | _beqz a3, .Lnospill # only one active frame? jump |
1256 | 1113 | ||
1257 | /* We want 1 at the top, so that we return to the current windowbase */ | 1114 | /* We want 1 at the top, so that we return to the current windowbase */ |
1258 | 1115 | ||
1259 | or a3, a3, a4 # 1yyxxxwww | 1116 | or a3, a3, a0 # 1yyxxxwww |
1260 | 1117 | ||
1261 | /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */ | 1118 | /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */ |
1262 | 1119 | ||
1263 | wsr a3, windowstart # save shifted windowstart | 1120 | wsr a3, windowstart # save shifted windowstart |
1264 | neg a4, a3 | 1121 | neg a0, a3 |
1265 | and a3, a4, a3 # first bit set from right: 000010000 | 1122 | and a3, a0, a3 # first bit set from right: 000010000 |
1266 | 1123 | ||
1267 | ffs_ws a4, a3 # a4: shifts to skip empty frames | 1124 | ffs_ws a0, a3 # a0: shifts to skip empty frames |
1268 | movi a3, WSBITS | 1125 | movi a3, WSBITS |
1269 | sub a4, a3, a4 # WSBITS-a4:number of 0-bits from right | 1126 | sub a0, a3, a0 # WSBITS-a0:number of 0-bits from right |
1270 | ssr a4 # save in SAR for later. | 1127 | ssr a0 # save in SAR for later. |
1271 | 1128 | ||
1272 | rsr a3, windowbase | 1129 | rsr a3, windowbase |
1273 | add a3, a3, a4 | 1130 | add a3, a3, a0 |
1274 | wsr a3, windowbase | 1131 | wsr a3, windowbase |
1275 | rsync | 1132 | rsync |
1276 | 1133 | ||
@@ -1285,22 +1142,6 @@ ENTRY(_spill_registers) | |||
1285 | * we have to save 4,8. or 12 registers. | 1142 | * we have to save 4,8. or 12 registers. |
1286 | */ | 1143 | */ |
1287 | 1144 | ||
1288 | _bbsi.l a3, 1, .Lc4 | ||
1289 | _bbsi.l a3, 2, .Lc8 | ||
1290 | |||
1291 | /* Special case: we have a call12-frame starting at a4. */ | ||
1292 | |||
1293 | _bbci.l a3, 3, .Lc12 # bit 3 shouldn't be zero! (Jump to Lc12 first) | ||
1294 | |||
1295 | s32e a4, a1, -16 # a1 is valid with an empty spill area | ||
1296 | l32e a4, a5, -12 | ||
1297 | s32e a8, a4, -48 | ||
1298 | mov a8, a4 | ||
1299 | l32e a4, a1, -16 | ||
1300 | j .Lc12c | ||
1301 | |||
1302 | .Lnospill: | ||
1303 | ret | ||
1304 | 1145 | ||
1305 | .Lloop: _bbsi.l a3, 1, .Lc4 | 1146 | .Lloop: _bbsi.l a3, 1, .Lc4 |
1306 | _bbci.l a3, 2, .Lc12 | 1147 | _bbci.l a3, 2, .Lc12 |
@@ -1314,20 +1155,10 @@ ENTRY(_spill_registers) | |||
1314 | s32e a9, a4, -28 | 1155 | s32e a9, a4, -28 |
1315 | s32e a10, a4, -24 | 1156 | s32e a10, a4, -24 |
1316 | s32e a11, a4, -20 | 1157 | s32e a11, a4, -20 |
1317 | |||
1318 | srli a11, a3, 2 # shift windowbase by 2 | 1158 | srli a11, a3, 2 # shift windowbase by 2 |
1319 | rotw 2 | 1159 | rotw 2 |
1320 | _bnei a3, 1, .Lloop | 1160 | _bnei a3, 1, .Lloop |
1321 | 1161 | j .Lexit | |
1322 | .Lexit: /* Done. Do the final rotation, set WS, and return. */ | ||
1323 | |||
1324 | rotw 1 | ||
1325 | rsr a3, windowbase | ||
1326 | ssl a3 | ||
1327 | movi a3, 1 | ||
1328 | sll a3, a3 | ||
1329 | wsr a3, windowstart | ||
1330 | ret | ||
1331 | 1162 | ||
1332 | .Lc4: s32e a4, a9, -16 | 1163 | .Lc4: s32e a4, a9, -16 |
1333 | s32e a5, a9, -12 | 1164 | s32e a5, a9, -12 |
@@ -1343,11 +1174,11 @@ ENTRY(_spill_registers) | |||
1343 | 1174 | ||
1344 | /* 12-register frame (call12) */ | 1175 | /* 12-register frame (call12) */ |
1345 | 1176 | ||
1346 | l32e a2, a5, -12 | 1177 | l32e a0, a5, -12 |
1347 | s32e a8, a2, -48 | 1178 | s32e a8, a0, -48 |
1348 | mov a8, a2 | 1179 | mov a8, a0 |
1349 | 1180 | ||
1350 | .Lc12c: s32e a9, a8, -44 | 1181 | s32e a9, a8, -44 |
1351 | s32e a10, a8, -40 | 1182 | s32e a10, a8, -40 |
1352 | s32e a11, a8, -36 | 1183 | s32e a11, a8, -36 |
1353 | s32e a12, a8, -32 | 1184 | s32e a12, a8, -32 |
@@ -1367,30 +1198,54 @@ ENTRY(_spill_registers) | |||
1367 | */ | 1198 | */ |
1368 | 1199 | ||
1369 | rotw 1 | 1200 | rotw 1 |
1370 | mov a5, a13 | 1201 | mov a4, a13 |
1371 | rotw -1 | 1202 | rotw -1 |
1372 | 1203 | ||
1373 | s32e a4, a9, -16 | 1204 | s32e a4, a8, -16 |
1374 | s32e a5, a9, -12 | 1205 | s32e a5, a8, -12 |
1375 | s32e a6, a9, -8 | 1206 | s32e a6, a8, -8 |
1376 | s32e a7, a9, -4 | 1207 | s32e a7, a8, -4 |
1377 | 1208 | ||
1378 | rotw 3 | 1209 | rotw 3 |
1379 | 1210 | ||
1380 | _beqi a3, 1, .Lexit | 1211 | _beqi a3, 1, .Lexit |
1381 | j .Lloop | 1212 | j .Lloop |
1382 | 1213 | ||
1383 | .Linvalid_mask: | 1214 | .Lexit: |
1384 | 1215 | ||
1385 | /* We get here because of an unrecoverable error in the window | 1216 | /* Done. Do the final rotation and set WS */ |
1386 | * registers. If we are in user space, we kill the application, | 1217 | |
1387 | * however, this condition is unrecoverable in kernel space. | 1218 | rotw 1 |
1388 | */ | 1219 | rsr a3, windowbase |
1220 | ssl a3 | ||
1221 | movi a3, 1 | ||
1222 | sll a3, a3 | ||
1223 | wsr a3, windowstart | ||
1224 | .Lnospill: | ||
1225 | |||
1226 | /* Advance PC, restore registers and SAR, and return from exception. */ | ||
1227 | |||
1228 | l32i a3, a2, PT_SAR | ||
1229 | l32i a0, a2, PT_AREG0 | ||
1230 | wsr a3, sar | ||
1231 | l32i a3, a2, PT_AREG3 | ||
1389 | 1232 | ||
1390 | rsr a0, ps | 1233 | /* Restore clobbered registers. */ |
1391 | _bbci.l a0, PS_UM_BIT, 1f | ||
1392 | 1234 | ||
1393 | /* User space: Setup a dummy frame and kill application. | 1235 | l32i a4, a2, PT_AREG4 |
1236 | l32i a7, a2, PT_AREG7 | ||
1237 | l32i a8, a2, PT_AREG8 | ||
1238 | l32i a11, a2, PT_AREG11 | ||
1239 | l32i a12, a2, PT_AREG12 | ||
1240 | l32i a15, a2, PT_AREG15 | ||
1241 | |||
1242 | movi a2, 0 | ||
1243 | rfe | ||
1244 | |||
1245 | .Linvalid_mask: | ||
1246 | |||
1247 | /* We get here because of an unrecoverable error in the window | ||
1248 | * registers, so set up a dummy frame and kill the user application. | ||
1394 | * Note: We assume EXC_TABLE_KSTK contains a valid stack pointer. | 1249 | * Note: We assume EXC_TABLE_KSTK contains a valid stack pointer. |
1395 | */ | 1250 | */ |
1396 | 1251 | ||
@@ -1414,14 +1269,136 @@ ENTRY(_spill_registers) | |||
1414 | movi a4, do_exit | 1269 | movi a4, do_exit |
1415 | callx4 a4 | 1270 | callx4 a4 |
1416 | 1271 | ||
1417 | 1: /* Kernel space: PANIC! */ | 1272 | /* shouldn't return, so panic */ |
1418 | 1273 | ||
1419 | wsr a0, excsave1 | 1274 | wsr a0, excsave1 |
1420 | movi a0, unrecoverable_exception | 1275 | movi a0, unrecoverable_exception |
1421 | callx0 a0 # should not return | 1276 | callx0 a0 # should not return |
1422 | 1: j 1b | 1277 | 1: j 1b |
1423 | 1278 | ||
1424 | ENDPROC(_spill_registers) | 1279 | |
1280 | ENDPROC(fast_syscall_spill_registers) | ||
1281 | |||
1282 | /* Fixup handler. | ||
1283 | * | ||
1284 | * We get here if the spill routine causes an exception, e.g. tlb miss. | ||
1285 | * We basically restore WINDOWBASE and WINDOWSTART to the condition when | ||
1286 | * we entered the spill routine and jump to the user exception handler. | ||
1287 | * | ||
1288 | * Note that we only need to restore the bits in windowstart that have not | ||
1289 | * been spilled yet by the _spill_register routine. Luckily, a3 contains a | ||
1290 | * rotated windowstart with only those bits set for frames that haven't been | ||
1291 | * spilled yet. Because a3 is rotated such that bit 0 represents the register | ||
1292 | * frame for the current windowbase - 1, we need to rotate a3 left by the | ||
1293 | * value of the current windowbase + 1 and move it to windowstart. | ||
1294 | * | ||
1295 | * a0: value of depc, original value in depc | ||
1296 | * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE | ||
1297 | * a3: exctable, original value in excsave1 | ||
1298 | */ | ||
1299 | |||
1300 | ENTRY(fast_syscall_spill_registers_fixup) | ||
1301 | |||
1302 | rsr a2, windowbase # get current windowbase (a2 is saved) | ||
1303 | xsr a0, depc # restore depc and a0 | ||
1304 | ssl a2 # set shift (32 - WB) | ||
1305 | |||
1306 | /* We need to make sure the current registers (a0-a3) are preserved. | ||
1307 | * To do this, we simply set the bit for the current window frame | ||
1308 | * in WS, so that the exception handlers save them to the task stack. | ||
1309 | * | ||
1310 | * Note: we use a3 to set the windowbase, so we take a special care | ||
1311 | * of it, saving it in the original _spill_registers frame across | ||
1312 | * the exception handler call. | ||
1313 | */ | ||
1314 | |||
1315 | xsr a3, excsave1 # get spill-mask | ||
1316 | slli a3, a3, 1 # shift left by one | ||
1317 | addi a3, a3, 1 # set the bit for the current window frame | ||
1318 | |||
1319 | slli a2, a3, 32-WSBITS | ||
1320 | src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy...... | ||
1321 | wsr a2, windowstart # set corrected windowstart | ||
1322 | |||
1323 | srli a3, a3, 1 | ||
1324 | rsr a2, excsave1 | ||
1325 | l32i a2, a2, EXC_TABLE_DOUBLE_SAVE # restore a2 | ||
1326 | xsr a2, excsave1 | ||
1327 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE # save a3 | ||
1328 | l32i a3, a2, EXC_TABLE_PARAM # original WB (in user task) | ||
1329 | xsr a2, excsave1 | ||
1330 | |||
1331 | /* Return to the original (user task) WINDOWBASE. | ||
1332 | * We leave the following frame behind: | ||
1333 | * a0, a1, a2 same | ||
1334 | * a3: trashed (saved in EXC_TABLE_DOUBLE_SAVE) | ||
1335 | * depc: depc (we have to return to that address) | ||
1336 | * excsave_1: exctable | ||
1337 | */ | ||
1338 | |||
1339 | wsr a3, windowbase | ||
1340 | rsync | ||
1341 | |||
1342 | /* We are now in the original frame when we entered _spill_registers: | ||
1343 | * a0: return address | ||
1344 | * a1: used, stack pointer | ||
1345 | * a2: kernel stack pointer | ||
1346 | * a3: available | ||
1347 | * depc: exception address | ||
1348 | * excsave: exctable | ||
1349 | * Note: This frame might be the same as above. | ||
1350 | */ | ||
1351 | |||
1352 | /* Setup stack pointer. */ | ||
1353 | |||
1354 | addi a2, a2, -PT_USER_SIZE | ||
1355 | s32i a0, a2, PT_AREG0 | ||
1356 | |||
1357 | /* Make sure we return to this fixup handler. */ | ||
1358 | |||
1359 | movi a3, fast_syscall_spill_registers_fixup_return | ||
1360 | s32i a3, a2, PT_DEPC # setup depc | ||
1361 | |||
1362 | /* Jump to the exception handler. */ | ||
1363 | |||
1364 | rsr a3, excsave1 | ||
1365 | rsr a0, exccause | ||
1366 | addx4 a0, a0, a3 # find entry in table | ||
1367 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler | ||
1368 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1369 | jx a0 | ||
1370 | |||
1371 | ENDPROC(fast_syscall_spill_registers_fixup) | ||
1372 | |||
1373 | ENTRY(fast_syscall_spill_registers_fixup_return) | ||
1374 | |||
1375 | /* When we return here, all registers have been restored (a2: DEPC) */ | ||
1376 | |||
1377 | wsr a2, depc # exception address | ||
1378 | |||
1379 | /* Restore fixup handler. */ | ||
1380 | |||
1381 | rsr a2, excsave1 | ||
1382 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE | ||
1383 | movi a3, fast_syscall_spill_registers_fixup | ||
1384 | s32i a3, a2, EXC_TABLE_FIXUP | ||
1385 | rsr a3, windowbase | ||
1386 | s32i a3, a2, EXC_TABLE_PARAM | ||
1387 | l32i a2, a2, EXC_TABLE_KSTK | ||
1388 | |||
1389 | /* Load WB at the time the exception occurred. */ | ||
1390 | |||
1391 | rsr a3, sar # WB is still in SAR | ||
1392 | neg a3, a3 | ||
1393 | wsr a3, windowbase | ||
1394 | rsync | ||
1395 | |||
1396 | rsr a3, excsave1 | ||
1397 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1398 | |||
1399 | rfde | ||
1400 | |||
1401 | ENDPROC(fast_syscall_spill_registers_fixup_return) | ||
1425 | 1402 | ||
1426 | #ifdef CONFIG_MMU | 1403 | #ifdef CONFIG_MMU |
1427 | /* | 1404 | /* |
@@ -1794,6 +1771,43 @@ ENTRY(system_call) | |||
1794 | 1771 | ||
1795 | ENDPROC(system_call) | 1772 | ENDPROC(system_call) |
1796 | 1773 | ||
1774 | /* | ||
1775 | * Spill live registers on the kernel stack macro. | ||
1776 | * | ||
1777 | * Entry condition: ps.woe is set, ps.excm is cleared | ||
1778 | * Exit condition: windowstart has single bit set | ||
1779 | * May clobber: a12, a13 | ||
1780 | */ | ||
1781 | .macro spill_registers_kernel | ||
1782 | |||
1783 | #if XCHAL_NUM_AREGS > 16 | ||
1784 | call12 1f | ||
1785 | _j 2f | ||
1786 | retw | ||
1787 | .align 4 | ||
1788 | 1: | ||
1789 | _entry a1, 48 | ||
1790 | addi a12, a0, 3 | ||
1791 | #if XCHAL_NUM_AREGS > 32 | ||
1792 | .rept (XCHAL_NUM_AREGS - 32) / 12 | ||
1793 | _entry a1, 48 | ||
1794 | mov a12, a0 | ||
1795 | .endr | ||
1796 | #endif | ||
1797 | _entry a1, 48 | ||
1798 | #if XCHAL_NUM_AREGS % 12 == 0 | ||
1799 | mov a8, a8 | ||
1800 | #elif XCHAL_NUM_AREGS % 12 == 4 | ||
1801 | mov a12, a12 | ||
1802 | #elif XCHAL_NUM_AREGS % 12 == 8 | ||
1803 | mov a4, a4 | ||
1804 | #endif | ||
1805 | retw | ||
1806 | 2: | ||
1807 | #else | ||
1808 | mov a12, a12 | ||
1809 | #endif | ||
1810 | .endm | ||
1797 | 1811 | ||
1798 | /* | 1812 | /* |
1799 | * Task switch. | 1813 | * Task switch. |
@@ -1806,21 +1820,20 @@ ENTRY(_switch_to) | |||
1806 | 1820 | ||
1807 | entry a1, 16 | 1821 | entry a1, 16 |
1808 | 1822 | ||
1809 | mov a12, a2 # preserve 'prev' (a2) | 1823 | mov a10, a2 # preserve 'prev' (a2) |
1810 | mov a13, a3 # and 'next' (a3) | 1824 | mov a11, a3 # and 'next' (a3) |
1811 | 1825 | ||
1812 | l32i a4, a2, TASK_THREAD_INFO | 1826 | l32i a4, a2, TASK_THREAD_INFO |
1813 | l32i a5, a3, TASK_THREAD_INFO | 1827 | l32i a5, a3, TASK_THREAD_INFO |
1814 | 1828 | ||
1815 | save_xtregs_user a4 a6 a8 a9 a10 a11 THREAD_XTREGS_USER | 1829 | save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
1816 | 1830 | ||
1817 | s32i a0, a12, THREAD_RA # save return address | 1831 | s32i a0, a10, THREAD_RA # save return address |
1818 | s32i a1, a12, THREAD_SP # save stack pointer | 1832 | s32i a1, a10, THREAD_SP # save stack pointer |
1819 | 1833 | ||
1820 | /* Disable ints while we manipulate the stack pointer. */ | 1834 | /* Disable ints while we manipulate the stack pointer. */ |
1821 | 1835 | ||
1822 | movi a14, (1 << PS_EXCM_BIT) | LOCKLEVEL | 1836 | rsil a14, LOCKLEVEL |
1823 | xsr a14, ps | ||
1824 | rsr a3, excsave1 | 1837 | rsr a3, excsave1 |
1825 | rsync | 1838 | rsync |
1826 | s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */ | 1839 | s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */ |
@@ -1835,7 +1848,7 @@ ENTRY(_switch_to) | |||
1835 | 1848 | ||
1836 | /* Flush register file. */ | 1849 | /* Flush register file. */ |
1837 | 1850 | ||
1838 | call0 _spill_registers # destroys a3, a4, and SAR | 1851 | spill_registers_kernel |
1839 | 1852 | ||
1840 | /* Set kernel stack (and leave critical section) | 1853 | /* Set kernel stack (and leave critical section) |
1841 | * Note: It's save to set it here. The stack will not be overwritten | 1854 | * Note: It's save to set it here. The stack will not be overwritten |
@@ -1851,13 +1864,13 @@ ENTRY(_switch_to) | |||
1851 | 1864 | ||
1852 | /* restore context of the task 'next' */ | 1865 | /* restore context of the task 'next' */ |
1853 | 1866 | ||
1854 | l32i a0, a13, THREAD_RA # restore return address | 1867 | l32i a0, a11, THREAD_RA # restore return address |
1855 | l32i a1, a13, THREAD_SP # restore stack pointer | 1868 | l32i a1, a11, THREAD_SP # restore stack pointer |
1856 | 1869 | ||
1857 | load_xtregs_user a5 a6 a8 a9 a10 a11 THREAD_XTREGS_USER | 1870 | load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
1858 | 1871 | ||
1859 | wsr a14, ps | 1872 | wsr a14, ps |
1860 | mov a2, a12 # return 'prev' | 1873 | mov a2, a10 # return 'prev' |
1861 | rsync | 1874 | rsync |
1862 | 1875 | ||
1863 | retw | 1876 | retw |
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 7d12af1317f1..84fe931bb60e 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/bootmem.h> | 22 | #include <linux/bootmem.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
25 | #include <linux/clk-provider.h> | ||
25 | #include <linux/cpu.h> | 26 | #include <linux/cpu.h> |
26 | #include <linux/of_fdt.h> | 27 | #include <linux/of_fdt.h> |
27 | #include <linux/of_platform.h> | 28 | #include <linux/of_platform.h> |
@@ -276,6 +277,7 @@ void __init early_init_devtree(void *params) | |||
276 | 277 | ||
277 | static int __init xtensa_device_probe(void) | 278 | static int __init xtensa_device_probe(void) |
278 | { | 279 | { |
280 | of_clk_init(NULL); | ||
279 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 281 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
280 | return 0; | 282 | return 0; |
281 | } | 283 | } |
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 08b769d3b3a1..2a1823de69cc 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <asm/platform.h> | 30 | #include <asm/platform.h> |
31 | 31 | ||
32 | unsigned long ccount_freq; /* ccount Hz */ | 32 | unsigned long ccount_freq; /* ccount Hz */ |
33 | EXPORT_SYMBOL(ccount_freq); | ||
33 | 34 | ||
34 | static cycle_t ccount_read(struct clocksource *cs) | 35 | static cycle_t ccount_read(struct clocksource *cs) |
35 | { | 36 | { |
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S index cb8fd44caabc..f9e1ec346e35 100644 --- a/arch/xtensa/kernel/vectors.S +++ b/arch/xtensa/kernel/vectors.S | |||
@@ -235,7 +235,7 @@ ENTRY(_DoubleExceptionVector) | |||
235 | 235 | ||
236 | /* Check for overflow/underflow exception, jump if overflow. */ | 236 | /* Check for overflow/underflow exception, jump if overflow. */ |
237 | 237 | ||
238 | _bbci.l a0, 6, _DoubleExceptionVector_WindowOverflow | 238 | bbci.l a0, 6, _DoubleExceptionVector_WindowOverflow |
239 | 239 | ||
240 | /* | 240 | /* |
241 | * Restart window underflow exception. | 241 | * Restart window underflow exception. |
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c index 74a60c7e085e..80b33ed51f31 100644 --- a/arch/xtensa/kernel/xtensa_ksyms.c +++ b/arch/xtensa/kernel/xtensa_ksyms.c | |||
@@ -122,9 +122,7 @@ EXPORT_SYMBOL(insw); | |||
122 | EXPORT_SYMBOL(insl); | 122 | EXPORT_SYMBOL(insl); |
123 | 123 | ||
124 | extern long common_exception_return; | 124 | extern long common_exception_return; |
125 | extern long _spill_registers; | ||
126 | EXPORT_SYMBOL(common_exception_return); | 125 | EXPORT_SYMBOL(common_exception_return); |
127 | EXPORT_SYMBOL(_spill_registers); | ||
128 | 126 | ||
129 | #ifdef CONFIG_FUNCTION_TRACER | 127 | #ifdef CONFIG_FUNCTION_TRACER |
130 | EXPORT_SYMBOL(_mcount); | 128 | EXPORT_SYMBOL(_mcount); |
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index 479d7537a32a..aff108df92d3 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c | |||
@@ -90,7 +90,7 @@ int __init mem_reserve(unsigned long start, unsigned long end, int must_exist) | |||
90 | 90 | ||
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Initialize the bootmem system and give it all the memory we have available. | 93 | * Initialize the bootmem system and give it all low memory we have available. |
94 | */ | 94 | */ |
95 | 95 | ||
96 | void __init bootmem_init(void) | 96 | void __init bootmem_init(void) |
@@ -142,9 +142,14 @@ void __init bootmem_init(void) | |||
142 | 142 | ||
143 | /* Add all remaining memory pieces into the bootmem map */ | 143 | /* Add all remaining memory pieces into the bootmem map */ |
144 | 144 | ||
145 | for (i=0; i<sysmem.nr_banks; i++) | 145 | for (i = 0; i < sysmem.nr_banks; i++) { |
146 | free_bootmem(sysmem.bank[i].start, | 146 | if (sysmem.bank[i].start >> PAGE_SHIFT < max_low_pfn) { |
147 | sysmem.bank[i].end - sysmem.bank[i].start); | 147 | unsigned long end = min(max_low_pfn << PAGE_SHIFT, |
148 | sysmem.bank[i].end); | ||
149 | free_bootmem(sysmem.bank[i].start, | ||
150 | end - sysmem.bank[i].start); | ||
151 | } | ||
152 | } | ||
148 | 153 | ||
149 | } | 154 | } |
150 | 155 | ||
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c index 36ec171698b8..861203e958da 100644 --- a/arch/xtensa/mm/mmu.c +++ b/arch/xtensa/mm/mmu.c | |||
@@ -39,7 +39,7 @@ void init_mmu(void) | |||
39 | set_itlbcfg_register(0); | 39 | set_itlbcfg_register(0); |
40 | set_dtlbcfg_register(0); | 40 | set_dtlbcfg_register(0); |
41 | #endif | 41 | #endif |
42 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF | 42 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF) |
43 | /* | 43 | /* |
44 | * Update the IO area mapping in case xtensa_kio_paddr has changed | 44 | * Update the IO area mapping in case xtensa_kio_paddr has changed |
45 | */ | 45 | */ |
diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c index 800227862fe8..57fd08b36f51 100644 --- a/arch/xtensa/platforms/xtfpga/setup.c +++ b/arch/xtensa/platforms/xtfpga/setup.c | |||
@@ -135,11 +135,11 @@ static void __init update_local_mac(struct device_node *node) | |||
135 | 135 | ||
136 | static int __init machine_setup(void) | 136 | static int __init machine_setup(void) |
137 | { | 137 | { |
138 | struct device_node *serial; | 138 | struct device_node *clock; |
139 | struct device_node *eth = NULL; | 139 | struct device_node *eth = NULL; |
140 | 140 | ||
141 | for_each_compatible_node(serial, NULL, "ns16550a") | 141 | for_each_node_by_name(clock, "main-oscillator") |
142 | update_clock_frequency(serial); | 142 | update_clock_frequency(clock); |
143 | 143 | ||
144 | if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc"))) | 144 | if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc"))) |
145 | update_local_mac(eth); | 145 | update_local_mac(eth); |
@@ -290,6 +290,7 @@ static int __init xtavnet_init(void) | |||
290 | * knows whether they set it correctly on the DIP switches. | 290 | * knows whether they set it correctly on the DIP switches. |
291 | */ | 291 | */ |
292 | pr_info("XTFPGA: Ethernet MAC %pM\n", ethoc_pdata.hwaddr); | 292 | pr_info("XTFPGA: Ethernet MAC %pM\n", ethoc_pdata.hwaddr); |
293 | ethoc_pdata.eth_clkfreq = *(long *)XTFPGA_CLKFRQ_VADDR; | ||
293 | 294 | ||
294 | return 0; | 295 | return 0; |
295 | } | 296 | } |
diff --git a/arch/xtensa/variants/fsf/include/variant/tie.h b/arch/xtensa/variants/fsf/include/variant/tie.h index bf4020116df5..244cdea4dee5 100644 --- a/arch/xtensa/variants/fsf/include/variant/tie.h +++ b/arch/xtensa/variants/fsf/include/variant/tie.h | |||
@@ -18,13 +18,6 @@ | |||
18 | #define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */ | 18 | #define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */ |
19 | #define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */ | 19 | #define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */ |
20 | 20 | ||
21 | /* Basic parameters of each coprocessor: */ | ||
22 | #define XCHAL_CP7_NAME "XTIOP" | ||
23 | #define XCHAL_CP7_IDENT XTIOP | ||
24 | #define XCHAL_CP7_SA_SIZE 0 /* size of state save area */ | ||
25 | #define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */ | ||
26 | #define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */ | ||
27 | |||
28 | /* Filler info for unassigned coprocessors, to simplify arrays etc: */ | 21 | /* Filler info for unassigned coprocessors, to simplify arrays etc: */ |
29 | #define XCHAL_NCP_SA_SIZE 0 | 22 | #define XCHAL_NCP_SA_SIZE 0 |
30 | #define XCHAL_NCP_SA_ALIGN 1 | 23 | #define XCHAL_NCP_SA_ALIGN 1 |
@@ -42,6 +35,8 @@ | |||
42 | #define XCHAL_CP5_SA_ALIGN 1 | 35 | #define XCHAL_CP5_SA_ALIGN 1 |
43 | #define XCHAL_CP6_SA_SIZE 0 | 36 | #define XCHAL_CP6_SA_SIZE 0 |
44 | #define XCHAL_CP6_SA_ALIGN 1 | 37 | #define XCHAL_CP6_SA_ALIGN 1 |
38 | #define XCHAL_CP7_SA_SIZE 0 | ||
39 | #define XCHAL_CP7_SA_ALIGN 1 | ||
45 | 40 | ||
46 | /* Save area for non-coprocessor optional and custom (TIE) state: */ | 41 | /* Save area for non-coprocessor optional and custom (TIE) state: */ |
47 | #define XCHAL_NCP_SA_SIZE 0 | 42 | #define XCHAL_NCP_SA_SIZE 0 |
diff --git a/block/blk-core.c b/block/blk-core.c index 853f92749202..bfe16d5af9f9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -693,20 +693,11 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) | |||
693 | if (!uninit_q) | 693 | if (!uninit_q) |
694 | return NULL; | 694 | return NULL; |
695 | 695 | ||
696 | uninit_q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL); | ||
697 | if (!uninit_q->flush_rq) | ||
698 | goto out_cleanup_queue; | ||
699 | |||
700 | q = blk_init_allocated_queue(uninit_q, rfn, lock); | 696 | q = blk_init_allocated_queue(uninit_q, rfn, lock); |
701 | if (!q) | 697 | if (!q) |
702 | goto out_free_flush_rq; | 698 | blk_cleanup_queue(uninit_q); |
703 | return q; | ||
704 | 699 | ||
705 | out_free_flush_rq: | 700 | return q; |
706 | kfree(uninit_q->flush_rq); | ||
707 | out_cleanup_queue: | ||
708 | blk_cleanup_queue(uninit_q); | ||
709 | return NULL; | ||
710 | } | 701 | } |
711 | EXPORT_SYMBOL(blk_init_queue_node); | 702 | EXPORT_SYMBOL(blk_init_queue_node); |
712 | 703 | ||
@@ -717,9 +708,13 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, | |||
717 | if (!q) | 708 | if (!q) |
718 | return NULL; | 709 | return NULL; |
719 | 710 | ||
720 | if (blk_init_rl(&q->root_rl, q, GFP_KERNEL)) | 711 | q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL); |
712 | if (!q->flush_rq) | ||
721 | return NULL; | 713 | return NULL; |
722 | 714 | ||
715 | if (blk_init_rl(&q->root_rl, q, GFP_KERNEL)) | ||
716 | goto fail; | ||
717 | |||
723 | q->request_fn = rfn; | 718 | q->request_fn = rfn; |
724 | q->prep_rq_fn = NULL; | 719 | q->prep_rq_fn = NULL; |
725 | q->unprep_rq_fn = NULL; | 720 | q->unprep_rq_fn = NULL; |
@@ -742,12 +737,16 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, | |||
742 | /* init elevator */ | 737 | /* init elevator */ |
743 | if (elevator_init(q, NULL)) { | 738 | if (elevator_init(q, NULL)) { |
744 | mutex_unlock(&q->sysfs_lock); | 739 | mutex_unlock(&q->sysfs_lock); |
745 | return NULL; | 740 | goto fail; |
746 | } | 741 | } |
747 | 742 | ||
748 | mutex_unlock(&q->sysfs_lock); | 743 | mutex_unlock(&q->sysfs_lock); |
749 | 744 | ||
750 | return q; | 745 | return q; |
746 | |||
747 | fail: | ||
748 | kfree(q->flush_rq); | ||
749 | return NULL; | ||
751 | } | 750 | } |
752 | EXPORT_SYMBOL(blk_init_allocated_queue); | 751 | EXPORT_SYMBOL(blk_init_allocated_queue); |
753 | 752 | ||
diff --git a/block/blk-exec.c b/block/blk-exec.c index c68613bb4c79..dbf4502b1d67 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c | |||
@@ -65,7 +65,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, | |||
65 | * be resued after dying flag is set | 65 | * be resued after dying flag is set |
66 | */ | 66 | */ |
67 | if (q->mq_ops) { | 67 | if (q->mq_ops) { |
68 | blk_mq_insert_request(q, rq, at_head, true); | 68 | blk_mq_insert_request(rq, at_head, true, false); |
69 | return; | 69 | return; |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/block/blk-flush.c b/block/blk-flush.c index 66e2b697f5db..43e6b4755e9a 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -137,17 +137,20 @@ static void mq_flush_run(struct work_struct *work) | |||
137 | rq = container_of(work, struct request, mq_flush_work); | 137 | rq = container_of(work, struct request, mq_flush_work); |
138 | 138 | ||
139 | memset(&rq->csd, 0, sizeof(rq->csd)); | 139 | memset(&rq->csd, 0, sizeof(rq->csd)); |
140 | blk_mq_run_request(rq, true, false); | 140 | blk_mq_insert_request(rq, false, true, false); |
141 | } | 141 | } |
142 | 142 | ||
143 | static bool blk_flush_queue_rq(struct request *rq) | 143 | static bool blk_flush_queue_rq(struct request *rq, bool add_front) |
144 | { | 144 | { |
145 | if (rq->q->mq_ops) { | 145 | if (rq->q->mq_ops) { |
146 | INIT_WORK(&rq->mq_flush_work, mq_flush_run); | 146 | INIT_WORK(&rq->mq_flush_work, mq_flush_run); |
147 | kblockd_schedule_work(rq->q, &rq->mq_flush_work); | 147 | kblockd_schedule_work(rq->q, &rq->mq_flush_work); |
148 | return false; | 148 | return false; |
149 | } else { | 149 | } else { |
150 | list_add_tail(&rq->queuelist, &rq->q->queue_head); | 150 | if (add_front) |
151 | list_add(&rq->queuelist, &rq->q->queue_head); | ||
152 | else | ||
153 | list_add_tail(&rq->queuelist, &rq->q->queue_head); | ||
151 | return true; | 154 | return true; |
152 | } | 155 | } |
153 | } | 156 | } |
@@ -193,7 +196,7 @@ static bool blk_flush_complete_seq(struct request *rq, unsigned int seq, | |||
193 | 196 | ||
194 | case REQ_FSEQ_DATA: | 197 | case REQ_FSEQ_DATA: |
195 | list_move_tail(&rq->flush.list, &q->flush_data_in_flight); | 198 | list_move_tail(&rq->flush.list, &q->flush_data_in_flight); |
196 | queued = blk_flush_queue_rq(rq); | 199 | queued = blk_flush_queue_rq(rq, true); |
197 | break; | 200 | break; |
198 | 201 | ||
199 | case REQ_FSEQ_DONE: | 202 | case REQ_FSEQ_DONE: |
@@ -326,7 +329,7 @@ static bool blk_kick_flush(struct request_queue *q) | |||
326 | q->flush_rq->rq_disk = first_rq->rq_disk; | 329 | q->flush_rq->rq_disk = first_rq->rq_disk; |
327 | q->flush_rq->end_io = flush_end_io; | 330 | q->flush_rq->end_io = flush_end_io; |
328 | 331 | ||
329 | return blk_flush_queue_rq(q->flush_rq); | 332 | return blk_flush_queue_rq(q->flush_rq, false); |
330 | } | 333 | } |
331 | 334 | ||
332 | static void flush_data_end_io(struct request *rq, int error) | 335 | static void flush_data_end_io(struct request *rq, int error) |
@@ -411,7 +414,7 @@ void blk_insert_flush(struct request *rq) | |||
411 | if ((policy & REQ_FSEQ_DATA) && | 414 | if ((policy & REQ_FSEQ_DATA) && |
412 | !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { | 415 | !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { |
413 | if (q->mq_ops) { | 416 | if (q->mq_ops) { |
414 | blk_mq_run_request(rq, false, true); | 417 | blk_mq_insert_request(rq, false, false, true); |
415 | } else | 418 | } else |
416 | list_add_tail(&rq->queuelist, &q->queue_head); | 419 | list_add_tail(&rq->queuelist, &q->queue_head); |
417 | return; | 420 | return; |
diff --git a/block/blk-mq-cpu.c b/block/blk-mq-cpu.c index 3146befb56aa..136ef8643bba 100644 --- a/block/blk-mq-cpu.c +++ b/block/blk-mq-cpu.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include "blk-mq.h" | 11 | #include "blk-mq.h" |
12 | 12 | ||
13 | static LIST_HEAD(blk_mq_cpu_notify_list); | 13 | static LIST_HEAD(blk_mq_cpu_notify_list); |
14 | static DEFINE_SPINLOCK(blk_mq_cpu_notify_lock); | 14 | static DEFINE_RAW_SPINLOCK(blk_mq_cpu_notify_lock); |
15 | 15 | ||
16 | static int blk_mq_main_cpu_notify(struct notifier_block *self, | 16 | static int blk_mq_main_cpu_notify(struct notifier_block *self, |
17 | unsigned long action, void *hcpu) | 17 | unsigned long action, void *hcpu) |
@@ -19,12 +19,12 @@ static int blk_mq_main_cpu_notify(struct notifier_block *self, | |||
19 | unsigned int cpu = (unsigned long) hcpu; | 19 | unsigned int cpu = (unsigned long) hcpu; |
20 | struct blk_mq_cpu_notifier *notify; | 20 | struct blk_mq_cpu_notifier *notify; |
21 | 21 | ||
22 | spin_lock(&blk_mq_cpu_notify_lock); | 22 | raw_spin_lock(&blk_mq_cpu_notify_lock); |
23 | 23 | ||
24 | list_for_each_entry(notify, &blk_mq_cpu_notify_list, list) | 24 | list_for_each_entry(notify, &blk_mq_cpu_notify_list, list) |
25 | notify->notify(notify->data, action, cpu); | 25 | notify->notify(notify->data, action, cpu); |
26 | 26 | ||
27 | spin_unlock(&blk_mq_cpu_notify_lock); | 27 | raw_spin_unlock(&blk_mq_cpu_notify_lock); |
28 | return NOTIFY_OK; | 28 | return NOTIFY_OK; |
29 | } | 29 | } |
30 | 30 | ||
@@ -32,16 +32,16 @@ void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier) | |||
32 | { | 32 | { |
33 | BUG_ON(!notifier->notify); | 33 | BUG_ON(!notifier->notify); |
34 | 34 | ||
35 | spin_lock(&blk_mq_cpu_notify_lock); | 35 | raw_spin_lock(&blk_mq_cpu_notify_lock); |
36 | list_add_tail(¬ifier->list, &blk_mq_cpu_notify_list); | 36 | list_add_tail(¬ifier->list, &blk_mq_cpu_notify_list); |
37 | spin_unlock(&blk_mq_cpu_notify_lock); | 37 | raw_spin_unlock(&blk_mq_cpu_notify_lock); |
38 | } | 38 | } |
39 | 39 | ||
40 | void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier) | 40 | void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier) |
41 | { | 41 | { |
42 | spin_lock(&blk_mq_cpu_notify_lock); | 42 | raw_spin_lock(&blk_mq_cpu_notify_lock); |
43 | list_del(¬ifier->list); | 43 | list_del(¬ifier->list); |
44 | spin_unlock(&blk_mq_cpu_notify_lock); | 44 | raw_spin_unlock(&blk_mq_cpu_notify_lock); |
45 | } | 45 | } |
46 | 46 | ||
47 | void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier, | 47 | void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier, |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 1fa9dd153fde..883f72089015 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -73,8 +73,8 @@ static void blk_mq_hctx_mark_pending(struct blk_mq_hw_ctx *hctx, | |||
73 | set_bit(ctx->index_hw, hctx->ctx_map); | 73 | set_bit(ctx->index_hw, hctx->ctx_map); |
74 | } | 74 | } |
75 | 75 | ||
76 | static struct request *blk_mq_alloc_rq(struct blk_mq_hw_ctx *hctx, gfp_t gfp, | 76 | static struct request *__blk_mq_alloc_request(struct blk_mq_hw_ctx *hctx, |
77 | bool reserved) | 77 | gfp_t gfp, bool reserved) |
78 | { | 78 | { |
79 | struct request *rq; | 79 | struct request *rq; |
80 | unsigned int tag; | 80 | unsigned int tag; |
@@ -193,12 +193,6 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx, | |||
193 | ctx->rq_dispatched[rw_is_sync(rw_flags)]++; | 193 | ctx->rq_dispatched[rw_is_sync(rw_flags)]++; |
194 | } | 194 | } |
195 | 195 | ||
196 | static struct request *__blk_mq_alloc_request(struct blk_mq_hw_ctx *hctx, | ||
197 | gfp_t gfp, bool reserved) | ||
198 | { | ||
199 | return blk_mq_alloc_rq(hctx, gfp, reserved); | ||
200 | } | ||
201 | |||
202 | static struct request *blk_mq_alloc_request_pinned(struct request_queue *q, | 196 | static struct request *blk_mq_alloc_request_pinned(struct request_queue *q, |
203 | int rw, gfp_t gfp, | 197 | int rw, gfp_t gfp, |
204 | bool reserved) | 198 | bool reserved) |
@@ -289,38 +283,10 @@ void blk_mq_free_request(struct request *rq) | |||
289 | __blk_mq_free_request(hctx, ctx, rq); | 283 | __blk_mq_free_request(hctx, ctx, rq); |
290 | } | 284 | } |
291 | 285 | ||
292 | static void blk_mq_bio_endio(struct request *rq, struct bio *bio, int error) | 286 | bool blk_mq_end_io_partial(struct request *rq, int error, unsigned int nr_bytes) |
293 | { | ||
294 | if (error) | ||
295 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
296 | else if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | ||
297 | error = -EIO; | ||
298 | |||
299 | if (unlikely(rq->cmd_flags & REQ_QUIET)) | ||
300 | set_bit(BIO_QUIET, &bio->bi_flags); | ||
301 | |||
302 | /* don't actually finish bio if it's part of flush sequence */ | ||
303 | if (!(rq->cmd_flags & REQ_FLUSH_SEQ)) | ||
304 | bio_endio(bio, error); | ||
305 | } | ||
306 | |||
307 | void blk_mq_end_io(struct request *rq, int error) | ||
308 | { | 287 | { |
309 | struct bio *bio = rq->bio; | 288 | if (blk_update_request(rq, error, blk_rq_bytes(rq))) |
310 | unsigned int bytes = 0; | 289 | return true; |
311 | |||
312 | trace_block_rq_complete(rq->q, rq); | ||
313 | |||
314 | while (bio) { | ||
315 | struct bio *next = bio->bi_next; | ||
316 | |||
317 | bio->bi_next = NULL; | ||
318 | bytes += bio->bi_iter.bi_size; | ||
319 | blk_mq_bio_endio(rq, bio, error); | ||
320 | bio = next; | ||
321 | } | ||
322 | |||
323 | blk_account_io_completion(rq, bytes); | ||
324 | 290 | ||
325 | blk_account_io_done(rq); | 291 | blk_account_io_done(rq); |
326 | 292 | ||
@@ -328,8 +294,9 @@ void blk_mq_end_io(struct request *rq, int error) | |||
328 | rq->end_io(rq, error); | 294 | rq->end_io(rq, error); |
329 | else | 295 | else |
330 | blk_mq_free_request(rq); | 296 | blk_mq_free_request(rq); |
297 | return false; | ||
331 | } | 298 | } |
332 | EXPORT_SYMBOL(blk_mq_end_io); | 299 | EXPORT_SYMBOL(blk_mq_end_io_partial); |
333 | 300 | ||
334 | static void __blk_mq_complete_request_remote(void *data) | 301 | static void __blk_mq_complete_request_remote(void *data) |
335 | { | 302 | { |
@@ -730,60 +697,27 @@ static void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, | |||
730 | blk_mq_add_timer(rq); | 697 | blk_mq_add_timer(rq); |
731 | } | 698 | } |
732 | 699 | ||
733 | void blk_mq_insert_request(struct request_queue *q, struct request *rq, | 700 | void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue, |
734 | bool at_head, bool run_queue) | 701 | bool async) |
735 | { | 702 | { |
703 | struct request_queue *q = rq->q; | ||
736 | struct blk_mq_hw_ctx *hctx; | 704 | struct blk_mq_hw_ctx *hctx; |
737 | struct blk_mq_ctx *ctx, *current_ctx; | 705 | struct blk_mq_ctx *ctx = rq->mq_ctx, *current_ctx; |
706 | |||
707 | current_ctx = blk_mq_get_ctx(q); | ||
708 | if (!cpu_online(ctx->cpu)) | ||
709 | rq->mq_ctx = ctx = current_ctx; | ||
738 | 710 | ||
739 | ctx = rq->mq_ctx; | ||
740 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | 711 | hctx = q->mq_ops->map_queue(q, ctx->cpu); |
741 | 712 | ||
742 | if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA)) { | 713 | if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA) && |
714 | !(rq->cmd_flags & (REQ_FLUSH_SEQ))) { | ||
743 | blk_insert_flush(rq); | 715 | blk_insert_flush(rq); |
744 | } else { | 716 | } else { |
745 | current_ctx = blk_mq_get_ctx(q); | ||
746 | |||
747 | if (!cpu_online(ctx->cpu)) { | ||
748 | ctx = current_ctx; | ||
749 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | ||
750 | rq->mq_ctx = ctx; | ||
751 | } | ||
752 | spin_lock(&ctx->lock); | 717 | spin_lock(&ctx->lock); |
753 | __blk_mq_insert_request(hctx, rq, at_head); | 718 | __blk_mq_insert_request(hctx, rq, at_head); |
754 | spin_unlock(&ctx->lock); | 719 | spin_unlock(&ctx->lock); |
755 | |||
756 | blk_mq_put_ctx(current_ctx); | ||
757 | } | ||
758 | |||
759 | if (run_queue) | ||
760 | __blk_mq_run_hw_queue(hctx); | ||
761 | } | ||
762 | EXPORT_SYMBOL(blk_mq_insert_request); | ||
763 | |||
764 | /* | ||
765 | * This is a special version of blk_mq_insert_request to bypass FLUSH request | ||
766 | * check. Should only be used internally. | ||
767 | */ | ||
768 | void blk_mq_run_request(struct request *rq, bool run_queue, bool async) | ||
769 | { | ||
770 | struct request_queue *q = rq->q; | ||
771 | struct blk_mq_hw_ctx *hctx; | ||
772 | struct blk_mq_ctx *ctx, *current_ctx; | ||
773 | |||
774 | current_ctx = blk_mq_get_ctx(q); | ||
775 | |||
776 | ctx = rq->mq_ctx; | ||
777 | if (!cpu_online(ctx->cpu)) { | ||
778 | ctx = current_ctx; | ||
779 | rq->mq_ctx = ctx; | ||
780 | } | 720 | } |
781 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | ||
782 | |||
783 | /* ctx->cpu might be offline */ | ||
784 | spin_lock(&ctx->lock); | ||
785 | __blk_mq_insert_request(hctx, rq, false); | ||
786 | spin_unlock(&ctx->lock); | ||
787 | 721 | ||
788 | blk_mq_put_ctx(current_ctx); | 722 | blk_mq_put_ctx(current_ctx); |
789 | 723 | ||
@@ -926,6 +860,8 @@ static void blk_mq_make_request(struct request_queue *q, struct bio *bio) | |||
926 | ctx = blk_mq_get_ctx(q); | 860 | ctx = blk_mq_get_ctx(q); |
927 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | 861 | hctx = q->mq_ops->map_queue(q, ctx->cpu); |
928 | 862 | ||
863 | if (is_sync) | ||
864 | rw |= REQ_SYNC; | ||
929 | trace_block_getrq(q, bio, rw); | 865 | trace_block_getrq(q, bio, rw); |
930 | rq = __blk_mq_alloc_request(hctx, GFP_ATOMIC, false); | 866 | rq = __blk_mq_alloc_request(hctx, GFP_ATOMIC, false); |
931 | if (likely(rq)) | 867 | if (likely(rq)) |
diff --git a/block/blk-mq.h b/block/blk-mq.h index ed0035cd458e..72beba1f9d55 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h | |||
@@ -23,7 +23,6 @@ struct blk_mq_ctx { | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | void __blk_mq_complete_request(struct request *rq); | 25 | void __blk_mq_complete_request(struct request *rq); |
26 | void blk_mq_run_request(struct request *rq, bool run_queue, bool async); | ||
27 | void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); | 26 | void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); |
28 | void blk_mq_init_flush(struct request_queue *q); | 27 | void blk_mq_init_flush(struct request_queue *q); |
29 | void blk_mq_drain_queue(struct request_queue *q); | 28 | void blk_mq_drain_queue(struct request_queue *q); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 959d41acc108..d7d32c28829b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -67,6 +67,8 @@ enum ec_command { | |||
67 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 67 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ |
68 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 68 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
69 | #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ | 69 | #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ |
70 | #define ACPI_EC_CLEAR_MAX 100 /* Maximum number of events to query | ||
71 | * when trying to clear the EC */ | ||
70 | 72 | ||
71 | enum { | 73 | enum { |
72 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 74 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
@@ -116,6 +118,7 @@ EXPORT_SYMBOL(first_ec); | |||
116 | static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ | 118 | static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ |
117 | static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */ | 119 | static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */ |
118 | static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */ | 120 | static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */ |
121 | static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */ | ||
119 | 122 | ||
120 | /* -------------------------------------------------------------------------- | 123 | /* -------------------------------------------------------------------------- |
121 | Transaction Management | 124 | Transaction Management |
@@ -440,6 +443,29 @@ acpi_handle ec_get_handle(void) | |||
440 | 443 | ||
441 | EXPORT_SYMBOL(ec_get_handle); | 444 | EXPORT_SYMBOL(ec_get_handle); |
442 | 445 | ||
446 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data); | ||
447 | |||
448 | /* | ||
449 | * Clears stale _Q events that might have accumulated in the EC. | ||
450 | * Run with locked ec mutex. | ||
451 | */ | ||
452 | static void acpi_ec_clear(struct acpi_ec *ec) | ||
453 | { | ||
454 | int i, status; | ||
455 | u8 value = 0; | ||
456 | |||
457 | for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) { | ||
458 | status = acpi_ec_query_unlocked(ec, &value); | ||
459 | if (status || !value) | ||
460 | break; | ||
461 | } | ||
462 | |||
463 | if (unlikely(i == ACPI_EC_CLEAR_MAX)) | ||
464 | pr_warn("Warning: Maximum of %d stale EC events cleared\n", i); | ||
465 | else | ||
466 | pr_info("%d stale EC events cleared\n", i); | ||
467 | } | ||
468 | |||
443 | void acpi_ec_block_transactions(void) | 469 | void acpi_ec_block_transactions(void) |
444 | { | 470 | { |
445 | struct acpi_ec *ec = first_ec; | 471 | struct acpi_ec *ec = first_ec; |
@@ -463,6 +489,10 @@ void acpi_ec_unblock_transactions(void) | |||
463 | mutex_lock(&ec->mutex); | 489 | mutex_lock(&ec->mutex); |
464 | /* Allow transactions to be carried out again */ | 490 | /* Allow transactions to be carried out again */ |
465 | clear_bit(EC_FLAGS_BLOCKED, &ec->flags); | 491 | clear_bit(EC_FLAGS_BLOCKED, &ec->flags); |
492 | |||
493 | if (EC_FLAGS_CLEAR_ON_RESUME) | ||
494 | acpi_ec_clear(ec); | ||
495 | |||
466 | mutex_unlock(&ec->mutex); | 496 | mutex_unlock(&ec->mutex); |
467 | } | 497 | } |
468 | 498 | ||
@@ -821,6 +851,13 @@ static int acpi_ec_add(struct acpi_device *device) | |||
821 | 851 | ||
822 | /* EC is fully operational, allow queries */ | 852 | /* EC is fully operational, allow queries */ |
823 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 853 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
854 | |||
855 | /* Clear stale _Q events if hardware might require that */ | ||
856 | if (EC_FLAGS_CLEAR_ON_RESUME) { | ||
857 | mutex_lock(&ec->mutex); | ||
858 | acpi_ec_clear(ec); | ||
859 | mutex_unlock(&ec->mutex); | ||
860 | } | ||
824 | return ret; | 861 | return ret; |
825 | } | 862 | } |
826 | 863 | ||
@@ -922,6 +959,30 @@ static int ec_enlarge_storm_threshold(const struct dmi_system_id *id) | |||
922 | return 0; | 959 | return 0; |
923 | } | 960 | } |
924 | 961 | ||
962 | /* | ||
963 | * On some hardware it is necessary to clear events accumulated by the EC during | ||
964 | * sleep. These ECs stop reporting GPEs until they are manually polled, if too | ||
965 | * many events are accumulated. (e.g. Samsung Series 5/9 notebooks) | ||
966 | * | ||
967 | * https://bugzilla.kernel.org/show_bug.cgi?id=44161 | ||
968 | * | ||
969 | * Ideally, the EC should also be instructed NOT to accumulate events during | ||
970 | * sleep (which Windows seems to do somehow), but the interface to control this | ||
971 | * behaviour is not known at this time. | ||
972 | * | ||
973 | * Models known to be affected are Samsung 530Uxx/535Uxx/540Uxx/550Pxx/900Xxx, | ||
974 | * however it is very likely that other Samsung models are affected. | ||
975 | * | ||
976 | * On systems which don't accumulate _Q events during sleep, this extra check | ||
977 | * should be harmless. | ||
978 | */ | ||
979 | static int ec_clear_on_resume(const struct dmi_system_id *id) | ||
980 | { | ||
981 | pr_debug("Detected system needing EC poll on resume.\n"); | ||
982 | EC_FLAGS_CLEAR_ON_RESUME = 1; | ||
983 | return 0; | ||
984 | } | ||
985 | |||
925 | static struct dmi_system_id ec_dmi_table[] __initdata = { | 986 | static struct dmi_system_id ec_dmi_table[] __initdata = { |
926 | { | 987 | { |
927 | ec_skip_dsdt_scan, "Compal JFL92", { | 988 | ec_skip_dsdt_scan, "Compal JFL92", { |
@@ -965,6 +1026,9 @@ static struct dmi_system_id ec_dmi_table[] __initdata = { | |||
965 | ec_validate_ecdt, "ASUS hardware", { | 1026 | ec_validate_ecdt, "ASUS hardware", { |
966 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer Inc."), | 1027 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer Inc."), |
967 | DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),}, NULL}, | 1028 | DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),}, NULL}, |
1029 | { | ||
1030 | ec_clear_on_resume, "Samsung hardware", { | ||
1031 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL}, | ||
968 | {}, | 1032 | {}, |
969 | }; | 1033 | }; |
970 | 1034 | ||
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 28baa05b8018..84243c32e29c 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -56,6 +56,12 @@ struct throttling_tstate { | |||
56 | int target_state; /* target T-state */ | 56 | int target_state; /* target T-state */ |
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct acpi_processor_throttling_arg { | ||
60 | struct acpi_processor *pr; | ||
61 | int target_state; | ||
62 | bool force; | ||
63 | }; | ||
64 | |||
59 | #define THROTTLING_PRECHANGE (1) | 65 | #define THROTTLING_PRECHANGE (1) |
60 | #define THROTTLING_POSTCHANGE (2) | 66 | #define THROTTLING_POSTCHANGE (2) |
61 | 67 | ||
@@ -1060,16 +1066,24 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
1060 | return 0; | 1066 | return 0; |
1061 | } | 1067 | } |
1062 | 1068 | ||
1069 | static long acpi_processor_throttling_fn(void *data) | ||
1070 | { | ||
1071 | struct acpi_processor_throttling_arg *arg = data; | ||
1072 | struct acpi_processor *pr = arg->pr; | ||
1073 | |||
1074 | return pr->throttling.acpi_processor_set_throttling(pr, | ||
1075 | arg->target_state, arg->force); | ||
1076 | } | ||
1077 | |||
1063 | int acpi_processor_set_throttling(struct acpi_processor *pr, | 1078 | int acpi_processor_set_throttling(struct acpi_processor *pr, |
1064 | int state, bool force) | 1079 | int state, bool force) |
1065 | { | 1080 | { |
1066 | cpumask_var_t saved_mask; | ||
1067 | int ret = 0; | 1081 | int ret = 0; |
1068 | unsigned int i; | 1082 | unsigned int i; |
1069 | struct acpi_processor *match_pr; | 1083 | struct acpi_processor *match_pr; |
1070 | struct acpi_processor_throttling *p_throttling; | 1084 | struct acpi_processor_throttling *p_throttling; |
1085 | struct acpi_processor_throttling_arg arg; | ||
1071 | struct throttling_tstate t_state; | 1086 | struct throttling_tstate t_state; |
1072 | cpumask_var_t online_throttling_cpus; | ||
1073 | 1087 | ||
1074 | if (!pr) | 1088 | if (!pr) |
1075 | return -EINVAL; | 1089 | return -EINVAL; |
@@ -1080,14 +1094,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1080 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) | 1094 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) |
1081 | return -EINVAL; | 1095 | return -EINVAL; |
1082 | 1096 | ||
1083 | if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL)) | ||
1084 | return -ENOMEM; | ||
1085 | |||
1086 | if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) { | ||
1087 | free_cpumask_var(saved_mask); | ||
1088 | return -ENOMEM; | ||
1089 | } | ||
1090 | |||
1091 | if (cpu_is_offline(pr->id)) { | 1097 | if (cpu_is_offline(pr->id)) { |
1092 | /* | 1098 | /* |
1093 | * the cpu pointed by pr->id is offline. Unnecessary to change | 1099 | * the cpu pointed by pr->id is offline. Unnecessary to change |
@@ -1096,17 +1102,15 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1096 | return -ENODEV; | 1102 | return -ENODEV; |
1097 | } | 1103 | } |
1098 | 1104 | ||
1099 | cpumask_copy(saved_mask, ¤t->cpus_allowed); | ||
1100 | t_state.target_state = state; | 1105 | t_state.target_state = state; |
1101 | p_throttling = &(pr->throttling); | 1106 | p_throttling = &(pr->throttling); |
1102 | cpumask_and(online_throttling_cpus, cpu_online_mask, | 1107 | |
1103 | p_throttling->shared_cpu_map); | ||
1104 | /* | 1108 | /* |
1105 | * The throttling notifier will be called for every | 1109 | * The throttling notifier will be called for every |
1106 | * affected cpu in order to get one proper T-state. | 1110 | * affected cpu in order to get one proper T-state. |
1107 | * The notifier event is THROTTLING_PRECHANGE. | 1111 | * The notifier event is THROTTLING_PRECHANGE. |
1108 | */ | 1112 | */ |
1109 | for_each_cpu(i, online_throttling_cpus) { | 1113 | for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { |
1110 | t_state.cpu = i; | 1114 | t_state.cpu = i; |
1111 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, | 1115 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, |
1112 | &t_state); | 1116 | &t_state); |
@@ -1118,21 +1122,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1118 | * it can be called only for the cpu pointed by pr. | 1122 | * it can be called only for the cpu pointed by pr. |
1119 | */ | 1123 | */ |
1120 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { | 1124 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { |
1121 | /* FIXME: use work_on_cpu() */ | 1125 | arg.pr = pr; |
1122 | if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) { | 1126 | arg.target_state = state; |
1123 | /* Can't migrate to the pr->id CPU. Exit */ | 1127 | arg.force = force; |
1124 | ret = -ENODEV; | 1128 | ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg); |
1125 | goto exit; | ||
1126 | } | ||
1127 | ret = p_throttling->acpi_processor_set_throttling(pr, | ||
1128 | t_state.target_state, force); | ||
1129 | } else { | 1129 | } else { |
1130 | /* | 1130 | /* |
1131 | * When the T-state coordination is SW_ALL or HW_ALL, | 1131 | * When the T-state coordination is SW_ALL or HW_ALL, |
1132 | * it is necessary to set T-state for every affected | 1132 | * it is necessary to set T-state for every affected |
1133 | * cpus. | 1133 | * cpus. |
1134 | */ | 1134 | */ |
1135 | for_each_cpu(i, online_throttling_cpus) { | 1135 | for_each_cpu_and(i, cpu_online_mask, |
1136 | p_throttling->shared_cpu_map) { | ||
1136 | match_pr = per_cpu(processors, i); | 1137 | match_pr = per_cpu(processors, i); |
1137 | /* | 1138 | /* |
1138 | * If the pointer is invalid, we will report the | 1139 | * If the pointer is invalid, we will report the |
@@ -1153,13 +1154,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1153 | "on CPU %d\n", i)); | 1154 | "on CPU %d\n", i)); |
1154 | continue; | 1155 | continue; |
1155 | } | 1156 | } |
1156 | t_state.cpu = i; | 1157 | |
1157 | /* FIXME: use work_on_cpu() */ | 1158 | arg.pr = match_pr; |
1158 | if (set_cpus_allowed_ptr(current, cpumask_of(i))) | 1159 | arg.target_state = state; |
1159 | continue; | 1160 | arg.force = force; |
1160 | ret = match_pr->throttling. | 1161 | ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, |
1161 | acpi_processor_set_throttling( | 1162 | &arg); |
1162 | match_pr, t_state.target_state, force); | ||
1163 | } | 1163 | } |
1164 | } | 1164 | } |
1165 | /* | 1165 | /* |
@@ -1168,17 +1168,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1168 | * affected cpu to update the T-states. | 1168 | * affected cpu to update the T-states. |
1169 | * The notifier event is THROTTLING_POSTCHANGE | 1169 | * The notifier event is THROTTLING_POSTCHANGE |
1170 | */ | 1170 | */ |
1171 | for_each_cpu(i, online_throttling_cpus) { | 1171 | for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { |
1172 | t_state.cpu = i; | 1172 | t_state.cpu = i; |
1173 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, | 1173 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, |
1174 | &t_state); | 1174 | &t_state); |
1175 | } | 1175 | } |
1176 | /* restore the previous state */ | 1176 | |
1177 | /* FIXME: use work_on_cpu() */ | ||
1178 | set_cpus_allowed_ptr(current, saved_mask); | ||
1179 | exit: | ||
1180 | free_cpumask_var(online_throttling_cpus); | ||
1181 | free_cpumask_var(saved_mask); | ||
1182 | return ret; | 1177 | return ret; |
1183 | } | 1178 | } |
1184 | 1179 | ||
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index b7201fc6f1e1..0bdacc5e26a3 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -77,18 +77,24 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
77 | switch (ares->type) { | 77 | switch (ares->type) { |
78 | case ACPI_RESOURCE_TYPE_MEMORY24: | 78 | case ACPI_RESOURCE_TYPE_MEMORY24: |
79 | memory24 = &ares->data.memory24; | 79 | memory24 = &ares->data.memory24; |
80 | if (!memory24->address_length) | ||
81 | return false; | ||
80 | acpi_dev_get_memresource(res, memory24->minimum, | 82 | acpi_dev_get_memresource(res, memory24->minimum, |
81 | memory24->address_length, | 83 | memory24->address_length, |
82 | memory24->write_protect); | 84 | memory24->write_protect); |
83 | break; | 85 | break; |
84 | case ACPI_RESOURCE_TYPE_MEMORY32: | 86 | case ACPI_RESOURCE_TYPE_MEMORY32: |
85 | memory32 = &ares->data.memory32; | 87 | memory32 = &ares->data.memory32; |
88 | if (!memory32->address_length) | ||
89 | return false; | ||
86 | acpi_dev_get_memresource(res, memory32->minimum, | 90 | acpi_dev_get_memresource(res, memory32->minimum, |
87 | memory32->address_length, | 91 | memory32->address_length, |
88 | memory32->write_protect); | 92 | memory32->write_protect); |
89 | break; | 93 | break; |
90 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 94 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
91 | fixed_memory32 = &ares->data.fixed_memory32; | 95 | fixed_memory32 = &ares->data.fixed_memory32; |
96 | if (!fixed_memory32->address_length) | ||
97 | return false; | ||
92 | acpi_dev_get_memresource(res, fixed_memory32->address, | 98 | acpi_dev_get_memresource(res, fixed_memory32->address, |
93 | fixed_memory32->address_length, | 99 | fixed_memory32->address_length, |
94 | fixed_memory32->write_protect); | 100 | fixed_memory32->write_protect); |
@@ -144,12 +150,16 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res) | |||
144 | switch (ares->type) { | 150 | switch (ares->type) { |
145 | case ACPI_RESOURCE_TYPE_IO: | 151 | case ACPI_RESOURCE_TYPE_IO: |
146 | io = &ares->data.io; | 152 | io = &ares->data.io; |
153 | if (!io->address_length) | ||
154 | return false; | ||
147 | acpi_dev_get_ioresource(res, io->minimum, | 155 | acpi_dev_get_ioresource(res, io->minimum, |
148 | io->address_length, | 156 | io->address_length, |
149 | io->io_decode); | 157 | io->io_decode); |
150 | break; | 158 | break; |
151 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 159 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
152 | fixed_io = &ares->data.fixed_io; | 160 | fixed_io = &ares->data.fixed_io; |
161 | if (!fixed_io->address_length) | ||
162 | return false; | ||
153 | acpi_dev_get_ioresource(res, fixed_io->address, | 163 | acpi_dev_get_ioresource(res, fixed_io->address, |
154 | fixed_io->address_length, | 164 | fixed_io->address_length, |
155 | ACPI_DECODE_10); | 165 | ACPI_DECODE_10); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index b718806657cd..c40fb2e81bbc 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -71,6 +71,17 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | static bool acpi_sleep_state_supported(u8 sleep_state) | ||
75 | { | ||
76 | acpi_status status; | ||
77 | u8 type_a, type_b; | ||
78 | |||
79 | status = acpi_get_sleep_type_data(sleep_state, &type_a, &type_b); | ||
80 | return ACPI_SUCCESS(status) && (!acpi_gbl_reduced_hardware | ||
81 | || (acpi_gbl_FADT.sleep_control.address | ||
82 | && acpi_gbl_FADT.sleep_status.address)); | ||
83 | } | ||
84 | |||
74 | #ifdef CONFIG_ACPI_SLEEP | 85 | #ifdef CONFIG_ACPI_SLEEP |
75 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | 86 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; |
76 | 87 | ||
@@ -604,15 +615,9 @@ static void acpi_sleep_suspend_setup(void) | |||
604 | { | 615 | { |
605 | int i; | 616 | int i; |
606 | 617 | ||
607 | for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) { | 618 | for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) |
608 | acpi_status status; | 619 | if (acpi_sleep_state_supported(i)) |
609 | u8 type_a, type_b; | ||
610 | |||
611 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); | ||
612 | if (ACPI_SUCCESS(status)) { | ||
613 | sleep_states[i] = 1; | 620 | sleep_states[i] = 1; |
614 | } | ||
615 | } | ||
616 | 621 | ||
617 | suspend_set_ops(old_suspend_ordering ? | 622 | suspend_set_ops(old_suspend_ordering ? |
618 | &acpi_suspend_ops_old : &acpi_suspend_ops); | 623 | &acpi_suspend_ops_old : &acpi_suspend_ops); |
@@ -740,11 +745,7 @@ static const struct platform_hibernation_ops acpi_hibernation_ops_old = { | |||
740 | 745 | ||
741 | static void acpi_sleep_hibernate_setup(void) | 746 | static void acpi_sleep_hibernate_setup(void) |
742 | { | 747 | { |
743 | acpi_status status; | 748 | if (!acpi_sleep_state_supported(ACPI_STATE_S4)) |
744 | u8 type_a, type_b; | ||
745 | |||
746 | status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b); | ||
747 | if (ACPI_FAILURE(status)) | ||
748 | return; | 749 | return; |
749 | 750 | ||
750 | hibernation_set_ops(old_suspend_ordering ? | 751 | hibernation_set_ops(old_suspend_ordering ? |
@@ -793,8 +794,6 @@ static void acpi_power_off(void) | |||
793 | 794 | ||
794 | int __init acpi_sleep_init(void) | 795 | int __init acpi_sleep_init(void) |
795 | { | 796 | { |
796 | acpi_status status; | ||
797 | u8 type_a, type_b; | ||
798 | char supported[ACPI_S_STATE_COUNT * 3 + 1]; | 797 | char supported[ACPI_S_STATE_COUNT * 3 + 1]; |
799 | char *pos = supported; | 798 | char *pos = supported; |
800 | int i; | 799 | int i; |
@@ -806,8 +805,7 @@ int __init acpi_sleep_init(void) | |||
806 | acpi_sleep_suspend_setup(); | 805 | acpi_sleep_suspend_setup(); |
807 | acpi_sleep_hibernate_setup(); | 806 | acpi_sleep_hibernate_setup(); |
808 | 807 | ||
809 | status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); | 808 | if (acpi_sleep_state_supported(ACPI_STATE_S5)) { |
810 | if (ACPI_SUCCESS(status)) { | ||
811 | sleep_states[ACPI_STATE_S5] = 1; | 809 | sleep_states[ACPI_STATE_S5] = 1; |
812 | pm_power_off_prepare = acpi_power_off_prepare; | 810 | pm_power_off_prepare = acpi_power_off_prepare; |
813 | pm_power_off = acpi_power_off; | 811 | pm_power_off = acpi_power_off; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 1a3dbd1b196e..8cb2522d592a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4175,6 +4175,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4175 | 4175 | ||
4176 | /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ | 4176 | /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ |
4177 | { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | 4177 | { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, |
4178 | { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | ||
4178 | 4179 | ||
4179 | /* Blacklist entries taken from Silicon Image 3124/3132 | 4180 | /* Blacklist entries taken from Silicon Image 3124/3132 |
4180 | Windows driver .inf file - also several Linux problem reports */ | 4181 | Windows driver .inf file - also several Linux problem reports */ |
@@ -4224,7 +4225,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4224 | 4225 | ||
4225 | /* devices that don't properly handle queued TRIM commands */ | 4226 | /* devices that don't properly handle queued TRIM commands */ |
4226 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4227 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4227 | { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4228 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4228 | 4229 | ||
4229 | /* | 4230 | /* |
4230 | * Some WD SATA-I drives spin up and down erratically when the link | 4231 | * Some WD SATA-I drives spin up and down erratically when the link |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 8a97ddfa6122..c30df50e4440 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -1580,6 +1580,7 @@ static int fw_pm_notify(struct notifier_block *notify_block, | |||
1580 | switch (mode) { | 1580 | switch (mode) { |
1581 | case PM_HIBERNATION_PREPARE: | 1581 | case PM_HIBERNATION_PREPARE: |
1582 | case PM_SUSPEND_PREPARE: | 1582 | case PM_SUSPEND_PREPARE: |
1583 | case PM_RESTORE_PREPARE: | ||
1583 | kill_requests_without_uevent(); | 1584 | kill_requests_without_uevent(); |
1584 | device_cache_fw_images(); | 1585 | device_cache_fw_images(); |
1585 | break; | 1586 | break; |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 8184451b57c0..422b7d84f686 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -874,7 +874,7 @@ bio_pageinc(struct bio *bio) | |||
874 | /* Non-zero page count for non-head members of | 874 | /* Non-zero page count for non-head members of |
875 | * compound pages is no longer allowed by the kernel. | 875 | * compound pages is no longer allowed by the kernel. |
876 | */ | 876 | */ |
877 | page = compound_trans_head(bv.bv_page); | 877 | page = compound_head(bv.bv_page); |
878 | atomic_inc(&page->_count); | 878 | atomic_inc(&page->_count); |
879 | } | 879 | } |
880 | } | 880 | } |
@@ -887,7 +887,7 @@ bio_pagedec(struct bio *bio) | |||
887 | struct bvec_iter iter; | 887 | struct bvec_iter iter; |
888 | 888 | ||
889 | bio_for_each_segment(bv, bio, iter) { | 889 | bio_for_each_segment(bv, bio, iter) { |
890 | page = compound_trans_head(bv.bv_page); | 890 | page = compound_head(bv.bv_page); |
891 | atomic_dec(&page->_count); | 891 | atomic_dec(&page->_count); |
892 | } | 892 | } |
893 | } | 893 | } |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 516026954be6..d777bb7cea93 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -4498,7 +4498,7 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
4498 | } | 4498 | } |
4499 | dev_info(&pdev->dev, "NUMA node %d (closest: %d,%d, probe on %d:%d)\n", | 4499 | dev_info(&pdev->dev, "NUMA node %d (closest: %d,%d, probe on %d:%d)\n", |
4500 | my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev), | 4500 | my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev), |
4501 | cpu_to_node(smp_processor_id()), smp_processor_id()); | 4501 | cpu_to_node(raw_smp_processor_id()), raw_smp_processor_id()); |
4502 | 4502 | ||
4503 | dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node); | 4503 | dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node); |
4504 | if (dd == NULL) { | 4504 | if (dd == NULL) { |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index b52e9a6d6aad..54174cb32feb 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -53,7 +53,7 @@ | |||
53 | #define MTIP_FTL_REBUILD_TIMEOUT_MS 2400000 | 53 | #define MTIP_FTL_REBUILD_TIMEOUT_MS 2400000 |
54 | 54 | ||
55 | /* unaligned IO handling */ | 55 | /* unaligned IO handling */ |
56 | #define MTIP_MAX_UNALIGNED_SLOTS 8 | 56 | #define MTIP_MAX_UNALIGNED_SLOTS 2 |
57 | 57 | ||
58 | /* Macro to extract the tag bit number from a tag value. */ | 58 | /* Macro to extract the tag bit number from a tag value. */ |
59 | #define MTIP_TAG_BIT(tag) (tag & 0x1F) | 59 | #define MTIP_TAG_BIT(tag) (tag & 0x1F) |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 011e55d820b1..51c557cfd92b 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -612,6 +612,8 @@ static ssize_t disksize_store(struct device *dev, | |||
612 | 612 | ||
613 | disksize = PAGE_ALIGN(disksize); | 613 | disksize = PAGE_ALIGN(disksize); |
614 | meta = zram_meta_alloc(disksize); | 614 | meta = zram_meta_alloc(disksize); |
615 | if (!meta) | ||
616 | return -ENOMEM; | ||
615 | down_write(&zram->init_lock); | 617 | down_write(&zram->init_lock); |
616 | if (zram->init_done) { | 618 | if (zram->init_done) { |
617 | up_write(&zram->init_lock); | 619 | up_write(&zram->init_lock); |
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c index bd313f7816a8..c1af80bcdf20 100644 --- a/drivers/clk/at91/clk-master.c +++ b/drivers/clk/at91/clk-master.c | |||
@@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, | |||
242 | 242 | ||
243 | irq = irq_of_parse_and_map(np, 0); | 243 | irq = irq_of_parse_and_map(np, 0); |
244 | if (!irq) | 244 | if (!irq) |
245 | return; | 245 | goto out_free_characteristics; |
246 | 246 | ||
247 | clk = at91_clk_register_master(pmc, irq, name, num_parents, | 247 | clk = at91_clk_register_master(pmc, irq, name, num_parents, |
248 | parent_names, layout, | 248 | parent_names, layout, |
diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 6a934a5296bd..05e04ce0f148 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c | |||
@@ -494,6 +494,9 @@ static const struct file_operations nomadik_src_clk_debugfs_ops = { | |||
494 | 494 | ||
495 | static int __init nomadik_src_clk_init_debugfs(void) | 495 | static int __init nomadik_src_clk_init_debugfs(void) |
496 | { | 496 | { |
497 | /* Vital for multiplatform */ | ||
498 | if (!src_base) | ||
499 | return -ENODEV; | ||
497 | src_pcksr0_boot = readl(src_base + SRC_PCKSR0); | 500 | src_pcksr0_boot = readl(src_base + SRC_PCKSR0); |
498 | src_pcksr1_boot = readl(src_base + SRC_PCKSR1); | 501 | src_pcksr1_boot = readl(src_base + SRC_PCKSR1); |
499 | debugfs_create_file("nomadik-src-clk", S_IFREG | S_IRUGO, | 502 | debugfs_create_file("nomadik-src-clk", S_IFREG | S_IRUGO, |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 5517944495d8..c42e608af6bb 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -2226,24 +2226,25 @@ EXPORT_SYMBOL_GPL(devm_clk_unregister); | |||
2226 | */ | 2226 | */ |
2227 | int __clk_get(struct clk *clk) | 2227 | int __clk_get(struct clk *clk) |
2228 | { | 2228 | { |
2229 | if (clk && !try_module_get(clk->owner)) | 2229 | if (clk) { |
2230 | return 0; | 2230 | if (!try_module_get(clk->owner)) |
2231 | return 0; | ||
2231 | 2232 | ||
2232 | kref_get(&clk->ref); | 2233 | kref_get(&clk->ref); |
2234 | } | ||
2233 | return 1; | 2235 | return 1; |
2234 | } | 2236 | } |
2235 | 2237 | ||
2236 | void __clk_put(struct clk *clk) | 2238 | void __clk_put(struct clk *clk) |
2237 | { | 2239 | { |
2238 | if (WARN_ON_ONCE(IS_ERR(clk))) | 2240 | if (!clk || WARN_ON_ONCE(IS_ERR(clk))) |
2239 | return; | 2241 | return; |
2240 | 2242 | ||
2241 | clk_prepare_lock(); | 2243 | clk_prepare_lock(); |
2242 | kref_put(&clk->ref, __clk_release); | 2244 | kref_put(&clk->ref, __clk_release); |
2243 | clk_prepare_unlock(); | 2245 | clk_prepare_unlock(); |
2244 | 2246 | ||
2245 | if (clk) | 2247 | module_put(clk->owner); |
2246 | module_put(clk->owner); | ||
2247 | } | 2248 | } |
2248 | 2249 | ||
2249 | /*** clk rate change notifiers ***/ | 2250 | /*** clk rate change notifiers ***/ |
diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c index 17a598398a53..86f1e362eafb 100644 --- a/drivers/clk/keystone/gate.c +++ b/drivers/clk/keystone/gate.c | |||
@@ -179,6 +179,7 @@ static struct clk *clk_register_psc(struct device *dev, | |||
179 | 179 | ||
180 | init.name = name; | 180 | init.name = name; |
181 | init.ops = &clk_psc_ops; | 181 | init.ops = &clk_psc_ops; |
182 | init.flags = 0; | ||
182 | init.parent_names = (parent_name ? &parent_name : NULL); | 183 | init.parent_names = (parent_name ? &parent_name : NULL); |
183 | init.num_parents = (parent_name ? 1 : 0); | 184 | init.num_parents = (parent_name ? 1 : 0); |
184 | 185 | ||
diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c index 81a202d12a7a..bef198a83863 100644 --- a/drivers/clk/mvebu/armada-370.c +++ b/drivers/clk/mvebu/armada-370.c | |||
@@ -141,13 +141,6 @@ static const struct coreclk_soc_desc a370_coreclks = { | |||
141 | .num_ratios = ARRAY_SIZE(a370_coreclk_ratios), | 141 | .num_ratios = ARRAY_SIZE(a370_coreclk_ratios), |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static void __init a370_coreclk_init(struct device_node *np) | ||
145 | { | ||
146 | mvebu_coreclk_setup(np, &a370_coreclks); | ||
147 | } | ||
148 | CLK_OF_DECLARE(a370_core_clk, "marvell,armada-370-core-clock", | ||
149 | a370_coreclk_init); | ||
150 | |||
151 | /* | 144 | /* |
152 | * Clock Gating Control | 145 | * Clock Gating Control |
153 | */ | 146 | */ |
@@ -168,9 +161,15 @@ static const struct clk_gating_soc_desc a370_gating_desc[] __initconst = { | |||
168 | { } | 161 | { } |
169 | }; | 162 | }; |
170 | 163 | ||
171 | static void __init a370_clk_gating_init(struct device_node *np) | 164 | static void __init a370_clk_init(struct device_node *np) |
172 | { | 165 | { |
173 | mvebu_clk_gating_setup(np, a370_gating_desc); | 166 | struct device_node *cgnp = |
167 | of_find_compatible_node(NULL, NULL, "marvell,armada-370-gating-clock"); | ||
168 | |||
169 | mvebu_coreclk_setup(np, &a370_coreclks); | ||
170 | |||
171 | if (cgnp) | ||
172 | mvebu_clk_gating_setup(cgnp, a370_gating_desc); | ||
174 | } | 173 | } |
175 | CLK_OF_DECLARE(a370_clk_gating, "marvell,armada-370-gating-clock", | 174 | CLK_OF_DECLARE(a370_clk, "marvell,armada-370-core-clock", a370_clk_init); |
176 | a370_clk_gating_init); | 175 | |
diff --git a/drivers/clk/mvebu/armada-xp.c b/drivers/clk/mvebu/armada-xp.c index 9922c4475aa8..b3094315a3c0 100644 --- a/drivers/clk/mvebu/armada-xp.c +++ b/drivers/clk/mvebu/armada-xp.c | |||
@@ -158,13 +158,6 @@ static const struct coreclk_soc_desc axp_coreclks = { | |||
158 | .num_ratios = ARRAY_SIZE(axp_coreclk_ratios), | 158 | .num_ratios = ARRAY_SIZE(axp_coreclk_ratios), |
159 | }; | 159 | }; |
160 | 160 | ||
161 | static void __init axp_coreclk_init(struct device_node *np) | ||
162 | { | ||
163 | mvebu_coreclk_setup(np, &axp_coreclks); | ||
164 | } | ||
165 | CLK_OF_DECLARE(axp_core_clk, "marvell,armada-xp-core-clock", | ||
166 | axp_coreclk_init); | ||
167 | |||
168 | /* | 161 | /* |
169 | * Clock Gating Control | 162 | * Clock Gating Control |
170 | */ | 163 | */ |
@@ -202,9 +195,14 @@ static const struct clk_gating_soc_desc axp_gating_desc[] __initconst = { | |||
202 | { } | 195 | { } |
203 | }; | 196 | }; |
204 | 197 | ||
205 | static void __init axp_clk_gating_init(struct device_node *np) | 198 | static void __init axp_clk_init(struct device_node *np) |
206 | { | 199 | { |
207 | mvebu_clk_gating_setup(np, axp_gating_desc); | 200 | struct device_node *cgnp = |
201 | of_find_compatible_node(NULL, NULL, "marvell,armada-xp-gating-clock"); | ||
202 | |||
203 | mvebu_coreclk_setup(np, &axp_coreclks); | ||
204 | |||
205 | if (cgnp) | ||
206 | mvebu_clk_gating_setup(cgnp, axp_gating_desc); | ||
208 | } | 207 | } |
209 | CLK_OF_DECLARE(axp_clk_gating, "marvell,armada-xp-gating-clock", | 208 | CLK_OF_DECLARE(axp_clk, "marvell,armada-xp-core-clock", axp_clk_init); |
210 | axp_clk_gating_init); | ||
diff --git a/drivers/clk/mvebu/dove.c b/drivers/clk/mvebu/dove.c index 38aee1e3f242..b8c2424ac926 100644 --- a/drivers/clk/mvebu/dove.c +++ b/drivers/clk/mvebu/dove.c | |||
@@ -154,12 +154,6 @@ static const struct coreclk_soc_desc dove_coreclks = { | |||
154 | .num_ratios = ARRAY_SIZE(dove_coreclk_ratios), | 154 | .num_ratios = ARRAY_SIZE(dove_coreclk_ratios), |
155 | }; | 155 | }; |
156 | 156 | ||
157 | static void __init dove_coreclk_init(struct device_node *np) | ||
158 | { | ||
159 | mvebu_coreclk_setup(np, &dove_coreclks); | ||
160 | } | ||
161 | CLK_OF_DECLARE(dove_core_clk, "marvell,dove-core-clock", dove_coreclk_init); | ||
162 | |||
163 | /* | 157 | /* |
164 | * Clock Gating Control | 158 | * Clock Gating Control |
165 | */ | 159 | */ |
@@ -186,9 +180,14 @@ static const struct clk_gating_soc_desc dove_gating_desc[] __initconst = { | |||
186 | { } | 180 | { } |
187 | }; | 181 | }; |
188 | 182 | ||
189 | static void __init dove_clk_gating_init(struct device_node *np) | 183 | static void __init dove_clk_init(struct device_node *np) |
190 | { | 184 | { |
191 | mvebu_clk_gating_setup(np, dove_gating_desc); | 185 | struct device_node *cgnp = |
186 | of_find_compatible_node(NULL, NULL, "marvell,dove-gating-clock"); | ||
187 | |||
188 | mvebu_coreclk_setup(np, &dove_coreclks); | ||
189 | |||
190 | if (cgnp) | ||
191 | mvebu_clk_gating_setup(cgnp, dove_gating_desc); | ||
192 | } | 192 | } |
193 | CLK_OF_DECLARE(dove_clk_gating, "marvell,dove-gating-clock", | 193 | CLK_OF_DECLARE(dove_clk, "marvell,dove-core-clock", dove_clk_init); |
194 | dove_clk_gating_init); | ||
diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c index 2636a55f29f9..ddb666a86500 100644 --- a/drivers/clk/mvebu/kirkwood.c +++ b/drivers/clk/mvebu/kirkwood.c | |||
@@ -193,13 +193,6 @@ static const struct coreclk_soc_desc kirkwood_coreclks = { | |||
193 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), | 193 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), |
194 | }; | 194 | }; |
195 | 195 | ||
196 | static void __init kirkwood_coreclk_init(struct device_node *np) | ||
197 | { | ||
198 | mvebu_coreclk_setup(np, &kirkwood_coreclks); | ||
199 | } | ||
200 | CLK_OF_DECLARE(kirkwood_core_clk, "marvell,kirkwood-core-clock", | ||
201 | kirkwood_coreclk_init); | ||
202 | |||
203 | static const struct coreclk_soc_desc mv88f6180_coreclks = { | 196 | static const struct coreclk_soc_desc mv88f6180_coreclks = { |
204 | .get_tclk_freq = kirkwood_get_tclk_freq, | 197 | .get_tclk_freq = kirkwood_get_tclk_freq, |
205 | .get_cpu_freq = mv88f6180_get_cpu_freq, | 198 | .get_cpu_freq = mv88f6180_get_cpu_freq, |
@@ -208,13 +201,6 @@ static const struct coreclk_soc_desc mv88f6180_coreclks = { | |||
208 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), | 201 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), |
209 | }; | 202 | }; |
210 | 203 | ||
211 | static void __init mv88f6180_coreclk_init(struct device_node *np) | ||
212 | { | ||
213 | mvebu_coreclk_setup(np, &mv88f6180_coreclks); | ||
214 | } | ||
215 | CLK_OF_DECLARE(mv88f6180_core_clk, "marvell,mv88f6180-core-clock", | ||
216 | mv88f6180_coreclk_init); | ||
217 | |||
218 | /* | 204 | /* |
219 | * Clock Gating Control | 205 | * Clock Gating Control |
220 | */ | 206 | */ |
@@ -239,9 +225,21 @@ static const struct clk_gating_soc_desc kirkwood_gating_desc[] __initconst = { | |||
239 | { } | 225 | { } |
240 | }; | 226 | }; |
241 | 227 | ||
242 | static void __init kirkwood_clk_gating_init(struct device_node *np) | 228 | static void __init kirkwood_clk_init(struct device_node *np) |
243 | { | 229 | { |
244 | mvebu_clk_gating_setup(np, kirkwood_gating_desc); | 230 | struct device_node *cgnp = |
231 | of_find_compatible_node(NULL, NULL, "marvell,kirkwood-gating-clock"); | ||
232 | |||
233 | |||
234 | if (of_device_is_compatible(np, "marvell,mv88f6180-core-clock")) | ||
235 | mvebu_coreclk_setup(np, &mv88f6180_coreclks); | ||
236 | else | ||
237 | mvebu_coreclk_setup(np, &kirkwood_coreclks); | ||
238 | |||
239 | if (cgnp) | ||
240 | mvebu_clk_gating_setup(cgnp, kirkwood_gating_desc); | ||
245 | } | 241 | } |
246 | CLK_OF_DECLARE(kirkwood_clk_gating, "marvell,kirkwood-gating-clock", | 242 | CLK_OF_DECLARE(kirkwood_clk, "marvell,kirkwood-core-clock", |
247 | kirkwood_clk_gating_init); | 243 | kirkwood_clk_init); |
244 | CLK_OF_DECLARE(mv88f6180_clk, "marvell,mv88f6180-core-clock", | ||
245 | kirkwood_clk_init); | ||
diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c index a59ec217a124..99c27b1c625b 100644 --- a/drivers/clk/shmobile/clk-rcar-gen2.c +++ b/drivers/clk/shmobile/clk-rcar-gen2.c | |||
@@ -26,6 +26,8 @@ struct rcar_gen2_cpg { | |||
26 | void __iomem *reg; | 26 | void __iomem *reg; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #define CPG_FRQCRB 0x00000004 | ||
30 | #define CPG_FRQCRB_KICK BIT(31) | ||
29 | #define CPG_SDCKCR 0x00000074 | 31 | #define CPG_SDCKCR 0x00000074 |
30 | #define CPG_PLL0CR 0x000000d8 | 32 | #define CPG_PLL0CR 0x000000d8 |
31 | #define CPG_FRQCRC 0x000000e0 | 33 | #define CPG_FRQCRC 0x000000e0 |
@@ -45,6 +47,7 @@ struct rcar_gen2_cpg { | |||
45 | struct cpg_z_clk { | 47 | struct cpg_z_clk { |
46 | struct clk_hw hw; | 48 | struct clk_hw hw; |
47 | void __iomem *reg; | 49 | void __iomem *reg; |
50 | void __iomem *kick_reg; | ||
48 | }; | 51 | }; |
49 | 52 | ||
50 | #define to_z_clk(_hw) container_of(_hw, struct cpg_z_clk, hw) | 53 | #define to_z_clk(_hw) container_of(_hw, struct cpg_z_clk, hw) |
@@ -83,17 +86,45 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate, | |||
83 | { | 86 | { |
84 | struct cpg_z_clk *zclk = to_z_clk(hw); | 87 | struct cpg_z_clk *zclk = to_z_clk(hw); |
85 | unsigned int mult; | 88 | unsigned int mult; |
86 | u32 val; | 89 | u32 val, kick; |
90 | unsigned int i; | ||
87 | 91 | ||
88 | mult = div_u64((u64)rate * 32, parent_rate); | 92 | mult = div_u64((u64)rate * 32, parent_rate); |
89 | mult = clamp(mult, 1U, 32U); | 93 | mult = clamp(mult, 1U, 32U); |
90 | 94 | ||
95 | if (clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK) | ||
96 | return -EBUSY; | ||
97 | |||
91 | val = clk_readl(zclk->reg); | 98 | val = clk_readl(zclk->reg); |
92 | val &= ~CPG_FRQCRC_ZFC_MASK; | 99 | val &= ~CPG_FRQCRC_ZFC_MASK; |
93 | val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT; | 100 | val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT; |
94 | clk_writel(val, zclk->reg); | 101 | clk_writel(val, zclk->reg); |
95 | 102 | ||
96 | return 0; | 103 | /* |
104 | * Set KICK bit in FRQCRB to update hardware setting and wait for | ||
105 | * clock change completion. | ||
106 | */ | ||
107 | kick = clk_readl(zclk->kick_reg); | ||
108 | kick |= CPG_FRQCRB_KICK; | ||
109 | clk_writel(kick, zclk->kick_reg); | ||
110 | |||
111 | /* | ||
112 | * Note: There is no HW information about the worst case latency. | ||
113 | * | ||
114 | * Using experimental measurements, it seems that no more than | ||
115 | * ~10 iterations are needed, independently of the CPU rate. | ||
116 | * Since this value might be dependant of external xtal rate, pll1 | ||
117 | * rate or even the other emulation clocks rate, use 1000 as a | ||
118 | * "super" safe value. | ||
119 | */ | ||
120 | for (i = 1000; i; i--) { | ||
121 | if (!(clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK)) | ||
122 | return 0; | ||
123 | |||
124 | cpu_relax(); | ||
125 | } | ||
126 | |||
127 | return -ETIMEDOUT; | ||
97 | } | 128 | } |
98 | 129 | ||
99 | static const struct clk_ops cpg_z_clk_ops = { | 130 | static const struct clk_ops cpg_z_clk_ops = { |
@@ -120,6 +151,7 @@ static struct clk * __init cpg_z_clk_register(struct rcar_gen2_cpg *cpg) | |||
120 | init.num_parents = 1; | 151 | init.num_parents = 1; |
121 | 152 | ||
122 | zclk->reg = cpg->reg + CPG_FRQCRC; | 153 | zclk->reg = cpg->reg + CPG_FRQCRC; |
154 | zclk->kick_reg = cpg->reg + CPG_FRQCRB; | ||
123 | zclk->hw.init = &init; | 155 | zclk->hw.init = &init; |
124 | 156 | ||
125 | clk = clk_register(NULL, &zclk->hw); | 157 | clk = clk_register(NULL, &zclk->hw); |
@@ -186,7 +218,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, | |||
186 | const char *name) | 218 | const char *name) |
187 | { | 219 | { |
188 | const struct clk_div_table *table = NULL; | 220 | const struct clk_div_table *table = NULL; |
189 | const char *parent_name = "main"; | 221 | const char *parent_name; |
190 | unsigned int shift; | 222 | unsigned int shift; |
191 | unsigned int mult = 1; | 223 | unsigned int mult = 1; |
192 | unsigned int div = 1; | 224 | unsigned int div = 1; |
@@ -201,23 +233,31 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, | |||
201 | * the multiplier value. | 233 | * the multiplier value. |
202 | */ | 234 | */ |
203 | u32 value = clk_readl(cpg->reg + CPG_PLL0CR); | 235 | u32 value = clk_readl(cpg->reg + CPG_PLL0CR); |
236 | parent_name = "main"; | ||
204 | mult = ((value >> 24) & ((1 << 7) - 1)) + 1; | 237 | mult = ((value >> 24) & ((1 << 7) - 1)) + 1; |
205 | } else if (!strcmp(name, "pll1")) { | 238 | } else if (!strcmp(name, "pll1")) { |
239 | parent_name = "main"; | ||
206 | mult = config->pll1_mult / 2; | 240 | mult = config->pll1_mult / 2; |
207 | } else if (!strcmp(name, "pll3")) { | 241 | } else if (!strcmp(name, "pll3")) { |
242 | parent_name = "main"; | ||
208 | mult = config->pll3_mult; | 243 | mult = config->pll3_mult; |
209 | } else if (!strcmp(name, "lb")) { | 244 | } else if (!strcmp(name, "lb")) { |
245 | parent_name = "pll1_div2"; | ||
210 | div = cpg_mode & BIT(18) ? 36 : 24; | 246 | div = cpg_mode & BIT(18) ? 36 : 24; |
211 | } else if (!strcmp(name, "qspi")) { | 247 | } else if (!strcmp(name, "qspi")) { |
248 | parent_name = "pll1_div2"; | ||
212 | div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2) | 249 | div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2) |
213 | ? 16 : 20; | 250 | ? 8 : 10; |
214 | } else if (!strcmp(name, "sdh")) { | 251 | } else if (!strcmp(name, "sdh")) { |
252 | parent_name = "pll1_div2"; | ||
215 | table = cpg_sdh_div_table; | 253 | table = cpg_sdh_div_table; |
216 | shift = 8; | 254 | shift = 8; |
217 | } else if (!strcmp(name, "sd0")) { | 255 | } else if (!strcmp(name, "sd0")) { |
256 | parent_name = "pll1_div2"; | ||
218 | table = cpg_sd01_div_table; | 257 | table = cpg_sd01_div_table; |
219 | shift = 4; | 258 | shift = 4; |
220 | } else if (!strcmp(name, "sd1")) { | 259 | } else if (!strcmp(name, "sd1")) { |
260 | parent_name = "pll1_div2"; | ||
221 | table = cpg_sd01_div_table; | 261 | table = cpg_sd01_div_table; |
222 | shift = 0; | 262 | shift = 0; |
223 | } else if (!strcmp(name, "z")) { | 263 | } else if (!strcmp(name, "z")) { |
diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c index 4d75b1f37e3a..290f9c1a3749 100644 --- a/drivers/clk/tegra/clk-divider.c +++ b/drivers/clk/tegra/clk-divider.c | |||
@@ -59,7 +59,7 @@ static int get_div(struct tegra_clk_frac_div *divider, unsigned long rate, | |||
59 | return 0; | 59 | return 0; |
60 | 60 | ||
61 | if (divider_ux1 > get_max_div(divider)) | 61 | if (divider_ux1 > get_max_div(divider)) |
62 | return -EINVAL; | 62 | return get_max_div(divider); |
63 | 63 | ||
64 | return divider_ux1; | 64 | return divider_ux1; |
65 | } | 65 | } |
diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h index cf0c323f2c36..c39613c519af 100644 --- a/drivers/clk/tegra/clk-id.h +++ b/drivers/clk/tegra/clk-id.h | |||
@@ -180,9 +180,13 @@ enum clk_id { | |||
180 | tegra_clk_sbc6_8, | 180 | tegra_clk_sbc6_8, |
181 | tegra_clk_sclk, | 181 | tegra_clk_sclk, |
182 | tegra_clk_sdmmc1, | 182 | tegra_clk_sdmmc1, |
183 | tegra_clk_sdmmc1_8, | ||
183 | tegra_clk_sdmmc2, | 184 | tegra_clk_sdmmc2, |
185 | tegra_clk_sdmmc2_8, | ||
184 | tegra_clk_sdmmc3, | 186 | tegra_clk_sdmmc3, |
187 | tegra_clk_sdmmc3_8, | ||
185 | tegra_clk_sdmmc4, | 188 | tegra_clk_sdmmc4, |
189 | tegra_clk_sdmmc4_8, | ||
186 | tegra_clk_se, | 190 | tegra_clk_se, |
187 | tegra_clk_soc_therm, | 191 | tegra_clk_soc_therm, |
188 | tegra_clk_sor0, | 192 | tegra_clk_sor0, |
diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c index 5c35885f4a7c..1fa5c3f33b20 100644 --- a/drivers/clk/tegra/clk-tegra-periph.c +++ b/drivers/clk/tegra/clk-tegra-periph.c | |||
@@ -371,9 +371,7 @@ static const char *mux_pllp3_pllc_clkm[] = { | |||
371 | static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = { | 371 | static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = { |
372 | "pll_m", "pll_c", "pll_p", "pll_a", "pll_c2", "pll_c3", "clk_m" | 372 | "pll_m", "pll_c", "pll_p", "pll_a", "pll_c2", "pll_c3", "clk_m" |
373 | }; | 373 | }; |
374 | static u32 mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx[] = { | 374 | #define mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx NULL |
375 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, | ||
376 | }; | ||
377 | 375 | ||
378 | static const char *mux_pllm_pllc2_c_c3_pllp_plla_pllc4[] = { | 376 | static const char *mux_pllm_pllc2_c_c3_pllp_plla_pllc4[] = { |
379 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0", "pll_c4", | 377 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0", "pll_c4", |
@@ -465,6 +463,10 @@ static struct tegra_periph_init_data periph_clks[] = { | |||
465 | MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1), | 463 | MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1), |
466 | MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1), | 464 | MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1), |
467 | MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2), | 465 | MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2), |
466 | MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, tegra_clk_sdmmc1_8), | ||
467 | MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, tegra_clk_sdmmc2_8), | ||
468 | MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, tegra_clk_sdmmc3_8), | ||
469 | MUX8("sdmmc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, tegra_clk_sdmmc4_8), | ||
468 | MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8), | 470 | MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8), |
469 | MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8), | 471 | MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8), |
470 | MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8), | 472 | MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8), |
@@ -492,7 +494,7 @@ static struct tegra_periph_init_data periph_clks[] = { | |||
492 | UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb), | 494 | UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb), |
493 | UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc), | 495 | UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc), |
494 | UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd), | 496 | UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd), |
495 | UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 65, tegra_clk_uarte), | 497 | UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 66, tegra_clk_uarte), |
496 | XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src), | 498 | XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src), |
497 | XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src), | 499 | XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src), |
498 | XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src), | 500 | XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src), |
diff --git a/drivers/clk/tegra/clk-tegra-super-gen4.c b/drivers/clk/tegra/clk-tegra-super-gen4.c index 05dce4aa2c11..feb3201c85ce 100644 --- a/drivers/clk/tegra/clk-tegra-super-gen4.c +++ b/drivers/clk/tegra/clk-tegra-super-gen4.c | |||
@@ -120,7 +120,7 @@ void __init tegra_super_clk_gen4_init(void __iomem *clk_base, | |||
120 | ARRAY_SIZE(cclk_lp_parents), | 120 | ARRAY_SIZE(cclk_lp_parents), |
121 | CLK_SET_RATE_PARENT, | 121 | CLK_SET_RATE_PARENT, |
122 | clk_base + CCLKLP_BURST_POLICY, | 122 | clk_base + CCLKLP_BURST_POLICY, |
123 | 0, 4, 8, 9, NULL); | 123 | TEGRA_DIVIDER_2, 4, 8, 9, NULL); |
124 | *dt_clk = clk; | 124 | *dt_clk = clk; |
125 | } | 125 | } |
126 | 126 | ||
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c index 90d9d25f2228..80431f0fb268 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c | |||
@@ -682,12 +682,12 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = { | |||
682 | [tegra_clk_timer] = { .dt_id = TEGRA114_CLK_TIMER, .present = true }, | 682 | [tegra_clk_timer] = { .dt_id = TEGRA114_CLK_TIMER, .present = true }, |
683 | [tegra_clk_uarta] = { .dt_id = TEGRA114_CLK_UARTA, .present = true }, | 683 | [tegra_clk_uarta] = { .dt_id = TEGRA114_CLK_UARTA, .present = true }, |
684 | [tegra_clk_uartd] = { .dt_id = TEGRA114_CLK_UARTD, .present = true }, | 684 | [tegra_clk_uartd] = { .dt_id = TEGRA114_CLK_UARTD, .present = true }, |
685 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true }, | 685 | [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true }, |
686 | [tegra_clk_i2s1] = { .dt_id = TEGRA114_CLK_I2S1, .present = true }, | 686 | [tegra_clk_i2s1] = { .dt_id = TEGRA114_CLK_I2S1, .present = true }, |
687 | [tegra_clk_i2c1] = { .dt_id = TEGRA114_CLK_I2C1, .present = true }, | 687 | [tegra_clk_i2c1] = { .dt_id = TEGRA114_CLK_I2C1, .present = true }, |
688 | [tegra_clk_ndflash] = { .dt_id = TEGRA114_CLK_NDFLASH, .present = true }, | 688 | [tegra_clk_ndflash] = { .dt_id = TEGRA114_CLK_NDFLASH, .present = true }, |
689 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true }, | 689 | [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true }, |
690 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true }, | 690 | [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true }, |
691 | [tegra_clk_pwm] = { .dt_id = TEGRA114_CLK_PWM, .present = true }, | 691 | [tegra_clk_pwm] = { .dt_id = TEGRA114_CLK_PWM, .present = true }, |
692 | [tegra_clk_i2s0] = { .dt_id = TEGRA114_CLK_I2S0, .present = true }, | 692 | [tegra_clk_i2s0] = { .dt_id = TEGRA114_CLK_I2S0, .present = true }, |
693 | [tegra_clk_i2s2] = { .dt_id = TEGRA114_CLK_I2S2, .present = true }, | 693 | [tegra_clk_i2s2] = { .dt_id = TEGRA114_CLK_I2S2, .present = true }, |
@@ -723,7 +723,7 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = { | |||
723 | [tegra_clk_bsev] = { .dt_id = TEGRA114_CLK_BSEV, .present = true }, | 723 | [tegra_clk_bsev] = { .dt_id = TEGRA114_CLK_BSEV, .present = true }, |
724 | [tegra_clk_i2c3] = { .dt_id = TEGRA114_CLK_I2C3, .present = true }, | 724 | [tegra_clk_i2c3] = { .dt_id = TEGRA114_CLK_I2C3, .present = true }, |
725 | [tegra_clk_sbc4_8] = { .dt_id = TEGRA114_CLK_SBC4, .present = true }, | 725 | [tegra_clk_sbc4_8] = { .dt_id = TEGRA114_CLK_SBC4, .present = true }, |
726 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true }, | 726 | [tegra_clk_sdmmc3_8] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true }, |
727 | [tegra_clk_owr] = { .dt_id = TEGRA114_CLK_OWR, .present = true }, | 727 | [tegra_clk_owr] = { .dt_id = TEGRA114_CLK_OWR, .present = true }, |
728 | [tegra_clk_csite] = { .dt_id = TEGRA114_CLK_CSITE, .present = true }, | 728 | [tegra_clk_csite] = { .dt_id = TEGRA114_CLK_CSITE, .present = true }, |
729 | [tegra_clk_la] = { .dt_id = TEGRA114_CLK_LA, .present = true }, | 729 | [tegra_clk_la] = { .dt_id = TEGRA114_CLK_LA, .present = true }, |
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c index aff86b5bc745..166e02f16c8a 100644 --- a/drivers/clk/tegra/clk-tegra124.c +++ b/drivers/clk/tegra/clk-tegra124.c | |||
@@ -516,11 +516,11 @@ static struct div_nmp pllp_nmp = { | |||
516 | }; | 516 | }; |
517 | 517 | ||
518 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | 518 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { |
519 | {12000000, 216000000, 432, 12, 1, 8}, | 519 | {12000000, 408000000, 408, 12, 0, 8}, |
520 | {13000000, 216000000, 432, 13, 1, 8}, | 520 | {13000000, 408000000, 408, 13, 0, 8}, |
521 | {16800000, 216000000, 360, 14, 1, 8}, | 521 | {16800000, 408000000, 340, 14, 0, 8}, |
522 | {19200000, 216000000, 360, 16, 1, 8}, | 522 | {19200000, 408000000, 340, 16, 0, 8}, |
523 | {26000000, 216000000, 432, 26, 1, 8}, | 523 | {26000000, 408000000, 408, 26, 0, 8}, |
524 | {0, 0, 0, 0, 0, 0}, | 524 | {0, 0, 0, 0, 0, 0}, |
525 | }; | 525 | }; |
526 | 526 | ||
@@ -570,6 +570,15 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
570 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | 570 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, |
571 | }; | 571 | }; |
572 | 572 | ||
573 | static struct div_nmp plld_nmp = { | ||
574 | .divm_shift = 0, | ||
575 | .divm_width = 5, | ||
576 | .divn_shift = 8, | ||
577 | .divn_width = 11, | ||
578 | .divp_shift = 20, | ||
579 | .divp_width = 3, | ||
580 | }; | ||
581 | |||
573 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | 582 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
574 | {12000000, 216000000, 864, 12, 4, 12}, | 583 | {12000000, 216000000, 864, 12, 4, 12}, |
575 | {13000000, 216000000, 864, 13, 4, 12}, | 584 | {13000000, 216000000, 864, 13, 4, 12}, |
@@ -603,19 +612,18 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
603 | .lock_mask = PLL_BASE_LOCK, | 612 | .lock_mask = PLL_BASE_LOCK, |
604 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 613 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
605 | .lock_delay = 1000, | 614 | .lock_delay = 1000, |
606 | .div_nmp = &pllp_nmp, | 615 | .div_nmp = &plld_nmp, |
607 | .freq_table = pll_d_freq_table, | 616 | .freq_table = pll_d_freq_table, |
608 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | 617 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | |
609 | TEGRA_PLL_USE_LOCK, | 618 | TEGRA_PLL_USE_LOCK, |
610 | }; | 619 | }; |
611 | 620 | ||
612 | static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = { | 621 | static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = { |
613 | { 12000000, 148500000, 99, 1, 8}, | 622 | { 12000000, 594000000, 99, 1, 2}, |
614 | { 12000000, 594000000, 99, 1, 1}, | 623 | { 13000000, 594000000, 91, 1, 2}, /* actual: 591.5 MHz */ |
615 | { 13000000, 594000000, 91, 1, 1}, /* actual: 591.5 MHz */ | 624 | { 16800000, 594000000, 71, 1, 2}, /* actual: 596.4 MHz */ |
616 | { 16800000, 594000000, 71, 1, 1}, /* actual: 596.4 MHz */ | 625 | { 19200000, 594000000, 62, 1, 2}, /* actual: 595.2 MHz */ |
617 | { 19200000, 594000000, 62, 1, 1}, /* actual: 595.2 MHz */ | 626 | { 26000000, 594000000, 91, 2, 2}, /* actual: 591.5 MHz */ |
618 | { 26000000, 594000000, 91, 2, 1}, /* actual: 591.5 MHz */ | ||
619 | { 0, 0, 0, 0, 0, 0 }, | 627 | { 0, 0, 0, 0, 0, 0 }, |
620 | }; | 628 | }; |
621 | 629 | ||
@@ -753,21 +761,19 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | |||
753 | [tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true }, | 761 | [tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true }, |
754 | [tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true }, | 762 | [tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true }, |
755 | [tegra_clk_uarta] = { .dt_id = TEGRA124_CLK_UARTA, .present = true }, | 763 | [tegra_clk_uarta] = { .dt_id = TEGRA124_CLK_UARTA, .present = true }, |
756 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true }, | 764 | [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true }, |
757 | [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true }, | 765 | [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true }, |
758 | [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true }, | 766 | [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true }, |
759 | [tegra_clk_ndflash] = { .dt_id = TEGRA124_CLK_NDFLASH, .present = true }, | 767 | [tegra_clk_ndflash] = { .dt_id = TEGRA124_CLK_NDFLASH, .present = true }, |
760 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true }, | 768 | [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true }, |
761 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true }, | 769 | [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true }, |
762 | [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true }, | 770 | [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true }, |
763 | [tegra_clk_i2s2] = { .dt_id = TEGRA124_CLK_I2S2, .present = true }, | 771 | [tegra_clk_i2s2] = { .dt_id = TEGRA124_CLK_I2S2, .present = true }, |
764 | [tegra_clk_gr2d] = { .dt_id = TEGRA124_CLK_GR_2D, .present = true }, | ||
765 | [tegra_clk_usbd] = { .dt_id = TEGRA124_CLK_USBD, .present = true }, | 772 | [tegra_clk_usbd] = { .dt_id = TEGRA124_CLK_USBD, .present = true }, |
766 | [tegra_clk_isp_8] = { .dt_id = TEGRA124_CLK_ISP, .present = true }, | 773 | [tegra_clk_isp_8] = { .dt_id = TEGRA124_CLK_ISP, .present = true }, |
767 | [tegra_clk_gr3d] = { .dt_id = TEGRA124_CLK_GR_3D, .present = true }, | ||
768 | [tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true }, | 774 | [tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true }, |
769 | [tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true }, | 775 | [tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true }, |
770 | [tegra_clk_host1x] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true }, | 776 | [tegra_clk_host1x_8] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true }, |
771 | [tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true }, | 777 | [tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true }, |
772 | [tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true }, | 778 | [tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true }, |
773 | [tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true }, | 779 | [tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true }, |
@@ -794,7 +800,7 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | |||
794 | [tegra_clk_uartd] = { .dt_id = TEGRA124_CLK_UARTD, .present = true }, | 800 | [tegra_clk_uartd] = { .dt_id = TEGRA124_CLK_UARTD, .present = true }, |
795 | [tegra_clk_i2c3] = { .dt_id = TEGRA124_CLK_I2C3, .present = true }, | 801 | [tegra_clk_i2c3] = { .dt_id = TEGRA124_CLK_I2C3, .present = true }, |
796 | [tegra_clk_sbc4] = { .dt_id = TEGRA124_CLK_SBC4, .present = true }, | 802 | [tegra_clk_sbc4] = { .dt_id = TEGRA124_CLK_SBC4, .present = true }, |
797 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA124_CLK_SDMMC3, .present = true }, | 803 | [tegra_clk_sdmmc3_8] = { .dt_id = TEGRA124_CLK_SDMMC3, .present = true }, |
798 | [tegra_clk_pcie] = { .dt_id = TEGRA124_CLK_PCIE, .present = true }, | 804 | [tegra_clk_pcie] = { .dt_id = TEGRA124_CLK_PCIE, .present = true }, |
799 | [tegra_clk_owr] = { .dt_id = TEGRA124_CLK_OWR, .present = true }, | 805 | [tegra_clk_owr] = { .dt_id = TEGRA124_CLK_OWR, .present = true }, |
800 | [tegra_clk_afi] = { .dt_id = TEGRA124_CLK_AFI, .present = true }, | 806 | [tegra_clk_afi] = { .dt_id = TEGRA124_CLK_AFI, .present = true }, |
@@ -1286,9 +1292,9 @@ static void __init tegra124_pll_init(void __iomem *clk_base, | |||
1286 | clk_register_clkdev(clk, "pll_d2", NULL); | 1292 | clk_register_clkdev(clk, "pll_d2", NULL); |
1287 | clks[TEGRA124_CLK_PLL_D2] = clk; | 1293 | clks[TEGRA124_CLK_PLL_D2] = clk; |
1288 | 1294 | ||
1289 | /* PLLD2_OUT0 ?? */ | 1295 | /* PLLD2_OUT0 */ |
1290 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", | 1296 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", |
1291 | CLK_SET_RATE_PARENT, 1, 2); | 1297 | CLK_SET_RATE_PARENT, 1, 1); |
1292 | clk_register_clkdev(clk, "pll_d2_out0", NULL); | 1298 | clk_register_clkdev(clk, "pll_d2_out0", NULL); |
1293 | clks[TEGRA124_CLK_PLL_D2_OUT0] = clk; | 1299 | clks[TEGRA124_CLK_PLL_D2_OUT0] = clk; |
1294 | 1300 | ||
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index dbace152b2fa..dace2b1b5ae6 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -574,6 +574,8 @@ static struct tegra_clk tegra20_clks[tegra_clk_max] __initdata = { | |||
574 | [tegra_clk_tvdac] = { .dt_id = TEGRA20_CLK_TVDAC, .present = true }, | 574 | [tegra_clk_tvdac] = { .dt_id = TEGRA20_CLK_TVDAC, .present = true }, |
575 | [tegra_clk_vi_sensor] = { .dt_id = TEGRA20_CLK_VI_SENSOR, .present = true }, | 575 | [tegra_clk_vi_sensor] = { .dt_id = TEGRA20_CLK_VI_SENSOR, .present = true }, |
576 | [tegra_clk_afi] = { .dt_id = TEGRA20_CLK_AFI, .present = true }, | 576 | [tegra_clk_afi] = { .dt_id = TEGRA20_CLK_AFI, .present = true }, |
577 | [tegra_clk_fuse] = { .dt_id = TEGRA20_CLK_FUSE, .present = true }, | ||
578 | [tegra_clk_kfuse] = { .dt_id = TEGRA20_CLK_KFUSE, .present = true }, | ||
577 | }; | 579 | }; |
578 | 580 | ||
579 | static unsigned long tegra20_clk_measure_input_freq(void) | 581 | static unsigned long tegra20_clk_measure_input_freq(void) |
diff --git a/drivers/clocksource/vf_pit_timer.c b/drivers/clocksource/vf_pit_timer.c index 02821b06a39e..a918bc481c52 100644 --- a/drivers/clocksource/vf_pit_timer.c +++ b/drivers/clocksource/vf_pit_timer.c | |||
@@ -54,7 +54,7 @@ static inline void pit_irq_acknowledge(void) | |||
54 | 54 | ||
55 | static u64 pit_read_sched_clock(void) | 55 | static u64 pit_read_sched_clock(void) |
56 | { | 56 | { |
57 | return __raw_readl(clksrc_base + PITCVAL); | 57 | return ~__raw_readl(clksrc_base + PITCVAL); |
58 | } | 58 | } |
59 | 59 | ||
60 | static int __init pit_clocksource_init(unsigned long rate) | 60 | static int __init pit_clocksource_init(unsigned long rate) |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cb003a6b72c8..199b52b7c3e1 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1109,12 +1109,27 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
1109 | goto err_set_policy_cpu; | 1109 | goto err_set_policy_cpu; |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | /* related cpus should atleast have policy->cpus */ | ||
1113 | cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); | ||
1114 | |||
1115 | /* | ||
1116 | * affected cpus must always be the one, which are online. We aren't | ||
1117 | * managing offline cpus here. | ||
1118 | */ | ||
1119 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); | ||
1120 | |||
1121 | if (!frozen) { | ||
1122 | policy->user_policy.min = policy->min; | ||
1123 | policy->user_policy.max = policy->max; | ||
1124 | } | ||
1125 | |||
1126 | down_write(&policy->rwsem); | ||
1112 | write_lock_irqsave(&cpufreq_driver_lock, flags); | 1127 | write_lock_irqsave(&cpufreq_driver_lock, flags); |
1113 | for_each_cpu(j, policy->cpus) | 1128 | for_each_cpu(j, policy->cpus) |
1114 | per_cpu(cpufreq_cpu_data, j) = policy; | 1129 | per_cpu(cpufreq_cpu_data, j) = policy; |
1115 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1130 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1116 | 1131 | ||
1117 | if (cpufreq_driver->get) { | 1132 | if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { |
1118 | policy->cur = cpufreq_driver->get(policy->cpu); | 1133 | policy->cur = cpufreq_driver->get(policy->cpu); |
1119 | if (!policy->cur) { | 1134 | if (!policy->cur) { |
1120 | pr_err("%s: ->get() failed\n", __func__); | 1135 | pr_err("%s: ->get() failed\n", __func__); |
@@ -1162,20 +1177,6 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
1162 | } | 1177 | } |
1163 | } | 1178 | } |
1164 | 1179 | ||
1165 | /* related cpus should atleast have policy->cpus */ | ||
1166 | cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); | ||
1167 | |||
1168 | /* | ||
1169 | * affected cpus must always be the one, which are online. We aren't | ||
1170 | * managing offline cpus here. | ||
1171 | */ | ||
1172 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); | ||
1173 | |||
1174 | if (!frozen) { | ||
1175 | policy->user_policy.min = policy->min; | ||
1176 | policy->user_policy.max = policy->max; | ||
1177 | } | ||
1178 | |||
1179 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, | 1180 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
1180 | CPUFREQ_START, policy); | 1181 | CPUFREQ_START, policy); |
1181 | 1182 | ||
@@ -1206,6 +1207,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
1206 | policy->user_policy.policy = policy->policy; | 1207 | policy->user_policy.policy = policy->policy; |
1207 | policy->user_policy.governor = policy->governor; | 1208 | policy->user_policy.governor = policy->governor; |
1208 | } | 1209 | } |
1210 | up_write(&policy->rwsem); | ||
1209 | 1211 | ||
1210 | kobject_uevent(&policy->kobj, KOBJ_ADD); | 1212 | kobject_uevent(&policy->kobj, KOBJ_ADD); |
1211 | up_read(&cpufreq_rwsem); | 1213 | up_read(&cpufreq_rwsem); |
@@ -1546,23 +1548,16 @@ static unsigned int __cpufreq_get(unsigned int cpu) | |||
1546 | */ | 1548 | */ |
1547 | unsigned int cpufreq_get(unsigned int cpu) | 1549 | unsigned int cpufreq_get(unsigned int cpu) |
1548 | { | 1550 | { |
1549 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); | 1551 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
1550 | unsigned int ret_freq = 0; | 1552 | unsigned int ret_freq = 0; |
1551 | 1553 | ||
1552 | if (cpufreq_disabled() || !cpufreq_driver) | 1554 | if (policy) { |
1553 | return -ENOENT; | 1555 | down_read(&policy->rwsem); |
1554 | 1556 | ret_freq = __cpufreq_get(cpu); | |
1555 | BUG_ON(!policy); | 1557 | up_read(&policy->rwsem); |
1556 | |||
1557 | if (!down_read_trylock(&cpufreq_rwsem)) | ||
1558 | return 0; | ||
1559 | |||
1560 | down_read(&policy->rwsem); | ||
1561 | |||
1562 | ret_freq = __cpufreq_get(cpu); | ||
1563 | 1558 | ||
1564 | up_read(&policy->rwsem); | 1559 | cpufreq_cpu_put(policy); |
1565 | up_read(&cpufreq_rwsem); | 1560 | } |
1566 | 1561 | ||
1567 | return ret_freq; | 1562 | return ret_freq; |
1568 | } | 1563 | } |
@@ -2148,7 +2143,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
2148 | * BIOS might change freq behind our back | 2143 | * BIOS might change freq behind our back |
2149 | * -> ask driver for current freq and notify governors about a change | 2144 | * -> ask driver for current freq and notify governors about a change |
2150 | */ | 2145 | */ |
2151 | if (cpufreq_driver->get) { | 2146 | if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { |
2152 | new_policy.cur = cpufreq_driver->get(cpu); | 2147 | new_policy.cur = cpufreq_driver->get(cpu); |
2153 | if (!policy->cur) { | 2148 | if (!policy->cur) { |
2154 | pr_debug("Driver did not initialize current freq"); | 2149 | pr_debug("Driver did not initialize current freq"); |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index e90816105921..2cd36b9297f3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -39,9 +39,10 @@ | |||
39 | #define BYT_TURBO_RATIOS 0x66c | 39 | #define BYT_TURBO_RATIOS 0x66c |
40 | 40 | ||
41 | 41 | ||
42 | #define FRAC_BITS 8 | 42 | #define FRAC_BITS 6 |
43 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) | 43 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) |
44 | #define fp_toint(X) ((X) >> FRAC_BITS) | 44 | #define fp_toint(X) ((X) >> FRAC_BITS) |
45 | #define FP_ROUNDUP(X) ((X) += 1 << FRAC_BITS) | ||
45 | 46 | ||
46 | static inline int32_t mul_fp(int32_t x, int32_t y) | 47 | static inline int32_t mul_fp(int32_t x, int32_t y) |
47 | { | 48 | { |
@@ -556,18 +557,20 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) | |||
556 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, | 557 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, |
557 | struct sample *sample) | 558 | struct sample *sample) |
558 | { | 559 | { |
559 | u64 core_pct; | 560 | int32_t core_pct; |
560 | u64 c0_pct; | 561 | int32_t c0_pct; |
561 | 562 | ||
562 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); | 563 | core_pct = div_fp(int_tofp((sample->aperf)), |
564 | int_tofp((sample->mperf))); | ||
565 | core_pct = mul_fp(core_pct, int_tofp(100)); | ||
566 | FP_ROUNDUP(core_pct); | ||
567 | |||
568 | c0_pct = div_fp(int_tofp(sample->mperf), int_tofp(sample->tsc)); | ||
563 | 569 | ||
564 | c0_pct = div64_u64(sample->mperf * 100, sample->tsc); | ||
565 | sample->freq = fp_toint( | 570 | sample->freq = fp_toint( |
566 | mul_fp(int_tofp(cpu->pstate.max_pstate), | 571 | mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); |
567 | int_tofp(core_pct * 1000))); | ||
568 | 572 | ||
569 | sample->core_pct_busy = mul_fp(int_tofp(core_pct), | 573 | sample->core_pct_busy = mul_fp(core_pct, c0_pct); |
570 | div_fp(int_tofp(c0_pct + 1), int_tofp(100))); | ||
571 | } | 574 | } |
572 | 575 | ||
573 | static inline void intel_pstate_sample(struct cpudata *cpu) | 576 | static inline void intel_pstate_sample(struct cpudata *cpu) |
@@ -579,6 +582,10 @@ static inline void intel_pstate_sample(struct cpudata *cpu) | |||
579 | rdmsrl(MSR_IA32_MPERF, mperf); | 582 | rdmsrl(MSR_IA32_MPERF, mperf); |
580 | tsc = native_read_tsc(); | 583 | tsc = native_read_tsc(); |
581 | 584 | ||
585 | aperf = aperf >> FRAC_BITS; | ||
586 | mperf = mperf >> FRAC_BITS; | ||
587 | tsc = tsc >> FRAC_BITS; | ||
588 | |||
582 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; | 589 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; |
583 | cpu->samples[cpu->sample_ptr].aperf = aperf; | 590 | cpu->samples[cpu->sample_ptr].aperf = aperf; |
584 | cpu->samples[cpu->sample_ptr].mperf = mperf; | 591 | cpu->samples[cpu->sample_ptr].mperf = mperf; |
@@ -610,7 +617,8 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | |||
610 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; | 617 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; |
611 | max_pstate = int_tofp(cpu->pstate.max_pstate); | 618 | max_pstate = int_tofp(cpu->pstate.max_pstate); |
612 | current_pstate = int_tofp(cpu->pstate.current_pstate); | 619 | current_pstate = int_tofp(cpu->pstate.current_pstate); |
613 | return mul_fp(core_busy, div_fp(max_pstate, current_pstate)); | 620 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); |
621 | return FP_ROUNDUP(core_busy); | ||
614 | } | 622 | } |
615 | 623 | ||
616 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) | 624 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 4e7918339b12..19041cefabb1 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -449,6 +449,7 @@ static const struct of_device_id sdma_dt_ids[] = { | |||
449 | { .compatible = "fsl,imx51-sdma", .data = &sdma_imx51, }, | 449 | { .compatible = "fsl,imx51-sdma", .data = &sdma_imx51, }, |
450 | { .compatible = "fsl,imx35-sdma", .data = &sdma_imx35, }, | 450 | { .compatible = "fsl,imx35-sdma", .data = &sdma_imx35, }, |
451 | { .compatible = "fsl,imx31-sdma", .data = &sdma_imx31, }, | 451 | { .compatible = "fsl,imx31-sdma", .data = &sdma_imx31, }, |
452 | { .compatible = "fsl,imx25-sdma", .data = &sdma_imx25, }, | ||
452 | { /* sentinel */ } | 453 | { /* sentinel */ } |
453 | }; | 454 | }; |
454 | MODULE_DEVICE_TABLE(of, sdma_dt_ids); | 455 | MODULE_DEVICE_TABLE(of, sdma_dt_ids); |
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 87529181efcc..4e3549a16132 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -77,7 +77,8 @@ static irqreturn_t ioat_dma_do_interrupt(int irq, void *data) | |||
77 | attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET); | 77 | attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET); |
78 | for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) { | 78 | for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) { |
79 | chan = ioat_chan_by_index(instance, bit); | 79 | chan = ioat_chan_by_index(instance, bit); |
80 | tasklet_schedule(&chan->cleanup_task); | 80 | if (test_bit(IOAT_RUN, &chan->state)) |
81 | tasklet_schedule(&chan->cleanup_task); | ||
81 | } | 82 | } |
82 | 83 | ||
83 | writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET); | 84 | writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET); |
@@ -93,7 +94,8 @@ static irqreturn_t ioat_dma_do_interrupt_msix(int irq, void *data) | |||
93 | { | 94 | { |
94 | struct ioat_chan_common *chan = data; | 95 | struct ioat_chan_common *chan = data; |
95 | 96 | ||
96 | tasklet_schedule(&chan->cleanup_task); | 97 | if (test_bit(IOAT_RUN, &chan->state)) |
98 | tasklet_schedule(&chan->cleanup_task); | ||
97 | 99 | ||
98 | return IRQ_HANDLED; | 100 | return IRQ_HANDLED; |
99 | } | 101 | } |
@@ -116,7 +118,6 @@ void ioat_init_channel(struct ioatdma_device *device, struct ioat_chan_common *c | |||
116 | chan->timer.function = device->timer_fn; | 118 | chan->timer.function = device->timer_fn; |
117 | chan->timer.data = data; | 119 | chan->timer.data = data; |
118 | tasklet_init(&chan->cleanup_task, device->cleanup_fn, data); | 120 | tasklet_init(&chan->cleanup_task, device->cleanup_fn, data); |
119 | tasklet_disable(&chan->cleanup_task); | ||
120 | } | 121 | } |
121 | 122 | ||
122 | /** | 123 | /** |
@@ -354,13 +355,49 @@ static int ioat1_dma_alloc_chan_resources(struct dma_chan *c) | |||
354 | writel(((u64) chan->completion_dma) >> 32, | 355 | writel(((u64) chan->completion_dma) >> 32, |
355 | chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); | 356 | chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); |
356 | 357 | ||
357 | tasklet_enable(&chan->cleanup_task); | 358 | set_bit(IOAT_RUN, &chan->state); |
358 | ioat1_dma_start_null_desc(ioat); /* give chain to dma device */ | 359 | ioat1_dma_start_null_desc(ioat); /* give chain to dma device */ |
359 | dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n", | 360 | dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n", |
360 | __func__, ioat->desccount); | 361 | __func__, ioat->desccount); |
361 | return ioat->desccount; | 362 | return ioat->desccount; |
362 | } | 363 | } |
363 | 364 | ||
365 | void ioat_stop(struct ioat_chan_common *chan) | ||
366 | { | ||
367 | struct ioatdma_device *device = chan->device; | ||
368 | struct pci_dev *pdev = device->pdev; | ||
369 | int chan_id = chan_num(chan); | ||
370 | struct msix_entry *msix; | ||
371 | |||
372 | /* 1/ stop irq from firing tasklets | ||
373 | * 2/ stop the tasklet from re-arming irqs | ||
374 | */ | ||
375 | clear_bit(IOAT_RUN, &chan->state); | ||
376 | |||
377 | /* flush inflight interrupts */ | ||
378 | switch (device->irq_mode) { | ||
379 | case IOAT_MSIX: | ||
380 | msix = &device->msix_entries[chan_id]; | ||
381 | synchronize_irq(msix->vector); | ||
382 | break; | ||
383 | case IOAT_MSI: | ||
384 | case IOAT_INTX: | ||
385 | synchronize_irq(pdev->irq); | ||
386 | break; | ||
387 | default: | ||
388 | break; | ||
389 | } | ||
390 | |||
391 | /* flush inflight timers */ | ||
392 | del_timer_sync(&chan->timer); | ||
393 | |||
394 | /* flush inflight tasklet runs */ | ||
395 | tasklet_kill(&chan->cleanup_task); | ||
396 | |||
397 | /* final cleanup now that everything is quiesced and can't re-arm */ | ||
398 | device->cleanup_fn((unsigned long) &chan->common); | ||
399 | } | ||
400 | |||
364 | /** | 401 | /** |
365 | * ioat1_dma_free_chan_resources - release all the descriptors | 402 | * ioat1_dma_free_chan_resources - release all the descriptors |
366 | * @chan: the channel to be cleaned | 403 | * @chan: the channel to be cleaned |
@@ -379,9 +416,7 @@ static void ioat1_dma_free_chan_resources(struct dma_chan *c) | |||
379 | if (ioat->desccount == 0) | 416 | if (ioat->desccount == 0) |
380 | return; | 417 | return; |
381 | 418 | ||
382 | tasklet_disable(&chan->cleanup_task); | 419 | ioat_stop(chan); |
383 | del_timer_sync(&chan->timer); | ||
384 | ioat1_cleanup(ioat); | ||
385 | 420 | ||
386 | /* Delay 100ms after reset to allow internal DMA logic to quiesce | 421 | /* Delay 100ms after reset to allow internal DMA logic to quiesce |
387 | * before removing DMA descriptor resources. | 422 | * before removing DMA descriptor resources. |
@@ -526,8 +561,11 @@ ioat1_dma_prep_memcpy(struct dma_chan *c, dma_addr_t dma_dest, | |||
526 | static void ioat1_cleanup_event(unsigned long data) | 561 | static void ioat1_cleanup_event(unsigned long data) |
527 | { | 562 | { |
528 | struct ioat_dma_chan *ioat = to_ioat_chan((void *) data); | 563 | struct ioat_dma_chan *ioat = to_ioat_chan((void *) data); |
564 | struct ioat_chan_common *chan = &ioat->base; | ||
529 | 565 | ||
530 | ioat1_cleanup(ioat); | 566 | ioat1_cleanup(ioat); |
567 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
568 | return; | ||
531 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 569 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
532 | } | 570 | } |
533 | 571 | ||
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index 11fb877ddca9..e982f00a9843 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -356,6 +356,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | |||
356 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 356 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
357 | void ioat_kobject_del(struct ioatdma_device *device); | 357 | void ioat_kobject_del(struct ioatdma_device *device); |
358 | int ioat_dma_setup_interrupts(struct ioatdma_device *device); | 358 | int ioat_dma_setup_interrupts(struct ioatdma_device *device); |
359 | void ioat_stop(struct ioat_chan_common *chan); | ||
359 | extern const struct sysfs_ops ioat_sysfs_ops; | 360 | extern const struct sysfs_ops ioat_sysfs_ops; |
360 | extern struct ioat_sysfs_entry ioat_version_attr; | 361 | extern struct ioat_sysfs_entry ioat_version_attr; |
361 | extern struct ioat_sysfs_entry ioat_cap_attr; | 362 | extern struct ioat_sysfs_entry ioat_cap_attr; |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 5d3affe7e976..8d1058085eeb 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -190,8 +190,11 @@ static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | |||
190 | void ioat2_cleanup_event(unsigned long data) | 190 | void ioat2_cleanup_event(unsigned long data) |
191 | { | 191 | { |
192 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); | 192 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); |
193 | struct ioat_chan_common *chan = &ioat->base; | ||
193 | 194 | ||
194 | ioat2_cleanup(ioat); | 195 | ioat2_cleanup(ioat); |
196 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
197 | return; | ||
195 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 198 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
196 | } | 199 | } |
197 | 200 | ||
@@ -553,10 +556,10 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
553 | ioat->issued = 0; | 556 | ioat->issued = 0; |
554 | ioat->tail = 0; | 557 | ioat->tail = 0; |
555 | ioat->alloc_order = order; | 558 | ioat->alloc_order = order; |
559 | set_bit(IOAT_RUN, &chan->state); | ||
556 | spin_unlock_bh(&ioat->prep_lock); | 560 | spin_unlock_bh(&ioat->prep_lock); |
557 | spin_unlock_bh(&chan->cleanup_lock); | 561 | spin_unlock_bh(&chan->cleanup_lock); |
558 | 562 | ||
559 | tasklet_enable(&chan->cleanup_task); | ||
560 | ioat2_start_null_desc(ioat); | 563 | ioat2_start_null_desc(ioat); |
561 | 564 | ||
562 | /* check that we got off the ground */ | 565 | /* check that we got off the ground */ |
@@ -566,7 +569,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
566 | } while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status)); | 569 | } while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status)); |
567 | 570 | ||
568 | if (is_ioat_active(status) || is_ioat_idle(status)) { | 571 | if (is_ioat_active(status) || is_ioat_idle(status)) { |
569 | set_bit(IOAT_RUN, &chan->state); | ||
570 | return 1 << ioat->alloc_order; | 572 | return 1 << ioat->alloc_order; |
571 | } else { | 573 | } else { |
572 | u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | 574 | u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); |
@@ -809,11 +811,8 @@ void ioat2_free_chan_resources(struct dma_chan *c) | |||
809 | if (!ioat->ring) | 811 | if (!ioat->ring) |
810 | return; | 812 | return; |
811 | 813 | ||
812 | tasklet_disable(&chan->cleanup_task); | 814 | ioat_stop(chan); |
813 | del_timer_sync(&chan->timer); | ||
814 | device->cleanup_fn((unsigned long) c); | ||
815 | device->reset_hw(chan); | 815 | device->reset_hw(chan); |
816 | clear_bit(IOAT_RUN, &chan->state); | ||
817 | 816 | ||
818 | spin_lock_bh(&chan->cleanup_lock); | 817 | spin_lock_bh(&chan->cleanup_lock); |
819 | spin_lock_bh(&ioat->prep_lock); | 818 | spin_lock_bh(&ioat->prep_lock); |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 820817e97e62..b9b38a1cf92f 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -464,8 +464,11 @@ static void ioat3_cleanup(struct ioat2_dma_chan *ioat) | |||
464 | static void ioat3_cleanup_event(unsigned long data) | 464 | static void ioat3_cleanup_event(unsigned long data) |
465 | { | 465 | { |
466 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); | 466 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); |
467 | struct ioat_chan_common *chan = &ioat->base; | ||
467 | 468 | ||
468 | ioat3_cleanup(ioat); | 469 | ioat3_cleanup(ioat); |
470 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
471 | return; | ||
469 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 472 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
470 | } | 473 | } |
471 | 474 | ||
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 00a2de957b23..bf18c786ed40 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -1641,6 +1641,7 @@ static void dma_tasklet(unsigned long data) | |||
1641 | struct d40_chan *d40c = (struct d40_chan *) data; | 1641 | struct d40_chan *d40c = (struct d40_chan *) data; |
1642 | struct d40_desc *d40d; | 1642 | struct d40_desc *d40d; |
1643 | unsigned long flags; | 1643 | unsigned long flags; |
1644 | bool callback_active; | ||
1644 | dma_async_tx_callback callback; | 1645 | dma_async_tx_callback callback; |
1645 | void *callback_param; | 1646 | void *callback_param; |
1646 | 1647 | ||
@@ -1668,6 +1669,7 @@ static void dma_tasklet(unsigned long data) | |||
1668 | } | 1669 | } |
1669 | 1670 | ||
1670 | /* Callback to client */ | 1671 | /* Callback to client */ |
1672 | callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT); | ||
1671 | callback = d40d->txd.callback; | 1673 | callback = d40d->txd.callback; |
1672 | callback_param = d40d->txd.callback_param; | 1674 | callback_param = d40d->txd.callback_param; |
1673 | 1675 | ||
@@ -1690,7 +1692,7 @@ static void dma_tasklet(unsigned long data) | |||
1690 | 1692 | ||
1691 | spin_unlock_irqrestore(&d40c->lock, flags); | 1693 | spin_unlock_irqrestore(&d40c->lock, flags); |
1692 | 1694 | ||
1693 | if (callback && (d40d->txd.flags & DMA_PREP_INTERRUPT)) | 1695 | if (callback_active && callback) |
1694 | callback(callback_param); | 1696 | callback(callback_param); |
1695 | 1697 | ||
1696 | return; | 1698 | return; |
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c index d63f4798f7d0..57e96a3350f0 100644 --- a/drivers/edac/i7300_edac.c +++ b/drivers/edac/i7300_edac.c | |||
@@ -943,33 +943,35 @@ static int i7300_get_devices(struct mem_ctl_info *mci) | |||
943 | 943 | ||
944 | /* Attempt to 'get' the MCH register we want */ | 944 | /* Attempt to 'get' the MCH register we want */ |
945 | pdev = NULL; | 945 | pdev = NULL; |
946 | while (!pvt->pci_dev_16_1_fsb_addr_map || | 946 | while ((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
947 | !pvt->pci_dev_16_2_fsb_err_regs) { | 947 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, |
948 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 948 | pdev))) { |
949 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, pdev); | ||
950 | if (!pdev) { | ||
951 | /* End of list, leave */ | ||
952 | i7300_printk(KERN_ERR, | ||
953 | "'system address,Process Bus' " | ||
954 | "device not found:" | ||
955 | "vendor 0x%x device 0x%x ERR funcs " | ||
956 | "(broken BIOS?)\n", | ||
957 | PCI_VENDOR_ID_INTEL, | ||
958 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR); | ||
959 | goto error; | ||
960 | } | ||
961 | |||
962 | /* Store device 16 funcs 1 and 2 */ | 949 | /* Store device 16 funcs 1 and 2 */ |
963 | switch (PCI_FUNC(pdev->devfn)) { | 950 | switch (PCI_FUNC(pdev->devfn)) { |
964 | case 1: | 951 | case 1: |
965 | pvt->pci_dev_16_1_fsb_addr_map = pdev; | 952 | if (!pvt->pci_dev_16_1_fsb_addr_map) |
953 | pvt->pci_dev_16_1_fsb_addr_map = | ||
954 | pci_dev_get(pdev); | ||
966 | break; | 955 | break; |
967 | case 2: | 956 | case 2: |
968 | pvt->pci_dev_16_2_fsb_err_regs = pdev; | 957 | if (!pvt->pci_dev_16_2_fsb_err_regs) |
958 | pvt->pci_dev_16_2_fsb_err_regs = | ||
959 | pci_dev_get(pdev); | ||
969 | break; | 960 | break; |
970 | } | 961 | } |
971 | } | 962 | } |
972 | 963 | ||
964 | if (!pvt->pci_dev_16_1_fsb_addr_map || | ||
965 | !pvt->pci_dev_16_2_fsb_err_regs) { | ||
966 | /* At least one device was not found */ | ||
967 | i7300_printk(KERN_ERR, | ||
968 | "'system address,Process Bus' device not found:" | ||
969 | "vendor 0x%x device 0x%x ERR funcs (broken BIOS?)\n", | ||
970 | PCI_VENDOR_ID_INTEL, | ||
971 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR); | ||
972 | goto error; | ||
973 | } | ||
974 | |||
973 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", | 975 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", |
974 | pci_name(pvt->pci_dev_16_0_fsb_ctlr), | 976 | pci_name(pvt->pci_dev_16_0_fsb_ctlr), |
975 | pvt->pci_dev_16_0_fsb_ctlr->vendor, | 977 | pvt->pci_dev_16_0_fsb_ctlr->vendor, |
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 87533ca7752e..d871275196f6 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -1334,14 +1334,19 @@ static int i7core_get_onedevice(struct pci_dev **prev, | |||
1334 | * is at addr 8086:2c40, instead of 8086:2c41. So, we need | 1334 | * is at addr 8086:2c40, instead of 8086:2c41. So, we need |
1335 | * to probe for the alternate address in case of failure | 1335 | * to probe for the alternate address in case of failure |
1336 | */ | 1336 | */ |
1337 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) | 1337 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) { |
1338 | pci_dev_get(*prev); /* pci_get_device will put it */ | ||
1338 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 1339 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
1339 | PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev); | 1340 | PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev); |
1341 | } | ||
1340 | 1342 | ||
1341 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev) | 1343 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && |
1344 | !pdev) { | ||
1345 | pci_dev_get(*prev); /* pci_get_device will put it */ | ||
1342 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 1346 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
1343 | PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT, | 1347 | PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT, |
1344 | *prev); | 1348 | *prev); |
1349 | } | ||
1345 | 1350 | ||
1346 | if (!pdev) { | 1351 | if (!pdev) { |
1347 | if (*prev) { | 1352 | if (*prev) { |
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index c20602f601ee..98a14f6143a7 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -222,27 +222,19 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info) | |||
222 | struct snd_soc_dapm_context *dapm = arizona->dapm; | 222 | struct snd_soc_dapm_context *dapm = arizona->dapm; |
223 | int ret; | 223 | int ret; |
224 | 224 | ||
225 | mutex_lock(&dapm->card->dapm_mutex); | ||
226 | |||
227 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); | 225 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); |
228 | if (ret != 0) | 226 | if (ret != 0) |
229 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", | 227 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", |
230 | widget, ret); | 228 | widget, ret); |
231 | 229 | ||
232 | mutex_unlock(&dapm->card->dapm_mutex); | ||
233 | |||
234 | snd_soc_dapm_sync(dapm); | 230 | snd_soc_dapm_sync(dapm); |
235 | 231 | ||
236 | if (!arizona->pdata.micd_force_micbias) { | 232 | if (!arizona->pdata.micd_force_micbias) { |
237 | mutex_lock(&dapm->card->dapm_mutex); | ||
238 | |||
239 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); | 233 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); |
240 | if (ret != 0) | 234 | if (ret != 0) |
241 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", | 235 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", |
242 | widget, ret); | 236 | widget, ret); |
243 | 237 | ||
244 | mutex_unlock(&dapm->card->dapm_mutex); | ||
245 | |||
246 | snd_soc_dapm_sync(dapm); | 238 | snd_soc_dapm_sync(dapm); |
247 | } | 239 | } |
248 | } | 240 | } |
@@ -304,16 +296,12 @@ static void arizona_stop_mic(struct arizona_extcon_info *info) | |||
304 | ARIZONA_MICD_ENA, 0, | 296 | ARIZONA_MICD_ENA, 0, |
305 | &change); | 297 | &change); |
306 | 298 | ||
307 | mutex_lock(&dapm->card->dapm_mutex); | ||
308 | |||
309 | ret = snd_soc_dapm_disable_pin(dapm, widget); | 299 | ret = snd_soc_dapm_disable_pin(dapm, widget); |
310 | if (ret != 0) | 300 | if (ret != 0) |
311 | dev_warn(arizona->dev, | 301 | dev_warn(arizona->dev, |
312 | "Failed to disable %s: %d\n", | 302 | "Failed to disable %s: %d\n", |
313 | widget, ret); | 303 | widget, ret); |
314 | 304 | ||
315 | mutex_unlock(&dapm->card->dapm_mutex); | ||
316 | |||
317 | snd_soc_dapm_sync(dapm); | 305 | snd_soc_dapm_sync(dapm); |
318 | 306 | ||
319 | if (info->micd_reva) { | 307 | if (info->micd_reva) { |
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index de4aa409abe2..2c6d5e118ac1 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c | |||
@@ -916,7 +916,7 @@ static int lookup_existing_device(struct device *dev, void *data) | |||
916 | old->config_rom_retries = 0; | 916 | old->config_rom_retries = 0; |
917 | fw_notice(card, "rediscovered device %s\n", dev_name(dev)); | 917 | fw_notice(card, "rediscovered device %s\n", dev_name(dev)); |
918 | 918 | ||
919 | PREPARE_DELAYED_WORK(&old->work, fw_device_update); | 919 | old->workfn = fw_device_update; |
920 | fw_schedule_device_work(old, 0); | 920 | fw_schedule_device_work(old, 0); |
921 | 921 | ||
922 | if (current_node == card->root_node) | 922 | if (current_node == card->root_node) |
@@ -1075,7 +1075,7 @@ static void fw_device_init(struct work_struct *work) | |||
1075 | if (atomic_cmpxchg(&device->state, | 1075 | if (atomic_cmpxchg(&device->state, |
1076 | FW_DEVICE_INITIALIZING, | 1076 | FW_DEVICE_INITIALIZING, |
1077 | FW_DEVICE_RUNNING) == FW_DEVICE_GONE) { | 1077 | FW_DEVICE_RUNNING) == FW_DEVICE_GONE) { |
1078 | PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); | 1078 | device->workfn = fw_device_shutdown; |
1079 | fw_schedule_device_work(device, SHUTDOWN_DELAY); | 1079 | fw_schedule_device_work(device, SHUTDOWN_DELAY); |
1080 | } else { | 1080 | } else { |
1081 | fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n", | 1081 | fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n", |
@@ -1196,13 +1196,20 @@ static void fw_device_refresh(struct work_struct *work) | |||
1196 | dev_name(&device->device), fw_rcode_string(ret)); | 1196 | dev_name(&device->device), fw_rcode_string(ret)); |
1197 | gone: | 1197 | gone: |
1198 | atomic_set(&device->state, FW_DEVICE_GONE); | 1198 | atomic_set(&device->state, FW_DEVICE_GONE); |
1199 | PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); | 1199 | device->workfn = fw_device_shutdown; |
1200 | fw_schedule_device_work(device, SHUTDOWN_DELAY); | 1200 | fw_schedule_device_work(device, SHUTDOWN_DELAY); |
1201 | out: | 1201 | out: |
1202 | if (node_id == card->root_node->node_id) | 1202 | if (node_id == card->root_node->node_id) |
1203 | fw_schedule_bm_work(card, 0); | 1203 | fw_schedule_bm_work(card, 0); |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | static void fw_device_workfn(struct work_struct *work) | ||
1207 | { | ||
1208 | struct fw_device *device = container_of(to_delayed_work(work), | ||
1209 | struct fw_device, work); | ||
1210 | device->workfn(work); | ||
1211 | } | ||
1212 | |||
1206 | void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | 1213 | void fw_node_event(struct fw_card *card, struct fw_node *node, int event) |
1207 | { | 1214 | { |
1208 | struct fw_device *device; | 1215 | struct fw_device *device; |
@@ -1252,7 +1259,8 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1252 | * power-up after getting plugged in. We schedule the | 1259 | * power-up after getting plugged in. We schedule the |
1253 | * first config rom scan half a second after bus reset. | 1260 | * first config rom scan half a second after bus reset. |
1254 | */ | 1261 | */ |
1255 | INIT_DELAYED_WORK(&device->work, fw_device_init); | 1262 | device->workfn = fw_device_init; |
1263 | INIT_DELAYED_WORK(&device->work, fw_device_workfn); | ||
1256 | fw_schedule_device_work(device, INITIAL_DELAY); | 1264 | fw_schedule_device_work(device, INITIAL_DELAY); |
1257 | break; | 1265 | break; |
1258 | 1266 | ||
@@ -1268,7 +1276,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1268 | if (atomic_cmpxchg(&device->state, | 1276 | if (atomic_cmpxchg(&device->state, |
1269 | FW_DEVICE_RUNNING, | 1277 | FW_DEVICE_RUNNING, |
1270 | FW_DEVICE_INITIALIZING) == FW_DEVICE_RUNNING) { | 1278 | FW_DEVICE_INITIALIZING) == FW_DEVICE_RUNNING) { |
1271 | PREPARE_DELAYED_WORK(&device->work, fw_device_refresh); | 1279 | device->workfn = fw_device_refresh; |
1272 | fw_schedule_device_work(device, | 1280 | fw_schedule_device_work(device, |
1273 | device->is_local ? 0 : INITIAL_DELAY); | 1281 | device->is_local ? 0 : INITIAL_DELAY); |
1274 | } | 1282 | } |
@@ -1283,7 +1291,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1283 | smp_wmb(); /* update node_id before generation */ | 1291 | smp_wmb(); /* update node_id before generation */ |
1284 | device->generation = card->generation; | 1292 | device->generation = card->generation; |
1285 | if (atomic_read(&device->state) == FW_DEVICE_RUNNING) { | 1293 | if (atomic_read(&device->state) == FW_DEVICE_RUNNING) { |
1286 | PREPARE_DELAYED_WORK(&device->work, fw_device_update); | 1294 | device->workfn = fw_device_update; |
1287 | fw_schedule_device_work(device, 0); | 1295 | fw_schedule_device_work(device, 0); |
1288 | } | 1296 | } |
1289 | break; | 1297 | break; |
@@ -1308,7 +1316,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1308 | device = node->data; | 1316 | device = node->data; |
1309 | if (atomic_xchg(&device->state, | 1317 | if (atomic_xchg(&device->state, |
1310 | FW_DEVICE_GONE) == FW_DEVICE_RUNNING) { | 1318 | FW_DEVICE_GONE) == FW_DEVICE_RUNNING) { |
1311 | PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); | 1319 | device->workfn = fw_device_shutdown; |
1312 | fw_schedule_device_work(device, | 1320 | fw_schedule_device_work(device, |
1313 | list_empty(&card->link) ? 0 : SHUTDOWN_DELAY); | 1321 | list_empty(&card->link) ? 0 : SHUTDOWN_DELAY); |
1314 | } | 1322 | } |
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 6b895986dc22..4af0a7bad7f2 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -929,8 +929,6 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
929 | if (rcode == RCODE_COMPLETE) { | 929 | if (rcode == RCODE_COMPLETE) { |
930 | fwnet_transmit_packet_done(ptask); | 930 | fwnet_transmit_packet_done(ptask); |
931 | } else { | 931 | } else { |
932 | fwnet_transmit_packet_failed(ptask); | ||
933 | |||
934 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { | 932 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { |
935 | dev_err(&ptask->dev->netdev->dev, | 933 | dev_err(&ptask->dev->netdev->dev, |
936 | "fwnet_write_complete failed: %x (skipped %d)\n", | 934 | "fwnet_write_complete failed: %x (skipped %d)\n", |
@@ -938,8 +936,10 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
938 | 936 | ||
939 | errors_skipped = 0; | 937 | errors_skipped = 0; |
940 | last_rcode = rcode; | 938 | last_rcode = rcode; |
941 | } else | 939 | } else { |
942 | errors_skipped++; | 940 | errors_skipped++; |
941 | } | ||
942 | fwnet_transmit_packet_failed(ptask); | ||
943 | } | 943 | } |
944 | } | 944 | } |
945 | 945 | ||
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 6f74d8d3f700..8db663219560 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -290,7 +290,6 @@ static char ohci_driver_name[] = KBUILD_MODNAME; | |||
290 | #define QUIRK_NO_MSI 0x10 | 290 | #define QUIRK_NO_MSI 0x10 |
291 | #define QUIRK_TI_SLLZ059 0x20 | 291 | #define QUIRK_TI_SLLZ059 0x20 |
292 | #define QUIRK_IR_WAKE 0x40 | 292 | #define QUIRK_IR_WAKE 0x40 |
293 | #define QUIRK_PHY_LCTRL_TIMEOUT 0x80 | ||
294 | 293 | ||
295 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ | 294 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ |
296 | static const struct { | 295 | static const struct { |
@@ -303,10 +302,7 @@ static const struct { | |||
303 | QUIRK_BE_HEADERS}, | 302 | QUIRK_BE_HEADERS}, |
304 | 303 | ||
305 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, | 304 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, |
306 | QUIRK_PHY_LCTRL_TIMEOUT | QUIRK_NO_MSI}, | 305 | QUIRK_NO_MSI}, |
307 | |||
308 | {PCI_VENDOR_ID_ATT, PCI_ANY_ID, PCI_ANY_ID, | ||
309 | QUIRK_PHY_LCTRL_TIMEOUT}, | ||
310 | 306 | ||
311 | {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, | 307 | {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, |
312 | QUIRK_RESET_PACKET}, | 308 | QUIRK_RESET_PACKET}, |
@@ -353,7 +349,6 @@ MODULE_PARM_DESC(quirks, "Chip quirks (default = 0" | |||
353 | ", disable MSI = " __stringify(QUIRK_NO_MSI) | 349 | ", disable MSI = " __stringify(QUIRK_NO_MSI) |
354 | ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059) | 350 | ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059) |
355 | ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE) | 351 | ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE) |
356 | ", phy LCtrl timeout = " __stringify(QUIRK_PHY_LCTRL_TIMEOUT) | ||
357 | ")"); | 352 | ")"); |
358 | 353 | ||
359 | #define OHCI_PARAM_DEBUG_AT_AR 1 | 354 | #define OHCI_PARAM_DEBUG_AT_AR 1 |
@@ -2299,9 +2294,6 @@ static int ohci_enable(struct fw_card *card, | |||
2299 | * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but | 2294 | * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but |
2300 | * cannot actually use the phy at that time. These need tens of | 2295 | * cannot actually use the phy at that time. These need tens of |
2301 | * millisecods pause between LPS write and first phy access too. | 2296 | * millisecods pause between LPS write and first phy access too. |
2302 | * | ||
2303 | * But do not wait for 50msec on Agere/LSI cards. Their phy | ||
2304 | * arbitration state machine may time out during such a long wait. | ||
2305 | */ | 2297 | */ |
2306 | 2298 | ||
2307 | reg_write(ohci, OHCI1394_HCControlSet, | 2299 | reg_write(ohci, OHCI1394_HCControlSet, |
@@ -2309,11 +2301,8 @@ static int ohci_enable(struct fw_card *card, | |||
2309 | OHCI1394_HCControl_postedWriteEnable); | 2301 | OHCI1394_HCControl_postedWriteEnable); |
2310 | flush_writes(ohci); | 2302 | flush_writes(ohci); |
2311 | 2303 | ||
2312 | if (!(ohci->quirks & QUIRK_PHY_LCTRL_TIMEOUT)) | 2304 | for (lps = 0, i = 0; !lps && i < 3; i++) { |
2313 | msleep(50); | 2305 | msleep(50); |
2314 | |||
2315 | for (lps = 0, i = 0; !lps && i < 150; i++) { | ||
2316 | msleep(1); | ||
2317 | lps = reg_read(ohci, OHCI1394_HCControlSet) & | 2306 | lps = reg_read(ohci, OHCI1394_HCControlSet) & |
2318 | OHCI1394_HCControl_LPS; | 2307 | OHCI1394_HCControl_LPS; |
2319 | } | 2308 | } |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 281029daf98c..7aef911fdc71 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -146,6 +146,7 @@ struct sbp2_logical_unit { | |||
146 | */ | 146 | */ |
147 | int generation; | 147 | int generation; |
148 | int retries; | 148 | int retries; |
149 | work_func_t workfn; | ||
149 | struct delayed_work work; | 150 | struct delayed_work work; |
150 | bool has_sdev; | 151 | bool has_sdev; |
151 | bool blocked; | 152 | bool blocked; |
@@ -864,7 +865,7 @@ static void sbp2_login(struct work_struct *work) | |||
864 | /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ | 865 | /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ |
865 | sbp2_set_busy_timeout(lu); | 866 | sbp2_set_busy_timeout(lu); |
866 | 867 | ||
867 | PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); | 868 | lu->workfn = sbp2_reconnect; |
868 | sbp2_agent_reset(lu); | 869 | sbp2_agent_reset(lu); |
869 | 870 | ||
870 | /* This was a re-login. */ | 871 | /* This was a re-login. */ |
@@ -918,7 +919,7 @@ static void sbp2_login(struct work_struct *work) | |||
918 | * If a bus reset happened, sbp2_update will have requeued | 919 | * If a bus reset happened, sbp2_update will have requeued |
919 | * lu->work already. Reset the work from reconnect to login. | 920 | * lu->work already. Reset the work from reconnect to login. |
920 | */ | 921 | */ |
921 | PREPARE_DELAYED_WORK(&lu->work, sbp2_login); | 922 | lu->workfn = sbp2_login; |
922 | } | 923 | } |
923 | 924 | ||
924 | static void sbp2_reconnect(struct work_struct *work) | 925 | static void sbp2_reconnect(struct work_struct *work) |
@@ -952,7 +953,7 @@ static void sbp2_reconnect(struct work_struct *work) | |||
952 | lu->retries++ >= 5) { | 953 | lu->retries++ >= 5) { |
953 | dev_err(tgt_dev(tgt), "failed to reconnect\n"); | 954 | dev_err(tgt_dev(tgt), "failed to reconnect\n"); |
954 | lu->retries = 0; | 955 | lu->retries = 0; |
955 | PREPARE_DELAYED_WORK(&lu->work, sbp2_login); | 956 | lu->workfn = sbp2_login; |
956 | } | 957 | } |
957 | sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); | 958 | sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); |
958 | 959 | ||
@@ -972,6 +973,13 @@ static void sbp2_reconnect(struct work_struct *work) | |||
972 | sbp2_conditionally_unblock(lu); | 973 | sbp2_conditionally_unblock(lu); |
973 | } | 974 | } |
974 | 975 | ||
976 | static void sbp2_lu_workfn(struct work_struct *work) | ||
977 | { | ||
978 | struct sbp2_logical_unit *lu = container_of(to_delayed_work(work), | ||
979 | struct sbp2_logical_unit, work); | ||
980 | lu->workfn(work); | ||
981 | } | ||
982 | |||
975 | static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) | 983 | static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) |
976 | { | 984 | { |
977 | struct sbp2_logical_unit *lu; | 985 | struct sbp2_logical_unit *lu; |
@@ -998,7 +1006,8 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) | |||
998 | lu->blocked = false; | 1006 | lu->blocked = false; |
999 | ++tgt->dont_block; | 1007 | ++tgt->dont_block; |
1000 | INIT_LIST_HEAD(&lu->orb_list); | 1008 | INIT_LIST_HEAD(&lu->orb_list); |
1001 | INIT_DELAYED_WORK(&lu->work, sbp2_login); | 1009 | lu->workfn = sbp2_login; |
1010 | INIT_DELAYED_WORK(&lu->work, sbp2_lu_workfn); | ||
1002 | 1011 | ||
1003 | list_add_tail(&lu->link, &tgt->lu_list); | 1012 | list_add_tail(&lu->link, &tgt->lu_list); |
1004 | return 0; | 1013 | return 0; |
diff --git a/drivers/fmc/fmc-write-eeprom.c b/drivers/fmc/fmc-write-eeprom.c index ee5b47904130..9bb2cbd5c9f2 100644 --- a/drivers/fmc/fmc-write-eeprom.c +++ b/drivers/fmc/fmc-write-eeprom.c | |||
@@ -27,7 +27,7 @@ FMC_PARAM_BUSID(fwe_drv); | |||
27 | /* The "file=" is like the generic "gateware=" used elsewhere */ | 27 | /* The "file=" is like the generic "gateware=" used elsewhere */ |
28 | static char *fwe_file[FMC_MAX_CARDS]; | 28 | static char *fwe_file[FMC_MAX_CARDS]; |
29 | static int fwe_file_n; | 29 | static int fwe_file_n; |
30 | module_param_array_named(file, fwe_file, charp, &fwe_file_n, 444); | 30 | module_param_array_named(file, fwe_file, charp, &fwe_file_n, 0444); |
31 | 31 | ||
32 | static int fwe_run_tlv(struct fmc_device *fmc, const struct firmware *fw, | 32 | static int fwe_run_tlv(struct fmc_device *fmc, const struct firmware *fw, |
33 | int write) | 33 | int write) |
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index acf3a36c9ebc..32982da82694 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c | |||
@@ -68,15 +68,7 @@ void __armada_drm_queue_unref_work(struct drm_device *dev, | |||
68 | { | 68 | { |
69 | struct armada_private *priv = dev->dev_private; | 69 | struct armada_private *priv = dev->dev_private; |
70 | 70 | ||
71 | /* | 71 | WARN_ON(!kfifo_put(&priv->fb_unref, fb)); |
72 | * Yes, we really must jump through these hoops just to store a | ||
73 | * _pointer_ to something into the kfifo. This is utterly insane | ||
74 | * and idiotic, because it kfifo requires the _data_ pointed to by | ||
75 | * the pointer const, not the pointer itself. Not only that, but | ||
76 | * you have to pass a pointer _to_ the pointer you want stored. | ||
77 | */ | ||
78 | const struct drm_framebuffer *silly_api_alert = fb; | ||
79 | WARN_ON(!kfifo_put(&priv->fb_unref, &silly_api_alert)); | ||
80 | schedule_work(&priv->fb_unref_work); | 72 | schedule_work(&priv->fb_unref_work); |
81 | } | 73 | } |
82 | 74 | ||
diff --git a/drivers/gpu/drm/bochs/Kconfig b/drivers/gpu/drm/bochs/Kconfig index c8fcf12019f0..5f8b0c2b9a44 100644 --- a/drivers/gpu/drm/bochs/Kconfig +++ b/drivers/gpu/drm/bochs/Kconfig | |||
@@ -2,6 +2,7 @@ config DRM_BOCHS | |||
2 | tristate "DRM Support for bochs dispi vga interface (qemu stdvga)" | 2 | tristate "DRM Support for bochs dispi vga interface (qemu stdvga)" |
3 | depends on DRM && PCI | 3 | depends on DRM && PCI |
4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
5 | select DRM_KMS_FB_HELPER | ||
5 | select FB_SYS_FILLRECT | 6 | select FB_SYS_FILLRECT |
6 | select FB_SYS_COPYAREA | 7 | select FB_SYS_COPYAREA |
7 | select FB_SYS_IMAGEBLIT | 8 | select FB_SYS_IMAGEBLIT |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 5736aaa7e86c..f7af69bcf3f4 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -468,8 +468,8 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver) | |||
468 | } else { | 468 | } else { |
469 | list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list, | 469 | list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list, |
470 | legacy_dev_list) { | 470 | legacy_dev_list) { |
471 | drm_put_dev(dev); | ||
472 | list_del(&dev->legacy_dev_list); | 471 | list_del(&dev->legacy_dev_list); |
472 | drm_put_dev(dev); | ||
473 | } | 473 | } |
474 | } | 474 | } |
475 | DRM_INFO("Module unloaded\n"); | 475 | DRM_INFO("Module unloaded\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 215131ab1dd2..c204b4e3356e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -172,20 +172,24 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) | |||
172 | 172 | ||
173 | ret = exynos_drm_subdrv_open(dev, file); | 173 | ret = exynos_drm_subdrv_open(dev, file); |
174 | if (ret) | 174 | if (ret) |
175 | goto out; | 175 | goto err_file_priv_free; |
176 | 176 | ||
177 | anon_filp = anon_inode_getfile("exynos_gem", &exynos_drm_gem_fops, | 177 | anon_filp = anon_inode_getfile("exynos_gem", &exynos_drm_gem_fops, |
178 | NULL, 0); | 178 | NULL, 0); |
179 | if (IS_ERR(anon_filp)) { | 179 | if (IS_ERR(anon_filp)) { |
180 | ret = PTR_ERR(anon_filp); | 180 | ret = PTR_ERR(anon_filp); |
181 | goto out; | 181 | goto err_subdrv_close; |
182 | } | 182 | } |
183 | 183 | ||
184 | anon_filp->f_mode = FMODE_READ | FMODE_WRITE; | 184 | anon_filp->f_mode = FMODE_READ | FMODE_WRITE; |
185 | file_priv->anon_filp = anon_filp; | 185 | file_priv->anon_filp = anon_filp; |
186 | 186 | ||
187 | return ret; | 187 | return ret; |
188 | out: | 188 | |
189 | err_subdrv_close: | ||
190 | exynos_drm_subdrv_close(dev, file); | ||
191 | |||
192 | err_file_priv_free: | ||
189 | kfree(file_priv); | 193 | kfree(file_priv); |
190 | file->driver_priv = NULL; | 194 | file->driver_priv = NULL; |
191 | return ret; | 195 | return ret; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 04f1f02c4019..ec7bb0fc71bc 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -403,7 +403,7 @@ MODULE_DEVICE_TABLE(pci, pciidlist); | |||
403 | void intel_detect_pch(struct drm_device *dev) | 403 | void intel_detect_pch(struct drm_device *dev) |
404 | { | 404 | { |
405 | struct drm_i915_private *dev_priv = dev->dev_private; | 405 | struct drm_i915_private *dev_priv = dev->dev_private; |
406 | struct pci_dev *pch; | 406 | struct pci_dev *pch = NULL; |
407 | 407 | ||
408 | /* In all current cases, num_pipes is equivalent to the PCH_NOP setting | 408 | /* In all current cases, num_pipes is equivalent to the PCH_NOP setting |
409 | * (which really amounts to a PCH but no South Display). | 409 | * (which really amounts to a PCH but no South Display). |
@@ -424,12 +424,9 @@ void intel_detect_pch(struct drm_device *dev) | |||
424 | * all the ISA bridge devices and check for the first match, instead | 424 | * all the ISA bridge devices and check for the first match, instead |
425 | * of only checking the first one. | 425 | * of only checking the first one. |
426 | */ | 426 | */ |
427 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); | 427 | while ((pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, pch))) { |
428 | while (pch) { | ||
429 | struct pci_dev *curr = pch; | ||
430 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { | 428 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { |
431 | unsigned short id; | 429 | unsigned short id = pch->device & INTEL_PCH_DEVICE_ID_MASK; |
432 | id = pch->device & INTEL_PCH_DEVICE_ID_MASK; | ||
433 | dev_priv->pch_id = id; | 430 | dev_priv->pch_id = id; |
434 | 431 | ||
435 | if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) { | 432 | if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) { |
@@ -461,18 +458,16 @@ void intel_detect_pch(struct drm_device *dev) | |||
461 | DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); | 458 | DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); |
462 | WARN_ON(!IS_HASWELL(dev)); | 459 | WARN_ON(!IS_HASWELL(dev)); |
463 | WARN_ON(!IS_ULT(dev)); | 460 | WARN_ON(!IS_ULT(dev)); |
464 | } else { | 461 | } else |
465 | goto check_next; | 462 | continue; |
466 | } | 463 | |
467 | pci_dev_put(pch); | ||
468 | break; | 464 | break; |
469 | } | 465 | } |
470 | check_next: | ||
471 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, curr); | ||
472 | pci_dev_put(curr); | ||
473 | } | 466 | } |
474 | if (!pch) | 467 | if (!pch) |
475 | DRM_DEBUG_KMS("No PCH found?\n"); | 468 | DRM_DEBUG_KMS("No PCH found.\n"); |
469 | |||
470 | pci_dev_put(pch); | ||
476 | } | 471 | } |
477 | 472 | ||
478 | bool i915_semaphore_is_enabled(struct drm_device *dev) | 473 | bool i915_semaphore_is_enabled(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 1a24e84f2315..28d24caa49f3 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -82,9 +82,22 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) | |||
82 | r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size, | 82 | r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size, |
83 | "Graphics Stolen Memory"); | 83 | "Graphics Stolen Memory"); |
84 | if (r == NULL) { | 84 | if (r == NULL) { |
85 | DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n", | 85 | /* |
86 | base, base + (uint32_t)dev_priv->gtt.stolen_size); | 86 | * One more attempt but this time requesting region from |
87 | base = 0; | 87 | * base + 1, as we have seen that this resolves the region |
88 | * conflict with the PCI Bus. | ||
89 | * This is a BIOS w/a: Some BIOS wrap stolen in the root | ||
90 | * PCI bus, but have an off-by-one error. Hence retry the | ||
91 | * reservation starting from 1 instead of 0. | ||
92 | */ | ||
93 | r = devm_request_mem_region(dev->dev, base + 1, | ||
94 | dev_priv->gtt.stolen_size - 1, | ||
95 | "Graphics Stolen Memory"); | ||
96 | if (r == NULL) { | ||
97 | DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n", | ||
98 | base, base + (uint32_t)dev_priv->gtt.stolen_size); | ||
99 | base = 0; | ||
100 | } | ||
88 | } | 101 | } |
89 | 102 | ||
90 | return base; | 103 | return base; |
@@ -201,6 +214,13 @@ int i915_gem_init_stolen(struct drm_device *dev) | |||
201 | struct drm_i915_private *dev_priv = dev->dev_private; | 214 | struct drm_i915_private *dev_priv = dev->dev_private; |
202 | int bios_reserved = 0; | 215 | int bios_reserved = 0; |
203 | 216 | ||
217 | #ifdef CONFIG_INTEL_IOMMU | ||
218 | if (intel_iommu_gfx_mapped) { | ||
219 | DRM_INFO("DMAR active, disabling use of stolen memory\n"); | ||
220 | return 0; | ||
221 | } | ||
222 | #endif | ||
223 | |||
204 | if (dev_priv->gtt.stolen_size == 0) | 224 | if (dev_priv->gtt.stolen_size == 0) |
205 | return 0; | 225 | return 0; |
206 | 226 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 9fec71175571..d554169ac592 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -618,33 +618,25 @@ static u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe) | |||
618 | 618 | ||
619 | /* raw reads, only for fast reads of display block, no need for forcewake etc. */ | 619 | /* raw reads, only for fast reads of display block, no need for forcewake etc. */ |
620 | #define __raw_i915_read32(dev_priv__, reg__) readl((dev_priv__)->regs + (reg__)) | 620 | #define __raw_i915_read32(dev_priv__, reg__) readl((dev_priv__)->regs + (reg__)) |
621 | #define __raw_i915_read16(dev_priv__, reg__) readw((dev_priv__)->regs + (reg__)) | ||
622 | 621 | ||
623 | static bool ilk_pipe_in_vblank_locked(struct drm_device *dev, enum pipe pipe) | 622 | static bool ilk_pipe_in_vblank_locked(struct drm_device *dev, enum pipe pipe) |
624 | { | 623 | { |
625 | struct drm_i915_private *dev_priv = dev->dev_private; | 624 | struct drm_i915_private *dev_priv = dev->dev_private; |
626 | uint32_t status; | 625 | uint32_t status; |
627 | 626 | int reg; | |
628 | if (INTEL_INFO(dev)->gen < 7) { | 627 | |
629 | status = pipe == PIPE_A ? | 628 | if (INTEL_INFO(dev)->gen >= 8) { |
630 | DE_PIPEA_VBLANK : | 629 | status = GEN8_PIPE_VBLANK; |
631 | DE_PIPEB_VBLANK; | 630 | reg = GEN8_DE_PIPE_ISR(pipe); |
631 | } else if (INTEL_INFO(dev)->gen >= 7) { | ||
632 | status = DE_PIPE_VBLANK_IVB(pipe); | ||
633 | reg = DEISR; | ||
632 | } else { | 634 | } else { |
633 | switch (pipe) { | 635 | status = DE_PIPE_VBLANK(pipe); |
634 | default: | 636 | reg = DEISR; |
635 | case PIPE_A: | ||
636 | status = DE_PIPEA_VBLANK_IVB; | ||
637 | break; | ||
638 | case PIPE_B: | ||
639 | status = DE_PIPEB_VBLANK_IVB; | ||
640 | break; | ||
641 | case PIPE_C: | ||
642 | status = DE_PIPEC_VBLANK_IVB; | ||
643 | break; | ||
644 | } | ||
645 | } | 637 | } |
646 | 638 | ||
647 | return __raw_i915_read32(dev_priv, DEISR) & status; | 639 | return __raw_i915_read32(dev_priv, reg) & status; |
648 | } | 640 | } |
649 | 641 | ||
650 | static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, | 642 | static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, |
@@ -702,7 +694,28 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, | |||
702 | else | 694 | else |
703 | position = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3; | 695 | position = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3; |
704 | 696 | ||
705 | if (HAS_PCH_SPLIT(dev)) { | 697 | if (HAS_DDI(dev)) { |
698 | /* | ||
699 | * On HSW HDMI outputs there seems to be a 2 line | ||
700 | * difference, whereas eDP has the normal 1 line | ||
701 | * difference that earlier platforms have. External | ||
702 | * DP is unknown. For now just check for the 2 line | ||
703 | * difference case on all output types on HSW+. | ||
704 | * | ||
705 | * This might misinterpret the scanline counter being | ||
706 | * one line too far along on eDP, but that's less | ||
707 | * dangerous than the alternative since that would lead | ||
708 | * the vblank timestamp code astray when it sees a | ||
709 | * scanline count before vblank_start during a vblank | ||
710 | * interrupt. | ||
711 | */ | ||
712 | in_vbl = ilk_pipe_in_vblank_locked(dev, pipe); | ||
713 | if ((in_vbl && (position == vbl_start - 2 || | ||
714 | position == vbl_start - 1)) || | ||
715 | (!in_vbl && (position == vbl_end - 2 || | ||
716 | position == vbl_end - 1))) | ||
717 | position = (position + 2) % vtotal; | ||
718 | } else if (HAS_PCH_SPLIT(dev)) { | ||
706 | /* | 719 | /* |
707 | * The scanline counter increments at the leading edge | 720 | * The scanline counter increments at the leading edge |
708 | * of hsync, ie. it completely misses the active portion | 721 | * of hsync, ie. it completely misses the active portion |
@@ -2769,10 +2782,9 @@ static void ibx_irq_postinstall(struct drm_device *dev) | |||
2769 | return; | 2782 | return; |
2770 | 2783 | ||
2771 | if (HAS_PCH_IBX(dev)) { | 2784 | if (HAS_PCH_IBX(dev)) { |
2772 | mask = SDE_GMBUS | SDE_AUX_MASK | SDE_TRANSB_FIFO_UNDER | | 2785 | mask = SDE_GMBUS | SDE_AUX_MASK | SDE_POISON; |
2773 | SDE_TRANSA_FIFO_UNDER | SDE_POISON; | ||
2774 | } else { | 2786 | } else { |
2775 | mask = SDE_GMBUS_CPT | SDE_AUX_MASK_CPT | SDE_ERROR_CPT; | 2787 | mask = SDE_GMBUS_CPT | SDE_AUX_MASK_CPT; |
2776 | 2788 | ||
2777 | I915_WRITE(SERR_INT, I915_READ(SERR_INT)); | 2789 | I915_WRITE(SERR_INT, I915_READ(SERR_INT)); |
2778 | } | 2790 | } |
@@ -2832,20 +2844,19 @@ static int ironlake_irq_postinstall(struct drm_device *dev) | |||
2832 | display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE_IVB | | 2844 | display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE_IVB | |
2833 | DE_PCH_EVENT_IVB | DE_PLANEC_FLIP_DONE_IVB | | 2845 | DE_PCH_EVENT_IVB | DE_PLANEC_FLIP_DONE_IVB | |
2834 | DE_PLANEB_FLIP_DONE_IVB | | 2846 | DE_PLANEB_FLIP_DONE_IVB | |
2835 | DE_PLANEA_FLIP_DONE_IVB | DE_AUX_CHANNEL_A_IVB | | 2847 | DE_PLANEA_FLIP_DONE_IVB | DE_AUX_CHANNEL_A_IVB); |
2836 | DE_ERR_INT_IVB); | ||
2837 | extra_mask = (DE_PIPEC_VBLANK_IVB | DE_PIPEB_VBLANK_IVB | | 2848 | extra_mask = (DE_PIPEC_VBLANK_IVB | DE_PIPEB_VBLANK_IVB | |
2838 | DE_PIPEA_VBLANK_IVB); | 2849 | DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB); |
2839 | 2850 | ||
2840 | I915_WRITE(GEN7_ERR_INT, I915_READ(GEN7_ERR_INT)); | 2851 | I915_WRITE(GEN7_ERR_INT, I915_READ(GEN7_ERR_INT)); |
2841 | } else { | 2852 | } else { |
2842 | display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | | 2853 | display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | |
2843 | DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE | | 2854 | DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE | |
2844 | DE_AUX_CHANNEL_A | | 2855 | DE_AUX_CHANNEL_A | |
2845 | DE_PIPEB_FIFO_UNDERRUN | DE_PIPEA_FIFO_UNDERRUN | | ||
2846 | DE_PIPEB_CRC_DONE | DE_PIPEA_CRC_DONE | | 2856 | DE_PIPEB_CRC_DONE | DE_PIPEA_CRC_DONE | |
2847 | DE_POISON); | 2857 | DE_POISON); |
2848 | extra_mask = DE_PIPEA_VBLANK | DE_PIPEB_VBLANK | DE_PCU_EVENT; | 2858 | extra_mask = DE_PIPEA_VBLANK | DE_PIPEB_VBLANK | DE_PCU_EVENT | |
2859 | DE_PIPEB_FIFO_UNDERRUN | DE_PIPEA_FIFO_UNDERRUN; | ||
2849 | } | 2860 | } |
2850 | 2861 | ||
2851 | dev_priv->irq_mask = ~display_mask; | 2862 | dev_priv->irq_mask = ~display_mask; |
@@ -2961,9 +2972,9 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) | |||
2961 | struct drm_device *dev = dev_priv->dev; | 2972 | struct drm_device *dev = dev_priv->dev; |
2962 | uint32_t de_pipe_masked = GEN8_PIPE_FLIP_DONE | | 2973 | uint32_t de_pipe_masked = GEN8_PIPE_FLIP_DONE | |
2963 | GEN8_PIPE_CDCLK_CRC_DONE | | 2974 | GEN8_PIPE_CDCLK_CRC_DONE | |
2964 | GEN8_PIPE_FIFO_UNDERRUN | | ||
2965 | GEN8_DE_PIPE_IRQ_FAULT_ERRORS; | 2975 | GEN8_DE_PIPE_IRQ_FAULT_ERRORS; |
2966 | uint32_t de_pipe_enables = de_pipe_masked | GEN8_PIPE_VBLANK; | 2976 | uint32_t de_pipe_enables = de_pipe_masked | GEN8_PIPE_VBLANK | |
2977 | GEN8_PIPE_FIFO_UNDERRUN; | ||
2967 | int pipe; | 2978 | int pipe; |
2968 | dev_priv->de_irq_mask[PIPE_A] = ~de_pipe_masked; | 2979 | dev_priv->de_irq_mask[PIPE_A] = ~de_pipe_masked; |
2969 | dev_priv->de_irq_mask[PIPE_B] = ~de_pipe_masked; | 2980 | dev_priv->de_irq_mask[PIPE_B] = ~de_pipe_masked; |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index e06b9e017d6b..234ac5f7bc5a 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -1244,6 +1244,7 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) | |||
1244 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { | 1244 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { |
1245 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 1245 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1246 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); | 1246 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); |
1247 | ironlake_edp_panel_vdd_on(intel_dp); | ||
1247 | ironlake_edp_panel_off(intel_dp); | 1248 | ironlake_edp_panel_off(intel_dp); |
1248 | } | 1249 | } |
1249 | 1250 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 4c1672809493..9b8a7c7ea7fc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1092,12 +1092,12 @@ static void assert_cursor(struct drm_i915_private *dev_priv, | |||
1092 | struct drm_device *dev = dev_priv->dev; | 1092 | struct drm_device *dev = dev_priv->dev; |
1093 | bool cur_state; | 1093 | bool cur_state; |
1094 | 1094 | ||
1095 | if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) | 1095 | if (IS_845G(dev) || IS_I865G(dev)) |
1096 | cur_state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE; | ||
1097 | else if (IS_845G(dev) || IS_I865G(dev)) | ||
1098 | cur_state = I915_READ(_CURACNTR) & CURSOR_ENABLE; | 1096 | cur_state = I915_READ(_CURACNTR) & CURSOR_ENABLE; |
1099 | else | 1097 | else if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) |
1100 | cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE; | 1098 | cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE; |
1099 | else | ||
1100 | cur_state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE; | ||
1101 | 1101 | ||
1102 | WARN(cur_state != state, | 1102 | WARN(cur_state != state, |
1103 | "cursor on pipe %c assertion failure (expected %s, current %s)\n", | 1103 | "cursor on pipe %c assertion failure (expected %s, current %s)\n", |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 57552eb386b0..2688f6d64bb9 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1249,17 +1249,24 @@ void ironlake_edp_panel_off(struct intel_dp *intel_dp) | |||
1249 | 1249 | ||
1250 | DRM_DEBUG_KMS("Turn eDP power off\n"); | 1250 | DRM_DEBUG_KMS("Turn eDP power off\n"); |
1251 | 1251 | ||
1252 | WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n"); | ||
1253 | |||
1252 | pp = ironlake_get_pp_control(intel_dp); | 1254 | pp = ironlake_get_pp_control(intel_dp); |
1253 | /* We need to switch off panel power _and_ force vdd, for otherwise some | 1255 | /* We need to switch off panel power _and_ force vdd, for otherwise some |
1254 | * panels get very unhappy and cease to work. */ | 1256 | * panels get very unhappy and cease to work. */ |
1255 | pp &= ~(POWER_TARGET_ON | PANEL_POWER_RESET | EDP_BLC_ENABLE); | 1257 | pp &= ~(POWER_TARGET_ON | EDP_FORCE_VDD | PANEL_POWER_RESET | EDP_BLC_ENABLE); |
1256 | 1258 | ||
1257 | pp_ctrl_reg = _pp_ctrl_reg(intel_dp); | 1259 | pp_ctrl_reg = _pp_ctrl_reg(intel_dp); |
1258 | 1260 | ||
1259 | I915_WRITE(pp_ctrl_reg, pp); | 1261 | I915_WRITE(pp_ctrl_reg, pp); |
1260 | POSTING_READ(pp_ctrl_reg); | 1262 | POSTING_READ(pp_ctrl_reg); |
1261 | 1263 | ||
1264 | intel_dp->want_panel_vdd = false; | ||
1265 | |||
1262 | ironlake_wait_panel_off(intel_dp); | 1266 | ironlake_wait_panel_off(intel_dp); |
1267 | |||
1268 | /* We got a reference when we enabled the VDD. */ | ||
1269 | intel_runtime_pm_put(dev_priv); | ||
1263 | } | 1270 | } |
1264 | 1271 | ||
1265 | void ironlake_edp_backlight_on(struct intel_dp *intel_dp) | 1272 | void ironlake_edp_backlight_on(struct intel_dp *intel_dp) |
@@ -1639,7 +1646,7 @@ static void intel_edp_psr_enable_source(struct intel_dp *intel_dp) | |||
1639 | val |= EDP_PSR_LINK_DISABLE; | 1646 | val |= EDP_PSR_LINK_DISABLE; |
1640 | 1647 | ||
1641 | I915_WRITE(EDP_PSR_CTL(dev), val | | 1648 | I915_WRITE(EDP_PSR_CTL(dev), val | |
1642 | IS_BROADWELL(dev) ? 0 : link_entry_time | | 1649 | (IS_BROADWELL(dev) ? 0 : link_entry_time) | |
1643 | max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT | | 1650 | max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT | |
1644 | idle_frames << EDP_PSR_IDLE_FRAME_SHIFT | | 1651 | idle_frames << EDP_PSR_IDLE_FRAME_SHIFT | |
1645 | EDP_PSR_ENABLE); | 1652 | EDP_PSR_ENABLE); |
@@ -1784,6 +1791,7 @@ static void intel_disable_dp(struct intel_encoder *encoder) | |||
1784 | 1791 | ||
1785 | /* Make sure the panel is off before trying to change the mode. But also | 1792 | /* Make sure the panel is off before trying to change the mode. But also |
1786 | * ensure that we have vdd while we switch off the panel. */ | 1793 | * ensure that we have vdd while we switch off the panel. */ |
1794 | ironlake_edp_panel_vdd_on(intel_dp); | ||
1787 | ironlake_edp_backlight_off(intel_dp); | 1795 | ironlake_edp_backlight_off(intel_dp); |
1788 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); | 1796 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); |
1789 | ironlake_edp_panel_off(intel_dp); | 1797 | ironlake_edp_panel_off(intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 6db0d9d17f47..ee3181ebcc92 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -845,7 +845,7 @@ static int hdmi_portclock_limit(struct intel_hdmi *hdmi) | |||
845 | { | 845 | { |
846 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); | 846 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
847 | 847 | ||
848 | if (IS_G4X(dev)) | 848 | if (!hdmi->has_hdmi_sink || IS_G4X(dev)) |
849 | return 165000; | 849 | return 165000; |
850 | else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) | 850 | else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) |
851 | return 300000; | 851 | return 300000; |
@@ -899,8 +899,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, | |||
899 | * outputs. We also need to check that the higher clock still fits | 899 | * outputs. We also need to check that the higher clock still fits |
900 | * within limits. | 900 | * within limits. |
901 | */ | 901 | */ |
902 | if (pipe_config->pipe_bpp > 8*3 && clock_12bpc <= portclock_limit | 902 | if (pipe_config->pipe_bpp > 8*3 && intel_hdmi->has_hdmi_sink && |
903 | && HAS_PCH_SPLIT(dev)) { | 903 | clock_12bpc <= portclock_limit && HAS_PCH_SPLIT(dev)) { |
904 | DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n"); | 904 | DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n"); |
905 | desired_bpp = 12*3; | 905 | desired_bpp = 12*3; |
906 | 906 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 350de359123a..079ea38f14d9 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -698,7 +698,7 @@ static void i9xx_enable_backlight(struct intel_connector *connector) | |||
698 | freq /= 0xff; | 698 | freq /= 0xff; |
699 | 699 | ||
700 | ctl = freq << 17; | 700 | ctl = freq << 17; |
701 | if (IS_GEN2(dev) && panel->backlight.combination_mode) | 701 | if (panel->backlight.combination_mode) |
702 | ctl |= BLM_LEGACY_MODE; | 702 | ctl |= BLM_LEGACY_MODE; |
703 | if (IS_PINEVIEW(dev) && panel->backlight.active_low_pwm) | 703 | if (IS_PINEVIEW(dev) && panel->backlight.active_low_pwm) |
704 | ctl |= BLM_POLARITY_PNV; | 704 | ctl |= BLM_POLARITY_PNV; |
@@ -979,7 +979,7 @@ static int i9xx_setup_backlight(struct intel_connector *connector) | |||
979 | 979 | ||
980 | ctl = I915_READ(BLC_PWM_CTL); | 980 | ctl = I915_READ(BLC_PWM_CTL); |
981 | 981 | ||
982 | if (IS_GEN2(dev)) | 982 | if (IS_GEN2(dev) || IS_I915GM(dev) || IS_I945GM(dev)) |
983 | panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE; | 983 | panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE; |
984 | 984 | ||
985 | if (IS_PINEVIEW(dev)) | 985 | if (IS_PINEVIEW(dev)) |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index d77cc81900f9..e1fc35a72656 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -3493,6 +3493,8 @@ static void valleyview_setup_pctx(struct drm_device *dev) | |||
3493 | u32 pcbr; | 3493 | u32 pcbr; |
3494 | int pctx_size = 24*1024; | 3494 | int pctx_size = 24*1024; |
3495 | 3495 | ||
3496 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); | ||
3497 | |||
3496 | pcbr = I915_READ(VLV_PCBR); | 3498 | pcbr = I915_READ(VLV_PCBR); |
3497 | if (pcbr) { | 3499 | if (pcbr) { |
3498 | /* BIOS set it up already, grab the pre-alloc'd space */ | 3500 | /* BIOS set it up already, grab the pre-alloc'd space */ |
@@ -3542,8 +3544,6 @@ static void valleyview_enable_rps(struct drm_device *dev) | |||
3542 | I915_WRITE(GTFIFODBG, gtfifodbg); | 3544 | I915_WRITE(GTFIFODBG, gtfifodbg); |
3543 | } | 3545 | } |
3544 | 3546 | ||
3545 | valleyview_setup_pctx(dev); | ||
3546 | |||
3547 | /* If VLV, Forcewake all wells, else re-direct to regular path */ | 3547 | /* If VLV, Forcewake all wells, else re-direct to regular path */ |
3548 | gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); | 3548 | gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); |
3549 | 3549 | ||
@@ -4395,6 +4395,8 @@ void intel_enable_gt_powersave(struct drm_device *dev) | |||
4395 | ironlake_enable_rc6(dev); | 4395 | ironlake_enable_rc6(dev); |
4396 | intel_init_emon(dev); | 4396 | intel_init_emon(dev); |
4397 | } else if (IS_GEN6(dev) || IS_GEN7(dev)) { | 4397 | } else if (IS_GEN6(dev) || IS_GEN7(dev)) { |
4398 | if (IS_VALLEYVIEW(dev)) | ||
4399 | valleyview_setup_pctx(dev); | ||
4398 | /* | 4400 | /* |
4399 | * PCU communication is slow and this doesn't need to be | 4401 | * PCU communication is slow and this doesn't need to be |
4400 | * done at any specific time, so do this out of our fast path | 4402 | * done at any specific time, so do this out of our fast path |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 0d19f4f94d5a..daa4dd375ab1 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1774,6 +1774,20 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1774 | return ATOM_PPLL1; | 1774 | return ATOM_PPLL1; |
1775 | DRM_ERROR("unable to allocate a PPLL\n"); | 1775 | DRM_ERROR("unable to allocate a PPLL\n"); |
1776 | return ATOM_PPLL_INVALID; | 1776 | return ATOM_PPLL_INVALID; |
1777 | } else if (ASIC_IS_DCE41(rdev)) { | ||
1778 | /* Don't share PLLs on DCE4.1 chips */ | ||
1779 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) { | ||
1780 | if (rdev->clock.dp_extclk) | ||
1781 | /* skip PPLL programming if using ext clock */ | ||
1782 | return ATOM_PPLL_INVALID; | ||
1783 | } | ||
1784 | pll_in_use = radeon_get_pll_use_mask(crtc); | ||
1785 | if (!(pll_in_use & (1 << ATOM_PPLL1))) | ||
1786 | return ATOM_PPLL1; | ||
1787 | if (!(pll_in_use & (1 << ATOM_PPLL2))) | ||
1788 | return ATOM_PPLL2; | ||
1789 | DRM_ERROR("unable to allocate a PPLL\n"); | ||
1790 | return ATOM_PPLL_INVALID; | ||
1777 | } else if (ASIC_IS_DCE4(rdev)) { | 1791 | } else if (ASIC_IS_DCE4(rdev)) { |
1778 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, | 1792 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, |
1779 | * depending on the asic: | 1793 | * depending on the asic: |
@@ -1801,7 +1815,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1801 | if (pll != ATOM_PPLL_INVALID) | 1815 | if (pll != ATOM_PPLL_INVALID) |
1802 | return pll; | 1816 | return pll; |
1803 | } | 1817 | } |
1804 | } else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on DCE4.1 chips */ | 1818 | } else { |
1805 | /* use the same PPLL for all monitors with the same clock */ | 1819 | /* use the same PPLL for all monitors with the same clock */ |
1806 | pll = radeon_get_shared_nondp_ppll(crtc); | 1820 | pll = radeon_get_shared_nondp_ppll(crtc); |
1807 | if (pll != ATOM_PPLL_INVALID) | 1821 | if (pll != ATOM_PPLL_INVALID) |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 2cec2ab02f80..607dc14d195e 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -1314,7 +1314,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
1314 | } | 1314 | } |
1315 | if (is_dp) | 1315 | if (is_dp) |
1316 | args.v5.ucLaneNum = dp_lane_count; | 1316 | args.v5.ucLaneNum = dp_lane_count; |
1317 | else if (radeon_encoder->pixel_clock > 165000) | 1317 | else if (radeon_dig_monitor_is_duallink(encoder, radeon_encoder->pixel_clock)) |
1318 | args.v5.ucLaneNum = 8; | 1318 | args.v5.ucLaneNum = 8; |
1319 | else | 1319 | else |
1320 | args.v5.ucLaneNum = 4; | 1320 | args.v5.ucLaneNum = 4; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index e6419ca7cd37..bbb17841a9e5 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -3046,7 +3046,7 @@ static u32 cik_create_bitmask(u32 bit_width) | |||
3046 | } | 3046 | } |
3047 | 3047 | ||
3048 | /** | 3048 | /** |
3049 | * cik_select_se_sh - select which SE, SH to address | 3049 | * cik_get_rb_disabled - computes the mask of disabled RBs |
3050 | * | 3050 | * |
3051 | * @rdev: radeon_device pointer | 3051 | * @rdev: radeon_device pointer |
3052 | * @max_rb_num: max RBs (render backends) for the asic | 3052 | * @max_rb_num: max RBs (render backends) for the asic |
@@ -4134,8 +4134,11 @@ static void cik_cp_compute_enable(struct radeon_device *rdev, bool enable) | |||
4134 | { | 4134 | { |
4135 | if (enable) | 4135 | if (enable) |
4136 | WREG32(CP_MEC_CNTL, 0); | 4136 | WREG32(CP_MEC_CNTL, 0); |
4137 | else | 4137 | else { |
4138 | WREG32(CP_MEC_CNTL, (MEC_ME1_HALT | MEC_ME2_HALT)); | 4138 | WREG32(CP_MEC_CNTL, (MEC_ME1_HALT | MEC_ME2_HALT)); |
4139 | rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; | ||
4140 | rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; | ||
4141 | } | ||
4139 | udelay(50); | 4142 | udelay(50); |
4140 | } | 4143 | } |
4141 | 4144 | ||
@@ -7902,7 +7905,8 @@ int cik_resume(struct radeon_device *rdev) | |||
7902 | /* init golden registers */ | 7905 | /* init golden registers */ |
7903 | cik_init_golden_registers(rdev); | 7906 | cik_init_golden_registers(rdev); |
7904 | 7907 | ||
7905 | radeon_pm_resume(rdev); | 7908 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
7909 | radeon_pm_resume(rdev); | ||
7906 | 7910 | ||
7907 | rdev->accel_working = true; | 7911 | rdev->accel_working = true; |
7908 | r = cik_startup(rdev); | 7912 | r = cik_startup(rdev); |
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index 1ecb3f1070e3..94626ea90fa5 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -264,6 +264,8 @@ static void cik_sdma_gfx_stop(struct radeon_device *rdev) | |||
264 | WREG32(SDMA0_GFX_RB_CNTL + reg_offset, rb_cntl); | 264 | WREG32(SDMA0_GFX_RB_CNTL + reg_offset, rb_cntl); |
265 | WREG32(SDMA0_GFX_IB_CNTL + reg_offset, 0); | 265 | WREG32(SDMA0_GFX_IB_CNTL + reg_offset, 0); |
266 | } | 266 | } |
267 | rdev->ring[R600_RING_TYPE_DMA_INDEX].ready = false; | ||
268 | rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX].ready = false; | ||
267 | } | 269 | } |
268 | 270 | ||
269 | /** | 271 | /** |
@@ -291,6 +293,11 @@ void cik_sdma_enable(struct radeon_device *rdev, bool enable) | |||
291 | u32 me_cntl, reg_offset; | 293 | u32 me_cntl, reg_offset; |
292 | int i; | 294 | int i; |
293 | 295 | ||
296 | if (enable == false) { | ||
297 | cik_sdma_gfx_stop(rdev); | ||
298 | cik_sdma_rlc_stop(rdev); | ||
299 | } | ||
300 | |||
294 | for (i = 0; i < 2; i++) { | 301 | for (i = 0; i < 2; i++) { |
295 | if (i == 0) | 302 | if (i == 0) |
296 | reg_offset = SDMA0_REGISTER_OFFSET; | 303 | reg_offset = SDMA0_REGISTER_OFFSET; |
@@ -420,10 +427,6 @@ static int cik_sdma_load_microcode(struct radeon_device *rdev) | |||
420 | if (!rdev->sdma_fw) | 427 | if (!rdev->sdma_fw) |
421 | return -EINVAL; | 428 | return -EINVAL; |
422 | 429 | ||
423 | /* stop the gfx rings and rlc compute queues */ | ||
424 | cik_sdma_gfx_stop(rdev); | ||
425 | cik_sdma_rlc_stop(rdev); | ||
426 | |||
427 | /* halt the MEs */ | 430 | /* halt the MEs */ |
428 | cik_sdma_enable(rdev, false); | 431 | cik_sdma_enable(rdev, false); |
429 | 432 | ||
@@ -492,9 +495,6 @@ int cik_sdma_resume(struct radeon_device *rdev) | |||
492 | */ | 495 | */ |
493 | void cik_sdma_fini(struct radeon_device *rdev) | 496 | void cik_sdma_fini(struct radeon_device *rdev) |
494 | { | 497 | { |
495 | /* stop the gfx rings and rlc compute queues */ | ||
496 | cik_sdma_gfx_stop(rdev); | ||
497 | cik_sdma_rlc_stop(rdev); | ||
498 | /* halt the MEs */ | 498 | /* halt the MEs */ |
499 | cik_sdma_enable(rdev, false); | 499 | cik_sdma_enable(rdev, false); |
500 | radeon_ring_fini(rdev, &rdev->ring[R600_RING_TYPE_DMA_INDEX]); | 500 | radeon_ring_fini(rdev, &rdev->ring[R600_RING_TYPE_DMA_INDEX]); |
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 713a5d359901..94e858751994 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c | |||
@@ -278,13 +278,15 @@ static int dce6_audio_chipset_supported(struct radeon_device *rdev) | |||
278 | return !ASIC_IS_NODCE(rdev); | 278 | return !ASIC_IS_NODCE(rdev); |
279 | } | 279 | } |
280 | 280 | ||
281 | static void dce6_audio_enable(struct radeon_device *rdev, | 281 | void dce6_audio_enable(struct radeon_device *rdev, |
282 | struct r600_audio_pin *pin, | 282 | struct r600_audio_pin *pin, |
283 | bool enable) | 283 | bool enable) |
284 | { | 284 | { |
285 | if (!pin) | ||
286 | return; | ||
287 | |||
285 | WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOTPLUG_CONTROL, | 288 | WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOTPLUG_CONTROL, |
286 | AUDIO_ENABLED); | 289 | enable ? AUDIO_ENABLED : 0); |
287 | DRM_INFO("%s audio %d support\n", enable ? "Enabling" : "Disabling", pin->id); | ||
288 | } | 290 | } |
289 | 291 | ||
290 | static const u32 pin_offsets[7] = | 292 | static const u32 pin_offsets[7] = |
@@ -323,7 +325,8 @@ int dce6_audio_init(struct radeon_device *rdev) | |||
323 | rdev->audio.pin[i].connected = false; | 325 | rdev->audio.pin[i].connected = false; |
324 | rdev->audio.pin[i].offset = pin_offsets[i]; | 326 | rdev->audio.pin[i].offset = pin_offsets[i]; |
325 | rdev->audio.pin[i].id = i; | 327 | rdev->audio.pin[i].id = i; |
326 | dce6_audio_enable(rdev, &rdev->audio.pin[i], true); | 328 | /* disable audio. it will be set up later */ |
329 | dce6_audio_enable(rdev, &rdev->audio.pin[i], false); | ||
327 | } | 330 | } |
328 | 331 | ||
329 | return 0; | 332 | return 0; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 5623e7542d99..27b0ff16082e 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -5299,7 +5299,8 @@ int evergreen_resume(struct radeon_device *rdev) | |||
5299 | /* init golden registers */ | 5299 | /* init golden registers */ |
5300 | evergreen_init_golden_registers(rdev); | 5300 | evergreen_init_golden_registers(rdev); |
5301 | 5301 | ||
5302 | radeon_pm_resume(rdev); | 5302 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
5303 | radeon_pm_resume(rdev); | ||
5303 | 5304 | ||
5304 | rdev->accel_working = true; | 5305 | rdev->accel_working = true; |
5305 | r = evergreen_startup(rdev); | 5306 | r = evergreen_startup(rdev); |
@@ -5475,9 +5476,9 @@ void evergreen_fini(struct radeon_device *rdev) | |||
5475 | radeon_wb_fini(rdev); | 5476 | radeon_wb_fini(rdev); |
5476 | radeon_ib_pool_fini(rdev); | 5477 | radeon_ib_pool_fini(rdev); |
5477 | radeon_irq_kms_fini(rdev); | 5478 | radeon_irq_kms_fini(rdev); |
5478 | evergreen_pcie_gart_fini(rdev); | ||
5479 | uvd_v1_0_fini(rdev); | 5479 | uvd_v1_0_fini(rdev); |
5480 | radeon_uvd_fini(rdev); | 5480 | radeon_uvd_fini(rdev); |
5481 | evergreen_pcie_gart_fini(rdev); | ||
5481 | r600_vram_scratch_fini(rdev); | 5482 | r600_vram_scratch_fini(rdev); |
5482 | radeon_gem_fini(rdev); | 5483 | radeon_gem_fini(rdev); |
5483 | radeon_fence_driver_fini(rdev); | 5484 | radeon_fence_driver_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 0c6d5cef4cf1..05b0c95813fd 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -306,6 +306,15 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
306 | return; | 306 | return; |
307 | offset = dig->afmt->offset; | 307 | offset = dig->afmt->offset; |
308 | 308 | ||
309 | /* disable audio prior to setting up hw */ | ||
310 | if (ASIC_IS_DCE6(rdev)) { | ||
311 | dig->afmt->pin = dce6_audio_get_pin(rdev); | ||
312 | dce6_audio_enable(rdev, dig->afmt->pin, false); | ||
313 | } else { | ||
314 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
315 | r600_audio_enable(rdev, dig->afmt->pin, false); | ||
316 | } | ||
317 | |||
309 | evergreen_audio_set_dto(encoder, mode->clock); | 318 | evergreen_audio_set_dto(encoder, mode->clock); |
310 | 319 | ||
311 | WREG32(HDMI_VBI_PACKET_CONTROL + offset, | 320 | WREG32(HDMI_VBI_PACKET_CONTROL + offset, |
@@ -409,12 +418,16 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
409 | WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF); | 418 | WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF); |
410 | WREG32(AFMT_RAMP_CONTROL2 + offset, 0x00000001); | 419 | WREG32(AFMT_RAMP_CONTROL2 + offset, 0x00000001); |
411 | WREG32(AFMT_RAMP_CONTROL3 + offset, 0x00000001); | 420 | WREG32(AFMT_RAMP_CONTROL3 + offset, 0x00000001); |
421 | |||
422 | /* enable audio after to setting up hw */ | ||
423 | if (ASIC_IS_DCE6(rdev)) | ||
424 | dce6_audio_enable(rdev, dig->afmt->pin, true); | ||
425 | else | ||
426 | r600_audio_enable(rdev, dig->afmt->pin, true); | ||
412 | } | 427 | } |
413 | 428 | ||
414 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | 429 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) |
415 | { | 430 | { |
416 | struct drm_device *dev = encoder->dev; | ||
417 | struct radeon_device *rdev = dev->dev_private; | ||
418 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 431 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
419 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 432 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
420 | 433 | ||
@@ -427,15 +440,6 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
427 | if (!enable && !dig->afmt->enabled) | 440 | if (!enable && !dig->afmt->enabled) |
428 | return; | 441 | return; |
429 | 442 | ||
430 | if (enable) { | ||
431 | if (ASIC_IS_DCE6(rdev)) | ||
432 | dig->afmt->pin = dce6_audio_get_pin(rdev); | ||
433 | else | ||
434 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
435 | } else { | ||
436 | dig->afmt->pin = NULL; | ||
437 | } | ||
438 | |||
439 | dig->afmt->enabled = enable; | 443 | dig->afmt->enabled = enable; |
440 | 444 | ||
441 | DRM_DEBUG("%sabling HDMI interface @ 0x%04X for encoder 0x%x\n", | 445 | DRM_DEBUG("%sabling HDMI interface @ 0x%04X for encoder 0x%x\n", |
diff --git a/drivers/gpu/drm/radeon/evergreen_smc.h b/drivers/gpu/drm/radeon/evergreen_smc.h index 76ada8cfe902..3a03ba37d043 100644 --- a/drivers/gpu/drm/radeon/evergreen_smc.h +++ b/drivers/gpu/drm/radeon/evergreen_smc.h | |||
@@ -57,7 +57,7 @@ typedef struct SMC_Evergreen_MCRegisters SMC_Evergreen_MCRegisters; | |||
57 | 57 | ||
58 | #define EVERGREEN_SMC_FIRMWARE_HEADER_LOCATION 0x100 | 58 | #define EVERGREEN_SMC_FIRMWARE_HEADER_LOCATION 0x100 |
59 | 59 | ||
60 | #define EVERGREEN_SMC_FIRMWARE_HEADER_softRegisters 0x0 | 60 | #define EVERGREEN_SMC_FIRMWARE_HEADER_softRegisters 0x8 |
61 | #define EVERGREEN_SMC_FIRMWARE_HEADER_stateTable 0xC | 61 | #define EVERGREEN_SMC_FIRMWARE_HEADER_stateTable 0xC |
62 | #define EVERGREEN_SMC_FIRMWARE_HEADER_mcRegisterTable 0x20 | 62 | #define EVERGREEN_SMC_FIRMWARE_HEADER_mcRegisterTable 0x20 |
63 | 63 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index ea932ac66fc6..bf6300cfd62d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -2105,7 +2105,8 @@ int cayman_resume(struct radeon_device *rdev) | |||
2105 | /* init golden registers */ | 2105 | /* init golden registers */ |
2106 | ni_init_golden_registers(rdev); | 2106 | ni_init_golden_registers(rdev); |
2107 | 2107 | ||
2108 | radeon_pm_resume(rdev); | 2108 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
2109 | radeon_pm_resume(rdev); | ||
2109 | 2110 | ||
2110 | rdev->accel_working = true; | 2111 | rdev->accel_working = true; |
2111 | r = cayman_startup(rdev); | 2112 | r = cayman_startup(rdev); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index ef024ce3f7cc..3cc78bb66042 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -3942,8 +3942,6 @@ int r100_resume(struct radeon_device *rdev) | |||
3942 | /* Initialize surface registers */ | 3942 | /* Initialize surface registers */ |
3943 | radeon_surface_init(rdev); | 3943 | radeon_surface_init(rdev); |
3944 | 3944 | ||
3945 | radeon_pm_resume(rdev); | ||
3946 | |||
3947 | rdev->accel_working = true; | 3945 | rdev->accel_working = true; |
3948 | r = r100_startup(rdev); | 3946 | r = r100_startup(rdev); |
3949 | if (r) { | 3947 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 7c63ef840e86..0b658b34b33a 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -1430,8 +1430,6 @@ int r300_resume(struct radeon_device *rdev) | |||
1430 | /* Initialize surface registers */ | 1430 | /* Initialize surface registers */ |
1431 | radeon_surface_init(rdev); | 1431 | radeon_surface_init(rdev); |
1432 | 1432 | ||
1433 | radeon_pm_resume(rdev); | ||
1434 | |||
1435 | rdev->accel_working = true; | 1433 | rdev->accel_working = true; |
1436 | r = r300_startup(rdev); | 1434 | r = r300_startup(rdev); |
1437 | if (r) { | 1435 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 3768aab2710b..802b19220a21 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -325,8 +325,6 @@ int r420_resume(struct radeon_device *rdev) | |||
325 | /* Initialize surface registers */ | 325 | /* Initialize surface registers */ |
326 | radeon_surface_init(rdev); | 326 | radeon_surface_init(rdev); |
327 | 327 | ||
328 | radeon_pm_resume(rdev); | ||
329 | |||
330 | rdev->accel_working = true; | 328 | rdev->accel_working = true; |
331 | r = r420_startup(rdev); | 329 | r = r420_startup(rdev); |
332 | if (r) { | 330 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index e209eb75024f..98d6053c36c6 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -240,8 +240,6 @@ int r520_resume(struct radeon_device *rdev) | |||
240 | /* Initialize surface registers */ | 240 | /* Initialize surface registers */ |
241 | radeon_surface_init(rdev); | 241 | radeon_surface_init(rdev); |
242 | 242 | ||
243 | radeon_pm_resume(rdev); | ||
244 | |||
245 | rdev->accel_working = true; | 243 | rdev->accel_working = true; |
246 | r = r520_startup(rdev); | 244 | r = r520_startup(rdev); |
247 | if (r) { | 245 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index cdbc4171fe73..647ef4079217 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2968,7 +2968,8 @@ int r600_resume(struct radeon_device *rdev) | |||
2968 | /* post card */ | 2968 | /* post card */ |
2969 | atom_asic_init(rdev->mode_info.atom_context); | 2969 | atom_asic_init(rdev->mode_info.atom_context); |
2970 | 2970 | ||
2971 | radeon_pm_resume(rdev); | 2971 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
2972 | radeon_pm_resume(rdev); | ||
2972 | 2973 | ||
2973 | rdev->accel_working = true; | 2974 | rdev->accel_working = true; |
2974 | r = r600_startup(rdev); | 2975 | r = r600_startup(rdev); |
diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index 47fc2b886979..bffac10c4296 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c | |||
@@ -142,12 +142,15 @@ void r600_audio_update_hdmi(struct work_struct *work) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /* enable the audio stream */ | 144 | /* enable the audio stream */ |
145 | static void r600_audio_enable(struct radeon_device *rdev, | 145 | void r600_audio_enable(struct radeon_device *rdev, |
146 | struct r600_audio_pin *pin, | 146 | struct r600_audio_pin *pin, |
147 | bool enable) | 147 | bool enable) |
148 | { | 148 | { |
149 | u32 value = 0; | 149 | u32 value = 0; |
150 | 150 | ||
151 | if (!pin) | ||
152 | return; | ||
153 | |||
151 | if (ASIC_IS_DCE4(rdev)) { | 154 | if (ASIC_IS_DCE4(rdev)) { |
152 | if (enable) { | 155 | if (enable) { |
153 | value |= 0x81000000; /* Required to enable audio */ | 156 | value |= 0x81000000; /* Required to enable audio */ |
@@ -158,7 +161,6 @@ static void r600_audio_enable(struct radeon_device *rdev, | |||
158 | WREG32_P(R600_AUDIO_ENABLE, | 161 | WREG32_P(R600_AUDIO_ENABLE, |
159 | enable ? 0x81000000 : 0x0, ~0x81000000); | 162 | enable ? 0x81000000 : 0x0, ~0x81000000); |
160 | } | 163 | } |
161 | DRM_INFO("%s audio %d support\n", enable ? "Enabling" : "Disabling", pin->id); | ||
162 | } | 164 | } |
163 | 165 | ||
164 | /* | 166 | /* |
@@ -178,8 +180,8 @@ int r600_audio_init(struct radeon_device *rdev) | |||
178 | rdev->audio.pin[0].status_bits = 0; | 180 | rdev->audio.pin[0].status_bits = 0; |
179 | rdev->audio.pin[0].category_code = 0; | 181 | rdev->audio.pin[0].category_code = 0; |
180 | rdev->audio.pin[0].id = 0; | 182 | rdev->audio.pin[0].id = 0; |
181 | 183 | /* disable audio. it will be set up later */ | |
182 | r600_audio_enable(rdev, &rdev->audio.pin[0], true); | 184 | r600_audio_enable(rdev, &rdev->audio.pin[0], false); |
183 | 185 | ||
184 | return 0; | 186 | return 0; |
185 | } | 187 | } |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 3016fc14f502..85a2bb28aed2 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -329,9 +329,6 @@ static void dce3_2_afmt_write_speaker_allocation(struct drm_encoder *encoder) | |||
329 | u8 *sadb; | 329 | u8 *sadb; |
330 | int sad_count; | 330 | int sad_count; |
331 | 331 | ||
332 | /* XXX: setting this register causes hangs on some asics */ | ||
333 | return; | ||
334 | |||
335 | list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { | 332 | list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { |
336 | if (connector->encoder == encoder) { | 333 | if (connector->encoder == encoder) { |
337 | radeon_connector = to_radeon_connector(connector); | 334 | radeon_connector = to_radeon_connector(connector); |
@@ -460,6 +457,10 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
460 | return; | 457 | return; |
461 | offset = dig->afmt->offset; | 458 | offset = dig->afmt->offset; |
462 | 459 | ||
460 | /* disable audio prior to setting up hw */ | ||
461 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
462 | r600_audio_enable(rdev, dig->afmt->pin, false); | ||
463 | |||
463 | r600_audio_set_dto(encoder, mode->clock); | 464 | r600_audio_set_dto(encoder, mode->clock); |
464 | 465 | ||
465 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, | 466 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, |
@@ -531,6 +532,9 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
531 | WREG32(HDMI0_RAMP_CONTROL3 + offset, 0x00000001); | 532 | WREG32(HDMI0_RAMP_CONTROL3 + offset, 0x00000001); |
532 | 533 | ||
533 | r600_hdmi_audio_workaround(encoder); | 534 | r600_hdmi_audio_workaround(encoder); |
535 | |||
536 | /* enable audio after to setting up hw */ | ||
537 | r600_audio_enable(rdev, dig->afmt->pin, true); | ||
534 | } | 538 | } |
535 | 539 | ||
536 | /* | 540 | /* |
@@ -651,11 +655,6 @@ void r600_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
651 | if (!enable && !dig->afmt->enabled) | 655 | if (!enable && !dig->afmt->enabled) |
652 | return; | 656 | return; |
653 | 657 | ||
654 | if (enable) | ||
655 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
656 | else | ||
657 | dig->afmt->pin = NULL; | ||
658 | |||
659 | /* Older chipsets require setting HDMI and routing manually */ | 658 | /* Older chipsets require setting HDMI and routing manually */ |
660 | if (!ASIC_IS_DCE3(rdev)) { | 659 | if (!ASIC_IS_DCE3(rdev)) { |
661 | if (enable) | 660 | if (enable) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 024db37b1832..e887d027b6d0 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -2747,6 +2747,12 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
2747 | void r600_audio_update_hdmi(struct work_struct *work); | 2747 | void r600_audio_update_hdmi(struct work_struct *work); |
2748 | struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev); | 2748 | struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev); |
2749 | struct r600_audio_pin *dce6_audio_get_pin(struct radeon_device *rdev); | 2749 | struct r600_audio_pin *dce6_audio_get_pin(struct radeon_device *rdev); |
2750 | void r600_audio_enable(struct radeon_device *rdev, | ||
2751 | struct r600_audio_pin *pin, | ||
2752 | bool enable); | ||
2753 | void dce6_audio_enable(struct radeon_device *rdev, | ||
2754 | struct r600_audio_pin *pin, | ||
2755 | bool enable); | ||
2750 | 2756 | ||
2751 | /* | 2757 | /* |
2752 | * R600 vram scratch functions | 2758 | * R600 vram scratch functions |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 485848f889f5..fa9a9c02751e 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -219,7 +219,8 @@ static int radeon_atpx_verify_interface(struct radeon_atpx *atpx) | |||
219 | memcpy(&output, info->buffer.pointer, size); | 219 | memcpy(&output, info->buffer.pointer, size); |
220 | 220 | ||
221 | /* TODO: check version? */ | 221 | /* TODO: check version? */ |
222 | printk("ATPX version %u\n", output.version); | 222 | printk("ATPX version %u, functions 0x%08x\n", |
223 | output.version, output.function_bits); | ||
223 | 224 | ||
224 | radeon_atpx_parse_functions(&atpx->functions, output.function_bits); | 225 | radeon_atpx_parse_functions(&atpx->functions, output.function_bits); |
225 | 226 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index b012cbbc3ed5..044bc98fb459 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1521,13 +1521,16 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) | |||
1521 | if (r) | 1521 | if (r) |
1522 | DRM_ERROR("ib ring test failed (%d).\n", r); | 1522 | DRM_ERROR("ib ring test failed (%d).\n", r); |
1523 | 1523 | ||
1524 | if (rdev->pm.dpm_enabled) { | 1524 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { |
1525 | /* do dpm late init */ | 1525 | /* do dpm late init */ |
1526 | r = radeon_pm_late_init(rdev); | 1526 | r = radeon_pm_late_init(rdev); |
1527 | if (r) { | 1527 | if (r) { |
1528 | rdev->pm.dpm_enabled = false; | 1528 | rdev->pm.dpm_enabled = false; |
1529 | DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); | 1529 | DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); |
1530 | } | 1530 | } |
1531 | } else { | ||
1532 | /* resume old pm late */ | ||
1533 | radeon_pm_resume(rdev); | ||
1531 | } | 1534 | } |
1532 | 1535 | ||
1533 | radeon_restore_bios_scratch_regs(rdev); | 1536 | radeon_restore_bios_scratch_regs(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 114d1672d616..66ed3ea71440 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -33,6 +33,13 @@ | |||
33 | #include <linux/vga_switcheroo.h> | 33 | #include <linux/vga_switcheroo.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
36 | |||
37 | #if defined(CONFIG_VGA_SWITCHEROO) | ||
38 | bool radeon_is_px(void); | ||
39 | #else | ||
40 | static inline bool radeon_is_px(void) { return false; } | ||
41 | #endif | ||
42 | |||
36 | /** | 43 | /** |
37 | * radeon_driver_unload_kms - Main unload function for KMS. | 44 | * radeon_driver_unload_kms - Main unload function for KMS. |
38 | * | 45 | * |
@@ -130,7 +137,8 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) | |||
130 | "Error during ACPI methods call\n"); | 137 | "Error during ACPI methods call\n"); |
131 | } | 138 | } |
132 | 139 | ||
133 | if (radeon_runtime_pm != 0) { | 140 | if ((radeon_runtime_pm == 1) || |
141 | ((radeon_runtime_pm == -1) && radeon_is_px())) { | ||
134 | pm_runtime_use_autosuspend(dev->dev); | 142 | pm_runtime_use_autosuspend(dev->dev); |
135 | pm_runtime_set_autosuspend_delay(dev->dev, 5000); | 143 | pm_runtime_set_autosuspend_delay(dev->dev, 5000); |
136 | pm_runtime_set_active(dev->dev); | 144 | pm_runtime_set_active(dev->dev); |
@@ -537,6 +545,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
537 | 545 | ||
538 | radeon_vm_init(rdev, &fpriv->vm); | 546 | radeon_vm_init(rdev, &fpriv->vm); |
539 | 547 | ||
548 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | ||
549 | if (r) | ||
550 | return r; | ||
551 | |||
540 | /* map the ib pool buffer read only into | 552 | /* map the ib pool buffer read only into |
541 | * virtual address space */ | 553 | * virtual address space */ |
542 | bo_va = radeon_vm_bo_add(rdev, &fpriv->vm, | 554 | bo_va = radeon_vm_bo_add(rdev, &fpriv->vm, |
@@ -544,6 +556,8 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
544 | r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET, | 556 | r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET, |
545 | RADEON_VM_PAGE_READABLE | | 557 | RADEON_VM_PAGE_READABLE | |
546 | RADEON_VM_PAGE_SNOOPED); | 558 | RADEON_VM_PAGE_SNOOPED); |
559 | |||
560 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); | ||
547 | if (r) { | 561 | if (r) { |
548 | radeon_vm_fini(rdev, &fpriv->vm); | 562 | radeon_vm_fini(rdev, &fpriv->vm); |
549 | kfree(fpriv); | 563 | kfree(fpriv); |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 77f5b0c3edb8..040a2a10ea17 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -714,6 +714,9 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
714 | DRM_ERROR("Failed initializing VRAM heap.\n"); | 714 | DRM_ERROR("Failed initializing VRAM heap.\n"); |
715 | return r; | 715 | return r; |
716 | } | 716 | } |
717 | /* Change the size here instead of the init above so only lpfn is affected */ | ||
718 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); | ||
719 | |||
717 | r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true, | 720 | r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true, |
718 | RADEON_GEM_DOMAIN_VRAM, | 721 | RADEON_GEM_DOMAIN_VRAM, |
719 | NULL, &rdev->stollen_vga_memory); | 722 | NULL, &rdev->stollen_vga_memory); |
@@ -935,7 +938,7 @@ static ssize_t radeon_ttm_gtt_read(struct file *f, char __user *buf, | |||
935 | while (size) { | 938 | while (size) { |
936 | loff_t p = *pos / PAGE_SIZE; | 939 | loff_t p = *pos / PAGE_SIZE; |
937 | unsigned off = *pos & ~PAGE_MASK; | 940 | unsigned off = *pos & ~PAGE_MASK; |
938 | ssize_t cur_size = min(size, PAGE_SIZE - off); | 941 | size_t cur_size = min_t(size_t, size, PAGE_SIZE - off); |
939 | struct page *page; | 942 | struct page *page; |
940 | void *ptr; | 943 | void *ptr; |
941 | 944 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 6781fee1eaad..3e6804b2b2ef 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -171,6 +171,8 @@ void radeon_uvd_fini(struct radeon_device *rdev) | |||
171 | 171 | ||
172 | radeon_bo_unref(&rdev->uvd.vcpu_bo); | 172 | radeon_bo_unref(&rdev->uvd.vcpu_bo); |
173 | 173 | ||
174 | radeon_ring_fini(rdev, &rdev->ring[R600_RING_TYPE_UVD_INDEX]); | ||
175 | |||
174 | release_firmware(rdev->uvd_fw); | 176 | release_firmware(rdev->uvd_fw); |
175 | } | 177 | } |
176 | 178 | ||
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index b5c2369cda2f..130d5cc50d43 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -474,8 +474,6 @@ int rs400_resume(struct radeon_device *rdev) | |||
474 | /* Initialize surface registers */ | 474 | /* Initialize surface registers */ |
475 | radeon_surface_init(rdev); | 475 | radeon_surface_init(rdev); |
476 | 476 | ||
477 | radeon_pm_resume(rdev); | ||
478 | |||
479 | rdev->accel_working = true; | 477 | rdev->accel_working = true; |
480 | r = rs400_startup(rdev); | 478 | r = rs400_startup(rdev); |
481 | if (r) { | 479 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index fdcde7693032..72d3616de08e 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -1048,8 +1048,6 @@ int rs600_resume(struct radeon_device *rdev) | |||
1048 | /* Initialize surface registers */ | 1048 | /* Initialize surface registers */ |
1049 | radeon_surface_init(rdev); | 1049 | radeon_surface_init(rdev); |
1050 | 1050 | ||
1051 | radeon_pm_resume(rdev); | ||
1052 | |||
1053 | rdev->accel_working = true; | 1051 | rdev->accel_working = true; |
1054 | r = rs600_startup(rdev); | 1052 | r = rs600_startup(rdev); |
1055 | if (r) { | 1053 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 35950738bd5e..3462b64369bf 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -756,8 +756,6 @@ int rs690_resume(struct radeon_device *rdev) | |||
756 | /* Initialize surface registers */ | 756 | /* Initialize surface registers */ |
757 | radeon_surface_init(rdev); | 757 | radeon_surface_init(rdev); |
758 | 758 | ||
759 | radeon_pm_resume(rdev); | ||
760 | |||
761 | rdev->accel_working = true; | 759 | rdev->accel_working = true; |
762 | r = rs690_startup(rdev); | 760 | r = rs690_startup(rdev); |
763 | if (r) { | 761 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 98e8138ff779..237dd29d9f1c 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -586,8 +586,6 @@ int rv515_resume(struct radeon_device *rdev) | |||
586 | /* Initialize surface registers */ | 586 | /* Initialize surface registers */ |
587 | radeon_surface_init(rdev); | 587 | radeon_surface_init(rdev); |
588 | 588 | ||
589 | radeon_pm_resume(rdev); | ||
590 | |||
591 | rdev->accel_working = true; | 589 | rdev->accel_working = true; |
592 | r = rv515_startup(rdev); | 590 | r = rv515_startup(rdev); |
593 | if (r) { | 591 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 6c772e58c784..fef310773aad 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1811,7 +1811,8 @@ int rv770_resume(struct radeon_device *rdev) | |||
1811 | /* init golden registers */ | 1811 | /* init golden registers */ |
1812 | rv770_init_golden_registers(rdev); | 1812 | rv770_init_golden_registers(rdev); |
1813 | 1813 | ||
1814 | radeon_pm_resume(rdev); | 1814 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
1815 | radeon_pm_resume(rdev); | ||
1815 | 1816 | ||
1816 | rdev->accel_working = true; | 1817 | rdev->accel_working = true; |
1817 | r = rv770_startup(rdev); | 1818 | r = rv770_startup(rdev); |
@@ -1955,9 +1956,9 @@ void rv770_fini(struct radeon_device *rdev) | |||
1955 | radeon_wb_fini(rdev); | 1956 | radeon_wb_fini(rdev); |
1956 | radeon_ib_pool_fini(rdev); | 1957 | radeon_ib_pool_fini(rdev); |
1957 | radeon_irq_kms_fini(rdev); | 1958 | radeon_irq_kms_fini(rdev); |
1958 | rv770_pcie_gart_fini(rdev); | ||
1959 | uvd_v1_0_fini(rdev); | 1959 | uvd_v1_0_fini(rdev); |
1960 | radeon_uvd_fini(rdev); | 1960 | radeon_uvd_fini(rdev); |
1961 | rv770_pcie_gart_fini(rdev); | ||
1961 | r600_vram_scratch_fini(rdev); | 1962 | r600_vram_scratch_fini(rdev); |
1962 | radeon_gem_fini(rdev); | 1963 | radeon_gem_fini(rdev); |
1963 | radeon_fence_driver_fini(rdev); | 1964 | radeon_fence_driver_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 83578324e5d1..9a124d0608b3 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -6618,7 +6618,8 @@ int si_resume(struct radeon_device *rdev) | |||
6618 | /* init golden registers */ | 6618 | /* init golden registers */ |
6619 | si_init_golden_registers(rdev); | 6619 | si_init_golden_registers(rdev); |
6620 | 6620 | ||
6621 | radeon_pm_resume(rdev); | 6621 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
6622 | radeon_pm_resume(rdev); | ||
6622 | 6623 | ||
6623 | rdev->accel_working = true; | 6624 | rdev->accel_working = true; |
6624 | r = si_startup(rdev); | 6625 | r = si_startup(rdev); |
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 88a529008ce0..c71594754f46 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c | |||
@@ -104,7 +104,7 @@ static void tegra_drm_context_free(struct tegra_drm_context *context) | |||
104 | 104 | ||
105 | static void tegra_drm_lastclose(struct drm_device *drm) | 105 | static void tegra_drm_lastclose(struct drm_device *drm) |
106 | { | 106 | { |
107 | #ifdef CONFIG_TEGRA_DRM_FBDEV | 107 | #ifdef CONFIG_DRM_TEGRA_FBDEV |
108 | struct tegra_drm *tegra = drm->dev_private; | 108 | struct tegra_drm *tegra = drm->dev_private; |
109 | 109 | ||
110 | tegra_fbdev_restore_mode(tegra->fbdev); | 110 | tegra_fbdev_restore_mode(tegra->fbdev); |
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 338f7f6561d7..0266fb40479e 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c | |||
@@ -15,6 +15,7 @@ | |||
15 | struct tegra_rgb { | 15 | struct tegra_rgb { |
16 | struct tegra_output output; | 16 | struct tegra_output output; |
17 | struct tegra_dc *dc; | 17 | struct tegra_dc *dc; |
18 | bool enabled; | ||
18 | 19 | ||
19 | struct clk *clk_parent; | 20 | struct clk *clk_parent; |
20 | struct clk *clk; | 21 | struct clk *clk; |
@@ -89,6 +90,9 @@ static int tegra_output_rgb_enable(struct tegra_output *output) | |||
89 | struct tegra_rgb *rgb = to_rgb(output); | 90 | struct tegra_rgb *rgb = to_rgb(output); |
90 | unsigned long value; | 91 | unsigned long value; |
91 | 92 | ||
93 | if (rgb->enabled) | ||
94 | return 0; | ||
95 | |||
92 | tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); | 96 | tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); |
93 | 97 | ||
94 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; | 98 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; |
@@ -122,6 +126,8 @@ static int tegra_output_rgb_enable(struct tegra_output *output) | |||
122 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL); | 126 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL); |
123 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); | 127 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); |
124 | 128 | ||
129 | rgb->enabled = true; | ||
130 | |||
125 | return 0; | 131 | return 0; |
126 | } | 132 | } |
127 | 133 | ||
@@ -130,6 +136,9 @@ static int tegra_output_rgb_disable(struct tegra_output *output) | |||
130 | struct tegra_rgb *rgb = to_rgb(output); | 136 | struct tegra_rgb *rgb = to_rgb(output); |
131 | unsigned long value; | 137 | unsigned long value; |
132 | 138 | ||
139 | if (!rgb->enabled) | ||
140 | return 0; | ||
141 | |||
133 | value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL); | 142 | value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL); |
134 | value &= ~(PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE | | 143 | value &= ~(PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE | |
135 | PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); | 144 | PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); |
@@ -144,6 +153,8 @@ static int tegra_output_rgb_disable(struct tegra_output *output) | |||
144 | 153 | ||
145 | tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); | 154 | tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); |
146 | 155 | ||
156 | rgb->enabled = false; | ||
157 | |||
147 | return 0; | 158 | return 0; |
148 | } | 159 | } |
149 | 160 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index a06651309388..214b7992a3aa 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -351,9 +351,11 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, | |||
351 | 351 | ||
352 | moved: | 352 | moved: |
353 | if (bo->evicted) { | 353 | if (bo->evicted) { |
354 | ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); | 354 | if (bdev->driver->invalidate_caches) { |
355 | if (ret) | 355 | ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); |
356 | pr_err("Can not flush read caches\n"); | 356 | if (ret) |
357 | pr_err("Can not flush read caches\n"); | ||
358 | } | ||
357 | bo->evicted = false; | 359 | bo->evicted = false; |
358 | } | 360 | } |
359 | 361 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 801231c9ae48..0ce48e5a9cb4 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c | |||
@@ -339,11 +339,13 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, | |||
339 | vma->vm_private_data = bo; | 339 | vma->vm_private_data = bo; |
340 | 340 | ||
341 | /* | 341 | /* |
342 | * PFNMAP is faster than MIXEDMAP due to reduced page | 342 | * We'd like to use VM_PFNMAP on shared mappings, where |
343 | * administration. So use MIXEDMAP only if private VMA, where | 343 | * (vma->vm_flags & VM_SHARED) != 0, for performance reasons, |
344 | * we need to support COW. | 344 | * but for some reason VM_PFNMAP + x86 PAT + write-combine is very |
345 | * bad for performance. Until that has been sorted out, use | ||
346 | * VM_MIXEDMAP on all mappings. See freedesktop.org bug #75719 | ||
345 | */ | 347 | */ |
346 | vma->vm_flags |= (vma->vm_flags & VM_SHARED) ? VM_PFNMAP : VM_MIXEDMAP; | 348 | vma->vm_flags |= VM_MIXEDMAP; |
347 | vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; | 349 | vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; |
348 | return 0; | 350 | return 0; |
349 | out_unref: | 351 | out_unref: |
@@ -359,7 +361,7 @@ int ttm_fbdev_mmap(struct vm_area_struct *vma, struct ttm_buffer_object *bo) | |||
359 | 361 | ||
360 | vma->vm_ops = &ttm_bo_vm_ops; | 362 | vma->vm_ops = &ttm_bo_vm_ops; |
361 | vma->vm_private_data = ttm_bo_reference(bo); | 363 | vma->vm_private_data = ttm_bo_reference(bo); |
362 | vma->vm_flags |= (vma->vm_flags & VM_SHARED) ? VM_PFNMAP : VM_MIXEDMAP; | 364 | vma->vm_flags |= VM_MIXEDMAP; |
363 | vma->vm_flags |= VM_IO | VM_DONTEXPAND; | 365 | vma->vm_flags |= VM_IO | VM_DONTEXPAND; |
364 | return 0; | 366 | return 0; |
365 | } | 367 | } |
diff --git a/drivers/gpu/drm/vmwgfx/svga3d_reg.h b/drivers/gpu/drm/vmwgfx/svga3d_reg.h index bb594c11605e..f58dc7dd15c5 100644 --- a/drivers/gpu/drm/vmwgfx/svga3d_reg.h +++ b/drivers/gpu/drm/vmwgfx/svga3d_reg.h | |||
@@ -261,12 +261,7 @@ typedef enum SVGA3dSurfaceFormat { | |||
261 | /* Planar video formats. */ | 261 | /* Planar video formats. */ |
262 | SVGA3D_YV12 = 121, | 262 | SVGA3D_YV12 = 121, |
263 | 263 | ||
264 | /* Shader constant formats. */ | 264 | SVGA3D_FORMAT_MAX = 122, |
265 | SVGA3D_SURFACE_SHADERCONST_FLOAT = 122, | ||
266 | SVGA3D_SURFACE_SHADERCONST_INT = 123, | ||
267 | SVGA3D_SURFACE_SHADERCONST_BOOL = 124, | ||
268 | |||
269 | SVGA3D_FORMAT_MAX = 125, | ||
270 | } SVGA3dSurfaceFormat; | 265 | } SVGA3dSurfaceFormat; |
271 | 266 | ||
272 | typedef uint32 SVGA3dColor; /* a, r, g, b */ | 267 | typedef uint32 SVGA3dColor; /* a, r, g, b */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 9e4be1725985..07831554dad7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <drm/ttm/ttm_module.h> | 40 | #include <drm/ttm/ttm_module.h> |
41 | #include "vmwgfx_fence.h" | 41 | #include "vmwgfx_fence.h" |
42 | 42 | ||
43 | #define VMWGFX_DRIVER_DATE "20121114" | 43 | #define VMWGFX_DRIVER_DATE "20140228" |
44 | #define VMWGFX_DRIVER_MAJOR 2 | 44 | #define VMWGFX_DRIVER_MAJOR 2 |
45 | #define VMWGFX_DRIVER_MINOR 5 | 45 | #define VMWGFX_DRIVER_MINOR 5 |
46 | #define VMWGFX_DRIVER_PATCHLEVEL 0 | 46 | #define VMWGFX_DRIVER_PATCHLEVEL 0 |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c index d4a5a19cb8c3..04a64b8cd3cd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | |||
@@ -188,18 +188,20 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv, | |||
188 | 188 | ||
189 | bo = otable->page_table->pt_bo; | 189 | bo = otable->page_table->pt_bo; |
190 | cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); | 190 | cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); |
191 | if (unlikely(cmd == NULL)) | 191 | if (unlikely(cmd == NULL)) { |
192 | DRM_ERROR("Failed reserving FIFO space for OTable setup.\n"); | 192 | DRM_ERROR("Failed reserving FIFO space for OTable " |
193 | 193 | "takedown.\n"); | |
194 | memset(cmd, 0, sizeof(*cmd)); | 194 | } else { |
195 | cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE; | 195 | memset(cmd, 0, sizeof(*cmd)); |
196 | cmd->header.size = sizeof(cmd->body); | 196 | cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE; |
197 | cmd->body.type = type; | 197 | cmd->header.size = sizeof(cmd->body); |
198 | cmd->body.baseAddress = 0; | 198 | cmd->body.type = type; |
199 | cmd->body.sizeInBytes = 0; | 199 | cmd->body.baseAddress = 0; |
200 | cmd->body.validSizeInBytes = 0; | 200 | cmd->body.sizeInBytes = 0; |
201 | cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID; | 201 | cmd->body.validSizeInBytes = 0; |
202 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 202 | cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID; |
203 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
204 | } | ||
203 | 205 | ||
204 | if (bo) { | 206 | if (bo) { |
205 | int ret; | 207 | int ret; |
@@ -562,11 +564,12 @@ void vmw_mob_unbind(struct vmw_private *dev_priv, | |||
562 | if (unlikely(cmd == NULL)) { | 564 | if (unlikely(cmd == NULL)) { |
563 | DRM_ERROR("Failed reserving FIFO space for Memory " | 565 | DRM_ERROR("Failed reserving FIFO space for Memory " |
564 | "Object unbinding.\n"); | 566 | "Object unbinding.\n"); |
567 | } else { | ||
568 | cmd->header.id = SVGA_3D_CMD_DESTROY_GB_MOB; | ||
569 | cmd->header.size = sizeof(cmd->body); | ||
570 | cmd->body.mobid = mob->id; | ||
571 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
565 | } | 572 | } |
566 | cmd->header.id = SVGA_3D_CMD_DESTROY_GB_MOB; | ||
567 | cmd->header.size = sizeof(cmd->body); | ||
568 | cmd->body.mobid = mob->id; | ||
569 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
570 | if (bo) { | 573 | if (bo) { |
571 | vmw_fence_single_bo(bo, NULL); | 574 | vmw_fence_single_bo(bo, NULL); |
572 | ttm_bo_unreserve(bo); | 575 | ttm_bo_unreserve(bo); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 2aa4bc6a4d60..9757b57f8388 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -427,8 +427,7 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, | |||
427 | INIT_LIST_HEAD(&vmw_bo->res_list); | 427 | INIT_LIST_HEAD(&vmw_bo->res_list); |
428 | 428 | ||
429 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, | 429 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, |
430 | (user) ? ttm_bo_type_device : | 430 | ttm_bo_type_device, placement, |
431 | ttm_bo_type_kernel, placement, | ||
432 | 0, interruptible, | 431 | 0, interruptible, |
433 | NULL, acc_size, NULL, bo_free); | 432 | NULL, acc_size, NULL, bo_free); |
434 | return ret; | 433 | return ret; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 82468d902915..e7af580ab977 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | |||
@@ -830,6 +830,24 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, | |||
830 | if (unlikely(ret != 0)) | 830 | if (unlikely(ret != 0)) |
831 | goto out_unlock; | 831 | goto out_unlock; |
832 | 832 | ||
833 | /* | ||
834 | * A gb-aware client referencing a shared surface will | ||
835 | * expect a backup buffer to be present. | ||
836 | */ | ||
837 | if (dev_priv->has_mob && req->shareable) { | ||
838 | uint32_t backup_handle; | ||
839 | |||
840 | ret = vmw_user_dmabuf_alloc(dev_priv, tfile, | ||
841 | res->backup_size, | ||
842 | true, | ||
843 | &backup_handle, | ||
844 | &res->backup); | ||
845 | if (unlikely(ret != 0)) { | ||
846 | vmw_resource_unreference(&res); | ||
847 | goto out_unlock; | ||
848 | } | ||
849 | } | ||
850 | |||
833 | tmp = vmw_resource_reference(&srf->res); | 851 | tmp = vmw_resource_reference(&srf->res); |
834 | ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime, | 852 | ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime, |
835 | req->shareable, VMW_RES_SURFACE, | 853 | req->shareable, VMW_RES_SURFACE, |
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 1146e3bba6e1..112f27e51bc7 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c | |||
@@ -538,7 +538,7 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) | |||
538 | 538 | ||
539 | g->base = job->gather_addr_phys[i]; | 539 | g->base = job->gather_addr_phys[i]; |
540 | 540 | ||
541 | for (j = 0; j < job->num_gathers; j++) | 541 | for (j = i + 1; j < job->num_gathers; j++) |
542 | if (job->gathers[j].bo == g->bo) | 542 | if (job->gathers[j].bo == g->bo) |
543 | job->gathers[j].handled = true; | 543 | job->gathers[j].handled = true; |
544 | 544 | ||
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index befe0e336471..24883b4d1a49 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #define G25_REV_MIN 0x22 | 43 | #define G25_REV_MIN 0x22 |
44 | #define G27_REV_MAJ 0x12 | 44 | #define G27_REV_MAJ 0x12 |
45 | #define G27_REV_MIN 0x38 | 45 | #define G27_REV_MIN 0x38 |
46 | #define G27_2_REV_MIN 0x39 | ||
46 | 47 | ||
47 | #define to_hid_device(pdev) container_of(pdev, struct hid_device, dev) | 48 | #define to_hid_device(pdev) container_of(pdev, struct hid_device, dev) |
48 | 49 | ||
@@ -130,6 +131,7 @@ static const struct lg4ff_usb_revision lg4ff_revs[] = { | |||
130 | {DFP_REV_MAJ, DFP_REV_MIN, &native_dfp}, /* Driving Force Pro */ | 131 | {DFP_REV_MAJ, DFP_REV_MIN, &native_dfp}, /* Driving Force Pro */ |
131 | {G25_REV_MAJ, G25_REV_MIN, &native_g25}, /* G25 */ | 132 | {G25_REV_MAJ, G25_REV_MIN, &native_g25}, /* G25 */ |
132 | {G27_REV_MAJ, G27_REV_MIN, &native_g27}, /* G27 */ | 133 | {G27_REV_MAJ, G27_REV_MIN, &native_g27}, /* G27 */ |
134 | {G27_REV_MAJ, G27_2_REV_MIN, &native_g27}, /* G27 v2 */ | ||
133 | }; | 135 | }; |
134 | 136 | ||
135 | /* Recalculates X axis value accordingly to currently selected range */ | 137 | /* Recalculates X axis value accordingly to currently selected range */ |
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 12354055d474..2f19b15f47f2 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #define DUALSHOCK4_CONTROLLER_BT BIT(6) | 42 | #define DUALSHOCK4_CONTROLLER_BT BIT(6) |
43 | 43 | ||
44 | #define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | DUALSHOCK4_CONTROLLER_USB) | 44 | #define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | DUALSHOCK4_CONTROLLER_USB) |
45 | #define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER_USB | DUALSHOCK4_CONTROLLER_USB) | ||
45 | 46 | ||
46 | #define MAX_LEDS 4 | 47 | #define MAX_LEDS 4 |
47 | 48 | ||
@@ -499,6 +500,7 @@ struct sony_sc { | |||
499 | __u8 right; | 500 | __u8 right; |
500 | #endif | 501 | #endif |
501 | 502 | ||
503 | __u8 worker_initialized; | ||
502 | __u8 led_state[MAX_LEDS]; | 504 | __u8 led_state[MAX_LEDS]; |
503 | __u8 led_count; | 505 | __u8 led_count; |
504 | }; | 506 | }; |
@@ -993,22 +995,11 @@ static int sony_init_ff(struct hid_device *hdev) | |||
993 | return input_ff_create_memless(input_dev, NULL, sony_play_effect); | 995 | return input_ff_create_memless(input_dev, NULL, sony_play_effect); |
994 | } | 996 | } |
995 | 997 | ||
996 | static void sony_destroy_ff(struct hid_device *hdev) | ||
997 | { | ||
998 | struct sony_sc *sc = hid_get_drvdata(hdev); | ||
999 | |||
1000 | cancel_work_sync(&sc->state_worker); | ||
1001 | } | ||
1002 | |||
1003 | #else | 998 | #else |
1004 | static int sony_init_ff(struct hid_device *hdev) | 999 | static int sony_init_ff(struct hid_device *hdev) |
1005 | { | 1000 | { |
1006 | return 0; | 1001 | return 0; |
1007 | } | 1002 | } |
1008 | |||
1009 | static void sony_destroy_ff(struct hid_device *hdev) | ||
1010 | { | ||
1011 | } | ||
1012 | #endif | 1003 | #endif |
1013 | 1004 | ||
1014 | static int sony_set_output_report(struct sony_sc *sc, int req_id, int req_size) | 1005 | static int sony_set_output_report(struct sony_sc *sc, int req_id, int req_size) |
@@ -1077,6 +1068,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1077 | if (sc->quirks & SIXAXIS_CONTROLLER_USB) { | 1068 | if (sc->quirks & SIXAXIS_CONTROLLER_USB) { |
1078 | hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; | 1069 | hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; |
1079 | ret = sixaxis_set_operational_usb(hdev); | 1070 | ret = sixaxis_set_operational_usb(hdev); |
1071 | |||
1072 | sc->worker_initialized = 1; | ||
1080 | INIT_WORK(&sc->state_worker, sixaxis_state_worker); | 1073 | INIT_WORK(&sc->state_worker, sixaxis_state_worker); |
1081 | } | 1074 | } |
1082 | else if (sc->quirks & SIXAXIS_CONTROLLER_BT) | 1075 | else if (sc->quirks & SIXAXIS_CONTROLLER_BT) |
@@ -1087,6 +1080,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1087 | if (ret < 0) | 1080 | if (ret < 0) |
1088 | goto err_stop; | 1081 | goto err_stop; |
1089 | 1082 | ||
1083 | sc->worker_initialized = 1; | ||
1090 | INIT_WORK(&sc->state_worker, dualshock4_state_worker); | 1084 | INIT_WORK(&sc->state_worker, dualshock4_state_worker); |
1091 | } else { | 1085 | } else { |
1092 | ret = 0; | 1086 | ret = 0; |
@@ -1101,9 +1095,11 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1101 | goto err_stop; | 1095 | goto err_stop; |
1102 | } | 1096 | } |
1103 | 1097 | ||
1104 | ret = sony_init_ff(hdev); | 1098 | if (sc->quirks & SONY_FF_SUPPORT) { |
1105 | if (ret < 0) | 1099 | ret = sony_init_ff(hdev); |
1106 | goto err_stop; | 1100 | if (ret < 0) |
1101 | goto err_stop; | ||
1102 | } | ||
1107 | 1103 | ||
1108 | return 0; | 1104 | return 0; |
1109 | err_stop: | 1105 | err_stop: |
@@ -1120,7 +1116,8 @@ static void sony_remove(struct hid_device *hdev) | |||
1120 | if (sc->quirks & SONY_LED_SUPPORT) | 1116 | if (sc->quirks & SONY_LED_SUPPORT) |
1121 | sony_leds_remove(hdev); | 1117 | sony_leds_remove(hdev); |
1122 | 1118 | ||
1123 | sony_destroy_ff(hdev); | 1119 | if (sc->worker_initialized) |
1120 | cancel_work_sync(&sc->state_worker); | ||
1124 | 1121 | ||
1125 | hid_hw_stop(hdev); | 1122 | hid_hw_stop(hdev); |
1126 | } | 1123 | } |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index cb0137b3718d..ab24ce2eb28f 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -320,13 +320,13 @@ static void drop_ref(struct hidraw *hidraw, int exists_bit) | |||
320 | hid_hw_close(hidraw->hid); | 320 | hid_hw_close(hidraw->hid); |
321 | wake_up_interruptible(&hidraw->wait); | 321 | wake_up_interruptible(&hidraw->wait); |
322 | } | 322 | } |
323 | device_destroy(hidraw_class, | ||
324 | MKDEV(hidraw_major, hidraw->minor)); | ||
323 | } else { | 325 | } else { |
324 | --hidraw->open; | 326 | --hidraw->open; |
325 | } | 327 | } |
326 | if (!hidraw->open) { | 328 | if (!hidraw->open) { |
327 | if (!hidraw->exist) { | 329 | if (!hidraw->exist) { |
328 | device_destroy(hidraw_class, | ||
329 | MKDEV(hidraw_major, hidraw->minor)); | ||
330 | hidraw_table[hidraw->minor] = NULL; | 330 | hidraw_table[hidraw->minor] = NULL; |
331 | kfree(hidraw); | 331 | kfree(hidraw); |
332 | } else { | 332 | } else { |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index f5ed03164d86..de17c5593d97 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -387,7 +387,7 @@ config I2C_CBUS_GPIO | |||
387 | 387 | ||
388 | config I2C_CPM | 388 | config I2C_CPM |
389 | tristate "Freescale CPM1 or CPM2 (MPC8xx/826x)" | 389 | tristate "Freescale CPM1 or CPM2 (MPC8xx/826x)" |
390 | depends on (CPM1 || CPM2) && OF_I2C | 390 | depends on CPM1 || CPM2 |
391 | help | 391 | help |
392 | This supports the use of the I2C interface on Freescale | 392 | This supports the use of the I2C interface on Freescale |
393 | processors with CPM1 or CPM2. | 393 | processors with CPM1 or CPM2. |
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig index 41c64a43bcab..ac2d69e34c8c 100644 --- a/drivers/iio/gyro/Kconfig +++ b/drivers/iio/gyro/Kconfig | |||
@@ -70,7 +70,7 @@ config IIO_ST_GYRO_3AXIS | |||
70 | select IIO_TRIGGERED_BUFFER if (IIO_BUFFER) | 70 | select IIO_TRIGGERED_BUFFER if (IIO_BUFFER) |
71 | help | 71 | help |
72 | Say yes here to build support for STMicroelectronics gyroscopes: | 72 | Say yes here to build support for STMicroelectronics gyroscopes: |
73 | L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330. | 73 | L3G4200D, LSM330DL, L3GD20, LSM330DLC, L3G4IS, LSM330. |
74 | 74 | ||
75 | This driver can also be built as a module. If so, these modules | 75 | This driver can also be built as a module. If so, these modules |
76 | will be created: | 76 | will be created: |
diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h index f8f2bf84a5a2..c197360c450b 100644 --- a/drivers/iio/gyro/st_gyro.h +++ b/drivers/iio/gyro/st_gyro.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" | 19 | #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" |
20 | #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" | 20 | #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" |
21 | #define L3GD20_GYRO_DEV_NAME "l3gd20" | 21 | #define L3GD20_GYRO_DEV_NAME "l3gd20" |
22 | #define L3GD20H_GYRO_DEV_NAME "l3gd20h" | ||
23 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" | 22 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" |
24 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" | 23 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" |
25 | 24 | ||
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index d53d91adfb55..a8e174a47bc4 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c | |||
@@ -167,11 +167,10 @@ static const struct st_sensors st_gyro_sensors[] = { | |||
167 | .wai = ST_GYRO_2_WAI_EXP, | 167 | .wai = ST_GYRO_2_WAI_EXP, |
168 | .sensors_supported = { | 168 | .sensors_supported = { |
169 | [0] = L3GD20_GYRO_DEV_NAME, | 169 | [0] = L3GD20_GYRO_DEV_NAME, |
170 | [1] = L3GD20H_GYRO_DEV_NAME, | 170 | [1] = LSM330D_GYRO_DEV_NAME, |
171 | [2] = LSM330D_GYRO_DEV_NAME, | 171 | [2] = LSM330DLC_GYRO_DEV_NAME, |
172 | [3] = LSM330DLC_GYRO_DEV_NAME, | 172 | [3] = L3G4IS_GYRO_DEV_NAME, |
173 | [4] = L3G4IS_GYRO_DEV_NAME, | 173 | [4] = LSM330_GYRO_DEV_NAME, |
174 | [5] = LSM330_GYRO_DEV_NAME, | ||
175 | }, | 174 | }, |
176 | .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, | 175 | .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, |
177 | .odr = { | 176 | .odr = { |
diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index 16b8b8d70bf1..23c12f361b05 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c | |||
@@ -55,7 +55,6 @@ static const struct i2c_device_id st_gyro_id_table[] = { | |||
55 | { LSM330DL_GYRO_DEV_NAME }, | 55 | { LSM330DL_GYRO_DEV_NAME }, |
56 | { LSM330DLC_GYRO_DEV_NAME }, | 56 | { LSM330DLC_GYRO_DEV_NAME }, |
57 | { L3GD20_GYRO_DEV_NAME }, | 57 | { L3GD20_GYRO_DEV_NAME }, |
58 | { L3GD20H_GYRO_DEV_NAME }, | ||
59 | { L3G4IS_GYRO_DEV_NAME }, | 58 | { L3G4IS_GYRO_DEV_NAME }, |
60 | { LSM330_GYRO_DEV_NAME }, | 59 | { LSM330_GYRO_DEV_NAME }, |
61 | {}, | 60 | {}, |
diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index 94763e25caf9..b4ad3be26687 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c | |||
@@ -54,7 +54,6 @@ static const struct spi_device_id st_gyro_id_table[] = { | |||
54 | { LSM330DL_GYRO_DEV_NAME }, | 54 | { LSM330DL_GYRO_DEV_NAME }, |
55 | { LSM330DLC_GYRO_DEV_NAME }, | 55 | { LSM330DLC_GYRO_DEV_NAME }, |
56 | { L3GD20_GYRO_DEV_NAME }, | 56 | { L3GD20_GYRO_DEV_NAME }, |
57 | { L3GD20H_GYRO_DEV_NAME }, | ||
58 | { L3G4IS_GYRO_DEV_NAME }, | 57 | { L3G4IS_GYRO_DEV_NAME }, |
59 | { LSM330_GYRO_DEV_NAME }, | 58 | { LSM330_GYRO_DEV_NAME }, |
60 | {}, | 59 | {}, |
diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index f17b4e6183c6..47a6dbac2d0c 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c | |||
@@ -103,13 +103,13 @@ static int cm32181_reg_init(struct cm32181_chip *cm32181) | |||
103 | /** | 103 | /** |
104 | * cm32181_read_als_it() - Get sensor integration time (ms) | 104 | * cm32181_read_als_it() - Get sensor integration time (ms) |
105 | * @cm32181: pointer of struct cm32181 | 105 | * @cm32181: pointer of struct cm32181 |
106 | * @val: pointer of int to load the als_it value. | 106 | * @val2: pointer of int to load the als_it value. |
107 | * | 107 | * |
108 | * Report the current integartion time by millisecond. | 108 | * Report the current integartion time by millisecond. |
109 | * | 109 | * |
110 | * Return: IIO_VAL_INT for success, otherwise -EINVAL. | 110 | * Return: IIO_VAL_INT_PLUS_MICRO for success, otherwise -EINVAL. |
111 | */ | 111 | */ |
112 | static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val) | 112 | static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2) |
113 | { | 113 | { |
114 | u16 als_it; | 114 | u16 als_it; |
115 | int i; | 115 | int i; |
@@ -119,8 +119,8 @@ static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val) | |||
119 | als_it >>= CM32181_CMD_ALS_IT_SHIFT; | 119 | als_it >>= CM32181_CMD_ALS_IT_SHIFT; |
120 | for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) { | 120 | for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) { |
121 | if (als_it == als_it_bits[i]) { | 121 | if (als_it == als_it_bits[i]) { |
122 | *val = als_it_value[i]; | 122 | *val2 = als_it_value[i]; |
123 | return IIO_VAL_INT; | 123 | return IIO_VAL_INT_PLUS_MICRO; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
@@ -221,7 +221,7 @@ static int cm32181_read_raw(struct iio_dev *indio_dev, | |||
221 | *val = cm32181->calibscale; | 221 | *val = cm32181->calibscale; |
222 | return IIO_VAL_INT; | 222 | return IIO_VAL_INT; |
223 | case IIO_CHAN_INFO_INT_TIME: | 223 | case IIO_CHAN_INFO_INT_TIME: |
224 | ret = cm32181_read_als_it(cm32181, val); | 224 | ret = cm32181_read_als_it(cm32181, val2); |
225 | return ret; | 225 | return ret; |
226 | } | 226 | } |
227 | 227 | ||
@@ -240,7 +240,7 @@ static int cm32181_write_raw(struct iio_dev *indio_dev, | |||
240 | cm32181->calibscale = val; | 240 | cm32181->calibscale = val; |
241 | return val; | 241 | return val; |
242 | case IIO_CHAN_INFO_INT_TIME: | 242 | case IIO_CHAN_INFO_INT_TIME: |
243 | ret = cm32181_write_als_it(cm32181, val); | 243 | ret = cm32181_write_als_it(cm32181, val2); |
244 | return ret; | 244 | return ret; |
245 | } | 245 | } |
246 | 246 | ||
@@ -264,7 +264,7 @@ static ssize_t cm32181_get_it_available(struct device *dev, | |||
264 | 264 | ||
265 | n = ARRAY_SIZE(als_it_value); | 265 | n = ARRAY_SIZE(als_it_value); |
266 | for (i = 0, len = 0; i < n; i++) | 266 | for (i = 0, len = 0; i < n; i++) |
267 | len += sprintf(buf + len, "%d ", als_it_value[i]); | 267 | len += sprintf(buf + len, "0.%06u ", als_it_value[i]); |
268 | return len + sprintf(buf + len, "\n"); | 268 | return len + sprintf(buf + len, "\n"); |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index 0a142af83e25..a45e07492db3 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c | |||
@@ -50,10 +50,10 @@ | |||
50 | #define CM36651_CS_CONF2_DEFAULT_BIT 0x08 | 50 | #define CM36651_CS_CONF2_DEFAULT_BIT 0x08 |
51 | 51 | ||
52 | /* CS_CONF3 channel integration time */ | 52 | /* CS_CONF3 channel integration time */ |
53 | #define CM36651_CS_IT1 0x00 /* Integration time 80000 usec */ | 53 | #define CM36651_CS_IT1 0x00 /* Integration time 80 msec */ |
54 | #define CM36651_CS_IT2 0x40 /* Integration time 160000 usec */ | 54 | #define CM36651_CS_IT2 0x40 /* Integration time 160 msec */ |
55 | #define CM36651_CS_IT3 0x80 /* Integration time 320000 usec */ | 55 | #define CM36651_CS_IT3 0x80 /* Integration time 320 msec */ |
56 | #define CM36651_CS_IT4 0xC0 /* Integration time 640000 usec */ | 56 | #define CM36651_CS_IT4 0xC0 /* Integration time 640 msec */ |
57 | 57 | ||
58 | /* PS_CONF1 command code */ | 58 | /* PS_CONF1 command code */ |
59 | #define CM36651_PS_ENABLE 0x00 | 59 | #define CM36651_PS_ENABLE 0x00 |
@@ -64,10 +64,10 @@ | |||
64 | #define CM36651_PS_PERS4 0x0C | 64 | #define CM36651_PS_PERS4 0x0C |
65 | 65 | ||
66 | /* PS_CONF1 command code: integration time */ | 66 | /* PS_CONF1 command code: integration time */ |
67 | #define CM36651_PS_IT1 0x00 /* Integration time 320 usec */ | 67 | #define CM36651_PS_IT1 0x00 /* Integration time 0.32 msec */ |
68 | #define CM36651_PS_IT2 0x10 /* Integration time 420 usec */ | 68 | #define CM36651_PS_IT2 0x10 /* Integration time 0.42 msec */ |
69 | #define CM36651_PS_IT3 0x20 /* Integration time 520 usec */ | 69 | #define CM36651_PS_IT3 0x20 /* Integration time 0.52 msec */ |
70 | #define CM36651_PS_IT4 0x30 /* Integration time 640 usec */ | 70 | #define CM36651_PS_IT4 0x30 /* Integration time 0.64 msec */ |
71 | 71 | ||
72 | /* PS_CONF1 command code: duty ratio */ | 72 | /* PS_CONF1 command code: duty ratio */ |
73 | #define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */ | 73 | #define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */ |
@@ -93,8 +93,8 @@ | |||
93 | #define CM36651_CLOSE_PROXIMITY 0x32 | 93 | #define CM36651_CLOSE_PROXIMITY 0x32 |
94 | #define CM36651_FAR_PROXIMITY 0x33 | 94 | #define CM36651_FAR_PROXIMITY 0x33 |
95 | 95 | ||
96 | #define CM36651_CS_INT_TIME_AVAIL "80000 160000 320000 640000" | 96 | #define CM36651_CS_INT_TIME_AVAIL "0.08 0.16 0.32 0.64" |
97 | #define CM36651_PS_INT_TIME_AVAIL "320 420 520 640" | 97 | #define CM36651_PS_INT_TIME_AVAIL "0.000320 0.000420 0.000520 0.000640" |
98 | 98 | ||
99 | enum cm36651_operation_mode { | 99 | enum cm36651_operation_mode { |
100 | CM36651_LIGHT_EN, | 100 | CM36651_LIGHT_EN, |
@@ -356,30 +356,30 @@ static int cm36651_read_channel(struct cm36651_data *cm36651, | |||
356 | } | 356 | } |
357 | 357 | ||
358 | static int cm36651_read_int_time(struct cm36651_data *cm36651, | 358 | static int cm36651_read_int_time(struct cm36651_data *cm36651, |
359 | struct iio_chan_spec const *chan, int *val) | 359 | struct iio_chan_spec const *chan, int *val2) |
360 | { | 360 | { |
361 | switch (chan->type) { | 361 | switch (chan->type) { |
362 | case IIO_LIGHT: | 362 | case IIO_LIGHT: |
363 | if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1) | 363 | if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1) |
364 | *val = 80000; | 364 | *val2 = 80000; |
365 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2) | 365 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2) |
366 | *val = 160000; | 366 | *val2 = 160000; |
367 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3) | 367 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3) |
368 | *val = 320000; | 368 | *val2 = 320000; |
369 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4) | 369 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4) |
370 | *val = 640000; | 370 | *val2 = 640000; |
371 | else | 371 | else |
372 | return -EINVAL; | 372 | return -EINVAL; |
373 | break; | 373 | break; |
374 | case IIO_PROXIMITY: | 374 | case IIO_PROXIMITY: |
375 | if (cm36651->ps_int_time == CM36651_PS_IT1) | 375 | if (cm36651->ps_int_time == CM36651_PS_IT1) |
376 | *val = 320; | 376 | *val2 = 320; |
377 | else if (cm36651->ps_int_time == CM36651_PS_IT2) | 377 | else if (cm36651->ps_int_time == CM36651_PS_IT2) |
378 | *val = 420; | 378 | *val2 = 420; |
379 | else if (cm36651->ps_int_time == CM36651_PS_IT3) | 379 | else if (cm36651->ps_int_time == CM36651_PS_IT3) |
380 | *val = 520; | 380 | *val2 = 520; |
381 | else if (cm36651->ps_int_time == CM36651_PS_IT4) | 381 | else if (cm36651->ps_int_time == CM36651_PS_IT4) |
382 | *val = 640; | 382 | *val2 = 640; |
383 | else | 383 | else |
384 | return -EINVAL; | 384 | return -EINVAL; |
385 | break; | 385 | break; |
@@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651, | |||
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | 389 | ||
390 | return IIO_VAL_INT; | 390 | return IIO_VAL_INT_PLUS_MICRO; |
391 | } | 391 | } |
392 | 392 | ||
393 | static int cm36651_write_int_time(struct cm36651_data *cm36651, | 393 | static int cm36651_write_int_time(struct cm36651_data *cm36651, |
@@ -459,7 +459,8 @@ static int cm36651_read_raw(struct iio_dev *indio_dev, | |||
459 | ret = cm36651_read_channel(cm36651, chan, val); | 459 | ret = cm36651_read_channel(cm36651, chan, val); |
460 | break; | 460 | break; |
461 | case IIO_CHAN_INFO_INT_TIME: | 461 | case IIO_CHAN_INFO_INT_TIME: |
462 | ret = cm36651_read_int_time(cm36651, chan, val); | 462 | *val = 0; |
463 | ret = cm36651_read_int_time(cm36651, chan, val2); | ||
463 | break; | 464 | break; |
464 | default: | 465 | default: |
465 | ret = -EINVAL; | 466 | ret = -EINVAL; |
@@ -479,7 +480,7 @@ static int cm36651_write_raw(struct iio_dev *indio_dev, | |||
479 | int ret = -EINVAL; | 480 | int ret = -EINVAL; |
480 | 481 | ||
481 | if (mask == IIO_CHAN_INFO_INT_TIME) { | 482 | if (mask == IIO_CHAN_INFO_INT_TIME) { |
482 | ret = cm36651_write_int_time(cm36651, chan, val); | 483 | ret = cm36651_write_int_time(cm36651, chan, val2); |
483 | if (ret < 0) | 484 | if (ret < 0) |
484 | dev_err(&client->dev, "Integration time write failed\n"); | 485 | dev_err(&client->dev, "Integration time write failed\n"); |
485 | } | 486 | } |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index e81c5547e647..f9c12e92fdd6 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -53,8 +53,8 @@ | |||
53 | #include "user.h" | 53 | #include "user.h" |
54 | 54 | ||
55 | #define DRV_NAME MLX4_IB_DRV_NAME | 55 | #define DRV_NAME MLX4_IB_DRV_NAME |
56 | #define DRV_VERSION "1.0" | 56 | #define DRV_VERSION "2.2-1" |
57 | #define DRV_RELDATE "April 4, 2008" | 57 | #define DRV_RELDATE "Feb 2014" |
58 | 58 | ||
59 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF | 59 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF |
60 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF | 60 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index aa03e732b6a8..bf900579ac08 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include "mlx5_ib.h" | 46 | #include "mlx5_ib.h" |
47 | 47 | ||
48 | #define DRIVER_NAME "mlx5_ib" | 48 | #define DRIVER_NAME "mlx5_ib" |
49 | #define DRIVER_VERSION "1.0" | 49 | #define DRIVER_VERSION "2.2-1" |
50 | #define DRIVER_RELDATE "June 2013" | 50 | #define DRIVER_RELDATE "Feb 2014" |
51 | 51 | ||
52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); | 52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); |
53 | MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); | 53 | MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index d18d08a076e8..8ee228e9ab5a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -492,12 +492,11 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
492 | isert_conn->state = ISER_CONN_INIT; | 492 | isert_conn->state = ISER_CONN_INIT; |
493 | INIT_LIST_HEAD(&isert_conn->conn_accept_node); | 493 | INIT_LIST_HEAD(&isert_conn->conn_accept_node); |
494 | init_completion(&isert_conn->conn_login_comp); | 494 | init_completion(&isert_conn->conn_login_comp); |
495 | init_waitqueue_head(&isert_conn->conn_wait); | 495 | init_completion(&isert_conn->conn_wait); |
496 | init_waitqueue_head(&isert_conn->conn_wait_comp_err); | 496 | init_completion(&isert_conn->conn_wait_comp_err); |
497 | kref_init(&isert_conn->conn_kref); | 497 | kref_init(&isert_conn->conn_kref); |
498 | kref_get(&isert_conn->conn_kref); | 498 | kref_get(&isert_conn->conn_kref); |
499 | mutex_init(&isert_conn->conn_mutex); | 499 | mutex_init(&isert_conn->conn_mutex); |
500 | mutex_init(&isert_conn->conn_comp_mutex); | ||
501 | spin_lock_init(&isert_conn->conn_lock); | 500 | spin_lock_init(&isert_conn->conn_lock); |
502 | 501 | ||
503 | cma_id->context = isert_conn; | 502 | cma_id->context = isert_conn; |
@@ -688,11 +687,11 @@ isert_disconnect_work(struct work_struct *work) | |||
688 | 687 | ||
689 | pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); | 688 | pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); |
690 | mutex_lock(&isert_conn->conn_mutex); | 689 | mutex_lock(&isert_conn->conn_mutex); |
691 | isert_conn->state = ISER_CONN_DOWN; | 690 | if (isert_conn->state == ISER_CONN_UP) |
691 | isert_conn->state = ISER_CONN_TERMINATING; | ||
692 | 692 | ||
693 | if (isert_conn->post_recv_buf_count == 0 && | 693 | if (isert_conn->post_recv_buf_count == 0 && |
694 | atomic_read(&isert_conn->post_send_buf_count) == 0) { | 694 | atomic_read(&isert_conn->post_send_buf_count) == 0) { |
695 | pr_debug("Calling wake_up(&isert_conn->conn_wait);\n"); | ||
696 | mutex_unlock(&isert_conn->conn_mutex); | 695 | mutex_unlock(&isert_conn->conn_mutex); |
697 | goto wake_up; | 696 | goto wake_up; |
698 | } | 697 | } |
@@ -712,7 +711,7 @@ isert_disconnect_work(struct work_struct *work) | |||
712 | mutex_unlock(&isert_conn->conn_mutex); | 711 | mutex_unlock(&isert_conn->conn_mutex); |
713 | 712 | ||
714 | wake_up: | 713 | wake_up: |
715 | wake_up(&isert_conn->conn_wait); | 714 | complete(&isert_conn->conn_wait); |
716 | isert_put_conn(isert_conn); | 715 | isert_put_conn(isert_conn); |
717 | } | 716 | } |
718 | 717 | ||
@@ -888,16 +887,17 @@ isert_init_send_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, | |||
888 | * Coalesce send completion interrupts by only setting IB_SEND_SIGNALED | 887 | * Coalesce send completion interrupts by only setting IB_SEND_SIGNALED |
889 | * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. | 888 | * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. |
890 | */ | 889 | */ |
891 | mutex_lock(&isert_conn->conn_comp_mutex); | 890 | mutex_lock(&isert_conn->conn_mutex); |
892 | if (coalesce && | 891 | if (coalesce && isert_conn->state == ISER_CONN_UP && |
893 | ++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) { | 892 | ++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) { |
893 | tx_desc->llnode_active = true; | ||
894 | llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist); | 894 | llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist); |
895 | mutex_unlock(&isert_conn->conn_comp_mutex); | 895 | mutex_unlock(&isert_conn->conn_mutex); |
896 | return; | 896 | return; |
897 | } | 897 | } |
898 | isert_conn->conn_comp_batch = 0; | 898 | isert_conn->conn_comp_batch = 0; |
899 | tx_desc->comp_llnode_batch = llist_del_all(&isert_conn->conn_comp_llist); | 899 | tx_desc->comp_llnode_batch = llist_del_all(&isert_conn->conn_comp_llist); |
900 | mutex_unlock(&isert_conn->conn_comp_mutex); | 900 | mutex_unlock(&isert_conn->conn_mutex); |
901 | 901 | ||
902 | send_wr->send_flags = IB_SEND_SIGNALED; | 902 | send_wr->send_flags = IB_SEND_SIGNALED; |
903 | } | 903 | } |
@@ -1464,7 +1464,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1464 | case ISCSI_OP_SCSI_CMD: | 1464 | case ISCSI_OP_SCSI_CMD: |
1465 | spin_lock_bh(&conn->cmd_lock); | 1465 | spin_lock_bh(&conn->cmd_lock); |
1466 | if (!list_empty(&cmd->i_conn_node)) | 1466 | if (!list_empty(&cmd->i_conn_node)) |
1467 | list_del(&cmd->i_conn_node); | 1467 | list_del_init(&cmd->i_conn_node); |
1468 | spin_unlock_bh(&conn->cmd_lock); | 1468 | spin_unlock_bh(&conn->cmd_lock); |
1469 | 1469 | ||
1470 | if (cmd->data_direction == DMA_TO_DEVICE) | 1470 | if (cmd->data_direction == DMA_TO_DEVICE) |
@@ -1476,7 +1476,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1476 | case ISCSI_OP_SCSI_TMFUNC: | 1476 | case ISCSI_OP_SCSI_TMFUNC: |
1477 | spin_lock_bh(&conn->cmd_lock); | 1477 | spin_lock_bh(&conn->cmd_lock); |
1478 | if (!list_empty(&cmd->i_conn_node)) | 1478 | if (!list_empty(&cmd->i_conn_node)) |
1479 | list_del(&cmd->i_conn_node); | 1479 | list_del_init(&cmd->i_conn_node); |
1480 | spin_unlock_bh(&conn->cmd_lock); | 1480 | spin_unlock_bh(&conn->cmd_lock); |
1481 | 1481 | ||
1482 | transport_generic_free_cmd(&cmd->se_cmd, 0); | 1482 | transport_generic_free_cmd(&cmd->se_cmd, 0); |
@@ -1486,7 +1486,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1486 | case ISCSI_OP_TEXT: | 1486 | case ISCSI_OP_TEXT: |
1487 | spin_lock_bh(&conn->cmd_lock); | 1487 | spin_lock_bh(&conn->cmd_lock); |
1488 | if (!list_empty(&cmd->i_conn_node)) | 1488 | if (!list_empty(&cmd->i_conn_node)) |
1489 | list_del(&cmd->i_conn_node); | 1489 | list_del_init(&cmd->i_conn_node); |
1490 | spin_unlock_bh(&conn->cmd_lock); | 1490 | spin_unlock_bh(&conn->cmd_lock); |
1491 | 1491 | ||
1492 | /* | 1492 | /* |
@@ -1549,6 +1549,7 @@ isert_completion_rdma_read(struct iser_tx_desc *tx_desc, | |||
1549 | iscsit_stop_dataout_timer(cmd); | 1549 | iscsit_stop_dataout_timer(cmd); |
1550 | device->unreg_rdma_mem(isert_cmd, isert_conn); | 1550 | device->unreg_rdma_mem(isert_cmd, isert_conn); |
1551 | cmd->write_data_done = wr->cur_rdma_length; | 1551 | cmd->write_data_done = wr->cur_rdma_length; |
1552 | wr->send_wr_num = 0; | ||
1552 | 1553 | ||
1553 | pr_debug("Cmd: %p RDMA_READ comp calling execute_cmd\n", isert_cmd); | 1554 | pr_debug("Cmd: %p RDMA_READ comp calling execute_cmd\n", isert_cmd); |
1554 | spin_lock_bh(&cmd->istate_lock); | 1555 | spin_lock_bh(&cmd->istate_lock); |
@@ -1589,7 +1590,7 @@ isert_do_control_comp(struct work_struct *work) | |||
1589 | pr_debug("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n"); | 1590 | pr_debug("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n"); |
1590 | /* | 1591 | /* |
1591 | * Call atomic_dec(&isert_conn->post_send_buf_count) | 1592 | * Call atomic_dec(&isert_conn->post_send_buf_count) |
1592 | * from isert_free_conn() | 1593 | * from isert_wait_conn() |
1593 | */ | 1594 | */ |
1594 | isert_conn->logout_posted = true; | 1595 | isert_conn->logout_posted = true; |
1595 | iscsit_logout_post_handler(cmd, cmd->conn); | 1596 | iscsit_logout_post_handler(cmd, cmd->conn); |
@@ -1613,6 +1614,7 @@ isert_response_completion(struct iser_tx_desc *tx_desc, | |||
1613 | struct ib_device *ib_dev) | 1614 | struct ib_device *ib_dev) |
1614 | { | 1615 | { |
1615 | struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; | 1616 | struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; |
1617 | struct isert_rdma_wr *wr = &isert_cmd->rdma_wr; | ||
1616 | 1618 | ||
1617 | if (cmd->i_state == ISTATE_SEND_TASKMGTRSP || | 1619 | if (cmd->i_state == ISTATE_SEND_TASKMGTRSP || |
1618 | cmd->i_state == ISTATE_SEND_LOGOUTRSP || | 1620 | cmd->i_state == ISTATE_SEND_LOGOUTRSP || |
@@ -1624,7 +1626,7 @@ isert_response_completion(struct iser_tx_desc *tx_desc, | |||
1624 | queue_work(isert_comp_wq, &isert_cmd->comp_work); | 1626 | queue_work(isert_comp_wq, &isert_cmd->comp_work); |
1625 | return; | 1627 | return; |
1626 | } | 1628 | } |
1627 | atomic_dec(&isert_conn->post_send_buf_count); | 1629 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
1628 | 1630 | ||
1629 | cmd->i_state = ISTATE_SENT_STATUS; | 1631 | cmd->i_state = ISTATE_SENT_STATUS; |
1630 | isert_completion_put(tx_desc, isert_cmd, ib_dev); | 1632 | isert_completion_put(tx_desc, isert_cmd, ib_dev); |
@@ -1662,7 +1664,7 @@ __isert_send_completion(struct iser_tx_desc *tx_desc, | |||
1662 | case ISER_IB_RDMA_READ: | 1664 | case ISER_IB_RDMA_READ: |
1663 | pr_debug("isert_send_completion: Got ISER_IB_RDMA_READ:\n"); | 1665 | pr_debug("isert_send_completion: Got ISER_IB_RDMA_READ:\n"); |
1664 | 1666 | ||
1665 | atomic_dec(&isert_conn->post_send_buf_count); | 1667 | atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count); |
1666 | isert_completion_rdma_read(tx_desc, isert_cmd); | 1668 | isert_completion_rdma_read(tx_desc, isert_cmd); |
1667 | break; | 1669 | break; |
1668 | default: | 1670 | default: |
@@ -1691,31 +1693,76 @@ isert_send_completion(struct iser_tx_desc *tx_desc, | |||
1691 | } | 1693 | } |
1692 | 1694 | ||
1693 | static void | 1695 | static void |
1694 | isert_cq_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) | 1696 | isert_cq_drain_comp_llist(struct isert_conn *isert_conn, struct ib_device *ib_dev) |
1697 | { | ||
1698 | struct llist_node *llnode; | ||
1699 | struct isert_rdma_wr *wr; | ||
1700 | struct iser_tx_desc *t; | ||
1701 | |||
1702 | mutex_lock(&isert_conn->conn_mutex); | ||
1703 | llnode = llist_del_all(&isert_conn->conn_comp_llist); | ||
1704 | isert_conn->conn_comp_batch = 0; | ||
1705 | mutex_unlock(&isert_conn->conn_mutex); | ||
1706 | |||
1707 | while (llnode) { | ||
1708 | t = llist_entry(llnode, struct iser_tx_desc, comp_llnode); | ||
1709 | llnode = llist_next(llnode); | ||
1710 | wr = &t->isert_cmd->rdma_wr; | ||
1711 | |||
1712 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); | ||
1713 | isert_completion_put(t, t->isert_cmd, ib_dev); | ||
1714 | } | ||
1715 | } | ||
1716 | |||
1717 | static void | ||
1718 | isert_cq_tx_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) | ||
1695 | { | 1719 | { |
1696 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 1720 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; |
1721 | struct isert_cmd *isert_cmd = tx_desc->isert_cmd; | ||
1722 | struct llist_node *llnode = tx_desc->comp_llnode_batch; | ||
1723 | struct isert_rdma_wr *wr; | ||
1724 | struct iser_tx_desc *t; | ||
1697 | 1725 | ||
1698 | if (tx_desc) { | 1726 | while (llnode) { |
1699 | struct isert_cmd *isert_cmd = tx_desc->isert_cmd; | 1727 | t = llist_entry(llnode, struct iser_tx_desc, comp_llnode); |
1728 | llnode = llist_next(llnode); | ||
1729 | wr = &t->isert_cmd->rdma_wr; | ||
1700 | 1730 | ||
1701 | if (!isert_cmd) | 1731 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
1702 | isert_unmap_tx_desc(tx_desc, ib_dev); | 1732 | isert_completion_put(t, t->isert_cmd, ib_dev); |
1703 | else | ||
1704 | isert_completion_put(tx_desc, isert_cmd, ib_dev); | ||
1705 | } | 1733 | } |
1734 | tx_desc->comp_llnode_batch = NULL; | ||
1706 | 1735 | ||
1707 | if (isert_conn->post_recv_buf_count == 0 && | 1736 | if (!isert_cmd) |
1708 | atomic_read(&isert_conn->post_send_buf_count) == 0) { | 1737 | isert_unmap_tx_desc(tx_desc, ib_dev); |
1709 | pr_debug("isert_cq_comp_err >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); | 1738 | else |
1710 | pr_debug("Calling wake_up from isert_cq_comp_err\n"); | 1739 | isert_completion_put(tx_desc, isert_cmd, ib_dev); |
1740 | } | ||
1711 | 1741 | ||
1712 | mutex_lock(&isert_conn->conn_mutex); | 1742 | static void |
1713 | if (isert_conn->state != ISER_CONN_DOWN) | 1743 | isert_cq_rx_comp_err(struct isert_conn *isert_conn) |
1714 | isert_conn->state = ISER_CONN_TERMINATING; | 1744 | { |
1715 | mutex_unlock(&isert_conn->conn_mutex); | 1745 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; |
1746 | struct iscsi_conn *conn = isert_conn->conn; | ||
1716 | 1747 | ||
1717 | wake_up(&isert_conn->conn_wait_comp_err); | 1748 | if (isert_conn->post_recv_buf_count) |
1749 | return; | ||
1750 | |||
1751 | isert_cq_drain_comp_llist(isert_conn, ib_dev); | ||
1752 | |||
1753 | if (conn->sess) { | ||
1754 | target_sess_cmd_list_set_waiting(conn->sess->se_sess); | ||
1755 | target_wait_for_sess_cmds(conn->sess->se_sess); | ||
1718 | } | 1756 | } |
1757 | |||
1758 | while (atomic_read(&isert_conn->post_send_buf_count)) | ||
1759 | msleep(3000); | ||
1760 | |||
1761 | mutex_lock(&isert_conn->conn_mutex); | ||
1762 | isert_conn->state = ISER_CONN_DOWN; | ||
1763 | mutex_unlock(&isert_conn->conn_mutex); | ||
1764 | |||
1765 | complete(&isert_conn->conn_wait_comp_err); | ||
1719 | } | 1766 | } |
1720 | 1767 | ||
1721 | static void | 1768 | static void |
@@ -1740,8 +1787,14 @@ isert_cq_tx_work(struct work_struct *work) | |||
1740 | pr_debug("TX wc.status != IB_WC_SUCCESS >>>>>>>>>>>>>>\n"); | 1787 | pr_debug("TX wc.status != IB_WC_SUCCESS >>>>>>>>>>>>>>\n"); |
1741 | pr_debug("TX wc.status: 0x%08x\n", wc.status); | 1788 | pr_debug("TX wc.status: 0x%08x\n", wc.status); |
1742 | pr_debug("TX wc.vendor_err: 0x%08x\n", wc.vendor_err); | 1789 | pr_debug("TX wc.vendor_err: 0x%08x\n", wc.vendor_err); |
1743 | atomic_dec(&isert_conn->post_send_buf_count); | 1790 | |
1744 | isert_cq_comp_err(tx_desc, isert_conn); | 1791 | if (wc.wr_id != ISER_FASTREG_LI_WRID) { |
1792 | if (tx_desc->llnode_active) | ||
1793 | continue; | ||
1794 | |||
1795 | atomic_dec(&isert_conn->post_send_buf_count); | ||
1796 | isert_cq_tx_comp_err(tx_desc, isert_conn); | ||
1797 | } | ||
1745 | } | 1798 | } |
1746 | } | 1799 | } |
1747 | 1800 | ||
@@ -1784,7 +1837,7 @@ isert_cq_rx_work(struct work_struct *work) | |||
1784 | wc.vendor_err); | 1837 | wc.vendor_err); |
1785 | } | 1838 | } |
1786 | isert_conn->post_recv_buf_count--; | 1839 | isert_conn->post_recv_buf_count--; |
1787 | isert_cq_comp_err(NULL, isert_conn); | 1840 | isert_cq_rx_comp_err(isert_conn); |
1788 | } | 1841 | } |
1789 | } | 1842 | } |
1790 | 1843 | ||
@@ -2202,6 +2255,7 @@ isert_fast_reg_mr(struct fast_reg_descriptor *fr_desc, | |||
2202 | 2255 | ||
2203 | if (!fr_desc->valid) { | 2256 | if (!fr_desc->valid) { |
2204 | memset(&inv_wr, 0, sizeof(inv_wr)); | 2257 | memset(&inv_wr, 0, sizeof(inv_wr)); |
2258 | inv_wr.wr_id = ISER_FASTREG_LI_WRID; | ||
2205 | inv_wr.opcode = IB_WR_LOCAL_INV; | 2259 | inv_wr.opcode = IB_WR_LOCAL_INV; |
2206 | inv_wr.ex.invalidate_rkey = fr_desc->data_mr->rkey; | 2260 | inv_wr.ex.invalidate_rkey = fr_desc->data_mr->rkey; |
2207 | wr = &inv_wr; | 2261 | wr = &inv_wr; |
@@ -2212,6 +2266,7 @@ isert_fast_reg_mr(struct fast_reg_descriptor *fr_desc, | |||
2212 | 2266 | ||
2213 | /* Prepare FASTREG WR */ | 2267 | /* Prepare FASTREG WR */ |
2214 | memset(&fr_wr, 0, sizeof(fr_wr)); | 2268 | memset(&fr_wr, 0, sizeof(fr_wr)); |
2269 | fr_wr.wr_id = ISER_FASTREG_LI_WRID; | ||
2215 | fr_wr.opcode = IB_WR_FAST_REG_MR; | 2270 | fr_wr.opcode = IB_WR_FAST_REG_MR; |
2216 | fr_wr.wr.fast_reg.iova_start = | 2271 | fr_wr.wr.fast_reg.iova_start = |
2217 | fr_desc->data_frpl->page_list[0] + page_off; | 2272 | fr_desc->data_frpl->page_list[0] + page_off; |
@@ -2377,12 +2432,12 @@ isert_put_datain(struct iscsi_conn *conn, struct iscsi_cmd *cmd) | |||
2377 | isert_init_send_wr(isert_conn, isert_cmd, | 2432 | isert_init_send_wr(isert_conn, isert_cmd, |
2378 | &isert_cmd->tx_desc.send_wr, true); | 2433 | &isert_cmd->tx_desc.send_wr, true); |
2379 | 2434 | ||
2380 | atomic_inc(&isert_conn->post_send_buf_count); | 2435 | atomic_add(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
2381 | 2436 | ||
2382 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); | 2437 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); |
2383 | if (rc) { | 2438 | if (rc) { |
2384 | pr_warn("ib_post_send() failed for IB_WR_RDMA_WRITE\n"); | 2439 | pr_warn("ib_post_send() failed for IB_WR_RDMA_WRITE\n"); |
2385 | atomic_dec(&isert_conn->post_send_buf_count); | 2440 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
2386 | } | 2441 | } |
2387 | pr_debug("Cmd: %p posted RDMA_WRITE + Response for iSER Data READ\n", | 2442 | pr_debug("Cmd: %p posted RDMA_WRITE + Response for iSER Data READ\n", |
2388 | isert_cmd); | 2443 | isert_cmd); |
@@ -2410,12 +2465,12 @@ isert_get_dataout(struct iscsi_conn *conn, struct iscsi_cmd *cmd, bool recovery) | |||
2410 | return rc; | 2465 | return rc; |
2411 | } | 2466 | } |
2412 | 2467 | ||
2413 | atomic_inc(&isert_conn->post_send_buf_count); | 2468 | atomic_add(wr->send_wr_num, &isert_conn->post_send_buf_count); |
2414 | 2469 | ||
2415 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); | 2470 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); |
2416 | if (rc) { | 2471 | if (rc) { |
2417 | pr_warn("ib_post_send() failed for IB_WR_RDMA_READ\n"); | 2472 | pr_warn("ib_post_send() failed for IB_WR_RDMA_READ\n"); |
2418 | atomic_dec(&isert_conn->post_send_buf_count); | 2473 | atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count); |
2419 | } | 2474 | } |
2420 | pr_debug("Cmd: %p posted RDMA_READ memory for ISER Data WRITE\n", | 2475 | pr_debug("Cmd: %p posted RDMA_READ memory for ISER Data WRITE\n", |
2421 | isert_cmd); | 2476 | isert_cmd); |
@@ -2702,22 +2757,11 @@ isert_free_np(struct iscsi_np *np) | |||
2702 | kfree(isert_np); | 2757 | kfree(isert_np); |
2703 | } | 2758 | } |
2704 | 2759 | ||
2705 | static int isert_check_state(struct isert_conn *isert_conn, int state) | 2760 | static void isert_wait_conn(struct iscsi_conn *conn) |
2706 | { | ||
2707 | int ret; | ||
2708 | |||
2709 | mutex_lock(&isert_conn->conn_mutex); | ||
2710 | ret = (isert_conn->state == state); | ||
2711 | mutex_unlock(&isert_conn->conn_mutex); | ||
2712 | |||
2713 | return ret; | ||
2714 | } | ||
2715 | |||
2716 | static void isert_free_conn(struct iscsi_conn *conn) | ||
2717 | { | 2761 | { |
2718 | struct isert_conn *isert_conn = conn->context; | 2762 | struct isert_conn *isert_conn = conn->context; |
2719 | 2763 | ||
2720 | pr_debug("isert_free_conn: Starting \n"); | 2764 | pr_debug("isert_wait_conn: Starting \n"); |
2721 | /* | 2765 | /* |
2722 | * Decrement post_send_buf_count for special case when called | 2766 | * Decrement post_send_buf_count for special case when called |
2723 | * from isert_do_control_comp() -> iscsit_logout_post_handler() | 2767 | * from isert_do_control_comp() -> iscsit_logout_post_handler() |
@@ -2727,38 +2771,29 @@ static void isert_free_conn(struct iscsi_conn *conn) | |||
2727 | atomic_dec(&isert_conn->post_send_buf_count); | 2771 | atomic_dec(&isert_conn->post_send_buf_count); |
2728 | 2772 | ||
2729 | if (isert_conn->conn_cm_id && isert_conn->state != ISER_CONN_DOWN) { | 2773 | if (isert_conn->conn_cm_id && isert_conn->state != ISER_CONN_DOWN) { |
2730 | pr_debug("Calling rdma_disconnect from isert_free_conn\n"); | 2774 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); |
2731 | rdma_disconnect(isert_conn->conn_cm_id); | 2775 | rdma_disconnect(isert_conn->conn_cm_id); |
2732 | } | 2776 | } |
2733 | /* | 2777 | /* |
2734 | * Only wait for conn_wait_comp_err if the isert_conn made it | 2778 | * Only wait for conn_wait_comp_err if the isert_conn made it |
2735 | * into full feature phase.. | 2779 | * into full feature phase.. |
2736 | */ | 2780 | */ |
2737 | if (isert_conn->state == ISER_CONN_UP) { | ||
2738 | pr_debug("isert_free_conn: Before wait_event comp_err %d\n", | ||
2739 | isert_conn->state); | ||
2740 | mutex_unlock(&isert_conn->conn_mutex); | ||
2741 | |||
2742 | wait_event(isert_conn->conn_wait_comp_err, | ||
2743 | (isert_check_state(isert_conn, ISER_CONN_TERMINATING))); | ||
2744 | |||
2745 | wait_event(isert_conn->conn_wait, | ||
2746 | (isert_check_state(isert_conn, ISER_CONN_DOWN))); | ||
2747 | |||
2748 | isert_put_conn(isert_conn); | ||
2749 | return; | ||
2750 | } | ||
2751 | if (isert_conn->state == ISER_CONN_INIT) { | 2781 | if (isert_conn->state == ISER_CONN_INIT) { |
2752 | mutex_unlock(&isert_conn->conn_mutex); | 2782 | mutex_unlock(&isert_conn->conn_mutex); |
2753 | isert_put_conn(isert_conn); | ||
2754 | return; | 2783 | return; |
2755 | } | 2784 | } |
2756 | pr_debug("isert_free_conn: wait_event conn_wait %d\n", | 2785 | if (isert_conn->state == ISER_CONN_UP) |
2757 | isert_conn->state); | 2786 | isert_conn->state = ISER_CONN_TERMINATING; |
2758 | mutex_unlock(&isert_conn->conn_mutex); | 2787 | mutex_unlock(&isert_conn->conn_mutex); |
2759 | 2788 | ||
2760 | wait_event(isert_conn->conn_wait, | 2789 | wait_for_completion(&isert_conn->conn_wait_comp_err); |
2761 | (isert_check_state(isert_conn, ISER_CONN_DOWN))); | 2790 | |
2791 | wait_for_completion(&isert_conn->conn_wait); | ||
2792 | } | ||
2793 | |||
2794 | static void isert_free_conn(struct iscsi_conn *conn) | ||
2795 | { | ||
2796 | struct isert_conn *isert_conn = conn->context; | ||
2762 | 2797 | ||
2763 | isert_put_conn(isert_conn); | 2798 | isert_put_conn(isert_conn); |
2764 | } | 2799 | } |
@@ -2771,6 +2806,7 @@ static struct iscsit_transport iser_target_transport = { | |||
2771 | .iscsit_setup_np = isert_setup_np, | 2806 | .iscsit_setup_np = isert_setup_np, |
2772 | .iscsit_accept_np = isert_accept_np, | 2807 | .iscsit_accept_np = isert_accept_np, |
2773 | .iscsit_free_np = isert_free_np, | 2808 | .iscsit_free_np = isert_free_np, |
2809 | .iscsit_wait_conn = isert_wait_conn, | ||
2774 | .iscsit_free_conn = isert_free_conn, | 2810 | .iscsit_free_conn = isert_free_conn, |
2775 | .iscsit_get_login_rx = isert_get_login_rx, | 2811 | .iscsit_get_login_rx = isert_get_login_rx, |
2776 | .iscsit_put_login_tx = isert_put_login_tx, | 2812 | .iscsit_put_login_tx = isert_put_login_tx, |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index 708a069002f3..f6ae7f5dd408 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #define ISERT_RDMA_LISTEN_BACKLOG 10 | 7 | #define ISERT_RDMA_LISTEN_BACKLOG 10 |
8 | #define ISCSI_ISER_SG_TABLESIZE 256 | 8 | #define ISCSI_ISER_SG_TABLESIZE 256 |
9 | #define ISER_FASTREG_LI_WRID 0xffffffffffffffffULL | ||
9 | 10 | ||
10 | enum isert_desc_type { | 11 | enum isert_desc_type { |
11 | ISCSI_TX_CONTROL, | 12 | ISCSI_TX_CONTROL, |
@@ -45,6 +46,7 @@ struct iser_tx_desc { | |||
45 | struct isert_cmd *isert_cmd; | 46 | struct isert_cmd *isert_cmd; |
46 | struct llist_node *comp_llnode_batch; | 47 | struct llist_node *comp_llnode_batch; |
47 | struct llist_node comp_llnode; | 48 | struct llist_node comp_llnode; |
49 | bool llnode_active; | ||
48 | struct ib_send_wr send_wr; | 50 | struct ib_send_wr send_wr; |
49 | } __packed; | 51 | } __packed; |
50 | 52 | ||
@@ -116,8 +118,8 @@ struct isert_conn { | |||
116 | struct isert_device *conn_device; | 118 | struct isert_device *conn_device; |
117 | struct work_struct conn_logout_work; | 119 | struct work_struct conn_logout_work; |
118 | struct mutex conn_mutex; | 120 | struct mutex conn_mutex; |
119 | wait_queue_head_t conn_wait; | 121 | struct completion conn_wait; |
120 | wait_queue_head_t conn_wait_comp_err; | 122 | struct completion conn_wait_comp_err; |
121 | struct kref conn_kref; | 123 | struct kref conn_kref; |
122 | struct list_head conn_fr_pool; | 124 | struct list_head conn_fr_pool; |
123 | int conn_fr_pool_size; | 125 | int conn_fr_pool_size; |
@@ -126,7 +128,6 @@ struct isert_conn { | |||
126 | #define ISERT_COMP_BATCH_COUNT 8 | 128 | #define ISERT_COMP_BATCH_COUNT 8 |
127 | int conn_comp_batch; | 129 | int conn_comp_batch; |
128 | struct llist_head conn_comp_llist; | 130 | struct llist_head conn_comp_llist; |
129 | struct mutex conn_comp_mutex; | ||
130 | }; | 131 | }; |
131 | 132 | ||
132 | #define ISERT_MAX_CQ 64 | 133 | #define ISERT_MAX_CQ 64 |
diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c index 7a04f54ef961..ef2e281b0a43 100644 --- a/drivers/input/misc/arizona-haptics.c +++ b/drivers/input/misc/arizona-haptics.c | |||
@@ -37,7 +37,6 @@ static void arizona_haptics_work(struct work_struct *work) | |||
37 | struct arizona_haptics, | 37 | struct arizona_haptics, |
38 | work); | 38 | work); |
39 | struct arizona *arizona = haptics->arizona; | 39 | struct arizona *arizona = haptics->arizona; |
40 | struct mutex *dapm_mutex = &arizona->dapm->card->dapm_mutex; | ||
41 | int ret; | 40 | int ret; |
42 | 41 | ||
43 | if (!haptics->arizona->dapm) { | 42 | if (!haptics->arizona->dapm) { |
@@ -67,13 +66,10 @@ static void arizona_haptics_work(struct work_struct *work) | |||
67 | return; | 66 | return; |
68 | } | 67 | } |
69 | 68 | ||
70 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
71 | |||
72 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); | 69 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); |
73 | if (ret != 0) { | 70 | if (ret != 0) { |
74 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", | 71 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", |
75 | ret); | 72 | ret); |
76 | mutex_unlock(dapm_mutex); | ||
77 | return; | 73 | return; |
78 | } | 74 | } |
79 | 75 | ||
@@ -81,21 +77,14 @@ static void arizona_haptics_work(struct work_struct *work) | |||
81 | if (ret != 0) { | 77 | if (ret != 0) { |
82 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 78 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
83 | ret); | 79 | ret); |
84 | mutex_unlock(dapm_mutex); | ||
85 | return; | 80 | return; |
86 | } | 81 | } |
87 | |||
88 | mutex_unlock(dapm_mutex); | ||
89 | |||
90 | } else { | 82 | } else { |
91 | /* This disable sequence will be a noop if already enabled */ | 83 | /* This disable sequence will be a noop if already enabled */ |
92 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
93 | |||
94 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); | 84 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); |
95 | if (ret != 0) { | 85 | if (ret != 0) { |
96 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", | 86 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", |
97 | ret); | 87 | ret); |
98 | mutex_unlock(dapm_mutex); | ||
99 | return; | 88 | return; |
100 | } | 89 | } |
101 | 90 | ||
@@ -103,12 +92,9 @@ static void arizona_haptics_work(struct work_struct *work) | |||
103 | if (ret != 0) { | 92 | if (ret != 0) { |
104 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 93 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
105 | ret); | 94 | ret); |
106 | mutex_unlock(dapm_mutex); | ||
107 | return; | 95 | return; |
108 | } | 96 | } |
109 | 97 | ||
110 | mutex_unlock(dapm_mutex); | ||
111 | |||
112 | ret = regmap_update_bits(arizona->regmap, | 98 | ret = regmap_update_bits(arizona->regmap, |
113 | ARIZONA_HAPTICS_CONTROL_1, | 99 | ARIZONA_HAPTICS_CONTROL_1, |
114 | ARIZONA_HAP_CTRL_MASK, | 100 | ARIZONA_HAP_CTRL_MASK, |
@@ -155,16 +141,11 @@ static int arizona_haptics_play(struct input_dev *input, void *data, | |||
155 | static void arizona_haptics_close(struct input_dev *input) | 141 | static void arizona_haptics_close(struct input_dev *input) |
156 | { | 142 | { |
157 | struct arizona_haptics *haptics = input_get_drvdata(input); | 143 | struct arizona_haptics *haptics = input_get_drvdata(input); |
158 | struct mutex *dapm_mutex = &haptics->arizona->dapm->card->dapm_mutex; | ||
159 | 144 | ||
160 | cancel_work_sync(&haptics->work); | 145 | cancel_work_sync(&haptics->work); |
161 | 146 | ||
162 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
163 | |||
164 | if (haptics->arizona->dapm) | 147 | if (haptics->arizona->dapm) |
165 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); | 148 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); |
166 | |||
167 | mutex_unlock(dapm_mutex); | ||
168 | } | 149 | } |
169 | 150 | ||
170 | static int arizona_haptics_probe(struct platform_device *pdev) | 151 | static int arizona_haptics_probe(struct platform_device *pdev) |
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index d97fbe4fb9b1..80fffba7f12d 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -354,8 +354,8 @@ DEBUG_FOPS(mem); | |||
354 | return -ENOMEM; \ | 354 | return -ENOMEM; \ |
355 | } | 355 | } |
356 | 356 | ||
357 | #define DEBUG_ADD_FILE(name) __DEBUG_ADD_FILE(name, 600) | 357 | #define DEBUG_ADD_FILE(name) __DEBUG_ADD_FILE(name, 0600) |
358 | #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 400) | 358 | #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 0400) |
359 | 359 | ||
360 | static int iommu_debug_register(struct device *dev, void *data) | 360 | static int iommu_debug_register(struct device *dev, void *data) |
361 | { | 361 | { |
diff --git a/drivers/irqchip/irq-metag-ext.c b/drivers/irqchip/irq-metag-ext.c index 92c41ab4dbfd..2cb474ad8809 100644 --- a/drivers/irqchip/irq-metag-ext.c +++ b/drivers/irqchip/irq-metag-ext.c | |||
@@ -515,7 +515,7 @@ static int meta_intc_set_affinity(struct irq_data *data, | |||
515 | * one cpu (the interrupt code doesn't support it), so we just | 515 | * one cpu (the interrupt code doesn't support it), so we just |
516 | * pick the first cpu we find in 'cpumask'. | 516 | * pick the first cpu we find in 'cpumask'. |
517 | */ | 517 | */ |
518 | cpu = cpumask_any(cpumask); | 518 | cpu = cpumask_any_and(cpumask, cpu_online_mask); |
519 | thread = cpu_2_hwthread_id[cpu]; | 519 | thread = cpu_2_hwthread_id[cpu]; |
520 | 520 | ||
521 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); | 521 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); |
diff --git a/drivers/irqchip/irq-metag.c b/drivers/irqchip/irq-metag.c index 8e94d7a3b20d..c16c186d97d3 100644 --- a/drivers/irqchip/irq-metag.c +++ b/drivers/irqchip/irq-metag.c | |||
@@ -201,7 +201,7 @@ static int metag_internal_irq_set_affinity(struct irq_data *data, | |||
201 | * one cpu (the interrupt code doesn't support it), so we just | 201 | * one cpu (the interrupt code doesn't support it), so we just |
202 | * pick the first cpu we find in 'cpumask'. | 202 | * pick the first cpu we find in 'cpumask'. |
203 | */ | 203 | */ |
204 | cpu = cpumask_any(cpumask); | 204 | cpu = cpumask_any_and(cpumask, cpu_online_mask); |
205 | thread = cpu_2_hwthread_id[cpu]; | 205 | thread = cpu_2_hwthread_id[cpu]; |
206 | 206 | ||
207 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), | 207 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), |
diff --git a/drivers/isdn/capi/Kconfig b/drivers/isdn/capi/Kconfig index f04686580040..9816c51eb5c2 100644 --- a/drivers/isdn/capi/Kconfig +++ b/drivers/isdn/capi/Kconfig | |||
@@ -16,9 +16,17 @@ config CAPI_TRACE | |||
16 | This will increase the size of the kernelcapi module by 20 KB. | 16 | This will increase the size of the kernelcapi module by 20 KB. |
17 | If unsure, say Y. | 17 | If unsure, say Y. |
18 | 18 | ||
19 | config ISDN_CAPI_CAPI20 | ||
20 | tristate "CAPI2.0 /dev/capi support" | ||
21 | help | ||
22 | This option will provide the CAPI 2.0 interface to userspace | ||
23 | applications via /dev/capi20. Applications should use the | ||
24 | standardized libcapi20 to access this functionality. You should say | ||
25 | Y/M here. | ||
26 | |||
19 | config ISDN_CAPI_MIDDLEWARE | 27 | config ISDN_CAPI_MIDDLEWARE |
20 | bool "CAPI2.0 Middleware support" | 28 | bool "CAPI2.0 Middleware support" |
21 | depends on TTY | 29 | depends on ISDN_CAPI_CAPI20 && TTY |
22 | help | 30 | help |
23 | This option will enhance the capabilities of the /dev/capi20 | 31 | This option will enhance the capabilities of the /dev/capi20 |
24 | interface. It will provide a means of moving a data connection, | 32 | interface. It will provide a means of moving a data connection, |
@@ -26,14 +34,6 @@ config ISDN_CAPI_MIDDLEWARE | |||
26 | device. If you want to use pppd with pppdcapiplugin to dial up to | 34 | device. If you want to use pppd with pppdcapiplugin to dial up to |
27 | your ISP, say Y here. | 35 | your ISP, say Y here. |
28 | 36 | ||
29 | config ISDN_CAPI_CAPI20 | ||
30 | tristate "CAPI2.0 /dev/capi support" | ||
31 | help | ||
32 | This option will provide the CAPI 2.0 interface to userspace | ||
33 | applications via /dev/capi20. Applications should use the | ||
34 | standardized libcapi20 to access this functionality. You should say | ||
35 | Y/M here. | ||
36 | |||
37 | config ISDN_CAPI_CAPIDRV | 37 | config ISDN_CAPI_CAPIDRV |
38 | tristate "CAPI2.0 capidrv interface support" | 38 | tristate "CAPI2.0 capidrv interface support" |
39 | depends on ISDN_I4L | 39 | depends on ISDN_I4L |
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index 9a06fe883766..95ad936e6048 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig | |||
@@ -254,16 +254,6 @@ config DM_THIN_PROVISIONING | |||
254 | ---help--- | 254 | ---help--- |
255 | Provides thin provisioning and snapshots that share a data store. | 255 | Provides thin provisioning and snapshots that share a data store. |
256 | 256 | ||
257 | config DM_DEBUG_BLOCK_STACK_TRACING | ||
258 | boolean "Keep stack trace of persistent data block lock holders" | ||
259 | depends on STACKTRACE_SUPPORT && DM_PERSISTENT_DATA | ||
260 | select STACKTRACE | ||
261 | ---help--- | ||
262 | Enable this for messages that may help debug problems with the | ||
263 | block manager locking used by thin provisioning and caching. | ||
264 | |||
265 | If unsure, say N. | ||
266 | |||
267 | config DM_CACHE | 257 | config DM_CACHE |
268 | tristate "Cache target (EXPERIMENTAL)" | 258 | tristate "Cache target (EXPERIMENTAL)" |
269 | depends on BLK_DEV_DM | 259 | depends on BLK_DEV_DM |
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index 1e018e986610..0e385e40909e 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
@@ -872,7 +872,7 @@ static void mq_destroy(struct dm_cache_policy *p) | |||
872 | { | 872 | { |
873 | struct mq_policy *mq = to_mq_policy(p); | 873 | struct mq_policy *mq = to_mq_policy(p); |
874 | 874 | ||
875 | kfree(mq->table); | 875 | vfree(mq->table); |
876 | epool_exit(&mq->cache_pool); | 876 | epool_exit(&mq->cache_pool); |
877 | epool_exit(&mq->pre_cache_pool); | 877 | epool_exit(&mq->pre_cache_pool); |
878 | kfree(mq); | 878 | kfree(mq); |
@@ -1245,7 +1245,7 @@ static struct dm_cache_policy *mq_create(dm_cblock_t cache_size, | |||
1245 | 1245 | ||
1246 | mq->nr_buckets = next_power(from_cblock(cache_size) / 2, 16); | 1246 | mq->nr_buckets = next_power(from_cblock(cache_size) / 2, 16); |
1247 | mq->hash_bits = ffs(mq->nr_buckets) - 1; | 1247 | mq->hash_bits = ffs(mq->nr_buckets) - 1; |
1248 | mq->table = kzalloc(sizeof(*mq->table) * mq->nr_buckets, GFP_KERNEL); | 1248 | mq->table = vzalloc(sizeof(*mq->table) * mq->nr_buckets); |
1249 | if (!mq->table) | 1249 | if (!mq->table) |
1250 | goto bad_alloc_table; | 1250 | goto bad_alloc_table; |
1251 | 1251 | ||
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index ffd472e015ca..074b9c8e4cf0 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -289,6 +289,7 @@ struct per_bio_data { | |||
289 | bool tick:1; | 289 | bool tick:1; |
290 | unsigned req_nr:2; | 290 | unsigned req_nr:2; |
291 | struct dm_deferred_entry *all_io_entry; | 291 | struct dm_deferred_entry *all_io_entry; |
292 | struct dm_hook_info hook_info; | ||
292 | 293 | ||
293 | /* | 294 | /* |
294 | * writethrough fields. These MUST remain at the end of this | 295 | * writethrough fields. These MUST remain at the end of this |
@@ -297,7 +298,6 @@ struct per_bio_data { | |||
297 | */ | 298 | */ |
298 | struct cache *cache; | 299 | struct cache *cache; |
299 | dm_cblock_t cblock; | 300 | dm_cblock_t cblock; |
300 | struct dm_hook_info hook_info; | ||
301 | struct dm_bio_details bio_details; | 301 | struct dm_bio_details bio_details; |
302 | }; | 302 | }; |
303 | 303 | ||
@@ -671,15 +671,16 @@ static void remap_to_cache(struct cache *cache, struct bio *bio, | |||
671 | dm_cblock_t cblock) | 671 | dm_cblock_t cblock) |
672 | { | 672 | { |
673 | sector_t bi_sector = bio->bi_iter.bi_sector; | 673 | sector_t bi_sector = bio->bi_iter.bi_sector; |
674 | sector_t block = from_cblock(cblock); | ||
674 | 675 | ||
675 | bio->bi_bdev = cache->cache_dev->bdev; | 676 | bio->bi_bdev = cache->cache_dev->bdev; |
676 | if (!block_size_is_power_of_two(cache)) | 677 | if (!block_size_is_power_of_two(cache)) |
677 | bio->bi_iter.bi_sector = | 678 | bio->bi_iter.bi_sector = |
678 | (from_cblock(cblock) * cache->sectors_per_block) + | 679 | (block * cache->sectors_per_block) + |
679 | sector_div(bi_sector, cache->sectors_per_block); | 680 | sector_div(bi_sector, cache->sectors_per_block); |
680 | else | 681 | else |
681 | bio->bi_iter.bi_sector = | 682 | bio->bi_iter.bi_sector = |
682 | (from_cblock(cblock) << cache->sectors_per_block_shift) | | 683 | (block << cache->sectors_per_block_shift) | |
683 | (bi_sector & (cache->sectors_per_block - 1)); | 684 | (bi_sector & (cache->sectors_per_block - 1)); |
684 | } | 685 | } |
685 | 686 | ||
@@ -978,12 +979,13 @@ static void issue_copy_real(struct dm_cache_migration *mg) | |||
978 | int r; | 979 | int r; |
979 | struct dm_io_region o_region, c_region; | 980 | struct dm_io_region o_region, c_region; |
980 | struct cache *cache = mg->cache; | 981 | struct cache *cache = mg->cache; |
982 | sector_t cblock = from_cblock(mg->cblock); | ||
981 | 983 | ||
982 | o_region.bdev = cache->origin_dev->bdev; | 984 | o_region.bdev = cache->origin_dev->bdev; |
983 | o_region.count = cache->sectors_per_block; | 985 | o_region.count = cache->sectors_per_block; |
984 | 986 | ||
985 | c_region.bdev = cache->cache_dev->bdev; | 987 | c_region.bdev = cache->cache_dev->bdev; |
986 | c_region.sector = from_cblock(mg->cblock) * cache->sectors_per_block; | 988 | c_region.sector = cblock * cache->sectors_per_block; |
987 | c_region.count = cache->sectors_per_block; | 989 | c_region.count = cache->sectors_per_block; |
988 | 990 | ||
989 | if (mg->writeback || mg->demote) { | 991 | if (mg->writeback || mg->demote) { |
@@ -1010,13 +1012,15 @@ static void overwrite_endio(struct bio *bio, int err) | |||
1010 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | 1012 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); |
1011 | unsigned long flags; | 1013 | unsigned long flags; |
1012 | 1014 | ||
1015 | dm_unhook_bio(&pb->hook_info, bio); | ||
1016 | |||
1013 | if (err) | 1017 | if (err) |
1014 | mg->err = true; | 1018 | mg->err = true; |
1015 | 1019 | ||
1020 | mg->requeue_holder = false; | ||
1021 | |||
1016 | spin_lock_irqsave(&cache->lock, flags); | 1022 | spin_lock_irqsave(&cache->lock, flags); |
1017 | list_add_tail(&mg->list, &cache->completed_migrations); | 1023 | list_add_tail(&mg->list, &cache->completed_migrations); |
1018 | dm_unhook_bio(&pb->hook_info, bio); | ||
1019 | mg->requeue_holder = false; | ||
1020 | spin_unlock_irqrestore(&cache->lock, flags); | 1024 | spin_unlock_irqrestore(&cache->lock, flags); |
1021 | 1025 | ||
1022 | wake_worker(cache); | 1026 | wake_worker(cache); |
@@ -2461,20 +2465,18 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2461 | bool discarded_block; | 2465 | bool discarded_block; |
2462 | struct dm_bio_prison_cell *cell; | 2466 | struct dm_bio_prison_cell *cell; |
2463 | struct policy_result lookup_result; | 2467 | struct policy_result lookup_result; |
2464 | struct per_bio_data *pb; | 2468 | struct per_bio_data *pb = init_per_bio_data(bio, pb_data_size); |
2465 | 2469 | ||
2466 | if (from_oblock(block) > from_oblock(cache->origin_blocks)) { | 2470 | if (unlikely(from_oblock(block) >= from_oblock(cache->origin_blocks))) { |
2467 | /* | 2471 | /* |
2468 | * This can only occur if the io goes to a partial block at | 2472 | * This can only occur if the io goes to a partial block at |
2469 | * the end of the origin device. We don't cache these. | 2473 | * the end of the origin device. We don't cache these. |
2470 | * Just remap to the origin and carry on. | 2474 | * Just remap to the origin and carry on. |
2471 | */ | 2475 | */ |
2472 | remap_to_origin_clear_discard(cache, bio, block); | 2476 | remap_to_origin(cache, bio); |
2473 | return DM_MAPIO_REMAPPED; | 2477 | return DM_MAPIO_REMAPPED; |
2474 | } | 2478 | } |
2475 | 2479 | ||
2476 | pb = init_per_bio_data(bio, pb_data_size); | ||
2477 | |||
2478 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { | 2480 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { |
2479 | defer_bio(cache, bio); | 2481 | defer_bio(cache, bio); |
2480 | return DM_MAPIO_SUBMITTED; | 2482 | return DM_MAPIO_SUBMITTED; |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index b2b8a10e8427..3842ac738f98 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -201,29 +201,28 @@ static void list_dp_init(struct dpages *dp, struct page_list *pl, unsigned offse | |||
201 | /* | 201 | /* |
202 | * Functions for getting the pages from a bvec. | 202 | * Functions for getting the pages from a bvec. |
203 | */ | 203 | */ |
204 | static void bio_get_page(struct dpages *dp, | 204 | static void bio_get_page(struct dpages *dp, struct page **p, |
205 | struct page **p, unsigned long *len, unsigned *offset) | 205 | unsigned long *len, unsigned *offset) |
206 | { | 206 | { |
207 | struct bio *bio = dp->context_ptr; | 207 | struct bio_vec *bvec = dp->context_ptr; |
208 | struct bio_vec bvec = bio_iovec(bio); | 208 | *p = bvec->bv_page; |
209 | *p = bvec.bv_page; | 209 | *len = bvec->bv_len - dp->context_u; |
210 | *len = bvec.bv_len; | 210 | *offset = bvec->bv_offset + dp->context_u; |
211 | *offset = bvec.bv_offset; | ||
212 | } | 211 | } |
213 | 212 | ||
214 | static void bio_next_page(struct dpages *dp) | 213 | static void bio_next_page(struct dpages *dp) |
215 | { | 214 | { |
216 | struct bio *bio = dp->context_ptr; | 215 | struct bio_vec *bvec = dp->context_ptr; |
217 | struct bio_vec bvec = bio_iovec(bio); | 216 | dp->context_ptr = bvec + 1; |
218 | 217 | dp->context_u = 0; | |
219 | bio_advance(bio, bvec.bv_len); | ||
220 | } | 218 | } |
221 | 219 | ||
222 | static void bio_dp_init(struct dpages *dp, struct bio *bio) | 220 | static void bio_dp_init(struct dpages *dp, struct bio *bio) |
223 | { | 221 | { |
224 | dp->get_page = bio_get_page; | 222 | dp->get_page = bio_get_page; |
225 | dp->next_page = bio_next_page; | 223 | dp->next_page = bio_next_page; |
226 | dp->context_ptr = bio; | 224 | dp->context_ptr = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter); |
225 | dp->context_u = bio->bi_iter.bi_bvec_done; | ||
227 | } | 226 | } |
228 | 227 | ||
229 | /* | 228 | /* |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 6eb9dc9ef8f3..422a9fdeb53e 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1626,8 +1626,11 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, | |||
1626 | /* | 1626 | /* |
1627 | * Only pass ioctls through if the device sizes match exactly. | 1627 | * Only pass ioctls through if the device sizes match exactly. |
1628 | */ | 1628 | */ |
1629 | if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) | 1629 | if (!bdev || ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) { |
1630 | r = scsi_verify_blk_ioctl(NULL, cmd); | 1630 | int err = scsi_verify_blk_ioctl(NULL, cmd); |
1631 | if (err) | ||
1632 | r = err; | ||
1633 | } | ||
1631 | 1634 | ||
1632 | if (r == -ENOTCONN && !fatal_signal_pending(current)) | 1635 | if (r == -ENOTCONN && !fatal_signal_pending(current)) |
1633 | queue_work(kmultipathd, &m->process_queued_ios); | 1636 | queue_work(kmultipathd, &m->process_queued_ios); |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index f284e0bfb25f..7dfdb5c746d6 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -1244,6 +1244,9 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) | |||
1244 | 1244 | ||
1245 | dm_bio_restore(bd, bio); | 1245 | dm_bio_restore(bd, bio); |
1246 | bio_record->details.bi_bdev = NULL; | 1246 | bio_record->details.bi_bdev = NULL; |
1247 | |||
1248 | atomic_inc(&bio->bi_remaining); | ||
1249 | |||
1247 | queue_bio(ms, bio, rw); | 1250 | queue_bio(ms, bio, rw); |
1248 | return DM_ENDIO_INCOMPLETE; | 1251 | return DM_ENDIO_INCOMPLETE; |
1249 | } | 1252 | } |
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index afc3d017de4c..d6e88178d22c 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c | |||
@@ -546,6 +546,9 @@ static int read_exceptions(struct pstore *ps, | |||
546 | r = insert_exceptions(ps, area, callback, callback_context, | 546 | r = insert_exceptions(ps, area, callback, callback_context, |
547 | &full); | 547 | &full); |
548 | 548 | ||
549 | if (!full) | ||
550 | memcpy(ps->area, area, ps->store->chunk_size << SECTOR_SHIFT); | ||
551 | |||
549 | dm_bufio_release(bp); | 552 | dm_bufio_release(bp); |
550 | 553 | ||
551 | dm_bufio_forget(client, chunk); | 554 | dm_bufio_forget(client, chunk); |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 7da347665552..fb9efc829182 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
@@ -76,7 +76,7 @@ | |||
76 | 76 | ||
77 | #define THIN_SUPERBLOCK_MAGIC 27022010 | 77 | #define THIN_SUPERBLOCK_MAGIC 27022010 |
78 | #define THIN_SUPERBLOCK_LOCATION 0 | 78 | #define THIN_SUPERBLOCK_LOCATION 0 |
79 | #define THIN_VERSION 1 | 79 | #define THIN_VERSION 2 |
80 | #define THIN_METADATA_CACHE_SIZE 64 | 80 | #define THIN_METADATA_CACHE_SIZE 64 |
81 | #define SECTOR_TO_BLOCK_SHIFT 3 | 81 | #define SECTOR_TO_BLOCK_SHIFT 3 |
82 | 82 | ||
@@ -483,7 +483,7 @@ static int __write_initial_superblock(struct dm_pool_metadata *pmd) | |||
483 | 483 | ||
484 | disk_super->data_mapping_root = cpu_to_le64(pmd->root); | 484 | disk_super->data_mapping_root = cpu_to_le64(pmd->root); |
485 | disk_super->device_details_root = cpu_to_le64(pmd->details_root); | 485 | disk_super->device_details_root = cpu_to_le64(pmd->details_root); |
486 | disk_super->metadata_block_size = cpu_to_le32(THIN_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 486 | disk_super->metadata_block_size = cpu_to_le32(THIN_METADATA_BLOCK_SIZE); |
487 | disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); | 487 | disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); |
488 | disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); | 488 | disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); |
489 | 489 | ||
@@ -651,7 +651,7 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f | |||
651 | { | 651 | { |
652 | int r; | 652 | int r; |
653 | 653 | ||
654 | pmd->bm = dm_block_manager_create(pmd->bdev, THIN_METADATA_BLOCK_SIZE, | 654 | pmd->bm = dm_block_manager_create(pmd->bdev, THIN_METADATA_BLOCK_SIZE << SECTOR_SHIFT, |
655 | THIN_METADATA_CACHE_SIZE, | 655 | THIN_METADATA_CACHE_SIZE, |
656 | THIN_MAX_CONCURRENT_LOCKS); | 656 | THIN_MAX_CONCURRENT_LOCKS); |
657 | if (IS_ERR(pmd->bm)) { | 657 | if (IS_ERR(pmd->bm)) { |
@@ -1489,6 +1489,23 @@ bool dm_thin_changed_this_transaction(struct dm_thin_device *td) | |||
1489 | return r; | 1489 | return r; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd) | ||
1493 | { | ||
1494 | bool r = false; | ||
1495 | struct dm_thin_device *td, *tmp; | ||
1496 | |||
1497 | down_read(&pmd->root_lock); | ||
1498 | list_for_each_entry_safe(td, tmp, &pmd->thin_devices, list) { | ||
1499 | if (td->changed) { | ||
1500 | r = td->changed; | ||
1501 | break; | ||
1502 | } | ||
1503 | } | ||
1504 | up_read(&pmd->root_lock); | ||
1505 | |||
1506 | return r; | ||
1507 | } | ||
1508 | |||
1492 | bool dm_thin_aborted_changes(struct dm_thin_device *td) | 1509 | bool dm_thin_aborted_changes(struct dm_thin_device *td) |
1493 | { | 1510 | { |
1494 | bool r; | 1511 | bool r; |
@@ -1738,3 +1755,38 @@ int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, | |||
1738 | 1755 | ||
1739 | return r; | 1756 | return r; |
1740 | } | 1757 | } |
1758 | |||
1759 | int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd) | ||
1760 | { | ||
1761 | int r; | ||
1762 | struct dm_block *sblock; | ||
1763 | struct thin_disk_superblock *disk_super; | ||
1764 | |||
1765 | down_write(&pmd->root_lock); | ||
1766 | pmd->flags |= THIN_METADATA_NEEDS_CHECK_FLAG; | ||
1767 | |||
1768 | r = superblock_lock(pmd, &sblock); | ||
1769 | if (r) { | ||
1770 | DMERR("couldn't read superblock"); | ||
1771 | goto out; | ||
1772 | } | ||
1773 | |||
1774 | disk_super = dm_block_data(sblock); | ||
1775 | disk_super->flags = cpu_to_le32(pmd->flags); | ||
1776 | |||
1777 | dm_bm_unlock(sblock); | ||
1778 | out: | ||
1779 | up_write(&pmd->root_lock); | ||
1780 | return r; | ||
1781 | } | ||
1782 | |||
1783 | bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd) | ||
1784 | { | ||
1785 | bool needs_check; | ||
1786 | |||
1787 | down_read(&pmd->root_lock); | ||
1788 | needs_check = pmd->flags & THIN_METADATA_NEEDS_CHECK_FLAG; | ||
1789 | up_read(&pmd->root_lock); | ||
1790 | |||
1791 | return needs_check; | ||
1792 | } | ||
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h index 9a368567632f..e3c857db195a 100644 --- a/drivers/md/dm-thin-metadata.h +++ b/drivers/md/dm-thin-metadata.h | |||
@@ -9,16 +9,14 @@ | |||
9 | 9 | ||
10 | #include "persistent-data/dm-block-manager.h" | 10 | #include "persistent-data/dm-block-manager.h" |
11 | #include "persistent-data/dm-space-map.h" | 11 | #include "persistent-data/dm-space-map.h" |
12 | #include "persistent-data/dm-space-map-metadata.h" | ||
12 | 13 | ||
13 | #define THIN_METADATA_BLOCK_SIZE 4096 | 14 | #define THIN_METADATA_BLOCK_SIZE DM_SM_METADATA_BLOCK_SIZE |
14 | 15 | ||
15 | /* | 16 | /* |
16 | * The metadata device is currently limited in size. | 17 | * The metadata device is currently limited in size. |
17 | * | ||
18 | * We have one block of index, which can hold 255 index entries. Each | ||
19 | * index entry contains allocation info about 16k metadata blocks. | ||
20 | */ | 18 | */ |
21 | #define THIN_METADATA_MAX_SECTORS (255 * (1 << 14) * (THIN_METADATA_BLOCK_SIZE / (1 << SECTOR_SHIFT))) | 19 | #define THIN_METADATA_MAX_SECTORS DM_SM_METADATA_MAX_SECTORS |
22 | 20 | ||
23 | /* | 21 | /* |
24 | * A metadata device larger than 16GB triggers a warning. | 22 | * A metadata device larger than 16GB triggers a warning. |
@@ -27,6 +25,11 @@ | |||
27 | 25 | ||
28 | /*----------------------------------------------------------------*/ | 26 | /*----------------------------------------------------------------*/ |
29 | 27 | ||
28 | /* | ||
29 | * Thin metadata superblock flags. | ||
30 | */ | ||
31 | #define THIN_METADATA_NEEDS_CHECK_FLAG (1 << 0) | ||
32 | |||
30 | struct dm_pool_metadata; | 33 | struct dm_pool_metadata; |
31 | struct dm_thin_device; | 34 | struct dm_thin_device; |
32 | 35 | ||
@@ -161,6 +164,8 @@ int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block); | |||
161 | */ | 164 | */ |
162 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td); | 165 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td); |
163 | 166 | ||
167 | bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd); | ||
168 | |||
164 | bool dm_thin_aborted_changes(struct dm_thin_device *td); | 169 | bool dm_thin_aborted_changes(struct dm_thin_device *td); |
165 | 170 | ||
166 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, | 171 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, |
@@ -202,6 +207,12 @@ int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, | |||
202 | dm_sm_threshold_fn fn, | 207 | dm_sm_threshold_fn fn, |
203 | void *context); | 208 | void *context); |
204 | 209 | ||
210 | /* | ||
211 | * Updates the superblock immediately. | ||
212 | */ | ||
213 | int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd); | ||
214 | bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd); | ||
215 | |||
205 | /*----------------------------------------------------------------*/ | 216 | /*----------------------------------------------------------------*/ |
206 | 217 | ||
207 | #endif | 218 | #endif |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index faaf944597ab..be70d38745f7 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -130,10 +130,11 @@ static void build_virtual_key(struct dm_thin_device *td, dm_block_t b, | |||
130 | struct dm_thin_new_mapping; | 130 | struct dm_thin_new_mapping; |
131 | 131 | ||
132 | /* | 132 | /* |
133 | * The pool runs in 3 modes. Ordered in degraded order for comparisons. | 133 | * The pool runs in 4 modes. Ordered in degraded order for comparisons. |
134 | */ | 134 | */ |
135 | enum pool_mode { | 135 | enum pool_mode { |
136 | PM_WRITE, /* metadata may be changed */ | 136 | PM_WRITE, /* metadata may be changed */ |
137 | PM_OUT_OF_DATA_SPACE, /* metadata may be changed, though data may not be allocated */ | ||
137 | PM_READ_ONLY, /* metadata may not be changed */ | 138 | PM_READ_ONLY, /* metadata may not be changed */ |
138 | PM_FAIL, /* all I/O fails */ | 139 | PM_FAIL, /* all I/O fails */ |
139 | }; | 140 | }; |
@@ -198,7 +199,6 @@ struct pool { | |||
198 | }; | 199 | }; |
199 | 200 | ||
200 | static enum pool_mode get_pool_mode(struct pool *pool); | 201 | static enum pool_mode get_pool_mode(struct pool *pool); |
201 | static void out_of_data_space(struct pool *pool); | ||
202 | static void metadata_operation_failed(struct pool *pool, const char *op, int r); | 202 | static void metadata_operation_failed(struct pool *pool, const char *op, int r); |
203 | 203 | ||
204 | /* | 204 | /* |
@@ -226,6 +226,7 @@ struct thin_c { | |||
226 | 226 | ||
227 | struct pool *pool; | 227 | struct pool *pool; |
228 | struct dm_thin_device *td; | 228 | struct dm_thin_device *td; |
229 | bool requeue_mode:1; | ||
229 | }; | 230 | }; |
230 | 231 | ||
231 | /*----------------------------------------------------------------*/ | 232 | /*----------------------------------------------------------------*/ |
@@ -369,14 +370,18 @@ struct dm_thin_endio_hook { | |||
369 | struct dm_thin_new_mapping *overwrite_mapping; | 370 | struct dm_thin_new_mapping *overwrite_mapping; |
370 | }; | 371 | }; |
371 | 372 | ||
372 | static void __requeue_bio_list(struct thin_c *tc, struct bio_list *master) | 373 | static void requeue_bio_list(struct thin_c *tc, struct bio_list *master) |
373 | { | 374 | { |
374 | struct bio *bio; | 375 | struct bio *bio; |
375 | struct bio_list bios; | 376 | struct bio_list bios; |
377 | unsigned long flags; | ||
376 | 378 | ||
377 | bio_list_init(&bios); | 379 | bio_list_init(&bios); |
380 | |||
381 | spin_lock_irqsave(&tc->pool->lock, flags); | ||
378 | bio_list_merge(&bios, master); | 382 | bio_list_merge(&bios, master); |
379 | bio_list_init(master); | 383 | bio_list_init(master); |
384 | spin_unlock_irqrestore(&tc->pool->lock, flags); | ||
380 | 385 | ||
381 | while ((bio = bio_list_pop(&bios))) { | 386 | while ((bio = bio_list_pop(&bios))) { |
382 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); | 387 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); |
@@ -391,12 +396,26 @@ static void __requeue_bio_list(struct thin_c *tc, struct bio_list *master) | |||
391 | static void requeue_io(struct thin_c *tc) | 396 | static void requeue_io(struct thin_c *tc) |
392 | { | 397 | { |
393 | struct pool *pool = tc->pool; | 398 | struct pool *pool = tc->pool; |
399 | |||
400 | requeue_bio_list(tc, &pool->deferred_bios); | ||
401 | requeue_bio_list(tc, &pool->retry_on_resume_list); | ||
402 | } | ||
403 | |||
404 | static void error_retry_list(struct pool *pool) | ||
405 | { | ||
406 | struct bio *bio; | ||
394 | unsigned long flags; | 407 | unsigned long flags; |
408 | struct bio_list bios; | ||
409 | |||
410 | bio_list_init(&bios); | ||
395 | 411 | ||
396 | spin_lock_irqsave(&pool->lock, flags); | 412 | spin_lock_irqsave(&pool->lock, flags); |
397 | __requeue_bio_list(tc, &pool->deferred_bios); | 413 | bio_list_merge(&bios, &pool->retry_on_resume_list); |
398 | __requeue_bio_list(tc, &pool->retry_on_resume_list); | 414 | bio_list_init(&pool->retry_on_resume_list); |
399 | spin_unlock_irqrestore(&pool->lock, flags); | 415 | spin_unlock_irqrestore(&pool->lock, flags); |
416 | |||
417 | while ((bio = bio_list_pop(&bios))) | ||
418 | bio_io_error(bio); | ||
400 | } | 419 | } |
401 | 420 | ||
402 | /* | 421 | /* |
@@ -925,13 +944,15 @@ static void check_low_water_mark(struct pool *pool, dm_block_t free_blocks) | |||
925 | } | 944 | } |
926 | } | 945 | } |
927 | 946 | ||
947 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); | ||
948 | |||
928 | static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | 949 | static int alloc_data_block(struct thin_c *tc, dm_block_t *result) |
929 | { | 950 | { |
930 | int r; | 951 | int r; |
931 | dm_block_t free_blocks; | 952 | dm_block_t free_blocks; |
932 | struct pool *pool = tc->pool; | 953 | struct pool *pool = tc->pool; |
933 | 954 | ||
934 | if (get_pool_mode(pool) != PM_WRITE) | 955 | if (WARN_ON(get_pool_mode(pool) != PM_WRITE)) |
935 | return -EINVAL; | 956 | return -EINVAL; |
936 | 957 | ||
937 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); | 958 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); |
@@ -958,7 +979,7 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | |||
958 | } | 979 | } |
959 | 980 | ||
960 | if (!free_blocks) { | 981 | if (!free_blocks) { |
961 | out_of_data_space(pool); | 982 | set_pool_mode(pool, PM_OUT_OF_DATA_SPACE); |
962 | return -ENOSPC; | 983 | return -ENOSPC; |
963 | } | 984 | } |
964 | } | 985 | } |
@@ -988,15 +1009,32 @@ static void retry_on_resume(struct bio *bio) | |||
988 | spin_unlock_irqrestore(&pool->lock, flags); | 1009 | spin_unlock_irqrestore(&pool->lock, flags); |
989 | } | 1010 | } |
990 | 1011 | ||
991 | static void handle_unserviceable_bio(struct pool *pool, struct bio *bio) | 1012 | static bool should_error_unserviceable_bio(struct pool *pool) |
992 | { | 1013 | { |
993 | /* | 1014 | enum pool_mode m = get_pool_mode(pool); |
994 | * When pool is read-only, no cell locking is needed because | ||
995 | * nothing is changing. | ||
996 | */ | ||
997 | WARN_ON_ONCE(get_pool_mode(pool) != PM_READ_ONLY); | ||
998 | 1015 | ||
999 | if (pool->pf.error_if_no_space) | 1016 | switch (m) { |
1017 | case PM_WRITE: | ||
1018 | /* Shouldn't get here */ | ||
1019 | DMERR_LIMIT("bio unserviceable, yet pool is in PM_WRITE mode"); | ||
1020 | return true; | ||
1021 | |||
1022 | case PM_OUT_OF_DATA_SPACE: | ||
1023 | return pool->pf.error_if_no_space; | ||
1024 | |||
1025 | case PM_READ_ONLY: | ||
1026 | case PM_FAIL: | ||
1027 | return true; | ||
1028 | default: | ||
1029 | /* Shouldn't get here */ | ||
1030 | DMERR_LIMIT("bio unserviceable, yet pool has an unknown mode"); | ||
1031 | return true; | ||
1032 | } | ||
1033 | } | ||
1034 | |||
1035 | static void handle_unserviceable_bio(struct pool *pool, struct bio *bio) | ||
1036 | { | ||
1037 | if (should_error_unserviceable_bio(pool)) | ||
1000 | bio_io_error(bio); | 1038 | bio_io_error(bio); |
1001 | else | 1039 | else |
1002 | retry_on_resume(bio); | 1040 | retry_on_resume(bio); |
@@ -1007,11 +1045,20 @@ static void retry_bios_on_resume(struct pool *pool, struct dm_bio_prison_cell *c | |||
1007 | struct bio *bio; | 1045 | struct bio *bio; |
1008 | struct bio_list bios; | 1046 | struct bio_list bios; |
1009 | 1047 | ||
1048 | if (should_error_unserviceable_bio(pool)) { | ||
1049 | cell_error(pool, cell); | ||
1050 | return; | ||
1051 | } | ||
1052 | |||
1010 | bio_list_init(&bios); | 1053 | bio_list_init(&bios); |
1011 | cell_release(pool, cell, &bios); | 1054 | cell_release(pool, cell, &bios); |
1012 | 1055 | ||
1013 | while ((bio = bio_list_pop(&bios))) | 1056 | if (should_error_unserviceable_bio(pool)) |
1014 | handle_unserviceable_bio(pool, bio); | 1057 | while ((bio = bio_list_pop(&bios))) |
1058 | bio_io_error(bio); | ||
1059 | else | ||
1060 | while ((bio = bio_list_pop(&bios))) | ||
1061 | retry_on_resume(bio); | ||
1015 | } | 1062 | } |
1016 | 1063 | ||
1017 | static void process_discard(struct thin_c *tc, struct bio *bio) | 1064 | static void process_discard(struct thin_c *tc, struct bio *bio) |
@@ -1296,6 +1343,11 @@ static void process_bio_read_only(struct thin_c *tc, struct bio *bio) | |||
1296 | } | 1343 | } |
1297 | } | 1344 | } |
1298 | 1345 | ||
1346 | static void process_bio_success(struct thin_c *tc, struct bio *bio) | ||
1347 | { | ||
1348 | bio_endio(bio, 0); | ||
1349 | } | ||
1350 | |||
1299 | static void process_bio_fail(struct thin_c *tc, struct bio *bio) | 1351 | static void process_bio_fail(struct thin_c *tc, struct bio *bio) |
1300 | { | 1352 | { |
1301 | bio_io_error(bio); | 1353 | bio_io_error(bio); |
@@ -1328,6 +1380,11 @@ static void process_deferred_bios(struct pool *pool) | |||
1328 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); | 1380 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); |
1329 | struct thin_c *tc = h->tc; | 1381 | struct thin_c *tc = h->tc; |
1330 | 1382 | ||
1383 | if (tc->requeue_mode) { | ||
1384 | bio_endio(bio, DM_ENDIO_REQUEUE); | ||
1385 | continue; | ||
1386 | } | ||
1387 | |||
1331 | /* | 1388 | /* |
1332 | * If we've got no free new_mapping structs, and processing | 1389 | * If we've got no free new_mapping structs, and processing |
1333 | * this bio might require one, we pause until there are some | 1390 | * this bio might require one, we pause until there are some |
@@ -1357,7 +1414,8 @@ static void process_deferred_bios(struct pool *pool) | |||
1357 | bio_list_init(&pool->deferred_flush_bios); | 1414 | bio_list_init(&pool->deferred_flush_bios); |
1358 | spin_unlock_irqrestore(&pool->lock, flags); | 1415 | spin_unlock_irqrestore(&pool->lock, flags); |
1359 | 1416 | ||
1360 | if (bio_list_empty(&bios) && !need_commit_due_to_time(pool)) | 1417 | if (bio_list_empty(&bios) && |
1418 | !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool))) | ||
1361 | return; | 1419 | return; |
1362 | 1420 | ||
1363 | if (commit(pool)) { | 1421 | if (commit(pool)) { |
@@ -1393,51 +1451,134 @@ static void do_waker(struct work_struct *ws) | |||
1393 | 1451 | ||
1394 | /*----------------------------------------------------------------*/ | 1452 | /*----------------------------------------------------------------*/ |
1395 | 1453 | ||
1454 | struct noflush_work { | ||
1455 | struct work_struct worker; | ||
1456 | struct thin_c *tc; | ||
1457 | |||
1458 | atomic_t complete; | ||
1459 | wait_queue_head_t wait; | ||
1460 | }; | ||
1461 | |||
1462 | static void complete_noflush_work(struct noflush_work *w) | ||
1463 | { | ||
1464 | atomic_set(&w->complete, 1); | ||
1465 | wake_up(&w->wait); | ||
1466 | } | ||
1467 | |||
1468 | static void do_noflush_start(struct work_struct *ws) | ||
1469 | { | ||
1470 | struct noflush_work *w = container_of(ws, struct noflush_work, worker); | ||
1471 | w->tc->requeue_mode = true; | ||
1472 | requeue_io(w->tc); | ||
1473 | complete_noflush_work(w); | ||
1474 | } | ||
1475 | |||
1476 | static void do_noflush_stop(struct work_struct *ws) | ||
1477 | { | ||
1478 | struct noflush_work *w = container_of(ws, struct noflush_work, worker); | ||
1479 | w->tc->requeue_mode = false; | ||
1480 | complete_noflush_work(w); | ||
1481 | } | ||
1482 | |||
1483 | static void noflush_work(struct thin_c *tc, void (*fn)(struct work_struct *)) | ||
1484 | { | ||
1485 | struct noflush_work w; | ||
1486 | |||
1487 | INIT_WORK(&w.worker, fn); | ||
1488 | w.tc = tc; | ||
1489 | atomic_set(&w.complete, 0); | ||
1490 | init_waitqueue_head(&w.wait); | ||
1491 | |||
1492 | queue_work(tc->pool->wq, &w.worker); | ||
1493 | |||
1494 | wait_event(w.wait, atomic_read(&w.complete)); | ||
1495 | } | ||
1496 | |||
1497 | /*----------------------------------------------------------------*/ | ||
1498 | |||
1396 | static enum pool_mode get_pool_mode(struct pool *pool) | 1499 | static enum pool_mode get_pool_mode(struct pool *pool) |
1397 | { | 1500 | { |
1398 | return pool->pf.mode; | 1501 | return pool->pf.mode; |
1399 | } | 1502 | } |
1400 | 1503 | ||
1504 | static void notify_of_pool_mode_change(struct pool *pool, const char *new_mode) | ||
1505 | { | ||
1506 | dm_table_event(pool->ti->table); | ||
1507 | DMINFO("%s: switching pool to %s mode", | ||
1508 | dm_device_name(pool->pool_md), new_mode); | ||
1509 | } | ||
1510 | |||
1401 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | 1511 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) |
1402 | { | 1512 | { |
1403 | int r; | 1513 | struct pool_c *pt = pool->ti->private; |
1404 | enum pool_mode old_mode = pool->pf.mode; | 1514 | bool needs_check = dm_pool_metadata_needs_check(pool->pmd); |
1515 | enum pool_mode old_mode = get_pool_mode(pool); | ||
1516 | |||
1517 | /* | ||
1518 | * Never allow the pool to transition to PM_WRITE mode if user | ||
1519 | * intervention is required to verify metadata and data consistency. | ||
1520 | */ | ||
1521 | if (new_mode == PM_WRITE && needs_check) { | ||
1522 | DMERR("%s: unable to switch pool to write mode until repaired.", | ||
1523 | dm_device_name(pool->pool_md)); | ||
1524 | if (old_mode != new_mode) | ||
1525 | new_mode = old_mode; | ||
1526 | else | ||
1527 | new_mode = PM_READ_ONLY; | ||
1528 | } | ||
1529 | /* | ||
1530 | * If we were in PM_FAIL mode, rollback of metadata failed. We're | ||
1531 | * not going to recover without a thin_repair. So we never let the | ||
1532 | * pool move out of the old mode. | ||
1533 | */ | ||
1534 | if (old_mode == PM_FAIL) | ||
1535 | new_mode = old_mode; | ||
1405 | 1536 | ||
1406 | switch (new_mode) { | 1537 | switch (new_mode) { |
1407 | case PM_FAIL: | 1538 | case PM_FAIL: |
1408 | if (old_mode != new_mode) | 1539 | if (old_mode != new_mode) |
1409 | DMERR("%s: switching pool to failure mode", | 1540 | notify_of_pool_mode_change(pool, "failure"); |
1410 | dm_device_name(pool->pool_md)); | ||
1411 | dm_pool_metadata_read_only(pool->pmd); | 1541 | dm_pool_metadata_read_only(pool->pmd); |
1412 | pool->process_bio = process_bio_fail; | 1542 | pool->process_bio = process_bio_fail; |
1413 | pool->process_discard = process_bio_fail; | 1543 | pool->process_discard = process_bio_fail; |
1414 | pool->process_prepared_mapping = process_prepared_mapping_fail; | 1544 | pool->process_prepared_mapping = process_prepared_mapping_fail; |
1415 | pool->process_prepared_discard = process_prepared_discard_fail; | 1545 | pool->process_prepared_discard = process_prepared_discard_fail; |
1546 | |||
1547 | error_retry_list(pool); | ||
1416 | break; | 1548 | break; |
1417 | 1549 | ||
1418 | case PM_READ_ONLY: | 1550 | case PM_READ_ONLY: |
1419 | if (old_mode != new_mode) | 1551 | if (old_mode != new_mode) |
1420 | DMERR("%s: switching pool to read-only mode", | 1552 | notify_of_pool_mode_change(pool, "read-only"); |
1421 | dm_device_name(pool->pool_md)); | 1553 | dm_pool_metadata_read_only(pool->pmd); |
1422 | r = dm_pool_abort_metadata(pool->pmd); | 1554 | pool->process_bio = process_bio_read_only; |
1423 | if (r) { | 1555 | pool->process_discard = process_bio_success; |
1424 | DMERR("%s: aborting transaction failed", | 1556 | pool->process_prepared_mapping = process_prepared_mapping_fail; |
1425 | dm_device_name(pool->pool_md)); | 1557 | pool->process_prepared_discard = process_prepared_discard_passdown; |
1426 | new_mode = PM_FAIL; | 1558 | |
1427 | set_pool_mode(pool, new_mode); | 1559 | error_retry_list(pool); |
1428 | } else { | 1560 | break; |
1429 | dm_pool_metadata_read_only(pool->pmd); | 1561 | |
1430 | pool->process_bio = process_bio_read_only; | 1562 | case PM_OUT_OF_DATA_SPACE: |
1431 | pool->process_discard = process_discard; | 1563 | /* |
1432 | pool->process_prepared_mapping = process_prepared_mapping_fail; | 1564 | * Ideally we'd never hit this state; the low water mark |
1433 | pool->process_prepared_discard = process_prepared_discard_passdown; | 1565 | * would trigger userland to extend the pool before we |
1434 | } | 1566 | * completely run out of data space. However, many small |
1567 | * IOs to unprovisioned space can consume data space at an | ||
1568 | * alarming rate. Adjust your low water mark if you're | ||
1569 | * frequently seeing this mode. | ||
1570 | */ | ||
1571 | if (old_mode != new_mode) | ||
1572 | notify_of_pool_mode_change(pool, "out-of-data-space"); | ||
1573 | pool->process_bio = process_bio_read_only; | ||
1574 | pool->process_discard = process_discard; | ||
1575 | pool->process_prepared_mapping = process_prepared_mapping; | ||
1576 | pool->process_prepared_discard = process_prepared_discard_passdown; | ||
1435 | break; | 1577 | break; |
1436 | 1578 | ||
1437 | case PM_WRITE: | 1579 | case PM_WRITE: |
1438 | if (old_mode != new_mode) | 1580 | if (old_mode != new_mode) |
1439 | DMINFO("%s: switching pool to write mode", | 1581 | notify_of_pool_mode_change(pool, "write"); |
1440 | dm_device_name(pool->pool_md)); | ||
1441 | dm_pool_metadata_read_write(pool->pmd); | 1582 | dm_pool_metadata_read_write(pool->pmd); |
1442 | pool->process_bio = process_bio; | 1583 | pool->process_bio = process_bio; |
1443 | pool->process_discard = process_discard; | 1584 | pool->process_discard = process_discard; |
@@ -1447,32 +1588,35 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | |||
1447 | } | 1588 | } |
1448 | 1589 | ||
1449 | pool->pf.mode = new_mode; | 1590 | pool->pf.mode = new_mode; |
1591 | /* | ||
1592 | * The pool mode may have changed, sync it so bind_control_target() | ||
1593 | * doesn't cause an unexpected mode transition on resume. | ||
1594 | */ | ||
1595 | pt->adjusted_pf.mode = new_mode; | ||
1450 | } | 1596 | } |
1451 | 1597 | ||
1452 | /* | 1598 | static void abort_transaction(struct pool *pool) |
1453 | * Rather than calling set_pool_mode directly, use these which describe the | ||
1454 | * reason for mode degradation. | ||
1455 | */ | ||
1456 | static void out_of_data_space(struct pool *pool) | ||
1457 | { | 1599 | { |
1458 | DMERR_LIMIT("%s: no free data space available.", | 1600 | const char *dev_name = dm_device_name(pool->pool_md); |
1459 | dm_device_name(pool->pool_md)); | 1601 | |
1460 | set_pool_mode(pool, PM_READ_ONLY); | 1602 | DMERR_LIMIT("%s: aborting current metadata transaction", dev_name); |
1603 | if (dm_pool_abort_metadata(pool->pmd)) { | ||
1604 | DMERR("%s: failed to abort metadata transaction", dev_name); | ||
1605 | set_pool_mode(pool, PM_FAIL); | ||
1606 | } | ||
1607 | |||
1608 | if (dm_pool_metadata_set_needs_check(pool->pmd)) { | ||
1609 | DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name); | ||
1610 | set_pool_mode(pool, PM_FAIL); | ||
1611 | } | ||
1461 | } | 1612 | } |
1462 | 1613 | ||
1463 | static void metadata_operation_failed(struct pool *pool, const char *op, int r) | 1614 | static void metadata_operation_failed(struct pool *pool, const char *op, int r) |
1464 | { | 1615 | { |
1465 | dm_block_t free_blocks; | ||
1466 | |||
1467 | DMERR_LIMIT("%s: metadata operation '%s' failed: error = %d", | 1616 | DMERR_LIMIT("%s: metadata operation '%s' failed: error = %d", |
1468 | dm_device_name(pool->pool_md), op, r); | 1617 | dm_device_name(pool->pool_md), op, r); |
1469 | 1618 | ||
1470 | if (r == -ENOSPC && | 1619 | abort_transaction(pool); |
1471 | !dm_pool_get_free_metadata_block_count(pool->pmd, &free_blocks) && | ||
1472 | !free_blocks) | ||
1473 | DMERR_LIMIT("%s: no free metadata space available.", | ||
1474 | dm_device_name(pool->pool_md)); | ||
1475 | |||
1476 | set_pool_mode(pool, PM_READ_ONLY); | 1620 | set_pool_mode(pool, PM_READ_ONLY); |
1477 | } | 1621 | } |
1478 | 1622 | ||
@@ -1523,6 +1667,11 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1523 | 1667 | ||
1524 | thin_hook_bio(tc, bio); | 1668 | thin_hook_bio(tc, bio); |
1525 | 1669 | ||
1670 | if (tc->requeue_mode) { | ||
1671 | bio_endio(bio, DM_ENDIO_REQUEUE); | ||
1672 | return DM_MAPIO_SUBMITTED; | ||
1673 | } | ||
1674 | |||
1526 | if (get_pool_mode(tc->pool) == PM_FAIL) { | 1675 | if (get_pool_mode(tc->pool) == PM_FAIL) { |
1527 | bio_io_error(bio); | 1676 | bio_io_error(bio); |
1528 | return DM_MAPIO_SUBMITTED; | 1677 | return DM_MAPIO_SUBMITTED; |
@@ -1686,7 +1835,7 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
1686 | /* | 1835 | /* |
1687 | * We want to make sure that a pool in PM_FAIL mode is never upgraded. | 1836 | * We want to make sure that a pool in PM_FAIL mode is never upgraded. |
1688 | */ | 1837 | */ |
1689 | enum pool_mode old_mode = pool->pf.mode; | 1838 | enum pool_mode old_mode = get_pool_mode(pool); |
1690 | enum pool_mode new_mode = pt->adjusted_pf.mode; | 1839 | enum pool_mode new_mode = pt->adjusted_pf.mode; |
1691 | 1840 | ||
1692 | /* | 1841 | /* |
@@ -1700,16 +1849,6 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
1700 | pool->pf = pt->adjusted_pf; | 1849 | pool->pf = pt->adjusted_pf; |
1701 | pool->low_water_blocks = pt->low_water_blocks; | 1850 | pool->low_water_blocks = pt->low_water_blocks; |
1702 | 1851 | ||
1703 | /* | ||
1704 | * If we were in PM_FAIL mode, rollback of metadata failed. We're | ||
1705 | * not going to recover without a thin_repair. So we never let the | ||
1706 | * pool move out of the old mode. On the other hand a PM_READ_ONLY | ||
1707 | * may have been due to a lack of metadata or data space, and may | ||
1708 | * now work (ie. if the underlying devices have been resized). | ||
1709 | */ | ||
1710 | if (old_mode == PM_FAIL) | ||
1711 | new_mode = old_mode; | ||
1712 | |||
1713 | set_pool_mode(pool, new_mode); | 1852 | set_pool_mode(pool, new_mode); |
1714 | 1853 | ||
1715 | return 0; | 1854 | return 0; |
@@ -1999,16 +2138,27 @@ static void metadata_low_callback(void *context) | |||
1999 | dm_table_event(pool->ti->table); | 2138 | dm_table_event(pool->ti->table); |
2000 | } | 2139 | } |
2001 | 2140 | ||
2002 | static sector_t get_metadata_dev_size(struct block_device *bdev) | 2141 | static sector_t get_dev_size(struct block_device *bdev) |
2142 | { | ||
2143 | return i_size_read(bdev->bd_inode) >> SECTOR_SHIFT; | ||
2144 | } | ||
2145 | |||
2146 | static void warn_if_metadata_device_too_big(struct block_device *bdev) | ||
2003 | { | 2147 | { |
2004 | sector_t metadata_dev_size = i_size_read(bdev->bd_inode) >> SECTOR_SHIFT; | 2148 | sector_t metadata_dev_size = get_dev_size(bdev); |
2005 | char buffer[BDEVNAME_SIZE]; | 2149 | char buffer[BDEVNAME_SIZE]; |
2006 | 2150 | ||
2007 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING) { | 2151 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING) |
2008 | DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.", | 2152 | DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.", |
2009 | bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS); | 2153 | bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS); |
2010 | metadata_dev_size = THIN_METADATA_MAX_SECTORS_WARNING; | 2154 | } |
2011 | } | 2155 | |
2156 | static sector_t get_metadata_dev_size(struct block_device *bdev) | ||
2157 | { | ||
2158 | sector_t metadata_dev_size = get_dev_size(bdev); | ||
2159 | |||
2160 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS) | ||
2161 | metadata_dev_size = THIN_METADATA_MAX_SECTORS; | ||
2012 | 2162 | ||
2013 | return metadata_dev_size; | 2163 | return metadata_dev_size; |
2014 | } | 2164 | } |
@@ -2017,7 +2167,7 @@ static dm_block_t get_metadata_dev_size_in_blocks(struct block_device *bdev) | |||
2017 | { | 2167 | { |
2018 | sector_t metadata_dev_size = get_metadata_dev_size(bdev); | 2168 | sector_t metadata_dev_size = get_metadata_dev_size(bdev); |
2019 | 2169 | ||
2020 | sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 2170 | sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE); |
2021 | 2171 | ||
2022 | return metadata_dev_size; | 2172 | return metadata_dev_size; |
2023 | } | 2173 | } |
@@ -2095,12 +2245,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2095 | ti->error = "Error opening metadata block device"; | 2245 | ti->error = "Error opening metadata block device"; |
2096 | goto out_unlock; | 2246 | goto out_unlock; |
2097 | } | 2247 | } |
2098 | 2248 | warn_if_metadata_device_too_big(metadata_dev->bdev); | |
2099 | /* | ||
2100 | * Run for the side-effect of possibly issuing a warning if the | ||
2101 | * device is too big. | ||
2102 | */ | ||
2103 | (void) get_metadata_dev_size(metadata_dev->bdev); | ||
2104 | 2249 | ||
2105 | r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &data_dev); | 2250 | r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &data_dev); |
2106 | if (r) { | 2251 | if (r) { |
@@ -2246,6 +2391,12 @@ static int maybe_resize_data_dev(struct dm_target *ti, bool *need_commit) | |||
2246 | return -EINVAL; | 2391 | return -EINVAL; |
2247 | 2392 | ||
2248 | } else if (data_size > sb_data_size) { | 2393 | } else if (data_size > sb_data_size) { |
2394 | if (dm_pool_metadata_needs_check(pool->pmd)) { | ||
2395 | DMERR("%s: unable to grow the data device until repaired.", | ||
2396 | dm_device_name(pool->pool_md)); | ||
2397 | return 0; | ||
2398 | } | ||
2399 | |||
2249 | if (sb_data_size) | 2400 | if (sb_data_size) |
2250 | DMINFO("%s: growing the data device from %llu to %llu blocks", | 2401 | DMINFO("%s: growing the data device from %llu to %llu blocks", |
2251 | dm_device_name(pool->pool_md), | 2402 | dm_device_name(pool->pool_md), |
@@ -2287,6 +2438,13 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit) | |||
2287 | return -EINVAL; | 2438 | return -EINVAL; |
2288 | 2439 | ||
2289 | } else if (metadata_dev_size > sb_metadata_dev_size) { | 2440 | } else if (metadata_dev_size > sb_metadata_dev_size) { |
2441 | if (dm_pool_metadata_needs_check(pool->pmd)) { | ||
2442 | DMERR("%s: unable to grow the metadata device until repaired.", | ||
2443 | dm_device_name(pool->pool_md)); | ||
2444 | return 0; | ||
2445 | } | ||
2446 | |||
2447 | warn_if_metadata_device_too_big(pool->md_dev); | ||
2290 | DMINFO("%s: growing the metadata device from %llu to %llu blocks", | 2448 | DMINFO("%s: growing the metadata device from %llu to %llu blocks", |
2291 | dm_device_name(pool->pool_md), | 2449 | dm_device_name(pool->pool_md), |
2292 | sb_metadata_dev_size, metadata_dev_size); | 2450 | sb_metadata_dev_size, metadata_dev_size); |
@@ -2673,7 +2831,9 @@ static void pool_status(struct dm_target *ti, status_type_t type, | |||
2673 | else | 2831 | else |
2674 | DMEMIT("- "); | 2832 | DMEMIT("- "); |
2675 | 2833 | ||
2676 | if (pool->pf.mode == PM_READ_ONLY) | 2834 | if (pool->pf.mode == PM_OUT_OF_DATA_SPACE) |
2835 | DMEMIT("out_of_data_space "); | ||
2836 | else if (pool->pf.mode == PM_READ_ONLY) | ||
2677 | DMEMIT("ro "); | 2837 | DMEMIT("ro "); |
2678 | else | 2838 | else |
2679 | DMEMIT("rw "); | 2839 | DMEMIT("rw "); |
@@ -2787,7 +2947,7 @@ static struct target_type pool_target = { | |||
2787 | .name = "thin-pool", | 2947 | .name = "thin-pool", |
2788 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 2948 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
2789 | DM_TARGET_IMMUTABLE, | 2949 | DM_TARGET_IMMUTABLE, |
2790 | .version = {1, 10, 0}, | 2950 | .version = {1, 11, 0}, |
2791 | .module = THIS_MODULE, | 2951 | .module = THIS_MODULE, |
2792 | .ctr = pool_ctr, | 2952 | .ctr = pool_ctr, |
2793 | .dtr = pool_dtr, | 2953 | .dtr = pool_dtr, |
@@ -2894,6 +3054,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2894 | 3054 | ||
2895 | if (get_pool_mode(tc->pool) == PM_FAIL) { | 3055 | if (get_pool_mode(tc->pool) == PM_FAIL) { |
2896 | ti->error = "Couldn't open thin device, Pool is in fail mode"; | 3056 | ti->error = "Couldn't open thin device, Pool is in fail mode"; |
3057 | r = -EINVAL; | ||
2897 | goto bad_thin_open; | 3058 | goto bad_thin_open; |
2898 | } | 3059 | } |
2899 | 3060 | ||
@@ -2905,7 +3066,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2905 | 3066 | ||
2906 | r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block); | 3067 | r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block); |
2907 | if (r) | 3068 | if (r) |
2908 | goto bad_thin_open; | 3069 | goto bad_target_max_io_len; |
2909 | 3070 | ||
2910 | ti->num_flush_bios = 1; | 3071 | ti->num_flush_bios = 1; |
2911 | ti->flush_supported = true; | 3072 | ti->flush_supported = true; |
@@ -2926,6 +3087,8 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2926 | 3087 | ||
2927 | return 0; | 3088 | return 0; |
2928 | 3089 | ||
3090 | bad_target_max_io_len: | ||
3091 | dm_pool_close_thin_device(tc->td); | ||
2929 | bad_thin_open: | 3092 | bad_thin_open: |
2930 | __pool_dec(tc->pool); | 3093 | __pool_dec(tc->pool); |
2931 | bad_pool_lookup: | 3094 | bad_pool_lookup: |
@@ -2986,10 +3149,23 @@ static int thin_endio(struct dm_target *ti, struct bio *bio, int err) | |||
2986 | return 0; | 3149 | return 0; |
2987 | } | 3150 | } |
2988 | 3151 | ||
2989 | static void thin_postsuspend(struct dm_target *ti) | 3152 | static void thin_presuspend(struct dm_target *ti) |
2990 | { | 3153 | { |
3154 | struct thin_c *tc = ti->private; | ||
3155 | |||
2991 | if (dm_noflush_suspending(ti)) | 3156 | if (dm_noflush_suspending(ti)) |
2992 | requeue_io((struct thin_c *)ti->private); | 3157 | noflush_work(tc, do_noflush_start); |
3158 | } | ||
3159 | |||
3160 | static void thin_postsuspend(struct dm_target *ti) | ||
3161 | { | ||
3162 | struct thin_c *tc = ti->private; | ||
3163 | |||
3164 | /* | ||
3165 | * The dm_noflush_suspending flag has been cleared by now, so | ||
3166 | * unfortunately we must always run this. | ||
3167 | */ | ||
3168 | noflush_work(tc, do_noflush_stop); | ||
2993 | } | 3169 | } |
2994 | 3170 | ||
2995 | /* | 3171 | /* |
@@ -3074,12 +3250,13 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
3074 | 3250 | ||
3075 | static struct target_type thin_target = { | 3251 | static struct target_type thin_target = { |
3076 | .name = "thin", | 3252 | .name = "thin", |
3077 | .version = {1, 10, 0}, | 3253 | .version = {1, 11, 0}, |
3078 | .module = THIS_MODULE, | 3254 | .module = THIS_MODULE, |
3079 | .ctr = thin_ctr, | 3255 | .ctr = thin_ctr, |
3080 | .dtr = thin_dtr, | 3256 | .dtr = thin_dtr, |
3081 | .map = thin_map, | 3257 | .map = thin_map, |
3082 | .end_io = thin_endio, | 3258 | .end_io = thin_endio, |
3259 | .presuspend = thin_presuspend, | ||
3083 | .postsuspend = thin_postsuspend, | 3260 | .postsuspend = thin_postsuspend, |
3084 | .status = thin_status, | 3261 | .status = thin_status, |
3085 | .iterate_devices = thin_iterate_devices, | 3262 | .iterate_devices = thin_iterate_devices, |
diff --git a/drivers/md/persistent-data/Kconfig b/drivers/md/persistent-data/Kconfig index 19b268795415..0c2dec7aec20 100644 --- a/drivers/md/persistent-data/Kconfig +++ b/drivers/md/persistent-data/Kconfig | |||
@@ -6,3 +6,13 @@ config DM_PERSISTENT_DATA | |||
6 | ---help--- | 6 | ---help--- |
7 | Library providing immutable on-disk data structure support for | 7 | Library providing immutable on-disk data structure support for |
8 | device-mapper targets such as the thin provisioning target. | 8 | device-mapper targets such as the thin provisioning target. |
9 | |||
10 | config DM_DEBUG_BLOCK_STACK_TRACING | ||
11 | boolean "Keep stack trace of persistent data block lock holders" | ||
12 | depends on STACKTRACE_SUPPORT && DM_PERSISTENT_DATA | ||
13 | select STACKTRACE | ||
14 | ---help--- | ||
15 | Enable this for messages that may help debug problems with the | ||
16 | block manager locking used by thin provisioning and caching. | ||
17 | |||
18 | If unsure, say N. | ||
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c index 536782e3bcb7..786b689bdfc7 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.c +++ b/drivers/md/persistent-data/dm-space-map-metadata.c | |||
@@ -91,6 +91,69 @@ struct block_op { | |||
91 | dm_block_t block; | 91 | dm_block_t block; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | struct bop_ring_buffer { | ||
95 | unsigned begin; | ||
96 | unsigned end; | ||
97 | struct block_op bops[MAX_RECURSIVE_ALLOCATIONS + 1]; | ||
98 | }; | ||
99 | |||
100 | static void brb_init(struct bop_ring_buffer *brb) | ||
101 | { | ||
102 | brb->begin = 0; | ||
103 | brb->end = 0; | ||
104 | } | ||
105 | |||
106 | static bool brb_empty(struct bop_ring_buffer *brb) | ||
107 | { | ||
108 | return brb->begin == brb->end; | ||
109 | } | ||
110 | |||
111 | static unsigned brb_next(struct bop_ring_buffer *brb, unsigned old) | ||
112 | { | ||
113 | unsigned r = old + 1; | ||
114 | return (r >= (sizeof(brb->bops) / sizeof(*brb->bops))) ? 0 : r; | ||
115 | } | ||
116 | |||
117 | static int brb_push(struct bop_ring_buffer *brb, | ||
118 | enum block_op_type type, dm_block_t b) | ||
119 | { | ||
120 | struct block_op *bop; | ||
121 | unsigned next = brb_next(brb, brb->end); | ||
122 | |||
123 | /* | ||
124 | * We don't allow the last bop to be filled, this way we can | ||
125 | * differentiate between full and empty. | ||
126 | */ | ||
127 | if (next == brb->begin) | ||
128 | return -ENOMEM; | ||
129 | |||
130 | bop = brb->bops + brb->end; | ||
131 | bop->type = type; | ||
132 | bop->block = b; | ||
133 | |||
134 | brb->end = next; | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int brb_pop(struct bop_ring_buffer *brb, struct block_op *result) | ||
140 | { | ||
141 | struct block_op *bop; | ||
142 | |||
143 | if (brb_empty(brb)) | ||
144 | return -ENODATA; | ||
145 | |||
146 | bop = brb->bops + brb->begin; | ||
147 | result->type = bop->type; | ||
148 | result->block = bop->block; | ||
149 | |||
150 | brb->begin = brb_next(brb, brb->begin); | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | /*----------------------------------------------------------------*/ | ||
156 | |||
94 | struct sm_metadata { | 157 | struct sm_metadata { |
95 | struct dm_space_map sm; | 158 | struct dm_space_map sm; |
96 | 159 | ||
@@ -101,25 +164,20 @@ struct sm_metadata { | |||
101 | 164 | ||
102 | unsigned recursion_count; | 165 | unsigned recursion_count; |
103 | unsigned allocated_this_transaction; | 166 | unsigned allocated_this_transaction; |
104 | unsigned nr_uncommitted; | 167 | struct bop_ring_buffer uncommitted; |
105 | struct block_op uncommitted[MAX_RECURSIVE_ALLOCATIONS]; | ||
106 | 168 | ||
107 | struct threshold threshold; | 169 | struct threshold threshold; |
108 | }; | 170 | }; |
109 | 171 | ||
110 | static int add_bop(struct sm_metadata *smm, enum block_op_type type, dm_block_t b) | 172 | static int add_bop(struct sm_metadata *smm, enum block_op_type type, dm_block_t b) |
111 | { | 173 | { |
112 | struct block_op *op; | 174 | int r = brb_push(&smm->uncommitted, type, b); |
113 | 175 | ||
114 | if (smm->nr_uncommitted == MAX_RECURSIVE_ALLOCATIONS) { | 176 | if (r) { |
115 | DMERR("too many recursive allocations"); | 177 | DMERR("too many recursive allocations"); |
116 | return -ENOMEM; | 178 | return -ENOMEM; |
117 | } | 179 | } |
118 | 180 | ||
119 | op = smm->uncommitted + smm->nr_uncommitted++; | ||
120 | op->type = type; | ||
121 | op->block = b; | ||
122 | |||
123 | return 0; | 181 | return 0; |
124 | } | 182 | } |
125 | 183 | ||
@@ -158,11 +216,17 @@ static int out(struct sm_metadata *smm) | |||
158 | return -ENOMEM; | 216 | return -ENOMEM; |
159 | } | 217 | } |
160 | 218 | ||
161 | if (smm->recursion_count == 1 && smm->nr_uncommitted) { | 219 | if (smm->recursion_count == 1) { |
162 | while (smm->nr_uncommitted && !r) { | 220 | while (!brb_empty(&smm->uncommitted)) { |
163 | smm->nr_uncommitted--; | 221 | struct block_op bop; |
164 | r = commit_bop(smm, smm->uncommitted + | 222 | |
165 | smm->nr_uncommitted); | 223 | r = brb_pop(&smm->uncommitted, &bop); |
224 | if (r) { | ||
225 | DMERR("bug in bop ring buffer"); | ||
226 | break; | ||
227 | } | ||
228 | |||
229 | r = commit_bop(smm, &bop); | ||
166 | if (r) | 230 | if (r) |
167 | break; | 231 | break; |
168 | } | 232 | } |
@@ -217,7 +281,8 @@ static int sm_metadata_get_nr_free(struct dm_space_map *sm, dm_block_t *count) | |||
217 | static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, | 281 | static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, |
218 | uint32_t *result) | 282 | uint32_t *result) |
219 | { | 283 | { |
220 | int r, i; | 284 | int r; |
285 | unsigned i; | ||
221 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); | 286 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); |
222 | unsigned adjustment = 0; | 287 | unsigned adjustment = 0; |
223 | 288 | ||
@@ -225,8 +290,10 @@ static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, | |||
225 | * We may have some uncommitted adjustments to add. This list | 290 | * We may have some uncommitted adjustments to add. This list |
226 | * should always be really short. | 291 | * should always be really short. |
227 | */ | 292 | */ |
228 | for (i = 0; i < smm->nr_uncommitted; i++) { | 293 | for (i = smm->uncommitted.begin; |
229 | struct block_op *op = smm->uncommitted + i; | 294 | i != smm->uncommitted.end; |
295 | i = brb_next(&smm->uncommitted, i)) { | ||
296 | struct block_op *op = smm->uncommitted.bops + i; | ||
230 | 297 | ||
231 | if (op->block != b) | 298 | if (op->block != b) |
232 | continue; | 299 | continue; |
@@ -254,7 +321,8 @@ static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, | |||
254 | static int sm_metadata_count_is_more_than_one(struct dm_space_map *sm, | 321 | static int sm_metadata_count_is_more_than_one(struct dm_space_map *sm, |
255 | dm_block_t b, int *result) | 322 | dm_block_t b, int *result) |
256 | { | 323 | { |
257 | int r, i, adjustment = 0; | 324 | int r, adjustment = 0; |
325 | unsigned i; | ||
258 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); | 326 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); |
259 | uint32_t rc; | 327 | uint32_t rc; |
260 | 328 | ||
@@ -262,8 +330,11 @@ static int sm_metadata_count_is_more_than_one(struct dm_space_map *sm, | |||
262 | * We may have some uncommitted adjustments to add. This list | 330 | * We may have some uncommitted adjustments to add. This list |
263 | * should always be really short. | 331 | * should always be really short. |
264 | */ | 332 | */ |
265 | for (i = 0; i < smm->nr_uncommitted; i++) { | 333 | for (i = smm->uncommitted.begin; |
266 | struct block_op *op = smm->uncommitted + i; | 334 | i != smm->uncommitted.end; |
335 | i = brb_next(&smm->uncommitted, i)) { | ||
336 | |||
337 | struct block_op *op = smm->uncommitted.bops + i; | ||
267 | 338 | ||
268 | if (op->block != b) | 339 | if (op->block != b) |
269 | continue; | 340 | continue; |
@@ -671,7 +742,7 @@ int dm_sm_metadata_create(struct dm_space_map *sm, | |||
671 | smm->begin = superblock + 1; | 742 | smm->begin = superblock + 1; |
672 | smm->recursion_count = 0; | 743 | smm->recursion_count = 0; |
673 | smm->allocated_this_transaction = 0; | 744 | smm->allocated_this_transaction = 0; |
674 | smm->nr_uncommitted = 0; | 745 | brb_init(&smm->uncommitted); |
675 | threshold_init(&smm->threshold); | 746 | threshold_init(&smm->threshold); |
676 | 747 | ||
677 | memcpy(&smm->sm, &bootstrap_ops, sizeof(smm->sm)); | 748 | memcpy(&smm->sm, &bootstrap_ops, sizeof(smm->sm)); |
@@ -680,6 +751,8 @@ int dm_sm_metadata_create(struct dm_space_map *sm, | |||
680 | if (r) | 751 | if (r) |
681 | return r; | 752 | return r; |
682 | 753 | ||
754 | if (nr_blocks > DM_SM_METADATA_MAX_BLOCKS) | ||
755 | nr_blocks = DM_SM_METADATA_MAX_BLOCKS; | ||
683 | r = sm_ll_extend(&smm->ll, nr_blocks); | 756 | r = sm_ll_extend(&smm->ll, nr_blocks); |
684 | if (r) | 757 | if (r) |
685 | return r; | 758 | return r; |
@@ -713,7 +786,7 @@ int dm_sm_metadata_open(struct dm_space_map *sm, | |||
713 | smm->begin = 0; | 786 | smm->begin = 0; |
714 | smm->recursion_count = 0; | 787 | smm->recursion_count = 0; |
715 | smm->allocated_this_transaction = 0; | 788 | smm->allocated_this_transaction = 0; |
716 | smm->nr_uncommitted = 0; | 789 | brb_init(&smm->uncommitted); |
717 | threshold_init(&smm->threshold); | 790 | threshold_init(&smm->threshold); |
718 | 791 | ||
719 | memcpy(&smm->old_ll, &smm->ll, sizeof(smm->old_ll)); | 792 | memcpy(&smm->old_ll, &smm->ll, sizeof(smm->old_ll)); |
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.h b/drivers/md/persistent-data/dm-space-map-metadata.h index 39bba0801cf2..64df923974d8 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.h +++ b/drivers/md/persistent-data/dm-space-map-metadata.h | |||
@@ -9,6 +9,17 @@ | |||
9 | 9 | ||
10 | #include "dm-transaction-manager.h" | 10 | #include "dm-transaction-manager.h" |
11 | 11 | ||
12 | #define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT) | ||
13 | |||
14 | /* | ||
15 | * The metadata device is currently limited in size. | ||
16 | * | ||
17 | * We have one block of index, which can hold 255 index entries. Each | ||
18 | * index entry contains allocation info about ~16k metadata blocks. | ||
19 | */ | ||
20 | #define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64)) | ||
21 | #define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE) | ||
22 | |||
12 | /* | 23 | /* |
13 | * Unfortunately we have to use two-phase construction due to the cycle | 24 | * Unfortunately we have to use two-phase construction due to the cycle |
14 | * between the tm and sm. | 25 | * between the tm and sm. |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index b9e2000969f0..95c894482fdd 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
@@ -240,7 +240,7 @@ xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name, | |||
240 | 240 | ||
241 | nid = cpu_to_node(cpu); | 241 | nid = cpu_to_node(cpu); |
242 | page = alloc_pages_exact_node(nid, | 242 | page = alloc_pages_exact_node(nid, |
243 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 243 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
244 | pg_order); | 244 | pg_order); |
245 | if (page == NULL) { | 245 | if (page == NULL) { |
246 | dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d " | 246 | dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d " |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 59eba5d2c685..9715a7ba164a 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1584,7 +1584,7 @@ read_retry: | |||
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | if (mtd->ecc_stats.failed - ecc_failures) { | 1586 | if (mtd->ecc_stats.failed - ecc_failures) { |
1587 | if (retry_mode + 1 <= chip->read_retries) { | 1587 | if (retry_mode + 1 < chip->read_retries) { |
1588 | retry_mode++; | 1588 | retry_mode++; |
1589 | ret = nand_setup_read_retry(mtd, | 1589 | ret = nand_setup_read_retry(mtd, |
1590 | retry_mode); | 1590 | retry_mode); |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index ef4190a02b7b..bf642ceef681 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -1633,6 +1633,7 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1633 | int i; | 1633 | int i; |
1634 | dma_cap_mask_t mask; | 1634 | dma_cap_mask_t mask; |
1635 | unsigned sig; | 1635 | unsigned sig; |
1636 | unsigned oob_index; | ||
1636 | struct resource *res; | 1637 | struct resource *res; |
1637 | struct mtd_part_parser_data ppdata = {}; | 1638 | struct mtd_part_parser_data ppdata = {}; |
1638 | 1639 | ||
@@ -1826,11 +1827,14 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1826 | (mtd->writesize / | 1827 | (mtd->writesize / |
1827 | nand_chip->ecc.size); | 1828 | nand_chip->ecc.size); |
1828 | if (nand_chip->options & NAND_BUSWIDTH_16) | 1829 | if (nand_chip->options & NAND_BUSWIDTH_16) |
1829 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1830 | oob_index = BADBLOCK_MARKER_LENGTH; |
1830 | else | 1831 | else |
1831 | ecclayout->eccpos[0] = 1; | 1832 | oob_index = 1; |
1832 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1833 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1833 | ecclayout->eccbytes; | 1834 | ecclayout->eccpos[i] = oob_index; |
1835 | /* no reserved-marker in ecclayout for this ecc-scheme */ | ||
1836 | ecclayout->oobfree->offset = | ||
1837 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1834 | break; | 1838 | break; |
1835 | 1839 | ||
1836 | case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: | 1840 | case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: |
@@ -1847,9 +1851,15 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1847 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1851 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1848 | (mtd->writesize / | 1852 | (mtd->writesize / |
1849 | nand_chip->ecc.size); | 1853 | nand_chip->ecc.size); |
1850 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1854 | oob_index = BADBLOCK_MARKER_LENGTH; |
1851 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1855 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) { |
1852 | ecclayout->eccbytes; | 1856 | ecclayout->eccpos[i] = oob_index; |
1857 | if (((i + 1) % nand_chip->ecc.bytes) == 0) | ||
1858 | oob_index++; | ||
1859 | } | ||
1860 | /* include reserved-marker in ecclayout->oobfree calculation */ | ||
1861 | ecclayout->oobfree->offset = 1 + | ||
1862 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1853 | /* software bch library is used for locating errors */ | 1863 | /* software bch library is used for locating errors */ |
1854 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1864 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1855 | nand_chip->ecc.size, | 1865 | nand_chip->ecc.size, |
@@ -1883,9 +1893,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1883 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1893 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1884 | (mtd->writesize / | 1894 | (mtd->writesize / |
1885 | nand_chip->ecc.size); | 1895 | nand_chip->ecc.size); |
1886 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1896 | oob_index = BADBLOCK_MARKER_LENGTH; |
1887 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1897 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1888 | ecclayout->eccbytes; | 1898 | ecclayout->eccpos[i] = oob_index; |
1899 | /* reserved marker already included in ecclayout->eccbytes */ | ||
1900 | ecclayout->oobfree->offset = | ||
1901 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1889 | /* This ECC scheme requires ELM H/W block */ | 1902 | /* This ECC scheme requires ELM H/W block */ |
1890 | if (is_elm_present(info, pdata->elm_of_node, BCH4_ECC) < 0) { | 1903 | if (is_elm_present(info, pdata->elm_of_node, BCH4_ECC) < 0) { |
1891 | pr_err("nand: error: could not initialize ELM\n"); | 1904 | pr_err("nand: error: could not initialize ELM\n"); |
@@ -1913,9 +1926,15 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1913 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1926 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1914 | (mtd->writesize / | 1927 | (mtd->writesize / |
1915 | nand_chip->ecc.size); | 1928 | nand_chip->ecc.size); |
1916 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1929 | oob_index = BADBLOCK_MARKER_LENGTH; |
1917 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1930 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) { |
1918 | ecclayout->eccbytes; | 1931 | ecclayout->eccpos[i] = oob_index; |
1932 | if (((i + 1) % nand_chip->ecc.bytes) == 0) | ||
1933 | oob_index++; | ||
1934 | } | ||
1935 | /* include reserved-marker in ecclayout->oobfree calculation */ | ||
1936 | ecclayout->oobfree->offset = 1 + | ||
1937 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1919 | /* software bch library is used for locating errors */ | 1938 | /* software bch library is used for locating errors */ |
1920 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1939 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1921 | nand_chip->ecc.size, | 1940 | nand_chip->ecc.size, |
@@ -1956,9 +1975,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1956 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1975 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1957 | (mtd->writesize / | 1976 | (mtd->writesize / |
1958 | nand_chip->ecc.size); | 1977 | nand_chip->ecc.size); |
1959 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1978 | oob_index = BADBLOCK_MARKER_LENGTH; |
1960 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1979 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1961 | ecclayout->eccbytes; | 1980 | ecclayout->eccpos[i] = oob_index; |
1981 | /* reserved marker already included in ecclayout->eccbytes */ | ||
1982 | ecclayout->oobfree->offset = | ||
1983 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1962 | break; | 1984 | break; |
1963 | #else | 1985 | #else |
1964 | pr_err("nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled\n"); | 1986 | pr_err("nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled\n"); |
@@ -1972,11 +1994,8 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1972 | goto return_error; | 1994 | goto return_error; |
1973 | } | 1995 | } |
1974 | 1996 | ||
1975 | /* populate remaining ECC layout data */ | 1997 | /* all OOB bytes from oobfree->offset till end off OOB are free */ |
1976 | ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH + | 1998 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; |
1977 | ecclayout->eccbytes); | ||
1978 | for (i = 1; i < ecclayout->eccbytes; i++) | ||
1979 | ecclayout->eccpos[i] = ecclayout->eccpos[0] + i; | ||
1980 | /* check if NAND device's OOB is enough to store ECC signatures */ | 1999 | /* check if NAND device's OOB is enough to store ECC signatures */ |
1981 | if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { | 2000 | if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { |
1982 | pr_err("not enough OOB bytes required = %d, available=%d\n", | 2001 | pr_err("not enough OOB bytes required = %d, available=%d\n", |
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index ead861307b3c..c5dad652614d 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
@@ -463,8 +463,8 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
463 | } | 463 | } |
464 | } | 464 | } |
465 | if (found_orphan) { | 465 | if (found_orphan) { |
466 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
467 | list_del(&tmp_aeb->u.list); | 466 | list_del(&tmp_aeb->u.list); |
467 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
468 | } | 468 | } |
469 | 469 | ||
470 | new_aeb = kmem_cache_alloc(ai->aeb_slab_cache, | 470 | new_aeb = kmem_cache_alloc(ai->aeb_slab_cache, |
@@ -846,16 +846,16 @@ fail_bad: | |||
846 | ret = UBI_BAD_FASTMAP; | 846 | ret = UBI_BAD_FASTMAP; |
847 | fail: | 847 | fail: |
848 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) { | 848 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) { |
849 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
850 | list_del(&tmp_aeb->u.list); | 849 | list_del(&tmp_aeb->u.list); |
850 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
851 | } | 851 | } |
852 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) { | 852 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) { |
853 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
854 | list_del(&tmp_aeb->u.list); | 853 | list_del(&tmp_aeb->u.list); |
854 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
855 | } | 855 | } |
856 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) { | 856 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) { |
857 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
858 | list_del(&tmp_aeb->u.list); | 857 | list_del(&tmp_aeb->u.list); |
858 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
859 | } | 859 | } |
860 | 860 | ||
861 | return ret; | 861 | return ret; |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 6d20fbde8d43..dcde56057fe1 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -181,7 +181,7 @@ static inline int __agg_has_partner(struct aggregator *agg) | |||
181 | */ | 181 | */ |
182 | static inline void __disable_port(struct port *port) | 182 | static inline void __disable_port(struct port *port) |
183 | { | 183 | { |
184 | bond_set_slave_inactive_flags(port->slave); | 184 | bond_set_slave_inactive_flags(port->slave, BOND_SLAVE_NOTIFY_LATER); |
185 | } | 185 | } |
186 | 186 | ||
187 | /** | 187 | /** |
@@ -193,7 +193,7 @@ static inline void __enable_port(struct port *port) | |||
193 | struct slave *slave = port->slave; | 193 | struct slave *slave = port->slave; |
194 | 194 | ||
195 | if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev)) | 195 | if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev)) |
196 | bond_set_slave_active_flags(slave); | 196 | bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER); |
197 | } | 197 | } |
198 | 198 | ||
199 | /** | 199 | /** |
@@ -2062,6 +2062,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2062 | struct list_head *iter; | 2062 | struct list_head *iter; |
2063 | struct slave *slave; | 2063 | struct slave *slave; |
2064 | struct port *port; | 2064 | struct port *port; |
2065 | bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER; | ||
2065 | 2066 | ||
2066 | read_lock(&bond->lock); | 2067 | read_lock(&bond->lock); |
2067 | rcu_read_lock(); | 2068 | rcu_read_lock(); |
@@ -2119,8 +2120,19 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2119 | } | 2120 | } |
2120 | 2121 | ||
2121 | re_arm: | 2122 | re_arm: |
2123 | bond_for_each_slave_rcu(bond, slave, iter) { | ||
2124 | if (slave->should_notify) { | ||
2125 | should_notify_rtnl = BOND_SLAVE_NOTIFY_NOW; | ||
2126 | break; | ||
2127 | } | ||
2128 | } | ||
2122 | rcu_read_unlock(); | 2129 | rcu_read_unlock(); |
2123 | read_unlock(&bond->lock); | 2130 | read_unlock(&bond->lock); |
2131 | |||
2132 | if (should_notify_rtnl && rtnl_trylock()) { | ||
2133 | bond_slave_state_notify(bond); | ||
2134 | rtnl_unlock(); | ||
2135 | } | ||
2124 | queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks); | 2136 | queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks); |
2125 | } | 2137 | } |
2126 | 2138 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index a2c47476804d..e8f133e926aa 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -730,7 +730,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
730 | client_info->ntt = 0; | 730 | client_info->ntt = 0; |
731 | } | 731 | } |
732 | 732 | ||
733 | if (!vlan_get_tag(skb, &client_info->vlan_id)) | 733 | if (vlan_get_tag(skb, &client_info->vlan_id)) |
734 | client_info->vlan_id = 0; | 734 | client_info->vlan_id = 0; |
735 | 735 | ||
736 | if (!client_info->assigned) { | 736 | if (!client_info->assigned) { |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 1c6104d3501d..e5628fc725c3 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -829,21 +829,25 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
829 | if (bond_is_lb(bond)) { | 829 | if (bond_is_lb(bond)) { |
830 | bond_alb_handle_active_change(bond, new_active); | 830 | bond_alb_handle_active_change(bond, new_active); |
831 | if (old_active) | 831 | if (old_active) |
832 | bond_set_slave_inactive_flags(old_active); | 832 | bond_set_slave_inactive_flags(old_active, |
833 | BOND_SLAVE_NOTIFY_NOW); | ||
833 | if (new_active) | 834 | if (new_active) |
834 | bond_set_slave_active_flags(new_active); | 835 | bond_set_slave_active_flags(new_active, |
836 | BOND_SLAVE_NOTIFY_NOW); | ||
835 | } else { | 837 | } else { |
836 | rcu_assign_pointer(bond->curr_active_slave, new_active); | 838 | rcu_assign_pointer(bond->curr_active_slave, new_active); |
837 | } | 839 | } |
838 | 840 | ||
839 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { | 841 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { |
840 | if (old_active) | 842 | if (old_active) |
841 | bond_set_slave_inactive_flags(old_active); | 843 | bond_set_slave_inactive_flags(old_active, |
844 | BOND_SLAVE_NOTIFY_NOW); | ||
842 | 845 | ||
843 | if (new_active) { | 846 | if (new_active) { |
844 | bool should_notify_peers = false; | 847 | bool should_notify_peers = false; |
845 | 848 | ||
846 | bond_set_slave_active_flags(new_active); | 849 | bond_set_slave_active_flags(new_active, |
850 | BOND_SLAVE_NOTIFY_NOW); | ||
847 | 851 | ||
848 | if (bond->params.fail_over_mac) | 852 | if (bond->params.fail_over_mac) |
849 | bond_do_fail_over_mac(bond, new_active, | 853 | bond_do_fail_over_mac(bond, new_active, |
@@ -1193,6 +1197,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1193 | return -EBUSY; | 1197 | return -EBUSY; |
1194 | } | 1198 | } |
1195 | 1199 | ||
1200 | if (bond_dev == slave_dev) { | ||
1201 | pr_err("%s: cannot enslave bond to itself.\n", bond_dev->name); | ||
1202 | return -EPERM; | ||
1203 | } | ||
1204 | |||
1196 | /* vlan challenged mutual exclusion */ | 1205 | /* vlan challenged mutual exclusion */ |
1197 | /* no need to lock since we're protected by rtnl_lock */ | 1206 | /* no need to lock since we're protected by rtnl_lock */ |
1198 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { | 1207 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { |
@@ -1463,14 +1472,15 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1463 | 1472 | ||
1464 | switch (bond->params.mode) { | 1473 | switch (bond->params.mode) { |
1465 | case BOND_MODE_ACTIVEBACKUP: | 1474 | case BOND_MODE_ACTIVEBACKUP: |
1466 | bond_set_slave_inactive_flags(new_slave); | 1475 | bond_set_slave_inactive_flags(new_slave, |
1476 | BOND_SLAVE_NOTIFY_NOW); | ||
1467 | break; | 1477 | break; |
1468 | case BOND_MODE_8023AD: | 1478 | case BOND_MODE_8023AD: |
1469 | /* in 802.3ad mode, the internal mechanism | 1479 | /* in 802.3ad mode, the internal mechanism |
1470 | * will activate the slaves in the selected | 1480 | * will activate the slaves in the selected |
1471 | * aggregator | 1481 | * aggregator |
1472 | */ | 1482 | */ |
1473 | bond_set_slave_inactive_flags(new_slave); | 1483 | bond_set_slave_inactive_flags(new_slave, BOND_SLAVE_NOTIFY_NOW); |
1474 | /* if this is the first slave */ | 1484 | /* if this is the first slave */ |
1475 | if (!prev_slave) { | 1485 | if (!prev_slave) { |
1476 | SLAVE_AD_INFO(new_slave).id = 1; | 1486 | SLAVE_AD_INFO(new_slave).id = 1; |
@@ -1488,7 +1498,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1488 | case BOND_MODE_TLB: | 1498 | case BOND_MODE_TLB: |
1489 | case BOND_MODE_ALB: | 1499 | case BOND_MODE_ALB: |
1490 | bond_set_active_slave(new_slave); | 1500 | bond_set_active_slave(new_slave); |
1491 | bond_set_slave_inactive_flags(new_slave); | 1501 | bond_set_slave_inactive_flags(new_slave, BOND_SLAVE_NOTIFY_NOW); |
1492 | break; | 1502 | break; |
1493 | default: | 1503 | default: |
1494 | pr_debug("This slave is always active in trunk mode\n"); | 1504 | pr_debug("This slave is always active in trunk mode\n"); |
@@ -1654,9 +1664,6 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1654 | return -EINVAL; | 1664 | return -EINVAL; |
1655 | } | 1665 | } |
1656 | 1666 | ||
1657 | /* release the slave from its bond */ | ||
1658 | bond->slave_cnt--; | ||
1659 | |||
1660 | bond_sysfs_slave_del(slave); | 1667 | bond_sysfs_slave_del(slave); |
1661 | 1668 | ||
1662 | bond_upper_dev_unlink(bond_dev, slave_dev); | 1669 | bond_upper_dev_unlink(bond_dev, slave_dev); |
@@ -1738,6 +1745,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1738 | 1745 | ||
1739 | unblock_netpoll_tx(); | 1746 | unblock_netpoll_tx(); |
1740 | synchronize_rcu(); | 1747 | synchronize_rcu(); |
1748 | bond->slave_cnt--; | ||
1741 | 1749 | ||
1742 | if (!bond_has_slaves(bond)) { | 1750 | if (!bond_has_slaves(bond)) { |
1743 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | 1751 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); |
@@ -2015,7 +2023,8 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2015 | 2023 | ||
2016 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || | 2024 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || |
2017 | bond->params.mode == BOND_MODE_8023AD) | 2025 | bond->params.mode == BOND_MODE_8023AD) |
2018 | bond_set_slave_inactive_flags(slave); | 2026 | bond_set_slave_inactive_flags(slave, |
2027 | BOND_SLAVE_NOTIFY_NOW); | ||
2019 | 2028 | ||
2020 | pr_info("%s: link status definitely down for interface %s, disabling it\n", | 2029 | pr_info("%s: link status definitely down for interface %s, disabling it\n", |
2021 | bond->dev->name, slave->dev->name); | 2030 | bond->dev->name, slave->dev->name); |
@@ -2562,7 +2571,8 @@ static void bond_ab_arp_commit(struct bonding *bond) | |||
2562 | slave->link = BOND_LINK_UP; | 2571 | slave->link = BOND_LINK_UP; |
2563 | if (bond->current_arp_slave) { | 2572 | if (bond->current_arp_slave) { |
2564 | bond_set_slave_inactive_flags( | 2573 | bond_set_slave_inactive_flags( |
2565 | bond->current_arp_slave); | 2574 | bond->current_arp_slave, |
2575 | BOND_SLAVE_NOTIFY_NOW); | ||
2566 | bond->current_arp_slave = NULL; | 2576 | bond->current_arp_slave = NULL; |
2567 | } | 2577 | } |
2568 | 2578 | ||
@@ -2582,7 +2592,8 @@ static void bond_ab_arp_commit(struct bonding *bond) | |||
2582 | slave->link_failure_count++; | 2592 | slave->link_failure_count++; |
2583 | 2593 | ||
2584 | slave->link = BOND_LINK_DOWN; | 2594 | slave->link = BOND_LINK_DOWN; |
2585 | bond_set_slave_inactive_flags(slave); | 2595 | bond_set_slave_inactive_flags(slave, |
2596 | BOND_SLAVE_NOTIFY_NOW); | ||
2586 | 2597 | ||
2587 | pr_info("%s: link status definitely down for interface %s, disabling it\n", | 2598 | pr_info("%s: link status definitely down for interface %s, disabling it\n", |
2588 | bond->dev->name, slave->dev->name); | 2599 | bond->dev->name, slave->dev->name); |
@@ -2615,17 +2626,17 @@ do_failover: | |||
2615 | 2626 | ||
2616 | /* | 2627 | /* |
2617 | * Send ARP probes for active-backup mode ARP monitor. | 2628 | * Send ARP probes for active-backup mode ARP monitor. |
2629 | * | ||
2630 | * Called with rcu_read_lock hold. | ||
2618 | */ | 2631 | */ |
2619 | static bool bond_ab_arp_probe(struct bonding *bond) | 2632 | static bool bond_ab_arp_probe(struct bonding *bond) |
2620 | { | 2633 | { |
2621 | struct slave *slave, *before = NULL, *new_slave = NULL, | 2634 | struct slave *slave, *before = NULL, *new_slave = NULL, |
2622 | *curr_arp_slave, *curr_active_slave; | 2635 | *curr_arp_slave = rcu_dereference(bond->current_arp_slave), |
2636 | *curr_active_slave = rcu_dereference(bond->curr_active_slave); | ||
2623 | struct list_head *iter; | 2637 | struct list_head *iter; |
2624 | bool found = false; | 2638 | bool found = false; |
2625 | 2639 | bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER; | |
2626 | rcu_read_lock(); | ||
2627 | curr_arp_slave = rcu_dereference(bond->current_arp_slave); | ||
2628 | curr_active_slave = rcu_dereference(bond->curr_active_slave); | ||
2629 | 2640 | ||
2630 | if (curr_arp_slave && curr_active_slave) | 2641 | if (curr_arp_slave && curr_active_slave) |
2631 | pr_info("PROBE: c_arp %s && cas %s BAD\n", | 2642 | pr_info("PROBE: c_arp %s && cas %s BAD\n", |
@@ -2634,32 +2645,23 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2634 | 2645 | ||
2635 | if (curr_active_slave) { | 2646 | if (curr_active_slave) { |
2636 | bond_arp_send_all(bond, curr_active_slave); | 2647 | bond_arp_send_all(bond, curr_active_slave); |
2637 | rcu_read_unlock(); | 2648 | return should_notify_rtnl; |
2638 | return true; | ||
2639 | } | 2649 | } |
2640 | rcu_read_unlock(); | ||
2641 | 2650 | ||
2642 | /* if we don't have a curr_active_slave, search for the next available | 2651 | /* if we don't have a curr_active_slave, search for the next available |
2643 | * backup slave from the current_arp_slave and make it the candidate | 2652 | * backup slave from the current_arp_slave and make it the candidate |
2644 | * for becoming the curr_active_slave | 2653 | * for becoming the curr_active_slave |
2645 | */ | 2654 | */ |
2646 | 2655 | ||
2647 | if (!rtnl_trylock()) | ||
2648 | return false; | ||
2649 | /* curr_arp_slave might have gone away */ | ||
2650 | curr_arp_slave = ACCESS_ONCE(bond->current_arp_slave); | ||
2651 | |||
2652 | if (!curr_arp_slave) { | 2656 | if (!curr_arp_slave) { |
2653 | curr_arp_slave = bond_first_slave(bond); | 2657 | curr_arp_slave = bond_first_slave_rcu(bond); |
2654 | if (!curr_arp_slave) { | 2658 | if (!curr_arp_slave) |
2655 | rtnl_unlock(); | 2659 | return should_notify_rtnl; |
2656 | return true; | ||
2657 | } | ||
2658 | } | 2660 | } |
2659 | 2661 | ||
2660 | bond_set_slave_inactive_flags(curr_arp_slave); | 2662 | bond_set_slave_inactive_flags(curr_arp_slave, BOND_SLAVE_NOTIFY_LATER); |
2661 | 2663 | ||
2662 | bond_for_each_slave(bond, slave, iter) { | 2664 | bond_for_each_slave_rcu(bond, slave, iter) { |
2663 | if (!found && !before && IS_UP(slave->dev)) | 2665 | if (!found && !before && IS_UP(slave->dev)) |
2664 | before = slave; | 2666 | before = slave; |
2665 | 2667 | ||
@@ -2677,7 +2679,8 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2677 | if (slave->link_failure_count < UINT_MAX) | 2679 | if (slave->link_failure_count < UINT_MAX) |
2678 | slave->link_failure_count++; | 2680 | slave->link_failure_count++; |
2679 | 2681 | ||
2680 | bond_set_slave_inactive_flags(slave); | 2682 | bond_set_slave_inactive_flags(slave, |
2683 | BOND_SLAVE_NOTIFY_LATER); | ||
2681 | 2684 | ||
2682 | pr_info("%s: backup interface %s is now down.\n", | 2685 | pr_info("%s: backup interface %s is now down.\n", |
2683 | bond->dev->name, slave->dev->name); | 2686 | bond->dev->name, slave->dev->name); |
@@ -2689,26 +2692,31 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2689 | if (!new_slave && before) | 2692 | if (!new_slave && before) |
2690 | new_slave = before; | 2693 | new_slave = before; |
2691 | 2694 | ||
2692 | if (!new_slave) { | 2695 | if (!new_slave) |
2693 | rtnl_unlock(); | 2696 | goto check_state; |
2694 | return true; | ||
2695 | } | ||
2696 | 2697 | ||
2697 | new_slave->link = BOND_LINK_BACK; | 2698 | new_slave->link = BOND_LINK_BACK; |
2698 | bond_set_slave_active_flags(new_slave); | 2699 | bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER); |
2699 | bond_arp_send_all(bond, new_slave); | 2700 | bond_arp_send_all(bond, new_slave); |
2700 | new_slave->jiffies = jiffies; | 2701 | new_slave->jiffies = jiffies; |
2701 | rcu_assign_pointer(bond->current_arp_slave, new_slave); | 2702 | rcu_assign_pointer(bond->current_arp_slave, new_slave); |
2702 | rtnl_unlock(); | ||
2703 | 2703 | ||
2704 | return true; | 2704 | check_state: |
2705 | bond_for_each_slave_rcu(bond, slave, iter) { | ||
2706 | if (slave->should_notify) { | ||
2707 | should_notify_rtnl = BOND_SLAVE_NOTIFY_NOW; | ||
2708 | break; | ||
2709 | } | ||
2710 | } | ||
2711 | return should_notify_rtnl; | ||
2705 | } | 2712 | } |
2706 | 2713 | ||
2707 | static void bond_activebackup_arp_mon(struct work_struct *work) | 2714 | static void bond_activebackup_arp_mon(struct work_struct *work) |
2708 | { | 2715 | { |
2709 | struct bonding *bond = container_of(work, struct bonding, | 2716 | struct bonding *bond = container_of(work, struct bonding, |
2710 | arp_work.work); | 2717 | arp_work.work); |
2711 | bool should_notify_peers = false, should_commit = false; | 2718 | bool should_notify_peers = false; |
2719 | bool should_notify_rtnl = false; | ||
2712 | int delta_in_ticks; | 2720 | int delta_in_ticks; |
2713 | 2721 | ||
2714 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); | 2722 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); |
@@ -2717,11 +2725,12 @@ static void bond_activebackup_arp_mon(struct work_struct *work) | |||
2717 | goto re_arm; | 2725 | goto re_arm; |
2718 | 2726 | ||
2719 | rcu_read_lock(); | 2727 | rcu_read_lock(); |
2728 | |||
2720 | should_notify_peers = bond_should_notify_peers(bond); | 2729 | should_notify_peers = bond_should_notify_peers(bond); |
2721 | should_commit = bond_ab_arp_inspect(bond); | ||
2722 | rcu_read_unlock(); | ||
2723 | 2730 | ||
2724 | if (should_commit) { | 2731 | if (bond_ab_arp_inspect(bond)) { |
2732 | rcu_read_unlock(); | ||
2733 | |||
2725 | /* Race avoidance with bond_close flush of workqueue */ | 2734 | /* Race avoidance with bond_close flush of workqueue */ |
2726 | if (!rtnl_trylock()) { | 2735 | if (!rtnl_trylock()) { |
2727 | delta_in_ticks = 1; | 2736 | delta_in_ticks = 1; |
@@ -2730,23 +2739,28 @@ static void bond_activebackup_arp_mon(struct work_struct *work) | |||
2730 | } | 2739 | } |
2731 | 2740 | ||
2732 | bond_ab_arp_commit(bond); | 2741 | bond_ab_arp_commit(bond); |
2742 | |||
2733 | rtnl_unlock(); | 2743 | rtnl_unlock(); |
2744 | rcu_read_lock(); | ||
2734 | } | 2745 | } |
2735 | 2746 | ||
2736 | if (!bond_ab_arp_probe(bond)) { | 2747 | should_notify_rtnl = bond_ab_arp_probe(bond); |
2737 | /* rtnl locking failed, re-arm */ | 2748 | rcu_read_unlock(); |
2738 | delta_in_ticks = 1; | ||
2739 | should_notify_peers = false; | ||
2740 | } | ||
2741 | 2749 | ||
2742 | re_arm: | 2750 | re_arm: |
2743 | if (bond->params.arp_interval) | 2751 | if (bond->params.arp_interval) |
2744 | queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); | 2752 | queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); |
2745 | 2753 | ||
2746 | if (should_notify_peers) { | 2754 | if (should_notify_peers || should_notify_rtnl) { |
2747 | if (!rtnl_trylock()) | 2755 | if (!rtnl_trylock()) |
2748 | return; | 2756 | return; |
2749 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | 2757 | |
2758 | if (should_notify_peers) | ||
2759 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, | ||
2760 | bond->dev); | ||
2761 | if (should_notify_rtnl) | ||
2762 | bond_slave_state_notify(bond); | ||
2763 | |||
2750 | rtnl_unlock(); | 2764 | rtnl_unlock(); |
2751 | } | 2765 | } |
2752 | } | 2766 | } |
@@ -3046,9 +3060,11 @@ static int bond_open(struct net_device *bond_dev) | |||
3046 | bond_for_each_slave(bond, slave, iter) { | 3060 | bond_for_each_slave(bond, slave, iter) { |
3047 | if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) | 3061 | if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) |
3048 | && (slave != bond->curr_active_slave)) { | 3062 | && (slave != bond->curr_active_slave)) { |
3049 | bond_set_slave_inactive_flags(slave); | 3063 | bond_set_slave_inactive_flags(slave, |
3064 | BOND_SLAVE_NOTIFY_NOW); | ||
3050 | } else { | 3065 | } else { |
3051 | bond_set_slave_active_flags(slave); | 3066 | bond_set_slave_active_flags(slave, |
3067 | BOND_SLAVE_NOTIFY_NOW); | ||
3052 | } | 3068 | } |
3053 | } | 3069 | } |
3054 | read_unlock(&bond->curr_slave_lock); | 3070 | read_unlock(&bond->curr_slave_lock); |
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index c37878432717..298c26509095 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -121,6 +121,7 @@ static struct bond_opt_value bond_resend_igmp_tbl[] = { | |||
121 | static struct bond_opt_value bond_lp_interval_tbl[] = { | 121 | static struct bond_opt_value bond_lp_interval_tbl[] = { |
122 | { "minval", 1, BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT}, | 122 | { "minval", 1, BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT}, |
123 | { "maxval", INT_MAX, BOND_VALFLAG_MAX}, | 123 | { "maxval", INT_MAX, BOND_VALFLAG_MAX}, |
124 | { NULL, -1, 0}, | ||
124 | }; | 125 | }; |
125 | 126 | ||
126 | static struct bond_option bond_opts[] = { | 127 | static struct bond_option bond_opts[] = { |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 86ccfb9f71cc..2b0fdec695f7 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -195,7 +195,8 @@ struct slave { | |||
195 | s8 new_link; | 195 | s8 new_link; |
196 | u8 backup:1, /* indicates backup slave. Value corresponds with | 196 | u8 backup:1, /* indicates backup slave. Value corresponds with |
197 | BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ | 197 | BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ |
198 | inactive:1; /* indicates inactive slave */ | 198 | inactive:1, /* indicates inactive slave */ |
199 | should_notify:1; /* indicateds whether the state changed */ | ||
199 | u8 duplex; | 200 | u8 duplex; |
200 | u32 original_mtu; | 201 | u32 original_mtu; |
201 | u32 link_failure_count; | 202 | u32 link_failure_count; |
@@ -303,6 +304,24 @@ static inline void bond_set_backup_slave(struct slave *slave) | |||
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
307 | static inline void bond_set_slave_state(struct slave *slave, | ||
308 | int slave_state, bool notify) | ||
309 | { | ||
310 | if (slave->backup == slave_state) | ||
311 | return; | ||
312 | |||
313 | slave->backup = slave_state; | ||
314 | if (notify) { | ||
315 | rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); | ||
316 | slave->should_notify = 0; | ||
317 | } else { | ||
318 | if (slave->should_notify) | ||
319 | slave->should_notify = 0; | ||
320 | else | ||
321 | slave->should_notify = 1; | ||
322 | } | ||
323 | } | ||
324 | |||
306 | static inline void bond_slave_state_change(struct bonding *bond) | 325 | static inline void bond_slave_state_change(struct bonding *bond) |
307 | { | 326 | { |
308 | struct list_head *iter; | 327 | struct list_head *iter; |
@@ -316,6 +335,19 @@ static inline void bond_slave_state_change(struct bonding *bond) | |||
316 | } | 335 | } |
317 | } | 336 | } |
318 | 337 | ||
338 | static inline void bond_slave_state_notify(struct bonding *bond) | ||
339 | { | ||
340 | struct list_head *iter; | ||
341 | struct slave *tmp; | ||
342 | |||
343 | bond_for_each_slave(bond, tmp, iter) { | ||
344 | if (tmp->should_notify) { | ||
345 | rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_KERNEL); | ||
346 | tmp->should_notify = 0; | ||
347 | } | ||
348 | } | ||
349 | } | ||
350 | |||
319 | static inline int bond_slave_state(struct slave *slave) | 351 | static inline int bond_slave_state(struct slave *slave) |
320 | { | 352 | { |
321 | return slave->backup; | 353 | return slave->backup; |
@@ -343,6 +375,9 @@ static inline bool bond_is_active_slave(struct slave *slave) | |||
343 | #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ | 375 | #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ |
344 | BOND_ARP_VALIDATE_BACKUP) | 376 | BOND_ARP_VALIDATE_BACKUP) |
345 | 377 | ||
378 | #define BOND_SLAVE_NOTIFY_NOW true | ||
379 | #define BOND_SLAVE_NOTIFY_LATER false | ||
380 | |||
346 | static inline int slave_do_arp_validate(struct bonding *bond, | 381 | static inline int slave_do_arp_validate(struct bonding *bond, |
347 | struct slave *slave) | 382 | struct slave *slave) |
348 | { | 383 | { |
@@ -394,17 +429,19 @@ static inline void bond_netpoll_send_skb(const struct slave *slave, | |||
394 | } | 429 | } |
395 | #endif | 430 | #endif |
396 | 431 | ||
397 | static inline void bond_set_slave_inactive_flags(struct slave *slave) | 432 | static inline void bond_set_slave_inactive_flags(struct slave *slave, |
433 | bool notify) | ||
398 | { | 434 | { |
399 | if (!bond_is_lb(slave->bond)) | 435 | if (!bond_is_lb(slave->bond)) |
400 | bond_set_backup_slave(slave); | 436 | bond_set_slave_state(slave, BOND_STATE_BACKUP, notify); |
401 | if (!slave->bond->params.all_slaves_active) | 437 | if (!slave->bond->params.all_slaves_active) |
402 | slave->inactive = 1; | 438 | slave->inactive = 1; |
403 | } | 439 | } |
404 | 440 | ||
405 | static inline void bond_set_slave_active_flags(struct slave *slave) | 441 | static inline void bond_set_slave_active_flags(struct slave *slave, |
442 | bool notify) | ||
406 | { | 443 | { |
407 | bond_set_active_slave(slave); | 444 | bond_set_slave_state(slave, BOND_STATE_ACTIVE, notify); |
408 | slave->inactive = 0; | 445 | slave->inactive = 0; |
409 | } | 446 | } |
410 | 447 | ||
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 320bef2dba42..61376abdab39 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -144,6 +144,8 @@ | |||
144 | 144 | ||
145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) | 145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) |
146 | 146 | ||
147 | #define FLEXCAN_TIMEOUT_US (50) | ||
148 | |||
147 | /* | 149 | /* |
148 | * FLEXCAN hardware feature flags | 150 | * FLEXCAN hardware feature flags |
149 | * | 151 | * |
@@ -262,6 +264,22 @@ static inline void flexcan_write(u32 val, void __iomem *addr) | |||
262 | } | 264 | } |
263 | #endif | 265 | #endif |
264 | 266 | ||
267 | static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv) | ||
268 | { | ||
269 | if (!priv->reg_xceiver) | ||
270 | return 0; | ||
271 | |||
272 | return regulator_enable(priv->reg_xceiver); | ||
273 | } | ||
274 | |||
275 | static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv) | ||
276 | { | ||
277 | if (!priv->reg_xceiver) | ||
278 | return 0; | ||
279 | |||
280 | return regulator_disable(priv->reg_xceiver); | ||
281 | } | ||
282 | |||
265 | static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, | 283 | static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, |
266 | u32 reg_esr) | 284 | u32 reg_esr) |
267 | { | 285 | { |
@@ -269,26 +287,95 @@ static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, | |||
269 | (reg_esr & FLEXCAN_ESR_ERR_BUS); | 287 | (reg_esr & FLEXCAN_ESR_ERR_BUS); |
270 | } | 288 | } |
271 | 289 | ||
272 | static inline void flexcan_chip_enable(struct flexcan_priv *priv) | 290 | static int flexcan_chip_enable(struct flexcan_priv *priv) |
273 | { | 291 | { |
274 | struct flexcan_regs __iomem *regs = priv->base; | 292 | struct flexcan_regs __iomem *regs = priv->base; |
293 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
275 | u32 reg; | 294 | u32 reg; |
276 | 295 | ||
277 | reg = flexcan_read(®s->mcr); | 296 | reg = flexcan_read(®s->mcr); |
278 | reg &= ~FLEXCAN_MCR_MDIS; | 297 | reg &= ~FLEXCAN_MCR_MDIS; |
279 | flexcan_write(reg, ®s->mcr); | 298 | flexcan_write(reg, ®s->mcr); |
280 | 299 | ||
281 | udelay(10); | 300 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
301 | usleep_range(10, 20); | ||
302 | |||
303 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) | ||
304 | return -ETIMEDOUT; | ||
305 | |||
306 | return 0; | ||
282 | } | 307 | } |
283 | 308 | ||
284 | static inline void flexcan_chip_disable(struct flexcan_priv *priv) | 309 | static int flexcan_chip_disable(struct flexcan_priv *priv) |
285 | { | 310 | { |
286 | struct flexcan_regs __iomem *regs = priv->base; | 311 | struct flexcan_regs __iomem *regs = priv->base; |
312 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
287 | u32 reg; | 313 | u32 reg; |
288 | 314 | ||
289 | reg = flexcan_read(®s->mcr); | 315 | reg = flexcan_read(®s->mcr); |
290 | reg |= FLEXCAN_MCR_MDIS; | 316 | reg |= FLEXCAN_MCR_MDIS; |
291 | flexcan_write(reg, ®s->mcr); | 317 | flexcan_write(reg, ®s->mcr); |
318 | |||
319 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | ||
320 | usleep_range(10, 20); | ||
321 | |||
322 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | ||
323 | return -ETIMEDOUT; | ||
324 | |||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | static int flexcan_chip_freeze(struct flexcan_priv *priv) | ||
329 | { | ||
330 | struct flexcan_regs __iomem *regs = priv->base; | ||
331 | unsigned int timeout = 1000 * 1000 * 10 / priv->can.bittiming.bitrate; | ||
332 | u32 reg; | ||
333 | |||
334 | reg = flexcan_read(®s->mcr); | ||
335 | reg |= FLEXCAN_MCR_HALT; | ||
336 | flexcan_write(reg, ®s->mcr); | ||
337 | |||
338 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | ||
339 | usleep_range(100, 200); | ||
340 | |||
341 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | ||
342 | return -ETIMEDOUT; | ||
343 | |||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | static int flexcan_chip_unfreeze(struct flexcan_priv *priv) | ||
348 | { | ||
349 | struct flexcan_regs __iomem *regs = priv->base; | ||
350 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
351 | u32 reg; | ||
352 | |||
353 | reg = flexcan_read(®s->mcr); | ||
354 | reg &= ~FLEXCAN_MCR_HALT; | ||
355 | flexcan_write(reg, ®s->mcr); | ||
356 | |||
357 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | ||
358 | usleep_range(10, 20); | ||
359 | |||
360 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) | ||
361 | return -ETIMEDOUT; | ||
362 | |||
363 | return 0; | ||
364 | } | ||
365 | |||
366 | static int flexcan_chip_softreset(struct flexcan_priv *priv) | ||
367 | { | ||
368 | struct flexcan_regs __iomem *regs = priv->base; | ||
369 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
370 | |||
371 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); | ||
372 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) | ||
373 | usleep_range(10, 20); | ||
374 | |||
375 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) | ||
376 | return -ETIMEDOUT; | ||
377 | |||
378 | return 0; | ||
292 | } | 379 | } |
293 | 380 | ||
294 | static int flexcan_get_berr_counter(const struct net_device *dev, | 381 | static int flexcan_get_berr_counter(const struct net_device *dev, |
@@ -709,19 +796,14 @@ static int flexcan_chip_start(struct net_device *dev) | |||
709 | u32 reg_mcr, reg_ctrl; | 796 | u32 reg_mcr, reg_ctrl; |
710 | 797 | ||
711 | /* enable module */ | 798 | /* enable module */ |
712 | flexcan_chip_enable(priv); | 799 | err = flexcan_chip_enable(priv); |
800 | if (err) | ||
801 | return err; | ||
713 | 802 | ||
714 | /* soft reset */ | 803 | /* soft reset */ |
715 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); | 804 | err = flexcan_chip_softreset(priv); |
716 | udelay(10); | 805 | if (err) |
717 | 806 | goto out_chip_disable; | |
718 | reg_mcr = flexcan_read(®s->mcr); | ||
719 | if (reg_mcr & FLEXCAN_MCR_SOFTRST) { | ||
720 | netdev_err(dev, "Failed to softreset can module (mcr=0x%08x)\n", | ||
721 | reg_mcr); | ||
722 | err = -ENODEV; | ||
723 | goto out; | ||
724 | } | ||
725 | 807 | ||
726 | flexcan_set_bittiming(dev); | 808 | flexcan_set_bittiming(dev); |
727 | 809 | ||
@@ -788,16 +870,14 @@ static int flexcan_chip_start(struct net_device *dev) | |||
788 | if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES) | 870 | if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES) |
789 | flexcan_write(0x0, ®s->rxfgmask); | 871 | flexcan_write(0x0, ®s->rxfgmask); |
790 | 872 | ||
791 | if (priv->reg_xceiver) { | 873 | err = flexcan_transceiver_enable(priv); |
792 | err = regulator_enable(priv->reg_xceiver); | 874 | if (err) |
793 | if (err) | 875 | goto out_chip_disable; |
794 | goto out; | ||
795 | } | ||
796 | 876 | ||
797 | /* synchronize with the can bus */ | 877 | /* synchronize with the can bus */ |
798 | reg_mcr = flexcan_read(®s->mcr); | 878 | err = flexcan_chip_unfreeze(priv); |
799 | reg_mcr &= ~FLEXCAN_MCR_HALT; | 879 | if (err) |
800 | flexcan_write(reg_mcr, ®s->mcr); | 880 | goto out_transceiver_disable; |
801 | 881 | ||
802 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 882 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
803 | 883 | ||
@@ -810,7 +890,9 @@ static int flexcan_chip_start(struct net_device *dev) | |||
810 | 890 | ||
811 | return 0; | 891 | return 0; |
812 | 892 | ||
813 | out: | 893 | out_transceiver_disable: |
894 | flexcan_transceiver_disable(priv); | ||
895 | out_chip_disable: | ||
814 | flexcan_chip_disable(priv); | 896 | flexcan_chip_disable(priv); |
815 | return err; | 897 | return err; |
816 | } | 898 | } |
@@ -825,18 +907,17 @@ static void flexcan_chip_stop(struct net_device *dev) | |||
825 | { | 907 | { |
826 | struct flexcan_priv *priv = netdev_priv(dev); | 908 | struct flexcan_priv *priv = netdev_priv(dev); |
827 | struct flexcan_regs __iomem *regs = priv->base; | 909 | struct flexcan_regs __iomem *regs = priv->base; |
828 | u32 reg; | 910 | |
911 | /* freeze + disable module */ | ||
912 | flexcan_chip_freeze(priv); | ||
913 | flexcan_chip_disable(priv); | ||
829 | 914 | ||
830 | /* Disable all interrupts */ | 915 | /* Disable all interrupts */ |
831 | flexcan_write(0, ®s->imask1); | 916 | flexcan_write(0, ®s->imask1); |
917 | flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL, | ||
918 | ®s->ctrl); | ||
832 | 919 | ||
833 | /* Disable + halt module */ | 920 | flexcan_transceiver_disable(priv); |
834 | reg = flexcan_read(®s->mcr); | ||
835 | reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT; | ||
836 | flexcan_write(reg, ®s->mcr); | ||
837 | |||
838 | if (priv->reg_xceiver) | ||
839 | regulator_disable(priv->reg_xceiver); | ||
840 | priv->can.state = CAN_STATE_STOPPED; | 921 | priv->can.state = CAN_STATE_STOPPED; |
841 | 922 | ||
842 | return; | 923 | return; |
@@ -866,7 +947,7 @@ static int flexcan_open(struct net_device *dev) | |||
866 | /* start chip and queuing */ | 947 | /* start chip and queuing */ |
867 | err = flexcan_chip_start(dev); | 948 | err = flexcan_chip_start(dev); |
868 | if (err) | 949 | if (err) |
869 | goto out_close; | 950 | goto out_free_irq; |
870 | 951 | ||
871 | can_led_event(dev, CAN_LED_EVENT_OPEN); | 952 | can_led_event(dev, CAN_LED_EVENT_OPEN); |
872 | 953 | ||
@@ -875,6 +956,8 @@ static int flexcan_open(struct net_device *dev) | |||
875 | 956 | ||
876 | return 0; | 957 | return 0; |
877 | 958 | ||
959 | out_free_irq: | ||
960 | free_irq(dev->irq, dev); | ||
878 | out_close: | 961 | out_close: |
879 | close_candev(dev); | 962 | close_candev(dev); |
880 | out_disable_per: | 963 | out_disable_per: |
@@ -945,12 +1028,16 @@ static int register_flexcandev(struct net_device *dev) | |||
945 | goto out_disable_ipg; | 1028 | goto out_disable_ipg; |
946 | 1029 | ||
947 | /* select "bus clock", chip must be disabled */ | 1030 | /* select "bus clock", chip must be disabled */ |
948 | flexcan_chip_disable(priv); | 1031 | err = flexcan_chip_disable(priv); |
1032 | if (err) | ||
1033 | goto out_disable_per; | ||
949 | reg = flexcan_read(®s->ctrl); | 1034 | reg = flexcan_read(®s->ctrl); |
950 | reg |= FLEXCAN_CTRL_CLK_SRC; | 1035 | reg |= FLEXCAN_CTRL_CLK_SRC; |
951 | flexcan_write(reg, ®s->ctrl); | 1036 | flexcan_write(reg, ®s->ctrl); |
952 | 1037 | ||
953 | flexcan_chip_enable(priv); | 1038 | err = flexcan_chip_enable(priv); |
1039 | if (err) | ||
1040 | goto out_chip_disable; | ||
954 | 1041 | ||
955 | /* set freeze, halt and activate FIFO, restrict register access */ | 1042 | /* set freeze, halt and activate FIFO, restrict register access */ |
956 | reg = flexcan_read(®s->mcr); | 1043 | reg = flexcan_read(®s->mcr); |
@@ -967,14 +1054,15 @@ static int register_flexcandev(struct net_device *dev) | |||
967 | if (!(reg & FLEXCAN_MCR_FEN)) { | 1054 | if (!(reg & FLEXCAN_MCR_FEN)) { |
968 | netdev_err(dev, "Could not enable RX FIFO, unsupported core\n"); | 1055 | netdev_err(dev, "Could not enable RX FIFO, unsupported core\n"); |
969 | err = -ENODEV; | 1056 | err = -ENODEV; |
970 | goto out_disable_per; | 1057 | goto out_chip_disable; |
971 | } | 1058 | } |
972 | 1059 | ||
973 | err = register_candev(dev); | 1060 | err = register_candev(dev); |
974 | 1061 | ||
975 | out_disable_per: | ||
976 | /* disable core and turn off clocks */ | 1062 | /* disable core and turn off clocks */ |
1063 | out_chip_disable: | ||
977 | flexcan_chip_disable(priv); | 1064 | flexcan_chip_disable(priv); |
1065 | out_disable_per: | ||
978 | clk_disable_unprepare(priv->clk_per); | 1066 | clk_disable_unprepare(priv->clk_per); |
979 | out_disable_ipg: | 1067 | out_disable_ipg: |
980 | clk_disable_unprepare(priv->clk_ipg); | 1068 | clk_disable_unprepare(priv->clk_ipg); |
@@ -1104,9 +1192,10 @@ static int flexcan_probe(struct platform_device *pdev) | |||
1104 | static int flexcan_remove(struct platform_device *pdev) | 1192 | static int flexcan_remove(struct platform_device *pdev) |
1105 | { | 1193 | { |
1106 | struct net_device *dev = platform_get_drvdata(pdev); | 1194 | struct net_device *dev = platform_get_drvdata(pdev); |
1195 | struct flexcan_priv *priv = netdev_priv(dev); | ||
1107 | 1196 | ||
1108 | unregister_flexcandev(dev); | 1197 | unregister_flexcandev(dev); |
1109 | 1198 | netif_napi_del(&priv->napi); | |
1110 | free_candev(dev); | 1199 | free_candev(dev); |
1111 | 1200 | ||
1112 | return 0; | 1201 | return 0; |
@@ -1117,8 +1206,11 @@ static int flexcan_suspend(struct device *device) | |||
1117 | { | 1206 | { |
1118 | struct net_device *dev = dev_get_drvdata(device); | 1207 | struct net_device *dev = dev_get_drvdata(device); |
1119 | struct flexcan_priv *priv = netdev_priv(dev); | 1208 | struct flexcan_priv *priv = netdev_priv(dev); |
1209 | int err; | ||
1120 | 1210 | ||
1121 | flexcan_chip_disable(priv); | 1211 | err = flexcan_chip_disable(priv); |
1212 | if (err) | ||
1213 | return err; | ||
1122 | 1214 | ||
1123 | if (netif_running(dev)) { | 1215 | if (netif_running(dev)) { |
1124 | netif_stop_queue(dev); | 1216 | netif_stop_queue(dev); |
@@ -1139,9 +1231,7 @@ static int flexcan_resume(struct device *device) | |||
1139 | netif_device_attach(dev); | 1231 | netif_device_attach(dev); |
1140 | netif_start_queue(dev); | 1232 | netif_start_queue(dev); |
1141 | } | 1233 | } |
1142 | flexcan_chip_enable(priv); | 1234 | return flexcan_chip_enable(priv); |
1143 | |||
1144 | return 0; | ||
1145 | } | 1235 | } |
1146 | #endif /* CONFIG_PM_SLEEP */ | 1236 | #endif /* CONFIG_PM_SLEEP */ |
1147 | 1237 | ||
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 2e45f6ec1bf0..380d24922049 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
@@ -1248,19 +1248,13 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1248 | * shared register for the high 32 bits, so only a single, aligned, | 1248 | * shared register for the high 32 bits, so only a single, aligned, |
1249 | * 4 GB physical address range can be used for descriptors. | 1249 | * 4 GB physical address range can be used for descriptors. |
1250 | */ | 1250 | */ |
1251 | if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && | 1251 | if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { |
1252 | !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { | ||
1253 | dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n"); | 1252 | dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n"); |
1254 | } else { | 1253 | } else { |
1255 | err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | 1254 | err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
1256 | if (err) { | 1255 | if (err) { |
1257 | err = dma_set_coherent_mask(&pdev->dev, | 1256 | dev_err(&pdev->dev, "No usable DMA config, aborting\n"); |
1258 | DMA_BIT_MASK(32)); | 1257 | goto out_pci_disable; |
1259 | if (err) { | ||
1260 | dev_err(&pdev->dev, | ||
1261 | "No usable DMA config, aborting\n"); | ||
1262 | goto out_pci_disable; | ||
1263 | } | ||
1264 | } | 1258 | } |
1265 | } | 1259 | } |
1266 | 1260 | ||
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index d5c2d3e912e5..422aab27ea1b 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c | |||
@@ -2436,7 +2436,7 @@ err_reset: | |||
2436 | err_register: | 2436 | err_register: |
2437 | err_sw_init: | 2437 | err_sw_init: |
2438 | err_eeprom: | 2438 | err_eeprom: |
2439 | iounmap(adapter->hw.hw_addr); | 2439 | pci_iounmap(pdev, adapter->hw.hw_addr); |
2440 | err_init_netdev: | 2440 | err_init_netdev: |
2441 | err_ioremap: | 2441 | err_ioremap: |
2442 | free_netdev(netdev); | 2442 | free_netdev(netdev); |
@@ -2474,7 +2474,7 @@ static void atl1e_remove(struct pci_dev *pdev) | |||
2474 | unregister_netdev(netdev); | 2474 | unregister_netdev(netdev); |
2475 | atl1e_free_ring_resources(adapter); | 2475 | atl1e_free_ring_resources(adapter); |
2476 | atl1e_force_ps(&adapter->hw); | 2476 | atl1e_force_ps(&adapter->hw); |
2477 | iounmap(adapter->hw.hw_addr); | 2477 | pci_iounmap(pdev, adapter->hw.hw_addr); |
2478 | pci_release_regions(pdev); | 2478 | pci_release_regions(pdev); |
2479 | free_netdev(netdev); | 2479 | free_netdev(netdev); |
2480 | pci_disable_device(pdev); | 2480 | pci_disable_device(pdev); |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 1f7b5aa114fa..8a7bf7dad898 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -1484,6 +1484,10 @@ static int b44_open(struct net_device *dev) | |||
1484 | add_timer(&bp->timer); | 1484 | add_timer(&bp->timer); |
1485 | 1485 | ||
1486 | b44_enable_ints(bp); | 1486 | b44_enable_ints(bp); |
1487 | |||
1488 | if (bp->flags & B44_FLAG_EXTERNAL_PHY) | ||
1489 | phy_start(bp->phydev); | ||
1490 | |||
1487 | netif_start_queue(dev); | 1491 | netif_start_queue(dev); |
1488 | out: | 1492 | out: |
1489 | return err; | 1493 | return err; |
@@ -1646,6 +1650,9 @@ static int b44_close(struct net_device *dev) | |||
1646 | 1650 | ||
1647 | netif_stop_queue(dev); | 1651 | netif_stop_queue(dev); |
1648 | 1652 | ||
1653 | if (bp->flags & B44_FLAG_EXTERNAL_PHY) | ||
1654 | phy_stop(bp->phydev); | ||
1655 | |||
1649 | napi_disable(&bp->napi); | 1656 | napi_disable(&bp->napi); |
1650 | 1657 | ||
1651 | del_timer_sync(&bp->timer); | 1658 | del_timer_sync(&bp->timer); |
@@ -2222,7 +2229,12 @@ static void b44_adjust_link(struct net_device *dev) | |||
2222 | } | 2229 | } |
2223 | 2230 | ||
2224 | if (status_changed) { | 2231 | if (status_changed) { |
2225 | b44_check_phy(bp); | 2232 | u32 val = br32(bp, B44_TX_CTRL); |
2233 | if (bp->flags & B44_FLAG_FULL_DUPLEX) | ||
2234 | val |= TX_CTRL_DUPLEX; | ||
2235 | else | ||
2236 | val &= ~TX_CTRL_DUPLEX; | ||
2237 | bw32(bp, B44_TX_CTRL, val); | ||
2226 | phy_print_status(phydev); | 2238 | phy_print_status(phydev); |
2227 | } | 2239 | } |
2228 | } | 2240 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index cda25ac45b47..6c9e1c9bdeb8 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -2507,6 +2507,7 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int ack, int silent) | |||
2507 | 2507 | ||
2508 | bp->fw_wr_seq++; | 2508 | bp->fw_wr_seq++; |
2509 | msg_data |= bp->fw_wr_seq; | 2509 | msg_data |= bp->fw_wr_seq; |
2510 | bp->fw_last_msg = msg_data; | ||
2510 | 2511 | ||
2511 | bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data); | 2512 | bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data); |
2512 | 2513 | ||
@@ -4000,8 +4001,23 @@ bnx2_setup_wol(struct bnx2 *bp) | |||
4000 | wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; | 4001 | wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; |
4001 | } | 4002 | } |
4002 | 4003 | ||
4003 | if (!(bp->flags & BNX2_FLAG_NO_WOL)) | 4004 | if (!(bp->flags & BNX2_FLAG_NO_WOL)) { |
4004 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg, 1, 0); | 4005 | u32 val; |
4006 | |||
4007 | wol_msg |= BNX2_DRV_MSG_DATA_WAIT3; | ||
4008 | if (bp->fw_last_msg || BNX2_CHIP(bp) != BNX2_CHIP_5709) { | ||
4009 | bnx2_fw_sync(bp, wol_msg, 1, 0); | ||
4010 | return; | ||
4011 | } | ||
4012 | /* Tell firmware not to power down the PHY yet, otherwise | ||
4013 | * the chip will take a long time to respond to MMIO reads. | ||
4014 | */ | ||
4015 | val = bnx2_shmem_rd(bp, BNX2_PORT_FEATURE); | ||
4016 | bnx2_shmem_wr(bp, BNX2_PORT_FEATURE, | ||
4017 | val | BNX2_PORT_FEATURE_ASF_ENABLED); | ||
4018 | bnx2_fw_sync(bp, wol_msg, 1, 0); | ||
4019 | bnx2_shmem_wr(bp, BNX2_PORT_FEATURE, val); | ||
4020 | } | ||
4005 | 4021 | ||
4006 | } | 4022 | } |
4007 | 4023 | ||
@@ -4033,9 +4049,22 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) | |||
4033 | 4049 | ||
4034 | if (bp->wol) | 4050 | if (bp->wol) |
4035 | pci_set_power_state(bp->pdev, PCI_D3hot); | 4051 | pci_set_power_state(bp->pdev, PCI_D3hot); |
4036 | } else { | 4052 | break; |
4037 | pci_set_power_state(bp->pdev, PCI_D3hot); | 4053 | |
4054 | } | ||
4055 | if (!bp->fw_last_msg && BNX2_CHIP(bp) == BNX2_CHIP_5709) { | ||
4056 | u32 val; | ||
4057 | |||
4058 | /* Tell firmware not to power down the PHY yet, | ||
4059 | * otherwise the other port may not respond to | ||
4060 | * MMIO reads. | ||
4061 | */ | ||
4062 | val = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION); | ||
4063 | val &= ~BNX2_CONDITION_PM_STATE_MASK; | ||
4064 | val |= BNX2_CONDITION_PM_STATE_UNPREP; | ||
4065 | bnx2_shmem_wr(bp, BNX2_BC_STATE_CONDITION, val); | ||
4038 | } | 4066 | } |
4067 | pci_set_power_state(bp->pdev, PCI_D3hot); | ||
4039 | 4068 | ||
4040 | /* No more memory access after this point until | 4069 | /* No more memory access after this point until |
4041 | * device is brought back to D0. | 4070 | * device is brought back to D0. |
diff --git a/drivers/net/ethernet/broadcom/bnx2.h b/drivers/net/ethernet/broadcom/bnx2.h index f1cf2c44e7ed..e341bc366fa5 100644 --- a/drivers/net/ethernet/broadcom/bnx2.h +++ b/drivers/net/ethernet/broadcom/bnx2.h | |||
@@ -6900,6 +6900,7 @@ struct bnx2 { | |||
6900 | 6900 | ||
6901 | u16 fw_wr_seq; | 6901 | u16 fw_wr_seq; |
6902 | u16 fw_drv_pulse_wr_seq; | 6902 | u16 fw_drv_pulse_wr_seq; |
6903 | u32 fw_last_msg; | ||
6903 | 6904 | ||
6904 | int rx_max_ring; | 6905 | int rx_max_ring; |
6905 | int rx_ring_size; | 6906 | int rx_ring_size; |
@@ -7406,6 +7407,10 @@ struct bnx2_rv2p_fw_file { | |||
7406 | #define BNX2_CONDITION_MFW_RUN_NCSI 0x00006000 | 7407 | #define BNX2_CONDITION_MFW_RUN_NCSI 0x00006000 |
7407 | #define BNX2_CONDITION_MFW_RUN_NONE 0x0000e000 | 7408 | #define BNX2_CONDITION_MFW_RUN_NONE 0x0000e000 |
7408 | #define BNX2_CONDITION_MFW_RUN_MASK 0x0000e000 | 7409 | #define BNX2_CONDITION_MFW_RUN_MASK 0x0000e000 |
7410 | #define BNX2_CONDITION_PM_STATE_MASK 0x00030000 | ||
7411 | #define BNX2_CONDITION_PM_STATE_FULL 0x00030000 | ||
7412 | #define BNX2_CONDITION_PM_STATE_PREP 0x00020000 | ||
7413 | #define BNX2_CONDITION_PM_STATE_UNPREP 0x00010000 | ||
7409 | 7414 | ||
7410 | #define BNX2_BC_STATE_DEBUG_CMD 0x1dc | 7415 | #define BNX2_BC_STATE_DEBUG_CMD 0x1dc |
7411 | #define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000 | 7416 | #define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 66c0df78c3ff..dbcff509dc3f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3875,7 +3875,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3875 | xmit_type); | 3875 | xmit_type); |
3876 | } | 3876 | } |
3877 | 3877 | ||
3878 | /* Add the macs to the parsing BD this is a vf */ | 3878 | /* Add the macs to the parsing BD if this is a vf or if |
3879 | * Tx Switching is enabled. | ||
3880 | */ | ||
3879 | if (IS_VF(bp)) { | 3881 | if (IS_VF(bp)) { |
3880 | /* override GRE parameters in BD */ | 3882 | /* override GRE parameters in BD */ |
3881 | bnx2x_set_fw_mac_addr(&pbd_e2->data.mac_addr.src_hi, | 3883 | bnx2x_set_fw_mac_addr(&pbd_e2->data.mac_addr.src_hi, |
@@ -3887,6 +3889,11 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3887 | &pbd_e2->data.mac_addr.dst_mid, | 3889 | &pbd_e2->data.mac_addr.dst_mid, |
3888 | &pbd_e2->data.mac_addr.dst_lo, | 3890 | &pbd_e2->data.mac_addr.dst_lo, |
3889 | eth->h_dest); | 3891 | eth->h_dest); |
3892 | } else if (bp->flags & TX_SWITCHING) { | ||
3893 | bnx2x_set_fw_mac_addr(&pbd_e2->data.mac_addr.dst_hi, | ||
3894 | &pbd_e2->data.mac_addr.dst_mid, | ||
3895 | &pbd_e2->data.mac_addr.dst_lo, | ||
3896 | eth->h_dest); | ||
3890 | } | 3897 | } |
3891 | 3898 | ||
3892 | SET_FLAG(pbd_e2_parsing_data, | 3899 | SET_FLAG(pbd_e2_parsing_data, |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index fcf9105a5476..09f3fefcbf9c 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* cnic.c: Broadcom CNIC core network driver. | 1 | /* cnic.c: Broadcom CNIC core network driver. |
2 | * | 2 | * |
3 | * Copyright (c) 2006-2013 Broadcom Corporation | 3 | * Copyright (c) 2006-2014 Broadcom Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -342,7 +342,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type, | |||
342 | while (retry < 3) { | 342 | while (retry < 3) { |
343 | rc = 0; | 343 | rc = 0; |
344 | rcu_read_lock(); | 344 | rcu_read_lock(); |
345 | ulp_ops = rcu_dereference(cnic_ulp_tbl[CNIC_ULP_ISCSI]); | 345 | ulp_ops = rcu_dereference(cp->ulp_ops[CNIC_ULP_ISCSI]); |
346 | if (ulp_ops) | 346 | if (ulp_ops) |
347 | rc = ulp_ops->iscsi_nl_send_msg( | 347 | rc = ulp_ops->iscsi_nl_send_msg( |
348 | cp->ulp_handle[CNIC_ULP_ISCSI], | 348 | cp->ulp_handle[CNIC_ULP_ISCSI], |
@@ -726,7 +726,7 @@ static void cnic_free_dma(struct cnic_dev *dev, struct cnic_dma *dma) | |||
726 | 726 | ||
727 | for (i = 0; i < dma->num_pages; i++) { | 727 | for (i = 0; i < dma->num_pages; i++) { |
728 | if (dma->pg_arr[i]) { | 728 | if (dma->pg_arr[i]) { |
729 | dma_free_coherent(&dev->pcidev->dev, BNX2_PAGE_SIZE, | 729 | dma_free_coherent(&dev->pcidev->dev, CNIC_PAGE_SIZE, |
730 | dma->pg_arr[i], dma->pg_map_arr[i]); | 730 | dma->pg_arr[i], dma->pg_map_arr[i]); |
731 | dma->pg_arr[i] = NULL; | 731 | dma->pg_arr[i] = NULL; |
732 | } | 732 | } |
@@ -785,7 +785,7 @@ static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma, | |||
785 | 785 | ||
786 | for (i = 0; i < pages; i++) { | 786 | for (i = 0; i < pages; i++) { |
787 | dma->pg_arr[i] = dma_alloc_coherent(&dev->pcidev->dev, | 787 | dma->pg_arr[i] = dma_alloc_coherent(&dev->pcidev->dev, |
788 | BNX2_PAGE_SIZE, | 788 | CNIC_PAGE_SIZE, |
789 | &dma->pg_map_arr[i], | 789 | &dma->pg_map_arr[i], |
790 | GFP_ATOMIC); | 790 | GFP_ATOMIC); |
791 | if (dma->pg_arr[i] == NULL) | 791 | if (dma->pg_arr[i] == NULL) |
@@ -794,8 +794,8 @@ static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma, | |||
794 | if (!use_pg_tbl) | 794 | if (!use_pg_tbl) |
795 | return 0; | 795 | return 0; |
796 | 796 | ||
797 | dma->pgtbl_size = ((pages * 8) + BNX2_PAGE_SIZE - 1) & | 797 | dma->pgtbl_size = ((pages * 8) + CNIC_PAGE_SIZE - 1) & |
798 | ~(BNX2_PAGE_SIZE - 1); | 798 | ~(CNIC_PAGE_SIZE - 1); |
799 | dma->pgtbl = dma_alloc_coherent(&dev->pcidev->dev, dma->pgtbl_size, | 799 | dma->pgtbl = dma_alloc_coherent(&dev->pcidev->dev, dma->pgtbl_size, |
800 | &dma->pgtbl_map, GFP_ATOMIC); | 800 | &dma->pgtbl_map, GFP_ATOMIC); |
801 | if (dma->pgtbl == NULL) | 801 | if (dma->pgtbl == NULL) |
@@ -900,8 +900,8 @@ static int cnic_alloc_context(struct cnic_dev *dev) | |||
900 | if (BNX2_CHIP(cp) == BNX2_CHIP_5709) { | 900 | if (BNX2_CHIP(cp) == BNX2_CHIP_5709) { |
901 | int i, k, arr_size; | 901 | int i, k, arr_size; |
902 | 902 | ||
903 | cp->ctx_blk_size = BNX2_PAGE_SIZE; | 903 | cp->ctx_blk_size = CNIC_PAGE_SIZE; |
904 | cp->cids_per_blk = BNX2_PAGE_SIZE / 128; | 904 | cp->cids_per_blk = CNIC_PAGE_SIZE / 128; |
905 | arr_size = BNX2_MAX_CID / cp->cids_per_blk * | 905 | arr_size = BNX2_MAX_CID / cp->cids_per_blk * |
906 | sizeof(struct cnic_ctx); | 906 | sizeof(struct cnic_ctx); |
907 | cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL); | 907 | cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL); |
@@ -933,7 +933,7 @@ static int cnic_alloc_context(struct cnic_dev *dev) | |||
933 | for (i = 0; i < cp->ctx_blks; i++) { | 933 | for (i = 0; i < cp->ctx_blks; i++) { |
934 | cp->ctx_arr[i].ctx = | 934 | cp->ctx_arr[i].ctx = |
935 | dma_alloc_coherent(&dev->pcidev->dev, | 935 | dma_alloc_coherent(&dev->pcidev->dev, |
936 | BNX2_PAGE_SIZE, | 936 | CNIC_PAGE_SIZE, |
937 | &cp->ctx_arr[i].mapping, | 937 | &cp->ctx_arr[i].mapping, |
938 | GFP_KERNEL); | 938 | GFP_KERNEL); |
939 | if (cp->ctx_arr[i].ctx == NULL) | 939 | if (cp->ctx_arr[i].ctx == NULL) |
@@ -1013,7 +1013,7 @@ static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages) | |||
1013 | if (udev->l2_ring) | 1013 | if (udev->l2_ring) |
1014 | return 0; | 1014 | return 0; |
1015 | 1015 | ||
1016 | udev->l2_ring_size = pages * BNX2_PAGE_SIZE; | 1016 | udev->l2_ring_size = pages * CNIC_PAGE_SIZE; |
1017 | udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size, | 1017 | udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size, |
1018 | &udev->l2_ring_map, | 1018 | &udev->l2_ring_map, |
1019 | GFP_KERNEL | __GFP_COMP); | 1019 | GFP_KERNEL | __GFP_COMP); |
@@ -1021,7 +1021,7 @@ static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages) | |||
1021 | return -ENOMEM; | 1021 | return -ENOMEM; |
1022 | 1022 | ||
1023 | udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; | 1023 | udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; |
1024 | udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size); | 1024 | udev->l2_buf_size = CNIC_PAGE_ALIGN(udev->l2_buf_size); |
1025 | udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size, | 1025 | udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size, |
1026 | &udev->l2_buf_map, | 1026 | &udev->l2_buf_map, |
1027 | GFP_KERNEL | __GFP_COMP); | 1027 | GFP_KERNEL | __GFP_COMP); |
@@ -1102,7 +1102,7 @@ static int cnic_init_uio(struct cnic_dev *dev) | |||
1102 | uinfo->mem[0].size = MB_GET_CID_ADDR(TX_TSS_CID + | 1102 | uinfo->mem[0].size = MB_GET_CID_ADDR(TX_TSS_CID + |
1103 | TX_MAX_TSS_RINGS + 1); | 1103 | TX_MAX_TSS_RINGS + 1); |
1104 | uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & | 1104 | uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & |
1105 | PAGE_MASK; | 1105 | CNIC_PAGE_MASK; |
1106 | if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) | 1106 | if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) |
1107 | uinfo->mem[1].size = BNX2_SBLK_MSIX_ALIGN_SIZE * 9; | 1107 | uinfo->mem[1].size = BNX2_SBLK_MSIX_ALIGN_SIZE * 9; |
1108 | else | 1108 | else |
@@ -1113,7 +1113,7 @@ static int cnic_init_uio(struct cnic_dev *dev) | |||
1113 | uinfo->mem[0].size = pci_resource_len(dev->pcidev, 0); | 1113 | uinfo->mem[0].size = pci_resource_len(dev->pcidev, 0); |
1114 | 1114 | ||
1115 | uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & | 1115 | uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & |
1116 | PAGE_MASK; | 1116 | CNIC_PAGE_MASK; |
1117 | uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk); | 1117 | uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk); |
1118 | 1118 | ||
1119 | uinfo->name = "bnx2x_cnic"; | 1119 | uinfo->name = "bnx2x_cnic"; |
@@ -1267,14 +1267,14 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1267 | for (i = MAX_ISCSI_TBL_SZ; i < cp->max_cid_space; i++) | 1267 | for (i = MAX_ISCSI_TBL_SZ; i < cp->max_cid_space; i++) |
1268 | cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_FCOE; | 1268 | cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_FCOE; |
1269 | 1269 | ||
1270 | pages = PAGE_ALIGN(cp->max_cid_space * CNIC_KWQ16_DATA_SIZE) / | 1270 | pages = CNIC_PAGE_ALIGN(cp->max_cid_space * CNIC_KWQ16_DATA_SIZE) / |
1271 | PAGE_SIZE; | 1271 | CNIC_PAGE_SIZE; |
1272 | 1272 | ||
1273 | ret = cnic_alloc_dma(dev, kwq_16_dma, pages, 0); | 1273 | ret = cnic_alloc_dma(dev, kwq_16_dma, pages, 0); |
1274 | if (ret) | 1274 | if (ret) |
1275 | return -ENOMEM; | 1275 | return -ENOMEM; |
1276 | 1276 | ||
1277 | n = PAGE_SIZE / CNIC_KWQ16_DATA_SIZE; | 1277 | n = CNIC_PAGE_SIZE / CNIC_KWQ16_DATA_SIZE; |
1278 | for (i = 0, j = 0; i < cp->max_cid_space; i++) { | 1278 | for (i = 0, j = 0; i < cp->max_cid_space; i++) { |
1279 | long off = CNIC_KWQ16_DATA_SIZE * (i % n); | 1279 | long off = CNIC_KWQ16_DATA_SIZE * (i % n); |
1280 | 1280 | ||
@@ -1296,7 +1296,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1296 | goto error; | 1296 | goto error; |
1297 | } | 1297 | } |
1298 | 1298 | ||
1299 | pages = PAGE_ALIGN(BNX2X_ISCSI_GLB_BUF_SIZE) / PAGE_SIZE; | 1299 | pages = CNIC_PAGE_ALIGN(BNX2X_ISCSI_GLB_BUF_SIZE) / CNIC_PAGE_SIZE; |
1300 | ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0); | 1300 | ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0); |
1301 | if (ret) | 1301 | if (ret) |
1302 | goto error; | 1302 | goto error; |
@@ -1466,8 +1466,8 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1466 | cp->r2tq_size = cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS * | 1466 | cp->r2tq_size = cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS * |
1467 | BNX2X_ISCSI_R2TQE_SIZE; | 1467 | BNX2X_ISCSI_R2TQE_SIZE; |
1468 | cp->hq_size = cp->num_ccells * BNX2X_ISCSI_HQ_BD_SIZE; | 1468 | cp->hq_size = cp->num_ccells * BNX2X_ISCSI_HQ_BD_SIZE; |
1469 | pages = PAGE_ALIGN(cp->hq_size) / PAGE_SIZE; | 1469 | pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE; |
1470 | hq_bds = pages * (PAGE_SIZE / BNX2X_ISCSI_HQ_BD_SIZE); | 1470 | hq_bds = pages * (CNIC_PAGE_SIZE / BNX2X_ISCSI_HQ_BD_SIZE); |
1471 | cp->num_cqs = req1->num_cqs; | 1471 | cp->num_cqs = req1->num_cqs; |
1472 | 1472 | ||
1473 | if (!dev->max_iscsi_conn) | 1473 | if (!dev->max_iscsi_conn) |
@@ -1477,9 +1477,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1477 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_RQ_SIZE_OFFSET(pfid), | 1477 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_RQ_SIZE_OFFSET(pfid), |
1478 | req1->rq_num_wqes); | 1478 | req1->rq_num_wqes); |
1479 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), | 1479 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), |
1480 | PAGE_SIZE); | 1480 | CNIC_PAGE_SIZE); |
1481 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + | 1481 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + |
1482 | TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); | 1482 | TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS); |
1483 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + | 1483 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + |
1484 | TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), | 1484 | TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), |
1485 | req1->num_tasks_per_conn); | 1485 | req1->num_tasks_per_conn); |
@@ -1489,9 +1489,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1489 | USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfid), | 1489 | USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfid), |
1490 | req1->rq_buffer_size); | 1490 | req1->rq_buffer_size); |
1491 | CNIC_WR16(dev, BAR_USTRORM_INTMEM + USTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), | 1491 | CNIC_WR16(dev, BAR_USTRORM_INTMEM + USTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), |
1492 | PAGE_SIZE); | 1492 | CNIC_PAGE_SIZE); |
1493 | CNIC_WR8(dev, BAR_USTRORM_INTMEM + | 1493 | CNIC_WR8(dev, BAR_USTRORM_INTMEM + |
1494 | USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); | 1494 | USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS); |
1495 | CNIC_WR16(dev, BAR_USTRORM_INTMEM + | 1495 | CNIC_WR16(dev, BAR_USTRORM_INTMEM + |
1496 | USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), | 1496 | USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), |
1497 | req1->num_tasks_per_conn); | 1497 | req1->num_tasks_per_conn); |
@@ -1504,9 +1504,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1504 | 1504 | ||
1505 | /* init Xstorm RAM */ | 1505 | /* init Xstorm RAM */ |
1506 | CNIC_WR16(dev, BAR_XSTRORM_INTMEM + XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), | 1506 | CNIC_WR16(dev, BAR_XSTRORM_INTMEM + XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), |
1507 | PAGE_SIZE); | 1507 | CNIC_PAGE_SIZE); |
1508 | CNIC_WR8(dev, BAR_XSTRORM_INTMEM + | 1508 | CNIC_WR8(dev, BAR_XSTRORM_INTMEM + |
1509 | XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); | 1509 | XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS); |
1510 | CNIC_WR16(dev, BAR_XSTRORM_INTMEM + | 1510 | CNIC_WR16(dev, BAR_XSTRORM_INTMEM + |
1511 | XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), | 1511 | XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), |
1512 | req1->num_tasks_per_conn); | 1512 | req1->num_tasks_per_conn); |
@@ -1519,9 +1519,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1519 | 1519 | ||
1520 | /* init Cstorm RAM */ | 1520 | /* init Cstorm RAM */ |
1521 | CNIC_WR16(dev, BAR_CSTRORM_INTMEM + CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), | 1521 | CNIC_WR16(dev, BAR_CSTRORM_INTMEM + CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), |
1522 | PAGE_SIZE); | 1522 | CNIC_PAGE_SIZE); |
1523 | CNIC_WR8(dev, BAR_CSTRORM_INTMEM + | 1523 | CNIC_WR8(dev, BAR_CSTRORM_INTMEM + |
1524 | CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); | 1524 | CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS); |
1525 | CNIC_WR16(dev, BAR_CSTRORM_INTMEM + | 1525 | CNIC_WR16(dev, BAR_CSTRORM_INTMEM + |
1526 | CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), | 1526 | CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), |
1527 | req1->num_tasks_per_conn); | 1527 | req1->num_tasks_per_conn); |
@@ -1623,18 +1623,18 @@ static int cnic_alloc_bnx2x_conn_resc(struct cnic_dev *dev, u32 l5_cid) | |||
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | ctx->cid = cid; | 1625 | ctx->cid = cid; |
1626 | pages = PAGE_ALIGN(cp->task_array_size) / PAGE_SIZE; | 1626 | pages = CNIC_PAGE_ALIGN(cp->task_array_size) / CNIC_PAGE_SIZE; |
1627 | 1627 | ||
1628 | ret = cnic_alloc_dma(dev, &iscsi->task_array_info, pages, 1); | 1628 | ret = cnic_alloc_dma(dev, &iscsi->task_array_info, pages, 1); |
1629 | if (ret) | 1629 | if (ret) |
1630 | goto error; | 1630 | goto error; |
1631 | 1631 | ||
1632 | pages = PAGE_ALIGN(cp->r2tq_size) / PAGE_SIZE; | 1632 | pages = CNIC_PAGE_ALIGN(cp->r2tq_size) / CNIC_PAGE_SIZE; |
1633 | ret = cnic_alloc_dma(dev, &iscsi->r2tq_info, pages, 1); | 1633 | ret = cnic_alloc_dma(dev, &iscsi->r2tq_info, pages, 1); |
1634 | if (ret) | 1634 | if (ret) |
1635 | goto error; | 1635 | goto error; |
1636 | 1636 | ||
1637 | pages = PAGE_ALIGN(cp->hq_size) / PAGE_SIZE; | 1637 | pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE; |
1638 | ret = cnic_alloc_dma(dev, &iscsi->hq_info, pages, 1); | 1638 | ret = cnic_alloc_dma(dev, &iscsi->hq_info, pages, 1); |
1639 | if (ret) | 1639 | if (ret) |
1640 | goto error; | 1640 | goto error; |
@@ -1760,7 +1760,7 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1760 | ictx->tstorm_st_context.iscsi.hdr_bytes_2_fetch = ISCSI_HEADER_SIZE; | 1760 | ictx->tstorm_st_context.iscsi.hdr_bytes_2_fetch = ISCSI_HEADER_SIZE; |
1761 | /* TSTORM requires the base address of RQ DB & not PTE */ | 1761 | /* TSTORM requires the base address of RQ DB & not PTE */ |
1762 | ictx->tstorm_st_context.iscsi.rq_db_phy_addr.lo = | 1762 | ictx->tstorm_st_context.iscsi.rq_db_phy_addr.lo = |
1763 | req2->rq_page_table_addr_lo & PAGE_MASK; | 1763 | req2->rq_page_table_addr_lo & CNIC_PAGE_MASK; |
1764 | ictx->tstorm_st_context.iscsi.rq_db_phy_addr.hi = | 1764 | ictx->tstorm_st_context.iscsi.rq_db_phy_addr.hi = |
1765 | req2->rq_page_table_addr_hi; | 1765 | req2->rq_page_table_addr_hi; |
1766 | ictx->tstorm_st_context.iscsi.iscsi_conn_id = req1->iscsi_conn_id; | 1766 | ictx->tstorm_st_context.iscsi.iscsi_conn_id = req1->iscsi_conn_id; |
@@ -1842,7 +1842,7 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1842 | /* CSTORM and USTORM initialization is different, CSTORM requires | 1842 | /* CSTORM and USTORM initialization is different, CSTORM requires |
1843 | * CQ DB base & not PTE addr */ | 1843 | * CQ DB base & not PTE addr */ |
1844 | ictx->cstorm_st_context.cq_db_base.lo = | 1844 | ictx->cstorm_st_context.cq_db_base.lo = |
1845 | req1->cq_page_table_addr_lo & PAGE_MASK; | 1845 | req1->cq_page_table_addr_lo & CNIC_PAGE_MASK; |
1846 | ictx->cstorm_st_context.cq_db_base.hi = req1->cq_page_table_addr_hi; | 1846 | ictx->cstorm_st_context.cq_db_base.hi = req1->cq_page_table_addr_hi; |
1847 | ictx->cstorm_st_context.iscsi_conn_id = req1->iscsi_conn_id; | 1847 | ictx->cstorm_st_context.iscsi_conn_id = req1->iscsi_conn_id; |
1848 | ictx->cstorm_st_context.cq_proc_en_bit_map = (1 << cp->num_cqs) - 1; | 1848 | ictx->cstorm_st_context.cq_proc_en_bit_map = (1 << cp->num_cqs) - 1; |
@@ -2911,7 +2911,7 @@ static int cnic_l2_completion(struct cnic_local *cp) | |||
2911 | u16 hw_cons, sw_cons; | 2911 | u16 hw_cons, sw_cons; |
2912 | struct cnic_uio_dev *udev = cp->udev; | 2912 | struct cnic_uio_dev *udev = cp->udev; |
2913 | union eth_rx_cqe *cqe, *cqe_ring = (union eth_rx_cqe *) | 2913 | union eth_rx_cqe *cqe, *cqe_ring = (union eth_rx_cqe *) |
2914 | (udev->l2_ring + (2 * BNX2_PAGE_SIZE)); | 2914 | (udev->l2_ring + (2 * CNIC_PAGE_SIZE)); |
2915 | u32 cmd; | 2915 | u32 cmd; |
2916 | int comp = 0; | 2916 | int comp = 0; |
2917 | 2917 | ||
@@ -3244,7 +3244,8 @@ static int cnic_copy_ulp_stats(struct cnic_dev *dev, int ulp_type) | |||
3244 | int rc; | 3244 | int rc; |
3245 | 3245 | ||
3246 | mutex_lock(&cnic_lock); | 3246 | mutex_lock(&cnic_lock); |
3247 | ulp_ops = cnic_ulp_tbl_prot(ulp_type); | 3247 | ulp_ops = rcu_dereference_protected(cp->ulp_ops[ulp_type], |
3248 | lockdep_is_held(&cnic_lock)); | ||
3248 | if (ulp_ops && ulp_ops->cnic_get_stats) | 3249 | if (ulp_ops && ulp_ops->cnic_get_stats) |
3249 | rc = ulp_ops->cnic_get_stats(cp->ulp_handle[ulp_type]); | 3250 | rc = ulp_ops->cnic_get_stats(cp->ulp_handle[ulp_type]); |
3250 | else | 3251 | else |
@@ -4384,7 +4385,7 @@ static int cnic_setup_5709_context(struct cnic_dev *dev, int valid) | |||
4384 | u32 idx = cp->ctx_arr[i].cid / cp->cids_per_blk; | 4385 | u32 idx = cp->ctx_arr[i].cid / cp->cids_per_blk; |
4385 | u32 val; | 4386 | u32 val; |
4386 | 4387 | ||
4387 | memset(cp->ctx_arr[i].ctx, 0, BNX2_PAGE_SIZE); | 4388 | memset(cp->ctx_arr[i].ctx, 0, CNIC_PAGE_SIZE); |
4388 | 4389 | ||
4389 | CNIC_WR(dev, BNX2_CTX_HOST_PAGE_TBL_DATA0, | 4390 | CNIC_WR(dev, BNX2_CTX_HOST_PAGE_TBL_DATA0, |
4390 | (cp->ctx_arr[i].mapping & 0xffffffff) | valid_bit); | 4391 | (cp->ctx_arr[i].mapping & 0xffffffff) | valid_bit); |
@@ -4628,7 +4629,7 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev) | |||
4628 | val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id); | 4629 | val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id); |
4629 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val); | 4630 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val); |
4630 | 4631 | ||
4631 | rxbd = udev->l2_ring + BNX2_PAGE_SIZE; | 4632 | rxbd = udev->l2_ring + CNIC_PAGE_SIZE; |
4632 | for (i = 0; i < BNX2_MAX_RX_DESC_CNT; i++, rxbd++) { | 4633 | for (i = 0; i < BNX2_MAX_RX_DESC_CNT; i++, rxbd++) { |
4633 | dma_addr_t buf_map; | 4634 | dma_addr_t buf_map; |
4634 | int n = (i % cp->l2_rx_ring_size) + 1; | 4635 | int n = (i % cp->l2_rx_ring_size) + 1; |
@@ -4639,11 +4640,11 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev) | |||
4639 | rxbd->rx_bd_haddr_hi = (u64) buf_map >> 32; | 4640 | rxbd->rx_bd_haddr_hi = (u64) buf_map >> 32; |
4640 | rxbd->rx_bd_haddr_lo = (u64) buf_map & 0xffffffff; | 4641 | rxbd->rx_bd_haddr_lo = (u64) buf_map & 0xffffffff; |
4641 | } | 4642 | } |
4642 | val = (u64) (ring_map + BNX2_PAGE_SIZE) >> 32; | 4643 | val = (u64) (ring_map + CNIC_PAGE_SIZE) >> 32; |
4643 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val); | 4644 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val); |
4644 | rxbd->rx_bd_haddr_hi = val; | 4645 | rxbd->rx_bd_haddr_hi = val; |
4645 | 4646 | ||
4646 | val = (u64) (ring_map + BNX2_PAGE_SIZE) & 0xffffffff; | 4647 | val = (u64) (ring_map + CNIC_PAGE_SIZE) & 0xffffffff; |
4647 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val); | 4648 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val); |
4648 | rxbd->rx_bd_haddr_lo = val; | 4649 | rxbd->rx_bd_haddr_lo = val; |
4649 | 4650 | ||
@@ -4709,10 +4710,10 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) | |||
4709 | 4710 | ||
4710 | val = CNIC_RD(dev, BNX2_MQ_CONFIG); | 4711 | val = CNIC_RD(dev, BNX2_MQ_CONFIG); |
4711 | val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; | 4712 | val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; |
4712 | if (BNX2_PAGE_BITS > 12) | 4713 | if (CNIC_PAGE_BITS > 12) |
4713 | val |= (12 - 8) << 4; | 4714 | val |= (12 - 8) << 4; |
4714 | else | 4715 | else |
4715 | val |= (BNX2_PAGE_BITS - 8) << 4; | 4716 | val |= (CNIC_PAGE_BITS - 8) << 4; |
4716 | 4717 | ||
4717 | CNIC_WR(dev, BNX2_MQ_CONFIG, val); | 4718 | CNIC_WR(dev, BNX2_MQ_CONFIG, val); |
4718 | 4719 | ||
@@ -4742,13 +4743,13 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) | |||
4742 | 4743 | ||
4743 | /* Initialize the kernel work queue context. */ | 4744 | /* Initialize the kernel work queue context. */ |
4744 | val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | | 4745 | val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | |
4745 | (BNX2_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; | 4746 | (CNIC_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; |
4746 | cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_TYPE, val); | 4747 | cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_TYPE, val); |
4747 | 4748 | ||
4748 | val = (BNX2_PAGE_SIZE / sizeof(struct kwqe) - 1) << 16; | 4749 | val = (CNIC_PAGE_SIZE / sizeof(struct kwqe) - 1) << 16; |
4749 | cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); | 4750 | cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); |
4750 | 4751 | ||
4751 | val = ((BNX2_PAGE_SIZE / sizeof(struct kwqe)) << 16) | KWQ_PAGE_CNT; | 4752 | val = ((CNIC_PAGE_SIZE / sizeof(struct kwqe)) << 16) | KWQ_PAGE_CNT; |
4752 | cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val); | 4753 | cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val); |
4753 | 4754 | ||
4754 | val = (u32) ((u64) cp->kwq_info.pgtbl_map >> 32); | 4755 | val = (u32) ((u64) cp->kwq_info.pgtbl_map >> 32); |
@@ -4768,13 +4769,13 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) | |||
4768 | 4769 | ||
4769 | /* Initialize the kernel complete queue context. */ | 4770 | /* Initialize the kernel complete queue context. */ |
4770 | val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | | 4771 | val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | |
4771 | (BNX2_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; | 4772 | (CNIC_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; |
4772 | cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_TYPE, val); | 4773 | cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_TYPE, val); |
4773 | 4774 | ||
4774 | val = (BNX2_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16; | 4775 | val = (CNIC_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16; |
4775 | cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); | 4776 | cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); |
4776 | 4777 | ||
4777 | val = ((BNX2_PAGE_SIZE / sizeof(struct kcqe)) << 16) | KCQ_PAGE_CNT; | 4778 | val = ((CNIC_PAGE_SIZE / sizeof(struct kcqe)) << 16) | KCQ_PAGE_CNT; |
4778 | cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val); | 4779 | cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val); |
4779 | 4780 | ||
4780 | val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32); | 4781 | val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32); |
@@ -4918,7 +4919,7 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, | |||
4918 | u32 cli = cp->ethdev->iscsi_l2_client_id; | 4919 | u32 cli = cp->ethdev->iscsi_l2_client_id; |
4919 | u32 val; | 4920 | u32 val; |
4920 | 4921 | ||
4921 | memset(txbd, 0, BNX2_PAGE_SIZE); | 4922 | memset(txbd, 0, CNIC_PAGE_SIZE); |
4922 | 4923 | ||
4923 | buf_map = udev->l2_buf_map; | 4924 | buf_map = udev->l2_buf_map; |
4924 | for (i = 0; i < BNX2_MAX_TX_DESC_CNT; i += 3, txbd += 3) { | 4925 | for (i = 0; i < BNX2_MAX_TX_DESC_CNT; i += 3, txbd += 3) { |
@@ -4978,9 +4979,9 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
4978 | struct bnx2x *bp = netdev_priv(dev->netdev); | 4979 | struct bnx2x *bp = netdev_priv(dev->netdev); |
4979 | struct cnic_uio_dev *udev = cp->udev; | 4980 | struct cnic_uio_dev *udev = cp->udev; |
4980 | struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (udev->l2_ring + | 4981 | struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (udev->l2_ring + |
4981 | BNX2_PAGE_SIZE); | 4982 | CNIC_PAGE_SIZE); |
4982 | struct eth_rx_cqe_next_page *rxcqe = (struct eth_rx_cqe_next_page *) | 4983 | struct eth_rx_cqe_next_page *rxcqe = (struct eth_rx_cqe_next_page *) |
4983 | (udev->l2_ring + (2 * BNX2_PAGE_SIZE)); | 4984 | (udev->l2_ring + (2 * CNIC_PAGE_SIZE)); |
4984 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; | 4985 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; |
4985 | int i; | 4986 | int i; |
4986 | u32 cli = cp->ethdev->iscsi_l2_client_id; | 4987 | u32 cli = cp->ethdev->iscsi_l2_client_id; |
@@ -5004,20 +5005,20 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
5004 | rxbd->addr_lo = cpu_to_le32(buf_map & 0xffffffff); | 5005 | rxbd->addr_lo = cpu_to_le32(buf_map & 0xffffffff); |
5005 | } | 5006 | } |
5006 | 5007 | ||
5007 | val = (u64) (ring_map + BNX2_PAGE_SIZE) >> 32; | 5008 | val = (u64) (ring_map + CNIC_PAGE_SIZE) >> 32; |
5008 | rxbd->addr_hi = cpu_to_le32(val); | 5009 | rxbd->addr_hi = cpu_to_le32(val); |
5009 | data->rx.bd_page_base.hi = cpu_to_le32(val); | 5010 | data->rx.bd_page_base.hi = cpu_to_le32(val); |
5010 | 5011 | ||
5011 | val = (u64) (ring_map + BNX2_PAGE_SIZE) & 0xffffffff; | 5012 | val = (u64) (ring_map + CNIC_PAGE_SIZE) & 0xffffffff; |
5012 | rxbd->addr_lo = cpu_to_le32(val); | 5013 | rxbd->addr_lo = cpu_to_le32(val); |
5013 | data->rx.bd_page_base.lo = cpu_to_le32(val); | 5014 | data->rx.bd_page_base.lo = cpu_to_le32(val); |
5014 | 5015 | ||
5015 | rxcqe += BNX2X_MAX_RCQ_DESC_CNT; | 5016 | rxcqe += BNX2X_MAX_RCQ_DESC_CNT; |
5016 | val = (u64) (ring_map + (2 * BNX2_PAGE_SIZE)) >> 32; | 5017 | val = (u64) (ring_map + (2 * CNIC_PAGE_SIZE)) >> 32; |
5017 | rxcqe->addr_hi = cpu_to_le32(val); | 5018 | rxcqe->addr_hi = cpu_to_le32(val); |
5018 | data->rx.cqe_page_base.hi = cpu_to_le32(val); | 5019 | data->rx.cqe_page_base.hi = cpu_to_le32(val); |
5019 | 5020 | ||
5020 | val = (u64) (ring_map + (2 * BNX2_PAGE_SIZE)) & 0xffffffff; | 5021 | val = (u64) (ring_map + (2 * CNIC_PAGE_SIZE)) & 0xffffffff; |
5021 | rxcqe->addr_lo = cpu_to_le32(val); | 5022 | rxcqe->addr_lo = cpu_to_le32(val); |
5022 | data->rx.cqe_page_base.lo = cpu_to_le32(val); | 5023 | data->rx.cqe_page_base.lo = cpu_to_le32(val); |
5023 | 5024 | ||
@@ -5265,8 +5266,8 @@ static void cnic_shutdown_rings(struct cnic_dev *dev) | |||
5265 | msleep(10); | 5266 | msleep(10); |
5266 | } | 5267 | } |
5267 | clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); | 5268 | clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); |
5268 | rx_ring = udev->l2_ring + BNX2_PAGE_SIZE; | 5269 | rx_ring = udev->l2_ring + CNIC_PAGE_SIZE; |
5269 | memset(rx_ring, 0, BNX2_PAGE_SIZE); | 5270 | memset(rx_ring, 0, CNIC_PAGE_SIZE); |
5270 | } | 5271 | } |
5271 | 5272 | ||
5272 | static int cnic_register_netdev(struct cnic_dev *dev) | 5273 | static int cnic_register_netdev(struct cnic_dev *dev) |
diff --git a/drivers/net/ethernet/broadcom/cnic.h b/drivers/net/ethernet/broadcom/cnic.h index 0d6b13f854d9..d535ae4228b4 100644 --- a/drivers/net/ethernet/broadcom/cnic.h +++ b/drivers/net/ethernet/broadcom/cnic.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* cnic.h: Broadcom CNIC core network driver. | 1 | /* cnic.h: Broadcom CNIC core network driver. |
2 | * | 2 | * |
3 | * Copyright (c) 2006-2013 Broadcom Corporation | 3 | * Copyright (c) 2006-2014 Broadcom Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/net/ethernet/broadcom/cnic_defs.h b/drivers/net/ethernet/broadcom/cnic_defs.h index 95a8e4b11c9f..dcbca6997e8f 100644 --- a/drivers/net/ethernet/broadcom/cnic_defs.h +++ b/drivers/net/ethernet/broadcom/cnic_defs.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /* cnic.c: Broadcom CNIC core network driver. | 2 | /* cnic.c: Broadcom CNIC core network driver. |
3 | * | 3 | * |
4 | * Copyright (c) 2006-2013 Broadcom Corporation | 4 | * Copyright (c) 2006-2014 Broadcom Corporation |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/net/ethernet/broadcom/cnic_if.h b/drivers/net/ethernet/broadcom/cnic_if.h index 8cf6b1926069..5f4d5573a73d 100644 --- a/drivers/net/ethernet/broadcom/cnic_if.h +++ b/drivers/net/ethernet/broadcom/cnic_if.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* cnic_if.h: Broadcom CNIC core network driver. | 1 | /* cnic_if.h: Broadcom CNIC core network driver. |
2 | * | 2 | * |
3 | * Copyright (c) 2006-2013 Broadcom Corporation | 3 | * Copyright (c) 2006-2014 Broadcom Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | #include "bnx2x/bnx2x_mfw_req.h" | 15 | #include "bnx2x/bnx2x_mfw_req.h" |
16 | 16 | ||
17 | #define CNIC_MODULE_VERSION "2.5.19" | 17 | #define CNIC_MODULE_VERSION "2.5.20" |
18 | #define CNIC_MODULE_RELDATE "December 19, 2013" | 18 | #define CNIC_MODULE_RELDATE "March 14, 2014" |
19 | 19 | ||
20 | #define CNIC_ULP_RDMA 0 | 20 | #define CNIC_ULP_RDMA 0 |
21 | #define CNIC_ULP_ISCSI 1 | 21 | #define CNIC_ULP_ISCSI 1 |
@@ -24,6 +24,16 @@ | |||
24 | #define MAX_CNIC_ULP_TYPE_EXT 3 | 24 | #define MAX_CNIC_ULP_TYPE_EXT 3 |
25 | #define MAX_CNIC_ULP_TYPE 4 | 25 | #define MAX_CNIC_ULP_TYPE 4 |
26 | 26 | ||
27 | /* Use CPU native page size up to 16K for cnic ring sizes. */ | ||
28 | #if (PAGE_SHIFT > 14) | ||
29 | #define CNIC_PAGE_BITS 14 | ||
30 | #else | ||
31 | #define CNIC_PAGE_BITS PAGE_SHIFT | ||
32 | #endif | ||
33 | #define CNIC_PAGE_SIZE (1 << (CNIC_PAGE_BITS)) | ||
34 | #define CNIC_PAGE_ALIGN(addr) ALIGN(addr, CNIC_PAGE_SIZE) | ||
35 | #define CNIC_PAGE_MASK (~((CNIC_PAGE_SIZE) - 1)) | ||
36 | |||
27 | struct kwqe { | 37 | struct kwqe { |
28 | u32 kwqe_op_flag; | 38 | u32 kwqe_op_flag; |
29 | 39 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3167ed6593b0..3b6d0ba86c71 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -6843,8 +6843,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
6843 | 6843 | ||
6844 | work_mask |= opaque_key; | 6844 | work_mask |= opaque_key; |
6845 | 6845 | ||
6846 | if ((desc->err_vlan & RXD_ERR_MASK) != 0 && | 6846 | if (desc->err_vlan & RXD_ERR_MASK) { |
6847 | (desc->err_vlan != RXD_ERR_ODD_NIBBLE_RCVD_MII)) { | ||
6848 | drop_it: | 6847 | drop_it: |
6849 | tg3_recycle_rx(tnapi, tpr, opaque_key, | 6848 | tg3_recycle_rx(tnapi, tpr, opaque_key, |
6850 | desc_idx, *post_ptr); | 6849 | desc_idx, *post_ptr); |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index ef472385bce4..04321e5a356e 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -2608,7 +2608,11 @@ struct tg3_rx_buffer_desc { | |||
2608 | #define RXD_ERR_TOO_SMALL 0x00400000 | 2608 | #define RXD_ERR_TOO_SMALL 0x00400000 |
2609 | #define RXD_ERR_NO_RESOURCES 0x00800000 | 2609 | #define RXD_ERR_NO_RESOURCES 0x00800000 |
2610 | #define RXD_ERR_HUGE_FRAME 0x01000000 | 2610 | #define RXD_ERR_HUGE_FRAME 0x01000000 |
2611 | #define RXD_ERR_MASK 0xffff0000 | 2611 | |
2612 | #define RXD_ERR_MASK (RXD_ERR_BAD_CRC | RXD_ERR_COLLISION | \ | ||
2613 | RXD_ERR_LINK_LOST | RXD_ERR_PHY_DECODE | \ | ||
2614 | RXD_ERR_MAC_ABRT | RXD_ERR_TOO_SMALL | \ | ||
2615 | RXD_ERR_NO_RESOURCES | RXD_ERR_HUGE_FRAME) | ||
2612 | 2616 | ||
2613 | u32 reserved; | 2617 | u32 reserved; |
2614 | u32 opaque; | 2618 | u32 opaque; |
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 1803c3959044..354ae9792bad 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c | |||
@@ -1704,7 +1704,7 @@ bfa_flash_sem_get(void __iomem *bar) | |||
1704 | while (!bfa_raw_sem_get(bar)) { | 1704 | while (!bfa_raw_sem_get(bar)) { |
1705 | if (--n <= 0) | 1705 | if (--n <= 0) |
1706 | return BFA_STATUS_BADFLASH; | 1706 | return BFA_STATUS_BADFLASH; |
1707 | udelay(10000); | 1707 | mdelay(10); |
1708 | } | 1708 | } |
1709 | return BFA_STATUS_OK; | 1709 | return BFA_STATUS_OK; |
1710 | } | 1710 | } |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index cf64f3d0b60d..4ad1187e82fb 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -707,7 +707,8 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) | |||
707 | else | 707 | else |
708 | skb_checksum_none_assert(skb); | 708 | skb_checksum_none_assert(skb); |
709 | 709 | ||
710 | if (flags & BNA_CQ_EF_VLAN) | 710 | if ((flags & BNA_CQ_EF_VLAN) && |
711 | (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) | ||
711 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cmpl->vlan_tag)); | 712 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cmpl->vlan_tag)); |
712 | 713 | ||
713 | if (BNAD_RXBUF_IS_SK_BUFF(unmap_q->type)) | 714 | if (BNAD_RXBUF_IS_SK_BUFF(unmap_q->type)) |
@@ -2094,7 +2095,9 @@ bnad_init_rx_config(struct bnad *bnad, struct bna_rx_config *rx_config) | |||
2094 | rx_config->q1_buf_size = BFI_SMALL_RXBUF_SIZE; | 2095 | rx_config->q1_buf_size = BFI_SMALL_RXBUF_SIZE; |
2095 | } | 2096 | } |
2096 | 2097 | ||
2097 | rx_config->vlan_strip_status = BNA_STATUS_T_ENABLED; | 2098 | rx_config->vlan_strip_status = |
2099 | (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) ? | ||
2100 | BNA_STATUS_T_ENABLED : BNA_STATUS_T_DISABLED; | ||
2098 | } | 2101 | } |
2099 | 2102 | ||
2100 | static void | 2103 | static void |
@@ -3245,11 +3248,6 @@ bnad_set_rx_mode(struct net_device *netdev) | |||
3245 | BNA_RXMODE_ALLMULTI; | 3248 | BNA_RXMODE_ALLMULTI; |
3246 | bna_rx_mode_set(bnad->rx_info[0].rx, new_mode, mode_mask, NULL); | 3249 | bna_rx_mode_set(bnad->rx_info[0].rx, new_mode, mode_mask, NULL); |
3247 | 3250 | ||
3248 | if (bnad->cfg_flags & BNAD_CF_PROMISC) | ||
3249 | bna_rx_vlan_strip_disable(bnad->rx_info[0].rx); | ||
3250 | else | ||
3251 | bna_rx_vlan_strip_enable(bnad->rx_info[0].rx); | ||
3252 | |||
3253 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | 3251 | spin_unlock_irqrestore(&bnad->bna_lock, flags); |
3254 | } | 3252 | } |
3255 | 3253 | ||
@@ -3374,6 +3372,27 @@ bnad_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid) | |||
3374 | return 0; | 3372 | return 0; |
3375 | } | 3373 | } |
3376 | 3374 | ||
3375 | static int bnad_set_features(struct net_device *dev, netdev_features_t features) | ||
3376 | { | ||
3377 | struct bnad *bnad = netdev_priv(dev); | ||
3378 | netdev_features_t changed = features ^ dev->features; | ||
3379 | |||
3380 | if ((changed & NETIF_F_HW_VLAN_CTAG_RX) && netif_running(dev)) { | ||
3381 | unsigned long flags; | ||
3382 | |||
3383 | spin_lock_irqsave(&bnad->bna_lock, flags); | ||
3384 | |||
3385 | if (features & NETIF_F_HW_VLAN_CTAG_RX) | ||
3386 | bna_rx_vlan_strip_enable(bnad->rx_info[0].rx); | ||
3387 | else | ||
3388 | bna_rx_vlan_strip_disable(bnad->rx_info[0].rx); | ||
3389 | |||
3390 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | ||
3391 | } | ||
3392 | |||
3393 | return 0; | ||
3394 | } | ||
3395 | |||
3377 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3396 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3378 | static void | 3397 | static void |
3379 | bnad_netpoll(struct net_device *netdev) | 3398 | bnad_netpoll(struct net_device *netdev) |
@@ -3421,6 +3440,7 @@ static const struct net_device_ops bnad_netdev_ops = { | |||
3421 | .ndo_change_mtu = bnad_change_mtu, | 3440 | .ndo_change_mtu = bnad_change_mtu, |
3422 | .ndo_vlan_rx_add_vid = bnad_vlan_rx_add_vid, | 3441 | .ndo_vlan_rx_add_vid = bnad_vlan_rx_add_vid, |
3423 | .ndo_vlan_rx_kill_vid = bnad_vlan_rx_kill_vid, | 3442 | .ndo_vlan_rx_kill_vid = bnad_vlan_rx_kill_vid, |
3443 | .ndo_set_features = bnad_set_features, | ||
3424 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3444 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3425 | .ndo_poll_controller = bnad_netpoll | 3445 | .ndo_poll_controller = bnad_netpoll |
3426 | #endif | 3446 | #endif |
@@ -3433,14 +3453,14 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac) | |||
3433 | 3453 | ||
3434 | netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | | 3454 | netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | |
3435 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 3455 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
3436 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX; | 3456 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX | |
3457 | NETIF_F_HW_VLAN_CTAG_RX; | ||
3437 | 3458 | ||
3438 | netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA | | 3459 | netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA | |
3439 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 3460 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
3440 | NETIF_F_TSO | NETIF_F_TSO6; | 3461 | NETIF_F_TSO | NETIF_F_TSO6; |
3441 | 3462 | ||
3442 | netdev->features |= netdev->hw_features | | 3463 | netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; |
3443 | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER; | ||
3444 | 3464 | ||
3445 | if (using_dac) | 3465 | if (using_dac) |
3446 | netdev->features |= NETIF_F_HIGHDMA; | 3466 | netdev->features |= NETIF_F_HIGHDMA; |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 3190d38e16fb..d0c38e01e99f 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -632,11 +632,16 @@ static void gem_rx_refill(struct macb *bp) | |||
632 | "Unable to allocate sk_buff\n"); | 632 | "Unable to allocate sk_buff\n"); |
633 | break; | 633 | break; |
634 | } | 634 | } |
635 | bp->rx_skbuff[entry] = skb; | ||
636 | 635 | ||
637 | /* now fill corresponding descriptor entry */ | 636 | /* now fill corresponding descriptor entry */ |
638 | paddr = dma_map_single(&bp->pdev->dev, skb->data, | 637 | paddr = dma_map_single(&bp->pdev->dev, skb->data, |
639 | bp->rx_buffer_size, DMA_FROM_DEVICE); | 638 | bp->rx_buffer_size, DMA_FROM_DEVICE); |
639 | if (dma_mapping_error(&bp->pdev->dev, paddr)) { | ||
640 | dev_kfree_skb(skb); | ||
641 | break; | ||
642 | } | ||
643 | |||
644 | bp->rx_skbuff[entry] = skb; | ||
640 | 645 | ||
641 | if (entry == RX_RING_SIZE - 1) | 646 | if (entry == RX_RING_SIZE - 1) |
642 | paddr |= MACB_BIT(RX_WRAP); | 647 | paddr |= MACB_BIT(RX_WRAP); |
@@ -725,7 +730,7 @@ static int gem_rx(struct macb *bp, int budget) | |||
725 | skb_put(skb, len); | 730 | skb_put(skb, len); |
726 | addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, addr)); | 731 | addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, addr)); |
727 | dma_unmap_single(&bp->pdev->dev, addr, | 732 | dma_unmap_single(&bp->pdev->dev, addr, |
728 | len, DMA_FROM_DEVICE); | 733 | bp->rx_buffer_size, DMA_FROM_DEVICE); |
729 | 734 | ||
730 | skb->protocol = eth_type_trans(skb, bp->dev); | 735 | skb->protocol = eth_type_trans(skb, bp->dev); |
731 | skb_checksum_none_assert(skb); | 736 | skb_checksum_none_assert(skb); |
@@ -1036,11 +1041,15 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1036 | } | 1041 | } |
1037 | 1042 | ||
1038 | entry = macb_tx_ring_wrap(bp->tx_head); | 1043 | entry = macb_tx_ring_wrap(bp->tx_head); |
1039 | bp->tx_head++; | ||
1040 | netdev_vdbg(bp->dev, "Allocated ring entry %u\n", entry); | 1044 | netdev_vdbg(bp->dev, "Allocated ring entry %u\n", entry); |
1041 | mapping = dma_map_single(&bp->pdev->dev, skb->data, | 1045 | mapping = dma_map_single(&bp->pdev->dev, skb->data, |
1042 | len, DMA_TO_DEVICE); | 1046 | len, DMA_TO_DEVICE); |
1047 | if (dma_mapping_error(&bp->pdev->dev, mapping)) { | ||
1048 | kfree_skb(skb); | ||
1049 | goto unlock; | ||
1050 | } | ||
1043 | 1051 | ||
1052 | bp->tx_head++; | ||
1044 | tx_skb = &bp->tx_skb[entry]; | 1053 | tx_skb = &bp->tx_skb[entry]; |
1045 | tx_skb->skb = skb; | 1054 | tx_skb->skb = skb; |
1046 | tx_skb->mapping = mapping; | 1055 | tx_skb->mapping = mapping; |
@@ -1066,6 +1075,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1066 | if (CIRC_SPACE(bp->tx_head, bp->tx_tail, TX_RING_SIZE) < 1) | 1075 | if (CIRC_SPACE(bp->tx_head, bp->tx_tail, TX_RING_SIZE) < 1) |
1067 | netif_stop_queue(dev); | 1076 | netif_stop_queue(dev); |
1068 | 1077 | ||
1078 | unlock: | ||
1069 | spin_unlock_irqrestore(&bp->lock, flags); | 1079 | spin_unlock_irqrestore(&bp->lock, flags); |
1070 | 1080 | ||
1071 | return NETDEV_TX_OK; | 1081 | return NETDEV_TX_OK; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 43ab35fea48d..34e2488767d9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -6179,6 +6179,7 @@ static struct pci_driver cxgb4_driver = { | |||
6179 | .id_table = cxgb4_pci_tbl, | 6179 | .id_table = cxgb4_pci_tbl, |
6180 | .probe = init_one, | 6180 | .probe = init_one, |
6181 | .remove = remove_one, | 6181 | .remove = remove_one, |
6182 | .shutdown = remove_one, | ||
6182 | .err_handler = &cxgb4_eeh, | 6183 | .err_handler = &cxgb4_eeh, |
6183 | }; | 6184 | }; |
6184 | 6185 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 8d09615da585..05529e273050 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -350,11 +350,13 @@ struct be_drv_stats { | |||
350 | u32 roce_drops_crc; | 350 | u32 roce_drops_crc; |
351 | }; | 351 | }; |
352 | 352 | ||
353 | /* A vlan-id of 0xFFFF must be used to clear transparent vlan-tagging */ | ||
354 | #define BE_RESET_VLAN_TAG_ID 0xFFFF | ||
355 | |||
353 | struct be_vf_cfg { | 356 | struct be_vf_cfg { |
354 | unsigned char mac_addr[ETH_ALEN]; | 357 | unsigned char mac_addr[ETH_ALEN]; |
355 | int if_handle; | 358 | int if_handle; |
356 | int pmac_id; | 359 | int pmac_id; |
357 | u16 def_vid; | ||
358 | u16 vlan_tag; | 360 | u16 vlan_tag; |
359 | u32 tx_rate; | 361 | u32 tx_rate; |
360 | }; | 362 | }; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 04ac9c6a0d39..36c80612e21a 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -913,24 +913,14 @@ static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, | |||
913 | return BE3_chip(adapter) && be_ipv6_exthdr_check(skb); | 913 | return BE3_chip(adapter) && be_ipv6_exthdr_check(skb); |
914 | } | 914 | } |
915 | 915 | ||
916 | static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | 916 | static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter, |
917 | struct sk_buff *skb, | 917 | struct sk_buff *skb, |
918 | bool *skip_hw_vlan) | 918 | bool *skip_hw_vlan) |
919 | { | 919 | { |
920 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; | 920 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; |
921 | unsigned int eth_hdr_len; | 921 | unsigned int eth_hdr_len; |
922 | struct iphdr *ip; | 922 | struct iphdr *ip; |
923 | 923 | ||
924 | /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or less | ||
925 | * may cause a transmit stall on that port. So the work-around is to | ||
926 | * pad short packets (<= 32 bytes) to a 36-byte length. | ||
927 | */ | ||
928 | if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { | ||
929 | if (skb_padto(skb, 36)) | ||
930 | goto tx_drop; | ||
931 | skb->len = 36; | ||
932 | } | ||
933 | |||
934 | /* For padded packets, BE HW modifies tot_len field in IP header | 924 | /* For padded packets, BE HW modifies tot_len field in IP header |
935 | * incorrecly when VLAN tag is inserted by HW. | 925 | * incorrecly when VLAN tag is inserted by HW. |
936 | * For padded packets, Lancer computes incorrect checksum. | 926 | * For padded packets, Lancer computes incorrect checksum. |
@@ -959,7 +949,7 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | |||
959 | vlan_tx_tag_present(skb)) { | 949 | vlan_tx_tag_present(skb)) { |
960 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); | 950 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); |
961 | if (unlikely(!skb)) | 951 | if (unlikely(!skb)) |
962 | goto tx_drop; | 952 | goto err; |
963 | } | 953 | } |
964 | 954 | ||
965 | /* HW may lockup when VLAN HW tagging is requested on | 955 | /* HW may lockup when VLAN HW tagging is requested on |
@@ -981,15 +971,39 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | |||
981 | be_vlan_tag_tx_chk(adapter, skb)) { | 971 | be_vlan_tag_tx_chk(adapter, skb)) { |
982 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); | 972 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); |
983 | if (unlikely(!skb)) | 973 | if (unlikely(!skb)) |
984 | goto tx_drop; | 974 | goto err; |
985 | } | 975 | } |
986 | 976 | ||
987 | return skb; | 977 | return skb; |
988 | tx_drop: | 978 | tx_drop: |
989 | dev_kfree_skb_any(skb); | 979 | dev_kfree_skb_any(skb); |
980 | err: | ||
990 | return NULL; | 981 | return NULL; |
991 | } | 982 | } |
992 | 983 | ||
984 | static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | ||
985 | struct sk_buff *skb, | ||
986 | bool *skip_hw_vlan) | ||
987 | { | ||
988 | /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or | ||
989 | * less may cause a transmit stall on that port. So the work-around is | ||
990 | * to pad short packets (<= 32 bytes) to a 36-byte length. | ||
991 | */ | ||
992 | if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { | ||
993 | if (skb_padto(skb, 36)) | ||
994 | return NULL; | ||
995 | skb->len = 36; | ||
996 | } | ||
997 | |||
998 | if (BEx_chip(adapter) || lancer_chip(adapter)) { | ||
999 | skb = be_lancer_xmit_workarounds(adapter, skb, skip_hw_vlan); | ||
1000 | if (!skb) | ||
1001 | return NULL; | ||
1002 | } | ||
1003 | |||
1004 | return skb; | ||
1005 | } | ||
1006 | |||
993 | static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) | 1007 | static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) |
994 | { | 1008 | { |
995 | struct be_adapter *adapter = netdev_priv(netdev); | 1009 | struct be_adapter *adapter = netdev_priv(netdev); |
@@ -1157,6 +1171,14 @@ ret: | |||
1157 | return status; | 1171 | return status; |
1158 | } | 1172 | } |
1159 | 1173 | ||
1174 | static void be_clear_promisc(struct be_adapter *adapter) | ||
1175 | { | ||
1176 | adapter->promiscuous = false; | ||
1177 | adapter->flags &= ~BE_FLAGS_VLAN_PROMISC; | ||
1178 | |||
1179 | be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); | ||
1180 | } | ||
1181 | |||
1160 | static void be_set_rx_mode(struct net_device *netdev) | 1182 | static void be_set_rx_mode(struct net_device *netdev) |
1161 | { | 1183 | { |
1162 | struct be_adapter *adapter = netdev_priv(netdev); | 1184 | struct be_adapter *adapter = netdev_priv(netdev); |
@@ -1170,9 +1192,7 @@ static void be_set_rx_mode(struct net_device *netdev) | |||
1170 | 1192 | ||
1171 | /* BE was previously in promiscuous mode; disable it */ | 1193 | /* BE was previously in promiscuous mode; disable it */ |
1172 | if (adapter->promiscuous) { | 1194 | if (adapter->promiscuous) { |
1173 | adapter->promiscuous = false; | 1195 | be_clear_promisc(adapter); |
1174 | be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); | ||
1175 | |||
1176 | if (adapter->vlans_added) | 1196 | if (adapter->vlans_added) |
1177 | be_vid_config(adapter); | 1197 | be_vid_config(adapter); |
1178 | } | 1198 | } |
@@ -1287,24 +1307,20 @@ static int be_set_vf_vlan(struct net_device *netdev, | |||
1287 | 1307 | ||
1288 | if (vlan || qos) { | 1308 | if (vlan || qos) { |
1289 | vlan |= qos << VLAN_PRIO_SHIFT; | 1309 | vlan |= qos << VLAN_PRIO_SHIFT; |
1290 | if (vf_cfg->vlan_tag != vlan) { | 1310 | if (vf_cfg->vlan_tag != vlan) |
1291 | /* If this is new value, program it. Else skip. */ | ||
1292 | vf_cfg->vlan_tag = vlan; | ||
1293 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | 1311 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, |
1294 | vf_cfg->if_handle, 0); | 1312 | vf_cfg->if_handle, 0); |
1295 | } | ||
1296 | } else { | 1313 | } else { |
1297 | /* Reset Transparent Vlan Tagging. */ | 1314 | /* Reset Transparent Vlan Tagging. */ |
1298 | vf_cfg->vlan_tag = 0; | 1315 | status = be_cmd_set_hsw_config(adapter, BE_RESET_VLAN_TAG_ID, |
1299 | vlan = vf_cfg->def_vid; | 1316 | vf + 1, vf_cfg->if_handle, 0); |
1300 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | ||
1301 | vf_cfg->if_handle, 0); | ||
1302 | } | 1317 | } |
1303 | 1318 | ||
1304 | 1319 | if (!status) | |
1305 | if (status) | 1320 | vf_cfg->vlan_tag = vlan; |
1321 | else | ||
1306 | dev_info(&adapter->pdev->dev, | 1322 | dev_info(&adapter->pdev->dev, |
1307 | "VLAN %d config on VF %d failed\n", vlan, vf); | 1323 | "VLAN %d config on VF %d failed\n", vlan, vf); |
1308 | return status; | 1324 | return status; |
1309 | } | 1325 | } |
1310 | 1326 | ||
@@ -3013,11 +3029,11 @@ static int be_vf_setup_init(struct be_adapter *adapter) | |||
3013 | 3029 | ||
3014 | static int be_vf_setup(struct be_adapter *adapter) | 3030 | static int be_vf_setup(struct be_adapter *adapter) |
3015 | { | 3031 | { |
3032 | struct device *dev = &adapter->pdev->dev; | ||
3016 | struct be_vf_cfg *vf_cfg; | 3033 | struct be_vf_cfg *vf_cfg; |
3017 | u16 def_vlan, lnk_speed; | ||
3018 | int status, old_vfs, vf; | 3034 | int status, old_vfs, vf; |
3019 | struct device *dev = &adapter->pdev->dev; | ||
3020 | u32 privileges; | 3035 | u32 privileges; |
3036 | u16 lnk_speed; | ||
3021 | 3037 | ||
3022 | old_vfs = pci_num_vf(adapter->pdev); | 3038 | old_vfs = pci_num_vf(adapter->pdev); |
3023 | if (old_vfs) { | 3039 | if (old_vfs) { |
@@ -3084,12 +3100,6 @@ static int be_vf_setup(struct be_adapter *adapter) | |||
3084 | if (!status) | 3100 | if (!status) |
3085 | vf_cfg->tx_rate = lnk_speed; | 3101 | vf_cfg->tx_rate = lnk_speed; |
3086 | 3102 | ||
3087 | status = be_cmd_get_hsw_config(adapter, &def_vlan, | ||
3088 | vf + 1, vf_cfg->if_handle, NULL); | ||
3089 | if (status) | ||
3090 | goto err; | ||
3091 | vf_cfg->def_vid = def_vlan; | ||
3092 | |||
3093 | if (!old_vfs) | 3103 | if (!old_vfs) |
3094 | be_cmd_enable_vf(adapter, vf + 1); | 3104 | be_cmd_enable_vf(adapter, vf + 1); |
3095 | } | 3105 | } |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 903362a7b584..03a351300013 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -389,12 +389,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
389 | netdev_err(ndev, "Tx DMA memory map failed\n"); | 389 | netdev_err(ndev, "Tx DMA memory map failed\n"); |
390 | return NETDEV_TX_OK; | 390 | return NETDEV_TX_OK; |
391 | } | 391 | } |
392 | /* Send it on its way. Tell FEC it's ready, interrupt when done, | ||
393 | * it's the last BD of the frame, and to put the CRC on the end. | ||
394 | */ | ||
395 | status |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | ||
396 | | BD_ENET_TX_LAST | BD_ENET_TX_TC); | ||
397 | bdp->cbd_sc = status; | ||
398 | 392 | ||
399 | if (fep->bufdesc_ex) { | 393 | if (fep->bufdesc_ex) { |
400 | 394 | ||
@@ -416,6 +410,13 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
416 | } | 410 | } |
417 | } | 411 | } |
418 | 412 | ||
413 | /* Send it on its way. Tell FEC it's ready, interrupt when done, | ||
414 | * it's the last BD of the frame, and to put the CRC on the end. | ||
415 | */ | ||
416 | status |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | ||
417 | | BD_ENET_TX_LAST | BD_ENET_TX_TC); | ||
418 | bdp->cbd_sc = status; | ||
419 | |||
419 | bdp_pre = fec_enet_get_prevdesc(bdp, fep); | 420 | bdp_pre = fec_enet_get_prevdesc(bdp, fep); |
420 | if ((id_entry->driver_data & FEC_QUIRK_ERR006358) && | 421 | if ((id_entry->driver_data & FEC_QUIRK_ERR006358) && |
421 | !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) { | 422 | !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) { |
@@ -527,13 +528,6 @@ fec_restart(struct net_device *ndev, int duplex) | |||
527 | /* Clear any outstanding interrupt. */ | 528 | /* Clear any outstanding interrupt. */ |
528 | writel(0xffc00000, fep->hwp + FEC_IEVENT); | 529 | writel(0xffc00000, fep->hwp + FEC_IEVENT); |
529 | 530 | ||
530 | /* Setup multicast filter. */ | ||
531 | set_multicast_list(ndev); | ||
532 | #ifndef CONFIG_M5272 | ||
533 | writel(0, fep->hwp + FEC_HASH_TABLE_HIGH); | ||
534 | writel(0, fep->hwp + FEC_HASH_TABLE_LOW); | ||
535 | #endif | ||
536 | |||
537 | /* Set maximum receive buffer size. */ | 531 | /* Set maximum receive buffer size. */ |
538 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); | 532 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); |
539 | 533 | ||
@@ -654,6 +648,13 @@ fec_restart(struct net_device *ndev, int duplex) | |||
654 | 648 | ||
655 | writel(rcntl, fep->hwp + FEC_R_CNTRL); | 649 | writel(rcntl, fep->hwp + FEC_R_CNTRL); |
656 | 650 | ||
651 | /* Setup multicast filter. */ | ||
652 | set_multicast_list(ndev); | ||
653 | #ifndef CONFIG_M5272 | ||
654 | writel(0, fep->hwp + FEC_HASH_TABLE_HIGH); | ||
655 | writel(0, fep->hwp + FEC_HASH_TABLE_LOW); | ||
656 | #endif | ||
657 | |||
657 | if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) { | 658 | if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) { |
658 | /* enable ENET endian swap */ | 659 | /* enable ENET endian swap */ |
659 | ecntl |= (1 << 8); | 660 | ecntl |= (1 << 8); |
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 4be971590461..1fc8334fc181 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
@@ -522,10 +522,21 @@ retry: | |||
522 | return rc; | 522 | return rc; |
523 | } | 523 | } |
524 | 524 | ||
525 | static u64 ibmveth_encode_mac_addr(u8 *mac) | ||
526 | { | ||
527 | int i; | ||
528 | u64 encoded = 0; | ||
529 | |||
530 | for (i = 0; i < ETH_ALEN; i++) | ||
531 | encoded = (encoded << 8) | mac[i]; | ||
532 | |||
533 | return encoded; | ||
534 | } | ||
535 | |||
525 | static int ibmveth_open(struct net_device *netdev) | 536 | static int ibmveth_open(struct net_device *netdev) |
526 | { | 537 | { |
527 | struct ibmveth_adapter *adapter = netdev_priv(netdev); | 538 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
528 | u64 mac_address = 0; | 539 | u64 mac_address; |
529 | int rxq_entries = 1; | 540 | int rxq_entries = 1; |
530 | unsigned long lpar_rc; | 541 | unsigned long lpar_rc; |
531 | int rc; | 542 | int rc; |
@@ -579,8 +590,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
579 | adapter->rx_queue.num_slots = rxq_entries; | 590 | adapter->rx_queue.num_slots = rxq_entries; |
580 | adapter->rx_queue.toggle = 1; | 591 | adapter->rx_queue.toggle = 1; |
581 | 592 | ||
582 | memcpy(&mac_address, netdev->dev_addr, netdev->addr_len); | 593 | mac_address = ibmveth_encode_mac_addr(netdev->dev_addr); |
583 | mac_address = mac_address >> 16; | ||
584 | 594 | ||
585 | rxq_desc.fields.flags_len = IBMVETH_BUF_VALID | | 595 | rxq_desc.fields.flags_len = IBMVETH_BUF_VALID | |
586 | adapter->rx_queue.queue_len; | 596 | adapter->rx_queue.queue_len; |
@@ -1183,8 +1193,8 @@ static void ibmveth_set_multicast_list(struct net_device *netdev) | |||
1183 | /* add the addresses to the filter table */ | 1193 | /* add the addresses to the filter table */ |
1184 | netdev_for_each_mc_addr(ha, netdev) { | 1194 | netdev_for_each_mc_addr(ha, netdev) { |
1185 | /* add the multicast address to the filter table */ | 1195 | /* add the multicast address to the filter table */ |
1186 | unsigned long mcast_addr = 0; | 1196 | u64 mcast_addr; |
1187 | memcpy(((char *)&mcast_addr)+2, ha->addr, ETH_ALEN); | 1197 | mcast_addr = ibmveth_encode_mac_addr(ha->addr); |
1188 | lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, | 1198 | lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, |
1189 | IbmVethMcastAddFilter, | 1199 | IbmVethMcastAddFilter, |
1190 | mcast_addr); | 1200 | mcast_addr); |
@@ -1372,9 +1382,6 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) | |||
1372 | 1382 | ||
1373 | netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16); | 1383 | netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16); |
1374 | 1384 | ||
1375 | adapter->mac_addr = 0; | ||
1376 | memcpy(&adapter->mac_addr, mac_addr_p, ETH_ALEN); | ||
1377 | |||
1378 | netdev->irq = dev->irq; | 1385 | netdev->irq = dev->irq; |
1379 | netdev->netdev_ops = &ibmveth_netdev_ops; | 1386 | netdev->netdev_ops = &ibmveth_netdev_ops; |
1380 | netdev->ethtool_ops = &netdev_ethtool_ops; | 1387 | netdev->ethtool_ops = &netdev_ethtool_ops; |
@@ -1383,7 +1390,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) | |||
1383 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 1390 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; |
1384 | netdev->features |= netdev->hw_features; | 1391 | netdev->features |= netdev->hw_features; |
1385 | 1392 | ||
1386 | memcpy(netdev->dev_addr, &adapter->mac_addr, netdev->addr_len); | 1393 | memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN); |
1387 | 1394 | ||
1388 | for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) { | 1395 | for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) { |
1389 | struct kobject *kobj = &adapter->rx_buff_pool[i].kobj; | 1396 | struct kobject *kobj = &adapter->rx_buff_pool[i].kobj; |
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h index 451ba7949e15..1f37499d4398 100644 --- a/drivers/net/ethernet/ibm/ibmveth.h +++ b/drivers/net/ethernet/ibm/ibmveth.h | |||
@@ -138,7 +138,6 @@ struct ibmveth_adapter { | |||
138 | struct napi_struct napi; | 138 | struct napi_struct napi; |
139 | struct net_device_stats stats; | 139 | struct net_device_stats stats; |
140 | unsigned int mcastFilterSize; | 140 | unsigned int mcastFilterSize; |
141 | unsigned long mac_addr; | ||
142 | void * buffer_list_addr; | 141 | void * buffer_list_addr; |
143 | void * filter_list_addr; | 142 | void * filter_list_addr; |
144 | dma_addr_t buffer_list_dma; | 143 | dma_addr_t buffer_list_dma; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index fad45316200a..84a96f70dfb5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -742,6 +742,14 @@ static int mlx4_en_replace_mac(struct mlx4_en_priv *priv, int qpn, | |||
742 | err = mlx4_en_uc_steer_add(priv, new_mac, | 742 | err = mlx4_en_uc_steer_add(priv, new_mac, |
743 | &qpn, | 743 | &qpn, |
744 | &entry->reg_id); | 744 | &entry->reg_id); |
745 | if (err) | ||
746 | return err; | ||
747 | if (priv->tunnel_reg_id) { | ||
748 | mlx4_flow_detach(priv->mdev->dev, priv->tunnel_reg_id); | ||
749 | priv->tunnel_reg_id = 0; | ||
750 | } | ||
751 | err = mlx4_en_tunnel_steer_add(priv, new_mac, qpn, | ||
752 | &priv->tunnel_reg_id); | ||
745 | return err; | 753 | return err; |
746 | } | 754 | } |
747 | } | 755 | } |
@@ -1792,6 +1800,8 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1792 | mc_list[5] = priv->port; | 1800 | mc_list[5] = priv->port; |
1793 | mlx4_multicast_detach(mdev->dev, &priv->rss_map.indir_qp, | 1801 | mlx4_multicast_detach(mdev->dev, &priv->rss_map.indir_qp, |
1794 | mc_list, MLX4_PROT_ETH, mclist->reg_id); | 1802 | mc_list, MLX4_PROT_ETH, mclist->reg_id); |
1803 | if (mclist->tunnel_reg_id) | ||
1804 | mlx4_flow_detach(mdev->dev, mclist->tunnel_reg_id); | ||
1795 | } | 1805 | } |
1796 | mlx4_en_clear_list(dev); | 1806 | mlx4_en_clear_list(dev); |
1797 | list_for_each_entry_safe(mclist, tmp, &priv->curr_list, list) { | 1807 | list_for_each_entry_safe(mclist, tmp, &priv->curr_list, list) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 91b69ff4b4a2..7e2995ecea6f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -129,13 +129,14 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags) | |||
129 | [0] = "RSS support", | 129 | [0] = "RSS support", |
130 | [1] = "RSS Toeplitz Hash Function support", | 130 | [1] = "RSS Toeplitz Hash Function support", |
131 | [2] = "RSS XOR Hash Function support", | 131 | [2] = "RSS XOR Hash Function support", |
132 | [3] = "Device manage flow steering support", | 132 | [3] = "Device managed flow steering support", |
133 | [4] = "Automatic MAC reassignment support", | 133 | [4] = "Automatic MAC reassignment support", |
134 | [5] = "Time stamping support", | 134 | [5] = "Time stamping support", |
135 | [6] = "VST (control vlan insertion/stripping) support", | 135 | [6] = "VST (control vlan insertion/stripping) support", |
136 | [7] = "FSM (MAC anti-spoofing) support", | 136 | [7] = "FSM (MAC anti-spoofing) support", |
137 | [8] = "Dynamic QP updates support", | 137 | [8] = "Dynamic QP updates support", |
138 | [9] = "TCP/IP offloads/flow-steering for VXLAN support" | 138 | [9] = "Device managed flow steering IPoIB support", |
139 | [10] = "TCP/IP offloads/flow-steering for VXLAN support" | ||
139 | }; | 140 | }; |
140 | int i; | 141 | int i; |
141 | 142 | ||
@@ -859,7 +860,7 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave, | |||
859 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_CQ_TS_SUPPORT_OFFSET); | 860 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_CQ_TS_SUPPORT_OFFSET); |
860 | 861 | ||
861 | /* For guests, disable vxlan tunneling */ | 862 | /* For guests, disable vxlan tunneling */ |
862 | MLX4_GET(field, outbox, QUERY_DEV_CAP_VXLAN); | 863 | MLX4_GET(field, outbox->buf, QUERY_DEV_CAP_VXLAN); |
863 | field &= 0xf7; | 864 | field &= 0xf7; |
864 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_VXLAN); | 865 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_VXLAN); |
865 | 866 | ||
@@ -869,7 +870,7 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave, | |||
869 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_BF_OFFSET); | 870 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_BF_OFFSET); |
870 | 871 | ||
871 | /* For guests, disable mw type 2 */ | 872 | /* For guests, disable mw type 2 */ |
872 | MLX4_GET(bmme_flags, outbox, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); | 873 | MLX4_GET(bmme_flags, outbox->buf, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); |
873 | bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN; | 874 | bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN; |
874 | MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); | 875 | MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); |
875 | 876 | ||
@@ -883,7 +884,7 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave, | |||
883 | } | 884 | } |
884 | 885 | ||
885 | /* turn off ipoib managed steering for guests */ | 886 | /* turn off ipoib managed steering for guests */ |
886 | MLX4_GET(field, outbox, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); | 887 | MLX4_GET(field, outbox->buf, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); |
887 | field &= ~0x80; | 888 | field &= ~0x80; |
888 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); | 889 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); |
889 | 890 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index d711158b0d4b..936c15364739 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -150,6 +150,8 @@ struct mlx4_port_config { | |||
150 | struct pci_dev *pdev; | 150 | struct pci_dev *pdev; |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static atomic_t pf_loading = ATOMIC_INIT(0); | ||
154 | |||
153 | int mlx4_check_port_params(struct mlx4_dev *dev, | 155 | int mlx4_check_port_params(struct mlx4_dev *dev, |
154 | enum mlx4_port_type *port_type) | 156 | enum mlx4_port_type *port_type) |
155 | { | 157 | { |
@@ -749,7 +751,7 @@ static void mlx4_request_modules(struct mlx4_dev *dev) | |||
749 | has_eth_port = true; | 751 | has_eth_port = true; |
750 | } | 752 | } |
751 | 753 | ||
752 | if (has_ib_port) | 754 | if (has_ib_port || (dev->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) |
753 | request_module_nowait(IB_DRV_NAME); | 755 | request_module_nowait(IB_DRV_NAME); |
754 | if (has_eth_port) | 756 | if (has_eth_port) |
755 | request_module_nowait(EN_DRV_NAME); | 757 | request_module_nowait(EN_DRV_NAME); |
@@ -1407,6 +1409,11 @@ static int mlx4_init_slave(struct mlx4_dev *dev) | |||
1407 | u32 slave_read; | 1409 | u32 slave_read; |
1408 | u32 cmd_channel_ver; | 1410 | u32 cmd_channel_ver; |
1409 | 1411 | ||
1412 | if (atomic_read(&pf_loading)) { | ||
1413 | mlx4_warn(dev, "PF is not ready. Deferring probe\n"); | ||
1414 | return -EPROBE_DEFER; | ||
1415 | } | ||
1416 | |||
1410 | mutex_lock(&priv->cmd.slave_cmd_mutex); | 1417 | mutex_lock(&priv->cmd.slave_cmd_mutex); |
1411 | priv->cmd.max_cmds = 1; | 1418 | priv->cmd.max_cmds = 1; |
1412 | mlx4_warn(dev, "Sending reset\n"); | 1419 | mlx4_warn(dev, "Sending reset\n"); |
@@ -2319,7 +2326,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data) | |||
2319 | 2326 | ||
2320 | if (num_vfs) { | 2327 | if (num_vfs) { |
2321 | mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", num_vfs); | 2328 | mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", num_vfs); |
2329 | |||
2330 | atomic_inc(&pf_loading); | ||
2322 | err = pci_enable_sriov(pdev, num_vfs); | 2331 | err = pci_enable_sriov(pdev, num_vfs); |
2332 | atomic_dec(&pf_loading); | ||
2333 | |||
2323 | if (err) { | 2334 | if (err) { |
2324 | mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n", | 2335 | mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n", |
2325 | err); | 2336 | err); |
@@ -2684,6 +2695,7 @@ static struct pci_driver mlx4_driver = { | |||
2684 | .name = DRV_NAME, | 2695 | .name = DRV_NAME, |
2685 | .id_table = mlx4_pci_table, | 2696 | .id_table = mlx4_pci_table, |
2686 | .probe = mlx4_init_one, | 2697 | .probe = mlx4_init_one, |
2698 | .shutdown = mlx4_remove_one, | ||
2687 | .remove = mlx4_remove_one, | 2699 | .remove = mlx4_remove_one, |
2688 | .err_handler = &mlx4_err_handler, | 2700 | .err_handler = &mlx4_err_handler, |
2689 | }; | 2701 | }; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index 6b65f7795215..7aec6c833973 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -51,8 +51,8 @@ | |||
51 | 51 | ||
52 | #define DRV_NAME "mlx4_core" | 52 | #define DRV_NAME "mlx4_core" |
53 | #define PFX DRV_NAME ": " | 53 | #define PFX DRV_NAME ": " |
54 | #define DRV_VERSION "1.1" | 54 | #define DRV_VERSION "2.2-1" |
55 | #define DRV_RELDATE "Dec, 2011" | 55 | #define DRV_RELDATE "Feb, 2014" |
56 | 56 | ||
57 | #define MLX4_FS_UDP_UC_EN (1 << 1) | 57 | #define MLX4_FS_UDP_UC_EN (1 << 1) |
58 | #define MLX4_FS_TCP_UC_EN (1 << 2) | 58 | #define MLX4_FS_TCP_UC_EN (1 << 2) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 9ca223bc90fc..b57e8c87a34e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -57,8 +57,8 @@ | |||
57 | #include "en_port.h" | 57 | #include "en_port.h" |
58 | 58 | ||
59 | #define DRV_NAME "mlx4_en" | 59 | #define DRV_NAME "mlx4_en" |
60 | #define DRV_VERSION "2.0" | 60 | #define DRV_VERSION "2.2-1" |
61 | #define DRV_RELDATE "Dec 2011" | 61 | #define DRV_RELDATE "Feb 2014" |
62 | 62 | ||
63 | #define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN) | 63 | #define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN) |
64 | 64 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index a064f06e0cb8..23b7e2d35a93 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include "mlx5_core.h" | 46 | #include "mlx5_core.h" |
47 | 47 | ||
48 | #define DRIVER_NAME "mlx5_core" | 48 | #define DRIVER_NAME "mlx5_core" |
49 | #define DRIVER_VERSION "1.0" | 49 | #define DRIVER_VERSION "2.2-1" |
50 | #define DRIVER_RELDATE "June 2013" | 50 | #define DRIVER_RELDATE "Feb 2014" |
51 | 51 | ||
52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); | 52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); |
53 | MODULE_DESCRIPTION("Mellanox ConnectX-IB HCA core library"); | 53 | MODULE_DESCRIPTION("Mellanox ConnectX-IB HCA core library"); |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index 727b546a9eb8..e0c92e0e5e1d 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/crc32.h> | 23 | #include <linux/crc32.h> |
24 | #include <linux/mii.h> | 24 | #include <linux/mii.h> |
25 | #include <linux/eeprom_93cx6.h> | 25 | #include <linux/eeprom_93cx6.h> |
26 | #include <linux/regulator/consumer.h> | ||
26 | 27 | ||
27 | #include <linux/spi/spi.h> | 28 | #include <linux/spi/spi.h> |
28 | 29 | ||
@@ -83,6 +84,7 @@ union ks8851_tx_hdr { | |||
83 | * @rc_rxqcr: Cached copy of KS_RXQCR. | 84 | * @rc_rxqcr: Cached copy of KS_RXQCR. |
84 | * @eeprom_size: Companion eeprom size in Bytes, 0 if no eeprom | 85 | * @eeprom_size: Companion eeprom size in Bytes, 0 if no eeprom |
85 | * @eeprom: 93CX6 EEPROM state for accessing on-board EEPROM. | 86 | * @eeprom: 93CX6 EEPROM state for accessing on-board EEPROM. |
87 | * @vdd_reg: Optional regulator supplying the chip | ||
86 | * | 88 | * |
87 | * The @lock ensures that the chip is protected when certain operations are | 89 | * The @lock ensures that the chip is protected when certain operations are |
88 | * in progress. When the read or write packet transfer is in progress, most | 90 | * in progress. When the read or write packet transfer is in progress, most |
@@ -130,6 +132,7 @@ struct ks8851_net { | |||
130 | struct spi_transfer spi_xfer2[2]; | 132 | struct spi_transfer spi_xfer2[2]; |
131 | 133 | ||
132 | struct eeprom_93cx6 eeprom; | 134 | struct eeprom_93cx6 eeprom; |
135 | struct regulator *vdd_reg; | ||
133 | }; | 136 | }; |
134 | 137 | ||
135 | static int msg_enable; | 138 | static int msg_enable; |
@@ -1414,6 +1417,21 @@ static int ks8851_probe(struct spi_device *spi) | |||
1414 | ks->spidev = spi; | 1417 | ks->spidev = spi; |
1415 | ks->tx_space = 6144; | 1418 | ks->tx_space = 6144; |
1416 | 1419 | ||
1420 | ks->vdd_reg = regulator_get_optional(&spi->dev, "vdd"); | ||
1421 | if (IS_ERR(ks->vdd_reg)) { | ||
1422 | ret = PTR_ERR(ks->vdd_reg); | ||
1423 | if (ret == -EPROBE_DEFER) | ||
1424 | goto err_reg; | ||
1425 | } else { | ||
1426 | ret = regulator_enable(ks->vdd_reg); | ||
1427 | if (ret) { | ||
1428 | dev_err(&spi->dev, "regulator enable fail: %d\n", | ||
1429 | ret); | ||
1430 | goto err_reg_en; | ||
1431 | } | ||
1432 | } | ||
1433 | |||
1434 | |||
1417 | mutex_init(&ks->lock); | 1435 | mutex_init(&ks->lock); |
1418 | spin_lock_init(&ks->statelock); | 1436 | spin_lock_init(&ks->statelock); |
1419 | 1437 | ||
@@ -1508,8 +1526,14 @@ static int ks8851_probe(struct spi_device *spi) | |||
1508 | err_netdev: | 1526 | err_netdev: |
1509 | free_irq(ndev->irq, ks); | 1527 | free_irq(ndev->irq, ks); |
1510 | 1528 | ||
1511 | err_id: | ||
1512 | err_irq: | 1529 | err_irq: |
1530 | err_id: | ||
1531 | if (!IS_ERR(ks->vdd_reg)) | ||
1532 | regulator_disable(ks->vdd_reg); | ||
1533 | err_reg_en: | ||
1534 | if (!IS_ERR(ks->vdd_reg)) | ||
1535 | regulator_put(ks->vdd_reg); | ||
1536 | err_reg: | ||
1513 | free_netdev(ndev); | 1537 | free_netdev(ndev); |
1514 | return ret; | 1538 | return ret; |
1515 | } | 1539 | } |
@@ -1523,6 +1547,10 @@ static int ks8851_remove(struct spi_device *spi) | |||
1523 | 1547 | ||
1524 | unregister_netdev(priv->netdev); | 1548 | unregister_netdev(priv->netdev); |
1525 | free_irq(spi->irq, priv); | 1549 | free_irq(spi->irq, priv); |
1550 | if (!IS_ERR(priv->vdd_reg)) { | ||
1551 | regulator_disable(priv->vdd_reg); | ||
1552 | regulator_put(priv->vdd_reg); | ||
1553 | } | ||
1526 | free_netdev(priv->netdev); | 1554 | free_netdev(priv->netdev); |
1527 | 1555 | ||
1528 | return 0; | 1556 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 4146664d4d6a..27c4f131863b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -340,6 +340,7 @@ int qlcnic_83xx_setup_intr(struct qlcnic_adapter *adapter) | |||
340 | if (qlcnic_sriov_vf_check(adapter)) | 340 | if (qlcnic_sriov_vf_check(adapter)) |
341 | return -EINVAL; | 341 | return -EINVAL; |
342 | num_msix = 1; | 342 | num_msix = 1; |
343 | adapter->drv_sds_rings = QLCNIC_SINGLE_RING; | ||
343 | adapter->drv_tx_rings = QLCNIC_SINGLE_RING; | 344 | adapter->drv_tx_rings = QLCNIC_SINGLE_RING; |
344 | } | 345 | } |
345 | } | 346 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c index 77f1bce432d2..7d4f54912bad 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | |||
@@ -807,7 +807,7 @@ qlcnic_dcb_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, u8 *prio, | |||
807 | !type->tc_param_valid) | 807 | !type->tc_param_valid) |
808 | return; | 808 | return; |
809 | 809 | ||
810 | if (tc < 0 || (tc > QLC_DCB_MAX_TC)) | 810 | if (tc < 0 || (tc >= QLC_DCB_MAX_TC)) |
811 | return; | 811 | return; |
812 | 812 | ||
813 | tc_cfg = &type->tc_cfg[tc]; | 813 | tc_cfg = &type->tc_cfg[tc]; |
@@ -843,7 +843,7 @@ static void qlcnic_dcb_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, | |||
843 | !type->tc_param_valid) | 843 | !type->tc_param_valid) |
844 | return; | 844 | return; |
845 | 845 | ||
846 | if (pgid < 0 || pgid > QLC_DCB_MAX_PG) | 846 | if (pgid < 0 || pgid >= QLC_DCB_MAX_PG) |
847 | return; | 847 | return; |
848 | 848 | ||
849 | pgcfg = &type->pg_cfg[pgid]; | 849 | pgcfg = &type->pg_cfg[pgid]; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index ba78c7481fa3..1222865cfb73 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -816,9 +816,10 @@ static int qlcnic_82xx_setup_intr(struct qlcnic_adapter *adapter) | |||
816 | 816 | ||
817 | if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) { | 817 | if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) { |
818 | qlcnic_disable_multi_tx(adapter); | 818 | qlcnic_disable_multi_tx(adapter); |
819 | adapter->drv_sds_rings = QLCNIC_SINGLE_RING; | ||
819 | 820 | ||
820 | err = qlcnic_enable_msi_legacy(adapter); | 821 | err = qlcnic_enable_msi_legacy(adapter); |
821 | if (!err) | 822 | if (err) |
822 | return err; | 823 | return err; |
823 | } | 824 | } |
824 | } | 825 | } |
@@ -3863,7 +3864,7 @@ int qlcnic_validate_rings(struct qlcnic_adapter *adapter, __u32 ring_cnt, | |||
3863 | strcpy(buf, "Tx"); | 3864 | strcpy(buf, "Tx"); |
3864 | } | 3865 | } |
3865 | 3866 | ||
3866 | if (!qlcnic_use_msi_x && !qlcnic_use_msi) { | 3867 | if (!QLCNIC_IS_MSI_FAMILY(adapter)) { |
3867 | netdev_err(netdev, "No RSS/TSS support in INT-x mode\n"); | 3868 | netdev_err(netdev, "No RSS/TSS support in INT-x mode\n"); |
3868 | return -EINVAL; | 3869 | return -EINVAL; |
3869 | } | 3870 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index 09acf15c3a56..e5277a632671 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -13,8 +13,6 @@ | |||
13 | #define QLC_VF_MIN_TX_RATE 100 | 13 | #define QLC_VF_MIN_TX_RATE 100 |
14 | #define QLC_VF_MAX_TX_RATE 9999 | 14 | #define QLC_VF_MAX_TX_RATE 9999 |
15 | #define QLC_MAC_OPCODE_MASK 0x7 | 15 | #define QLC_MAC_OPCODE_MASK 0x7 |
16 | #define QLC_MAC_STAR_ADD 6 | ||
17 | #define QLC_MAC_STAR_DEL 7 | ||
18 | #define QLC_VF_FLOOD_BIT BIT_16 | 16 | #define QLC_VF_FLOOD_BIT BIT_16 |
19 | #define QLC_FLOOD_MODE 0x5 | 17 | #define QLC_FLOOD_MODE 0x5 |
20 | 18 | ||
@@ -1206,13 +1204,6 @@ static int qlcnic_sriov_validate_cfg_macvlan(struct qlcnic_adapter *adapter, | |||
1206 | struct qlcnic_vport *vp = vf->vp; | 1204 | struct qlcnic_vport *vp = vf->vp; |
1207 | u8 op, new_op; | 1205 | u8 op, new_op; |
1208 | 1206 | ||
1209 | if (((cmd->req.arg[1] & QLC_MAC_OPCODE_MASK) == QLC_MAC_STAR_ADD) || | ||
1210 | ((cmd->req.arg[1] & QLC_MAC_OPCODE_MASK) == QLC_MAC_STAR_DEL)) { | ||
1211 | netdev_err(adapter->netdev, "MAC + any VLAN filter not allowed from VF %d\n", | ||
1212 | vf->pci_func); | ||
1213 | return -EINVAL; | ||
1214 | } | ||
1215 | |||
1216 | if (!(cmd->req.arg[1] & BIT_8)) | 1207 | if (!(cmd->req.arg[1] & BIT_8)) |
1217 | return -EINVAL; | 1208 | return -EINVAL; |
1218 | 1209 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 91a67ae8f17b..3ff7bc3e7a23 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -209,7 +209,7 @@ static const struct { | |||
209 | [RTL_GIGA_MAC_VER_16] = | 209 | [RTL_GIGA_MAC_VER_16] = |
210 | _R("RTL8101e", RTL_TD_0, NULL, JUMBO_1K, true), | 210 | _R("RTL8101e", RTL_TD_0, NULL, JUMBO_1K, true), |
211 | [RTL_GIGA_MAC_VER_17] = | 211 | [RTL_GIGA_MAC_VER_17] = |
212 | _R("RTL8168b/8111b", RTL_TD_1, NULL, JUMBO_4K, false), | 212 | _R("RTL8168b/8111b", RTL_TD_0, NULL, JUMBO_4K, false), |
213 | [RTL_GIGA_MAC_VER_18] = | 213 | [RTL_GIGA_MAC_VER_18] = |
214 | _R("RTL8168cp/8111cp", RTL_TD_1, NULL, JUMBO_6K, false), | 214 | _R("RTL8168cp/8111cp", RTL_TD_1, NULL, JUMBO_6K, false), |
215 | [RTL_GIGA_MAC_VER_19] = | 215 | [RTL_GIGA_MAC_VER_19] = |
@@ -7118,6 +7118,8 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7118 | } | 7118 | } |
7119 | 7119 | ||
7120 | mutex_init(&tp->wk.mutex); | 7120 | mutex_init(&tp->wk.mutex); |
7121 | u64_stats_init(&tp->rx_stats.syncp); | ||
7122 | u64_stats_init(&tp->tx_stats.syncp); | ||
7121 | 7123 | ||
7122 | /* Get MAC address */ | 7124 | /* Get MAC address */ |
7123 | for (i = 0; i < ETH_ALEN; i++) | 7125 | for (i = 0; i < ETH_ALEN; i++) |
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index eb75fbd11a01..d7a36829649a 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c | |||
@@ -1668,6 +1668,13 @@ void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) | |||
1668 | struct efx_ptp_data *ptp = efx->ptp_data; | 1668 | struct efx_ptp_data *ptp = efx->ptp_data; |
1669 | int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); | 1669 | int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); |
1670 | 1670 | ||
1671 | if (!ptp) { | ||
1672 | if (net_ratelimit()) | ||
1673 | netif_warn(efx, drv, efx->net_dev, | ||
1674 | "Received PTP event but PTP not set up\n"); | ||
1675 | return; | ||
1676 | } | ||
1677 | |||
1671 | if (!ptp->enabled) | 1678 | if (!ptp->enabled) |
1672 | return; | 1679 | return; |
1673 | 1680 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c index 72d282bf33a5..c553f6b5a913 100644 --- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c | |||
@@ -151,7 +151,7 @@ static void stmmac_clean_desc3(void *priv_ptr, struct dma_desc *p) | |||
151 | sizeof(struct dma_desc))); | 151 | sizeof(struct dma_desc))); |
152 | } | 152 | } |
153 | 153 | ||
154 | const struct stmmac_chain_mode_ops chain_mode_ops = { | 154 | const struct stmmac_mode_ops chain_mode_ops = { |
155 | .init = stmmac_init_dma_chain, | 155 | .init = stmmac_init_dma_chain, |
156 | .is_jumbo_frm = stmmac_is_jumbo_frm, | 156 | .is_jumbo_frm = stmmac_is_jumbo_frm, |
157 | .jumbo_frm = stmmac_jumbo_frm, | 157 | .jumbo_frm = stmmac_jumbo_frm, |
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 7834a3993946..74610f3aca9e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h | |||
@@ -419,20 +419,13 @@ struct mii_regs { | |||
419 | unsigned int data; /* MII Data */ | 419 | unsigned int data; /* MII Data */ |
420 | }; | 420 | }; |
421 | 421 | ||
422 | struct stmmac_ring_mode_ops { | 422 | struct stmmac_mode_ops { |
423 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); | ||
424 | unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); | ||
425 | void (*refill_desc3) (void *priv, struct dma_desc *p); | ||
426 | void (*init_desc3) (struct dma_desc *p); | ||
427 | void (*clean_desc3) (void *priv, struct dma_desc *p); | ||
428 | int (*set_16kib_bfsize) (int mtu); | ||
429 | }; | ||
430 | |||
431 | struct stmmac_chain_mode_ops { | ||
432 | void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, | 423 | void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, |
433 | unsigned int extend_desc); | 424 | unsigned int extend_desc); |
434 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); | 425 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); |
435 | unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); | 426 | unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); |
427 | int (*set_16kib_bfsize)(int mtu); | ||
428 | void (*init_desc3)(struct dma_desc *p); | ||
436 | void (*refill_desc3) (void *priv, struct dma_desc *p); | 429 | void (*refill_desc3) (void *priv, struct dma_desc *p); |
437 | void (*clean_desc3) (void *priv, struct dma_desc *p); | 430 | void (*clean_desc3) (void *priv, struct dma_desc *p); |
438 | }; | 431 | }; |
@@ -441,8 +434,7 @@ struct mac_device_info { | |||
441 | const struct stmmac_ops *mac; | 434 | const struct stmmac_ops *mac; |
442 | const struct stmmac_desc_ops *desc; | 435 | const struct stmmac_desc_ops *desc; |
443 | const struct stmmac_dma_ops *dma; | 436 | const struct stmmac_dma_ops *dma; |
444 | const struct stmmac_ring_mode_ops *ring; | 437 | const struct stmmac_mode_ops *mode; |
445 | const struct stmmac_chain_mode_ops *chain; | ||
446 | const struct stmmac_hwtimestamp *ptp; | 438 | const struct stmmac_hwtimestamp *ptp; |
447 | struct mii_regs mii; /* MII register Addresses */ | 439 | struct mii_regs mii; /* MII register Addresses */ |
448 | struct mac_link link; | 440 | struct mac_link link; |
@@ -460,7 +452,7 @@ void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr, | |||
460 | void stmmac_set_mac(void __iomem *ioaddr, bool enable); | 452 | void stmmac_set_mac(void __iomem *ioaddr, bool enable); |
461 | 453 | ||
462 | void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr); | 454 | void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr); |
463 | extern const struct stmmac_ring_mode_ops ring_mode_ops; | 455 | extern const struct stmmac_mode_ops ring_mode_ops; |
464 | extern const struct stmmac_chain_mode_ops chain_mode_ops; | 456 | extern const struct stmmac_mode_ops chain_mode_ops; |
465 | 457 | ||
466 | #endif /* __COMMON_H__ */ | 458 | #endif /* __COMMON_H__ */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index a96c7c2f5f3f..650a4be6bce5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c | |||
@@ -100,10 +100,9 @@ static void stmmac_refill_desc3(void *priv_ptr, struct dma_desc *p) | |||
100 | { | 100 | { |
101 | struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr; | 101 | struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr; |
102 | 102 | ||
103 | if (unlikely(priv->plat->has_gmac)) | 103 | /* Fill DES3 in case of RING mode */ |
104 | /* Fill DES3 in case of RING mode */ | 104 | if (priv->dma_buf_sz >= BUF_SIZE_8KiB) |
105 | if (priv->dma_buf_sz >= BUF_SIZE_8KiB) | 105 | p->des3 = p->des2 + BUF_SIZE_8KiB; |
106 | p->des3 = p->des2 + BUF_SIZE_8KiB; | ||
107 | } | 106 | } |
108 | 107 | ||
109 | /* In ring mode we need to fill the desc3 because it is used as buffer */ | 108 | /* In ring mode we need to fill the desc3 because it is used as buffer */ |
@@ -126,7 +125,7 @@ static int stmmac_set_16kib_bfsize(int mtu) | |||
126 | return ret; | 125 | return ret; |
127 | } | 126 | } |
128 | 127 | ||
129 | const struct stmmac_ring_mode_ops ring_mode_ops = { | 128 | const struct stmmac_mode_ops ring_mode_ops = { |
130 | .is_jumbo_frm = stmmac_is_jumbo_frm, | 129 | .is_jumbo_frm = stmmac_is_jumbo_frm, |
131 | .jumbo_frm = stmmac_jumbo_frm, | 130 | .jumbo_frm = stmmac_jumbo_frm, |
132 | .refill_desc3 = stmmac_refill_desc3, | 131 | .refill_desc3 = stmmac_refill_desc3, |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a2e7d2c96e36..8543e1cfd55e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -92,8 +92,8 @@ static int tc = TC_DEFAULT; | |||
92 | module_param(tc, int, S_IRUGO | S_IWUSR); | 92 | module_param(tc, int, S_IRUGO | S_IWUSR); |
93 | MODULE_PARM_DESC(tc, "DMA threshold control value"); | 93 | MODULE_PARM_DESC(tc, "DMA threshold control value"); |
94 | 94 | ||
95 | #define DMA_BUFFER_SIZE BUF_SIZE_4KiB | 95 | #define DEFAULT_BUFSIZE 1536 |
96 | static int buf_sz = DMA_BUFFER_SIZE; | 96 | static int buf_sz = DEFAULT_BUFSIZE; |
97 | module_param(buf_sz, int, S_IRUGO | S_IWUSR); | 97 | module_param(buf_sz, int, S_IRUGO | S_IWUSR); |
98 | MODULE_PARM_DESC(buf_sz, "DMA buffer size"); | 98 | MODULE_PARM_DESC(buf_sz, "DMA buffer size"); |
99 | 99 | ||
@@ -136,8 +136,8 @@ static void stmmac_verify_args(void) | |||
136 | dma_rxsize = DMA_RX_SIZE; | 136 | dma_rxsize = DMA_RX_SIZE; |
137 | if (unlikely(dma_txsize < 0)) | 137 | if (unlikely(dma_txsize < 0)) |
138 | dma_txsize = DMA_TX_SIZE; | 138 | dma_txsize = DMA_TX_SIZE; |
139 | if (unlikely((buf_sz < DMA_BUFFER_SIZE) || (buf_sz > BUF_SIZE_16KiB))) | 139 | if (unlikely((buf_sz < DEFAULT_BUFSIZE) || (buf_sz > BUF_SIZE_16KiB))) |
140 | buf_sz = DMA_BUFFER_SIZE; | 140 | buf_sz = DEFAULT_BUFSIZE; |
141 | if (unlikely(flow_ctrl > 1)) | 141 | if (unlikely(flow_ctrl > 1)) |
142 | flow_ctrl = FLOW_AUTO; | 142 | flow_ctrl = FLOW_AUTO; |
143 | else if (likely(flow_ctrl < 0)) | 143 | else if (likely(flow_ctrl < 0)) |
@@ -286,10 +286,25 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
286 | 286 | ||
287 | /* MAC core supports the EEE feature. */ | 287 | /* MAC core supports the EEE feature. */ |
288 | if (priv->dma_cap.eee) { | 288 | if (priv->dma_cap.eee) { |
289 | int tx_lpi_timer = priv->tx_lpi_timer; | ||
290 | |||
289 | /* Check if the PHY supports EEE */ | 291 | /* Check if the PHY supports EEE */ |
290 | if (phy_init_eee(priv->phydev, 1)) | 292 | if (phy_init_eee(priv->phydev, 1)) { |
293 | /* To manage at run-time if the EEE cannot be supported | ||
294 | * anymore (for example because the lp caps have been | ||
295 | * changed). | ||
296 | * In that case the driver disable own timers. | ||
297 | */ | ||
298 | if (priv->eee_active) { | ||
299 | pr_debug("stmmac: disable EEE\n"); | ||
300 | del_timer_sync(&priv->eee_ctrl_timer); | ||
301 | priv->hw->mac->set_eee_timer(priv->ioaddr, 0, | ||
302 | tx_lpi_timer); | ||
303 | } | ||
304 | priv->eee_active = 0; | ||
291 | goto out; | 305 | goto out; |
292 | 306 | } | |
307 | /* Activate the EEE and start timers */ | ||
293 | if (!priv->eee_active) { | 308 | if (!priv->eee_active) { |
294 | priv->eee_active = 1; | 309 | priv->eee_active = 1; |
295 | init_timer(&priv->eee_ctrl_timer); | 310 | init_timer(&priv->eee_ctrl_timer); |
@@ -300,13 +315,13 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
300 | 315 | ||
301 | priv->hw->mac->set_eee_timer(priv->ioaddr, | 316 | priv->hw->mac->set_eee_timer(priv->ioaddr, |
302 | STMMAC_DEFAULT_LIT_LS, | 317 | STMMAC_DEFAULT_LIT_LS, |
303 | priv->tx_lpi_timer); | 318 | tx_lpi_timer); |
304 | } else | 319 | } else |
305 | /* Set HW EEE according to the speed */ | 320 | /* Set HW EEE according to the speed */ |
306 | priv->hw->mac->set_eee_pls(priv->ioaddr, | 321 | priv->hw->mac->set_eee_pls(priv->ioaddr, |
307 | priv->phydev->link); | 322 | priv->phydev->link); |
308 | 323 | ||
309 | pr_info("stmmac: Energy-Efficient Ethernet initialized\n"); | 324 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); |
310 | 325 | ||
311 | ret = true; | 326 | ret = true; |
312 | } | 327 | } |
@@ -886,10 +901,10 @@ static int stmmac_set_bfsize(int mtu, int bufsize) | |||
886 | ret = BUF_SIZE_8KiB; | 901 | ret = BUF_SIZE_8KiB; |
887 | else if (mtu >= BUF_SIZE_2KiB) | 902 | else if (mtu >= BUF_SIZE_2KiB) |
888 | ret = BUF_SIZE_4KiB; | 903 | ret = BUF_SIZE_4KiB; |
889 | else if (mtu >= DMA_BUFFER_SIZE) | 904 | else if (mtu > DEFAULT_BUFSIZE) |
890 | ret = BUF_SIZE_2KiB; | 905 | ret = BUF_SIZE_2KiB; |
891 | else | 906 | else |
892 | ret = DMA_BUFFER_SIZE; | 907 | ret = DEFAULT_BUFSIZE; |
893 | 908 | ||
894 | return ret; | 909 | return ret; |
895 | } | 910 | } |
@@ -951,9 +966,9 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | |||
951 | 966 | ||
952 | p->des2 = priv->rx_skbuff_dma[i]; | 967 | p->des2 = priv->rx_skbuff_dma[i]; |
953 | 968 | ||
954 | if ((priv->mode == STMMAC_RING_MODE) && | 969 | if ((priv->hw->mode->init_desc3) && |
955 | (priv->dma_buf_sz == BUF_SIZE_16KiB)) | 970 | (priv->dma_buf_sz == BUF_SIZE_16KiB)) |
956 | priv->hw->ring->init_desc3(p); | 971 | priv->hw->mode->init_desc3(p); |
957 | 972 | ||
958 | return 0; | 973 | return 0; |
959 | } | 974 | } |
@@ -984,11 +999,8 @@ static int init_dma_desc_rings(struct net_device *dev) | |||
984 | unsigned int bfsize = 0; | 999 | unsigned int bfsize = 0; |
985 | int ret = -ENOMEM; | 1000 | int ret = -ENOMEM; |
986 | 1001 | ||
987 | /* Set the max buffer size according to the DESC mode | 1002 | if (priv->hw->mode->set_16kib_bfsize) |
988 | * and the MTU. Note that RING mode allows 16KiB bsize. | 1003 | bfsize = priv->hw->mode->set_16kib_bfsize(dev->mtu); |
989 | */ | ||
990 | if (priv->mode == STMMAC_RING_MODE) | ||
991 | bfsize = priv->hw->ring->set_16kib_bfsize(dev->mtu); | ||
992 | 1004 | ||
993 | if (bfsize < BUF_SIZE_16KiB) | 1005 | if (bfsize < BUF_SIZE_16KiB) |
994 | bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); | 1006 | bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); |
@@ -1029,15 +1041,15 @@ static int init_dma_desc_rings(struct net_device *dev) | |||
1029 | /* Setup the chained descriptor addresses */ | 1041 | /* Setup the chained descriptor addresses */ |
1030 | if (priv->mode == STMMAC_CHAIN_MODE) { | 1042 | if (priv->mode == STMMAC_CHAIN_MODE) { |
1031 | if (priv->extend_desc) { | 1043 | if (priv->extend_desc) { |
1032 | priv->hw->chain->init(priv->dma_erx, priv->dma_rx_phy, | 1044 | priv->hw->mode->init(priv->dma_erx, priv->dma_rx_phy, |
1033 | rxsize, 1); | 1045 | rxsize, 1); |
1034 | priv->hw->chain->init(priv->dma_etx, priv->dma_tx_phy, | 1046 | priv->hw->mode->init(priv->dma_etx, priv->dma_tx_phy, |
1035 | txsize, 1); | 1047 | txsize, 1); |
1036 | } else { | 1048 | } else { |
1037 | priv->hw->chain->init(priv->dma_rx, priv->dma_rx_phy, | 1049 | priv->hw->mode->init(priv->dma_rx, priv->dma_rx_phy, |
1038 | rxsize, 0); | 1050 | rxsize, 0); |
1039 | priv->hw->chain->init(priv->dma_tx, priv->dma_tx_phy, | 1051 | priv->hw->mode->init(priv->dma_tx, priv->dma_tx_phy, |
1040 | txsize, 0); | 1052 | txsize, 0); |
1041 | } | 1053 | } |
1042 | } | 1054 | } |
1043 | 1055 | ||
@@ -1288,7 +1300,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv) | |||
1288 | DMA_TO_DEVICE); | 1300 | DMA_TO_DEVICE); |
1289 | priv->tx_skbuff_dma[entry] = 0; | 1301 | priv->tx_skbuff_dma[entry] = 0; |
1290 | } | 1302 | } |
1291 | priv->hw->ring->clean_desc3(priv, p); | 1303 | priv->hw->mode->clean_desc3(priv, p); |
1292 | 1304 | ||
1293 | if (likely(skb != NULL)) { | 1305 | if (likely(skb != NULL)) { |
1294 | dev_kfree_skb(skb); | 1306 | dev_kfree_skb(skb); |
@@ -1705,7 +1717,7 @@ static int stmmac_open(struct net_device *dev) | |||
1705 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); | 1717 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); |
1706 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); | 1718 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); |
1707 | 1719 | ||
1708 | alloc_dma_desc_resources(priv); | 1720 | ret = alloc_dma_desc_resources(priv); |
1709 | if (ret < 0) { | 1721 | if (ret < 0) { |
1710 | pr_err("%s: DMA descriptors allocation failed\n", __func__); | 1722 | pr_err("%s: DMA descriptors allocation failed\n", __func__); |
1711 | goto dma_desc_error; | 1723 | goto dma_desc_error; |
@@ -1844,6 +1856,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1844 | int nfrags = skb_shinfo(skb)->nr_frags; | 1856 | int nfrags = skb_shinfo(skb)->nr_frags; |
1845 | struct dma_desc *desc, *first; | 1857 | struct dma_desc *desc, *first; |
1846 | unsigned int nopaged_len = skb_headlen(skb); | 1858 | unsigned int nopaged_len = skb_headlen(skb); |
1859 | unsigned int enh_desc = priv->plat->enh_desc; | ||
1847 | 1860 | ||
1848 | if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { | 1861 | if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { |
1849 | if (!netif_queue_stopped(dev)) { | 1862 | if (!netif_queue_stopped(dev)) { |
@@ -1871,27 +1884,19 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1871 | first = desc; | 1884 | first = desc; |
1872 | 1885 | ||
1873 | /* To program the descriptors according to the size of the frame */ | 1886 | /* To program the descriptors according to the size of the frame */ |
1874 | if (priv->mode == STMMAC_RING_MODE) { | 1887 | if (enh_desc) |
1875 | is_jumbo = priv->hw->ring->is_jumbo_frm(skb->len, | 1888 | is_jumbo = priv->hw->mode->is_jumbo_frm(skb->len, enh_desc); |
1876 | priv->plat->enh_desc); | 1889 | |
1877 | if (unlikely(is_jumbo)) | ||
1878 | entry = priv->hw->ring->jumbo_frm(priv, skb, | ||
1879 | csum_insertion); | ||
1880 | } else { | ||
1881 | is_jumbo = priv->hw->chain->is_jumbo_frm(skb->len, | ||
1882 | priv->plat->enh_desc); | ||
1883 | if (unlikely(is_jumbo)) | ||
1884 | entry = priv->hw->chain->jumbo_frm(priv, skb, | ||
1885 | csum_insertion); | ||
1886 | } | ||
1887 | if (likely(!is_jumbo)) { | 1890 | if (likely(!is_jumbo)) { |
1888 | desc->des2 = dma_map_single(priv->device, skb->data, | 1891 | desc->des2 = dma_map_single(priv->device, skb->data, |
1889 | nopaged_len, DMA_TO_DEVICE); | 1892 | nopaged_len, DMA_TO_DEVICE); |
1890 | priv->tx_skbuff_dma[entry] = desc->des2; | 1893 | priv->tx_skbuff_dma[entry] = desc->des2; |
1891 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, | 1894 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, |
1892 | csum_insertion, priv->mode); | 1895 | csum_insertion, priv->mode); |
1893 | } else | 1896 | } else { |
1894 | desc = first; | 1897 | desc = first; |
1898 | entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion); | ||
1899 | } | ||
1895 | 1900 | ||
1896 | for (i = 0; i < nfrags; i++) { | 1901 | for (i = 0; i < nfrags; i++) { |
1897 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 1902 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
@@ -2029,7 +2034,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) | |||
2029 | 2034 | ||
2030 | p->des2 = priv->rx_skbuff_dma[entry]; | 2035 | p->des2 = priv->rx_skbuff_dma[entry]; |
2031 | 2036 | ||
2032 | priv->hw->ring->refill_desc3(priv, p); | 2037 | priv->hw->mode->refill_desc3(priv, p); |
2033 | 2038 | ||
2034 | if (netif_msg_rx_status(priv)) | 2039 | if (netif_msg_rx_status(priv)) |
2035 | pr_debug("\trefill entry #%d\n", entry); | 2040 | pr_debug("\trefill entry #%d\n", entry); |
@@ -2633,11 +2638,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
2633 | 2638 | ||
2634 | /* To use the chained or ring mode */ | 2639 | /* To use the chained or ring mode */ |
2635 | if (chain_mode) { | 2640 | if (chain_mode) { |
2636 | priv->hw->chain = &chain_mode_ops; | 2641 | priv->hw->mode = &chain_mode_ops; |
2637 | pr_info(" Chain mode enabled\n"); | 2642 | pr_info(" Chain mode enabled\n"); |
2638 | priv->mode = STMMAC_CHAIN_MODE; | 2643 | priv->mode = STMMAC_CHAIN_MODE; |
2639 | } else { | 2644 | } else { |
2640 | priv->hw->ring = &ring_mode_ops; | 2645 | priv->hw->mode = &ring_mode_ops; |
2641 | pr_info(" Ring mode enabled\n"); | 2646 | pr_info(" Ring mode enabled\n"); |
2642 | priv->mode = STMMAC_RING_MODE; | 2647 | priv->mode = STMMAC_RING_MODE; |
2643 | } | 2648 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index c61bc72b8e90..8fb32a80f1c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -36,7 +36,7 @@ static const struct of_device_id stmmac_dt_ids[] = { | |||
36 | #ifdef CONFIG_DWMAC_STI | 36 | #ifdef CONFIG_DWMAC_STI |
37 | { .compatible = "st,stih415-dwmac", .data = &sti_gmac_data}, | 37 | { .compatible = "st,stih415-dwmac", .data = &sti_gmac_data}, |
38 | { .compatible = "st,stih416-dwmac", .data = &sti_gmac_data}, | 38 | { .compatible = "st,stih416-dwmac", .data = &sti_gmac_data}, |
39 | { .compatible = "st,stih127-dwmac", .data = &sti_gmac_data}, | 39 | { .compatible = "st,stid127-dwmac", .data = &sti_gmac_data}, |
40 | #endif | 40 | #endif |
41 | /* SoC specific glue layers should come before generic bindings */ | 41 | /* SoC specific glue layers should come before generic bindings */ |
42 | { .compatible = "st,spear600-gmac"}, | 42 | { .compatible = "st,spear600-gmac"}, |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 651087b5c8da..7d6d8ec676c8 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1164,11 +1164,17 @@ static void cpsw_init_host_port(struct cpsw_priv *priv) | |||
1164 | 1164 | ||
1165 | static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv) | 1165 | static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv) |
1166 | { | 1166 | { |
1167 | u32 slave_port; | ||
1168 | |||
1169 | slave_port = cpsw_get_slave_port(priv, slave->slave_num); | ||
1170 | |||
1167 | if (!slave->phy) | 1171 | if (!slave->phy) |
1168 | return; | 1172 | return; |
1169 | phy_stop(slave->phy); | 1173 | phy_stop(slave->phy); |
1170 | phy_disconnect(slave->phy); | 1174 | phy_disconnect(slave->phy); |
1171 | slave->phy = NULL; | 1175 | slave->phy = NULL; |
1176 | cpsw_ale_control_set(priv->ale, slave_port, | ||
1177 | ALE_PORT_STATE, ALE_PORT_STATE_DISABLE); | ||
1172 | } | 1178 | } |
1173 | 1179 | ||
1174 | static int cpsw_ndo_open(struct net_device *ndev) | 1180 | static int cpsw_ndo_open(struct net_device *ndev) |
@@ -2223,10 +2229,6 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2223 | goto clean_ale_ret; | 2229 | goto clean_ale_ret; |
2224 | } | 2230 | } |
2225 | 2231 | ||
2226 | if (cpts_register(&pdev->dev, priv->cpts, | ||
2227 | data->cpts_clock_mult, data->cpts_clock_shift)) | ||
2228 | dev_err(priv->dev, "error registering cpts device\n"); | ||
2229 | |||
2230 | cpsw_notice(priv, probe, "initialized device (regs %pa, irq %d)\n", | 2232 | cpsw_notice(priv, probe, "initialized device (regs %pa, irq %d)\n", |
2231 | &ss_res->start, ndev->irq); | 2233 | &ss_res->start, ndev->irq); |
2232 | 2234 | ||
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index 364d0c7952c0..88ef27067bf2 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c | |||
@@ -355,7 +355,7 @@ int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr) | |||
355 | int i; | 355 | int i; |
356 | 356 | ||
357 | spin_lock_irqsave(&ctlr->lock, flags); | 357 | spin_lock_irqsave(&ctlr->lock, flags); |
358 | if (ctlr->state != CPDMA_STATE_ACTIVE) { | 358 | if (ctlr->state == CPDMA_STATE_TEARDOWN) { |
359 | spin_unlock_irqrestore(&ctlr->lock, flags); | 359 | spin_unlock_irqrestore(&ctlr->lock, flags); |
360 | return -EINVAL; | 360 | return -EINVAL; |
361 | } | 361 | } |
@@ -891,7 +891,7 @@ int cpdma_chan_stop(struct cpdma_chan *chan) | |||
891 | unsigned timeout; | 891 | unsigned timeout; |
892 | 892 | ||
893 | spin_lock_irqsave(&chan->lock, flags); | 893 | spin_lock_irqsave(&chan->lock, flags); |
894 | if (chan->state != CPDMA_STATE_ACTIVE) { | 894 | if (chan->state == CPDMA_STATE_TEARDOWN) { |
895 | spin_unlock_irqrestore(&chan->lock, flags); | 895 | spin_unlock_irqrestore(&chan->lock, flags); |
896 | return -EINVAL; | 896 | return -EINVAL; |
897 | } | 897 | } |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index cd9b164a0434..8f0e69ce07ca 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1532,9 +1532,9 @@ static int emac_dev_open(struct net_device *ndev) | |||
1532 | struct device *emac_dev = &ndev->dev; | 1532 | struct device *emac_dev = &ndev->dev; |
1533 | u32 cnt; | 1533 | u32 cnt; |
1534 | struct resource *res; | 1534 | struct resource *res; |
1535 | int ret; | 1535 | int q, m, ret; |
1536 | int res_num = 0, irq_num = 0; | ||
1536 | int i = 0; | 1537 | int i = 0; |
1537 | int k = 0; | ||
1538 | struct emac_priv *priv = netdev_priv(ndev); | 1538 | struct emac_priv *priv = netdev_priv(ndev); |
1539 | 1539 | ||
1540 | pm_runtime_get(&priv->pdev->dev); | 1540 | pm_runtime_get(&priv->pdev->dev); |
@@ -1564,15 +1564,24 @@ static int emac_dev_open(struct net_device *ndev) | |||
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | /* Request IRQ */ | 1566 | /* Request IRQ */ |
1567 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, | ||
1568 | res_num))) { | ||
1569 | for (irq_num = res->start; irq_num <= res->end; irq_num++) { | ||
1570 | dev_err(emac_dev, "Request IRQ %d\n", irq_num); | ||
1571 | if (request_irq(irq_num, emac_irq, 0, ndev->name, | ||
1572 | ndev)) { | ||
1573 | dev_err(emac_dev, | ||
1574 | "DaVinci EMAC: request_irq() failed\n"); | ||
1575 | ret = -EBUSY; | ||
1567 | 1576 | ||
1568 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { | ||
1569 | for (i = res->start; i <= res->end; i++) { | ||
1570 | if (devm_request_irq(&priv->pdev->dev, i, emac_irq, | ||
1571 | 0, ndev->name, ndev)) | ||
1572 | goto rollback; | 1577 | goto rollback; |
1578 | } | ||
1573 | } | 1579 | } |
1574 | k++; | 1580 | res_num++; |
1575 | } | 1581 | } |
1582 | /* prepare counters for rollback in case of an error */ | ||
1583 | res_num--; | ||
1584 | irq_num--; | ||
1576 | 1585 | ||
1577 | /* Start/Enable EMAC hardware */ | 1586 | /* Start/Enable EMAC hardware */ |
1578 | emac_hw_enable(priv); | 1587 | emac_hw_enable(priv); |
@@ -1639,11 +1648,23 @@ static int emac_dev_open(struct net_device *ndev) | |||
1639 | 1648 | ||
1640 | return 0; | 1649 | return 0; |
1641 | 1650 | ||
1642 | rollback: | ||
1643 | |||
1644 | dev_err(emac_dev, "DaVinci EMAC: devm_request_irq() failed"); | ||
1645 | ret = -EBUSY; | ||
1646 | err: | 1651 | err: |
1652 | emac_int_disable(priv); | ||
1653 | napi_disable(&priv->napi); | ||
1654 | |||
1655 | rollback: | ||
1656 | for (q = res_num; q >= 0; q--) { | ||
1657 | res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, q); | ||
1658 | /* at the first iteration, irq_num is already set to the | ||
1659 | * right value | ||
1660 | */ | ||
1661 | if (q != res_num) | ||
1662 | irq_num = res->end; | ||
1663 | |||
1664 | for (m = irq_num; m >= res->start; m--) | ||
1665 | free_irq(m, ndev); | ||
1666 | } | ||
1667 | cpdma_ctlr_stop(priv->dma); | ||
1647 | pm_runtime_put(&priv->pdev->dev); | 1668 | pm_runtime_put(&priv->pdev->dev); |
1648 | return ret; | 1669 | return ret; |
1649 | } | 1670 | } |
@@ -1659,6 +1680,9 @@ err: | |||
1659 | */ | 1680 | */ |
1660 | static int emac_dev_stop(struct net_device *ndev) | 1681 | static int emac_dev_stop(struct net_device *ndev) |
1661 | { | 1682 | { |
1683 | struct resource *res; | ||
1684 | int i = 0; | ||
1685 | int irq_num; | ||
1662 | struct emac_priv *priv = netdev_priv(ndev); | 1686 | struct emac_priv *priv = netdev_priv(ndev); |
1663 | struct device *emac_dev = &ndev->dev; | 1687 | struct device *emac_dev = &ndev->dev; |
1664 | 1688 | ||
@@ -1674,6 +1698,13 @@ static int emac_dev_stop(struct net_device *ndev) | |||
1674 | if (priv->phydev) | 1698 | if (priv->phydev) |
1675 | phy_disconnect(priv->phydev); | 1699 | phy_disconnect(priv->phydev); |
1676 | 1700 | ||
1701 | /* Free IRQ */ | ||
1702 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, i))) { | ||
1703 | for (irq_num = res->start; irq_num <= res->end; irq_num++) | ||
1704 | free_irq(irq_num, priv->ndev); | ||
1705 | i++; | ||
1706 | } | ||
1707 | |||
1677 | if (netif_msg_drv(priv)) | 1708 | if (netif_msg_drv(priv)) |
1678 | dev_notice(emac_dev, "DaVinci EMAC: %s stopped\n", ndev->name); | 1709 | dev_notice(emac_dev, "DaVinci EMAC: %s stopped\n", ndev->name); |
1679 | 1710 | ||
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index ef312bc6b865..6ac20a6738f4 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c | |||
@@ -923,7 +923,7 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
923 | if (rc) { | 923 | if (rc) { |
924 | dev_err(&pdev->dev, | 924 | dev_err(&pdev->dev, |
925 | "32-bit PCI DMA addresses not supported by the card!?\n"); | 925 | "32-bit PCI DMA addresses not supported by the card!?\n"); |
926 | goto err_out; | 926 | goto err_out_pci_disable; |
927 | } | 927 | } |
928 | 928 | ||
929 | /* sanity check */ | 929 | /* sanity check */ |
@@ -931,7 +931,7 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
931 | (pci_resource_len(pdev, 1) < io_size)) { | 931 | (pci_resource_len(pdev, 1) < io_size)) { |
932 | rc = -EIO; | 932 | rc = -EIO; |
933 | dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n"); | 933 | dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n"); |
934 | goto err_out; | 934 | goto err_out_pci_disable; |
935 | } | 935 | } |
936 | 936 | ||
937 | pioaddr = pci_resource_start(pdev, 0); | 937 | pioaddr = pci_resource_start(pdev, 0); |
@@ -942,7 +942,7 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
942 | dev = alloc_etherdev(sizeof(struct rhine_private)); | 942 | dev = alloc_etherdev(sizeof(struct rhine_private)); |
943 | if (!dev) { | 943 | if (!dev) { |
944 | rc = -ENOMEM; | 944 | rc = -ENOMEM; |
945 | goto err_out; | 945 | goto err_out_pci_disable; |
946 | } | 946 | } |
947 | SET_NETDEV_DEV(dev, &pdev->dev); | 947 | SET_NETDEV_DEV(dev, &pdev->dev); |
948 | 948 | ||
@@ -1084,6 +1084,8 @@ err_out_free_res: | |||
1084 | pci_release_regions(pdev); | 1084 | pci_release_regions(pdev); |
1085 | err_out_free_netdev: | 1085 | err_out_free_netdev: |
1086 | free_netdev(dev); | 1086 | free_netdev(dev); |
1087 | err_out_pci_disable: | ||
1088 | pci_disable_device(pdev); | ||
1087 | err_out: | 1089 | err_out: |
1088 | return rc; | 1090 | return rc; |
1089 | } | 1091 | } |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 7141a1937360..d6fce9750b95 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -442,6 +442,8 @@ static int netvsc_probe(struct hv_device *dev, | |||
442 | if (!net) | 442 | if (!net) |
443 | return -ENOMEM; | 443 | return -ENOMEM; |
444 | 444 | ||
445 | netif_carrier_off(net); | ||
446 | |||
445 | net_device_ctx = netdev_priv(net); | 447 | net_device_ctx = netdev_priv(net); |
446 | net_device_ctx->device_ctx = dev; | 448 | net_device_ctx->device_ctx = dev; |
447 | hv_set_drvdata(dev, net); | 449 | hv_set_drvdata(dev, net); |
@@ -473,6 +475,8 @@ static int netvsc_probe(struct hv_device *dev, | |||
473 | pr_err("Unable to register netdev.\n"); | 475 | pr_err("Unable to register netdev.\n"); |
474 | rndis_filter_device_remove(dev); | 476 | rndis_filter_device_remove(dev); |
475 | free_netdev(net); | 477 | free_netdev(net); |
478 | } else { | ||
479 | schedule_delayed_work(&net_device_ctx->dwork, 0); | ||
476 | } | 480 | } |
477 | 481 | ||
478 | return ret; | 482 | return ret; |
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 1084e5de3ceb..b54fd257652b 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c | |||
@@ -243,6 +243,22 @@ static int rndis_filter_send_request(struct rndis_device *dev, | |||
243 | return ret; | 243 | return ret; |
244 | } | 244 | } |
245 | 245 | ||
246 | static void rndis_set_link_state(struct rndis_device *rdev, | ||
247 | struct rndis_request *request) | ||
248 | { | ||
249 | u32 link_status; | ||
250 | struct rndis_query_complete *query_complete; | ||
251 | |||
252 | query_complete = &request->response_msg.msg.query_complete; | ||
253 | |||
254 | if (query_complete->status == RNDIS_STATUS_SUCCESS && | ||
255 | query_complete->info_buflen == sizeof(u32)) { | ||
256 | memcpy(&link_status, (void *)((unsigned long)query_complete + | ||
257 | query_complete->info_buf_offset), sizeof(u32)); | ||
258 | rdev->link_state = link_status != 0; | ||
259 | } | ||
260 | } | ||
261 | |||
246 | static void rndis_filter_receive_response(struct rndis_device *dev, | 262 | static void rndis_filter_receive_response(struct rndis_device *dev, |
247 | struct rndis_message *resp) | 263 | struct rndis_message *resp) |
248 | { | 264 | { |
@@ -272,6 +288,10 @@ static void rndis_filter_receive_response(struct rndis_device *dev, | |||
272 | sizeof(struct rndis_message) + RNDIS_EXT_LEN) { | 288 | sizeof(struct rndis_message) + RNDIS_EXT_LEN) { |
273 | memcpy(&request->response_msg, resp, | 289 | memcpy(&request->response_msg, resp, |
274 | resp->msg_len); | 290 | resp->msg_len); |
291 | if (request->request_msg.ndis_msg_type == | ||
292 | RNDIS_MSG_QUERY && request->request_msg.msg. | ||
293 | query_req.oid == RNDIS_OID_GEN_MEDIA_CONNECT_STATUS) | ||
294 | rndis_set_link_state(dev, request); | ||
275 | } else { | 295 | } else { |
276 | netdev_err(ndev, | 296 | netdev_err(ndev, |
277 | "rndis response buffer overflow " | 297 | "rndis response buffer overflow " |
@@ -620,7 +640,6 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev) | |||
620 | ret = rndis_filter_query_device(dev, | 640 | ret = rndis_filter_query_device(dev, |
621 | RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, | 641 | RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, |
622 | &link_status, &size); | 642 | &link_status, &size); |
623 | dev->link_state = (link_status != 0) ? true : false; | ||
624 | 643 | ||
625 | return ret; | 644 | return ret; |
626 | } | 645 | } |
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index ab31544bc254..a30258aad139 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -546,12 +546,12 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb) | |||
546 | int rc; | 546 | int rc; |
547 | unsigned long flags; | 547 | unsigned long flags; |
548 | 548 | ||
549 | spin_lock(&lp->lock); | 549 | spin_lock_irqsave(&lp->lock, flags); |
550 | if (lp->irq_busy) { | 550 | if (lp->irq_busy) { |
551 | spin_unlock(&lp->lock); | 551 | spin_unlock_irqrestore(&lp->lock, flags); |
552 | return -EBUSY; | 552 | return -EBUSY; |
553 | } | 553 | } |
554 | spin_unlock(&lp->lock); | 554 | spin_unlock_irqrestore(&lp->lock, flags); |
555 | 555 | ||
556 | might_sleep(); | 556 | might_sleep(); |
557 | 557 | ||
@@ -725,10 +725,11 @@ static void at86rf230_irqwork_level(struct work_struct *work) | |||
725 | static irqreturn_t at86rf230_isr(int irq, void *data) | 725 | static irqreturn_t at86rf230_isr(int irq, void *data) |
726 | { | 726 | { |
727 | struct at86rf230_local *lp = data; | 727 | struct at86rf230_local *lp = data; |
728 | unsigned long flags; | ||
728 | 729 | ||
729 | spin_lock(&lp->lock); | 730 | spin_lock_irqsave(&lp->lock, flags); |
730 | lp->irq_busy = 1; | 731 | lp->irq_busy = 1; |
731 | spin_unlock(&lp->lock); | 732 | spin_unlock_irqrestore(&lp->lock, flags); |
732 | 733 | ||
733 | schedule_work(&lp->irqwork); | 734 | schedule_work(&lp->irqwork); |
734 | 735 | ||
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index a5d21893670d..1831fb7cd017 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -506,6 +506,9 @@ static int macvlan_change_mtu(struct net_device *dev, int new_mtu) | |||
506 | static struct lock_class_key macvlan_netdev_xmit_lock_key; | 506 | static struct lock_class_key macvlan_netdev_xmit_lock_key; |
507 | static struct lock_class_key macvlan_netdev_addr_lock_key; | 507 | static struct lock_class_key macvlan_netdev_addr_lock_key; |
508 | 508 | ||
509 | #define ALWAYS_ON_FEATURES \ | ||
510 | (NETIF_F_SG | NETIF_F_GEN_CSUM | NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX) | ||
511 | |||
509 | #define MACVLAN_FEATURES \ | 512 | #define MACVLAN_FEATURES \ |
510 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ | 513 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ |
511 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ | 514 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ |
@@ -539,7 +542,7 @@ static int macvlan_init(struct net_device *dev) | |||
539 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | | 542 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | |
540 | (lowerdev->state & MACVLAN_STATE_MASK); | 543 | (lowerdev->state & MACVLAN_STATE_MASK); |
541 | dev->features = lowerdev->features & MACVLAN_FEATURES; | 544 | dev->features = lowerdev->features & MACVLAN_FEATURES; |
542 | dev->features |= NETIF_F_LLTX; | 545 | dev->features |= ALWAYS_ON_FEATURES; |
543 | dev->gso_max_size = lowerdev->gso_max_size; | 546 | dev->gso_max_size = lowerdev->gso_max_size; |
544 | dev->iflink = lowerdev->ifindex; | 547 | dev->iflink = lowerdev->ifindex; |
545 | dev->hard_header_len = lowerdev->hard_header_len; | 548 | dev->hard_header_len = lowerdev->hard_header_len; |
@@ -699,7 +702,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev, | |||
699 | features = netdev_increment_features(vlan->lowerdev->features, | 702 | features = netdev_increment_features(vlan->lowerdev->features, |
700 | features, | 703 | features, |
701 | mask); | 704 | mask); |
702 | features |= NETIF_F_LLTX; | 705 | features |= ALWAYS_ON_FEATURES; |
703 | 706 | ||
704 | return features; | 707 | return features; |
705 | } | 708 | } |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 19c9eca0ef26..76d96b9ebcdb 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -164,9 +164,9 @@ static const struct phy_setting settings[] = { | |||
164 | * of that setting. Returns the index of the last setting if | 164 | * of that setting. Returns the index of the last setting if |
165 | * none of the others match. | 165 | * none of the others match. |
166 | */ | 166 | */ |
167 | static inline int phy_find_setting(int speed, int duplex) | 167 | static inline unsigned int phy_find_setting(int speed, int duplex) |
168 | { | 168 | { |
169 | int idx = 0; | 169 | unsigned int idx = 0; |
170 | 170 | ||
171 | while (idx < ARRAY_SIZE(settings) && | 171 | while (idx < ARRAY_SIZE(settings) && |
172 | (settings[idx].speed != speed || settings[idx].duplex != duplex)) | 172 | (settings[idx].speed != speed || settings[idx].duplex != duplex)) |
@@ -185,7 +185,7 @@ static inline int phy_find_setting(int speed, int duplex) | |||
185 | * the mask in features. Returns the index of the last setting | 185 | * the mask in features. Returns the index of the last setting |
186 | * if nothing else matches. | 186 | * if nothing else matches. |
187 | */ | 187 | */ |
188 | static inline int phy_find_valid(int idx, u32 features) | 188 | static inline unsigned int phy_find_valid(unsigned int idx, u32 features) |
189 | { | 189 | { |
190 | while (idx < MAX_NUM_SETTINGS && !(settings[idx].setting & features)) | 190 | while (idx < MAX_NUM_SETTINGS && !(settings[idx].setting & features)) |
191 | idx++; | 191 | idx++; |
@@ -204,7 +204,7 @@ static inline int phy_find_valid(int idx, u32 features) | |||
204 | static void phy_sanitize_settings(struct phy_device *phydev) | 204 | static void phy_sanitize_settings(struct phy_device *phydev) |
205 | { | 205 | { |
206 | u32 features = phydev->supported; | 206 | u32 features = phydev->supported; |
207 | int idx; | 207 | unsigned int idx; |
208 | 208 | ||
209 | /* Sanitize settings based on PHY capabilities */ | 209 | /* Sanitize settings based on PHY capabilities */ |
210 | if ((features & SUPPORTED_Autoneg) == 0) | 210 | if ((features & SUPPORTED_Autoneg) == 0) |
@@ -954,7 +954,8 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
954 | (phydev->interface == PHY_INTERFACE_MODE_RGMII))) { | 954 | (phydev->interface == PHY_INTERFACE_MODE_RGMII))) { |
955 | int eee_lp, eee_cap, eee_adv; | 955 | int eee_lp, eee_cap, eee_adv; |
956 | u32 lp, cap, adv; | 956 | u32 lp, cap, adv; |
957 | int idx, status; | 957 | int status; |
958 | unsigned int idx; | ||
958 | 959 | ||
959 | /* Read phy status to properly get the right settings */ | 960 | /* Read phy status to properly get the right settings */ |
960 | status = phy_read_status(phydev); | 961 | status = phy_read_status(phydev); |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 82514e72b3d8..2f6989b1e0dc 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -683,10 +683,9 @@ EXPORT_SYMBOL(phy_detach); | |||
683 | int phy_suspend(struct phy_device *phydev) | 683 | int phy_suspend(struct phy_device *phydev) |
684 | { | 684 | { |
685 | struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); | 685 | struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); |
686 | struct ethtool_wolinfo wol; | 686 | struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; |
687 | 687 | ||
688 | /* If the device has WOL enabled, we cannot suspend the PHY */ | 688 | /* If the device has WOL enabled, we cannot suspend the PHY */ |
689 | wol.cmd = ETHTOOL_GWOL; | ||
690 | phy_ethtool_get_wol(phydev, &wol); | 689 | phy_ethtool_get_wol(phydev, &wol); |
691 | if (wol.wolopts) | 690 | if (wol.wolopts) |
692 | return -EBUSY; | 691 | return -EBUSY; |
@@ -916,6 +915,8 @@ int genphy_read_status(struct phy_device *phydev) | |||
916 | int err; | 915 | int err; |
917 | int lpa; | 916 | int lpa; |
918 | int lpagb = 0; | 917 | int lpagb = 0; |
918 | int common_adv; | ||
919 | int common_adv_gb = 0; | ||
919 | 920 | ||
920 | /* Update the link, but return if there was an error */ | 921 | /* Update the link, but return if there was an error */ |
921 | err = genphy_update_link(phydev); | 922 | err = genphy_update_link(phydev); |
@@ -937,7 +938,7 @@ int genphy_read_status(struct phy_device *phydev) | |||
937 | 938 | ||
938 | phydev->lp_advertising = | 939 | phydev->lp_advertising = |
939 | mii_stat1000_to_ethtool_lpa_t(lpagb); | 940 | mii_stat1000_to_ethtool_lpa_t(lpagb); |
940 | lpagb &= adv << 2; | 941 | common_adv_gb = lpagb & adv << 2; |
941 | } | 942 | } |
942 | 943 | ||
943 | lpa = phy_read(phydev, MII_LPA); | 944 | lpa = phy_read(phydev, MII_LPA); |
@@ -950,25 +951,25 @@ int genphy_read_status(struct phy_device *phydev) | |||
950 | if (adv < 0) | 951 | if (adv < 0) |
951 | return adv; | 952 | return adv; |
952 | 953 | ||
953 | lpa &= adv; | 954 | common_adv = lpa & adv; |
954 | 955 | ||
955 | phydev->speed = SPEED_10; | 956 | phydev->speed = SPEED_10; |
956 | phydev->duplex = DUPLEX_HALF; | 957 | phydev->duplex = DUPLEX_HALF; |
957 | phydev->pause = 0; | 958 | phydev->pause = 0; |
958 | phydev->asym_pause = 0; | 959 | phydev->asym_pause = 0; |
959 | 960 | ||
960 | if (lpagb & (LPA_1000FULL | LPA_1000HALF)) { | 961 | if (common_adv_gb & (LPA_1000FULL | LPA_1000HALF)) { |
961 | phydev->speed = SPEED_1000; | 962 | phydev->speed = SPEED_1000; |
962 | 963 | ||
963 | if (lpagb & LPA_1000FULL) | 964 | if (common_adv_gb & LPA_1000FULL) |
964 | phydev->duplex = DUPLEX_FULL; | 965 | phydev->duplex = DUPLEX_FULL; |
965 | } else if (lpa & (LPA_100FULL | LPA_100HALF)) { | 966 | } else if (common_adv & (LPA_100FULL | LPA_100HALF)) { |
966 | phydev->speed = SPEED_100; | 967 | phydev->speed = SPEED_100; |
967 | 968 | ||
968 | if (lpa & LPA_100FULL) | 969 | if (common_adv & LPA_100FULL) |
969 | phydev->duplex = DUPLEX_FULL; | 970 | phydev->duplex = DUPLEX_FULL; |
970 | } else | 971 | } else |
971 | if (lpa & LPA_10FULL) | 972 | if (common_adv & LPA_10FULL) |
972 | phydev->duplex = DUPLEX_FULL; | 973 | phydev->duplex = DUPLEX_FULL; |
973 | 974 | ||
974 | if (phydev->duplex == DUPLEX_FULL) { | 975 | if (phydev->duplex == DUPLEX_FULL) { |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 8fe9cb7d0f72..26f8635b027d 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1686,7 +1686,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1686 | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | | 1686 | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | |
1687 | NETIF_F_HW_VLAN_STAG_TX; | 1687 | NETIF_F_HW_VLAN_STAG_TX; |
1688 | dev->features = dev->hw_features; | 1688 | dev->features = dev->hw_features; |
1689 | dev->vlan_features = dev->features; | 1689 | dev->vlan_features = dev->features & |
1690 | ~(NETIF_F_HW_VLAN_CTAG_TX | | ||
1691 | NETIF_F_HW_VLAN_STAG_TX); | ||
1690 | 1692 | ||
1691 | INIT_LIST_HEAD(&tun->disabled); | 1693 | INIT_LIST_HEAD(&tun->disabled); |
1692 | err = tun_attach(tun, file, false); | 1694 | err = tun_attach(tun, file, false); |
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile index 433f0a00c683..e2797f1e1b31 100644 --- a/drivers/net/usb/Makefile +++ b/drivers/net/usb/Makefile | |||
@@ -11,7 +11,7 @@ obj-$(CONFIG_USB_HSO) += hso.o | |||
11 | obj-$(CONFIG_USB_NET_AX8817X) += asix.o | 11 | obj-$(CONFIG_USB_NET_AX8817X) += asix.o |
12 | asix-y := asix_devices.o asix_common.o ax88172a.o | 12 | asix-y := asix_devices.o asix_common.o ax88172a.o |
13 | obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o | 13 | obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o |
14 | obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o r815x.o | 14 | obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o |
15 | obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o | 15 | obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o |
16 | obj-$(CONFIG_USB_NET_DM9601) += dm9601.o | 16 | obj-$(CONFIG_USB_NET_DM9601) += dm9601.o |
17 | obj-$(CONFIG_USB_NET_SR9700) += sr9700.o | 17 | obj-$(CONFIG_USB_NET_SR9700) += sr9700.o |
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 955df81a4358..054e59ca6946 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c | |||
@@ -1029,20 +1029,12 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1029 | dev->mii.phy_id = 0x03; | 1029 | dev->mii.phy_id = 0x03; |
1030 | dev->mii.supports_gmii = 1; | 1030 | dev->mii.supports_gmii = 1; |
1031 | 1031 | ||
1032 | if (usb_device_no_sg_constraint(dev->udev)) | ||
1033 | dev->can_dma_sg = 1; | ||
1034 | |||
1035 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1032 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1036 | NETIF_F_RXCSUM; | 1033 | NETIF_F_RXCSUM; |
1037 | 1034 | ||
1038 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1035 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1039 | NETIF_F_RXCSUM; | 1036 | NETIF_F_RXCSUM; |
1040 | 1037 | ||
1041 | if (dev->can_dma_sg) { | ||
1042 | dev->net->features |= NETIF_F_SG | NETIF_F_TSO; | ||
1043 | dev->net->hw_features |= NETIF_F_SG | NETIF_F_TSO; | ||
1044 | } | ||
1045 | |||
1046 | /* Enable checksum offload */ | 1038 | /* Enable checksum offload */ |
1047 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | | 1039 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | |
1048 | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; | 1040 | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; |
@@ -1395,6 +1387,19 @@ static const struct driver_info ax88178a_info = { | |||
1395 | .tx_fixup = ax88179_tx_fixup, | 1387 | .tx_fixup = ax88179_tx_fixup, |
1396 | }; | 1388 | }; |
1397 | 1389 | ||
1390 | static const struct driver_info dlink_dub1312_info = { | ||
1391 | .description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter", | ||
1392 | .bind = ax88179_bind, | ||
1393 | .unbind = ax88179_unbind, | ||
1394 | .status = ax88179_status, | ||
1395 | .link_reset = ax88179_link_reset, | ||
1396 | .reset = ax88179_reset, | ||
1397 | .stop = ax88179_stop, | ||
1398 | .flags = FLAG_ETHER | FLAG_FRAMING_AX, | ||
1399 | .rx_fixup = ax88179_rx_fixup, | ||
1400 | .tx_fixup = ax88179_tx_fixup, | ||
1401 | }; | ||
1402 | |||
1398 | static const struct driver_info sitecom_info = { | 1403 | static const struct driver_info sitecom_info = { |
1399 | .description = "Sitecom USB 3.0 to Gigabit Adapter", | 1404 | .description = "Sitecom USB 3.0 to Gigabit Adapter", |
1400 | .bind = ax88179_bind, | 1405 | .bind = ax88179_bind, |
@@ -1421,6 +1426,19 @@ static const struct driver_info samsung_info = { | |||
1421 | .tx_fixup = ax88179_tx_fixup, | 1426 | .tx_fixup = ax88179_tx_fixup, |
1422 | }; | 1427 | }; |
1423 | 1428 | ||
1429 | static const struct driver_info lenovo_info = { | ||
1430 | .description = "Lenovo OneLinkDock Gigabit LAN", | ||
1431 | .bind = ax88179_bind, | ||
1432 | .unbind = ax88179_unbind, | ||
1433 | .status = ax88179_status, | ||
1434 | .link_reset = ax88179_link_reset, | ||
1435 | .reset = ax88179_reset, | ||
1436 | .stop = ax88179_stop, | ||
1437 | .flags = FLAG_ETHER | FLAG_FRAMING_AX, | ||
1438 | .rx_fixup = ax88179_rx_fixup, | ||
1439 | .tx_fixup = ax88179_tx_fixup, | ||
1440 | }; | ||
1441 | |||
1424 | static const struct usb_device_id products[] = { | 1442 | static const struct usb_device_id products[] = { |
1425 | { | 1443 | { |
1426 | /* ASIX AX88179 10/100/1000 */ | 1444 | /* ASIX AX88179 10/100/1000 */ |
@@ -1431,6 +1449,10 @@ static const struct usb_device_id products[] = { | |||
1431 | USB_DEVICE(0x0b95, 0x178a), | 1449 | USB_DEVICE(0x0b95, 0x178a), |
1432 | .driver_info = (unsigned long)&ax88178a_info, | 1450 | .driver_info = (unsigned long)&ax88178a_info, |
1433 | }, { | 1451 | }, { |
1452 | /* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */ | ||
1453 | USB_DEVICE(0x2001, 0x4a00), | ||
1454 | .driver_info = (unsigned long)&dlink_dub1312_info, | ||
1455 | }, { | ||
1434 | /* Sitecom USB 3.0 to Gigabit Adapter */ | 1456 | /* Sitecom USB 3.0 to Gigabit Adapter */ |
1435 | USB_DEVICE(0x0df6, 0x0072), | 1457 | USB_DEVICE(0x0df6, 0x0072), |
1436 | .driver_info = (unsigned long)&sitecom_info, | 1458 | .driver_info = (unsigned long)&sitecom_info, |
@@ -1438,6 +1460,10 @@ static const struct usb_device_id products[] = { | |||
1438 | /* Samsung USB Ethernet Adapter */ | 1460 | /* Samsung USB Ethernet Adapter */ |
1439 | USB_DEVICE(0x04e8, 0xa100), | 1461 | USB_DEVICE(0x04e8, 0xa100), |
1440 | .driver_info = (unsigned long)&samsung_info, | 1462 | .driver_info = (unsigned long)&samsung_info, |
1463 | }, { | ||
1464 | /* Lenovo OneLinkDock Gigabit LAN */ | ||
1465 | USB_DEVICE(0x17ef, 0x304b), | ||
1466 | .driver_info = (unsigned long)&lenovo_info, | ||
1441 | }, | 1467 | }, |
1442 | { }, | 1468 | { }, |
1443 | }; | 1469 | }; |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 42e176912c8e..bd363b27e854 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -652,6 +652,13 @@ static const struct usb_device_id products[] = { | |||
652 | .driver_info = 0, | 652 | .driver_info = 0, |
653 | }, | 653 | }, |
654 | 654 | ||
655 | /* Samsung USB Ethernet Adapters */ | ||
656 | { | ||
657 | USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, 0xa101, USB_CLASS_COMM, | ||
658 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | ||
659 | .driver_info = 0, | ||
660 | }, | ||
661 | |||
655 | /* WHITELIST!!! | 662 | /* WHITELIST!!! |
656 | * | 663 | * |
657 | * CDC Ether uses two interfaces, not necessarily consecutive. | 664 | * CDC Ether uses two interfaces, not necessarily consecutive. |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index dbff290ed0e4..d350d2795e10 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -68,7 +68,6 @@ static struct usb_driver cdc_ncm_driver; | |||
68 | static int cdc_ncm_setup(struct usbnet *dev) | 68 | static int cdc_ncm_setup(struct usbnet *dev) |
69 | { | 69 | { |
70 | struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; | 70 | struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; |
71 | struct usb_cdc_ncm_ntb_parameters ncm_parm; | ||
72 | u32 val; | 71 | u32 val; |
73 | u8 flags; | 72 | u8 flags; |
74 | u8 iface_no; | 73 | u8 iface_no; |
@@ -82,22 +81,22 @@ static int cdc_ncm_setup(struct usbnet *dev) | |||
82 | err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_PARAMETERS, | 81 | err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_PARAMETERS, |
83 | USB_TYPE_CLASS | USB_DIR_IN | 82 | USB_TYPE_CLASS | USB_DIR_IN |
84 | |USB_RECIP_INTERFACE, | 83 | |USB_RECIP_INTERFACE, |
85 | 0, iface_no, &ncm_parm, | 84 | 0, iface_no, &ctx->ncm_parm, |
86 | sizeof(ncm_parm)); | 85 | sizeof(ctx->ncm_parm)); |
87 | if (err < 0) { | 86 | if (err < 0) { |
88 | dev_err(&dev->intf->dev, "failed GET_NTB_PARAMETERS\n"); | 87 | dev_err(&dev->intf->dev, "failed GET_NTB_PARAMETERS\n"); |
89 | return err; /* GET_NTB_PARAMETERS is required */ | 88 | return err; /* GET_NTB_PARAMETERS is required */ |
90 | } | 89 | } |
91 | 90 | ||
92 | /* read correct set of parameters according to device mode */ | 91 | /* read correct set of parameters according to device mode */ |
93 | ctx->rx_max = le32_to_cpu(ncm_parm.dwNtbInMaxSize); | 92 | ctx->rx_max = le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize); |
94 | ctx->tx_max = le32_to_cpu(ncm_parm.dwNtbOutMaxSize); | 93 | ctx->tx_max = le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize); |
95 | ctx->tx_remainder = le16_to_cpu(ncm_parm.wNdpOutPayloadRemainder); | 94 | ctx->tx_remainder = le16_to_cpu(ctx->ncm_parm.wNdpOutPayloadRemainder); |
96 | ctx->tx_modulus = le16_to_cpu(ncm_parm.wNdpOutDivisor); | 95 | ctx->tx_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutDivisor); |
97 | ctx->tx_ndp_modulus = le16_to_cpu(ncm_parm.wNdpOutAlignment); | 96 | ctx->tx_ndp_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutAlignment); |
98 | /* devices prior to NCM Errata shall set this field to zero */ | 97 | /* devices prior to NCM Errata shall set this field to zero */ |
99 | ctx->tx_max_datagrams = le16_to_cpu(ncm_parm.wNtbOutMaxDatagrams); | 98 | ctx->tx_max_datagrams = le16_to_cpu(ctx->ncm_parm.wNtbOutMaxDatagrams); |
100 | ntb_fmt_supported = le16_to_cpu(ncm_parm.bmNtbFormatsSupported); | 99 | ntb_fmt_supported = le16_to_cpu(ctx->ncm_parm.bmNtbFormatsSupported); |
101 | 100 | ||
102 | /* there are some minor differences in NCM and MBIM defaults */ | 101 | /* there are some minor differences in NCM and MBIM defaults */ |
103 | if (cdc_ncm_comm_intf_is_mbim(ctx->control->cur_altsetting)) { | 102 | if (cdc_ncm_comm_intf_is_mbim(ctx->control->cur_altsetting)) { |
@@ -146,7 +145,7 @@ static int cdc_ncm_setup(struct usbnet *dev) | |||
146 | } | 145 | } |
147 | 146 | ||
148 | /* inform device about NTB input size changes */ | 147 | /* inform device about NTB input size changes */ |
149 | if (ctx->rx_max != le32_to_cpu(ncm_parm.dwNtbInMaxSize)) { | 148 | if (ctx->rx_max != le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize)) { |
150 | __le32 dwNtbInMaxSize = cpu_to_le32(ctx->rx_max); | 149 | __le32 dwNtbInMaxSize = cpu_to_le32(ctx->rx_max); |
151 | 150 | ||
152 | err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_INPUT_SIZE, | 151 | err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_INPUT_SIZE, |
@@ -162,14 +161,6 @@ static int cdc_ncm_setup(struct usbnet *dev) | |||
162 | dev_dbg(&dev->intf->dev, "Using default maximum transmit length=%d\n", | 161 | dev_dbg(&dev->intf->dev, "Using default maximum transmit length=%d\n", |
163 | CDC_NCM_NTB_MAX_SIZE_TX); | 162 | CDC_NCM_NTB_MAX_SIZE_TX); |
164 | ctx->tx_max = CDC_NCM_NTB_MAX_SIZE_TX; | 163 | ctx->tx_max = CDC_NCM_NTB_MAX_SIZE_TX; |
165 | |||
166 | /* Adding a pad byte here simplifies the handling in | ||
167 | * cdc_ncm_fill_tx_frame, by making tx_max always | ||
168 | * represent the real skb max size. | ||
169 | */ | ||
170 | if (ctx->tx_max % usb_maxpacket(dev->udev, dev->out, 1) == 0) | ||
171 | ctx->tx_max++; | ||
172 | |||
173 | } | 164 | } |
174 | 165 | ||
175 | /* | 166 | /* |
@@ -439,6 +430,10 @@ advance: | |||
439 | goto error2; | 430 | goto error2; |
440 | } | 431 | } |
441 | 432 | ||
433 | /* initialize data interface */ | ||
434 | if (cdc_ncm_setup(dev)) | ||
435 | goto error2; | ||
436 | |||
442 | /* configure data interface */ | 437 | /* configure data interface */ |
443 | temp = usb_set_interface(dev->udev, iface_no, data_altsetting); | 438 | temp = usb_set_interface(dev->udev, iface_no, data_altsetting); |
444 | if (temp) { | 439 | if (temp) { |
@@ -453,12 +448,6 @@ advance: | |||
453 | goto error2; | 448 | goto error2; |
454 | } | 449 | } |
455 | 450 | ||
456 | /* initialize data interface */ | ||
457 | if (cdc_ncm_setup(dev)) { | ||
458 | dev_dbg(&intf->dev, "cdc_ncm_setup() failed\n"); | ||
459 | goto error2; | ||
460 | } | ||
461 | |||
462 | usb_set_intfdata(ctx->data, dev); | 451 | usb_set_intfdata(ctx->data, dev); |
463 | usb_set_intfdata(ctx->control, dev); | 452 | usb_set_intfdata(ctx->control, dev); |
464 | 453 | ||
@@ -475,6 +464,15 @@ advance: | |||
475 | dev->hard_mtu = ctx->tx_max; | 464 | dev->hard_mtu = ctx->tx_max; |
476 | dev->rx_urb_size = ctx->rx_max; | 465 | dev->rx_urb_size = ctx->rx_max; |
477 | 466 | ||
467 | /* cdc_ncm_setup will override dwNtbOutMaxSize if it is | ||
468 | * outside the sane range. Adding a pad byte here if necessary | ||
469 | * simplifies the handling in cdc_ncm_fill_tx_frame, making | ||
470 | * tx_max always represent the real skb max size. | ||
471 | */ | ||
472 | if (ctx->tx_max != le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize) && | ||
473 | ctx->tx_max % usb_maxpacket(dev->udev, dev->out, 1) == 0) | ||
474 | ctx->tx_max++; | ||
475 | |||
478 | return 0; | 476 | return 0; |
479 | 477 | ||
480 | error2: | 478 | error2: |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index d89dbe395ad2..adb12f349a61 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -449,9 +449,6 @@ enum rtl8152_flags { | |||
449 | #define MCU_TYPE_PLA 0x0100 | 449 | #define MCU_TYPE_PLA 0x0100 |
450 | #define MCU_TYPE_USB 0x0000 | 450 | #define MCU_TYPE_USB 0x0000 |
451 | 451 | ||
452 | #define REALTEK_USB_DEVICE(vend, prod) \ | ||
453 | USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC) | ||
454 | |||
455 | struct rx_desc { | 452 | struct rx_desc { |
456 | __le32 opts1; | 453 | __le32 opts1; |
457 | #define RX_LEN_MASK 0x7fff | 454 | #define RX_LEN_MASK 0x7fff |
@@ -2739,6 +2736,12 @@ static int rtl8152_probe(struct usb_interface *intf, | |||
2739 | struct net_device *netdev; | 2736 | struct net_device *netdev; |
2740 | int ret; | 2737 | int ret; |
2741 | 2738 | ||
2739 | if (udev->actconfig->desc.bConfigurationValue != 1) { | ||
2740 | usb_driver_set_configuration(udev, 1); | ||
2741 | return -ENODEV; | ||
2742 | } | ||
2743 | |||
2744 | usb_reset_device(udev); | ||
2742 | netdev = alloc_etherdev(sizeof(struct r8152)); | 2745 | netdev = alloc_etherdev(sizeof(struct r8152)); |
2743 | if (!netdev) { | 2746 | if (!netdev) { |
2744 | dev_err(&intf->dev, "Out of memory\n"); | 2747 | dev_err(&intf->dev, "Out of memory\n"); |
@@ -2819,9 +2822,9 @@ static void rtl8152_disconnect(struct usb_interface *intf) | |||
2819 | 2822 | ||
2820 | /* table of devices that work with this driver */ | 2823 | /* table of devices that work with this driver */ |
2821 | static struct usb_device_id rtl8152_table[] = { | 2824 | static struct usb_device_id rtl8152_table[] = { |
2822 | {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)}, | 2825 | {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)}, |
2823 | {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)}, | 2826 | {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)}, |
2824 | {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)}, | 2827 | {USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)}, |
2825 | {} | 2828 | {} |
2826 | }; | 2829 | }; |
2827 | 2830 | ||
diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c deleted file mode 100644 index f0a8791b7636..000000000000 --- a/drivers/net/usb/r815x.c +++ /dev/null | |||
@@ -1,248 +0,0 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <linux/netdevice.h> | ||
3 | #include <linux/mii.h> | ||
4 | #include <linux/usb.h> | ||
5 | #include <linux/usb/cdc.h> | ||
6 | #include <linux/usb/usbnet.h> | ||
7 | |||
8 | #define RTL815x_REQT_READ 0xc0 | ||
9 | #define RTL815x_REQT_WRITE 0x40 | ||
10 | #define RTL815x_REQ_GET_REGS 0x05 | ||
11 | #define RTL815x_REQ_SET_REGS 0x05 | ||
12 | |||
13 | #define MCU_TYPE_PLA 0x0100 | ||
14 | #define OCP_BASE 0xe86c | ||
15 | #define BASE_MII 0xa400 | ||
16 | |||
17 | #define BYTE_EN_DWORD 0xff | ||
18 | #define BYTE_EN_WORD 0x33 | ||
19 | #define BYTE_EN_BYTE 0x11 | ||
20 | |||
21 | #define R815x_PHY_ID 32 | ||
22 | #define REALTEK_VENDOR_ID 0x0bda | ||
23 | |||
24 | |||
25 | static int pla_read_word(struct usb_device *udev, u16 index) | ||
26 | { | ||
27 | int ret; | ||
28 | u8 shift = index & 2; | ||
29 | __le32 *tmp; | ||
30 | |||
31 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
32 | if (!tmp) | ||
33 | return -ENOMEM; | ||
34 | |||
35 | index &= ~3; | ||
36 | |||
37 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
38 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | ||
39 | index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); | ||
40 | if (ret < 0) | ||
41 | goto out2; | ||
42 | |||
43 | ret = __le32_to_cpu(*tmp); | ||
44 | ret >>= (shift * 8); | ||
45 | ret &= 0xffff; | ||
46 | |||
47 | out2: | ||
48 | kfree(tmp); | ||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | static int pla_write_word(struct usb_device *udev, u16 index, u32 data) | ||
53 | { | ||
54 | __le32 *tmp; | ||
55 | u32 mask = 0xffff; | ||
56 | u16 byen = BYTE_EN_WORD; | ||
57 | u8 shift = index & 2; | ||
58 | int ret; | ||
59 | |||
60 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
61 | if (!tmp) | ||
62 | return -ENOMEM; | ||
63 | |||
64 | data &= mask; | ||
65 | |||
66 | if (shift) { | ||
67 | byen <<= shift; | ||
68 | mask <<= (shift * 8); | ||
69 | data <<= (shift * 8); | ||
70 | index &= ~3; | ||
71 | } | ||
72 | |||
73 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
74 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | ||
75 | index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); | ||
76 | if (ret < 0) | ||
77 | goto out3; | ||
78 | |||
79 | data |= __le32_to_cpu(*tmp) & ~mask; | ||
80 | *tmp = __cpu_to_le32(data); | ||
81 | |||
82 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
83 | RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, | ||
84 | index, MCU_TYPE_PLA | byen, tmp, sizeof(*tmp), | ||
85 | 500); | ||
86 | |||
87 | out3: | ||
88 | kfree(tmp); | ||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | static int ocp_reg_read(struct usbnet *dev, u16 addr) | ||
93 | { | ||
94 | u16 ocp_base, ocp_index; | ||
95 | int ret; | ||
96 | |||
97 | ocp_base = addr & 0xf000; | ||
98 | ret = pla_write_word(dev->udev, OCP_BASE, ocp_base); | ||
99 | if (ret < 0) | ||
100 | goto out; | ||
101 | |||
102 | ocp_index = (addr & 0x0fff) | 0xb000; | ||
103 | ret = pla_read_word(dev->udev, ocp_index); | ||
104 | |||
105 | out: | ||
106 | return ret; | ||
107 | } | ||
108 | |||
109 | static int ocp_reg_write(struct usbnet *dev, u16 addr, u16 data) | ||
110 | { | ||
111 | u16 ocp_base, ocp_index; | ||
112 | int ret; | ||
113 | |||
114 | ocp_base = addr & 0xf000; | ||
115 | ret = pla_write_word(dev->udev, OCP_BASE, ocp_base); | ||
116 | if (ret < 0) | ||
117 | goto out1; | ||
118 | |||
119 | ocp_index = (addr & 0x0fff) | 0xb000; | ||
120 | ret = pla_write_word(dev->udev, ocp_index, data); | ||
121 | |||
122 | out1: | ||
123 | return ret; | ||
124 | } | ||
125 | |||
126 | static int r815x_mdio_read(struct net_device *netdev, int phy_id, int reg) | ||
127 | { | ||
128 | struct usbnet *dev = netdev_priv(netdev); | ||
129 | int ret; | ||
130 | |||
131 | if (phy_id != R815x_PHY_ID) | ||
132 | return -EINVAL; | ||
133 | |||
134 | if (usb_autopm_get_interface(dev->intf) < 0) | ||
135 | return -ENODEV; | ||
136 | |||
137 | ret = ocp_reg_read(dev, BASE_MII + reg * 2); | ||
138 | |||
139 | usb_autopm_put_interface(dev->intf); | ||
140 | return ret; | ||
141 | } | ||
142 | |||
143 | static | ||
144 | void r815x_mdio_write(struct net_device *netdev, int phy_id, int reg, int val) | ||
145 | { | ||
146 | struct usbnet *dev = netdev_priv(netdev); | ||
147 | |||
148 | if (phy_id != R815x_PHY_ID) | ||
149 | return; | ||
150 | |||
151 | if (usb_autopm_get_interface(dev->intf) < 0) | ||
152 | return; | ||
153 | |||
154 | ocp_reg_write(dev, BASE_MII + reg * 2, val); | ||
155 | |||
156 | usb_autopm_put_interface(dev->intf); | ||
157 | } | ||
158 | |||
159 | static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) | ||
160 | { | ||
161 | int status; | ||
162 | |||
163 | status = usbnet_cdc_bind(dev, intf); | ||
164 | if (status < 0) | ||
165 | return status; | ||
166 | |||
167 | dev->mii.dev = dev->net; | ||
168 | dev->mii.mdio_read = r815x_mdio_read; | ||
169 | dev->mii.mdio_write = r815x_mdio_write; | ||
170 | dev->mii.phy_id_mask = 0x3f; | ||
171 | dev->mii.reg_num_mask = 0x1f; | ||
172 | dev->mii.phy_id = R815x_PHY_ID; | ||
173 | dev->mii.supports_gmii = 1; | ||
174 | |||
175 | return status; | ||
176 | } | ||
177 | |||
178 | static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) | ||
179 | { | ||
180 | int status; | ||
181 | |||
182 | status = usbnet_cdc_bind(dev, intf); | ||
183 | if (status < 0) | ||
184 | return status; | ||
185 | |||
186 | dev->mii.dev = dev->net; | ||
187 | dev->mii.mdio_read = r815x_mdio_read; | ||
188 | dev->mii.mdio_write = r815x_mdio_write; | ||
189 | dev->mii.phy_id_mask = 0x3f; | ||
190 | dev->mii.reg_num_mask = 0x1f; | ||
191 | dev->mii.phy_id = R815x_PHY_ID; | ||
192 | dev->mii.supports_gmii = 0; | ||
193 | |||
194 | return status; | ||
195 | } | ||
196 | |||
197 | static const struct driver_info r8152_info = { | ||
198 | .description = "RTL8152 ECM Device", | ||
199 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, | ||
200 | .bind = r8152_bind, | ||
201 | .unbind = usbnet_cdc_unbind, | ||
202 | .status = usbnet_cdc_status, | ||
203 | .manage_power = usbnet_manage_power, | ||
204 | }; | ||
205 | |||
206 | static const struct driver_info r8153_info = { | ||
207 | .description = "RTL8153 ECM Device", | ||
208 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, | ||
209 | .bind = r8153_bind, | ||
210 | .unbind = usbnet_cdc_unbind, | ||
211 | .status = usbnet_cdc_status, | ||
212 | .manage_power = usbnet_manage_power, | ||
213 | }; | ||
214 | |||
215 | static const struct usb_device_id products[] = { | ||
216 | { | ||
217 | USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8152, USB_CLASS_COMM, | ||
218 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | ||
219 | .driver_info = (unsigned long) &r8152_info, | ||
220 | }, | ||
221 | |||
222 | { | ||
223 | USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8153, USB_CLASS_COMM, | ||
224 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | ||
225 | .driver_info = (unsigned long) &r8153_info, | ||
226 | }, | ||
227 | |||
228 | { }, /* END */ | ||
229 | }; | ||
230 | MODULE_DEVICE_TABLE(usb, products); | ||
231 | |||
232 | static struct usb_driver r815x_driver = { | ||
233 | .name = "r815x", | ||
234 | .id_table = products, | ||
235 | .probe = usbnet_probe, | ||
236 | .disconnect = usbnet_disconnect, | ||
237 | .suspend = usbnet_suspend, | ||
238 | .resume = usbnet_resume, | ||
239 | .reset_resume = usbnet_resume, | ||
240 | .supports_autosuspend = 1, | ||
241 | .disable_hub_initiated_lpm = 1, | ||
242 | }; | ||
243 | |||
244 | module_usb_driver(r815x_driver); | ||
245 | |||
246 | MODULE_AUTHOR("Hayes Wang"); | ||
247 | MODULE_DESCRIPTION("Realtek USB ECM device"); | ||
248 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 2ec2041b62d4..5b374370f71c 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -285,7 +285,8 @@ static void veth_setup(struct net_device *dev) | |||
285 | dev->ethtool_ops = &veth_ethtool_ops; | 285 | dev->ethtool_ops = &veth_ethtool_ops; |
286 | dev->features |= NETIF_F_LLTX; | 286 | dev->features |= NETIF_F_LLTX; |
287 | dev->features |= VETH_FEATURES; | 287 | dev->features |= VETH_FEATURES; |
288 | dev->vlan_features = dev->features; | 288 | dev->vlan_features = dev->features & |
289 | ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); | ||
289 | dev->destructor = veth_dev_free; | 290 | dev->destructor = veth_dev_free; |
290 | 291 | ||
291 | dev->hw_features = VETH_FEATURES; | 292 | dev->hw_features = VETH_FEATURES; |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d75f8edf4fb3..5632a99cbbd2 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1711,7 +1711,8 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1711 | /* If we can receive ANY GSO packets, we must allocate large ones. */ | 1711 | /* If we can receive ANY GSO packets, we must allocate large ones. */ |
1712 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || | 1712 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || |
1713 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || | 1713 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || |
1714 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) | 1714 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) || |
1715 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) | ||
1715 | vi->big_packets = true; | 1716 | vi->big_packets = true; |
1716 | 1717 | ||
1717 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) | 1718 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 3be786faaaec..0fa3b44f7342 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -1762,11 +1762,20 @@ vmxnet3_netpoll(struct net_device *netdev) | |||
1762 | { | 1762 | { |
1763 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | 1763 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
1764 | 1764 | ||
1765 | if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE) | 1765 | switch (adapter->intr.type) { |
1766 | vmxnet3_disable_all_intrs(adapter); | 1766 | #ifdef CONFIG_PCI_MSI |
1767 | 1767 | case VMXNET3_IT_MSIX: { | |
1768 | vmxnet3_do_poll(adapter, adapter->rx_queue[0].rx_ring[0].size); | 1768 | int i; |
1769 | vmxnet3_enable_all_intrs(adapter); | 1769 | for (i = 0; i < adapter->num_rx_queues; i++) |
1770 | vmxnet3_msix_rx(0, &adapter->rx_queue[i]); | ||
1771 | break; | ||
1772 | } | ||
1773 | #endif | ||
1774 | case VMXNET3_IT_MSI: | ||
1775 | default: | ||
1776 | vmxnet3_intr(0, adapter->netdev); | ||
1777 | break; | ||
1778 | } | ||
1770 | 1779 | ||
1771 | } | 1780 | } |
1772 | #endif /* CONFIG_NET_POLL_CONTROLLER */ | 1781 | #endif /* CONFIG_NET_POLL_CONTROLLER */ |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index b0f705c2378f..1236812c7be6 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -1318,6 +1318,9 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb) | |||
1318 | 1318 | ||
1319 | neigh_release(n); | 1319 | neigh_release(n); |
1320 | 1320 | ||
1321 | if (reply == NULL) | ||
1322 | goto out; | ||
1323 | |||
1321 | skb_reset_mac_header(reply); | 1324 | skb_reset_mac_header(reply); |
1322 | __skb_pull(reply, skb_network_offset(reply)); | 1325 | __skb_pull(reply, skb_network_offset(reply)); |
1323 | reply->ip_summed = CHECKSUM_UNNECESSARY; | 1326 | reply->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1339,15 +1342,103 @@ out: | |||
1339 | } | 1342 | } |
1340 | 1343 | ||
1341 | #if IS_ENABLED(CONFIG_IPV6) | 1344 | #if IS_ENABLED(CONFIG_IPV6) |
1345 | |||
1346 | static struct sk_buff *vxlan_na_create(struct sk_buff *request, | ||
1347 | struct neighbour *n, bool isrouter) | ||
1348 | { | ||
1349 | struct net_device *dev = request->dev; | ||
1350 | struct sk_buff *reply; | ||
1351 | struct nd_msg *ns, *na; | ||
1352 | struct ipv6hdr *pip6; | ||
1353 | u8 *daddr; | ||
1354 | int na_olen = 8; /* opt hdr + ETH_ALEN for target */ | ||
1355 | int ns_olen; | ||
1356 | int i, len; | ||
1357 | |||
1358 | if (dev == NULL) | ||
1359 | return NULL; | ||
1360 | |||
1361 | len = LL_RESERVED_SPACE(dev) + sizeof(struct ipv6hdr) + | ||
1362 | sizeof(*na) + na_olen + dev->needed_tailroom; | ||
1363 | reply = alloc_skb(len, GFP_ATOMIC); | ||
1364 | if (reply == NULL) | ||
1365 | return NULL; | ||
1366 | |||
1367 | reply->protocol = htons(ETH_P_IPV6); | ||
1368 | reply->dev = dev; | ||
1369 | skb_reserve(reply, LL_RESERVED_SPACE(request->dev)); | ||
1370 | skb_push(reply, sizeof(struct ethhdr)); | ||
1371 | skb_set_mac_header(reply, 0); | ||
1372 | |||
1373 | ns = (struct nd_msg *)skb_transport_header(request); | ||
1374 | |||
1375 | daddr = eth_hdr(request)->h_source; | ||
1376 | ns_olen = request->len - skb_transport_offset(request) - sizeof(*ns); | ||
1377 | for (i = 0; i < ns_olen-1; i += (ns->opt[i+1]<<3)) { | ||
1378 | if (ns->opt[i] == ND_OPT_SOURCE_LL_ADDR) { | ||
1379 | daddr = ns->opt + i + sizeof(struct nd_opt_hdr); | ||
1380 | break; | ||
1381 | } | ||
1382 | } | ||
1383 | |||
1384 | /* Ethernet header */ | ||
1385 | ether_addr_copy(eth_hdr(reply)->h_dest, daddr); | ||
1386 | ether_addr_copy(eth_hdr(reply)->h_source, n->ha); | ||
1387 | eth_hdr(reply)->h_proto = htons(ETH_P_IPV6); | ||
1388 | reply->protocol = htons(ETH_P_IPV6); | ||
1389 | |||
1390 | skb_pull(reply, sizeof(struct ethhdr)); | ||
1391 | skb_set_network_header(reply, 0); | ||
1392 | skb_put(reply, sizeof(struct ipv6hdr)); | ||
1393 | |||
1394 | /* IPv6 header */ | ||
1395 | |||
1396 | pip6 = ipv6_hdr(reply); | ||
1397 | memset(pip6, 0, sizeof(struct ipv6hdr)); | ||
1398 | pip6->version = 6; | ||
1399 | pip6->priority = ipv6_hdr(request)->priority; | ||
1400 | pip6->nexthdr = IPPROTO_ICMPV6; | ||
1401 | pip6->hop_limit = 255; | ||
1402 | pip6->daddr = ipv6_hdr(request)->saddr; | ||
1403 | pip6->saddr = *(struct in6_addr *)n->primary_key; | ||
1404 | |||
1405 | skb_pull(reply, sizeof(struct ipv6hdr)); | ||
1406 | skb_set_transport_header(reply, 0); | ||
1407 | |||
1408 | na = (struct nd_msg *)skb_put(reply, sizeof(*na) + na_olen); | ||
1409 | |||
1410 | /* Neighbor Advertisement */ | ||
1411 | memset(na, 0, sizeof(*na)+na_olen); | ||
1412 | na->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; | ||
1413 | na->icmph.icmp6_router = isrouter; | ||
1414 | na->icmph.icmp6_override = 1; | ||
1415 | na->icmph.icmp6_solicited = 1; | ||
1416 | na->target = ns->target; | ||
1417 | ether_addr_copy(&na->opt[2], n->ha); | ||
1418 | na->opt[0] = ND_OPT_TARGET_LL_ADDR; | ||
1419 | na->opt[1] = na_olen >> 3; | ||
1420 | |||
1421 | na->icmph.icmp6_cksum = csum_ipv6_magic(&pip6->saddr, | ||
1422 | &pip6->daddr, sizeof(*na)+na_olen, IPPROTO_ICMPV6, | ||
1423 | csum_partial(na, sizeof(*na)+na_olen, 0)); | ||
1424 | |||
1425 | pip6->payload_len = htons(sizeof(*na)+na_olen); | ||
1426 | |||
1427 | skb_push(reply, sizeof(struct ipv6hdr)); | ||
1428 | |||
1429 | reply->ip_summed = CHECKSUM_UNNECESSARY; | ||
1430 | |||
1431 | return reply; | ||
1432 | } | ||
1433 | |||
1342 | static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) | 1434 | static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) |
1343 | { | 1435 | { |
1344 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1436 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1345 | struct neighbour *n; | 1437 | struct nd_msg *msg; |
1346 | union vxlan_addr ipa; | ||
1347 | const struct ipv6hdr *iphdr; | 1438 | const struct ipv6hdr *iphdr; |
1348 | const struct in6_addr *saddr, *daddr; | 1439 | const struct in6_addr *saddr, *daddr; |
1349 | struct nd_msg *msg; | 1440 | struct neighbour *n; |
1350 | struct inet6_dev *in6_dev = NULL; | 1441 | struct inet6_dev *in6_dev; |
1351 | 1442 | ||
1352 | in6_dev = __in6_dev_get(dev); | 1443 | in6_dev = __in6_dev_get(dev); |
1353 | if (!in6_dev) | 1444 | if (!in6_dev) |
@@ -1360,19 +1451,20 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) | |||
1360 | saddr = &iphdr->saddr; | 1451 | saddr = &iphdr->saddr; |
1361 | daddr = &iphdr->daddr; | 1452 | daddr = &iphdr->daddr; |
1362 | 1453 | ||
1363 | if (ipv6_addr_loopback(daddr) || | ||
1364 | ipv6_addr_is_multicast(daddr)) | ||
1365 | goto out; | ||
1366 | |||
1367 | msg = (struct nd_msg *)skb_transport_header(skb); | 1454 | msg = (struct nd_msg *)skb_transport_header(skb); |
1368 | if (msg->icmph.icmp6_code != 0 || | 1455 | if (msg->icmph.icmp6_code != 0 || |
1369 | msg->icmph.icmp6_type != NDISC_NEIGHBOUR_SOLICITATION) | 1456 | msg->icmph.icmp6_type != NDISC_NEIGHBOUR_SOLICITATION) |
1370 | goto out; | 1457 | goto out; |
1371 | 1458 | ||
1372 | n = neigh_lookup(ipv6_stub->nd_tbl, daddr, dev); | 1459 | if (ipv6_addr_loopback(daddr) || |
1460 | ipv6_addr_is_multicast(&msg->target)) | ||
1461 | goto out; | ||
1462 | |||
1463 | n = neigh_lookup(ipv6_stub->nd_tbl, &msg->target, dev); | ||
1373 | 1464 | ||
1374 | if (n) { | 1465 | if (n) { |
1375 | struct vxlan_fdb *f; | 1466 | struct vxlan_fdb *f; |
1467 | struct sk_buff *reply; | ||
1376 | 1468 | ||
1377 | if (!(n->nud_state & NUD_CONNECTED)) { | 1469 | if (!(n->nud_state & NUD_CONNECTED)) { |
1378 | neigh_release(n); | 1470 | neigh_release(n); |
@@ -1386,13 +1478,23 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) | |||
1386 | goto out; | 1478 | goto out; |
1387 | } | 1479 | } |
1388 | 1480 | ||
1389 | ipv6_stub->ndisc_send_na(dev, n, saddr, &msg->target, | 1481 | reply = vxlan_na_create(skb, n, |
1390 | !!in6_dev->cnf.forwarding, | 1482 | !!(f ? f->flags & NTF_ROUTER : 0)); |
1391 | true, false, false); | 1483 | |
1392 | neigh_release(n); | 1484 | neigh_release(n); |
1485 | |||
1486 | if (reply == NULL) | ||
1487 | goto out; | ||
1488 | |||
1489 | if (netif_rx_ni(reply) == NET_RX_DROP) | ||
1490 | dev->stats.rx_dropped++; | ||
1491 | |||
1393 | } else if (vxlan->flags & VXLAN_F_L3MISS) { | 1492 | } else if (vxlan->flags & VXLAN_F_L3MISS) { |
1394 | ipa.sin6.sin6_addr = *daddr; | 1493 | union vxlan_addr ipa = { |
1395 | ipa.sa.sa_family = AF_INET6; | 1494 | .sin6.sin6_addr = msg->target, |
1495 | .sa.sa_family = AF_INET6, | ||
1496 | }; | ||
1497 | |||
1396 | vxlan_ip_miss(dev, &ipa); | 1498 | vxlan_ip_miss(dev, &ipa); |
1397 | } | 1499 | } |
1398 | 1500 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h index 1cc13569b17b..1b6b4d0cfa97 100644 --- a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h | |||
@@ -57,7 +57,7 @@ static const u32 ar9462_2p0_baseband_postamble[][5] = { | |||
57 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3236605e, 0x32365a5e}, | 57 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3236605e, 0x32365a5e}, |
58 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 58 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
59 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | 59 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
60 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, | 60 | {0x00009e20, 0x000003a5, 0x000003a5, 0x000003a5, 0x000003a5}, |
61 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, | 61 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, |
62 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcfd5c782, 0xcfd5c282}, | 62 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcfd5c782, 0xcfd5c282}, |
63 | {0x00009e44, 0x62321e27, 0x62321e27, 0xfe291e27, 0xfe291e27}, | 63 | {0x00009e44, 0x62321e27, 0x62321e27, 0xfe291e27, 0xfe291e27}, |
@@ -96,7 +96,7 @@ static const u32 ar9462_2p0_baseband_postamble[][5] = { | |||
96 | {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x00100000}, | 96 | {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x00100000}, |
97 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 97 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
98 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 98 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
99 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, | 99 | {0x0000ae20, 0x000001a6, 0x000001a6, 0x000001aa, 0x000001aa}, |
100 | {0x0000b284, 0x00000000, 0x00000000, 0x00000550, 0x00000550}, | 100 | {0x0000b284, 0x00000000, 0x00000000, 0x00000550, 0x00000550}, |
101 | }; | 101 | }; |
102 | 102 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 11eab9f01fd8..9078a6c5a74e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1534,7 +1534,7 @@ EXPORT_SYMBOL(ath9k_hw_check_nav); | |||
1534 | bool ath9k_hw_check_alive(struct ath_hw *ah) | 1534 | bool ath9k_hw_check_alive(struct ath_hw *ah) |
1535 | { | 1535 | { |
1536 | int count = 50; | 1536 | int count = 50; |
1537 | u32 reg; | 1537 | u32 reg, last_val; |
1538 | 1538 | ||
1539 | if (AR_SREV_9300(ah)) | 1539 | if (AR_SREV_9300(ah)) |
1540 | return !ath9k_hw_detect_mac_hang(ah); | 1540 | return !ath9k_hw_detect_mac_hang(ah); |
@@ -1542,9 +1542,14 @@ bool ath9k_hw_check_alive(struct ath_hw *ah) | |||
1542 | if (AR_SREV_9285_12_OR_LATER(ah)) | 1542 | if (AR_SREV_9285_12_OR_LATER(ah)) |
1543 | return true; | 1543 | return true; |
1544 | 1544 | ||
1545 | last_val = REG_READ(ah, AR_OBS_BUS_1); | ||
1545 | do { | 1546 | do { |
1546 | reg = REG_READ(ah, AR_OBS_BUS_1); | 1547 | reg = REG_READ(ah, AR_OBS_BUS_1); |
1548 | if (reg != last_val) | ||
1549 | return true; | ||
1547 | 1550 | ||
1551 | udelay(1); | ||
1552 | last_val = reg; | ||
1548 | if ((reg & 0x7E7FFFEF) == 0x00702400) | 1553 | if ((reg & 0x7E7FFFEF) == 0x00702400) |
1549 | continue; | 1554 | continue; |
1550 | 1555 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index a0ebdd000fc2..82e340d3ec60 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -732,11 +732,18 @@ static struct ath_rxbuf *ath_get_next_rx_buf(struct ath_softc *sc, | |||
732 | return NULL; | 732 | return NULL; |
733 | 733 | ||
734 | /* | 734 | /* |
735 | * mark descriptor as zero-length and set the 'more' | 735 | * Re-check previous descriptor, in case it has been filled |
736 | * flag to ensure that both buffers get discarded | 736 | * in the mean time. |
737 | */ | 737 | */ |
738 | rs->rs_datalen = 0; | 738 | ret = ath9k_hw_rxprocdesc(ah, ds, rs); |
739 | rs->rs_more = true; | 739 | if (ret == -EINPROGRESS) { |
740 | /* | ||
741 | * mark descriptor as zero-length and set the 'more' | ||
742 | * flag to ensure that both buffers get discarded | ||
743 | */ | ||
744 | rs->rs_datalen = 0; | ||
745 | rs->rs_more = true; | ||
746 | } | ||
740 | } | 747 | } |
741 | 748 | ||
742 | list_del(&bf->list); | 749 | list_del(&bf->list); |
@@ -985,32 +992,32 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
985 | struct ath_common *common = ath9k_hw_common(ah); | 992 | struct ath_common *common = ath9k_hw_common(ah); |
986 | struct ieee80211_hdr *hdr; | 993 | struct ieee80211_hdr *hdr; |
987 | bool discard_current = sc->rx.discard_next; | 994 | bool discard_current = sc->rx.discard_next; |
988 | int ret = 0; | ||
989 | 995 | ||
990 | /* | 996 | /* |
991 | * Discard corrupt descriptors which are marked in | 997 | * Discard corrupt descriptors which are marked in |
992 | * ath_get_next_rx_buf(). | 998 | * ath_get_next_rx_buf(). |
993 | */ | 999 | */ |
994 | sc->rx.discard_next = rx_stats->rs_more; | ||
995 | if (discard_current) | 1000 | if (discard_current) |
996 | return -EINVAL; | 1001 | goto corrupt; |
1002 | |||
1003 | sc->rx.discard_next = false; | ||
997 | 1004 | ||
998 | /* | 1005 | /* |
999 | * Discard zero-length packets. | 1006 | * Discard zero-length packets. |
1000 | */ | 1007 | */ |
1001 | if (!rx_stats->rs_datalen) { | 1008 | if (!rx_stats->rs_datalen) { |
1002 | RX_STAT_INC(rx_len_err); | 1009 | RX_STAT_INC(rx_len_err); |
1003 | return -EINVAL; | 1010 | goto corrupt; |
1004 | } | 1011 | } |
1005 | 1012 | ||
1006 | /* | 1013 | /* |
1007 | * rs_status follows rs_datalen so if rs_datalen is too large | 1014 | * rs_status follows rs_datalen so if rs_datalen is too large |
1008 | * we can take a hint that hardware corrupted it, so ignore | 1015 | * we can take a hint that hardware corrupted it, so ignore |
1009 | * those frames. | 1016 | * those frames. |
1010 | */ | 1017 | */ |
1011 | if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) { | 1018 | if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) { |
1012 | RX_STAT_INC(rx_len_err); | 1019 | RX_STAT_INC(rx_len_err); |
1013 | return -EINVAL; | 1020 | goto corrupt; |
1014 | } | 1021 | } |
1015 | 1022 | ||
1016 | /* Only use status info from the last fragment */ | 1023 | /* Only use status info from the last fragment */ |
@@ -1024,10 +1031,8 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1024 | * This is different from the other corrupt descriptor | 1031 | * This is different from the other corrupt descriptor |
1025 | * condition handled above. | 1032 | * condition handled above. |
1026 | */ | 1033 | */ |
1027 | if (rx_stats->rs_status & ATH9K_RXERR_CORRUPT_DESC) { | 1034 | if (rx_stats->rs_status & ATH9K_RXERR_CORRUPT_DESC) |
1028 | ret = -EINVAL; | 1035 | goto corrupt; |
1029 | goto exit; | ||
1030 | } | ||
1031 | 1036 | ||
1032 | hdr = (struct ieee80211_hdr *) (skb->data + ah->caps.rx_status_len); | 1037 | hdr = (struct ieee80211_hdr *) (skb->data + ah->caps.rx_status_len); |
1033 | 1038 | ||
@@ -1043,18 +1048,15 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1043 | if (ath_process_fft(sc, hdr, rx_stats, rx_status->mactime)) | 1048 | if (ath_process_fft(sc, hdr, rx_stats, rx_status->mactime)) |
1044 | RX_STAT_INC(rx_spectral); | 1049 | RX_STAT_INC(rx_spectral); |
1045 | 1050 | ||
1046 | ret = -EINVAL; | 1051 | return -EINVAL; |
1047 | goto exit; | ||
1048 | } | 1052 | } |
1049 | 1053 | ||
1050 | /* | 1054 | /* |
1051 | * everything but the rate is checked here, the rate check is done | 1055 | * everything but the rate is checked here, the rate check is done |
1052 | * separately to avoid doing two lookups for a rate for each frame. | 1056 | * separately to avoid doing two lookups for a rate for each frame. |
1053 | */ | 1057 | */ |
1054 | if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) { | 1058 | if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) |
1055 | ret = -EINVAL; | 1059 | return -EINVAL; |
1056 | goto exit; | ||
1057 | } | ||
1058 | 1060 | ||
1059 | if (ath_is_mybeacon(common, hdr)) { | 1061 | if (ath_is_mybeacon(common, hdr)) { |
1060 | RX_STAT_INC(rx_beacons); | 1062 | RX_STAT_INC(rx_beacons); |
@@ -1064,15 +1066,11 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1064 | /* | 1066 | /* |
1065 | * This shouldn't happen, but have a safety check anyway. | 1067 | * This shouldn't happen, but have a safety check anyway. |
1066 | */ | 1068 | */ |
1067 | if (WARN_ON(!ah->curchan)) { | 1069 | if (WARN_ON(!ah->curchan)) |
1068 | ret = -EINVAL; | 1070 | return -EINVAL; |
1069 | goto exit; | ||
1070 | } | ||
1071 | 1071 | ||
1072 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) { | 1072 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) |
1073 | ret =-EINVAL; | 1073 | return -EINVAL; |
1074 | goto exit; | ||
1075 | } | ||
1076 | 1074 | ||
1077 | ath9k_process_rssi(common, hw, rx_stats, rx_status); | 1075 | ath9k_process_rssi(common, hw, rx_stats, rx_status); |
1078 | 1076 | ||
@@ -1087,9 +1085,11 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1087 | sc->rx.num_pkts++; | 1085 | sc->rx.num_pkts++; |
1088 | #endif | 1086 | #endif |
1089 | 1087 | ||
1090 | exit: | 1088 | return 0; |
1091 | sc->rx.discard_next = false; | 1089 | |
1092 | return ret; | 1090 | corrupt: |
1091 | sc->rx.discard_next = rx_stats->rs_more; | ||
1092 | return -EINVAL; | ||
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | static void ath9k_rx_skb_postprocess(struct ath_common *common, | 1095 | static void ath9k_rx_skb_postprocess(struct ath_common *common, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 0a75e2f68c9d..55897d508a76 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1444,14 +1444,16 @@ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, | |||
1444 | for (tidno = 0, tid = &an->tid[tidno]; | 1444 | for (tidno = 0, tid = &an->tid[tidno]; |
1445 | tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { | 1445 | tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { |
1446 | 1446 | ||
1447 | if (!tid->sched) | ||
1448 | continue; | ||
1449 | |||
1450 | ac = tid->ac; | 1447 | ac = tid->ac; |
1451 | txq = ac->txq; | 1448 | txq = ac->txq; |
1452 | 1449 | ||
1453 | ath_txq_lock(sc, txq); | 1450 | ath_txq_lock(sc, txq); |
1454 | 1451 | ||
1452 | if (!tid->sched) { | ||
1453 | ath_txq_unlock(sc, txq); | ||
1454 | continue; | ||
1455 | } | ||
1456 | |||
1455 | buffered = ath_tid_has_buffered(tid); | 1457 | buffered = ath_tid_has_buffered(tid); |
1456 | 1458 | ||
1457 | tid->sched = false; | 1459 | tid->sched = false; |
@@ -2061,7 +2063,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | |||
2061 | 2063 | ||
2062 | ATH_TXBUF_RESET(bf); | 2064 | ATH_TXBUF_RESET(bf); |
2063 | 2065 | ||
2064 | if (tid) { | 2066 | if (tid && ieee80211_is_data_present(hdr->frame_control)) { |
2065 | fragno = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; | 2067 | fragno = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; |
2066 | seqno = tid->seq_next; | 2068 | seqno = tid->seq_next; |
2067 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); | 2069 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); |
@@ -2184,14 +2186,15 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2184 | txq->stopped = true; | 2186 | txq->stopped = true; |
2185 | } | 2187 | } |
2186 | 2188 | ||
2189 | if (txctl->an && ieee80211_is_data_present(hdr->frame_control)) | ||
2190 | tid = ath_get_skb_tid(sc, txctl->an, skb); | ||
2191 | |||
2187 | if (info->flags & IEEE80211_TX_CTL_PS_RESPONSE) { | 2192 | if (info->flags & IEEE80211_TX_CTL_PS_RESPONSE) { |
2188 | ath_txq_unlock(sc, txq); | 2193 | ath_txq_unlock(sc, txq); |
2189 | txq = sc->tx.uapsdq; | 2194 | txq = sc->tx.uapsdq; |
2190 | ath_txq_lock(sc, txq); | 2195 | ath_txq_lock(sc, txq); |
2191 | } else if (txctl->an && | 2196 | } else if (txctl->an && |
2192 | ieee80211_is_data_present(hdr->frame_control)) { | 2197 | ieee80211_is_data_present(hdr->frame_control)) { |
2193 | tid = ath_get_skb_tid(sc, txctl->an, skb); | ||
2194 | |||
2195 | WARN_ON(tid->ac->txq != txctl->txq); | 2198 | WARN_ON(tid->ac->txq != txctl->txq); |
2196 | 2199 | ||
2197 | if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) | 2200 | if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 3e991897d7ca..ddaa9efd053d 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -457,7 +457,6 @@ struct brcmf_sdio { | |||
457 | 457 | ||
458 | u8 tx_hdrlen; /* sdio bus header length for tx packet */ | 458 | u8 tx_hdrlen; /* sdio bus header length for tx packet */ |
459 | bool txglom; /* host tx glomming enable flag */ | 459 | bool txglom; /* host tx glomming enable flag */ |
460 | struct sk_buff *txglom_sgpad; /* scatter-gather padding buffer */ | ||
461 | u16 head_align; /* buffer pointer alignment */ | 460 | u16 head_align; /* buffer pointer alignment */ |
462 | u16 sgentry_align; /* scatter-gather buffer alignment */ | 461 | u16 sgentry_align; /* scatter-gather buffer alignment */ |
463 | }; | 462 | }; |
@@ -1944,19 +1943,21 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus, | |||
1944 | if (lastfrm && chain_pad) | 1943 | if (lastfrm && chain_pad) |
1945 | tail_pad += blksize - chain_pad; | 1944 | tail_pad += blksize - chain_pad; |
1946 | if (skb_tailroom(pkt) < tail_pad && pkt->len > blksize) { | 1945 | if (skb_tailroom(pkt) < tail_pad && pkt->len > blksize) { |
1947 | pkt_pad = bus->txglom_sgpad; | 1946 | pkt_pad = brcmu_pkt_buf_get_skb(tail_pad + tail_chop + |
1948 | if (pkt_pad == NULL) | 1947 | bus->head_align); |
1949 | brcmu_pkt_buf_get_skb(tail_pad + tail_chop); | ||
1950 | if (pkt_pad == NULL) | 1948 | if (pkt_pad == NULL) |
1951 | return -ENOMEM; | 1949 | return -ENOMEM; |
1952 | ret = brcmf_sdio_txpkt_hdalign(bus, pkt_pad); | 1950 | ret = brcmf_sdio_txpkt_hdalign(bus, pkt_pad); |
1953 | if (unlikely(ret < 0)) | 1951 | if (unlikely(ret < 0)) { |
1952 | kfree_skb(pkt_pad); | ||
1954 | return ret; | 1953 | return ret; |
1954 | } | ||
1955 | memcpy(pkt_pad->data, | 1955 | memcpy(pkt_pad->data, |
1956 | pkt->data + pkt->len - tail_chop, | 1956 | pkt->data + pkt->len - tail_chop, |
1957 | tail_chop); | 1957 | tail_chop); |
1958 | *(u32 *)(pkt_pad->cb) = ALIGN_SKB_FLAG + tail_chop; | 1958 | *(u32 *)(pkt_pad->cb) = ALIGN_SKB_FLAG + tail_chop; |
1959 | skb_trim(pkt, pkt->len - tail_chop); | 1959 | skb_trim(pkt, pkt->len - tail_chop); |
1960 | skb_trim(pkt_pad, tail_pad + tail_chop); | ||
1960 | __skb_queue_after(pktq, pkt, pkt_pad); | 1961 | __skb_queue_after(pktq, pkt, pkt_pad); |
1961 | } else { | 1962 | } else { |
1962 | ntail = pkt->data_len + tail_pad - | 1963 | ntail = pkt->data_len + tail_pad - |
@@ -2011,7 +2012,7 @@ brcmf_sdio_txpkt_prep(struct brcmf_sdio *bus, struct sk_buff_head *pktq, | |||
2011 | return ret; | 2012 | return ret; |
2012 | head_pad = (u16)ret; | 2013 | head_pad = (u16)ret; |
2013 | if (head_pad) | 2014 | if (head_pad) |
2014 | memset(pkt_next->data, 0, head_pad + bus->tx_hdrlen); | 2015 | memset(pkt_next->data + bus->tx_hdrlen, 0, head_pad); |
2015 | 2016 | ||
2016 | total_len += pkt_next->len; | 2017 | total_len += pkt_next->len; |
2017 | 2018 | ||
@@ -3486,10 +3487,6 @@ static int brcmf_sdio_bus_preinit(struct device *dev) | |||
3486 | bus->txglom = false; | 3487 | bus->txglom = false; |
3487 | value = 1; | 3488 | value = 1; |
3488 | pad_size = bus->sdiodev->func[2]->cur_blksize << 1; | 3489 | pad_size = bus->sdiodev->func[2]->cur_blksize << 1; |
3489 | bus->txglom_sgpad = brcmu_pkt_buf_get_skb(pad_size); | ||
3490 | if (!bus->txglom_sgpad) | ||
3491 | brcmf_err("allocating txglom padding skb failed, reduced performance\n"); | ||
3492 | |||
3493 | err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", | 3490 | err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", |
3494 | &value, sizeof(u32)); | 3491 | &value, sizeof(u32)); |
3495 | if (err < 0) { | 3492 | if (err < 0) { |
@@ -4053,7 +4050,6 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus) | |||
4053 | brcmf_sdio_chip_detach(&bus->ci); | 4050 | brcmf_sdio_chip_detach(&bus->ci); |
4054 | } | 4051 | } |
4055 | 4052 | ||
4056 | brcmu_pkt_buf_free_skb(bus->txglom_sgpad); | ||
4057 | kfree(bus->rxbuf); | 4053 | kfree(bus->rxbuf); |
4058 | kfree(bus->hdrbuf); | 4054 | kfree(bus->hdrbuf); |
4059 | kfree(bus); | 4055 | kfree(bus); |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index d36e252d2ccb..596525528f50 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -147,7 +147,7 @@ static void ap_free_sta(struct ap_data *ap, struct sta_info *sta) | |||
147 | 147 | ||
148 | if (!sta->ap && sta->u.sta.challenge) | 148 | if (!sta->ap && sta->u.sta.challenge) |
149 | kfree(sta->u.sta.challenge); | 149 | kfree(sta->u.sta.challenge); |
150 | del_timer(&sta->timer); | 150 | del_timer_sync(&sta->timer); |
151 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 151 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
152 | 152 | ||
153 | kfree(sta); | 153 | kfree(sta); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index c0d070c5df5e..9cdd91cdf661 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c | |||
@@ -590,6 +590,7 @@ void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id, | |||
590 | sizeof(priv->tid_data[sta_id][tid])); | 590 | sizeof(priv->tid_data[sta_id][tid])); |
591 | 591 | ||
592 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; | 592 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; |
593 | priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; | ||
593 | 594 | ||
594 | priv->num_stations--; | 595 | priv->num_stations--; |
595 | 596 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index a6839dfcb82d..398dd096674c 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -1291,8 +1291,6 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1291 | struct iwl_compressed_ba_resp *ba_resp = (void *)pkt->data; | 1291 | struct iwl_compressed_ba_resp *ba_resp = (void *)pkt->data; |
1292 | struct iwl_ht_agg *agg; | 1292 | struct iwl_ht_agg *agg; |
1293 | struct sk_buff_head reclaimed_skbs; | 1293 | struct sk_buff_head reclaimed_skbs; |
1294 | struct ieee80211_tx_info *info; | ||
1295 | struct ieee80211_hdr *hdr; | ||
1296 | struct sk_buff *skb; | 1294 | struct sk_buff *skb; |
1297 | int sta_id; | 1295 | int sta_id; |
1298 | int tid; | 1296 | int tid; |
@@ -1379,22 +1377,28 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1379 | freed = 0; | 1377 | freed = 0; |
1380 | 1378 | ||
1381 | skb_queue_walk(&reclaimed_skbs, skb) { | 1379 | skb_queue_walk(&reclaimed_skbs, skb) { |
1382 | hdr = (struct ieee80211_hdr *)skb->data; | 1380 | struct ieee80211_hdr *hdr = (void *)skb->data; |
1381 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
1383 | 1382 | ||
1384 | if (ieee80211_is_data_qos(hdr->frame_control)) | 1383 | if (ieee80211_is_data_qos(hdr->frame_control)) |
1385 | freed++; | 1384 | freed++; |
1386 | else | 1385 | else |
1387 | WARN_ON_ONCE(1); | 1386 | WARN_ON_ONCE(1); |
1388 | 1387 | ||
1389 | info = IEEE80211_SKB_CB(skb); | ||
1390 | iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]); | 1388 | iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]); |
1391 | 1389 | ||
1390 | memset(&info->status, 0, sizeof(info->status)); | ||
1391 | /* Packet was transmitted successfully, failures come as single | ||
1392 | * frames because before failing a frame the firmware transmits | ||
1393 | * it without aggregation at least once. | ||
1394 | */ | ||
1395 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
1396 | |||
1392 | if (freed == 1) { | 1397 | if (freed == 1) { |
1393 | /* this is the first skb we deliver in this batch */ | 1398 | /* this is the first skb we deliver in this batch */ |
1394 | /* put the rate scaling data there */ | 1399 | /* put the rate scaling data there */ |
1395 | info = IEEE80211_SKB_CB(skb); | 1400 | info = IEEE80211_SKB_CB(skb); |
1396 | memset(&info->status, 0, sizeof(info->status)); | 1401 | memset(&info->status, 0, sizeof(info->status)); |
1397 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
1398 | info->flags |= IEEE80211_TX_STAT_AMPDU; | 1402 | info->flags |= IEEE80211_TX_STAT_AMPDU; |
1399 | info->status.ampdu_ack_len = ba_resp->txed_2_done; | 1403 | info->status.ampdu_ack_len = ba_resp->txed_2_done; |
1400 | info->status.ampdu_len = ba_resp->txed; | 1404 | info->status.ampdu_len = ba_resp->txed; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c index 76cde6ce6551..18a895a949d4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c | |||
@@ -872,8 +872,11 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
872 | 872 | ||
873 | lockdep_assert_held(&mvm->mutex); | 873 | lockdep_assert_held(&mvm->mutex); |
874 | 874 | ||
875 | /* Rssi update while not associated ?! */ | 875 | /* |
876 | if (WARN_ON_ONCE(mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)) | 876 | * Rssi update while not associated - can happen since the statistics |
877 | * are handled asynchronously | ||
878 | */ | ||
879 | if (mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) | ||
877 | return; | 880 | return; |
878 | 881 | ||
879 | /* No BT - reports should be disabled */ | 882 | /* No BT - reports should be disabled */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index e4ead86f06d6..2b0ba1fc3c82 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -152,7 +152,7 @@ enum iwl_power_scheme { | |||
152 | IWL_POWER_SCHEME_LP | 152 | IWL_POWER_SCHEME_LP |
153 | }; | 153 | }; |
154 | 154 | ||
155 | #define IWL_CONN_MAX_LISTEN_INTERVAL 70 | 155 | #define IWL_CONN_MAX_LISTEN_INTERVAL 10 |
156 | #define IWL_UAPSD_AC_INFO (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\ | 156 | #define IWL_UAPSD_AC_INFO (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\ |
157 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |\ | 157 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |\ |
158 | IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |\ | 158 | IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |\ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 4df12fa9d336..76ee486039d7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -822,16 +822,12 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
822 | struct iwl_mvm_ba_notif *ba_notif = (void *)pkt->data; | 822 | struct iwl_mvm_ba_notif *ba_notif = (void *)pkt->data; |
823 | struct sk_buff_head reclaimed_skbs; | 823 | struct sk_buff_head reclaimed_skbs; |
824 | struct iwl_mvm_tid_data *tid_data; | 824 | struct iwl_mvm_tid_data *tid_data; |
825 | struct ieee80211_tx_info *info; | ||
826 | struct ieee80211_sta *sta; | 825 | struct ieee80211_sta *sta; |
827 | struct iwl_mvm_sta *mvmsta; | 826 | struct iwl_mvm_sta *mvmsta; |
828 | struct ieee80211_hdr *hdr; | ||
829 | struct sk_buff *skb; | 827 | struct sk_buff *skb; |
830 | int sta_id, tid, freed; | 828 | int sta_id, tid, freed; |
831 | |||
832 | /* "flow" corresponds to Tx queue */ | 829 | /* "flow" corresponds to Tx queue */ |
833 | u16 scd_flow = le16_to_cpu(ba_notif->scd_flow); | 830 | u16 scd_flow = le16_to_cpu(ba_notif->scd_flow); |
834 | |||
835 | /* "ssn" is start of block-ack Tx window, corresponds to index | 831 | /* "ssn" is start of block-ack Tx window, corresponds to index |
836 | * (in Tx queue's circular buffer) of first TFD/frame in window */ | 832 | * (in Tx queue's circular buffer) of first TFD/frame in window */ |
837 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_notif->scd_ssn); | 833 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_notif->scd_ssn); |
@@ -888,22 +884,26 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
888 | freed = 0; | 884 | freed = 0; |
889 | 885 | ||
890 | skb_queue_walk(&reclaimed_skbs, skb) { | 886 | skb_queue_walk(&reclaimed_skbs, skb) { |
891 | hdr = (struct ieee80211_hdr *)skb->data; | 887 | struct ieee80211_hdr *hdr = (void *)skb->data; |
888 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
892 | 889 | ||
893 | if (ieee80211_is_data_qos(hdr->frame_control)) | 890 | if (ieee80211_is_data_qos(hdr->frame_control)) |
894 | freed++; | 891 | freed++; |
895 | else | 892 | else |
896 | WARN_ON_ONCE(1); | 893 | WARN_ON_ONCE(1); |
897 | 894 | ||
898 | info = IEEE80211_SKB_CB(skb); | ||
899 | iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); | 895 | iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); |
900 | 896 | ||
897 | memset(&info->status, 0, sizeof(info->status)); | ||
898 | /* Packet was transmitted successfully, failures come as single | ||
899 | * frames because before failing a frame the firmware transmits | ||
900 | * it without aggregation at least once. | ||
901 | */ | ||
902 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
903 | |||
901 | if (freed == 1) { | 904 | if (freed == 1) { |
902 | /* this is the first skb we deliver in this batch */ | 905 | /* this is the first skb we deliver in this batch */ |
903 | /* put the rate scaling data there */ | 906 | /* put the rate scaling data there */ |
904 | info = IEEE80211_SKB_CB(skb); | ||
905 | memset(&info->status, 0, sizeof(info->status)); | ||
906 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
907 | info->flags |= IEEE80211_TX_STAT_AMPDU; | 907 | info->flags |= IEEE80211_TX_STAT_AMPDU; |
908 | info->status.ampdu_ack_len = ba_notif->txed_2_done; | 908 | info->status.ampdu_ack_len = ba_notif->txed_2_done; |
909 | info->status.ampdu_len = ba_notif->txed; | 909 | info->status.ampdu_len = ba_notif->txed; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index f47bcbe2945a..3872ead75488 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -359,13 +359,12 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
359 | /* 7265 Series */ | 359 | /* 7265 Series */ |
360 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, | 360 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, |
361 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, | 361 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, |
362 | {IWL_PCI_DEVICE(0x095A, 0x5112, iwl7265_2ac_cfg)}, | ||
363 | {IWL_PCI_DEVICE(0x095A, 0x5100, iwl7265_2ac_cfg)}, | 362 | {IWL_PCI_DEVICE(0x095A, 0x5100, iwl7265_2ac_cfg)}, |
364 | {IWL_PCI_DEVICE(0x095A, 0x510A, iwl7265_2ac_cfg)}, | ||
365 | {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)}, | 363 | {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)}, |
366 | {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_2ac_cfg)}, | 364 | {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_n_cfg)}, |
367 | {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)}, | 365 | {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)}, |
368 | {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, | 366 | {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, |
367 | {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)}, | ||
369 | {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, | 368 | {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, |
370 | {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, | 369 | {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, |
371 | {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, | 370 | {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 32f75007a825..cb6d189bc3e6 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -621,7 +621,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, | |||
621 | id = *pos++; | 621 | id = *pos++; |
622 | elen = *pos++; | 622 | elen = *pos++; |
623 | left -= 2; | 623 | left -= 2; |
624 | if (elen > left || elen == 0) { | 624 | if (elen > left) { |
625 | lbs_deb_scan("scan response: invalid IE fmt\n"); | 625 | lbs_deb_scan("scan response: invalid IE fmt\n"); |
626 | goto done; | 626 | goto done; |
627 | } | 627 | } |
diff --git a/drivers/net/wireless/mwifiex/11ac.c b/drivers/net/wireless/mwifiex/11ac.c index 5e0eec4d71c7..5d9a8084665d 100644 --- a/drivers/net/wireless/mwifiex/11ac.c +++ b/drivers/net/wireless/mwifiex/11ac.c | |||
@@ -189,8 +189,7 @@ int mwifiex_cmd_append_11ac_tlv(struct mwifiex_private *priv, | |||
189 | vht_cap->header.len = | 189 | vht_cap->header.len = |
190 | cpu_to_le16(sizeof(struct ieee80211_vht_cap)); | 190 | cpu_to_le16(sizeof(struct ieee80211_vht_cap)); |
191 | memcpy((u8 *)vht_cap + sizeof(struct mwifiex_ie_types_header), | 191 | memcpy((u8 *)vht_cap + sizeof(struct mwifiex_ie_types_header), |
192 | (u8 *)bss_desc->bcn_vht_cap + | 192 | (u8 *)bss_desc->bcn_vht_cap, |
193 | sizeof(struct ieee_types_header), | ||
194 | le16_to_cpu(vht_cap->header.len)); | 193 | le16_to_cpu(vht_cap->header.len)); |
195 | 194 | ||
196 | mwifiex_fill_vht_cap_tlv(priv, vht_cap, bss_desc->bss_band); | 195 | mwifiex_fill_vht_cap_tlv(priv, vht_cap, bss_desc->bss_band); |
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c index 6261f8c53d44..7db1a89fdd95 100644 --- a/drivers/net/wireless/mwifiex/11n.c +++ b/drivers/net/wireless/mwifiex/11n.c | |||
@@ -308,8 +308,7 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, | |||
308 | ht_cap->header.len = | 308 | ht_cap->header.len = |
309 | cpu_to_le16(sizeof(struct ieee80211_ht_cap)); | 309 | cpu_to_le16(sizeof(struct ieee80211_ht_cap)); |
310 | memcpy((u8 *) ht_cap + sizeof(struct mwifiex_ie_types_header), | 310 | memcpy((u8 *) ht_cap + sizeof(struct mwifiex_ie_types_header), |
311 | (u8 *) bss_desc->bcn_ht_cap + | 311 | (u8 *)bss_desc->bcn_ht_cap, |
312 | sizeof(struct ieee_types_header), | ||
313 | le16_to_cpu(ht_cap->header.len)); | 312 | le16_to_cpu(ht_cap->header.len)); |
314 | 313 | ||
315 | mwifiex_fill_cap_info(priv, radio_type, ht_cap); | 314 | mwifiex_fill_cap_info(priv, radio_type, ht_cap); |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 03688aa14e8a..7fe7b53fb17a 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -1211,6 +1211,12 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
1211 | rd_index = card->rxbd_rdptr & reg->rx_mask; | 1211 | rd_index = card->rxbd_rdptr & reg->rx_mask; |
1212 | skb_data = card->rx_buf_list[rd_index]; | 1212 | skb_data = card->rx_buf_list[rd_index]; |
1213 | 1213 | ||
1214 | /* If skb allocation was failed earlier for Rx packet, | ||
1215 | * rx_buf_list[rd_index] would have been left with a NULL. | ||
1216 | */ | ||
1217 | if (!skb_data) | ||
1218 | return -ENOMEM; | ||
1219 | |||
1214 | MWIFIEX_SKB_PACB(skb_data, &buf_pa); | 1220 | MWIFIEX_SKB_PACB(skb_data, &buf_pa); |
1215 | pci_unmap_single(card->dev, buf_pa, MWIFIEX_RX_DATA_BUF_SIZE, | 1221 | pci_unmap_single(card->dev, buf_pa, MWIFIEX_RX_DATA_BUF_SIZE, |
1216 | PCI_DMA_FROMDEVICE); | 1222 | PCI_DMA_FROMDEVICE); |
@@ -1525,6 +1531,14 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | |||
1525 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | 1531 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
1526 | mwifiex_process_sleep_confirm_resp(adapter, skb->data, | 1532 | mwifiex_process_sleep_confirm_resp(adapter, skb->data, |
1527 | skb->len); | 1533 | skb->len); |
1534 | mwifiex_pcie_enable_host_int(adapter); | ||
1535 | if (mwifiex_write_reg(adapter, | ||
1536 | PCIE_CPU_INT_EVENT, | ||
1537 | CPU_INTR_SLEEP_CFM_DONE)) { | ||
1538 | dev_warn(adapter->dev, | ||
1539 | "Write register failed\n"); | ||
1540 | return -1; | ||
1541 | } | ||
1528 | while (reg->sleep_cookie && (count++ < 10) && | 1542 | while (reg->sleep_cookie && (count++ < 10) && |
1529 | mwifiex_pcie_ok_to_access_hw(adapter)) | 1543 | mwifiex_pcie_ok_to_access_hw(adapter)) |
1530 | usleep_range(50, 60); | 1544 | usleep_range(50, 60); |
@@ -1993,23 +2007,9 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) | |||
1993 | adapter->int_status |= pcie_ireg; | 2007 | adapter->int_status |= pcie_ireg; |
1994 | spin_unlock_irqrestore(&adapter->int_lock, flags); | 2008 | spin_unlock_irqrestore(&adapter->int_lock, flags); |
1995 | 2009 | ||
1996 | if (pcie_ireg & HOST_INTR_CMD_DONE) { | 2010 | if (!adapter->pps_uapsd_mode && |
1997 | if ((adapter->ps_state == PS_STATE_SLEEP_CFM) || | 2011 | adapter->ps_state == PS_STATE_SLEEP && |
1998 | (adapter->ps_state == PS_STATE_SLEEP)) { | 2012 | mwifiex_pcie_ok_to_access_hw(adapter)) { |
1999 | mwifiex_pcie_enable_host_int(adapter); | ||
2000 | if (mwifiex_write_reg(adapter, | ||
2001 | PCIE_CPU_INT_EVENT, | ||
2002 | CPU_INTR_SLEEP_CFM_DONE) | ||
2003 | ) { | ||
2004 | dev_warn(adapter->dev, | ||
2005 | "Write register failed\n"); | ||
2006 | return; | ||
2007 | |||
2008 | } | ||
2009 | } | ||
2010 | } else if (!adapter->pps_uapsd_mode && | ||
2011 | adapter->ps_state == PS_STATE_SLEEP && | ||
2012 | mwifiex_pcie_ok_to_access_hw(adapter)) { | ||
2013 | /* Potentially for PCIe we could get other | 2013 | /* Potentially for PCIe we could get other |
2014 | * interrupts like shared. Don't change power | 2014 | * interrupts like shared. Don't change power |
2015 | * state until cookie is set */ | 2015 | * state until cookie is set */ |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 0a8a26e10f01..668547c2de84 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -2101,12 +2101,12 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv) | |||
2101 | curr_bss->ht_info_offset); | 2101 | curr_bss->ht_info_offset); |
2102 | 2102 | ||
2103 | if (curr_bss->bcn_vht_cap) | 2103 | if (curr_bss->bcn_vht_cap) |
2104 | curr_bss->bcn_ht_cap = (void *)(curr_bss->beacon_buf + | 2104 | curr_bss->bcn_vht_cap = (void *)(curr_bss->beacon_buf + |
2105 | curr_bss->vht_cap_offset); | 2105 | curr_bss->vht_cap_offset); |
2106 | 2106 | ||
2107 | if (curr_bss->bcn_vht_oper) | 2107 | if (curr_bss->bcn_vht_oper) |
2108 | curr_bss->bcn_ht_oper = (void *)(curr_bss->beacon_buf + | 2108 | curr_bss->bcn_vht_oper = (void *)(curr_bss->beacon_buf + |
2109 | curr_bss->vht_info_offset); | 2109 | curr_bss->vht_info_offset); |
2110 | 2110 | ||
2111 | if (curr_bss->bcn_bss_co_2040) | 2111 | if (curr_bss->bcn_bss_co_2040) |
2112 | curr_bss->bcn_bss_co_2040 = | 2112 | curr_bss->bcn_bss_co_2040 = |
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index e8ebbd4bc3cd..208748804a55 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -22,8 +22,6 @@ | |||
22 | 22 | ||
23 | #define USB_VERSION "1.0" | 23 | #define USB_VERSION "1.0" |
24 | 24 | ||
25 | static const char usbdriver_name[] = "usb8xxx"; | ||
26 | |||
27 | static struct mwifiex_if_ops usb_ops; | 25 | static struct mwifiex_if_ops usb_ops; |
28 | static struct semaphore add_remove_card_sem; | 26 | static struct semaphore add_remove_card_sem; |
29 | static struct usb_card_rec *usb_card; | 27 | static struct usb_card_rec *usb_card; |
@@ -527,13 +525,6 @@ static int mwifiex_usb_resume(struct usb_interface *intf) | |||
527 | MWIFIEX_BSS_ROLE_ANY), | 525 | MWIFIEX_BSS_ROLE_ANY), |
528 | MWIFIEX_ASYNC_CMD); | 526 | MWIFIEX_ASYNC_CMD); |
529 | 527 | ||
530 | #ifdef CONFIG_PM | ||
531 | /* Resume handler may be called due to remote wakeup, | ||
532 | * force to exit suspend anyway | ||
533 | */ | ||
534 | usb_disable_autosuspend(card->udev); | ||
535 | #endif /* CONFIG_PM */ | ||
536 | |||
537 | return 0; | 528 | return 0; |
538 | } | 529 | } |
539 | 530 | ||
@@ -567,13 +558,12 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) | |||
567 | } | 558 | } |
568 | 559 | ||
569 | static struct usb_driver mwifiex_usb_driver = { | 560 | static struct usb_driver mwifiex_usb_driver = { |
570 | .name = usbdriver_name, | 561 | .name = "mwifiex_usb", |
571 | .probe = mwifiex_usb_probe, | 562 | .probe = mwifiex_usb_probe, |
572 | .disconnect = mwifiex_usb_disconnect, | 563 | .disconnect = mwifiex_usb_disconnect, |
573 | .id_table = mwifiex_usb_table, | 564 | .id_table = mwifiex_usb_table, |
574 | .suspend = mwifiex_usb_suspend, | 565 | .suspend = mwifiex_usb_suspend, |
575 | .resume = mwifiex_usb_resume, | 566 | .resume = mwifiex_usb_resume, |
576 | .supports_autosuspend = 1, | ||
577 | }; | 567 | }; |
578 | 568 | ||
579 | static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) | 569 | static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 13eaeed03898..981cf6e7c73b 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -559,7 +559,8 @@ mwifiex_clean_txrx(struct mwifiex_private *priv) | |||
559 | mwifiex_wmm_delete_all_ralist(priv); | 559 | mwifiex_wmm_delete_all_ralist(priv); |
560 | memcpy(tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); | 560 | memcpy(tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); |
561 | 561 | ||
562 | if (priv->adapter->if_ops.clean_pcie_ring) | 562 | if (priv->adapter->if_ops.clean_pcie_ring && |
563 | !priv->adapter->surprise_removed) | ||
563 | priv->adapter->if_ops.clean_pcie_ring(priv->adapter); | 564 | priv->adapter->if_ops.clean_pcie_ring(priv->adapter); |
564 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); | 565 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); |
565 | } | 566 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 7f8b5d156c8c..41d4a8167dc3 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -5460,14 +5460,15 @@ static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev) | |||
5460 | 5460 | ||
5461 | rt2800_bbp_write(rt2x00dev, 68, 0x0b); | 5461 | rt2800_bbp_write(rt2x00dev, 68, 0x0b); |
5462 | 5462 | ||
5463 | rt2800_bbp_write(rt2x00dev, 69, 0x0d); | 5463 | rt2800_bbp_write(rt2x00dev, 69, 0x12); |
5464 | rt2800_bbp_write(rt2x00dev, 70, 0x06); | ||
5465 | rt2800_bbp_write(rt2x00dev, 73, 0x13); | 5464 | rt2800_bbp_write(rt2x00dev, 73, 0x13); |
5466 | rt2800_bbp_write(rt2x00dev, 75, 0x46); | 5465 | rt2800_bbp_write(rt2x00dev, 75, 0x46); |
5467 | rt2800_bbp_write(rt2x00dev, 76, 0x28); | 5466 | rt2800_bbp_write(rt2x00dev, 76, 0x28); |
5468 | 5467 | ||
5469 | rt2800_bbp_write(rt2x00dev, 77, 0x59); | 5468 | rt2800_bbp_write(rt2x00dev, 77, 0x59); |
5470 | 5469 | ||
5470 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); | ||
5471 | |||
5471 | rt2800_bbp_write(rt2x00dev, 79, 0x13); | 5472 | rt2800_bbp_write(rt2x00dev, 79, 0x13); |
5472 | rt2800_bbp_write(rt2x00dev, 80, 0x05); | 5473 | rt2800_bbp_write(rt2x00dev, 80, 0x05); |
5473 | rt2800_bbp_write(rt2x00dev, 81, 0x33); | 5474 | rt2800_bbp_write(rt2x00dev, 81, 0x33); |
@@ -5510,7 +5511,6 @@ static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev) | |||
5510 | if (rt2x00_rt(rt2x00dev, RT5392)) { | 5511 | if (rt2x00_rt(rt2x00dev, RT5392)) { |
5511 | rt2800_bbp_write(rt2x00dev, 134, 0xd0); | 5512 | rt2800_bbp_write(rt2x00dev, 134, 0xd0); |
5512 | rt2800_bbp_write(rt2x00dev, 135, 0xf6); | 5513 | rt2800_bbp_write(rt2x00dev, 135, 0xf6); |
5513 | rt2800_bbp_write(rt2x00dev, 148, 0x84); | ||
5514 | } | 5514 | } |
5515 | 5515 | ||
5516 | rt2800_disable_unused_dac_adc(rt2x00dev); | 5516 | rt2800_disable_unused_dac_adc(rt2x00dev); |
diff --git a/drivers/net/wireless/ti/wl1251/rx.c b/drivers/net/wireless/ti/wl1251/rx.c index 123c4bb50e0a..cde0eaf99714 100644 --- a/drivers/net/wireless/ti/wl1251/rx.c +++ b/drivers/net/wireless/ti/wl1251/rx.c | |||
@@ -180,7 +180,7 @@ static void wl1251_rx_body(struct wl1251 *wl, | |||
180 | wl1251_mem_read(wl, rx_packet_ring_addr, rx_buffer, length); | 180 | wl1251_mem_read(wl, rx_packet_ring_addr, rx_buffer, length); |
181 | 181 | ||
182 | /* The actual length doesn't include the target's alignment */ | 182 | /* The actual length doesn't include the target's alignment */ |
183 | skb->len = desc->length - PLCP_HEADER_LENGTH; | 183 | skb_trim(skb, desc->length - PLCP_HEADER_LENGTH); |
184 | 184 | ||
185 | fc = (u16 *)skb->data; | 185 | fc = (u16 *)skb->data; |
186 | 186 | ||
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 7669d49a67e2..301cc037fda8 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -132,8 +132,7 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
132 | /* If the skb is GSO then we'll also need an extra slot for the | 132 | /* If the skb is GSO then we'll also need an extra slot for the |
133 | * metadata. | 133 | * metadata. |
134 | */ | 134 | */ |
135 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 || | 135 | if (skb_is_gso(skb)) |
136 | skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | ||
137 | min_slots_needed++; | 136 | min_slots_needed++; |
138 | 137 | ||
139 | /* If the skb can't possibly fit in the remaining slots | 138 | /* If the skb can't possibly fit in the remaining slots |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index e5284bca2d90..438d0c09b7e6 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -240,7 +240,7 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, | |||
240 | struct gnttab_copy *copy_gop; | 240 | struct gnttab_copy *copy_gop; |
241 | struct xenvif_rx_meta *meta; | 241 | struct xenvif_rx_meta *meta; |
242 | unsigned long bytes; | 242 | unsigned long bytes; |
243 | int gso_type; | 243 | int gso_type = XEN_NETIF_GSO_TYPE_NONE; |
244 | 244 | ||
245 | /* Data must not cross a page boundary. */ | 245 | /* Data must not cross a page boundary. */ |
246 | BUG_ON(size + offset > PAGE_SIZE<<compound_order(page)); | 246 | BUG_ON(size + offset > PAGE_SIZE<<compound_order(page)); |
@@ -299,12 +299,12 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, | |||
299 | } | 299 | } |
300 | 300 | ||
301 | /* Leave a gap for the GSO descriptor. */ | 301 | /* Leave a gap for the GSO descriptor. */ |
302 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) | 302 | if (skb_is_gso(skb)) { |
303 | gso_type = XEN_NETIF_GSO_TYPE_TCPV4; | 303 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) |
304 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 304 | gso_type = XEN_NETIF_GSO_TYPE_TCPV4; |
305 | gso_type = XEN_NETIF_GSO_TYPE_TCPV6; | 305 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
306 | else | 306 | gso_type = XEN_NETIF_GSO_TYPE_TCPV6; |
307 | gso_type = XEN_NETIF_GSO_TYPE_NONE; | 307 | } |
308 | 308 | ||
309 | if (*head && ((1 << gso_type) & vif->gso_mask)) | 309 | if (*head && ((1 << gso_type) & vif->gso_mask)) |
310 | vif->rx.req_cons++; | 310 | vif->rx.req_cons++; |
@@ -338,19 +338,15 @@ static int xenvif_gop_skb(struct sk_buff *skb, | |||
338 | int head = 1; | 338 | int head = 1; |
339 | int old_meta_prod; | 339 | int old_meta_prod; |
340 | int gso_type; | 340 | int gso_type; |
341 | int gso_size; | ||
342 | 341 | ||
343 | old_meta_prod = npo->meta_prod; | 342 | old_meta_prod = npo->meta_prod; |
344 | 343 | ||
345 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { | 344 | gso_type = XEN_NETIF_GSO_TYPE_NONE; |
346 | gso_type = XEN_NETIF_GSO_TYPE_TCPV4; | 345 | if (skb_is_gso(skb)) { |
347 | gso_size = skb_shinfo(skb)->gso_size; | 346 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) |
348 | } else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) { | 347 | gso_type = XEN_NETIF_GSO_TYPE_TCPV4; |
349 | gso_type = XEN_NETIF_GSO_TYPE_TCPV6; | 348 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
350 | gso_size = skb_shinfo(skb)->gso_size; | 349 | gso_type = XEN_NETIF_GSO_TYPE_TCPV6; |
351 | } else { | ||
352 | gso_type = XEN_NETIF_GSO_TYPE_NONE; | ||
353 | gso_size = 0; | ||
354 | } | 350 | } |
355 | 351 | ||
356 | /* Set up a GSO prefix descriptor, if necessary */ | 352 | /* Set up a GSO prefix descriptor, if necessary */ |
@@ -358,7 +354,7 @@ static int xenvif_gop_skb(struct sk_buff *skb, | |||
358 | req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++); | 354 | req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++); |
359 | meta = npo->meta + npo->meta_prod++; | 355 | meta = npo->meta + npo->meta_prod++; |
360 | meta->gso_type = gso_type; | 356 | meta->gso_type = gso_type; |
361 | meta->gso_size = gso_size; | 357 | meta->gso_size = skb_shinfo(skb)->gso_size; |
362 | meta->size = 0; | 358 | meta->size = 0; |
363 | meta->id = req->id; | 359 | meta->id = req->id; |
364 | } | 360 | } |
@@ -368,7 +364,7 @@ static int xenvif_gop_skb(struct sk_buff *skb, | |||
368 | 364 | ||
369 | if ((1 << gso_type) & vif->gso_mask) { | 365 | if ((1 << gso_type) & vif->gso_mask) { |
370 | meta->gso_type = gso_type; | 366 | meta->gso_type = gso_type; |
371 | meta->gso_size = gso_size; | 367 | meta->gso_size = skb_shinfo(skb)->gso_size; |
372 | } else { | 368 | } else { |
373 | meta->gso_type = XEN_NETIF_GSO_TYPE_NONE; | 369 | meta->gso_type = XEN_NETIF_GSO_TYPE_NONE; |
374 | meta->gso_size = 0; | 370 | meta->gso_size = 0; |
@@ -500,8 +496,9 @@ static void xenvif_rx_action(struct xenvif *vif) | |||
500 | size = skb_frag_size(&skb_shinfo(skb)->frags[i]); | 496 | size = skb_frag_size(&skb_shinfo(skb)->frags[i]); |
501 | max_slots_needed += DIV_ROUND_UP(size, PAGE_SIZE); | 497 | max_slots_needed += DIV_ROUND_UP(size, PAGE_SIZE); |
502 | } | 498 | } |
503 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 || | 499 | if (skb_is_gso(skb) && |
504 | skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 500 | (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 || |
501 | skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)) | ||
505 | max_slots_needed++; | 502 | max_slots_needed++; |
506 | 503 | ||
507 | /* If the skb may not fit then bail out now */ | 504 | /* If the skb may not fit then bail out now */ |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index f9daa9e183f2..e30d80033cbc 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -907,6 +907,7 @@ static int handle_incoming_queue(struct net_device *dev, | |||
907 | 907 | ||
908 | /* Ethernet work: Delayed to here as it peeks the header. */ | 908 | /* Ethernet work: Delayed to here as it peeks the header. */ |
909 | skb->protocol = eth_type_trans(skb, dev); | 909 | skb->protocol = eth_type_trans(skb, dev); |
910 | skb_reset_network_header(skb); | ||
910 | 911 | ||
911 | if (checksum_setup(dev, skb)) { | 912 | if (checksum_setup(dev, skb)) { |
912 | kfree_skb(skb); | 913 | kfree_skb(skb); |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 00660cc502c5..38901665c770 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -162,8 +162,6 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, | |||
162 | 162 | ||
163 | avail = *r; | 163 | avail = *r; |
164 | pci_clip_resource_to_region(bus, &avail, region); | 164 | pci_clip_resource_to_region(bus, &avail, region); |
165 | if (!resource_size(&avail)) | ||
166 | continue; | ||
167 | 165 | ||
168 | /* | 166 | /* |
169 | * "min" is typically PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM to | 167 | * "min" is typically PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM to |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6b05f6134b68..fdbc294821e6 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1192,6 +1192,9 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars) | |||
1192 | return err; | 1192 | return err; |
1193 | pci_fixup_device(pci_fixup_enable, dev); | 1193 | pci_fixup_device(pci_fixup_enable, dev); |
1194 | 1194 | ||
1195 | if (dev->msi_enabled || dev->msix_enabled) | ||
1196 | return 0; | ||
1197 | |||
1195 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | 1198 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); |
1196 | if (pin) { | 1199 | if (pin) { |
1197 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 1200 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index be361b7cd30f..1e4e69384baa 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -217,7 +217,7 @@ config PINCTRL_IMX28 | |||
217 | select PINCTRL_MXS | 217 | select PINCTRL_MXS |
218 | 218 | ||
219 | config PINCTRL_MSM | 219 | config PINCTRL_MSM |
220 | tristate | 220 | bool |
221 | select PINMUX | 221 | select PINMUX |
222 | select PINCONF | 222 | select PINCONF |
223 | select GENERIC_PINCONF | 223 | select GENERIC_PINCONF |
diff --git a/drivers/pinctrl/pinctrl-capri.c b/drivers/pinctrl/pinctrl-capri.c index 4669c53f99b0..eb2500212147 100644 --- a/drivers/pinctrl/pinctrl-capri.c +++ b/drivers/pinctrl/pinctrl-capri.c | |||
@@ -1435,7 +1435,7 @@ int __init capri_pinctrl_probe(struct platform_device *pdev) | |||
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | static struct of_device_id capri_pinctrl_of_match[] = { | 1437 | static struct of_device_id capri_pinctrl_of_match[] = { |
1438 | { .compatible = "brcm,capri-pinctrl", }, | 1438 | { .compatible = "brcm,bcm11351-pinctrl", }, |
1439 | { }, | 1439 | { }, |
1440 | }; | 1440 | }; |
1441 | 1441 | ||
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index 9ccf681dad2f..f9fabe9bf47d 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
16 | #include <linux/irqdomain.h> | 16 | #include <linux/irqdomain.h> |
17 | #include <linux/irqchip/chained_irq.h> | ||
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/of.h> | 19 | #include <linux/of.h> |
19 | #include <linux/of_address.h> | 20 | #include <linux/of_address.h> |
@@ -584,7 +585,7 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, | |||
584 | spin_lock_irqsave(&pctl->lock, flags); | 585 | spin_lock_irqsave(&pctl->lock, flags); |
585 | 586 | ||
586 | regval = readl(pctl->membase + reg); | 587 | regval = readl(pctl->membase + reg); |
587 | regval &= ~IRQ_CFG_IRQ_MASK; | 588 | regval &= ~(IRQ_CFG_IRQ_MASK << index); |
588 | writel(regval | (mode << index), pctl->membase + reg); | 589 | writel(regval | (mode << index), pctl->membase + reg); |
589 | 590 | ||
590 | spin_unlock_irqrestore(&pctl->lock, flags); | 591 | spin_unlock_irqrestore(&pctl->lock, flags); |
@@ -665,6 +666,7 @@ static struct irq_chip sunxi_pinctrl_irq_chip = { | |||
665 | 666 | ||
666 | static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) | 667 | static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) |
667 | { | 668 | { |
669 | struct irq_chip *chip = irq_get_chip(irq); | ||
668 | struct sunxi_pinctrl *pctl = irq_get_handler_data(irq); | 670 | struct sunxi_pinctrl *pctl = irq_get_handler_data(irq); |
669 | const unsigned long reg = readl(pctl->membase + IRQ_STATUS_REG); | 671 | const unsigned long reg = readl(pctl->membase + IRQ_STATUS_REG); |
670 | 672 | ||
@@ -674,10 +676,12 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) | |||
674 | if (reg) { | 676 | if (reg) { |
675 | int irqoffset; | 677 | int irqoffset; |
676 | 678 | ||
679 | chained_irq_enter(chip, desc); | ||
677 | for_each_set_bit(irqoffset, ®, SUNXI_IRQ_NUMBER) { | 680 | for_each_set_bit(irqoffset, ®, SUNXI_IRQ_NUMBER) { |
678 | int pin_irq = irq_find_mapping(pctl->domain, irqoffset); | 681 | int pin_irq = irq_find_mapping(pctl->domain, irqoffset); |
679 | generic_handle_irq(pin_irq); | 682 | generic_handle_irq(pin_irq); |
680 | } | 683 | } |
684 | chained_irq_exit(chip, desc); | ||
681 | } | 685 | } |
682 | } | 686 | } |
683 | 687 | ||
diff --git a/drivers/pinctrl/pinctrl-sunxi.h b/drivers/pinctrl/pinctrl-sunxi.h index 01c494f8a14f..552b0e97077a 100644 --- a/drivers/pinctrl/pinctrl-sunxi.h +++ b/drivers/pinctrl/pinctrl-sunxi.h | |||
@@ -511,7 +511,7 @@ static inline u32 sunxi_pull_offset(u16 pin) | |||
511 | 511 | ||
512 | static inline u32 sunxi_irq_cfg_reg(u16 irq) | 512 | static inline u32 sunxi_irq_cfg_reg(u16 irq) |
513 | { | 513 | { |
514 | u8 reg = irq / IRQ_CFG_IRQ_PER_REG; | 514 | u8 reg = irq / IRQ_CFG_IRQ_PER_REG * 0x04; |
515 | return reg + IRQ_CFG_REG; | 515 | return reg + IRQ_CFG_REG; |
516 | } | 516 | } |
517 | 517 | ||
@@ -523,7 +523,7 @@ static inline u32 sunxi_irq_cfg_offset(u16 irq) | |||
523 | 523 | ||
524 | static inline u32 sunxi_irq_ctrl_reg(u16 irq) | 524 | static inline u32 sunxi_irq_ctrl_reg(u16 irq) |
525 | { | 525 | { |
526 | u8 reg = irq / IRQ_CTRL_IRQ_PER_REG; | 526 | u8 reg = irq / IRQ_CTRL_IRQ_PER_REG * 0x04; |
527 | return reg + IRQ_CTRL_REG; | 527 | return reg + IRQ_CTRL_REG; |
528 | } | 528 | } |
529 | 529 | ||
@@ -535,7 +535,7 @@ static inline u32 sunxi_irq_ctrl_offset(u16 irq) | |||
535 | 535 | ||
536 | static inline u32 sunxi_irq_status_reg(u16 irq) | 536 | static inline u32 sunxi_irq_status_reg(u16 irq) |
537 | { | 537 | { |
538 | u8 reg = irq / IRQ_STATUS_IRQ_PER_REG; | 538 | u8 reg = irq / IRQ_STATUS_IRQ_PER_REG * 0x04; |
539 | return reg + IRQ_STATUS_REG; | 539 | return reg + IRQ_STATUS_REG; |
540 | } | 540 | } |
541 | 541 | ||
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c index 77d103fe39d9..567d6918d50b 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c | |||
@@ -89,7 +89,8 @@ enum { | |||
89 | 89 | ||
90 | /* GPSR6 */ | 90 | /* GPSR6 */ |
91 | FN_IP13_10, FN_IP13_11, FN_IP13_12, FN_IP13_13, FN_IP13_14, | 91 | FN_IP13_10, FN_IP13_11, FN_IP13_12, FN_IP13_13, FN_IP13_14, |
92 | FN_IP13_15, FN_IP13_18_16, FN_IP13_21_19, FN_IP13_22, FN_IP13_24_23, | 92 | FN_IP13_15, FN_IP13_18_16, FN_IP13_21_19, |
93 | FN_IP13_22, FN_IP13_24_23, FN_SD1_CLK, | ||
93 | FN_IP13_25, FN_IP13_26, FN_IP13_27, FN_IP13_30_28, FN_IP14_1_0, | 94 | FN_IP13_25, FN_IP13_26, FN_IP13_27, FN_IP13_30_28, FN_IP14_1_0, |
94 | FN_IP14_2, FN_IP14_3, FN_IP14_4, FN_IP14_5, FN_IP14_6, FN_IP14_7, | 95 | FN_IP14_2, FN_IP14_3, FN_IP14_4, FN_IP14_5, FN_IP14_6, FN_IP14_7, |
95 | FN_IP14_10_8, FN_IP14_13_11, FN_IP14_16_14, FN_IP14_19_17, | 96 | FN_IP14_10_8, FN_IP14_13_11, FN_IP14_16_14, FN_IP14_19_17, |
@@ -788,6 +789,7 @@ static const u16 pinmux_data[] = { | |||
788 | PINMUX_DATA(USB1_PWEN_MARK, FN_USB1_PWEN), | 789 | PINMUX_DATA(USB1_PWEN_MARK, FN_USB1_PWEN), |
789 | PINMUX_DATA(USB1_OVC_MARK, FN_USB1_OVC), | 790 | PINMUX_DATA(USB1_OVC_MARK, FN_USB1_OVC), |
790 | PINMUX_DATA(DU0_DOTCLKIN_MARK, FN_DU0_DOTCLKIN), | 791 | PINMUX_DATA(DU0_DOTCLKIN_MARK, FN_DU0_DOTCLKIN), |
792 | PINMUX_DATA(SD1_CLK_MARK, FN_SD1_CLK), | ||
791 | 793 | ||
792 | /* IPSR0 */ | 794 | /* IPSR0 */ |
793 | PINMUX_IPSR_DATA(IP0_0, D0), | 795 | PINMUX_IPSR_DATA(IP0_0, D0), |
@@ -3825,7 +3827,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { | |||
3825 | GP_6_11_FN, FN_IP13_25, | 3827 | GP_6_11_FN, FN_IP13_25, |
3826 | GP_6_10_FN, FN_IP13_24_23, | 3828 | GP_6_10_FN, FN_IP13_24_23, |
3827 | GP_6_9_FN, FN_IP13_22, | 3829 | GP_6_9_FN, FN_IP13_22, |
3828 | 0, 0, | 3830 | GP_6_8_FN, FN_SD1_CLK, |
3829 | GP_6_7_FN, FN_IP13_21_19, | 3831 | GP_6_7_FN, FN_IP13_21_19, |
3830 | GP_6_6_FN, FN_IP13_18_16, | 3832 | GP_6_6_FN, FN_IP13_18_16, |
3831 | GP_6_5_FN, FN_IP13_15, | 3833 | GP_6_5_FN, FN_IP13_15, |
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c index a0d6152701cd..617a4916b50f 100644 --- a/drivers/pinctrl/sirf/pinctrl-sirf.c +++ b/drivers/pinctrl/sirf/pinctrl-sirf.c | |||
@@ -598,7 +598,7 @@ static unsigned int sirfsoc_gpio_irq_startup(struct irq_data *d) | |||
598 | { | 598 | { |
599 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); | 599 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); |
600 | 600 | ||
601 | if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq)) | 601 | if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE)) |
602 | dev_err(bank->chip.gc.dev, | 602 | dev_err(bank->chip.gc.dev, |
603 | "unable to lock HW IRQ %lu for IRQ\n", | 603 | "unable to lock HW IRQ %lu for IRQ\n", |
604 | d->hwirq); | 604 | d->hwirq); |
@@ -611,7 +611,7 @@ static void sirfsoc_gpio_irq_shutdown(struct irq_data *d) | |||
611 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); | 611 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); |
612 | 612 | ||
613 | sirfsoc_gpio_irq_mask(d); | 613 | sirfsoc_gpio_irq_mask(d); |
614 | gpio_unlock_as_irq(&bank->chip.gc, d->hwirq); | 614 | gpio_unlock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE); |
615 | } | 615 | } |
616 | 616 | ||
617 | static struct irq_chip sirfsoc_irq_chip = { | 617 | static struct irq_chip sirfsoc_irq_chip = { |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 167f3d00c916..66977ebf13b3 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -183,9 +183,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
183 | struct resource r = {0}; | 183 | struct resource r = {0}; |
184 | int i, flags; | 184 | int i, flags; |
185 | 185 | ||
186 | if (acpi_dev_resource_memory(res, &r) | 186 | if (acpi_dev_resource_address_space(res, &r) |
187 | || acpi_dev_resource_io(res, &r) | ||
188 | || acpi_dev_resource_address_space(res, &r) | ||
189 | || acpi_dev_resource_ext_address_space(res, &r)) { | 187 | || acpi_dev_resource_ext_address_space(res, &r)) { |
190 | pnp_add_resource(dev, &r); | 188 | pnp_add_resource(dev, &r); |
191 | return AE_OK; | 189 | return AE_OK; |
@@ -217,6 +215,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
217 | } | 215 | } |
218 | 216 | ||
219 | switch (res->type) { | 217 | switch (res->type) { |
218 | case ACPI_RESOURCE_TYPE_MEMORY24: | ||
219 | case ACPI_RESOURCE_TYPE_MEMORY32: | ||
220 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | ||
221 | if (acpi_dev_resource_memory(res, &r)) | ||
222 | pnp_add_resource(dev, &r); | ||
223 | break; | ||
224 | case ACPI_RESOURCE_TYPE_IO: | ||
225 | case ACPI_RESOURCE_TYPE_FIXED_IO: | ||
226 | if (acpi_dev_resource_io(res, &r)) | ||
227 | pnp_add_resource(dev, &r); | ||
228 | break; | ||
220 | case ACPI_RESOURCE_TYPE_DMA: | 229 | case ACPI_RESOURCE_TYPE_DMA: |
221 | dma = &res->data.dma; | 230 | dma = &res->data.dma; |
222 | if (dma->channel_count > 0 && dma->channels[0] != (u8) -1) | 231 | if (dma->channel_count > 0 && dma->channels[0] != (u8) -1) |
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c index 8a843a04c224..a40b9c34e9ff 100644 --- a/drivers/pwm/pwm-lp3943.c +++ b/drivers/pwm/pwm-lp3943.c | |||
@@ -52,8 +52,10 @@ lp3943_pwm_request_map(struct lp3943_pwm *lp3943_pwm, int hwpwm) | |||
52 | offset = pwm_map->output[i]; | 52 | offset = pwm_map->output[i]; |
53 | 53 | ||
54 | /* Return an error if the pin is already assigned */ | 54 | /* Return an error if the pin is already assigned */ |
55 | if (test_and_set_bit(offset, &lp3943->pin_used)) | 55 | if (test_and_set_bit(offset, &lp3943->pin_used)) { |
56 | kfree(pwm_map); | ||
56 | return ERR_PTR(-EBUSY); | 57 | return ERR_PTR(-EBUSY); |
58 | } | ||
57 | } | 59 | } |
58 | 60 | ||
59 | return pwm_map; | 61 | return pwm_map; |
diff --git a/drivers/rapidio/devices/tsi721.h b/drivers/rapidio/devices/tsi721.h index b4b0d83f9ef6..7061ac0ad428 100644 --- a/drivers/rapidio/devices/tsi721.h +++ b/drivers/rapidio/devices/tsi721.h | |||
@@ -678,6 +678,7 @@ struct tsi721_bdma_chan { | |||
678 | struct list_head free_list; | 678 | struct list_head free_list; |
679 | dma_cookie_t completed_cookie; | 679 | dma_cookie_t completed_cookie; |
680 | struct tasklet_struct tasklet; | 680 | struct tasklet_struct tasklet; |
681 | bool active; | ||
681 | }; | 682 | }; |
682 | 683 | ||
683 | #endif /* CONFIG_RAPIDIO_DMA_ENGINE */ | 684 | #endif /* CONFIG_RAPIDIO_DMA_ENGINE */ |
diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c index 502663f5f7c6..91245f5dbe81 100644 --- a/drivers/rapidio/devices/tsi721_dma.c +++ b/drivers/rapidio/devices/tsi721_dma.c | |||
@@ -206,8 +206,8 @@ void tsi721_bdma_handler(struct tsi721_bdma_chan *bdma_chan) | |||
206 | { | 206 | { |
207 | /* Disable BDMA channel interrupts */ | 207 | /* Disable BDMA channel interrupts */ |
208 | iowrite32(0, bdma_chan->regs + TSI721_DMAC_INTE); | 208 | iowrite32(0, bdma_chan->regs + TSI721_DMAC_INTE); |
209 | 209 | if (bdma_chan->active) | |
210 | tasklet_schedule(&bdma_chan->tasklet); | 210 | tasklet_schedule(&bdma_chan->tasklet); |
211 | } | 211 | } |
212 | 212 | ||
213 | #ifdef CONFIG_PCI_MSI | 213 | #ifdef CONFIG_PCI_MSI |
@@ -562,7 +562,7 @@ static int tsi721_alloc_chan_resources(struct dma_chan *dchan) | |||
562 | } | 562 | } |
563 | #endif /* CONFIG_PCI_MSI */ | 563 | #endif /* CONFIG_PCI_MSI */ |
564 | 564 | ||
565 | tasklet_enable(&bdma_chan->tasklet); | 565 | bdma_chan->active = true; |
566 | tsi721_bdma_interrupt_enable(bdma_chan, 1); | 566 | tsi721_bdma_interrupt_enable(bdma_chan, 1); |
567 | 567 | ||
568 | return bdma_chan->bd_num - 1; | 568 | return bdma_chan->bd_num - 1; |
@@ -576,9 +576,7 @@ err_out: | |||
576 | static void tsi721_free_chan_resources(struct dma_chan *dchan) | 576 | static void tsi721_free_chan_resources(struct dma_chan *dchan) |
577 | { | 577 | { |
578 | struct tsi721_bdma_chan *bdma_chan = to_tsi721_chan(dchan); | 578 | struct tsi721_bdma_chan *bdma_chan = to_tsi721_chan(dchan); |
579 | #ifdef CONFIG_PCI_MSI | ||
580 | struct tsi721_device *priv = to_tsi721(dchan->device); | 579 | struct tsi721_device *priv = to_tsi721(dchan->device); |
581 | #endif | ||
582 | LIST_HEAD(list); | 580 | LIST_HEAD(list); |
583 | 581 | ||
584 | dev_dbg(dchan->device->dev, "%s: Entry\n", __func__); | 582 | dev_dbg(dchan->device->dev, "%s: Entry\n", __func__); |
@@ -589,14 +587,25 @@ static void tsi721_free_chan_resources(struct dma_chan *dchan) | |||
589 | BUG_ON(!list_empty(&bdma_chan->active_list)); | 587 | BUG_ON(!list_empty(&bdma_chan->active_list)); |
590 | BUG_ON(!list_empty(&bdma_chan->queue)); | 588 | BUG_ON(!list_empty(&bdma_chan->queue)); |
591 | 589 | ||
592 | tasklet_disable(&bdma_chan->tasklet); | 590 | tsi721_bdma_interrupt_enable(bdma_chan, 0); |
591 | bdma_chan->active = false; | ||
592 | |||
593 | #ifdef CONFIG_PCI_MSI | ||
594 | if (priv->flags & TSI721_USING_MSIX) { | ||
595 | synchronize_irq(priv->msix[TSI721_VECT_DMA0_DONE + | ||
596 | bdma_chan->id].vector); | ||
597 | synchronize_irq(priv->msix[TSI721_VECT_DMA0_INT + | ||
598 | bdma_chan->id].vector); | ||
599 | } else | ||
600 | #endif | ||
601 | synchronize_irq(priv->pdev->irq); | ||
602 | |||
603 | tasklet_kill(&bdma_chan->tasklet); | ||
593 | 604 | ||
594 | spin_lock_bh(&bdma_chan->lock); | 605 | spin_lock_bh(&bdma_chan->lock); |
595 | list_splice_init(&bdma_chan->free_list, &list); | 606 | list_splice_init(&bdma_chan->free_list, &list); |
596 | spin_unlock_bh(&bdma_chan->lock); | 607 | spin_unlock_bh(&bdma_chan->lock); |
597 | 608 | ||
598 | tsi721_bdma_interrupt_enable(bdma_chan, 0); | ||
599 | |||
600 | #ifdef CONFIG_PCI_MSI | 609 | #ifdef CONFIG_PCI_MSI |
601 | if (priv->flags & TSI721_USING_MSIX) { | 610 | if (priv->flags & TSI721_USING_MSIX) { |
602 | free_irq(priv->msix[TSI721_VECT_DMA0_DONE + | 611 | free_irq(priv->msix[TSI721_VECT_DMA0_DONE + |
@@ -790,6 +799,7 @@ int tsi721_register_dma(struct tsi721_device *priv) | |||
790 | bdma_chan->dchan.cookie = 1; | 799 | bdma_chan->dchan.cookie = 1; |
791 | bdma_chan->dchan.chan_id = i; | 800 | bdma_chan->dchan.chan_id = i; |
792 | bdma_chan->id = i; | 801 | bdma_chan->id = i; |
802 | bdma_chan->active = false; | ||
793 | 803 | ||
794 | spin_lock_init(&bdma_chan->lock); | 804 | spin_lock_init(&bdma_chan->lock); |
795 | 805 | ||
@@ -799,7 +809,6 @@ int tsi721_register_dma(struct tsi721_device *priv) | |||
799 | 809 | ||
800 | tasklet_init(&bdma_chan->tasklet, tsi721_dma_tasklet, | 810 | tasklet_init(&bdma_chan->tasklet, tsi721_dma_tasklet, |
801 | (unsigned long)bdma_chan); | 811 | (unsigned long)bdma_chan); |
802 | tasklet_disable(&bdma_chan->tasklet); | ||
803 | list_add_tail(&bdma_chan->dchan.device_node, | 812 | list_add_tail(&bdma_chan->dchan.device_node, |
804 | &mport->dma.channels); | 813 | &mport->dma.channels); |
805 | } | 814 | } |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d1ac4caaf1b0..afca1bc24f26 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -953,6 +953,8 @@ static int machine_constraints_current(struct regulator_dev *rdev, | |||
953 | return 0; | 953 | return 0; |
954 | } | 954 | } |
955 | 955 | ||
956 | static int _regulator_do_enable(struct regulator_dev *rdev); | ||
957 | |||
956 | /** | 958 | /** |
957 | * set_machine_constraints - sets regulator constraints | 959 | * set_machine_constraints - sets regulator constraints |
958 | * @rdev: regulator source | 960 | * @rdev: regulator source |
@@ -1013,10 +1015,9 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
1013 | /* If the constraints say the regulator should be on at this point | 1015 | /* If the constraints say the regulator should be on at this point |
1014 | * and we have control then make sure it is enabled. | 1016 | * and we have control then make sure it is enabled. |
1015 | */ | 1017 | */ |
1016 | if ((rdev->constraints->always_on || rdev->constraints->boot_on) && | 1018 | if (rdev->constraints->always_on || rdev->constraints->boot_on) { |
1017 | ops->enable) { | 1019 | ret = _regulator_do_enable(rdev); |
1018 | ret = ops->enable(rdev); | 1020 | if (ret < 0 && ret != -EINVAL) { |
1019 | if (ret < 0) { | ||
1020 | rdev_err(rdev, "failed to enable\n"); | 1021 | rdev_err(rdev, "failed to enable\n"); |
1021 | goto out; | 1022 | goto out; |
1022 | } | 1023 | } |
@@ -1907,8 +1908,6 @@ static int _regulator_do_disable(struct regulator_dev *rdev) | |||
1907 | 1908 | ||
1908 | trace_regulator_disable_complete(rdev_get_name(rdev)); | 1909 | trace_regulator_disable_complete(rdev_get_name(rdev)); |
1909 | 1910 | ||
1910 | _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE, | ||
1911 | NULL); | ||
1912 | return 0; | 1911 | return 0; |
1913 | } | 1912 | } |
1914 | 1913 | ||
@@ -1932,6 +1931,8 @@ static int _regulator_disable(struct regulator_dev *rdev) | |||
1932 | rdev_err(rdev, "failed to disable\n"); | 1931 | rdev_err(rdev, "failed to disable\n"); |
1933 | return ret; | 1932 | return ret; |
1934 | } | 1933 | } |
1934 | _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE, | ||
1935 | NULL); | ||
1935 | } | 1936 | } |
1936 | 1937 | ||
1937 | rdev->use_count = 0; | 1938 | rdev->use_count = 0; |
@@ -1984,20 +1985,16 @@ static int _regulator_force_disable(struct regulator_dev *rdev) | |||
1984 | { | 1985 | { |
1985 | int ret = 0; | 1986 | int ret = 0; |
1986 | 1987 | ||
1987 | /* force disable */ | 1988 | ret = _regulator_do_disable(rdev); |
1988 | if (rdev->desc->ops->disable) { | 1989 | if (ret < 0) { |
1989 | /* ah well, who wants to live forever... */ | 1990 | rdev_err(rdev, "failed to force disable\n"); |
1990 | ret = rdev->desc->ops->disable(rdev); | 1991 | return ret; |
1991 | if (ret < 0) { | ||
1992 | rdev_err(rdev, "failed to force disable\n"); | ||
1993 | return ret; | ||
1994 | } | ||
1995 | /* notify other consumers that power has been forced off */ | ||
1996 | _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | | ||
1997 | REGULATOR_EVENT_DISABLE, NULL); | ||
1998 | } | 1992 | } |
1999 | 1993 | ||
2000 | return ret; | 1994 | _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | |
1995 | REGULATOR_EVENT_DISABLE, NULL); | ||
1996 | |||
1997 | return 0; | ||
2001 | } | 1998 | } |
2002 | 1999 | ||
2003 | /** | 2000 | /** |
@@ -3630,23 +3627,18 @@ int regulator_suspend_finish(void) | |||
3630 | 3627 | ||
3631 | mutex_lock(®ulator_list_mutex); | 3628 | mutex_lock(®ulator_list_mutex); |
3632 | list_for_each_entry(rdev, ®ulator_list, list) { | 3629 | list_for_each_entry(rdev, ®ulator_list, list) { |
3633 | struct regulator_ops *ops = rdev->desc->ops; | ||
3634 | |||
3635 | mutex_lock(&rdev->mutex); | 3630 | mutex_lock(&rdev->mutex); |
3636 | if ((rdev->use_count > 0 || rdev->constraints->always_on) && | 3631 | if (rdev->use_count > 0 || rdev->constraints->always_on) { |
3637 | ops->enable) { | 3632 | error = _regulator_do_enable(rdev); |
3638 | error = ops->enable(rdev); | ||
3639 | if (error) | 3633 | if (error) |
3640 | ret = error; | 3634 | ret = error; |
3641 | } else { | 3635 | } else { |
3642 | if (!have_full_constraints()) | 3636 | if (!have_full_constraints()) |
3643 | goto unlock; | 3637 | goto unlock; |
3644 | if (!ops->disable) | ||
3645 | goto unlock; | ||
3646 | if (!_regulator_is_enabled(rdev)) | 3638 | if (!_regulator_is_enabled(rdev)) |
3647 | goto unlock; | 3639 | goto unlock; |
3648 | 3640 | ||
3649 | error = ops->disable(rdev); | 3641 | error = _regulator_do_disable(rdev); |
3650 | if (error) | 3642 | if (error) |
3651 | ret = error; | 3643 | ret = error; |
3652 | } | 3644 | } |
@@ -3820,7 +3812,7 @@ static int __init regulator_init_complete(void) | |||
3820 | ops = rdev->desc->ops; | 3812 | ops = rdev->desc->ops; |
3821 | c = rdev->constraints; | 3813 | c = rdev->constraints; |
3822 | 3814 | ||
3823 | if (!ops->disable || (c && c->always_on)) | 3815 | if (c && c->always_on) |
3824 | continue; | 3816 | continue; |
3825 | 3817 | ||
3826 | mutex_lock(&rdev->mutex); | 3818 | mutex_lock(&rdev->mutex); |
@@ -3841,7 +3833,7 @@ static int __init regulator_init_complete(void) | |||
3841 | /* We log since this may kill the system if it | 3833 | /* We log since this may kill the system if it |
3842 | * goes wrong. */ | 3834 | * goes wrong. */ |
3843 | rdev_info(rdev, "disabling\n"); | 3835 | rdev_info(rdev, "disabling\n"); |
3844 | ret = ops->disable(rdev); | 3836 | ret = _regulator_do_disable(rdev); |
3845 | if (ret != 0) | 3837 | if (ret != 0) |
3846 | rdev_err(rdev, "couldn't disable: %d\n", ret); | 3838 | rdev_err(rdev, "couldn't disable: %d\n", ret); |
3847 | } else { | 3839 | } else { |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7afd373b9595..c4cde9c08f1f 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -580,10 +580,12 @@ static int s3c_rtc_suspend(struct device *dev) | |||
580 | 580 | ||
581 | clk_enable(rtc_clk); | 581 | clk_enable(rtc_clk); |
582 | /* save TICNT for anyone using periodic interrupts */ | 582 | /* save TICNT for anyone using periodic interrupts */ |
583 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | ||
584 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { | 583 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
585 | ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); | 584 | ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); |
586 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; | 585 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; |
586 | ticnt_save = readl(s3c_rtc_base + S3C2410_TICNT); | ||
587 | } else { | ||
588 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | ||
587 | } | 589 | } |
588 | s3c_rtc_enable(pdev, 0); | 590 | s3c_rtc_enable(pdev, 0); |
589 | 591 | ||
@@ -605,10 +607,15 @@ static int s3c_rtc_resume(struct device *dev) | |||
605 | 607 | ||
606 | clk_enable(rtc_clk); | 608 | clk_enable(rtc_clk); |
607 | s3c_rtc_enable(pdev, 1); | 609 | s3c_rtc_enable(pdev, 1); |
608 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | 610 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
609 | if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { | 611 | writel(ticnt_save, s3c_rtc_base + S3C2410_TICNT); |
610 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); | 612 | if (ticnt_en_save) { |
611 | writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); | 613 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); |
614 | writew(tmp | ticnt_en_save, | ||
615 | s3c_rtc_base + S3C2410_RTCCON); | ||
616 | } | ||
617 | } else { | ||
618 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | ||
612 | } | 619 | } |
613 | 620 | ||
614 | if (device_may_wakeup(dev) && wake_en) { | 621 | if (device_may_wakeup(dev) && wake_en) { |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index f6b9188c5af5..9f0ea6cb6922 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -610,6 +610,7 @@ void chsc_chp_online(struct chp_id chpid) | |||
610 | css_wait_for_slow_path(); | 610 | css_wait_for_slow_path(); |
611 | for_each_subchannel_staged(__s390_process_res_acc, NULL, | 611 | for_each_subchannel_staged(__s390_process_res_acc, NULL, |
612 | &link); | 612 | &link); |
613 | css_schedule_reprobe(); | ||
613 | } | 614 | } |
614 | } | 615 | } |
615 | 616 | ||
diff --git a/drivers/s390/crypto/zcrypt_msgtype6.c b/drivers/s390/crypto/zcrypt_msgtype6.c index dc542e0a3055..0bc91e46395a 100644 --- a/drivers/s390/crypto/zcrypt_msgtype6.c +++ b/drivers/s390/crypto/zcrypt_msgtype6.c | |||
@@ -311,7 +311,7 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev, | |||
311 | } __packed * msg = ap_msg->message; | 311 | } __packed * msg = ap_msg->message; |
312 | 312 | ||
313 | int rcblen = CEIL4(xcRB->request_control_blk_length); | 313 | int rcblen = CEIL4(xcRB->request_control_blk_length); |
314 | int replylen; | 314 | int replylen, req_sumlen, resp_sumlen; |
315 | char *req_data = ap_msg->message + sizeof(struct type6_hdr) + rcblen; | 315 | char *req_data = ap_msg->message + sizeof(struct type6_hdr) + rcblen; |
316 | char *function_code; | 316 | char *function_code; |
317 | 317 | ||
@@ -321,12 +321,34 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev, | |||
321 | xcRB->request_data_length; | 321 | xcRB->request_data_length; |
322 | if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE) | 322 | if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE) |
323 | return -EINVAL; | 323 | return -EINVAL; |
324 | |||
325 | /* Overflow check | ||
326 | sum must be greater (or equal) than the largest operand */ | ||
327 | req_sumlen = CEIL4(xcRB->request_control_blk_length) + | ||
328 | xcRB->request_data_length; | ||
329 | if ((CEIL4(xcRB->request_control_blk_length) <= | ||
330 | xcRB->request_data_length) ? | ||
331 | (req_sumlen < xcRB->request_data_length) : | ||
332 | (req_sumlen < CEIL4(xcRB->request_control_blk_length))) { | ||
333 | return -EINVAL; | ||
334 | } | ||
335 | |||
324 | replylen = sizeof(struct type86_fmt2_msg) + | 336 | replylen = sizeof(struct type86_fmt2_msg) + |
325 | CEIL4(xcRB->reply_control_blk_length) + | 337 | CEIL4(xcRB->reply_control_blk_length) + |
326 | xcRB->reply_data_length; | 338 | xcRB->reply_data_length; |
327 | if (replylen > MSGTYPE06_MAX_MSG_SIZE) | 339 | if (replylen > MSGTYPE06_MAX_MSG_SIZE) |
328 | return -EINVAL; | 340 | return -EINVAL; |
329 | 341 | ||
342 | /* Overflow check | ||
343 | sum must be greater (or equal) than the largest operand */ | ||
344 | resp_sumlen = CEIL4(xcRB->reply_control_blk_length) + | ||
345 | xcRB->reply_data_length; | ||
346 | if ((CEIL4(xcRB->reply_control_blk_length) <= xcRB->reply_data_length) ? | ||
347 | (resp_sumlen < xcRB->reply_data_length) : | ||
348 | (resp_sumlen < CEIL4(xcRB->reply_control_blk_length))) { | ||
349 | return -EINVAL; | ||
350 | } | ||
351 | |||
330 | /* prepare type6 header */ | 352 | /* prepare type6 header */ |
331 | msg->hdr = static_type6_hdrX; | 353 | msg->hdr = static_type6_hdrX; |
332 | memcpy(msg->hdr.agent_id , &(xcRB->agent_ID), sizeof(xcRB->agent_ID)); | 354 | memcpy(msg->hdr.agent_id , &(xcRB->agent_ID), sizeof(xcRB->agent_ID)); |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index c3a83df07894..795ed61a5496 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1660,7 +1660,6 @@ int qeth_qdio_clear_card(struct qeth_card *card, int use_halt) | |||
1660 | QDIO_FLAG_CLEANUP_USING_CLEAR); | 1660 | QDIO_FLAG_CLEANUP_USING_CLEAR); |
1661 | if (rc) | 1661 | if (rc) |
1662 | QETH_CARD_TEXT_(card, 3, "1err%d", rc); | 1662 | QETH_CARD_TEXT_(card, 3, "1err%d", rc); |
1663 | qdio_free(CARD_DDEV(card)); | ||
1664 | atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); | 1663 | atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); |
1665 | break; | 1664 | break; |
1666 | case QETH_QDIO_CLEANING: | 1665 | case QETH_QDIO_CLEANING: |
@@ -2605,6 +2604,7 @@ static int qeth_mpc_initialize(struct qeth_card *card) | |||
2605 | return 0; | 2604 | return 0; |
2606 | out_qdio: | 2605 | out_qdio: |
2607 | qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); | 2606 | qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); |
2607 | qdio_free(CARD_DDEV(card)); | ||
2608 | return rc; | 2608 | return rc; |
2609 | } | 2609 | } |
2610 | 2610 | ||
@@ -4906,9 +4906,11 @@ retry: | |||
4906 | if (retries < 3) | 4906 | if (retries < 3) |
4907 | QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", | 4907 | QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", |
4908 | dev_name(&card->gdev->dev)); | 4908 | dev_name(&card->gdev->dev)); |
4909 | rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); | ||
4909 | ccw_device_set_offline(CARD_DDEV(card)); | 4910 | ccw_device_set_offline(CARD_DDEV(card)); |
4910 | ccw_device_set_offline(CARD_WDEV(card)); | 4911 | ccw_device_set_offline(CARD_WDEV(card)); |
4911 | ccw_device_set_offline(CARD_RDEV(card)); | 4912 | ccw_device_set_offline(CARD_RDEV(card)); |
4913 | qdio_free(CARD_DDEV(card)); | ||
4912 | rc = ccw_device_set_online(CARD_RDEV(card)); | 4914 | rc = ccw_device_set_online(CARD_RDEV(card)); |
4913 | if (rc) | 4915 | if (rc) |
4914 | goto retriable; | 4916 | goto retriable; |
@@ -4918,7 +4920,6 @@ retry: | |||
4918 | rc = ccw_device_set_online(CARD_DDEV(card)); | 4920 | rc = ccw_device_set_online(CARD_DDEV(card)); |
4919 | if (rc) | 4921 | if (rc) |
4920 | goto retriable; | 4922 | goto retriable; |
4921 | rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); | ||
4922 | retriable: | 4923 | retriable: |
4923 | if (rc == -ERESTARTSYS) { | 4924 | if (rc == -ERESTARTSYS) { |
4924 | QETH_DBF_TEXT(SETUP, 2, "break1"); | 4925 | QETH_DBF_TEXT(SETUP, 2, "break1"); |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 0710550093ce..908d82529ee9 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -1091,6 +1091,7 @@ out_remove: | |||
1091 | ccw_device_set_offline(CARD_DDEV(card)); | 1091 | ccw_device_set_offline(CARD_DDEV(card)); |
1092 | ccw_device_set_offline(CARD_WDEV(card)); | 1092 | ccw_device_set_offline(CARD_WDEV(card)); |
1093 | ccw_device_set_offline(CARD_RDEV(card)); | 1093 | ccw_device_set_offline(CARD_RDEV(card)); |
1094 | qdio_free(CARD_DDEV(card)); | ||
1094 | if (recover_flag == CARD_STATE_RECOVER) | 1095 | if (recover_flag == CARD_STATE_RECOVER) |
1095 | card->state = CARD_STATE_RECOVER; | 1096 | card->state = CARD_STATE_RECOVER; |
1096 | else | 1097 | else |
@@ -1132,6 +1133,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev, | |||
1132 | rc = (rc2) ? rc2 : rc3; | 1133 | rc = (rc2) ? rc2 : rc3; |
1133 | if (rc) | 1134 | if (rc) |
1134 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | 1135 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); |
1136 | qdio_free(CARD_DDEV(card)); | ||
1135 | if (recover_flag == CARD_STATE_UP) | 1137 | if (recover_flag == CARD_STATE_UP) |
1136 | card->state = CARD_STATE_RECOVER; | 1138 | card->state = CARD_STATE_RECOVER; |
1137 | /* let user_space know that device is offline */ | 1139 | /* let user_space know that device is offline */ |
@@ -1194,6 +1196,7 @@ static void qeth_l2_shutdown(struct ccwgroup_device *gdev) | |||
1194 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); | 1196 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); |
1195 | qeth_qdio_clear_card(card, 0); | 1197 | qeth_qdio_clear_card(card, 0); |
1196 | qeth_clear_qdio_buffers(card); | 1198 | qeth_clear_qdio_buffers(card); |
1199 | qdio_free(CARD_DDEV(card)); | ||
1197 | } | 1200 | } |
1198 | 1201 | ||
1199 | static int qeth_l2_pm_suspend(struct ccwgroup_device *gdev) | 1202 | static int qeth_l2_pm_suspend(struct ccwgroup_device *gdev) |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 0f430424c3b8..3524d34ff694 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -3447,6 +3447,7 @@ out_remove: | |||
3447 | ccw_device_set_offline(CARD_DDEV(card)); | 3447 | ccw_device_set_offline(CARD_DDEV(card)); |
3448 | ccw_device_set_offline(CARD_WDEV(card)); | 3448 | ccw_device_set_offline(CARD_WDEV(card)); |
3449 | ccw_device_set_offline(CARD_RDEV(card)); | 3449 | ccw_device_set_offline(CARD_RDEV(card)); |
3450 | qdio_free(CARD_DDEV(card)); | ||
3450 | if (recover_flag == CARD_STATE_RECOVER) | 3451 | if (recover_flag == CARD_STATE_RECOVER) |
3451 | card->state = CARD_STATE_RECOVER; | 3452 | card->state = CARD_STATE_RECOVER; |
3452 | else | 3453 | else |
@@ -3493,6 +3494,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev, | |||
3493 | rc = (rc2) ? rc2 : rc3; | 3494 | rc = (rc2) ? rc2 : rc3; |
3494 | if (rc) | 3495 | if (rc) |
3495 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | 3496 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); |
3497 | qdio_free(CARD_DDEV(card)); | ||
3496 | if (recover_flag == CARD_STATE_UP) | 3498 | if (recover_flag == CARD_STATE_UP) |
3497 | card->state = CARD_STATE_RECOVER; | 3499 | card->state = CARD_STATE_RECOVER; |
3498 | /* let user_space know that device is offline */ | 3500 | /* let user_space know that device is offline */ |
@@ -3545,6 +3547,7 @@ static void qeth_l3_shutdown(struct ccwgroup_device *gdev) | |||
3545 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); | 3547 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); |
3546 | qeth_qdio_clear_card(card, 0); | 3548 | qeth_qdio_clear_card(card, 0); |
3547 | qeth_clear_qdio_buffers(card); | 3549 | qeth_clear_qdio_buffers(card); |
3550 | qdio_free(CARD_DDEV(card)); | ||
3548 | } | 3551 | } |
3549 | 3552 | ||
3550 | static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev) | 3553 | static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev) |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 1f375051483a..5642a9b250c2 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -325,7 +325,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) | |||
325 | if (!abrt_task->sc || abrt_task->state == ISCSI_TASK_FREE) | 325 | if (!abrt_task->sc || abrt_task->state == ISCSI_TASK_FREE) |
326 | continue; | 326 | continue; |
327 | 327 | ||
328 | if (abrt_task->sc->device->lun != abrt_task->sc->device->lun) | 328 | if (sc->device->lun != abrt_task->sc->device->lun) |
329 | continue; | 329 | continue; |
330 | 330 | ||
331 | /* Invalidate WRB Posted for this Task */ | 331 | /* Invalidate WRB Posted for this Task */ |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index ed880891cb7c..e9279a8c1e1c 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -594,13 +594,13 @@ static void bnx2fc_free_mp_resc(struct bnx2fc_cmd *io_req) | |||
594 | mp_req->mp_resp_bd = NULL; | 594 | mp_req->mp_resp_bd = NULL; |
595 | } | 595 | } |
596 | if (mp_req->req_buf) { | 596 | if (mp_req->req_buf) { |
597 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 597 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
598 | mp_req->req_buf, | 598 | mp_req->req_buf, |
599 | mp_req->req_buf_dma); | 599 | mp_req->req_buf_dma); |
600 | mp_req->req_buf = NULL; | 600 | mp_req->req_buf = NULL; |
601 | } | 601 | } |
602 | if (mp_req->resp_buf) { | 602 | if (mp_req->resp_buf) { |
603 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 603 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
604 | mp_req->resp_buf, | 604 | mp_req->resp_buf, |
605 | mp_req->resp_buf_dma); | 605 | mp_req->resp_buf_dma); |
606 | mp_req->resp_buf = NULL; | 606 | mp_req->resp_buf = NULL; |
@@ -622,7 +622,7 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req) | |||
622 | 622 | ||
623 | mp_req->req_len = sizeof(struct fcp_cmnd); | 623 | mp_req->req_len = sizeof(struct fcp_cmnd); |
624 | io_req->data_xfer_len = mp_req->req_len; | 624 | io_req->data_xfer_len = mp_req->req_len; |
625 | mp_req->req_buf = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, | 625 | mp_req->req_buf = dma_alloc_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
626 | &mp_req->req_buf_dma, | 626 | &mp_req->req_buf_dma, |
627 | GFP_ATOMIC); | 627 | GFP_ATOMIC); |
628 | if (!mp_req->req_buf) { | 628 | if (!mp_req->req_buf) { |
@@ -631,7 +631,7 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req) | |||
631 | return FAILED; | 631 | return FAILED; |
632 | } | 632 | } |
633 | 633 | ||
634 | mp_req->resp_buf = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, | 634 | mp_req->resp_buf = dma_alloc_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
635 | &mp_req->resp_buf_dma, | 635 | &mp_req->resp_buf_dma, |
636 | GFP_ATOMIC); | 636 | GFP_ATOMIC); |
637 | if (!mp_req->resp_buf) { | 637 | if (!mp_req->resp_buf) { |
@@ -639,8 +639,8 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req) | |||
639 | bnx2fc_free_mp_resc(io_req); | 639 | bnx2fc_free_mp_resc(io_req); |
640 | return FAILED; | 640 | return FAILED; |
641 | } | 641 | } |
642 | memset(mp_req->req_buf, 0, PAGE_SIZE); | 642 | memset(mp_req->req_buf, 0, CNIC_PAGE_SIZE); |
643 | memset(mp_req->resp_buf, 0, PAGE_SIZE); | 643 | memset(mp_req->resp_buf, 0, CNIC_PAGE_SIZE); |
644 | 644 | ||
645 | /* Allocate and map mp_req_bd and mp_resp_bd */ | 645 | /* Allocate and map mp_req_bd and mp_resp_bd */ |
646 | sz = sizeof(struct fcoe_bd_ctx); | 646 | sz = sizeof(struct fcoe_bd_ctx); |
@@ -665,7 +665,7 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req) | |||
665 | mp_req_bd = mp_req->mp_req_bd; | 665 | mp_req_bd = mp_req->mp_req_bd; |
666 | mp_req_bd->buf_addr_lo = (u32)addr & 0xffffffff; | 666 | mp_req_bd->buf_addr_lo = (u32)addr & 0xffffffff; |
667 | mp_req_bd->buf_addr_hi = (u32)((u64)addr >> 32); | 667 | mp_req_bd->buf_addr_hi = (u32)((u64)addr >> 32); |
668 | mp_req_bd->buf_len = PAGE_SIZE; | 668 | mp_req_bd->buf_len = CNIC_PAGE_SIZE; |
669 | mp_req_bd->flags = 0; | 669 | mp_req_bd->flags = 0; |
670 | 670 | ||
671 | /* | 671 | /* |
@@ -677,7 +677,7 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req) | |||
677 | addr = mp_req->resp_buf_dma; | 677 | addr = mp_req->resp_buf_dma; |
678 | mp_resp_bd->buf_addr_lo = (u32)addr & 0xffffffff; | 678 | mp_resp_bd->buf_addr_lo = (u32)addr & 0xffffffff; |
679 | mp_resp_bd->buf_addr_hi = (u32)((u64)addr >> 32); | 679 | mp_resp_bd->buf_addr_hi = (u32)((u64)addr >> 32); |
680 | mp_resp_bd->buf_len = PAGE_SIZE; | 680 | mp_resp_bd->buf_len = CNIC_PAGE_SIZE; |
681 | mp_resp_bd->flags = 0; | 681 | mp_resp_bd->flags = 0; |
682 | 682 | ||
683 | return SUCCESS; | 683 | return SUCCESS; |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c index 4d93177dfb53..d9bae5672273 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c | |||
@@ -673,7 +673,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
673 | 673 | ||
674 | /* Allocate and map SQ */ | 674 | /* Allocate and map SQ */ |
675 | tgt->sq_mem_size = tgt->max_sqes * BNX2FC_SQ_WQE_SIZE; | 675 | tgt->sq_mem_size = tgt->max_sqes * BNX2FC_SQ_WQE_SIZE; |
676 | tgt->sq_mem_size = (tgt->sq_mem_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 676 | tgt->sq_mem_size = (tgt->sq_mem_size + (CNIC_PAGE_SIZE - 1)) & |
677 | CNIC_PAGE_MASK; | ||
677 | 678 | ||
678 | tgt->sq = dma_alloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size, | 679 | tgt->sq = dma_alloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size, |
679 | &tgt->sq_dma, GFP_KERNEL); | 680 | &tgt->sq_dma, GFP_KERNEL); |
@@ -686,7 +687,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
686 | 687 | ||
687 | /* Allocate and map CQ */ | 688 | /* Allocate and map CQ */ |
688 | tgt->cq_mem_size = tgt->max_cqes * BNX2FC_CQ_WQE_SIZE; | 689 | tgt->cq_mem_size = tgt->max_cqes * BNX2FC_CQ_WQE_SIZE; |
689 | tgt->cq_mem_size = (tgt->cq_mem_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 690 | tgt->cq_mem_size = (tgt->cq_mem_size + (CNIC_PAGE_SIZE - 1)) & |
691 | CNIC_PAGE_MASK; | ||
690 | 692 | ||
691 | tgt->cq = dma_alloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size, | 693 | tgt->cq = dma_alloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size, |
692 | &tgt->cq_dma, GFP_KERNEL); | 694 | &tgt->cq_dma, GFP_KERNEL); |
@@ -699,7 +701,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
699 | 701 | ||
700 | /* Allocate and map RQ and RQ PBL */ | 702 | /* Allocate and map RQ and RQ PBL */ |
701 | tgt->rq_mem_size = tgt->max_rqes * BNX2FC_RQ_WQE_SIZE; | 703 | tgt->rq_mem_size = tgt->max_rqes * BNX2FC_RQ_WQE_SIZE; |
702 | tgt->rq_mem_size = (tgt->rq_mem_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 704 | tgt->rq_mem_size = (tgt->rq_mem_size + (CNIC_PAGE_SIZE - 1)) & |
705 | CNIC_PAGE_MASK; | ||
703 | 706 | ||
704 | tgt->rq = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size, | 707 | tgt->rq = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size, |
705 | &tgt->rq_dma, GFP_KERNEL); | 708 | &tgt->rq_dma, GFP_KERNEL); |
@@ -710,8 +713,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
710 | } | 713 | } |
711 | memset(tgt->rq, 0, tgt->rq_mem_size); | 714 | memset(tgt->rq, 0, tgt->rq_mem_size); |
712 | 715 | ||
713 | tgt->rq_pbl_size = (tgt->rq_mem_size / PAGE_SIZE) * sizeof(void *); | 716 | tgt->rq_pbl_size = (tgt->rq_mem_size / CNIC_PAGE_SIZE) * sizeof(void *); |
714 | tgt->rq_pbl_size = (tgt->rq_pbl_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 717 | tgt->rq_pbl_size = (tgt->rq_pbl_size + (CNIC_PAGE_SIZE - 1)) & |
718 | CNIC_PAGE_MASK; | ||
715 | 719 | ||
716 | tgt->rq_pbl = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size, | 720 | tgt->rq_pbl = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size, |
717 | &tgt->rq_pbl_dma, GFP_KERNEL); | 721 | &tgt->rq_pbl_dma, GFP_KERNEL); |
@@ -722,7 +726,7 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
722 | } | 726 | } |
723 | 727 | ||
724 | memset(tgt->rq_pbl, 0, tgt->rq_pbl_size); | 728 | memset(tgt->rq_pbl, 0, tgt->rq_pbl_size); |
725 | num_pages = tgt->rq_mem_size / PAGE_SIZE; | 729 | num_pages = tgt->rq_mem_size / CNIC_PAGE_SIZE; |
726 | page = tgt->rq_dma; | 730 | page = tgt->rq_dma; |
727 | pbl = (u32 *)tgt->rq_pbl; | 731 | pbl = (u32 *)tgt->rq_pbl; |
728 | 732 | ||
@@ -731,13 +735,13 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
731 | pbl++; | 735 | pbl++; |
732 | *pbl = (u32)((u64)page >> 32); | 736 | *pbl = (u32)((u64)page >> 32); |
733 | pbl++; | 737 | pbl++; |
734 | page += PAGE_SIZE; | 738 | page += CNIC_PAGE_SIZE; |
735 | } | 739 | } |
736 | 740 | ||
737 | /* Allocate and map XFERQ */ | 741 | /* Allocate and map XFERQ */ |
738 | tgt->xferq_mem_size = tgt->max_sqes * BNX2FC_XFERQ_WQE_SIZE; | 742 | tgt->xferq_mem_size = tgt->max_sqes * BNX2FC_XFERQ_WQE_SIZE; |
739 | tgt->xferq_mem_size = (tgt->xferq_mem_size + (PAGE_SIZE - 1)) & | 743 | tgt->xferq_mem_size = (tgt->xferq_mem_size + (CNIC_PAGE_SIZE - 1)) & |
740 | PAGE_MASK; | 744 | CNIC_PAGE_MASK; |
741 | 745 | ||
742 | tgt->xferq = dma_alloc_coherent(&hba->pcidev->dev, tgt->xferq_mem_size, | 746 | tgt->xferq = dma_alloc_coherent(&hba->pcidev->dev, tgt->xferq_mem_size, |
743 | &tgt->xferq_dma, GFP_KERNEL); | 747 | &tgt->xferq_dma, GFP_KERNEL); |
@@ -750,8 +754,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
750 | 754 | ||
751 | /* Allocate and map CONFQ & CONFQ PBL */ | 755 | /* Allocate and map CONFQ & CONFQ PBL */ |
752 | tgt->confq_mem_size = tgt->max_sqes * BNX2FC_CONFQ_WQE_SIZE; | 756 | tgt->confq_mem_size = tgt->max_sqes * BNX2FC_CONFQ_WQE_SIZE; |
753 | tgt->confq_mem_size = (tgt->confq_mem_size + (PAGE_SIZE - 1)) & | 757 | tgt->confq_mem_size = (tgt->confq_mem_size + (CNIC_PAGE_SIZE - 1)) & |
754 | PAGE_MASK; | 758 | CNIC_PAGE_MASK; |
755 | 759 | ||
756 | tgt->confq = dma_alloc_coherent(&hba->pcidev->dev, tgt->confq_mem_size, | 760 | tgt->confq = dma_alloc_coherent(&hba->pcidev->dev, tgt->confq_mem_size, |
757 | &tgt->confq_dma, GFP_KERNEL); | 761 | &tgt->confq_dma, GFP_KERNEL); |
@@ -763,9 +767,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
763 | memset(tgt->confq, 0, tgt->confq_mem_size); | 767 | memset(tgt->confq, 0, tgt->confq_mem_size); |
764 | 768 | ||
765 | tgt->confq_pbl_size = | 769 | tgt->confq_pbl_size = |
766 | (tgt->confq_mem_size / PAGE_SIZE) * sizeof(void *); | 770 | (tgt->confq_mem_size / CNIC_PAGE_SIZE) * sizeof(void *); |
767 | tgt->confq_pbl_size = | 771 | tgt->confq_pbl_size = |
768 | (tgt->confq_pbl_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 772 | (tgt->confq_pbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; |
769 | 773 | ||
770 | tgt->confq_pbl = dma_alloc_coherent(&hba->pcidev->dev, | 774 | tgt->confq_pbl = dma_alloc_coherent(&hba->pcidev->dev, |
771 | tgt->confq_pbl_size, | 775 | tgt->confq_pbl_size, |
@@ -777,7 +781,7 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
777 | } | 781 | } |
778 | 782 | ||
779 | memset(tgt->confq_pbl, 0, tgt->confq_pbl_size); | 783 | memset(tgt->confq_pbl, 0, tgt->confq_pbl_size); |
780 | num_pages = tgt->confq_mem_size / PAGE_SIZE; | 784 | num_pages = tgt->confq_mem_size / CNIC_PAGE_SIZE; |
781 | page = tgt->confq_dma; | 785 | page = tgt->confq_dma; |
782 | pbl = (u32 *)tgt->confq_pbl; | 786 | pbl = (u32 *)tgt->confq_pbl; |
783 | 787 | ||
@@ -786,7 +790,7 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
786 | pbl++; | 790 | pbl++; |
787 | *pbl = (u32)((u64)page >> 32); | 791 | *pbl = (u32)((u64)page >> 32); |
788 | pbl++; | 792 | pbl++; |
789 | page += PAGE_SIZE; | 793 | page += CNIC_PAGE_SIZE; |
790 | } | 794 | } |
791 | 795 | ||
792 | /* Allocate and map ConnDB */ | 796 | /* Allocate and map ConnDB */ |
@@ -805,8 +809,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
805 | 809 | ||
806 | /* Allocate and map LCQ */ | 810 | /* Allocate and map LCQ */ |
807 | tgt->lcq_mem_size = (tgt->max_sqes + 8) * BNX2FC_SQ_WQE_SIZE; | 811 | tgt->lcq_mem_size = (tgt->max_sqes + 8) * BNX2FC_SQ_WQE_SIZE; |
808 | tgt->lcq_mem_size = (tgt->lcq_mem_size + (PAGE_SIZE - 1)) & | 812 | tgt->lcq_mem_size = (tgt->lcq_mem_size + (CNIC_PAGE_SIZE - 1)) & |
809 | PAGE_MASK; | 813 | CNIC_PAGE_MASK; |
810 | 814 | ||
811 | tgt->lcq = dma_alloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size, | 815 | tgt->lcq = dma_alloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size, |
812 | &tgt->lcq_dma, GFP_KERNEL); | 816 | &tgt->lcq_dma, GFP_KERNEL); |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index e4cf23df4b4f..b87a1933f880 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
@@ -61,7 +61,7 @@ static void bnx2i_adjust_qp_size(struct bnx2i_hba *hba) | |||
61 | * yield integral num of page buffers | 61 | * yield integral num of page buffers |
62 | */ | 62 | */ |
63 | /* adjust SQ */ | 63 | /* adjust SQ */ |
64 | num_elements_per_pg = PAGE_SIZE / BNX2I_SQ_WQE_SIZE; | 64 | num_elements_per_pg = CNIC_PAGE_SIZE / BNX2I_SQ_WQE_SIZE; |
65 | if (hba->max_sqes < num_elements_per_pg) | 65 | if (hba->max_sqes < num_elements_per_pg) |
66 | hba->max_sqes = num_elements_per_pg; | 66 | hba->max_sqes = num_elements_per_pg; |
67 | else if (hba->max_sqes % num_elements_per_pg) | 67 | else if (hba->max_sqes % num_elements_per_pg) |
@@ -69,7 +69,7 @@ static void bnx2i_adjust_qp_size(struct bnx2i_hba *hba) | |||
69 | ~(num_elements_per_pg - 1); | 69 | ~(num_elements_per_pg - 1); |
70 | 70 | ||
71 | /* adjust CQ */ | 71 | /* adjust CQ */ |
72 | num_elements_per_pg = PAGE_SIZE / BNX2I_CQE_SIZE; | 72 | num_elements_per_pg = CNIC_PAGE_SIZE / BNX2I_CQE_SIZE; |
73 | if (hba->max_cqes < num_elements_per_pg) | 73 | if (hba->max_cqes < num_elements_per_pg) |
74 | hba->max_cqes = num_elements_per_pg; | 74 | hba->max_cqes = num_elements_per_pg; |
75 | else if (hba->max_cqes % num_elements_per_pg) | 75 | else if (hba->max_cqes % num_elements_per_pg) |
@@ -77,7 +77,7 @@ static void bnx2i_adjust_qp_size(struct bnx2i_hba *hba) | |||
77 | ~(num_elements_per_pg - 1); | 77 | ~(num_elements_per_pg - 1); |
78 | 78 | ||
79 | /* adjust RQ */ | 79 | /* adjust RQ */ |
80 | num_elements_per_pg = PAGE_SIZE / BNX2I_RQ_WQE_SIZE; | 80 | num_elements_per_pg = CNIC_PAGE_SIZE / BNX2I_RQ_WQE_SIZE; |
81 | if (hba->max_rqes < num_elements_per_pg) | 81 | if (hba->max_rqes < num_elements_per_pg) |
82 | hba->max_rqes = num_elements_per_pg; | 82 | hba->max_rqes = num_elements_per_pg; |
83 | else if (hba->max_rqes % num_elements_per_pg) | 83 | else if (hba->max_rqes % num_elements_per_pg) |
@@ -959,7 +959,7 @@ static void setup_qp_page_tables(struct bnx2i_endpoint *ep) | |||
959 | 959 | ||
960 | /* SQ page table */ | 960 | /* SQ page table */ |
961 | memset(ep->qp.sq_pgtbl_virt, 0, ep->qp.sq_pgtbl_size); | 961 | memset(ep->qp.sq_pgtbl_virt, 0, ep->qp.sq_pgtbl_size); |
962 | num_pages = ep->qp.sq_mem_size / PAGE_SIZE; | 962 | num_pages = ep->qp.sq_mem_size / CNIC_PAGE_SIZE; |
963 | page = ep->qp.sq_phys; | 963 | page = ep->qp.sq_phys; |
964 | 964 | ||
965 | if (cnic_dev_10g) | 965 | if (cnic_dev_10g) |
@@ -973,7 +973,7 @@ static void setup_qp_page_tables(struct bnx2i_endpoint *ep) | |||
973 | ptbl++; | 973 | ptbl++; |
974 | *ptbl = (u32) ((u64) page >> 32); | 974 | *ptbl = (u32) ((u64) page >> 32); |
975 | ptbl++; | 975 | ptbl++; |
976 | page += PAGE_SIZE; | 976 | page += CNIC_PAGE_SIZE; |
977 | } else { | 977 | } else { |
978 | /* PTE is written in big endian format for | 978 | /* PTE is written in big endian format for |
979 | * 5706/5708/5709 devices */ | 979 | * 5706/5708/5709 devices */ |
@@ -981,13 +981,13 @@ static void setup_qp_page_tables(struct bnx2i_endpoint *ep) | |||
981 | ptbl++; | 981 | ptbl++; |
982 | *ptbl = (u32) page; | 982 | *ptbl = (u32) page; |
983 | ptbl++; | 983 | ptbl++; |
984 | page += PAGE_SIZE; | 984 | page += CNIC_PAGE_SIZE; |
985 | } | 985 | } |
986 | } | 986 | } |
987 | 987 | ||
988 | /* RQ page table */ | 988 | /* RQ page table */ |
989 | memset(ep->qp.rq_pgtbl_virt, 0, ep->qp.rq_pgtbl_size); | 989 | memset(ep->qp.rq_pgtbl_virt, 0, ep->qp.rq_pgtbl_size); |
990 | num_pages = ep->qp.rq_mem_size / PAGE_SIZE; | 990 | num_pages = ep->qp.rq_mem_size / CNIC_PAGE_SIZE; |
991 | page = ep->qp.rq_phys; | 991 | page = ep->qp.rq_phys; |
992 | 992 | ||
993 | if (cnic_dev_10g) | 993 | if (cnic_dev_10g) |
@@ -1001,7 +1001,7 @@ static void setup_qp_page_tables(struct bnx2i_endpoint *ep) | |||
1001 | ptbl++; | 1001 | ptbl++; |
1002 | *ptbl = (u32) ((u64) page >> 32); | 1002 | *ptbl = (u32) ((u64) page >> 32); |
1003 | ptbl++; | 1003 | ptbl++; |
1004 | page += PAGE_SIZE; | 1004 | page += CNIC_PAGE_SIZE; |
1005 | } else { | 1005 | } else { |
1006 | /* PTE is written in big endian format for | 1006 | /* PTE is written in big endian format for |
1007 | * 5706/5708/5709 devices */ | 1007 | * 5706/5708/5709 devices */ |
@@ -1009,13 +1009,13 @@ static void setup_qp_page_tables(struct bnx2i_endpoint *ep) | |||
1009 | ptbl++; | 1009 | ptbl++; |
1010 | *ptbl = (u32) page; | 1010 | *ptbl = (u32) page; |
1011 | ptbl++; | 1011 | ptbl++; |
1012 | page += PAGE_SIZE; | 1012 | page += CNIC_PAGE_SIZE; |
1013 | } | 1013 | } |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | /* CQ page table */ | 1016 | /* CQ page table */ |
1017 | memset(ep->qp.cq_pgtbl_virt, 0, ep->qp.cq_pgtbl_size); | 1017 | memset(ep->qp.cq_pgtbl_virt, 0, ep->qp.cq_pgtbl_size); |
1018 | num_pages = ep->qp.cq_mem_size / PAGE_SIZE; | 1018 | num_pages = ep->qp.cq_mem_size / CNIC_PAGE_SIZE; |
1019 | page = ep->qp.cq_phys; | 1019 | page = ep->qp.cq_phys; |
1020 | 1020 | ||
1021 | if (cnic_dev_10g) | 1021 | if (cnic_dev_10g) |
@@ -1029,7 +1029,7 @@ static void setup_qp_page_tables(struct bnx2i_endpoint *ep) | |||
1029 | ptbl++; | 1029 | ptbl++; |
1030 | *ptbl = (u32) ((u64) page >> 32); | 1030 | *ptbl = (u32) ((u64) page >> 32); |
1031 | ptbl++; | 1031 | ptbl++; |
1032 | page += PAGE_SIZE; | 1032 | page += CNIC_PAGE_SIZE; |
1033 | } else { | 1033 | } else { |
1034 | /* PTE is written in big endian format for | 1034 | /* PTE is written in big endian format for |
1035 | * 5706/5708/5709 devices */ | 1035 | * 5706/5708/5709 devices */ |
@@ -1037,7 +1037,7 @@ static void setup_qp_page_tables(struct bnx2i_endpoint *ep) | |||
1037 | ptbl++; | 1037 | ptbl++; |
1038 | *ptbl = (u32) page; | 1038 | *ptbl = (u32) page; |
1039 | ptbl++; | 1039 | ptbl++; |
1040 | page += PAGE_SIZE; | 1040 | page += CNIC_PAGE_SIZE; |
1041 | } | 1041 | } |
1042 | } | 1042 | } |
1043 | } | 1043 | } |
@@ -1064,11 +1064,11 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) | |||
1064 | /* Allocate page table memory for SQ which is page aligned */ | 1064 | /* Allocate page table memory for SQ which is page aligned */ |
1065 | ep->qp.sq_mem_size = hba->max_sqes * BNX2I_SQ_WQE_SIZE; | 1065 | ep->qp.sq_mem_size = hba->max_sqes * BNX2I_SQ_WQE_SIZE; |
1066 | ep->qp.sq_mem_size = | 1066 | ep->qp.sq_mem_size = |
1067 | (ep->qp.sq_mem_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 1067 | (ep->qp.sq_mem_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; |
1068 | ep->qp.sq_pgtbl_size = | 1068 | ep->qp.sq_pgtbl_size = |
1069 | (ep->qp.sq_mem_size / PAGE_SIZE) * sizeof(void *); | 1069 | (ep->qp.sq_mem_size / CNIC_PAGE_SIZE) * sizeof(void *); |
1070 | ep->qp.sq_pgtbl_size = | 1070 | ep->qp.sq_pgtbl_size = |
1071 | (ep->qp.sq_pgtbl_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 1071 | (ep->qp.sq_pgtbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; |
1072 | 1072 | ||
1073 | ep->qp.sq_pgtbl_virt = | 1073 | ep->qp.sq_pgtbl_virt = |
1074 | dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_pgtbl_size, | 1074 | dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_pgtbl_size, |
@@ -1101,11 +1101,11 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) | |||
1101 | /* Allocate page table memory for CQ which is page aligned */ | 1101 | /* Allocate page table memory for CQ which is page aligned */ |
1102 | ep->qp.cq_mem_size = hba->max_cqes * BNX2I_CQE_SIZE; | 1102 | ep->qp.cq_mem_size = hba->max_cqes * BNX2I_CQE_SIZE; |
1103 | ep->qp.cq_mem_size = | 1103 | ep->qp.cq_mem_size = |
1104 | (ep->qp.cq_mem_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 1104 | (ep->qp.cq_mem_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; |
1105 | ep->qp.cq_pgtbl_size = | 1105 | ep->qp.cq_pgtbl_size = |
1106 | (ep->qp.cq_mem_size / PAGE_SIZE) * sizeof(void *); | 1106 | (ep->qp.cq_mem_size / CNIC_PAGE_SIZE) * sizeof(void *); |
1107 | ep->qp.cq_pgtbl_size = | 1107 | ep->qp.cq_pgtbl_size = |
1108 | (ep->qp.cq_pgtbl_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 1108 | (ep->qp.cq_pgtbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; |
1109 | 1109 | ||
1110 | ep->qp.cq_pgtbl_virt = | 1110 | ep->qp.cq_pgtbl_virt = |
1111 | dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_pgtbl_size, | 1111 | dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_pgtbl_size, |
@@ -1144,11 +1144,11 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) | |||
1144 | /* Allocate page table memory for RQ which is page aligned */ | 1144 | /* Allocate page table memory for RQ which is page aligned */ |
1145 | ep->qp.rq_mem_size = hba->max_rqes * BNX2I_RQ_WQE_SIZE; | 1145 | ep->qp.rq_mem_size = hba->max_rqes * BNX2I_RQ_WQE_SIZE; |
1146 | ep->qp.rq_mem_size = | 1146 | ep->qp.rq_mem_size = |
1147 | (ep->qp.rq_mem_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 1147 | (ep->qp.rq_mem_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; |
1148 | ep->qp.rq_pgtbl_size = | 1148 | ep->qp.rq_pgtbl_size = |
1149 | (ep->qp.rq_mem_size / PAGE_SIZE) * sizeof(void *); | 1149 | (ep->qp.rq_mem_size / CNIC_PAGE_SIZE) * sizeof(void *); |
1150 | ep->qp.rq_pgtbl_size = | 1150 | ep->qp.rq_pgtbl_size = |
1151 | (ep->qp.rq_pgtbl_size + (PAGE_SIZE - 1)) & PAGE_MASK; | 1151 | (ep->qp.rq_pgtbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; |
1152 | 1152 | ||
1153 | ep->qp.rq_pgtbl_virt = | 1153 | ep->qp.rq_pgtbl_virt = |
1154 | dma_alloc_coherent(&hba->pcidev->dev, ep->qp.rq_pgtbl_size, | 1154 | dma_alloc_coherent(&hba->pcidev->dev, ep->qp.rq_pgtbl_size, |
@@ -1270,7 +1270,7 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba) | |||
1270 | bnx2i_adjust_qp_size(hba); | 1270 | bnx2i_adjust_qp_size(hba); |
1271 | 1271 | ||
1272 | iscsi_init.flags = | 1272 | iscsi_init.flags = |
1273 | ISCSI_PAGE_SIZE_4K << ISCSI_KWQE_INIT1_PAGE_SIZE_SHIFT; | 1273 | (CNIC_PAGE_BITS - 8) << ISCSI_KWQE_INIT1_PAGE_SIZE_SHIFT; |
1274 | if (en_tcp_dack) | 1274 | if (en_tcp_dack) |
1275 | iscsi_init.flags |= ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE; | 1275 | iscsi_init.flags |= ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE; |
1276 | iscsi_init.reserved0 = 0; | 1276 | iscsi_init.reserved0 = 0; |
@@ -1288,15 +1288,15 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba) | |||
1288 | ((hba->num_ccell & 0xFFFF) | (hba->max_sqes << 16)); | 1288 | ((hba->num_ccell & 0xFFFF) | (hba->max_sqes << 16)); |
1289 | iscsi_init.num_ccells_per_conn = hba->num_ccell; | 1289 | iscsi_init.num_ccells_per_conn = hba->num_ccell; |
1290 | iscsi_init.num_tasks_per_conn = hba->max_sqes; | 1290 | iscsi_init.num_tasks_per_conn = hba->max_sqes; |
1291 | iscsi_init.sq_wqes_per_page = PAGE_SIZE / BNX2I_SQ_WQE_SIZE; | 1291 | iscsi_init.sq_wqes_per_page = CNIC_PAGE_SIZE / BNX2I_SQ_WQE_SIZE; |
1292 | iscsi_init.sq_num_wqes = hba->max_sqes; | 1292 | iscsi_init.sq_num_wqes = hba->max_sqes; |
1293 | iscsi_init.cq_log_wqes_per_page = | 1293 | iscsi_init.cq_log_wqes_per_page = |
1294 | (u8) bnx2i_power_of2(PAGE_SIZE / BNX2I_CQE_SIZE); | 1294 | (u8) bnx2i_power_of2(CNIC_PAGE_SIZE / BNX2I_CQE_SIZE); |
1295 | iscsi_init.cq_num_wqes = hba->max_cqes; | 1295 | iscsi_init.cq_num_wqes = hba->max_cqes; |
1296 | iscsi_init.cq_num_pages = (hba->max_cqes * BNX2I_CQE_SIZE + | 1296 | iscsi_init.cq_num_pages = (hba->max_cqes * BNX2I_CQE_SIZE + |
1297 | (PAGE_SIZE - 1)) / PAGE_SIZE; | 1297 | (CNIC_PAGE_SIZE - 1)) / CNIC_PAGE_SIZE; |
1298 | iscsi_init.sq_num_pages = (hba->max_sqes * BNX2I_SQ_WQE_SIZE + | 1298 | iscsi_init.sq_num_pages = (hba->max_sqes * BNX2I_SQ_WQE_SIZE + |
1299 | (PAGE_SIZE - 1)) / PAGE_SIZE; | 1299 | (CNIC_PAGE_SIZE - 1)) / CNIC_PAGE_SIZE; |
1300 | iscsi_init.rq_buffer_size = BNX2I_RQ_WQE_SIZE; | 1300 | iscsi_init.rq_buffer_size = BNX2I_RQ_WQE_SIZE; |
1301 | iscsi_init.rq_num_wqes = hba->max_rqes; | 1301 | iscsi_init.rq_num_wqes = hba->max_rqes; |
1302 | 1302 | ||
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 854dad7d5b03..c8b0aff5bbd4 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c | |||
@@ -525,7 +525,7 @@ static int bnx2i_setup_mp_bdt(struct bnx2i_hba *hba) | |||
525 | struct iscsi_bd *mp_bdt; | 525 | struct iscsi_bd *mp_bdt; |
526 | u64 addr; | 526 | u64 addr; |
527 | 527 | ||
528 | hba->mp_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, | 528 | hba->mp_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
529 | &hba->mp_bd_dma, GFP_KERNEL); | 529 | &hba->mp_bd_dma, GFP_KERNEL); |
530 | if (!hba->mp_bd_tbl) { | 530 | if (!hba->mp_bd_tbl) { |
531 | printk(KERN_ERR "unable to allocate Middle Path BDT\n"); | 531 | printk(KERN_ERR "unable to allocate Middle Path BDT\n"); |
@@ -533,11 +533,12 @@ static int bnx2i_setup_mp_bdt(struct bnx2i_hba *hba) | |||
533 | goto out; | 533 | goto out; |
534 | } | 534 | } |
535 | 535 | ||
536 | hba->dummy_buffer = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, | 536 | hba->dummy_buffer = dma_alloc_coherent(&hba->pcidev->dev, |
537 | CNIC_PAGE_SIZE, | ||
537 | &hba->dummy_buf_dma, GFP_KERNEL); | 538 | &hba->dummy_buf_dma, GFP_KERNEL); |
538 | if (!hba->dummy_buffer) { | 539 | if (!hba->dummy_buffer) { |
539 | printk(KERN_ERR "unable to alloc Middle Path Dummy Buffer\n"); | 540 | printk(KERN_ERR "unable to alloc Middle Path Dummy Buffer\n"); |
540 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 541 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
541 | hba->mp_bd_tbl, hba->mp_bd_dma); | 542 | hba->mp_bd_tbl, hba->mp_bd_dma); |
542 | hba->mp_bd_tbl = NULL; | 543 | hba->mp_bd_tbl = NULL; |
543 | rc = -1; | 544 | rc = -1; |
@@ -548,7 +549,7 @@ static int bnx2i_setup_mp_bdt(struct bnx2i_hba *hba) | |||
548 | addr = (unsigned long) hba->dummy_buf_dma; | 549 | addr = (unsigned long) hba->dummy_buf_dma; |
549 | mp_bdt->buffer_addr_lo = addr & 0xffffffff; | 550 | mp_bdt->buffer_addr_lo = addr & 0xffffffff; |
550 | mp_bdt->buffer_addr_hi = addr >> 32; | 551 | mp_bdt->buffer_addr_hi = addr >> 32; |
551 | mp_bdt->buffer_length = PAGE_SIZE; | 552 | mp_bdt->buffer_length = CNIC_PAGE_SIZE; |
552 | mp_bdt->flags = ISCSI_BD_LAST_IN_BD_CHAIN | | 553 | mp_bdt->flags = ISCSI_BD_LAST_IN_BD_CHAIN | |
553 | ISCSI_BD_FIRST_IN_BD_CHAIN; | 554 | ISCSI_BD_FIRST_IN_BD_CHAIN; |
554 | out: | 555 | out: |
@@ -565,12 +566,12 @@ out: | |||
565 | static void bnx2i_free_mp_bdt(struct bnx2i_hba *hba) | 566 | static void bnx2i_free_mp_bdt(struct bnx2i_hba *hba) |
566 | { | 567 | { |
567 | if (hba->mp_bd_tbl) { | 568 | if (hba->mp_bd_tbl) { |
568 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 569 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
569 | hba->mp_bd_tbl, hba->mp_bd_dma); | 570 | hba->mp_bd_tbl, hba->mp_bd_dma); |
570 | hba->mp_bd_tbl = NULL; | 571 | hba->mp_bd_tbl = NULL; |
571 | } | 572 | } |
572 | if (hba->dummy_buffer) { | 573 | if (hba->dummy_buffer) { |
573 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 574 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
574 | hba->dummy_buffer, hba->dummy_buf_dma); | 575 | hba->dummy_buffer, hba->dummy_buf_dma); |
575 | hba->dummy_buffer = NULL; | 576 | hba->dummy_buffer = NULL; |
576 | } | 577 | } |
@@ -934,14 +935,14 @@ static void bnx2i_conn_free_login_resources(struct bnx2i_hba *hba, | |||
934 | struct bnx2i_conn *bnx2i_conn) | 935 | struct bnx2i_conn *bnx2i_conn) |
935 | { | 936 | { |
936 | if (bnx2i_conn->gen_pdu.resp_bd_tbl) { | 937 | if (bnx2i_conn->gen_pdu.resp_bd_tbl) { |
937 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 938 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
938 | bnx2i_conn->gen_pdu.resp_bd_tbl, | 939 | bnx2i_conn->gen_pdu.resp_bd_tbl, |
939 | bnx2i_conn->gen_pdu.resp_bd_dma); | 940 | bnx2i_conn->gen_pdu.resp_bd_dma); |
940 | bnx2i_conn->gen_pdu.resp_bd_tbl = NULL; | 941 | bnx2i_conn->gen_pdu.resp_bd_tbl = NULL; |
941 | } | 942 | } |
942 | 943 | ||
943 | if (bnx2i_conn->gen_pdu.req_bd_tbl) { | 944 | if (bnx2i_conn->gen_pdu.req_bd_tbl) { |
944 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 945 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
945 | bnx2i_conn->gen_pdu.req_bd_tbl, | 946 | bnx2i_conn->gen_pdu.req_bd_tbl, |
946 | bnx2i_conn->gen_pdu.req_bd_dma); | 947 | bnx2i_conn->gen_pdu.req_bd_dma); |
947 | bnx2i_conn->gen_pdu.req_bd_tbl = NULL; | 948 | bnx2i_conn->gen_pdu.req_bd_tbl = NULL; |
@@ -998,13 +999,13 @@ static int bnx2i_conn_alloc_login_resources(struct bnx2i_hba *hba, | |||
998 | bnx2i_conn->gen_pdu.resp_wr_ptr = bnx2i_conn->gen_pdu.resp_buf; | 999 | bnx2i_conn->gen_pdu.resp_wr_ptr = bnx2i_conn->gen_pdu.resp_buf; |
999 | 1000 | ||
1000 | bnx2i_conn->gen_pdu.req_bd_tbl = | 1001 | bnx2i_conn->gen_pdu.req_bd_tbl = |
1001 | dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, | 1002 | dma_alloc_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
1002 | &bnx2i_conn->gen_pdu.req_bd_dma, GFP_KERNEL); | 1003 | &bnx2i_conn->gen_pdu.req_bd_dma, GFP_KERNEL); |
1003 | if (bnx2i_conn->gen_pdu.req_bd_tbl == NULL) | 1004 | if (bnx2i_conn->gen_pdu.req_bd_tbl == NULL) |
1004 | goto login_req_bd_tbl_failure; | 1005 | goto login_req_bd_tbl_failure; |
1005 | 1006 | ||
1006 | bnx2i_conn->gen_pdu.resp_bd_tbl = | 1007 | bnx2i_conn->gen_pdu.resp_bd_tbl = |
1007 | dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, | 1008 | dma_alloc_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
1008 | &bnx2i_conn->gen_pdu.resp_bd_dma, | 1009 | &bnx2i_conn->gen_pdu.resp_bd_dma, |
1009 | GFP_KERNEL); | 1010 | GFP_KERNEL); |
1010 | if (bnx2i_conn->gen_pdu.resp_bd_tbl == NULL) | 1011 | if (bnx2i_conn->gen_pdu.resp_bd_tbl == NULL) |
@@ -1013,7 +1014,7 @@ static int bnx2i_conn_alloc_login_resources(struct bnx2i_hba *hba, | |||
1013 | return 0; | 1014 | return 0; |
1014 | 1015 | ||
1015 | login_resp_bd_tbl_failure: | 1016 | login_resp_bd_tbl_failure: |
1016 | dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, | 1017 | dma_free_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
1017 | bnx2i_conn->gen_pdu.req_bd_tbl, | 1018 | bnx2i_conn->gen_pdu.req_bd_tbl, |
1018 | bnx2i_conn->gen_pdu.req_bd_dma); | 1019 | bnx2i_conn->gen_pdu.req_bd_dma); |
1019 | bnx2i_conn->gen_pdu.req_bd_tbl = NULL; | 1020 | bnx2i_conn->gen_pdu.req_bd_tbl = NULL; |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index 4911310a38f5..22a9bb1abae1 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
@@ -311,9 +311,8 @@ static inline struct Scsi_Host *to_shost(struct isci_host *ihost) | |||
311 | } | 311 | } |
312 | 312 | ||
313 | #define for_each_isci_host(id, ihost, pdev) \ | 313 | #define for_each_isci_host(id, ihost, pdev) \ |
314 | for (id = 0, ihost = to_pci_info(pdev)->hosts[id]; \ | 314 | for (id = 0; id < SCI_MAX_CONTROLLERS && \ |
315 | id < ARRAY_SIZE(to_pci_info(pdev)->hosts) && ihost; \ | 315 | (ihost = to_pci_info(pdev)->hosts[id]); id++) |
316 | ihost = to_pci_info(pdev)->hosts[++id]) | ||
317 | 316 | ||
318 | static inline void wait_for_start(struct isci_host *ihost) | 317 | static inline void wait_for_start(struct isci_host *ihost) |
319 | { | 318 | { |
diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c index 85c77f6b802b..ac879745ef80 100644 --- a/drivers/scsi/isci/port_config.c +++ b/drivers/scsi/isci/port_config.c | |||
@@ -615,13 +615,6 @@ static void sci_apc_agent_link_up(struct isci_host *ihost, | |||
615 | SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION); | 615 | SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION); |
616 | } else { | 616 | } else { |
617 | /* the phy is already the part of the port */ | 617 | /* the phy is already the part of the port */ |
618 | u32 port_state = iport->sm.current_state_id; | ||
619 | |||
620 | /* if the PORT'S state is resetting then the link up is from | ||
621 | * port hard reset in this case, we need to tell the port | ||
622 | * that link up is recieved | ||
623 | */ | ||
624 | BUG_ON(port_state != SCI_PORT_RESETTING); | ||
625 | port_agent->phy_ready_mask |= 1 << phy_index; | 618 | port_agent->phy_ready_mask |= 1 << phy_index; |
626 | sci_port_link_up(iport, iphy); | 619 | sci_port_link_up(iport, iphy); |
627 | } | 620 | } |
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 0d30ca849e8f..5d6fda72d659 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c | |||
@@ -801,7 +801,7 @@ int isci_task_I_T_nexus_reset(struct domain_device *dev) | |||
801 | /* XXX: need to cleanup any ireqs targeting this | 801 | /* XXX: need to cleanup any ireqs targeting this |
802 | * domain_device | 802 | * domain_device |
803 | */ | 803 | */ |
804 | ret = TMF_RESP_FUNC_COMPLETE; | 804 | ret = -ENODEV; |
805 | goto out; | 805 | goto out; |
806 | } | 806 | } |
807 | 807 | ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index e1fe95ef23e1..266724b6b899 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2996,8 +2996,7 @@ struct qla_hw_data { | |||
2996 | IS_QLA82XX(ha) || IS_QLA83XX(ha) || \ | 2996 | IS_QLA82XX(ha) || IS_QLA83XX(ha) || \ |
2997 | IS_QLA8044(ha)) | 2997 | IS_QLA8044(ha)) |
2998 | #define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) | 2998 | #define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) |
2999 | #define IS_NOPOLLING_TYPE(ha) ((IS_QLA25XX(ha) || IS_QLA81XX(ha) || \ | 2999 | #define IS_NOPOLLING_TYPE(ha) (IS_QLA81XX(ha) && (ha)->flags.msix_enabled) |
3000 | IS_QLA83XX(ha)) && (ha)->flags.msix_enabled) | ||
3001 | #define IS_FAC_REQUIRED(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) | 3000 | #define IS_FAC_REQUIRED(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) |
3002 | #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) | 3001 | #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) |
3003 | #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) | 3002 | #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 9bc86b9e86b1..0a1dcb43d18b 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -2880,6 +2880,7 @@ static int | |||
2880 | qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) | 2880 | qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) |
2881 | { | 2881 | { |
2882 | #define MIN_MSIX_COUNT 2 | 2882 | #define MIN_MSIX_COUNT 2 |
2883 | #define ATIO_VECTOR 2 | ||
2883 | int i, ret; | 2884 | int i, ret; |
2884 | struct msix_entry *entries; | 2885 | struct msix_entry *entries; |
2885 | struct qla_msix_entry *qentry; | 2886 | struct qla_msix_entry *qentry; |
@@ -2936,34 +2937,47 @@ msix_failed: | |||
2936 | } | 2937 | } |
2937 | 2938 | ||
2938 | /* Enable MSI-X vectors for the base queue */ | 2939 | /* Enable MSI-X vectors for the base queue */ |
2939 | for (i = 0; i < ha->msix_count; i++) { | 2940 | for (i = 0; i < 2; i++) { |
2940 | qentry = &ha->msix_entries[i]; | 2941 | qentry = &ha->msix_entries[i]; |
2941 | if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) { | 2942 | if (IS_P3P_TYPE(ha)) |
2942 | ret = request_irq(qentry->vector, | ||
2943 | qla83xx_msix_entries[i].handler, | ||
2944 | 0, qla83xx_msix_entries[i].name, rsp); | ||
2945 | } else if (IS_P3P_TYPE(ha)) { | ||
2946 | ret = request_irq(qentry->vector, | 2943 | ret = request_irq(qentry->vector, |
2947 | qla82xx_msix_entries[i].handler, | 2944 | qla82xx_msix_entries[i].handler, |
2948 | 0, qla82xx_msix_entries[i].name, rsp); | 2945 | 0, qla82xx_msix_entries[i].name, rsp); |
2949 | } else { | 2946 | else |
2950 | ret = request_irq(qentry->vector, | 2947 | ret = request_irq(qentry->vector, |
2951 | msix_entries[i].handler, | 2948 | msix_entries[i].handler, |
2952 | 0, msix_entries[i].name, rsp); | 2949 | 0, msix_entries[i].name, rsp); |
2953 | } | 2950 | if (ret) |
2954 | if (ret) { | 2951 | goto msix_register_fail; |
2955 | ql_log(ql_log_fatal, vha, 0x00cb, | ||
2956 | "MSI-X: unable to register handler -- %x/%d.\n", | ||
2957 | qentry->vector, ret); | ||
2958 | qla24xx_disable_msix(ha); | ||
2959 | ha->mqenable = 0; | ||
2960 | goto msix_out; | ||
2961 | } | ||
2962 | qentry->have_irq = 1; | 2952 | qentry->have_irq = 1; |
2963 | qentry->rsp = rsp; | 2953 | qentry->rsp = rsp; |
2964 | rsp->msix = qentry; | 2954 | rsp->msix = qentry; |
2965 | } | 2955 | } |
2966 | 2956 | ||
2957 | /* | ||
2958 | * If target mode is enable, also request the vector for the ATIO | ||
2959 | * queue. | ||
2960 | */ | ||
2961 | if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) { | ||
2962 | qentry = &ha->msix_entries[ATIO_VECTOR]; | ||
2963 | ret = request_irq(qentry->vector, | ||
2964 | qla83xx_msix_entries[ATIO_VECTOR].handler, | ||
2965 | 0, qla83xx_msix_entries[ATIO_VECTOR].name, rsp); | ||
2966 | qentry->have_irq = 1; | ||
2967 | qentry->rsp = rsp; | ||
2968 | rsp->msix = qentry; | ||
2969 | } | ||
2970 | |||
2971 | msix_register_fail: | ||
2972 | if (ret) { | ||
2973 | ql_log(ql_log_fatal, vha, 0x00cb, | ||
2974 | "MSI-X: unable to register handler -- %x/%d.\n", | ||
2975 | qentry->vector, ret); | ||
2976 | qla24xx_disable_msix(ha); | ||
2977 | ha->mqenable = 0; | ||
2978 | goto msix_out; | ||
2979 | } | ||
2980 | |||
2967 | /* Enable MSI-X vector for response queue update for queue 0 */ | 2981 | /* Enable MSI-X vector for response queue update for queue 0 */ |
2968 | if (IS_QLA83XX(ha)) { | 2982 | if (IS_QLA83XX(ha)) { |
2969 | if (ha->msixbase && ha->mqiobase && | 2983 | if (ha->msixbase && ha->mqiobase && |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 2eb97d7e8d12..0cb73074c199 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -790,17 +790,32 @@ static inline int test_tgt_sess_count(struct qla_tgt *tgt) | |||
790 | } | 790 | } |
791 | 791 | ||
792 | /* Called by tcm_qla2xxx configfs code */ | 792 | /* Called by tcm_qla2xxx configfs code */ |
793 | void qlt_stop_phase1(struct qla_tgt *tgt) | 793 | int qlt_stop_phase1(struct qla_tgt *tgt) |
794 | { | 794 | { |
795 | struct scsi_qla_host *vha = tgt->vha; | 795 | struct scsi_qla_host *vha = tgt->vha; |
796 | struct qla_hw_data *ha = tgt->ha; | 796 | struct qla_hw_data *ha = tgt->ha; |
797 | unsigned long flags; | 797 | unsigned long flags; |
798 | 798 | ||
799 | mutex_lock(&qla_tgt_mutex); | ||
800 | if (!vha->fc_vport) { | ||
801 | struct Scsi_Host *sh = vha->host; | ||
802 | struct fc_host_attrs *fc_host = shost_to_fc_host(sh); | ||
803 | bool npiv_vports; | ||
804 | |||
805 | spin_lock_irqsave(sh->host_lock, flags); | ||
806 | npiv_vports = (fc_host->npiv_vports_inuse); | ||
807 | spin_unlock_irqrestore(sh->host_lock, flags); | ||
808 | |||
809 | if (npiv_vports) { | ||
810 | mutex_unlock(&qla_tgt_mutex); | ||
811 | return -EPERM; | ||
812 | } | ||
813 | } | ||
799 | if (tgt->tgt_stop || tgt->tgt_stopped) { | 814 | if (tgt->tgt_stop || tgt->tgt_stopped) { |
800 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf04e, | 815 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf04e, |
801 | "Already in tgt->tgt_stop or tgt_stopped state\n"); | 816 | "Already in tgt->tgt_stop or tgt_stopped state\n"); |
802 | dump_stack(); | 817 | mutex_unlock(&qla_tgt_mutex); |
803 | return; | 818 | return -EPERM; |
804 | } | 819 | } |
805 | 820 | ||
806 | ql_dbg(ql_dbg_tgt, vha, 0xe003, "Stopping target for host %ld(%p)\n", | 821 | ql_dbg(ql_dbg_tgt, vha, 0xe003, "Stopping target for host %ld(%p)\n", |
@@ -815,6 +830,7 @@ void qlt_stop_phase1(struct qla_tgt *tgt) | |||
815 | qlt_clear_tgt_db(tgt, true); | 830 | qlt_clear_tgt_db(tgt, true); |
816 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 831 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
817 | mutex_unlock(&vha->vha_tgt.tgt_mutex); | 832 | mutex_unlock(&vha->vha_tgt.tgt_mutex); |
833 | mutex_unlock(&qla_tgt_mutex); | ||
818 | 834 | ||
819 | flush_delayed_work(&tgt->sess_del_work); | 835 | flush_delayed_work(&tgt->sess_del_work); |
820 | 836 | ||
@@ -841,6 +857,7 @@ void qlt_stop_phase1(struct qla_tgt *tgt) | |||
841 | 857 | ||
842 | /* Wait for sessions to clear out (just in case) */ | 858 | /* Wait for sessions to clear out (just in case) */ |
843 | wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); | 859 | wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); |
860 | return 0; | ||
844 | } | 861 | } |
845 | EXPORT_SYMBOL(qlt_stop_phase1); | 862 | EXPORT_SYMBOL(qlt_stop_phase1); |
846 | 863 | ||
@@ -3185,7 +3202,8 @@ restart: | |||
3185 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c, | 3202 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c, |
3186 | "SRR cmd %p (se_cmd %p, tag %d, op %x), " | 3203 | "SRR cmd %p (se_cmd %p, tag %d, op %x), " |
3187 | "sg_cnt=%d, offset=%d", cmd, &cmd->se_cmd, cmd->tag, | 3204 | "sg_cnt=%d, offset=%d", cmd, &cmd->se_cmd, cmd->tag, |
3188 | se_cmd->t_task_cdb[0], cmd->sg_cnt, cmd->offset); | 3205 | se_cmd->t_task_cdb ? se_cmd->t_task_cdb[0] : 0, |
3206 | cmd->sg_cnt, cmd->offset); | ||
3189 | 3207 | ||
3190 | qlt_handle_srr(vha, sctio, imm); | 3208 | qlt_handle_srr(vha, sctio, imm); |
3191 | 3209 | ||
@@ -4181,6 +4199,9 @@ int qlt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha) | |||
4181 | tgt->datasegs_per_cmd = QLA_TGT_DATASEGS_PER_CMD_24XX; | 4199 | tgt->datasegs_per_cmd = QLA_TGT_DATASEGS_PER_CMD_24XX; |
4182 | tgt->datasegs_per_cont = QLA_TGT_DATASEGS_PER_CONT_24XX; | 4200 | tgt->datasegs_per_cont = QLA_TGT_DATASEGS_PER_CONT_24XX; |
4183 | 4201 | ||
4202 | if (base_vha->fc_vport) | ||
4203 | return 0; | ||
4204 | |||
4184 | mutex_lock(&qla_tgt_mutex); | 4205 | mutex_lock(&qla_tgt_mutex); |
4185 | list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist); | 4206 | list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist); |
4186 | mutex_unlock(&qla_tgt_mutex); | 4207 | mutex_unlock(&qla_tgt_mutex); |
@@ -4194,6 +4215,10 @@ int qlt_remove_target(struct qla_hw_data *ha, struct scsi_qla_host *vha) | |||
4194 | if (!vha->vha_tgt.qla_tgt) | 4215 | if (!vha->vha_tgt.qla_tgt) |
4195 | return 0; | 4216 | return 0; |
4196 | 4217 | ||
4218 | if (vha->fc_vport) { | ||
4219 | qlt_release(vha->vha_tgt.qla_tgt); | ||
4220 | return 0; | ||
4221 | } | ||
4197 | mutex_lock(&qla_tgt_mutex); | 4222 | mutex_lock(&qla_tgt_mutex); |
4198 | list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry); | 4223 | list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry); |
4199 | mutex_unlock(&qla_tgt_mutex); | 4224 | mutex_unlock(&qla_tgt_mutex); |
@@ -4265,6 +4290,12 @@ int qlt_lport_register(void *target_lport_ptr, u64 phys_wwpn, | |||
4265 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 4290 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
4266 | continue; | 4291 | continue; |
4267 | } | 4292 | } |
4293 | if (tgt->tgt_stop) { | ||
4294 | pr_debug("MODE_TARGET in shutdown on qla2xxx(%d)\n", | ||
4295 | host->host_no); | ||
4296 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
4297 | continue; | ||
4298 | } | ||
4268 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 4299 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
4269 | 4300 | ||
4270 | if (!scsi_host_get(host)) { | 4301 | if (!scsi_host_get(host)) { |
@@ -4279,12 +4310,11 @@ int qlt_lport_register(void *target_lport_ptr, u64 phys_wwpn, | |||
4279 | scsi_host_put(host); | 4310 | scsi_host_put(host); |
4280 | continue; | 4311 | continue; |
4281 | } | 4312 | } |
4282 | mutex_unlock(&qla_tgt_mutex); | ||
4283 | |||
4284 | rc = (*callback)(vha, target_lport_ptr, npiv_wwpn, npiv_wwnn); | 4313 | rc = (*callback)(vha, target_lport_ptr, npiv_wwpn, npiv_wwnn); |
4285 | if (rc != 0) | 4314 | if (rc != 0) |
4286 | scsi_host_put(host); | 4315 | scsi_host_put(host); |
4287 | 4316 | ||
4317 | mutex_unlock(&qla_tgt_mutex); | ||
4288 | return rc; | 4318 | return rc; |
4289 | } | 4319 | } |
4290 | mutex_unlock(&qla_tgt_mutex); | 4320 | mutex_unlock(&qla_tgt_mutex); |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 66e755cdde57..ce33d8c26406 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -1001,7 +1001,7 @@ extern void qlt_modify_vp_config(struct scsi_qla_host *, | |||
1001 | extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *); | 1001 | extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *); |
1002 | extern int qlt_mem_alloc(struct qla_hw_data *); | 1002 | extern int qlt_mem_alloc(struct qla_hw_data *); |
1003 | extern void qlt_mem_free(struct qla_hw_data *); | 1003 | extern void qlt_mem_free(struct qla_hw_data *); |
1004 | extern void qlt_stop_phase1(struct qla_tgt *); | 1004 | extern int qlt_stop_phase1(struct qla_tgt *); |
1005 | extern void qlt_stop_phase2(struct qla_tgt *); | 1005 | extern void qlt_stop_phase2(struct qla_tgt *); |
1006 | extern irqreturn_t qla83xx_msix_atio_q(int, void *); | 1006 | extern irqreturn_t qla83xx_msix_atio_q(int, void *); |
1007 | extern void qlt_83xx_iospace_config(struct qla_hw_data *); | 1007 | extern void qlt_83xx_iospace_config(struct qla_hw_data *); |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 75a141bbe74d..788c4fe2b0c9 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -182,20 +182,6 @@ static int tcm_qla2xxx_npiv_parse_wwn( | |||
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
184 | 184 | ||
185 | static ssize_t tcm_qla2xxx_npiv_format_wwn(char *buf, size_t len, | ||
186 | u64 wwpn, u64 wwnn) | ||
187 | { | ||
188 | u8 b[8], b2[8]; | ||
189 | |||
190 | put_unaligned_be64(wwpn, b); | ||
191 | put_unaligned_be64(wwnn, b2); | ||
192 | return snprintf(buf, len, | ||
193 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x," | ||
194 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", | ||
195 | b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], | ||
196 | b2[0], b2[1], b2[2], b2[3], b2[4], b2[5], b2[6], b2[7]); | ||
197 | } | ||
198 | |||
199 | static char *tcm_qla2xxx_npiv_get_fabric_name(void) | 185 | static char *tcm_qla2xxx_npiv_get_fabric_name(void) |
200 | { | 186 | { |
201 | return "qla2xxx_npiv"; | 187 | return "qla2xxx_npiv"; |
@@ -227,15 +213,6 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) | |||
227 | return lport->lport_naa_name; | 213 | return lport->lport_naa_name; |
228 | } | 214 | } |
229 | 215 | ||
230 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) | ||
231 | { | ||
232 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | ||
233 | struct tcm_qla2xxx_tpg, se_tpg); | ||
234 | struct tcm_qla2xxx_lport *lport = tpg->lport; | ||
235 | |||
236 | return &lport->lport_npiv_name[0]; | ||
237 | } | ||
238 | |||
239 | static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg) | 216 | static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg) |
240 | { | 217 | { |
241 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 218 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
@@ -941,15 +918,41 @@ static ssize_t tcm_qla2xxx_tpg_show_enable( | |||
941 | atomic_read(&tpg->lport_tpg_enabled)); | 918 | atomic_read(&tpg->lport_tpg_enabled)); |
942 | } | 919 | } |
943 | 920 | ||
921 | static void tcm_qla2xxx_depend_tpg(struct work_struct *work) | ||
922 | { | ||
923 | struct tcm_qla2xxx_tpg *base_tpg = container_of(work, | ||
924 | struct tcm_qla2xxx_tpg, tpg_base_work); | ||
925 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | ||
926 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | ||
927 | |||
928 | if (!configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
929 | &se_tpg->tpg_group.cg_item)) { | ||
930 | atomic_set(&base_tpg->lport_tpg_enabled, 1); | ||
931 | qlt_enable_vha(base_vha); | ||
932 | } | ||
933 | complete(&base_tpg->tpg_base_comp); | ||
934 | } | ||
935 | |||
936 | static void tcm_qla2xxx_undepend_tpg(struct work_struct *work) | ||
937 | { | ||
938 | struct tcm_qla2xxx_tpg *base_tpg = container_of(work, | ||
939 | struct tcm_qla2xxx_tpg, tpg_base_work); | ||
940 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | ||
941 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | ||
942 | |||
943 | if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) { | ||
944 | atomic_set(&base_tpg->lport_tpg_enabled, 0); | ||
945 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
946 | &se_tpg->tpg_group.cg_item); | ||
947 | } | ||
948 | complete(&base_tpg->tpg_base_comp); | ||
949 | } | ||
950 | |||
944 | static ssize_t tcm_qla2xxx_tpg_store_enable( | 951 | static ssize_t tcm_qla2xxx_tpg_store_enable( |
945 | struct se_portal_group *se_tpg, | 952 | struct se_portal_group *se_tpg, |
946 | const char *page, | 953 | const char *page, |
947 | size_t count) | 954 | size_t count) |
948 | { | 955 | { |
949 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | ||
950 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | ||
951 | struct tcm_qla2xxx_lport, lport_wwn); | ||
952 | struct scsi_qla_host *vha = lport->qla_vha; | ||
953 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 956 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
954 | struct tcm_qla2xxx_tpg, se_tpg); | 957 | struct tcm_qla2xxx_tpg, se_tpg); |
955 | unsigned long op; | 958 | unsigned long op; |
@@ -964,19 +967,28 @@ static ssize_t tcm_qla2xxx_tpg_store_enable( | |||
964 | pr_err("Illegal value for tpg_enable: %lu\n", op); | 967 | pr_err("Illegal value for tpg_enable: %lu\n", op); |
965 | return -EINVAL; | 968 | return -EINVAL; |
966 | } | 969 | } |
967 | |||
968 | if (op) { | 970 | if (op) { |
969 | atomic_set(&tpg->lport_tpg_enabled, 1); | 971 | if (atomic_read(&tpg->lport_tpg_enabled)) |
970 | qlt_enable_vha(vha); | 972 | return -EEXIST; |
973 | |||
974 | INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_depend_tpg); | ||
971 | } else { | 975 | } else { |
972 | if (!vha->vha_tgt.qla_tgt) { | 976 | if (!atomic_read(&tpg->lport_tpg_enabled)) |
973 | pr_err("struct qla_hw_data *vha->vha_tgt.qla_tgt is NULL\n"); | 977 | return count; |
974 | return -ENODEV; | 978 | |
975 | } | 979 | INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_undepend_tpg); |
976 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
977 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
978 | } | 980 | } |
981 | init_completion(&tpg->tpg_base_comp); | ||
982 | schedule_work(&tpg->tpg_base_work); | ||
983 | wait_for_completion(&tpg->tpg_base_comp); | ||
979 | 984 | ||
985 | if (op) { | ||
986 | if (!atomic_read(&tpg->lport_tpg_enabled)) | ||
987 | return -ENODEV; | ||
988 | } else { | ||
989 | if (atomic_read(&tpg->lport_tpg_enabled)) | ||
990 | return -EPERM; | ||
991 | } | ||
980 | return count; | 992 | return count; |
981 | } | 993 | } |
982 | 994 | ||
@@ -1053,11 +1065,64 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg) | |||
1053 | /* | 1065 | /* |
1054 | * Clear local TPG=1 pointer for non NPIV mode. | 1066 | * Clear local TPG=1 pointer for non NPIV mode. |
1055 | */ | 1067 | */ |
1056 | lport->tpg_1 = NULL; | 1068 | lport->tpg_1 = NULL; |
1057 | |||
1058 | kfree(tpg); | 1069 | kfree(tpg); |
1059 | } | 1070 | } |
1060 | 1071 | ||
1072 | static ssize_t tcm_qla2xxx_npiv_tpg_show_enable( | ||
1073 | struct se_portal_group *se_tpg, | ||
1074 | char *page) | ||
1075 | { | ||
1076 | return tcm_qla2xxx_tpg_show_enable(se_tpg, page); | ||
1077 | } | ||
1078 | |||
1079 | static ssize_t tcm_qla2xxx_npiv_tpg_store_enable( | ||
1080 | struct se_portal_group *se_tpg, | ||
1081 | const char *page, | ||
1082 | size_t count) | ||
1083 | { | ||
1084 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | ||
1085 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | ||
1086 | struct tcm_qla2xxx_lport, lport_wwn); | ||
1087 | struct scsi_qla_host *vha = lport->qla_vha; | ||
1088 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | ||
1089 | struct tcm_qla2xxx_tpg, se_tpg); | ||
1090 | unsigned long op; | ||
1091 | int rc; | ||
1092 | |||
1093 | rc = kstrtoul(page, 0, &op); | ||
1094 | if (rc < 0) { | ||
1095 | pr_err("kstrtoul() returned %d\n", rc); | ||
1096 | return -EINVAL; | ||
1097 | } | ||
1098 | if ((op != 1) && (op != 0)) { | ||
1099 | pr_err("Illegal value for tpg_enable: %lu\n", op); | ||
1100 | return -EINVAL; | ||
1101 | } | ||
1102 | if (op) { | ||
1103 | if (atomic_read(&tpg->lport_tpg_enabled)) | ||
1104 | return -EEXIST; | ||
1105 | |||
1106 | atomic_set(&tpg->lport_tpg_enabled, 1); | ||
1107 | qlt_enable_vha(vha); | ||
1108 | } else { | ||
1109 | if (!atomic_read(&tpg->lport_tpg_enabled)) | ||
1110 | return count; | ||
1111 | |||
1112 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
1113 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
1114 | } | ||
1115 | |||
1116 | return count; | ||
1117 | } | ||
1118 | |||
1119 | TF_TPG_BASE_ATTR(tcm_qla2xxx_npiv, enable, S_IRUGO | S_IWUSR); | ||
1120 | |||
1121 | static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = { | ||
1122 | &tcm_qla2xxx_npiv_tpg_enable.attr, | ||
1123 | NULL, | ||
1124 | }; | ||
1125 | |||
1061 | static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg( | 1126 | static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg( |
1062 | struct se_wwn *wwn, | 1127 | struct se_wwn *wwn, |
1063 | struct config_group *group, | 1128 | struct config_group *group, |
@@ -1650,6 +1715,9 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1650 | struct scsi_qla_host *npiv_vha; | 1715 | struct scsi_qla_host *npiv_vha; |
1651 | struct tcm_qla2xxx_lport *lport = | 1716 | struct tcm_qla2xxx_lport *lport = |
1652 | (struct tcm_qla2xxx_lport *)target_lport_ptr; | 1717 | (struct tcm_qla2xxx_lport *)target_lport_ptr; |
1718 | struct tcm_qla2xxx_lport *base_lport = | ||
1719 | (struct tcm_qla2xxx_lport *)base_vha->vha_tgt.target_lport_ptr; | ||
1720 | struct tcm_qla2xxx_tpg *base_tpg; | ||
1653 | struct fc_vport_identifiers vport_id; | 1721 | struct fc_vport_identifiers vport_id; |
1654 | 1722 | ||
1655 | if (!qla_tgt_mode_enabled(base_vha)) { | 1723 | if (!qla_tgt_mode_enabled(base_vha)) { |
@@ -1657,6 +1725,13 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1657 | return -EPERM; | 1725 | return -EPERM; |
1658 | } | 1726 | } |
1659 | 1727 | ||
1728 | if (!base_lport || !base_lport->tpg_1 || | ||
1729 | !atomic_read(&base_lport->tpg_1->lport_tpg_enabled)) { | ||
1730 | pr_err("qla2xxx base_lport or tpg_1 not available\n"); | ||
1731 | return -EPERM; | ||
1732 | } | ||
1733 | base_tpg = base_lport->tpg_1; | ||
1734 | |||
1660 | memset(&vport_id, 0, sizeof(vport_id)); | 1735 | memset(&vport_id, 0, sizeof(vport_id)); |
1661 | vport_id.port_name = npiv_wwpn; | 1736 | vport_id.port_name = npiv_wwpn; |
1662 | vport_id.node_name = npiv_wwnn; | 1737 | vport_id.node_name = npiv_wwnn; |
@@ -1675,7 +1750,6 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1675 | npiv_vha = (struct scsi_qla_host *)vport->dd_data; | 1750 | npiv_vha = (struct scsi_qla_host *)vport->dd_data; |
1676 | npiv_vha->vha_tgt.target_lport_ptr = target_lport_ptr; | 1751 | npiv_vha->vha_tgt.target_lport_ptr = target_lport_ptr; |
1677 | lport->qla_vha = npiv_vha; | 1752 | lport->qla_vha = npiv_vha; |
1678 | |||
1679 | scsi_host_get(npiv_vha->host); | 1753 | scsi_host_get(npiv_vha->host); |
1680 | return 0; | 1754 | return 0; |
1681 | } | 1755 | } |
@@ -1714,8 +1788,6 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport( | |||
1714 | } | 1788 | } |
1715 | lport->lport_npiv_wwpn = npiv_wwpn; | 1789 | lport->lport_npiv_wwpn = npiv_wwpn; |
1716 | lport->lport_npiv_wwnn = npiv_wwnn; | 1790 | lport->lport_npiv_wwnn = npiv_wwnn; |
1717 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], | ||
1718 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); | ||
1719 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); | 1791 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); |
1720 | 1792 | ||
1721 | ret = tcm_qla2xxx_init_lport(lport); | 1793 | ret = tcm_qla2xxx_init_lport(lport); |
@@ -1824,7 +1896,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = { | |||
1824 | static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { | 1896 | static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { |
1825 | .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, | 1897 | .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, |
1826 | .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident, | 1898 | .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident, |
1827 | .tpg_get_wwn = tcm_qla2xxx_npiv_get_fabric_wwn, | 1899 | .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn, |
1828 | .tpg_get_tag = tcm_qla2xxx_get_tag, | 1900 | .tpg_get_tag = tcm_qla2xxx_get_tag, |
1829 | .tpg_get_default_depth = tcm_qla2xxx_get_default_depth, | 1901 | .tpg_get_default_depth = tcm_qla2xxx_get_default_depth, |
1830 | .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, | 1902 | .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, |
@@ -1935,7 +2007,7 @@ static int tcm_qla2xxx_register_configfs(void) | |||
1935 | */ | 2007 | */ |
1936 | npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; | 2008 | npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; |
1937 | npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = | 2009 | npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = |
1938 | tcm_qla2xxx_tpg_attrs; | 2010 | tcm_qla2xxx_npiv_tpg_attrs; |
1939 | npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL; | 2011 | npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL; |
1940 | npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; | 2012 | npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; |
1941 | npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; | 2013 | npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 275d8b9a7a34..33aaac8c7d59 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h | |||
@@ -4,8 +4,6 @@ | |||
4 | #define TCM_QLA2XXX_VERSION "v0.1" | 4 | #define TCM_QLA2XXX_VERSION "v0.1" |
5 | /* length of ASCII WWPNs including pad */ | 5 | /* length of ASCII WWPNs including pad */ |
6 | #define TCM_QLA2XXX_NAMELEN 32 | 6 | #define TCM_QLA2XXX_NAMELEN 32 |
7 | /* lenth of ASCII NPIV 'WWPN+WWNN' including pad */ | ||
8 | #define TCM_QLA2XXX_NPIV_NAMELEN 66 | ||
9 | 7 | ||
10 | #include "qla_target.h" | 8 | #include "qla_target.h" |
11 | 9 | ||
@@ -43,6 +41,9 @@ struct tcm_qla2xxx_tpg { | |||
43 | struct tcm_qla2xxx_tpg_attrib tpg_attrib; | 41 | struct tcm_qla2xxx_tpg_attrib tpg_attrib; |
44 | /* Returned by tcm_qla2xxx_make_tpg() */ | 42 | /* Returned by tcm_qla2xxx_make_tpg() */ |
45 | struct se_portal_group se_tpg; | 43 | struct se_portal_group se_tpg; |
44 | /* Items for dealing with configfs_depend_item */ | ||
45 | struct completion tpg_base_comp; | ||
46 | struct work_struct tpg_base_work; | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | struct tcm_qla2xxx_fc_loopid { | 49 | struct tcm_qla2xxx_fc_loopid { |
@@ -62,8 +63,6 @@ struct tcm_qla2xxx_lport { | |||
62 | char lport_name[TCM_QLA2XXX_NAMELEN]; | 63 | char lport_name[TCM_QLA2XXX_NAMELEN]; |
63 | /* ASCII formatted naa WWPN for VPD page 83 etc */ | 64 | /* ASCII formatted naa WWPN for VPD page 83 etc */ |
64 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; | 65 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; |
65 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ | ||
66 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; | ||
67 | /* map for fc_port pointers in 24-bit FC Port ID space */ | 66 | /* map for fc_port pointers in 24-bit FC Port ID space */ |
68 | struct btree_head32 lport_fcport_map; | 67 | struct btree_head32 lport_fcport_map; |
69 | /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ | 68 | /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ |
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 17d740427240..9969fa1ef7c4 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
@@ -1419,6 +1419,9 @@ static void storvsc_device_destroy(struct scsi_device *sdevice) | |||
1419 | { | 1419 | { |
1420 | struct stor_mem_pools *memp = sdevice->hostdata; | 1420 | struct stor_mem_pools *memp = sdevice->hostdata; |
1421 | 1421 | ||
1422 | if (!memp) | ||
1423 | return; | ||
1424 | |||
1422 | mempool_destroy(memp->request_mempool); | 1425 | mempool_destroy(memp->request_mempool); |
1423 | kmem_cache_destroy(memp->request_pool); | 1426 | kmem_cache_destroy(memp->request_pool); |
1424 | kfree(memp); | 1427 | kfree(memp); |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 581ee2a8856b..5dea67c798d5 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -150,7 +150,7 @@ config SPI_BUTTERFLY | |||
150 | 150 | ||
151 | config SPI_CLPS711X | 151 | config SPI_CLPS711X |
152 | tristate "CLPS711X host SPI controller" | 152 | tristate "CLPS711X host SPI controller" |
153 | depends on ARCH_CLPS711X | 153 | depends on ARCH_CLPS711X || COMPILE_TEST |
154 | help | 154 | help |
155 | This enables dedicated general purpose SPI/Microwire1-compatible | 155 | This enables dedicated general purpose SPI/Microwire1-compatible |
156 | master mode interface (SSI1) for CLPS711X-based CPUs. | 156 | master mode interface (SSI1) for CLPS711X-based CPUs. |
@@ -212,7 +212,6 @@ config SPI_IMX | |||
212 | tristate "Freescale i.MX SPI controllers" | 212 | tristate "Freescale i.MX SPI controllers" |
213 | depends on ARCH_MXC || COMPILE_TEST | 213 | depends on ARCH_MXC || COMPILE_TEST |
214 | select SPI_BITBANG | 214 | select SPI_BITBANG |
215 | default m if IMX_HAVE_PLATFORM_SPI_IMX | ||
216 | help | 215 | help |
217 | This enables using the Freescale i.MX SPI controllers in master | 216 | This enables using the Freescale i.MX SPI controllers in master |
218 | mode. | 217 | mode. |
@@ -270,6 +269,7 @@ config SPI_FSL_SPI | |||
270 | config SPI_FSL_DSPI | 269 | config SPI_FSL_DSPI |
271 | tristate "Freescale DSPI controller" | 270 | tristate "Freescale DSPI controller" |
272 | select SPI_BITBANG | 271 | select SPI_BITBANG |
272 | select REGMAP_MMIO | ||
273 | depends on SOC_VF610 || COMPILE_TEST | 273 | depends on SOC_VF610 || COMPILE_TEST |
274 | help | 274 | help |
275 | This enables support for the Freescale DSPI controller in master | 275 | This enables support for the Freescale DSPI controller in master |
@@ -307,7 +307,7 @@ config SPI_OMAP_UWIRE | |||
307 | 307 | ||
308 | config SPI_OMAP24XX | 308 | config SPI_OMAP24XX |
309 | tristate "McSPI driver for OMAP" | 309 | tristate "McSPI driver for OMAP" |
310 | depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SH | 310 | depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SUPERH |
311 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | 311 | depends on ARCH_OMAP2PLUS || COMPILE_TEST |
312 | help | 312 | help |
313 | SPI master controller for OMAP24XX and later Multichannel SPI | 313 | SPI master controller for OMAP24XX and later Multichannel SPI |
@@ -381,6 +381,19 @@ config SPI_RSPI | |||
381 | help | 381 | help |
382 | SPI driver for Renesas RSPI and QSPI blocks. | 382 | SPI driver for Renesas RSPI and QSPI blocks. |
383 | 383 | ||
384 | config SPI_QUP | ||
385 | tristate "Qualcomm SPI controller with QUP interface" | ||
386 | depends on ARCH_MSM_DT || (ARM && COMPILE_TEST) | ||
387 | help | ||
388 | Qualcomm Universal Peripheral (QUP) core is an AHB slave that | ||
389 | provides a common data path (an output FIFO and an input FIFO) | ||
390 | for serial peripheral interface (SPI) mini-core. SPI in master | ||
391 | mode supports up to 50MHz, up to four chip selects, programmable | ||
392 | data path from 4 bits to 32 bits and numerous protocol variants. | ||
393 | |||
394 | This driver can also be built as a module. If so, the module | ||
395 | will be called spi_qup. | ||
396 | |||
384 | config SPI_S3C24XX | 397 | config SPI_S3C24XX |
385 | tristate "Samsung S3C24XX series SPI" | 398 | tristate "Samsung S3C24XX series SPI" |
386 | depends on ARCH_S3C24XX | 399 | depends on ARCH_S3C24XX |
@@ -546,7 +559,7 @@ config SPI_DW_MID_DMA | |||
546 | 559 | ||
547 | config SPI_DW_MMIO | 560 | config SPI_DW_MMIO |
548 | tristate "Memory-mapped io interface driver for DW SPI core" | 561 | tristate "Memory-mapped io interface driver for DW SPI core" |
549 | depends on SPI_DESIGNWARE && HAVE_CLK | 562 | depends on SPI_DESIGNWARE |
550 | 563 | ||
551 | # | 564 | # |
552 | # There are lots of SPI device types, with sensors and memory | 565 | # There are lots of SPI device types, with sensors and memory |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 95af48d2d360..e598147b06ef 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -59,6 +59,7 @@ spi-pxa2xx-platform-$(CONFIG_SPI_PXA2XX_PXADMA) += spi-pxa2xx-pxadma.o | |||
59 | spi-pxa2xx-platform-$(CONFIG_SPI_PXA2XX_DMA) += spi-pxa2xx-dma.o | 59 | spi-pxa2xx-platform-$(CONFIG_SPI_PXA2XX_DMA) += spi-pxa2xx-dma.o |
60 | obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o | 60 | obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o |
61 | obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o | 61 | obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o |
62 | obj-$(CONFIG_SPI_QUP) += spi-qup.o | ||
62 | obj-$(CONFIG_SPI_RSPI) += spi-rspi.o | 63 | obj-$(CONFIG_SPI_RSPI) += spi-rspi.o |
63 | obj-$(CONFIG_SPI_S3C24XX) += spi-s3c24xx-hw.o | 64 | obj-$(CONFIG_SPI_S3C24XX) += spi-s3c24xx-hw.o |
64 | spi-s3c24xx-hw-y := spi-s3c24xx.o | 65 | spi-s3c24xx-hw-y := spi-s3c24xx.o |
diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index 5d7deaf62867..5b5709a5c957 100644 --- a/drivers/spi/spi-altera.c +++ b/drivers/spi/spi-altera.c | |||
@@ -13,7 +13,6 @@ | |||
13 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
18 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
@@ -200,7 +199,6 @@ static irqreturn_t altera_spi_irq(int irq, void *dev) | |||
200 | 199 | ||
201 | static int altera_spi_probe(struct platform_device *pdev) | 200 | static int altera_spi_probe(struct platform_device *pdev) |
202 | { | 201 | { |
203 | struct altera_spi_platform_data *platp = dev_get_platdata(&pdev->dev); | ||
204 | struct altera_spi *hw; | 202 | struct altera_spi *hw; |
205 | struct spi_master *master; | 203 | struct spi_master *master; |
206 | struct resource *res; | 204 | struct resource *res; |
@@ -214,6 +212,8 @@ static int altera_spi_probe(struct platform_device *pdev) | |||
214 | master->bus_num = pdev->id; | 212 | master->bus_num = pdev->id; |
215 | master->num_chipselect = 16; | 213 | master->num_chipselect = 16; |
216 | master->mode_bits = SPI_CS_HIGH; | 214 | master->mode_bits = SPI_CS_HIGH; |
215 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16); | ||
216 | master->dev.of_node = pdev->dev.of_node; | ||
217 | 217 | ||
218 | hw = spi_master_get_devdata(master); | 218 | hw = spi_master_get_devdata(master); |
219 | platform_set_drvdata(pdev, hw); | 219 | platform_set_drvdata(pdev, hw); |
@@ -245,9 +245,6 @@ static int altera_spi_probe(struct platform_device *pdev) | |||
245 | if (err) | 245 | if (err) |
246 | goto exit; | 246 | goto exit; |
247 | } | 247 | } |
248 | /* find platform data */ | ||
249 | if (!platp) | ||
250 | hw->bitbang.master->dev.of_node = pdev->dev.of_node; | ||
251 | 248 | ||
252 | /* register our spi controller */ | 249 | /* register our spi controller */ |
253 | err = spi_bitbang_start(&hw->bitbang); | 250 | err = spi_bitbang_start(&hw->bitbang); |
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index 31534b51715a..3898b0b9ee77 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/init.h> | ||
18 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
19 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
20 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
@@ -132,9 +131,9 @@ static int ath79_spi_setup_cs(struct spi_device *spi) | |||
132 | 131 | ||
133 | flags = GPIOF_DIR_OUT; | 132 | flags = GPIOF_DIR_OUT; |
134 | if (spi->mode & SPI_CS_HIGH) | 133 | if (spi->mode & SPI_CS_HIGH) |
135 | flags |= GPIOF_INIT_HIGH; | ||
136 | else | ||
137 | flags |= GPIOF_INIT_LOW; | 134 | flags |= GPIOF_INIT_LOW; |
135 | else | ||
136 | flags |= GPIOF_INIT_HIGH; | ||
138 | 137 | ||
139 | status = gpio_request_one(cdata->gpio, flags, | 138 | status = gpio_request_one(cdata->gpio, flags, |
140 | dev_name(&spi->dev)); | 139 | dev_name(&spi->dev)); |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index b0842f751016..8005f9869481 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -9,7 +9,6 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | ||
13 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
15 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
@@ -26,6 +25,7 @@ | |||
26 | 25 | ||
27 | #include <linux/io.h> | 26 | #include <linux/io.h> |
28 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/pinctrl/consumer.h> | ||
29 | 29 | ||
30 | /* SPI register offsets */ | 30 | /* SPI register offsets */ |
31 | #define SPI_CR 0x0000 | 31 | #define SPI_CR 0x0000 |
@@ -993,13 +993,6 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
993 | 993 | ||
994 | as = spi_master_get_devdata(spi->master); | 994 | as = spi_master_get_devdata(spi->master); |
995 | 995 | ||
996 | if (spi->chip_select > spi->master->num_chipselect) { | ||
997 | dev_dbg(&spi->dev, | ||
998 | "setup: invalid chipselect %u (%u defined)\n", | ||
999 | spi->chip_select, spi->master->num_chipselect); | ||
1000 | return -EINVAL; | ||
1001 | } | ||
1002 | |||
1003 | /* see notes above re chipselect */ | 996 | /* see notes above re chipselect */ |
1004 | if (!atmel_spi_is_v2(as) | 997 | if (!atmel_spi_is_v2(as) |
1005 | && spi->chip_select == 0 | 998 | && spi->chip_select == 0 |
@@ -1087,14 +1080,6 @@ static int atmel_spi_one_transfer(struct spi_master *master, | |||
1087 | } | 1080 | } |
1088 | } | 1081 | } |
1089 | 1082 | ||
1090 | if (xfer->bits_per_word > 8) { | ||
1091 | if (xfer->len % 2) { | ||
1092 | dev_dbg(&spi->dev, | ||
1093 | "buffer len should be 16 bits aligned\n"); | ||
1094 | return -EINVAL; | ||
1095 | } | ||
1096 | } | ||
1097 | |||
1098 | /* | 1083 | /* |
1099 | * DMA map early, for performance (empties dcache ASAP) and | 1084 | * DMA map early, for performance (empties dcache ASAP) and |
1100 | * better fault reporting. | 1085 | * better fault reporting. |
@@ -1221,9 +1206,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master, | |||
1221 | dev_dbg(&spi->dev, "new message %p submitted for %s\n", | 1206 | dev_dbg(&spi->dev, "new message %p submitted for %s\n", |
1222 | msg, dev_name(&spi->dev)); | 1207 | msg, dev_name(&spi->dev)); |
1223 | 1208 | ||
1224 | if (unlikely(list_empty(&msg->transfers))) | ||
1225 | return -EINVAL; | ||
1226 | |||
1227 | atmel_spi_lock(as); | 1209 | atmel_spi_lock(as); |
1228 | cs_activate(as, spi); | 1210 | cs_activate(as, spi); |
1229 | 1211 | ||
@@ -1244,10 +1226,10 @@ static int atmel_spi_transfer_one_message(struct spi_master *master, | |||
1244 | 1226 | ||
1245 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 1227 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
1246 | dev_dbg(&spi->dev, | 1228 | dev_dbg(&spi->dev, |
1247 | " xfer %p: len %u tx %p/%08x rx %p/%08x\n", | 1229 | " xfer %p: len %u tx %p/%pad rx %p/%pad\n", |
1248 | xfer, xfer->len, | 1230 | xfer, xfer->len, |
1249 | xfer->tx_buf, xfer->tx_dma, | 1231 | xfer->tx_buf, &xfer->tx_dma, |
1250 | xfer->rx_buf, xfer->rx_dma); | 1232 | xfer->rx_buf, &xfer->rx_dma); |
1251 | } | 1233 | } |
1252 | 1234 | ||
1253 | msg_done: | 1235 | msg_done: |
@@ -1303,6 +1285,9 @@ static int atmel_spi_probe(struct platform_device *pdev) | |||
1303 | struct spi_master *master; | 1285 | struct spi_master *master; |
1304 | struct atmel_spi *as; | 1286 | struct atmel_spi *as; |
1305 | 1287 | ||
1288 | /* Select default pin state */ | ||
1289 | pinctrl_pm_select_default_state(&pdev->dev); | ||
1290 | |||
1306 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1291 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1307 | if (!regs) | 1292 | if (!regs) |
1308 | return -ENXIO; | 1293 | return -ENXIO; |
@@ -1455,8 +1440,19 @@ static int atmel_spi_suspend(struct device *dev) | |||
1455 | { | 1440 | { |
1456 | struct spi_master *master = dev_get_drvdata(dev); | 1441 | struct spi_master *master = dev_get_drvdata(dev); |
1457 | struct atmel_spi *as = spi_master_get_devdata(master); | 1442 | struct atmel_spi *as = spi_master_get_devdata(master); |
1443 | int ret; | ||
1444 | |||
1445 | /* Stop the queue running */ | ||
1446 | ret = spi_master_suspend(master); | ||
1447 | if (ret) { | ||
1448 | dev_warn(dev, "cannot suspend master\n"); | ||
1449 | return ret; | ||
1450 | } | ||
1458 | 1451 | ||
1459 | clk_disable_unprepare(as->clk); | 1452 | clk_disable_unprepare(as->clk); |
1453 | |||
1454 | pinctrl_pm_select_sleep_state(dev); | ||
1455 | |||
1460 | return 0; | 1456 | return 0; |
1461 | } | 1457 | } |
1462 | 1458 | ||
@@ -1464,9 +1460,18 @@ static int atmel_spi_resume(struct device *dev) | |||
1464 | { | 1460 | { |
1465 | struct spi_master *master = dev_get_drvdata(dev); | 1461 | struct spi_master *master = dev_get_drvdata(dev); |
1466 | struct atmel_spi *as = spi_master_get_devdata(master); | 1462 | struct atmel_spi *as = spi_master_get_devdata(master); |
1463 | int ret; | ||
1464 | |||
1465 | pinctrl_pm_select_default_state(dev); | ||
1467 | 1466 | ||
1468 | clk_prepare_enable(as->clk); | 1467 | clk_prepare_enable(as->clk); |
1469 | return 0; | 1468 | |
1469 | /* Start the queue running */ | ||
1470 | ret = spi_master_resume(master); | ||
1471 | if (ret) | ||
1472 | dev_err(dev, "problem starting queue (%d)\n", ret); | ||
1473 | |||
1474 | return ret; | ||
1470 | } | 1475 | } |
1471 | 1476 | ||
1472 | static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume); | 1477 | static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume); |
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index c4141c92bcff..aafb812d7ea6 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c | |||
@@ -55,8 +55,6 @@ struct au1550_spi { | |||
55 | 55 | ||
56 | volatile psc_spi_t __iomem *regs; | 56 | volatile psc_spi_t __iomem *regs; |
57 | int irq; | 57 | int irq; |
58 | unsigned freq_max; | ||
59 | unsigned freq_min; | ||
60 | 58 | ||
61 | unsigned len; | 59 | unsigned len; |
62 | unsigned tx_count; | 60 | unsigned tx_count; |
@@ -248,11 +246,8 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t) | |||
248 | hz = t->speed_hz; | 246 | hz = t->speed_hz; |
249 | } | 247 | } |
250 | 248 | ||
251 | if (hz > spi->max_speed_hz || hz > hw->freq_max || hz < hw->freq_min) { | 249 | if (!hz) |
252 | dev_err(&spi->dev, "setupxfer: clock rate=%d out of range\n", | ||
253 | hz); | ||
254 | return -EINVAL; | 250 | return -EINVAL; |
255 | } | ||
256 | 251 | ||
257 | au1550_spi_bits_handlers_set(hw, spi->bits_per_word); | 252 | au1550_spi_bits_handlers_set(hw, spi->bits_per_word); |
258 | 253 | ||
@@ -287,23 +282,6 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t) | |||
287 | return 0; | 282 | return 0; |
288 | } | 283 | } |
289 | 284 | ||
290 | static int au1550_spi_setup(struct spi_device *spi) | ||
291 | { | ||
292 | struct au1550_spi *hw = spi_master_get_devdata(spi->master); | ||
293 | |||
294 | if (spi->max_speed_hz == 0) | ||
295 | spi->max_speed_hz = hw->freq_max; | ||
296 | if (spi->max_speed_hz > hw->freq_max | ||
297 | || spi->max_speed_hz < hw->freq_min) | ||
298 | return -EINVAL; | ||
299 | /* | ||
300 | * NOTE: cannot change speed and other hw settings immediately, | ||
301 | * otherwise sharing of spi bus is not possible, | ||
302 | * so do not call setupxfer(spi, NULL) here | ||
303 | */ | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | /* | 285 | /* |
308 | * for dma spi transfers, we have to setup rx channel, otherwise there is | 286 | * for dma spi transfers, we have to setup rx channel, otherwise there is |
309 | * no reliable way how to recognize that spi transfer is done | 287 | * no reliable way how to recognize that spi transfer is done |
@@ -838,7 +816,6 @@ static int au1550_spi_probe(struct platform_device *pdev) | |||
838 | hw->bitbang.master = hw->master; | 816 | hw->bitbang.master = hw->master; |
839 | hw->bitbang.setup_transfer = au1550_spi_setupxfer; | 817 | hw->bitbang.setup_transfer = au1550_spi_setupxfer; |
840 | hw->bitbang.chipselect = au1550_spi_chipsel; | 818 | hw->bitbang.chipselect = au1550_spi_chipsel; |
841 | hw->bitbang.master->setup = au1550_spi_setup; | ||
842 | hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs; | 819 | hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs; |
843 | 820 | ||
844 | if (hw->usedma) { | 821 | if (hw->usedma) { |
@@ -909,8 +886,9 @@ static int au1550_spi_probe(struct platform_device *pdev) | |||
909 | { | 886 | { |
910 | int min_div = (2 << 0) * (2 * (4 + 1)); | 887 | int min_div = (2 << 0) * (2 * (4 + 1)); |
911 | int max_div = (2 << 3) * (2 * (63 + 1)); | 888 | int max_div = (2 << 3) * (2 * (63 + 1)); |
912 | hw->freq_max = hw->pdata->mainclk_hz / min_div; | 889 | master->max_speed_hz = hw->pdata->mainclk_hz / min_div; |
913 | hw->freq_min = hw->pdata->mainclk_hz / (max_div + 1) + 1; | 890 | master->min_speed_hz = |
891 | hw->pdata->mainclk_hz / (max_div + 1) + 1; | ||
914 | } | 892 | } |
915 | 893 | ||
916 | au1550_spi_setup_psc_as_spi(hw); | 894 | au1550_spi_setup_psc_as_spi(hw); |
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 8a89dd1f2654..69167456ec1e 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c | |||
@@ -315,7 +315,6 @@ static int bcm2835_spi_probe(struct platform_device *pdev) | |||
315 | 315 | ||
316 | master->mode_bits = BCM2835_SPI_MODE_BITS; | 316 | master->mode_bits = BCM2835_SPI_MODE_BITS; |
317 | master->bits_per_word_mask = SPI_BPW_MASK(8); | 317 | master->bits_per_word_mask = SPI_BPW_MASK(8); |
318 | master->bus_num = -1; | ||
319 | master->num_chipselect = 3; | 318 | master->num_chipselect = 3; |
320 | master->transfer_one_message = bcm2835_spi_transfer_one; | 319 | master->transfer_one_message = bcm2835_spi_transfer_one; |
321 | master->dev.of_node = pdev->dev.of_node; | 320 | master->dev.of_node = pdev->dev.of_node; |
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c index b528f9fc8bc0..5a211e98383b 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c | |||
@@ -180,7 +180,7 @@ static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) | |||
180 | while (pending > 0) { | 180 | while (pending > 0) { |
181 | int curr_step = min_t(int, step_size, pending); | 181 | int curr_step = min_t(int, step_size, pending); |
182 | 182 | ||
183 | init_completion(&bs->done); | 183 | reinit_completion(&bs->done); |
184 | if (tx) { | 184 | if (tx) { |
185 | memcpy_toio(bs->fifo + HSSPI_OPCODE_LEN, tx, curr_step); | 185 | memcpy_toio(bs->fifo + HSSPI_OPCODE_LEN, tx, curr_step); |
186 | tx += curr_step; | 186 | tx += curr_step; |
@@ -369,6 +369,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) | |||
369 | bs->fifo = (u8 __iomem *)(bs->regs + HSSPI_FIFO_REG(0)); | 369 | bs->fifo = (u8 __iomem *)(bs->regs + HSSPI_FIFO_REG(0)); |
370 | 370 | ||
371 | mutex_init(&bs->bus_mutex); | 371 | mutex_init(&bs->bus_mutex); |
372 | init_completion(&bs->done); | ||
372 | 373 | ||
373 | master->bus_num = HSSPI_BUS_NUM; | 374 | master->bus_num = HSSPI_BUS_NUM; |
374 | master->num_chipselect = 8; | 375 | master->num_chipselect = 8; |
@@ -453,9 +454,8 @@ static int bcm63xx_hsspi_resume(struct device *dev) | |||
453 | } | 454 | } |
454 | #endif | 455 | #endif |
455 | 456 | ||
456 | static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = { | 457 | static SIMPLE_DEV_PM_OPS(bcm63xx_hsspi_pm_ops, bcm63xx_hsspi_suspend, |
457 | SET_SYSTEM_SLEEP_PM_OPS(bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume) | 458 | bcm63xx_hsspi_resume); |
458 | }; | ||
459 | 459 | ||
460 | static struct platform_driver bcm63xx_hsspi_driver = { | 460 | static struct platform_driver bcm63xx_hsspi_driver = { |
461 | .driver = { | 461 | .driver = { |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 77286aef2adf..0250fa721cea 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
@@ -20,7 +20,6 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/init.h> | ||
24 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
25 | #include <linux/io.h> | 24 | #include <linux/io.h> |
26 | #include <linux/module.h> | 25 | #include <linux/module.h> |
@@ -35,8 +34,6 @@ | |||
35 | 34 | ||
36 | #include <bcm63xx_dev_spi.h> | 35 | #include <bcm63xx_dev_spi.h> |
37 | 36 | ||
38 | #define PFX KBUILD_MODNAME | ||
39 | |||
40 | #define BCM63XX_SPI_MAX_PREPEND 15 | 37 | #define BCM63XX_SPI_MAX_PREPEND 15 |
41 | 38 | ||
42 | struct bcm63xx_spi { | 39 | struct bcm63xx_spi { |
@@ -169,7 +166,7 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first, | |||
169 | transfer_list); | 166 | transfer_list); |
170 | } | 167 | } |
171 | 168 | ||
172 | init_completion(&bs->done); | 169 | reinit_completion(&bs->done); |
173 | 170 | ||
174 | /* Fill in the Message control register */ | 171 | /* Fill in the Message control register */ |
175 | msg_ctl = (len << SPI_BYTE_CNT_SHIFT); | 172 | msg_ctl = (len << SPI_BYTE_CNT_SHIFT); |
@@ -353,6 +350,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev) | |||
353 | } | 350 | } |
354 | 351 | ||
355 | bs = spi_master_get_devdata(master); | 352 | bs = spi_master_get_devdata(master); |
353 | init_completion(&bs->done); | ||
356 | 354 | ||
357 | platform_set_drvdata(pdev, master); | 355 | platform_set_drvdata(pdev, master); |
358 | bs->pdev = pdev; | 356 | bs->pdev = pdev; |
diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c index 38941e5920b5..f515c5e9db57 100644 --- a/drivers/spi/spi-bfin-sport.c +++ b/drivers/spi/spi-bfin-sport.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * Licensed under the GPL-2 or later. | 8 | * Licensed under the GPL-2 or later. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
13 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
14 | #include <linux/device.h> | 13 | #include <linux/device.h> |
diff --git a/drivers/spi/spi-bfin-v3.c b/drivers/spi/spi-bfin-v3.c index 8f8598834b30..4089d0e0d84e 100644 --- a/drivers/spi/spi-bfin-v3.c +++ b/drivers/spi/spi-bfin-v3.c | |||
@@ -822,7 +822,8 @@ static int bfin_spi_probe(struct platform_device *pdev) | |||
822 | master->cleanup = bfin_spi_cleanup; | 822 | master->cleanup = bfin_spi_cleanup; |
823 | master->setup = bfin_spi_setup; | 823 | master->setup = bfin_spi_setup; |
824 | master->transfer_one_message = bfin_spi_transfer_one_message; | 824 | master->transfer_one_message = bfin_spi_transfer_one_message; |
825 | master->bits_per_word_mask = BIT(32 - 1) | BIT(16 - 1) | BIT(8 - 1); | 825 | master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | |
826 | SPI_BPW_MASK(8); | ||
826 | 827 | ||
827 | drv_data = spi_master_get_devdata(master); | 828 | drv_data = spi_master_get_devdata(master); |
828 | drv_data->master = master; | 829 | drv_data->master = master; |
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index f0f195af75d4..55e57c3eb9bd 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c | |||
@@ -350,7 +350,6 @@ static void *bfin_spi_next_transfer(struct bfin_spi_master_data *drv_data) | |||
350 | static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data) | 350 | static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data) |
351 | { | 351 | { |
352 | struct bfin_spi_slave_data *chip = drv_data->cur_chip; | 352 | struct bfin_spi_slave_data *chip = drv_data->cur_chip; |
353 | struct spi_transfer *last_transfer; | ||
354 | unsigned long flags; | 353 | unsigned long flags; |
355 | struct spi_message *msg; | 354 | struct spi_message *msg; |
356 | 355 | ||
@@ -362,9 +361,6 @@ static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data) | |||
362 | queue_work(drv_data->workqueue, &drv_data->pump_messages); | 361 | queue_work(drv_data->workqueue, &drv_data->pump_messages); |
363 | spin_unlock_irqrestore(&drv_data->lock, flags); | 362 | spin_unlock_irqrestore(&drv_data->lock, flags); |
364 | 363 | ||
365 | last_transfer = list_entry(msg->transfers.prev, | ||
366 | struct spi_transfer, transfer_list); | ||
367 | |||
368 | msg->state = NULL; | 364 | msg->state = NULL; |
369 | 365 | ||
370 | if (!drv_data->cs_change) | 366 | if (!drv_data->cs_change) |
@@ -1030,10 +1026,6 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
1030 | } | 1026 | } |
1031 | 1027 | ||
1032 | /* translate common spi framework into our register */ | 1028 | /* translate common spi framework into our register */ |
1033 | if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST)) { | ||
1034 | dev_err(&spi->dev, "unsupported spi modes detected\n"); | ||
1035 | goto error; | ||
1036 | } | ||
1037 | if (spi->mode & SPI_CPOL) | 1029 | if (spi->mode & SPI_CPOL) |
1038 | chip->ctl_reg |= BIT_CTL_CPOL; | 1030 | chip->ctl_reg |= BIT_CTL_CPOL; |
1039 | if (spi->mode & SPI_CPHA) | 1031 | if (spi->mode & SPI_CPHA) |
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index bd222f6b677d..dc7d2c2d643e 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
21 | #include <linux/workqueue.h> | 20 | #include <linux/workqueue.h> |
22 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
@@ -467,11 +466,9 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start); | |||
467 | /** | 466 | /** |
468 | * spi_bitbang_stop - stops the task providing spi communication | 467 | * spi_bitbang_stop - stops the task providing spi communication |
469 | */ | 468 | */ |
470 | int spi_bitbang_stop(struct spi_bitbang *bitbang) | 469 | void spi_bitbang_stop(struct spi_bitbang *bitbang) |
471 | { | 470 | { |
472 | spi_unregister_master(bitbang->master); | 471 | spi_unregister_master(bitbang->master); |
473 | |||
474 | return 0; | ||
475 | } | 472 | } |
476 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); | 473 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); |
477 | 474 | ||
diff --git a/drivers/spi/spi-butterfly.c b/drivers/spi/spi-butterfly.c index 8081f96bd1d5..ee4f91ccd8fd 100644 --- a/drivers/spi/spi-butterfly.c +++ b/drivers/spi/spi-butterfly.c | |||
@@ -309,7 +309,6 @@ done: | |||
309 | static void butterfly_detach(struct parport *p) | 309 | static void butterfly_detach(struct parport *p) |
310 | { | 310 | { |
311 | struct butterfly *pp; | 311 | struct butterfly *pp; |
312 | int status; | ||
313 | 312 | ||
314 | /* FIXME this global is ugly ... but, how to quickly get from | 313 | /* FIXME this global is ugly ... but, how to quickly get from |
315 | * the parport to the "struct butterfly" associated with it? | 314 | * the parport to the "struct butterfly" associated with it? |
@@ -321,7 +320,7 @@ static void butterfly_detach(struct parport *p) | |||
321 | butterfly = NULL; | 320 | butterfly = NULL; |
322 | 321 | ||
323 | /* stop() unregisters child devices too */ | 322 | /* stop() unregisters child devices too */ |
324 | status = spi_bitbang_stop(&pp->bitbang); | 323 | spi_bitbang_stop(&pp->bitbang); |
325 | 324 | ||
326 | /* turn off VCC */ | 325 | /* turn off VCC */ |
327 | parport_write_data(pp->port, 0); | 326 | parport_write_data(pp->port, 0); |
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 374ba4a48a9e..4cd62f636547 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c | |||
@@ -11,158 +11,125 @@ | |||
11 | 11 | ||
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/init.h> | ||
15 | #include <linux/gpio.h> | 14 | #include <linux/gpio.h> |
16 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/regmap.h> | ||
20 | #include <linux/mfd/syscon.h> | ||
21 | #include <linux/mfd/syscon/clps711x.h> | ||
20 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
21 | #include <linux/platform_data/spi-clps711x.h> | 23 | #include <linux/platform_data/spi-clps711x.h> |
22 | 24 | ||
23 | #include <mach/hardware.h> | ||
24 | |||
25 | #define DRIVER_NAME "spi-clps711x" | 25 | #define DRIVER_NAME "spi-clps711x" |
26 | 26 | ||
27 | struct spi_clps711x_data { | 27 | #define SYNCIO_FRMLEN(x) ((x) << 8) |
28 | struct completion done; | 28 | #define SYNCIO_TXFRMEN (1 << 14) |
29 | 29 | ||
30 | struct spi_clps711x_data { | ||
31 | void __iomem *syncio; | ||
32 | struct regmap *syscon; | ||
33 | struct regmap *syscon1; | ||
30 | struct clk *spi_clk; | 34 | struct clk *spi_clk; |
31 | u32 max_speed_hz; | ||
32 | 35 | ||
33 | u8 *tx_buf; | 36 | u8 *tx_buf; |
34 | u8 *rx_buf; | 37 | u8 *rx_buf; |
35 | int count; | 38 | unsigned int bpw; |
36 | int len; | 39 | int len; |
37 | |||
38 | int chipselect[0]; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | static int spi_clps711x_setup(struct spi_device *spi) | 42 | static int spi_clps711x_setup(struct spi_device *spi) |
42 | { | 43 | { |
43 | struct spi_clps711x_data *hw = spi_master_get_devdata(spi->master); | ||
44 | |||
45 | /* We are expect that SPI-device is not selected */ | 44 | /* We are expect that SPI-device is not selected */ |
46 | gpio_direction_output(hw->chipselect[spi->chip_select], | 45 | gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
47 | !(spi->mode & SPI_CS_HIGH)); | ||
48 | 46 | ||
49 | return 0; | 47 | return 0; |
50 | } | 48 | } |
51 | 49 | ||
52 | static void spi_clps711x_setup_mode(struct spi_device *spi) | 50 | static void spi_clps711x_setup_xfer(struct spi_device *spi, |
53 | { | 51 | struct spi_transfer *xfer) |
54 | /* Setup edge for transfer */ | ||
55 | if (spi->mode & SPI_CPHA) | ||
56 | clps_writew(clps_readw(SYSCON3) | SYSCON3_ADCCKNSEN, SYSCON3); | ||
57 | else | ||
58 | clps_writew(clps_readw(SYSCON3) & ~SYSCON3_ADCCKNSEN, SYSCON3); | ||
59 | } | ||
60 | |||
61 | static int spi_clps711x_setup_xfer(struct spi_device *spi, | ||
62 | struct spi_transfer *xfer) | ||
63 | { | 52 | { |
64 | u32 speed = xfer->speed_hz ? : spi->max_speed_hz; | 53 | struct spi_master *master = spi->master; |
65 | u8 bpw = xfer->bits_per_word; | 54 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); |
66 | struct spi_clps711x_data *hw = spi_master_get_devdata(spi->master); | ||
67 | |||
68 | if (bpw != 8) { | ||
69 | dev_err(&spi->dev, "Unsupported master bus width %i\n", bpw); | ||
70 | return -EINVAL; | ||
71 | } | ||
72 | 55 | ||
73 | /* Setup SPI frequency divider */ | 56 | /* Setup SPI frequency divider */ |
74 | if (!speed || (speed >= hw->max_speed_hz)) | 57 | if (xfer->speed_hz >= master->max_speed_hz) |
75 | clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) | | 58 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, |
76 | SYSCON1_ADCKSEL(3), SYSCON1); | 59 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(3)); |
77 | else if (speed >= (hw->max_speed_hz / 2)) | 60 | else if (xfer->speed_hz >= (master->max_speed_hz / 2)) |
78 | clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) | | 61 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, |
79 | SYSCON1_ADCKSEL(2), SYSCON1); | 62 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(2)); |
80 | else if (speed >= (hw->max_speed_hz / 8)) | 63 | else if (xfer->speed_hz >= (master->max_speed_hz / 8)) |
81 | clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) | | 64 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, |
82 | SYSCON1_ADCKSEL(1), SYSCON1); | 65 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(1)); |
83 | else | 66 | else |
84 | clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) | | 67 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, |
85 | SYSCON1_ADCKSEL(0), SYSCON1); | 68 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(0)); |
86 | |||
87 | return 0; | ||
88 | } | 69 | } |
89 | 70 | ||
90 | static int spi_clps711x_transfer_one_message(struct spi_master *master, | 71 | static int spi_clps711x_prepare_message(struct spi_master *master, |
91 | struct spi_message *msg) | 72 | struct spi_message *msg) |
92 | { | 73 | { |
93 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); | 74 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); |
94 | struct spi_transfer *xfer; | 75 | struct spi_device *spi = msg->spi; |
95 | int status = 0, cs = hw->chipselect[msg->spi->chip_select]; | ||
96 | u32 data; | ||
97 | |||
98 | spi_clps711x_setup_mode(msg->spi); | ||
99 | |||
100 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | ||
101 | if (spi_clps711x_setup_xfer(msg->spi, xfer)) { | ||
102 | status = -EINVAL; | ||
103 | goto out_xfr; | ||
104 | } | ||
105 | 76 | ||
106 | gpio_set_value(cs, !!(msg->spi->mode & SPI_CS_HIGH)); | 77 | /* Setup mode for transfer */ |
107 | 78 | return regmap_update_bits(hw->syscon, SYSCON_OFFSET, SYSCON3_ADCCKNSEN, | |
108 | reinit_completion(&hw->done); | 79 | (spi->mode & SPI_CPHA) ? |
109 | 80 | SYSCON3_ADCCKNSEN : 0); | |
110 | hw->count = 0; | 81 | } |
111 | hw->len = xfer->len; | ||
112 | hw->tx_buf = (u8 *)xfer->tx_buf; | ||
113 | hw->rx_buf = (u8 *)xfer->rx_buf; | ||
114 | |||
115 | /* Initiate transfer */ | ||
116 | data = hw->tx_buf ? hw->tx_buf[hw->count] : 0; | ||
117 | clps_writel(data | SYNCIO_FRMLEN(8) | SYNCIO_TXFRMEN, SYNCIO); | ||
118 | |||
119 | wait_for_completion(&hw->done); | ||
120 | 82 | ||
121 | if (xfer->delay_usecs) | 83 | static int spi_clps711x_transfer_one(struct spi_master *master, |
122 | udelay(xfer->delay_usecs); | 84 | struct spi_device *spi, |
85 | struct spi_transfer *xfer) | ||
86 | { | ||
87 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); | ||
88 | u8 data; | ||
123 | 89 | ||
124 | if (xfer->cs_change || | 90 | spi_clps711x_setup_xfer(spi, xfer); |
125 | list_is_last(&xfer->transfer_list, &msg->transfers)) | ||
126 | gpio_set_value(cs, !(msg->spi->mode & SPI_CS_HIGH)); | ||
127 | 91 | ||
128 | msg->actual_length += xfer->len; | 92 | hw->len = xfer->len; |
129 | } | 93 | hw->bpw = xfer->bits_per_word; |
94 | hw->tx_buf = (u8 *)xfer->tx_buf; | ||
95 | hw->rx_buf = (u8 *)xfer->rx_buf; | ||
130 | 96 | ||
131 | out_xfr: | 97 | /* Initiate transfer */ |
132 | msg->status = status; | 98 | data = hw->tx_buf ? *hw->tx_buf++ : 0; |
133 | spi_finalize_current_message(master); | 99 | writel(data | SYNCIO_FRMLEN(hw->bpw) | SYNCIO_TXFRMEN, hw->syncio); |
134 | 100 | ||
135 | return 0; | 101 | return 1; |
136 | } | 102 | } |
137 | 103 | ||
138 | static irqreturn_t spi_clps711x_isr(int irq, void *dev_id) | 104 | static irqreturn_t spi_clps711x_isr(int irq, void *dev_id) |
139 | { | 105 | { |
140 | struct spi_clps711x_data *hw = (struct spi_clps711x_data *)dev_id; | 106 | struct spi_master *master = dev_id; |
141 | u32 data; | 107 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); |
108 | u8 data; | ||
142 | 109 | ||
143 | /* Handle RX */ | 110 | /* Handle RX */ |
144 | data = clps_readb(SYNCIO); | 111 | data = readb(hw->syncio); |
145 | if (hw->rx_buf) | 112 | if (hw->rx_buf) |
146 | hw->rx_buf[hw->count] = (u8)data; | 113 | *hw->rx_buf++ = data; |
147 | |||
148 | hw->count++; | ||
149 | 114 | ||
150 | /* Handle TX */ | 115 | /* Handle TX */ |
151 | if (hw->count < hw->len) { | 116 | if (--hw->len > 0) { |
152 | data = hw->tx_buf ? hw->tx_buf[hw->count] : 0; | 117 | data = hw->tx_buf ? *hw->tx_buf++ : 0; |
153 | clps_writel(data | SYNCIO_FRMLEN(8) | SYNCIO_TXFRMEN, SYNCIO); | 118 | writel(data | SYNCIO_FRMLEN(hw->bpw) | SYNCIO_TXFRMEN, |
119 | hw->syncio); | ||
154 | } else | 120 | } else |
155 | complete(&hw->done); | 121 | spi_finalize_current_transfer(master); |
156 | 122 | ||
157 | return IRQ_HANDLED; | 123 | return IRQ_HANDLED; |
158 | } | 124 | } |
159 | 125 | ||
160 | static int spi_clps711x_probe(struct platform_device *pdev) | 126 | static int spi_clps711x_probe(struct platform_device *pdev) |
161 | { | 127 | { |
162 | int i, ret; | ||
163 | struct spi_master *master; | ||
164 | struct spi_clps711x_data *hw; | 128 | struct spi_clps711x_data *hw; |
165 | struct spi_clps711x_pdata *pdata = dev_get_platdata(&pdev->dev); | 129 | struct spi_clps711x_pdata *pdata = dev_get_platdata(&pdev->dev); |
130 | struct spi_master *master; | ||
131 | struct resource *res; | ||
132 | int i, irq, ret; | ||
166 | 133 | ||
167 | if (!pdata) { | 134 | if (!pdata) { |
168 | dev_err(&pdev->dev, "No platform data supplied\n"); | 135 | dev_err(&pdev->dev, "No platform data supplied\n"); |
@@ -174,33 +141,37 @@ static int spi_clps711x_probe(struct platform_device *pdev) | |||
174 | return -EINVAL; | 141 | return -EINVAL; |
175 | } | 142 | } |
176 | 143 | ||
177 | master = spi_alloc_master(&pdev->dev, | 144 | irq = platform_get_irq(pdev, 0); |
178 | sizeof(struct spi_clps711x_data) + | 145 | if (irq < 0) |
179 | sizeof(int) * pdata->num_chipselect); | 146 | return irq; |
180 | if (!master) { | 147 | |
181 | dev_err(&pdev->dev, "SPI allocating memory error\n"); | 148 | master = spi_alloc_master(&pdev->dev, sizeof(*hw)); |
149 | if (!master) | ||
182 | return -ENOMEM; | 150 | return -ENOMEM; |
151 | |||
152 | master->cs_gpios = devm_kzalloc(&pdev->dev, sizeof(int) * | ||
153 | pdata->num_chipselect, GFP_KERNEL); | ||
154 | if (!master->cs_gpios) { | ||
155 | ret = -ENOMEM; | ||
156 | goto err_out; | ||
183 | } | 157 | } |
184 | 158 | ||
185 | master->bus_num = pdev->id; | 159 | master->bus_num = pdev->id; |
186 | master->mode_bits = SPI_CPHA | SPI_CS_HIGH; | 160 | master->mode_bits = SPI_CPHA | SPI_CS_HIGH; |
187 | master->bits_per_word_mask = SPI_BPW_MASK(8); | 161 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 8); |
188 | master->num_chipselect = pdata->num_chipselect; | 162 | master->num_chipselect = pdata->num_chipselect; |
189 | master->setup = spi_clps711x_setup; | 163 | master->setup = spi_clps711x_setup; |
190 | master->transfer_one_message = spi_clps711x_transfer_one_message; | 164 | master->prepare_message = spi_clps711x_prepare_message; |
165 | master->transfer_one = spi_clps711x_transfer_one; | ||
191 | 166 | ||
192 | hw = spi_master_get_devdata(master); | 167 | hw = spi_master_get_devdata(master); |
193 | 168 | ||
194 | for (i = 0; i < master->num_chipselect; i++) { | 169 | for (i = 0; i < master->num_chipselect; i++) { |
195 | hw->chipselect[i] = pdata->chipselect[i]; | 170 | master->cs_gpios[i] = pdata->chipselect[i]; |
196 | if (!gpio_is_valid(hw->chipselect[i])) { | 171 | ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i], |
197 | dev_err(&pdev->dev, "Invalid CS GPIO %i\n", i); | 172 | DRIVER_NAME); |
198 | ret = -EINVAL; | 173 | if (ret) { |
199 | goto err_out; | ||
200 | } | ||
201 | if (devm_gpio_request(&pdev->dev, hw->chipselect[i], NULL)) { | ||
202 | dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i); | 174 | dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i); |
203 | ret = -EINVAL; | ||
204 | goto err_out; | 175 | goto err_out; |
205 | } | 176 | } |
206 | } | 177 | } |
@@ -211,29 +182,45 @@ static int spi_clps711x_probe(struct platform_device *pdev) | |||
211 | ret = PTR_ERR(hw->spi_clk); | 182 | ret = PTR_ERR(hw->spi_clk); |
212 | goto err_out; | 183 | goto err_out; |
213 | } | 184 | } |
214 | hw->max_speed_hz = clk_get_rate(hw->spi_clk); | 185 | master->max_speed_hz = clk_get_rate(hw->spi_clk); |
215 | 186 | ||
216 | init_completion(&hw->done); | ||
217 | platform_set_drvdata(pdev, master); | 187 | platform_set_drvdata(pdev, master); |
218 | 188 | ||
189 | hw->syscon = syscon_regmap_lookup_by_pdevname("syscon.3"); | ||
190 | if (IS_ERR(hw->syscon)) { | ||
191 | ret = PTR_ERR(hw->syscon); | ||
192 | goto err_out; | ||
193 | } | ||
194 | |||
195 | hw->syscon1 = syscon_regmap_lookup_by_pdevname("syscon.1"); | ||
196 | if (IS_ERR(hw->syscon1)) { | ||
197 | ret = PTR_ERR(hw->syscon1); | ||
198 | goto err_out; | ||
199 | } | ||
200 | |||
201 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
202 | hw->syncio = devm_ioremap_resource(&pdev->dev, res); | ||
203 | if (IS_ERR(hw->syncio)) { | ||
204 | ret = PTR_ERR(hw->syncio); | ||
205 | goto err_out; | ||
206 | } | ||
207 | |||
219 | /* Disable extended mode due hardware problems */ | 208 | /* Disable extended mode due hardware problems */ |
220 | clps_writew(clps_readw(SYSCON3) & ~SYSCON3_ADCCON, SYSCON3); | 209 | regmap_update_bits(hw->syscon, SYSCON_OFFSET, SYSCON3_ADCCON, 0); |
221 | 210 | ||
222 | /* Clear possible pending interrupt */ | 211 | /* Clear possible pending interrupt */ |
223 | clps_readl(SYNCIO); | 212 | readl(hw->syncio); |
224 | 213 | ||
225 | ret = devm_request_irq(&pdev->dev, IRQ_SSEOTI, spi_clps711x_isr, 0, | 214 | ret = devm_request_irq(&pdev->dev, irq, spi_clps711x_isr, 0, |
226 | dev_name(&pdev->dev), hw); | 215 | dev_name(&pdev->dev), master); |
227 | if (ret) { | 216 | if (ret) |
228 | dev_err(&pdev->dev, "Can't request IRQ\n"); | ||
229 | goto err_out; | 217 | goto err_out; |
230 | } | ||
231 | 218 | ||
232 | ret = devm_spi_register_master(&pdev->dev, master); | 219 | ret = devm_spi_register_master(&pdev->dev, master); |
233 | if (!ret) { | 220 | if (!ret) { |
234 | dev_info(&pdev->dev, | 221 | dev_info(&pdev->dev, |
235 | "SPI bus driver initialized. Master clock %u Hz\n", | 222 | "SPI bus driver initialized. Master clock %u Hz\n", |
236 | hw->max_speed_hz); | 223 | master->max_speed_hz); |
237 | return 0; | 224 | return 0; |
238 | } | 225 | } |
239 | 226 | ||
diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c index cabed8f9119e..e2fa628e55e7 100644 --- a/drivers/spi/spi-coldfire-qspi.c +++ b/drivers/spi/spi-coldfire-qspi.c | |||
@@ -77,8 +77,6 @@ struct mcfqspi { | |||
77 | struct mcfqspi_cs_control *cs_control; | 77 | struct mcfqspi_cs_control *cs_control; |
78 | 78 | ||
79 | wait_queue_head_t waitq; | 79 | wait_queue_head_t waitq; |
80 | |||
81 | struct device *dev; | ||
82 | }; | 80 | }; |
83 | 81 | ||
84 | static void mcfqspi_wr_qmr(struct mcfqspi *mcfqspi, u16 val) | 82 | static void mcfqspi_wr_qmr(struct mcfqspi *mcfqspi, u16 val) |
@@ -135,13 +133,13 @@ static void mcfqspi_cs_deselect(struct mcfqspi *mcfqspi, u8 chip_select, | |||
135 | 133 | ||
136 | static int mcfqspi_cs_setup(struct mcfqspi *mcfqspi) | 134 | static int mcfqspi_cs_setup(struct mcfqspi *mcfqspi) |
137 | { | 135 | { |
138 | return (mcfqspi->cs_control && mcfqspi->cs_control->setup) ? | 136 | return (mcfqspi->cs_control->setup) ? |
139 | mcfqspi->cs_control->setup(mcfqspi->cs_control) : 0; | 137 | mcfqspi->cs_control->setup(mcfqspi->cs_control) : 0; |
140 | } | 138 | } |
141 | 139 | ||
142 | static void mcfqspi_cs_teardown(struct mcfqspi *mcfqspi) | 140 | static void mcfqspi_cs_teardown(struct mcfqspi *mcfqspi) |
143 | { | 141 | { |
144 | if (mcfqspi->cs_control && mcfqspi->cs_control->teardown) | 142 | if (mcfqspi->cs_control->teardown) |
145 | mcfqspi->cs_control->teardown(mcfqspi->cs_control); | 143 | mcfqspi->cs_control->teardown(mcfqspi->cs_control); |
146 | } | 144 | } |
147 | 145 | ||
@@ -300,68 +298,45 @@ static void mcfqspi_transfer_msg16(struct mcfqspi *mcfqspi, unsigned count, | |||
300 | } | 298 | } |
301 | } | 299 | } |
302 | 300 | ||
303 | static int mcfqspi_transfer_one_message(struct spi_master *master, | 301 | static void mcfqspi_set_cs(struct spi_device *spi, bool enable) |
304 | struct spi_message *msg) | ||
305 | { | 302 | { |
306 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | 303 | struct mcfqspi *mcfqspi = spi_master_get_devdata(spi->master); |
307 | struct spi_device *spi = msg->spi; | 304 | bool cs_high = spi->mode & SPI_CS_HIGH; |
308 | struct spi_transfer *t; | ||
309 | int status = 0; | ||
310 | |||
311 | list_for_each_entry(t, &msg->transfers, transfer_list) { | ||
312 | bool cs_high = spi->mode & SPI_CS_HIGH; | ||
313 | u16 qmr = MCFQSPI_QMR_MSTR; | ||
314 | |||
315 | qmr |= t->bits_per_word << 10; | ||
316 | if (spi->mode & SPI_CPHA) | ||
317 | qmr |= MCFQSPI_QMR_CPHA; | ||
318 | if (spi->mode & SPI_CPOL) | ||
319 | qmr |= MCFQSPI_QMR_CPOL; | ||
320 | if (t->speed_hz) | ||
321 | qmr |= mcfqspi_qmr_baud(t->speed_hz); | ||
322 | else | ||
323 | qmr |= mcfqspi_qmr_baud(spi->max_speed_hz); | ||
324 | mcfqspi_wr_qmr(mcfqspi, qmr); | ||
325 | 305 | ||
306 | if (enable) | ||
326 | mcfqspi_cs_select(mcfqspi, spi->chip_select, cs_high); | 307 | mcfqspi_cs_select(mcfqspi, spi->chip_select, cs_high); |
308 | else | ||
309 | mcfqspi_cs_deselect(mcfqspi, spi->chip_select, cs_high); | ||
310 | } | ||
327 | 311 | ||
328 | mcfqspi_wr_qir(mcfqspi, MCFQSPI_QIR_SPIFE); | 312 | static int mcfqspi_transfer_one(struct spi_master *master, |
329 | if (t->bits_per_word == 8) | 313 | struct spi_device *spi, |
330 | mcfqspi_transfer_msg8(mcfqspi, t->len, t->tx_buf, | 314 | struct spi_transfer *t) |
331 | t->rx_buf); | 315 | { |
332 | else | 316 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); |
333 | mcfqspi_transfer_msg16(mcfqspi, t->len / 2, t->tx_buf, | 317 | u16 qmr = MCFQSPI_QMR_MSTR; |
334 | t->rx_buf); | 318 | |
335 | mcfqspi_wr_qir(mcfqspi, 0); | 319 | qmr |= t->bits_per_word << 10; |
336 | 320 | if (spi->mode & SPI_CPHA) | |
337 | if (t->delay_usecs) | 321 | qmr |= MCFQSPI_QMR_CPHA; |
338 | udelay(t->delay_usecs); | 322 | if (spi->mode & SPI_CPOL) |
339 | if (t->cs_change) { | 323 | qmr |= MCFQSPI_QMR_CPOL; |
340 | if (!list_is_last(&t->transfer_list, &msg->transfers)) | 324 | qmr |= mcfqspi_qmr_baud(t->speed_hz); |
341 | mcfqspi_cs_deselect(mcfqspi, spi->chip_select, | 325 | mcfqspi_wr_qmr(mcfqspi, qmr); |
342 | cs_high); | 326 | |
343 | } else { | 327 | mcfqspi_wr_qir(mcfqspi, MCFQSPI_QIR_SPIFE); |
344 | if (list_is_last(&t->transfer_list, &msg->transfers)) | 328 | if (t->bits_per_word == 8) |
345 | mcfqspi_cs_deselect(mcfqspi, spi->chip_select, | 329 | mcfqspi_transfer_msg8(mcfqspi, t->len, t->tx_buf, t->rx_buf); |
346 | cs_high); | 330 | else |
347 | } | 331 | mcfqspi_transfer_msg16(mcfqspi, t->len / 2, t->tx_buf, |
348 | msg->actual_length += t->len; | 332 | t->rx_buf); |
349 | } | 333 | mcfqspi_wr_qir(mcfqspi, 0); |
350 | msg->status = status; | ||
351 | spi_finalize_current_message(master); | ||
352 | |||
353 | return status; | ||
354 | 334 | ||
335 | return 0; | ||
355 | } | 336 | } |
356 | 337 | ||
357 | static int mcfqspi_setup(struct spi_device *spi) | 338 | static int mcfqspi_setup(struct spi_device *spi) |
358 | { | 339 | { |
359 | if (spi->chip_select >= spi->master->num_chipselect) { | ||
360 | dev_dbg(&spi->dev, "%d chip select is out of range\n", | ||
361 | spi->chip_select); | ||
362 | return -EINVAL; | ||
363 | } | ||
364 | |||
365 | mcfqspi_cs_deselect(spi_master_get_devdata(spi->master), | 340 | mcfqspi_cs_deselect(spi_master_get_devdata(spi->master), |
366 | spi->chip_select, spi->mode & SPI_CS_HIGH); | 341 | spi->chip_select, spi->mode & SPI_CS_HIGH); |
367 | 342 | ||
@@ -388,6 +363,11 @@ static int mcfqspi_probe(struct platform_device *pdev) | |||
388 | return -ENOENT; | 363 | return -ENOENT; |
389 | } | 364 | } |
390 | 365 | ||
366 | if (!pdata->cs_control) { | ||
367 | dev_dbg(&pdev->dev, "pdata->cs_control is NULL\n"); | ||
368 | return -EINVAL; | ||
369 | } | ||
370 | |||
391 | master = spi_alloc_master(&pdev->dev, sizeof(*mcfqspi)); | 371 | master = spi_alloc_master(&pdev->dev, sizeof(*mcfqspi)); |
392 | if (master == NULL) { | 372 | if (master == NULL) { |
393 | dev_dbg(&pdev->dev, "spi_alloc_master failed\n"); | 373 | dev_dbg(&pdev->dev, "spi_alloc_master failed\n"); |
@@ -436,12 +416,12 @@ static int mcfqspi_probe(struct platform_device *pdev) | |||
436 | } | 416 | } |
437 | 417 | ||
438 | init_waitqueue_head(&mcfqspi->waitq); | 418 | init_waitqueue_head(&mcfqspi->waitq); |
439 | mcfqspi->dev = &pdev->dev; | ||
440 | 419 | ||
441 | master->mode_bits = SPI_CS_HIGH | SPI_CPOL | SPI_CPHA; | 420 | master->mode_bits = SPI_CS_HIGH | SPI_CPOL | SPI_CPHA; |
442 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 16); | 421 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 16); |
443 | master->setup = mcfqspi_setup; | 422 | master->setup = mcfqspi_setup; |
444 | master->transfer_one_message = mcfqspi_transfer_one_message; | 423 | master->set_cs = mcfqspi_set_cs; |
424 | master->transfer_one = mcfqspi_transfer_one; | ||
445 | master->auto_runtime_pm = true; | 425 | master->auto_runtime_pm = true; |
446 | 426 | ||
447 | platform_set_drvdata(pdev, master); | 427 | platform_set_drvdata(pdev, master); |
@@ -451,7 +431,7 @@ static int mcfqspi_probe(struct platform_device *pdev) | |||
451 | dev_dbg(&pdev->dev, "spi_register_master failed\n"); | 431 | dev_dbg(&pdev->dev, "spi_register_master failed\n"); |
452 | goto fail2; | 432 | goto fail2; |
453 | } | 433 | } |
454 | pm_runtime_enable(mcfqspi->dev); | 434 | pm_runtime_enable(&pdev->dev); |
455 | 435 | ||
456 | dev_info(&pdev->dev, "Coldfire QSPI bus driver\n"); | 436 | dev_info(&pdev->dev, "Coldfire QSPI bus driver\n"); |
457 | 437 | ||
@@ -473,9 +453,8 @@ static int mcfqspi_remove(struct platform_device *pdev) | |||
473 | { | 453 | { |
474 | struct spi_master *master = platform_get_drvdata(pdev); | 454 | struct spi_master *master = platform_get_drvdata(pdev); |
475 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | 455 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); |
476 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
477 | 456 | ||
478 | pm_runtime_disable(mcfqspi->dev); | 457 | pm_runtime_disable(&pdev->dev); |
479 | /* disable the hardware (set the baud rate to 0) */ | 458 | /* disable the hardware (set the baud rate to 0) */ |
480 | mcfqspi_wr_qmr(mcfqspi, MCFQSPI_QMR_MSTR); | 459 | mcfqspi_wr_qmr(mcfqspi, MCFQSPI_QMR_MSTR); |
481 | 460 | ||
@@ -490,8 +469,11 @@ static int mcfqspi_suspend(struct device *dev) | |||
490 | { | 469 | { |
491 | struct spi_master *master = dev_get_drvdata(dev); | 470 | struct spi_master *master = dev_get_drvdata(dev); |
492 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | 471 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); |
472 | int ret; | ||
493 | 473 | ||
494 | spi_master_suspend(master); | 474 | ret = spi_master_suspend(master); |
475 | if (ret) | ||
476 | return ret; | ||
495 | 477 | ||
496 | clk_disable(mcfqspi->clk); | 478 | clk_disable(mcfqspi->clk); |
497 | 479 | ||
@@ -503,18 +485,17 @@ static int mcfqspi_resume(struct device *dev) | |||
503 | struct spi_master *master = dev_get_drvdata(dev); | 485 | struct spi_master *master = dev_get_drvdata(dev); |
504 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | 486 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); |
505 | 487 | ||
506 | spi_master_resume(master); | ||
507 | |||
508 | clk_enable(mcfqspi->clk); | 488 | clk_enable(mcfqspi->clk); |
509 | 489 | ||
510 | return 0; | 490 | return spi_master_resume(master); |
511 | } | 491 | } |
512 | #endif | 492 | #endif |
513 | 493 | ||
514 | #ifdef CONFIG_PM_RUNTIME | 494 | #ifdef CONFIG_PM_RUNTIME |
515 | static int mcfqspi_runtime_suspend(struct device *dev) | 495 | static int mcfqspi_runtime_suspend(struct device *dev) |
516 | { | 496 | { |
517 | struct mcfqspi *mcfqspi = dev_get_drvdata(dev); | 497 | struct spi_master *master = dev_get_drvdata(dev); |
498 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | ||
518 | 499 | ||
519 | clk_disable(mcfqspi->clk); | 500 | clk_disable(mcfqspi->clk); |
520 | 501 | ||
@@ -523,7 +504,8 @@ static int mcfqspi_runtime_suspend(struct device *dev) | |||
523 | 504 | ||
524 | static int mcfqspi_runtime_resume(struct device *dev) | 505 | static int mcfqspi_runtime_resume(struct device *dev) |
525 | { | 506 | { |
526 | struct mcfqspi *mcfqspi = dev_get_drvdata(dev); | 507 | struct spi_master *master = dev_get_drvdata(dev); |
508 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | ||
527 | 509 | ||
528 | clk_enable(mcfqspi->clk); | 510 | clk_enable(mcfqspi->clk); |
529 | 511 | ||
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 5e7389faa2a0..50f750989258 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -802,8 +802,7 @@ static int spi_davinci_get_pdata(struct platform_device *pdev, | |||
802 | pdata = &dspi->pdata; | 802 | pdata = &dspi->pdata; |
803 | 803 | ||
804 | pdata->version = SPI_VERSION_1; | 804 | pdata->version = SPI_VERSION_1; |
805 | match = of_match_device(of_match_ptr(davinci_spi_of_match), | 805 | match = of_match_device(davinci_spi_of_match, &pdev->dev); |
806 | &pdev->dev); | ||
807 | if (!match) | 806 | if (!match) |
808 | return -ENODEV; | 807 | return -ENODEV; |
809 | 808 | ||
@@ -824,7 +823,6 @@ static int spi_davinci_get_pdata(struct platform_device *pdev, | |||
824 | return 0; | 823 | return 0; |
825 | } | 824 | } |
826 | #else | 825 | #else |
827 | #define davinci_spi_of_match NULL | ||
828 | static struct davinci_spi_platform_data | 826 | static struct davinci_spi_platform_data |
829 | *spi_davinci_get_pdata(struct platform_device *pdev, | 827 | *spi_davinci_get_pdata(struct platform_device *pdev, |
830 | struct davinci_spi *dspi) | 828 | struct davinci_spi *dspi) |
@@ -864,10 +862,6 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
864 | platform_set_drvdata(pdev, master); | 862 | platform_set_drvdata(pdev, master); |
865 | 863 | ||
866 | dspi = spi_master_get_devdata(master); | 864 | dspi = spi_master_get_devdata(master); |
867 | if (dspi == NULL) { | ||
868 | ret = -ENOENT; | ||
869 | goto free_master; | ||
870 | } | ||
871 | 865 | ||
872 | if (dev_get_platdata(&pdev->dev)) { | 866 | if (dev_get_platdata(&pdev->dev)) { |
873 | pdata = dev_get_platdata(&pdev->dev); | 867 | pdata = dev_get_platdata(&pdev->dev); |
@@ -908,10 +902,6 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
908 | goto free_master; | 902 | goto free_master; |
909 | 903 | ||
910 | dspi->bitbang.master = master; | 904 | dspi->bitbang.master = master; |
911 | if (dspi->bitbang.master == NULL) { | ||
912 | ret = -ENODEV; | ||
913 | goto free_master; | ||
914 | } | ||
915 | 905 | ||
916 | dspi->clk = devm_clk_get(&pdev->dev, NULL); | 906 | dspi->clk = devm_clk_get(&pdev->dev, NULL); |
917 | if (IS_ERR(dspi->clk)) { | 907 | if (IS_ERR(dspi->clk)) { |
@@ -1040,7 +1030,7 @@ static struct platform_driver davinci_spi_driver = { | |||
1040 | .driver = { | 1030 | .driver = { |
1041 | .name = "spi_davinci", | 1031 | .name = "spi_davinci", |
1042 | .owner = THIS_MODULE, | 1032 | .owner = THIS_MODULE, |
1043 | .of_match_table = davinci_spi_of_match, | 1033 | .of_match_table = of_match_ptr(davinci_spi_of_match), |
1044 | }, | 1034 | }, |
1045 | .probe = davinci_spi_probe, | 1035 | .probe = davinci_spi_probe, |
1046 | .remove = davinci_spi_remove, | 1036 | .remove = davinci_spi_remove, |
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 9af56cdf1540..1492f5ee9aaa 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c | |||
@@ -66,7 +66,7 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) | |||
66 | if (ret) | 66 | if (ret) |
67 | return ret; | 67 | return ret; |
68 | 68 | ||
69 | dws->bus_num = 0; | 69 | dws->bus_num = pdev->id; |
70 | dws->num_cs = 4; | 70 | dws->num_cs = 4; |
71 | dws->max_freq = clk_get_rate(dwsmmio->clk); | 71 | dws->max_freq = clk_get_rate(dwsmmio->clk); |
72 | 72 | ||
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index bf98d63d92b3..712ac5629cd4 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -276,8 +276,7 @@ static void giveback(struct dw_spi *dws) | |||
276 | queue_work(dws->workqueue, &dws->pump_messages); | 276 | queue_work(dws->workqueue, &dws->pump_messages); |
277 | spin_unlock_irqrestore(&dws->lock, flags); | 277 | spin_unlock_irqrestore(&dws->lock, flags); |
278 | 278 | ||
279 | last_transfer = list_entry(msg->transfers.prev, | 279 | last_transfer = list_last_entry(&msg->transfers, struct spi_transfer, |
280 | struct spi_transfer, | ||
281 | transfer_list); | 280 | transfer_list); |
282 | 281 | ||
283 | if (!last_transfer->cs_change && dws->cs_control) | 282 | if (!last_transfer->cs_change && dws->cs_control) |
@@ -439,12 +438,6 @@ static void pump_transfers(unsigned long data) | |||
439 | 438 | ||
440 | if (transfer->speed_hz != speed) { | 439 | if (transfer->speed_hz != speed) { |
441 | speed = transfer->speed_hz; | 440 | speed = transfer->speed_hz; |
442 | if (speed > dws->max_freq) { | ||
443 | printk(KERN_ERR "MRST SPI0: unsupported" | ||
444 | "freq: %dHz\n", speed); | ||
445 | message->status = -EIO; | ||
446 | goto early_exit; | ||
447 | } | ||
448 | 441 | ||
449 | /* clk_div doesn't support odd number */ | 442 | /* clk_div doesn't support odd number */ |
450 | clk_div = dws->max_freq / speed; | 443 | clk_div = dws->max_freq / speed; |
@@ -671,12 +664,6 @@ static int dw_spi_setup(struct spi_device *spi) | |||
671 | return 0; | 664 | return 0; |
672 | } | 665 | } |
673 | 666 | ||
674 | static void dw_spi_cleanup(struct spi_device *spi) | ||
675 | { | ||
676 | struct chip_data *chip = spi_get_ctldata(spi); | ||
677 | kfree(chip); | ||
678 | } | ||
679 | |||
680 | static int init_queue(struct dw_spi *dws) | 667 | static int init_queue(struct dw_spi *dws) |
681 | { | 668 | { |
682 | INIT_LIST_HEAD(&dws->queue); | 669 | INIT_LIST_HEAD(&dws->queue); |
@@ -806,9 +793,9 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
806 | master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); | 793 | master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); |
807 | master->bus_num = dws->bus_num; | 794 | master->bus_num = dws->bus_num; |
808 | master->num_chipselect = dws->num_cs; | 795 | master->num_chipselect = dws->num_cs; |
809 | master->cleanup = dw_spi_cleanup; | ||
810 | master->setup = dw_spi_setup; | 796 | master->setup = dw_spi_setup; |
811 | master->transfer = dw_spi_transfer; | 797 | master->transfer = dw_spi_transfer; |
798 | master->max_speed_hz = dws->max_freq; | ||
812 | 799 | ||
813 | /* Basic HW init */ | 800 | /* Basic HW init */ |
814 | spi_hw_init(dws); | 801 | spi_hw_init(dws); |
diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index d4d3cc534792..be44a3eeb5e8 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c | |||
@@ -198,7 +198,7 @@ static int efm32_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
198 | 198 | ||
199 | efm32_spi_filltx(ddata); | 199 | efm32_spi_filltx(ddata); |
200 | 200 | ||
201 | init_completion(&ddata->done); | 201 | reinit_completion(&ddata->done); |
202 | 202 | ||
203 | efm32_spi_write32(ddata, REG_IF_TXBL | REG_IF_RXDATAV, REG_IEN); | 203 | efm32_spi_write32(ddata, REG_IF_TXBL | REG_IF_RXDATAV, REG_IEN); |
204 | 204 | ||
@@ -287,17 +287,17 @@ static u32 efm32_spi_get_configured_location(struct efm32_spi_ddata *ddata) | |||
287 | return (reg & REG_ROUTE_LOCATION__MASK) >> __ffs(REG_ROUTE_LOCATION__MASK); | 287 | return (reg & REG_ROUTE_LOCATION__MASK) >> __ffs(REG_ROUTE_LOCATION__MASK); |
288 | } | 288 | } |
289 | 289 | ||
290 | static int efm32_spi_probe_dt(struct platform_device *pdev, | 290 | static void efm32_spi_probe_dt(struct platform_device *pdev, |
291 | struct spi_master *master, struct efm32_spi_ddata *ddata) | 291 | struct spi_master *master, struct efm32_spi_ddata *ddata) |
292 | { | 292 | { |
293 | struct device_node *np = pdev->dev.of_node; | 293 | struct device_node *np = pdev->dev.of_node; |
294 | u32 location; | 294 | u32 location; |
295 | int ret; | 295 | int ret; |
296 | 296 | ||
297 | if (!np) | 297 | ret = of_property_read_u32(np, "efm32,location", &location); |
298 | return 1; | 298 | if (ret) |
299 | 299 | /* fall back to old and (wrongly) generic property "location" */ | |
300 | ret = of_property_read_u32(np, "location", &location); | 300 | ret = of_property_read_u32(np, "location", &location); |
301 | if (!ret) { | 301 | if (!ret) { |
302 | dev_dbg(&pdev->dev, "using location %u\n", location); | 302 | dev_dbg(&pdev->dev, "using location %u\n", location); |
303 | } else { | 303 | } else { |
@@ -308,11 +308,6 @@ static int efm32_spi_probe_dt(struct platform_device *pdev, | |||
308 | } | 308 | } |
309 | 309 | ||
310 | ddata->pdata.location = location; | 310 | ddata->pdata.location = location; |
311 | |||
312 | /* spi core takes care about the bus number using an alias */ | ||
313 | master->bus_num = -1; | ||
314 | |||
315 | return 0; | ||
316 | } | 311 | } |
317 | 312 | ||
318 | static int efm32_spi_probe(struct platform_device *pdev) | 313 | static int efm32_spi_probe(struct platform_device *pdev) |
@@ -322,9 +317,14 @@ static int efm32_spi_probe(struct platform_device *pdev) | |||
322 | int ret; | 317 | int ret; |
323 | struct spi_master *master; | 318 | struct spi_master *master; |
324 | struct device_node *np = pdev->dev.of_node; | 319 | struct device_node *np = pdev->dev.of_node; |
325 | unsigned int num_cs, i; | 320 | int num_cs, i; |
321 | |||
322 | if (!np) | ||
323 | return -EINVAL; | ||
326 | 324 | ||
327 | num_cs = of_gpio_named_count(np, "cs-gpios"); | 325 | num_cs = of_gpio_named_count(np, "cs-gpios"); |
326 | if (num_cs < 0) | ||
327 | return num_cs; | ||
328 | 328 | ||
329 | master = spi_alloc_master(&pdev->dev, | 329 | master = spi_alloc_master(&pdev->dev, |
330 | sizeof(*ddata) + num_cs * sizeof(unsigned)); | 330 | sizeof(*ddata) + num_cs * sizeof(unsigned)); |
@@ -349,6 +349,7 @@ static int efm32_spi_probe(struct platform_device *pdev) | |||
349 | ddata->bitbang.txrx_bufs = efm32_spi_txrx_bufs; | 349 | ddata->bitbang.txrx_bufs = efm32_spi_txrx_bufs; |
350 | 350 | ||
351 | spin_lock_init(&ddata->lock); | 351 | spin_lock_init(&ddata->lock); |
352 | init_completion(&ddata->done); | ||
352 | 353 | ||
353 | ddata->clk = devm_clk_get(&pdev->dev, NULL); | 354 | ddata->clk = devm_clk_get(&pdev->dev, NULL); |
354 | if (IS_ERR(ddata->clk)) { | 355 | if (IS_ERR(ddata->clk)) { |
@@ -415,23 +416,7 @@ static int efm32_spi_probe(struct platform_device *pdev) | |||
415 | goto err; | 416 | goto err; |
416 | } | 417 | } |
417 | 418 | ||
418 | ret = efm32_spi_probe_dt(pdev, master, ddata); | 419 | efm32_spi_probe_dt(pdev, master, ddata); |
419 | if (ret > 0) { | ||
420 | /* not created by device tree */ | ||
421 | const struct efm32_spi_pdata *pdata = | ||
422 | dev_get_platdata(&pdev->dev); | ||
423 | |||
424 | if (pdata) | ||
425 | ddata->pdata = *pdata; | ||
426 | else | ||
427 | ddata->pdata.location = | ||
428 | efm32_spi_get_configured_location(ddata); | ||
429 | |||
430 | master->bus_num = pdev->id; | ||
431 | |||
432 | } else if (ret < 0) { | ||
433 | goto err_disable_clk; | ||
434 | } | ||
435 | 420 | ||
436 | efm32_spi_write32(ddata, 0, REG_IEN); | 421 | efm32_spi_write32(ddata, 0, REG_IEN); |
437 | efm32_spi_write32(ddata, REG_ROUTE_TXPEN | REG_ROUTE_RXPEN | | 422 | efm32_spi_write32(ddata, REG_ROUTE_TXPEN | REG_ROUTE_RXPEN | |
@@ -487,6 +472,9 @@ static int efm32_spi_remove(struct platform_device *pdev) | |||
487 | 472 | ||
488 | static const struct of_device_id efm32_spi_dt_ids[] = { | 473 | static const struct of_device_id efm32_spi_dt_ids[] = { |
489 | { | 474 | { |
475 | .compatible = "energymicro,efm32-spi", | ||
476 | }, { | ||
477 | /* doesn't follow the "vendor,device" scheme, don't use */ | ||
490 | .compatible = "efm32,spi", | 478 | .compatible = "efm32,spi", |
491 | }, { | 479 | }, { |
492 | /* sentinel */ | 480 | /* sentinel */ |
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index 1bfaed6e4073..2f675d32df0e 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c | |||
@@ -73,8 +73,6 @@ | |||
73 | * @clk: clock for the controller | 73 | * @clk: clock for the controller |
74 | * @regs_base: pointer to ioremap()'d registers | 74 | * @regs_base: pointer to ioremap()'d registers |
75 | * @sspdr_phys: physical address of the SSPDR register | 75 | * @sspdr_phys: physical address of the SSPDR register |
76 | * @min_rate: minimum clock rate (in Hz) supported by the controller | ||
77 | * @max_rate: maximum clock rate (in Hz) supported by the controller | ||
78 | * @wait: wait here until given transfer is completed | 76 | * @wait: wait here until given transfer is completed |
79 | * @current_msg: message that is currently processed (or %NULL if none) | 77 | * @current_msg: message that is currently processed (or %NULL if none) |
80 | * @tx: current byte in transfer to transmit | 78 | * @tx: current byte in transfer to transmit |
@@ -95,8 +93,6 @@ struct ep93xx_spi { | |||
95 | struct clk *clk; | 93 | struct clk *clk; |
96 | void __iomem *regs_base; | 94 | void __iomem *regs_base; |
97 | unsigned long sspdr_phys; | 95 | unsigned long sspdr_phys; |
98 | unsigned long min_rate; | ||
99 | unsigned long max_rate; | ||
100 | struct completion wait; | 96 | struct completion wait; |
101 | struct spi_message *current_msg; | 97 | struct spi_message *current_msg; |
102 | size_t tx; | 98 | size_t tx; |
@@ -199,9 +195,9 @@ static void ep93xx_spi_disable_interrupts(const struct ep93xx_spi *espi) | |||
199 | * @div_scr: pointer to return the scr divider | 195 | * @div_scr: pointer to return the scr divider |
200 | */ | 196 | */ |
201 | static int ep93xx_spi_calc_divisors(const struct ep93xx_spi *espi, | 197 | static int ep93xx_spi_calc_divisors(const struct ep93xx_spi *espi, |
202 | unsigned long rate, | 198 | u32 rate, u8 *div_cpsr, u8 *div_scr) |
203 | u8 *div_cpsr, u8 *div_scr) | ||
204 | { | 199 | { |
200 | struct spi_master *master = platform_get_drvdata(espi->pdev); | ||
205 | unsigned long spi_clk_rate = clk_get_rate(espi->clk); | 201 | unsigned long spi_clk_rate = clk_get_rate(espi->clk); |
206 | int cpsr, scr; | 202 | int cpsr, scr; |
207 | 203 | ||
@@ -210,7 +206,7 @@ static int ep93xx_spi_calc_divisors(const struct ep93xx_spi *espi, | |||
210 | * controller. Note that minimum value is already checked in | 206 | * controller. Note that minimum value is already checked in |
211 | * ep93xx_spi_transfer_one_message(). | 207 | * ep93xx_spi_transfer_one_message(). |
212 | */ | 208 | */ |
213 | rate = clamp(rate, espi->min_rate, espi->max_rate); | 209 | rate = clamp(rate, master->min_speed_hz, master->max_speed_hz); |
214 | 210 | ||
215 | /* | 211 | /* |
216 | * Calculate divisors so that we can get speed according the | 212 | * Calculate divisors so that we can get speed according the |
@@ -735,13 +731,6 @@ static int ep93xx_spi_transfer_one_message(struct spi_master *master, | |||
735 | struct spi_message *msg) | 731 | struct spi_message *msg) |
736 | { | 732 | { |
737 | struct ep93xx_spi *espi = spi_master_get_devdata(master); | 733 | struct ep93xx_spi *espi = spi_master_get_devdata(master); |
738 | struct spi_transfer *t; | ||
739 | |||
740 | /* first validate each transfer */ | ||
741 | list_for_each_entry(t, &msg->transfers, transfer_list) { | ||
742 | if (t->speed_hz < espi->min_rate) | ||
743 | return -EINVAL; | ||
744 | } | ||
745 | 734 | ||
746 | msg->state = NULL; | 735 | msg->state = NULL; |
747 | msg->status = 0; | 736 | msg->status = 0; |
@@ -917,8 +906,8 @@ static int ep93xx_spi_probe(struct platform_device *pdev) | |||
917 | * Calculate maximum and minimum supported clock rates | 906 | * Calculate maximum and minimum supported clock rates |
918 | * for the controller. | 907 | * for the controller. |
919 | */ | 908 | */ |
920 | espi->max_rate = clk_get_rate(espi->clk) / 2; | 909 | master->max_speed_hz = clk_get_rate(espi->clk) / 2; |
921 | espi->min_rate = clk_get_rate(espi->clk) / (254 * 256); | 910 | master->min_speed_hz = clk_get_rate(espi->clk) / (254 * 256); |
922 | espi->pdev = pdev; | 911 | espi->pdev = pdev; |
923 | 912 | ||
924 | espi->sspdr_phys = res->start + SSPDR; | 913 | espi->sspdr_phys = res->start + SSPDR; |
diff --git a/drivers/spi/spi-falcon.c b/drivers/spi/spi-falcon.c index dd5bd468e962..09965f069a1c 100644 --- a/drivers/spi/spi-falcon.c +++ b/drivers/spi/spi-falcon.c | |||
@@ -312,9 +312,6 @@ static int falcon_sflash_setup(struct spi_device *spi) | |||
312 | unsigned int i; | 312 | unsigned int i; |
313 | unsigned long flags; | 313 | unsigned long flags; |
314 | 314 | ||
315 | if (spi->chip_select > 0) | ||
316 | return -ENODEV; | ||
317 | |||
318 | spin_lock_irqsave(&ebu_lock, flags); | 315 | spin_lock_irqsave(&ebu_lock, flags); |
319 | 316 | ||
320 | if (spi->max_speed_hz >= CLOCK_100M) { | 317 | if (spi->max_speed_hz >= CLOCK_100M) { |
@@ -422,9 +419,7 @@ static int falcon_sflash_probe(struct platform_device *pdev) | |||
422 | priv->master = master; | 419 | priv->master = master; |
423 | 420 | ||
424 | master->mode_bits = SPI_MODE_3; | 421 | master->mode_bits = SPI_MODE_3; |
425 | master->num_chipselect = 1; | ||
426 | master->flags = SPI_MASTER_HALF_DUPLEX; | 422 | master->flags = SPI_MASTER_HALF_DUPLEX; |
427 | master->bus_num = -1; | ||
428 | master->setup = falcon_sflash_setup; | 423 | master->setup = falcon_sflash_setup; |
429 | master->prepare_transfer_hardware = falcon_sflash_prepare_xfer; | 424 | master->prepare_transfer_hardware = falcon_sflash_prepare_xfer; |
430 | master->transfer_one_message = falcon_sflash_xfer_one; | 425 | master->transfer_one_message = falcon_sflash_xfer_one; |
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index ec79f726672a..d565eeee3bd8 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/regmap.h> | ||
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
22 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
23 | #include <linux/io.h> | 24 | #include <linux/io.h> |
@@ -108,11 +109,11 @@ struct fsl_dspi { | |||
108 | struct spi_bitbang bitbang; | 109 | struct spi_bitbang bitbang; |
109 | struct platform_device *pdev; | 110 | struct platform_device *pdev; |
110 | 111 | ||
111 | void __iomem *base; | 112 | struct regmap *regmap; |
112 | int irq; | 113 | int irq; |
113 | struct clk *clk; | 114 | struct clk *clk; |
114 | 115 | ||
115 | struct spi_transfer *cur_transfer; | 116 | struct spi_transfer *cur_transfer; |
116 | struct chip_data *cur_chip; | 117 | struct chip_data *cur_chip; |
117 | size_t len; | 118 | size_t len; |
118 | void *tx; | 119 | void *tx; |
@@ -123,24 +124,17 @@ struct fsl_dspi { | |||
123 | u8 cs; | 124 | u8 cs; |
124 | u16 void_write_data; | 125 | u16 void_write_data; |
125 | 126 | ||
126 | wait_queue_head_t waitq; | 127 | wait_queue_head_t waitq; |
127 | u32 waitflags; | 128 | u32 waitflags; |
128 | }; | 129 | }; |
129 | 130 | ||
130 | static inline int is_double_byte_mode(struct fsl_dspi *dspi) | 131 | static inline int is_double_byte_mode(struct fsl_dspi *dspi) |
131 | { | 132 | { |
132 | return ((readl(dspi->base + SPI_CTAR(dspi->cs)) & SPI_FRAME_BITS_MASK) | 133 | unsigned int val; |
133 | == SPI_FRAME_BITS(8)) ? 0 : 1; | ||
134 | } | ||
135 | 134 | ||
136 | static void set_bit_mode(struct fsl_dspi *dspi, unsigned char bits) | 135 | regmap_read(dspi->regmap, SPI_CTAR(dspi->cs), &val); |
137 | { | ||
138 | u32 temp; | ||
139 | 136 | ||
140 | temp = readl(dspi->base + SPI_CTAR(dspi->cs)); | 137 | return ((val & SPI_FRAME_BITS_MASK) == SPI_FRAME_BITS(8)) ? 0 : 1; |
141 | temp &= ~SPI_FRAME_BITS_MASK; | ||
142 | temp |= SPI_FRAME_BITS(bits); | ||
143 | writel(temp, dspi->base + SPI_CTAR(dspi->cs)); | ||
144 | } | 138 | } |
145 | 139 | ||
146 | static void hz_to_spi_baud(char *pbr, char *br, int speed_hz, | 140 | static void hz_to_spi_baud(char *pbr, char *br, int speed_hz, |
@@ -188,7 +182,8 @@ static int dspi_transfer_write(struct fsl_dspi *dspi) | |||
188 | */ | 182 | */ |
189 | if (tx_word && (dspi->len == 1)) { | 183 | if (tx_word && (dspi->len == 1)) { |
190 | dspi->dataflags |= TRAN_STATE_WORD_ODD_NUM; | 184 | dspi->dataflags |= TRAN_STATE_WORD_ODD_NUM; |
191 | set_bit_mode(dspi, 8); | 185 | regmap_update_bits(dspi->regmap, SPI_CTAR(dspi->cs), |
186 | SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(8)); | ||
192 | tx_word = 0; | 187 | tx_word = 0; |
193 | } | 188 | } |
194 | 189 | ||
@@ -238,7 +233,8 @@ static int dspi_transfer_write(struct fsl_dspi *dspi) | |||
238 | dspi_pushr |= SPI_PUSHR_CTCNT; /* clear counter */ | 233 | dspi_pushr |= SPI_PUSHR_CTCNT; /* clear counter */ |
239 | } | 234 | } |
240 | 235 | ||
241 | writel(dspi_pushr, dspi->base + SPI_PUSHR); | 236 | regmap_write(dspi->regmap, SPI_PUSHR, dspi_pushr); |
237 | |||
242 | tx_count++; | 238 | tx_count++; |
243 | } | 239 | } |
244 | 240 | ||
@@ -253,17 +249,23 @@ static int dspi_transfer_read(struct fsl_dspi *dspi) | |||
253 | while ((dspi->rx < dspi->rx_end) | 249 | while ((dspi->rx < dspi->rx_end) |
254 | && (rx_count < DSPI_FIFO_SIZE)) { | 250 | && (rx_count < DSPI_FIFO_SIZE)) { |
255 | if (rx_word) { | 251 | if (rx_word) { |
252 | unsigned int val; | ||
253 | |||
256 | if ((dspi->rx_end - dspi->rx) == 1) | 254 | if ((dspi->rx_end - dspi->rx) == 1) |
257 | break; | 255 | break; |
258 | 256 | ||
259 | d = SPI_POPR_RXDATA(readl(dspi->base + SPI_POPR)); | 257 | regmap_read(dspi->regmap, SPI_POPR, &val); |
258 | d = SPI_POPR_RXDATA(val); | ||
260 | 259 | ||
261 | if (!(dspi->dataflags & TRAN_STATE_RX_VOID)) | 260 | if (!(dspi->dataflags & TRAN_STATE_RX_VOID)) |
262 | *(u16 *)dspi->rx = d; | 261 | *(u16 *)dspi->rx = d; |
263 | dspi->rx += 2; | 262 | dspi->rx += 2; |
264 | 263 | ||
265 | } else { | 264 | } else { |
266 | d = SPI_POPR_RXDATA(readl(dspi->base + SPI_POPR)); | 265 | unsigned int val; |
266 | |||
267 | regmap_read(dspi->regmap, SPI_POPR, &val); | ||
268 | d = SPI_POPR_RXDATA(val); | ||
267 | if (!(dspi->dataflags & TRAN_STATE_RX_VOID)) | 269 | if (!(dspi->dataflags & TRAN_STATE_RX_VOID)) |
268 | *(u8 *)dspi->rx = d; | 270 | *(u8 *)dspi->rx = d; |
269 | dspi->rx++; | 271 | dspi->rx++; |
@@ -295,13 +297,13 @@ static int dspi_txrx_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
295 | if (!dspi->tx) | 297 | if (!dspi->tx) |
296 | dspi->dataflags |= TRAN_STATE_TX_VOID; | 298 | dspi->dataflags |= TRAN_STATE_TX_VOID; |
297 | 299 | ||
298 | writel(dspi->cur_chip->mcr_val, dspi->base + SPI_MCR); | 300 | regmap_write(dspi->regmap, SPI_MCR, dspi->cur_chip->mcr_val); |
299 | writel(dspi->cur_chip->ctar_val, dspi->base + SPI_CTAR(dspi->cs)); | 301 | regmap_write(dspi->regmap, SPI_CTAR(dspi->cs), dspi->cur_chip->ctar_val); |
300 | writel(SPI_RSER_EOQFE, dspi->base + SPI_RSER); | 302 | regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE); |
301 | 303 | ||
302 | if (t->speed_hz) | 304 | if (t->speed_hz) |
303 | writel(dspi->cur_chip->ctar_val, | 305 | regmap_write(dspi->regmap, SPI_CTAR(dspi->cs), |
304 | dspi->base + SPI_CTAR(dspi->cs)); | 306 | dspi->cur_chip->ctar_val); |
305 | 307 | ||
306 | dspi_transfer_write(dspi); | 308 | dspi_transfer_write(dspi); |
307 | 309 | ||
@@ -315,7 +317,9 @@ static int dspi_txrx_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
315 | static void dspi_chipselect(struct spi_device *spi, int value) | 317 | static void dspi_chipselect(struct spi_device *spi, int value) |
316 | { | 318 | { |
317 | struct fsl_dspi *dspi = spi_master_get_devdata(spi->master); | 319 | struct fsl_dspi *dspi = spi_master_get_devdata(spi->master); |
318 | u32 pushr = readl(dspi->base + SPI_PUSHR); | 320 | unsigned int pushr; |
321 | |||
322 | regmap_read(dspi->regmap, SPI_PUSHR, &pushr); | ||
319 | 323 | ||
320 | switch (value) { | 324 | switch (value) { |
321 | case BITBANG_CS_ACTIVE: | 325 | case BITBANG_CS_ACTIVE: |
@@ -326,7 +330,7 @@ static void dspi_chipselect(struct spi_device *spi, int value) | |||
326 | break; | 330 | break; |
327 | } | 331 | } |
328 | 332 | ||
329 | writel(pushr, dspi->base + SPI_PUSHR); | 333 | regmap_write(dspi->regmap, SPI_PUSHR, pushr); |
330 | } | 334 | } |
331 | 335 | ||
332 | static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | 336 | static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) |
@@ -338,7 +342,8 @@ static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
338 | /* Only alloc on first setup */ | 342 | /* Only alloc on first setup */ |
339 | chip = spi_get_ctldata(spi); | 343 | chip = spi_get_ctldata(spi); |
340 | if (chip == NULL) { | 344 | if (chip == NULL) { |
341 | chip = kcalloc(1, sizeof(struct chip_data), GFP_KERNEL); | 345 | chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), |
346 | GFP_KERNEL); | ||
342 | if (!chip) | 347 | if (!chip) |
343 | return -ENOMEM; | 348 | return -ENOMEM; |
344 | } | 349 | } |
@@ -349,7 +354,6 @@ static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
349 | fmsz = spi->bits_per_word - 1; | 354 | fmsz = spi->bits_per_word - 1; |
350 | } else { | 355 | } else { |
351 | pr_err("Invalid wordsize\n"); | 356 | pr_err("Invalid wordsize\n"); |
352 | kfree(chip); | ||
353 | return -ENODEV; | 357 | return -ENODEV; |
354 | } | 358 | } |
355 | 359 | ||
@@ -382,13 +386,15 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) | |||
382 | { | 386 | { |
383 | struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id; | 387 | struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id; |
384 | 388 | ||
385 | writel(SPI_SR_EOQF, dspi->base + SPI_SR); | 389 | regmap_write(dspi->regmap, SPI_SR, SPI_SR_EOQF); |
386 | 390 | ||
387 | dspi_transfer_read(dspi); | 391 | dspi_transfer_read(dspi); |
388 | 392 | ||
389 | if (!dspi->len) { | 393 | if (!dspi->len) { |
390 | if (dspi->dataflags & TRAN_STATE_WORD_ODD_NUM) | 394 | if (dspi->dataflags & TRAN_STATE_WORD_ODD_NUM) |
391 | set_bit_mode(dspi, 16); | 395 | regmap_update_bits(dspi->regmap, SPI_CTAR(dspi->cs), |
396 | SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(16)); | ||
397 | |||
392 | dspi->waitflags = 1; | 398 | dspi->waitflags = 1; |
393 | wake_up_interruptible(&dspi->waitq); | 399 | wake_up_interruptible(&dspi->waitq); |
394 | } else { | 400 | } else { |
@@ -420,7 +426,6 @@ static int dspi_suspend(struct device *dev) | |||
420 | 426 | ||
421 | static int dspi_resume(struct device *dev) | 427 | static int dspi_resume(struct device *dev) |
422 | { | 428 | { |
423 | |||
424 | struct spi_master *master = dev_get_drvdata(dev); | 429 | struct spi_master *master = dev_get_drvdata(dev); |
425 | struct fsl_dspi *dspi = spi_master_get_devdata(master); | 430 | struct fsl_dspi *dspi = spi_master_get_devdata(master); |
426 | 431 | ||
@@ -431,8 +436,13 @@ static int dspi_resume(struct device *dev) | |||
431 | } | 436 | } |
432 | #endif /* CONFIG_PM_SLEEP */ | 437 | #endif /* CONFIG_PM_SLEEP */ |
433 | 438 | ||
434 | static const struct dev_pm_ops dspi_pm = { | 439 | static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume); |
435 | SET_SYSTEM_SLEEP_PM_OPS(dspi_suspend, dspi_resume) | 440 | |
441 | static struct regmap_config dspi_regmap_config = { | ||
442 | .reg_bits = 32, | ||
443 | .val_bits = 32, | ||
444 | .reg_stride = 4, | ||
445 | .max_register = 0x88, | ||
436 | }; | 446 | }; |
437 | 447 | ||
438 | static int dspi_probe(struct platform_device *pdev) | 448 | static int dspi_probe(struct platform_device *pdev) |
@@ -441,6 +451,7 @@ static int dspi_probe(struct platform_device *pdev) | |||
441 | struct spi_master *master; | 451 | struct spi_master *master; |
442 | struct fsl_dspi *dspi; | 452 | struct fsl_dspi *dspi; |
443 | struct resource *res; | 453 | struct resource *res; |
454 | void __iomem *base; | ||
444 | int ret = 0, cs_num, bus_num; | 455 | int ret = 0, cs_num, bus_num; |
445 | 456 | ||
446 | master = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); | 457 | master = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); |
@@ -475,12 +486,24 @@ static int dspi_probe(struct platform_device *pdev) | |||
475 | master->bus_num = bus_num; | 486 | master->bus_num = bus_num; |
476 | 487 | ||
477 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 488 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
478 | dspi->base = devm_ioremap_resource(&pdev->dev, res); | 489 | base = devm_ioremap_resource(&pdev->dev, res); |
479 | if (IS_ERR(dspi->base)) { | 490 | if (IS_ERR(base)) { |
480 | ret = PTR_ERR(dspi->base); | 491 | ret = PTR_ERR(base); |
481 | goto out_master_put; | 492 | goto out_master_put; |
482 | } | 493 | } |
483 | 494 | ||
495 | dspi_regmap_config.lock_arg = dspi; | ||
496 | dspi_regmap_config.val_format_endian = | ||
497 | of_property_read_bool(np, "big-endian") | ||
498 | ? REGMAP_ENDIAN_BIG : REGMAP_ENDIAN_DEFAULT; | ||
499 | dspi->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "dspi", base, | ||
500 | &dspi_regmap_config); | ||
501 | if (IS_ERR(dspi->regmap)) { | ||
502 | dev_err(&pdev->dev, "failed to init regmap: %ld\n", | ||
503 | PTR_ERR(dspi->regmap)); | ||
504 | return PTR_ERR(dspi->regmap); | ||
505 | } | ||
506 | |||
484 | dspi->irq = platform_get_irq(pdev, 0); | 507 | dspi->irq = platform_get_irq(pdev, 0); |
485 | if (dspi->irq < 0) { | 508 | if (dspi->irq < 0) { |
486 | dev_err(&pdev->dev, "can't get platform irq\n"); | 509 | dev_err(&pdev->dev, "can't get platform irq\n"); |
@@ -504,7 +527,7 @@ static int dspi_probe(struct platform_device *pdev) | |||
504 | clk_prepare_enable(dspi->clk); | 527 | clk_prepare_enable(dspi->clk); |
505 | 528 | ||
506 | init_waitqueue_head(&dspi->waitq); | 529 | init_waitqueue_head(&dspi->waitq); |
507 | platform_set_drvdata(pdev, dspi); | 530 | platform_set_drvdata(pdev, master); |
508 | 531 | ||
509 | ret = spi_bitbang_start(&dspi->bitbang); | 532 | ret = spi_bitbang_start(&dspi->bitbang); |
510 | if (ret != 0) { | 533 | if (ret != 0) { |
@@ -525,7 +548,8 @@ out_master_put: | |||
525 | 548 | ||
526 | static int dspi_remove(struct platform_device *pdev) | 549 | static int dspi_remove(struct platform_device *pdev) |
527 | { | 550 | { |
528 | struct fsl_dspi *dspi = platform_get_drvdata(pdev); | 551 | struct spi_master *master = platform_get_drvdata(pdev); |
552 | struct fsl_dspi *dspi = spi_master_get_devdata(master); | ||
529 | 553 | ||
530 | /* Disconnect from the SPI framework */ | 554 | /* Disconnect from the SPI framework */ |
531 | spi_bitbang_stop(&dspi->bitbang); | 555 | spi_bitbang_stop(&dspi->bitbang); |
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 428dc7a6b62e..6fb2b75df821 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -219,13 +219,8 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
219 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 219 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
220 | struct fsl_espi_reg *reg_base = mpc8xxx_spi->reg_base; | 220 | struct fsl_espi_reg *reg_base = mpc8xxx_spi->reg_base; |
221 | unsigned int len = t->len; | 221 | unsigned int len = t->len; |
222 | u8 bits_per_word; | ||
223 | int ret; | 222 | int ret; |
224 | 223 | ||
225 | bits_per_word = spi->bits_per_word; | ||
226 | if (t->bits_per_word) | ||
227 | bits_per_word = t->bits_per_word; | ||
228 | |||
229 | mpc8xxx_spi->len = t->len; | 224 | mpc8xxx_spi->len = t->len; |
230 | len = roundup(len, 4) / 4; | 225 | len = roundup(len, 4) / 4; |
231 | 226 | ||
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index 0b75f26158ab..e5d45fca3551 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c | |||
@@ -200,7 +200,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) | |||
200 | const void *prop; | 200 | const void *prop; |
201 | int ret = -ENOMEM; | 201 | int ret = -ENOMEM; |
202 | 202 | ||
203 | pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL); | 203 | pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL); |
204 | if (!pinfo) | 204 | if (!pinfo) |
205 | return -ENOMEM; | 205 | return -ENOMEM; |
206 | 206 | ||
@@ -215,15 +215,13 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) | |||
215 | pdata->sysclk = get_brgfreq(); | 215 | pdata->sysclk = get_brgfreq(); |
216 | if (pdata->sysclk == -1) { | 216 | if (pdata->sysclk == -1) { |
217 | pdata->sysclk = fsl_get_sys_freq(); | 217 | pdata->sysclk = fsl_get_sys_freq(); |
218 | if (pdata->sysclk == -1) { | 218 | if (pdata->sysclk == -1) |
219 | ret = -ENODEV; | 219 | return -ENODEV; |
220 | goto err; | ||
221 | } | ||
222 | } | 220 | } |
223 | #else | 221 | #else |
224 | ret = of_property_read_u32(np, "clock-frequency", &pdata->sysclk); | 222 | ret = of_property_read_u32(np, "clock-frequency", &pdata->sysclk); |
225 | if (ret) | 223 | if (ret) |
226 | goto err; | 224 | return ret; |
227 | #endif | 225 | #endif |
228 | 226 | ||
229 | prop = of_get_property(np, "mode", NULL); | 227 | prop = of_get_property(np, "mode", NULL); |
@@ -237,8 +235,4 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) | |||
237 | pdata->flags = SPI_CPM_MODE | SPI_CPM1; | 235 | pdata->flags = SPI_CPM_MODE | SPI_CPM1; |
238 | 236 | ||
239 | return 0; | 237 | return 0; |
240 | |||
241 | err: | ||
242 | kfree(pinfo); | ||
243 | return ret; | ||
244 | } | 238 | } |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 119f7af94537..f35488ed62a9 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -239,12 +239,6 @@ static int fsl_spi_setup_transfer(struct spi_device *spi, | |||
239 | if (!bits_per_word) | 239 | if (!bits_per_word) |
240 | bits_per_word = spi->bits_per_word; | 240 | bits_per_word = spi->bits_per_word; |
241 | 241 | ||
242 | /* Make sure its a bit width we support [4..16, 32] */ | ||
243 | if ((bits_per_word < 4) | ||
244 | || ((bits_per_word > 16) && (bits_per_word != 32)) | ||
245 | || (bits_per_word > mpc8xxx_spi->max_bits_per_word)) | ||
246 | return -EINVAL; | ||
247 | |||
248 | if (!hz) | 242 | if (!hz) |
249 | hz = spi->max_speed_hz; | 243 | hz = spi->max_speed_hz; |
250 | 244 | ||
@@ -362,18 +356,28 @@ static int fsl_spi_bufs(struct spi_device *spi, struct spi_transfer *t, | |||
362 | static void fsl_spi_do_one_msg(struct spi_message *m) | 356 | static void fsl_spi_do_one_msg(struct spi_message *m) |
363 | { | 357 | { |
364 | struct spi_device *spi = m->spi; | 358 | struct spi_device *spi = m->spi; |
365 | struct spi_transfer *t; | 359 | struct spi_transfer *t, *first; |
366 | unsigned int cs_change; | 360 | unsigned int cs_change; |
367 | const int nsecs = 50; | 361 | const int nsecs = 50; |
368 | int status; | 362 | int status; |
369 | 363 | ||
370 | cs_change = 1; | 364 | /* Don't allow changes if CS is active */ |
371 | status = 0; | 365 | first = list_first_entry(&m->transfers, struct spi_transfer, |
366 | transfer_list); | ||
372 | list_for_each_entry(t, &m->transfers, transfer_list) { | 367 | list_for_each_entry(t, &m->transfers, transfer_list) { |
373 | if (t->bits_per_word || t->speed_hz) { | 368 | if ((first->bits_per_word != t->bits_per_word) || |
374 | /* Don't allow changes if CS is active */ | 369 | (first->speed_hz != t->speed_hz)) { |
375 | status = -EINVAL; | 370 | status = -EINVAL; |
371 | dev_err(&spi->dev, | ||
372 | "bits_per_word/speed_hz should be same for the same SPI transfer\n"); | ||
373 | return; | ||
374 | } | ||
375 | } | ||
376 | 376 | ||
377 | cs_change = 1; | ||
378 | status = -EINVAL; | ||
379 | list_for_each_entry(t, &m->transfers, transfer_list) { | ||
380 | if (t->bits_per_word || t->speed_hz) { | ||
377 | if (cs_change) | 381 | if (cs_change) |
378 | status = fsl_spi_setup_transfer(spi, t); | 382 | status = fsl_spi_setup_transfer(spi, t); |
379 | if (status < 0) | 383 | if (status < 0) |
@@ -641,6 +645,10 @@ static struct spi_master * fsl_spi_probe(struct device *dev, | |||
641 | if (mpc8xxx_spi->type == TYPE_GRLIB) | 645 | if (mpc8xxx_spi->type == TYPE_GRLIB) |
642 | fsl_spi_grlib_probe(dev); | 646 | fsl_spi_grlib_probe(dev); |
643 | 647 | ||
648 | master->bits_per_word_mask = | ||
649 | (SPI_BPW_RANGE_MASK(4, 16) | SPI_BPW_MASK(32)) & | ||
650 | SPI_BPW_RANGE_MASK(1, mpc8xxx_spi->max_bits_per_word); | ||
651 | |||
644 | if (mpc8xxx_spi->flags & SPI_QE_CPU_MODE) | 652 | if (mpc8xxx_spi->flags & SPI_QE_CPU_MODE) |
645 | mpc8xxx_spi->set_shifts = fsl_spi_qe_cpu_set_shifts; | 653 | mpc8xxx_spi->set_shifts = fsl_spi_qe_cpu_set_shifts; |
646 | 654 | ||
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index 7beeb29472ac..09823076df88 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c | |||
@@ -19,7 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/init.h> | ||
23 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
24 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
25 | #include <linux/of.h> | 24 | #include <linux/of.h> |
@@ -250,7 +249,7 @@ static int spi_gpio_setup(struct spi_device *spi) | |||
250 | /* | 249 | /* |
251 | * ... otherwise, take it from spi->controller_data | 250 | * ... otherwise, take it from spi->controller_data |
252 | */ | 251 | */ |
253 | cs = (unsigned int) spi->controller_data; | 252 | cs = (unsigned int)(uintptr_t) spi->controller_data; |
254 | } | 253 | } |
255 | 254 | ||
256 | if (!spi->controller_state) { | 255 | if (!spi->controller_state) { |
@@ -503,13 +502,12 @@ static int spi_gpio_remove(struct platform_device *pdev) | |||
503 | { | 502 | { |
504 | struct spi_gpio *spi_gpio; | 503 | struct spi_gpio *spi_gpio; |
505 | struct spi_gpio_platform_data *pdata; | 504 | struct spi_gpio_platform_data *pdata; |
506 | int status; | ||
507 | 505 | ||
508 | spi_gpio = platform_get_drvdata(pdev); | 506 | spi_gpio = platform_get_drvdata(pdev); |
509 | pdata = dev_get_platdata(&pdev->dev); | 507 | pdata = dev_get_platdata(&pdev->dev); |
510 | 508 | ||
511 | /* stop() unregisters child devices too */ | 509 | /* stop() unregisters child devices too */ |
512 | status = spi_bitbang_stop(&spi_gpio->bitbang); | 510 | spi_bitbang_stop(&spi_gpio->bitbang); |
513 | 511 | ||
514 | if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) | 512 | if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) |
515 | gpio_free(SPI_MISO_GPIO); | 513 | gpio_free(SPI_MISO_GPIO); |
@@ -518,7 +516,7 @@ static int spi_gpio_remove(struct platform_device *pdev) | |||
518 | gpio_free(SPI_SCK_GPIO); | 516 | gpio_free(SPI_SCK_GPIO); |
519 | spi_master_put(spi_gpio->bitbang.master); | 517 | spi_master_put(spi_gpio->bitbang.master); |
520 | 518 | ||
521 | return status; | 519 | return 0; |
522 | } | 520 | } |
523 | 521 | ||
524 | MODULE_ALIAS("platform:" DRIVER_NAME); | 522 | MODULE_ALIAS("platform:" DRIVER_NAME); |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index a5474ef9d2a0..5daff2054ae4 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <linux/init.h> | ||
27 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
28 | #include <linux/io.h> | 27 | #include <linux/io.h> |
29 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
@@ -741,7 +740,7 @@ static int spi_imx_transfer(struct spi_device *spi, | |||
741 | spi_imx->count = transfer->len; | 740 | spi_imx->count = transfer->len; |
742 | spi_imx->txfifo = 0; | 741 | spi_imx->txfifo = 0; |
743 | 742 | ||
744 | init_completion(&spi_imx->xfer_done); | 743 | reinit_completion(&spi_imx->xfer_done); |
745 | 744 | ||
746 | spi_imx_push(spi_imx); | 745 | spi_imx_push(spi_imx); |
747 | 746 | ||
@@ -880,12 +879,12 @@ static int spi_imx_probe(struct platform_device *pdev) | |||
880 | 879 | ||
881 | spi_imx->irq = platform_get_irq(pdev, 0); | 880 | spi_imx->irq = platform_get_irq(pdev, 0); |
882 | if (spi_imx->irq < 0) { | 881 | if (spi_imx->irq < 0) { |
883 | ret = -EINVAL; | 882 | ret = spi_imx->irq; |
884 | goto out_master_put; | 883 | goto out_master_put; |
885 | } | 884 | } |
886 | 885 | ||
887 | ret = devm_request_irq(&pdev->dev, spi_imx->irq, spi_imx_isr, 0, | 886 | ret = devm_request_irq(&pdev->dev, spi_imx->irq, spi_imx_isr, 0, |
888 | DRIVER_NAME, spi_imx); | 887 | dev_name(&pdev->dev), spi_imx); |
889 | if (ret) { | 888 | if (ret) { |
890 | dev_err(&pdev->dev, "can't get irq%d: %d\n", spi_imx->irq, ret); | 889 | dev_err(&pdev->dev, "can't get irq%d: %d\n", spi_imx->irq, ret); |
891 | goto out_master_put; | 890 | goto out_master_put; |
@@ -948,8 +947,8 @@ static int spi_imx_remove(struct platform_device *pdev) | |||
948 | spi_bitbang_stop(&spi_imx->bitbang); | 947 | spi_bitbang_stop(&spi_imx->bitbang); |
949 | 948 | ||
950 | writel(0, spi_imx->base + MXC_CSPICTRL); | 949 | writel(0, spi_imx->base + MXC_CSPICTRL); |
951 | clk_disable_unprepare(spi_imx->clk_ipg); | 950 | clk_unprepare(spi_imx->clk_ipg); |
952 | clk_disable_unprepare(spi_imx->clk_per); | 951 | clk_unprepare(spi_imx->clk_per); |
953 | spi_master_put(master); | 952 | spi_master_put(master); |
954 | 953 | ||
955 | return 0; | 954 | return 0; |
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 5032141eeeec..3822eef2ef9d 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/init.h> | ||
20 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
21 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
22 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
@@ -466,10 +465,8 @@ static void mpc512x_spi_cs_control(struct spi_device *spi, bool onoff) | |||
466 | gpio_set_value(spi->cs_gpio, onoff); | 465 | gpio_set_value(spi->cs_gpio, onoff); |
467 | } | 466 | } |
468 | 467 | ||
469 | /* bus_num is used only for the case dev->platform_data == NULL */ | ||
470 | static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, | 468 | static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, |
471 | u32 size, unsigned int irq, | 469 | u32 size, unsigned int irq) |
472 | s16 bus_num) | ||
473 | { | 470 | { |
474 | struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); | 471 | struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); |
475 | struct mpc512x_psc_spi *mps; | 472 | struct mpc512x_psc_spi *mps; |
@@ -488,7 +485,6 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
488 | 485 | ||
489 | if (pdata == NULL) { | 486 | if (pdata == NULL) { |
490 | mps->cs_control = mpc512x_spi_cs_control; | 487 | mps->cs_control = mpc512x_spi_cs_control; |
491 | master->bus_num = bus_num; | ||
492 | } else { | 488 | } else { |
493 | mps->cs_control = pdata->cs_control; | 489 | mps->cs_control = pdata->cs_control; |
494 | master->bus_num = pdata->bus_num; | 490 | master->bus_num = pdata->bus_num; |
@@ -574,7 +570,6 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) | |||
574 | { | 570 | { |
575 | const u32 *regaddr_p; | 571 | const u32 *regaddr_p; |
576 | u64 regaddr64, size64; | 572 | u64 regaddr64, size64; |
577 | s16 id = -1; | ||
578 | 573 | ||
579 | regaddr_p = of_get_address(op->dev.of_node, 0, &size64, NULL); | 574 | regaddr_p = of_get_address(op->dev.of_node, 0, &size64, NULL); |
580 | if (!regaddr_p) { | 575 | if (!regaddr_p) { |
@@ -583,16 +578,8 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) | |||
583 | } | 578 | } |
584 | regaddr64 = of_translate_address(op->dev.of_node, regaddr_p); | 579 | regaddr64 = of_translate_address(op->dev.of_node, regaddr_p); |
585 | 580 | ||
586 | /* get PSC id (0..11, used by port_config) */ | ||
587 | id = of_alias_get_id(op->dev.of_node, "spi"); | ||
588 | if (id < 0) { | ||
589 | dev_err(&op->dev, "no alias id for %s\n", | ||
590 | op->dev.of_node->full_name); | ||
591 | return id; | ||
592 | } | ||
593 | |||
594 | return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64, | 581 | return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64, |
595 | irq_of_parse_and_map(op->dev.of_node, 0), id); | 582 | irq_of_parse_and_map(op->dev.of_node, 0)); |
596 | } | 583 | } |
597 | 584 | ||
598 | static int mpc512x_psc_spi_of_remove(struct platform_device *op) | 585 | static int mpc512x_psc_spi_of_remove(struct platform_device *op) |
diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c index 00ba910ab302..3d18d9351185 100644 --- a/drivers/spi/spi-mpc52xx-psc.c +++ b/drivers/spi/spi-mpc52xx-psc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/init.h> | ||
16 | #include <linux/types.h> | 15 | #include <linux/types.h> |
17 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
18 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c index 7c675fe83101..aac2a5ddd964 100644 --- a/drivers/spi/spi-mpc52xx.c +++ b/drivers/spi/spi-mpc52xx.c | |||
@@ -12,7 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/init.h> | ||
16 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
17 | #include <linux/of_platform.h> | 16 | #include <linux/of_platform.h> |
18 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
@@ -357,20 +356,6 @@ static void mpc52xx_spi_wq(struct work_struct *work) | |||
357 | * spi_master ops | 356 | * spi_master ops |
358 | */ | 357 | */ |
359 | 358 | ||
360 | static int mpc52xx_spi_setup(struct spi_device *spi) | ||
361 | { | ||
362 | if (spi->bits_per_word % 8) | ||
363 | return -EINVAL; | ||
364 | |||
365 | if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST)) | ||
366 | return -EINVAL; | ||
367 | |||
368 | if (spi->chip_select >= spi->master->num_chipselect) | ||
369 | return -EINVAL; | ||
370 | |||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m) | 359 | static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m) |
375 | { | 360 | { |
376 | struct mpc52xx_spi *ms = spi_master_get_devdata(spi->master); | 361 | struct mpc52xx_spi *ms = spi_master_get_devdata(spi->master); |
@@ -433,9 +418,9 @@ static int mpc52xx_spi_probe(struct platform_device *op) | |||
433 | goto err_alloc; | 418 | goto err_alloc; |
434 | } | 419 | } |
435 | 420 | ||
436 | master->setup = mpc52xx_spi_setup; | ||
437 | master->transfer = mpc52xx_spi_transfer; | 421 | master->transfer = mpc52xx_spi_transfer; |
438 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; | 422 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; |
423 | master->bits_per_word_mask = SPI_BPW_MASK(8); | ||
439 | master->dev.of_node = op->dev.of_node; | 424 | master->dev.of_node = op->dev.of_node; |
440 | 425 | ||
441 | platform_set_drvdata(op, master); | 426 | platform_set_drvdata(op, master); |
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 79e5aa2250c8..2884f0c2f5f0 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -29,7 +29,6 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/init.h> | ||
33 | #include <linux/ioport.h> | 32 | #include <linux/ioport.h> |
34 | #include <linux/of.h> | 33 | #include <linux/of.h> |
35 | #include <linux/of_device.h> | 34 | #include <linux/of_device.h> |
@@ -371,7 +370,7 @@ static int mxs_spi_transfer_one(struct spi_master *master, | |||
371 | { | 370 | { |
372 | struct mxs_spi *spi = spi_master_get_devdata(master); | 371 | struct mxs_spi *spi = spi_master_get_devdata(master); |
373 | struct mxs_ssp *ssp = &spi->ssp; | 372 | struct mxs_ssp *ssp = &spi->ssp; |
374 | struct spi_transfer *t, *tmp_t; | 373 | struct spi_transfer *t; |
375 | unsigned int flag; | 374 | unsigned int flag; |
376 | int status = 0; | 375 | int status = 0; |
377 | 376 | ||
@@ -381,7 +380,7 @@ static int mxs_spi_transfer_one(struct spi_master *master, | |||
381 | writel(mxs_spi_cs_to_reg(m->spi->chip_select), | 380 | writel(mxs_spi_cs_to_reg(m->spi->chip_select), |
382 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | 381 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); |
383 | 382 | ||
384 | list_for_each_entry_safe(t, tmp_t, &m->transfers, transfer_list) { | 383 | list_for_each_entry(t, &m->transfers, transfer_list) { |
385 | 384 | ||
386 | status = mxs_spi_setup_transfer(m->spi, t); | 385 | status = mxs_spi_setup_transfer(m->spi, t); |
387 | if (status) | 386 | if (status) |
@@ -473,7 +472,7 @@ static int mxs_spi_probe(struct platform_device *pdev) | |||
473 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 472 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
474 | irq_err = platform_get_irq(pdev, 0); | 473 | irq_err = platform_get_irq(pdev, 0); |
475 | if (irq_err < 0) | 474 | if (irq_err < 0) |
476 | return -EINVAL; | 475 | return irq_err; |
477 | 476 | ||
478 | base = devm_ioremap_resource(&pdev->dev, iores); | 477 | base = devm_ioremap_resource(&pdev->dev, iores); |
479 | if (IS_ERR(base)) | 478 | if (IS_ERR(base)) |
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c index bae97ffec4b9..16e30de650b0 100644 --- a/drivers/spi/spi-nuc900.c +++ b/drivers/spi/spi-nuc900.c | |||
@@ -9,7 +9,6 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/init.h> | ||
13 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
14 | #include <linux/workqueue.h> | 13 | #include <linux/workqueue.h> |
15 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
@@ -38,7 +37,9 @@ | |||
38 | /* usi register bit */ | 37 | /* usi register bit */ |
39 | #define ENINT (0x01 << 17) | 38 | #define ENINT (0x01 << 17) |
40 | #define ENFLG (0x01 << 16) | 39 | #define ENFLG (0x01 << 16) |
40 | #define SLEEP (0x0f << 12) | ||
41 | #define TXNUM (0x03 << 8) | 41 | #define TXNUM (0x03 << 8) |
42 | #define TXBITLEN (0x1f << 3) | ||
42 | #define TXNEG (0x01 << 2) | 43 | #define TXNEG (0x01 << 2) |
43 | #define RXNEG (0x01 << 1) | 44 | #define RXNEG (0x01 << 1) |
44 | #define LSB (0x01 << 10) | 45 | #define LSB (0x01 << 10) |
@@ -58,11 +59,8 @@ struct nuc900_spi { | |||
58 | unsigned char *rx; | 59 | unsigned char *rx; |
59 | struct clk *clk; | 60 | struct clk *clk; |
60 | struct spi_master *master; | 61 | struct spi_master *master; |
61 | struct spi_device *curdev; | ||
62 | struct device *dev; | ||
63 | struct nuc900_spi_info *pdata; | 62 | struct nuc900_spi_info *pdata; |
64 | spinlock_t lock; | 63 | spinlock_t lock; |
65 | struct resource *res; | ||
66 | }; | 64 | }; |
67 | 65 | ||
68 | static inline struct nuc900_spi *to_hw(struct spi_device *sdev) | 66 | static inline struct nuc900_spi *to_hw(struct spi_device *sdev) |
@@ -119,19 +117,16 @@ static void nuc900_spi_chipsel(struct spi_device *spi, int value) | |||
119 | } | 117 | } |
120 | } | 118 | } |
121 | 119 | ||
122 | static void nuc900_spi_setup_txnum(struct nuc900_spi *hw, | 120 | static void nuc900_spi_setup_txnum(struct nuc900_spi *hw, unsigned int txnum) |
123 | unsigned int txnum) | ||
124 | { | 121 | { |
125 | unsigned int val; | 122 | unsigned int val; |
126 | unsigned long flags; | 123 | unsigned long flags; |
127 | 124 | ||
128 | spin_lock_irqsave(&hw->lock, flags); | 125 | spin_lock_irqsave(&hw->lock, flags); |
129 | 126 | ||
130 | val = __raw_readl(hw->regs + USI_CNT); | 127 | val = __raw_readl(hw->regs + USI_CNT) & ~TXNUM; |
131 | 128 | ||
132 | if (!txnum) | 129 | if (txnum) |
133 | val &= ~TXNUM; | ||
134 | else | ||
135 | val |= txnum << 0x08; | 130 | val |= txnum << 0x08; |
136 | 131 | ||
137 | __raw_writel(val, hw->regs + USI_CNT); | 132 | __raw_writel(val, hw->regs + USI_CNT); |
@@ -148,7 +143,7 @@ static void nuc900_spi_setup_txbitlen(struct nuc900_spi *hw, | |||
148 | 143 | ||
149 | spin_lock_irqsave(&hw->lock, flags); | 144 | spin_lock_irqsave(&hw->lock, flags); |
150 | 145 | ||
151 | val = __raw_readl(hw->regs + USI_CNT); | 146 | val = __raw_readl(hw->regs + USI_CNT) & ~TXBITLEN; |
152 | 147 | ||
153 | val |= (txbitlen << 0x03); | 148 | val |= (txbitlen << 0x03); |
154 | 149 | ||
@@ -287,12 +282,11 @@ static void nuc900_set_sleep(struct nuc900_spi *hw, unsigned int sleep) | |||
287 | 282 | ||
288 | spin_lock_irqsave(&hw->lock, flags); | 283 | spin_lock_irqsave(&hw->lock, flags); |
289 | 284 | ||
290 | val = __raw_readl(hw->regs + USI_CNT); | 285 | val = __raw_readl(hw->regs + USI_CNT) & ~SLEEP; |
291 | 286 | ||
292 | if (sleep) | 287 | if (sleep) |
293 | val |= (sleep << 12); | 288 | val |= (sleep << 12); |
294 | else | 289 | |
295 | val &= ~(0x0f << 12); | ||
296 | __raw_writel(val, hw->regs + USI_CNT); | 290 | __raw_writel(val, hw->regs + USI_CNT); |
297 | 291 | ||
298 | spin_unlock_irqrestore(&hw->lock, flags); | 292 | spin_unlock_irqrestore(&hw->lock, flags); |
@@ -338,6 +332,7 @@ static int nuc900_spi_probe(struct platform_device *pdev) | |||
338 | { | 332 | { |
339 | struct nuc900_spi *hw; | 333 | struct nuc900_spi *hw; |
340 | struct spi_master *master; | 334 | struct spi_master *master; |
335 | struct resource *res; | ||
341 | int err = 0; | 336 | int err = 0; |
342 | 337 | ||
343 | master = spi_alloc_master(&pdev->dev, sizeof(struct nuc900_spi)); | 338 | master = spi_alloc_master(&pdev->dev, sizeof(struct nuc900_spi)); |
@@ -349,7 +344,6 @@ static int nuc900_spi_probe(struct platform_device *pdev) | |||
349 | hw = spi_master_get_devdata(master); | 344 | hw = spi_master_get_devdata(master); |
350 | hw->master = master; | 345 | hw->master = master; |
351 | hw->pdata = dev_get_platdata(&pdev->dev); | 346 | hw->pdata = dev_get_platdata(&pdev->dev); |
352 | hw->dev = &pdev->dev; | ||
353 | 347 | ||
354 | if (hw->pdata == NULL) { | 348 | if (hw->pdata == NULL) { |
355 | dev_err(&pdev->dev, "No platform data supplied\n"); | 349 | dev_err(&pdev->dev, "No platform data supplied\n"); |
@@ -369,8 +363,8 @@ static int nuc900_spi_probe(struct platform_device *pdev) | |||
369 | hw->bitbang.chipselect = nuc900_spi_chipsel; | 363 | hw->bitbang.chipselect = nuc900_spi_chipsel; |
370 | hw->bitbang.txrx_bufs = nuc900_spi_txrx; | 364 | hw->bitbang.txrx_bufs = nuc900_spi_txrx; |
371 | 365 | ||
372 | hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 366 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
373 | hw->regs = devm_ioremap_resource(&pdev->dev, hw->res); | 367 | hw->regs = devm_ioremap_resource(&pdev->dev, res); |
374 | if (IS_ERR(hw->regs)) { | 368 | if (IS_ERR(hw->regs)) { |
375 | err = PTR_ERR(hw->regs); | 369 | err = PTR_ERR(hw->regs); |
376 | goto err_pdata; | 370 | goto err_pdata; |
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c index f7c896e2981e..8998d11c7238 100644 --- a/drivers/spi/spi-oc-tiny.c +++ b/drivers/spi/spi-oc-tiny.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * published by the Free Software Foundation. | 15 | * published by the Free Software Foundation. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
20 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -267,8 +266,6 @@ static int tiny_spi_probe(struct platform_device *pdev) | |||
267 | 266 | ||
268 | /* setup the state for the bitbang driver */ | 267 | /* setup the state for the bitbang driver */ |
269 | hw->bitbang.master = master; | 268 | hw->bitbang.master = master; |
270 | if (!hw->bitbang.master) | ||
271 | return err; | ||
272 | hw->bitbang.setup_transfer = tiny_spi_setup_transfer; | 269 | hw->bitbang.setup_transfer = tiny_spi_setup_transfer; |
273 | hw->bitbang.chipselect = tiny_spi_chipselect; | 270 | hw->bitbang.chipselect = tiny_spi_chipselect; |
274 | hw->bitbang.txrx_bufs = tiny_spi_txrx_bufs; | 271 | hw->bitbang.txrx_bufs = tiny_spi_txrx_bufs; |
diff --git a/drivers/spi/spi-octeon.c b/drivers/spi/spi-octeon.c index 67249a48b391..c5e2f718eebd 100644 --- a/drivers/spi/spi-octeon.c +++ b/drivers/spi/spi-octeon.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/spi/spi.h> | 11 | #include <linux/spi/spi.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/init.h> | ||
15 | #include <linux/io.h> | 14 | #include <linux/io.h> |
16 | #include <linux/of.h> | 15 | #include <linux/of.h> |
17 | 16 | ||
@@ -33,13 +32,6 @@ struct octeon_spi { | |||
33 | u64 cs_enax; | 32 | u64 cs_enax; |
34 | }; | 33 | }; |
35 | 34 | ||
36 | struct octeon_spi_setup { | ||
37 | u32 max_speed_hz; | ||
38 | u8 chip_select; | ||
39 | u8 mode; | ||
40 | u8 bits_per_word; | ||
41 | }; | ||
42 | |||
43 | static void octeon_spi_wait_ready(struct octeon_spi *p) | 35 | static void octeon_spi_wait_ready(struct octeon_spi *p) |
44 | { | 36 | { |
45 | union cvmx_mpi_sts mpi_sts; | 37 | union cvmx_mpi_sts mpi_sts; |
@@ -57,6 +49,7 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, | |||
57 | struct spi_transfer *xfer, | 49 | struct spi_transfer *xfer, |
58 | bool last_xfer) | 50 | bool last_xfer) |
59 | { | 51 | { |
52 | struct spi_device *spi = msg->spi; | ||
60 | union cvmx_mpi_cfg mpi_cfg; | 53 | union cvmx_mpi_cfg mpi_cfg; |
61 | union cvmx_mpi_tx mpi_tx; | 54 | union cvmx_mpi_tx mpi_tx; |
62 | unsigned int clkdiv; | 55 | unsigned int clkdiv; |
@@ -68,18 +61,11 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, | |||
68 | int len; | 61 | int len; |
69 | int i; | 62 | int i; |
70 | 63 | ||
71 | struct octeon_spi_setup *msg_setup = spi_get_ctldata(msg->spi); | 64 | mode = spi->mode; |
72 | |||
73 | speed_hz = msg_setup->max_speed_hz; | ||
74 | mode = msg_setup->mode; | ||
75 | cpha = mode & SPI_CPHA; | 65 | cpha = mode & SPI_CPHA; |
76 | cpol = mode & SPI_CPOL; | 66 | cpol = mode & SPI_CPOL; |
77 | 67 | ||
78 | if (xfer->speed_hz) | 68 | speed_hz = xfer->speed_hz ? : spi->max_speed_hz; |
79 | speed_hz = xfer->speed_hz; | ||
80 | |||
81 | if (speed_hz > OCTEON_SPI_MAX_CLOCK_HZ) | ||
82 | speed_hz = OCTEON_SPI_MAX_CLOCK_HZ; | ||
83 | 69 | ||
84 | clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz); | 70 | clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz); |
85 | 71 | ||
@@ -93,8 +79,8 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, | |||
93 | mpi_cfg.s.cslate = cpha ? 1 : 0; | 79 | mpi_cfg.s.cslate = cpha ? 1 : 0; |
94 | mpi_cfg.s.enable = 1; | 80 | mpi_cfg.s.enable = 1; |
95 | 81 | ||
96 | if (msg_setup->chip_select < 4) | 82 | if (spi->chip_select < 4) |
97 | p->cs_enax |= 1ull << (12 + msg_setup->chip_select); | 83 | p->cs_enax |= 1ull << (12 + spi->chip_select); |
98 | mpi_cfg.u64 |= p->cs_enax; | 84 | mpi_cfg.u64 |= p->cs_enax; |
99 | 85 | ||
100 | if (mpi_cfg.u64 != p->last_cfg) { | 86 | if (mpi_cfg.u64 != p->last_cfg) { |
@@ -114,7 +100,7 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, | |||
114 | cvmx_write_csr(p->register_base + OCTEON_SPI_DAT0 + (8 * i), d); | 100 | cvmx_write_csr(p->register_base + OCTEON_SPI_DAT0 + (8 * i), d); |
115 | } | 101 | } |
116 | mpi_tx.u64 = 0; | 102 | mpi_tx.u64 = 0; |
117 | mpi_tx.s.csid = msg_setup->chip_select; | 103 | mpi_tx.s.csid = spi->chip_select; |
118 | mpi_tx.s.leavecs = 1; | 104 | mpi_tx.s.leavecs = 1; |
119 | mpi_tx.s.txnum = tx_buf ? OCTEON_SPI_MAX_BYTES : 0; | 105 | mpi_tx.s.txnum = tx_buf ? OCTEON_SPI_MAX_BYTES : 0; |
120 | mpi_tx.s.totnum = OCTEON_SPI_MAX_BYTES; | 106 | mpi_tx.s.totnum = OCTEON_SPI_MAX_BYTES; |
@@ -139,7 +125,7 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, | |||
139 | } | 125 | } |
140 | 126 | ||
141 | mpi_tx.u64 = 0; | 127 | mpi_tx.u64 = 0; |
142 | mpi_tx.s.csid = msg_setup->chip_select; | 128 | mpi_tx.s.csid = spi->chip_select; |
143 | if (last_xfer) | 129 | if (last_xfer) |
144 | mpi_tx.s.leavecs = xfer->cs_change; | 130 | mpi_tx.s.leavecs = xfer->cs_change; |
145 | else | 131 | else |
@@ -169,17 +155,9 @@ static int octeon_spi_transfer_one_message(struct spi_master *master, | |||
169 | int status = 0; | 155 | int status = 0; |
170 | struct spi_transfer *xfer; | 156 | struct spi_transfer *xfer; |
171 | 157 | ||
172 | /* | ||
173 | * We better have set the configuration via a call to .setup | ||
174 | * before we get here. | ||
175 | */ | ||
176 | if (spi_get_ctldata(msg->spi) == NULL) { | ||
177 | status = -EINVAL; | ||
178 | goto err; | ||
179 | } | ||
180 | |||
181 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 158 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
182 | bool last_xfer = &xfer->transfer_list == msg->transfers.prev; | 159 | bool last_xfer = list_is_last(&xfer->transfer_list, |
160 | &msg->transfers); | ||
183 | int r = octeon_spi_do_transfer(p, msg, xfer, last_xfer); | 161 | int r = octeon_spi_do_transfer(p, msg, xfer, last_xfer); |
184 | if (r < 0) { | 162 | if (r < 0) { |
185 | status = r; | 163 | status = r; |
@@ -194,41 +172,6 @@ err: | |||
194 | return status; | 172 | return status; |
195 | } | 173 | } |
196 | 174 | ||
197 | static struct octeon_spi_setup *octeon_spi_new_setup(struct spi_device *spi) | ||
198 | { | ||
199 | struct octeon_spi_setup *setup = kzalloc(sizeof(*setup), GFP_KERNEL); | ||
200 | if (!setup) | ||
201 | return NULL; | ||
202 | |||
203 | setup->max_speed_hz = spi->max_speed_hz; | ||
204 | setup->chip_select = spi->chip_select; | ||
205 | setup->mode = spi->mode; | ||
206 | setup->bits_per_word = spi->bits_per_word; | ||
207 | return setup; | ||
208 | } | ||
209 | |||
210 | static int octeon_spi_setup(struct spi_device *spi) | ||
211 | { | ||
212 | struct octeon_spi_setup *new_setup; | ||
213 | struct octeon_spi_setup *old_setup = spi_get_ctldata(spi); | ||
214 | |||
215 | new_setup = octeon_spi_new_setup(spi); | ||
216 | if (!new_setup) | ||
217 | return -ENOMEM; | ||
218 | |||
219 | spi_set_ctldata(spi, new_setup); | ||
220 | kfree(old_setup); | ||
221 | |||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static void octeon_spi_cleanup(struct spi_device *spi) | ||
226 | { | ||
227 | struct octeon_spi_setup *old_setup = spi_get_ctldata(spi); | ||
228 | spi_set_ctldata(spi, NULL); | ||
229 | kfree(old_setup); | ||
230 | } | ||
231 | |||
232 | static int octeon_spi_probe(struct platform_device *pdev) | 175 | static int octeon_spi_probe(struct platform_device *pdev) |
233 | { | 176 | { |
234 | struct resource *res_mem; | 177 | struct resource *res_mem; |
@@ -257,8 +200,6 @@ static int octeon_spi_probe(struct platform_device *pdev) | |||
257 | p->register_base = (u64)devm_ioremap(&pdev->dev, res_mem->start, | 200 | p->register_base = (u64)devm_ioremap(&pdev->dev, res_mem->start, |
258 | resource_size(res_mem)); | 201 | resource_size(res_mem)); |
259 | 202 | ||
260 | /* Dynamic bus numbering */ | ||
261 | master->bus_num = -1; | ||
262 | master->num_chipselect = 4; | 203 | master->num_chipselect = 4; |
263 | master->mode_bits = SPI_CPHA | | 204 | master->mode_bits = SPI_CPHA | |
264 | SPI_CPOL | | 205 | SPI_CPOL | |
@@ -266,10 +207,9 @@ static int octeon_spi_probe(struct platform_device *pdev) | |||
266 | SPI_LSB_FIRST | | 207 | SPI_LSB_FIRST | |
267 | SPI_3WIRE; | 208 | SPI_3WIRE; |
268 | 209 | ||
269 | master->setup = octeon_spi_setup; | ||
270 | master->cleanup = octeon_spi_cleanup; | ||
271 | master->transfer_one_message = octeon_spi_transfer_one_message; | 210 | master->transfer_one_message = octeon_spi_transfer_one_message; |
272 | master->bits_per_word_mask = SPI_BPW_MASK(8); | 211 | master->bits_per_word_mask = SPI_BPW_MASK(8); |
212 | master->max_speed_hz = OCTEON_SPI_MAX_CLOCK_HZ; | ||
273 | 213 | ||
274 | master->dev.of_node = pdev->dev.of_node; | 214 | master->dev.of_node = pdev->dev.of_node; |
275 | err = devm_spi_register_master(&pdev->dev, master); | 215 | err = devm_spi_register_master(&pdev->dev, master); |
diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 0d32054bfc0d..e7ffcded4e14 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c | |||
@@ -83,15 +83,11 @@ | |||
83 | #define SPI_SHUTDOWN 1 | 83 | #define SPI_SHUTDOWN 1 |
84 | 84 | ||
85 | struct omap1_spi100k { | 85 | struct omap1_spi100k { |
86 | struct spi_master *master; | ||
87 | struct clk *ick; | 86 | struct clk *ick; |
88 | struct clk *fck; | 87 | struct clk *fck; |
89 | 88 | ||
90 | /* Virtual base address of the controller */ | 89 | /* Virtual base address of the controller */ |
91 | void __iomem *base; | 90 | void __iomem *base; |
92 | |||
93 | /* State of the SPI */ | ||
94 | unsigned int state; | ||
95 | }; | 91 | }; |
96 | 92 | ||
97 | struct omap1_spi100k_cs { | 93 | struct omap1_spi100k_cs { |
@@ -99,13 +95,6 @@ struct omap1_spi100k_cs { | |||
99 | int word_len; | 95 | int word_len; |
100 | }; | 96 | }; |
101 | 97 | ||
102 | #define MOD_REG_BIT(val, mask, set) do { \ | ||
103 | if (set) \ | ||
104 | val |= mask; \ | ||
105 | else \ | ||
106 | val &= ~mask; \ | ||
107 | } while (0) | ||
108 | |||
109 | static void spi100k_enable_clock(struct spi_master *master) | 98 | static void spi100k_enable_clock(struct spi_master *master) |
110 | { | 99 | { |
111 | unsigned int val; | 100 | unsigned int val; |
@@ -139,7 +128,7 @@ static void spi100k_write_data(struct spi_master *master, int len, int data) | |||
139 | } | 128 | } |
140 | 129 | ||
141 | spi100k_enable_clock(master); | 130 | spi100k_enable_clock(master); |
142 | writew( data , spi100k->base + SPI_TX_MSB); | 131 | writew(data , spi100k->base + SPI_TX_MSB); |
143 | 132 | ||
144 | writew(SPI_CTRL_SEN(0) | | 133 | writew(SPI_CTRL_SEN(0) | |
145 | SPI_CTRL_WORD_SIZE(len) | | 134 | SPI_CTRL_WORD_SIZE(len) | |
@@ -147,7 +136,8 @@ static void spi100k_write_data(struct spi_master *master, int len, int data) | |||
147 | spi100k->base + SPI_CTRL); | 136 | spi100k->base + SPI_CTRL); |
148 | 137 | ||
149 | /* Wait for bit ack send change */ | 138 | /* Wait for bit ack send change */ |
150 | while((readw(spi100k->base + SPI_STATUS) & SPI_STATUS_WE) != SPI_STATUS_WE); | 139 | while ((readw(spi100k->base + SPI_STATUS) & SPI_STATUS_WE) != SPI_STATUS_WE) |
140 | ; | ||
151 | udelay(1000); | 141 | udelay(1000); |
152 | 142 | ||
153 | spi100k_disable_clock(master); | 143 | spi100k_disable_clock(master); |
@@ -155,7 +145,7 @@ static void spi100k_write_data(struct spi_master *master, int len, int data) | |||
155 | 145 | ||
156 | static int spi100k_read_data(struct spi_master *master, int len) | 146 | static int spi100k_read_data(struct spi_master *master, int len) |
157 | { | 147 | { |
158 | int dataH,dataL; | 148 | int dataH, dataL; |
159 | struct omap1_spi100k *spi100k = spi_master_get_devdata(master); | 149 | struct omap1_spi100k *spi100k = spi_master_get_devdata(master); |
160 | 150 | ||
161 | /* Always do at least 16 bits */ | 151 | /* Always do at least 16 bits */ |
@@ -168,7 +158,8 @@ static int spi100k_read_data(struct spi_master *master, int len) | |||
168 | SPI_CTRL_RD, | 158 | SPI_CTRL_RD, |
169 | spi100k->base + SPI_CTRL); | 159 | spi100k->base + SPI_CTRL); |
170 | 160 | ||
171 | while((readw(spi100k->base + SPI_STATUS) & SPI_STATUS_RD) != SPI_STATUS_RD); | 161 | while ((readw(spi100k->base + SPI_STATUS) & SPI_STATUS_RD) != SPI_STATUS_RD) |
162 | ; | ||
172 | udelay(1000); | 163 | udelay(1000); |
173 | 164 | ||
174 | dataL = readw(spi100k->base + SPI_RX_LSB); | 165 | dataL = readw(spi100k->base + SPI_RX_LSB); |
@@ -204,12 +195,10 @@ static void omap1_spi100k_force_cs(struct omap1_spi100k *spi100k, int enable) | |||
204 | static unsigned | 195 | static unsigned |
205 | omap1_spi100k_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | 196 | omap1_spi100k_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) |
206 | { | 197 | { |
207 | struct omap1_spi100k *spi100k; | ||
208 | struct omap1_spi100k_cs *cs = spi->controller_state; | 198 | struct omap1_spi100k_cs *cs = spi->controller_state; |
209 | unsigned int count, c; | 199 | unsigned int count, c; |
210 | int word_len; | 200 | int word_len; |
211 | 201 | ||
212 | spi100k = spi_master_get_devdata(spi->master); | ||
213 | count = xfer->len; | 202 | count = xfer->len; |
214 | c = count; | 203 | c = count; |
215 | word_len = cs->word_len; | 204 | word_len = cs->word_len; |
@@ -221,12 +210,12 @@ omap1_spi100k_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | |||
221 | rx = xfer->rx_buf; | 210 | rx = xfer->rx_buf; |
222 | tx = xfer->tx_buf; | 211 | tx = xfer->tx_buf; |
223 | do { | 212 | do { |
224 | c-=1; | 213 | c -= 1; |
225 | if (xfer->tx_buf != NULL) | 214 | if (xfer->tx_buf != NULL) |
226 | spi100k_write_data(spi->master, word_len, *tx++); | 215 | spi100k_write_data(spi->master, word_len, *tx++); |
227 | if (xfer->rx_buf != NULL) | 216 | if (xfer->rx_buf != NULL) |
228 | *rx++ = spi100k_read_data(spi->master, word_len); | 217 | *rx++ = spi100k_read_data(spi->master, word_len); |
229 | } while(c); | 218 | } while (c); |
230 | } else if (word_len <= 16) { | 219 | } else if (word_len <= 16) { |
231 | u16 *rx; | 220 | u16 *rx; |
232 | const u16 *tx; | 221 | const u16 *tx; |
@@ -234,12 +223,12 @@ omap1_spi100k_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | |||
234 | rx = xfer->rx_buf; | 223 | rx = xfer->rx_buf; |
235 | tx = xfer->tx_buf; | 224 | tx = xfer->tx_buf; |
236 | do { | 225 | do { |
237 | c-=2; | 226 | c -= 2; |
238 | if (xfer->tx_buf != NULL) | 227 | if (xfer->tx_buf != NULL) |
239 | spi100k_write_data(spi->master,word_len, *tx++); | 228 | spi100k_write_data(spi->master, word_len, *tx++); |
240 | if (xfer->rx_buf != NULL) | 229 | if (xfer->rx_buf != NULL) |
241 | *rx++ = spi100k_read_data(spi->master,word_len); | 230 | *rx++ = spi100k_read_data(spi->master, word_len); |
242 | } while(c); | 231 | } while (c); |
243 | } else if (word_len <= 32) { | 232 | } else if (word_len <= 32) { |
244 | u32 *rx; | 233 | u32 *rx; |
245 | const u32 *tx; | 234 | const u32 *tx; |
@@ -247,12 +236,12 @@ omap1_spi100k_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | |||
247 | rx = xfer->rx_buf; | 236 | rx = xfer->rx_buf; |
248 | tx = xfer->tx_buf; | 237 | tx = xfer->tx_buf; |
249 | do { | 238 | do { |
250 | c-=4; | 239 | c -= 4; |
251 | if (xfer->tx_buf != NULL) | 240 | if (xfer->tx_buf != NULL) |
252 | spi100k_write_data(spi->master,word_len, *tx); | 241 | spi100k_write_data(spi->master, word_len, *tx); |
253 | if (xfer->rx_buf != NULL) | 242 | if (xfer->rx_buf != NULL) |
254 | *rx = spi100k_read_data(spi->master,word_len); | 243 | *rx = spi100k_read_data(spi->master, word_len); |
255 | } while(c); | 244 | } while (c); |
256 | } | 245 | } |
257 | return count - c; | 246 | return count - c; |
258 | } | 247 | } |
@@ -294,7 +283,7 @@ static int omap1_spi100k_setup(struct spi_device *spi) | |||
294 | spi100k = spi_master_get_devdata(spi->master); | 283 | spi100k = spi_master_get_devdata(spi->master); |
295 | 284 | ||
296 | if (!cs) { | 285 | if (!cs) { |
297 | cs = kzalloc(sizeof *cs, GFP_KERNEL); | 286 | cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); |
298 | if (!cs) | 287 | if (!cs) |
299 | return -ENOMEM; | 288 | return -ENOMEM; |
300 | cs->base = spi100k->base + spi->chip_select * 0x14; | 289 | cs->base = spi100k->base + spi->chip_select * 0x14; |
@@ -411,14 +400,14 @@ static int omap1_spi100k_probe(struct platform_device *pdev) | |||
411 | if (!pdev->id) | 400 | if (!pdev->id) |
412 | return -EINVAL; | 401 | return -EINVAL; |
413 | 402 | ||
414 | master = spi_alloc_master(&pdev->dev, sizeof *spi100k); | 403 | master = spi_alloc_master(&pdev->dev, sizeof(*spi100k)); |
415 | if (master == NULL) { | 404 | if (master == NULL) { |
416 | dev_dbg(&pdev->dev, "master allocation failed\n"); | 405 | dev_dbg(&pdev->dev, "master allocation failed\n"); |
417 | return -ENOMEM; | 406 | return -ENOMEM; |
418 | } | 407 | } |
419 | 408 | ||
420 | if (pdev->id != -1) | 409 | if (pdev->id != -1) |
421 | master->bus_num = pdev->id; | 410 | master->bus_num = pdev->id; |
422 | 411 | ||
423 | master->setup = omap1_spi100k_setup; | 412 | master->setup = omap1_spi100k_setup; |
424 | master->transfer_one_message = omap1_spi100k_transfer_one_message; | 413 | master->transfer_one_message = omap1_spi100k_transfer_one_message; |
@@ -434,7 +423,6 @@ static int omap1_spi100k_probe(struct platform_device *pdev) | |||
434 | platform_set_drvdata(pdev, master); | 423 | platform_set_drvdata(pdev, master); |
435 | 424 | ||
436 | spi100k = spi_master_get_devdata(master); | 425 | spi100k = spi_master_get_devdata(master); |
437 | spi100k->master = master; | ||
438 | 426 | ||
439 | /* | 427 | /* |
440 | * The memory region base address is taken as the platform_data. | 428 | * The memory region base address is taken as the platform_data. |
@@ -461,8 +449,6 @@ static int omap1_spi100k_probe(struct platform_device *pdev) | |||
461 | if (status < 0) | 449 | if (status < 0) |
462 | goto err; | 450 | goto err; |
463 | 451 | ||
464 | spi100k->state = SPI_RUNNING; | ||
465 | |||
466 | return status; | 452 | return status; |
467 | 453 | ||
468 | err: | 454 | err: |
diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index 9313fd3b413d..be2a2e108e2f 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c | |||
@@ -99,7 +99,6 @@ struct uwire_spi { | |||
99 | }; | 99 | }; |
100 | 100 | ||
101 | struct uwire_state { | 101 | struct uwire_state { |
102 | unsigned bits_per_word; | ||
103 | unsigned div1_idx; | 102 | unsigned div1_idx; |
104 | }; | 103 | }; |
105 | 104 | ||
@@ -210,9 +209,8 @@ static void uwire_chipselect(struct spi_device *spi, int value) | |||
210 | 209 | ||
211 | static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t) | 210 | static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t) |
212 | { | 211 | { |
213 | struct uwire_state *ust = spi->controller_state; | ||
214 | unsigned len = t->len; | 212 | unsigned len = t->len; |
215 | unsigned bits = ust->bits_per_word; | 213 | unsigned bits = t->bits_per_word ? : spi->bits_per_word; |
216 | unsigned bytes; | 214 | unsigned bytes; |
217 | u16 val, w; | 215 | u16 val, w; |
218 | int status = 0; | 216 | int status = 0; |
@@ -220,10 +218,6 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t) | |||
220 | if (!t->tx_buf && !t->rx_buf) | 218 | if (!t->tx_buf && !t->rx_buf) |
221 | return 0; | 219 | return 0; |
222 | 220 | ||
223 | /* Microwire doesn't read and write concurrently */ | ||
224 | if (t->tx_buf && t->rx_buf) | ||
225 | return -EPERM; | ||
226 | |||
227 | w = spi->chip_select << 10; | 221 | w = spi->chip_select << 10; |
228 | w |= CS_CMD; | 222 | w |= CS_CMD; |
229 | 223 | ||
@@ -322,7 +316,6 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
322 | struct uwire_state *ust = spi->controller_state; | 316 | struct uwire_state *ust = spi->controller_state; |
323 | struct uwire_spi *uwire; | 317 | struct uwire_spi *uwire; |
324 | unsigned flags = 0; | 318 | unsigned flags = 0; |
325 | unsigned bits; | ||
326 | unsigned hz; | 319 | unsigned hz; |
327 | unsigned long rate; | 320 | unsigned long rate; |
328 | int div1_idx; | 321 | int div1_idx; |
@@ -332,23 +325,6 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
332 | 325 | ||
333 | uwire = spi_master_get_devdata(spi->master); | 326 | uwire = spi_master_get_devdata(spi->master); |
334 | 327 | ||
335 | if (spi->chip_select > 3) { | ||
336 | pr_debug("%s: cs%d?\n", dev_name(&spi->dev), spi->chip_select); | ||
337 | status = -ENODEV; | ||
338 | goto done; | ||
339 | } | ||
340 | |||
341 | bits = spi->bits_per_word; | ||
342 | if (t != NULL && t->bits_per_word) | ||
343 | bits = t->bits_per_word; | ||
344 | |||
345 | if (bits > 16) { | ||
346 | pr_debug("%s: wordsize %d?\n", dev_name(&spi->dev), bits); | ||
347 | status = -ENODEV; | ||
348 | goto done; | ||
349 | } | ||
350 | ust->bits_per_word = bits; | ||
351 | |||
352 | /* mode 0..3, clock inverted separately; | 328 | /* mode 0..3, clock inverted separately; |
353 | * standard nCS signaling; | 329 | * standard nCS signaling; |
354 | * don't treat DI=high as "not ready" | 330 | * don't treat DI=high as "not ready" |
@@ -502,6 +478,7 @@ static int uwire_probe(struct platform_device *pdev) | |||
502 | status = PTR_ERR(uwire->ck); | 478 | status = PTR_ERR(uwire->ck); |
503 | dev_dbg(&pdev->dev, "no functional clock?\n"); | 479 | dev_dbg(&pdev->dev, "no functional clock?\n"); |
504 | spi_master_put(master); | 480 | spi_master_put(master); |
481 | iounmap(uwire_base); | ||
505 | return status; | 482 | return status; |
506 | } | 483 | } |
507 | clk_enable(uwire->ck); | 484 | clk_enable(uwire->ck); |
@@ -515,7 +492,7 @@ static int uwire_probe(struct platform_device *pdev) | |||
515 | 492 | ||
516 | /* the spi->mode bits understood by this driver: */ | 493 | /* the spi->mode bits understood by this driver: */ |
517 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; | 494 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; |
518 | 495 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16); | |
519 | master->flags = SPI_MASTER_HALF_DUPLEX; | 496 | master->flags = SPI_MASTER_HALF_DUPLEX; |
520 | 497 | ||
521 | master->bus_num = 2; /* "official" */ | 498 | master->bus_num = 2; /* "official" */ |
@@ -539,14 +516,13 @@ static int uwire_probe(struct platform_device *pdev) | |||
539 | static int uwire_remove(struct platform_device *pdev) | 516 | static int uwire_remove(struct platform_device *pdev) |
540 | { | 517 | { |
541 | struct uwire_spi *uwire = platform_get_drvdata(pdev); | 518 | struct uwire_spi *uwire = platform_get_drvdata(pdev); |
542 | int status; | ||
543 | 519 | ||
544 | // FIXME remove all child devices, somewhere ... | 520 | // FIXME remove all child devices, somewhere ... |
545 | 521 | ||
546 | status = spi_bitbang_stop(&uwire->bitbang); | 522 | spi_bitbang_stop(&uwire->bitbang); |
547 | uwire_off(uwire); | 523 | uwire_off(uwire); |
548 | iounmap(uwire_base); | 524 | iounmap(uwire_base); |
549 | return status; | 525 | return 0; |
550 | } | 526 | } |
551 | 527 | ||
552 | /* work with hotplug and coldplug */ | 528 | /* work with hotplug and coldplug */ |
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index a72127f08e39..2941c5b96ebc 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
@@ -22,7 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/init.h> | ||
26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
28 | #include <linux/device.h> | 27 | #include <linux/device.h> |
@@ -45,6 +44,7 @@ | |||
45 | #include <linux/platform_data/spi-omap2-mcspi.h> | 44 | #include <linux/platform_data/spi-omap2-mcspi.h> |
46 | 45 | ||
47 | #define OMAP2_MCSPI_MAX_FREQ 48000000 | 46 | #define OMAP2_MCSPI_MAX_FREQ 48000000 |
47 | #define OMAP2_MCSPI_MAX_DIVIDER 4096 | ||
48 | #define OMAP2_MCSPI_MAX_FIFODEPTH 64 | 48 | #define OMAP2_MCSPI_MAX_FIFODEPTH 64 |
49 | #define OMAP2_MCSPI_MAX_FIFOWCNT 0xFFFF | 49 | #define OMAP2_MCSPI_MAX_FIFOWCNT 0xFFFF |
50 | #define SPI_AUTOSUSPEND_TIMEOUT 2000 | 50 | #define SPI_AUTOSUSPEND_TIMEOUT 2000 |
@@ -89,6 +89,7 @@ | |||
89 | #define OMAP2_MCSPI_CHCONF_FORCE BIT(20) | 89 | #define OMAP2_MCSPI_CHCONF_FORCE BIT(20) |
90 | #define OMAP2_MCSPI_CHCONF_FFET BIT(27) | 90 | #define OMAP2_MCSPI_CHCONF_FFET BIT(27) |
91 | #define OMAP2_MCSPI_CHCONF_FFER BIT(28) | 91 | #define OMAP2_MCSPI_CHCONF_FFER BIT(28) |
92 | #define OMAP2_MCSPI_CHCONF_CLKG BIT(29) | ||
92 | 93 | ||
93 | #define OMAP2_MCSPI_CHSTAT_RXS BIT(0) | 94 | #define OMAP2_MCSPI_CHSTAT_RXS BIT(0) |
94 | #define OMAP2_MCSPI_CHSTAT_TXS BIT(1) | 95 | #define OMAP2_MCSPI_CHSTAT_TXS BIT(1) |
@@ -96,6 +97,7 @@ | |||
96 | #define OMAP2_MCSPI_CHSTAT_TXFFE BIT(3) | 97 | #define OMAP2_MCSPI_CHSTAT_TXFFE BIT(3) |
97 | 98 | ||
98 | #define OMAP2_MCSPI_CHCTRL_EN BIT(0) | 99 | #define OMAP2_MCSPI_CHCTRL_EN BIT(0) |
100 | #define OMAP2_MCSPI_CHCTRL_EXTCLK_MASK (0xff << 8) | ||
99 | 101 | ||
100 | #define OMAP2_MCSPI_WAKEUPENABLE_WKEN BIT(0) | 102 | #define OMAP2_MCSPI_WAKEUPENABLE_WKEN BIT(0) |
101 | 103 | ||
@@ -149,7 +151,7 @@ struct omap2_mcspi_cs { | |||
149 | int word_len; | 151 | int word_len; |
150 | struct list_head node; | 152 | struct list_head node; |
151 | /* Context save and restore shadow register */ | 153 | /* Context save and restore shadow register */ |
152 | u32 chconf0; | 154 | u32 chconf0, chctrl0; |
153 | }; | 155 | }; |
154 | 156 | ||
155 | static inline void mcspi_write_reg(struct spi_master *master, | 157 | static inline void mcspi_write_reg(struct spi_master *master, |
@@ -230,10 +232,16 @@ static void omap2_mcspi_set_dma_req(const struct spi_device *spi, | |||
230 | 232 | ||
231 | static void omap2_mcspi_set_enable(const struct spi_device *spi, int enable) | 233 | static void omap2_mcspi_set_enable(const struct spi_device *spi, int enable) |
232 | { | 234 | { |
235 | struct omap2_mcspi_cs *cs = spi->controller_state; | ||
233 | u32 l; | 236 | u32 l; |
234 | 237 | ||
235 | l = enable ? OMAP2_MCSPI_CHCTRL_EN : 0; | 238 | l = cs->chctrl0; |
236 | mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCTRL0, l); | 239 | if (enable) |
240 | l |= OMAP2_MCSPI_CHCTRL_EN; | ||
241 | else | ||
242 | l &= ~OMAP2_MCSPI_CHCTRL_EN; | ||
243 | cs->chctrl0 = l; | ||
244 | mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCTRL0, cs->chctrl0); | ||
237 | /* Flash post-writes */ | 245 | /* Flash post-writes */ |
238 | mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCTRL0); | 246 | mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCTRL0); |
239 | } | 247 | } |
@@ -840,7 +848,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, | |||
840 | struct omap2_mcspi_cs *cs = spi->controller_state; | 848 | struct omap2_mcspi_cs *cs = spi->controller_state; |
841 | struct omap2_mcspi *mcspi; | 849 | struct omap2_mcspi *mcspi; |
842 | struct spi_master *spi_cntrl; | 850 | struct spi_master *spi_cntrl; |
843 | u32 l = 0, div = 0; | 851 | u32 l = 0, clkd = 0, div, extclk = 0, clkg = 0; |
844 | u8 word_len = spi->bits_per_word; | 852 | u8 word_len = spi->bits_per_word; |
845 | u32 speed_hz = spi->max_speed_hz; | 853 | u32 speed_hz = spi->max_speed_hz; |
846 | 854 | ||
@@ -856,7 +864,17 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, | |||
856 | speed_hz = t->speed_hz; | 864 | speed_hz = t->speed_hz; |
857 | 865 | ||
858 | speed_hz = min_t(u32, speed_hz, OMAP2_MCSPI_MAX_FREQ); | 866 | speed_hz = min_t(u32, speed_hz, OMAP2_MCSPI_MAX_FREQ); |
859 | div = omap2_mcspi_calc_divisor(speed_hz); | 867 | if (speed_hz < (OMAP2_MCSPI_MAX_FREQ / OMAP2_MCSPI_MAX_DIVIDER)) { |
868 | clkd = omap2_mcspi_calc_divisor(speed_hz); | ||
869 | speed_hz = OMAP2_MCSPI_MAX_FREQ >> clkd; | ||
870 | clkg = 0; | ||
871 | } else { | ||
872 | div = (OMAP2_MCSPI_MAX_FREQ + speed_hz - 1) / speed_hz; | ||
873 | speed_hz = OMAP2_MCSPI_MAX_FREQ / div; | ||
874 | clkd = (div - 1) & 0xf; | ||
875 | extclk = (div - 1) >> 4; | ||
876 | clkg = OMAP2_MCSPI_CHCONF_CLKG; | ||
877 | } | ||
860 | 878 | ||
861 | l = mcspi_cached_chconf0(spi); | 879 | l = mcspi_cached_chconf0(spi); |
862 | 880 | ||
@@ -885,7 +903,16 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, | |||
885 | 903 | ||
886 | /* set clock divisor */ | 904 | /* set clock divisor */ |
887 | l &= ~OMAP2_MCSPI_CHCONF_CLKD_MASK; | 905 | l &= ~OMAP2_MCSPI_CHCONF_CLKD_MASK; |
888 | l |= div << 2; | 906 | l |= clkd << 2; |
907 | |||
908 | /* set clock granularity */ | ||
909 | l &= ~OMAP2_MCSPI_CHCONF_CLKG; | ||
910 | l |= clkg; | ||
911 | if (clkg) { | ||
912 | cs->chctrl0 &= ~OMAP2_MCSPI_CHCTRL_EXTCLK_MASK; | ||
913 | cs->chctrl0 |= extclk << 8; | ||
914 | mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCTRL0, cs->chctrl0); | ||
915 | } | ||
889 | 916 | ||
890 | /* set SPI mode 0..3 */ | 917 | /* set SPI mode 0..3 */ |
891 | if (spi->mode & SPI_CPOL) | 918 | if (spi->mode & SPI_CPOL) |
@@ -900,7 +927,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, | |||
900 | mcspi_write_chconf0(spi, l); | 927 | mcspi_write_chconf0(spi, l); |
901 | 928 | ||
902 | dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n", | 929 | dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n", |
903 | OMAP2_MCSPI_MAX_FREQ >> div, | 930 | speed_hz, |
904 | (spi->mode & SPI_CPHA) ? "trailing" : "leading", | 931 | (spi->mode & SPI_CPHA) ? "trailing" : "leading", |
905 | (spi->mode & SPI_CPOL) ? "inverted" : "normal"); | 932 | (spi->mode & SPI_CPOL) ? "inverted" : "normal"); |
906 | 933 | ||
@@ -972,6 +999,7 @@ static int omap2_mcspi_setup(struct spi_device *spi) | |||
972 | cs->base = mcspi->base + spi->chip_select * 0x14; | 999 | cs->base = mcspi->base + spi->chip_select * 0x14; |
973 | cs->phys = mcspi->phys + spi->chip_select * 0x14; | 1000 | cs->phys = mcspi->phys + spi->chip_select * 0x14; |
974 | cs->chconf0 = 0; | 1001 | cs->chconf0 = 0; |
1002 | cs->chctrl0 = 0; | ||
975 | spi->controller_state = cs; | 1003 | spi->controller_state = cs; |
976 | /* Link this to context save list */ | 1004 | /* Link this to context save list */ |
977 | list_add_tail(&cs->node, &ctx->cs); | 1005 | list_add_tail(&cs->node, &ctx->cs); |
@@ -1057,12 +1085,15 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m) | |||
1057 | status = -EINVAL; | 1085 | status = -EINVAL; |
1058 | break; | 1086 | break; |
1059 | } | 1087 | } |
1060 | if (par_override || t->speed_hz || t->bits_per_word) { | 1088 | if (par_override || |
1089 | (t->speed_hz != spi->max_speed_hz) || | ||
1090 | (t->bits_per_word != spi->bits_per_word)) { | ||
1061 | par_override = 1; | 1091 | par_override = 1; |
1062 | status = omap2_mcspi_setup_transfer(spi, t); | 1092 | status = omap2_mcspi_setup_transfer(spi, t); |
1063 | if (status < 0) | 1093 | if (status < 0) |
1064 | break; | 1094 | break; |
1065 | if (!t->speed_hz && !t->bits_per_word) | 1095 | if (t->speed_hz == spi->max_speed_hz && |
1096 | t->bits_per_word == spi->bits_per_word) | ||
1066 | par_override = 0; | 1097 | par_override = 0; |
1067 | } | 1098 | } |
1068 | if (cd && cd->cs_per_word) { | 1099 | if (cd && cd->cs_per_word) { |
@@ -1176,16 +1207,12 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, | |||
1176 | m->actual_length = 0; | 1207 | m->actual_length = 0; |
1177 | m->status = 0; | 1208 | m->status = 0; |
1178 | 1209 | ||
1179 | /* reject invalid messages and transfers */ | ||
1180 | if (list_empty(&m->transfers)) | ||
1181 | return -EINVAL; | ||
1182 | list_for_each_entry(t, &m->transfers, transfer_list) { | 1210 | list_for_each_entry(t, &m->transfers, transfer_list) { |
1183 | const void *tx_buf = t->tx_buf; | 1211 | const void *tx_buf = t->tx_buf; |
1184 | void *rx_buf = t->rx_buf; | 1212 | void *rx_buf = t->rx_buf; |
1185 | unsigned len = t->len; | 1213 | unsigned len = t->len; |
1186 | 1214 | ||
1187 | if (t->speed_hz > OMAP2_MCSPI_MAX_FREQ | 1215 | if ((len && !(rx_buf || tx_buf))) { |
1188 | || (len && !(rx_buf || tx_buf))) { | ||
1189 | dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n", | 1216 | dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n", |
1190 | t->speed_hz, | 1217 | t->speed_hz, |
1191 | len, | 1218 | len, |
@@ -1194,12 +1221,6 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, | |||
1194 | t->bits_per_word); | 1221 | t->bits_per_word); |
1195 | return -EINVAL; | 1222 | return -EINVAL; |
1196 | } | 1223 | } |
1197 | if (t->speed_hz && t->speed_hz < (OMAP2_MCSPI_MAX_FREQ >> 15)) { | ||
1198 | dev_dbg(mcspi->dev, "speed_hz %d below minimum %d Hz\n", | ||
1199 | t->speed_hz, | ||
1200 | OMAP2_MCSPI_MAX_FREQ >> 15); | ||
1201 | return -EINVAL; | ||
1202 | } | ||
1203 | 1224 | ||
1204 | if (m->is_dma_mapped || len < DMA_MIN_BYTES) | 1225 | if (m->is_dma_mapped || len < DMA_MIN_BYTES) |
1205 | continue; | 1226 | continue; |
@@ -1311,6 +1332,8 @@ static int omap2_mcspi_probe(struct platform_device *pdev) | |||
1311 | master->transfer_one_message = omap2_mcspi_transfer_one_message; | 1332 | master->transfer_one_message = omap2_mcspi_transfer_one_message; |
1312 | master->cleanup = omap2_mcspi_cleanup; | 1333 | master->cleanup = omap2_mcspi_cleanup; |
1313 | master->dev.of_node = node; | 1334 | master->dev.of_node = node; |
1335 | master->max_speed_hz = OMAP2_MCSPI_MAX_FREQ; | ||
1336 | master->min_speed_hz = OMAP2_MCSPI_MAX_FREQ >> 15; | ||
1314 | 1337 | ||
1315 | platform_set_drvdata(pdev, master); | 1338 | platform_set_drvdata(pdev, master); |
1316 | 1339 | ||
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 7f2121fe2622..d018a4aac3a1 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
14 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
15 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
@@ -43,8 +42,6 @@ | |||
43 | struct orion_spi { | 42 | struct orion_spi { |
44 | struct spi_master *master; | 43 | struct spi_master *master; |
45 | void __iomem *base; | 44 | void __iomem *base; |
46 | unsigned int max_speed; | ||
47 | unsigned int min_speed; | ||
48 | struct clk *clk; | 45 | struct clk *clk; |
49 | }; | 46 | }; |
50 | 47 | ||
@@ -75,23 +72,6 @@ orion_spi_clrbits(struct orion_spi *orion_spi, u32 reg, u32 mask) | |||
75 | writel(val, reg_addr); | 72 | writel(val, reg_addr); |
76 | } | 73 | } |
77 | 74 | ||
78 | static int orion_spi_set_transfer_size(struct orion_spi *orion_spi, int size) | ||
79 | { | ||
80 | if (size == 16) { | ||
81 | orion_spi_setbits(orion_spi, ORION_SPI_IF_CONFIG_REG, | ||
82 | ORION_SPI_IF_8_16_BIT_MODE); | ||
83 | } else if (size == 8) { | ||
84 | orion_spi_clrbits(orion_spi, ORION_SPI_IF_CONFIG_REG, | ||
85 | ORION_SPI_IF_8_16_BIT_MODE); | ||
86 | } else { | ||
87 | pr_debug("Bad bits per word value %d (only 8 or 16 are allowed).\n", | ||
88 | size); | ||
89 | return -EINVAL; | ||
90 | } | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed) | 75 | static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed) |
96 | { | 76 | { |
97 | u32 tclk_hz; | 77 | u32 tclk_hz; |
@@ -170,7 +150,14 @@ orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
170 | if (rc) | 150 | if (rc) |
171 | return rc; | 151 | return rc; |
172 | 152 | ||
173 | return orion_spi_set_transfer_size(orion_spi, bits_per_word); | 153 | if (bits_per_word == 16) |
154 | orion_spi_setbits(orion_spi, ORION_SPI_IF_CONFIG_REG, | ||
155 | ORION_SPI_IF_8_16_BIT_MODE); | ||
156 | else | ||
157 | orion_spi_clrbits(orion_spi, ORION_SPI_IF_CONFIG_REG, | ||
158 | ORION_SPI_IF_8_16_BIT_MODE); | ||
159 | |||
160 | return 0; | ||
174 | } | 161 | } |
175 | 162 | ||
176 | static void orion_spi_set_cs(struct orion_spi *orion_spi, int enable) | 163 | static void orion_spi_set_cs(struct orion_spi *orion_spi, int enable) |
@@ -260,11 +247,9 @@ orion_spi_write_read_16bit(struct spi_device *spi, | |||
260 | static unsigned int | 247 | static unsigned int |
261 | orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) | 248 | orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) |
262 | { | 249 | { |
263 | struct orion_spi *orion_spi; | ||
264 | unsigned int count; | 250 | unsigned int count; |
265 | int word_len; | 251 | int word_len; |
266 | 252 | ||
267 | orion_spi = spi_master_get_devdata(spi->master); | ||
268 | word_len = spi->bits_per_word; | 253 | word_len = spi->bits_per_word; |
269 | count = xfer->len; | 254 | count = xfer->len; |
270 | 255 | ||
@@ -310,27 +295,6 @@ static int orion_spi_transfer_one_message(struct spi_master *master, | |||
310 | goto msg_done; | 295 | goto msg_done; |
311 | 296 | ||
312 | list_for_each_entry(t, &m->transfers, transfer_list) { | 297 | list_for_each_entry(t, &m->transfers, transfer_list) { |
313 | /* make sure buffer length is even when working in 16 | ||
314 | * bit mode*/ | ||
315 | if ((t->bits_per_word == 16) && (t->len & 1)) { | ||
316 | dev_err(&spi->dev, | ||
317 | "message rejected : " | ||
318 | "odd data length %d while in 16 bit mode\n", | ||
319 | t->len); | ||
320 | status = -EIO; | ||
321 | goto msg_done; | ||
322 | } | ||
323 | |||
324 | if (t->speed_hz && t->speed_hz < orion_spi->min_speed) { | ||
325 | dev_err(&spi->dev, | ||
326 | "message rejected : " | ||
327 | "device min speed (%d Hz) exceeds " | ||
328 | "required transfer speed (%d Hz)\n", | ||
329 | orion_spi->min_speed, t->speed_hz); | ||
330 | status = -EIO; | ||
331 | goto msg_done; | ||
332 | } | ||
333 | |||
334 | if (par_override || t->speed_hz || t->bits_per_word) { | 298 | if (par_override || t->speed_hz || t->bits_per_word) { |
335 | par_override = 1; | 299 | par_override = 1; |
336 | status = orion_spi_setup_transfer(spi, t); | 300 | status = orion_spi_setup_transfer(spi, t); |
@@ -375,28 +339,6 @@ static int orion_spi_reset(struct orion_spi *orion_spi) | |||
375 | return 0; | 339 | return 0; |
376 | } | 340 | } |
377 | 341 | ||
378 | static int orion_spi_setup(struct spi_device *spi) | ||
379 | { | ||
380 | struct orion_spi *orion_spi; | ||
381 | |||
382 | orion_spi = spi_master_get_devdata(spi->master); | ||
383 | |||
384 | if ((spi->max_speed_hz == 0) | ||
385 | || (spi->max_speed_hz > orion_spi->max_speed)) | ||
386 | spi->max_speed_hz = orion_spi->max_speed; | ||
387 | |||
388 | if (spi->max_speed_hz < orion_spi->min_speed) { | ||
389 | dev_err(&spi->dev, "setup: requested speed too low %d Hz\n", | ||
390 | spi->max_speed_hz); | ||
391 | return -EINVAL; | ||
392 | } | ||
393 | |||
394 | /* | ||
395 | * baudrate & width will be set orion_spi_setup_transfer | ||
396 | */ | ||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | static int orion_spi_probe(struct platform_device *pdev) | 342 | static int orion_spi_probe(struct platform_device *pdev) |
401 | { | 343 | { |
402 | struct spi_master *master; | 344 | struct spi_master *master; |
@@ -425,9 +367,9 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
425 | /* we support only mode 0, and no options */ | 367 | /* we support only mode 0, and no options */ |
426 | master->mode_bits = SPI_CPHA | SPI_CPOL; | 368 | master->mode_bits = SPI_CPHA | SPI_CPOL; |
427 | 369 | ||
428 | master->setup = orion_spi_setup; | ||
429 | master->transfer_one_message = orion_spi_transfer_one_message; | 370 | master->transfer_one_message = orion_spi_transfer_one_message; |
430 | master->num_chipselect = ORION_NUM_CHIPSELECTS; | 371 | master->num_chipselect = ORION_NUM_CHIPSELECTS; |
372 | master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); | ||
431 | 373 | ||
432 | platform_set_drvdata(pdev, master); | 374 | platform_set_drvdata(pdev, master); |
433 | 375 | ||
@@ -443,8 +385,8 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
443 | clk_prepare(spi->clk); | 385 | clk_prepare(spi->clk); |
444 | clk_enable(spi->clk); | 386 | clk_enable(spi->clk); |
445 | tclk_hz = clk_get_rate(spi->clk); | 387 | tclk_hz = clk_get_rate(spi->clk); |
446 | spi->max_speed = DIV_ROUND_UP(tclk_hz, 4); | 388 | master->max_speed_hz = DIV_ROUND_UP(tclk_hz, 4); |
447 | spi->min_speed = DIV_ROUND_UP(tclk_hz, 30); | 389 | master->min_speed_hz = DIV_ROUND_UP(tclk_hz, 30); |
448 | 390 | ||
449 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 391 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
450 | spi->base = devm_ioremap_resource(&pdev->dev, r); | 392 | spi->base = devm_ioremap_resource(&pdev->dev, r); |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index d37e840944d6..51d99779682f 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -459,9 +459,8 @@ static void giveback(struct pl022 *pl022) | |||
459 | struct spi_transfer *last_transfer; | 459 | struct spi_transfer *last_transfer; |
460 | pl022->next_msg_cs_active = false; | 460 | pl022->next_msg_cs_active = false; |
461 | 461 | ||
462 | last_transfer = list_entry(pl022->cur_msg->transfers.prev, | 462 | last_transfer = list_last_entry(&pl022->cur_msg->transfers, |
463 | struct spi_transfer, | 463 | struct spi_transfer, transfer_list); |
464 | transfer_list); | ||
465 | 464 | ||
466 | /* Delay if requested before any change in chip select */ | 465 | /* Delay if requested before any change in chip select */ |
467 | if (last_transfer->delay_usecs) | 466 | if (last_transfer->delay_usecs) |
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index 5ee56726f8d0..80b8408ac3e3 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c | |||
@@ -24,7 +24,6 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/init.h> | ||
28 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
30 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index 3c0b55125f1e..713af4806f26 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/device.h> | 12 | #include <linux/device.h> |
14 | #include <linux/dma-mapping.h> | 13 | #include <linux/dma-mapping.h> |
15 | #include <linux/dmaengine.h> | 14 | #include <linux/dmaengine.h> |
diff --git a/drivers/spi/spi-pxa2xx-pxadma.c b/drivers/spi/spi-pxa2xx-pxadma.c index 2916efc7cfe5..e8a26f25d5c0 100644 --- a/drivers/spi/spi-pxa2xx-pxadma.c +++ b/drivers/spi/spi-pxa2xx-pxadma.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/device.h> | 22 | #include <linux/device.h> |
24 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index c702fc536a77..41185d0557fa 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -362,8 +362,7 @@ static void giveback(struct driver_data *drv_data) | |||
362 | drv_data->cur_msg = NULL; | 362 | drv_data->cur_msg = NULL; |
363 | drv_data->cur_transfer = NULL; | 363 | drv_data->cur_transfer = NULL; |
364 | 364 | ||
365 | last_transfer = list_entry(msg->transfers.prev, | 365 | last_transfer = list_last_entry(&msg->transfers, struct spi_transfer, |
366 | struct spi_transfer, | ||
367 | transfer_list); | 366 | transfer_list); |
368 | 367 | ||
369 | /* Delay if requested before any change in chip select */ | 368 | /* Delay if requested before any change in chip select */ |
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c new file mode 100644 index 000000000000..b032e8885e24 --- /dev/null +++ b/drivers/spi/spi-qup.c | |||
@@ -0,0 +1,779 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2014, The Linux foundation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License rev 2 and | ||
6 | * only rev 2 as published by the free Software foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or fITNESS fOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #include <linux/clk.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/list.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/pm_runtime.h> | ||
24 | #include <linux/spi/spi.h> | ||
25 | |||
26 | #define QUP_CONFIG 0x0000 | ||
27 | #define QUP_STATE 0x0004 | ||
28 | #define QUP_IO_M_MODES 0x0008 | ||
29 | #define QUP_SW_RESET 0x000c | ||
30 | #define QUP_OPERATIONAL 0x0018 | ||
31 | #define QUP_ERROR_FLAGS 0x001c | ||
32 | #define QUP_ERROR_FLAGS_EN 0x0020 | ||
33 | #define QUP_OPERATIONAL_MASK 0x0028 | ||
34 | #define QUP_HW_VERSION 0x0030 | ||
35 | #define QUP_MX_OUTPUT_CNT 0x0100 | ||
36 | #define QUP_OUTPUT_FIFO 0x0110 | ||
37 | #define QUP_MX_WRITE_CNT 0x0150 | ||
38 | #define QUP_MX_INPUT_CNT 0x0200 | ||
39 | #define QUP_MX_READ_CNT 0x0208 | ||
40 | #define QUP_INPUT_FIFO 0x0218 | ||
41 | |||
42 | #define SPI_CONFIG 0x0300 | ||
43 | #define SPI_IO_CONTROL 0x0304 | ||
44 | #define SPI_ERROR_FLAGS 0x0308 | ||
45 | #define SPI_ERROR_FLAGS_EN 0x030c | ||
46 | |||
47 | /* QUP_CONFIG fields */ | ||
48 | #define QUP_CONFIG_SPI_MODE (1 << 8) | ||
49 | #define QUP_CONFIG_CLOCK_AUTO_GATE BIT(13) | ||
50 | #define QUP_CONFIG_NO_INPUT BIT(7) | ||
51 | #define QUP_CONFIG_NO_OUTPUT BIT(6) | ||
52 | #define QUP_CONFIG_N 0x001f | ||
53 | |||
54 | /* QUP_STATE fields */ | ||
55 | #define QUP_STATE_VALID BIT(2) | ||
56 | #define QUP_STATE_RESET 0 | ||
57 | #define QUP_STATE_RUN 1 | ||
58 | #define QUP_STATE_PAUSE 3 | ||
59 | #define QUP_STATE_MASK 3 | ||
60 | #define QUP_STATE_CLEAR 2 | ||
61 | |||
62 | #define QUP_HW_VERSION_2_1_1 0x20010001 | ||
63 | |||
64 | /* QUP_IO_M_MODES fields */ | ||
65 | #define QUP_IO_M_PACK_EN BIT(15) | ||
66 | #define QUP_IO_M_UNPACK_EN BIT(14) | ||
67 | #define QUP_IO_M_INPUT_MODE_MASK_SHIFT 12 | ||
68 | #define QUP_IO_M_OUTPUT_MODE_MASK_SHIFT 10 | ||
69 | #define QUP_IO_M_INPUT_MODE_MASK (3 << QUP_IO_M_INPUT_MODE_MASK_SHIFT) | ||
70 | #define QUP_IO_M_OUTPUT_MODE_MASK (3 << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT) | ||
71 | |||
72 | #define QUP_IO_M_OUTPUT_BLOCK_SIZE(x) (((x) & (0x03 << 0)) >> 0) | ||
73 | #define QUP_IO_M_OUTPUT_FIFO_SIZE(x) (((x) & (0x07 << 2)) >> 2) | ||
74 | #define QUP_IO_M_INPUT_BLOCK_SIZE(x) (((x) & (0x03 << 5)) >> 5) | ||
75 | #define QUP_IO_M_INPUT_FIFO_SIZE(x) (((x) & (0x07 << 7)) >> 7) | ||
76 | |||
77 | #define QUP_IO_M_MODE_FIFO 0 | ||
78 | #define QUP_IO_M_MODE_BLOCK 1 | ||
79 | #define QUP_IO_M_MODE_DMOV 2 | ||
80 | #define QUP_IO_M_MODE_BAM 3 | ||
81 | |||
82 | /* QUP_OPERATIONAL fields */ | ||
83 | #define QUP_OP_MAX_INPUT_DONE_FLAG BIT(11) | ||
84 | #define QUP_OP_MAX_OUTPUT_DONE_FLAG BIT(10) | ||
85 | #define QUP_OP_IN_SERVICE_FLAG BIT(9) | ||
86 | #define QUP_OP_OUT_SERVICE_FLAG BIT(8) | ||
87 | #define QUP_OP_IN_FIFO_FULL BIT(7) | ||
88 | #define QUP_OP_OUT_FIFO_FULL BIT(6) | ||
89 | #define QUP_OP_IN_FIFO_NOT_EMPTY BIT(5) | ||
90 | #define QUP_OP_OUT_FIFO_NOT_EMPTY BIT(4) | ||
91 | |||
92 | /* QUP_ERROR_FLAGS and QUP_ERROR_FLAGS_EN fields */ | ||
93 | #define QUP_ERROR_OUTPUT_OVER_RUN BIT(5) | ||
94 | #define QUP_ERROR_INPUT_UNDER_RUN BIT(4) | ||
95 | #define QUP_ERROR_OUTPUT_UNDER_RUN BIT(3) | ||
96 | #define QUP_ERROR_INPUT_OVER_RUN BIT(2) | ||
97 | |||
98 | /* SPI_CONFIG fields */ | ||
99 | #define SPI_CONFIG_HS_MODE BIT(10) | ||
100 | #define SPI_CONFIG_INPUT_FIRST BIT(9) | ||
101 | #define SPI_CONFIG_LOOPBACK BIT(8) | ||
102 | |||
103 | /* SPI_IO_CONTROL fields */ | ||
104 | #define SPI_IO_C_FORCE_CS BIT(11) | ||
105 | #define SPI_IO_C_CLK_IDLE_HIGH BIT(10) | ||
106 | #define SPI_IO_C_MX_CS_MODE BIT(8) | ||
107 | #define SPI_IO_C_CS_N_POLARITY_0 BIT(4) | ||
108 | #define SPI_IO_C_CS_SELECT(x) (((x) & 3) << 2) | ||
109 | #define SPI_IO_C_CS_SELECT_MASK 0x000c | ||
110 | #define SPI_IO_C_TRISTATE_CS BIT(1) | ||
111 | #define SPI_IO_C_NO_TRI_STATE BIT(0) | ||
112 | |||
113 | /* SPI_ERROR_FLAGS and SPI_ERROR_FLAGS_EN fields */ | ||
114 | #define SPI_ERROR_CLK_OVER_RUN BIT(1) | ||
115 | #define SPI_ERROR_CLK_UNDER_RUN BIT(0) | ||
116 | |||
117 | #define SPI_NUM_CHIPSELECTS 4 | ||
118 | |||
119 | /* high speed mode is when bus rate is greater then 26MHz */ | ||
120 | #define SPI_HS_MIN_RATE 26000000 | ||
121 | #define SPI_MAX_RATE 50000000 | ||
122 | |||
123 | #define SPI_DELAY_THRESHOLD 1 | ||
124 | #define SPI_DELAY_RETRY 10 | ||
125 | |||
126 | struct spi_qup { | ||
127 | void __iomem *base; | ||
128 | struct device *dev; | ||
129 | struct clk *cclk; /* core clock */ | ||
130 | struct clk *iclk; /* interface clock */ | ||
131 | int irq; | ||
132 | spinlock_t lock; | ||
133 | |||
134 | int in_fifo_sz; | ||
135 | int out_fifo_sz; | ||
136 | int in_blk_sz; | ||
137 | int out_blk_sz; | ||
138 | |||
139 | struct spi_transfer *xfer; | ||
140 | struct completion done; | ||
141 | int error; | ||
142 | int w_size; /* bytes per SPI word */ | ||
143 | int tx_bytes; | ||
144 | int rx_bytes; | ||
145 | }; | ||
146 | |||
147 | |||
148 | static inline bool spi_qup_is_valid_state(struct spi_qup *controller) | ||
149 | { | ||
150 | u32 opstate = readl_relaxed(controller->base + QUP_STATE); | ||
151 | |||
152 | return opstate & QUP_STATE_VALID; | ||
153 | } | ||
154 | |||
155 | static int spi_qup_set_state(struct spi_qup *controller, u32 state) | ||
156 | { | ||
157 | unsigned long loop; | ||
158 | u32 cur_state; | ||
159 | |||
160 | loop = 0; | ||
161 | while (!spi_qup_is_valid_state(controller)) { | ||
162 | |||
163 | usleep_range(SPI_DELAY_THRESHOLD, SPI_DELAY_THRESHOLD * 2); | ||
164 | |||
165 | if (++loop > SPI_DELAY_RETRY) | ||
166 | return -EIO; | ||
167 | } | ||
168 | |||
169 | if (loop) | ||
170 | dev_dbg(controller->dev, "invalid state for %ld,us %d\n", | ||
171 | loop, state); | ||
172 | |||
173 | cur_state = readl_relaxed(controller->base + QUP_STATE); | ||
174 | /* | ||
175 | * Per spec: for PAUSE_STATE to RESET_STATE, two writes | ||
176 | * of (b10) are required | ||
177 | */ | ||
178 | if (((cur_state & QUP_STATE_MASK) == QUP_STATE_PAUSE) && | ||
179 | (state == QUP_STATE_RESET)) { | ||
180 | writel_relaxed(QUP_STATE_CLEAR, controller->base + QUP_STATE); | ||
181 | writel_relaxed(QUP_STATE_CLEAR, controller->base + QUP_STATE); | ||
182 | } else { | ||
183 | cur_state &= ~QUP_STATE_MASK; | ||
184 | cur_state |= state; | ||
185 | writel_relaxed(cur_state, controller->base + QUP_STATE); | ||
186 | } | ||
187 | |||
188 | loop = 0; | ||
189 | while (!spi_qup_is_valid_state(controller)) { | ||
190 | |||
191 | usleep_range(SPI_DELAY_THRESHOLD, SPI_DELAY_THRESHOLD * 2); | ||
192 | |||
193 | if (++loop > SPI_DELAY_RETRY) | ||
194 | return -EIO; | ||
195 | } | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | |||
201 | static void spi_qup_fifo_read(struct spi_qup *controller, | ||
202 | struct spi_transfer *xfer) | ||
203 | { | ||
204 | u8 *rx_buf = xfer->rx_buf; | ||
205 | u32 word, state; | ||
206 | int idx, shift, w_size; | ||
207 | |||
208 | w_size = controller->w_size; | ||
209 | |||
210 | while (controller->rx_bytes < xfer->len) { | ||
211 | |||
212 | state = readl_relaxed(controller->base + QUP_OPERATIONAL); | ||
213 | if (0 == (state & QUP_OP_IN_FIFO_NOT_EMPTY)) | ||
214 | break; | ||
215 | |||
216 | word = readl_relaxed(controller->base + QUP_INPUT_FIFO); | ||
217 | |||
218 | if (!rx_buf) { | ||
219 | controller->rx_bytes += w_size; | ||
220 | continue; | ||
221 | } | ||
222 | |||
223 | for (idx = 0; idx < w_size; idx++, controller->rx_bytes++) { | ||
224 | /* | ||
225 | * The data format depends on bytes per SPI word: | ||
226 | * 4 bytes: 0x12345678 | ||
227 | * 2 bytes: 0x00001234 | ||
228 | * 1 byte : 0x00000012 | ||
229 | */ | ||
230 | shift = BITS_PER_BYTE; | ||
231 | shift *= (w_size - idx - 1); | ||
232 | rx_buf[controller->rx_bytes] = word >> shift; | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | static void spi_qup_fifo_write(struct spi_qup *controller, | ||
238 | struct spi_transfer *xfer) | ||
239 | { | ||
240 | const u8 *tx_buf = xfer->tx_buf; | ||
241 | u32 word, state, data; | ||
242 | int idx, w_size; | ||
243 | |||
244 | w_size = controller->w_size; | ||
245 | |||
246 | while (controller->tx_bytes < xfer->len) { | ||
247 | |||
248 | state = readl_relaxed(controller->base + QUP_OPERATIONAL); | ||
249 | if (state & QUP_OP_OUT_FIFO_FULL) | ||
250 | break; | ||
251 | |||
252 | word = 0; | ||
253 | for (idx = 0; idx < w_size; idx++, controller->tx_bytes++) { | ||
254 | |||
255 | if (!tx_buf) { | ||
256 | controller->tx_bytes += w_size; | ||
257 | break; | ||
258 | } | ||
259 | |||
260 | data = tx_buf[controller->tx_bytes]; | ||
261 | word |= data << (BITS_PER_BYTE * (3 - idx)); | ||
262 | } | ||
263 | |||
264 | writel_relaxed(word, controller->base + QUP_OUTPUT_FIFO); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) | ||
269 | { | ||
270 | struct spi_qup *controller = dev_id; | ||
271 | struct spi_transfer *xfer; | ||
272 | u32 opflags, qup_err, spi_err; | ||
273 | unsigned long flags; | ||
274 | int error = 0; | ||
275 | |||
276 | spin_lock_irqsave(&controller->lock, flags); | ||
277 | xfer = controller->xfer; | ||
278 | controller->xfer = NULL; | ||
279 | spin_unlock_irqrestore(&controller->lock, flags); | ||
280 | |||
281 | qup_err = readl_relaxed(controller->base + QUP_ERROR_FLAGS); | ||
282 | spi_err = readl_relaxed(controller->base + SPI_ERROR_FLAGS); | ||
283 | opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); | ||
284 | |||
285 | writel_relaxed(qup_err, controller->base + QUP_ERROR_FLAGS); | ||
286 | writel_relaxed(spi_err, controller->base + SPI_ERROR_FLAGS); | ||
287 | writel_relaxed(opflags, controller->base + QUP_OPERATIONAL); | ||
288 | |||
289 | if (!xfer) { | ||
290 | dev_err_ratelimited(controller->dev, "unexpected irq %x08 %x08 %x08\n", | ||
291 | qup_err, spi_err, opflags); | ||
292 | return IRQ_HANDLED; | ||
293 | } | ||
294 | |||
295 | if (qup_err) { | ||
296 | if (qup_err & QUP_ERROR_OUTPUT_OVER_RUN) | ||
297 | dev_warn(controller->dev, "OUTPUT_OVER_RUN\n"); | ||
298 | if (qup_err & QUP_ERROR_INPUT_UNDER_RUN) | ||
299 | dev_warn(controller->dev, "INPUT_UNDER_RUN\n"); | ||
300 | if (qup_err & QUP_ERROR_OUTPUT_UNDER_RUN) | ||
301 | dev_warn(controller->dev, "OUTPUT_UNDER_RUN\n"); | ||
302 | if (qup_err & QUP_ERROR_INPUT_OVER_RUN) | ||
303 | dev_warn(controller->dev, "INPUT_OVER_RUN\n"); | ||
304 | |||
305 | error = -EIO; | ||
306 | } | ||
307 | |||
308 | if (spi_err) { | ||
309 | if (spi_err & SPI_ERROR_CLK_OVER_RUN) | ||
310 | dev_warn(controller->dev, "CLK_OVER_RUN\n"); | ||
311 | if (spi_err & SPI_ERROR_CLK_UNDER_RUN) | ||
312 | dev_warn(controller->dev, "CLK_UNDER_RUN\n"); | ||
313 | |||
314 | error = -EIO; | ||
315 | } | ||
316 | |||
317 | if (opflags & QUP_OP_IN_SERVICE_FLAG) | ||
318 | spi_qup_fifo_read(controller, xfer); | ||
319 | |||
320 | if (opflags & QUP_OP_OUT_SERVICE_FLAG) | ||
321 | spi_qup_fifo_write(controller, xfer); | ||
322 | |||
323 | spin_lock_irqsave(&controller->lock, flags); | ||
324 | controller->error = error; | ||
325 | controller->xfer = xfer; | ||
326 | spin_unlock_irqrestore(&controller->lock, flags); | ||
327 | |||
328 | if (controller->rx_bytes == xfer->len || error) | ||
329 | complete(&controller->done); | ||
330 | |||
331 | return IRQ_HANDLED; | ||
332 | } | ||
333 | |||
334 | |||
335 | /* set clock freq ... bits per word */ | ||
336 | static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) | ||
337 | { | ||
338 | struct spi_qup *controller = spi_master_get_devdata(spi->master); | ||
339 | u32 config, iomode, mode; | ||
340 | int ret, n_words, w_size; | ||
341 | |||
342 | if (spi->mode & SPI_LOOP && xfer->len > controller->in_fifo_sz) { | ||
343 | dev_err(controller->dev, "too big size for loopback %d > %d\n", | ||
344 | xfer->len, controller->in_fifo_sz); | ||
345 | return -EIO; | ||
346 | } | ||
347 | |||
348 | ret = clk_set_rate(controller->cclk, xfer->speed_hz); | ||
349 | if (ret) { | ||
350 | dev_err(controller->dev, "fail to set frequency %d", | ||
351 | xfer->speed_hz); | ||
352 | return -EIO; | ||
353 | } | ||
354 | |||
355 | if (spi_qup_set_state(controller, QUP_STATE_RESET)) { | ||
356 | dev_err(controller->dev, "cannot set RESET state\n"); | ||
357 | return -EIO; | ||
358 | } | ||
359 | |||
360 | w_size = 4; | ||
361 | if (xfer->bits_per_word <= 8) | ||
362 | w_size = 1; | ||
363 | else if (xfer->bits_per_word <= 16) | ||
364 | w_size = 2; | ||
365 | |||
366 | n_words = xfer->len / w_size; | ||
367 | controller->w_size = w_size; | ||
368 | |||
369 | if (n_words <= controller->in_fifo_sz) { | ||
370 | mode = QUP_IO_M_MODE_FIFO; | ||
371 | writel_relaxed(n_words, controller->base + QUP_MX_READ_CNT); | ||
372 | writel_relaxed(n_words, controller->base + QUP_MX_WRITE_CNT); | ||
373 | /* must be zero for FIFO */ | ||
374 | writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); | ||
375 | writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); | ||
376 | } else { | ||
377 | mode = QUP_IO_M_MODE_BLOCK; | ||
378 | writel_relaxed(n_words, controller->base + QUP_MX_INPUT_CNT); | ||
379 | writel_relaxed(n_words, controller->base + QUP_MX_OUTPUT_CNT); | ||
380 | /* must be zero for BLOCK and BAM */ | ||
381 | writel_relaxed(0, controller->base + QUP_MX_READ_CNT); | ||
382 | writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); | ||
383 | } | ||
384 | |||
385 | iomode = readl_relaxed(controller->base + QUP_IO_M_MODES); | ||
386 | /* Set input and output transfer mode */ | ||
387 | iomode &= ~(QUP_IO_M_INPUT_MODE_MASK | QUP_IO_M_OUTPUT_MODE_MASK); | ||
388 | iomode &= ~(QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN); | ||
389 | iomode |= (mode << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT); | ||
390 | iomode |= (mode << QUP_IO_M_INPUT_MODE_MASK_SHIFT); | ||
391 | |||
392 | writel_relaxed(iomode, controller->base + QUP_IO_M_MODES); | ||
393 | |||
394 | config = readl_relaxed(controller->base + SPI_CONFIG); | ||
395 | |||
396 | if (spi->mode & SPI_LOOP) | ||
397 | config |= SPI_CONFIG_LOOPBACK; | ||
398 | else | ||
399 | config &= ~SPI_CONFIG_LOOPBACK; | ||
400 | |||
401 | if (spi->mode & SPI_CPHA) | ||
402 | config &= ~SPI_CONFIG_INPUT_FIRST; | ||
403 | else | ||
404 | config |= SPI_CONFIG_INPUT_FIRST; | ||
405 | |||
406 | /* | ||
407 | * HS_MODE improves signal stability for spi-clk high rates, | ||
408 | * but is invalid in loop back mode. | ||
409 | */ | ||
410 | if ((xfer->speed_hz >= SPI_HS_MIN_RATE) && !(spi->mode & SPI_LOOP)) | ||
411 | config |= SPI_CONFIG_HS_MODE; | ||
412 | else | ||
413 | config &= ~SPI_CONFIG_HS_MODE; | ||
414 | |||
415 | writel_relaxed(config, controller->base + SPI_CONFIG); | ||
416 | |||
417 | config = readl_relaxed(controller->base + QUP_CONFIG); | ||
418 | config &= ~(QUP_CONFIG_NO_INPUT | QUP_CONFIG_NO_OUTPUT | QUP_CONFIG_N); | ||
419 | config |= xfer->bits_per_word - 1; | ||
420 | config |= QUP_CONFIG_SPI_MODE; | ||
421 | writel_relaxed(config, controller->base + QUP_CONFIG); | ||
422 | |||
423 | writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK); | ||
424 | return 0; | ||
425 | } | ||
426 | |||
427 | static void spi_qup_set_cs(struct spi_device *spi, bool enable) | ||
428 | { | ||
429 | struct spi_qup *controller = spi_master_get_devdata(spi->master); | ||
430 | |||
431 | u32 iocontol, mask; | ||
432 | |||
433 | iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL); | ||
434 | |||
435 | /* Disable auto CS toggle and use manual */ | ||
436 | iocontol &= ~SPI_IO_C_MX_CS_MODE; | ||
437 | iocontol |= SPI_IO_C_FORCE_CS; | ||
438 | |||
439 | iocontol &= ~SPI_IO_C_CS_SELECT_MASK; | ||
440 | iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select); | ||
441 | |||
442 | mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select; | ||
443 | |||
444 | if (enable) | ||
445 | iocontol |= mask; | ||
446 | else | ||
447 | iocontol &= ~mask; | ||
448 | |||
449 | writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL); | ||
450 | } | ||
451 | |||
452 | static int spi_qup_transfer_one(struct spi_master *master, | ||
453 | struct spi_device *spi, | ||
454 | struct spi_transfer *xfer) | ||
455 | { | ||
456 | struct spi_qup *controller = spi_master_get_devdata(master); | ||
457 | unsigned long timeout, flags; | ||
458 | int ret = -EIO; | ||
459 | |||
460 | ret = spi_qup_io_config(spi, xfer); | ||
461 | if (ret) | ||
462 | return ret; | ||
463 | |||
464 | timeout = DIV_ROUND_UP(xfer->speed_hz, MSEC_PER_SEC); | ||
465 | timeout = DIV_ROUND_UP(xfer->len * 8, timeout); | ||
466 | timeout = 100 * msecs_to_jiffies(timeout); | ||
467 | |||
468 | reinit_completion(&controller->done); | ||
469 | |||
470 | spin_lock_irqsave(&controller->lock, flags); | ||
471 | controller->xfer = xfer; | ||
472 | controller->error = 0; | ||
473 | controller->rx_bytes = 0; | ||
474 | controller->tx_bytes = 0; | ||
475 | spin_unlock_irqrestore(&controller->lock, flags); | ||
476 | |||
477 | if (spi_qup_set_state(controller, QUP_STATE_RUN)) { | ||
478 | dev_warn(controller->dev, "cannot set RUN state\n"); | ||
479 | goto exit; | ||
480 | } | ||
481 | |||
482 | if (spi_qup_set_state(controller, QUP_STATE_PAUSE)) { | ||
483 | dev_warn(controller->dev, "cannot set PAUSE state\n"); | ||
484 | goto exit; | ||
485 | } | ||
486 | |||
487 | spi_qup_fifo_write(controller, xfer); | ||
488 | |||
489 | if (spi_qup_set_state(controller, QUP_STATE_RUN)) { | ||
490 | dev_warn(controller->dev, "cannot set EXECUTE state\n"); | ||
491 | goto exit; | ||
492 | } | ||
493 | |||
494 | if (!wait_for_completion_timeout(&controller->done, timeout)) | ||
495 | ret = -ETIMEDOUT; | ||
496 | exit: | ||
497 | spi_qup_set_state(controller, QUP_STATE_RESET); | ||
498 | spin_lock_irqsave(&controller->lock, flags); | ||
499 | controller->xfer = NULL; | ||
500 | if (!ret) | ||
501 | ret = controller->error; | ||
502 | spin_unlock_irqrestore(&controller->lock, flags); | ||
503 | return ret; | ||
504 | } | ||
505 | |||
506 | static int spi_qup_probe(struct platform_device *pdev) | ||
507 | { | ||
508 | struct spi_master *master; | ||
509 | struct clk *iclk, *cclk; | ||
510 | struct spi_qup *controller; | ||
511 | struct resource *res; | ||
512 | struct device *dev; | ||
513 | void __iomem *base; | ||
514 | u32 data, max_freq, iomode; | ||
515 | int ret, irq, size; | ||
516 | |||
517 | dev = &pdev->dev; | ||
518 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
519 | base = devm_ioremap_resource(dev, res); | ||
520 | if (IS_ERR(base)) | ||
521 | return PTR_ERR(base); | ||
522 | |||
523 | irq = platform_get_irq(pdev, 0); | ||
524 | if (irq < 0) | ||
525 | return irq; | ||
526 | |||
527 | cclk = devm_clk_get(dev, "core"); | ||
528 | if (IS_ERR(cclk)) | ||
529 | return PTR_ERR(cclk); | ||
530 | |||
531 | iclk = devm_clk_get(dev, "iface"); | ||
532 | if (IS_ERR(iclk)) | ||
533 | return PTR_ERR(iclk); | ||
534 | |||
535 | /* This is optional parameter */ | ||
536 | if (of_property_read_u32(dev->of_node, "spi-max-frequency", &max_freq)) | ||
537 | max_freq = SPI_MAX_RATE; | ||
538 | |||
539 | if (!max_freq || max_freq > SPI_MAX_RATE) { | ||
540 | dev_err(dev, "invalid clock frequency %d\n", max_freq); | ||
541 | return -ENXIO; | ||
542 | } | ||
543 | |||
544 | ret = clk_prepare_enable(cclk); | ||
545 | if (ret) { | ||
546 | dev_err(dev, "cannot enable core clock\n"); | ||
547 | return ret; | ||
548 | } | ||
549 | |||
550 | ret = clk_prepare_enable(iclk); | ||
551 | if (ret) { | ||
552 | clk_disable_unprepare(cclk); | ||
553 | dev_err(dev, "cannot enable iface clock\n"); | ||
554 | return ret; | ||
555 | } | ||
556 | |||
557 | data = readl_relaxed(base + QUP_HW_VERSION); | ||
558 | |||
559 | if (data < QUP_HW_VERSION_2_1_1) { | ||
560 | clk_disable_unprepare(cclk); | ||
561 | clk_disable_unprepare(iclk); | ||
562 | dev_err(dev, "v.%08x is not supported\n", data); | ||
563 | return -ENXIO; | ||
564 | } | ||
565 | |||
566 | master = spi_alloc_master(dev, sizeof(struct spi_qup)); | ||
567 | if (!master) { | ||
568 | clk_disable_unprepare(cclk); | ||
569 | clk_disable_unprepare(iclk); | ||
570 | dev_err(dev, "cannot allocate master\n"); | ||
571 | return -ENOMEM; | ||
572 | } | ||
573 | |||
574 | master->bus_num = pdev->id; | ||
575 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | ||
576 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
577 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); | ||
578 | master->max_speed_hz = max_freq; | ||
579 | master->set_cs = spi_qup_set_cs; | ||
580 | master->transfer_one = spi_qup_transfer_one; | ||
581 | master->dev.of_node = pdev->dev.of_node; | ||
582 | master->auto_runtime_pm = true; | ||
583 | |||
584 | platform_set_drvdata(pdev, master); | ||
585 | |||
586 | controller = spi_master_get_devdata(master); | ||
587 | |||
588 | controller->dev = dev; | ||
589 | controller->base = base; | ||
590 | controller->iclk = iclk; | ||
591 | controller->cclk = cclk; | ||
592 | controller->irq = irq; | ||
593 | |||
594 | spin_lock_init(&controller->lock); | ||
595 | init_completion(&controller->done); | ||
596 | |||
597 | iomode = readl_relaxed(base + QUP_IO_M_MODES); | ||
598 | |||
599 | size = QUP_IO_M_OUTPUT_BLOCK_SIZE(iomode); | ||
600 | if (size) | ||
601 | controller->out_blk_sz = size * 16; | ||
602 | else | ||
603 | controller->out_blk_sz = 4; | ||
604 | |||
605 | size = QUP_IO_M_INPUT_BLOCK_SIZE(iomode); | ||
606 | if (size) | ||
607 | controller->in_blk_sz = size * 16; | ||
608 | else | ||
609 | controller->in_blk_sz = 4; | ||
610 | |||
611 | size = QUP_IO_M_OUTPUT_FIFO_SIZE(iomode); | ||
612 | controller->out_fifo_sz = controller->out_blk_sz * (2 << size); | ||
613 | |||
614 | size = QUP_IO_M_INPUT_FIFO_SIZE(iomode); | ||
615 | controller->in_fifo_sz = controller->in_blk_sz * (2 << size); | ||
616 | |||
617 | dev_info(dev, "v.%08x IN:block:%d, fifo:%d, OUT:block:%d, fifo:%d\n", | ||
618 | data, controller->in_blk_sz, controller->in_fifo_sz, | ||
619 | controller->out_blk_sz, controller->out_fifo_sz); | ||
620 | |||
621 | writel_relaxed(1, base + QUP_SW_RESET); | ||
622 | |||
623 | ret = spi_qup_set_state(controller, QUP_STATE_RESET); | ||
624 | if (ret) { | ||
625 | dev_err(dev, "cannot set RESET state\n"); | ||
626 | goto error; | ||
627 | } | ||
628 | |||
629 | writel_relaxed(0, base + QUP_OPERATIONAL); | ||
630 | writel_relaxed(0, base + QUP_IO_M_MODES); | ||
631 | writel_relaxed(0, base + QUP_OPERATIONAL_MASK); | ||
632 | writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN, | ||
633 | base + SPI_ERROR_FLAGS_EN); | ||
634 | |||
635 | writel_relaxed(0, base + SPI_CONFIG); | ||
636 | writel_relaxed(SPI_IO_C_NO_TRI_STATE, base + SPI_IO_CONTROL); | ||
637 | |||
638 | ret = devm_request_irq(dev, irq, spi_qup_qup_irq, | ||
639 | IRQF_TRIGGER_HIGH, pdev->name, controller); | ||
640 | if (ret) | ||
641 | goto error; | ||
642 | |||
643 | ret = devm_spi_register_master(dev, master); | ||
644 | if (ret) | ||
645 | goto error; | ||
646 | |||
647 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); | ||
648 | pm_runtime_use_autosuspend(dev); | ||
649 | pm_runtime_set_active(dev); | ||
650 | pm_runtime_enable(dev); | ||
651 | return 0; | ||
652 | |||
653 | error: | ||
654 | clk_disable_unprepare(cclk); | ||
655 | clk_disable_unprepare(iclk); | ||
656 | spi_master_put(master); | ||
657 | return ret; | ||
658 | } | ||
659 | |||
660 | #ifdef CONFIG_PM_RUNTIME | ||
661 | static int spi_qup_pm_suspend_runtime(struct device *device) | ||
662 | { | ||
663 | struct spi_master *master = dev_get_drvdata(device); | ||
664 | struct spi_qup *controller = spi_master_get_devdata(master); | ||
665 | u32 config; | ||
666 | |||
667 | /* Enable clocks auto gaiting */ | ||
668 | config = readl(controller->base + QUP_CONFIG); | ||
669 | config |= QUP_CONFIG_CLOCK_AUTO_GATE; | ||
670 | writel_relaxed(config, controller->base + QUP_CONFIG); | ||
671 | return 0; | ||
672 | } | ||
673 | |||
674 | static int spi_qup_pm_resume_runtime(struct device *device) | ||
675 | { | ||
676 | struct spi_master *master = dev_get_drvdata(device); | ||
677 | struct spi_qup *controller = spi_master_get_devdata(master); | ||
678 | u32 config; | ||
679 | |||
680 | /* Disable clocks auto gaiting */ | ||
681 | config = readl_relaxed(controller->base + QUP_CONFIG); | ||
682 | config &= ~QUP_CONFIG_CLOCK_AUTO_GATE; | ||
683 | writel_relaxed(config, controller->base + QUP_CONFIG); | ||
684 | return 0; | ||
685 | } | ||
686 | #endif /* CONFIG_PM_RUNTIME */ | ||
687 | |||
688 | #ifdef CONFIG_PM_SLEEP | ||
689 | static int spi_qup_suspend(struct device *device) | ||
690 | { | ||
691 | struct spi_master *master = dev_get_drvdata(device); | ||
692 | struct spi_qup *controller = spi_master_get_devdata(master); | ||
693 | int ret; | ||
694 | |||
695 | ret = spi_master_suspend(master); | ||
696 | if (ret) | ||
697 | return ret; | ||
698 | |||
699 | ret = spi_qup_set_state(controller, QUP_STATE_RESET); | ||
700 | if (ret) | ||
701 | return ret; | ||
702 | |||
703 | clk_disable_unprepare(controller->cclk); | ||
704 | clk_disable_unprepare(controller->iclk); | ||
705 | return 0; | ||
706 | } | ||
707 | |||
708 | static int spi_qup_resume(struct device *device) | ||
709 | { | ||
710 | struct spi_master *master = dev_get_drvdata(device); | ||
711 | struct spi_qup *controller = spi_master_get_devdata(master); | ||
712 | int ret; | ||
713 | |||
714 | ret = clk_prepare_enable(controller->iclk); | ||
715 | if (ret) | ||
716 | return ret; | ||
717 | |||
718 | ret = clk_prepare_enable(controller->cclk); | ||
719 | if (ret) | ||
720 | return ret; | ||
721 | |||
722 | ret = spi_qup_set_state(controller, QUP_STATE_RESET); | ||
723 | if (ret) | ||
724 | return ret; | ||
725 | |||
726 | return spi_master_resume(master); | ||
727 | } | ||
728 | #endif /* CONFIG_PM_SLEEP */ | ||
729 | |||
730 | static int spi_qup_remove(struct platform_device *pdev) | ||
731 | { | ||
732 | struct spi_master *master = dev_get_drvdata(&pdev->dev); | ||
733 | struct spi_qup *controller = spi_master_get_devdata(master); | ||
734 | int ret; | ||
735 | |||
736 | ret = pm_runtime_get_sync(&pdev->dev); | ||
737 | if (ret) | ||
738 | return ret; | ||
739 | |||
740 | ret = spi_qup_set_state(controller, QUP_STATE_RESET); | ||
741 | if (ret) | ||
742 | return ret; | ||
743 | |||
744 | clk_disable_unprepare(controller->cclk); | ||
745 | clk_disable_unprepare(controller->iclk); | ||
746 | |||
747 | pm_runtime_put_noidle(&pdev->dev); | ||
748 | pm_runtime_disable(&pdev->dev); | ||
749 | return 0; | ||
750 | } | ||
751 | |||
752 | static struct of_device_id spi_qup_dt_match[] = { | ||
753 | { .compatible = "qcom,spi-qup-v2.1.1", }, | ||
754 | { .compatible = "qcom,spi-qup-v2.2.1", }, | ||
755 | { } | ||
756 | }; | ||
757 | MODULE_DEVICE_TABLE(of, spi_qup_dt_match); | ||
758 | |||
759 | static const struct dev_pm_ops spi_qup_dev_pm_ops = { | ||
760 | SET_SYSTEM_SLEEP_PM_OPS(spi_qup_suspend, spi_qup_resume) | ||
761 | SET_RUNTIME_PM_OPS(spi_qup_pm_suspend_runtime, | ||
762 | spi_qup_pm_resume_runtime, | ||
763 | NULL) | ||
764 | }; | ||
765 | |||
766 | static struct platform_driver spi_qup_driver = { | ||
767 | .driver = { | ||
768 | .name = "spi_qup", | ||
769 | .owner = THIS_MODULE, | ||
770 | .pm = &spi_qup_dev_pm_ops, | ||
771 | .of_match_table = spi_qup_dt_match, | ||
772 | }, | ||
773 | .probe = spi_qup_probe, | ||
774 | .remove = spi_qup_remove, | ||
775 | }; | ||
776 | module_platform_driver(spi_qup_driver); | ||
777 | |||
778 | MODULE_LICENSE("GPL v2"); | ||
779 | MODULE_ALIAS("platform:spi_qup"); | ||
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 28987d9fcfe5..1fb0ad213324 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * SH RSPI driver | 2 | * SH RSPI driver |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Renesas Solutions Corp. | 4 | * Copyright (C) 2012, 2013 Renesas Solutions Corp. |
5 | * Copyright (C) 2014 Glider bvba | ||
5 | * | 6 | * |
6 | * Based on spi-sh.c: | 7 | * Based on spi-sh.c: |
7 | * Copyright (C) 2011 Renesas Solutions Corp. | 8 | * Copyright (C) 2011 Renesas Solutions Corp. |
@@ -25,14 +26,14 @@ | |||
25 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
26 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
27 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
28 | #include <linux/list.h> | ||
29 | #include <linux/workqueue.h> | ||
30 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
31 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
32 | #include <linux/io.h> | 31 | #include <linux/io.h> |
33 | #include <linux/clk.h> | 32 | #include <linux/clk.h> |
34 | #include <linux/dmaengine.h> | 33 | #include <linux/dmaengine.h> |
35 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <linux/of_device.h> | ||
36 | #include <linux/pm_runtime.h> | ||
36 | #include <linux/sh_dma.h> | 37 | #include <linux/sh_dma.h> |
37 | #include <linux/spi/spi.h> | 38 | #include <linux/spi/spi.h> |
38 | #include <linux/spi/rspi.h> | 39 | #include <linux/spi/rspi.h> |
@@ -49,7 +50,7 @@ | |||
49 | #define RSPI_SPCKD 0x0c /* Clock Delay Register */ | 50 | #define RSPI_SPCKD 0x0c /* Clock Delay Register */ |
50 | #define RSPI_SSLND 0x0d /* Slave Select Negation Delay Register */ | 51 | #define RSPI_SSLND 0x0d /* Slave Select Negation Delay Register */ |
51 | #define RSPI_SPND 0x0e /* Next-Access Delay Register */ | 52 | #define RSPI_SPND 0x0e /* Next-Access Delay Register */ |
52 | #define RSPI_SPCR2 0x0f /* Control Register 2 */ | 53 | #define RSPI_SPCR2 0x0f /* Control Register 2 (SH only) */ |
53 | #define RSPI_SPCMD0 0x10 /* Command Register 0 */ | 54 | #define RSPI_SPCMD0 0x10 /* Command Register 0 */ |
54 | #define RSPI_SPCMD1 0x12 /* Command Register 1 */ | 55 | #define RSPI_SPCMD1 0x12 /* Command Register 1 */ |
55 | #define RSPI_SPCMD2 0x14 /* Command Register 2 */ | 56 | #define RSPI_SPCMD2 0x14 /* Command Register 2 */ |
@@ -58,16 +59,23 @@ | |||
58 | #define RSPI_SPCMD5 0x1a /* Command Register 5 */ | 59 | #define RSPI_SPCMD5 0x1a /* Command Register 5 */ |
59 | #define RSPI_SPCMD6 0x1c /* Command Register 6 */ | 60 | #define RSPI_SPCMD6 0x1c /* Command Register 6 */ |
60 | #define RSPI_SPCMD7 0x1e /* Command Register 7 */ | 61 | #define RSPI_SPCMD7 0x1e /* Command Register 7 */ |
62 | #define RSPI_SPCMD(i) (RSPI_SPCMD0 + (i) * 2) | ||
63 | #define RSPI_NUM_SPCMD 8 | ||
64 | #define RSPI_RZ_NUM_SPCMD 4 | ||
65 | #define QSPI_NUM_SPCMD 4 | ||
66 | |||
67 | /* RSPI on RZ only */ | ||
61 | #define RSPI_SPBFCR 0x20 /* Buffer Control Register */ | 68 | #define RSPI_SPBFCR 0x20 /* Buffer Control Register */ |
62 | #define RSPI_SPBFDR 0x22 /* Buffer Data Count Setting Register */ | 69 | #define RSPI_SPBFDR 0x22 /* Buffer Data Count Setting Register */ |
63 | 70 | ||
64 | /*qspi only */ | 71 | /* QSPI only */ |
65 | #define QSPI_SPBFCR 0x18 /* Buffer Control Register */ | 72 | #define QSPI_SPBFCR 0x18 /* Buffer Control Register */ |
66 | #define QSPI_SPBDCR 0x1a /* Buffer Data Count Register */ | 73 | #define QSPI_SPBDCR 0x1a /* Buffer Data Count Register */ |
67 | #define QSPI_SPBMUL0 0x1c /* Transfer Data Length Multiplier Setting Register 0 */ | 74 | #define QSPI_SPBMUL0 0x1c /* Transfer Data Length Multiplier Setting Register 0 */ |
68 | #define QSPI_SPBMUL1 0x20 /* Transfer Data Length Multiplier Setting Register 1 */ | 75 | #define QSPI_SPBMUL1 0x20 /* Transfer Data Length Multiplier Setting Register 1 */ |
69 | #define QSPI_SPBMUL2 0x24 /* Transfer Data Length Multiplier Setting Register 2 */ | 76 | #define QSPI_SPBMUL2 0x24 /* Transfer Data Length Multiplier Setting Register 2 */ |
70 | #define QSPI_SPBMUL3 0x28 /* Transfer Data Length Multiplier Setting Register 3 */ | 77 | #define QSPI_SPBMUL3 0x28 /* Transfer Data Length Multiplier Setting Register 3 */ |
78 | #define QSPI_SPBMUL(i) (QSPI_SPBMUL0 + (i) * 4) | ||
71 | 79 | ||
72 | /* SPCR - Control Register */ | 80 | /* SPCR - Control Register */ |
73 | #define SPCR_SPRIE 0x80 /* Receive Interrupt Enable */ | 81 | #define SPCR_SPRIE 0x80 /* Receive Interrupt Enable */ |
@@ -104,7 +112,7 @@ | |||
104 | #define SPSR_PERF 0x08 /* Parity Error Flag */ | 112 | #define SPSR_PERF 0x08 /* Parity Error Flag */ |
105 | #define SPSR_MODF 0x04 /* Mode Fault Error Flag */ | 113 | #define SPSR_MODF 0x04 /* Mode Fault Error Flag */ |
106 | #define SPSR_IDLNF 0x02 /* RSPI Idle Flag */ | 114 | #define SPSR_IDLNF 0x02 /* RSPI Idle Flag */ |
107 | #define SPSR_OVRF 0x01 /* Overrun Error Flag */ | 115 | #define SPSR_OVRF 0x01 /* Overrun Error Flag (RSPI only) */ |
108 | 116 | ||
109 | /* SPSCR - Sequence Control Register */ | 117 | /* SPSCR - Sequence Control Register */ |
110 | #define SPSCR_SPSLN_MASK 0x07 /* Sequence Length Specification */ | 118 | #define SPSCR_SPSLN_MASK 0x07 /* Sequence Length Specification */ |
@@ -121,13 +129,13 @@ | |||
121 | #define SPDCR_SPLWORD SPDCR_SPLW1 | 129 | #define SPDCR_SPLWORD SPDCR_SPLW1 |
122 | #define SPDCR_SPLBYTE SPDCR_SPLW0 | 130 | #define SPDCR_SPLBYTE SPDCR_SPLW0 |
123 | #define SPDCR_SPLW 0x20 /* Access Width Specification (SH) */ | 131 | #define SPDCR_SPLW 0x20 /* Access Width Specification (SH) */ |
124 | #define SPDCR_SPRDTD 0x10 /* Receive Transmit Data Select */ | 132 | #define SPDCR_SPRDTD 0x10 /* Receive Transmit Data Select (SH) */ |
125 | #define SPDCR_SLSEL1 0x08 | 133 | #define SPDCR_SLSEL1 0x08 |
126 | #define SPDCR_SLSEL0 0x04 | 134 | #define SPDCR_SLSEL0 0x04 |
127 | #define SPDCR_SLSEL_MASK 0x0c /* SSL1 Output Select */ | 135 | #define SPDCR_SLSEL_MASK 0x0c /* SSL1 Output Select (SH) */ |
128 | #define SPDCR_SPFC1 0x02 | 136 | #define SPDCR_SPFC1 0x02 |
129 | #define SPDCR_SPFC0 0x01 | 137 | #define SPDCR_SPFC0 0x01 |
130 | #define SPDCR_SPFC_MASK 0x03 /* Frame Count Setting (1-4) */ | 138 | #define SPDCR_SPFC_MASK 0x03 /* Frame Count Setting (1-4) (SH) */ |
131 | 139 | ||
132 | /* SPCKD - Clock Delay Register */ | 140 | /* SPCKD - Clock Delay Register */ |
133 | #define SPCKD_SCKDL_MASK 0x07 /* Clock Delay Setting (1-8) */ | 141 | #define SPCKD_SCKDL_MASK 0x07 /* Clock Delay Setting (1-8) */ |
@@ -151,7 +159,7 @@ | |||
151 | #define SPCMD_LSBF 0x1000 /* LSB First */ | 159 | #define SPCMD_LSBF 0x1000 /* LSB First */ |
152 | #define SPCMD_SPB_MASK 0x0f00 /* Data Length Setting */ | 160 | #define SPCMD_SPB_MASK 0x0f00 /* Data Length Setting */ |
153 | #define SPCMD_SPB_8_TO_16(bit) (((bit - 1) << 8) & SPCMD_SPB_MASK) | 161 | #define SPCMD_SPB_8_TO_16(bit) (((bit - 1) << 8) & SPCMD_SPB_MASK) |
154 | #define SPCMD_SPB_8BIT 0x0000 /* qspi only */ | 162 | #define SPCMD_SPB_8BIT 0x0000 /* QSPI only */ |
155 | #define SPCMD_SPB_16BIT 0x0100 | 163 | #define SPCMD_SPB_16BIT 0x0100 |
156 | #define SPCMD_SPB_20BIT 0x0000 | 164 | #define SPCMD_SPB_20BIT 0x0000 |
157 | #define SPCMD_SPB_24BIT 0x0100 | 165 | #define SPCMD_SPB_24BIT 0x0100 |
@@ -170,8 +178,8 @@ | |||
170 | #define SPCMD_CPHA 0x0001 /* Clock Phase Setting */ | 178 | #define SPCMD_CPHA 0x0001 /* Clock Phase Setting */ |
171 | 179 | ||
172 | /* SPBFCR - Buffer Control Register */ | 180 | /* SPBFCR - Buffer Control Register */ |
173 | #define SPBFCR_TXRST 0x80 /* Transmit Buffer Data Reset (qspi only) */ | 181 | #define SPBFCR_TXRST 0x80 /* Transmit Buffer Data Reset */ |
174 | #define SPBFCR_RXRST 0x40 /* Receive Buffer Data Reset (qspi only) */ | 182 | #define SPBFCR_RXRST 0x40 /* Receive Buffer Data Reset */ |
175 | #define SPBFCR_TXTRG_MASK 0x30 /* Transmit Buffer Data Triggering Number */ | 183 | #define SPBFCR_TXTRG_MASK 0x30 /* Transmit Buffer Data Triggering Number */ |
176 | #define SPBFCR_RXTRG_MASK 0x07 /* Receive Buffer Data Triggering Number */ | 184 | #define SPBFCR_RXTRG_MASK 0x07 /* Receive Buffer Data Triggering Number */ |
177 | 185 | ||
@@ -181,22 +189,21 @@ struct rspi_data { | |||
181 | void __iomem *addr; | 189 | void __iomem *addr; |
182 | u32 max_speed_hz; | 190 | u32 max_speed_hz; |
183 | struct spi_master *master; | 191 | struct spi_master *master; |
184 | struct list_head queue; | ||
185 | struct work_struct ws; | ||
186 | wait_queue_head_t wait; | 192 | wait_queue_head_t wait; |
187 | spinlock_t lock; | ||
188 | struct clk *clk; | 193 | struct clk *clk; |
189 | u8 spsr; | ||
190 | u16 spcmd; | 194 | u16 spcmd; |
195 | u8 spsr; | ||
196 | u8 sppcr; | ||
197 | int rx_irq, tx_irq; | ||
191 | const struct spi_ops *ops; | 198 | const struct spi_ops *ops; |
192 | 199 | ||
193 | /* for dmaengine */ | 200 | /* for dmaengine */ |
194 | struct dma_chan *chan_tx; | 201 | struct dma_chan *chan_tx; |
195 | struct dma_chan *chan_rx; | 202 | struct dma_chan *chan_rx; |
196 | int irq; | ||
197 | 203 | ||
198 | unsigned dma_width_16bit:1; | 204 | unsigned dma_width_16bit:1; |
199 | unsigned dma_callbacked:1; | 205 | unsigned dma_callbacked:1; |
206 | unsigned byte_access:1; | ||
200 | }; | 207 | }; |
201 | 208 | ||
202 | static void rspi_write8(const struct rspi_data *rspi, u8 data, u16 offset) | 209 | static void rspi_write8(const struct rspi_data *rspi, u8 data, u16 offset) |
@@ -224,34 +231,47 @@ static u16 rspi_read16(const struct rspi_data *rspi, u16 offset) | |||
224 | return ioread16(rspi->addr + offset); | 231 | return ioread16(rspi->addr + offset); |
225 | } | 232 | } |
226 | 233 | ||
234 | static void rspi_write_data(const struct rspi_data *rspi, u16 data) | ||
235 | { | ||
236 | if (rspi->byte_access) | ||
237 | rspi_write8(rspi, data, RSPI_SPDR); | ||
238 | else /* 16 bit */ | ||
239 | rspi_write16(rspi, data, RSPI_SPDR); | ||
240 | } | ||
241 | |||
242 | static u16 rspi_read_data(const struct rspi_data *rspi) | ||
243 | { | ||
244 | if (rspi->byte_access) | ||
245 | return rspi_read8(rspi, RSPI_SPDR); | ||
246 | else /* 16 bit */ | ||
247 | return rspi_read16(rspi, RSPI_SPDR); | ||
248 | } | ||
249 | |||
227 | /* optional functions */ | 250 | /* optional functions */ |
228 | struct spi_ops { | 251 | struct spi_ops { |
229 | int (*set_config_register)(const struct rspi_data *rspi, | 252 | int (*set_config_register)(struct rspi_data *rspi, int access_size); |
230 | int access_size); | 253 | int (*transfer_one)(struct spi_master *master, struct spi_device *spi, |
231 | int (*send_pio)(struct rspi_data *rspi, struct spi_message *mesg, | 254 | struct spi_transfer *xfer); |
232 | struct spi_transfer *t); | 255 | u16 mode_bits; |
233 | int (*receive_pio)(struct rspi_data *rspi, struct spi_message *mesg, | ||
234 | struct spi_transfer *t); | ||
235 | |||
236 | }; | 256 | }; |
237 | 257 | ||
238 | /* | 258 | /* |
239 | * functions for RSPI | 259 | * functions for RSPI on legacy SH |
240 | */ | 260 | */ |
241 | static int rspi_set_config_register(const struct rspi_data *rspi, | 261 | static int rspi_set_config_register(struct rspi_data *rspi, int access_size) |
242 | int access_size) | ||
243 | { | 262 | { |
244 | int spbr; | 263 | int spbr; |
245 | 264 | ||
246 | /* Sets output mode(CMOS) and MOSI signal(from previous transfer) */ | 265 | /* Sets output mode, MOSI signal, and (optionally) loopback */ |
247 | rspi_write8(rspi, 0x00, RSPI_SPPCR); | 266 | rspi_write8(rspi, rspi->sppcr, RSPI_SPPCR); |
248 | 267 | ||
249 | /* Sets transfer bit rate */ | 268 | /* Sets transfer bit rate */ |
250 | spbr = clk_get_rate(rspi->clk) / (2 * rspi->max_speed_hz) - 1; | 269 | spbr = clk_get_rate(rspi->clk) / (2 * rspi->max_speed_hz) - 1; |
251 | rspi_write8(rspi, clamp(spbr, 0, 255), RSPI_SPBR); | 270 | rspi_write8(rspi, clamp(spbr, 0, 255), RSPI_SPBR); |
252 | 271 | ||
253 | /* Sets number of frames to be used: 1 frame */ | 272 | /* Disable dummy transmission, set 16-bit word access, 1 frame */ |
254 | rspi_write8(rspi, 0x00, RSPI_SPDCR); | 273 | rspi_write8(rspi, 0, RSPI_SPDCR); |
274 | rspi->byte_access = 0; | ||
255 | 275 | ||
256 | /* Sets RSPCK, SSL, next-access delay value */ | 276 | /* Sets RSPCK, SSL, next-access delay value */ |
257 | rspi_write8(rspi, 0x00, RSPI_SPCKD); | 277 | rspi_write8(rspi, 0x00, RSPI_SPCKD); |
@@ -262,8 +282,41 @@ static int rspi_set_config_register(const struct rspi_data *rspi, | |||
262 | rspi_write8(rspi, 0x00, RSPI_SPCR2); | 282 | rspi_write8(rspi, 0x00, RSPI_SPCR2); |
263 | 283 | ||
264 | /* Sets SPCMD */ | 284 | /* Sets SPCMD */ |
265 | rspi_write16(rspi, SPCMD_SPB_8_TO_16(access_size) | rspi->spcmd, | 285 | rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); |
266 | RSPI_SPCMD0); | 286 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
287 | |||
288 | /* Sets RSPI mode */ | ||
289 | rspi_write8(rspi, SPCR_MSTR, RSPI_SPCR); | ||
290 | |||
291 | return 0; | ||
292 | } | ||
293 | |||
294 | /* | ||
295 | * functions for RSPI on RZ | ||
296 | */ | ||
297 | static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size) | ||
298 | { | ||
299 | int spbr; | ||
300 | |||
301 | /* Sets output mode, MOSI signal, and (optionally) loopback */ | ||
302 | rspi_write8(rspi, rspi->sppcr, RSPI_SPPCR); | ||
303 | |||
304 | /* Sets transfer bit rate */ | ||
305 | spbr = clk_get_rate(rspi->clk) / (2 * rspi->max_speed_hz) - 1; | ||
306 | rspi_write8(rspi, clamp(spbr, 0, 255), RSPI_SPBR); | ||
307 | |||
308 | /* Disable dummy transmission, set byte access */ | ||
309 | rspi_write8(rspi, SPDCR_SPLBYTE, RSPI_SPDCR); | ||
310 | rspi->byte_access = 1; | ||
311 | |||
312 | /* Sets RSPCK, SSL, next-access delay value */ | ||
313 | rspi_write8(rspi, 0x00, RSPI_SPCKD); | ||
314 | rspi_write8(rspi, 0x00, RSPI_SSLND); | ||
315 | rspi_write8(rspi, 0x00, RSPI_SPND); | ||
316 | |||
317 | /* Sets SPCMD */ | ||
318 | rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); | ||
319 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); | ||
267 | 320 | ||
268 | /* Sets RSPI mode */ | 321 | /* Sets RSPI mode */ |
269 | rspi_write8(rspi, SPCR_MSTR, RSPI_SPCR); | 322 | rspi_write8(rspi, SPCR_MSTR, RSPI_SPCR); |
@@ -274,21 +327,20 @@ static int rspi_set_config_register(const struct rspi_data *rspi, | |||
274 | /* | 327 | /* |
275 | * functions for QSPI | 328 | * functions for QSPI |
276 | */ | 329 | */ |
277 | static int qspi_set_config_register(const struct rspi_data *rspi, | 330 | static int qspi_set_config_register(struct rspi_data *rspi, int access_size) |
278 | int access_size) | ||
279 | { | 331 | { |
280 | u16 spcmd; | ||
281 | int spbr; | 332 | int spbr; |
282 | 333 | ||
283 | /* Sets output mode(CMOS) and MOSI signal(from previous transfer) */ | 334 | /* Sets output mode, MOSI signal, and (optionally) loopback */ |
284 | rspi_write8(rspi, 0x00, RSPI_SPPCR); | 335 | rspi_write8(rspi, rspi->sppcr, RSPI_SPPCR); |
285 | 336 | ||
286 | /* Sets transfer bit rate */ | 337 | /* Sets transfer bit rate */ |
287 | spbr = clk_get_rate(rspi->clk) / (2 * rspi->max_speed_hz); | 338 | spbr = clk_get_rate(rspi->clk) / (2 * rspi->max_speed_hz); |
288 | rspi_write8(rspi, clamp(spbr, 0, 255), RSPI_SPBR); | 339 | rspi_write8(rspi, clamp(spbr, 0, 255), RSPI_SPBR); |
289 | 340 | ||
290 | /* Sets number of frames to be used: 1 frame */ | 341 | /* Disable dummy transmission, set byte access */ |
291 | rspi_write8(rspi, 0x00, RSPI_SPDCR); | 342 | rspi_write8(rspi, 0, RSPI_SPDCR); |
343 | rspi->byte_access = 1; | ||
292 | 344 | ||
293 | /* Sets RSPCK, SSL, next-access delay value */ | 345 | /* Sets RSPCK, SSL, next-access delay value */ |
294 | rspi_write8(rspi, 0x00, RSPI_SPCKD); | 346 | rspi_write8(rspi, 0x00, RSPI_SPCKD); |
@@ -297,13 +349,13 @@ static int qspi_set_config_register(const struct rspi_data *rspi, | |||
297 | 349 | ||
298 | /* Data Length Setting */ | 350 | /* Data Length Setting */ |
299 | if (access_size == 8) | 351 | if (access_size == 8) |
300 | spcmd = SPCMD_SPB_8BIT; | 352 | rspi->spcmd |= SPCMD_SPB_8BIT; |
301 | else if (access_size == 16) | 353 | else if (access_size == 16) |
302 | spcmd = SPCMD_SPB_16BIT; | 354 | rspi->spcmd |= SPCMD_SPB_16BIT; |
303 | else | 355 | else |
304 | spcmd = SPCMD_SPB_32BIT; | 356 | rspi->spcmd |= SPCMD_SPB_32BIT; |
305 | 357 | ||
306 | spcmd |= SPCMD_SCKDEN | SPCMD_SLNDEN | rspi->spcmd | SPCMD_SPNDEN; | 358 | rspi->spcmd |= SPCMD_SCKDEN | SPCMD_SLNDEN | SPCMD_SPNDEN; |
307 | 359 | ||
308 | /* Resets transfer data length */ | 360 | /* Resets transfer data length */ |
309 | rspi_write32(rspi, 0, QSPI_SPBMUL0); | 361 | rspi_write32(rspi, 0, QSPI_SPBMUL0); |
@@ -314,9 +366,9 @@ static int qspi_set_config_register(const struct rspi_data *rspi, | |||
314 | rspi_write8(rspi, 0x00, QSPI_SPBFCR); | 366 | rspi_write8(rspi, 0x00, QSPI_SPBFCR); |
315 | 367 | ||
316 | /* Sets SPCMD */ | 368 | /* Sets SPCMD */ |
317 | rspi_write16(rspi, spcmd, RSPI_SPCMD0); | 369 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
318 | 370 | ||
319 | /* Enables SPI function in a master mode */ | 371 | /* Enables SPI function in master mode */ |
320 | rspi_write8(rspi, SPCR_SPE | SPCR_MSTR, RSPI_SPCR); | 372 | rspi_write8(rspi, SPCR_SPE | SPCR_MSTR, RSPI_SPCR); |
321 | 373 | ||
322 | return 0; | 374 | return 0; |
@@ -340,6 +392,9 @@ static int rspi_wait_for_interrupt(struct rspi_data *rspi, u8 wait_mask, | |||
340 | int ret; | 392 | int ret; |
341 | 393 | ||
342 | rspi->spsr = rspi_read8(rspi, RSPI_SPSR); | 394 | rspi->spsr = rspi_read8(rspi, RSPI_SPSR); |
395 | if (rspi->spsr & wait_mask) | ||
396 | return 0; | ||
397 | |||
343 | rspi_enable_irq(rspi, enable_bit); | 398 | rspi_enable_irq(rspi, enable_bit); |
344 | ret = wait_event_timeout(rspi->wait, rspi->spsr & wait_mask, HZ); | 399 | ret = wait_event_timeout(rspi->wait, rspi->spsr & wait_mask, HZ); |
345 | if (ret == 0 && !(rspi->spsr & wait_mask)) | 400 | if (ret == 0 && !(rspi->spsr & wait_mask)) |
@@ -348,78 +403,39 @@ static int rspi_wait_for_interrupt(struct rspi_data *rspi, u8 wait_mask, | |||
348 | return 0; | 403 | return 0; |
349 | } | 404 | } |
350 | 405 | ||
351 | static void rspi_assert_ssl(const struct rspi_data *rspi) | 406 | static int rspi_data_out(struct rspi_data *rspi, u8 data) |
352 | { | ||
353 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_SPE, RSPI_SPCR); | ||
354 | } | ||
355 | |||
356 | static void rspi_negate_ssl(const struct rspi_data *rspi) | ||
357 | { | 407 | { |
358 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_SPE, RSPI_SPCR); | 408 | if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) { |
409 | dev_err(&rspi->master->dev, "transmit timeout\n"); | ||
410 | return -ETIMEDOUT; | ||
411 | } | ||
412 | rspi_write_data(rspi, data); | ||
413 | return 0; | ||
359 | } | 414 | } |
360 | 415 | ||
361 | static int rspi_send_pio(struct rspi_data *rspi, struct spi_message *mesg, | 416 | static int rspi_data_in(struct rspi_data *rspi) |
362 | struct spi_transfer *t) | ||
363 | { | 417 | { |
364 | int remain = t->len; | 418 | u8 data; |
365 | const u8 *data = t->tx_buf; | ||
366 | while (remain > 0) { | ||
367 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_TXMD, | ||
368 | RSPI_SPCR); | ||
369 | |||
370 | if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) { | ||
371 | dev_err(&rspi->master->dev, | ||
372 | "%s: tx empty timeout\n", __func__); | ||
373 | return -ETIMEDOUT; | ||
374 | } | ||
375 | 419 | ||
376 | rspi_write16(rspi, *data, RSPI_SPDR); | 420 | if (rspi_wait_for_interrupt(rspi, SPSR_SPRF, SPCR_SPRIE) < 0) { |
377 | data++; | 421 | dev_err(&rspi->master->dev, "receive timeout\n"); |
378 | remain--; | 422 | return -ETIMEDOUT; |
379 | } | 423 | } |
380 | 424 | data = rspi_read_data(rspi); | |
381 | /* Waiting for the last transmission */ | 425 | return data; |
382 | rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE); | ||
383 | |||
384 | return 0; | ||
385 | } | 426 | } |
386 | 427 | ||
387 | static int qspi_send_pio(struct rspi_data *rspi, struct spi_message *mesg, | 428 | static int rspi_data_out_in(struct rspi_data *rspi, u8 data) |
388 | struct spi_transfer *t) | ||
389 | { | 429 | { |
390 | int remain = t->len; | 430 | int ret; |
391 | const u8 *data = t->tx_buf; | ||
392 | |||
393 | rspi_write8(rspi, SPBFCR_TXRST, QSPI_SPBFCR); | ||
394 | rspi_write8(rspi, 0x00, QSPI_SPBFCR); | ||
395 | |||
396 | while (remain > 0) { | ||
397 | |||
398 | if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) { | ||
399 | dev_err(&rspi->master->dev, | ||
400 | "%s: tx empty timeout\n", __func__); | ||
401 | return -ETIMEDOUT; | ||
402 | } | ||
403 | rspi_write8(rspi, *data++, RSPI_SPDR); | ||
404 | |||
405 | if (rspi_wait_for_interrupt(rspi, SPSR_SPRF, SPCR_SPRIE) < 0) { | ||
406 | dev_err(&rspi->master->dev, | ||
407 | "%s: receive timeout\n", __func__); | ||
408 | return -ETIMEDOUT; | ||
409 | } | ||
410 | rspi_read8(rspi, RSPI_SPDR); | ||
411 | |||
412 | remain--; | ||
413 | } | ||
414 | 431 | ||
415 | /* Waiting for the last transmission */ | 432 | ret = rspi_data_out(rspi, data); |
416 | rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE); | 433 | if (ret < 0) |
434 | return ret; | ||
417 | 435 | ||
418 | return 0; | 436 | return rspi_data_in(rspi); |
419 | } | 437 | } |
420 | 438 | ||
421 | #define send_pio(spi, mesg, t) spi->ops->send_pio(spi, mesg, t) | ||
422 | |||
423 | static void rspi_dma_complete(void *arg) | 439 | static void rspi_dma_complete(void *arg) |
424 | { | 440 | { |
425 | struct rspi_data *rspi = arg; | 441 | struct rspi_data *rspi = arg; |
@@ -471,7 +487,7 @@ static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t) | |||
471 | struct scatterlist sg; | 487 | struct scatterlist sg; |
472 | const void *buf = NULL; | 488 | const void *buf = NULL; |
473 | struct dma_async_tx_descriptor *desc; | 489 | struct dma_async_tx_descriptor *desc; |
474 | unsigned len; | 490 | unsigned int len; |
475 | int ret = 0; | 491 | int ret = 0; |
476 | 492 | ||
477 | if (rspi->dma_width_16bit) { | 493 | if (rspi->dma_width_16bit) { |
@@ -509,7 +525,7 @@ static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t) | |||
509 | * DMAC needs SPTIE, but if SPTIE is set, this IRQ routine will be | 525 | * DMAC needs SPTIE, but if SPTIE is set, this IRQ routine will be |
510 | * called. So, this driver disables the IRQ while DMA transfer. | 526 | * called. So, this driver disables the IRQ while DMA transfer. |
511 | */ | 527 | */ |
512 | disable_irq(rspi->irq); | 528 | disable_irq(rspi->tx_irq); |
513 | 529 | ||
514 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_TXMD, RSPI_SPCR); | 530 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_TXMD, RSPI_SPCR); |
515 | rspi_enable_irq(rspi, SPCR_SPTIE); | 531 | rspi_enable_irq(rspi, SPCR_SPTIE); |
@@ -528,7 +544,7 @@ static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t) | |||
528 | ret = -ETIMEDOUT; | 544 | ret = -ETIMEDOUT; |
529 | rspi_disable_irq(rspi, SPCR_SPTIE); | 545 | rspi_disable_irq(rspi, SPCR_SPTIE); |
530 | 546 | ||
531 | enable_irq(rspi->irq); | 547 | enable_irq(rspi->tx_irq); |
532 | 548 | ||
533 | end: | 549 | end: |
534 | rspi_dma_unmap_sg(&sg, rspi->chan_tx, DMA_TO_DEVICE); | 550 | rspi_dma_unmap_sg(&sg, rspi->chan_tx, DMA_TO_DEVICE); |
@@ -545,46 +561,17 @@ static void rspi_receive_init(const struct rspi_data *rspi) | |||
545 | 561 | ||
546 | spsr = rspi_read8(rspi, RSPI_SPSR); | 562 | spsr = rspi_read8(rspi, RSPI_SPSR); |
547 | if (spsr & SPSR_SPRF) | 563 | if (spsr & SPSR_SPRF) |
548 | rspi_read16(rspi, RSPI_SPDR); /* dummy read */ | 564 | rspi_read_data(rspi); /* dummy read */ |
549 | if (spsr & SPSR_OVRF) | 565 | if (spsr & SPSR_OVRF) |
550 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPSR) & ~SPSR_OVRF, | 566 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPSR) & ~SPSR_OVRF, |
551 | RSPI_SPSR); | 567 | RSPI_SPSR); |
552 | } | 568 | } |
553 | 569 | ||
554 | static int rspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg, | 570 | static void rspi_rz_receive_init(const struct rspi_data *rspi) |
555 | struct spi_transfer *t) | ||
556 | { | 571 | { |
557 | int remain = t->len; | ||
558 | u8 *data; | ||
559 | |||
560 | rspi_receive_init(rspi); | 572 | rspi_receive_init(rspi); |
561 | 573 | rspi_write8(rspi, SPBFCR_TXRST | SPBFCR_RXRST, RSPI_SPBFCR); | |
562 | data = t->rx_buf; | 574 | rspi_write8(rspi, 0, RSPI_SPBFCR); |
563 | while (remain > 0) { | ||
564 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_TXMD, | ||
565 | RSPI_SPCR); | ||
566 | |||
567 | if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) { | ||
568 | dev_err(&rspi->master->dev, | ||
569 | "%s: tx empty timeout\n", __func__); | ||
570 | return -ETIMEDOUT; | ||
571 | } | ||
572 | /* dummy write for generate clock */ | ||
573 | rspi_write16(rspi, DUMMY_DATA, RSPI_SPDR); | ||
574 | |||
575 | if (rspi_wait_for_interrupt(rspi, SPSR_SPRF, SPCR_SPRIE) < 0) { | ||
576 | dev_err(&rspi->master->dev, | ||
577 | "%s: receive timeout\n", __func__); | ||
578 | return -ETIMEDOUT; | ||
579 | } | ||
580 | /* SPDR allows 16 or 32-bit access only */ | ||
581 | *data = (u8)rspi_read16(rspi, RSPI_SPDR); | ||
582 | |||
583 | data++; | ||
584 | remain--; | ||
585 | } | ||
586 | |||
587 | return 0; | ||
588 | } | 575 | } |
589 | 576 | ||
590 | static void qspi_receive_init(const struct rspi_data *rspi) | 577 | static void qspi_receive_init(const struct rspi_data *rspi) |
@@ -593,51 +580,17 @@ static void qspi_receive_init(const struct rspi_data *rspi) | |||
593 | 580 | ||
594 | spsr = rspi_read8(rspi, RSPI_SPSR); | 581 | spsr = rspi_read8(rspi, RSPI_SPSR); |
595 | if (spsr & SPSR_SPRF) | 582 | if (spsr & SPSR_SPRF) |
596 | rspi_read8(rspi, RSPI_SPDR); /* dummy read */ | 583 | rspi_read_data(rspi); /* dummy read */ |
597 | rspi_write8(rspi, SPBFCR_TXRST | SPBFCR_RXRST, QSPI_SPBFCR); | 584 | rspi_write8(rspi, SPBFCR_TXRST | SPBFCR_RXRST, QSPI_SPBFCR); |
598 | rspi_write8(rspi, 0x00, QSPI_SPBFCR); | 585 | rspi_write8(rspi, 0, QSPI_SPBFCR); |
599 | } | 586 | } |
600 | 587 | ||
601 | static int qspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg, | ||
602 | struct spi_transfer *t) | ||
603 | { | ||
604 | int remain = t->len; | ||
605 | u8 *data; | ||
606 | |||
607 | qspi_receive_init(rspi); | ||
608 | |||
609 | data = t->rx_buf; | ||
610 | while (remain > 0) { | ||
611 | |||
612 | if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) { | ||
613 | dev_err(&rspi->master->dev, | ||
614 | "%s: tx empty timeout\n", __func__); | ||
615 | return -ETIMEDOUT; | ||
616 | } | ||
617 | /* dummy write for generate clock */ | ||
618 | rspi_write8(rspi, DUMMY_DATA, RSPI_SPDR); | ||
619 | |||
620 | if (rspi_wait_for_interrupt(rspi, SPSR_SPRF, SPCR_SPRIE) < 0) { | ||
621 | dev_err(&rspi->master->dev, | ||
622 | "%s: receive timeout\n", __func__); | ||
623 | return -ETIMEDOUT; | ||
624 | } | ||
625 | /* SPDR allows 8, 16 or 32-bit access */ | ||
626 | *data++ = rspi_read8(rspi, RSPI_SPDR); | ||
627 | remain--; | ||
628 | } | ||
629 | |||
630 | return 0; | ||
631 | } | ||
632 | |||
633 | #define receive_pio(spi, mesg, t) spi->ops->receive_pio(spi, mesg, t) | ||
634 | |||
635 | static int rspi_receive_dma(struct rspi_data *rspi, struct spi_transfer *t) | 588 | static int rspi_receive_dma(struct rspi_data *rspi, struct spi_transfer *t) |
636 | { | 589 | { |
637 | struct scatterlist sg, sg_dummy; | 590 | struct scatterlist sg, sg_dummy; |
638 | void *dummy = NULL, *rx_buf = NULL; | 591 | void *dummy = NULL, *rx_buf = NULL; |
639 | struct dma_async_tx_descriptor *desc, *desc_dummy; | 592 | struct dma_async_tx_descriptor *desc, *desc_dummy; |
640 | unsigned len; | 593 | unsigned int len; |
641 | int ret = 0; | 594 | int ret = 0; |
642 | 595 | ||
643 | if (rspi->dma_width_16bit) { | 596 | if (rspi->dma_width_16bit) { |
@@ -695,7 +648,9 @@ static int rspi_receive_dma(struct rspi_data *rspi, struct spi_transfer *t) | |||
695 | * DMAC needs SPTIE, but if SPTIE is set, this IRQ routine will be | 648 | * DMAC needs SPTIE, but if SPTIE is set, this IRQ routine will be |
696 | * called. So, this driver disables the IRQ while DMA transfer. | 649 | * called. So, this driver disables the IRQ while DMA transfer. |
697 | */ | 650 | */ |
698 | disable_irq(rspi->irq); | 651 | disable_irq(rspi->tx_irq); |
652 | if (rspi->rx_irq != rspi->tx_irq) | ||
653 | disable_irq(rspi->rx_irq); | ||
699 | 654 | ||
700 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_TXMD, RSPI_SPCR); | 655 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_TXMD, RSPI_SPCR); |
701 | rspi_enable_irq(rspi, SPCR_SPTIE | SPCR_SPRIE); | 656 | rspi_enable_irq(rspi, SPCR_SPTIE | SPCR_SPRIE); |
@@ -718,7 +673,9 @@ static int rspi_receive_dma(struct rspi_data *rspi, struct spi_transfer *t) | |||
718 | ret = -ETIMEDOUT; | 673 | ret = -ETIMEDOUT; |
719 | rspi_disable_irq(rspi, SPCR_SPTIE | SPCR_SPRIE); | 674 | rspi_disable_irq(rspi, SPCR_SPTIE | SPCR_SPRIE); |
720 | 675 | ||
721 | enable_irq(rspi->irq); | 676 | enable_irq(rspi->tx_irq); |
677 | if (rspi->rx_irq != rspi->tx_irq) | ||
678 | enable_irq(rspi->rx_irq); | ||
722 | 679 | ||
723 | end: | 680 | end: |
724 | rspi_dma_unmap_sg(&sg, rspi->chan_rx, DMA_FROM_DEVICE); | 681 | rspi_dma_unmap_sg(&sg, rspi->chan_rx, DMA_FROM_DEVICE); |
@@ -746,56 +703,175 @@ static int rspi_is_dma(const struct rspi_data *rspi, struct spi_transfer *t) | |||
746 | return 0; | 703 | return 0; |
747 | } | 704 | } |
748 | 705 | ||
749 | static void rspi_work(struct work_struct *work) | 706 | static int rspi_transfer_out_in(struct rspi_data *rspi, |
707 | struct spi_transfer *xfer) | ||
750 | { | 708 | { |
751 | struct rspi_data *rspi = container_of(work, struct rspi_data, ws); | 709 | int remain = xfer->len, ret; |
752 | struct spi_message *mesg; | 710 | const u8 *tx_buf = xfer->tx_buf; |
753 | struct spi_transfer *t; | 711 | u8 *rx_buf = xfer->rx_buf; |
754 | unsigned long flags; | 712 | u8 spcr, data; |
755 | int ret; | ||
756 | 713 | ||
757 | while (1) { | 714 | rspi_receive_init(rspi); |
758 | spin_lock_irqsave(&rspi->lock, flags); | 715 | |
759 | if (list_empty(&rspi->queue)) { | 716 | spcr = rspi_read8(rspi, RSPI_SPCR); |
760 | spin_unlock_irqrestore(&rspi->lock, flags); | 717 | if (rx_buf) |
761 | break; | 718 | spcr &= ~SPCR_TXMD; |
762 | } | 719 | else |
763 | mesg = list_entry(rspi->queue.next, struct spi_message, queue); | 720 | spcr |= SPCR_TXMD; |
764 | list_del_init(&mesg->queue); | 721 | rspi_write8(rspi, spcr, RSPI_SPCR); |
765 | spin_unlock_irqrestore(&rspi->lock, flags); | 722 | |
766 | 723 | while (remain > 0) { | |
767 | rspi_assert_ssl(rspi); | 724 | data = tx_buf ? *tx_buf++ : DUMMY_DATA; |
768 | 725 | ret = rspi_data_out(rspi, data); | |
769 | list_for_each_entry(t, &mesg->transfers, transfer_list) { | 726 | if (ret < 0) |
770 | if (t->tx_buf) { | 727 | return ret; |
771 | if (rspi_is_dma(rspi, t)) | 728 | if (rx_buf) { |
772 | ret = rspi_send_dma(rspi, t); | 729 | ret = rspi_data_in(rspi); |
773 | else | 730 | if (ret < 0) |
774 | ret = send_pio(rspi, mesg, t); | 731 | return ret; |
775 | if (ret < 0) | 732 | *rx_buf++ = ret; |
776 | goto error; | ||
777 | } | ||
778 | if (t->rx_buf) { | ||
779 | if (rspi_is_dma(rspi, t)) | ||
780 | ret = rspi_receive_dma(rspi, t); | ||
781 | else | ||
782 | ret = receive_pio(rspi, mesg, t); | ||
783 | if (ret < 0) | ||
784 | goto error; | ||
785 | } | ||
786 | mesg->actual_length += t->len; | ||
787 | } | 733 | } |
788 | rspi_negate_ssl(rspi); | 734 | remain--; |
735 | } | ||
736 | |||
737 | /* Wait for the last transmission */ | ||
738 | rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE); | ||
739 | |||
740 | return 0; | ||
741 | } | ||
742 | |||
743 | static int rspi_transfer_one(struct spi_master *master, struct spi_device *spi, | ||
744 | struct spi_transfer *xfer) | ||
745 | { | ||
746 | struct rspi_data *rspi = spi_master_get_devdata(master); | ||
747 | int ret; | ||
748 | |||
749 | if (!rspi_is_dma(rspi, xfer)) | ||
750 | return rspi_transfer_out_in(rspi, xfer); | ||
751 | |||
752 | if (xfer->tx_buf) { | ||
753 | ret = rspi_send_dma(rspi, xfer); | ||
754 | if (ret < 0) | ||
755 | return ret; | ||
756 | } | ||
757 | if (xfer->rx_buf) | ||
758 | return rspi_receive_dma(rspi, xfer); | ||
759 | |||
760 | return 0; | ||
761 | } | ||
762 | |||
763 | static int rspi_rz_transfer_out_in(struct rspi_data *rspi, | ||
764 | struct spi_transfer *xfer) | ||
765 | { | ||
766 | int remain = xfer->len, ret; | ||
767 | const u8 *tx_buf = xfer->tx_buf; | ||
768 | u8 *rx_buf = xfer->rx_buf; | ||
769 | u8 data; | ||
770 | |||
771 | rspi_rz_receive_init(rspi); | ||
772 | |||
773 | while (remain > 0) { | ||
774 | data = tx_buf ? *tx_buf++ : DUMMY_DATA; | ||
775 | ret = rspi_data_out_in(rspi, data); | ||
776 | if (ret < 0) | ||
777 | return ret; | ||
778 | if (rx_buf) | ||
779 | *rx_buf++ = ret; | ||
780 | remain--; | ||
781 | } | ||
782 | |||
783 | /* Wait for the last transmission */ | ||
784 | rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE); | ||
785 | |||
786 | return 0; | ||
787 | } | ||
788 | |||
789 | static int rspi_rz_transfer_one(struct spi_master *master, | ||
790 | struct spi_device *spi, | ||
791 | struct spi_transfer *xfer) | ||
792 | { | ||
793 | struct rspi_data *rspi = spi_master_get_devdata(master); | ||
794 | |||
795 | return rspi_rz_transfer_out_in(rspi, xfer); | ||
796 | } | ||
797 | |||
798 | static int qspi_transfer_out_in(struct rspi_data *rspi, | ||
799 | struct spi_transfer *xfer) | ||
800 | { | ||
801 | int remain = xfer->len, ret; | ||
802 | const u8 *tx_buf = xfer->tx_buf; | ||
803 | u8 *rx_buf = xfer->rx_buf; | ||
804 | u8 data; | ||
789 | 805 | ||
790 | mesg->status = 0; | 806 | qspi_receive_init(rspi); |
791 | mesg->complete(mesg->context); | 807 | |
808 | while (remain > 0) { | ||
809 | data = tx_buf ? *tx_buf++ : DUMMY_DATA; | ||
810 | ret = rspi_data_out_in(rspi, data); | ||
811 | if (ret < 0) | ||
812 | return ret; | ||
813 | if (rx_buf) | ||
814 | *rx_buf++ = ret; | ||
815 | remain--; | ||
816 | } | ||
817 | |||
818 | /* Wait for the last transmission */ | ||
819 | rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE); | ||
820 | |||
821 | return 0; | ||
822 | } | ||
823 | |||
824 | static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer) | ||
825 | { | ||
826 | const u8 *buf = xfer->tx_buf; | ||
827 | unsigned int i; | ||
828 | int ret; | ||
829 | |||
830 | for (i = 0; i < xfer->len; i++) { | ||
831 | ret = rspi_data_out(rspi, *buf++); | ||
832 | if (ret < 0) | ||
833 | return ret; | ||
792 | } | 834 | } |
793 | 835 | ||
794 | return; | 836 | /* Wait for the last transmission */ |
837 | rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE); | ||
795 | 838 | ||
796 | error: | 839 | return 0; |
797 | mesg->status = ret; | 840 | } |
798 | mesg->complete(mesg->context); | 841 | |
842 | static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer) | ||
843 | { | ||
844 | u8 *buf = xfer->rx_buf; | ||
845 | unsigned int i; | ||
846 | int ret; | ||
847 | |||
848 | for (i = 0; i < xfer->len; i++) { | ||
849 | ret = rspi_data_in(rspi); | ||
850 | if (ret < 0) | ||
851 | return ret; | ||
852 | *buf++ = ret; | ||
853 | } | ||
854 | |||
855 | return 0; | ||
856 | } | ||
857 | |||
858 | static int qspi_transfer_one(struct spi_master *master, struct spi_device *spi, | ||
859 | struct spi_transfer *xfer) | ||
860 | { | ||
861 | struct rspi_data *rspi = spi_master_get_devdata(master); | ||
862 | |||
863 | if (spi->mode & SPI_LOOP) { | ||
864 | return qspi_transfer_out_in(rspi, xfer); | ||
865 | } else if (xfer->tx_buf && xfer->tx_nbits > SPI_NBITS_SINGLE) { | ||
866 | /* Quad or Dual SPI Write */ | ||
867 | return qspi_transfer_out(rspi, xfer); | ||
868 | } else if (xfer->rx_buf && xfer->rx_nbits > SPI_NBITS_SINGLE) { | ||
869 | /* Quad or Dual SPI Read */ | ||
870 | return qspi_transfer_in(rspi, xfer); | ||
871 | } else { | ||
872 | /* Single SPI Transfer */ | ||
873 | return qspi_transfer_out_in(rspi, xfer); | ||
874 | } | ||
799 | } | 875 | } |
800 | 876 | ||
801 | static int rspi_setup(struct spi_device *spi) | 877 | static int rspi_setup(struct spi_device *spi) |
@@ -810,32 +886,115 @@ static int rspi_setup(struct spi_device *spi) | |||
810 | if (spi->mode & SPI_CPHA) | 886 | if (spi->mode & SPI_CPHA) |
811 | rspi->spcmd |= SPCMD_CPHA; | 887 | rspi->spcmd |= SPCMD_CPHA; |
812 | 888 | ||
889 | /* CMOS output mode and MOSI signal from previous transfer */ | ||
890 | rspi->sppcr = 0; | ||
891 | if (spi->mode & SPI_LOOP) | ||
892 | rspi->sppcr |= SPPCR_SPLP; | ||
893 | |||
813 | set_config_register(rspi, 8); | 894 | set_config_register(rspi, 8); |
814 | 895 | ||
815 | return 0; | 896 | return 0; |
816 | } | 897 | } |
817 | 898 | ||
818 | static int rspi_transfer(struct spi_device *spi, struct spi_message *mesg) | 899 | static u16 qspi_transfer_mode(const struct spi_transfer *xfer) |
819 | { | 900 | { |
820 | struct rspi_data *rspi = spi_master_get_devdata(spi->master); | 901 | if (xfer->tx_buf) |
821 | unsigned long flags; | 902 | switch (xfer->tx_nbits) { |
903 | case SPI_NBITS_QUAD: | ||
904 | return SPCMD_SPIMOD_QUAD; | ||
905 | case SPI_NBITS_DUAL: | ||
906 | return SPCMD_SPIMOD_DUAL; | ||
907 | default: | ||
908 | return 0; | ||
909 | } | ||
910 | if (xfer->rx_buf) | ||
911 | switch (xfer->rx_nbits) { | ||
912 | case SPI_NBITS_QUAD: | ||
913 | return SPCMD_SPIMOD_QUAD | SPCMD_SPRW; | ||
914 | case SPI_NBITS_DUAL: | ||
915 | return SPCMD_SPIMOD_DUAL | SPCMD_SPRW; | ||
916 | default: | ||
917 | return 0; | ||
918 | } | ||
919 | |||
920 | return 0; | ||
921 | } | ||
822 | 922 | ||
823 | mesg->actual_length = 0; | 923 | static int qspi_setup_sequencer(struct rspi_data *rspi, |
824 | mesg->status = -EINPROGRESS; | 924 | const struct spi_message *msg) |
925 | { | ||
926 | const struct spi_transfer *xfer; | ||
927 | unsigned int i = 0, len = 0; | ||
928 | u16 current_mode = 0xffff, mode; | ||
929 | |||
930 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | ||
931 | mode = qspi_transfer_mode(xfer); | ||
932 | if (mode == current_mode) { | ||
933 | len += xfer->len; | ||
934 | continue; | ||
935 | } | ||
936 | |||
937 | /* Transfer mode change */ | ||
938 | if (i) { | ||
939 | /* Set transfer data length of previous transfer */ | ||
940 | rspi_write32(rspi, len, QSPI_SPBMUL(i - 1)); | ||
941 | } | ||
825 | 942 | ||
826 | spin_lock_irqsave(&rspi->lock, flags); | 943 | if (i >= QSPI_NUM_SPCMD) { |
827 | list_add_tail(&mesg->queue, &rspi->queue); | 944 | dev_err(&msg->spi->dev, |
828 | schedule_work(&rspi->ws); | 945 | "Too many different transfer modes"); |
829 | spin_unlock_irqrestore(&rspi->lock, flags); | 946 | return -EINVAL; |
947 | } | ||
948 | |||
949 | /* Program transfer mode for this transfer */ | ||
950 | rspi_write16(rspi, rspi->spcmd | mode, RSPI_SPCMD(i)); | ||
951 | current_mode = mode; | ||
952 | len = xfer->len; | ||
953 | i++; | ||
954 | } | ||
955 | if (i) { | ||
956 | /* Set final transfer data length and sequence length */ | ||
957 | rspi_write32(rspi, len, QSPI_SPBMUL(i - 1)); | ||
958 | rspi_write8(rspi, i - 1, RSPI_SPSCR); | ||
959 | } | ||
830 | 960 | ||
831 | return 0; | 961 | return 0; |
832 | } | 962 | } |
833 | 963 | ||
834 | static void rspi_cleanup(struct spi_device *spi) | 964 | static int rspi_prepare_message(struct spi_master *master, |
965 | struct spi_message *msg) | ||
835 | { | 966 | { |
967 | struct rspi_data *rspi = spi_master_get_devdata(master); | ||
968 | int ret; | ||
969 | |||
970 | if (msg->spi->mode & | ||
971 | (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD)) { | ||
972 | /* Setup sequencer for messages with multiple transfer modes */ | ||
973 | ret = qspi_setup_sequencer(rspi, msg); | ||
974 | if (ret < 0) | ||
975 | return ret; | ||
976 | } | ||
977 | |||
978 | /* Enable SPI function in master mode */ | ||
979 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_SPE, RSPI_SPCR); | ||
980 | return 0; | ||
836 | } | 981 | } |
837 | 982 | ||
838 | static irqreturn_t rspi_irq(int irq, void *_sr) | 983 | static int rspi_unprepare_message(struct spi_master *master, |
984 | struct spi_message *msg) | ||
985 | { | ||
986 | struct rspi_data *rspi = spi_master_get_devdata(master); | ||
987 | |||
988 | /* Disable SPI function */ | ||
989 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_SPE, RSPI_SPCR); | ||
990 | |||
991 | /* Reset sequencer for Single SPI Transfers */ | ||
992 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); | ||
993 | rspi_write8(rspi, 0, RSPI_SPSCR); | ||
994 | return 0; | ||
995 | } | ||
996 | |||
997 | static irqreturn_t rspi_irq_mux(int irq, void *_sr) | ||
839 | { | 998 | { |
840 | struct rspi_data *rspi = _sr; | 999 | struct rspi_data *rspi = _sr; |
841 | u8 spsr; | 1000 | u8 spsr; |
@@ -857,6 +1016,36 @@ static irqreturn_t rspi_irq(int irq, void *_sr) | |||
857 | return ret; | 1016 | return ret; |
858 | } | 1017 | } |
859 | 1018 | ||
1019 | static irqreturn_t rspi_irq_rx(int irq, void *_sr) | ||
1020 | { | ||
1021 | struct rspi_data *rspi = _sr; | ||
1022 | u8 spsr; | ||
1023 | |||
1024 | rspi->spsr = spsr = rspi_read8(rspi, RSPI_SPSR); | ||
1025 | if (spsr & SPSR_SPRF) { | ||
1026 | rspi_disable_irq(rspi, SPCR_SPRIE); | ||
1027 | wake_up(&rspi->wait); | ||
1028 | return IRQ_HANDLED; | ||
1029 | } | ||
1030 | |||
1031 | return 0; | ||
1032 | } | ||
1033 | |||
1034 | static irqreturn_t rspi_irq_tx(int irq, void *_sr) | ||
1035 | { | ||
1036 | struct rspi_data *rspi = _sr; | ||
1037 | u8 spsr; | ||
1038 | |||
1039 | rspi->spsr = spsr = rspi_read8(rspi, RSPI_SPSR); | ||
1040 | if (spsr & SPSR_SPTEF) { | ||
1041 | rspi_disable_irq(rspi, SPCR_SPTIE); | ||
1042 | wake_up(&rspi->wait); | ||
1043 | return IRQ_HANDLED; | ||
1044 | } | ||
1045 | |||
1046 | return 0; | ||
1047 | } | ||
1048 | |||
860 | static int rspi_request_dma(struct rspi_data *rspi, | 1049 | static int rspi_request_dma(struct rspi_data *rspi, |
861 | struct platform_device *pdev) | 1050 | struct platform_device *pdev) |
862 | { | 1051 | { |
@@ -923,34 +1112,89 @@ static int rspi_remove(struct platform_device *pdev) | |||
923 | struct rspi_data *rspi = platform_get_drvdata(pdev); | 1112 | struct rspi_data *rspi = platform_get_drvdata(pdev); |
924 | 1113 | ||
925 | rspi_release_dma(rspi); | 1114 | rspi_release_dma(rspi); |
926 | clk_disable(rspi->clk); | 1115 | pm_runtime_disable(&pdev->dev); |
927 | 1116 | ||
928 | return 0; | 1117 | return 0; |
929 | } | 1118 | } |
930 | 1119 | ||
1120 | static const struct spi_ops rspi_ops = { | ||
1121 | .set_config_register = rspi_set_config_register, | ||
1122 | .transfer_one = rspi_transfer_one, | ||
1123 | .mode_bits = SPI_CPHA | SPI_CPOL | SPI_LOOP, | ||
1124 | }; | ||
1125 | |||
1126 | static const struct spi_ops rspi_rz_ops = { | ||
1127 | .set_config_register = rspi_rz_set_config_register, | ||
1128 | .transfer_one = rspi_rz_transfer_one, | ||
1129 | .mode_bits = SPI_CPHA | SPI_CPOL | SPI_LOOP, | ||
1130 | }; | ||
1131 | |||
1132 | static const struct spi_ops qspi_ops = { | ||
1133 | .set_config_register = qspi_set_config_register, | ||
1134 | .transfer_one = qspi_transfer_one, | ||
1135 | .mode_bits = SPI_CPHA | SPI_CPOL | SPI_LOOP | | ||
1136 | SPI_TX_DUAL | SPI_TX_QUAD | | ||
1137 | SPI_RX_DUAL | SPI_RX_QUAD, | ||
1138 | }; | ||
1139 | |||
1140 | #ifdef CONFIG_OF | ||
1141 | static const struct of_device_id rspi_of_match[] = { | ||
1142 | /* RSPI on legacy SH */ | ||
1143 | { .compatible = "renesas,rspi", .data = &rspi_ops }, | ||
1144 | /* RSPI on RZ/A1H */ | ||
1145 | { .compatible = "renesas,rspi-rz", .data = &rspi_rz_ops }, | ||
1146 | /* QSPI on R-Car Gen2 */ | ||
1147 | { .compatible = "renesas,qspi", .data = &qspi_ops }, | ||
1148 | { /* sentinel */ } | ||
1149 | }; | ||
1150 | |||
1151 | MODULE_DEVICE_TABLE(of, rspi_of_match); | ||
1152 | |||
1153 | static int rspi_parse_dt(struct device *dev, struct spi_master *master) | ||
1154 | { | ||
1155 | u32 num_cs; | ||
1156 | int error; | ||
1157 | |||
1158 | /* Parse DT properties */ | ||
1159 | error = of_property_read_u32(dev->of_node, "num-cs", &num_cs); | ||
1160 | if (error) { | ||
1161 | dev_err(dev, "of_property_read_u32 num-cs failed %d\n", error); | ||
1162 | return error; | ||
1163 | } | ||
1164 | |||
1165 | master->num_chipselect = num_cs; | ||
1166 | return 0; | ||
1167 | } | ||
1168 | #else | ||
1169 | #define rspi_of_match NULL | ||
1170 | static inline int rspi_parse_dt(struct device *dev, struct spi_master *master) | ||
1171 | { | ||
1172 | return -EINVAL; | ||
1173 | } | ||
1174 | #endif /* CONFIG_OF */ | ||
1175 | |||
1176 | static int rspi_request_irq(struct device *dev, unsigned int irq, | ||
1177 | irq_handler_t handler, const char *suffix, | ||
1178 | void *dev_id) | ||
1179 | { | ||
1180 | const char *base = dev_name(dev); | ||
1181 | size_t len = strlen(base) + strlen(suffix) + 2; | ||
1182 | char *name = devm_kzalloc(dev, len, GFP_KERNEL); | ||
1183 | if (!name) | ||
1184 | return -ENOMEM; | ||
1185 | snprintf(name, len, "%s:%s", base, suffix); | ||
1186 | return devm_request_irq(dev, irq, handler, 0, name, dev_id); | ||
1187 | } | ||
1188 | |||
931 | static int rspi_probe(struct platform_device *pdev) | 1189 | static int rspi_probe(struct platform_device *pdev) |
932 | { | 1190 | { |
933 | struct resource *res; | 1191 | struct resource *res; |
934 | struct spi_master *master; | 1192 | struct spi_master *master; |
935 | struct rspi_data *rspi; | 1193 | struct rspi_data *rspi; |
936 | int ret, irq; | 1194 | int ret; |
937 | char clk_name[16]; | 1195 | const struct of_device_id *of_id; |
938 | const struct rspi_plat_data *rspi_pd = dev_get_platdata(&pdev->dev); | 1196 | const struct rspi_plat_data *rspi_pd; |
939 | const struct spi_ops *ops; | 1197 | const struct spi_ops *ops; |
940 | const struct platform_device_id *id_entry = pdev->id_entry; | ||
941 | |||
942 | ops = (struct spi_ops *)id_entry->driver_data; | ||
943 | /* ops parameter check */ | ||
944 | if (!ops->set_config_register) { | ||
945 | dev_err(&pdev->dev, "there is no set_config_register\n"); | ||
946 | return -ENODEV; | ||
947 | } | ||
948 | |||
949 | irq = platform_get_irq(pdev, 0); | ||
950 | if (irq < 0) { | ||
951 | dev_err(&pdev->dev, "platform_get_irq error\n"); | ||
952 | return -ENODEV; | ||
953 | } | ||
954 | 1198 | ||
955 | master = spi_alloc_master(&pdev->dev, sizeof(struct rspi_data)); | 1199 | master = spi_alloc_master(&pdev->dev, sizeof(struct rspi_data)); |
956 | if (master == NULL) { | 1200 | if (master == NULL) { |
@@ -958,6 +1202,28 @@ static int rspi_probe(struct platform_device *pdev) | |||
958 | return -ENOMEM; | 1202 | return -ENOMEM; |
959 | } | 1203 | } |
960 | 1204 | ||
1205 | of_id = of_match_device(rspi_of_match, &pdev->dev); | ||
1206 | if (of_id) { | ||
1207 | ops = of_id->data; | ||
1208 | ret = rspi_parse_dt(&pdev->dev, master); | ||
1209 | if (ret) | ||
1210 | goto error1; | ||
1211 | } else { | ||
1212 | ops = (struct spi_ops *)pdev->id_entry->driver_data; | ||
1213 | rspi_pd = dev_get_platdata(&pdev->dev); | ||
1214 | if (rspi_pd && rspi_pd->num_chipselect) | ||
1215 | master->num_chipselect = rspi_pd->num_chipselect; | ||
1216 | else | ||
1217 | master->num_chipselect = 2; /* default */ | ||
1218 | }; | ||
1219 | |||
1220 | /* ops parameter check */ | ||
1221 | if (!ops->set_config_register) { | ||
1222 | dev_err(&pdev->dev, "there is no set_config_register\n"); | ||
1223 | ret = -ENODEV; | ||
1224 | goto error1; | ||
1225 | } | ||
1226 | |||
961 | rspi = spi_master_get_devdata(master); | 1227 | rspi = spi_master_get_devdata(master); |
962 | platform_set_drvdata(pdev, rspi); | 1228 | platform_set_drvdata(pdev, rspi); |
963 | rspi->ops = ops; | 1229 | rspi->ops = ops; |
@@ -970,39 +1236,61 @@ static int rspi_probe(struct platform_device *pdev) | |||
970 | goto error1; | 1236 | goto error1; |
971 | } | 1237 | } |
972 | 1238 | ||
973 | snprintf(clk_name, sizeof(clk_name), "%s%d", id_entry->name, pdev->id); | 1239 | rspi->clk = devm_clk_get(&pdev->dev, NULL); |
974 | rspi->clk = devm_clk_get(&pdev->dev, clk_name); | ||
975 | if (IS_ERR(rspi->clk)) { | 1240 | if (IS_ERR(rspi->clk)) { |
976 | dev_err(&pdev->dev, "cannot get clock\n"); | 1241 | dev_err(&pdev->dev, "cannot get clock\n"); |
977 | ret = PTR_ERR(rspi->clk); | 1242 | ret = PTR_ERR(rspi->clk); |
978 | goto error1; | 1243 | goto error1; |
979 | } | 1244 | } |
980 | clk_enable(rspi->clk); | ||
981 | 1245 | ||
982 | INIT_LIST_HEAD(&rspi->queue); | 1246 | pm_runtime_enable(&pdev->dev); |
983 | spin_lock_init(&rspi->lock); | ||
984 | INIT_WORK(&rspi->ws, rspi_work); | ||
985 | init_waitqueue_head(&rspi->wait); | ||
986 | 1247 | ||
987 | if (rspi_pd && rspi_pd->num_chipselect) | 1248 | init_waitqueue_head(&rspi->wait); |
988 | master->num_chipselect = rspi_pd->num_chipselect; | ||
989 | else | ||
990 | master->num_chipselect = 2; /* default */ | ||
991 | 1249 | ||
992 | master->bus_num = pdev->id; | 1250 | master->bus_num = pdev->id; |
993 | master->setup = rspi_setup; | 1251 | master->setup = rspi_setup; |
994 | master->transfer = rspi_transfer; | 1252 | master->auto_runtime_pm = true; |
995 | master->cleanup = rspi_cleanup; | 1253 | master->transfer_one = ops->transfer_one; |
996 | master->mode_bits = SPI_CPHA | SPI_CPOL; | 1254 | master->prepare_message = rspi_prepare_message; |
1255 | master->unprepare_message = rspi_unprepare_message; | ||
1256 | master->mode_bits = ops->mode_bits; | ||
1257 | master->dev.of_node = pdev->dev.of_node; | ||
1258 | |||
1259 | ret = platform_get_irq_byname(pdev, "rx"); | ||
1260 | if (ret < 0) { | ||
1261 | ret = platform_get_irq_byname(pdev, "mux"); | ||
1262 | if (ret < 0) | ||
1263 | ret = platform_get_irq(pdev, 0); | ||
1264 | if (ret >= 0) | ||
1265 | rspi->rx_irq = rspi->tx_irq = ret; | ||
1266 | } else { | ||
1267 | rspi->rx_irq = ret; | ||
1268 | ret = platform_get_irq_byname(pdev, "tx"); | ||
1269 | if (ret >= 0) | ||
1270 | rspi->tx_irq = ret; | ||
1271 | } | ||
1272 | if (ret < 0) { | ||
1273 | dev_err(&pdev->dev, "platform_get_irq error\n"); | ||
1274 | goto error2; | ||
1275 | } | ||
997 | 1276 | ||
998 | ret = devm_request_irq(&pdev->dev, irq, rspi_irq, 0, | 1277 | if (rspi->rx_irq == rspi->tx_irq) { |
999 | dev_name(&pdev->dev), rspi); | 1278 | /* Single multiplexed interrupt */ |
1279 | ret = rspi_request_irq(&pdev->dev, rspi->rx_irq, rspi_irq_mux, | ||
1280 | "mux", rspi); | ||
1281 | } else { | ||
1282 | /* Multi-interrupt mode, only SPRI and SPTI are used */ | ||
1283 | ret = rspi_request_irq(&pdev->dev, rspi->rx_irq, rspi_irq_rx, | ||
1284 | "rx", rspi); | ||
1285 | if (!ret) | ||
1286 | ret = rspi_request_irq(&pdev->dev, rspi->tx_irq, | ||
1287 | rspi_irq_tx, "tx", rspi); | ||
1288 | } | ||
1000 | if (ret < 0) { | 1289 | if (ret < 0) { |
1001 | dev_err(&pdev->dev, "request_irq error\n"); | 1290 | dev_err(&pdev->dev, "request_irq error\n"); |
1002 | goto error2; | 1291 | goto error2; |
1003 | } | 1292 | } |
1004 | 1293 | ||
1005 | rspi->irq = irq; | ||
1006 | ret = rspi_request_dma(rspi, pdev); | 1294 | ret = rspi_request_dma(rspi, pdev); |
1007 | if (ret < 0) { | 1295 | if (ret < 0) { |
1008 | dev_err(&pdev->dev, "rspi_request_dma failed.\n"); | 1296 | dev_err(&pdev->dev, "rspi_request_dma failed.\n"); |
@@ -1022,27 +1310,16 @@ static int rspi_probe(struct platform_device *pdev) | |||
1022 | error3: | 1310 | error3: |
1023 | rspi_release_dma(rspi); | 1311 | rspi_release_dma(rspi); |
1024 | error2: | 1312 | error2: |
1025 | clk_disable(rspi->clk); | 1313 | pm_runtime_disable(&pdev->dev); |
1026 | error1: | 1314 | error1: |
1027 | spi_master_put(master); | 1315 | spi_master_put(master); |
1028 | 1316 | ||
1029 | return ret; | 1317 | return ret; |
1030 | } | 1318 | } |
1031 | 1319 | ||
1032 | static struct spi_ops rspi_ops = { | ||
1033 | .set_config_register = rspi_set_config_register, | ||
1034 | .send_pio = rspi_send_pio, | ||
1035 | .receive_pio = rspi_receive_pio, | ||
1036 | }; | ||
1037 | |||
1038 | static struct spi_ops qspi_ops = { | ||
1039 | .set_config_register = qspi_set_config_register, | ||
1040 | .send_pio = qspi_send_pio, | ||
1041 | .receive_pio = qspi_receive_pio, | ||
1042 | }; | ||
1043 | |||
1044 | static struct platform_device_id spi_driver_ids[] = { | 1320 | static struct platform_device_id spi_driver_ids[] = { |
1045 | { "rspi", (kernel_ulong_t)&rspi_ops }, | 1321 | { "rspi", (kernel_ulong_t)&rspi_ops }, |
1322 | { "rspi-rz", (kernel_ulong_t)&rspi_rz_ops }, | ||
1046 | { "qspi", (kernel_ulong_t)&qspi_ops }, | 1323 | { "qspi", (kernel_ulong_t)&qspi_ops }, |
1047 | {}, | 1324 | {}, |
1048 | }; | 1325 | }; |
@@ -1056,6 +1333,7 @@ static struct platform_driver rspi_driver = { | |||
1056 | .driver = { | 1333 | .driver = { |
1057 | .name = "renesas_spi", | 1334 | .name = "renesas_spi", |
1058 | .owner = THIS_MODULE, | 1335 | .owner = THIS_MODULE, |
1336 | .of_match_table = of_match_ptr(rspi_of_match), | ||
1059 | }, | 1337 | }, |
1060 | }; | 1338 | }; |
1061 | module_platform_driver(rspi_driver); | 1339 | module_platform_driver(rspi_driver); |
diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index 746424aa5353..bed23384dfab 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
14 | #include <linux/workqueue.h> | 13 | #include <linux/workqueue.h> |
15 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
@@ -123,25 +122,15 @@ static int s3c24xx_spi_update_state(struct spi_device *spi, | |||
123 | { | 122 | { |
124 | struct s3c24xx_spi *hw = to_hw(spi); | 123 | struct s3c24xx_spi *hw = to_hw(spi); |
125 | struct s3c24xx_spi_devstate *cs = spi->controller_state; | 124 | struct s3c24xx_spi_devstate *cs = spi->controller_state; |
126 | unsigned int bpw; | ||
127 | unsigned int hz; | 125 | unsigned int hz; |
128 | unsigned int div; | 126 | unsigned int div; |
129 | unsigned long clk; | 127 | unsigned long clk; |
130 | 128 | ||
131 | bpw = t ? t->bits_per_word : spi->bits_per_word; | ||
132 | hz = t ? t->speed_hz : spi->max_speed_hz; | 129 | hz = t ? t->speed_hz : spi->max_speed_hz; |
133 | 130 | ||
134 | if (!bpw) | ||
135 | bpw = 8; | ||
136 | |||
137 | if (!hz) | 131 | if (!hz) |
138 | hz = spi->max_speed_hz; | 132 | hz = spi->max_speed_hz; |
139 | 133 | ||
140 | if (bpw != 8) { | ||
141 | dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); | ||
142 | return -EINVAL; | ||
143 | } | ||
144 | |||
145 | if (spi->mode != cs->mode) { | 134 | if (spi->mode != cs->mode) { |
146 | u8 spcon = SPCON_DEFAULT | S3C2410_SPCON_ENSCK; | 135 | u8 spcon = SPCON_DEFAULT | S3C2410_SPCON_ENSCK; |
147 | 136 | ||
@@ -544,6 +533,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) | |||
544 | 533 | ||
545 | master->num_chipselect = hw->pdata->num_cs; | 534 | master->num_chipselect = hw->pdata->num_cs; |
546 | master->bus_num = pdata->bus_num; | 535 | master->bus_num = pdata->bus_num; |
536 | master->bits_per_word_mask = SPI_BPW_MASK(8); | ||
547 | 537 | ||
548 | /* setup the state for the bitbang driver */ | 538 | /* setup the state for the bitbang driver */ |
549 | 539 | ||
@@ -643,6 +633,11 @@ static int s3c24xx_spi_remove(struct platform_device *dev) | |||
643 | static int s3c24xx_spi_suspend(struct device *dev) | 633 | static int s3c24xx_spi_suspend(struct device *dev) |
644 | { | 634 | { |
645 | struct s3c24xx_spi *hw = dev_get_drvdata(dev); | 635 | struct s3c24xx_spi *hw = dev_get_drvdata(dev); |
636 | int ret; | ||
637 | |||
638 | ret = spi_master_suspend(hw->master); | ||
639 | if (ret) | ||
640 | return ret; | ||
646 | 641 | ||
647 | if (hw->pdata && hw->pdata->gpio_setup) | 642 | if (hw->pdata && hw->pdata->gpio_setup) |
648 | hw->pdata->gpio_setup(hw->pdata, 0); | 643 | hw->pdata->gpio_setup(hw->pdata, 0); |
@@ -656,7 +651,7 @@ static int s3c24xx_spi_resume(struct device *dev) | |||
656 | struct s3c24xx_spi *hw = dev_get_drvdata(dev); | 651 | struct s3c24xx_spi *hw = dev_get_drvdata(dev); |
657 | 652 | ||
658 | s3c24xx_spi_initialsetup(hw); | 653 | s3c24xx_spi_initialsetup(hw); |
659 | return 0; | 654 | return spi_master_resume(hw->master); |
660 | } | 655 | } |
661 | 656 | ||
662 | static const struct dev_pm_ops s3c24xx_spi_pmops = { | 657 | static const struct dev_pm_ops s3c24xx_spi_pmops = { |
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index ae907dde1371..25c9bd409a87 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -381,7 +381,7 @@ static void s3c64xx_spi_dma_stop(struct s3c64xx_spi_driver_data *sdd, | |||
381 | #else | 381 | #else |
382 | 382 | ||
383 | static void prepare_dma(struct s3c64xx_spi_dma_data *dma, | 383 | static void prepare_dma(struct s3c64xx_spi_dma_data *dma, |
384 | unsigned len, dma_addr_t buf) | 384 | struct sg_table *sgt) |
385 | { | 385 | { |
386 | struct s3c64xx_spi_driver_data *sdd; | 386 | struct s3c64xx_spi_driver_data *sdd; |
387 | struct dma_slave_config config; | 387 | struct dma_slave_config config; |
@@ -407,8 +407,8 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, | |||
407 | dmaengine_slave_config(dma->ch, &config); | 407 | dmaengine_slave_config(dma->ch, &config); |
408 | } | 408 | } |
409 | 409 | ||
410 | desc = dmaengine_prep_slave_single(dma->ch, buf, len, | 410 | desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents, |
411 | dma->direction, DMA_PREP_INTERRUPT); | 411 | dma->direction, DMA_PREP_INTERRUPT); |
412 | 412 | ||
413 | desc->callback = s3c64xx_spi_dmacb; | 413 | desc->callback = s3c64xx_spi_dmacb; |
414 | desc->callback_param = dma; | 414 | desc->callback_param = dma; |
@@ -515,7 +515,11 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd, | |||
515 | chcfg |= S3C64XX_SPI_CH_TXCH_ON; | 515 | chcfg |= S3C64XX_SPI_CH_TXCH_ON; |
516 | if (dma_mode) { | 516 | if (dma_mode) { |
517 | modecfg |= S3C64XX_SPI_MODE_TXDMA_ON; | 517 | modecfg |= S3C64XX_SPI_MODE_TXDMA_ON; |
518 | #ifndef CONFIG_S3C_DMA | ||
519 | prepare_dma(&sdd->tx_dma, &xfer->tx_sg); | ||
520 | #else | ||
518 | prepare_dma(&sdd->tx_dma, xfer->len, xfer->tx_dma); | 521 | prepare_dma(&sdd->tx_dma, xfer->len, xfer->tx_dma); |
522 | #endif | ||
519 | } else { | 523 | } else { |
520 | switch (sdd->cur_bpw) { | 524 | switch (sdd->cur_bpw) { |
521 | case 32: | 525 | case 32: |
@@ -547,7 +551,11 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd, | |||
547 | writel(((xfer->len * 8 / sdd->cur_bpw) & 0xffff) | 551 | writel(((xfer->len * 8 / sdd->cur_bpw) & 0xffff) |
548 | | S3C64XX_SPI_PACKET_CNT_EN, | 552 | | S3C64XX_SPI_PACKET_CNT_EN, |
549 | regs + S3C64XX_SPI_PACKET_CNT); | 553 | regs + S3C64XX_SPI_PACKET_CNT); |
554 | #ifndef CONFIG_S3C_DMA | ||
555 | prepare_dma(&sdd->rx_dma, &xfer->rx_sg); | ||
556 | #else | ||
550 | prepare_dma(&sdd->rx_dma, xfer->len, xfer->rx_dma); | 557 | prepare_dma(&sdd->rx_dma, xfer->len, xfer->rx_dma); |
558 | #endif | ||
551 | } | 559 | } |
552 | } | 560 | } |
553 | 561 | ||
@@ -555,23 +563,6 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd, | |||
555 | writel(chcfg, regs + S3C64XX_SPI_CH_CFG); | 563 | writel(chcfg, regs + S3C64XX_SPI_CH_CFG); |
556 | } | 564 | } |
557 | 565 | ||
558 | static inline void enable_cs(struct s3c64xx_spi_driver_data *sdd, | ||
559 | struct spi_device *spi) | ||
560 | { | ||
561 | if (sdd->tgl_spi != NULL) { /* If last device toggled after mssg */ | ||
562 | if (sdd->tgl_spi != spi) { /* if last mssg on diff device */ | ||
563 | /* Deselect the last toggled device */ | ||
564 | if (spi->cs_gpio >= 0) | ||
565 | gpio_set_value(spi->cs_gpio, | ||
566 | spi->mode & SPI_CS_HIGH ? 0 : 1); | ||
567 | } | ||
568 | sdd->tgl_spi = NULL; | ||
569 | } | ||
570 | |||
571 | if (spi->cs_gpio >= 0) | ||
572 | gpio_set_value(spi->cs_gpio, spi->mode & SPI_CS_HIGH ? 1 : 0); | ||
573 | } | ||
574 | |||
575 | static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd, | 566 | static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd, |
576 | int timeout_ms) | 567 | int timeout_ms) |
577 | { | 568 | { |
@@ -593,112 +584,111 @@ static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd, | |||
593 | return RX_FIFO_LVL(status, sdd); | 584 | return RX_FIFO_LVL(status, sdd); |
594 | } | 585 | } |
595 | 586 | ||
596 | static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd, | 587 | static int wait_for_dma(struct s3c64xx_spi_driver_data *sdd, |
597 | struct spi_transfer *xfer, int dma_mode) | 588 | struct spi_transfer *xfer) |
598 | { | 589 | { |
599 | void __iomem *regs = sdd->regs; | 590 | void __iomem *regs = sdd->regs; |
600 | unsigned long val; | 591 | unsigned long val; |
592 | u32 status; | ||
601 | int ms; | 593 | int ms; |
602 | 594 | ||
603 | /* millisecs to xfer 'len' bytes @ 'cur_speed' */ | 595 | /* millisecs to xfer 'len' bytes @ 'cur_speed' */ |
604 | ms = xfer->len * 8 * 1000 / sdd->cur_speed; | 596 | ms = xfer->len * 8 * 1000 / sdd->cur_speed; |
605 | ms += 10; /* some tolerance */ | 597 | ms += 10; /* some tolerance */ |
606 | 598 | ||
607 | if (dma_mode) { | 599 | val = msecs_to_jiffies(ms) + 10; |
608 | val = msecs_to_jiffies(ms) + 10; | 600 | val = wait_for_completion_timeout(&sdd->xfer_completion, val); |
609 | val = wait_for_completion_timeout(&sdd->xfer_completion, val); | 601 | |
610 | } else { | 602 | /* |
611 | u32 status; | 603 | * If the previous xfer was completed within timeout, then |
612 | val = msecs_to_loops(ms); | 604 | * proceed further else return -EIO. |
613 | do { | 605 | * DmaTx returns after simply writing data in the FIFO, |
606 | * w/o waiting for real transmission on the bus to finish. | ||
607 | * DmaRx returns only after Dma read data from FIFO which | ||
608 | * needs bus transmission to finish, so we don't worry if | ||
609 | * Xfer involved Rx(with or without Tx). | ||
610 | */ | ||
611 | if (val && !xfer->rx_buf) { | ||
612 | val = msecs_to_loops(10); | ||
613 | status = readl(regs + S3C64XX_SPI_STATUS); | ||
614 | while ((TX_FIFO_LVL(status, sdd) | ||
615 | || !S3C64XX_SPI_ST_TX_DONE(status, sdd)) | ||
616 | && --val) { | ||
617 | cpu_relax(); | ||
614 | status = readl(regs + S3C64XX_SPI_STATUS); | 618 | status = readl(regs + S3C64XX_SPI_STATUS); |
615 | } while (RX_FIFO_LVL(status, sdd) < xfer->len && --val); | 619 | } |
620 | |||
616 | } | 621 | } |
617 | 622 | ||
618 | if (dma_mode) { | 623 | /* If timed out while checking rx/tx status return error */ |
619 | u32 status; | 624 | if (!val) |
620 | 625 | return -EIO; | |
621 | /* | ||
622 | * If the previous xfer was completed within timeout, then | ||
623 | * proceed further else return -EIO. | ||
624 | * DmaTx returns after simply writing data in the FIFO, | ||
625 | * w/o waiting for real transmission on the bus to finish. | ||
626 | * DmaRx returns only after Dma read data from FIFO which | ||
627 | * needs bus transmission to finish, so we don't worry if | ||
628 | * Xfer involved Rx(with or without Tx). | ||
629 | */ | ||
630 | if (val && !xfer->rx_buf) { | ||
631 | val = msecs_to_loops(10); | ||
632 | status = readl(regs + S3C64XX_SPI_STATUS); | ||
633 | while ((TX_FIFO_LVL(status, sdd) | ||
634 | || !S3C64XX_SPI_ST_TX_DONE(status, sdd)) | ||
635 | && --val) { | ||
636 | cpu_relax(); | ||
637 | status = readl(regs + S3C64XX_SPI_STATUS); | ||
638 | } | ||
639 | 626 | ||
640 | } | 627 | return 0; |
628 | } | ||
641 | 629 | ||
642 | /* If timed out while checking rx/tx status return error */ | 630 | static int wait_for_pio(struct s3c64xx_spi_driver_data *sdd, |
643 | if (!val) | 631 | struct spi_transfer *xfer) |
644 | return -EIO; | 632 | { |
645 | } else { | 633 | void __iomem *regs = sdd->regs; |
646 | int loops; | 634 | unsigned long val; |
647 | u32 cpy_len; | 635 | u32 status; |
648 | u8 *buf; | 636 | int loops; |
649 | 637 | u32 cpy_len; | |
650 | /* If it was only Tx */ | 638 | u8 *buf; |
651 | if (!xfer->rx_buf) { | 639 | int ms; |
652 | sdd->state &= ~TXBUSY; | ||
653 | return 0; | ||
654 | } | ||
655 | 640 | ||
656 | /* | 641 | /* millisecs to xfer 'len' bytes @ 'cur_speed' */ |
657 | * If the receive length is bigger than the controller fifo | 642 | ms = xfer->len * 8 * 1000 / sdd->cur_speed; |
658 | * size, calculate the loops and read the fifo as many times. | 643 | ms += 10; /* some tolerance */ |
659 | * loops = length / max fifo size (calculated by using the | ||
660 | * fifo mask). | ||
661 | * For any size less than the fifo size the below code is | ||
662 | * executed atleast once. | ||
663 | */ | ||
664 | loops = xfer->len / ((FIFO_LVL_MASK(sdd) >> 1) + 1); | ||
665 | buf = xfer->rx_buf; | ||
666 | do { | ||
667 | /* wait for data to be received in the fifo */ | ||
668 | cpy_len = s3c64xx_spi_wait_for_timeout(sdd, | ||
669 | (loops ? ms : 0)); | ||
670 | 644 | ||
671 | switch (sdd->cur_bpw) { | 645 | val = msecs_to_loops(ms); |
672 | case 32: | 646 | do { |
673 | ioread32_rep(regs + S3C64XX_SPI_RX_DATA, | 647 | status = readl(regs + S3C64XX_SPI_STATUS); |
674 | buf, cpy_len / 4); | 648 | } while (RX_FIFO_LVL(status, sdd) < xfer->len && --val); |
675 | break; | ||
676 | case 16: | ||
677 | ioread16_rep(regs + S3C64XX_SPI_RX_DATA, | ||
678 | buf, cpy_len / 2); | ||
679 | break; | ||
680 | default: | ||
681 | ioread8_rep(regs + S3C64XX_SPI_RX_DATA, | ||
682 | buf, cpy_len); | ||
683 | break; | ||
684 | } | ||
685 | 649 | ||
686 | buf = buf + cpy_len; | 650 | |
687 | } while (loops--); | 651 | /* If it was only Tx */ |
688 | sdd->state &= ~RXBUSY; | 652 | if (!xfer->rx_buf) { |
653 | sdd->state &= ~TXBUSY; | ||
654 | return 0; | ||
689 | } | 655 | } |
690 | 656 | ||
691 | return 0; | 657 | /* |
692 | } | 658 | * If the receive length is bigger than the controller fifo |
659 | * size, calculate the loops and read the fifo as many times. | ||
660 | * loops = length / max fifo size (calculated by using the | ||
661 | * fifo mask). | ||
662 | * For any size less than the fifo size the below code is | ||
663 | * executed atleast once. | ||
664 | */ | ||
665 | loops = xfer->len / ((FIFO_LVL_MASK(sdd) >> 1) + 1); | ||
666 | buf = xfer->rx_buf; | ||
667 | do { | ||
668 | /* wait for data to be received in the fifo */ | ||
669 | cpy_len = s3c64xx_spi_wait_for_timeout(sdd, | ||
670 | (loops ? ms : 0)); | ||
671 | |||
672 | switch (sdd->cur_bpw) { | ||
673 | case 32: | ||
674 | ioread32_rep(regs + S3C64XX_SPI_RX_DATA, | ||
675 | buf, cpy_len / 4); | ||
676 | break; | ||
677 | case 16: | ||
678 | ioread16_rep(regs + S3C64XX_SPI_RX_DATA, | ||
679 | buf, cpy_len / 2); | ||
680 | break; | ||
681 | default: | ||
682 | ioread8_rep(regs + S3C64XX_SPI_RX_DATA, | ||
683 | buf, cpy_len); | ||
684 | break; | ||
685 | } | ||
693 | 686 | ||
694 | static inline void disable_cs(struct s3c64xx_spi_driver_data *sdd, | 687 | buf = buf + cpy_len; |
695 | struct spi_device *spi) | 688 | } while (loops--); |
696 | { | 689 | sdd->state &= ~RXBUSY; |
697 | if (sdd->tgl_spi == spi) | ||
698 | sdd->tgl_spi = NULL; | ||
699 | 690 | ||
700 | if (spi->cs_gpio >= 0) | 691 | return 0; |
701 | gpio_set_value(spi->cs_gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); | ||
702 | } | 692 | } |
703 | 693 | ||
704 | static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) | 694 | static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) |
@@ -929,7 +919,10 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, | |||
929 | 919 | ||
930 | spin_unlock_irqrestore(&sdd->lock, flags); | 920 | spin_unlock_irqrestore(&sdd->lock, flags); |
931 | 921 | ||
932 | status = wait_for_xfer(sdd, xfer, use_dma); | 922 | if (use_dma) |
923 | status = wait_for_dma(sdd, xfer); | ||
924 | else | ||
925 | status = wait_for_pio(sdd, xfer); | ||
933 | 926 | ||
934 | if (status) { | 927 | if (status) { |
935 | dev_err(&spi->dev, "I/O Error: rx-%d tx-%d res:rx-%c tx-%c len-%d\n", | 928 | dev_err(&spi->dev, "I/O Error: rx-%d tx-%d res:rx-%c tx-%c len-%d\n", |
@@ -1092,14 +1085,12 @@ static int s3c64xx_spi_setup(struct spi_device *spi) | |||
1092 | 1085 | ||
1093 | pm_runtime_put(&sdd->pdev->dev); | 1086 | pm_runtime_put(&sdd->pdev->dev); |
1094 | writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); | 1087 | writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); |
1095 | disable_cs(sdd, spi); | ||
1096 | return 0; | 1088 | return 0; |
1097 | 1089 | ||
1098 | setup_exit: | 1090 | setup_exit: |
1099 | pm_runtime_put(&sdd->pdev->dev); | 1091 | pm_runtime_put(&sdd->pdev->dev); |
1100 | /* setup() returns with device de-selected */ | 1092 | /* setup() returns with device de-selected */ |
1101 | writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); | 1093 | writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); |
1102 | disable_cs(sdd, spi); | ||
1103 | 1094 | ||
1104 | gpio_free(cs->line); | 1095 | gpio_free(cs->line); |
1105 | spi_set_ctldata(spi, NULL); | 1096 | spi_set_ctldata(spi, NULL); |
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 82d2f922ffa0..755d7cc9e72f 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c | |||
@@ -298,7 +298,6 @@ static int hspi_probe(struct platform_device *pdev) | |||
298 | 298 | ||
299 | pm_runtime_enable(&pdev->dev); | 299 | pm_runtime_enable(&pdev->dev); |
300 | 300 | ||
301 | master->num_chipselect = 1; | ||
302 | master->bus_num = pdev->id; | 301 | master->bus_num = pdev->id; |
303 | master->setup = hspi_setup; | 302 | master->setup = hspi_setup; |
304 | master->cleanup = hspi_cleanup; | 303 | master->cleanup = hspi_cleanup; |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 81cc02f5f9b0..33474061b742 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <linux/init.h> | ||
19 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
20 | #include <linux/io.h> | 19 | #include <linux/io.h> |
21 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c index 38eb24df796c..85c2efd57c80 100644 --- a/drivers/spi/spi-sh-sci.c +++ b/drivers/spi/spi-sh-sci.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | ||
18 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
19 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
20 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 413c71843492..6be661e4c6e1 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
24 | #include <linux/dmapool.h> | 24 | #include <linux/dmapool.h> |
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/init.h> | ||
27 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
28 | #include <linux/io.h> | 27 | #include <linux/io.h> |
29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
@@ -172,7 +171,6 @@ struct tegra_spi_data { | |||
172 | void __iomem *base; | 171 | void __iomem *base; |
173 | phys_addr_t phys; | 172 | phys_addr_t phys; |
174 | unsigned irq; | 173 | unsigned irq; |
175 | u32 spi_max_frequency; | ||
176 | u32 cur_speed; | 174 | u32 cur_speed; |
177 | 175 | ||
178 | struct spi_device *cur_spi; | 176 | struct spi_device *cur_spi; |
@@ -761,11 +759,6 @@ static int tegra_spi_setup(struct spi_device *spi) | |||
761 | spi->mode & SPI_CPHA ? "" : "~", | 759 | spi->mode & SPI_CPHA ? "" : "~", |
762 | spi->max_speed_hz); | 760 | spi->max_speed_hz); |
763 | 761 | ||
764 | BUG_ON(spi->chip_select >= MAX_CHIP_SELECT); | ||
765 | |||
766 | /* Set speed to the spi max fequency if spi device has not set */ | ||
767 | spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency; | ||
768 | |||
769 | ret = pm_runtime_get_sync(tspi->dev); | 762 | ret = pm_runtime_get_sync(tspi->dev); |
770 | if (ret < 0) { | 763 | if (ret < 0) { |
771 | dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); | 764 | dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); |
@@ -1019,16 +1012,6 @@ static irqreturn_t tegra_spi_isr(int irq, void *context_data) | |||
1019 | return IRQ_WAKE_THREAD; | 1012 | return IRQ_WAKE_THREAD; |
1020 | } | 1013 | } |
1021 | 1014 | ||
1022 | static void tegra_spi_parse_dt(struct platform_device *pdev, | ||
1023 | struct tegra_spi_data *tspi) | ||
1024 | { | ||
1025 | struct device_node *np = pdev->dev.of_node; | ||
1026 | |||
1027 | if (of_property_read_u32(np, "spi-max-frequency", | ||
1028 | &tspi->spi_max_frequency)) | ||
1029 | tspi->spi_max_frequency = 25000000; /* 25MHz */ | ||
1030 | } | ||
1031 | |||
1032 | static struct of_device_id tegra_spi_of_match[] = { | 1015 | static struct of_device_id tegra_spi_of_match[] = { |
1033 | { .compatible = "nvidia,tegra114-spi", }, | 1016 | { .compatible = "nvidia,tegra114-spi", }, |
1034 | {} | 1017 | {} |
@@ -1050,15 +1033,15 @@ static int tegra_spi_probe(struct platform_device *pdev) | |||
1050 | platform_set_drvdata(pdev, master); | 1033 | platform_set_drvdata(pdev, master); |
1051 | tspi = spi_master_get_devdata(master); | 1034 | tspi = spi_master_get_devdata(master); |
1052 | 1035 | ||
1053 | /* Parse DT */ | 1036 | if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency", |
1054 | tegra_spi_parse_dt(pdev, tspi); | 1037 | &master->max_speed_hz)) |
1038 | master->max_speed_hz = 25000000; /* 25MHz */ | ||
1055 | 1039 | ||
1056 | /* the spi->mode bits understood by this driver: */ | 1040 | /* the spi->mode bits understood by this driver: */ |
1057 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; | 1041 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; |
1058 | master->setup = tegra_spi_setup; | 1042 | master->setup = tegra_spi_setup; |
1059 | master->transfer_one_message = tegra_spi_transfer_one_message; | 1043 | master->transfer_one_message = tegra_spi_transfer_one_message; |
1060 | master->num_chipselect = MAX_CHIP_SELECT; | 1044 | master->num_chipselect = MAX_CHIP_SELECT; |
1061 | master->bus_num = -1; | ||
1062 | master->auto_runtime_pm = true; | 1045 | master->auto_runtime_pm = true; |
1063 | 1046 | ||
1064 | tspi->master = master; | 1047 | tspi->master = master; |
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 08794977f21a..47869ea636e1 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/completion.h> | 22 | #include <linux/completion.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/init.h> | ||
26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
27 | #include <linux/io.h> | 26 | #include <linux/io.h> |
28 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
@@ -121,7 +120,6 @@ struct tegra_sflash_data { | |||
121 | struct reset_control *rst; | 120 | struct reset_control *rst; |
122 | void __iomem *base; | 121 | void __iomem *base; |
123 | unsigned irq; | 122 | unsigned irq; |
124 | u32 spi_max_frequency; | ||
125 | u32 cur_speed; | 123 | u32 cur_speed; |
126 | 124 | ||
127 | struct spi_device *cur_spi; | 125 | struct spi_device *cur_spi; |
@@ -315,15 +313,6 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, | |||
315 | return tegra_sflash_start_cpu_based_transfer(tsd, t); | 313 | return tegra_sflash_start_cpu_based_transfer(tsd, t); |
316 | } | 314 | } |
317 | 315 | ||
318 | static int tegra_sflash_setup(struct spi_device *spi) | ||
319 | { | ||
320 | struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master); | ||
321 | |||
322 | /* Set speed to the spi max fequency if spi device has not set */ | ||
323 | spi->max_speed_hz = spi->max_speed_hz ? : tsd->spi_max_frequency; | ||
324 | return 0; | ||
325 | } | ||
326 | |||
327 | static int tegra_sflash_transfer_one_message(struct spi_master *master, | 316 | static int tegra_sflash_transfer_one_message(struct spi_master *master, |
328 | struct spi_message *msg) | 317 | struct spi_message *msg) |
329 | { | 318 | { |
@@ -430,15 +419,6 @@ static irqreturn_t tegra_sflash_isr(int irq, void *context_data) | |||
430 | return handle_cpu_based_xfer(tsd); | 419 | return handle_cpu_based_xfer(tsd); |
431 | } | 420 | } |
432 | 421 | ||
433 | static void tegra_sflash_parse_dt(struct tegra_sflash_data *tsd) | ||
434 | { | ||
435 | struct device_node *np = tsd->dev->of_node; | ||
436 | |||
437 | if (of_property_read_u32(np, "spi-max-frequency", | ||
438 | &tsd->spi_max_frequency)) | ||
439 | tsd->spi_max_frequency = 25000000; /* 25MHz */ | ||
440 | } | ||
441 | |||
442 | static struct of_device_id tegra_sflash_of_match[] = { | 422 | static struct of_device_id tegra_sflash_of_match[] = { |
443 | { .compatible = "nvidia,tegra20-sflash", }, | 423 | { .compatible = "nvidia,tegra20-sflash", }, |
444 | {} | 424 | {} |
@@ -467,11 +447,9 @@ static int tegra_sflash_probe(struct platform_device *pdev) | |||
467 | 447 | ||
468 | /* the spi->mode bits understood by this driver: */ | 448 | /* the spi->mode bits understood by this driver: */ |
469 | master->mode_bits = SPI_CPOL | SPI_CPHA; | 449 | master->mode_bits = SPI_CPOL | SPI_CPHA; |
470 | master->setup = tegra_sflash_setup; | ||
471 | master->transfer_one_message = tegra_sflash_transfer_one_message; | 450 | master->transfer_one_message = tegra_sflash_transfer_one_message; |
472 | master->auto_runtime_pm = true; | 451 | master->auto_runtime_pm = true; |
473 | master->num_chipselect = MAX_CHIP_SELECT; | 452 | master->num_chipselect = MAX_CHIP_SELECT; |
474 | master->bus_num = -1; | ||
475 | 453 | ||
476 | platform_set_drvdata(pdev, master); | 454 | platform_set_drvdata(pdev, master); |
477 | tsd = spi_master_get_devdata(master); | 455 | tsd = spi_master_get_devdata(master); |
@@ -479,7 +457,9 @@ static int tegra_sflash_probe(struct platform_device *pdev) | |||
479 | tsd->dev = &pdev->dev; | 457 | tsd->dev = &pdev->dev; |
480 | spin_lock_init(&tsd->lock); | 458 | spin_lock_init(&tsd->lock); |
481 | 459 | ||
482 | tegra_sflash_parse_dt(tsd); | 460 | if (of_property_read_u32(tsd->dev->of_node, "spi-max-frequency", |
461 | &master->max_speed_hz)) | ||
462 | master->max_speed_hz = 25000000; /* 25MHz */ | ||
483 | 463 | ||
484 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 464 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
485 | tsd->base = devm_ioremap_resource(&pdev->dev, r); | 465 | tsd->base = devm_ioremap_resource(&pdev->dev, r); |
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index be3a069879c3..e3c1b93e45d1 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
24 | #include <linux/dmapool.h> | 24 | #include <linux/dmapool.h> |
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/init.h> | ||
27 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
28 | #include <linux/io.h> | 27 | #include <linux/io.h> |
29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
@@ -171,7 +170,6 @@ struct tegra_slink_data { | |||
171 | void __iomem *base; | 170 | void __iomem *base; |
172 | phys_addr_t phys; | 171 | phys_addr_t phys; |
173 | unsigned irq; | 172 | unsigned irq; |
174 | u32 spi_max_frequency; | ||
175 | u32 cur_speed; | 173 | u32 cur_speed; |
176 | 174 | ||
177 | struct spi_device *cur_spi; | 175 | struct spi_device *cur_spi; |
@@ -761,10 +759,6 @@ static int tegra_slink_setup(struct spi_device *spi) | |||
761 | spi->mode & SPI_CPHA ? "" : "~", | 759 | spi->mode & SPI_CPHA ? "" : "~", |
762 | spi->max_speed_hz); | 760 | spi->max_speed_hz); |
763 | 761 | ||
764 | BUG_ON(spi->chip_select >= MAX_CHIP_SELECT); | ||
765 | |||
766 | /* Set speed to the spi max fequency if spi device has not set */ | ||
767 | spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency; | ||
768 | ret = pm_runtime_get_sync(tspi->dev); | 762 | ret = pm_runtime_get_sync(tspi->dev); |
769 | if (ret < 0) { | 763 | if (ret < 0) { |
770 | dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); | 764 | dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); |
@@ -999,15 +993,6 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data) | |||
999 | return IRQ_WAKE_THREAD; | 993 | return IRQ_WAKE_THREAD; |
1000 | } | 994 | } |
1001 | 995 | ||
1002 | static void tegra_slink_parse_dt(struct tegra_slink_data *tspi) | ||
1003 | { | ||
1004 | struct device_node *np = tspi->dev->of_node; | ||
1005 | |||
1006 | if (of_property_read_u32(np, "spi-max-frequency", | ||
1007 | &tspi->spi_max_frequency)) | ||
1008 | tspi->spi_max_frequency = 25000000; /* 25MHz */ | ||
1009 | } | ||
1010 | |||
1011 | static const struct tegra_slink_chip_data tegra30_spi_cdata = { | 996 | static const struct tegra_slink_chip_data tegra30_spi_cdata = { |
1012 | .cs_hold_time = true, | 997 | .cs_hold_time = true, |
1013 | }; | 998 | }; |
@@ -1053,7 +1038,6 @@ static int tegra_slink_probe(struct platform_device *pdev) | |||
1053 | master->unprepare_message = tegra_slink_unprepare_message; | 1038 | master->unprepare_message = tegra_slink_unprepare_message; |
1054 | master->auto_runtime_pm = true; | 1039 | master->auto_runtime_pm = true; |
1055 | master->num_chipselect = MAX_CHIP_SELECT; | 1040 | master->num_chipselect = MAX_CHIP_SELECT; |
1056 | master->bus_num = -1; | ||
1057 | 1041 | ||
1058 | platform_set_drvdata(pdev, master); | 1042 | platform_set_drvdata(pdev, master); |
1059 | tspi = spi_master_get_devdata(master); | 1043 | tspi = spi_master_get_devdata(master); |
@@ -1062,7 +1046,9 @@ static int tegra_slink_probe(struct platform_device *pdev) | |||
1062 | tspi->chip_data = cdata; | 1046 | tspi->chip_data = cdata; |
1063 | spin_lock_init(&tspi->lock); | 1047 | spin_lock_init(&tspi->lock); |
1064 | 1048 | ||
1065 | tegra_slink_parse_dt(tspi); | 1049 | if (of_property_read_u32(tspi->dev->of_node, "spi-max-frequency", |
1050 | &master->max_speed_hz)) | ||
1051 | master->max_speed_hz = 25000000; /* 25MHz */ | ||
1066 | 1052 | ||
1067 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1053 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1068 | if (!r) { | 1054 | if (!r) { |
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 3d09265b5133..49ddfc7f12b1 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c | |||
@@ -429,13 +429,13 @@ static int ti_qspi_probe(struct platform_device *pdev) | |||
429 | 429 | ||
430 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD; | 430 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD; |
431 | 431 | ||
432 | master->bus_num = -1; | ||
433 | master->flags = SPI_MASTER_HALF_DUPLEX; | 432 | master->flags = SPI_MASTER_HALF_DUPLEX; |
434 | master->setup = ti_qspi_setup; | 433 | master->setup = ti_qspi_setup; |
435 | master->auto_runtime_pm = true; | 434 | master->auto_runtime_pm = true; |
436 | master->transfer_one_message = ti_qspi_start_transfer_one; | 435 | master->transfer_one_message = ti_qspi_start_transfer_one; |
437 | master->dev.of_node = pdev->dev.of_node; | 436 | master->dev.of_node = pdev->dev.of_node; |
438 | master->bits_per_word_mask = BIT(32 - 1) | BIT(16 - 1) | BIT(8 - 1); | 437 | master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | |
438 | SPI_BPW_MASK(8); | ||
439 | 439 | ||
440 | if (!of_property_read_u32(np, "num-cs", &num_cs)) | 440 | if (!of_property_read_u32(np, "num-cs", &num_cs)) |
441 | master->num_chipselect = num_cs; | 441 | master->num_chipselect = num_cs; |
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 2e7f38c7a961..88eb57e858b3 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c | |||
@@ -915,7 +915,7 @@ static void pch_spi_request_dma(struct pch_spi_data *data, int bpw) | |||
915 | /* Set Tx DMA */ | 915 | /* Set Tx DMA */ |
916 | param = &dma->param_tx; | 916 | param = &dma->param_tx; |
917 | param->dma_dev = &dma_dev->dev; | 917 | param->dma_dev = &dma_dev->dev; |
918 | param->chan_id = data->master->bus_num * 2; /* Tx = 0, 2 */ | 918 | param->chan_id = data->ch * 2; /* Tx = 0, 2 */; |
919 | param->tx_reg = data->io_base_addr + PCH_SPDWR; | 919 | param->tx_reg = data->io_base_addr + PCH_SPDWR; |
920 | param->width = width; | 920 | param->width = width; |
921 | chan = dma_request_channel(mask, pch_spi_filter, param); | 921 | chan = dma_request_channel(mask, pch_spi_filter, param); |
@@ -930,7 +930,7 @@ static void pch_spi_request_dma(struct pch_spi_data *data, int bpw) | |||
930 | /* Set Rx DMA */ | 930 | /* Set Rx DMA */ |
931 | param = &dma->param_rx; | 931 | param = &dma->param_rx; |
932 | param->dma_dev = &dma_dev->dev; | 932 | param->dma_dev = &dma_dev->dev; |
933 | param->chan_id = data->master->bus_num * 2 + 1; /* Rx = Tx + 1 */ | 933 | param->chan_id = data->ch * 2 + 1; /* Rx = Tx + 1 */; |
934 | param->rx_reg = data->io_base_addr + PCH_SPDRR; | 934 | param->rx_reg = data->io_base_addr + PCH_SPDRR; |
935 | param->width = width; | 935 | param->width = width; |
936 | chan = dma_request_channel(mask, pch_spi_filter, param); | 936 | chan = dma_request_channel(mask, pch_spi_filter, param); |
@@ -1452,6 +1452,11 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) | |||
1452 | 1452 | ||
1453 | pch_spi_set_master_mode(master); | 1453 | pch_spi_set_master_mode(master); |
1454 | 1454 | ||
1455 | if (use_dma) { | ||
1456 | dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); | ||
1457 | pch_alloc_dma_buf(board_dat, data); | ||
1458 | } | ||
1459 | |||
1455 | ret = spi_register_master(master); | 1460 | ret = spi_register_master(master); |
1456 | if (ret != 0) { | 1461 | if (ret != 0) { |
1457 | dev_err(&plat_dev->dev, | 1462 | dev_err(&plat_dev->dev, |
@@ -1459,14 +1464,10 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) | |||
1459 | goto err_spi_register_master; | 1464 | goto err_spi_register_master; |
1460 | } | 1465 | } |
1461 | 1466 | ||
1462 | if (use_dma) { | ||
1463 | dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); | ||
1464 | pch_alloc_dma_buf(board_dat, data); | ||
1465 | } | ||
1466 | |||
1467 | return 0; | 1467 | return 0; |
1468 | 1468 | ||
1469 | err_spi_register_master: | 1469 | err_spi_register_master: |
1470 | pch_free_dma_buf(board_dat, data); | ||
1470 | free_irq(board_dat->pdev->irq, data); | 1471 | free_irq(board_dat->pdev->irq, data); |
1471 | err_request_irq: | 1472 | err_request_irq: |
1472 | pch_spi_free_resources(board_dat, data); | 1473 | pch_spi_free_resources(board_dat, data); |
diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index 24c40b13dab1..350a76b7e8d4 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c | |||
@@ -8,7 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/init.h> | ||
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
13 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
14 | #include <linux/i2c.h> | 13 | #include <linux/i2c.h> |
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 6d4ce4615163..e6cd1112ae40 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/init.h> | ||
18 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
19 | #include <linux/of.h> | 18 | #include <linux/of.h> |
20 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d0b28bba38be..ffc1a2ebc4ca 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/cache.h> | 26 | #include <linux/cache.h> |
27 | #include <linux/dma-mapping.h> | ||
28 | #include <linux/dmaengine.h> | ||
27 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
28 | #include <linux/of_device.h> | 30 | #include <linux/of_device.h> |
29 | #include <linux/of_irq.h> | 31 | #include <linux/of_irq.h> |
@@ -255,13 +257,12 @@ EXPORT_SYMBOL_GPL(spi_bus_type); | |||
255 | static int spi_drv_probe(struct device *dev) | 257 | static int spi_drv_probe(struct device *dev) |
256 | { | 258 | { |
257 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); | 259 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); |
258 | struct spi_device *spi = to_spi_device(dev); | ||
259 | int ret; | 260 | int ret; |
260 | 261 | ||
261 | acpi_dev_pm_attach(&spi->dev, true); | 262 | acpi_dev_pm_attach(dev, true); |
262 | ret = sdrv->probe(spi); | 263 | ret = sdrv->probe(to_spi_device(dev)); |
263 | if (ret) | 264 | if (ret) |
264 | acpi_dev_pm_detach(&spi->dev, true); | 265 | acpi_dev_pm_detach(dev, true); |
265 | 266 | ||
266 | return ret; | 267 | return ret; |
267 | } | 268 | } |
@@ -269,11 +270,10 @@ static int spi_drv_probe(struct device *dev) | |||
269 | static int spi_drv_remove(struct device *dev) | 270 | static int spi_drv_remove(struct device *dev) |
270 | { | 271 | { |
271 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); | 272 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); |
272 | struct spi_device *spi = to_spi_device(dev); | ||
273 | int ret; | 273 | int ret; |
274 | 274 | ||
275 | ret = sdrv->remove(spi); | 275 | ret = sdrv->remove(to_spi_device(dev)); |
276 | acpi_dev_pm_detach(&spi->dev, true); | 276 | acpi_dev_pm_detach(dev, true); |
277 | 277 | ||
278 | return ret; | 278 | return ret; |
279 | } | 279 | } |
@@ -580,6 +580,169 @@ static void spi_set_cs(struct spi_device *spi, bool enable) | |||
580 | spi->master->set_cs(spi, !enable); | 580 | spi->master->set_cs(spi, !enable); |
581 | } | 581 | } |
582 | 582 | ||
583 | static int spi_map_buf(struct spi_master *master, struct device *dev, | ||
584 | struct sg_table *sgt, void *buf, size_t len, | ||
585 | enum dma_data_direction dir) | ||
586 | { | ||
587 | const bool vmalloced_buf = is_vmalloc_addr(buf); | ||
588 | const int desc_len = vmalloced_buf ? PAGE_SIZE : master->max_dma_len; | ||
589 | const int sgs = DIV_ROUND_UP(len, desc_len); | ||
590 | struct page *vm_page; | ||
591 | void *sg_buf; | ||
592 | size_t min; | ||
593 | int i, ret; | ||
594 | |||
595 | ret = sg_alloc_table(sgt, sgs, GFP_KERNEL); | ||
596 | if (ret != 0) | ||
597 | return ret; | ||
598 | |||
599 | for (i = 0; i < sgs; i++) { | ||
600 | min = min_t(size_t, len, desc_len); | ||
601 | |||
602 | if (vmalloced_buf) { | ||
603 | vm_page = vmalloc_to_page(buf); | ||
604 | if (!vm_page) { | ||
605 | sg_free_table(sgt); | ||
606 | return -ENOMEM; | ||
607 | } | ||
608 | sg_buf = page_address(vm_page) + | ||
609 | ((size_t)buf & ~PAGE_MASK); | ||
610 | } else { | ||
611 | sg_buf = buf; | ||
612 | } | ||
613 | |||
614 | sg_set_buf(&sgt->sgl[i], sg_buf, min); | ||
615 | |||
616 | buf += min; | ||
617 | len -= min; | ||
618 | } | ||
619 | |||
620 | ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir); | ||
621 | if (ret < 0) { | ||
622 | sg_free_table(sgt); | ||
623 | return ret; | ||
624 | } | ||
625 | |||
626 | sgt->nents = ret; | ||
627 | |||
628 | return 0; | ||
629 | } | ||
630 | |||
631 | static void spi_unmap_buf(struct spi_master *master, struct device *dev, | ||
632 | struct sg_table *sgt, enum dma_data_direction dir) | ||
633 | { | ||
634 | if (sgt->orig_nents) { | ||
635 | dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir); | ||
636 | sg_free_table(sgt); | ||
637 | } | ||
638 | } | ||
639 | |||
640 | static int spi_map_msg(struct spi_master *master, struct spi_message *msg) | ||
641 | { | ||
642 | struct device *tx_dev, *rx_dev; | ||
643 | struct spi_transfer *xfer; | ||
644 | void *tmp; | ||
645 | unsigned int max_tx, max_rx; | ||
646 | int ret; | ||
647 | |||
648 | if (master->flags & (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX)) { | ||
649 | max_tx = 0; | ||
650 | max_rx = 0; | ||
651 | |||
652 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | ||
653 | if ((master->flags & SPI_MASTER_MUST_TX) && | ||
654 | !xfer->tx_buf) | ||
655 | max_tx = max(xfer->len, max_tx); | ||
656 | if ((master->flags & SPI_MASTER_MUST_RX) && | ||
657 | !xfer->rx_buf) | ||
658 | max_rx = max(xfer->len, max_rx); | ||
659 | } | ||
660 | |||
661 | if (max_tx) { | ||
662 | tmp = krealloc(master->dummy_tx, max_tx, | ||
663 | GFP_KERNEL | GFP_DMA); | ||
664 | if (!tmp) | ||
665 | return -ENOMEM; | ||
666 | master->dummy_tx = tmp; | ||
667 | memset(tmp, 0, max_tx); | ||
668 | } | ||
669 | |||
670 | if (max_rx) { | ||
671 | tmp = krealloc(master->dummy_rx, max_rx, | ||
672 | GFP_KERNEL | GFP_DMA); | ||
673 | if (!tmp) | ||
674 | return -ENOMEM; | ||
675 | master->dummy_rx = tmp; | ||
676 | } | ||
677 | |||
678 | if (max_tx || max_rx) { | ||
679 | list_for_each_entry(xfer, &msg->transfers, | ||
680 | transfer_list) { | ||
681 | if (!xfer->tx_buf) | ||
682 | xfer->tx_buf = master->dummy_tx; | ||
683 | if (!xfer->rx_buf) | ||
684 | xfer->rx_buf = master->dummy_rx; | ||
685 | } | ||
686 | } | ||
687 | } | ||
688 | |||
689 | if (!master->can_dma) | ||
690 | return 0; | ||
691 | |||
692 | tx_dev = &master->dma_tx->dev->device; | ||
693 | rx_dev = &master->dma_rx->dev->device; | ||
694 | |||
695 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | ||
696 | if (!master->can_dma(master, msg->spi, xfer)) | ||
697 | continue; | ||
698 | |||
699 | if (xfer->tx_buf != NULL) { | ||
700 | ret = spi_map_buf(master, tx_dev, &xfer->tx_sg, | ||
701 | (void *)xfer->tx_buf, xfer->len, | ||
702 | DMA_TO_DEVICE); | ||
703 | if (ret != 0) | ||
704 | return ret; | ||
705 | } | ||
706 | |||
707 | if (xfer->rx_buf != NULL) { | ||
708 | ret = spi_map_buf(master, rx_dev, &xfer->rx_sg, | ||
709 | xfer->rx_buf, xfer->len, | ||
710 | DMA_FROM_DEVICE); | ||
711 | if (ret != 0) { | ||
712 | spi_unmap_buf(master, tx_dev, &xfer->tx_sg, | ||
713 | DMA_TO_DEVICE); | ||
714 | return ret; | ||
715 | } | ||
716 | } | ||
717 | } | ||
718 | |||
719 | master->cur_msg_mapped = true; | ||
720 | |||
721 | return 0; | ||
722 | } | ||
723 | |||
724 | static int spi_unmap_msg(struct spi_master *master, struct spi_message *msg) | ||
725 | { | ||
726 | struct spi_transfer *xfer; | ||
727 | struct device *tx_dev, *rx_dev; | ||
728 | |||
729 | if (!master->cur_msg_mapped || !master->can_dma) | ||
730 | return 0; | ||
731 | |||
732 | tx_dev = &master->dma_tx->dev->device; | ||
733 | rx_dev = &master->dma_rx->dev->device; | ||
734 | |||
735 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | ||
736 | if (!master->can_dma(master, msg->spi, xfer)) | ||
737 | continue; | ||
738 | |||
739 | spi_unmap_buf(master, rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); | ||
740 | spi_unmap_buf(master, tx_dev, &xfer->tx_sg, DMA_TO_DEVICE); | ||
741 | } | ||
742 | |||
743 | return 0; | ||
744 | } | ||
745 | |||
583 | /* | 746 | /* |
584 | * spi_transfer_one_message - Default implementation of transfer_one_message() | 747 | * spi_transfer_one_message - Default implementation of transfer_one_message() |
585 | * | 748 | * |
@@ -591,7 +754,6 @@ static int spi_transfer_one_message(struct spi_master *master, | |||
591 | struct spi_message *msg) | 754 | struct spi_message *msg) |
592 | { | 755 | { |
593 | struct spi_transfer *xfer; | 756 | struct spi_transfer *xfer; |
594 | bool cur_cs = true; | ||
595 | bool keep_cs = false; | 757 | bool keep_cs = false; |
596 | int ret = 0; | 758 | int ret = 0; |
597 | 759 | ||
@@ -627,8 +789,9 @@ static int spi_transfer_one_message(struct spi_master *master, | |||
627 | &msg->transfers)) { | 789 | &msg->transfers)) { |
628 | keep_cs = true; | 790 | keep_cs = true; |
629 | } else { | 791 | } else { |
630 | cur_cs = !cur_cs; | 792 | spi_set_cs(msg->spi, false); |
631 | spi_set_cs(msg->spi, cur_cs); | 793 | udelay(10); |
794 | spi_set_cs(msg->spi, true); | ||
632 | } | 795 | } |
633 | } | 796 | } |
634 | 797 | ||
@@ -686,6 +849,10 @@ static void spi_pump_messages(struct kthread_work *work) | |||
686 | } | 849 | } |
687 | master->busy = false; | 850 | master->busy = false; |
688 | spin_unlock_irqrestore(&master->queue_lock, flags); | 851 | spin_unlock_irqrestore(&master->queue_lock, flags); |
852 | kfree(master->dummy_rx); | ||
853 | master->dummy_rx = NULL; | ||
854 | kfree(master->dummy_tx); | ||
855 | master->dummy_tx = NULL; | ||
689 | if (master->unprepare_transfer_hardware && | 856 | if (master->unprepare_transfer_hardware && |
690 | master->unprepare_transfer_hardware(master)) | 857 | master->unprepare_transfer_hardware(master)) |
691 | dev_err(&master->dev, | 858 | dev_err(&master->dev, |
@@ -752,6 +919,13 @@ static void spi_pump_messages(struct kthread_work *work) | |||
752 | master->cur_msg_prepared = true; | 919 | master->cur_msg_prepared = true; |
753 | } | 920 | } |
754 | 921 | ||
922 | ret = spi_map_msg(master, master->cur_msg); | ||
923 | if (ret) { | ||
924 | master->cur_msg->status = ret; | ||
925 | spi_finalize_current_message(master); | ||
926 | return; | ||
927 | } | ||
928 | |||
755 | ret = master->transfer_one_message(master, master->cur_msg); | 929 | ret = master->transfer_one_message(master, master->cur_msg); |
756 | if (ret) { | 930 | if (ret) { |
757 | dev_err(&master->dev, | 931 | dev_err(&master->dev, |
@@ -839,6 +1013,8 @@ void spi_finalize_current_message(struct spi_master *master) | |||
839 | queue_kthread_work(&master->kworker, &master->pump_messages); | 1013 | queue_kthread_work(&master->kworker, &master->pump_messages); |
840 | spin_unlock_irqrestore(&master->queue_lock, flags); | 1014 | spin_unlock_irqrestore(&master->queue_lock, flags); |
841 | 1015 | ||
1016 | spi_unmap_msg(master, mesg); | ||
1017 | |||
842 | if (master->cur_msg_prepared && master->unprepare_message) { | 1018 | if (master->cur_msg_prepared && master->unprepare_message) { |
843 | ret = master->unprepare_message(master, mesg); | 1019 | ret = master->unprepare_message(master, mesg); |
844 | if (ret) { | 1020 | if (ret) { |
@@ -892,7 +1068,7 @@ static int spi_stop_queue(struct spi_master *master) | |||
892 | */ | 1068 | */ |
893 | while ((!list_empty(&master->queue) || master->busy) && limit--) { | 1069 | while ((!list_empty(&master->queue) || master->busy) && limit--) { |
894 | spin_unlock_irqrestore(&master->queue_lock, flags); | 1070 | spin_unlock_irqrestore(&master->queue_lock, flags); |
895 | msleep(10); | 1071 | usleep_range(10000, 11000); |
896 | spin_lock_irqsave(&master->queue_lock, flags); | 1072 | spin_lock_irqsave(&master->queue_lock, flags); |
897 | } | 1073 | } |
898 | 1074 | ||
@@ -1372,6 +1548,8 @@ int spi_register_master(struct spi_master *master) | |||
1372 | mutex_init(&master->bus_lock_mutex); | 1548 | mutex_init(&master->bus_lock_mutex); |
1373 | master->bus_lock_flag = 0; | 1549 | master->bus_lock_flag = 0; |
1374 | init_completion(&master->xfer_completion); | 1550 | init_completion(&master->xfer_completion); |
1551 | if (!master->max_dma_len) | ||
1552 | master->max_dma_len = INT_MAX; | ||
1375 | 1553 | ||
1376 | /* register the device, then userspace will see it. | 1554 | /* register the device, then userspace will see it. |
1377 | * registration fails if the bus ID is in use. | 1555 | * registration fails if the bus ID is in use. |
@@ -1597,6 +1775,9 @@ int spi_setup(struct spi_device *spi) | |||
1597 | if (!spi->bits_per_word) | 1775 | if (!spi->bits_per_word) |
1598 | spi->bits_per_word = 8; | 1776 | spi->bits_per_word = 8; |
1599 | 1777 | ||
1778 | if (!spi->max_speed_hz) | ||
1779 | spi->max_speed_hz = spi->master->max_speed_hz; | ||
1780 | |||
1600 | if (spi->master->setup) | 1781 | if (spi->master->setup) |
1601 | status = spi->master->setup(spi); | 1782 | status = spi->master->setup(spi); |
1602 | 1783 | ||
@@ -1617,11 +1798,10 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) | |||
1617 | { | 1798 | { |
1618 | struct spi_master *master = spi->master; | 1799 | struct spi_master *master = spi->master; |
1619 | struct spi_transfer *xfer; | 1800 | struct spi_transfer *xfer; |
1801 | int w_size; | ||
1620 | 1802 | ||
1621 | if (list_empty(&message->transfers)) | 1803 | if (list_empty(&message->transfers)) |
1622 | return -EINVAL; | 1804 | return -EINVAL; |
1623 | if (!message->complete) | ||
1624 | return -EINVAL; | ||
1625 | 1805 | ||
1626 | /* Half-duplex links include original MicroWire, and ones with | 1806 | /* Half-duplex links include original MicroWire, and ones with |
1627 | * only one data pin like SPI_3WIRE (switches direction) or where | 1807 | * only one data pin like SPI_3WIRE (switches direction) or where |
@@ -1652,12 +1832,13 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) | |||
1652 | message->frame_length += xfer->len; | 1832 | message->frame_length += xfer->len; |
1653 | if (!xfer->bits_per_word) | 1833 | if (!xfer->bits_per_word) |
1654 | xfer->bits_per_word = spi->bits_per_word; | 1834 | xfer->bits_per_word = spi->bits_per_word; |
1655 | if (!xfer->speed_hz) { | 1835 | |
1836 | if (!xfer->speed_hz) | ||
1656 | xfer->speed_hz = spi->max_speed_hz; | 1837 | xfer->speed_hz = spi->max_speed_hz; |
1657 | if (master->max_speed_hz && | 1838 | |
1658 | xfer->speed_hz > master->max_speed_hz) | 1839 | if (master->max_speed_hz && |
1659 | xfer->speed_hz = master->max_speed_hz; | 1840 | xfer->speed_hz > master->max_speed_hz) |
1660 | } | 1841 | xfer->speed_hz = master->max_speed_hz; |
1661 | 1842 | ||
1662 | if (master->bits_per_word_mask) { | 1843 | if (master->bits_per_word_mask) { |
1663 | /* Only 32 bits fit in the mask */ | 1844 | /* Only 32 bits fit in the mask */ |
@@ -1668,12 +1849,24 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) | |||
1668 | return -EINVAL; | 1849 | return -EINVAL; |
1669 | } | 1850 | } |
1670 | 1851 | ||
1852 | /* | ||
1853 | * SPI transfer length should be multiple of SPI word size | ||
1854 | * where SPI word size should be power-of-two multiple | ||
1855 | */ | ||
1856 | if (xfer->bits_per_word <= 8) | ||
1857 | w_size = 1; | ||
1858 | else if (xfer->bits_per_word <= 16) | ||
1859 | w_size = 2; | ||
1860 | else | ||
1861 | w_size = 4; | ||
1862 | |||
1863 | /* No partial transfers accepted */ | ||
1864 | if (xfer->len % w_size) | ||
1865 | return -EINVAL; | ||
1866 | |||
1671 | if (xfer->speed_hz && master->min_speed_hz && | 1867 | if (xfer->speed_hz && master->min_speed_hz && |
1672 | xfer->speed_hz < master->min_speed_hz) | 1868 | xfer->speed_hz < master->min_speed_hz) |
1673 | return -EINVAL; | 1869 | return -EINVAL; |
1674 | if (xfer->speed_hz && master->max_speed_hz && | ||
1675 | xfer->speed_hz > master->max_speed_hz) | ||
1676 | return -EINVAL; | ||
1677 | 1870 | ||
1678 | if (xfer->tx_buf && !xfer->tx_nbits) | 1871 | if (xfer->tx_buf && !xfer->tx_nbits) |
1679 | xfer->tx_nbits = SPI_NBITS_SINGLE; | 1872 | xfer->tx_nbits = SPI_NBITS_SINGLE; |
diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c index 4a08e16e42f7..79206cb3fb94 100644 --- a/drivers/staging/cxt1e1/linux.c +++ b/drivers/staging/cxt1e1/linux.c | |||
@@ -866,6 +866,8 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
866 | _IOC_SIZE (iocmd)); | 866 | _IOC_SIZE (iocmd)); |
867 | #endif | 867 | #endif |
868 | iolen = _IOC_SIZE (iocmd); | 868 | iolen = _IOC_SIZE (iocmd); |
869 | if (iolen > sizeof(arg)) | ||
870 | return -EFAULT; | ||
869 | data = ifr->ifr_data + sizeof (iocmd); | 871 | data = ifr->ifr_data + sizeof (iocmd); |
870 | if (copy_from_user (&arg, data, iolen)) | 872 | if (copy_from_user (&arg, data, iolen)) |
871 | return -EFAULT; | 873 | return -EFAULT; |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 7fc66a6a6e36..514844efac75 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -757,6 +757,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid) | |||
757 | } | 757 | } |
758 | 758 | ||
759 | /* if it is released, wait for the next touch via IRQ */ | 759 | /* if it is released, wait for the next touch via IRQ */ |
760 | lradc->cur_plate = LRADC_TOUCH; | ||
760 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); | 761 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); |
761 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); | 762 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); |
762 | } | 763 | } |
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index a70dcef1419e..2f40ff5901d6 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
@@ -55,6 +55,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
55 | /****** 8188EUS ********/ | 55 | /****** 8188EUS ********/ |
56 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ | 56 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
58 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | ||
58 | {} /* Terminating entry */ | 59 | {} /* Terminating entry */ |
59 | }; | 60 | }; |
60 | 61 | ||
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 7f1a7ce4b771..b83ec378d04f 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -785,7 +785,7 @@ static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn) | |||
785 | spin_unlock_bh(&conn->cmd_lock); | 785 | spin_unlock_bh(&conn->cmd_lock); |
786 | 786 | ||
787 | list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) { | 787 | list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) { |
788 | list_del(&cmd->i_conn_node); | 788 | list_del_init(&cmd->i_conn_node); |
789 | iscsit_free_cmd(cmd, false); | 789 | iscsit_free_cmd(cmd, false); |
790 | } | 790 | } |
791 | } | 791 | } |
@@ -3708,7 +3708,7 @@ iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state | |||
3708 | break; | 3708 | break; |
3709 | case ISTATE_REMOVE: | 3709 | case ISTATE_REMOVE: |
3710 | spin_lock_bh(&conn->cmd_lock); | 3710 | spin_lock_bh(&conn->cmd_lock); |
3711 | list_del(&cmd->i_conn_node); | 3711 | list_del_init(&cmd->i_conn_node); |
3712 | spin_unlock_bh(&conn->cmd_lock); | 3712 | spin_unlock_bh(&conn->cmd_lock); |
3713 | 3713 | ||
3714 | iscsit_free_cmd(cmd, false); | 3714 | iscsit_free_cmd(cmd, false); |
@@ -4151,7 +4151,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) | |||
4151 | spin_lock_bh(&conn->cmd_lock); | 4151 | spin_lock_bh(&conn->cmd_lock); |
4152 | list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { | 4152 | list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { |
4153 | 4153 | ||
4154 | list_del(&cmd->i_conn_node); | 4154 | list_del_init(&cmd->i_conn_node); |
4155 | spin_unlock_bh(&conn->cmd_lock); | 4155 | spin_unlock_bh(&conn->cmd_lock); |
4156 | 4156 | ||
4157 | iscsit_increment_maxcmdsn(cmd, sess); | 4157 | iscsit_increment_maxcmdsn(cmd, sess); |
@@ -4196,6 +4196,10 @@ int iscsit_close_connection( | |||
4196 | iscsit_stop_timers_for_cmds(conn); | 4196 | iscsit_stop_timers_for_cmds(conn); |
4197 | iscsit_stop_nopin_response_timer(conn); | 4197 | iscsit_stop_nopin_response_timer(conn); |
4198 | iscsit_stop_nopin_timer(conn); | 4198 | iscsit_stop_nopin_timer(conn); |
4199 | |||
4200 | if (conn->conn_transport->iscsit_wait_conn) | ||
4201 | conn->conn_transport->iscsit_wait_conn(conn); | ||
4202 | |||
4199 | iscsit_free_queue_reqs_for_conn(conn); | 4203 | iscsit_free_queue_reqs_for_conn(conn); |
4200 | 4204 | ||
4201 | /* | 4205 | /* |
diff --git a/drivers/target/iscsi/iscsi_target_erl2.c b/drivers/target/iscsi/iscsi_target_erl2.c index 33be1fb1df32..4ca8fd2a70db 100644 --- a/drivers/target/iscsi/iscsi_target_erl2.c +++ b/drivers/target/iscsi/iscsi_target_erl2.c | |||
@@ -138,7 +138,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
138 | list_for_each_entry_safe(cmd, cmd_tmp, | 138 | list_for_each_entry_safe(cmd, cmd_tmp, |
139 | &cr->conn_recovery_cmd_list, i_conn_node) { | 139 | &cr->conn_recovery_cmd_list, i_conn_node) { |
140 | 140 | ||
141 | list_del(&cmd->i_conn_node); | 141 | list_del_init(&cmd->i_conn_node); |
142 | cmd->conn = NULL; | 142 | cmd->conn = NULL; |
143 | spin_unlock(&cr->conn_recovery_cmd_lock); | 143 | spin_unlock(&cr->conn_recovery_cmd_lock); |
144 | iscsit_free_cmd(cmd, true); | 144 | iscsit_free_cmd(cmd, true); |
@@ -160,7 +160,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
160 | list_for_each_entry_safe(cmd, cmd_tmp, | 160 | list_for_each_entry_safe(cmd, cmd_tmp, |
161 | &cr->conn_recovery_cmd_list, i_conn_node) { | 161 | &cr->conn_recovery_cmd_list, i_conn_node) { |
162 | 162 | ||
163 | list_del(&cmd->i_conn_node); | 163 | list_del_init(&cmd->i_conn_node); |
164 | cmd->conn = NULL; | 164 | cmd->conn = NULL; |
165 | spin_unlock(&cr->conn_recovery_cmd_lock); | 165 | spin_unlock(&cr->conn_recovery_cmd_lock); |
166 | iscsit_free_cmd(cmd, true); | 166 | iscsit_free_cmd(cmd, true); |
@@ -216,7 +216,7 @@ int iscsit_remove_cmd_from_connection_recovery( | |||
216 | } | 216 | } |
217 | cr = cmd->cr; | 217 | cr = cmd->cr; |
218 | 218 | ||
219 | list_del(&cmd->i_conn_node); | 219 | list_del_init(&cmd->i_conn_node); |
220 | return --cr->cmd_count; | 220 | return --cr->cmd_count; |
221 | } | 221 | } |
222 | 222 | ||
@@ -297,7 +297,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn) | |||
297 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) | 297 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) |
298 | continue; | 298 | continue; |
299 | 299 | ||
300 | list_del(&cmd->i_conn_node); | 300 | list_del_init(&cmd->i_conn_node); |
301 | 301 | ||
302 | spin_unlock_bh(&conn->cmd_lock); | 302 | spin_unlock_bh(&conn->cmd_lock); |
303 | iscsit_free_cmd(cmd, true); | 303 | iscsit_free_cmd(cmd, true); |
@@ -335,7 +335,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
335 | /* | 335 | /* |
336 | * Only perform connection recovery on ISCSI_OP_SCSI_CMD or | 336 | * Only perform connection recovery on ISCSI_OP_SCSI_CMD or |
337 | * ISCSI_OP_NOOP_OUT opcodes. For all other opcodes call | 337 | * ISCSI_OP_NOOP_OUT opcodes. For all other opcodes call |
338 | * list_del(&cmd->i_conn_node); to release the command to the | 338 | * list_del_init(&cmd->i_conn_node); to release the command to the |
339 | * session pool and remove it from the connection's list. | 339 | * session pool and remove it from the connection's list. |
340 | * | 340 | * |
341 | * Also stop the DataOUT timer, which will be restarted after | 341 | * Also stop the DataOUT timer, which will be restarted after |
@@ -351,7 +351,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
351 | " CID: %hu\n", cmd->iscsi_opcode, | 351 | " CID: %hu\n", cmd->iscsi_opcode, |
352 | cmd->init_task_tag, cmd->cmd_sn, conn->cid); | 352 | cmd->init_task_tag, cmd->cmd_sn, conn->cid); |
353 | 353 | ||
354 | list_del(&cmd->i_conn_node); | 354 | list_del_init(&cmd->i_conn_node); |
355 | spin_unlock_bh(&conn->cmd_lock); | 355 | spin_unlock_bh(&conn->cmd_lock); |
356 | iscsit_free_cmd(cmd, true); | 356 | iscsit_free_cmd(cmd, true); |
357 | spin_lock_bh(&conn->cmd_lock); | 357 | spin_lock_bh(&conn->cmd_lock); |
@@ -371,7 +371,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
371 | */ | 371 | */ |
372 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && | 372 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && |
373 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { | 373 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { |
374 | list_del(&cmd->i_conn_node); | 374 | list_del_init(&cmd->i_conn_node); |
375 | spin_unlock_bh(&conn->cmd_lock); | 375 | spin_unlock_bh(&conn->cmd_lock); |
376 | iscsit_free_cmd(cmd, true); | 376 | iscsit_free_cmd(cmd, true); |
377 | spin_lock_bh(&conn->cmd_lock); | 377 | spin_lock_bh(&conn->cmd_lock); |
@@ -393,7 +393,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
393 | 393 | ||
394 | cmd->sess = conn->sess; | 394 | cmd->sess = conn->sess; |
395 | 395 | ||
396 | list_del(&cmd->i_conn_node); | 396 | list_del_init(&cmd->i_conn_node); |
397 | spin_unlock_bh(&conn->cmd_lock); | 397 | spin_unlock_bh(&conn->cmd_lock); |
398 | 398 | ||
399 | iscsit_free_all_datain_reqs(cmd); | 399 | iscsit_free_all_datain_reqs(cmd); |
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 39761837608d..44a5471de00f 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -137,7 +137,7 @@ struct iscsi_portal_group *iscsit_get_tpg_from_np( | |||
137 | list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { | 137 | list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { |
138 | 138 | ||
139 | spin_lock(&tpg->tpg_state_lock); | 139 | spin_lock(&tpg->tpg_state_lock); |
140 | if (tpg->tpg_state == TPG_STATE_FREE) { | 140 | if (tpg->tpg_state != TPG_STATE_ACTIVE) { |
141 | spin_unlock(&tpg->tpg_state_lock); | 141 | spin_unlock(&tpg->tpg_state_lock); |
142 | continue; | 142 | continue; |
143 | } | 143 | } |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index a4489444ffbc..77e6531fb0a1 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -1074,31 +1074,36 @@ sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, | |||
1074 | struct scatterlist *psg; | 1074 | struct scatterlist *psg; |
1075 | void *paddr, *addr; | 1075 | void *paddr, *addr; |
1076 | unsigned int i, len, left; | 1076 | unsigned int i, len, left; |
1077 | unsigned int offset = 0; | 1077 | unsigned int offset = sg_off; |
1078 | 1078 | ||
1079 | left = sectors * dev->prot_length; | 1079 | left = sectors * dev->prot_length; |
1080 | 1080 | ||
1081 | for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { | 1081 | for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { |
1082 | 1082 | unsigned int psg_len, copied = 0; | |
1083 | len = min(psg->length, left); | ||
1084 | if (offset >= sg->length) { | ||
1085 | sg = sg_next(sg); | ||
1086 | offset = 0; | ||
1087 | sg_off = sg->offset; | ||
1088 | } | ||
1089 | 1083 | ||
1090 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; | 1084 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; |
1091 | addr = kmap_atomic(sg_page(sg)) + sg_off; | 1085 | psg_len = min(left, psg->length); |
1086 | while (psg_len) { | ||
1087 | len = min(psg_len, sg->length - offset); | ||
1088 | addr = kmap_atomic(sg_page(sg)) + sg->offset + offset; | ||
1092 | 1089 | ||
1093 | if (read) | 1090 | if (read) |
1094 | memcpy(paddr, addr, len); | 1091 | memcpy(paddr + copied, addr, len); |
1095 | else | 1092 | else |
1096 | memcpy(addr, paddr, len); | 1093 | memcpy(addr, paddr + copied, len); |
1097 | 1094 | ||
1098 | left -= len; | 1095 | left -= len; |
1099 | offset += len; | 1096 | offset += len; |
1097 | copied += len; | ||
1098 | psg_len -= len; | ||
1099 | |||
1100 | if (offset >= sg->length) { | ||
1101 | sg = sg_next(sg); | ||
1102 | offset = 0; | ||
1103 | } | ||
1104 | kunmap_atomic(addr); | ||
1105 | } | ||
1100 | kunmap_atomic(paddr); | 1106 | kunmap_atomic(paddr); |
1101 | kunmap_atomic(addr); | ||
1102 | } | 1107 | } |
1103 | } | 1108 | } |
1104 | 1109 | ||
@@ -1163,7 +1168,7 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, | |||
1163 | { | 1168 | { |
1164 | struct se_device *dev = cmd->se_dev; | 1169 | struct se_device *dev = cmd->se_dev; |
1165 | struct se_dif_v1_tuple *sdt; | 1170 | struct se_dif_v1_tuple *sdt; |
1166 | struct scatterlist *dsg; | 1171 | struct scatterlist *dsg, *psg = sg; |
1167 | sector_t sector = start; | 1172 | sector_t sector = start; |
1168 | void *daddr, *paddr; | 1173 | void *daddr, *paddr; |
1169 | int i, j, offset = sg_off; | 1174 | int i, j, offset = sg_off; |
@@ -1171,14 +1176,14 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, | |||
1171 | 1176 | ||
1172 | for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) { | 1177 | for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) { |
1173 | daddr = kmap_atomic(sg_page(dsg)) + dsg->offset; | 1178 | daddr = kmap_atomic(sg_page(dsg)) + dsg->offset; |
1174 | paddr = kmap_atomic(sg_page(sg)) + sg->offset; | 1179 | paddr = kmap_atomic(sg_page(psg)) + sg->offset; |
1175 | 1180 | ||
1176 | for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) { | 1181 | for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) { |
1177 | 1182 | ||
1178 | if (offset >= sg->length) { | 1183 | if (offset >= psg->length) { |
1179 | kunmap_atomic(paddr); | 1184 | kunmap_atomic(paddr); |
1180 | sg = sg_next(sg); | 1185 | psg = sg_next(psg); |
1181 | paddr = kmap_atomic(sg_page(sg)) + sg->offset; | 1186 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; |
1182 | offset = 0; | 1187 | offset = 0; |
1183 | } | 1188 | } |
1184 | 1189 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 24b4f65d8777..2956250b7225 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1601,6 +1601,9 @@ void transport_generic_request_failure(struct se_cmd *cmd, | |||
1601 | case TCM_CHECK_CONDITION_ABORT_CMD: | 1601 | case TCM_CHECK_CONDITION_ABORT_CMD: |
1602 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: | 1602 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: |
1603 | case TCM_CHECK_CONDITION_NOT_READY: | 1603 | case TCM_CHECK_CONDITION_NOT_READY: |
1604 | case TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED: | ||
1605 | case TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED: | ||
1606 | case TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED: | ||
1604 | break; | 1607 | break; |
1605 | case TCM_OUT_OF_RESOURCES: | 1608 | case TCM_OUT_OF_RESOURCES: |
1606 | sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 1609 | sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 35c066489a19..5f88d767671e 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -136,6 +136,7 @@ config SPEAR_THERMAL | |||
136 | config RCAR_THERMAL | 136 | config RCAR_THERMAL |
137 | tristate "Renesas R-Car thermal driver" | 137 | tristate "Renesas R-Car thermal driver" |
138 | depends on ARCH_SHMOBILE || COMPILE_TEST | 138 | depends on ARCH_SHMOBILE || COMPILE_TEST |
139 | depends on HAS_IOMEM | ||
139 | help | 140 | help |
140 | Enable this to plug the R-Car thermal sensor driver into the Linux | 141 | Enable this to plug the R-Car thermal sensor driver into the Linux |
141 | thermal framework. | 142 | thermal framework. |
@@ -210,8 +211,16 @@ config ACPI_INT3403_THERMAL | |||
210 | tristate "ACPI INT3403 thermal driver" | 211 | tristate "ACPI INT3403 thermal driver" |
211 | depends on X86 && ACPI | 212 | depends on X86 && ACPI |
212 | help | 213 | help |
213 | This driver uses ACPI INT3403 device objects. If present, it will | 214 | Newer laptops and tablets that use ACPI may have thermal sensors |
214 | register each INT3403 thermal sensor as a thermal zone. | 215 | outside the core CPU/SOC for thermal safety reasons. These |
216 | temperature sensors are also exposed for the OS to use via the so | ||
217 | called INT3403 ACPI object. This driver will, on devices that have | ||
218 | such sensors, expose the temperature information from these sensors | ||
219 | to userspace via the normal thermal framework. This means that a wide | ||
220 | range of applications and GUI widgets can show this information to | ||
221 | the user or use this information for making decisions. For example, | ||
222 | the Intel Thermal Daemon can use this information to allow the user | ||
223 | to select his laptop to run without turning on the fans. | ||
215 | 224 | ||
216 | menu "Texas Instruments thermal drivers" | 225 | menu "Texas Instruments thermal drivers" |
217 | source "drivers/thermal/ti-soc-thermal/Kconfig" | 226 | source "drivers/thermal/ti-soc-thermal/Kconfig" |
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 338a88bf6662..71b0ec0c370d 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -56,10 +56,15 @@ static LIST_HEAD(thermal_governor_list); | |||
56 | static DEFINE_MUTEX(thermal_list_lock); | 56 | static DEFINE_MUTEX(thermal_list_lock); |
57 | static DEFINE_MUTEX(thermal_governor_lock); | 57 | static DEFINE_MUTEX(thermal_governor_lock); |
58 | 58 | ||
59 | static struct thermal_governor *def_governor; | ||
60 | |||
59 | static struct thermal_governor *__find_governor(const char *name) | 61 | static struct thermal_governor *__find_governor(const char *name) |
60 | { | 62 | { |
61 | struct thermal_governor *pos; | 63 | struct thermal_governor *pos; |
62 | 64 | ||
65 | if (!name || !name[0]) | ||
66 | return def_governor; | ||
67 | |||
63 | list_for_each_entry(pos, &thermal_governor_list, governor_list) | 68 | list_for_each_entry(pos, &thermal_governor_list, governor_list) |
64 | if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH)) | 69 | if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH)) |
65 | return pos; | 70 | return pos; |
@@ -82,17 +87,23 @@ int thermal_register_governor(struct thermal_governor *governor) | |||
82 | if (__find_governor(governor->name) == NULL) { | 87 | if (__find_governor(governor->name) == NULL) { |
83 | err = 0; | 88 | err = 0; |
84 | list_add(&governor->governor_list, &thermal_governor_list); | 89 | list_add(&governor->governor_list, &thermal_governor_list); |
90 | if (!def_governor && !strncmp(governor->name, | ||
91 | DEFAULT_THERMAL_GOVERNOR, THERMAL_NAME_LENGTH)) | ||
92 | def_governor = governor; | ||
85 | } | 93 | } |
86 | 94 | ||
87 | mutex_lock(&thermal_list_lock); | 95 | mutex_lock(&thermal_list_lock); |
88 | 96 | ||
89 | list_for_each_entry(pos, &thermal_tz_list, node) { | 97 | list_for_each_entry(pos, &thermal_tz_list, node) { |
98 | /* | ||
99 | * only thermal zones with specified tz->tzp->governor_name | ||
100 | * may run with tz->govenor unset | ||
101 | */ | ||
90 | if (pos->governor) | 102 | if (pos->governor) |
91 | continue; | 103 | continue; |
92 | if (pos->tzp) | 104 | |
93 | name = pos->tzp->governor_name; | 105 | name = pos->tzp->governor_name; |
94 | else | 106 | |
95 | name = DEFAULT_THERMAL_GOVERNOR; | ||
96 | if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH)) | 107 | if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH)) |
97 | pos->governor = governor; | 108 | pos->governor = governor; |
98 | } | 109 | } |
@@ -342,8 +353,8 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz) | |||
342 | static void handle_non_critical_trips(struct thermal_zone_device *tz, | 353 | static void handle_non_critical_trips(struct thermal_zone_device *tz, |
343 | int trip, enum thermal_trip_type trip_type) | 354 | int trip, enum thermal_trip_type trip_type) |
344 | { | 355 | { |
345 | if (tz->governor) | 356 | tz->governor ? tz->governor->throttle(tz, trip) : |
346 | tz->governor->throttle(tz, trip); | 357 | def_governor->throttle(tz, trip); |
347 | } | 358 | } |
348 | 359 | ||
349 | static void handle_critical_trips(struct thermal_zone_device *tz, | 360 | static void handle_critical_trips(struct thermal_zone_device *tz, |
@@ -1107,7 +1118,7 @@ __thermal_cooling_device_register(struct device_node *np, | |||
1107 | INIT_LIST_HEAD(&cdev->thermal_instances); | 1118 | INIT_LIST_HEAD(&cdev->thermal_instances); |
1108 | cdev->np = np; | 1119 | cdev->np = np; |
1109 | cdev->ops = ops; | 1120 | cdev->ops = ops; |
1110 | cdev->updated = true; | 1121 | cdev->updated = false; |
1111 | cdev->device.class = &thermal_class; | 1122 | cdev->device.class = &thermal_class; |
1112 | cdev->devdata = devdata; | 1123 | cdev->devdata = devdata; |
1113 | dev_set_name(&cdev->device, "cooling_device%d", cdev->id); | 1124 | dev_set_name(&cdev->device, "cooling_device%d", cdev->id); |
@@ -1533,7 +1544,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, | |||
1533 | if (tz->tzp) | 1544 | if (tz->tzp) |
1534 | tz->governor = __find_governor(tz->tzp->governor_name); | 1545 | tz->governor = __find_governor(tz->tzp->governor_name); |
1535 | else | 1546 | else |
1536 | tz->governor = __find_governor(DEFAULT_THERMAL_GOVERNOR); | 1547 | tz->governor = def_governor; |
1537 | 1548 | ||
1538 | mutex_unlock(&thermal_governor_lock); | 1549 | mutex_unlock(&thermal_governor_lock); |
1539 | 1550 | ||
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 972e1c73722a..081fd7e6a9f0 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c | |||
@@ -68,6 +68,10 @@ struct phy_dev_entry { | |||
68 | struct thermal_zone_device *tzone; | 68 | struct thermal_zone_device *tzone; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static const struct thermal_zone_params pkg_temp_tz_params = { | ||
72 | .no_hwmon = true, | ||
73 | }; | ||
74 | |||
71 | /* List maintaining number of package instances */ | 75 | /* List maintaining number of package instances */ |
72 | static LIST_HEAD(phy_dev_list); | 76 | static LIST_HEAD(phy_dev_list); |
73 | static DEFINE_MUTEX(phy_dev_list_mutex); | 77 | static DEFINE_MUTEX(phy_dev_list_mutex); |
@@ -394,7 +398,6 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) | |||
394 | int err; | 398 | int err; |
395 | u32 tj_max; | 399 | u32 tj_max; |
396 | struct phy_dev_entry *phy_dev_entry; | 400 | struct phy_dev_entry *phy_dev_entry; |
397 | char buffer[30]; | ||
398 | int thres_count; | 401 | int thres_count; |
399 | u32 eax, ebx, ecx, edx; | 402 | u32 eax, ebx, ecx, edx; |
400 | u8 *temp; | 403 | u8 *temp; |
@@ -440,13 +443,11 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) | |||
440 | phy_dev_entry->first_cpu = cpu; | 443 | phy_dev_entry->first_cpu = cpu; |
441 | phy_dev_entry->tj_max = tj_max; | 444 | phy_dev_entry->tj_max = tj_max; |
442 | phy_dev_entry->ref_cnt = 1; | 445 | phy_dev_entry->ref_cnt = 1; |
443 | snprintf(buffer, sizeof(buffer), "pkg-temp-%d\n", | 446 | phy_dev_entry->tzone = thermal_zone_device_register("x86_pkg_temp", |
444 | phy_dev_entry->phys_proc_id); | ||
445 | phy_dev_entry->tzone = thermal_zone_device_register(buffer, | ||
446 | thres_count, | 447 | thres_count, |
447 | (thres_count == MAX_NUMBER_OF_TRIPS) ? | 448 | (thres_count == MAX_NUMBER_OF_TRIPS) ? |
448 | 0x03 : 0x01, | 449 | 0x03 : 0x01, |
449 | phy_dev_entry, &tzone_ops, NULL, 0, 0); | 450 | phy_dev_entry, &tzone_ops, &pkg_temp_tz_params, 0, 0); |
450 | if (IS_ERR(phy_dev_entry->tzone)) { | 451 | if (IS_ERR(phy_dev_entry->tzone)) { |
451 | err = PTR_ERR(phy_dev_entry->tzone); | 452 | err = PTR_ERR(phy_dev_entry->tzone); |
452 | goto err_ret_free; | 453 | goto err_ret_free; |
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c index cf86e729532b..dc697cee248a 100644 --- a/drivers/tty/serial/sunhv.c +++ b/drivers/tty/serial/sunhv.c | |||
@@ -433,13 +433,10 @@ static void sunhv_console_write_paged(struct console *con, const char *s, unsign | |||
433 | unsigned long flags; | 433 | unsigned long flags; |
434 | int locked = 1; | 434 | int locked = 1; |
435 | 435 | ||
436 | local_irq_save(flags); | 436 | if (port->sysrq || oops_in_progress) |
437 | if (port->sysrq) { | 437 | locked = spin_trylock_irqsave(&port->lock, flags); |
438 | locked = 0; | 438 | else |
439 | } else if (oops_in_progress) { | 439 | spin_lock_irqsave(&port->lock, flags); |
440 | locked = spin_trylock(&port->lock); | ||
441 | } else | ||
442 | spin_lock(&port->lock); | ||
443 | 440 | ||
444 | while (n > 0) { | 441 | while (n > 0) { |
445 | unsigned long ra = __pa(con_write_page); | 442 | unsigned long ra = __pa(con_write_page); |
@@ -470,8 +467,7 @@ static void sunhv_console_write_paged(struct console *con, const char *s, unsign | |||
470 | } | 467 | } |
471 | 468 | ||
472 | if (locked) | 469 | if (locked) |
473 | spin_unlock(&port->lock); | 470 | spin_unlock_irqrestore(&port->lock, flags); |
474 | local_irq_restore(flags); | ||
475 | } | 471 | } |
476 | 472 | ||
477 | static inline void sunhv_console_putchar(struct uart_port *port, char c) | 473 | static inline void sunhv_console_putchar(struct uart_port *port, char c) |
@@ -492,7 +488,10 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig | |||
492 | unsigned long flags; | 488 | unsigned long flags; |
493 | int i, locked = 1; | 489 | int i, locked = 1; |
494 | 490 | ||
495 | local_irq_save(flags); | 491 | if (port->sysrq || oops_in_progress) |
492 | locked = spin_trylock_irqsave(&port->lock, flags); | ||
493 | else | ||
494 | spin_lock_irqsave(&port->lock, flags); | ||
496 | if (port->sysrq) { | 495 | if (port->sysrq) { |
497 | locked = 0; | 496 | locked = 0; |
498 | } else if (oops_in_progress) { | 497 | } else if (oops_in_progress) { |
@@ -507,8 +506,7 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig | |||
507 | } | 506 | } |
508 | 507 | ||
509 | if (locked) | 508 | if (locked) |
510 | spin_unlock(&port->lock); | 509 | spin_unlock_irqrestore(&port->lock, flags); |
511 | local_irq_restore(flags); | ||
512 | } | 510 | } |
513 | 511 | ||
514 | static struct console sunhv_console = { | 512 | static struct console sunhv_console = { |
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index 380fb5355cb2..5faa8e905e98 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -844,20 +844,16 @@ static void sunsab_console_write(struct console *con, const char *s, unsigned n) | |||
844 | unsigned long flags; | 844 | unsigned long flags; |
845 | int locked = 1; | 845 | int locked = 1; |
846 | 846 | ||
847 | local_irq_save(flags); | 847 | if (up->port.sysrq || oops_in_progress) |
848 | if (up->port.sysrq) { | 848 | locked = spin_trylock_irqsave(&up->port.lock, flags); |
849 | locked = 0; | 849 | else |
850 | } else if (oops_in_progress) { | 850 | spin_lock_irqsave(&up->port.lock, flags); |
851 | locked = spin_trylock(&up->port.lock); | ||
852 | } else | ||
853 | spin_lock(&up->port.lock); | ||
854 | 851 | ||
855 | uart_console_write(&up->port, s, n, sunsab_console_putchar); | 852 | uart_console_write(&up->port, s, n, sunsab_console_putchar); |
856 | sunsab_tec_wait(up); | 853 | sunsab_tec_wait(up); |
857 | 854 | ||
858 | if (locked) | 855 | if (locked) |
859 | spin_unlock(&up->port.lock); | 856 | spin_unlock_irqrestore(&up->port.lock, flags); |
860 | local_irq_restore(flags); | ||
861 | } | 857 | } |
862 | 858 | ||
863 | static int sunsab_console_setup(struct console *con, char *options) | 859 | static int sunsab_console_setup(struct console *con, char *options) |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index db79b76f5c8e..9a0f24f83720 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -1295,13 +1295,10 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
1295 | unsigned int ier; | 1295 | unsigned int ier; |
1296 | int locked = 1; | 1296 | int locked = 1; |
1297 | 1297 | ||
1298 | local_irq_save(flags); | 1298 | if (up->port.sysrq || oops_in_progress) |
1299 | if (up->port.sysrq) { | 1299 | locked = spin_trylock_irqsave(&up->port.lock, flags); |
1300 | locked = 0; | 1300 | else |
1301 | } else if (oops_in_progress) { | 1301 | spin_lock_irqsave(&up->port.lock, flags); |
1302 | locked = spin_trylock(&up->port.lock); | ||
1303 | } else | ||
1304 | spin_lock(&up->port.lock); | ||
1305 | 1302 | ||
1306 | /* | 1303 | /* |
1307 | * First save the UER then disable the interrupts | 1304 | * First save the UER then disable the interrupts |
@@ -1319,8 +1316,7 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
1319 | serial_out(up, UART_IER, ier); | 1316 | serial_out(up, UART_IER, ier); |
1320 | 1317 | ||
1321 | if (locked) | 1318 | if (locked) |
1322 | spin_unlock(&up->port.lock); | 1319 | spin_unlock_irqrestore(&up->port.lock, flags); |
1323 | local_irq_restore(flags); | ||
1324 | } | 1320 | } |
1325 | 1321 | ||
1326 | /* | 1322 | /* |
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index 45a8c6aa5837..a2c40ed287d2 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -1195,20 +1195,16 @@ sunzilog_console_write(struct console *con, const char *s, unsigned int count) | |||
1195 | unsigned long flags; | 1195 | unsigned long flags; |
1196 | int locked = 1; | 1196 | int locked = 1; |
1197 | 1197 | ||
1198 | local_irq_save(flags); | 1198 | if (up->port.sysrq || oops_in_progress) |
1199 | if (up->port.sysrq) { | 1199 | locked = spin_trylock_irqsave(&up->port.lock, flags); |
1200 | locked = 0; | 1200 | else |
1201 | } else if (oops_in_progress) { | 1201 | spin_lock_irqsave(&up->port.lock, flags); |
1202 | locked = spin_trylock(&up->port.lock); | ||
1203 | } else | ||
1204 | spin_lock(&up->port.lock); | ||
1205 | 1202 | ||
1206 | uart_console_write(&up->port, s, count, sunzilog_putchar); | 1203 | uart_console_write(&up->port, s, count, sunzilog_putchar); |
1207 | udelay(2); | 1204 | udelay(2); |
1208 | 1205 | ||
1209 | if (locked) | 1206 | if (locked) |
1210 | spin_unlock(&up->port.lock); | 1207 | spin_unlock_irqrestore(&up->port.lock, flags); |
1211 | local_irq_restore(flags); | ||
1212 | } | 1208 | } |
1213 | 1209 | ||
1214 | static int __init sunzilog_console_setup(struct console *con, char *options) | 1210 | static int __init sunzilog_console_setup(struct console *con, char *options) |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 8d72f0c65937..062967c90b2a 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -717,6 +717,10 @@ int usb_get_configuration(struct usb_device *dev) | |||
717 | result = -ENOMEM; | 717 | result = -ENOMEM; |
718 | goto err; | 718 | goto err; |
719 | } | 719 | } |
720 | |||
721 | if (dev->quirks & USB_QUIRK_DELAY_INIT) | ||
722 | msleep(100); | ||
723 | |||
720 | result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, | 724 | result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, |
721 | bigbuffer, length); | 725 | bigbuffer, length); |
722 | if (result < 0) { | 726 | if (result < 0) { |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 8f37063c0a49..739ee8e8bdfd 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -47,6 +47,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
47 | /* Microsoft LifeCam-VX700 v2.0 */ | 47 | /* Microsoft LifeCam-VX700 v2.0 */ |
48 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, | 48 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, |
49 | 49 | ||
50 | /* Logitech HD Pro Webcams C920 and C930e */ | ||
51 | { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
52 | { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
53 | |||
50 | /* Logitech Quickcam Fusion */ | 54 | /* Logitech Quickcam Fusion */ |
51 | { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, | 55 | { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, |
52 | 56 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 471142725ffe..81cda09b47e3 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -685,8 +685,15 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
685 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 685 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
686 | u32 status, masked_status, pcd_status = 0, cmd; | 686 | u32 status, masked_status, pcd_status = 0, cmd; |
687 | int bh; | 687 | int bh; |
688 | unsigned long flags; | ||
688 | 689 | ||
689 | spin_lock (&ehci->lock); | 690 | /* |
691 | * For threadirqs option we use spin_lock_irqsave() variant to prevent | ||
692 | * deadlock with ehci hrtimer callback, because hrtimer callbacks run | ||
693 | * in interrupt context even when threadirqs is specified. We can go | ||
694 | * back to spin_lock() variant when hrtimer callbacks become threaded. | ||
695 | */ | ||
696 | spin_lock_irqsave(&ehci->lock, flags); | ||
690 | 697 | ||
691 | status = ehci_readl(ehci, &ehci->regs->status); | 698 | status = ehci_readl(ehci, &ehci->regs->status); |
692 | 699 | ||
@@ -704,7 +711,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
704 | 711 | ||
705 | /* Shared IRQ? */ | 712 | /* Shared IRQ? */ |
706 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | 713 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { |
707 | spin_unlock(&ehci->lock); | 714 | spin_unlock_irqrestore(&ehci->lock, flags); |
708 | return IRQ_NONE; | 715 | return IRQ_NONE; |
709 | } | 716 | } |
710 | 717 | ||
@@ -815,7 +822,7 @@ dead: | |||
815 | 822 | ||
816 | if (bh) | 823 | if (bh) |
817 | ehci_work (ehci); | 824 | ehci_work (ehci); |
818 | spin_unlock (&ehci->lock); | 825 | spin_unlock_irqrestore(&ehci->lock, flags); |
819 | if (pcd_status) | 826 | if (pcd_status) |
820 | usb_hcd_poll_rh_status(hcd); | 827 | usb_hcd_poll_rh_status(hcd); |
821 | return IRQ_HANDLED; | 828 | return IRQ_HANDLED; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6fe577d46fa2..924a6ccdb622 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -4733,6 +4733,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4733 | /* Accept arbitrarily long scatter-gather lists */ | 4733 | /* Accept arbitrarily long scatter-gather lists */ |
4734 | hcd->self.sg_tablesize = ~0; | 4734 | hcd->self.sg_tablesize = ~0; |
4735 | 4735 | ||
4736 | /* support to build packet from discontinuous buffers */ | ||
4737 | hcd->self.no_sg_constraint = 1; | ||
4738 | |||
4736 | /* XHCI controllers don't stop the ep queue on short packets :| */ | 4739 | /* XHCI controllers don't stop the ep queue on short packets :| */ |
4737 | hcd->self.no_stop_on_short = 1; | 4740 | hcd->self.no_stop_on_short = 1; |
4738 | 4741 | ||
@@ -4757,14 +4760,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4757 | /* xHCI private pointer was set in xhci_pci_probe for the second | 4760 | /* xHCI private pointer was set in xhci_pci_probe for the second |
4758 | * registered roothub. | 4761 | * registered roothub. |
4759 | */ | 4762 | */ |
4760 | xhci = hcd_to_xhci(hcd); | ||
4761 | /* | ||
4762 | * Support arbitrarily aligned sg-list entries on hosts without | ||
4763 | * TD fragment rules (which are currently unsupported). | ||
4764 | */ | ||
4765 | if (xhci->hci_version < 0x100) | ||
4766 | hcd->self.no_sg_constraint = 1; | ||
4767 | |||
4768 | return 0; | 4763 | return 0; |
4769 | } | 4764 | } |
4770 | 4765 | ||
@@ -4793,9 +4788,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4793 | if (xhci->hci_version > 0x96) | 4788 | if (xhci->hci_version > 0x96) |
4794 | xhci->quirks |= XHCI_SPURIOUS_SUCCESS; | 4789 | xhci->quirks |= XHCI_SPURIOUS_SUCCESS; |
4795 | 4790 | ||
4796 | if (xhci->hci_version < 0x100) | ||
4797 | hcd->self.no_sg_constraint = 1; | ||
4798 | |||
4799 | /* Make sure the HC is halted. */ | 4791 | /* Make sure the HC is halted. */ |
4800 | retval = xhci_halt(xhci); | 4792 | retval = xhci_halt(xhci); |
4801 | if (retval) | 4793 | if (retval) |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ee1f00f03c43..44ab12986805 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -907,6 +907,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
907 | /* Crucible Devices */ | 907 | /* Crucible Devices */ |
908 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, | 908 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, |
909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, | 909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, |
910 | /* Cressi Devices */ | ||
911 | { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, | ||
910 | { } /* Terminating entry */ | 912 | { } /* Terminating entry */ |
911 | }; | 913 | }; |
912 | 914 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 1e2d369df86e..e599fbfcde5f 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -1320,3 +1320,9 @@ | |||
1320 | * Manufacturer: Smart GSM Team | 1320 | * Manufacturer: Smart GSM Team |
1321 | */ | 1321 | */ |
1322 | #define FTDI_Z3X_PID 0x0011 | 1322 | #define FTDI_Z3X_PID 0x0011 |
1323 | |||
1324 | /* | ||
1325 | * Product: Cressi PC Interface | ||
1326 | * Manufacturer: Cressi | ||
1327 | */ | ||
1328 | #define FTDI_CRESSI_PID 0x87d0 | ||
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 4fb7a8f83c8a..54af4e933695 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c | |||
@@ -186,12 +186,12 @@ static bool is_invalid_reserved_pfn(unsigned long pfn) | |||
186 | if (pfn_valid(pfn)) { | 186 | if (pfn_valid(pfn)) { |
187 | bool reserved; | 187 | bool reserved; |
188 | struct page *tail = pfn_to_page(pfn); | 188 | struct page *tail = pfn_to_page(pfn); |
189 | struct page *head = compound_trans_head(tail); | 189 | struct page *head = compound_head(tail); |
190 | reserved = !!(PageReserved(head)); | 190 | reserved = !!(PageReserved(head)); |
191 | if (head != tail) { | 191 | if (head != tail) { |
192 | /* | 192 | /* |
193 | * "head" is not a dangling pointer | 193 | * "head" is not a dangling pointer |
194 | * (compound_trans_head takes care of that) | 194 | * (compound_head takes care of that) |
195 | * but the hugepage may have been split | 195 | * but the hugepage may have been split |
196 | * from under us (and we may not hold a | 196 | * from under us (and we may not hold a |
197 | * reference count on the head page so it can | 197 | * reference count on the head page so it can |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 0a025b8e2a12..e48d4a672580 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1001,6 +1001,12 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) | |||
1001 | break; | 1001 | break; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* virtio-scsi spec requires byte 0 of the lun to be 1 */ | ||
1005 | if (unlikely(v_req.lun[0] != 1)) { | ||
1006 | vhost_scsi_send_bad_target(vs, vq, head, out); | ||
1007 | continue; | ||
1008 | } | ||
1009 | |||
1004 | /* Extract the tpgt */ | 1010 | /* Extract the tpgt */ |
1005 | target = v_req.lun[1]; | 1011 | target = v_req.lun[1]; |
1006 | tpg = ACCESS_ONCE(vs_tpg[target]); | 1012 | tpg = ACCESS_ONCE(vs_tpg[target]); |
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index 0129b78a6908..4f70f383132c 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -458,11 +458,10 @@ static int bio_integrity_verify(struct bio *bio) | |||
458 | struct blk_integrity_exchg bix; | 458 | struct blk_integrity_exchg bix; |
459 | struct bio_vec *bv; | 459 | struct bio_vec *bv; |
460 | sector_t sector = bio->bi_integrity->bip_iter.bi_sector; | 460 | sector_t sector = bio->bi_integrity->bip_iter.bi_sector; |
461 | unsigned int sectors, total, ret; | 461 | unsigned int sectors, ret = 0; |
462 | void *prot_buf = bio->bi_integrity->bip_buf; | 462 | void *prot_buf = bio->bi_integrity->bip_buf; |
463 | int i; | 463 | int i; |
464 | 464 | ||
465 | ret = total = 0; | ||
466 | bix.disk_name = bio->bi_bdev->bd_disk->disk_name; | 465 | bix.disk_name = bio->bi_bdev->bd_disk->disk_name; |
467 | bix.sector_size = bi->sector_size; | 466 | bix.sector_size = bi->sector_size; |
468 | 467 | ||
@@ -484,8 +483,6 @@ static int bio_integrity_verify(struct bio *bio) | |||
484 | sectors = bv->bv_len / bi->sector_size; | 483 | sectors = bv->bv_len / bi->sector_size; |
485 | sector += sectors; | 484 | sector += sectors; |
486 | prot_buf += sectors * bi->tuple_size; | 485 | prot_buf += sectors * bi->tuple_size; |
487 | total += sectors * bi->tuple_size; | ||
488 | BUG_ON(total > bio->bi_integrity->bip_iter.bi_size); | ||
489 | 486 | ||
490 | kunmap_atomic(kaddr); | 487 | kunmap_atomic(kaddr); |
491 | } | 488 | } |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index cf32f0393369..c0f3718b77a8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -513,7 +513,7 @@ struct cifs_mnt_data { | |||
513 | static inline unsigned int | 513 | static inline unsigned int |
514 | get_rfc1002_length(void *buf) | 514 | get_rfc1002_length(void *buf) |
515 | { | 515 | { |
516 | return be32_to_cpu(*((__be32 *)buf)); | 516 | return be32_to_cpu(*((__be32 *)buf)) & 0xffffff; |
517 | } | 517 | } |
518 | 518 | ||
519 | static inline void | 519 | static inline void |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 53c15074bb36..834fce759d80 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2579,31 +2579,19 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2579 | struct cifsInodeInfo *cinode = CIFS_I(inode); | 2579 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
2580 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; | 2580 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; |
2581 | ssize_t rc = -EACCES; | 2581 | ssize_t rc = -EACCES; |
2582 | loff_t lock_pos = pos; | ||
2582 | 2583 | ||
2583 | BUG_ON(iocb->ki_pos != pos); | 2584 | if (file->f_flags & O_APPEND) |
2584 | 2585 | lock_pos = i_size_read(inode); | |
2585 | /* | 2586 | /* |
2586 | * We need to hold the sem to be sure nobody modifies lock list | 2587 | * We need to hold the sem to be sure nobody modifies lock list |
2587 | * with a brlock that prevents writing. | 2588 | * with a brlock that prevents writing. |
2588 | */ | 2589 | */ |
2589 | down_read(&cinode->lock_sem); | 2590 | down_read(&cinode->lock_sem); |
2590 | if (!cifs_find_lock_conflict(cfile, pos, iov_length(iov, nr_segs), | 2591 | if (!cifs_find_lock_conflict(cfile, lock_pos, iov_length(iov, nr_segs), |
2591 | server->vals->exclusive_lock_type, NULL, | 2592 | server->vals->exclusive_lock_type, NULL, |
2592 | CIFS_WRITE_OP)) { | 2593 | CIFS_WRITE_OP)) |
2593 | mutex_lock(&inode->i_mutex); | 2594 | rc = generic_file_aio_write(iocb, iov, nr_segs, pos); |
2594 | rc = __generic_file_aio_write(iocb, iov, nr_segs, | ||
2595 | &iocb->ki_pos); | ||
2596 | mutex_unlock(&inode->i_mutex); | ||
2597 | } | ||
2598 | |||
2599 | if (rc > 0) { | ||
2600 | ssize_t err; | ||
2601 | |||
2602 | err = generic_write_sync(file, iocb->ki_pos - rc, rc); | ||
2603 | if (err < 0) | ||
2604 | rc = err; | ||
2605 | } | ||
2606 | |||
2607 | up_read(&cinode->lock_sem); | 2595 | up_read(&cinode->lock_sem); |
2608 | return rc; | 2596 | return rc; |
2609 | } | 2597 | } |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index b37570952846..18cd5650a5fc 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -270,6 +270,26 @@ cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx, | |||
270 | iov->iov_len = rqst->rq_pagesz; | 270 | iov->iov_len = rqst->rq_pagesz; |
271 | } | 271 | } |
272 | 272 | ||
273 | static unsigned long | ||
274 | rqst_len(struct smb_rqst *rqst) | ||
275 | { | ||
276 | unsigned int i; | ||
277 | struct kvec *iov = rqst->rq_iov; | ||
278 | unsigned long buflen = 0; | ||
279 | |||
280 | /* total up iov array first */ | ||
281 | for (i = 0; i < rqst->rq_nvec; i++) | ||
282 | buflen += iov[i].iov_len; | ||
283 | |||
284 | /* add in the page array if there is one */ | ||
285 | if (rqst->rq_npages) { | ||
286 | buflen += rqst->rq_pagesz * (rqst->rq_npages - 1); | ||
287 | buflen += rqst->rq_tailsz; | ||
288 | } | ||
289 | |||
290 | return buflen; | ||
291 | } | ||
292 | |||
273 | static int | 293 | static int |
274 | smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) | 294 | smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) |
275 | { | 295 | { |
@@ -277,6 +297,7 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) | |||
277 | struct kvec *iov = rqst->rq_iov; | 297 | struct kvec *iov = rqst->rq_iov; |
278 | int n_vec = rqst->rq_nvec; | 298 | int n_vec = rqst->rq_nvec; |
279 | unsigned int smb_buf_length = get_rfc1002_length(iov[0].iov_base); | 299 | unsigned int smb_buf_length = get_rfc1002_length(iov[0].iov_base); |
300 | unsigned long send_length; | ||
280 | unsigned int i; | 301 | unsigned int i; |
281 | size_t total_len = 0, sent; | 302 | size_t total_len = 0, sent; |
282 | struct socket *ssocket = server->ssocket; | 303 | struct socket *ssocket = server->ssocket; |
@@ -285,6 +306,14 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) | |||
285 | if (ssocket == NULL) | 306 | if (ssocket == NULL) |
286 | return -ENOTSOCK; | 307 | return -ENOTSOCK; |
287 | 308 | ||
309 | /* sanity check send length */ | ||
310 | send_length = rqst_len(rqst); | ||
311 | if (send_length != smb_buf_length + 4) { | ||
312 | WARN(1, "Send length mismatch(send_length=%lu smb_buf_length=%u)\n", | ||
313 | send_length, smb_buf_length); | ||
314 | return -EIO; | ||
315 | } | ||
316 | |||
288 | cifs_dbg(FYI, "Sending smb: smb_len=%u\n", smb_buf_length); | 317 | cifs_dbg(FYI, "Sending smb: smb_len=%u\n", smb_buf_length); |
289 | dump_smb(iov[0].iov_base, iov[0].iov_len); | 318 | dump_smb(iov[0].iov_base, iov[0].iov_len); |
290 | 319 | ||
@@ -683,35 +683,65 @@ EXPORT_SYMBOL(fget_raw); | |||
683 | * The fput_needed flag returned by fget_light should be passed to the | 683 | * The fput_needed flag returned by fget_light should be passed to the |
684 | * corresponding fput_light. | 684 | * corresponding fput_light. |
685 | */ | 685 | */ |
686 | struct file *__fget_light(unsigned int fd, fmode_t mask, int *fput_needed) | 686 | static unsigned long __fget_light(unsigned int fd, fmode_t mask) |
687 | { | 687 | { |
688 | struct files_struct *files = current->files; | 688 | struct files_struct *files = current->files; |
689 | struct file *file; | 689 | struct file *file; |
690 | 690 | ||
691 | *fput_needed = 0; | ||
692 | if (atomic_read(&files->count) == 1) { | 691 | if (atomic_read(&files->count) == 1) { |
693 | file = __fcheck_files(files, fd); | 692 | file = __fcheck_files(files, fd); |
694 | if (file && (file->f_mode & mask)) | 693 | if (!file || unlikely(file->f_mode & mask)) |
695 | file = NULL; | 694 | return 0; |
695 | return (unsigned long)file; | ||
696 | } else { | 696 | } else { |
697 | file = __fget(fd, mask); | 697 | file = __fget(fd, mask); |
698 | if (file) | 698 | if (!file) |
699 | *fput_needed = 1; | 699 | return 0; |
700 | return FDPUT_FPUT | (unsigned long)file; | ||
700 | } | 701 | } |
701 | |||
702 | return file; | ||
703 | } | 702 | } |
704 | struct file *fget_light(unsigned int fd, int *fput_needed) | 703 | unsigned long __fdget(unsigned int fd) |
705 | { | 704 | { |
706 | return __fget_light(fd, FMODE_PATH, fput_needed); | 705 | return __fget_light(fd, FMODE_PATH); |
707 | } | 706 | } |
708 | EXPORT_SYMBOL(fget_light); | 707 | EXPORT_SYMBOL(__fdget); |
709 | 708 | ||
710 | struct file *fget_raw_light(unsigned int fd, int *fput_needed) | 709 | unsigned long __fdget_raw(unsigned int fd) |
711 | { | 710 | { |
712 | return __fget_light(fd, 0, fput_needed); | 711 | return __fget_light(fd, 0); |
712 | } | ||
713 | |||
714 | unsigned long __fdget_pos(unsigned int fd) | ||
715 | { | ||
716 | struct files_struct *files = current->files; | ||
717 | struct file *file; | ||
718 | unsigned long v; | ||
719 | |||
720 | if (atomic_read(&files->count) == 1) { | ||
721 | file = __fcheck_files(files, fd); | ||
722 | v = 0; | ||
723 | } else { | ||
724 | file = __fget(fd, 0); | ||
725 | v = FDPUT_FPUT; | ||
726 | } | ||
727 | if (!file) | ||
728 | return 0; | ||
729 | |||
730 | if (file->f_mode & FMODE_ATOMIC_POS) { | ||
731 | if (file_count(file) > 1) { | ||
732 | v |= FDPUT_POS_UNLOCK; | ||
733 | mutex_lock(&file->f_pos_lock); | ||
734 | } | ||
735 | } | ||
736 | return v | (unsigned long)file; | ||
713 | } | 737 | } |
714 | 738 | ||
739 | /* | ||
740 | * We only lock f_pos if we have threads or if the file might be | ||
741 | * shared with another process. In both cases we'll have an elevated | ||
742 | * file count (done either by fdget() or by fork()). | ||
743 | */ | ||
744 | |||
715 | void set_close_on_exec(unsigned int fd, int flag) | 745 | void set_close_on_exec(unsigned int fd, int flag) |
716 | { | 746 | { |
717 | struct files_struct *files = current->files; | 747 | struct files_struct *files = current->files; |
diff --git a/fs/file_table.c b/fs/file_table.c index 5fff9030be34..5b24008ea4f6 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -135,6 +135,7 @@ struct file *get_empty_filp(void) | |||
135 | atomic_long_set(&f->f_count, 1); | 135 | atomic_long_set(&f->f_count, 1); |
136 | rwlock_init(&f->f_owner.lock); | 136 | rwlock_init(&f->f_owner.lock); |
137 | spin_lock_init(&f->f_lock); | 137 | spin_lock_init(&f->f_lock); |
138 | mutex_init(&f->f_pos_lock); | ||
138 | eventpoll_init_file(f); | 139 | eventpoll_init_file(f); |
139 | /* f->f_version: 0 */ | 140 | /* f->f_version: 0 */ |
140 | return f; | 141 | return f; |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index e0259a163f98..d754e3cf99a8 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -40,18 +40,13 @@ | |||
40 | struct wb_writeback_work { | 40 | struct wb_writeback_work { |
41 | long nr_pages; | 41 | long nr_pages; |
42 | struct super_block *sb; | 42 | struct super_block *sb; |
43 | /* | 43 | unsigned long *older_than_this; |
44 | * Write only inodes dirtied before this time. Don't forget to set | ||
45 | * older_than_this_is_set when you set this. | ||
46 | */ | ||
47 | unsigned long older_than_this; | ||
48 | enum writeback_sync_modes sync_mode; | 44 | enum writeback_sync_modes sync_mode; |
49 | unsigned int tagged_writepages:1; | 45 | unsigned int tagged_writepages:1; |
50 | unsigned int for_kupdate:1; | 46 | unsigned int for_kupdate:1; |
51 | unsigned int range_cyclic:1; | 47 | unsigned int range_cyclic:1; |
52 | unsigned int for_background:1; | 48 | unsigned int for_background:1; |
53 | unsigned int for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ | 49 | unsigned int for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ |
54 | unsigned int older_than_this_is_set:1; | ||
55 | enum wb_reason reason; /* why was writeback initiated? */ | 50 | enum wb_reason reason; /* why was writeback initiated? */ |
56 | 51 | ||
57 | struct list_head list; /* pending work list */ | 52 | struct list_head list; /* pending work list */ |
@@ -252,10 +247,10 @@ static int move_expired_inodes(struct list_head *delaying_queue, | |||
252 | int do_sb_sort = 0; | 247 | int do_sb_sort = 0; |
253 | int moved = 0; | 248 | int moved = 0; |
254 | 249 | ||
255 | WARN_ON_ONCE(!work->older_than_this_is_set); | ||
256 | while (!list_empty(delaying_queue)) { | 250 | while (!list_empty(delaying_queue)) { |
257 | inode = wb_inode(delaying_queue->prev); | 251 | inode = wb_inode(delaying_queue->prev); |
258 | if (inode_dirtied_after(inode, work->older_than_this)) | 252 | if (work->older_than_this && |
253 | inode_dirtied_after(inode, *work->older_than_this)) | ||
259 | break; | 254 | break; |
260 | list_move(&inode->i_wb_list, &tmp); | 255 | list_move(&inode->i_wb_list, &tmp); |
261 | moved++; | 256 | moved++; |
@@ -742,8 +737,6 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, | |||
742 | .sync_mode = WB_SYNC_NONE, | 737 | .sync_mode = WB_SYNC_NONE, |
743 | .range_cyclic = 1, | 738 | .range_cyclic = 1, |
744 | .reason = reason, | 739 | .reason = reason, |
745 | .older_than_this = jiffies, | ||
746 | .older_than_this_is_set = 1, | ||
747 | }; | 740 | }; |
748 | 741 | ||
749 | spin_lock(&wb->list_lock); | 742 | spin_lock(&wb->list_lock); |
@@ -802,13 +795,12 @@ static long wb_writeback(struct bdi_writeback *wb, | |||
802 | { | 795 | { |
803 | unsigned long wb_start = jiffies; | 796 | unsigned long wb_start = jiffies; |
804 | long nr_pages = work->nr_pages; | 797 | long nr_pages = work->nr_pages; |
798 | unsigned long oldest_jif; | ||
805 | struct inode *inode; | 799 | struct inode *inode; |
806 | long progress; | 800 | long progress; |
807 | 801 | ||
808 | if (!work->older_than_this_is_set) { | 802 | oldest_jif = jiffies; |
809 | work->older_than_this = jiffies; | 803 | work->older_than_this = &oldest_jif; |
810 | work->older_than_this_is_set = 1; | ||
811 | } | ||
812 | 804 | ||
813 | spin_lock(&wb->list_lock); | 805 | spin_lock(&wb->list_lock); |
814 | for (;;) { | 806 | for (;;) { |
@@ -842,10 +834,10 @@ static long wb_writeback(struct bdi_writeback *wb, | |||
842 | * safe. | 834 | * safe. |
843 | */ | 835 | */ |
844 | if (work->for_kupdate) { | 836 | if (work->for_kupdate) { |
845 | work->older_than_this = jiffies - | 837 | oldest_jif = jiffies - |
846 | msecs_to_jiffies(dirty_expire_interval * 10); | 838 | msecs_to_jiffies(dirty_expire_interval * 10); |
847 | } else if (work->for_background) | 839 | } else if (work->for_background) |
848 | work->older_than_this = jiffies; | 840 | oldest_jif = jiffies; |
849 | 841 | ||
850 | trace_writeback_start(wb->bdi, work); | 842 | trace_writeback_start(wb->bdi, work); |
851 | if (list_empty(&wb->b_io)) | 843 | if (list_empty(&wb->b_io)) |
@@ -1357,21 +1349,18 @@ EXPORT_SYMBOL(try_to_writeback_inodes_sb); | |||
1357 | 1349 | ||
1358 | /** | 1350 | /** |
1359 | * sync_inodes_sb - sync sb inode pages | 1351 | * sync_inodes_sb - sync sb inode pages |
1360 | * @sb: the superblock | 1352 | * @sb: the superblock |
1361 | * @older_than_this: timestamp | ||
1362 | * | 1353 | * |
1363 | * This function writes and waits on any dirty inode belonging to this | 1354 | * This function writes and waits on any dirty inode belonging to this |
1364 | * superblock that has been dirtied before given timestamp. | 1355 | * super_block. |
1365 | */ | 1356 | */ |
1366 | void sync_inodes_sb(struct super_block *sb, unsigned long older_than_this) | 1357 | void sync_inodes_sb(struct super_block *sb) |
1367 | { | 1358 | { |
1368 | DECLARE_COMPLETION_ONSTACK(done); | 1359 | DECLARE_COMPLETION_ONSTACK(done); |
1369 | struct wb_writeback_work work = { | 1360 | struct wb_writeback_work work = { |
1370 | .sb = sb, | 1361 | .sb = sb, |
1371 | .sync_mode = WB_SYNC_ALL, | 1362 | .sync_mode = WB_SYNC_ALL, |
1372 | .nr_pages = LONG_MAX, | 1363 | .nr_pages = LONG_MAX, |
1373 | .older_than_this = older_than_this, | ||
1374 | .older_than_this_is_set = 1, | ||
1375 | .range_cyclic = 0, | 1364 | .range_cyclic = 0, |
1376 | .done = &done, | 1365 | .done = &done, |
1377 | .reason = WB_REASON_SYNC, | 1366 | .reason = WB_REASON_SYNC, |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index 968ce411db53..32602c667b4a 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
@@ -103,6 +103,8 @@ static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, | |||
103 | folder = &entry->folder; | 103 | folder = &entry->folder; |
104 | memset(folder, 0, sizeof(*folder)); | 104 | memset(folder, 0, sizeof(*folder)); |
105 | folder->type = cpu_to_be16(HFSPLUS_FOLDER); | 105 | folder->type = cpu_to_be16(HFSPLUS_FOLDER); |
106 | if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) | ||
107 | folder->flags |= cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT); | ||
106 | folder->id = cpu_to_be32(inode->i_ino); | 108 | folder->id = cpu_to_be32(inode->i_ino); |
107 | HFSPLUS_I(inode)->create_date = | 109 | HFSPLUS_I(inode)->create_date = |
108 | folder->create_date = | 110 | folder->create_date = |
@@ -203,6 +205,36 @@ int hfsplus_find_cat(struct super_block *sb, u32 cnid, | |||
203 | return hfs_brec_find(fd, hfs_find_rec_by_key); | 205 | return hfs_brec_find(fd, hfs_find_rec_by_key); |
204 | } | 206 | } |
205 | 207 | ||
208 | static void hfsplus_subfolders_inc(struct inode *dir) | ||
209 | { | ||
210 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | ||
211 | |||
212 | if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) { | ||
213 | /* | ||
214 | * Increment subfolder count. Note, the value is only meaningful | ||
215 | * for folders with HFSPLUS_HAS_FOLDER_COUNT flag set. | ||
216 | */ | ||
217 | HFSPLUS_I(dir)->subfolders++; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | static void hfsplus_subfolders_dec(struct inode *dir) | ||
222 | { | ||
223 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | ||
224 | |||
225 | if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) { | ||
226 | /* | ||
227 | * Decrement subfolder count. Note, the value is only meaningful | ||
228 | * for folders with HFSPLUS_HAS_FOLDER_COUNT flag set. | ||
229 | * | ||
230 | * Check for zero. Some subfolders may have been created | ||
231 | * by an implementation ignorant of this counter. | ||
232 | */ | ||
233 | if (HFSPLUS_I(dir)->subfolders) | ||
234 | HFSPLUS_I(dir)->subfolders--; | ||
235 | } | ||
236 | } | ||
237 | |||
206 | int hfsplus_create_cat(u32 cnid, struct inode *dir, | 238 | int hfsplus_create_cat(u32 cnid, struct inode *dir, |
207 | struct qstr *str, struct inode *inode) | 239 | struct qstr *str, struct inode *inode) |
208 | { | 240 | { |
@@ -247,6 +279,8 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir, | |||
247 | goto err1; | 279 | goto err1; |
248 | 280 | ||
249 | dir->i_size++; | 281 | dir->i_size++; |
282 | if (S_ISDIR(inode->i_mode)) | ||
283 | hfsplus_subfolders_inc(dir); | ||
250 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; | 284 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; |
251 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); | 285 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); |
252 | 286 | ||
@@ -336,6 +370,8 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str) | |||
336 | goto out; | 370 | goto out; |
337 | 371 | ||
338 | dir->i_size--; | 372 | dir->i_size--; |
373 | if (type == HFSPLUS_FOLDER) | ||
374 | hfsplus_subfolders_dec(dir); | ||
339 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; | 375 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; |
340 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); | 376 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); |
341 | 377 | ||
@@ -380,6 +416,7 @@ int hfsplus_rename_cat(u32 cnid, | |||
380 | 416 | ||
381 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, | 417 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, |
382 | src_fd.entrylength); | 418 | src_fd.entrylength); |
419 | type = be16_to_cpu(entry.type); | ||
383 | 420 | ||
384 | /* create new dir entry with the data from the old entry */ | 421 | /* create new dir entry with the data from the old entry */ |
385 | hfsplus_cat_build_key(sb, dst_fd.search_key, dst_dir->i_ino, dst_name); | 422 | hfsplus_cat_build_key(sb, dst_fd.search_key, dst_dir->i_ino, dst_name); |
@@ -394,6 +431,8 @@ int hfsplus_rename_cat(u32 cnid, | |||
394 | if (err) | 431 | if (err) |
395 | goto out; | 432 | goto out; |
396 | dst_dir->i_size++; | 433 | dst_dir->i_size++; |
434 | if (type == HFSPLUS_FOLDER) | ||
435 | hfsplus_subfolders_inc(dst_dir); | ||
397 | dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC; | 436 | dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC; |
398 | 437 | ||
399 | /* finally remove the old entry */ | 438 | /* finally remove the old entry */ |
@@ -405,6 +444,8 @@ int hfsplus_rename_cat(u32 cnid, | |||
405 | if (err) | 444 | if (err) |
406 | goto out; | 445 | goto out; |
407 | src_dir->i_size--; | 446 | src_dir->i_size--; |
447 | if (type == HFSPLUS_FOLDER) | ||
448 | hfsplus_subfolders_dec(src_dir); | ||
408 | src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC; | 449 | src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC; |
409 | 450 | ||
410 | /* remove old thread entry */ | 451 | /* remove old thread entry */ |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 08846425b67f..62d571eb69ba 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -242,6 +242,7 @@ struct hfsplus_inode_info { | |||
242 | */ | 242 | */ |
243 | sector_t fs_blocks; | 243 | sector_t fs_blocks; |
244 | u8 userflags; /* BSD user file flags */ | 244 | u8 userflags; /* BSD user file flags */ |
245 | u32 subfolders; /* Subfolder count (HFSX only) */ | ||
245 | struct list_head open_dir_list; | 246 | struct list_head open_dir_list; |
246 | loff_t phys_size; | 247 | loff_t phys_size; |
247 | 248 | ||
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h index 8ffb3a8ffe75..5a126828d85e 100644 --- a/fs/hfsplus/hfsplus_raw.h +++ b/fs/hfsplus/hfsplus_raw.h | |||
@@ -261,7 +261,7 @@ struct hfsplus_cat_folder { | |||
261 | struct DInfo user_info; | 261 | struct DInfo user_info; |
262 | struct DXInfo finder_info; | 262 | struct DXInfo finder_info; |
263 | __be32 text_encoding; | 263 | __be32 text_encoding; |
264 | u32 reserved; | 264 | __be32 subfolders; /* Subfolder count in HFSX. Reserved in HFS+. */ |
265 | } __packed; | 265 | } __packed; |
266 | 266 | ||
267 | /* HFS file info (stolen from hfs.h) */ | 267 | /* HFS file info (stolen from hfs.h) */ |
@@ -301,11 +301,13 @@ struct hfsplus_cat_file { | |||
301 | struct hfsplus_fork_raw rsrc_fork; | 301 | struct hfsplus_fork_raw rsrc_fork; |
302 | } __packed; | 302 | } __packed; |
303 | 303 | ||
304 | /* File attribute bits */ | 304 | /* File and folder flag bits */ |
305 | #define HFSPLUS_FILE_LOCKED 0x0001 | 305 | #define HFSPLUS_FILE_LOCKED 0x0001 |
306 | #define HFSPLUS_FILE_THREAD_EXISTS 0x0002 | 306 | #define HFSPLUS_FILE_THREAD_EXISTS 0x0002 |
307 | #define HFSPLUS_XATTR_EXISTS 0x0004 | 307 | #define HFSPLUS_XATTR_EXISTS 0x0004 |
308 | #define HFSPLUS_ACL_EXISTS 0x0008 | 308 | #define HFSPLUS_ACL_EXISTS 0x0008 |
309 | #define HFSPLUS_HAS_FOLDER_COUNT 0x0010 /* Folder has subfolder count | ||
310 | * (HFSX only) */ | ||
309 | 311 | ||
310 | /* HFS+ catalog thread (part of a cat_entry) */ | 312 | /* HFS+ catalog thread (part of a cat_entry) */ |
311 | struct hfsplus_cat_thread { | 313 | struct hfsplus_cat_thread { |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index fa929f325f87..a4f45bd88a63 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -375,6 +375,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode) | |||
375 | hip->extent_state = 0; | 375 | hip->extent_state = 0; |
376 | hip->flags = 0; | 376 | hip->flags = 0; |
377 | hip->userflags = 0; | 377 | hip->userflags = 0; |
378 | hip->subfolders = 0; | ||
378 | memset(hip->first_extents, 0, sizeof(hfsplus_extent_rec)); | 379 | memset(hip->first_extents, 0, sizeof(hfsplus_extent_rec)); |
379 | memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); | 380 | memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); |
380 | hip->alloc_blocks = 0; | 381 | hip->alloc_blocks = 0; |
@@ -494,6 +495,10 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd) | |||
494 | inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date); | 495 | inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date); |
495 | HFSPLUS_I(inode)->create_date = folder->create_date; | 496 | HFSPLUS_I(inode)->create_date = folder->create_date; |
496 | HFSPLUS_I(inode)->fs_blocks = 0; | 497 | HFSPLUS_I(inode)->fs_blocks = 0; |
498 | if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { | ||
499 | HFSPLUS_I(inode)->subfolders = | ||
500 | be32_to_cpu(folder->subfolders); | ||
501 | } | ||
497 | inode->i_op = &hfsplus_dir_inode_operations; | 502 | inode->i_op = &hfsplus_dir_inode_operations; |
498 | inode->i_fop = &hfsplus_dir_operations; | 503 | inode->i_fop = &hfsplus_dir_operations; |
499 | } else if (type == HFSPLUS_FILE) { | 504 | } else if (type == HFSPLUS_FILE) { |
@@ -566,6 +571,10 @@ int hfsplus_cat_write_inode(struct inode *inode) | |||
566 | folder->content_mod_date = hfsp_ut2mt(inode->i_mtime); | 571 | folder->content_mod_date = hfsp_ut2mt(inode->i_mtime); |
567 | folder->attribute_mod_date = hfsp_ut2mt(inode->i_ctime); | 572 | folder->attribute_mod_date = hfsp_ut2mt(inode->i_ctime); |
568 | folder->valence = cpu_to_be32(inode->i_size - 2); | 573 | folder->valence = cpu_to_be32(inode->i_size - 2); |
574 | if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { | ||
575 | folder->subfolders = | ||
576 | cpu_to_be32(HFSPLUS_I(inode)->subfolders); | ||
577 | } | ||
569 | hfs_bnode_write(fd.bnode, &entry, fd.entryoffset, | 578 | hfs_bnode_write(fd.bnode, &entry, fd.entryoffset, |
570 | sizeof(struct hfsplus_cat_folder)); | 579 | sizeof(struct hfsplus_cat_folder)); |
571 | } else if (HFSPLUS_IS_RSRC(inode)) { | 580 | } else if (HFSPLUS_IS_RSRC(inode)) { |
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 968eab5bc1f5..68537e8b7a09 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c | |||
@@ -75,7 +75,7 @@ int hfsplus_parse_options_remount(char *input, int *force) | |||
75 | int token; | 75 | int token; |
76 | 76 | ||
77 | if (!input) | 77 | if (!input) |
78 | return 0; | 78 | return 1; |
79 | 79 | ||
80 | while ((p = strsep(&input, ",")) != NULL) { | 80 | while ((p = strsep(&input, ",")) != NULL) { |
81 | if (!*p) | 81 | if (!*p) |
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 0d6ce895a9ee..0f4152defe7b 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c | |||
@@ -94,6 +94,7 @@ const void *kernfs_super_ns(struct super_block *sb) | |||
94 | * @fs_type: file_system_type of the fs being mounted | 94 | * @fs_type: file_system_type of the fs being mounted |
95 | * @flags: mount flags specified for the mount | 95 | * @flags: mount flags specified for the mount |
96 | * @root: kernfs_root of the hierarchy being mounted | 96 | * @root: kernfs_root of the hierarchy being mounted |
97 | * @new_sb_created: tell the caller if we allocated a new superblock | ||
97 | * @ns: optional namespace tag of the mount | 98 | * @ns: optional namespace tag of the mount |
98 | * | 99 | * |
99 | * This is to be called from each kernfs user's file_system_type->mount() | 100 | * This is to be called from each kernfs user's file_system_type->mount() |
@@ -104,7 +105,8 @@ const void *kernfs_super_ns(struct super_block *sb) | |||
104 | * The return value can be passed to the vfs layer verbatim. | 105 | * The return value can be passed to the vfs layer verbatim. |
105 | */ | 106 | */ |
106 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | 107 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
107 | struct kernfs_root *root, const void *ns) | 108 | struct kernfs_root *root, bool *new_sb_created, |
109 | const void *ns) | ||
108 | { | 110 | { |
109 | struct super_block *sb; | 111 | struct super_block *sb; |
110 | struct kernfs_super_info *info; | 112 | struct kernfs_super_info *info; |
@@ -122,6 +124,10 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | |||
122 | kfree(info); | 124 | kfree(info); |
123 | if (IS_ERR(sb)) | 125 | if (IS_ERR(sb)) |
124 | return ERR_CAST(sb); | 126 | return ERR_CAST(sb); |
127 | |||
128 | if (new_sb_created) | ||
129 | *new_sb_created = !sb->s_root; | ||
130 | |||
125 | if (!sb->s_root) { | 131 | if (!sb->s_root) { |
126 | error = kernfs_fill_super(sb); | 132 | error = kernfs_fill_super(sb); |
127 | if (error) { | 133 | if (error) { |
diff --git a/fs/namei.c b/fs/namei.c index 385f7817bfcc..2f730ef9b4b3 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1884,7 +1884,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, | |||
1884 | 1884 | ||
1885 | nd->path = f.file->f_path; | 1885 | nd->path = f.file->f_path; |
1886 | if (flags & LOOKUP_RCU) { | 1886 | if (flags & LOOKUP_RCU) { |
1887 | if (f.need_put) | 1887 | if (f.flags & FDPUT_FPUT) |
1888 | *fp = f.file; | 1888 | *fp = f.file; |
1889 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); | 1889 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); |
1890 | rcu_read_lock(); | 1890 | rcu_read_lock(); |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index ef792f29f831..5d8ccecf5f5c 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -659,16 +659,19 @@ int nfs_async_inode_return_delegation(struct inode *inode, | |||
659 | 659 | ||
660 | rcu_read_lock(); | 660 | rcu_read_lock(); |
661 | delegation = rcu_dereference(NFS_I(inode)->delegation); | 661 | delegation = rcu_dereference(NFS_I(inode)->delegation); |
662 | if (delegation == NULL) | ||
663 | goto out_enoent; | ||
662 | 664 | ||
663 | if (!clp->cl_mvops->match_stateid(&delegation->stateid, stateid)) { | 665 | if (!clp->cl_mvops->match_stateid(&delegation->stateid, stateid)) |
664 | rcu_read_unlock(); | 666 | goto out_enoent; |
665 | return -ENOENT; | ||
666 | } | ||
667 | nfs_mark_return_delegation(server, delegation); | 667 | nfs_mark_return_delegation(server, delegation); |
668 | rcu_read_unlock(); | 668 | rcu_read_unlock(); |
669 | 669 | ||
670 | nfs_delegation_run_state_manager(clp); | 670 | nfs_delegation_run_state_manager(clp); |
671 | return 0; | 671 | return 0; |
672 | out_enoent: | ||
673 | rcu_read_unlock(); | ||
674 | return -ENOENT; | ||
672 | } | 675 | } |
673 | 676 | ||
674 | static struct inode * | 677 | static struct inode * |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 12c8132ad408..b9a35c05b60f 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -324,8 +324,9 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data) | |||
324 | &rdata->res.seq_res, | 324 | &rdata->res.seq_res, |
325 | task)) | 325 | task)) |
326 | return; | 326 | return; |
327 | nfs4_set_rw_stateid(&rdata->args.stateid, rdata->args.context, | 327 | if (nfs4_set_rw_stateid(&rdata->args.stateid, rdata->args.context, |
328 | rdata->args.lock_context, FMODE_READ); | 328 | rdata->args.lock_context, FMODE_READ) == -EIO) |
329 | rpc_exit(task, -EIO); /* lost lock, terminate I/O */ | ||
329 | } | 330 | } |
330 | 331 | ||
331 | static void filelayout_read_call_done(struct rpc_task *task, void *data) | 332 | static void filelayout_read_call_done(struct rpc_task *task, void *data) |
@@ -435,8 +436,9 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data) | |||
435 | &wdata->res.seq_res, | 436 | &wdata->res.seq_res, |
436 | task)) | 437 | task)) |
437 | return; | 438 | return; |
438 | nfs4_set_rw_stateid(&wdata->args.stateid, wdata->args.context, | 439 | if (nfs4_set_rw_stateid(&wdata->args.stateid, wdata->args.context, |
439 | wdata->args.lock_context, FMODE_WRITE); | 440 | wdata->args.lock_context, FMODE_WRITE) == -EIO) |
441 | rpc_exit(task, -EIO); /* lost lock, terminate I/O */ | ||
440 | } | 442 | } |
441 | 443 | ||
442 | static void filelayout_write_call_done(struct rpc_task *task, void *data) | 444 | static void filelayout_write_call_done(struct rpc_task *task, void *data) |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 2da6a698b8f7..450bfedbe2f4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2398,13 +2398,16 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, | |||
2398 | 2398 | ||
2399 | if (nfs4_copy_delegation_stateid(&arg.stateid, inode, fmode)) { | 2399 | if (nfs4_copy_delegation_stateid(&arg.stateid, inode, fmode)) { |
2400 | /* Use that stateid */ | 2400 | /* Use that stateid */ |
2401 | } else if (truncate && state != NULL && nfs4_valid_open_stateid(state)) { | 2401 | } else if (truncate && state != NULL) { |
2402 | struct nfs_lockowner lockowner = { | 2402 | struct nfs_lockowner lockowner = { |
2403 | .l_owner = current->files, | 2403 | .l_owner = current->files, |
2404 | .l_pid = current->tgid, | 2404 | .l_pid = current->tgid, |
2405 | }; | 2405 | }; |
2406 | nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE, | 2406 | if (!nfs4_valid_open_stateid(state)) |
2407 | &lockowner); | 2407 | return -EBADF; |
2408 | if (nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE, | ||
2409 | &lockowner) == -EIO) | ||
2410 | return -EBADF; | ||
2408 | } else | 2411 | } else |
2409 | nfs4_stateid_copy(&arg.stateid, &zero_stateid); | 2412 | nfs4_stateid_copy(&arg.stateid, &zero_stateid); |
2410 | 2413 | ||
@@ -4011,8 +4014,9 @@ static bool nfs4_stateid_is_current(nfs4_stateid *stateid, | |||
4011 | { | 4014 | { |
4012 | nfs4_stateid current_stateid; | 4015 | nfs4_stateid current_stateid; |
4013 | 4016 | ||
4014 | if (nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode)) | 4017 | /* If the current stateid represents a lost lock, then exit */ |
4015 | return false; | 4018 | if (nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode) == -EIO) |
4019 | return true; | ||
4016 | return nfs4_stateid_match(stateid, ¤t_stateid); | 4020 | return nfs4_stateid_match(stateid, ¤t_stateid); |
4017 | } | 4021 | } |
4018 | 4022 | ||
@@ -5828,8 +5832,7 @@ struct nfs_release_lockowner_data { | |||
5828 | struct nfs4_lock_state *lsp; | 5832 | struct nfs4_lock_state *lsp; |
5829 | struct nfs_server *server; | 5833 | struct nfs_server *server; |
5830 | struct nfs_release_lockowner_args args; | 5834 | struct nfs_release_lockowner_args args; |
5831 | struct nfs4_sequence_args seq_args; | 5835 | struct nfs_release_lockowner_res res; |
5832 | struct nfs4_sequence_res seq_res; | ||
5833 | unsigned long timestamp; | 5836 | unsigned long timestamp; |
5834 | }; | 5837 | }; |
5835 | 5838 | ||
@@ -5837,7 +5840,7 @@ static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata | |||
5837 | { | 5840 | { |
5838 | struct nfs_release_lockowner_data *data = calldata; | 5841 | struct nfs_release_lockowner_data *data = calldata; |
5839 | nfs40_setup_sequence(data->server, | 5842 | nfs40_setup_sequence(data->server, |
5840 | &data->seq_args, &data->seq_res, task); | 5843 | &data->args.seq_args, &data->res.seq_res, task); |
5841 | data->timestamp = jiffies; | 5844 | data->timestamp = jiffies; |
5842 | } | 5845 | } |
5843 | 5846 | ||
@@ -5846,7 +5849,7 @@ static void nfs4_release_lockowner_done(struct rpc_task *task, void *calldata) | |||
5846 | struct nfs_release_lockowner_data *data = calldata; | 5849 | struct nfs_release_lockowner_data *data = calldata; |
5847 | struct nfs_server *server = data->server; | 5850 | struct nfs_server *server = data->server; |
5848 | 5851 | ||
5849 | nfs40_sequence_done(task, &data->seq_res); | 5852 | nfs40_sequence_done(task, &data->res.seq_res); |
5850 | 5853 | ||
5851 | switch (task->tk_status) { | 5854 | switch (task->tk_status) { |
5852 | case 0: | 5855 | case 0: |
@@ -5887,7 +5890,6 @@ static int nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_st | |||
5887 | data = kmalloc(sizeof(*data), GFP_NOFS); | 5890 | data = kmalloc(sizeof(*data), GFP_NOFS); |
5888 | if (!data) | 5891 | if (!data) |
5889 | return -ENOMEM; | 5892 | return -ENOMEM; |
5890 | nfs4_init_sequence(&data->seq_args, &data->seq_res, 0); | ||
5891 | data->lsp = lsp; | 5893 | data->lsp = lsp; |
5892 | data->server = server; | 5894 | data->server = server; |
5893 | data->args.lock_owner.clientid = server->nfs_client->cl_clientid; | 5895 | data->args.lock_owner.clientid = server->nfs_client->cl_clientid; |
@@ -5895,6 +5897,8 @@ static int nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_st | |||
5895 | data->args.lock_owner.s_dev = server->s_dev; | 5897 | data->args.lock_owner.s_dev = server->s_dev; |
5896 | 5898 | ||
5897 | msg.rpc_argp = &data->args; | 5899 | msg.rpc_argp = &data->args; |
5900 | msg.rpc_resp = &data->res; | ||
5901 | nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0); | ||
5898 | rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, data); | 5902 | rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, data); |
5899 | return 0; | 5903 | return 0; |
5900 | } | 5904 | } |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index e1a47217c05e..0deb32105ccf 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -974,9 +974,6 @@ static int nfs4_copy_lock_stateid(nfs4_stateid *dst, | |||
974 | else if (lsp != NULL && test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) != 0) { | 974 | else if (lsp != NULL && test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) != 0) { |
975 | nfs4_stateid_copy(dst, &lsp->ls_stateid); | 975 | nfs4_stateid_copy(dst, &lsp->ls_stateid); |
976 | ret = 0; | 976 | ret = 0; |
977 | smp_rmb(); | ||
978 | if (!list_empty(&lsp->ls_seqid.list)) | ||
979 | ret = -EWOULDBLOCK; | ||
980 | } | 977 | } |
981 | spin_unlock(&state->state_lock); | 978 | spin_unlock(&state->state_lock); |
982 | nfs4_put_lock_state(lsp); | 979 | nfs4_put_lock_state(lsp); |
@@ -984,10 +981,9 @@ out: | |||
984 | return ret; | 981 | return ret; |
985 | } | 982 | } |
986 | 983 | ||
987 | static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) | 984 | static void nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) |
988 | { | 985 | { |
989 | const nfs4_stateid *src; | 986 | const nfs4_stateid *src; |
990 | int ret; | ||
991 | int seq; | 987 | int seq; |
992 | 988 | ||
993 | do { | 989 | do { |
@@ -996,12 +992,7 @@ static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) | |||
996 | if (test_bit(NFS_OPEN_STATE, &state->flags)) | 992 | if (test_bit(NFS_OPEN_STATE, &state->flags)) |
997 | src = &state->open_stateid; | 993 | src = &state->open_stateid; |
998 | nfs4_stateid_copy(dst, src); | 994 | nfs4_stateid_copy(dst, src); |
999 | ret = 0; | ||
1000 | smp_rmb(); | ||
1001 | if (!list_empty(&state->owner->so_seqid.list)) | ||
1002 | ret = -EWOULDBLOCK; | ||
1003 | } while (read_seqretry(&state->seqlock, seq)); | 995 | } while (read_seqretry(&state->seqlock, seq)); |
1004 | return ret; | ||
1005 | } | 996 | } |
1006 | 997 | ||
1007 | /* | 998 | /* |
@@ -1026,7 +1017,8 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, | |||
1026 | * choose to use. | 1017 | * choose to use. |
1027 | */ | 1018 | */ |
1028 | goto out; | 1019 | goto out; |
1029 | ret = nfs4_copy_open_stateid(dst, state); | 1020 | nfs4_copy_open_stateid(dst, state); |
1021 | ret = 0; | ||
1030 | out: | 1022 | out: |
1031 | if (nfs_server_capable(state->inode, NFS_CAP_STATEID_NFSV41)) | 1023 | if (nfs_server_capable(state->inode, NFS_CAP_STATEID_NFSV41)) |
1032 | dst->seqid = 0; | 1024 | dst->seqid = 0; |
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 0b9ff4395e6a..abc8cbcfe90e 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
@@ -86,7 +86,7 @@ static int dnotify_handle_event(struct fsnotify_group *group, | |||
86 | struct fsnotify_mark *inode_mark, | 86 | struct fsnotify_mark *inode_mark, |
87 | struct fsnotify_mark *vfsmount_mark, | 87 | struct fsnotify_mark *vfsmount_mark, |
88 | u32 mask, void *data, int data_type, | 88 | u32 mask, void *data, int data_type, |
89 | const unsigned char *file_name) | 89 | const unsigned char *file_name, u32 cookie) |
90 | { | 90 | { |
91 | struct dnotify_mark *dn_mark; | 91 | struct dnotify_mark *dn_mark; |
92 | struct dnotify_struct *dn; | 92 | struct dnotify_struct *dn; |
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 0e792f5e3147..dc638f786d5c 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -147,7 +147,7 @@ static int fanotify_handle_event(struct fsnotify_group *group, | |||
147 | struct fsnotify_mark *inode_mark, | 147 | struct fsnotify_mark *inode_mark, |
148 | struct fsnotify_mark *fanotify_mark, | 148 | struct fsnotify_mark *fanotify_mark, |
149 | u32 mask, void *data, int data_type, | 149 | u32 mask, void *data, int data_type, |
150 | const unsigned char *file_name) | 150 | const unsigned char *file_name, u32 cookie) |
151 | { | 151 | { |
152 | int ret = 0; | 152 | int ret = 0; |
153 | struct fanotify_event_info *event; | 153 | struct fanotify_event_info *event; |
@@ -192,10 +192,12 @@ static int fanotify_handle_event(struct fsnotify_group *group, | |||
192 | 192 | ||
193 | ret = fsnotify_add_notify_event(group, fsn_event, fanotify_merge); | 193 | ret = fsnotify_add_notify_event(group, fsn_event, fanotify_merge); |
194 | if (ret) { | 194 | if (ret) { |
195 | BUG_ON(mask & FAN_ALL_PERM_EVENTS); | 195 | /* Permission events shouldn't be merged */ |
196 | BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS); | ||
196 | /* Our event wasn't used in the end. Free it. */ | 197 | /* Our event wasn't used in the end. Free it. */ |
197 | fsnotify_destroy_event(group, fsn_event); | 198 | fsnotify_destroy_event(group, fsn_event); |
198 | ret = 0; | 199 | |
200 | return 0; | ||
199 | } | 201 | } |
200 | 202 | ||
201 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 203 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index b6175fa11bf8..287a22c04149 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -698,6 +698,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
698 | struct fsnotify_group *group; | 698 | struct fsnotify_group *group; |
699 | int f_flags, fd; | 699 | int f_flags, fd; |
700 | struct user_struct *user; | 700 | struct user_struct *user; |
701 | struct fanotify_event_info *oevent; | ||
701 | 702 | ||
702 | pr_debug("%s: flags=%d event_f_flags=%d\n", | 703 | pr_debug("%s: flags=%d event_f_flags=%d\n", |
703 | __func__, flags, event_f_flags); | 704 | __func__, flags, event_f_flags); |
@@ -730,8 +731,20 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
730 | group->fanotify_data.user = user; | 731 | group->fanotify_data.user = user; |
731 | atomic_inc(&user->fanotify_listeners); | 732 | atomic_inc(&user->fanotify_listeners); |
732 | 733 | ||
734 | oevent = kmem_cache_alloc(fanotify_event_cachep, GFP_KERNEL); | ||
735 | if (unlikely(!oevent)) { | ||
736 | fd = -ENOMEM; | ||
737 | goto out_destroy_group; | ||
738 | } | ||
739 | group->overflow_event = &oevent->fse; | ||
740 | fsnotify_init_event(group->overflow_event, NULL, FS_Q_OVERFLOW); | ||
741 | oevent->tgid = get_pid(task_tgid(current)); | ||
742 | oevent->path.mnt = NULL; | ||
743 | oevent->path.dentry = NULL; | ||
744 | |||
733 | group->fanotify_data.f_flags = event_f_flags; | 745 | group->fanotify_data.f_flags = event_f_flags; |
734 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 746 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
747 | oevent->response = 0; | ||
735 | mutex_init(&group->fanotify_data.access_mutex); | 748 | mutex_init(&group->fanotify_data.access_mutex); |
736 | init_waitqueue_head(&group->fanotify_data.access_waitq); | 749 | init_waitqueue_head(&group->fanotify_data.access_waitq); |
737 | INIT_LIST_HEAD(&group->fanotify_data.access_list); | 750 | INIT_LIST_HEAD(&group->fanotify_data.access_list); |
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 1d4e1ea2f37c..9d3e9c50066a 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -179,7 +179,7 @@ static int send_to_group(struct inode *to_tell, | |||
179 | 179 | ||
180 | return group->ops->handle_event(group, to_tell, inode_mark, | 180 | return group->ops->handle_event(group, to_tell, inode_mark, |
181 | vfsmount_mark, mask, data, data_is, | 181 | vfsmount_mark, mask, data, data_is, |
182 | file_name); | 182 | file_name, cookie); |
183 | } | 183 | } |
184 | 184 | ||
185 | /* | 185 | /* |
diff --git a/fs/notify/group.c b/fs/notify/group.c index ee674fe2cec7..ad1995980456 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -55,6 +55,13 @@ void fsnotify_destroy_group(struct fsnotify_group *group) | |||
55 | /* clear the notification queue of all events */ | 55 | /* clear the notification queue of all events */ |
56 | fsnotify_flush_notify(group); | 56 | fsnotify_flush_notify(group); |
57 | 57 | ||
58 | /* | ||
59 | * Destroy overflow event (we cannot use fsnotify_destroy_event() as | ||
60 | * that deliberately ignores overflow events. | ||
61 | */ | ||
62 | if (group->overflow_event) | ||
63 | group->ops->free_event(group->overflow_event); | ||
64 | |||
58 | fsnotify_put_group(group); | 65 | fsnotify_put_group(group); |
59 | } | 66 | } |
60 | 67 | ||
@@ -99,7 +106,6 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops) | |||
99 | INIT_LIST_HEAD(&group->marks_list); | 106 | INIT_LIST_HEAD(&group->marks_list); |
100 | 107 | ||
101 | group->ops = ops; | 108 | group->ops = ops; |
102 | fsnotify_init_event(&group->overflow_event, NULL, FS_Q_OVERFLOW); | ||
103 | 109 | ||
104 | return group; | 110 | return group; |
105 | } | 111 | } |
diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h index 485eef3f4407..ed855ef6f077 100644 --- a/fs/notify/inotify/inotify.h +++ b/fs/notify/inotify/inotify.h | |||
@@ -27,6 +27,6 @@ extern int inotify_handle_event(struct fsnotify_group *group, | |||
27 | struct fsnotify_mark *inode_mark, | 27 | struct fsnotify_mark *inode_mark, |
28 | struct fsnotify_mark *vfsmount_mark, | 28 | struct fsnotify_mark *vfsmount_mark, |
29 | u32 mask, void *data, int data_type, | 29 | u32 mask, void *data, int data_type, |
30 | const unsigned char *file_name); | 30 | const unsigned char *file_name, u32 cookie); |
31 | 31 | ||
32 | extern const struct fsnotify_ops inotify_fsnotify_ops; | 32 | extern const struct fsnotify_ops inotify_fsnotify_ops; |
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c index d5ee56348bb8..43ab1e1a07a2 100644 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c | |||
@@ -67,7 +67,7 @@ int inotify_handle_event(struct fsnotify_group *group, | |||
67 | struct fsnotify_mark *inode_mark, | 67 | struct fsnotify_mark *inode_mark, |
68 | struct fsnotify_mark *vfsmount_mark, | 68 | struct fsnotify_mark *vfsmount_mark, |
69 | u32 mask, void *data, int data_type, | 69 | u32 mask, void *data, int data_type, |
70 | const unsigned char *file_name) | 70 | const unsigned char *file_name, u32 cookie) |
71 | { | 71 | { |
72 | struct inotify_inode_mark *i_mark; | 72 | struct inotify_inode_mark *i_mark; |
73 | struct inotify_event_info *event; | 73 | struct inotify_event_info *event; |
@@ -103,6 +103,7 @@ int inotify_handle_event(struct fsnotify_group *group, | |||
103 | fsn_event = &event->fse; | 103 | fsn_event = &event->fse; |
104 | fsnotify_init_event(fsn_event, inode, mask); | 104 | fsnotify_init_event(fsn_event, inode, mask); |
105 | event->wd = i_mark->wd; | 105 | event->wd = i_mark->wd; |
106 | event->sync_cookie = cookie; | ||
106 | event->name_len = len; | 107 | event->name_len = len; |
107 | if (len) | 108 | if (len) |
108 | strcpy(event->name, file_name); | 109 | strcpy(event->name, file_name); |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 497395c8274b..78a2ca3966c3 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -495,7 +495,7 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, | |||
495 | 495 | ||
496 | /* Queue ignore event for the watch */ | 496 | /* Queue ignore event for the watch */ |
497 | inotify_handle_event(group, NULL, fsn_mark, NULL, FS_IN_IGNORED, | 497 | inotify_handle_event(group, NULL, fsn_mark, NULL, FS_IN_IGNORED, |
498 | NULL, FSNOTIFY_EVENT_NONE, NULL); | 498 | NULL, FSNOTIFY_EVENT_NONE, NULL, 0); |
499 | 499 | ||
500 | i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark); | 500 | i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark); |
501 | /* remove this mark from the idr */ | 501 | /* remove this mark from the idr */ |
@@ -633,11 +633,23 @@ static int inotify_update_watch(struct fsnotify_group *group, struct inode *inod | |||
633 | static struct fsnotify_group *inotify_new_group(unsigned int max_events) | 633 | static struct fsnotify_group *inotify_new_group(unsigned int max_events) |
634 | { | 634 | { |
635 | struct fsnotify_group *group; | 635 | struct fsnotify_group *group; |
636 | struct inotify_event_info *oevent; | ||
636 | 637 | ||
637 | group = fsnotify_alloc_group(&inotify_fsnotify_ops); | 638 | group = fsnotify_alloc_group(&inotify_fsnotify_ops); |
638 | if (IS_ERR(group)) | 639 | if (IS_ERR(group)) |
639 | return group; | 640 | return group; |
640 | 641 | ||
642 | oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL); | ||
643 | if (unlikely(!oevent)) { | ||
644 | fsnotify_destroy_group(group); | ||
645 | return ERR_PTR(-ENOMEM); | ||
646 | } | ||
647 | group->overflow_event = &oevent->fse; | ||
648 | fsnotify_init_event(group->overflow_event, NULL, FS_Q_OVERFLOW); | ||
649 | oevent->wd = -1; | ||
650 | oevent->sync_cookie = 0; | ||
651 | oevent->name_len = 0; | ||
652 | |||
641 | group->max_events = max_events; | 653 | group->max_events = max_events; |
642 | 654 | ||
643 | spin_lock_init(&group->inotify_data.idr_lock); | 655 | spin_lock_init(&group->inotify_data.idr_lock); |
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index 18b3c4427dca..1e58402171a5 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -80,7 +80,8 @@ void fsnotify_destroy_event(struct fsnotify_group *group, | |||
80 | /* | 80 | /* |
81 | * Add an event to the group notification queue. The group can later pull this | 81 | * Add an event to the group notification queue. The group can later pull this |
82 | * event off the queue to deal with. The function returns 0 if the event was | 82 | * event off the queue to deal with. The function returns 0 if the event was |
83 | * added to the queue, 1 if the event was merged with some other queued event. | 83 | * added to the queue, 1 if the event was merged with some other queued event, |
84 | * 2 if the queue of events has overflown. | ||
84 | */ | 85 | */ |
85 | int fsnotify_add_notify_event(struct fsnotify_group *group, | 86 | int fsnotify_add_notify_event(struct fsnotify_group *group, |
86 | struct fsnotify_event *event, | 87 | struct fsnotify_event *event, |
@@ -95,10 +96,14 @@ int fsnotify_add_notify_event(struct fsnotify_group *group, | |||
95 | mutex_lock(&group->notification_mutex); | 96 | mutex_lock(&group->notification_mutex); |
96 | 97 | ||
97 | if (group->q_len >= group->max_events) { | 98 | if (group->q_len >= group->max_events) { |
99 | ret = 2; | ||
98 | /* Queue overflow event only if it isn't already queued */ | 100 | /* Queue overflow event only if it isn't already queued */ |
99 | if (list_empty(&group->overflow_event.list)) | 101 | if (!list_empty(&group->overflow_event->list)) { |
100 | event = &group->overflow_event; | 102 | mutex_unlock(&group->notification_mutex); |
101 | ret = 1; | 103 | return ret; |
104 | } | ||
105 | event = group->overflow_event; | ||
106 | goto queue; | ||
102 | } | 107 | } |
103 | 108 | ||
104 | if (!list_empty(list) && merge) { | 109 | if (!list_empty(list) && merge) { |
@@ -109,6 +114,7 @@ int fsnotify_add_notify_event(struct fsnotify_group *group, | |||
109 | } | 114 | } |
110 | } | 115 | } |
111 | 116 | ||
117 | queue: | ||
112 | group->q_len++; | 118 | group->q_len++; |
113 | list_add_tail(&event->list, list); | 119 | list_add_tail(&event->list, list); |
114 | mutex_unlock(&group->notification_mutex); | 120 | mutex_unlock(&group->notification_mutex); |
@@ -132,7 +138,11 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group | |||
132 | 138 | ||
133 | event = list_first_entry(&group->notification_list, | 139 | event = list_first_entry(&group->notification_list, |
134 | struct fsnotify_event, list); | 140 | struct fsnotify_event, list); |
135 | list_del(&event->list); | 141 | /* |
142 | * We need to init list head for the case of overflow event so that | ||
143 | * check in fsnotify_add_notify_events() works | ||
144 | */ | ||
145 | list_del_init(&event->list); | ||
136 | group->q_len--; | 146 | group->q_len--; |
137 | 147 | ||
138 | return event; | 148 | return event; |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 8450262bcf2a..51632c40e896 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2393,8 +2393,8 @@ out_dio: | |||
2393 | 2393 | ||
2394 | if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || | 2394 | if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || |
2395 | ((file->f_flags & O_DIRECT) && !direct_io)) { | 2395 | ((file->f_flags & O_DIRECT) && !direct_io)) { |
2396 | ret = filemap_fdatawrite_range(file->f_mapping, pos, | 2396 | ret = filemap_fdatawrite_range(file->f_mapping, *ppos, |
2397 | pos + count - 1); | 2397 | *ppos + count - 1); |
2398 | if (ret < 0) | 2398 | if (ret < 0) |
2399 | written = ret; | 2399 | written = ret; |
2400 | 2400 | ||
@@ -2407,8 +2407,8 @@ out_dio: | |||
2407 | } | 2407 | } |
2408 | 2408 | ||
2409 | if (!ret) | 2409 | if (!ret) |
2410 | ret = filemap_fdatawait_range(file->f_mapping, pos, | 2410 | ret = filemap_fdatawait_range(file->f_mapping, *ppos, |
2411 | pos + count - 1); | 2411 | *ppos + count - 1); |
2412 | } | 2412 | } |
2413 | 2413 | ||
2414 | /* | 2414 | /* |
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index aaa50611ec66..d7b5108789e2 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -717,6 +717,12 @@ static int ocfs2_release_dquot(struct dquot *dquot) | |||
717 | */ | 717 | */ |
718 | if (status < 0) | 718 | if (status < 0) |
719 | mlog_errno(status); | 719 | mlog_errno(status); |
720 | /* | ||
721 | * Clear dq_off so that we search for the structure in quota file next | ||
722 | * time we acquire it. The structure might be deleted and reallocated | ||
723 | * elsewhere by another node while our dquot structure is on freelist. | ||
724 | */ | ||
725 | dquot->dq_off = 0; | ||
720 | clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); | 726 | clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); |
721 | out_trans: | 727 | out_trans: |
722 | ocfs2_commit_trans(osb, handle); | 728 | ocfs2_commit_trans(osb, handle); |
@@ -756,16 +762,17 @@ static int ocfs2_acquire_dquot(struct dquot *dquot) | |||
756 | status = ocfs2_lock_global_qf(info, 1); | 762 | status = ocfs2_lock_global_qf(info, 1); |
757 | if (status < 0) | 763 | if (status < 0) |
758 | goto out; | 764 | goto out; |
759 | if (!test_bit(DQ_READ_B, &dquot->dq_flags)) { | 765 | status = ocfs2_qinfo_lock(info, 0); |
760 | status = ocfs2_qinfo_lock(info, 0); | 766 | if (status < 0) |
761 | if (status < 0) | 767 | goto out_dq; |
762 | goto out_dq; | 768 | /* |
763 | status = qtree_read_dquot(&info->dqi_gi, dquot); | 769 | * We always want to read dquot structure from disk because we don't |
764 | ocfs2_qinfo_unlock(info, 0); | 770 | * know what happened with it while it was on freelist. |
765 | if (status < 0) | 771 | */ |
766 | goto out_dq; | 772 | status = qtree_read_dquot(&info->dqi_gi, dquot); |
767 | } | 773 | ocfs2_qinfo_unlock(info, 0); |
768 | set_bit(DQ_READ_B, &dquot->dq_flags); | 774 | if (status < 0) |
775 | goto out_dq; | ||
769 | 776 | ||
770 | OCFS2_DQUOT(dquot)->dq_use_count++; | 777 | OCFS2_DQUOT(dquot)->dq_use_count++; |
771 | OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; | 778 | OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; |
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 2e4344be3b96..2001862bf2b1 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -1303,10 +1303,6 @@ int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot) | |||
1303 | ocfs2_journal_dirty(handle, od->dq_chunk->qc_headerbh); | 1303 | ocfs2_journal_dirty(handle, od->dq_chunk->qc_headerbh); |
1304 | 1304 | ||
1305 | out: | 1305 | out: |
1306 | /* Clear the read bit so that next time someone uses this | ||
1307 | * dquot he reads fresh info from disk and allocates local | ||
1308 | * dquot structure */ | ||
1309 | clear_bit(DQ_READ_B, &dquot->dq_flags); | ||
1310 | return status; | 1306 | return status; |
1311 | } | 1307 | } |
1312 | 1308 | ||
@@ -705,6 +705,10 @@ static int do_dentry_open(struct file *f, | |||
705 | return 0; | 705 | return 0; |
706 | } | 706 | } |
707 | 707 | ||
708 | /* POSIX.1-2008/SUSv4 Section XSI 2.9.7 */ | ||
709 | if (S_ISREG(inode->i_mode)) | ||
710 | f->f_mode |= FMODE_ATOMIC_POS; | ||
711 | |||
708 | f->f_op = fops_get(inode->i_fop); | 712 | f->f_op = fops_get(inode->i_fop); |
709 | if (unlikely(WARN_ON(!f->f_op))) { | 713 | if (unlikely(WARN_ON(!f->f_op))) { |
710 | error = -ENODEV; | 714 | error = -ENODEV; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 51507065263b..b9760628e1fd 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1824,6 +1824,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path) | |||
1824 | if (rc) | 1824 | if (rc) |
1825 | goto out_mmput; | 1825 | goto out_mmput; |
1826 | 1826 | ||
1827 | rc = -ENOENT; | ||
1827 | down_read(&mm->mmap_sem); | 1828 | down_read(&mm->mmap_sem); |
1828 | vma = find_exact_vma(mm, vm_start, vm_end); | 1829 | vma = find_exact_vma(mm, vm_start, vm_end); |
1829 | if (vma && vma->vm_file) { | 1830 | if (vma && vma->vm_file) { |
diff --git a/fs/proc/page.c b/fs/proc/page.c index 02174a610315..e647c55275d9 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c | |||
@@ -121,9 +121,8 @@ u64 stable_page_flags(struct page *page) | |||
121 | * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon | 121 | * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon |
122 | * to make sure a given page is a thp, not a non-huge compound page. | 122 | * to make sure a given page is a thp, not a non-huge compound page. |
123 | */ | 123 | */ |
124 | else if (PageTransCompound(page) && | 124 | else if (PageTransCompound(page) && (PageLRU(compound_head(page)) || |
125 | (PageLRU(compound_trans_head(page)) || | 125 | PageAnon(compound_head(page)))) |
126 | PageAnon(compound_trans_head(page)))) | ||
127 | u |= 1 << KPF_THP; | 126 | u |= 1 << KPF_THP; |
128 | 127 | ||
129 | /* | 128 | /* |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 831d49a4111f..cfc8dcc16043 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -581,9 +581,17 @@ int dquot_scan_active(struct super_block *sb, | |||
581 | dqstats_inc(DQST_LOOKUPS); | 581 | dqstats_inc(DQST_LOOKUPS); |
582 | dqput(old_dquot); | 582 | dqput(old_dquot); |
583 | old_dquot = dquot; | 583 | old_dquot = dquot; |
584 | ret = fn(dquot, priv); | 584 | /* |
585 | if (ret < 0) | 585 | * ->release_dquot() can be racing with us. Our reference |
586 | goto out; | 586 | * protects us from new calls to it so just wait for any |
587 | * outstanding call and recheck the DQ_ACTIVE_B after that. | ||
588 | */ | ||
589 | wait_on_dquot(dquot); | ||
590 | if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { | ||
591 | ret = fn(dquot, priv); | ||
592 | if (ret < 0) | ||
593 | goto out; | ||
594 | } | ||
587 | spin_lock(&dq_list_lock); | 595 | spin_lock(&dq_list_lock); |
588 | /* We are safe to continue now because our dquot could not | 596 | /* We are safe to continue now because our dquot could not |
589 | * be moved out of the inuse list while we hold the reference */ | 597 | * be moved out of the inuse list while we hold the reference */ |
diff --git a/fs/read_write.c b/fs/read_write.c index edc5746a902a..54e19b9392dc 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -264,10 +264,22 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int whence) | |||
264 | } | 264 | } |
265 | EXPORT_SYMBOL(vfs_llseek); | 265 | EXPORT_SYMBOL(vfs_llseek); |
266 | 266 | ||
267 | static inline struct fd fdget_pos(int fd) | ||
268 | { | ||
269 | return __to_fd(__fdget_pos(fd)); | ||
270 | } | ||
271 | |||
272 | static inline void fdput_pos(struct fd f) | ||
273 | { | ||
274 | if (f.flags & FDPUT_POS_UNLOCK) | ||
275 | mutex_unlock(&f.file->f_pos_lock); | ||
276 | fdput(f); | ||
277 | } | ||
278 | |||
267 | SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) | 279 | SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) |
268 | { | 280 | { |
269 | off_t retval; | 281 | off_t retval; |
270 | struct fd f = fdget(fd); | 282 | struct fd f = fdget_pos(fd); |
271 | if (!f.file) | 283 | if (!f.file) |
272 | return -EBADF; | 284 | return -EBADF; |
273 | 285 | ||
@@ -278,7 +290,7 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) | |||
278 | if (res != (loff_t)retval) | 290 | if (res != (loff_t)retval) |
279 | retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */ | 291 | retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */ |
280 | } | 292 | } |
281 | fdput(f); | 293 | fdput_pos(f); |
282 | return retval; | 294 | return retval; |
283 | } | 295 | } |
284 | 296 | ||
@@ -498,7 +510,7 @@ static inline void file_pos_write(struct file *file, loff_t pos) | |||
498 | 510 | ||
499 | SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) | 511 | SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) |
500 | { | 512 | { |
501 | struct fd f = fdget(fd); | 513 | struct fd f = fdget_pos(fd); |
502 | ssize_t ret = -EBADF; | 514 | ssize_t ret = -EBADF; |
503 | 515 | ||
504 | if (f.file) { | 516 | if (f.file) { |
@@ -506,7 +518,7 @@ SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) | |||
506 | ret = vfs_read(f.file, buf, count, &pos); | 518 | ret = vfs_read(f.file, buf, count, &pos); |
507 | if (ret >= 0) | 519 | if (ret >= 0) |
508 | file_pos_write(f.file, pos); | 520 | file_pos_write(f.file, pos); |
509 | fdput(f); | 521 | fdput_pos(f); |
510 | } | 522 | } |
511 | return ret; | 523 | return ret; |
512 | } | 524 | } |
@@ -514,7 +526,7 @@ SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) | |||
514 | SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, | 526 | SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, |
515 | size_t, count) | 527 | size_t, count) |
516 | { | 528 | { |
517 | struct fd f = fdget(fd); | 529 | struct fd f = fdget_pos(fd); |
518 | ssize_t ret = -EBADF; | 530 | ssize_t ret = -EBADF; |
519 | 531 | ||
520 | if (f.file) { | 532 | if (f.file) { |
@@ -522,7 +534,7 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, | |||
522 | ret = vfs_write(f.file, buf, count, &pos); | 534 | ret = vfs_write(f.file, buf, count, &pos); |
523 | if (ret >= 0) | 535 | if (ret >= 0) |
524 | file_pos_write(f.file, pos); | 536 | file_pos_write(f.file, pos); |
525 | fdput(f); | 537 | fdput_pos(f); |
526 | } | 538 | } |
527 | 539 | ||
528 | return ret; | 540 | return ret; |
@@ -797,7 +809,7 @@ EXPORT_SYMBOL(vfs_writev); | |||
797 | SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, | 809 | SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, |
798 | unsigned long, vlen) | 810 | unsigned long, vlen) |
799 | { | 811 | { |
800 | struct fd f = fdget(fd); | 812 | struct fd f = fdget_pos(fd); |
801 | ssize_t ret = -EBADF; | 813 | ssize_t ret = -EBADF; |
802 | 814 | ||
803 | if (f.file) { | 815 | if (f.file) { |
@@ -805,7 +817,7 @@ SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, | |||
805 | ret = vfs_readv(f.file, vec, vlen, &pos); | 817 | ret = vfs_readv(f.file, vec, vlen, &pos); |
806 | if (ret >= 0) | 818 | if (ret >= 0) |
807 | file_pos_write(f.file, pos); | 819 | file_pos_write(f.file, pos); |
808 | fdput(f); | 820 | fdput_pos(f); |
809 | } | 821 | } |
810 | 822 | ||
811 | if (ret > 0) | 823 | if (ret > 0) |
@@ -817,7 +829,7 @@ SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, | |||
817 | SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec, | 829 | SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec, |
818 | unsigned long, vlen) | 830 | unsigned long, vlen) |
819 | { | 831 | { |
820 | struct fd f = fdget(fd); | 832 | struct fd f = fdget_pos(fd); |
821 | ssize_t ret = -EBADF; | 833 | ssize_t ret = -EBADF; |
822 | 834 | ||
823 | if (f.file) { | 835 | if (f.file) { |
@@ -825,7 +837,7 @@ SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec, | |||
825 | ret = vfs_writev(f.file, vec, vlen, &pos); | 837 | ret = vfs_writev(f.file, vec, vlen, &pos); |
826 | if (ret >= 0) | 838 | if (ret >= 0) |
827 | file_pos_write(f.file, pos); | 839 | file_pos_write(f.file, pos); |
828 | fdput(f); | 840 | fdput_pos(f); |
829 | } | 841 | } |
830 | 842 | ||
831 | if (ret > 0) | 843 | if (ret > 0) |
@@ -968,7 +980,7 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd, | |||
968 | const struct compat_iovec __user *,vec, | 980 | const struct compat_iovec __user *,vec, |
969 | compat_ulong_t, vlen) | 981 | compat_ulong_t, vlen) |
970 | { | 982 | { |
971 | struct fd f = fdget(fd); | 983 | struct fd f = fdget_pos(fd); |
972 | ssize_t ret; | 984 | ssize_t ret; |
973 | loff_t pos; | 985 | loff_t pos; |
974 | 986 | ||
@@ -978,7 +990,7 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd, | |||
978 | ret = compat_readv(f.file, vec, vlen, &pos); | 990 | ret = compat_readv(f.file, vec, vlen, &pos); |
979 | if (ret >= 0) | 991 | if (ret >= 0) |
980 | f.file->f_pos = pos; | 992 | f.file->f_pos = pos; |
981 | fdput(f); | 993 | fdput_pos(f); |
982 | return ret; | 994 | return ret; |
983 | } | 995 | } |
984 | 996 | ||
@@ -1035,7 +1047,7 @@ COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd, | |||
1035 | const struct compat_iovec __user *, vec, | 1047 | const struct compat_iovec __user *, vec, |
1036 | compat_ulong_t, vlen) | 1048 | compat_ulong_t, vlen) |
1037 | { | 1049 | { |
1038 | struct fd f = fdget(fd); | 1050 | struct fd f = fdget_pos(fd); |
1039 | ssize_t ret; | 1051 | ssize_t ret; |
1040 | loff_t pos; | 1052 | loff_t pos; |
1041 | 1053 | ||
@@ -1045,7 +1057,7 @@ COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd, | |||
1045 | ret = compat_writev(f.file, vec, vlen, &pos); | 1057 | ret = compat_writev(f.file, vec, vlen, &pos); |
1046 | if (ret >= 0) | 1058 | if (ret >= 0) |
1047 | f.file->f_pos = pos; | 1059 | f.file->f_pos = pos; |
1048 | fdput(f); | 1060 | fdput_pos(f); |
1049 | return ret; | 1061 | return ret; |
1050 | } | 1062 | } |
1051 | 1063 | ||
@@ -27,11 +27,10 @@ | |||
27 | * wait == 1 case since in that case write_inode() functions do | 27 | * wait == 1 case since in that case write_inode() functions do |
28 | * sync_dirty_buffer() and thus effectively write one block at a time. | 28 | * sync_dirty_buffer() and thus effectively write one block at a time. |
29 | */ | 29 | */ |
30 | static int __sync_filesystem(struct super_block *sb, int wait, | 30 | static int __sync_filesystem(struct super_block *sb, int wait) |
31 | unsigned long start) | ||
32 | { | 31 | { |
33 | if (wait) | 32 | if (wait) |
34 | sync_inodes_sb(sb, start); | 33 | sync_inodes_sb(sb); |
35 | else | 34 | else |
36 | writeback_inodes_sb(sb, WB_REASON_SYNC); | 35 | writeback_inodes_sb(sb, WB_REASON_SYNC); |
37 | 36 | ||
@@ -48,7 +47,6 @@ static int __sync_filesystem(struct super_block *sb, int wait, | |||
48 | int sync_filesystem(struct super_block *sb) | 47 | int sync_filesystem(struct super_block *sb) |
49 | { | 48 | { |
50 | int ret; | 49 | int ret; |
51 | unsigned long start = jiffies; | ||
52 | 50 | ||
53 | /* | 51 | /* |
54 | * We need to be protected against the filesystem going from | 52 | * We need to be protected against the filesystem going from |
@@ -62,17 +60,17 @@ int sync_filesystem(struct super_block *sb) | |||
62 | if (sb->s_flags & MS_RDONLY) | 60 | if (sb->s_flags & MS_RDONLY) |
63 | return 0; | 61 | return 0; |
64 | 62 | ||
65 | ret = __sync_filesystem(sb, 0, start); | 63 | ret = __sync_filesystem(sb, 0); |
66 | if (ret < 0) | 64 | if (ret < 0) |
67 | return ret; | 65 | return ret; |
68 | return __sync_filesystem(sb, 1, start); | 66 | return __sync_filesystem(sb, 1); |
69 | } | 67 | } |
70 | EXPORT_SYMBOL_GPL(sync_filesystem); | 68 | EXPORT_SYMBOL_GPL(sync_filesystem); |
71 | 69 | ||
72 | static void sync_inodes_one_sb(struct super_block *sb, void *arg) | 70 | static void sync_inodes_one_sb(struct super_block *sb, void *arg) |
73 | { | 71 | { |
74 | if (!(sb->s_flags & MS_RDONLY)) | 72 | if (!(sb->s_flags & MS_RDONLY)) |
75 | sync_inodes_sb(sb, *((unsigned long *)arg)); | 73 | sync_inodes_sb(sb); |
76 | } | 74 | } |
77 | 75 | ||
78 | static void sync_fs_one_sb(struct super_block *sb, void *arg) | 76 | static void sync_fs_one_sb(struct super_block *sb, void *arg) |
@@ -104,10 +102,9 @@ static void fdatawait_one_bdev(struct block_device *bdev, void *arg) | |||
104 | SYSCALL_DEFINE0(sync) | 102 | SYSCALL_DEFINE0(sync) |
105 | { | 103 | { |
106 | int nowait = 0, wait = 1; | 104 | int nowait = 0, wait = 1; |
107 | unsigned long start = jiffies; | ||
108 | 105 | ||
109 | wakeup_flusher_threads(0, WB_REASON_SYNC); | 106 | wakeup_flusher_threads(0, WB_REASON_SYNC); |
110 | iterate_supers(sync_inodes_one_sb, &start); | 107 | iterate_supers(sync_inodes_one_sb, NULL); |
111 | iterate_supers(sync_fs_one_sb, &nowait); | 108 | iterate_supers(sync_fs_one_sb, &nowait); |
112 | iterate_supers(sync_fs_one_sb, &wait); | 109 | iterate_supers(sync_fs_one_sb, &wait); |
113 | iterate_bdevs(fdatawrite_one_bdev, NULL); | 110 | iterate_bdevs(fdatawrite_one_bdev, NULL); |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 6211230814fd..3eaf5c6622eb 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -27,6 +27,7 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, | |||
27 | { | 27 | { |
28 | struct dentry *root; | 28 | struct dentry *root; |
29 | void *ns; | 29 | void *ns; |
30 | bool new_sb; | ||
30 | 31 | ||
31 | if (!(flags & MS_KERNMOUNT)) { | 32 | if (!(flags & MS_KERNMOUNT)) { |
32 | if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type)) | 33 | if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type)) |
@@ -37,8 +38,8 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, | |||
37 | } | 38 | } |
38 | 39 | ||
39 | ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); | 40 | ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); |
40 | root = kernfs_mount_ns(fs_type, flags, sysfs_root, ns); | 41 | root = kernfs_mount_ns(fs_type, flags, sysfs_root, &new_sb, ns); |
41 | if (IS_ERR(root)) | 42 | if (IS_ERR(root) || !new_sb) |
42 | kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); | 43 | kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); |
43 | return root; | 44 | return root; |
44 | } | 45 | } |
diff --git a/fs/udf/file.c b/fs/udf/file.c index c02a27a19c6d..1037637957c7 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -144,6 +144,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
144 | size_t count = iocb->ki_nbytes; | 144 | size_t count = iocb->ki_nbytes; |
145 | struct udf_inode_info *iinfo = UDF_I(inode); | 145 | struct udf_inode_info *iinfo = UDF_I(inode); |
146 | 146 | ||
147 | mutex_lock(&inode->i_mutex); | ||
147 | down_write(&iinfo->i_data_sem); | 148 | down_write(&iinfo->i_data_sem); |
148 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 149 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
149 | if (file->f_flags & O_APPEND) | 150 | if (file->f_flags & O_APPEND) |
@@ -156,6 +157,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
156 | pos + count)) { | 157 | pos + count)) { |
157 | err = udf_expand_file_adinicb(inode); | 158 | err = udf_expand_file_adinicb(inode); |
158 | if (err) { | 159 | if (err) { |
160 | mutex_unlock(&inode->i_mutex); | ||
159 | udf_debug("udf_expand_adinicb: err=%d\n", err); | 161 | udf_debug("udf_expand_adinicb: err=%d\n", err); |
160 | return err; | 162 | return err; |
161 | } | 163 | } |
@@ -169,9 +171,17 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
169 | } else | 171 | } else |
170 | up_write(&iinfo->i_data_sem); | 172 | up_write(&iinfo->i_data_sem); |
171 | 173 | ||
172 | retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); | 174 | retval = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); |
173 | if (retval > 0) | 175 | mutex_unlock(&inode->i_mutex); |
176 | |||
177 | if (retval > 0) { | ||
178 | ssize_t err; | ||
179 | |||
174 | mark_inode_dirty(inode); | 180 | mark_inode_dirty(inode); |
181 | err = generic_write_sync(file, iocb->ki_pos - retval, retval); | ||
182 | if (err < 0) | ||
183 | retval = err; | ||
184 | } | ||
175 | 185 | ||
176 | return retval; | 186 | return retval; |
177 | } | 187 | } |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 062b7925bca0..982ce05c87ed 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -265,6 +265,7 @@ int udf_expand_file_adinicb(struct inode *inode) | |||
265 | .nr_to_write = 1, | 265 | .nr_to_write = 1, |
266 | }; | 266 | }; |
267 | 267 | ||
268 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); | ||
268 | if (!iinfo->i_lenAlloc) { | 269 | if (!iinfo->i_lenAlloc) { |
269 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 270 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
270 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 271 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index f317488263dd..d971f4932b5d 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -913,7 +913,7 @@ xfs_flush_inodes( | |||
913 | struct super_block *sb = mp->m_super; | 913 | struct super_block *sb = mp->m_super; |
914 | 914 | ||
915 | if (down_read_trylock(&sb->s_umount)) { | 915 | if (down_read_trylock(&sb->s_umount)) { |
916 | sync_inodes_sb(sb, jiffies); | 916 | sync_inodes_sb(sb); |
917 | up_read(&sb->s_umount); | 917 | up_read(&sb->s_umount); |
918 | } | 918 | } |
919 | } | 919 | } |
diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h index a1116a3b54ef..8c1603b10665 100644 --- a/include/dt-bindings/clock/tegra124-car.h +++ b/include/dt-bindings/clock/tegra124-car.h | |||
@@ -36,10 +36,10 @@ | |||
36 | #define TEGRA124_CLK_PWM 17 | 36 | #define TEGRA124_CLK_PWM 17 |
37 | #define TEGRA124_CLK_I2S2 18 | 37 | #define TEGRA124_CLK_I2S2 18 |
38 | /* 20 (register bit affects vi and vi_sensor) */ | 38 | /* 20 (register bit affects vi and vi_sensor) */ |
39 | #define TEGRA124_CLK_GR_2D 21 | 39 | /* 21 */ |
40 | #define TEGRA124_CLK_USBD 22 | 40 | #define TEGRA124_CLK_USBD 22 |
41 | #define TEGRA124_CLK_ISP 23 | 41 | #define TEGRA124_CLK_ISP 23 |
42 | #define TEGRA124_CLK_GR_3D 24 | 42 | /* 26 */ |
43 | /* 25 */ | 43 | /* 25 */ |
44 | #define TEGRA124_CLK_DISP2 26 | 44 | #define TEGRA124_CLK_DISP2 26 |
45 | #define TEGRA124_CLK_DISP1 27 | 45 | #define TEGRA124_CLK_DISP1 27 |
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index be85127bfed3..f27000f55a83 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
@@ -171,6 +171,11 @@ static inline int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 add | |||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | static inline int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write) | ||
175 | { | ||
176 | return -ENXIO; | ||
177 | } | ||
178 | |||
174 | static inline int kvm_vgic_init(struct kvm *kvm) | 179 | static inline int kvm_vgic_init(struct kvm *kvm) |
175 | { | 180 | { |
176 | return 0; | 181 | return 0; |
diff --git a/include/linux/audit.h b/include/linux/audit.h index aa865a9a4c4f..ec1464df4c60 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -43,6 +43,7 @@ struct mq_attr; | |||
43 | struct mqstat; | 43 | struct mqstat; |
44 | struct audit_watch; | 44 | struct audit_watch; |
45 | struct audit_tree; | 45 | struct audit_tree; |
46 | struct sk_buff; | ||
46 | 47 | ||
47 | struct audit_krule { | 48 | struct audit_krule { |
48 | int vers_ops; | 49 | int vers_ops; |
@@ -463,7 +464,7 @@ extern int audit_filter_user(int type); | |||
463 | extern int audit_filter_type(int type); | 464 | extern int audit_filter_type(int type); |
464 | extern int audit_rule_change(int type, __u32 portid, int seq, | 465 | extern int audit_rule_change(int type, __u32 portid, int seq, |
465 | void *data, size_t datasz); | 466 | void *data, size_t datasz); |
466 | extern int audit_list_rules_send(__u32 portid, int seq); | 467 | extern int audit_list_rules_send(struct sk_buff *request_skb, int seq); |
467 | 468 | ||
468 | extern u32 audit_enabled; | 469 | extern u32 audit_enabled; |
469 | #else /* CONFIG_AUDIT */ | 470 | #else /* CONFIG_AUDIT */ |
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 18ba8a627f46..2ff2e8d982be 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h | |||
@@ -121,8 +121,7 @@ void blk_mq_init_commands(struct request_queue *, void (*init)(void *data, struc | |||
121 | 121 | ||
122 | void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); | 122 | void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); |
123 | 123 | ||
124 | void blk_mq_insert_request(struct request_queue *, struct request *, | 124 | void blk_mq_insert_request(struct request *, bool, bool, bool); |
125 | bool, bool); | ||
126 | void blk_mq_run_queues(struct request_queue *q, bool async); | 125 | void blk_mq_run_queues(struct request_queue *q, bool async); |
127 | void blk_mq_free_request(struct request *rq); | 126 | void blk_mq_free_request(struct request *rq); |
128 | bool blk_mq_can_queue(struct blk_mq_hw_ctx *); | 127 | bool blk_mq_can_queue(struct blk_mq_hw_ctx *); |
@@ -134,7 +133,13 @@ struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_ind | |||
134 | struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_reg *, unsigned int); | 133 | struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_reg *, unsigned int); |
135 | void blk_mq_free_single_hw_queue(struct blk_mq_hw_ctx *, unsigned int); | 134 | void blk_mq_free_single_hw_queue(struct blk_mq_hw_ctx *, unsigned int); |
136 | 135 | ||
137 | void blk_mq_end_io(struct request *rq, int error); | 136 | bool blk_mq_end_io_partial(struct request *rq, int error, |
137 | unsigned int nr_bytes); | ||
138 | static inline void blk_mq_end_io(struct request *rq, int error) | ||
139 | { | ||
140 | bool done = !blk_mq_end_io_partial(rq, error, blk_rq_bytes(rq)); | ||
141 | BUG_ON(!done); | ||
142 | } | ||
138 | 143 | ||
139 | void blk_mq_complete_request(struct request *rq); | 144 | void blk_mq_complete_request(struct request *rq); |
140 | 145 | ||
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h index 092b64168d7f..4a21a872dbbd 100644 --- a/include/linux/clk/ti.h +++ b/include/linux/clk/ti.h | |||
@@ -245,6 +245,10 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, | |||
245 | void omap2_init_clk_clkdm(struct clk_hw *clk); | 245 | void omap2_init_clk_clkdm(struct clk_hw *clk); |
246 | unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, | 246 | unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, |
247 | unsigned long parent_rate); | 247 | unsigned long parent_rate); |
248 | int omap3_clkoutx2_set_rate(struct clk_hw *hw, unsigned long rate, | ||
249 | unsigned long parent_rate); | ||
250 | long omap3_clkoutx2_round_rate(struct clk_hw *hw, unsigned long rate, | ||
251 | unsigned long *prate); | ||
248 | int omap2_clkops_enable_clkdm(struct clk_hw *hw); | 252 | int omap2_clkops_enable_clkdm(struct clk_hw *hw); |
249 | void omap2_clkops_disable_clkdm(struct clk_hw *hw); | 253 | void omap2_clkops_disable_clkdm(struct clk_hw *hw); |
250 | int omap2_clk_disable_autoidle_all(void); | 254 | int omap2_clk_disable_autoidle_all(void); |
diff --git a/include/linux/file.h b/include/linux/file.h index cbacf4faf447..4d69123377a2 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -28,33 +28,36 @@ static inline void fput_light(struct file *file, int fput_needed) | |||
28 | 28 | ||
29 | struct fd { | 29 | struct fd { |
30 | struct file *file; | 30 | struct file *file; |
31 | int need_put; | 31 | unsigned int flags; |
32 | }; | 32 | }; |
33 | #define FDPUT_FPUT 1 | ||
34 | #define FDPUT_POS_UNLOCK 2 | ||
33 | 35 | ||
34 | static inline void fdput(struct fd fd) | 36 | static inline void fdput(struct fd fd) |
35 | { | 37 | { |
36 | if (fd.need_put) | 38 | if (fd.flags & FDPUT_FPUT) |
37 | fput(fd.file); | 39 | fput(fd.file); |
38 | } | 40 | } |
39 | 41 | ||
40 | extern struct file *fget(unsigned int fd); | 42 | extern struct file *fget(unsigned int fd); |
41 | extern struct file *fget_light(unsigned int fd, int *fput_needed); | 43 | extern struct file *fget_raw(unsigned int fd); |
44 | extern unsigned long __fdget(unsigned int fd); | ||
45 | extern unsigned long __fdget_raw(unsigned int fd); | ||
46 | extern unsigned long __fdget_pos(unsigned int fd); | ||
42 | 47 | ||
43 | static inline struct fd fdget(unsigned int fd) | 48 | static inline struct fd __to_fd(unsigned long v) |
44 | { | 49 | { |
45 | int b; | 50 | return (struct fd){(struct file *)(v & ~3),v & 3}; |
46 | struct file *f = fget_light(fd, &b); | ||
47 | return (struct fd){f,b}; | ||
48 | } | 51 | } |
49 | 52 | ||
50 | extern struct file *fget_raw(unsigned int fd); | 53 | static inline struct fd fdget(unsigned int fd) |
51 | extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); | 54 | { |
55 | return __to_fd(__fdget(fd)); | ||
56 | } | ||
52 | 57 | ||
53 | static inline struct fd fdget_raw(unsigned int fd) | 58 | static inline struct fd fdget_raw(unsigned int fd) |
54 | { | 59 | { |
55 | int b; | 60 | return __to_fd(__fdget_raw(fd)); |
56 | struct file *f = fget_raw_light(fd, &b); | ||
57 | return (struct fd){f,b}; | ||
58 | } | 61 | } |
59 | 62 | ||
60 | extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); | 63 | extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 5d7782e42b8f..c3683bdf28fe 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -200,6 +200,7 @@ struct fw_device { | |||
200 | unsigned irmc:1; | 200 | unsigned irmc:1; |
201 | unsigned bc_implemented:2; | 201 | unsigned bc_implemented:2; |
202 | 202 | ||
203 | work_func_t workfn; | ||
203 | struct delayed_work work; | 204 | struct delayed_work work; |
204 | struct fw_attribute_group attribute_group; | 205 | struct fw_attribute_group attribute_group; |
205 | }; | 206 | }; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 60829565e552..23b2a35d712e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -123,6 +123,9 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | |||
123 | /* File is opened with O_PATH; almost nothing can be done with it */ | 123 | /* File is opened with O_PATH; almost nothing can be done with it */ |
124 | #define FMODE_PATH ((__force fmode_t)0x4000) | 124 | #define FMODE_PATH ((__force fmode_t)0x4000) |
125 | 125 | ||
126 | /* File needs atomic accesses to f_pos */ | ||
127 | #define FMODE_ATOMIC_POS ((__force fmode_t)0x8000) | ||
128 | |||
126 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 129 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
127 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | 130 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
128 | 131 | ||
@@ -780,13 +783,14 @@ struct file { | |||
780 | const struct file_operations *f_op; | 783 | const struct file_operations *f_op; |
781 | 784 | ||
782 | /* | 785 | /* |
783 | * Protects f_ep_links, f_flags, f_pos vs i_size in lseek SEEK_CUR. | 786 | * Protects f_ep_links, f_flags. |
784 | * Must not be taken from IRQ context. | 787 | * Must not be taken from IRQ context. |
785 | */ | 788 | */ |
786 | spinlock_t f_lock; | 789 | spinlock_t f_lock; |
787 | atomic_long_t f_count; | 790 | atomic_long_t f_count; |
788 | unsigned int f_flags; | 791 | unsigned int f_flags; |
789 | fmode_t f_mode; | 792 | fmode_t f_mode; |
793 | struct mutex f_pos_lock; | ||
790 | loff_t f_pos; | 794 | loff_t f_pos; |
791 | struct fown_struct f_owner; | 795 | struct fown_struct f_owner; |
792 | const struct cred *f_cred; | 796 | const struct cred *f_cred; |
@@ -808,7 +812,7 @@ struct file { | |||
808 | #ifdef CONFIG_DEBUG_WRITECOUNT | 812 | #ifdef CONFIG_DEBUG_WRITECOUNT |
809 | unsigned long f_mnt_write_state; | 813 | unsigned long f_mnt_write_state; |
810 | #endif | 814 | #endif |
811 | }; | 815 | } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ |
812 | 816 | ||
813 | struct file_handle { | 817 | struct file_handle { |
814 | __u32 handle_bytes; | 818 | __u32 handle_bytes; |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 3d286ff49ab0..64cf3ef50696 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -99,7 +99,7 @@ struct fsnotify_ops { | |||
99 | struct fsnotify_mark *inode_mark, | 99 | struct fsnotify_mark *inode_mark, |
100 | struct fsnotify_mark *vfsmount_mark, | 100 | struct fsnotify_mark *vfsmount_mark, |
101 | u32 mask, void *data, int data_type, | 101 | u32 mask, void *data, int data_type, |
102 | const unsigned char *file_name); | 102 | const unsigned char *file_name, u32 cookie); |
103 | void (*free_group_priv)(struct fsnotify_group *group); | 103 | void (*free_group_priv)(struct fsnotify_group *group); |
104 | void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); | 104 | void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); |
105 | void (*free_event)(struct fsnotify_event *event); | 105 | void (*free_event)(struct fsnotify_event *event); |
@@ -160,7 +160,7 @@ struct fsnotify_group { | |||
160 | 160 | ||
161 | struct fasync_struct *fsn_fa; /* async notification */ | 161 | struct fasync_struct *fsn_fa; /* async notification */ |
162 | 162 | ||
163 | struct fsnotify_event overflow_event; /* Event we queue when the | 163 | struct fsnotify_event *overflow_event; /* Event we queue when the |
164 | * notification list is too | 164 | * notification list is too |
165 | * full */ | 165 | * full */ |
166 | 166 | ||
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4e4cc28623ad..4cdb3a17bcb5 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -495,10 +495,6 @@ enum { | |||
495 | FILTER_TRACE_FN, | 495 | FILTER_TRACE_FN, |
496 | }; | 496 | }; |
497 | 497 | ||
498 | #define EVENT_STORAGE_SIZE 128 | ||
499 | extern struct mutex event_storage_mutex; | ||
500 | extern char event_storage[EVENT_STORAGE_SIZE]; | ||
501 | |||
502 | extern int trace_event_raw_init(struct ftrace_event_call *call); | 498 | extern int trace_event_raw_init(struct ftrace_event_call *call); |
503 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, | 499 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, |
504 | const char *name, int offset, int size, | 500 | const char *name, int offset, int size, |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 0437439bc047..39b81dc7d01a 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -123,6 +123,10 @@ struct vm_area_struct; | |||
123 | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ | 123 | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ |
124 | __GFP_NO_KSWAPD) | 124 | __GFP_NO_KSWAPD) |
125 | 125 | ||
126 | /* | ||
127 | * GFP_THISNODE does not perform any reclaim, you most likely want to | ||
128 | * use __GFP_THISNODE to allocate from a given node without fallback! | ||
129 | */ | ||
126 | #ifdef CONFIG_NUMA | 130 | #ifdef CONFIG_NUMA |
127 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) | 131 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) |
128 | #else | 132 | #else |
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index db512014e061..b826239bdce0 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h | |||
@@ -157,46 +157,6 @@ static inline int hpage_nr_pages(struct page *page) | |||
157 | return HPAGE_PMD_NR; | 157 | return HPAGE_PMD_NR; |
158 | return 1; | 158 | return 1; |
159 | } | 159 | } |
160 | /* | ||
161 | * compound_trans_head() should be used instead of compound_head(), | ||
162 | * whenever the "page" passed as parameter could be the tail of a | ||
163 | * transparent hugepage that could be undergoing a | ||
164 | * __split_huge_page_refcount(). The page structure layout often | ||
165 | * changes across releases and it makes extensive use of unions. So if | ||
166 | * the page structure layout will change in a way that | ||
167 | * page->first_page gets clobbered by __split_huge_page_refcount, the | ||
168 | * implementation making use of smp_rmb() will be required. | ||
169 | * | ||
170 | * Currently we define compound_trans_head as compound_head, because | ||
171 | * page->private is in the same union with page->first_page, and | ||
172 | * page->private isn't clobbered. However this also means we're | ||
173 | * currently leaving dirt into the page->private field of anonymous | ||
174 | * pages resulting from a THP split, instead of setting page->private | ||
175 | * to zero like for every other page that has PG_private not set. But | ||
176 | * anonymous pages don't use page->private so this is not a problem. | ||
177 | */ | ||
178 | #if 0 | ||
179 | /* This will be needed if page->private will be clobbered in split_huge_page */ | ||
180 | static inline struct page *compound_trans_head(struct page *page) | ||
181 | { | ||
182 | if (PageTail(page)) { | ||
183 | struct page *head; | ||
184 | head = page->first_page; | ||
185 | smp_rmb(); | ||
186 | /* | ||
187 | * head may be a dangling pointer. | ||
188 | * __split_huge_page_refcount clears PageTail before | ||
189 | * overwriting first_page, so if PageTail is still | ||
190 | * there it means the head pointer isn't dangling. | ||
191 | */ | ||
192 | if (PageTail(page)) | ||
193 | return head; | ||
194 | } | ||
195 | return page; | ||
196 | } | ||
197 | #else | ||
198 | #define compound_trans_head(page) compound_head(page) | ||
199 | #endif | ||
200 | 160 | ||
201 | extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | 161 | extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, |
202 | unsigned long addr, pmd_t pmd, pmd_t *pmdp); | 162 | unsigned long addr, pmd_t pmd, pmd_t *pmdp); |
@@ -226,7 +186,6 @@ static inline int split_huge_page(struct page *page) | |||
226 | do { } while (0) | 186 | do { } while (0) |
227 | #define split_huge_page_pmd_mm(__mm, __address, __pmd) \ | 187 | #define split_huge_page_pmd_mm(__mm, __address, __pmd) \ |
228 | do { } while (0) | 188 | do { } while (0) |
229 | #define compound_trans_head(page) compound_head(page) | ||
230 | static inline int hugepage_madvise(struct vm_area_struct *vma, | 189 | static inline int hugepage_madvise(struct vm_area_struct *vma, |
231 | unsigned long *vm_flags, int advice) | 190 | unsigned long *vm_flags, int advice) |
232 | { | 191 | { |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index e7831d203737..35e7eca4e33b 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -118,9 +118,7 @@ extern int mq_init_ns(struct ipc_namespace *ns); | |||
118 | * the new maximum will handle anyone else. I may have to revisit this | 118 | * the new maximum will handle anyone else. I may have to revisit this |
119 | * in the future. | 119 | * in the future. |
120 | */ | 120 | */ |
121 | #define MIN_QUEUESMAX 1 | ||
122 | #define DFLT_QUEUESMAX 256 | 121 | #define DFLT_QUEUESMAX 256 |
123 | #define HARD_QUEUESMAX 1024 | ||
124 | #define MIN_MSGMAX 1 | 122 | #define MIN_MSGMAX 1 |
125 | #define DFLT_MSG 10U | 123 | #define DFLT_MSG 10U |
126 | #define DFLT_MSGMAX 10 | 124 | #define DFLT_MSGMAX 10 |
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 5be9f0228a3b..d267623c28cf 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
@@ -249,7 +249,8 @@ void kernfs_notify(struct kernfs_node *kn); | |||
249 | 249 | ||
250 | const void *kernfs_super_ns(struct super_block *sb); | 250 | const void *kernfs_super_ns(struct super_block *sb); |
251 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | 251 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
252 | struct kernfs_root *root, const void *ns); | 252 | struct kernfs_root *root, bool *new_sb_created, |
253 | const void *ns); | ||
253 | void kernfs_kill_sb(struct super_block *sb); | 254 | void kernfs_kill_sb(struct super_block *sb); |
254 | 255 | ||
255 | void kernfs_init(void); | 256 | void kernfs_init(void); |
@@ -317,7 +318,7 @@ static inline const void *kernfs_super_ns(struct super_block *sb) | |||
317 | 318 | ||
318 | static inline struct dentry * | 319 | static inline struct dentry * |
319 | kernfs_mount_ns(struct file_system_type *fs_type, int flags, | 320 | kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
320 | struct kernfs_root *root, const void *ns) | 321 | struct kernfs_root *root, bool *new_sb_created, const void *ns) |
321 | { return ERR_PTR(-ENOSYS); } | 322 | { return ERR_PTR(-ENOSYS); } |
322 | 323 | ||
323 | static inline void kernfs_kill_sb(struct super_block *sb) { } | 324 | static inline void kernfs_kill_sb(struct super_block *sb) { } |
@@ -368,9 +369,9 @@ static inline int kernfs_remove_by_name(struct kernfs_node *parent, | |||
368 | 369 | ||
369 | static inline struct dentry * | 370 | static inline struct dentry * |
370 | kernfs_mount(struct file_system_type *fs_type, int flags, | 371 | kernfs_mount(struct file_system_type *fs_type, int flags, |
371 | struct kernfs_root *root) | 372 | struct kernfs_root *root, bool *new_sb_created) |
372 | { | 373 | { |
373 | return kernfs_mount_ns(fs_type, flags, root, NULL); | 374 | return kernfs_mount_ns(fs_type, flags, root, new_sb_created, NULL); |
374 | } | 375 | } |
375 | 376 | ||
376 | #endif /* __LINUX_KERNFS_H */ | 377 | #endif /* __LINUX_KERNFS_H */ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index f28f46eade6a..c1b7414c7bef 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -175,7 +175,7 @@ extern unsigned int kobjsize(const void *objp); | |||
175 | * Special vmas that are non-mergable, non-mlock()able. | 175 | * Special vmas that are non-mergable, non-mlock()able. |
176 | * Note: mm/huge_memory.c VM_NO_THP depends on this definition. | 176 | * Note: mm/huge_memory.c VM_NO_THP depends on this definition. |
177 | */ | 177 | */ |
178 | #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP) | 178 | #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP) |
179 | 179 | ||
180 | /* | 180 | /* |
181 | * mapping from the currently active vm_flags protection bits (the | 181 | * mapping from the currently active vm_flags protection bits (the |
@@ -399,8 +399,18 @@ static inline void compound_unlock_irqrestore(struct page *page, | |||
399 | 399 | ||
400 | static inline struct page *compound_head(struct page *page) | 400 | static inline struct page *compound_head(struct page *page) |
401 | { | 401 | { |
402 | if (unlikely(PageTail(page))) | 402 | if (unlikely(PageTail(page))) { |
403 | return page->first_page; | 403 | struct page *head = page->first_page; |
404 | |||
405 | /* | ||
406 | * page->first_page may be a dangling pointer to an old | ||
407 | * compound page, so recheck that it is still a tail | ||
408 | * page before returning. | ||
409 | */ | ||
410 | smp_rmb(); | ||
411 | if (likely(PageTail(page))) | ||
412 | return head; | ||
413 | } | ||
404 | return page; | 414 | return page; |
405 | } | 415 | } |
406 | 416 | ||
@@ -757,7 +767,7 @@ static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid) | |||
757 | #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS | 767 | #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS |
758 | static inline int page_cpupid_xchg_last(struct page *page, int cpupid) | 768 | static inline int page_cpupid_xchg_last(struct page *page, int cpupid) |
759 | { | 769 | { |
760 | return xchg(&page->_last_cpupid, cpupid); | 770 | return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK); |
761 | } | 771 | } |
762 | 772 | ||
763 | static inline int page_cpupid_last(struct page *page) | 773 | static inline int page_cpupid_last(struct page *page) |
@@ -766,7 +776,7 @@ static inline int page_cpupid_last(struct page *page) | |||
766 | } | 776 | } |
767 | static inline void page_cpupid_reset_last(struct page *page) | 777 | static inline void page_cpupid_reset_last(struct page *page) |
768 | { | 778 | { |
769 | page->_last_cpupid = -1; | 779 | page->_last_cpupid = -1 & LAST_CPUPID_MASK; |
770 | } | 780 | } |
771 | #else | 781 | #else |
772 | static inline int page_cpupid_last(struct page *page) | 782 | static inline int page_cpupid_last(struct page *page) |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 5f2052c83154..9b61b9bf81ac 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -590,10 +590,10 @@ static inline bool zone_is_empty(struct zone *zone) | |||
590 | 590 | ||
591 | /* | 591 | /* |
592 | * The NUMA zonelists are doubled because we need zonelists that restrict the | 592 | * The NUMA zonelists are doubled because we need zonelists that restrict the |
593 | * allocations to a single node for GFP_THISNODE. | 593 | * allocations to a single node for __GFP_THISNODE. |
594 | * | 594 | * |
595 | * [0] : Zonelist with fallback | 595 | * [0] : Zonelist with fallback |
596 | * [1] : No fallback (GFP_THISNODE) | 596 | * [1] : No fallback (__GFP_THISNODE) |
597 | */ | 597 | */ |
598 | #define MAX_ZONELISTS 2 | 598 | #define MAX_ZONELISTS 2 |
599 | 599 | ||
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index b2fb167b2e6d..5624e4e2763c 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -467,9 +467,14 @@ struct nfs_lockt_res { | |||
467 | }; | 467 | }; |
468 | 468 | ||
469 | struct nfs_release_lockowner_args { | 469 | struct nfs_release_lockowner_args { |
470 | struct nfs4_sequence_args seq_args; | ||
470 | struct nfs_lowner lock_owner; | 471 | struct nfs_lowner lock_owner; |
471 | }; | 472 | }; |
472 | 473 | ||
474 | struct nfs_release_lockowner_res { | ||
475 | struct nfs4_sequence_res seq_res; | ||
476 | }; | ||
477 | |||
473 | struct nfs4_delegreturnargs { | 478 | struct nfs4_delegreturnargs { |
474 | struct nfs4_sequence_args seq_args; | 479 | struct nfs4_sequence_args seq_args; |
475 | const struct nfs_fh *fhandle; | 480 | const struct nfs_fh *fhandle; |
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 1da693d51255..b66c2110cb1f 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -250,8 +250,7 @@ struct rmap_walk_control { | |||
250 | int (*rmap_one)(struct page *page, struct vm_area_struct *vma, | 250 | int (*rmap_one)(struct page *page, struct vm_area_struct *vma, |
251 | unsigned long addr, void *arg); | 251 | unsigned long addr, void *arg); |
252 | int (*done)(struct page *page); | 252 | int (*done)(struct page *page); |
253 | int (*file_nonlinear)(struct page *, struct address_space *, | 253 | int (*file_nonlinear)(struct page *, struct address_space *, void *arg); |
254 | struct vm_area_struct *vma); | ||
255 | struct anon_vma *(*anon_lock)(struct page *page); | 254 | struct anon_vma *(*anon_lock)(struct page *page); |
256 | bool (*invalid_vma)(struct vm_area_struct *vma, void *arg); | 255 | bool (*invalid_vma)(struct vm_area_struct *vma, void *arg); |
257 | }; | 256 | }; |
diff --git a/include/linux/security.h b/include/linux/security.h index 5623a7f965b7..2fc42d191f79 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1040,6 +1040,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1040 | * Allocate a security structure to the xp->security field; the security | 1040 | * Allocate a security structure to the xp->security field; the security |
1041 | * field is initialized to NULL when the xfrm_policy is allocated. | 1041 | * field is initialized to NULL when the xfrm_policy is allocated. |
1042 | * Return 0 if operation was successful (memory to allocate, legal context) | 1042 | * Return 0 if operation was successful (memory to allocate, legal context) |
1043 | * @gfp is to specify the context for the allocation | ||
1043 | * @xfrm_policy_clone_security: | 1044 | * @xfrm_policy_clone_security: |
1044 | * @old_ctx contains an existing xfrm_sec_ctx. | 1045 | * @old_ctx contains an existing xfrm_sec_ctx. |
1045 | * @new_ctxp contains a new xfrm_sec_ctx being cloned from old. | 1046 | * @new_ctxp contains a new xfrm_sec_ctx being cloned from old. |
@@ -1683,7 +1684,7 @@ struct security_operations { | |||
1683 | 1684 | ||
1684 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1685 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
1685 | int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp, | 1686 | int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp, |
1686 | struct xfrm_user_sec_ctx *sec_ctx); | 1687 | struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp); |
1687 | int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); | 1688 | int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); |
1688 | void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); | 1689 | void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); |
1689 | int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); | 1690 | int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); |
@@ -2859,7 +2860,8 @@ static inline void security_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |||
2859 | 2860 | ||
2860 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 2861 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
2861 | 2862 | ||
2862 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx); | 2863 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
2864 | struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp); | ||
2863 | int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp); | 2865 | int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp); |
2864 | void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx); | 2866 | void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx); |
2865 | int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx); | 2867 | int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx); |
@@ -2877,7 +2879,9 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); | |||
2877 | 2879 | ||
2878 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ | 2880 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ |
2879 | 2881 | ||
2880 | static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx) | 2882 | static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
2883 | struct xfrm_user_sec_ctx *sec_ctx, | ||
2884 | gfp_t gfp) | ||
2881 | { | 2885 | { |
2882 | return 0; | 2886 | return 0; |
2883 | } | 2887 | } |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 3ebbbe7b6d05..5e1e6f2d98c2 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2725,7 +2725,7 @@ static inline void nf_reset(struct sk_buff *skb) | |||
2725 | 2725 | ||
2726 | static inline void nf_reset_trace(struct sk_buff *skb) | 2726 | static inline void nf_reset_trace(struct sk_buff *skb) |
2727 | { | 2727 | { |
2728 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) | 2728 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES) |
2729 | skb->nf_trace = 0; | 2729 | skb->nf_trace = 0; |
2730 | #endif | 2730 | #endif |
2731 | } | 2731 | } |
@@ -2742,6 +2742,9 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) | |||
2742 | dst->nf_bridge = src->nf_bridge; | 2742 | dst->nf_bridge = src->nf_bridge; |
2743 | nf_bridge_get(src->nf_bridge); | 2743 | nf_bridge_get(src->nf_bridge); |
2744 | #endif | 2744 | #endif |
2745 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES) | ||
2746 | dst->nf_trace = src->nf_trace; | ||
2747 | #endif | ||
2745 | } | 2748 | } |
2746 | 2749 | ||
2747 | static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src) | 2750 | static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src) |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 9260abdd67df..b5b2df60299e 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -410,7 +410,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | |||
410 | * | 410 | * |
411 | * %GFP_NOWAIT - Allocation will not sleep. | 411 | * %GFP_NOWAIT - Allocation will not sleep. |
412 | * | 412 | * |
413 | * %GFP_THISNODE - Allocate node-local memory only. | 413 | * %__GFP_THISNODE - Allocate node-local memory only. |
414 | * | 414 | * |
415 | * %GFP_DMA - Allocation suitable for DMA. | 415 | * %GFP_DMA - Allocation suitable for DMA. |
416 | * Should only be used for kmalloc() caches. Otherwise, use a | 416 | * Should only be used for kmalloc() caches. Otherwise, use a |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 4203c66d8803..36c86ef51ff3 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -24,6 +24,9 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/kthread.h> | 25 | #include <linux/kthread.h> |
26 | #include <linux/completion.h> | 26 | #include <linux/completion.h> |
27 | #include <linux/scatterlist.h> | ||
28 | |||
29 | struct dma_chan; | ||
27 | 30 | ||
28 | /* | 31 | /* |
29 | * INTERFACES between SPI master-side drivers and SPI infrastructure. | 32 | * INTERFACES between SPI master-side drivers and SPI infrastructure. |
@@ -266,6 +269,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
266 | * @auto_runtime_pm: the core should ensure a runtime PM reference is held | 269 | * @auto_runtime_pm: the core should ensure a runtime PM reference is held |
267 | * while the hardware is prepared, using the parent | 270 | * while the hardware is prepared, using the parent |
268 | * device for the spidev | 271 | * device for the spidev |
272 | * @max_dma_len: Maximum length of a DMA transfer for the device. | ||
269 | * @prepare_transfer_hardware: a message will soon arrive from the queue | 273 | * @prepare_transfer_hardware: a message will soon arrive from the queue |
270 | * so the subsystem requests the driver to prepare the transfer hardware | 274 | * so the subsystem requests the driver to prepare the transfer hardware |
271 | * by issuing this call | 275 | * by issuing this call |
@@ -348,6 +352,8 @@ struct spi_master { | |||
348 | #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ | 352 | #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ |
349 | #define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ | 353 | #define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ |
350 | #define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ | 354 | #define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ |
355 | #define SPI_MASTER_MUST_RX BIT(3) /* requires rx */ | ||
356 | #define SPI_MASTER_MUST_TX BIT(4) /* requires tx */ | ||
351 | 357 | ||
352 | /* lock and mutex for SPI bus locking */ | 358 | /* lock and mutex for SPI bus locking */ |
353 | spinlock_t bus_lock_spinlock; | 359 | spinlock_t bus_lock_spinlock; |
@@ -390,6 +396,17 @@ struct spi_master { | |||
390 | void (*cleanup)(struct spi_device *spi); | 396 | void (*cleanup)(struct spi_device *spi); |
391 | 397 | ||
392 | /* | 398 | /* |
399 | * Used to enable core support for DMA handling, if can_dma() | ||
400 | * exists and returns true then the transfer will be mapped | ||
401 | * prior to transfer_one() being called. The driver should | ||
402 | * not modify or store xfer and dma_tx and dma_rx must be set | ||
403 | * while the device is prepared. | ||
404 | */ | ||
405 | bool (*can_dma)(struct spi_master *master, | ||
406 | struct spi_device *spi, | ||
407 | struct spi_transfer *xfer); | ||
408 | |||
409 | /* | ||
393 | * These hooks are for drivers that want to use the generic | 410 | * These hooks are for drivers that want to use the generic |
394 | * master transfer queueing mechanism. If these are used, the | 411 | * master transfer queueing mechanism. If these are used, the |
395 | * transfer() function above must NOT be specified by the driver. | 412 | * transfer() function above must NOT be specified by the driver. |
@@ -407,7 +424,9 @@ struct spi_master { | |||
407 | bool rt; | 424 | bool rt; |
408 | bool auto_runtime_pm; | 425 | bool auto_runtime_pm; |
409 | bool cur_msg_prepared; | 426 | bool cur_msg_prepared; |
427 | bool cur_msg_mapped; | ||
410 | struct completion xfer_completion; | 428 | struct completion xfer_completion; |
429 | size_t max_dma_len; | ||
411 | 430 | ||
412 | int (*prepare_transfer_hardware)(struct spi_master *master); | 431 | int (*prepare_transfer_hardware)(struct spi_master *master); |
413 | int (*transfer_one_message)(struct spi_master *master, | 432 | int (*transfer_one_message)(struct spi_master *master, |
@@ -428,6 +447,14 @@ struct spi_master { | |||
428 | 447 | ||
429 | /* gpio chip select */ | 448 | /* gpio chip select */ |
430 | int *cs_gpios; | 449 | int *cs_gpios; |
450 | |||
451 | /* DMA channels for use with core dmaengine helpers */ | ||
452 | struct dma_chan *dma_tx; | ||
453 | struct dma_chan *dma_rx; | ||
454 | |||
455 | /* dummy data for full duplex devices */ | ||
456 | void *dummy_rx; | ||
457 | void *dummy_tx; | ||
431 | }; | 458 | }; |
432 | 459 | ||
433 | static inline void *spi_master_get_devdata(struct spi_master *master) | 460 | static inline void *spi_master_get_devdata(struct spi_master *master) |
@@ -512,6 +539,8 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
512 | * (optionally) changing the chipselect status, then starting | 539 | * (optionally) changing the chipselect status, then starting |
513 | * the next transfer or completing this @spi_message. | 540 | * the next transfer or completing this @spi_message. |
514 | * @transfer_list: transfers are sequenced through @spi_message.transfers | 541 | * @transfer_list: transfers are sequenced through @spi_message.transfers |
542 | * @tx_sg: Scatterlist for transmit, currently not for client use | ||
543 | * @rx_sg: Scatterlist for receive, currently not for client use | ||
515 | * | 544 | * |
516 | * SPI transfers always write the same number of bytes as they read. | 545 | * SPI transfers always write the same number of bytes as they read. |
517 | * Protocol drivers should always provide @rx_buf and/or @tx_buf. | 546 | * Protocol drivers should always provide @rx_buf and/or @tx_buf. |
@@ -579,6 +608,8 @@ struct spi_transfer { | |||
579 | 608 | ||
580 | dma_addr_t tx_dma; | 609 | dma_addr_t tx_dma; |
581 | dma_addr_t rx_dma; | 610 | dma_addr_t rx_dma; |
611 | struct sg_table tx_sg; | ||
612 | struct sg_table rx_sg; | ||
582 | 613 | ||
583 | unsigned cs_change:1; | 614 | unsigned cs_change:1; |
584 | unsigned tx_nbits:3; | 615 | unsigned tx_nbits:3; |
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index daebaba886aa..85578d4be034 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -42,6 +42,6 @@ extern int spi_bitbang_setup_transfer(struct spi_device *spi, | |||
42 | 42 | ||
43 | /* start or stop queue processing */ | 43 | /* start or stop queue processing */ |
44 | extern int spi_bitbang_start(struct spi_bitbang *spi); | 44 | extern int spi_bitbang_start(struct spi_bitbang *spi); |
45 | extern int spi_bitbang_stop(struct spi_bitbang *spi); | 45 | extern void spi_bitbang_stop(struct spi_bitbang *spi); |
46 | 46 | ||
47 | #endif /* __SPI_BITBANG_H */ | 47 | #endif /* __SPI_BITBANG_H */ |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index accc497f8d72..7159a0a933df 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -60,6 +60,12 @@ struct tp_module { | |||
60 | unsigned int num_tracepoints; | 60 | unsigned int num_tracepoints; |
61 | struct tracepoint * const *tracepoints_ptrs; | 61 | struct tracepoint * const *tracepoints_ptrs; |
62 | }; | 62 | }; |
63 | bool trace_module_has_bad_taint(struct module *mod); | ||
64 | #else | ||
65 | static inline bool trace_module_has_bad_taint(struct module *mod) | ||
66 | { | ||
67 | return false; | ||
68 | } | ||
63 | #endif /* CONFIG_MODULES */ | 69 | #endif /* CONFIG_MODULES */ |
64 | 70 | ||
65 | struct tracepoint_iter { | 71 | struct tracepoint_iter { |
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h index c3fa80745996..2c14d9cdd57a 100644 --- a/include/linux/usb/cdc_ncm.h +++ b/include/linux/usb/cdc_ncm.h | |||
@@ -88,6 +88,7 @@ | |||
88 | #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) | 88 | #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) |
89 | 89 | ||
90 | struct cdc_ncm_ctx { | 90 | struct cdc_ncm_ctx { |
91 | struct usb_cdc_ncm_ntb_parameters ncm_parm; | ||
91 | struct hrtimer tx_timer; | 92 | struct hrtimer tx_timer; |
92 | struct tasklet_struct bh; | 93 | struct tasklet_struct bh; |
93 | 94 | ||
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index fc0e4320aa6d..021b8a319b9e 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -97,7 +97,7 @@ void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | |||
97 | int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); | 97 | int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); |
98 | int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | 98 | int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, |
99 | enum wb_reason reason); | 99 | enum wb_reason reason); |
100 | void sync_inodes_sb(struct super_block *sb, unsigned long older_than_this); | 100 | void sync_inodes_sb(struct super_block *); |
101 | void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); | 101 | void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); |
102 | void inode_wait_for_writeback(struct inode *inode); | 102 | void inode_wait_for_writeback(struct inode *inode); |
103 | 103 | ||
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 48ed75c21260..e77c10405d51 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
@@ -129,6 +129,7 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[], | |||
129 | int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], | 129 | int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], |
130 | struct ip_tunnel_parm *p); | 130 | struct ip_tunnel_parm *p); |
131 | void ip_tunnel_setup(struct net_device *dev, int net_id); | 131 | void ip_tunnel_setup(struct net_device *dev, int net_id); |
132 | void ip_tunnel_dst_reset_all(struct ip_tunnel *t); | ||
132 | 133 | ||
133 | /* Extract dsfield from inner protocol */ | 134 | /* Extract dsfield from inner protocol */ |
134 | static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, | 135 | static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, |
diff --git a/include/net/sock.h b/include/net/sock.h index 5c3f7c3624aa..b9586a137cad 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1488,6 +1488,11 @@ static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) | |||
1488 | */ | 1488 | */ |
1489 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owned) | 1489 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owned) |
1490 | 1490 | ||
1491 | static inline void sock_release_ownership(struct sock *sk) | ||
1492 | { | ||
1493 | sk->sk_lock.owned = 0; | ||
1494 | } | ||
1495 | |||
1491 | /* | 1496 | /* |
1492 | * Macro so as to not evaluate some arguments when | 1497 | * Macro so as to not evaluate some arguments when |
1493 | * lockdep is not enabled. | 1498 | * lockdep is not enabled. |
@@ -2186,7 +2191,6 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, | |||
2186 | { | 2191 | { |
2187 | #define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \ | 2192 | #define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \ |
2188 | (1UL << SOCK_RCVTSTAMP) | \ | 2193 | (1UL << SOCK_RCVTSTAMP) | \ |
2189 | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \ | ||
2190 | (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \ | 2194 | (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \ |
2191 | (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \ | 2195 | (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \ |
2192 | (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE)) | 2196 | (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE)) |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 56fc366da6d5..743accec6c76 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -480,20 +480,21 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
480 | #ifdef CONFIG_SYN_COOKIES | 480 | #ifdef CONFIG_SYN_COOKIES |
481 | #include <linux/ktime.h> | 481 | #include <linux/ktime.h> |
482 | 482 | ||
483 | /* Syncookies use a monotonic timer which increments every 64 seconds. | 483 | /* Syncookies use a monotonic timer which increments every 60 seconds. |
484 | * This counter is used both as a hash input and partially encoded into | 484 | * This counter is used both as a hash input and partially encoded into |
485 | * the cookie value. A cookie is only validated further if the delta | 485 | * the cookie value. A cookie is only validated further if the delta |
486 | * between the current counter value and the encoded one is less than this, | 486 | * between the current counter value and the encoded one is less than this, |
487 | * i.e. a sent cookie is valid only at most for 128 seconds (or less if | 487 | * i.e. a sent cookie is valid only at most for 2*60 seconds (or less if |
488 | * the counter advances immediately after a cookie is generated). | 488 | * the counter advances immediately after a cookie is generated). |
489 | */ | 489 | */ |
490 | #define MAX_SYNCOOKIE_AGE 2 | 490 | #define MAX_SYNCOOKIE_AGE 2 |
491 | 491 | ||
492 | static inline u32 tcp_cookie_time(void) | 492 | static inline u32 tcp_cookie_time(void) |
493 | { | 493 | { |
494 | struct timespec now; | 494 | u64 val = get_jiffies_64(); |
495 | getnstimeofday(&now); | 495 | |
496 | return now.tv_sec >> 6; /* 64 seconds granularity */ | 496 | do_div(val, 60 * HZ); |
497 | return val; | ||
497 | } | 498 | } |
498 | 499 | ||
499 | u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, | 500 | u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, |
@@ -1303,7 +1304,8 @@ struct tcp_fastopen_request { | |||
1303 | /* Fast Open cookie. Size 0 means a cookie request */ | 1304 | /* Fast Open cookie. Size 0 means a cookie request */ |
1304 | struct tcp_fastopen_cookie cookie; | 1305 | struct tcp_fastopen_cookie cookie; |
1305 | struct msghdr *data; /* data in MSG_FASTOPEN */ | 1306 | struct msghdr *data; /* data in MSG_FASTOPEN */ |
1306 | u16 copied; /* queued in tcp_connect() */ | 1307 | size_t size; |
1308 | int copied; /* queued in tcp_connect() */ | ||
1307 | }; | 1309 | }; |
1308 | void tcp_free_fastopen_req(struct tcp_sock *tp); | 1310 | void tcp_free_fastopen_req(struct tcp_sock *tp); |
1309 | 1311 | ||
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index afa5730fb3bd..fb5654a8ca3c 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -1648,6 +1648,11 @@ static inline int xfrm_aevent_is_on(struct net *net) | |||
1648 | } | 1648 | } |
1649 | #endif | 1649 | #endif |
1650 | 1650 | ||
1651 | static inline int aead_len(struct xfrm_algo_aead *alg) | ||
1652 | { | ||
1653 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | ||
1654 | } | ||
1655 | |||
1651 | static inline int xfrm_alg_len(const struct xfrm_algo *alg) | 1656 | static inline int xfrm_alg_len(const struct xfrm_algo *alg) |
1652 | { | 1657 | { |
1653 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | 1658 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); |
@@ -1686,6 +1691,12 @@ static inline int xfrm_replay_clone(struct xfrm_state *x, | |||
1686 | return 0; | 1691 | return 0; |
1687 | } | 1692 | } |
1688 | 1693 | ||
1694 | static inline struct xfrm_algo_aead *xfrm_algo_aead_clone(struct xfrm_algo_aead *orig) | ||
1695 | { | ||
1696 | return kmemdup(orig, aead_len(orig), GFP_KERNEL); | ||
1697 | } | ||
1698 | |||
1699 | |||
1689 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) | 1700 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) |
1690 | { | 1701 | { |
1691 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); | 1702 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 68d92e36facd..6e89ef6c11c1 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -449,14 +449,22 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | |||
449 | /* dapm audio pin control and status */ | 449 | /* dapm audio pin control and status */ |
450 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, | 450 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, |
451 | const char *pin); | 451 | const char *pin); |
452 | int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
453 | const char *pin); | ||
452 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, | 454 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, |
453 | const char *pin); | 455 | const char *pin); |
456 | int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
457 | const char *pin); | ||
454 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); | 458 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); |
459 | int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
460 | const char *pin); | ||
455 | int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, | 461 | int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, |
456 | const char *pin); | 462 | const char *pin); |
457 | int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); | 463 | int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); |
458 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | 464 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, |
459 | const char *pin); | 465 | const char *pin); |
466 | int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
467 | const char *pin); | ||
460 | int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, | 468 | int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, |
461 | const char *pin); | 469 | const char *pin); |
462 | void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); | 470 | void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); |
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h index ae5a17111968..4483fadfa68d 100644 --- a/include/target/iscsi/iscsi_transport.h +++ b/include/target/iscsi/iscsi_transport.h | |||
@@ -12,6 +12,7 @@ struct iscsit_transport { | |||
12 | int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *); | 12 | int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *); |
13 | int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *); | 13 | int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *); |
14 | void (*iscsit_free_np)(struct iscsi_np *); | 14 | void (*iscsit_free_np)(struct iscsi_np *); |
15 | void (*iscsit_wait_conn)(struct iscsi_conn *); | ||
15 | void (*iscsit_free_conn)(struct iscsi_conn *); | 16 | void (*iscsit_free_conn)(struct iscsi_conn *); |
16 | int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *); | 17 | int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *); |
17 | int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32); | 18 | int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32); |
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index ddc179b7a105..1fef3e6e9436 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h | |||
@@ -83,7 +83,7 @@ DECLARE_EVENT_CLASS(rpc_task_running, | |||
83 | ), | 83 | ), |
84 | 84 | ||
85 | TP_fast_assign( | 85 | TP_fast_assign( |
86 | __entry->client_id = clnt->cl_clid; | 86 | __entry->client_id = clnt ? clnt->cl_clid : -1; |
87 | __entry->task_id = task->tk_pid; | 87 | __entry->task_id = task->tk_pid; |
88 | __entry->action = action; | 88 | __entry->action = action; |
89 | __entry->runstate = task->tk_runstate; | 89 | __entry->runstate = task->tk_runstate; |
@@ -91,7 +91,7 @@ DECLARE_EVENT_CLASS(rpc_task_running, | |||
91 | __entry->flags = task->tk_flags; | 91 | __entry->flags = task->tk_flags; |
92 | ), | 92 | ), |
93 | 93 | ||
94 | TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d action=%pf", | 94 | TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf", |
95 | __entry->task_id, __entry->client_id, | 95 | __entry->task_id, __entry->client_id, |
96 | __entry->flags, | 96 | __entry->flags, |
97 | __entry->runstate, | 97 | __entry->runstate, |
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index c7bbbe794e65..464ea82e10db 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -287,11 +287,11 @@ TRACE_EVENT(writeback_queue_io, | |||
287 | __field(int, reason) | 287 | __field(int, reason) |
288 | ), | 288 | ), |
289 | TP_fast_assign( | 289 | TP_fast_assign( |
290 | unsigned long older_than_this = work->older_than_this; | 290 | unsigned long *older_than_this = work->older_than_this; |
291 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); | 291 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); |
292 | __entry->older = older_than_this; | 292 | __entry->older = older_than_this ? *older_than_this : 0; |
293 | __entry->age = older_than_this ? | 293 | __entry->age = older_than_this ? |
294 | (jiffies - older_than_this) * 1000 / HZ : -1; | 294 | (jiffies - *older_than_this) * 1000 / HZ : -1; |
295 | __entry->moved = moved; | 295 | __entry->moved = moved; |
296 | __entry->reason = work->reason; | 296 | __entry->reason = work->reason; |
297 | ), | 297 | ), |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 1a8b28db3775..1ee19a24cc5f 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -310,15 +310,12 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | |||
310 | #undef __array | 310 | #undef __array |
311 | #define __array(type, item, len) \ | 311 | #define __array(type, item, len) \ |
312 | do { \ | 312 | do { \ |
313 | mutex_lock(&event_storage_mutex); \ | 313 | char *type_str = #type"["__stringify(len)"]"; \ |
314 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 314 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
315 | snprintf(event_storage, sizeof(event_storage), \ | 315 | ret = trace_define_field(event_call, type_str, #item, \ |
316 | "%s[%d]", #type, len); \ | ||
317 | ret = trace_define_field(event_call, event_storage, #item, \ | ||
318 | offsetof(typeof(field), item), \ | 316 | offsetof(typeof(field), item), \ |
319 | sizeof(field.item), \ | 317 | sizeof(field.item), \ |
320 | is_signed_type(type), FILTER_OTHER); \ | 318 | is_signed_type(type), FILTER_OTHER); \ |
321 | mutex_unlock(&event_storage_mutex); \ | ||
322 | if (ret) \ | 319 | if (ret) \ |
323 | return ret; \ | 320 | return ret; \ |
324 | } while (0); | 321 | } while (0); |
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index a20a9b4d3871..dde8041f40d2 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h | |||
@@ -692,9 +692,13 @@ __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ | |||
692 | __SYSCALL(__NR_kcmp, sys_kcmp) | 692 | __SYSCALL(__NR_kcmp, sys_kcmp) |
693 | #define __NR_finit_module 273 | 693 | #define __NR_finit_module 273 |
694 | __SYSCALL(__NR_finit_module, sys_finit_module) | 694 | __SYSCALL(__NR_finit_module, sys_finit_module) |
695 | #define __NR_sched_setattr 274 | ||
696 | __SYSCALL(__NR_sched_setattr, sys_sched_setattr) | ||
697 | #define __NR_sched_getattr 275 | ||
698 | __SYSCALL(__NR_sched_getattr, sys_sched_getattr) | ||
695 | 699 | ||
696 | #undef __NR_syscalls | 700 | #undef __NR_syscalls |
697 | #define __NR_syscalls 274 | 701 | #define __NR_syscalls 276 |
698 | 702 | ||
699 | /* | 703 | /* |
700 | * All syscalls below here should go away really, | 704 | * All syscalls below here should go away really, |
diff --git a/init/main.c b/init/main.c index eb03090cdced..9c7fd4c9249f 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -561,7 +561,6 @@ asmlinkage void __init start_kernel(void) | |||
561 | init_timers(); | 561 | init_timers(); |
562 | hrtimers_init(); | 562 | hrtimers_init(); |
563 | softirq_init(); | 563 | softirq_init(); |
564 | acpi_early_init(); | ||
565 | timekeeping_init(); | 564 | timekeeping_init(); |
566 | time_init(); | 565 | time_init(); |
567 | sched_clock_postinit(); | 566 | sched_clock_postinit(); |
@@ -613,6 +612,7 @@ asmlinkage void __init start_kernel(void) | |||
613 | calibrate_delay(); | 612 | calibrate_delay(); |
614 | pidmap_init(); | 613 | pidmap_init(); |
615 | anon_vma_init(); | 614 | anon_vma_init(); |
615 | acpi_early_init(); | ||
616 | #ifdef CONFIG_X86 | 616 | #ifdef CONFIG_X86 |
617 | if (efi_enabled(EFI_RUNTIME_SERVICES)) | 617 | if (efi_enabled(EFI_RUNTIME_SERVICES)) |
618 | efi_enter_virtual_mode(); | 618 | efi_enter_virtual_mode(); |
diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c index 383d638340b8..5bb8bfe67149 100644 --- a/ipc/mq_sysctl.c +++ b/ipc/mq_sysctl.c | |||
@@ -22,6 +22,16 @@ static void *get_mq(ctl_table *table) | |||
22 | return which; | 22 | return which; |
23 | } | 23 | } |
24 | 24 | ||
25 | static int proc_mq_dointvec(ctl_table *table, int write, | ||
26 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
27 | { | ||
28 | struct ctl_table mq_table; | ||
29 | memcpy(&mq_table, table, sizeof(mq_table)); | ||
30 | mq_table.data = get_mq(table); | ||
31 | |||
32 | return proc_dointvec(&mq_table, write, buffer, lenp, ppos); | ||
33 | } | ||
34 | |||
25 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, | 35 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, |
26 | void __user *buffer, size_t *lenp, loff_t *ppos) | 36 | void __user *buffer, size_t *lenp, loff_t *ppos) |
27 | { | 37 | { |
@@ -33,12 +43,10 @@ static int proc_mq_dointvec_minmax(ctl_table *table, int write, | |||
33 | lenp, ppos); | 43 | lenp, ppos); |
34 | } | 44 | } |
35 | #else | 45 | #else |
46 | #define proc_mq_dointvec NULL | ||
36 | #define proc_mq_dointvec_minmax NULL | 47 | #define proc_mq_dointvec_minmax NULL |
37 | #endif | 48 | #endif |
38 | 49 | ||
39 | static int msg_queues_limit_min = MIN_QUEUESMAX; | ||
40 | static int msg_queues_limit_max = HARD_QUEUESMAX; | ||
41 | |||
42 | static int msg_max_limit_min = MIN_MSGMAX; | 50 | static int msg_max_limit_min = MIN_MSGMAX; |
43 | static int msg_max_limit_max = HARD_MSGMAX; | 51 | static int msg_max_limit_max = HARD_MSGMAX; |
44 | 52 | ||
@@ -51,9 +59,7 @@ static ctl_table mq_sysctls[] = { | |||
51 | .data = &init_ipc_ns.mq_queues_max, | 59 | .data = &init_ipc_ns.mq_queues_max, |
52 | .maxlen = sizeof(int), | 60 | .maxlen = sizeof(int), |
53 | .mode = 0644, | 61 | .mode = 0644, |
54 | .proc_handler = proc_mq_dointvec_minmax, | 62 | .proc_handler = proc_mq_dointvec, |
55 | .extra1 = &msg_queues_limit_min, | ||
56 | .extra2 = &msg_queues_limit_max, | ||
57 | }, | 63 | }, |
58 | { | 64 | { |
59 | .procname = "msg_max", | 65 | .procname = "msg_max", |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index ccf1f9fd263a..c3b31179122c 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -433,9 +433,9 @@ static int mqueue_create(struct inode *dir, struct dentry *dentry, | |||
433 | error = -EACCES; | 433 | error = -EACCES; |
434 | goto out_unlock; | 434 | goto out_unlock; |
435 | } | 435 | } |
436 | if (ipc_ns->mq_queues_count >= HARD_QUEUESMAX || | 436 | |
437 | (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && | 437 | if (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && |
438 | !capable(CAP_SYS_RESOURCE))) { | 438 | !capable(CAP_SYS_RESOURCE)) { |
439 | error = -ENOSPC; | 439 | error = -ENOSPC; |
440 | goto out_unlock; | 440 | goto out_unlock; |
441 | } | 441 | } |
@@ -901,6 +901,8 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgfl | |||
901 | return -EINVAL; | 901 | return -EINVAL; |
902 | 902 | ||
903 | if (msgflg & MSG_COPY) { | 903 | if (msgflg & MSG_COPY) { |
904 | if ((msgflg & MSG_EXCEPT) || !(msgflg & IPC_NOWAIT)) | ||
905 | return -EINVAL; | ||
904 | copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax)); | 906 | copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax)); |
905 | if (IS_ERR(copy)) | 907 | if (IS_ERR(copy)) |
906 | return PTR_ERR(copy); | 908 | return PTR_ERR(copy); |
diff --git a/kernel/audit.c b/kernel/audit.c index 34c5a2310fbf..3392d3e0254a 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -182,7 +182,7 @@ struct audit_buffer { | |||
182 | 182 | ||
183 | struct audit_reply { | 183 | struct audit_reply { |
184 | __u32 portid; | 184 | __u32 portid; |
185 | pid_t pid; | 185 | struct net *net; |
186 | struct sk_buff *skb; | 186 | struct sk_buff *skb; |
187 | }; | 187 | }; |
188 | 188 | ||
@@ -500,7 +500,7 @@ int audit_send_list(void *_dest) | |||
500 | { | 500 | { |
501 | struct audit_netlink_list *dest = _dest; | 501 | struct audit_netlink_list *dest = _dest; |
502 | struct sk_buff *skb; | 502 | struct sk_buff *skb; |
503 | struct net *net = get_net_ns_by_pid(dest->pid); | 503 | struct net *net = dest->net; |
504 | struct audit_net *aunet = net_generic(net, audit_net_id); | 504 | struct audit_net *aunet = net_generic(net, audit_net_id); |
505 | 505 | ||
506 | /* wait for parent to finish and send an ACK */ | 506 | /* wait for parent to finish and send an ACK */ |
@@ -510,6 +510,7 @@ int audit_send_list(void *_dest) | |||
510 | while ((skb = __skb_dequeue(&dest->q)) != NULL) | 510 | while ((skb = __skb_dequeue(&dest->q)) != NULL) |
511 | netlink_unicast(aunet->nlsk, skb, dest->portid, 0); | 511 | netlink_unicast(aunet->nlsk, skb, dest->portid, 0); |
512 | 512 | ||
513 | put_net(net); | ||
513 | kfree(dest); | 514 | kfree(dest); |
514 | 515 | ||
515 | return 0; | 516 | return 0; |
@@ -543,7 +544,7 @@ out_kfree_skb: | |||
543 | static int audit_send_reply_thread(void *arg) | 544 | static int audit_send_reply_thread(void *arg) |
544 | { | 545 | { |
545 | struct audit_reply *reply = (struct audit_reply *)arg; | 546 | struct audit_reply *reply = (struct audit_reply *)arg; |
546 | struct net *net = get_net_ns_by_pid(reply->pid); | 547 | struct net *net = reply->net; |
547 | struct audit_net *aunet = net_generic(net, audit_net_id); | 548 | struct audit_net *aunet = net_generic(net, audit_net_id); |
548 | 549 | ||
549 | mutex_lock(&audit_cmd_mutex); | 550 | mutex_lock(&audit_cmd_mutex); |
@@ -552,12 +553,13 @@ static int audit_send_reply_thread(void *arg) | |||
552 | /* Ignore failure. It'll only happen if the sender goes away, | 553 | /* Ignore failure. It'll only happen if the sender goes away, |
553 | because our timeout is set to infinite. */ | 554 | because our timeout is set to infinite. */ |
554 | netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); | 555 | netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); |
556 | put_net(net); | ||
555 | kfree(reply); | 557 | kfree(reply); |
556 | return 0; | 558 | return 0; |
557 | } | 559 | } |
558 | /** | 560 | /** |
559 | * audit_send_reply - send an audit reply message via netlink | 561 | * audit_send_reply - send an audit reply message via netlink |
560 | * @portid: netlink port to which to send reply | 562 | * @request_skb: skb of request we are replying to (used to target the reply) |
561 | * @seq: sequence number | 563 | * @seq: sequence number |
562 | * @type: audit message type | 564 | * @type: audit message type |
563 | * @done: done (last) flag | 565 | * @done: done (last) flag |
@@ -568,9 +570,11 @@ static int audit_send_reply_thread(void *arg) | |||
568 | * Allocates an skb, builds the netlink message, and sends it to the port id. | 570 | * Allocates an skb, builds the netlink message, and sends it to the port id. |
569 | * No failure notifications. | 571 | * No failure notifications. |
570 | */ | 572 | */ |
571 | static void audit_send_reply(__u32 portid, int seq, int type, int done, | 573 | static void audit_send_reply(struct sk_buff *request_skb, int seq, int type, int done, |
572 | int multi, const void *payload, int size) | 574 | int multi, const void *payload, int size) |
573 | { | 575 | { |
576 | u32 portid = NETLINK_CB(request_skb).portid; | ||
577 | struct net *net = sock_net(NETLINK_CB(request_skb).sk); | ||
574 | struct sk_buff *skb; | 578 | struct sk_buff *skb; |
575 | struct task_struct *tsk; | 579 | struct task_struct *tsk; |
576 | struct audit_reply *reply = kmalloc(sizeof(struct audit_reply), | 580 | struct audit_reply *reply = kmalloc(sizeof(struct audit_reply), |
@@ -583,8 +587,8 @@ static void audit_send_reply(__u32 portid, int seq, int type, int done, | |||
583 | if (!skb) | 587 | if (!skb) |
584 | goto out; | 588 | goto out; |
585 | 589 | ||
590 | reply->net = get_net(net); | ||
586 | reply->portid = portid; | 591 | reply->portid = portid; |
587 | reply->pid = task_pid_vnr(current); | ||
588 | reply->skb = skb; | 592 | reply->skb = skb; |
589 | 593 | ||
590 | tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply"); | 594 | tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply"); |
@@ -673,8 +677,7 @@ static int audit_get_feature(struct sk_buff *skb) | |||
673 | 677 | ||
674 | seq = nlmsg_hdr(skb)->nlmsg_seq; | 678 | seq = nlmsg_hdr(skb)->nlmsg_seq; |
675 | 679 | ||
676 | audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_GET, 0, 0, | 680 | audit_send_reply(skb, seq, AUDIT_GET, 0, 0, &af, sizeof(af)); |
677 | &af, sizeof(af)); | ||
678 | 681 | ||
679 | return 0; | 682 | return 0; |
680 | } | 683 | } |
@@ -794,8 +797,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
794 | s.backlog = skb_queue_len(&audit_skb_queue); | 797 | s.backlog = skb_queue_len(&audit_skb_queue); |
795 | s.version = AUDIT_VERSION_LATEST; | 798 | s.version = AUDIT_VERSION_LATEST; |
796 | s.backlog_wait_time = audit_backlog_wait_time; | 799 | s.backlog_wait_time = audit_backlog_wait_time; |
797 | audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_GET, 0, 0, | 800 | audit_send_reply(skb, seq, AUDIT_GET, 0, 0, &s, sizeof(s)); |
798 | &s, sizeof(s)); | ||
799 | break; | 801 | break; |
800 | } | 802 | } |
801 | case AUDIT_SET: { | 803 | case AUDIT_SET: { |
@@ -905,7 +907,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
905 | seq, data, nlmsg_len(nlh)); | 907 | seq, data, nlmsg_len(nlh)); |
906 | break; | 908 | break; |
907 | case AUDIT_LIST_RULES: | 909 | case AUDIT_LIST_RULES: |
908 | err = audit_list_rules_send(NETLINK_CB(skb).portid, seq); | 910 | err = audit_list_rules_send(skb, seq); |
909 | break; | 911 | break; |
910 | case AUDIT_TRIM: | 912 | case AUDIT_TRIM: |
911 | audit_trim_trees(); | 913 | audit_trim_trees(); |
@@ -970,8 +972,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
970 | memcpy(sig_data->ctx, ctx, len); | 972 | memcpy(sig_data->ctx, ctx, len); |
971 | security_release_secctx(ctx, len); | 973 | security_release_secctx(ctx, len); |
972 | } | 974 | } |
973 | audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_SIGNAL_INFO, | 975 | audit_send_reply(skb, seq, AUDIT_SIGNAL_INFO, 0, 0, |
974 | 0, 0, sig_data, sizeof(*sig_data) + len); | 976 | sig_data, sizeof(*sig_data) + len); |
975 | kfree(sig_data); | 977 | kfree(sig_data); |
976 | break; | 978 | break; |
977 | case AUDIT_TTY_GET: { | 979 | case AUDIT_TTY_GET: { |
@@ -983,8 +985,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
983 | s.log_passwd = tsk->signal->audit_tty_log_passwd; | 985 | s.log_passwd = tsk->signal->audit_tty_log_passwd; |
984 | spin_unlock(&tsk->sighand->siglock); | 986 | spin_unlock(&tsk->sighand->siglock); |
985 | 987 | ||
986 | audit_send_reply(NETLINK_CB(skb).portid, seq, | 988 | audit_send_reply(skb, seq, AUDIT_TTY_GET, 0, 0, &s, sizeof(s)); |
987 | AUDIT_TTY_GET, 0, 0, &s, sizeof(s)); | ||
988 | break; | 989 | break; |
989 | } | 990 | } |
990 | case AUDIT_TTY_SET: { | 991 | case AUDIT_TTY_SET: { |
diff --git a/kernel/audit.h b/kernel/audit.h index 57cc64d67718..8df132214606 100644 --- a/kernel/audit.h +++ b/kernel/audit.h | |||
@@ -247,7 +247,7 @@ extern void audit_panic(const char *message); | |||
247 | 247 | ||
248 | struct audit_netlink_list { | 248 | struct audit_netlink_list { |
249 | __u32 portid; | 249 | __u32 portid; |
250 | pid_t pid; | 250 | struct net *net; |
251 | struct sk_buff_head q; | 251 | struct sk_buff_head q; |
252 | }; | 252 | }; |
253 | 253 | ||
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 67ccf0e7cca9..135944a7b28a 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -916,7 +916,7 @@ static int audit_tree_handle_event(struct fsnotify_group *group, | |||
916 | struct fsnotify_mark *inode_mark, | 916 | struct fsnotify_mark *inode_mark, |
917 | struct fsnotify_mark *vfsmount_mark, | 917 | struct fsnotify_mark *vfsmount_mark, |
918 | u32 mask, void *data, int data_type, | 918 | u32 mask, void *data, int data_type, |
919 | const unsigned char *file_name) | 919 | const unsigned char *file_name, u32 cookie) |
920 | { | 920 | { |
921 | return 0; | 921 | return 0; |
922 | } | 922 | } |
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 2596fac5dcb4..70b4554d2fbe 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
@@ -471,7 +471,7 @@ static int audit_watch_handle_event(struct fsnotify_group *group, | |||
471 | struct fsnotify_mark *inode_mark, | 471 | struct fsnotify_mark *inode_mark, |
472 | struct fsnotify_mark *vfsmount_mark, | 472 | struct fsnotify_mark *vfsmount_mark, |
473 | u32 mask, void *data, int data_type, | 473 | u32 mask, void *data, int data_type, |
474 | const unsigned char *dname) | 474 | const unsigned char *dname, u32 cookie) |
475 | { | 475 | { |
476 | struct inode *inode; | 476 | struct inode *inode; |
477 | struct audit_parent *parent; | 477 | struct audit_parent *parent; |
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 14a78cca384e..92062fd6cc8c 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/security.h> | 31 | #include <linux/security.h> |
32 | #include <net/net_namespace.h> | ||
33 | #include <net/sock.h> | ||
32 | #include "audit.h" | 34 | #include "audit.h" |
33 | 35 | ||
34 | /* | 36 | /* |
@@ -1065,11 +1067,13 @@ int audit_rule_change(int type, __u32 portid, int seq, void *data, | |||
1065 | 1067 | ||
1066 | /** | 1068 | /** |
1067 | * audit_list_rules_send - list the audit rules | 1069 | * audit_list_rules_send - list the audit rules |
1068 | * @portid: target portid for netlink audit messages | 1070 | * @request_skb: skb of request we are replying to (used to target the reply) |
1069 | * @seq: netlink audit message sequence (serial) number | 1071 | * @seq: netlink audit message sequence (serial) number |
1070 | */ | 1072 | */ |
1071 | int audit_list_rules_send(__u32 portid, int seq) | 1073 | int audit_list_rules_send(struct sk_buff *request_skb, int seq) |
1072 | { | 1074 | { |
1075 | u32 portid = NETLINK_CB(request_skb).portid; | ||
1076 | struct net *net = sock_net(NETLINK_CB(request_skb).sk); | ||
1073 | struct task_struct *tsk; | 1077 | struct task_struct *tsk; |
1074 | struct audit_netlink_list *dest; | 1078 | struct audit_netlink_list *dest; |
1075 | int err = 0; | 1079 | int err = 0; |
@@ -1083,8 +1087,8 @@ int audit_list_rules_send(__u32 portid, int seq) | |||
1083 | dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); | 1087 | dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); |
1084 | if (!dest) | 1088 | if (!dest) |
1085 | return -ENOMEM; | 1089 | return -ENOMEM; |
1090 | dest->net = get_net(net); | ||
1086 | dest->portid = portid; | 1091 | dest->portid = portid; |
1087 | dest->pid = task_pid_vnr(current); | ||
1088 | skb_queue_head_init(&dest->q); | 1092 | skb_queue_head_init(&dest->q); |
1089 | 1093 | ||
1090 | mutex_lock(&audit_filter_mutex); | 1094 | mutex_lock(&audit_filter_mutex); |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 105f273b6f86..0c753ddd223b 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -4112,17 +4112,17 @@ static int create_css(struct cgroup *cgrp, struct cgroup_subsys *ss) | |||
4112 | 4112 | ||
4113 | err = percpu_ref_init(&css->refcnt, css_release); | 4113 | err = percpu_ref_init(&css->refcnt, css_release); |
4114 | if (err) | 4114 | if (err) |
4115 | goto err_free; | 4115 | goto err_free_css; |
4116 | 4116 | ||
4117 | init_css(css, ss, cgrp); | 4117 | init_css(css, ss, cgrp); |
4118 | 4118 | ||
4119 | err = cgroup_populate_dir(cgrp, 1 << ss->subsys_id); | 4119 | err = cgroup_populate_dir(cgrp, 1 << ss->subsys_id); |
4120 | if (err) | 4120 | if (err) |
4121 | goto err_free; | 4121 | goto err_free_percpu_ref; |
4122 | 4122 | ||
4123 | err = online_css(css); | 4123 | err = online_css(css); |
4124 | if (err) | 4124 | if (err) |
4125 | goto err_free; | 4125 | goto err_clear_dir; |
4126 | 4126 | ||
4127 | dget(cgrp->dentry); | 4127 | dget(cgrp->dentry); |
4128 | css_get(css->parent); | 4128 | css_get(css->parent); |
@@ -4138,8 +4138,11 @@ static int create_css(struct cgroup *cgrp, struct cgroup_subsys *ss) | |||
4138 | 4138 | ||
4139 | return 0; | 4139 | return 0; |
4140 | 4140 | ||
4141 | err_free: | 4141 | err_clear_dir: |
4142 | cgroup_clear_dir(css->cgroup, 1 << css->ss->subsys_id); | ||
4143 | err_free_percpu_ref: | ||
4142 | percpu_ref_cancel_init(&css->refcnt); | 4144 | percpu_ref_cancel_init(&css->refcnt); |
4145 | err_free_css: | ||
4143 | ss->css_free(css); | 4146 | ss->css_free(css); |
4144 | return err; | 4147 | return err; |
4145 | } | 4148 | } |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 4410ac6a55f1..e6b1b66afe52 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -974,12 +974,6 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, | |||
974 | * Temporarilly set tasks mems_allowed to target nodes of migration, | 974 | * Temporarilly set tasks mems_allowed to target nodes of migration, |
975 | * so that the migration code can allocate pages on these nodes. | 975 | * so that the migration code can allocate pages on these nodes. |
976 | * | 976 | * |
977 | * Call holding cpuset_mutex, so current's cpuset won't change | ||
978 | * during this call, as manage_mutex holds off any cpuset_attach() | ||
979 | * calls. Therefore we don't need to take task_lock around the | ||
980 | * call to guarantee_online_mems(), as we know no one is changing | ||
981 | * our task's cpuset. | ||
982 | * | ||
983 | * While the mm_struct we are migrating is typically from some | 977 | * While the mm_struct we are migrating is typically from some |
984 | * other task, the task_struct mems_allowed that we are hacking | 978 | * other task, the task_struct mems_allowed that we are hacking |
985 | * is for our current task, which must allocate new pages for that | 979 | * is for our current task, which must allocate new pages for that |
@@ -996,8 +990,10 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from, | |||
996 | 990 | ||
997 | do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL); | 991 | do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL); |
998 | 992 | ||
993 | rcu_read_lock(); | ||
999 | mems_cs = effective_nodemask_cpuset(task_cs(tsk)); | 994 | mems_cs = effective_nodemask_cpuset(task_cs(tsk)); |
1000 | guarantee_online_mems(mems_cs, &tsk->mems_allowed); | 995 | guarantee_online_mems(mems_cs, &tsk->mems_allowed); |
996 | rcu_read_unlock(); | ||
1001 | } | 997 | } |
1002 | 998 | ||
1003 | /* | 999 | /* |
@@ -2486,9 +2482,9 @@ int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask) | |||
2486 | 2482 | ||
2487 | task_lock(current); | 2483 | task_lock(current); |
2488 | cs = nearest_hardwall_ancestor(task_cs(current)); | 2484 | cs = nearest_hardwall_ancestor(task_cs(current)); |
2485 | allowed = node_isset(node, cs->mems_allowed); | ||
2489 | task_unlock(current); | 2486 | task_unlock(current); |
2490 | 2487 | ||
2491 | allowed = node_isset(node, cs->mems_allowed); | ||
2492 | mutex_unlock(&callback_mutex); | 2488 | mutex_unlock(&callback_mutex); |
2493 | return allowed; | 2489 | return allowed; |
2494 | } | 2490 | } |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 56003c6edfd3..fa0b2d4ad83c 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -7856,14 +7856,14 @@ static void perf_pmu_rotate_stop(struct pmu *pmu) | |||
7856 | static void __perf_event_exit_context(void *__info) | 7856 | static void __perf_event_exit_context(void *__info) |
7857 | { | 7857 | { |
7858 | struct perf_event_context *ctx = __info; | 7858 | struct perf_event_context *ctx = __info; |
7859 | struct perf_event *event, *tmp; | 7859 | struct perf_event *event; |
7860 | 7860 | ||
7861 | perf_pmu_rotate_stop(ctx->pmu); | 7861 | perf_pmu_rotate_stop(ctx->pmu); |
7862 | 7862 | ||
7863 | list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry) | 7863 | rcu_read_lock(); |
7864 | __perf_remove_from_context(event); | 7864 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) |
7865 | list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry) | ||
7866 | __perf_remove_from_context(event); | 7865 | __perf_remove_from_context(event); |
7866 | rcu_read_unlock(); | ||
7867 | } | 7867 | } |
7868 | 7868 | ||
7869 | static void perf_event_exit_cpu_context(int cpu) | 7869 | static void perf_event_exit_cpu_context(int cpu) |
@@ -7887,11 +7887,11 @@ static void perf_event_exit_cpu(int cpu) | |||
7887 | { | 7887 | { |
7888 | struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); | 7888 | struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); |
7889 | 7889 | ||
7890 | perf_event_exit_cpu_context(cpu); | ||
7891 | |||
7890 | mutex_lock(&swhash->hlist_mutex); | 7892 | mutex_lock(&swhash->hlist_mutex); |
7891 | swevent_hlist_release(swhash); | 7893 | swevent_hlist_release(swhash); |
7892 | mutex_unlock(&swhash->hlist_mutex); | 7894 | mutex_unlock(&swhash->hlist_mutex); |
7893 | |||
7894 | perf_event_exit_cpu_context(cpu); | ||
7895 | } | 7895 | } |
7896 | #else | 7896 | #else |
7897 | static inline void perf_event_exit_cpu(int cpu) { } | 7897 | static inline void perf_event_exit_cpu(int cpu) { } |
diff --git a/kernel/futex.c b/kernel/futex.c index 44a1261cb9ff..08ec814ad9d2 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -234,6 +234,7 @@ static const struct futex_q futex_q_init = { | |||
234 | * waiting on a futex. | 234 | * waiting on a futex. |
235 | */ | 235 | */ |
236 | struct futex_hash_bucket { | 236 | struct futex_hash_bucket { |
237 | atomic_t waiters; | ||
237 | spinlock_t lock; | 238 | spinlock_t lock; |
238 | struct plist_head chain; | 239 | struct plist_head chain; |
239 | } ____cacheline_aligned_in_smp; | 240 | } ____cacheline_aligned_in_smp; |
@@ -253,22 +254,37 @@ static inline void futex_get_mm(union futex_key *key) | |||
253 | smp_mb__after_atomic_inc(); | 254 | smp_mb__after_atomic_inc(); |
254 | } | 255 | } |
255 | 256 | ||
256 | static inline bool hb_waiters_pending(struct futex_hash_bucket *hb) | 257 | /* |
258 | * Reflects a new waiter being added to the waitqueue. | ||
259 | */ | ||
260 | static inline void hb_waiters_inc(struct futex_hash_bucket *hb) | ||
257 | { | 261 | { |
258 | #ifdef CONFIG_SMP | 262 | #ifdef CONFIG_SMP |
263 | atomic_inc(&hb->waiters); | ||
259 | /* | 264 | /* |
260 | * Tasks trying to enter the critical region are most likely | 265 | * Full barrier (A), see the ordering comment above. |
261 | * potential waiters that will be added to the plist. Ensure | ||
262 | * that wakers won't miss to-be-slept tasks in the window between | ||
263 | * the wait call and the actual plist_add. | ||
264 | */ | 266 | */ |
265 | if (spin_is_locked(&hb->lock)) | 267 | smp_mb__after_atomic_inc(); |
266 | return true; | 268 | #endif |
267 | smp_rmb(); /* Make sure we check the lock state first */ | 269 | } |
270 | |||
271 | /* | ||
272 | * Reflects a waiter being removed from the waitqueue by wakeup | ||
273 | * paths. | ||
274 | */ | ||
275 | static inline void hb_waiters_dec(struct futex_hash_bucket *hb) | ||
276 | { | ||
277 | #ifdef CONFIG_SMP | ||
278 | atomic_dec(&hb->waiters); | ||
279 | #endif | ||
280 | } | ||
268 | 281 | ||
269 | return !plist_head_empty(&hb->chain); | 282 | static inline int hb_waiters_pending(struct futex_hash_bucket *hb) |
283 | { | ||
284 | #ifdef CONFIG_SMP | ||
285 | return atomic_read(&hb->waiters); | ||
270 | #else | 286 | #else |
271 | return true; | 287 | return 1; |
272 | #endif | 288 | #endif |
273 | } | 289 | } |
274 | 290 | ||
@@ -954,6 +970,7 @@ static void __unqueue_futex(struct futex_q *q) | |||
954 | 970 | ||
955 | hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock); | 971 | hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock); |
956 | plist_del(&q->list, &hb->chain); | 972 | plist_del(&q->list, &hb->chain); |
973 | hb_waiters_dec(hb); | ||
957 | } | 974 | } |
958 | 975 | ||
959 | /* | 976 | /* |
@@ -1257,7 +1274,9 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1, | |||
1257 | */ | 1274 | */ |
1258 | if (likely(&hb1->chain != &hb2->chain)) { | 1275 | if (likely(&hb1->chain != &hb2->chain)) { |
1259 | plist_del(&q->list, &hb1->chain); | 1276 | plist_del(&q->list, &hb1->chain); |
1277 | hb_waiters_dec(hb1); | ||
1260 | plist_add(&q->list, &hb2->chain); | 1278 | plist_add(&q->list, &hb2->chain); |
1279 | hb_waiters_inc(hb2); | ||
1261 | q->lock_ptr = &hb2->lock; | 1280 | q->lock_ptr = &hb2->lock; |
1262 | } | 1281 | } |
1263 | get_futex_key_refs(key2); | 1282 | get_futex_key_refs(key2); |
@@ -1600,6 +1619,17 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) | |||
1600 | struct futex_hash_bucket *hb; | 1619 | struct futex_hash_bucket *hb; |
1601 | 1620 | ||
1602 | hb = hash_futex(&q->key); | 1621 | hb = hash_futex(&q->key); |
1622 | |||
1623 | /* | ||
1624 | * Increment the counter before taking the lock so that | ||
1625 | * a potential waker won't miss a to-be-slept task that is | ||
1626 | * waiting for the spinlock. This is safe as all queue_lock() | ||
1627 | * users end up calling queue_me(). Similarly, for housekeeping, | ||
1628 | * decrement the counter at queue_unlock() when some error has | ||
1629 | * occurred and we don't end up adding the task to the list. | ||
1630 | */ | ||
1631 | hb_waiters_inc(hb); | ||
1632 | |||
1603 | q->lock_ptr = &hb->lock; | 1633 | q->lock_ptr = &hb->lock; |
1604 | 1634 | ||
1605 | spin_lock(&hb->lock); /* implies MB (A) */ | 1635 | spin_lock(&hb->lock); /* implies MB (A) */ |
@@ -1611,6 +1641,7 @@ queue_unlock(struct futex_hash_bucket *hb) | |||
1611 | __releases(&hb->lock) | 1641 | __releases(&hb->lock) |
1612 | { | 1642 | { |
1613 | spin_unlock(&hb->lock); | 1643 | spin_unlock(&hb->lock); |
1644 | hb_waiters_dec(hb); | ||
1614 | } | 1645 | } |
1615 | 1646 | ||
1616 | /** | 1647 | /** |
@@ -2342,6 +2373,7 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, | |||
2342 | * Unqueue the futex_q and determine which it was. | 2373 | * Unqueue the futex_q and determine which it was. |
2343 | */ | 2374 | */ |
2344 | plist_del(&q->list, &hb->chain); | 2375 | plist_del(&q->list, &hb->chain); |
2376 | hb_waiters_dec(hb); | ||
2345 | 2377 | ||
2346 | /* Handle spurious wakeups gracefully */ | 2378 | /* Handle spurious wakeups gracefully */ |
2347 | ret = -EWOULDBLOCK; | 2379 | ret = -EWOULDBLOCK; |
@@ -2875,6 +2907,7 @@ static int __init futex_init(void) | |||
2875 | futex_cmpxchg_enabled = 1; | 2907 | futex_cmpxchg_enabled = 1; |
2876 | 2908 | ||
2877 | for (i = 0; i < futex_hashsize; i++) { | 2909 | for (i = 0; i < futex_hashsize; i++) { |
2910 | atomic_set(&futex_queues[i].waiters, 0); | ||
2878 | plist_head_init(&futex_queues[i].chain); | 2911 | plist_head_init(&futex_queues[i].chain); |
2879 | spin_lock_init(&futex_queues[i].lock); | 2912 | spin_lock_init(&futex_queues[i].lock); |
2880 | } | 2913 | } |
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index cf68bb36fe58..f14033700c25 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/mutex.h> | 10 | #include <linux/mutex.h> |
11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
12 | #include <linux/of_address.h> | 12 | #include <linux/of_address.h> |
13 | #include <linux/of_irq.h> | ||
13 | #include <linux/topology.h> | 14 | #include <linux/topology.h> |
14 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 481a13c43b17..d3bf660cb57f 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -802,8 +802,7 @@ static irqreturn_t irq_thread_fn(struct irq_desc *desc, | |||
802 | 802 | ||
803 | static void wake_threads_waitq(struct irq_desc *desc) | 803 | static void wake_threads_waitq(struct irq_desc *desc) |
804 | { | 804 | { |
805 | if (atomic_dec_and_test(&desc->threads_active) && | 805 | if (atomic_dec_and_test(&desc->threads_active)) |
806 | waitqueue_active(&desc->wait_for_threads)) | ||
807 | wake_up(&desc->wait_for_threads); | 806 | wake_up(&desc->wait_for_threads); |
808 | } | 807 | } |
809 | 808 | ||
diff --git a/kernel/profile.c b/kernel/profile.c index 6631e1ef55ab..ebdd9c1a86b4 100644 --- a/kernel/profile.c +++ b/kernel/profile.c | |||
@@ -549,14 +549,14 @@ static int create_hash_tables(void) | |||
549 | struct page *page; | 549 | struct page *page; |
550 | 550 | ||
551 | page = alloc_pages_exact_node(node, | 551 | page = alloc_pages_exact_node(node, |
552 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 552 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
553 | 0); | 553 | 0); |
554 | if (!page) | 554 | if (!page) |
555 | goto out_cleanup; | 555 | goto out_cleanup; |
556 | per_cpu(cpu_profile_hits, cpu)[1] | 556 | per_cpu(cpu_profile_hits, cpu)[1] |
557 | = (struct profile_hit *)page_address(page); | 557 | = (struct profile_hit *)page_address(page); |
558 | page = alloc_pages_exact_node(node, | 558 | page = alloc_pages_exact_node(node, |
559 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 559 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
560 | 0); | 560 | 0); |
561 | if (!page) | 561 | if (!page) |
562 | goto out_cleanup; | 562 | goto out_cleanup; |
diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c index 43c2bcc35761..b30a2924ef14 100644 --- a/kernel/sched/clock.c +++ b/kernel/sched/clock.c | |||
@@ -301,14 +301,14 @@ u64 sched_clock_cpu(int cpu) | |||
301 | if (unlikely(!sched_clock_running)) | 301 | if (unlikely(!sched_clock_running)) |
302 | return 0ull; | 302 | return 0ull; |
303 | 303 | ||
304 | preempt_disable(); | 304 | preempt_disable_notrace(); |
305 | scd = cpu_sdc(cpu); | 305 | scd = cpu_sdc(cpu); |
306 | 306 | ||
307 | if (cpu != smp_processor_id()) | 307 | if (cpu != smp_processor_id()) |
308 | clock = sched_clock_remote(scd); | 308 | clock = sched_clock_remote(scd); |
309 | else | 309 | else |
310 | clock = sched_clock_local(scd); | 310 | clock = sched_clock_local(scd); |
311 | preempt_enable(); | 311 | preempt_enable_notrace(); |
312 | 312 | ||
313 | return clock; | 313 | return clock; |
314 | } | 314 | } |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6edbef296ece..f5c6635b806c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3338,6 +3338,15 @@ recheck: | |||
3338 | return -EPERM; | 3338 | return -EPERM; |
3339 | } | 3339 | } |
3340 | 3340 | ||
3341 | /* | ||
3342 | * Can't set/change SCHED_DEADLINE policy at all for now | ||
3343 | * (safest behavior); in the future we would like to allow | ||
3344 | * unprivileged DL tasks to increase their relative deadline | ||
3345 | * or reduce their runtime (both ways reducing utilization) | ||
3346 | */ | ||
3347 | if (dl_policy(policy)) | ||
3348 | return -EPERM; | ||
3349 | |||
3341 | /* | 3350 | /* |
3342 | * Treat SCHED_IDLE as nice 20. Only allow a switch to | 3351 | * Treat SCHED_IDLE as nice 20. Only allow a switch to |
3343 | * SCHED_NORMAL if the RLIMIT_NICE would normally permit it. | 3352 | * SCHED_NORMAL if the RLIMIT_NICE would normally permit it. |
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index 5b8838b56d1c..5b9bb42b2d47 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c | |||
@@ -70,7 +70,7 @@ static void cpudl_heapify(struct cpudl *cp, int idx) | |||
70 | 70 | ||
71 | static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl) | 71 | static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl) |
72 | { | 72 | { |
73 | WARN_ON(!cpu_present(idx) || idx == IDX_INVALID); | 73 | WARN_ON(idx == IDX_INVALID || !cpu_present(idx)); |
74 | 74 | ||
75 | if (dl_time_before(new_dl, cp->elements[idx].dl)) { | 75 | if (dl_time_before(new_dl, cp->elements[idx].dl)) { |
76 | cp->elements[idx].dl = new_dl; | 76 | cp->elements[idx].dl = new_dl; |
@@ -117,7 +117,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, | |||
117 | } | 117 | } |
118 | 118 | ||
119 | out: | 119 | out: |
120 | WARN_ON(!cpu_present(best_cpu) && best_cpu != -1); | 120 | WARN_ON(best_cpu != -1 && !cpu_present(best_cpu)); |
121 | 121 | ||
122 | return best_cpu; | 122 | return best_cpu; |
123 | } | 123 | } |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 15cbc17fbf84..6e79b3faa4cd 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -135,7 +135,6 @@ static void update_dl_migration(struct dl_rq *dl_rq) | |||
135 | static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) | 135 | static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) |
136 | { | 136 | { |
137 | struct task_struct *p = dl_task_of(dl_se); | 137 | struct task_struct *p = dl_task_of(dl_se); |
138 | dl_rq = &rq_of_dl_rq(dl_rq)->dl; | ||
139 | 138 | ||
140 | if (p->nr_cpus_allowed > 1) | 139 | if (p->nr_cpus_allowed > 1) |
141 | dl_rq->dl_nr_migratory++; | 140 | dl_rq->dl_nr_migratory++; |
@@ -146,7 +145,6 @@ static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) | |||
146 | static void dec_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) | 145 | static void dec_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) |
147 | { | 146 | { |
148 | struct task_struct *p = dl_task_of(dl_se); | 147 | struct task_struct *p = dl_task_of(dl_se); |
149 | dl_rq = &rq_of_dl_rq(dl_rq)->dl; | ||
150 | 148 | ||
151 | if (p->nr_cpus_allowed > 1) | 149 | if (p->nr_cpus_allowed > 1) |
152 | dl_rq->dl_nr_migratory--; | 150 | dl_rq->dl_nr_migratory--; |
@@ -564,6 +562,8 @@ int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se) | |||
564 | return 1; | 562 | return 1; |
565 | } | 563 | } |
566 | 564 | ||
565 | extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); | ||
566 | |||
567 | /* | 567 | /* |
568 | * Update the current task's runtime statistics (provided it is still | 568 | * Update the current task's runtime statistics (provided it is still |
569 | * a -deadline task and has not been removed from the dl_rq). | 569 | * a -deadline task and has not been removed from the dl_rq). |
@@ -627,11 +627,13 @@ static void update_curr_dl(struct rq *rq) | |||
627 | struct rt_rq *rt_rq = &rq->rt; | 627 | struct rt_rq *rt_rq = &rq->rt; |
628 | 628 | ||
629 | raw_spin_lock(&rt_rq->rt_runtime_lock); | 629 | raw_spin_lock(&rt_rq->rt_runtime_lock); |
630 | rt_rq->rt_time += delta_exec; | ||
631 | /* | 630 | /* |
632 | * We'll let actual RT tasks worry about the overflow here, we | 631 | * We'll let actual RT tasks worry about the overflow here, we |
633 | * have our own CBS to keep us inline -- see above. | 632 | * have our own CBS to keep us inline; only account when RT |
633 | * bandwidth is relevant. | ||
634 | */ | 634 | */ |
635 | if (sched_rt_bandwidth_account(rt_rq)) | ||
636 | rt_rq->rt_time += delta_exec; | ||
635 | raw_spin_unlock(&rt_rq->rt_runtime_lock); | 637 | raw_spin_unlock(&rt_rq->rt_runtime_lock); |
636 | } | 638 | } |
637 | } | 639 | } |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 78157099b167..9b4c4f320130 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -7001,15 +7001,15 @@ static void switched_from_fair(struct rq *rq, struct task_struct *p) | |||
7001 | struct cfs_rq *cfs_rq = cfs_rq_of(se); | 7001 | struct cfs_rq *cfs_rq = cfs_rq_of(se); |
7002 | 7002 | ||
7003 | /* | 7003 | /* |
7004 | * Ensure the task's vruntime is normalized, so that when its | 7004 | * Ensure the task's vruntime is normalized, so that when it's |
7005 | * switched back to the fair class the enqueue_entity(.flags=0) will | 7005 | * switched back to the fair class the enqueue_entity(.flags=0) will |
7006 | * do the right thing. | 7006 | * do the right thing. |
7007 | * | 7007 | * |
7008 | * If it was on_rq, then the dequeue_entity(.flags=0) will already | 7008 | * If it's on_rq, then the dequeue_entity(.flags=0) will already |
7009 | * have normalized the vruntime, if it was !on_rq, then only when | 7009 | * have normalized the vruntime, if it's !on_rq, then only when |
7010 | * the task is sleeping will it still have non-normalized vruntime. | 7010 | * the task is sleeping will it still have non-normalized vruntime. |
7011 | */ | 7011 | */ |
7012 | if (!se->on_rq && p->state != TASK_RUNNING) { | 7012 | if (!p->on_rq && p->state != TASK_RUNNING) { |
7013 | /* | 7013 | /* |
7014 | * Fix up our vruntime so that the current sleep doesn't | 7014 | * Fix up our vruntime so that the current sleep doesn't |
7015 | * cause 'unlimited' sleep bonus. | 7015 | * cause 'unlimited' sleep bonus. |
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index a2740b775b45..1999021042c7 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -538,6 +538,14 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq) | |||
538 | 538 | ||
539 | #endif /* CONFIG_RT_GROUP_SCHED */ | 539 | #endif /* CONFIG_RT_GROUP_SCHED */ |
540 | 540 | ||
541 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq) | ||
542 | { | ||
543 | struct rt_bandwidth *rt_b = sched_rt_bandwidth(rt_rq); | ||
544 | |||
545 | return (hrtimer_active(&rt_b->rt_period_timer) || | ||
546 | rt_rq->rt_time < rt_b->rt_runtime); | ||
547 | } | ||
548 | |||
541 | #ifdef CONFIG_SMP | 549 | #ifdef CONFIG_SMP |
542 | /* | 550 | /* |
543 | * We ran out of runtime, see if we can borrow some from our neighbours. | 551 | * We ran out of runtime, see if we can borrow some from our neighbours. |
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 84571e09c907..01fbae5b97b7 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c | |||
@@ -293,7 +293,7 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void * | |||
293 | */ | 293 | */ |
294 | smp_call_function_single(min(cpu1, cpu2), | 294 | smp_call_function_single(min(cpu1, cpu2), |
295 | &irq_cpu_stop_queue_work, | 295 | &irq_cpu_stop_queue_work, |
296 | &call_args, 0); | 296 | &call_args, 1); |
297 | lg_local_unlock(&stop_cpus_lock); | 297 | lg_local_unlock(&stop_cpus_lock); |
298 | preempt_enable(); | 298 | preempt_enable(); |
299 | 299 | ||
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index e71ffd4eccb5..7b16d40bd64d 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -27,12 +27,6 @@ | |||
27 | 27 | ||
28 | DEFINE_MUTEX(event_mutex); | 28 | DEFINE_MUTEX(event_mutex); |
29 | 29 | ||
30 | DEFINE_MUTEX(event_storage_mutex); | ||
31 | EXPORT_SYMBOL_GPL(event_storage_mutex); | ||
32 | |||
33 | char event_storage[EVENT_STORAGE_SIZE]; | ||
34 | EXPORT_SYMBOL_GPL(event_storage); | ||
35 | |||
36 | LIST_HEAD(ftrace_events); | 30 | LIST_HEAD(ftrace_events); |
37 | static LIST_HEAD(ftrace_common_fields); | 31 | static LIST_HEAD(ftrace_common_fields); |
38 | 32 | ||
@@ -1777,6 +1771,16 @@ static void trace_module_add_events(struct module *mod) | |||
1777 | { | 1771 | { |
1778 | struct ftrace_event_call **call, **start, **end; | 1772 | struct ftrace_event_call **call, **start, **end; |
1779 | 1773 | ||
1774 | if (!mod->num_trace_events) | ||
1775 | return; | ||
1776 | |||
1777 | /* Don't add infrastructure for mods without tracepoints */ | ||
1778 | if (trace_module_has_bad_taint(mod)) { | ||
1779 | pr_err("%s: module has bad taint, not creating trace events\n", | ||
1780 | mod->name); | ||
1781 | return; | ||
1782 | } | ||
1783 | |||
1780 | start = mod->trace_events; | 1784 | start = mod->trace_events; |
1781 | end = mod->trace_events + mod->num_trace_events; | 1785 | end = mod->trace_events + mod->num_trace_events; |
1782 | 1786 | ||
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 7c3e3e72e2b6..ee0a5098ac43 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -95,15 +95,12 @@ static void __always_unused ____ftrace_check_##name(void) \ | |||
95 | #undef __array | 95 | #undef __array |
96 | #define __array(type, item, len) \ | 96 | #define __array(type, item, len) \ |
97 | do { \ | 97 | do { \ |
98 | char *type_str = #type"["__stringify(len)"]"; \ | ||
98 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 99 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
99 | mutex_lock(&event_storage_mutex); \ | 100 | ret = trace_define_field(event_call, type_str, #item, \ |
100 | snprintf(event_storage, sizeof(event_storage), \ | ||
101 | "%s[%d]", #type, len); \ | ||
102 | ret = trace_define_field(event_call, event_storage, #item, \ | ||
103 | offsetof(typeof(field), item), \ | 101 | offsetof(typeof(field), item), \ |
104 | sizeof(field.item), \ | 102 | sizeof(field.item), \ |
105 | is_signed_type(type), filter_type); \ | 103 | is_signed_type(type), filter_type); \ |
106 | mutex_unlock(&event_storage_mutex); \ | ||
107 | if (ret) \ | 104 | if (ret) \ |
108 | return ret; \ | 105 | return ret; \ |
109 | } while (0); | 106 | } while (0); |
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 29f26540e9c9..031cc5655a51 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c | |||
@@ -631,6 +631,11 @@ void tracepoint_iter_reset(struct tracepoint_iter *iter) | |||
631 | EXPORT_SYMBOL_GPL(tracepoint_iter_reset); | 631 | EXPORT_SYMBOL_GPL(tracepoint_iter_reset); |
632 | 632 | ||
633 | #ifdef CONFIG_MODULES | 633 | #ifdef CONFIG_MODULES |
634 | bool trace_module_has_bad_taint(struct module *mod) | ||
635 | { | ||
636 | return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP)); | ||
637 | } | ||
638 | |||
634 | static int tracepoint_module_coming(struct module *mod) | 639 | static int tracepoint_module_coming(struct module *mod) |
635 | { | 640 | { |
636 | struct tp_module *tp_mod, *iter; | 641 | struct tp_module *tp_mod, *iter; |
@@ -641,7 +646,7 @@ static int tracepoint_module_coming(struct module *mod) | |||
641 | * module headers (for forced load), to make sure we don't cause a crash. | 646 | * module headers (for forced load), to make sure we don't cause a crash. |
642 | * Staging and out-of-tree GPL modules are fine. | 647 | * Staging and out-of-tree GPL modules are fine. |
643 | */ | 648 | */ |
644 | if (mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP))) | 649 | if (trace_module_has_bad_taint(mod)) |
645 | return 0; | 650 | return 0; |
646 | mutex_lock(&tracepoints_mutex); | 651 | mutex_lock(&tracepoints_mutex); |
647 | tp_mod = kmalloc(sizeof(struct tp_module), GFP_KERNEL); | 652 | tp_mod = kmalloc(sizeof(struct tp_module), GFP_KERNEL); |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 2defd1308b04..98f2d7e91a91 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -424,111 +424,134 @@ void debug_dma_dump_mappings(struct device *dev) | |||
424 | EXPORT_SYMBOL(debug_dma_dump_mappings); | 424 | EXPORT_SYMBOL(debug_dma_dump_mappings); |
425 | 425 | ||
426 | /* | 426 | /* |
427 | * For each page mapped (initial page in the case of | 427 | * For each mapping (initial cacheline in the case of |
428 | * dma_alloc_coherent/dma_map_{single|page}, or each page in a | 428 | * dma_alloc_coherent/dma_map_page, initial cacheline in each page of a |
429 | * scatterlist) insert into this tree using the pfn as the key. At | 429 | * scatterlist, or the cacheline specified in dma_map_single) insert |
430 | * into this tree using the cacheline as the key. At | ||
430 | * dma_unmap_{single|sg|page} or dma_free_coherent delete the entry. If | 431 | * dma_unmap_{single|sg|page} or dma_free_coherent delete the entry. If |
431 | * the pfn already exists at insertion time add a tag as a reference | 432 | * the entry already exists at insertion time add a tag as a reference |
432 | * count for the overlapping mappings. For now, the overlap tracking | 433 | * count for the overlapping mappings. For now, the overlap tracking |
433 | * just ensures that 'unmaps' balance 'maps' before marking the pfn | 434 | * just ensures that 'unmaps' balance 'maps' before marking the |
434 | * idle, but we should also be flagging overlaps as an API violation. | 435 | * cacheline idle, but we should also be flagging overlaps as an API |
436 | * violation. | ||
435 | * | 437 | * |
436 | * Memory usage is mostly constrained by the maximum number of available | 438 | * Memory usage is mostly constrained by the maximum number of available |
437 | * dma-debug entries in that we need a free dma_debug_entry before | 439 | * dma-debug entries in that we need a free dma_debug_entry before |
438 | * inserting into the tree. In the case of dma_map_{single|page} and | 440 | * inserting into the tree. In the case of dma_map_page and |
439 | * dma_alloc_coherent there is only one dma_debug_entry and one pfn to | 441 | * dma_alloc_coherent there is only one dma_debug_entry and one |
440 | * track per event. dma_map_sg(), on the other hand, | 442 | * dma_active_cacheline entry to track per event. dma_map_sg(), on the |
441 | * consumes a single dma_debug_entry, but inserts 'nents' entries into | 443 | * other hand, consumes a single dma_debug_entry, but inserts 'nents' |
442 | * the tree. | 444 | * entries into the tree. |
443 | * | 445 | * |
444 | * At any time debug_dma_assert_idle() can be called to trigger a | 446 | * At any time debug_dma_assert_idle() can be called to trigger a |
445 | * warning if the given page is in the active set. | 447 | * warning if any cachelines in the given page are in the active set. |
446 | */ | 448 | */ |
447 | static RADIX_TREE(dma_active_pfn, GFP_NOWAIT); | 449 | static RADIX_TREE(dma_active_cacheline, GFP_NOWAIT); |
448 | static DEFINE_SPINLOCK(radix_lock); | 450 | static DEFINE_SPINLOCK(radix_lock); |
449 | #define ACTIVE_PFN_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1) | 451 | #define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1) |
452 | #define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT) | ||
453 | #define CACHELINES_PER_PAGE (1 << CACHELINE_PER_PAGE_SHIFT) | ||
450 | 454 | ||
451 | static int active_pfn_read_overlap(unsigned long pfn) | 455 | static phys_addr_t to_cacheline_number(struct dma_debug_entry *entry) |
456 | { | ||
457 | return (entry->pfn << CACHELINE_PER_PAGE_SHIFT) + | ||
458 | (entry->offset >> L1_CACHE_SHIFT); | ||
459 | } | ||
460 | |||
461 | static int active_cacheline_read_overlap(phys_addr_t cln) | ||
452 | { | 462 | { |
453 | int overlap = 0, i; | 463 | int overlap = 0, i; |
454 | 464 | ||
455 | for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--) | 465 | for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--) |
456 | if (radix_tree_tag_get(&dma_active_pfn, pfn, i)) | 466 | if (radix_tree_tag_get(&dma_active_cacheline, cln, i)) |
457 | overlap |= 1 << i; | 467 | overlap |= 1 << i; |
458 | return overlap; | 468 | return overlap; |
459 | } | 469 | } |
460 | 470 | ||
461 | static int active_pfn_set_overlap(unsigned long pfn, int overlap) | 471 | static int active_cacheline_set_overlap(phys_addr_t cln, int overlap) |
462 | { | 472 | { |
463 | int i; | 473 | int i; |
464 | 474 | ||
465 | if (overlap > ACTIVE_PFN_MAX_OVERLAP || overlap < 0) | 475 | if (overlap > ACTIVE_CACHELINE_MAX_OVERLAP || overlap < 0) |
466 | return overlap; | 476 | return overlap; |
467 | 477 | ||
468 | for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--) | 478 | for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--) |
469 | if (overlap & 1 << i) | 479 | if (overlap & 1 << i) |
470 | radix_tree_tag_set(&dma_active_pfn, pfn, i); | 480 | radix_tree_tag_set(&dma_active_cacheline, cln, i); |
471 | else | 481 | else |
472 | radix_tree_tag_clear(&dma_active_pfn, pfn, i); | 482 | radix_tree_tag_clear(&dma_active_cacheline, cln, i); |
473 | 483 | ||
474 | return overlap; | 484 | return overlap; |
475 | } | 485 | } |
476 | 486 | ||
477 | static void active_pfn_inc_overlap(unsigned long pfn) | 487 | static void active_cacheline_inc_overlap(phys_addr_t cln) |
478 | { | 488 | { |
479 | int overlap = active_pfn_read_overlap(pfn); | 489 | int overlap = active_cacheline_read_overlap(cln); |
480 | 490 | ||
481 | overlap = active_pfn_set_overlap(pfn, ++overlap); | 491 | overlap = active_cacheline_set_overlap(cln, ++overlap); |
482 | 492 | ||
483 | /* If we overflowed the overlap counter then we're potentially | 493 | /* If we overflowed the overlap counter then we're potentially |
484 | * leaking dma-mappings. Otherwise, if maps and unmaps are | 494 | * leaking dma-mappings. Otherwise, if maps and unmaps are |
485 | * balanced then this overflow may cause false negatives in | 495 | * balanced then this overflow may cause false negatives in |
486 | * debug_dma_assert_idle() as the pfn may be marked idle | 496 | * debug_dma_assert_idle() as the cacheline may be marked idle |
487 | * prematurely. | 497 | * prematurely. |
488 | */ | 498 | */ |
489 | WARN_ONCE(overlap > ACTIVE_PFN_MAX_OVERLAP, | 499 | WARN_ONCE(overlap > ACTIVE_CACHELINE_MAX_OVERLAP, |
490 | "DMA-API: exceeded %d overlapping mappings of pfn %lx\n", | 500 | "DMA-API: exceeded %d overlapping mappings of cacheline %pa\n", |
491 | ACTIVE_PFN_MAX_OVERLAP, pfn); | 501 | ACTIVE_CACHELINE_MAX_OVERLAP, &cln); |
492 | } | 502 | } |
493 | 503 | ||
494 | static int active_pfn_dec_overlap(unsigned long pfn) | 504 | static int active_cacheline_dec_overlap(phys_addr_t cln) |
495 | { | 505 | { |
496 | int overlap = active_pfn_read_overlap(pfn); | 506 | int overlap = active_cacheline_read_overlap(cln); |
497 | 507 | ||
498 | return active_pfn_set_overlap(pfn, --overlap); | 508 | return active_cacheline_set_overlap(cln, --overlap); |
499 | } | 509 | } |
500 | 510 | ||
501 | static int active_pfn_insert(struct dma_debug_entry *entry) | 511 | static int active_cacheline_insert(struct dma_debug_entry *entry) |
502 | { | 512 | { |
513 | phys_addr_t cln = to_cacheline_number(entry); | ||
503 | unsigned long flags; | 514 | unsigned long flags; |
504 | int rc; | 515 | int rc; |
505 | 516 | ||
517 | /* If the device is not writing memory then we don't have any | ||
518 | * concerns about the cpu consuming stale data. This mitigates | ||
519 | * legitimate usages of overlapping mappings. | ||
520 | */ | ||
521 | if (entry->direction == DMA_TO_DEVICE) | ||
522 | return 0; | ||
523 | |||
506 | spin_lock_irqsave(&radix_lock, flags); | 524 | spin_lock_irqsave(&radix_lock, flags); |
507 | rc = radix_tree_insert(&dma_active_pfn, entry->pfn, entry); | 525 | rc = radix_tree_insert(&dma_active_cacheline, cln, entry); |
508 | if (rc == -EEXIST) | 526 | if (rc == -EEXIST) |
509 | active_pfn_inc_overlap(entry->pfn); | 527 | active_cacheline_inc_overlap(cln); |
510 | spin_unlock_irqrestore(&radix_lock, flags); | 528 | spin_unlock_irqrestore(&radix_lock, flags); |
511 | 529 | ||
512 | return rc; | 530 | return rc; |
513 | } | 531 | } |
514 | 532 | ||
515 | static void active_pfn_remove(struct dma_debug_entry *entry) | 533 | static void active_cacheline_remove(struct dma_debug_entry *entry) |
516 | { | 534 | { |
535 | phys_addr_t cln = to_cacheline_number(entry); | ||
517 | unsigned long flags; | 536 | unsigned long flags; |
518 | 537 | ||
538 | /* ...mirror the insert case */ | ||
539 | if (entry->direction == DMA_TO_DEVICE) | ||
540 | return; | ||
541 | |||
519 | spin_lock_irqsave(&radix_lock, flags); | 542 | spin_lock_irqsave(&radix_lock, flags); |
520 | /* since we are counting overlaps the final put of the | 543 | /* since we are counting overlaps the final put of the |
521 | * entry->pfn will occur when the overlap count is 0. | 544 | * cacheline will occur when the overlap count is 0. |
522 | * active_pfn_dec_overlap() returns -1 in that case | 545 | * active_cacheline_dec_overlap() returns -1 in that case |
523 | */ | 546 | */ |
524 | if (active_pfn_dec_overlap(entry->pfn) < 0) | 547 | if (active_cacheline_dec_overlap(cln) < 0) |
525 | radix_tree_delete(&dma_active_pfn, entry->pfn); | 548 | radix_tree_delete(&dma_active_cacheline, cln); |
526 | spin_unlock_irqrestore(&radix_lock, flags); | 549 | spin_unlock_irqrestore(&radix_lock, flags); |
527 | } | 550 | } |
528 | 551 | ||
529 | /** | 552 | /** |
530 | * debug_dma_assert_idle() - assert that a page is not undergoing dma | 553 | * debug_dma_assert_idle() - assert that a page is not undergoing dma |
531 | * @page: page to lookup in the dma_active_pfn tree | 554 | * @page: page to lookup in the dma_active_cacheline tree |
532 | * | 555 | * |
533 | * Place a call to this routine in cases where the cpu touching the page | 556 | * Place a call to this routine in cases where the cpu touching the page |
534 | * before the dma completes (page is dma_unmapped) will lead to data | 557 | * before the dma completes (page is dma_unmapped) will lead to data |
@@ -536,22 +559,38 @@ static void active_pfn_remove(struct dma_debug_entry *entry) | |||
536 | */ | 559 | */ |
537 | void debug_dma_assert_idle(struct page *page) | 560 | void debug_dma_assert_idle(struct page *page) |
538 | { | 561 | { |
562 | static struct dma_debug_entry *ents[CACHELINES_PER_PAGE]; | ||
563 | struct dma_debug_entry *entry = NULL; | ||
564 | void **results = (void **) &ents; | ||
565 | unsigned int nents, i; | ||
539 | unsigned long flags; | 566 | unsigned long flags; |
540 | struct dma_debug_entry *entry; | 567 | phys_addr_t cln; |
541 | 568 | ||
542 | if (!page) | 569 | if (!page) |
543 | return; | 570 | return; |
544 | 571 | ||
572 | cln = (phys_addr_t) page_to_pfn(page) << CACHELINE_PER_PAGE_SHIFT; | ||
545 | spin_lock_irqsave(&radix_lock, flags); | 573 | spin_lock_irqsave(&radix_lock, flags); |
546 | entry = radix_tree_lookup(&dma_active_pfn, page_to_pfn(page)); | 574 | nents = radix_tree_gang_lookup(&dma_active_cacheline, results, cln, |
575 | CACHELINES_PER_PAGE); | ||
576 | for (i = 0; i < nents; i++) { | ||
577 | phys_addr_t ent_cln = to_cacheline_number(ents[i]); | ||
578 | |||
579 | if (ent_cln == cln) { | ||
580 | entry = ents[i]; | ||
581 | break; | ||
582 | } else if (ent_cln >= cln + CACHELINES_PER_PAGE) | ||
583 | break; | ||
584 | } | ||
547 | spin_unlock_irqrestore(&radix_lock, flags); | 585 | spin_unlock_irqrestore(&radix_lock, flags); |
548 | 586 | ||
549 | if (!entry) | 587 | if (!entry) |
550 | return; | 588 | return; |
551 | 589 | ||
590 | cln = to_cacheline_number(entry); | ||
552 | err_printk(entry->dev, entry, | 591 | err_printk(entry->dev, entry, |
553 | "DMA-API: cpu touching an active dma mapped page " | 592 | "DMA-API: cpu touching an active dma mapped cacheline [cln=%pa]\n", |
554 | "[pfn=0x%lx]\n", entry->pfn); | 593 | &cln); |
555 | } | 594 | } |
556 | 595 | ||
557 | /* | 596 | /* |
@@ -568,9 +607,9 @@ static void add_dma_entry(struct dma_debug_entry *entry) | |||
568 | hash_bucket_add(bucket, entry); | 607 | hash_bucket_add(bucket, entry); |
569 | put_hash_bucket(bucket, &flags); | 608 | put_hash_bucket(bucket, &flags); |
570 | 609 | ||
571 | rc = active_pfn_insert(entry); | 610 | rc = active_cacheline_insert(entry); |
572 | if (rc == -ENOMEM) { | 611 | if (rc == -ENOMEM) { |
573 | pr_err("DMA-API: pfn tracking ENOMEM, dma-debug disabled\n"); | 612 | pr_err("DMA-API: cacheline tracking ENOMEM, dma-debug disabled\n"); |
574 | global_disable = true; | 613 | global_disable = true; |
575 | } | 614 | } |
576 | 615 | ||
@@ -631,7 +670,7 @@ static void dma_entry_free(struct dma_debug_entry *entry) | |||
631 | { | 670 | { |
632 | unsigned long flags; | 671 | unsigned long flags; |
633 | 672 | ||
634 | active_pfn_remove(entry); | 673 | active_cacheline_remove(entry); |
635 | 674 | ||
636 | /* | 675 | /* |
637 | * add to beginning of the list - this way the entries are | 676 | * add to beginning of the list - this way the entries are |
diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig index 4dc1b990aa23..34fd931b54b5 100644 --- a/lib/fonts/Kconfig +++ b/lib/fonts/Kconfig | |||
@@ -9,7 +9,7 @@ if FONT_SUPPORT | |||
9 | 9 | ||
10 | config FONTS | 10 | config FONTS |
11 | bool "Select compiled-in fonts" | 11 | bool "Select compiled-in fonts" |
12 | depends on FRAMEBUFFER_CONSOLE | 12 | depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE |
13 | help | 13 | help |
14 | Say Y here if you would like to use fonts other than the default | 14 | Say Y here if you would like to use fonts other than the default |
15 | your frame buffer console usually use. | 15 | your frame buffer console usually use. |
@@ -22,7 +22,7 @@ config FONTS | |||
22 | 22 | ||
23 | config FONT_8x8 | 23 | config FONT_8x8 |
24 | bool "VGA 8x8 font" if FONTS | 24 | bool "VGA 8x8 font" if FONTS |
25 | depends on FRAMEBUFFER_CONSOLE | 25 | depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE |
26 | default y if !SPARC && !FONTS | 26 | default y if !SPARC && !FONTS |
27 | help | 27 | help |
28 | This is the "high resolution" font for the VGA frame buffer (the one | 28 | This is the "high resolution" font for the VGA frame buffer (the one |
@@ -45,7 +45,7 @@ config FONT_8x16 | |||
45 | 45 | ||
46 | config FONT_6x11 | 46 | config FONT_6x11 |
47 | bool "Mac console 6x11 font (not supported by all drivers)" if FONTS | 47 | bool "Mac console 6x11 font (not supported by all drivers)" if FONTS |
48 | depends on FRAMEBUFFER_CONSOLE | 48 | depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE |
49 | default y if !SPARC && !FONTS && MAC | 49 | default y if !SPARC && !FONTS && MAC |
50 | help | 50 | help |
51 | Small console font with Macintosh-style high-half glyphs. Some Mac | 51 | Small console font with Macintosh-style high-half glyphs. Some Mac |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 7811ed3b4e70..bd4a8dfdf0b8 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -1253,8 +1253,10 @@ unsigned long radix_tree_locate_item(struct radix_tree_root *root, void *item) | |||
1253 | 1253 | ||
1254 | node = indirect_to_ptr(node); | 1254 | node = indirect_to_ptr(node); |
1255 | max_index = radix_tree_maxindex(node->height); | 1255 | max_index = radix_tree_maxindex(node->height); |
1256 | if (cur_index > max_index) | 1256 | if (cur_index > max_index) { |
1257 | rcu_read_unlock(); | ||
1257 | break; | 1258 | break; |
1259 | } | ||
1258 | 1260 | ||
1259 | cur_index = __locate(node, item, cur_index, &found_index); | 1261 | cur_index = __locate(node, item, cur_index, &found_index); |
1260 | rcu_read_unlock(); | 1262 | rcu_read_unlock(); |
diff --git a/mm/Kconfig b/mm/Kconfig index 2d9f1504d75e..2888024e0b0a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -575,5 +575,5 @@ config PGTABLE_MAPPING | |||
575 | then you should select this. This causes zsmalloc to use page table | 575 | then you should select this. This causes zsmalloc to use page table |
576 | mapping rather than copying for object mapping. | 576 | mapping rather than copying for object mapping. |
577 | 577 | ||
578 | You can check speed with zsmalloc benchmark[1]. | 578 | You can check speed with zsmalloc benchmark: |
579 | [1] https://github.com/spartacus06/zsmalloc | 579 | https://github.com/spartacus06/zsmapbench |
diff --git a/mm/compaction.c b/mm/compaction.c index b48c5259ea33..918577595ea8 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -251,7 +251,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
251 | { | 251 | { |
252 | int nr_scanned = 0, total_isolated = 0; | 252 | int nr_scanned = 0, total_isolated = 0; |
253 | struct page *cursor, *valid_page = NULL; | 253 | struct page *cursor, *valid_page = NULL; |
254 | unsigned long nr_strict_required = end_pfn - blockpfn; | ||
255 | unsigned long flags; | 254 | unsigned long flags; |
256 | bool locked = false; | 255 | bool locked = false; |
257 | 256 | ||
@@ -264,11 +263,12 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
264 | 263 | ||
265 | nr_scanned++; | 264 | nr_scanned++; |
266 | if (!pfn_valid_within(blockpfn)) | 265 | if (!pfn_valid_within(blockpfn)) |
267 | continue; | 266 | goto isolate_fail; |
267 | |||
268 | if (!valid_page) | 268 | if (!valid_page) |
269 | valid_page = page; | 269 | valid_page = page; |
270 | if (!PageBuddy(page)) | 270 | if (!PageBuddy(page)) |
271 | continue; | 271 | goto isolate_fail; |
272 | 272 | ||
273 | /* | 273 | /* |
274 | * The zone lock must be held to isolate freepages. | 274 | * The zone lock must be held to isolate freepages. |
@@ -289,12 +289,10 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
289 | 289 | ||
290 | /* Recheck this is a buddy page under lock */ | 290 | /* Recheck this is a buddy page under lock */ |
291 | if (!PageBuddy(page)) | 291 | if (!PageBuddy(page)) |
292 | continue; | 292 | goto isolate_fail; |
293 | 293 | ||
294 | /* Found a free page, break it into order-0 pages */ | 294 | /* Found a free page, break it into order-0 pages */ |
295 | isolated = split_free_page(page); | 295 | isolated = split_free_page(page); |
296 | if (!isolated && strict) | ||
297 | break; | ||
298 | total_isolated += isolated; | 296 | total_isolated += isolated; |
299 | for (i = 0; i < isolated; i++) { | 297 | for (i = 0; i < isolated; i++) { |
300 | list_add(&page->lru, freelist); | 298 | list_add(&page->lru, freelist); |
@@ -305,7 +303,15 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
305 | if (isolated) { | 303 | if (isolated) { |
306 | blockpfn += isolated - 1; | 304 | blockpfn += isolated - 1; |
307 | cursor += isolated - 1; | 305 | cursor += isolated - 1; |
306 | continue; | ||
308 | } | 307 | } |
308 | |||
309 | isolate_fail: | ||
310 | if (strict) | ||
311 | break; | ||
312 | else | ||
313 | continue; | ||
314 | |||
309 | } | 315 | } |
310 | 316 | ||
311 | trace_mm_compaction_isolate_freepages(nr_scanned, total_isolated); | 317 | trace_mm_compaction_isolate_freepages(nr_scanned, total_isolated); |
@@ -315,7 +321,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
315 | * pages requested were isolated. If there were any failures, 0 is | 321 | * pages requested were isolated. If there were any failures, 0 is |
316 | * returned and CMA will fail. | 322 | * returned and CMA will fail. |
317 | */ | 323 | */ |
318 | if (strict && nr_strict_required > total_isolated) | 324 | if (strict && blockpfn < end_pfn) |
319 | total_isolated = 0; | 325 | total_isolated = 0; |
320 | 326 | ||
321 | if (locked) | 327 | if (locked) |
diff --git a/mm/fremap.c b/mm/fremap.c index bbc4d660221a..34feba60a17e 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -23,28 +23,44 @@ | |||
23 | 23 | ||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | 25 | ||
26 | static int mm_counter(struct page *page) | ||
27 | { | ||
28 | return PageAnon(page) ? MM_ANONPAGES : MM_FILEPAGES; | ||
29 | } | ||
30 | |||
26 | static void zap_pte(struct mm_struct *mm, struct vm_area_struct *vma, | 31 | static void zap_pte(struct mm_struct *mm, struct vm_area_struct *vma, |
27 | unsigned long addr, pte_t *ptep) | 32 | unsigned long addr, pte_t *ptep) |
28 | { | 33 | { |
29 | pte_t pte = *ptep; | 34 | pte_t pte = *ptep; |
35 | struct page *page; | ||
36 | swp_entry_t entry; | ||
30 | 37 | ||
31 | if (pte_present(pte)) { | 38 | if (pte_present(pte)) { |
32 | struct page *page; | ||
33 | |||
34 | flush_cache_page(vma, addr, pte_pfn(pte)); | 39 | flush_cache_page(vma, addr, pte_pfn(pte)); |
35 | pte = ptep_clear_flush(vma, addr, ptep); | 40 | pte = ptep_clear_flush(vma, addr, ptep); |
36 | page = vm_normal_page(vma, addr, pte); | 41 | page = vm_normal_page(vma, addr, pte); |
37 | if (page) { | 42 | if (page) { |
38 | if (pte_dirty(pte)) | 43 | if (pte_dirty(pte)) |
39 | set_page_dirty(page); | 44 | set_page_dirty(page); |
45 | update_hiwater_rss(mm); | ||
46 | dec_mm_counter(mm, mm_counter(page)); | ||
40 | page_remove_rmap(page); | 47 | page_remove_rmap(page); |
41 | page_cache_release(page); | 48 | page_cache_release(page); |
49 | } | ||
50 | } else { /* zap_pte() is not called when pte_none() */ | ||
51 | if (!pte_file(pte)) { | ||
42 | update_hiwater_rss(mm); | 52 | update_hiwater_rss(mm); |
43 | dec_mm_counter(mm, MM_FILEPAGES); | 53 | entry = pte_to_swp_entry(pte); |
54 | if (non_swap_entry(entry)) { | ||
55 | if (is_migration_entry(entry)) { | ||
56 | page = migration_entry_to_page(entry); | ||
57 | dec_mm_counter(mm, mm_counter(page)); | ||
58 | } | ||
59 | } else { | ||
60 | free_swap_and_cache(entry); | ||
61 | dec_mm_counter(mm, MM_SWAPENTS); | ||
62 | } | ||
44 | } | 63 | } |
45 | } else { | ||
46 | if (!pte_file(pte)) | ||
47 | free_swap_and_cache(pte_to_swp_entry(pte)); | ||
48 | pte_clear_not_present_full(mm, addr, ptep, 0); | 64 | pte_clear_not_present_full(mm, addr, ptep, 0); |
49 | } | 65 | } |
50 | } | 66 | } |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index da23eb96779f..1546655a2d78 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1166,8 +1166,10 @@ alloc: | |||
1166 | } else { | 1166 | } else { |
1167 | ret = do_huge_pmd_wp_page_fallback(mm, vma, address, | 1167 | ret = do_huge_pmd_wp_page_fallback(mm, vma, address, |
1168 | pmd, orig_pmd, page, haddr); | 1168 | pmd, orig_pmd, page, haddr); |
1169 | if (ret & VM_FAULT_OOM) | 1169 | if (ret & VM_FAULT_OOM) { |
1170 | split_huge_page(page); | 1170 | split_huge_page(page); |
1171 | ret |= VM_FAULT_FALLBACK; | ||
1172 | } | ||
1171 | put_page(page); | 1173 | put_page(page); |
1172 | } | 1174 | } |
1173 | count_vm_event(THP_FAULT_FALLBACK); | 1175 | count_vm_event(THP_FAULT_FALLBACK); |
@@ -1179,9 +1181,10 @@ alloc: | |||
1179 | if (page) { | 1181 | if (page) { |
1180 | split_huge_page(page); | 1182 | split_huge_page(page); |
1181 | put_page(page); | 1183 | put_page(page); |
1182 | } | 1184 | } else |
1185 | split_huge_page_pmd(vma, address, pmd); | ||
1186 | ret |= VM_FAULT_FALLBACK; | ||
1183 | count_vm_event(THP_FAULT_FALLBACK); | 1187 | count_vm_event(THP_FAULT_FALLBACK); |
1184 | ret |= VM_FAULT_OOM; | ||
1185 | goto out; | 1188 | goto out; |
1186 | } | 1189 | } |
1187 | 1190 | ||
@@ -1958,7 +1961,7 @@ out: | |||
1958 | return ret; | 1961 | return ret; |
1959 | } | 1962 | } |
1960 | 1963 | ||
1961 | #define VM_NO_THP (VM_SPECIAL|VM_MIXEDMAP|VM_HUGETLB|VM_SHARED|VM_MAYSHARE) | 1964 | #define VM_NO_THP (VM_SPECIAL | VM_HUGETLB | VM_SHARED | VM_MAYSHARE) |
1962 | 1965 | ||
1963 | int hugepage_madvise(struct vm_area_struct *vma, | 1966 | int hugepage_madvise(struct vm_area_struct *vma, |
1964 | unsigned long *vm_flags, int advice) | 1967 | unsigned long *vm_flags, int advice) |
@@ -444,7 +444,7 @@ static void break_cow(struct rmap_item *rmap_item) | |||
444 | static struct page *page_trans_compound_anon(struct page *page) | 444 | static struct page *page_trans_compound_anon(struct page *page) |
445 | { | 445 | { |
446 | if (PageTransCompound(page)) { | 446 | if (PageTransCompound(page)) { |
447 | struct page *head = compound_trans_head(page); | 447 | struct page *head = compound_head(page); |
448 | /* | 448 | /* |
449 | * head may actually be splitted and freed from under | 449 | * head may actually be splitted and freed from under |
450 | * us but it's ok here. | 450 | * us but it's ok here. |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 53385cd4e6f0..5b6b0039f725 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1127,8 +1127,8 @@ skip_node: | |||
1127 | * skipping css reference should be safe. | 1127 | * skipping css reference should be safe. |
1128 | */ | 1128 | */ |
1129 | if (next_css) { | 1129 | if (next_css) { |
1130 | if ((next_css->flags & CSS_ONLINE) && | 1130 | if ((next_css == &root->css) || |
1131 | (next_css == &root->css || css_tryget(next_css))) | 1131 | ((next_css->flags & CSS_ONLINE) && css_tryget(next_css))) |
1132 | return mem_cgroup_from_css(next_css); | 1132 | return mem_cgroup_from_css(next_css); |
1133 | 1133 | ||
1134 | prev_css = next_css; | 1134 | prev_css = next_css; |
@@ -1687,7 +1687,7 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
1687 | * protects memcg_name and makes sure that parallel ooms do not | 1687 | * protects memcg_name and makes sure that parallel ooms do not |
1688 | * interleave | 1688 | * interleave |
1689 | */ | 1689 | */ |
1690 | static DEFINE_SPINLOCK(oom_info_lock); | 1690 | static DEFINE_MUTEX(oom_info_lock); |
1691 | struct cgroup *task_cgrp; | 1691 | struct cgroup *task_cgrp; |
1692 | struct cgroup *mem_cgrp; | 1692 | struct cgroup *mem_cgrp; |
1693 | static char memcg_name[PATH_MAX]; | 1693 | static char memcg_name[PATH_MAX]; |
@@ -1698,7 +1698,7 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
1698 | if (!p) | 1698 | if (!p) |
1699 | return; | 1699 | return; |
1700 | 1700 | ||
1701 | spin_lock(&oom_info_lock); | 1701 | mutex_lock(&oom_info_lock); |
1702 | rcu_read_lock(); | 1702 | rcu_read_lock(); |
1703 | 1703 | ||
1704 | mem_cgrp = memcg->css.cgroup; | 1704 | mem_cgrp = memcg->css.cgroup; |
@@ -1767,7 +1767,7 @@ done: | |||
1767 | 1767 | ||
1768 | pr_cont("\n"); | 1768 | pr_cont("\n"); |
1769 | } | 1769 | } |
1770 | spin_unlock(&oom_info_lock); | 1770 | mutex_unlock(&oom_info_lock); |
1771 | } | 1771 | } |
1772 | 1772 | ||
1773 | /* | 1773 | /* |
@@ -6595,6 +6595,7 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) | |||
6595 | { | 6595 | { |
6596 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 6596 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
6597 | struct mem_cgroup_event *event, *tmp; | 6597 | struct mem_cgroup_event *event, *tmp; |
6598 | struct cgroup_subsys_state *iter; | ||
6598 | 6599 | ||
6599 | /* | 6600 | /* |
6600 | * Unregister events and notify userspace. | 6601 | * Unregister events and notify userspace. |
@@ -6611,7 +6612,14 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) | |||
6611 | kmem_cgroup_css_offline(memcg); | 6612 | kmem_cgroup_css_offline(memcg); |
6612 | 6613 | ||
6613 | mem_cgroup_invalidate_reclaim_iterators(memcg); | 6614 | mem_cgroup_invalidate_reclaim_iterators(memcg); |
6614 | mem_cgroup_reparent_charges(memcg); | 6615 | |
6616 | /* | ||
6617 | * This requires that offlining is serialized. Right now that is | ||
6618 | * guaranteed because css_killed_work_fn() holds the cgroup_mutex. | ||
6619 | */ | ||
6620 | css_for_each_descendant_post(iter, css) | ||
6621 | mem_cgroup_reparent_charges(mem_cgroup_from_css(iter)); | ||
6622 | |||
6615 | mem_cgroup_destroy_all_caches(memcg); | 6623 | mem_cgroup_destroy_all_caches(memcg); |
6616 | vmpressure_cleanup(&memcg->vmpressure); | 6624 | vmpressure_cleanup(&memcg->vmpressure); |
6617 | } | 6625 | } |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 2f2f34a4e77d..90002ea43638 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -1651,7 +1651,7 @@ int soft_offline_page(struct page *page, int flags) | |||
1651 | { | 1651 | { |
1652 | int ret; | 1652 | int ret; |
1653 | unsigned long pfn = page_to_pfn(page); | 1653 | unsigned long pfn = page_to_pfn(page); |
1654 | struct page *hpage = compound_trans_head(page); | 1654 | struct page *hpage = compound_head(page); |
1655 | 1655 | ||
1656 | if (PageHWPoison(page)) { | 1656 | if (PageHWPoison(page)) { |
1657 | pr_info("soft offline: %#lx page already poisoned\n", pfn); | 1657 | pr_info("soft offline: %#lx page already poisoned\n", pfn); |
diff --git a/mm/memory.c b/mm/memory.c index be6a0c0d4ae0..22dfa617bddb 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3348,6 +3348,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3348 | if (ret & VM_FAULT_LOCKED) | 3348 | if (ret & VM_FAULT_LOCKED) |
3349 | unlock_page(vmf.page); | 3349 | unlock_page(vmf.page); |
3350 | ret = VM_FAULT_HWPOISON; | 3350 | ret = VM_FAULT_HWPOISON; |
3351 | page_cache_release(vmf.page); | ||
3351 | goto uncharge_out; | 3352 | goto uncharge_out; |
3352 | } | 3353 | } |
3353 | 3354 | ||
@@ -3703,7 +3704,6 @@ static int __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3703 | if (unlikely(is_vm_hugetlb_page(vma))) | 3704 | if (unlikely(is_vm_hugetlb_page(vma))) |
3704 | return hugetlb_fault(mm, vma, address, flags); | 3705 | return hugetlb_fault(mm, vma, address, flags); |
3705 | 3706 | ||
3706 | retry: | ||
3707 | pgd = pgd_offset(mm, address); | 3707 | pgd = pgd_offset(mm, address); |
3708 | pud = pud_alloc(mm, pgd, address); | 3708 | pud = pud_alloc(mm, pgd, address); |
3709 | if (!pud) | 3709 | if (!pud) |
@@ -3741,20 +3741,13 @@ retry: | |||
3741 | if (dirty && !pmd_write(orig_pmd)) { | 3741 | if (dirty && !pmd_write(orig_pmd)) { |
3742 | ret = do_huge_pmd_wp_page(mm, vma, address, pmd, | 3742 | ret = do_huge_pmd_wp_page(mm, vma, address, pmd, |
3743 | orig_pmd); | 3743 | orig_pmd); |
3744 | /* | 3744 | if (!(ret & VM_FAULT_FALLBACK)) |
3745 | * If COW results in an oom, the huge pmd will | 3745 | return ret; |
3746 | * have been split, so retry the fault on the | ||
3747 | * pte for a smaller charge. | ||
3748 | */ | ||
3749 | if (unlikely(ret & VM_FAULT_OOM)) | ||
3750 | goto retry; | ||
3751 | return ret; | ||
3752 | } else { | 3746 | } else { |
3753 | huge_pmd_set_accessed(mm, vma, address, pmd, | 3747 | huge_pmd_set_accessed(mm, vma, address, pmd, |
3754 | orig_pmd, dirty); | 3748 | orig_pmd, dirty); |
3749 | return 0; | ||
3755 | } | 3750 | } |
3756 | |||
3757 | return 0; | ||
3758 | } | 3751 | } |
3759 | } | 3752 | } |
3760 | 3753 | ||
diff --git a/mm/migrate.c b/mm/migrate.c index 482a33d89134..bed48809e5d0 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -178,6 +178,37 @@ out: | |||
178 | } | 178 | } |
179 | 179 | ||
180 | /* | 180 | /* |
181 | * Congratulations to trinity for discovering this bug. | ||
182 | * mm/fremap.c's remap_file_pages() accepts any range within a single vma to | ||
183 | * convert that vma to VM_NONLINEAR; and generic_file_remap_pages() will then | ||
184 | * replace the specified range by file ptes throughout (maybe populated after). | ||
185 | * If page migration finds a page within that range, while it's still located | ||
186 | * by vma_interval_tree rather than lost to i_mmap_nonlinear list, no problem: | ||
187 | * zap_pte() clears the temporary migration entry before mmap_sem is dropped. | ||
188 | * But if the migrating page is in a part of the vma outside the range to be | ||
189 | * remapped, then it will not be cleared, and remove_migration_ptes() needs to | ||
190 | * deal with it. Fortunately, this part of the vma is of course still linear, | ||
191 | * so we just need to use linear location on the nonlinear list. | ||
192 | */ | ||
193 | static int remove_linear_migration_ptes_from_nonlinear(struct page *page, | ||
194 | struct address_space *mapping, void *arg) | ||
195 | { | ||
196 | struct vm_area_struct *vma; | ||
197 | /* hugetlbfs does not support remap_pages, so no huge pgoff worries */ | ||
198 | pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT); | ||
199 | unsigned long addr; | ||
200 | |||
201 | list_for_each_entry(vma, | ||
202 | &mapping->i_mmap_nonlinear, shared.nonlinear) { | ||
203 | |||
204 | addr = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); | ||
205 | if (addr >= vma->vm_start && addr < vma->vm_end) | ||
206 | remove_migration_pte(page, vma, addr, arg); | ||
207 | } | ||
208 | return SWAP_AGAIN; | ||
209 | } | ||
210 | |||
211 | /* | ||
181 | * Get rid of all migration entries and replace them by | 212 | * Get rid of all migration entries and replace them by |
182 | * references to the indicated page. | 213 | * references to the indicated page. |
183 | */ | 214 | */ |
@@ -186,6 +217,7 @@ static void remove_migration_ptes(struct page *old, struct page *new) | |||
186 | struct rmap_walk_control rwc = { | 217 | struct rmap_walk_control rwc = { |
187 | .rmap_one = remove_migration_pte, | 218 | .rmap_one = remove_migration_pte, |
188 | .arg = old, | 219 | .arg = old, |
220 | .file_nonlinear = remove_linear_migration_ptes_from_nonlinear, | ||
189 | }; | 221 | }; |
190 | 222 | ||
191 | rmap_walk(new, &rwc); | 223 | rmap_walk(new, &rwc); |
@@ -1158,7 +1190,7 @@ static struct page *new_page_node(struct page *p, unsigned long private, | |||
1158 | pm->node); | 1190 | pm->node); |
1159 | else | 1191 | else |
1160 | return alloc_pages_exact_node(pm->node, | 1192 | return alloc_pages_exact_node(pm->node, |
1161 | GFP_HIGHUSER_MOVABLE | GFP_THISNODE, 0); | 1193 | GFP_HIGHUSER_MOVABLE | __GFP_THISNODE, 0); |
1162 | } | 1194 | } |
1163 | 1195 | ||
1164 | /* | 1196 | /* |
@@ -1544,9 +1576,9 @@ static struct page *alloc_misplaced_dst_page(struct page *page, | |||
1544 | struct page *newpage; | 1576 | struct page *newpage; |
1545 | 1577 | ||
1546 | newpage = alloc_pages_exact_node(nid, | 1578 | newpage = alloc_pages_exact_node(nid, |
1547 | (GFP_HIGHUSER_MOVABLE | GFP_THISNODE | | 1579 | (GFP_HIGHUSER_MOVABLE | |
1548 | __GFP_NOMEMALLOC | __GFP_NORETRY | | 1580 | __GFP_THISNODE | __GFP_NOMEMALLOC | |
1549 | __GFP_NOWARN) & | 1581 | __GFP_NORETRY | __GFP_NOWARN) & |
1550 | ~GFP_IOFS, 0); | 1582 | ~GFP_IOFS, 0); |
1551 | 1583 | ||
1552 | return newpage; | 1584 | return newpage; |
@@ -1747,7 +1779,8 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
1747 | goto out_dropref; | 1779 | goto out_dropref; |
1748 | 1780 | ||
1749 | new_page = alloc_pages_node(node, | 1781 | new_page = alloc_pages_node(node, |
1750 | (GFP_TRANSHUGE | GFP_THISNODE) & ~__GFP_WAIT, HPAGE_PMD_ORDER); | 1782 | (GFP_TRANSHUGE | __GFP_THISNODE) & ~__GFP_WAIT, |
1783 | HPAGE_PMD_ORDER); | ||
1751 | if (!new_page) | 1784 | if (!new_page) |
1752 | goto out_fail; | 1785 | goto out_fail; |
1753 | 1786 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e3758a09a009..3bac76ae4b30 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -369,9 +369,11 @@ void prep_compound_page(struct page *page, unsigned long order) | |||
369 | __SetPageHead(page); | 369 | __SetPageHead(page); |
370 | for (i = 1; i < nr_pages; i++) { | 370 | for (i = 1; i < nr_pages; i++) { |
371 | struct page *p = page + i; | 371 | struct page *p = page + i; |
372 | __SetPageTail(p); | ||
373 | set_page_count(p, 0); | 372 | set_page_count(p, 0); |
374 | p->first_page = page; | 373 | p->first_page = page; |
374 | /* Make sure p->first_page is always valid for PageTail() */ | ||
375 | smp_wmb(); | ||
376 | __SetPageTail(p); | ||
375 | } | 377 | } |
376 | } | 378 | } |
377 | 379 | ||
@@ -1236,6 +1238,15 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp) | |||
1236 | } | 1238 | } |
1237 | local_irq_restore(flags); | 1239 | local_irq_restore(flags); |
1238 | } | 1240 | } |
1241 | static bool gfp_thisnode_allocation(gfp_t gfp_mask) | ||
1242 | { | ||
1243 | return (gfp_mask & GFP_THISNODE) == GFP_THISNODE; | ||
1244 | } | ||
1245 | #else | ||
1246 | static bool gfp_thisnode_allocation(gfp_t gfp_mask) | ||
1247 | { | ||
1248 | return false; | ||
1249 | } | ||
1239 | #endif | 1250 | #endif |
1240 | 1251 | ||
1241 | /* | 1252 | /* |
@@ -1572,7 +1583,13 @@ again: | |||
1572 | get_pageblock_migratetype(page)); | 1583 | get_pageblock_migratetype(page)); |
1573 | } | 1584 | } |
1574 | 1585 | ||
1575 | __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order)); | 1586 | /* |
1587 | * NOTE: GFP_THISNODE allocations do not partake in the kswapd | ||
1588 | * aging protocol, so they can't be fair. | ||
1589 | */ | ||
1590 | if (!gfp_thisnode_allocation(gfp_flags)) | ||
1591 | __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order)); | ||
1592 | |||
1576 | __count_zone_vm_events(PGALLOC, zone, 1 << order); | 1593 | __count_zone_vm_events(PGALLOC, zone, 1 << order); |
1577 | zone_statistics(preferred_zone, zone, gfp_flags); | 1594 | zone_statistics(preferred_zone, zone, gfp_flags); |
1578 | local_irq_restore(flags); | 1595 | local_irq_restore(flags); |
@@ -1944,8 +1961,12 @@ zonelist_scan: | |||
1944 | * ultimately fall back to remote zones that do not | 1961 | * ultimately fall back to remote zones that do not |
1945 | * partake in the fairness round-robin cycle of this | 1962 | * partake in the fairness round-robin cycle of this |
1946 | * zonelist. | 1963 | * zonelist. |
1964 | * | ||
1965 | * NOTE: GFP_THISNODE allocations do not partake in | ||
1966 | * the kswapd aging protocol, so they can't be fair. | ||
1947 | */ | 1967 | */ |
1948 | if (alloc_flags & ALLOC_WMARK_LOW) { | 1968 | if ((alloc_flags & ALLOC_WMARK_LOW) && |
1969 | !gfp_thisnode_allocation(gfp_mask)) { | ||
1949 | if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0) | 1970 | if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0) |
1950 | continue; | 1971 | continue; |
1951 | if (!zone_local(preferred_zone, zone)) | 1972 | if (!zone_local(preferred_zone, zone)) |
@@ -2501,8 +2522,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, | |||
2501 | * allowed per node queues are empty and that nodes are | 2522 | * allowed per node queues are empty and that nodes are |
2502 | * over allocated. | 2523 | * over allocated. |
2503 | */ | 2524 | */ |
2504 | if (IS_ENABLED(CONFIG_NUMA) && | 2525 | if (gfp_thisnode_allocation(gfp_mask)) |
2505 | (gfp_mask & GFP_THISNODE) == GFP_THISNODE) | ||
2506 | goto nopage; | 2526 | goto nopage; |
2507 | 2527 | ||
2508 | restart: | 2528 | restart: |
@@ -1360,8 +1360,9 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount, | |||
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | static int try_to_unmap_nonlinear(struct page *page, | 1362 | static int try_to_unmap_nonlinear(struct page *page, |
1363 | struct address_space *mapping, struct vm_area_struct *vma) | 1363 | struct address_space *mapping, void *arg) |
1364 | { | 1364 | { |
1365 | struct vm_area_struct *vma; | ||
1365 | int ret = SWAP_AGAIN; | 1366 | int ret = SWAP_AGAIN; |
1366 | unsigned long cursor; | 1367 | unsigned long cursor; |
1367 | unsigned long max_nl_cursor = 0; | 1368 | unsigned long max_nl_cursor = 0; |
@@ -1663,7 +1664,7 @@ static int rmap_walk_file(struct page *page, struct rmap_walk_control *rwc) | |||
1663 | if (list_empty(&mapping->i_mmap_nonlinear)) | 1664 | if (list_empty(&mapping->i_mmap_nonlinear)) |
1664 | goto done; | 1665 | goto done; |
1665 | 1666 | ||
1666 | ret = rwc->file_nonlinear(page, mapping, vma); | 1667 | ret = rwc->file_nonlinear(page, mapping, rwc->arg); |
1667 | 1668 | ||
1668 | done: | 1669 | done: |
1669 | mutex_unlock(&mapping->i_mmap_mutex); | 1670 | mutex_unlock(&mapping->i_mmap_mutex); |
@@ -98,7 +98,7 @@ static void put_compound_page(struct page *page) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /* __split_huge_page_refcount can run under us */ | 100 | /* __split_huge_page_refcount can run under us */ |
101 | page_head = compound_trans_head(page); | 101 | page_head = compound_head(page); |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * THP can not break up slab pages so avoid taking | 104 | * THP can not break up slab pages so avoid taking |
@@ -253,7 +253,7 @@ bool __get_page_tail(struct page *page) | |||
253 | */ | 253 | */ |
254 | unsigned long flags; | 254 | unsigned long flags; |
255 | bool got; | 255 | bool got; |
256 | struct page *page_head = compound_trans_head(page); | 256 | struct page *page_head = compound_head(page); |
257 | 257 | ||
258 | /* Ref to put_compound_page() comment. */ | 258 | /* Ref to put_compound_page() comment. */ |
259 | if (!__compound_tail_refcounted(page_head)) { | 259 | if (!__compound_tail_refcounted(page_head)) { |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index de51c48c4393..4b65aa492fb6 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -538,6 +538,9 @@ static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev | |||
538 | struct vlan_dev_priv *vlan = vlan_dev_priv(dev); | 538 | struct vlan_dev_priv *vlan = vlan_dev_priv(dev); |
539 | struct net_device *real_dev = vlan->real_dev; | 539 | struct net_device *real_dev = vlan->real_dev; |
540 | 540 | ||
541 | if (saddr == NULL) | ||
542 | saddr = dev->dev_addr; | ||
543 | |||
541 | return dev_hard_header(skb, real_dev, type, daddr, saddr, len); | 544 | return dev_hard_header(skb, real_dev, type, daddr, saddr, len); |
542 | } | 545 | } |
543 | 546 | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index ef66365b7354..93067ecdb9a2 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1127,9 +1127,10 @@ static void br_multicast_query_received(struct net_bridge *br, | |||
1127 | struct net_bridge_port *port, | 1127 | struct net_bridge_port *port, |
1128 | struct bridge_mcast_querier *querier, | 1128 | struct bridge_mcast_querier *querier, |
1129 | int saddr, | 1129 | int saddr, |
1130 | bool is_general_query, | ||
1130 | unsigned long max_delay) | 1131 | unsigned long max_delay) |
1131 | { | 1132 | { |
1132 | if (saddr) | 1133 | if (saddr && is_general_query) |
1133 | br_multicast_update_querier_timer(br, querier, max_delay); | 1134 | br_multicast_update_querier_timer(br, querier, max_delay); |
1134 | else if (timer_pending(&querier->timer)) | 1135 | else if (timer_pending(&querier->timer)) |
1135 | return; | 1136 | return; |
@@ -1181,8 +1182,16 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1181 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; | 1182 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; |
1182 | } | 1183 | } |
1183 | 1184 | ||
1185 | /* RFC2236+RFC3376 (IGMPv2+IGMPv3) require the multicast link layer | ||
1186 | * all-systems destination addresses (224.0.0.1) for general queries | ||
1187 | */ | ||
1188 | if (!group && iph->daddr != htonl(INADDR_ALLHOSTS_GROUP)) { | ||
1189 | err = -EINVAL; | ||
1190 | goto out; | ||
1191 | } | ||
1192 | |||
1184 | br_multicast_query_received(br, port, &br->ip4_querier, !!iph->saddr, | 1193 | br_multicast_query_received(br, port, &br->ip4_querier, !!iph->saddr, |
1185 | max_delay); | 1194 | !group, max_delay); |
1186 | 1195 | ||
1187 | if (!group) | 1196 | if (!group) |
1188 | goto out; | 1197 | goto out; |
@@ -1228,6 +1237,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1228 | unsigned long max_delay; | 1237 | unsigned long max_delay; |
1229 | unsigned long now = jiffies; | 1238 | unsigned long now = jiffies; |
1230 | const struct in6_addr *group = NULL; | 1239 | const struct in6_addr *group = NULL; |
1240 | bool is_general_query; | ||
1231 | int err = 0; | 1241 | int err = 0; |
1232 | 1242 | ||
1233 | spin_lock(&br->multicast_lock); | 1243 | spin_lock(&br->multicast_lock); |
@@ -1235,6 +1245,12 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1235 | (port && port->state == BR_STATE_DISABLED)) | 1245 | (port && port->state == BR_STATE_DISABLED)) |
1236 | goto out; | 1246 | goto out; |
1237 | 1247 | ||
1248 | /* RFC2710+RFC3810 (MLDv1+MLDv2) require link-local source addresses */ | ||
1249 | if (!(ipv6_addr_type(&ip6h->saddr) & IPV6_ADDR_LINKLOCAL)) { | ||
1250 | err = -EINVAL; | ||
1251 | goto out; | ||
1252 | } | ||
1253 | |||
1238 | if (skb->len == sizeof(*mld)) { | 1254 | if (skb->len == sizeof(*mld)) { |
1239 | if (!pskb_may_pull(skb, sizeof(*mld))) { | 1255 | if (!pskb_may_pull(skb, sizeof(*mld))) { |
1240 | err = -EINVAL; | 1256 | err = -EINVAL; |
@@ -1256,8 +1272,19 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1256 | max_delay = max(msecs_to_jiffies(mldv2_mrc(mld2q)), 1UL); | 1272 | max_delay = max(msecs_to_jiffies(mldv2_mrc(mld2q)), 1UL); |
1257 | } | 1273 | } |
1258 | 1274 | ||
1275 | is_general_query = group && ipv6_addr_any(group); | ||
1276 | |||
1277 | /* RFC2710+RFC3810 (MLDv1+MLDv2) require the multicast link layer | ||
1278 | * all-nodes destination address (ff02::1) for general queries | ||
1279 | */ | ||
1280 | if (is_general_query && !ipv6_addr_is_ll_all_nodes(&ip6h->daddr)) { | ||
1281 | err = -EINVAL; | ||
1282 | goto out; | ||
1283 | } | ||
1284 | |||
1259 | br_multicast_query_received(br, port, &br->ip6_querier, | 1285 | br_multicast_query_received(br, port, &br->ip6_querier, |
1260 | !ipv6_addr_any(&ip6h->saddr), max_delay); | 1286 | !ipv6_addr_any(&ip6h->saddr), |
1287 | is_general_query, max_delay); | ||
1261 | 1288 | ||
1262 | if (!group) | 1289 | if (!group) |
1263 | goto out; | 1290 | goto out; |
diff --git a/net/can/raw.c b/net/can/raw.c index 8be757cca2ec..081e81fd017f 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -121,13 +121,9 @@ static void raw_rcv(struct sk_buff *oskb, void *data) | |||
121 | if (!ro->recv_own_msgs && oskb->sk == sk) | 121 | if (!ro->recv_own_msgs && oskb->sk == sk) |
122 | return; | 122 | return; |
123 | 123 | ||
124 | /* do not pass frames with DLC > 8 to a legacy socket */ | 124 | /* do not pass non-CAN2.0 frames to a legacy socket */ |
125 | if (!ro->fd_frames) { | 125 | if (!ro->fd_frames && oskb->len != CAN_MTU) |
126 | struct canfd_frame *cfd = (struct canfd_frame *)oskb->data; | 126 | return; |
127 | |||
128 | if (unlikely(cfd->len > CAN_MAX_DLEN)) | ||
129 | return; | ||
130 | } | ||
131 | 127 | ||
132 | /* clone the given skb to be able to enqueue it into the rcv queue */ | 128 | /* clone the given skb to be able to enqueue it into the rcv queue */ |
133 | skb = skb_clone(oskb, GFP_ATOMIC); | 129 | skb = skb_clone(oskb, GFP_ATOMIC); |
@@ -738,9 +734,7 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
738 | struct msghdr *msg, size_t size, int flags) | 734 | struct msghdr *msg, size_t size, int flags) |
739 | { | 735 | { |
740 | struct sock *sk = sock->sk; | 736 | struct sock *sk = sock->sk; |
741 | struct raw_sock *ro = raw_sk(sk); | ||
742 | struct sk_buff *skb; | 737 | struct sk_buff *skb; |
743 | int rxmtu; | ||
744 | int err = 0; | 738 | int err = 0; |
745 | int noblock; | 739 | int noblock; |
746 | 740 | ||
@@ -751,20 +745,10 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
751 | if (!skb) | 745 | if (!skb) |
752 | return err; | 746 | return err; |
753 | 747 | ||
754 | /* | 748 | if (size < skb->len) |
755 | * when serving a legacy socket the DLC <= 8 is already checked inside | ||
756 | * raw_rcv(). Now check if we need to pass a canfd_frame to a legacy | ||
757 | * socket and cut the possible CANFD_MTU/CAN_MTU length to CAN_MTU | ||
758 | */ | ||
759 | if (!ro->fd_frames) | ||
760 | rxmtu = CAN_MTU; | ||
761 | else | ||
762 | rxmtu = skb->len; | ||
763 | |||
764 | if (size < rxmtu) | ||
765 | msg->msg_flags |= MSG_TRUNC; | 749 | msg->msg_flags |= MSG_TRUNC; |
766 | else | 750 | else |
767 | size = rxmtu; | 751 | size = skb->len; |
768 | 752 | ||
769 | err = memcpy_toiovec(msg->msg_iov, skb->data, size); | 753 | err = memcpy_toiovec(msg->msg_iov, skb->data, size); |
770 | if (err < 0) { | 754 | if (err < 0) { |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b9e9e0d38672..e16129019c66 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -766,9 +766,6 @@ static void neigh_periodic_work(struct work_struct *work) | |||
766 | nht = rcu_dereference_protected(tbl->nht, | 766 | nht = rcu_dereference_protected(tbl->nht, |
767 | lockdep_is_held(&tbl->lock)); | 767 | lockdep_is_held(&tbl->lock)); |
768 | 768 | ||
769 | if (atomic_read(&tbl->entries) < tbl->gc_thresh1) | ||
770 | goto out; | ||
771 | |||
772 | /* | 769 | /* |
773 | * periodically recompute ReachableTime from random function | 770 | * periodically recompute ReachableTime from random function |
774 | */ | 771 | */ |
@@ -781,6 +778,9 @@ static void neigh_periodic_work(struct work_struct *work) | |||
781 | neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME)); | 778 | neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME)); |
782 | } | 779 | } |
783 | 780 | ||
781 | if (atomic_read(&tbl->entries) < tbl->gc_thresh1) | ||
782 | goto out; | ||
783 | |||
784 | for (i = 0 ; i < (1 << nht->hash_shift); i++) { | 784 | for (i = 0 ; i < (1 << nht->hash_shift); i++) { |
785 | np = &nht->hash_buckets[i]; | 785 | np = &nht->hash_buckets[i]; |
786 | 786 | ||
@@ -3046,7 +3046,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | |||
3046 | if (!t) | 3046 | if (!t) |
3047 | goto err; | 3047 | goto err; |
3048 | 3048 | ||
3049 | for (i = 0; i < ARRAY_SIZE(t->neigh_vars); i++) { | 3049 | for (i = 0; i < NEIGH_VAR_GC_INTERVAL; i++) { |
3050 | t->neigh_vars[i].data += (long) p; | 3050 | t->neigh_vars[i].data += (long) p; |
3051 | t->neigh_vars[i].extra1 = dev; | 3051 | t->neigh_vars[i].extra1 = dev; |
3052 | t->neigh_vars[i].extra2 = p; | 3052 | t->neigh_vars[i].extra2 = p; |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index a664f7829a6d..df9e6b1a9759 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -742,7 +742,7 @@ static bool pkt_is_ns(struct sk_buff *skb) | |||
742 | struct nd_msg *msg; | 742 | struct nd_msg *msg; |
743 | struct ipv6hdr *hdr; | 743 | struct ipv6hdr *hdr; |
744 | 744 | ||
745 | if (skb->protocol != htons(ETH_P_ARP)) | 745 | if (skb->protocol != htons(ETH_P_IPV6)) |
746 | return false; | 746 | return false; |
747 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + sizeof(struct nd_msg))) | 747 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + sizeof(struct nd_msg))) |
748 | return false; | 748 | return false; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 1a0dac2ef9ad..120eecc0f5a4 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2121,12 +2121,13 @@ EXPORT_SYMBOL(rtmsg_ifinfo); | |||
2121 | static int nlmsg_populate_fdb_fill(struct sk_buff *skb, | 2121 | static int nlmsg_populate_fdb_fill(struct sk_buff *skb, |
2122 | struct net_device *dev, | 2122 | struct net_device *dev, |
2123 | u8 *addr, u32 pid, u32 seq, | 2123 | u8 *addr, u32 pid, u32 seq, |
2124 | int type, unsigned int flags) | 2124 | int type, unsigned int flags, |
2125 | int nlflags) | ||
2125 | { | 2126 | { |
2126 | struct nlmsghdr *nlh; | 2127 | struct nlmsghdr *nlh; |
2127 | struct ndmsg *ndm; | 2128 | struct ndmsg *ndm; |
2128 | 2129 | ||
2129 | nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), NLM_F_MULTI); | 2130 | nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), nlflags); |
2130 | if (!nlh) | 2131 | if (!nlh) |
2131 | return -EMSGSIZE; | 2132 | return -EMSGSIZE; |
2132 | 2133 | ||
@@ -2164,7 +2165,7 @@ static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, int type) | |||
2164 | if (!skb) | 2165 | if (!skb) |
2165 | goto errout; | 2166 | goto errout; |
2166 | 2167 | ||
2167 | err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF); | 2168 | err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF, 0); |
2168 | if (err < 0) { | 2169 | if (err < 0) { |
2169 | kfree_skb(skb); | 2170 | kfree_skb(skb); |
2170 | goto errout; | 2171 | goto errout; |
@@ -2389,7 +2390,8 @@ static int nlmsg_populate_fdb(struct sk_buff *skb, | |||
2389 | 2390 | ||
2390 | err = nlmsg_populate_fdb_fill(skb, dev, ha->addr, | 2391 | err = nlmsg_populate_fdb_fill(skb, dev, ha->addr, |
2391 | portid, seq, | 2392 | portid, seq, |
2392 | RTM_NEWNEIGH, NTF_SELF); | 2393 | RTM_NEWNEIGH, NTF_SELF, |
2394 | NLM_F_MULTI); | ||
2393 | if (err < 0) | 2395 | if (err < 0) |
2394 | return err; | 2396 | return err; |
2395 | skip: | 2397 | skip: |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 5976ef0846bd..869c7afe3b07 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -707,9 +707,6 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
707 | new->mark = old->mark; | 707 | new->mark = old->mark; |
708 | new->skb_iif = old->skb_iif; | 708 | new->skb_iif = old->skb_iif; |
709 | __nf_copy(new, old); | 709 | __nf_copy(new, old); |
710 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) | ||
711 | new->nf_trace = old->nf_trace; | ||
712 | #endif | ||
713 | #ifdef CONFIG_NET_SCHED | 710 | #ifdef CONFIG_NET_SCHED |
714 | new->tc_index = old->tc_index; | 711 | new->tc_index = old->tc_index; |
715 | #ifdef CONFIG_NET_CLS_ACT | 712 | #ifdef CONFIG_NET_CLS_ACT |
@@ -2841,81 +2838,84 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum); | |||
2841 | 2838 | ||
2842 | /** | 2839 | /** |
2843 | * skb_segment - Perform protocol segmentation on skb. | 2840 | * skb_segment - Perform protocol segmentation on skb. |
2844 | * @skb: buffer to segment | 2841 | * @head_skb: buffer to segment |
2845 | * @features: features for the output path (see dev->features) | 2842 | * @features: features for the output path (see dev->features) |
2846 | * | 2843 | * |
2847 | * This function performs segmentation on the given skb. It returns | 2844 | * This function performs segmentation on the given skb. It returns |
2848 | * a pointer to the first in a list of new skbs for the segments. | 2845 | * a pointer to the first in a list of new skbs for the segments. |
2849 | * In case of error it returns ERR_PTR(err). | 2846 | * In case of error it returns ERR_PTR(err). |
2850 | */ | 2847 | */ |
2851 | struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features) | 2848 | struct sk_buff *skb_segment(struct sk_buff *head_skb, |
2849 | netdev_features_t features) | ||
2852 | { | 2850 | { |
2853 | struct sk_buff *segs = NULL; | 2851 | struct sk_buff *segs = NULL; |
2854 | struct sk_buff *tail = NULL; | 2852 | struct sk_buff *tail = NULL; |
2855 | struct sk_buff *fskb = skb_shinfo(skb)->frag_list; | 2853 | struct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list; |
2856 | skb_frag_t *skb_frag = skb_shinfo(skb)->frags; | 2854 | skb_frag_t *frag = skb_shinfo(head_skb)->frags; |
2857 | unsigned int mss = skb_shinfo(skb)->gso_size; | 2855 | unsigned int mss = skb_shinfo(head_skb)->gso_size; |
2858 | unsigned int doffset = skb->data - skb_mac_header(skb); | 2856 | unsigned int doffset = head_skb->data - skb_mac_header(head_skb); |
2857 | struct sk_buff *frag_skb = head_skb; | ||
2859 | unsigned int offset = doffset; | 2858 | unsigned int offset = doffset; |
2860 | unsigned int tnl_hlen = skb_tnl_header_len(skb); | 2859 | unsigned int tnl_hlen = skb_tnl_header_len(head_skb); |
2861 | unsigned int headroom; | 2860 | unsigned int headroom; |
2862 | unsigned int len; | 2861 | unsigned int len; |
2863 | __be16 proto; | 2862 | __be16 proto; |
2864 | bool csum; | 2863 | bool csum; |
2865 | int sg = !!(features & NETIF_F_SG); | 2864 | int sg = !!(features & NETIF_F_SG); |
2866 | int nfrags = skb_shinfo(skb)->nr_frags; | 2865 | int nfrags = skb_shinfo(head_skb)->nr_frags; |
2867 | int err = -ENOMEM; | 2866 | int err = -ENOMEM; |
2868 | int i = 0; | 2867 | int i = 0; |
2869 | int pos; | 2868 | int pos; |
2870 | 2869 | ||
2871 | proto = skb_network_protocol(skb); | 2870 | proto = skb_network_protocol(head_skb); |
2872 | if (unlikely(!proto)) | 2871 | if (unlikely(!proto)) |
2873 | return ERR_PTR(-EINVAL); | 2872 | return ERR_PTR(-EINVAL); |
2874 | 2873 | ||
2875 | csum = !!can_checksum_protocol(features, proto); | 2874 | csum = !!can_checksum_protocol(features, proto); |
2876 | __skb_push(skb, doffset); | 2875 | __skb_push(head_skb, doffset); |
2877 | headroom = skb_headroom(skb); | 2876 | headroom = skb_headroom(head_skb); |
2878 | pos = skb_headlen(skb); | 2877 | pos = skb_headlen(head_skb); |
2879 | 2878 | ||
2880 | do { | 2879 | do { |
2881 | struct sk_buff *nskb; | 2880 | struct sk_buff *nskb; |
2882 | skb_frag_t *frag; | 2881 | skb_frag_t *nskb_frag; |
2883 | int hsize; | 2882 | int hsize; |
2884 | int size; | 2883 | int size; |
2885 | 2884 | ||
2886 | len = skb->len - offset; | 2885 | len = head_skb->len - offset; |
2887 | if (len > mss) | 2886 | if (len > mss) |
2888 | len = mss; | 2887 | len = mss; |
2889 | 2888 | ||
2890 | hsize = skb_headlen(skb) - offset; | 2889 | hsize = skb_headlen(head_skb) - offset; |
2891 | if (hsize < 0) | 2890 | if (hsize < 0) |
2892 | hsize = 0; | 2891 | hsize = 0; |
2893 | if (hsize > len || !sg) | 2892 | if (hsize > len || !sg) |
2894 | hsize = len; | 2893 | hsize = len; |
2895 | 2894 | ||
2896 | if (!hsize && i >= nfrags && skb_headlen(fskb) && | 2895 | if (!hsize && i >= nfrags && skb_headlen(list_skb) && |
2897 | (skb_headlen(fskb) == len || sg)) { | 2896 | (skb_headlen(list_skb) == len || sg)) { |
2898 | BUG_ON(skb_headlen(fskb) > len); | 2897 | BUG_ON(skb_headlen(list_skb) > len); |
2899 | 2898 | ||
2900 | i = 0; | 2899 | i = 0; |
2901 | nfrags = skb_shinfo(fskb)->nr_frags; | 2900 | nfrags = skb_shinfo(list_skb)->nr_frags; |
2902 | skb_frag = skb_shinfo(fskb)->frags; | 2901 | frag = skb_shinfo(list_skb)->frags; |
2903 | pos += skb_headlen(fskb); | 2902 | frag_skb = list_skb; |
2903 | pos += skb_headlen(list_skb); | ||
2904 | 2904 | ||
2905 | while (pos < offset + len) { | 2905 | while (pos < offset + len) { |
2906 | BUG_ON(i >= nfrags); | 2906 | BUG_ON(i >= nfrags); |
2907 | 2907 | ||
2908 | size = skb_frag_size(skb_frag); | 2908 | size = skb_frag_size(frag); |
2909 | if (pos + size > offset + len) | 2909 | if (pos + size > offset + len) |
2910 | break; | 2910 | break; |
2911 | 2911 | ||
2912 | i++; | 2912 | i++; |
2913 | pos += size; | 2913 | pos += size; |
2914 | skb_frag++; | 2914 | frag++; |
2915 | } | 2915 | } |
2916 | 2916 | ||
2917 | nskb = skb_clone(fskb, GFP_ATOMIC); | 2917 | nskb = skb_clone(list_skb, GFP_ATOMIC); |
2918 | fskb = fskb->next; | 2918 | list_skb = list_skb->next; |
2919 | 2919 | ||
2920 | if (unlikely(!nskb)) | 2920 | if (unlikely(!nskb)) |
2921 | goto err; | 2921 | goto err; |
@@ -2936,7 +2936,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features) | |||
2936 | __skb_push(nskb, doffset); | 2936 | __skb_push(nskb, doffset); |
2937 | } else { | 2937 | } else { |
2938 | nskb = __alloc_skb(hsize + doffset + headroom, | 2938 | nskb = __alloc_skb(hsize + doffset + headroom, |
2939 | GFP_ATOMIC, skb_alloc_rx_flag(skb), | 2939 | GFP_ATOMIC, skb_alloc_rx_flag(head_skb), |
2940 | NUMA_NO_NODE); | 2940 | NUMA_NO_NODE); |
2941 | 2941 | ||
2942 | if (unlikely(!nskb)) | 2942 | if (unlikely(!nskb)) |
@@ -2952,12 +2952,12 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features) | |||
2952 | segs = nskb; | 2952 | segs = nskb; |
2953 | tail = nskb; | 2953 | tail = nskb; |
2954 | 2954 | ||
2955 | __copy_skb_header(nskb, skb); | 2955 | __copy_skb_header(nskb, head_skb); |
2956 | nskb->mac_len = skb->mac_len; | 2956 | nskb->mac_len = head_skb->mac_len; |
2957 | 2957 | ||
2958 | skb_headers_offset_update(nskb, skb_headroom(nskb) - headroom); | 2958 | skb_headers_offset_update(nskb, skb_headroom(nskb) - headroom); |
2959 | 2959 | ||
2960 | skb_copy_from_linear_data_offset(skb, -tnl_hlen, | 2960 | skb_copy_from_linear_data_offset(head_skb, -tnl_hlen, |
2961 | nskb->data - tnl_hlen, | 2961 | nskb->data - tnl_hlen, |
2962 | doffset + tnl_hlen); | 2962 | doffset + tnl_hlen); |
2963 | 2963 | ||
@@ -2966,30 +2966,32 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features) | |||
2966 | 2966 | ||
2967 | if (!sg) { | 2967 | if (!sg) { |
2968 | nskb->ip_summed = CHECKSUM_NONE; | 2968 | nskb->ip_summed = CHECKSUM_NONE; |
2969 | nskb->csum = skb_copy_and_csum_bits(skb, offset, | 2969 | nskb->csum = skb_copy_and_csum_bits(head_skb, offset, |
2970 | skb_put(nskb, len), | 2970 | skb_put(nskb, len), |
2971 | len, 0); | 2971 | len, 0); |
2972 | continue; | 2972 | continue; |
2973 | } | 2973 | } |
2974 | 2974 | ||
2975 | frag = skb_shinfo(nskb)->frags; | 2975 | nskb_frag = skb_shinfo(nskb)->frags; |
2976 | 2976 | ||
2977 | skb_copy_from_linear_data_offset(skb, offset, | 2977 | skb_copy_from_linear_data_offset(head_skb, offset, |
2978 | skb_put(nskb, hsize), hsize); | 2978 | skb_put(nskb, hsize), hsize); |
2979 | 2979 | ||
2980 | skb_shinfo(nskb)->tx_flags = skb_shinfo(skb)->tx_flags & SKBTX_SHARED_FRAG; | 2980 | skb_shinfo(nskb)->tx_flags = skb_shinfo(head_skb)->tx_flags & |
2981 | SKBTX_SHARED_FRAG; | ||
2981 | 2982 | ||
2982 | while (pos < offset + len) { | 2983 | while (pos < offset + len) { |
2983 | if (i >= nfrags) { | 2984 | if (i >= nfrags) { |
2984 | BUG_ON(skb_headlen(fskb)); | 2985 | BUG_ON(skb_headlen(list_skb)); |
2985 | 2986 | ||
2986 | i = 0; | 2987 | i = 0; |
2987 | nfrags = skb_shinfo(fskb)->nr_frags; | 2988 | nfrags = skb_shinfo(list_skb)->nr_frags; |
2988 | skb_frag = skb_shinfo(fskb)->frags; | 2989 | frag = skb_shinfo(list_skb)->frags; |
2990 | frag_skb = list_skb; | ||
2989 | 2991 | ||
2990 | BUG_ON(!nfrags); | 2992 | BUG_ON(!nfrags); |
2991 | 2993 | ||
2992 | fskb = fskb->next; | 2994 | list_skb = list_skb->next; |
2993 | } | 2995 | } |
2994 | 2996 | ||
2995 | if (unlikely(skb_shinfo(nskb)->nr_frags >= | 2997 | if (unlikely(skb_shinfo(nskb)->nr_frags >= |
@@ -3000,27 +3002,30 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features) | |||
3000 | goto err; | 3002 | goto err; |
3001 | } | 3003 | } |
3002 | 3004 | ||
3003 | *frag = *skb_frag; | 3005 | if (unlikely(skb_orphan_frags(frag_skb, GFP_ATOMIC))) |
3004 | __skb_frag_ref(frag); | 3006 | goto err; |
3005 | size = skb_frag_size(frag); | 3007 | |
3008 | *nskb_frag = *frag; | ||
3009 | __skb_frag_ref(nskb_frag); | ||
3010 | size = skb_frag_size(nskb_frag); | ||
3006 | 3011 | ||
3007 | if (pos < offset) { | 3012 | if (pos < offset) { |
3008 | frag->page_offset += offset - pos; | 3013 | nskb_frag->page_offset += offset - pos; |
3009 | skb_frag_size_sub(frag, offset - pos); | 3014 | skb_frag_size_sub(nskb_frag, offset - pos); |
3010 | } | 3015 | } |
3011 | 3016 | ||
3012 | skb_shinfo(nskb)->nr_frags++; | 3017 | skb_shinfo(nskb)->nr_frags++; |
3013 | 3018 | ||
3014 | if (pos + size <= offset + len) { | 3019 | if (pos + size <= offset + len) { |
3015 | i++; | 3020 | i++; |
3016 | skb_frag++; | 3021 | frag++; |
3017 | pos += size; | 3022 | pos += size; |
3018 | } else { | 3023 | } else { |
3019 | skb_frag_size_sub(frag, pos + size - (offset + len)); | 3024 | skb_frag_size_sub(nskb_frag, pos + size - (offset + len)); |
3020 | goto skip_fraglist; | 3025 | goto skip_fraglist; |
3021 | } | 3026 | } |
3022 | 3027 | ||
3023 | frag++; | 3028 | nskb_frag++; |
3024 | } | 3029 | } |
3025 | 3030 | ||
3026 | skip_fraglist: | 3031 | skip_fraglist: |
@@ -3034,7 +3039,7 @@ perform_csum_check: | |||
3034 | nskb->len - doffset, 0); | 3039 | nskb->len - doffset, 0); |
3035 | nskb->ip_summed = CHECKSUM_NONE; | 3040 | nskb->ip_summed = CHECKSUM_NONE; |
3036 | } | 3041 | } |
3037 | } while ((offset += len) < skb->len); | 3042 | } while ((offset += len) < head_skb->len); |
3038 | 3043 | ||
3039 | return segs; | 3044 | return segs; |
3040 | 3045 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 5b6a9431b017..c0fc6bdad1e3 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2357,10 +2357,13 @@ void release_sock(struct sock *sk) | |||
2357 | if (sk->sk_backlog.tail) | 2357 | if (sk->sk_backlog.tail) |
2358 | __release_sock(sk); | 2358 | __release_sock(sk); |
2359 | 2359 | ||
2360 | /* Warning : release_cb() might need to release sk ownership, | ||
2361 | * ie call sock_release_ownership(sk) before us. | ||
2362 | */ | ||
2360 | if (sk->sk_prot->release_cb) | 2363 | if (sk->sk_prot->release_cb) |
2361 | sk->sk_prot->release_cb(sk); | 2364 | sk->sk_prot->release_cb(sk); |
2362 | 2365 | ||
2363 | sk->sk_lock.owned = 0; | 2366 | sock_release_ownership(sk); |
2364 | if (waitqueue_active(&sk->sk_lock.wq)) | 2367 | if (waitqueue_active(&sk->sk_lock.wq)) |
2365 | wake_up(&sk->sk_lock.wq); | 2368 | wake_up(&sk->sk_lock.wq); |
2366 | spin_unlock_bh(&sk->sk_lock.slock); | 2369 | spin_unlock_bh(&sk->sk_lock.slock); |
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 327060c6c874..7ae0d7f6dbd0 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c | |||
@@ -297,7 +297,7 @@ static bool seq_nr_after(u16 a, u16 b) | |||
297 | 297 | ||
298 | void hsr_register_frame_in(struct node_entry *node, enum hsr_dev_idx dev_idx) | 298 | void hsr_register_frame_in(struct node_entry *node, enum hsr_dev_idx dev_idx) |
299 | { | 299 | { |
300 | if ((dev_idx < 0) || (dev_idx >= HSR_MAX_DEV)) { | 300 | if ((dev_idx < 0) || (dev_idx >= HSR_MAX_SLAVE)) { |
301 | WARN_ONCE(1, "%s: Invalid dev_idx (%d)\n", __func__, dev_idx); | 301 | WARN_ONCE(1, "%s: Invalid dev_idx (%d)\n", __func__, dev_idx); |
302 | return; | 302 | return; |
303 | } | 303 | } |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index ecd2c3f245ce..19ab78aca547 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1296,8 +1296,11 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |||
1296 | 1296 | ||
1297 | segs = ERR_PTR(-EPROTONOSUPPORT); | 1297 | segs = ERR_PTR(-EPROTONOSUPPORT); |
1298 | 1298 | ||
1299 | /* Note : following gso_segment() might change skb->encapsulation */ | 1299 | if (skb->encapsulation && |
1300 | udpfrag = !skb->encapsulation && proto == IPPROTO_UDP; | 1300 | skb_shinfo(skb)->gso_type & (SKB_GSO_SIT|SKB_GSO_IPIP)) |
1301 | udpfrag = proto == IPPROTO_UDP && encap; | ||
1302 | else | ||
1303 | udpfrag = proto == IPPROTO_UDP && !skb->encapsulation; | ||
1301 | 1304 | ||
1302 | ops = rcu_dereference(inet_offloads[proto]); | 1305 | ops = rcu_dereference(inet_offloads[proto]); |
1303 | if (likely(ops && ops->callbacks.gso_segment)) | 1306 | if (likely(ops && ops->callbacks.gso_segment)) |
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index bb075fc9a14f..3b01959bf4bb 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -208,7 +208,7 @@ int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | work = frag_mem_limit(nf) - nf->low_thresh; | 210 | work = frag_mem_limit(nf) - nf->low_thresh; |
211 | while (work > 0) { | 211 | while (work > 0 || force) { |
212 | spin_lock(&nf->lru_lock); | 212 | spin_lock(&nf->lru_lock); |
213 | 213 | ||
214 | if (list_empty(&nf->lru_list)) { | 214 | if (list_empty(&nf->lru_list)) { |
@@ -278,9 +278,10 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, | |||
278 | 278 | ||
279 | atomic_inc(&qp->refcnt); | 279 | atomic_inc(&qp->refcnt); |
280 | hlist_add_head(&qp->list, &hb->chain); | 280 | hlist_add_head(&qp->list, &hb->chain); |
281 | inet_frag_lru_add(nf, qp); | ||
281 | spin_unlock(&hb->chain_lock); | 282 | spin_unlock(&hb->chain_lock); |
282 | read_unlock(&f->lock); | 283 | read_unlock(&f->lock); |
283 | inet_frag_lru_add(nf, qp); | 284 | |
284 | return qp; | 285 | return qp; |
285 | } | 286 | } |
286 | 287 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 8971780aec7c..73c6b63bba74 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -422,9 +422,6 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from) | |||
422 | to->tc_index = from->tc_index; | 422 | to->tc_index = from->tc_index; |
423 | #endif | 423 | #endif |
424 | nf_copy(to, from); | 424 | nf_copy(to, from); |
425 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) | ||
426 | to->nf_trace = from->nf_trace; | ||
427 | #endif | ||
428 | #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) | 425 | #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) |
429 | to->ipvs_property = from->ipvs_property; | 426 | to->ipvs_property = from->ipvs_property; |
430 | #endif | 427 | #endif |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 50228be5c17b..78a89e61925d 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -93,13 +93,14 @@ static void tunnel_dst_reset(struct ip_tunnel *t) | |||
93 | tunnel_dst_set(t, NULL); | 93 | tunnel_dst_set(t, NULL); |
94 | } | 94 | } |
95 | 95 | ||
96 | static void tunnel_dst_reset_all(struct ip_tunnel *t) | 96 | void ip_tunnel_dst_reset_all(struct ip_tunnel *t) |
97 | { | 97 | { |
98 | int i; | 98 | int i; |
99 | 99 | ||
100 | for_each_possible_cpu(i) | 100 | for_each_possible_cpu(i) |
101 | __tunnel_dst_set(per_cpu_ptr(t->dst_cache, i), NULL); | 101 | __tunnel_dst_set(per_cpu_ptr(t->dst_cache, i), NULL); |
102 | } | 102 | } |
103 | EXPORT_SYMBOL(ip_tunnel_dst_reset_all); | ||
103 | 104 | ||
104 | static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie) | 105 | static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie) |
105 | { | 106 | { |
@@ -119,52 +120,6 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie) | |||
119 | return (struct rtable *)dst; | 120 | return (struct rtable *)dst; |
120 | } | 121 | } |
121 | 122 | ||
122 | /* Often modified stats are per cpu, other are shared (netdev->stats) */ | ||
123 | struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, | ||
124 | struct rtnl_link_stats64 *tot) | ||
125 | { | ||
126 | int i; | ||
127 | |||
128 | for_each_possible_cpu(i) { | ||
129 | const struct pcpu_sw_netstats *tstats = | ||
130 | per_cpu_ptr(dev->tstats, i); | ||
131 | u64 rx_packets, rx_bytes, tx_packets, tx_bytes; | ||
132 | unsigned int start; | ||
133 | |||
134 | do { | ||
135 | start = u64_stats_fetch_begin_bh(&tstats->syncp); | ||
136 | rx_packets = tstats->rx_packets; | ||
137 | tx_packets = tstats->tx_packets; | ||
138 | rx_bytes = tstats->rx_bytes; | ||
139 | tx_bytes = tstats->tx_bytes; | ||
140 | } while (u64_stats_fetch_retry_bh(&tstats->syncp, start)); | ||
141 | |||
142 | tot->rx_packets += rx_packets; | ||
143 | tot->tx_packets += tx_packets; | ||
144 | tot->rx_bytes += rx_bytes; | ||
145 | tot->tx_bytes += tx_bytes; | ||
146 | } | ||
147 | |||
148 | tot->multicast = dev->stats.multicast; | ||
149 | |||
150 | tot->rx_crc_errors = dev->stats.rx_crc_errors; | ||
151 | tot->rx_fifo_errors = dev->stats.rx_fifo_errors; | ||
152 | tot->rx_length_errors = dev->stats.rx_length_errors; | ||
153 | tot->rx_frame_errors = dev->stats.rx_frame_errors; | ||
154 | tot->rx_errors = dev->stats.rx_errors; | ||
155 | |||
156 | tot->tx_fifo_errors = dev->stats.tx_fifo_errors; | ||
157 | tot->tx_carrier_errors = dev->stats.tx_carrier_errors; | ||
158 | tot->tx_dropped = dev->stats.tx_dropped; | ||
159 | tot->tx_aborted_errors = dev->stats.tx_aborted_errors; | ||
160 | tot->tx_errors = dev->stats.tx_errors; | ||
161 | |||
162 | tot->collisions = dev->stats.collisions; | ||
163 | |||
164 | return tot; | ||
165 | } | ||
166 | EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64); | ||
167 | |||
168 | static bool ip_tunnel_key_match(const struct ip_tunnel_parm *p, | 123 | static bool ip_tunnel_key_match(const struct ip_tunnel_parm *p, |
169 | __be16 flags, __be32 key) | 124 | __be16 flags, __be32 key) |
170 | { | 125 | { |
@@ -759,7 +714,7 @@ static void ip_tunnel_update(struct ip_tunnel_net *itn, | |||
759 | if (set_mtu) | 714 | if (set_mtu) |
760 | dev->mtu = mtu; | 715 | dev->mtu = mtu; |
761 | } | 716 | } |
762 | tunnel_dst_reset_all(t); | 717 | ip_tunnel_dst_reset_all(t); |
763 | netdev_state_change(dev); | 718 | netdev_state_change(dev); |
764 | } | 719 | } |
765 | 720 | ||
@@ -1088,7 +1043,7 @@ void ip_tunnel_uninit(struct net_device *dev) | |||
1088 | if (itn->fb_tunnel_dev != dev) | 1043 | if (itn->fb_tunnel_dev != dev) |
1089 | ip_tunnel_del(netdev_priv(dev)); | 1044 | ip_tunnel_del(netdev_priv(dev)); |
1090 | 1045 | ||
1091 | tunnel_dst_reset_all(tunnel); | 1046 | ip_tunnel_dst_reset_all(tunnel); |
1092 | } | 1047 | } |
1093 | EXPORT_SYMBOL_GPL(ip_tunnel_uninit); | 1048 | EXPORT_SYMBOL_GPL(ip_tunnel_uninit); |
1094 | 1049 | ||
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 6156f4ef5e91..6f847dd56dbc 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c | |||
@@ -108,7 +108,6 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto) | |||
108 | nf_reset(skb); | 108 | nf_reset(skb); |
109 | secpath_reset(skb); | 109 | secpath_reset(skb); |
110 | skb_clear_hash_if_not_l4(skb); | 110 | skb_clear_hash_if_not_l4(skb); |
111 | skb_dst_drop(skb); | ||
112 | skb->vlan_tci = 0; | 111 | skb->vlan_tci = 0; |
113 | skb_set_queue_mapping(skb, 0); | 112 | skb_set_queue_mapping(skb, 0); |
114 | skb->pkt_type = PACKET_HOST; | 113 | skb->pkt_type = PACKET_HOST; |
@@ -148,3 +147,49 @@ error: | |||
148 | return ERR_PTR(err); | 147 | return ERR_PTR(err); |
149 | } | 148 | } |
150 | EXPORT_SYMBOL_GPL(iptunnel_handle_offloads); | 149 | EXPORT_SYMBOL_GPL(iptunnel_handle_offloads); |
150 | |||
151 | /* Often modified stats are per cpu, other are shared (netdev->stats) */ | ||
152 | struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, | ||
153 | struct rtnl_link_stats64 *tot) | ||
154 | { | ||
155 | int i; | ||
156 | |||
157 | for_each_possible_cpu(i) { | ||
158 | const struct pcpu_sw_netstats *tstats = | ||
159 | per_cpu_ptr(dev->tstats, i); | ||
160 | u64 rx_packets, rx_bytes, tx_packets, tx_bytes; | ||
161 | unsigned int start; | ||
162 | |||
163 | do { | ||
164 | start = u64_stats_fetch_begin_bh(&tstats->syncp); | ||
165 | rx_packets = tstats->rx_packets; | ||
166 | tx_packets = tstats->tx_packets; | ||
167 | rx_bytes = tstats->rx_bytes; | ||
168 | tx_bytes = tstats->tx_bytes; | ||
169 | } while (u64_stats_fetch_retry_bh(&tstats->syncp, start)); | ||
170 | |||
171 | tot->rx_packets += rx_packets; | ||
172 | tot->tx_packets += tx_packets; | ||
173 | tot->rx_bytes += rx_bytes; | ||
174 | tot->tx_bytes += tx_bytes; | ||
175 | } | ||
176 | |||
177 | tot->multicast = dev->stats.multicast; | ||
178 | |||
179 | tot->rx_crc_errors = dev->stats.rx_crc_errors; | ||
180 | tot->rx_fifo_errors = dev->stats.rx_fifo_errors; | ||
181 | tot->rx_length_errors = dev->stats.rx_length_errors; | ||
182 | tot->rx_frame_errors = dev->stats.rx_frame_errors; | ||
183 | tot->rx_errors = dev->stats.rx_errors; | ||
184 | |||
185 | tot->tx_fifo_errors = dev->stats.tx_fifo_errors; | ||
186 | tot->tx_carrier_errors = dev->stats.tx_carrier_errors; | ||
187 | tot->tx_dropped = dev->stats.tx_dropped; | ||
188 | tot->tx_aborted_errors = dev->stats.tx_aborted_errors; | ||
189 | tot->tx_errors = dev->stats.tx_errors; | ||
190 | |||
191 | tot->collisions = dev->stats.collisions; | ||
192 | |||
193 | return tot; | ||
194 | } | ||
195 | EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64); | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index b9b3472975ba..28863570dd60 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -2255,13 +2255,14 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb, | |||
2255 | } | 2255 | } |
2256 | 2256 | ||
2257 | static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | 2257 | static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, |
2258 | u32 portid, u32 seq, struct mfc_cache *c, int cmd) | 2258 | u32 portid, u32 seq, struct mfc_cache *c, int cmd, |
2259 | int flags) | ||
2259 | { | 2260 | { |
2260 | struct nlmsghdr *nlh; | 2261 | struct nlmsghdr *nlh; |
2261 | struct rtmsg *rtm; | 2262 | struct rtmsg *rtm; |
2262 | int err; | 2263 | int err; |
2263 | 2264 | ||
2264 | nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), NLM_F_MULTI); | 2265 | nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), flags); |
2265 | if (nlh == NULL) | 2266 | if (nlh == NULL) |
2266 | return -EMSGSIZE; | 2267 | return -EMSGSIZE; |
2267 | 2268 | ||
@@ -2329,7 +2330,7 @@ static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc, | |||
2329 | if (skb == NULL) | 2330 | if (skb == NULL) |
2330 | goto errout; | 2331 | goto errout; |
2331 | 2332 | ||
2332 | err = ipmr_fill_mroute(mrt, skb, 0, 0, mfc, cmd); | 2333 | err = ipmr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0); |
2333 | if (err < 0) | 2334 | if (err < 0) |
2334 | goto errout; | 2335 | goto errout; |
2335 | 2336 | ||
@@ -2368,7 +2369,8 @@ static int ipmr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb) | |||
2368 | if (ipmr_fill_mroute(mrt, skb, | 2369 | if (ipmr_fill_mroute(mrt, skb, |
2369 | NETLINK_CB(cb->skb).portid, | 2370 | NETLINK_CB(cb->skb).portid, |
2370 | cb->nlh->nlmsg_seq, | 2371 | cb->nlh->nlmsg_seq, |
2371 | mfc, RTM_NEWROUTE) < 0) | 2372 | mfc, RTM_NEWROUTE, |
2373 | NLM_F_MULTI) < 0) | ||
2372 | goto done; | 2374 | goto done; |
2373 | next_entry: | 2375 | next_entry: |
2374 | e++; | 2376 | e++; |
@@ -2382,7 +2384,8 @@ next_entry: | |||
2382 | if (ipmr_fill_mroute(mrt, skb, | 2384 | if (ipmr_fill_mroute(mrt, skb, |
2383 | NETLINK_CB(cb->skb).portid, | 2385 | NETLINK_CB(cb->skb).portid, |
2384 | cb->nlh->nlmsg_seq, | 2386 | cb->nlh->nlmsg_seq, |
2385 | mfc, RTM_NEWROUTE) < 0) { | 2387 | mfc, RTM_NEWROUTE, |
2388 | NLM_F_MULTI) < 0) { | ||
2386 | spin_unlock_bh(&mfc_unres_lock); | 2389 | spin_unlock_bh(&mfc_unres_lock); |
2387 | goto done; | 2390 | goto done; |
2388 | } | 2391 | } |
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c index d551e31b416e..7c676671329d 100644 --- a/net/ipv4/netfilter/nf_nat_snmp_basic.c +++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c | |||
@@ -1198,8 +1198,8 @@ static int snmp_translate(struct nf_conn *ct, | |||
1198 | map.to = NOCT1(&ct->tuplehash[!dir].tuple.dst.u3.ip); | 1198 | map.to = NOCT1(&ct->tuplehash[!dir].tuple.dst.u3.ip); |
1199 | } else { | 1199 | } else { |
1200 | /* DNAT replies */ | 1200 | /* DNAT replies */ |
1201 | map.from = NOCT1(&ct->tuplehash[dir].tuple.src.u3.ip); | 1201 | map.from = NOCT1(&ct->tuplehash[!dir].tuple.src.u3.ip); |
1202 | map.to = NOCT1(&ct->tuplehash[!dir].tuple.dst.u3.ip); | 1202 | map.to = NOCT1(&ct->tuplehash[dir].tuple.dst.u3.ip); |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | if (map.from == map.to) | 1205 | if (map.from == map.to) |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 9f3a2db9109e..97c8f5620c43 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1044,7 +1044,8 @@ void tcp_free_fastopen_req(struct tcp_sock *tp) | |||
1044 | } | 1044 | } |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, int *size) | 1047 | static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, |
1048 | int *copied, size_t size) | ||
1048 | { | 1049 | { |
1049 | struct tcp_sock *tp = tcp_sk(sk); | 1050 | struct tcp_sock *tp = tcp_sk(sk); |
1050 | int err, flags; | 1051 | int err, flags; |
@@ -1059,11 +1060,12 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, int *size) | |||
1059 | if (unlikely(tp->fastopen_req == NULL)) | 1060 | if (unlikely(tp->fastopen_req == NULL)) |
1060 | return -ENOBUFS; | 1061 | return -ENOBUFS; |
1061 | tp->fastopen_req->data = msg; | 1062 | tp->fastopen_req->data = msg; |
1063 | tp->fastopen_req->size = size; | ||
1062 | 1064 | ||
1063 | flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0; | 1065 | flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0; |
1064 | err = __inet_stream_connect(sk->sk_socket, msg->msg_name, | 1066 | err = __inet_stream_connect(sk->sk_socket, msg->msg_name, |
1065 | msg->msg_namelen, flags); | 1067 | msg->msg_namelen, flags); |
1066 | *size = tp->fastopen_req->copied; | 1068 | *copied = tp->fastopen_req->copied; |
1067 | tcp_free_fastopen_req(tp); | 1069 | tcp_free_fastopen_req(tp); |
1068 | return err; | 1070 | return err; |
1069 | } | 1071 | } |
@@ -1083,7 +1085,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1083 | 1085 | ||
1084 | flags = msg->msg_flags; | 1086 | flags = msg->msg_flags; |
1085 | if (flags & MSG_FASTOPEN) { | 1087 | if (flags & MSG_FASTOPEN) { |
1086 | err = tcp_sendmsg_fastopen(sk, msg, &copied_syn); | 1088 | err = tcp_sendmsg_fastopen(sk, msg, &copied_syn, size); |
1087 | if (err == -EINPROGRESS && copied_syn > 0) | 1089 | if (err == -EINPROGRESS && copied_syn > 0) |
1088 | goto out; | 1090 | goto out; |
1089 | else if (err) | 1091 | else if (err) |
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index ad37bf18ae4b..2388275adb9b 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -290,8 +290,7 @@ bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | |||
290 | left = tp->snd_cwnd - in_flight; | 290 | left = tp->snd_cwnd - in_flight; |
291 | if (sk_can_gso(sk) && | 291 | if (sk_can_gso(sk) && |
292 | left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd && | 292 | left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd && |
293 | left * tp->mss_cache < sk->sk_gso_max_size && | 293 | left < tp->xmit_size_goal_segs) |
294 | left < sk->sk_gso_max_segs) | ||
295 | return true; | 294 | return true; |
296 | return left <= tcp_max_tso_deferred_mss(tp); | 295 | return left <= tcp_max_tso_deferred_mss(tp); |
297 | } | 296 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 227cba79fa6b..eeaac399420d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1945,8 +1945,9 @@ void tcp_enter_loss(struct sock *sk, int how) | |||
1945 | if (skb == tcp_send_head(sk)) | 1945 | if (skb == tcp_send_head(sk)) |
1946 | break; | 1946 | break; |
1947 | 1947 | ||
1948 | if (TCP_SKB_CB(skb)->sacked & TCPCB_RETRANS) | 1948 | if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS) |
1949 | tp->undo_marker = 0; | 1949 | tp->undo_marker = 0; |
1950 | |||
1950 | TCP_SKB_CB(skb)->sacked &= (~TCPCB_TAGBITS)|TCPCB_SACKED_ACKED; | 1951 | TCP_SKB_CB(skb)->sacked &= (~TCPCB_TAGBITS)|TCPCB_SACKED_ACKED; |
1951 | if (!(TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_ACKED) || how) { | 1952 | if (!(TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_ACKED) || how) { |
1952 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED; | 1953 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 3be16727f058..17a11e65e57f 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -767,6 +767,17 @@ void tcp_release_cb(struct sock *sk) | |||
767 | if (flags & (1UL << TCP_TSQ_DEFERRED)) | 767 | if (flags & (1UL << TCP_TSQ_DEFERRED)) |
768 | tcp_tsq_handler(sk); | 768 | tcp_tsq_handler(sk); |
769 | 769 | ||
770 | /* Here begins the tricky part : | ||
771 | * We are called from release_sock() with : | ||
772 | * 1) BH disabled | ||
773 | * 2) sk_lock.slock spinlock held | ||
774 | * 3) socket owned by us (sk->sk_lock.owned == 1) | ||
775 | * | ||
776 | * But following code is meant to be called from BH handlers, | ||
777 | * so we should keep BH disabled, but early release socket ownership | ||
778 | */ | ||
779 | sock_release_ownership(sk); | ||
780 | |||
770 | if (flags & (1UL << TCP_WRITE_TIMER_DEFERRED)) { | 781 | if (flags & (1UL << TCP_WRITE_TIMER_DEFERRED)) { |
771 | tcp_write_timer_handler(sk); | 782 | tcp_write_timer_handler(sk); |
772 | __sock_put(sk); | 783 | __sock_put(sk); |
@@ -864,8 +875,8 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
864 | 875 | ||
865 | if (unlikely(skb->fclone == SKB_FCLONE_ORIG && | 876 | if (unlikely(skb->fclone == SKB_FCLONE_ORIG && |
866 | fclone->fclone == SKB_FCLONE_CLONE)) | 877 | fclone->fclone == SKB_FCLONE_CLONE)) |
867 | NET_INC_STATS_BH(sock_net(sk), | 878 | NET_INC_STATS(sock_net(sk), |
868 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); | 879 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); |
869 | 880 | ||
870 | if (unlikely(skb_cloned(skb))) | 881 | if (unlikely(skb_cloned(skb))) |
871 | skb = pskb_copy(skb, gfp_mask); | 882 | skb = pskb_copy(skb, gfp_mask); |
@@ -2337,6 +2348,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
2337 | struct tcp_sock *tp = tcp_sk(sk); | 2348 | struct tcp_sock *tp = tcp_sk(sk); |
2338 | struct inet_connection_sock *icsk = inet_csk(sk); | 2349 | struct inet_connection_sock *icsk = inet_csk(sk); |
2339 | unsigned int cur_mss; | 2350 | unsigned int cur_mss; |
2351 | int err; | ||
2340 | 2352 | ||
2341 | /* Inconslusive MTU probe */ | 2353 | /* Inconslusive MTU probe */ |
2342 | if (icsk->icsk_mtup.probe_size) { | 2354 | if (icsk->icsk_mtup.probe_size) { |
@@ -2400,11 +2412,15 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
2400 | skb_headroom(skb) >= 0xFFFF)) { | 2412 | skb_headroom(skb) >= 0xFFFF)) { |
2401 | struct sk_buff *nskb = __pskb_copy(skb, MAX_TCP_HEADER, | 2413 | struct sk_buff *nskb = __pskb_copy(skb, MAX_TCP_HEADER, |
2402 | GFP_ATOMIC); | 2414 | GFP_ATOMIC); |
2403 | return nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : | 2415 | err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : |
2404 | -ENOBUFS; | 2416 | -ENOBUFS; |
2405 | } else { | 2417 | } else { |
2406 | return tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); | 2418 | err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); |
2407 | } | 2419 | } |
2420 | |||
2421 | if (likely(!err)) | ||
2422 | TCP_SKB_CB(skb)->sacked |= TCPCB_EVER_RETRANS; | ||
2423 | return err; | ||
2408 | } | 2424 | } |
2409 | 2425 | ||
2410 | int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | 2426 | int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) |
@@ -2908,7 +2924,12 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) | |||
2908 | space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - | 2924 | space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - |
2909 | MAX_TCP_OPTION_SPACE; | 2925 | MAX_TCP_OPTION_SPACE; |
2910 | 2926 | ||
2911 | syn_data = skb_copy_expand(syn, skb_headroom(syn), space, | 2927 | space = min_t(size_t, space, fo->size); |
2928 | |||
2929 | /* limit to order-0 allocations */ | ||
2930 | space = min_t(size_t, space, SKB_MAX_HEAD(MAX_TCP_HEADER)); | ||
2931 | |||
2932 | syn_data = skb_copy_expand(syn, MAX_TCP_HEADER, space, | ||
2912 | sk->sk_allocation); | 2933 | sk->sk_allocation); |
2913 | if (syn_data == NULL) | 2934 | if (syn_data == NULL) |
2914 | goto fallback; | 2935 | goto fallback; |
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index d92e5586783e..438a73aa777c 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
@@ -138,6 +138,7 @@ config INET6_XFRM_MODE_ROUTEOPTIMIZATION | |||
138 | config IPV6_VTI | 138 | config IPV6_VTI |
139 | tristate "Virtual (secure) IPv6: tunneling" | 139 | tristate "Virtual (secure) IPv6: tunneling" |
140 | select IPV6_TUNNEL | 140 | select IPV6_TUNNEL |
141 | select NET_IP_TUNNEL | ||
141 | depends on INET6_XFRM_MODE_TUNNEL | 142 | depends on INET6_XFRM_MODE_TUNNEL |
142 | ---help--- | 143 | ---help--- |
143 | Tunneling means encapsulating data of one protocol type within | 144 | Tunneling means encapsulating data of one protocol type within |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index fdbfeca36d63..344e972426df 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1103,8 +1103,11 @@ retry: | |||
1103 | * Lifetime is greater than REGEN_ADVANCE time units. In particular, | 1103 | * Lifetime is greater than REGEN_ADVANCE time units. In particular, |
1104 | * an implementation must not create a temporary address with a zero | 1104 | * an implementation must not create a temporary address with a zero |
1105 | * Preferred Lifetime. | 1105 | * Preferred Lifetime. |
1106 | * Use age calculation as in addrconf_verify to avoid unnecessary | ||
1107 | * temporary addresses being generated. | ||
1106 | */ | 1108 | */ |
1107 | if (tmp_prefered_lft <= regen_advance) { | 1109 | age = (now - tmp_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ; |
1110 | if (tmp_prefered_lft <= regen_advance + age) { | ||
1108 | in6_ifa_put(ifp); | 1111 | in6_ifa_put(ifp); |
1109 | in6_dev_put(idev); | 1112 | in6_dev_put(idev); |
1110 | ret = -1; | 1113 | ret = -1; |
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c index 140748debc4a..8af3eb57f438 100644 --- a/net/ipv6/exthdrs_core.c +++ b/net/ipv6/exthdrs_core.c | |||
@@ -212,7 +212,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, | |||
212 | found = (nexthdr == target); | 212 | found = (nexthdr == target); |
213 | 213 | ||
214 | if ((!ipv6_ext_hdr(nexthdr)) || nexthdr == NEXTHDR_NONE) { | 214 | if ((!ipv6_ext_hdr(nexthdr)) || nexthdr == NEXTHDR_NONE) { |
215 | if (target < 0) | 215 | if (target < 0 || found) |
216 | break; | 216 | break; |
217 | return -ENOENT; | 217 | return -ENOENT; |
218 | } | 218 | } |
diff --git a/net/ipv6/exthdrs_offload.c b/net/ipv6/exthdrs_offload.c index cf77f3abfd06..447a7fbd1bb6 100644 --- a/net/ipv6/exthdrs_offload.c +++ b/net/ipv6/exthdrs_offload.c | |||
@@ -25,11 +25,11 @@ int __init ipv6_exthdrs_offload_init(void) | |||
25 | int ret; | 25 | int ret; |
26 | 26 | ||
27 | ret = inet6_add_offload(&rthdr_offload, IPPROTO_ROUTING); | 27 | ret = inet6_add_offload(&rthdr_offload, IPPROTO_ROUTING); |
28 | if (!ret) | 28 | if (ret) |
29 | goto out; | 29 | goto out; |
30 | 30 | ||
31 | ret = inet6_add_offload(&dstopt_offload, IPPROTO_DSTOPTS); | 31 | ret = inet6_add_offload(&dstopt_offload, IPPROTO_DSTOPTS); |
32 | if (!ret) | 32 | if (ret) |
33 | goto out_rt; | 33 | goto out_rt; |
34 | 34 | ||
35 | out: | 35 | out: |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 1e8683b135bb..59f95affceb0 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -89,7 +89,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
89 | unsigned int unfrag_ip6hlen; | 89 | unsigned int unfrag_ip6hlen; |
90 | u8 *prevhdr; | 90 | u8 *prevhdr; |
91 | int offset = 0; | 91 | int offset = 0; |
92 | bool tunnel; | 92 | bool encap, udpfrag; |
93 | int nhoff; | 93 | int nhoff; |
94 | 94 | ||
95 | if (unlikely(skb_shinfo(skb)->gso_type & | 95 | if (unlikely(skb_shinfo(skb)->gso_type & |
@@ -110,8 +110,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
110 | if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) | 110 | if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) |
111 | goto out; | 111 | goto out; |
112 | 112 | ||
113 | tunnel = SKB_GSO_CB(skb)->encap_level > 0; | 113 | encap = SKB_GSO_CB(skb)->encap_level > 0; |
114 | if (tunnel) | 114 | if (encap) |
115 | features = skb->dev->hw_enc_features & netif_skb_features(skb); | 115 | features = skb->dev->hw_enc_features & netif_skb_features(skb); |
116 | SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h); | 116 | SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h); |
117 | 117 | ||
@@ -121,6 +121,12 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
121 | 121 | ||
122 | proto = ipv6_gso_pull_exthdrs(skb, ipv6h->nexthdr); | 122 | proto = ipv6_gso_pull_exthdrs(skb, ipv6h->nexthdr); |
123 | 123 | ||
124 | if (skb->encapsulation && | ||
125 | skb_shinfo(skb)->gso_type & (SKB_GSO_SIT|SKB_GSO_IPIP)) | ||
126 | udpfrag = proto == IPPROTO_UDP && encap; | ||
127 | else | ||
128 | udpfrag = proto == IPPROTO_UDP && !skb->encapsulation; | ||
129 | |||
124 | ops = rcu_dereference(inet6_offloads[proto]); | 130 | ops = rcu_dereference(inet6_offloads[proto]); |
125 | if (likely(ops && ops->callbacks.gso_segment)) { | 131 | if (likely(ops && ops->callbacks.gso_segment)) { |
126 | skb_reset_transport_header(skb); | 132 | skb_reset_transport_header(skb); |
@@ -133,13 +139,9 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
133 | for (skb = segs; skb; skb = skb->next) { | 139 | for (skb = segs; skb; skb = skb->next) { |
134 | ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff); | 140 | ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff); |
135 | ipv6h->payload_len = htons(skb->len - nhoff - sizeof(*ipv6h)); | 141 | ipv6h->payload_len = htons(skb->len - nhoff - sizeof(*ipv6h)); |
136 | if (tunnel) { | ||
137 | skb_reset_inner_headers(skb); | ||
138 | skb->encapsulation = 1; | ||
139 | } | ||
140 | skb->network_header = (u8 *)ipv6h - skb->head; | 142 | skb->network_header = (u8 *)ipv6h - skb->head; |
141 | 143 | ||
142 | if (!tunnel && proto == IPPROTO_UDP) { | 144 | if (udpfrag) { |
143 | unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr); | 145 | unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr); |
144 | fptr = (struct frag_hdr *)((u8 *)ipv6h + unfrag_ip6hlen); | 146 | fptr = (struct frag_hdr *)((u8 *)ipv6h + unfrag_ip6hlen); |
145 | fptr->frag_off = htons(offset); | 147 | fptr->frag_off = htons(offset); |
@@ -148,6 +150,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
148 | offset += (ntohs(ipv6h->payload_len) - | 150 | offset += (ntohs(ipv6h->payload_len) - |
149 | sizeof(struct frag_hdr)); | 151 | sizeof(struct frag_hdr)); |
150 | } | 152 | } |
153 | if (encap) | ||
154 | skb_reset_inner_headers(skb); | ||
151 | } | 155 | } |
152 | 156 | ||
153 | out: | 157 | out: |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 070a2fae2375..64d6073731d3 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -530,9 +530,6 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) | |||
530 | to->tc_index = from->tc_index; | 530 | to->tc_index = from->tc_index; |
531 | #endif | 531 | #endif |
532 | nf_copy(to, from); | 532 | nf_copy(to, from); |
533 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) | ||
534 | to->nf_trace = from->nf_trace; | ||
535 | #endif | ||
536 | skb_copy_secmark(to, from); | 533 | skb_copy_secmark(to, from); |
537 | } | 534 | } |
538 | 535 | ||
@@ -1104,21 +1101,19 @@ static void ip6_append_data_mtu(unsigned int *mtu, | |||
1104 | unsigned int fragheaderlen, | 1101 | unsigned int fragheaderlen, |
1105 | struct sk_buff *skb, | 1102 | struct sk_buff *skb, |
1106 | struct rt6_info *rt, | 1103 | struct rt6_info *rt, |
1107 | bool pmtuprobe) | 1104 | unsigned int orig_mtu) |
1108 | { | 1105 | { |
1109 | if (!(rt->dst.flags & DST_XFRM_TUNNEL)) { | 1106 | if (!(rt->dst.flags & DST_XFRM_TUNNEL)) { |
1110 | if (skb == NULL) { | 1107 | if (skb == NULL) { |
1111 | /* first fragment, reserve header_len */ | 1108 | /* first fragment, reserve header_len */ |
1112 | *mtu = *mtu - rt->dst.header_len; | 1109 | *mtu = orig_mtu - rt->dst.header_len; |
1113 | 1110 | ||
1114 | } else { | 1111 | } else { |
1115 | /* | 1112 | /* |
1116 | * this fragment is not first, the headers | 1113 | * this fragment is not first, the headers |
1117 | * space is regarded as data space. | 1114 | * space is regarded as data space. |
1118 | */ | 1115 | */ |
1119 | *mtu = min(*mtu, pmtuprobe ? | 1116 | *mtu = orig_mtu; |
1120 | rt->dst.dev->mtu : | ||
1121 | dst_mtu(rt->dst.path)); | ||
1122 | } | 1117 | } |
1123 | *maxfraglen = ((*mtu - fragheaderlen) & ~7) | 1118 | *maxfraglen = ((*mtu - fragheaderlen) & ~7) |
1124 | + fragheaderlen - sizeof(struct frag_hdr); | 1119 | + fragheaderlen - sizeof(struct frag_hdr); |
@@ -1135,7 +1130,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1135 | struct ipv6_pinfo *np = inet6_sk(sk); | 1130 | struct ipv6_pinfo *np = inet6_sk(sk); |
1136 | struct inet_cork *cork; | 1131 | struct inet_cork *cork; |
1137 | struct sk_buff *skb, *skb_prev = NULL; | 1132 | struct sk_buff *skb, *skb_prev = NULL; |
1138 | unsigned int maxfraglen, fragheaderlen, mtu; | 1133 | unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu; |
1139 | int exthdrlen; | 1134 | int exthdrlen; |
1140 | int dst_exthdrlen; | 1135 | int dst_exthdrlen; |
1141 | int hh_len; | 1136 | int hh_len; |
@@ -1217,6 +1212,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1217 | dst_exthdrlen = 0; | 1212 | dst_exthdrlen = 0; |
1218 | mtu = cork->fragsize; | 1213 | mtu = cork->fragsize; |
1219 | } | 1214 | } |
1215 | orig_mtu = mtu; | ||
1220 | 1216 | ||
1221 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); | 1217 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); |
1222 | 1218 | ||
@@ -1314,8 +1310,7 @@ alloc_new_skb: | |||
1314 | if (skb == NULL || skb_prev == NULL) | 1310 | if (skb == NULL || skb_prev == NULL) |
1315 | ip6_append_data_mtu(&mtu, &maxfraglen, | 1311 | ip6_append_data_mtu(&mtu, &maxfraglen, |
1316 | fragheaderlen, skb, rt, | 1312 | fragheaderlen, skb, rt, |
1317 | np->pmtudisc >= | 1313 | orig_mtu); |
1318 | IPV6_PMTUDISC_PROBE); | ||
1319 | 1314 | ||
1320 | skb_prev = skb; | 1315 | skb_prev = skb; |
1321 | 1316 | ||
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 0eb4038a4d63..8737400af0a0 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -2349,13 +2349,14 @@ int ip6mr_get_route(struct net *net, | |||
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, | 2351 | static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, |
2352 | u32 portid, u32 seq, struct mfc6_cache *c, int cmd) | 2352 | u32 portid, u32 seq, struct mfc6_cache *c, int cmd, |
2353 | int flags) | ||
2353 | { | 2354 | { |
2354 | struct nlmsghdr *nlh; | 2355 | struct nlmsghdr *nlh; |
2355 | struct rtmsg *rtm; | 2356 | struct rtmsg *rtm; |
2356 | int err; | 2357 | int err; |
2357 | 2358 | ||
2358 | nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), NLM_F_MULTI); | 2359 | nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), flags); |
2359 | if (nlh == NULL) | 2360 | if (nlh == NULL) |
2360 | return -EMSGSIZE; | 2361 | return -EMSGSIZE; |
2361 | 2362 | ||
@@ -2423,7 +2424,7 @@ static void mr6_netlink_event(struct mr6_table *mrt, struct mfc6_cache *mfc, | |||
2423 | if (skb == NULL) | 2424 | if (skb == NULL) |
2424 | goto errout; | 2425 | goto errout; |
2425 | 2426 | ||
2426 | err = ip6mr_fill_mroute(mrt, skb, 0, 0, mfc, cmd); | 2427 | err = ip6mr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0); |
2427 | if (err < 0) | 2428 | if (err < 0) |
2428 | goto errout; | 2429 | goto errout; |
2429 | 2430 | ||
@@ -2462,7 +2463,8 @@ static int ip6mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb) | |||
2462 | if (ip6mr_fill_mroute(mrt, skb, | 2463 | if (ip6mr_fill_mroute(mrt, skb, |
2463 | NETLINK_CB(cb->skb).portid, | 2464 | NETLINK_CB(cb->skb).portid, |
2464 | cb->nlh->nlmsg_seq, | 2465 | cb->nlh->nlmsg_seq, |
2465 | mfc, RTM_NEWROUTE) < 0) | 2466 | mfc, RTM_NEWROUTE, |
2467 | NLM_F_MULTI) < 0) | ||
2466 | goto done; | 2468 | goto done; |
2467 | next_entry: | 2469 | next_entry: |
2468 | e++; | 2470 | e++; |
@@ -2476,7 +2478,8 @@ next_entry: | |||
2476 | if (ip6mr_fill_mroute(mrt, skb, | 2478 | if (ip6mr_fill_mroute(mrt, skb, |
2477 | NETLINK_CB(cb->skb).portid, | 2479 | NETLINK_CB(cb->skb).portid, |
2478 | cb->nlh->nlmsg_seq, | 2480 | cb->nlh->nlmsg_seq, |
2479 | mfc, RTM_NEWROUTE) < 0) { | 2481 | mfc, RTM_NEWROUTE, |
2482 | NLM_F_MULTI) < 0) { | ||
2480 | spin_unlock_bh(&mfc_unres_lock); | 2483 | spin_unlock_bh(&mfc_unres_lock); |
2481 | goto done; | 2484 | goto done; |
2482 | } | 2485 | } |
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index fb9beb78f00b..587bbdcb22b4 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c | |||
@@ -135,6 +135,7 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
135 | fl6.flowi6_proto = IPPROTO_ICMPV6; | 135 | fl6.flowi6_proto = IPPROTO_ICMPV6; |
136 | fl6.saddr = np->saddr; | 136 | fl6.saddr = np->saddr; |
137 | fl6.daddr = *daddr; | 137 | fl6.daddr = *daddr; |
138 | fl6.flowi6_mark = sk->sk_mark; | ||
138 | fl6.fl6_icmp_type = user_icmph.icmp6_type; | 139 | fl6.fl6_icmp_type = user_icmph.icmp6_type; |
139 | fl6.fl6_icmp_code = user_icmph.icmp6_code; | 140 | fl6.fl6_icmp_code = user_icmph.icmp6_code; |
140 | security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); | 141 | security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 11dac21e6586..fba54a407bb2 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1513,7 +1513,7 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1513 | if (!table) | 1513 | if (!table) |
1514 | goto out; | 1514 | goto out; |
1515 | 1515 | ||
1516 | rt = ip6_dst_alloc(net, NULL, DST_NOCOUNT, table); | 1516 | rt = ip6_dst_alloc(net, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT, table); |
1517 | 1517 | ||
1518 | if (!rt) { | 1518 | if (!rt) { |
1519 | err = -ENOMEM; | 1519 | err = -ENOMEM; |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 3dfbcf1dcb1c..b4d74c86586c 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -475,6 +475,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev) | |||
475 | ipip6_tunnel_unlink(sitn, tunnel); | 475 | ipip6_tunnel_unlink(sitn, tunnel); |
476 | ipip6_tunnel_del_prl(tunnel, NULL); | 476 | ipip6_tunnel_del_prl(tunnel, NULL); |
477 | } | 477 | } |
478 | ip_tunnel_dst_reset_all(tunnel); | ||
478 | dev_put(dev); | 479 | dev_put(dev); |
479 | } | 480 | } |
480 | 481 | ||
@@ -1082,6 +1083,7 @@ static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p) | |||
1082 | t->parms.link = p->link; | 1083 | t->parms.link = p->link; |
1083 | ipip6_tunnel_bind_dev(t->dev); | 1084 | ipip6_tunnel_bind_dev(t->dev); |
1084 | } | 1085 | } |
1086 | ip_tunnel_dst_reset_all(t); | ||
1085 | netdev_state_change(t->dev); | 1087 | netdev_state_change(t->dev); |
1086 | } | 1088 | } |
1087 | 1089 | ||
@@ -1112,6 +1114,7 @@ static int ipip6_tunnel_update_6rd(struct ip_tunnel *t, | |||
1112 | t->ip6rd.relay_prefix = relay_prefix; | 1114 | t->ip6rd.relay_prefix = relay_prefix; |
1113 | t->ip6rd.prefixlen = ip6rd->prefixlen; | 1115 | t->ip6rd.prefixlen = ip6rd->prefixlen; |
1114 | t->ip6rd.relay_prefixlen = ip6rd->relay_prefixlen; | 1116 | t->ip6rd.relay_prefixlen = ip6rd->relay_prefixlen; |
1117 | ip_tunnel_dst_reset_all(t); | ||
1115 | netdev_state_change(t->dev); | 1118 | netdev_state_change(t->dev); |
1116 | return 0; | 1119 | return 0; |
1117 | } | 1120 | } |
@@ -1271,6 +1274,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1271 | err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL); | 1274 | err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL); |
1272 | break; | 1275 | break; |
1273 | } | 1276 | } |
1277 | ip_tunnel_dst_reset_all(t); | ||
1274 | netdev_state_change(dev); | 1278 | netdev_state_change(dev); |
1275 | break; | 1279 | break; |
1276 | 1280 | ||
@@ -1326,6 +1330,9 @@ static const struct net_device_ops ipip6_netdev_ops = { | |||
1326 | 1330 | ||
1327 | static void ipip6_dev_free(struct net_device *dev) | 1331 | static void ipip6_dev_free(struct net_device *dev) |
1328 | { | 1332 | { |
1333 | struct ip_tunnel *tunnel = netdev_priv(dev); | ||
1334 | |||
1335 | free_percpu(tunnel->dst_cache); | ||
1329 | free_percpu(dev->tstats); | 1336 | free_percpu(dev->tstats); |
1330 | free_netdev(dev); | 1337 | free_netdev(dev); |
1331 | } | 1338 | } |
@@ -1375,6 +1382,12 @@ static int ipip6_tunnel_init(struct net_device *dev) | |||
1375 | u64_stats_init(&ipip6_tunnel_stats->syncp); | 1382 | u64_stats_init(&ipip6_tunnel_stats->syncp); |
1376 | } | 1383 | } |
1377 | 1384 | ||
1385 | tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst); | ||
1386 | if (!tunnel->dst_cache) { | ||
1387 | free_percpu(dev->tstats); | ||
1388 | return -ENOMEM; | ||
1389 | } | ||
1390 | |||
1378 | return 0; | 1391 | return 0; |
1379 | } | 1392 | } |
1380 | 1393 | ||
@@ -1405,6 +1418,12 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) | |||
1405 | u64_stats_init(&ipip6_fb_stats->syncp); | 1418 | u64_stats_init(&ipip6_fb_stats->syncp); |
1406 | } | 1419 | } |
1407 | 1420 | ||
1421 | tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst); | ||
1422 | if (!tunnel->dst_cache) { | ||
1423 | free_percpu(dev->tstats); | ||
1424 | return -ENOMEM; | ||
1425 | } | ||
1426 | |||
1408 | dev_hold(dev); | 1427 | dev_hold(dev); |
1409 | rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); | 1428 | rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); |
1410 | return 0; | 1429 | return 0; |
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index e7359f9eaa8d..b261ee8b83fc 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c | |||
@@ -113,7 +113,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, | |||
113 | fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); | 113 | fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); |
114 | fptr->nexthdr = nexthdr; | 114 | fptr->nexthdr = nexthdr; |
115 | fptr->reserved = 0; | 115 | fptr->reserved = 0; |
116 | ipv6_select_ident(fptr, (struct rt6_info *)skb_dst(skb)); | 116 | fptr->identification = skb_shinfo(skb)->ip6_frag_id; |
117 | 117 | ||
118 | /* Fragment the skb. ipv6 header and the remaining fields of the | 118 | /* Fragment the skb. ipv6 header and the remaining fields of the |
119 | * fragment header are updated in ipv6_gso_segment() | 119 | * fragment header are updated in ipv6_gso_segment() |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 1a04c1329362..79326978517a 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -433,12 +433,13 @@ static inline int verify_sec_ctx_len(const void *p) | |||
433 | return 0; | 433 | return 0; |
434 | } | 434 | } |
435 | 435 | ||
436 | static inline struct xfrm_user_sec_ctx *pfkey_sadb2xfrm_user_sec_ctx(const struct sadb_x_sec_ctx *sec_ctx) | 436 | static inline struct xfrm_user_sec_ctx *pfkey_sadb2xfrm_user_sec_ctx(const struct sadb_x_sec_ctx *sec_ctx, |
437 | gfp_t gfp) | ||
437 | { | 438 | { |
438 | struct xfrm_user_sec_ctx *uctx = NULL; | 439 | struct xfrm_user_sec_ctx *uctx = NULL; |
439 | int ctx_size = sec_ctx->sadb_x_ctx_len; | 440 | int ctx_size = sec_ctx->sadb_x_ctx_len; |
440 | 441 | ||
441 | uctx = kmalloc((sizeof(*uctx)+ctx_size), GFP_KERNEL); | 442 | uctx = kmalloc((sizeof(*uctx)+ctx_size), gfp); |
442 | 443 | ||
443 | if (!uctx) | 444 | if (!uctx) |
444 | return NULL; | 445 | return NULL; |
@@ -1124,7 +1125,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, | |||
1124 | 1125 | ||
1125 | sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; | 1126 | sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; |
1126 | if (sec_ctx != NULL) { | 1127 | if (sec_ctx != NULL) { |
1127 | struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); | 1128 | struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_KERNEL); |
1128 | 1129 | ||
1129 | if (!uctx) | 1130 | if (!uctx) |
1130 | goto out; | 1131 | goto out; |
@@ -2231,14 +2232,14 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_ | |||
2231 | 2232 | ||
2232 | sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; | 2233 | sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; |
2233 | if (sec_ctx != NULL) { | 2234 | if (sec_ctx != NULL) { |
2234 | struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); | 2235 | struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_KERNEL); |
2235 | 2236 | ||
2236 | if (!uctx) { | 2237 | if (!uctx) { |
2237 | err = -ENOBUFS; | 2238 | err = -ENOBUFS; |
2238 | goto out; | 2239 | goto out; |
2239 | } | 2240 | } |
2240 | 2241 | ||
2241 | err = security_xfrm_policy_alloc(&xp->security, uctx); | 2242 | err = security_xfrm_policy_alloc(&xp->security, uctx, GFP_KERNEL); |
2242 | kfree(uctx); | 2243 | kfree(uctx); |
2243 | 2244 | ||
2244 | if (err) | 2245 | if (err) |
@@ -2335,12 +2336,12 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa | |||
2335 | 2336 | ||
2336 | sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; | 2337 | sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; |
2337 | if (sec_ctx != NULL) { | 2338 | if (sec_ctx != NULL) { |
2338 | struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); | 2339 | struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_KERNEL); |
2339 | 2340 | ||
2340 | if (!uctx) | 2341 | if (!uctx) |
2341 | return -ENOMEM; | 2342 | return -ENOMEM; |
2342 | 2343 | ||
2343 | err = security_xfrm_policy_alloc(&pol_ctx, uctx); | 2344 | err = security_xfrm_policy_alloc(&pol_ctx, uctx, GFP_KERNEL); |
2344 | kfree(uctx); | 2345 | kfree(uctx); |
2345 | if (err) | 2346 | if (err) |
2346 | return err; | 2347 | return err; |
@@ -3239,8 +3240,8 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt, | |||
3239 | } | 3240 | } |
3240 | if ((*dir = verify_sec_ctx_len(p))) | 3241 | if ((*dir = verify_sec_ctx_len(p))) |
3241 | goto out; | 3242 | goto out; |
3242 | uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); | 3243 | uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_ATOMIC); |
3243 | *dir = security_xfrm_policy_alloc(&xp->security, uctx); | 3244 | *dir = security_xfrm_policy_alloc(&xp->security, uctx, GFP_ATOMIC); |
3244 | kfree(uctx); | 3245 | kfree(uctx); |
3245 | 3246 | ||
3246 | if (*dir) | 3247 | if (*dir) |
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 735d0f60c83a..85d9d94c0a3c 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -112,7 +112,6 @@ struct l2tp_net { | |||
112 | spinlock_t l2tp_session_hlist_lock; | 112 | spinlock_t l2tp_session_hlist_lock; |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version); | ||
116 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); | 115 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); |
117 | 116 | ||
118 | static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) | 117 | static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) |
@@ -1863,7 +1862,7 @@ EXPORT_SYMBOL_GPL(l2tp_session_delete); | |||
1863 | /* We come here whenever a session's send_seq, cookie_len or | 1862 | /* We come here whenever a session's send_seq, cookie_len or |
1864 | * l2specific_len parameters are set. | 1863 | * l2specific_len parameters are set. |
1865 | */ | 1864 | */ |
1866 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version) | 1865 | void l2tp_session_set_header_len(struct l2tp_session *session, int version) |
1867 | { | 1866 | { |
1868 | if (version == L2TP_HDR_VER_2) { | 1867 | if (version == L2TP_HDR_VER_2) { |
1869 | session->hdr_len = 6; | 1868 | session->hdr_len = 6; |
@@ -1876,6 +1875,7 @@ static void l2tp_session_set_header_len(struct l2tp_session *session, int versio | |||
1876 | } | 1875 | } |
1877 | 1876 | ||
1878 | } | 1877 | } |
1878 | EXPORT_SYMBOL_GPL(l2tp_session_set_header_len); | ||
1879 | 1879 | ||
1880 | struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg) | 1880 | struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg) |
1881 | { | 1881 | { |
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index 1f01ba3435bc..3f93ccd6ba97 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h | |||
@@ -263,6 +263,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
263 | int length, int (*payload_hook)(struct sk_buff *skb)); | 263 | int length, int (*payload_hook)(struct sk_buff *skb)); |
264 | int l2tp_session_queue_purge(struct l2tp_session *session); | 264 | int l2tp_session_queue_purge(struct l2tp_session *session); |
265 | int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb); | 265 | int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb); |
266 | void l2tp_session_set_header_len(struct l2tp_session *session, int version); | ||
266 | 267 | ||
267 | int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, | 268 | int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, |
268 | int hdr_len); | 269 | int hdr_len); |
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index 4cfd722e9153..bd7387adea9e 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
@@ -578,8 +578,10 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf | |||
578 | if (info->attrs[L2TP_ATTR_RECV_SEQ]) | 578 | if (info->attrs[L2TP_ATTR_RECV_SEQ]) |
579 | session->recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]); | 579 | session->recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]); |
580 | 580 | ||
581 | if (info->attrs[L2TP_ATTR_SEND_SEQ]) | 581 | if (info->attrs[L2TP_ATTR_SEND_SEQ]) { |
582 | session->send_seq = nla_get_u8(info->attrs[L2TP_ATTR_SEND_SEQ]); | 582 | session->send_seq = nla_get_u8(info->attrs[L2TP_ATTR_SEND_SEQ]); |
583 | l2tp_session_set_header_len(session, session->tunnel->version); | ||
584 | } | ||
583 | 585 | ||
584 | if (info->attrs[L2TP_ATTR_LNS_MODE]) | 586 | if (info->attrs[L2TP_ATTR_LNS_MODE]) |
585 | session->lns_mode = nla_get_u8(info->attrs[L2TP_ATTR_LNS_MODE]); | 587 | session->lns_mode = nla_get_u8(info->attrs[L2TP_ATTR_LNS_MODE]); |
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index be5fadf34739..5990919356a5 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -254,12 +254,14 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int | |||
254 | po = pppox_sk(sk); | 254 | po = pppox_sk(sk); |
255 | ppp_input(&po->chan, skb); | 255 | ppp_input(&po->chan, skb); |
256 | } else { | 256 | } else { |
257 | l2tp_info(session, PPPOL2TP_MSG_DATA, "%s: socket not bound\n", | 257 | l2tp_dbg(session, PPPOL2TP_MSG_DATA, |
258 | session->name); | 258 | "%s: recv %d byte data frame, passing to L2TP socket\n", |
259 | session->name, data_len); | ||
259 | 260 | ||
260 | /* Not bound. Nothing we can do, so discard. */ | 261 | if (sock_queue_rcv_skb(sk, skb) < 0) { |
261 | atomic_long_inc(&session->stats.rx_errors); | 262 | atomic_long_inc(&session->stats.rx_errors); |
262 | kfree_skb(skb); | 263 | kfree_skb(skb); |
264 | } | ||
263 | } | 265 | } |
264 | 266 | ||
265 | return; | 267 | return; |
@@ -1312,6 +1314,7 @@ static int pppol2tp_session_setsockopt(struct sock *sk, | |||
1312 | po->chan.hdrlen = val ? PPPOL2TP_L2TP_HDR_SIZE_SEQ : | 1314 | po->chan.hdrlen = val ? PPPOL2TP_L2TP_HDR_SIZE_SEQ : |
1313 | PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; | 1315 | PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; |
1314 | } | 1316 | } |
1317 | l2tp_session_set_header_len(session, session->tunnel->version); | ||
1315 | l2tp_info(session, PPPOL2TP_MSG_CONTROL, | 1318 | l2tp_info(session, PPPOL2TP_MSG_CONTROL, |
1316 | "%s: set send_seq=%d\n", | 1319 | "%s: set send_seq=%d\n", |
1317 | session->name, session->send_seq); | 1320 | session->name, session->send_seq); |
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index f43613a97dd6..0c1ecfdf9a12 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -100,6 +100,12 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local, | |||
100 | } | 100 | } |
101 | max_bw = max(max_bw, width); | 101 | max_bw = max(max_bw, width); |
102 | } | 102 | } |
103 | |||
104 | /* use the configured bandwidth in case of monitor interface */ | ||
105 | sdata = rcu_dereference(local->monitor_sdata); | ||
106 | if (sdata && rcu_access_pointer(sdata->vif.chanctx_conf) == conf) | ||
107 | max_bw = max(max_bw, conf->def.width); | ||
108 | |||
103 | rcu_read_unlock(); | 109 | rcu_read_unlock(); |
104 | 110 | ||
105 | return max_bw; | 111 | return max_bw; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 3701930c6649..5e44e3179e02 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1692,14 +1692,8 @@ void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, | |||
1692 | void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); | 1692 | void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); |
1693 | void ieee80211_add_pending_skb(struct ieee80211_local *local, | 1693 | void ieee80211_add_pending_skb(struct ieee80211_local *local, |
1694 | struct sk_buff *skb); | 1694 | struct sk_buff *skb); |
1695 | void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, | 1695 | void ieee80211_add_pending_skbs(struct ieee80211_local *local, |
1696 | struct sk_buff_head *skbs, | 1696 | struct sk_buff_head *skbs); |
1697 | void (*fn)(void *data), void *data); | ||
1698 | static inline void ieee80211_add_pending_skbs(struct ieee80211_local *local, | ||
1699 | struct sk_buff_head *skbs) | ||
1700 | { | ||
1701 | ieee80211_add_pending_skbs_fn(local, skbs, NULL, NULL); | ||
1702 | } | ||
1703 | void ieee80211_flush_queues(struct ieee80211_local *local, | 1697 | void ieee80211_flush_queues(struct ieee80211_local *local, |
1704 | struct ieee80211_sub_if_data *sdata); | 1698 | struct ieee80211_sub_if_data *sdata); |
1705 | 1699 | ||
diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c index 2802f9d9279d..ad8b377b4b9f 100644 --- a/net/mac80211/mesh_ps.c +++ b/net/mac80211/mesh_ps.c | |||
@@ -36,6 +36,7 @@ static struct sk_buff *mps_qos_null_get(struct sta_info *sta) | |||
36 | sdata->vif.addr); | 36 | sdata->vif.addr); |
37 | nullfunc->frame_control = fc; | 37 | nullfunc->frame_control = fc; |
38 | nullfunc->duration_id = 0; | 38 | nullfunc->duration_id = 0; |
39 | nullfunc->seq_ctrl = 0; | ||
39 | /* no address resolution for this frame -> set addr 1 immediately */ | 40 | /* no address resolution for this frame -> set addr 1 immediately */ |
40 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); | 41 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); |
41 | memset(skb_put(skb, 2), 0, 2); /* append QoS control field */ | 42 | memset(skb_put(skb, 2), 0, 2); /* append QoS control field */ |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index fc1d82465b3c..245dce969b31 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -222,6 +222,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
222 | switch (vht_oper->chan_width) { | 222 | switch (vht_oper->chan_width) { |
223 | case IEEE80211_VHT_CHANWIDTH_USE_HT: | 223 | case IEEE80211_VHT_CHANWIDTH_USE_HT: |
224 | vht_chandef.width = chandef->width; | 224 | vht_chandef.width = chandef->width; |
225 | vht_chandef.center_freq1 = chandef->center_freq1; | ||
225 | break; | 226 | break; |
226 | case IEEE80211_VHT_CHANWIDTH_80MHZ: | 227 | case IEEE80211_VHT_CHANWIDTH_80MHZ: |
227 | vht_chandef.width = NL80211_CHAN_WIDTH_80; | 228 | vht_chandef.width = NL80211_CHAN_WIDTH_80; |
@@ -271,6 +272,28 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
271 | ret = 0; | 272 | ret = 0; |
272 | 273 | ||
273 | out: | 274 | out: |
275 | /* | ||
276 | * When tracking the current AP, don't do any further checks if the | ||
277 | * new chandef is identical to the one we're currently using for the | ||
278 | * connection. This keeps us from playing ping-pong with regulatory, | ||
279 | * without it the following can happen (for example): | ||
280 | * - connect to an AP with 80 MHz, world regdom allows 80 MHz | ||
281 | * - AP advertises regdom US | ||
282 | * - CRDA loads regdom US with 80 MHz prohibited (old database) | ||
283 | * - the code below detects an unsupported channel, downgrades, and | ||
284 | * we disconnect from the AP in the caller | ||
285 | * - disconnect causes CRDA to reload world regdomain and the game | ||
286 | * starts anew. | ||
287 | * (see https://bugzilla.kernel.org/show_bug.cgi?id=70881) | ||
288 | * | ||
289 | * It seems possible that there are still scenarios with CSA or real | ||
290 | * bandwidth changes where a this could happen, but those cases are | ||
291 | * less common and wouldn't completely prevent using the AP. | ||
292 | */ | ||
293 | if (tracking && | ||
294 | cfg80211_chandef_identical(chandef, &sdata->vif.bss_conf.chandef)) | ||
295 | return ret; | ||
296 | |||
274 | /* don't print the message below for VHT mismatch if VHT is disabled */ | 297 | /* don't print the message below for VHT mismatch if VHT is disabled */ |
275 | if (ret & IEEE80211_STA_DISABLE_VHT) | 298 | if (ret & IEEE80211_STA_DISABLE_VHT) |
276 | vht_chandef = *chandef; | 299 | vht_chandef = *chandef; |
@@ -3753,6 +3776,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3753 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | 3776 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
3754 | if (WARN_ON(!chanctx_conf)) { | 3777 | if (WARN_ON(!chanctx_conf)) { |
3755 | rcu_read_unlock(); | 3778 | rcu_read_unlock(); |
3779 | sta_info_free(local, new_sta); | ||
3756 | return -EINVAL; | 3780 | return -EINVAL; |
3757 | } | 3781 | } |
3758 | rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); | 3782 | rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c24ca0d0f469..3e57f96c9666 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1128,6 +1128,13 @@ static void sta_ps_end(struct sta_info *sta) | |||
1128 | sta->sta.addr, sta->sta.aid); | 1128 | sta->sta.addr, sta->sta.aid); |
1129 | 1129 | ||
1130 | if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { | 1130 | if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { |
1131 | /* | ||
1132 | * Clear the flag only if the other one is still set | ||
1133 | * so that the TX path won't start TX'ing new frames | ||
1134 | * directly ... In the case that the driver flag isn't | ||
1135 | * set ieee80211_sta_ps_deliver_wakeup() will clear it. | ||
1136 | */ | ||
1137 | clear_sta_flag(sta, WLAN_STA_PS_STA); | ||
1131 | ps_dbg(sta->sdata, "STA %pM aid %d driver-ps-blocked\n", | 1138 | ps_dbg(sta->sdata, "STA %pM aid %d driver-ps-blocked\n", |
1132 | sta->sta.addr, sta->sta.aid); | 1139 | sta->sta.addr, sta->sta.aid); |
1133 | return; | 1140 | return; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index decd30c1e290..137a192e64bc 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -91,7 +91,7 @@ static int sta_info_hash_del(struct ieee80211_local *local, | |||
91 | return -ENOENT; | 91 | return -ENOENT; |
92 | } | 92 | } |
93 | 93 | ||
94 | static void cleanup_single_sta(struct sta_info *sta) | 94 | static void __cleanup_single_sta(struct sta_info *sta) |
95 | { | 95 | { |
96 | int ac, i; | 96 | int ac, i; |
97 | struct tid_ampdu_tx *tid_tx; | 97 | struct tid_ampdu_tx *tid_tx; |
@@ -99,7 +99,8 @@ static void cleanup_single_sta(struct sta_info *sta) | |||
99 | struct ieee80211_local *local = sdata->local; | 99 | struct ieee80211_local *local = sdata->local; |
100 | struct ps_data *ps; | 100 | struct ps_data *ps; |
101 | 101 | ||
102 | if (test_sta_flag(sta, WLAN_STA_PS_STA)) { | 102 | if (test_sta_flag(sta, WLAN_STA_PS_STA) || |
103 | test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { | ||
103 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP || | 104 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP || |
104 | sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 105 | sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
105 | ps = &sdata->bss->ps; | 106 | ps = &sdata->bss->ps; |
@@ -109,6 +110,7 @@ static void cleanup_single_sta(struct sta_info *sta) | |||
109 | return; | 110 | return; |
110 | 111 | ||
111 | clear_sta_flag(sta, WLAN_STA_PS_STA); | 112 | clear_sta_flag(sta, WLAN_STA_PS_STA); |
113 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); | ||
112 | 114 | ||
113 | atomic_dec(&ps->num_sta_ps); | 115 | atomic_dec(&ps->num_sta_ps); |
114 | sta_info_recalc_tim(sta); | 116 | sta_info_recalc_tim(sta); |
@@ -139,7 +141,14 @@ static void cleanup_single_sta(struct sta_info *sta) | |||
139 | ieee80211_purge_tx_queue(&local->hw, &tid_tx->pending); | 141 | ieee80211_purge_tx_queue(&local->hw, &tid_tx->pending); |
140 | kfree(tid_tx); | 142 | kfree(tid_tx); |
141 | } | 143 | } |
144 | } | ||
142 | 145 | ||
146 | static void cleanup_single_sta(struct sta_info *sta) | ||
147 | { | ||
148 | struct ieee80211_sub_if_data *sdata = sta->sdata; | ||
149 | struct ieee80211_local *local = sdata->local; | ||
150 | |||
151 | __cleanup_single_sta(sta); | ||
143 | sta_info_free(local, sta); | 152 | sta_info_free(local, sta); |
144 | } | 153 | } |
145 | 154 | ||
@@ -330,6 +339,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
330 | rcu_read_unlock(); | 339 | rcu_read_unlock(); |
331 | 340 | ||
332 | spin_lock_init(&sta->lock); | 341 | spin_lock_init(&sta->lock); |
342 | spin_lock_init(&sta->ps_lock); | ||
333 | INIT_WORK(&sta->drv_unblock_wk, sta_unblock); | 343 | INIT_WORK(&sta->drv_unblock_wk, sta_unblock); |
334 | INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); | 344 | INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); |
335 | mutex_init(&sta->ampdu_mlme.mtx); | 345 | mutex_init(&sta->ampdu_mlme.mtx); |
@@ -487,21 +497,26 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) | |||
487 | goto out_err; | 497 | goto out_err; |
488 | } | 498 | } |
489 | 499 | ||
490 | /* notify driver */ | ||
491 | err = sta_info_insert_drv_state(local, sdata, sta); | ||
492 | if (err) | ||
493 | goto out_err; | ||
494 | |||
495 | local->num_sta++; | 500 | local->num_sta++; |
496 | local->sta_generation++; | 501 | local->sta_generation++; |
497 | smp_mb(); | 502 | smp_mb(); |
498 | 503 | ||
504 | /* simplify things and don't accept BA sessions yet */ | ||
505 | set_sta_flag(sta, WLAN_STA_BLOCK_BA); | ||
506 | |||
499 | /* make the station visible */ | 507 | /* make the station visible */ |
500 | sta_info_hash_add(local, sta); | 508 | sta_info_hash_add(local, sta); |
501 | 509 | ||
502 | list_add_rcu(&sta->list, &local->sta_list); | 510 | list_add_rcu(&sta->list, &local->sta_list); |
503 | 511 | ||
512 | /* notify driver */ | ||
513 | err = sta_info_insert_drv_state(local, sdata, sta); | ||
514 | if (err) | ||
515 | goto out_remove; | ||
516 | |||
504 | set_sta_flag(sta, WLAN_STA_INSERTED); | 517 | set_sta_flag(sta, WLAN_STA_INSERTED); |
518 | /* accept BA sessions now */ | ||
519 | clear_sta_flag(sta, WLAN_STA_BLOCK_BA); | ||
505 | 520 | ||
506 | ieee80211_recalc_min_chandef(sdata); | 521 | ieee80211_recalc_min_chandef(sdata); |
507 | ieee80211_sta_debugfs_add(sta); | 522 | ieee80211_sta_debugfs_add(sta); |
@@ -522,6 +537,12 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) | |||
522 | mesh_accept_plinks_update(sdata); | 537 | mesh_accept_plinks_update(sdata); |
523 | 538 | ||
524 | return 0; | 539 | return 0; |
540 | out_remove: | ||
541 | sta_info_hash_del(local, sta); | ||
542 | list_del_rcu(&sta->list); | ||
543 | local->num_sta--; | ||
544 | synchronize_net(); | ||
545 | __cleanup_single_sta(sta); | ||
525 | out_err: | 546 | out_err: |
526 | mutex_unlock(&local->sta_mtx); | 547 | mutex_unlock(&local->sta_mtx); |
527 | rcu_read_lock(); | 548 | rcu_read_lock(); |
@@ -1071,10 +1092,14 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, | |||
1071 | } | 1092 | } |
1072 | EXPORT_SYMBOL(ieee80211_find_sta); | 1093 | EXPORT_SYMBOL(ieee80211_find_sta); |
1073 | 1094 | ||
1074 | static void clear_sta_ps_flags(void *_sta) | 1095 | /* powersave support code */ |
1096 | void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | ||
1075 | { | 1097 | { |
1076 | struct sta_info *sta = _sta; | ||
1077 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 1098 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
1099 | struct ieee80211_local *local = sdata->local; | ||
1100 | struct sk_buff_head pending; | ||
1101 | int filtered = 0, buffered = 0, ac; | ||
1102 | unsigned long flags; | ||
1078 | struct ps_data *ps; | 1103 | struct ps_data *ps; |
1079 | 1104 | ||
1080 | if (sdata->vif.type == NL80211_IFTYPE_AP || | 1105 | if (sdata->vif.type == NL80211_IFTYPE_AP || |
@@ -1085,20 +1110,6 @@ static void clear_sta_ps_flags(void *_sta) | |||
1085 | else | 1110 | else |
1086 | return; | 1111 | return; |
1087 | 1112 | ||
1088 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); | ||
1089 | if (test_and_clear_sta_flag(sta, WLAN_STA_PS_STA)) | ||
1090 | atomic_dec(&ps->num_sta_ps); | ||
1091 | } | ||
1092 | |||
1093 | /* powersave support code */ | ||
1094 | void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | ||
1095 | { | ||
1096 | struct ieee80211_sub_if_data *sdata = sta->sdata; | ||
1097 | struct ieee80211_local *local = sdata->local; | ||
1098 | struct sk_buff_head pending; | ||
1099 | int filtered = 0, buffered = 0, ac; | ||
1100 | unsigned long flags; | ||
1101 | |||
1102 | clear_sta_flag(sta, WLAN_STA_SP); | 1113 | clear_sta_flag(sta, WLAN_STA_SP); |
1103 | 1114 | ||
1104 | BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1); | 1115 | BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1); |
@@ -1109,6 +1120,8 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
1109 | 1120 | ||
1110 | skb_queue_head_init(&pending); | 1121 | skb_queue_head_init(&pending); |
1111 | 1122 | ||
1123 | /* sync with ieee80211_tx_h_unicast_ps_buf */ | ||
1124 | spin_lock(&sta->ps_lock); | ||
1112 | /* Send all buffered frames to the station */ | 1125 | /* Send all buffered frames to the station */ |
1113 | for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { | 1126 | for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { |
1114 | int count = skb_queue_len(&pending), tmp; | 1127 | int count = skb_queue_len(&pending), tmp; |
@@ -1127,7 +1140,12 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
1127 | buffered += tmp - count; | 1140 | buffered += tmp - count; |
1128 | } | 1141 | } |
1129 | 1142 | ||
1130 | ieee80211_add_pending_skbs_fn(local, &pending, clear_sta_ps_flags, sta); | 1143 | ieee80211_add_pending_skbs(local, &pending); |
1144 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); | ||
1145 | clear_sta_flag(sta, WLAN_STA_PS_STA); | ||
1146 | spin_unlock(&sta->ps_lock); | ||
1147 | |||
1148 | atomic_dec(&ps->num_sta_ps); | ||
1131 | 1149 | ||
1132 | /* This station just woke up and isn't aware of our SMPS state */ | 1150 | /* This station just woke up and isn't aware of our SMPS state */ |
1133 | if (!ieee80211_smps_is_restrictive(sta->known_smps_mode, | 1151 | if (!ieee80211_smps_is_restrictive(sta->known_smps_mode, |
@@ -1188,6 +1206,7 @@ static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata, | |||
1188 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); | 1206 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); |
1189 | memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); | 1207 | memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); |
1190 | memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN); | 1208 | memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN); |
1209 | nullfunc->seq_ctrl = 0; | ||
1191 | 1210 | ||
1192 | skb->priority = tid; | 1211 | skb->priority = tid; |
1193 | skb_set_queue_mapping(skb, ieee802_1d_to_ac[tid]); | 1212 | skb_set_queue_mapping(skb, ieee802_1d_to_ac[tid]); |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index d77ff7090630..d3a6d8208f2f 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -267,6 +267,7 @@ struct ieee80211_tx_latency_stat { | |||
267 | * @drv_unblock_wk: used for driver PS unblocking | 267 | * @drv_unblock_wk: used for driver PS unblocking |
268 | * @listen_interval: listen interval of this station, when we're acting as AP | 268 | * @listen_interval: listen interval of this station, when we're acting as AP |
269 | * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly | 269 | * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly |
270 | * @ps_lock: used for powersave (when mac80211 is the AP) related locking | ||
270 | * @ps_tx_buf: buffers (per AC) of frames to transmit to this station | 271 | * @ps_tx_buf: buffers (per AC) of frames to transmit to this station |
271 | * when it leaves power saving state or polls | 272 | * when it leaves power saving state or polls |
272 | * @tx_filtered: buffers (per AC) of frames we already tried to | 273 | * @tx_filtered: buffers (per AC) of frames we already tried to |
@@ -356,10 +357,8 @@ struct sta_info { | |||
356 | /* use the accessors defined below */ | 357 | /* use the accessors defined below */ |
357 | unsigned long _flags; | 358 | unsigned long _flags; |
358 | 359 | ||
359 | /* | 360 | /* STA powersave lock and frame queues */ |
360 | * STA powersave frame queues, no more than the internal | 361 | spinlock_t ps_lock; |
361 | * locking required. | ||
362 | */ | ||
363 | struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS]; | 362 | struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS]; |
364 | struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS]; | 363 | struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS]; |
365 | unsigned long driver_buffered_tids; | 364 | unsigned long driver_buffered_tids; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 97a02d3f7d87..4080c615636f 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -478,6 +478,20 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
478 | sta->sta.addr, sta->sta.aid, ac); | 478 | sta->sta.addr, sta->sta.aid, ac); |
479 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) | 479 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) |
480 | purge_old_ps_buffers(tx->local); | 480 | purge_old_ps_buffers(tx->local); |
481 | |||
482 | /* sync with ieee80211_sta_ps_deliver_wakeup */ | ||
483 | spin_lock(&sta->ps_lock); | ||
484 | /* | ||
485 | * STA woke up the meantime and all the frames on ps_tx_buf have | ||
486 | * been queued to pending queue. No reordering can happen, go | ||
487 | * ahead and Tx the packet. | ||
488 | */ | ||
489 | if (!test_sta_flag(sta, WLAN_STA_PS_STA) && | ||
490 | !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { | ||
491 | spin_unlock(&sta->ps_lock); | ||
492 | return TX_CONTINUE; | ||
493 | } | ||
494 | |||
481 | if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { | 495 | if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { |
482 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); | 496 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); |
483 | ps_dbg(tx->sdata, | 497 | ps_dbg(tx->sdata, |
@@ -492,6 +506,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
492 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; | 506 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; |
493 | info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; | 507 | info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; |
494 | skb_queue_tail(&sta->ps_tx_buf[ac], tx->skb); | 508 | skb_queue_tail(&sta->ps_tx_buf[ac], tx->skb); |
509 | spin_unlock(&sta->ps_lock); | ||
495 | 510 | ||
496 | if (!timer_pending(&local->sta_cleanup)) | 511 | if (!timer_pending(&local->sta_cleanup)) |
497 | mod_timer(&local->sta_cleanup, | 512 | mod_timer(&local->sta_cleanup, |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 676dc0967f37..b8700d417a9c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -435,9 +435,8 @@ void ieee80211_add_pending_skb(struct ieee80211_local *local, | |||
435 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); | 435 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
436 | } | 436 | } |
437 | 437 | ||
438 | void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, | 438 | void ieee80211_add_pending_skbs(struct ieee80211_local *local, |
439 | struct sk_buff_head *skbs, | 439 | struct sk_buff_head *skbs) |
440 | void (*fn)(void *data), void *data) | ||
441 | { | 440 | { |
442 | struct ieee80211_hw *hw = &local->hw; | 441 | struct ieee80211_hw *hw = &local->hw; |
443 | struct sk_buff *skb; | 442 | struct sk_buff *skb; |
@@ -461,9 +460,6 @@ void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, | |||
461 | __skb_queue_tail(&local->pending[queue], skb); | 460 | __skb_queue_tail(&local->pending[queue], skb); |
462 | } | 461 | } |
463 | 462 | ||
464 | if (fn) | ||
465 | fn(data); | ||
466 | |||
467 | for (i = 0; i < hw->queues; i++) | 463 | for (i = 0; i < hw->queues; i++) |
468 | __ieee80211_wake_queue(hw, i, | 464 | __ieee80211_wake_queue(hw, i, |
469 | IEEE80211_QUEUE_STOP_REASON_SKB_ADD); | 465 | IEEE80211_QUEUE_STOP_REASON_SKB_ADD); |
@@ -1741,6 +1737,26 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1741 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); | 1737 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); |
1742 | 1738 | ||
1743 | /* | 1739 | /* |
1740 | * Reconfigure sched scan if it was interrupted by FW restart or | ||
1741 | * suspend. | ||
1742 | */ | ||
1743 | mutex_lock(&local->mtx); | ||
1744 | sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, | ||
1745 | lockdep_is_held(&local->mtx)); | ||
1746 | if (sched_scan_sdata && local->sched_scan_req) | ||
1747 | /* | ||
1748 | * Sched scan stopped, but we don't want to report it. Instead, | ||
1749 | * we're trying to reschedule. | ||
1750 | */ | ||
1751 | if (__ieee80211_request_sched_scan_start(sched_scan_sdata, | ||
1752 | local->sched_scan_req)) | ||
1753 | sched_scan_stopped = true; | ||
1754 | mutex_unlock(&local->mtx); | ||
1755 | |||
1756 | if (sched_scan_stopped) | ||
1757 | cfg80211_sched_scan_stopped(local->hw.wiphy); | ||
1758 | |||
1759 | /* | ||
1744 | * If this is for hw restart things are still running. | 1760 | * If this is for hw restart things are still running. |
1745 | * We may want to change that later, however. | 1761 | * We may want to change that later, however. |
1746 | */ | 1762 | */ |
@@ -1768,26 +1784,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1768 | WARN_ON(1); | 1784 | WARN_ON(1); |
1769 | #endif | 1785 | #endif |
1770 | 1786 | ||
1771 | /* | ||
1772 | * Reconfigure sched scan if it was interrupted by FW restart or | ||
1773 | * suspend. | ||
1774 | */ | ||
1775 | mutex_lock(&local->mtx); | ||
1776 | sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, | ||
1777 | lockdep_is_held(&local->mtx)); | ||
1778 | if (sched_scan_sdata && local->sched_scan_req) | ||
1779 | /* | ||
1780 | * Sched scan stopped, but we don't want to report it. Instead, | ||
1781 | * we're trying to reschedule. | ||
1782 | */ | ||
1783 | if (__ieee80211_request_sched_scan_start(sched_scan_sdata, | ||
1784 | local->sched_scan_req)) | ||
1785 | sched_scan_stopped = true; | ||
1786 | mutex_unlock(&local->mtx); | ||
1787 | |||
1788 | if (sched_scan_stopped) | ||
1789 | cfg80211_sched_scan_stopped(local->hw.wiphy); | ||
1790 | |||
1791 | return 0; | 1787 | return 0; |
1792 | } | 1788 | } |
1793 | 1789 | ||
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index 21211c60ca98..d51422c778de 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c | |||
@@ -154,6 +154,11 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, | |||
154 | return IEEE80211_AC_BE; | 154 | return IEEE80211_AC_BE; |
155 | } | 155 | } |
156 | 156 | ||
157 | if (skb->protocol == sdata->control_port_protocol) { | ||
158 | skb->priority = 7; | ||
159 | return ieee80211_downgrade_queue(sdata, skb); | ||
160 | } | ||
161 | |||
157 | /* use the data classifier to determine what 802.1d tag the | 162 | /* use the data classifier to determine what 802.1d tag the |
158 | * data frame has */ | 163 | * data frame has */ |
159 | rcu_read_lock(); | 164 | rcu_read_lock(); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index bb322d0beb48..b9f0e0374322 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -1310,27 +1310,22 @@ ctnetlink_change_status(struct nf_conn *ct, const struct nlattr * const cda[]) | |||
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | static int | 1312 | static int |
1313 | ctnetlink_change_nat(struct nf_conn *ct, const struct nlattr * const cda[]) | 1313 | ctnetlink_setup_nat(struct nf_conn *ct, const struct nlattr * const cda[]) |
1314 | { | 1314 | { |
1315 | #ifdef CONFIG_NF_NAT_NEEDED | 1315 | #ifdef CONFIG_NF_NAT_NEEDED |
1316 | int ret; | 1316 | int ret; |
1317 | 1317 | ||
1318 | if (cda[CTA_NAT_DST]) { | 1318 | ret = ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_DST, |
1319 | ret = ctnetlink_parse_nat_setup(ct, | 1319 | cda[CTA_NAT_DST]); |
1320 | NF_NAT_MANIP_DST, | 1320 | if (ret < 0) |
1321 | cda[CTA_NAT_DST]); | 1321 | return ret; |
1322 | if (ret < 0) | 1322 | |
1323 | return ret; | 1323 | ret = ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_SRC, |
1324 | } | 1324 | cda[CTA_NAT_SRC]); |
1325 | if (cda[CTA_NAT_SRC]) { | 1325 | return ret; |
1326 | ret = ctnetlink_parse_nat_setup(ct, | ||
1327 | NF_NAT_MANIP_SRC, | ||
1328 | cda[CTA_NAT_SRC]); | ||
1329 | if (ret < 0) | ||
1330 | return ret; | ||
1331 | } | ||
1332 | return 0; | ||
1333 | #else | 1326 | #else |
1327 | if (!cda[CTA_NAT_DST] && !cda[CTA_NAT_SRC]) | ||
1328 | return 0; | ||
1334 | return -EOPNOTSUPP; | 1329 | return -EOPNOTSUPP; |
1335 | #endif | 1330 | #endif |
1336 | } | 1331 | } |
@@ -1659,11 +1654,9 @@ ctnetlink_create_conntrack(struct net *net, u16 zone, | |||
1659 | goto err2; | 1654 | goto err2; |
1660 | } | 1655 | } |
1661 | 1656 | ||
1662 | if (cda[CTA_NAT_SRC] || cda[CTA_NAT_DST]) { | 1657 | err = ctnetlink_setup_nat(ct, cda); |
1663 | err = ctnetlink_change_nat(ct, cda); | 1658 | if (err < 0) |
1664 | if (err < 0) | 1659 | goto err2; |
1665 | goto err2; | ||
1666 | } | ||
1667 | 1660 | ||
1668 | nf_ct_acct_ext_add(ct, GFP_ATOMIC); | 1661 | nf_ct_acct_ext_add(ct, GFP_ATOMIC); |
1669 | nf_ct_tstamp_ext_add(ct, GFP_ATOMIC); | 1662 | nf_ct_tstamp_ext_add(ct, GFP_ATOMIC); |
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index d3f5cd6dd962..52ca952b802c 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c | |||
@@ -432,15 +432,15 @@ nf_nat_setup_info(struct nf_conn *ct, | |||
432 | } | 432 | } |
433 | EXPORT_SYMBOL(nf_nat_setup_info); | 433 | EXPORT_SYMBOL(nf_nat_setup_info); |
434 | 434 | ||
435 | unsigned int | 435 | static unsigned int |
436 | nf_nat_alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) | 436 | __nf_nat_alloc_null_binding(struct nf_conn *ct, enum nf_nat_manip_type manip) |
437 | { | 437 | { |
438 | /* Force range to this IP; let proto decide mapping for | 438 | /* Force range to this IP; let proto decide mapping for |
439 | * per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). | 439 | * per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). |
440 | * Use reply in case it's already been mangled (eg local packet). | 440 | * Use reply in case it's already been mangled (eg local packet). |
441 | */ | 441 | */ |
442 | union nf_inet_addr ip = | 442 | union nf_inet_addr ip = |
443 | (HOOK2MANIP(hooknum) == NF_NAT_MANIP_SRC ? | 443 | (manip == NF_NAT_MANIP_SRC ? |
444 | ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3 : | 444 | ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3 : |
445 | ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3); | 445 | ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3); |
446 | struct nf_nat_range range = { | 446 | struct nf_nat_range range = { |
@@ -448,7 +448,13 @@ nf_nat_alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) | |||
448 | .min_addr = ip, | 448 | .min_addr = ip, |
449 | .max_addr = ip, | 449 | .max_addr = ip, |
450 | }; | 450 | }; |
451 | return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum)); | 451 | return nf_nat_setup_info(ct, &range, manip); |
452 | } | ||
453 | |||
454 | unsigned int | ||
455 | nf_nat_alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) | ||
456 | { | ||
457 | return __nf_nat_alloc_null_binding(ct, HOOK2MANIP(hooknum)); | ||
452 | } | 458 | } |
453 | EXPORT_SYMBOL_GPL(nf_nat_alloc_null_binding); | 459 | EXPORT_SYMBOL_GPL(nf_nat_alloc_null_binding); |
454 | 460 | ||
@@ -702,9 +708,9 @@ static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = { | |||
702 | 708 | ||
703 | static int | 709 | static int |
704 | nfnetlink_parse_nat(const struct nlattr *nat, | 710 | nfnetlink_parse_nat(const struct nlattr *nat, |
705 | const struct nf_conn *ct, struct nf_nat_range *range) | 711 | const struct nf_conn *ct, struct nf_nat_range *range, |
712 | const struct nf_nat_l3proto *l3proto) | ||
706 | { | 713 | { |
707 | const struct nf_nat_l3proto *l3proto; | ||
708 | struct nlattr *tb[CTA_NAT_MAX+1]; | 714 | struct nlattr *tb[CTA_NAT_MAX+1]; |
709 | int err; | 715 | int err; |
710 | 716 | ||
@@ -714,38 +720,46 @@ nfnetlink_parse_nat(const struct nlattr *nat, | |||
714 | if (err < 0) | 720 | if (err < 0) |
715 | return err; | 721 | return err; |
716 | 722 | ||
717 | rcu_read_lock(); | ||
718 | l3proto = __nf_nat_l3proto_find(nf_ct_l3num(ct)); | ||
719 | if (l3proto == NULL) { | ||
720 | err = -EAGAIN; | ||
721 | goto out; | ||
722 | } | ||
723 | err = l3proto->nlattr_to_range(tb, range); | 723 | err = l3proto->nlattr_to_range(tb, range); |
724 | if (err < 0) | 724 | if (err < 0) |
725 | goto out; | 725 | return err; |
726 | 726 | ||
727 | if (!tb[CTA_NAT_PROTO]) | 727 | if (!tb[CTA_NAT_PROTO]) |
728 | goto out; | 728 | return 0; |
729 | 729 | ||
730 | err = nfnetlink_parse_nat_proto(tb[CTA_NAT_PROTO], ct, range); | 730 | return nfnetlink_parse_nat_proto(tb[CTA_NAT_PROTO], ct, range); |
731 | out: | ||
732 | rcu_read_unlock(); | ||
733 | return err; | ||
734 | } | 731 | } |
735 | 732 | ||
733 | /* This function is called under rcu_read_lock() */ | ||
736 | static int | 734 | static int |
737 | nfnetlink_parse_nat_setup(struct nf_conn *ct, | 735 | nfnetlink_parse_nat_setup(struct nf_conn *ct, |
738 | enum nf_nat_manip_type manip, | 736 | enum nf_nat_manip_type manip, |
739 | const struct nlattr *attr) | 737 | const struct nlattr *attr) |
740 | { | 738 | { |
741 | struct nf_nat_range range; | 739 | struct nf_nat_range range; |
740 | const struct nf_nat_l3proto *l3proto; | ||
742 | int err; | 741 | int err; |
743 | 742 | ||
744 | err = nfnetlink_parse_nat(attr, ct, &range); | 743 | /* Should not happen, restricted to creating new conntracks |
744 | * via ctnetlink. | ||
745 | */ | ||
746 | if (WARN_ON_ONCE(nf_nat_initialized(ct, manip))) | ||
747 | return -EEXIST; | ||
748 | |||
749 | /* Make sure that L3 NAT is there by when we call nf_nat_setup_info to | ||
750 | * attach the null binding, otherwise this may oops. | ||
751 | */ | ||
752 | l3proto = __nf_nat_l3proto_find(nf_ct_l3num(ct)); | ||
753 | if (l3proto == NULL) | ||
754 | return -EAGAIN; | ||
755 | |||
756 | /* No NAT information has been passed, allocate the null-binding */ | ||
757 | if (attr == NULL) | ||
758 | return __nf_nat_alloc_null_binding(ct, manip); | ||
759 | |||
760 | err = nfnetlink_parse_nat(attr, ct, &range, l3proto); | ||
745 | if (err < 0) | 761 | if (err < 0) |
746 | return err; | 762 | return err; |
747 | if (nf_nat_initialized(ct, manip)) | ||
748 | return -EEXIST; | ||
749 | 763 | ||
750 | return nf_nat_setup_info(ct, &range, manip); | 764 | return nf_nat_setup_info(ct, &range, manip); |
751 | } | 765 | } |
diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c index e8254ad2e5a9..425cf39af890 100644 --- a/net/netfilter/nft_meta.c +++ b/net/netfilter/nft_meta.c | |||
@@ -116,7 +116,7 @@ static void nft_meta_get_eval(const struct nft_expr *expr, | |||
116 | skb->sk->sk_socket->file->f_cred->fsgid); | 116 | skb->sk->sk_socket->file->f_cred->fsgid); |
117 | read_unlock_bh(&skb->sk->sk_callback_lock); | 117 | read_unlock_bh(&skb->sk->sk_callback_lock); |
118 | break; | 118 | break; |
119 | #ifdef CONFIG_NET_CLS_ROUTE | 119 | #ifdef CONFIG_IP_ROUTE_CLASSID |
120 | case NFT_META_RTCLASSID: { | 120 | case NFT_META_RTCLASSID: { |
121 | const struct dst_entry *dst = skb_dst(skb); | 121 | const struct dst_entry *dst = skb_dst(skb); |
122 | 122 | ||
@@ -199,7 +199,7 @@ static int nft_meta_init_validate_get(uint32_t key) | |||
199 | case NFT_META_OIFTYPE: | 199 | case NFT_META_OIFTYPE: |
200 | case NFT_META_SKUID: | 200 | case NFT_META_SKUID: |
201 | case NFT_META_SKGID: | 201 | case NFT_META_SKGID: |
202 | #ifdef CONFIG_NET_CLS_ROUTE | 202 | #ifdef CONFIG_IP_ROUTE_CLASSID |
203 | case NFT_META_RTCLASSID: | 203 | case NFT_META_RTCLASSID: |
204 | #endif | 204 | #endif |
205 | #ifdef CONFIG_NETWORK_SECMARK | 205 | #ifdef CONFIG_NETWORK_SECMARK |
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c index a2aeb318678f..85daa84bfdfe 100644 --- a/net/netfilter/nft_payload.c +++ b/net/netfilter/nft_payload.c | |||
@@ -135,7 +135,8 @@ nft_payload_select_ops(const struct nft_ctx *ctx, | |||
135 | if (len == 0 || len > FIELD_SIZEOF(struct nft_data, data)) | 135 | if (len == 0 || len > FIELD_SIZEOF(struct nft_data, data)) |
136 | return ERR_PTR(-EINVAL); | 136 | return ERR_PTR(-EINVAL); |
137 | 137 | ||
138 | if (len <= 4 && IS_ALIGNED(offset, len) && base != NFT_PAYLOAD_LL_HEADER) | 138 | if (len <= 4 && is_power_of_2(len) && IS_ALIGNED(offset, len) && |
139 | base != NFT_PAYLOAD_LL_HEADER) | ||
139 | return &nft_payload_fast_ops; | 140 | return &nft_payload_fast_ops; |
140 | else | 141 | else |
141 | return &nft_payload_ops; | 142 | return &nft_payload_ops; |
diff --git a/net/netfilter/nft_reject_inet.c b/net/netfilter/nft_reject_inet.c index 8a310f239c93..b718a52a4654 100644 --- a/net/netfilter/nft_reject_inet.c +++ b/net/netfilter/nft_reject_inet.c | |||
@@ -21,9 +21,9 @@ static void nft_reject_inet_eval(const struct nft_expr *expr, | |||
21 | { | 21 | { |
22 | switch (pkt->ops->pf) { | 22 | switch (pkt->ops->pf) { |
23 | case NFPROTO_IPV4: | 23 | case NFPROTO_IPV4: |
24 | nft_reject_ipv4_eval(expr, data, pkt); | 24 | return nft_reject_ipv4_eval(expr, data, pkt); |
25 | case NFPROTO_IPV6: | 25 | case NFPROTO_IPV6: |
26 | nft_reject_ipv6_eval(expr, data, pkt); | 26 | return nft_reject_ipv6_eval(expr, data, pkt); |
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index fdf51353cf78..04748ab649c2 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1489,8 +1489,8 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr, | |||
1489 | if (addr->sa_family != AF_NETLINK) | 1489 | if (addr->sa_family != AF_NETLINK) |
1490 | return -EINVAL; | 1490 | return -EINVAL; |
1491 | 1491 | ||
1492 | /* Only superuser is allowed to send multicasts */ | 1492 | if ((nladdr->nl_groups || nladdr->nl_pid) && |
1493 | if (nladdr->nl_groups && !netlink_capable(sock, NL_CFG_F_NONROOT_SEND)) | 1493 | !netlink_capable(sock, NL_CFG_F_NONROOT_SEND)) |
1494 | return -EPERM; | 1494 | return -EPERM; |
1495 | 1495 | ||
1496 | if (!nlk->portid) | 1496 | if (!nlk->portid) |
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 46bda010bf11..56db888b1cd5 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -301,7 +301,7 @@ static int nci_open_device(struct nci_dev *ndev) | |||
301 | rc = __nci_request(ndev, nci_reset_req, 0, | 301 | rc = __nci_request(ndev, nci_reset_req, 0, |
302 | msecs_to_jiffies(NCI_RESET_TIMEOUT)); | 302 | msecs_to_jiffies(NCI_RESET_TIMEOUT)); |
303 | 303 | ||
304 | if (ndev->ops->setup(ndev)) | 304 | if (ndev->ops->setup) |
305 | ndev->ops->setup(ndev); | 305 | ndev->ops->setup(ndev); |
306 | 306 | ||
307 | if (!rc) { | 307 | if (!rc) { |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index e9a48baf8551..8601b320b443 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -1174,7 +1174,7 @@ static void ovs_dp_reset_user_features(struct sk_buff *skb, struct genl_info *in | |||
1174 | struct datapath *dp; | 1174 | struct datapath *dp; |
1175 | 1175 | ||
1176 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); | 1176 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); |
1177 | if (!dp) | 1177 | if (IS_ERR(dp)) |
1178 | return; | 1178 | return; |
1179 | 1179 | ||
1180 | WARN(dp->user_features, "Dropping previously announced user features\n"); | 1180 | WARN(dp->user_features, "Dropping previously announced user features\n"); |
@@ -1762,11 +1762,12 @@ static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1762 | int bucket = cb->args[0], skip = cb->args[1]; | 1762 | int bucket = cb->args[0], skip = cb->args[1]; |
1763 | int i, j = 0; | 1763 | int i, j = 0; |
1764 | 1764 | ||
1765 | rcu_read_lock(); | ||
1765 | dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); | 1766 | dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); |
1766 | if (!dp) | 1767 | if (!dp) { |
1768 | rcu_read_unlock(); | ||
1767 | return -ENODEV; | 1769 | return -ENODEV; |
1768 | 1770 | } | |
1769 | rcu_read_lock(); | ||
1770 | for (i = bucket; i < DP_VPORT_HASH_BUCKETS; i++) { | 1771 | for (i = bucket; i < DP_VPORT_HASH_BUCKETS; i++) { |
1771 | struct vport *vport; | 1772 | struct vport *vport; |
1772 | 1773 | ||
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 16f4b46161d4..dda451f4429c 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -73,6 +73,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb) | |||
73 | 73 | ||
74 | if ((flow->key.eth.type == htons(ETH_P_IP) || | 74 | if ((flow->key.eth.type == htons(ETH_P_IP) || |
75 | flow->key.eth.type == htons(ETH_P_IPV6)) && | 75 | flow->key.eth.type == htons(ETH_P_IPV6)) && |
76 | flow->key.ip.frag != OVS_FRAG_TYPE_LATER && | ||
76 | flow->key.ip.proto == IPPROTO_TCP && | 77 | flow->key.ip.proto == IPPROTO_TCP && |
77 | likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) { | 78 | likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) { |
78 | tcp_flags = TCP_FLAGS_BE16(tcp_hdr(skb)); | 79 | tcp_flags = TCP_FLAGS_BE16(tcp_hdr(skb)); |
@@ -91,7 +92,7 @@ static void stats_read(struct flow_stats *stats, | |||
91 | unsigned long *used, __be16 *tcp_flags) | 92 | unsigned long *used, __be16 *tcp_flags) |
92 | { | 93 | { |
93 | spin_lock(&stats->lock); | 94 | spin_lock(&stats->lock); |
94 | if (time_after(stats->used, *used)) | 95 | if (!*used || time_after(stats->used, *used)) |
95 | *used = stats->used; | 96 | *used = stats->used; |
96 | *tcp_flags |= stats->tcp_flags; | 97 | *tcp_flags |= stats->tcp_flags; |
97 | ovs_stats->n_packets += stats->packet_count; | 98 | ovs_stats->n_packets += stats->packet_count; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 1313145e3b86..a07d55e75698 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -273,11 +273,12 @@ static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle) | |||
273 | 273 | ||
274 | void qdisc_list_add(struct Qdisc *q) | 274 | void qdisc_list_add(struct Qdisc *q) |
275 | { | 275 | { |
276 | struct Qdisc *root = qdisc_dev(q)->qdisc; | 276 | if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) { |
277 | struct Qdisc *root = qdisc_dev(q)->qdisc; | ||
277 | 278 | ||
278 | WARN_ON_ONCE(root == &noop_qdisc); | 279 | WARN_ON_ONCE(root == &noop_qdisc); |
279 | if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) | ||
280 | list_add_tail(&q->list, &root->list); | 280 | list_add_tail(&q->list, &root->list); |
281 | } | ||
281 | } | 282 | } |
282 | EXPORT_SYMBOL(qdisc_list_add); | 283 | EXPORT_SYMBOL(qdisc_list_add); |
283 | 284 | ||
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index 08ef7a42c0e4..21e251766eb1 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c | |||
@@ -601,6 +601,7 @@ static int fq_resize(struct Qdisc *sch, u32 log) | |||
601 | { | 601 | { |
602 | struct fq_sched_data *q = qdisc_priv(sch); | 602 | struct fq_sched_data *q = qdisc_priv(sch); |
603 | struct rb_root *array; | 603 | struct rb_root *array; |
604 | void *old_fq_root; | ||
604 | u32 idx; | 605 | u32 idx; |
605 | 606 | ||
606 | if (q->fq_root && log == q->fq_trees_log) | 607 | if (q->fq_root && log == q->fq_trees_log) |
@@ -615,13 +616,19 @@ static int fq_resize(struct Qdisc *sch, u32 log) | |||
615 | for (idx = 0; idx < (1U << log); idx++) | 616 | for (idx = 0; idx < (1U << log); idx++) |
616 | array[idx] = RB_ROOT; | 617 | array[idx] = RB_ROOT; |
617 | 618 | ||
618 | if (q->fq_root) { | 619 | sch_tree_lock(sch); |
619 | fq_rehash(q, q->fq_root, q->fq_trees_log, array, log); | 620 | |
620 | fq_free(q->fq_root); | 621 | old_fq_root = q->fq_root; |
621 | } | 622 | if (old_fq_root) |
623 | fq_rehash(q, old_fq_root, q->fq_trees_log, array, log); | ||
624 | |||
622 | q->fq_root = array; | 625 | q->fq_root = array; |
623 | q->fq_trees_log = log; | 626 | q->fq_trees_log = log; |
624 | 627 | ||
628 | sch_tree_unlock(sch); | ||
629 | |||
630 | fq_free(old_fq_root); | ||
631 | |||
625 | return 0; | 632 | return 0; |
626 | } | 633 | } |
627 | 634 | ||
@@ -697,9 +704,11 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt) | |||
697 | q->flow_refill_delay = usecs_to_jiffies(usecs_delay); | 704 | q->flow_refill_delay = usecs_to_jiffies(usecs_delay); |
698 | } | 705 | } |
699 | 706 | ||
700 | if (!err) | 707 | if (!err) { |
708 | sch_tree_unlock(sch); | ||
701 | err = fq_resize(sch, fq_log); | 709 | err = fq_resize(sch, fq_log); |
702 | 710 | sch_tree_lock(sch); | |
711 | } | ||
703 | while (sch->q.qlen > sch->limit) { | 712 | while (sch->q.qlen > sch->limit) { |
704 | struct sk_buff *skb = fq_dequeue(sch); | 713 | struct sk_buff *skb = fq_dequeue(sch); |
705 | 714 | ||
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 1cb413fead89..4f505a006896 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -334,18 +334,6 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
334 | qdisc_put_rtab(qdisc_get_rtab(&qopt->peakrate, | 334 | qdisc_put_rtab(qdisc_get_rtab(&qopt->peakrate, |
335 | tb[TCA_TBF_PTAB])); | 335 | tb[TCA_TBF_PTAB])); |
336 | 336 | ||
337 | if (q->qdisc != &noop_qdisc) { | ||
338 | err = fifo_set_limit(q->qdisc, qopt->limit); | ||
339 | if (err) | ||
340 | goto done; | ||
341 | } else if (qopt->limit > 0) { | ||
342 | child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit); | ||
343 | if (IS_ERR(child)) { | ||
344 | err = PTR_ERR(child); | ||
345 | goto done; | ||
346 | } | ||
347 | } | ||
348 | |||
349 | buffer = min_t(u64, PSCHED_TICKS2NS(qopt->buffer), ~0U); | 337 | buffer = min_t(u64, PSCHED_TICKS2NS(qopt->buffer), ~0U); |
350 | mtu = min_t(u64, PSCHED_TICKS2NS(qopt->mtu), ~0U); | 338 | mtu = min_t(u64, PSCHED_TICKS2NS(qopt->mtu), ~0U); |
351 | 339 | ||
@@ -390,6 +378,18 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
390 | goto done; | 378 | goto done; |
391 | } | 379 | } |
392 | 380 | ||
381 | if (q->qdisc != &noop_qdisc) { | ||
382 | err = fifo_set_limit(q->qdisc, qopt->limit); | ||
383 | if (err) | ||
384 | goto done; | ||
385 | } else if (qopt->limit > 0) { | ||
386 | child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit); | ||
387 | if (IS_ERR(child)) { | ||
388 | err = PTR_ERR(child); | ||
389 | goto done; | ||
390 | } | ||
391 | } | ||
392 | |||
393 | sch_tree_lock(sch); | 393 | sch_tree_lock(sch); |
394 | if (child) { | 394 | if (child) { |
395 | qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); | 395 | qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index f558433537b8..ee13d28d39d1 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -1239,78 +1239,107 @@ void sctp_assoc_update(struct sctp_association *asoc, | |||
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | /* Update the retran path for sending a retransmitted packet. | 1241 | /* Update the retran path for sending a retransmitted packet. |
1242 | * Round-robin through the active transports, else round-robin | 1242 | * See also RFC4960, 6.4. Multi-Homed SCTP Endpoints: |
1243 | * through the inactive transports as this is the next best thing | 1243 | * |
1244 | * we can try. | 1244 | * When there is outbound data to send and the primary path |
1245 | * becomes inactive (e.g., due to failures), or where the | ||
1246 | * SCTP user explicitly requests to send data to an | ||
1247 | * inactive destination transport address, before reporting | ||
1248 | * an error to its ULP, the SCTP endpoint should try to send | ||
1249 | * the data to an alternate active destination transport | ||
1250 | * address if one exists. | ||
1251 | * | ||
1252 | * When retransmitting data that timed out, if the endpoint | ||
1253 | * is multihomed, it should consider each source-destination | ||
1254 | * address pair in its retransmission selection policy. | ||
1255 | * When retransmitting timed-out data, the endpoint should | ||
1256 | * attempt to pick the most divergent source-destination | ||
1257 | * pair from the original source-destination pair to which | ||
1258 | * the packet was transmitted. | ||
1259 | * | ||
1260 | * Note: Rules for picking the most divergent source-destination | ||
1261 | * pair are an implementation decision and are not specified | ||
1262 | * within this document. | ||
1263 | * | ||
1264 | * Our basic strategy is to round-robin transports in priorities | ||
1265 | * according to sctp_state_prio_map[] e.g., if no such | ||
1266 | * transport with state SCTP_ACTIVE exists, round-robin through | ||
1267 | * SCTP_UNKNOWN, etc. You get the picture. | ||
1245 | */ | 1268 | */ |
1246 | void sctp_assoc_update_retran_path(struct sctp_association *asoc) | 1269 | static const u8 sctp_trans_state_to_prio_map[] = { |
1270 | [SCTP_ACTIVE] = 3, /* best case */ | ||
1271 | [SCTP_UNKNOWN] = 2, | ||
1272 | [SCTP_PF] = 1, | ||
1273 | [SCTP_INACTIVE] = 0, /* worst case */ | ||
1274 | }; | ||
1275 | |||
1276 | static u8 sctp_trans_score(const struct sctp_transport *trans) | ||
1247 | { | 1277 | { |
1248 | struct sctp_transport *t, *next; | 1278 | return sctp_trans_state_to_prio_map[trans->state]; |
1249 | struct list_head *head = &asoc->peer.transport_addr_list; | 1279 | } |
1250 | struct list_head *pos; | ||
1251 | 1280 | ||
1252 | if (asoc->peer.transport_count == 1) | 1281 | static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr, |
1253 | return; | 1282 | struct sctp_transport *best) |
1283 | { | ||
1284 | if (best == NULL) | ||
1285 | return curr; | ||
1254 | 1286 | ||
1255 | /* Find the next transport in a round-robin fashion. */ | 1287 | return sctp_trans_score(curr) > sctp_trans_score(best) ? curr : best; |
1256 | t = asoc->peer.retran_path; | 1288 | } |
1257 | pos = &t->transports; | ||
1258 | next = NULL; | ||
1259 | 1289 | ||
1260 | while (1) { | 1290 | void sctp_assoc_update_retran_path(struct sctp_association *asoc) |
1261 | /* Skip the head. */ | 1291 | { |
1262 | if (pos->next == head) | 1292 | struct sctp_transport *trans = asoc->peer.retran_path; |
1263 | pos = head->next; | 1293 | struct sctp_transport *trans_next = NULL; |
1264 | else | ||
1265 | pos = pos->next; | ||
1266 | 1294 | ||
1267 | t = list_entry(pos, struct sctp_transport, transports); | 1295 | /* We're done as we only have the one and only path. */ |
1296 | if (asoc->peer.transport_count == 1) | ||
1297 | return; | ||
1298 | /* If active_path and retran_path are the same and active, | ||
1299 | * then this is the only active path. Use it. | ||
1300 | */ | ||
1301 | if (asoc->peer.active_path == asoc->peer.retran_path && | ||
1302 | asoc->peer.active_path->state == SCTP_ACTIVE) | ||
1303 | return; | ||
1268 | 1304 | ||
1269 | /* We have exhausted the list, but didn't find any | 1305 | /* Iterate from retran_path's successor back to retran_path. */ |
1270 | * other active transports. If so, use the next | 1306 | for (trans = list_next_entry(trans, transports); 1; |
1271 | * transport. | 1307 | trans = list_next_entry(trans, transports)) { |
1272 | */ | 1308 | /* Manually skip the head element. */ |
1273 | if (t == asoc->peer.retran_path) { | 1309 | if (&trans->transports == &asoc->peer.transport_addr_list) |
1274 | t = next; | 1310 | continue; |
1311 | if (trans->state == SCTP_UNCONFIRMED) | ||
1312 | continue; | ||
1313 | trans_next = sctp_trans_elect_best(trans, trans_next); | ||
1314 | /* Active is good enough for immediate return. */ | ||
1315 | if (trans_next->state == SCTP_ACTIVE) | ||
1275 | break; | 1316 | break; |
1276 | } | 1317 | /* We've reached the end, time to update path. */ |
1277 | 1318 | if (trans == asoc->peer.retran_path) | |
1278 | /* Try to find an active transport. */ | ||
1279 | |||
1280 | if ((t->state == SCTP_ACTIVE) || | ||
1281 | (t->state == SCTP_UNKNOWN)) { | ||
1282 | break; | 1319 | break; |
1283 | } else { | ||
1284 | /* Keep track of the next transport in case | ||
1285 | * we don't find any active transport. | ||
1286 | */ | ||
1287 | if (t->state != SCTP_UNCONFIRMED && !next) | ||
1288 | next = t; | ||
1289 | } | ||
1290 | } | 1320 | } |
1291 | 1321 | ||
1292 | if (t) | 1322 | if (trans_next != NULL) |
1293 | asoc->peer.retran_path = t; | 1323 | asoc->peer.retran_path = trans_next; |
1294 | else | ||
1295 | t = asoc->peer.retran_path; | ||
1296 | 1324 | ||
1297 | pr_debug("%s: association:%p addr:%pISpc\n", __func__, asoc, | 1325 | pr_debug("%s: association:%p updated new path to addr:%pISpc\n", |
1298 | &t->ipaddr.sa); | 1326 | __func__, asoc, &asoc->peer.retran_path->ipaddr.sa); |
1299 | } | 1327 | } |
1300 | 1328 | ||
1301 | /* Choose the transport for sending retransmit packet. */ | 1329 | struct sctp_transport * |
1302 | struct sctp_transport *sctp_assoc_choose_alter_transport( | 1330 | sctp_assoc_choose_alter_transport(struct sctp_association *asoc, |
1303 | struct sctp_association *asoc, struct sctp_transport *last_sent_to) | 1331 | struct sctp_transport *last_sent_to) |
1304 | { | 1332 | { |
1305 | /* If this is the first time packet is sent, use the active path, | 1333 | /* If this is the first time packet is sent, use the active path, |
1306 | * else use the retran path. If the last packet was sent over the | 1334 | * else use the retran path. If the last packet was sent over the |
1307 | * retran path, update the retran path and use it. | 1335 | * retran path, update the retran path and use it. |
1308 | */ | 1336 | */ |
1309 | if (!last_sent_to) | 1337 | if (last_sent_to == NULL) { |
1310 | return asoc->peer.active_path; | 1338 | return asoc->peer.active_path; |
1311 | else { | 1339 | } else { |
1312 | if (last_sent_to == asoc->peer.retran_path) | 1340 | if (last_sent_to == asoc->peer.retran_path) |
1313 | sctp_assoc_update_retran_path(asoc); | 1341 | sctp_assoc_update_retran_path(asoc); |
1342 | |||
1314 | return asoc->peer.retran_path; | 1343 | return asoc->peer.retran_path; |
1315 | } | 1344 | } |
1316 | } | 1345 | } |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 632090b961c3..3a1767ef3201 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1421,8 +1421,8 @@ static void sctp_chunk_destroy(struct sctp_chunk *chunk) | |||
1421 | BUG_ON(!list_empty(&chunk->list)); | 1421 | BUG_ON(!list_empty(&chunk->list)); |
1422 | list_del_init(&chunk->transmitted_list); | 1422 | list_del_init(&chunk->transmitted_list); |
1423 | 1423 | ||
1424 | /* Free the chunk skb data and the SCTP_chunk stub itself. */ | 1424 | consume_skb(chunk->skb); |
1425 | dev_kfree_skb(chunk->skb); | 1425 | consume_skb(chunk->auth_chunk); |
1426 | 1426 | ||
1427 | SCTP_DBG_OBJCNT_DEC(chunk); | 1427 | SCTP_DBG_OBJCNT_DEC(chunk); |
1428 | kmem_cache_free(sctp_chunk_cachep, chunk); | 1428 | kmem_cache_free(sctp_chunk_cachep, chunk); |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index bd859154000e..5d6883ff00c3 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -495,11 +495,12 @@ static void sctp_do_8_2_transport_strike(sctp_cmd_seq_t *commands, | |||
495 | } | 495 | } |
496 | 496 | ||
497 | /* If the transport error count is greater than the pf_retrans | 497 | /* If the transport error count is greater than the pf_retrans |
498 | * threshold, and less than pathmaxrtx, then mark this transport | 498 | * threshold, and less than pathmaxrtx, and if the current state |
499 | * as Partially Failed, ee SCTP Quick Failover Draft, secon 5.1, | 499 | * is not SCTP_UNCONFIRMED, then mark this transport as Partially |
500 | * point 1 | 500 | * Failed, see SCTP Quick Failover Draft, section 5.1 |
501 | */ | 501 | */ |
502 | if ((transport->state != SCTP_PF) && | 502 | if ((transport->state != SCTP_PF) && |
503 | (transport->state != SCTP_UNCONFIRMED) && | ||
503 | (asoc->pf_retrans < transport->pathmaxrxt) && | 504 | (asoc->pf_retrans < transport->pathmaxrxt) && |
504 | (transport->error_count > asoc->pf_retrans)) { | 505 | (transport->error_count > asoc->pf_retrans)) { |
505 | 506 | ||
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 591b44d3b7de..01e002430c85 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -758,6 +758,12 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, | |||
758 | struct sctp_chunk auth; | 758 | struct sctp_chunk auth; |
759 | sctp_ierror_t ret; | 759 | sctp_ierror_t ret; |
760 | 760 | ||
761 | /* Make sure that we and the peer are AUTH capable */ | ||
762 | if (!net->sctp.auth_enable || !new_asoc->peer.auth_capable) { | ||
763 | sctp_association_free(new_asoc); | ||
764 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | ||
765 | } | ||
766 | |||
761 | /* set-up our fake chunk so that we can process it */ | 767 | /* set-up our fake chunk so that we can process it */ |
762 | auth.skb = chunk->auth_chunk; | 768 | auth.skb = chunk->auth_chunk; |
763 | auth.asoc = chunk->asoc; | 769 | auth.asoc = chunk->asoc; |
@@ -768,10 +774,6 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, | |||
768 | auth.transport = chunk->transport; | 774 | auth.transport = chunk->transport; |
769 | 775 | ||
770 | ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth); | 776 | ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth); |
771 | |||
772 | /* We can now safely free the auth_chunk clone */ | ||
773 | kfree_skb(chunk->auth_chunk); | ||
774 | |||
775 | if (ret != SCTP_IERROR_NO_ERROR) { | 777 | if (ret != SCTP_IERROR_NO_ERROR) { |
776 | sctp_association_free(new_asoc); | 778 | sctp_association_free(new_asoc); |
777 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 779 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
diff --git a/net/socket.c b/net/socket.c index 879933aaed4c..a19ae1968d37 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -450,16 +450,17 @@ EXPORT_SYMBOL(sockfd_lookup); | |||
450 | 450 | ||
451 | static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) | 451 | static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) |
452 | { | 452 | { |
453 | struct file *file; | 453 | struct fd f = fdget(fd); |
454 | struct socket *sock; | 454 | struct socket *sock; |
455 | 455 | ||
456 | *err = -EBADF; | 456 | *err = -EBADF; |
457 | file = fget_light(fd, fput_needed); | 457 | if (f.file) { |
458 | if (file) { | 458 | sock = sock_from_file(f.file, err); |
459 | sock = sock_from_file(file, err); | 459 | if (likely(sock)) { |
460 | if (sock) | 460 | *fput_needed = f.flags; |
461 | return sock; | 461 | return sock; |
462 | fput_light(file, *fput_needed); | 462 | } |
463 | fdput(f); | ||
463 | } | 464 | } |
464 | return NULL; | 465 | return NULL; |
465 | } | 466 | } |
@@ -1985,6 +1986,10 @@ static int copy_msghdr_from_user(struct msghdr *kmsg, | |||
1985 | { | 1986 | { |
1986 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) | 1987 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) |
1987 | return -EFAULT; | 1988 | return -EFAULT; |
1989 | |||
1990 | if (kmsg->msg_namelen < 0) | ||
1991 | return -EINVAL; | ||
1992 | |||
1988 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) | 1993 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) |
1989 | kmsg->msg_namelen = sizeof(struct sockaddr_storage); | 1994 | kmsg->msg_namelen = sizeof(struct sockaddr_storage); |
1990 | return 0; | 1995 | return 0; |
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index a38c89969c68..574b86193b15 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -610,8 +610,13 @@ static struct notifier_block notifier = { | |||
610 | 610 | ||
611 | int tipc_bearer_setup(void) | 611 | int tipc_bearer_setup(void) |
612 | { | 612 | { |
613 | int err; | ||
614 | |||
615 | err = register_netdevice_notifier(¬ifier); | ||
616 | if (err) | ||
617 | return err; | ||
613 | dev_add_pack(&tipc_packet_type); | 618 | dev_add_pack(&tipc_packet_type); |
614 | return register_netdevice_notifier(¬ifier); | 619 | return 0; |
615 | } | 620 | } |
616 | 621 | ||
617 | void tipc_bearer_cleanup(void) | 622 | void tipc_bearer_cleanup(void) |
diff --git a/net/tipc/config.c b/net/tipc/config.c index c301a9a592d8..e6d721692ae0 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -181,7 +181,7 @@ static struct sk_buff *cfg_set_own_addr(void) | |||
181 | if (tipc_own_addr) | 181 | if (tipc_own_addr) |
182 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 182 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
183 | " (cannot change node address once assigned)"); | 183 | " (cannot change node address once assigned)"); |
184 | tipc_core_start_net(addr); | 184 | tipc_net_start(addr); |
185 | return tipc_cfg_reply_none(); | 185 | return tipc_cfg_reply_none(); |
186 | } | 186 | } |
187 | 187 | ||
@@ -376,7 +376,6 @@ static void cfg_conn_msg_event(int conid, struct sockaddr_tipc *addr, | |||
376 | struct tipc_cfg_msg_hdr *req_hdr; | 376 | struct tipc_cfg_msg_hdr *req_hdr; |
377 | struct tipc_cfg_msg_hdr *rep_hdr; | 377 | struct tipc_cfg_msg_hdr *rep_hdr; |
378 | struct sk_buff *rep_buf; | 378 | struct sk_buff *rep_buf; |
379 | int ret; | ||
380 | 379 | ||
381 | /* Validate configuration message header (ignore invalid message) */ | 380 | /* Validate configuration message header (ignore invalid message) */ |
382 | req_hdr = (struct tipc_cfg_msg_hdr *)buf; | 381 | req_hdr = (struct tipc_cfg_msg_hdr *)buf; |
@@ -398,12 +397,8 @@ static void cfg_conn_msg_event(int conid, struct sockaddr_tipc *addr, | |||
398 | memcpy(rep_hdr, req_hdr, sizeof(*rep_hdr)); | 397 | memcpy(rep_hdr, req_hdr, sizeof(*rep_hdr)); |
399 | rep_hdr->tcm_len = htonl(rep_buf->len); | 398 | rep_hdr->tcm_len = htonl(rep_buf->len); |
400 | rep_hdr->tcm_flags &= htons(~TCM_F_REQUEST); | 399 | rep_hdr->tcm_flags &= htons(~TCM_F_REQUEST); |
401 | 400 | tipc_conn_sendmsg(&cfgsrv, conid, addr, rep_buf->data, | |
402 | ret = tipc_conn_sendmsg(&cfgsrv, conid, addr, rep_buf->data, | 401 | rep_buf->len); |
403 | rep_buf->len); | ||
404 | if (ret < 0) | ||
405 | pr_err("Sending cfg reply message failed, no memory\n"); | ||
406 | |||
407 | kfree_skb(rep_buf); | 402 | kfree_skb(rep_buf); |
408 | } | 403 | } |
409 | } | 404 | } |
diff --git a/net/tipc/core.c b/net/tipc/core.c index f9e88d8b04ca..80c20647b3d2 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -77,37 +77,13 @@ struct sk_buff *tipc_buf_acquire(u32 size) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * tipc_core_stop_net - shut down TIPC networking sub-systems | ||
81 | */ | ||
82 | static void tipc_core_stop_net(void) | ||
83 | { | ||
84 | tipc_net_stop(); | ||
85 | tipc_bearer_cleanup(); | ||
86 | } | ||
87 | |||
88 | /** | ||
89 | * start_net - start TIPC networking sub-systems | ||
90 | */ | ||
91 | int tipc_core_start_net(unsigned long addr) | ||
92 | { | ||
93 | int res; | ||
94 | |||
95 | tipc_net_start(addr); | ||
96 | res = tipc_bearer_setup(); | ||
97 | if (res < 0) | ||
98 | goto err; | ||
99 | return res; | ||
100 | |||
101 | err: | ||
102 | tipc_core_stop_net(); | ||
103 | return res; | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode | 80 | * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode |
108 | */ | 81 | */ |
109 | static void tipc_core_stop(void) | 82 | static void tipc_core_stop(void) |
110 | { | 83 | { |
84 | tipc_handler_stop(); | ||
85 | tipc_net_stop(); | ||
86 | tipc_bearer_cleanup(); | ||
111 | tipc_netlink_stop(); | 87 | tipc_netlink_stop(); |
112 | tipc_cfg_stop(); | 88 | tipc_cfg_stop(); |
113 | tipc_subscr_stop(); | 89 | tipc_subscr_stop(); |
@@ -122,30 +98,65 @@ static void tipc_core_stop(void) | |||
122 | */ | 98 | */ |
123 | static int tipc_core_start(void) | 99 | static int tipc_core_start(void) |
124 | { | 100 | { |
125 | int res; | 101 | int err; |
126 | 102 | ||
127 | get_random_bytes(&tipc_random, sizeof(tipc_random)); | 103 | get_random_bytes(&tipc_random, sizeof(tipc_random)); |
128 | 104 | ||
129 | res = tipc_handler_start(); | 105 | err = tipc_handler_start(); |
130 | if (!res) | 106 | if (err) |
131 | res = tipc_ref_table_init(tipc_max_ports, tipc_random); | 107 | goto out_handler; |
132 | if (!res) | 108 | |
133 | res = tipc_nametbl_init(); | 109 | err = tipc_ref_table_init(tipc_max_ports, tipc_random); |
134 | if (!res) | 110 | if (err) |
135 | res = tipc_netlink_start(); | 111 | goto out_reftbl; |
136 | if (!res) | 112 | |
137 | res = tipc_socket_init(); | 113 | err = tipc_nametbl_init(); |
138 | if (!res) | 114 | if (err) |
139 | res = tipc_register_sysctl(); | 115 | goto out_nametbl; |
140 | if (!res) | 116 | |
141 | res = tipc_subscr_start(); | 117 | err = tipc_netlink_start(); |
142 | if (!res) | 118 | if (err) |
143 | res = tipc_cfg_init(); | 119 | goto out_netlink; |
144 | if (res) { | 120 | |
145 | tipc_handler_stop(); | 121 | err = tipc_socket_init(); |
146 | tipc_core_stop(); | 122 | if (err) |
147 | } | 123 | goto out_socket; |
148 | return res; | 124 | |
125 | err = tipc_register_sysctl(); | ||
126 | if (err) | ||
127 | goto out_sysctl; | ||
128 | |||
129 | err = tipc_subscr_start(); | ||
130 | if (err) | ||
131 | goto out_subscr; | ||
132 | |||
133 | err = tipc_cfg_init(); | ||
134 | if (err) | ||
135 | goto out_cfg; | ||
136 | |||
137 | err = tipc_bearer_setup(); | ||
138 | if (err) | ||
139 | goto out_bearer; | ||
140 | |||
141 | return 0; | ||
142 | out_bearer: | ||
143 | tipc_cfg_stop(); | ||
144 | out_cfg: | ||
145 | tipc_subscr_stop(); | ||
146 | out_subscr: | ||
147 | tipc_unregister_sysctl(); | ||
148 | out_sysctl: | ||
149 | tipc_socket_stop(); | ||
150 | out_socket: | ||
151 | tipc_netlink_stop(); | ||
152 | out_netlink: | ||
153 | tipc_nametbl_stop(); | ||
154 | out_nametbl: | ||
155 | tipc_ref_table_stop(); | ||
156 | out_reftbl: | ||
157 | tipc_handler_stop(); | ||
158 | out_handler: | ||
159 | return err; | ||
149 | } | 160 | } |
150 | 161 | ||
151 | static int __init tipc_init(void) | 162 | static int __init tipc_init(void) |
@@ -174,8 +185,6 @@ static int __init tipc_init(void) | |||
174 | 185 | ||
175 | static void __exit tipc_exit(void) | 186 | static void __exit tipc_exit(void) |
176 | { | 187 | { |
177 | tipc_handler_stop(); | ||
178 | tipc_core_stop_net(); | ||
179 | tipc_core_stop(); | 188 | tipc_core_stop(); |
180 | pr_info("Deactivated\n"); | 189 | pr_info("Deactivated\n"); |
181 | } | 190 | } |
diff --git a/net/tipc/core.h b/net/tipc/core.h index 5569d96b4da3..4dfe137587bb 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -90,7 +90,6 @@ extern int tipc_random __read_mostly; | |||
90 | /* | 90 | /* |
91 | * Routines available to privileged subsystems | 91 | * Routines available to privileged subsystems |
92 | */ | 92 | */ |
93 | int tipc_core_start_net(unsigned long); | ||
94 | int tipc_handler_start(void); | 93 | int tipc_handler_start(void); |
95 | void tipc_handler_stop(void); | 94 | void tipc_handler_stop(void); |
96 | int tipc_netlink_start(void); | 95 | int tipc_netlink_start(void); |
diff --git a/net/tipc/handler.c b/net/tipc/handler.c index e4bc8a296744..1fabf160501f 100644 --- a/net/tipc/handler.c +++ b/net/tipc/handler.c | |||
@@ -58,7 +58,6 @@ unsigned int tipc_k_signal(Handler routine, unsigned long argument) | |||
58 | 58 | ||
59 | spin_lock_bh(&qitem_lock); | 59 | spin_lock_bh(&qitem_lock); |
60 | if (!handler_enabled) { | 60 | if (!handler_enabled) { |
61 | pr_err("Signal request ignored by handler\n"); | ||
62 | spin_unlock_bh(&qitem_lock); | 61 | spin_unlock_bh(&qitem_lock); |
63 | return -ENOPROTOOPT; | 62 | return -ENOPROTOOPT; |
64 | } | 63 | } |
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 92a1533af4e0..042e8e3cabc0 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -941,20 +941,48 @@ int tipc_nametbl_init(void) | |||
941 | return 0; | 941 | return 0; |
942 | } | 942 | } |
943 | 943 | ||
944 | void tipc_nametbl_stop(void) | 944 | /** |
945 | * tipc_purge_publications - remove all publications for a given type | ||
946 | * | ||
947 | * tipc_nametbl_lock must be held when calling this function | ||
948 | */ | ||
949 | static void tipc_purge_publications(struct name_seq *seq) | ||
945 | { | 950 | { |
946 | u32 i; | 951 | struct publication *publ, *safe; |
952 | struct sub_seq *sseq; | ||
953 | struct name_info *info; | ||
947 | 954 | ||
948 | if (!table.types) | 955 | if (!seq->sseqs) { |
956 | nameseq_delete_empty(seq); | ||
949 | return; | 957 | return; |
958 | } | ||
959 | sseq = seq->sseqs; | ||
960 | info = sseq->info; | ||
961 | list_for_each_entry_safe(publ, safe, &info->zone_list, zone_list) { | ||
962 | tipc_nametbl_remove_publ(publ->type, publ->lower, publ->node, | ||
963 | publ->ref, publ->key); | ||
964 | } | ||
965 | } | ||
966 | |||
967 | void tipc_nametbl_stop(void) | ||
968 | { | ||
969 | u32 i; | ||
970 | struct name_seq *seq; | ||
971 | struct hlist_head *seq_head; | ||
972 | struct hlist_node *safe; | ||
950 | 973 | ||
951 | /* Verify name table is empty, then release it */ | 974 | /* Verify name table is empty and purge any lingering |
975 | * publications, then release the name table | ||
976 | */ | ||
952 | write_lock_bh(&tipc_nametbl_lock); | 977 | write_lock_bh(&tipc_nametbl_lock); |
953 | for (i = 0; i < TIPC_NAMETBL_SIZE; i++) { | 978 | for (i = 0; i < TIPC_NAMETBL_SIZE; i++) { |
954 | if (hlist_empty(&table.types[i])) | 979 | if (hlist_empty(&table.types[i])) |
955 | continue; | 980 | continue; |
956 | pr_err("nametbl_stop(): orphaned hash chain detected\n"); | 981 | seq_head = &table.types[i]; |
957 | break; | 982 | hlist_for_each_entry_safe(seq, safe, seq_head, ns_list) { |
983 | tipc_purge_publications(seq); | ||
984 | } | ||
985 | continue; | ||
958 | } | 986 | } |
959 | kfree(table.types); | 987 | kfree(table.types); |
960 | table.types = NULL; | 988 | table.types = NULL; |
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 9f72a6376362..3aaf73de9e2d 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c | |||
@@ -83,8 +83,6 @@ static struct genl_ops tipc_genl_ops[] = { | |||
83 | }, | 83 | }, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static int tipc_genl_family_registered; | ||
87 | |||
88 | int tipc_netlink_start(void) | 86 | int tipc_netlink_start(void) |
89 | { | 87 | { |
90 | int res; | 88 | int res; |
@@ -94,16 +92,10 @@ int tipc_netlink_start(void) | |||
94 | pr_err("Failed to register netlink interface\n"); | 92 | pr_err("Failed to register netlink interface\n"); |
95 | return res; | 93 | return res; |
96 | } | 94 | } |
97 | |||
98 | tipc_genl_family_registered = 1; | ||
99 | return 0; | 95 | return 0; |
100 | } | 96 | } |
101 | 97 | ||
102 | void tipc_netlink_stop(void) | 98 | void tipc_netlink_stop(void) |
103 | { | 99 | { |
104 | if (!tipc_genl_family_registered) | ||
105 | return; | ||
106 | |||
107 | genl_unregister_family(&tipc_genl_family); | 100 | genl_unregister_family(&tipc_genl_family); |
108 | tipc_genl_family_registered = 0; | ||
109 | } | 101 | } |
diff --git a/net/tipc/ref.c b/net/tipc/ref.c index 2a2a938dc22c..de3d593e2fee 100644 --- a/net/tipc/ref.c +++ b/net/tipc/ref.c | |||
@@ -126,9 +126,6 @@ int tipc_ref_table_init(u32 requested_size, u32 start) | |||
126 | */ | 126 | */ |
127 | void tipc_ref_table_stop(void) | 127 | void tipc_ref_table_stop(void) |
128 | { | 128 | { |
129 | if (!tipc_ref_table.entries) | ||
130 | return; | ||
131 | |||
132 | vfree(tipc_ref_table.entries); | 129 | vfree(tipc_ref_table.entries); |
133 | tipc_ref_table.entries = NULL; | 130 | tipc_ref_table.entries = NULL; |
134 | } | 131 | } |
diff --git a/net/tipc/server.c b/net/tipc/server.c index b635ca347a87..646a930eefbf 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c | |||
@@ -87,7 +87,6 @@ static void tipc_clean_outqueues(struct tipc_conn *con); | |||
87 | static void tipc_conn_kref_release(struct kref *kref) | 87 | static void tipc_conn_kref_release(struct kref *kref) |
88 | { | 88 | { |
89 | struct tipc_conn *con = container_of(kref, struct tipc_conn, kref); | 89 | struct tipc_conn *con = container_of(kref, struct tipc_conn, kref); |
90 | struct tipc_server *s = con->server; | ||
91 | 90 | ||
92 | if (con->sock) { | 91 | if (con->sock) { |
93 | tipc_sock_release_local(con->sock); | 92 | tipc_sock_release_local(con->sock); |
@@ -95,10 +94,6 @@ static void tipc_conn_kref_release(struct kref *kref) | |||
95 | } | 94 | } |
96 | 95 | ||
97 | tipc_clean_outqueues(con); | 96 | tipc_clean_outqueues(con); |
98 | |||
99 | if (con->conid) | ||
100 | s->tipc_conn_shutdown(con->conid, con->usr_data); | ||
101 | |||
102 | kfree(con); | 97 | kfree(con); |
103 | } | 98 | } |
104 | 99 | ||
@@ -181,6 +176,9 @@ static void tipc_close_conn(struct tipc_conn *con) | |||
181 | struct tipc_server *s = con->server; | 176 | struct tipc_server *s = con->server; |
182 | 177 | ||
183 | if (test_and_clear_bit(CF_CONNECTED, &con->flags)) { | 178 | if (test_and_clear_bit(CF_CONNECTED, &con->flags)) { |
179 | if (con->conid) | ||
180 | s->tipc_conn_shutdown(con->conid, con->usr_data); | ||
181 | |||
184 | spin_lock_bh(&s->idr_lock); | 182 | spin_lock_bh(&s->idr_lock); |
185 | idr_remove(&s->conn_idr, con->conid); | 183 | idr_remove(&s->conn_idr, con->conid); |
186 | s->idr_in_use--; | 184 | s->idr_in_use--; |
@@ -429,10 +427,12 @@ int tipc_conn_sendmsg(struct tipc_server *s, int conid, | |||
429 | list_add_tail(&e->list, &con->outqueue); | 427 | list_add_tail(&e->list, &con->outqueue); |
430 | spin_unlock_bh(&con->outqueue_lock); | 428 | spin_unlock_bh(&con->outqueue_lock); |
431 | 429 | ||
432 | if (test_bit(CF_CONNECTED, &con->flags)) | 430 | if (test_bit(CF_CONNECTED, &con->flags)) { |
433 | if (!queue_work(s->send_wq, &con->swork)) | 431 | if (!queue_work(s->send_wq, &con->swork)) |
434 | conn_put(con); | 432 | conn_put(con); |
435 | 433 | } else { | |
434 | conn_put(con); | ||
435 | } | ||
436 | return 0; | 436 | return 0; |
437 | } | 437 | } |
438 | 438 | ||
@@ -573,7 +573,6 @@ int tipc_server_start(struct tipc_server *s) | |||
573 | kmem_cache_destroy(s->rcvbuf_cache); | 573 | kmem_cache_destroy(s->rcvbuf_cache); |
574 | return ret; | 574 | return ret; |
575 | } | 575 | } |
576 | s->enabled = 1; | ||
577 | return ret; | 576 | return ret; |
578 | } | 577 | } |
579 | 578 | ||
@@ -583,10 +582,6 @@ void tipc_server_stop(struct tipc_server *s) | |||
583 | int total = 0; | 582 | int total = 0; |
584 | int id; | 583 | int id; |
585 | 584 | ||
586 | if (!s->enabled) | ||
587 | return; | ||
588 | |||
589 | s->enabled = 0; | ||
590 | spin_lock_bh(&s->idr_lock); | 585 | spin_lock_bh(&s->idr_lock); |
591 | for (id = 0; total < s->idr_in_use; id++) { | 586 | for (id = 0; total < s->idr_in_use; id++) { |
592 | con = idr_find(&s->conn_idr, id); | 587 | con = idr_find(&s->conn_idr, id); |
diff --git a/net/tipc/server.h b/net/tipc/server.h index 98b23f20bc0f..be817b0b547e 100644 --- a/net/tipc/server.h +++ b/net/tipc/server.h | |||
@@ -56,7 +56,6 @@ | |||
56 | * @name: server name | 56 | * @name: server name |
57 | * @imp: message importance | 57 | * @imp: message importance |
58 | * @type: socket type | 58 | * @type: socket type |
59 | * @enabled: identify whether server is launched or not | ||
60 | */ | 59 | */ |
61 | struct tipc_server { | 60 | struct tipc_server { |
62 | struct idr conn_idr; | 61 | struct idr conn_idr; |
@@ -74,7 +73,6 @@ struct tipc_server { | |||
74 | const char name[TIPC_SERVER_NAME_LEN]; | 73 | const char name[TIPC_SERVER_NAME_LEN]; |
75 | int imp; | 74 | int imp; |
76 | int type; | 75 | int type; |
77 | int enabled; | ||
78 | }; | 76 | }; |
79 | 77 | ||
80 | int tipc_conn_sendmsg(struct tipc_server *s, int conid, | 78 | int tipc_conn_sendmsg(struct tipc_server *s, int conid, |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index aab4948f0aff..0ed0eaa62f29 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -70,8 +70,6 @@ static const struct proto_ops msg_ops; | |||
70 | static struct proto tipc_proto; | 70 | static struct proto tipc_proto; |
71 | static struct proto tipc_proto_kern; | 71 | static struct proto tipc_proto_kern; |
72 | 72 | ||
73 | static int sockets_enabled; | ||
74 | |||
75 | /* | 73 | /* |
76 | * Revised TIPC socket locking policy: | 74 | * Revised TIPC socket locking policy: |
77 | * | 75 | * |
@@ -999,7 +997,7 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo) | |||
999 | 997 | ||
1000 | for (;;) { | 998 | for (;;) { |
1001 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); | 999 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
1002 | if (skb_queue_empty(&sk->sk_receive_queue)) { | 1000 | if (timeo && skb_queue_empty(&sk->sk_receive_queue)) { |
1003 | if (sock->state == SS_DISCONNECTING) { | 1001 | if (sock->state == SS_DISCONNECTING) { |
1004 | err = -ENOTCONN; | 1002 | err = -ENOTCONN; |
1005 | break; | 1003 | break; |
@@ -1625,7 +1623,7 @@ static int tipc_wait_for_accept(struct socket *sock, long timeo) | |||
1625 | for (;;) { | 1623 | for (;;) { |
1626 | prepare_to_wait_exclusive(sk_sleep(sk), &wait, | 1624 | prepare_to_wait_exclusive(sk_sleep(sk), &wait, |
1627 | TASK_INTERRUPTIBLE); | 1625 | TASK_INTERRUPTIBLE); |
1628 | if (skb_queue_empty(&sk->sk_receive_queue)) { | 1626 | if (timeo && skb_queue_empty(&sk->sk_receive_queue)) { |
1629 | release_sock(sk); | 1627 | release_sock(sk); |
1630 | timeo = schedule_timeout(timeo); | 1628 | timeo = schedule_timeout(timeo); |
1631 | lock_sock(sk); | 1629 | lock_sock(sk); |
@@ -2027,8 +2025,6 @@ int tipc_socket_init(void) | |||
2027 | proto_unregister(&tipc_proto); | 2025 | proto_unregister(&tipc_proto); |
2028 | goto out; | 2026 | goto out; |
2029 | } | 2027 | } |
2030 | |||
2031 | sockets_enabled = 1; | ||
2032 | out: | 2028 | out: |
2033 | return res; | 2029 | return res; |
2034 | } | 2030 | } |
@@ -2038,10 +2034,6 @@ int tipc_socket_init(void) | |||
2038 | */ | 2034 | */ |
2039 | void tipc_socket_stop(void) | 2035 | void tipc_socket_stop(void) |
2040 | { | 2036 | { |
2041 | if (!sockets_enabled) | ||
2042 | return; | ||
2043 | |||
2044 | sockets_enabled = 0; | ||
2045 | sock_unregister(tipc_family_ops.family); | 2037 | sock_unregister(tipc_family_ops.family); |
2046 | proto_unregister(&tipc_proto); | 2038 | proto_unregister(&tipc_proto); |
2047 | } | 2039 | } |
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 7cb0bd5b1176..642437231ad5 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -96,20 +96,16 @@ static void subscr_send_event(struct tipc_subscription *sub, u32 found_lower, | |||
96 | { | 96 | { |
97 | struct tipc_subscriber *subscriber = sub->subscriber; | 97 | struct tipc_subscriber *subscriber = sub->subscriber; |
98 | struct kvec msg_sect; | 98 | struct kvec msg_sect; |
99 | int ret; | ||
100 | 99 | ||
101 | msg_sect.iov_base = (void *)&sub->evt; | 100 | msg_sect.iov_base = (void *)&sub->evt; |
102 | msg_sect.iov_len = sizeof(struct tipc_event); | 101 | msg_sect.iov_len = sizeof(struct tipc_event); |
103 | |||
104 | sub->evt.event = htohl(event, sub->swap); | 102 | sub->evt.event = htohl(event, sub->swap); |
105 | sub->evt.found_lower = htohl(found_lower, sub->swap); | 103 | sub->evt.found_lower = htohl(found_lower, sub->swap); |
106 | sub->evt.found_upper = htohl(found_upper, sub->swap); | 104 | sub->evt.found_upper = htohl(found_upper, sub->swap); |
107 | sub->evt.port.ref = htohl(port_ref, sub->swap); | 105 | sub->evt.port.ref = htohl(port_ref, sub->swap); |
108 | sub->evt.port.node = htohl(node, sub->swap); | 106 | sub->evt.port.node = htohl(node, sub->swap); |
109 | ret = tipc_conn_sendmsg(&topsrv, subscriber->conid, NULL, | 107 | tipc_conn_sendmsg(&topsrv, subscriber->conid, NULL, msg_sect.iov_base, |
110 | msg_sect.iov_base, msg_sect.iov_len); | 108 | msg_sect.iov_len); |
111 | if (ret < 0) | ||
112 | pr_err("Sending subscription event failed, no memory\n"); | ||
113 | } | 109 | } |
114 | 110 | ||
115 | /** | 111 | /** |
@@ -153,14 +149,6 @@ static void subscr_timeout(struct tipc_subscription *sub) | |||
153 | /* The spin lock per subscriber is used to protect its members */ | 149 | /* The spin lock per subscriber is used to protect its members */ |
154 | spin_lock_bh(&subscriber->lock); | 150 | spin_lock_bh(&subscriber->lock); |
155 | 151 | ||
156 | /* Validate if the connection related to the subscriber is | ||
157 | * closed (in case subscriber is terminating) | ||
158 | */ | ||
159 | if (subscriber->conid == 0) { | ||
160 | spin_unlock_bh(&subscriber->lock); | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | /* Validate timeout (in case subscription is being cancelled) */ | 152 | /* Validate timeout (in case subscription is being cancelled) */ |
165 | if (sub->timeout == TIPC_WAIT_FOREVER) { | 153 | if (sub->timeout == TIPC_WAIT_FOREVER) { |
166 | spin_unlock_bh(&subscriber->lock); | 154 | spin_unlock_bh(&subscriber->lock); |
@@ -215,9 +203,6 @@ static void subscr_release(struct tipc_subscriber *subscriber) | |||
215 | 203 | ||
216 | spin_lock_bh(&subscriber->lock); | 204 | spin_lock_bh(&subscriber->lock); |
217 | 205 | ||
218 | /* Invalidate subscriber reference */ | ||
219 | subscriber->conid = 0; | ||
220 | |||
221 | /* Destroy any existing subscriptions for subscriber */ | 206 | /* Destroy any existing subscriptions for subscriber */ |
222 | list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, | 207 | list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, |
223 | subscription_list) { | 208 | subscription_list) { |
@@ -278,9 +263,9 @@ static void subscr_cancel(struct tipc_subscr *s, | |||
278 | * | 263 | * |
279 | * Called with subscriber lock held. | 264 | * Called with subscriber lock held. |
280 | */ | 265 | */ |
281 | static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, | 266 | static int subscr_subscribe(struct tipc_subscr *s, |
282 | struct tipc_subscriber *subscriber) | 267 | struct tipc_subscriber *subscriber, |
283 | { | 268 | struct tipc_subscription **sub_p) { |
284 | struct tipc_subscription *sub; | 269 | struct tipc_subscription *sub; |
285 | int swap; | 270 | int swap; |
286 | 271 | ||
@@ -291,23 +276,21 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, | |||
291 | if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) { | 276 | if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) { |
292 | s->filter &= ~htohl(TIPC_SUB_CANCEL, swap); | 277 | s->filter &= ~htohl(TIPC_SUB_CANCEL, swap); |
293 | subscr_cancel(s, subscriber); | 278 | subscr_cancel(s, subscriber); |
294 | return NULL; | 279 | return 0; |
295 | } | 280 | } |
296 | 281 | ||
297 | /* Refuse subscription if global limit exceeded */ | 282 | /* Refuse subscription if global limit exceeded */ |
298 | if (atomic_read(&subscription_count) >= TIPC_MAX_SUBSCRIPTIONS) { | 283 | if (atomic_read(&subscription_count) >= TIPC_MAX_SUBSCRIPTIONS) { |
299 | pr_warn("Subscription rejected, limit reached (%u)\n", | 284 | pr_warn("Subscription rejected, limit reached (%u)\n", |
300 | TIPC_MAX_SUBSCRIPTIONS); | 285 | TIPC_MAX_SUBSCRIPTIONS); |
301 | subscr_terminate(subscriber); | 286 | return -EINVAL; |
302 | return NULL; | ||
303 | } | 287 | } |
304 | 288 | ||
305 | /* Allocate subscription object */ | 289 | /* Allocate subscription object */ |
306 | sub = kmalloc(sizeof(*sub), GFP_ATOMIC); | 290 | sub = kmalloc(sizeof(*sub), GFP_ATOMIC); |
307 | if (!sub) { | 291 | if (!sub) { |
308 | pr_warn("Subscription rejected, no memory\n"); | 292 | pr_warn("Subscription rejected, no memory\n"); |
309 | subscr_terminate(subscriber); | 293 | return -ENOMEM; |
310 | return NULL; | ||
311 | } | 294 | } |
312 | 295 | ||
313 | /* Initialize subscription object */ | 296 | /* Initialize subscription object */ |
@@ -321,8 +304,7 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, | |||
321 | (sub->seq.lower > sub->seq.upper)) { | 304 | (sub->seq.lower > sub->seq.upper)) { |
322 | pr_warn("Subscription rejected, illegal request\n"); | 305 | pr_warn("Subscription rejected, illegal request\n"); |
323 | kfree(sub); | 306 | kfree(sub); |
324 | subscr_terminate(subscriber); | 307 | return -EINVAL; |
325 | return NULL; | ||
326 | } | 308 | } |
327 | INIT_LIST_HEAD(&sub->nameseq_list); | 309 | INIT_LIST_HEAD(&sub->nameseq_list); |
328 | list_add(&sub->subscription_list, &subscriber->subscription_list); | 310 | list_add(&sub->subscription_list, &subscriber->subscription_list); |
@@ -335,8 +317,8 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, | |||
335 | (Handler)subscr_timeout, (unsigned long)sub); | 317 | (Handler)subscr_timeout, (unsigned long)sub); |
336 | k_start_timer(&sub->timer, sub->timeout); | 318 | k_start_timer(&sub->timer, sub->timeout); |
337 | } | 319 | } |
338 | 320 | *sub_p = sub; | |
339 | return sub; | 321 | return 0; |
340 | } | 322 | } |
341 | 323 | ||
342 | /* Handle one termination request for the subscriber */ | 324 | /* Handle one termination request for the subscriber */ |
@@ -350,10 +332,14 @@ static void subscr_conn_msg_event(int conid, struct sockaddr_tipc *addr, | |||
350 | void *usr_data, void *buf, size_t len) | 332 | void *usr_data, void *buf, size_t len) |
351 | { | 333 | { |
352 | struct tipc_subscriber *subscriber = usr_data; | 334 | struct tipc_subscriber *subscriber = usr_data; |
353 | struct tipc_subscription *sub; | 335 | struct tipc_subscription *sub = NULL; |
354 | 336 | ||
355 | spin_lock_bh(&subscriber->lock); | 337 | spin_lock_bh(&subscriber->lock); |
356 | sub = subscr_subscribe((struct tipc_subscr *)buf, subscriber); | 338 | if (subscr_subscribe((struct tipc_subscr *)buf, subscriber, &sub) < 0) { |
339 | spin_unlock_bh(&subscriber->lock); | ||
340 | subscr_terminate(subscriber); | ||
341 | return; | ||
342 | } | ||
357 | if (sub) | 343 | if (sub) |
358 | tipc_nametbl_subscribe(sub); | 344 | tipc_nametbl_subscribe(sub); |
359 | spin_unlock_bh(&subscriber->lock); | 345 | spin_unlock_bh(&subscriber->lock); |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 29fc8bee9702..ce6ec6c2f4de 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -163,9 +163,8 @@ static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) | |||
163 | 163 | ||
164 | static inline unsigned int unix_hash_fold(__wsum n) | 164 | static inline unsigned int unix_hash_fold(__wsum n) |
165 | { | 165 | { |
166 | unsigned int hash = (__force unsigned int)n; | 166 | unsigned int hash = (__force unsigned int)csum_fold(n); |
167 | 167 | ||
168 | hash ^= hash>>16; | ||
169 | hash ^= hash>>8; | 168 | hash ^= hash>>8; |
170 | return hash&(UNIX_HASH_SIZE-1); | 169 | return hash&(UNIX_HASH_SIZE-1); |
171 | } | 170 | } |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 010892b81a06..a3bf18d11609 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -788,8 +788,6 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev, | |||
788 | default: | 788 | default: |
789 | break; | 789 | break; |
790 | } | 790 | } |
791 | |||
792 | wdev->beacon_interval = 0; | ||
793 | } | 791 | } |
794 | 792 | ||
795 | static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | 793 | static int cfg80211_netdev_notifier_call(struct notifier_block *nb, |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 9b897fca7487..f0541370e68e 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -1700,7 +1700,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1700 | return; | 1700 | return; |
1701 | case NL80211_REGDOM_SET_BY_USER: | 1701 | case NL80211_REGDOM_SET_BY_USER: |
1702 | treatment = reg_process_hint_user(reg_request); | 1702 | treatment = reg_process_hint_user(reg_request); |
1703 | if (treatment == REG_REQ_OK || | 1703 | if (treatment == REG_REQ_IGNORE || |
1704 | treatment == REG_REQ_ALREADY_SET) | 1704 | treatment == REG_REQ_ALREADY_SET) |
1705 | return; | 1705 | return; |
1706 | schedule_delayed_work(®_timeout, msecs_to_jiffies(3142)); | 1706 | schedule_delayed_work(®_timeout, msecs_to_jiffies(3142)); |
@@ -2373,6 +2373,7 @@ static int reg_set_rd_country_ie(const struct ieee80211_regdomain *rd, | |||
2373 | int set_regdom(const struct ieee80211_regdomain *rd) | 2373 | int set_regdom(const struct ieee80211_regdomain *rd) |
2374 | { | 2374 | { |
2375 | struct regulatory_request *lr; | 2375 | struct regulatory_request *lr; |
2376 | bool user_reset = false; | ||
2376 | int r; | 2377 | int r; |
2377 | 2378 | ||
2378 | if (!reg_is_valid_request(rd->alpha2)) { | 2379 | if (!reg_is_valid_request(rd->alpha2)) { |
@@ -2389,6 +2390,7 @@ int set_regdom(const struct ieee80211_regdomain *rd) | |||
2389 | break; | 2390 | break; |
2390 | case NL80211_REGDOM_SET_BY_USER: | 2391 | case NL80211_REGDOM_SET_BY_USER: |
2391 | r = reg_set_rd_user(rd, lr); | 2392 | r = reg_set_rd_user(rd, lr); |
2393 | user_reset = true; | ||
2392 | break; | 2394 | break; |
2393 | case NL80211_REGDOM_SET_BY_DRIVER: | 2395 | case NL80211_REGDOM_SET_BY_DRIVER: |
2394 | r = reg_set_rd_driver(rd, lr); | 2396 | r = reg_set_rd_driver(rd, lr); |
@@ -2402,8 +2404,14 @@ int set_regdom(const struct ieee80211_regdomain *rd) | |||
2402 | } | 2404 | } |
2403 | 2405 | ||
2404 | if (r) { | 2406 | if (r) { |
2405 | if (r == -EALREADY) | 2407 | switch (r) { |
2408 | case -EALREADY: | ||
2406 | reg_set_request_processed(); | 2409 | reg_set_request_processed(); |
2410 | break; | ||
2411 | default: | ||
2412 | /* Back to world regulatory in case of errors */ | ||
2413 | restore_regulatory_settings(user_reset); | ||
2414 | } | ||
2407 | 2415 | ||
2408 | kfree(rd); | 2416 | kfree(rd); |
2409 | return r; | 2417 | return r; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 4b98b25793c5..1d5c7bf29938 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1158,7 +1158,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol, | |||
1158 | if (hlist_unhashed(&pol->bydst)) | 1158 | if (hlist_unhashed(&pol->bydst)) |
1159 | return NULL; | 1159 | return NULL; |
1160 | 1160 | ||
1161 | hlist_del(&pol->bydst); | 1161 | hlist_del_init(&pol->bydst); |
1162 | hlist_del(&pol->byidx); | 1162 | hlist_del(&pol->byidx); |
1163 | list_del(&pol->walk.all); | 1163 | list_del(&pol->walk.all); |
1164 | net->xfrm.policy_count[dir]--; | 1164 | net->xfrm.policy_count[dir]--; |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index a26b7aa79475..40f1b3e92e78 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1159,6 +1159,11 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp) | |||
1159 | } | 1159 | } |
1160 | x->props.aalgo = orig->props.aalgo; | 1160 | x->props.aalgo = orig->props.aalgo; |
1161 | 1161 | ||
1162 | if (orig->aead) { | ||
1163 | x->aead = xfrm_algo_aead_clone(orig->aead); | ||
1164 | if (!x->aead) | ||
1165 | goto error; | ||
1166 | } | ||
1162 | if (orig->ealg) { | 1167 | if (orig->ealg) { |
1163 | x->ealg = xfrm_algo_clone(orig->ealg); | 1168 | x->ealg = xfrm_algo_clone(orig->ealg); |
1164 | if (!x->ealg) | 1169 | if (!x->ealg) |
@@ -1201,6 +1206,9 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp) | |||
1201 | x->props.flags = orig->props.flags; | 1206 | x->props.flags = orig->props.flags; |
1202 | x->props.extra_flags = orig->props.extra_flags; | 1207 | x->props.extra_flags = orig->props.extra_flags; |
1203 | 1208 | ||
1209 | x->tfcpad = orig->tfcpad; | ||
1210 | x->replay_maxdiff = orig->replay_maxdiff; | ||
1211 | x->replay_maxage = orig->replay_maxage; | ||
1204 | x->curlft.add_time = orig->curlft.add_time; | 1212 | x->curlft.add_time = orig->curlft.add_time; |
1205 | x->km.state = orig->km.state; | 1213 | x->km.state = orig->km.state; |
1206 | x->km.seq = orig->km.seq; | 1214 | x->km.seq = orig->km.seq; |
@@ -1215,11 +1223,12 @@ out: | |||
1215 | return NULL; | 1223 | return NULL; |
1216 | } | 1224 | } |
1217 | 1225 | ||
1218 | /* net->xfrm.xfrm_state_lock is held */ | ||
1219 | struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net) | 1226 | struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net) |
1220 | { | 1227 | { |
1221 | unsigned int h; | 1228 | unsigned int h; |
1222 | struct xfrm_state *x; | 1229 | struct xfrm_state *x = NULL; |
1230 | |||
1231 | spin_lock_bh(&net->xfrm.xfrm_state_lock); | ||
1223 | 1232 | ||
1224 | if (m->reqid) { | 1233 | if (m->reqid) { |
1225 | h = xfrm_dst_hash(net, &m->old_daddr, &m->old_saddr, | 1234 | h = xfrm_dst_hash(net, &m->old_daddr, &m->old_saddr, |
@@ -1236,7 +1245,7 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n | |||
1236 | m->old_family)) | 1245 | m->old_family)) |
1237 | continue; | 1246 | continue; |
1238 | xfrm_state_hold(x); | 1247 | xfrm_state_hold(x); |
1239 | return x; | 1248 | break; |
1240 | } | 1249 | } |
1241 | } else { | 1250 | } else { |
1242 | h = xfrm_src_hash(net, &m->old_daddr, &m->old_saddr, | 1251 | h = xfrm_src_hash(net, &m->old_daddr, &m->old_saddr, |
@@ -1251,11 +1260,13 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n | |||
1251 | m->old_family)) | 1260 | m->old_family)) |
1252 | continue; | 1261 | continue; |
1253 | xfrm_state_hold(x); | 1262 | xfrm_state_hold(x); |
1254 | return x; | 1263 | break; |
1255 | } | 1264 | } |
1256 | } | 1265 | } |
1257 | 1266 | ||
1258 | return NULL; | 1267 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); |
1268 | |||
1269 | return x; | ||
1259 | } | 1270 | } |
1260 | EXPORT_SYMBOL(xfrm_migrate_state_find); | 1271 | EXPORT_SYMBOL(xfrm_migrate_state_find); |
1261 | 1272 | ||
@@ -1451,7 +1462,7 @@ xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n, | |||
1451 | { | 1462 | { |
1452 | int err = 0; | 1463 | int err = 0; |
1453 | struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family); | 1464 | struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family); |
1454 | struct net *net = xs_net(*dst); | 1465 | struct net *net = xs_net(*src); |
1455 | 1466 | ||
1456 | if (!afinfo) | 1467 | if (!afinfo) |
1457 | return -EAFNOSUPPORT; | 1468 | return -EAFNOSUPPORT; |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 1ae3ec7c18b0..2f7ddc3a59b4 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -32,11 +32,6 @@ | |||
32 | #include <linux/in6.h> | 32 | #include <linux/in6.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | static inline int aead_len(struct xfrm_algo_aead *alg) | ||
36 | { | ||
37 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | ||
38 | } | ||
39 | |||
40 | static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type) | 35 | static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type) |
41 | { | 36 | { |
42 | struct nlattr *rt = attrs[type]; | 37 | struct nlattr *rt = attrs[type]; |
@@ -1226,7 +1221,7 @@ static int copy_from_user_sec_ctx(struct xfrm_policy *pol, struct nlattr **attrs | |||
1226 | return 0; | 1221 | return 0; |
1227 | 1222 | ||
1228 | uctx = nla_data(rt); | 1223 | uctx = nla_data(rt); |
1229 | return security_xfrm_policy_alloc(&pol->security, uctx); | 1224 | return security_xfrm_policy_alloc(&pol->security, uctx, GFP_KERNEL); |
1230 | } | 1225 | } |
1231 | 1226 | ||
1232 | static void copy_templates(struct xfrm_policy *xp, struct xfrm_user_tmpl *ut, | 1227 | static void copy_templates(struct xfrm_policy *xp, struct xfrm_user_tmpl *ut, |
@@ -1631,7 +1626,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1631 | if (rt) { | 1626 | if (rt) { |
1632 | struct xfrm_user_sec_ctx *uctx = nla_data(rt); | 1627 | struct xfrm_user_sec_ctx *uctx = nla_data(rt); |
1633 | 1628 | ||
1634 | err = security_xfrm_policy_alloc(&ctx, uctx); | 1629 | err = security_xfrm_policy_alloc(&ctx, uctx, GFP_KERNEL); |
1635 | if (err) | 1630 | if (err) |
1636 | return err; | 1631 | return err; |
1637 | } | 1632 | } |
@@ -1933,7 +1928,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1933 | if (rt) { | 1928 | if (rt) { |
1934 | struct xfrm_user_sec_ctx *uctx = nla_data(rt); | 1929 | struct xfrm_user_sec_ctx *uctx = nla_data(rt); |
1935 | 1930 | ||
1936 | err = security_xfrm_policy_alloc(&ctx, uctx); | 1931 | err = security_xfrm_policy_alloc(&ctx, uctx, GFP_KERNEL); |
1937 | if (err) | 1932 | if (err) |
1938 | return err; | 1933 | return err; |
1939 | } | 1934 | } |
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index ef474098d9f1..17fa901418ae 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh | |||
@@ -257,7 +257,7 @@ case "$arg" in | |||
257 | && compr="lzop -9 -f" | 257 | && compr="lzop -9 -f" |
258 | echo "$output_file" | grep -q "\.lz4$" \ | 258 | echo "$output_file" | grep -q "\.lz4$" \ |
259 | && [ -x "`which lz4 2> /dev/null`" ] \ | 259 | && [ -x "`which lz4 2> /dev/null`" ] \ |
260 | && compr="lz4 -9 -f" | 260 | && compr="lz4 -l -9 -f" |
261 | echo "$output_file" | grep -q "\.cpio$" && compr="cat" | 261 | echo "$output_file" | grep -q "\.cpio$" && compr="cat" |
262 | shift | 262 | shift |
263 | ;; | 263 | ;; |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 40610984a1b5..99a45fdc1bbf 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1502,6 +1502,16 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) | |||
1502 | #define R_ARM_JUMP24 29 | 1502 | #define R_ARM_JUMP24 29 |
1503 | #endif | 1503 | #endif |
1504 | 1504 | ||
1505 | #ifndef R_ARM_THM_CALL | ||
1506 | #define R_ARM_THM_CALL 10 | ||
1507 | #endif | ||
1508 | #ifndef R_ARM_THM_JUMP24 | ||
1509 | #define R_ARM_THM_JUMP24 30 | ||
1510 | #endif | ||
1511 | #ifndef R_ARM_THM_JUMP19 | ||
1512 | #define R_ARM_THM_JUMP19 51 | ||
1513 | #endif | ||
1514 | |||
1505 | static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) | 1515 | static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) |
1506 | { | 1516 | { |
1507 | unsigned int r_typ = ELF_R_TYPE(r->r_info); | 1517 | unsigned int r_typ = ELF_R_TYPE(r->r_info); |
@@ -1515,6 +1525,9 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) | |||
1515 | case R_ARM_PC24: | 1525 | case R_ARM_PC24: |
1516 | case R_ARM_CALL: | 1526 | case R_ARM_CALL: |
1517 | case R_ARM_JUMP24: | 1527 | case R_ARM_JUMP24: |
1528 | case R_ARM_THM_CALL: | ||
1529 | case R_ARM_THM_JUMP24: | ||
1530 | case R_ARM_THM_JUMP19: | ||
1518 | /* From ARM ABI: ((S + A) | T) - P */ | 1531 | /* From ARM ABI: ((S + A) | T) - P */ |
1519 | r->r_addend = (int)(long)(elf->hdr + | 1532 | r->r_addend = (int)(long)(elf->hdr + |
1520 | sechdr->sh_offset + | 1533 | sechdr->sh_offset + |
diff --git a/security/capability.c b/security/capability.c index 8b4f24ae4338..21e2b9cae685 100644 --- a/security/capability.c +++ b/security/capability.c | |||
@@ -757,7 +757,8 @@ static void cap_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |||
757 | 757 | ||
758 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 758 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
759 | static int cap_xfrm_policy_alloc_security(struct xfrm_sec_ctx **ctxp, | 759 | static int cap_xfrm_policy_alloc_security(struct xfrm_sec_ctx **ctxp, |
760 | struct xfrm_user_sec_ctx *sec_ctx) | 760 | struct xfrm_user_sec_ctx *sec_ctx, |
761 | gfp_t gfp) | ||
761 | { | 762 | { |
762 | return 0; | 763 | return 0; |
763 | } | 764 | } |
diff --git a/security/keys/keyring.c b/security/keys/keyring.c index d46cbc5e335e..2fb2576dc644 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c | |||
@@ -1000,7 +1000,11 @@ static int keyring_detect_cycle_iterator(const void *object, | |||
1000 | 1000 | ||
1001 | kenter("{%d}", key->serial); | 1001 | kenter("{%d}", key->serial); |
1002 | 1002 | ||
1003 | BUG_ON(key != ctx->match_data); | 1003 | /* We might get a keyring with matching index-key that is nonetheless a |
1004 | * different keyring. */ | ||
1005 | if (key != ctx->match_data) | ||
1006 | return 0; | ||
1007 | |||
1004 | ctx->result = ERR_PTR(-EDEADLK); | 1008 | ctx->result = ERR_PTR(-EDEADLK); |
1005 | return 1; | 1009 | return 1; |
1006 | } | 1010 | } |
diff --git a/security/security.c b/security/security.c index 15b6928592ef..919cad93ac82 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -1317,9 +1317,11 @@ void security_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |||
1317 | 1317 | ||
1318 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1318 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
1319 | 1319 | ||
1320 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx) | 1320 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
1321 | struct xfrm_user_sec_ctx *sec_ctx, | ||
1322 | gfp_t gfp) | ||
1321 | { | 1323 | { |
1322 | return security_ops->xfrm_policy_alloc_security(ctxp, sec_ctx); | 1324 | return security_ops->xfrm_policy_alloc_security(ctxp, sec_ctx, gfp); |
1323 | } | 1325 | } |
1324 | EXPORT_SYMBOL(security_xfrm_policy_alloc); | 1326 | EXPORT_SYMBOL(security_xfrm_policy_alloc); |
1325 | 1327 | ||
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4b34847208cc..b332e2cc0954 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -668,7 +668,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
668 | if (flags[i] == SBLABEL_MNT) | 668 | if (flags[i] == SBLABEL_MNT) |
669 | continue; | 669 | continue; |
670 | rc = security_context_to_sid(mount_options[i], | 670 | rc = security_context_to_sid(mount_options[i], |
671 | strlen(mount_options[i]), &sid); | 671 | strlen(mount_options[i]), &sid, GFP_KERNEL); |
672 | if (rc) { | 672 | if (rc) { |
673 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 673 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
674 | "(%s) failed for (dev %s, type %s) errno=%d\n", | 674 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
@@ -2489,7 +2489,8 @@ static int selinux_sb_remount(struct super_block *sb, void *data) | |||
2489 | if (flags[i] == SBLABEL_MNT) | 2489 | if (flags[i] == SBLABEL_MNT) |
2490 | continue; | 2490 | continue; |
2491 | len = strlen(mount_options[i]); | 2491 | len = strlen(mount_options[i]); |
2492 | rc = security_context_to_sid(mount_options[i], len, &sid); | 2492 | rc = security_context_to_sid(mount_options[i], len, &sid, |
2493 | GFP_KERNEL); | ||
2493 | if (rc) { | 2494 | if (rc) { |
2494 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 2495 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
2495 | "(%s) failed for (dev %s, type %s) errno=%d\n", | 2496 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
@@ -2893,7 +2894,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2893 | if (rc) | 2894 | if (rc) |
2894 | return rc; | 2895 | return rc; |
2895 | 2896 | ||
2896 | rc = security_context_to_sid(value, size, &newsid); | 2897 | rc = security_context_to_sid(value, size, &newsid, GFP_KERNEL); |
2897 | if (rc == -EINVAL) { | 2898 | if (rc == -EINVAL) { |
2898 | if (!capable(CAP_MAC_ADMIN)) { | 2899 | if (!capable(CAP_MAC_ADMIN)) { |
2899 | struct audit_buffer *ab; | 2900 | struct audit_buffer *ab; |
@@ -3050,7 +3051,7 @@ static int selinux_inode_setsecurity(struct inode *inode, const char *name, | |||
3050 | if (!value || !size) | 3051 | if (!value || !size) |
3051 | return -EACCES; | 3052 | return -EACCES; |
3052 | 3053 | ||
3053 | rc = security_context_to_sid((void *)value, size, &newsid); | 3054 | rc = security_context_to_sid((void *)value, size, &newsid, GFP_KERNEL); |
3054 | if (rc) | 3055 | if (rc) |
3055 | return rc; | 3056 | return rc; |
3056 | 3057 | ||
@@ -5529,7 +5530,7 @@ static int selinux_setprocattr(struct task_struct *p, | |||
5529 | str[size-1] = 0; | 5530 | str[size-1] = 0; |
5530 | size--; | 5531 | size--; |
5531 | } | 5532 | } |
5532 | error = security_context_to_sid(value, size, &sid); | 5533 | error = security_context_to_sid(value, size, &sid, GFP_KERNEL); |
5533 | if (error == -EINVAL && !strcmp(name, "fscreate")) { | 5534 | if (error == -EINVAL && !strcmp(name, "fscreate")) { |
5534 | if (!capable(CAP_MAC_ADMIN)) { | 5535 | if (!capable(CAP_MAC_ADMIN)) { |
5535 | struct audit_buffer *ab; | 5536 | struct audit_buffer *ab; |
@@ -5638,7 +5639,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | |||
5638 | 5639 | ||
5639 | static int selinux_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) | 5640 | static int selinux_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) |
5640 | { | 5641 | { |
5641 | return security_context_to_sid(secdata, seclen, secid); | 5642 | return security_context_to_sid(secdata, seclen, secid, GFP_KERNEL); |
5642 | } | 5643 | } |
5643 | 5644 | ||
5644 | static void selinux_release_secctx(char *secdata, u32 seclen) | 5645 | static void selinux_release_secctx(char *secdata, u32 seclen) |
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index 8ed8daf7f1ee..ce7852cf526b 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h | |||
@@ -134,7 +134,7 @@ int security_sid_to_context(u32 sid, char **scontext, | |||
134 | int security_sid_to_context_force(u32 sid, char **scontext, u32 *scontext_len); | 134 | int security_sid_to_context_force(u32 sid, char **scontext, u32 *scontext_len); |
135 | 135 | ||
136 | int security_context_to_sid(const char *scontext, u32 scontext_len, | 136 | int security_context_to_sid(const char *scontext, u32 scontext_len, |
137 | u32 *out_sid); | 137 | u32 *out_sid, gfp_t gfp); |
138 | 138 | ||
139 | int security_context_to_sid_default(const char *scontext, u32 scontext_len, | 139 | int security_context_to_sid_default(const char *scontext, u32 scontext_len, |
140 | u32 *out_sid, u32 def_sid, gfp_t gfp_flags); | 140 | u32 *out_sid, u32 def_sid, gfp_t gfp_flags); |
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h index 48c3cc94c168..9f0584710c85 100644 --- a/security/selinux/include/xfrm.h +++ b/security/selinux/include/xfrm.h | |||
@@ -10,7 +10,8 @@ | |||
10 | #include <net/flow.h> | 10 | #include <net/flow.h> |
11 | 11 | ||
12 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, | 12 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
13 | struct xfrm_user_sec_ctx *uctx); | 13 | struct xfrm_user_sec_ctx *uctx, |
14 | gfp_t gfp); | ||
14 | int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, | 15 | int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, |
15 | struct xfrm_sec_ctx **new_ctxp); | 16 | struct xfrm_sec_ctx **new_ctxp); |
16 | void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx); | 17 | void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx); |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 5122affe06a8..d60c0ee66387 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -576,7 +576,7 @@ static ssize_t sel_write_context(struct file *file, char *buf, size_t size) | |||
576 | if (length) | 576 | if (length) |
577 | goto out; | 577 | goto out; |
578 | 578 | ||
579 | length = security_context_to_sid(buf, size, &sid); | 579 | length = security_context_to_sid(buf, size, &sid, GFP_KERNEL); |
580 | if (length) | 580 | if (length) |
581 | goto out; | 581 | goto out; |
582 | 582 | ||
@@ -731,11 +731,13 @@ static ssize_t sel_write_access(struct file *file, char *buf, size_t size) | |||
731 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 731 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
732 | goto out; | 732 | goto out; |
733 | 733 | ||
734 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 734 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
735 | GFP_KERNEL); | ||
735 | if (length) | 736 | if (length) |
736 | goto out; | 737 | goto out; |
737 | 738 | ||
738 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 739 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
740 | GFP_KERNEL); | ||
739 | if (length) | 741 | if (length) |
740 | goto out; | 742 | goto out; |
741 | 743 | ||
@@ -817,11 +819,13 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size) | |||
817 | objname = namebuf; | 819 | objname = namebuf; |
818 | } | 820 | } |
819 | 821 | ||
820 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 822 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
823 | GFP_KERNEL); | ||
821 | if (length) | 824 | if (length) |
822 | goto out; | 825 | goto out; |
823 | 826 | ||
824 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 827 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
828 | GFP_KERNEL); | ||
825 | if (length) | 829 | if (length) |
826 | goto out; | 830 | goto out; |
827 | 831 | ||
@@ -878,11 +882,13 @@ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size) | |||
878 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 882 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
879 | goto out; | 883 | goto out; |
880 | 884 | ||
881 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 885 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
886 | GFP_KERNEL); | ||
882 | if (length) | 887 | if (length) |
883 | goto out; | 888 | goto out; |
884 | 889 | ||
885 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 890 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
891 | GFP_KERNEL); | ||
886 | if (length) | 892 | if (length) |
887 | goto out; | 893 | goto out; |
888 | 894 | ||
@@ -934,7 +940,7 @@ static ssize_t sel_write_user(struct file *file, char *buf, size_t size) | |||
934 | if (sscanf(buf, "%s %s", con, user) != 2) | 940 | if (sscanf(buf, "%s %s", con, user) != 2) |
935 | goto out; | 941 | goto out; |
936 | 942 | ||
937 | length = security_context_to_sid(con, strlen(con) + 1, &sid); | 943 | length = security_context_to_sid(con, strlen(con) + 1, &sid, GFP_KERNEL); |
938 | if (length) | 944 | if (length) |
939 | goto out; | 945 | goto out; |
940 | 946 | ||
@@ -994,11 +1000,13 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size) | |||
994 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 1000 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
995 | goto out; | 1001 | goto out; |
996 | 1002 | ||
997 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 1003 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
1004 | GFP_KERNEL); | ||
998 | if (length) | 1005 | if (length) |
999 | goto out; | 1006 | goto out; |
1000 | 1007 | ||
1001 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 1008 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
1009 | GFP_KERNEL); | ||
1002 | if (length) | 1010 | if (length) |
1003 | goto out; | 1011 | goto out; |
1004 | 1012 | ||
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index c0f498842129..9c5cdc2caaef 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
@@ -3338,10 +3338,10 @@ static int filename_write_helper(void *key, void *data, void *ptr) | |||
3338 | if (rc) | 3338 | if (rc) |
3339 | return rc; | 3339 | return rc; |
3340 | 3340 | ||
3341 | buf[0] = ft->stype; | 3341 | buf[0] = cpu_to_le32(ft->stype); |
3342 | buf[1] = ft->ttype; | 3342 | buf[1] = cpu_to_le32(ft->ttype); |
3343 | buf[2] = ft->tclass; | 3343 | buf[2] = cpu_to_le32(ft->tclass); |
3344 | buf[3] = otype->otype; | 3344 | buf[3] = cpu_to_le32(otype->otype); |
3345 | 3345 | ||
3346 | rc = put_entry(buf, sizeof(u32), 4, fp); | 3346 | rc = put_entry(buf, sizeof(u32), 4, fp); |
3347 | if (rc) | 3347 | if (rc) |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 5d0144ee8ed6..4bca49414a40 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -1289,16 +1289,18 @@ out: | |||
1289 | * @scontext: security context | 1289 | * @scontext: security context |
1290 | * @scontext_len: length in bytes | 1290 | * @scontext_len: length in bytes |
1291 | * @sid: security identifier, SID | 1291 | * @sid: security identifier, SID |
1292 | * @gfp: context for the allocation | ||
1292 | * | 1293 | * |
1293 | * Obtains a SID associated with the security context that | 1294 | * Obtains a SID associated with the security context that |
1294 | * has the string representation specified by @scontext. | 1295 | * has the string representation specified by @scontext. |
1295 | * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient | 1296 | * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient |
1296 | * memory is available, or 0 on success. | 1297 | * memory is available, or 0 on success. |
1297 | */ | 1298 | */ |
1298 | int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid) | 1299 | int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid, |
1300 | gfp_t gfp) | ||
1299 | { | 1301 | { |
1300 | return security_context_to_sid_core(scontext, scontext_len, | 1302 | return security_context_to_sid_core(scontext, scontext_len, |
1301 | sid, SECSID_NULL, GFP_KERNEL, 0); | 1303 | sid, SECSID_NULL, gfp, 0); |
1302 | } | 1304 | } |
1303 | 1305 | ||
1304 | /** | 1306 | /** |
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c index 0462cb3ff0a7..98b042630a9e 100644 --- a/security/selinux/xfrm.c +++ b/security/selinux/xfrm.c | |||
@@ -78,7 +78,8 @@ static inline int selinux_authorizable_xfrm(struct xfrm_state *x) | |||
78 | * xfrm_user_sec_ctx context. | 78 | * xfrm_user_sec_ctx context. |
79 | */ | 79 | */ |
80 | static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, | 80 | static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, |
81 | struct xfrm_user_sec_ctx *uctx) | 81 | struct xfrm_user_sec_ctx *uctx, |
82 | gfp_t gfp) | ||
82 | { | 83 | { |
83 | int rc; | 84 | int rc; |
84 | const struct task_security_struct *tsec = current_security(); | 85 | const struct task_security_struct *tsec = current_security(); |
@@ -94,7 +95,7 @@ static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, | |||
94 | if (str_len >= PAGE_SIZE) | 95 | if (str_len >= PAGE_SIZE) |
95 | return -ENOMEM; | 96 | return -ENOMEM; |
96 | 97 | ||
97 | ctx = kmalloc(sizeof(*ctx) + str_len + 1, GFP_KERNEL); | 98 | ctx = kmalloc(sizeof(*ctx) + str_len + 1, gfp); |
98 | if (!ctx) | 99 | if (!ctx) |
99 | return -ENOMEM; | 100 | return -ENOMEM; |
100 | 101 | ||
@@ -103,7 +104,7 @@ static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, | |||
103 | ctx->ctx_len = str_len; | 104 | ctx->ctx_len = str_len; |
104 | memcpy(ctx->ctx_str, &uctx[1], str_len); | 105 | memcpy(ctx->ctx_str, &uctx[1], str_len); |
105 | ctx->ctx_str[str_len] = '\0'; | 106 | ctx->ctx_str[str_len] = '\0'; |
106 | rc = security_context_to_sid(ctx->ctx_str, str_len, &ctx->ctx_sid); | 107 | rc = security_context_to_sid(ctx->ctx_str, str_len, &ctx->ctx_sid, gfp); |
107 | if (rc) | 108 | if (rc) |
108 | goto err; | 109 | goto err; |
109 | 110 | ||
@@ -282,9 +283,10 @@ int selinux_xfrm_skb_sid(struct sk_buff *skb, u32 *sid) | |||
282 | * LSM hook implementation that allocs and transfers uctx spec to xfrm_policy. | 283 | * LSM hook implementation that allocs and transfers uctx spec to xfrm_policy. |
283 | */ | 284 | */ |
284 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, | 285 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
285 | struct xfrm_user_sec_ctx *uctx) | 286 | struct xfrm_user_sec_ctx *uctx, |
287 | gfp_t gfp) | ||
286 | { | 288 | { |
287 | return selinux_xfrm_alloc_user(ctxp, uctx); | 289 | return selinux_xfrm_alloc_user(ctxp, uctx, gfp); |
288 | } | 290 | } |
289 | 291 | ||
290 | /* | 292 | /* |
@@ -332,7 +334,7 @@ int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) | |||
332 | int selinux_xfrm_state_alloc(struct xfrm_state *x, | 334 | int selinux_xfrm_state_alloc(struct xfrm_state *x, |
333 | struct xfrm_user_sec_ctx *uctx) | 335 | struct xfrm_user_sec_ctx *uctx) |
334 | { | 336 | { |
335 | return selinux_xfrm_alloc_user(&x->security, uctx); | 337 | return selinux_xfrm_alloc_user(&x->security, uctx, GFP_KERNEL); |
336 | } | 338 | } |
337 | 339 | ||
338 | /* | 340 | /* |
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 7a20897d33db..7403f348ed14 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -133,7 +133,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
133 | kfree(data); | 133 | kfree(data); |
134 | } | 134 | } |
135 | snd_card_unref(compr->card); | 135 | snd_card_unref(compr->card); |
136 | return 0; | 136 | return ret; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int snd_compr_free(struct inode *inode, struct file *f) | 139 | static int snd_compr_free(struct inode *inode, struct file *f) |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index df3652ad15ef..8ed0bcc01386 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -1026,6 +1026,9 @@ static void ad1884_fixup_thinkpad(struct hda_codec *codec, | |||
1026 | spec->gen.keep_eapd_on = 1; | 1026 | spec->gen.keep_eapd_on = 1; |
1027 | spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; | 1027 | spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; |
1028 | spec->eapd_nid = 0x12; | 1028 | spec->eapd_nid = 0x12; |
1029 | /* Analog PC Beeper - allow firmware/ACPI beeps */ | ||
1030 | spec->beep_amp = HDA_COMPOSE_AMP_VAL(0x20, 3, 3, HDA_INPUT); | ||
1031 | spec->gen.beep_nid = 0; /* no digital beep */ | ||
1029 | } | 1032 | } |
1030 | } | 1033 | } |
1031 | 1034 | ||
@@ -1092,6 +1095,7 @@ static int patch_ad1884(struct hda_codec *codec) | |||
1092 | spec = codec->spec; | 1095 | spec = codec->spec; |
1093 | 1096 | ||
1094 | spec->gen.mixer_nid = 0x20; | 1097 | spec->gen.mixer_nid = 0x20; |
1098 | spec->gen.mixer_merge_nid = 0x21; | ||
1095 | spec->gen.beep_nid = 0x10; | 1099 | spec->gen.beep_nid = 0x10; |
1096 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | 1100 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); |
1097 | 1101 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6eb903cc6237..8d0a84436674 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -3616,6 +3616,19 @@ static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, | |||
3616 | } | 3616 | } |
3617 | } | 3617 | } |
3618 | 3618 | ||
3619 | static void alc_no_shutup(struct hda_codec *codec) | ||
3620 | { | ||
3621 | } | ||
3622 | |||
3623 | static void alc_fixup_no_shutup(struct hda_codec *codec, | ||
3624 | const struct hda_fixup *fix, int action) | ||
3625 | { | ||
3626 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
3627 | struct alc_spec *spec = codec->spec; | ||
3628 | spec->shutup = alc_no_shutup; | ||
3629 | } | ||
3630 | } | ||
3631 | |||
3619 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, | 3632 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, |
3620 | const struct hda_fixup *fix, int action) | 3633 | const struct hda_fixup *fix, int action) |
3621 | { | 3634 | { |
@@ -3844,6 +3857,7 @@ enum { | |||
3844 | ALC269_FIXUP_HP_GPIO_LED, | 3857 | ALC269_FIXUP_HP_GPIO_LED, |
3845 | ALC269_FIXUP_INV_DMIC, | 3858 | ALC269_FIXUP_INV_DMIC, |
3846 | ALC269_FIXUP_LENOVO_DOCK, | 3859 | ALC269_FIXUP_LENOVO_DOCK, |
3860 | ALC269_FIXUP_NO_SHUTUP, | ||
3847 | ALC286_FIXUP_SONY_MIC_NO_PRESENCE, | 3861 | ALC286_FIXUP_SONY_MIC_NO_PRESENCE, |
3848 | ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, | 3862 | ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, |
3849 | ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | 3863 | ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
@@ -4020,6 +4034,10 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4020 | .type = HDA_FIXUP_FUNC, | 4034 | .type = HDA_FIXUP_FUNC, |
4021 | .v.func = alc_fixup_inv_dmic_0x12, | 4035 | .v.func = alc_fixup_inv_dmic_0x12, |
4022 | }, | 4036 | }, |
4037 | [ALC269_FIXUP_NO_SHUTUP] = { | ||
4038 | .type = HDA_FIXUP_FUNC, | ||
4039 | .v.func = alc_fixup_no_shutup, | ||
4040 | }, | ||
4023 | [ALC269_FIXUP_LENOVO_DOCK] = { | 4041 | [ALC269_FIXUP_LENOVO_DOCK] = { |
4024 | .type = HDA_FIXUP_PINS, | 4042 | .type = HDA_FIXUP_PINS, |
4025 | .v.pins = (const struct hda_pintbl[]) { | 4043 | .v.pins = (const struct hda_pintbl[]) { |
@@ -4253,6 +4271,7 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4253 | }; | 4271 | }; |
4254 | 4272 | ||
4255 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 4273 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4274 | SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC), | ||
4256 | SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), | 4275 | SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), |
4257 | SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), | 4276 | SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), |
4258 | SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700), | 4277 | SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700), |
@@ -4319,6 +4338,54 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4319 | SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4338 | SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4320 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4339 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4321 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), | 4340 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), |
4341 | /* ALC282 */ | ||
4342 | SND_PCI_QUIRK(0x103c, 0x220f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4343 | SND_PCI_QUIRK(0x103c, 0x2213, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4344 | SND_PCI_QUIRK(0x103c, 0x2266, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4345 | SND_PCI_QUIRK(0x103c, 0x2267, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4346 | SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4347 | SND_PCI_QUIRK(0x103c, 0x2269, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4348 | SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4349 | SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4350 | SND_PCI_QUIRK(0x103c, 0x227a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4351 | SND_PCI_QUIRK(0x103c, 0x227b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4352 | SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4353 | SND_PCI_QUIRK(0x103c, 0x22a0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4354 | SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4355 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4356 | SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4357 | SND_PCI_QUIRK(0x103c, 0x22c0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4358 | SND_PCI_QUIRK(0x103c, 0x22c1, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4359 | SND_PCI_QUIRK(0x103c, 0x22c2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4360 | SND_PCI_QUIRK(0x103c, 0x22cd, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4361 | SND_PCI_QUIRK(0x103c, 0x22ce, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4362 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4363 | SND_PCI_QUIRK(0x103c, 0x22d0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4364 | /* ALC290 */ | ||
4365 | SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4366 | SND_PCI_QUIRK(0x103c, 0x2261, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4367 | SND_PCI_QUIRK(0x103c, 0x2262, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4368 | SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4369 | SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4370 | SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4371 | SND_PCI_QUIRK(0x103c, 0x227d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4372 | SND_PCI_QUIRK(0x103c, 0x227e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4373 | SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4374 | SND_PCI_QUIRK(0x103c, 0x2280, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4375 | SND_PCI_QUIRK(0x103c, 0x2281, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4376 | SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4377 | SND_PCI_QUIRK(0x103c, 0x2289, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4378 | SND_PCI_QUIRK(0x103c, 0x228a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4379 | SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4380 | SND_PCI_QUIRK(0x103c, 0x228c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4381 | SND_PCI_QUIRK(0x103c, 0x228d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4382 | SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4383 | SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4384 | SND_PCI_QUIRK(0x103c, 0x22c6, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4385 | SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4386 | SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4387 | SND_PCI_QUIRK(0x103c, 0x22c3, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4388 | SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4322 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), | 4389 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), |
4323 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), | 4390 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
4324 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4391 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
@@ -4356,6 +4423,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4356 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4423 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4357 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4424 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4358 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4425 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4426 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), | ||
4359 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4427 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4360 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), | 4428 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), |
4361 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4429 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
@@ -5115,7 +5183,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
5115 | SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5183 | SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5116 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5184 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5117 | SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_AUTO_MUTE), | 5185 | SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_AUTO_MUTE), |
5118 | SND_PCI_QUIRK(0x1028, 0x064e, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5186 | SND_PCI_QUIRK(0x1028, 0x064e, "Dell", ALC668_FIXUP_AUTO_MUTE), |
5119 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), | 5187 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
5120 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A_CHMAP), | 5188 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A_CHMAP), |
5121 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_CHMAP), | 5189 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_CHMAP), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a2f11bf8155c..3bc29c9b2529 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -98,6 +98,7 @@ enum { | |||
98 | STAC_92HD83XXX_HP_LED, | 98 | STAC_92HD83XXX_HP_LED, |
99 | STAC_92HD83XXX_HP_INV_LED, | 99 | STAC_92HD83XXX_HP_INV_LED, |
100 | STAC_92HD83XXX_HP_MIC_LED, | 100 | STAC_92HD83XXX_HP_MIC_LED, |
101 | STAC_HP_LED_GPIO10, | ||
101 | STAC_92HD83XXX_HEADSET_JACK, | 102 | STAC_92HD83XXX_HEADSET_JACK, |
102 | STAC_92HD83XXX_HP, | 103 | STAC_92HD83XXX_HP, |
103 | STAC_HP_ENVY_BASS, | 104 | STAC_HP_ENVY_BASS, |
@@ -2130,6 +2131,17 @@ static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec, | |||
2130 | } | 2131 | } |
2131 | } | 2132 | } |
2132 | 2133 | ||
2134 | static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec, | ||
2135 | const struct hda_fixup *fix, int action) | ||
2136 | { | ||
2137 | struct sigmatel_spec *spec = codec->spec; | ||
2138 | |||
2139 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
2140 | spec->gpio_led = 0x10; /* GPIO4 */ | ||
2141 | spec->default_polarity = 0; | ||
2142 | } | ||
2143 | } | ||
2144 | |||
2133 | static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, | 2145 | static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, |
2134 | const struct hda_fixup *fix, int action) | 2146 | const struct hda_fixup *fix, int action) |
2135 | { | 2147 | { |
@@ -2624,6 +2636,12 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = { | |||
2624 | .chained = true, | 2636 | .chained = true, |
2625 | .chain_id = STAC_92HD83XXX_HP, | 2637 | .chain_id = STAC_92HD83XXX_HP, |
2626 | }, | 2638 | }, |
2639 | [STAC_HP_LED_GPIO10] = { | ||
2640 | .type = HDA_FIXUP_FUNC, | ||
2641 | .v.func = stac92hd83xxx_fixup_hp_led_gpio10, | ||
2642 | .chained = true, | ||
2643 | .chain_id = STAC_92HD83XXX_HP, | ||
2644 | }, | ||
2627 | [STAC_92HD83XXX_HEADSET_JACK] = { | 2645 | [STAC_92HD83XXX_HEADSET_JACK] = { |
2628 | .type = HDA_FIXUP_FUNC, | 2646 | .type = HDA_FIXUP_FUNC, |
2629 | .v.func = stac92hd83xxx_fixup_headset_jack, | 2647 | .v.func = stac92hd83xxx_fixup_headset_jack, |
@@ -2702,6 +2720,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = { | |||
2702 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 2720 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
2703 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888, | 2721 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888, |
2704 | "HP Envy Spectre", STAC_HP_ENVY_BASS), | 2722 | "HP Envy Spectre", STAC_HP_ENVY_BASS), |
2723 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899, | ||
2724 | "HP Folio 13", STAC_HP_LED_GPIO10), | ||
2705 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, | 2725 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, |
2706 | "HP Folio", STAC_HP_BNB13_EQ), | 2726 | "HP Folio", STAC_HP_BNB13_EQ), |
2707 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8, | 2727 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8, |
diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c index ed6f199f8a38..4cf3200e988b 100644 --- a/sound/pci/oxygen/xonar_dg.c +++ b/sound/pci/oxygen/xonar_dg.c | |||
@@ -238,11 +238,21 @@ void set_cs4245_adc_params(struct oxygen *chip, | |||
238 | cs4245_write_spi(chip, CS4245_MCLK_FREQ); | 238 | cs4245_write_spi(chip, CS4245_MCLK_FREQ); |
239 | } | 239 | } |
240 | 240 | ||
241 | static inline unsigned int shift_bits(unsigned int value, | ||
242 | unsigned int shift_from, | ||
243 | unsigned int shift_to, | ||
244 | unsigned int mask) | ||
245 | { | ||
246 | if (shift_from < shift_to) | ||
247 | return (value << (shift_to - shift_from)) & mask; | ||
248 | else | ||
249 | return (value >> (shift_from - shift_to)) & mask; | ||
250 | } | ||
251 | |||
241 | unsigned int adjust_dg_dac_routing(struct oxygen *chip, | 252 | unsigned int adjust_dg_dac_routing(struct oxygen *chip, |
242 | unsigned int play_routing) | 253 | unsigned int play_routing) |
243 | { | 254 | { |
244 | struct dg *data = chip->model_data; | 255 | struct dg *data = chip->model_data; |
245 | unsigned int routing = 0; | ||
246 | 256 | ||
247 | switch (data->output_sel) { | 257 | switch (data->output_sel) { |
248 | case PLAYBACK_DST_HP: | 258 | case PLAYBACK_DST_HP: |
@@ -252,15 +262,23 @@ unsigned int adjust_dg_dac_routing(struct oxygen *chip, | |||
252 | OXYGEN_PLAY_MUTE67, OXYGEN_PLAY_MUTE_MASK); | 262 | OXYGEN_PLAY_MUTE67, OXYGEN_PLAY_MUTE_MASK); |
253 | break; | 263 | break; |
254 | case PLAYBACK_DST_MULTICH: | 264 | case PLAYBACK_DST_MULTICH: |
255 | routing = (0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) | | ||
256 | (2 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | | ||
257 | (1 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | | ||
258 | (0 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT); | ||
259 | oxygen_write8_masked(chip, OXYGEN_PLAY_ROUTING, | 265 | oxygen_write8_masked(chip, OXYGEN_PLAY_ROUTING, |
260 | OXYGEN_PLAY_MUTE01, OXYGEN_PLAY_MUTE_MASK); | 266 | OXYGEN_PLAY_MUTE01, OXYGEN_PLAY_MUTE_MASK); |
261 | break; | 267 | break; |
262 | } | 268 | } |
263 | return routing; | 269 | return (play_routing & OXYGEN_PLAY_DAC0_SOURCE_MASK) | |
270 | shift_bits(play_routing, | ||
271 | OXYGEN_PLAY_DAC2_SOURCE_SHIFT, | ||
272 | OXYGEN_PLAY_DAC1_SOURCE_SHIFT, | ||
273 | OXYGEN_PLAY_DAC1_SOURCE_MASK) | | ||
274 | shift_bits(play_routing, | ||
275 | OXYGEN_PLAY_DAC1_SOURCE_SHIFT, | ||
276 | OXYGEN_PLAY_DAC2_SOURCE_SHIFT, | ||
277 | OXYGEN_PLAY_DAC2_SOURCE_MASK) | | ||
278 | shift_bits(play_routing, | ||
279 | OXYGEN_PLAY_DAC0_SOURCE_SHIFT, | ||
280 | OXYGEN_PLAY_DAC3_SOURCE_SHIFT, | ||
281 | OXYGEN_PLAY_DAC3_SOURCE_MASK); | ||
264 | } | 282 | } |
265 | 283 | ||
266 | void dump_cs4245_registers(struct oxygen *chip, | 284 | void dump_cs4245_registers(struct oxygen *chip, |
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 75d0ad5d2dcb..647a72cda005 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c | |||
@@ -1328,6 +1328,9 @@ static int pm860x_probe(struct snd_soc_codec *codec) | |||
1328 | pm860x->codec = codec; | 1328 | pm860x->codec = codec; |
1329 | 1329 | ||
1330 | codec->control_data = pm860x->regmap; | 1330 | codec->control_data = pm860x->regmap; |
1331 | ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); | ||
1332 | if (ret) | ||
1333 | return ret; | ||
1331 | 1334 | ||
1332 | for (i = 0; i < 4; i++) { | 1335 | for (i = 0; i < 4; i++) { |
1333 | ret = request_threaded_irq(pm860x->irq[i], NULL, | 1336 | ret = request_threaded_irq(pm860x->irq[i], NULL, |
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 7257a8885f42..34d965a4a040 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c | |||
@@ -57,8 +57,8 @@ static const u16 ad1980_reg[] = { | |||
57 | static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line", | 57 | static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line", |
58 | "Stereo Mix", "Mono Mix", "Phone"}; | 58 | "Stereo Mix", "Mono Mix", "Phone"}; |
59 | 59 | ||
60 | static const struct soc_enum ad1980_cap_src = | 60 | static SOC_ENUM_DOUBLE_DECL(ad1980_cap_src, |
61 | SOC_ENUM_DOUBLE(AC97_REC_SEL, 8, 0, 7, ad1980_rec_sel); | 61 | AC97_REC_SEL, 8, 0, ad1980_rec_sel); |
62 | 62 | ||
63 | static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = { | 63 | static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = { |
64 | SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1), | 64 | SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1), |
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c index f295b6569910..f4d965ebc29e 100644 --- a/sound/soc/codecs/da732x.c +++ b/sound/soc/codecs/da732x.c | |||
@@ -1268,11 +1268,23 @@ static struct snd_soc_dai_driver da732x_dai[] = { | |||
1268 | }, | 1268 | }, |
1269 | }; | 1269 | }; |
1270 | 1270 | ||
1271 | static bool da732x_volatile(struct device *dev, unsigned int reg) | ||
1272 | { | ||
1273 | switch (reg) { | ||
1274 | case DA732X_REG_HPL_DAC_OFF_CNTL: | ||
1275 | case DA732X_REG_HPR_DAC_OFF_CNTL: | ||
1276 | return true; | ||
1277 | default: | ||
1278 | return false; | ||
1279 | } | ||
1280 | } | ||
1281 | |||
1271 | static const struct regmap_config da732x_regmap = { | 1282 | static const struct regmap_config da732x_regmap = { |
1272 | .reg_bits = 8, | 1283 | .reg_bits = 8, |
1273 | .val_bits = 8, | 1284 | .val_bits = 8, |
1274 | 1285 | ||
1275 | .max_register = DA732X_MAX_REG, | 1286 | .max_register = DA732X_MAX_REG, |
1287 | .volatile_reg = da732x_volatile, | ||
1276 | .reg_defaults = da732x_reg_cache, | 1288 | .reg_defaults = da732x_reg_cache, |
1277 | .num_reg_defaults = ARRAY_SIZE(da732x_reg_cache), | 1289 | .num_reg_defaults = ARRAY_SIZE(da732x_reg_cache), |
1278 | .cache_type = REGCACHE_RBTREE, | 1290 | .cache_type = REGCACHE_RBTREE, |
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c index 5839048ec467..cb736ddc446d 100644 --- a/sound/soc/codecs/isabelle.c +++ b/sound/soc/codecs/isabelle.c | |||
@@ -140,13 +140,17 @@ static const char *isabelle_rx1_texts[] = {"VRX1", "ARX1"}; | |||
140 | static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"}; | 140 | static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"}; |
141 | 141 | ||
142 | static const struct soc_enum isabelle_rx1_enum[] = { | 142 | static const struct soc_enum isabelle_rx1_enum[] = { |
143 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3, 1, isabelle_rx1_texts), | 143 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3, |
144 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5, 1, isabelle_rx1_texts), | 144 | ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts), |
145 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5, | ||
146 | ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts), | ||
145 | }; | 147 | }; |
146 | 148 | ||
147 | static const struct soc_enum isabelle_rx2_enum[] = { | 149 | static const struct soc_enum isabelle_rx2_enum[] = { |
148 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2, 1, isabelle_rx2_texts), | 150 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2, |
149 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4, 1, isabelle_rx2_texts), | 151 | ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts), |
152 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4, | ||
153 | ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts), | ||
150 | }; | 154 | }; |
151 | 155 | ||
152 | /* Headset DAC playback switches */ | 156 | /* Headset DAC playback switches */ |
@@ -161,13 +165,17 @@ static const char *isabelle_atx_texts[] = {"AMIC1", "DMIC"}; | |||
161 | static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"}; | 165 | static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"}; |
162 | 166 | ||
163 | static const struct soc_enum isabelle_atx_enum[] = { | 167 | static const struct soc_enum isabelle_atx_enum[] = { |
164 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7, 1, isabelle_atx_texts), | 168 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7, |
165 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_atx_texts), | 169 | ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts), |
170 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, | ||
171 | ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts), | ||
166 | }; | 172 | }; |
167 | 173 | ||
168 | static const struct soc_enum isabelle_vtx_enum[] = { | 174 | static const struct soc_enum isabelle_vtx_enum[] = { |
169 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6, 1, isabelle_vtx_texts), | 175 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6, |
170 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_vtx_texts), | 176 | ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts), |
177 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, | ||
178 | ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts), | ||
171 | }; | 179 | }; |
172 | 180 | ||
173 | static const struct snd_kcontrol_new atx_mux_controls = | 181 | static const struct snd_kcontrol_new atx_mux_controls = |
@@ -183,17 +191,13 @@ static const char *isabelle_amic1_texts[] = { | |||
183 | /* Left analog microphone selection */ | 191 | /* Left analog microphone selection */ |
184 | static const char *isabelle_amic2_texts[] = {"Sub Mic", "Aux/FM Right"}; | 192 | static const char *isabelle_amic2_texts[] = {"Sub Mic", "Aux/FM Right"}; |
185 | 193 | ||
186 | static const struct soc_enum isabelle_amic1_enum[] = { | 194 | static SOC_ENUM_SINGLE_DECL(isabelle_amic1_enum, |
187 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 5, | 195 | ISABELLE_AMIC_CFG_REG, 5, |
188 | ARRAY_SIZE(isabelle_amic1_texts), | 196 | isabelle_amic1_texts); |
189 | isabelle_amic1_texts), | ||
190 | }; | ||
191 | 197 | ||
192 | static const struct soc_enum isabelle_amic2_enum[] = { | 198 | static SOC_ENUM_SINGLE_DECL(isabelle_amic2_enum, |
193 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 4, | 199 | ISABELLE_AMIC_CFG_REG, 4, |
194 | ARRAY_SIZE(isabelle_amic2_texts), | 200 | isabelle_amic2_texts); |
195 | isabelle_amic2_texts), | ||
196 | }; | ||
197 | 201 | ||
198 | static const struct snd_kcontrol_new amic1_control = | 202 | static const struct snd_kcontrol_new amic1_control = |
199 | SOC_DAPM_ENUM("Route", isabelle_amic1_enum); | 203 | SOC_DAPM_ENUM("Route", isabelle_amic1_enum); |
@@ -206,16 +210,20 @@ static const char *isabelle_st_audio_texts[] = {"ATX1", "ATX2"}; | |||
206 | static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"}; | 210 | static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"}; |
207 | 211 | ||
208 | static const struct soc_enum isabelle_st_audio_enum[] = { | 212 | static const struct soc_enum isabelle_st_audio_enum[] = { |
209 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7, 1, | 213 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7, |
214 | ARRAY_SIZE(isabelle_st_audio_texts), | ||
210 | isabelle_st_audio_texts), | 215 | isabelle_st_audio_texts), |
211 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7, 1, | 216 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7, |
217 | ARRAY_SIZE(isabelle_st_audio_texts), | ||
212 | isabelle_st_audio_texts), | 218 | isabelle_st_audio_texts), |
213 | }; | 219 | }; |
214 | 220 | ||
215 | static const struct soc_enum isabelle_st_voice_enum[] = { | 221 | static const struct soc_enum isabelle_st_voice_enum[] = { |
216 | SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7, 1, | 222 | SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7, |
223 | ARRAY_SIZE(isabelle_st_voice_texts), | ||
217 | isabelle_st_voice_texts), | 224 | isabelle_st_voice_texts), |
218 | SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7, 1, | 225 | SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7, |
226 | ARRAY_SIZE(isabelle_st_voice_texts), | ||
219 | isabelle_st_voice_texts), | 227 | isabelle_st_voice_texts), |
220 | }; | 228 | }; |
221 | 229 | ||
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c index 52e7cb08434b..fa2b8e07f420 100644 --- a/sound/soc/codecs/si476x.c +++ b/sound/soc/codecs/si476x.c | |||
@@ -210,7 +210,7 @@ out: | |||
210 | static int si476x_codec_probe(struct snd_soc_codec *codec) | 210 | static int si476x_codec_probe(struct snd_soc_codec *codec) |
211 | { | 211 | { |
212 | codec->control_data = dev_get_regmap(codec->dev->parent, NULL); | 212 | codec->control_data = dev_get_regmap(codec->dev->parent, NULL); |
213 | return 0; | 213 | return snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); |
214 | } | 214 | } |
215 | 215 | ||
216 | static struct snd_soc_dai_ops si476x_dai_ops = { | 216 | static struct snd_soc_dai_ops si476x_dai_ops = { |
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 06edb396e733..2735361a4c3c 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c | |||
@@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter_drc_release_tlv[] = { | |||
187 | 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0), | 187 | 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0), |
188 | }; | 188 | }; |
189 | 189 | ||
190 | static const struct soc_enum sta32x_drc_ac_enum = | 190 | static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum, |
191 | SOC_ENUM_SINGLE(STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, | 191 | STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, |
192 | 2, sta32x_drc_ac); | 192 | sta32x_drc_ac); |
193 | static const struct soc_enum sta32x_auto_eq_enum = | 193 | static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum, |
194 | SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, | 194 | STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, |
195 | 3, sta32x_auto_eq_mode); | 195 | sta32x_auto_eq_mode); |
196 | static const struct soc_enum sta32x_auto_gc_enum = | 196 | static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum, |
197 | SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, | 197 | STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, |
198 | 4, sta32x_auto_gc_mode); | 198 | sta32x_auto_gc_mode); |
199 | static const struct soc_enum sta32x_auto_xo_enum = | 199 | static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum, |
200 | SOC_ENUM_SINGLE(STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, | 200 | STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, |
201 | 16, sta32x_auto_xo_mode); | 201 | sta32x_auto_xo_mode); |
202 | static const struct soc_enum sta32x_preset_eq_enum = | 202 | static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum, |
203 | SOC_ENUM_SINGLE(STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, | 203 | STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, |
204 | 32, sta32x_preset_eq_mode); | 204 | sta32x_preset_eq_mode); |
205 | static const struct soc_enum sta32x_limiter_ch1_enum = | 205 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum, |
206 | SOC_ENUM_SINGLE(STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, | 206 | STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, |
207 | 3, sta32x_limiter_select); | 207 | sta32x_limiter_select); |
208 | static const struct soc_enum sta32x_limiter_ch2_enum = | 208 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum, |
209 | SOC_ENUM_SINGLE(STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, | 209 | STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, |
210 | 3, sta32x_limiter_select); | 210 | sta32x_limiter_select); |
211 | static const struct soc_enum sta32x_limiter_ch3_enum = | 211 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum, |
212 | SOC_ENUM_SINGLE(STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, | 212 | STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, |
213 | 3, sta32x_limiter_select); | 213 | sta32x_limiter_select); |
214 | static const struct soc_enum sta32x_limiter1_attack_rate_enum = | 214 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum, |
215 | SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxA_SHIFT, | 215 | STA32X_L1AR, STA32X_LxA_SHIFT, |
216 | 16, sta32x_limiter_attack_rate); | 216 | sta32x_limiter_attack_rate); |
217 | static const struct soc_enum sta32x_limiter2_attack_rate_enum = | 217 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum, |
218 | SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxA_SHIFT, | 218 | STA32X_L2AR, STA32X_LxA_SHIFT, |
219 | 16, sta32x_limiter_attack_rate); | 219 | sta32x_limiter_attack_rate); |
220 | static const struct soc_enum sta32x_limiter1_release_rate_enum = | 220 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum, |
221 | SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxR_SHIFT, | 221 | STA32X_L1AR, STA32X_LxR_SHIFT, |
222 | 16, sta32x_limiter_release_rate); | 222 | sta32x_limiter_release_rate); |
223 | static const struct soc_enum sta32x_limiter2_release_rate_enum = | 223 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum, |
224 | SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxR_SHIFT, | 224 | STA32X_L2AR, STA32X_LxR_SHIFT, |
225 | 16, sta32x_limiter_release_rate); | 225 | sta32x_limiter_release_rate); |
226 | 226 | ||
227 | /* byte array controls for setting biquad, mixer, scaling coefficients; | 227 | /* byte array controls for setting biquad, mixer, scaling coefficients; |
228 | * for biquads all five coefficients need to be set in one go, | 228 | * for biquads all five coefficients need to be set in one go, |
@@ -331,7 +331,7 @@ static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) | |||
331 | 331 | ||
332 | static int sta32x_cache_sync(struct snd_soc_codec *codec) | 332 | static int sta32x_cache_sync(struct snd_soc_codec *codec) |
333 | { | 333 | { |
334 | struct sta32x_priv *sta32x = codec->control_data; | 334 | struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); |
335 | unsigned int mute; | 335 | unsigned int mute; |
336 | int rc; | 336 | int rc; |
337 | 337 | ||
@@ -434,7 +434,7 @@ SOC_SINGLE_TLV("Treble Tone Control", STA32X_TONE, STA32X_TONE_TTC_SHIFT, 15, 0, | |||
434 | SOC_ENUM("Limiter1 Attack Rate (dB/ms)", sta32x_limiter1_attack_rate_enum), | 434 | SOC_ENUM("Limiter1 Attack Rate (dB/ms)", sta32x_limiter1_attack_rate_enum), |
435 | SOC_ENUM("Limiter2 Attack Rate (dB/ms)", sta32x_limiter2_attack_rate_enum), | 435 | SOC_ENUM("Limiter2 Attack Rate (dB/ms)", sta32x_limiter2_attack_rate_enum), |
436 | SOC_ENUM("Limiter1 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), | 436 | SOC_ENUM("Limiter1 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), |
437 | SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), | 437 | SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter2_release_rate_enum), |
438 | 438 | ||
439 | /* depending on mode, the attack/release thresholds have | 439 | /* depending on mode, the attack/release thresholds have |
440 | * two different enum definitions; provide both | 440 | * two different enum definitions; provide both |
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 48dc7d2fee36..6d684d934f4d 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -117,19 +117,23 @@ static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, | |||
117 | static const char *wm8400_digital_sidetone[] = | 117 | static const char *wm8400_digital_sidetone[] = |
118 | {"None", "Left ADC", "Right ADC", "Reserved"}; | 118 | {"None", "Left ADC", "Right ADC", "Reserved"}; |
119 | 119 | ||
120 | static const struct soc_enum wm8400_left_digital_sidetone_enum = | 120 | static SOC_ENUM_SINGLE_DECL(wm8400_left_digital_sidetone_enum, |
121 | SOC_ENUM_SINGLE(WM8400_DIGITAL_SIDE_TONE, | 121 | WM8400_DIGITAL_SIDE_TONE, |
122 | WM8400_ADC_TO_DACL_SHIFT, 2, wm8400_digital_sidetone); | 122 | WM8400_ADC_TO_DACL_SHIFT, |
123 | wm8400_digital_sidetone); | ||
123 | 124 | ||
124 | static const struct soc_enum wm8400_right_digital_sidetone_enum = | 125 | static SOC_ENUM_SINGLE_DECL(wm8400_right_digital_sidetone_enum, |
125 | SOC_ENUM_SINGLE(WM8400_DIGITAL_SIDE_TONE, | 126 | WM8400_DIGITAL_SIDE_TONE, |
126 | WM8400_ADC_TO_DACR_SHIFT, 2, wm8400_digital_sidetone); | 127 | WM8400_ADC_TO_DACR_SHIFT, |
128 | wm8400_digital_sidetone); | ||
127 | 129 | ||
128 | static const char *wm8400_adcmode[] = | 130 | static const char *wm8400_adcmode[] = |
129 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; | 131 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; |
130 | 132 | ||
131 | static const struct soc_enum wm8400_right_adcmode_enum = | 133 | static SOC_ENUM_SINGLE_DECL(wm8400_right_adcmode_enum, |
132 | SOC_ENUM_SINGLE(WM8400_ADC_CTRL, WM8400_ADC_HPF_CUT_SHIFT, 3, wm8400_adcmode); | 134 | WM8400_ADC_CTRL, |
135 | WM8400_ADC_HPF_CUT_SHIFT, | ||
136 | wm8400_adcmode); | ||
133 | 137 | ||
134 | static const struct snd_kcontrol_new wm8400_snd_controls[] = { | 138 | static const struct snd_kcontrol_new wm8400_snd_controls[] = { |
135 | /* INMIXL */ | 139 | /* INMIXL */ |
@@ -422,9 +426,10 @@ SOC_DAPM_SINGLE("RINPGA34 Switch", WM8400_INPUT_MIXER3, WM8400_L34MNB_SHIFT, | |||
422 | static const char *wm8400_ainlmux[] = | 426 | static const char *wm8400_ainlmux[] = |
423 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; | 427 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; |
424 | 428 | ||
425 | static const struct soc_enum wm8400_ainlmux_enum = | 429 | static SOC_ENUM_SINGLE_DECL(wm8400_ainlmux_enum, |
426 | SOC_ENUM_SINGLE( WM8400_INPUT_MIXER1, WM8400_AINLMODE_SHIFT, | 430 | WM8400_INPUT_MIXER1, |
427 | ARRAY_SIZE(wm8400_ainlmux), wm8400_ainlmux); | 431 | WM8400_AINLMODE_SHIFT, |
432 | wm8400_ainlmux); | ||
428 | 433 | ||
429 | static const struct snd_kcontrol_new wm8400_dapm_ainlmux_controls = | 434 | static const struct snd_kcontrol_new wm8400_dapm_ainlmux_controls = |
430 | SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum); | 435 | SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum); |
@@ -435,9 +440,10 @@ SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum); | |||
435 | static const char *wm8400_ainrmux[] = | 440 | static const char *wm8400_ainrmux[] = |
436 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; | 441 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; |
437 | 442 | ||
438 | static const struct soc_enum wm8400_ainrmux_enum = | 443 | static SOC_ENUM_SINGLE_DECL(wm8400_ainrmux_enum, |
439 | SOC_ENUM_SINGLE( WM8400_INPUT_MIXER1, WM8400_AINRMODE_SHIFT, | 444 | WM8400_INPUT_MIXER1, |
440 | ARRAY_SIZE(wm8400_ainrmux), wm8400_ainrmux); | 445 | WM8400_AINRMODE_SHIFT, |
446 | wm8400_ainrmux); | ||
441 | 447 | ||
442 | static const struct snd_kcontrol_new wm8400_dapm_ainrmux_controls = | 448 | static const struct snd_kcontrol_new wm8400_dapm_ainrmux_controls = |
443 | SOC_DAPM_ENUM("Route", wm8400_ainrmux_enum); | 449 | SOC_DAPM_ENUM("Route", wm8400_ainrmux_enum); |
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 89a18d82f303..5bce21013485 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c | |||
@@ -196,8 +196,8 @@ static const char *ain_text[] = { | |||
196 | "AIN5", "AIN6", "AIN7", "AIN8" | 196 | "AIN5", "AIN6", "AIN7", "AIN8" |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static const struct soc_enum ain_enum = | 199 | static SOC_ENUM_DOUBLE_DECL(ain_enum, |
200 | SOC_ENUM_DOUBLE(WM8770_ADCMUX, 0, 4, 8, ain_text); | 200 | WM8770_ADCMUX, 0, 4, ain_text); |
201 | 201 | ||
202 | static const struct snd_kcontrol_new ain_mux = | 202 | static const struct snd_kcontrol_new ain_mux = |
203 | SOC_DAPM_ENUM("Capture Mux", ain_enum); | 203 | SOC_DAPM_ENUM("Capture Mux", ain_enum); |
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index e98bc7038a08..43c2201cb901 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -304,53 +304,53 @@ static const DECLARE_TLV_DB_SCALE(adc_tlv, -7200, 75, 1); | |||
304 | 304 | ||
305 | static const char *mic_bias_level_txt[] = { "0.9*AVDD", "0.65*AVDD" }; | 305 | static const char *mic_bias_level_txt[] = { "0.9*AVDD", "0.65*AVDD" }; |
306 | 306 | ||
307 | static const struct soc_enum mic_bias_level = | 307 | static SOC_ENUM_SINGLE_DECL(mic_bias_level, |
308 | SOC_ENUM_SINGLE(WM8900_REG_INCTL, 8, 2, mic_bias_level_txt); | 308 | WM8900_REG_INCTL, 8, mic_bias_level_txt); |
309 | 309 | ||
310 | static const char *dac_mute_rate_txt[] = { "Fast", "Slow" }; | 310 | static const char *dac_mute_rate_txt[] = { "Fast", "Slow" }; |
311 | 311 | ||
312 | static const struct soc_enum dac_mute_rate = | 312 | static SOC_ENUM_SINGLE_DECL(dac_mute_rate, |
313 | SOC_ENUM_SINGLE(WM8900_REG_DACCTRL, 7, 2, dac_mute_rate_txt); | 313 | WM8900_REG_DACCTRL, 7, dac_mute_rate_txt); |
314 | 314 | ||
315 | static const char *dac_deemphasis_txt[] = { | 315 | static const char *dac_deemphasis_txt[] = { |
316 | "Disabled", "32kHz", "44.1kHz", "48kHz" | 316 | "Disabled", "32kHz", "44.1kHz", "48kHz" |
317 | }; | 317 | }; |
318 | 318 | ||
319 | static const struct soc_enum dac_deemphasis = | 319 | static SOC_ENUM_SINGLE_DECL(dac_deemphasis, |
320 | SOC_ENUM_SINGLE(WM8900_REG_DACCTRL, 4, 4, dac_deemphasis_txt); | 320 | WM8900_REG_DACCTRL, 4, dac_deemphasis_txt); |
321 | 321 | ||
322 | static const char *adc_hpf_cut_txt[] = { | 322 | static const char *adc_hpf_cut_txt[] = { |
323 | "Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3" | 323 | "Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3" |
324 | }; | 324 | }; |
325 | 325 | ||
326 | static const struct soc_enum adc_hpf_cut = | 326 | static SOC_ENUM_SINGLE_DECL(adc_hpf_cut, |
327 | SOC_ENUM_SINGLE(WM8900_REG_ADCCTRL, 5, 4, adc_hpf_cut_txt); | 327 | WM8900_REG_ADCCTRL, 5, adc_hpf_cut_txt); |
328 | 328 | ||
329 | static const char *lr_txt[] = { | 329 | static const char *lr_txt[] = { |
330 | "Left", "Right" | 330 | "Left", "Right" |
331 | }; | 331 | }; |
332 | 332 | ||
333 | static const struct soc_enum aifl_src = | 333 | static SOC_ENUM_SINGLE_DECL(aifl_src, |
334 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO1, 15, 2, lr_txt); | 334 | WM8900_REG_AUDIO1, 15, lr_txt); |
335 | 335 | ||
336 | static const struct soc_enum aifr_src = | 336 | static SOC_ENUM_SINGLE_DECL(aifr_src, |
337 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO1, 14, 2, lr_txt); | 337 | WM8900_REG_AUDIO1, 14, lr_txt); |
338 | 338 | ||
339 | static const struct soc_enum dacl_src = | 339 | static SOC_ENUM_SINGLE_DECL(dacl_src, |
340 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO2, 15, 2, lr_txt); | 340 | WM8900_REG_AUDIO2, 15, lr_txt); |
341 | 341 | ||
342 | static const struct soc_enum dacr_src = | 342 | static SOC_ENUM_SINGLE_DECL(dacr_src, |
343 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO2, 14, 2, lr_txt); | 343 | WM8900_REG_AUDIO2, 14, lr_txt); |
344 | 344 | ||
345 | static const char *sidetone_txt[] = { | 345 | static const char *sidetone_txt[] = { |
346 | "Disabled", "Left ADC", "Right ADC" | 346 | "Disabled", "Left ADC", "Right ADC" |
347 | }; | 347 | }; |
348 | 348 | ||
349 | static const struct soc_enum dacl_sidetone = | 349 | static SOC_ENUM_SINGLE_DECL(dacl_sidetone, |
350 | SOC_ENUM_SINGLE(WM8900_REG_SIDETONE, 2, 3, sidetone_txt); | 350 | WM8900_REG_SIDETONE, 2, sidetone_txt); |
351 | 351 | ||
352 | static const struct soc_enum dacr_sidetone = | 352 | static SOC_ENUM_SINGLE_DECL(dacr_sidetone, |
353 | SOC_ENUM_SINGLE(WM8900_REG_SIDETONE, 0, 3, sidetone_txt); | 353 | WM8900_REG_SIDETONE, 0, sidetone_txt); |
354 | 354 | ||
355 | static const struct snd_kcontrol_new wm8900_snd_controls[] = { | 355 | static const struct snd_kcontrol_new wm8900_snd_controls[] = { |
356 | SOC_ENUM("Mic Bias Level", mic_bias_level), | 356 | SOC_ENUM("Mic Bias Level", mic_bias_level), |
@@ -496,8 +496,8 @@ SOC_DAPM_SINGLE("RINPUT3 Switch", WM8900_REG_INCTL, 0, 1, 0), | |||
496 | 496 | ||
497 | static const char *wm8900_lp_mux[] = { "Disabled", "Enabled" }; | 497 | static const char *wm8900_lp_mux[] = { "Disabled", "Enabled" }; |
498 | 498 | ||
499 | static const struct soc_enum wm8900_lineout2_lp_mux = | 499 | static SOC_ENUM_SINGLE_DECL(wm8900_lineout2_lp_mux, |
500 | SOC_ENUM_SINGLE(WM8900_REG_LOUTMIXCTL1, 1, 2, wm8900_lp_mux); | 500 | WM8900_REG_LOUTMIXCTL1, 1, wm8900_lp_mux); |
501 | 501 | ||
502 | static const struct snd_kcontrol_new wm8900_lineout2_lp = | 502 | static const struct snd_kcontrol_new wm8900_lineout2_lp = |
503 | SOC_DAPM_ENUM("Route", wm8900_lineout2_lp_mux); | 503 | SOC_DAPM_ENUM("Route", wm8900_lineout2_lp_mux); |
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index b7488f190d2b..d4248e00160e 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -153,7 +153,7 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name, | |||
153 | 153 | ||
154 | data32 &= 0xffffff; | 154 | data32 &= 0xffffff; |
155 | 155 | ||
156 | wm8994_bulk_write(codec->control_data, | 156 | wm8994_bulk_write(wm8994->wm8994, |
157 | data32 & 0xffffff, | 157 | data32 & 0xffffff, |
158 | block_len / 2, | 158 | block_len / 2, |
159 | (void *)(data + 8)); | 159 | (void *)(data + 8)); |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index b9be9cbc4603..adb72063d44e 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -265,21 +265,21 @@ static const char *sidetone_hpf_text[] = { | |||
265 | "2.7kHz", "1.35kHz", "675Hz", "370Hz", "180Hz", "90Hz", "45Hz" | 265 | "2.7kHz", "1.35kHz", "675Hz", "370Hz", "180Hz", "90Hz", "45Hz" |
266 | }; | 266 | }; |
267 | 267 | ||
268 | static const struct soc_enum sidetone_hpf = | 268 | static SOC_ENUM_SINGLE_DECL(sidetone_hpf, |
269 | SOC_ENUM_SINGLE(WM8994_SIDETONE, 7, 7, sidetone_hpf_text); | 269 | WM8994_SIDETONE, 7, sidetone_hpf_text); |
270 | 270 | ||
271 | static const char *adc_hpf_text[] = { | 271 | static const char *adc_hpf_text[] = { |
272 | "HiFi", "Voice 1", "Voice 2", "Voice 3" | 272 | "HiFi", "Voice 1", "Voice 2", "Voice 3" |
273 | }; | 273 | }; |
274 | 274 | ||
275 | static const struct soc_enum aif1adc1_hpf = | 275 | static SOC_ENUM_SINGLE_DECL(aif1adc1_hpf, |
276 | SOC_ENUM_SINGLE(WM8994_AIF1_ADC1_FILTERS, 13, 4, adc_hpf_text); | 276 | WM8994_AIF1_ADC1_FILTERS, 13, adc_hpf_text); |
277 | 277 | ||
278 | static const struct soc_enum aif1adc2_hpf = | 278 | static SOC_ENUM_SINGLE_DECL(aif1adc2_hpf, |
279 | SOC_ENUM_SINGLE(WM8994_AIF1_ADC2_FILTERS, 13, 4, adc_hpf_text); | 279 | WM8994_AIF1_ADC2_FILTERS, 13, adc_hpf_text); |
280 | 280 | ||
281 | static const struct soc_enum aif2adc_hpf = | 281 | static SOC_ENUM_SINGLE_DECL(aif2adc_hpf, |
282 | SOC_ENUM_SINGLE(WM8994_AIF2_ADC_FILTERS, 13, 4, adc_hpf_text); | 282 | WM8994_AIF2_ADC_FILTERS, 13, adc_hpf_text); |
283 | 283 | ||
284 | static const DECLARE_TLV_DB_SCALE(aif_tlv, 0, 600, 0); | 284 | static const DECLARE_TLV_DB_SCALE(aif_tlv, 0, 600, 0); |
285 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); | 285 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); |
@@ -501,39 +501,39 @@ static const char *aif_chan_src_text[] = { | |||
501 | "Left", "Right" | 501 | "Left", "Right" |
502 | }; | 502 | }; |
503 | 503 | ||
504 | static const struct soc_enum aif1adcl_src = | 504 | static SOC_ENUM_SINGLE_DECL(aif1adcl_src, |
505 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_1, 15, 2, aif_chan_src_text); | 505 | WM8994_AIF1_CONTROL_1, 15, aif_chan_src_text); |
506 | 506 | ||
507 | static const struct soc_enum aif1adcr_src = | 507 | static SOC_ENUM_SINGLE_DECL(aif1adcr_src, |
508 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_1, 14, 2, aif_chan_src_text); | 508 | WM8994_AIF1_CONTROL_1, 14, aif_chan_src_text); |
509 | 509 | ||
510 | static const struct soc_enum aif2adcl_src = | 510 | static SOC_ENUM_SINGLE_DECL(aif2adcl_src, |
511 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_1, 15, 2, aif_chan_src_text); | 511 | WM8994_AIF2_CONTROL_1, 15, aif_chan_src_text); |
512 | 512 | ||
513 | static const struct soc_enum aif2adcr_src = | 513 | static SOC_ENUM_SINGLE_DECL(aif2adcr_src, |
514 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_1, 14, 2, aif_chan_src_text); | 514 | WM8994_AIF2_CONTROL_1, 14, aif_chan_src_text); |
515 | 515 | ||
516 | static const struct soc_enum aif1dacl_src = | 516 | static SOC_ENUM_SINGLE_DECL(aif1dacl_src, |
517 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, 15, 2, aif_chan_src_text); | 517 | WM8994_AIF1_CONTROL_2, 15, aif_chan_src_text); |
518 | 518 | ||
519 | static const struct soc_enum aif1dacr_src = | 519 | static SOC_ENUM_SINGLE_DECL(aif1dacr_src, |
520 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, 14, 2, aif_chan_src_text); | 520 | WM8994_AIF1_CONTROL_2, 14, aif_chan_src_text); |
521 | 521 | ||
522 | static const struct soc_enum aif2dacl_src = | 522 | static SOC_ENUM_SINGLE_DECL(aif2dacl_src, |
523 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, 15, 2, aif_chan_src_text); | 523 | WM8994_AIF2_CONTROL_2, 15, aif_chan_src_text); |
524 | 524 | ||
525 | static const struct soc_enum aif2dacr_src = | 525 | static SOC_ENUM_SINGLE_DECL(aif2dacr_src, |
526 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, 14, 2, aif_chan_src_text); | 526 | WM8994_AIF2_CONTROL_2, 14, aif_chan_src_text); |
527 | 527 | ||
528 | static const char *osr_text[] = { | 528 | static const char *osr_text[] = { |
529 | "Low Power", "High Performance", | 529 | "Low Power", "High Performance", |
530 | }; | 530 | }; |
531 | 531 | ||
532 | static const struct soc_enum dac_osr = | 532 | static SOC_ENUM_SINGLE_DECL(dac_osr, |
533 | SOC_ENUM_SINGLE(WM8994_OVERSAMPLING, 0, 2, osr_text); | 533 | WM8994_OVERSAMPLING, 0, osr_text); |
534 | 534 | ||
535 | static const struct soc_enum adc_osr = | 535 | static SOC_ENUM_SINGLE_DECL(adc_osr, |
536 | SOC_ENUM_SINGLE(WM8994_OVERSAMPLING, 1, 2, osr_text); | 536 | WM8994_OVERSAMPLING, 1, osr_text); |
537 | 537 | ||
538 | static const struct snd_kcontrol_new wm8994_snd_controls[] = { | 538 | static const struct snd_kcontrol_new wm8994_snd_controls[] = { |
539 | SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME, | 539 | SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME, |
@@ -690,17 +690,20 @@ static const char *wm8958_ng_text[] = { | |||
690 | "30ms", "125ms", "250ms", "500ms", | 690 | "30ms", "125ms", "250ms", "500ms", |
691 | }; | 691 | }; |
692 | 692 | ||
693 | static const struct soc_enum wm8958_aif1dac1_ng_hold = | 693 | static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac1_ng_hold, |
694 | SOC_ENUM_SINGLE(WM8958_AIF1_DAC1_NOISE_GATE, | 694 | WM8958_AIF1_DAC1_NOISE_GATE, |
695 | WM8958_AIF1DAC1_NG_THR_SHIFT, 4, wm8958_ng_text); | 695 | WM8958_AIF1DAC1_NG_THR_SHIFT, |
696 | wm8958_ng_text); | ||
696 | 697 | ||
697 | static const struct soc_enum wm8958_aif1dac2_ng_hold = | 698 | static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac2_ng_hold, |
698 | SOC_ENUM_SINGLE(WM8958_AIF1_DAC2_NOISE_GATE, | 699 | WM8958_AIF1_DAC2_NOISE_GATE, |
699 | WM8958_AIF1DAC2_NG_THR_SHIFT, 4, wm8958_ng_text); | 700 | WM8958_AIF1DAC2_NG_THR_SHIFT, |
701 | wm8958_ng_text); | ||
700 | 702 | ||
701 | static const struct soc_enum wm8958_aif2dac_ng_hold = | 703 | static SOC_ENUM_SINGLE_DECL(wm8958_aif2dac_ng_hold, |
702 | SOC_ENUM_SINGLE(WM8958_AIF2_DAC_NOISE_GATE, | 704 | WM8958_AIF2_DAC_NOISE_GATE, |
703 | WM8958_AIF2DAC_NG_THR_SHIFT, 4, wm8958_ng_text); | 705 | WM8958_AIF2DAC_NG_THR_SHIFT, |
706 | wm8958_ng_text); | ||
704 | 707 | ||
705 | static const struct snd_kcontrol_new wm8958_snd_controls[] = { | 708 | static const struct snd_kcontrol_new wm8958_snd_controls[] = { |
706 | SOC_SINGLE_TLV("AIF3 Boost Volume", WM8958_AIF3_CONTROL_2, 10, 3, 0, aif_tlv), | 709 | SOC_SINGLE_TLV("AIF3 Boost Volume", WM8958_AIF3_CONTROL_2, 10, 3, 0, aif_tlv), |
@@ -1341,8 +1344,8 @@ static const char *adc_mux_text[] = { | |||
1341 | "DMIC", | 1344 | "DMIC", |
1342 | }; | 1345 | }; |
1343 | 1346 | ||
1344 | static const struct soc_enum adc_enum = | 1347 | static SOC_ENUM_SINGLE_DECL(adc_enum, |
1345 | SOC_ENUM_SINGLE(0, 0, 2, adc_mux_text); | 1348 | 0, 0, adc_mux_text); |
1346 | 1349 | ||
1347 | static const struct snd_kcontrol_new adcl_mux = | 1350 | static const struct snd_kcontrol_new adcl_mux = |
1348 | SOC_DAPM_ENUM_VIRT("ADCL Mux", adc_enum); | 1351 | SOC_DAPM_ENUM_VIRT("ADCL Mux", adc_enum); |
@@ -1478,14 +1481,14 @@ static const char *sidetone_text[] = { | |||
1478 | "ADC/DMIC1", "DMIC2", | 1481 | "ADC/DMIC1", "DMIC2", |
1479 | }; | 1482 | }; |
1480 | 1483 | ||
1481 | static const struct soc_enum sidetone1_enum = | 1484 | static SOC_ENUM_SINGLE_DECL(sidetone1_enum, |
1482 | SOC_ENUM_SINGLE(WM8994_SIDETONE, 0, 2, sidetone_text); | 1485 | WM8994_SIDETONE, 0, sidetone_text); |
1483 | 1486 | ||
1484 | static const struct snd_kcontrol_new sidetone1_mux = | 1487 | static const struct snd_kcontrol_new sidetone1_mux = |
1485 | SOC_DAPM_ENUM("Left Sidetone Mux", sidetone1_enum); | 1488 | SOC_DAPM_ENUM("Left Sidetone Mux", sidetone1_enum); |
1486 | 1489 | ||
1487 | static const struct soc_enum sidetone2_enum = | 1490 | static SOC_ENUM_SINGLE_DECL(sidetone2_enum, |
1488 | SOC_ENUM_SINGLE(WM8994_SIDETONE, 1, 2, sidetone_text); | 1491 | WM8994_SIDETONE, 1, sidetone_text); |
1489 | 1492 | ||
1490 | static const struct snd_kcontrol_new sidetone2_mux = | 1493 | static const struct snd_kcontrol_new sidetone2_mux = |
1491 | SOC_DAPM_ENUM("Right Sidetone Mux", sidetone2_enum); | 1494 | SOC_DAPM_ENUM("Right Sidetone Mux", sidetone2_enum); |
@@ -1498,22 +1501,24 @@ static const char *loopback_text[] = { | |||
1498 | "None", "ADCDAT", | 1501 | "None", "ADCDAT", |
1499 | }; | 1502 | }; |
1500 | 1503 | ||
1501 | static const struct soc_enum aif1_loopback_enum = | 1504 | static SOC_ENUM_SINGLE_DECL(aif1_loopback_enum, |
1502 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, WM8994_AIF1_LOOPBACK_SHIFT, 2, | 1505 | WM8994_AIF1_CONTROL_2, |
1503 | loopback_text); | 1506 | WM8994_AIF1_LOOPBACK_SHIFT, |
1507 | loopback_text); | ||
1504 | 1508 | ||
1505 | static const struct snd_kcontrol_new aif1_loopback = | 1509 | static const struct snd_kcontrol_new aif1_loopback = |
1506 | SOC_DAPM_ENUM("AIF1 Loopback", aif1_loopback_enum); | 1510 | SOC_DAPM_ENUM("AIF1 Loopback", aif1_loopback_enum); |
1507 | 1511 | ||
1508 | static const struct soc_enum aif2_loopback_enum = | 1512 | static SOC_ENUM_SINGLE_DECL(aif2_loopback_enum, |
1509 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, WM8994_AIF2_LOOPBACK_SHIFT, 2, | 1513 | WM8994_AIF2_CONTROL_2, |
1510 | loopback_text); | 1514 | WM8994_AIF2_LOOPBACK_SHIFT, |
1515 | loopback_text); | ||
1511 | 1516 | ||
1512 | static const struct snd_kcontrol_new aif2_loopback = | 1517 | static const struct snd_kcontrol_new aif2_loopback = |
1513 | SOC_DAPM_ENUM("AIF2 Loopback", aif2_loopback_enum); | 1518 | SOC_DAPM_ENUM("AIF2 Loopback", aif2_loopback_enum); |
1514 | 1519 | ||
1515 | static const struct soc_enum aif1dac_enum = | 1520 | static SOC_ENUM_SINGLE_DECL(aif1dac_enum, |
1516 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 0, 2, aif1dac_text); | 1521 | WM8994_POWER_MANAGEMENT_6, 0, aif1dac_text); |
1517 | 1522 | ||
1518 | static const struct snd_kcontrol_new aif1dac_mux = | 1523 | static const struct snd_kcontrol_new aif1dac_mux = |
1519 | SOC_DAPM_ENUM("AIF1DAC Mux", aif1dac_enum); | 1524 | SOC_DAPM_ENUM("AIF1DAC Mux", aif1dac_enum); |
@@ -1522,8 +1527,8 @@ static const char *aif2dac_text[] = { | |||
1522 | "AIF2DACDAT", "AIF3DACDAT", | 1527 | "AIF2DACDAT", "AIF3DACDAT", |
1523 | }; | 1528 | }; |
1524 | 1529 | ||
1525 | static const struct soc_enum aif2dac_enum = | 1530 | static SOC_ENUM_SINGLE_DECL(aif2dac_enum, |
1526 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 1, 2, aif2dac_text); | 1531 | WM8994_POWER_MANAGEMENT_6, 1, aif2dac_text); |
1527 | 1532 | ||
1528 | static const struct snd_kcontrol_new aif2dac_mux = | 1533 | static const struct snd_kcontrol_new aif2dac_mux = |
1529 | SOC_DAPM_ENUM("AIF2DAC Mux", aif2dac_enum); | 1534 | SOC_DAPM_ENUM("AIF2DAC Mux", aif2dac_enum); |
@@ -1532,8 +1537,8 @@ static const char *aif2adc_text[] = { | |||
1532 | "AIF2ADCDAT", "AIF3DACDAT", | 1537 | "AIF2ADCDAT", "AIF3DACDAT", |
1533 | }; | 1538 | }; |
1534 | 1539 | ||
1535 | static const struct soc_enum aif2adc_enum = | 1540 | static SOC_ENUM_SINGLE_DECL(aif2adc_enum, |
1536 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 2, 2, aif2adc_text); | 1541 | WM8994_POWER_MANAGEMENT_6, 2, aif2adc_text); |
1537 | 1542 | ||
1538 | static const struct snd_kcontrol_new aif2adc_mux = | 1543 | static const struct snd_kcontrol_new aif2adc_mux = |
1539 | SOC_DAPM_ENUM("AIF2ADC Mux", aif2adc_enum); | 1544 | SOC_DAPM_ENUM("AIF2ADC Mux", aif2adc_enum); |
@@ -1542,14 +1547,14 @@ static const char *aif3adc_text[] = { | |||
1542 | "AIF1ADCDAT", "AIF2ADCDAT", "AIF2DACDAT", "Mono PCM", | 1547 | "AIF1ADCDAT", "AIF2ADCDAT", "AIF2DACDAT", "Mono PCM", |
1543 | }; | 1548 | }; |
1544 | 1549 | ||
1545 | static const struct soc_enum wm8994_aif3adc_enum = | 1550 | static SOC_ENUM_SINGLE_DECL(wm8994_aif3adc_enum, |
1546 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 3, 3, aif3adc_text); | 1551 | WM8994_POWER_MANAGEMENT_6, 3, aif3adc_text); |
1547 | 1552 | ||
1548 | static const struct snd_kcontrol_new wm8994_aif3adc_mux = | 1553 | static const struct snd_kcontrol_new wm8994_aif3adc_mux = |
1549 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8994_aif3adc_enum); | 1554 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8994_aif3adc_enum); |
1550 | 1555 | ||
1551 | static const struct soc_enum wm8958_aif3adc_enum = | 1556 | static SOC_ENUM_SINGLE_DECL(wm8958_aif3adc_enum, |
1552 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 3, 4, aif3adc_text); | 1557 | WM8994_POWER_MANAGEMENT_6, 3, aif3adc_text); |
1553 | 1558 | ||
1554 | static const struct snd_kcontrol_new wm8958_aif3adc_mux = | 1559 | static const struct snd_kcontrol_new wm8958_aif3adc_mux = |
1555 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8958_aif3adc_enum); | 1560 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8958_aif3adc_enum); |
@@ -1558,8 +1563,8 @@ static const char *mono_pcm_out_text[] = { | |||
1558 | "None", "AIF2ADCL", "AIF2ADCR", | 1563 | "None", "AIF2ADCL", "AIF2ADCR", |
1559 | }; | 1564 | }; |
1560 | 1565 | ||
1561 | static const struct soc_enum mono_pcm_out_enum = | 1566 | static SOC_ENUM_SINGLE_DECL(mono_pcm_out_enum, |
1562 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 9, 3, mono_pcm_out_text); | 1567 | WM8994_POWER_MANAGEMENT_6, 9, mono_pcm_out_text); |
1563 | 1568 | ||
1564 | static const struct snd_kcontrol_new mono_pcm_out_mux = | 1569 | static const struct snd_kcontrol_new mono_pcm_out_mux = |
1565 | SOC_DAPM_ENUM("Mono PCM Out Mux", mono_pcm_out_enum); | 1570 | SOC_DAPM_ENUM("Mono PCM Out Mux", mono_pcm_out_enum); |
@@ -1569,14 +1574,14 @@ static const char *aif2dac_src_text[] = { | |||
1569 | }; | 1574 | }; |
1570 | 1575 | ||
1571 | /* Note that these two control shouldn't be simultaneously switched to AIF3 */ | 1576 | /* Note that these two control shouldn't be simultaneously switched to AIF3 */ |
1572 | static const struct soc_enum aif2dacl_src_enum = | 1577 | static SOC_ENUM_SINGLE_DECL(aif2dacl_src_enum, |
1573 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 7, 2, aif2dac_src_text); | 1578 | WM8994_POWER_MANAGEMENT_6, 7, aif2dac_src_text); |
1574 | 1579 | ||
1575 | static const struct snd_kcontrol_new aif2dacl_src_mux = | 1580 | static const struct snd_kcontrol_new aif2dacl_src_mux = |
1576 | SOC_DAPM_ENUM("AIF2DACL Mux", aif2dacl_src_enum); | 1581 | SOC_DAPM_ENUM("AIF2DACL Mux", aif2dacl_src_enum); |
1577 | 1582 | ||
1578 | static const struct soc_enum aif2dacr_src_enum = | 1583 | static SOC_ENUM_SINGLE_DECL(aif2dacr_src_enum, |
1579 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 8, 2, aif2dac_src_text); | 1584 | WM8994_POWER_MANAGEMENT_6, 8, aif2dac_src_text); |
1580 | 1585 | ||
1581 | static const struct snd_kcontrol_new aif2dacr_src_mux = | 1586 | static const struct snd_kcontrol_new aif2dacr_src_mux = |
1582 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); | 1587 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); |
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 3fde9e402710..d163e18d85d4 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -305,7 +305,9 @@ static int __init n810_soc_init(void) | |||
305 | int err; | 305 | int err; |
306 | struct device *dev; | 306 | struct device *dev; |
307 | 307 | ||
308 | if (!(machine_is_nokia_n810() || machine_is_nokia_n810_wimax())) | 308 | if (!of_have_populated_dt() || |
309 | (!of_machine_is_compatible("nokia,n810") && | ||
310 | !of_machine_is_compatible("nokia,n810-wimax"))) | ||
309 | return -ENODEV; | 311 | return -ENODEV; |
310 | 312 | ||
311 | n810_snd_device = platform_device_alloc("soc-audio", -1); | 313 | n810_snd_device = platform_device_alloc("soc-audio", -1); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index dc8ff13187f7..b9dc6acbba8c 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1218,7 +1218,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, | |||
1218 | ret = regulator_allow_bypass(w->regulator, false); | 1218 | ret = regulator_allow_bypass(w->regulator, false); |
1219 | if (ret != 0) | 1219 | if (ret != 0) |
1220 | dev_warn(w->dapm->dev, | 1220 | dev_warn(w->dapm->dev, |
1221 | "ASoC: Failed to bypass %s: %d\n", | 1221 | "ASoC: Failed to unbypass %s: %d\n", |
1222 | w->name, ret); | 1222 | w->name, ret); |
1223 | } | 1223 | } |
1224 | 1224 | ||
@@ -1228,7 +1228,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, | |||
1228 | ret = regulator_allow_bypass(w->regulator, true); | 1228 | ret = regulator_allow_bypass(w->regulator, true); |
1229 | if (ret != 0) | 1229 | if (ret != 0) |
1230 | dev_warn(w->dapm->dev, | 1230 | dev_warn(w->dapm->dev, |
1231 | "ASoC: Failed to unbypass %s: %d\n", | 1231 | "ASoC: Failed to bypass %s: %d\n", |
1232 | w->name, ret); | 1232 | w->name, ret); |
1233 | } | 1233 | } |
1234 | 1234 | ||
@@ -3210,15 +3210,11 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, | |||
3210 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); | 3210 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); |
3211 | const char *pin = (const char *)kcontrol->private_value; | 3211 | const char *pin = (const char *)kcontrol->private_value; |
3212 | 3212 | ||
3213 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3214 | |||
3215 | if (ucontrol->value.integer.value[0]) | 3213 | if (ucontrol->value.integer.value[0]) |
3216 | snd_soc_dapm_enable_pin(&card->dapm, pin); | 3214 | snd_soc_dapm_enable_pin(&card->dapm, pin); |
3217 | else | 3215 | else |
3218 | snd_soc_dapm_disable_pin(&card->dapm, pin); | 3216 | snd_soc_dapm_disable_pin(&card->dapm, pin); |
3219 | 3217 | ||
3220 | mutex_unlock(&card->dapm_mutex); | ||
3221 | |||
3222 | snd_soc_dapm_sync(&card->dapm); | 3218 | snd_soc_dapm_sync(&card->dapm); |
3223 | return 0; | 3219 | return 0; |
3224 | } | 3220 | } |
@@ -3248,7 +3244,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3248 | ret = regulator_allow_bypass(w->regulator, true); | 3244 | ret = regulator_allow_bypass(w->regulator, true); |
3249 | if (ret != 0) | 3245 | if (ret != 0) |
3250 | dev_warn(w->dapm->dev, | 3246 | dev_warn(w->dapm->dev, |
3251 | "ASoC: Failed to unbypass %s: %d\n", | 3247 | "ASoC: Failed to bypass %s: %d\n", |
3252 | w->name, ret); | 3248 | w->name, ret); |
3253 | } | 3249 | } |
3254 | break; | 3250 | break; |
@@ -3767,23 +3763,52 @@ void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | |||
3767 | } | 3763 | } |
3768 | 3764 | ||
3769 | /** | 3765 | /** |
3766 | * snd_soc_dapm_enable_pin_unlocked - enable pin. | ||
3767 | * @dapm: DAPM context | ||
3768 | * @pin: pin name | ||
3769 | * | ||
3770 | * Enables input/output pin and its parents or children widgets iff there is | ||
3771 | * a valid audio route and active audio stream. | ||
3772 | * | ||
3773 | * Requires external locking. | ||
3774 | * | ||
3775 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3776 | * do any widget power switching. | ||
3777 | */ | ||
3778 | int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3779 | const char *pin) | ||
3780 | { | ||
3781 | return snd_soc_dapm_set_pin(dapm, pin, 1); | ||
3782 | } | ||
3783 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin_unlocked); | ||
3784 | |||
3785 | /** | ||
3770 | * snd_soc_dapm_enable_pin - enable pin. | 3786 | * snd_soc_dapm_enable_pin - enable pin. |
3771 | * @dapm: DAPM context | 3787 | * @dapm: DAPM context |
3772 | * @pin: pin name | 3788 | * @pin: pin name |
3773 | * | 3789 | * |
3774 | * Enables input/output pin and its parents or children widgets iff there is | 3790 | * Enables input/output pin and its parents or children widgets iff there is |
3775 | * a valid audio route and active audio stream. | 3791 | * a valid audio route and active audio stream. |
3792 | * | ||
3776 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3793 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3777 | * do any widget power switching. | 3794 | * do any widget power switching. |
3778 | */ | 3795 | */ |
3779 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) | 3796 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) |
3780 | { | 3797 | { |
3781 | return snd_soc_dapm_set_pin(dapm, pin, 1); | 3798 | int ret; |
3799 | |||
3800 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3801 | |||
3802 | ret = snd_soc_dapm_set_pin(dapm, pin, 1); | ||
3803 | |||
3804 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3805 | |||
3806 | return ret; | ||
3782 | } | 3807 | } |
3783 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); | 3808 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); |
3784 | 3809 | ||
3785 | /** | 3810 | /** |
3786 | * snd_soc_dapm_force_enable_pin - force a pin to be enabled | 3811 | * snd_soc_dapm_force_enable_pin_unlocked - force a pin to be enabled |
3787 | * @dapm: DAPM context | 3812 | * @dapm: DAPM context |
3788 | * @pin: pin name | 3813 | * @pin: pin name |
3789 | * | 3814 | * |
@@ -3791,11 +3816,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); | |||
3791 | * intended for use with microphone bias supplies used in microphone | 3816 | * intended for use with microphone bias supplies used in microphone |
3792 | * jack detection. | 3817 | * jack detection. |
3793 | * | 3818 | * |
3819 | * Requires external locking. | ||
3820 | * | ||
3794 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3821 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3795 | * do any widget power switching. | 3822 | * do any widget power switching. |
3796 | */ | 3823 | */ |
3797 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | 3824 | int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, |
3798 | const char *pin) | 3825 | const char *pin) |
3799 | { | 3826 | { |
3800 | struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); | 3827 | struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); |
3801 | 3828 | ||
@@ -3811,25 +3838,103 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | |||
3811 | 3838 | ||
3812 | return 0; | 3839 | return 0; |
3813 | } | 3840 | } |
3841 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin_unlocked); | ||
3842 | |||
3843 | /** | ||
3844 | * snd_soc_dapm_force_enable_pin - force a pin to be enabled | ||
3845 | * @dapm: DAPM context | ||
3846 | * @pin: pin name | ||
3847 | * | ||
3848 | * Enables input/output pin regardless of any other state. This is | ||
3849 | * intended for use with microphone bias supplies used in microphone | ||
3850 | * jack detection. | ||
3851 | * | ||
3852 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3853 | * do any widget power switching. | ||
3854 | */ | ||
3855 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | ||
3856 | const char *pin) | ||
3857 | { | ||
3858 | int ret; | ||
3859 | |||
3860 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3861 | |||
3862 | ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, pin); | ||
3863 | |||
3864 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3865 | |||
3866 | return ret; | ||
3867 | } | ||
3814 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); | 3868 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); |
3815 | 3869 | ||
3816 | /** | 3870 | /** |
3871 | * snd_soc_dapm_disable_pin_unlocked - disable pin. | ||
3872 | * @dapm: DAPM context | ||
3873 | * @pin: pin name | ||
3874 | * | ||
3875 | * Disables input/output pin and its parents or children widgets. | ||
3876 | * | ||
3877 | * Requires external locking. | ||
3878 | * | ||
3879 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3880 | * do any widget power switching. | ||
3881 | */ | ||
3882 | int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3883 | const char *pin) | ||
3884 | { | ||
3885 | return snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3886 | } | ||
3887 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin_unlocked); | ||
3888 | |||
3889 | /** | ||
3817 | * snd_soc_dapm_disable_pin - disable pin. | 3890 | * snd_soc_dapm_disable_pin - disable pin. |
3818 | * @dapm: DAPM context | 3891 | * @dapm: DAPM context |
3819 | * @pin: pin name | 3892 | * @pin: pin name |
3820 | * | 3893 | * |
3821 | * Disables input/output pin and its parents or children widgets. | 3894 | * Disables input/output pin and its parents or children widgets. |
3895 | * | ||
3822 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3896 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3823 | * do any widget power switching. | 3897 | * do any widget power switching. |
3824 | */ | 3898 | */ |
3825 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, | 3899 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, |
3826 | const char *pin) | 3900 | const char *pin) |
3827 | { | 3901 | { |
3828 | return snd_soc_dapm_set_pin(dapm, pin, 0); | 3902 | int ret; |
3903 | |||
3904 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3905 | |||
3906 | ret = snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3907 | |||
3908 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3909 | |||
3910 | return ret; | ||
3829 | } | 3911 | } |
3830 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); | 3912 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); |
3831 | 3913 | ||
3832 | /** | 3914 | /** |
3915 | * snd_soc_dapm_nc_pin_unlocked - permanently disable pin. | ||
3916 | * @dapm: DAPM context | ||
3917 | * @pin: pin name | ||
3918 | * | ||
3919 | * Marks the specified pin as being not connected, disabling it along | ||
3920 | * any parent or child widgets. At present this is identical to | ||
3921 | * snd_soc_dapm_disable_pin() but in future it will be extended to do | ||
3922 | * additional things such as disabling controls which only affect | ||
3923 | * paths through the pin. | ||
3924 | * | ||
3925 | * Requires external locking. | ||
3926 | * | ||
3927 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3928 | * do any widget power switching. | ||
3929 | */ | ||
3930 | int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3931 | const char *pin) | ||
3932 | { | ||
3933 | return snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3934 | } | ||
3935 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin_unlocked); | ||
3936 | |||
3937 | /** | ||
3833 | * snd_soc_dapm_nc_pin - permanently disable pin. | 3938 | * snd_soc_dapm_nc_pin - permanently disable pin. |
3834 | * @dapm: DAPM context | 3939 | * @dapm: DAPM context |
3835 | * @pin: pin name | 3940 | * @pin: pin name |
@@ -3845,7 +3950,15 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); | |||
3845 | */ | 3950 | */ |
3846 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin) | 3951 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin) |
3847 | { | 3952 | { |
3848 | return snd_soc_dapm_set_pin(dapm, pin, 0); | 3953 | int ret; |
3954 | |||
3955 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3956 | |||
3957 | ret = snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3958 | |||
3959 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3960 | |||
3961 | return ret; | ||
3849 | } | 3962 | } |
3850 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); | 3963 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); |
3851 | 3964 | ||
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 47e1ce771e65..28522bd03b8e 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -1989,6 +1989,7 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card) | |||
1989 | 1989 | ||
1990 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); | 1990 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); |
1991 | if (paths < 0) { | 1991 | if (paths < 0) { |
1992 | dpcm_path_put(&list); | ||
1992 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", | 1993 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", |
1993 | fe->dai_link->name, "playback"); | 1994 | fe->dai_link->name, "playback"); |
1994 | mutex_unlock(&card->mutex); | 1995 | mutex_unlock(&card->mutex); |
@@ -2018,6 +2019,7 @@ capture: | |||
2018 | 2019 | ||
2019 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); | 2020 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); |
2020 | if (paths < 0) { | 2021 | if (paths < 0) { |
2022 | dpcm_path_put(&list); | ||
2021 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", | 2023 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", |
2022 | fe->dai_link->name, "capture"); | 2024 | fe->dai_link->name, "capture"); |
2023 | mutex_unlock(&card->mutex); | 2025 | mutex_unlock(&card->mutex); |
@@ -2082,6 +2084,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) | |||
2082 | fe->dpcm[stream].runtime = fe_substream->runtime; | 2084 | fe->dpcm[stream].runtime = fe_substream->runtime; |
2083 | 2085 | ||
2084 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 2086 | if (dpcm_path_get(fe, stream, &list) <= 0) { |
2087 | dpcm_path_put(&list); | ||
2085 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 2088 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
2086 | fe->dai_link->name, stream ? "capture" : "playback"); | 2089 | fe->dai_link->name, stream ? "capture" : "playback"); |
2087 | } | 2090 | } |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 44b0ba4feab3..1bed780e21d9 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -883,6 +883,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, | |||
883 | } | 883 | } |
884 | break; | 884 | break; |
885 | 885 | ||
886 | case USB_ID(0x046d, 0x0807): /* Logitech Webcam C500 */ | ||
886 | case USB_ID(0x046d, 0x0808): | 887 | case USB_ID(0x046d, 0x0808): |
887 | case USB_ID(0x046d, 0x0809): | 888 | case USB_ID(0x046d, 0x0809): |
888 | case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ | 889 | case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ |
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile index da8b7aa3d351..07b0b7542511 100644 --- a/tools/lib/lockdep/Makefile +++ b/tools/lib/lockdep/Makefile | |||
@@ -87,8 +87,8 @@ endif # BUILD_SRC | |||
87 | # We process the rest of the Makefile if this is the final invocation of make | 87 | # We process the rest of the Makefile if this is the final invocation of make |
88 | ifeq ($(skip-makefile),) | 88 | ifeq ($(skip-makefile),) |
89 | 89 | ||
90 | srctree := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)) | 90 | srctree := $(realpath $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR))) |
91 | objtree := $(CURDIR) | 91 | objtree := $(realpath $(CURDIR)) |
92 | src := $(srctree) | 92 | src := $(srctree) |
93 | obj := $(objtree) | 93 | obj := $(objtree) |
94 | 94 | ||
@@ -112,7 +112,7 @@ export Q VERBOSE | |||
112 | 112 | ||
113 | LIBLOCKDEP_VERSION = $(LL_VERSION).$(LL_PATCHLEVEL).$(LL_EXTRAVERSION) | 113 | LIBLOCKDEP_VERSION = $(LL_VERSION).$(LL_PATCHLEVEL).$(LL_EXTRAVERSION) |
114 | 114 | ||
115 | INCLUDES = -I. -I/usr/local/include -I./uinclude $(CONFIG_INCLUDES) | 115 | INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES) |
116 | 116 | ||
117 | # Set compile option CFLAGS if not set elsewhere | 117 | # Set compile option CFLAGS if not set elsewhere |
118 | CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g | 118 | CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g |
diff --git a/tools/lib/lockdep/preload.c b/tools/lib/lockdep/preload.c index f8465a811aa5..23bd69cb5ade 100644 --- a/tools/lib/lockdep/preload.c +++ b/tools/lib/lockdep/preload.c | |||
@@ -418,7 +418,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) | |||
418 | 418 | ||
419 | __attribute__((constructor)) static void init_preload(void) | 419 | __attribute__((constructor)) static void init_preload(void) |
420 | { | 420 | { |
421 | if (__init_state != done) | 421 | if (__init_state == done) |
422 | return; | 422 | return; |
423 | 423 | ||
424 | #ifndef __GLIBC__ | 424 | #ifndef __GLIBC__ |
diff --git a/tools/lib/lockdep/run_tests.sh b/tools/lib/lockdep/run_tests.sh index 5334ad9d39b7..5334ad9d39b7 100644..100755 --- a/tools/lib/lockdep/run_tests.sh +++ b/tools/lib/lockdep/run_tests.sh | |||
diff --git a/tools/lib/lockdep/uinclude/asm/hash.h b/tools/lib/lockdep/uinclude/asm/hash.h new file mode 100644 index 000000000000..d82b170bb216 --- /dev/null +++ b/tools/lib/lockdep/uinclude/asm/hash.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_GENERIC_HASH_H | ||
2 | #define __ASM_GENERIC_HASH_H | ||
3 | |||
4 | /* Stub */ | ||
5 | |||
6 | #endif /* __ASM_GENERIC_HASH_H */ | ||
diff --git a/tools/lib/lockdep/uinclude/linux/rcu.h b/tools/lib/lockdep/uinclude/linux/rcu.h index 4c99fcb5da27..042ee8e463c9 100644 --- a/tools/lib/lockdep/uinclude/linux/rcu.h +++ b/tools/lib/lockdep/uinclude/linux/rcu.h | |||
@@ -13,4 +13,9 @@ static inline int rcu_is_cpu_idle(void) | |||
13 | return 1; | 13 | return 1; |
14 | } | 14 | } |
15 | 15 | ||
16 | static inline bool rcu_is_watching(void) | ||
17 | { | ||
18 | return false; | ||
19 | } | ||
20 | |||
16 | #endif | 21 | #endif |
diff --git a/tools/net/Makefile b/tools/net/Makefile index 004cd74734b6..ee577ea03ba5 100644 --- a/tools/net/Makefile +++ b/tools/net/Makefile | |||
@@ -12,7 +12,7 @@ YACC = bison | |||
12 | 12 | ||
13 | all : bpf_jit_disasm bpf_dbg bpf_asm | 13 | all : bpf_jit_disasm bpf_dbg bpf_asm |
14 | 14 | ||
15 | bpf_jit_disasm : CFLAGS = -Wall -O2 | 15 | bpf_jit_disasm : CFLAGS = -Wall -O2 -DPACKAGE='bpf_jit_disasm' |
16 | bpf_jit_disasm : LDLIBS = -lopcodes -lbfd -ldl | 16 | bpf_jit_disasm : LDLIBS = -lopcodes -lbfd -ldl |
17 | bpf_jit_disasm : bpf_jit_disasm.o | 17 | bpf_jit_disasm : bpf_jit_disasm.o |
18 | 18 | ||
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index d4c83c60b9b2..97d86d828190 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c | |||
@@ -1593,6 +1593,7 @@ static void init_params(struct params *p, const char *name, int argc, const char | |||
1593 | p->data_rand_walk = true; | 1593 | p->data_rand_walk = true; |
1594 | p->nr_loops = -1; | 1594 | p->nr_loops = -1; |
1595 | p->init_random = true; | 1595 | p->init_random = true; |
1596 | p->run_all = argc == 1; | ||
1596 | } | 1597 | } |
1597 | 1598 | ||
1598 | static int run_bench_numa(const char *name, const char **argv) | 1599 | static int run_bench_numa(const char *name, const char **argv) |
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index e47f90cc7b98..8a987d252780 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c | |||
@@ -76,7 +76,7 @@ static struct collection collections[] = { | |||
76 | 76 | ||
77 | /* Iterate over all benchmarks within a collection: */ | 77 | /* Iterate over all benchmarks within a collection: */ |
78 | #define for_each_bench(coll, bench) \ | 78 | #define for_each_bench(coll, bench) \ |
79 | for (bench = coll->benchmarks; bench->name; bench++) | 79 | for (bench = coll->benchmarks; bench && bench->name; bench++) |
80 | 80 | ||
81 | static void dump_benchmarks(struct collection *coll) | 81 | static void dump_benchmarks(struct collection *coll) |
82 | { | 82 | { |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 3c53ec268fbc..02f985f3a396 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -113,14 +113,16 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati | |||
113 | if (!he) | 113 | if (!he) |
114 | return -ENOMEM; | 114 | return -ENOMEM; |
115 | 115 | ||
116 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 116 | if (ui__has_annotation()) { |
117 | if (err) | 117 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
118 | goto out; | 118 | if (err) |
119 | goto out; | ||
119 | 120 | ||
120 | mx = he->mem_info; | 121 | mx = he->mem_info; |
121 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); | 122 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); |
122 | if (err) | 123 | if (err) |
123 | goto out; | 124 | goto out; |
125 | } | ||
124 | 126 | ||
125 | evsel->hists.stats.total_period += cost; | 127 | evsel->hists.stats.total_period += cost; |
126 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 128 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -164,14 +166,18 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc | |||
164 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, | 166 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, |
165 | 1, 1, 0); | 167 | 1, 1, 0); |
166 | if (he) { | 168 | if (he) { |
167 | bx = he->branch_info; | 169 | if (ui__has_annotation()) { |
168 | err = addr_map_symbol__inc_samples(&bx->from, evsel->idx); | 170 | bx = he->branch_info; |
169 | if (err) | 171 | err = addr_map_symbol__inc_samples(&bx->from, |
170 | goto out; | 172 | evsel->idx); |
171 | 173 | if (err) | |
172 | err = addr_map_symbol__inc_samples(&bx->to, evsel->idx); | 174 | goto out; |
173 | if (err) | 175 | |
174 | goto out; | 176 | err = addr_map_symbol__inc_samples(&bx->to, |
177 | evsel->idx); | ||
178 | if (err) | ||
179 | goto out; | ||
180 | } | ||
175 | 181 | ||
176 | evsel->hists.stats.total_period += 1; | 182 | evsel->hists.stats.total_period += 1; |
177 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 183 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -205,7 +211,9 @@ static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evs | |||
205 | if (err) | 211 | if (err) |
206 | goto out; | 212 | goto out; |
207 | 213 | ||
208 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 214 | if (ui__has_annotation()) |
215 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | ||
216 | |||
209 | evsel->hists.stats.total_period += sample->period; | 217 | evsel->hists.stats.total_period += sample->period; |
210 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 218 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
211 | out: | 219 | out: |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 76cd510d34d0..5f989a7d8bc2 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -176,7 +176,7 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
176 | { | 176 | { |
177 | struct annotation *notes; | 177 | struct annotation *notes; |
178 | struct symbol *sym; | 178 | struct symbol *sym; |
179 | int err; | 179 | int err = 0; |
180 | 180 | ||
181 | if (he == NULL || he->ms.sym == NULL || | 181 | if (he == NULL || he->ms.sym == NULL || |
182 | ((top->sym_filter_entry == NULL || | 182 | ((top->sym_filter_entry == NULL || |
@@ -190,7 +190,9 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
190 | return; | 190 | return; |
191 | 191 | ||
192 | ip = he->ms.map->map_ip(he->ms.map, ip); | 192 | ip = he->ms.map->map_ip(he->ms.map, ip); |
193 | err = hist_entry__inc_addr_samples(he, counter, ip); | 193 | |
194 | if (ui__has_annotation()) | ||
195 | err = hist_entry__inc_addr_samples(he, counter, ip); | ||
194 | 196 | ||
195 | pthread_mutex_unlock(¬es->lock); | 197 | pthread_mutex_unlock(¬es->lock); |
196 | 198 | ||
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 6aa6fb6f7bd9..f954c26de231 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -825,7 +825,6 @@ static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscal | |||
825 | P_SIGNUM(PIPE); | 825 | P_SIGNUM(PIPE); |
826 | P_SIGNUM(ALRM); | 826 | P_SIGNUM(ALRM); |
827 | P_SIGNUM(TERM); | 827 | P_SIGNUM(TERM); |
828 | P_SIGNUM(STKFLT); | ||
829 | P_SIGNUM(CHLD); | 828 | P_SIGNUM(CHLD); |
830 | P_SIGNUM(CONT); | 829 | P_SIGNUM(CONT); |
831 | P_SIGNUM(STOP); | 830 | P_SIGNUM(STOP); |
@@ -841,6 +840,15 @@ static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscal | |||
841 | P_SIGNUM(IO); | 840 | P_SIGNUM(IO); |
842 | P_SIGNUM(PWR); | 841 | P_SIGNUM(PWR); |
843 | P_SIGNUM(SYS); | 842 | P_SIGNUM(SYS); |
843 | #ifdef SIGEMT | ||
844 | P_SIGNUM(EMT); | ||
845 | #endif | ||
846 | #ifdef SIGSTKFLT | ||
847 | P_SIGNUM(STKFLT); | ||
848 | #endif | ||
849 | #ifdef SIGSWI | ||
850 | P_SIGNUM(SWI); | ||
851 | #endif | ||
844 | default: break; | 852 | default: break; |
845 | } | 853 | } |
846 | 854 | ||
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index c48d44958172..0331ea2701a3 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -478,7 +478,7 @@ else | |||
478 | endif | 478 | endif |
479 | 479 | ||
480 | ifeq ($(feature-libbfd), 1) | 480 | ifeq ($(feature-libbfd), 1) |
481 | EXTLIBS += -lbfd | 481 | EXTLIBS += -lbfd -lz -liberty |
482 | endif | 482 | endif |
483 | 483 | ||
484 | ifdef NO_DEMANGLE | 484 | ifdef NO_DEMANGLE |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 12e551346fa6..523b7bc10553 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -121,7 +121,7 @@ test-libpython-version.bin: | |||
121 | $(BUILD) $(FLAGS_PYTHON_EMBED) | 121 | $(BUILD) $(FLAGS_PYTHON_EMBED) |
122 | 122 | ||
123 | test-libbfd.bin: | 123 | test-libbfd.bin: |
124 | $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl | 124 | $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl |
125 | 125 | ||
126 | test-liberty.bin: | 126 | test-liberty.bin: |
127 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty | 127 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 469eb679fb9d..3aa555ff9d89 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -8,6 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "util.h" | 10 | #include "util.h" |
11 | #include "ui/ui.h" | ||
12 | #include "sort.h" | ||
11 | #include "build-id.h" | 13 | #include "build-id.h" |
12 | #include "color.h" | 14 | #include "color.h" |
13 | #include "cache.h" | 15 | #include "cache.h" |
@@ -489,7 +491,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
489 | { | 491 | { |
490 | struct annotation *notes; | 492 | struct annotation *notes; |
491 | 493 | ||
492 | if (sym == NULL || use_browser != 1 || !sort__has_sym) | 494 | if (sym == NULL) |
493 | return 0; | 495 | return 0; |
494 | 496 | ||
495 | notes = symbol__annotation(sym); | 497 | notes = symbol__annotation(sym); |
@@ -1399,3 +1401,8 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize) | |||
1399 | { | 1401 | { |
1400 | return symbol__annotate(he->ms.sym, he->ms.map, privsize); | 1402 | return symbol__annotate(he->ms.sym, he->ms.map, privsize); |
1401 | } | 1403 | } |
1404 | |||
1405 | bool ui__has_annotation(void) | ||
1406 | { | ||
1407 | return use_browser == 1 && sort__has_sym; | ||
1408 | } | ||
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index b2aef59d6bb2..56ad4f5287de 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -151,6 +151,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); | |||
151 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); | 151 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); |
152 | void disasm__purge(struct list_head *head); | 152 | void disasm__purge(struct list_head *head); |
153 | 153 | ||
154 | bool ui__has_annotation(void); | ||
155 | |||
154 | int symbol__tty_annotate(struct symbol *sym, struct map *map, | 156 | int symbol__tty_annotate(struct symbol *sym, struct map *map, |
155 | struct perf_evsel *evsel, bool print_lines, | 157 | struct perf_evsel *evsel, bool print_lines, |
156 | bool full_paths, int min_pcnt, int max_lines); | 158 | bool full_paths, int min_pcnt, int max_lines); |
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h index 45cf10a562bd..dadfa7e54287 100644 --- a/tools/perf/util/include/linux/bitops.h +++ b/tools/perf/util/include/linux/bitops.h | |||
@@ -87,13 +87,15 @@ static __always_inline unsigned long __ffs(unsigned long word) | |||
87 | return num; | 87 | return num; |
88 | } | 88 | } |
89 | 89 | ||
90 | typedef const unsigned long __attribute__((__may_alias__)) long_alias_t; | ||
91 | |||
90 | /* | 92 | /* |
91 | * Find the first set bit in a memory region. | 93 | * Find the first set bit in a memory region. |
92 | */ | 94 | */ |
93 | static inline unsigned long | 95 | static inline unsigned long |
94 | find_first_bit(const unsigned long *addr, unsigned long size) | 96 | find_first_bit(const unsigned long *addr, unsigned long size) |
95 | { | 97 | { |
96 | const unsigned long *p = addr; | 98 | long_alias_t *p = (long_alias_t *) addr; |
97 | unsigned long result = 0; | 99 | unsigned long result = 0; |
98 | unsigned long tmp; | 100 | unsigned long tmp; |
99 | 101 | ||
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index c872991e0f65..620a1983b76b 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1213,7 +1213,7 @@ static void ip__resolve_ams(struct machine *machine, struct thread *thread, | |||
1213 | */ | 1213 | */ |
1214 | thread__find_addr_location(thread, machine, m, MAP__FUNCTION, | 1214 | thread__find_addr_location(thread, machine, m, MAP__FUNCTION, |
1215 | ip, &al); | 1215 | ip, &al); |
1216 | if (al.sym) | 1216 | if (al.map) |
1217 | goto found; | 1217 | goto found; |
1218 | } | 1218 | } |
1219 | found: | 1219 | found: |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 3e9f336740fa..516d19fb999b 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -151,15 +151,15 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, | |||
151 | 151 | ||
152 | gelf_getshdr(sec, shp); | 152 | gelf_getshdr(sec, shp); |
153 | str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); | 153 | str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); |
154 | if (!strcmp(name, str)) { | 154 | if (str && !strcmp(name, str)) { |
155 | if (idx) | 155 | if (idx) |
156 | *idx = cnt; | 156 | *idx = cnt; |
157 | break; | 157 | return sec; |
158 | } | 158 | } |
159 | ++cnt; | 159 | ++cnt; |
160 | } | 160 | } |
161 | 161 | ||
162 | return sec; | 162 | return NULL; |
163 | } | 163 | } |
164 | 164 | ||
165 | #define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \ | 165 | #define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \ |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index a9d758a3b371..e89afc097d8a 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1336,6 +1336,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1336 | 1336 | ||
1337 | if (syms_ss && runtime_ss) | 1337 | if (syms_ss && runtime_ss) |
1338 | break; | 1338 | break; |
1339 | } else { | ||
1340 | symsrc__destroy(ss); | ||
1339 | } | 1341 | } |
1340 | 1342 | ||
1341 | } | 1343 | } |
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index d66418237d21..aa290c0de6f5 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c | |||
@@ -201,6 +201,7 @@ int main(int argc, char **argv) | |||
201 | 201 | ||
202 | msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666); | 202 | msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666); |
203 | if (msgque.msq_id == -1) { | 203 | if (msgque.msq_id == -1) { |
204 | err = -errno; | ||
204 | printf("Can't create queue\n"); | 205 | printf("Can't create queue\n"); |
205 | goto err_out; | 206 | goto err_out; |
206 | } | 207 | } |