diff options
1367 files changed, 15964 insertions, 7843 deletions
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index eee6f0f4aa43..3a626d1b8f2e 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml | |||
@@ -2545,6 +2545,30 @@ fields changed from _s32 to _u32. | |||
2545 | </orderedlist> | 2545 | </orderedlist> |
2546 | </section> | 2546 | </section> |
2547 | 2547 | ||
2548 | <section> | ||
2549 | <title>V4L2 in Linux 3.16</title> | ||
2550 | <orderedlist> | ||
2551 | <listitem> | ||
2552 | <para>Added event V4L2_EVENT_SOURCE_CHANGE. | ||
2553 | </para> | ||
2554 | </listitem> | ||
2555 | </orderedlist> | ||
2556 | </section> | ||
2557 | |||
2558 | <section> | ||
2559 | <title>V4L2 in Linux 3.17</title> | ||
2560 | <orderedlist> | ||
2561 | <listitem> | ||
2562 | <para>Extended &v4l2-pix-format;. Added format flags. | ||
2563 | </para> | ||
2564 | </listitem> | ||
2565 | <listitem> | ||
2566 | <para>Added compound control types and &VIDIOC-QUERY-EXT-CTRL;. | ||
2567 | </para> | ||
2568 | </listitem> | ||
2569 | </orderedlist> | ||
2570 | </section> | ||
2571 | |||
2548 | <section id="other"> | 2572 | <section id="other"> |
2549 | <title>Relation of V4L2 to other Linux multimedia APIs</title> | 2573 | <title>Relation of V4L2 to other Linux multimedia APIs</title> |
2550 | 2574 | ||
diff --git a/Documentation/DocBook/media/v4l/func-poll.xml b/Documentation/DocBook/media/v4l/func-poll.xml index 85cad8bff5ba..4c73f115219b 100644 --- a/Documentation/DocBook/media/v4l/func-poll.xml +++ b/Documentation/DocBook/media/v4l/func-poll.xml | |||
@@ -29,9 +29,12 @@ can suspend execution until the driver has captured data or is ready | |||
29 | to accept data for output.</para> | 29 | to accept data for output.</para> |
30 | 30 | ||
31 | <para>When streaming I/O has been negotiated this function waits | 31 | <para>When streaming I/O has been negotiated this function waits |
32 | until a buffer has been filled or displayed and can be dequeued with | 32 | until a buffer has been filled by the capture device and can be dequeued |
33 | the &VIDIOC-DQBUF; ioctl. When buffers are already in the outgoing | 33 | with the &VIDIOC-DQBUF; ioctl. For output devices this function waits |
34 | queue of the driver the function returns immediately.</para> | 34 | until the device is ready to accept a new buffer to be queued up with |
35 | the &VIDIOC-QBUF; ioctl for display. When buffers are already in the outgoing | ||
36 | queue of the driver (capture) or the incoming queue isn't full (display) | ||
37 | the function returns immediately.</para> | ||
35 | 38 | ||
36 | <para>On success <function>poll()</function> returns the number of | 39 | <para>On success <function>poll()</function> returns the number of |
37 | file descriptors that have been selected (that is, file descriptors | 40 | file descriptors that have been selected (that is, file descriptors |
@@ -44,10 +47,22 @@ Capture devices set the <constant>POLLIN</constant> and | |||
44 | flags. When the function timed out it returns a value of zero, on | 47 | flags. When the function timed out it returns a value of zero, on |
45 | failure it returns <returnvalue>-1</returnvalue> and the | 48 | failure it returns <returnvalue>-1</returnvalue> and the |
46 | <varname>errno</varname> variable is set appropriately. When the | 49 | <varname>errno</varname> variable is set appropriately. When the |
47 | application did not call &VIDIOC-QBUF; or &VIDIOC-STREAMON; yet the | 50 | application did not call &VIDIOC-STREAMON; the |
48 | <function>poll()</function> function succeeds, but sets the | 51 | <function>poll()</function> function succeeds, but sets the |
49 | <constant>POLLERR</constant> flag in the | 52 | <constant>POLLERR</constant> flag in the |
50 | <structfield>revents</structfield> field.</para> | 53 | <structfield>revents</structfield> field. When the |
54 | application has called &VIDIOC-STREAMON; for a capture device but hasn't | ||
55 | yet called &VIDIOC-QBUF;, the <function>poll()</function> function | ||
56 | succeeds and sets the <constant>POLLERR</constant> flag in the | ||
57 | <structfield>revents</structfield> field. For output devices this | ||
58 | same situation will cause <function>poll()</function> to succeed | ||
59 | as well, but it sets the <constant>POLLOUT</constant> and | ||
60 | <constant>POLLWRNORM</constant> flags in the <structfield>revents</structfield> | ||
61 | field.</para> | ||
62 | |||
63 | <para>If an event occurred (see &VIDIOC-DQEVENT;) then | ||
64 | <constant>POLLPRI</constant> will be set in the <structfield>revents</structfield> | ||
65 | field and <function>poll()</function> will return.</para> | ||
51 | 66 | ||
52 | <para>When use of the <function>read()</function> function has | 67 | <para>When use of the <function>read()</function> function has |
53 | been negotiated and the driver does not capture yet, the | 68 | been negotiated and the driver does not capture yet, the |
@@ -58,10 +73,18 @@ continuously (as opposed to, for example, still images) the function | |||
58 | may return immediately.</para> | 73 | may return immediately.</para> |
59 | 74 | ||
60 | <para>When use of the <function>write()</function> function has | 75 | <para>When use of the <function>write()</function> function has |
61 | been negotiated the <function>poll</function> function just waits | 76 | been negotiated and the driver does not stream yet, the |
77 | <function>poll</function> function starts streaming. When that fails | ||
78 | it returns a <constant>POLLERR</constant> as above. Otherwise it waits | ||
62 | until the driver is ready for a non-blocking | 79 | until the driver is ready for a non-blocking |
63 | <function>write()</function> call.</para> | 80 | <function>write()</function> call.</para> |
64 | 81 | ||
82 | <para>If the caller is only interested in events (just | ||
83 | <constant>POLLPRI</constant> is set in the <structfield>events</structfield> | ||
84 | field), then <function>poll()</function> will <emphasis>not</emphasis> | ||
85 | start streaming if the driver does not stream yet. This makes it | ||
86 | possible to just poll for events and not for buffers.</para> | ||
87 | |||
65 | <para>All drivers implementing the <function>read()</function> or | 88 | <para>All drivers implementing the <function>read()</function> or |
66 | <function>write()</function> function or streaming I/O must also | 89 | <function>write()</function> function or streaming I/O must also |
67 | support the <function>poll()</function> function.</para> | 90 | support the <function>poll()</function> function.</para> |
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index f2f81f06a17b..7cfe618f754d 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml | |||
@@ -152,10 +152,11 @@ structs, ioctls) must be noted in more detail in the history chapter | |||
152 | applications. --> | 152 | applications. --> |
153 | 153 | ||
154 | <revision> | 154 | <revision> |
155 | <revnumber>3.16</revnumber> | 155 | <revnumber>3.17</revnumber> |
156 | <date>2014-05-27</date> | 156 | <date>2014-08-04</date> |
157 | <authorinitials>lp</authorinitials> | 157 | <authorinitials>lp, hv</authorinitials> |
158 | <revremark>Extended &v4l2-pix-format;. Added format flags. | 158 | <revremark>Extended &v4l2-pix-format;. Added format flags. Added compound control types |
159 | and VIDIOC_QUERY_EXT_CTRL. | ||
159 | </revremark> | 160 | </revremark> |
160 | </revision> | 161 | </revision> |
161 | 162 | ||
@@ -538,7 +539,7 @@ and discussions on the V4L mailing list.</revremark> | |||
538 | </partinfo> | 539 | </partinfo> |
539 | 540 | ||
540 | <title>Video for Linux Two API Specification</title> | 541 | <title>Video for Linux Two API Specification</title> |
541 | <subtitle>Revision 3.14</subtitle> | 542 | <subtitle>Revision 3.17</subtitle> |
542 | 543 | ||
543 | <chapter id="common"> | 544 | <chapter id="common"> |
544 | &sub-common; | 545 | &sub-common; |
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml index 1ba9e999af3f..c62a7360719b 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml | |||
@@ -119,7 +119,7 @@ | |||
119 | </row> | 119 | </row> |
120 | <row> | 120 | <row> |
121 | <entry>&v4l2-rect;</entry> | 121 | <entry>&v4l2-rect;</entry> |
122 | <entry><structfield>rect</structfield></entry> | 122 | <entry><structfield>r</structfield></entry> |
123 | <entry>Selection rectangle, in pixels.</entry> | 123 | <entry>Selection rectangle, in pixels.</entry> |
124 | </row> | 124 | </row> |
125 | <row> | 125 | <row> |
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 0a523c9a5ff4..482c74947de0 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -794,6 +794,7 @@ Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". | |||
794 | <http://www.kroah.com/log/linux/maintainer-03.html> | 794 | <http://www.kroah.com/log/linux/maintainer-03.html> |
795 | <http://www.kroah.com/log/linux/maintainer-04.html> | 795 | <http://www.kroah.com/log/linux/maintainer-04.html> |
796 | <http://www.kroah.com/log/linux/maintainer-05.html> | 796 | <http://www.kroah.com/log/linux/maintainer-05.html> |
797 | <http://www.kroah.com/log/linux/maintainer-06.html> | ||
797 | 798 | ||
798 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! | 799 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! |
799 | <https://lkml.org/lkml/2005/7/11/336> | 800 | <https://lkml.org/lkml/2005/7/11/336> |
diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt index 7740038d82bc..3c94ff3f9693 100644 --- a/Documentation/cgroups/cpusets.txt +++ b/Documentation/cgroups/cpusets.txt | |||
@@ -345,14 +345,14 @@ the named feature on. | |||
345 | The implementation is simple. | 345 | The implementation is simple. |
346 | 346 | ||
347 | Setting the flag 'cpuset.memory_spread_page' turns on a per-process flag | 347 | Setting the flag 'cpuset.memory_spread_page' turns on a per-process flag |
348 | PF_SPREAD_PAGE for each task that is in that cpuset or subsequently | 348 | PFA_SPREAD_PAGE for each task that is in that cpuset or subsequently |
349 | joins that cpuset. The page allocation calls for the page cache | 349 | joins that cpuset. The page allocation calls for the page cache |
350 | is modified to perform an inline check for this PF_SPREAD_PAGE task | 350 | is modified to perform an inline check for this PFA_SPREAD_PAGE task |
351 | flag, and if set, a call to a new routine cpuset_mem_spread_node() | 351 | flag, and if set, a call to a new routine cpuset_mem_spread_node() |
352 | returns the node to prefer for the allocation. | 352 | returns the node to prefer for the allocation. |
353 | 353 | ||
354 | Similarly, setting 'cpuset.memory_spread_slab' turns on the flag | 354 | Similarly, setting 'cpuset.memory_spread_slab' turns on the flag |
355 | PF_SPREAD_SLAB, and appropriately marked slab caches will allocate | 355 | PFA_SPREAD_SLAB, and appropriately marked slab caches will allocate |
356 | pages from the node returned by cpuset_mem_spread_node(). | 356 | pages from the node returned by cpuset_mem_spread_node(). |
357 | 357 | ||
358 | The cpuset_mem_spread_node() routine is also simple. It uses the | 358 | The cpuset_mem_spread_node() routine is also simple. It uses the |
diff --git a/Documentation/devicetree/bindings/dma/rcar-audmapp.txt b/Documentation/devicetree/bindings/dma/rcar-audmapp.txt index 9f1d750d76de..61bca509d7b9 100644 --- a/Documentation/devicetree/bindings/dma/rcar-audmapp.txt +++ b/Documentation/devicetree/bindings/dma/rcar-audmapp.txt | |||
@@ -16,9 +16,9 @@ Example: | |||
16 | * DMA client | 16 | * DMA client |
17 | 17 | ||
18 | Required properties: | 18 | Required properties: |
19 | - dmas: a list of <[DMA multiplexer phandle] [SRS/DRS value]> pairs, | 19 | - dmas: a list of <[DMA multiplexer phandle] [SRS << 8 | DRS]> pairs. |
20 | where SRS/DRS values are fixed handles, specified in the SoC | 20 | where SRS/DRS are specified in the SoC manual. |
21 | manual as the value that would be written into the PDMACHCR. | 21 | It will be written into PDMACHCR as high 16-bit parts. |
22 | - dma-names: a list of DMA channel names, one per "dmas" entry | 22 | - dma-names: a list of DMA channel names, one per "dmas" entry |
23 | 23 | ||
24 | Example: | 24 | Example: |
diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt index baef432e8369..1852906517ab 100644 --- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt | |||
@@ -11,10 +11,17 @@ Required properties: | |||
11 | 11 | ||
12 | Optional properties for main touchpad device: | 12 | Optional properties for main touchpad device: |
13 | 13 | ||
14 | - linux,gpio-keymap: An array of up to 4 entries indicating the Linux | 14 | - linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages |
15 | keycode generated by each GPIO. Linux keycodes are defined in | 15 | on GPIO bit changes. An array of up to 8 entries can be provided |
16 | indicating the Linux keycode mapped to each bit of the status byte, | ||
17 | starting at the LSB. Linux keycodes are defined in | ||
16 | <dt-bindings/input/input.h>. | 18 | <dt-bindings/input/input.h>. |
17 | 19 | ||
20 | Note: the numbering of the GPIOs and the bit they start at varies between | ||
21 | maXTouch devices. You must either refer to the documentation, or | ||
22 | experiment to determine which bit corresponds to which input. Use | ||
23 | KEY_RESERVED for unused padding values. | ||
24 | |||
18 | Example: | 25 | Example: |
19 | 26 | ||
20 | touch@4b { | 27 | touch@4b { |
diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt index 1486497a24c1..ce6a1a072028 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt | |||
@@ -4,11 +4,13 @@ Specifying interrupt information for devices | |||
4 | 1) Interrupt client nodes | 4 | 1) Interrupt client nodes |
5 | ------------------------- | 5 | ------------------------- |
6 | 6 | ||
7 | Nodes that describe devices which generate interrupts must contain an either an | 7 | Nodes that describe devices which generate interrupts must contain an |
8 | "interrupts" property or an "interrupts-extended" property. These properties | 8 | "interrupts" property, an "interrupts-extended" property, or both. If both are |
9 | contain a list of interrupt specifiers, one per output interrupt. The format of | 9 | present, the latter should take precedence; the former may be provided simply |
10 | the interrupt specifier is determined by the interrupt controller to which the | 10 | for compatibility with software that does not recognize the latter. These |
11 | interrupts are routed; see section 2 below for details. | 11 | properties contain a list of interrupt specifiers, one per output interrupt. The |
12 | format of the interrupt specifier is determined by the interrupt controller to | ||
13 | which the interrupts are routed; see section 2 below for details. | ||
12 | 14 | ||
13 | Example: | 15 | Example: |
14 | interrupt-parent = <&intc1>; | 16 | interrupt-parent = <&intc1>; |
diff --git a/Documentation/devicetree/bindings/mfd/tc3589x.txt b/Documentation/devicetree/bindings/mfd/tc3589x.txt new file mode 100644 index 000000000000..6fcedba46ae9 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/tc3589x.txt | |||
@@ -0,0 +1,107 @@ | |||
1 | * Toshiba TC3589x multi-purpose expander | ||
2 | |||
3 | The Toshiba TC3589x series are I2C-based MFD devices which may expose the | ||
4 | following built-in devices: gpio, keypad, rotator (vibrator), PWM (for | ||
5 | e.g. LEDs or vibrators) The included models are: | ||
6 | |||
7 | - TC35890 | ||
8 | - TC35892 | ||
9 | - TC35893 | ||
10 | - TC35894 | ||
11 | - TC35895 | ||
12 | - TC35896 | ||
13 | |||
14 | Required properties: | ||
15 | - compatible : must be "toshiba,tc35890", "toshiba,tc35892", "toshiba,tc35893", | ||
16 | "toshiba,tc35894", "toshiba,tc35895" or "toshiba,tc35896" | ||
17 | - reg : I2C address of the device | ||
18 | - interrupt-parent : specifies which IRQ controller we're connected to | ||
19 | - interrupts : the interrupt on the parent the controller is connected to | ||
20 | - interrupt-controller : marks the device node as an interrupt controller | ||
21 | - #interrupt-cells : should be <1>, the first cell is the IRQ offset on this | ||
22 | TC3589x interrupt controller. | ||
23 | |||
24 | Optional nodes: | ||
25 | |||
26 | - GPIO | ||
27 | This GPIO module inside the TC3589x has 24 (TC35890, TC35892) or 20 | ||
28 | (other models) GPIO lines. | ||
29 | - compatible : must be "toshiba,tc3589x-gpio" | ||
30 | - interrupts : interrupt on the parent, which must be the tc3589x MFD device | ||
31 | - interrupt-controller : marks the device node as an interrupt controller | ||
32 | - #interrupt-cells : should be <2>, the first cell is the IRQ offset on this | ||
33 | TC3589x GPIO interrupt controller, the second cell is the interrupt flags | ||
34 | in accordance with <dt-bindings/interrupt-controller/irq.h>. The following | ||
35 | flags are valid: | ||
36 | - IRQ_TYPE_LEVEL_LOW | ||
37 | - IRQ_TYPE_LEVEL_HIGH | ||
38 | - IRQ_TYPE_EDGE_RISING | ||
39 | - IRQ_TYPE_EDGE_FALLING | ||
40 | - IRQ_TYPE_EDGE_BOTH | ||
41 | - gpio-controller : marks the device node as a GPIO controller | ||
42 | - #gpio-cells : should be <2>, the first cell is the GPIO offset on this | ||
43 | GPIO controller, the second cell is the flags. | ||
44 | |||
45 | - Keypad | ||
46 | This keypad is the same on all variants, supporting up to 96 different | ||
47 | keys. The linux-specific properties are modeled on those already existing | ||
48 | in other input drivers. | ||
49 | - compatible : must be "toshiba,tc3589x-keypad" | ||
50 | - debounce-delay-ms : debounce interval in milliseconds | ||
51 | - keypad,num-rows : number of rows in the matrix, see | ||
52 | bindings/input/matrix-keymap.txt | ||
53 | - keypad,num-columns : number of columns in the matrix, see | ||
54 | bindings/input/matrix-keymap.txt | ||
55 | - linux,keymap: the definition can be found in | ||
56 | bindings/input/matrix-keymap.txt | ||
57 | - linux,no-autorepeat: do no enable autorepeat feature. | ||
58 | - linux,wakeup: use any event on keypad as wakeup event. | ||
59 | |||
60 | Example: | ||
61 | |||
62 | tc35893@44 { | ||
63 | compatible = "toshiba,tc35893"; | ||
64 | reg = <0x44>; | ||
65 | interrupt-parent = <&gpio6>; | ||
66 | interrupts = <26 IRQ_TYPE_EDGE_RISING>; | ||
67 | |||
68 | interrupt-controller; | ||
69 | #interrupt-cells = <1>; | ||
70 | |||
71 | tc3589x_gpio { | ||
72 | compatible = "toshiba,tc3589x-gpio"; | ||
73 | interrupts = <0>; | ||
74 | |||
75 | interrupt-controller; | ||
76 | #interrupt-cells = <2>; | ||
77 | gpio-controller; | ||
78 | #gpio-cells = <2>; | ||
79 | }; | ||
80 | tc3589x_keypad { | ||
81 | compatible = "toshiba,tc3589x-keypad"; | ||
82 | interrupts = <6>; | ||
83 | debounce-delay-ms = <4>; | ||
84 | keypad,num-columns = <8>; | ||
85 | keypad,num-rows = <8>; | ||
86 | linux,no-autorepeat; | ||
87 | linux,wakeup; | ||
88 | linux,keymap = <0x0301006b | ||
89 | 0x04010066 | ||
90 | 0x06040072 | ||
91 | 0x040200d7 | ||
92 | 0x0303006a | ||
93 | 0x0205000e | ||
94 | 0x0607008b | ||
95 | 0x0500001c | ||
96 | 0x0403000b | ||
97 | 0x03040034 | ||
98 | 0x05020067 | ||
99 | 0x0305006c | ||
100 | 0x040500e7 | ||
101 | 0x0005009e | ||
102 | 0x06020073 | ||
103 | 0x01030039 | ||
104 | 0x07060069 | ||
105 | 0x050500d9>; | ||
106 | }; | ||
107 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt index 65f4f7c43136..ee654e95d8ad 100644 --- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt +++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt | |||
@@ -22,7 +22,7 @@ Optional properties: | |||
22 | width of 8 is assumed. | 22 | width of 8 is assumed. |
23 | 23 | ||
24 | - ti,nand-ecc-opt: A string setting the ECC layout to use. One of: | 24 | - ti,nand-ecc-opt: A string setting the ECC layout to use. One of: |
25 | "sw" <deprecated> use "ham1" instead | 25 | "sw" 1-bit Hamming ecc code via software |
26 | "hw" <deprecated> use "ham1" instead | 26 | "hw" <deprecated> use "ham1" instead |
27 | "hw-romcode" <deprecated> use "ham1" instead | 27 | "hw-romcode" <deprecated> use "ham1" instead |
28 | "ham1" 1-bit Hamming ecc code | 28 | "ham1" 1-bit Hamming ecc code |
diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt index 9b03c57563a4..e45ac3f926b1 100644 --- a/Documentation/devicetree/bindings/net/stmmac.txt +++ b/Documentation/devicetree/bindings/net/stmmac.txt | |||
@@ -39,6 +39,10 @@ Optional properties: | |||
39 | further clocks may be specified in derived bindings. | 39 | further clocks may be specified in derived bindings. |
40 | - clock-names: One name for each entry in the clocks property, the | 40 | - clock-names: One name for each entry in the clocks property, the |
41 | first one should be "stmmaceth". | 41 | first one should be "stmmaceth". |
42 | - clk_ptp_ref: this is the PTP reference clock; in case of the PTP is | ||
43 | available this clock is used for programming the Timestamp Addend Register. | ||
44 | If not passed then the system clock will be used and this is fine on some | ||
45 | platforms. | ||
42 | 46 | ||
43 | Examples: | 47 | Examples: |
44 | 48 | ||
diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt index d0d15ee42834..ed0d9b9fff2b 100644 --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt | |||
@@ -2,6 +2,10 @@ | |||
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: should contain "snps,dw-pcie" to identify the core. | 4 | - compatible: should contain "snps,dw-pcie" to identify the core. |
5 | - reg: Should contain the configuration address space. | ||
6 | - reg-names: Must be "config" for the PCIe configuration space. | ||
7 | (The old way of getting the configuration address space from "ranges" | ||
8 | is deprecated and should be avoided.) | ||
5 | - #address-cells: set to <3> | 9 | - #address-cells: set to <3> |
6 | - #size-cells: set to <2> | 10 | - #size-cells: set to <2> |
7 | - device_type: set to "pci" | 11 | - device_type: set to "pci" |
diff --git a/Documentation/devicetree/bindings/pci/ti-pci.txt b/Documentation/devicetree/bindings/pci/ti-pci.txt new file mode 100644 index 000000000000..3d217911b313 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/ti-pci.txt | |||
@@ -0,0 +1,59 @@ | |||
1 | TI PCI Controllers | ||
2 | |||
3 | PCIe Designware Controller | ||
4 | - compatible: Should be "ti,dra7-pcie"" | ||
5 | - reg : Two register ranges as listed in the reg-names property | ||
6 | - reg-names : The first entry must be "ti-conf" for the TI specific registers | ||
7 | The second entry must be "rc-dbics" for the designware pcie | ||
8 | registers | ||
9 | The third entry must be "config" for the PCIe configuration space | ||
10 | - phys : list of PHY specifiers (used by generic PHY framework) | ||
11 | - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the | ||
12 | number of PHYs as specified in *phys* property. | ||
13 | - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", | ||
14 | where <X> is the instance number of the pcie from the HW spec. | ||
15 | - interrupts : Two interrupt entries must be specified. The first one is for | ||
16 | main interrupt line and the second for MSI interrupt line. | ||
17 | - #address-cells, | ||
18 | #size-cells, | ||
19 | #interrupt-cells, | ||
20 | device_type, | ||
21 | ranges, | ||
22 | num-lanes, | ||
23 | interrupt-map-mask, | ||
24 | interrupt-map : as specified in ../designware-pcie.txt | ||
25 | |||
26 | Example: | ||
27 | axi { | ||
28 | compatible = "simple-bus"; | ||
29 | #size-cells = <1>; | ||
30 | #address-cells = <1>; | ||
31 | ranges = <0x51000000 0x51000000 0x3000 | ||
32 | 0x0 0x20000000 0x10000000>; | ||
33 | pcie@51000000 { | ||
34 | compatible = "ti,dra7-pcie"; | ||
35 | reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; | ||
36 | reg-names = "rc_dbics", "ti_conf", "config"; | ||
37 | interrupts = <0 232 0x4>, <0 233 0x4>; | ||
38 | #address-cells = <3>; | ||
39 | #size-cells = <2>; | ||
40 | device_type = "pci"; | ||
41 | ranges = <0x81000000 0 0 0x03000 0 0x00010000 | ||
42 | 0x82000000 0 0x20013000 0x13000 0 0xffed000>; | ||
43 | #interrupt-cells = <1>; | ||
44 | num-lanes = <1>; | ||
45 | ti,hwmods = "pcie1"; | ||
46 | phys = <&pcie1_phy>; | ||
47 | phy-names = "pcie-phy0"; | ||
48 | interrupt-map-mask = <0 0 0 7>; | ||
49 | interrupt-map = <0 0 0 1 &pcie_intc 1>, | ||
50 | <0 0 0 2 &pcie_intc 2>, | ||
51 | <0 0 0 3 &pcie_intc 3>, | ||
52 | <0 0 0 4 &pcie_intc 4>; | ||
53 | pcie_intc: interrupt-controller { | ||
54 | interrupt-controller; | ||
55 | #address-cells = <0>; | ||
56 | #interrupt-cells = <1>; | ||
57 | }; | ||
58 | }; | ||
59 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt index 0211c6d8a522..92fae82f35f2 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt | |||
@@ -62,7 +62,7 @@ Example: | |||
62 | #gpio-cells = <2>; | 62 | #gpio-cells = <2>; |
63 | interrupt-controller; | 63 | interrupt-controller; |
64 | #interrupt-cells = <2>; | 64 | #interrupt-cells = <2>; |
65 | interrupts = <0 32 0x4>; | 65 | interrupts = <0 16 0x4>; |
66 | 66 | ||
67 | pinctrl-names = "default"; | 67 | pinctrl-names = "default"; |
68 | pinctrl-0 = <&gsbi5_uart_default>; | 68 | pinctrl-0 = <&gsbi5_uart_default>; |
diff --git a/Documentation/devicetree/bindings/regmap/regmap.txt b/Documentation/devicetree/bindings/regmap/regmap.txt new file mode 100644 index 000000000000..b494f8b8ef72 --- /dev/null +++ b/Documentation/devicetree/bindings/regmap/regmap.txt | |||
@@ -0,0 +1,47 @@ | |||
1 | Device-Tree binding for regmap | ||
2 | |||
3 | The endianness mode of CPU & Device scenarios: | ||
4 | Index Device Endianness properties | ||
5 | --------------------------------------------------- | ||
6 | 1 BE 'big-endian' | ||
7 | 2 LE 'little-endian' | ||
8 | |||
9 | For one device driver, which will run in different scenarios above | ||
10 | on different SoCs using the devicetree, we need one way to simplify | ||
11 | this. | ||
12 | |||
13 | Required properties: | ||
14 | - {big,little}-endian: these are boolean properties, if absent | ||
15 | meaning that the CPU and the Device are in the same endianness mode, | ||
16 | these properties are for register values and all the buffers only. | ||
17 | |||
18 | Examples: | ||
19 | Scenario 1 : CPU in LE mode & device in LE mode. | ||
20 | dev: dev@40031000 { | ||
21 | compatible = "name"; | ||
22 | reg = <0x40031000 0x1000>; | ||
23 | ... | ||
24 | }; | ||
25 | |||
26 | Scenario 2 : CPU in LE mode & device in BE mode. | ||
27 | dev: dev@40031000 { | ||
28 | compatible = "name"; | ||
29 | reg = <0x40031000 0x1000>; | ||
30 | ... | ||
31 | big-endian; | ||
32 | }; | ||
33 | |||
34 | Scenario 3 : CPU in BE mode & device in BE mode. | ||
35 | dev: dev@40031000 { | ||
36 | compatible = "name"; | ||
37 | reg = <0x40031000 0x1000>; | ||
38 | ... | ||
39 | }; | ||
40 | |||
41 | Scenario 4 : CPU in BE mode & device in LE mode. | ||
42 | dev: dev@40031000 { | ||
43 | compatible = "name"; | ||
44 | reg = <0x40031000 0x1000>; | ||
45 | ... | ||
46 | little-endian; | ||
47 | }; | ||
diff --git a/Documentation/devicetree/bindings/regulator/tps65090.txt b/Documentation/devicetree/bindings/regulator/tps65090.txt index 340980239ea9..ca69f5e3040c 100644 --- a/Documentation/devicetree/bindings/regulator/tps65090.txt +++ b/Documentation/devicetree/bindings/regulator/tps65090.txt | |||
@@ -45,8 +45,8 @@ Example: | |||
45 | infet5-supply = <&some_reg>; | 45 | infet5-supply = <&some_reg>; |
46 | infet6-supply = <&some_reg>; | 46 | infet6-supply = <&some_reg>; |
47 | infet7-supply = <&some_reg>; | 47 | infet7-supply = <&some_reg>; |
48 | vsys_l1-supply = <&some_reg>; | 48 | vsys-l1-supply = <&some_reg>; |
49 | vsys_l2-supply = <&some_reg>; | 49 | vsys-l2-supply = <&some_reg>; |
50 | 50 | ||
51 | regulators { | 51 | regulators { |
52 | dcdc1 { | 52 | dcdc1 { |
diff --git a/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt b/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt index 46f344965313..4eb7997674a0 100644 --- a/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt +++ b/Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | ADI AXI-SPDIF controller | 1 | ADI AXI-SPDIF controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : Must be "adi,axi-spdif-1.00.a" | 4 | - compatible : Must be "adi,axi-spdif-tx-1.00.a" |
5 | - reg : Must contain SPDIF core's registers location and length | 5 | - reg : Must contain SPDIF core's registers location and length |
6 | - clocks : Pairs of phandle and specifier referencing the controller's clocks. | 6 | - clocks : Pairs of phandle and specifier referencing the controller's clocks. |
7 | The controller expects two clocks, the clock used for the AXI interface and | 7 | The controller expects two clocks, the clock used for the AXI interface and |
diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt index 6c55fcfe5e1d..9b82c20b306b 100644 --- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt +++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt | |||
@@ -31,7 +31,7 @@ i2s@ff890000 { | |||
31 | #address-cells = <1>; | 31 | #address-cells = <1>; |
32 | #size-cells = <0>; | 32 | #size-cells = <0>; |
33 | dmas = <&pdma1 0>, <&pdma1 1>; | 33 | dmas = <&pdma1 0>, <&pdma1 1>; |
34 | dma-names = "rx", "tx"; | 34 | dma-names = "tx", "rx"; |
35 | clock-names = "i2s_hclk", "i2s_clk"; | 35 | clock-names = "i2s_hclk", "i2s_clk"; |
36 | clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; | 36 | clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; |
37 | }; | 37 | }; |
diff --git a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt index 4256a6df9b79..aad527b357a0 100644 --- a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt +++ b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt | |||
@@ -7,6 +7,9 @@ Required properties: | |||
7 | - interrupts : Should contain CSPI/eCSPI interrupt | 7 | - interrupts : Should contain CSPI/eCSPI interrupt |
8 | - fsl,spi-num-chipselects : Contains the number of the chipselect | 8 | - fsl,spi-num-chipselects : Contains the number of the chipselect |
9 | - cs-gpios : Specifies the gpio pins to be used for chipselects. | 9 | - cs-gpios : Specifies the gpio pins to be used for chipselects. |
10 | - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, | ||
11 | Documentation/devicetree/bindings/dma/dma.txt | ||
12 | - dma-names: DMA request names should include "tx" and "rx" if present. | ||
10 | 13 | ||
11 | Example: | 14 | Example: |
12 | 15 | ||
@@ -19,4 +22,6 @@ ecspi@70010000 { | |||
19 | fsl,spi-num-chipselects = <2>; | 22 | fsl,spi-num-chipselects = <2>; |
20 | cs-gpios = <&gpio3 24 0>, /* GPIO3_24 */ | 23 | cs-gpios = <&gpio3 24 0>, /* GPIO3_24 */ |
21 | <&gpio3 25 0>; /* GPIO3_25 */ | 24 | <&gpio3 25 0>; /* GPIO3_25 */ |
25 | dmas = <&sdma 3 7 1>, <&sdma 4 7 2>; | ||
26 | dma-names = "rx", "tx"; | ||
22 | }; | 27 | }; |
diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt b/Documentation/devicetree/bindings/spi/sh-msiof.txt index f24baf3b6cc1..d11c3721e7cd 100644 --- a/Documentation/devicetree/bindings/spi/sh-msiof.txt +++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt | |||
@@ -6,8 +6,17 @@ Required properties: | |||
6 | "renesas,sh-mobile-msiof" for SH Mobile series. | 6 | "renesas,sh-mobile-msiof" for SH Mobile series. |
7 | Examples with soctypes are: | 7 | Examples with soctypes are: |
8 | "renesas,msiof-r8a7790" (R-Car H2) | 8 | "renesas,msiof-r8a7790" (R-Car H2) |
9 | "renesas,msiof-r8a7791" (R-Car M2) | 9 | "renesas,msiof-r8a7791" (R-Car M2-W) |
10 | - reg : Offset and length of the register set for the device | 10 | "renesas,msiof-r8a7792" (R-Car V2H) |
11 | "renesas,msiof-r8a7793" (R-Car M2-N) | ||
12 | "renesas,msiof-r8a7794" (R-Car E2) | ||
13 | - reg : A list of offsets and lengths of the register sets for | ||
14 | the device. | ||
15 | If only one register set is present, it is to be used | ||
16 | by both the CPU and the DMA engine. | ||
17 | If two register sets are present, the first is to be | ||
18 | used by the CPU, and the second is to be used by the | ||
19 | DMA engine. | ||
11 | - interrupt-parent : The phandle for the interrupt controller that | 20 | - interrupt-parent : The phandle for the interrupt controller that |
12 | services interrupts for this device | 21 | services interrupts for this device |
13 | - interrupts : Interrupt specifier | 22 | - interrupts : Interrupt specifier |
@@ -17,12 +26,16 @@ Required properties: | |||
17 | Optional properties: | 26 | Optional properties: |
18 | - clocks : Must contain a reference to the functional clock. | 27 | - clocks : Must contain a reference to the functional clock. |
19 | - num-cs : Total number of chip-selects (default is 1) | 28 | - num-cs : Total number of chip-selects (default is 1) |
29 | - dmas : Must contain a list of two references to DMA | ||
30 | specifiers, one for transmission, and one for | ||
31 | reception. | ||
32 | - dma-names : Must contain a list of two DMA names, "tx" and "rx". | ||
20 | 33 | ||
21 | Optional properties, deprecated for soctype-specific bindings: | 34 | Optional properties, deprecated for soctype-specific bindings: |
22 | - renesas,tx-fifo-size : Overrides the default tx fifo size given in words | 35 | - renesas,tx-fifo-size : Overrides the default tx fifo size given in words |
23 | (default is 64) | 36 | (default is 64) |
24 | - renesas,rx-fifo-size : Overrides the default rx fifo size given in words | 37 | - renesas,rx-fifo-size : Overrides the default rx fifo size given in words |
25 | (default is 64, or 256 on R-Car H2 and M2) | 38 | (default is 64, or 256 on R-Car Gen2) |
26 | 39 | ||
27 | Pinctrl properties might be needed, too. See | 40 | Pinctrl properties might be needed, too. See |
28 | Documentation/devicetree/bindings/pinctrl/renesas,*. | 41 | Documentation/devicetree/bindings/pinctrl/renesas,*. |
@@ -31,9 +44,11 @@ Example: | |||
31 | 44 | ||
32 | msiof0: spi@e6e20000 { | 45 | msiof0: spi@e6e20000 { |
33 | compatible = "renesas,msiof-r8a7791"; | 46 | compatible = "renesas,msiof-r8a7791"; |
34 | reg = <0 0xe6e20000 0 0x0064>; | 47 | reg = <0 0xe6e20000 0 0x0064>, <0 0xe7e20000 0 0x0064>; |
35 | interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>; | 48 | interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>; |
36 | clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>; | 49 | clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>; |
50 | dmas = <&dmac0 0x51>, <&dmac0 0x52>; | ||
51 | dma-names = "tx", "rx"; | ||
37 | #address-cells = <1>; | 52 | #address-cells = <1>; |
38 | #size-cells = <0>; | 53 | #size-cells = <0>; |
39 | status = "disabled"; | 54 | status = "disabled"; |
diff --git a/Documentation/devicetree/bindings/spi/spi-davinci.txt b/Documentation/devicetree/bindings/spi/spi-davinci.txt index f80887bca0d6..12ecfe9e3599 100644 --- a/Documentation/devicetree/bindings/spi/spi-davinci.txt +++ b/Documentation/devicetree/bindings/spi/spi-davinci.txt | |||
@@ -1,5 +1,10 @@ | |||
1 | Davinci SPI controller device bindings | 1 | Davinci SPI controller device bindings |
2 | 2 | ||
3 | Links on DM: | ||
4 | Keystone 2 - http://www.ti.com/lit/ug/sprugp2a/sprugp2a.pdf | ||
5 | dm644x - http://www.ti.com/lit/ug/sprue32a/sprue32a.pdf | ||
6 | OMAP-L138/da830 - http://www.ti.com/lit/ug/spruh77a/spruh77a.pdf | ||
7 | |||
3 | Required properties: | 8 | Required properties: |
4 | - #address-cells: number of cells required to define a chip select | 9 | - #address-cells: number of cells required to define a chip select |
5 | address on the SPI bus. Should be set to 1. | 10 | address on the SPI bus. Should be set to 1. |
@@ -24,6 +29,30 @@ Optional: | |||
24 | cs-gpios = <0>, <0>, <0>, <&gpio1 30 0>, <&gpio1 31 0>; | 29 | cs-gpios = <0>, <0>, <0>, <&gpio1 30 0>, <&gpio1 31 0>; |
25 | where first three are internal CS and last two are GPIO CS. | 30 | where first three are internal CS and last two are GPIO CS. |
26 | 31 | ||
32 | Optional properties for slave devices: | ||
33 | SPI slave nodes can contain the following properties. | ||
34 | Not all SPI Peripherals from Texas Instruments support this. | ||
35 | Please check SPI peripheral documentation for a device before using these. | ||
36 | |||
37 | - ti,spi-wdelay : delay between transmission of words | ||
38 | (SPIFMTn.WDELAY, SPIDAT1.WDEL) must be specified in number of SPI module | ||
39 | clock periods. | ||
40 | |||
41 | delay = WDELAY * SPI_module_clock_period + 2 * SPI_module_clock_period | ||
42 | |||
43 | Below is timing diagram which shows functional meaning of | ||
44 | "ti,spi-wdelay" parameter. | ||
45 | |||
46 | +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ | ||
47 | SPI_CLK | | | | | | | | | | | | | | | | | ||
48 | +----------+ +-+ +-+ +-+ +-+ +---------------------------+ +-+ +-+ +- | ||
49 | |||
50 | SPI_SOMI/SIMO+-----------------+ +----------- | ||
51 | +----------+ word1 +---------------------------+word2 | ||
52 | +-----------------+ +----------- | ||
53 | WDELAY | ||
54 | <--------------------------> | ||
55 | |||
27 | Example of a NOR flash slave device (n25q032) connected to DaVinci | 56 | Example of a NOR flash slave device (n25q032) connected to DaVinci |
28 | SPI controller device over the SPI bus. | 57 | SPI controller device over the SPI bus. |
29 | 58 | ||
@@ -43,6 +72,7 @@ spi0:spi@20BF0000 { | |||
43 | compatible = "st,m25p32"; | 72 | compatible = "st,m25p32"; |
44 | spi-max-frequency = <25000000>; | 73 | spi-max-frequency = <25000000>; |
45 | reg = <0>; | 74 | reg = <0>; |
75 | ti,spi-wdelay = <8>; | ||
46 | 76 | ||
47 | partition@0 { | 77 | partition@0 { |
48 | label = "u-boot-spl"; | 78 | label = "u-boot-spl"; |
diff --git a/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt b/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt index 5376de40f10b..cbbe16ed3874 100644 --- a/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt +++ b/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt | |||
@@ -10,7 +10,12 @@ 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 | |
14 | Optional property: | ||
15 | - big-endian: If present the dspi device's registers are implemented | ||
16 | in big endian mode, otherwise in native mode(same with CPU), for more | ||
17 | detail please see: Documentation/devicetree/bindings/regmap/regmap.txt. | ||
18 | |||
14 | Example: | 19 | Example: |
15 | 20 | ||
16 | dspi0@4002c000 { | 21 | dspi0@4002c000 { |
diff --git a/Documentation/devicetree/bindings/spi/spi-orion.txt b/Documentation/devicetree/bindings/spi/spi-orion.txt index a3ff50fc76fb..50c3a3de61c1 100644 --- a/Documentation/devicetree/bindings/spi/spi-orion.txt +++ b/Documentation/devicetree/bindings/spi/spi-orion.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | Marvell Orion SPI device | 1 | Marvell Orion SPI device |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : should be "marvell,orion-spi". | 4 | - compatible : should be "marvell,orion-spi" or "marvell,armada-370-spi". |
5 | - reg : offset and length of the register set for the device | 5 | - reg : offset and length of the register set for the device |
6 | - cell-index : Which of multiple SPI controllers is this. | 6 | - cell-index : Which of multiple SPI controllers is this. |
7 | Optional properties: | 7 | Optional properties: |
diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.txt b/Documentation/devicetree/bindings/spi/spi-rockchip.txt index 7bab35575817..467dec441c62 100644 --- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt +++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt | |||
@@ -16,11 +16,15 @@ Required Properties: | |||
16 | - clocks: Must contain an entry for each entry in clock-names. | 16 | - clocks: Must contain an entry for each entry in clock-names. |
17 | - clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for | 17 | - clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for |
18 | the peripheral clock. | 18 | the peripheral clock. |
19 | - #address-cells: should be 1. | ||
20 | - #size-cells: should be 0. | ||
21 | |||
22 | Optional Properties: | ||
23 | |||
19 | - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, | 24 | - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, |
20 | Documentation/devicetree/bindings/dma/dma.txt | 25 | Documentation/devicetree/bindings/dma/dma.txt |
21 | - dma-names: DMA request names should include "tx" and "rx" if present. | 26 | - dma-names: DMA request names should include "tx" and "rx" if present. |
22 | - #address-cells: should be 1. | 27 | |
23 | - #size-cells: should be 0. | ||
24 | 28 | ||
25 | Example: | 29 | Example: |
26 | 30 | ||
diff --git a/Documentation/devicetree/bindings/spi/spi-rspi.txt b/Documentation/devicetree/bindings/spi/spi-rspi.txt index d57d82a74054..8f4169f63936 100644 --- a/Documentation/devicetree/bindings/spi/spi-rspi.txt +++ b/Documentation/devicetree/bindings/spi/spi-rspi.txt | |||
@@ -11,7 +11,10 @@ Required properties: | |||
11 | - "renesas,rspi-sh7757" (SH) | 11 | - "renesas,rspi-sh7757" (SH) |
12 | - "renesas,rspi-r7s72100" (RZ/A1H) | 12 | - "renesas,rspi-r7s72100" (RZ/A1H) |
13 | - "renesas,qspi-r8a7790" (R-Car H2) | 13 | - "renesas,qspi-r8a7790" (R-Car H2) |
14 | - "renesas,qspi-r8a7791" (R-Car M2) | 14 | - "renesas,qspi-r8a7791" (R-Car M2-W) |
15 | - "renesas,qspi-r8a7792" (R-Car V2H) | ||
16 | - "renesas,qspi-r8a7793" (R-Car M2-N) | ||
17 | - "renesas,qspi-r8a7794" (R-Car E2) | ||
15 | - reg : Address start and address range size of the device | 18 | - reg : Address start and address range size of the device |
16 | - interrupts : A list of interrupt-specifiers, one for each entry in | 19 | - interrupts : A list of interrupt-specifiers, one for each entry in |
17 | interrupt-names. | 20 | interrupt-names. |
@@ -30,6 +33,9 @@ Required properties: | |||
30 | 33 | ||
31 | Optional properties: | 34 | Optional properties: |
32 | - clocks : Must contain a reference to the functional clock. | 35 | - clocks : Must contain a reference to the functional clock. |
36 | - dmas : Must contain a list of two references to DMA specifiers, | ||
37 | one for transmission, and one for reception. | ||
38 | - dma-names : Must contain a list of two DMA names, "tx" and "rx". | ||
33 | 39 | ||
34 | Pinctrl properties might be needed, too. See | 40 | Pinctrl properties might be needed, too. See |
35 | Documentation/devicetree/bindings/pinctrl/renesas,*. | 41 | Documentation/devicetree/bindings/pinctrl/renesas,*. |
@@ -58,4 +64,6 @@ Examples: | |||
58 | num-cs = <1>; | 64 | num-cs = <1>; |
59 | #address-cells = <1>; | 65 | #address-cells = <1>; |
60 | #size-cells = <0>; | 66 | #size-cells = <0>; |
67 | dmas = <&dmac0 0x17>, <&dmac0 0x18>; | ||
68 | dma-names = "tx", "rx"; | ||
61 | }; | 69 | }; |
diff --git a/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt b/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt index 578a1fca366e..443bcb6134d5 100644 --- a/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt +++ b/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt | |||
@@ -56,6 +56,9 @@ Required properties: | |||
56 | - fsl,data-width : should be <18> or <24> | 56 | - fsl,data-width : should be <18> or <24> |
57 | - port: A port node with endpoint definitions as defined in | 57 | - port: A port node with endpoint definitions as defined in |
58 | Documentation/devicetree/bindings/media/video-interfaces.txt. | 58 | Documentation/devicetree/bindings/media/video-interfaces.txt. |
59 | On i.MX5, the internal two-input-multiplexer is used. | ||
60 | Due to hardware limitations, only one port (port@[0,1]) | ||
61 | can be used for each channel (lvds-channel@[0,1], respectively) | ||
59 | On i.MX6, there should be four ports (port@[0-3]) that correspond | 62 | On i.MX6, there should be four ports (port@[0-3]) that correspond |
60 | to the four LVDS multiplexer inputs. | 63 | to the four LVDS multiplexer inputs. |
61 | 64 | ||
@@ -78,6 +81,8 @@ ldb: ldb@53fa8008 { | |||
78 | "di0", "di1"; | 81 | "di0", "di1"; |
79 | 82 | ||
80 | lvds-channel@0 { | 83 | lvds-channel@0 { |
84 | #address-cells = <1>; | ||
85 | #size-cells = <0>; | ||
81 | reg = <0>; | 86 | reg = <0>; |
82 | fsl,data-mapping = "spwg"; | 87 | fsl,data-mapping = "spwg"; |
83 | fsl,data-width = <24>; | 88 | fsl,data-width = <24>; |
@@ -86,7 +91,9 @@ ldb: ldb@53fa8008 { | |||
86 | /* ... */ | 91 | /* ... */ |
87 | }; | 92 | }; |
88 | 93 | ||
89 | port { | 94 | port@0 { |
95 | reg = <0>; | ||
96 | |||
90 | lvds0_in: endpoint { | 97 | lvds0_in: endpoint { |
91 | remote-endpoint = <&ipu_di0_lvds0>; | 98 | remote-endpoint = <&ipu_di0_lvds0>; |
92 | }; | 99 | }; |
@@ -94,6 +101,8 @@ ldb: ldb@53fa8008 { | |||
94 | }; | 101 | }; |
95 | 102 | ||
96 | lvds-channel@1 { | 103 | lvds-channel@1 { |
104 | #address-cells = <1>; | ||
105 | #size-cells = <0>; | ||
97 | reg = <1>; | 106 | reg = <1>; |
98 | fsl,data-mapping = "spwg"; | 107 | fsl,data-mapping = "spwg"; |
99 | fsl,data-width = <24>; | 108 | fsl,data-width = <24>; |
@@ -102,7 +111,9 @@ ldb: ldb@53fa8008 { | |||
102 | /* ... */ | 111 | /* ... */ |
103 | }; | 112 | }; |
104 | 113 | ||
105 | port { | 114 | port@1 { |
115 | reg = <1>; | ||
116 | |||
106 | lvds1_in: endpoint { | 117 | lvds1_in: endpoint { |
107 | remote-endpoint = <&ipu_di1_lvds1>; | 118 | remote-endpoint = <&ipu_di1_lvds1>; |
108 | }; | 119 | }; |
diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index cef181a9d8bd..96681c93b86d 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt | |||
@@ -5,6 +5,7 @@ Required properties: | |||
5 | * "fsl,imx23-usbphy" for imx23 and imx28 | 5 | * "fsl,imx23-usbphy" for imx23 and imx28 |
6 | * "fsl,imx6q-usbphy" for imx6dq and imx6dl | 6 | * "fsl,imx6q-usbphy" for imx6dq and imx6dl |
7 | * "fsl,imx6sl-usbphy" for imx6sl | 7 | * "fsl,imx6sl-usbphy" for imx6sl |
8 | * "fsl,imx6sx-usbphy" for imx6sx | ||
8 | "fsl,imx23-usbphy" is still a fallback for other strings | 9 | "fsl,imx23-usbphy" is still a fallback for other strings |
9 | - reg: Should contain registers location and length | 10 | - reg: Should contain registers location and length |
10 | - interrupts: Should contain phy interrupt | 11 | - interrupts: Should contain phy interrupt |
diff --git a/Documentation/devicetree/bindings/video/analog-tv-connector.txt b/Documentation/devicetree/bindings/video/analog-tv-connector.txt index 0218fcdc1299..0c0970c210ab 100644 --- a/Documentation/devicetree/bindings/video/analog-tv-connector.txt +++ b/Documentation/devicetree/bindings/video/analog-tv-connector.txt | |||
@@ -2,7 +2,7 @@ Analog TV Connector | |||
2 | =================== | 2 | =================== |
3 | 3 | ||
4 | Required properties: | 4 | Required properties: |
5 | - compatible: "composite-connector" or "svideo-connector" | 5 | - compatible: "composite-video-connector" or "svideo-connector" |
6 | 6 | ||
7 | Optional properties: | 7 | Optional properties: |
8 | - label: a symbolic name for the connector | 8 | - label: a symbolic name for the connector |
@@ -14,7 +14,7 @@ Example | |||
14 | ------- | 14 | ------- |
15 | 15 | ||
16 | tv: connector { | 16 | tv: connector { |
17 | compatible = "composite-connector"; | 17 | compatible = "composite-video-connector"; |
18 | label = "tv"; | 18 | label = "tv"; |
19 | 19 | ||
20 | port { | 20 | port { |
diff --git a/Documentation/devicetree/of_selftest.txt b/Documentation/devicetree/of_selftest.txt new file mode 100644 index 000000000000..3a2f54d07fc5 --- /dev/null +++ b/Documentation/devicetree/of_selftest.txt | |||
@@ -0,0 +1,211 @@ | |||
1 | Open Firmware Device Tree Selftest | ||
2 | ---------------------------------- | ||
3 | |||
4 | Author: Gaurav Minocha <gaurav.minocha.os@gmail.com> | ||
5 | |||
6 | 1. Introduction | ||
7 | |||
8 | This document explains how the test data required for executing OF selftest | ||
9 | is attached to the live tree dynamically, independent of the machine's | ||
10 | architecture. | ||
11 | |||
12 | It is recommended to read the following documents before moving ahead. | ||
13 | |||
14 | [1] Documentation/devicetree/usage-model.txt | ||
15 | [2] http://www.devicetree.org/Device_Tree_Usage | ||
16 | |||
17 | OF Selftest has been designed to test the interface (include/linux/of.h) | ||
18 | provided to device driver developers to fetch the device information..etc. | ||
19 | from the unflattened device tree data structure. This interface is used by | ||
20 | most of the device drivers in various use cases. | ||
21 | |||
22 | |||
23 | 2. Test-data | ||
24 | |||
25 | The Device Tree Source file (drivers/of/testcase-data/testcases.dts) contains | ||
26 | the test data required for executing the unit tests automated in | ||
27 | drivers/of/selftests.c. Currently, following Device Tree Source Include files | ||
28 | (.dtsi) are included in testcase.dts: | ||
29 | |||
30 | drivers/of/testcase-data/tests-interrupts.dtsi | ||
31 | drivers/of/testcase-data/tests-platform.dtsi | ||
32 | drivers/of/testcase-data/tests-phandle.dtsi | ||
33 | drivers/of/testcase-data/tests-match.dtsi | ||
34 | |||
35 | When the kernel is build with OF_SELFTEST enabled, then the following make rule | ||
36 | |||
37 | $(obj)/%.dtb: $(src)/%.dts FORCE | ||
38 | $(call if_changed_dep, dtc) | ||
39 | |||
40 | is used to compile the DT source file (testcase.dts) into a binary blob | ||
41 | (testcase.dtb), also referred as flattened DT. | ||
42 | |||
43 | After that, using the following rule the binary blob above is wrapped as an | ||
44 | assembly file (testcase.dtb.S). | ||
45 | |||
46 | $(obj)/%.dtb.S: $(obj)/%.dtb | ||
47 | $(call cmd, dt_S_dtb) | ||
48 | |||
49 | The assembly file is compiled into an object file (testcase.dtb.o), and is | ||
50 | linked into the kernel image. | ||
51 | |||
52 | |||
53 | 2.1. Adding the test data | ||
54 | |||
55 | Un-flattened device tree structure: | ||
56 | |||
57 | Un-flattened device tree consists of connected device_node(s) in form of a tree | ||
58 | structure described below. | ||
59 | |||
60 | // following struct members are used to construct the tree | ||
61 | struct device_node { | ||
62 | ... | ||
63 | struct device_node *parent; | ||
64 | struct device_node *child; | ||
65 | struct device_node *sibling; | ||
66 | struct device_node *allnext; /* next in list of all nodes */ | ||
67 | ... | ||
68 | }; | ||
69 | |||
70 | Figure 1, describes a generic structure of machine’s un-flattened device tree | ||
71 | considering only child and sibling pointers. There exists another pointer, | ||
72 | *parent, that is used to traverse the tree in the reverse direction. So, at | ||
73 | a particular level the child node and all the sibling nodes will have a parent | ||
74 | pointer pointing to a common node (e.g. child1, sibling2, sibling3, sibling4’s | ||
75 | parent points to root node) | ||
76 | |||
77 | root (‘/’) | ||
78 | | | ||
79 | child1 -> sibling2 -> sibling3 -> sibling4 -> null | ||
80 | | | | | | ||
81 | | | | null | ||
82 | | | | | ||
83 | | | child31 -> sibling32 -> null | ||
84 | | | | | | ||
85 | | | null null | ||
86 | | | | ||
87 | | child21 -> sibling22 -> sibling23 -> null | ||
88 | | | | | | ||
89 | | null null null | ||
90 | | | ||
91 | child11 -> sibling12 -> sibling13 -> sibling14 -> null | ||
92 | | | | | | ||
93 | | | | null | ||
94 | | | | | ||
95 | null null child131 -> null | ||
96 | | | ||
97 | null | ||
98 | |||
99 | Figure 1: Generic structure of un-flattened device tree | ||
100 | |||
101 | |||
102 | *allnext: it is used to link all the nodes of DT into a list. So, for the | ||
103 | above tree the list would be as follows: | ||
104 | |||
105 | root->child1->child11->sibling12->sibling13->child131->sibling14->sibling2-> | ||
106 | child21->sibling22->sibling23->sibling3->child31->sibling32->sibling4->null | ||
107 | |||
108 | Before executing OF selftest, it is required to attach the test data to | ||
109 | machine's device tree (if present). So, when selftest_data_add() is called, | ||
110 | at first it reads the flattened device tree data linked into the kernel image | ||
111 | via the following kernel symbols: | ||
112 | |||
113 | __dtb_testcases_begin - address marking the start of test data blob | ||
114 | __dtb_testcases_end - address marking the end of test data blob | ||
115 | |||
116 | Secondly, it calls of_fdt_unflatten_device_tree() to unflatten the flattened | ||
117 | blob. And finally, if the machine’s device tree (i.e live tree) is present, | ||
118 | then it attaches the unflattened test data tree to the live tree, else it | ||
119 | attaches itself as a live device tree. | ||
120 | |||
121 | attach_node_and_children() uses of_attach_node() to attach the nodes into the | ||
122 | live tree as explained below. To explain the same, the test data tree described | ||
123 | in Figure 2 is attached to the live tree described in Figure 1. | ||
124 | |||
125 | root (‘/’) | ||
126 | | | ||
127 | testcase-data | ||
128 | | | ||
129 | test-child0 -> test-sibling1 -> test-sibling2 -> test-sibling3 -> null | ||
130 | | | | | | ||
131 | test-child01 null null null | ||
132 | |||
133 | |||
134 | allnext list: | ||
135 | |||
136 | root->testcase-data->test-child0->test-child01->test-sibling1->test-sibling2 | ||
137 | ->test-sibling3->null | ||
138 | |||
139 | Figure 2: Example test data tree to be attached to live tree. | ||
140 | |||
141 | According to the scenario above, the live tree is already present so it isn’t | ||
142 | required to attach the root(‘/’) node. All other nodes are attached by calling | ||
143 | of_attach_node() on each node. | ||
144 | |||
145 | In the function of_attach_node(), the new node is attached as the child of the | ||
146 | given parent in live tree. But, if parent already has a child then the new node | ||
147 | replaces the current child and turns it into its sibling. So, when the testcase | ||
148 | data node is attached to the live tree above (Figure 1), the final structure is | ||
149 | as shown in Figure 3. | ||
150 | |||
151 | root (‘/’) | ||
152 | | | ||
153 | testcase-data -> child1 -> sibling2 -> sibling3 -> sibling4 -> null | ||
154 | | | | | | | ||
155 | (...) | | | null | ||
156 | | | child31 -> sibling32 -> null | ||
157 | | | | | | ||
158 | | | null null | ||
159 | | | | ||
160 | | child21 -> sibling22 -> sibling23 -> null | ||
161 | | | | | | ||
162 | | null null null | ||
163 | | | ||
164 | child11 -> sibling12 -> sibling13 -> sibling14 -> null | ||
165 | | | | | | ||
166 | null null | null | ||
167 | | | ||
168 | child131 -> null | ||
169 | | | ||
170 | null | ||
171 | ----------------------------------------------------------------------- | ||
172 | |||
173 | root (‘/’) | ||
174 | | | ||
175 | testcase-data -> child1 -> sibling2 -> sibling3 -> sibling4 -> null | ||
176 | | | | | | | ||
177 | | (...) (...) (...) null | ||
178 | | | ||
179 | test-sibling3 -> test-sibling2 -> test-sibling1 -> test-child0 -> null | ||
180 | | | | | | ||
181 | null null null test-child01 | ||
182 | |||
183 | |||
184 | Figure 3: Live device tree structure after attaching the testcase-data. | ||
185 | |||
186 | |||
187 | Astute readers would have noticed that test-child0 node becomes the last | ||
188 | sibling compared to the earlier structure (Figure 2). After attaching first | ||
189 | test-child0 the test-sibling1 is attached that pushes the child node | ||
190 | (i.e. test-child0) to become a sibling and makes itself a child node, | ||
191 | as mentioned above. | ||
192 | |||
193 | If a duplicate node is found (i.e. if a node with same full_name property is | ||
194 | already present in the live tree), then the node isn’t attached rather its | ||
195 | properties are updated to the live tree’s node by calling the function | ||
196 | update_node_properties(). | ||
197 | |||
198 | |||
199 | 2.2. Removing the test data | ||
200 | |||
201 | Once the test case execution is complete, selftest_data_remove is called in | ||
202 | order to remove the device nodes attached initially (first the leaf nodes are | ||
203 | detached and then moving up the parent nodes are removed, and eventually the | ||
204 | whole tree). selftest_data_remove() calls detach_node_and_children() that uses | ||
205 | of_detach_node() to detach the nodes from the live device tree. | ||
206 | |||
207 | To detach a node, of_detach_node() first updates all_next linked list, by | ||
208 | attaching the previous node’s allnext to current node’s allnext pointer. And | ||
209 | then, it either updates the child pointer of given node’s parent to its | ||
210 | sibling or attaches the previous sibling to the given node’s sibling, as | ||
211 | appropriate. That is it :) | ||
diff --git a/Documentation/dma-buf-sharing.txt b/Documentation/dma-buf-sharing.txt index 67a4087d53f9..bb9753b635a3 100644 --- a/Documentation/dma-buf-sharing.txt +++ b/Documentation/dma-buf-sharing.txt | |||
@@ -56,10 +56,10 @@ The dma_buf buffer sharing API usage contains the following steps: | |||
56 | size_t size, int flags, | 56 | size_t size, int flags, |
57 | const char *exp_name) | 57 | const char *exp_name) |
58 | 58 | ||
59 | If this succeeds, dma_buf_export allocates a dma_buf structure, and returns a | 59 | If this succeeds, dma_buf_export_named allocates a dma_buf structure, and |
60 | pointer to the same. It also associates an anonymous file with this buffer, | 60 | returns a pointer to the same. It also associates an anonymous file with this |
61 | so it can be exported. On failure to allocate the dma_buf object, it returns | 61 | buffer, so it can be exported. On failure to allocate the dma_buf object, |
62 | NULL. | 62 | it returns NULL. |
63 | 63 | ||
64 | 'exp_name' is the name of exporter - to facilitate information while | 64 | 'exp_name' is the name of exporter - to facilitate information while |
65 | debugging. | 65 | debugging. |
@@ -76,7 +76,7 @@ The dma_buf buffer sharing API usage contains the following steps: | |||
76 | drivers and/or processes. | 76 | drivers and/or processes. |
77 | 77 | ||
78 | Interface: | 78 | Interface: |
79 | int dma_buf_fd(struct dma_buf *dmabuf) | 79 | int dma_buf_fd(struct dma_buf *dmabuf, int flags) |
80 | 80 | ||
81 | This API installs an fd for the anonymous file associated with this buffer; | 81 | This API installs an fd for the anonymous file associated with this buffer; |
82 | returns either 'fd', or error. | 82 | returns either 'fd', or error. |
@@ -157,7 +157,9 @@ to request use of buffer for allocation. | |||
157 | "dma_buf->ops->" indirection from the users of this interface. | 157 | "dma_buf->ops->" indirection from the users of this interface. |
158 | 158 | ||
159 | In struct dma_buf_ops, unmap_dma_buf is defined as | 159 | In struct dma_buf_ops, unmap_dma_buf is defined as |
160 | void (*unmap_dma_buf)(struct dma_buf_attachment *, struct sg_table *); | 160 | void (*unmap_dma_buf)(struct dma_buf_attachment *, |
161 | struct sg_table *, | ||
162 | enum dma_data_direction); | ||
161 | 163 | ||
162 | unmap_dma_buf signifies the end-of-DMA for the attachment provided. Like | 164 | unmap_dma_buf signifies the end-of-DMA for the attachment provided. Like |
163 | map_dma_buf, this API also must be implemented by the exporter. | 165 | map_dma_buf, this API also must be implemented by the exporter. |
diff --git a/Documentation/filesystems/nfs/nfs-rdma.txt b/Documentation/filesystems/nfs/nfs-rdma.txt index e386f7e4bcee..724043858b08 100644 --- a/Documentation/filesystems/nfs/nfs-rdma.txt +++ b/Documentation/filesystems/nfs/nfs-rdma.txt | |||
@@ -138,9 +138,9 @@ Installation | |||
138 | - Build, install, reboot | 138 | - Build, install, reboot |
139 | 139 | ||
140 | The NFS/RDMA code will be enabled automatically if NFS and RDMA | 140 | The NFS/RDMA code will be enabled automatically if NFS and RDMA |
141 | are turned on. The NFS/RDMA client and server are configured via the hidden | 141 | are turned on. The NFS/RDMA client and server are configured via the |
142 | SUNRPC_XPRT_RDMA config option that depends on SUNRPC and INFINIBAND. The | 142 | SUNRPC_XPRT_RDMA_CLIENT and SUNRPC_XPRT_RDMA_SERVER config options that both |
143 | value of SUNRPC_XPRT_RDMA will be: | 143 | depend on SUNRPC and INFINIBAND. The default value of both options will be: |
144 | 144 | ||
145 | - N if either SUNRPC or INFINIBAND are N, in this case the NFS/RDMA client | 145 | - N if either SUNRPC or INFINIBAND are N, in this case the NFS/RDMA client |
146 | and server will not be built | 146 | and server will not be built |
@@ -235,8 +235,9 @@ NFS/RDMA Setup | |||
235 | 235 | ||
236 | - Start the NFS server | 236 | - Start the NFS server |
237 | 237 | ||
238 | If the NFS/RDMA server was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in | 238 | If the NFS/RDMA server was built as a module |
239 | kernel config), load the RDMA transport module: | 239 | (CONFIG_SUNRPC_XPRT_RDMA_SERVER=m in kernel config), load the RDMA |
240 | transport module: | ||
240 | 241 | ||
241 | $ modprobe svcrdma | 242 | $ modprobe svcrdma |
242 | 243 | ||
@@ -255,8 +256,9 @@ NFS/RDMA Setup | |||
255 | 256 | ||
256 | - On the client system | 257 | - On the client system |
257 | 258 | ||
258 | If the NFS/RDMA client was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in | 259 | If the NFS/RDMA client was built as a module |
259 | kernel config), load the RDMA client module: | 260 | (CONFIG_SUNRPC_XPRT_RDMA_CLIENT=m in kernel config), load the RDMA client |
261 | module: | ||
260 | 262 | ||
261 | $ modprobe xprtrdma.ko | 263 | $ modprobe xprtrdma.ko |
262 | 264 | ||
diff --git a/Documentation/filesystems/seq_file.txt b/Documentation/filesystems/seq_file.txt index 1fe0ccb1af55..8ea3e90ace07 100644 --- a/Documentation/filesystems/seq_file.txt +++ b/Documentation/filesystems/seq_file.txt | |||
@@ -235,6 +235,39 @@ be used for more than one file, you can store an arbitrary pointer in the | |||
235 | private field of the seq_file structure; that value can then be retrieved | 235 | private field of the seq_file structure; that value can then be retrieved |
236 | by the iterator functions. | 236 | by the iterator functions. |
237 | 237 | ||
238 | There is also a wrapper function to seq_open() called seq_open_private(). It | ||
239 | kmallocs a zero filled block of memory and stores a pointer to it in the | ||
240 | private field of the seq_file structure, returning 0 on success. The | ||
241 | block size is specified in a third parameter to the function, e.g.: | ||
242 | |||
243 | static int ct_open(struct inode *inode, struct file *file) | ||
244 | { | ||
245 | return seq_open_private(file, &ct_seq_ops, | ||
246 | sizeof(struct mystruct)); | ||
247 | } | ||
248 | |||
249 | There is also a variant function, __seq_open_private(), which is functionally | ||
250 | identical except that, if successful, it returns the pointer to the allocated | ||
251 | memory block, allowing further initialisation e.g.: | ||
252 | |||
253 | static int ct_open(struct inode *inode, struct file *file) | ||
254 | { | ||
255 | struct mystruct *p = | ||
256 | __seq_open_private(file, &ct_seq_ops, sizeof(*p)); | ||
257 | |||
258 | if (!p) | ||
259 | return -ENOMEM; | ||
260 | |||
261 | p->foo = bar; /* initialize my stuff */ | ||
262 | ... | ||
263 | p->baz = true; | ||
264 | |||
265 | return 0; | ||
266 | } | ||
267 | |||
268 | A corresponding close function, seq_release_private() is available which | ||
269 | frees the memory allocated in the corresponding open. | ||
270 | |||
238 | The other operations of interest - read(), llseek(), and release() - are | 271 | The other operations of interest - read(), llseek(), and release() - are |
239 | all implemented by the seq_file code itself. So a virtual file's | 272 | all implemented by the seq_file code itself. So a virtual file's |
240 | file_operations structure will look like: | 273 | file_operations structure will look like: |
diff --git a/Documentation/gpio/consumer.txt b/Documentation/gpio/consumer.txt index 76546324e968..6ce544191ca6 100644 --- a/Documentation/gpio/consumer.txt +++ b/Documentation/gpio/consumer.txt | |||
@@ -53,7 +53,20 @@ with IS_ERR() (they will never return a NULL pointer). -ENOENT will be returned | |||
53 | if and only if no GPIO has been assigned to the device/function/index triplet, | 53 | if and only if no GPIO has been assigned to the device/function/index triplet, |
54 | other error codes are used for cases where a GPIO has been assigned but an error | 54 | other error codes are used for cases where a GPIO has been assigned but an error |
55 | occurred while trying to acquire it. This is useful to discriminate between mere | 55 | occurred while trying to acquire it. This is useful to discriminate between mere |
56 | errors and an absence of GPIO for optional GPIO parameters. | 56 | errors and an absence of GPIO for optional GPIO parameters. For the common |
57 | pattern where a GPIO is optional, the gpiod_get_optional() and | ||
58 | gpiod_get_index_optional() functions can be used. These functions return NULL | ||
59 | instead of -ENOENT if no GPIO has been assigned to the requested function: | ||
60 | |||
61 | |||
62 | struct gpio_desc *gpiod_get_optional(struct device *dev, | ||
63 | const char *con_id, | ||
64 | enum gpiod_flags flags) | ||
65 | |||
66 | struct gpio_desc *gpiod_get_index_optional(struct device *dev, | ||
67 | const char *con_id, | ||
68 | unsigned int index, | ||
69 | enum gpiod_flags flags) | ||
57 | 70 | ||
58 | Device-managed variants of these functions are also defined: | 71 | Device-managed variants of these functions are also defined: |
59 | 72 | ||
@@ -65,6 +78,15 @@ Device-managed variants of these functions are also defined: | |||
65 | unsigned int idx, | 78 | unsigned int idx, |
66 | enum gpiod_flags flags) | 79 | enum gpiod_flags flags) |
67 | 80 | ||
81 | struct gpio_desc *devm_gpiod_get_optional(struct device *dev, | ||
82 | const char *con_id, | ||
83 | enum gpiod_flags flags) | ||
84 | |||
85 | struct gpio_desc * devm_gpiod_get_index_optional(struct device *dev, | ||
86 | const char *con_id, | ||
87 | unsigned int index, | ||
88 | enum gpiod_flags flags) | ||
89 | |||
68 | A GPIO descriptor can be disposed of using the gpiod_put() function: | 90 | A GPIO descriptor can be disposed of using the gpiod_put() function: |
69 | 91 | ||
70 | void gpiod_put(struct gpio_desc *desc) | 92 | void gpiod_put(struct gpio_desc *desc) |
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface index 3e742ba25536..2ac78ae1039d 100644 --- a/Documentation/i2c/dev-interface +++ b/Documentation/i2c/dev-interface | |||
@@ -57,12 +57,12 @@ Well, you are all set up now. You can now use SMBus commands or plain | |||
57 | I2C to communicate with your device. SMBus commands are preferred if | 57 | I2C to communicate with your device. SMBus commands are preferred if |
58 | the device supports them. Both are illustrated below. | 58 | the device supports them. Both are illustrated below. |
59 | 59 | ||
60 | __u8 register = 0x10; /* Device register to access */ | 60 | __u8 reg = 0x10; /* Device register to access */ |
61 | __s32 res; | 61 | __s32 res; |
62 | char buf[10]; | 62 | char buf[10]; |
63 | 63 | ||
64 | /* Using SMBus commands */ | 64 | /* Using SMBus commands */ |
65 | res = i2c_smbus_read_word_data(file, register); | 65 | res = i2c_smbus_read_word_data(file, reg); |
66 | if (res < 0) { | 66 | if (res < 0) { |
67 | /* ERROR HANDLING: i2c transaction failed */ | 67 | /* ERROR HANDLING: i2c transaction failed */ |
68 | } else { | 68 | } else { |
@@ -70,11 +70,11 @@ the device supports them. Both are illustrated below. | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /* Using I2C Write, equivalent of | 72 | /* Using I2C Write, equivalent of |
73 | i2c_smbus_write_word_data(file, register, 0x6543) */ | 73 | i2c_smbus_write_word_data(file, reg, 0x6543) */ |
74 | buf[0] = register; | 74 | buf[0] = reg; |
75 | buf[1] = 0x43; | 75 | buf[1] = 0x43; |
76 | buf[2] = 0x65; | 76 | buf[2] = 0x65; |
77 | if (write(file, buf, 3) ! =3) { | 77 | if (write(file, buf, 3) != 3) { |
78 | /* ERROR HANDLING: i2c transaction failed */ | 78 | /* ERROR HANDLING: i2c transaction failed */ |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt index 88d5a863712a..6c0b9f27e465 100644 --- a/Documentation/kdump/kdump.txt +++ b/Documentation/kdump/kdump.txt | |||
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to | |||
18 | a remote system. | 18 | a remote system. |
19 | 19 | ||
20 | Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64, | 20 | Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64, |
21 | and s390x architectures. | 21 | s390x and arm architectures. |
22 | 22 | ||
23 | When the system kernel boots, it reserves a small section of memory for | 23 | When the system kernel boots, it reserves a small section of memory for |
24 | the dump-capture kernel. This ensures that ongoing Direct Memory Access | 24 | the dump-capture kernel. This ensures that ongoing Direct Memory Access |
@@ -112,7 +112,7 @@ There are two possible methods of using Kdump. | |||
112 | 2) Or use the system kernel binary itself as dump-capture kernel and there is | 112 | 2) Or use the system kernel binary itself as dump-capture kernel and there is |
113 | no need to build a separate dump-capture kernel. This is possible | 113 | no need to build a separate dump-capture kernel. This is possible |
114 | only with the architectures which support a relocatable kernel. As | 114 | only with the architectures which support a relocatable kernel. As |
115 | of today, i386, x86_64, ppc64 and ia64 architectures support relocatable | 115 | of today, i386, x86_64, ppc64, ia64 and arm architectures support relocatable |
116 | kernel. | 116 | kernel. |
117 | 117 | ||
118 | Building a relocatable kernel is advantageous from the point of view that | 118 | Building a relocatable kernel is advantageous from the point of view that |
@@ -241,6 +241,13 @@ Dump-capture kernel config options (Arch Dependent, ia64) | |||
241 | kernel will be aligned to 64Mb, so if the start address is not then | 241 | kernel will be aligned to 64Mb, so if the start address is not then |
242 | any space below the alignment point will be wasted. | 242 | any space below the alignment point will be wasted. |
243 | 243 | ||
244 | Dump-capture kernel config options (Arch Dependent, arm) | ||
245 | ---------------------------------------------------------- | ||
246 | |||
247 | - To use a relocatable kernel, | ||
248 | Enable "AUTO_ZRELADDR" support under "Boot" options: | ||
249 | |||
250 | AUTO_ZRELADDR=y | ||
244 | 251 | ||
245 | Extended crashkernel syntax | 252 | Extended crashkernel syntax |
246 | =========================== | 253 | =========================== |
@@ -256,6 +263,10 @@ The syntax is: | |||
256 | crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] | 263 | crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] |
257 | range=start-[end] | 264 | range=start-[end] |
258 | 265 | ||
266 | Please note, on arm, the offset is required. | ||
267 | crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset | ||
268 | range=start-[end] | ||
269 | |||
259 | 'start' is inclusive and 'end' is exclusive. | 270 | 'start' is inclusive and 'end' is exclusive. |
260 | 271 | ||
261 | For example: | 272 | For example: |
@@ -296,6 +307,12 @@ Boot into System Kernel | |||
296 | on the memory consumption of the kdump system. In general this is not | 307 | on the memory consumption of the kdump system. In general this is not |
297 | dependent on the memory size of the production system. | 308 | dependent on the memory size of the production system. |
298 | 309 | ||
310 | On arm, use "crashkernel=Y@X". Note that the start address of the kernel | ||
311 | will be aligned to 128MiB (0x08000000), so if the start address is not then | ||
312 | any space below the alignment point may be overwritten by the dump-capture kernel, | ||
313 | which means it is possible that the vmcore is not that precise as expected. | ||
314 | |||
315 | |||
299 | Load the Dump-capture Kernel | 316 | Load the Dump-capture Kernel |
300 | ============================ | 317 | ============================ |
301 | 318 | ||
@@ -315,7 +332,8 @@ For ia64: | |||
315 | - Use vmlinux or vmlinuz.gz | 332 | - Use vmlinux or vmlinuz.gz |
316 | For s390x: | 333 | For s390x: |
317 | - Use image or bzImage | 334 | - Use image or bzImage |
318 | 335 | For arm: | |
336 | - Use zImage | ||
319 | 337 | ||
320 | If you are using a uncompressed vmlinux image then use following command | 338 | If you are using a uncompressed vmlinux image then use following command |
321 | to load dump-capture kernel. | 339 | to load dump-capture kernel. |
@@ -331,6 +349,15 @@ to load dump-capture kernel. | |||
331 | --initrd=<initrd-for-dump-capture-kernel> \ | 349 | --initrd=<initrd-for-dump-capture-kernel> \ |
332 | --append="root=<root-dev> <arch-specific-options>" | 350 | --append="root=<root-dev> <arch-specific-options>" |
333 | 351 | ||
352 | If you are using a compressed zImage, then use following command | ||
353 | to load dump-capture kernel. | ||
354 | |||
355 | kexec --type zImage -p <dump-capture-kernel-bzImage> \ | ||
356 | --initrd=<initrd-for-dump-capture-kernel> \ | ||
357 | --dtb=<dtb-for-dump-capture-kernel> \ | ||
358 | --append="root=<root-dev> <arch-specific-options>" | ||
359 | |||
360 | |||
334 | Please note, that --args-linux does not need to be specified for ia64. | 361 | Please note, that --args-linux does not need to be specified for ia64. |
335 | It is planned to make this a no-op on that architecture, but for now | 362 | It is planned to make this a no-op on that architecture, but for now |
336 | it should be omitted | 363 | it should be omitted |
@@ -347,6 +374,9 @@ For ppc64: | |||
347 | For s390x: | 374 | For s390x: |
348 | "1 maxcpus=1 cgroup_disable=memory" | 375 | "1 maxcpus=1 cgroup_disable=memory" |
349 | 376 | ||
377 | For arm: | ||
378 | "1 maxcpus=1 reset_devices" | ||
379 | |||
350 | Notes on loading the dump-capture kernel: | 380 | Notes on loading the dump-capture kernel: |
351 | 381 | ||
352 | * By default, the ELF headers are stored in ELF64 format to support | 382 | * By default, the ELF headers are stored in ELF64 format to support |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 5ae8608ca9f5..10d51c2f10d7 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -3541,6 +3541,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
3541 | bogus residue values); | 3541 | bogus residue values); |
3542 | s = SINGLE_LUN (the device has only one | 3542 | s = SINGLE_LUN (the device has only one |
3543 | Logical Unit); | 3543 | Logical Unit); |
3544 | u = IGNORE_UAS (don't bind to the uas driver); | ||
3544 | w = NO_WP_DETECT (don't test whether the | 3545 | w = NO_WP_DETECT (don't test whether the |
3545 | medium is write-protected). | 3546 | medium is write-protected). |
3546 | Example: quirks=0419:aaf5:rl,0421:0433:rc | 3547 | Example: quirks=0419:aaf5:rl,0421:0433:rc |
diff --git a/Documentation/misc-devices/lis3lv02d b/Documentation/misc-devices/lis3lv02d index af815b9ba413..f89960a0ff95 100644 --- a/Documentation/misc-devices/lis3lv02d +++ b/Documentation/misc-devices/lis3lv02d | |||
@@ -59,7 +59,7 @@ acts similar to /dev/rtc and reacts on free-fall interrupts received | |||
59 | from the device. It supports blocking operations, poll/select and | 59 | from the device. It supports blocking operations, poll/select and |
60 | fasync operation modes. You must read 1 bytes from the device. The | 60 | fasync operation modes. You must read 1 bytes from the device. The |
61 | result is number of free-fall interrupts since the last successful | 61 | result is number of free-fall interrupts since the last successful |
62 | read (or 255 if number of interrupts would not fit). See the hpfall.c | 62 | read (or 255 if number of interrupts would not fit). See the freefall.c |
63 | file for an example on using the device. | 63 | file for an example on using the device. |
64 | 64 | ||
65 | 65 | ||
diff --git a/Documentation/networking/filter.txt b/Documentation/networking/filter.txt index c48a9704bda8..d16f424c5e8d 100644 --- a/Documentation/networking/filter.txt +++ b/Documentation/networking/filter.txt | |||
@@ -462,9 +462,9 @@ JIT compiler | |||
462 | ------------ | 462 | ------------ |
463 | 463 | ||
464 | The Linux kernel has a built-in BPF JIT compiler for x86_64, SPARC, PowerPC, | 464 | The Linux kernel has a built-in BPF JIT compiler for x86_64, SPARC, PowerPC, |
465 | ARM and s390 and can be enabled through CONFIG_BPF_JIT. The JIT compiler is | 465 | ARM, MIPS and s390 and can be enabled through CONFIG_BPF_JIT. The JIT compiler |
466 | transparently invoked for each attached filter from user space or for internal | 466 | is transparently invoked for each attached filter from user space or for |
467 | kernel users if it has been previously enabled by root: | 467 | internal kernel users if it has been previously enabled by root: |
468 | 468 | ||
469 | echo 1 > /proc/sys/net/core/bpf_jit_enable | 469 | echo 1 > /proc/sys/net/core/bpf_jit_enable |
470 | 470 | ||
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt index 81c0e2b49cd8..8afb236ca765 100644 --- a/Documentation/power/regulator/consumer.txt +++ b/Documentation/power/regulator/consumer.txt | |||
@@ -143,8 +143,9 @@ This will cause the core to recalculate the total load on the regulator (based | |||
143 | on all its consumers) and change operating mode (if necessary and permitted) | 143 | on all its consumers) and change operating mode (if necessary and permitted) |
144 | to best match the current operating load. | 144 | to best match the current operating load. |
145 | 145 | ||
146 | The load_uA value can be determined from the consumers datasheet. e.g.most | 146 | The load_uA value can be determined from the consumer's datasheet. e.g. most |
147 | datasheets have tables showing the max current consumed in certain situations. | 147 | datasheets have tables showing the maximum current consumed in certain |
148 | situations. | ||
148 | 149 | ||
149 | Most consumers will use indirect operating mode control since they have no | 150 | Most consumers will use indirect operating mode control since they have no |
150 | knowledge of the regulator or whether the regulator is shared with other | 151 | knowledge of the regulator or whether the regulator is shared with other |
@@ -173,7 +174,7 @@ Consumers can register interest in regulator events by calling :- | |||
173 | int regulator_register_notifier(struct regulator *regulator, | 174 | int regulator_register_notifier(struct regulator *regulator, |
174 | struct notifier_block *nb); | 175 | struct notifier_block *nb); |
175 | 176 | ||
176 | Consumers can uregister interest by calling :- | 177 | Consumers can unregister interest by calling :- |
177 | 178 | ||
178 | int regulator_unregister_notifier(struct regulator *regulator, | 179 | int regulator_unregister_notifier(struct regulator *regulator, |
179 | struct notifier_block *nb); | 180 | struct notifier_block *nb); |
diff --git a/Documentation/power/regulator/design.txt b/Documentation/power/regulator/design.txt index f9b56b72b782..fdd919b96830 100644 --- a/Documentation/power/regulator/design.txt +++ b/Documentation/power/regulator/design.txt | |||
@@ -9,14 +9,14 @@ Safety | |||
9 | 9 | ||
10 | - Errors in regulator configuration can have very serious consequences | 10 | - Errors in regulator configuration can have very serious consequences |
11 | for the system, potentially including lasting hardware damage. | 11 | for the system, potentially including lasting hardware damage. |
12 | - It is not possible to automatically determine the power confugration | 12 | - It is not possible to automatically determine the power configuration |
13 | of the system - software-equivalent variants of the same chip may | 13 | of the system - software-equivalent variants of the same chip may |
14 | have different power requirments, and not all components with power | 14 | have different power requirements, and not all components with power |
15 | requirements are visible to software. | 15 | requirements are visible to software. |
16 | 16 | ||
17 | => The API should make no changes to the hardware state unless it has | 17 | => The API should make no changes to the hardware state unless it has |
18 | specific knowledge that these changes are safe to do perform on | 18 | specific knowledge that these changes are safe to perform on this |
19 | this particular system. | 19 | particular system. |
20 | 20 | ||
21 | Consumer use cases | 21 | Consumer use cases |
22 | ------------------ | 22 | ------------------ |
diff --git a/Documentation/power/regulator/machine.txt b/Documentation/power/regulator/machine.txt index ce63af0a8e35..757e3b53dc11 100644 --- a/Documentation/power/regulator/machine.txt +++ b/Documentation/power/regulator/machine.txt | |||
@@ -11,7 +11,7 @@ Consider the following machine :- | |||
11 | +-> [Consumer B @ 3.3V] | 11 | +-> [Consumer B @ 3.3V] |
12 | 12 | ||
13 | The drivers for consumers A & B must be mapped to the correct regulator in | 13 | The drivers for consumers A & B must be mapped to the correct regulator in |
14 | order to control their power supply. This mapping can be achieved in machine | 14 | order to control their power supplies. This mapping can be achieved in machine |
15 | initialisation code by creating a struct regulator_consumer_supply for | 15 | initialisation code by creating a struct regulator_consumer_supply for |
16 | each regulator. | 16 | each regulator. |
17 | 17 | ||
@@ -39,7 +39,7 @@ to the 'Vcc' supply for Consumer A. | |||
39 | 39 | ||
40 | Constraints can now be registered by defining a struct regulator_init_data | 40 | Constraints can now be registered by defining a struct regulator_init_data |
41 | for each regulator power domain. This structure also maps the consumers | 41 | for each regulator power domain. This structure also maps the consumers |
42 | to their supply regulator :- | 42 | to their supply regulators :- |
43 | 43 | ||
44 | static struct regulator_init_data regulator1_data = { | 44 | static struct regulator_init_data regulator1_data = { |
45 | .constraints = { | 45 | .constraints = { |
diff --git a/Documentation/power/regulator/overview.txt b/Documentation/power/regulator/overview.txt index 8ed17587a74b..40ca2d6e2742 100644 --- a/Documentation/power/regulator/overview.txt +++ b/Documentation/power/regulator/overview.txt | |||
@@ -36,11 +36,11 @@ Some terms used in this document:- | |||
36 | Consumers can be classified into two types:- | 36 | Consumers can be classified into two types:- |
37 | 37 | ||
38 | Static: consumer does not change its supply voltage or | 38 | Static: consumer does not change its supply voltage or |
39 | current limit. It only needs to enable or disable it's | 39 | current limit. It only needs to enable or disable its |
40 | power supply. Its supply voltage is set by the hardware, | 40 | power supply. Its supply voltage is set by the hardware, |
41 | bootloader, firmware or kernel board initialisation code. | 41 | bootloader, firmware or kernel board initialisation code. |
42 | 42 | ||
43 | Dynamic: consumer needs to change it's supply voltage or | 43 | Dynamic: consumer needs to change its supply voltage or |
44 | current limit to meet operation demands. | 44 | current limit to meet operation demands. |
45 | 45 | ||
46 | 46 | ||
@@ -156,7 +156,7 @@ relevant to non SoC devices and is split into the following four interfaces:- | |||
156 | This interface is for machine specific code and allows the creation of | 156 | This interface is for machine specific code and allows the creation of |
157 | voltage/current domains (with constraints) for each regulator. It can | 157 | voltage/current domains (with constraints) for each regulator. It can |
158 | provide regulator constraints that will prevent device damage through | 158 | provide regulator constraints that will prevent device damage through |
159 | overvoltage or over current caused by buggy client drivers. It also | 159 | overvoltage or overcurrent caused by buggy client drivers. It also |
160 | allows the creation of a regulator tree whereby some regulators are | 160 | allows the creation of a regulator tree whereby some regulators are |
161 | supplied by others (similar to a clock tree). | 161 | supplied by others (similar to a clock tree). |
162 | 162 | ||
diff --git a/Documentation/power/regulator/regulator.txt b/Documentation/power/regulator/regulator.txt index 13902778ae44..b17e5833ce21 100644 --- a/Documentation/power/regulator/regulator.txt +++ b/Documentation/power/regulator/regulator.txt | |||
@@ -13,7 +13,7 @@ Drivers can register a regulator by calling :- | |||
13 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | 13 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, |
14 | const struct regulator_config *config); | 14 | const struct regulator_config *config); |
15 | 15 | ||
16 | This will register the regulators capabilities and operations to the regulator | 16 | This will register the regulator's capabilities and operations to the regulator |
17 | core. | 17 | core. |
18 | 18 | ||
19 | Regulators can be unregistered by calling :- | 19 | Regulators can be unregistered by calling :- |
@@ -23,8 +23,8 @@ void regulator_unregister(struct regulator_dev *rdev); | |||
23 | 23 | ||
24 | Regulator Events | 24 | Regulator Events |
25 | ================ | 25 | ================ |
26 | Regulators can send events (e.g. over temp, under voltage, etc) to consumer | 26 | Regulators can send events (e.g. overtemperature, undervoltage, etc) to |
27 | drivers by calling :- | 27 | consumer drivers by calling :- |
28 | 28 | ||
29 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | 29 | int regulator_notifier_call_chain(struct regulator_dev *rdev, |
30 | unsigned long event, void *data); | 30 | unsigned long event, void *data); |
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index 7982bcc4d151..d29734bff28c 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
@@ -601,13 +601,13 @@ THANKS TO | |||
601 | Contributors to Linux-SPI discussions include (in alphabetical order, | 601 | Contributors to Linux-SPI discussions include (in alphabetical order, |
602 | by last name): | 602 | by last name): |
603 | 603 | ||
604 | Mark Brown | ||
604 | David Brownell | 605 | David Brownell |
605 | Russell King | 606 | Russell King |
607 | Grant Likely | ||
606 | Dmitry Pervushin | 608 | Dmitry Pervushin |
607 | Stephen Street | 609 | Stephen Street |
608 | Mark Underwood | 610 | Mark Underwood |
609 | Andrew Victor | 611 | Andrew Victor |
610 | Vitaly Wool | ||
611 | Grant Likely | ||
612 | Mark Brown | ||
613 | Linus Walleij | 612 | Linus Walleij |
613 | Vitaly Wool | ||
diff --git a/Documentation/this_cpu_ops.txt b/Documentation/this_cpu_ops.txt index 1a4ce7e3e05f..0ec995712176 100644 --- a/Documentation/this_cpu_ops.txt +++ b/Documentation/this_cpu_ops.txt | |||
@@ -2,26 +2,26 @@ this_cpu operations | |||
2 | ------------------- | 2 | ------------------- |
3 | 3 | ||
4 | this_cpu operations are a way of optimizing access to per cpu | 4 | this_cpu operations are a way of optimizing access to per cpu |
5 | variables associated with the *currently* executing processor through | 5 | variables associated with the *currently* executing processor. This is |
6 | the use of segment registers (or a dedicated register where the cpu | 6 | done through the use of segment registers (or a dedicated register where |
7 | permanently stored the beginning of the per cpu area for a specific | 7 | the cpu permanently stored the beginning of the per cpu area for a |
8 | processor). | 8 | specific processor). |
9 | 9 | ||
10 | The this_cpu operations add a per cpu variable offset to the processor | 10 | this_cpu operations add a per cpu variable offset to the processor |
11 | specific percpu base and encode that operation in the instruction | 11 | specific per cpu base and encode that operation in the instruction |
12 | operating on the per cpu variable. | 12 | operating on the per cpu variable. |
13 | 13 | ||
14 | This means there are no atomicity issues between the calculation of | 14 | This means that there are no atomicity issues between the calculation of |
15 | the offset and the operation on the data. Therefore it is not | 15 | the offset and the operation on the data. Therefore it is not |
16 | necessary to disable preempt or interrupts to ensure that the | 16 | necessary to disable preemption or interrupts to ensure that the |
17 | processor is not changed between the calculation of the address and | 17 | processor is not changed between the calculation of the address and |
18 | the operation on the data. | 18 | the operation on the data. |
19 | 19 | ||
20 | Read-modify-write operations are of particular interest. Frequently | 20 | Read-modify-write operations are of particular interest. Frequently |
21 | processors have special lower latency instructions that can operate | 21 | processors have special lower latency instructions that can operate |
22 | without the typical synchronization overhead but still provide some | 22 | without the typical synchronization overhead, but still provide some |
23 | sort of relaxed atomicity guarantee. The x86 for example can execute | 23 | sort of relaxed atomicity guarantees. The x86, for example, can execute |
24 | RMV (Read Modify Write) instructions like inc/dec/cmpxchg without the | 24 | RMW (Read Modify Write) instructions like inc/dec/cmpxchg without the |
25 | lock prefix and the associated latency penalty. | 25 | lock prefix and the associated latency penalty. |
26 | 26 | ||
27 | Access to the variable without the lock prefix is not synchronized but | 27 | Access to the variable without the lock prefix is not synchronized but |
@@ -30,6 +30,38 @@ data specific to the currently executing processor. Only the current | |||
30 | processor should be accessing that variable and therefore there are no | 30 | processor should be accessing that variable and therefore there are no |
31 | concurrency issues with other processors in the system. | 31 | concurrency issues with other processors in the system. |
32 | 32 | ||
33 | Please note that accesses by remote processors to a per cpu area are | ||
34 | exceptional situations and may impact performance and/or correctness | ||
35 | (remote write operations) of local RMW operations via this_cpu_*. | ||
36 | |||
37 | The main use of the this_cpu operations has been to optimize counter | ||
38 | operations. | ||
39 | |||
40 | The following this_cpu() operations with implied preemption protection | ||
41 | are defined. These operations can be used without worrying about | ||
42 | preemption and interrupts. | ||
43 | |||
44 | this_cpu_add() | ||
45 | this_cpu_read(pcp) | ||
46 | this_cpu_write(pcp, val) | ||
47 | this_cpu_add(pcp, val) | ||
48 | this_cpu_and(pcp, val) | ||
49 | this_cpu_or(pcp, val) | ||
50 | this_cpu_add_return(pcp, val) | ||
51 | this_cpu_xchg(pcp, nval) | ||
52 | this_cpu_cmpxchg(pcp, oval, nval) | ||
53 | this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
54 | this_cpu_sub(pcp, val) | ||
55 | this_cpu_inc(pcp) | ||
56 | this_cpu_dec(pcp) | ||
57 | this_cpu_sub_return(pcp, val) | ||
58 | this_cpu_inc_return(pcp) | ||
59 | this_cpu_dec_return(pcp) | ||
60 | |||
61 | |||
62 | Inner working of this_cpu operations | ||
63 | ------------------------------------ | ||
64 | |||
33 | On x86 the fs: or the gs: segment registers contain the base of the | 65 | On x86 the fs: or the gs: segment registers contain the base of the |
34 | per cpu area. It is then possible to simply use the segment override | 66 | per cpu area. It is then possible to simply use the segment override |
35 | to relocate a per cpu relative address to the proper per cpu area for | 67 | to relocate a per cpu relative address to the proper per cpu area for |
@@ -48,22 +80,21 @@ results in a single instruction | |||
48 | mov ax, gs:[x] | 80 | mov ax, gs:[x] |
49 | 81 | ||
50 | instead of a sequence of calculation of the address and then a fetch | 82 | instead of a sequence of calculation of the address and then a fetch |
51 | from that address which occurs with the percpu operations. Before | 83 | from that address which occurs with the per cpu operations. Before |
52 | this_cpu_ops such sequence also required preempt disable/enable to | 84 | this_cpu_ops such sequence also required preempt disable/enable to |
53 | prevent the kernel from moving the thread to a different processor | 85 | prevent the kernel from moving the thread to a different processor |
54 | while the calculation is performed. | 86 | while the calculation is performed. |
55 | 87 | ||
56 | The main use of the this_cpu operations has been to optimize counter | 88 | Consider the following this_cpu operation: |
57 | operations. | ||
58 | 89 | ||
59 | this_cpu_inc(x) | 90 | this_cpu_inc(x) |
60 | 91 | ||
61 | results in the following single instruction (no lock prefix!) | 92 | The above results in the following single instruction (no lock prefix!) |
62 | 93 | ||
63 | inc gs:[x] | 94 | inc gs:[x] |
64 | 95 | ||
65 | instead of the following operations required if there is no segment | 96 | instead of the following operations required if there is no segment |
66 | register. | 97 | register: |
67 | 98 | ||
68 | int *y; | 99 | int *y; |
69 | int cpu; | 100 | int cpu; |
@@ -73,10 +104,10 @@ register. | |||
73 | (*y)++; | 104 | (*y)++; |
74 | put_cpu(); | 105 | put_cpu(); |
75 | 106 | ||
76 | Note that these operations can only be used on percpu data that is | 107 | Note that these operations can only be used on per cpu data that is |
77 | reserved for a specific processor. Without disabling preemption in the | 108 | reserved for a specific processor. Without disabling preemption in the |
78 | surrounding code this_cpu_inc() will only guarantee that one of the | 109 | surrounding code this_cpu_inc() will only guarantee that one of the |
79 | percpu counters is correctly incremented. However, there is no | 110 | per cpu counters is correctly incremented. However, there is no |
80 | guarantee that the OS will not move the process directly before or | 111 | guarantee that the OS will not move the process directly before or |
81 | after the this_cpu instruction is executed. In general this means that | 112 | after the this_cpu instruction is executed. In general this means that |
82 | the value of the individual counters for each processor are | 113 | the value of the individual counters for each processor are |
@@ -86,9 +117,9 @@ that is of interest. | |||
86 | Per cpu variables are used for performance reasons. Bouncing cache | 117 | Per cpu variables are used for performance reasons. Bouncing cache |
87 | lines can be avoided if multiple processors concurrently go through | 118 | lines can be avoided if multiple processors concurrently go through |
88 | the same code paths. Since each processor has its own per cpu | 119 | the same code paths. Since each processor has its own per cpu |
89 | variables no concurrent cacheline updates take place. The price that | 120 | variables no concurrent cache line updates take place. The price that |
90 | has to be paid for this optimization is the need to add up the per cpu | 121 | has to be paid for this optimization is the need to add up the per cpu |
91 | counters when the value of the counter is needed. | 122 | counters when the value of a counter is needed. |
92 | 123 | ||
93 | 124 | ||
94 | Special operations: | 125 | Special operations: |
@@ -100,33 +131,39 @@ Takes the offset of a per cpu variable (&x !) and returns the address | |||
100 | of the per cpu variable that belongs to the currently executing | 131 | of the per cpu variable that belongs to the currently executing |
101 | processor. this_cpu_ptr avoids multiple steps that the common | 132 | processor. this_cpu_ptr avoids multiple steps that the common |
102 | get_cpu/put_cpu sequence requires. No processor number is | 133 | get_cpu/put_cpu sequence requires. No processor number is |
103 | available. Instead the offset of the local per cpu area is simply | 134 | available. Instead, the offset of the local per cpu area is simply |
104 | added to the percpu offset. | 135 | added to the per cpu offset. |
105 | 136 | ||
137 | Note that this operation is usually used in a code segment when | ||
138 | preemption has been disabled. The pointer is then used to | ||
139 | access local per cpu data in a critical section. When preemption | ||
140 | is re-enabled this pointer is usually no longer useful since it may | ||
141 | no longer point to per cpu data of the current processor. | ||
106 | 142 | ||
107 | 143 | ||
108 | Per cpu variables and offsets | 144 | Per cpu variables and offsets |
109 | ----------------------------- | 145 | ----------------------------- |
110 | 146 | ||
111 | Per cpu variables have *offsets* to the beginning of the percpu | 147 | Per cpu variables have *offsets* to the beginning of the per cpu |
112 | area. They do not have addresses although they look like that in the | 148 | area. They do not have addresses although they look like that in the |
113 | code. Offsets cannot be directly dereferenced. The offset must be | 149 | code. Offsets cannot be directly dereferenced. The offset must be |
114 | added to a base pointer of a percpu area of a processor in order to | 150 | added to a base pointer of a per cpu area of a processor in order to |
115 | form a valid address. | 151 | form a valid address. |
116 | 152 | ||
117 | Therefore the use of x or &x outside of the context of per cpu | 153 | Therefore the use of x or &x outside of the context of per cpu |
118 | operations is invalid and will generally be treated like a NULL | 154 | operations is invalid and will generally be treated like a NULL |
119 | pointer dereference. | 155 | pointer dereference. |
120 | 156 | ||
121 | In the context of per cpu operations | 157 | DEFINE_PER_CPU(int, x); |
122 | 158 | ||
123 | x is a per cpu variable. Most this_cpu operations take a cpu | 159 | In the context of per cpu operations the above implies that x is a per |
124 | variable. | 160 | cpu variable. Most this_cpu operations take a cpu variable. |
125 | 161 | ||
126 | &x is the *offset* a per cpu variable. this_cpu_ptr() takes | 162 | int __percpu *p = &x; |
127 | the offset of a per cpu variable which makes this look a bit | ||
128 | strange. | ||
129 | 163 | ||
164 | &x and hence p is the *offset* of a per cpu variable. this_cpu_ptr() | ||
165 | takes the offset of a per cpu variable which makes this look a bit | ||
166 | strange. | ||
130 | 167 | ||
131 | 168 | ||
132 | Operations on a field of a per cpu structure | 169 | Operations on a field of a per cpu structure |
@@ -152,7 +189,7 @@ If we have an offset to struct s: | |||
152 | 189 | ||
153 | struct s __percpu *ps = &p; | 190 | struct s __percpu *ps = &p; |
154 | 191 | ||
155 | z = this_cpu_dec(ps->m); | 192 | this_cpu_dec(ps->m); |
156 | 193 | ||
157 | z = this_cpu_inc_return(ps->n); | 194 | z = this_cpu_inc_return(ps->n); |
158 | 195 | ||
@@ -172,29 +209,52 @@ if we do not make use of this_cpu ops later to manipulate fields: | |||
172 | Variants of this_cpu ops | 209 | Variants of this_cpu ops |
173 | ------------------------- | 210 | ------------------------- |
174 | 211 | ||
175 | this_cpu ops are interrupt safe. Some architecture do not support | 212 | this_cpu ops are interrupt safe. Some architectures do not support |
176 | these per cpu local operations. In that case the operation must be | 213 | these per cpu local operations. In that case the operation must be |
177 | replaced by code that disables interrupts, then does the operations | 214 | replaced by code that disables interrupts, then does the operations |
178 | that are guaranteed to be atomic and then reenable interrupts. Doing | 215 | that are guaranteed to be atomic and then re-enable interrupts. Doing |
179 | so is expensive. If there are other reasons why the scheduler cannot | 216 | so is expensive. If there are other reasons why the scheduler cannot |
180 | change the processor we are executing on then there is no reason to | 217 | change the processor we are executing on then there is no reason to |
181 | disable interrupts. For that purpose the __this_cpu operations are | 218 | disable interrupts. For that purpose the following __this_cpu operations |
182 | provided. For example. | 219 | are provided. |
183 | 220 | ||
184 | __this_cpu_inc(x); | 221 | These operations have no guarantee against concurrent interrupts or |
185 | 222 | preemption. If a per cpu variable is not used in an interrupt context | |
186 | Will increment x and will not fallback to code that disables | 223 | and the scheduler cannot preempt, then they are safe. If any interrupts |
224 | still occur while an operation is in progress and if the interrupt too | ||
225 | modifies the variable, then RMW actions can not be guaranteed to be | ||
226 | safe. | ||
227 | |||
228 | __this_cpu_add() | ||
229 | __this_cpu_read(pcp) | ||
230 | __this_cpu_write(pcp, val) | ||
231 | __this_cpu_add(pcp, val) | ||
232 | __this_cpu_and(pcp, val) | ||
233 | __this_cpu_or(pcp, val) | ||
234 | __this_cpu_add_return(pcp, val) | ||
235 | __this_cpu_xchg(pcp, nval) | ||
236 | __this_cpu_cmpxchg(pcp, oval, nval) | ||
237 | __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | ||
238 | __this_cpu_sub(pcp, val) | ||
239 | __this_cpu_inc(pcp) | ||
240 | __this_cpu_dec(pcp) | ||
241 | __this_cpu_sub_return(pcp, val) | ||
242 | __this_cpu_inc_return(pcp) | ||
243 | __this_cpu_dec_return(pcp) | ||
244 | |||
245 | |||
246 | Will increment x and will not fall-back to code that disables | ||
187 | interrupts on platforms that cannot accomplish atomicity through | 247 | interrupts on platforms that cannot accomplish atomicity through |
188 | address relocation and a Read-Modify-Write operation in the same | 248 | address relocation and a Read-Modify-Write operation in the same |
189 | instruction. | 249 | instruction. |
190 | 250 | ||
191 | 251 | ||
192 | |||
193 | &this_cpu_ptr(pp)->n vs this_cpu_ptr(&pp->n) | 252 | &this_cpu_ptr(pp)->n vs this_cpu_ptr(&pp->n) |
194 | -------------------------------------------- | 253 | -------------------------------------------- |
195 | 254 | ||
196 | The first operation takes the offset and forms an address and then | 255 | The first operation takes the offset and forms an address and then |
197 | adds the offset of the n field. | 256 | adds the offset of the n field. This may result in two add |
257 | instructions emitted by the compiler. | ||
198 | 258 | ||
199 | The second one first adds the two offsets and then does the | 259 | The second one first adds the two offsets and then does the |
200 | relocation. IMHO the second form looks cleaner and has an easier time | 260 | relocation. IMHO the second form looks cleaner and has an easier time |
@@ -202,4 +262,73 @@ with (). The second form also is consistent with the way | |||
202 | this_cpu_read() and friends are used. | 262 | this_cpu_read() and friends are used. |
203 | 263 | ||
204 | 264 | ||
205 | Christoph Lameter, April 3rd, 2013 | 265 | Remote access to per cpu data |
266 | ------------------------------ | ||
267 | |||
268 | Per cpu data structures are designed to be used by one cpu exclusively. | ||
269 | If you use the variables as intended, this_cpu_ops() are guaranteed to | ||
270 | be "atomic" as no other CPU has access to these data structures. | ||
271 | |||
272 | There are special cases where you might need to access per cpu data | ||
273 | structures remotely. It is usually safe to do a remote read access | ||
274 | and that is frequently done to summarize counters. Remote write access | ||
275 | something which could be problematic because this_cpu ops do not | ||
276 | have lock semantics. A remote write may interfere with a this_cpu | ||
277 | RMW operation. | ||
278 | |||
279 | Remote write accesses to percpu data structures are highly discouraged | ||
280 | unless absolutely necessary. Please consider using an IPI to wake up | ||
281 | the remote CPU and perform the update to its per cpu area. | ||
282 | |||
283 | To access per-cpu data structure remotely, typically the per_cpu_ptr() | ||
284 | function is used: | ||
285 | |||
286 | |||
287 | DEFINE_PER_CPU(struct data, datap); | ||
288 | |||
289 | struct data *p = per_cpu_ptr(&datap, cpu); | ||
290 | |||
291 | This makes it explicit that we are getting ready to access a percpu | ||
292 | area remotely. | ||
293 | |||
294 | You can also do the following to convert the datap offset to an address | ||
295 | |||
296 | struct data *p = this_cpu_ptr(&datap); | ||
297 | |||
298 | but, passing of pointers calculated via this_cpu_ptr to other cpus is | ||
299 | unusual and should be avoided. | ||
300 | |||
301 | Remote access are typically only for reading the status of another cpus | ||
302 | per cpu data. Write accesses can cause unique problems due to the | ||
303 | relaxed synchronization requirements for this_cpu operations. | ||
304 | |||
305 | One example that illustrates some concerns with write operations is | ||
306 | the following scenario that occurs because two per cpu variables | ||
307 | share a cache-line but the relaxed synchronization is applied to | ||
308 | only one process updating the cache-line. | ||
309 | |||
310 | Consider the following example | ||
311 | |||
312 | |||
313 | struct test { | ||
314 | atomic_t a; | ||
315 | int b; | ||
316 | }; | ||
317 | |||
318 | DEFINE_PER_CPU(struct test, onecacheline); | ||
319 | |||
320 | There is some concern about what would happen if the field 'a' is updated | ||
321 | remotely from one processor and the local processor would use this_cpu ops | ||
322 | to update field b. Care should be taken that such simultaneous accesses to | ||
323 | data within the same cache line are avoided. Also costly synchronization | ||
324 | may be necessary. IPIs are generally recommended in such scenarios instead | ||
325 | of a remote write to the per cpu area of another processor. | ||
326 | |||
327 | Even in cases where the remote writes are rare, please bear in | ||
328 | mind that a remote write will evict the cache line from the processor | ||
329 | that most likely will access it. If the processor wakes up and finds a | ||
330 | missing local cache line of a per cpu area, its performance and hence | ||
331 | the wake up times will be affected. | ||
332 | |||
333 | Christoph Lameter, August 4th, 2014 | ||
334 | Pranith Kumar, Aug 2nd, 2014 | ||
diff --git a/Documentation/x86/tlb.txt b/Documentation/x86/tlb.txt index 2b3a82e69151..39d172326703 100644 --- a/Documentation/x86/tlb.txt +++ b/Documentation/x86/tlb.txt | |||
@@ -35,7 +35,7 @@ invlpg instruction (or instructions _near_ it) show up high in | |||
35 | profiles. If you believe that individual invalidations being | 35 | profiles. If you believe that individual invalidations being |
36 | called too often, you can lower the tunable: | 36 | called too often, you can lower the tunable: |
37 | 37 | ||
38 | /sys/debug/kernel/x86/tlb_single_page_flush_ceiling | 38 | /sys/kernel/debug/x86/tlb_single_page_flush_ceiling |
39 | 39 | ||
40 | This will cause us to do the global flush for more cases. | 40 | This will cause us to do the global flush for more cases. |
41 | Lowering it to 0 will disable the use of the individual flushes. | 41 | Lowering it to 0 will disable the use of the individual flushes. |
diff --git a/MAINTAINERS b/MAINTAINERS index aefa94841ff3..37054306dc9f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1277,9 +1277,15 @@ F: drivers/scsi/arm/ | |||
1277 | ARM/Rockchip SoC support | 1277 | ARM/Rockchip SoC support |
1278 | M: Heiko Stuebner <heiko@sntech.de> | 1278 | M: Heiko Stuebner <heiko@sntech.de> |
1279 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1279 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1280 | L: linux-rockchip@lists.infradead.org | ||
1280 | S: Maintained | 1281 | S: Maintained |
1282 | F: arch/arm/boot/dts/rk3* | ||
1281 | F: arch/arm/mach-rockchip/ | 1283 | F: arch/arm/mach-rockchip/ |
1284 | F: drivers/clk/rockchip/ | ||
1285 | F: drivers/i2c/busses/i2c-rk3x.c | ||
1282 | F: drivers/*/*rockchip* | 1286 | F: drivers/*/*rockchip* |
1287 | F: drivers/*/*/*rockchip* | ||
1288 | F: sound/soc/rockchip/ | ||
1283 | 1289 | ||
1284 | ARM/SAMSUNG ARM ARCHITECTURES | 1290 | ARM/SAMSUNG ARM ARCHITECTURES |
1285 | M: Ben Dooks <ben-linux@fluff.org> | 1291 | M: Ben Dooks <ben-linux@fluff.org> |
@@ -1843,6 +1849,12 @@ S: Orphan | |||
1843 | F: Documentation/filesystems/befs.txt | 1849 | F: Documentation/filesystems/befs.txt |
1844 | F: fs/befs/ | 1850 | F: fs/befs/ |
1845 | 1851 | ||
1852 | BECKHOFF CX5020 ETHERCAT MASTER DRIVER | ||
1853 | M: Dariusz Marcinkiewicz <reksio@newterm.pl> | ||
1854 | L: netdev@vger.kernel.org | ||
1855 | S: Maintained | ||
1856 | F: drivers/net/ethernet/ec_bhf.c | ||
1857 | |||
1846 | BFS FILE SYSTEM | 1858 | BFS FILE SYSTEM |
1847 | M: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk> | 1859 | M: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk> |
1848 | S: Maintained | 1860 | S: Maintained |
@@ -2059,7 +2071,7 @@ S: Supported | |||
2059 | F: drivers/scsi/bnx2i/ | 2071 | F: drivers/scsi/bnx2i/ |
2060 | 2072 | ||
2061 | BROADCOM KONA GPIO DRIVER | 2073 | BROADCOM KONA GPIO DRIVER |
2062 | M: Markus Mayer <markus.mayer@linaro.org> | 2074 | M: Ray Jui <rjui@broadcom.com> |
2063 | L: bcm-kernel-feedback-list@broadcom.com | 2075 | L: bcm-kernel-feedback-list@broadcom.com |
2064 | S: Supported | 2076 | S: Supported |
2065 | F: drivers/gpio/gpio-bcm-kona.c | 2077 | F: drivers/gpio/gpio-bcm-kona.c |
@@ -3000,9 +3012,8 @@ S: Supported | |||
3000 | F: drivers/acpi/dock.c | 3012 | F: drivers/acpi/dock.c |
3001 | 3013 | ||
3002 | DOCUMENTATION | 3014 | DOCUMENTATION |
3003 | M: Randy Dunlap <rdunlap@infradead.org> | 3015 | M: Jiri Kosina <jkosina@suse.cz> |
3004 | L: linux-doc@vger.kernel.org | 3016 | L: linux-doc@vger.kernel.org |
3005 | T: quilt http://www.infradead.org/~rdunlap/Doc/patches/ | ||
3006 | S: Maintained | 3017 | S: Maintained |
3007 | F: Documentation/ | 3018 | F: Documentation/ |
3008 | X: Documentation/ABI/ | 3019 | X: Documentation/ABI/ |
@@ -3115,6 +3126,17 @@ F: include/linux/host1x.h | |||
3115 | F: include/uapi/drm/tegra_drm.h | 3126 | F: include/uapi/drm/tegra_drm.h |
3116 | F: Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt | 3127 | F: Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt |
3117 | 3128 | ||
3129 | DRM DRIVERS FOR RENESAS | ||
3130 | M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
3131 | L: dri-devel@lists.freedesktop.org | ||
3132 | L: linux-sh@vger.kernel.org | ||
3133 | T: git git://people.freedesktop.org/~airlied/linux | ||
3134 | S: Supported | ||
3135 | F: drivers/gpu/drm/rcar-du/ | ||
3136 | F: drivers/gpu/drm/shmobile/ | ||
3137 | F: include/linux/platform_data/rcar-du.h | ||
3138 | F: include/linux/platform_data/shmob_drm.h | ||
3139 | |||
3118 | DSBR100 USB FM RADIO DRIVER | 3140 | DSBR100 USB FM RADIO DRIVER |
3119 | M: Alexey Klimov <klimov.linux@gmail.com> | 3141 | M: Alexey Klimov <klimov.linux@gmail.com> |
3120 | L: linux-media@vger.kernel.org | 3142 | L: linux-media@vger.kernel.org |
@@ -3843,10 +3865,13 @@ F: drivers/tty/serial/ucc_uart.c | |||
3843 | 3865 | ||
3844 | FREESCALE SOC SOUND DRIVERS | 3866 | FREESCALE SOC SOUND DRIVERS |
3845 | M: Timur Tabi <timur@tabi.org> | 3867 | M: Timur Tabi <timur@tabi.org> |
3868 | M: Nicolin Chen <nicoleotsuka@gmail.com> | ||
3869 | M: Xiubo Li <Li.Xiubo@freescale.com> | ||
3846 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 3870 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
3847 | L: linuxppc-dev@lists.ozlabs.org | 3871 | L: linuxppc-dev@lists.ozlabs.org |
3848 | S: Maintained | 3872 | S: Maintained |
3849 | F: sound/soc/fsl/fsl* | 3873 | F: sound/soc/fsl/fsl* |
3874 | F: sound/soc/fsl/imx* | ||
3850 | F: sound/soc/fsl/mpc8610_hpcd.c | 3875 | F: sound/soc/fsl/mpc8610_hpcd.c |
3851 | 3876 | ||
3852 | FREEVXFS FILESYSTEM | 3877 | FREEVXFS FILESYSTEM |
@@ -4446,6 +4471,12 @@ F: include/linux/i2c-*.h | |||
4446 | F: include/uapi/linux/i2c.h | 4471 | F: include/uapi/linux/i2c.h |
4447 | F: include/uapi/linux/i2c-*.h | 4472 | F: include/uapi/linux/i2c-*.h |
4448 | 4473 | ||
4474 | I2C ACPI SUPPORT | ||
4475 | M: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
4476 | L: linux-i2c@vger.kernel.org | ||
4477 | L: linux-acpi@vger.kernel.org | ||
4478 | S: Maintained | ||
4479 | |||
4449 | I2C-TAOS-EVM DRIVER | 4480 | I2C-TAOS-EVM DRIVER |
4450 | M: Jean Delvare <jdelvare@suse.de> | 4481 | M: Jean Delvare <jdelvare@suse.de> |
4451 | L: linux-i2c@vger.kernel.org | 4482 | L: linux-i2c@vger.kernel.org |
@@ -5972,6 +6003,12 @@ T: git git://linuxtv.org/media_tree.git | |||
5972 | S: Maintained | 6003 | S: Maintained |
5973 | F: drivers/media/radio/radio-mr800.c | 6004 | F: drivers/media/radio/radio-mr800.c |
5974 | 6005 | ||
6006 | MRF24J40 IEEE 802.15.4 RADIO DRIVER | ||
6007 | M: Alan Ott <alan@signal11.us> | ||
6008 | L: linux-wpan@vger.kernel.org | ||
6009 | S: Maintained | ||
6010 | F: drivers/net/ieee802154/mrf24j40.c | ||
6011 | |||
5975 | MSI LAPTOP SUPPORT | 6012 | MSI LAPTOP SUPPORT |
5976 | M: "Lee, Chun-Yi" <jlee@suse.com> | 6013 | M: "Lee, Chun-Yi" <jlee@suse.com> |
5977 | L: platform-driver-x86@vger.kernel.org | 6014 | L: platform-driver-x86@vger.kernel.org |
@@ -6385,7 +6422,8 @@ F: Documentation/scsi/NinjaSCSI.txt | |||
6385 | F: drivers/scsi/nsp32* | 6422 | F: drivers/scsi/nsp32* |
6386 | 6423 | ||
6387 | NTB DRIVER | 6424 | NTB DRIVER |
6388 | M: Jon Mason <jon.mason@intel.com> | 6425 | M: Jon Mason <jdmason@kudzu.us> |
6426 | M: Dave Jiang <dave.jiang@intel.com> | ||
6389 | S: Supported | 6427 | S: Supported |
6390 | W: https://github.com/jonmason/ntb/wiki | 6428 | W: https://github.com/jonmason/ntb/wiki |
6391 | T: git git://github.com/jonmason/ntb.git | 6429 | T: git git://github.com/jonmason/ntb.git |
@@ -6836,7 +6874,7 @@ F: arch/x86/kernel/quirks.c | |||
6836 | 6874 | ||
6837 | PCI DRIVER FOR IMX6 | 6875 | PCI DRIVER FOR IMX6 |
6838 | M: Richard Zhu <r65037@freescale.com> | 6876 | M: Richard Zhu <r65037@freescale.com> |
6839 | M: Shawn Guo <shawn.guo@freescale.com> | 6877 | M: Lucas Stach <l.stach@pengutronix.de> |
6840 | L: linux-pci@vger.kernel.org | 6878 | L: linux-pci@vger.kernel.org |
6841 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 6879 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
6842 | S: Maintained | 6880 | S: Maintained |
@@ -6858,6 +6896,14 @@ S: Supported | |||
6858 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | 6896 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt |
6859 | F: drivers/pci/host/pci-tegra.c | 6897 | F: drivers/pci/host/pci-tegra.c |
6860 | 6898 | ||
6899 | PCI DRIVER FOR TI DRA7XX | ||
6900 | M: Kishon Vijay Abraham I <kishon@ti.com> | ||
6901 | L: linux-omap@vger.kernel.org | ||
6902 | L: linux-pci@vger.kernel.org | ||
6903 | S: Supported | ||
6904 | F: Documentation/devicetree/bindings/pci/ti-pci.txt | ||
6905 | F: drivers/pci/host/pci-dra7xx.c | ||
6906 | |||
6861 | PCI DRIVER FOR RENESAS R-CAR | 6907 | PCI DRIVER FOR RENESAS R-CAR |
6862 | M: Simon Horman <horms@verge.net.au> | 6908 | M: Simon Horman <horms@verge.net.au> |
6863 | L: linux-pci@vger.kernel.org | 6909 | L: linux-pci@vger.kernel.org |
@@ -7006,7 +7052,7 @@ S: Maintained | |||
7006 | F: drivers/pinctrl/sh-pfc/ | 7052 | F: drivers/pinctrl/sh-pfc/ |
7007 | 7053 | ||
7008 | PIN CONTROLLER - SAMSUNG | 7054 | PIN CONTROLLER - SAMSUNG |
7009 | M: Tomasz Figa <t.figa@samsung.com> | 7055 | M: Tomasz Figa <tomasz.figa@gmail.com> |
7010 | M: Thomas Abraham <thomas.abraham@linaro.org> | 7056 | M: Thomas Abraham <thomas.abraham@linaro.org> |
7011 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 7057 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
7012 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 7058 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
@@ -7852,7 +7898,8 @@ S: Supported | |||
7852 | F: drivers/media/i2c/s5k5baf.c | 7898 | F: drivers/media/i2c/s5k5baf.c |
7853 | 7899 | ||
7854 | SAMSUNG SOC CLOCK DRIVERS | 7900 | SAMSUNG SOC CLOCK DRIVERS |
7855 | M: Tomasz Figa <t.figa@samsung.com> | 7901 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> |
7902 | M: Tomasz Figa <tomasz.figa@gmail.com> | ||
7856 | S: Supported | 7903 | S: Supported |
7857 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 7904 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
7858 | F: drivers/clk/samsung/ | 7905 | F: drivers/clk/samsung/ |
@@ -7865,6 +7912,19 @@ S: Supported | |||
7865 | L: netdev@vger.kernel.org | 7912 | L: netdev@vger.kernel.org |
7866 | F: drivers/net/ethernet/samsung/sxgbe/ | 7913 | F: drivers/net/ethernet/samsung/sxgbe/ |
7867 | 7914 | ||
7915 | SAMSUNG USB2 PHY DRIVER | ||
7916 | M: Kamil Debski <k.debski@samsung.com> | ||
7917 | L: linux-kernel@vger.kernel.org | ||
7918 | S: Supported | ||
7919 | F: Documentation/devicetree/bindings/phy/samsung-phy.txt | ||
7920 | F: Documentation/phy/samsung-usb2.txt | ||
7921 | F: drivers/phy/phy-exynos4210-usb2.c | ||
7922 | F: drivers/phy/phy-exynos4x12-usb2.c | ||
7923 | F: drivers/phy/phy-exynos5250-usb2.c | ||
7924 | F: drivers/phy/phy-s5pv210-usb2.c | ||
7925 | F: drivers/phy/phy-samsung-usb2.c | ||
7926 | F: drivers/phy/phy-samsung-usb2.h | ||
7927 | |||
7868 | SERIAL DRIVERS | 7928 | SERIAL DRIVERS |
7869 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 7929 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
7870 | L: linux-serial@vger.kernel.org | 7930 | L: linux-serial@vger.kernel.org |
@@ -9515,6 +9575,14 @@ S: Maintained | |||
9515 | F: Documentation/usb/ohci.txt | 9575 | F: Documentation/usb/ohci.txt |
9516 | F: drivers/usb/host/ohci* | 9576 | F: drivers/usb/host/ohci* |
9517 | 9577 | ||
9578 | USB OVER IP DRIVER | ||
9579 | M: Valentina Manea <valentina.manea.m@gmail.com> | ||
9580 | M: Shuah Khan <shuah.kh@samsung.com> | ||
9581 | L: linux-usb@vger.kernel.org | ||
9582 | S: Maintained | ||
9583 | F: drivers/usb/usbip/ | ||
9584 | F: tools/usb/usbip/ | ||
9585 | |||
9518 | USB PEGASUS DRIVER | 9586 | USB PEGASUS DRIVER |
9519 | M: Petko Manolov <petkan@nucleusys.com> | 9587 | M: Petko Manolov <petkan@nucleusys.com> |
9520 | L: linux-usb@vger.kernel.org | 9588 | L: linux-usb@vger.kernel.org |
@@ -10015,9 +10083,9 @@ F: Documentation/x86/ | |||
10015 | F: arch/x86/ | 10083 | F: arch/x86/ |
10016 | 10084 | ||
10017 | X86 PLATFORM DRIVERS | 10085 | X86 PLATFORM DRIVERS |
10018 | M: Matthew Garrett <matthew.garrett@nebula.com> | 10086 | M: Darren Hart <dvhart@infradead.org> |
10019 | L: platform-driver-x86@vger.kernel.org | 10087 | L: platform-driver-x86@vger.kernel.org |
10020 | T: git git://cavan.codon.org.uk/platform-drivers-x86.git | 10088 | T: git git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git |
10021 | S: Maintained | 10089 | S: Maintained |
10022 | F: drivers/platform/x86/ | 10090 | F: drivers/platform/x86/ |
10023 | 10091 | ||
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 17 | 2 | PATCHLEVEL = 17 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h index 5ebab5895edb..f05bdb4b1cb9 100644 --- a/arch/alpha/include/asm/io.h +++ b/arch/alpha/include/asm/io.h | |||
@@ -500,10 +500,14 @@ extern inline void writeq(u64 b, volatile void __iomem *addr) | |||
500 | #define outb_p outb | 500 | #define outb_p outb |
501 | #define outw_p outw | 501 | #define outw_p outw |
502 | #define outl_p outl | 502 | #define outl_p outl |
503 | #define readb_relaxed(addr) __raw_readb(addr) | 503 | #define readb_relaxed(addr) __raw_readb(addr) |
504 | #define readw_relaxed(addr) __raw_readw(addr) | 504 | #define readw_relaxed(addr) __raw_readw(addr) |
505 | #define readl_relaxed(addr) __raw_readl(addr) | 505 | #define readl_relaxed(addr) __raw_readl(addr) |
506 | #define readq_relaxed(addr) __raw_readq(addr) | 506 | #define readq_relaxed(addr) __raw_readq(addr) |
507 | #define writeb_relaxed(b, addr) __raw_writeb(b, addr) | ||
508 | #define writew_relaxed(b, addr) __raw_writew(b, addr) | ||
509 | #define writel_relaxed(b, addr) __raw_writel(b, addr) | ||
510 | #define writeq_relaxed(b, addr) __raw_writeq(b, addr) | ||
507 | 511 | ||
508 | #define mmiowb() | 512 | #define mmiowb() |
509 | 513 | ||
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index f2c94402e2c8..c509d306db45 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <uapi/asm/unistd.h> | 4 | #include <uapi/asm/unistd.h> |
5 | 5 | ||
6 | #define NR_SYSCALLS 508 | 6 | #define NR_SYSCALLS 511 |
7 | 7 | ||
8 | #define __ARCH_WANT_OLD_READDIR | 8 | #define __ARCH_WANT_OLD_READDIR |
9 | #define __ARCH_WANT_STAT64 | 9 | #define __ARCH_WANT_STAT64 |
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h index 53ae7bb1bfd1..d214a0358100 100644 --- a/arch/alpha/include/uapi/asm/unistd.h +++ b/arch/alpha/include/uapi/asm/unistd.h | |||
@@ -469,5 +469,8 @@ | |||
469 | #define __NR_process_vm_writev 505 | 469 | #define __NR_process_vm_writev 505 |
470 | #define __NR_kcmp 506 | 470 | #define __NR_kcmp 506 |
471 | #define __NR_finit_module 507 | 471 | #define __NR_finit_module 507 |
472 | #define __NR_sched_setattr 508 | ||
473 | #define __NR_sched_getattr 509 | ||
474 | #define __NR_renameat2 510 | ||
472 | 475 | ||
473 | #endif /* _UAPI_ALPHA_UNISTD_H */ | 476 | #endif /* _UAPI_ALPHA_UNISTD_H */ |
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index dca9b3fb0071..24789713f1ea 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S | |||
@@ -526,6 +526,9 @@ sys_call_table: | |||
526 | .quad sys_process_vm_writev /* 505 */ | 526 | .quad sys_process_vm_writev /* 505 */ |
527 | .quad sys_kcmp | 527 | .quad sys_kcmp |
528 | .quad sys_finit_module | 528 | .quad sys_finit_module |
529 | .quad sys_sched_setattr | ||
530 | .quad sys_sched_getattr | ||
531 | .quad sys_renameat2 /* 510 */ | ||
529 | 532 | ||
530 | .size sys_call_table, . - sys_call_table | 533 | .size sys_call_table, . - sys_call_table |
531 | .type sys_call_table, @object | 534 | .type sys_call_table, @object |
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c index 4670afc3b971..9e1142729fd1 100644 --- a/arch/arc/mm/cache_arc700.c +++ b/arch/arc/mm/cache_arc700.c | |||
@@ -427,7 +427,7 @@ struct ic_inv_args { | |||
427 | 427 | ||
428 | static void __ic_line_inv_vaddr_helper(void *info) | 428 | static void __ic_line_inv_vaddr_helper(void *info) |
429 | { | 429 | { |
430 | struct ic_inv *ic_inv_args = (struct ic_inv_args *) info; | 430 | struct ic_inv_args *ic_inv = info; |
431 | 431 | ||
432 | __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz); | 432 | __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz); |
433 | } | 433 | } |
@@ -581,6 +581,7 @@ void flush_icache_range(unsigned long kstart, unsigned long kend) | |||
581 | tot_sz -= sz; | 581 | tot_sz -= sz; |
582 | } | 582 | } |
583 | } | 583 | } |
584 | EXPORT_SYMBOL(flush_icache_range); | ||
584 | 585 | ||
585 | /* | 586 | /* |
586 | * General purpose helper to make I and D cache lines consistent. | 587 | * General purpose helper to make I and D cache lines consistent. |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c49a775937db..32cbbd565902 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1983,8 +1983,6 @@ config XIP_PHYS_ADDR | |||
1983 | config KEXEC | 1983 | config KEXEC |
1984 | bool "Kexec system call (EXPERIMENTAL)" | 1984 | bool "Kexec system call (EXPERIMENTAL)" |
1985 | depends on (!SMP || PM_SLEEP_SMP) | 1985 | depends on (!SMP || PM_SLEEP_SMP) |
1986 | select CRYPTO | ||
1987 | select CRYPTO_SHA256 | ||
1988 | help | 1986 | help |
1989 | kexec is a system call that implements the ability to shutdown your | 1987 | kexec is a system call that implements the ability to shutdown your |
1990 | current kernel, and to start another kernel. It is like a reboot | 1988 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi index 9b3d2ba82f13..8689949bdba3 100644 --- a/arch/arm/boot/dts/am4372.dtsi +++ b/arch/arm/boot/dts/am4372.dtsi | |||
@@ -804,7 +804,7 @@ | |||
804 | 804 | ||
805 | usb1: usb@48390000 { | 805 | usb1: usb@48390000 { |
806 | compatible = "synopsys,dwc3"; | 806 | compatible = "synopsys,dwc3"; |
807 | reg = <0x48390000 0x17000>; | 807 | reg = <0x48390000 0x10000>; |
808 | interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; | 808 | interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
809 | phys = <&usb2_phy1>; | 809 | phys = <&usb2_phy1>; |
810 | phy-names = "usb2-phy"; | 810 | phy-names = "usb2-phy"; |
@@ -826,7 +826,7 @@ | |||
826 | 826 | ||
827 | usb2: usb@483d0000 { | 827 | usb2: usb@483d0000 { |
828 | compatible = "synopsys,dwc3"; | 828 | compatible = "synopsys,dwc3"; |
829 | reg = <0x483d0000 0x17000>; | 829 | reg = <0x483d0000 0x10000>; |
830 | interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; | 830 | interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; |
831 | phys = <&usb2_phy2>; | 831 | phys = <&usb2_phy2>; |
832 | phy-names = "usb2-phy"; | 832 | phy-names = "usb2-phy"; |
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts index 646a6eade788..e7ac47fa6615 100644 --- a/arch/arm/boot/dts/am437x-gp-evm.dts +++ b/arch/arm/boot/dts/am437x-gp-evm.dts | |||
@@ -260,7 +260,7 @@ | |||
260 | status = "okay"; | 260 | status = "okay"; |
261 | pinctrl-names = "default"; | 261 | pinctrl-names = "default"; |
262 | pinctrl-0 = <&i2c0_pins>; | 262 | pinctrl-0 = <&i2c0_pins>; |
263 | clock-frequency = <400000>; | 263 | clock-frequency = <100000>; |
264 | 264 | ||
265 | tps65218: tps65218@24 { | 265 | tps65218: tps65218@24 { |
266 | reg = <0x24>; | 266 | reg = <0x24>; |
@@ -424,7 +424,7 @@ | |||
424 | ranges = <0 0 0 0x01000000>; /* minimum GPMC partition = 16MB */ | 424 | ranges = <0 0 0 0x01000000>; /* minimum GPMC partition = 16MB */ |
425 | nand@0,0 { | 425 | nand@0,0 { |
426 | reg = <0 0 4>; /* device IO registers */ | 426 | reg = <0 0 4>; /* device IO registers */ |
427 | ti,nand-ecc-opt = "bch8"; | 427 | ti,nand-ecc-opt = "bch16"; |
428 | ti,elm-id = <&elm>; | 428 | ti,elm-id = <&elm>; |
429 | nand-bus-width = <8>; | 429 | nand-bus-width = <8>; |
430 | gpmc,device-width = <1>; | 430 | gpmc,device-width = <1>; |
@@ -443,8 +443,6 @@ | |||
443 | gpmc,rd-cycle-ns = <40>; | 443 | gpmc,rd-cycle-ns = <40>; |
444 | gpmc,wr-cycle-ns = <40>; | 444 | gpmc,wr-cycle-ns = <40>; |
445 | gpmc,wait-pin = <0>; | 445 | gpmc,wait-pin = <0>; |
446 | gpmc,wait-on-read; | ||
447 | gpmc,wait-on-write; | ||
448 | gpmc,bus-turnaround-ns = <0>; | 446 | gpmc,bus-turnaround-ns = <0>; |
449 | gpmc,cycle2cycle-delay-ns = <0>; | 447 | gpmc,cycle2cycle-delay-ns = <0>; |
450 | gpmc,clk-activation-ns = <0>; | 448 | gpmc,clk-activation-ns = <0>; |
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index ed7dd2395915..ac3e4859935f 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts | |||
@@ -435,13 +435,13 @@ | |||
435 | }; | 435 | }; |
436 | 436 | ||
437 | &gpmc { | 437 | &gpmc { |
438 | status = "okay"; | 438 | status = "okay"; /* Disable QSPI when enabling GPMC (NAND) */ |
439 | pinctrl-names = "default"; | 439 | pinctrl-names = "default"; |
440 | pinctrl-0 = <&nand_flash_x8>; | 440 | pinctrl-0 = <&nand_flash_x8>; |
441 | ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */ | 441 | ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */ |
442 | nand@0,0 { | 442 | nand@0,0 { |
443 | reg = <0 0 0>; /* CS0, offset 0 */ | 443 | reg = <0 0 0>; /* CS0, offset 0 */ |
444 | ti,nand-ecc-opt = "bch8"; | 444 | ti,nand-ecc-opt = "bch16"; |
445 | ti,elm-id = <&elm>; | 445 | ti,elm-id = <&elm>; |
446 | nand-bus-width = <8>; | 446 | nand-bus-width = <8>; |
447 | gpmc,device-width = <1>; | 447 | gpmc,device-width = <1>; |
@@ -459,8 +459,7 @@ | |||
459 | gpmc,access-ns = <30>; /* tCEA + 4*/ | 459 | gpmc,access-ns = <30>; /* tCEA + 4*/ |
460 | gpmc,rd-cycle-ns = <40>; | 460 | gpmc,rd-cycle-ns = <40>; |
461 | gpmc,wr-cycle-ns = <40>; | 461 | gpmc,wr-cycle-ns = <40>; |
462 | gpmc,wait-on-read = "true"; | 462 | gpmc,wait-pin = <0>; |
463 | gpmc,wait-on-write = "true"; | ||
464 | gpmc,bus-turnaround-ns = <0>; | 463 | gpmc,bus-turnaround-ns = <0>; |
465 | gpmc,cycle2cycle-delay-ns = <0>; | 464 | gpmc,cycle2cycle-delay-ns = <0>; |
466 | gpmc,clk-activation-ns = <0>; | 465 | gpmc,clk-activation-ns = <0>; |
@@ -557,7 +556,7 @@ | |||
557 | }; | 556 | }; |
558 | 557 | ||
559 | &qspi { | 558 | &qspi { |
560 | status = "okay"; | 559 | status = "disabled"; /* Disable GPMC (NAND) when enabling QSPI */ |
561 | pinctrl-names = "default"; | 560 | pinctrl-names = "default"; |
562 | pinctrl-0 = <&qspi1_default>; | 561 | pinctrl-0 = <&qspi1_default>; |
563 | 562 | ||
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi index 65ccf564b9a5..6c97d4af61ee 100644 --- a/arch/arm/boot/dts/at91rm9200.dtsi +++ b/arch/arm/boot/dts/at91rm9200.dtsi | |||
@@ -149,7 +149,7 @@ | |||
149 | usb: usbck { | 149 | usb: usbck { |
150 | compatible = "atmel,at91rm9200-clk-usb"; | 150 | compatible = "atmel,at91rm9200-clk-usb"; |
151 | #clock-cells = <0>; | 151 | #clock-cells = <0>; |
152 | atmel,clk-divisors = <1 2>; | 152 | atmel,clk-divisors = <1 2 0 0>; |
153 | clocks = <&pllb>; | 153 | clocks = <&pllb>; |
154 | }; | 154 | }; |
155 | 155 | ||
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi index 31f7652612fc..4e0abbd9d655 100644 --- a/arch/arm/boot/dts/at91sam9g20.dtsi +++ b/arch/arm/boot/dts/at91sam9g20.dtsi | |||
@@ -40,6 +40,7 @@ | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | pllb: pllbck { | 42 | pllb: pllbck { |
43 | compatible = "atmel,at91sam9g20-clk-pllb"; | ||
43 | atmel,clk-input-range = <2000000 32000000>; | 44 | atmel,clk-input-range = <2000000 32000000>; |
44 | atmel,pll-clk-output-ranges = <30000000 100000000 0 0>; | 45 | atmel,pll-clk-output-ranges = <30000000 100000000 0 0>; |
45 | }; | 46 | }; |
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index 50f8022905a1..b40cdadb1f87 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -8,6 +8,7 @@ | |||
8 | /dts-v1/; | 8 | /dts-v1/; |
9 | 9 | ||
10 | #include "dra74x.dtsi" | 10 | #include "dra74x.dtsi" |
11 | #include <dt-bindings/gpio/gpio.h> | ||
11 | 12 | ||
12 | / { | 13 | / { |
13 | model = "TI DRA742"; | 14 | model = "TI DRA742"; |
@@ -24,9 +25,29 @@ | |||
24 | regulator-min-microvolt = <3300000>; | 25 | regulator-min-microvolt = <3300000>; |
25 | regulator-max-microvolt = <3300000>; | 26 | regulator-max-microvolt = <3300000>; |
26 | }; | 27 | }; |
28 | |||
29 | vtt_fixed: fixedregulator-vtt { | ||
30 | compatible = "regulator-fixed"; | ||
31 | regulator-name = "vtt_fixed"; | ||
32 | regulator-min-microvolt = <1350000>; | ||
33 | regulator-max-microvolt = <1350000>; | ||
34 | regulator-always-on; | ||
35 | regulator-boot-on; | ||
36 | enable-active-high; | ||
37 | gpio = <&gpio7 11 GPIO_ACTIVE_HIGH>; | ||
38 | }; | ||
27 | }; | 39 | }; |
28 | 40 | ||
29 | &dra7_pmx_core { | 41 | &dra7_pmx_core { |
42 | pinctrl-names = "default"; | ||
43 | pinctrl-0 = <&vtt_pin>; | ||
44 | |||
45 | vtt_pin: pinmux_vtt_pin { | ||
46 | pinctrl-single,pins = < | ||
47 | 0x3b4 (PIN_OUTPUT | MUX_MODE14) /* spi1_cs1.gpio7_11 */ | ||
48 | >; | ||
49 | }; | ||
50 | |||
30 | i2c1_pins: pinmux_i2c1_pins { | 51 | i2c1_pins: pinmux_i2c1_pins { |
31 | pinctrl-single,pins = < | 52 | pinctrl-single,pins = < |
32 | 0x400 (PIN_INPUT | MUX_MODE0) /* i2c1_sda */ | 53 | 0x400 (PIN_INPUT | MUX_MODE0) /* i2c1_sda */ |
@@ -43,20 +64,19 @@ | |||
43 | 64 | ||
44 | i2c3_pins: pinmux_i2c3_pins { | 65 | i2c3_pins: pinmux_i2c3_pins { |
45 | pinctrl-single,pins = < | 66 | pinctrl-single,pins = < |
46 | 0x410 (PIN_INPUT | MUX_MODE0) /* i2c3_sda */ | 67 | 0x288 (PIN_INPUT | MUX_MODE9) /* gpio6_14.i2c3_sda */ |
47 | 0x414 (PIN_INPUT | MUX_MODE0) /* i2c3_scl */ | 68 | 0x28c (PIN_INPUT | MUX_MODE9) /* gpio6_15.i2c3_scl */ |
48 | >; | 69 | >; |
49 | }; | 70 | }; |
50 | 71 | ||
51 | mcspi1_pins: pinmux_mcspi1_pins { | 72 | mcspi1_pins: pinmux_mcspi1_pins { |
52 | pinctrl-single,pins = < | 73 | pinctrl-single,pins = < |
53 | 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi2_clk */ | 74 | 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi1_sclk */ |
54 | 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi2_d1 */ | 75 | 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi1_d1 */ |
55 | 0x3ac (PIN_INPUT | MUX_MODE0) /* spi2_d0 */ | 76 | 0x3ac (PIN_INPUT | MUX_MODE0) /* spi1_d0 */ |
56 | 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs0 */ | 77 | 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi1_cs0 */ |
57 | 0x3b4 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs1 */ | 78 | 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs2.hdmi1_hpd */ |
58 | 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs2 */ | 79 | 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs3.hdmi1_cec */ |
59 | 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs3 */ | ||
60 | >; | 80 | >; |
61 | }; | 81 | }; |
62 | 82 | ||
@@ -284,7 +304,7 @@ | |||
284 | status = "okay"; | 304 | status = "okay"; |
285 | pinctrl-names = "default"; | 305 | pinctrl-names = "default"; |
286 | pinctrl-0 = <&i2c3_pins>; | 306 | pinctrl-0 = <&i2c3_pins>; |
287 | clock-frequency = <3400000>; | 307 | clock-frequency = <400000>; |
288 | }; | 308 | }; |
289 | 309 | ||
290 | &mcspi1 { | 310 | &mcspi1 { |
@@ -427,22 +447,19 @@ | |||
427 | gpmc,device-width = <2>; | 447 | gpmc,device-width = <2>; |
428 | gpmc,sync-clk-ps = <0>; | 448 | gpmc,sync-clk-ps = <0>; |
429 | gpmc,cs-on-ns = <0>; | 449 | gpmc,cs-on-ns = <0>; |
430 | gpmc,cs-rd-off-ns = <40>; | 450 | gpmc,cs-rd-off-ns = <80>; |
431 | gpmc,cs-wr-off-ns = <40>; | 451 | gpmc,cs-wr-off-ns = <80>; |
432 | gpmc,adv-on-ns = <0>; | 452 | gpmc,adv-on-ns = <0>; |
433 | gpmc,adv-rd-off-ns = <30>; | 453 | gpmc,adv-rd-off-ns = <60>; |
434 | gpmc,adv-wr-off-ns = <30>; | 454 | gpmc,adv-wr-off-ns = <60>; |
435 | gpmc,we-on-ns = <5>; | 455 | gpmc,we-on-ns = <10>; |
436 | gpmc,we-off-ns = <25>; | 456 | gpmc,we-off-ns = <50>; |
437 | gpmc,oe-on-ns = <2>; | 457 | gpmc,oe-on-ns = <4>; |
438 | gpmc,oe-off-ns = <20>; | 458 | gpmc,oe-off-ns = <40>; |
439 | gpmc,access-ns = <20>; | 459 | gpmc,access-ns = <40>; |
440 | gpmc,wr-access-ns = <40>; | 460 | gpmc,wr-access-ns = <80>; |
441 | gpmc,rd-cycle-ns = <40>; | 461 | gpmc,rd-cycle-ns = <80>; |
442 | gpmc,wr-cycle-ns = <40>; | 462 | gpmc,wr-cycle-ns = <80>; |
443 | gpmc,wait-pin = <0>; | ||
444 | gpmc,wait-on-read; | ||
445 | gpmc,wait-on-write; | ||
446 | gpmc,bus-turnaround-ns = <0>; | 463 | gpmc,bus-turnaround-ns = <0>; |
447 | gpmc,cycle2cycle-delay-ns = <0>; | 464 | gpmc,cycle2cycle-delay-ns = <0>; |
448 | gpmc,clk-activation-ns = <0>; | 465 | gpmc,clk-activation-ns = <0>; |
@@ -483,7 +500,7 @@ | |||
483 | reg = <0x001c0000 0x00020000>; | 500 | reg = <0x001c0000 0x00020000>; |
484 | }; | 501 | }; |
485 | partition@7 { | 502 | partition@7 { |
486 | label = "NAND.u-boot-env"; | 503 | label = "NAND.u-boot-env.backup1"; |
487 | reg = <0x001e0000 0x00020000>; | 504 | reg = <0x001e0000 0x00020000>; |
488 | }; | 505 | }; |
489 | partition@8 { | 506 | partition@8 { |
@@ -504,3 +521,8 @@ | |||
504 | &usb2_phy2 { | 521 | &usb2_phy2 { |
505 | phy-supply = <&ldousb_reg>; | 522 | phy-supply = <&ldousb_reg>; |
506 | }; | 523 | }; |
524 | |||
525 | &gpio7 { | ||
526 | ti,no-reset-on-init; | ||
527 | ti,no-idle-on-init; | ||
528 | }; | ||
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 97f603c4483d..d678152db4cb 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
@@ -245,7 +245,7 @@ | |||
245 | gpio-controller; | 245 | gpio-controller; |
246 | #gpio-cells = <2>; | 246 | #gpio-cells = <2>; |
247 | interrupt-controller; | 247 | interrupt-controller; |
248 | #interrupt-cells = <1>; | 248 | #interrupt-cells = <2>; |
249 | }; | 249 | }; |
250 | 250 | ||
251 | gpio2: gpio@48055000 { | 251 | gpio2: gpio@48055000 { |
@@ -256,7 +256,7 @@ | |||
256 | gpio-controller; | 256 | gpio-controller; |
257 | #gpio-cells = <2>; | 257 | #gpio-cells = <2>; |
258 | interrupt-controller; | 258 | interrupt-controller; |
259 | #interrupt-cells = <1>; | 259 | #interrupt-cells = <2>; |
260 | }; | 260 | }; |
261 | 261 | ||
262 | gpio3: gpio@48057000 { | 262 | gpio3: gpio@48057000 { |
@@ -267,7 +267,7 @@ | |||
267 | gpio-controller; | 267 | gpio-controller; |
268 | #gpio-cells = <2>; | 268 | #gpio-cells = <2>; |
269 | interrupt-controller; | 269 | interrupt-controller; |
270 | #interrupt-cells = <1>; | 270 | #interrupt-cells = <2>; |
271 | }; | 271 | }; |
272 | 272 | ||
273 | gpio4: gpio@48059000 { | 273 | gpio4: gpio@48059000 { |
@@ -278,7 +278,7 @@ | |||
278 | gpio-controller; | 278 | gpio-controller; |
279 | #gpio-cells = <2>; | 279 | #gpio-cells = <2>; |
280 | interrupt-controller; | 280 | interrupt-controller; |
281 | #interrupt-cells = <1>; | 281 | #interrupt-cells = <2>; |
282 | }; | 282 | }; |
283 | 283 | ||
284 | gpio5: gpio@4805b000 { | 284 | gpio5: gpio@4805b000 { |
@@ -289,7 +289,7 @@ | |||
289 | gpio-controller; | 289 | gpio-controller; |
290 | #gpio-cells = <2>; | 290 | #gpio-cells = <2>; |
291 | interrupt-controller; | 291 | interrupt-controller; |
292 | #interrupt-cells = <1>; | 292 | #interrupt-cells = <2>; |
293 | }; | 293 | }; |
294 | 294 | ||
295 | gpio6: gpio@4805d000 { | 295 | gpio6: gpio@4805d000 { |
@@ -300,7 +300,7 @@ | |||
300 | gpio-controller; | 300 | gpio-controller; |
301 | #gpio-cells = <2>; | 301 | #gpio-cells = <2>; |
302 | interrupt-controller; | 302 | interrupt-controller; |
303 | #interrupt-cells = <1>; | 303 | #interrupt-cells = <2>; |
304 | }; | 304 | }; |
305 | 305 | ||
306 | gpio7: gpio@48051000 { | 306 | gpio7: gpio@48051000 { |
@@ -311,7 +311,7 @@ | |||
311 | gpio-controller; | 311 | gpio-controller; |
312 | #gpio-cells = <2>; | 312 | #gpio-cells = <2>; |
313 | interrupt-controller; | 313 | interrupt-controller; |
314 | #interrupt-cells = <1>; | 314 | #interrupt-cells = <2>; |
315 | }; | 315 | }; |
316 | 316 | ||
317 | gpio8: gpio@48053000 { | 317 | gpio8: gpio@48053000 { |
@@ -322,7 +322,7 @@ | |||
322 | gpio-controller; | 322 | gpio-controller; |
323 | #gpio-cells = <2>; | 323 | #gpio-cells = <2>; |
324 | interrupt-controller; | 324 | interrupt-controller; |
325 | #interrupt-cells = <1>; | 325 | #interrupt-cells = <2>; |
326 | }; | 326 | }; |
327 | 327 | ||
328 | uart1: serial@4806a000 { | 328 | uart1: serial@4806a000 { |
diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi index 6d6d23c83d30..adadaf97ac01 100644 --- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi +++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi | |||
@@ -134,6 +134,8 @@ | |||
134 | i2c@13860000 { | 134 | i2c@13860000 { |
135 | pinctrl-0 = <&i2c0_bus>; | 135 | pinctrl-0 = <&i2c0_bus>; |
136 | pinctrl-names = "default"; | 136 | pinctrl-names = "default"; |
137 | samsung,i2c-sda-delay = <100>; | ||
138 | samsung,i2c-max-bus-freq = <400000>; | ||
137 | status = "okay"; | 139 | status = "okay"; |
138 | 140 | ||
139 | usb3503: usb3503@08 { | 141 | usb3503: usb3503@08 { |
@@ -148,6 +150,10 @@ | |||
148 | 150 | ||
149 | max77686: pmic@09 { | 151 | max77686: pmic@09 { |
150 | compatible = "maxim,max77686"; | 152 | compatible = "maxim,max77686"; |
153 | interrupt-parent = <&gpx3>; | ||
154 | interrupts = <2 0>; | ||
155 | pinctrl-names = "default"; | ||
156 | pinctrl-0 = <&max77686_irq>; | ||
151 | reg = <0x09>; | 157 | reg = <0x09>; |
152 | #clock-cells = <1>; | 158 | #clock-cells = <1>; |
153 | 159 | ||
@@ -368,4 +374,11 @@ | |||
368 | samsung,pins = "gpx1-3"; | 374 | samsung,pins = "gpx1-3"; |
369 | samsung,pin-pud = <0>; | 375 | samsung,pin-pud = <0>; |
370 | }; | 376 | }; |
377 | |||
378 | max77686_irq: max77686-irq { | ||
379 | samsung,pins = "gpx3-2"; | ||
380 | samsung,pin-function = <0>; | ||
381 | samsung,pin-pud = <0>; | ||
382 | samsung,pin-drv = <0>; | ||
383 | }; | ||
371 | }; | 384 | }; |
diff --git a/arch/arm/boot/dts/imx53-qsrb.dts b/arch/arm/boot/dts/imx53-qsrb.dts index f1bbf9a32991..82d623d05915 100644 --- a/arch/arm/boot/dts/imx53-qsrb.dts +++ b/arch/arm/boot/dts/imx53-qsrb.dts | |||
@@ -28,6 +28,12 @@ | |||
28 | MX53_PAD_CSI0_DAT9__I2C1_SCL 0x400001ec | 28 | MX53_PAD_CSI0_DAT9__I2C1_SCL 0x400001ec |
29 | >; | 29 | >; |
30 | }; | 30 | }; |
31 | |||
32 | pinctrl_pmic: pmicgrp { | ||
33 | fsl,pins = < | ||
34 | MX53_PAD_CSI0_DAT5__GPIO5_23 0x1e4 /* IRQ */ | ||
35 | >; | ||
36 | }; | ||
31 | }; | 37 | }; |
32 | }; | 38 | }; |
33 | 39 | ||
@@ -38,6 +44,8 @@ | |||
38 | 44 | ||
39 | pmic: mc34708@8 { | 45 | pmic: mc34708@8 { |
40 | compatible = "fsl,mc34708"; | 46 | compatible = "fsl,mc34708"; |
47 | pinctrl-names = "default"; | ||
48 | pinctrl-0 = <&pinctrl_pmic>; | ||
41 | reg = <0x08>; | 49 | reg = <0x08>; |
42 | interrupt-parent = <&gpio5>; | 50 | interrupt-parent = <&gpio5>; |
43 | interrupts = <23 0x8>; | 51 | interrupts = <23 0x8>; |
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi index 64fa27b36be0..6b675a02066f 100644 --- a/arch/arm/boot/dts/imx53.dtsi +++ b/arch/arm/boot/dts/imx53.dtsi | |||
@@ -423,10 +423,14 @@ | |||
423 | status = "disabled"; | 423 | status = "disabled"; |
424 | 424 | ||
425 | lvds-channel@0 { | 425 | lvds-channel@0 { |
426 | #address-cells = <1>; | ||
427 | #size-cells = <0>; | ||
426 | reg = <0>; | 428 | reg = <0>; |
427 | status = "disabled"; | 429 | status = "disabled"; |
428 | 430 | ||
429 | port { | 431 | port@0 { |
432 | reg = <0>; | ||
433 | |||
430 | lvds0_in: endpoint { | 434 | lvds0_in: endpoint { |
431 | remote-endpoint = <&ipu_di0_lvds0>; | 435 | remote-endpoint = <&ipu_di0_lvds0>; |
432 | }; | 436 | }; |
@@ -434,10 +438,14 @@ | |||
434 | }; | 438 | }; |
435 | 439 | ||
436 | lvds-channel@1 { | 440 | lvds-channel@1 { |
441 | #address-cells = <1>; | ||
442 | #size-cells = <0>; | ||
437 | reg = <1>; | 443 | reg = <1>; |
438 | status = "disabled"; | 444 | status = "disabled"; |
439 | 445 | ||
440 | port { | 446 | port@1 { |
447 | reg = <1>; | ||
448 | |||
441 | lvds1_in: endpoint { | 449 | lvds1_in: endpoint { |
442 | remote-endpoint = <&ipu_di1_lvds1>; | 450 | remote-endpoint = <&ipu_di1_lvds1>; |
443 | }; | 451 | }; |
@@ -731,7 +739,7 @@ | |||
731 | compatible = "fsl,imx53-vpu"; | 739 | compatible = "fsl,imx53-vpu"; |
732 | reg = <0x63ff4000 0x1000>; | 740 | reg = <0x63ff4000 0x1000>; |
733 | interrupts = <9>; | 741 | interrupts = <9>; |
734 | clocks = <&clks IMX5_CLK_VPU_GATE>, | 742 | clocks = <&clks IMX5_CLK_VPU_REFERENCE_GATE>, |
735 | <&clks IMX5_CLK_VPU_GATE>; | 743 | <&clks IMX5_CLK_VPU_GATE>; |
736 | clock-names = "per", "ahb"; | 744 | clock-names = "per", "ahb"; |
737 | resets = <&src 1>; | 745 | resets = <&src 1>; |
diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts index c8e51dd41b8f..71598546087f 100644 --- a/arch/arm/boot/dts/imx6dl-hummingboard.dts +++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | sound-spdif { | 59 | sound-spdif { |
60 | compatible = "fsl,imx-audio-spdif"; | 60 | compatible = "fsl,imx-audio-spdif"; |
61 | model = "imx-spdif"; | 61 | model = "On-board SPDIF"; |
62 | /* IMX6 doesn't implement this yet */ | 62 | /* IMX6 doesn't implement this yet */ |
63 | spdif-controller = <&spdif>; | 63 | spdif-controller = <&spdif>; |
64 | spdif-out; | 64 | spdif-out; |
@@ -181,11 +181,13 @@ | |||
181 | }; | 181 | }; |
182 | 182 | ||
183 | &usbh1 { | 183 | &usbh1 { |
184 | disable-over-current; | ||
184 | vbus-supply = <®_usbh1_vbus>; | 185 | vbus-supply = <®_usbh1_vbus>; |
185 | status = "okay"; | 186 | status = "okay"; |
186 | }; | 187 | }; |
187 | 188 | ||
188 | &usbotg { | 189 | &usbotg { |
190 | disable-over-current; | ||
189 | pinctrl-names = "default"; | 191 | pinctrl-names = "default"; |
190 | pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>; | 192 | pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>; |
191 | vbus-supply = <®_usbotg_vbus>; | 193 | vbus-supply = <®_usbotg_vbus>; |
diff --git a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts index 8c1cb53464a0..4fa254347798 100644 --- a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts +++ b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts | |||
@@ -119,7 +119,7 @@ | |||
119 | pinctrl-names = "default"; | 119 | pinctrl-names = "default"; |
120 | pinctrl-0 = <&pinctrl_enet>; | 120 | pinctrl-0 = <&pinctrl_enet>; |
121 | phy-mode = "rgmii"; | 121 | phy-mode = "rgmii"; |
122 | phy-reset-gpios = <&gpio3 23 0>; | 122 | phy-reset-gpios = <&gpio1 25 0>; |
123 | phy-supply = <&vgen2_1v2_eth>; | 123 | phy-supply = <&vgen2_1v2_eth>; |
124 | status = "okay"; | 124 | status = "okay"; |
125 | }; | 125 | }; |
@@ -339,6 +339,7 @@ | |||
339 | MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 | 339 | MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 |
340 | MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 | 340 | MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 |
341 | MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 | 341 | MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 |
342 | MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1b0b0 | ||
342 | MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 | 343 | MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 |
343 | >; | 344 | >; |
344 | }; | 345 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi index e8e781656b3f..6a524ca011e7 100644 --- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi +++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | |||
@@ -61,7 +61,7 @@ | |||
61 | 61 | ||
62 | sound-spdif { | 62 | sound-spdif { |
63 | compatible = "fsl,imx-audio-spdif"; | 63 | compatible = "fsl,imx-audio-spdif"; |
64 | model = "imx-spdif"; | 64 | model = "Integrated SPDIF"; |
65 | /* IMX6 doesn't implement this yet */ | 65 | /* IMX6 doesn't implement this yet */ |
66 | spdif-controller = <&spdif>; | 66 | spdif-controller = <&spdif>; |
67 | spdif-out; | 67 | spdif-out; |
@@ -130,16 +130,23 @@ | |||
130 | fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; | 130 | fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | pinctrl_cubox_i_usbh1: cubox-i-usbh1 { | ||
134 | fsl,pins = <MX6QDL_PAD_GPIO_3__USB_H1_OC 0x1b0b0>; | ||
135 | }; | ||
136 | |||
133 | pinctrl_cubox_i_usbh1_vbus: cubox-i-usbh1-vbus { | 137 | pinctrl_cubox_i_usbh1_vbus: cubox-i-usbh1-vbus { |
134 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; | 138 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; |
135 | }; | 139 | }; |
136 | 140 | ||
137 | pinctrl_cubox_i_usbotg_id: cubox-i-usbotg-id { | 141 | pinctrl_cubox_i_usbotg: cubox-i-usbotg { |
138 | /* | 142 | /* |
139 | * The Cubox-i pulls this low, but as it's pointless | 143 | * The Cubox-i pulls ID low, but as it's pointless |
140 | * leaving it as a pull-up, even if it is just 10uA. | 144 | * leaving it as a pull-up, even if it is just 10uA. |
141 | */ | 145 | */ |
142 | fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | 146 | fsl,pins = < |
147 | MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059 | ||
148 | MX6QDL_PAD_KEY_COL4__USB_OTG_OC 0x1b0b0 | ||
149 | >; | ||
143 | }; | 150 | }; |
144 | 151 | ||
145 | pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { | 152 | pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { |
@@ -173,13 +180,15 @@ | |||
173 | }; | 180 | }; |
174 | 181 | ||
175 | &usbh1 { | 182 | &usbh1 { |
183 | pinctrl-names = "default"; | ||
184 | pinctrl-0 = <&pinctrl_cubox_i_usbh1>; | ||
176 | vbus-supply = <®_usbh1_vbus>; | 185 | vbus-supply = <®_usbh1_vbus>; |
177 | status = "okay"; | 186 | status = "okay"; |
178 | }; | 187 | }; |
179 | 188 | ||
180 | &usbotg { | 189 | &usbotg { |
181 | pinctrl-names = "default"; | 190 | pinctrl-names = "default"; |
182 | pinctrl-0 = <&pinctrl_cubox_i_usbotg_id>; | 191 | pinctrl-0 = <&pinctrl_cubox_i_usbotg>; |
183 | vbus-supply = <®_usbotg_vbus>; | 192 | vbus-supply = <®_usbotg_vbus>; |
184 | status = "okay"; | 193 | status = "okay"; |
185 | }; | 194 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi b/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi index d16066608e21..db9f45b2c573 100644 --- a/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi +++ b/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi | |||
@@ -17,7 +17,7 @@ | |||
17 | enet { | 17 | enet { |
18 | pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 { | 18 | pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 { |
19 | fsl,pins = < | 19 | fsl,pins = < |
20 | MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 | 20 | MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b8b0 |
21 | MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 | 21 | MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 |
22 | /* AR8035 reset */ | 22 | /* AR8035 reset */ |
23 | MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0 | 23 | MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0 |
diff --git a/arch/arm/boot/dts/imx6sx-pinfunc.h b/arch/arm/boot/dts/imx6sx-pinfunc.h index 3e0b816dac08..bb9c6b78cb97 100644 --- a/arch/arm/boot/dts/imx6sx-pinfunc.h +++ b/arch/arm/boot/dts/imx6sx-pinfunc.h | |||
@@ -78,7 +78,7 @@ | |||
78 | #define MX6SX_PAD_GPIO1_IO07__USDHC2_WP 0x0030 0x0378 0x0870 0x1 0x1 | 78 | #define MX6SX_PAD_GPIO1_IO07__USDHC2_WP 0x0030 0x0378 0x0870 0x1 0x1 |
79 | #define MX6SX_PAD_GPIO1_IO07__ENET2_MDIO 0x0030 0x0378 0x0770 0x2 0x0 | 79 | #define MX6SX_PAD_GPIO1_IO07__ENET2_MDIO 0x0030 0x0378 0x0770 0x2 0x0 |
80 | #define MX6SX_PAD_GPIO1_IO07__AUDMUX_MCLK 0x0030 0x0378 0x0000 0x3 0x0 | 80 | #define MX6SX_PAD_GPIO1_IO07__AUDMUX_MCLK 0x0030 0x0378 0x0000 0x3 0x0 |
81 | #define MX6SX_PAD_GPIO1_IO07__UART1_CTS_B 0x0030 0x0378 0x082C 0x4 0x1 | 81 | #define MX6SX_PAD_GPIO1_IO07__UART1_CTS_B 0x0030 0x0378 0x0000 0x4 0x0 |
82 | #define MX6SX_PAD_GPIO1_IO07__GPIO1_IO_7 0x0030 0x0378 0x0000 0x5 0x0 | 82 | #define MX6SX_PAD_GPIO1_IO07__GPIO1_IO_7 0x0030 0x0378 0x0000 0x5 0x0 |
83 | #define MX6SX_PAD_GPIO1_IO07__SRC_EARLY_RESET 0x0030 0x0378 0x0000 0x6 0x0 | 83 | #define MX6SX_PAD_GPIO1_IO07__SRC_EARLY_RESET 0x0030 0x0378 0x0000 0x6 0x0 |
84 | #define MX6SX_PAD_GPIO1_IO07__DCIC2_OUT 0x0030 0x0378 0x0000 0x7 0x0 | 84 | #define MX6SX_PAD_GPIO1_IO07__DCIC2_OUT 0x0030 0x0378 0x0000 0x7 0x0 |
@@ -96,7 +96,7 @@ | |||
96 | #define MX6SX_PAD_GPIO1_IO09__WDOG2_WDOG_B 0x0038 0x0380 0x0000 0x1 0x0 | 96 | #define MX6SX_PAD_GPIO1_IO09__WDOG2_WDOG_B 0x0038 0x0380 0x0000 0x1 0x0 |
97 | #define MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x0038 0x0380 0x0820 0x2 0x0 | 97 | #define MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x0038 0x0380 0x0820 0x2 0x0 |
98 | #define MX6SX_PAD_GPIO1_IO09__CCM_OUT0 0x0038 0x0380 0x0000 0x3 0x0 | 98 | #define MX6SX_PAD_GPIO1_IO09__CCM_OUT0 0x0038 0x0380 0x0000 0x3 0x0 |
99 | #define MX6SX_PAD_GPIO1_IO09__UART2_CTS_B 0x0038 0x0380 0x0834 0x4 0x1 | 99 | #define MX6SX_PAD_GPIO1_IO09__UART2_CTS_B 0x0038 0x0380 0x0000 0x4 0x0 |
100 | #define MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x0038 0x0380 0x0000 0x5 0x0 | 100 | #define MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x0038 0x0380 0x0000 0x5 0x0 |
101 | #define MX6SX_PAD_GPIO1_IO09__SRC_INT_BOOT 0x0038 0x0380 0x0000 0x6 0x0 | 101 | #define MX6SX_PAD_GPIO1_IO09__SRC_INT_BOOT 0x0038 0x0380 0x0000 0x6 0x0 |
102 | #define MX6SX_PAD_GPIO1_IO09__OBSERVE_MUX_OUT_4 0x0038 0x0380 0x0000 0x7 0x0 | 102 | #define MX6SX_PAD_GPIO1_IO09__OBSERVE_MUX_OUT_4 0x0038 0x0380 0x0000 0x7 0x0 |
@@ -213,7 +213,7 @@ | |||
213 | #define MX6SX_PAD_CSI_DATA07__ESAI_TX3_RX2 0x0068 0x03B0 0x079C 0x1 0x1 | 213 | #define MX6SX_PAD_CSI_DATA07__ESAI_TX3_RX2 0x0068 0x03B0 0x079C 0x1 0x1 |
214 | #define MX6SX_PAD_CSI_DATA07__I2C4_SDA 0x0068 0x03B0 0x07C4 0x2 0x2 | 214 | #define MX6SX_PAD_CSI_DATA07__I2C4_SDA 0x0068 0x03B0 0x07C4 0x2 0x2 |
215 | #define MX6SX_PAD_CSI_DATA07__KPP_ROW_7 0x0068 0x03B0 0x07DC 0x3 0x0 | 215 | #define MX6SX_PAD_CSI_DATA07__KPP_ROW_7 0x0068 0x03B0 0x07DC 0x3 0x0 |
216 | #define MX6SX_PAD_CSI_DATA07__UART6_CTS_B 0x0068 0x03B0 0x0854 0x4 0x1 | 216 | #define MX6SX_PAD_CSI_DATA07__UART6_CTS_B 0x0068 0x03B0 0x0000 0x4 0x0 |
217 | #define MX6SX_PAD_CSI_DATA07__GPIO1_IO_21 0x0068 0x03B0 0x0000 0x5 0x0 | 217 | #define MX6SX_PAD_CSI_DATA07__GPIO1_IO_21 0x0068 0x03B0 0x0000 0x5 0x0 |
218 | #define MX6SX_PAD_CSI_DATA07__WEIM_DATA_16 0x0068 0x03B0 0x0000 0x6 0x0 | 218 | #define MX6SX_PAD_CSI_DATA07__WEIM_DATA_16 0x0068 0x03B0 0x0000 0x6 0x0 |
219 | #define MX6SX_PAD_CSI_DATA07__DCIC1_OUT 0x0068 0x03B0 0x0000 0x7 0x0 | 219 | #define MX6SX_PAD_CSI_DATA07__DCIC1_OUT 0x0068 0x03B0 0x0000 0x7 0x0 |
@@ -254,7 +254,7 @@ | |||
254 | #define MX6SX_PAD_CSI_VSYNC__CSI1_VSYNC 0x0078 0x03C0 0x0708 0x0 0x0 | 254 | #define MX6SX_PAD_CSI_VSYNC__CSI1_VSYNC 0x0078 0x03C0 0x0708 0x0 0x0 |
255 | #define MX6SX_PAD_CSI_VSYNC__ESAI_TX5_RX0 0x0078 0x03C0 0x07A4 0x1 0x1 | 255 | #define MX6SX_PAD_CSI_VSYNC__ESAI_TX5_RX0 0x0078 0x03C0 0x07A4 0x1 0x1 |
256 | #define MX6SX_PAD_CSI_VSYNC__AUDMUX_AUD6_RXD 0x0078 0x03C0 0x0674 0x2 0x1 | 256 | #define MX6SX_PAD_CSI_VSYNC__AUDMUX_AUD6_RXD 0x0078 0x03C0 0x0674 0x2 0x1 |
257 | #define MX6SX_PAD_CSI_VSYNC__UART4_CTS_B 0x0078 0x03C0 0x0844 0x3 0x3 | 257 | #define MX6SX_PAD_CSI_VSYNC__UART4_CTS_B 0x0078 0x03C0 0x0000 0x3 0x0 |
258 | #define MX6SX_PAD_CSI_VSYNC__MQS_RIGHT 0x0078 0x03C0 0x0000 0x4 0x0 | 258 | #define MX6SX_PAD_CSI_VSYNC__MQS_RIGHT 0x0078 0x03C0 0x0000 0x4 0x0 |
259 | #define MX6SX_PAD_CSI_VSYNC__GPIO1_IO_25 0x0078 0x03C0 0x0000 0x5 0x0 | 259 | #define MX6SX_PAD_CSI_VSYNC__GPIO1_IO_25 0x0078 0x03C0 0x0000 0x5 0x0 |
260 | #define MX6SX_PAD_CSI_VSYNC__WEIM_DATA_24 0x0078 0x03C0 0x0000 0x6 0x0 | 260 | #define MX6SX_PAD_CSI_VSYNC__WEIM_DATA_24 0x0078 0x03C0 0x0000 0x6 0x0 |
@@ -352,7 +352,7 @@ | |||
352 | #define MX6SX_PAD_ENET2_TX_CLK__ENET2_TX_CLK 0x00A0 0x03E8 0x0000 0x0 0x0 | 352 | #define MX6SX_PAD_ENET2_TX_CLK__ENET2_TX_CLK 0x00A0 0x03E8 0x0000 0x0 0x0 |
353 | #define MX6SX_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x00A0 0x03E8 0x076C 0x1 0x1 | 353 | #define MX6SX_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x00A0 0x03E8 0x076C 0x1 0x1 |
354 | #define MX6SX_PAD_ENET2_TX_CLK__I2C3_SDA 0x00A0 0x03E8 0x07BC 0x2 0x1 | 354 | #define MX6SX_PAD_ENET2_TX_CLK__I2C3_SDA 0x00A0 0x03E8 0x07BC 0x2 0x1 |
355 | #define MX6SX_PAD_ENET2_TX_CLK__UART1_CTS_B 0x00A0 0x03E8 0x082C 0x3 0x3 | 355 | #define MX6SX_PAD_ENET2_TX_CLK__UART1_CTS_B 0x00A0 0x03E8 0x0000 0x3 0x0 |
356 | #define MX6SX_PAD_ENET2_TX_CLK__MLB_CLK 0x00A0 0x03E8 0x07E8 0x4 0x1 | 356 | #define MX6SX_PAD_ENET2_TX_CLK__MLB_CLK 0x00A0 0x03E8 0x07E8 0x4 0x1 |
357 | #define MX6SX_PAD_ENET2_TX_CLK__GPIO2_IO_9 0x00A0 0x03E8 0x0000 0x5 0x0 | 357 | #define MX6SX_PAD_ENET2_TX_CLK__GPIO2_IO_9 0x00A0 0x03E8 0x0000 0x5 0x0 |
358 | #define MX6SX_PAD_ENET2_TX_CLK__USB_OTG2_PWR 0x00A0 0x03E8 0x0000 0x6 0x0 | 358 | #define MX6SX_PAD_ENET2_TX_CLK__USB_OTG2_PWR 0x00A0 0x03E8 0x0000 0x6 0x0 |
@@ -404,7 +404,7 @@ | |||
404 | #define MX6SX_PAD_KEY_COL4__SAI2_RX_BCLK 0x00B4 0x03FC 0x0808 0x7 0x0 | 404 | #define MX6SX_PAD_KEY_COL4__SAI2_RX_BCLK 0x00B4 0x03FC 0x0808 0x7 0x0 |
405 | #define MX6SX_PAD_KEY_ROW0__KPP_ROW_0 0x00B8 0x0400 0x0000 0x0 0x0 | 405 | #define MX6SX_PAD_KEY_ROW0__KPP_ROW_0 0x00B8 0x0400 0x0000 0x0 0x0 |
406 | #define MX6SX_PAD_KEY_ROW0__USDHC3_WP 0x00B8 0x0400 0x0000 0x1 0x0 | 406 | #define MX6SX_PAD_KEY_ROW0__USDHC3_WP 0x00B8 0x0400 0x0000 0x1 0x0 |
407 | #define MX6SX_PAD_KEY_ROW0__UART6_CTS_B 0x00B8 0x0400 0x0854 0x2 0x3 | 407 | #define MX6SX_PAD_KEY_ROW0__UART6_CTS_B 0x00B8 0x0400 0x0000 0x2 0x0 |
408 | #define MX6SX_PAD_KEY_ROW0__ECSPI1_MOSI 0x00B8 0x0400 0x0718 0x3 0x0 | 408 | #define MX6SX_PAD_KEY_ROW0__ECSPI1_MOSI 0x00B8 0x0400 0x0718 0x3 0x0 |
409 | #define MX6SX_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x00B8 0x0400 0x0660 0x4 0x0 | 409 | #define MX6SX_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x00B8 0x0400 0x0660 0x4 0x0 |
410 | #define MX6SX_PAD_KEY_ROW0__GPIO2_IO_15 0x00B8 0x0400 0x0000 0x5 0x0 | 410 | #define MX6SX_PAD_KEY_ROW0__GPIO2_IO_15 0x00B8 0x0400 0x0000 0x5 0x0 |
@@ -423,7 +423,7 @@ | |||
423 | #define MX6SX_PAD_KEY_ROW1__M4_NMI 0x00BC 0x0404 0x0000 0x8 0x0 | 423 | #define MX6SX_PAD_KEY_ROW1__M4_NMI 0x00BC 0x0404 0x0000 0x8 0x0 |
424 | #define MX6SX_PAD_KEY_ROW2__KPP_ROW_2 0x00C0 0x0408 0x0000 0x0 0x0 | 424 | #define MX6SX_PAD_KEY_ROW2__KPP_ROW_2 0x00C0 0x0408 0x0000 0x0 0x0 |
425 | #define MX6SX_PAD_KEY_ROW2__USDHC4_WP 0x00C0 0x0408 0x0878 0x1 0x1 | 425 | #define MX6SX_PAD_KEY_ROW2__USDHC4_WP 0x00C0 0x0408 0x0878 0x1 0x1 |
426 | #define MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x00C0 0x0408 0x084C 0x2 0x3 | 426 | #define MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x00C0 0x0408 0x0000 0x2 0x0 |
427 | #define MX6SX_PAD_KEY_ROW2__CAN1_RX 0x00C0 0x0408 0x068C 0x3 0x1 | 427 | #define MX6SX_PAD_KEY_ROW2__CAN1_RX 0x00C0 0x0408 0x068C 0x3 0x1 |
428 | #define MX6SX_PAD_KEY_ROW2__CANFD_RX1 0x00C0 0x0408 0x0694 0x4 0x1 | 428 | #define MX6SX_PAD_KEY_ROW2__CANFD_RX1 0x00C0 0x0408 0x0694 0x4 0x1 |
429 | #define MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x00C0 0x0408 0x0000 0x5 0x0 | 429 | #define MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x00C0 0x0408 0x0000 0x5 0x0 |
@@ -815,7 +815,7 @@ | |||
815 | #define MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 0x0164 0x04AC 0x0000 0x0 0x0 | 815 | #define MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 0x0164 0x04AC 0x0000 0x0 0x0 |
816 | #define MX6SX_PAD_NAND_DATA05__USDHC2_DATA5 0x0164 0x04AC 0x0000 0x1 0x0 | 816 | #define MX6SX_PAD_NAND_DATA05__USDHC2_DATA5 0x0164 0x04AC 0x0000 0x1 0x0 |
817 | #define MX6SX_PAD_NAND_DATA05__QSPI2_B_DQS 0x0164 0x04AC 0x0000 0x2 0x0 | 817 | #define MX6SX_PAD_NAND_DATA05__QSPI2_B_DQS 0x0164 0x04AC 0x0000 0x2 0x0 |
818 | #define MX6SX_PAD_NAND_DATA05__UART3_CTS_B 0x0164 0x04AC 0x083C 0x3 0x1 | 818 | #define MX6SX_PAD_NAND_DATA05__UART3_CTS_B 0x0164 0x04AC 0x0000 0x3 0x0 |
819 | #define MX6SX_PAD_NAND_DATA05__AUDMUX_AUD4_RXC 0x0164 0x04AC 0x064C 0x4 0x0 | 819 | #define MX6SX_PAD_NAND_DATA05__AUDMUX_AUD4_RXC 0x0164 0x04AC 0x064C 0x4 0x0 |
820 | #define MX6SX_PAD_NAND_DATA05__GPIO4_IO_9 0x0164 0x04AC 0x0000 0x5 0x0 | 820 | #define MX6SX_PAD_NAND_DATA05__GPIO4_IO_9 0x0164 0x04AC 0x0000 0x5 0x0 |
821 | #define MX6SX_PAD_NAND_DATA05__WEIM_AD_5 0x0164 0x04AC 0x0000 0x6 0x0 | 821 | #define MX6SX_PAD_NAND_DATA05__WEIM_AD_5 0x0164 0x04AC 0x0000 0x6 0x0 |
@@ -957,7 +957,7 @@ | |||
957 | #define MX6SX_PAD_QSPI1A_SS1_B__SIM_M_HADDR_12 0x019C 0x04E4 0x0000 0x7 0x0 | 957 | #define MX6SX_PAD_QSPI1A_SS1_B__SIM_M_HADDR_12 0x019C 0x04E4 0x0000 0x7 0x0 |
958 | #define MX6SX_PAD_QSPI1A_SS1_B__SDMA_DEBUG_PC_3 0x019C 0x04E4 0x0000 0x9 0x0 | 958 | #define MX6SX_PAD_QSPI1A_SS1_B__SDMA_DEBUG_PC_3 0x019C 0x04E4 0x0000 0x9 0x0 |
959 | #define MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 0x01A0 0x04E8 0x0000 0x0 0x0 | 959 | #define MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 0x01A0 0x04E8 0x0000 0x0 0x0 |
960 | #define MX6SX_PAD_QSPI1B_DATA0__UART3_CTS_B 0x01A0 0x04E8 0x083C 0x1 0x4 | 960 | #define MX6SX_PAD_QSPI1B_DATA0__UART3_CTS_B 0x01A0 0x04E8 0x0000 0x1 0x0 |
961 | #define MX6SX_PAD_QSPI1B_DATA0__ECSPI3_MOSI 0x01A0 0x04E8 0x0738 0x2 0x1 | 961 | #define MX6SX_PAD_QSPI1B_DATA0__ECSPI3_MOSI 0x01A0 0x04E8 0x0738 0x2 0x1 |
962 | #define MX6SX_PAD_QSPI1B_DATA0__ESAI_RX_FS 0x01A0 0x04E8 0x0778 0x3 0x2 | 962 | #define MX6SX_PAD_QSPI1B_DATA0__ESAI_RX_FS 0x01A0 0x04E8 0x0778 0x3 0x2 |
963 | #define MX6SX_PAD_QSPI1B_DATA0__CSI1_DATA_22 0x01A0 0x04E8 0x06F4 0x4 0x1 | 963 | #define MX6SX_PAD_QSPI1B_DATA0__CSI1_DATA_22 0x01A0 0x04E8 0x06F4 0x4 0x1 |
@@ -1236,7 +1236,7 @@ | |||
1236 | #define MX6SX_PAD_SD1_DATA2__AUDMUX_AUD5_TXFS 0x0230 0x0578 0x0670 0x1 0x1 | 1236 | #define MX6SX_PAD_SD1_DATA2__AUDMUX_AUD5_TXFS 0x0230 0x0578 0x0670 0x1 0x1 |
1237 | #define MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x0230 0x0578 0x0000 0x2 0x0 | 1237 | #define MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x0230 0x0578 0x0000 0x2 0x0 |
1238 | #define MX6SX_PAD_SD1_DATA2__GPT_COMPARE2 0x0230 0x0578 0x0000 0x3 0x0 | 1238 | #define MX6SX_PAD_SD1_DATA2__GPT_COMPARE2 0x0230 0x0578 0x0000 0x3 0x0 |
1239 | #define MX6SX_PAD_SD1_DATA2__UART2_CTS_B 0x0230 0x0578 0x0834 0x4 0x2 | 1239 | #define MX6SX_PAD_SD1_DATA2__UART2_CTS_B 0x0230 0x0578 0x0000 0x4 0x0 |
1240 | #define MX6SX_PAD_SD1_DATA2__GPIO6_IO_4 0x0230 0x0578 0x0000 0x5 0x0 | 1240 | #define MX6SX_PAD_SD1_DATA2__GPIO6_IO_4 0x0230 0x0578 0x0000 0x5 0x0 |
1241 | #define MX6SX_PAD_SD1_DATA2__ECSPI4_RDY 0x0230 0x0578 0x0000 0x6 0x0 | 1241 | #define MX6SX_PAD_SD1_DATA2__ECSPI4_RDY 0x0230 0x0578 0x0000 0x6 0x0 |
1242 | #define MX6SX_PAD_SD1_DATA2__CCM_OUT0 0x0230 0x0578 0x0000 0x7 0x0 | 1242 | #define MX6SX_PAD_SD1_DATA2__CCM_OUT0 0x0230 0x0578 0x0000 0x7 0x0 |
@@ -1315,7 +1315,7 @@ | |||
1315 | #define MX6SX_PAD_SD2_DATA3__VADC_CLAMP_CURRENT_3 0x024C 0x0594 0x0000 0x8 0x0 | 1315 | #define MX6SX_PAD_SD2_DATA3__VADC_CLAMP_CURRENT_3 0x024C 0x0594 0x0000 0x8 0x0 |
1316 | #define MX6SX_PAD_SD2_DATA3__MMDC_DEBUG_31 0x024C 0x0594 0x0000 0x9 0x0 | 1316 | #define MX6SX_PAD_SD2_DATA3__MMDC_DEBUG_31 0x024C 0x0594 0x0000 0x9 0x0 |
1317 | #define MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x0250 0x0598 0x0000 0x0 0x0 | 1317 | #define MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x0250 0x0598 0x0000 0x0 0x0 |
1318 | #define MX6SX_PAD_SD3_CLK__UART4_CTS_B 0x0250 0x0598 0x0844 0x1 0x0 | 1318 | #define MX6SX_PAD_SD3_CLK__UART4_CTS_B 0x0250 0x0598 0x0000 0x1 0x0 |
1319 | #define MX6SX_PAD_SD3_CLK__ECSPI4_SCLK 0x0250 0x0598 0x0740 0x2 0x0 | 1319 | #define MX6SX_PAD_SD3_CLK__ECSPI4_SCLK 0x0250 0x0598 0x0740 0x2 0x0 |
1320 | #define MX6SX_PAD_SD3_CLK__AUDMUX_AUD6_RXFS 0x0250 0x0598 0x0680 0x3 0x0 | 1320 | #define MX6SX_PAD_SD3_CLK__AUDMUX_AUD6_RXFS 0x0250 0x0598 0x0680 0x3 0x0 |
1321 | #define MX6SX_PAD_SD3_CLK__LCDIF2_VSYNC 0x0250 0x0598 0x0000 0x4 0x0 | 1321 | #define MX6SX_PAD_SD3_CLK__LCDIF2_VSYNC 0x0250 0x0598 0x0000 0x4 0x0 |
@@ -1409,7 +1409,7 @@ | |||
1409 | #define MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x0274 0x05BC 0x0000 0x0 0x0 | 1409 | #define MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x0274 0x05BC 0x0000 0x0 0x0 |
1410 | #define MX6SX_PAD_SD3_DATA7__CAN1_RX 0x0274 0x05BC 0x068C 0x1 0x0 | 1410 | #define MX6SX_PAD_SD3_DATA7__CAN1_RX 0x0274 0x05BC 0x068C 0x1 0x0 |
1411 | #define MX6SX_PAD_SD3_DATA7__CANFD_RX1 0x0274 0x05BC 0x0694 0x2 0x0 | 1411 | #define MX6SX_PAD_SD3_DATA7__CANFD_RX1 0x0274 0x05BC 0x0694 0x2 0x0 |
1412 | #define MX6SX_PAD_SD3_DATA7__UART3_CTS_B 0x0274 0x05BC 0x083C 0x3 0x3 | 1412 | #define MX6SX_PAD_SD3_DATA7__UART3_CTS_B 0x0274 0x05BC 0x0000 0x3 0x0 |
1413 | #define MX6SX_PAD_SD3_DATA7__LCDIF2_DATA_5 0x0274 0x05BC 0x0000 0x4 0x0 | 1413 | #define MX6SX_PAD_SD3_DATA7__LCDIF2_DATA_5 0x0274 0x05BC 0x0000 0x4 0x0 |
1414 | #define MX6SX_PAD_SD3_DATA7__GPIO7_IO_9 0x0274 0x05BC 0x0000 0x5 0x0 | 1414 | #define MX6SX_PAD_SD3_DATA7__GPIO7_IO_9 0x0274 0x05BC 0x0000 0x5 0x0 |
1415 | #define MX6SX_PAD_SD3_DATA7__ENET1_1588_EVENT0_IN 0x0274 0x05BC 0x0000 0x6 0x0 | 1415 | #define MX6SX_PAD_SD3_DATA7__ENET1_1588_EVENT0_IN 0x0274 0x05BC 0x0000 0x6 0x0 |
@@ -1510,7 +1510,7 @@ | |||
1510 | #define MX6SX_PAD_SD4_DATA6__SDMA_DEBUG_EVENT_CHANNEL_1 0x0298 0x05E0 0x0000 0x9 0x0 | 1510 | #define MX6SX_PAD_SD4_DATA6__SDMA_DEBUG_EVENT_CHANNEL_1 0x0298 0x05E0 0x0000 0x9 0x0 |
1511 | #define MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 0x029C 0x05E4 0x0000 0x0 0x0 | 1511 | #define MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 0x029C 0x05E4 0x0000 0x0 0x0 |
1512 | #define MX6SX_PAD_SD4_DATA7__RAWNAND_DATA08 0x029C 0x05E4 0x0000 0x1 0x0 | 1512 | #define MX6SX_PAD_SD4_DATA7__RAWNAND_DATA08 0x029C 0x05E4 0x0000 0x1 0x0 |
1513 | #define MX6SX_PAD_SD4_DATA7__UART5_CTS_B 0x029C 0x05E4 0x084C 0x2 0x1 | 1513 | #define MX6SX_PAD_SD4_DATA7__UART5_CTS_B 0x029C 0x05E4 0x0000 0x2 0x0 |
1514 | #define MX6SX_PAD_SD4_DATA7__ECSPI3_SS0 0x029C 0x05E4 0x073C 0x3 0x0 | 1514 | #define MX6SX_PAD_SD4_DATA7__ECSPI3_SS0 0x029C 0x05E4 0x073C 0x3 0x0 |
1515 | #define MX6SX_PAD_SD4_DATA7__LCDIF2_DATA_15 0x029C 0x05E4 0x0000 0x4 0x0 | 1515 | #define MX6SX_PAD_SD4_DATA7__LCDIF2_DATA_15 0x029C 0x05E4 0x0000 0x4 0x0 |
1516 | #define MX6SX_PAD_SD4_DATA7__GPIO6_IO_21 0x029C 0x05E4 0x0000 0x5 0x0 | 1516 | #define MX6SX_PAD_SD4_DATA7__GPIO6_IO_21 0x029C 0x05E4 0x0000 0x5 0x0 |
diff --git a/arch/arm/boot/dts/k2e-clocks.dtsi b/arch/arm/boot/dts/k2e-clocks.dtsi index 598afe91c676..4773d6af66a0 100644 --- a/arch/arm/boot/dts/k2e-clocks.dtsi +++ b/arch/arm/boot/dts/k2e-clocks.dtsi | |||
@@ -40,7 +40,7 @@ clocks { | |||
40 | #clock-cells = <0>; | 40 | #clock-cells = <0>; |
41 | compatible = "ti,keystone,psc-clock"; | 41 | compatible = "ti,keystone,psc-clock"; |
42 | clocks = <&chipclk16>; | 42 | clocks = <&chipclk16>; |
43 | clock-output-names = "usb"; | 43 | clock-output-names = "usb1"; |
44 | reg = <0x02350004 0xb00>, <0x02350000 0x400>; | 44 | reg = <0x02350004 0xb00>, <0x02350000 0x400>; |
45 | reg-names = "control", "domain"; | 45 | reg-names = "control", "domain"; |
46 | domain-id = <0>; | 46 | domain-id = <0>; |
@@ -60,8 +60,8 @@ clocks { | |||
60 | #clock-cells = <0>; | 60 | #clock-cells = <0>; |
61 | compatible = "ti,keystone,psc-clock"; | 61 | compatible = "ti,keystone,psc-clock"; |
62 | clocks = <&chipclk12>; | 62 | clocks = <&chipclk12>; |
63 | clock-output-names = "pcie"; | 63 | clock-output-names = "pcie1"; |
64 | reg = <0x0235006c 0xb00>, <0x02350000 0x400>; | 64 | reg = <0x0235006c 0xb00>, <0x02350048 0x400>; |
65 | reg-names = "control", "domain"; | 65 | reg-names = "control", "domain"; |
66 | domain-id = <18>; | 66 | domain-id = <18>; |
67 | }; | 67 | }; |
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts index 3c3e6da1deac..a9aae88b74f5 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts | |||
@@ -292,6 +292,7 @@ | |||
292 | &uart3 { | 292 | &uart3 { |
293 | pinctrl-names = "default"; | 293 | pinctrl-names = "default"; |
294 | pinctrl-0 = <&uart3_pins>; | 294 | pinctrl-0 = <&uart3_pins>; |
295 | interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>; | ||
295 | }; | 296 | }; |
296 | 297 | ||
297 | &gpio1 { | 298 | &gpio1 { |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index b15f1a77d684..4361777a08d8 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -93,7 +93,7 @@ | |||
93 | }; | 93 | }; |
94 | 94 | ||
95 | tv: connector { | 95 | tv: connector { |
96 | compatible = "composite-connector"; | 96 | compatible = "composite-video-connector"; |
97 | label = "tv"; | 97 | label = "tv"; |
98 | 98 | ||
99 | port { | 99 | port { |
@@ -353,7 +353,7 @@ | |||
353 | }; | 353 | }; |
354 | 354 | ||
355 | twl_power: power { | 355 | twl_power: power { |
356 | compatible = "ti,twl4030-power-n900"; | 356 | compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off"; |
357 | ti,use_poweroff; | 357 | ti,use_poweroff; |
358 | }; | 358 | }; |
359 | }; | 359 | }; |
diff --git a/arch/arm/boot/dts/omap3430-sdp.dts b/arch/arm/boot/dts/omap3430-sdp.dts index 02f69f4a8fd3..9bad94efe1c8 100644 --- a/arch/arm/boot/dts/omap3430-sdp.dts +++ b/arch/arm/boot/dts/omap3430-sdp.dts | |||
@@ -107,7 +107,7 @@ | |||
107 | #address-cells = <1>; | 107 | #address-cells = <1>; |
108 | #size-cells = <1>; | 108 | #size-cells = <1>; |
109 | reg = <1 0 0x08000000>; | 109 | reg = <1 0 0x08000000>; |
110 | ti,nand-ecc-opt = "ham1"; | 110 | ti,nand-ecc-opt = "sw"; |
111 | nand-bus-width = <8>; | 111 | nand-bus-width = <8>; |
112 | gpmc,cs-on-ns = <0>; | 112 | gpmc,cs-on-ns = <0>; |
113 | gpmc,cs-rd-off-ns = <36>; | 113 | gpmc,cs-rd-off-ns = <36>; |
diff --git a/arch/arm/boot/dts/omap3xxx-clocks.dtsi b/arch/arm/boot/dts/omap3xxx-clocks.dtsi index e47ff69dcf70..5c375003bad1 100644 --- a/arch/arm/boot/dts/omap3xxx-clocks.dtsi +++ b/arch/arm/boot/dts/omap3xxx-clocks.dtsi | |||
@@ -467,6 +467,7 @@ | |||
467 | ti,bit-shift = <0x1e>; | 467 | ti,bit-shift = <0x1e>; |
468 | reg = <0x0d00>; | 468 | reg = <0x0d00>; |
469 | ti,set-bit-to-disable; | 469 | ti,set-bit-to-disable; |
470 | ti,set-rate-parent; | ||
470 | }; | 471 | }; |
471 | 472 | ||
472 | dpll4_m6_ck: dpll4_m6_ck { | 473 | dpll4_m6_ck: dpll4_m6_ck { |
diff --git a/arch/arm/boot/dts/omap5-cm-t54.dts b/arch/arm/boot/dts/omap5-cm-t54.dts index b8698ca68647..429471aa7a1f 100644 --- a/arch/arm/boot/dts/omap5-cm-t54.dts +++ b/arch/arm/boot/dts/omap5-cm-t54.dts | |||
@@ -353,13 +353,12 @@ | |||
353 | }; | 353 | }; |
354 | 354 | ||
355 | ldo8_reg: ldo8 { | 355 | ldo8_reg: ldo8 { |
356 | /* VDD_3v0: Does not go anywhere */ | 356 | /* VDD_3V_GP: act led/serial console */ |
357 | regulator-name = "ldo8"; | 357 | regulator-name = "ldo8"; |
358 | regulator-min-microvolt = <3000000>; | 358 | regulator-min-microvolt = <3000000>; |
359 | regulator-max-microvolt = <3000000>; | 359 | regulator-max-microvolt = <3000000>; |
360 | regulator-always-on; | ||
360 | regulator-boot-on; | 361 | regulator-boot-on; |
361 | /* Unused */ | ||
362 | status = "disabled"; | ||
363 | }; | 362 | }; |
364 | 363 | ||
365 | ldo9_reg: ldo9 { | 364 | ldo9_reg: ldo9 { |
diff --git a/arch/arm/boot/dts/omap54xx-clocks.dtsi b/arch/arm/boot/dts/omap54xx-clocks.dtsi index e67a23b5d788..58c27466f012 100644 --- a/arch/arm/boot/dts/omap54xx-clocks.dtsi +++ b/arch/arm/boot/dts/omap54xx-clocks.dtsi | |||
@@ -367,10 +367,12 @@ | |||
367 | 367 | ||
368 | l3_iclk_div: l3_iclk_div { | 368 | l3_iclk_div: l3_iclk_div { |
369 | #clock-cells = <0>; | 369 | #clock-cells = <0>; |
370 | compatible = "fixed-factor-clock"; | 370 | compatible = "ti,divider-clock"; |
371 | ti,max-div = <2>; | ||
372 | ti,bit-shift = <4>; | ||
373 | reg = <0x100>; | ||
371 | clocks = <&dpll_core_h12x2_ck>; | 374 | clocks = <&dpll_core_h12x2_ck>; |
372 | clock-mult = <1>; | 375 | ti,index-power-of-two; |
373 | clock-div = <1>; | ||
374 | }; | 376 | }; |
375 | 377 | ||
376 | gpu_l3_iclk: gpu_l3_iclk { | 378 | gpu_l3_iclk: gpu_l3_iclk { |
@@ -383,10 +385,12 @@ | |||
383 | 385 | ||
384 | l4_root_clk_div: l4_root_clk_div { | 386 | l4_root_clk_div: l4_root_clk_div { |
385 | #clock-cells = <0>; | 387 | #clock-cells = <0>; |
386 | compatible = "fixed-factor-clock"; | 388 | compatible = "ti,divider-clock"; |
389 | ti,max-div = <2>; | ||
390 | ti,bit-shift = <8>; | ||
391 | reg = <0x100>; | ||
387 | clocks = <&l3_iclk_div>; | 392 | clocks = <&l3_iclk_div>; |
388 | clock-mult = <1>; | 393 | ti,index-power-of-two; |
389 | clock-div = <1>; | ||
390 | }; | 394 | }; |
391 | 395 | ||
392 | slimbus1_slimbus_clk: slimbus1_slimbus_clk { | 396 | slimbus1_slimbus_clk: slimbus1_slimbus_clk { |
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts index 23486c081a69..be59014474b2 100644 --- a/arch/arm/boot/dts/r8a7791-koelsch.dts +++ b/arch/arm/boot/dts/r8a7791-koelsch.dts | |||
@@ -275,11 +275,6 @@ | |||
275 | renesas,function = "msiof0"; | 275 | renesas,function = "msiof0"; |
276 | }; | 276 | }; |
277 | 277 | ||
278 | i2c6_pins: i2c6 { | ||
279 | renesas,groups = "i2c6"; | ||
280 | renesas,function = "i2c6"; | ||
281 | }; | ||
282 | |||
283 | usb0_pins: usb0 { | 278 | usb0_pins: usb0 { |
284 | renesas,groups = "usb0"; | 279 | renesas,groups = "usb0"; |
285 | renesas,function = "usb0"; | 280 | renesas,function = "usb0"; |
@@ -420,8 +415,6 @@ | |||
420 | }; | 415 | }; |
421 | 416 | ||
422 | &i2c6 { | 417 | &i2c6 { |
423 | pinctrl-names = "default"; | ||
424 | pinctrl-0 = <&i2c6_pins>; | ||
425 | status = "okay"; | 418 | status = "okay"; |
426 | clock-frequency = <100000>; | 419 | clock-frequency = <100000>; |
427 | 420 | ||
diff --git a/arch/arm/boot/dts/rk3066a-bqcurie2.dts b/arch/arm/boot/dts/rk3066a-bqcurie2.dts index 042f821d9e4d..c9d912da6141 100644 --- a/arch/arm/boot/dts/rk3066a-bqcurie2.dts +++ b/arch/arm/boot/dts/rk3066a-bqcurie2.dts | |||
@@ -149,6 +149,8 @@ | |||
149 | &mmc0 { /* sdmmc */ | 149 | &mmc0 { /* sdmmc */ |
150 | num-slots = <1>; | 150 | num-slots = <1>; |
151 | status = "okay"; | 151 | status = "okay"; |
152 | pinctrl-names = "default"; | ||
153 | pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>; | ||
152 | vmmc-supply = <&vcc_sd0>; | 154 | vmmc-supply = <&vcc_sd0>; |
153 | 155 | ||
154 | slot@0 { | 156 | slot@0 { |
diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts index 171b610db709..5e4e3c238b2d 100644 --- a/arch/arm/boot/dts/rk3188-radxarock.dts +++ b/arch/arm/boot/dts/rk3188-radxarock.dts | |||
@@ -179,6 +179,8 @@ | |||
179 | &mmc0 { | 179 | &mmc0 { |
180 | num-slots = <1>; | 180 | num-slots = <1>; |
181 | status = "okay"; | 181 | status = "okay"; |
182 | pinctrl-names = "default"; | ||
183 | pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>; | ||
182 | vmmc-supply = <&vcc_sd0>; | 184 | vmmc-supply = <&vcc_sd0>; |
183 | 185 | ||
184 | slot@0 { | 186 | slot@0 { |
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts index 4a2000c620ad..3e97a669f15e 100644 --- a/arch/arm/boot/dts/ste-snowball.dts +++ b/arch/arm/boot/dts/ste-snowball.dts | |||
@@ -116,7 +116,6 @@ | |||
116 | msp2: msp@80117000 { | 116 | msp2: msp@80117000 { |
117 | pinctrl-names = "default"; | 117 | pinctrl-names = "default"; |
118 | pinctrl-0 = <&msp2_default_mode>; | 118 | pinctrl-0 = <&msp2_default_mode>; |
119 | status = "okay"; | ||
120 | }; | 119 | }; |
121 | 120 | ||
122 | msp3: msp@80125000 { | 121 | msp3: msp@80125000 { |
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index 44b07e512c24..e06fbfc55bb7 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi | |||
@@ -660,6 +660,8 @@ | |||
660 | clock-frequency = <100000>; | 660 | clock-frequency = <100000>; |
661 | resets = <&apb2_rst 0>; | 661 | resets = <&apb2_rst 0>; |
662 | status = "disabled"; | 662 | status = "disabled"; |
663 | #address-cells = <1>; | ||
664 | #size-cells = <0>; | ||
663 | }; | 665 | }; |
664 | 666 | ||
665 | i2c1: i2c@01c2b000 { | 667 | i2c1: i2c@01c2b000 { |
@@ -670,6 +672,8 @@ | |||
670 | clock-frequency = <100000>; | 672 | clock-frequency = <100000>; |
671 | resets = <&apb2_rst 1>; | 673 | resets = <&apb2_rst 1>; |
672 | status = "disabled"; | 674 | status = "disabled"; |
675 | #address-cells = <1>; | ||
676 | #size-cells = <0>; | ||
673 | }; | 677 | }; |
674 | 678 | ||
675 | i2c2: i2c@01c2b400 { | 679 | i2c2: i2c@01c2b400 { |
@@ -680,6 +684,8 @@ | |||
680 | clock-frequency = <100000>; | 684 | clock-frequency = <100000>; |
681 | resets = <&apb2_rst 2>; | 685 | resets = <&apb2_rst 2>; |
682 | status = "disabled"; | 686 | status = "disabled"; |
687 | #address-cells = <1>; | ||
688 | #size-cells = <0>; | ||
683 | }; | 689 | }; |
684 | 690 | ||
685 | i2c3: i2c@01c2b800 { | 691 | i2c3: i2c@01c2b800 { |
@@ -690,6 +696,8 @@ | |||
690 | clock-frequency = <100000>; | 696 | clock-frequency = <100000>; |
691 | resets = <&apb2_rst 3>; | 697 | resets = <&apb2_rst 3>; |
692 | status = "disabled"; | 698 | status = "disabled"; |
699 | #address-cells = <1>; | ||
700 | #size-cells = <0>; | ||
693 | }; | 701 | }; |
694 | 702 | ||
695 | gmac: ethernet@01c30000 { | 703 | gmac: ethernet@01c30000 { |
diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi index 8adaa7871dd3..a5446cba9804 100644 --- a/arch/arm/boot/dts/tegra30-apalis.dtsi +++ b/arch/arm/boot/dts/tegra30-apalis.dtsi | |||
@@ -423,7 +423,7 @@ | |||
423 | vcc4-supply = <&sys_3v3_reg>; | 423 | vcc4-supply = <&sys_3v3_reg>; |
424 | vcc5-supply = <&sys_3v3_reg>; | 424 | vcc5-supply = <&sys_3v3_reg>; |
425 | vcc6-supply = <&vio_reg>; | 425 | vcc6-supply = <&vio_reg>; |
426 | vcc7-supply = <&sys_5v0_reg>; | 426 | vcc7-supply = <&charge_pump_5v0_reg>; |
427 | vccio-supply = <&sys_3v3_reg>; | 427 | vccio-supply = <&sys_3v3_reg>; |
428 | 428 | ||
429 | regulators { | 429 | regulators { |
@@ -674,5 +674,14 @@ | |||
674 | regulator-max-microvolt = <3300000>; | 674 | regulator-max-microvolt = <3300000>; |
675 | regulator-always-on; | 675 | regulator-always-on; |
676 | }; | 676 | }; |
677 | |||
678 | charge_pump_5v0_reg: regulator@101 { | ||
679 | compatible = "regulator-fixed"; | ||
680 | reg = <101>; | ||
681 | regulator-name = "5v0"; | ||
682 | regulator-min-microvolt = <5000000>; | ||
683 | regulator-max-microvolt = <5000000>; | ||
684 | regulator-always-on; | ||
685 | }; | ||
677 | }; | 686 | }; |
678 | }; | 687 | }; |
diff --git a/arch/arm/boot/dts/tegra30-colibri.dtsi b/arch/arm/boot/dts/tegra30-colibri.dtsi index bf16f8e65627..c4ed1bec4d92 100644 --- a/arch/arm/boot/dts/tegra30-colibri.dtsi +++ b/arch/arm/boot/dts/tegra30-colibri.dtsi | |||
@@ -201,7 +201,7 @@ | |||
201 | vcc4-supply = <&sys_3v3_reg>; | 201 | vcc4-supply = <&sys_3v3_reg>; |
202 | vcc5-supply = <&sys_3v3_reg>; | 202 | vcc5-supply = <&sys_3v3_reg>; |
203 | vcc6-supply = <&vio_reg>; | 203 | vcc6-supply = <&vio_reg>; |
204 | vcc7-supply = <&sys_5v0_reg>; | 204 | vcc7-supply = <&charge_pump_5v0_reg>; |
205 | vccio-supply = <&sys_3v3_reg>; | 205 | vccio-supply = <&sys_3v3_reg>; |
206 | 206 | ||
207 | regulators { | 207 | regulators { |
@@ -373,5 +373,14 @@ | |||
373 | regulator-max-microvolt = <3300000>; | 373 | regulator-max-microvolt = <3300000>; |
374 | regulator-always-on; | 374 | regulator-always-on; |
375 | }; | 375 | }; |
376 | |||
377 | charge_pump_5v0_reg: regulator@101 { | ||
378 | compatible = "regulator-fixed"; | ||
379 | reg = <101>; | ||
380 | regulator-name = "5v0"; | ||
381 | regulator-min-microvolt = <5000000>; | ||
382 | regulator-max-microvolt = <5000000>; | ||
383 | regulator-always-on; | ||
384 | }; | ||
376 | }; | 385 | }; |
377 | }; | 386 | }; |
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi index 2e3bd3172b23..55eb35f068fb 100644 --- a/arch/arm/boot/dts/twl6030.dtsi +++ b/arch/arm/boot/dts/twl6030.dtsi | |||
@@ -83,10 +83,6 @@ | |||
83 | regulator-always-on; | 83 | regulator-always-on; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | clk32kg: regulator-clk32kg { | ||
87 | compatible = "ti,twl6030-clk32kg"; | ||
88 | }; | ||
89 | |||
90 | twl_usb_comparator: usb-comparator { | 86 | twl_usb_comparator: usb-comparator { |
91 | compatible = "ti,twl6030-usb"; | 87 | compatible = "ti,twl6030-usb"; |
92 | interrupts = <4>, <10>; | 88 | interrupts = <4>, <10>; |
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts index 11d733406c7e..b8a5e8c68f06 100644 --- a/arch/arm/boot/dts/vf610-twr.dts +++ b/arch/arm/boot/dts/vf610-twr.dts | |||
@@ -168,7 +168,7 @@ | |||
168 | }; | 168 | }; |
169 | 169 | ||
170 | pinctrl_esdhc1: esdhc1grp { | 170 | pinctrl_esdhc1: esdhc1grp { |
171 | fsl,fsl,pins = < | 171 | fsl,pins = < |
172 | VF610_PAD_PTA24__ESDHC1_CLK 0x31ef | 172 | VF610_PAD_PTA24__ESDHC1_CLK 0x31ef |
173 | VF610_PAD_PTA25__ESDHC1_CMD 0x31ef | 173 | VF610_PAD_PTA25__ESDHC1_CMD 0x31ef |
174 | VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef | 174 | VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef |
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 88099175fc56..d86771abbf57 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c | |||
@@ -1443,14 +1443,14 @@ void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no) | |||
1443 | EXPORT_SYMBOL(edma_assign_channel_eventq); | 1443 | EXPORT_SYMBOL(edma_assign_channel_eventq); |
1444 | 1444 | ||
1445 | static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, | 1445 | static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, |
1446 | struct edma *edma_cc) | 1446 | struct edma *edma_cc, int cc_id) |
1447 | { | 1447 | { |
1448 | int i; | 1448 | int i; |
1449 | u32 value, cccfg; | 1449 | u32 value, cccfg; |
1450 | s8 (*queue_priority_map)[2]; | 1450 | s8 (*queue_priority_map)[2]; |
1451 | 1451 | ||
1452 | /* Decode the eDMA3 configuration from CCCFG register */ | 1452 | /* Decode the eDMA3 configuration from CCCFG register */ |
1453 | cccfg = edma_read(0, EDMA_CCCFG); | 1453 | cccfg = edma_read(cc_id, EDMA_CCCFG); |
1454 | 1454 | ||
1455 | value = GET_NUM_REGN(cccfg); | 1455 | value = GET_NUM_REGN(cccfg); |
1456 | edma_cc->num_region = BIT(value); | 1456 | edma_cc->num_region = BIT(value); |
@@ -1464,7 +1464,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, | |||
1464 | value = GET_NUM_EVQUE(cccfg); | 1464 | value = GET_NUM_EVQUE(cccfg); |
1465 | edma_cc->num_tc = value + 1; | 1465 | edma_cc->num_tc = value + 1; |
1466 | 1466 | ||
1467 | dev_dbg(dev, "eDMA3 HW configuration (cccfg: 0x%08x):\n", cccfg); | 1467 | dev_dbg(dev, "eDMA3 CC%d HW configuration (cccfg: 0x%08x):\n", cc_id, |
1468 | cccfg); | ||
1468 | dev_dbg(dev, "num_region: %u\n", edma_cc->num_region); | 1469 | dev_dbg(dev, "num_region: %u\n", edma_cc->num_region); |
1469 | dev_dbg(dev, "num_channel: %u\n", edma_cc->num_channels); | 1470 | dev_dbg(dev, "num_channel: %u\n", edma_cc->num_channels); |
1470 | dev_dbg(dev, "num_slot: %u\n", edma_cc->num_slots); | 1471 | dev_dbg(dev, "num_slot: %u\n", edma_cc->num_slots); |
@@ -1684,7 +1685,7 @@ static int edma_probe(struct platform_device *pdev) | |||
1684 | return -ENOMEM; | 1685 | return -ENOMEM; |
1685 | 1686 | ||
1686 | /* Get eDMA3 configuration from IP */ | 1687 | /* Get eDMA3 configuration from IP */ |
1687 | ret = edma_setup_from_hw(dev, info[j], edma_cc[j]); | 1688 | ret = edma_setup_from_hw(dev, info[j], edma_cc[j], j); |
1688 | if (ret) | 1689 | if (ret) |
1689 | return ret; | 1690 | return ret; |
1690 | 1691 | ||
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index fd43f7f55b70..79ecb4f34ffb 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
@@ -472,7 +472,6 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size) | |||
472 | "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR \n\t" \ | 472 | "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR \n\t" \ |
473 | "isb \n\t" \ | 473 | "isb \n\t" \ |
474 | "bl v7_flush_dcache_"__stringify(level)" \n\t" \ | 474 | "bl v7_flush_dcache_"__stringify(level)" \n\t" \ |
475 | "clrex \n\t" \ | ||
476 | "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR \n\t" \ | 475 | "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR \n\t" \ |
477 | "bic r0, r0, #(1 << 6) @ disable local coherency \n\t" \ | 476 | "bic r0, r0, #(1 << 6) @ disable local coherency \n\t" \ |
478 | "mcr p15, 0, r0, c1, c0, 1 @ set ACTLR \n\t" \ | 477 | "mcr p15, 0, r0, c1, c0, 1 @ set ACTLR \n\t" \ |
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index 963a2515906d..819777d0e91f 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h | |||
@@ -74,6 +74,7 @@ | |||
74 | #define ARM_CPU_PART_CORTEX_A12 0x4100c0d0 | 74 | #define ARM_CPU_PART_CORTEX_A12 0x4100c0d0 |
75 | #define ARM_CPU_PART_CORTEX_A17 0x4100c0e0 | 75 | #define ARM_CPU_PART_CORTEX_A17 0x4100c0e0 |
76 | #define ARM_CPU_PART_CORTEX_A15 0x4100c0f0 | 76 | #define ARM_CPU_PART_CORTEX_A15 0x4100c0f0 |
77 | #define ARM_CPU_PART_MASK 0xff00fff0 | ||
77 | 78 | ||
78 | #define ARM_CPU_XSCALE_ARCH_MASK 0xe000 | 79 | #define ARM_CPU_XSCALE_ARCH_MASK 0xe000 |
79 | #define ARM_CPU_XSCALE_ARCH_V1 0x2000 | 80 | #define ARM_CPU_XSCALE_ARCH_V1 0x2000 |
@@ -179,7 +180,7 @@ static inline unsigned int __attribute_const__ read_cpuid_implementor(void) | |||
179 | */ | 180 | */ |
180 | static inline unsigned int __attribute_const__ read_cpuid_part(void) | 181 | static inline unsigned int __attribute_const__ read_cpuid_part(void) |
181 | { | 182 | { |
182 | return read_cpuid_id() & 0xff00fff0; | 183 | return read_cpuid_id() & ARM_CPU_PART_MASK; |
183 | } | 184 | } |
184 | 185 | ||
185 | static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void) | 186 | static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void) |
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index f4b46d39b9cf..afb9cafd3786 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h | |||
@@ -50,6 +50,7 @@ typedef struct user_fp elf_fpregset_t; | |||
50 | #define R_ARM_ABS32 2 | 50 | #define R_ARM_ABS32 2 |
51 | #define R_ARM_CALL 28 | 51 | #define R_ARM_CALL 28 |
52 | #define R_ARM_JUMP24 29 | 52 | #define R_ARM_JUMP24 29 |
53 | #define R_ARM_TARGET1 38 | ||
53 | #define R_ARM_V4BX 40 | 54 | #define R_ARM_V4BX 40 |
54 | #define R_ARM_PREL31 42 | 55 | #define R_ARM_PREL31 42 |
55 | #define R_ARM_MOVW_ABS_NC 43 | 56 | #define R_ARM_MOVW_ABS_NC 43 |
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h index a252c0bfacf5..0ad7d490ee6f 100644 --- a/arch/arm/include/asm/smp_plat.h +++ b/arch/arm/include/asm/smp_plat.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/cpumask.h> | 8 | #include <linux/cpumask.h> |
9 | #include <linux/err.h> | 9 | #include <linux/err.h> |
10 | 10 | ||
11 | #include <asm/cpu.h> | ||
11 | #include <asm/cputype.h> | 12 | #include <asm/cputype.h> |
12 | 13 | ||
13 | /* | 14 | /* |
@@ -25,6 +26,20 @@ static inline bool is_smp(void) | |||
25 | #endif | 26 | #endif |
26 | } | 27 | } |
27 | 28 | ||
29 | /** | ||
30 | * smp_cpuid_part() - return part id for a given cpu | ||
31 | * @cpu: logical cpu id. | ||
32 | * | ||
33 | * Return: part id of logical cpu passed as argument. | ||
34 | */ | ||
35 | static inline unsigned int smp_cpuid_part(int cpu) | ||
36 | { | ||
37 | struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpu); | ||
38 | |||
39 | return is_smp() ? cpu_info->cpuid & ARM_CPU_PART_MASK : | ||
40 | read_cpuid_part(); | ||
41 | } | ||
42 | |||
28 | /* all SMP configurations have the extended CPUID registers */ | 43 | /* all SMP configurations have the extended CPUID registers */ |
29 | #ifndef CONFIG_MMU | 44 | #ifndef CONFIG_MMU |
30 | #define tlb_ops_need_broadcast() 0 | 45 | #define tlb_ops_need_broadcast() 0 |
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h index 83259b873333..36172adda9d0 100644 --- a/arch/arm/include/asm/tls.h +++ b/arch/arm/include/asm/tls.h | |||
@@ -1,6 +1,9 @@ | |||
1 | #ifndef __ASMARM_TLS_H | 1 | #ifndef __ASMARM_TLS_H |
2 | #define __ASMARM_TLS_H | 2 | #define __ASMARM_TLS_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | ||
5 | #include <asm/thread_info.h> | ||
6 | |||
4 | #ifdef __ASSEMBLY__ | 7 | #ifdef __ASSEMBLY__ |
5 | #include <asm/asm-offsets.h> | 8 | #include <asm/asm-offsets.h> |
6 | .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2 | 9 | .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2 |
@@ -50,6 +53,47 @@ | |||
50 | #endif | 53 | #endif |
51 | 54 | ||
52 | #ifndef __ASSEMBLY__ | 55 | #ifndef __ASSEMBLY__ |
56 | |||
57 | static inline void set_tls(unsigned long val) | ||
58 | { | ||
59 | struct thread_info *thread; | ||
60 | |||
61 | thread = current_thread_info(); | ||
62 | |||
63 | thread->tp_value[0] = val; | ||
64 | |||
65 | /* | ||
66 | * This code runs with preemption enabled and therefore must | ||
67 | * be reentrant with respect to switch_tls. | ||
68 | * | ||
69 | * We need to ensure ordering between the shadow state and the | ||
70 | * hardware state, so that we don't corrupt the hardware state | ||
71 | * with a stale shadow state during context switch. | ||
72 | * | ||
73 | * If we're preempted here, switch_tls will load TPIDRURO from | ||
74 | * thread_info upon resuming execution and the following mcr | ||
75 | * is merely redundant. | ||
76 | */ | ||
77 | barrier(); | ||
78 | |||
79 | if (!tls_emu) { | ||
80 | if (has_tls_reg) { | ||
81 | asm("mcr p15, 0, %0, c13, c0, 3" | ||
82 | : : "r" (val)); | ||
83 | } else { | ||
84 | /* | ||
85 | * User space must never try to access this | ||
86 | * directly. Expect your app to break | ||
87 | * eventually if you do so. The user helper | ||
88 | * at 0xffff0fe0 must be used instead. (see | ||
89 | * entry-armv.S for details) | ||
90 | */ | ||
91 | *((unsigned int *)0xffff0ff0) = val; | ||
92 | } | ||
93 | |||
94 | } | ||
95 | } | ||
96 | |||
53 | static inline unsigned long get_tpuser(void) | 97 | static inline unsigned long get_tpuser(void) |
54 | { | 98 | { |
55 | unsigned long reg = 0; | 99 | unsigned long reg = 0; |
@@ -59,5 +103,23 @@ static inline unsigned long get_tpuser(void) | |||
59 | 103 | ||
60 | return reg; | 104 | return reg; |
61 | } | 105 | } |
106 | |||
107 | static inline void set_tpuser(unsigned long val) | ||
108 | { | ||
109 | /* Since TPIDRURW is fully context-switched (unlike TPIDRURO), | ||
110 | * we need not update thread_info. | ||
111 | */ | ||
112 | if (has_tls_reg && !tls_emu) { | ||
113 | asm("mcr p15, 0, %0, c13, c0, 2" | ||
114 | : : "r" (val)); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | static inline void flush_tls(void) | ||
119 | { | ||
120 | set_tls(0); | ||
121 | set_tpuser(0); | ||
122 | } | ||
123 | |||
62 | #endif | 124 | #endif |
63 | #endif /* __ASMARM_TLS_H */ | 125 | #endif /* __ASMARM_TLS_H */ |
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index a4cd7af475e9..4767eb9caa78 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h | |||
@@ -107,8 +107,11 @@ static inline void set_fs(mm_segment_t fs) | |||
107 | extern int __get_user_1(void *); | 107 | extern int __get_user_1(void *); |
108 | extern int __get_user_2(void *); | 108 | extern int __get_user_2(void *); |
109 | extern int __get_user_4(void *); | 109 | extern int __get_user_4(void *); |
110 | extern int __get_user_lo8(void *); | 110 | extern int __get_user_32t_8(void *); |
111 | extern int __get_user_8(void *); | 111 | extern int __get_user_8(void *); |
112 | extern int __get_user_64t_1(void *); | ||
113 | extern int __get_user_64t_2(void *); | ||
114 | extern int __get_user_64t_4(void *); | ||
112 | 115 | ||
113 | #define __GUP_CLOBBER_1 "lr", "cc" | 116 | #define __GUP_CLOBBER_1 "lr", "cc" |
114 | #ifdef CONFIG_CPU_USE_DOMAINS | 117 | #ifdef CONFIG_CPU_USE_DOMAINS |
@@ -117,7 +120,7 @@ extern int __get_user_8(void *); | |||
117 | #define __GUP_CLOBBER_2 "lr", "cc" | 120 | #define __GUP_CLOBBER_2 "lr", "cc" |
118 | #endif | 121 | #endif |
119 | #define __GUP_CLOBBER_4 "lr", "cc" | 122 | #define __GUP_CLOBBER_4 "lr", "cc" |
120 | #define __GUP_CLOBBER_lo8 "lr", "cc" | 123 | #define __GUP_CLOBBER_32t_8 "lr", "cc" |
121 | #define __GUP_CLOBBER_8 "lr", "cc" | 124 | #define __GUP_CLOBBER_8 "lr", "cc" |
122 | 125 | ||
123 | #define __get_user_x(__r2,__p,__e,__l,__s) \ | 126 | #define __get_user_x(__r2,__p,__e,__l,__s) \ |
@@ -131,12 +134,30 @@ extern int __get_user_8(void *); | |||
131 | 134 | ||
132 | /* narrowing a double-word get into a single 32bit word register: */ | 135 | /* narrowing a double-word get into a single 32bit word register: */ |
133 | #ifdef __ARMEB__ | 136 | #ifdef __ARMEB__ |
134 | #define __get_user_xb(__r2, __p, __e, __l, __s) \ | 137 | #define __get_user_x_32t(__r2, __p, __e, __l, __s) \ |
135 | __get_user_x(__r2, __p, __e, __l, lo8) | 138 | __get_user_x(__r2, __p, __e, __l, 32t_8) |
136 | #else | 139 | #else |
137 | #define __get_user_xb __get_user_x | 140 | #define __get_user_x_32t __get_user_x |
138 | #endif | 141 | #endif |
139 | 142 | ||
143 | /* | ||
144 | * storing result into proper least significant word of 64bit target var, | ||
145 | * different only for big endian case where 64 bit __r2 lsw is r3: | ||
146 | */ | ||
147 | #ifdef __ARMEB__ | ||
148 | #define __get_user_x_64t(__r2, __p, __e, __l, __s) \ | ||
149 | __asm__ __volatile__ ( \ | ||
150 | __asmeq("%0", "r0") __asmeq("%1", "r2") \ | ||
151 | __asmeq("%3", "r1") \ | ||
152 | "bl __get_user_64t_" #__s \ | ||
153 | : "=&r" (__e), "=r" (__r2) \ | ||
154 | : "0" (__p), "r" (__l) \ | ||
155 | : __GUP_CLOBBER_##__s) | ||
156 | #else | ||
157 | #define __get_user_x_64t __get_user_x | ||
158 | #endif | ||
159 | |||
160 | |||
140 | #define __get_user_check(x,p) \ | 161 | #define __get_user_check(x,p) \ |
141 | ({ \ | 162 | ({ \ |
142 | unsigned long __limit = current_thread_info()->addr_limit - 1; \ | 163 | unsigned long __limit = current_thread_info()->addr_limit - 1; \ |
@@ -146,17 +167,26 @@ extern int __get_user_8(void *); | |||
146 | register int __e asm("r0"); \ | 167 | register int __e asm("r0"); \ |
147 | switch (sizeof(*(__p))) { \ | 168 | switch (sizeof(*(__p))) { \ |
148 | case 1: \ | 169 | case 1: \ |
149 | __get_user_x(__r2, __p, __e, __l, 1); \ | 170 | if (sizeof((x)) >= 8) \ |
171 | __get_user_x_64t(__r2, __p, __e, __l, 1); \ | ||
172 | else \ | ||
173 | __get_user_x(__r2, __p, __e, __l, 1); \ | ||
150 | break; \ | 174 | break; \ |
151 | case 2: \ | 175 | case 2: \ |
152 | __get_user_x(__r2, __p, __e, __l, 2); \ | 176 | if (sizeof((x)) >= 8) \ |
177 | __get_user_x_64t(__r2, __p, __e, __l, 2); \ | ||
178 | else \ | ||
179 | __get_user_x(__r2, __p, __e, __l, 2); \ | ||
153 | break; \ | 180 | break; \ |
154 | case 4: \ | 181 | case 4: \ |
155 | __get_user_x(__r2, __p, __e, __l, 4); \ | 182 | if (sizeof((x)) >= 8) \ |
183 | __get_user_x_64t(__r2, __p, __e, __l, 4); \ | ||
184 | else \ | ||
185 | __get_user_x(__r2, __p, __e, __l, 4); \ | ||
156 | break; \ | 186 | break; \ |
157 | case 8: \ | 187 | case 8: \ |
158 | if (sizeof((x)) < 8) \ | 188 | if (sizeof((x)) < 8) \ |
159 | __get_user_xb(__r2, __p, __e, __l, 4); \ | 189 | __get_user_x_32t(__r2, __p, __e, __l, 4); \ |
160 | else \ | 190 | else \ |
161 | __get_user_x(__r2, __p, __e, __l, 8); \ | 191 | __get_user_x(__r2, __p, __e, __l, 8); \ |
162 | break; \ | 192 | break; \ |
diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h index 1109017499e5..e8275ea88e88 100644 --- a/arch/arm/include/asm/xen/page-coherent.h +++ b/arch/arm/include/asm/xen/page-coherent.h | |||
@@ -26,25 +26,14 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | |||
26 | __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); | 26 | __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); |
27 | } | 27 | } |
28 | 28 | ||
29 | static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | 29 | void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, |
30 | size_t size, enum dma_data_direction dir, | 30 | size_t size, enum dma_data_direction dir, |
31 | struct dma_attrs *attrs) | 31 | struct dma_attrs *attrs); |
32 | { | ||
33 | if (__generic_dma_ops(hwdev)->unmap_page) | ||
34 | __generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); | ||
35 | } | ||
36 | 32 | ||
37 | static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | 33 | void xen_dma_sync_single_for_cpu(struct device *hwdev, |
38 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | 34 | dma_addr_t handle, size_t size, enum dma_data_direction dir); |
39 | { | 35 | |
40 | if (__generic_dma_ops(hwdev)->sync_single_for_cpu) | 36 | void xen_dma_sync_single_for_device(struct device *hwdev, |
41 | __generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); | 37 | dma_addr_t handle, size_t size, enum dma_data_direction dir); |
42 | } | ||
43 | 38 | ||
44 | static inline void xen_dma_sync_single_for_device(struct device *hwdev, | ||
45 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
46 | { | ||
47 | if (__generic_dma_ops(hwdev)->sync_single_for_device) | ||
48 | __generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); | ||
49 | } | ||
50 | #endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ | 39 | #endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ |
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index ded062f9b358..135c24a5ba26 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h | |||
@@ -33,7 +33,6 @@ typedef struct xpaddr { | |||
33 | #define INVALID_P2M_ENTRY (~0UL) | 33 | #define INVALID_P2M_ENTRY (~0UL) |
34 | 34 | ||
35 | unsigned long __pfn_to_mfn(unsigned long pfn); | 35 | unsigned long __pfn_to_mfn(unsigned long pfn); |
36 | unsigned long __mfn_to_pfn(unsigned long mfn); | ||
37 | extern struct rb_root phys_to_mach; | 36 | extern struct rb_root phys_to_mach; |
38 | 37 | ||
39 | static inline unsigned long pfn_to_mfn(unsigned long pfn) | 38 | static inline unsigned long pfn_to_mfn(unsigned long pfn) |
@@ -51,14 +50,6 @@ static inline unsigned long pfn_to_mfn(unsigned long pfn) | |||
51 | 50 | ||
52 | static inline unsigned long mfn_to_pfn(unsigned long mfn) | 51 | static inline unsigned long mfn_to_pfn(unsigned long mfn) |
53 | { | 52 | { |
54 | unsigned long pfn; | ||
55 | |||
56 | if (phys_to_mach.rb_node != NULL) { | ||
57 | pfn = __mfn_to_pfn(mfn); | ||
58 | if (pfn != INVALID_P2M_ENTRY) | ||
59 | return pfn; | ||
60 | } | ||
61 | |||
62 | return mfn; | 53 | return mfn; |
63 | } | 54 | } |
64 | 55 | ||
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index f7b450f97e68..a88671cfe1ff 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -98,6 +98,14 @@ EXPORT_SYMBOL(__clear_user); | |||
98 | EXPORT_SYMBOL(__get_user_1); | 98 | EXPORT_SYMBOL(__get_user_1); |
99 | EXPORT_SYMBOL(__get_user_2); | 99 | EXPORT_SYMBOL(__get_user_2); |
100 | EXPORT_SYMBOL(__get_user_4); | 100 | EXPORT_SYMBOL(__get_user_4); |
101 | EXPORT_SYMBOL(__get_user_8); | ||
102 | |||
103 | #ifdef __ARMEB__ | ||
104 | EXPORT_SYMBOL(__get_user_64t_1); | ||
105 | EXPORT_SYMBOL(__get_user_64t_2); | ||
106 | EXPORT_SYMBOL(__get_user_64t_4); | ||
107 | EXPORT_SYMBOL(__get_user_32t_8); | ||
108 | #endif | ||
101 | 109 | ||
102 | EXPORT_SYMBOL(__put_user_1); | 110 | EXPORT_SYMBOL(__put_user_1); |
103 | EXPORT_SYMBOL(__put_user_2); | 111 | EXPORT_SYMBOL(__put_user_2); |
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S index 8db307d0954b..2fdf8679b46e 100644 --- a/arch/arm/kernel/entry-header.S +++ b/arch/arm/kernel/entry-header.S | |||
@@ -208,26 +208,21 @@ | |||
208 | #endif | 208 | #endif |
209 | .endif | 209 | .endif |
210 | msr spsr_cxsf, \rpsr | 210 | msr spsr_cxsf, \rpsr |
211 | #if defined(CONFIG_CPU_V6) | 211 | #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) |
212 | ldr r0, [sp] | 212 | @ We must avoid clrex due to Cortex-A15 erratum #830321 |
213 | strex r1, r2, [sp] @ clear the exclusive monitor | 213 | sub r0, sp, #4 @ uninhabited address |
214 | ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr | 214 | strex r1, r2, [r0] @ clear the exclusive monitor |
215 | #elif defined(CONFIG_CPU_32v6K) | ||
216 | clrex @ clear the exclusive monitor | ||
217 | ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr | ||
218 | #else | ||
219 | ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr | ||
220 | #endif | 215 | #endif |
216 | ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr | ||
221 | .endm | 217 | .endm |
222 | 218 | ||
223 | .macro restore_user_regs, fast = 0, offset = 0 | 219 | .macro restore_user_regs, fast = 0, offset = 0 |
224 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr | 220 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr |
225 | ldr lr, [sp, #\offset + S_PC]! @ get pc | 221 | ldr lr, [sp, #\offset + S_PC]! @ get pc |
226 | msr spsr_cxsf, r1 @ save in spsr_svc | 222 | msr spsr_cxsf, r1 @ save in spsr_svc |
227 | #if defined(CONFIG_CPU_V6) | 223 | #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) |
224 | @ We must avoid clrex due to Cortex-A15 erratum #830321 | ||
228 | strex r1, r2, [sp] @ clear the exclusive monitor | 225 | strex r1, r2, [sp] @ clear the exclusive monitor |
229 | #elif defined(CONFIG_CPU_32v6K) | ||
230 | clrex @ clear the exclusive monitor | ||
231 | #endif | 226 | #endif |
232 | .if \fast | 227 | .if \fast |
233 | ldmdb sp, {r1 - lr}^ @ get calling r1 - lr | 228 | ldmdb sp, {r1 - lr}^ @ get calling r1 - lr |
@@ -261,7 +256,10 @@ | |||
261 | .endif | 256 | .endif |
262 | ldr lr, [sp, #S_SP] @ top of the stack | 257 | ldr lr, [sp, #S_SP] @ top of the stack |
263 | ldrd r0, r1, [sp, #S_LR] @ calling lr and pc | 258 | ldrd r0, r1, [sp, #S_LR] @ calling lr and pc |
264 | clrex @ clear the exclusive monitor | 259 | |
260 | @ We must avoid clrex due to Cortex-A15 erratum #830321 | ||
261 | strex r2, r1, [sp, #S_LR] @ clear the exclusive monitor | ||
262 | |||
265 | stmdb lr!, {r0, r1, \rpsr} @ calling lr and rfe context | 263 | stmdb lr!, {r0, r1, \rpsr} @ calling lr and rfe context |
266 | ldmia sp, {r0 - r12} | 264 | ldmia sp, {r0 - r12} |
267 | mov sp, lr | 265 | mov sp, lr |
@@ -282,13 +280,16 @@ | |||
282 | .endm | 280 | .endm |
283 | #else /* ifdef CONFIG_CPU_V7M */ | 281 | #else /* ifdef CONFIG_CPU_V7M */ |
284 | .macro restore_user_regs, fast = 0, offset = 0 | 282 | .macro restore_user_regs, fast = 0, offset = 0 |
285 | clrex @ clear the exclusive monitor | ||
286 | mov r2, sp | 283 | mov r2, sp |
287 | load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr | 284 | load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr |
288 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr | 285 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr |
289 | ldr lr, [sp, #\offset + S_PC] @ get pc | 286 | ldr lr, [sp, #\offset + S_PC] @ get pc |
290 | add sp, sp, #\offset + S_SP | 287 | add sp, sp, #\offset + S_SP |
291 | msr spsr_cxsf, r1 @ save in spsr_svc | 288 | msr spsr_cxsf, r1 @ save in spsr_svc |
289 | |||
290 | @ We must avoid clrex due to Cortex-A15 erratum #830321 | ||
291 | strex r1, r2, [sp] @ clear the exclusive monitor | ||
292 | |||
292 | .if \fast | 293 | .if \fast |
293 | ldmdb sp, {r1 - r12} @ get calling r1 - r12 | 294 | ldmdb sp, {r1 - r12} @ get calling r1 - r12 |
294 | .else | 295 | .else |
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 2c4257604513..5c4d38e32a51 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
@@ -175,7 +175,7 @@ static bool migrate_one_irq(struct irq_desc *desc) | |||
175 | c = irq_data_get_irq_chip(d); | 175 | c = irq_data_get_irq_chip(d); |
176 | if (!c->irq_set_affinity) | 176 | if (!c->irq_set_affinity) |
177 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | 177 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
178 | else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) | 178 | else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) |
179 | cpumask_copy(d->affinity, affinity); | 179 | cpumask_copy(d->affinity, affinity); |
180 | 180 | ||
181 | return ret; | 181 | return ret; |
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 45e478157278..6a4dffefd357 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c | |||
@@ -91,6 +91,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, | |||
91 | break; | 91 | break; |
92 | 92 | ||
93 | case R_ARM_ABS32: | 93 | case R_ARM_ABS32: |
94 | case R_ARM_TARGET1: | ||
94 | *(u32 *)loc += sym->st_value; | 95 | *(u32 *)loc += sym->st_value; |
95 | break; | 96 | break; |
96 | 97 | ||
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index e6a6edbec613..4bf4cce759fe 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c | |||
@@ -76,21 +76,15 @@ static struct pmu_hw_events *cpu_pmu_get_cpu_events(void) | |||
76 | 76 | ||
77 | static void cpu_pmu_enable_percpu_irq(void *data) | 77 | static void cpu_pmu_enable_percpu_irq(void *data) |
78 | { | 78 | { |
79 | struct arm_pmu *cpu_pmu = data; | 79 | int irq = *(int *)data; |
80 | struct platform_device *pmu_device = cpu_pmu->plat_device; | ||
81 | int irq = platform_get_irq(pmu_device, 0); | ||
82 | 80 | ||
83 | enable_percpu_irq(irq, IRQ_TYPE_NONE); | 81 | enable_percpu_irq(irq, IRQ_TYPE_NONE); |
84 | cpumask_set_cpu(smp_processor_id(), &cpu_pmu->active_irqs); | ||
85 | } | 82 | } |
86 | 83 | ||
87 | static void cpu_pmu_disable_percpu_irq(void *data) | 84 | static void cpu_pmu_disable_percpu_irq(void *data) |
88 | { | 85 | { |
89 | struct arm_pmu *cpu_pmu = data; | 86 | int irq = *(int *)data; |
90 | struct platform_device *pmu_device = cpu_pmu->plat_device; | ||
91 | int irq = platform_get_irq(pmu_device, 0); | ||
92 | 87 | ||
93 | cpumask_clear_cpu(smp_processor_id(), &cpu_pmu->active_irqs); | ||
94 | disable_percpu_irq(irq); | 88 | disable_percpu_irq(irq); |
95 | } | 89 | } |
96 | 90 | ||
@@ -103,7 +97,7 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu) | |||
103 | 97 | ||
104 | irq = platform_get_irq(pmu_device, 0); | 98 | irq = platform_get_irq(pmu_device, 0); |
105 | if (irq >= 0 && irq_is_percpu(irq)) { | 99 | if (irq >= 0 && irq_is_percpu(irq)) { |
106 | on_each_cpu(cpu_pmu_disable_percpu_irq, cpu_pmu, 1); | 100 | on_each_cpu(cpu_pmu_disable_percpu_irq, &irq, 1); |
107 | free_percpu_irq(irq, &percpu_pmu); | 101 | free_percpu_irq(irq, &percpu_pmu); |
108 | } else { | 102 | } else { |
109 | for (i = 0; i < irqs; ++i) { | 103 | for (i = 0; i < irqs; ++i) { |
@@ -138,7 +132,7 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler) | |||
138 | irq); | 132 | irq); |
139 | return err; | 133 | return err; |
140 | } | 134 | } |
141 | on_each_cpu(cpu_pmu_enable_percpu_irq, cpu_pmu, 1); | 135 | on_each_cpu(cpu_pmu_enable_percpu_irq, &irq, 1); |
142 | } else { | 136 | } else { |
143 | for (i = 0; i < irqs; ++i) { | 137 | for (i = 0; i < irqs; ++i) { |
144 | err = 0; | 138 | err = 0; |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 81ef686a91ca..a35f6ebbd2c2 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -334,6 +334,8 @@ void flush_thread(void) | |||
334 | memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); | 334 | memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); |
335 | memset(&thread->fpstate, 0, sizeof(union fp_state)); | 335 | memset(&thread->fpstate, 0, sizeof(union fp_state)); |
336 | 336 | ||
337 | flush_tls(); | ||
338 | |||
337 | thread_notify(THREAD_NOTIFY_FLUSH, thread); | 339 | thread_notify(THREAD_NOTIFY_FLUSH, thread); |
338 | } | 340 | } |
339 | 341 | ||
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index 67ca8578c6d8..587fdfe1a72c 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c | |||
@@ -142,14 +142,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data, | |||
142 | while (1) { | 142 | while (1) { |
143 | unsigned long temp; | 143 | unsigned long temp; |
144 | 144 | ||
145 | /* | ||
146 | * Barrier required between accessing protected resource and | ||
147 | * releasing a lock for it. Legacy code might not have done | ||
148 | * this, and we cannot determine that this is not the case | ||
149 | * being emulated, so insert always. | ||
150 | */ | ||
151 | smp_mb(); | ||
152 | |||
153 | if (type == TYPE_SWPB) | 145 | if (type == TYPE_SWPB) |
154 | __user_swpb_asm(*data, address, res, temp); | 146 | __user_swpb_asm(*data, address, res, temp); |
155 | else | 147 | else |
@@ -162,13 +154,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data, | |||
162 | } | 154 | } |
163 | 155 | ||
164 | if (res == 0) { | 156 | if (res == 0) { |
165 | /* | ||
166 | * Barrier also required between acquiring a lock for a | ||
167 | * protected resource and accessing the resource. Inserted for | ||
168 | * same reason as above. | ||
169 | */ | ||
170 | smp_mb(); | ||
171 | |||
172 | if (type == TYPE_SWPB) | 157 | if (type == TYPE_SWPB) |
173 | swpbcounter++; | 158 | swpbcounter++; |
174 | else | 159 | else |
diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c index 7b8403b76666..80f0d69205e7 100644 --- a/arch/arm/kernel/thumbee.c +++ b/arch/arm/kernel/thumbee.c | |||
@@ -45,7 +45,7 @@ static int thumbee_notifier(struct notifier_block *self, unsigned long cmd, void | |||
45 | 45 | ||
46 | switch (cmd) { | 46 | switch (cmd) { |
47 | case THREAD_NOTIFY_FLUSH: | 47 | case THREAD_NOTIFY_FLUSH: |
48 | thread->thumbee_state = 0; | 48 | teehbr_write(0); |
49 | break; | 49 | break; |
50 | case THREAD_NOTIFY_SWITCH: | 50 | case THREAD_NOTIFY_SWITCH: |
51 | current_thread_info()->thumbee_state = teehbr_read(); | 51 | current_thread_info()->thumbee_state = teehbr_read(); |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index c8e4bb714944..a964c9f40f87 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -581,7 +581,6 @@ do_cache_op(unsigned long start, unsigned long end, int flags) | |||
581 | #define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE) | 581 | #define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE) |
582 | asmlinkage int arm_syscall(int no, struct pt_regs *regs) | 582 | asmlinkage int arm_syscall(int no, struct pt_regs *regs) |
583 | { | 583 | { |
584 | struct thread_info *thread = current_thread_info(); | ||
585 | siginfo_t info; | 584 | siginfo_t info; |
586 | 585 | ||
587 | if ((no >> 16) != (__ARM_NR_BASE>> 16)) | 586 | if ((no >> 16) != (__ARM_NR_BASE>> 16)) |
@@ -632,21 +631,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) | |||
632 | return regs->ARM_r0; | 631 | return regs->ARM_r0; |
633 | 632 | ||
634 | case NR(set_tls): | 633 | case NR(set_tls): |
635 | thread->tp_value[0] = regs->ARM_r0; | 634 | set_tls(regs->ARM_r0); |
636 | if (tls_emu) | ||
637 | return 0; | ||
638 | if (has_tls_reg) { | ||
639 | asm ("mcr p15, 0, %0, c13, c0, 3" | ||
640 | : : "r" (regs->ARM_r0)); | ||
641 | } else { | ||
642 | /* | ||
643 | * User space must never try to access this directly. | ||
644 | * Expect your app to break eventually if you do so. | ||
645 | * The user helper at 0xffff0fe0 must be used instead. | ||
646 | * (see entry-armv.S for details) | ||
647 | */ | ||
648 | *((unsigned int *)0xffff0ff0) = regs->ARM_r0; | ||
649 | } | ||
650 | return 0; | 635 | return 0; |
651 | 636 | ||
652 | #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG | 637 | #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG |
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c index 4c979d466cc1..a96a8043277c 100644 --- a/arch/arm/kvm/handle_exit.c +++ b/arch/arm/kvm/handle_exit.c | |||
@@ -93,6 +93,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
93 | else | 93 | else |
94 | kvm_vcpu_block(vcpu); | 94 | kvm_vcpu_block(vcpu); |
95 | 95 | ||
96 | kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | ||
97 | |||
96 | return 1; | 98 | return 1; |
97 | } | 99 | } |
98 | 100 | ||
diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S index 991415d978b6..3988e72d16ff 100644 --- a/arch/arm/kvm/init.S +++ b/arch/arm/kvm/init.S | |||
@@ -99,6 +99,10 @@ __do_hyp_init: | |||
99 | mrc p15, 0, r0, c10, c2, 1 | 99 | mrc p15, 0, r0, c10, c2, 1 |
100 | mcr p15, 4, r0, c10, c2, 1 | 100 | mcr p15, 4, r0, c10, c2, 1 |
101 | 101 | ||
102 | @ Invalidate the stale TLBs from Bootloader | ||
103 | mcr p15, 4, r0, c8, c7, 0 @ TLBIALLH | ||
104 | dsb ish | ||
105 | |||
102 | @ Set the HSCTLR to: | 106 | @ Set the HSCTLR to: |
103 | @ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel) | 107 | @ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel) |
104 | @ - Endianness: Kernel config | 108 | @ - Endianness: Kernel config |
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S index 938600098b88..8ecfd15c3a02 100644 --- a/arch/arm/lib/getuser.S +++ b/arch/arm/lib/getuser.S | |||
@@ -80,7 +80,7 @@ ENTRY(__get_user_8) | |||
80 | ENDPROC(__get_user_8) | 80 | ENDPROC(__get_user_8) |
81 | 81 | ||
82 | #ifdef __ARMEB__ | 82 | #ifdef __ARMEB__ |
83 | ENTRY(__get_user_lo8) | 83 | ENTRY(__get_user_32t_8) |
84 | check_uaccess r0, 8, r1, r2, __get_user_bad | 84 | check_uaccess r0, 8, r1, r2, __get_user_bad |
85 | #ifdef CONFIG_CPU_USE_DOMAINS | 85 | #ifdef CONFIG_CPU_USE_DOMAINS |
86 | add r0, r0, #4 | 86 | add r0, r0, #4 |
@@ -90,7 +90,37 @@ ENTRY(__get_user_lo8) | |||
90 | #endif | 90 | #endif |
91 | mov r0, #0 | 91 | mov r0, #0 |
92 | ret lr | 92 | ret lr |
93 | ENDPROC(__get_user_lo8) | 93 | ENDPROC(__get_user_32t_8) |
94 | |||
95 | ENTRY(__get_user_64t_1) | ||
96 | check_uaccess r0, 1, r1, r2, __get_user_bad8 | ||
97 | 8: TUSER(ldrb) r3, [r0] | ||
98 | mov r0, #0 | ||
99 | ret lr | ||
100 | ENDPROC(__get_user_64t_1) | ||
101 | |||
102 | ENTRY(__get_user_64t_2) | ||
103 | check_uaccess r0, 2, r1, r2, __get_user_bad8 | ||
104 | #ifdef CONFIG_CPU_USE_DOMAINS | ||
105 | rb .req ip | ||
106 | 9: ldrbt r3, [r0], #1 | ||
107 | 10: ldrbt rb, [r0], #0 | ||
108 | #else | ||
109 | rb .req r0 | ||
110 | 9: ldrb r3, [r0] | ||
111 | 10: ldrb rb, [r0, #1] | ||
112 | #endif | ||
113 | orr r3, rb, r3, lsl #8 | ||
114 | mov r0, #0 | ||
115 | ret lr | ||
116 | ENDPROC(__get_user_64t_2) | ||
117 | |||
118 | ENTRY(__get_user_64t_4) | ||
119 | check_uaccess r0, 4, r1, r2, __get_user_bad8 | ||
120 | 11: TUSER(ldr) r3, [r0] | ||
121 | mov r0, #0 | ||
122 | ret lr | ||
123 | ENDPROC(__get_user_64t_4) | ||
94 | #endif | 124 | #endif |
95 | 125 | ||
96 | __get_user_bad8: | 126 | __get_user_bad8: |
@@ -111,5 +141,9 @@ ENDPROC(__get_user_bad8) | |||
111 | .long 6b, __get_user_bad8 | 141 | .long 6b, __get_user_bad8 |
112 | #ifdef __ARMEB__ | 142 | #ifdef __ARMEB__ |
113 | .long 7b, __get_user_bad | 143 | .long 7b, __get_user_bad |
144 | .long 8b, __get_user_bad8 | ||
145 | .long 9b, __get_user_bad8 | ||
146 | .long 10b, __get_user_bad8 | ||
147 | .long 11b, __get_user_bad8 | ||
114 | #endif | 148 | #endif |
115 | .popsection | 149 | .popsection |
diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c index 3a185faee795..f4b6e91843e4 100644 --- a/arch/arm/mach-at91/board-dt-rm9200.c +++ b/arch/arm/mach-at91/board-dt-rm9200.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/gpio.h> | 14 | #include <linux/gpio.h> |
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_irq.h> | 16 | #include <linux/of_irq.h> |
17 | #include <linux/clk-provider.h> | ||
17 | 18 | ||
18 | #include <asm/setup.h> | 19 | #include <asm/setup.h> |
19 | #include <asm/irq.h> | 20 | #include <asm/irq.h> |
@@ -35,13 +36,21 @@ static void __init at91rm9200_dt_init_irq(void) | |||
35 | of_irq_init(irq_of_match); | 36 | of_irq_init(irq_of_match); |
36 | } | 37 | } |
37 | 38 | ||
39 | static void __init at91rm9200_dt_timer_init(void) | ||
40 | { | ||
41 | #if defined(CONFIG_COMMON_CLK) | ||
42 | of_clk_init(NULL); | ||
43 | #endif | ||
44 | at91rm9200_timer_init(); | ||
45 | } | ||
46 | |||
38 | static const char *at91rm9200_dt_board_compat[] __initdata = { | 47 | static const char *at91rm9200_dt_board_compat[] __initdata = { |
39 | "atmel,at91rm9200", | 48 | "atmel,at91rm9200", |
40 | NULL | 49 | NULL |
41 | }; | 50 | }; |
42 | 51 | ||
43 | DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") | 52 | DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") |
44 | .init_time = at91rm9200_timer_init, | 53 | .init_time = at91rm9200_dt_timer_init, |
45 | .map_io = at91_map_io, | 54 | .map_io = at91_map_io, |
46 | .handle_irq = at91_aic_handle_irq, | 55 | .handle_irq = at91_aic_handle_irq, |
47 | .init_early = at91rm9200_dt_initialize, | 56 | .init_early = at91rm9200_dt_initialize, |
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile index 67c492aabf4d..b19a39652545 100644 --- a/arch/arm/mach-bcm/Makefile +++ b/arch/arm/mach-bcm/Makefile | |||
@@ -36,5 +36,4 @@ obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o | |||
36 | 36 | ||
37 | ifeq ($(CONFIG_ARCH_BRCMSTB),y) | 37 | ifeq ($(CONFIG_ARCH_BRCMSTB),y) |
38 | obj-y += brcmstb.o | 38 | obj-y += brcmstb.o |
39 | obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o | ||
40 | endif | 39 | endif |
diff --git a/arch/arm/mach-bcm/brcmstb.h b/arch/arm/mach-bcm/brcmstb.h deleted file mode 100644 index ec0c3d112b36..000000000000 --- a/arch/arm/mach-bcm/brcmstb.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013-2014 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
9 | * kind, whether express or implied; without even the implied warranty | ||
10 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #ifndef __BRCMSTB_H__ | ||
15 | #define __BRCMSTB_H__ | ||
16 | |||
17 | void brcmstb_secondary_startup(void); | ||
18 | |||
19 | #endif /* __BRCMSTB_H__ */ | ||
diff --git a/arch/arm/mach-bcm/headsmp-brcmstb.S b/arch/arm/mach-bcm/headsmp-brcmstb.S deleted file mode 100644 index 199c1ea58248..000000000000 --- a/arch/arm/mach-bcm/headsmp-brcmstb.S +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * SMP boot code for secondary CPUs | ||
3 | * Based on arch/arm/mach-tegra/headsmp.S | ||
4 | * | ||
5 | * Copyright (C) 2010 NVIDIA, Inc. | ||
6 | * Copyright (C) 2013-2014 Broadcom Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License as | ||
10 | * published by the Free Software Foundation version 2. | ||
11 | * | ||
12 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
13 | * kind, whether express or implied; without even the implied warranty | ||
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #include <asm/assembler.h> | ||
19 | #include <linux/linkage.h> | ||
20 | #include <linux/init.h> | ||
21 | |||
22 | .section ".text.head", "ax" | ||
23 | |||
24 | ENTRY(brcmstb_secondary_startup) | ||
25 | /* | ||
26 | * Ensure CPU is in a sane state by disabling all IRQs and switching | ||
27 | * into SVC mode. | ||
28 | */ | ||
29 | setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0 | ||
30 | |||
31 | bl v7_invalidate_l1 | ||
32 | b secondary_startup | ||
33 | ENDPROC(brcmstb_secondary_startup) | ||
diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c deleted file mode 100644 index af780e9c23a6..000000000000 --- a/arch/arm/mach-bcm/platsmp-brcmstb.c +++ /dev/null | |||
@@ -1,363 +0,0 @@ | |||
1 | /* | ||
2 | * Broadcom STB CPU SMP and hotplug support for ARM | ||
3 | * | ||
4 | * Copyright (C) 2013-2014 Broadcom Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation version 2. | ||
9 | * | ||
10 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
11 | * kind, whether express or implied; without even the implied warranty | ||
12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/delay.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/of_platform.h> | ||
22 | #include <linux/printk.h> | ||
23 | #include <linux/regmap.h> | ||
24 | #include <linux/smp.h> | ||
25 | #include <linux/mfd/syscon.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | |||
28 | #include <asm/cacheflush.h> | ||
29 | #include <asm/cp15.h> | ||
30 | #include <asm/mach-types.h> | ||
31 | #include <asm/smp_plat.h> | ||
32 | |||
33 | #include "brcmstb.h" | ||
34 | |||
35 | enum { | ||
36 | ZONE_MAN_CLKEN_MASK = BIT(0), | ||
37 | ZONE_MAN_RESET_CNTL_MASK = BIT(1), | ||
38 | ZONE_MAN_MEM_PWR_MASK = BIT(4), | ||
39 | ZONE_RESERVED_1_MASK = BIT(5), | ||
40 | ZONE_MAN_ISO_CNTL_MASK = BIT(6), | ||
41 | ZONE_MANUAL_CONTROL_MASK = BIT(7), | ||
42 | ZONE_PWR_DN_REQ_MASK = BIT(9), | ||
43 | ZONE_PWR_UP_REQ_MASK = BIT(10), | ||
44 | ZONE_BLK_RST_ASSERT_MASK = BIT(12), | ||
45 | ZONE_PWR_OFF_STATE_MASK = BIT(25), | ||
46 | ZONE_PWR_ON_STATE_MASK = BIT(26), | ||
47 | ZONE_DPG_PWR_STATE_MASK = BIT(28), | ||
48 | ZONE_MEM_PWR_STATE_MASK = BIT(29), | ||
49 | ZONE_RESET_STATE_MASK = BIT(31), | ||
50 | CPU0_PWR_ZONE_CTRL_REG = 1, | ||
51 | CPU_RESET_CONFIG_REG = 2, | ||
52 | }; | ||
53 | |||
54 | static void __iomem *cpubiuctrl_block; | ||
55 | static void __iomem *hif_cont_block; | ||
56 | static u32 cpu0_pwr_zone_ctrl_reg; | ||
57 | static u32 cpu_rst_cfg_reg; | ||
58 | static u32 hif_cont_reg; | ||
59 | |||
60 | #ifdef CONFIG_HOTPLUG_CPU | ||
61 | static DEFINE_PER_CPU_ALIGNED(int, per_cpu_sw_state); | ||
62 | |||
63 | static int per_cpu_sw_state_rd(u32 cpu) | ||
64 | { | ||
65 | sync_cache_r(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); | ||
66 | return per_cpu(per_cpu_sw_state, cpu); | ||
67 | } | ||
68 | |||
69 | static void per_cpu_sw_state_wr(u32 cpu, int val) | ||
70 | { | ||
71 | per_cpu(per_cpu_sw_state, cpu) = val; | ||
72 | dmb(); | ||
73 | sync_cache_w(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); | ||
74 | dsb_sev(); | ||
75 | } | ||
76 | #else | ||
77 | static inline void per_cpu_sw_state_wr(u32 cpu, int val) { } | ||
78 | #endif | ||
79 | |||
80 | static void __iomem *pwr_ctrl_get_base(u32 cpu) | ||
81 | { | ||
82 | void __iomem *base = cpubiuctrl_block + cpu0_pwr_zone_ctrl_reg; | ||
83 | base += (cpu_logical_map(cpu) * 4); | ||
84 | return base; | ||
85 | } | ||
86 | |||
87 | static u32 pwr_ctrl_rd(u32 cpu) | ||
88 | { | ||
89 | void __iomem *base = pwr_ctrl_get_base(cpu); | ||
90 | return readl_relaxed(base); | ||
91 | } | ||
92 | |||
93 | static void pwr_ctrl_wr(u32 cpu, u32 val) | ||
94 | { | ||
95 | void __iomem *base = pwr_ctrl_get_base(cpu); | ||
96 | writel(val, base); | ||
97 | } | ||
98 | |||
99 | static void cpu_rst_cfg_set(u32 cpu, int set) | ||
100 | { | ||
101 | u32 val; | ||
102 | val = readl_relaxed(cpubiuctrl_block + cpu_rst_cfg_reg); | ||
103 | if (set) | ||
104 | val |= BIT(cpu_logical_map(cpu)); | ||
105 | else | ||
106 | val &= ~BIT(cpu_logical_map(cpu)); | ||
107 | writel_relaxed(val, cpubiuctrl_block + cpu_rst_cfg_reg); | ||
108 | } | ||
109 | |||
110 | static void cpu_set_boot_addr(u32 cpu, unsigned long boot_addr) | ||
111 | { | ||
112 | const int reg_ofs = cpu_logical_map(cpu) * 8; | ||
113 | writel_relaxed(0, hif_cont_block + hif_cont_reg + reg_ofs); | ||
114 | writel_relaxed(boot_addr, hif_cont_block + hif_cont_reg + 4 + reg_ofs); | ||
115 | } | ||
116 | |||
117 | static void brcmstb_cpu_boot(u32 cpu) | ||
118 | { | ||
119 | pr_info("SMP: Booting CPU%d...\n", cpu); | ||
120 | |||
121 | /* | ||
122 | * set the reset vector to point to the secondary_startup | ||
123 | * routine | ||
124 | */ | ||
125 | cpu_set_boot_addr(cpu, virt_to_phys(brcmstb_secondary_startup)); | ||
126 | |||
127 | /* unhalt the cpu */ | ||
128 | cpu_rst_cfg_set(cpu, 0); | ||
129 | } | ||
130 | |||
131 | static void brcmstb_cpu_power_on(u32 cpu) | ||
132 | { | ||
133 | /* | ||
134 | * The secondary cores power was cut, so we must go through | ||
135 | * power-on initialization. | ||
136 | */ | ||
137 | u32 tmp; | ||
138 | |||
139 | pr_info("SMP: Powering up CPU%d...\n", cpu); | ||
140 | |||
141 | /* Request zone power up */ | ||
142 | pwr_ctrl_wr(cpu, ZONE_PWR_UP_REQ_MASK); | ||
143 | |||
144 | /* Wait for the power up FSM to complete */ | ||
145 | do { | ||
146 | tmp = pwr_ctrl_rd(cpu); | ||
147 | } while (!(tmp & ZONE_PWR_ON_STATE_MASK)); | ||
148 | |||
149 | per_cpu_sw_state_wr(cpu, 1); | ||
150 | } | ||
151 | |||
152 | static int brcmstb_cpu_get_power_state(u32 cpu) | ||
153 | { | ||
154 | int tmp = pwr_ctrl_rd(cpu); | ||
155 | return (tmp & ZONE_RESET_STATE_MASK) ? 0 : 1; | ||
156 | } | ||
157 | |||
158 | #ifdef CONFIG_HOTPLUG_CPU | ||
159 | |||
160 | static void brcmstb_cpu_die(u32 cpu) | ||
161 | { | ||
162 | v7_exit_coherency_flush(all); | ||
163 | |||
164 | /* Prevent all interrupts from reaching this CPU. */ | ||
165 | arch_local_irq_disable(); | ||
166 | |||
167 | /* | ||
168 | * Final full barrier to ensure everything before this instruction has | ||
169 | * quiesced. | ||
170 | */ | ||
171 | isb(); | ||
172 | dsb(); | ||
173 | |||
174 | per_cpu_sw_state_wr(cpu, 0); | ||
175 | |||
176 | /* Sit and wait to die */ | ||
177 | wfi(); | ||
178 | |||
179 | /* We should never get here... */ | ||
180 | panic("Spurious interrupt on CPU %d received!\n", cpu); | ||
181 | } | ||
182 | |||
183 | static int brcmstb_cpu_kill(u32 cpu) | ||
184 | { | ||
185 | u32 tmp; | ||
186 | |||
187 | pr_info("SMP: Powering down CPU%d...\n", cpu); | ||
188 | |||
189 | while (per_cpu_sw_state_rd(cpu)) | ||
190 | ; | ||
191 | |||
192 | /* Program zone reset */ | ||
193 | pwr_ctrl_wr(cpu, ZONE_RESET_STATE_MASK | ZONE_BLK_RST_ASSERT_MASK | | ||
194 | ZONE_PWR_DN_REQ_MASK); | ||
195 | |||
196 | /* Verify zone reset */ | ||
197 | tmp = pwr_ctrl_rd(cpu); | ||
198 | if (!(tmp & ZONE_RESET_STATE_MASK)) | ||
199 | pr_err("%s: Zone reset bit for CPU %d not asserted!\n", | ||
200 | __func__, cpu); | ||
201 | |||
202 | /* Wait for power down */ | ||
203 | do { | ||
204 | tmp = pwr_ctrl_rd(cpu); | ||
205 | } while (!(tmp & ZONE_PWR_OFF_STATE_MASK)); | ||
206 | |||
207 | /* Settle-time from Broadcom-internal DVT reference code */ | ||
208 | udelay(7); | ||
209 | |||
210 | /* Assert reset on the CPU */ | ||
211 | cpu_rst_cfg_set(cpu, 1); | ||
212 | |||
213 | return 1; | ||
214 | } | ||
215 | |||
216 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
217 | |||
218 | static int __init setup_hifcpubiuctrl_regs(struct device_node *np) | ||
219 | { | ||
220 | int rc = 0; | ||
221 | char *name; | ||
222 | struct device_node *syscon_np = NULL; | ||
223 | |||
224 | name = "syscon-cpu"; | ||
225 | |||
226 | syscon_np = of_parse_phandle(np, name, 0); | ||
227 | if (!syscon_np) { | ||
228 | pr_err("can't find phandle %s\n", name); | ||
229 | rc = -EINVAL; | ||
230 | goto cleanup; | ||
231 | } | ||
232 | |||
233 | cpubiuctrl_block = of_iomap(syscon_np, 0); | ||
234 | if (!cpubiuctrl_block) { | ||
235 | pr_err("iomap failed for cpubiuctrl_block\n"); | ||
236 | rc = -EINVAL; | ||
237 | goto cleanup; | ||
238 | } | ||
239 | |||
240 | rc = of_property_read_u32_index(np, name, CPU0_PWR_ZONE_CTRL_REG, | ||
241 | &cpu0_pwr_zone_ctrl_reg); | ||
242 | if (rc) { | ||
243 | pr_err("failed to read 1st entry from %s property (%d)\n", name, | ||
244 | rc); | ||
245 | rc = -EINVAL; | ||
246 | goto cleanup; | ||
247 | } | ||
248 | |||
249 | rc = of_property_read_u32_index(np, name, CPU_RESET_CONFIG_REG, | ||
250 | &cpu_rst_cfg_reg); | ||
251 | if (rc) { | ||
252 | pr_err("failed to read 2nd entry from %s property (%d)\n", name, | ||
253 | rc); | ||
254 | rc = -EINVAL; | ||
255 | goto cleanup; | ||
256 | } | ||
257 | |||
258 | cleanup: | ||
259 | if (syscon_np) | ||
260 | of_node_put(syscon_np); | ||
261 | |||
262 | return rc; | ||
263 | } | ||
264 | |||
265 | static int __init setup_hifcont_regs(struct device_node *np) | ||
266 | { | ||
267 | int rc = 0; | ||
268 | char *name; | ||
269 | struct device_node *syscon_np = NULL; | ||
270 | |||
271 | name = "syscon-cont"; | ||
272 | |||
273 | syscon_np = of_parse_phandle(np, name, 0); | ||
274 | if (!syscon_np) { | ||
275 | pr_err("can't find phandle %s\n", name); | ||
276 | rc = -EINVAL; | ||
277 | goto cleanup; | ||
278 | } | ||
279 | |||
280 | hif_cont_block = of_iomap(syscon_np, 0); | ||
281 | if (!hif_cont_block) { | ||
282 | pr_err("iomap failed for hif_cont_block\n"); | ||
283 | rc = -EINVAL; | ||
284 | goto cleanup; | ||
285 | } | ||
286 | |||
287 | /* offset is at top of hif_cont_block */ | ||
288 | hif_cont_reg = 0; | ||
289 | |||
290 | cleanup: | ||
291 | if (syscon_np) | ||
292 | of_node_put(syscon_np); | ||
293 | |||
294 | return rc; | ||
295 | } | ||
296 | |||
297 | static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus) | ||
298 | { | ||
299 | int rc; | ||
300 | struct device_node *np; | ||
301 | char *name; | ||
302 | |||
303 | name = "brcm,brcmstb-smpboot"; | ||
304 | np = of_find_compatible_node(NULL, NULL, name); | ||
305 | if (!np) { | ||
306 | pr_err("can't find compatible node %s\n", name); | ||
307 | return; | ||
308 | } | ||
309 | |||
310 | rc = setup_hifcpubiuctrl_regs(np); | ||
311 | if (rc) | ||
312 | return; | ||
313 | |||
314 | rc = setup_hifcont_regs(np); | ||
315 | if (rc) | ||
316 | return; | ||
317 | } | ||
318 | |||
319 | static DEFINE_SPINLOCK(boot_lock); | ||
320 | |||
321 | static void brcmstb_secondary_init(unsigned int cpu) | ||
322 | { | ||
323 | /* | ||
324 | * Synchronise with the boot thread. | ||
325 | */ | ||
326 | spin_lock(&boot_lock); | ||
327 | spin_unlock(&boot_lock); | ||
328 | } | ||
329 | |||
330 | static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
331 | { | ||
332 | /* | ||
333 | * set synchronisation state between this boot processor | ||
334 | * and the secondary one | ||
335 | */ | ||
336 | spin_lock(&boot_lock); | ||
337 | |||
338 | /* Bring up power to the core if necessary */ | ||
339 | if (brcmstb_cpu_get_power_state(cpu) == 0) | ||
340 | brcmstb_cpu_power_on(cpu); | ||
341 | |||
342 | brcmstb_cpu_boot(cpu); | ||
343 | |||
344 | /* | ||
345 | * now the secondary core is starting up let it run its | ||
346 | * calibrations, then wait for it to finish | ||
347 | */ | ||
348 | spin_unlock(&boot_lock); | ||
349 | |||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | static struct smp_operations brcmstb_smp_ops __initdata = { | ||
354 | .smp_prepare_cpus = brcmstb_cpu_ctrl_setup, | ||
355 | .smp_secondary_init = brcmstb_secondary_init, | ||
356 | .smp_boot_secondary = brcmstb_boot_secondary, | ||
357 | #ifdef CONFIG_HOTPLUG_CPU | ||
358 | .cpu_kill = brcmstb_cpu_kill, | ||
359 | .cpu_die = brcmstb_cpu_die, | ||
360 | #endif | ||
361 | }; | ||
362 | |||
363 | CPU_METHOD_OF_DECLARE(brcmstb_smp, "brcm,brahma-b15", &brcmstb_smp_ops); | ||
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index b2f8b60cf0e9..dc9a764a7c37 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c | |||
@@ -43,7 +43,6 @@ | |||
43 | "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR\n\t" \ | 43 | "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR\n\t" \ |
44 | "isb\n\t"\ | 44 | "isb\n\t"\ |
45 | "bl v7_flush_dcache_"__stringify(level)"\n\t" \ | 45 | "bl v7_flush_dcache_"__stringify(level)"\n\t" \ |
46 | "clrex\n\t"\ | ||
47 | "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR\n\t" \ | 46 | "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR\n\t" \ |
48 | "bic r0, r0, #(1 << 6) @ disable local coherency\n\t" \ | 47 | "bic r0, r0, #(1 << 6) @ disable local coherency\n\t" \ |
49 | /* Dummy Load of a device register to avoid Erratum 799270 */ \ | 48 | /* Dummy Load of a device register to avoid Erratum 799270 */ \ |
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 9de84a215abd..be9a51afe05a 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -85,7 +85,6 @@ config SOC_IMX25 | |||
85 | 85 | ||
86 | config SOC_IMX27 | 86 | config SOC_IMX27 |
87 | bool | 87 | bool |
88 | select ARCH_HAS_OPP | ||
89 | select CPU_ARM926T | 88 | select CPU_ARM926T |
90 | select IMX_HAVE_IOMUX_V1 | 89 | select IMX_HAVE_IOMUX_V1 |
91 | select MXC_AVIC | 90 | select MXC_AVIC |
@@ -659,7 +658,6 @@ comment "Device tree only" | |||
659 | 658 | ||
660 | config SOC_IMX5 | 659 | config SOC_IMX5 |
661 | bool | 660 | bool |
662 | select ARCH_HAS_OPP | ||
663 | select HAVE_IMX_SRC | 661 | select HAVE_IMX_SRC |
664 | select MXC_TZIC | 662 | select MXC_TZIC |
665 | 663 | ||
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index ac88599ca080..23c02932bf84 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile | |||
@@ -93,9 +93,11 @@ obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o | |||
93 | obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o | 93 | obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o |
94 | obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o | 94 | obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o |
95 | obj-$(CONFIG_HAVE_IMX_SRC) += src.o | 95 | obj-$(CONFIG_HAVE_IMX_SRC) += src.o |
96 | ifdef CONFIG_SOC_IMX6 | ||
96 | AFLAGS_headsmp.o :=-Wa,-march=armv7-a | 97 | AFLAGS_headsmp.o :=-Wa,-march=armv7-a |
97 | obj-$(CONFIG_SMP) += headsmp.o platsmp.o | 98 | obj-$(CONFIG_SMP) += headsmp.o platsmp.o |
98 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 99 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
100 | endif | ||
99 | obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o | 101 | obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o |
100 | obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o | 102 | obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o |
101 | obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o mach-imx6sx.o | 103 | obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o mach-imx6sx.o |
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c index 84acdfd1d715..5a75cdc81891 100644 --- a/arch/arm/mach-imx/clk-gate2.c +++ b/arch/arm/mach-imx/clk-gate2.c | |||
@@ -97,7 +97,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw) | |||
97 | struct clk_gate2 *gate = to_clk_gate2(hw); | 97 | struct clk_gate2 *gate = to_clk_gate2(hw); |
98 | 98 | ||
99 | if (gate->share_count) | 99 | if (gate->share_count) |
100 | return !!(*gate->share_count); | 100 | return !!__clk_get_enable_count(hw->clk); |
101 | else | 101 | else |
102 | return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); | 102 | return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); |
103 | } | 103 | } |
@@ -127,10 +127,6 @@ struct clk *clk_register_gate2(struct device *dev, const char *name, | |||
127 | gate->bit_idx = bit_idx; | 127 | gate->bit_idx = bit_idx; |
128 | gate->flags = clk_gate2_flags; | 128 | gate->flags = clk_gate2_flags; |
129 | gate->lock = lock; | 129 | gate->lock = lock; |
130 | |||
131 | /* Initialize share_count per hardware state */ | ||
132 | if (share_count) | ||
133 | *share_count = clk_gate2_reg_is_enabled(reg, bit_idx) ? 1 : 0; | ||
134 | gate->share_count = share_count; | 130 | gate->share_count = share_count; |
135 | 131 | ||
136 | init.name = name; | 132 | init.name = name; |
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 6cceb7765c14..29d412975aff 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c | |||
@@ -194,6 +194,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) | |||
194 | clk[IMX6QDL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); | 194 | clk[IMX6QDL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); |
195 | clk[IMX6QDL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); | 195 | clk[IMX6QDL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); |
196 | clk[IMX6QDL_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2); | 196 | clk[IMX6QDL_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2); |
197 | if (cpu_is_imx6dl()) { | ||
198 | clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_fixed_factor("gpu2d_axi", "mmdc_ch0_axi_podf", 1, 1); | ||
199 | clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_fixed_factor("gpu3d_axi", "mmdc_ch0_axi_podf", 1, 1); | ||
200 | } | ||
197 | 201 | ||
198 | clk[IMX6QDL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); | 202 | clk[IMX6QDL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); |
199 | clk[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); | 203 | clk[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); |
@@ -217,8 +221,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) | |||
217 | clk[IMX6QDL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); | 221 | clk[IMX6QDL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); |
218 | clk[IMX6QDL_CLK_ASRC_SEL] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); | 222 | clk[IMX6QDL_CLK_ASRC_SEL] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); |
219 | clk[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); | 223 | clk[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); |
220 | clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); | 224 | if (cpu_is_imx6q()) { |
221 | clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); | 225 | clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); |
226 | clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); | ||
227 | } | ||
222 | clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); | 228 | clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); |
223 | clk[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels)); | 229 | clk[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels)); |
224 | clk[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); | 230 | clk[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); |
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S index 74b50f1982db..ca4ea2daf25b 100644 --- a/arch/arm/mach-imx/suspend-imx6.S +++ b/arch/arm/mach-imx/suspend-imx6.S | |||
@@ -173,6 +173,8 @@ ENTRY(imx6_suspend) | |||
173 | ldr r6, [r11, #0x0] | 173 | ldr r6, [r11, #0x0] |
174 | ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET] | 174 | ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET] |
175 | ldr r6, [r11, #0x0] | 175 | ldr r6, [r11, #0x0] |
176 | ldr r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET] | ||
177 | ldr r6, [r11, #0x0] | ||
176 | 178 | ||
177 | /* use r11 to store the IO address */ | 179 | /* use r11 to store the IO address */ |
178 | ldr r11, [r0, #PM_INFO_MX6Q_SRC_V_OFFSET] | 180 | ldr r11, [r0, #PM_INFO_MX6Q_SRC_V_OFFSET] |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index e7189dcc9309..08d4167cc7c5 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -1,9 +1,6 @@ | |||
1 | menu "TI OMAP/AM/DM/DRA Family" | 1 | menu "TI OMAP/AM/DM/DRA Family" |
2 | depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 | 2 | depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 |
3 | 3 | ||
4 | config ARCH_OMAP | ||
5 | bool | ||
6 | |||
7 | config ARCH_OMAP2 | 4 | config ARCH_OMAP2 |
8 | bool "TI OMAP2" | 5 | bool "TI OMAP2" |
9 | depends on ARCH_MULTI_V6 | 6 | depends on ARCH_MULTI_V6 |
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c index e87f2a83d6bf..2d245c2e641c 100644 --- a/arch/arm/mach-omap2/board-flash.c +++ b/arch/arm/mach-omap2/board-flash.c | |||
@@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, | |||
142 | board_nand_data.nr_parts = nr_parts; | 142 | board_nand_data.nr_parts = nr_parts; |
143 | board_nand_data.devsize = nand_type; | 143 | board_nand_data.devsize = nand_type; |
144 | 144 | ||
145 | board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_HW; | 145 | board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_SW; |
146 | gpmc_nand_init(&board_nand_data, gpmc_t); | 146 | gpmc_nand_init(&board_nand_data, gpmc_t); |
147 | } | 147 | } |
148 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ | 148 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ |
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index 8897ad7035fd..cb7764314f17 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c | |||
@@ -49,7 +49,8 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) | |||
49 | return 0; | 49 | return 0; |
50 | 50 | ||
51 | /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ | 51 | /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ |
52 | if (ecc_opt == OMAP_ECC_HAM1_CODE_HW) | 52 | if (ecc_opt == OMAP_ECC_HAM1_CODE_HW || |
53 | ecc_opt == OMAP_ECC_HAM1_CODE_SW) | ||
53 | return 1; | 54 | return 1; |
54 | else | 55 | else |
55 | return 0; | 56 | return 0; |
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 8bc13380f0a0..2f97228f188a 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -1207,8 +1207,7 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) | |||
1207 | } | 1207 | } |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | if ((p->wait_on_read || p->wait_on_write) && | 1210 | if (p->wait_pin > gpmc_nr_waitpins) { |
1211 | (p->wait_pin > gpmc_nr_waitpins)) { | ||
1212 | pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin); | 1211 | pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin); |
1213 | return -EINVAL; | 1212 | return -EINVAL; |
1214 | } | 1213 | } |
@@ -1288,8 +1287,8 @@ void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p) | |||
1288 | p->wait_on_write = of_property_read_bool(np, | 1287 | p->wait_on_write = of_property_read_bool(np, |
1289 | "gpmc,wait-on-write"); | 1288 | "gpmc,wait-on-write"); |
1290 | if (!p->wait_on_read && !p->wait_on_write) | 1289 | if (!p->wait_on_read && !p->wait_on_write) |
1291 | pr_warn("%s: read/write wait monitoring not enabled!\n", | 1290 | pr_debug("%s: rd/wr wait monitoring not enabled!\n", |
1292 | __func__); | 1291 | __func__); |
1293 | } | 1292 | } |
1294 | } | 1293 | } |
1295 | 1294 | ||
@@ -1403,8 +1402,11 @@ static int gpmc_probe_nand_child(struct platform_device *pdev, | |||
1403 | pr_err("%s: ti,nand-ecc-opt not found\n", __func__); | 1402 | pr_err("%s: ti,nand-ecc-opt not found\n", __func__); |
1404 | return -ENODEV; | 1403 | return -ENODEV; |
1405 | } | 1404 | } |
1406 | if (!strcmp(s, "ham1") || !strcmp(s, "sw") || | 1405 | |
1407 | !strcmp(s, "hw") || !strcmp(s, "hw-romcode")) | 1406 | if (!strcmp(s, "sw")) |
1407 | gpmc_nand_data->ecc_opt = OMAP_ECC_HAM1_CODE_SW; | ||
1408 | else if (!strcmp(s, "ham1") || | ||
1409 | !strcmp(s, "hw") || !strcmp(s, "hw-romcode")) | ||
1408 | gpmc_nand_data->ecc_opt = | 1410 | gpmc_nand_data->ecc_opt = |
1409 | OMAP_ECC_HAM1_CODE_HW; | 1411 | OMAP_ECC_HAM1_CODE_HW; |
1410 | else if (!strcmp(s, "bch4")) | 1412 | else if (!strcmp(s, "bch4")) |
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index d42022f2a71e..53841dea80ea 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c | |||
@@ -663,7 +663,7 @@ void __init dra7xxx_check_revision(void) | |||
663 | 663 | ||
664 | default: | 664 | default: |
665 | /* Unknown default to latest silicon rev as default*/ | 665 | /* Unknown default to latest silicon rev as default*/ |
666 | pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", | 666 | pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%x)\n", |
667 | __func__, idcode, hawkeye, rev); | 667 | __func__, idcode, hawkeye, rev); |
668 | omap_revision = DRA752_REV_ES1_1; | 668 | omap_revision = DRA752_REV_ES1_1; |
669 | } | 669 | } |
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 01ef59def44b..d22c30d3ccfa 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c | |||
@@ -56,7 +56,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias, | |||
56 | 56 | ||
57 | r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); | 57 | r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); |
58 | if (!IS_ERR(r)) { | 58 | if (!IS_ERR(r)) { |
59 | dev_warn(&od->pdev->dev, | 59 | dev_dbg(&od->pdev->dev, |
60 | "alias %s already exists\n", clk_alias); | 60 | "alias %s already exists\n", clk_alias); |
61 | clk_put(r); | 61 | clk_put(r); |
62 | return; | 62 | return; |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 6c074f37cdd2..9e91a4e7519a 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -2065,7 +2065,7 @@ static void _reconfigure_io_chain(void) | |||
2065 | 2065 | ||
2066 | spin_lock_irqsave(&io_chain_lock, flags); | 2066 | spin_lock_irqsave(&io_chain_lock, flags); |
2067 | 2067 | ||
2068 | if (cpu_is_omap34xx() && omap3_has_io_chain_ctrl()) | 2068 | if (cpu_is_omap34xx()) |
2069 | omap3xxx_prm_reconfigure_io_chain(); | 2069 | omap3xxx_prm_reconfigure_io_chain(); |
2070 | else if (cpu_is_omap44xx()) | 2070 | else if (cpu_is_omap44xx()) |
2071 | omap44xx_prm_reconfigure_io_chain(); | 2071 | omap44xx_prm_reconfigure_io_chain(); |
@@ -2185,6 +2185,8 @@ static int _enable(struct omap_hwmod *oh) | |||
2185 | oh->mux->pads_dynamic))) { | 2185 | oh->mux->pads_dynamic))) { |
2186 | omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED); | 2186 | omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED); |
2187 | _reconfigure_io_chain(); | 2187 | _reconfigure_io_chain(); |
2188 | } else if (oh->flags & HWMOD_FORCE_MSTANDBY) { | ||
2189 | _reconfigure_io_chain(); | ||
2188 | } | 2190 | } |
2189 | 2191 | ||
2190 | _add_initiator_dep(oh, mpu_oh); | 2192 | _add_initiator_dep(oh, mpu_oh); |
@@ -2291,6 +2293,8 @@ static int _idle(struct omap_hwmod *oh) | |||
2291 | if (oh->mux && oh->mux->pads_dynamic) { | 2293 | if (oh->mux && oh->mux->pads_dynamic) { |
2292 | omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE); | 2294 | omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE); |
2293 | _reconfigure_io_chain(); | 2295 | _reconfigure_io_chain(); |
2296 | } else if (oh->flags & HWMOD_FORCE_MSTANDBY) { | ||
2297 | _reconfigure_io_chain(); | ||
2294 | } | 2298 | } |
2295 | 2299 | ||
2296 | oh->_state = _HWMOD_STATE_IDLE; | 2300 | oh->_state = _HWMOD_STATE_IDLE; |
@@ -3345,6 +3349,9 @@ int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois) | |||
3345 | if (!ois) | 3349 | if (!ois) |
3346 | return 0; | 3350 | return 0; |
3347 | 3351 | ||
3352 | if (ois[0] == NULL) /* Empty list */ | ||
3353 | return 0; | ||
3354 | |||
3348 | if (!linkspace) { | 3355 | if (!linkspace) { |
3349 | if (_alloc_linkspace(ois)) { | 3356 | if (_alloc_linkspace(ois)) { |
3350 | pr_err("omap_hwmod: could not allocate link space\n"); | 3357 | pr_err("omap_hwmod: could not allocate link space\n"); |
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index 2757abf87fbc..5684f112654b 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "i2c.h" | 35 | #include "i2c.h" |
36 | #include "mmc.h" | 36 | #include "mmc.h" |
37 | #include "wd_timer.h" | 37 | #include "wd_timer.h" |
38 | #include "soc.h" | ||
38 | 39 | ||
39 | /* Base offset for all DRA7XX interrupts external to MPUSS */ | 40 | /* Base offset for all DRA7XX interrupts external to MPUSS */ |
40 | #define DRA7XX_IRQ_GIC_START 32 | 41 | #define DRA7XX_IRQ_GIC_START 32 |
@@ -3261,7 +3262,6 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { | |||
3261 | &dra7xx_l4_per3__usb_otg_ss1, | 3262 | &dra7xx_l4_per3__usb_otg_ss1, |
3262 | &dra7xx_l4_per3__usb_otg_ss2, | 3263 | &dra7xx_l4_per3__usb_otg_ss2, |
3263 | &dra7xx_l4_per3__usb_otg_ss3, | 3264 | &dra7xx_l4_per3__usb_otg_ss3, |
3264 | &dra7xx_l4_per3__usb_otg_ss4, | ||
3265 | &dra7xx_l3_main_1__vcp1, | 3265 | &dra7xx_l3_main_1__vcp1, |
3266 | &dra7xx_l4_per2__vcp1, | 3266 | &dra7xx_l4_per2__vcp1, |
3267 | &dra7xx_l3_main_1__vcp2, | 3267 | &dra7xx_l3_main_1__vcp2, |
@@ -3270,8 +3270,26 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { | |||
3270 | NULL, | 3270 | NULL, |
3271 | }; | 3271 | }; |
3272 | 3272 | ||
3273 | static struct omap_hwmod_ocp_if *dra74x_hwmod_ocp_ifs[] __initdata = { | ||
3274 | &dra7xx_l4_per3__usb_otg_ss4, | ||
3275 | NULL, | ||
3276 | }; | ||
3277 | |||
3278 | static struct omap_hwmod_ocp_if *dra72x_hwmod_ocp_ifs[] __initdata = { | ||
3279 | NULL, | ||
3280 | }; | ||
3281 | |||
3273 | int __init dra7xx_hwmod_init(void) | 3282 | int __init dra7xx_hwmod_init(void) |
3274 | { | 3283 | { |
3284 | int ret; | ||
3285 | |||
3275 | omap_hwmod_init(); | 3286 | omap_hwmod_init(); |
3276 | return omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs); | 3287 | ret = omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs); |
3288 | |||
3289 | if (!ret && soc_is_dra74x()) | ||
3290 | return omap_hwmod_register_links(dra74x_hwmod_ocp_ifs); | ||
3291 | else if (!ret && soc_is_dra72x()) | ||
3292 | return omap_hwmod_register_links(dra72x_hwmod_ocp_ifs); | ||
3293 | |||
3294 | return ret; | ||
3277 | } | 3295 | } |
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 2458be6fc67b..372de3edf4a5 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c | |||
@@ -45,7 +45,7 @@ static struct omap_prcm_irq_setup omap3_prcm_irq_setup = { | |||
45 | .ocp_barrier = &omap3xxx_prm_ocp_barrier, | 45 | .ocp_barrier = &omap3xxx_prm_ocp_barrier, |
46 | .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, | 46 | .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, |
47 | .restore_irqen = &omap3xxx_prm_restore_irqen, | 47 | .restore_irqen = &omap3xxx_prm_restore_irqen, |
48 | .reconfigure_io_chain = &omap3xxx_prm_reconfigure_io_chain, | 48 | .reconfigure_io_chain = NULL, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | /* | 51 | /* |
@@ -369,15 +369,30 @@ void __init omap3_prm_init_pm(bool has_uart4, bool has_iva) | |||
369 | } | 369 | } |
370 | 370 | ||
371 | /** | 371 | /** |
372 | * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain | 372 | * omap3430_pre_es3_1_reconfigure_io_chain - restart wake-up daisy chain |
373 | * | ||
374 | * The ST_IO_CHAIN bit does not exist in 3430 before es3.1. The only | ||
375 | * thing we can do is toggle EN_IO bit for earlier omaps. | ||
376 | */ | ||
377 | void omap3430_pre_es3_1_reconfigure_io_chain(void) | ||
378 | { | ||
379 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, | ||
380 | PM_WKEN); | ||
381 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, | ||
382 | PM_WKEN); | ||
383 | omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN); | ||
384 | } | ||
385 | |||
386 | /** | ||
387 | * omap3_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain | ||
373 | * | 388 | * |
374 | * Clear any previously-latched I/O wakeup events and ensure that the | 389 | * Clear any previously-latched I/O wakeup events and ensure that the |
375 | * I/O wakeup gates are aligned with the current mux settings. Works | 390 | * I/O wakeup gates are aligned with the current mux settings. Works |
376 | * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then | 391 | * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then |
377 | * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No | 392 | * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No |
378 | * return value. | 393 | * return value. These registers are only available in 3430 es3.1 and later. |
379 | */ | 394 | */ |
380 | void omap3xxx_prm_reconfigure_io_chain(void) | 395 | void omap3_prm_reconfigure_io_chain(void) |
381 | { | 396 | { |
382 | int i = 0; | 397 | int i = 0; |
383 | 398 | ||
@@ -400,6 +415,15 @@ void omap3xxx_prm_reconfigure_io_chain(void) | |||
400 | } | 415 | } |
401 | 416 | ||
402 | /** | 417 | /** |
418 | * omap3xxx_prm_reconfigure_io_chain - reconfigure I/O chain | ||
419 | */ | ||
420 | void omap3xxx_prm_reconfigure_io_chain(void) | ||
421 | { | ||
422 | if (omap3_prcm_irq_setup.reconfigure_io_chain) | ||
423 | omap3_prcm_irq_setup.reconfigure_io_chain(); | ||
424 | } | ||
425 | |||
426 | /** | ||
403 | * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches | 427 | * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches |
404 | * | 428 | * |
405 | * Activates the I/O wakeup event latches and allows events logged by | 429 | * Activates the I/O wakeup event latches and allows events logged by |
@@ -656,6 +680,13 @@ static int omap3xxx_prm_late_init(void) | |||
656 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) | 680 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) |
657 | return 0; | 681 | return 0; |
658 | 682 | ||
683 | if (omap3_has_io_chain_ctrl()) | ||
684 | omap3_prcm_irq_setup.reconfigure_io_chain = | ||
685 | omap3_prm_reconfigure_io_chain; | ||
686 | else | ||
687 | omap3_prcm_irq_setup.reconfigure_io_chain = | ||
688 | omap3430_pre_es3_1_reconfigure_io_chain; | ||
689 | |||
659 | omap3xxx_prm_enable_io_wakeup(); | 690 | omap3xxx_prm_enable_io_wakeup(); |
660 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); | 691 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); |
661 | if (!ret) | 692 | if (!ret) |
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h index 01ca8086fb6c..4376f59626d1 100644 --- a/arch/arm/mach-omap2/soc.h +++ b/arch/arm/mach-omap2/soc.h | |||
@@ -245,6 +245,8 @@ IS_AM_SUBCLASS(437x, 0x437) | |||
245 | #define soc_is_omap54xx() 0 | 245 | #define soc_is_omap54xx() 0 |
246 | #define soc_is_omap543x() 0 | 246 | #define soc_is_omap543x() 0 |
247 | #define soc_is_dra7xx() 0 | 247 | #define soc_is_dra7xx() 0 |
248 | #define soc_is_dra74x() 0 | ||
249 | #define soc_is_dra72x() 0 | ||
248 | 250 | ||
249 | #if defined(MULTI_OMAP2) | 251 | #if defined(MULTI_OMAP2) |
250 | # if defined(CONFIG_ARCH_OMAP2) | 252 | # if defined(CONFIG_ARCH_OMAP2) |
@@ -393,7 +395,11 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
393 | 395 | ||
394 | #if defined(CONFIG_SOC_DRA7XX) | 396 | #if defined(CONFIG_SOC_DRA7XX) |
395 | #undef soc_is_dra7xx | 397 | #undef soc_is_dra7xx |
398 | #undef soc_is_dra74x | ||
399 | #undef soc_is_dra72x | ||
396 | #define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) | 400 | #define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) |
401 | #define soc_is_dra74x() (of_machine_is_compatible("ti,dra74")) | ||
402 | #define soc_is_dra72x() (of_machine_is_compatible("ti,dra72")) | ||
397 | #endif | 403 | #endif |
398 | 404 | ||
399 | /* Various silicon revisions for omap2 */ | 405 | /* Various silicon revisions for omap2 */ |
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index 630fa916bbc6..04b013fbc98f 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c | |||
@@ -61,7 +61,7 @@ EXPORT_SYMBOL(get_clock_tick_rate); | |||
61 | /* | 61 | /* |
62 | * For non device-tree builds, keep legacy timer init | 62 | * For non device-tree builds, keep legacy timer init |
63 | */ | 63 | */ |
64 | void pxa_timer_init(void) | 64 | void __init pxa_timer_init(void) |
65 | { | 65 | { |
66 | pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000), | 66 | pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000), |
67 | get_clock_tick_rate()); | 67 | get_clock_tick_rate()); |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index e15dff790dbb..1e6c51c7c2d5 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -75,6 +75,7 @@ config ARCH_SH7372 | |||
75 | select ARM_CPU_SUSPEND if PM || CPU_IDLE | 75 | select ARM_CPU_SUSPEND if PM || CPU_IDLE |
76 | select CPU_V7 | 76 | select CPU_V7 |
77 | select SH_CLK_CPG | 77 | select SH_CLK_CPG |
78 | select SH_INTC | ||
78 | select SYS_SUPPORTS_SH_CMT | 79 | select SYS_SUPPORTS_SH_CMT |
79 | select SYS_SUPPORTS_SH_TMU | 80 | select SYS_SUPPORTS_SH_TMU |
80 | 81 | ||
@@ -85,6 +86,7 @@ config ARCH_SH73A0 | |||
85 | select CPU_V7 | 86 | select CPU_V7 |
86 | select I2C | 87 | select I2C |
87 | select SH_CLK_CPG | 88 | select SH_CLK_CPG |
89 | select SH_INTC | ||
88 | select RENESAS_INTC_IRQPIN | 90 | select RENESAS_INTC_IRQPIN |
89 | select SYS_SUPPORTS_SH_CMT | 91 | select SYS_SUPPORTS_SH_CMT |
90 | select SYS_SUPPORTS_SH_TMU | 92 | select SYS_SUPPORTS_SH_TMU |
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c index 17435c1aa2fe..126ddafad526 100644 --- a/arch/arm/mach-shmobile/clock-r8a7790.c +++ b/arch/arm/mach-shmobile/clock-r8a7790.c | |||
@@ -183,8 +183,8 @@ enum { | |||
183 | 183 | ||
184 | static struct clk div4_clks[DIV4_NR] = { | 184 | static struct clk div4_clks[DIV4_NR] = { |
185 | [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), | 185 | [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), |
186 | [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT), | 186 | [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT), |
187 | [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1de0, CLK_ENABLE_ON_INIT), | 187 | [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1df0, CLK_ENABLE_ON_INIT), |
188 | }; | 188 | }; |
189 | 189 | ||
190 | /* DIV6 clocks */ | 190 | /* DIV6 clocks */ |
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c index 10e193d707f5..453b23129cfa 100644 --- a/arch/arm/mach-shmobile/clock-r8a7791.c +++ b/arch/arm/mach-shmobile/clock-r8a7791.c | |||
@@ -152,7 +152,7 @@ enum { | |||
152 | 152 | ||
153 | static struct clk div4_clks[DIV4_NR] = { | 153 | static struct clk div4_clks[DIV4_NR] = { |
154 | [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), | 154 | [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), |
155 | [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT), | 155 | [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT), |
156 | }; | 156 | }; |
157 | 157 | ||
158 | /* DIV6 clocks */ | 158 | /* DIV6 clocks */ |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index d8c4048b9e33..02a6f45a0b9e 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -644,7 +644,7 @@ static struct clk_lookup lookups[] = { | |||
644 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ | 644 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ |
645 | CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */ | 645 | CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */ |
646 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ | 646 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ |
647 | CLKDEV_DEV_ID("0xe6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */ | 647 | CLKDEV_DEV_ID("e6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */ |
648 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ | 648 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ |
649 | CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */ | 649 | CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */ |
650 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ | 650 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ |
diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c index 2c2754e79cb3..f61158c6ce71 100644 --- a/arch/arm/mach-vexpress/spc.c +++ b/arch/arm/mach-vexpress/spc.c | |||
@@ -426,9 +426,15 @@ static int ve_spc_populate_opps(uint32_t cluster) | |||
426 | 426 | ||
427 | static int ve_init_opp_table(struct device *cpu_dev) | 427 | static int ve_init_opp_table(struct device *cpu_dev) |
428 | { | 428 | { |
429 | int cluster = topology_physical_package_id(cpu_dev->id); | 429 | int cluster; |
430 | int idx, ret = 0, max_opp = info->num_opps[cluster]; | 430 | int idx, ret = 0, max_opp; |
431 | struct ve_spc_opp *opps = info->opps[cluster]; | 431 | struct ve_spc_opp *opps; |
432 | |||
433 | cluster = topology_physical_package_id(cpu_dev->id); | ||
434 | cluster = cluster < 0 ? 0 : cluster; | ||
435 | |||
436 | max_opp = info->num_opps[cluster]; | ||
437 | opps = info->opps[cluster]; | ||
432 | 438 | ||
433 | for (idx = 0; idx < max_opp; idx++, opps++) { | 439 | for (idx = 0; idx < max_opp; idx++, opps++) { |
434 | ret = dev_pm_opp_add(cpu_dev, opps->freq * 1000, opps->u_volt); | 440 | ret = dev_pm_opp_add(cpu_dev, opps->freq * 1000, opps->u_volt); |
@@ -537,6 +543,8 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev) | |||
537 | spc->hw.init = &init; | 543 | spc->hw.init = &init; |
538 | spc->cluster = topology_physical_package_id(cpu_dev->id); | 544 | spc->cluster = topology_physical_package_id(cpu_dev->id); |
539 | 545 | ||
546 | spc->cluster = spc->cluster < 0 ? 0 : spc->cluster; | ||
547 | |||
540 | init.name = dev_name(cpu_dev); | 548 | init.name = dev_name(cpu_dev); |
541 | init.ops = &clk_spc_ops; | 549 | init.ops = &clk_spc_ops; |
542 | init.flags = CLK_IS_ROOT | CLK_GET_RATE_NOCACHE; | 550 | init.flags = CLK_IS_ROOT | CLK_GET_RATE_NOCACHE; |
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S index 3815a8262af0..8c48c5c22a33 100644 --- a/arch/arm/mm/abort-ev6.S +++ b/arch/arm/mm/abort-ev6.S | |||
@@ -17,12 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | .align 5 | 18 | .align 5 |
19 | ENTRY(v6_early_abort) | 19 | ENTRY(v6_early_abort) |
20 | #ifdef CONFIG_CPU_V6 | ||
21 | sub r1, sp, #4 @ Get unused stack location | ||
22 | strex r0, r1, [r1] @ Clear the exclusive monitor | ||
23 | #elif defined(CONFIG_CPU_32v6K) | ||
24 | clrex | ||
25 | #endif | ||
26 | mrc p15, 0, r1, c5, c0, 0 @ get FSR | 20 | mrc p15, 0, r1, c5, c0, 0 @ get FSR |
27 | mrc p15, 0, r0, c6, c0, 0 @ get FAR | 21 | mrc p15, 0, r0, c6, c0, 0 @ get FAR |
28 | /* | 22 | /* |
diff --git a/arch/arm/mm/abort-ev7.S b/arch/arm/mm/abort-ev7.S index 703375277ba6..4812ad054214 100644 --- a/arch/arm/mm/abort-ev7.S +++ b/arch/arm/mm/abort-ev7.S | |||
@@ -13,12 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | .align 5 | 14 | .align 5 |
15 | ENTRY(v7_early_abort) | 15 | ENTRY(v7_early_abort) |
16 | /* | ||
17 | * The effect of data aborts on on the exclusive access monitor are | ||
18 | * UNPREDICTABLE. Do a CLREX to clear the state | ||
19 | */ | ||
20 | clrex | ||
21 | |||
22 | mrc p15, 0, r1, c5, c0, 0 @ get FSR | 16 | mrc p15, 0, r1, c5, c0, 0 @ get FSR |
23 | mrc p15, 0, r0, c6, c0, 0 @ get FAR | 17 | mrc p15, 0, r0, c6, c0, 0 @ get FAR |
24 | 18 | ||
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S index 1a24e9232ec8..b64e67c7f176 100644 --- a/arch/arm/mm/proc-v7-3level.S +++ b/arch/arm/mm/proc-v7-3level.S | |||
@@ -146,7 +146,6 @@ ENDPROC(cpu_v7_set_pte_ext) | |||
146 | mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits | 146 | mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits |
147 | mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits | 147 | mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits |
148 | addls \ttbr1, \ttbr1, #TTBR1_OFFSET | 148 | addls \ttbr1, \ttbr1, #TTBR1_OFFSET |
149 | adcls \tmp, \tmp, #0 | ||
150 | mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1 | 149 | mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1 |
151 | mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits | 150 | mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits |
152 | mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits | 151 | mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 02fc10d2d63b..d055db32ffcb 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -1,3 +1,6 @@ | |||
1 | config ARCH_OMAP | ||
2 | bool | ||
3 | |||
1 | if ARCH_OMAP | 4 | if ARCH_OMAP |
2 | 5 | ||
3 | menu "TI OMAP Common Features" | 6 | menu "TI OMAP Common Features" |
diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile index 12969523414c..1f85bfe6b470 100644 --- a/arch/arm/xen/Makefile +++ b/arch/arm/xen/Makefile | |||
@@ -1 +1 @@ | |||
obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o | obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o mm32.o | ||
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 98544c5f86e9..0e15f011f9c8 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -260,6 +260,12 @@ static int __init xen_guest_init(void) | |||
260 | xen_domain_type = XEN_HVM_DOMAIN; | 260 | xen_domain_type = XEN_HVM_DOMAIN; |
261 | 261 | ||
262 | xen_setup_features(); | 262 | xen_setup_features(); |
263 | |||
264 | if (!xen_feature(XENFEAT_grant_map_identity)) { | ||
265 | pr_warn("Please upgrade your Xen.\n" | ||
266 | "If your platform has any non-coherent DMA devices, they won't work properly.\n"); | ||
267 | } | ||
268 | |||
263 | if (xen_feature(XENFEAT_dom0)) | 269 | if (xen_feature(XENFEAT_dom0)) |
264 | xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; | 270 | xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; |
265 | else | 271 | else |
diff --git a/arch/arm/xen/mm32.c b/arch/arm/xen/mm32.c new file mode 100644 index 000000000000..3b99860fd7ae --- /dev/null +++ b/arch/arm/xen/mm32.c | |||
@@ -0,0 +1,202 @@ | |||
1 | #include <linux/cpu.h> | ||
2 | #include <linux/dma-mapping.h> | ||
3 | #include <linux/gfp.h> | ||
4 | #include <linux/highmem.h> | ||
5 | |||
6 | #include <xen/features.h> | ||
7 | |||
8 | static DEFINE_PER_CPU(unsigned long, xen_mm32_scratch_virt); | ||
9 | static DEFINE_PER_CPU(pte_t *, xen_mm32_scratch_ptep); | ||
10 | |||
11 | static int alloc_xen_mm32_scratch_page(int cpu) | ||
12 | { | ||
13 | struct page *page; | ||
14 | unsigned long virt; | ||
15 | pmd_t *pmdp; | ||
16 | pte_t *ptep; | ||
17 | |||
18 | if (per_cpu(xen_mm32_scratch_ptep, cpu) != NULL) | ||
19 | return 0; | ||
20 | |||
21 | page = alloc_page(GFP_KERNEL); | ||
22 | if (page == NULL) { | ||
23 | pr_warn("Failed to allocate xen_mm32_scratch_page for cpu %d\n", cpu); | ||
24 | return -ENOMEM; | ||
25 | } | ||
26 | |||
27 | virt = (unsigned long)__va(page_to_phys(page)); | ||
28 | pmdp = pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt); | ||
29 | ptep = pte_offset_kernel(pmdp, virt); | ||
30 | |||
31 | per_cpu(xen_mm32_scratch_virt, cpu) = virt; | ||
32 | per_cpu(xen_mm32_scratch_ptep, cpu) = ptep; | ||
33 | |||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static int xen_mm32_cpu_notify(struct notifier_block *self, | ||
38 | unsigned long action, void *hcpu) | ||
39 | { | ||
40 | int cpu = (long)hcpu; | ||
41 | switch (action) { | ||
42 | case CPU_UP_PREPARE: | ||
43 | if (alloc_xen_mm32_scratch_page(cpu)) | ||
44 | return NOTIFY_BAD; | ||
45 | break; | ||
46 | default: | ||
47 | break; | ||
48 | } | ||
49 | return NOTIFY_OK; | ||
50 | } | ||
51 | |||
52 | static struct notifier_block xen_mm32_cpu_notifier = { | ||
53 | .notifier_call = xen_mm32_cpu_notify, | ||
54 | }; | ||
55 | |||
56 | static void* xen_mm32_remap_page(dma_addr_t handle) | ||
57 | { | ||
58 | unsigned long virt = get_cpu_var(xen_mm32_scratch_virt); | ||
59 | pte_t *ptep = __get_cpu_var(xen_mm32_scratch_ptep); | ||
60 | |||
61 | *ptep = pfn_pte(handle >> PAGE_SHIFT, PAGE_KERNEL); | ||
62 | local_flush_tlb_kernel_page(virt); | ||
63 | |||
64 | return (void*)virt; | ||
65 | } | ||
66 | |||
67 | static void xen_mm32_unmap(void *vaddr) | ||
68 | { | ||
69 | put_cpu_var(xen_mm32_scratch_virt); | ||
70 | } | ||
71 | |||
72 | |||
73 | /* functions called by SWIOTLB */ | ||
74 | |||
75 | static void dma_cache_maint(dma_addr_t handle, unsigned long offset, | ||
76 | size_t size, enum dma_data_direction dir, | ||
77 | void (*op)(const void *, size_t, int)) | ||
78 | { | ||
79 | unsigned long pfn; | ||
80 | size_t left = size; | ||
81 | |||
82 | pfn = (handle >> PAGE_SHIFT) + offset / PAGE_SIZE; | ||
83 | offset %= PAGE_SIZE; | ||
84 | |||
85 | do { | ||
86 | size_t len = left; | ||
87 | void *vaddr; | ||
88 | |||
89 | if (!pfn_valid(pfn)) | ||
90 | { | ||
91 | /* Cannot map the page, we don't know its physical address. | ||
92 | * Return and hope for the best */ | ||
93 | if (!xen_feature(XENFEAT_grant_map_identity)) | ||
94 | return; | ||
95 | vaddr = xen_mm32_remap_page(handle) + offset; | ||
96 | op(vaddr, len, dir); | ||
97 | xen_mm32_unmap(vaddr - offset); | ||
98 | } else { | ||
99 | struct page *page = pfn_to_page(pfn); | ||
100 | |||
101 | if (PageHighMem(page)) { | ||
102 | if (len + offset > PAGE_SIZE) | ||
103 | len = PAGE_SIZE - offset; | ||
104 | |||
105 | if (cache_is_vipt_nonaliasing()) { | ||
106 | vaddr = kmap_atomic(page); | ||
107 | op(vaddr + offset, len, dir); | ||
108 | kunmap_atomic(vaddr); | ||
109 | } else { | ||
110 | vaddr = kmap_high_get(page); | ||
111 | if (vaddr) { | ||
112 | op(vaddr + offset, len, dir); | ||
113 | kunmap_high(page); | ||
114 | } | ||
115 | } | ||
116 | } else { | ||
117 | vaddr = page_address(page) + offset; | ||
118 | op(vaddr, len, dir); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | offset = 0; | ||
123 | pfn++; | ||
124 | left -= len; | ||
125 | } while (left); | ||
126 | } | ||
127 | |||
128 | static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle, | ||
129 | size_t size, enum dma_data_direction dir) | ||
130 | { | ||
131 | /* Cannot use __dma_page_dev_to_cpu because we don't have a | ||
132 | * struct page for handle */ | ||
133 | |||
134 | if (dir != DMA_TO_DEVICE) | ||
135 | outer_inv_range(handle, handle + size); | ||
136 | |||
137 | dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, dmac_unmap_area); | ||
138 | } | ||
139 | |||
140 | static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle, | ||
141 | size_t size, enum dma_data_direction dir) | ||
142 | { | ||
143 | |||
144 | dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, dmac_map_area); | ||
145 | |||
146 | if (dir == DMA_FROM_DEVICE) { | ||
147 | outer_inv_range(handle, handle + size); | ||
148 | } else { | ||
149 | outer_clean_range(handle, handle + size); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | ||
154 | size_t size, enum dma_data_direction dir, | ||
155 | struct dma_attrs *attrs) | ||
156 | |||
157 | { | ||
158 | if (!__generic_dma_ops(hwdev)->unmap_page) | ||
159 | return; | ||
160 | if (dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | ||
161 | return; | ||
162 | |||
163 | __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); | ||
164 | } | ||
165 | |||
166 | void xen_dma_sync_single_for_cpu(struct device *hwdev, | ||
167 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
168 | { | ||
169 | if (!__generic_dma_ops(hwdev)->sync_single_for_cpu) | ||
170 | return; | ||
171 | __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); | ||
172 | } | ||
173 | |||
174 | void xen_dma_sync_single_for_device(struct device *hwdev, | ||
175 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
176 | { | ||
177 | if (!__generic_dma_ops(hwdev)->sync_single_for_device) | ||
178 | return; | ||
179 | __xen_dma_page_cpu_to_dev(hwdev, handle, size, dir); | ||
180 | } | ||
181 | |||
182 | int __init xen_mm32_init(void) | ||
183 | { | ||
184 | int cpu; | ||
185 | |||
186 | if (!xen_initial_domain()) | ||
187 | return 0; | ||
188 | |||
189 | register_cpu_notifier(&xen_mm32_cpu_notifier); | ||
190 | get_online_cpus(); | ||
191 | for_each_online_cpu(cpu) { | ||
192 | if (alloc_xen_mm32_scratch_page(cpu)) { | ||
193 | put_online_cpus(); | ||
194 | unregister_cpu_notifier(&xen_mm32_cpu_notifier); | ||
195 | return -ENOMEM; | ||
196 | } | ||
197 | } | ||
198 | put_online_cpus(); | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | arch_initcall(xen_mm32_init); | ||
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c index 97baf4427817..054857776254 100644 --- a/arch/arm/xen/p2m.c +++ b/arch/arm/xen/p2m.c | |||
@@ -21,14 +21,12 @@ struct xen_p2m_entry { | |||
21 | unsigned long pfn; | 21 | unsigned long pfn; |
22 | unsigned long mfn; | 22 | unsigned long mfn; |
23 | unsigned long nr_pages; | 23 | unsigned long nr_pages; |
24 | struct rb_node rbnode_mach; | ||
25 | struct rb_node rbnode_phys; | 24 | struct rb_node rbnode_phys; |
26 | }; | 25 | }; |
27 | 26 | ||
28 | static rwlock_t p2m_lock; | 27 | static rwlock_t p2m_lock; |
29 | struct rb_root phys_to_mach = RB_ROOT; | 28 | struct rb_root phys_to_mach = RB_ROOT; |
30 | EXPORT_SYMBOL_GPL(phys_to_mach); | 29 | EXPORT_SYMBOL_GPL(phys_to_mach); |
31 | static struct rb_root mach_to_phys = RB_ROOT; | ||
32 | 30 | ||
33 | static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) | 31 | static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) |
34 | { | 32 | { |
@@ -41,8 +39,6 @@ static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) | |||
41 | parent = *link; | 39 | parent = *link; |
42 | entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys); | 40 | entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys); |
43 | 41 | ||
44 | if (new->mfn == entry->mfn) | ||
45 | goto err_out; | ||
46 | if (new->pfn == entry->pfn) | 42 | if (new->pfn == entry->pfn) |
47 | goto err_out; | 43 | goto err_out; |
48 | 44 | ||
@@ -88,64 +84,6 @@ unsigned long __pfn_to_mfn(unsigned long pfn) | |||
88 | } | 84 | } |
89 | EXPORT_SYMBOL_GPL(__pfn_to_mfn); | 85 | EXPORT_SYMBOL_GPL(__pfn_to_mfn); |
90 | 86 | ||
91 | static int xen_add_mach_to_phys_entry(struct xen_p2m_entry *new) | ||
92 | { | ||
93 | struct rb_node **link = &mach_to_phys.rb_node; | ||
94 | struct rb_node *parent = NULL; | ||
95 | struct xen_p2m_entry *entry; | ||
96 | int rc = 0; | ||
97 | |||
98 | while (*link) { | ||
99 | parent = *link; | ||
100 | entry = rb_entry(parent, struct xen_p2m_entry, rbnode_mach); | ||
101 | |||
102 | if (new->mfn == entry->mfn) | ||
103 | goto err_out; | ||
104 | if (new->pfn == entry->pfn) | ||
105 | goto err_out; | ||
106 | |||
107 | if (new->mfn < entry->mfn) | ||
108 | link = &(*link)->rb_left; | ||
109 | else | ||
110 | link = &(*link)->rb_right; | ||
111 | } | ||
112 | rb_link_node(&new->rbnode_mach, parent, link); | ||
113 | rb_insert_color(&new->rbnode_mach, &mach_to_phys); | ||
114 | goto out; | ||
115 | |||
116 | err_out: | ||
117 | rc = -EINVAL; | ||
118 | pr_warn("%s: cannot add pfn=%pa -> mfn=%pa: pfn=%pa -> mfn=%pa already exists\n", | ||
119 | __func__, &new->pfn, &new->mfn, &entry->pfn, &entry->mfn); | ||
120 | out: | ||
121 | return rc; | ||
122 | } | ||
123 | |||
124 | unsigned long __mfn_to_pfn(unsigned long mfn) | ||
125 | { | ||
126 | struct rb_node *n = mach_to_phys.rb_node; | ||
127 | struct xen_p2m_entry *entry; | ||
128 | unsigned long irqflags; | ||
129 | |||
130 | read_lock_irqsave(&p2m_lock, irqflags); | ||
131 | while (n) { | ||
132 | entry = rb_entry(n, struct xen_p2m_entry, rbnode_mach); | ||
133 | if (entry->mfn <= mfn && | ||
134 | entry->mfn + entry->nr_pages > mfn) { | ||
135 | read_unlock_irqrestore(&p2m_lock, irqflags); | ||
136 | return entry->pfn + (mfn - entry->mfn); | ||
137 | } | ||
138 | if (mfn < entry->mfn) | ||
139 | n = n->rb_left; | ||
140 | else | ||
141 | n = n->rb_right; | ||
142 | } | ||
143 | read_unlock_irqrestore(&p2m_lock, irqflags); | ||
144 | |||
145 | return INVALID_P2M_ENTRY; | ||
146 | } | ||
147 | EXPORT_SYMBOL_GPL(__mfn_to_pfn); | ||
148 | |||
149 | int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, | 87 | int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, |
150 | struct gnttab_map_grant_ref *kmap_ops, | 88 | struct gnttab_map_grant_ref *kmap_ops, |
151 | struct page **pages, unsigned int count) | 89 | struct page **pages, unsigned int count) |
@@ -192,7 +130,6 @@ bool __set_phys_to_machine_multi(unsigned long pfn, | |||
192 | p2m_entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys); | 130 | p2m_entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys); |
193 | if (p2m_entry->pfn <= pfn && | 131 | if (p2m_entry->pfn <= pfn && |
194 | p2m_entry->pfn + p2m_entry->nr_pages > pfn) { | 132 | p2m_entry->pfn + p2m_entry->nr_pages > pfn) { |
195 | rb_erase(&p2m_entry->rbnode_mach, &mach_to_phys); | ||
196 | rb_erase(&p2m_entry->rbnode_phys, &phys_to_mach); | 133 | rb_erase(&p2m_entry->rbnode_phys, &phys_to_mach); |
197 | write_unlock_irqrestore(&p2m_lock, irqflags); | 134 | write_unlock_irqrestore(&p2m_lock, irqflags); |
198 | kfree(p2m_entry); | 135 | kfree(p2m_entry); |
@@ -217,8 +154,7 @@ bool __set_phys_to_machine_multi(unsigned long pfn, | |||
217 | p2m_entry->mfn = mfn; | 154 | p2m_entry->mfn = mfn; |
218 | 155 | ||
219 | write_lock_irqsave(&p2m_lock, irqflags); | 156 | write_lock_irqsave(&p2m_lock, irqflags); |
220 | if ((rc = xen_add_phys_to_mach_entry(p2m_entry) < 0) || | 157 | if ((rc = xen_add_phys_to_mach_entry(p2m_entry)) < 0) { |
221 | (rc = xen_add_mach_to_phys_entry(p2m_entry) < 0)) { | ||
222 | write_unlock_irqrestore(&p2m_lock, irqflags); | 158 | write_unlock_irqrestore(&p2m_lock, irqflags); |
223 | return false; | 159 | return false; |
224 | } | 160 | } |
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 57833546bf00..2df5e5daeebe 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile | |||
@@ -39,7 +39,7 @@ head-y := arch/arm64/kernel/head.o | |||
39 | 39 | ||
40 | # The byte offset of the kernel image in RAM from the start of RAM. | 40 | # The byte offset of the kernel image in RAM from the start of RAM. |
41 | ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y) | 41 | ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y) |
42 | TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%04x0\n", int(65535 * rand())}') | 42 | TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%03x000\n", int(512 * rand())}') |
43 | else | 43 | else |
44 | TEXT_OFFSET := 0x00080000 | 44 | TEXT_OFFSET := 0x00080000 |
45 | endif | 45 | endif |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 1e52b741d806..d92ef3c54161 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -64,6 +64,8 @@ CONFIG_VIRTIO_BLK=y | |||
64 | CONFIG_BLK_DEV_SD=y | 64 | CONFIG_BLK_DEV_SD=y |
65 | # CONFIG_SCSI_LOWLEVEL is not set | 65 | # CONFIG_SCSI_LOWLEVEL is not set |
66 | CONFIG_ATA=y | 66 | CONFIG_ATA=y |
67 | CONFIG_AHCI_XGENE=y | ||
68 | CONFIG_PHY_XGENE=y | ||
67 | CONFIG_PATA_PLATFORM=y | 69 | CONFIG_PATA_PLATFORM=y |
68 | CONFIG_PATA_OF_PLATFORM=y | 70 | CONFIG_PATA_OF_PLATFORM=y |
69 | CONFIG_NETDEVICES=y | 71 | CONFIG_NETDEVICES=y |
@@ -71,6 +73,7 @@ CONFIG_TUN=y | |||
71 | CONFIG_VIRTIO_NET=y | 73 | CONFIG_VIRTIO_NET=y |
72 | CONFIG_SMC91X=y | 74 | CONFIG_SMC91X=y |
73 | CONFIG_SMSC911X=y | 75 | CONFIG_SMSC911X=y |
76 | CONFIG_NET_XGENE=y | ||
74 | # CONFIG_WLAN is not set | 77 | # CONFIG_WLAN is not set |
75 | CONFIG_INPUT_EVDEV=y | 78 | CONFIG_INPUT_EVDEV=y |
76 | # CONFIG_SERIO_SERPORT is not set | 79 | # CONFIG_SERIO_SERPORT is not set |
diff --git a/arch/arm64/crypto/sha2-ce-glue.c b/arch/arm64/crypto/sha2-ce-glue.c index c294e67d3925..ae67e88c28b9 100644 --- a/arch/arm64/crypto/sha2-ce-glue.c +++ b/arch/arm64/crypto/sha2-ce-glue.c | |||
@@ -150,7 +150,6 @@ static void sha2_finup(struct shash_desc *desc, const u8 *data, | |||
150 | kernel_neon_begin_partial(28); | 150 | kernel_neon_begin_partial(28); |
151 | sha2_ce_transform(blocks, data, sctx->state, NULL, len); | 151 | sha2_ce_transform(blocks, data, sctx->state, NULL, len); |
152 | kernel_neon_end(); | 152 | kernel_neon_end(); |
153 | data += blocks * SHA256_BLOCK_SIZE; | ||
154 | } | 153 | } |
155 | 154 | ||
156 | static int sha224_finup(struct shash_desc *desc, const u8 *data, | 155 | static int sha224_finup(struct shash_desc *desc, const u8 *data, |
diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h index d064047612b1..52b484b6aa1a 100644 --- a/arch/arm64/include/asm/hw_breakpoint.h +++ b/arch/arm64/include/asm/hw_breakpoint.h | |||
@@ -79,7 +79,6 @@ static inline void decode_ctrl_reg(u32 reg, | |||
79 | */ | 79 | */ |
80 | #define ARM_MAX_BRP 16 | 80 | #define ARM_MAX_BRP 16 |
81 | #define ARM_MAX_WRP 16 | 81 | #define ARM_MAX_WRP 16 |
82 | #define ARM_MAX_HBP_SLOTS (ARM_MAX_BRP + ARM_MAX_WRP) | ||
83 | 82 | ||
84 | /* Virtual debug register bases. */ | 83 | /* Virtual debug register bases. */ |
85 | #define AARCH64_DBG_REG_BVR 0 | 84 | #define AARCH64_DBG_REG_BVR 0 |
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 3df21feeabdd..286b1bec547c 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h | |||
@@ -139,7 +139,7 @@ extern struct task_struct *cpu_switch_to(struct task_struct *prev, | |||
139 | ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) | 139 | ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) |
140 | 140 | ||
141 | #define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc) | 141 | #define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc) |
142 | #define KSTK_ESP(tsk) ((unsigned long)task_pt_regs(tsk)->sp) | 142 | #define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk)) |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * Prefetching support | 145 | * Prefetching support |
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index 501000fadb6f..41ed9e13795e 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h | |||
@@ -137,7 +137,7 @@ struct pt_regs { | |||
137 | (!((regs)->pstate & PSR_F_BIT)) | 137 | (!((regs)->pstate & PSR_F_BIT)) |
138 | 138 | ||
139 | #define user_stack_pointer(regs) \ | 139 | #define user_stack_pointer(regs) \ |
140 | (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp) | 140 | (!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp) |
141 | 141 | ||
142 | static inline unsigned long regs_return_value(struct pt_regs *regs) | 142 | static inline unsigned long regs_return_value(struct pt_regs *regs) |
143 | { | 143 | { |
diff --git a/arch/arm64/include/asm/sparsemem.h b/arch/arm64/include/asm/sparsemem.h index 1be62bcb9d47..74a9d301819f 100644 --- a/arch/arm64/include/asm/sparsemem.h +++ b/arch/arm64/include/asm/sparsemem.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #define __ASM_SPARSEMEM_H | 17 | #define __ASM_SPARSEMEM_H |
18 | 18 | ||
19 | #ifdef CONFIG_SPARSEMEM | 19 | #ifdef CONFIG_SPARSEMEM |
20 | #define MAX_PHYSMEM_BITS 40 | 20 | #define MAX_PHYSMEM_BITS 48 |
21 | #define SECTION_SIZE_BITS 30 | 21 | #define SECTION_SIZE_BITS 30 |
22 | #endif | 22 | #endif |
23 | 23 | ||
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 4bc95d27e063..6d2bf419431d 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h | |||
@@ -41,7 +41,7 @@ | |||
41 | #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) | 41 | #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) |
42 | #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) | 42 | #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) |
43 | 43 | ||
44 | #define __NR_compat_syscalls 383 | 44 | #define __NR_compat_syscalls 386 |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #define __ARCH_WANT_SYS_CLONE | 47 | #define __ARCH_WANT_SYS_CLONE |
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index e242600c4046..da1f06b535e3 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h | |||
@@ -787,3 +787,8 @@ __SYSCALL(__NR_sched_setattr, sys_sched_setattr) | |||
787 | __SYSCALL(__NR_sched_getattr, sys_sched_getattr) | 787 | __SYSCALL(__NR_sched_getattr, sys_sched_getattr) |
788 | #define __NR_renameat2 382 | 788 | #define __NR_renameat2 382 |
789 | __SYSCALL(__NR_renameat2, sys_renameat2) | 789 | __SYSCALL(__NR_renameat2, sys_renameat2) |
790 | /* 383 for seccomp */ | ||
791 | #define __NR_getrandom 384 | ||
792 | __SYSCALL(__NR_getrandom, sys_getrandom) | ||
793 | #define __NR_memfd_create 385 | ||
794 | __SYSCALL(__NR_memfd_create, sys_memfd_create) | ||
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index f798f66634af..177169623026 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c | |||
@@ -49,7 +49,7 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info) | |||
49 | 49 | ||
50 | if (l1ip != ICACHE_POLICY_PIPT) | 50 | if (l1ip != ICACHE_POLICY_PIPT) |
51 | set_bit(ICACHEF_ALIASING, &__icache_flags); | 51 | set_bit(ICACHEF_ALIASING, &__icache_flags); |
52 | if (l1ip == ICACHE_POLICY_AIVIVT); | 52 | if (l1ip == ICACHE_POLICY_AIVIVT) |
53 | set_bit(ICACHEF_AIVIVT, &__icache_flags); | 53 | set_bit(ICACHEF_AIVIVT, &__icache_flags); |
54 | 54 | ||
55 | pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu); | 55 | pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu); |
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index e72f3100958f..03aaa99e1ea0 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c | |||
@@ -188,6 +188,8 @@ static __init void reserve_regions(void) | |||
188 | if (uefi_debug) | 188 | if (uefi_debug) |
189 | pr_cont("\n"); | 189 | pr_cont("\n"); |
190 | } | 190 | } |
191 | |||
192 | set_bit(EFI_MEMMAP, &efi.flags); | ||
191 | } | 193 | } |
192 | 194 | ||
193 | 195 | ||
@@ -463,6 +465,8 @@ static int __init arm64_enter_virtual_mode(void) | |||
463 | efi_native_runtime_setup(); | 465 | efi_native_runtime_setup(); |
464 | set_bit(EFI_RUNTIME_SERVICES, &efi.flags); | 466 | set_bit(EFI_RUNTIME_SERVICES, &efi.flags); |
465 | 467 | ||
468 | efi.runtime_version = efi.systab->hdr.revision; | ||
469 | |||
466 | return 0; | 470 | return 0; |
467 | 471 | ||
468 | err_unmap: | 472 | err_unmap: |
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index ad8aebb1cdef..3dca15634e69 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c | |||
@@ -270,6 +270,7 @@ static int fpsimd_cpu_pm_notifier(struct notifier_block *self, | |||
270 | case CPU_PM_ENTER: | 270 | case CPU_PM_ENTER: |
271 | if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE)) | 271 | if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE)) |
272 | fpsimd_save_state(¤t->thread.fpsimd_state); | 272 | fpsimd_save_state(¤t->thread.fpsimd_state); |
273 | this_cpu_write(fpsimd_last_state, NULL); | ||
273 | break; | 274 | break; |
274 | case CPU_PM_EXIT: | 275 | case CPU_PM_EXIT: |
275 | if (current->mm) | 276 | if (current->mm) |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 144f10567f82..873069056229 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
@@ -38,11 +38,11 @@ | |||
38 | 38 | ||
39 | #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) | 39 | #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) |
40 | 40 | ||
41 | #if (TEXT_OFFSET & 0xf) != 0 | 41 | #if (TEXT_OFFSET & 0xfff) != 0 |
42 | #error TEXT_OFFSET must be at least 16B aligned | 42 | #error TEXT_OFFSET must be at least 4KB aligned |
43 | #elif (PAGE_OFFSET & 0xfffff) != 0 | 43 | #elif (PAGE_OFFSET & 0x1fffff) != 0 |
44 | #error PAGE_OFFSET must be at least 2MB aligned | 44 | #error PAGE_OFFSET must be at least 2MB aligned |
45 | #elif TEXT_OFFSET > 0xfffff | 45 | #elif TEXT_OFFSET > 0x1fffff |
46 | #error TEXT_OFFSET must be less than 2MB | 46 | #error TEXT_OFFSET must be less than 2MB |
47 | #endif | 47 | #endif |
48 | 48 | ||
@@ -373,10 +373,6 @@ ENTRY(__boot_cpu_mode) | |||
373 | .long 0 | 373 | .long 0 |
374 | .popsection | 374 | .popsection |
375 | 375 | ||
376 | .align 3 | ||
377 | 2: .quad . | ||
378 | .quad PAGE_OFFSET | ||
379 | |||
380 | #ifdef CONFIG_SMP | 376 | #ifdef CONFIG_SMP |
381 | .align 3 | 377 | .align 3 |
382 | 1: .quad . | 378 | 1: .quad . |
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c index 0f08dfd69ebc..dfa6e3e74fdd 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c | |||
@@ -97,19 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc) | |||
97 | if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) | 97 | if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) |
98 | return false; | 98 | return false; |
99 | 99 | ||
100 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) | 100 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { |
101 | affinity = cpu_online_mask; | ||
101 | ret = true; | 102 | ret = true; |
103 | } | ||
102 | 104 | ||
103 | /* | ||
104 | * when using forced irq_set_affinity we must ensure that the cpu | ||
105 | * being offlined is not present in the affinity mask, it may be | ||
106 | * selected as the target CPU otherwise | ||
107 | */ | ||
108 | affinity = cpu_online_mask; | ||
109 | c = irq_data_get_irq_chip(d); | 105 | c = irq_data_get_irq_chip(d); |
110 | if (!c->irq_set_affinity) | 106 | if (!c->irq_set_affinity) |
111 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | 107 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
112 | else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) | 108 | else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) |
113 | cpumask_copy(d->affinity, affinity); | 109 | cpumask_copy(d->affinity, affinity); |
114 | 110 | ||
115 | return ret; | 111 | return ret; |
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c index 422ebd63b619..6762ad705587 100644 --- a/arch/arm64/kernel/perf_regs.c +++ b/arch/arm64/kernel/perf_regs.c | |||
@@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) | |||
24 | return regs->compat_lr; | 24 | return regs->compat_lr; |
25 | } | 25 | } |
26 | 26 | ||
27 | if ((u32)idx == PERF_REG_ARM64_SP) | ||
28 | return regs->sp; | ||
29 | |||
30 | if ((u32)idx == PERF_REG_ARM64_PC) | ||
31 | return regs->pc; | ||
32 | |||
27 | return regs->regs[idx]; | 33 | return regs->regs[idx]; |
28 | } | 34 | } |
29 | 35 | ||
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 1309d64aa926..29d48690f2ac 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c | |||
@@ -230,9 +230,27 @@ void exit_thread(void) | |||
230 | { | 230 | { |
231 | } | 231 | } |
232 | 232 | ||
233 | static void tls_thread_flush(void) | ||
234 | { | ||
235 | asm ("msr tpidr_el0, xzr"); | ||
236 | |||
237 | if (is_compat_task()) { | ||
238 | current->thread.tp_value = 0; | ||
239 | |||
240 | /* | ||
241 | * We need to ensure ordering between the shadow state and the | ||
242 | * hardware state, so that we don't corrupt the hardware state | ||
243 | * with a stale shadow state during context switch. | ||
244 | */ | ||
245 | barrier(); | ||
246 | asm ("msr tpidrro_el0, xzr"); | ||
247 | } | ||
248 | } | ||
249 | |||
233 | void flush_thread(void) | 250 | void flush_thread(void) |
234 | { | 251 | { |
235 | fpsimd_flush_thread(); | 252 | fpsimd_flush_thread(); |
253 | tls_thread_flush(); | ||
236 | flush_ptrace_hw_breakpoint(current); | 254 | flush_ptrace_hw_breakpoint(current); |
237 | } | 255 | } |
238 | 256 | ||
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 0310811bd77d..fe63ac5e9bf5 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c | |||
@@ -87,7 +87,8 @@ static void ptrace_hbptriggered(struct perf_event *bp, | |||
87 | break; | 87 | break; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | for (i = ARM_MAX_BRP; i < ARM_MAX_HBP_SLOTS && !bp; ++i) { | 90 | |
91 | for (i = 0; i < ARM_MAX_WRP; ++i) { | ||
91 | if (current->thread.debug.hbp_watch[i] == bp) { | 92 | if (current->thread.debug.hbp_watch[i] == bp) { |
92 | info.si_errno = -((i << 1) + 1); | 93 | info.si_errno = -((i << 1) + 1); |
93 | break; | 94 | break; |
@@ -662,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target, | |||
662 | kbuf += sizeof(reg); | 663 | kbuf += sizeof(reg); |
663 | } else { | 664 | } else { |
664 | ret = copy_to_user(ubuf, ®, sizeof(reg)); | 665 | ret = copy_to_user(ubuf, ®, sizeof(reg)); |
665 | if (ret) | 666 | if (ret) { |
667 | ret = -EFAULT; | ||
666 | break; | 668 | break; |
669 | } | ||
667 | 670 | ||
668 | ubuf += sizeof(reg); | 671 | ubuf += sizeof(reg); |
669 | } | 672 | } |
@@ -701,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target, | |||
701 | kbuf += sizeof(reg); | 704 | kbuf += sizeof(reg); |
702 | } else { | 705 | } else { |
703 | ret = copy_from_user(®, ubuf, sizeof(reg)); | 706 | ret = copy_from_user(®, ubuf, sizeof(reg)); |
704 | if (ret) | 707 | if (ret) { |
705 | return ret; | 708 | ret = -EFAULT; |
709 | break; | ||
710 | } | ||
706 | 711 | ||
707 | ubuf += sizeof(reg); | 712 | ubuf += sizeof(reg); |
708 | } | 713 | } |
@@ -1115,19 +1120,15 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs) | |||
1115 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 1120 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
1116 | trace_sys_enter(regs, regs->syscallno); | 1121 | trace_sys_enter(regs, regs->syscallno); |
1117 | 1122 | ||
1118 | #ifdef CONFIG_AUDITSYSCALL | ||
1119 | audit_syscall_entry(syscall_get_arch(), regs->syscallno, | 1123 | audit_syscall_entry(syscall_get_arch(), regs->syscallno, |
1120 | regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]); | 1124 | regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]); |
1121 | #endif | ||
1122 | 1125 | ||
1123 | return regs->syscallno; | 1126 | return regs->syscallno; |
1124 | } | 1127 | } |
1125 | 1128 | ||
1126 | asmlinkage void syscall_trace_exit(struct pt_regs *regs) | 1129 | asmlinkage void syscall_trace_exit(struct pt_regs *regs) |
1127 | { | 1130 | { |
1128 | #ifdef CONFIG_AUDITSYSCALL | ||
1129 | audit_syscall_exit(regs); | 1131 | audit_syscall_exit(regs); |
1130 | #endif | ||
1131 | 1132 | ||
1132 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 1133 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
1133 | trace_sys_exit(regs, regs_return_value(regs)); | 1134 | trace_sys_exit(regs, regs_return_value(regs)); |
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index f6f0ccf35ae6..edb146d01857 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c | |||
@@ -78,6 +78,7 @@ unsigned int compat_elf_hwcap2 __read_mostly; | |||
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | static const char *cpu_name; | 80 | static const char *cpu_name; |
81 | static const char *machine_name; | ||
81 | phys_addr_t __fdt_pointer __initdata; | 82 | phys_addr_t __fdt_pointer __initdata; |
82 | 83 | ||
83 | /* | 84 | /* |
@@ -309,6 +310,8 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) | |||
309 | while (true) | 310 | while (true) |
310 | cpu_relax(); | 311 | cpu_relax(); |
311 | } | 312 | } |
313 | |||
314 | machine_name = of_flat_dt_get_machine_name(); | ||
312 | } | 315 | } |
313 | 316 | ||
314 | /* | 317 | /* |
@@ -447,21 +450,10 @@ static int c_show(struct seq_file *m, void *v) | |||
447 | { | 450 | { |
448 | int i; | 451 | int i; |
449 | 452 | ||
450 | /* | 453 | seq_printf(m, "Processor\t: %s rev %d (%s)\n", |
451 | * Dump out the common processor features in a single line. Userspace | 454 | cpu_name, read_cpuid_id() & 15, ELF_PLATFORM); |
452 | * should read the hwcaps with getauxval(AT_HWCAP) rather than | ||
453 | * attempting to parse this. | ||
454 | */ | ||
455 | seq_puts(m, "features\t:"); | ||
456 | for (i = 0; hwcap_str[i]; i++) | ||
457 | if (elf_hwcap & (1 << i)) | ||
458 | seq_printf(m, " %s", hwcap_str[i]); | ||
459 | seq_puts(m, "\n\n"); | ||
460 | 455 | ||
461 | for_each_online_cpu(i) { | 456 | for_each_online_cpu(i) { |
462 | struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i); | ||
463 | u32 midr = cpuinfo->reg_midr; | ||
464 | |||
465 | /* | 457 | /* |
466 | * glibc reads /proc/cpuinfo to determine the number of | 458 | * glibc reads /proc/cpuinfo to determine the number of |
467 | * online processors, looking for lines beginning with | 459 | * online processors, looking for lines beginning with |
@@ -470,13 +462,25 @@ static int c_show(struct seq_file *m, void *v) | |||
470 | #ifdef CONFIG_SMP | 462 | #ifdef CONFIG_SMP |
471 | seq_printf(m, "processor\t: %d\n", i); | 463 | seq_printf(m, "processor\t: %d\n", i); |
472 | #endif | 464 | #endif |
473 | seq_printf(m, "implementer\t: 0x%02x\n", | ||
474 | MIDR_IMPLEMENTOR(midr)); | ||
475 | seq_printf(m, "variant\t\t: 0x%x\n", MIDR_VARIANT(midr)); | ||
476 | seq_printf(m, "partnum\t\t: 0x%03x\n", MIDR_PARTNUM(midr)); | ||
477 | seq_printf(m, "revision\t: 0x%x\n\n", MIDR_REVISION(midr)); | ||
478 | } | 465 | } |
479 | 466 | ||
467 | /* dump out the processor features */ | ||
468 | seq_puts(m, "Features\t: "); | ||
469 | |||
470 | for (i = 0; hwcap_str[i]; i++) | ||
471 | if (elf_hwcap & (1 << i)) | ||
472 | seq_printf(m, "%s ", hwcap_str[i]); | ||
473 | |||
474 | seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24); | ||
475 | seq_printf(m, "CPU architecture: AArch64\n"); | ||
476 | seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15); | ||
477 | seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff); | ||
478 | seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15); | ||
479 | |||
480 | seq_puts(m, "\n"); | ||
481 | |||
482 | seq_printf(m, "Hardware\t: %s\n", machine_name); | ||
483 | |||
480 | return 0; | 484 | return 0; |
481 | } | 485 | } |
482 | 486 | ||
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index de2b0226e06d..dc47e53e9e28 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c | |||
@@ -79,6 +79,12 @@ long compat_arm_syscall(struct pt_regs *regs) | |||
79 | 79 | ||
80 | case __ARM_NR_compat_set_tls: | 80 | case __ARM_NR_compat_set_tls: |
81 | current->thread.tp_value = regs->regs[0]; | 81 | current->thread.tp_value = regs->regs[0]; |
82 | |||
83 | /* | ||
84 | * Protect against register corruption from context switch. | ||
85 | * See comment in tls_thread_flush. | ||
86 | */ | ||
87 | barrier(); | ||
82 | asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0])); | 88 | asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0])); |
83 | return 0; | 89 | return 0; |
84 | 90 | ||
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index e28be510380c..34b8bd0711e9 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c | |||
@@ -66,6 +66,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
66 | else | 66 | else |
67 | kvm_vcpu_block(vcpu); | 67 | kvm_vcpu_block(vcpu); |
68 | 68 | ||
69 | kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | ||
70 | |||
69 | return 1; | 71 | return 1; |
70 | } | 72 | } |
71 | 73 | ||
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index d968796f4b2d..c3191168a994 100644 --- a/arch/arm64/kvm/hyp-init.S +++ b/arch/arm64/kvm/hyp-init.S | |||
@@ -80,6 +80,10 @@ __do_hyp_init: | |||
80 | msr mair_el2, x4 | 80 | msr mair_el2, x4 |
81 | isb | 81 | isb |
82 | 82 | ||
83 | /* Invalidate the stale TLBs from Bootloader */ | ||
84 | tlbi alle2 | ||
85 | dsb sy | ||
86 | |||
83 | mrs x4, sctlr_el2 | 87 | mrs x4, sctlr_el2 |
84 | and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2 | 88 | and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2 |
85 | ldr x5, =SCTLR_EL2_FLAGS | 89 | ldr x5, =SCTLR_EL2_FLAGS |
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 5b4526ee3a01..a83061f37e43 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/of_fdt.h> | 32 | #include <linux/of_fdt.h> |
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/dma-contiguous.h> | 34 | #include <linux/dma-contiguous.h> |
35 | #include <linux/efi.h> | ||
35 | 36 | ||
36 | #include <asm/fixmap.h> | 37 | #include <asm/fixmap.h> |
37 | #include <asm/sections.h> | 38 | #include <asm/sections.h> |
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h index a34f309e5801..6554e78893f2 100644 --- a/arch/frv/include/asm/processor.h +++ b/arch/frv/include/asm/processor.h | |||
@@ -129,7 +129,8 @@ unsigned long get_wchan(struct task_struct *p); | |||
129 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) | 129 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) |
130 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) | 130 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) |
131 | 131 | ||
132 | #define cpu_relax() barrier() | 132 | #define cpu_relax() barrier() |
133 | #define cpu_relax_lowlatency() cpu_relax() | ||
133 | 134 | ||
134 | /* data cache prefetch */ | 135 | /* data cache prefetch */ |
135 | #define ARCH_HAS_PREFETCH | 136 | #define ARCH_HAS_PREFETCH |
diff --git a/arch/hexagon/mm/cache.c b/arch/hexagon/mm/cache.c index fe14ccf28561..0c76c802e31c 100644 --- a/arch/hexagon/mm/cache.c +++ b/arch/hexagon/mm/cache.c | |||
@@ -68,6 +68,7 @@ void flush_icache_range(unsigned long start, unsigned long end) | |||
68 | ); | 68 | ); |
69 | local_irq_restore(flags); | 69 | local_irq_restore(flags); |
70 | } | 70 | } |
71 | EXPORT_SYMBOL(flush_icache_range); | ||
71 | 72 | ||
72 | void hexagon_clean_dcache_range(unsigned long start, unsigned long end) | 73 | void hexagon_clean_dcache_range(unsigned long start, unsigned long end) |
73 | { | 74 | { |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 64aefb76bd69..c84c88bbbbd7 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -549,8 +549,6 @@ source "drivers/sn/Kconfig" | |||
549 | config KEXEC | 549 | config KEXEC |
550 | bool "kexec system call" | 550 | bool "kexec system call" |
551 | depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU) | 551 | depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU) |
552 | select CRYPTO | ||
553 | select CRYPTO_SHA256 | ||
554 | help | 552 | help |
555 | kexec is a system call that implements the ability to shutdown your | 553 | kexec is a system call that implements the ability to shutdown your |
556 | current kernel, and to start another kernel. It is like a reboot | 554 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig index 4c4ac163c600..b6bda1838629 100644 --- a/arch/ia64/configs/bigsur_defconfig +++ b/arch/ia64/configs/bigsur_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
3 | CONFIG_POSIX_MQUEUE=y | 2 | CONFIG_POSIX_MQUEUE=y |
4 | CONFIG_LOG_BUF_SHIFT=16 | 3 | CONFIG_LOG_BUF_SHIFT=16 |
@@ -6,6 +5,8 @@ CONFIG_PROFILING=y | |||
6 | CONFIG_OPROFILE=y | 5 | CONFIG_OPROFILE=y |
7 | CONFIG_MODULES=y | 6 | CONFIG_MODULES=y |
8 | CONFIG_MODULE_UNLOAD=y | 7 | CONFIG_MODULE_UNLOAD=y |
8 | CONFIG_PARTITION_ADVANCED=y | ||
9 | CONFIG_SGI_PARTITION=y | ||
9 | CONFIG_IA64_DIG=y | 10 | CONFIG_IA64_DIG=y |
10 | CONFIG_SMP=y | 11 | CONFIG_SMP=y |
11 | CONFIG_NR_CPUS=2 | 12 | CONFIG_NR_CPUS=2 |
@@ -51,9 +52,6 @@ CONFIG_DM_MIRROR=m | |||
51 | CONFIG_DM_ZERO=m | 52 | CONFIG_DM_ZERO=m |
52 | CONFIG_NETDEVICES=y | 53 | CONFIG_NETDEVICES=y |
53 | CONFIG_DUMMY=y | 54 | CONFIG_DUMMY=y |
54 | CONFIG_NET_ETHERNET=y | ||
55 | CONFIG_MII=y | ||
56 | CONFIG_NET_PCI=y | ||
57 | CONFIG_INPUT_EVDEV=y | 55 | CONFIG_INPUT_EVDEV=y |
58 | CONFIG_SERIAL_8250=y | 56 | CONFIG_SERIAL_8250=y |
59 | CONFIG_SERIAL_8250_CONSOLE=y | 57 | CONFIG_SERIAL_8250_CONSOLE=y |
@@ -85,7 +83,6 @@ CONFIG_EXT3_FS=y | |||
85 | CONFIG_XFS_FS=y | 83 | CONFIG_XFS_FS=y |
86 | CONFIG_XFS_QUOTA=y | 84 | CONFIG_XFS_QUOTA=y |
87 | CONFIG_XFS_POSIX_ACL=y | 85 | CONFIG_XFS_POSIX_ACL=y |
88 | CONFIG_AUTOFS_FS=m | ||
89 | CONFIG_AUTOFS4_FS=m | 86 | CONFIG_AUTOFS4_FS=m |
90 | CONFIG_ISO9660_FS=m | 87 | CONFIG_ISO9660_FS=m |
91 | CONFIG_JOLIET=y | 88 | CONFIG_JOLIET=y |
@@ -95,17 +92,13 @@ CONFIG_PROC_KCORE=y | |||
95 | CONFIG_TMPFS=y | 92 | CONFIG_TMPFS=y |
96 | CONFIG_HUGETLBFS=y | 93 | CONFIG_HUGETLBFS=y |
97 | CONFIG_NFS_FS=m | 94 | CONFIG_NFS_FS=m |
98 | CONFIG_NFS_V3=y | 95 | CONFIG_NFS_V4=m |
99 | CONFIG_NFS_V4=y | ||
100 | CONFIG_NFSD=m | 96 | CONFIG_NFSD=m |
101 | CONFIG_NFSD_V4=y | 97 | CONFIG_NFSD_V4=y |
102 | CONFIG_CIFS=m | 98 | CONFIG_CIFS=m |
103 | CONFIG_CIFS_STATS=y | 99 | CONFIG_CIFS_STATS=y |
104 | CONFIG_CIFS_XATTR=y | 100 | CONFIG_CIFS_XATTR=y |
105 | CONFIG_CIFS_POSIX=y | 101 | CONFIG_CIFS_POSIX=y |
106 | CONFIG_PARTITION_ADVANCED=y | ||
107 | CONFIG_SGI_PARTITION=y | ||
108 | CONFIG_EFI_PARTITION=y | ||
109 | CONFIG_NLS_CODEPAGE_437=y | 102 | CONFIG_NLS_CODEPAGE_437=y |
110 | CONFIG_NLS_ISO8859_1=y | 103 | CONFIG_NLS_ISO8859_1=y |
111 | CONFIG_NLS_UTF8=m | 104 | CONFIG_NLS_UTF8=m |
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig index e8ed3ae70aae..81f686dee53c 100644 --- a/arch/ia64/configs/generic_defconfig +++ b/arch/ia64/configs/generic_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
3 | CONFIG_POSIX_MQUEUE=y | 2 | CONFIG_POSIX_MQUEUE=y |
4 | CONFIG_IKCONFIG=y | 3 | CONFIG_IKCONFIG=y |
@@ -6,13 +5,13 @@ CONFIG_IKCONFIG_PROC=y | |||
6 | CONFIG_LOG_BUF_SHIFT=20 | 5 | CONFIG_LOG_BUF_SHIFT=20 |
7 | CONFIG_CGROUPS=y | 6 | CONFIG_CGROUPS=y |
8 | CONFIG_CPUSETS=y | 7 | CONFIG_CPUSETS=y |
9 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
10 | CONFIG_BLK_DEV_INITRD=y | 8 | CONFIG_BLK_DEV_INITRD=y |
11 | CONFIG_KALLSYMS_ALL=y | 9 | CONFIG_KALLSYMS_ALL=y |
12 | CONFIG_MODULES=y | 10 | CONFIG_MODULES=y |
13 | CONFIG_MODULE_UNLOAD=y | 11 | CONFIG_MODULE_UNLOAD=y |
14 | CONFIG_MODVERSIONS=y | 12 | CONFIG_MODVERSIONS=y |
15 | # CONFIG_BLK_DEV_BSG is not set | 13 | CONFIG_PARTITION_ADVANCED=y |
14 | CONFIG_SGI_PARTITION=y | ||
16 | CONFIG_MCKINLEY=y | 15 | CONFIG_MCKINLEY=y |
17 | CONFIG_IA64_PAGE_SIZE_64KB=y | 16 | CONFIG_IA64_PAGE_SIZE_64KB=y |
18 | CONFIG_IA64_CYCLONE=y | 17 | CONFIG_IA64_CYCLONE=y |
@@ -29,14 +28,13 @@ CONFIG_ACPI_BUTTON=m | |||
29 | CONFIG_ACPI_FAN=m | 28 | CONFIG_ACPI_FAN=m |
30 | CONFIG_ACPI_DOCK=y | 29 | CONFIG_ACPI_DOCK=y |
31 | CONFIG_ACPI_PROCESSOR=m | 30 | CONFIG_ACPI_PROCESSOR=m |
32 | CONFIG_ACPI_CONTAINER=y | ||
33 | CONFIG_HOTPLUG_PCI=y | 31 | CONFIG_HOTPLUG_PCI=y |
34 | CONFIG_HOTPLUG_PCI_ACPI=y | 32 | CONFIG_HOTPLUG_PCI_ACPI=y |
33 | CONFIG_NET=y | ||
35 | CONFIG_PACKET=y | 34 | CONFIG_PACKET=y |
36 | CONFIG_UNIX=y | 35 | CONFIG_UNIX=y |
37 | CONFIG_INET=y | 36 | CONFIG_INET=y |
38 | CONFIG_IP_MULTICAST=y | 37 | CONFIG_IP_MULTICAST=y |
39 | CONFIG_ARPD=y | ||
40 | CONFIG_SYN_COOKIES=y | 38 | CONFIG_SYN_COOKIES=y |
41 | # CONFIG_IPV6 is not set | 39 | # CONFIG_IPV6 is not set |
42 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 40 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
@@ -82,16 +80,13 @@ CONFIG_FUSION_FC=m | |||
82 | CONFIG_FUSION_SAS=y | 80 | CONFIG_FUSION_SAS=y |
83 | CONFIG_NETDEVICES=y | 81 | CONFIG_NETDEVICES=y |
84 | CONFIG_DUMMY=m | 82 | CONFIG_DUMMY=m |
85 | CONFIG_NET_ETHERNET=y | 83 | CONFIG_NETCONSOLE=y |
84 | CONFIG_TIGON3=y | ||
86 | CONFIG_NET_TULIP=y | 85 | CONFIG_NET_TULIP=y |
87 | CONFIG_TULIP=m | 86 | CONFIG_TULIP=m |
88 | CONFIG_NET_PCI=y | ||
89 | CONFIG_NET_VENDOR_INTEL=y | ||
90 | CONFIG_E100=m | 87 | CONFIG_E100=m |
91 | CONFIG_E1000=y | 88 | CONFIG_E1000=y |
92 | CONFIG_IGB=y | 89 | CONFIG_IGB=y |
93 | CONFIG_TIGON3=y | ||
94 | CONFIG_NETCONSOLE=y | ||
95 | # CONFIG_SERIO_SERPORT is not set | 90 | # CONFIG_SERIO_SERPORT is not set |
96 | CONFIG_GAMEPORT=m | 91 | CONFIG_GAMEPORT=m |
97 | CONFIG_SERIAL_NONSTANDARD=y | 92 | CONFIG_SERIAL_NONSTANDARD=y |
@@ -151,6 +146,7 @@ CONFIG_USB_STORAGE=m | |||
151 | CONFIG_INFINIBAND=m | 146 | CONFIG_INFINIBAND=m |
152 | CONFIG_INFINIBAND_MTHCA=m | 147 | CONFIG_INFINIBAND_MTHCA=m |
153 | CONFIG_INFINIBAND_IPOIB=m | 148 | CONFIG_INFINIBAND_IPOIB=m |
149 | CONFIG_INTEL_IOMMU=y | ||
154 | CONFIG_MSPEC=m | 150 | CONFIG_MSPEC=m |
155 | CONFIG_EXT2_FS=y | 151 | CONFIG_EXT2_FS=y |
156 | CONFIG_EXT2_FS_XATTR=y | 152 | CONFIG_EXT2_FS_XATTR=y |
@@ -164,7 +160,6 @@ CONFIG_REISERFS_FS_XATTR=y | |||
164 | CONFIG_REISERFS_FS_POSIX_ACL=y | 160 | CONFIG_REISERFS_FS_POSIX_ACL=y |
165 | CONFIG_REISERFS_FS_SECURITY=y | 161 | CONFIG_REISERFS_FS_SECURITY=y |
166 | CONFIG_XFS_FS=y | 162 | CONFIG_XFS_FS=y |
167 | CONFIG_AUTOFS_FS=m | ||
168 | CONFIG_AUTOFS4_FS=m | 163 | CONFIG_AUTOFS4_FS=m |
169 | CONFIG_ISO9660_FS=m | 164 | CONFIG_ISO9660_FS=m |
170 | CONFIG_JOLIET=y | 165 | CONFIG_JOLIET=y |
@@ -175,16 +170,10 @@ CONFIG_PROC_KCORE=y | |||
175 | CONFIG_TMPFS=y | 170 | CONFIG_TMPFS=y |
176 | CONFIG_HUGETLBFS=y | 171 | CONFIG_HUGETLBFS=y |
177 | CONFIG_NFS_FS=m | 172 | CONFIG_NFS_FS=m |
178 | CONFIG_NFS_V3=y | 173 | CONFIG_NFS_V4=m |
179 | CONFIG_NFS_V4=y | ||
180 | CONFIG_NFSD=m | 174 | CONFIG_NFSD=m |
181 | CONFIG_NFSD_V4=y | 175 | CONFIG_NFSD_V4=y |
182 | CONFIG_SMB_FS=m | ||
183 | CONFIG_SMB_NLS_DEFAULT=y | ||
184 | CONFIG_CIFS=m | 176 | CONFIG_CIFS=m |
185 | CONFIG_PARTITION_ADVANCED=y | ||
186 | CONFIG_SGI_PARTITION=y | ||
187 | CONFIG_EFI_PARTITION=y | ||
188 | CONFIG_NLS_CODEPAGE_437=y | 177 | CONFIG_NLS_CODEPAGE_437=y |
189 | CONFIG_NLS_CODEPAGE_737=m | 178 | CONFIG_NLS_CODEPAGE_737=m |
190 | CONFIG_NLS_CODEPAGE_775=m | 179 | CONFIG_NLS_CODEPAGE_775=m |
@@ -225,11 +214,7 @@ CONFIG_NLS_UTF8=m | |||
225 | CONFIG_MAGIC_SYSRQ=y | 214 | CONFIG_MAGIC_SYSRQ=y |
226 | CONFIG_DEBUG_KERNEL=y | 215 | CONFIG_DEBUG_KERNEL=y |
227 | CONFIG_DEBUG_MUTEXES=y | 216 | CONFIG_DEBUG_MUTEXES=y |
228 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
229 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
230 | CONFIG_CRYPTO_ECB=m | ||
231 | CONFIG_CRYPTO_PCBC=m | 217 | CONFIG_CRYPTO_PCBC=m |
232 | CONFIG_CRYPTO_MD5=y | 218 | CONFIG_CRYPTO_MD5=y |
233 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | 219 | # CONFIG_CRYPTO_ANSI_CPRNG is not set |
234 | CONFIG_CRC_T10DIF=y | 220 | CONFIG_CRC_T10DIF=y |
235 | CONFIG_INTEL_IOMMU=y | ||
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig index d663efd1e4db..5b4fcdd51457 100644 --- a/arch/ia64/configs/gensparse_defconfig +++ b/arch/ia64/configs/gensparse_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
3 | CONFIG_POSIX_MQUEUE=y | 2 | CONFIG_POSIX_MQUEUE=y |
4 | CONFIG_IKCONFIG=y | 3 | CONFIG_IKCONFIG=y |
@@ -9,6 +8,8 @@ CONFIG_KALLSYMS_ALL=y | |||
9 | CONFIG_MODULES=y | 8 | CONFIG_MODULES=y |
10 | CONFIG_MODULE_UNLOAD=y | 9 | CONFIG_MODULE_UNLOAD=y |
11 | CONFIG_MODVERSIONS=y | 10 | CONFIG_MODVERSIONS=y |
11 | CONFIG_PARTITION_ADVANCED=y | ||
12 | CONFIG_SGI_PARTITION=y | ||
12 | CONFIG_MCKINLEY=y | 13 | CONFIG_MCKINLEY=y |
13 | CONFIG_IA64_CYCLONE=y | 14 | CONFIG_IA64_CYCLONE=y |
14 | CONFIG_SMP=y | 15 | CONFIG_SMP=y |
@@ -24,14 +25,12 @@ CONFIG_BINFMT_MISC=m | |||
24 | CONFIG_ACPI_BUTTON=m | 25 | CONFIG_ACPI_BUTTON=m |
25 | CONFIG_ACPI_FAN=m | 26 | CONFIG_ACPI_FAN=m |
26 | CONFIG_ACPI_PROCESSOR=m | 27 | CONFIG_ACPI_PROCESSOR=m |
27 | CONFIG_ACPI_CONTAINER=m | ||
28 | CONFIG_HOTPLUG_PCI=y | 28 | CONFIG_HOTPLUG_PCI=y |
29 | CONFIG_HOTPLUG_PCI_ACPI=m | 29 | CONFIG_NET=y |
30 | CONFIG_PACKET=y | 30 | CONFIG_PACKET=y |
31 | CONFIG_UNIX=y | 31 | CONFIG_UNIX=y |
32 | CONFIG_INET=y | 32 | CONFIG_INET=y |
33 | CONFIG_IP_MULTICAST=y | 33 | CONFIG_IP_MULTICAST=y |
34 | CONFIG_ARPD=y | ||
35 | CONFIG_SYN_COOKIES=y | 34 | CONFIG_SYN_COOKIES=y |
36 | # CONFIG_IPV6 is not set | 35 | # CONFIG_IPV6 is not set |
37 | CONFIG_BLK_DEV_LOOP=m | 36 | CONFIG_BLK_DEV_LOOP=m |
@@ -71,15 +70,12 @@ CONFIG_FUSION_SPI=y | |||
71 | CONFIG_FUSION_FC=m | 70 | CONFIG_FUSION_FC=m |
72 | CONFIG_NETDEVICES=y | 71 | CONFIG_NETDEVICES=y |
73 | CONFIG_DUMMY=m | 72 | CONFIG_DUMMY=m |
74 | CONFIG_NET_ETHERNET=y | 73 | CONFIG_NETCONSOLE=y |
74 | CONFIG_TIGON3=y | ||
75 | CONFIG_NET_TULIP=y | 75 | CONFIG_NET_TULIP=y |
76 | CONFIG_TULIP=m | 76 | CONFIG_TULIP=m |
77 | CONFIG_NET_PCI=y | ||
78 | CONFIG_NET_VENDOR_INTEL=y | ||
79 | CONFIG_E100=m | 77 | CONFIG_E100=m |
80 | CONFIG_E1000=y | 78 | CONFIG_E1000=y |
81 | CONFIG_TIGON3=y | ||
82 | CONFIG_NETCONSOLE=y | ||
83 | # CONFIG_SERIO_SERPORT is not set | 79 | # CONFIG_SERIO_SERPORT is not set |
84 | CONFIG_GAMEPORT=m | 80 | CONFIG_GAMEPORT=m |
85 | CONFIG_SERIAL_NONSTANDARD=y | 81 | CONFIG_SERIAL_NONSTANDARD=y |
@@ -146,7 +142,6 @@ CONFIG_REISERFS_FS_XATTR=y | |||
146 | CONFIG_REISERFS_FS_POSIX_ACL=y | 142 | CONFIG_REISERFS_FS_POSIX_ACL=y |
147 | CONFIG_REISERFS_FS_SECURITY=y | 143 | CONFIG_REISERFS_FS_SECURITY=y |
148 | CONFIG_XFS_FS=y | 144 | CONFIG_XFS_FS=y |
149 | CONFIG_AUTOFS_FS=y | ||
150 | CONFIG_AUTOFS4_FS=y | 145 | CONFIG_AUTOFS4_FS=y |
151 | CONFIG_ISO9660_FS=m | 146 | CONFIG_ISO9660_FS=m |
152 | CONFIG_JOLIET=y | 147 | CONFIG_JOLIET=y |
@@ -157,16 +152,10 @@ CONFIG_PROC_KCORE=y | |||
157 | CONFIG_TMPFS=y | 152 | CONFIG_TMPFS=y |
158 | CONFIG_HUGETLBFS=y | 153 | CONFIG_HUGETLBFS=y |
159 | CONFIG_NFS_FS=m | 154 | CONFIG_NFS_FS=m |
160 | CONFIG_NFS_V3=y | 155 | CONFIG_NFS_V4=m |
161 | CONFIG_NFS_V4=y | ||
162 | CONFIG_NFSD=m | 156 | CONFIG_NFSD=m |
163 | CONFIG_NFSD_V4=y | 157 | CONFIG_NFSD_V4=y |
164 | CONFIG_SMB_FS=m | ||
165 | CONFIG_SMB_NLS_DEFAULT=y | ||
166 | CONFIG_CIFS=m | 158 | CONFIG_CIFS=m |
167 | CONFIG_PARTITION_ADVANCED=y | ||
168 | CONFIG_SGI_PARTITION=y | ||
169 | CONFIG_EFI_PARTITION=y | ||
170 | CONFIG_NLS_CODEPAGE_437=y | 159 | CONFIG_NLS_CODEPAGE_437=y |
171 | CONFIG_NLS_CODEPAGE_737=m | 160 | CONFIG_NLS_CODEPAGE_737=m |
172 | CONFIG_NLS_CODEPAGE_775=m | 161 | CONFIG_NLS_CODEPAGE_775=m |
diff --git a/arch/ia64/configs/sim_defconfig b/arch/ia64/configs/sim_defconfig index b4548a3e82d5..f0f69fdbddae 100644 --- a/arch/ia64/configs/sim_defconfig +++ b/arch/ia64/configs/sim_defconfig | |||
@@ -1,13 +1,12 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
3 | CONFIG_IKCONFIG=y | 2 | CONFIG_IKCONFIG=y |
4 | CONFIG_IKCONFIG_PROC=y | 3 | CONFIG_IKCONFIG_PROC=y |
5 | CONFIG_LOG_BUF_SHIFT=16 | 4 | CONFIG_LOG_BUF_SHIFT=16 |
6 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
7 | CONFIG_MODULES=y | 5 | CONFIG_MODULES=y |
8 | CONFIG_MODULE_UNLOAD=y | 6 | CONFIG_MODULE_UNLOAD=y |
9 | CONFIG_MODULE_FORCE_UNLOAD=y | 7 | CONFIG_MODULE_FORCE_UNLOAD=y |
10 | CONFIG_MODVERSIONS=y | 8 | CONFIG_MODVERSIONS=y |
9 | CONFIG_PARTITION_ADVANCED=y | ||
11 | CONFIG_IA64_HP_SIM=y | 10 | CONFIG_IA64_HP_SIM=y |
12 | CONFIG_MCKINLEY=y | 11 | CONFIG_MCKINLEY=y |
13 | CONFIG_IA64_PAGE_SIZE_64KB=y | 12 | CONFIG_IA64_PAGE_SIZE_64KB=y |
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y | |||
27 | CONFIG_BLK_DEV_RAM=y | 26 | CONFIG_BLK_DEV_RAM=y |
28 | CONFIG_SCSI=y | 27 | CONFIG_SCSI=y |
29 | CONFIG_BLK_DEV_SD=y | 28 | CONFIG_BLK_DEV_SD=y |
30 | CONFIG_SCSI_MULTI_LUN=y | ||
31 | CONFIG_SCSI_CONSTANTS=y | 29 | CONFIG_SCSI_CONSTANTS=y |
32 | CONFIG_SCSI_LOGGING=y | 30 | CONFIG_SCSI_LOGGING=y |
33 | CONFIG_SCSI_SPI_ATTRS=y | 31 | CONFIG_SCSI_SPI_ATTRS=y |
@@ -49,8 +47,6 @@ CONFIG_HUGETLBFS=y | |||
49 | CONFIG_NFS_FS=y | 47 | CONFIG_NFS_FS=y |
50 | CONFIG_NFSD=y | 48 | CONFIG_NFSD=y |
51 | CONFIG_NFSD_V3=y | 49 | CONFIG_NFSD_V3=y |
52 | CONFIG_PARTITION_ADVANCED=y | 50 | CONFIG_DEBUG_INFO=y |
53 | CONFIG_EFI_PARTITION=y | ||
54 | CONFIG_DEBUG_KERNEL=y | 51 | CONFIG_DEBUG_KERNEL=y |
55 | CONFIG_DEBUG_MUTEXES=y | 52 | CONFIG_DEBUG_MUTEXES=y |
56 | CONFIG_DEBUG_INFO=y | ||
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index c8a3f40e77f6..192ed157c9ce 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
3 | CONFIG_POSIX_MQUEUE=y | 2 | CONFIG_POSIX_MQUEUE=y |
4 | CONFIG_IKCONFIG=y | 3 | CONFIG_IKCONFIG=y |
@@ -11,6 +10,8 @@ CONFIG_MODULE_UNLOAD=y | |||
11 | CONFIG_MODVERSIONS=y | 10 | CONFIG_MODVERSIONS=y |
12 | CONFIG_MODULE_SRCVERSION_ALL=y | 11 | CONFIG_MODULE_SRCVERSION_ALL=y |
13 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
13 | CONFIG_PARTITION_ADVANCED=y | ||
14 | CONFIG_SGI_PARTITION=y | ||
14 | CONFIG_IA64_DIG=y | 15 | CONFIG_IA64_DIG=y |
15 | CONFIG_MCKINLEY=y | 16 | CONFIG_MCKINLEY=y |
16 | CONFIG_IA64_PAGE_SIZE_64KB=y | 17 | CONFIG_IA64_PAGE_SIZE_64KB=y |
@@ -29,14 +30,12 @@ CONFIG_BINFMT_MISC=m | |||
29 | CONFIG_ACPI_BUTTON=m | 30 | CONFIG_ACPI_BUTTON=m |
30 | CONFIG_ACPI_FAN=m | 31 | CONFIG_ACPI_FAN=m |
31 | CONFIG_ACPI_PROCESSOR=m | 32 | CONFIG_ACPI_PROCESSOR=m |
32 | CONFIG_ACPI_CONTAINER=m | ||
33 | CONFIG_HOTPLUG_PCI=y | 33 | CONFIG_HOTPLUG_PCI=y |
34 | CONFIG_HOTPLUG_PCI_ACPI=m | 34 | CONFIG_NET=y |
35 | CONFIG_PACKET=y | 35 | CONFIG_PACKET=y |
36 | CONFIG_UNIX=y | 36 | CONFIG_UNIX=y |
37 | CONFIG_INET=y | 37 | CONFIG_INET=y |
38 | CONFIG_IP_MULTICAST=y | 38 | CONFIG_IP_MULTICAST=y |
39 | CONFIG_ARPD=y | ||
40 | CONFIG_SYN_COOKIES=y | 39 | CONFIG_SYN_COOKIES=y |
41 | # CONFIG_IPV6 is not set | 40 | # CONFIG_IPV6 is not set |
42 | CONFIG_BLK_DEV_LOOP=m | 41 | CONFIG_BLK_DEV_LOOP=m |
@@ -53,6 +52,7 @@ CONFIG_BLK_DEV_SD=y | |||
53 | CONFIG_CHR_DEV_ST=m | 52 | CONFIG_CHR_DEV_ST=m |
54 | CONFIG_BLK_DEV_SR=m | 53 | CONFIG_BLK_DEV_SR=m |
55 | CONFIG_CHR_DEV_SG=m | 54 | CONFIG_CHR_DEV_SG=m |
55 | CONFIG_SCSI_FC_ATTRS=y | ||
56 | CONFIG_SCSI_SYM53C8XX_2=y | 56 | CONFIG_SCSI_SYM53C8XX_2=y |
57 | CONFIG_SCSI_QLOGIC_1280=y | 57 | CONFIG_SCSI_QLOGIC_1280=y |
58 | CONFIG_MD=y | 58 | CONFIG_MD=y |
@@ -72,15 +72,12 @@ CONFIG_FUSION_FC=y | |||
72 | CONFIG_FUSION_CTL=y | 72 | CONFIG_FUSION_CTL=y |
73 | CONFIG_NETDEVICES=y | 73 | CONFIG_NETDEVICES=y |
74 | CONFIG_DUMMY=m | 74 | CONFIG_DUMMY=m |
75 | CONFIG_NET_ETHERNET=y | 75 | CONFIG_NETCONSOLE=y |
76 | CONFIG_TIGON3=y | ||
76 | CONFIG_NET_TULIP=y | 77 | CONFIG_NET_TULIP=y |
77 | CONFIG_TULIP=m | 78 | CONFIG_TULIP=m |
78 | CONFIG_NET_PCI=y | ||
79 | CONFIG_NET_VENDOR_INTEL=y | ||
80 | CONFIG_E100=m | 79 | CONFIG_E100=m |
81 | CONFIG_E1000=y | 80 | CONFIG_E1000=y |
82 | CONFIG_TIGON3=y | ||
83 | CONFIG_NETCONSOLE=y | ||
84 | # CONFIG_SERIO_SERPORT is not set | 81 | # CONFIG_SERIO_SERPORT is not set |
85 | CONFIG_GAMEPORT=m | 82 | CONFIG_GAMEPORT=m |
86 | CONFIG_SERIAL_NONSTANDARD=y | 83 | CONFIG_SERIAL_NONSTANDARD=y |
@@ -118,7 +115,6 @@ CONFIG_REISERFS_FS_XATTR=y | |||
118 | CONFIG_REISERFS_FS_POSIX_ACL=y | 115 | CONFIG_REISERFS_FS_POSIX_ACL=y |
119 | CONFIG_REISERFS_FS_SECURITY=y | 116 | CONFIG_REISERFS_FS_SECURITY=y |
120 | CONFIG_XFS_FS=y | 117 | CONFIG_XFS_FS=y |
121 | CONFIG_AUTOFS_FS=y | ||
122 | CONFIG_AUTOFS4_FS=y | 118 | CONFIG_AUTOFS4_FS=y |
123 | CONFIG_ISO9660_FS=m | 119 | CONFIG_ISO9660_FS=m |
124 | CONFIG_JOLIET=y | 120 | CONFIG_JOLIET=y |
@@ -129,16 +125,10 @@ CONFIG_PROC_KCORE=y | |||
129 | CONFIG_TMPFS=y | 125 | CONFIG_TMPFS=y |
130 | CONFIG_HUGETLBFS=y | 126 | CONFIG_HUGETLBFS=y |
131 | CONFIG_NFS_FS=m | 127 | CONFIG_NFS_FS=m |
132 | CONFIG_NFS_V3=y | 128 | CONFIG_NFS_V4=m |
133 | CONFIG_NFS_V4=y | ||
134 | CONFIG_NFSD=m | 129 | CONFIG_NFSD=m |
135 | CONFIG_NFSD_V4=y | 130 | CONFIG_NFSD_V4=y |
136 | CONFIG_SMB_FS=m | ||
137 | CONFIG_SMB_NLS_DEFAULT=y | ||
138 | CONFIG_CIFS=m | 131 | CONFIG_CIFS=m |
139 | CONFIG_PARTITION_ADVANCED=y | ||
140 | CONFIG_SGI_PARTITION=y | ||
141 | CONFIG_EFI_PARTITION=y | ||
142 | CONFIG_NLS_CODEPAGE_437=y | 132 | CONFIG_NLS_CODEPAGE_437=y |
143 | CONFIG_NLS_CODEPAGE_737=m | 133 | CONFIG_NLS_CODEPAGE_737=m |
144 | CONFIG_NLS_CODEPAGE_775=m | 134 | CONFIG_NLS_CODEPAGE_775=m |
@@ -180,6 +170,5 @@ CONFIG_MAGIC_SYSRQ=y | |||
180 | CONFIG_DEBUG_KERNEL=y | 170 | CONFIG_DEBUG_KERNEL=y |
181 | CONFIG_DEBUG_MUTEXES=y | 171 | CONFIG_DEBUG_MUTEXES=y |
182 | CONFIG_IA64_GRANULE_16MB=y | 172 | CONFIG_IA64_GRANULE_16MB=y |
183 | CONFIG_CRYPTO_ECB=m | ||
184 | CONFIG_CRYPTO_PCBC=m | 173 | CONFIG_CRYPTO_PCBC=m |
185 | CONFIG_CRYPTO_MD5=y | 174 | CONFIG_CRYPTO_MD5=y |
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index 54bc72eda30d..b504c8e2fd52 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig | |||
@@ -1,9 +1,9 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
3 | CONFIG_BSD_PROCESS_ACCT=y | 2 | CONFIG_BSD_PROCESS_ACCT=y |
4 | CONFIG_BLK_DEV_INITRD=y | 3 | CONFIG_BLK_DEV_INITRD=y |
5 | CONFIG_KPROBES=y | 4 | CONFIG_KPROBES=y |
6 | CONFIG_MODULES=y | 5 | CONFIG_MODULES=y |
6 | CONFIG_PARTITION_ADVANCED=y | ||
7 | CONFIG_IA64_HP_ZX1=y | 7 | CONFIG_IA64_HP_ZX1=y |
8 | CONFIG_MCKINLEY=y | 8 | CONFIG_MCKINLEY=y |
9 | CONFIG_SMP=y | 9 | CONFIG_SMP=y |
@@ -18,6 +18,7 @@ CONFIG_EFI_VARS=y | |||
18 | CONFIG_BINFMT_MISC=y | 18 | CONFIG_BINFMT_MISC=y |
19 | CONFIG_HOTPLUG_PCI=y | 19 | CONFIG_HOTPLUG_PCI=y |
20 | CONFIG_HOTPLUG_PCI_ACPI=y | 20 | CONFIG_HOTPLUG_PCI_ACPI=y |
21 | CONFIG_NET=y | ||
21 | CONFIG_PACKET=y | 22 | CONFIG_PACKET=y |
22 | CONFIG_UNIX=y | 23 | CONFIG_UNIX=y |
23 | CONFIG_INET=y | 24 | CONFIG_INET=y |
@@ -37,9 +38,9 @@ CONFIG_CHR_DEV_OSST=y | |||
37 | CONFIG_BLK_DEV_SR=y | 38 | CONFIG_BLK_DEV_SR=y |
38 | CONFIG_BLK_DEV_SR_VENDOR=y | 39 | CONFIG_BLK_DEV_SR_VENDOR=y |
39 | CONFIG_CHR_DEV_SG=y | 40 | CONFIG_CHR_DEV_SG=y |
40 | CONFIG_SCSI_MULTI_LUN=y | ||
41 | CONFIG_SCSI_CONSTANTS=y | 41 | CONFIG_SCSI_CONSTANTS=y |
42 | CONFIG_SCSI_LOGGING=y | 42 | CONFIG_SCSI_LOGGING=y |
43 | CONFIG_SCSI_FC_ATTRS=y | ||
43 | CONFIG_SCSI_SYM53C8XX_2=y | 44 | CONFIG_SCSI_SYM53C8XX_2=y |
44 | CONFIG_SCSI_QLOGIC_1280=y | 45 | CONFIG_SCSI_QLOGIC_1280=y |
45 | CONFIG_FUSION=y | 46 | CONFIG_FUSION=y |
@@ -48,18 +49,15 @@ CONFIG_FUSION_FC=y | |||
48 | CONFIG_FUSION_CTL=m | 49 | CONFIG_FUSION_CTL=m |
49 | CONFIG_NETDEVICES=y | 50 | CONFIG_NETDEVICES=y |
50 | CONFIG_DUMMY=y | 51 | CONFIG_DUMMY=y |
51 | CONFIG_NET_ETHERNET=y | 52 | CONFIG_TIGON3=y |
52 | CONFIG_NET_TULIP=y | 53 | CONFIG_NET_TULIP=y |
53 | CONFIG_TULIP=y | 54 | CONFIG_TULIP=y |
54 | CONFIG_TULIP_MWI=y | 55 | CONFIG_TULIP_MWI=y |
55 | CONFIG_TULIP_MMIO=y | 56 | CONFIG_TULIP_MMIO=y |
56 | CONFIG_TULIP_NAPI=y | 57 | CONFIG_TULIP_NAPI=y |
57 | CONFIG_TULIP_NAPI_HW_MITIGATION=y | 58 | CONFIG_TULIP_NAPI_HW_MITIGATION=y |
58 | CONFIG_NET_PCI=y | ||
59 | CONFIG_NET_VENDOR_INTEL=y | ||
60 | CONFIG_E100=y | 59 | CONFIG_E100=y |
61 | CONFIG_E1000=y | 60 | CONFIG_E1000=y |
62 | CONFIG_TIGON3=y | ||
63 | CONFIG_INPUT_JOYDEV=y | 61 | CONFIG_INPUT_JOYDEV=y |
64 | CONFIG_INPUT_EVDEV=y | 62 | CONFIG_INPUT_EVDEV=y |
65 | # CONFIG_INPUT_KEYBOARD is not set | 63 | # CONFIG_INPUT_KEYBOARD is not set |
@@ -100,7 +98,6 @@ CONFIG_USB_STORAGE=y | |||
100 | CONFIG_EXT2_FS=y | 98 | CONFIG_EXT2_FS=y |
101 | CONFIG_EXT2_FS_XATTR=y | 99 | CONFIG_EXT2_FS_XATTR=y |
102 | CONFIG_EXT3_FS=y | 100 | CONFIG_EXT3_FS=y |
103 | CONFIG_AUTOFS_FS=y | ||
104 | CONFIG_ISO9660_FS=y | 101 | CONFIG_ISO9660_FS=y |
105 | CONFIG_JOLIET=y | 102 | CONFIG_JOLIET=y |
106 | CONFIG_UDF_FS=y | 103 | CONFIG_UDF_FS=y |
@@ -110,12 +107,9 @@ CONFIG_PROC_KCORE=y | |||
110 | CONFIG_TMPFS=y | 107 | CONFIG_TMPFS=y |
111 | CONFIG_HUGETLBFS=y | 108 | CONFIG_HUGETLBFS=y |
112 | CONFIG_NFS_FS=y | 109 | CONFIG_NFS_FS=y |
113 | CONFIG_NFS_V3=y | ||
114 | CONFIG_NFS_V4=y | 110 | CONFIG_NFS_V4=y |
115 | CONFIG_NFSD=y | 111 | CONFIG_NFSD=y |
116 | CONFIG_NFSD_V3=y | 112 | CONFIG_NFSD_V3=y |
117 | CONFIG_PARTITION_ADVANCED=y | ||
118 | CONFIG_EFI_PARTITION=y | ||
119 | CONFIG_NLS_CODEPAGE_437=y | 113 | CONFIG_NLS_CODEPAGE_437=y |
120 | CONFIG_NLS_CODEPAGE_737=y | 114 | CONFIG_NLS_CODEPAGE_737=y |
121 | CONFIG_NLS_CODEPAGE_775=y | 115 | CONFIG_NLS_CODEPAGE_775=y |
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h index 4254f5d3218c..10a14ead70b9 100644 --- a/arch/ia64/include/asm/unistd.h +++ b/arch/ia64/include/asm/unistd.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | 13 | ||
14 | #define NR_syscalls 316 /* length of syscall table */ | 14 | #define NR_syscalls 317 /* length of syscall table */ |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * The following defines stop scripts/checksyscalls.sh from complaining about | 17 | * The following defines stop scripts/checksyscalls.sh from complaining about |
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h index 99801c3be914..18026b2eb582 100644 --- a/arch/ia64/include/uapi/asm/unistd.h +++ b/arch/ia64/include/uapi/asm/unistd.h | |||
@@ -329,5 +329,6 @@ | |||
329 | #define __NR_sched_getattr 1337 | 329 | #define __NR_sched_getattr 1337 |
330 | #define __NR_renameat2 1338 | 330 | #define __NR_renameat2 1338 |
331 | #define __NR_getrandom 1339 | 331 | #define __NR_getrandom 1339 |
332 | #define __NR_memfd_create 1340 | ||
332 | 333 | ||
333 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ | 334 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 4c13837a9269..01edf242eb29 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1777,6 +1777,7 @@ sys_call_table: | |||
1777 | data8 sys_sched_getattr | 1777 | data8 sys_sched_getattr |
1778 | data8 sys_renameat2 | 1778 | data8 sys_renameat2 |
1779 | data8 sys_getrandom | 1779 | data8 sys_getrandom |
1780 | data8 sys_memfd_create // 1340 | ||
1780 | 1781 | ||
1781 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls | 1782 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls |
1782 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ | 1783 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ |
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c index ec73b2cf912a..fc505d58f078 100644 --- a/arch/ia64/pci/fixup.c +++ b/arch/ia64/pci/fixup.c | |||
@@ -38,27 +38,6 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
38 | return; | 38 | return; |
39 | /* Maybe, this machine supports legacy memory map. */ | 39 | /* Maybe, this machine supports legacy memory map. */ |
40 | 40 | ||
41 | if (!vga_default_device()) { | ||
42 | resource_size_t start, end; | ||
43 | int i; | ||
44 | |||
45 | /* Does firmware framebuffer belong to us? */ | ||
46 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
47 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) | ||
48 | continue; | ||
49 | |||
50 | start = pci_resource_start(pdev, i); | ||
51 | end = pci_resource_end(pdev, i); | ||
52 | |||
53 | if (!start || !end) | ||
54 | continue; | ||
55 | |||
56 | if (screen_info.lfb_base >= start && | ||
57 | (screen_info.lfb_base + screen_info.lfb_size) < end) | ||
58 | vga_set_default_device(pdev); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /* Is VGA routed to us? */ | 41 | /* Is VGA routed to us? */ |
63 | bus = pdev->bus; | 42 | bus = pdev->bus; |
64 | while (bus) { | 43 | while (bus) { |
@@ -83,8 +62,7 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
83 | pci_read_config_word(pdev, PCI_COMMAND, &config); | 62 | pci_read_config_word(pdev, PCI_COMMAND, &config); |
84 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { | 63 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { |
85 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; | 64 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; |
86 | dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); | 65 | dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n"); |
87 | vga_set_default_device(pdev); | ||
88 | } | 66 | } |
89 | } | 67 | } |
90 | } | 68 | } |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 3ff8c9a25335..87b7c7581b1d 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -91,8 +91,6 @@ config MMU_SUN3 | |||
91 | config KEXEC | 91 | config KEXEC |
92 | bool "kexec system call" | 92 | bool "kexec system call" |
93 | depends on M68KCLASSIC | 93 | depends on M68KCLASSIC |
94 | select CRYPTO | ||
95 | select CRYPTO_SHA256 | ||
96 | help | 94 | help |
97 | kexec is a system call that implements the ability to shutdown your | 95 | kexec is a system call that implements the ability to shutdown your |
98 | current kernel, and to start another kernel. It is like a reboot | 96 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 1fcdd344c7ad..4ef7a54813e6 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 352 | 7 | #define NR_syscalls 354 |
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 9cd82fbc7817..b419c6b7ac37 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h | |||
@@ -357,5 +357,7 @@ | |||
357 | #define __NR_sched_setattr 349 | 357 | #define __NR_sched_setattr 349 |
358 | #define __NR_sched_getattr 350 | 358 | #define __NR_sched_getattr 350 |
359 | #define __NR_renameat2 351 | 359 | #define __NR_renameat2 351 |
360 | #define __NR_getrandom 352 | ||
361 | #define __NR_memfd_create 353 | ||
360 | 362 | ||
361 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ | 363 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index 501e10212789..05b46c2b08b8 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -372,4 +372,6 @@ ENTRY(sys_call_table) | |||
372 | .long sys_sched_setattr | 372 | .long sys_sched_setattr |
373 | .long sys_sched_getattr /* 350 */ | 373 | .long sys_sched_getattr /* 350 */ |
374 | .long sys_renameat2 | 374 | .long sys_renameat2 |
375 | .long sys_getrandom | ||
376 | .long sys_memfd_create | ||
375 | 377 | ||
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 40e1c1dd0e24..6feded3b0c4c 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -127,7 +127,7 @@ config SECCOMP | |||
127 | 127 | ||
128 | endmenu | 128 | endmenu |
129 | 129 | ||
130 | menu "Advanced setup" | 130 | menu "Kernel features" |
131 | 131 | ||
132 | config ADVANCED_OPTIONS | 132 | config ADVANCED_OPTIONS |
133 | bool "Prompt for advanced kernel configuration options" | 133 | bool "Prompt for advanced kernel configuration options" |
@@ -248,10 +248,10 @@ config MICROBLAZE_64K_PAGES | |||
248 | 248 | ||
249 | endchoice | 249 | endchoice |
250 | 250 | ||
251 | endmenu | ||
252 | |||
253 | source "mm/Kconfig" | 251 | source "mm/Kconfig" |
254 | 252 | ||
253 | endmenu | ||
254 | |||
255 | menu "Executable file formats" | 255 | menu "Executable file formats" |
256 | 256 | ||
257 | source "fs/Kconfig.binfmt" | 257 | source "fs/Kconfig.binfmt" |
diff --git a/arch/microblaze/include/asm/entry.h b/arch/microblaze/include/asm/entry.h index b4a4cb150aa9..596e485ae707 100644 --- a/arch/microblaze/include/asm/entry.h +++ b/arch/microblaze/include/asm/entry.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <asm/percpu.h> | 16 | #include <asm/percpu.h> |
17 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
18 | #include <linux/linkage.h> | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * These are per-cpu variables required in entry.S, among other | 21 | * These are per-cpu variables required in entry.S, among other |
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 0aa005703a0b..59a89a64a865 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -98,13 +98,13 @@ static inline int access_ok(int type, const void __user *addr, | |||
98 | 98 | ||
99 | if ((get_fs().seg < ((unsigned long)addr)) || | 99 | if ((get_fs().seg < ((unsigned long)addr)) || |
100 | (get_fs().seg < ((unsigned long)addr + size - 1))) { | 100 | (get_fs().seg < ((unsigned long)addr + size - 1))) { |
101 | pr_debug("ACCESS fail: %s at 0x%08x (size 0x%x), seg 0x%08x\n", | 101 | pr_devel("ACCESS fail: %s at 0x%08x (size 0x%x), seg 0x%08x\n", |
102 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, | 102 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, |
103 | (u32)get_fs().seg); | 103 | (u32)get_fs().seg); |
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | ok: | 106 | ok: |
107 | pr_debug("ACCESS OK: %s at 0x%08x (size 0x%x), seg 0x%08x\n", | 107 | pr_devel("ACCESS OK: %s at 0x%08x (size 0x%x), seg 0x%08x\n", |
108 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, | 108 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, |
109 | (u32)get_fs().seg); | 109 | (u32)get_fs().seg); |
110 | return 1; | 110 | return 1; |
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index fd56a8f66489..ea4b233647c1 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h | |||
@@ -38,6 +38,6 @@ | |||
38 | 38 | ||
39 | #endif /* __ASSEMBLY__ */ | 39 | #endif /* __ASSEMBLY__ */ |
40 | 40 | ||
41 | #define __NR_syscalls 381 | 41 | #define __NR_syscalls 387 |
42 | 42 | ||
43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ | 43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h index 4e1ddc930a68..1c2380bf8fe6 100644 --- a/arch/microblaze/include/uapi/asm/unistd.h +++ b/arch/microblaze/include/uapi/asm/unistd.h | |||
@@ -399,5 +399,8 @@ | |||
399 | #define __NR_sched_setattr 381 | 399 | #define __NR_sched_setattr 381 |
400 | #define __NR_sched_getattr 382 | 400 | #define __NR_sched_getattr 382 |
401 | #define __NR_renameat2 383 | 401 | #define __NR_renameat2 383 |
402 | #define __NR_seccomp 384 | ||
403 | #define __NR_getrandom 385 | ||
404 | #define __NR_memfd_create 386 | ||
402 | 405 | ||
403 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ | 406 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index 1a23d5d5480c..de59ee1d7010 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -384,3 +384,6 @@ ENTRY(sys_call_table) | |||
384 | .long sys_sched_setattr | 384 | .long sys_sched_setattr |
385 | .long sys_sched_getattr | 385 | .long sys_sched_getattr |
386 | .long sys_renameat2 | 386 | .long sys_renameat2 |
387 | .long sys_seccomp | ||
388 | .long sys_getrandom /* 385 */ | ||
389 | .long sys_memfd_create | ||
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index df51e78a72cc..574c43000699 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -546,6 +546,7 @@ config SGI_IP28 | |||
546 | # select SYS_HAS_EARLY_PRINTK | 546 | # select SYS_HAS_EARLY_PRINTK |
547 | select SYS_SUPPORTS_64BIT_KERNEL | 547 | select SYS_SUPPORTS_64BIT_KERNEL |
548 | select SYS_SUPPORTS_BIG_ENDIAN | 548 | select SYS_SUPPORTS_BIG_ENDIAN |
549 | select MIPS_L1_CACHE_SHIFT_7 | ||
549 | help | 550 | help |
550 | This is the SGI Indigo2 with R10000 processor. To compile a Linux | 551 | This is the SGI Indigo2 with R10000 processor. To compile a Linux |
551 | kernel that runs on these, say Y here. | 552 | kernel that runs on these, say Y here. |
@@ -2029,7 +2030,9 @@ config MIPS_CMP | |||
2029 | bool "MIPS CMP framework support (DEPRECATED)" | 2030 | bool "MIPS CMP framework support (DEPRECATED)" |
2030 | depends on SYS_SUPPORTS_MIPS_CMP | 2031 | depends on SYS_SUPPORTS_MIPS_CMP |
2031 | select MIPS_GIC_IPI | 2032 | select MIPS_GIC_IPI |
2033 | select SMP | ||
2032 | select SYNC_R4K | 2034 | select SYNC_R4K |
2035 | select SYS_SUPPORTS_SMP | ||
2033 | select WEAK_ORDERING | 2036 | select WEAK_ORDERING |
2034 | default n | 2037 | default n |
2035 | help | 2038 | help |
@@ -2396,8 +2399,6 @@ source "kernel/Kconfig.preempt" | |||
2396 | 2399 | ||
2397 | config KEXEC | 2400 | config KEXEC |
2398 | bool "Kexec system call" | 2401 | bool "Kexec system call" |
2399 | select CRYPTO | ||
2400 | select CRYPTO_SHA256 | ||
2401 | help | 2402 | help |
2402 | kexec is a system call that implements the ability to shutdown your | 2403 | kexec is a system call that implements the ability to shutdown your |
2403 | current kernel, and to start another kernel. It is like a reboot | 2404 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 9336509f47ad..bbac51e11179 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -113,7 +113,16 @@ predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ | |||
113 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) | 113 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) |
114 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) | 114 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) |
115 | 115 | ||
116 | cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) | 116 | # For smartmips configurations, there are hundreds of warnings due to ISA overrides |
117 | # in assembly and header files. smartmips is only supported for MIPS32r1 onwards | ||
118 | # and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or | ||
119 | # similar directives in the kernel will spam the build logs with the following warnings: | ||
120 | # Warning: the `smartmips' extension requires MIPS32 revision 1 or greater | ||
121 | # or | ||
122 | # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension | ||
123 | # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has | ||
124 | # been fixed properly. | ||
125 | cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) -Wa,--no-warn | ||
117 | cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips) | 126 | cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips) |
118 | 127 | ||
119 | cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ | 128 | cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ |
diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c index 776188908dfc..8c13675a12e7 100644 --- a/arch/mips/alchemy/devboards/db1200.c +++ b/arch/mips/alchemy/devboards/db1200.c | |||
@@ -847,6 +847,7 @@ int __init db1200_dev_setup(void) | |||
847 | pr_warn("DB1200: cant get I2C close to 50MHz\n"); | 847 | pr_warn("DB1200: cant get I2C close to 50MHz\n"); |
848 | else | 848 | else |
849 | clk_set_rate(c, pfc); | 849 | clk_set_rate(c, pfc); |
850 | clk_prepare_enable(c); | ||
850 | clk_put(c); | 851 | clk_put(c); |
851 | } | 852 | } |
852 | 853 | ||
@@ -922,11 +923,6 @@ int __init db1200_dev_setup(void) | |||
922 | } | 923 | } |
923 | 924 | ||
924 | /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ | 925 | /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ |
925 | c = clk_get(NULL, "psc1_intclk"); | ||
926 | if (!IS_ERR(c)) { | ||
927 | clk_prepare_enable(c); | ||
928 | clk_put(c); | ||
929 | } | ||
930 | __raw_writel(PSC_SEL_CLK_SERCLK, | 926 | __raw_writel(PSC_SEL_CLK_SERCLK, |
931 | (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); | 927 | (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); |
932 | wmb(); | 928 | wmb(); |
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index 2b63e7e7d3d3..ad439c273003 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c | |||
@@ -59,12 +59,21 @@ static void bcm47xx_machine_restart(char *command) | |||
59 | switch (bcm47xx_bus_type) { | 59 | switch (bcm47xx_bus_type) { |
60 | #ifdef CONFIG_BCM47XX_SSB | 60 | #ifdef CONFIG_BCM47XX_SSB |
61 | case BCM47XX_BUS_TYPE_SSB: | 61 | case BCM47XX_BUS_TYPE_SSB: |
62 | ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 3); | 62 | if (bcm47xx_bus.ssb.chip_id == 0x4785) |
63 | write_c0_diag4(1 << 22); | ||
64 | ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1); | ||
65 | if (bcm47xx_bus.ssb.chip_id == 0x4785) { | ||
66 | __asm__ __volatile__( | ||
67 | ".set\tmips3\n\t" | ||
68 | "sync\n\t" | ||
69 | "wait\n\t" | ||
70 | ".set\tmips0"); | ||
71 | } | ||
63 | break; | 72 | break; |
64 | #endif | 73 | #endif |
65 | #ifdef CONFIG_BCM47XX_BCMA | 74 | #ifdef CONFIG_BCM47XX_BCMA |
66 | case BCM47XX_BUS_TYPE_BCMA: | 75 | case BCM47XX_BUS_TYPE_BCMA: |
67 | bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 3); | 76 | bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1); |
68 | break; | 77 | break; |
69 | #endif | 78 | #endif |
70 | } | 79 | } |
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c index 37eb2d1fa69a..b94bf44d8d8e 100644 --- a/arch/mips/bcm63xx/irq.c +++ b/arch/mips/bcm63xx/irq.c | |||
@@ -434,7 +434,7 @@ static void bcm63xx_init_irq(void) | |||
434 | irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; | 434 | irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; |
435 | irq_mask_addr[0] += PERF_IRQMASK_3368_REG; | 435 | irq_mask_addr[0] += PERF_IRQMASK_3368_REG; |
436 | irq_stat_addr[1] = 0; | 436 | irq_stat_addr[1] = 0; |
437 | irq_stat_addr[1] = 0; | 437 | irq_mask_addr[1] = 0; |
438 | irq_bits = 32; | 438 | irq_bits = 32; |
439 | ext_irq_count = 4; | 439 | ext_irq_count = 4; |
440 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; | 440 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; |
@@ -443,7 +443,7 @@ static void bcm63xx_init_irq(void) | |||
443 | irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); | 443 | irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); |
444 | irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); | 444 | irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); |
445 | irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); | 445 | irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); |
446 | irq_stat_addr[1] += PERF_IRQMASK_6328_REG(1); | 446 | irq_mask_addr[1] += PERF_IRQMASK_6328_REG(1); |
447 | irq_bits = 64; | 447 | irq_bits = 64; |
448 | ext_irq_count = 4; | 448 | ext_irq_count = 4; |
449 | is_ext_irq_cascaded = 1; | 449 | is_ext_irq_cascaded = 1; |
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c index b49c7adbfa89..31903cf9709d 100644 --- a/arch/mips/boot/compressed/decompress.c +++ b/arch/mips/boot/compressed/decompress.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/string.h> | ||
16 | 17 | ||
17 | #include <asm/addrspace.h> | 18 | #include <asm/addrspace.h> |
18 | 19 | ||
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index 008e9c8b8eac..38f4c32e2816 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
@@ -263,7 +263,6 @@ static uint64_t crashk_size, crashk_base; | |||
263 | static int octeon_uart; | 263 | static int octeon_uart; |
264 | 264 | ||
265 | extern asmlinkage void handle_int(void); | 265 | extern asmlinkage void handle_int(void); |
266 | extern asmlinkage void plat_irq_dispatch(void); | ||
267 | 266 | ||
268 | /** | 267 | /** |
269 | * Return non zero if we are currently running in the Octeon simulator | 268 | * Return non zero if we are currently running in the Octeon simulator |
@@ -458,6 +457,18 @@ static void octeon_halt(void) | |||
458 | octeon_kill_core(NULL); | 457 | octeon_kill_core(NULL); |
459 | } | 458 | } |
460 | 459 | ||
460 | static char __read_mostly octeon_system_type[80]; | ||
461 | |||
462 | static int __init init_octeon_system_type(void) | ||
463 | { | ||
464 | snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)", | ||
465 | cvmx_board_type_to_string(octeon_bootinfo->board_type), | ||
466 | octeon_model_get_string(read_c0_prid())); | ||
467 | |||
468 | return 0; | ||
469 | } | ||
470 | early_initcall(init_octeon_system_type); | ||
471 | |||
461 | /** | 472 | /** |
462 | * Return a string representing the system type | 473 | * Return a string representing the system type |
463 | * | 474 | * |
@@ -465,11 +476,7 @@ static void octeon_halt(void) | |||
465 | */ | 476 | */ |
466 | const char *octeon_board_type_string(void) | 477 | const char *octeon_board_type_string(void) |
467 | { | 478 | { |
468 | static char name[80]; | 479 | return octeon_system_type; |
469 | sprintf(name, "%s (%s)", | ||
470 | cvmx_board_type_to_string(octeon_bootinfo->board_type), | ||
471 | octeon_model_get_string(read_c0_prid())); | ||
472 | return name; | ||
473 | } | 480 | } |
474 | 481 | ||
475 | const char *get_system_type(void) | 482 | const char *get_system_type(void) |
diff --git a/arch/mips/configs/gpr_defconfig b/arch/mips/configs/gpr_defconfig index 8f219dac9598..e24feb0633aa 100644 --- a/arch/mips/configs/gpr_defconfig +++ b/arch/mips/configs/gpr_defconfig | |||
@@ -19,6 +19,7 @@ CONFIG_MODULE_UNLOAD=y | |||
19 | # CONFIG_BLK_DEV_BSG is not set | 19 | # CONFIG_BLK_DEV_BSG is not set |
20 | CONFIG_PCI=y | 20 | CONFIG_PCI=y |
21 | CONFIG_BINFMT_MISC=m | 21 | CONFIG_BINFMT_MISC=m |
22 | CONFIG_NET=y | ||
22 | CONFIG_PACKET=y | 23 | CONFIG_PACKET=y |
23 | CONFIG_UNIX=y | 24 | CONFIG_UNIX=y |
24 | CONFIG_INET=y | 25 | CONFIG_INET=y |
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig index cc0756021398..48e16d98b2cc 100644 --- a/arch/mips/configs/ip27_defconfig +++ b/arch/mips/configs/ip27_defconfig | |||
@@ -28,6 +28,7 @@ CONFIG_MIPS32_COMPAT=y | |||
28 | CONFIG_MIPS32_O32=y | 28 | CONFIG_MIPS32_O32=y |
29 | CONFIG_MIPS32_N32=y | 29 | CONFIG_MIPS32_N32=y |
30 | CONFIG_PM=y | 30 | CONFIG_PM=y |
31 | CONFIG_NET=y | ||
31 | CONFIG_PACKET=y | 32 | CONFIG_PACKET=y |
32 | CONFIG_UNIX=y | 33 | CONFIG_UNIX=y |
33 | CONFIG_XFRM_USER=m | 34 | CONFIG_XFRM_USER=m |
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig index 2575302aa2be..4f37a5985459 100644 --- a/arch/mips/configs/jazz_defconfig +++ b/arch/mips/configs/jazz_defconfig | |||
@@ -18,6 +18,7 @@ CONFIG_MODULE_UNLOAD=y | |||
18 | CONFIG_MODVERSIONS=y | 18 | CONFIG_MODVERSIONS=y |
19 | CONFIG_BINFMT_MISC=m | 19 | CONFIG_BINFMT_MISC=m |
20 | CONFIG_PM=y | 20 | CONFIG_PM=y |
21 | CONFIG_NET=y | ||
21 | CONFIG_PACKET=m | 22 | CONFIG_PACKET=m |
22 | CONFIG_UNIX=y | 23 | CONFIG_UNIX=y |
23 | CONFIG_NET_KEY=m | 24 | CONFIG_NET_KEY=m |
diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig index 4cb787ff273e..1c6191ebd583 100644 --- a/arch/mips/configs/loongson3_defconfig +++ b/arch/mips/configs/loongson3_defconfig | |||
@@ -59,6 +59,7 @@ CONFIG_MIPS32_COMPAT=y | |||
59 | CONFIG_MIPS32_O32=y | 59 | CONFIG_MIPS32_O32=y |
60 | CONFIG_MIPS32_N32=y | 60 | CONFIG_MIPS32_N32=y |
61 | CONFIG_PM_RUNTIME=y | 61 | CONFIG_PM_RUNTIME=y |
62 | CONFIG_NET=y | ||
62 | CONFIG_PACKET=y | 63 | CONFIG_PACKET=y |
63 | CONFIG_UNIX=y | 64 | CONFIG_UNIX=y |
64 | CONFIG_XFRM_USER=y | 65 | CONFIG_XFRM_USER=y |
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig index e18741ea1771..f57b96dcf7df 100644 --- a/arch/mips/configs/malta_defconfig +++ b/arch/mips/configs/malta_defconfig | |||
@@ -19,6 +19,7 @@ CONFIG_MODULE_UNLOAD=y | |||
19 | CONFIG_MODVERSIONS=y | 19 | CONFIG_MODVERSIONS=y |
20 | CONFIG_MODULE_SRCVERSION_ALL=y | 20 | CONFIG_MODULE_SRCVERSION_ALL=y |
21 | CONFIG_PCI=y | 21 | CONFIG_PCI=y |
22 | CONFIG_NET=y | ||
22 | CONFIG_PACKET=y | 23 | CONFIG_PACKET=y |
23 | CONFIG_UNIX=y | 24 | CONFIG_UNIX=y |
24 | CONFIG_XFRM_USER=m | 25 | CONFIG_XFRM_USER=m |
diff --git a/arch/mips/configs/malta_kvm_defconfig b/arch/mips/configs/malta_kvm_defconfig index cf0e01f814e1..d41742dd26c8 100644 --- a/arch/mips/configs/malta_kvm_defconfig +++ b/arch/mips/configs/malta_kvm_defconfig | |||
@@ -20,6 +20,7 @@ CONFIG_MODULE_UNLOAD=y | |||
20 | CONFIG_MODVERSIONS=y | 20 | CONFIG_MODVERSIONS=y |
21 | CONFIG_MODULE_SRCVERSION_ALL=y | 21 | CONFIG_MODULE_SRCVERSION_ALL=y |
22 | CONFIG_PCI=y | 22 | CONFIG_PCI=y |
23 | CONFIG_NET=y | ||
23 | CONFIG_PACKET=y | 24 | CONFIG_PACKET=y |
24 | CONFIG_UNIX=y | 25 | CONFIG_UNIX=y |
25 | CONFIG_XFRM_USER=m | 26 | CONFIG_XFRM_USER=m |
diff --git a/arch/mips/configs/malta_kvm_guest_defconfig b/arch/mips/configs/malta_kvm_guest_defconfig index edd9ec9cb678..a7806e83ea0f 100644 --- a/arch/mips/configs/malta_kvm_guest_defconfig +++ b/arch/mips/configs/malta_kvm_guest_defconfig | |||
@@ -19,6 +19,7 @@ CONFIG_MODULE_UNLOAD=y | |||
19 | CONFIG_MODVERSIONS=y | 19 | CONFIG_MODVERSIONS=y |
20 | CONFIG_MODULE_SRCVERSION_ALL=y | 20 | CONFIG_MODULE_SRCVERSION_ALL=y |
21 | CONFIG_PCI=y | 21 | CONFIG_PCI=y |
22 | CONFIG_NET=y | ||
22 | CONFIG_PACKET=y | 23 | CONFIG_PACKET=y |
23 | CONFIG_UNIX=y | 24 | CONFIG_UNIX=y |
24 | CONFIG_XFRM_USER=m | 25 | CONFIG_XFRM_USER=m |
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig index d269a5326a30..9b6926d6bb32 100644 --- a/arch/mips/configs/mtx1_defconfig +++ b/arch/mips/configs/mtx1_defconfig | |||
@@ -27,6 +27,7 @@ CONFIG_PD6729=m | |||
27 | CONFIG_I82092=m | 27 | CONFIG_I82092=m |
28 | CONFIG_BINFMT_MISC=m | 28 | CONFIG_BINFMT_MISC=m |
29 | CONFIG_PM=y | 29 | CONFIG_PM=y |
30 | CONFIG_NET=y | ||
30 | CONFIG_PACKET=m | 31 | CONFIG_PACKET=m |
31 | CONFIG_UNIX=y | 32 | CONFIG_UNIX=y |
32 | CONFIG_XFRM_USER=m | 33 | CONFIG_XFRM_USER=m |
diff --git a/arch/mips/configs/nlm_xlp_defconfig b/arch/mips/configs/nlm_xlp_defconfig index 2f660e9a0da6..70509a48df82 100644 --- a/arch/mips/configs/nlm_xlp_defconfig +++ b/arch/mips/configs/nlm_xlp_defconfig | |||
@@ -63,6 +63,7 @@ CONFIG_MIPS32_O32=y | |||
63 | CONFIG_MIPS32_N32=y | 63 | CONFIG_MIPS32_N32=y |
64 | CONFIG_PM_RUNTIME=y | 64 | CONFIG_PM_RUNTIME=y |
65 | CONFIG_PM_DEBUG=y | 65 | CONFIG_PM_DEBUG=y |
66 | CONFIG_NET=y | ||
66 | CONFIG_PACKET=y | 67 | CONFIG_PACKET=y |
67 | CONFIG_UNIX=y | 68 | CONFIG_UNIX=y |
68 | CONFIG_XFRM_USER=m | 69 | CONFIG_XFRM_USER=m |
diff --git a/arch/mips/configs/nlm_xlr_defconfig b/arch/mips/configs/nlm_xlr_defconfig index c6f84655c98a..82207e8079f3 100644 --- a/arch/mips/configs/nlm_xlr_defconfig +++ b/arch/mips/configs/nlm_xlr_defconfig | |||
@@ -43,6 +43,7 @@ CONFIG_PCI_DEBUG=y | |||
43 | CONFIG_BINFMT_MISC=m | 43 | CONFIG_BINFMT_MISC=m |
44 | CONFIG_PM_RUNTIME=y | 44 | CONFIG_PM_RUNTIME=y |
45 | CONFIG_PM_DEBUG=y | 45 | CONFIG_PM_DEBUG=y |
46 | CONFIG_NET=y | ||
46 | CONFIG_PACKET=y | 47 | CONFIG_PACKET=y |
47 | CONFIG_UNIX=y | 48 | CONFIG_UNIX=y |
48 | CONFIG_XFRM_USER=m | 49 | CONFIG_XFRM_USER=m |
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig index 29d79ae8a823..db029f4ff759 100644 --- a/arch/mips/configs/rm200_defconfig +++ b/arch/mips/configs/rm200_defconfig | |||
@@ -20,6 +20,7 @@ CONFIG_MODVERSIONS=y | |||
20 | CONFIG_PCI=y | 20 | CONFIG_PCI=y |
21 | CONFIG_BINFMT_MISC=m | 21 | CONFIG_BINFMT_MISC=m |
22 | CONFIG_PM=y | 22 | CONFIG_PM=y |
23 | CONFIG_NET=y | ||
23 | CONFIG_PACKET=m | 24 | CONFIG_PACKET=m |
24 | CONFIG_UNIX=y | 25 | CONFIG_UNIX=y |
25 | CONFIG_NET_KEY=m | 26 | CONFIG_NET_KEY=m |
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h index d0352983b94d..51f80bd36fcc 100644 --- a/arch/mips/include/asm/cop2.h +++ b/arch/mips/include/asm/cop2.h | |||
@@ -16,8 +16,8 @@ | |||
16 | extern void octeon_cop2_save(struct octeon_cop2_state *); | 16 | extern void octeon_cop2_save(struct octeon_cop2_state *); |
17 | extern void octeon_cop2_restore(struct octeon_cop2_state *); | 17 | extern void octeon_cop2_restore(struct octeon_cop2_state *); |
18 | 18 | ||
19 | #define cop2_save(r) octeon_cop2_save(r) | 19 | #define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2) |
20 | #define cop2_restore(r) octeon_cop2_restore(r) | 20 | #define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2) |
21 | 21 | ||
22 | #define cop2_present 1 | 22 | #define cop2_present 1 |
23 | #define cop2_lazy_restore 1 | 23 | #define cop2_lazy_restore 1 |
@@ -26,26 +26,26 @@ extern void octeon_cop2_restore(struct octeon_cop2_state *); | |||
26 | 26 | ||
27 | extern void nlm_cop2_save(struct nlm_cop2_state *); | 27 | extern void nlm_cop2_save(struct nlm_cop2_state *); |
28 | extern void nlm_cop2_restore(struct nlm_cop2_state *); | 28 | extern void nlm_cop2_restore(struct nlm_cop2_state *); |
29 | #define cop2_save(r) nlm_cop2_save(r) | 29 | |
30 | #define cop2_restore(r) nlm_cop2_restore(r) | 30 | #define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2) |
31 | #define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2) | ||
31 | 32 | ||
32 | #define cop2_present 1 | 33 | #define cop2_present 1 |
33 | #define cop2_lazy_restore 0 | 34 | #define cop2_lazy_restore 0 |
34 | 35 | ||
35 | #elif defined(CONFIG_CPU_LOONGSON3) | 36 | #elif defined(CONFIG_CPU_LOONGSON3) |
36 | 37 | ||
37 | #define cop2_save(r) | ||
38 | #define cop2_restore(r) | ||
39 | |||
40 | #define cop2_present 1 | 38 | #define cop2_present 1 |
41 | #define cop2_lazy_restore 1 | 39 | #define cop2_lazy_restore 1 |
40 | #define cop2_save(r) do { (r); } while (0) | ||
41 | #define cop2_restore(r) do { (r); } while (0) | ||
42 | 42 | ||
43 | #else | 43 | #else |
44 | 44 | ||
45 | #define cop2_present 0 | 45 | #define cop2_present 0 |
46 | #define cop2_lazy_restore 0 | 46 | #define cop2_lazy_restore 0 |
47 | #define cop2_save(r) | 47 | #define cop2_save(r) do { (r); } while (0) |
48 | #define cop2_restore(r) | 48 | #define cop2_restore(r) do { (r); } while (0) |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | enum cu2_ops { | 51 | enum cu2_ops { |
diff --git a/arch/mips/include/asm/eva.h b/arch/mips/include/asm/eva.h new file mode 100644 index 000000000000..a3d1807f227c --- /dev/null +++ b/arch/mips/include/asm/eva.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2014, Imagination Technologies Ltd. | ||
7 | * | ||
8 | * EVA functions for generic code | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_EVA_H | ||
12 | #define _ASM_EVA_H | ||
13 | |||
14 | #include <kernel-entry-init.h> | ||
15 | |||
16 | #ifdef __ASSEMBLY__ | ||
17 | |||
18 | #ifdef CONFIG_EVA | ||
19 | |||
20 | /* | ||
21 | * EVA early init code | ||
22 | * | ||
23 | * Platforms must define their own 'platform_eva_init' macro in | ||
24 | * their kernel-entry-init.h header. This macro usually does the | ||
25 | * platform specific configuration of the segmentation registers, | ||
26 | * and it is normally called from assembly code. | ||
27 | * | ||
28 | */ | ||
29 | |||
30 | .macro eva_init | ||
31 | platform_eva_init | ||
32 | .endm | ||
33 | |||
34 | #else | ||
35 | |||
36 | .macro eva_init | ||
37 | .endm | ||
38 | |||
39 | #endif /* CONFIG_EVA */ | ||
40 | |||
41 | #endif /* __ASSEMBLY__ */ | ||
42 | |||
43 | #endif | ||
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h index 3f20b2111d56..d7699cf7e135 100644 --- a/arch/mips/include/asm/gic.h +++ b/arch/mips/include/asm/gic.h | |||
@@ -49,7 +49,7 @@ | |||
49 | #endif | 49 | #endif |
50 | #define GICBIS(reg, mask, bits) \ | 50 | #define GICBIS(reg, mask, bits) \ |
51 | do { u32 data; \ | 51 | do { u32 data; \ |
52 | GICREAD((reg), data); \ | 52 | GICREAD(reg, data); \ |
53 | data &= ~(mask); \ | 53 | data &= ~(mask); \ |
54 | data |= ((bits) & (mask)); \ | 54 | data |= ((bits) & (mask)); \ |
55 | GICWRITE((reg), data); \ | 55 | GICWRITE((reg), data); \ |
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index ae1f7b24dd1a..39f07aec640c 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h | |||
@@ -26,6 +26,8 @@ static inline int irq_canonicalize(int irq) | |||
26 | #define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ | 26 | #define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | asmlinkage void plat_irq_dispatch(void); | ||
30 | |||
29 | extern void do_IRQ(unsigned int irq); | 31 | extern void do_IRQ(unsigned int irq); |
30 | 32 | ||
31 | extern void arch_init_irq(void); | 33 | extern void arch_init_irq(void); |
diff --git a/arch/mips/include/asm/mach-ip28/spaces.h b/arch/mips/include/asm/mach-ip28/spaces.h index 5d6a76434d00..c4a912733b65 100644 --- a/arch/mips/include/asm/mach-ip28/spaces.h +++ b/arch/mips/include/asm/mach-ip28/spaces.h | |||
@@ -11,15 +11,8 @@ | |||
11 | #ifndef _ASM_MACH_IP28_SPACES_H | 11 | #ifndef _ASM_MACH_IP28_SPACES_H |
12 | #define _ASM_MACH_IP28_SPACES_H | 12 | #define _ASM_MACH_IP28_SPACES_H |
13 | 13 | ||
14 | #define CAC_BASE _AC(0xa800000000000000, UL) | ||
15 | |||
16 | #define HIGHMEM_START (~0UL) | ||
17 | |||
18 | #define PHYS_OFFSET _AC(0x20000000, UL) | 14 | #define PHYS_OFFSET _AC(0x20000000, UL) |
19 | 15 | ||
20 | #define UNCAC_BASE _AC(0xc0000000, UL) /* 0xa0000000 + PHYS_OFFSET */ | ||
21 | #define IO_BASE UNCAC_BASE | ||
22 | |||
23 | #include <asm/mach-generic/spaces.h> | 16 | #include <asm/mach-generic/spaces.h> |
24 | 17 | ||
25 | #endif /* _ASM_MACH_IP28_SPACES_H */ | 18 | #endif /* _ASM_MACH_IP28_SPACES_H */ |
diff --git a/arch/mips/include/asm/mach-malta/kernel-entry-init.h b/arch/mips/include/asm/mach-malta/kernel-entry-init.h index 77eeda77e73c..0cf8622db27f 100644 --- a/arch/mips/include/asm/mach-malta/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-malta/kernel-entry-init.h | |||
@@ -10,14 +10,15 @@ | |||
10 | #ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H | 10 | #ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H |
11 | #define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H | 11 | #define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H |
12 | 12 | ||
13 | #include <asm/regdef.h> | ||
14 | #include <asm/mipsregs.h> | ||
15 | |||
13 | /* | 16 | /* |
14 | * Prepare segments for EVA boot: | 17 | * Prepare segments for EVA boot: |
15 | * | 18 | * |
16 | * This is in case the processor boots in legacy configuration | 19 | * This is in case the processor boots in legacy configuration |
17 | * (SI_EVAReset is de-asserted and CONFIG5.K == 0) | 20 | * (SI_EVAReset is de-asserted and CONFIG5.K == 0) |
18 | * | 21 | * |
19 | * On entry, t1 is loaded with CP0_CONFIG | ||
20 | * | ||
21 | * ========================= Mappings ============================= | 22 | * ========================= Mappings ============================= |
22 | * Virtual memory Physical memory Mapping | 23 | * Virtual memory Physical memory Mapping |
23 | * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg) | 24 | * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg) |
@@ -30,12 +31,20 @@ | |||
30 | * | 31 | * |
31 | * | 32 | * |
32 | * Lowmem is expanded to 2GB | 33 | * Lowmem is expanded to 2GB |
34 | * | ||
35 | * The following code uses the t0, t1, t2 and ra registers without | ||
36 | * previously preserving them. | ||
37 | * | ||
33 | */ | 38 | */ |
34 | .macro eva_entry | 39 | .macro platform_eva_init |
40 | |||
41 | .set push | ||
42 | .set reorder | ||
35 | /* | 43 | /* |
36 | * Get Config.K0 value and use it to program | 44 | * Get Config.K0 value and use it to program |
37 | * the segmentation registers | 45 | * the segmentation registers |
38 | */ | 46 | */ |
47 | mfc0 t1, CP0_CONFIG | ||
39 | andi t1, 0x7 /* CCA */ | 48 | andi t1, 0x7 /* CCA */ |
40 | move t2, t1 | 49 | move t2, t1 |
41 | ins t2, t1, 16, 3 | 50 | ins t2, t1, 16, 3 |
@@ -77,6 +86,8 @@ | |||
77 | mtc0 t0, $16, 5 | 86 | mtc0 t0, $16, 5 |
78 | sync | 87 | sync |
79 | jal mips_ihb | 88 | jal mips_ihb |
89 | |||
90 | .set pop | ||
80 | .endm | 91 | .endm |
81 | 92 | ||
82 | .macro kernel_entry_setup | 93 | .macro kernel_entry_setup |
@@ -95,7 +106,7 @@ | |||
95 | sll t0, t0, 6 /* SC bit */ | 106 | sll t0, t0, 6 /* SC bit */ |
96 | bgez t0, 9f | 107 | bgez t0, 9f |
97 | 108 | ||
98 | eva_entry | 109 | platform_eva_init |
99 | b 0f | 110 | b 0f |
100 | 9: | 111 | 9: |
101 | /* Assume we came from YAMON... */ | 112 | /* Assume we came from YAMON... */ |
@@ -127,8 +138,7 @@ nonsc_processor: | |||
127 | #ifdef CONFIG_EVA | 138 | #ifdef CONFIG_EVA |
128 | sync | 139 | sync |
129 | ehb | 140 | ehb |
130 | mfc0 t1, CP0_CONFIG | 141 | platform_eva_init |
131 | eva_entry | ||
132 | #endif | 142 | #endif |
133 | .endm | 143 | .endm |
134 | 144 | ||
diff --git a/arch/mips/include/asm/mach-netlogic/topology.h b/arch/mips/include/asm/mach-netlogic/topology.h index ceeb1f5e7129..0eb43c832b25 100644 --- a/arch/mips/include/asm/mach-netlogic/topology.h +++ b/arch/mips/include/asm/mach-netlogic/topology.h | |||
@@ -10,13 +10,6 @@ | |||
10 | 10 | ||
11 | #include <asm/mach-netlogic/multi-node.h> | 11 | #include <asm/mach-netlogic/multi-node.h> |
12 | 12 | ||
13 | #ifdef CONFIG_SMP | ||
14 | #define topology_physical_package_id(cpu) cpu_to_node(cpu) | ||
15 | #define topology_core_id(cpu) (cpu_logical_map(cpu) / NLM_THREADS_PER_CORE) | ||
16 | #define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) | ||
17 | #define topology_core_cpumask(cpu) cpumask_of_node(cpu_to_node(cpu)) | ||
18 | #endif | ||
19 | |||
20 | #include <asm-generic/topology.h> | 13 | #include <asm-generic/topology.h> |
21 | 14 | ||
22 | #endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */ | 15 | #endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */ |
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 5699ec3a71af..3be81803595d 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | /* | 38 | /* |
39 | * This is used for calculating the real page sizes | 39 | * This is used for calculating the real page sizes |
40 | * for FTLB or VTLB + FTLB confugrations. | 40 | * for FTLB or VTLB + FTLB configurations. |
41 | */ | 41 | */ |
42 | static inline unsigned int page_size_ftlb(unsigned int mmuextdef) | 42 | static inline unsigned int page_size_ftlb(unsigned int mmuextdef) |
43 | { | 43 | { |
@@ -223,7 +223,8 @@ static inline int pfn_valid(unsigned long pfn) | |||
223 | 223 | ||
224 | #endif | 224 | #endif |
225 | 225 | ||
226 | #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) | 226 | #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys((void *) \ |
227 | (kaddr)))) | ||
227 | 228 | ||
228 | extern int __virt_addr_valid(const volatile void *kaddr); | 229 | extern int __virt_addr_valid(const volatile void *kaddr); |
229 | #define virt_addr_valid(kaddr) \ | 230 | #define virt_addr_valid(kaddr) \ |
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 027c74db13f9..df49a308085c 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
@@ -122,6 +122,9 @@ do { \ | |||
122 | } \ | 122 | } \ |
123 | } while(0) | 123 | } while(0) |
124 | 124 | ||
125 | extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, | ||
126 | pte_t pteval); | ||
127 | |||
125 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | 128 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) |
126 | 129 | ||
127 | #define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) | 130 | #define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) |
@@ -145,7 +148,6 @@ static inline void set_pte(pte_t *ptep, pte_t pte) | |||
145 | } | 148 | } |
146 | } | 149 | } |
147 | } | 150 | } |
148 | #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) | ||
149 | 151 | ||
150 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 152 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
151 | { | 153 | { |
@@ -183,7 +185,6 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
183 | } | 185 | } |
184 | #endif | 186 | #endif |
185 | } | 187 | } |
186 | #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) | ||
187 | 188 | ||
188 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 189 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
189 | { | 190 | { |
@@ -390,15 +391,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
390 | 391 | ||
391 | extern void __update_tlb(struct vm_area_struct *vma, unsigned long address, | 392 | extern void __update_tlb(struct vm_area_struct *vma, unsigned long address, |
392 | pte_t pte); | 393 | pte_t pte); |
393 | extern void __update_cache(struct vm_area_struct *vma, unsigned long address, | ||
394 | pte_t pte); | ||
395 | 394 | ||
396 | static inline void update_mmu_cache(struct vm_area_struct *vma, | 395 | static inline void update_mmu_cache(struct vm_area_struct *vma, |
397 | unsigned long address, pte_t *ptep) | 396 | unsigned long address, pte_t *ptep) |
398 | { | 397 | { |
399 | pte_t pte = *ptep; | 398 | pte_t pte = *ptep; |
400 | __update_tlb(vma, address, pte); | 399 | __update_tlb(vma, address, pte); |
401 | __update_cache(vma, address, pte); | ||
402 | } | 400 | } |
403 | 401 | ||
404 | static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, | 402 | static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, |
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 1e0f20a9cdda..eacf865d21c2 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
@@ -37,11 +37,6 @@ extern int __cpu_logical_map[NR_CPUS]; | |||
37 | 37 | ||
38 | #define NO_PROC_ID (-1) | 38 | #define NO_PROC_ID (-1) |
39 | 39 | ||
40 | #define topology_physical_package_id(cpu) (cpu_data[cpu].package) | ||
41 | #define topology_core_id(cpu) (cpu_data[cpu].core) | ||
42 | #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) | ||
43 | #define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) | ||
44 | |||
45 | #define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ | 40 | #define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ |
46 | #define SMP_CALL_FUNCTION 0x2 | 41 | #define SMP_CALL_FUNCTION 0x2 |
47 | /* Octeon - Tell another core to flush its icache */ | 42 | /* Octeon - Tell another core to flush its icache */ |
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h index 495c1041a2cc..b928b6f898cd 100644 --- a/arch/mips/include/asm/switch_to.h +++ b/arch/mips/include/asm/switch_to.h | |||
@@ -92,7 +92,7 @@ do { \ | |||
92 | KSTK_STATUS(prev) &= ~ST0_CU2; \ | 92 | KSTK_STATUS(prev) &= ~ST0_CU2; \ |
93 | __c0_stat = read_c0_status(); \ | 93 | __c0_stat = read_c0_status(); \ |
94 | write_c0_status(__c0_stat | ST0_CU2); \ | 94 | write_c0_status(__c0_stat | ST0_CU2); \ |
95 | cop2_save(&prev->thread.cp2); \ | 95 | cop2_save(prev); \ |
96 | write_c0_status(__c0_stat & ~ST0_CU2); \ | 96 | write_c0_status(__c0_stat & ~ST0_CU2); \ |
97 | } \ | 97 | } \ |
98 | __clear_software_ll_bit(); \ | 98 | __clear_software_ll_bit(); \ |
@@ -111,7 +111,7 @@ do { \ | |||
111 | (KSTK_STATUS(current) & ST0_CU2)) { \ | 111 | (KSTK_STATUS(current) & ST0_CU2)) { \ |
112 | __c0_stat = read_c0_status(); \ | 112 | __c0_stat = read_c0_status(); \ |
113 | write_c0_status(__c0_stat | ST0_CU2); \ | 113 | write_c0_status(__c0_stat | ST0_CU2); \ |
114 | cop2_restore(¤t->thread.cp2); \ | 114 | cop2_restore(current); \ |
115 | write_c0_status(__c0_stat & ~ST0_CU2); \ | 115 | write_c0_status(__c0_stat & ~ST0_CU2); \ |
116 | } \ | 116 | } \ |
117 | if (cpu_has_dsp) \ | 117 | if (cpu_has_dsp) \ |
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h index 17960fe7a8ce..cdf68b33bd65 100644 --- a/arch/mips/include/asm/syscall.h +++ b/arch/mips/include/asm/syscall.h | |||
@@ -131,10 +131,12 @@ static inline int syscall_get_arch(void) | |||
131 | { | 131 | { |
132 | int arch = EM_MIPS; | 132 | int arch = EM_MIPS; |
133 | #ifdef CONFIG_64BIT | 133 | #ifdef CONFIG_64BIT |
134 | if (!test_thread_flag(TIF_32BIT_REGS)) | 134 | if (!test_thread_flag(TIF_32BIT_REGS)) { |
135 | arch |= __AUDIT_ARCH_64BIT; | 135 | arch |= __AUDIT_ARCH_64BIT; |
136 | if (test_thread_flag(TIF_32BIT_ADDR)) | 136 | /* N32 sets only TIF_32BIT_ADDR */ |
137 | arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; | 137 | if (test_thread_flag(TIF_32BIT_ADDR)) |
138 | arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; | ||
139 | } | ||
138 | #endif | 140 | #endif |
139 | #if defined(__LITTLE_ENDIAN) | 141 | #if defined(__LITTLE_ENDIAN) |
140 | arch |= __AUDIT_ARCH_LE; | 142 | arch |= __AUDIT_ARCH_LE; |
diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h index 20ea4859c822..3e307ec2afba 100644 --- a/arch/mips/include/asm/topology.h +++ b/arch/mips/include/asm/topology.h | |||
@@ -9,5 +9,13 @@ | |||
9 | #define __ASM_TOPOLOGY_H | 9 | #define __ASM_TOPOLOGY_H |
10 | 10 | ||
11 | #include <topology.h> | 11 | #include <topology.h> |
12 | #include <linux/smp.h> | ||
13 | |||
14 | #ifdef CONFIG_SMP | ||
15 | #define topology_physical_package_id(cpu) (cpu_data[cpu].package) | ||
16 | #define topology_core_id(cpu) (cpu_data[cpu].core) | ||
17 | #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) | ||
18 | #define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) | ||
19 | #endif | ||
12 | 20 | ||
13 | #endif /* __ASM_TOPOLOGY_H */ | 21 | #endif /* __ASM_TOPOLOGY_H */ |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index 9bc13eaf9d67..fdb4923777d1 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
@@ -373,16 +373,18 @@ | |||
373 | #define __NR_sched_getattr (__NR_Linux + 350) | 373 | #define __NR_sched_getattr (__NR_Linux + 350) |
374 | #define __NR_renameat2 (__NR_Linux + 351) | 374 | #define __NR_renameat2 (__NR_Linux + 351) |
375 | #define __NR_seccomp (__NR_Linux + 352) | 375 | #define __NR_seccomp (__NR_Linux + 352) |
376 | #define __NR_getrandom (__NR_Linux + 353) | ||
377 | #define __NR_memfd_create (__NR_Linux + 354) | ||
376 | 378 | ||
377 | /* | 379 | /* |
378 | * Offset of the last Linux o32 flavoured syscall | 380 | * Offset of the last Linux o32 flavoured syscall |
379 | */ | 381 | */ |
380 | #define __NR_Linux_syscalls 352 | 382 | #define __NR_Linux_syscalls 354 |
381 | 383 | ||
382 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 384 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
383 | 385 | ||
384 | #define __NR_O32_Linux 4000 | 386 | #define __NR_O32_Linux 4000 |
385 | #define __NR_O32_Linux_syscalls 352 | 387 | #define __NR_O32_Linux_syscalls 354 |
386 | 388 | ||
387 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 389 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
388 | 390 | ||
@@ -703,16 +705,18 @@ | |||
703 | #define __NR_sched_getattr (__NR_Linux + 310) | 705 | #define __NR_sched_getattr (__NR_Linux + 310) |
704 | #define __NR_renameat2 (__NR_Linux + 311) | 706 | #define __NR_renameat2 (__NR_Linux + 311) |
705 | #define __NR_seccomp (__NR_Linux + 312) | 707 | #define __NR_seccomp (__NR_Linux + 312) |
708 | #define __NR_getrandom (__NR_Linux + 313) | ||
709 | #define __NR_memfd_create (__NR_Linux + 314) | ||
706 | 710 | ||
707 | /* | 711 | /* |
708 | * Offset of the last Linux 64-bit flavoured syscall | 712 | * Offset of the last Linux 64-bit flavoured syscall |
709 | */ | 713 | */ |
710 | #define __NR_Linux_syscalls 312 | 714 | #define __NR_Linux_syscalls 314 |
711 | 715 | ||
712 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 716 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
713 | 717 | ||
714 | #define __NR_64_Linux 5000 | 718 | #define __NR_64_Linux 5000 |
715 | #define __NR_64_Linux_syscalls 312 | 719 | #define __NR_64_Linux_syscalls 314 |
716 | 720 | ||
717 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 721 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
718 | 722 | ||
@@ -1037,15 +1041,17 @@ | |||
1037 | #define __NR_sched_getattr (__NR_Linux + 314) | 1041 | #define __NR_sched_getattr (__NR_Linux + 314) |
1038 | #define __NR_renameat2 (__NR_Linux + 315) | 1042 | #define __NR_renameat2 (__NR_Linux + 315) |
1039 | #define __NR_seccomp (__NR_Linux + 316) | 1043 | #define __NR_seccomp (__NR_Linux + 316) |
1044 | #define __NR_getrandom (__NR_Linux + 317) | ||
1045 | #define __NR_memfd_create (__NR_Linux + 318) | ||
1040 | 1046 | ||
1041 | /* | 1047 | /* |
1042 | * Offset of the last N32 flavoured syscall | 1048 | * Offset of the last N32 flavoured syscall |
1043 | */ | 1049 | */ |
1044 | #define __NR_Linux_syscalls 316 | 1050 | #define __NR_Linux_syscalls 318 |
1045 | 1051 | ||
1046 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1052 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
1047 | 1053 | ||
1048 | #define __NR_N32_Linux 6000 | 1054 | #define __NR_N32_Linux 6000 |
1049 | #define __NR_N32_Linux_syscalls 316 | 1055 | #define __NR_N32_Linux_syscalls 318 |
1050 | 1056 | ||
1051 | #endif /* _UAPI_ASM_UNISTD_H */ | 1057 | #endif /* _UAPI_ASM_UNISTD_H */ |
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S index 6f4f739dad96..e6e97d2a5c9e 100644 --- a/arch/mips/kernel/cps-vec.S +++ b/arch/mips/kernel/cps-vec.S | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/asm-offsets.h> | 13 | #include <asm/asm-offsets.h> |
14 | #include <asm/asmmacro.h> | 14 | #include <asm/asmmacro.h> |
15 | #include <asm/cacheops.h> | 15 | #include <asm/cacheops.h> |
16 | #include <asm/eva.h> | ||
16 | #include <asm/mipsregs.h> | 17 | #include <asm/mipsregs.h> |
17 | #include <asm/mipsmtregs.h> | 18 | #include <asm/mipsmtregs.h> |
18 | #include <asm/pm.h> | 19 | #include <asm/pm.h> |
@@ -166,6 +167,9 @@ dcache_done: | |||
166 | 1: jal mips_cps_core_init | 167 | 1: jal mips_cps_core_init |
167 | nop | 168 | nop |
168 | 169 | ||
170 | /* Do any EVA initialization if necessary */ | ||
171 | eva_init | ||
172 | |||
169 | /* | 173 | /* |
170 | * Boot any other VPEs within this core that should be online, and | 174 | * Boot any other VPEs within this core that should be online, and |
171 | * deactivate this VPE if it should be offline. | 175 | * deactivate this VPE if it should be offline. |
diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c index 992e18474da5..50980bf3983e 100644 --- a/arch/mips/kernel/machine_kexec.c +++ b/arch/mips/kernel/machine_kexec.c | |||
@@ -71,8 +71,12 @@ machine_kexec(struct kimage *image) | |||
71 | kexec_start_address = | 71 | kexec_start_address = |
72 | (unsigned long) phys_to_virt(image->start); | 72 | (unsigned long) phys_to_virt(image->start); |
73 | 73 | ||
74 | kexec_indirection_page = | 74 | if (image->type == KEXEC_TYPE_DEFAULT) { |
75 | (unsigned long) phys_to_virt(image->head & PAGE_MASK); | 75 | kexec_indirection_page = |
76 | (unsigned long) phys_to_virt(image->head & PAGE_MASK); | ||
77 | } else { | ||
78 | kexec_indirection_page = (unsigned long)&image->head; | ||
79 | } | ||
76 | 80 | ||
77 | memcpy((void*)reboot_code_buffer, relocate_new_kernel, | 81 | memcpy((void*)reboot_code_buffer, relocate_new_kernel, |
78 | relocate_new_kernel_size); | 82 | relocate_new_kernel_size); |
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S index 5d25462de8a6..2f7c734771f4 100644 --- a/arch/mips/kernel/mcount.S +++ b/arch/mips/kernel/mcount.S | |||
@@ -129,7 +129,11 @@ NESTED(_mcount, PT_SIZE, ra) | |||
129 | nop | 129 | nop |
130 | #endif | 130 | #endif |
131 | b ftrace_stub | 131 | b ftrace_stub |
132 | #ifdef CONFIG_32BIT | ||
133 | addiu sp, sp, 8 | ||
134 | #else | ||
132 | nop | 135 | nop |
136 | #endif | ||
133 | 137 | ||
134 | static_trace: | 138 | static_trace: |
135 | MCOUNT_SAVE_REGS | 139 | MCOUNT_SAVE_REGS |
@@ -139,6 +143,9 @@ static_trace: | |||
139 | move a1, AT /* arg2: parent's return address */ | 143 | move a1, AT /* arg2: parent's return address */ |
140 | 144 | ||
141 | MCOUNT_RESTORE_REGS | 145 | MCOUNT_RESTORE_REGS |
146 | #ifdef CONFIG_32BIT | ||
147 | addiu sp, sp, 8 | ||
148 | #endif | ||
142 | .globl ftrace_stub | 149 | .globl ftrace_stub |
143 | ftrace_stub: | 150 | ftrace_stub: |
144 | RETURN_BACK | 151 | RETURN_BACK |
@@ -183,6 +190,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra) | |||
183 | jal prepare_ftrace_return | 190 | jal prepare_ftrace_return |
184 | nop | 191 | nop |
185 | MCOUNT_RESTORE_REGS | 192 | MCOUNT_RESTORE_REGS |
193 | #ifndef CONFIG_DYNAMIC_FTRACE | ||
194 | #ifdef CONFIG_32BIT | ||
195 | addiu sp, sp, 8 | ||
196 | #endif | ||
197 | #endif | ||
186 | RETURN_BACK | 198 | RETURN_BACK |
187 | END(ftrace_graph_caller) | 199 | END(ftrace_graph_caller) |
188 | 200 | ||
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index 14bf74b0f51c..b63f2482f288 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c | |||
@@ -558,7 +558,7 @@ static int mipspmu_get_irq(void) | |||
558 | if (mipspmu.irq >= 0) { | 558 | if (mipspmu.irq >= 0) { |
559 | /* Request my own irq handler. */ | 559 | /* Request my own irq handler. */ |
560 | err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq, | 560 | err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq, |
561 | IRQF_PERCPU | IRQF_NOBALANCING, | 561 | IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_THREAD, |
562 | "mips_perf_pmu", NULL); | 562 | "mips_perf_pmu", NULL); |
563 | if (err) { | 563 | if (err) { |
564 | pr_warning("Unable to request IRQ%d for MIPS " | 564 | pr_warning("Unable to request IRQ%d for MIPS " |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index f93b4cbec739..744cd10ba599 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -577,3 +577,5 @@ EXPORT(sys_call_table) | |||
577 | PTR sys_sched_getattr /* 4350 */ | 577 | PTR sys_sched_getattr /* 4350 */ |
578 | PTR sys_renameat2 | 578 | PTR sys_renameat2 |
579 | PTR sys_seccomp | 579 | PTR sys_seccomp |
580 | PTR sys_getrandom | ||
581 | PTR sys_memfd_create | ||
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 03ebd9979ad2..002b1bc09c38 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -432,4 +432,6 @@ EXPORT(sys_call_table) | |||
432 | PTR sys_sched_getattr /* 5310 */ | 432 | PTR sys_sched_getattr /* 5310 */ |
433 | PTR sys_renameat2 | 433 | PTR sys_renameat2 |
434 | PTR sys_seccomp | 434 | PTR sys_seccomp |
435 | PTR sys_getrandom | ||
436 | PTR sys_memfd_create | ||
435 | .size sys_call_table,.-sys_call_table | 437 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index ebc9228e2e15..ca6cbbe9805b 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -425,4 +425,6 @@ EXPORT(sysn32_call_table) | |||
425 | PTR sys_sched_getattr | 425 | PTR sys_sched_getattr |
426 | PTR sys_renameat2 /* 6315 */ | 426 | PTR sys_renameat2 /* 6315 */ |
427 | PTR sys_seccomp | 427 | PTR sys_seccomp |
428 | PTR sys_getrandom | ||
429 | PTR sys_memfd_create | ||
428 | .size sysn32_call_table,.-sysn32_call_table | 430 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 13b964fddc4a..9e10d11fbb84 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -113,15 +113,19 @@ trace_a_syscall: | |||
113 | move s0, t2 # Save syscall pointer | 113 | move s0, t2 # Save syscall pointer |
114 | move a0, sp | 114 | move a0, sp |
115 | /* | 115 | /* |
116 | * syscall number is in v0 unless we called syscall(__NR_###) | 116 | * absolute syscall number is in v0 unless we called syscall(__NR_###) |
117 | * where the real syscall number is in a0 | 117 | * where the real syscall number is in a0 |
118 | * note: NR_syscall is the first O32 syscall but the macro is | 118 | * note: NR_syscall is the first O32 syscall but the macro is |
119 | * only defined when compiling with -mabi=32 (CONFIG_32BIT) | 119 | * only defined when compiling with -mabi=32 (CONFIG_32BIT) |
120 | * therefore __NR_O32_Linux is used (4000) | 120 | * therefore __NR_O32_Linux is used (4000) |
121 | */ | 121 | */ |
122 | addiu a1, v0, __NR_O32_Linux | 122 | .set push |
123 | bnez v0, 1f /* __NR_syscall at offset 0 */ | 123 | .set reorder |
124 | lw a1, PT_R4(sp) | 124 | subu t1, v0, __NR_O32_Linux |
125 | move a1, v0 | ||
126 | bnez t1, 1f /* __NR_syscall at offset 0 */ | ||
127 | lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */ | ||
128 | .set pop | ||
125 | 129 | ||
126 | 1: jal syscall_trace_enter | 130 | 1: jal syscall_trace_enter |
127 | 131 | ||
@@ -558,4 +562,6 @@ EXPORT(sys32_call_table) | |||
558 | PTR sys_sched_getattr /* 4350 */ | 562 | PTR sys_sched_getattr /* 4350 */ |
559 | PTR sys_renameat2 | 563 | PTR sys_renameat2 |
560 | PTR sys_seccomp | 564 | PTR sys_seccomp |
565 | PTR sys_getrandom | ||
566 | PTR sys_memfd_create | ||
561 | .size sys32_call_table,.-sys32_call_table | 567 | .size sys32_call_table,.-sys32_call_table |
diff --git a/arch/mips/loongson/loongson-3/cop2-ex.c b/arch/mips/loongson/loongson-3/cop2-ex.c index 9182e8d2967c..b03e37d2071a 100644 --- a/arch/mips/loongson/loongson-3/cop2-ex.c +++ b/arch/mips/loongson/loongson-3/cop2-ex.c | |||
@@ -22,13 +22,13 @@ | |||
22 | static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action, | 22 | static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action, |
23 | void *data) | 23 | void *data) |
24 | { | 24 | { |
25 | int fpu_enabled; | 25 | int fpu_owned; |
26 | int fr = !test_thread_flag(TIF_32BIT_FPREGS); | 26 | int fr = !test_thread_flag(TIF_32BIT_FPREGS); |
27 | 27 | ||
28 | switch (action) { | 28 | switch (action) { |
29 | case CU2_EXCEPTION: | 29 | case CU2_EXCEPTION: |
30 | preempt_disable(); | 30 | preempt_disable(); |
31 | fpu_enabled = read_c0_status() & ST0_CU1; | 31 | fpu_owned = __is_fpu_owner(); |
32 | if (!fr) | 32 | if (!fr) |
33 | set_c0_status(ST0_CU1 | ST0_CU2); | 33 | set_c0_status(ST0_CU1 | ST0_CU2); |
34 | else | 34 | else |
@@ -39,8 +39,8 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action, | |||
39 | KSTK_STATUS(current) |= ST0_FR; | 39 | KSTK_STATUS(current) |= ST0_FR; |
40 | else | 40 | else |
41 | KSTK_STATUS(current) &= ~ST0_FR; | 41 | KSTK_STATUS(current) &= ~ST0_FR; |
42 | /* If FPU is enabled, we needn't init or restore fp */ | 42 | /* If FPU is owned, we needn't init or restore fp */ |
43 | if(!fpu_enabled) { | 43 | if (!fpu_owned) { |
44 | set_thread_flag(TIF_USEDFPU); | 44 | set_thread_flag(TIF_USEDFPU); |
45 | if (!used_math()) { | 45 | if (!used_math()) { |
46 | _init_fpu(); | 46 | _init_fpu(); |
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c index ca025a6ba559..37ed184398c6 100644 --- a/arch/mips/loongson/loongson-3/numa.c +++ b/arch/mips/loongson/loongson-3/numa.c | |||
@@ -24,8 +24,6 @@ | |||
24 | #include <asm/page.h> | 24 | #include <asm/page.h> |
25 | #include <asm/pgalloc.h> | 25 | #include <asm/pgalloc.h> |
26 | #include <asm/sections.h> | 26 | #include <asm/sections.h> |
27 | #include <linux/bootmem.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
30 | #include <asm/bootinfo.h> | 28 | #include <asm/bootinfo.h> |
31 | #include <asm/mc146818-time.h> | 29 | #include <asm/mc146818-time.h> |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index bf0fc6b16ad9..7a4727795a70 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -650,9 +650,9 @@ static inline int cop1_64bit(struct pt_regs *xcp) | |||
650 | #define SIFROMREG(si, x) \ | 650 | #define SIFROMREG(si, x) \ |
651 | do { \ | 651 | do { \ |
652 | if (cop1_64bit(xcp)) \ | 652 | if (cop1_64bit(xcp)) \ |
653 | (si) = get_fpr32(&ctx->fpr[x], 0); \ | 653 | (si) = (int)get_fpr32(&ctx->fpr[x], 0); \ |
654 | else \ | 654 | else \ |
655 | (si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \ | 655 | (si) = (int)get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \ |
656 | } while (0) | 656 | } while (0) |
657 | 657 | ||
658 | #define SITOREG(si, x) \ | 658 | #define SITOREG(si, x) \ |
@@ -667,7 +667,7 @@ do { \ | |||
667 | } \ | 667 | } \ |
668 | } while (0) | 668 | } while (0) |
669 | 669 | ||
670 | #define SIFROMHREG(si, x) ((si) = get_fpr32(&ctx->fpr[x], 1)) | 670 | #define SIFROMHREG(si, x) ((si) = (int)get_fpr32(&ctx->fpr[x], 1)) |
671 | 671 | ||
672 | #define SITOHREG(si, x) \ | 672 | #define SITOHREG(si, x) \ |
673 | do { \ | 673 | do { \ |
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index f7b91d3a371d..7e3ea7766822 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c | |||
@@ -119,25 +119,36 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr) | |||
119 | 119 | ||
120 | EXPORT_SYMBOL(__flush_anon_page); | 120 | EXPORT_SYMBOL(__flush_anon_page); |
121 | 121 | ||
122 | void __update_cache(struct vm_area_struct *vma, unsigned long address, | 122 | static void mips_flush_dcache_from_pte(pte_t pteval, unsigned long address) |
123 | pte_t pte) | ||
124 | { | 123 | { |
125 | struct page *page; | 124 | struct page *page; |
126 | unsigned long pfn, addr; | 125 | unsigned long pfn = pte_pfn(pteval); |
127 | int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc; | ||
128 | 126 | ||
129 | pfn = pte_pfn(pte); | ||
130 | if (unlikely(!pfn_valid(pfn))) | 127 | if (unlikely(!pfn_valid(pfn))) |
131 | return; | 128 | return; |
129 | |||
132 | page = pfn_to_page(pfn); | 130 | page = pfn_to_page(pfn); |
133 | if (page_mapping(page) && Page_dcache_dirty(page)) { | 131 | if (page_mapping(page) && Page_dcache_dirty(page)) { |
134 | addr = (unsigned long) page_address(page); | 132 | unsigned long page_addr = (unsigned long) page_address(page); |
135 | if (exec || pages_do_alias(addr, address & PAGE_MASK)) | 133 | |
136 | flush_data_cache_page(addr); | 134 | if (!cpu_has_ic_fills_f_dc || |
135 | pages_do_alias(page_addr, address & PAGE_MASK)) | ||
136 | flush_data_cache_page(page_addr); | ||
137 | ClearPageDcacheDirty(page); | 137 | ClearPageDcacheDirty(page); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | void set_pte_at(struct mm_struct *mm, unsigned long addr, | ||
142 | pte_t *ptep, pte_t pteval) | ||
143 | { | ||
144 | if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) { | ||
145 | if (pte_present(pteval)) | ||
146 | mips_flush_dcache_from_pte(pteval, addr); | ||
147 | } | ||
148 | |||
149 | set_pte(ptep, pteval); | ||
150 | } | ||
151 | |||
141 | unsigned long _page_cachable_default; | 152 | unsigned long _page_cachable_default; |
142 | EXPORT_SYMBOL(_page_cachable_default); | 153 | EXPORT_SYMBOL(_page_cachable_default); |
143 | 154 | ||
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 571aab064936..f42e35e42790 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -53,6 +53,7 @@ | |||
53 | */ | 53 | */ |
54 | unsigned long empty_zero_page, zero_page_mask; | 54 | unsigned long empty_zero_page, zero_page_mask; |
55 | EXPORT_SYMBOL_GPL(empty_zero_page); | 55 | EXPORT_SYMBOL_GPL(empty_zero_page); |
56 | EXPORT_SYMBOL(zero_page_mask); | ||
56 | 57 | ||
57 | /* | 58 | /* |
58 | * Not static inline because used by IP27 special magic initialization code | 59 | * Not static inline because used by IP27 special magic initialization code |
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c index 0c35dee0a215..8fddd2cdbff7 100644 --- a/arch/mips/mti-malta/malta-memory.c +++ b/arch/mips/mti-malta/malta-memory.c | |||
@@ -35,13 +35,19 @@ fw_memblock_t * __init fw_getmdesc(int eva) | |||
35 | /* otherwise look in the environment */ | 35 | /* otherwise look in the environment */ |
36 | 36 | ||
37 | memsize_str = fw_getenv("memsize"); | 37 | memsize_str = fw_getenv("memsize"); |
38 | if (memsize_str) | 38 | if (memsize_str) { |
39 | tmp = kstrtol(memsize_str, 0, &memsize); | 39 | tmp = kstrtoul(memsize_str, 0, &memsize); |
40 | if (tmp) | ||
41 | pr_warn("Failed to read the 'memsize' env variable.\n"); | ||
42 | } | ||
40 | if (eva) { | 43 | if (eva) { |
41 | /* Look for ememsize for EVA */ | 44 | /* Look for ememsize for EVA */ |
42 | ememsize_str = fw_getenv("ememsize"); | 45 | ememsize_str = fw_getenv("ememsize"); |
43 | if (ememsize_str) | 46 | if (ememsize_str) { |
44 | tmp = kstrtol(ememsize_str, 0, &ememsize); | 47 | tmp = kstrtoul(ememsize_str, 0, &ememsize); |
48 | if (tmp) | ||
49 | pr_warn("Failed to read the 'ememsize' env variable.\n"); | ||
50 | } | ||
45 | } | 51 | } |
46 | if (!memsize && !ememsize) { | 52 | if (!memsize && !ememsize) { |
47 | pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); | 53 | pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); |
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index 05a56619ece2..9f7ecbda250c 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
@@ -793,6 +793,7 @@ static int build_body(struct jit_ctx *ctx) | |||
793 | const struct sock_filter *inst; | 793 | const struct sock_filter *inst; |
794 | unsigned int i, off, load_order, condt; | 794 | unsigned int i, off, load_order, condt; |
795 | u32 k, b_off __maybe_unused; | 795 | u32 k, b_off __maybe_unused; |
796 | int tmp; | ||
796 | 797 | ||
797 | for (i = 0; i < prog->len; i++) { | 798 | for (i = 0; i < prog->len; i++) { |
798 | u16 code; | 799 | u16 code; |
@@ -1332,9 +1333,9 @@ jmp_cmp: | |||
1332 | case BPF_ANC | SKF_AD_PKTTYPE: | 1333 | case BPF_ANC | SKF_AD_PKTTYPE: |
1333 | ctx->flags |= SEEN_SKB; | 1334 | ctx->flags |= SEEN_SKB; |
1334 | 1335 | ||
1335 | off = pkt_type_offset(); | 1336 | tmp = off = pkt_type_offset(); |
1336 | 1337 | ||
1337 | if (off < 0) | 1338 | if (tmp < 0) |
1338 | return -1; | 1339 | return -1; |
1339 | emit_load_byte(r_tmp, r_skb, off, ctx); | 1340 | emit_load_byte(r_tmp, r_skb, off, ctx); |
1340 | /* Keep only the last 3 bits */ | 1341 | /* Keep only the last 3 bits */ |
diff --git a/arch/mips/pmcs-msp71xx/msp_irq.c b/arch/mips/pmcs-msp71xx/msp_irq.c index 941744aabb51..f914c753de21 100644 --- a/arch/mips/pmcs-msp71xx/msp_irq.c +++ b/arch/mips/pmcs-msp71xx/msp_irq.c | |||
@@ -51,7 +51,7 @@ static inline void sec_int_dispatch(void) { do_IRQ(MSP_INT_SEC); } | |||
51 | * the range 40-71. | 51 | * the range 40-71. |
52 | */ | 52 | */ |
53 | 53 | ||
54 | asmlinkage void plat_irq_dispatch(struct pt_regs *regs) | 54 | asmlinkage void plat_irq_dispatch(void) |
55 | { | 55 | { |
56 | u32 pending; | 56 | u32 pending; |
57 | 57 | ||
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 6e75e2030927..1554a6f2a5bb 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -321,6 +321,22 @@ source "fs/Kconfig" | |||
321 | 321 | ||
322 | source "arch/parisc/Kconfig.debug" | 322 | source "arch/parisc/Kconfig.debug" |
323 | 323 | ||
324 | config SECCOMP | ||
325 | def_bool y | ||
326 | prompt "Enable seccomp to safely compute untrusted bytecode" | ||
327 | ---help--- | ||
328 | This kernel feature is useful for number crunching applications | ||
329 | that may need to compute untrusted bytecode during their | ||
330 | execution. By using pipes or other transports made available to | ||
331 | the process as file descriptors supporting the read/write | ||
332 | syscalls, it's possible to isolate those applications in | ||
333 | their own address space using seccomp. Once seccomp is | ||
334 | enabled via prctl(PR_SET_SECCOMP), it cannot be disabled | ||
335 | and the task is only allowed to execute a few safe syscalls | ||
336 | defined by each seccomp mode. | ||
337 | |||
338 | If unsure, say Y. Only embedded should say N here. | ||
339 | |||
324 | source "security/Kconfig" | 340 | source "security/Kconfig" |
325 | 341 | ||
326 | source "crypto/Kconfig" | 342 | source "crypto/Kconfig" |
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 7187664034c3..5db8882f732c 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile | |||
@@ -48,7 +48,12 @@ cflags-y := -pipe | |||
48 | 48 | ||
49 | # These flags should be implied by an hppa-linux configuration, but they | 49 | # These flags should be implied by an hppa-linux configuration, but they |
50 | # are not in gcc 3.2. | 50 | # are not in gcc 3.2. |
51 | cflags-y += -mno-space-regs -mfast-indirect-calls | 51 | cflags-y += -mno-space-regs |
52 | |||
53 | # -mfast-indirect-calls is only relevant for 32-bit kernels. | ||
54 | ifndef CONFIG_64BIT | ||
55 | cflags-y += -mfast-indirect-calls | ||
56 | endif | ||
52 | 57 | ||
53 | # Currently we save and restore fpregs on all kernel entry/interruption paths. | 58 | # Currently we save and restore fpregs on all kernel entry/interruption paths. |
54 | # If that gets optimized, we might need to disable the use of fpregs in the | 59 | # If that gets optimized, we might need to disable the use of fpregs in the |
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig index 90025322b75e..0490199d7b15 100644 --- a/arch/parisc/configs/a500_defconfig +++ b/arch/parisc/configs/a500_defconfig | |||
@@ -31,6 +31,7 @@ CONFIG_PD6729=m | |||
31 | CONFIG_I82092=m | 31 | CONFIG_I82092=m |
32 | # CONFIG_SUPERIO is not set | 32 | # CONFIG_SUPERIO is not set |
33 | # CONFIG_CHASSIS_LCD_LED is not set | 33 | # CONFIG_CHASSIS_LCD_LED is not set |
34 | CONFIG_NET=y | ||
34 | CONFIG_PACKET=y | 35 | CONFIG_PACKET=y |
35 | CONFIG_UNIX=y | 36 | CONFIG_UNIX=y |
36 | CONFIG_XFRM_USER=m | 37 | CONFIG_XFRM_USER=m |
diff --git a/arch/parisc/configs/c8000_defconfig b/arch/parisc/configs/c8000_defconfig index 8249ac9d9cfc..269c23d23fcb 100644 --- a/arch/parisc/configs/c8000_defconfig +++ b/arch/parisc/configs/c8000_defconfig | |||
@@ -33,6 +33,7 @@ CONFIG_PCI_LBA=y | |||
33 | # CONFIG_PDC_CHASSIS_WARN is not set | 33 | # CONFIG_PDC_CHASSIS_WARN is not set |
34 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 34 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
35 | CONFIG_BINFMT_MISC=m | 35 | CONFIG_BINFMT_MISC=m |
36 | CONFIG_NET=y | ||
36 | CONFIG_PACKET=y | 37 | CONFIG_PACKET=y |
37 | CONFIG_UNIX=y | 38 | CONFIG_UNIX=y |
38 | CONFIG_XFRM_USER=m | 39 | CONFIG_XFRM_USER=m |
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index d9dc6cd3b7d2..e5c4da035810 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
@@ -456,7 +456,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2) | |||
456 | } | 456 | } |
457 | 457 | ||
458 | /* String could be altered by userspace after strlen_user() */ | 458 | /* String could be altered by userspace after strlen_user() */ |
459 | fsname[len] = '\0'; | 459 | fsname[len - 1] = '\0'; |
460 | 460 | ||
461 | printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); | 461 | printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); |
462 | if ( !strcmp(fsname, "hfs") ) { | 462 | if ( !strcmp(fsname, "hfs") ) { |
diff --git a/arch/parisc/include/asm/seccomp.h b/arch/parisc/include/asm/seccomp.h new file mode 100644 index 000000000000..015f7887aa29 --- /dev/null +++ b/arch/parisc/include/asm/seccomp.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _ASM_PARISC_SECCOMP_H | ||
2 | #define _ASM_PARISC_SECCOMP_H | ||
3 | |||
4 | #include <linux/unistd.h> | ||
5 | |||
6 | #define __NR_seccomp_read __NR_read | ||
7 | #define __NR_seccomp_write __NR_write | ||
8 | #define __NR_seccomp_exit __NR_exit | ||
9 | #define __NR_seccomp_sigreturn __NR_rt_sigreturn | ||
10 | |||
11 | #define __NR_seccomp_read_32 __NR_read | ||
12 | #define __NR_seccomp_write_32 __NR_write | ||
13 | #define __NR_seccomp_exit_32 __NR_exit | ||
14 | #define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn | ||
15 | |||
16 | #endif /* _ASM_PARISC_SECCOMP_H */ | ||
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h index 4b9b10ce1f9d..a84611835549 100644 --- a/arch/parisc/include/asm/thread_info.h +++ b/arch/parisc/include/asm/thread_info.h | |||
@@ -60,6 +60,7 @@ struct thread_info { | |||
60 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ | 60 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ |
61 | #define TIF_SINGLESTEP 9 /* single stepping? */ | 61 | #define TIF_SINGLESTEP 9 /* single stepping? */ |
62 | #define TIF_BLOCKSTEP 10 /* branch stepping? */ | 62 | #define TIF_BLOCKSTEP 10 /* branch stepping? */ |
63 | #define TIF_SECCOMP 11 /* secure computing */ | ||
63 | 64 | ||
64 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 65 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
65 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 66 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
@@ -70,11 +71,13 @@ struct thread_info { | |||
70 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 71 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
71 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | 72 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
72 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) | 73 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) |
74 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | ||
73 | 75 | ||
74 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ | 76 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ |
75 | _TIF_NEED_RESCHED) | 77 | _TIF_NEED_RESCHED) |
76 | #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ | 78 | #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ |
77 | _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT) | 79 | _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \ |
80 | _TIF_SECCOMP) | ||
78 | 81 | ||
79 | #ifdef CONFIG_64BIT | 82 | #ifdef CONFIG_64BIT |
80 | # ifdef CONFIG_COMPAT | 83 | # ifdef CONFIG_COMPAT |
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h index 47e0e21d2272..8667f18be238 100644 --- a/arch/parisc/include/uapi/asm/unistd.h +++ b/arch/parisc/include/uapi/asm/unistd.h | |||
@@ -830,8 +830,11 @@ | |||
830 | #define __NR_sched_getattr (__NR_Linux + 335) | 830 | #define __NR_sched_getattr (__NR_Linux + 335) |
831 | #define __NR_utimes (__NR_Linux + 336) | 831 | #define __NR_utimes (__NR_Linux + 336) |
832 | #define __NR_renameat2 (__NR_Linux + 337) | 832 | #define __NR_renameat2 (__NR_Linux + 337) |
833 | #define __NR_seccomp (__NR_Linux + 338) | ||
834 | #define __NR_getrandom (__NR_Linux + 339) | ||
835 | #define __NR_memfd_create (__NR_Linux + 340) | ||
833 | 836 | ||
834 | #define __NR_Linux_syscalls (__NR_renameat2 + 1) | 837 | #define __NR_Linux_syscalls (__NR_memfd_create + 1) |
835 | 838 | ||
836 | 839 | ||
837 | #define __IGNORE_select /* newselect */ | 840 | #define __IGNORE_select /* newselect */ |
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index e842ee233db4..92438c21d453 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/user.h> | 17 | #include <linux/user.h> |
18 | #include <linux/personality.h> | 18 | #include <linux/personality.h> |
19 | #include <linux/security.h> | 19 | #include <linux/security.h> |
20 | #include <linux/seccomp.h> | ||
20 | #include <linux/compat.h> | 21 | #include <linux/compat.h> |
21 | #include <linux/signal.h> | 22 | #include <linux/signal.h> |
22 | #include <linux/audit.h> | 23 | #include <linux/audit.h> |
@@ -270,6 +271,9 @@ long do_syscall_trace_enter(struct pt_regs *regs) | |||
270 | { | 271 | { |
271 | long ret = 0; | 272 | long ret = 0; |
272 | 273 | ||
274 | /* Do the secure computing check first. */ | ||
275 | secure_computing_strict(regs->gr[20]); | ||
276 | |||
273 | if (test_thread_flag(TIF_SYSCALL_TRACE) && | 277 | if (test_thread_flag(TIF_SYSCALL_TRACE) && |
274 | tracehook_report_syscall_entry(regs)) | 278 | tracehook_report_syscall_entry(regs)) |
275 | ret = -1L; | 279 | ret = -1L; |
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index 838786011037..7ef22e3387e0 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S | |||
@@ -74,7 +74,7 @@ ENTRY(linux_gateway_page) | |||
74 | /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */ | 74 | /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */ |
75 | /* Light-weight-syscall entry must always be located at 0xb0 */ | 75 | /* Light-weight-syscall entry must always be located at 0xb0 */ |
76 | /* WARNING: Keep this number updated with table size changes */ | 76 | /* WARNING: Keep this number updated with table size changes */ |
77 | #define __NR_lws_entries (2) | 77 | #define __NR_lws_entries (3) |
78 | 78 | ||
79 | lws_entry: | 79 | lws_entry: |
80 | gate lws_start, %r0 /* increase privilege */ | 80 | gate lws_start, %r0 /* increase privilege */ |
@@ -502,7 +502,7 @@ lws_exit: | |||
502 | 502 | ||
503 | 503 | ||
504 | /*************************************************** | 504 | /*************************************************** |
505 | Implementing CAS as an atomic operation: | 505 | Implementing 32bit CAS as an atomic operation: |
506 | 506 | ||
507 | %r26 - Address to examine | 507 | %r26 - Address to examine |
508 | %r25 - Old value to check (old) | 508 | %r25 - Old value to check (old) |
@@ -659,6 +659,230 @@ cas_action: | |||
659 | ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page) | 659 | ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page) |
660 | 660 | ||
661 | 661 | ||
662 | /*************************************************** | ||
663 | New CAS implementation which uses pointers and variable size | ||
664 | information. The value pointed by old and new MUST NOT change | ||
665 | while performing CAS. The lock only protect the value at %r26. | ||
666 | |||
667 | %r26 - Address to examine | ||
668 | %r25 - Pointer to the value to check (old) | ||
669 | %r24 - Pointer to the value to set (new) | ||
670 | %r23 - Size of the variable (0/1/2/3 for 8/16/32/64 bit) | ||
671 | %r28 - Return non-zero on failure | ||
672 | %r21 - Kernel error code | ||
673 | |||
674 | %r21 has the following meanings: | ||
675 | |||
676 | EAGAIN - CAS is busy, ldcw failed, try again. | ||
677 | EFAULT - Read or write failed. | ||
678 | |||
679 | Scratch: r20, r22, r28, r29, r1, fr4 (32bit for 64bit CAS only) | ||
680 | |||
681 | ****************************************************/ | ||
682 | |||
683 | /* ELF32 Process entry path */ | ||
684 | lws_compare_and_swap_2: | ||
685 | #ifdef CONFIG_64BIT | ||
686 | /* Clip the input registers */ | ||
687 | depdi 0, 31, 32, %r26 | ||
688 | depdi 0, 31, 32, %r25 | ||
689 | depdi 0, 31, 32, %r24 | ||
690 | depdi 0, 31, 32, %r23 | ||
691 | #endif | ||
692 | |||
693 | /* Check the validity of the size pointer */ | ||
694 | subi,>>= 4, %r23, %r0 | ||
695 | b,n lws_exit_nosys | ||
696 | |||
697 | /* Jump to the functions which will load the old and new values into | ||
698 | registers depending on the their size */ | ||
699 | shlw %r23, 2, %r29 | ||
700 | blr %r29, %r0 | ||
701 | nop | ||
702 | |||
703 | /* 8bit load */ | ||
704 | 4: ldb 0(%sr3,%r25), %r25 | ||
705 | b cas2_lock_start | ||
706 | 5: ldb 0(%sr3,%r24), %r24 | ||
707 | nop | ||
708 | nop | ||
709 | nop | ||
710 | nop | ||
711 | nop | ||
712 | |||
713 | /* 16bit load */ | ||
714 | 6: ldh 0(%sr3,%r25), %r25 | ||
715 | b cas2_lock_start | ||
716 | 7: ldh 0(%sr3,%r24), %r24 | ||
717 | nop | ||
718 | nop | ||
719 | nop | ||
720 | nop | ||
721 | nop | ||
722 | |||
723 | /* 32bit load */ | ||
724 | 8: ldw 0(%sr3,%r25), %r25 | ||
725 | b cas2_lock_start | ||
726 | 9: ldw 0(%sr3,%r24), %r24 | ||
727 | nop | ||
728 | nop | ||
729 | nop | ||
730 | nop | ||
731 | nop | ||
732 | |||
733 | /* 64bit load */ | ||
734 | #ifdef CONFIG_64BIT | ||
735 | 10: ldd 0(%sr3,%r25), %r25 | ||
736 | 11: ldd 0(%sr3,%r24), %r24 | ||
737 | #else | ||
738 | /* Load new value into r22/r23 - high/low */ | ||
739 | 10: ldw 0(%sr3,%r25), %r22 | ||
740 | 11: ldw 4(%sr3,%r25), %r23 | ||
741 | /* Load new value into fr4 for atomic store later */ | ||
742 | 12: flddx 0(%sr3,%r24), %fr4 | ||
743 | #endif | ||
744 | |||
745 | cas2_lock_start: | ||
746 | /* Load start of lock table */ | ||
747 | ldil L%lws_lock_start, %r20 | ||
748 | ldo R%lws_lock_start(%r20), %r28 | ||
749 | |||
750 | /* Extract four bits from r26 and hash lock (Bits 4-7) */ | ||
751 | extru %r26, 27, 4, %r20 | ||
752 | |||
753 | /* Find lock to use, the hash is either one of 0 to | ||
754 | 15, multiplied by 16 (keep it 16-byte aligned) | ||
755 | and add to the lock table offset. */ | ||
756 | shlw %r20, 4, %r20 | ||
757 | add %r20, %r28, %r20 | ||
758 | |||
759 | rsm PSW_SM_I, %r0 /* Disable interrupts */ | ||
760 | /* COW breaks can cause contention on UP systems */ | ||
761 | LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */ | ||
762 | cmpb,<>,n %r0, %r28, cas2_action /* Did we get it? */ | ||
763 | cas2_wouldblock: | ||
764 | ldo 2(%r0), %r28 /* 2nd case */ | ||
765 | ssm PSW_SM_I, %r0 | ||
766 | b lws_exit /* Contended... */ | ||
767 | ldo -EAGAIN(%r0), %r21 /* Spin in userspace */ | ||
768 | |||
769 | /* | ||
770 | prev = *addr; | ||
771 | if ( prev == old ) | ||
772 | *addr = new; | ||
773 | return prev; | ||
774 | */ | ||
775 | |||
776 | /* NOTES: | ||
777 | This all works becuse intr_do_signal | ||
778 | and schedule both check the return iasq | ||
779 | and see that we are on the kernel page | ||
780 | so this process is never scheduled off | ||
781 | or is ever sent any signal of any sort, | ||
782 | thus it is wholly atomic from usrspaces | ||
783 | perspective | ||
784 | */ | ||
785 | cas2_action: | ||
786 | /* Jump to the correct function */ | ||
787 | blr %r29, %r0 | ||
788 | /* Set %r28 as non-zero for now */ | ||
789 | ldo 1(%r0),%r28 | ||
790 | |||
791 | /* 8bit CAS */ | ||
792 | 13: ldb,ma 0(%sr3,%r26), %r29 | ||
793 | sub,= %r29, %r25, %r0 | ||
794 | b,n cas2_end | ||
795 | 14: stb,ma %r24, 0(%sr3,%r26) | ||
796 | b cas2_end | ||
797 | copy %r0, %r28 | ||
798 | nop | ||
799 | nop | ||
800 | |||
801 | /* 16bit CAS */ | ||
802 | 15: ldh,ma 0(%sr3,%r26), %r29 | ||
803 | sub,= %r29, %r25, %r0 | ||
804 | b,n cas2_end | ||
805 | 16: sth,ma %r24, 0(%sr3,%r26) | ||
806 | b cas2_end | ||
807 | copy %r0, %r28 | ||
808 | nop | ||
809 | nop | ||
810 | |||
811 | /* 32bit CAS */ | ||
812 | 17: ldw,ma 0(%sr3,%r26), %r29 | ||
813 | sub,= %r29, %r25, %r0 | ||
814 | b,n cas2_end | ||
815 | 18: stw,ma %r24, 0(%sr3,%r26) | ||
816 | b cas2_end | ||
817 | copy %r0, %r28 | ||
818 | nop | ||
819 | nop | ||
820 | |||
821 | /* 64bit CAS */ | ||
822 | #ifdef CONFIG_64BIT | ||
823 | 19: ldd,ma 0(%sr3,%r26), %r29 | ||
824 | sub,= %r29, %r25, %r0 | ||
825 | b,n cas2_end | ||
826 | 20: std,ma %r24, 0(%sr3,%r26) | ||
827 | copy %r0, %r28 | ||
828 | #else | ||
829 | /* Compare first word */ | ||
830 | 19: ldw,ma 0(%sr3,%r26), %r29 | ||
831 | sub,= %r29, %r22, %r0 | ||
832 | b,n cas2_end | ||
833 | /* Compare second word */ | ||
834 | 20: ldw,ma 4(%sr3,%r26), %r29 | ||
835 | sub,= %r29, %r23, %r0 | ||
836 | b,n cas2_end | ||
837 | /* Perform the store */ | ||
838 | 21: fstdx %fr4, 0(%sr3,%r26) | ||
839 | copy %r0, %r28 | ||
840 | #endif | ||
841 | |||
842 | cas2_end: | ||
843 | /* Free lock */ | ||
844 | stw,ma %r20, 0(%sr2,%r20) | ||
845 | /* Enable interrupts */ | ||
846 | ssm PSW_SM_I, %r0 | ||
847 | /* Return to userspace, set no error */ | ||
848 | b lws_exit | ||
849 | copy %r0, %r21 | ||
850 | |||
851 | 22: | ||
852 | /* Error occurred on load or store */ | ||
853 | /* Free lock */ | ||
854 | stw %r20, 0(%sr2,%r20) | ||
855 | ssm PSW_SM_I, %r0 | ||
856 | ldo 1(%r0),%r28 | ||
857 | b lws_exit | ||
858 | ldo -EFAULT(%r0),%r21 /* set errno */ | ||
859 | nop | ||
860 | nop | ||
861 | nop | ||
862 | |||
863 | /* Exception table entries, for the load and store, return EFAULT. | ||
864 | Each of the entries must be relocated. */ | ||
865 | ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 22b-linux_gateway_page) | ||
866 | ASM_EXCEPTIONTABLE_ENTRY(5b-linux_gateway_page, 22b-linux_gateway_page) | ||
867 | ASM_EXCEPTIONTABLE_ENTRY(6b-linux_gateway_page, 22b-linux_gateway_page) | ||
868 | ASM_EXCEPTIONTABLE_ENTRY(7b-linux_gateway_page, 22b-linux_gateway_page) | ||
869 | ASM_EXCEPTIONTABLE_ENTRY(8b-linux_gateway_page, 22b-linux_gateway_page) | ||
870 | ASM_EXCEPTIONTABLE_ENTRY(9b-linux_gateway_page, 22b-linux_gateway_page) | ||
871 | ASM_EXCEPTIONTABLE_ENTRY(10b-linux_gateway_page, 22b-linux_gateway_page) | ||
872 | ASM_EXCEPTIONTABLE_ENTRY(11b-linux_gateway_page, 22b-linux_gateway_page) | ||
873 | ASM_EXCEPTIONTABLE_ENTRY(13b-linux_gateway_page, 22b-linux_gateway_page) | ||
874 | ASM_EXCEPTIONTABLE_ENTRY(14b-linux_gateway_page, 22b-linux_gateway_page) | ||
875 | ASM_EXCEPTIONTABLE_ENTRY(15b-linux_gateway_page, 22b-linux_gateway_page) | ||
876 | ASM_EXCEPTIONTABLE_ENTRY(16b-linux_gateway_page, 22b-linux_gateway_page) | ||
877 | ASM_EXCEPTIONTABLE_ENTRY(17b-linux_gateway_page, 22b-linux_gateway_page) | ||
878 | ASM_EXCEPTIONTABLE_ENTRY(18b-linux_gateway_page, 22b-linux_gateway_page) | ||
879 | ASM_EXCEPTIONTABLE_ENTRY(19b-linux_gateway_page, 22b-linux_gateway_page) | ||
880 | ASM_EXCEPTIONTABLE_ENTRY(20b-linux_gateway_page, 22b-linux_gateway_page) | ||
881 | #ifndef CONFIG_64BIT | ||
882 | ASM_EXCEPTIONTABLE_ENTRY(12b-linux_gateway_page, 22b-linux_gateway_page) | ||
883 | ASM_EXCEPTIONTABLE_ENTRY(21b-linux_gateway_page, 22b-linux_gateway_page) | ||
884 | #endif | ||
885 | |||
662 | /* Make sure nothing else is placed on this page */ | 886 | /* Make sure nothing else is placed on this page */ |
663 | .align PAGE_SIZE | 887 | .align PAGE_SIZE |
664 | END(linux_gateway_page) | 888 | END(linux_gateway_page) |
@@ -675,8 +899,9 @@ ENTRY(end_linux_gateway_page) | |||
675 | /* Light-weight-syscall table */ | 899 | /* Light-weight-syscall table */ |
676 | /* Start of lws table. */ | 900 | /* Start of lws table. */ |
677 | ENTRY(lws_table) | 901 | ENTRY(lws_table) |
678 | LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */ | 902 | LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic 32bit CAS */ |
679 | LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */ | 903 | LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic 32bit CAS */ |
904 | LWS_ENTRY(compare_and_swap_2) /* 2 - ELF32 Atomic 64bit CAS */ | ||
680 | END(lws_table) | 905 | END(lws_table) |
681 | /* End of lws table */ | 906 | /* End of lws table */ |
682 | 907 | ||
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 84c5d3a58fa1..b563d9c8268b 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -433,6 +433,9 @@ | |||
433 | ENTRY_SAME(sched_getattr) /* 335 */ | 433 | ENTRY_SAME(sched_getattr) /* 335 */ |
434 | ENTRY_COMP(utimes) | 434 | ENTRY_COMP(utimes) |
435 | ENTRY_SAME(renameat2) | 435 | ENTRY_SAME(renameat2) |
436 | ENTRY_SAME(seccomp) | ||
437 | ENTRY_SAME(getrandom) | ||
438 | ENTRY_SAME(memfd_create) /* 340 */ | ||
436 | 439 | ||
437 | /* Nothing yet */ | 440 | /* Nothing yet */ |
438 | 441 | ||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index a577609f8ed6..4bc7b62fb4b6 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -399,8 +399,6 @@ config PPC64_SUPPORTS_MEMORY_FAILURE | |||
399 | config KEXEC | 399 | config KEXEC |
400 | bool "kexec system call" | 400 | bool "kexec system call" |
401 | depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) | 401 | depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) |
402 | select CRYPTO | ||
403 | select CRYPTO_SHA256 | ||
404 | help | 402 | help |
405 | kexec is a system call that implements the ability to shutdown your | 403 | kexec is a system call that implements the ability to shutdown your |
406 | current kernel, and to start another kernel. It is like a reboot | 404 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/powerpc/configs/c2k_defconfig b/arch/powerpc/configs/c2k_defconfig index 5e2aa43562b5..59734916986a 100644 --- a/arch/powerpc/configs/c2k_defconfig +++ b/arch/powerpc/configs/c2k_defconfig | |||
@@ -29,6 +29,7 @@ CONFIG_PM=y | |||
29 | CONFIG_PCI_MSI=y | 29 | CONFIG_PCI_MSI=y |
30 | CONFIG_HOTPLUG_PCI=y | 30 | CONFIG_HOTPLUG_PCI=y |
31 | CONFIG_HOTPLUG_PCI_SHPC=m | 31 | CONFIG_HOTPLUG_PCI_SHPC=m |
32 | CONFIG_NET=y | ||
32 | CONFIG_PACKET=y | 33 | CONFIG_PACKET=y |
33 | CONFIG_UNIX=y | 34 | CONFIG_UNIX=y |
34 | CONFIG_XFRM_USER=y | 35 | CONFIG_XFRM_USER=y |
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig index 4bee1a6d41d0..45fd06cdc3e8 100644 --- a/arch/powerpc/configs/cell_defconfig +++ b/arch/powerpc/configs/cell_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=4 | 5 | CONFIG_NR_CPUS=4 |
6 | CONFIG_EXPERIMENTAL=y | 6 | CONFIG_EXPERIMENTAL=y |
7 | CONFIG_SYSVIPC=y | 7 | CONFIG_SYSVIPC=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_IKCONFIG=y | 9 | CONFIG_IKCONFIG=y |
9 | CONFIG_IKCONFIG_PROC=y | 10 | CONFIG_IKCONFIG_PROC=y |
10 | CONFIG_LOG_BUF_SHIFT=15 | 11 | CONFIG_LOG_BUF_SHIFT=15 |
diff --git a/arch/powerpc/configs/celleb_defconfig b/arch/powerpc/configs/celleb_defconfig index 6d7b22f41b50..77d7bf3ca2ac 100644 --- a/arch/powerpc/configs/celleb_defconfig +++ b/arch/powerpc/configs/celleb_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=4 | 5 | CONFIG_NR_CPUS=4 |
6 | CONFIG_EXPERIMENTAL=y | 6 | CONFIG_EXPERIMENTAL=y |
7 | CONFIG_SYSVIPC=y | 7 | CONFIG_SYSVIPC=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_IKCONFIG=y | 9 | CONFIG_IKCONFIG=y |
9 | CONFIG_IKCONFIG_PROC=y | 10 | CONFIG_IKCONFIG_PROC=y |
10 | CONFIG_LOG_BUF_SHIFT=15 | 11 | CONFIG_LOG_BUF_SHIFT=15 |
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig index 4b07bade1ba9..269d6e47c67d 100644 --- a/arch/powerpc/configs/corenet64_smp_defconfig +++ b/arch/powerpc/configs/corenet64_smp_defconfig | |||
@@ -4,6 +4,7 @@ CONFIG_ALTIVEC=y | |||
4 | CONFIG_SMP=y | 4 | CONFIG_SMP=y |
5 | CONFIG_NR_CPUS=24 | 5 | CONFIG_NR_CPUS=24 |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_FHANDLE=y | ||
7 | CONFIG_IRQ_DOMAIN_DEBUG=y | 8 | CONFIG_IRQ_DOMAIN_DEBUG=y |
8 | CONFIG_NO_HZ=y | 9 | CONFIG_NO_HZ=y |
9 | CONFIG_HIGH_RES_TIMERS=y | 10 | CONFIG_HIGH_RES_TIMERS=y |
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index 3c72fa615bd9..7594c5ac6481 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_NR_CPUS=4 | |||
5 | CONFIG_EXPERIMENTAL=y | 5 | CONFIG_EXPERIMENTAL=y |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_POSIX_MQUEUE=y | 7 | CONFIG_POSIX_MQUEUE=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_IKCONFIG=y | 9 | CONFIG_IKCONFIG=y |
9 | CONFIG_IKCONFIG_PROC=y | 10 | CONFIG_IKCONFIG_PROC=y |
10 | CONFIG_BLK_DEV_INITRD=y | 11 | CONFIG_BLK_DEV_INITRD=y |
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig index 95e545d9f25c..c8b6a9ddb21b 100644 --- a/arch/powerpc/configs/maple_defconfig +++ b/arch/powerpc/configs/maple_defconfig | |||
@@ -4,6 +4,7 @@ CONFIG_NR_CPUS=4 | |||
4 | CONFIG_EXPERIMENTAL=y | 4 | CONFIG_EXPERIMENTAL=y |
5 | CONFIG_SYSVIPC=y | 5 | CONFIG_SYSVIPC=y |
6 | CONFIG_POSIX_MQUEUE=y | 6 | CONFIG_POSIX_MQUEUE=y |
7 | CONFIG_FHANDLE=y | ||
7 | CONFIG_IKCONFIG=y | 8 | CONFIG_IKCONFIG=y |
8 | CONFIG_IKCONFIG_PROC=y | 9 | CONFIG_IKCONFIG_PROC=y |
9 | # CONFIG_COMPAT_BRK is not set | 10 | # CONFIG_COMPAT_BRK is not set |
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig index cec044a3ff69..e5e7838af008 100644 --- a/arch/powerpc/configs/pasemi_defconfig +++ b/arch/powerpc/configs/pasemi_defconfig | |||
@@ -3,6 +3,7 @@ CONFIG_ALTIVEC=y | |||
3 | CONFIG_SMP=y | 3 | CONFIG_SMP=y |
4 | CONFIG_NR_CPUS=2 | 4 | CONFIG_NR_CPUS=2 |
5 | CONFIG_SYSVIPC=y | 5 | CONFIG_SYSVIPC=y |
6 | CONFIG_FHANDLE=y | ||
6 | CONFIG_NO_HZ=y | 7 | CONFIG_NO_HZ=y |
7 | CONFIG_HIGH_RES_TIMERS=y | 8 | CONFIG_HIGH_RES_TIMERS=y |
8 | CONFIG_BLK_DEV_INITRD=y | 9 | CONFIG_BLK_DEV_INITRD=y |
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig index 553e66278010..0351b5ffdfef 100644 --- a/arch/powerpc/configs/pmac32_defconfig +++ b/arch/powerpc/configs/pmac32_defconfig | |||
@@ -31,6 +31,7 @@ CONFIG_HIBERNATION=y | |||
31 | CONFIG_APM_EMULATION=y | 31 | CONFIG_APM_EMULATION=y |
32 | CONFIG_PCCARD=m | 32 | CONFIG_PCCARD=m |
33 | CONFIG_YENTA=m | 33 | CONFIG_YENTA=m |
34 | CONFIG_NET=y | ||
34 | CONFIG_PACKET=y | 35 | CONFIG_PACKET=y |
35 | CONFIG_UNIX=y | 36 | CONFIG_UNIX=y |
36 | CONFIG_XFRM_USER=y | 37 | CONFIG_XFRM_USER=y |
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index f26b267eb71f..36518870e6b2 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig | |||
@@ -4,6 +4,7 @@ CONFIG_VSX=y | |||
4 | CONFIG_SMP=y | 4 | CONFIG_SMP=y |
5 | CONFIG_SYSVIPC=y | 5 | CONFIG_SYSVIPC=y |
6 | CONFIG_POSIX_MQUEUE=y | 6 | CONFIG_POSIX_MQUEUE=y |
7 | CONFIG_FHANDLE=y | ||
7 | CONFIG_IRQ_DOMAIN_DEBUG=y | 8 | CONFIG_IRQ_DOMAIN_DEBUG=y |
8 | CONFIG_NO_HZ=y | 9 | CONFIG_NO_HZ=y |
9 | CONFIG_HIGH_RES_TIMERS=y | 10 | CONFIG_HIGH_RES_TIMERS=y |
@@ -57,6 +58,7 @@ CONFIG_ELECTRA_CF=y | |||
57 | CONFIG_HOTPLUG_PCI=y | 58 | CONFIG_HOTPLUG_PCI=y |
58 | CONFIG_HOTPLUG_PCI_RPA=m | 59 | CONFIG_HOTPLUG_PCI_RPA=m |
59 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m | 60 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m |
61 | CONFIG_NET=y | ||
60 | CONFIG_PACKET=y | 62 | CONFIG_PACKET=y |
61 | CONFIG_UNIX=y | 63 | CONFIG_UNIX=y |
62 | CONFIG_XFRM_USER=m | 64 | CONFIG_XFRM_USER=m |
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig index 438e813dc9cb..c3a3269b0865 100644 --- a/arch/powerpc/configs/ppc64e_defconfig +++ b/arch/powerpc/configs/ppc64e_defconfig | |||
@@ -3,6 +3,7 @@ CONFIG_PPC_BOOK3E_64=y | |||
3 | CONFIG_SMP=y | 3 | CONFIG_SMP=y |
4 | CONFIG_SYSVIPC=y | 4 | CONFIG_SYSVIPC=y |
5 | CONFIG_POSIX_MQUEUE=y | 5 | CONFIG_POSIX_MQUEUE=y |
6 | CONFIG_FHANDLE=y | ||
6 | CONFIG_NO_HZ=y | 7 | CONFIG_NO_HZ=y |
7 | CONFIG_HIGH_RES_TIMERS=y | 8 | CONFIG_HIGH_RES_TIMERS=y |
8 | CONFIG_TASKSTATS=y | 9 | CONFIG_TASKSTATS=y |
@@ -32,6 +33,7 @@ CONFIG_SPARSEMEM_MANUAL=y | |||
32 | CONFIG_PCI_MSI=y | 33 | CONFIG_PCI_MSI=y |
33 | CONFIG_PCCARD=y | 34 | CONFIG_PCCARD=y |
34 | CONFIG_HOTPLUG_PCI=y | 35 | CONFIG_HOTPLUG_PCI=y |
36 | CONFIG_NET=y | ||
35 | CONFIG_PACKET=y | 37 | CONFIG_PACKET=y |
36 | CONFIG_UNIX=y | 38 | CONFIG_UNIX=y |
37 | CONFIG_XFRM_USER=m | 39 | CONFIG_XFRM_USER=m |
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig index fdee37fab81c..2e637c881d2b 100644 --- a/arch/powerpc/configs/ps3_defconfig +++ b/arch/powerpc/configs/ps3_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=2 | 5 | CONFIG_NR_CPUS=2 |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_POSIX_MQUEUE=y | 7 | CONFIG_POSIX_MQUEUE=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_HIGH_RES_TIMERS=y | 9 | CONFIG_HIGH_RES_TIMERS=y |
9 | CONFIG_BLK_DEV_INITRD=y | 10 | CONFIG_BLK_DEV_INITRD=y |
10 | CONFIG_RD_LZMA=y | 11 | CONFIG_RD_LZMA=y |
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index a905063281cc..dd2a9cab4b50 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=2048 | 5 | CONFIG_NR_CPUS=2048 |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_POSIX_MQUEUE=y | 7 | CONFIG_POSIX_MQUEUE=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_AUDIT=y | 9 | CONFIG_AUDIT=y |
9 | CONFIG_AUDITSYSCALL=y | 10 | CONFIG_AUDITSYSCALL=y |
10 | CONFIG_IRQ_DOMAIN_DEBUG=y | 11 | CONFIG_IRQ_DOMAIN_DEBUG=y |
@@ -52,6 +53,7 @@ CONFIG_SCHED_SMT=y | |||
52 | CONFIG_HOTPLUG_PCI=y | 53 | CONFIG_HOTPLUG_PCI=y |
53 | CONFIG_HOTPLUG_PCI_RPA=m | 54 | CONFIG_HOTPLUG_PCI_RPA=m |
54 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m | 55 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m |
56 | CONFIG_NET=y | ||
55 | CONFIG_PACKET=y | 57 | CONFIG_PACKET=y |
56 | CONFIG_UNIX=y | 58 | CONFIG_UNIX=y |
57 | CONFIG_XFRM_USER=m | 59 | CONFIG_XFRM_USER=m |
diff --git a/arch/powerpc/configs/pseries_le_defconfig b/arch/powerpc/configs/pseries_le_defconfig index 58e3dbf43ca4..63392f4b29a4 100644 --- a/arch/powerpc/configs/pseries_le_defconfig +++ b/arch/powerpc/configs/pseries_le_defconfig | |||
@@ -6,6 +6,7 @@ CONFIG_NR_CPUS=2048 | |||
6 | CONFIG_CPU_LITTLE_ENDIAN=y | 6 | CONFIG_CPU_LITTLE_ENDIAN=y |
7 | CONFIG_SYSVIPC=y | 7 | CONFIG_SYSVIPC=y |
8 | CONFIG_POSIX_MQUEUE=y | 8 | CONFIG_POSIX_MQUEUE=y |
9 | CONFIG_FHANDLE=y | ||
9 | CONFIG_AUDIT=y | 10 | CONFIG_AUDIT=y |
10 | CONFIG_AUDITSYSCALL=y | 11 | CONFIG_AUDITSYSCALL=y |
11 | CONFIG_IRQ_DOMAIN_DEBUG=y | 12 | CONFIG_IRQ_DOMAIN_DEBUG=y |
@@ -54,6 +55,7 @@ CONFIG_SCHED_SMT=y | |||
54 | CONFIG_HOTPLUG_PCI=y | 55 | CONFIG_HOTPLUG_PCI=y |
55 | CONFIG_HOTPLUG_PCI_RPA=m | 56 | CONFIG_HOTPLUG_PCI_RPA=m |
56 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m | 57 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m |
58 | CONFIG_NET=y | ||
57 | CONFIG_PACKET=y | 59 | CONFIG_PACKET=y |
58 | CONFIG_UNIX=y | 60 | CONFIG_UNIX=y |
59 | CONFIG_XFRM_USER=m | 61 | CONFIG_XFRM_USER=m |
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index 279b80f3bb29..c0c61fa9cd9e 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h | |||
@@ -47,6 +47,12 @@ | |||
47 | STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) | 47 | STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) |
48 | #define STACK_FRAME_MARKER 12 | 48 | #define STACK_FRAME_MARKER 12 |
49 | 49 | ||
50 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
51 | #define STACK_FRAME_MIN_SIZE 32 | ||
52 | #else | ||
53 | #define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD | ||
54 | #endif | ||
55 | |||
50 | /* Size of dummy stack frame allocated when calling signal handler. */ | 56 | /* Size of dummy stack frame allocated when calling signal handler. */ |
51 | #define __SIGNAL_FRAMESIZE 128 | 57 | #define __SIGNAL_FRAMESIZE 128 |
52 | #define __SIGNAL_FRAMESIZE32 64 | 58 | #define __SIGNAL_FRAMESIZE32 64 |
@@ -60,6 +66,7 @@ | |||
60 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) | 66 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) |
61 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) | 67 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) |
62 | #define STACK_FRAME_MARKER 2 | 68 | #define STACK_FRAME_MARKER 2 |
69 | #define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD | ||
63 | 70 | ||
64 | /* Size of stack frame allocated when calling signal handler. */ | 71 | /* Size of stack frame allocated when calling signal handler. */ |
65 | #define __SIGNAL_FRAMESIZE 64 | 72 | #define __SIGNAL_FRAMESIZE 64 |
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 542bc0f0673f..7d8a60068805 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -362,3 +362,6 @@ SYSCALL(ni_syscall) /* sys_kcmp */ | |||
362 | SYSCALL_SPU(sched_setattr) | 362 | SYSCALL_SPU(sched_setattr) |
363 | SYSCALL_SPU(sched_getattr) | 363 | SYSCALL_SPU(sched_getattr) |
364 | SYSCALL_SPU(renameat2) | 364 | SYSCALL_SPU(renameat2) |
365 | SYSCALL_SPU(seccomp) | ||
366 | SYSCALL_SPU(getrandom) | ||
367 | SYSCALL_SPU(memfd_create) | ||
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 5ce5552ab9f5..4e9af3fd43e7 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <uapi/asm/unistd.h> | 12 | #include <uapi/asm/unistd.h> |
13 | 13 | ||
14 | 14 | ||
15 | #define __NR_syscalls 358 | 15 | #define __NR_syscalls 361 |
16 | 16 | ||
17 | #define __NR__exit __NR_exit | 17 | #define __NR__exit __NR_exit |
18 | #define NR_syscalls __NR_syscalls | 18 | #define NR_syscalls __NR_syscalls |
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h index 2d526f7b48da..0688fc06e183 100644 --- a/arch/powerpc/include/uapi/asm/unistd.h +++ b/arch/powerpc/include/uapi/asm/unistd.h | |||
@@ -380,5 +380,8 @@ | |||
380 | #define __NR_sched_setattr 355 | 380 | #define __NR_sched_setattr 355 |
381 | #define __NR_sched_getattr 356 | 381 | #define __NR_sched_getattr 356 |
382 | #define __NR_renameat2 357 | 382 | #define __NR_renameat2 357 |
383 | #define __NR_seccomp 358 | ||
384 | #define __NR_getrandom 359 | ||
385 | #define __NR_memfd_create 360 | ||
383 | 386 | ||
384 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ | 387 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 72c20bb16d26..79294c4c5015 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c | |||
@@ -62,10 +62,10 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | kvm->arch.hpt_cma_alloc = 0; | 64 | kvm->arch.hpt_cma_alloc = 0; |
65 | page = kvm_alloc_hpt(1 << (order - PAGE_SHIFT)); | 65 | page = kvm_alloc_hpt(1ul << (order - PAGE_SHIFT)); |
66 | if (page) { | 66 | if (page) { |
67 | hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page)); | 67 | hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page)); |
68 | memset((void *)hpt, 0, (1 << order)); | 68 | memset((void *)hpt, 0, (1ul << order)); |
69 | kvm->arch.hpt_cma_alloc = 1; | 69 | kvm->arch.hpt_cma_alloc = 1; |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 329d7fdd0a6a..b9615ba5b083 100644 --- a/arch/powerpc/kvm/book3s_hv_builtin.c +++ b/arch/powerpc/kvm/book3s_hv_builtin.c | |||
@@ -101,7 +101,7 @@ struct kvm_rma_info *kvm_alloc_rma() | |||
101 | ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL); | 101 | ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL); |
102 | if (!ri) | 102 | if (!ri) |
103 | return NULL; | 103 | return NULL; |
104 | page = cma_alloc(kvm_cma, kvm_rma_pages, get_order(kvm_rma_pages)); | 104 | page = cma_alloc(kvm_cma, kvm_rma_pages, order_base_2(kvm_rma_pages)); |
105 | if (!page) | 105 | if (!page) |
106 | goto err_out; | 106 | goto err_out; |
107 | atomic_set(&ri->use_count, 1); | 107 | atomic_set(&ri->use_count, 1); |
@@ -135,12 +135,12 @@ struct page *kvm_alloc_hpt(unsigned long nr_pages) | |||
135 | { | 135 | { |
136 | unsigned long align_pages = HPT_ALIGN_PAGES; | 136 | unsigned long align_pages = HPT_ALIGN_PAGES; |
137 | 137 | ||
138 | VM_BUG_ON(get_order(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT); | 138 | VM_BUG_ON(order_base_2(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT); |
139 | 139 | ||
140 | /* Old CPUs require HPT aligned on a multiple of its size */ | 140 | /* Old CPUs require HPT aligned on a multiple of its size */ |
141 | if (!cpu_has_feature(CPU_FTR_ARCH_206)) | 141 | if (!cpu_has_feature(CPU_FTR_ARCH_206)) |
142 | align_pages = nr_pages; | 142 | align_pages = nr_pages; |
143 | return cma_alloc(kvm_cma, nr_pages, get_order(align_pages)); | 143 | return cma_alloc(kvm_cma, nr_pages, order_base_2(align_pages)); |
144 | } | 144 | } |
145 | EXPORT_SYMBOL_GPL(kvm_alloc_hpt); | 145 | EXPORT_SYMBOL_GPL(kvm_alloc_hpt); |
146 | 146 | ||
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c index 74d1e780748b..2396dda282cd 100644 --- a/arch/powerpc/perf/callchain.c +++ b/arch/powerpc/perf/callchain.c | |||
@@ -35,7 +35,7 @@ static int valid_next_sp(unsigned long sp, unsigned long prev_sp) | |||
35 | return 0; /* must be 16-byte aligned */ | 35 | return 0; /* must be 16-byte aligned */ |
36 | if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD)) | 36 | if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD)) |
37 | return 0; | 37 | return 0; |
38 | if (sp >= prev_sp + STACK_FRAME_OVERHEAD) | 38 | if (sp >= prev_sp + STACK_FRAME_MIN_SIZE) |
39 | return 1; | 39 | return 1; |
40 | /* | 40 | /* |
41 | * sp could decrease when we jump off an interrupt stack | 41 | * sp could decrease when we jump off an interrupt stack |
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c index 97ac8dc33667..5e1ed1575aab 100644 --- a/arch/powerpc/platforms/powernv/opal-hmi.c +++ b/arch/powerpc/platforms/powernv/opal-hmi.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <asm/opal.h> | 29 | #include <asm/opal.h> |
30 | #include <asm/cputable.h> | 30 | #include <asm/cputable.h> |
31 | #include <asm/machdep.h> | ||
31 | 32 | ||
32 | static int opal_hmi_handler_nb_init; | 33 | static int opal_hmi_handler_nb_init; |
33 | struct OpalHmiEvtNode { | 34 | struct OpalHmiEvtNode { |
@@ -185,4 +186,4 @@ static int __init opal_hmi_handler_init(void) | |||
185 | } | 186 | } |
186 | return 0; | 187 | return 0; |
187 | } | 188 | } |
188 | subsys_initcall(opal_hmi_handler_init); | 189 | machine_subsys_initcall(powernv, opal_hmi_handler_init); |
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index c904583baf4b..17ee193960a0 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c | |||
@@ -113,7 +113,7 @@ out: | |||
113 | static int pseries_remove_mem_node(struct device_node *np) | 113 | static int pseries_remove_mem_node(struct device_node *np) |
114 | { | 114 | { |
115 | const char *type; | 115 | const char *type; |
116 | const unsigned int *regs; | 116 | const __be32 *regs; |
117 | unsigned long base; | 117 | unsigned long base; |
118 | unsigned int lmb_size; | 118 | unsigned int lmb_size; |
119 | int ret = -EINVAL; | 119 | int ret = -EINVAL; |
@@ -132,8 +132,8 @@ static int pseries_remove_mem_node(struct device_node *np) | |||
132 | if (!regs) | 132 | if (!regs) |
133 | return ret; | 133 | return ret; |
134 | 134 | ||
135 | base = *(unsigned long *)regs; | 135 | base = be64_to_cpu(*(unsigned long *)regs); |
136 | lmb_size = regs[3]; | 136 | lmb_size = be32_to_cpu(regs[3]); |
137 | 137 | ||
138 | pseries_remove_memblock(base, lmb_size); | 138 | pseries_remove_memblock(base, lmb_size); |
139 | return 0; | 139 | return 0; |
@@ -153,7 +153,7 @@ static inline int pseries_remove_mem_node(struct device_node *np) | |||
153 | static int pseries_add_mem_node(struct device_node *np) | 153 | static int pseries_add_mem_node(struct device_node *np) |
154 | { | 154 | { |
155 | const char *type; | 155 | const char *type; |
156 | const unsigned int *regs; | 156 | const __be32 *regs; |
157 | unsigned long base; | 157 | unsigned long base; |
158 | unsigned int lmb_size; | 158 | unsigned int lmb_size; |
159 | int ret = -EINVAL; | 159 | int ret = -EINVAL; |
@@ -172,8 +172,8 @@ static int pseries_add_mem_node(struct device_node *np) | |||
172 | if (!regs) | 172 | if (!regs) |
173 | return ret; | 173 | return ret; |
174 | 174 | ||
175 | base = *(unsigned long *)regs; | 175 | base = be64_to_cpu(*(unsigned long *)regs); |
176 | lmb_size = regs[3]; | 176 | lmb_size = be32_to_cpu(regs[3]); |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * Update memory region to represent the memory add | 179 | * Update memory region to represent the memory add |
@@ -187,14 +187,14 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr) | |||
187 | struct of_drconf_cell *new_drmem, *old_drmem; | 187 | struct of_drconf_cell *new_drmem, *old_drmem; |
188 | unsigned long memblock_size; | 188 | unsigned long memblock_size; |
189 | u32 entries; | 189 | u32 entries; |
190 | u32 *p; | 190 | __be32 *p; |
191 | int i, rc = -EINVAL; | 191 | int i, rc = -EINVAL; |
192 | 192 | ||
193 | memblock_size = pseries_memory_block_size(); | 193 | memblock_size = pseries_memory_block_size(); |
194 | if (!memblock_size) | 194 | if (!memblock_size) |
195 | return -EINVAL; | 195 | return -EINVAL; |
196 | 196 | ||
197 | p = (u32 *) pr->old_prop->value; | 197 | p = (__be32 *) pr->old_prop->value; |
198 | if (!p) | 198 | if (!p) |
199 | return -EINVAL; | 199 | return -EINVAL; |
200 | 200 | ||
@@ -203,28 +203,30 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr) | |||
203 | * entries. Get the niumber of entries and skip to the array of | 203 | * entries. Get the niumber of entries and skip to the array of |
204 | * of_drconf_cell's. | 204 | * of_drconf_cell's. |
205 | */ | 205 | */ |
206 | entries = *p++; | 206 | entries = be32_to_cpu(*p++); |
207 | old_drmem = (struct of_drconf_cell *)p; | 207 | old_drmem = (struct of_drconf_cell *)p; |
208 | 208 | ||
209 | p = (u32 *)pr->prop->value; | 209 | p = (__be32 *)pr->prop->value; |
210 | p++; | 210 | p++; |
211 | new_drmem = (struct of_drconf_cell *)p; | 211 | new_drmem = (struct of_drconf_cell *)p; |
212 | 212 | ||
213 | for (i = 0; i < entries; i++) { | 213 | for (i = 0; i < entries; i++) { |
214 | if ((old_drmem[i].flags & DRCONF_MEM_ASSIGNED) && | 214 | if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) && |
215 | (!(new_drmem[i].flags & DRCONF_MEM_ASSIGNED))) { | 215 | (!(be32_to_cpu(new_drmem[i].flags) & DRCONF_MEM_ASSIGNED))) { |
216 | rc = pseries_remove_memblock(old_drmem[i].base_addr, | 216 | rc = pseries_remove_memblock( |
217 | be64_to_cpu(old_drmem[i].base_addr), | ||
217 | memblock_size); | 218 | memblock_size); |
218 | break; | 219 | break; |
219 | } else if ((!(old_drmem[i].flags & DRCONF_MEM_ASSIGNED)) && | 220 | } else if ((!(be32_to_cpu(old_drmem[i].flags) & |
220 | (new_drmem[i].flags & DRCONF_MEM_ASSIGNED)) { | 221 | DRCONF_MEM_ASSIGNED)) && |
221 | rc = memblock_add(old_drmem[i].base_addr, | 222 | (be32_to_cpu(new_drmem[i].flags) & |
223 | DRCONF_MEM_ASSIGNED)) { | ||
224 | rc = memblock_add(be64_to_cpu(old_drmem[i].base_addr), | ||
222 | memblock_size); | 225 | memblock_size); |
223 | rc = (rc < 0) ? -EINVAL : 0; | 226 | rc = (rc < 0) ? -EINVAL : 0; |
224 | break; | 227 | break; |
225 | } | 228 | } |
226 | } | 229 | } |
227 | |||
228 | return rc; | 230 | return rc; |
229 | } | 231 | } |
230 | 232 | ||
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index ab39ceb89ecf..05c78bb5f570 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -48,8 +48,6 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC | |||
48 | 48 | ||
49 | config KEXEC | 49 | config KEXEC |
50 | def_bool y | 50 | def_bool y |
51 | select CRYPTO | ||
52 | select CRYPTO_SHA256 | ||
53 | 51 | ||
54 | config AUDIT_ARCH | 52 | config AUDIT_ARCH |
55 | def_bool y | 53 | def_bool y |
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig index 3ca1894ade09..9d94fdd9f525 100644 --- a/arch/s390/configs/default_defconfig +++ b/arch/s390/configs/default_defconfig | |||
@@ -63,6 +63,7 @@ CONFIG_CRASH_DUMP=y | |||
63 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 63 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
64 | CONFIG_BINFMT_MISC=m | 64 | CONFIG_BINFMT_MISC=m |
65 | CONFIG_HIBERNATION=y | 65 | CONFIG_HIBERNATION=y |
66 | CONFIG_NET=y | ||
66 | CONFIG_PACKET=y | 67 | CONFIG_PACKET=y |
67 | CONFIG_PACKET_DIAG=m | 68 | CONFIG_PACKET_DIAG=m |
68 | CONFIG_UNIX=y | 69 | CONFIG_UNIX=y |
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig index 4830aa6e6f53..90f514baa37d 100644 --- a/arch/s390/configs/gcov_defconfig +++ b/arch/s390/configs/gcov_defconfig | |||
@@ -61,6 +61,7 @@ CONFIG_CRASH_DUMP=y | |||
61 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 61 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
62 | CONFIG_BINFMT_MISC=m | 62 | CONFIG_BINFMT_MISC=m |
63 | CONFIG_HIBERNATION=y | 63 | CONFIG_HIBERNATION=y |
64 | CONFIG_NET=y | ||
64 | CONFIG_PACKET=y | 65 | CONFIG_PACKET=y |
65 | CONFIG_PACKET_DIAG=m | 66 | CONFIG_PACKET_DIAG=m |
66 | CONFIG_UNIX=y | 67 | CONFIG_UNIX=y |
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig index 61db449bf309..13559d32af69 100644 --- a/arch/s390/configs/performance_defconfig +++ b/arch/s390/configs/performance_defconfig | |||
@@ -59,6 +59,7 @@ CONFIG_CRASH_DUMP=y | |||
59 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 59 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
60 | CONFIG_BINFMT_MISC=m | 60 | CONFIG_BINFMT_MISC=m |
61 | CONFIG_HIBERNATION=y | 61 | CONFIG_HIBERNATION=y |
62 | CONFIG_NET=y | ||
62 | CONFIG_PACKET=y | 63 | CONFIG_PACKET=y |
63 | CONFIG_PACKET_DIAG=m | 64 | CONFIG_PACKET_DIAG=m |
64 | CONFIG_UNIX=y | 65 | CONFIG_UNIX=y |
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig index 948e0e057a23..e376789f2d8d 100644 --- a/arch/s390/configs/zfcpdump_defconfig +++ b/arch/s390/configs/zfcpdump_defconfig | |||
@@ -23,6 +23,7 @@ CONFIG_CRASH_DUMP=y | |||
23 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 23 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
24 | # CONFIG_SECCOMP is not set | 24 | # CONFIG_SECCOMP is not set |
25 | # CONFIG_IUCV is not set | 25 | # CONFIG_IUCV is not set |
26 | CONFIG_NET=y | ||
26 | CONFIG_ATM=y | 27 | CONFIG_ATM=y |
27 | CONFIG_ATM_LANE=y | 28 | CONFIG_ATM_LANE=y |
28 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 29 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 2e56498a40df..fab35a8efa4f 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -50,6 +50,7 @@ CONFIG_CMA=y | |||
50 | CONFIG_CRASH_DUMP=y | 50 | CONFIG_CRASH_DUMP=y |
51 | CONFIG_BINFMT_MISC=m | 51 | CONFIG_BINFMT_MISC=m |
52 | CONFIG_HIBERNATION=y | 52 | CONFIG_HIBERNATION=y |
53 | CONFIG_NET=y | ||
53 | CONFIG_PACKET=y | 54 | CONFIG_PACKET=y |
54 | CONFIG_UNIX=y | 55 | CONFIG_UNIX=y |
55 | CONFIG_NET_KEY=y | 56 | CONFIG_NET_KEY=y |
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h index 2fcccc0c997c..c81661e756a0 100644 --- a/arch/s390/include/asm/ipl.h +++ b/arch/s390/include/asm/ipl.h | |||
@@ -17,12 +17,12 @@ | |||
17 | #define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ | 17 | #define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ |
18 | sizeof(struct ipl_block_fcp)) | 18 | sizeof(struct ipl_block_fcp)) |
19 | 19 | ||
20 | #define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 8) | 20 | #define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 16) |
21 | 21 | ||
22 | #define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ | 22 | #define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ |
23 | sizeof(struct ipl_block_ccw)) | 23 | sizeof(struct ipl_block_ccw)) |
24 | 24 | ||
25 | #define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 8) | 25 | #define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 16) |
26 | 26 | ||
27 | #define IPL_MAX_SUPPORTED_VERSION (0) | 27 | #define IPL_MAX_SUPPORTED_VERSION (0) |
28 | 28 | ||
@@ -38,10 +38,11 @@ struct ipl_list_hdr { | |||
38 | u8 pbt; | 38 | u8 pbt; |
39 | u8 flags; | 39 | u8 flags; |
40 | u16 reserved2; | 40 | u16 reserved2; |
41 | u8 loadparm[8]; | ||
41 | } __attribute__((packed)); | 42 | } __attribute__((packed)); |
42 | 43 | ||
43 | struct ipl_block_fcp { | 44 | struct ipl_block_fcp { |
44 | u8 reserved1[313-1]; | 45 | u8 reserved1[305-1]; |
45 | u8 opt; | 46 | u8 opt; |
46 | u8 reserved2[3]; | 47 | u8 reserved2[3]; |
47 | u16 reserved3; | 48 | u16 reserved3; |
@@ -62,7 +63,6 @@ struct ipl_block_fcp { | |||
62 | offsetof(struct ipl_block_fcp, scp_data))) | 63 | offsetof(struct ipl_block_fcp, scp_data))) |
63 | 64 | ||
64 | struct ipl_block_ccw { | 65 | struct ipl_block_ccw { |
65 | u8 load_parm[8]; | ||
66 | u8 reserved1[84]; | 66 | u8 reserved1[84]; |
67 | u8 reserved2[2]; | 67 | u8 reserved2[2]; |
68 | u16 devno; | 68 | u16 devno; |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index b76317c1f3eb..5efb2fe186e7 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -1127,7 +1127,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, | |||
1127 | unsigned long addr, pte_t *ptep) | 1127 | unsigned long addr, pte_t *ptep) |
1128 | { | 1128 | { |
1129 | pgste_t pgste; | 1129 | pgste_t pgste; |
1130 | pte_t pte; | 1130 | pte_t pte, oldpte; |
1131 | int young; | 1131 | int young; |
1132 | 1132 | ||
1133 | if (mm_has_pgste(vma->vm_mm)) { | 1133 | if (mm_has_pgste(vma->vm_mm)) { |
@@ -1135,12 +1135,13 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, | |||
1135 | pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste); | 1135 | pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste); |
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | pte = *ptep; | 1138 | oldpte = pte = *ptep; |
1139 | ptep_flush_direct(vma->vm_mm, addr, ptep); | 1139 | ptep_flush_direct(vma->vm_mm, addr, ptep); |
1140 | young = pte_young(pte); | 1140 | young = pte_young(pte); |
1141 | pte = pte_mkold(pte); | 1141 | pte = pte_mkold(pte); |
1142 | 1142 | ||
1143 | if (mm_has_pgste(vma->vm_mm)) { | 1143 | if (mm_has_pgste(vma->vm_mm)) { |
1144 | pgste = pgste_update_all(&oldpte, pgste, vma->vm_mm); | ||
1144 | pgste = pgste_set_pte(ptep, pgste, pte); | 1145 | pgste = pgste_set_pte(ptep, pgste, pte); |
1145 | pgste_set_unlock(ptep, pgste); | 1146 | pgste_set_unlock(ptep, pgste); |
1146 | } else | 1147 | } else |
@@ -1330,6 +1331,7 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma, | |||
1330 | ptep_flush_direct(vma->vm_mm, address, ptep); | 1331 | ptep_flush_direct(vma->vm_mm, address, ptep); |
1331 | 1332 | ||
1332 | if (mm_has_pgste(vma->vm_mm)) { | 1333 | if (mm_has_pgste(vma->vm_mm)) { |
1334 | pgste_set_key(ptep, pgste, entry, vma->vm_mm); | ||
1333 | pgste = pgste_set_pte(ptep, pgste, entry); | 1335 | pgste = pgste_set_pte(ptep, pgste, entry); |
1334 | pgste_set_unlock(ptep, pgste); | 1336 | pgste_set_unlock(ptep, pgste); |
1335 | } else | 1337 | } else |
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h index 3802d2d3a18d..940ac49198db 100644 --- a/arch/s390/include/uapi/asm/unistd.h +++ b/arch/s390/include/uapi/asm/unistd.h | |||
@@ -283,7 +283,10 @@ | |||
283 | #define __NR_sched_setattr 345 | 283 | #define __NR_sched_setattr 345 |
284 | #define __NR_sched_getattr 346 | 284 | #define __NR_sched_getattr 346 |
285 | #define __NR_renameat2 347 | 285 | #define __NR_renameat2 347 |
286 | #define NR_syscalls 348 | 286 | #define __NR_seccomp 348 |
287 | #define __NR_getrandom 349 | ||
288 | #define __NR_memfd_create 350 | ||
289 | #define NR_syscalls 351 | ||
287 | 290 | ||
288 | /* | 291 | /* |
289 | * There are some system calls that are not present on 64 bit, some | 292 | * There are some system calls that are not present on 64 bit, some |
diff --git a/arch/s390/kernel/compat_wrapper.c b/arch/s390/kernel/compat_wrapper.c index 45cdb37aa6f8..faf6caa510dc 100644 --- a/arch/s390/kernel/compat_wrapper.c +++ b/arch/s390/kernel/compat_wrapper.c | |||
@@ -214,3 +214,6 @@ COMPAT_SYSCALL_WRAP3(finit_module, int, fd, const char __user *, uargs, int, fla | |||
214 | COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags); | 214 | COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags); |
215 | COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags); | 215 | COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags); |
216 | COMPAT_SYSCALL_WRAP5(renameat2, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, unsigned int, flags); | 216 | COMPAT_SYSCALL_WRAP5(renameat2, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, unsigned int, flags); |
217 | COMPAT_SYSCALL_WRAP3(seccomp, unsigned int, op, unsigned int, flags, const char __user *, uargs) | ||
218 | COMPAT_SYSCALL_WRAP3(getrandom, char __user *, buf, size_t, count, unsigned int, flags) | ||
219 | COMPAT_SYSCALL_WRAP2(memfd_create, const char __user *, uname, unsigned int, flags) | ||
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 633ca7504536..39badb9ca0b3 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -455,22 +455,6 @@ DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n", (unsigned long long) | |||
455 | DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long) | 455 | DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long) |
456 | IPL_PARMBLOCK_START->ipl_info.fcp.br_lba); | 456 | IPL_PARMBLOCK_START->ipl_info.fcp.br_lba); |
457 | 457 | ||
458 | static struct attribute *ipl_fcp_attrs[] = { | ||
459 | &sys_ipl_type_attr.attr, | ||
460 | &sys_ipl_device_attr.attr, | ||
461 | &sys_ipl_fcp_wwpn_attr.attr, | ||
462 | &sys_ipl_fcp_lun_attr.attr, | ||
463 | &sys_ipl_fcp_bootprog_attr.attr, | ||
464 | &sys_ipl_fcp_br_lba_attr.attr, | ||
465 | NULL, | ||
466 | }; | ||
467 | |||
468 | static struct attribute_group ipl_fcp_attr_group = { | ||
469 | .attrs = ipl_fcp_attrs, | ||
470 | }; | ||
471 | |||
472 | /* CCW ipl device attributes */ | ||
473 | |||
474 | static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, | 458 | static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, |
475 | struct kobj_attribute *attr, char *page) | 459 | struct kobj_attribute *attr, char *page) |
476 | { | 460 | { |
@@ -487,6 +471,23 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, | |||
487 | static struct kobj_attribute sys_ipl_ccw_loadparm_attr = | 471 | static struct kobj_attribute sys_ipl_ccw_loadparm_attr = |
488 | __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL); | 472 | __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL); |
489 | 473 | ||
474 | static struct attribute *ipl_fcp_attrs[] = { | ||
475 | &sys_ipl_type_attr.attr, | ||
476 | &sys_ipl_device_attr.attr, | ||
477 | &sys_ipl_fcp_wwpn_attr.attr, | ||
478 | &sys_ipl_fcp_lun_attr.attr, | ||
479 | &sys_ipl_fcp_bootprog_attr.attr, | ||
480 | &sys_ipl_fcp_br_lba_attr.attr, | ||
481 | &sys_ipl_ccw_loadparm_attr.attr, | ||
482 | NULL, | ||
483 | }; | ||
484 | |||
485 | static struct attribute_group ipl_fcp_attr_group = { | ||
486 | .attrs = ipl_fcp_attrs, | ||
487 | }; | ||
488 | |||
489 | /* CCW ipl device attributes */ | ||
490 | |||
490 | static struct attribute *ipl_ccw_attrs_vm[] = { | 491 | static struct attribute *ipl_ccw_attrs_vm[] = { |
491 | &sys_ipl_type_attr.attr, | 492 | &sys_ipl_type_attr.attr, |
492 | &sys_ipl_device_attr.attr, | 493 | &sys_ipl_device_attr.attr, |
@@ -765,28 +766,10 @@ DEFINE_IPL_ATTR_RW(reipl_fcp, br_lba, "%lld\n", "%lld\n", | |||
765 | DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n", | 766 | DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n", |
766 | reipl_block_fcp->ipl_info.fcp.devno); | 767 | reipl_block_fcp->ipl_info.fcp.devno); |
767 | 768 | ||
768 | static struct attribute *reipl_fcp_attrs[] = { | ||
769 | &sys_reipl_fcp_device_attr.attr, | ||
770 | &sys_reipl_fcp_wwpn_attr.attr, | ||
771 | &sys_reipl_fcp_lun_attr.attr, | ||
772 | &sys_reipl_fcp_bootprog_attr.attr, | ||
773 | &sys_reipl_fcp_br_lba_attr.attr, | ||
774 | NULL, | ||
775 | }; | ||
776 | |||
777 | static struct attribute_group reipl_fcp_attr_group = { | ||
778 | .attrs = reipl_fcp_attrs, | ||
779 | }; | ||
780 | |||
781 | /* CCW reipl device attributes */ | ||
782 | |||
783 | DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n", | ||
784 | reipl_block_ccw->ipl_info.ccw.devno); | ||
785 | |||
786 | static void reipl_get_ascii_loadparm(char *loadparm, | 769 | static void reipl_get_ascii_loadparm(char *loadparm, |
787 | struct ipl_parameter_block *ibp) | 770 | struct ipl_parameter_block *ibp) |
788 | { | 771 | { |
789 | memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); | 772 | memcpy(loadparm, ibp->hdr.loadparm, LOADPARM_LEN); |
790 | EBCASC(loadparm, LOADPARM_LEN); | 773 | EBCASC(loadparm, LOADPARM_LEN); |
791 | loadparm[LOADPARM_LEN] = 0; | 774 | loadparm[LOADPARM_LEN] = 0; |
792 | strim(loadparm); | 775 | strim(loadparm); |
@@ -821,13 +804,50 @@ static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb, | |||
821 | return -EINVAL; | 804 | return -EINVAL; |
822 | } | 805 | } |
823 | /* initialize loadparm with blanks */ | 806 | /* initialize loadparm with blanks */ |
824 | memset(ipb->ipl_info.ccw.load_parm, ' ', LOADPARM_LEN); | 807 | memset(ipb->hdr.loadparm, ' ', LOADPARM_LEN); |
825 | /* copy and convert to ebcdic */ | 808 | /* copy and convert to ebcdic */ |
826 | memcpy(ipb->ipl_info.ccw.load_parm, buf, lp_len); | 809 | memcpy(ipb->hdr.loadparm, buf, lp_len); |
827 | ASCEBC(ipb->ipl_info.ccw.load_parm, LOADPARM_LEN); | 810 | ASCEBC(ipb->hdr.loadparm, LOADPARM_LEN); |
828 | return len; | 811 | return len; |
829 | } | 812 | } |
830 | 813 | ||
814 | /* FCP wrapper */ | ||
815 | static ssize_t reipl_fcp_loadparm_show(struct kobject *kobj, | ||
816 | struct kobj_attribute *attr, char *page) | ||
817 | { | ||
818 | return reipl_generic_loadparm_show(reipl_block_fcp, page); | ||
819 | } | ||
820 | |||
821 | static ssize_t reipl_fcp_loadparm_store(struct kobject *kobj, | ||
822 | struct kobj_attribute *attr, | ||
823 | const char *buf, size_t len) | ||
824 | { | ||
825 | return reipl_generic_loadparm_store(reipl_block_fcp, buf, len); | ||
826 | } | ||
827 | |||
828 | static struct kobj_attribute sys_reipl_fcp_loadparm_attr = | ||
829 | __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_fcp_loadparm_show, | ||
830 | reipl_fcp_loadparm_store); | ||
831 | |||
832 | static struct attribute *reipl_fcp_attrs[] = { | ||
833 | &sys_reipl_fcp_device_attr.attr, | ||
834 | &sys_reipl_fcp_wwpn_attr.attr, | ||
835 | &sys_reipl_fcp_lun_attr.attr, | ||
836 | &sys_reipl_fcp_bootprog_attr.attr, | ||
837 | &sys_reipl_fcp_br_lba_attr.attr, | ||
838 | &sys_reipl_fcp_loadparm_attr.attr, | ||
839 | NULL, | ||
840 | }; | ||
841 | |||
842 | static struct attribute_group reipl_fcp_attr_group = { | ||
843 | .attrs = reipl_fcp_attrs, | ||
844 | }; | ||
845 | |||
846 | /* CCW reipl device attributes */ | ||
847 | |||
848 | DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n", | ||
849 | reipl_block_ccw->ipl_info.ccw.devno); | ||
850 | |||
831 | /* NSS wrapper */ | 851 | /* NSS wrapper */ |
832 | static ssize_t reipl_nss_loadparm_show(struct kobject *kobj, | 852 | static ssize_t reipl_nss_loadparm_show(struct kobject *kobj, |
833 | struct kobj_attribute *attr, char *page) | 853 | struct kobj_attribute *attr, char *page) |
@@ -1125,11 +1145,10 @@ static void reipl_block_ccw_fill_parms(struct ipl_parameter_block *ipb) | |||
1125 | /* LOADPARM */ | 1145 | /* LOADPARM */ |
1126 | /* check if read scp info worked and set loadparm */ | 1146 | /* check if read scp info worked and set loadparm */ |
1127 | if (sclp_ipl_info.is_valid) | 1147 | if (sclp_ipl_info.is_valid) |
1128 | memcpy(ipb->ipl_info.ccw.load_parm, | 1148 | memcpy(ipb->hdr.loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); |
1129 | &sclp_ipl_info.loadparm, LOADPARM_LEN); | ||
1130 | else | 1149 | else |
1131 | /* read scp info failed: set empty loadparm (EBCDIC blanks) */ | 1150 | /* read scp info failed: set empty loadparm (EBCDIC blanks) */ |
1132 | memset(ipb->ipl_info.ccw.load_parm, 0x40, LOADPARM_LEN); | 1151 | memset(ipb->hdr.loadparm, 0x40, LOADPARM_LEN); |
1133 | ipb->hdr.flags = DIAG308_FLAGS_LP_VALID; | 1152 | ipb->hdr.flags = DIAG308_FLAGS_LP_VALID; |
1134 | 1153 | ||
1135 | /* VM PARM */ | 1154 | /* VM PARM */ |
@@ -1251,9 +1270,16 @@ static int __init reipl_fcp_init(void) | |||
1251 | return rc; | 1270 | return rc; |
1252 | } | 1271 | } |
1253 | 1272 | ||
1254 | if (ipl_info.type == IPL_TYPE_FCP) | 1273 | if (ipl_info.type == IPL_TYPE_FCP) { |
1255 | memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); | 1274 | memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); |
1256 | else { | 1275 | /* |
1276 | * Fix loadparm: There are systems where the (SCSI) LOADPARM | ||
1277 | * is invalid in the SCSI IPL parameter block, so take it | ||
1278 | * always from sclp_ipl_info. | ||
1279 | */ | ||
1280 | memcpy(reipl_block_fcp->hdr.loadparm, sclp_ipl_info.loadparm, | ||
1281 | LOADPARM_LEN); | ||
1282 | } else { | ||
1257 | reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; | 1283 | reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; |
1258 | reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; | 1284 | reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; |
1259 | reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; | 1285 | reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; |
@@ -1864,7 +1890,23 @@ static void __init shutdown_actions_init(void) | |||
1864 | 1890 | ||
1865 | static int __init s390_ipl_init(void) | 1891 | static int __init s390_ipl_init(void) |
1866 | { | 1892 | { |
1893 | char str[8] = {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; | ||
1894 | |||
1867 | sclp_get_ipl_info(&sclp_ipl_info); | 1895 | sclp_get_ipl_info(&sclp_ipl_info); |
1896 | /* | ||
1897 | * Fix loadparm: There are systems where the (SCSI) LOADPARM | ||
1898 | * returned by read SCP info is invalid (contains EBCDIC blanks) | ||
1899 | * when the system has been booted via diag308. In that case we use | ||
1900 | * the value from diag308, if available. | ||
1901 | * | ||
1902 | * There are also systems where diag308 store does not work in | ||
1903 | * case the system is booted from HMC. Fortunately in this case | ||
1904 | * READ SCP info provides the correct value. | ||
1905 | */ | ||
1906 | if (memcmp(sclp_ipl_info.loadparm, str, sizeof(str)) == 0 && | ||
1907 | diag308_set_works) | ||
1908 | memcpy(sclp_ipl_info.loadparm, ipl_block.hdr.loadparm, | ||
1909 | LOADPARM_LEN); | ||
1868 | shutdown_actions_init(); | 1910 | shutdown_actions_init(); |
1869 | shutdown_triggers_init(); | 1911 | shutdown_triggers_init(); |
1870 | return 0; | 1912 | return 0; |
@@ -2060,6 +2102,13 @@ void s390_reset_system(void (*func)(void *), void *data) | |||
2060 | S390_lowcore.program_new_psw.addr = | 2102 | S390_lowcore.program_new_psw.addr = |
2061 | PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; | 2103 | PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; |
2062 | 2104 | ||
2105 | /* | ||
2106 | * Clear subchannel ID and number to signal new kernel that no CCW or | ||
2107 | * SCSI IPL has been done (for kexec and kdump) | ||
2108 | */ | ||
2109 | S390_lowcore.subchannel_id = 0; | ||
2110 | S390_lowcore.subchannel_nr = 0; | ||
2111 | |||
2063 | /* Store status at absolute zero */ | 2112 | /* Store status at absolute zero */ |
2064 | store_status(); | 2113 | store_status(); |
2065 | 2114 | ||
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index ae1d5be7dd88..82bc113e8c1d 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/stddef.h> | 24 | #include <linux/stddef.h> |
25 | #include <linux/unistd.h> | 25 | #include <linux/unistd.h> |
26 | #include <linux/ptrace.h> | 26 | #include <linux/ptrace.h> |
27 | #include <linux/random.h> | ||
27 | #include <linux/user.h> | 28 | #include <linux/user.h> |
28 | #include <linux/tty.h> | 29 | #include <linux/tty.h> |
29 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
@@ -61,6 +62,7 @@ | |||
61 | #include <asm/diag.h> | 62 | #include <asm/diag.h> |
62 | #include <asm/os_info.h> | 63 | #include <asm/os_info.h> |
63 | #include <asm/sclp.h> | 64 | #include <asm/sclp.h> |
65 | #include <asm/sysinfo.h> | ||
64 | #include "entry.h" | 66 | #include "entry.h" |
65 | 67 | ||
66 | /* | 68 | /* |
@@ -766,6 +768,7 @@ static void __init setup_hwcaps(void) | |||
766 | #endif | 768 | #endif |
767 | 769 | ||
768 | get_cpu_id(&cpu_id); | 770 | get_cpu_id(&cpu_id); |
771 | add_device_randomness(&cpu_id, sizeof(cpu_id)); | ||
769 | switch (cpu_id.machine) { | 772 | switch (cpu_id.machine) { |
770 | case 0x9672: | 773 | case 0x9672: |
771 | #if !defined(CONFIG_64BIT) | 774 | #if !defined(CONFIG_64BIT) |
@@ -804,6 +807,19 @@ static void __init setup_hwcaps(void) | |||
804 | } | 807 | } |
805 | 808 | ||
806 | /* | 809 | /* |
810 | * Add system information as device randomness | ||
811 | */ | ||
812 | static void __init setup_randomness(void) | ||
813 | { | ||
814 | struct sysinfo_3_2_2 *vmms; | ||
815 | |||
816 | vmms = (struct sysinfo_3_2_2 *) alloc_page(GFP_KERNEL); | ||
817 | if (vmms && stsi(vmms, 3, 2, 2) == 0 && vmms->count) | ||
818 | add_device_randomness(&vmms, vmms->count); | ||
819 | free_page((unsigned long) vmms); | ||
820 | } | ||
821 | |||
822 | /* | ||
807 | * Setup function called from init/main.c just after the banner | 823 | * Setup function called from init/main.c just after the banner |
808 | * was printed. | 824 | * was printed. |
809 | */ | 825 | */ |
@@ -901,6 +917,9 @@ void __init setup_arch(char **cmdline_p) | |||
901 | 917 | ||
902 | /* Setup zfcpdump support */ | 918 | /* Setup zfcpdump support */ |
903 | setup_zfcpdump(); | 919 | setup_zfcpdump(); |
920 | |||
921 | /* Add system specific data to the random pool */ | ||
922 | setup_randomness(); | ||
904 | } | 923 | } |
905 | 924 | ||
906 | #ifdef CONFIG_32BIT | 925 | #ifdef CONFIG_32BIT |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index fe5cdf29a001..6fe886ac2db5 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -356,3 +356,6 @@ SYSCALL(sys_finit_module,sys_finit_module,compat_sys_finit_module) | |||
356 | SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */ | 356 | SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */ |
357 | SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr) | 357 | SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr) |
358 | SYSCALL(sys_renameat2,sys_renameat2,compat_sys_renameat2) | 358 | SYSCALL(sys_renameat2,sys_renameat2,compat_sys_renameat2) |
359 | SYSCALL(sys_seccomp,sys_seccomp,compat_sys_seccomp) | ||
360 | SYSCALL(sys_getrandom,sys_getrandom,compat_sys_getrandom) | ||
361 | SYSCALL(sys_memfd_create,sys_memfd_create,compat_sys_memfd_create) /* 350 */ | ||
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S index 65fc3979c2f1..7cf18f8d4cb4 100644 --- a/arch/s390/kernel/vdso32/clock_gettime.S +++ b/arch/s390/kernel/vdso32/clock_gettime.S | |||
@@ -22,13 +22,11 @@ __kernel_clock_gettime: | |||
22 | basr %r5,0 | 22 | basr %r5,0 |
23 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ | 23 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ |
24 | chi %r2,__CLOCK_REALTIME | 24 | chi %r2,__CLOCK_REALTIME |
25 | je 10f | 25 | je 11f |
26 | chi %r2,__CLOCK_MONOTONIC | 26 | chi %r2,__CLOCK_MONOTONIC |
27 | jne 19f | 27 | jne 19f |
28 | 28 | ||
29 | /* CLOCK_MONOTONIC */ | 29 | /* CLOCK_MONOTONIC */ |
30 | ltr %r3,%r3 | ||
31 | jz 9f /* tp == NULL */ | ||
32 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 30 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
33 | tml %r4,0x0001 /* pending update ? loop */ | 31 | tml %r4,0x0001 /* pending update ? loop */ |
34 | jnz 1b | 32 | jnz 1b |
@@ -67,12 +65,10 @@ __kernel_clock_gettime: | |||
67 | j 6b | 65 | j 6b |
68 | 8: st %r2,0(%r3) /* store tp->tv_sec */ | 66 | 8: st %r2,0(%r3) /* store tp->tv_sec */ |
69 | st %r1,4(%r3) /* store tp->tv_nsec */ | 67 | st %r1,4(%r3) /* store tp->tv_nsec */ |
70 | 9: lhi %r2,0 | 68 | lhi %r2,0 |
71 | br %r14 | 69 | br %r14 |
72 | 70 | ||
73 | /* CLOCK_REALTIME */ | 71 | /* CLOCK_REALTIME */ |
74 | 10: ltr %r3,%r3 /* tp == NULL */ | ||
75 | jz 18f | ||
76 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 72 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
77 | tml %r4,0x0001 /* pending update ? loop */ | 73 | tml %r4,0x0001 /* pending update ? loop */ |
78 | jnz 11b | 74 | jnz 11b |
@@ -111,7 +107,7 @@ __kernel_clock_gettime: | |||
111 | j 15b | 107 | j 15b |
112 | 17: st %r2,0(%r3) /* store tp->tv_sec */ | 108 | 17: st %r2,0(%r3) /* store tp->tv_sec */ |
113 | st %r1,4(%r3) /* store tp->tv_nsec */ | 109 | st %r1,4(%r3) /* store tp->tv_nsec */ |
114 | 18: lhi %r2,0 | 110 | lhi %r2,0 |
115 | br %r14 | 111 | br %r14 |
116 | 112 | ||
117 | /* Fallback to system call */ | 113 | /* Fallback to system call */ |
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S index 91940ed33a4a..3f34e09db5f4 100644 --- a/arch/s390/kernel/vdso64/clock_gettime.S +++ b/arch/s390/kernel/vdso64/clock_gettime.S | |||
@@ -21,7 +21,7 @@ __kernel_clock_gettime: | |||
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | larl %r5,_vdso_data | 22 | larl %r5,_vdso_data |
23 | cghi %r2,__CLOCK_REALTIME | 23 | cghi %r2,__CLOCK_REALTIME |
24 | je 4f | 24 | je 5f |
25 | cghi %r2,__CLOCK_THREAD_CPUTIME_ID | 25 | cghi %r2,__CLOCK_THREAD_CPUTIME_ID |
26 | je 9f | 26 | je 9f |
27 | cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */ | 27 | cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */ |
@@ -30,8 +30,6 @@ __kernel_clock_gettime: | |||
30 | jne 12f | 30 | jne 12f |
31 | 31 | ||
32 | /* CLOCK_MONOTONIC */ | 32 | /* CLOCK_MONOTONIC */ |
33 | ltgr %r3,%r3 | ||
34 | jz 3f /* tp == NULL */ | ||
35 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 33 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
36 | tmll %r4,0x0001 /* pending update ? loop */ | 34 | tmll %r4,0x0001 /* pending update ? loop */ |
37 | jnz 0b | 35 | jnz 0b |
@@ -53,12 +51,10 @@ __kernel_clock_gettime: | |||
53 | j 1b | 51 | j 1b |
54 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ | 52 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ |
55 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 53 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
56 | 3: lghi %r2,0 | 54 | lghi %r2,0 |
57 | br %r14 | 55 | br %r14 |
58 | 56 | ||
59 | /* CLOCK_REALTIME */ | 57 | /* CLOCK_REALTIME */ |
60 | 4: ltr %r3,%r3 /* tp == NULL */ | ||
61 | jz 8f | ||
62 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 58 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
63 | tmll %r4,0x0001 /* pending update ? loop */ | 59 | tmll %r4,0x0001 /* pending update ? loop */ |
64 | jnz 5b | 60 | jnz 5b |
@@ -80,7 +76,7 @@ __kernel_clock_gettime: | |||
80 | j 6b | 76 | j 6b |
81 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ | 77 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ |
82 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 78 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
83 | 8: lghi %r2,0 | 79 | lghi %r2,0 |
84 | br %r14 | 80 | br %r14 |
85 | 81 | ||
86 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ | 82 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index ce81eb2ab76a..81b0e11521e4 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -1317,19 +1317,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1317 | return -EINVAL; | 1317 | return -EINVAL; |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | switch (kvm_run->exit_reason) { | ||
1321 | case KVM_EXIT_S390_SIEIC: | ||
1322 | case KVM_EXIT_UNKNOWN: | ||
1323 | case KVM_EXIT_INTR: | ||
1324 | case KVM_EXIT_S390_RESET: | ||
1325 | case KVM_EXIT_S390_UCONTROL: | ||
1326 | case KVM_EXIT_S390_TSCH: | ||
1327 | case KVM_EXIT_DEBUG: | ||
1328 | break; | ||
1329 | default: | ||
1330 | BUG(); | ||
1331 | } | ||
1332 | |||
1333 | vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask; | 1320 | vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask; |
1334 | vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr; | 1321 | vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr; |
1335 | if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX) { | 1322 | if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX) { |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 0c1073ed1e84..c7235e01fd67 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -43,6 +43,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); | |||
43 | 43 | ||
44 | unsigned long empty_zero_page, zero_page_mask; | 44 | unsigned long empty_zero_page, zero_page_mask; |
45 | EXPORT_SYMBOL(empty_zero_page); | 45 | EXPORT_SYMBOL(empty_zero_page); |
46 | EXPORT_SYMBOL(zero_page_mask); | ||
46 | 47 | ||
47 | static void __init setup_zero_pages(void) | 48 | static void __init setup_zero_pages(void) |
48 | { | 49 | { |
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 19daa53a3da4..5404a6261db9 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -986,11 +986,21 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, | |||
986 | pte_t *ptep; | 986 | pte_t *ptep; |
987 | 987 | ||
988 | down_read(&mm->mmap_sem); | 988 | down_read(&mm->mmap_sem); |
989 | retry: | ||
989 | ptep = get_locked_pte(current->mm, addr, &ptl); | 990 | ptep = get_locked_pte(current->mm, addr, &ptl); |
990 | if (unlikely(!ptep)) { | 991 | if (unlikely(!ptep)) { |
991 | up_read(&mm->mmap_sem); | 992 | up_read(&mm->mmap_sem); |
992 | return -EFAULT; | 993 | return -EFAULT; |
993 | } | 994 | } |
995 | if (!(pte_val(*ptep) & _PAGE_INVALID) && | ||
996 | (pte_val(*ptep) & _PAGE_PROTECT)) { | ||
997 | pte_unmap_unlock(*ptep, ptl); | ||
998 | if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE)) { | ||
999 | up_read(&mm->mmap_sem); | ||
1000 | return -EFAULT; | ||
1001 | } | ||
1002 | goto retry; | ||
1003 | } | ||
994 | 1004 | ||
995 | new = old = pgste_get_lock(ptep); | 1005 | new = old = pgste_get_lock(ptep); |
996 | pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT | | 1006 | pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT | |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 453fa5c09550..244fb4c81e25 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -172,6 +172,7 @@ menu "System type" | |||
172 | # | 172 | # |
173 | config CPU_SH2 | 173 | config CPU_SH2 |
174 | bool | 174 | bool |
175 | select SH_INTC | ||
175 | 176 | ||
176 | config CPU_SH2A | 177 | config CPU_SH2A |
177 | bool | 178 | bool |
@@ -182,6 +183,7 @@ config CPU_SH3 | |||
182 | bool | 183 | bool |
183 | select CPU_HAS_INTEVT | 184 | select CPU_HAS_INTEVT |
184 | select CPU_HAS_SR_RB | 185 | select CPU_HAS_SR_RB |
186 | select SH_INTC | ||
185 | select SYS_SUPPORTS_SH_TMU | 187 | select SYS_SUPPORTS_SH_TMU |
186 | 188 | ||
187 | config CPU_SH4 | 189 | config CPU_SH4 |
@@ -189,6 +191,7 @@ config CPU_SH4 | |||
189 | select CPU_HAS_INTEVT | 191 | select CPU_HAS_INTEVT |
190 | select CPU_HAS_SR_RB | 192 | select CPU_HAS_SR_RB |
191 | select CPU_HAS_FPU if !CPU_SH4AL_DSP | 193 | select CPU_HAS_FPU if !CPU_SH4AL_DSP |
194 | select SH_INTC | ||
192 | select SYS_SUPPORTS_SH_TMU | 195 | select SYS_SUPPORTS_SH_TMU |
193 | select SYS_SUPPORTS_HUGETLBFS if MMU | 196 | select SYS_SUPPORTS_HUGETLBFS if MMU |
194 | 197 | ||
@@ -595,8 +598,6 @@ source kernel/Kconfig.hz | |||
595 | config KEXEC | 598 | config KEXEC |
596 | bool "kexec system call (EXPERIMENTAL)" | 599 | bool "kexec system call (EXPERIMENTAL)" |
597 | depends on SUPERH32 && MMU | 600 | depends on SUPERH32 && MMU |
598 | select CRYPTO | ||
599 | select CRYPTO_SHA256 | ||
600 | help | 601 | help |
601 | kexec is a system call that implements the ability to shutdown your | 602 | kexec is a system call that implements the ability to shutdown your |
602 | current kernel, and to start another kernel. It is like a reboot | 603 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/sh/configs/sdk7780_defconfig b/arch/sh/configs/sdk7780_defconfig index 6a96b9a2f7a5..bbd4c2298708 100644 --- a/arch/sh/configs/sdk7780_defconfig +++ b/arch/sh/configs/sdk7780_defconfig | |||
@@ -30,6 +30,7 @@ CONFIG_PCI_DEBUG=y | |||
30 | CONFIG_PCCARD=y | 30 | CONFIG_PCCARD=y |
31 | CONFIG_YENTA=y | 31 | CONFIG_YENTA=y |
32 | CONFIG_HOTPLUG_PCI=y | 32 | CONFIG_HOTPLUG_PCI=y |
33 | CONFIG_NET=y | ||
33 | CONFIG_PACKET=y | 34 | CONFIG_PACKET=y |
34 | CONFIG_UNIX=y | 35 | CONFIG_UNIX=y |
35 | CONFIG_INET=y | 36 | CONFIG_INET=y |
diff --git a/arch/sh/configs/sh2007_defconfig b/arch/sh/configs/sh2007_defconfig index e741b1e36acd..df25ae774ee0 100644 --- a/arch/sh/configs/sh2007_defconfig +++ b/arch/sh/configs/sh2007_defconfig | |||
@@ -25,6 +25,7 @@ CONFIG_CMDLINE_OVERWRITE=y | |||
25 | CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1" | 25 | CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1" |
26 | CONFIG_PCCARD=y | 26 | CONFIG_PCCARD=y |
27 | CONFIG_BINFMT_MISC=y | 27 | CONFIG_BINFMT_MISC=y |
28 | CONFIG_NET=y | ||
28 | CONFIG_PACKET=y | 29 | CONFIG_PACKET=y |
29 | CONFIG_UNIX=y | 30 | CONFIG_UNIX=y |
30 | CONFIG_XFRM_USER=y | 31 | CONFIG_XFRM_USER=y |
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index 097c2cdd117f..f770e3992620 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c | |||
@@ -229,6 +229,7 @@ void flush_icache_range(unsigned long start, unsigned long end) | |||
229 | 229 | ||
230 | cacheop_on_each_cpu(local_flush_icache_range, (void *)&data, 1); | 230 | cacheop_on_each_cpu(local_flush_icache_range, (void *)&data, 1); |
231 | } | 231 | } |
232 | EXPORT_SYMBOL(flush_icache_range); | ||
232 | 233 | ||
233 | void flush_icache_page(struct vm_area_struct *vma, struct page *page) | 234 | void flush_icache_page(struct vm_area_struct *vma, struct page *page) |
234 | { | 235 | { |
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c index bf8daf9d9c9b..37458f38b220 100644 --- a/arch/sh/mm/gup.c +++ b/arch/sh/mm/gup.c | |||
@@ -105,6 +105,8 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, | |||
105 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); | 105 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); |
106 | page = pte_page(pte); | 106 | page = pte_page(pte); |
107 | get_page(page); | 107 | get_page(page); |
108 | __flush_anon_page(page, addr); | ||
109 | flush_dcache_page(page); | ||
108 | pages[*nr] = page; | 110 | pages[*nr] = page; |
109 | (*nr)++; | 111 | (*nr)++; |
110 | 112 | ||
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig index 9d8521b8c854..6b68f12f29db 100644 --- a/arch/sparc/configs/sparc64_defconfig +++ b/arch/sparc/configs/sparc64_defconfig | |||
@@ -29,6 +29,7 @@ CONFIG_PCI=y | |||
29 | CONFIG_PCI_MSI=y | 29 | CONFIG_PCI_MSI=y |
30 | CONFIG_SUN_OPENPROMFS=m | 30 | CONFIG_SUN_OPENPROMFS=m |
31 | CONFIG_BINFMT_MISC=m | 31 | CONFIG_BINFMT_MISC=m |
32 | CONFIG_NET=y | ||
32 | CONFIG_PACKET=y | 33 | CONFIG_PACKET=y |
33 | CONFIG_UNIX=y | 34 | CONFIG_UNIX=y |
34 | CONFIG_XFRM_USER=m | 35 | CONFIG_XFRM_USER=m |
diff --git a/arch/sparc/net/bpf_jit_asm.S b/arch/sparc/net/bpf_jit_asm.S index 9d016c7017f7..8c83f4b8eb15 100644 --- a/arch/sparc/net/bpf_jit_asm.S +++ b/arch/sparc/net/bpf_jit_asm.S | |||
@@ -6,10 +6,12 @@ | |||
6 | #define SAVE_SZ 176 | 6 | #define SAVE_SZ 176 |
7 | #define SCRATCH_OFF STACK_BIAS + 128 | 7 | #define SCRATCH_OFF STACK_BIAS + 128 |
8 | #define BE_PTR(label) be,pn %xcc, label | 8 | #define BE_PTR(label) be,pn %xcc, label |
9 | #define SIGN_EXTEND(reg) sra reg, 0, reg | ||
9 | #else | 10 | #else |
10 | #define SAVE_SZ 96 | 11 | #define SAVE_SZ 96 |
11 | #define SCRATCH_OFF 72 | 12 | #define SCRATCH_OFF 72 |
12 | #define BE_PTR(label) be label | 13 | #define BE_PTR(label) be label |
14 | #define SIGN_EXTEND(reg) | ||
13 | #endif | 15 | #endif |
14 | 16 | ||
15 | #define SKF_MAX_NEG_OFF (-0x200000) /* SKF_LL_OFF from filter.h */ | 17 | #define SKF_MAX_NEG_OFF (-0x200000) /* SKF_LL_OFF from filter.h */ |
@@ -135,6 +137,7 @@ bpf_slow_path_byte_msh: | |||
135 | save %sp, -SAVE_SZ, %sp; \ | 137 | save %sp, -SAVE_SZ, %sp; \ |
136 | mov %i0, %o0; \ | 138 | mov %i0, %o0; \ |
137 | mov r_OFF, %o1; \ | 139 | mov r_OFF, %o1; \ |
140 | SIGN_EXTEND(%o1); \ | ||
138 | call bpf_internal_load_pointer_neg_helper; \ | 141 | call bpf_internal_load_pointer_neg_helper; \ |
139 | mov (LEN), %o2; \ | 142 | mov (LEN), %o2; \ |
140 | mov %o0, r_TMP; \ | 143 | mov %o0, r_TMP; \ |
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c index 1f76c22a6a75..ece4af0575e9 100644 --- a/arch/sparc/net/bpf_jit_comp.c +++ b/arch/sparc/net/bpf_jit_comp.c | |||
@@ -184,7 +184,7 @@ do { \ | |||
184 | */ | 184 | */ |
185 | #define emit_alu_K(OPCODE, K) \ | 185 | #define emit_alu_K(OPCODE, K) \ |
186 | do { \ | 186 | do { \ |
187 | if (K) { \ | 187 | if (K || OPCODE == AND || OPCODE == MUL) { \ |
188 | unsigned int _insn = OPCODE; \ | 188 | unsigned int _insn = OPCODE; \ |
189 | _insn |= RS1(r_A) | RD(r_A); \ | 189 | _insn |= RS1(r_A) | RD(r_A); \ |
190 | if (is_simm13(K)) { \ | 190 | if (is_simm13(K)) { \ |
@@ -234,12 +234,18 @@ do { BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u8)); \ | |||
234 | __emit_load8(BASE, STRUCT, FIELD, DEST); \ | 234 | __emit_load8(BASE, STRUCT, FIELD, DEST); \ |
235 | } while (0) | 235 | } while (0) |
236 | 236 | ||
237 | #define emit_ldmem(OFF, DEST) \ | 237 | #ifdef CONFIG_SPARC64 |
238 | do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(DEST); \ | 238 | #define BIAS (STACK_BIAS - 4) |
239 | #else | ||
240 | #define BIAS (-4) | ||
241 | #endif | ||
242 | |||
243 | #define emit_ldmem(OFF, DEST) \ | ||
244 | do { *prog++ = LD32I | RS1(SP) | S13(BIAS - (OFF)) | RD(DEST); \ | ||
239 | } while (0) | 245 | } while (0) |
240 | 246 | ||
241 | #define emit_stmem(OFF, SRC) \ | 247 | #define emit_stmem(OFF, SRC) \ |
242 | do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(SRC); \ | 248 | do { *prog++ = ST32I | RS1(SP) | S13(BIAS - (OFF)) | RD(SRC); \ |
243 | } while (0) | 249 | } while (0) |
244 | 250 | ||
245 | #ifdef CONFIG_SMP | 251 | #ifdef CONFIG_SMP |
@@ -615,10 +621,11 @@ void bpf_jit_compile(struct bpf_prog *fp) | |||
615 | case BPF_ANC | SKF_AD_VLAN_TAG: | 621 | case BPF_ANC | SKF_AD_VLAN_TAG: |
616 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: | 622 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
617 | emit_skb_load16(vlan_tci, r_A); | 623 | emit_skb_load16(vlan_tci, r_A); |
618 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { | 624 | if (code != (BPF_ANC | SKF_AD_VLAN_TAG)) { |
619 | emit_andi(r_A, VLAN_VID_MASK, r_A); | 625 | emit_alu_K(SRL, 12); |
626 | emit_andi(r_A, 1, r_A); | ||
620 | } else { | 627 | } else { |
621 | emit_loadimm(VLAN_TAG_PRESENT, r_TMP); | 628 | emit_loadimm(~VLAN_TAG_PRESENT, r_TMP); |
622 | emit_and(r_A, r_TMP, r_A); | 629 | emit_and(r_A, r_TMP, r_A); |
623 | } | 630 | } |
624 | break; | 631 | break; |
@@ -630,15 +637,19 @@ void bpf_jit_compile(struct bpf_prog *fp) | |||
630 | emit_loadimm(K, r_X); | 637 | emit_loadimm(K, r_X); |
631 | break; | 638 | break; |
632 | case BPF_LD | BPF_MEM: | 639 | case BPF_LD | BPF_MEM: |
640 | seen |= SEEN_MEM; | ||
633 | emit_ldmem(K * 4, r_A); | 641 | emit_ldmem(K * 4, r_A); |
634 | break; | 642 | break; |
635 | case BPF_LDX | BPF_MEM: | 643 | case BPF_LDX | BPF_MEM: |
644 | seen |= SEEN_MEM | SEEN_XREG; | ||
636 | emit_ldmem(K * 4, r_X); | 645 | emit_ldmem(K * 4, r_X); |
637 | break; | 646 | break; |
638 | case BPF_ST: | 647 | case BPF_ST: |
648 | seen |= SEEN_MEM; | ||
639 | emit_stmem(K * 4, r_A); | 649 | emit_stmem(K * 4, r_A); |
640 | break; | 650 | break; |
641 | case BPF_STX: | 651 | case BPF_STX: |
652 | seen |= SEEN_MEM | SEEN_XREG; | ||
642 | emit_stmem(K * 4, r_X); | 653 | emit_stmem(K * 4, r_X); |
643 | break; | 654 | break; |
644 | 655 | ||
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index a3ffe2dd4832..7fcd492adbfc 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -191,8 +191,6 @@ source "kernel/Kconfig.hz" | |||
191 | 191 | ||
192 | config KEXEC | 192 | config KEXEC |
193 | bool "kexec system call" | 193 | bool "kexec system call" |
194 | select CRYPTO | ||
195 | select CRYPTO_SHA256 | ||
196 | ---help--- | 194 | ---help--- |
197 | kexec is a system call that implements the ability to shutdown your | 195 | kexec is a system call that implements the ability to shutdown your |
198 | current kernel, and to start another kernel. It is like a reboot | 196 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c index 01e8ab29f43a..19eaa62d456a 100644 --- a/arch/tile/kernel/smp.c +++ b/arch/tile/kernel/smp.c | |||
@@ -183,6 +183,7 @@ void flush_icache_range(unsigned long start, unsigned long end) | |||
183 | preempt_enable(); | 183 | preempt_enable(); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | EXPORT_SYMBOL(flush_icache_range); | ||
186 | 187 | ||
187 | 188 | ||
188 | /* Called when smp_send_reschedule() triggers IRQ_RESCHEDULE. */ | 189 | /* Called when smp_send_reschedule() triggers IRQ_RESCHEDULE. */ |
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c index 780d77388dec..7c8fb7018dc6 100644 --- a/arch/unicore32/kernel/signal.c +++ b/arch/unicore32/kernel/signal.c | |||
@@ -254,7 +254,8 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set, | |||
254 | 254 | ||
255 | err |= setup_sigframe(frame, regs, set); | 255 | err |= setup_sigframe(frame, regs, set); |
256 | if (err == 0) | 256 | if (err == 0) |
257 | err |= setup_return(regs, &ksig->ka, frame->retcode, frame, usig); | 257 | err |= setup_return(regs, &ksig->ka, frame->retcode, frame, |
258 | ksig->sig); | ||
258 | 259 | ||
259 | return err; | 260 | return err; |
260 | } | 261 | } |
@@ -276,7 +277,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, | |||
276 | err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp); | 277 | err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp); |
277 | err |= setup_sigframe(&frame->sig, regs, set); | 278 | err |= setup_sigframe(&frame->sig, regs, set); |
278 | if (err == 0) | 279 | if (err == 0) |
279 | err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig); | 280 | err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, |
281 | ksig->sig); | ||
280 | 282 | ||
281 | if (err == 0) { | 283 | if (err == 0) { |
282 | /* | 284 | /* |
@@ -303,7 +305,6 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs, | |||
303 | int syscall) | 305 | int syscall) |
304 | { | 306 | { |
305 | struct thread_info *thread = current_thread_info(); | 307 | struct thread_info *thread = current_thread_info(); |
306 | struct task_struct *tsk = current; | ||
307 | sigset_t *oldset = sigmask_to_save(); | 308 | sigset_t *oldset = sigmask_to_save(); |
308 | int usig = ksig->sig; | 309 | int usig = ksig->sig; |
309 | int ret; | 310 | int ret; |
@@ -373,7 +374,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
373 | if (!user_mode(regs)) | 374 | if (!user_mode(regs)) |
374 | return; | 375 | return; |
375 | 376 | ||
376 | if (get_signsl(&ksig)) { | 377 | if (get_signal(&ksig)) { |
377 | handle_signal(&ksig, regs, syscall); | 378 | handle_signal(&ksig, regs, syscall); |
378 | return; | 379 | return; |
379 | } | 380 | } |
diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild index 61b6d51866f8..3942f74c92d7 100644 --- a/arch/x86/Kbuild +++ b/arch/x86/Kbuild | |||
@@ -17,6 +17,4 @@ obj-$(CONFIG_IA32_EMULATION) += ia32/ | |||
17 | obj-y += platform/ | 17 | obj-y += platform/ |
18 | obj-y += net/ | 18 | obj-y += net/ |
19 | 19 | ||
20 | ifeq ($(CONFIG_X86_64),y) | 20 | obj-$(CONFIG_KEXEC_FILE) += purgatory/ |
21 | obj-$(CONFIG_KEXEC) += purgatory/ | ||
22 | endif | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5d0bf1aa9dcb..36327438caf0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -23,6 +23,7 @@ config X86 | |||
23 | def_bool y | 23 | def_bool y |
24 | select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI | 24 | select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI |
25 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | 25 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS |
26 | select ARCH_HAS_FAST_MULTIPLIER | ||
26 | select ARCH_MIGHT_HAVE_PC_PARPORT | 27 | select ARCH_MIGHT_HAVE_PC_PARPORT |
27 | select ARCH_MIGHT_HAVE_PC_SERIO | 28 | select ARCH_MIGHT_HAVE_PC_SERIO |
28 | select HAVE_AOUT if X86_32 | 29 | select HAVE_AOUT if X86_32 |
@@ -1585,9 +1586,6 @@ source kernel/Kconfig.hz | |||
1585 | 1586 | ||
1586 | config KEXEC | 1587 | config KEXEC |
1587 | bool "kexec system call" | 1588 | bool "kexec system call" |
1588 | select BUILD_BIN2C | ||
1589 | select CRYPTO | ||
1590 | select CRYPTO_SHA256 | ||
1591 | ---help--- | 1589 | ---help--- |
1592 | kexec is a system call that implements the ability to shutdown your | 1590 | kexec is a system call that implements the ability to shutdown your |
1593 | current kernel, and to start another kernel. It is like a reboot | 1591 | current kernel, and to start another kernel. It is like a reboot |
@@ -1602,9 +1600,22 @@ config KEXEC | |||
1602 | interface is strongly in flux, so no good recommendation can be | 1600 | interface is strongly in flux, so no good recommendation can be |
1603 | made. | 1601 | made. |
1604 | 1602 | ||
1603 | config KEXEC_FILE | ||
1604 | bool "kexec file based system call" | ||
1605 | select BUILD_BIN2C | ||
1606 | depends on KEXEC | ||
1607 | depends on X86_64 | ||
1608 | depends on CRYPTO=y | ||
1609 | depends on CRYPTO_SHA256=y | ||
1610 | ---help--- | ||
1611 | This is new version of kexec system call. This system call is | ||
1612 | file based and takes file descriptors as system call argument | ||
1613 | for kernel and initramfs as opposed to list of segments as | ||
1614 | accepted by previous system call. | ||
1615 | |||
1605 | config KEXEC_VERIFY_SIG | 1616 | config KEXEC_VERIFY_SIG |
1606 | bool "Verify kernel signature during kexec_file_load() syscall" | 1617 | bool "Verify kernel signature during kexec_file_load() syscall" |
1607 | depends on KEXEC | 1618 | depends on KEXEC_FILE |
1608 | ---help--- | 1619 | ---help--- |
1609 | This option makes kernel signature verification mandatory for | 1620 | This option makes kernel signature verification mandatory for |
1610 | kexec_file_load() syscall. If kernel is signature can not be | 1621 | kexec_file_load() syscall. If kernel is signature can not be |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index c1aa36887843..60087ca37679 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -184,11 +184,8 @@ archheaders: | |||
184 | $(Q)$(MAKE) $(build)=arch/x86/syscalls all | 184 | $(Q)$(MAKE) $(build)=arch/x86/syscalls all |
185 | 185 | ||
186 | archprepare: | 186 | archprepare: |
187 | ifeq ($(CONFIG_KEXEC),y) | 187 | ifeq ($(CONFIG_KEXEC_FILE),y) |
188 | # Build only for 64bit. No loaders for 32bit yet. | ||
189 | ifeq ($(CONFIG_X86_64),y) | ||
190 | $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c | 188 | $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c |
191 | endif | ||
192 | endif | 189 | endif |
193 | 190 | ||
194 | ### | 191 | ### |
@@ -254,6 +251,7 @@ archclean: | |||
254 | $(Q)rm -rf $(objtree)/arch/x86_64 | 251 | $(Q)rm -rf $(objtree)/arch/x86_64 |
255 | $(Q)$(MAKE) $(clean)=$(boot) | 252 | $(Q)$(MAKE) $(clean)=$(boot) |
256 | $(Q)$(MAKE) $(clean)=arch/x86/tools | 253 | $(Q)$(MAKE) $(clean)=arch/x86/tools |
254 | $(Q)$(MAKE) $(clean)=arch/x86/purgatory | ||
257 | 255 | ||
258 | PHONY += kvmconfig | 256 | PHONY += kvmconfig |
259 | kvmconfig: | 257 | kvmconfig: |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 7a801a310e37..0fcd9133790c 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -33,8 +33,7 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ | |||
33 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone | 33 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone |
34 | 34 | ||
35 | ifeq ($(CONFIG_EFI_STUB), y) | 35 | ifeq ($(CONFIG_EFI_STUB), y) |
36 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \ | 36 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o |
37 | $(objtree)/drivers/firmware/efi/libstub/lib.a | ||
38 | endif | 37 | endif |
39 | 38 | ||
40 | $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE | 39 | $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE |
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index fc6091abedb7..d39189ba7f8e 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c | |||
@@ -183,12 +183,27 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size, | |||
183 | static 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 | struct setup_data *ptr; | ||
186 | 187 | ||
187 | for (i = 0; i < MEM_AVOID_MAX; i++) { | 188 | for (i = 0; i < MEM_AVOID_MAX; i++) { |
188 | if (mem_overlaps(img, &mem_avoid[i])) | 189 | if (mem_overlaps(img, &mem_avoid[i])) |
189 | return true; | 190 | return true; |
190 | } | 191 | } |
191 | 192 | ||
193 | /* Avoid all entries in the setup_data linked list. */ | ||
194 | ptr = (struct setup_data *)(unsigned long)real_mode->hdr.setup_data; | ||
195 | while (ptr) { | ||
196 | struct mem_vector avoid; | ||
197 | |||
198 | avoid.start = (u64)ptr; | ||
199 | avoid.size = sizeof(*ptr) + ptr->len; | ||
200 | |||
201 | if (mem_overlaps(img, &avoid)) | ||
202 | return true; | ||
203 | |||
204 | ptr = (struct setup_data *)(unsigned long)ptr->next; | ||
205 | } | ||
206 | |||
192 | return false; | 207 | return false; |
193 | } | 208 | } |
194 | 209 | ||
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index f277184e2ac1..de8eebd6f67c 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -19,7 +19,10 @@ | |||
19 | 19 | ||
20 | static efi_system_table_t *sys_table; | 20 | static efi_system_table_t *sys_table; |
21 | 21 | ||
22 | struct efi_config *efi_early; | 22 | static struct efi_config *efi_early; |
23 | |||
24 | #define efi_call_early(f, ...) \ | ||
25 | efi_early->call(efi_early->f, __VA_ARGS__); | ||
23 | 26 | ||
24 | #define BOOT_SERVICES(bits) \ | 27 | #define BOOT_SERVICES(bits) \ |
25 | static void setup_boot_services##bits(struct efi_config *c) \ | 28 | static void setup_boot_services##bits(struct efi_config *c) \ |
@@ -265,21 +268,25 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str) | |||
265 | 268 | ||
266 | offset = offsetof(typeof(*out), output_string); | 269 | offset = offsetof(typeof(*out), output_string); |
267 | output_string = efi_early->text_output + offset; | 270 | output_string = efi_early->text_output + offset; |
271 | out = (typeof(out))(unsigned long)efi_early->text_output; | ||
268 | func = (u64 *)output_string; | 272 | func = (u64 *)output_string; |
269 | 273 | ||
270 | efi_early->call(*func, efi_early->text_output, str); | 274 | efi_early->call(*func, out, str); |
271 | } else { | 275 | } else { |
272 | struct efi_simple_text_output_protocol_32 *out; | 276 | struct efi_simple_text_output_protocol_32 *out; |
273 | u32 *func; | 277 | u32 *func; |
274 | 278 | ||
275 | offset = offsetof(typeof(*out), output_string); | 279 | offset = offsetof(typeof(*out), output_string); |
276 | output_string = efi_early->text_output + offset; | 280 | output_string = efi_early->text_output + offset; |
281 | out = (typeof(out))(unsigned long)efi_early->text_output; | ||
277 | func = (u32 *)output_string; | 282 | func = (u32 *)output_string; |
278 | 283 | ||
279 | efi_early->call(*func, efi_early->text_output, str); | 284 | efi_early->call(*func, out, str); |
280 | } | 285 | } |
281 | } | 286 | } |
282 | 287 | ||
288 | #include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c" | ||
289 | |||
283 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) | 290 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) |
284 | { | 291 | { |
285 | u8 first, len; | 292 | u8 first, len; |
@@ -360,7 +367,7 @@ free_struct: | |||
360 | return status; | 367 | return status; |
361 | } | 368 | } |
362 | 369 | ||
363 | static efi_status_t | 370 | static void |
364 | setup_efi_pci32(struct boot_params *params, void **pci_handle, | 371 | setup_efi_pci32(struct boot_params *params, void **pci_handle, |
365 | unsigned long size) | 372 | unsigned long size) |
366 | { | 373 | { |
@@ -403,8 +410,6 @@ setup_efi_pci32(struct boot_params *params, void **pci_handle, | |||
403 | data = (struct setup_data *)rom; | 410 | data = (struct setup_data *)rom; |
404 | 411 | ||
405 | } | 412 | } |
406 | |||
407 | return status; | ||
408 | } | 413 | } |
409 | 414 | ||
410 | static efi_status_t | 415 | static efi_status_t |
@@ -463,7 +468,7 @@ free_struct: | |||
463 | 468 | ||
464 | } | 469 | } |
465 | 470 | ||
466 | static efi_status_t | 471 | static void |
467 | setup_efi_pci64(struct boot_params *params, void **pci_handle, | 472 | setup_efi_pci64(struct boot_params *params, void **pci_handle, |
468 | unsigned long size) | 473 | unsigned long size) |
469 | { | 474 | { |
@@ -506,11 +511,18 @@ setup_efi_pci64(struct boot_params *params, void **pci_handle, | |||
506 | data = (struct setup_data *)rom; | 511 | data = (struct setup_data *)rom; |
507 | 512 | ||
508 | } | 513 | } |
509 | |||
510 | return status; | ||
511 | } | 514 | } |
512 | 515 | ||
513 | static efi_status_t setup_efi_pci(struct boot_params *params) | 516 | /* |
517 | * There's no way to return an informative status from this function, | ||
518 | * because any analysis (and printing of error messages) needs to be | ||
519 | * done directly at the EFI function call-site. | ||
520 | * | ||
521 | * For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we | ||
522 | * just didn't find any PCI devices, but there's no way to tell outside | ||
523 | * the context of the call. | ||
524 | */ | ||
525 | static void setup_efi_pci(struct boot_params *params) | ||
514 | { | 526 | { |
515 | efi_status_t status; | 527 | efi_status_t status; |
516 | void **pci_handle = NULL; | 528 | void **pci_handle = NULL; |
@@ -527,7 +539,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params) | |||
527 | size, (void **)&pci_handle); | 539 | size, (void **)&pci_handle); |
528 | 540 | ||
529 | if (status != EFI_SUCCESS) | 541 | if (status != EFI_SUCCESS) |
530 | return status; | 542 | return; |
531 | 543 | ||
532 | status = efi_call_early(locate_handle, | 544 | status = efi_call_early(locate_handle, |
533 | EFI_LOCATE_BY_PROTOCOL, &pci_proto, | 545 | EFI_LOCATE_BY_PROTOCOL, &pci_proto, |
@@ -538,13 +550,12 @@ static efi_status_t setup_efi_pci(struct boot_params *params) | |||
538 | goto free_handle; | 550 | goto free_handle; |
539 | 551 | ||
540 | if (efi_early->is64) | 552 | if (efi_early->is64) |
541 | status = setup_efi_pci64(params, pci_handle, size); | 553 | setup_efi_pci64(params, pci_handle, size); |
542 | else | 554 | else |
543 | status = setup_efi_pci32(params, pci_handle, size); | 555 | setup_efi_pci32(params, pci_handle, size); |
544 | 556 | ||
545 | free_handle: | 557 | free_handle: |
546 | efi_call_early(free_pool, pci_handle); | 558 | efi_call_early(free_pool, pci_handle); |
547 | return status; | ||
548 | } | 559 | } |
549 | 560 | ||
550 | static void | 561 | static void |
@@ -1032,7 +1043,6 @@ struct boot_params *make_boot_params(struct efi_config *c) | |||
1032 | int i; | 1043 | int i; |
1033 | unsigned long ramdisk_addr; | 1044 | unsigned long ramdisk_addr; |
1034 | unsigned long ramdisk_size; | 1045 | unsigned long ramdisk_size; |
1035 | unsigned long initrd_addr_max; | ||
1036 | 1046 | ||
1037 | efi_early = c; | 1047 | efi_early = c; |
1038 | sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; | 1048 | sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; |
@@ -1095,15 +1105,20 @@ struct boot_params *make_boot_params(struct efi_config *c) | |||
1095 | 1105 | ||
1096 | memset(sdt, 0, sizeof(*sdt)); | 1106 | memset(sdt, 0, sizeof(*sdt)); |
1097 | 1107 | ||
1098 | if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) | ||
1099 | initrd_addr_max = -1UL; | ||
1100 | else | ||
1101 | initrd_addr_max = hdr->initrd_addr_max; | ||
1102 | |||
1103 | status = handle_cmdline_files(sys_table, image, | 1108 | status = handle_cmdline_files(sys_table, image, |
1104 | (char *)(unsigned long)hdr->cmd_line_ptr, | 1109 | (char *)(unsigned long)hdr->cmd_line_ptr, |
1105 | "initrd=", initrd_addr_max, | 1110 | "initrd=", hdr->initrd_addr_max, |
1106 | &ramdisk_addr, &ramdisk_size); | 1111 | &ramdisk_addr, &ramdisk_size); |
1112 | |||
1113 | if (status != EFI_SUCCESS && | ||
1114 | hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) { | ||
1115 | efi_printk(sys_table, "Trying to load files to higher address\n"); | ||
1116 | status = handle_cmdline_files(sys_table, image, | ||
1117 | (char *)(unsigned long)hdr->cmd_line_ptr, | ||
1118 | "initrd=", -1UL, | ||
1119 | &ramdisk_addr, &ramdisk_size); | ||
1120 | } | ||
1121 | |||
1107 | if (status != EFI_SUCCESS) | 1122 | if (status != EFI_SUCCESS) |
1108 | goto fail2; | 1123 | goto fail2; |
1109 | hdr->ramdisk_image = ramdisk_addr & 0xffffffff; | 1124 | hdr->ramdisk_image = ramdisk_addr & 0xffffffff; |
@@ -1376,10 +1391,7 @@ struct boot_params *efi_main(struct efi_config *c, | |||
1376 | 1391 | ||
1377 | setup_graphics(boot_params); | 1392 | setup_graphics(boot_params); |
1378 | 1393 | ||
1379 | status = setup_efi_pci(boot_params); | 1394 | setup_efi_pci(boot_params); |
1380 | if (status != EFI_SUCCESS) { | ||
1381 | efi_printk(sys_table, "setup_efi_pci() failed!\n"); | ||
1382 | } | ||
1383 | 1395 | ||
1384 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, | 1396 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, |
1385 | sizeof(*gdt), (void **)&gdt); | 1397 | sizeof(*gdt), (void **)&gdt); |
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h index d487e727f1ec..c88c31ecad12 100644 --- a/arch/x86/boot/compressed/eboot.h +++ b/arch/x86/boot/compressed/eboot.h | |||
@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol { | |||
103 | void *blt; | 103 | void *blt; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | struct efi_config { | ||
107 | u64 image_handle; | ||
108 | u64 table; | ||
109 | u64 allocate_pool; | ||
110 | u64 allocate_pages; | ||
111 | u64 get_memory_map; | ||
112 | u64 free_pool; | ||
113 | u64 free_pages; | ||
114 | u64 locate_handle; | ||
115 | u64 handle_protocol; | ||
116 | u64 exit_boot_services; | ||
117 | u64 text_output; | ||
118 | efi_status_t (*call)(unsigned long, ...); | ||
119 | bool is64; | ||
120 | } __packed; | ||
121 | |||
106 | #endif /* BOOT_COMPRESSED_EBOOT_H */ | 122 | #endif /* BOOT_COMPRESSED_EBOOT_H */ |
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index 888950f29fd9..a7ccd57f19e4 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
@@ -481,7 +481,7 @@ static void ctr_crypt_final(struct crypto_aes_ctx *ctx, | |||
481 | crypto_inc(ctrblk, AES_BLOCK_SIZE); | 481 | crypto_inc(ctrblk, AES_BLOCK_SIZE); |
482 | } | 482 | } |
483 | 483 | ||
484 | #ifdef CONFIG_AS_AVX | 484 | #if 0 /* temporary disabled due to failing crypto tests */ |
485 | static void aesni_ctr_enc_avx_tfm(struct crypto_aes_ctx *ctx, u8 *out, | 485 | static void aesni_ctr_enc_avx_tfm(struct crypto_aes_ctx *ctx, u8 *out, |
486 | const u8 *in, unsigned int len, u8 *iv) | 486 | const u8 *in, unsigned int len, u8 *iv) |
487 | { | 487 | { |
@@ -1522,7 +1522,7 @@ static int __init aesni_init(void) | |||
1522 | aesni_gcm_dec_tfm = aesni_gcm_dec; | 1522 | aesni_gcm_dec_tfm = aesni_gcm_dec; |
1523 | } | 1523 | } |
1524 | aesni_ctr_enc_tfm = aesni_ctr_enc; | 1524 | aesni_ctr_enc_tfm = aesni_ctr_enc; |
1525 | #ifdef CONFIG_AS_AVX | 1525 | #if 0 /* temporary disabled due to failing crypto tests */ |
1526 | if (cpu_has_avx) { | 1526 | if (cpu_has_avx) { |
1527 | /* optimize performance of ctr mode encryption transform */ | 1527 | /* optimize performance of ctr mode encryption transform */ |
1528 | aesni_ctr_enc_tfm = aesni_ctr_enc_avx_tfm; | 1528 | aesni_ctr_enc_tfm = aesni_ctr_enc_avx_tfm; |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index afcd35d331de..cfe3b954d5e4 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -497,8 +497,6 @@ static __always_inline int fls64(__u64 x) | |||
497 | 497 | ||
498 | #include <asm-generic/bitops/sched.h> | 498 | #include <asm-generic/bitops/sched.h> |
499 | 499 | ||
500 | #define ARCH_HAS_FAST_MULTIPLIER 1 | ||
501 | |||
502 | #include <asm/arch_hweight.h> | 500 | #include <asm/arch_hweight.h> |
503 | 501 | ||
504 | #include <asm-generic/bitops/const_hweight.h> | 502 | #include <asm-generic/bitops/const_hweight.h> |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 044a2fd3c5fe..0ec241ede5a2 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map( | |||
159 | } | 159 | } |
160 | #endif /* CONFIG_EFI_MIXED */ | 160 | #endif /* CONFIG_EFI_MIXED */ |
161 | 161 | ||
162 | |||
163 | /* arch specific definitions used by the stub code */ | ||
164 | |||
165 | struct efi_config { | ||
166 | u64 image_handle; | ||
167 | u64 table; | ||
168 | u64 allocate_pool; | ||
169 | u64 allocate_pages; | ||
170 | u64 get_memory_map; | ||
171 | u64 free_pool; | ||
172 | u64 free_pages; | ||
173 | u64 locate_handle; | ||
174 | u64 handle_protocol; | ||
175 | u64 exit_boot_services; | ||
176 | u64 text_output; | ||
177 | efi_status_t (*call)(unsigned long, ...); | ||
178 | bool is64; | ||
179 | } __packed; | ||
180 | |||
181 | extern struct efi_config *efi_early; | ||
182 | |||
183 | #define efi_call_early(f, ...) \ | ||
184 | efi_early->call(efi_early->f, __VA_ARGS__); | ||
185 | |||
186 | extern bool efi_reboot_required(void); | 162 | extern bool efi_reboot_required(void); |
187 | 163 | ||
188 | #else | 164 | #else |
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index b0910f97a3ea..ffb1733ac91f 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h | |||
@@ -106,14 +106,14 @@ enum fixed_addresses { | |||
106 | __end_of_permanent_fixed_addresses, | 106 | __end_of_permanent_fixed_addresses, |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * 256 temporary boot-time mappings, used by early_ioremap(), | 109 | * 512 temporary boot-time mappings, used by early_ioremap(), |
110 | * before ioremap() is functional. | 110 | * before ioremap() is functional. |
111 | * | 111 | * |
112 | * If necessary we round it up to the next 256 pages boundary so | 112 | * If necessary we round it up to the next 512 pages boundary so |
113 | * that we can have a single pgd entry and a single pte table: | 113 | * that we can have a single pgd entry and a single pte table: |
114 | */ | 114 | */ |
115 | #define NR_FIX_BTMAPS 64 | 115 | #define NR_FIX_BTMAPS 64 |
116 | #define FIX_BTMAPS_SLOTS 4 | 116 | #define FIX_BTMAPS_SLOTS 8 |
117 | #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) | 117 | #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) |
118 | FIX_BTMAP_END = | 118 | FIX_BTMAP_END = |
119 | (__end_of_permanent_fixed_addresses ^ | 119 | (__end_of_permanent_fixed_addresses ^ |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 0aeed5ca356e..1733ab49ac5e 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -227,6 +227,8 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned | |||
227 | 227 | ||
228 | extern void io_apic_eoi(unsigned int apic, unsigned int vector); | 228 | extern void io_apic_eoi(unsigned int apic, unsigned int vector); |
229 | 229 | ||
230 | extern bool mp_should_keep_irq(struct device *dev); | ||
231 | |||
230 | #else /* !CONFIG_X86_IO_APIC */ | 232 | #else /* !CONFIG_X86_IO_APIC */ |
231 | 233 | ||
232 | #define io_apic_assign_pci_irqs 0 | 234 | #define io_apic_assign_pci_irqs 0 |
@@ -237,6 +239,7 @@ static inline int mp_find_ioapic(u32 gsi) { return 0; } | |||
237 | static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } | 239 | static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } |
238 | static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } | 240 | static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } |
239 | static inline void mp_unmap_irq(int irq) { } | 241 | static inline void mp_unmap_irq(int irq) { } |
242 | static inline bool mp_should_keep_irq(struct device *dev) { return 1; } | ||
240 | 243 | ||
241 | static inline int save_ioapic_entries(void) | 244 | static inline int save_ioapic_entries(void) |
242 | { | 245 | { |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 572460175ba5..7c492ed9087b 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -95,7 +95,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) | |||
95 | #define KVM_REFILL_PAGES 25 | 95 | #define KVM_REFILL_PAGES 25 |
96 | #define KVM_MAX_CPUID_ENTRIES 80 | 96 | #define KVM_MAX_CPUID_ENTRIES 80 |
97 | #define KVM_NR_FIXED_MTRR_REGION 88 | 97 | #define KVM_NR_FIXED_MTRR_REGION 88 |
98 | #define KVM_NR_VAR_MTRR 10 | 98 | #define KVM_NR_VAR_MTRR 8 |
99 | 99 | ||
100 | #define ASYNC_PF_PER_VCPU 64 | 100 | #define ASYNC_PF_PER_VCPU 64 |
101 | 101 | ||
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 0ec056012618..aa97a070f09f 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -131,8 +131,13 @@ static inline int pte_exec(pte_t pte) | |||
131 | 131 | ||
132 | static inline int pte_special(pte_t pte) | 132 | static inline int pte_special(pte_t pte) |
133 | { | 133 | { |
134 | return (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_SPECIAL)) == | 134 | /* |
135 | (_PAGE_PRESENT|_PAGE_SPECIAL); | 135 | * See CONFIG_NUMA_BALANCING pte_numa in include/asm-generic/pgtable.h. |
136 | * On x86 we have _PAGE_BIT_NUMA == _PAGE_BIT_GLOBAL+1 == | ||
137 | * __PAGE_BIT_SOFTW1 == _PAGE_BIT_SPECIAL. | ||
138 | */ | ||
139 | return (pte_flags(pte) & _PAGE_SPECIAL) && | ||
140 | (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_PROTNONE)); | ||
136 | } | 141 | } |
137 | 142 | ||
138 | static inline unsigned long pte_pfn(pte_t pte) | 143 | static inline unsigned long pte_pfn(pte_t pte) |
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index 5be9063545d2..3874693c0e53 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -19,6 +19,7 @@ extern pud_t level3_ident_pgt[512]; | |||
19 | extern pmd_t level2_kernel_pgt[512]; | 19 | extern pmd_t level2_kernel_pgt[512]; |
20 | extern pmd_t level2_fixmap_pgt[512]; | 20 | extern pmd_t level2_fixmap_pgt[512]; |
21 | extern pmd_t level2_ident_pgt[512]; | 21 | extern pmd_t level2_ident_pgt[512]; |
22 | extern pte_t level1_fixmap_pgt[512]; | ||
22 | extern pgd_t init_level4_pgt[]; | 23 | extern pgd_t init_level4_pgt[]; |
23 | 24 | ||
24 | #define swapper_pg_dir init_level4_pgt | 25 | #define swapper_pg_dir init_level4_pgt |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index b5ea75c4a4b4..ada2e2d6be3e 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -71,6 +71,7 @@ obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o | |||
71 | obj-$(CONFIG_X86_TSC) += trace_clock.o | 71 | obj-$(CONFIG_X86_TSC) += trace_clock.o |
72 | obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o | 72 | obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o |
73 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o | 73 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o |
74 | obj-$(CONFIG_KEXEC_FILE) += kexec-bzimage64.o | ||
74 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o | 75 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o |
75 | obj-y += kprobes/ | 76 | obj-y += kprobes/ |
76 | obj-$(CONFIG_MODULES) += module.o | 77 | obj-$(CONFIG_MODULES) += module.o |
@@ -118,5 +119,4 @@ ifeq ($(CONFIG_X86_64),y) | |||
118 | 119 | ||
119 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o | 120 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o |
120 | obj-y += vsmp_64.o | 121 | obj-y += vsmp_64.o |
121 | obj-$(CONFIG_KEXEC) += kexec-bzimage64.o | ||
122 | endif | 122 | endif |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 29290f554e79..337ce5a9b15c 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -1070,6 +1070,11 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, | |||
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | if (flags & IOAPIC_MAP_ALLOC) { | 1072 | if (flags & IOAPIC_MAP_ALLOC) { |
1073 | /* special handling for legacy IRQs */ | ||
1074 | if (irq < nr_legacy_irqs() && info->count == 1 && | ||
1075 | mp_irqdomain_map(domain, irq, pin) != 0) | ||
1076 | irq = -1; | ||
1077 | |||
1073 | if (irq > 0) | 1078 | if (irq > 0) |
1074 | info->count++; | 1079 | info->count++; |
1075 | else if (info->count == 0) | 1080 | else if (info->count == 0) |
@@ -3896,7 +3901,15 @@ int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, | |||
3896 | info->polarity = 1; | 3901 | info->polarity = 1; |
3897 | } | 3902 | } |
3898 | info->node = NUMA_NO_NODE; | 3903 | info->node = NUMA_NO_NODE; |
3899 | info->set = 1; | 3904 | |
3905 | /* | ||
3906 | * setup_IO_APIC_irqs() programs all legacy IRQs with default | ||
3907 | * trigger and polarity attributes. Don't set the flag for that | ||
3908 | * case so the first legacy IRQ user could reprogram the pin | ||
3909 | * with real trigger and polarity attributes. | ||
3910 | */ | ||
3911 | if (virq >= nr_legacy_irqs() || info->count) | ||
3912 | info->set = 1; | ||
3900 | } | 3913 | } |
3901 | set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger, | 3914 | set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger, |
3902 | info->polarity); | 3915 | info->polarity); |
@@ -3946,6 +3959,18 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node) | |||
3946 | return ret; | 3959 | return ret; |
3947 | } | 3960 | } |
3948 | 3961 | ||
3962 | bool mp_should_keep_irq(struct device *dev) | ||
3963 | { | ||
3964 | if (dev->power.is_prepared) | ||
3965 | return true; | ||
3966 | #ifdef CONFIG_PM_RUNTIME | ||
3967 | if (dev->power.runtime_status == RPM_SUSPENDING) | ||
3968 | return true; | ||
3969 | #endif | ||
3970 | |||
3971 | return false; | ||
3972 | } | ||
3973 | |||
3949 | /* Enable IOAPIC early just for system timer */ | 3974 | /* Enable IOAPIC early just for system timer */ |
3950 | void __init pre_init_apic_IRQ0(void) | 3975 | void __init pre_init_apic_IRQ0(void) |
3951 | { | 3976 | { |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 0553a34fa0df..a618fcd2c07d 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
@@ -182,8 +182,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs) | |||
182 | crash_save_cpu(regs, safe_smp_processor_id()); | 182 | crash_save_cpu(regs, safe_smp_processor_id()); |
183 | } | 183 | } |
184 | 184 | ||
185 | #ifdef CONFIG_X86_64 | 185 | #ifdef CONFIG_KEXEC_FILE |
186 | |||
187 | static int get_nr_ram_ranges_callback(unsigned long start_pfn, | 186 | static int get_nr_ram_ranges_callback(unsigned long start_pfn, |
188 | unsigned long nr_pfn, void *arg) | 187 | unsigned long nr_pfn, void *arg) |
189 | { | 188 | { |
@@ -696,5 +695,4 @@ int crash_load_segments(struct kimage *image) | |||
696 | 695 | ||
697 | return ret; | 696 | return ret; |
698 | } | 697 | } |
699 | 698 | #endif /* CONFIG_KEXEC_FILE */ | |
700 | #endif /* CONFIG_X86_64 */ | ||
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 47c410d99f5d..4b0e1dfa2226 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -683,7 +683,7 @@ END(syscall_badsys) | |||
683 | sysenter_badsys: | 683 | sysenter_badsys: |
684 | movl $-ENOSYS,%eax | 684 | movl $-ENOSYS,%eax |
685 | jmp sysenter_after_call | 685 | jmp sysenter_after_call |
686 | END(syscall_badsys) | 686 | END(sysenter_badsys) |
687 | CFI_ENDPROC | 687 | CFI_ENDPROC |
688 | 688 | ||
689 | .macro FIXUP_ESPFIX_STACK | 689 | .macro FIXUP_ESPFIX_STACK |
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 1e6cff5814fa..44f1ed42fdf2 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c | |||
@@ -203,7 +203,7 @@ void __init native_init_IRQ(void) | |||
203 | set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); | 203 | set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); |
204 | } | 204 | } |
205 | 205 | ||
206 | if (!acpi_ioapic && !of_ioapic) | 206 | if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) |
207 | setup_irq(2, &irq2); | 207 | setup_irq(2, &irq2); |
208 | 208 | ||
209 | #ifdef CONFIG_X86_32 | 209 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index f304773285ae..f1314d0bcf0a 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c | |||
@@ -338,8 +338,10 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op) | |||
338 | * a relative jump. | 338 | * a relative jump. |
339 | */ | 339 | */ |
340 | rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE; | 340 | rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE; |
341 | if (abs(rel) > 0x7fffffff) | 341 | if (abs(rel) > 0x7fffffff) { |
342 | __arch_remove_optimized_kprobe(op, 0); | ||
342 | return -ERANGE; | 343 | return -ERANGE; |
344 | } | ||
343 | 345 | ||
344 | buf = (u8 *)op->optinsn.insn; | 346 | buf = (u8 *)op->optinsn.insn; |
345 | 347 | ||
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 8b04018e5d1f..485981059a40 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c | |||
@@ -25,9 +25,11 @@ | |||
25 | #include <asm/debugreg.h> | 25 | #include <asm/debugreg.h> |
26 | #include <asm/kexec-bzimage64.h> | 26 | #include <asm/kexec-bzimage64.h> |
27 | 27 | ||
28 | #ifdef CONFIG_KEXEC_FILE | ||
28 | static struct kexec_file_ops *kexec_file_loaders[] = { | 29 | static struct kexec_file_ops *kexec_file_loaders[] = { |
29 | &kexec_bzImage64_ops, | 30 | &kexec_bzImage64_ops, |
30 | }; | 31 | }; |
32 | #endif | ||
31 | 33 | ||
32 | static void free_transition_pgtable(struct kimage *image) | 34 | static void free_transition_pgtable(struct kimage *image) |
33 | { | 35 | { |
@@ -178,6 +180,7 @@ static void load_segments(void) | |||
178 | ); | 180 | ); |
179 | } | 181 | } |
180 | 182 | ||
183 | #ifdef CONFIG_KEXEC_FILE | ||
181 | /* Update purgatory as needed after various image segments have been prepared */ | 184 | /* Update purgatory as needed after various image segments have been prepared */ |
182 | static int arch_update_purgatory(struct kimage *image) | 185 | static int arch_update_purgatory(struct kimage *image) |
183 | { | 186 | { |
@@ -209,6 +212,12 @@ static int arch_update_purgatory(struct kimage *image) | |||
209 | 212 | ||
210 | return ret; | 213 | return ret; |
211 | } | 214 | } |
215 | #else /* !CONFIG_KEXEC_FILE */ | ||
216 | static inline int arch_update_purgatory(struct kimage *image) | ||
217 | { | ||
218 | return 0; | ||
219 | } | ||
220 | #endif /* CONFIG_KEXEC_FILE */ | ||
212 | 221 | ||
213 | int machine_kexec_prepare(struct kimage *image) | 222 | int machine_kexec_prepare(struct kimage *image) |
214 | { | 223 | { |
@@ -329,6 +338,7 @@ void arch_crash_save_vmcoreinfo(void) | |||
329 | 338 | ||
330 | /* arch-dependent functionality related to kexec file-based syscall */ | 339 | /* arch-dependent functionality related to kexec file-based syscall */ |
331 | 340 | ||
341 | #ifdef CONFIG_KEXEC_FILE | ||
332 | int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, | 342 | int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, |
333 | unsigned long buf_len) | 343 | unsigned long buf_len) |
334 | { | 344 | { |
@@ -522,3 +532,4 @@ overflow: | |||
522 | (int)ELF64_R_TYPE(rel[i].r_info), value); | 532 | (int)ELF64_R_TYPE(rel[i].r_info), value); |
523 | return -ENOEXEC; | 533 | return -ENOEXEC; |
524 | } | 534 | } |
535 | #endif /* CONFIG_KEXEC_FILE */ | ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2d872e08fab9..42a2dca984b3 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1284,6 +1284,9 @@ static void remove_siblinginfo(int cpu) | |||
1284 | 1284 | ||
1285 | for_each_cpu(sibling, cpu_sibling_mask(cpu)) | 1285 | for_each_cpu(sibling, cpu_sibling_mask(cpu)) |
1286 | cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling)); | 1286 | cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling)); |
1287 | for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) | ||
1288 | cpumask_clear_cpu(cpu, cpu_llc_shared_mask(sibling)); | ||
1289 | cpumask_clear(cpu_llc_shared_mask(cpu)); | ||
1287 | cpumask_clear(cpu_sibling_mask(cpu)); | 1290 | cpumask_clear(cpu_sibling_mask(cpu)); |
1288 | cpumask_clear(cpu_core_mask(cpu)); | 1291 | cpumask_clear(cpu_core_mask(cpu)); |
1289 | c->phys_proc_id = 0; | 1292 | c->phys_proc_id = 0; |
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c index bf7ef5ce29df..0fa29609b2c4 100644 --- a/arch/x86/kernel/time.c +++ b/arch/x86/kernel/time.c | |||
@@ -68,6 +68,8 @@ static struct irqaction irq0 = { | |||
68 | 68 | ||
69 | void __init setup_default_timer_irq(void) | 69 | void __init setup_default_timer_irq(void) |
70 | { | 70 | { |
71 | if (!nr_legacy_irqs()) | ||
72 | return; | ||
71 | setup_irq(0, &irq0); | 73 | setup_irq(0, &irq0); |
72 | } | 74 | } |
73 | 75 | ||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 56657b0bb3bb..03954f7900f5 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -1491,9 +1491,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, | |||
1491 | goto exception; | 1491 | goto exception; |
1492 | break; | 1492 | break; |
1493 | case VCPU_SREG_CS: | 1493 | case VCPU_SREG_CS: |
1494 | if (in_task_switch && rpl != dpl) | ||
1495 | goto exception; | ||
1496 | |||
1497 | if (!(seg_desc.type & 8)) | 1494 | if (!(seg_desc.type & 8)) |
1498 | goto exception; | 1495 | goto exception; |
1499 | 1496 | ||
@@ -4394,8 +4391,11 @@ done_prefixes: | |||
4394 | 4391 | ||
4395 | ctxt->execute = opcode.u.execute; | 4392 | ctxt->execute = opcode.u.execute; |
4396 | 4393 | ||
4394 | if (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD))) | ||
4395 | return EMULATION_FAILED; | ||
4396 | |||
4397 | if (unlikely(ctxt->d & | 4397 | if (unlikely(ctxt->d & |
4398 | (NotImpl|EmulateOnUD|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) { | 4398 | (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) { |
4399 | /* | 4399 | /* |
4400 | * These are copied unconditionally here, and checked unconditionally | 4400 | * These are copied unconditionally here, and checked unconditionally |
4401 | * in x86_emulate_insn. | 4401 | * in x86_emulate_insn. |
@@ -4406,9 +4406,6 @@ done_prefixes: | |||
4406 | if (ctxt->d & NotImpl) | 4406 | if (ctxt->d & NotImpl) |
4407 | return EMULATION_FAILED; | 4407 | return EMULATION_FAILED; |
4408 | 4408 | ||
4409 | if (!(ctxt->d & EmulateOnUD) && ctxt->ud) | ||
4410 | return EMULATION_FAILED; | ||
4411 | |||
4412 | if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) | 4409 | if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) |
4413 | ctxt->op_bytes = 8; | 4410 | ctxt->op_bytes = 8; |
4414 | 4411 | ||
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 167ffcac16ed..95a427e57887 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c | |||
@@ -48,7 +48,9 @@ enum address_markers_idx { | |||
48 | LOW_KERNEL_NR, | 48 | LOW_KERNEL_NR, |
49 | VMALLOC_START_NR, | 49 | VMALLOC_START_NR, |
50 | VMEMMAP_START_NR, | 50 | VMEMMAP_START_NR, |
51 | # ifdef CONFIG_X86_ESPFIX64 | ||
51 | ESPFIX_START_NR, | 52 | ESPFIX_START_NR, |
53 | # endif | ||
52 | HIGH_KERNEL_NR, | 54 | HIGH_KERNEL_NR, |
53 | MODULES_VADDR_NR, | 55 | MODULES_VADDR_NR, |
54 | MODULES_END_NR, | 56 | MODULES_END_NR, |
@@ -71,7 +73,9 @@ static struct addr_marker address_markers[] = { | |||
71 | { PAGE_OFFSET, "Low Kernel Mapping" }, | 73 | { PAGE_OFFSET, "Low Kernel Mapping" }, |
72 | { VMALLOC_START, "vmalloc() Area" }, | 74 | { VMALLOC_START, "vmalloc() Area" }, |
73 | { VMEMMAP_START, "Vmemmap" }, | 75 | { VMEMMAP_START, "Vmemmap" }, |
76 | # ifdef CONFIG_X86_ESPFIX64 | ||
74 | { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, | 77 | { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, |
78 | # endif | ||
75 | { __START_KERNEL_map, "High Kernel Mapping" }, | 79 | { __START_KERNEL_map, "High Kernel Mapping" }, |
76 | { MODULES_VADDR, "Modules" }, | 80 | { MODULES_VADDR, "Modules" }, |
77 | { MODULES_END, "End Modules" }, | 81 | { MODULES_END, "End Modules" }, |
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c index 25e7e1372bb2..919b91205cd4 100644 --- a/arch/x86/mm/mmap.c +++ b/arch/x86/mm/mmap.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <asm/elf.h> | 32 | #include <asm/elf.h> |
33 | 33 | ||
34 | struct __read_mostly va_alignment va_align = { | 34 | struct va_alignment __read_mostly va_align = { |
35 | .flags = -1, | 35 | .flags = -1, |
36 | }; | 36 | }; |
37 | 37 | ||
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 1fe33987de02..ee61c36d64f8 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -49,7 +49,13 @@ void leave_mm(int cpu) | |||
49 | if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) { | 49 | if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) { |
50 | cpumask_clear_cpu(cpu, mm_cpumask(active_mm)); | 50 | cpumask_clear_cpu(cpu, mm_cpumask(active_mm)); |
51 | load_cr3(swapper_pg_dir); | 51 | load_cr3(swapper_pg_dir); |
52 | trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); | 52 | /* |
53 | * This gets called in the idle path where RCU | ||
54 | * functions differently. Tracing normally | ||
55 | * uses RCU, so we have to call the tracepoint | ||
56 | * specially here. | ||
57 | */ | ||
58 | trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); | ||
53 | } | 59 | } |
54 | } | 60 | } |
55 | EXPORT_SYMBOL_GPL(leave_mm); | 61 | EXPORT_SYMBOL_GPL(leave_mm); |
@@ -174,7 +180,7 @@ void flush_tlb_current_task(void) | |||
174 | * | 180 | * |
175 | * This is in units of pages. | 181 | * This is in units of pages. |
176 | */ | 182 | */ |
177 | unsigned long tlb_single_page_flush_ceiling = 33; | 183 | static unsigned long tlb_single_page_flush_ceiling __read_mostly = 33; |
178 | 184 | ||
179 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, | 185 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, |
180 | unsigned long end, unsigned long vmflag) | 186 | unsigned long end, unsigned long vmflag) |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index c61ea57d1ba1..9a2b7101ae8a 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -326,27 +326,6 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
326 | struct pci_bus *bus; | 326 | struct pci_bus *bus; |
327 | u16 config; | 327 | u16 config; |
328 | 328 | ||
329 | if (!vga_default_device()) { | ||
330 | resource_size_t start, end; | ||
331 | int i; | ||
332 | |||
333 | /* Does firmware framebuffer belong to us? */ | ||
334 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
335 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) | ||
336 | continue; | ||
337 | |||
338 | start = pci_resource_start(pdev, i); | ||
339 | end = pci_resource_end(pdev, i); | ||
340 | |||
341 | if (!start || !end) | ||
342 | continue; | ||
343 | |||
344 | if (screen_info.lfb_base >= start && | ||
345 | (screen_info.lfb_base + screen_info.lfb_size) < end) | ||
346 | vga_set_default_device(pdev); | ||
347 | } | ||
348 | } | ||
349 | |||
350 | /* Is VGA routed to us? */ | 329 | /* Is VGA routed to us? */ |
351 | bus = pdev->bus; | 330 | bus = pdev->bus; |
352 | while (bus) { | 331 | while (bus) { |
@@ -371,8 +350,7 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
371 | pci_read_config_word(pdev, PCI_COMMAND, &config); | 350 | pci_read_config_word(pdev, PCI_COMMAND, &config); |
372 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { | 351 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { |
373 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; | 352 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; |
374 | dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); | 353 | dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n"); |
375 | vga_set_default_device(pdev); | ||
376 | } | 354 | } |
377 | } | 355 | } |
378 | } | 356 | } |
diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c index 3865116c51fb..b9958c364075 100644 --- a/arch/x86/pci/intel_mid_pci.c +++ b/arch/x86/pci/intel_mid_pci.c | |||
@@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev) | |||
229 | 229 | ||
230 | static void intel_mid_pci_irq_disable(struct pci_dev *dev) | 230 | static void intel_mid_pci_irq_disable(struct pci_dev *dev) |
231 | { | 231 | { |
232 | if (!dev->dev.power.is_prepared && dev->irq > 0) | 232 | if (!mp_should_keep_irq(&dev->dev) && dev->irq > 0) |
233 | mp_unmap_irq(dev->irq); | 233 | mp_unmap_irq(dev->irq); |
234 | } | 234 | } |
235 | 235 | ||
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index bc1a2c341891..eb500c2592ad 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -1256,7 +1256,7 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1256 | 1256 | ||
1257 | static void pirq_disable_irq(struct pci_dev *dev) | 1257 | static void pirq_disable_irq(struct pci_dev *dev) |
1258 | { | 1258 | { |
1259 | if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && | 1259 | if (io_apic_assign_pci_irqs && !mp_should_keep_irq(&dev->dev) && |
1260 | dev->irq) { | 1260 | dev->irq) { |
1261 | mp_unmap_irq(dev->irq); | 1261 | mp_unmap_irq(dev->irq); |
1262 | dev->irq = 0; | 1262 | dev->irq = 0; |
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 7fde9ee438a4..899dd2454256 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile | |||
@@ -11,6 +11,7 @@ targets += purgatory.ro | |||
11 | # sure how to relocate those. Like kexec-tools, use custom flags. | 11 | # sure how to relocate those. Like kexec-tools, use custom flags. |
12 | 12 | ||
13 | KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large | 13 | KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large |
14 | KBUILD_CFLAGS += -m$(BITS) | ||
14 | 15 | ||
15 | $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE | 16 | $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE |
16 | $(call if_changed,ld) | 17 | $(call if_changed,ld) |
@@ -24,7 +25,4 @@ $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE | |||
24 | $(call if_changed,bin2c) | 25 | $(call if_changed,bin2c) |
25 | 26 | ||
26 | 27 | ||
27 | # No loaders for 32bits yet. | 28 | obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o |
28 | ifeq ($(CONFIG_X86_64),y) | ||
29 | obj-$(CONFIG_KEXEC) += kexec-purgatory.o | ||
30 | endif | ||
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index e8a1201c3293..16fb0099b7f2 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1866,12 +1866,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end, | |||
1866 | * | 1866 | * |
1867 | * We can construct this by grafting the Xen provided pagetable into | 1867 | * We can construct this by grafting the Xen provided pagetable into |
1868 | * head_64.S's preconstructed pagetables. We copy the Xen L2's into | 1868 | * head_64.S's preconstructed pagetables. We copy the Xen L2's into |
1869 | * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt. This | 1869 | * level2_ident_pgt, and level2_kernel_pgt. This means that only the |
1870 | * means that only the kernel has a physical mapping to start with - | 1870 | * kernel has a physical mapping to start with - but that's enough to |
1871 | * but that's enough to get __va working. We need to fill in the rest | 1871 | * get __va working. We need to fill in the rest of the physical |
1872 | * of the physical mapping once some sort of allocator has been set | 1872 | * mapping once some sort of allocator has been set up. NOTE: for |
1873 | * up. | 1873 | * PVH, the page tables are native. |
1874 | * NOTE: for PVH, the page tables are native. | ||
1875 | */ | 1874 | */ |
1876 | void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | 1875 | void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) |
1877 | { | 1876 | { |
@@ -1902,8 +1901,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1902 | /* L3_i[0] -> level2_ident_pgt */ | 1901 | /* L3_i[0] -> level2_ident_pgt */ |
1903 | convert_pfn_mfn(level3_ident_pgt); | 1902 | convert_pfn_mfn(level3_ident_pgt); |
1904 | /* L3_k[510] -> level2_kernel_pgt | 1903 | /* L3_k[510] -> level2_kernel_pgt |
1905 | * L3_i[511] -> level2_fixmap_pgt */ | 1904 | * L3_k[511] -> level2_fixmap_pgt */ |
1906 | convert_pfn_mfn(level3_kernel_pgt); | 1905 | convert_pfn_mfn(level3_kernel_pgt); |
1906 | |||
1907 | /* L3_k[511][506] -> level1_fixmap_pgt */ | ||
1908 | convert_pfn_mfn(level2_fixmap_pgt); | ||
1907 | } | 1909 | } |
1908 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ | 1910 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ |
1909 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); | 1911 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); |
@@ -1913,21 +1915,15 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1913 | addr[1] = (unsigned long)l3; | 1915 | addr[1] = (unsigned long)l3; |
1914 | addr[2] = (unsigned long)l2; | 1916 | addr[2] = (unsigned long)l2; |
1915 | /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: | 1917 | /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: |
1916 | * Both L4[272][0] and L4[511][511] have entries that point to the same | 1918 | * Both L4[272][0] and L4[511][510] have entries that point to the same |
1917 | * L2 (PMD) tables. Meaning that if you modify it in __va space | 1919 | * L2 (PMD) tables. Meaning that if you modify it in __va space |
1918 | * it will be also modified in the __ka space! (But if you just | 1920 | * it will be also modified in the __ka space! (But if you just |
1919 | * modify the PMD table to point to other PTE's or none, then you | 1921 | * modify the PMD table to point to other PTE's or none, then you |
1920 | * are OK - which is what cleanup_highmap does) */ | 1922 | * are OK - which is what cleanup_highmap does) */ |
1921 | copy_page(level2_ident_pgt, l2); | 1923 | copy_page(level2_ident_pgt, l2); |
1922 | /* Graft it onto L4[511][511] */ | 1924 | /* Graft it onto L4[511][510] */ |
1923 | copy_page(level2_kernel_pgt, l2); | 1925 | copy_page(level2_kernel_pgt, l2); |
1924 | 1926 | ||
1925 | /* Get [511][510] and graft that in level2_fixmap_pgt */ | ||
1926 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd); | ||
1927 | l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud); | ||
1928 | copy_page(level2_fixmap_pgt, l2); | ||
1929 | /* Note that we don't do anything with level1_fixmap_pgt which | ||
1930 | * we don't need. */ | ||
1931 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 1927 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
1932 | /* Make pagetable pieces RO */ | 1928 | /* Make pagetable pieces RO */ |
1933 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); | 1929 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); |
@@ -1937,6 +1933,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1937 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); | 1933 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); |
1938 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); | 1934 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); |
1939 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); | 1935 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); |
1936 | set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); | ||
1940 | 1937 | ||
1941 | /* Pin down new L4 */ | 1938 | /* Pin down new L4 */ |
1942 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, | 1939 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 3a617af60d46..49c6c3d94449 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -4,24 +4,23 @@ config ZONE_DMA | |||
4 | config XTENSA | 4 | config XTENSA |
5 | def_bool y | 5 | def_bool y |
6 | select ARCH_WANT_FRAME_POINTERS | 6 | select ARCH_WANT_FRAME_POINTERS |
7 | select HAVE_IDE | ||
8 | select GENERIC_ATOMIC64 | ||
9 | select GENERIC_CLOCKEVENTS | ||
10 | select VIRT_TO_BUS | ||
11 | select GENERIC_IRQ_SHOW | ||
12 | select GENERIC_SCHED_CLOCK | ||
13 | select MODULES_USE_ELF_RELA | ||
14 | select GENERIC_PCI_IOMAP | ||
15 | select ARCH_WANT_IPC_PARSE_VERSION | 7 | select ARCH_WANT_IPC_PARSE_VERSION |
16 | select ARCH_WANT_OPTIONAL_GPIOLIB | 8 | select ARCH_WANT_OPTIONAL_GPIOLIB |
17 | select BUILDTIME_EXTABLE_SORT | 9 | select BUILDTIME_EXTABLE_SORT |
18 | select CLONE_BACKWARDS | 10 | select CLONE_BACKWARDS |
19 | select IRQ_DOMAIN | 11 | select COMMON_CLK |
20 | select HAVE_OPROFILE | 12 | select GENERIC_ATOMIC64 |
13 | select GENERIC_CLOCKEVENTS | ||
14 | select GENERIC_IRQ_SHOW | ||
15 | select GENERIC_PCI_IOMAP | ||
16 | select GENERIC_SCHED_CLOCK | ||
21 | select HAVE_FUNCTION_TRACER | 17 | select HAVE_FUNCTION_TRACER |
22 | select HAVE_IRQ_TIME_ACCOUNTING | 18 | select HAVE_IRQ_TIME_ACCOUNTING |
19 | select HAVE_OPROFILE | ||
23 | select HAVE_PERF_EVENTS | 20 | select HAVE_PERF_EVENTS |
24 | select COMMON_CLK | 21 | select IRQ_DOMAIN |
22 | select MODULES_USE_ELF_RELA | ||
23 | select VIRT_TO_BUS | ||
25 | help | 24 | help |
26 | Xtensa processors are 32-bit RISC machines designed by Tensilica | 25 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
27 | primarily for embedded systems. These processors are both | 26 | primarily for embedded systems. These processors are both |
@@ -62,7 +61,9 @@ config TRACE_IRQFLAGS_SUPPORT | |||
62 | def_bool y | 61 | def_bool y |
63 | 62 | ||
64 | config MMU | 63 | config MMU |
65 | def_bool n | 64 | bool |
65 | default n if !XTENSA_VARIANT_CUSTOM | ||
66 | default XTENSA_VARIANT_MMU if XTENSA_VARIANT_CUSTOM | ||
66 | 67 | ||
67 | config VARIANT_IRQ_SWITCH | 68 | config VARIANT_IRQ_SWITCH |
68 | def_bool n | 69 | def_bool n |
@@ -102,8 +103,40 @@ config XTENSA_VARIANT_S6000 | |||
102 | select VARIANT_IRQ_SWITCH | 103 | select VARIANT_IRQ_SWITCH |
103 | select ARCH_REQUIRE_GPIOLIB | 104 | select ARCH_REQUIRE_GPIOLIB |
104 | select XTENSA_CALIBRATE_CCOUNT | 105 | select XTENSA_CALIBRATE_CCOUNT |
106 | |||
107 | config XTENSA_VARIANT_CUSTOM | ||
108 | bool "Custom Xtensa processor configuration" | ||
109 | select MAY_HAVE_SMP | ||
110 | select HAVE_XTENSA_GPIO32 | ||
111 | help | ||
112 | Select this variant to use a custom Xtensa processor configuration. | ||
113 | You will be prompted for a processor variant CORENAME. | ||
105 | endchoice | 114 | endchoice |
106 | 115 | ||
116 | config XTENSA_VARIANT_CUSTOM_NAME | ||
117 | string "Xtensa Processor Custom Core Variant Name" | ||
118 | depends on XTENSA_VARIANT_CUSTOM | ||
119 | help | ||
120 | Provide the name of a custom Xtensa processor variant. | ||
121 | This CORENAME selects arch/xtensa/variant/CORENAME. | ||
122 | Dont forget you have to select MMU if you have one. | ||
123 | |||
124 | config XTENSA_VARIANT_NAME | ||
125 | string | ||
126 | default "dc232b" if XTENSA_VARIANT_DC232B | ||
127 | default "dc233c" if XTENSA_VARIANT_DC233C | ||
128 | default "fsf" if XTENSA_VARIANT_FSF | ||
129 | default "s6000" if XTENSA_VARIANT_S6000 | ||
130 | default XTENSA_VARIANT_CUSTOM_NAME if XTENSA_VARIANT_CUSTOM | ||
131 | |||
132 | config XTENSA_VARIANT_MMU | ||
133 | bool "Core variant has a Full MMU (TLB, Pages, Protection, etc)" | ||
134 | depends on XTENSA_VARIANT_CUSTOM | ||
135 | default y | ||
136 | help | ||
137 | Build a Conventional Kernel with full MMU support, | ||
138 | ie: it supports a TLB with auto-loading, page protection. | ||
139 | |||
107 | config XTENSA_UNALIGNED_USER | 140 | config XTENSA_UNALIGNED_USER |
108 | bool "Unaligned memory access in use space" | 141 | bool "Unaligned memory access in use space" |
109 | help | 142 | help |
@@ -156,13 +189,9 @@ config HOTPLUG_CPU | |||
156 | 189 | ||
157 | Say N if you want to disable CPU hotplug. | 190 | Say N if you want to disable CPU hotplug. |
158 | 191 | ||
159 | config MATH_EMULATION | ||
160 | bool "Math emulation" | ||
161 | help | ||
162 | Can we use information of configuration file? | ||
163 | |||
164 | config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX | 192 | config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX |
165 | bool "Initialize Xtensa MMU inside the Linux kernel code" | 193 | bool "Initialize Xtensa MMU inside the Linux kernel code" |
194 | depends on MMU | ||
166 | default y | 195 | default y |
167 | help | 196 | help |
168 | Earlier version initialized the MMU in the exception vector | 197 | Earlier version initialized the MMU in the exception vector |
@@ -192,6 +221,7 @@ config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX | |||
192 | 221 | ||
193 | config HIGHMEM | 222 | config HIGHMEM |
194 | bool "High Memory Support" | 223 | bool "High Memory Support" |
224 | depends on MMU | ||
195 | help | 225 | help |
196 | Linux can use the full amount of RAM in the system by | 226 | Linux can use the full amount of RAM in the system by |
197 | default. However, the default MMUv2 setup only maps the | 227 | default. However, the default MMUv2 setup only maps the |
@@ -208,6 +238,32 @@ config HIGHMEM | |||
208 | 238 | ||
209 | If unsure, say Y. | 239 | If unsure, say Y. |
210 | 240 | ||
241 | config FAST_SYSCALL_XTENSA | ||
242 | bool "Enable fast atomic syscalls" | ||
243 | default n | ||
244 | help | ||
245 | fast_syscall_xtensa is a syscall that can make atomic operations | ||
246 | on UP kernel when processor has no s32c1i support. | ||
247 | |||
248 | This syscall is deprecated. It may have issues when called with | ||
249 | invalid arguments. It is provided only for backwards compatibility. | ||
250 | Only enable it if your userspace software requires it. | ||
251 | |||
252 | If unsure, say N. | ||
253 | |||
254 | config FAST_SYSCALL_SPILL_REGISTERS | ||
255 | bool "Enable spill registers syscall" | ||
256 | default n | ||
257 | help | ||
258 | fast_syscall_spill_registers is a syscall that spills all active | ||
259 | register windows of a calling userspace task onto its stack. | ||
260 | |||
261 | This syscall is deprecated. It may have issues when called with | ||
262 | invalid arguments. It is provided only for backwards compatibility. | ||
263 | Only enable it if your userspace software requires it. | ||
264 | |||
265 | If unsure, say N. | ||
266 | |||
211 | endmenu | 267 | endmenu |
212 | 268 | ||
213 | config XTENSA_CALIBRATE_CCOUNT | 269 | config XTENSA_CALIBRATE_CCOUNT |
@@ -250,12 +306,14 @@ config XTENSA_PLATFORM_ISS | |||
250 | 306 | ||
251 | config XTENSA_PLATFORM_XT2000 | 307 | config XTENSA_PLATFORM_XT2000 |
252 | bool "XT2000" | 308 | bool "XT2000" |
309 | select HAVE_IDE | ||
253 | help | 310 | help |
254 | XT2000 is the name of Tensilica's feature-rich emulation platform. | 311 | XT2000 is the name of Tensilica's feature-rich emulation platform. |
255 | This hardware is capable of running a full Linux distribution. | 312 | This hardware is capable of running a full Linux distribution. |
256 | 313 | ||
257 | config XTENSA_PLATFORM_S6105 | 314 | config XTENSA_PLATFORM_S6105 |
258 | bool "S6105" | 315 | bool "S6105" |
316 | select HAVE_IDE | ||
259 | select SERIAL_CONSOLE | 317 | select SERIAL_CONSOLE |
260 | select NO_IOPORT_MAP | 318 | select NO_IOPORT_MAP |
261 | 319 | ||
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index 81250ece3062..472533064b46 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile | |||
@@ -4,6 +4,7 @@ | |||
4 | # for more details. | 4 | # for more details. |
5 | # | 5 | # |
6 | # Copyright (C) 2001 - 2005 Tensilica Inc. | 6 | # Copyright (C) 2001 - 2005 Tensilica Inc. |
7 | # Copyright (C) 2014 Cadence Design Systems Inc. | ||
7 | # | 8 | # |
8 | # This file is included by the global makefile so that you can add your own | 9 | # This file is included by the global makefile so that you can add your own |
9 | # architecture-specific flags and dependencies. Remember to do have actions | 10 | # architecture-specific flags and dependencies. Remember to do have actions |
@@ -13,11 +14,7 @@ | |||
13 | # Core configuration. | 14 | # Core configuration. |
14 | # (Use VAR=<xtensa_config> to use another default compiler.) | 15 | # (Use VAR=<xtensa_config> to use another default compiler.) |
15 | 16 | ||
16 | variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf | 17 | variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME)) |
17 | variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b | ||
18 | variant-$(CONFIG_XTENSA_VARIANT_DC233C) := dc233c | ||
19 | variant-$(CONFIG_XTENSA_VARIANT_S6000) := s6000 | ||
20 | variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom | ||
21 | 18 | ||
22 | VARIANT = $(variant-y) | 19 | VARIANT = $(variant-y) |
23 | export VARIANT | 20 | export VARIANT |
diff --git a/arch/xtensa/boot/dts/kc705.dts b/arch/xtensa/boot/dts/kc705.dts index 742a347be67a..c4d17a34ab86 100644 --- a/arch/xtensa/boot/dts/kc705.dts +++ b/arch/xtensa/boot/dts/kc705.dts | |||
@@ -4,8 +4,11 @@ | |||
4 | 4 | ||
5 | / { | 5 | / { |
6 | compatible = "cdns,xtensa-kc705"; | 6 | compatible = "cdns,xtensa-kc705"; |
7 | chosen { | ||
8 | bootargs = "earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000"; | ||
9 | }; | ||
7 | memory@0 { | 10 | memory@0 { |
8 | device_type = "memory"; | 11 | device_type = "memory"; |
9 | reg = <0x00000000 0x08000000>; | 12 | reg = <0x00000000 0x38000000>; |
10 | }; | 13 | }; |
11 | }; | 14 | }; |
diff --git a/arch/xtensa/configs/common_defconfig b/arch/xtensa/configs/common_defconfig index f6000fe05119..721df1214bc3 100644 --- a/arch/xtensa/configs/common_defconfig +++ b/arch/xtensa/configs/common_defconfig | |||
@@ -66,7 +66,6 @@ CONFIG_XTENSA_ARCH_LINUX_BE=y | |||
66 | CONFIG_MMU=y | 66 | CONFIG_MMU=y |
67 | # CONFIG_XTENSA_UNALIGNED_USER is not set | 67 | # CONFIG_XTENSA_UNALIGNED_USER is not set |
68 | # CONFIG_PREEMPT is not set | 68 | # CONFIG_PREEMPT is not set |
69 | # CONFIG_MATH_EMULATION is not set | ||
70 | # CONFIG_HIGHMEM is not set | 69 | # CONFIG_HIGHMEM is not set |
71 | 70 | ||
72 | # | 71 | # |
diff --git a/arch/xtensa/configs/iss_defconfig b/arch/xtensa/configs/iss_defconfig index 1493c68352d1..b966baf82cae 100644 --- a/arch/xtensa/configs/iss_defconfig +++ b/arch/xtensa/configs/iss_defconfig | |||
@@ -146,7 +146,6 @@ CONFIG_XTENSA_VARIANT_FSF=y | |||
146 | # CONFIG_XTENSA_VARIANT_S6000 is not set | 146 | # CONFIG_XTENSA_VARIANT_S6000 is not set |
147 | # CONFIG_XTENSA_UNALIGNED_USER is not set | 147 | # CONFIG_XTENSA_UNALIGNED_USER is not set |
148 | # CONFIG_PREEMPT is not set | 148 | # CONFIG_PREEMPT is not set |
149 | # CONFIG_MATH_EMULATION is not set | ||
150 | CONFIG_XTENSA_CALIBRATE_CCOUNT=y | 149 | CONFIG_XTENSA_CALIBRATE_CCOUNT=y |
151 | CONFIG_SERIAL_CONSOLE=y | 150 | CONFIG_SERIAL_CONSOLE=y |
152 | CONFIG_XTENSA_ISS_NETWORK=y | 151 | CONFIG_XTENSA_ISS_NETWORK=y |
@@ -308,7 +307,7 @@ CONFIG_MISC_DEVICES=y | |||
308 | # EEPROM support | 307 | # EEPROM support |
309 | # | 308 | # |
310 | # CONFIG_EEPROM_93CX6 is not set | 309 | # CONFIG_EEPROM_93CX6 is not set |
311 | CONFIG_HAVE_IDE=y | 310 | # CONFIG_HAVE_IDE is not set |
312 | # CONFIG_IDE is not set | 311 | # CONFIG_IDE is not set |
313 | 312 | ||
314 | # | 313 | # |
diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig index 12a492ab6d17..9471265b8ca6 100644 --- a/arch/xtensa/configs/s6105_defconfig +++ b/arch/xtensa/configs/s6105_defconfig | |||
@@ -109,7 +109,6 @@ CONFIG_VARIANT_IRQ_SWITCH=y | |||
109 | CONFIG_XTENSA_VARIANT_S6000=y | 109 | CONFIG_XTENSA_VARIANT_S6000=y |
110 | # CONFIG_XTENSA_UNALIGNED_USER is not set | 110 | # CONFIG_XTENSA_UNALIGNED_USER is not set |
111 | CONFIG_PREEMPT=y | 111 | CONFIG_PREEMPT=y |
112 | # CONFIG_MATH_EMULATION is not set | ||
113 | # CONFIG_HIGHMEM is not set | 112 | # CONFIG_HIGHMEM is not set |
114 | CONFIG_XTENSA_CALIBRATE_CCOUNT=y | 113 | CONFIG_XTENSA_CALIBRATE_CCOUNT=y |
115 | CONFIG_SERIAL_CONSOLE=y | 114 | CONFIG_SERIAL_CONSOLE=y |
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h index 555a98a18453..e72aaca7a77f 100644 --- a/arch/xtensa/include/asm/cacheflush.h +++ b/arch/xtensa/include/asm/cacheflush.h | |||
@@ -37,6 +37,7 @@ | |||
37 | * specials for cache aliasing: | 37 | * specials for cache aliasing: |
38 | * | 38 | * |
39 | * __flush_invalidate_dcache_page_alias(vaddr,paddr) | 39 | * __flush_invalidate_dcache_page_alias(vaddr,paddr) |
40 | * __invalidate_dcache_page_alias(vaddr,paddr) | ||
40 | * __invalidate_icache_page_alias(vaddr,paddr) | 41 | * __invalidate_icache_page_alias(vaddr,paddr) |
41 | */ | 42 | */ |
42 | 43 | ||
@@ -62,6 +63,7 @@ extern void __flush_invalidate_dcache_range(unsigned long, unsigned long); | |||
62 | 63 | ||
63 | #if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) | 64 | #if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) |
64 | extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long); | 65 | extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long); |
66 | extern void __invalidate_dcache_page_alias(unsigned long, unsigned long); | ||
65 | #else | 67 | #else |
66 | static inline void __flush_invalidate_dcache_page_alias(unsigned long virt, | 68 | static inline void __flush_invalidate_dcache_page_alias(unsigned long virt, |
67 | unsigned long phys) { } | 69 | unsigned long phys) { } |
diff --git a/arch/xtensa/include/asm/fixmap.h b/arch/xtensa/include/asm/fixmap.h index 9f6c33d0428a..62b507deea9d 100644 --- a/arch/xtensa/include/asm/fixmap.h +++ b/arch/xtensa/include/asm/fixmap.h | |||
@@ -23,8 +23,8 @@ | |||
23 | * Here we define all the compile-time 'special' virtual | 23 | * Here we define all the compile-time 'special' virtual |
24 | * addresses. The point is to have a constant address at | 24 | * addresses. The point is to have a constant address at |
25 | * compile time, but to set the physical address only | 25 | * compile time, but to set the physical address only |
26 | * in the boot process. We allocate these special addresses | 26 | * in the boot process. We allocate these special addresses |
27 | * from the end of the consistent memory region backwards. | 27 | * from the start of the consistent memory region upwards. |
28 | * Also this lets us do fail-safe vmalloc(), we | 28 | * Also this lets us do fail-safe vmalloc(), we |
29 | * can guarantee that these special addresses and | 29 | * can guarantee that these special addresses and |
30 | * vmalloc()-ed addresses never overlap. | 30 | * vmalloc()-ed addresses never overlap. |
@@ -38,7 +38,8 @@ enum fixed_addresses { | |||
38 | #ifdef CONFIG_HIGHMEM | 38 | #ifdef CONFIG_HIGHMEM |
39 | /* reserved pte's for temporary kernel mappings */ | 39 | /* reserved pte's for temporary kernel mappings */ |
40 | FIX_KMAP_BEGIN, | 40 | FIX_KMAP_BEGIN, |
41 | FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, | 41 | FIX_KMAP_END = FIX_KMAP_BEGIN + |
42 | (KM_TYPE_NR * NR_CPUS * DCACHE_N_COLORS) - 1, | ||
42 | #endif | 43 | #endif |
43 | __end_of_fixed_addresses | 44 | __end_of_fixed_addresses |
44 | }; | 45 | }; |
@@ -47,7 +48,28 @@ enum fixed_addresses { | |||
47 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 48 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
48 | #define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) | 49 | #define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) |
49 | 50 | ||
50 | #include <asm-generic/fixmap.h> | 51 | #define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT)) |
52 | #define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT) | ||
53 | |||
54 | #ifndef __ASSEMBLY__ | ||
55 | /* | ||
56 | * 'index to address' translation. If anyone tries to use the idx | ||
57 | * directly without translation, we catch the bug with a NULL-deference | ||
58 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
59 | */ | ||
60 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
61 | { | ||
62 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses); | ||
63 | return __fix_to_virt(idx); | ||
64 | } | ||
65 | |||
66 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
67 | { | ||
68 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
69 | return __virt_to_fix(vaddr); | ||
70 | } | ||
71 | |||
72 | #endif | ||
51 | 73 | ||
52 | #define kmap_get_fixmap_pte(vaddr) \ | 74 | #define kmap_get_fixmap_pte(vaddr) \ |
53 | pte_offset_kernel( \ | 75 | pte_offset_kernel( \ |
diff --git a/arch/xtensa/include/asm/highmem.h b/arch/xtensa/include/asm/highmem.h index 2653ef5d55f1..2c7901edffaf 100644 --- a/arch/xtensa/include/asm/highmem.h +++ b/arch/xtensa/include/asm/highmem.h | |||
@@ -12,19 +12,55 @@ | |||
12 | #ifndef _XTENSA_HIGHMEM_H | 12 | #ifndef _XTENSA_HIGHMEM_H |
13 | #define _XTENSA_HIGHMEM_H | 13 | #define _XTENSA_HIGHMEM_H |
14 | 14 | ||
15 | #include <linux/wait.h> | ||
15 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
16 | #include <asm/fixmap.h> | 17 | #include <asm/fixmap.h> |
17 | #include <asm/kmap_types.h> | 18 | #include <asm/kmap_types.h> |
18 | #include <asm/pgtable.h> | 19 | #include <asm/pgtable.h> |
19 | 20 | ||
20 | #define PKMAP_BASE (FIXADDR_START - PMD_SIZE) | 21 | #define PKMAP_BASE ((FIXADDR_START - \ |
21 | #define LAST_PKMAP PTRS_PER_PTE | 22 | (LAST_PKMAP + 1) * PAGE_SIZE) & PMD_MASK) |
23 | #define LAST_PKMAP (PTRS_PER_PTE * DCACHE_N_COLORS) | ||
22 | #define LAST_PKMAP_MASK (LAST_PKMAP - 1) | 24 | #define LAST_PKMAP_MASK (LAST_PKMAP - 1) |
23 | #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) | 25 | #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) |
24 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) | 26 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) |
25 | 27 | ||
26 | #define kmap_prot PAGE_KERNEL | 28 | #define kmap_prot PAGE_KERNEL |
27 | 29 | ||
30 | #if DCACHE_WAY_SIZE > PAGE_SIZE | ||
31 | #define get_pkmap_color get_pkmap_color | ||
32 | static inline int get_pkmap_color(struct page *page) | ||
33 | { | ||
34 | return DCACHE_ALIAS(page_to_phys(page)); | ||
35 | } | ||
36 | |||
37 | extern unsigned int last_pkmap_nr_arr[]; | ||
38 | |||
39 | static inline unsigned int get_next_pkmap_nr(unsigned int color) | ||
40 | { | ||
41 | last_pkmap_nr_arr[color] = | ||
42 | (last_pkmap_nr_arr[color] + DCACHE_N_COLORS) & LAST_PKMAP_MASK; | ||
43 | return last_pkmap_nr_arr[color] + color; | ||
44 | } | ||
45 | |||
46 | static inline int no_more_pkmaps(unsigned int pkmap_nr, unsigned int color) | ||
47 | { | ||
48 | return pkmap_nr < DCACHE_N_COLORS; | ||
49 | } | ||
50 | |||
51 | static inline int get_pkmap_entries_count(unsigned int color) | ||
52 | { | ||
53 | return LAST_PKMAP / DCACHE_N_COLORS; | ||
54 | } | ||
55 | |||
56 | extern wait_queue_head_t pkmap_map_wait_arr[]; | ||
57 | |||
58 | static inline wait_queue_head_t *get_pkmap_wait_queue_head(unsigned int color) | ||
59 | { | ||
60 | return pkmap_map_wait_arr + color; | ||
61 | } | ||
62 | #endif | ||
63 | |||
28 | extern pte_t *pkmap_page_table; | 64 | extern pte_t *pkmap_page_table; |
29 | 65 | ||
30 | void *kmap_high(struct page *page); | 66 | void *kmap_high(struct page *page); |
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h index 47f582333f6b..abe24c6f8b2f 100644 --- a/arch/xtensa/include/asm/page.h +++ b/arch/xtensa/include/asm/page.h | |||
@@ -78,7 +78,9 @@ | |||
78 | # define DCACHE_ALIAS_EQ(a,b) ((((a) ^ (b)) & DCACHE_ALIAS_MASK) == 0) | 78 | # define DCACHE_ALIAS_EQ(a,b) ((((a) ^ (b)) & DCACHE_ALIAS_MASK) == 0) |
79 | #else | 79 | #else |
80 | # define DCACHE_ALIAS_ORDER 0 | 80 | # define DCACHE_ALIAS_ORDER 0 |
81 | # define DCACHE_ALIAS(a) ((void)(a), 0) | ||
81 | #endif | 82 | #endif |
83 | #define DCACHE_N_COLORS (1 << DCACHE_ALIAS_ORDER) | ||
82 | 84 | ||
83 | #if ICACHE_WAY_SIZE > PAGE_SIZE | 85 | #if ICACHE_WAY_SIZE > PAGE_SIZE |
84 | # define ICACHE_ALIAS_ORDER (ICACHE_WAY_SHIFT - PAGE_SHIFT) | 86 | # define ICACHE_ALIAS_ORDER (ICACHE_WAY_SHIFT - PAGE_SHIFT) |
@@ -134,6 +136,7 @@ static inline __attribute_const__ int get_order(unsigned long size) | |||
134 | #endif | 136 | #endif |
135 | 137 | ||
136 | struct page; | 138 | struct page; |
139 | struct vm_area_struct; | ||
137 | extern void clear_page(void *page); | 140 | extern void clear_page(void *page); |
138 | extern void copy_page(void *to, void *from); | 141 | extern void copy_page(void *to, void *from); |
139 | 142 | ||
@@ -143,8 +146,15 @@ extern void copy_page(void *to, void *from); | |||
143 | */ | 146 | */ |
144 | 147 | ||
145 | #if DCACHE_WAY_SIZE > PAGE_SIZE | 148 | #if DCACHE_WAY_SIZE > PAGE_SIZE |
146 | extern void clear_user_page(void*, unsigned long, struct page*); | 149 | extern void clear_page_alias(void *vaddr, unsigned long paddr); |
147 | extern void copy_user_page(void*, void*, unsigned long, struct page*); | 150 | extern void copy_page_alias(void *to, void *from, |
151 | unsigned long to_paddr, unsigned long from_paddr); | ||
152 | |||
153 | #define clear_user_highpage clear_user_highpage | ||
154 | void clear_user_highpage(struct page *page, unsigned long vaddr); | ||
155 | #define __HAVE_ARCH_COPY_USER_HIGHPAGE | ||
156 | void copy_user_highpage(struct page *to, struct page *from, | ||
157 | unsigned long vaddr, struct vm_area_struct *vma); | ||
148 | #else | 158 | #else |
149 | # define clear_user_page(page, vaddr, pg) clear_page(page) | 159 | # define clear_user_page(page, vaddr, pg) clear_page(page) |
150 | # define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | 160 | # define copy_user_page(to, from, vaddr, pg) copy_page(to, from) |
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index 4b0ca35a93b1..b2173e5da601 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h | |||
@@ -67,7 +67,12 @@ | |||
67 | #define VMALLOC_START 0xC0000000 | 67 | #define VMALLOC_START 0xC0000000 |
68 | #define VMALLOC_END 0xC7FEFFFF | 68 | #define VMALLOC_END 0xC7FEFFFF |
69 | #define TLBTEMP_BASE_1 0xC7FF0000 | 69 | #define TLBTEMP_BASE_1 0xC7FF0000 |
70 | #define TLBTEMP_BASE_2 0xC7FF8000 | 70 | #define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE) |
71 | #if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE | ||
72 | #define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE) | ||
73 | #else | ||
74 | #define TLBTEMP_SIZE ICACHE_WAY_SIZE | ||
75 | #endif | ||
71 | 76 | ||
72 | /* | 77 | /* |
73 | * For the Xtensa architecture, the PTE layout is as follows: | 78 | * For the Xtensa architecture, the PTE layout is as follows: |
diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h index fd686dc45d1a..c7211e7e182d 100644 --- a/arch/xtensa/include/asm/uaccess.h +++ b/arch/xtensa/include/asm/uaccess.h | |||
@@ -52,7 +52,12 @@ | |||
52 | */ | 52 | */ |
53 | .macro get_fs ad, sp | 53 | .macro get_fs ad, sp |
54 | GET_CURRENT(\ad,\sp) | 54 | GET_CURRENT(\ad,\sp) |
55 | #if THREAD_CURRENT_DS > 1020 | ||
56 | addi \ad, \ad, TASK_THREAD | ||
57 | l32i \ad, \ad, THREAD_CURRENT_DS - TASK_THREAD | ||
58 | #else | ||
55 | l32i \ad, \ad, THREAD_CURRENT_DS | 59 | l32i \ad, \ad, THREAD_CURRENT_DS |
60 | #endif | ||
56 | .endm | 61 | .endm |
57 | 62 | ||
58 | /* | 63 | /* |
diff --git a/arch/xtensa/include/uapi/asm/ioctls.h b/arch/xtensa/include/uapi/asm/ioctls.h index b4cb1100c0fb..a47909f0c34b 100644 --- a/arch/xtensa/include/uapi/asm/ioctls.h +++ b/arch/xtensa/include/uapi/asm/ioctls.h | |||
@@ -28,17 +28,17 @@ | |||
28 | #define TCSETSW 0x5403 | 28 | #define TCSETSW 0x5403 |
29 | #define TCSETSF 0x5404 | 29 | #define TCSETSF 0x5404 |
30 | 30 | ||
31 | #define TCGETA _IOR('t', 23, struct termio) | 31 | #define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */ |
32 | #define TCSETA _IOW('t', 24, struct termio) | 32 | #define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */ |
33 | #define TCSETAW _IOW('t', 25, struct termio) | 33 | #define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */ |
34 | #define TCSETAF _IOW('t', 28, struct termio) | 34 | #define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */ |
35 | 35 | ||
36 | #define TCSBRK _IO('t', 29) | 36 | #define TCSBRK _IO('t', 29) |
37 | #define TCXONC _IO('t', 30) | 37 | #define TCXONC _IO('t', 30) |
38 | #define TCFLSH _IO('t', 31) | 38 | #define TCFLSH _IO('t', 31) |
39 | 39 | ||
40 | #define TIOCSWINSZ _IOW('t', 103, struct winsize) | 40 | #define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */ |
41 | #define TIOCGWINSZ _IOR('t', 104, struct winsize) | 41 | #define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */ |
42 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ | 42 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ |
43 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ | 43 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ |
44 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ | 44 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ |
@@ -88,7 +88,6 @@ | |||
88 | #define TIOCSETD _IOW('T', 35, int) | 88 | #define TIOCSETD _IOW('T', 35, int) |
89 | #define TIOCGETD _IOR('T', 36, int) | 89 | #define TIOCGETD _IOR('T', 36, int) |
90 | #define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/ | 90 | #define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/ |
91 | #define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/ | ||
92 | #define TIOCSBRK _IO('T', 39) /* BSD compatibility */ | 91 | #define TIOCSBRK _IO('T', 39) /* BSD compatibility */ |
93 | #define TIOCCBRK _IO('T', 40) /* BSD compatibility */ | 92 | #define TIOCCBRK _IO('T', 40) /* BSD compatibility */ |
94 | #define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/ | 93 | #define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/ |
@@ -114,8 +113,10 @@ | |||
114 | #define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */ | 113 | #define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */ |
115 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | 114 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ |
116 | # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | 115 | # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ |
117 | #define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */ | 116 | #define TIOCSERGETMULTI 0x80a8545a /* Get multiport config */ |
118 | #define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ | 117 | /* _IOR('T', 90, struct serial_multiport_struct) */ |
118 | #define TIOCSERSETMULTI 0x40a8545b /* Set multiport config */ | ||
119 | /* _IOW('T', 91, struct serial_multiport_struct) */ | ||
119 | 120 | ||
120 | #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ | 121 | #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ |
121 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | 122 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ |
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index b9395529f02d..8883fc877c5c 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -739,7 +739,10 @@ __SYSCALL(334, sys_sched_setattr, 2) | |||
739 | #define __NR_sched_getattr 335 | 739 | #define __NR_sched_getattr 335 |
740 | __SYSCALL(335, sys_sched_getattr, 3) | 740 | __SYSCALL(335, sys_sched_getattr, 3) |
741 | 741 | ||
742 | #define __NR_syscall_count 336 | 742 | #define __NR_renameat2 336 |
743 | __SYSCALL(336, sys_renameat2, 5) | ||
744 | |||
745 | #define __NR_syscall_count 337 | ||
743 | 746 | ||
744 | /* | 747 | /* |
745 | * sysxtensa syscall handler | 748 | * sysxtensa syscall handler |
diff --git a/arch/xtensa/kernel/align.S b/arch/xtensa/kernel/align.S index d4cef6039a5c..890004af03a9 100644 --- a/arch/xtensa/kernel/align.S +++ b/arch/xtensa/kernel/align.S | |||
@@ -8,6 +8,7 @@ | |||
8 | * this archive for more details. | 8 | * this archive for more details. |
9 | * | 9 | * |
10 | * Copyright (C) 2001 - 2005 Tensilica, Inc. | 10 | * Copyright (C) 2001 - 2005 Tensilica, Inc. |
11 | * Copyright (C) 2014 Cadence Design Systems Inc. | ||
11 | * | 12 | * |
12 | * Rewritten by Chris Zankel <chris@zankel.net> | 13 | * Rewritten by Chris Zankel <chris@zankel.net> |
13 | * | 14 | * |
@@ -174,6 +175,10 @@ ENTRY(fast_unaligned) | |||
174 | s32i a0, a2, PT_AREG2 | 175 | s32i a0, a2, PT_AREG2 |
175 | s32i a3, a2, PT_AREG3 | 176 | s32i a3, a2, PT_AREG3 |
176 | 177 | ||
178 | rsr a3, excsave1 | ||
179 | movi a4, fast_unaligned_fixup | ||
180 | s32i a4, a3, EXC_TABLE_FIXUP | ||
181 | |||
177 | /* Keep value of SAR in a0 */ | 182 | /* Keep value of SAR in a0 */ |
178 | 183 | ||
179 | rsr a0, sar | 184 | rsr a0, sar |
@@ -225,10 +230,6 @@ ENTRY(fast_unaligned) | |||
225 | addx8 a5, a6, a5 | 230 | addx8 a5, a6, a5 |
226 | jx a5 # jump into table | 231 | jx a5 # jump into table |
227 | 232 | ||
228 | /* Invalid instruction, CRITICAL! */ | ||
229 | .Linvalid_instruction_load: | ||
230 | j .Linvalid_instruction | ||
231 | |||
232 | /* Load: Load memory address. */ | 233 | /* Load: Load memory address. */ |
233 | 234 | ||
234 | .Lload: movi a3, ~3 | 235 | .Lload: movi a3, ~3 |
@@ -272,18 +273,6 @@ ENTRY(fast_unaligned) | |||
272 | /* Set target register. */ | 273 | /* Set target register. */ |
273 | 274 | ||
274 | 1: | 275 | 1: |
275 | |||
276 | #if XCHAL_HAVE_LOOPS | ||
277 | rsr a5, lend # check if we reached LEND | ||
278 | bne a7, a5, 1f | ||
279 | rsr a5, lcount # and LCOUNT != 0 | ||
280 | beqz a5, 1f | ||
281 | addi a5, a5, -1 # decrement LCOUNT and set | ||
282 | rsr a7, lbeg # set PC to LBEGIN | ||
283 | wsr a5, lcount | ||
284 | #endif | ||
285 | |||
286 | 1: wsr a7, epc1 # skip load instruction | ||
287 | extui a4, a4, INSN_T, 4 # extract target register | 276 | extui a4, a4, INSN_T, 4 # extract target register |
288 | movi a5, .Lload_table | 277 | movi a5, .Lload_table |
289 | addx8 a4, a4, a5 | 278 | addx8 a4, a4, a5 |
@@ -326,6 +315,35 @@ ENTRY(fast_unaligned) | |||
326 | mov a3, a14 ; _j 1f; .align 8 | 315 | mov a3, a14 ; _j 1f; .align 8 |
327 | mov a3, a15 ; _j 1f; .align 8 | 316 | mov a3, a15 ; _j 1f; .align 8 |
328 | 317 | ||
318 | /* We cannot handle this exception. */ | ||
319 | |||
320 | .extern _kernel_exception | ||
321 | .Linvalid_instruction_load: | ||
322 | .Linvalid_instruction_store: | ||
323 | |||
324 | movi a4, 0 | ||
325 | rsr a3, excsave1 | ||
326 | s32i a4, a3, EXC_TABLE_FIXUP | ||
327 | |||
328 | /* Restore a4...a8 and SAR, set SP, and jump to default exception. */ | ||
329 | |||
330 | l32i a8, a2, PT_AREG8 | ||
331 | l32i a7, a2, PT_AREG7 | ||
332 | l32i a6, a2, PT_AREG6 | ||
333 | l32i a5, a2, PT_AREG5 | ||
334 | l32i a4, a2, PT_AREG4 | ||
335 | wsr a0, sar | ||
336 | mov a1, a2 | ||
337 | |||
338 | rsr a0, ps | ||
339 | bbsi.l a0, PS_UM_BIT, 2f # jump if user mode | ||
340 | |||
341 | movi a0, _kernel_exception | ||
342 | jx a0 | ||
343 | |||
344 | 2: movi a0, _user_exception | ||
345 | jx a0 | ||
346 | |||
329 | 1: # a7: instruction pointer, a4: instruction, a3: value | 347 | 1: # a7: instruction pointer, a4: instruction, a3: value |
330 | 348 | ||
331 | movi a6, 0 # mask: ffffffff:00000000 | 349 | movi a6, 0 # mask: ffffffff:00000000 |
@@ -353,17 +371,6 @@ ENTRY(fast_unaligned) | |||
353 | /* Get memory address */ | 371 | /* Get memory address */ |
354 | 372 | ||
355 | 1: | 373 | 1: |
356 | #if XCHAL_HAVE_LOOPS | ||
357 | rsr a4, lend # check if we reached LEND | ||
358 | bne a7, a4, 1f | ||
359 | rsr a4, lcount # and LCOUNT != 0 | ||
360 | beqz a4, 1f | ||
361 | addi a4, a4, -1 # decrement LCOUNT and set | ||
362 | rsr a7, lbeg # set PC to LBEGIN | ||
363 | wsr a4, lcount | ||
364 | #endif | ||
365 | |||
366 | 1: wsr a7, epc1 # skip store instruction | ||
367 | movi a4, ~3 | 374 | movi a4, ~3 |
368 | and a4, a4, a8 # align memory address | 375 | and a4, a4, a8 # align memory address |
369 | 376 | ||
@@ -375,25 +382,25 @@ ENTRY(fast_unaligned) | |||
375 | #endif | 382 | #endif |
376 | 383 | ||
377 | __ssa8r a8 | 384 | __ssa8r a8 |
378 | __src_b a7, a5, a6 # lo-mask F..F0..0 (BE) 0..0F..F (LE) | 385 | __src_b a8, a5, a6 # lo-mask F..F0..0 (BE) 0..0F..F (LE) |
379 | __src_b a6, a6, a5 # hi-mask 0..0F..F (BE) F..F0..0 (LE) | 386 | __src_b a6, a6, a5 # hi-mask 0..0F..F (BE) F..F0..0 (LE) |
380 | #ifdef UNALIGNED_USER_EXCEPTION | 387 | #ifdef UNALIGNED_USER_EXCEPTION |
381 | l32e a5, a4, -8 | 388 | l32e a5, a4, -8 |
382 | #else | 389 | #else |
383 | l32i a5, a4, 0 # load lower address word | 390 | l32i a5, a4, 0 # load lower address word |
384 | #endif | 391 | #endif |
385 | and a5, a5, a7 # mask | 392 | and a5, a5, a8 # mask |
386 | __sh a7, a3 # shift value | 393 | __sh a8, a3 # shift value |
387 | or a5, a5, a7 # or with original value | 394 | or a5, a5, a8 # or with original value |
388 | #ifdef UNALIGNED_USER_EXCEPTION | 395 | #ifdef UNALIGNED_USER_EXCEPTION |
389 | s32e a5, a4, -8 | 396 | s32e a5, a4, -8 |
390 | l32e a7, a4, -4 | 397 | l32e a8, a4, -4 |
391 | #else | 398 | #else |
392 | s32i a5, a4, 0 # store | 399 | s32i a5, a4, 0 # store |
393 | l32i a7, a4, 4 # same for upper address word | 400 | l32i a8, a4, 4 # same for upper address word |
394 | #endif | 401 | #endif |
395 | __sl a5, a3 | 402 | __sl a5, a3 |
396 | and a6, a7, a6 | 403 | and a6, a8, a6 |
397 | or a6, a6, a5 | 404 | or a6, a6, a5 |
398 | #ifdef UNALIGNED_USER_EXCEPTION | 405 | #ifdef UNALIGNED_USER_EXCEPTION |
399 | s32e a6, a4, -4 | 406 | s32e a6, a4, -4 |
@@ -401,9 +408,27 @@ ENTRY(fast_unaligned) | |||
401 | s32i a6, a4, 4 | 408 | s32i a6, a4, 4 |
402 | #endif | 409 | #endif |
403 | 410 | ||
404 | /* Done. restore stack and return */ | ||
405 | |||
406 | .Lexit: | 411 | .Lexit: |
412 | #if XCHAL_HAVE_LOOPS | ||
413 | rsr a4, lend # check if we reached LEND | ||
414 | bne a7, a4, 1f | ||
415 | rsr a4, lcount # and LCOUNT != 0 | ||
416 | beqz a4, 1f | ||
417 | addi a4, a4, -1 # decrement LCOUNT and set | ||
418 | rsr a7, lbeg # set PC to LBEGIN | ||
419 | wsr a4, lcount | ||
420 | #endif | ||
421 | |||
422 | 1: wsr a7, epc1 # skip emulated instruction | ||
423 | |||
424 | /* Update icount if we're single-stepping in userspace. */ | ||
425 | rsr a4, icountlevel | ||
426 | beqz a4, 1f | ||
427 | bgeui a4, LOCKLEVEL + 1, 1f | ||
428 | rsr a4, icount | ||
429 | addi a4, a4, 1 | ||
430 | wsr a4, icount | ||
431 | 1: | ||
407 | movi a4, 0 | 432 | movi a4, 0 |
408 | rsr a3, excsave1 | 433 | rsr a3, excsave1 |
409 | s32i a4, a3, EXC_TABLE_FIXUP | 434 | s32i a4, a3, EXC_TABLE_FIXUP |
@@ -424,31 +449,40 @@ ENTRY(fast_unaligned) | |||
424 | l32i a2, a2, PT_AREG2 | 449 | l32i a2, a2, PT_AREG2 |
425 | rfe | 450 | rfe |
426 | 451 | ||
427 | /* We cannot handle this exception. */ | 452 | ENDPROC(fast_unaligned) |
428 | 453 | ||
429 | .extern _kernel_exception | 454 | ENTRY(fast_unaligned_fixup) |
430 | .Linvalid_instruction_store: | ||
431 | .Linvalid_instruction: | ||
432 | 455 | ||
433 | /* Restore a4...a8 and SAR, set SP, and jump to default exception. */ | 456 | l32i a2, a3, EXC_TABLE_DOUBLE_SAVE |
457 | wsr a3, excsave1 | ||
434 | 458 | ||
435 | l32i a8, a2, PT_AREG8 | 459 | l32i a8, a2, PT_AREG8 |
436 | l32i a7, a2, PT_AREG7 | 460 | l32i a7, a2, PT_AREG7 |
437 | l32i a6, a2, PT_AREG6 | 461 | l32i a6, a2, PT_AREG6 |
438 | l32i a5, a2, PT_AREG5 | 462 | l32i a5, a2, PT_AREG5 |
439 | l32i a4, a2, PT_AREG4 | 463 | l32i a4, a2, PT_AREG4 |
464 | l32i a0, a2, PT_AREG2 | ||
465 | xsr a0, depc # restore depc and a0 | ||
440 | wsr a0, sar | 466 | wsr a0, sar |
441 | mov a1, a2 | 467 | |
468 | rsr a0, exccause | ||
469 | s32i a0, a2, PT_DEPC # mark as a regular exception | ||
442 | 470 | ||
443 | rsr a0, ps | 471 | rsr a0, ps |
444 | bbsi.l a2, PS_UM_BIT, 1f # jump if user mode | 472 | bbsi.l a0, PS_UM_BIT, 1f # jump if user mode |
445 | 473 | ||
446 | movi a0, _kernel_exception | 474 | rsr a0, exccause |
475 | addx4 a0, a0, a3 # find entry in table | ||
476 | l32i a0, a0, EXC_TABLE_FAST_KERNEL # load handler | ||
477 | l32i a3, a2, PT_AREG3 | ||
447 | jx a0 | 478 | jx a0 |
448 | 479 | 1: | |
449 | 1: movi a0, _user_exception | 480 | rsr a0, exccause |
481 | addx4 a0, a0, a3 # find entry in table | ||
482 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler | ||
483 | l32i a3, a2, PT_AREG3 | ||
450 | jx a0 | 484 | jx a0 |
451 | 485 | ||
452 | ENDPROC(fast_unaligned) | 486 | ENDPROC(fast_unaligned_fixup) |
453 | 487 | ||
454 | #endif /* XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION */ | 488 | #endif /* XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION */ |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index ef7f4990722b..82bbfa5a05b3 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -986,6 +986,8 @@ ENDPROC(fast_syscall_unrecoverable) | |||
986 | * j done | 986 | * j done |
987 | */ | 987 | */ |
988 | 988 | ||
989 | #ifdef CONFIG_FAST_SYSCALL_XTENSA | ||
990 | |||
989 | #define TRY \ | 991 | #define TRY \ |
990 | .section __ex_table, "a"; \ | 992 | .section __ex_table, "a"; \ |
991 | .word 66f, 67f; \ | 993 | .word 66f, 67f; \ |
@@ -1001,9 +1003,8 @@ ENTRY(fast_syscall_xtensa) | |||
1001 | movi a7, 4 # sizeof(unsigned int) | 1003 | movi a7, 4 # sizeof(unsigned int) |
1002 | access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp | 1004 | access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp |
1003 | 1005 | ||
1004 | addi a6, a6, -1 # assuming SYS_XTENSA_ATOMIC_SET = 1 | 1006 | _bgeui a6, SYS_XTENSA_COUNT, .Lill |
1005 | _bgeui a6, SYS_XTENSA_COUNT - 1, .Lill | 1007 | _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP, .Lnswp |
1006 | _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP - 1, .Lnswp | ||
1007 | 1008 | ||
1008 | /* Fall through for ATOMIC_CMP_SWP. */ | 1009 | /* Fall through for ATOMIC_CMP_SWP. */ |
1009 | 1010 | ||
@@ -1015,27 +1016,26 @@ TRY s32i a5, a3, 0 # different, modify value | |||
1015 | l32i a7, a2, PT_AREG7 # restore a7 | 1016 | l32i a7, a2, PT_AREG7 # restore a7 |
1016 | l32i a0, a2, PT_AREG0 # restore a0 | 1017 | l32i a0, a2, PT_AREG0 # restore a0 |
1017 | movi a2, 1 # and return 1 | 1018 | movi a2, 1 # and return 1 |
1018 | addi a6, a6, 1 # restore a6 (really necessary?) | ||
1019 | rfe | 1019 | rfe |
1020 | 1020 | ||
1021 | 1: l32i a7, a2, PT_AREG7 # restore a7 | 1021 | 1: l32i a7, a2, PT_AREG7 # restore a7 |
1022 | l32i a0, a2, PT_AREG0 # restore a0 | 1022 | l32i a0, a2, PT_AREG0 # restore a0 |
1023 | movi a2, 0 # return 0 (note that we cannot set | 1023 | movi a2, 0 # return 0 (note that we cannot set |
1024 | addi a6, a6, 1 # restore a6 (really necessary?) | ||
1025 | rfe | 1024 | rfe |
1026 | 1025 | ||
1027 | .Lnswp: /* Atomic set, add, and exg_add. */ | 1026 | .Lnswp: /* Atomic set, add, and exg_add. */ |
1028 | 1027 | ||
1029 | TRY l32i a7, a3, 0 # orig | 1028 | TRY l32i a7, a3, 0 # orig |
1029 | addi a6, a6, -SYS_XTENSA_ATOMIC_SET | ||
1030 | add a0, a4, a7 # + arg | 1030 | add a0, a4, a7 # + arg |
1031 | moveqz a0, a4, a6 # set | 1031 | moveqz a0, a4, a6 # set |
1032 | addi a6, a6, SYS_XTENSA_ATOMIC_SET | ||
1032 | TRY s32i a0, a3, 0 # write new value | 1033 | TRY s32i a0, a3, 0 # write new value |
1033 | 1034 | ||
1034 | mov a0, a2 | 1035 | mov a0, a2 |
1035 | mov a2, a7 | 1036 | mov a2, a7 |
1036 | l32i a7, a0, PT_AREG7 # restore a7 | 1037 | l32i a7, a0, PT_AREG7 # restore a7 |
1037 | l32i a0, a0, PT_AREG0 # restore a0 | 1038 | l32i a0, a0, PT_AREG0 # restore a0 |
1038 | addi a6, a6, 1 # restore a6 (really necessary?) | ||
1039 | rfe | 1039 | rfe |
1040 | 1040 | ||
1041 | CATCH | 1041 | CATCH |
@@ -1044,13 +1044,25 @@ CATCH | |||
1044 | movi a2, -EFAULT | 1044 | movi a2, -EFAULT |
1045 | rfe | 1045 | rfe |
1046 | 1046 | ||
1047 | .Lill: l32i a7, a2, PT_AREG0 # restore a7 | 1047 | .Lill: l32i a7, a2, PT_AREG7 # restore a7 |
1048 | l32i a0, a2, PT_AREG0 # restore a0 | 1048 | l32i a0, a2, PT_AREG0 # restore a0 |
1049 | movi a2, -EINVAL | 1049 | movi a2, -EINVAL |
1050 | rfe | 1050 | rfe |
1051 | 1051 | ||
1052 | ENDPROC(fast_syscall_xtensa) | 1052 | ENDPROC(fast_syscall_xtensa) |
1053 | 1053 | ||
1054 | #else /* CONFIG_FAST_SYSCALL_XTENSA */ | ||
1055 | |||
1056 | ENTRY(fast_syscall_xtensa) | ||
1057 | |||
1058 | l32i a0, a2, PT_AREG0 # restore a0 | ||
1059 | movi a2, -ENOSYS | ||
1060 | rfe | ||
1061 | |||
1062 | ENDPROC(fast_syscall_xtensa) | ||
1063 | |||
1064 | #endif /* CONFIG_FAST_SYSCALL_XTENSA */ | ||
1065 | |||
1054 | 1066 | ||
1055 | /* fast_syscall_spill_registers. | 1067 | /* fast_syscall_spill_registers. |
1056 | * | 1068 | * |
@@ -1066,6 +1078,8 @@ ENDPROC(fast_syscall_xtensa) | |||
1066 | * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler. | 1078 | * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler. |
1067 | */ | 1079 | */ |
1068 | 1080 | ||
1081 | #ifdef CONFIG_FAST_SYSCALL_SPILL_REGISTERS | ||
1082 | |||
1069 | ENTRY(fast_syscall_spill_registers) | 1083 | ENTRY(fast_syscall_spill_registers) |
1070 | 1084 | ||
1071 | /* Register a FIXUP handler (pass current wb as a parameter) */ | 1085 | /* Register a FIXUP handler (pass current wb as a parameter) */ |
@@ -1400,6 +1414,18 @@ ENTRY(fast_syscall_spill_registers_fixup_return) | |||
1400 | 1414 | ||
1401 | ENDPROC(fast_syscall_spill_registers_fixup_return) | 1415 | ENDPROC(fast_syscall_spill_registers_fixup_return) |
1402 | 1416 | ||
1417 | #else /* CONFIG_FAST_SYSCALL_SPILL_REGISTERS */ | ||
1418 | |||
1419 | ENTRY(fast_syscall_spill_registers) | ||
1420 | |||
1421 | l32i a0, a2, PT_AREG0 # restore a0 | ||
1422 | movi a2, -ENOSYS | ||
1423 | rfe | ||
1424 | |||
1425 | ENDPROC(fast_syscall_spill_registers) | ||
1426 | |||
1427 | #endif /* CONFIG_FAST_SYSCALL_SPILL_REGISTERS */ | ||
1428 | |||
1403 | #ifdef CONFIG_MMU | 1429 | #ifdef CONFIG_MMU |
1404 | /* | 1430 | /* |
1405 | * We should never get here. Bail out! | 1431 | * We should never get here. Bail out! |
@@ -1565,7 +1591,7 @@ ENTRY(fast_second_level_miss) | |||
1565 | rsr a0, excvaddr | 1591 | rsr a0, excvaddr |
1566 | bltu a0, a3, 2f | 1592 | bltu a0, a3, 2f |
1567 | 1593 | ||
1568 | addi a1, a0, -(2 << (DCACHE_ALIAS_ORDER + PAGE_SHIFT)) | 1594 | addi a1, a0, -TLBTEMP_SIZE |
1569 | bgeu a1, a3, 2f | 1595 | bgeu a1, a3, 2f |
1570 | 1596 | ||
1571 | /* Check if we have to restore an ITLB mapping. */ | 1597 | /* Check if we have to restore an ITLB mapping. */ |
@@ -1820,7 +1846,6 @@ ENTRY(_switch_to) | |||
1820 | 1846 | ||
1821 | entry a1, 16 | 1847 | entry a1, 16 |
1822 | 1848 | ||
1823 | mov a10, a2 # preserve 'prev' (a2) | ||
1824 | mov a11, a3 # and 'next' (a3) | 1849 | mov a11, a3 # and 'next' (a3) |
1825 | 1850 | ||
1826 | l32i a4, a2, TASK_THREAD_INFO | 1851 | l32i a4, a2, TASK_THREAD_INFO |
@@ -1828,8 +1853,14 @@ ENTRY(_switch_to) | |||
1828 | 1853 | ||
1829 | save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER | 1854 | save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
1830 | 1855 | ||
1831 | s32i a0, a10, THREAD_RA # save return address | 1856 | #if THREAD_RA > 1020 || THREAD_SP > 1020 |
1832 | s32i a1, a10, THREAD_SP # save stack pointer | 1857 | addi a10, a2, TASK_THREAD |
1858 | s32i a0, a10, THREAD_RA - TASK_THREAD # save return address | ||
1859 | s32i a1, a10, THREAD_SP - TASK_THREAD # save stack pointer | ||
1860 | #else | ||
1861 | s32i a0, a2, THREAD_RA # save return address | ||
1862 | s32i a1, a2, THREAD_SP # save stack pointer | ||
1863 | #endif | ||
1833 | 1864 | ||
1834 | /* Disable ints while we manipulate the stack pointer. */ | 1865 | /* Disable ints while we manipulate the stack pointer. */ |
1835 | 1866 | ||
@@ -1870,7 +1901,6 @@ ENTRY(_switch_to) | |||
1870 | load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER | 1901 | load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
1871 | 1902 | ||
1872 | wsr a14, ps | 1903 | wsr a14, ps |
1873 | mov a2, a10 # return 'prev' | ||
1874 | rsync | 1904 | rsync |
1875 | 1905 | ||
1876 | retw | 1906 | retw |
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c index 2d9cc6dbfd78..e8b76b8e4b29 100644 --- a/arch/xtensa/kernel/pci-dma.c +++ b/arch/xtensa/kernel/pci-dma.c | |||
@@ -49,9 +49,8 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag) | |||
49 | 49 | ||
50 | /* We currently don't support coherent memory outside KSEG */ | 50 | /* We currently don't support coherent memory outside KSEG */ |
51 | 51 | ||
52 | if (ret < XCHAL_KSEG_CACHED_VADDR | 52 | BUG_ON(ret < XCHAL_KSEG_CACHED_VADDR || |
53 | || ret >= XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE) | 53 | ret > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1); |
54 | BUG(); | ||
55 | 54 | ||
56 | 55 | ||
57 | if (ret != 0) { | 56 | if (ret != 0) { |
@@ -68,10 +67,11 @@ EXPORT_SYMBOL(dma_alloc_coherent); | |||
68 | void dma_free_coherent(struct device *hwdev, size_t size, | 67 | void dma_free_coherent(struct device *hwdev, size_t size, |
69 | void *vaddr, dma_addr_t dma_handle) | 68 | void *vaddr, dma_addr_t dma_handle) |
70 | { | 69 | { |
71 | long addr=(long)vaddr+XCHAL_KSEG_CACHED_VADDR-XCHAL_KSEG_BYPASS_VADDR; | 70 | unsigned long addr = (unsigned long)vaddr + |
71 | XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR; | ||
72 | 72 | ||
73 | if (addr < 0 || addr >= XCHAL_KSEG_SIZE) | 73 | BUG_ON(addr < XCHAL_KSEG_CACHED_VADDR || |
74 | BUG(); | 74 | addr > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1); |
75 | 75 | ||
76 | free_pages(addr, get_order(size)); | 76 | free_pages(addr, get_order(size)); |
77 | } | 77 | } |
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c index 40b5a3771fb0..4d02e38514f5 100644 --- a/arch/xtensa/kernel/smp.c +++ b/arch/xtensa/kernel/smp.c | |||
@@ -571,6 +571,7 @@ void flush_icache_range(unsigned long start, unsigned long end) | |||
571 | }; | 571 | }; |
572 | on_each_cpu(ipi_flush_icache_range, &fd, 1); | 572 | on_each_cpu(ipi_flush_icache_range, &fd, 1); |
573 | } | 573 | } |
574 | EXPORT_SYMBOL(flush_icache_range); | ||
574 | 575 | ||
575 | /* ------------------------------------------------------------------------- */ | 576 | /* ------------------------------------------------------------------------- */ |
576 | 577 | ||
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index eebbfd8c26fc..9d2f45f010ef 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
@@ -101,9 +101,8 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = { | |||
101 | #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION | 101 | #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION |
102 | #ifdef CONFIG_XTENSA_UNALIGNED_USER | 102 | #ifdef CONFIG_XTENSA_UNALIGNED_USER |
103 | { EXCCAUSE_UNALIGNED, USER, fast_unaligned }, | 103 | { EXCCAUSE_UNALIGNED, USER, fast_unaligned }, |
104 | #else | ||
105 | { EXCCAUSE_UNALIGNED, 0, do_unaligned_user }, | ||
106 | #endif | 104 | #endif |
105 | { EXCCAUSE_UNALIGNED, 0, do_unaligned_user }, | ||
107 | { EXCCAUSE_UNALIGNED, KRNL, fast_unaligned }, | 106 | { EXCCAUSE_UNALIGNED, KRNL, fast_unaligned }, |
108 | #endif | 107 | #endif |
109 | #ifdef CONFIG_MMU | 108 | #ifdef CONFIG_MMU |
@@ -264,7 +263,6 @@ do_illegal_instruction(struct pt_regs *regs) | |||
264 | */ | 263 | */ |
265 | 264 | ||
266 | #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION | 265 | #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION |
267 | #ifndef CONFIG_XTENSA_UNALIGNED_USER | ||
268 | void | 266 | void |
269 | do_unaligned_user (struct pt_regs *regs) | 267 | do_unaligned_user (struct pt_regs *regs) |
270 | { | 268 | { |
@@ -286,7 +284,6 @@ do_unaligned_user (struct pt_regs *regs) | |||
286 | 284 | ||
287 | } | 285 | } |
288 | #endif | 286 | #endif |
289 | #endif | ||
290 | 287 | ||
291 | void | 288 | void |
292 | do_debug(struct pt_regs *regs) | 289 | do_debug(struct pt_regs *regs) |
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S index 8453e6e39895..1b397a902292 100644 --- a/arch/xtensa/kernel/vectors.S +++ b/arch/xtensa/kernel/vectors.S | |||
@@ -454,8 +454,14 @@ _DoubleExceptionVector_WindowOverflow: | |||
454 | s32i a0, a2, PT_DEPC | 454 | s32i a0, a2, PT_DEPC |
455 | 455 | ||
456 | _DoubleExceptionVector_handle_exception: | 456 | _DoubleExceptionVector_handle_exception: |
457 | addi a0, a0, -EXCCAUSE_UNALIGNED | ||
458 | beqz a0, 2f | ||
457 | addx4 a0, a0, a3 | 459 | addx4 a0, a0, a3 |
458 | l32i a0, a0, EXC_TABLE_FAST_USER | 460 | l32i a0, a0, EXC_TABLE_FAST_USER + 4 * EXCCAUSE_UNALIGNED |
461 | xsr a3, excsave1 | ||
462 | jx a0 | ||
463 | 2: | ||
464 | movi a0, user_exception | ||
459 | xsr a3, excsave1 | 465 | xsr a3, excsave1 |
460 | jx a0 | 466 | jx a0 |
461 | 467 | ||
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S index d16db6df86f8..fc1bc2ba8d5d 100644 --- a/arch/xtensa/kernel/vmlinux.lds.S +++ b/arch/xtensa/kernel/vmlinux.lds.S | |||
@@ -269,13 +269,13 @@ SECTIONS | |||
269 | .UserExceptionVector.literal) | 269 | .UserExceptionVector.literal) |
270 | SECTION_VECTOR (_DoubleExceptionVector_literal, | 270 | SECTION_VECTOR (_DoubleExceptionVector_literal, |
271 | .DoubleExceptionVector.literal, | 271 | .DoubleExceptionVector.literal, |
272 | DOUBLEEXC_VECTOR_VADDR - 40, | 272 | DOUBLEEXC_VECTOR_VADDR - 48, |
273 | SIZEOF(.UserExceptionVector.text), | 273 | SIZEOF(.UserExceptionVector.text), |
274 | .UserExceptionVector.text) | 274 | .UserExceptionVector.text) |
275 | SECTION_VECTOR (_DoubleExceptionVector_text, | 275 | SECTION_VECTOR (_DoubleExceptionVector_text, |
276 | .DoubleExceptionVector.text, | 276 | .DoubleExceptionVector.text, |
277 | DOUBLEEXC_VECTOR_VADDR, | 277 | DOUBLEEXC_VECTOR_VADDR, |
278 | 40, | 278 | 48, |
279 | .DoubleExceptionVector.literal) | 279 | .DoubleExceptionVector.literal) |
280 | 280 | ||
281 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; | 281 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; |
diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c index 63cbb867dadd..d75aa1476da7 100644 --- a/arch/xtensa/mm/cache.c +++ b/arch/xtensa/mm/cache.c | |||
@@ -59,9 +59,68 @@ | |||
59 | * | 59 | * |
60 | */ | 60 | */ |
61 | 61 | ||
62 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && defined(CONFIG_HIGHMEM) | 62 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) |
63 | #error "HIGHMEM is not supported on cores with aliasing cache." | 63 | static inline void kmap_invalidate_coherent(struct page *page, |
64 | #endif | 64 | unsigned long vaddr) |
65 | { | ||
66 | if (!DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) { | ||
67 | unsigned long kvaddr; | ||
68 | |||
69 | if (!PageHighMem(page)) { | ||
70 | kvaddr = (unsigned long)page_to_virt(page); | ||
71 | |||
72 | __invalidate_dcache_page(kvaddr); | ||
73 | } else { | ||
74 | kvaddr = TLBTEMP_BASE_1 + | ||
75 | (page_to_phys(page) & DCACHE_ALIAS_MASK); | ||
76 | |||
77 | __invalidate_dcache_page_alias(kvaddr, | ||
78 | page_to_phys(page)); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | static inline void *coherent_kvaddr(struct page *page, unsigned long base, | ||
84 | unsigned long vaddr, unsigned long *paddr) | ||
85 | { | ||
86 | if (PageHighMem(page) || !DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) { | ||
87 | *paddr = page_to_phys(page); | ||
88 | return (void *)(base + (vaddr & DCACHE_ALIAS_MASK)); | ||
89 | } else { | ||
90 | *paddr = 0; | ||
91 | return page_to_virt(page); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | void clear_user_highpage(struct page *page, unsigned long vaddr) | ||
96 | { | ||
97 | unsigned long paddr; | ||
98 | void *kvaddr = coherent_kvaddr(page, TLBTEMP_BASE_1, vaddr, &paddr); | ||
99 | |||
100 | pagefault_disable(); | ||
101 | kmap_invalidate_coherent(page, vaddr); | ||
102 | set_bit(PG_arch_1, &page->flags); | ||
103 | clear_page_alias(kvaddr, paddr); | ||
104 | pagefault_enable(); | ||
105 | } | ||
106 | |||
107 | void copy_user_highpage(struct page *dst, struct page *src, | ||
108 | unsigned long vaddr, struct vm_area_struct *vma) | ||
109 | { | ||
110 | unsigned long dst_paddr, src_paddr; | ||
111 | void *dst_vaddr = coherent_kvaddr(dst, TLBTEMP_BASE_1, vaddr, | ||
112 | &dst_paddr); | ||
113 | void *src_vaddr = coherent_kvaddr(src, TLBTEMP_BASE_2, vaddr, | ||
114 | &src_paddr); | ||
115 | |||
116 | pagefault_disable(); | ||
117 | kmap_invalidate_coherent(dst, vaddr); | ||
118 | set_bit(PG_arch_1, &dst->flags); | ||
119 | copy_page_alias(dst_vaddr, src_vaddr, dst_paddr, src_paddr); | ||
120 | pagefault_enable(); | ||
121 | } | ||
122 | |||
123 | #endif /* DCACHE_WAY_SIZE > PAGE_SIZE */ | ||
65 | 124 | ||
66 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | 125 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK |
67 | 126 | ||
@@ -103,7 +162,8 @@ void flush_dcache_page(struct page *page) | |||
103 | if (!alias && !mapping) | 162 | if (!alias && !mapping) |
104 | return; | 163 | return; |
105 | 164 | ||
106 | __flush_invalidate_dcache_page((long)page_address(page)); | 165 | virt = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK); |
166 | __flush_invalidate_dcache_page_alias(virt, phys); | ||
107 | 167 | ||
108 | virt = TLBTEMP_BASE_1 + (temp & DCACHE_ALIAS_MASK); | 168 | virt = TLBTEMP_BASE_1 + (temp & DCACHE_ALIAS_MASK); |
109 | 169 | ||
@@ -168,13 +228,12 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep) | |||
168 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | 228 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK |
169 | 229 | ||
170 | if (!PageReserved(page) && test_bit(PG_arch_1, &page->flags)) { | 230 | if (!PageReserved(page) && test_bit(PG_arch_1, &page->flags)) { |
171 | |||
172 | unsigned long paddr = (unsigned long) page_address(page); | ||
173 | unsigned long phys = page_to_phys(page); | 231 | unsigned long phys = page_to_phys(page); |
174 | unsigned long tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK); | 232 | unsigned long tmp; |
175 | |||
176 | __flush_invalidate_dcache_page(paddr); | ||
177 | 233 | ||
234 | tmp = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK); | ||
235 | __flush_invalidate_dcache_page_alias(tmp, phys); | ||
236 | tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK); | ||
178 | __flush_invalidate_dcache_page_alias(tmp, phys); | 237 | __flush_invalidate_dcache_page_alias(tmp, phys); |
179 | __invalidate_icache_page_alias(tmp, phys); | 238 | __invalidate_icache_page_alias(tmp, phys); |
180 | 239 | ||
diff --git a/arch/xtensa/mm/highmem.c b/arch/xtensa/mm/highmem.c index 17a8c0d6fd17..8cfb71ec0937 100644 --- a/arch/xtensa/mm/highmem.c +++ b/arch/xtensa/mm/highmem.c | |||
@@ -14,23 +14,45 @@ | |||
14 | 14 | ||
15 | static pte_t *kmap_pte; | 15 | static pte_t *kmap_pte; |
16 | 16 | ||
17 | #if DCACHE_WAY_SIZE > PAGE_SIZE | ||
18 | unsigned int last_pkmap_nr_arr[DCACHE_N_COLORS]; | ||
19 | wait_queue_head_t pkmap_map_wait_arr[DCACHE_N_COLORS]; | ||
20 | |||
21 | static void __init kmap_waitqueues_init(void) | ||
22 | { | ||
23 | unsigned int i; | ||
24 | |||
25 | for (i = 0; i < ARRAY_SIZE(pkmap_map_wait_arr); ++i) | ||
26 | init_waitqueue_head(pkmap_map_wait_arr + i); | ||
27 | } | ||
28 | #else | ||
29 | static inline void kmap_waitqueues_init(void) | ||
30 | { | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | static inline enum fixed_addresses kmap_idx(int type, unsigned long color) | ||
35 | { | ||
36 | return (type + KM_TYPE_NR * smp_processor_id()) * DCACHE_N_COLORS + | ||
37 | color; | ||
38 | } | ||
39 | |||
17 | void *kmap_atomic(struct page *page) | 40 | void *kmap_atomic(struct page *page) |
18 | { | 41 | { |
19 | enum fixed_addresses idx; | 42 | enum fixed_addresses idx; |
20 | unsigned long vaddr; | 43 | unsigned long vaddr; |
21 | int type; | ||
22 | 44 | ||
23 | pagefault_disable(); | 45 | pagefault_disable(); |
24 | if (!PageHighMem(page)) | 46 | if (!PageHighMem(page)) |
25 | return page_address(page); | 47 | return page_address(page); |
26 | 48 | ||
27 | type = kmap_atomic_idx_push(); | 49 | idx = kmap_idx(kmap_atomic_idx_push(), |
28 | idx = type + KM_TYPE_NR * smp_processor_id(); | 50 | DCACHE_ALIAS(page_to_phys(page))); |
29 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); | 51 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); |
30 | #ifdef CONFIG_DEBUG_HIGHMEM | 52 | #ifdef CONFIG_DEBUG_HIGHMEM |
31 | BUG_ON(!pte_none(*(kmap_pte - idx))); | 53 | BUG_ON(!pte_none(*(kmap_pte + idx))); |
32 | #endif | 54 | #endif |
33 | set_pte(kmap_pte - idx, mk_pte(page, PAGE_KERNEL_EXEC)); | 55 | set_pte(kmap_pte + idx, mk_pte(page, PAGE_KERNEL_EXEC)); |
34 | 56 | ||
35 | return (void *)vaddr; | 57 | return (void *)vaddr; |
36 | } | 58 | } |
@@ -38,12 +60,10 @@ EXPORT_SYMBOL(kmap_atomic); | |||
38 | 60 | ||
39 | void __kunmap_atomic(void *kvaddr) | 61 | void __kunmap_atomic(void *kvaddr) |
40 | { | 62 | { |
41 | int idx, type; | ||
42 | |||
43 | if (kvaddr >= (void *)FIXADDR_START && | 63 | if (kvaddr >= (void *)FIXADDR_START && |
44 | kvaddr < (void *)FIXADDR_TOP) { | 64 | kvaddr < (void *)FIXADDR_TOP) { |
45 | type = kmap_atomic_idx(); | 65 | int idx = kmap_idx(kmap_atomic_idx(), |
46 | idx = type + KM_TYPE_NR * smp_processor_id(); | 66 | DCACHE_ALIAS((unsigned long)kvaddr)); |
47 | 67 | ||
48 | /* | 68 | /* |
49 | * Force other mappings to Oops if they'll try to access this | 69 | * Force other mappings to Oops if they'll try to access this |
@@ -51,7 +71,7 @@ void __kunmap_atomic(void *kvaddr) | |||
51 | * is a bad idea also, in case the page changes cacheability | 71 | * is a bad idea also, in case the page changes cacheability |
52 | * attributes or becomes a protected page in a hypervisor. | 72 | * attributes or becomes a protected page in a hypervisor. |
53 | */ | 73 | */ |
54 | pte_clear(&init_mm, kvaddr, kmap_pte - idx); | 74 | pte_clear(&init_mm, kvaddr, kmap_pte + idx); |
55 | local_flush_tlb_kernel_range((unsigned long)kvaddr, | 75 | local_flush_tlb_kernel_range((unsigned long)kvaddr, |
56 | (unsigned long)kvaddr + PAGE_SIZE); | 76 | (unsigned long)kvaddr + PAGE_SIZE); |
57 | 77 | ||
@@ -69,4 +89,5 @@ void __init kmap_init(void) | |||
69 | /* cache the first kmap pte */ | 89 | /* cache the first kmap pte */ |
70 | kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); | 90 | kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); |
71 | kmap_pte = kmap_get_fixmap_pte(kmap_vstart); | 91 | kmap_pte = kmap_get_fixmap_pte(kmap_vstart); |
92 | kmap_waitqueues_init(); | ||
72 | } | 93 | } |
diff --git a/arch/xtensa/mm/misc.S b/arch/xtensa/mm/misc.S index 1f68558dbcc2..11a01c3e9cea 100644 --- a/arch/xtensa/mm/misc.S +++ b/arch/xtensa/mm/misc.S | |||
@@ -110,41 +110,24 @@ ENTRY(__tlbtemp_mapping_start) | |||
110 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) | 110 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * clear_user_page (void *addr, unsigned long vaddr, struct page *page) | 113 | * clear_page_alias(void *addr, unsigned long paddr) |
114 | * a2 a3 a4 | 114 | * a2 a3 |
115 | */ | 115 | */ |
116 | 116 | ||
117 | ENTRY(clear_user_page) | 117 | ENTRY(clear_page_alias) |
118 | 118 | ||
119 | entry a1, 32 | 119 | entry a1, 32 |
120 | 120 | ||
121 | /* Mark page dirty and determine alias. */ | 121 | /* Skip setting up a temporary DTLB if not aliased low page. */ |
122 | 122 | ||
123 | movi a7, (1 << PG_ARCH_1) | 123 | movi a5, PAGE_OFFSET |
124 | l32i a5, a4, PAGE_FLAGS | 124 | movi a6, 0 |
125 | xor a6, a2, a3 | 125 | beqz a3, 1f |
126 | extui a3, a3, PAGE_SHIFT, DCACHE_ALIAS_ORDER | ||
127 | extui a6, a6, PAGE_SHIFT, DCACHE_ALIAS_ORDER | ||
128 | or a5, a5, a7 | ||
129 | slli a3, a3, PAGE_SHIFT | ||
130 | s32i a5, a4, PAGE_FLAGS | ||
131 | 126 | ||
132 | /* Skip setting up a temporary DTLB if not aliased. */ | 127 | /* Setup a temporary DTLB for the addr. */ |
133 | |||
134 | beqz a6, 1f | ||
135 | |||
136 | /* Invalidate kernel page. */ | ||
137 | |||
138 | mov a10, a2 | ||
139 | call8 __invalidate_dcache_page | ||
140 | |||
141 | /* Setup a temporary DTLB with the color of the VPN */ | ||
142 | |||
143 | movi a4, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff | ||
144 | movi a5, TLBTEMP_BASE_1 # virt | ||
145 | add a6, a2, a4 # ppn | ||
146 | add a2, a5, a3 # add 'color' | ||
147 | 128 | ||
129 | addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE) | ||
130 | mov a4, a2 | ||
148 | wdtlb a6, a2 | 131 | wdtlb a6, a2 |
149 | dsync | 132 | dsync |
150 | 133 | ||
@@ -165,62 +148,43 @@ ENTRY(clear_user_page) | |||
165 | 148 | ||
166 | /* We need to invalidate the temporary idtlb entry, if any. */ | 149 | /* We need to invalidate the temporary idtlb entry, if any. */ |
167 | 150 | ||
168 | 1: addi a2, a2, -PAGE_SIZE | 151 | 1: idtlb a4 |
169 | idtlb a2 | ||
170 | dsync | 152 | dsync |
171 | 153 | ||
172 | retw | 154 | retw |
173 | 155 | ||
174 | ENDPROC(clear_user_page) | 156 | ENDPROC(clear_page_alias) |
175 | 157 | ||
176 | /* | 158 | /* |
177 | * copy_page_user (void *to, void *from, unsigned long vaddr, struct page *page) | 159 | * copy_page_alias(void *to, void *from, |
178 | * a2 a3 a4 a5 | 160 | * a2 a3 |
161 | * unsigned long to_paddr, unsigned long from_paddr) | ||
162 | * a4 a5 | ||
179 | */ | 163 | */ |
180 | 164 | ||
181 | ENTRY(copy_user_page) | 165 | ENTRY(copy_page_alias) |
182 | 166 | ||
183 | entry a1, 32 | 167 | entry a1, 32 |
184 | 168 | ||
185 | /* Mark page dirty and determine alias for destination. */ | 169 | /* Skip setting up a temporary DTLB for destination if not aliased. */ |
186 | |||
187 | movi a8, (1 << PG_ARCH_1) | ||
188 | l32i a9, a5, PAGE_FLAGS | ||
189 | xor a6, a2, a4 | ||
190 | xor a7, a3, a4 | ||
191 | extui a4, a4, PAGE_SHIFT, DCACHE_ALIAS_ORDER | ||
192 | extui a6, a6, PAGE_SHIFT, DCACHE_ALIAS_ORDER | ||
193 | extui a7, a7, PAGE_SHIFT, DCACHE_ALIAS_ORDER | ||
194 | or a9, a9, a8 | ||
195 | slli a4, a4, PAGE_SHIFT | ||
196 | s32i a9, a5, PAGE_FLAGS | ||
197 | movi a5, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff | ||
198 | |||
199 | beqz a6, 1f | ||
200 | |||
201 | /* Invalidate dcache */ | ||
202 | |||
203 | mov a10, a2 | ||
204 | call8 __invalidate_dcache_page | ||
205 | 170 | ||
206 | /* Setup a temporary DTLB with a matching color. */ | 171 | movi a6, 0 |
172 | movi a7, 0 | ||
173 | beqz a4, 1f | ||
207 | 174 | ||
208 | movi a8, TLBTEMP_BASE_1 # base | 175 | /* Setup a temporary DTLB for destination. */ |
209 | add a6, a2, a5 # ppn | ||
210 | add a2, a8, a4 # add 'color' | ||
211 | 176 | ||
177 | addi a6, a4, (PAGE_KERNEL | _PAGE_HW_WRITE) | ||
212 | wdtlb a6, a2 | 178 | wdtlb a6, a2 |
213 | dsync | 179 | dsync |
214 | 180 | ||
215 | /* Skip setting up a temporary DTLB for destination if not aliased. */ | 181 | /* Skip setting up a temporary DTLB for source if not aliased. */ |
216 | 182 | ||
217 | 1: beqz a7, 1f | 183 | 1: beqz a5, 1f |
218 | 184 | ||
219 | /* Setup a temporary DTLB with a matching color. */ | 185 | /* Setup a temporary DTLB for source. */ |
220 | 186 | ||
221 | movi a8, TLBTEMP_BASE_2 # base | 187 | addi a7, a5, PAGE_KERNEL |
222 | add a7, a3, a5 # ppn | ||
223 | add a3, a8, a4 | ||
224 | addi a8, a3, 1 # way1 | 188 | addi a8, a3, 1 # way1 |
225 | 189 | ||
226 | wdtlb a7, a8 | 190 | wdtlb a7, a8 |
@@ -271,7 +235,7 @@ ENTRY(copy_user_page) | |||
271 | 235 | ||
272 | retw | 236 | retw |
273 | 237 | ||
274 | ENDPROC(copy_user_page) | 238 | ENDPROC(copy_page_alias) |
275 | 239 | ||
276 | #endif | 240 | #endif |
277 | 241 | ||
@@ -300,6 +264,30 @@ ENTRY(__flush_invalidate_dcache_page_alias) | |||
300 | retw | 264 | retw |
301 | 265 | ||
302 | ENDPROC(__flush_invalidate_dcache_page_alias) | 266 | ENDPROC(__flush_invalidate_dcache_page_alias) |
267 | |||
268 | /* | ||
269 | * void __invalidate_dcache_page_alias (addr, phys) | ||
270 | * a2 a3 | ||
271 | */ | ||
272 | |||
273 | ENTRY(__invalidate_dcache_page_alias) | ||
274 | |||
275 | entry sp, 16 | ||
276 | |||
277 | movi a7, 0 # required for exception handler | ||
278 | addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE) | ||
279 | mov a4, a2 | ||
280 | wdtlb a6, a2 | ||
281 | dsync | ||
282 | |||
283 | ___invalidate_dcache_page a2 a3 | ||
284 | |||
285 | idtlb a4 | ||
286 | dsync | ||
287 | |||
288 | retw | ||
289 | |||
290 | ENDPROC(__invalidate_dcache_page_alias) | ||
303 | #endif | 291 | #endif |
304 | 292 | ||
305 | ENTRY(__tlbtemp_mapping_itlb) | 293 | ENTRY(__tlbtemp_mapping_itlb) |
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c index 3429b483d9f8..abe4513eb0dd 100644 --- a/arch/xtensa/mm/mmu.c +++ b/arch/xtensa/mm/mmu.c | |||
@@ -18,32 +18,38 @@ | |||
18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
19 | 19 | ||
20 | #if defined(CONFIG_HIGHMEM) | 20 | #if defined(CONFIG_HIGHMEM) |
21 | static void * __init init_pmd(unsigned long vaddr) | 21 | static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages) |
22 | { | 22 | { |
23 | pgd_t *pgd = pgd_offset_k(vaddr); | 23 | pgd_t *pgd = pgd_offset_k(vaddr); |
24 | pmd_t *pmd = pmd_offset(pgd, vaddr); | 24 | pmd_t *pmd = pmd_offset(pgd, vaddr); |
25 | pte_t *pte; | ||
26 | unsigned long i; | ||
25 | 27 | ||
26 | if (pmd_none(*pmd)) { | 28 | n_pages = ALIGN(n_pages, PTRS_PER_PTE); |
27 | unsigned i; | ||
28 | pte_t *pte = alloc_bootmem_low_pages(PAGE_SIZE); | ||
29 | 29 | ||
30 | for (i = 0; i < 1024; i++) | 30 | pr_debug("%s: vaddr: 0x%08lx, n_pages: %ld\n", |
31 | pte_clear(NULL, 0, pte + i); | 31 | __func__, vaddr, n_pages); |
32 | 32 | ||
33 | set_pmd(pmd, __pmd(((unsigned long)pte) & PAGE_MASK)); | 33 | pte = alloc_bootmem_low_pages(n_pages * sizeof(pte_t)); |
34 | BUG_ON(pte != pte_offset_kernel(pmd, 0)); | 34 | |
35 | pr_debug("%s: vaddr: 0x%08lx, pmd: 0x%p, pte: 0x%p\n", | 35 | for (i = 0; i < n_pages; ++i) |
36 | __func__, vaddr, pmd, pte); | 36 | pte_clear(NULL, 0, pte + i); |
37 | return pte; | 37 | |
38 | } else { | 38 | for (i = 0; i < n_pages; i += PTRS_PER_PTE, ++pmd) { |
39 | return pte_offset_kernel(pmd, 0); | 39 | pte_t *cur_pte = pte + i; |
40 | |||
41 | BUG_ON(!pmd_none(*pmd)); | ||
42 | set_pmd(pmd, __pmd(((unsigned long)cur_pte) & PAGE_MASK)); | ||
43 | BUG_ON(cur_pte != pte_offset_kernel(pmd, 0)); | ||
44 | pr_debug("%s: pmd: 0x%p, pte: 0x%p\n", | ||
45 | __func__, pmd, cur_pte); | ||
40 | } | 46 | } |
47 | return pte; | ||
41 | } | 48 | } |
42 | 49 | ||
43 | static void __init fixedrange_init(void) | 50 | static void __init fixedrange_init(void) |
44 | { | 51 | { |
45 | BUILD_BUG_ON(FIXADDR_SIZE > PMD_SIZE); | 52 | init_pmd(__fix_to_virt(0), __end_of_fixed_addresses); |
46 | init_pmd(__fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK); | ||
47 | } | 53 | } |
48 | #endif | 54 | #endif |
49 | 55 | ||
@@ -52,7 +58,7 @@ void __init paging_init(void) | |||
52 | memset(swapper_pg_dir, 0, PAGE_SIZE); | 58 | memset(swapper_pg_dir, 0, PAGE_SIZE); |
53 | #ifdef CONFIG_HIGHMEM | 59 | #ifdef CONFIG_HIGHMEM |
54 | fixedrange_init(); | 60 | fixedrange_init(); |
55 | pkmap_page_table = init_pmd(PKMAP_BASE); | 61 | pkmap_page_table = init_pmd(PKMAP_BASE, LAST_PKMAP); |
56 | kmap_init(); | 62 | kmap_init(); |
57 | #endif | 63 | #endif |
58 | } | 64 | } |
diff --git a/block/bio-integrity.c b/block/bio-integrity.c index bc423f7b02da..f14b4abbebd8 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c | |||
@@ -520,7 +520,7 @@ void bio_integrity_endio(struct bio *bio, int error) | |||
520 | */ | 520 | */ |
521 | if (error) { | 521 | if (error) { |
522 | bio->bi_end_io = bip->bip_end_io; | 522 | bio->bi_end_io = bip->bip_end_io; |
523 | bio_endio(bio, error); | 523 | bio_endio_nodec(bio, error); |
524 | 524 | ||
525 | return; | 525 | return; |
526 | } | 526 | } |
diff --git a/block/blk-core.c b/block/blk-core.c index c359d72e9d76..bf930f481d43 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1252,7 +1252,6 @@ void blk_rq_set_block_pc(struct request *rq) | |||
1252 | rq->__sector = (sector_t) -1; | 1252 | rq->__sector = (sector_t) -1; |
1253 | rq->bio = rq->biotail = NULL; | 1253 | rq->bio = rq->biotail = NULL; |
1254 | memset(rq->__cmd, 0, sizeof(rq->__cmd)); | 1254 | memset(rq->__cmd, 0, sizeof(rq->__cmd)); |
1255 | rq->cmd = rq->__cmd; | ||
1256 | } | 1255 | } |
1257 | EXPORT_SYMBOL(blk_rq_set_block_pc); | 1256 | EXPORT_SYMBOL(blk_rq_set_block_pc); |
1258 | 1257 | ||
diff --git a/block/blk-exec.c b/block/blk-exec.c index f4d27b12c90b..9924725fa50d 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c | |||
@@ -56,6 +56,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, | |||
56 | bool is_pm_resume; | 56 | bool is_pm_resume; |
57 | 57 | ||
58 | WARN_ON(irqs_disabled()); | 58 | WARN_ON(irqs_disabled()); |
59 | WARN_ON(rq->cmd_type == REQ_TYPE_FS); | ||
59 | 60 | ||
60 | rq->rq_disk = bd_disk; | 61 | rq->rq_disk = bd_disk; |
61 | rq->end_io = done; | 62 | rq->end_io = done; |
diff --git a/block/blk-merge.c b/block/blk-merge.c index 54535831f1e1..77881798f793 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -10,10 +10,11 @@ | |||
10 | #include "blk.h" | 10 | #include "blk.h" |
11 | 11 | ||
12 | static unsigned int __blk_recalc_rq_segments(struct request_queue *q, | 12 | static unsigned int __blk_recalc_rq_segments(struct request_queue *q, |
13 | struct bio *bio) | 13 | struct bio *bio, |
14 | bool no_sg_merge) | ||
14 | { | 15 | { |
15 | struct bio_vec bv, bvprv = { NULL }; | 16 | struct bio_vec bv, bvprv = { NULL }; |
16 | int cluster, high, highprv = 1, no_sg_merge; | 17 | int cluster, high, highprv = 1; |
17 | unsigned int seg_size, nr_phys_segs; | 18 | unsigned int seg_size, nr_phys_segs; |
18 | struct bio *fbio, *bbio; | 19 | struct bio *fbio, *bbio; |
19 | struct bvec_iter iter; | 20 | struct bvec_iter iter; |
@@ -35,7 +36,6 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q, | |||
35 | cluster = blk_queue_cluster(q); | 36 | cluster = blk_queue_cluster(q); |
36 | seg_size = 0; | 37 | seg_size = 0; |
37 | nr_phys_segs = 0; | 38 | nr_phys_segs = 0; |
38 | no_sg_merge = test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags); | ||
39 | high = 0; | 39 | high = 0; |
40 | for_each_bio(bio) { | 40 | for_each_bio(bio) { |
41 | bio_for_each_segment(bv, bio, iter) { | 41 | bio_for_each_segment(bv, bio, iter) { |
@@ -88,18 +88,23 @@ new_segment: | |||
88 | 88 | ||
89 | void blk_recalc_rq_segments(struct request *rq) | 89 | void blk_recalc_rq_segments(struct request *rq) |
90 | { | 90 | { |
91 | rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio); | 91 | bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, |
92 | &rq->q->queue_flags); | ||
93 | |||
94 | rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio, | ||
95 | no_sg_merge); | ||
92 | } | 96 | } |
93 | 97 | ||
94 | void blk_recount_segments(struct request_queue *q, struct bio *bio) | 98 | void blk_recount_segments(struct request_queue *q, struct bio *bio) |
95 | { | 99 | { |
96 | if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags)) | 100 | if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) && |
101 | bio->bi_vcnt < queue_max_segments(q)) | ||
97 | bio->bi_phys_segments = bio->bi_vcnt; | 102 | bio->bi_phys_segments = bio->bi_vcnt; |
98 | else { | 103 | else { |
99 | struct bio *nxt = bio->bi_next; | 104 | struct bio *nxt = bio->bi_next; |
100 | 105 | ||
101 | bio->bi_next = NULL; | 106 | bio->bi_next = NULL; |
102 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio); | 107 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, false); |
103 | bio->bi_next = nxt; | 108 | bio->bi_next = nxt; |
104 | } | 109 | } |
105 | 110 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index 5189cb1e478a..df8e1e09dd17 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -112,18 +112,31 @@ static void blk_mq_usage_counter_release(struct percpu_ref *ref) | |||
112 | */ | 112 | */ |
113 | void blk_mq_freeze_queue(struct request_queue *q) | 113 | void blk_mq_freeze_queue(struct request_queue *q) |
114 | { | 114 | { |
115 | bool freeze; | ||
116 | |||
115 | spin_lock_irq(q->queue_lock); | 117 | spin_lock_irq(q->queue_lock); |
116 | q->mq_freeze_depth++; | 118 | freeze = !q->mq_freeze_depth++; |
117 | spin_unlock_irq(q->queue_lock); | 119 | spin_unlock_irq(q->queue_lock); |
118 | 120 | ||
119 | percpu_ref_kill(&q->mq_usage_counter); | 121 | if (freeze) { |
120 | blk_mq_run_queues(q, false); | 122 | /* |
123 | * XXX: Temporary kludge to work around SCSI blk-mq stall. | ||
124 | * SCSI synchronously creates and destroys many queues | ||
125 | * back-to-back during probe leading to lengthy stalls. | ||
126 | * This will be fixed by keeping ->mq_usage_counter in | ||
127 | * atomic mode until genhd registration, but, for now, | ||
128 | * let's work around using expedited synchronization. | ||
129 | */ | ||
130 | __percpu_ref_kill_expedited(&q->mq_usage_counter); | ||
131 | |||
132 | blk_mq_run_queues(q, false); | ||
133 | } | ||
121 | wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); | 134 | wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); |
122 | } | 135 | } |
123 | 136 | ||
124 | static void blk_mq_unfreeze_queue(struct request_queue *q) | 137 | static void blk_mq_unfreeze_queue(struct request_queue *q) |
125 | { | 138 | { |
126 | bool wake = false; | 139 | bool wake; |
127 | 140 | ||
128 | spin_lock_irq(q->queue_lock); | 141 | spin_lock_irq(q->queue_lock); |
129 | wake = !--q->mq_freeze_depth; | 142 | wake = !--q->mq_freeze_depth; |
@@ -172,6 +185,8 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx, | |||
172 | /* tag was already set */ | 185 | /* tag was already set */ |
173 | rq->errors = 0; | 186 | rq->errors = 0; |
174 | 187 | ||
188 | rq->cmd = rq->__cmd; | ||
189 | |||
175 | rq->extra_len = 0; | 190 | rq->extra_len = 0; |
176 | rq->sense_len = 0; | 191 | rq->sense_len = 0; |
177 | rq->resid_len = 0; | 192 | rq->resid_len = 0; |
@@ -197,7 +212,6 @@ __blk_mq_alloc_request(struct blk_mq_alloc_data *data, int rw) | |||
197 | if (tag != BLK_MQ_TAG_FAIL) { | 212 | if (tag != BLK_MQ_TAG_FAIL) { |
198 | rq = data->hctx->tags->rqs[tag]; | 213 | rq = data->hctx->tags->rqs[tag]; |
199 | 214 | ||
200 | rq->cmd_flags = 0; | ||
201 | if (blk_mq_tag_busy(data->hctx)) { | 215 | if (blk_mq_tag_busy(data->hctx)) { |
202 | rq->cmd_flags = REQ_MQ_INFLIGHT; | 216 | rq->cmd_flags = REQ_MQ_INFLIGHT; |
203 | atomic_inc(&data->hctx->nr_active); | 217 | atomic_inc(&data->hctx->nr_active); |
@@ -252,6 +266,7 @@ static void __blk_mq_free_request(struct blk_mq_hw_ctx *hctx, | |||
252 | 266 | ||
253 | if (rq->cmd_flags & REQ_MQ_INFLIGHT) | 267 | if (rq->cmd_flags & REQ_MQ_INFLIGHT) |
254 | atomic_dec(&hctx->nr_active); | 268 | atomic_dec(&hctx->nr_active); |
269 | rq->cmd_flags = 0; | ||
255 | 270 | ||
256 | clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags); | 271 | clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags); |
257 | blk_mq_put_tag(hctx, tag, &ctx->last_tag); | 272 | blk_mq_put_tag(hctx, tag, &ctx->last_tag); |
@@ -387,6 +402,12 @@ static void blk_mq_start_request(struct request *rq, bool last) | |||
387 | blk_add_timer(rq); | 402 | blk_add_timer(rq); |
388 | 403 | ||
389 | /* | 404 | /* |
405 | * Ensure that ->deadline is visible before set the started | ||
406 | * flag and clear the completed flag. | ||
407 | */ | ||
408 | smp_mb__before_atomic(); | ||
409 | |||
410 | /* | ||
390 | * Mark us as started and clear complete. Complete might have been | 411 | * Mark us as started and clear complete. Complete might have been |
391 | * set if requeue raced with timeout, which then marked it as | 412 | * set if requeue raced with timeout, which then marked it as |
392 | * complete. So be sure to clear complete again when we start | 413 | * complete. So be sure to clear complete again when we start |
@@ -467,7 +488,11 @@ static void blk_mq_requeue_work(struct work_struct *work) | |||
467 | blk_mq_insert_request(rq, false, false, false); | 488 | blk_mq_insert_request(rq, false, false, false); |
468 | } | 489 | } |
469 | 490 | ||
470 | blk_mq_run_queues(q, false); | 491 | /* |
492 | * Use the start variant of queue running here, so that running | ||
493 | * the requeue work will kick stopped queues. | ||
494 | */ | ||
495 | blk_mq_start_hw_queues(q); | ||
471 | } | 496 | } |
472 | 497 | ||
473 | void blk_mq_add_to_requeue_list(struct request *rq, bool at_head) | 498 | void blk_mq_add_to_requeue_list(struct request *rq, bool at_head) |
@@ -951,14 +976,9 @@ void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue, | |||
951 | 976 | ||
952 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | 977 | hctx = q->mq_ops->map_queue(q, ctx->cpu); |
953 | 978 | ||
954 | if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA) && | 979 | spin_lock(&ctx->lock); |
955 | !(rq->cmd_flags & (REQ_FLUSH_SEQ))) { | 980 | __blk_mq_insert_request(hctx, rq, at_head); |
956 | blk_insert_flush(rq); | 981 | spin_unlock(&ctx->lock); |
957 | } else { | ||
958 | spin_lock(&ctx->lock); | ||
959 | __blk_mq_insert_request(hctx, rq, at_head); | ||
960 | spin_unlock(&ctx->lock); | ||
961 | } | ||
962 | 982 | ||
963 | if (run_queue) | 983 | if (run_queue) |
964 | blk_mq_run_hw_queue(hctx, async); | 984 | blk_mq_run_hw_queue(hctx, async); |
@@ -1068,13 +1088,17 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio) | |||
1068 | blk_account_io_start(rq, 1); | 1088 | blk_account_io_start(rq, 1); |
1069 | } | 1089 | } |
1070 | 1090 | ||
1091 | static inline bool hctx_allow_merges(struct blk_mq_hw_ctx *hctx) | ||
1092 | { | ||
1093 | return (hctx->flags & BLK_MQ_F_SHOULD_MERGE) && | ||
1094 | !blk_queue_nomerges(hctx->queue); | ||
1095 | } | ||
1096 | |||
1071 | static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx, | 1097 | static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx, |
1072 | struct blk_mq_ctx *ctx, | 1098 | struct blk_mq_ctx *ctx, |
1073 | struct request *rq, struct bio *bio) | 1099 | struct request *rq, struct bio *bio) |
1074 | { | 1100 | { |
1075 | struct request_queue *q = hctx->queue; | 1101 | if (!hctx_allow_merges(hctx)) { |
1076 | |||
1077 | if (!(hctx->flags & BLK_MQ_F_SHOULD_MERGE)) { | ||
1078 | blk_mq_bio_to_request(rq, bio); | 1102 | blk_mq_bio_to_request(rq, bio); |
1079 | spin_lock(&ctx->lock); | 1103 | spin_lock(&ctx->lock); |
1080 | insert_rq: | 1104 | insert_rq: |
@@ -1082,6 +1106,8 @@ insert_rq: | |||
1082 | spin_unlock(&ctx->lock); | 1106 | spin_unlock(&ctx->lock); |
1083 | return false; | 1107 | return false; |
1084 | } else { | 1108 | } else { |
1109 | struct request_queue *q = hctx->queue; | ||
1110 | |||
1085 | spin_lock(&ctx->lock); | 1111 | spin_lock(&ctx->lock); |
1086 | if (!blk_mq_attempt_merge(q, ctx, bio)) { | 1112 | if (!blk_mq_attempt_merge(q, ctx, bio)) { |
1087 | blk_mq_bio_to_request(rq, bio); | 1113 | blk_mq_bio_to_request(rq, bio); |
@@ -1309,6 +1335,7 @@ static void blk_mq_free_rq_map(struct blk_mq_tag_set *set, | |||
1309 | continue; | 1335 | continue; |
1310 | set->ops->exit_request(set->driver_data, tags->rqs[i], | 1336 | set->ops->exit_request(set->driver_data, tags->rqs[i], |
1311 | hctx_idx, i); | 1337 | hctx_idx, i); |
1338 | tags->rqs[i] = NULL; | ||
1312 | } | 1339 | } |
1313 | } | 1340 | } |
1314 | 1341 | ||
@@ -1342,8 +1369,9 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1342 | 1369 | ||
1343 | INIT_LIST_HEAD(&tags->page_list); | 1370 | INIT_LIST_HEAD(&tags->page_list); |
1344 | 1371 | ||
1345 | tags->rqs = kmalloc_node(set->queue_depth * sizeof(struct request *), | 1372 | tags->rqs = kzalloc_node(set->queue_depth * sizeof(struct request *), |
1346 | GFP_KERNEL, set->numa_node); | 1373 | GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, |
1374 | set->numa_node); | ||
1347 | if (!tags->rqs) { | 1375 | if (!tags->rqs) { |
1348 | blk_mq_free_tags(tags); | 1376 | blk_mq_free_tags(tags); |
1349 | return NULL; | 1377 | return NULL; |
@@ -1367,8 +1395,9 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1367 | this_order--; | 1395 | this_order--; |
1368 | 1396 | ||
1369 | do { | 1397 | do { |
1370 | page = alloc_pages_node(set->numa_node, GFP_KERNEL, | 1398 | page = alloc_pages_node(set->numa_node, |
1371 | this_order); | 1399 | GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, |
1400 | this_order); | ||
1372 | if (page) | 1401 | if (page) |
1373 | break; | 1402 | break; |
1374 | if (!this_order--) | 1403 | if (!this_order--) |
@@ -1389,11 +1418,15 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1389 | left -= to_do * rq_size; | 1418 | left -= to_do * rq_size; |
1390 | for (j = 0; j < to_do; j++) { | 1419 | for (j = 0; j < to_do; j++) { |
1391 | tags->rqs[i] = p; | 1420 | tags->rqs[i] = p; |
1421 | tags->rqs[i]->atomic_flags = 0; | ||
1422 | tags->rqs[i]->cmd_flags = 0; | ||
1392 | if (set->ops->init_request) { | 1423 | if (set->ops->init_request) { |
1393 | if (set->ops->init_request(set->driver_data, | 1424 | if (set->ops->init_request(set->driver_data, |
1394 | tags->rqs[i], hctx_idx, i, | 1425 | tags->rqs[i], hctx_idx, i, |
1395 | set->numa_node)) | 1426 | set->numa_node)) { |
1427 | tags->rqs[i] = NULL; | ||
1396 | goto fail; | 1428 | goto fail; |
1429 | } | ||
1397 | } | 1430 | } |
1398 | 1431 | ||
1399 | p += rq_size; | 1432 | p += rq_size; |
@@ -1404,7 +1437,6 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1404 | return tags; | 1437 | return tags; |
1405 | 1438 | ||
1406 | fail: | 1439 | fail: |
1407 | pr_warn("%s: failed to allocate requests\n", __func__); | ||
1408 | blk_mq_free_rq_map(set, tags, hctx_idx); | 1440 | blk_mq_free_rq_map(set, tags, hctx_idx); |
1409 | return NULL; | 1441 | return NULL; |
1410 | } | 1442 | } |
@@ -1574,7 +1606,7 @@ static int blk_mq_init_hw_queues(struct request_queue *q, | |||
1574 | hctx->tags = set->tags[i]; | 1606 | hctx->tags = set->tags[i]; |
1575 | 1607 | ||
1576 | /* | 1608 | /* |
1577 | * Allocate space for all possible cpus to avoid allocation in | 1609 | * Allocate space for all possible cpus to avoid allocation at |
1578 | * runtime | 1610 | * runtime |
1579 | */ | 1611 | */ |
1580 | hctx->ctxs = kmalloc_node(nr_cpu_ids * sizeof(void *), | 1612 | hctx->ctxs = kmalloc_node(nr_cpu_ids * sizeof(void *), |
@@ -1662,8 +1694,8 @@ static void blk_mq_map_swqueue(struct request_queue *q) | |||
1662 | 1694 | ||
1663 | queue_for_each_hw_ctx(q, hctx, i) { | 1695 | queue_for_each_hw_ctx(q, hctx, i) { |
1664 | /* | 1696 | /* |
1665 | * If not software queues are mapped to this hardware queue, | 1697 | * If no software queues are mapped to this hardware queue, |
1666 | * disable it and free the request entries | 1698 | * disable it and free the request entries. |
1667 | */ | 1699 | */ |
1668 | if (!hctx->nr_ctx) { | 1700 | if (!hctx->nr_ctx) { |
1669 | struct blk_mq_tag_set *set = q->tag_set; | 1701 | struct blk_mq_tag_set *set = q->tag_set; |
@@ -1713,14 +1745,10 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q) | |||
1713 | { | 1745 | { |
1714 | struct blk_mq_tag_set *set = q->tag_set; | 1746 | struct blk_mq_tag_set *set = q->tag_set; |
1715 | 1747 | ||
1716 | blk_mq_freeze_queue(q); | ||
1717 | |||
1718 | mutex_lock(&set->tag_list_lock); | 1748 | mutex_lock(&set->tag_list_lock); |
1719 | list_del_init(&q->tag_set_list); | 1749 | list_del_init(&q->tag_set_list); |
1720 | blk_mq_update_tag_set_depth(set); | 1750 | blk_mq_update_tag_set_depth(set); |
1721 | mutex_unlock(&set->tag_list_lock); | 1751 | mutex_unlock(&set->tag_list_lock); |
1722 | |||
1723 | blk_mq_unfreeze_queue(q); | ||
1724 | } | 1752 | } |
1725 | 1753 | ||
1726 | static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, | 1754 | static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, |
@@ -1928,6 +1956,60 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb, | |||
1928 | return NOTIFY_OK; | 1956 | return NOTIFY_OK; |
1929 | } | 1957 | } |
1930 | 1958 | ||
1959 | static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) | ||
1960 | { | ||
1961 | int i; | ||
1962 | |||
1963 | for (i = 0; i < set->nr_hw_queues; i++) { | ||
1964 | set->tags[i] = blk_mq_init_rq_map(set, i); | ||
1965 | if (!set->tags[i]) | ||
1966 | goto out_unwind; | ||
1967 | } | ||
1968 | |||
1969 | return 0; | ||
1970 | |||
1971 | out_unwind: | ||
1972 | while (--i >= 0) | ||
1973 | blk_mq_free_rq_map(set, set->tags[i], i); | ||
1974 | |||
1975 | return -ENOMEM; | ||
1976 | } | ||
1977 | |||
1978 | /* | ||
1979 | * Allocate the request maps associated with this tag_set. Note that this | ||
1980 | * may reduce the depth asked for, if memory is tight. set->queue_depth | ||
1981 | * will be updated to reflect the allocated depth. | ||
1982 | */ | ||
1983 | static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) | ||
1984 | { | ||
1985 | unsigned int depth; | ||
1986 | int err; | ||
1987 | |||
1988 | depth = set->queue_depth; | ||
1989 | do { | ||
1990 | err = __blk_mq_alloc_rq_maps(set); | ||
1991 | if (!err) | ||
1992 | break; | ||
1993 | |||
1994 | set->queue_depth >>= 1; | ||
1995 | if (set->queue_depth < set->reserved_tags + BLK_MQ_TAG_MIN) { | ||
1996 | err = -ENOMEM; | ||
1997 | break; | ||
1998 | } | ||
1999 | } while (set->queue_depth); | ||
2000 | |||
2001 | if (!set->queue_depth || err) { | ||
2002 | pr_err("blk-mq: failed to allocate request map\n"); | ||
2003 | return -ENOMEM; | ||
2004 | } | ||
2005 | |||
2006 | if (depth != set->queue_depth) | ||
2007 | pr_info("blk-mq: reduced tag depth (%u -> %u)\n", | ||
2008 | depth, set->queue_depth); | ||
2009 | |||
2010 | return 0; | ||
2011 | } | ||
2012 | |||
1931 | /* | 2013 | /* |
1932 | * Alloc a tag set to be associated with one or more request queues. | 2014 | * Alloc a tag set to be associated with one or more request queues. |
1933 | * May fail with EINVAL for various error conditions. May adjust the | 2015 | * May fail with EINVAL for various error conditions. May adjust the |
@@ -1936,8 +2018,6 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb, | |||
1936 | */ | 2018 | */ |
1937 | int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) | 2019 | int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) |
1938 | { | 2020 | { |
1939 | int i; | ||
1940 | |||
1941 | if (!set->nr_hw_queues) | 2021 | if (!set->nr_hw_queues) |
1942 | return -EINVAL; | 2022 | return -EINVAL; |
1943 | if (!set->queue_depth) | 2023 | if (!set->queue_depth) |
@@ -1958,23 +2038,18 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) | |||
1958 | sizeof(struct blk_mq_tags *), | 2038 | sizeof(struct blk_mq_tags *), |
1959 | GFP_KERNEL, set->numa_node); | 2039 | GFP_KERNEL, set->numa_node); |
1960 | if (!set->tags) | 2040 | if (!set->tags) |
1961 | goto out; | 2041 | return -ENOMEM; |
1962 | 2042 | ||
1963 | for (i = 0; i < set->nr_hw_queues; i++) { | 2043 | if (blk_mq_alloc_rq_maps(set)) |
1964 | set->tags[i] = blk_mq_init_rq_map(set, i); | 2044 | goto enomem; |
1965 | if (!set->tags[i]) | ||
1966 | goto out_unwind; | ||
1967 | } | ||
1968 | 2045 | ||
1969 | mutex_init(&set->tag_list_lock); | 2046 | mutex_init(&set->tag_list_lock); |
1970 | INIT_LIST_HEAD(&set->tag_list); | 2047 | INIT_LIST_HEAD(&set->tag_list); |
1971 | 2048 | ||
1972 | return 0; | 2049 | return 0; |
1973 | 2050 | enomem: | |
1974 | out_unwind: | 2051 | kfree(set->tags); |
1975 | while (--i >= 0) | 2052 | set->tags = NULL; |
1976 | blk_mq_free_rq_map(set, set->tags[i], i); | ||
1977 | out: | ||
1978 | return -ENOMEM; | 2053 | return -ENOMEM; |
1979 | } | 2054 | } |
1980 | EXPORT_SYMBOL(blk_mq_alloc_tag_set); | 2055 | EXPORT_SYMBOL(blk_mq_alloc_tag_set); |
@@ -1989,6 +2064,7 @@ void blk_mq_free_tag_set(struct blk_mq_tag_set *set) | |||
1989 | } | 2064 | } |
1990 | 2065 | ||
1991 | kfree(set->tags); | 2066 | kfree(set->tags); |
2067 | set->tags = NULL; | ||
1992 | } | 2068 | } |
1993 | EXPORT_SYMBOL(blk_mq_free_tag_set); | 2069 | EXPORT_SYMBOL(blk_mq_free_tag_set); |
1994 | 2070 | ||
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 4db5abf96b9e..17f5c84ce7bf 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -554,8 +554,10 @@ int blk_register_queue(struct gendisk *disk) | |||
554 | * Initialization must be complete by now. Finish the initial | 554 | * Initialization must be complete by now. Finish the initial |
555 | * bypass from queue allocation. | 555 | * bypass from queue allocation. |
556 | */ | 556 | */ |
557 | queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q); | 557 | if (!blk_queue_init_done(q)) { |
558 | blk_queue_bypass_end(q); | 558 | queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q); |
559 | blk_queue_bypass_end(q); | ||
560 | } | ||
559 | 561 | ||
560 | ret = blk_trace_init_sysfs(dev); | 562 | ret = blk_trace_init_sysfs(dev); |
561 | if (ret) | 563 | if (ret) |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index cadc37841744..3f31cf9508e6 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1272,15 +1272,22 @@ __cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) | |||
1272 | rb_insert_color(&cfqg->rb_node, &st->rb); | 1272 | rb_insert_color(&cfqg->rb_node, &st->rb); |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | /* | ||
1276 | * This has to be called only on activation of cfqg | ||
1277 | */ | ||
1275 | static void | 1278 | static void |
1276 | cfq_update_group_weight(struct cfq_group *cfqg) | 1279 | cfq_update_group_weight(struct cfq_group *cfqg) |
1277 | { | 1280 | { |
1278 | BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); | ||
1279 | |||
1280 | if (cfqg->new_weight) { | 1281 | if (cfqg->new_weight) { |
1281 | cfqg->weight = cfqg->new_weight; | 1282 | cfqg->weight = cfqg->new_weight; |
1282 | cfqg->new_weight = 0; | 1283 | cfqg->new_weight = 0; |
1283 | } | 1284 | } |
1285 | } | ||
1286 | |||
1287 | static void | ||
1288 | cfq_update_group_leaf_weight(struct cfq_group *cfqg) | ||
1289 | { | ||
1290 | BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); | ||
1284 | 1291 | ||
1285 | if (cfqg->new_leaf_weight) { | 1292 | if (cfqg->new_leaf_weight) { |
1286 | cfqg->leaf_weight = cfqg->new_leaf_weight; | 1293 | cfqg->leaf_weight = cfqg->new_leaf_weight; |
@@ -1299,7 +1306,12 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) | |||
1299 | /* add to the service tree */ | 1306 | /* add to the service tree */ |
1300 | BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); | 1307 | BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); |
1301 | 1308 | ||
1302 | cfq_update_group_weight(cfqg); | 1309 | /* |
1310 | * Update leaf_weight. We cannot update weight at this point | ||
1311 | * because cfqg might already have been activated and is | ||
1312 | * contributing its current weight to the parent's child_weight. | ||
1313 | */ | ||
1314 | cfq_update_group_leaf_weight(cfqg); | ||
1303 | __cfq_group_service_tree_add(st, cfqg); | 1315 | __cfq_group_service_tree_add(st, cfqg); |
1304 | 1316 | ||
1305 | /* | 1317 | /* |
@@ -1323,6 +1335,7 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) | |||
1323 | */ | 1335 | */ |
1324 | while ((parent = cfqg_parent(pos))) { | 1336 | while ((parent = cfqg_parent(pos))) { |
1325 | if (propagate) { | 1337 | if (propagate) { |
1338 | cfq_update_group_weight(pos); | ||
1326 | propagate = !parent->nr_active++; | 1339 | propagate = !parent->nr_active++; |
1327 | parent->children_weight += pos->weight; | 1340 | parent->children_weight += pos->weight; |
1328 | } | 1341 | } |
diff --git a/block/genhd.c b/block/genhd.c index 791f41943132..e6723bd4d7a1 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -28,10 +28,10 @@ struct kobject *block_depr; | |||
28 | /* for extended dynamic devt allocation, currently only one major is used */ | 28 | /* for extended dynamic devt allocation, currently only one major is used */ |
29 | #define NR_EXT_DEVT (1 << MINORBITS) | 29 | #define NR_EXT_DEVT (1 << MINORBITS) |
30 | 30 | ||
31 | /* For extended devt allocation. ext_devt_mutex prevents look up | 31 | /* For extended devt allocation. ext_devt_lock prevents look up |
32 | * results from going away underneath its user. | 32 | * results from going away underneath its user. |
33 | */ | 33 | */ |
34 | static DEFINE_MUTEX(ext_devt_mutex); | 34 | static DEFINE_SPINLOCK(ext_devt_lock); |
35 | static DEFINE_IDR(ext_devt_idr); | 35 | static DEFINE_IDR(ext_devt_idr); |
36 | 36 | ||
37 | static struct device_type disk_type; | 37 | static struct device_type disk_type; |
@@ -420,9 +420,13 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) | |||
420 | } | 420 | } |
421 | 421 | ||
422 | /* allocate ext devt */ | 422 | /* allocate ext devt */ |
423 | mutex_lock(&ext_devt_mutex); | 423 | idr_preload(GFP_KERNEL); |
424 | idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_KERNEL); | 424 | |
425 | mutex_unlock(&ext_devt_mutex); | 425 | spin_lock(&ext_devt_lock); |
426 | idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT); | ||
427 | spin_unlock(&ext_devt_lock); | ||
428 | |||
429 | idr_preload_end(); | ||
426 | if (idx < 0) | 430 | if (idx < 0) |
427 | return idx == -ENOSPC ? -EBUSY : idx; | 431 | return idx == -ENOSPC ? -EBUSY : idx; |
428 | 432 | ||
@@ -441,15 +445,13 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) | |||
441 | */ | 445 | */ |
442 | void blk_free_devt(dev_t devt) | 446 | void blk_free_devt(dev_t devt) |
443 | { | 447 | { |
444 | might_sleep(); | ||
445 | |||
446 | if (devt == MKDEV(0, 0)) | 448 | if (devt == MKDEV(0, 0)) |
447 | return; | 449 | return; |
448 | 450 | ||
449 | if (MAJOR(devt) == BLOCK_EXT_MAJOR) { | 451 | if (MAJOR(devt) == BLOCK_EXT_MAJOR) { |
450 | mutex_lock(&ext_devt_mutex); | 452 | spin_lock(&ext_devt_lock); |
451 | idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); | 453 | idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); |
452 | mutex_unlock(&ext_devt_mutex); | 454 | spin_unlock(&ext_devt_lock); |
453 | } | 455 | } |
454 | } | 456 | } |
455 | 457 | ||
@@ -665,7 +667,6 @@ void del_gendisk(struct gendisk *disk) | |||
665 | sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); | 667 | sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); |
666 | pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); | 668 | pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); |
667 | device_del(disk_to_dev(disk)); | 669 | device_del(disk_to_dev(disk)); |
668 | blk_free_devt(disk_to_dev(disk)->devt); | ||
669 | } | 670 | } |
670 | EXPORT_SYMBOL(del_gendisk); | 671 | EXPORT_SYMBOL(del_gendisk); |
671 | 672 | ||
@@ -690,13 +691,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno) | |||
690 | } else { | 691 | } else { |
691 | struct hd_struct *part; | 692 | struct hd_struct *part; |
692 | 693 | ||
693 | mutex_lock(&ext_devt_mutex); | 694 | spin_lock(&ext_devt_lock); |
694 | part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); | 695 | part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); |
695 | if (part && get_disk(part_to_disk(part))) { | 696 | if (part && get_disk(part_to_disk(part))) { |
696 | *partno = part->partno; | 697 | *partno = part->partno; |
697 | disk = part_to_disk(part); | 698 | disk = part_to_disk(part); |
698 | } | 699 | } |
699 | mutex_unlock(&ext_devt_mutex); | 700 | spin_unlock(&ext_devt_lock); |
700 | } | 701 | } |
701 | 702 | ||
702 | return disk; | 703 | return disk; |
@@ -1098,6 +1099,7 @@ static void disk_release(struct device *dev) | |||
1098 | { | 1099 | { |
1099 | struct gendisk *disk = dev_to_disk(dev); | 1100 | struct gendisk *disk = dev_to_disk(dev); |
1100 | 1101 | ||
1102 | blk_free_devt(dev->devt); | ||
1101 | disk_release_events(disk); | 1103 | disk_release_events(disk); |
1102 | kfree(disk->random); | 1104 | kfree(disk->random); |
1103 | disk_replace_part_tbl(disk, NULL); | 1105 | disk_replace_part_tbl(disk, NULL); |
diff --git a/block/partition-generic.c b/block/partition-generic.c index 789cdea05893..0d9e5f97f0a8 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c | |||
@@ -211,6 +211,7 @@ static const struct attribute_group *part_attr_groups[] = { | |||
211 | static void part_release(struct device *dev) | 211 | static void part_release(struct device *dev) |
212 | { | 212 | { |
213 | struct hd_struct *p = dev_to_part(dev); | 213 | struct hd_struct *p = dev_to_part(dev); |
214 | blk_free_devt(dev->devt); | ||
214 | free_part_stats(p); | 215 | free_part_stats(p); |
215 | free_part_info(p); | 216 | free_part_info(p); |
216 | kfree(p); | 217 | kfree(p); |
@@ -253,7 +254,6 @@ void delete_partition(struct gendisk *disk, int partno) | |||
253 | rcu_assign_pointer(ptbl->last_lookup, NULL); | 254 | rcu_assign_pointer(ptbl->last_lookup, NULL); |
254 | kobject_put(part->holder_dir); | 255 | kobject_put(part->holder_dir); |
255 | device_del(part_to_dev(part)); | 256 | device_del(part_to_dev(part)); |
256 | blk_free_devt(part_devt(part)); | ||
257 | 257 | ||
258 | hd_struct_put(part); | 258 | hd_struct_put(part); |
259 | } | 259 | } |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 51bf5155ee75..9b8eaeca6a79 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -279,7 +279,6 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, | |||
279 | r = blk_rq_unmap_user(bio); | 279 | r = blk_rq_unmap_user(bio); |
280 | if (!ret) | 280 | if (!ret) |
281 | ret = r; | 281 | ret = r; |
282 | blk_put_request(rq); | ||
283 | 282 | ||
284 | return ret; | 283 | return ret; |
285 | } | 284 | } |
@@ -297,8 +296,6 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
297 | 296 | ||
298 | if (hdr->interface_id != 'S') | 297 | if (hdr->interface_id != 'S') |
299 | return -EINVAL; | 298 | return -EINVAL; |
300 | if (hdr->cmd_len > BLK_MAX_CDB) | ||
301 | return -EINVAL; | ||
302 | 299 | ||
303 | if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9)) | 300 | if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9)) |
304 | return -EIO; | 301 | return -EIO; |
@@ -317,16 +314,23 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
317 | if (hdr->flags & SG_FLAG_Q_AT_HEAD) | 314 | if (hdr->flags & SG_FLAG_Q_AT_HEAD) |
318 | at_head = 1; | 315 | at_head = 1; |
319 | 316 | ||
317 | ret = -ENOMEM; | ||
320 | rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); | 318 | rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); |
321 | if (!rq) | 319 | if (!rq) |
322 | return -ENOMEM; | 320 | goto out; |
323 | blk_rq_set_block_pc(rq); | 321 | blk_rq_set_block_pc(rq); |
324 | 322 | ||
325 | if (blk_fill_sghdr_rq(q, rq, hdr, mode)) { | 323 | if (hdr->cmd_len > BLK_MAX_CDB) { |
326 | blk_put_request(rq); | 324 | rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); |
327 | return -EFAULT; | 325 | if (!rq->cmd) |
326 | goto out_put_request; | ||
328 | } | 327 | } |
329 | 328 | ||
329 | ret = -EFAULT; | ||
330 | if (blk_fill_sghdr_rq(q, rq, hdr, mode)) | ||
331 | goto out_free_cdb; | ||
332 | |||
333 | ret = 0; | ||
330 | if (hdr->iovec_count) { | 334 | if (hdr->iovec_count) { |
331 | size_t iov_data_len; | 335 | size_t iov_data_len; |
332 | struct iovec *iov = NULL; | 336 | struct iovec *iov = NULL; |
@@ -335,7 +339,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
335 | 0, NULL, &iov); | 339 | 0, NULL, &iov); |
336 | if (ret < 0) { | 340 | if (ret < 0) { |
337 | kfree(iov); | 341 | kfree(iov); |
338 | goto out; | 342 | goto out_free_cdb; |
339 | } | 343 | } |
340 | 344 | ||
341 | iov_data_len = ret; | 345 | iov_data_len = ret; |
@@ -358,7 +362,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
358 | GFP_KERNEL); | 362 | GFP_KERNEL); |
359 | 363 | ||
360 | if (ret) | 364 | if (ret) |
361 | goto out; | 365 | goto out_free_cdb; |
362 | 366 | ||
363 | bio = rq->bio; | 367 | bio = rq->bio; |
364 | memset(sense, 0, sizeof(sense)); | 368 | memset(sense, 0, sizeof(sense)); |
@@ -376,9 +380,14 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
376 | 380 | ||
377 | hdr->duration = jiffies_to_msecs(jiffies - start_time); | 381 | hdr->duration = jiffies_to_msecs(jiffies - start_time); |
378 | 382 | ||
379 | return blk_complete_sghdr_rq(rq, hdr, bio); | 383 | ret = blk_complete_sghdr_rq(rq, hdr, bio); |
380 | out: | 384 | |
385 | out_free_cdb: | ||
386 | if (rq->cmd != rq->__cmd) | ||
387 | kfree(rq->cmd); | ||
388 | out_put_request: | ||
381 | blk_put_request(rq); | 389 | blk_put_request(rq); |
390 | out: | ||
382 | return ret; | 391 | return ret; |
383 | } | 392 | } |
384 | 393 | ||
@@ -448,6 +457,11 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
448 | } | 457 | } |
449 | 458 | ||
450 | rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); | 459 | rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); |
460 | if (!rq) { | ||
461 | err = -ENOMEM; | ||
462 | goto error; | ||
463 | } | ||
464 | blk_rq_set_block_pc(rq); | ||
451 | 465 | ||
452 | cmdlen = COMMAND_SIZE(opcode); | 466 | cmdlen = COMMAND_SIZE(opcode); |
453 | 467 | ||
@@ -501,7 +515,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
501 | memset(sense, 0, sizeof(sense)); | 515 | memset(sense, 0, sizeof(sense)); |
502 | rq->sense = sense; | 516 | rq->sense = sense; |
503 | rq->sense_len = 0; | 517 | rq->sense_len = 0; |
504 | blk_rq_set_block_pc(rq); | ||
505 | 518 | ||
506 | blk_execute_rq(q, disk, rq, 0); | 519 | blk_execute_rq(q, disk, rq, 0); |
507 | 520 | ||
@@ -521,7 +534,8 @@ out: | |||
521 | 534 | ||
522 | error: | 535 | error: |
523 | kfree(buffer); | 536 | kfree(buffer); |
524 | blk_put_request(rq); | 537 | if (rq) |
538 | blk_put_request(rq); | ||
525 | return err; | 539 | return err; |
526 | } | 540 | } |
527 | EXPORT_SYMBOL_GPL(sg_scsi_ioctl); | 541 | EXPORT_SYMBOL_GPL(sg_scsi_ioctl); |
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c index 97eb001960b9..2f6e4fb1a1ea 100644 --- a/crypto/asymmetric_keys/public_key.c +++ b/crypto/asymmetric_keys/public_key.c | |||
@@ -121,6 +121,7 @@ static int public_key_verify_signature_2(const struct key *key, | |||
121 | struct asymmetric_key_subtype public_key_subtype = { | 121 | struct asymmetric_key_subtype public_key_subtype = { |
122 | .owner = THIS_MODULE, | 122 | .owner = THIS_MODULE, |
123 | .name = "public_key", | 123 | .name = "public_key", |
124 | .name_len = sizeof("public_key") - 1, | ||
124 | .describe = public_key_describe, | 125 | .describe = public_key_describe, |
125 | .destroy = public_key_destroy, | 126 | .destroy = public_key_destroy, |
126 | .verify_signature = public_key_verify_signature_2, | 127 | .verify_signature = public_key_verify_signature_2, |
diff --git a/crypto/asymmetric_keys/verify_pefile.c b/crypto/asymmetric_keys/verify_pefile.c index 79175e6ea0b2..2421f46184ce 100644 --- a/crypto/asymmetric_keys/verify_pefile.c +++ b/crypto/asymmetric_keys/verify_pefile.c | |||
@@ -128,6 +128,7 @@ static int pefile_strip_sig_wrapper(const void *pebuf, | |||
128 | { | 128 | { |
129 | struct win_certificate wrapper; | 129 | struct win_certificate wrapper; |
130 | const u8 *pkcs7; | 130 | const u8 *pkcs7; |
131 | unsigned len; | ||
131 | 132 | ||
132 | if (ctx->sig_len < sizeof(wrapper)) { | 133 | if (ctx->sig_len < sizeof(wrapper)) { |
133 | pr_debug("Signature wrapper too short\n"); | 134 | pr_debug("Signature wrapper too short\n"); |
@@ -154,33 +155,49 @@ static int pefile_strip_sig_wrapper(const void *pebuf, | |||
154 | return -ENOTSUPP; | 155 | return -ENOTSUPP; |
155 | } | 156 | } |
156 | 157 | ||
157 | /* Looks like actual pkcs signature length is in wrapper->length. | 158 | /* It looks like the pkcs signature length in wrapper->length and the |
158 | * size obtained from data dir entries lists the total size of | 159 | * size obtained from the data dir entries, which lists the total size |
159 | * certificate table which is also aligned to octawrod boundary. | 160 | * of certificate table, are both aligned to an octaword boundary, so |
160 | * | 161 | * we may have to deal with some padding. |
161 | * So set signature length field appropriately. | ||
162 | */ | 162 | */ |
163 | ctx->sig_len = wrapper.length; | 163 | ctx->sig_len = wrapper.length; |
164 | ctx->sig_offset += sizeof(wrapper); | 164 | ctx->sig_offset += sizeof(wrapper); |
165 | ctx->sig_len -= sizeof(wrapper); | 165 | ctx->sig_len -= sizeof(wrapper); |
166 | if (ctx->sig_len == 0) { | 166 | if (ctx->sig_len < 4) { |
167 | pr_debug("Signature data missing\n"); | 167 | pr_debug("Signature data missing\n"); |
168 | return -EKEYREJECTED; | 168 | return -EKEYREJECTED; |
169 | } | 169 | } |
170 | 170 | ||
171 | /* What's left should a PKCS#7 cert */ | 171 | /* What's left should be a PKCS#7 cert */ |
172 | pkcs7 = pebuf + ctx->sig_offset; | 172 | pkcs7 = pebuf + ctx->sig_offset; |
173 | if (pkcs7[0] == (ASN1_CONS_BIT | ASN1_SEQ)) { | 173 | if (pkcs7[0] != (ASN1_CONS_BIT | ASN1_SEQ)) |
174 | if (pkcs7[1] == 0x82 && | 174 | goto not_pkcs7; |
175 | pkcs7[2] == (((ctx->sig_len - 4) >> 8) & 0xff) && | 175 | |
176 | pkcs7[3] == ((ctx->sig_len - 4) & 0xff)) | 176 | switch (pkcs7[1]) { |
177 | return 0; | 177 | case 0 ... 0x7f: |
178 | if (pkcs7[1] == 0x80) | 178 | len = pkcs7[1] + 2; |
179 | return 0; | 179 | goto check_len; |
180 | if (pkcs7[1] > 0x82) | 180 | case ASN1_INDEFINITE_LENGTH: |
181 | return -EMSGSIZE; | 181 | return 0; |
182 | case 0x81: | ||
183 | len = pkcs7[2] + 3; | ||
184 | goto check_len; | ||
185 | case 0x82: | ||
186 | len = ((pkcs7[2] << 8) | pkcs7[3]) + 4; | ||
187 | goto check_len; | ||
188 | case 0x83 ... 0xff: | ||
189 | return -EMSGSIZE; | ||
190 | default: | ||
191 | goto not_pkcs7; | ||
182 | } | 192 | } |
183 | 193 | ||
194 | check_len: | ||
195 | if (len <= ctx->sig_len) { | ||
196 | /* There may be padding */ | ||
197 | ctx->sig_len = len; | ||
198 | return 0; | ||
199 | } | ||
200 | not_pkcs7: | ||
184 | pr_debug("Signature data not PKCS#7\n"); | 201 | pr_debug("Signature data not PKCS#7\n"); |
185 | return -ELIBBAD; | 202 | return -ELIBBAD; |
186 | } | 203 | } |
diff --git a/crypto/drbg.c b/crypto/drbg.c index 7894db9ca90b..a53ee099e281 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c | |||
@@ -1922,9 +1922,6 @@ static inline int __init drbg_healthcheck_sanity(void) | |||
1922 | /* overflow max addtllen with personalization string */ | 1922 | /* overflow max addtllen with personalization string */ |
1923 | ret = drbg_instantiate(drbg, &addtl, coreref, pr); | 1923 | ret = drbg_instantiate(drbg, &addtl, coreref, pr); |
1924 | BUG_ON(0 == ret); | 1924 | BUG_ON(0 == ret); |
1925 | /* test uninstantated DRBG */ | ||
1926 | len = drbg_generate(drbg, buf, (max_request_bytes + 1), NULL); | ||
1927 | BUG_ON(0 < len); | ||
1928 | /* all tests passed */ | 1925 | /* all tests passed */ |
1929 | rc = 0; | 1926 | rc = 0; |
1930 | 1927 | ||
diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c index 2da8660262e5..81dc75033f15 100644 --- a/drivers/acpi/acpi_cmos_rtc.c +++ b/drivers/acpi/acpi_cmos_rtc.c | |||
@@ -33,7 +33,7 @@ acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address, | |||
33 | void *handler_context, void *region_context) | 33 | void *handler_context, void *region_context) |
34 | { | 34 | { |
35 | int i; | 35 | int i; |
36 | u8 *value = (u8 *)&value64; | 36 | u8 *value = (u8 *)value64; |
37 | 37 | ||
38 | if (address > 0xff || !value64) | 38 | if (address > 0xff || !value64) |
39 | return AE_BAD_PARAMETER; | 39 | return AE_BAD_PARAMETER; |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index ce06149088c5..b0ea767c8696 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -196,6 +196,17 @@ static struct lpss_device_desc byt_i2c_dev_desc = { | |||
196 | .setup = lpss_i2c_setup, | 196 | .setup = lpss_i2c_setup, |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static struct lpss_shared_clock bsw_pwm_clock = { | ||
200 | .name = "pwm_clk", | ||
201 | .rate = 19200000, | ||
202 | }; | ||
203 | |||
204 | static struct lpss_device_desc bsw_pwm_dev_desc = { | ||
205 | .clk_required = true, | ||
206 | .save_ctx = true, | ||
207 | .shared_clock = &bsw_pwm_clock, | ||
208 | }; | ||
209 | |||
199 | #else | 210 | #else |
200 | 211 | ||
201 | #define LPSS_ADDR(desc) (0UL) | 212 | #define LPSS_ADDR(desc) (0UL) |
@@ -225,6 +236,12 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { | |||
225 | { "INT33B2", }, | 236 | { "INT33B2", }, |
226 | { "INT33FC", }, | 237 | { "INT33FC", }, |
227 | 238 | ||
239 | /* Braswell LPSS devices */ | ||
240 | { "80862288", LPSS_ADDR(bsw_pwm_dev_desc) }, | ||
241 | { "8086228A", LPSS_ADDR(byt_uart_dev_desc) }, | ||
242 | { "8086228E", LPSS_ADDR(byt_spi_dev_desc) }, | ||
243 | { "808622C1", LPSS_ADDR(byt_i2c_dev_desc) }, | ||
244 | |||
228 | { "INT3430", LPSS_ADDR(lpt_dev_desc) }, | 245 | { "INT3430", LPSS_ADDR(lpt_dev_desc) }, |
229 | { "INT3431", LPSS_ADDR(lpt_dev_desc) }, | 246 | { "INT3431", LPSS_ADDR(lpt_dev_desc) }, |
230 | { "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) }, | 247 | { "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) }, |
@@ -402,7 +419,6 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
402 | adev->driver_data = pdata; | 419 | adev->driver_data = pdata; |
403 | pdev = acpi_create_platform_device(adev); | 420 | pdev = acpi_create_platform_device(adev); |
404 | if (!IS_ERR_OR_NULL(pdev)) { | 421 | if (!IS_ERR_OR_NULL(pdev)) { |
405 | device_enable_async_suspend(&pdev->dev); | ||
406 | return 1; | 422 | return 1; |
407 | } | 423 | } |
408 | 424 | ||
@@ -593,7 +609,7 @@ static int acpi_lpss_suspend_late(struct device *dev) | |||
593 | return acpi_dev_suspend_late(dev); | 609 | return acpi_dev_suspend_late(dev); |
594 | } | 610 | } |
595 | 611 | ||
596 | static int acpi_lpss_restore_early(struct device *dev) | 612 | static int acpi_lpss_resume_early(struct device *dev) |
597 | { | 613 | { |
598 | int ret = acpi_dev_resume_early(dev); | 614 | int ret = acpi_dev_resume_early(dev); |
599 | 615 | ||
@@ -633,15 +649,15 @@ static int acpi_lpss_runtime_resume(struct device *dev) | |||
633 | static struct dev_pm_domain acpi_lpss_pm_domain = { | 649 | static struct dev_pm_domain acpi_lpss_pm_domain = { |
634 | .ops = { | 650 | .ops = { |
635 | #ifdef CONFIG_PM_SLEEP | 651 | #ifdef CONFIG_PM_SLEEP |
636 | .suspend_late = acpi_lpss_suspend_late, | ||
637 | .restore_early = acpi_lpss_restore_early, | ||
638 | .prepare = acpi_subsys_prepare, | 652 | .prepare = acpi_subsys_prepare, |
639 | .complete = acpi_subsys_complete, | 653 | .complete = acpi_subsys_complete, |
640 | .suspend = acpi_subsys_suspend, | 654 | .suspend = acpi_subsys_suspend, |
641 | .resume_early = acpi_subsys_resume_early, | 655 | .suspend_late = acpi_lpss_suspend_late, |
656 | .resume_early = acpi_lpss_resume_early, | ||
642 | .freeze = acpi_subsys_freeze, | 657 | .freeze = acpi_subsys_freeze, |
643 | .poweroff = acpi_subsys_suspend, | 658 | .poweroff = acpi_subsys_suspend, |
644 | .poweroff_late = acpi_subsys_suspend_late, | 659 | .poweroff_late = acpi_lpss_suspend_late, |
660 | .restore_early = acpi_lpss_resume_early, | ||
645 | #endif | 661 | #endif |
646 | #ifdef CONFIG_PM_RUNTIME | 662 | #ifdef CONFIG_PM_RUNTIME |
647 | .runtime_suspend = acpi_lpss_runtime_suspend, | 663 | .runtime_suspend = acpi_lpss_runtime_suspend, |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 1f9aba5fb81f..2747279fbe3c 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -254,6 +254,7 @@ struct acpi_create_field_info { | |||
254 | u32 field_bit_position; | 254 | u32 field_bit_position; |
255 | u32 field_bit_length; | 255 | u32 field_bit_length; |
256 | u16 resource_length; | 256 | u16 resource_length; |
257 | u16 pin_number_index; | ||
257 | u8 field_flags; | 258 | u8 field_flags; |
258 | u8 attribute; | 259 | u8 attribute; |
259 | u8 field_type; | 260 | u8 field_type; |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 22fb6449d3d6..8abb393dafab 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -264,6 +264,7 @@ struct acpi_object_region_field { | |||
264 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; | 264 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; |
265 | union acpi_operand_object *region_obj; /* Containing op_region object */ | 265 | union acpi_operand_object *region_obj; /* Containing op_region object */ |
266 | u8 *resource_buffer; /* resource_template for serial regions/fields */ | 266 | u8 *resource_buffer; /* resource_template for serial regions/fields */ |
267 | u16 pin_number_index; /* Index relative to previous Connection/Template */ | ||
267 | }; | 268 | }; |
268 | 269 | ||
269 | struct acpi_object_bank_field { | 270 | struct acpi_object_bank_field { |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 3661c8e90540..c57666196672 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -360,6 +360,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
360 | */ | 360 | */ |
361 | info->resource_buffer = NULL; | 361 | info->resource_buffer = NULL; |
362 | info->connection_node = NULL; | 362 | info->connection_node = NULL; |
363 | info->pin_number_index = 0; | ||
363 | 364 | ||
364 | /* | 365 | /* |
365 | * A Connection() is either an actual resource descriptor (buffer) | 366 | * A Connection() is either an actual resource descriptor (buffer) |
@@ -437,6 +438,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
437 | } | 438 | } |
438 | 439 | ||
439 | info->field_bit_position += info->field_bit_length; | 440 | info->field_bit_position += info->field_bit_length; |
441 | info->pin_number_index++; /* Index relative to previous Connection() */ | ||
440 | break; | 442 | break; |
441 | 443 | ||
442 | default: | 444 | default: |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 9957297d1580..8eb8575e8c16 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -142,6 +142,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
142 | union acpi_operand_object *region_obj2; | 142 | union acpi_operand_object *region_obj2; |
143 | void *region_context = NULL; | 143 | void *region_context = NULL; |
144 | struct acpi_connection_info *context; | 144 | struct acpi_connection_info *context; |
145 | acpi_physical_address address; | ||
145 | 146 | ||
146 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); | 147 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); |
147 | 148 | ||
@@ -231,25 +232,23 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
231 | /* We have everything we need, we can invoke the address space handler */ | 232 | /* We have everything we need, we can invoke the address space handler */ |
232 | 233 | ||
233 | handler = handler_desc->address_space.handler; | 234 | handler = handler_desc->address_space.handler; |
234 | 235 | address = (region_obj->region.address + region_offset); | |
235 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
236 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | ||
237 | ®ion_obj->region.handler->address_space, handler, | ||
238 | ACPI_FORMAT_NATIVE_UINT(region_obj->region.address + | ||
239 | region_offset), | ||
240 | acpi_ut_get_region_name(region_obj->region. | ||
241 | space_id))); | ||
242 | 236 | ||
243 | /* | 237 | /* |
244 | * Special handling for generic_serial_bus and general_purpose_io: | 238 | * Special handling for generic_serial_bus and general_purpose_io: |
245 | * There are three extra parameters that must be passed to the | 239 | * There are three extra parameters that must be passed to the |
246 | * handler via the context: | 240 | * handler via the context: |
247 | * 1) Connection buffer, a resource template from Connection() op. | 241 | * 1) Connection buffer, a resource template from Connection() op |
248 | * 2) Length of the above buffer. | 242 | * 2) Length of the above buffer |
249 | * 3) Actual access length from the access_as() op. | 243 | * 3) Actual access length from the access_as() op |
244 | * | ||
245 | * In addition, for general_purpose_io, the Address and bit_width fields | ||
246 | * are defined as follows: | ||
247 | * 1) Address is the pin number index of the field (bit offset from | ||
248 | * the previous Connection) | ||
249 | * 2) bit_width is the actual bit length of the field (number of pins) | ||
250 | */ | 250 | */ |
251 | if (((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) || | 251 | if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) && |
252 | (region_obj->region.space_id == ACPI_ADR_SPACE_GPIO)) && | ||
253 | context && field_obj) { | 252 | context && field_obj) { |
254 | 253 | ||
255 | /* Get the Connection (resource_template) buffer */ | 254 | /* Get the Connection (resource_template) buffer */ |
@@ -258,6 +257,24 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
258 | context->length = field_obj->field.resource_length; | 257 | context->length = field_obj->field.resource_length; |
259 | context->access_length = field_obj->field.access_length; | 258 | context->access_length = field_obj->field.access_length; |
260 | } | 259 | } |
260 | if ((region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) && | ||
261 | context && field_obj) { | ||
262 | |||
263 | /* Get the Connection (resource_template) buffer */ | ||
264 | |||
265 | context->connection = field_obj->field.resource_buffer; | ||
266 | context->length = field_obj->field.resource_length; | ||
267 | context->access_length = field_obj->field.access_length; | ||
268 | address = field_obj->field.pin_number_index; | ||
269 | bit_width = field_obj->field.bit_length; | ||
270 | } | ||
271 | |||
272 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
273 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | ||
274 | ®ion_obj->region.handler->address_space, handler, | ||
275 | ACPI_FORMAT_NATIVE_UINT(address), | ||
276 | acpi_ut_get_region_name(region_obj->region. | ||
277 | space_id))); | ||
261 | 278 | ||
262 | if (!(handler_desc->address_space.handler_flags & | 279 | if (!(handler_desc->address_space.handler_flags & |
263 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | 280 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
@@ -271,9 +288,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
271 | 288 | ||
272 | /* Call the handler */ | 289 | /* Call the handler */ |
273 | 290 | ||
274 | status = handler(function, | 291 | status = handler(function, address, bit_width, value, context, |
275 | (region_obj->region.address + region_offset), | ||
276 | bit_width, value, context, | ||
277 | region_obj2->extra.region_context); | 292 | region_obj2->extra.region_context); |
278 | 293 | ||
279 | if (ACPI_FAILURE(status)) { | 294 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 6907ce0c704c..b994845ed359 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -253,6 +253,37 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
253 | buffer = &buffer_desc->integer.value; | 253 | buffer = &buffer_desc->integer.value; |
254 | } | 254 | } |
255 | 255 | ||
256 | if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && | ||
257 | (obj_desc->field.region_obj->region.space_id == | ||
258 | ACPI_ADR_SPACE_GPIO)) { | ||
259 | /* | ||
260 | * For GPIO (general_purpose_io), the Address will be the bit offset | ||
261 | * from the previous Connection() operator, making it effectively a | ||
262 | * pin number index. The bit_length is the length of the field, which | ||
263 | * is thus the number of pins. | ||
264 | */ | ||
265 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
266 | "GPIO FieldRead [FROM]: Pin %u Bits %u\n", | ||
267 | obj_desc->field.pin_number_index, | ||
268 | obj_desc->field.bit_length)); | ||
269 | |||
270 | /* Lock entire transaction if requested */ | ||
271 | |||
272 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
273 | |||
274 | /* Perform the write */ | ||
275 | |||
276 | status = acpi_ex_access_region(obj_desc, 0, | ||
277 | (u64 *)buffer, ACPI_READ); | ||
278 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | ||
279 | if (ACPI_FAILURE(status)) { | ||
280 | acpi_ut_remove_reference(buffer_desc); | ||
281 | } else { | ||
282 | *ret_buffer_desc = buffer_desc; | ||
283 | } | ||
284 | return_ACPI_STATUS(status); | ||
285 | } | ||
286 | |||
256 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 287 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
257 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", | 288 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", |
258 | obj_desc, obj_desc->common.type, buffer, | 289 | obj_desc, obj_desc->common.type, buffer, |
@@ -413,6 +444,42 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
413 | 444 | ||
414 | *result_desc = buffer_desc; | 445 | *result_desc = buffer_desc; |
415 | return_ACPI_STATUS(status); | 446 | return_ACPI_STATUS(status); |
447 | } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && | ||
448 | (obj_desc->field.region_obj->region.space_id == | ||
449 | ACPI_ADR_SPACE_GPIO)) { | ||
450 | /* | ||
451 | * For GPIO (general_purpose_io), we will bypass the entire field | ||
452 | * mechanism and handoff the bit address and bit width directly to | ||
453 | * the handler. The Address will be the bit offset | ||
454 | * from the previous Connection() operator, making it effectively a | ||
455 | * pin number index. The bit_length is the length of the field, which | ||
456 | * is thus the number of pins. | ||
457 | */ | ||
458 | if (source_desc->common.type != ACPI_TYPE_INTEGER) { | ||
459 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
460 | } | ||
461 | |||
462 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
463 | "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", | ||
464 | acpi_ut_get_type_name(source_desc->common. | ||
465 | type), | ||
466 | source_desc->common.type, | ||
467 | (u32)source_desc->integer.value, | ||
468 | obj_desc->field.pin_number_index, | ||
469 | obj_desc->field.bit_length)); | ||
470 | |||
471 | buffer = &source_desc->integer.value; | ||
472 | |||
473 | /* Lock entire transaction if requested */ | ||
474 | |||
475 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
476 | |||
477 | /* Perform the write */ | ||
478 | |||
479 | status = acpi_ex_access_region(obj_desc, 0, | ||
480 | (u64 *)buffer, ACPI_WRITE); | ||
481 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | ||
482 | return_ACPI_STATUS(status); | ||
416 | } | 483 | } |
417 | 484 | ||
418 | /* Get a pointer to the data to be written */ | 485 | /* Get a pointer to the data to be written */ |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index ee3f872870bc..118e942005e5 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -484,6 +484,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
484 | obj_desc->field.resource_length = info->resource_length; | 484 | obj_desc->field.resource_length = info->resource_length; |
485 | } | 485 | } |
486 | 486 | ||
487 | obj_desc->field.pin_number_index = info->pin_number_index; | ||
488 | |||
487 | /* Allow full data read from EC address space */ | 489 | /* Allow full data read from EC address space */ |
488 | 490 | ||
489 | if ((obj_desc->field.region_obj->region.space_id == | 491 | if ((obj_desc->field.region_obj->region.space_id == |
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index 68f725839eb6..1b13b921dda9 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c | |||
@@ -316,6 +316,45 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
316 | acpi_ns_check_package_list(info, package, elements, count); | 316 | acpi_ns_check_package_list(info, package, elements, count); |
317 | break; | 317 | break; |
318 | 318 | ||
319 | case ACPI_PTYPE2_UUID_PAIR: | ||
320 | |||
321 | /* The package must contain pairs of (UUID + type) */ | ||
322 | |||
323 | if (count & 1) { | ||
324 | expected_count = count + 1; | ||
325 | goto package_too_small; | ||
326 | } | ||
327 | |||
328 | while (count > 0) { | ||
329 | status = acpi_ns_check_object_type(info, elements, | ||
330 | package->ret_info. | ||
331 | object_type1, 0); | ||
332 | if (ACPI_FAILURE(status)) { | ||
333 | return (status); | ||
334 | } | ||
335 | |||
336 | /* Validate length of the UUID buffer */ | ||
337 | |||
338 | if ((*elements)->buffer.length != 16) { | ||
339 | ACPI_WARN_PREDEFINED((AE_INFO, | ||
340 | info->full_pathname, | ||
341 | info->node_flags, | ||
342 | "Invalid length for UUID Buffer")); | ||
343 | return (AE_AML_OPERAND_VALUE); | ||
344 | } | ||
345 | |||
346 | status = acpi_ns_check_object_type(info, elements + 1, | ||
347 | package->ret_info. | ||
348 | object_type2, 0); | ||
349 | if (ACPI_FAILURE(status)) { | ||
350 | return (status); | ||
351 | } | ||
352 | |||
353 | elements += 2; | ||
354 | count -= 2; | ||
355 | } | ||
356 | break; | ||
357 | |||
319 | default: | 358 | default: |
320 | 359 | ||
321 | /* Should not get here if predefined info table is correct */ | 360 | /* Should not get here if predefined info table is correct */ |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1c162e7be045..5fdfe65fe165 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -534,20 +534,6 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
534 | " invalid.\n"); | 534 | " invalid.\n"); |
535 | } | 535 | } |
536 | 536 | ||
537 | /* | ||
538 | * When fully charged, some batteries wrongly report | ||
539 | * capacity_now = design_capacity instead of = full_charge_capacity | ||
540 | */ | ||
541 | if (battery->capacity_now > battery->full_charge_capacity | ||
542 | && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { | ||
543 | if (battery->capacity_now != battery->design_capacity) | ||
544 | printk_once(KERN_WARNING FW_BUG | ||
545 | "battery: reported current charge level (%d) " | ||
546 | "is higher than reported maximum charge level (%d).\n", | ||
547 | battery->capacity_now, battery->full_charge_capacity); | ||
548 | battery->capacity_now = battery->full_charge_capacity; | ||
549 | } | ||
550 | |||
551 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) | 537 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) |
552 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) | 538 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) |
553 | battery->capacity_now = (battery->capacity_now * | 539 | battery->capacity_now = (battery->capacity_now * |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 8581f5b84f48..8b67bd0f6bb5 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -177,16 +177,6 @@ void acpi_bus_detach_private_data(acpi_handle handle) | |||
177 | } | 177 | } |
178 | EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); | 178 | EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); |
179 | 179 | ||
180 | void acpi_bus_no_hotplug(acpi_handle handle) | ||
181 | { | ||
182 | struct acpi_device *adev = NULL; | ||
183 | |||
184 | acpi_bus_get_device(handle, &adev); | ||
185 | if (adev) | ||
186 | adev->flags.no_hotplug = true; | ||
187 | } | ||
188 | EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug); | ||
189 | |||
190 | static void acpi_print_osc_error(acpi_handle handle, | 180 | static void acpi_print_osc_error(acpi_handle handle, |
191 | struct acpi_osc_context *context, char *error) | 181 | struct acpi_osc_context *context, char *error) |
192 | { | 182 | { |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 76f7cff64594..c8ead9f97375 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -99,6 +99,13 @@ static void container_device_detach(struct acpi_device *adev) | |||
99 | device_unregister(dev); | 99 | device_unregister(dev); |
100 | } | 100 | } |
101 | 101 | ||
102 | static void container_device_online(struct acpi_device *adev) | ||
103 | { | ||
104 | struct device *dev = acpi_driver_data(adev); | ||
105 | |||
106 | kobject_uevent(&dev->kobj, KOBJ_ONLINE); | ||
107 | } | ||
108 | |||
102 | static struct acpi_scan_handler container_handler = { | 109 | static struct acpi_scan_handler container_handler = { |
103 | .ids = container_device_ids, | 110 | .ids = container_device_ids, |
104 | .attach = container_device_attach, | 111 | .attach = container_device_attach, |
@@ -106,6 +113,7 @@ static struct acpi_scan_handler container_handler = { | |||
106 | .hotplug = { | 113 | .hotplug = { |
107 | .enabled = true, | 114 | .enabled = true, |
108 | .demand_offline = true, | 115 | .demand_offline = true, |
116 | .notify_online = container_device_online, | ||
109 | }, | 117 | }, |
110 | }; | 118 | }; |
111 | 119 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index a66ab658abbc..cb6066c809ea 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -197,6 +197,8 @@ static bool advance_transaction(struct acpi_ec *ec) | |||
197 | t->rdata[t->ri++] = acpi_ec_read_data(ec); | 197 | t->rdata[t->ri++] = acpi_ec_read_data(ec); |
198 | if (t->rlen == t->ri) { | 198 | if (t->rlen == t->ri) { |
199 | t->flags |= ACPI_EC_COMMAND_COMPLETE; | 199 | t->flags |= ACPI_EC_COMMAND_COMPLETE; |
200 | if (t->command == ACPI_EC_COMMAND_QUERY) | ||
201 | pr_debug("hardware QR_EC completion\n"); | ||
200 | wakeup = true; | 202 | wakeup = true; |
201 | } | 203 | } |
202 | } else | 204 | } else |
@@ -208,7 +210,20 @@ static bool advance_transaction(struct acpi_ec *ec) | |||
208 | } | 210 | } |
209 | return wakeup; | 211 | return wakeup; |
210 | } else { | 212 | } else { |
211 | if ((status & ACPI_EC_FLAG_IBF) == 0) { | 213 | /* |
214 | * There is firmware refusing to respond QR_EC when SCI_EVT | ||
215 | * is not set, for which case, we complete the QR_EC | ||
216 | * without issuing it to the firmware. | ||
217 | * https://bugzilla.kernel.org/show_bug.cgi?id=86211 | ||
218 | */ | ||
219 | if (!(status & ACPI_EC_FLAG_SCI) && | ||
220 | (t->command == ACPI_EC_COMMAND_QUERY)) { | ||
221 | t->flags |= ACPI_EC_COMMAND_POLL; | ||
222 | t->rdata[t->ri++] = 0x00; | ||
223 | t->flags |= ACPI_EC_COMMAND_COMPLETE; | ||
224 | pr_debug("software QR_EC completion\n"); | ||
225 | wakeup = true; | ||
226 | } else if ((status & ACPI_EC_FLAG_IBF) == 0) { | ||
212 | acpi_ec_write_cmd(ec, t->command); | 227 | acpi_ec_write_cmd(ec, t->command); |
213 | t->flags |= ACPI_EC_COMMAND_POLL; | 228 | t->flags |= ACPI_EC_COMMAND_POLL; |
214 | } else | 229 | } else |
@@ -288,11 +303,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
288 | /* following two actions should be kept atomic */ | 303 | /* following two actions should be kept atomic */ |
289 | ec->curr = t; | 304 | ec->curr = t; |
290 | start_transaction(ec); | 305 | start_transaction(ec); |
291 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) | ||
292 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | ||
293 | spin_unlock_irqrestore(&ec->lock, tmp); | 306 | spin_unlock_irqrestore(&ec->lock, tmp); |
294 | ret = ec_poll(ec); | 307 | ret = ec_poll(ec); |
295 | spin_lock_irqsave(&ec->lock, tmp); | 308 | spin_lock_irqsave(&ec->lock, tmp); |
309 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) | ||
310 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | ||
296 | ec->curr = NULL; | 311 | ec->curr = NULL; |
297 | spin_unlock_irqrestore(&ec->lock, tmp); | 312 | spin_unlock_irqrestore(&ec->lock, tmp); |
298 | return ret; | 313 | return ret; |
@@ -1015,6 +1030,10 @@ static struct dmi_system_id ec_dmi_table[] __initdata = { | |||
1015 | DMI_MATCH(DMI_SYS_VENDOR, "Quanta"), | 1030 | DMI_MATCH(DMI_SYS_VENDOR, "Quanta"), |
1016 | DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL}, | 1031 | DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL}, |
1017 | { | 1032 | { |
1033 | ec_flag_msi, "Clevo W350etq", { | ||
1034 | DMI_MATCH(DMI_SYS_VENDOR, "CLEVO CO."), | ||
1035 | DMI_MATCH(DMI_PRODUCT_NAME, "W35_37ET"),}, NULL}, | ||
1036 | { | ||
1018 | ec_validate_ecdt, "ASUS hardware", { | 1037 | ec_validate_ecdt, "ASUS hardware", { |
1019 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, | 1038 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, |
1020 | { | 1039 | { |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index c96887d5289e..6e6b80eb0bba 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -484,6 +484,10 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
484 | /* Keep IOAPIC pin configuration when suspending */ | 484 | /* Keep IOAPIC pin configuration when suspending */ |
485 | if (dev->dev.power.is_prepared) | 485 | if (dev->dev.power.is_prepared) |
486 | return; | 486 | return; |
487 | #ifdef CONFIG_PM_RUNTIME | ||
488 | if (dev->dev.power.runtime_status == RPM_SUSPENDING) | ||
489 | return; | ||
490 | #endif | ||
487 | 491 | ||
488 | entry = acpi_pci_irq_lookup(dev, pin); | 492 | entry = acpi_pci_irq_lookup(dev, pin); |
489 | if (!entry) | 493 | if (!entry) |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 3dca36d4ad26..17f9ec501972 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -1071,9 +1071,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1071 | 1071 | ||
1072 | if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { | 1072 | if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { |
1073 | 1073 | ||
1074 | cpuidle_pause_and_lock(); | ||
1075 | /* Protect against cpu-hotplug */ | 1074 | /* Protect against cpu-hotplug */ |
1076 | get_online_cpus(); | 1075 | get_online_cpus(); |
1076 | cpuidle_pause_and_lock(); | ||
1077 | 1077 | ||
1078 | /* Disable all cpuidle devices */ | 1078 | /* Disable all cpuidle devices */ |
1079 | for_each_online_cpu(cpu) { | 1079 | for_each_online_cpu(cpu) { |
@@ -1100,8 +1100,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1100 | cpuidle_enable_device(dev); | 1100 | cpuidle_enable_device(dev); |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | put_online_cpus(); | ||
1104 | cpuidle_resume_and_unlock(); | 1103 | cpuidle_resume_and_unlock(); |
1104 | put_online_cpus(); | ||
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | return 0; | 1107 | return 0; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0a817ad24f16..ae44d8654c82 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -130,7 +130,7 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { | 130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { |
131 | count = snprintf(&modalias[len], size, "%s:", id->id); | 131 | count = snprintf(&modalias[len], size, "%s:", id->id); |
132 | if (count < 0) | 132 | if (count < 0) |
133 | return EINVAL; | 133 | return -EINVAL; |
134 | if (count >= size) | 134 | if (count >= size) |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
136 | len += count; | 136 | len += count; |
@@ -667,8 +667,14 @@ static ssize_t | |||
667 | acpi_device_sun_show(struct device *dev, struct device_attribute *attr, | 667 | acpi_device_sun_show(struct device *dev, struct device_attribute *attr, |
668 | char *buf) { | 668 | char *buf) { |
669 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 669 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
670 | acpi_status status; | ||
671 | unsigned long long sun; | ||
672 | |||
673 | status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun); | ||
674 | if (ACPI_FAILURE(status)) | ||
675 | return -ENODEV; | ||
670 | 676 | ||
671 | return sprintf(buf, "%lu\n", acpi_dev->pnp.sun); | 677 | return sprintf(buf, "%llu\n", sun); |
672 | } | 678 | } |
673 | static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); | 679 | static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); |
674 | 680 | ||
@@ -690,7 +696,6 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
690 | { | 696 | { |
691 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 697 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
692 | acpi_status status; | 698 | acpi_status status; |
693 | unsigned long long sun; | ||
694 | int result = 0; | 699 | int result = 0; |
695 | 700 | ||
696 | /* | 701 | /* |
@@ -731,14 +736,10 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
731 | if (dev->pnp.unique_id) | 736 | if (dev->pnp.unique_id) |
732 | result = device_create_file(&dev->dev, &dev_attr_uid); | 737 | result = device_create_file(&dev->dev, &dev_attr_uid); |
733 | 738 | ||
734 | status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun); | 739 | if (acpi_has_method(dev->handle, "_SUN")) { |
735 | if (ACPI_SUCCESS(status)) { | ||
736 | dev->pnp.sun = (unsigned long)sun; | ||
737 | result = device_create_file(&dev->dev, &dev_attr_sun); | 740 | result = device_create_file(&dev->dev, &dev_attr_sun); |
738 | if (result) | 741 | if (result) |
739 | goto end; | 742 | goto end; |
740 | } else { | ||
741 | dev->pnp.sun = (unsigned long)-1; | ||
742 | } | 743 | } |
743 | 744 | ||
744 | if (acpi_has_method(dev->handle, "_STA")) { | 745 | if (acpi_has_method(dev->handle, "_STA")) { |
@@ -922,12 +923,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data) | |||
922 | device->driver->ops.notify(device, event); | 923 | device->driver->ops.notify(device, event); |
923 | } | 924 | } |
924 | 925 | ||
925 | static acpi_status acpi_device_notify_fixed(void *data) | 926 | static void acpi_device_notify_fixed(void *data) |
926 | { | 927 | { |
927 | struct acpi_device *device = data; | 928 | struct acpi_device *device = data; |
928 | 929 | ||
929 | /* Fixed hardware devices have no handles */ | 930 | /* Fixed hardware devices have no handles */ |
930 | acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); | 931 | acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); |
932 | } | ||
933 | |||
934 | static acpi_status acpi_device_fixed_event(void *data) | ||
935 | { | ||
936 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data); | ||
931 | return AE_OK; | 937 | return AE_OK; |
932 | } | 938 | } |
933 | 939 | ||
@@ -938,12 +944,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device) | |||
938 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) | 944 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) |
939 | status = | 945 | status = |
940 | acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, | 946 | acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, |
941 | acpi_device_notify_fixed, | 947 | acpi_device_fixed_event, |
942 | device); | 948 | device); |
943 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) | 949 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) |
944 | status = | 950 | status = |
945 | acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, | 951 | acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, |
946 | acpi_device_notify_fixed, | 952 | acpi_device_fixed_event, |
947 | device); | 953 | device); |
948 | else | 954 | else |
949 | status = acpi_install_notify_handler(device->handle, | 955 | status = acpi_install_notify_handler(device->handle, |
@@ -960,10 +966,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) | |||
960 | { | 966 | { |
961 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) | 967 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) |
962 | acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, | 968 | acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, |
963 | acpi_device_notify_fixed); | 969 | acpi_device_fixed_event); |
964 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) | 970 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) |
965 | acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, | 971 | acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, |
966 | acpi_device_notify_fixed); | 972 | acpi_device_fixed_event); |
967 | else | 973 | else |
968 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | 974 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, |
969 | acpi_device_notify); | 975 | acpi_device_notify); |
@@ -975,7 +981,7 @@ static int acpi_device_probe(struct device *dev) | |||
975 | struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); | 981 | struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); |
976 | int ret; | 982 | int ret; |
977 | 983 | ||
978 | if (acpi_dev->handler) | 984 | if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev)) |
979 | return -EINVAL; | 985 | return -EINVAL; |
980 | 986 | ||
981 | if (!acpi_drv->ops.add) | 987 | if (!acpi_drv->ops.add) |
@@ -2183,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
2183 | ok: | 2189 | ok: |
2184 | list_for_each_entry(child, &device->children, node) | 2190 | list_for_each_entry(child, &device->children, node) |
2185 | acpi_bus_attach(child); | 2191 | acpi_bus_attach(child); |
2192 | |||
2193 | if (device->handler && device->handler->hotplug.notify_online) | ||
2194 | device->handler->hotplug.notify_online(device); | ||
2186 | } | 2195 | } |
2187 | 2196 | ||
2188 | /** | 2197 | /** |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 826884392e6b..8e7e18567ae6 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -82,9 +82,9 @@ module_param(allow_duplicates, bool, 0644); | |||
82 | * For Windows 8 systems: used to decide if video module | 82 | * For Windows 8 systems: used to decide if video module |
83 | * should skip registering backlight interface of its own. | 83 | * should skip registering backlight interface of its own. |
84 | */ | 84 | */ |
85 | static int use_native_backlight_param = 1; | 85 | static int use_native_backlight_param = -1; |
86 | module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); | 86 | module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); |
87 | static bool use_native_backlight_dmi = false; | 87 | static bool use_native_backlight_dmi = true; |
88 | 88 | ||
89 | static int register_count; | 89 | static int register_count; |
90 | static struct mutex video_list_lock; | 90 | static struct mutex video_list_lock; |
@@ -417,6 +417,12 @@ static int __init video_set_use_native_backlight(const struct dmi_system_id *d) | |||
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | static int __init video_disable_native_backlight(const struct dmi_system_id *d) | ||
421 | { | ||
422 | use_native_backlight_dmi = false; | ||
423 | return 0; | ||
424 | } | ||
425 | |||
420 | static struct dmi_system_id video_dmi_table[] __initdata = { | 426 | static struct dmi_system_id video_dmi_table[] __initdata = { |
421 | /* | 427 | /* |
422 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 | 428 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
@@ -720,6 +726,49 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
720 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), | 726 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), |
721 | }, | 727 | }, |
722 | }, | 728 | }, |
729 | |||
730 | /* | ||
731 | * These models have a working acpi_video backlight control, and using | ||
732 | * native backlight causes a regression where backlight does not work | ||
733 | * when userspace is not handling brightness key events. Disable | ||
734 | * native_backlight on these to fix this: | ||
735 | * https://bugzilla.kernel.org/show_bug.cgi?id=81691 | ||
736 | */ | ||
737 | { | ||
738 | .callback = video_disable_native_backlight, | ||
739 | .ident = "ThinkPad T420", | ||
740 | .matches = { | ||
741 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
742 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"), | ||
743 | }, | ||
744 | }, | ||
745 | { | ||
746 | .callback = video_disable_native_backlight, | ||
747 | .ident = "ThinkPad T520", | ||
748 | .matches = { | ||
749 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
750 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), | ||
751 | }, | ||
752 | }, | ||
753 | { | ||
754 | .callback = video_disable_native_backlight, | ||
755 | .ident = "ThinkPad X201s", | ||
756 | .matches = { | ||
757 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
758 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"), | ||
759 | }, | ||
760 | }, | ||
761 | |||
762 | /* The native backlight controls do not work on some older machines */ | ||
763 | { | ||
764 | /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */ | ||
765 | .callback = video_disable_native_backlight, | ||
766 | .ident = "HP ENVY 15 Notebook", | ||
767 | .matches = { | ||
768 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
769 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"), | ||
770 | }, | ||
771 | }, | ||
723 | {} | 772 | {} |
724 | }; | 773 | }; |
725 | 774 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index a29f8012fb08..a0cc0edafc78 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -305,6 +305,14 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
305 | { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ | 305 | { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ |
306 | { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ | 306 | { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ |
307 | { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ | 307 | { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ |
308 | { PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */ | ||
309 | { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series AHCI */ | ||
310 | { PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */ | ||
311 | { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series RAID */ | ||
312 | { PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */ | ||
313 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ | ||
314 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ | ||
315 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ | ||
308 | 316 | ||
309 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 317 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
310 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 318 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -442,6 +450,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
442 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), | 450 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), |
443 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | 451 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ |
444 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), | 452 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), |
453 | .driver_data = board_ahci_yes_fbs }, /* 88se9182 */ | ||
454 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9182), | ||
445 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | 455 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ |
446 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), | 456 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), |
447 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ | 457 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ |
@@ -1329,6 +1339,18 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1329 | else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) | 1339 | else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) |
1330 | ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; | 1340 | ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; |
1331 | 1341 | ||
1342 | /* | ||
1343 | * The JMicron chip 361/363 contains one SATA controller and one | ||
1344 | * PATA controller,for powering on these both controllers, we must | ||
1345 | * follow the sequence one by one, otherwise one of them can not be | ||
1346 | * powered on successfully, so here we disable the async suspend | ||
1347 | * method for these chips. | ||
1348 | */ | ||
1349 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | ||
1350 | (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | ||
1351 | pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | ||
1352 | device_disable_async_suspend(&pdev->dev); | ||
1353 | |||
1332 | /* acquire resources */ | 1354 | /* acquire resources */ |
1333 | rc = pcim_enable_device(pdev); | 1355 | rc = pcim_enable_device(pdev); |
1334 | if (rc) | 1356 | if (rc) |
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c index fc3df47fca35..032904402c95 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c | |||
@@ -18,14 +18,17 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/ahci_platform.h> | 20 | #include <linux/ahci_platform.h> |
21 | #include <linux/reset.h> | ||
22 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
23 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/of_device.h> | 24 | #include <linux/of_device.h> |
26 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
27 | #include <linux/tegra-powergate.h> | ||
28 | #include <linux/regulator/consumer.h> | 26 | #include <linux/regulator/consumer.h> |
27 | #include <linux/reset.h> | ||
28 | |||
29 | #include <soc/tegra/fuse.h> | ||
30 | #include <soc/tegra/pmc.h> | ||
31 | |||
29 | #include "ahci.h" | 32 | #include "ahci.h" |
30 | 33 | ||
31 | #define SATA_CONFIGURATION_0 0x180 | 34 | #define SATA_CONFIGURATION_0 0x180 |
@@ -180,9 +183,12 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv) | |||
180 | 183 | ||
181 | /* Pad calibration */ | 184 | /* Pad calibration */ |
182 | 185 | ||
183 | /* FIXME Always use calibration 0. Change this to read the calibration | 186 | ret = tegra_fuse_readl(FUSE_SATA_CALIB, &val); |
184 | * fuse once the fuse driver has landed. */ | 187 | if (ret) { |
185 | val = 0; | 188 | dev_err(&tegra->pdev->dev, |
189 | "failed to read calibration fuse: %d\n", ret); | ||
190 | return ret; | ||
191 | } | ||
186 | 192 | ||
187 | calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK]; | 193 | calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK]; |
188 | 194 | ||
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index bc281115490b..f03aab187f4d 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -78,6 +78,9 @@ | |||
78 | #define CFG_MEM_RAM_SHUTDOWN 0x00000070 | 78 | #define CFG_MEM_RAM_SHUTDOWN 0x00000070 |
79 | #define BLOCK_MEM_RDY 0x00000074 | 79 | #define BLOCK_MEM_RDY 0x00000074 |
80 | 80 | ||
81 | /* Max retry for link down */ | ||
82 | #define MAX_LINK_DOWN_RETRY 3 | ||
83 | |||
81 | struct xgene_ahci_context { | 84 | struct xgene_ahci_context { |
82 | struct ahci_host_priv *hpriv; | 85 | struct ahci_host_priv *hpriv; |
83 | struct device *dev; | 86 | struct device *dev; |
@@ -145,6 +148,14 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) | |||
145 | return rc; | 148 | return rc; |
146 | } | 149 | } |
147 | 150 | ||
151 | static bool xgene_ahci_is_memram_inited(struct xgene_ahci_context *ctx) | ||
152 | { | ||
153 | void __iomem *diagcsr = ctx->csr_diag; | ||
154 | |||
155 | return (readl(diagcsr + CFG_MEM_RAM_SHUTDOWN) == 0 && | ||
156 | readl(diagcsr + BLOCK_MEM_RDY) == 0xFFFFFFFF); | ||
157 | } | ||
158 | |||
148 | /** | 159 | /** |
149 | * xgene_ahci_read_id - Read ID data from the specified device | 160 | * xgene_ahci_read_id - Read ID data from the specified device |
150 | * @dev: device | 161 | * @dev: device |
@@ -229,8 +240,11 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel) | |||
229 | * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will | 240 | * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will |
230 | * report disparity error and etc. In addition, during COMRESET, there can | 241 | * report disparity error and etc. In addition, during COMRESET, there can |
231 | * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and | 242 | * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and |
232 | * SERR_10B_8B_ERR, the PHY receiver line must be reseted. The following | 243 | * SERR_10B_8B_ERR, the PHY receiver line must be reseted. Also during long |
233 | * algorithm is followed to proper configure the hardware PHY during COMRESET: | 244 | * reboot cycle regression, sometimes the PHY reports link down even if the |
245 | * device is present because of speed negotiation failure. so need to retry | ||
246 | * the COMRESET to get the link up. The following algorithm is followed to | ||
247 | * proper configure the hardware PHY during COMRESET: | ||
234 | * | 248 | * |
235 | * Alg Part 1: | 249 | * Alg Part 1: |
236 | * 1. Start the PHY at Gen3 speed (default setting) | 250 | * 1. Start the PHY at Gen3 speed (default setting) |
@@ -246,9 +260,15 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel) | |||
246 | * Alg Part 2: | 260 | * Alg Part 2: |
247 | * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error | 261 | * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error |
248 | * reported in the register PORT_SCR_ERR, then reset the PHY receiver line | 262 | * reported in the register PORT_SCR_ERR, then reset the PHY receiver line |
249 | * 2. Go to Alg Part 3 | 263 | * 2. Go to Alg Part 4 |
250 | * | 264 | * |
251 | * Alg Part 3: | 265 | * Alg Part 3: |
266 | * 1. Check the PORT_SCR_STAT to see whether device presence detected but PHY | ||
267 | * communication establishment failed and maximum link down attempts are | ||
268 | * less than Max attempts 3 then goto Alg Part 1. | ||
269 | * 2. Go to Alg Part 4. | ||
270 | * | ||
271 | * Alg Part 4: | ||
252 | * 1. Clear any pending from register PORT_SCR_ERR. | 272 | * 1. Clear any pending from register PORT_SCR_ERR. |
253 | * | 273 | * |
254 | * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition | 274 | * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition |
@@ -267,19 +287,27 @@ static int xgene_ahci_do_hardreset(struct ata_link *link, | |||
267 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | 287 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
268 | void __iomem *port_mmio = ahci_port_base(ap); | 288 | void __iomem *port_mmio = ahci_port_base(ap); |
269 | struct ata_taskfile tf; | 289 | struct ata_taskfile tf; |
290 | int link_down_retry = 0; | ||
270 | int rc; | 291 | int rc; |
271 | u32 val; | 292 | u32 val, sstatus; |
272 | 293 | ||
273 | /* clear D2H reception area to properly wait for D2H FIS */ | 294 | do { |
274 | ata_tf_init(link->device, &tf); | 295 | /* clear D2H reception area to properly wait for D2H FIS */ |
275 | tf.command = ATA_BUSY; | 296 | ata_tf_init(link->device, &tf); |
276 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); | 297 | tf.command = ATA_BUSY; |
277 | rc = sata_link_hardreset(link, timing, deadline, online, | 298 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); |
299 | rc = sata_link_hardreset(link, timing, deadline, online, | ||
278 | ahci_check_ready); | 300 | ahci_check_ready); |
301 | if (*online) { | ||
302 | val = readl(port_mmio + PORT_SCR_ERR); | ||
303 | if (val & (SERR_DISPARITY | SERR_10B_8B_ERR)) | ||
304 | dev_warn(ctx->dev, "link has error\n"); | ||
305 | break; | ||
306 | } | ||
279 | 307 | ||
280 | val = readl(port_mmio + PORT_SCR_ERR); | 308 | sata_scr_read(link, SCR_STATUS, &sstatus); |
281 | if (val & (SERR_DISPARITY | SERR_10B_8B_ERR)) | 309 | } while (link_down_retry++ < MAX_LINK_DOWN_RETRY && |
282 | dev_warn(ctx->dev, "link has error\n"); | 310 | (sstatus & 0xff) == 0x1); |
283 | 311 | ||
284 | /* clear all errors if any pending */ | 312 | /* clear all errors if any pending */ |
285 | val = readl(port_mmio + PORT_SCR_ERR); | 313 | val = readl(port_mmio + PORT_SCR_ERR); |
@@ -344,7 +372,7 @@ static struct ata_port_operations xgene_ahci_ops = { | |||
344 | }; | 372 | }; |
345 | 373 | ||
346 | static const struct ata_port_info xgene_ahci_port_info = { | 374 | static const struct ata_port_info xgene_ahci_port_info = { |
347 | .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ, | 375 | .flags = AHCI_FLAG_COMMON, |
348 | .pio_mask = ATA_PIO4, | 376 | .pio_mask = ATA_PIO4, |
349 | .udma_mask = ATA_UDMA6, | 377 | .udma_mask = ATA_UDMA6, |
350 | .port_ops = &xgene_ahci_ops, | 378 | .port_ops = &xgene_ahci_ops, |
@@ -467,6 +495,11 @@ static int xgene_ahci_probe(struct platform_device *pdev) | |||
467 | return -ENODEV; | 495 | return -ENODEV; |
468 | } | 496 | } |
469 | 497 | ||
498 | if (xgene_ahci_is_memram_inited(ctx)) { | ||
499 | dev_info(dev, "skip clock and PHY initialization\n"); | ||
500 | goto skip_clk_phy; | ||
501 | } | ||
502 | |||
470 | /* Due to errata, HW requires full toggle transition */ | 503 | /* Due to errata, HW requires full toggle transition */ |
471 | rc = ahci_platform_enable_clks(hpriv); | 504 | rc = ahci_platform_enable_clks(hpriv); |
472 | if (rc) | 505 | if (rc) |
@@ -479,8 +512,8 @@ static int xgene_ahci_probe(struct platform_device *pdev) | |||
479 | 512 | ||
480 | /* Configure the host controller */ | 513 | /* Configure the host controller */ |
481 | xgene_ahci_hw_init(hpriv); | 514 | xgene_ahci_hw_init(hpriv); |
482 | 515 | skip_clk_phy: | |
483 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ; | 516 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ; |
484 | 517 | ||
485 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); | 518 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); |
486 | if (rc) | 519 | if (rc) |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 893e30e9a9ef..ffbe625e6fd2 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -340,6 +340,14 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
340 | { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, | 340 | { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, |
341 | /* SATA Controller IDE (Coleto Creek) */ | 341 | /* SATA Controller IDE (Coleto Creek) */ |
342 | { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 342 | { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
343 | /* SATA Controller IDE (9 Series) */ | ||
344 | { 0x8086, 0x8c88, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, | ||
345 | /* SATA Controller IDE (9 Series) */ | ||
346 | { 0x8086, 0x8c89, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, | ||
347 | /* SATA Controller IDE (9 Series) */ | ||
348 | { 0x8086, 0x8c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | ||
349 | /* SATA Controller IDE (9 Series) */ | ||
350 | { 0x8086, 0x8c81, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | ||
343 | 351 | ||
344 | { } /* terminate list */ | 352 | { } /* terminate list */ |
345 | }; | 353 | }; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index dbdc5d32343f..f3e7b9f894cd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4228,7 +4228,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4228 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4228 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4229 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4229 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4230 | { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4230 | { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4231 | { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4231 | { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4232 | 4232 | ||
4233 | /* | 4233 | /* |
4234 | * Some WD SATA-I drives spin up and down erratically when the link | 4234 | * Some WD SATA-I drives spin up and down erratically when the link |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 4d1a5d2c4287..47e418b8c8ba 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -143,6 +143,18 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
143 | }; | 143 | }; |
144 | const struct ata_port_info *ppi[] = { &info, NULL }; | 144 | const struct ata_port_info *ppi[] = { &info, NULL }; |
145 | 145 | ||
146 | /* | ||
147 | * The JMicron chip 361/363 contains one SATA controller and one | ||
148 | * PATA controller,for powering on these both controllers, we must | ||
149 | * follow the sequence one by one, otherwise one of them can not be | ||
150 | * powered on successfully, so here we disable the async suspend | ||
151 | * method for these chips. | ||
152 | */ | ||
153 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | ||
154 | (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | ||
155 | pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | ||
156 | device_disable_async_suspend(&pdev->dev); | ||
157 | |||
146 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); | 158 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); |
147 | } | 159 | } |
148 | 160 | ||
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index 2578fc16960a..1a24a5dc3940 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -360,7 +360,7 @@ static int pata_s3c_wait_after_reset(struct ata_link *link, | |||
360 | /* | 360 | /* |
361 | * pata_s3c_bus_softreset - PATA device software reset | 361 | * pata_s3c_bus_softreset - PATA device software reset |
362 | */ | 362 | */ |
363 | static unsigned int pata_s3c_bus_softreset(struct ata_port *ap, | 363 | static int pata_s3c_bus_softreset(struct ata_port *ap, |
364 | unsigned long deadline) | 364 | unsigned long deadline) |
365 | { | 365 | { |
366 | struct ata_ioports *ioaddr = &ap->ioaddr; | 366 | struct ata_ioports *ioaddr = &ap->ioaddr; |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 4e006d74bef8..7f4cb76ed9fa 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -585,7 +585,7 @@ static int scc_wait_after_reset(struct ata_link *link, unsigned int devmask, | |||
585 | * Note: Original code is ata_bus_softreset(). | 585 | * Note: Original code is ata_bus_softreset(). |
586 | */ | 586 | */ |
587 | 587 | ||
588 | static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, | 588 | static int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, |
589 | unsigned long deadline) | 589 | unsigned long deadline) |
590 | { | 590 | { |
591 | struct ata_ioports *ioaddr = &ap->ioaddr; | 591 | struct ata_ioports *ioaddr = &ap->ioaddr; |
@@ -599,9 +599,7 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
599 | udelay(20); | 599 | udelay(20); |
600 | out_be32(ioaddr->ctl_addr, ap->ctl); | 600 | out_be32(ioaddr->ctl_addr, ap->ctl); |
601 | 601 | ||
602 | scc_wait_after_reset(&ap->link, devmask, deadline); | 602 | return scc_wait_after_reset(&ap->link, devmask, deadline); |
603 | |||
604 | return 0; | ||
605 | } | 603 | } |
606 | 604 | ||
607 | /** | 605 | /** |
@@ -618,7 +616,8 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes, | |||
618 | { | 616 | { |
619 | struct ata_port *ap = link->ap; | 617 | struct ata_port *ap = link->ap; |
620 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; | 618 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; |
621 | unsigned int devmask = 0, err_mask; | 619 | unsigned int devmask = 0; |
620 | int rc; | ||
622 | u8 err; | 621 | u8 err; |
623 | 622 | ||
624 | DPRINTK("ENTER\n"); | 623 | DPRINTK("ENTER\n"); |
@@ -634,9 +633,9 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes, | |||
634 | 633 | ||
635 | /* issue bus reset */ | 634 | /* issue bus reset */ |
636 | DPRINTK("about to softreset, devmask=%x\n", devmask); | 635 | DPRINTK("about to softreset, devmask=%x\n", devmask); |
637 | err_mask = scc_bus_softreset(ap, devmask, deadline); | 636 | rc = scc_bus_softreset(ap, devmask, deadline); |
638 | if (err_mask) { | 637 | if (rc) { |
639 | ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", err_mask); | 638 | ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", rc); |
640 | return -EIO; | 639 | return -EIO; |
641 | } | 640 | } |
642 | 641 | ||
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 7d1326985bee..bfc90b8547f2 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
@@ -146,6 +146,9 @@ struct regcache_ops { | |||
146 | enum regcache_type type; | 146 | enum regcache_type type; |
147 | int (*init)(struct regmap *map); | 147 | int (*init)(struct regmap *map); |
148 | int (*exit)(struct regmap *map); | 148 | int (*exit)(struct regmap *map); |
149 | #ifdef CONFIG_DEBUG_FS | ||
150 | void (*debugfs_init)(struct regmap *map); | ||
151 | #endif | ||
149 | int (*read)(struct regmap *map, unsigned int reg, unsigned int *value); | 152 | int (*read)(struct regmap *map, unsigned int reg, unsigned int *value); |
150 | int (*write)(struct regmap *map, unsigned int reg, unsigned int value); | 153 | int (*write)(struct regmap *map, unsigned int reg, unsigned int value); |
151 | int (*sync)(struct regmap *map, unsigned int min, unsigned int max); | 154 | int (*sync)(struct regmap *map, unsigned int min, unsigned int max); |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 6a7e4fa12854..f3e8fe0cc650 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -194,10 +194,6 @@ static void rbtree_debugfs_init(struct regmap *map) | |||
194 | { | 194 | { |
195 | debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops); | 195 | debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops); |
196 | } | 196 | } |
197 | #else | ||
198 | static void rbtree_debugfs_init(struct regmap *map) | ||
199 | { | ||
200 | } | ||
201 | #endif | 197 | #endif |
202 | 198 | ||
203 | static int regcache_rbtree_init(struct regmap *map) | 199 | static int regcache_rbtree_init(struct regmap *map) |
@@ -222,8 +218,6 @@ static int regcache_rbtree_init(struct regmap *map) | |||
222 | goto err; | 218 | goto err; |
223 | } | 219 | } |
224 | 220 | ||
225 | rbtree_debugfs_init(map); | ||
226 | |||
227 | return 0; | 221 | return 0; |
228 | 222 | ||
229 | err: | 223 | err: |
@@ -532,6 +526,9 @@ struct regcache_ops regcache_rbtree_ops = { | |||
532 | .name = "rbtree", | 526 | .name = "rbtree", |
533 | .init = regcache_rbtree_init, | 527 | .init = regcache_rbtree_init, |
534 | .exit = regcache_rbtree_exit, | 528 | .exit = regcache_rbtree_exit, |
529 | #ifdef CONFIG_DEBUG_FS | ||
530 | .debugfs_init = rbtree_debugfs_init, | ||
531 | #endif | ||
535 | .read = regcache_rbtree_read, | 532 | .read = regcache_rbtree_read, |
536 | .write = regcache_rbtree_write, | 533 | .write = regcache_rbtree_write, |
537 | .sync = regcache_rbtree_sync, | 534 | .sync = regcache_rbtree_sync, |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 29b4128da0b0..5617da6dc898 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -698,7 +698,7 @@ int regcache_sync_block(struct regmap *map, void *block, | |||
698 | unsigned int block_base, unsigned int start, | 698 | unsigned int block_base, unsigned int start, |
699 | unsigned int end) | 699 | unsigned int end) |
700 | { | 700 | { |
701 | if (regmap_can_raw_write(map)) | 701 | if (regmap_can_raw_write(map) && !map->use_single_rw) |
702 | return regcache_sync_block_raw(map, block, cache_present, | 702 | return regcache_sync_block_raw(map, block, cache_present, |
703 | block_base, start, end); | 703 | block_base, start, end); |
704 | else | 704 | else |
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 45d812c0ea77..0c94b661c16f 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name) | |||
512 | map, ®map_reg_ranges_fops); | 512 | map, ®map_reg_ranges_fops); |
513 | 513 | ||
514 | if (map->max_register || regmap_readable(map, 0)) { | 514 | if (map->max_register || regmap_readable(map, 0)) { |
515 | debugfs_create_file("registers", 0400, map->debugfs, | 515 | umode_t registers_mode; |
516 | |||
517 | if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS)) | ||
518 | registers_mode = 0600; | ||
519 | else | ||
520 | registers_mode = 0400; | ||
521 | |||
522 | debugfs_create_file("registers", registers_mode, map->debugfs, | ||
516 | map, ®map_map_fops); | 523 | map, ®map_map_fops); |
517 | debugfs_create_file("access", 0400, map->debugfs, | 524 | debugfs_create_file("access", 0400, map->debugfs, |
518 | map, ®map_access_fops); | 525 | map, ®map_access_fops); |
@@ -538,6 +545,9 @@ void regmap_debugfs_init(struct regmap *map, const char *name) | |||
538 | 545 | ||
539 | next = rb_next(&range_node->node); | 546 | next = rb_next(&range_node->node); |
540 | } | 547 | } |
548 | |||
549 | if (map->cache_ops && map->cache_ops->debugfs_init) | ||
550 | map->cache_ops->debugfs_init(map); | ||
541 | } | 551 | } |
542 | 552 | ||
543 | void regmap_debugfs_exit(struct regmap *map) | 553 | void regmap_debugfs_exit(struct regmap *map) |
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c index ca193d1ef47c..053150a7f9f2 100644 --- a/drivers/base/regmap/regmap-i2c.c +++ b/drivers/base/regmap/regmap-i2c.c | |||
@@ -168,6 +168,8 @@ static struct regmap_bus regmap_i2c = { | |||
168 | .write = regmap_i2c_write, | 168 | .write = regmap_i2c_write, |
169 | .gather_write = regmap_i2c_gather_write, | 169 | .gather_write = regmap_i2c_gather_write, |
170 | .read = regmap_i2c_read, | 170 | .read = regmap_i2c_read, |
171 | .reg_format_endian_default = REGMAP_ENDIAN_BIG, | ||
172 | .val_format_endian_default = REGMAP_ENDIAN_BIG, | ||
171 | }; | 173 | }; |
172 | 174 | ||
173 | static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c, | 175 | static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c, |
diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c index 0eb3097c0d76..53d1148e80a0 100644 --- a/drivers/base/regmap/regmap-spi.c +++ b/drivers/base/regmap/regmap-spi.c | |||
@@ -109,6 +109,8 @@ static struct regmap_bus regmap_spi = { | |||
109 | .async_alloc = regmap_spi_async_alloc, | 109 | .async_alloc = regmap_spi_async_alloc, |
110 | .read = regmap_spi_read, | 110 | .read = regmap_spi_read, |
111 | .read_flag_mask = 0x80, | 111 | .read_flag_mask = 0x80, |
112 | .reg_format_endian_default = REGMAP_ENDIAN_BIG, | ||
113 | .val_format_endian_default = REGMAP_ENDIAN_BIG, | ||
112 | }; | 114 | }; |
113 | 115 | ||
114 | /** | 116 | /** |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 78f43fb2fe84..f2281af24ec6 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/export.h> | 15 | #include <linux/export.h> |
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/of.h> | ||
18 | #include <linux/rbtree.h> | 19 | #include <linux/rbtree.h> |
19 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
20 | 21 | ||
@@ -109,7 +110,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg) | |||
109 | 110 | ||
110 | bool regmap_volatile(struct regmap *map, unsigned int reg) | 111 | bool regmap_volatile(struct regmap *map, unsigned int reg) |
111 | { | 112 | { |
112 | if (!regmap_readable(map, reg)) | 113 | if (!map->format.format_write && !regmap_readable(map, reg)) |
113 | return false; | 114 | return false; |
114 | 115 | ||
115 | if (map->volatile_reg) | 116 | if (map->volatile_reg) |
@@ -448,6 +449,66 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
448 | } | 449 | } |
449 | EXPORT_SYMBOL_GPL(regmap_attach_dev); | 450 | EXPORT_SYMBOL_GPL(regmap_attach_dev); |
450 | 451 | ||
452 | static enum regmap_endian regmap_get_reg_endian(const struct regmap_bus *bus, | ||
453 | const struct regmap_config *config) | ||
454 | { | ||
455 | enum regmap_endian endian; | ||
456 | |||
457 | /* Retrieve the endianness specification from the regmap config */ | ||
458 | endian = config->reg_format_endian; | ||
459 | |||
460 | /* If the regmap config specified a non-default value, use that */ | ||
461 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
462 | return endian; | ||
463 | |||
464 | /* Retrieve the endianness specification from the bus config */ | ||
465 | if (bus && bus->reg_format_endian_default) | ||
466 | endian = bus->reg_format_endian_default; | ||
467 | |||
468 | /* If the bus specified a non-default value, use that */ | ||
469 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
470 | return endian; | ||
471 | |||
472 | /* Use this if no other value was found */ | ||
473 | return REGMAP_ENDIAN_BIG; | ||
474 | } | ||
475 | |||
476 | static enum regmap_endian regmap_get_val_endian(struct device *dev, | ||
477 | const struct regmap_bus *bus, | ||
478 | const struct regmap_config *config) | ||
479 | { | ||
480 | struct device_node *np = dev->of_node; | ||
481 | enum regmap_endian endian; | ||
482 | |||
483 | /* Retrieve the endianness specification from the regmap config */ | ||
484 | endian = config->val_format_endian; | ||
485 | |||
486 | /* If the regmap config specified a non-default value, use that */ | ||
487 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
488 | return endian; | ||
489 | |||
490 | /* Parse the device's DT node for an endianness specification */ | ||
491 | if (of_property_read_bool(np, "big-endian")) | ||
492 | endian = REGMAP_ENDIAN_BIG; | ||
493 | else if (of_property_read_bool(np, "little-endian")) | ||
494 | endian = REGMAP_ENDIAN_LITTLE; | ||
495 | |||
496 | /* If the endianness was specified in DT, use that */ | ||
497 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
498 | return endian; | ||
499 | |||
500 | /* Retrieve the endianness specification from the bus config */ | ||
501 | if (bus && bus->val_format_endian_default) | ||
502 | endian = bus->val_format_endian_default; | ||
503 | |||
504 | /* If the bus specified a non-default value, use that */ | ||
505 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
506 | return endian; | ||
507 | |||
508 | /* Use this if no other value was found */ | ||
509 | return REGMAP_ENDIAN_BIG; | ||
510 | } | ||
511 | |||
451 | /** | 512 | /** |
452 | * regmap_init(): Initialise register map | 513 | * regmap_init(): Initialise register map |
453 | * | 514 | * |
@@ -551,17 +612,8 @@ struct regmap *regmap_init(struct device *dev, | |||
551 | map->reg_read = _regmap_bus_read; | 612 | map->reg_read = _regmap_bus_read; |
552 | } | 613 | } |
553 | 614 | ||
554 | reg_endian = config->reg_format_endian; | 615 | reg_endian = regmap_get_reg_endian(bus, config); |
555 | if (reg_endian == REGMAP_ENDIAN_DEFAULT) | 616 | val_endian = regmap_get_val_endian(dev, bus, config); |
556 | reg_endian = bus->reg_format_endian_default; | ||
557 | if (reg_endian == REGMAP_ENDIAN_DEFAULT) | ||
558 | reg_endian = REGMAP_ENDIAN_BIG; | ||
559 | |||
560 | val_endian = config->val_format_endian; | ||
561 | if (val_endian == REGMAP_ENDIAN_DEFAULT) | ||
562 | val_endian = bus->val_format_endian_default; | ||
563 | if (val_endian == REGMAP_ENDIAN_DEFAULT) | ||
564 | val_endian = REGMAP_ENDIAN_BIG; | ||
565 | 617 | ||
566 | switch (config->reg_bits + map->reg_shift) { | 618 | switch (config->reg_bits + map->reg_shift) { |
567 | case 2: | 619 | case 2: |
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index 294a7dd25190..f032ed6dd459 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
@@ -282,6 +282,7 @@ static const struct pci_device_id bcma_pci_bridge_tbl[] = { | |||
282 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, | 282 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, |
283 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, | 283 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, |
284 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, | 284 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, |
285 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */ | ||
285 | { 0, }, | 286 | { 0, }, |
286 | }; | 287 | }; |
287 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); | 288 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); |
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index c7d138eca731..3598110d2cef 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -442,12 +442,15 @@ static int rd_nr; | |||
442 | int rd_size = CONFIG_BLK_DEV_RAM_SIZE; | 442 | int rd_size = CONFIG_BLK_DEV_RAM_SIZE; |
443 | static int max_part; | 443 | static int max_part; |
444 | static int part_shift; | 444 | static int part_shift; |
445 | static int part_show = 0; | ||
445 | module_param(rd_nr, int, S_IRUGO); | 446 | module_param(rd_nr, int, S_IRUGO); |
446 | MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices"); | 447 | MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices"); |
447 | module_param(rd_size, int, S_IRUGO); | 448 | module_param(rd_size, int, S_IRUGO); |
448 | MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes."); | 449 | MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes."); |
449 | module_param(max_part, int, S_IRUGO); | 450 | module_param(max_part, int, S_IRUGO); |
450 | MODULE_PARM_DESC(max_part, "Maximum number of partitions per RAM disk"); | 451 | MODULE_PARM_DESC(max_part, "Maximum number of partitions per RAM disk"); |
452 | module_param(part_show, int, S_IRUGO); | ||
453 | MODULE_PARM_DESC(part_show, "Control RAM disk visibility in /proc/partitions"); | ||
451 | MODULE_LICENSE("GPL"); | 454 | MODULE_LICENSE("GPL"); |
452 | MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR); | 455 | MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR); |
453 | MODULE_ALIAS("rd"); | 456 | MODULE_ALIAS("rd"); |
@@ -501,7 +504,8 @@ static struct brd_device *brd_alloc(int i) | |||
501 | disk->fops = &brd_fops; | 504 | disk->fops = &brd_fops; |
502 | disk->private_data = brd; | 505 | disk->private_data = brd; |
503 | disk->queue = brd->brd_queue; | 506 | disk->queue = brd->brd_queue; |
504 | disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; | 507 | if (!part_show) |
508 | disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; | ||
505 | sprintf(disk->disk_name, "ram%d", i); | 509 | sprintf(disk->disk_name, "ram%d", i); |
506 | set_capacity(disk, rd_size * 2); | 510 | set_capacity(disk, rd_size * 2); |
507 | 511 | ||
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index db1e9560d8a7..5c8e7fe07745 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -3918,7 +3918,6 @@ skip_create_disk: | |||
3918 | if (rv) { | 3918 | if (rv) { |
3919 | dev_err(&dd->pdev->dev, | 3919 | dev_err(&dd->pdev->dev, |
3920 | "Unable to allocate request queue\n"); | 3920 | "Unable to allocate request queue\n"); |
3921 | rv = -ENOMEM; | ||
3922 | goto block_queue_alloc_init_error; | 3921 | goto block_queue_alloc_init_error; |
3923 | } | 3922 | } |
3924 | 3923 | ||
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index a3b042c4d448..00d469c7f9f7 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -462,17 +462,21 @@ static int null_add_dev(void) | |||
462 | struct gendisk *disk; | 462 | struct gendisk *disk; |
463 | struct nullb *nullb; | 463 | struct nullb *nullb; |
464 | sector_t size; | 464 | sector_t size; |
465 | int rv; | ||
465 | 466 | ||
466 | nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, home_node); | 467 | nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, home_node); |
467 | if (!nullb) | 468 | if (!nullb) { |
469 | rv = -ENOMEM; | ||
468 | goto out; | 470 | goto out; |
471 | } | ||
469 | 472 | ||
470 | spin_lock_init(&nullb->lock); | 473 | spin_lock_init(&nullb->lock); |
471 | 474 | ||
472 | if (queue_mode == NULL_Q_MQ && use_per_node_hctx) | 475 | if (queue_mode == NULL_Q_MQ && use_per_node_hctx) |
473 | submit_queues = nr_online_nodes; | 476 | submit_queues = nr_online_nodes; |
474 | 477 | ||
475 | if (setup_queues(nullb)) | 478 | rv = setup_queues(nullb); |
479 | if (rv) | ||
476 | goto out_free_nullb; | 480 | goto out_free_nullb; |
477 | 481 | ||
478 | if (queue_mode == NULL_Q_MQ) { | 482 | if (queue_mode == NULL_Q_MQ) { |
@@ -484,22 +488,29 @@ static int null_add_dev(void) | |||
484 | nullb->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 488 | nullb->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
485 | nullb->tag_set.driver_data = nullb; | 489 | nullb->tag_set.driver_data = nullb; |
486 | 490 | ||
487 | if (blk_mq_alloc_tag_set(&nullb->tag_set)) | 491 | rv = blk_mq_alloc_tag_set(&nullb->tag_set); |
492 | if (rv) | ||
488 | goto out_cleanup_queues; | 493 | goto out_cleanup_queues; |
489 | 494 | ||
490 | nullb->q = blk_mq_init_queue(&nullb->tag_set); | 495 | nullb->q = blk_mq_init_queue(&nullb->tag_set); |
491 | if (!nullb->q) | 496 | if (!nullb->q) { |
497 | rv = -ENOMEM; | ||
492 | goto out_cleanup_tags; | 498 | goto out_cleanup_tags; |
499 | } | ||
493 | } else if (queue_mode == NULL_Q_BIO) { | 500 | } else if (queue_mode == NULL_Q_BIO) { |
494 | nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node); | 501 | nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node); |
495 | if (!nullb->q) | 502 | if (!nullb->q) { |
503 | rv = -ENOMEM; | ||
496 | goto out_cleanup_queues; | 504 | goto out_cleanup_queues; |
505 | } | ||
497 | blk_queue_make_request(nullb->q, null_queue_bio); | 506 | blk_queue_make_request(nullb->q, null_queue_bio); |
498 | init_driver_queues(nullb); | 507 | init_driver_queues(nullb); |
499 | } else { | 508 | } else { |
500 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); | 509 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); |
501 | if (!nullb->q) | 510 | if (!nullb->q) { |
511 | rv = -ENOMEM; | ||
502 | goto out_cleanup_queues; | 512 | goto out_cleanup_queues; |
513 | } | ||
503 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); | 514 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); |
504 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); | 515 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); |
505 | init_driver_queues(nullb); | 516 | init_driver_queues(nullb); |
@@ -509,8 +520,10 @@ static int null_add_dev(void) | |||
509 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q); | 520 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q); |
510 | 521 | ||
511 | disk = nullb->disk = alloc_disk_node(1, home_node); | 522 | disk = nullb->disk = alloc_disk_node(1, home_node); |
512 | if (!disk) | 523 | if (!disk) { |
524 | rv = -ENOMEM; | ||
513 | goto out_cleanup_blk_queue; | 525 | goto out_cleanup_blk_queue; |
526 | } | ||
514 | 527 | ||
515 | mutex_lock(&lock); | 528 | mutex_lock(&lock); |
516 | list_add_tail(&nullb->list, &nullb_list); | 529 | list_add_tail(&nullb->list, &nullb_list); |
@@ -544,7 +557,7 @@ out_cleanup_queues: | |||
544 | out_free_nullb: | 557 | out_free_nullb: |
545 | kfree(nullb); | 558 | kfree(nullb); |
546 | out: | 559 | out: |
547 | return -ENOMEM; | 560 | return rv; |
548 | } | 561 | } |
549 | 562 | ||
550 | static int __init null_init(void) | 563 | static int __init null_init(void) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 623c84145b79..4b97baf8afa3 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -5087,9 +5087,11 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
5087 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); | 5087 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); |
5088 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); | 5088 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); |
5089 | 5089 | ||
5090 | rbd_dev->rq_wq = alloc_workqueue(rbd_dev->disk->disk_name, 0, 0); | 5090 | rbd_dev->rq_wq = alloc_workqueue("%s", 0, 0, rbd_dev->disk->disk_name); |
5091 | if (!rbd_dev->rq_wq) | 5091 | if (!rbd_dev->rq_wq) { |
5092 | ret = -ENOMEM; | ||
5092 | goto err_out_mapping; | 5093 | goto err_out_mapping; |
5094 | } | ||
5093 | 5095 | ||
5094 | ret = rbd_bus_add_dev(rbd_dev); | 5096 | ret = rbd_bus_add_dev(rbd_dev); |
5095 | if (ret) | 5097 | if (ret) |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index ab3ea62e5dfc..c4328d9d9981 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -1203,7 +1203,6 @@ static struct platform_driver ace_platform_driver = { | |||
1203 | .probe = ace_probe, | 1203 | .probe = ace_probe, |
1204 | .remove = ace_remove, | 1204 | .remove = ace_remove, |
1205 | .driver = { | 1205 | .driver = { |
1206 | .owner = THIS_MODULE, | ||
1207 | .name = "xsysace", | 1206 | .name = "xsysace", |
1208 | .of_match_table = ace_of_match, | 1207 | .of_match_table = ace_of_match, |
1209 | }, | 1208 | }, |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index dfa4024c448a..d00831c3d731 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -378,7 +378,6 @@ static int zram_decompress_page(struct zram *zram, char *mem, u32 index) | |||
378 | /* Should NEVER happen. Return bio error if it does. */ | 378 | /* Should NEVER happen. Return bio error if it does. */ |
379 | if (unlikely(ret)) { | 379 | if (unlikely(ret)) { |
380 | pr_err("Decompression failed! err=%d, page=%u\n", ret, index); | 380 | pr_err("Decompression failed! err=%d, page=%u\n", ret, index); |
381 | atomic64_inc(&zram->stats.failed_reads); | ||
382 | return ret; | 381 | return ret; |
383 | } | 382 | } |
384 | 383 | ||
@@ -547,8 +546,6 @@ out: | |||
547 | zcomp_strm_release(zram->comp, zstrm); | 546 | zcomp_strm_release(zram->comp, zstrm); |
548 | if (is_partial_io(bvec)) | 547 | if (is_partial_io(bvec)) |
549 | kfree(uncmem); | 548 | kfree(uncmem); |
550 | if (ret) | ||
551 | atomic64_inc(&zram->stats.failed_writes); | ||
552 | return ret; | 549 | return ret; |
553 | } | 550 | } |
554 | 551 | ||
@@ -566,6 +563,13 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, | |||
566 | ret = zram_bvec_write(zram, bvec, index, offset); | 563 | ret = zram_bvec_write(zram, bvec, index, offset); |
567 | } | 564 | } |
568 | 565 | ||
566 | if (unlikely(ret)) { | ||
567 | if (rw == READ) | ||
568 | atomic64_inc(&zram->stats.failed_reads); | ||
569 | else | ||
570 | atomic64_inc(&zram->stats.failed_writes); | ||
571 | } | ||
572 | |||
569 | return ret; | 573 | return ret; |
570 | } | 574 | } |
571 | 575 | ||
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index 5b0afde729cd..e0f725c87cc6 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h | |||
@@ -84,7 +84,7 @@ struct zram_stats { | |||
84 | atomic64_t compr_data_size; /* compressed size of pages stored */ | 84 | atomic64_t compr_data_size; /* compressed size of pages stored */ |
85 | atomic64_t num_reads; /* failed + successful */ | 85 | atomic64_t num_reads; /* failed + successful */ |
86 | atomic64_t num_writes; /* --do-- */ | 86 | atomic64_t num_writes; /* --do-- */ |
87 | atomic64_t failed_reads; /* should NEVER! happen */ | 87 | atomic64_t failed_reads; /* can happen when memory is too low */ |
88 | atomic64_t failed_writes; /* can happen when memory is too low */ | 88 | atomic64_t failed_writes; /* can happen when memory is too low */ |
89 | atomic64_t invalid_io; /* non-page-aligned I/O requests */ | 89 | atomic64_t invalid_io; /* non-page-aligned I/O requests */ |
90 | atomic64_t notify_free; /* no. of swap slot free notifications */ | 90 | atomic64_t notify_free; /* no. of swap slot free notifications */ |
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c index 3266f8ff9311..a60f26400705 100644 --- a/drivers/bus/arm-ccn.c +++ b/drivers/bus/arm-ccn.c | |||
@@ -586,6 +586,30 @@ static int arm_ccn_pmu_type_eq(u32 a, u32 b) | |||
586 | return 0; | 586 | return 0; |
587 | } | 587 | } |
588 | 588 | ||
589 | static void arm_ccn_pmu_event_destroy(struct perf_event *event) | ||
590 | { | ||
591 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
592 | struct hw_perf_event *hw = &event->hw; | ||
593 | |||
594 | if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) { | ||
595 | clear_bit(CCN_IDX_PMU_CYCLE_COUNTER, ccn->dt.pmu_counters_mask); | ||
596 | } else { | ||
597 | struct arm_ccn_component *source = | ||
598 | ccn->dt.pmu_counters[hw->idx].source; | ||
599 | |||
600 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP && | ||
601 | CCN_CONFIG_EVENT(event->attr.config) == | ||
602 | CCN_EVENT_WATCHPOINT) | ||
603 | clear_bit(hw->config_base, source->xp.dt_cmp_mask); | ||
604 | else | ||
605 | clear_bit(hw->config_base, source->pmu_events_mask); | ||
606 | clear_bit(hw->idx, ccn->dt.pmu_counters_mask); | ||
607 | } | ||
608 | |||
609 | ccn->dt.pmu_counters[hw->idx].source = NULL; | ||
610 | ccn->dt.pmu_counters[hw->idx].event = NULL; | ||
611 | } | ||
612 | |||
589 | static int arm_ccn_pmu_event_init(struct perf_event *event) | 613 | static int arm_ccn_pmu_event_init(struct perf_event *event) |
590 | { | 614 | { |
591 | struct arm_ccn *ccn; | 615 | struct arm_ccn *ccn; |
@@ -599,6 +623,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
599 | return -ENOENT; | 623 | return -ENOENT; |
600 | 624 | ||
601 | ccn = pmu_to_arm_ccn(event->pmu); | 625 | ccn = pmu_to_arm_ccn(event->pmu); |
626 | event->destroy = arm_ccn_pmu_event_destroy; | ||
602 | 627 | ||
603 | if (hw->sample_period) { | 628 | if (hw->sample_period) { |
604 | dev_warn(ccn->dev, "Sampling not supported!\n"); | 629 | dev_warn(ccn->dev, "Sampling not supported!\n"); |
@@ -662,7 +687,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
662 | } | 687 | } |
663 | if (e->num_vcs && vc >= e->num_vcs) { | 688 | if (e->num_vcs && vc >= e->num_vcs) { |
664 | dev_warn(ccn->dev, "Invalid vc %d for node/XP %d!\n", | 689 | dev_warn(ccn->dev, "Invalid vc %d for node/XP %d!\n", |
665 | port, node_xp); | 690 | vc, node_xp); |
666 | return -EINVAL; | 691 | return -EINVAL; |
667 | } | 692 | } |
668 | valid = 1; | 693 | valid = 1; |
@@ -731,30 +756,6 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
731 | return 0; | 756 | return 0; |
732 | } | 757 | } |
733 | 758 | ||
734 | static void arm_ccn_pmu_event_free(struct perf_event *event) | ||
735 | { | ||
736 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
737 | struct hw_perf_event *hw = &event->hw; | ||
738 | |||
739 | if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) { | ||
740 | clear_bit(CCN_IDX_PMU_CYCLE_COUNTER, ccn->dt.pmu_counters_mask); | ||
741 | } else { | ||
742 | struct arm_ccn_component *source = | ||
743 | ccn->dt.pmu_counters[hw->idx].source; | ||
744 | |||
745 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP && | ||
746 | CCN_CONFIG_EVENT(event->attr.config) == | ||
747 | CCN_EVENT_WATCHPOINT) | ||
748 | clear_bit(hw->config_base, source->xp.dt_cmp_mask); | ||
749 | else | ||
750 | clear_bit(hw->config_base, source->pmu_events_mask); | ||
751 | clear_bit(hw->idx, ccn->dt.pmu_counters_mask); | ||
752 | } | ||
753 | |||
754 | ccn->dt.pmu_counters[hw->idx].source = NULL; | ||
755 | ccn->dt.pmu_counters[hw->idx].event = NULL; | ||
756 | } | ||
757 | |||
758 | static u64 arm_ccn_pmu_read_counter(struct arm_ccn *ccn, int idx) | 759 | static u64 arm_ccn_pmu_read_counter(struct arm_ccn *ccn, int idx) |
759 | { | 760 | { |
760 | u64 res; | 761 | u64 res; |
@@ -1027,8 +1028,6 @@ static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) | |||
1027 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) | 1028 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) |
1028 | { | 1029 | { |
1029 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); | 1030 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); |
1030 | |||
1031 | arm_ccn_pmu_event_free(event); | ||
1032 | } | 1031 | } |
1033 | 1032 | ||
1034 | static void arm_ccn_pmu_event_read(struct perf_event *event) | 1033 | static void arm_ccn_pmu_event_read(struct perf_event *event) |
diff --git a/drivers/bus/omap_l3_noc.h b/drivers/bus/omap_l3_noc.h index 551e01061434..95254585db86 100644 --- a/drivers/bus/omap_l3_noc.h +++ b/drivers/bus/omap_l3_noc.h | |||
@@ -188,31 +188,31 @@ static struct l3_flagmux_data omap_l3_flagmux_clk3 = { | |||
188 | }; | 188 | }; |
189 | 189 | ||
190 | static struct l3_masters_data omap_l3_masters[] = { | 190 | static struct l3_masters_data omap_l3_masters[] = { |
191 | { 0x0 , "MPU"}, | 191 | { 0x00, "MPU"}, |
192 | { 0x10, "CS_ADP"}, | 192 | { 0x04, "CS_ADP"}, |
193 | { 0x14, "xxx"}, | 193 | { 0x05, "xxx"}, |
194 | { 0x20, "DSP"}, | 194 | { 0x08, "DSP"}, |
195 | { 0x30, "IVAHD"}, | 195 | { 0x0C, "IVAHD"}, |
196 | { 0x40, "ISS"}, | 196 | { 0x10, "ISS"}, |
197 | { 0x44, "DucatiM3"}, | 197 | { 0x11, "DucatiM3"}, |
198 | { 0x48, "FaceDetect"}, | 198 | { 0x12, "FaceDetect"}, |
199 | { 0x50, "SDMA_Rd"}, | 199 | { 0x14, "SDMA_Rd"}, |
200 | { 0x54, "SDMA_Wr"}, | 200 | { 0x15, "SDMA_Wr"}, |
201 | { 0x58, "xxx"}, | 201 | { 0x16, "xxx"}, |
202 | { 0x5C, "xxx"}, | 202 | { 0x17, "xxx"}, |
203 | { 0x60, "SGX"}, | 203 | { 0x18, "SGX"}, |
204 | { 0x70, "DSS"}, | 204 | { 0x1C, "DSS"}, |
205 | { 0x80, "C2C"}, | 205 | { 0x20, "C2C"}, |
206 | { 0x88, "xxx"}, | 206 | { 0x22, "xxx"}, |
207 | { 0x8C, "xxx"}, | 207 | { 0x23, "xxx"}, |
208 | { 0x90, "HSI"}, | 208 | { 0x24, "HSI"}, |
209 | { 0xA0, "MMC1"}, | 209 | { 0x28, "MMC1"}, |
210 | { 0xA4, "MMC2"}, | 210 | { 0x29, "MMC2"}, |
211 | { 0xA8, "MMC6"}, | 211 | { 0x2A, "MMC6"}, |
212 | { 0xB0, "UNIPRO1"}, | 212 | { 0x2C, "UNIPRO1"}, |
213 | { 0xC0, "USBHOSTHS"}, | 213 | { 0x30, "USBHOSTHS"}, |
214 | { 0xC4, "USBOTGHS"}, | 214 | { 0x31, "USBOTGHS"}, |
215 | { 0xC8, "USBHOSTFS"} | 215 | { 0x32, "USBHOSTFS"} |
216 | }; | 216 | }; |
217 | 217 | ||
218 | static struct l3_flagmux_data *omap_l3_flagmux[] = { | 218 | static struct l3_flagmux_data *omap_l3_flagmux[] = { |
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 2e3139eda93b..132c9ccfdc62 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -36,6 +36,7 @@ struct virtrng_info { | |||
36 | int index; | 36 | int index; |
37 | bool busy; | 37 | bool busy; |
38 | bool hwrng_register_done; | 38 | bool hwrng_register_done; |
39 | bool hwrng_removed; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | 42 | ||
@@ -68,6 +69,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) | |||
68 | int ret; | 69 | int ret; |
69 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; | 70 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; |
70 | 71 | ||
72 | if (vi->hwrng_removed) | ||
73 | return -ENODEV; | ||
74 | |||
71 | if (!vi->busy) { | 75 | if (!vi->busy) { |
72 | vi->busy = true; | 76 | vi->busy = true; |
73 | init_completion(&vi->have_data); | 77 | init_completion(&vi->have_data); |
@@ -137,6 +141,9 @@ static void remove_common(struct virtio_device *vdev) | |||
137 | { | 141 | { |
138 | struct virtrng_info *vi = vdev->priv; | 142 | struct virtrng_info *vi = vdev->priv; |
139 | 143 | ||
144 | vi->hwrng_removed = true; | ||
145 | vi->data_avail = 0; | ||
146 | complete(&vi->have_data); | ||
140 | vdev->config->reset(vdev); | 147 | vdev->config->reset(vdev); |
141 | vi->busy = false; | 148 | vi->busy = false; |
142 | if (vi->hwrng_register_done) | 149 | if (vi->hwrng_register_done) |
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c index 0300c46ee247..32f7c1b36204 100644 --- a/drivers/clk/at91/clk-slow.c +++ b/drivers/clk/at91/clk-slow.c | |||
@@ -447,7 +447,7 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np, | |||
447 | int i; | 447 | int i; |
448 | 448 | ||
449 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); | 449 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); |
450 | if (num_parents <= 0 || num_parents > 1) | 450 | if (num_parents != 2) |
451 | return; | 451 | return; |
452 | 452 | ||
453 | for (i = 0; i < num_parents; ++i) { | 453 | for (i = 0; i < num_parents; ++i) { |
diff --git a/drivers/clk/clk-efm32gg.c b/drivers/clk/clk-efm32gg.c index bac2ddf49d02..73a8d0ff530c 100644 --- a/drivers/clk/clk-efm32gg.c +++ b/drivers/clk/clk-efm32gg.c | |||
@@ -22,7 +22,7 @@ static struct clk_onecell_data clk_data = { | |||
22 | .clk_num = ARRAY_SIZE(clk), | 22 | .clk_num = ARRAY_SIZE(clk), |
23 | }; | 23 | }; |
24 | 24 | ||
25 | static int __init efm32gg_cmu_init(struct device_node *np) | 25 | static void __init efm32gg_cmu_init(struct device_node *np) |
26 | { | 26 | { |
27 | int i; | 27 | int i; |
28 | void __iomem *base; | 28 | void __iomem *base; |
@@ -33,7 +33,7 @@ static int __init efm32gg_cmu_init(struct device_node *np) | |||
33 | base = of_iomap(np, 0); | 33 | base = of_iomap(np, 0); |
34 | if (!base) { | 34 | if (!base) { |
35 | pr_warn("Failed to map address range for efm32gg,cmu node\n"); | 35 | pr_warn("Failed to map address range for efm32gg,cmu node\n"); |
36 | return -EADDRNOTAVAIL; | 36 | return; |
37 | } | 37 | } |
38 | 38 | ||
39 | clk[clk_HFXO] = clk_register_fixed_rate(NULL, "HFXO", NULL, | 39 | clk[clk_HFXO] = clk_register_fixed_rate(NULL, "HFXO", NULL, |
@@ -76,6 +76,6 @@ static int __init efm32gg_cmu_init(struct device_node *np) | |||
76 | clk[clk_HFPERCLKDAC0] = clk_register_gate(NULL, "HFPERCLK.DAC0", | 76 | clk[clk_HFPERCLKDAC0] = clk_register_gate(NULL, "HFPERCLK.DAC0", |
77 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); | 77 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); |
78 | 78 | ||
79 | return of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 79 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
80 | } | 80 | } |
81 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); | 81 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index b76fa69b44cb..bacc06ff939b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1467,6 +1467,7 @@ static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long even | |||
1467 | static void clk_change_rate(struct clk *clk) | 1467 | static void clk_change_rate(struct clk *clk) |
1468 | { | 1468 | { |
1469 | struct clk *child; | 1469 | struct clk *child; |
1470 | struct hlist_node *tmp; | ||
1470 | unsigned long old_rate; | 1471 | unsigned long old_rate; |
1471 | unsigned long best_parent_rate = 0; | 1472 | unsigned long best_parent_rate = 0; |
1472 | bool skip_set_rate = false; | 1473 | bool skip_set_rate = false; |
@@ -1502,7 +1503,11 @@ static void clk_change_rate(struct clk *clk) | |||
1502 | if (clk->notifier_count && old_rate != clk->rate) | 1503 | if (clk->notifier_count && old_rate != clk->rate) |
1503 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); | 1504 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); |
1504 | 1505 | ||
1505 | hlist_for_each_entry(child, &clk->children, child_node) { | 1506 | /* |
1507 | * Use safe iteration, as change_rate can actually swap parents | ||
1508 | * for certain clock types. | ||
1509 | */ | ||
1510 | hlist_for_each_entry_safe(child, tmp, &clk->children, child_node) { | ||
1506 | /* Skip children who will be reparented to another clock */ | 1511 | /* Skip children who will be reparented to another clock */ |
1507 | if (child->new_parent && child->new_parent != clk) | 1512 | if (child->new_parent && child->new_parent != clk) |
1508 | continue; | 1513 | continue; |
diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c index 4032e510d9aa..3b83b7dd78c7 100644 --- a/drivers/clk/qcom/gcc-ipq806x.c +++ b/drivers/clk/qcom/gcc-ipq806x.c | |||
@@ -1095,7 +1095,7 @@ static struct clk_branch prng_clk = { | |||
1095 | }; | 1095 | }; |
1096 | 1096 | ||
1097 | static const struct freq_tbl clk_tbl_sdc[] = { | 1097 | static const struct freq_tbl clk_tbl_sdc[] = { |
1098 | { 144000, P_PXO, 5, 18,625 }, | 1098 | { 200000, P_PXO, 2, 2, 125 }, |
1099 | { 400000, P_PLL8, 4, 1, 240 }, | 1099 | { 400000, P_PLL8, 4, 1, 240 }, |
1100 | { 16000000, P_PLL8, 4, 1, 6 }, | 1100 | { 16000000, P_PLL8, 4, 1, 6 }, |
1101 | { 17070000, P_PLL8, 1, 2, 45 }, | 1101 | { 17070000, P_PLL8, 1, 2, 45 }, |
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index 0d8c6c59a75e..b22a2d2f21e9 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c | |||
@@ -545,7 +545,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { | |||
545 | GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 0, GFLAGS), | 545 | GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 0, GFLAGS), |
546 | GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 1, GFLAGS), | 546 | GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 1, GFLAGS), |
547 | GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 2, GFLAGS), | 547 | GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 2, GFLAGS), |
548 | GATE(PCLK_I2C1, "pclk_i2c1", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 3, GFLAGS), | 548 | GATE(PCLK_I2C2, "pclk_i2c2", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 3, GFLAGS), |
549 | GATE(0, "pclk_ddrupctl0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 14, GFLAGS), | 549 | GATE(0, "pclk_ddrupctl0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 14, GFLAGS), |
550 | GATE(0, "pclk_publ0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 15, GFLAGS), | 550 | GATE(0, "pclk_publ0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 15, GFLAGS), |
551 | GATE(0, "pclk_ddrupctl1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 0, GFLAGS), | 551 | GATE(0, "pclk_ddrupctl1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 0, GFLAGS), |
@@ -603,7 +603,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { | |||
603 | GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 15, GFLAGS), | 603 | GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 15, GFLAGS), |
604 | GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 11, GFLAGS), | 604 | GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 11, GFLAGS), |
605 | GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 12, GFLAGS), | 605 | GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 12, GFLAGS), |
606 | GATE(PCLK_I2C2, "pclk_i2c2", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 13, GFLAGS), | 606 | GATE(PCLK_I2C1, "pclk_i2c1", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 13, GFLAGS), |
607 | GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 14, GFLAGS), | 607 | GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 14, GFLAGS), |
608 | GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 1, GFLAGS), | 608 | GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 1, GFLAGS), |
609 | GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 2, GFLAGS), | 609 | GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 2, GFLAGS), |
diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index 4a65b410e4d5..af29359677da 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c | |||
@@ -139,9 +139,13 @@ static long atl_clk_round_rate(struct clk_hw *hw, unsigned long rate, | |||
139 | static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate, | 139 | static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate, |
140 | unsigned long parent_rate) | 140 | unsigned long parent_rate) |
141 | { | 141 | { |
142 | struct dra7_atl_desc *cdesc = to_atl_desc(hw); | 142 | struct dra7_atl_desc *cdesc; |
143 | u32 divider; | 143 | u32 divider; |
144 | 144 | ||
145 | if (!hw || !rate) | ||
146 | return -EINVAL; | ||
147 | |||
148 | cdesc = to_atl_desc(hw); | ||
145 | divider = ((parent_rate + rate / 2) / rate) - 1; | 149 | divider = ((parent_rate + rate / 2) / rate) - 1; |
146 | if (divider > DRA7_ATL_DIVIDER_MASK) | 150 | if (divider > DRA7_ATL_DIVIDER_MASK) |
147 | divider = DRA7_ATL_DIVIDER_MASK; | 151 | divider = DRA7_ATL_DIVIDER_MASK; |
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index e6aa10db7bba..a837f703be65 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c | |||
@@ -211,11 +211,16 @@ static long ti_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, | |||
211 | static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, | 211 | static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, |
212 | unsigned long parent_rate) | 212 | unsigned long parent_rate) |
213 | { | 213 | { |
214 | struct clk_divider *divider = to_clk_divider(hw); | 214 | struct clk_divider *divider; |
215 | unsigned int div, value; | 215 | unsigned int div, value; |
216 | unsigned long flags = 0; | 216 | unsigned long flags = 0; |
217 | u32 val; | 217 | u32 val; |
218 | 218 | ||
219 | if (!hw || !rate) | ||
220 | return -EINVAL; | ||
221 | |||
222 | divider = to_clk_divider(hw); | ||
223 | |||
219 | div = DIV_ROUND_UP(parent_rate, rate); | 224 | div = DIV_ROUND_UP(parent_rate, rate); |
220 | value = _get_val(divider, div); | 225 | value = _get_val(divider, div); |
221 | 226 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d9fdeddcef96..6e93e7f98358 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1289,6 +1289,8 @@ err_get_freq: | |||
1289 | per_cpu(cpufreq_cpu_data, j) = NULL; | 1289 | per_cpu(cpufreq_cpu_data, j) = NULL; |
1290 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1290 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1291 | 1291 | ||
1292 | up_write(&policy->rwsem); | ||
1293 | |||
1292 | if (cpufreq_driver->exit) | 1294 | if (cpufreq_driver->exit) |
1293 | cpufreq_driver->exit(policy); | 1295 | cpufreq_driver->exit(policy); |
1294 | err_set_policy_cpu: | 1296 | err_set_policy_cpu: |
@@ -1656,6 +1658,8 @@ void cpufreq_suspend(void) | |||
1656 | if (!cpufreq_driver) | 1658 | if (!cpufreq_driver) |
1657 | return; | 1659 | return; |
1658 | 1660 | ||
1661 | cpufreq_suspended = true; | ||
1662 | |||
1659 | if (!has_target()) | 1663 | if (!has_target()) |
1660 | return; | 1664 | return; |
1661 | 1665 | ||
@@ -1670,8 +1674,6 @@ void cpufreq_suspend(void) | |||
1670 | pr_err("%s: Failed to suspend driver: %p\n", __func__, | 1674 | pr_err("%s: Failed to suspend driver: %p\n", __func__, |
1671 | policy); | 1675 | policy); |
1672 | } | 1676 | } |
1673 | |||
1674 | cpufreq_suspended = true; | ||
1675 | } | 1677 | } |
1676 | 1678 | ||
1677 | /** | 1679 | /** |
@@ -1687,13 +1689,13 @@ void cpufreq_resume(void) | |||
1687 | if (!cpufreq_driver) | 1689 | if (!cpufreq_driver) |
1688 | return; | 1690 | return; |
1689 | 1691 | ||
1692 | cpufreq_suspended = false; | ||
1693 | |||
1690 | if (!has_target()) | 1694 | if (!has_target()) |
1691 | return; | 1695 | return; |
1692 | 1696 | ||
1693 | pr_debug("%s: Resuming Governors\n", __func__); | 1697 | pr_debug("%s: Resuming Governors\n", __func__); |
1694 | 1698 | ||
1695 | cpufreq_suspended = false; | ||
1696 | |||
1697 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { | 1699 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { |
1698 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) | 1700 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) |
1699 | pr_err("%s: Failed to resume driver: %p\n", __func__, | 1701 | pr_err("%s: Failed to resume driver: %p\n", __func__, |
diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index f7a32d2326c6..773bcde893c0 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c | |||
@@ -60,7 +60,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, | |||
60 | goto out; | 60 | goto out; |
61 | } | 61 | } |
62 | 62 | ||
63 | freq_table = kcalloc(sizeof(*freq_table), (max_opps + 1), GFP_ATOMIC); | 63 | freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_ATOMIC); |
64 | if (!freq_table) { | 64 | if (!freq_table) { |
65 | ret = -ENOMEM; | 65 | ret = -ENOMEM; |
66 | goto out; | 66 | goto out; |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index c5eac949760d..0668b389c516 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -660,6 +660,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { | |||
660 | ICPU(0x3f, core_params), | 660 | ICPU(0x3f, core_params), |
661 | ICPU(0x45, core_params), | 661 | ICPU(0x45, core_params), |
662 | ICPU(0x46, core_params), | 662 | ICPU(0x46, core_params), |
663 | ICPU(0x4c, byt_params), | ||
663 | ICPU(0x4f, core_params), | 664 | ICPU(0x4f, core_params), |
664 | ICPU(0x56, core_params), | 665 | ICPU(0x56, core_params), |
665 | {} | 666 | {} |
@@ -688,7 +689,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum) | |||
688 | 689 | ||
689 | add_timer_on(&cpu->timer, cpunum); | 690 | add_timer_on(&cpu->timer, cpunum); |
690 | 691 | ||
691 | pr_info("Intel pstate controlling: cpu %d\n", cpunum); | 692 | pr_debug("Intel pstate controlling: cpu %d\n", cpunum); |
692 | 693 | ||
693 | return 0; | 694 | return 0; |
694 | } | 695 | } |
@@ -707,10 +708,6 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) | |||
707 | 708 | ||
708 | static int intel_pstate_set_policy(struct cpufreq_policy *policy) | 709 | static int intel_pstate_set_policy(struct cpufreq_policy *policy) |
709 | { | 710 | { |
710 | struct cpudata *cpu; | ||
711 | |||
712 | cpu = all_cpu_data[policy->cpu]; | ||
713 | |||
714 | if (!policy->cpuinfo.max_freq) | 711 | if (!policy->cpuinfo.max_freq) |
715 | return -ENODEV; | 712 | return -ENODEV; |
716 | 713 | ||
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index 9a68225a757e..3f9791f07b8e 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c | |||
@@ -501,7 +501,7 @@ static int check_mem_type(void __iomem *dmc_reg) | |||
501 | return val >> 8; | 501 | return val >> 8; |
502 | } | 502 | } |
503 | 503 | ||
504 | static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) | 504 | static int s5pv210_cpu_init(struct cpufreq_policy *policy) |
505 | { | 505 | { |
506 | unsigned long mem_type; | 506 | unsigned long mem_type; |
507 | int ret; | 507 | int ret; |
diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c index 344d79fa3407..ef94c3b81f18 100644 --- a/drivers/cpuidle/cpuidle-big_little.c +++ b/drivers/cpuidle/cpuidle-big_little.c | |||
@@ -138,25 +138,18 @@ static int bl_enter_powerdown(struct cpuidle_device *dev, | |||
138 | return idx; | 138 | return idx; |
139 | } | 139 | } |
140 | 140 | ||
141 | static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id) | 141 | static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int part_id) |
142 | { | 142 | { |
143 | struct cpuinfo_arm *cpu_info; | ||
144 | struct cpumask *cpumask; | 143 | struct cpumask *cpumask; |
145 | unsigned long cpuid; | ||
146 | int cpu; | 144 | int cpu; |
147 | 145 | ||
148 | cpumask = kzalloc(cpumask_size(), GFP_KERNEL); | 146 | cpumask = kzalloc(cpumask_size(), GFP_KERNEL); |
149 | if (!cpumask) | 147 | if (!cpumask) |
150 | return -ENOMEM; | 148 | return -ENOMEM; |
151 | 149 | ||
152 | for_each_possible_cpu(cpu) { | 150 | for_each_possible_cpu(cpu) |
153 | cpu_info = &per_cpu(cpu_data, cpu); | 151 | if (smp_cpuid_part(cpu) == part_id) |
154 | cpuid = is_smp() ? cpu_info->cpuid : read_cpuid_id(); | ||
155 | |||
156 | /* read cpu id part number */ | ||
157 | if ((cpuid & 0xFFF0) == cpu_id) | ||
158 | cpumask_set_cpu(cpu, cpumask); | 152 | cpumask_set_cpu(cpu, cpumask); |
159 | } | ||
160 | 153 | ||
161 | drv->cpumask = cpumask; | 154 | drv->cpumask = cpumask; |
162 | 155 | ||
diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c index 20dc848481e7..4d4e016d755b 100644 --- a/drivers/crypto/ccp/ccp-crypto-main.c +++ b/drivers/crypto/ccp/ccp-crypto-main.c | |||
@@ -367,6 +367,10 @@ static int ccp_crypto_init(void) | |||
367 | { | 367 | { |
368 | int ret; | 368 | int ret; |
369 | 369 | ||
370 | ret = ccp_present(); | ||
371 | if (ret) | ||
372 | return ret; | ||
373 | |||
370 | spin_lock_init(&req_queue_lock); | 374 | spin_lock_init(&req_queue_lock); |
371 | INIT_LIST_HEAD(&req_queue.cmds); | 375 | INIT_LIST_HEAD(&req_queue.cmds); |
372 | req_queue.backlog = &req_queue.cmds; | 376 | req_queue.backlog = &req_queue.cmds; |
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index a7d110652a74..c6e6171eb6d3 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c | |||
@@ -55,6 +55,20 @@ static inline void ccp_del_device(struct ccp_device *ccp) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * ccp_present - check if a CCP device is present | ||
59 | * | ||
60 | * Returns zero if a CCP device is present, -ENODEV otherwise. | ||
61 | */ | ||
62 | int ccp_present(void) | ||
63 | { | ||
64 | if (ccp_get_device()) | ||
65 | return 0; | ||
66 | |||
67 | return -ENODEV; | ||
68 | } | ||
69 | EXPORT_SYMBOL_GPL(ccp_present); | ||
70 | |||
71 | /** | ||
58 | * ccp_enqueue_cmd - queue an operation for processing by the CCP | 72 | * ccp_enqueue_cmd - queue an operation for processing by the CCP |
59 | * | 73 | * |
60 | * @cmd: ccp_cmd struct to be processed | 74 | * @cmd: ccp_cmd struct to be processed |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h index b707f292b377..65dd1ff93d3b 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h +++ b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h | |||
@@ -66,7 +66,7 @@ | |||
66 | #define ADF_DH895XCC_ETR_MAX_BANKS 32 | 66 | #define ADF_DH895XCC_ETR_MAX_BANKS 32 |
67 | #define ADF_DH895XCC_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28) | 67 | #define ADF_DH895XCC_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28) |
68 | #define ADF_DH895XCC_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30) | 68 | #define ADF_DH895XCC_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30) |
69 | #define ADF_DH895XCC_SMIA0_MASK 0xFFFF | 69 | #define ADF_DH895XCC_SMIA0_MASK 0xFFFFFFFF |
70 | #define ADF_DH895XCC_SMIA1_MASK 0x1 | 70 | #define ADF_DH895XCC_SMIA1_MASK 0x1 |
71 | /* Error detection and correction */ | 71 | /* Error detection and correction */ |
72 | #define ADF_DH895XCC_AE_CTX_ENABLES(i) (i * 0x1000 + 0x20818) | 72 | #define ADF_DH895XCC_AE_CTX_ENABLES(i) (i * 0x1000 + 0x20818) |
diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c index 4222cb2aa96a..7bb9d65d9a2c 100644 --- a/drivers/dma-buf/fence.c +++ b/drivers/dma-buf/fence.c | |||
@@ -29,7 +29,7 @@ | |||
29 | EXPORT_TRACEPOINT_SYMBOL(fence_annotate_wait_on); | 29 | EXPORT_TRACEPOINT_SYMBOL(fence_annotate_wait_on); |
30 | EXPORT_TRACEPOINT_SYMBOL(fence_emit); | 30 | EXPORT_TRACEPOINT_SYMBOL(fence_emit); |
31 | 31 | ||
32 | /** | 32 | /* |
33 | * fence context counter: each execution context should have its own | 33 | * fence context counter: each execution context should have its own |
34 | * fence context, this allows checking if fences belong to the same | 34 | * fence context, this allows checking if fences belong to the same |
35 | * context or not. One device can have multiple separate contexts, | 35 | * context or not. One device can have multiple separate contexts, |
diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c index 6a9d89c93b1f..ae2ab14e64b3 100644 --- a/drivers/dma/dma-jz4740.c +++ b/drivers/dma/dma-jz4740.c | |||
@@ -362,8 +362,9 @@ static void jz4740_dma_chan_irq(struct jz4740_dmaengine_chan *chan) | |||
362 | vchan_cyclic_callback(&chan->desc->vdesc); | 362 | vchan_cyclic_callback(&chan->desc->vdesc); |
363 | } else { | 363 | } else { |
364 | if (chan->next_sg == chan->desc->num_sgs) { | 364 | if (chan->next_sg == chan->desc->num_sgs) { |
365 | chan->desc = NULL; | 365 | list_del(&chan->desc->vdesc.node); |
366 | vchan_cookie_complete(&chan->desc->vdesc); | 366 | vchan_cookie_complete(&chan->desc->vdesc); |
367 | chan->desc = NULL; | ||
367 | } | 368 | } |
368 | } | 369 | } |
369 | } | 370 | } |
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index 4cf7d9a950d7..bbea8243f9e8 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c | |||
@@ -1017,6 +1017,11 @@ static int omap_dma_resume(struct omap_chan *c) | |||
1017 | return -EINVAL; | 1017 | return -EINVAL; |
1018 | 1018 | ||
1019 | if (c->paused) { | 1019 | if (c->paused) { |
1020 | mb(); | ||
1021 | |||
1022 | /* Restore channel link register */ | ||
1023 | omap_dma_chan_write(c, CLNK_CTRL, c->desc->clnk_ctrl); | ||
1024 | |||
1020 | omap_dma_start(c, c->desc); | 1025 | omap_dma_start(c, c->desc); |
1021 | c->paused = false; | 1026 | c->paused = false; |
1022 | } | 1027 | } |
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile index d8be608a9f3b..aef6a95adef5 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile | |||
@@ -7,4 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o | |||
7 | obj-$(CONFIG_UEFI_CPER) += cper.o | 7 | obj-$(CONFIG_UEFI_CPER) += cper.o |
8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o | 8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o |
9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o | 9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o |
10 | obj-$(CONFIG_EFI_STUB) += libstub/ | 10 | obj-$(CONFIG_EFI_ARM_STUB) += libstub/ |
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index a56bb3528755..c846a9608cbd 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c | |||
@@ -22,7 +22,7 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
22 | unsigned long map_size, unsigned long desc_size, | 22 | unsigned long map_size, unsigned long desc_size, |
23 | u32 desc_ver) | 23 | u32 desc_ver) |
24 | { | 24 | { |
25 | int node, prev; | 25 | int node, prev, num_rsv; |
26 | int status; | 26 | int status; |
27 | u32 fdt_val32; | 27 | u32 fdt_val32; |
28 | u64 fdt_val64; | 28 | u64 fdt_val64; |
@@ -73,6 +73,14 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
73 | prev = node; | 73 | prev = node; |
74 | } | 74 | } |
75 | 75 | ||
76 | /* | ||
77 | * Delete all memory reserve map entries. When booting via UEFI, | ||
78 | * kernel will use the UEFI memory map to find reserved regions. | ||
79 | */ | ||
80 | num_rsv = fdt_num_mem_rsv(fdt); | ||
81 | while (num_rsv-- > 0) | ||
82 | fdt_del_mem_rsv(fdt, num_rsv); | ||
83 | |||
76 | node = fdt_subnode_offset(fdt, 0, "chosen"); | 84 | node = fdt_subnode_offset(fdt, 0, "chosen"); |
77 | if (node < 0) { | 85 | if (node < 0) { |
78 | node = fdt_add_subnode(fdt, 0, "chosen"); | 86 | node = fdt_add_subnode(fdt, 0, "chosen"); |
diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index f0a43646a2f3..5abe943e3404 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c | |||
@@ -481,7 +481,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_remove); | |||
481 | */ | 481 | */ |
482 | static void efivar_entry_list_del_unlock(struct efivar_entry *entry) | 482 | static void efivar_entry_list_del_unlock(struct efivar_entry *entry) |
483 | { | 483 | { |
484 | WARN_ON(!spin_is_locked(&__efivars->lock)); | 484 | lockdep_assert_held(&__efivars->lock); |
485 | 485 | ||
486 | list_del(&entry->list); | 486 | list_del(&entry->list); |
487 | spin_unlock_irq(&__efivars->lock); | 487 | spin_unlock_irq(&__efivars->lock); |
@@ -507,7 +507,7 @@ int __efivar_entry_delete(struct efivar_entry *entry) | |||
507 | const struct efivar_operations *ops = __efivars->ops; | 507 | const struct efivar_operations *ops = __efivars->ops; |
508 | efi_status_t status; | 508 | efi_status_t status; |
509 | 509 | ||
510 | WARN_ON(!spin_is_locked(&__efivars->lock)); | 510 | lockdep_assert_held(&__efivars->lock); |
511 | 511 | ||
512 | status = ops->set_variable(entry->var.VariableName, | 512 | status = ops->set_variable(entry->var.VariableName, |
513 | &entry->var.VendorGuid, | 513 | &entry->var.VendorGuid, |
@@ -667,7 +667,7 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, | |||
667 | int strsize1, strsize2; | 667 | int strsize1, strsize2; |
668 | bool found = false; | 668 | bool found = false; |
669 | 669 | ||
670 | WARN_ON(!spin_is_locked(&__efivars->lock)); | 670 | lockdep_assert_held(&__efivars->lock); |
671 | 671 | ||
672 | list_for_each_entry_safe(entry, n, head, list) { | 672 | list_for_each_entry_safe(entry, n, head, list) { |
673 | strsize1 = ucs2_strsize(name, 1024); | 673 | strsize1 = ucs2_strsize(name, 1024); |
@@ -739,7 +739,7 @@ int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, | |||
739 | const struct efivar_operations *ops = __efivars->ops; | 739 | const struct efivar_operations *ops = __efivars->ops; |
740 | efi_status_t status; | 740 | efi_status_t status; |
741 | 741 | ||
742 | WARN_ON(!spin_is_locked(&__efivars->lock)); | 742 | lockdep_assert_held(&__efivars->lock); |
743 | 743 | ||
744 | status = ops->get_variable(entry->var.VariableName, | 744 | status = ops->get_variable(entry->var.VariableName, |
745 | &entry->var.VendorGuid, | 745 | &entry->var.VendorGuid, |
diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c index 41b2f40578d5..954b9f6b0ef8 100644 --- a/drivers/gpio/devres.c +++ b/drivers/gpio/devres.c | |||
@@ -90,7 +90,7 @@ struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, | |||
90 | struct gpio_desc **dr; | 90 | struct gpio_desc **dr; |
91 | struct gpio_desc *desc; | 91 | struct gpio_desc *desc; |
92 | 92 | ||
93 | dr = devres_alloc(devm_gpiod_release, sizeof(struct gpiod_desc *), | 93 | dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *), |
94 | GFP_KERNEL); | 94 | GFP_KERNEL); |
95 | if (!dr) | 95 | if (!dr) |
96 | return ERR_PTR(-ENOMEM); | 96 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/gpio/gpio-bt8xx.c b/drivers/gpio/gpio-bt8xx.c index 6557147d9331..7e4c43c18960 100644 --- a/drivers/gpio/gpio-bt8xx.c +++ b/drivers/gpio/gpio-bt8xx.c | |||
@@ -241,9 +241,6 @@ static void bt8xxgpio_remove(struct pci_dev *pdev) | |||
241 | bgwrite(~0x0, BT848_INT_STAT); | 241 | bgwrite(~0x0, BT848_INT_STAT); |
242 | bgwrite(0x0, BT848_GPIO_OUT_EN); | 242 | bgwrite(0x0, BT848_GPIO_OUT_EN); |
243 | 243 | ||
244 | iounmap(bg->mmio); | ||
245 | release_mem_region(pci_resource_start(pdev, 0), | ||
246 | pci_resource_len(pdev, 0)); | ||
247 | pci_disable_device(pdev); | 244 | pci_disable_device(pdev); |
248 | } | 245 | } |
249 | 246 | ||
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c index ff9eb911b5e4..fa945ec9ccff 100644 --- a/drivers/gpio/gpio-lynxpoint.c +++ b/drivers/gpio/gpio-lynxpoint.c | |||
@@ -407,9 +407,27 @@ static int lp_gpio_runtime_resume(struct device *dev) | |||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | static int lp_gpio_resume(struct device *dev) | ||
411 | { | ||
412 | struct platform_device *pdev = to_platform_device(dev); | ||
413 | struct lp_gpio *lg = platform_get_drvdata(pdev); | ||
414 | unsigned long reg; | ||
415 | int i; | ||
416 | |||
417 | /* on some hardware suspend clears input sensing, re-enable it here */ | ||
418 | for (i = 0; i < lg->chip.ngpio; i++) { | ||
419 | if (gpiochip_is_requested(&lg->chip, i) != NULL) { | ||
420 | reg = lp_gpio_reg(&lg->chip, i, LP_CONFIG2); | ||
421 | outl(inl(reg) & ~GPINDIS_BIT, reg); | ||
422 | } | ||
423 | } | ||
424 | return 0; | ||
425 | } | ||
426 | |||
410 | static const struct dev_pm_ops lp_gpio_pm_ops = { | 427 | static const struct dev_pm_ops lp_gpio_pm_ops = { |
411 | .runtime_suspend = lp_gpio_runtime_suspend, | 428 | .runtime_suspend = lp_gpio_runtime_suspend, |
412 | .runtime_resume = lp_gpio_runtime_resume, | 429 | .runtime_resume = lp_gpio_runtime_resume, |
430 | .resume = lp_gpio_resume, | ||
413 | }; | 431 | }; |
414 | 432 | ||
415 | static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = { | 433 | static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = { |
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index c3145f91fda3..31ad5df5dbc9 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c | |||
@@ -95,6 +95,9 @@ struct zynq_gpio { | |||
95 | struct clk *clk; | 95 | struct clk *clk; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | static struct irq_chip zynq_gpio_level_irqchip; | ||
99 | static struct irq_chip zynq_gpio_edge_irqchip; | ||
100 | |||
98 | /** | 101 | /** |
99 | * zynq_gpio_get_bank_pin - Get the bank number and pin number within that bank | 102 | * zynq_gpio_get_bank_pin - Get the bank number and pin number within that bank |
100 | * for a given pin in the GPIO device | 103 | * for a given pin in the GPIO device |
@@ -410,6 +413,15 @@ static int zynq_gpio_set_irq_type(struct irq_data *irq_data, unsigned int type) | |||
410 | gpio->base_addr + ZYNQ_GPIO_INTPOL_OFFSET(bank_num)); | 413 | gpio->base_addr + ZYNQ_GPIO_INTPOL_OFFSET(bank_num)); |
411 | writel_relaxed(int_any, | 414 | writel_relaxed(int_any, |
412 | gpio->base_addr + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); | 415 | gpio->base_addr + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); |
416 | |||
417 | if (type & IRQ_TYPE_LEVEL_MASK) { | ||
418 | __irq_set_chip_handler_name_locked(irq_data->irq, | ||
419 | &zynq_gpio_level_irqchip, handle_fasteoi_irq, NULL); | ||
420 | } else { | ||
421 | __irq_set_chip_handler_name_locked(irq_data->irq, | ||
422 | &zynq_gpio_edge_irqchip, handle_level_irq, NULL); | ||
423 | } | ||
424 | |||
413 | return 0; | 425 | return 0; |
414 | } | 426 | } |
415 | 427 | ||
@@ -424,9 +436,21 @@ static int zynq_gpio_set_wake(struct irq_data *data, unsigned int on) | |||
424 | } | 436 | } |
425 | 437 | ||
426 | /* irq chip descriptor */ | 438 | /* irq chip descriptor */ |
427 | static struct irq_chip zynq_gpio_irqchip = { | 439 | static struct irq_chip zynq_gpio_level_irqchip = { |
428 | .name = DRIVER_NAME, | 440 | .name = DRIVER_NAME, |
429 | .irq_enable = zynq_gpio_irq_enable, | 441 | .irq_enable = zynq_gpio_irq_enable, |
442 | .irq_eoi = zynq_gpio_irq_ack, | ||
443 | .irq_mask = zynq_gpio_irq_mask, | ||
444 | .irq_unmask = zynq_gpio_irq_unmask, | ||
445 | .irq_set_type = zynq_gpio_set_irq_type, | ||
446 | .irq_set_wake = zynq_gpio_set_wake, | ||
447 | .flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED, | ||
448 | }; | ||
449 | |||
450 | static struct irq_chip zynq_gpio_edge_irqchip = { | ||
451 | .name = DRIVER_NAME, | ||
452 | .irq_enable = zynq_gpio_irq_enable, | ||
453 | .irq_ack = zynq_gpio_irq_ack, | ||
430 | .irq_mask = zynq_gpio_irq_mask, | 454 | .irq_mask = zynq_gpio_irq_mask, |
431 | .irq_unmask = zynq_gpio_irq_unmask, | 455 | .irq_unmask = zynq_gpio_irq_unmask, |
432 | .irq_set_type = zynq_gpio_set_irq_type, | 456 | .irq_set_type = zynq_gpio_set_irq_type, |
@@ -469,10 +493,6 @@ static void zynq_gpio_irqhandler(unsigned int irq, struct irq_desc *desc) | |||
469 | offset); | 493 | offset); |
470 | generic_handle_irq(gpio_irq); | 494 | generic_handle_irq(gpio_irq); |
471 | } | 495 | } |
472 | |||
473 | /* clear IRQ in HW */ | ||
474 | writel_relaxed(int_sts, gpio->base_addr + | ||
475 | ZYNQ_GPIO_INTSTS_OFFSET(bank_num)); | ||
476 | } | 496 | } |
477 | } | 497 | } |
478 | 498 | ||
@@ -610,14 +630,14 @@ static int zynq_gpio_probe(struct platform_device *pdev) | |||
610 | writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + | 630 | writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + |
611 | ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); | 631 | ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); |
612 | 632 | ||
613 | ret = gpiochip_irqchip_add(chip, &zynq_gpio_irqchip, 0, | 633 | ret = gpiochip_irqchip_add(chip, &zynq_gpio_edge_irqchip, 0, |
614 | handle_simple_irq, IRQ_TYPE_NONE); | 634 | handle_level_irq, IRQ_TYPE_NONE); |
615 | if (ret) { | 635 | if (ret) { |
616 | dev_err(&pdev->dev, "Failed to add irq chip\n"); | 636 | dev_err(&pdev->dev, "Failed to add irq chip\n"); |
617 | goto err_rm_gpiochip; | 637 | goto err_rm_gpiochip; |
618 | } | 638 | } |
619 | 639 | ||
620 | gpiochip_set_chained_irqchip(chip, &zynq_gpio_irqchip, irq, | 640 | gpiochip_set_chained_irqchip(chip, &zynq_gpio_edge_irqchip, irq, |
621 | zynq_gpio_irqhandler); | 641 | zynq_gpio_irqhandler); |
622 | 642 | ||
623 | pm_runtime_set_active(&pdev->dev); | 643 | pm_runtime_set_active(&pdev->dev); |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index d62eaaa75397..687476fb39e3 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -377,8 +377,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
377 | struct gpio_chip *chip = achip->chip; | 377 | struct gpio_chip *chip = achip->chip; |
378 | struct acpi_resource_gpio *agpio; | 378 | struct acpi_resource_gpio *agpio; |
379 | struct acpi_resource *ares; | 379 | struct acpi_resource *ares; |
380 | int pin_index = (int)address; | ||
380 | acpi_status status; | 381 | acpi_status status; |
381 | bool pull_up; | 382 | bool pull_up; |
383 | int length; | ||
382 | int i; | 384 | int i; |
383 | 385 | ||
384 | status = acpi_buffer_to_resource(achip->conn_info.connection, | 386 | status = acpi_buffer_to_resource(achip->conn_info.connection, |
@@ -400,7 +402,8 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
400 | return AE_BAD_PARAMETER; | 402 | return AE_BAD_PARAMETER; |
401 | } | 403 | } |
402 | 404 | ||
403 | for (i = 0; i < agpio->pin_table_length; i++) { | 405 | length = min(agpio->pin_table_length, (u16)(pin_index + bits)); |
406 | for (i = pin_index; i < length; ++i) { | ||
404 | unsigned pin = agpio->pin_table[i]; | 407 | unsigned pin = agpio->pin_table[i]; |
405 | struct acpi_gpio_connection *conn; | 408 | struct acpi_gpio_connection *conn; |
406 | struct gpio_desc *desc; | 409 | struct gpio_desc *desc; |
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 7cfdc2278905..604dbe60bdee 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -307,7 +307,5 @@ void of_gpiochip_add(struct gpio_chip *chip) | |||
307 | void of_gpiochip_remove(struct gpio_chip *chip) | 307 | void of_gpiochip_remove(struct gpio_chip *chip) |
308 | { | 308 | { |
309 | gpiochip_remove_pin_ranges(chip); | 309 | gpiochip_remove_pin_ranges(chip); |
310 | 310 | of_node_put(chip->of_node); | |
311 | if (chip->of_node) | ||
312 | of_node_put(chip->of_node); | ||
313 | } | 311 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 15cc0bb65dda..c68d037de656 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -413,12 +413,12 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, | |||
413 | return; | 413 | return; |
414 | } | 414 | } |
415 | 415 | ||
416 | irq_set_chained_handler(parent_irq, parent_handler); | ||
417 | /* | 416 | /* |
418 | * The parent irqchip is already using the chip_data for this | 417 | * The parent irqchip is already using the chip_data for this |
419 | * irqchip, so our callbacks simply use the handler_data. | 418 | * irqchip, so our callbacks simply use the handler_data. |
420 | */ | 419 | */ |
421 | irq_set_handler_data(parent_irq, gpiochip); | 420 | irq_set_handler_data(parent_irq, gpiochip); |
421 | irq_set_chained_handler(parent_irq, parent_handler); | ||
422 | } | 422 | } |
423 | EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip); | 423 | EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip); |
424 | 424 | ||
@@ -1674,7 +1674,7 @@ struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, | |||
1674 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | 1674 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); |
1675 | 1675 | ||
1676 | /* No particular flag request, return here... */ | 1676 | /* No particular flag request, return here... */ |
1677 | if (flags & GPIOD_FLAGS_BIT_DIR_SET) | 1677 | if (!(flags & GPIOD_FLAGS_BIT_DIR_SET)) |
1678 | return desc; | 1678 | return desc; |
1679 | 1679 | ||
1680 | /* Process flags */ | 1680 | /* Process flags */ |
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index a2cc6be97983..b792194e0d9c 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c | |||
@@ -67,6 +67,7 @@ static int ast_detect_chip(struct drm_device *dev) | |||
67 | { | 67 | { |
68 | struct ast_private *ast = dev->dev_private; | 68 | struct ast_private *ast = dev->dev_private; |
69 | uint32_t data, jreg; | 69 | uint32_t data, jreg; |
70 | ast_open_key(ast); | ||
70 | 71 | ||
71 | if (dev->pdev->device == PCI_CHIP_AST1180) { | 72 | if (dev->pdev->device == PCI_CHIP_AST1180) { |
72 | ast->chip = AST1100; | 73 | ast->chip = AST1100; |
@@ -104,7 +105,7 @@ static int ast_detect_chip(struct drm_device *dev) | |||
104 | } | 105 | } |
105 | ast->vga2_clone = false; | 106 | ast->vga2_clone = false; |
106 | } else { | 107 | } else { |
107 | ast->chip = 2000; | 108 | ast->chip = AST2000; |
108 | DRM_INFO("AST 2000 detected\n"); | 109 | DRM_INFO("AST 2000 detected\n"); |
109 | } | 110 | } |
110 | } | 111 | } |
diff --git a/drivers/gpu/drm/ast/ast_tables.h b/drivers/gpu/drm/ast/ast_tables.h index 4c761dcea972..05c01ea85294 100644 --- a/drivers/gpu/drm/ast/ast_tables.h +++ b/drivers/gpu/drm/ast/ast_tables.h | |||
@@ -99,6 +99,7 @@ static struct ast_vbios_dclk_info dclk_table[] = { | |||
99 | {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ | 99 | {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ |
100 | {0x77, 0x58, 0x80}, /* 17: VCLK119 */ | 100 | {0x77, 0x58, 0x80}, /* 17: VCLK119 */ |
101 | {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ | 101 | {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ |
102 | {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */ | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | static struct ast_vbios_stdtable vbios_stdtable[] = { | 105 | static struct ast_vbios_stdtable vbios_stdtable[] = { |
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index 9d7346b92653..6b7efcf363d6 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c | |||
@@ -250,6 +250,7 @@ static void bochs_connector_init(struct drm_device *dev) | |||
250 | DRM_MODE_CONNECTOR_VIRTUAL); | 250 | DRM_MODE_CONNECTOR_VIRTUAL); |
251 | drm_connector_helper_add(connector, | 251 | drm_connector_helper_add(connector, |
252 | &bochs_connector_connector_helper_funcs); | 252 | &bochs_connector_connector_helper_funcs); |
253 | drm_connector_register(connector); | ||
253 | } | 254 | } |
254 | 255 | ||
255 | 256 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index e1c5c3222129..c7c5a9d91fa0 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c | |||
@@ -555,6 +555,7 @@ static struct drm_connector *cirrus_vga_init(struct drm_device *dev) | |||
555 | 555 | ||
556 | drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); | 556 | drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); |
557 | 557 | ||
558 | drm_connector_register(connector); | ||
558 | return connector; | 559 | return connector; |
559 | } | 560 | } |
560 | 561 | ||
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index fa2be249999c..90e773019eac 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -4696,8 +4696,9 @@ int drm_mode_create_dumb_ioctl(struct drm_device *dev, | |||
4696 | return -EINVAL; | 4696 | return -EINVAL; |
4697 | 4697 | ||
4698 | /* overflow checks for 32bit size calculations */ | 4698 | /* overflow checks for 32bit size calculations */ |
4699 | /* NOTE: DIV_ROUND_UP() can overflow */ | ||
4699 | cpp = DIV_ROUND_UP(args->bpp, 8); | 4700 | cpp = DIV_ROUND_UP(args->bpp, 8); |
4700 | if (cpp > 0xffffffffU / args->width) | 4701 | if (!cpp || cpp > 0xffffffffU / args->width) |
4701 | return -EINVAL; | 4702 | return -EINVAL; |
4702 | stride = cpp * args->width; | 4703 | stride = cpp * args->width; |
4703 | if (args->height > 0xffffffffU / stride) | 4704 | if (args->height > 0xffffffffU / stride) |
diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index dea99d92fb4a..4b7ed5289217 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c | |||
@@ -709,11 +709,13 @@ int i915_cmd_parser_init_ring(struct intel_engine_cs *ring) | |||
709 | BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count)); | 709 | BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count)); |
710 | BUG_ON(!validate_regs_sorted(ring)); | 710 | BUG_ON(!validate_regs_sorted(ring)); |
711 | 711 | ||
712 | ret = init_hash_table(ring, cmd_tables, cmd_table_count); | 712 | if (hash_empty(ring->cmd_hash)) { |
713 | if (ret) { | 713 | ret = init_hash_table(ring, cmd_tables, cmd_table_count); |
714 | DRM_ERROR("CMD: cmd_parser_init failed!\n"); | 714 | if (ret) { |
715 | fini_hash_table(ring); | 715 | DRM_ERROR("CMD: cmd_parser_init failed!\n"); |
716 | return ret; | 716 | fini_hash_table(ring); |
717 | return ret; | ||
718 | } | ||
717 | } | 719 | } |
718 | 720 | ||
719 | ring->needs_cmd_parser = true; | 721 | ring->needs_cmd_parser = true; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 2e7f03ad5ee2..9933c26017ed 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1336,12 +1336,17 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1336 | 1336 | ||
1337 | intel_power_domains_init_hw(dev_priv); | 1337 | intel_power_domains_init_hw(dev_priv); |
1338 | 1338 | ||
1339 | /* | ||
1340 | * We enable some interrupt sources in our postinstall hooks, so mark | ||
1341 | * interrupts as enabled _before_ actually enabling them to avoid | ||
1342 | * special cases in our ordering checks. | ||
1343 | */ | ||
1344 | dev_priv->pm._irqs_disabled = false; | ||
1345 | |||
1339 | ret = drm_irq_install(dev, dev->pdev->irq); | 1346 | ret = drm_irq_install(dev, dev->pdev->irq); |
1340 | if (ret) | 1347 | if (ret) |
1341 | goto cleanup_gem_stolen; | 1348 | goto cleanup_gem_stolen; |
1342 | 1349 | ||
1343 | dev_priv->pm._irqs_disabled = false; | ||
1344 | |||
1345 | /* Important: The output setup functions called by modeset_init need | 1350 | /* Important: The output setup functions called by modeset_init need |
1346 | * working irqs for e.g. gmbus and dp aux transfers. */ | 1351 | * working irqs for e.g. gmbus and dp aux transfers. */ |
1347 | intel_modeset_init(dev); | 1352 | intel_modeset_init(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index ec96f9a9724c..e27cdbe9d524 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -494,6 +494,36 @@ bool i915_semaphore_is_enabled(struct drm_device *dev) | |||
494 | return true; | 494 | return true; |
495 | } | 495 | } |
496 | 496 | ||
497 | void intel_hpd_cancel_work(struct drm_i915_private *dev_priv) | ||
498 | { | ||
499 | spin_lock_irq(&dev_priv->irq_lock); | ||
500 | |||
501 | dev_priv->long_hpd_port_mask = 0; | ||
502 | dev_priv->short_hpd_port_mask = 0; | ||
503 | dev_priv->hpd_event_bits = 0; | ||
504 | |||
505 | spin_unlock_irq(&dev_priv->irq_lock); | ||
506 | |||
507 | cancel_work_sync(&dev_priv->dig_port_work); | ||
508 | cancel_work_sync(&dev_priv->hotplug_work); | ||
509 | cancel_delayed_work_sync(&dev_priv->hotplug_reenable_work); | ||
510 | } | ||
511 | |||
512 | static void intel_suspend_encoders(struct drm_i915_private *dev_priv) | ||
513 | { | ||
514 | struct drm_device *dev = dev_priv->dev; | ||
515 | struct drm_encoder *encoder; | ||
516 | |||
517 | drm_modeset_lock_all(dev); | ||
518 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
519 | struct intel_encoder *intel_encoder = to_intel_encoder(encoder); | ||
520 | |||
521 | if (intel_encoder->suspend) | ||
522 | intel_encoder->suspend(intel_encoder); | ||
523 | } | ||
524 | drm_modeset_unlock_all(dev); | ||
525 | } | ||
526 | |||
497 | static int i915_drm_freeze(struct drm_device *dev) | 527 | static int i915_drm_freeze(struct drm_device *dev) |
498 | { | 528 | { |
499 | struct drm_i915_private *dev_priv = dev->dev_private; | 529 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -538,6 +568,9 @@ static int i915_drm_freeze(struct drm_device *dev) | |||
538 | flush_delayed_work(&dev_priv->rps.delayed_resume_work); | 568 | flush_delayed_work(&dev_priv->rps.delayed_resume_work); |
539 | 569 | ||
540 | intel_runtime_pm_disable_interrupts(dev); | 570 | intel_runtime_pm_disable_interrupts(dev); |
571 | intel_hpd_cancel_work(dev_priv); | ||
572 | |||
573 | intel_suspend_encoders(dev_priv); | ||
541 | 574 | ||
542 | intel_suspend_gt_powersave(dev); | 575 | intel_suspend_gt_powersave(dev); |
543 | 576 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 4412f6a4383b..3524306d8cfb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -184,6 +184,7 @@ enum hpd_pin { | |||
184 | if ((1 << (domain)) & (mask)) | 184 | if ((1 << (domain)) & (mask)) |
185 | 185 | ||
186 | struct drm_i915_private; | 186 | struct drm_i915_private; |
187 | struct i915_mm_struct; | ||
187 | struct i915_mmu_object; | 188 | struct i915_mmu_object; |
188 | 189 | ||
189 | enum intel_dpll_id { | 190 | enum intel_dpll_id { |
@@ -1458,7 +1459,7 @@ struct drm_i915_private { | |||
1458 | } hpd_mark; | 1459 | } hpd_mark; |
1459 | } hpd_stats[HPD_NUM_PINS]; | 1460 | } hpd_stats[HPD_NUM_PINS]; |
1460 | u32 hpd_event_bits; | 1461 | u32 hpd_event_bits; |
1461 | struct timer_list hotplug_reenable_timer; | 1462 | struct delayed_work hotplug_reenable_work; |
1462 | 1463 | ||
1463 | struct i915_fbc fbc; | 1464 | struct i915_fbc fbc; |
1464 | struct i915_drrs drrs; | 1465 | struct i915_drrs drrs; |
@@ -1506,9 +1507,8 @@ struct drm_i915_private { | |||
1506 | struct i915_gtt gtt; /* VM representing the global address space */ | 1507 | struct i915_gtt gtt; /* VM representing the global address space */ |
1507 | 1508 | ||
1508 | struct i915_gem_mm mm; | 1509 | struct i915_gem_mm mm; |
1509 | #if defined(CONFIG_MMU_NOTIFIER) | 1510 | DECLARE_HASHTABLE(mm_structs, 7); |
1510 | DECLARE_HASHTABLE(mmu_notifiers, 7); | 1511 | struct mutex mm_lock; |
1511 | #endif | ||
1512 | 1512 | ||
1513 | /* Kernel Modesetting */ | 1513 | /* Kernel Modesetting */ |
1514 | 1514 | ||
@@ -1814,8 +1814,8 @@ struct drm_i915_gem_object { | |||
1814 | unsigned workers :4; | 1814 | unsigned workers :4; |
1815 | #define I915_GEM_USERPTR_MAX_WORKERS 15 | 1815 | #define I915_GEM_USERPTR_MAX_WORKERS 15 |
1816 | 1816 | ||
1817 | struct mm_struct *mm; | 1817 | struct i915_mm_struct *mm; |
1818 | struct i915_mmu_object *mn; | 1818 | struct i915_mmu_object *mmu_object; |
1819 | struct work_struct *work; | 1819 | struct work_struct *work; |
1820 | } userptr; | 1820 | } userptr; |
1821 | }; | 1821 | }; |
@@ -2178,6 +2178,7 @@ extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv); | |||
2178 | extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv); | 2178 | extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv); |
2179 | extern void i915_update_gfx_val(struct drm_i915_private *dev_priv); | 2179 | extern void i915_update_gfx_val(struct drm_i915_private *dev_priv); |
2180 | int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on); | 2180 | int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on); |
2181 | void intel_hpd_cancel_work(struct drm_i915_private *dev_priv); | ||
2181 | 2182 | ||
2182 | extern void intel_console_resume(struct work_struct *work); | 2183 | extern void intel_console_resume(struct work_struct *work); |
2183 | 2184 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ba7f5c6bb50d..ad55b06a3cb1 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1590,10 +1590,13 @@ unlock: | |||
1590 | out: | 1590 | out: |
1591 | switch (ret) { | 1591 | switch (ret) { |
1592 | case -EIO: | 1592 | case -EIO: |
1593 | /* If this -EIO is due to a gpu hang, give the reset code a | 1593 | /* |
1594 | * chance to clean up the mess. Otherwise return the proper | 1594 | * We eat errors when the gpu is terminally wedged to avoid |
1595 | * SIGBUS. */ | 1595 | * userspace unduly crashing (gl has no provisions for mmaps to |
1596 | if (i915_terminally_wedged(&dev_priv->gpu_error)) { | 1596 | * fail). But any other -EIO isn't ours (e.g. swap in failure) |
1597 | * and so needs to be reported. | ||
1598 | */ | ||
1599 | if (!i915_terminally_wedged(&dev_priv->gpu_error)) { | ||
1597 | ret = VM_FAULT_SIGBUS; | 1600 | ret = VM_FAULT_SIGBUS; |
1598 | break; | 1601 | break; |
1599 | } | 1602 | } |
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c index fe69fc837d9e..d38413997379 100644 --- a/drivers/gpu/drm/i915/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c | |||
@@ -32,6 +32,15 @@ | |||
32 | #include <linux/mempolicy.h> | 32 | #include <linux/mempolicy.h> |
33 | #include <linux/swap.h> | 33 | #include <linux/swap.h> |
34 | 34 | ||
35 | struct i915_mm_struct { | ||
36 | struct mm_struct *mm; | ||
37 | struct drm_device *dev; | ||
38 | struct i915_mmu_notifier *mn; | ||
39 | struct hlist_node node; | ||
40 | struct kref kref; | ||
41 | struct work_struct work; | ||
42 | }; | ||
43 | |||
35 | #if defined(CONFIG_MMU_NOTIFIER) | 44 | #if defined(CONFIG_MMU_NOTIFIER) |
36 | #include <linux/interval_tree.h> | 45 | #include <linux/interval_tree.h> |
37 | 46 | ||
@@ -41,16 +50,12 @@ struct i915_mmu_notifier { | |||
41 | struct mmu_notifier mn; | 50 | struct mmu_notifier mn; |
42 | struct rb_root objects; | 51 | struct rb_root objects; |
43 | struct list_head linear; | 52 | struct list_head linear; |
44 | struct drm_device *dev; | ||
45 | struct mm_struct *mm; | ||
46 | struct work_struct work; | ||
47 | unsigned long count; | ||
48 | unsigned long serial; | 53 | unsigned long serial; |
49 | bool has_linear; | 54 | bool has_linear; |
50 | }; | 55 | }; |
51 | 56 | ||
52 | struct i915_mmu_object { | 57 | struct i915_mmu_object { |
53 | struct i915_mmu_notifier *mmu; | 58 | struct i915_mmu_notifier *mn; |
54 | struct interval_tree_node it; | 59 | struct interval_tree_node it; |
55 | struct list_head link; | 60 | struct list_head link; |
56 | struct drm_i915_gem_object *obj; | 61 | struct drm_i915_gem_object *obj; |
@@ -96,18 +101,18 @@ static void *invalidate_range__linear(struct i915_mmu_notifier *mn, | |||
96 | unsigned long start, | 101 | unsigned long start, |
97 | unsigned long end) | 102 | unsigned long end) |
98 | { | 103 | { |
99 | struct i915_mmu_object *mmu; | 104 | struct i915_mmu_object *mo; |
100 | unsigned long serial; | 105 | unsigned long serial; |
101 | 106 | ||
102 | restart: | 107 | restart: |
103 | serial = mn->serial; | 108 | serial = mn->serial; |
104 | list_for_each_entry(mmu, &mn->linear, link) { | 109 | list_for_each_entry(mo, &mn->linear, link) { |
105 | struct drm_i915_gem_object *obj; | 110 | struct drm_i915_gem_object *obj; |
106 | 111 | ||
107 | if (mmu->it.last < start || mmu->it.start > end) | 112 | if (mo->it.last < start || mo->it.start > end) |
108 | continue; | 113 | continue; |
109 | 114 | ||
110 | obj = mmu->obj; | 115 | obj = mo->obj; |
111 | drm_gem_object_reference(&obj->base); | 116 | drm_gem_object_reference(&obj->base); |
112 | spin_unlock(&mn->lock); | 117 | spin_unlock(&mn->lock); |
113 | 118 | ||
@@ -160,130 +165,47 @@ static const struct mmu_notifier_ops i915_gem_userptr_notifier = { | |||
160 | }; | 165 | }; |
161 | 166 | ||
162 | static struct i915_mmu_notifier * | 167 | static struct i915_mmu_notifier * |
163 | __i915_mmu_notifier_lookup(struct drm_device *dev, struct mm_struct *mm) | 168 | i915_mmu_notifier_create(struct mm_struct *mm) |
164 | { | ||
165 | struct drm_i915_private *dev_priv = to_i915(dev); | ||
166 | struct i915_mmu_notifier *mmu; | ||
167 | |||
168 | /* Protected by dev->struct_mutex */ | ||
169 | hash_for_each_possible(dev_priv->mmu_notifiers, mmu, node, (unsigned long)mm) | ||
170 | if (mmu->mm == mm) | ||
171 | return mmu; | ||
172 | |||
173 | return NULL; | ||
174 | } | ||
175 | |||
176 | static struct i915_mmu_notifier * | ||
177 | i915_mmu_notifier_get(struct drm_device *dev, struct mm_struct *mm) | ||
178 | { | 169 | { |
179 | struct drm_i915_private *dev_priv = to_i915(dev); | 170 | struct i915_mmu_notifier *mn; |
180 | struct i915_mmu_notifier *mmu; | ||
181 | int ret; | 171 | int ret; |
182 | 172 | ||
183 | lockdep_assert_held(&dev->struct_mutex); | 173 | mn = kmalloc(sizeof(*mn), GFP_KERNEL); |
184 | 174 | if (mn == NULL) | |
185 | mmu = __i915_mmu_notifier_lookup(dev, mm); | ||
186 | if (mmu) | ||
187 | return mmu; | ||
188 | |||
189 | mmu = kmalloc(sizeof(*mmu), GFP_KERNEL); | ||
190 | if (mmu == NULL) | ||
191 | return ERR_PTR(-ENOMEM); | 175 | return ERR_PTR(-ENOMEM); |
192 | 176 | ||
193 | spin_lock_init(&mmu->lock); | 177 | spin_lock_init(&mn->lock); |
194 | mmu->dev = dev; | 178 | mn->mn.ops = &i915_gem_userptr_notifier; |
195 | mmu->mn.ops = &i915_gem_userptr_notifier; | 179 | mn->objects = RB_ROOT; |
196 | mmu->mm = mm; | 180 | mn->serial = 1; |
197 | mmu->objects = RB_ROOT; | 181 | INIT_LIST_HEAD(&mn->linear); |
198 | mmu->count = 0; | 182 | mn->has_linear = false; |
199 | mmu->serial = 1; | 183 | |
200 | INIT_LIST_HEAD(&mmu->linear); | 184 | /* Protected by mmap_sem (write-lock) */ |
201 | mmu->has_linear = false; | 185 | ret = __mmu_notifier_register(&mn->mn, mm); |
202 | |||
203 | /* Protected by mmap_sem (write-lock) */ | ||
204 | ret = __mmu_notifier_register(&mmu->mn, mm); | ||
205 | if (ret) { | 186 | if (ret) { |
206 | kfree(mmu); | 187 | kfree(mn); |
207 | return ERR_PTR(ret); | 188 | return ERR_PTR(ret); |
208 | } | 189 | } |
209 | 190 | ||
210 | /* Protected by dev->struct_mutex */ | 191 | return mn; |
211 | hash_add(dev_priv->mmu_notifiers, &mmu->node, (unsigned long)mm); | ||
212 | return mmu; | ||
213 | } | 192 | } |
214 | 193 | ||
215 | static void | 194 | static void __i915_mmu_notifier_update_serial(struct i915_mmu_notifier *mn) |
216 | __i915_mmu_notifier_destroy_worker(struct work_struct *work) | ||
217 | { | 195 | { |
218 | struct i915_mmu_notifier *mmu = container_of(work, typeof(*mmu), work); | 196 | if (++mn->serial == 0) |
219 | mmu_notifier_unregister(&mmu->mn, mmu->mm); | 197 | mn->serial = 1; |
220 | kfree(mmu); | ||
221 | } | ||
222 | |||
223 | static void | ||
224 | __i915_mmu_notifier_destroy(struct i915_mmu_notifier *mmu) | ||
225 | { | ||
226 | lockdep_assert_held(&mmu->dev->struct_mutex); | ||
227 | |||
228 | /* Protected by dev->struct_mutex */ | ||
229 | hash_del(&mmu->node); | ||
230 | |||
231 | /* Our lock ordering is: mmap_sem, mmu_notifier_scru, struct_mutex. | ||
232 | * We enter the function holding struct_mutex, therefore we need | ||
233 | * to drop our mutex prior to calling mmu_notifier_unregister in | ||
234 | * order to prevent lock inversion (and system-wide deadlock) | ||
235 | * between the mmap_sem and struct-mutex. Hence we defer the | ||
236 | * unregistration to a workqueue where we hold no locks. | ||
237 | */ | ||
238 | INIT_WORK(&mmu->work, __i915_mmu_notifier_destroy_worker); | ||
239 | schedule_work(&mmu->work); | ||
240 | } | ||
241 | |||
242 | static void __i915_mmu_notifier_update_serial(struct i915_mmu_notifier *mmu) | ||
243 | { | ||
244 | if (++mmu->serial == 0) | ||
245 | mmu->serial = 1; | ||
246 | } | ||
247 | |||
248 | static bool i915_mmu_notifier_has_linear(struct i915_mmu_notifier *mmu) | ||
249 | { | ||
250 | struct i915_mmu_object *mn; | ||
251 | |||
252 | list_for_each_entry(mn, &mmu->linear, link) | ||
253 | if (mn->is_linear) | ||
254 | return true; | ||
255 | |||
256 | return false; | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | i915_mmu_notifier_del(struct i915_mmu_notifier *mmu, | ||
261 | struct i915_mmu_object *mn) | ||
262 | { | ||
263 | lockdep_assert_held(&mmu->dev->struct_mutex); | ||
264 | |||
265 | spin_lock(&mmu->lock); | ||
266 | list_del(&mn->link); | ||
267 | if (mn->is_linear) | ||
268 | mmu->has_linear = i915_mmu_notifier_has_linear(mmu); | ||
269 | else | ||
270 | interval_tree_remove(&mn->it, &mmu->objects); | ||
271 | __i915_mmu_notifier_update_serial(mmu); | ||
272 | spin_unlock(&mmu->lock); | ||
273 | |||
274 | /* Protected against _add() by dev->struct_mutex */ | ||
275 | if (--mmu->count == 0) | ||
276 | __i915_mmu_notifier_destroy(mmu); | ||
277 | } | 198 | } |
278 | 199 | ||
279 | static int | 200 | static int |
280 | i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | 201 | i915_mmu_notifier_add(struct drm_device *dev, |
281 | struct i915_mmu_object *mn) | 202 | struct i915_mmu_notifier *mn, |
203 | struct i915_mmu_object *mo) | ||
282 | { | 204 | { |
283 | struct interval_tree_node *it; | 205 | struct interval_tree_node *it; |
284 | int ret; | 206 | int ret; |
285 | 207 | ||
286 | ret = i915_mutex_lock_interruptible(mmu->dev); | 208 | ret = i915_mutex_lock_interruptible(dev); |
287 | if (ret) | 209 | if (ret) |
288 | return ret; | 210 | return ret; |
289 | 211 | ||
@@ -291,11 +213,11 @@ i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | |||
291 | * remove the objects from the interval tree) before we do | 213 | * remove the objects from the interval tree) before we do |
292 | * the check for overlapping objects. | 214 | * the check for overlapping objects. |
293 | */ | 215 | */ |
294 | i915_gem_retire_requests(mmu->dev); | 216 | i915_gem_retire_requests(dev); |
295 | 217 | ||
296 | spin_lock(&mmu->lock); | 218 | spin_lock(&mn->lock); |
297 | it = interval_tree_iter_first(&mmu->objects, | 219 | it = interval_tree_iter_first(&mn->objects, |
298 | mn->it.start, mn->it.last); | 220 | mo->it.start, mo->it.last); |
299 | if (it) { | 221 | if (it) { |
300 | struct drm_i915_gem_object *obj; | 222 | struct drm_i915_gem_object *obj; |
301 | 223 | ||
@@ -312,86 +234,122 @@ i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | |||
312 | 234 | ||
313 | obj = container_of(it, struct i915_mmu_object, it)->obj; | 235 | obj = container_of(it, struct i915_mmu_object, it)->obj; |
314 | if (!obj->userptr.workers) | 236 | if (!obj->userptr.workers) |
315 | mmu->has_linear = mn->is_linear = true; | 237 | mn->has_linear = mo->is_linear = true; |
316 | else | 238 | else |
317 | ret = -EAGAIN; | 239 | ret = -EAGAIN; |
318 | } else | 240 | } else |
319 | interval_tree_insert(&mn->it, &mmu->objects); | 241 | interval_tree_insert(&mo->it, &mn->objects); |
320 | 242 | ||
321 | if (ret == 0) { | 243 | if (ret == 0) { |
322 | list_add(&mn->link, &mmu->linear); | 244 | list_add(&mo->link, &mn->linear); |
323 | __i915_mmu_notifier_update_serial(mmu); | 245 | __i915_mmu_notifier_update_serial(mn); |
324 | } | 246 | } |
325 | spin_unlock(&mmu->lock); | 247 | spin_unlock(&mn->lock); |
326 | mutex_unlock(&mmu->dev->struct_mutex); | 248 | mutex_unlock(&dev->struct_mutex); |
327 | 249 | ||
328 | return ret; | 250 | return ret; |
329 | } | 251 | } |
330 | 252 | ||
253 | static bool i915_mmu_notifier_has_linear(struct i915_mmu_notifier *mn) | ||
254 | { | ||
255 | struct i915_mmu_object *mo; | ||
256 | |||
257 | list_for_each_entry(mo, &mn->linear, link) | ||
258 | if (mo->is_linear) | ||
259 | return true; | ||
260 | |||
261 | return false; | ||
262 | } | ||
263 | |||
264 | static void | ||
265 | i915_mmu_notifier_del(struct i915_mmu_notifier *mn, | ||
266 | struct i915_mmu_object *mo) | ||
267 | { | ||
268 | spin_lock(&mn->lock); | ||
269 | list_del(&mo->link); | ||
270 | if (mo->is_linear) | ||
271 | mn->has_linear = i915_mmu_notifier_has_linear(mn); | ||
272 | else | ||
273 | interval_tree_remove(&mo->it, &mn->objects); | ||
274 | __i915_mmu_notifier_update_serial(mn); | ||
275 | spin_unlock(&mn->lock); | ||
276 | } | ||
277 | |||
331 | static void | 278 | static void |
332 | i915_gem_userptr_release__mmu_notifier(struct drm_i915_gem_object *obj) | 279 | i915_gem_userptr_release__mmu_notifier(struct drm_i915_gem_object *obj) |
333 | { | 280 | { |
334 | struct i915_mmu_object *mn; | 281 | struct i915_mmu_object *mo; |
335 | 282 | ||
336 | mn = obj->userptr.mn; | 283 | mo = obj->userptr.mmu_object; |
337 | if (mn == NULL) | 284 | if (mo == NULL) |
338 | return; | 285 | return; |
339 | 286 | ||
340 | i915_mmu_notifier_del(mn->mmu, mn); | 287 | i915_mmu_notifier_del(mo->mn, mo); |
341 | obj->userptr.mn = NULL; | 288 | kfree(mo); |
289 | |||
290 | obj->userptr.mmu_object = NULL; | ||
291 | } | ||
292 | |||
293 | static struct i915_mmu_notifier * | ||
294 | i915_mmu_notifier_find(struct i915_mm_struct *mm) | ||
295 | { | ||
296 | if (mm->mn == NULL) { | ||
297 | down_write(&mm->mm->mmap_sem); | ||
298 | mutex_lock(&to_i915(mm->dev)->mm_lock); | ||
299 | if (mm->mn == NULL) | ||
300 | mm->mn = i915_mmu_notifier_create(mm->mm); | ||
301 | mutex_unlock(&to_i915(mm->dev)->mm_lock); | ||
302 | up_write(&mm->mm->mmap_sem); | ||
303 | } | ||
304 | return mm->mn; | ||
342 | } | 305 | } |
343 | 306 | ||
344 | static int | 307 | static int |
345 | i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, | 308 | i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, |
346 | unsigned flags) | 309 | unsigned flags) |
347 | { | 310 | { |
348 | struct i915_mmu_notifier *mmu; | 311 | struct i915_mmu_notifier *mn; |
349 | struct i915_mmu_object *mn; | 312 | struct i915_mmu_object *mo; |
350 | int ret; | 313 | int ret; |
351 | 314 | ||
352 | if (flags & I915_USERPTR_UNSYNCHRONIZED) | 315 | if (flags & I915_USERPTR_UNSYNCHRONIZED) |
353 | return capable(CAP_SYS_ADMIN) ? 0 : -EPERM; | 316 | return capable(CAP_SYS_ADMIN) ? 0 : -EPERM; |
354 | 317 | ||
355 | down_write(&obj->userptr.mm->mmap_sem); | 318 | if (WARN_ON(obj->userptr.mm == NULL)) |
356 | ret = i915_mutex_lock_interruptible(obj->base.dev); | 319 | return -EINVAL; |
357 | if (ret == 0) { | ||
358 | mmu = i915_mmu_notifier_get(obj->base.dev, obj->userptr.mm); | ||
359 | if (!IS_ERR(mmu)) | ||
360 | mmu->count++; /* preemptive add to act as a refcount */ | ||
361 | else | ||
362 | ret = PTR_ERR(mmu); | ||
363 | mutex_unlock(&obj->base.dev->struct_mutex); | ||
364 | } | ||
365 | up_write(&obj->userptr.mm->mmap_sem); | ||
366 | if (ret) | ||
367 | return ret; | ||
368 | 320 | ||
369 | mn = kzalloc(sizeof(*mn), GFP_KERNEL); | 321 | mn = i915_mmu_notifier_find(obj->userptr.mm); |
370 | if (mn == NULL) { | 322 | if (IS_ERR(mn)) |
371 | ret = -ENOMEM; | 323 | return PTR_ERR(mn); |
372 | goto destroy_mmu; | ||
373 | } | ||
374 | 324 | ||
375 | mn->mmu = mmu; | 325 | mo = kzalloc(sizeof(*mo), GFP_KERNEL); |
376 | mn->it.start = obj->userptr.ptr; | 326 | if (mo == NULL) |
377 | mn->it.last = mn->it.start + obj->base.size - 1; | 327 | return -ENOMEM; |
378 | mn->obj = obj; | ||
379 | 328 | ||
380 | ret = i915_mmu_notifier_add(mmu, mn); | 329 | mo->mn = mn; |
381 | if (ret) | 330 | mo->it.start = obj->userptr.ptr; |
382 | goto free_mn; | 331 | mo->it.last = mo->it.start + obj->base.size - 1; |
332 | mo->obj = obj; | ||
383 | 333 | ||
384 | obj->userptr.mn = mn; | 334 | ret = i915_mmu_notifier_add(obj->base.dev, mn, mo); |
335 | if (ret) { | ||
336 | kfree(mo); | ||
337 | return ret; | ||
338 | } | ||
339 | |||
340 | obj->userptr.mmu_object = mo; | ||
385 | return 0; | 341 | return 0; |
342 | } | ||
343 | |||
344 | static void | ||
345 | i915_mmu_notifier_free(struct i915_mmu_notifier *mn, | ||
346 | struct mm_struct *mm) | ||
347 | { | ||
348 | if (mn == NULL) | ||
349 | return; | ||
386 | 350 | ||
387 | free_mn: | 351 | mmu_notifier_unregister(&mn->mn, mm); |
388 | kfree(mn); | 352 | kfree(mn); |
389 | destroy_mmu: | ||
390 | mutex_lock(&obj->base.dev->struct_mutex); | ||
391 | if (--mmu->count == 0) | ||
392 | __i915_mmu_notifier_destroy(mmu); | ||
393 | mutex_unlock(&obj->base.dev->struct_mutex); | ||
394 | return ret; | ||
395 | } | 353 | } |
396 | 354 | ||
397 | #else | 355 | #else |
@@ -413,15 +371,114 @@ i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, | |||
413 | 371 | ||
414 | return 0; | 372 | return 0; |
415 | } | 373 | } |
374 | |||
375 | static void | ||
376 | i915_mmu_notifier_free(struct i915_mmu_notifier *mn, | ||
377 | struct mm_struct *mm) | ||
378 | { | ||
379 | } | ||
380 | |||
416 | #endif | 381 | #endif |
417 | 382 | ||
383 | static struct i915_mm_struct * | ||
384 | __i915_mm_struct_find(struct drm_i915_private *dev_priv, struct mm_struct *real) | ||
385 | { | ||
386 | struct i915_mm_struct *mm; | ||
387 | |||
388 | /* Protected by dev_priv->mm_lock */ | ||
389 | hash_for_each_possible(dev_priv->mm_structs, mm, node, (unsigned long)real) | ||
390 | if (mm->mm == real) | ||
391 | return mm; | ||
392 | |||
393 | return NULL; | ||
394 | } | ||
395 | |||
396 | static int | ||
397 | i915_gem_userptr_init__mm_struct(struct drm_i915_gem_object *obj) | ||
398 | { | ||
399 | struct drm_i915_private *dev_priv = to_i915(obj->base.dev); | ||
400 | struct i915_mm_struct *mm; | ||
401 | int ret = 0; | ||
402 | |||
403 | /* During release of the GEM object we hold the struct_mutex. This | ||
404 | * precludes us from calling mmput() at that time as that may be | ||
405 | * the last reference and so call exit_mmap(). exit_mmap() will | ||
406 | * attempt to reap the vma, and if we were holding a GTT mmap | ||
407 | * would then call drm_gem_vm_close() and attempt to reacquire | ||
408 | * the struct mutex. So in order to avoid that recursion, we have | ||
409 | * to defer releasing the mm reference until after we drop the | ||
410 | * struct_mutex, i.e. we need to schedule a worker to do the clean | ||
411 | * up. | ||
412 | */ | ||
413 | mutex_lock(&dev_priv->mm_lock); | ||
414 | mm = __i915_mm_struct_find(dev_priv, current->mm); | ||
415 | if (mm == NULL) { | ||
416 | mm = kmalloc(sizeof(*mm), GFP_KERNEL); | ||
417 | if (mm == NULL) { | ||
418 | ret = -ENOMEM; | ||
419 | goto out; | ||
420 | } | ||
421 | |||
422 | kref_init(&mm->kref); | ||
423 | mm->dev = obj->base.dev; | ||
424 | |||
425 | mm->mm = current->mm; | ||
426 | atomic_inc(¤t->mm->mm_count); | ||
427 | |||
428 | mm->mn = NULL; | ||
429 | |||
430 | /* Protected by dev_priv->mm_lock */ | ||
431 | hash_add(dev_priv->mm_structs, | ||
432 | &mm->node, (unsigned long)mm->mm); | ||
433 | } else | ||
434 | kref_get(&mm->kref); | ||
435 | |||
436 | obj->userptr.mm = mm; | ||
437 | out: | ||
438 | mutex_unlock(&dev_priv->mm_lock); | ||
439 | return ret; | ||
440 | } | ||
441 | |||
442 | static void | ||
443 | __i915_mm_struct_free__worker(struct work_struct *work) | ||
444 | { | ||
445 | struct i915_mm_struct *mm = container_of(work, typeof(*mm), work); | ||
446 | i915_mmu_notifier_free(mm->mn, mm->mm); | ||
447 | mmdrop(mm->mm); | ||
448 | kfree(mm); | ||
449 | } | ||
450 | |||
451 | static void | ||
452 | __i915_mm_struct_free(struct kref *kref) | ||
453 | { | ||
454 | struct i915_mm_struct *mm = container_of(kref, typeof(*mm), kref); | ||
455 | |||
456 | /* Protected by dev_priv->mm_lock */ | ||
457 | hash_del(&mm->node); | ||
458 | mutex_unlock(&to_i915(mm->dev)->mm_lock); | ||
459 | |||
460 | INIT_WORK(&mm->work, __i915_mm_struct_free__worker); | ||
461 | schedule_work(&mm->work); | ||
462 | } | ||
463 | |||
464 | static void | ||
465 | i915_gem_userptr_release__mm_struct(struct drm_i915_gem_object *obj) | ||
466 | { | ||
467 | if (obj->userptr.mm == NULL) | ||
468 | return; | ||
469 | |||
470 | kref_put_mutex(&obj->userptr.mm->kref, | ||
471 | __i915_mm_struct_free, | ||
472 | &to_i915(obj->base.dev)->mm_lock); | ||
473 | obj->userptr.mm = NULL; | ||
474 | } | ||
475 | |||
418 | struct get_pages_work { | 476 | struct get_pages_work { |
419 | struct work_struct work; | 477 | struct work_struct work; |
420 | struct drm_i915_gem_object *obj; | 478 | struct drm_i915_gem_object *obj; |
421 | struct task_struct *task; | 479 | struct task_struct *task; |
422 | }; | 480 | }; |
423 | 481 | ||
424 | |||
425 | #if IS_ENABLED(CONFIG_SWIOTLB) | 482 | #if IS_ENABLED(CONFIG_SWIOTLB) |
426 | #define swiotlb_active() swiotlb_nr_tbl() | 483 | #define swiotlb_active() swiotlb_nr_tbl() |
427 | #else | 484 | #else |
@@ -479,7 +536,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) | |||
479 | if (pvec == NULL) | 536 | if (pvec == NULL) |
480 | pvec = drm_malloc_ab(num_pages, sizeof(struct page *)); | 537 | pvec = drm_malloc_ab(num_pages, sizeof(struct page *)); |
481 | if (pvec != NULL) { | 538 | if (pvec != NULL) { |
482 | struct mm_struct *mm = obj->userptr.mm; | 539 | struct mm_struct *mm = obj->userptr.mm->mm; |
483 | 540 | ||
484 | down_read(&mm->mmap_sem); | 541 | down_read(&mm->mmap_sem); |
485 | while (pinned < num_pages) { | 542 | while (pinned < num_pages) { |
@@ -545,7 +602,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) | |||
545 | 602 | ||
546 | pvec = NULL; | 603 | pvec = NULL; |
547 | pinned = 0; | 604 | pinned = 0; |
548 | if (obj->userptr.mm == current->mm) { | 605 | if (obj->userptr.mm->mm == current->mm) { |
549 | pvec = kmalloc(num_pages*sizeof(struct page *), | 606 | pvec = kmalloc(num_pages*sizeof(struct page *), |
550 | GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY); | 607 | GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY); |
551 | if (pvec == NULL) { | 608 | if (pvec == NULL) { |
@@ -651,17 +708,13 @@ static void | |||
651 | i915_gem_userptr_release(struct drm_i915_gem_object *obj) | 708 | i915_gem_userptr_release(struct drm_i915_gem_object *obj) |
652 | { | 709 | { |
653 | i915_gem_userptr_release__mmu_notifier(obj); | 710 | i915_gem_userptr_release__mmu_notifier(obj); |
654 | 711 | i915_gem_userptr_release__mm_struct(obj); | |
655 | if (obj->userptr.mm) { | ||
656 | mmput(obj->userptr.mm); | ||
657 | obj->userptr.mm = NULL; | ||
658 | } | ||
659 | } | 712 | } |
660 | 713 | ||
661 | static int | 714 | static int |
662 | i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) | 715 | i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) |
663 | { | 716 | { |
664 | if (obj->userptr.mn) | 717 | if (obj->userptr.mmu_object) |
665 | return 0; | 718 | return 0; |
666 | 719 | ||
667 | return i915_gem_userptr_init__mmu_notifier(obj, 0); | 720 | return i915_gem_userptr_init__mmu_notifier(obj, 0); |
@@ -736,7 +789,6 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
736 | return -ENODEV; | 789 | return -ENODEV; |
737 | } | 790 | } |
738 | 791 | ||
739 | /* Allocate the new object */ | ||
740 | obj = i915_gem_object_alloc(dev); | 792 | obj = i915_gem_object_alloc(dev); |
741 | if (obj == NULL) | 793 | if (obj == NULL) |
742 | return -ENOMEM; | 794 | return -ENOMEM; |
@@ -754,8 +806,8 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
754 | * at binding. This means that we need to hook into the mmu_notifier | 806 | * at binding. This means that we need to hook into the mmu_notifier |
755 | * in order to detect if the mmu is destroyed. | 807 | * in order to detect if the mmu is destroyed. |
756 | */ | 808 | */ |
757 | ret = -ENOMEM; | 809 | ret = i915_gem_userptr_init__mm_struct(obj); |
758 | if ((obj->userptr.mm = get_task_mm(current))) | 810 | if (ret == 0) |
759 | ret = i915_gem_userptr_init__mmu_notifier(obj, args->flags); | 811 | ret = i915_gem_userptr_init__mmu_notifier(obj, args->flags); |
760 | if (ret == 0) | 812 | if (ret == 0) |
761 | ret = drm_gem_handle_create(file, &obj->base, &handle); | 813 | ret = drm_gem_handle_create(file, &obj->base, &handle); |
@@ -772,9 +824,8 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
772 | int | 824 | int |
773 | i915_gem_init_userptr(struct drm_device *dev) | 825 | i915_gem_init_userptr(struct drm_device *dev) |
774 | { | 826 | { |
775 | #if defined(CONFIG_MMU_NOTIFIER) | ||
776 | struct drm_i915_private *dev_priv = to_i915(dev); | 827 | struct drm_i915_private *dev_priv = to_i915(dev); |
777 | hash_init(dev_priv->mmu_notifiers); | 828 | mutex_init(&dev_priv->mm_lock); |
778 | #endif | 829 | hash_init(dev_priv->mm_structs); |
779 | return 0; | 830 | return 0; |
780 | } | 831 | } |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 390ccc2a3096..0050ee9470f1 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1189,8 +1189,8 @@ static void i915_hotplug_work_func(struct work_struct *work) | |||
1189 | * some connectors */ | 1189 | * some connectors */ |
1190 | if (hpd_disabled) { | 1190 | if (hpd_disabled) { |
1191 | drm_kms_helper_poll_enable(dev); | 1191 | drm_kms_helper_poll_enable(dev); |
1192 | mod_timer(&dev_priv->hotplug_reenable_timer, | 1192 | mod_delayed_work(system_wq, &dev_priv->hotplug_reenable_work, |
1193 | jiffies + msecs_to_jiffies(I915_REENABLE_HOTPLUG_DELAY)); | 1193 | msecs_to_jiffies(I915_REENABLE_HOTPLUG_DELAY)); |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); | 1196 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
@@ -1213,11 +1213,6 @@ static void i915_hotplug_work_func(struct work_struct *work) | |||
1213 | drm_kms_helper_hotplug_event(dev); | 1213 | drm_kms_helper_hotplug_event(dev); |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | static void intel_hpd_irq_uninstall(struct drm_i915_private *dev_priv) | ||
1217 | { | ||
1218 | del_timer_sync(&dev_priv->hotplug_reenable_timer); | ||
1219 | } | ||
1220 | |||
1221 | static void ironlake_rps_change_irq_handler(struct drm_device *dev) | 1216 | static void ironlake_rps_change_irq_handler(struct drm_device *dev) |
1222 | { | 1217 | { |
1223 | struct drm_i915_private *dev_priv = dev->dev_private; | 1218 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -3892,8 +3887,6 @@ static void gen8_irq_uninstall(struct drm_device *dev) | |||
3892 | if (!dev_priv) | 3887 | if (!dev_priv) |
3893 | return; | 3888 | return; |
3894 | 3889 | ||
3895 | intel_hpd_irq_uninstall(dev_priv); | ||
3896 | |||
3897 | gen8_irq_reset(dev); | 3890 | gen8_irq_reset(dev); |
3898 | } | 3891 | } |
3899 | 3892 | ||
@@ -3908,8 +3901,6 @@ static void valleyview_irq_uninstall(struct drm_device *dev) | |||
3908 | 3901 | ||
3909 | I915_WRITE(VLV_MASTER_IER, 0); | 3902 | I915_WRITE(VLV_MASTER_IER, 0); |
3910 | 3903 | ||
3911 | intel_hpd_irq_uninstall(dev_priv); | ||
3912 | |||
3913 | for_each_pipe(pipe) | 3904 | for_each_pipe(pipe) |
3914 | I915_WRITE(PIPESTAT(pipe), 0xffff); | 3905 | I915_WRITE(PIPESTAT(pipe), 0xffff); |
3915 | 3906 | ||
@@ -3988,8 +3979,6 @@ static void ironlake_irq_uninstall(struct drm_device *dev) | |||
3988 | if (!dev_priv) | 3979 | if (!dev_priv) |
3989 | return; | 3980 | return; |
3990 | 3981 | ||
3991 | intel_hpd_irq_uninstall(dev_priv); | ||
3992 | |||
3993 | ironlake_irq_reset(dev); | 3982 | ironlake_irq_reset(dev); |
3994 | } | 3983 | } |
3995 | 3984 | ||
@@ -4360,8 +4349,6 @@ static void i915_irq_uninstall(struct drm_device * dev) | |||
4360 | struct drm_i915_private *dev_priv = dev->dev_private; | 4349 | struct drm_i915_private *dev_priv = dev->dev_private; |
4361 | int pipe; | 4350 | int pipe; |
4362 | 4351 | ||
4363 | intel_hpd_irq_uninstall(dev_priv); | ||
4364 | |||
4365 | if (I915_HAS_HOTPLUG(dev)) { | 4352 | if (I915_HAS_HOTPLUG(dev)) { |
4366 | I915_WRITE(PORT_HOTPLUG_EN, 0); | 4353 | I915_WRITE(PORT_HOTPLUG_EN, 0); |
4367 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); | 4354 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); |
@@ -4598,8 +4585,6 @@ static void i965_irq_uninstall(struct drm_device * dev) | |||
4598 | if (!dev_priv) | 4585 | if (!dev_priv) |
4599 | return; | 4586 | return; |
4600 | 4587 | ||
4601 | intel_hpd_irq_uninstall(dev_priv); | ||
4602 | |||
4603 | I915_WRITE(PORT_HOTPLUG_EN, 0); | 4588 | I915_WRITE(PORT_HOTPLUG_EN, 0); |
4604 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); | 4589 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); |
4605 | 4590 | ||
@@ -4615,14 +4600,18 @@ static void i965_irq_uninstall(struct drm_device * dev) | |||
4615 | I915_WRITE(IIR, I915_READ(IIR)); | 4600 | I915_WRITE(IIR, I915_READ(IIR)); |
4616 | } | 4601 | } |
4617 | 4602 | ||
4618 | static void intel_hpd_irq_reenable(unsigned long data) | 4603 | static void intel_hpd_irq_reenable(struct work_struct *work) |
4619 | { | 4604 | { |
4620 | struct drm_i915_private *dev_priv = (struct drm_i915_private *)data; | 4605 | struct drm_i915_private *dev_priv = |
4606 | container_of(work, typeof(*dev_priv), | ||
4607 | hotplug_reenable_work.work); | ||
4621 | struct drm_device *dev = dev_priv->dev; | 4608 | struct drm_device *dev = dev_priv->dev; |
4622 | struct drm_mode_config *mode_config = &dev->mode_config; | 4609 | struct drm_mode_config *mode_config = &dev->mode_config; |
4623 | unsigned long irqflags; | 4610 | unsigned long irqflags; |
4624 | int i; | 4611 | int i; |
4625 | 4612 | ||
4613 | intel_runtime_pm_get(dev_priv); | ||
4614 | |||
4626 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); | 4615 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); |
4627 | for (i = (HPD_NONE + 1); i < HPD_NUM_PINS; i++) { | 4616 | for (i = (HPD_NONE + 1); i < HPD_NUM_PINS; i++) { |
4628 | struct drm_connector *connector; | 4617 | struct drm_connector *connector; |
@@ -4648,6 +4637,8 @@ static void intel_hpd_irq_reenable(unsigned long data) | |||
4648 | if (dev_priv->display.hpd_irq_setup) | 4637 | if (dev_priv->display.hpd_irq_setup) |
4649 | dev_priv->display.hpd_irq_setup(dev); | 4638 | dev_priv->display.hpd_irq_setup(dev); |
4650 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); | 4639 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
4640 | |||
4641 | intel_runtime_pm_put(dev_priv); | ||
4651 | } | 4642 | } |
4652 | 4643 | ||
4653 | void intel_irq_init(struct drm_device *dev) | 4644 | void intel_irq_init(struct drm_device *dev) |
@@ -4670,8 +4661,8 @@ void intel_irq_init(struct drm_device *dev) | |||
4670 | setup_timer(&dev_priv->gpu_error.hangcheck_timer, | 4661 | setup_timer(&dev_priv->gpu_error.hangcheck_timer, |
4671 | i915_hangcheck_elapsed, | 4662 | i915_hangcheck_elapsed, |
4672 | (unsigned long) dev); | 4663 | (unsigned long) dev); |
4673 | setup_timer(&dev_priv->hotplug_reenable_timer, intel_hpd_irq_reenable, | 4664 | INIT_DELAYED_WORK(&dev_priv->hotplug_reenable_work, |
4674 | (unsigned long) dev_priv); | 4665 | intel_hpd_irq_reenable); |
4675 | 4666 | ||
4676 | pm_qos_add_request(&dev_priv->pm_qos, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE); | 4667 | pm_qos_add_request(&dev_priv->pm_qos, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE); |
4677 | 4668 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index e4d7607da2c4..f29b44c86a2f 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -334,16 +334,20 @@ | |||
334 | #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) | 334 | #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) |
335 | #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) | 335 | #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) |
336 | #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2) | 336 | #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2) |
337 | #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4) | 337 | |
338 | #define COLOR_BLT_CMD (2<<29 | 0x40<<22 | (5-2)) | ||
339 | #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4) | ||
338 | #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) | 340 | #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) |
339 | #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5) | 341 | #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5) |
340 | #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) | 342 | #define BLT_WRITE_A (2<<20) |
341 | #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) | 343 | #define BLT_WRITE_RGB (1<<20) |
344 | #define BLT_WRITE_RGBA (BLT_WRITE_RGB | BLT_WRITE_A) | ||
342 | #define BLT_DEPTH_8 (0<<24) | 345 | #define BLT_DEPTH_8 (0<<24) |
343 | #define BLT_DEPTH_16_565 (1<<24) | 346 | #define BLT_DEPTH_16_565 (1<<24) |
344 | #define BLT_DEPTH_16_1555 (2<<24) | 347 | #define BLT_DEPTH_16_1555 (2<<24) |
345 | #define BLT_DEPTH_32 (3<<24) | 348 | #define BLT_DEPTH_32 (3<<24) |
346 | #define BLT_ROP_GXCOPY (0xcc<<16) | 349 | #define BLT_ROP_SRC_COPY (0xcc<<16) |
350 | #define BLT_ROP_COLOR_COPY (0xf0<<16) | ||
347 | #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */ | 351 | #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */ |
348 | #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */ | 352 | #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */ |
349 | #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2) | 353 | #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2) |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index a66955037e4e..eee79e1c3222 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -1123,7 +1123,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) | |||
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id) | 1126 | static int intel_no_opregion_vbt_callback(const struct dmi_system_id *id) |
1127 | { | 1127 | { |
1128 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " | 1128 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " |
1129 | "VBIOS ROM for %s\n", | 1129 | "VBIOS ROM for %s\n", |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 2efaf8e8d9c4..9212e6504e0f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -699,16 +699,21 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
699 | goto out; | 699 | goto out; |
700 | } | 700 | } |
701 | 701 | ||
702 | drm_modeset_acquire_init(&ctx, 0); | ||
703 | |||
702 | /* for pre-945g platforms use load detect */ | 704 | /* for pre-945g platforms use load detect */ |
703 | if (intel_get_load_detect_pipe(connector, NULL, &tmp, &ctx)) { | 705 | if (intel_get_load_detect_pipe(connector, NULL, &tmp, &ctx)) { |
704 | if (intel_crt_detect_ddc(connector)) | 706 | if (intel_crt_detect_ddc(connector)) |
705 | status = connector_status_connected; | 707 | status = connector_status_connected; |
706 | else | 708 | else |
707 | status = intel_crt_load_detect(crt); | 709 | status = intel_crt_load_detect(crt); |
708 | intel_release_load_detect_pipe(connector, &tmp, &ctx); | 710 | intel_release_load_detect_pipe(connector, &tmp); |
709 | } else | 711 | } else |
710 | status = connector_status_unknown; | 712 | status = connector_status_unknown; |
711 | 713 | ||
714 | drm_modeset_drop_locks(&ctx); | ||
715 | drm_modeset_acquire_fini(&ctx); | ||
716 | |||
712 | out: | 717 | out: |
713 | intel_display_power_put(dev_priv, power_domain); | 718 | intel_display_power_put(dev_priv, power_domain); |
714 | return status; | 719 | return status; |
@@ -799,7 +804,7 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { | |||
799 | .destroy = intel_encoder_destroy, | 804 | .destroy = intel_encoder_destroy, |
800 | }; | 805 | }; |
801 | 806 | ||
802 | static int __init intel_no_crt_dmi_callback(const struct dmi_system_id *id) | 807 | static int intel_no_crt_dmi_callback(const struct dmi_system_id *id) |
803 | { | 808 | { |
804 | DRM_INFO("Skipping CRT initialization for %s\n", id->ident); | 809 | DRM_INFO("Skipping CRT initialization for %s\n", id->ident); |
805 | return 1; | 810 | return 1; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 018fb7222f60..d8324c69fa86 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2233,6 +2233,15 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, | |||
2233 | if (need_vtd_wa(dev) && alignment < 256 * 1024) | 2233 | if (need_vtd_wa(dev) && alignment < 256 * 1024) |
2234 | alignment = 256 * 1024; | 2234 | alignment = 256 * 1024; |
2235 | 2235 | ||
2236 | /* | ||
2237 | * Global gtt pte registers are special registers which actually forward | ||
2238 | * writes to a chunk of system memory. Which means that there is no risk | ||
2239 | * that the register values disappear as soon as we call | ||
2240 | * intel_runtime_pm_put(), so it is correct to wrap only the | ||
2241 | * pin/unpin/fence and not more. | ||
2242 | */ | ||
2243 | intel_runtime_pm_get(dev_priv); | ||
2244 | |||
2236 | dev_priv->mm.interruptible = false; | 2245 | dev_priv->mm.interruptible = false; |
2237 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined); | 2246 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined); |
2238 | if (ret) | 2247 | if (ret) |
@@ -2250,12 +2259,14 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, | |||
2250 | i915_gem_object_pin_fence(obj); | 2259 | i915_gem_object_pin_fence(obj); |
2251 | 2260 | ||
2252 | dev_priv->mm.interruptible = true; | 2261 | dev_priv->mm.interruptible = true; |
2262 | intel_runtime_pm_put(dev_priv); | ||
2253 | return 0; | 2263 | return 0; |
2254 | 2264 | ||
2255 | err_unpin: | 2265 | err_unpin: |
2256 | i915_gem_object_unpin_from_display_plane(obj); | 2266 | i915_gem_object_unpin_from_display_plane(obj); |
2257 | err_interruptible: | 2267 | err_interruptible: |
2258 | dev_priv->mm.interruptible = true; | 2268 | dev_priv->mm.interruptible = true; |
2269 | intel_runtime_pm_put(dev_priv); | ||
2259 | return ret; | 2270 | return ret; |
2260 | } | 2271 | } |
2261 | 2272 | ||
@@ -4188,10 +4199,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) | |||
4188 | intel_set_pch_fifo_underrun_reporting(dev, pipe, false); | 4199 | intel_set_pch_fifo_underrun_reporting(dev, pipe, false); |
4189 | 4200 | ||
4190 | intel_disable_pipe(dev_priv, pipe); | 4201 | intel_disable_pipe(dev_priv, pipe); |
4191 | |||
4192 | if (intel_crtc->config.dp_encoder_is_mst) | ||
4193 | intel_ddi_set_vc_payload_alloc(crtc, false); | ||
4194 | |||
4195 | ironlake_pfit_disable(intel_crtc); | 4202 | ironlake_pfit_disable(intel_crtc); |
4196 | 4203 | ||
4197 | for_each_encoder_on_crtc(dev, crtc, encoder) | 4204 | for_each_encoder_on_crtc(dev, crtc, encoder) |
@@ -4256,6 +4263,9 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) | |||
4256 | intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, false); | 4263 | intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, false); |
4257 | intel_disable_pipe(dev_priv, pipe); | 4264 | intel_disable_pipe(dev_priv, pipe); |
4258 | 4265 | ||
4266 | if (intel_crtc->config.dp_encoder_is_mst) | ||
4267 | intel_ddi_set_vc_payload_alloc(crtc, false); | ||
4268 | |||
4259 | intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); | 4269 | intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); |
4260 | 4270 | ||
4261 | ironlake_pfit_disable(intel_crtc); | 4271 | ironlake_pfit_disable(intel_crtc); |
@@ -8240,6 +8250,15 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc, | |||
8240 | goto fail_locked; | 8250 | goto fail_locked; |
8241 | } | 8251 | } |
8242 | 8252 | ||
8253 | /* | ||
8254 | * Global gtt pte registers are special registers which actually | ||
8255 | * forward writes to a chunk of system memory. Which means that | ||
8256 | * there is no risk that the register values disappear as soon | ||
8257 | * as we call intel_runtime_pm_put(), so it is correct to wrap | ||
8258 | * only the pin/unpin/fence and not more. | ||
8259 | */ | ||
8260 | intel_runtime_pm_get(dev_priv); | ||
8261 | |||
8243 | /* Note that the w/a also requires 2 PTE of padding following | 8262 | /* Note that the w/a also requires 2 PTE of padding following |
8244 | * the bo. We currently fill all unused PTE with the shadow | 8263 | * the bo. We currently fill all unused PTE with the shadow |
8245 | * page and so we should always have valid PTE following the | 8264 | * page and so we should always have valid PTE following the |
@@ -8252,16 +8271,20 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc, | |||
8252 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, NULL); | 8271 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, NULL); |
8253 | if (ret) { | 8272 | if (ret) { |
8254 | DRM_DEBUG_KMS("failed to move cursor bo into the GTT\n"); | 8273 | DRM_DEBUG_KMS("failed to move cursor bo into the GTT\n"); |
8274 | intel_runtime_pm_put(dev_priv); | ||
8255 | goto fail_locked; | 8275 | goto fail_locked; |
8256 | } | 8276 | } |
8257 | 8277 | ||
8258 | ret = i915_gem_object_put_fence(obj); | 8278 | ret = i915_gem_object_put_fence(obj); |
8259 | if (ret) { | 8279 | if (ret) { |
8260 | DRM_DEBUG_KMS("failed to release fence for cursor"); | 8280 | DRM_DEBUG_KMS("failed to release fence for cursor"); |
8281 | intel_runtime_pm_put(dev_priv); | ||
8261 | goto fail_unpin; | 8282 | goto fail_unpin; |
8262 | } | 8283 | } |
8263 | 8284 | ||
8264 | addr = i915_gem_obj_ggtt_offset(obj); | 8285 | addr = i915_gem_obj_ggtt_offset(obj); |
8286 | |||
8287 | intel_runtime_pm_put(dev_priv); | ||
8265 | } else { | 8288 | } else { |
8266 | int align = IS_I830(dev) ? 16 * 1024 : 256; | 8289 | int align = IS_I830(dev) ? 16 * 1024 : 256; |
8267 | ret = i915_gem_object_attach_phys(obj, align); | 8290 | ret = i915_gem_object_attach_phys(obj, align); |
@@ -8462,8 +8485,6 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, | |||
8462 | connector->base.id, connector->name, | 8485 | connector->base.id, connector->name, |
8463 | encoder->base.id, encoder->name); | 8486 | encoder->base.id, encoder->name); |
8464 | 8487 | ||
8465 | drm_modeset_acquire_init(ctx, 0); | ||
8466 | |||
8467 | retry: | 8488 | retry: |
8468 | ret = drm_modeset_lock(&config->connection_mutex, ctx); | 8489 | ret = drm_modeset_lock(&config->connection_mutex, ctx); |
8469 | if (ret) | 8490 | if (ret) |
@@ -8502,10 +8523,14 @@ retry: | |||
8502 | i++; | 8523 | i++; |
8503 | if (!(encoder->possible_crtcs & (1 << i))) | 8524 | if (!(encoder->possible_crtcs & (1 << i))) |
8504 | continue; | 8525 | continue; |
8505 | if (!possible_crtc->enabled) { | 8526 | if (possible_crtc->enabled) |
8506 | crtc = possible_crtc; | 8527 | continue; |
8507 | break; | 8528 | /* This can occur when applying the pipe A quirk on resume. */ |
8508 | } | 8529 | if (to_intel_crtc(possible_crtc)->new_enabled) |
8530 | continue; | ||
8531 | |||
8532 | crtc = possible_crtc; | ||
8533 | break; | ||
8509 | } | 8534 | } |
8510 | 8535 | ||
8511 | /* | 8536 | /* |
@@ -8574,15 +8599,11 @@ fail_unlock: | |||
8574 | goto retry; | 8599 | goto retry; |
8575 | } | 8600 | } |
8576 | 8601 | ||
8577 | drm_modeset_drop_locks(ctx); | ||
8578 | drm_modeset_acquire_fini(ctx); | ||
8579 | |||
8580 | return false; | 8602 | return false; |
8581 | } | 8603 | } |
8582 | 8604 | ||
8583 | void intel_release_load_detect_pipe(struct drm_connector *connector, | 8605 | void intel_release_load_detect_pipe(struct drm_connector *connector, |
8584 | struct intel_load_detect_pipe *old, | 8606 | struct intel_load_detect_pipe *old) |
8585 | struct drm_modeset_acquire_ctx *ctx) | ||
8586 | { | 8607 | { |
8587 | struct intel_encoder *intel_encoder = | 8608 | struct intel_encoder *intel_encoder = |
8588 | intel_attached_encoder(connector); | 8609 | intel_attached_encoder(connector); |
@@ -8606,17 +8627,12 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, | |||
8606 | drm_framebuffer_unreference(old->release_fb); | 8627 | drm_framebuffer_unreference(old->release_fb); |
8607 | } | 8628 | } |
8608 | 8629 | ||
8609 | goto unlock; | ||
8610 | return; | 8630 | return; |
8611 | } | 8631 | } |
8612 | 8632 | ||
8613 | /* Switch crtc and encoder back off if necessary */ | 8633 | /* Switch crtc and encoder back off if necessary */ |
8614 | if (old->dpms_mode != DRM_MODE_DPMS_ON) | 8634 | if (old->dpms_mode != DRM_MODE_DPMS_ON) |
8615 | connector->funcs->dpms(connector, old->dpms_mode); | 8635 | connector->funcs->dpms(connector, old->dpms_mode); |
8616 | |||
8617 | unlock: | ||
8618 | drm_modeset_drop_locks(ctx); | ||
8619 | drm_modeset_acquire_fini(ctx); | ||
8620 | } | 8636 | } |
8621 | 8637 | ||
8622 | static int i9xx_pll_refclk(struct drm_device *dev, | 8638 | static int i9xx_pll_refclk(struct drm_device *dev, |
@@ -11700,8 +11716,8 @@ intel_cursor_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
11700 | }; | 11716 | }; |
11701 | const struct drm_rect clip = { | 11717 | const struct drm_rect clip = { |
11702 | /* integer pixels */ | 11718 | /* integer pixels */ |
11703 | .x2 = intel_crtc->config.pipe_src_w, | 11719 | .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w : 0, |
11704 | .y2 = intel_crtc->config.pipe_src_h, | 11720 | .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h : 0, |
11705 | }; | 11721 | }; |
11706 | bool visible; | 11722 | bool visible; |
11707 | int ret; | 11723 | int ret; |
@@ -12488,6 +12504,9 @@ static struct intel_quirk intel_quirks[] = { | |||
12488 | /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ | 12504 | /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ |
12489 | { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, | 12505 | { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, |
12490 | 12506 | ||
12507 | /* Acer C720 Chromebook (Core i3 4005U) */ | ||
12508 | { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present }, | ||
12509 | |||
12491 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ | 12510 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ |
12492 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, | 12511 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, |
12493 | 12512 | ||
@@ -12659,7 +12678,7 @@ static void intel_enable_pipe_a(struct drm_device *dev) | |||
12659 | struct intel_connector *connector; | 12678 | struct intel_connector *connector; |
12660 | struct drm_connector *crt = NULL; | 12679 | struct drm_connector *crt = NULL; |
12661 | struct intel_load_detect_pipe load_detect_temp; | 12680 | struct intel_load_detect_pipe load_detect_temp; |
12662 | struct drm_modeset_acquire_ctx ctx; | 12681 | struct drm_modeset_acquire_ctx *ctx = dev->mode_config.acquire_ctx; |
12663 | 12682 | ||
12664 | /* We can't just switch on the pipe A, we need to set things up with a | 12683 | /* We can't just switch on the pipe A, we need to set things up with a |
12665 | * proper mode and output configuration. As a gross hack, enable pipe A | 12684 | * proper mode and output configuration. As a gross hack, enable pipe A |
@@ -12676,10 +12695,8 @@ static void intel_enable_pipe_a(struct drm_device *dev) | |||
12676 | if (!crt) | 12695 | if (!crt) |
12677 | return; | 12696 | return; |
12678 | 12697 | ||
12679 | if (intel_get_load_detect_pipe(crt, NULL, &load_detect_temp, &ctx)) | 12698 | if (intel_get_load_detect_pipe(crt, NULL, &load_detect_temp, ctx)) |
12680 | intel_release_load_detect_pipe(crt, &load_detect_temp, &ctx); | 12699 | intel_release_load_detect_pipe(crt, &load_detect_temp); |
12681 | |||
12682 | |||
12683 | } | 12700 | } |
12684 | 12701 | ||
12685 | static bool | 12702 | static bool |
@@ -13112,7 +13129,7 @@ void intel_modeset_cleanup(struct drm_device *dev) | |||
13112 | * experience fancy races otherwise. | 13129 | * experience fancy races otherwise. |
13113 | */ | 13130 | */ |
13114 | drm_irq_uninstall(dev); | 13131 | drm_irq_uninstall(dev); |
13115 | cancel_work_sync(&dev_priv->hotplug_work); | 13132 | intel_hpd_cancel_work(dev_priv); |
13116 | dev_priv->pm._irqs_disabled = true; | 13133 | dev_priv->pm._irqs_disabled = true; |
13117 | 13134 | ||
13118 | /* | 13135 | /* |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ee3942f0b068..fdff1d420c14 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1631,6 +1631,10 @@ static void intel_dp_get_config(struct intel_encoder *encoder, | |||
1631 | 1631 | ||
1632 | pipe_config->adjusted_mode.flags |= flags; | 1632 | pipe_config->adjusted_mode.flags |= flags; |
1633 | 1633 | ||
1634 | if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev) && | ||
1635 | tmp & DP_COLOR_RANGE_16_235) | ||
1636 | pipe_config->limited_color_range = true; | ||
1637 | |||
1634 | pipe_config->has_dp_encoder = true; | 1638 | pipe_config->has_dp_encoder = true; |
1635 | 1639 | ||
1636 | intel_dp_get_m_n(crtc, pipe_config); | 1640 | intel_dp_get_m_n(crtc, pipe_config); |
@@ -3553,6 +3557,9 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
3553 | if (WARN_ON(!intel_encoder->base.crtc)) | 3557 | if (WARN_ON(!intel_encoder->base.crtc)) |
3554 | return; | 3558 | return; |
3555 | 3559 | ||
3560 | if (!to_intel_crtc(intel_encoder->base.crtc)->active) | ||
3561 | return; | ||
3562 | |||
3556 | /* Try to read receiver status if the link appears to be up */ | 3563 | /* Try to read receiver status if the link appears to be up */ |
3557 | if (!intel_dp_get_link_status(intel_dp, link_status)) { | 3564 | if (!intel_dp_get_link_status(intel_dp, link_status)) { |
3558 | return; | 3565 | return; |
@@ -3658,24 +3665,12 @@ ironlake_dp_detect(struct intel_dp *intel_dp) | |||
3658 | return intel_dp_detect_dpcd(intel_dp); | 3665 | return intel_dp_detect_dpcd(intel_dp); |
3659 | } | 3666 | } |
3660 | 3667 | ||
3661 | static enum drm_connector_status | 3668 | static int g4x_digital_port_connected(struct drm_device *dev, |
3662 | g4x_dp_detect(struct intel_dp *intel_dp) | 3669 | struct intel_digital_port *intel_dig_port) |
3663 | { | 3670 | { |
3664 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
3665 | struct drm_i915_private *dev_priv = dev->dev_private; | 3671 | struct drm_i915_private *dev_priv = dev->dev_private; |
3666 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
3667 | uint32_t bit; | 3672 | uint32_t bit; |
3668 | 3673 | ||
3669 | /* Can't disconnect eDP, but you can close the lid... */ | ||
3670 | if (is_edp(intel_dp)) { | ||
3671 | enum drm_connector_status status; | ||
3672 | |||
3673 | status = intel_panel_detect(dev); | ||
3674 | if (status == connector_status_unknown) | ||
3675 | status = connector_status_connected; | ||
3676 | return status; | ||
3677 | } | ||
3678 | |||
3679 | if (IS_VALLEYVIEW(dev)) { | 3674 | if (IS_VALLEYVIEW(dev)) { |
3680 | switch (intel_dig_port->port) { | 3675 | switch (intel_dig_port->port) { |
3681 | case PORT_B: | 3676 | case PORT_B: |
@@ -3688,7 +3683,7 @@ g4x_dp_detect(struct intel_dp *intel_dp) | |||
3688 | bit = PORTD_HOTPLUG_LIVE_STATUS_VLV; | 3683 | bit = PORTD_HOTPLUG_LIVE_STATUS_VLV; |
3689 | break; | 3684 | break; |
3690 | default: | 3685 | default: |
3691 | return connector_status_unknown; | 3686 | return -EINVAL; |
3692 | } | 3687 | } |
3693 | } else { | 3688 | } else { |
3694 | switch (intel_dig_port->port) { | 3689 | switch (intel_dig_port->port) { |
@@ -3702,11 +3697,36 @@ g4x_dp_detect(struct intel_dp *intel_dp) | |||
3702 | bit = PORTD_HOTPLUG_LIVE_STATUS_G4X; | 3697 | bit = PORTD_HOTPLUG_LIVE_STATUS_G4X; |
3703 | break; | 3698 | break; |
3704 | default: | 3699 | default: |
3705 | return connector_status_unknown; | 3700 | return -EINVAL; |
3706 | } | 3701 | } |
3707 | } | 3702 | } |
3708 | 3703 | ||
3709 | if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0) | 3704 | if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0) |
3705 | return 0; | ||
3706 | return 1; | ||
3707 | } | ||
3708 | |||
3709 | static enum drm_connector_status | ||
3710 | g4x_dp_detect(struct intel_dp *intel_dp) | ||
3711 | { | ||
3712 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
3713 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
3714 | int ret; | ||
3715 | |||
3716 | /* Can't disconnect eDP, but you can close the lid... */ | ||
3717 | if (is_edp(intel_dp)) { | ||
3718 | enum drm_connector_status status; | ||
3719 | |||
3720 | status = intel_panel_detect(dev); | ||
3721 | if (status == connector_status_unknown) | ||
3722 | status = connector_status_connected; | ||
3723 | return status; | ||
3724 | } | ||
3725 | |||
3726 | ret = g4x_digital_port_connected(dev, intel_dig_port); | ||
3727 | if (ret == -EINVAL) | ||
3728 | return connector_status_unknown; | ||
3729 | else if (ret == 0) | ||
3710 | return connector_status_disconnected; | 3730 | return connector_status_disconnected; |
3711 | 3731 | ||
3712 | return intel_dp_detect_dpcd(intel_dp); | 3732 | return intel_dp_detect_dpcd(intel_dp); |
@@ -4003,6 +4023,16 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
4003 | kfree(intel_dig_port); | 4023 | kfree(intel_dig_port); |
4004 | } | 4024 | } |
4005 | 4025 | ||
4026 | static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) | ||
4027 | { | ||
4028 | struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); | ||
4029 | |||
4030 | if (!is_edp(intel_dp)) | ||
4031 | return; | ||
4032 | |||
4033 | edp_panel_vdd_off_sync(intel_dp); | ||
4034 | } | ||
4035 | |||
4006 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) | 4036 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) |
4007 | { | 4037 | { |
4008 | intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); | 4038 | intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); |
@@ -4037,18 +4067,30 @@ bool | |||
4037 | intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | 4067 | intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) |
4038 | { | 4068 | { |
4039 | struct intel_dp *intel_dp = &intel_dig_port->dp; | 4069 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
4070 | struct intel_encoder *intel_encoder = &intel_dig_port->base; | ||
4040 | struct drm_device *dev = intel_dig_port->base.base.dev; | 4071 | struct drm_device *dev = intel_dig_port->base.base.dev; |
4041 | struct drm_i915_private *dev_priv = dev->dev_private; | 4072 | struct drm_i915_private *dev_priv = dev->dev_private; |
4042 | int ret; | 4073 | enum intel_display_power_domain power_domain; |
4074 | bool ret = true; | ||
4075 | |||
4043 | if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) | 4076 | if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) |
4044 | intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; | 4077 | intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; |
4045 | 4078 | ||
4046 | DRM_DEBUG_KMS("got hpd irq on port %d - %s\n", intel_dig_port->port, | 4079 | DRM_DEBUG_KMS("got hpd irq on port %d - %s\n", intel_dig_port->port, |
4047 | long_hpd ? "long" : "short"); | 4080 | long_hpd ? "long" : "short"); |
4048 | 4081 | ||
4082 | power_domain = intel_display_port_power_domain(intel_encoder); | ||
4083 | intel_display_power_get(dev_priv, power_domain); | ||
4084 | |||
4049 | if (long_hpd) { | 4085 | if (long_hpd) { |
4050 | if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) | 4086 | |
4051 | goto mst_fail; | 4087 | if (HAS_PCH_SPLIT(dev)) { |
4088 | if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) | ||
4089 | goto mst_fail; | ||
4090 | } else { | ||
4091 | if (g4x_digital_port_connected(dev, intel_dig_port) != 1) | ||
4092 | goto mst_fail; | ||
4093 | } | ||
4052 | 4094 | ||
4053 | if (!intel_dp_get_dpcd(intel_dp)) { | 4095 | if (!intel_dp_get_dpcd(intel_dp)) { |
4054 | goto mst_fail; | 4096 | goto mst_fail; |
@@ -4061,8 +4103,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | |||
4061 | 4103 | ||
4062 | } else { | 4104 | } else { |
4063 | if (intel_dp->is_mst) { | 4105 | if (intel_dp->is_mst) { |
4064 | ret = intel_dp_check_mst_status(intel_dp); | 4106 | if (intel_dp_check_mst_status(intel_dp) == -EINVAL) |
4065 | if (ret == -EINVAL) | ||
4066 | goto mst_fail; | 4107 | goto mst_fail; |
4067 | } | 4108 | } |
4068 | 4109 | ||
@@ -4076,7 +4117,8 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | |||
4076 | drm_modeset_unlock(&dev->mode_config.connection_mutex); | 4117 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
4077 | } | 4118 | } |
4078 | } | 4119 | } |
4079 | return false; | 4120 | ret = false; |
4121 | goto put_power; | ||
4080 | mst_fail: | 4122 | mst_fail: |
4081 | /* if we were in MST mode, and device is not there get out of MST mode */ | 4123 | /* if we were in MST mode, and device is not there get out of MST mode */ |
4082 | if (intel_dp->is_mst) { | 4124 | if (intel_dp->is_mst) { |
@@ -4084,7 +4126,10 @@ mst_fail: | |||
4084 | intel_dp->is_mst = false; | 4126 | intel_dp->is_mst = false; |
4085 | drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); | 4127 | drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); |
4086 | } | 4128 | } |
4087 | return true; | 4129 | put_power: |
4130 | intel_display_power_put(dev_priv, power_domain); | ||
4131 | |||
4132 | return ret; | ||
4088 | } | 4133 | } |
4089 | 4134 | ||
4090 | /* Return which DP Port should be selected for Transcoder DP control */ | 4135 | /* Return which DP Port should be selected for Transcoder DP control */ |
@@ -4722,6 +4767,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port) | |||
4722 | intel_encoder->disable = intel_disable_dp; | 4767 | intel_encoder->disable = intel_disable_dp; |
4723 | intel_encoder->get_hw_state = intel_dp_get_hw_state; | 4768 | intel_encoder->get_hw_state = intel_dp_get_hw_state; |
4724 | intel_encoder->get_config = intel_dp_get_config; | 4769 | intel_encoder->get_config = intel_dp_get_config; |
4770 | intel_encoder->suspend = intel_dp_encoder_suspend; | ||
4725 | if (IS_CHERRYVIEW(dev)) { | 4771 | if (IS_CHERRYVIEW(dev)) { |
4726 | intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable; | 4772 | intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable; |
4727 | intel_encoder->pre_enable = chv_pre_enable_dp; | 4773 | intel_encoder->pre_enable = chv_pre_enable_dp; |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 4b2664bd5b81..b8c8bbd8e5f9 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -153,6 +153,12 @@ struct intel_encoder { | |||
153 | * be set correctly before calling this function. */ | 153 | * be set correctly before calling this function. */ |
154 | void (*get_config)(struct intel_encoder *, | 154 | void (*get_config)(struct intel_encoder *, |
155 | struct intel_crtc_config *pipe_config); | 155 | struct intel_crtc_config *pipe_config); |
156 | /* | ||
157 | * Called during system suspend after all pending requests for the | ||
158 | * encoder are flushed (for example for DP AUX transactions) and | ||
159 | * device interrupts are disabled. | ||
160 | */ | ||
161 | void (*suspend)(struct intel_encoder *); | ||
156 | int crtc_mask; | 162 | int crtc_mask; |
157 | enum hpd_pin hpd_pin; | 163 | enum hpd_pin hpd_pin; |
158 | }; | 164 | }; |
@@ -830,8 +836,7 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, | |||
830 | struct intel_load_detect_pipe *old, | 836 | struct intel_load_detect_pipe *old, |
831 | struct drm_modeset_acquire_ctx *ctx); | 837 | struct drm_modeset_acquire_ctx *ctx); |
832 | void intel_release_load_detect_pipe(struct drm_connector *connector, | 838 | void intel_release_load_detect_pipe(struct drm_connector *connector, |
833 | struct intel_load_detect_pipe *old, | 839 | struct intel_load_detect_pipe *old); |
834 | struct drm_modeset_acquire_ctx *ctx); | ||
835 | int intel_pin_and_fence_fb_obj(struct drm_device *dev, | 840 | int intel_pin_and_fence_fb_obj(struct drm_device *dev, |
836 | struct drm_i915_gem_object *obj, | 841 | struct drm_i915_gem_object *obj, |
837 | struct intel_engine_cs *pipelined); | 842 | struct intel_engine_cs *pipelined); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f9151f6641d9..5a9de21637b7 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -712,7 +712,8 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
712 | struct intel_crtc_config *pipe_config) | 712 | struct intel_crtc_config *pipe_config) |
713 | { | 713 | { |
714 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); | 714 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
715 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | 715 | struct drm_device *dev = encoder->base.dev; |
716 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
716 | u32 tmp, flags = 0; | 717 | u32 tmp, flags = 0; |
717 | int dotclock; | 718 | int dotclock; |
718 | 719 | ||
@@ -731,9 +732,13 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
731 | if (tmp & HDMI_MODE_SELECT_HDMI) | 732 | if (tmp & HDMI_MODE_SELECT_HDMI) |
732 | pipe_config->has_hdmi_sink = true; | 733 | pipe_config->has_hdmi_sink = true; |
733 | 734 | ||
734 | if (tmp & HDMI_MODE_SELECT_HDMI) | 735 | if (tmp & SDVO_AUDIO_ENABLE) |
735 | pipe_config->has_audio = true; | 736 | pipe_config->has_audio = true; |
736 | 737 | ||
738 | if (!HAS_PCH_SPLIT(dev) && | ||
739 | tmp & HDMI_COLOR_RANGE_16_235) | ||
740 | pipe_config->limited_color_range = true; | ||
741 | |||
737 | pipe_config->adjusted_mode.flags |= flags; | 742 | pipe_config->adjusted_mode.flags |= flags; |
738 | 743 | ||
739 | if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) | 744 | if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 881361c0f27e..fdf40267249c 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -538,7 +538,7 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = { | |||
538 | .destroy = intel_encoder_destroy, | 538 | .destroy = intel_encoder_destroy, |
539 | }; | 539 | }; |
540 | 540 | ||
541 | static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id) | 541 | static int intel_no_lvds_dmi_callback(const struct dmi_system_id *id) |
542 | { | 542 | { |
543 | DRM_INFO("Skipping LVDS initialization for %s\n", id->ident); | 543 | DRM_INFO("Skipping LVDS initialization for %s\n", id->ident); |
544 | return 1; | 544 | return 1; |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 59b028f0b1e8..8e374449c6b5 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -801,7 +801,7 @@ static void pch_enable_backlight(struct intel_connector *connector) | |||
801 | 801 | ||
802 | cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); | 802 | cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); |
803 | if (cpu_ctl2 & BLM_PWM_ENABLE) { | 803 | if (cpu_ctl2 & BLM_PWM_ENABLE) { |
804 | WARN(1, "cpu backlight already enabled\n"); | 804 | DRM_DEBUG_KMS("cpu backlight already enabled\n"); |
805 | cpu_ctl2 &= ~BLM_PWM_ENABLE; | 805 | cpu_ctl2 &= ~BLM_PWM_ENABLE; |
806 | I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); | 806 | I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); |
807 | } | 807 | } |
@@ -845,7 +845,7 @@ static void i9xx_enable_backlight(struct intel_connector *connector) | |||
845 | 845 | ||
846 | ctl = I915_READ(BLC_PWM_CTL); | 846 | ctl = I915_READ(BLC_PWM_CTL); |
847 | if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) { | 847 | if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) { |
848 | WARN(1, "backlight already enabled\n"); | 848 | DRM_DEBUG_KMS("backlight already enabled\n"); |
849 | I915_WRITE(BLC_PWM_CTL, 0); | 849 | I915_WRITE(BLC_PWM_CTL, 0); |
850 | } | 850 | } |
851 | 851 | ||
@@ -876,7 +876,7 @@ static void i965_enable_backlight(struct intel_connector *connector) | |||
876 | 876 | ||
877 | ctl2 = I915_READ(BLC_PWM_CTL2); | 877 | ctl2 = I915_READ(BLC_PWM_CTL2); |
878 | if (ctl2 & BLM_PWM_ENABLE) { | 878 | if (ctl2 & BLM_PWM_ENABLE) { |
879 | WARN(1, "backlight already enabled\n"); | 879 | DRM_DEBUG_KMS("backlight already enabled\n"); |
880 | ctl2 &= ~BLM_PWM_ENABLE; | 880 | ctl2 &= ~BLM_PWM_ENABLE; |
881 | I915_WRITE(BLC_PWM_CTL2, ctl2); | 881 | I915_WRITE(BLC_PWM_CTL2, ctl2); |
882 | } | 882 | } |
@@ -910,7 +910,7 @@ static void vlv_enable_backlight(struct intel_connector *connector) | |||
910 | 910 | ||
911 | ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); | 911 | ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); |
912 | if (ctl2 & BLM_PWM_ENABLE) { | 912 | if (ctl2 & BLM_PWM_ENABLE) { |
913 | WARN(1, "backlight already enabled\n"); | 913 | DRM_DEBUG_KMS("backlight already enabled\n"); |
914 | ctl2 &= ~BLM_PWM_ENABLE; | 914 | ctl2 &= ~BLM_PWM_ENABLE; |
915 | I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); | 915 | I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); |
916 | } | 916 | } |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 16371a444426..47a126a0493f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1363,54 +1363,66 @@ i965_dispatch_execbuffer(struct intel_engine_cs *ring, | |||
1363 | 1363 | ||
1364 | /* Just userspace ABI convention to limit the wa batch bo to a resonable size */ | 1364 | /* Just userspace ABI convention to limit the wa batch bo to a resonable size */ |
1365 | #define I830_BATCH_LIMIT (256*1024) | 1365 | #define I830_BATCH_LIMIT (256*1024) |
1366 | #define I830_TLB_ENTRIES (2) | ||
1367 | #define I830_WA_SIZE max(I830_TLB_ENTRIES*4096, I830_BATCH_LIMIT) | ||
1366 | static int | 1368 | static int |
1367 | i830_dispatch_execbuffer(struct intel_engine_cs *ring, | 1369 | i830_dispatch_execbuffer(struct intel_engine_cs *ring, |
1368 | u64 offset, u32 len, | 1370 | u64 offset, u32 len, |
1369 | unsigned flags) | 1371 | unsigned flags) |
1370 | { | 1372 | { |
1373 | u32 cs_offset = ring->scratch.gtt_offset; | ||
1371 | int ret; | 1374 | int ret; |
1372 | 1375 | ||
1373 | if (flags & I915_DISPATCH_PINNED) { | 1376 | ret = intel_ring_begin(ring, 6); |
1374 | ret = intel_ring_begin(ring, 4); | 1377 | if (ret) |
1375 | if (ret) | 1378 | return ret; |
1376 | return ret; | ||
1377 | 1379 | ||
1378 | intel_ring_emit(ring, MI_BATCH_BUFFER); | 1380 | /* Evict the invalid PTE TLBs */ |
1379 | intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | 1381 | intel_ring_emit(ring, COLOR_BLT_CMD | BLT_WRITE_RGBA); |
1380 | intel_ring_emit(ring, offset + len - 8); | 1382 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_COLOR_COPY | 4096); |
1381 | intel_ring_emit(ring, MI_NOOP); | 1383 | intel_ring_emit(ring, I830_TLB_ENTRIES << 16 | 4); /* load each page */ |
1382 | intel_ring_advance(ring); | 1384 | intel_ring_emit(ring, cs_offset); |
1383 | } else { | 1385 | intel_ring_emit(ring, 0xdeadbeef); |
1384 | u32 cs_offset = ring->scratch.gtt_offset; | 1386 | intel_ring_emit(ring, MI_NOOP); |
1387 | intel_ring_advance(ring); | ||
1385 | 1388 | ||
1389 | if ((flags & I915_DISPATCH_PINNED) == 0) { | ||
1386 | if (len > I830_BATCH_LIMIT) | 1390 | if (len > I830_BATCH_LIMIT) |
1387 | return -ENOSPC; | 1391 | return -ENOSPC; |
1388 | 1392 | ||
1389 | ret = intel_ring_begin(ring, 9+3); | 1393 | ret = intel_ring_begin(ring, 6 + 2); |
1390 | if (ret) | 1394 | if (ret) |
1391 | return ret; | 1395 | return ret; |
1392 | /* Blit the batch (which has now all relocs applied) to the stable batch | 1396 | |
1393 | * scratch bo area (so that the CS never stumbles over its tlb | 1397 | /* Blit the batch (which has now all relocs applied) to the |
1394 | * invalidation bug) ... */ | 1398 | * stable batch scratch bo area (so that the CS never |
1395 | intel_ring_emit(ring, XY_SRC_COPY_BLT_CMD | | 1399 | * stumbles over its tlb invalidation bug) ... |
1396 | XY_SRC_COPY_BLT_WRITE_ALPHA | | 1400 | */ |
1397 | XY_SRC_COPY_BLT_WRITE_RGB); | 1401 | intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA); |
1398 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_GXCOPY | 4096); | 1402 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096); |
1399 | intel_ring_emit(ring, 0); | 1403 | intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 4096); |
1400 | intel_ring_emit(ring, (DIV_ROUND_UP(len, 4096) << 16) | 1024); | ||
1401 | intel_ring_emit(ring, cs_offset); | 1404 | intel_ring_emit(ring, cs_offset); |
1402 | intel_ring_emit(ring, 0); | ||
1403 | intel_ring_emit(ring, 4096); | 1405 | intel_ring_emit(ring, 4096); |
1404 | intel_ring_emit(ring, offset); | 1406 | intel_ring_emit(ring, offset); |
1407 | |||
1405 | intel_ring_emit(ring, MI_FLUSH); | 1408 | intel_ring_emit(ring, MI_FLUSH); |
1409 | intel_ring_emit(ring, MI_NOOP); | ||
1410 | intel_ring_advance(ring); | ||
1406 | 1411 | ||
1407 | /* ... and execute it. */ | 1412 | /* ... and execute it. */ |
1408 | intel_ring_emit(ring, MI_BATCH_BUFFER); | 1413 | offset = cs_offset; |
1409 | intel_ring_emit(ring, cs_offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | ||
1410 | intel_ring_emit(ring, cs_offset + len - 8); | ||
1411 | intel_ring_advance(ring); | ||
1412 | } | 1414 | } |
1413 | 1415 | ||
1416 | ret = intel_ring_begin(ring, 4); | ||
1417 | if (ret) | ||
1418 | return ret; | ||
1419 | |||
1420 | intel_ring_emit(ring, MI_BATCH_BUFFER); | ||
1421 | intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | ||
1422 | intel_ring_emit(ring, offset + len - 8); | ||
1423 | intel_ring_emit(ring, MI_NOOP); | ||
1424 | intel_ring_advance(ring); | ||
1425 | |||
1414 | return 0; | 1426 | return 0; |
1415 | } | 1427 | } |
1416 | 1428 | ||
@@ -2200,7 +2212,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) | |||
2200 | 2212 | ||
2201 | /* Workaround batchbuffer to combat CS tlb bug. */ | 2213 | /* Workaround batchbuffer to combat CS tlb bug. */ |
2202 | if (HAS_BROKEN_CS_TLB(dev)) { | 2214 | if (HAS_BROKEN_CS_TLB(dev)) { |
2203 | obj = i915_gem_alloc_object(dev, I830_BATCH_LIMIT); | 2215 | obj = i915_gem_alloc_object(dev, I830_WA_SIZE); |
2204 | if (obj == NULL) { | 2216 | if (obj == NULL) { |
2205 | DRM_ERROR("Failed to allocate batch bo\n"); | 2217 | DRM_ERROR("Failed to allocate batch bo\n"); |
2206 | return -ENOMEM; | 2218 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index e211eef4b7e4..c14341ca3ef9 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -854,6 +854,10 @@ intel_enable_tv(struct intel_encoder *encoder) | |||
854 | struct drm_device *dev = encoder->base.dev; | 854 | struct drm_device *dev = encoder->base.dev; |
855 | struct drm_i915_private *dev_priv = dev->dev_private; | 855 | struct drm_i915_private *dev_priv = dev->dev_private; |
856 | 856 | ||
857 | /* Prevents vblank waits from timing out in intel_tv_detect_type() */ | ||
858 | intel_wait_for_vblank(encoder->base.dev, | ||
859 | to_intel_crtc(encoder->base.crtc)->pipe); | ||
860 | |||
857 | I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); | 861 | I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); |
858 | } | 862 | } |
859 | 863 | ||
@@ -1311,6 +1315,7 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1311 | { | 1315 | { |
1312 | struct drm_display_mode mode; | 1316 | struct drm_display_mode mode; |
1313 | struct intel_tv *intel_tv = intel_attached_tv(connector); | 1317 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
1318 | enum drm_connector_status status; | ||
1314 | int type; | 1319 | int type; |
1315 | 1320 | ||
1316 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force=%d\n", | 1321 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force=%d\n", |
@@ -1323,16 +1328,24 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1323 | struct intel_load_detect_pipe tmp; | 1328 | struct intel_load_detect_pipe tmp; |
1324 | struct drm_modeset_acquire_ctx ctx; | 1329 | struct drm_modeset_acquire_ctx ctx; |
1325 | 1330 | ||
1331 | drm_modeset_acquire_init(&ctx, 0); | ||
1332 | |||
1326 | if (intel_get_load_detect_pipe(connector, &mode, &tmp, &ctx)) { | 1333 | if (intel_get_load_detect_pipe(connector, &mode, &tmp, &ctx)) { |
1327 | type = intel_tv_detect_type(intel_tv, connector); | 1334 | type = intel_tv_detect_type(intel_tv, connector); |
1328 | intel_release_load_detect_pipe(connector, &tmp, &ctx); | 1335 | intel_release_load_detect_pipe(connector, &tmp); |
1336 | status = type < 0 ? | ||
1337 | connector_status_disconnected : | ||
1338 | connector_status_connected; | ||
1329 | } else | 1339 | } else |
1330 | return connector_status_unknown; | 1340 | status = connector_status_unknown; |
1341 | |||
1342 | drm_modeset_drop_locks(&ctx); | ||
1343 | drm_modeset_acquire_fini(&ctx); | ||
1331 | } else | 1344 | } else |
1332 | return connector->status; | 1345 | return connector->status; |
1333 | 1346 | ||
1334 | if (type < 0) | 1347 | if (status != connector_status_connected) |
1335 | return connector_status_disconnected; | 1348 | return status; |
1336 | 1349 | ||
1337 | intel_tv->type = type; | 1350 | intel_tv->type = type; |
1338 | intel_tv_find_better_format(connector); | 1351 | intel_tv_find_better_format(connector); |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index a125a7e32742..c6c9b02e0ada 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c | |||
@@ -258,28 +258,30 @@ static void set_hdmi_pdev(struct drm_device *dev, | |||
258 | priv->hdmi_pdev = pdev; | 258 | priv->hdmi_pdev = pdev; |
259 | } | 259 | } |
260 | 260 | ||
261 | #ifdef CONFIG_OF | ||
262 | static int get_gpio(struct device *dev, struct device_node *of_node, const char *name) | ||
263 | { | ||
264 | int gpio = of_get_named_gpio(of_node, name, 0); | ||
265 | if (gpio < 0) { | ||
266 | char name2[32]; | ||
267 | snprintf(name2, sizeof(name2), "%s-gpio", name); | ||
268 | gpio = of_get_named_gpio(of_node, name2, 0); | ||
269 | if (gpio < 0) { | ||
270 | dev_err(dev, "failed to get gpio: %s (%d)\n", | ||
271 | name, gpio); | ||
272 | gpio = -1; | ||
273 | } | ||
274 | } | ||
275 | return gpio; | ||
276 | } | ||
277 | #endif | ||
278 | |||
261 | static int hdmi_bind(struct device *dev, struct device *master, void *data) | 279 | static int hdmi_bind(struct device *dev, struct device *master, void *data) |
262 | { | 280 | { |
263 | static struct hdmi_platform_config config = {}; | 281 | static struct hdmi_platform_config config = {}; |
264 | #ifdef CONFIG_OF | 282 | #ifdef CONFIG_OF |
265 | struct device_node *of_node = dev->of_node; | 283 | struct device_node *of_node = dev->of_node; |
266 | 284 | ||
267 | int get_gpio(const char *name) | ||
268 | { | ||
269 | int gpio = of_get_named_gpio(of_node, name, 0); | ||
270 | if (gpio < 0) { | ||
271 | char name2[32]; | ||
272 | snprintf(name2, sizeof(name2), "%s-gpio", name); | ||
273 | gpio = of_get_named_gpio(of_node, name2, 0); | ||
274 | if (gpio < 0) { | ||
275 | dev_err(dev, "failed to get gpio: %s (%d)\n", | ||
276 | name, gpio); | ||
277 | gpio = -1; | ||
278 | } | ||
279 | } | ||
280 | return gpio; | ||
281 | } | ||
282 | |||
283 | if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) { | 285 | if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) { |
284 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; | 286 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; |
285 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; | 287 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; |
@@ -312,12 +314,12 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
312 | } | 314 | } |
313 | 315 | ||
314 | config.mmio_name = "core_physical"; | 316 | config.mmio_name = "core_physical"; |
315 | config.ddc_clk_gpio = get_gpio("qcom,hdmi-tx-ddc-clk"); | 317 | config.ddc_clk_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk"); |
316 | config.ddc_data_gpio = get_gpio("qcom,hdmi-tx-ddc-data"); | 318 | config.ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data"); |
317 | config.hpd_gpio = get_gpio("qcom,hdmi-tx-hpd"); | 319 | config.hpd_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd"); |
318 | config.mux_en_gpio = get_gpio("qcom,hdmi-tx-mux-en"); | 320 | config.mux_en_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-en"); |
319 | config.mux_sel_gpio = get_gpio("qcom,hdmi-tx-mux-sel"); | 321 | config.mux_sel_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-sel"); |
320 | config.mux_lpm_gpio = get_gpio("qcom,hdmi-tx-mux-lpm"); | 322 | config.mux_lpm_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-lpm"); |
321 | 323 | ||
322 | #else | 324 | #else |
323 | static const char *hpd_clk_names[] = { | 325 | static const char *hpd_clk_names[] = { |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c index 902d7685d441..f408b69486a8 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c | |||
@@ -15,19 +15,25 @@ | |||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifdef CONFIG_COMMON_CLK | ||
18 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
19 | #include <linux/clk-provider.h> | 20 | #include <linux/clk-provider.h> |
21 | #endif | ||
20 | 22 | ||
21 | #include "hdmi.h" | 23 | #include "hdmi.h" |
22 | 24 | ||
23 | struct hdmi_phy_8960 { | 25 | struct hdmi_phy_8960 { |
24 | struct hdmi_phy base; | 26 | struct hdmi_phy base; |
25 | struct hdmi *hdmi; | 27 | struct hdmi *hdmi; |
28 | #ifdef CONFIG_COMMON_CLK | ||
26 | struct clk_hw pll_hw; | 29 | struct clk_hw pll_hw; |
27 | struct clk *pll; | 30 | struct clk *pll; |
28 | unsigned long pixclk; | 31 | unsigned long pixclk; |
32 | #endif | ||
29 | }; | 33 | }; |
30 | #define to_hdmi_phy_8960(x) container_of(x, struct hdmi_phy_8960, base) | 34 | #define to_hdmi_phy_8960(x) container_of(x, struct hdmi_phy_8960, base) |
35 | |||
36 | #ifdef CONFIG_COMMON_CLK | ||
31 | #define clk_to_phy(x) container_of(x, struct hdmi_phy_8960, pll_hw) | 37 | #define clk_to_phy(x) container_of(x, struct hdmi_phy_8960, pll_hw) |
32 | 38 | ||
33 | /* | 39 | /* |
@@ -374,7 +380,7 @@ static struct clk_init_data pll_init = { | |||
374 | .parent_names = hdmi_pll_parents, | 380 | .parent_names = hdmi_pll_parents, |
375 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), | 381 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), |
376 | }; | 382 | }; |
377 | 383 | #endif | |
378 | 384 | ||
379 | /* | 385 | /* |
380 | * HDMI Phy: | 386 | * HDMI Phy: |
@@ -480,12 +486,15 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
480 | { | 486 | { |
481 | struct hdmi_phy_8960 *phy_8960; | 487 | struct hdmi_phy_8960 *phy_8960; |
482 | struct hdmi_phy *phy = NULL; | 488 | struct hdmi_phy *phy = NULL; |
483 | int ret, i; | 489 | int ret; |
490 | #ifdef CONFIG_COMMON_CLK | ||
491 | int i; | ||
484 | 492 | ||
485 | /* sanity check: */ | 493 | /* sanity check: */ |
486 | for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) | 494 | for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) |
487 | if (WARN_ON(freqtbl[i].rate < freqtbl[i+1].rate)) | 495 | if (WARN_ON(freqtbl[i].rate < freqtbl[i+1].rate)) |
488 | return ERR_PTR(-EINVAL); | 496 | return ERR_PTR(-EINVAL); |
497 | #endif | ||
489 | 498 | ||
490 | phy_8960 = kzalloc(sizeof(*phy_8960), GFP_KERNEL); | 499 | phy_8960 = kzalloc(sizeof(*phy_8960), GFP_KERNEL); |
491 | if (!phy_8960) { | 500 | if (!phy_8960) { |
@@ -499,6 +508,7 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
499 | 508 | ||
500 | phy_8960->hdmi = hdmi; | 509 | phy_8960->hdmi = hdmi; |
501 | 510 | ||
511 | #ifdef CONFIG_COMMON_CLK | ||
502 | phy_8960->pll_hw.init = &pll_init; | 512 | phy_8960->pll_hw.init = &pll_init; |
503 | phy_8960->pll = devm_clk_register(hdmi->dev->dev, &phy_8960->pll_hw); | 513 | phy_8960->pll = devm_clk_register(hdmi->dev->dev, &phy_8960->pll_hw); |
504 | if (IS_ERR(phy_8960->pll)) { | 514 | if (IS_ERR(phy_8960->pll)) { |
@@ -506,6 +516,7 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
506 | phy_8960->pll = NULL; | 516 | phy_8960->pll = NULL; |
507 | goto fail; | 517 | goto fail; |
508 | } | 518 | } |
519 | #endif | ||
509 | 520 | ||
510 | return phy; | 521 | return phy; |
511 | 522 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c index 74cebb51e8c2..c6c80ea28c35 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | |||
@@ -397,6 +397,7 @@ static void mdp4_crtc_prepare(struct drm_crtc *crtc) | |||
397 | struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); | 397 | struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); |
398 | DBG("%s", mdp4_crtc->name); | 398 | DBG("%s", mdp4_crtc->name); |
399 | /* make sure we hold a ref to mdp clks while setting up mode: */ | 399 | /* make sure we hold a ref to mdp clks while setting up mode: */ |
400 | drm_crtc_vblank_get(crtc); | ||
400 | mdp4_enable(get_kms(crtc)); | 401 | mdp4_enable(get_kms(crtc)); |
401 | mdp4_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 402 | mdp4_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
402 | } | 403 | } |
@@ -407,6 +408,7 @@ static void mdp4_crtc_commit(struct drm_crtc *crtc) | |||
407 | crtc_flush(crtc); | 408 | crtc_flush(crtc); |
408 | /* drop the ref to mdp clk's that we got in prepare: */ | 409 | /* drop the ref to mdp clk's that we got in prepare: */ |
409 | mdp4_disable(get_kms(crtc)); | 410 | mdp4_disable(get_kms(crtc)); |
411 | drm_crtc_vblank_put(crtc); | ||
410 | } | 412 | } |
411 | 413 | ||
412 | static int mdp4_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, | 414 | static int mdp4_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index b447c01ad89c..fcf95680413d 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -52,7 +52,7 @@ module_param(reglog, bool, 0600); | |||
52 | #define reglog 0 | 52 | #define reglog 0 |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | static char *vram; | 55 | static char *vram = "16m"; |
56 | MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU"); | 56 | MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU"); |
57 | module_param(vram, charp, 0); | 57 | module_param(vram, charp, 0); |
58 | 58 | ||
@@ -974,12 +974,11 @@ static int msm_pdev_probe(struct platform_device *pdev) | |||
974 | 974 | ||
975 | for (i = 0; i < ARRAY_SIZE(devnames); i++) { | 975 | for (i = 0; i < ARRAY_SIZE(devnames); i++) { |
976 | struct device *dev; | 976 | struct device *dev; |
977 | int ret; | ||
978 | 977 | ||
979 | dev = bus_find_device_by_name(&platform_bus_type, | 978 | dev = bus_find_device_by_name(&platform_bus_type, |
980 | NULL, devnames[i]); | 979 | NULL, devnames[i]); |
981 | if (!dev) { | 980 | if (!dev) { |
982 | dev_info(master, "still waiting for %s\n", devnames[i]); | 981 | dev_info(&pdev->dev, "still waiting for %s\n", devnames[i]); |
983 | return -EPROBE_DEFER; | 982 | return -EPROBE_DEFER; |
984 | } | 983 | } |
985 | 984 | ||
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 9c5221ce391a..ab5bfd2d0ebf 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c | |||
@@ -143,7 +143,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, | |||
143 | ret = msm_gem_get_iova_locked(fbdev->bo, 0, &paddr); | 143 | ret = msm_gem_get_iova_locked(fbdev->bo, 0, &paddr); |
144 | if (ret) { | 144 | if (ret) { |
145 | dev_err(dev->dev, "failed to get buffer obj iova: %d\n", ret); | 145 | dev_err(dev->dev, "failed to get buffer obj iova: %d\n", ret); |
146 | goto fail; | 146 | goto fail_unlock; |
147 | } | 147 | } |
148 | 148 | ||
149 | fbi = framebuffer_alloc(0, dev->dev); | 149 | fbi = framebuffer_alloc(0, dev->dev); |
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 099af483fdf0..7acdaa5688b7 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c | |||
@@ -27,8 +27,8 @@ struct msm_iommu { | |||
27 | static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev, | 27 | static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev, |
28 | unsigned long iova, int flags, void *arg) | 28 | unsigned long iova, int flags, void *arg) |
29 | { | 29 | { |
30 | DBG("*** fault: iova=%08lx, flags=%d", iova, flags); | 30 | pr_warn_ratelimited("*** fault: iova=%08lx, flags=%d\n", iova, flags); |
31 | return -ENOSYS; | 31 | return 0; |
32 | } | 32 | } |
33 | 33 | ||
34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | 34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) |
diff --git a/drivers/gpu/drm/nouveau/core/core/parent.c b/drivers/gpu/drm/nouveau/core/core/parent.c index 8701968a9743..30a2911878f8 100644 --- a/drivers/gpu/drm/nouveau/core/core/parent.c +++ b/drivers/gpu/drm/nouveau/core/core/parent.c | |||
@@ -86,7 +86,7 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) | |||
86 | sclass = nv_parent(parent)->sclass; | 86 | sclass = nv_parent(parent)->sclass; |
87 | while (sclass) { | 87 | while (sclass) { |
88 | if (++nr < size) | 88 | if (++nr < size) |
89 | lclass[nr] = sclass->oclass->handle; | 89 | lclass[nr] = sclass->oclass->handle & 0xffff; |
90 | sclass = sclass->sclass; | 90 | sclass = sclass->sclass; |
91 | } | 91 | } |
92 | 92 | ||
@@ -96,7 +96,7 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) | |||
96 | if (engine && (oclass = engine->sclass)) { | 96 | if (engine && (oclass = engine->sclass)) { |
97 | while (oclass->ofuncs) { | 97 | while (oclass->ofuncs) { |
98 | if (++nr < size) | 98 | if (++nr < size) |
99 | lclass[nr] = oclass->handle; | 99 | lclass[nr] = oclass->handle & 0xffff; |
100 | oclass++; | 100 | oclass++; |
101 | } | 101 | } |
102 | } | 102 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c index 0a44459844e3..05a278bab247 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | |||
@@ -200,7 +200,6 @@ nvc0_bar_init(struct nouveau_object *object) | |||
200 | 200 | ||
201 | nv_mask(priv, 0x000200, 0x00000100, 0x00000000); | 201 | nv_mask(priv, 0x000200, 0x00000100, 0x00000000); |
202 | nv_mask(priv, 0x000200, 0x00000100, 0x00000100); | 202 | nv_mask(priv, 0x000200, 0x00000100, 0x00000100); |
203 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); | ||
204 | 203 | ||
205 | nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); | 204 | nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); |
206 | if (priv->bar[0].mem) | 205 | if (priv->bar[0].mem) |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c index b19a2b3c1081..32f28dc73ef2 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c | |||
@@ -60,6 +60,7 @@ nvc0_fb_init(struct nouveau_object *object) | |||
60 | 60 | ||
61 | if (priv->r100c10_page) | 61 | if (priv->r100c10_page) |
62 | nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); | 62 | nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); |
63 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ | ||
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | 66 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c index b54b582e72c4..d5d65285efe5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c | |||
@@ -98,6 +98,7 @@ static int | |||
98 | gf100_ltc_init(struct nouveau_object *object) | 98 | gf100_ltc_init(struct nouveau_object *object) |
99 | { | 99 | { |
100 | struct nvkm_ltc_priv *priv = (void *)object; | 100 | struct nvkm_ltc_priv *priv = (void *)object; |
101 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
101 | int ret; | 102 | int ret; |
102 | 103 | ||
103 | ret = nvkm_ltc_init(priv); | 104 | ret = nvkm_ltc_init(priv); |
@@ -107,6 +108,7 @@ gf100_ltc_init(struct nouveau_object *object) | |||
107 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ | 108 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ |
108 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); | 109 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); |
109 | nv_wr32(priv, 0x17e8d4, priv->tag_base); | 110 | nv_wr32(priv, 0x17e8d4, priv->tag_base); |
111 | nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
110 | return 0; | 112 | return 0; |
111 | } | 113 | } |
112 | 114 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c index ea716569745d..b39b5d0eb8f9 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c | |||
@@ -28,6 +28,7 @@ static int | |||
28 | gk104_ltc_init(struct nouveau_object *object) | 28 | gk104_ltc_init(struct nouveau_object *object) |
29 | { | 29 | { |
30 | struct nvkm_ltc_priv *priv = (void *)object; | 30 | struct nvkm_ltc_priv *priv = (void *)object; |
31 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
31 | int ret; | 32 | int ret; |
32 | 33 | ||
33 | ret = nvkm_ltc_init(priv); | 34 | ret = nvkm_ltc_init(priv); |
@@ -37,6 +38,7 @@ gk104_ltc_init(struct nouveau_object *object) | |||
37 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); | 38 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); |
38 | nv_wr32(priv, 0x17e000, priv->ltc_nr); | 39 | nv_wr32(priv, 0x17e000, priv->ltc_nr); |
39 | nv_wr32(priv, 0x17e8d4, priv->tag_base); | 40 | nv_wr32(priv, 0x17e8d4, priv->tag_base); |
41 | nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
40 | return 0; | 42 | return 0; |
41 | } | 43 | } |
42 | 44 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c index 4761b2e9af00..a4de64289762 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c | |||
@@ -98,6 +98,7 @@ static int | |||
98 | gm107_ltc_init(struct nouveau_object *object) | 98 | gm107_ltc_init(struct nouveau_object *object) |
99 | { | 99 | { |
100 | struct nvkm_ltc_priv *priv = (void *)object; | 100 | struct nvkm_ltc_priv *priv = (void *)object; |
101 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
101 | int ret; | 102 | int ret; |
102 | 103 | ||
103 | ret = nvkm_ltc_init(priv); | 104 | ret = nvkm_ltc_init(priv); |
@@ -106,6 +107,7 @@ gm107_ltc_init(struct nouveau_object *object) | |||
106 | 107 | ||
107 | nv_wr32(priv, 0x17e27c, priv->ltc_nr); | 108 | nv_wr32(priv, 0x17e27c, priv->ltc_nr); |
108 | nv_wr32(priv, 0x17e278, priv->tag_base); | 109 | nv_wr32(priv, 0x17e278, priv->tag_base); |
110 | nv_mask(priv, 0x17e264, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
109 | return 0; | 111 | return 0; |
110 | } | 112 | } |
111 | 113 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 279206997e5c..622424692b3b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -46,7 +46,6 @@ static struct nouveau_dsm_priv { | |||
46 | bool dsm_detected; | 46 | bool dsm_detected; |
47 | bool optimus_detected; | 47 | bool optimus_detected; |
48 | acpi_handle dhandle; | 48 | acpi_handle dhandle; |
49 | acpi_handle other_handle; | ||
50 | acpi_handle rom_handle; | 49 | acpi_handle rom_handle; |
51 | } nouveau_dsm_priv; | 50 | } nouveau_dsm_priv; |
52 | 51 | ||
@@ -222,10 +221,9 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) | |||
222 | if (!dhandle) | 221 | if (!dhandle) |
223 | return false; | 222 | return false; |
224 | 223 | ||
225 | if (!acpi_has_method(dhandle, "_DSM")) { | 224 | if (!acpi_has_method(dhandle, "_DSM")) |
226 | nouveau_dsm_priv.other_handle = dhandle; | ||
227 | return false; | 225 | return false; |
228 | } | 226 | |
229 | if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, | 227 | if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, |
230 | 1 << NOUVEAU_DSM_POWER)) | 228 | 1 << NOUVEAU_DSM_POWER)) |
231 | retval |= NOUVEAU_DSM_HAS_MUX; | 229 | retval |= NOUVEAU_DSM_HAS_MUX; |
@@ -301,16 +299,6 @@ static bool nouveau_dsm_detect(void) | |||
301 | printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", | 299 | printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", |
302 | acpi_method_name); | 300 | acpi_method_name); |
303 | nouveau_dsm_priv.dsm_detected = true; | 301 | nouveau_dsm_priv.dsm_detected = true; |
304 | /* | ||
305 | * On some systems hotplug events are generated for the device | ||
306 | * being switched off when _DSM is executed. They cause ACPI | ||
307 | * hotplug to trigger and attempt to remove the device from | ||
308 | * the system, which causes it to break down. Prevent that from | ||
309 | * happening by setting the no_hotplug flag for the involved | ||
310 | * ACPI device objects. | ||
311 | */ | ||
312 | acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle); | ||
313 | acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle); | ||
314 | ret = true; | 302 | ret = true; |
315 | } | 303 | } |
316 | 304 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 250a5e88c751..9c3af96a7153 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -627,6 +627,7 @@ int nouveau_pmops_suspend(struct device *dev) | |||
627 | 627 | ||
628 | pci_save_state(pdev); | 628 | pci_save_state(pdev); |
629 | pci_disable_device(pdev); | 629 | pci_disable_device(pdev); |
630 | pci_ignore_hotplug(pdev); | ||
630 | pci_set_power_state(pdev, PCI_D3hot); | 631 | pci_set_power_state(pdev, PCI_D3hot); |
631 | return 0; | 632 | return 0; |
632 | } | 633 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c index 18d55d447248..c7592ec8ecb8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vga.c +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c | |||
@@ -108,7 +108,16 @@ void | |||
108 | nouveau_vga_fini(struct nouveau_drm *drm) | 108 | nouveau_vga_fini(struct nouveau_drm *drm) |
109 | { | 109 | { |
110 | struct drm_device *dev = drm->dev; | 110 | struct drm_device *dev = drm->dev; |
111 | bool runtime = false; | ||
112 | |||
113 | if (nouveau_runtime_pm == 1) | ||
114 | runtime = true; | ||
115 | if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) | ||
116 | runtime = true; | ||
117 | |||
111 | vga_switcheroo_unregister_client(dev->pdev); | 118 | vga_switcheroo_unregister_client(dev->pdev); |
119 | if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) | ||
120 | vga_switcheroo_fini_domain_pm_ops(drm->dev->dev); | ||
112 | vga_client_register(dev->pdev, NULL, NULL, NULL); | 121 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
113 | } | 122 | } |
114 | 123 | ||
diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 0013ad0db9ef..f77b7135ee4c 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile | |||
@@ -76,7 +76,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ | |||
76 | evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ | 76 | evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ |
77 | evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ | 77 | evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ |
78 | atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ | 78 | atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ |
79 | si_blit_shaders.o radeon_prime.o radeon_uvd.o cik.o cik_blit_shaders.o \ | 79 | si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ |
80 | r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ | 80 | r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ |
81 | rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ | 81 | rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ |
82 | trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ | 82 | trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index b1e11f8434e2..ac14b67621d3 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
405 | u8 msg[DP_DPCD_SIZE]; | 405 | u8 msg[DP_DPCD_SIZE]; |
406 | int ret; | 406 | int ret; |
407 | 407 | ||
408 | char dpcd_hex_dump[DP_DPCD_SIZE * 3]; | ||
409 | |||
410 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 408 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
411 | DP_DPCD_SIZE); | 409 | DP_DPCD_SIZE); |
412 | if (ret > 0) { | 410 | if (ret > 0) { |
413 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 411 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
414 | 412 | ||
415 | hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), | 413 | DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), |
416 | 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); | 414 | dig_connector->dpcd); |
417 | DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); | ||
418 | 415 | ||
419 | radeon_dp_probe_oui(radeon_connector); | 416 | radeon_dp_probe_oui(radeon_connector); |
420 | 417 | ||
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 022561e28707..d416bb2ff48d 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -869,6 +869,9 @@ static int ci_set_thermal_temperature_range(struct radeon_device *rdev, | |||
869 | WREG32_SMC(CG_THERMAL_CTRL, tmp); | 869 | WREG32_SMC(CG_THERMAL_CTRL, tmp); |
870 | #endif | 870 | #endif |
871 | 871 | ||
872 | rdev->pm.dpm.thermal.min_temp = low_temp; | ||
873 | rdev->pm.dpm.thermal.max_temp = high_temp; | ||
874 | |||
872 | return 0; | 875 | return 0; |
873 | } | 876 | } |
874 | 877 | ||
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index b625646bf3e2..3d546c606b43 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -3483,7 +3483,7 @@ static void cik_gpu_init(struct radeon_device *rdev) | |||
3483 | u32 mc_shared_chmap, mc_arb_ramcfg; | 3483 | u32 mc_shared_chmap, mc_arb_ramcfg; |
3484 | u32 hdp_host_path_cntl; | 3484 | u32 hdp_host_path_cntl; |
3485 | u32 tmp; | 3485 | u32 tmp; |
3486 | int i, j, k; | 3486 | int i, j; |
3487 | 3487 | ||
3488 | switch (rdev->family) { | 3488 | switch (rdev->family) { |
3489 | case CHIP_BONAIRE: | 3489 | case CHIP_BONAIRE: |
@@ -3544,6 +3544,7 @@ static void cik_gpu_init(struct radeon_device *rdev) | |||
3544 | (rdev->pdev->device == 0x130B) || | 3544 | (rdev->pdev->device == 0x130B) || |
3545 | (rdev->pdev->device == 0x130E) || | 3545 | (rdev->pdev->device == 0x130E) || |
3546 | (rdev->pdev->device == 0x1315) || | 3546 | (rdev->pdev->device == 0x1315) || |
3547 | (rdev->pdev->device == 0x1318) || | ||
3547 | (rdev->pdev->device == 0x131B)) { | 3548 | (rdev->pdev->device == 0x131B)) { |
3548 | rdev->config.cik.max_cu_per_sh = 4; | 3549 | rdev->config.cik.max_cu_per_sh = 4; |
3549 | rdev->config.cik.max_backends_per_se = 1; | 3550 | rdev->config.cik.max_backends_per_se = 1; |
@@ -3672,12 +3673,11 @@ static void cik_gpu_init(struct radeon_device *rdev) | |||
3672 | rdev->config.cik.max_sh_per_se, | 3673 | rdev->config.cik.max_sh_per_se, |
3673 | rdev->config.cik.max_backends_per_se); | 3674 | rdev->config.cik.max_backends_per_se); |
3674 | 3675 | ||
3676 | rdev->config.cik.active_cus = 0; | ||
3675 | for (i = 0; i < rdev->config.cik.max_shader_engines; i++) { | 3677 | for (i = 0; i < rdev->config.cik.max_shader_engines; i++) { |
3676 | for (j = 0; j < rdev->config.cik.max_sh_per_se; j++) { | 3678 | for (j = 0; j < rdev->config.cik.max_sh_per_se; j++) { |
3677 | for (k = 0; k < rdev->config.cik.max_cu_per_sh; k++) { | 3679 | rdev->config.cik.active_cus += |
3678 | rdev->config.cik.active_cus += | 3680 | hweight32(cik_get_cu_active_bitmap(rdev, i, j)); |
3679 | hweight32(cik_get_cu_active_bitmap(rdev, i, j)); | ||
3680 | } | ||
3681 | } | 3681 | } |
3682 | } | 3682 | } |
3683 | 3683 | ||
@@ -3801,7 +3801,7 @@ int cik_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
3801 | radeon_ring_write(ring, PACKET3(PACKET3_SET_UCONFIG_REG, 1)); | 3801 | radeon_ring_write(ring, PACKET3(PACKET3_SET_UCONFIG_REG, 1)); |
3802 | radeon_ring_write(ring, ((scratch - PACKET3_SET_UCONFIG_REG_START) >> 2)); | 3802 | radeon_ring_write(ring, ((scratch - PACKET3_SET_UCONFIG_REG_START) >> 2)); |
3803 | radeon_ring_write(ring, 0xDEADBEEF); | 3803 | radeon_ring_write(ring, 0xDEADBEEF); |
3804 | radeon_ring_unlock_commit(rdev, ring); | 3804 | radeon_ring_unlock_commit(rdev, ring, false); |
3805 | 3805 | ||
3806 | for (i = 0; i < rdev->usec_timeout; i++) { | 3806 | for (i = 0; i < rdev->usec_timeout; i++) { |
3807 | tmp = RREG32(scratch); | 3807 | tmp = RREG32(scratch); |
@@ -3920,6 +3920,17 @@ void cik_fence_compute_ring_emit(struct radeon_device *rdev, | |||
3920 | radeon_ring_write(ring, 0); | 3920 | radeon_ring_write(ring, 0); |
3921 | } | 3921 | } |
3922 | 3922 | ||
3923 | /** | ||
3924 | * cik_semaphore_ring_emit - emit a semaphore on the CP ring | ||
3925 | * | ||
3926 | * @rdev: radeon_device pointer | ||
3927 | * @ring: radeon ring buffer object | ||
3928 | * @semaphore: radeon semaphore object | ||
3929 | * @emit_wait: Is this a sempahore wait? | ||
3930 | * | ||
3931 | * Emits a semaphore signal/wait packet to the CP ring and prevents the PFP | ||
3932 | * from running ahead of semaphore waits. | ||
3933 | */ | ||
3923 | bool cik_semaphore_ring_emit(struct radeon_device *rdev, | 3934 | bool cik_semaphore_ring_emit(struct radeon_device *rdev, |
3924 | struct radeon_ring *ring, | 3935 | struct radeon_ring *ring, |
3925 | struct radeon_semaphore *semaphore, | 3936 | struct radeon_semaphore *semaphore, |
@@ -3932,6 +3943,12 @@ bool cik_semaphore_ring_emit(struct radeon_device *rdev, | |||
3932 | radeon_ring_write(ring, lower_32_bits(addr)); | 3943 | radeon_ring_write(ring, lower_32_bits(addr)); |
3933 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xffff) | sel); | 3944 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xffff) | sel); |
3934 | 3945 | ||
3946 | if (emit_wait && ring->idx == RADEON_RING_TYPE_GFX_INDEX) { | ||
3947 | /* Prevent the PFP from running ahead of the semaphore wait */ | ||
3948 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | ||
3949 | radeon_ring_write(ring, 0x0); | ||
3950 | } | ||
3951 | |||
3935 | return true; | 3952 | return true; |
3936 | } | 3953 | } |
3937 | 3954 | ||
@@ -4004,7 +4021,7 @@ int cik_copy_cpdma(struct radeon_device *rdev, | |||
4004 | return r; | 4021 | return r; |
4005 | } | 4022 | } |
4006 | 4023 | ||
4007 | radeon_ring_unlock_commit(rdev, ring); | 4024 | radeon_ring_unlock_commit(rdev, ring, false); |
4008 | radeon_semaphore_free(rdev, &sem, *fence); | 4025 | radeon_semaphore_free(rdev, &sem, *fence); |
4009 | 4026 | ||
4010 | return r; | 4027 | return r; |
@@ -4103,7 +4120,7 @@ int cik_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
4103 | ib.ptr[1] = ((scratch - PACKET3_SET_UCONFIG_REG_START) >> 2); | 4120 | ib.ptr[1] = ((scratch - PACKET3_SET_UCONFIG_REG_START) >> 2); |
4104 | ib.ptr[2] = 0xDEADBEEF; | 4121 | ib.ptr[2] = 0xDEADBEEF; |
4105 | ib.length_dw = 3; | 4122 | ib.length_dw = 3; |
4106 | r = radeon_ib_schedule(rdev, &ib, NULL); | 4123 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
4107 | if (r) { | 4124 | if (r) { |
4108 | radeon_scratch_free(rdev, scratch); | 4125 | radeon_scratch_free(rdev, scratch); |
4109 | radeon_ib_free(rdev, &ib); | 4126 | radeon_ib_free(rdev, &ib); |
@@ -4324,7 +4341,7 @@ static int cik_cp_gfx_start(struct radeon_device *rdev) | |||
4324 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | 4341 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
4325 | radeon_ring_write(ring, 0x00000010); /* VGT_OUT_DEALLOC_CNTL */ | 4342 | radeon_ring_write(ring, 0x00000010); /* VGT_OUT_DEALLOC_CNTL */ |
4326 | 4343 | ||
4327 | radeon_ring_unlock_commit(rdev, ring); | 4344 | radeon_ring_unlock_commit(rdev, ring, false); |
4328 | 4345 | ||
4329 | return 0; | 4346 | return 0; |
4330 | } | 4347 | } |
@@ -4786,7 +4803,7 @@ struct bonaire_mqd | |||
4786 | */ | 4803 | */ |
4787 | static int cik_cp_compute_resume(struct radeon_device *rdev) | 4804 | static int cik_cp_compute_resume(struct radeon_device *rdev) |
4788 | { | 4805 | { |
4789 | int r, i, idx; | 4806 | int r, i, j, idx; |
4790 | u32 tmp; | 4807 | u32 tmp; |
4791 | bool use_doorbell = true; | 4808 | bool use_doorbell = true; |
4792 | u64 hqd_gpu_addr; | 4809 | u64 hqd_gpu_addr; |
@@ -4905,7 +4922,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
4905 | mqd->queue_state.cp_hqd_pq_wptr= 0; | 4922 | mqd->queue_state.cp_hqd_pq_wptr= 0; |
4906 | if (RREG32(CP_HQD_ACTIVE) & 1) { | 4923 | if (RREG32(CP_HQD_ACTIVE) & 1) { |
4907 | WREG32(CP_HQD_DEQUEUE_REQUEST, 1); | 4924 | WREG32(CP_HQD_DEQUEUE_REQUEST, 1); |
4908 | for (i = 0; i < rdev->usec_timeout; i++) { | 4925 | for (j = 0; j < rdev->usec_timeout; j++) { |
4909 | if (!(RREG32(CP_HQD_ACTIVE) & 1)) | 4926 | if (!(RREG32(CP_HQD_ACTIVE) & 1)) |
4910 | break; | 4927 | break; |
4911 | udelay(1); | 4928 | udelay(1); |
@@ -5732,20 +5749,17 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
5732 | WREG32(0x15D8, 0); | 5749 | WREG32(0x15D8, 0); |
5733 | WREG32(0x15DC, 0); | 5750 | WREG32(0x15DC, 0); |
5734 | 5751 | ||
5735 | /* empty context1-15 */ | 5752 | /* restore context1-15 */ |
5736 | /* FIXME start with 4G, once using 2 level pt switch to full | ||
5737 | * vm size space | ||
5738 | */ | ||
5739 | /* set vm size, must be a multiple of 4 */ | 5753 | /* set vm size, must be a multiple of 4 */ |
5740 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); | 5754 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
5741 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); | 5755 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); |
5742 | for (i = 1; i < 16; i++) { | 5756 | for (i = 1; i < 16; i++) { |
5743 | if (i < 8) | 5757 | if (i < 8) |
5744 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 5758 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
5745 | rdev->gart.table_addr >> 12); | 5759 | rdev->vm_manager.saved_table_addr[i]); |
5746 | else | 5760 | else |
5747 | WREG32(VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2), | 5761 | WREG32(VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2), |
5748 | rdev->gart.table_addr >> 12); | 5762 | rdev->vm_manager.saved_table_addr[i]); |
5749 | } | 5763 | } |
5750 | 5764 | ||
5751 | /* enable context1-15 */ | 5765 | /* enable context1-15 */ |
@@ -5810,6 +5824,17 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
5810 | */ | 5824 | */ |
5811 | static void cik_pcie_gart_disable(struct radeon_device *rdev) | 5825 | static void cik_pcie_gart_disable(struct radeon_device *rdev) |
5812 | { | 5826 | { |
5827 | unsigned i; | ||
5828 | |||
5829 | for (i = 1; i < 16; ++i) { | ||
5830 | uint32_t reg; | ||
5831 | if (i < 8) | ||
5832 | reg = VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2); | ||
5833 | else | ||
5834 | reg = VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2); | ||
5835 | rdev->vm_manager.saved_table_addr[i] = RREG32(reg); | ||
5836 | } | ||
5837 | |||
5813 | /* Disable all tables */ | 5838 | /* Disable all tables */ |
5814 | WREG32(VM_CONTEXT0_CNTL, 0); | 5839 | WREG32(VM_CONTEXT0_CNTL, 0); |
5815 | WREG32(VM_CONTEXT1_CNTL, 0); | 5840 | WREG32(VM_CONTEXT1_CNTL, 0); |
@@ -5958,14 +5983,14 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
5958 | 5983 | ||
5959 | /* update SH_MEM_* regs */ | 5984 | /* update SH_MEM_* regs */ |
5960 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 5985 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5961 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 5986 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
5962 | WRITE_DATA_DST_SEL(0))); | 5987 | WRITE_DATA_DST_SEL(0))); |
5963 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); | 5988 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
5964 | radeon_ring_write(ring, 0); | 5989 | radeon_ring_write(ring, 0); |
5965 | radeon_ring_write(ring, VMID(vm->id)); | 5990 | radeon_ring_write(ring, VMID(vm->id)); |
5966 | 5991 | ||
5967 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 6)); | 5992 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 6)); |
5968 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 5993 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
5969 | WRITE_DATA_DST_SEL(0))); | 5994 | WRITE_DATA_DST_SEL(0))); |
5970 | radeon_ring_write(ring, SH_MEM_BASES >> 2); | 5995 | radeon_ring_write(ring, SH_MEM_BASES >> 2); |
5971 | radeon_ring_write(ring, 0); | 5996 | radeon_ring_write(ring, 0); |
@@ -5976,7 +6001,7 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
5976 | radeon_ring_write(ring, 0); /* SH_MEM_APE1_LIMIT */ | 6001 | radeon_ring_write(ring, 0); /* SH_MEM_APE1_LIMIT */ |
5977 | 6002 | ||
5978 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 6003 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5979 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 6004 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
5980 | WRITE_DATA_DST_SEL(0))); | 6005 | WRITE_DATA_DST_SEL(0))); |
5981 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); | 6006 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
5982 | radeon_ring_write(ring, 0); | 6007 | radeon_ring_write(ring, 0); |
@@ -5987,7 +6012,7 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
5987 | 6012 | ||
5988 | /* bits 0-15 are the VM contexts0-15 */ | 6013 | /* bits 0-15 are the VM contexts0-15 */ |
5989 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 6014 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5990 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 6015 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
5991 | WRITE_DATA_DST_SEL(0))); | 6016 | WRITE_DATA_DST_SEL(0))); |
5992 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | 6017 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
5993 | radeon_ring_write(ring, 0); | 6018 | radeon_ring_write(ring, 0); |
@@ -7726,17 +7751,17 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev) | |||
7726 | wptr = RREG32(IH_RB_WPTR); | 7751 | wptr = RREG32(IH_RB_WPTR); |
7727 | 7752 | ||
7728 | if (wptr & RB_OVERFLOW) { | 7753 | if (wptr & RB_OVERFLOW) { |
7754 | wptr &= ~RB_OVERFLOW; | ||
7729 | /* When a ring buffer overflow happen start parsing interrupt | 7755 | /* When a ring buffer overflow happen start parsing interrupt |
7730 | * from the last not overwritten vector (wptr + 16). Hopefully | 7756 | * from the last not overwritten vector (wptr + 16). Hopefully |
7731 | * this should allow us to catchup. | 7757 | * this should allow us to catchup. |
7732 | */ | 7758 | */ |
7733 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 7759 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
7734 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 7760 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
7735 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 7761 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
7736 | tmp = RREG32(IH_RB_CNTL); | 7762 | tmp = RREG32(IH_RB_CNTL); |
7737 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 7763 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
7738 | WREG32(IH_RB_CNTL, tmp); | 7764 | WREG32(IH_RB_CNTL, tmp); |
7739 | wptr &= ~RB_OVERFLOW; | ||
7740 | } | 7765 | } |
7741 | return (wptr & rdev->ih.ptr_mask); | 7766 | return (wptr & rdev->ih.ptr_mask); |
7742 | } | 7767 | } |
@@ -8226,6 +8251,7 @@ restart_ih: | |||
8226 | /* wptr/rptr are in bytes! */ | 8251 | /* wptr/rptr are in bytes! */ |
8227 | rptr += 16; | 8252 | rptr += 16; |
8228 | rptr &= rdev->ih.ptr_mask; | 8253 | rptr &= rdev->ih.ptr_mask; |
8254 | WREG32(IH_RB_RPTR, rptr); | ||
8229 | } | 8255 | } |
8230 | if (queue_hotplug) | 8256 | if (queue_hotplug) |
8231 | schedule_work(&rdev->hotplug_work); | 8257 | schedule_work(&rdev->hotplug_work); |
@@ -8234,7 +8260,6 @@ restart_ih: | |||
8234 | if (queue_thermal) | 8260 | if (queue_thermal) |
8235 | schedule_work(&rdev->pm.dpm.thermal.work); | 8261 | schedule_work(&rdev->pm.dpm.thermal.work); |
8236 | rdev->ih.rptr = rptr; | 8262 | rdev->ih.rptr = rptr; |
8237 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
8238 | atomic_set(&rdev->ih.lock, 0); | 8263 | atomic_set(&rdev->ih.lock, 0); |
8239 | 8264 | ||
8240 | /* make sure wptr hasn't changed while processing */ | 8265 | /* make sure wptr hasn't changed while processing */ |
@@ -9538,6 +9563,9 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev) | |||
9538 | int ret, i; | 9563 | int ret, i; |
9539 | u16 tmp16; | 9564 | u16 tmp16; |
9540 | 9565 | ||
9566 | if (pci_is_root_bus(rdev->pdev->bus)) | ||
9567 | return; | ||
9568 | |||
9541 | if (radeon_pcie_gen2 == 0) | 9569 | if (radeon_pcie_gen2 == 0) |
9542 | return; | 9570 | return; |
9543 | 9571 | ||
@@ -9764,7 +9792,8 @@ static void cik_program_aspm(struct radeon_device *rdev) | |||
9764 | if (orig != data) | 9792 | if (orig != data) |
9765 | WREG32_PCIE_PORT(PCIE_LC_LINK_WIDTH_CNTL, data); | 9793 | WREG32_PCIE_PORT(PCIE_LC_LINK_WIDTH_CNTL, data); |
9766 | 9794 | ||
9767 | if (!disable_clkreq) { | 9795 | if (!disable_clkreq && |
9796 | !pci_is_root_bus(rdev->pdev->bus)) { | ||
9768 | struct pci_dev *root = rdev->pdev->bus->self; | 9797 | struct pci_dev *root = rdev->pdev->bus->self; |
9769 | u32 lnkcap; | 9798 | u32 lnkcap; |
9770 | 9799 | ||
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index bcf480510ac2..c4ffa54b1e3d 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -489,13 +489,6 @@ int cik_sdma_resume(struct radeon_device *rdev) | |||
489 | { | 489 | { |
490 | int r; | 490 | int r; |
491 | 491 | ||
492 | /* Reset dma */ | ||
493 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1); | ||
494 | RREG32(SRBM_SOFT_RESET); | ||
495 | udelay(50); | ||
496 | WREG32(SRBM_SOFT_RESET, 0); | ||
497 | RREG32(SRBM_SOFT_RESET); | ||
498 | |||
499 | r = cik_sdma_load_microcode(rdev); | 492 | r = cik_sdma_load_microcode(rdev); |
500 | if (r) | 493 | if (r) |
501 | return r; | 494 | return r; |
@@ -596,7 +589,7 @@ int cik_copy_dma(struct radeon_device *rdev, | |||
596 | return r; | 589 | return r; |
597 | } | 590 | } |
598 | 591 | ||
599 | radeon_ring_unlock_commit(rdev, ring); | 592 | radeon_ring_unlock_commit(rdev, ring, false); |
600 | radeon_semaphore_free(rdev, &sem, *fence); | 593 | radeon_semaphore_free(rdev, &sem, *fence); |
601 | 594 | ||
602 | return r; | 595 | return r; |
@@ -638,7 +631,7 @@ int cik_sdma_ring_test(struct radeon_device *rdev, | |||
638 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr)); | 631 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr)); |
639 | radeon_ring_write(ring, 1); /* number of DWs to follow */ | 632 | radeon_ring_write(ring, 1); /* number of DWs to follow */ |
640 | radeon_ring_write(ring, 0xDEADBEEF); | 633 | radeon_ring_write(ring, 0xDEADBEEF); |
641 | radeon_ring_unlock_commit(rdev, ring); | 634 | radeon_ring_unlock_commit(rdev, ring, false); |
642 | 635 | ||
643 | for (i = 0; i < rdev->usec_timeout; i++) { | 636 | for (i = 0; i < rdev->usec_timeout; i++) { |
644 | tmp = readl(ptr); | 637 | tmp = readl(ptr); |
@@ -695,7 +688,7 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
695 | ib.ptr[4] = 0xDEADBEEF; | 688 | ib.ptr[4] = 0xDEADBEEF; |
696 | ib.length_dw = 5; | 689 | ib.length_dw = 5; |
697 | 690 | ||
698 | r = radeon_ib_schedule(rdev, &ib, NULL); | 691 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
699 | if (r) { | 692 | if (r) { |
700 | radeon_ib_free(rdev, &ib); | 693 | radeon_ib_free(rdev, &ib); |
701 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 694 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 4fedd14e670a..e50807c29f69 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2869,7 +2869,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
2869 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); | 2869 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); |
2870 | radeon_ring_write(ring, 0); | 2870 | radeon_ring_write(ring, 0); |
2871 | radeon_ring_write(ring, 0); | 2871 | radeon_ring_write(ring, 0); |
2872 | radeon_ring_unlock_commit(rdev, ring); | 2872 | radeon_ring_unlock_commit(rdev, ring, false); |
2873 | 2873 | ||
2874 | cp_me = 0xff; | 2874 | cp_me = 0xff; |
2875 | WREG32(CP_ME_CNTL, cp_me); | 2875 | WREG32(CP_ME_CNTL, cp_me); |
@@ -2912,7 +2912,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
2912 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | 2912 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
2913 | radeon_ring_write(ring, 0x00000010); /* */ | 2913 | radeon_ring_write(ring, 0x00000010); /* */ |
2914 | 2914 | ||
2915 | radeon_ring_unlock_commit(rdev, ring); | 2915 | radeon_ring_unlock_commit(rdev, ring, false); |
2916 | 2916 | ||
2917 | return 0; | 2917 | return 0; |
2918 | } | 2918 | } |
@@ -4749,17 +4749,17 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
4749 | wptr = RREG32(IH_RB_WPTR); | 4749 | wptr = RREG32(IH_RB_WPTR); |
4750 | 4750 | ||
4751 | if (wptr & RB_OVERFLOW) { | 4751 | if (wptr & RB_OVERFLOW) { |
4752 | wptr &= ~RB_OVERFLOW; | ||
4752 | /* When a ring buffer overflow happen start parsing interrupt | 4753 | /* When a ring buffer overflow happen start parsing interrupt |
4753 | * from the last not overwritten vector (wptr + 16). Hopefully | 4754 | * from the last not overwritten vector (wptr + 16). Hopefully |
4754 | * this should allow us to catchup. | 4755 | * this should allow us to catchup. |
4755 | */ | 4756 | */ |
4756 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 4757 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
4757 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 4758 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
4758 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 4759 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
4759 | tmp = RREG32(IH_RB_CNTL); | 4760 | tmp = RREG32(IH_RB_CNTL); |
4760 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 4761 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
4761 | WREG32(IH_RB_CNTL, tmp); | 4762 | WREG32(IH_RB_CNTL, tmp); |
4762 | wptr &= ~RB_OVERFLOW; | ||
4763 | } | 4763 | } |
4764 | return (wptr & rdev->ih.ptr_mask); | 4764 | return (wptr & rdev->ih.ptr_mask); |
4765 | } | 4765 | } |
@@ -5137,6 +5137,7 @@ restart_ih: | |||
5137 | /* wptr/rptr are in bytes! */ | 5137 | /* wptr/rptr are in bytes! */ |
5138 | rptr += 16; | 5138 | rptr += 16; |
5139 | rptr &= rdev->ih.ptr_mask; | 5139 | rptr &= rdev->ih.ptr_mask; |
5140 | WREG32(IH_RB_RPTR, rptr); | ||
5140 | } | 5141 | } |
5141 | if (queue_hotplug) | 5142 | if (queue_hotplug) |
5142 | schedule_work(&rdev->hotplug_work); | 5143 | schedule_work(&rdev->hotplug_work); |
@@ -5145,7 +5146,6 @@ restart_ih: | |||
5145 | if (queue_thermal && rdev->pm.dpm_enabled) | 5146 | if (queue_thermal && rdev->pm.dpm_enabled) |
5146 | schedule_work(&rdev->pm.dpm.thermal.work); | 5147 | schedule_work(&rdev->pm.dpm.thermal.work); |
5147 | rdev->ih.rptr = rptr; | 5148 | rdev->ih.rptr = rptr; |
5148 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
5149 | atomic_set(&rdev->ih.lock, 0); | 5149 | atomic_set(&rdev->ih.lock, 0); |
5150 | 5150 | ||
5151 | /* make sure wptr hasn't changed while processing */ | 5151 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_dma.c b/drivers/gpu/drm/radeon/evergreen_dma.c index 478caefe0fef..afaba388c36d 100644 --- a/drivers/gpu/drm/radeon/evergreen_dma.c +++ b/drivers/gpu/drm/radeon/evergreen_dma.c | |||
@@ -155,7 +155,7 @@ int evergreen_copy_dma(struct radeon_device *rdev, | |||
155 | return r; | 155 | return r; |
156 | } | 156 | } |
157 | 157 | ||
158 | radeon_ring_unlock_commit(rdev, ring); | 158 | radeon_ring_unlock_commit(rdev, ring, false); |
159 | radeon_semaphore_free(rdev, &sem, *fence); | 159 | radeon_semaphore_free(rdev, &sem, *fence); |
160 | 160 | ||
161 | return r; | 161 | return r; |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 9ef8c38f2d66..67cb472d188c 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #define KV_MINIMUM_ENGINE_CLOCK 800 | 33 | #define KV_MINIMUM_ENGINE_CLOCK 800 |
34 | #define SMC_RAM_END 0x40000 | 34 | #define SMC_RAM_END 0x40000 |
35 | 35 | ||
36 | static int kv_enable_nb_dpm(struct radeon_device *rdev, | ||
37 | bool enable); | ||
36 | static void kv_init_graphics_levels(struct radeon_device *rdev); | 38 | static void kv_init_graphics_levels(struct radeon_device *rdev); |
37 | static int kv_calculate_ds_divider(struct radeon_device *rdev); | 39 | static int kv_calculate_ds_divider(struct radeon_device *rdev); |
38 | static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); | 40 | static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); |
@@ -1295,6 +1297,9 @@ void kv_dpm_disable(struct radeon_device *rdev) | |||
1295 | { | 1297 | { |
1296 | kv_smc_bapm_enable(rdev, false); | 1298 | kv_smc_bapm_enable(rdev, false); |
1297 | 1299 | ||
1300 | if (rdev->family == CHIP_MULLINS) | ||
1301 | kv_enable_nb_dpm(rdev, false); | ||
1302 | |||
1298 | /* powerup blocks */ | 1303 | /* powerup blocks */ |
1299 | kv_dpm_powergate_acp(rdev, false); | 1304 | kv_dpm_powergate_acp(rdev, false); |
1300 | kv_dpm_powergate_samu(rdev, false); | 1305 | kv_dpm_powergate_samu(rdev, false); |
@@ -1438,14 +1443,14 @@ static int kv_update_uvd_dpm(struct radeon_device *rdev, bool gate) | |||
1438 | return kv_enable_uvd_dpm(rdev, !gate); | 1443 | return kv_enable_uvd_dpm(rdev, !gate); |
1439 | } | 1444 | } |
1440 | 1445 | ||
1441 | static u8 kv_get_vce_boot_level(struct radeon_device *rdev) | 1446 | static u8 kv_get_vce_boot_level(struct radeon_device *rdev, u32 evclk) |
1442 | { | 1447 | { |
1443 | u8 i; | 1448 | u8 i; |
1444 | struct radeon_vce_clock_voltage_dependency_table *table = | 1449 | struct radeon_vce_clock_voltage_dependency_table *table = |
1445 | &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; | 1450 | &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; |
1446 | 1451 | ||
1447 | for (i = 0; i < table->count; i++) { | 1452 | for (i = 0; i < table->count; i++) { |
1448 | if (table->entries[i].evclk >= 0) /* XXX */ | 1453 | if (table->entries[i].evclk >= evclk) |
1449 | break; | 1454 | break; |
1450 | } | 1455 | } |
1451 | 1456 | ||
@@ -1468,7 +1473,7 @@ static int kv_update_vce_dpm(struct radeon_device *rdev, | |||
1468 | if (pi->caps_stable_p_state) | 1473 | if (pi->caps_stable_p_state) |
1469 | pi->vce_boot_level = table->count - 1; | 1474 | pi->vce_boot_level = table->count - 1; |
1470 | else | 1475 | else |
1471 | pi->vce_boot_level = kv_get_vce_boot_level(rdev); | 1476 | pi->vce_boot_level = kv_get_vce_boot_level(rdev, radeon_new_state->evclk); |
1472 | 1477 | ||
1473 | ret = kv_copy_bytes_to_smc(rdev, | 1478 | ret = kv_copy_bytes_to_smc(rdev, |
1474 | pi->dpm_table_start + | 1479 | pi->dpm_table_start + |
@@ -1769,15 +1774,24 @@ static int kv_update_dfs_bypass_settings(struct radeon_device *rdev, | |||
1769 | return ret; | 1774 | return ret; |
1770 | } | 1775 | } |
1771 | 1776 | ||
1772 | static int kv_enable_nb_dpm(struct radeon_device *rdev) | 1777 | static int kv_enable_nb_dpm(struct radeon_device *rdev, |
1778 | bool enable) | ||
1773 | { | 1779 | { |
1774 | struct kv_power_info *pi = kv_get_pi(rdev); | 1780 | struct kv_power_info *pi = kv_get_pi(rdev); |
1775 | int ret = 0; | 1781 | int ret = 0; |
1776 | 1782 | ||
1777 | if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { | 1783 | if (enable) { |
1778 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); | 1784 | if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { |
1779 | if (ret == 0) | 1785 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); |
1780 | pi->nb_dpm_enabled = true; | 1786 | if (ret == 0) |
1787 | pi->nb_dpm_enabled = true; | ||
1788 | } | ||
1789 | } else { | ||
1790 | if (pi->enable_nb_dpm && pi->nb_dpm_enabled) { | ||
1791 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Disable); | ||
1792 | if (ret == 0) | ||
1793 | pi->nb_dpm_enabled = false; | ||
1794 | } | ||
1781 | } | 1795 | } |
1782 | 1796 | ||
1783 | return ret; | 1797 | return ret; |
@@ -1864,7 +1878,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
1864 | } | 1878 | } |
1865 | kv_update_sclk_t(rdev); | 1879 | kv_update_sclk_t(rdev); |
1866 | if (rdev->family == CHIP_MULLINS) | 1880 | if (rdev->family == CHIP_MULLINS) |
1867 | kv_enable_nb_dpm(rdev); | 1881 | kv_enable_nb_dpm(rdev, true); |
1868 | } | 1882 | } |
1869 | } else { | 1883 | } else { |
1870 | if (pi->enable_dpm) { | 1884 | if (pi->enable_dpm) { |
@@ -1889,7 +1903,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
1889 | } | 1903 | } |
1890 | kv_update_acp_boot_level(rdev); | 1904 | kv_update_acp_boot_level(rdev); |
1891 | kv_update_sclk_t(rdev); | 1905 | kv_update_sclk_t(rdev); |
1892 | kv_enable_nb_dpm(rdev); | 1906 | kv_enable_nb_dpm(rdev, true); |
1893 | } | 1907 | } |
1894 | } | 1908 | } |
1895 | 1909 | ||
@@ -2726,7 +2740,10 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2726 | pi->caps_sclk_ds = true; | 2740 | pi->caps_sclk_ds = true; |
2727 | pi->enable_auto_thermal_throttling = true; | 2741 | pi->enable_auto_thermal_throttling = true; |
2728 | pi->disable_nb_ps3_in_battery = false; | 2742 | pi->disable_nb_ps3_in_battery = false; |
2729 | pi->bapm_enable = true; | 2743 | if (radeon_bapm == 0) |
2744 | pi->bapm_enable = false; | ||
2745 | else | ||
2746 | pi->bapm_enable = true; | ||
2730 | pi->voltage_drop_t = 0; | 2747 | pi->voltage_drop_t = 0; |
2731 | pi->caps_sclk_throttle_low_notification = false; | 2748 | pi->caps_sclk_throttle_low_notification = false; |
2732 | pi->caps_fps = false; /* true? */ | 2749 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 327b85f7fd0d..3faee58946dd 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1271,7 +1271,7 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) | |||
1271 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0); | 1271 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0); |
1272 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), rdev->vm_manager.max_pfn); | 1272 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), rdev->vm_manager.max_pfn); |
1273 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 1273 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
1274 | rdev->gart.table_addr >> 12); | 1274 | rdev->vm_manager.saved_table_addr[i]); |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | /* enable context1-7 */ | 1277 | /* enable context1-7 */ |
@@ -1303,6 +1303,13 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) | |||
1303 | 1303 | ||
1304 | static void cayman_pcie_gart_disable(struct radeon_device *rdev) | 1304 | static void cayman_pcie_gart_disable(struct radeon_device *rdev) |
1305 | { | 1305 | { |
1306 | unsigned i; | ||
1307 | |||
1308 | for (i = 1; i < 8; ++i) { | ||
1309 | rdev->vm_manager.saved_table_addr[i] = RREG32( | ||
1310 | VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2)); | ||
1311 | } | ||
1312 | |||
1306 | /* Disable all tables */ | 1313 | /* Disable all tables */ |
1307 | WREG32(VM_CONTEXT0_CNTL, 0); | 1314 | WREG32(VM_CONTEXT0_CNTL, 0); |
1308 | WREG32(VM_CONTEXT1_CNTL, 0); | 1315 | WREG32(VM_CONTEXT1_CNTL, 0); |
@@ -1505,7 +1512,7 @@ static int cayman_cp_start(struct radeon_device *rdev) | |||
1505 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); | 1512 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); |
1506 | radeon_ring_write(ring, 0); | 1513 | radeon_ring_write(ring, 0); |
1507 | radeon_ring_write(ring, 0); | 1514 | radeon_ring_write(ring, 0); |
1508 | radeon_ring_unlock_commit(rdev, ring); | 1515 | radeon_ring_unlock_commit(rdev, ring, false); |
1509 | 1516 | ||
1510 | cayman_cp_enable(rdev, true); | 1517 | cayman_cp_enable(rdev, true); |
1511 | 1518 | ||
@@ -1547,7 +1554,7 @@ static int cayman_cp_start(struct radeon_device *rdev) | |||
1547 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | 1554 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
1548 | radeon_ring_write(ring, 0x00000010); /* */ | 1555 | radeon_ring_write(ring, 0x00000010); /* */ |
1549 | 1556 | ||
1550 | radeon_ring_unlock_commit(rdev, ring); | 1557 | radeon_ring_unlock_commit(rdev, ring, false); |
1551 | 1558 | ||
1552 | /* XXX init other rings */ | 1559 | /* XXX init other rings */ |
1553 | 1560 | ||
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c index 8a3e6221cece..f26f0a9fb522 100644 --- a/drivers/gpu/drm/radeon/ni_dma.c +++ b/drivers/gpu/drm/radeon/ni_dma.c | |||
@@ -191,12 +191,6 @@ int cayman_dma_resume(struct radeon_device *rdev) | |||
191 | u32 reg_offset, wb_offset; | 191 | u32 reg_offset, wb_offset; |
192 | int i, r; | 192 | int i, r; |
193 | 193 | ||
194 | /* Reset dma */ | ||
195 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1); | ||
196 | RREG32(SRBM_SOFT_RESET); | ||
197 | udelay(50); | ||
198 | WREG32(SRBM_SOFT_RESET, 0); | ||
199 | |||
200 | for (i = 0; i < 2; i++) { | 194 | for (i = 0; i < 2; i++) { |
201 | if (i == 0) { | 195 | if (i == 0) { |
202 | ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; | 196 | ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 04b5940b8923..b0098e792e62 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -821,6 +821,20 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc) | |||
821 | return RREG32(RADEON_CRTC2_CRNT_FRAME); | 821 | return RREG32(RADEON_CRTC2_CRNT_FRAME); |
822 | } | 822 | } |
823 | 823 | ||
824 | /** | ||
825 | * r100_ring_hdp_flush - flush Host Data Path via the ring buffer | ||
826 | * rdev: radeon device structure | ||
827 | * ring: ring buffer struct for emitting packets | ||
828 | */ | ||
829 | static void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring) | ||
830 | { | ||
831 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
832 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl | | ||
833 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
834 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
835 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl); | ||
836 | } | ||
837 | |||
824 | /* Who ever call radeon_fence_emit should call ring_lock and ask | 838 | /* Who ever call radeon_fence_emit should call ring_lock and ask |
825 | * for enough space (today caller are ib schedule and buffer move) */ | 839 | * for enough space (today caller are ib schedule and buffer move) */ |
826 | void r100_fence_ring_emit(struct radeon_device *rdev, | 840 | void r100_fence_ring_emit(struct radeon_device *rdev, |
@@ -925,7 +939,7 @@ int r100_copy_blit(struct radeon_device *rdev, | |||
925 | if (fence) { | 939 | if (fence) { |
926 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); | 940 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); |
927 | } | 941 | } |
928 | radeon_ring_unlock_commit(rdev, ring); | 942 | radeon_ring_unlock_commit(rdev, ring, false); |
929 | return r; | 943 | return r; |
930 | } | 944 | } |
931 | 945 | ||
@@ -958,7 +972,7 @@ void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) | |||
958 | RADEON_ISYNC_ANY3D_IDLE2D | | 972 | RADEON_ISYNC_ANY3D_IDLE2D | |
959 | RADEON_ISYNC_WAIT_IDLEGUI | | 973 | RADEON_ISYNC_WAIT_IDLEGUI | |
960 | RADEON_ISYNC_CPSCRATCH_IDLEGUI); | 974 | RADEON_ISYNC_CPSCRATCH_IDLEGUI); |
961 | radeon_ring_unlock_commit(rdev, ring); | 975 | radeon_ring_unlock_commit(rdev, ring, false); |
962 | } | 976 | } |
963 | 977 | ||
964 | 978 | ||
@@ -1056,20 +1070,6 @@ void r100_gfx_set_wptr(struct radeon_device *rdev, | |||
1056 | (void)RREG32(RADEON_CP_RB_WPTR); | 1070 | (void)RREG32(RADEON_CP_RB_WPTR); |
1057 | } | 1071 | } |
1058 | 1072 | ||
1059 | /** | ||
1060 | * r100_ring_hdp_flush - flush Host Data Path via the ring buffer | ||
1061 | * rdev: radeon device structure | ||
1062 | * ring: ring buffer struct for emitting packets | ||
1063 | */ | ||
1064 | void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring) | ||
1065 | { | ||
1066 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
1067 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl | | ||
1068 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
1069 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
1070 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl); | ||
1071 | } | ||
1072 | |||
1073 | static void r100_cp_load_microcode(struct radeon_device *rdev) | 1073 | static void r100_cp_load_microcode(struct radeon_device *rdev) |
1074 | { | 1074 | { |
1075 | const __be32 *fw_data; | 1075 | const __be32 *fw_data; |
@@ -3638,7 +3638,7 @@ int r100_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
3638 | } | 3638 | } |
3639 | radeon_ring_write(ring, PACKET0(scratch, 0)); | 3639 | radeon_ring_write(ring, PACKET0(scratch, 0)); |
3640 | radeon_ring_write(ring, 0xDEADBEEF); | 3640 | radeon_ring_write(ring, 0xDEADBEEF); |
3641 | radeon_ring_unlock_commit(rdev, ring); | 3641 | radeon_ring_unlock_commit(rdev, ring, false); |
3642 | for (i = 0; i < rdev->usec_timeout; i++) { | 3642 | for (i = 0; i < rdev->usec_timeout; i++) { |
3643 | tmp = RREG32(scratch); | 3643 | tmp = RREG32(scratch); |
3644 | if (tmp == 0xDEADBEEF) { | 3644 | if (tmp == 0xDEADBEEF) { |
@@ -3700,7 +3700,7 @@ int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
3700 | ib.ptr[6] = PACKET2(0); | 3700 | ib.ptr[6] = PACKET2(0); |
3701 | ib.ptr[7] = PACKET2(0); | 3701 | ib.ptr[7] = PACKET2(0); |
3702 | ib.length_dw = 8; | 3702 | ib.length_dw = 8; |
3703 | r = radeon_ib_schedule(rdev, &ib, NULL); | 3703 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
3704 | if (r) { | 3704 | if (r) { |
3705 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 3705 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
3706 | goto free_ib; | 3706 | goto free_ib; |
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c index 58f0473aa73f..67780374a652 100644 --- a/drivers/gpu/drm/radeon/r200.c +++ b/drivers/gpu/drm/radeon/r200.c | |||
@@ -121,7 +121,7 @@ int r200_copy_dma(struct radeon_device *rdev, | |||
121 | if (fence) { | 121 | if (fence) { |
122 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); | 122 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); |
123 | } | 123 | } |
124 | radeon_ring_unlock_commit(rdev, ring); | 124 | radeon_ring_unlock_commit(rdev, ring, false); |
125 | return r; | 125 | return r; |
126 | } | 126 | } |
127 | 127 | ||
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 75b30338c226..1bc4704034ce 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -295,7 +295,7 @@ void r300_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) | |||
295 | radeon_ring_write(ring, | 295 | radeon_ring_write(ring, |
296 | R300_GEOMETRY_ROUND_NEAREST | | 296 | R300_GEOMETRY_ROUND_NEAREST | |
297 | R300_COLOR_ROUND_NEAREST); | 297 | R300_COLOR_ROUND_NEAREST); |
298 | radeon_ring_unlock_commit(rdev, ring); | 298 | radeon_ring_unlock_commit(rdev, ring, false); |
299 | } | 299 | } |
300 | 300 | ||
301 | static void r300_errata(struct radeon_device *rdev) | 301 | static void r300_errata(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 802b19220a21..2828605aef3f 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -219,7 +219,7 @@ static void r420_cp_errata_init(struct radeon_device *rdev) | |||
219 | radeon_ring_write(ring, PACKET0(R300_CP_RESYNC_ADDR, 1)); | 219 | radeon_ring_write(ring, PACKET0(R300_CP_RESYNC_ADDR, 1)); |
220 | radeon_ring_write(ring, rdev->config.r300.resync_scratch); | 220 | radeon_ring_write(ring, rdev->config.r300.resync_scratch); |
221 | radeon_ring_write(ring, 0xDEADBEEF); | 221 | radeon_ring_write(ring, 0xDEADBEEF); |
222 | radeon_ring_unlock_commit(rdev, ring); | 222 | radeon_ring_unlock_commit(rdev, ring, false); |
223 | } | 223 | } |
224 | 224 | ||
225 | static void r420_cp_errata_fini(struct radeon_device *rdev) | 225 | static void r420_cp_errata_fini(struct radeon_device *rdev) |
@@ -232,7 +232,7 @@ static void r420_cp_errata_fini(struct radeon_device *rdev) | |||
232 | radeon_ring_lock(rdev, ring, 8); | 232 | radeon_ring_lock(rdev, ring, 8); |
233 | radeon_ring_write(ring, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | 233 | radeon_ring_write(ring, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); |
234 | radeon_ring_write(ring, R300_RB3D_DC_FINISH); | 234 | radeon_ring_write(ring, R300_RB3D_DC_FINISH); |
235 | radeon_ring_unlock_commit(rdev, ring); | 235 | radeon_ring_unlock_commit(rdev, ring, false); |
236 | radeon_scratch_free(rdev, rdev->config.r300.resync_scratch); | 236 | radeon_scratch_free(rdev, rdev->config.r300.resync_scratch); |
237 | } | 237 | } |
238 | 238 | ||
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index c70a504d96af..ea5c9af722ef 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1812,7 +1812,6 @@ static void r600_gpu_init(struct radeon_device *rdev) | |||
1812 | { | 1812 | { |
1813 | u32 tiling_config; | 1813 | u32 tiling_config; |
1814 | u32 ramcfg; | 1814 | u32 ramcfg; |
1815 | u32 cc_rb_backend_disable; | ||
1816 | u32 cc_gc_shader_pipe_config; | 1815 | u32 cc_gc_shader_pipe_config; |
1817 | u32 tmp; | 1816 | u32 tmp; |
1818 | int i, j; | 1817 | int i, j; |
@@ -1939,29 +1938,20 @@ static void r600_gpu_init(struct radeon_device *rdev) | |||
1939 | } | 1938 | } |
1940 | tiling_config |= BANK_SWAPS(1); | 1939 | tiling_config |= BANK_SWAPS(1); |
1941 | 1940 | ||
1942 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; | ||
1943 | tmp = R6XX_MAX_BACKENDS - | ||
1944 | r600_count_pipe_bits((cc_rb_backend_disable >> 16) & R6XX_MAX_BACKENDS_MASK); | ||
1945 | if (tmp < rdev->config.r600.max_backends) { | ||
1946 | rdev->config.r600.max_backends = tmp; | ||
1947 | } | ||
1948 | |||
1949 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0x00ffff00; | 1941 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0x00ffff00; |
1950 | tmp = R6XX_MAX_PIPES - | ||
1951 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 8) & R6XX_MAX_PIPES_MASK); | ||
1952 | if (tmp < rdev->config.r600.max_pipes) { | ||
1953 | rdev->config.r600.max_pipes = tmp; | ||
1954 | } | ||
1955 | tmp = R6XX_MAX_SIMDS - | ||
1956 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK); | ||
1957 | if (tmp < rdev->config.r600.max_simds) { | ||
1958 | rdev->config.r600.max_simds = tmp; | ||
1959 | } | ||
1960 | tmp = rdev->config.r600.max_simds - | 1942 | tmp = rdev->config.r600.max_simds - |
1961 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK); | 1943 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK); |
1962 | rdev->config.r600.active_simds = tmp; | 1944 | rdev->config.r600.active_simds = tmp; |
1963 | 1945 | ||
1964 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R6XX_MAX_BACKENDS_MASK; | 1946 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R6XX_MAX_BACKENDS_MASK; |
1947 | tmp = 0; | ||
1948 | for (i = 0; i < rdev->config.r600.max_backends; i++) | ||
1949 | tmp |= (1 << i); | ||
1950 | /* if all the backends are disabled, fix it up here */ | ||
1951 | if ((disabled_rb_mask & tmp) == tmp) { | ||
1952 | for (i = 0; i < rdev->config.r600.max_backends; i++) | ||
1953 | disabled_rb_mask &= ~(1 << i); | ||
1954 | } | ||
1965 | tmp = (tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; | 1955 | tmp = (tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; |
1966 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.r600.max_backends, | 1956 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.r600.max_backends, |
1967 | R6XX_MAX_BACKENDS, disabled_rb_mask); | 1957 | R6XX_MAX_BACKENDS, disabled_rb_mask); |
@@ -2547,7 +2537,7 @@ int r600_cp_start(struct radeon_device *rdev) | |||
2547 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); | 2537 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); |
2548 | radeon_ring_write(ring, 0); | 2538 | radeon_ring_write(ring, 0); |
2549 | radeon_ring_write(ring, 0); | 2539 | radeon_ring_write(ring, 0); |
2550 | radeon_ring_unlock_commit(rdev, ring); | 2540 | radeon_ring_unlock_commit(rdev, ring, false); |
2551 | 2541 | ||
2552 | cp_me = 0xff; | 2542 | cp_me = 0xff; |
2553 | WREG32(R_0086D8_CP_ME_CNTL, cp_me); | 2543 | WREG32(R_0086D8_CP_ME_CNTL, cp_me); |
@@ -2683,7 +2673,7 @@ int r600_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
2683 | radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | 2673 | radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
2684 | radeon_ring_write(ring, ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); | 2674 | radeon_ring_write(ring, ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); |
2685 | radeon_ring_write(ring, 0xDEADBEEF); | 2675 | radeon_ring_write(ring, 0xDEADBEEF); |
2686 | radeon_ring_unlock_commit(rdev, ring); | 2676 | radeon_ring_unlock_commit(rdev, ring, false); |
2687 | for (i = 0; i < rdev->usec_timeout; i++) { | 2677 | for (i = 0; i < rdev->usec_timeout; i++) { |
2688 | tmp = RREG32(scratch); | 2678 | tmp = RREG32(scratch); |
2689 | if (tmp == 0xDEADBEEF) | 2679 | if (tmp == 0xDEADBEEF) |
@@ -2753,6 +2743,17 @@ void r600_fence_ring_emit(struct radeon_device *rdev, | |||
2753 | } | 2743 | } |
2754 | } | 2744 | } |
2755 | 2745 | ||
2746 | /** | ||
2747 | * r600_semaphore_ring_emit - emit a semaphore on the CP ring | ||
2748 | * | ||
2749 | * @rdev: radeon_device pointer | ||
2750 | * @ring: radeon ring buffer object | ||
2751 | * @semaphore: radeon semaphore object | ||
2752 | * @emit_wait: Is this a sempahore wait? | ||
2753 | * | ||
2754 | * Emits a semaphore signal/wait packet to the CP ring and prevents the PFP | ||
2755 | * from running ahead of semaphore waits. | ||
2756 | */ | ||
2756 | bool r600_semaphore_ring_emit(struct radeon_device *rdev, | 2757 | bool r600_semaphore_ring_emit(struct radeon_device *rdev, |
2757 | struct radeon_ring *ring, | 2758 | struct radeon_ring *ring, |
2758 | struct radeon_semaphore *semaphore, | 2759 | struct radeon_semaphore *semaphore, |
@@ -2768,6 +2769,13 @@ bool r600_semaphore_ring_emit(struct radeon_device *rdev, | |||
2768 | radeon_ring_write(ring, lower_32_bits(addr)); | 2769 | radeon_ring_write(ring, lower_32_bits(addr)); |
2769 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); | 2770 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); |
2770 | 2771 | ||
2772 | /* PFP_SYNC_ME packet only exists on 7xx+, only enable it on eg+ */ | ||
2773 | if (emit_wait && (rdev->family >= CHIP_CEDAR)) { | ||
2774 | /* Prevent the PFP from running ahead of the semaphore wait */ | ||
2775 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | ||
2776 | radeon_ring_write(ring, 0x0); | ||
2777 | } | ||
2778 | |||
2771 | return true; | 2779 | return true; |
2772 | } | 2780 | } |
2773 | 2781 | ||
@@ -2845,7 +2853,7 @@ int r600_copy_cpdma(struct radeon_device *rdev, | |||
2845 | return r; | 2853 | return r; |
2846 | } | 2854 | } |
2847 | 2855 | ||
2848 | radeon_ring_unlock_commit(rdev, ring); | 2856 | radeon_ring_unlock_commit(rdev, ring, false); |
2849 | radeon_semaphore_free(rdev, &sem, *fence); | 2857 | radeon_semaphore_free(rdev, &sem, *fence); |
2850 | 2858 | ||
2851 | return r; | 2859 | return r; |
@@ -3165,7 +3173,7 @@ int r600_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
3165 | ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); | 3173 | ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
3166 | ib.ptr[2] = 0xDEADBEEF; | 3174 | ib.ptr[2] = 0xDEADBEEF; |
3167 | ib.length_dw = 3; | 3175 | ib.length_dw = 3; |
3168 | r = radeon_ib_schedule(rdev, &ib, NULL); | 3176 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
3169 | if (r) { | 3177 | if (r) { |
3170 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 3178 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
3171 | goto free_ib; | 3179 | goto free_ib; |
@@ -3784,17 +3792,17 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
3784 | wptr = RREG32(IH_RB_WPTR); | 3792 | wptr = RREG32(IH_RB_WPTR); |
3785 | 3793 | ||
3786 | if (wptr & RB_OVERFLOW) { | 3794 | if (wptr & RB_OVERFLOW) { |
3795 | wptr &= ~RB_OVERFLOW; | ||
3787 | /* When a ring buffer overflow happen start parsing interrupt | 3796 | /* When a ring buffer overflow happen start parsing interrupt |
3788 | * from the last not overwritten vector (wptr + 16). Hopefully | 3797 | * from the last not overwritten vector (wptr + 16). Hopefully |
3789 | * this should allow us to catchup. | 3798 | * this should allow us to catchup. |
3790 | */ | 3799 | */ |
3791 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 3800 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
3792 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 3801 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
3793 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 3802 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
3794 | tmp = RREG32(IH_RB_CNTL); | 3803 | tmp = RREG32(IH_RB_CNTL); |
3795 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 3804 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
3796 | WREG32(IH_RB_CNTL, tmp); | 3805 | WREG32(IH_RB_CNTL, tmp); |
3797 | wptr &= ~RB_OVERFLOW; | ||
3798 | } | 3806 | } |
3799 | return (wptr & rdev->ih.ptr_mask); | 3807 | return (wptr & rdev->ih.ptr_mask); |
3800 | } | 3808 | } |
@@ -4040,6 +4048,7 @@ restart_ih: | |||
4040 | /* wptr/rptr are in bytes! */ | 4048 | /* wptr/rptr are in bytes! */ |
4041 | rptr += 16; | 4049 | rptr += 16; |
4042 | rptr &= rdev->ih.ptr_mask; | 4050 | rptr &= rdev->ih.ptr_mask; |
4051 | WREG32(IH_RB_RPTR, rptr); | ||
4043 | } | 4052 | } |
4044 | if (queue_hotplug) | 4053 | if (queue_hotplug) |
4045 | schedule_work(&rdev->hotplug_work); | 4054 | schedule_work(&rdev->hotplug_work); |
@@ -4048,7 +4057,6 @@ restart_ih: | |||
4048 | if (queue_thermal && rdev->pm.dpm_enabled) | 4057 | if (queue_thermal && rdev->pm.dpm_enabled) |
4049 | schedule_work(&rdev->pm.dpm.thermal.work); | 4058 | schedule_work(&rdev->pm.dpm.thermal.work); |
4050 | rdev->ih.rptr = rptr; | 4059 | rdev->ih.rptr = rptr; |
4051 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
4052 | atomic_set(&rdev->ih.lock, 0); | 4060 | atomic_set(&rdev->ih.lock, 0); |
4053 | 4061 | ||
4054 | /* make sure wptr hasn't changed while processing */ | 4062 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c index 4969cef44a19..a908daa006d2 100644 --- a/drivers/gpu/drm/radeon/r600_dma.c +++ b/drivers/gpu/drm/radeon/r600_dma.c | |||
@@ -124,15 +124,6 @@ int r600_dma_resume(struct radeon_device *rdev) | |||
124 | u32 rb_bufsz; | 124 | u32 rb_bufsz; |
125 | int r; | 125 | int r; |
126 | 126 | ||
127 | /* Reset dma */ | ||
128 | if (rdev->family >= CHIP_RV770) | ||
129 | WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA); | ||
130 | else | ||
131 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA); | ||
132 | RREG32(SRBM_SOFT_RESET); | ||
133 | udelay(50); | ||
134 | WREG32(SRBM_SOFT_RESET, 0); | ||
135 | |||
136 | WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); | 127 | WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); |
137 | WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); | 128 | WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); |
138 | 129 | ||
@@ -261,7 +252,7 @@ int r600_dma_ring_test(struct radeon_device *rdev, | |||
261 | radeon_ring_write(ring, rdev->vram_scratch.gpu_addr & 0xfffffffc); | 252 | radeon_ring_write(ring, rdev->vram_scratch.gpu_addr & 0xfffffffc); |
262 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff); | 253 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff); |
263 | radeon_ring_write(ring, 0xDEADBEEF); | 254 | radeon_ring_write(ring, 0xDEADBEEF); |
264 | radeon_ring_unlock_commit(rdev, ring); | 255 | radeon_ring_unlock_commit(rdev, ring, false); |
265 | 256 | ||
266 | for (i = 0; i < rdev->usec_timeout; i++) { | 257 | for (i = 0; i < rdev->usec_timeout; i++) { |
267 | tmp = readl(ptr); | 258 | tmp = readl(ptr); |
@@ -368,7 +359,7 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
368 | ib.ptr[3] = 0xDEADBEEF; | 359 | ib.ptr[3] = 0xDEADBEEF; |
369 | ib.length_dw = 4; | 360 | ib.length_dw = 4; |
370 | 361 | ||
371 | r = radeon_ib_schedule(rdev, &ib, NULL); | 362 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
372 | if (r) { | 363 | if (r) { |
373 | radeon_ib_free(rdev, &ib); | 364 | radeon_ib_free(rdev, &ib); |
374 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 365 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
@@ -493,7 +484,7 @@ int r600_copy_dma(struct radeon_device *rdev, | |||
493 | return r; | 484 | return r; |
494 | } | 485 | } |
495 | 486 | ||
496 | radeon_ring_unlock_commit(rdev, ring); | 487 | radeon_ring_unlock_commit(rdev, ring, false); |
497 | radeon_semaphore_free(rdev, &sem, *fence); | 488 | radeon_semaphore_free(rdev, &sem, *fence); |
498 | 489 | ||
499 | return r; | 490 | return r; |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index f94e7a9afe75..31e1052ad3e3 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -44,13 +44,6 @@ | |||
44 | #define R6XX_MAX_PIPES 8 | 44 | #define R6XX_MAX_PIPES 8 |
45 | #define R6XX_MAX_PIPES_MASK 0xff | 45 | #define R6XX_MAX_PIPES_MASK 0xff |
46 | 46 | ||
47 | /* PTE flags */ | ||
48 | #define PTE_VALID (1 << 0) | ||
49 | #define PTE_SYSTEM (1 << 1) | ||
50 | #define PTE_SNOOPED (1 << 2) | ||
51 | #define PTE_READABLE (1 << 5) | ||
52 | #define PTE_WRITEABLE (1 << 6) | ||
53 | |||
54 | /* tiling bits */ | 47 | /* tiling bits */ |
55 | #define ARRAY_LINEAR_GENERAL 0x00000000 | 48 | #define ARRAY_LINEAR_GENERAL 0x00000000 |
56 | #define ARRAY_LINEAR_ALIGNED 0x00000001 | 49 | #define ARRAY_LINEAR_ALIGNED 0x00000001 |
@@ -1597,6 +1590,7 @@ | |||
1597 | */ | 1590 | */ |
1598 | # define PACKET3_CP_DMA_CMD_SAIC (1 << 28) | 1591 | # define PACKET3_CP_DMA_CMD_SAIC (1 << 28) |
1599 | # define PACKET3_CP_DMA_CMD_DAIC (1 << 29) | 1592 | # define PACKET3_CP_DMA_CMD_DAIC (1 << 29) |
1593 | #define PACKET3_PFP_SYNC_ME 0x42 /* r7xx+ only */ | ||
1600 | #define PACKET3_SURFACE_SYNC 0x43 | 1594 | #define PACKET3_SURFACE_SYNC 0x43 |
1601 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) | 1595 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) |
1602 | # define PACKET3_FULL_CACHE_ENA (1 << 20) /* r7xx+ only */ | 1596 | # define PACKET3_FULL_CACHE_ENA (1 << 20) /* r7xx+ only */ |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 9e1732eb402c..3247bfd14410 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -105,6 +105,8 @@ extern int radeon_vm_size; | |||
105 | extern int radeon_vm_block_size; | 105 | extern int radeon_vm_block_size; |
106 | extern int radeon_deep_color; | 106 | extern int radeon_deep_color; |
107 | extern int radeon_use_pflipirq; | 107 | extern int radeon_use_pflipirq; |
108 | extern int radeon_bapm; | ||
109 | extern int radeon_backlight; | ||
108 | 110 | ||
109 | /* | 111 | /* |
110 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 112 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
@@ -914,6 +916,8 @@ struct radeon_vm_manager { | |||
914 | u64 vram_base_offset; | 916 | u64 vram_base_offset; |
915 | /* is vm enabled? */ | 917 | /* is vm enabled? */ |
916 | bool enabled; | 918 | bool enabled; |
919 | /* for hw to save the PD addr on suspend/resume */ | ||
920 | uint32_t saved_table_addr[RADEON_NUM_VM]; | ||
917 | }; | 921 | }; |
918 | 922 | ||
919 | /* | 923 | /* |
@@ -967,7 +971,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring, | |||
967 | unsigned size); | 971 | unsigned size); |
968 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib); | 972 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib); |
969 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, | 973 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, |
970 | struct radeon_ib *const_ib); | 974 | struct radeon_ib *const_ib, bool hdp_flush); |
971 | int radeon_ib_pool_init(struct radeon_device *rdev); | 975 | int radeon_ib_pool_init(struct radeon_device *rdev); |
972 | void radeon_ib_pool_fini(struct radeon_device *rdev); | 976 | void radeon_ib_pool_fini(struct radeon_device *rdev); |
973 | int radeon_ib_ring_tests(struct radeon_device *rdev); | 977 | int radeon_ib_ring_tests(struct radeon_device *rdev); |
@@ -977,8 +981,10 @@ bool radeon_ring_supports_scratch_reg(struct radeon_device *rdev, | |||
977 | void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *cp); | 981 | void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *cp); |
978 | int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); | 982 | int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); |
979 | int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); | 983 | int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); |
980 | void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp); | 984 | void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp, |
981 | void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp); | 985 | bool hdp_flush); |
986 | void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp, | ||
987 | bool hdp_flush); | ||
982 | void radeon_ring_undo(struct radeon_ring *ring); | 988 | void radeon_ring_undo(struct radeon_ring *ring); |
983 | void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); | 989 | void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); |
984 | int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); | 990 | int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index eeeeabe09758..2dd5847f9b98 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -185,7 +185,6 @@ static struct radeon_asic_ring r100_gfx_ring = { | |||
185 | .get_rptr = &r100_gfx_get_rptr, | 185 | .get_rptr = &r100_gfx_get_rptr, |
186 | .get_wptr = &r100_gfx_get_wptr, | 186 | .get_wptr = &r100_gfx_get_wptr, |
187 | .set_wptr = &r100_gfx_set_wptr, | 187 | .set_wptr = &r100_gfx_set_wptr, |
188 | .hdp_flush = &r100_ring_hdp_flush, | ||
189 | }; | 188 | }; |
190 | 189 | ||
191 | static struct radeon_asic r100_asic = { | 190 | static struct radeon_asic r100_asic = { |
@@ -332,7 +331,6 @@ static struct radeon_asic_ring r300_gfx_ring = { | |||
332 | .get_rptr = &r100_gfx_get_rptr, | 331 | .get_rptr = &r100_gfx_get_rptr, |
333 | .get_wptr = &r100_gfx_get_wptr, | 332 | .get_wptr = &r100_gfx_get_wptr, |
334 | .set_wptr = &r100_gfx_set_wptr, | 333 | .set_wptr = &r100_gfx_set_wptr, |
335 | .hdp_flush = &r100_ring_hdp_flush, | ||
336 | }; | 334 | }; |
337 | 335 | ||
338 | static struct radeon_asic r300_asic = { | 336 | static struct radeon_asic r300_asic = { |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 275a5dc01780..7756bc1e1cd3 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -148,8 +148,7 @@ u32 r100_gfx_get_wptr(struct radeon_device *rdev, | |||
148 | struct radeon_ring *ring); | 148 | struct radeon_ring *ring); |
149 | void r100_gfx_set_wptr(struct radeon_device *rdev, | 149 | void r100_gfx_set_wptr(struct radeon_device *rdev, |
150 | struct radeon_ring *ring); | 150 | struct radeon_ring *ring); |
151 | void r100_ring_hdp_flush(struct radeon_device *rdev, | 151 | |
152 | struct radeon_ring *ring); | ||
153 | /* | 152 | /* |
154 | * r200,rv250,rs300,rv280 | 153 | * r200,rv250,rs300,rv280 |
155 | */ | 154 | */ |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 92b2d8dd4735..e74c7e387dde 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -447,6 +447,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | /* Fujitsu D3003-S2 board lists DVI-I as DVI-I and VGA */ | ||
451 | if ((dev->pdev->device == 0x9805) && | ||
452 | (dev->pdev->subsystem_vendor == 0x1734) && | ||
453 | (dev->pdev->subsystem_device == 0x11bd)) { | ||
454 | if (*connector_type == DRM_MODE_CONNECTOR_VGA) | ||
455 | return false; | ||
456 | } | ||
450 | 457 | ||
451 | return true; | 458 | return true; |
452 | } | 459 | } |
@@ -2281,19 +2288,31 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r | |||
2281 | (controller->ucFanParameters & | 2288 | (controller->ucFanParameters & |
2282 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | 2289 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2283 | rdev->pm.int_thermal_type = THERMAL_TYPE_KV; | 2290 | rdev->pm.int_thermal_type = THERMAL_TYPE_KV; |
2284 | } else if ((controller->ucType == | 2291 | } else if (controller->ucType == |
2285 | ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) || | 2292 | ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) { |
2286 | (controller->ucType == | 2293 | DRM_INFO("External GPIO thermal controller %s fan control\n", |
2287 | ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) || | 2294 | (controller->ucFanParameters & |
2288 | (controller->ucType == | 2295 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2289 | ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL)) { | 2296 | rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL_GPIO; |
2290 | DRM_INFO("Special thermal controller config\n"); | 2297 | } else if (controller->ucType == |
2298 | ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) { | ||
2299 | DRM_INFO("ADT7473 with internal thermal controller %s fan control\n", | ||
2300 | (controller->ucFanParameters & | ||
2301 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | ||
2302 | rdev->pm.int_thermal_type = THERMAL_TYPE_ADT7473_WITH_INTERNAL; | ||
2303 | } else if (controller->ucType == | ||
2304 | ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL) { | ||
2305 | DRM_INFO("EMC2103 with internal thermal controller %s fan control\n", | ||
2306 | (controller->ucFanParameters & | ||
2307 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | ||
2308 | rdev->pm.int_thermal_type = THERMAL_TYPE_EMC2103_WITH_INTERNAL; | ||
2291 | } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { | 2309 | } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { |
2292 | DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", | 2310 | DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", |
2293 | pp_lib_thermal_controller_names[controller->ucType], | 2311 | pp_lib_thermal_controller_names[controller->ucType], |
2294 | controller->ucI2cAddress >> 1, | 2312 | controller->ucI2cAddress >> 1, |
2295 | (controller->ucFanParameters & | 2313 | (controller->ucFanParameters & |
2296 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | 2314 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2315 | rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL; | ||
2297 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); | 2316 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); |
2298 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); | 2317 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
2299 | if (rdev->pm.i2c_bus) { | 2318 | if (rdev->pm.i2c_bus) { |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index a9fb0d016d38..8bc7d0bbd3c8 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -33,7 +33,6 @@ static struct radeon_atpx_priv { | |||
33 | bool atpx_detected; | 33 | bool atpx_detected; |
34 | /* handle for device - and atpx */ | 34 | /* handle for device - and atpx */ |
35 | acpi_handle dhandle; | 35 | acpi_handle dhandle; |
36 | acpi_handle other_handle; | ||
37 | struct radeon_atpx atpx; | 36 | struct radeon_atpx atpx; |
38 | } radeon_atpx_priv; | 37 | } radeon_atpx_priv; |
39 | 38 | ||
@@ -453,10 +452,9 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
453 | return false; | 452 | return false; |
454 | 453 | ||
455 | status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); | 454 | status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); |
456 | if (ACPI_FAILURE(status)) { | 455 | if (ACPI_FAILURE(status)) |
457 | radeon_atpx_priv.other_handle = dhandle; | ||
458 | return false; | 456 | return false; |
459 | } | 457 | |
460 | radeon_atpx_priv.dhandle = dhandle; | 458 | radeon_atpx_priv.dhandle = dhandle; |
461 | radeon_atpx_priv.atpx.handle = atpx_handle; | 459 | radeon_atpx_priv.atpx.handle = atpx_handle; |
462 | return true; | 460 | return true; |
@@ -540,16 +538,6 @@ static bool radeon_atpx_detect(void) | |||
540 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", | 538 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", |
541 | acpi_method_name); | 539 | acpi_method_name); |
542 | radeon_atpx_priv.atpx_detected = true; | 540 | radeon_atpx_priv.atpx_detected = true; |
543 | /* | ||
544 | * On some systems hotplug events are generated for the device | ||
545 | * being switched off when ATPX is executed. They cause ACPI | ||
546 | * hotplug to trigger and attempt to remove the device from | ||
547 | * the system, which causes it to break down. Prevent that from | ||
548 | * happening by setting the no_hotplug flag for the involved | ||
549 | * ACPI device objects. | ||
550 | */ | ||
551 | acpi_bus_no_hotplug(radeon_atpx_priv.dhandle); | ||
552 | acpi_bus_no_hotplug(radeon_atpx_priv.other_handle); | ||
553 | return true; | 541 | return true; |
554 | } | 542 | } |
555 | return false; | 543 | return false; |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index ee712c199b25..83f382e8e40e 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -132,7 +132,8 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) | |||
132 | * the buffers used for read only, which doubles the range | 132 | * the buffers used for read only, which doubles the range |
133 | * to 0 to 31. 32 is reserved for the kernel driver. | 133 | * to 0 to 31. 32 is reserved for the kernel driver. |
134 | */ | 134 | */ |
135 | priority = (r->flags & 0xf) * 2 + !!r->write_domain; | 135 | priority = (r->flags & RADEON_RELOC_PRIO_MASK) * 2 |
136 | + !!r->write_domain; | ||
136 | 137 | ||
137 | /* the first reloc of an UVD job is the msg and that must be in | 138 | /* the first reloc of an UVD job is the msg and that must be in |
138 | VRAM, also but everything into VRAM on AGP cards to avoid | 139 | VRAM, also but everything into VRAM on AGP cards to avoid |
@@ -450,7 +451,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev, | |||
450 | radeon_vce_note_usage(rdev); | 451 | radeon_vce_note_usage(rdev); |
451 | 452 | ||
452 | radeon_cs_sync_rings(parser); | 453 | radeon_cs_sync_rings(parser); |
453 | r = radeon_ib_schedule(rdev, &parser->ib, NULL); | 454 | r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); |
454 | if (r) { | 455 | if (r) { |
455 | DRM_ERROR("Failed to schedule IB !\n"); | 456 | DRM_ERROR("Failed to schedule IB !\n"); |
456 | } | 457 | } |
@@ -541,9 +542,9 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, | |||
541 | 542 | ||
542 | if ((rdev->family >= CHIP_TAHITI) && | 543 | if ((rdev->family >= CHIP_TAHITI) && |
543 | (parser->chunk_const_ib_idx != -1)) { | 544 | (parser->chunk_const_ib_idx != -1)) { |
544 | r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib); | 545 | r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib, true); |
545 | } else { | 546 | } else { |
546 | r = radeon_ib_schedule(rdev, &parser->ib, NULL); | 547 | r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); |
547 | } | 548 | } |
548 | 549 | ||
549 | out: | 550 | out: |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index c8ea050c8fa4..12c8329644c4 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -123,6 +123,10 @@ static struct radeon_px_quirk radeon_px_quirk_list[] = { | |||
123 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 | 123 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 |
124 | */ | 124 | */ |
125 | { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, | 125 | { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, |
126 | /* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU | ||
127 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 | ||
128 | */ | ||
129 | { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, | ||
126 | /* macbook pro 8.2 */ | 130 | /* macbook pro 8.2 */ |
127 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, | 131 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, |
128 | { 0, 0, 0, 0, 0 }, | 132 | { 0, 0, 0, 0, 0 }, |
@@ -1393,7 +1397,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1393 | 1397 | ||
1394 | r = radeon_init(rdev); | 1398 | r = radeon_init(rdev); |
1395 | if (r) | 1399 | if (r) |
1396 | return r; | 1400 | goto failed; |
1397 | 1401 | ||
1398 | r = radeon_ib_ring_tests(rdev); | 1402 | r = radeon_ib_ring_tests(rdev); |
1399 | if (r) | 1403 | if (r) |
@@ -1413,7 +1417,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1413 | radeon_agp_disable(rdev); | 1417 | radeon_agp_disable(rdev); |
1414 | r = radeon_init(rdev); | 1418 | r = radeon_init(rdev); |
1415 | if (r) | 1419 | if (r) |
1416 | return r; | 1420 | goto failed; |
1417 | } | 1421 | } |
1418 | 1422 | ||
1419 | if ((radeon_testing & 1)) { | 1423 | if ((radeon_testing & 1)) { |
@@ -1435,6 +1439,11 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1435 | DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); | 1439 | DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); |
1436 | } | 1440 | } |
1437 | return 0; | 1441 | return 0; |
1442 | |||
1443 | failed: | ||
1444 | if (runtime) | ||
1445 | vga_switcheroo_fini_domain_pm_ops(rdev->dev); | ||
1446 | return r; | ||
1438 | } | 1447 | } |
1439 | 1448 | ||
1440 | static void radeon_debugfs_remove_files(struct radeon_device *rdev); | 1449 | static void radeon_debugfs_remove_files(struct radeon_device *rdev); |
@@ -1455,6 +1464,8 @@ void radeon_device_fini(struct radeon_device *rdev) | |||
1455 | radeon_bo_evict_vram(rdev); | 1464 | radeon_bo_evict_vram(rdev); |
1456 | radeon_fini(rdev); | 1465 | radeon_fini(rdev); |
1457 | vga_switcheroo_unregister_client(rdev->pdev); | 1466 | vga_switcheroo_unregister_client(rdev->pdev); |
1467 | if (rdev->flags & RADEON_IS_PX) | ||
1468 | vga_switcheroo_fini_domain_pm_ops(rdev->dev); | ||
1458 | vga_client_register(rdev->pdev, NULL, NULL, NULL); | 1469 | vga_client_register(rdev->pdev, NULL, NULL, NULL); |
1459 | if (rdev->rio_mem) | 1470 | if (rdev->rio_mem) |
1460 | pci_iounmap(rdev->pdev, rdev->rio_mem); | 1471 | pci_iounmap(rdev->pdev, rdev->rio_mem); |
@@ -1680,8 +1691,8 @@ int radeon_gpu_reset(struct radeon_device *rdev) | |||
1680 | radeon_save_bios_scratch_regs(rdev); | 1691 | radeon_save_bios_scratch_regs(rdev); |
1681 | /* block TTM */ | 1692 | /* block TTM */ |
1682 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); | 1693 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); |
1683 | radeon_pm_suspend(rdev); | ||
1684 | radeon_suspend(rdev); | 1694 | radeon_suspend(rdev); |
1695 | radeon_hpd_fini(rdev); | ||
1685 | 1696 | ||
1686 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 1697 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
1687 | ring_sizes[i] = radeon_ring_backup(rdev, &rdev->ring[i], | 1698 | ring_sizes[i] = radeon_ring_backup(rdev, &rdev->ring[i], |
@@ -1726,9 +1737,39 @@ retry: | |||
1726 | } | 1737 | } |
1727 | } | 1738 | } |
1728 | 1739 | ||
1729 | radeon_pm_resume(rdev); | 1740 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { |
1741 | /* do dpm late init */ | ||
1742 | r = radeon_pm_late_init(rdev); | ||
1743 | if (r) { | ||
1744 | rdev->pm.dpm_enabled = false; | ||
1745 | DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); | ||
1746 | } | ||
1747 | } else { | ||
1748 | /* resume old pm late */ | ||
1749 | radeon_pm_resume(rdev); | ||
1750 | } | ||
1751 | |||
1752 | /* init dig PHYs, disp eng pll */ | ||
1753 | if (rdev->is_atom_bios) { | ||
1754 | radeon_atom_encoder_init(rdev); | ||
1755 | radeon_atom_disp_eng_pll_init(rdev); | ||
1756 | /* turn on the BL */ | ||
1757 | if (rdev->mode_info.bl_encoder) { | ||
1758 | u8 bl_level = radeon_get_backlight_level(rdev, | ||
1759 | rdev->mode_info.bl_encoder); | ||
1760 | radeon_set_backlight_level(rdev, rdev->mode_info.bl_encoder, | ||
1761 | bl_level); | ||
1762 | } | ||
1763 | } | ||
1764 | /* reset hpd state */ | ||
1765 | radeon_hpd_init(rdev); | ||
1766 | |||
1730 | drm_helper_resume_force_mode(rdev->ddev); | 1767 | drm_helper_resume_force_mode(rdev->ddev); |
1731 | 1768 | ||
1769 | /* set the power state here in case we are a PX system or headless */ | ||
1770 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) | ||
1771 | radeon_pm_compute_clocks(rdev); | ||
1772 | |||
1732 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); | 1773 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); |
1733 | if (r) { | 1774 | if (r) { |
1734 | /* bad news, how to tell it to userspace ? */ | 1775 | /* bad news, how to tell it to userspace ? */ |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 092d067f93e1..f9d17b29b343 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -83,7 +83,7 @@ | |||
83 | * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG | 83 | * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG |
84 | * 2.39.0 - Add INFO query for number of active CUs | 84 | * 2.39.0 - Add INFO query for number of active CUs |
85 | * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting | 85 | * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting |
86 | * CS to GPU | 86 | * CS to GPU on >= r600 |
87 | */ | 87 | */ |
88 | #define KMS_DRIVER_MAJOR 2 | 88 | #define KMS_DRIVER_MAJOR 2 |
89 | #define KMS_DRIVER_MINOR 40 | 89 | #define KMS_DRIVER_MINOR 40 |
@@ -180,6 +180,8 @@ int radeon_vm_size = 8; | |||
180 | int radeon_vm_block_size = -1; | 180 | int radeon_vm_block_size = -1; |
181 | int radeon_deep_color = 0; | 181 | int radeon_deep_color = 0; |
182 | int radeon_use_pflipirq = 2; | 182 | int radeon_use_pflipirq = 2; |
183 | int radeon_bapm = -1; | ||
184 | int radeon_backlight = -1; | ||
183 | 185 | ||
184 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 186 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
185 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 187 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
@@ -259,6 +261,12 @@ module_param_named(deep_color, radeon_deep_color, int, 0444); | |||
259 | MODULE_PARM_DESC(use_pflipirq, "Pflip irqs for pageflip completion (0 = disable, 1 = as fallback, 2 = exclusive (default))"); | 261 | MODULE_PARM_DESC(use_pflipirq, "Pflip irqs for pageflip completion (0 = disable, 1 = as fallback, 2 = exclusive (default))"); |
260 | module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444); | 262 | module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444); |
261 | 263 | ||
264 | MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); | ||
265 | module_param_named(bapm, radeon_bapm, int, 0444); | ||
266 | |||
267 | MODULE_PARM_DESC(backlight, "backlight support (1 = enable, 0 = disable, -1 = auto)"); | ||
268 | module_param_named(backlight, radeon_backlight, int, 0444); | ||
269 | |||
262 | static struct pci_device_id pciidlist[] = { | 270 | static struct pci_device_id pciidlist[] = { |
263 | radeon_PCI_IDS | 271 | radeon_PCI_IDS |
264 | }; | 272 | }; |
@@ -436,6 +444,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev) | |||
436 | ret = radeon_suspend_kms(drm_dev, false, false); | 444 | ret = radeon_suspend_kms(drm_dev, false, false); |
437 | pci_save_state(pdev); | 445 | pci_save_state(pdev); |
438 | pci_disable_device(pdev); | 446 | pci_disable_device(pdev); |
447 | pci_ignore_hotplug(pdev); | ||
439 | pci_set_power_state(pdev, PCI_D3cold); | 448 | pci_set_power_state(pdev, PCI_D3cold); |
440 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; | 449 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; |
441 | 450 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 3c2094c25b53..15edf23b465c 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -158,10 +158,43 @@ radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, uint8 | |||
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | 160 | ||
161 | static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder, | ||
162 | struct drm_connector *connector) | ||
163 | { | ||
164 | struct drm_device *dev = radeon_encoder->base.dev; | ||
165 | struct radeon_device *rdev = dev->dev_private; | ||
166 | bool use_bl = false; | ||
167 | |||
168 | if (!(radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))) | ||
169 | return; | ||
170 | |||
171 | if (radeon_backlight == 0) { | ||
172 | return; | ||
173 | } else if (radeon_backlight == 1) { | ||
174 | use_bl = true; | ||
175 | } else if (radeon_backlight == -1) { | ||
176 | /* Quirks */ | ||
177 | /* Amilo Xi 2550 only works with acpi bl */ | ||
178 | if ((rdev->pdev->device == 0x9583) && | ||
179 | (rdev->pdev->subsystem_vendor == 0x1734) && | ||
180 | (rdev->pdev->subsystem_device == 0x1107)) | ||
181 | use_bl = false; | ||
182 | else | ||
183 | use_bl = true; | ||
184 | } | ||
185 | |||
186 | if (use_bl) { | ||
187 | if (rdev->is_atom_bios) | ||
188 | radeon_atom_backlight_init(radeon_encoder, connector); | ||
189 | else | ||
190 | radeon_legacy_backlight_init(radeon_encoder, connector); | ||
191 | rdev->mode_info.bl_encoder = radeon_encoder; | ||
192 | } | ||
193 | } | ||
194 | |||
161 | void | 195 | void |
162 | radeon_link_encoder_connector(struct drm_device *dev) | 196 | radeon_link_encoder_connector(struct drm_device *dev) |
163 | { | 197 | { |
164 | struct radeon_device *rdev = dev->dev_private; | ||
165 | struct drm_connector *connector; | 198 | struct drm_connector *connector; |
166 | struct radeon_connector *radeon_connector; | 199 | struct radeon_connector *radeon_connector; |
167 | struct drm_encoder *encoder; | 200 | struct drm_encoder *encoder; |
@@ -174,13 +207,8 @@ radeon_link_encoder_connector(struct drm_device *dev) | |||
174 | radeon_encoder = to_radeon_encoder(encoder); | 207 | radeon_encoder = to_radeon_encoder(encoder); |
175 | if (radeon_encoder->devices & radeon_connector->devices) { | 208 | if (radeon_encoder->devices & radeon_connector->devices) { |
176 | drm_mode_connector_attach_encoder(connector, encoder); | 209 | drm_mode_connector_attach_encoder(connector, encoder); |
177 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 210 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) |
178 | if (rdev->is_atom_bios) | 211 | radeon_encoder_add_backlight(radeon_encoder, connector); |
179 | radeon_atom_backlight_init(radeon_encoder, connector); | ||
180 | else | ||
181 | radeon_legacy_backlight_init(radeon_encoder, connector); | ||
182 | rdev->mode_info.bl_encoder = radeon_encoder; | ||
183 | } | ||
184 | } | 212 | } |
185 | } | 213 | } |
186 | } | 214 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_ib.c b/drivers/gpu/drm/radeon/radeon_ib.c index 65b0c213488d..5bf2c0a05827 100644 --- a/drivers/gpu/drm/radeon/radeon_ib.c +++ b/drivers/gpu/drm/radeon/radeon_ib.c | |||
@@ -107,6 +107,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib) | |||
107 | * @rdev: radeon_device pointer | 107 | * @rdev: radeon_device pointer |
108 | * @ib: IB object to schedule | 108 | * @ib: IB object to schedule |
109 | * @const_ib: Const IB to schedule (SI only) | 109 | * @const_ib: Const IB to schedule (SI only) |
110 | * @hdp_flush: Whether or not to perform an HDP cache flush | ||
110 | * | 111 | * |
111 | * Schedule an IB on the associated ring (all asics). | 112 | * Schedule an IB on the associated ring (all asics). |
112 | * Returns 0 on success, error on failure. | 113 | * Returns 0 on success, error on failure. |
@@ -122,7 +123,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib) | |||
122 | * to SI there was just a DE IB. | 123 | * to SI there was just a DE IB. |
123 | */ | 124 | */ |
124 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, | 125 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, |
125 | struct radeon_ib *const_ib) | 126 | struct radeon_ib *const_ib, bool hdp_flush) |
126 | { | 127 | { |
127 | struct radeon_ring *ring = &rdev->ring[ib->ring]; | 128 | struct radeon_ring *ring = &rdev->ring[ib->ring]; |
128 | int r = 0; | 129 | int r = 0; |
@@ -176,7 +177,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, | |||
176 | if (ib->vm) | 177 | if (ib->vm) |
177 | radeon_vm_fence(rdev, ib->vm, ib->fence); | 178 | radeon_vm_fence(rdev, ib->vm, ib->fence); |
178 | 179 | ||
179 | radeon_ring_unlock_commit(rdev, ring); | 180 | radeon_ring_unlock_commit(rdev, ring, hdp_flush); |
180 | return 0; | 181 | return 0; |
181 | } | 182 | } |
182 | 183 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 23314be49480..164898b0010c 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -460,10 +460,6 @@ static ssize_t radeon_get_dpm_state(struct device *dev, | |||
460 | struct radeon_device *rdev = ddev->dev_private; | 460 | struct radeon_device *rdev = ddev->dev_private; |
461 | enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; | 461 | enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; |
462 | 462 | ||
463 | if ((rdev->flags & RADEON_IS_PX) && | ||
464 | (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
465 | return snprintf(buf, PAGE_SIZE, "off\n"); | ||
466 | |||
467 | return snprintf(buf, PAGE_SIZE, "%s\n", | 463 | return snprintf(buf, PAGE_SIZE, "%s\n", |
468 | (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : | 464 | (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : |
469 | (pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : "performance"); | 465 | (pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : "performance"); |
@@ -477,11 +473,6 @@ static ssize_t radeon_set_dpm_state(struct device *dev, | |||
477 | struct drm_device *ddev = dev_get_drvdata(dev); | 473 | struct drm_device *ddev = dev_get_drvdata(dev); |
478 | struct radeon_device *rdev = ddev->dev_private; | 474 | struct radeon_device *rdev = ddev->dev_private; |
479 | 475 | ||
480 | /* Can't set dpm state when the card is off */ | ||
481 | if ((rdev->flags & RADEON_IS_PX) && | ||
482 | (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
483 | return -EINVAL; | ||
484 | |||
485 | mutex_lock(&rdev->pm.mutex); | 476 | mutex_lock(&rdev->pm.mutex); |
486 | if (strncmp("battery", buf, strlen("battery")) == 0) | 477 | if (strncmp("battery", buf, strlen("battery")) == 0) |
487 | rdev->pm.dpm.user_state = POWER_STATE_TYPE_BATTERY; | 478 | rdev->pm.dpm.user_state = POWER_STATE_TYPE_BATTERY; |
@@ -495,7 +486,12 @@ static ssize_t radeon_set_dpm_state(struct device *dev, | |||
495 | goto fail; | 486 | goto fail; |
496 | } | 487 | } |
497 | mutex_unlock(&rdev->pm.mutex); | 488 | mutex_unlock(&rdev->pm.mutex); |
498 | radeon_pm_compute_clocks(rdev); | 489 | |
490 | /* Can't set dpm state when the card is off */ | ||
491 | if (!(rdev->flags & RADEON_IS_PX) || | ||
492 | (ddev->switch_power_state == DRM_SWITCH_POWER_ON)) | ||
493 | radeon_pm_compute_clocks(rdev); | ||
494 | |||
499 | fail: | 495 | fail: |
500 | return count; | 496 | return count; |
501 | } | 497 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 5b4e0cf231a0..d65607902537 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -177,16 +177,18 @@ int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *ring, unsig | |||
177 | * | 177 | * |
178 | * @rdev: radeon_device pointer | 178 | * @rdev: radeon_device pointer |
179 | * @ring: radeon_ring structure holding ring information | 179 | * @ring: radeon_ring structure holding ring information |
180 | * @hdp_flush: Whether or not to perform an HDP cache flush | ||
180 | * | 181 | * |
181 | * Update the wptr (write pointer) to tell the GPU to | 182 | * Update the wptr (write pointer) to tell the GPU to |
182 | * execute new commands on the ring buffer (all asics). | 183 | * execute new commands on the ring buffer (all asics). |
183 | */ | 184 | */ |
184 | void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring) | 185 | void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring, |
186 | bool hdp_flush) | ||
185 | { | 187 | { |
186 | /* If we are emitting the HDP flush via the ring buffer, we need to | 188 | /* If we are emitting the HDP flush via the ring buffer, we need to |
187 | * do it before padding. | 189 | * do it before padding. |
188 | */ | 190 | */ |
189 | if (rdev->asic->ring[ring->idx]->hdp_flush) | 191 | if (hdp_flush && rdev->asic->ring[ring->idx]->hdp_flush) |
190 | rdev->asic->ring[ring->idx]->hdp_flush(rdev, ring); | 192 | rdev->asic->ring[ring->idx]->hdp_flush(rdev, ring); |
191 | /* We pad to match fetch size */ | 193 | /* We pad to match fetch size */ |
192 | while (ring->wptr & ring->align_mask) { | 194 | while (ring->wptr & ring->align_mask) { |
@@ -196,7 +198,7 @@ void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring) | |||
196 | /* If we are emitting the HDP flush via MMIO, we need to do it after | 198 | /* If we are emitting the HDP flush via MMIO, we need to do it after |
197 | * all CPU writes to VRAM finished. | 199 | * all CPU writes to VRAM finished. |
198 | */ | 200 | */ |
199 | if (rdev->asic->mmio_hdp_flush) | 201 | if (hdp_flush && rdev->asic->mmio_hdp_flush) |
200 | rdev->asic->mmio_hdp_flush(rdev); | 202 | rdev->asic->mmio_hdp_flush(rdev); |
201 | radeon_ring_set_wptr(rdev, ring); | 203 | radeon_ring_set_wptr(rdev, ring); |
202 | } | 204 | } |
@@ -207,12 +209,14 @@ void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring) | |||
207 | * | 209 | * |
208 | * @rdev: radeon_device pointer | 210 | * @rdev: radeon_device pointer |
209 | * @ring: radeon_ring structure holding ring information | 211 | * @ring: radeon_ring structure holding ring information |
212 | * @hdp_flush: Whether or not to perform an HDP cache flush | ||
210 | * | 213 | * |
211 | * Call radeon_ring_commit() then unlock the ring (all asics). | 214 | * Call radeon_ring_commit() then unlock the ring (all asics). |
212 | */ | 215 | */ |
213 | void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *ring) | 216 | void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *ring, |
217 | bool hdp_flush) | ||
214 | { | 218 | { |
215 | radeon_ring_commit(rdev, ring); | 219 | radeon_ring_commit(rdev, ring, hdp_flush); |
216 | mutex_unlock(&rdev->ring_lock); | 220 | mutex_unlock(&rdev->ring_lock); |
217 | } | 221 | } |
218 | 222 | ||
@@ -372,7 +376,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring, | |||
372 | radeon_ring_write(ring, data[i]); | 376 | radeon_ring_write(ring, data[i]); |
373 | } | 377 | } |
374 | 378 | ||
375 | radeon_ring_unlock_commit(rdev, ring); | 379 | radeon_ring_unlock_commit(rdev, ring, false); |
376 | kfree(data); | 380 | kfree(data); |
377 | return 0; | 381 | return 0; |
378 | } | 382 | } |
@@ -400,9 +404,7 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig | |||
400 | /* Allocate ring buffer */ | 404 | /* Allocate ring buffer */ |
401 | if (ring->ring_obj == NULL) { | 405 | if (ring->ring_obj == NULL) { |
402 | r = radeon_bo_create(rdev, ring->ring_size, PAGE_SIZE, true, | 406 | r = radeon_bo_create(rdev, ring->ring_size, PAGE_SIZE, true, |
403 | RADEON_GEM_DOMAIN_GTT, | 407 | RADEON_GEM_DOMAIN_GTT, 0, |
404 | (rdev->flags & RADEON_IS_PCIE) ? | ||
405 | RADEON_GEM_GTT_WC : 0, | ||
406 | NULL, &ring->ring_obj); | 408 | NULL, &ring->ring_obj); |
407 | if (r) { | 409 | if (r) { |
408 | dev_err(rdev->dev, "(%d) ring create failed\n", r); | 410 | dev_err(rdev->dev, "(%d) ring create failed\n", r); |
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c index dbd6bcde92de..abd6753a570a 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c | |||
@@ -34,7 +34,7 @@ | |||
34 | int radeon_semaphore_create(struct radeon_device *rdev, | 34 | int radeon_semaphore_create(struct radeon_device *rdev, |
35 | struct radeon_semaphore **semaphore) | 35 | struct radeon_semaphore **semaphore) |
36 | { | 36 | { |
37 | uint32_t *cpu_addr; | 37 | uint64_t *cpu_addr; |
38 | int i, r; | 38 | int i, r; |
39 | 39 | ||
40 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); | 40 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); |
@@ -179,7 +179,7 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, | |||
179 | continue; | 179 | continue; |
180 | } | 180 | } |
181 | 181 | ||
182 | radeon_ring_commit(rdev, &rdev->ring[i]); | 182 | radeon_ring_commit(rdev, &rdev->ring[i], false); |
183 | radeon_fence_note_sync(fence, ring); | 183 | radeon_fence_note_sync(fence, ring); |
184 | 184 | ||
185 | semaphore->gpu_addr += 8; | 185 | semaphore->gpu_addr += 8; |
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c index 5adf4207453d..17bc3dced9f1 100644 --- a/drivers/gpu/drm/radeon/radeon_test.c +++ b/drivers/gpu/drm/radeon/radeon_test.c | |||
@@ -288,7 +288,7 @@ static int radeon_test_create_and_emit_fence(struct radeon_device *rdev, | |||
288 | return r; | 288 | return r; |
289 | } | 289 | } |
290 | radeon_fence_emit(rdev, fence, ring->idx); | 290 | radeon_fence_emit(rdev, fence, ring->idx); |
291 | radeon_ring_unlock_commit(rdev, ring); | 291 | radeon_ring_unlock_commit(rdev, ring, false); |
292 | } | 292 | } |
293 | return 0; | 293 | return 0; |
294 | } | 294 | } |
@@ -313,7 +313,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, | |||
313 | goto out_cleanup; | 313 | goto out_cleanup; |
314 | } | 314 | } |
315 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); | 315 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); |
316 | radeon_ring_unlock_commit(rdev, ringA); | 316 | radeon_ring_unlock_commit(rdev, ringA, false); |
317 | 317 | ||
318 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fence1); | 318 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fence1); |
319 | if (r) | 319 | if (r) |
@@ -325,7 +325,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, | |||
325 | goto out_cleanup; | 325 | goto out_cleanup; |
326 | } | 326 | } |
327 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); | 327 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); |
328 | radeon_ring_unlock_commit(rdev, ringA); | 328 | radeon_ring_unlock_commit(rdev, ringA, false); |
329 | 329 | ||
330 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fence2); | 330 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fence2); |
331 | if (r) | 331 | if (r) |
@@ -344,7 +344,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, | |||
344 | goto out_cleanup; | 344 | goto out_cleanup; |
345 | } | 345 | } |
346 | radeon_semaphore_emit_signal(rdev, ringB->idx, semaphore); | 346 | radeon_semaphore_emit_signal(rdev, ringB->idx, semaphore); |
347 | radeon_ring_unlock_commit(rdev, ringB); | 347 | radeon_ring_unlock_commit(rdev, ringB, false); |
348 | 348 | ||
349 | r = radeon_fence_wait(fence1, false); | 349 | r = radeon_fence_wait(fence1, false); |
350 | if (r) { | 350 | if (r) { |
@@ -365,7 +365,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, | |||
365 | goto out_cleanup; | 365 | goto out_cleanup; |
366 | } | 366 | } |
367 | radeon_semaphore_emit_signal(rdev, ringB->idx, semaphore); | 367 | radeon_semaphore_emit_signal(rdev, ringB->idx, semaphore); |
368 | radeon_ring_unlock_commit(rdev, ringB); | 368 | radeon_ring_unlock_commit(rdev, ringB, false); |
369 | 369 | ||
370 | r = radeon_fence_wait(fence2, false); | 370 | r = radeon_fence_wait(fence2, false); |
371 | if (r) { | 371 | if (r) { |
@@ -408,7 +408,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, | |||
408 | goto out_cleanup; | 408 | goto out_cleanup; |
409 | } | 409 | } |
410 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); | 410 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); |
411 | radeon_ring_unlock_commit(rdev, ringA); | 411 | radeon_ring_unlock_commit(rdev, ringA, false); |
412 | 412 | ||
413 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fenceA); | 413 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fenceA); |
414 | if (r) | 414 | if (r) |
@@ -420,7 +420,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, | |||
420 | goto out_cleanup; | 420 | goto out_cleanup; |
421 | } | 421 | } |
422 | radeon_semaphore_emit_wait(rdev, ringB->idx, semaphore); | 422 | radeon_semaphore_emit_wait(rdev, ringB->idx, semaphore); |
423 | radeon_ring_unlock_commit(rdev, ringB); | 423 | radeon_ring_unlock_commit(rdev, ringB, false); |
424 | r = radeon_test_create_and_emit_fence(rdev, ringB, &fenceB); | 424 | r = radeon_test_create_and_emit_fence(rdev, ringB, &fenceB); |
425 | if (r) | 425 | if (r) |
426 | goto out_cleanup; | 426 | goto out_cleanup; |
@@ -442,7 +442,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, | |||
442 | goto out_cleanup; | 442 | goto out_cleanup; |
443 | } | 443 | } |
444 | radeon_semaphore_emit_signal(rdev, ringC->idx, semaphore); | 444 | radeon_semaphore_emit_signal(rdev, ringC->idx, semaphore); |
445 | radeon_ring_unlock_commit(rdev, ringC); | 445 | radeon_ring_unlock_commit(rdev, ringC, false); |
446 | 446 | ||
447 | for (i = 0; i < 30; ++i) { | 447 | for (i = 0; i < 30; ++i) { |
448 | mdelay(100); | 448 | mdelay(100); |
@@ -468,7 +468,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, | |||
468 | goto out_cleanup; | 468 | goto out_cleanup; |
469 | } | 469 | } |
470 | radeon_semaphore_emit_signal(rdev, ringC->idx, semaphore); | 470 | radeon_semaphore_emit_signal(rdev, ringC->idx, semaphore); |
471 | radeon_ring_unlock_commit(rdev, ringC); | 471 | radeon_ring_unlock_commit(rdev, ringC, false); |
472 | 472 | ||
473 | mdelay(1000); | 473 | mdelay(1000); |
474 | 474 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 6bf55ec85b62..341848a14376 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -646,7 +646,7 @@ static int radeon_uvd_send_msg(struct radeon_device *rdev, | |||
646 | ib.ptr[i] = PACKET2(0); | 646 | ib.ptr[i] = PACKET2(0); |
647 | ib.length_dw = 16; | 647 | ib.length_dw = 16; |
648 | 648 | ||
649 | r = radeon_ib_schedule(rdev, &ib, NULL); | 649 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
650 | if (r) | 650 | if (r) |
651 | goto err; | 651 | goto err; |
652 | ttm_eu_fence_buffer_objects(&ticket, &head, ib.fence); | 652 | ttm_eu_fence_buffer_objects(&ticket, &head, ib.fence); |
diff --git a/drivers/gpu/drm/radeon/radeon_vce.c b/drivers/gpu/drm/radeon/radeon_vce.c index f9b70a43aa52..c7190aadbd89 100644 --- a/drivers/gpu/drm/radeon/radeon_vce.c +++ b/drivers/gpu/drm/radeon/radeon_vce.c | |||
@@ -368,7 +368,7 @@ int radeon_vce_get_create_msg(struct radeon_device *rdev, int ring, | |||
368 | for (i = ib.length_dw; i < ib_size_dw; ++i) | 368 | for (i = ib.length_dw; i < ib_size_dw; ++i) |
369 | ib.ptr[i] = 0x0; | 369 | ib.ptr[i] = 0x0; |
370 | 370 | ||
371 | r = radeon_ib_schedule(rdev, &ib, NULL); | 371 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
372 | if (r) { | 372 | if (r) { |
373 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 373 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
374 | } | 374 | } |
@@ -425,7 +425,7 @@ int radeon_vce_get_destroy_msg(struct radeon_device *rdev, int ring, | |||
425 | for (i = ib.length_dw; i < ib_size_dw; ++i) | 425 | for (i = ib.length_dw; i < ib_size_dw; ++i) |
426 | ib.ptr[i] = 0x0; | 426 | ib.ptr[i] = 0x0; |
427 | 427 | ||
428 | r = radeon_ib_schedule(rdev, &ib, NULL); | 428 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
429 | if (r) { | 429 | if (r) { |
430 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 430 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
431 | } | 431 | } |
@@ -715,7 +715,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
715 | return r; | 715 | return r; |
716 | } | 716 | } |
717 | radeon_ring_write(ring, VCE_CMD_END); | 717 | radeon_ring_write(ring, VCE_CMD_END); |
718 | radeon_ring_unlock_commit(rdev, ring); | 718 | radeon_ring_unlock_commit(rdev, ring, false); |
719 | 719 | ||
720 | for (i = 0; i < rdev->usec_timeout; i++) { | 720 | for (i = 0; i < rdev->usec_timeout; i++) { |
721 | if (vce_v1_0_get_rptr(rdev, ring) != rptr) | 721 | if (vce_v1_0_get_rptr(rdev, ring) != rptr) |
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index ccae4d9dc3de..088ffdc2f577 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
@@ -420,7 +420,7 @@ static int radeon_vm_clear_bo(struct radeon_device *rdev, | |||
420 | radeon_asic_vm_pad_ib(rdev, &ib); | 420 | radeon_asic_vm_pad_ib(rdev, &ib); |
421 | WARN_ON(ib.length_dw > 64); | 421 | WARN_ON(ib.length_dw > 64); |
422 | 422 | ||
423 | r = radeon_ib_schedule(rdev, &ib, NULL); | 423 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
424 | if (r) | 424 | if (r) |
425 | goto error; | 425 | goto error; |
426 | 426 | ||
@@ -483,6 +483,10 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
483 | /* add a clone of the bo_va to clear the old address */ | 483 | /* add a clone of the bo_va to clear the old address */ |
484 | struct radeon_bo_va *tmp; | 484 | struct radeon_bo_va *tmp; |
485 | tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); | 485 | tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); |
486 | if (!tmp) { | ||
487 | mutex_unlock(&vm->mutex); | ||
488 | return -ENOMEM; | ||
489 | } | ||
486 | tmp->it.start = bo_va->it.start; | 490 | tmp->it.start = bo_va->it.start; |
487 | tmp->it.last = bo_va->it.last; | 491 | tmp->it.last = bo_va->it.last; |
488 | tmp->vm = vm; | 492 | tmp->vm = vm; |
@@ -693,7 +697,7 @@ int radeon_vm_update_page_directory(struct radeon_device *rdev, | |||
693 | radeon_semaphore_sync_to(ib.semaphore, pd->tbo.sync_obj); | 697 | radeon_semaphore_sync_to(ib.semaphore, pd->tbo.sync_obj); |
694 | radeon_semaphore_sync_to(ib.semaphore, vm->last_id_use); | 698 | radeon_semaphore_sync_to(ib.semaphore, vm->last_id_use); |
695 | WARN_ON(ib.length_dw > ndw); | 699 | WARN_ON(ib.length_dw > ndw); |
696 | r = radeon_ib_schedule(rdev, &ib, NULL); | 700 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
697 | if (r) { | 701 | if (r) { |
698 | radeon_ib_free(rdev, &ib); | 702 | radeon_ib_free(rdev, &ib); |
699 | return r; | 703 | return r; |
@@ -957,7 +961,7 @@ int radeon_vm_bo_update(struct radeon_device *rdev, | |||
957 | WARN_ON(ib.length_dw > ndw); | 961 | WARN_ON(ib.length_dw > ndw); |
958 | 962 | ||
959 | radeon_semaphore_sync_to(ib.semaphore, vm->fence); | 963 | radeon_semaphore_sync_to(ib.semaphore, vm->fence); |
960 | r = radeon_ib_schedule(rdev, &ib, NULL); | 964 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
961 | if (r) { | 965 | if (r) { |
962 | radeon_ib_free(rdev, &ib); | 966 | radeon_ib_free(rdev, &ib); |
963 | return r; | 967 | return r; |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 6c1fc339d228..c5799f16aa4b 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -221,9 +221,9 @@ void rs400_gart_set_page(struct radeon_device *rdev, unsigned i, | |||
221 | entry = (lower_32_bits(addr) & PAGE_MASK) | | 221 | entry = (lower_32_bits(addr) & PAGE_MASK) | |
222 | ((upper_32_bits(addr) & 0xff) << 4); | 222 | ((upper_32_bits(addr) & 0xff) << 4); |
223 | if (flags & RADEON_GART_PAGE_READ) | 223 | if (flags & RADEON_GART_PAGE_READ) |
224 | addr |= RS400_PTE_READABLE; | 224 | entry |= RS400_PTE_READABLE; |
225 | if (flags & RADEON_GART_PAGE_WRITE) | 225 | if (flags & RADEON_GART_PAGE_WRITE) |
226 | addr |= RS400_PTE_WRITEABLE; | 226 | entry |= RS400_PTE_WRITEABLE; |
227 | if (!(flags & RADEON_GART_PAGE_SNOOP)) | 227 | if (!(flags & RADEON_GART_PAGE_SNOOP)) |
228 | entry |= RS400_PTE_UNSNOOPED; | 228 | entry |= RS400_PTE_UNSNOOPED; |
229 | entry = cpu_to_le32(entry); | 229 | entry = cpu_to_le32(entry); |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 3e21e869015f..8a477bf1fdb3 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -124,7 +124,7 @@ void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) | |||
124 | radeon_ring_write(ring, GEOMETRY_ROUND_NEAREST | COLOR_ROUND_NEAREST); | 124 | radeon_ring_write(ring, GEOMETRY_ROUND_NEAREST | COLOR_ROUND_NEAREST); |
125 | radeon_ring_write(ring, PACKET0(0x20C8, 0)); | 125 | radeon_ring_write(ring, PACKET0(0x20C8, 0)); |
126 | radeon_ring_write(ring, 0); | 126 | radeon_ring_write(ring, 0); |
127 | radeon_ring_unlock_commit(rdev, ring); | 127 | radeon_ring_unlock_commit(rdev, ring, false); |
128 | } | 128 | } |
129 | 129 | ||
130 | int rv515_mc_wait_for_idle(struct radeon_device *rdev) | 130 | int rv515_mc_wait_for_idle(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 2983f17ea1b3..d9f5ce715c9b 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1177,7 +1177,6 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
1177 | u32 hdp_host_path_cntl; | 1177 | u32 hdp_host_path_cntl; |
1178 | u32 sq_dyn_gpr_size_simd_ab_0; | 1178 | u32 sq_dyn_gpr_size_simd_ab_0; |
1179 | u32 gb_tiling_config = 0; | 1179 | u32 gb_tiling_config = 0; |
1180 | u32 cc_rb_backend_disable = 0; | ||
1181 | u32 cc_gc_shader_pipe_config = 0; | 1180 | u32 cc_gc_shader_pipe_config = 0; |
1182 | u32 mc_arb_ramcfg; | 1181 | u32 mc_arb_ramcfg; |
1183 | u32 db_debug4, tmp; | 1182 | u32 db_debug4, tmp; |
@@ -1311,21 +1310,7 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
1311 | WREG32(SPI_CONFIG_CNTL, 0); | 1310 | WREG32(SPI_CONFIG_CNTL, 0); |
1312 | } | 1311 | } |
1313 | 1312 | ||
1314 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; | ||
1315 | tmp = R7XX_MAX_BACKENDS - r600_count_pipe_bits(cc_rb_backend_disable >> 16); | ||
1316 | if (tmp < rdev->config.rv770.max_backends) { | ||
1317 | rdev->config.rv770.max_backends = tmp; | ||
1318 | } | ||
1319 | |||
1320 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0xffffff00; | 1313 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0xffffff00; |
1321 | tmp = R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config >> 8) & R7XX_MAX_PIPES_MASK); | ||
1322 | if (tmp < rdev->config.rv770.max_pipes) { | ||
1323 | rdev->config.rv770.max_pipes = tmp; | ||
1324 | } | ||
1325 | tmp = R7XX_MAX_SIMDS - r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R7XX_MAX_SIMDS_MASK); | ||
1326 | if (tmp < rdev->config.rv770.max_simds) { | ||
1327 | rdev->config.rv770.max_simds = tmp; | ||
1328 | } | ||
1329 | tmp = rdev->config.rv770.max_simds - | 1314 | tmp = rdev->config.rv770.max_simds - |
1330 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R7XX_MAX_SIMDS_MASK); | 1315 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R7XX_MAX_SIMDS_MASK); |
1331 | rdev->config.rv770.active_simds = tmp; | 1316 | rdev->config.rv770.active_simds = tmp; |
@@ -1348,6 +1333,14 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
1348 | rdev->config.rv770.tiling_npipes = rdev->config.rv770.max_tile_pipes; | 1333 | rdev->config.rv770.tiling_npipes = rdev->config.rv770.max_tile_pipes; |
1349 | 1334 | ||
1350 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R7XX_MAX_BACKENDS_MASK; | 1335 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R7XX_MAX_BACKENDS_MASK; |
1336 | tmp = 0; | ||
1337 | for (i = 0; i < rdev->config.rv770.max_backends; i++) | ||
1338 | tmp |= (1 << i); | ||
1339 | /* if all the backends are disabled, fix it up here */ | ||
1340 | if ((disabled_rb_mask & tmp) == tmp) { | ||
1341 | for (i = 0; i < rdev->config.rv770.max_backends; i++) | ||
1342 | disabled_rb_mask &= ~(1 << i); | ||
1343 | } | ||
1351 | tmp = (gb_tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; | 1344 | tmp = (gb_tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; |
1352 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.rv770.max_backends, | 1345 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.rv770.max_backends, |
1353 | R7XX_MAX_BACKENDS, disabled_rb_mask); | 1346 | R7XX_MAX_BACKENDS, disabled_rb_mask); |
diff --git a/drivers/gpu/drm/radeon/rv770_dma.c b/drivers/gpu/drm/radeon/rv770_dma.c index bbf2e076ee45..74426ac2bb5c 100644 --- a/drivers/gpu/drm/radeon/rv770_dma.c +++ b/drivers/gpu/drm/radeon/rv770_dma.c | |||
@@ -90,7 +90,7 @@ int rv770_copy_dma(struct radeon_device *rdev, | |||
90 | return r; | 90 | return r; |
91 | } | 91 | } |
92 | 92 | ||
93 | radeon_ring_unlock_commit(rdev, ring); | 93 | radeon_ring_unlock_commit(rdev, ring, false); |
94 | radeon_semaphore_free(rdev, &sem, *fence); | 94 | radeon_semaphore_free(rdev, &sem, *fence); |
95 | 95 | ||
96 | return r; | 96 | return r; |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 011779bd2b3d..3a0b973e8a96 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -3057,7 +3057,7 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
3057 | u32 sx_debug_1; | 3057 | u32 sx_debug_1; |
3058 | u32 hdp_host_path_cntl; | 3058 | u32 hdp_host_path_cntl; |
3059 | u32 tmp; | 3059 | u32 tmp; |
3060 | int i, j, k; | 3060 | int i, j; |
3061 | 3061 | ||
3062 | switch (rdev->family) { | 3062 | switch (rdev->family) { |
3063 | case CHIP_TAHITI: | 3063 | case CHIP_TAHITI: |
@@ -3255,12 +3255,11 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
3255 | rdev->config.si.max_sh_per_se, | 3255 | rdev->config.si.max_sh_per_se, |
3256 | rdev->config.si.max_cu_per_sh); | 3256 | rdev->config.si.max_cu_per_sh); |
3257 | 3257 | ||
3258 | rdev->config.si.active_cus = 0; | ||
3258 | for (i = 0; i < rdev->config.si.max_shader_engines; i++) { | 3259 | for (i = 0; i < rdev->config.si.max_shader_engines; i++) { |
3259 | for (j = 0; j < rdev->config.si.max_sh_per_se; j++) { | 3260 | for (j = 0; j < rdev->config.si.max_sh_per_se; j++) { |
3260 | for (k = 0; k < rdev->config.si.max_cu_per_sh; k++) { | 3261 | rdev->config.si.active_cus += |
3261 | rdev->config.si.active_cus += | 3262 | hweight32(si_get_cu_active_bitmap(rdev, i, j)); |
3262 | hweight32(si_get_cu_active_bitmap(rdev, i, j)); | ||
3263 | } | ||
3264 | } | 3263 | } |
3265 | } | 3264 | } |
3266 | 3265 | ||
@@ -3541,7 +3540,7 @@ static int si_cp_start(struct radeon_device *rdev) | |||
3541 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); | 3540 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); |
3542 | radeon_ring_write(ring, 0xc000); | 3541 | radeon_ring_write(ring, 0xc000); |
3543 | radeon_ring_write(ring, 0xe000); | 3542 | radeon_ring_write(ring, 0xe000); |
3544 | radeon_ring_unlock_commit(rdev, ring); | 3543 | radeon_ring_unlock_commit(rdev, ring, false); |
3545 | 3544 | ||
3546 | si_cp_enable(rdev, true); | 3545 | si_cp_enable(rdev, true); |
3547 | 3546 | ||
@@ -3570,7 +3569,7 @@ static int si_cp_start(struct radeon_device *rdev) | |||
3570 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | 3569 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
3571 | radeon_ring_write(ring, 0x00000010); /* VGT_OUT_DEALLOC_CNTL */ | 3570 | radeon_ring_write(ring, 0x00000010); /* VGT_OUT_DEALLOC_CNTL */ |
3572 | 3571 | ||
3573 | radeon_ring_unlock_commit(rdev, ring); | 3572 | radeon_ring_unlock_commit(rdev, ring, false); |
3574 | 3573 | ||
3575 | for (i = RADEON_RING_TYPE_GFX_INDEX; i <= CAYMAN_RING_TYPE_CP2_INDEX; ++i) { | 3574 | for (i = RADEON_RING_TYPE_GFX_INDEX; i <= CAYMAN_RING_TYPE_CP2_INDEX; ++i) { |
3576 | ring = &rdev->ring[i]; | 3575 | ring = &rdev->ring[i]; |
@@ -3580,7 +3579,7 @@ static int si_cp_start(struct radeon_device *rdev) | |||
3580 | radeon_ring_write(ring, PACKET3_COMPUTE(PACKET3_CLEAR_STATE, 0)); | 3579 | radeon_ring_write(ring, PACKET3_COMPUTE(PACKET3_CLEAR_STATE, 0)); |
3581 | radeon_ring_write(ring, 0); | 3580 | radeon_ring_write(ring, 0); |
3582 | 3581 | ||
3583 | radeon_ring_unlock_commit(rdev, ring); | 3582 | radeon_ring_unlock_commit(rdev, ring, false); |
3584 | } | 3583 | } |
3585 | 3584 | ||
3586 | return 0; | 3585 | return 0; |
@@ -4291,10 +4290,10 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) | |||
4291 | for (i = 1; i < 16; i++) { | 4290 | for (i = 1; i < 16; i++) { |
4292 | if (i < 8) | 4291 | if (i < 8) |
4293 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 4292 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
4294 | rdev->gart.table_addr >> 12); | 4293 | rdev->vm_manager.saved_table_addr[i]); |
4295 | else | 4294 | else |
4296 | WREG32(VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2), | 4295 | WREG32(VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2), |
4297 | rdev->gart.table_addr >> 12); | 4296 | rdev->vm_manager.saved_table_addr[i]); |
4298 | } | 4297 | } |
4299 | 4298 | ||
4300 | /* enable context1-15 */ | 4299 | /* enable context1-15 */ |
@@ -4326,6 +4325,17 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) | |||
4326 | 4325 | ||
4327 | static void si_pcie_gart_disable(struct radeon_device *rdev) | 4326 | static void si_pcie_gart_disable(struct radeon_device *rdev) |
4328 | { | 4327 | { |
4328 | unsigned i; | ||
4329 | |||
4330 | for (i = 1; i < 16; ++i) { | ||
4331 | uint32_t reg; | ||
4332 | if (i < 8) | ||
4333 | reg = VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2); | ||
4334 | else | ||
4335 | reg = VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2); | ||
4336 | rdev->vm_manager.saved_table_addr[i] = RREG32(reg); | ||
4337 | } | ||
4338 | |||
4329 | /* Disable all tables */ | 4339 | /* Disable all tables */ |
4330 | WREG32(VM_CONTEXT0_CNTL, 0); | 4340 | WREG32(VM_CONTEXT0_CNTL, 0); |
4331 | WREG32(VM_CONTEXT1_CNTL, 0); | 4341 | WREG32(VM_CONTEXT1_CNTL, 0); |
@@ -5028,7 +5038,7 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
5028 | 5038 | ||
5029 | /* flush hdp cache */ | 5039 | /* flush hdp cache */ |
5030 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 5040 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5031 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 5041 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) | |
5032 | WRITE_DATA_DST_SEL(0))); | 5042 | WRITE_DATA_DST_SEL(0))); |
5033 | radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); | 5043 | radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); |
5034 | radeon_ring_write(ring, 0); | 5044 | radeon_ring_write(ring, 0); |
@@ -5036,7 +5046,7 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
5036 | 5046 | ||
5037 | /* bits 0-15 are the VM contexts0-15 */ | 5047 | /* bits 0-15 are the VM contexts0-15 */ |
5038 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 5048 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5039 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 5049 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) | |
5040 | WRITE_DATA_DST_SEL(0))); | 5050 | WRITE_DATA_DST_SEL(0))); |
5041 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | 5051 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
5042 | radeon_ring_write(ring, 0); | 5052 | radeon_ring_write(ring, 0); |
@@ -6306,17 +6316,17 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev) | |||
6306 | wptr = RREG32(IH_RB_WPTR); | 6316 | wptr = RREG32(IH_RB_WPTR); |
6307 | 6317 | ||
6308 | if (wptr & RB_OVERFLOW) { | 6318 | if (wptr & RB_OVERFLOW) { |
6319 | wptr &= ~RB_OVERFLOW; | ||
6309 | /* When a ring buffer overflow happen start parsing interrupt | 6320 | /* When a ring buffer overflow happen start parsing interrupt |
6310 | * from the last not overwritten vector (wptr + 16). Hopefully | 6321 | * from the last not overwritten vector (wptr + 16). Hopefully |
6311 | * this should allow us to catchup. | 6322 | * this should allow us to catchup. |
6312 | */ | 6323 | */ |
6313 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 6324 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
6314 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 6325 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
6315 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 6326 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
6316 | tmp = RREG32(IH_RB_CNTL); | 6327 | tmp = RREG32(IH_RB_CNTL); |
6317 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 6328 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
6318 | WREG32(IH_RB_CNTL, tmp); | 6329 | WREG32(IH_RB_CNTL, tmp); |
6319 | wptr &= ~RB_OVERFLOW; | ||
6320 | } | 6330 | } |
6321 | return (wptr & rdev->ih.ptr_mask); | 6331 | return (wptr & rdev->ih.ptr_mask); |
6322 | } | 6332 | } |
@@ -6654,13 +6664,13 @@ restart_ih: | |||
6654 | /* wptr/rptr are in bytes! */ | 6664 | /* wptr/rptr are in bytes! */ |
6655 | rptr += 16; | 6665 | rptr += 16; |
6656 | rptr &= rdev->ih.ptr_mask; | 6666 | rptr &= rdev->ih.ptr_mask; |
6667 | WREG32(IH_RB_RPTR, rptr); | ||
6657 | } | 6668 | } |
6658 | if (queue_hotplug) | 6669 | if (queue_hotplug) |
6659 | schedule_work(&rdev->hotplug_work); | 6670 | schedule_work(&rdev->hotplug_work); |
6660 | if (queue_thermal && rdev->pm.dpm_enabled) | 6671 | if (queue_thermal && rdev->pm.dpm_enabled) |
6661 | schedule_work(&rdev->pm.dpm.thermal.work); | 6672 | schedule_work(&rdev->pm.dpm.thermal.work); |
6662 | rdev->ih.rptr = rptr; | 6673 | rdev->ih.rptr = rptr; |
6663 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
6664 | atomic_set(&rdev->ih.lock, 0); | 6674 | atomic_set(&rdev->ih.lock, 0); |
6665 | 6675 | ||
6666 | /* make sure wptr hasn't changed while processing */ | 6676 | /* make sure wptr hasn't changed while processing */ |
@@ -7178,6 +7188,9 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev) | |||
7178 | int ret, i; | 7188 | int ret, i; |
7179 | u16 tmp16; | 7189 | u16 tmp16; |
7180 | 7190 | ||
7191 | if (pci_is_root_bus(rdev->pdev->bus)) | ||
7192 | return; | ||
7193 | |||
7181 | if (radeon_pcie_gen2 == 0) | 7194 | if (radeon_pcie_gen2 == 0) |
7182 | return; | 7195 | return; |
7183 | 7196 | ||
@@ -7455,7 +7468,8 @@ static void si_program_aspm(struct radeon_device *rdev) | |||
7455 | if (orig != data) | 7468 | if (orig != data) |
7456 | WREG32_PIF_PHY1(PB1_PIF_CNTL, data); | 7469 | WREG32_PIF_PHY1(PB1_PIF_CNTL, data); |
7457 | 7470 | ||
7458 | if (!disable_clkreq) { | 7471 | if (!disable_clkreq && |
7472 | !pci_is_root_bus(rdev->pdev->bus)) { | ||
7459 | struct pci_dev *root = rdev->pdev->bus->self; | 7473 | struct pci_dev *root = rdev->pdev->bus->self; |
7460 | u32 lnkcap; | 7474 | u32 lnkcap; |
7461 | 7475 | ||
diff --git a/drivers/gpu/drm/radeon/si_dma.c b/drivers/gpu/drm/radeon/si_dma.c index 716505129450..7c22baaf94db 100644 --- a/drivers/gpu/drm/radeon/si_dma.c +++ b/drivers/gpu/drm/radeon/si_dma.c | |||
@@ -275,7 +275,7 @@ int si_copy_dma(struct radeon_device *rdev, | |||
275 | return r; | 275 | return r; |
276 | } | 276 | } |
277 | 277 | ||
278 | radeon_ring_unlock_commit(rdev, ring); | 278 | radeon_ring_unlock_commit(rdev, ring, false); |
279 | radeon_semaphore_free(rdev, &sem, *fence); | 279 | radeon_semaphore_free(rdev, &sem, *fence); |
280 | 280 | ||
281 | return r; | 281 | return r; |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index 32e50be9c4ac..57f780053b3e 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
@@ -1874,16 +1874,22 @@ int trinity_dpm_init(struct radeon_device *rdev) | |||
1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
1875 | pi->at[i] = TRINITY_AT_DFLT; | 1875 | pi->at[i] = TRINITY_AT_DFLT; |
1876 | 1876 | ||
1877 | /* There are stability issues reported on with | 1877 | if (radeon_bapm == -1) { |
1878 | * bapm enabled when switching between AC and battery | 1878 | /* There are stability issues reported on with |
1879 | * power. At the same time, some MSI boards hang | 1879 | * bapm enabled when switching between AC and battery |
1880 | * if it's not enabled and dpm is enabled. Just enable | 1880 | * power. At the same time, some MSI boards hang |
1881 | * it for MSI boards right now. | 1881 | * if it's not enabled and dpm is enabled. Just enable |
1882 | */ | 1882 | * it for MSI boards right now. |
1883 | if (rdev->pdev->subsystem_vendor == 0x1462) | 1883 | */ |
1884 | pi->enable_bapm = true; | 1884 | if (rdev->pdev->subsystem_vendor == 0x1462) |
1885 | else | 1885 | pi->enable_bapm = true; |
1886 | else | ||
1887 | pi->enable_bapm = false; | ||
1888 | } else if (radeon_bapm == 0) { | ||
1886 | pi->enable_bapm = false; | 1889 | pi->enable_bapm = false; |
1890 | } else { | ||
1891 | pi->enable_bapm = true; | ||
1892 | } | ||
1887 | pi->enable_nbps_policy = true; | 1893 | pi->enable_nbps_policy = true; |
1888 | pi->enable_sclk_ds = true; | 1894 | pi->enable_sclk_ds = true; |
1889 | pi->enable_gfx_power_gating = true; | 1895 | pi->enable_gfx_power_gating = true; |
diff --git a/drivers/gpu/drm/radeon/uvd_v1_0.c b/drivers/gpu/drm/radeon/uvd_v1_0.c index be42c8125203..cda391347286 100644 --- a/drivers/gpu/drm/radeon/uvd_v1_0.c +++ b/drivers/gpu/drm/radeon/uvd_v1_0.c | |||
@@ -124,7 +124,7 @@ int uvd_v1_0_init(struct radeon_device *rdev) | |||
124 | radeon_ring_write(ring, PACKET0(UVD_SEMA_CNTL, 0)); | 124 | radeon_ring_write(ring, PACKET0(UVD_SEMA_CNTL, 0)); |
125 | radeon_ring_write(ring, 3); | 125 | radeon_ring_write(ring, 3); |
126 | 126 | ||
127 | radeon_ring_unlock_commit(rdev, ring); | 127 | radeon_ring_unlock_commit(rdev, ring, false); |
128 | 128 | ||
129 | done: | 129 | done: |
130 | /* lower clocks again */ | 130 | /* lower clocks again */ |
@@ -331,7 +331,7 @@ int uvd_v1_0_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
331 | } | 331 | } |
332 | radeon_ring_write(ring, PACKET0(UVD_CONTEXT_ID, 0)); | 332 | radeon_ring_write(ring, PACKET0(UVD_CONTEXT_ID, 0)); |
333 | radeon_ring_write(ring, 0xDEADBEEF); | 333 | radeon_ring_write(ring, 0xDEADBEEF); |
334 | radeon_ring_unlock_commit(rdev, ring); | 334 | radeon_ring_unlock_commit(rdev, ring, false); |
335 | for (i = 0; i < rdev->usec_timeout; i++) { | 335 | for (i = 0; i < rdev->usec_timeout; i++) { |
336 | tmp = RREG32(UVD_CONTEXT_ID); | 336 | tmp = RREG32(UVD_CONTEXT_ID); |
337 | if (tmp == 0xDEADBEEF) | 337 | if (tmp == 0xDEADBEEF) |
diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig index 2d9d4252d598..ae8850f3e63b 100644 --- a/drivers/gpu/drm/sti/Kconfig +++ b/drivers/gpu/drm/sti/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config DRM_STI | 1 | config DRM_STI |
2 | tristate "DRM Support for STMicroelectronics SoC stiH41x Series" | 2 | tristate "DRM Support for STMicroelectronics SoC stiH41x Series" |
3 | depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM) | 3 | depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM) |
4 | select RESET_CONTROLLER | ||
4 | select DRM_KMS_HELPER | 5 | select DRM_KMS_HELPER |
5 | select DRM_GEM_CMA_HELPER | 6 | select DRM_GEM_CMA_HELPER |
6 | select DRM_KMS_CMA_HELPER | 7 | select DRM_KMS_CMA_HELPER |
diff --git a/drivers/gpu/drm/sti/sti_drm_drv.c b/drivers/gpu/drm/sti/sti_drm_drv.c index a7cc24917a96..223d93c3a05d 100644 --- a/drivers/gpu/drm/sti/sti_drm_drv.c +++ b/drivers/gpu/drm/sti/sti_drm_drv.c | |||
@@ -201,8 +201,8 @@ static int sti_drm_platform_probe(struct platform_device *pdev) | |||
201 | master = platform_device_register_resndata(dev, | 201 | master = platform_device_register_resndata(dev, |
202 | DRIVER_NAME "__master", -1, | 202 | DRIVER_NAME "__master", -1, |
203 | NULL, 0, NULL, 0); | 203 | NULL, 0, NULL, 0); |
204 | if (!master) | 204 | if (IS_ERR(master)) |
205 | return -EINVAL; | 205 | return PTR_ERR(master); |
206 | 206 | ||
207 | platform_set_drvdata(pdev, master); | 207 | platform_set_drvdata(pdev, master); |
208 | return 0; | 208 | return 0; |
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index 72d957f81c05..2ae9a9b73666 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c | |||
@@ -730,16 +730,16 @@ static int sti_hda_probe(struct platform_device *pdev) | |||
730 | return -ENOMEM; | 730 | return -ENOMEM; |
731 | } | 731 | } |
732 | hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); | 732 | hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
733 | if (IS_ERR(hda->regs)) | 733 | if (!hda->regs) |
734 | return PTR_ERR(hda->regs); | 734 | return -ENOMEM; |
735 | 735 | ||
736 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 736 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
737 | "video-dacs-ctrl"); | 737 | "video-dacs-ctrl"); |
738 | if (res) { | 738 | if (res) { |
739 | hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start, | 739 | hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start, |
740 | resource_size(res)); | 740 | resource_size(res)); |
741 | if (IS_ERR(hda->video_dacs_ctrl)) | 741 | if (!hda->video_dacs_ctrl) |
742 | return PTR_ERR(hda->video_dacs_ctrl); | 742 | return -ENOMEM; |
743 | } else { | 743 | } else { |
744 | /* If no existing video-dacs-ctrl resource continue the probe */ | 744 | /* If no existing video-dacs-ctrl resource continue the probe */ |
745 | DRM_DEBUG_DRIVER("No video-dacs-ctrl resource\n"); | 745 | DRM_DEBUG_DRIVER("No video-dacs-ctrl resource\n"); |
@@ -770,7 +770,7 @@ static int sti_hda_remove(struct platform_device *pdev) | |||
770 | return 0; | 770 | return 0; |
771 | } | 771 | } |
772 | 772 | ||
773 | static struct of_device_id hda_of_match[] = { | 773 | static const struct of_device_id hda_of_match[] = { |
774 | { .compatible = "st,stih416-hda", }, | 774 | { .compatible = "st,stih416-hda", }, |
775 | { .compatible = "st,stih407-hda", }, | 775 | { .compatible = "st,stih407-hda", }, |
776 | { /* end node */ } | 776 | { /* end node */ } |
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 284e541d970d..b22968c08d1f 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c | |||
@@ -298,7 +298,6 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi) | |||
298 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); | 298 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); |
299 | 299 | ||
300 | val = frame[0xC]; | 300 | val = frame[0xC]; |
301 | val |= frame[0xD] << 8; | ||
302 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); | 301 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); |
303 | 302 | ||
304 | /* Enable transmission slot for AVI infoframe | 303 | /* Enable transmission slot for AVI infoframe |
@@ -677,7 +676,7 @@ static const struct component_ops sti_hdmi_ops = { | |||
677 | .unbind = sti_hdmi_unbind, | 676 | .unbind = sti_hdmi_unbind, |
678 | }; | 677 | }; |
679 | 678 | ||
680 | static struct of_device_id hdmi_of_match[] = { | 679 | static const struct of_device_id hdmi_of_match[] = { |
681 | { | 680 | { |
682 | .compatible = "st,stih416-hdmi", | 681 | .compatible = "st,stih416-hdmi", |
683 | .data = &tx3g0c55phy_ops, | 682 | .data = &tx3g0c55phy_ops, |
@@ -713,8 +712,8 @@ static int sti_hdmi_probe(struct platform_device *pdev) | |||
713 | return -ENOMEM; | 712 | return -ENOMEM; |
714 | } | 713 | } |
715 | hdmi->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); | 714 | hdmi->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
716 | if (IS_ERR(hdmi->regs)) | 715 | if (!hdmi->regs) |
717 | return PTR_ERR(hdmi->regs); | 716 | return -ENOMEM; |
718 | 717 | ||
719 | if (of_device_is_compatible(np, "st,stih416-hdmi")) { | 718 | if (of_device_is_compatible(np, "st,stih416-hdmi")) { |
720 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 719 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -725,8 +724,8 @@ static int sti_hdmi_probe(struct platform_device *pdev) | |||
725 | } | 724 | } |
726 | hdmi->syscfg = devm_ioremap_nocache(dev, res->start, | 725 | hdmi->syscfg = devm_ioremap_nocache(dev, res->start, |
727 | resource_size(res)); | 726 | resource_size(res)); |
728 | if (IS_ERR(hdmi->syscfg)) | 727 | if (!hdmi->syscfg) |
729 | return PTR_ERR(hdmi->syscfg); | 728 | return -ENOMEM; |
730 | 729 | ||
731 | } | 730 | } |
732 | 731 | ||
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c index b69e26fee76e..b8afe490356a 100644 --- a/drivers/gpu/drm/sti/sti_tvout.c +++ b/drivers/gpu/drm/sti/sti_tvout.c | |||
@@ -591,8 +591,8 @@ static int sti_tvout_probe(struct platform_device *pdev) | |||
591 | return -ENOMEM; | 591 | return -ENOMEM; |
592 | } | 592 | } |
593 | tvout->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); | 593 | tvout->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
594 | if (IS_ERR(tvout->regs)) | 594 | if (!tvout->regs) |
595 | return PTR_ERR(tvout->regs); | 595 | return -ENOMEM; |
596 | 596 | ||
597 | /* get reset resources */ | 597 | /* get reset resources */ |
598 | tvout->reset = devm_reset_control_get(dev, "tvout"); | 598 | tvout->reset = devm_reset_control_get(dev, "tvout"); |
@@ -624,7 +624,7 @@ static int sti_tvout_remove(struct platform_device *pdev) | |||
624 | return 0; | 624 | return 0; |
625 | } | 625 | } |
626 | 626 | ||
627 | static struct of_device_id tvout_of_match[] = { | 627 | static const struct of_device_id tvout_of_match[] = { |
628 | { .compatible = "st,stih416-tvout", }, | 628 | { .compatible = "st,stih416-tvout", }, |
629 | { .compatible = "st,stih407-tvout", }, | 629 | { .compatible = "st,stih407-tvout", }, |
630 | { /* end node */ } | 630 | { /* end node */ } |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 7bfdaa163a33..36b871686d3c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
@@ -450,11 +450,11 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, | |||
450 | res, | 450 | res, |
451 | id_loc - sw_context->buf_start); | 451 | id_loc - sw_context->buf_start); |
452 | if (unlikely(ret != 0)) | 452 | if (unlikely(ret != 0)) |
453 | goto out_err; | 453 | return ret; |
454 | 454 | ||
455 | ret = vmw_resource_val_add(sw_context, res, &node); | 455 | ret = vmw_resource_val_add(sw_context, res, &node); |
456 | if (unlikely(ret != 0)) | 456 | if (unlikely(ret != 0)) |
457 | goto out_err; | 457 | return ret; |
458 | 458 | ||
459 | if (res_type == vmw_res_context && dev_priv->has_mob && | 459 | if (res_type == vmw_res_context && dev_priv->has_mob && |
460 | node->first_usage) { | 460 | node->first_usage) { |
@@ -468,13 +468,13 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, | |||
468 | 468 | ||
469 | ret = vmw_resource_context_res_add(dev_priv, sw_context, res); | 469 | ret = vmw_resource_context_res_add(dev_priv, sw_context, res); |
470 | if (unlikely(ret != 0)) | 470 | if (unlikely(ret != 0)) |
471 | goto out_err; | 471 | return ret; |
472 | node->staged_bindings = | 472 | node->staged_bindings = |
473 | kzalloc(sizeof(*node->staged_bindings), GFP_KERNEL); | 473 | kzalloc(sizeof(*node->staged_bindings), GFP_KERNEL); |
474 | if (node->staged_bindings == NULL) { | 474 | if (node->staged_bindings == NULL) { |
475 | DRM_ERROR("Failed to allocate context binding " | 475 | DRM_ERROR("Failed to allocate context binding " |
476 | "information.\n"); | 476 | "information.\n"); |
477 | goto out_err; | 477 | return -ENOMEM; |
478 | } | 478 | } |
479 | INIT_LIST_HEAD(&node->staged_bindings->list); | 479 | INIT_LIST_HEAD(&node->staged_bindings->list); |
480 | } | 480 | } |
@@ -482,8 +482,7 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, | |||
482 | if (p_val) | 482 | if (p_val) |
483 | *p_val = node; | 483 | *p_val = node; |
484 | 484 | ||
485 | out_err: | 485 | return 0; |
486 | return ret; | ||
487 | } | 486 | } |
488 | 487 | ||
489 | 488 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index 6ccd993e26bf..6eae14d2a3f7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | |||
@@ -180,8 +180,9 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) | |||
180 | 180 | ||
181 | mutex_lock(&dev_priv->hw_mutex); | 181 | mutex_lock(&dev_priv->hw_mutex); |
182 | 182 | ||
183 | vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); | ||
183 | while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0) | 184 | while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0) |
184 | vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); | 185 | ; |
185 | 186 | ||
186 | dev_priv->last_read_seqno = ioread32(fifo_mem + SVGA_FIFO_FENCE); | 187 | dev_priv->last_read_seqno = ioread32(fifo_mem + SVGA_FIFO_FENCE); |
187 | 188 | ||
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 6866448083b2..37ac7b5dbd06 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c | |||
@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain * | |||
660 | } | 660 | } |
661 | EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); | 661 | EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); |
662 | 662 | ||
663 | void vga_switcheroo_fini_domain_pm_ops(struct device *dev) | ||
664 | { | ||
665 | dev->pm_domain = NULL; | ||
666 | } | ||
667 | EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops); | ||
668 | |||
663 | static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) | 669 | static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) |
664 | { | 670 | { |
665 | struct pci_dev *pdev = to_pci_dev(dev); | 671 | struct pci_dev *pdev = to_pci_dev(dev); |
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index d2077f040f3e..77711623b973 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/poll.h> | 41 | #include <linux/poll.h> |
42 | #include <linux/miscdevice.h> | 42 | #include <linux/miscdevice.h> |
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/screen_info.h> | ||
44 | 45 | ||
45 | #include <linux/uaccess.h> | 46 | #include <linux/uaccess.h> |
46 | 47 | ||
@@ -112,10 +113,8 @@ both: | |||
112 | return 1; | 113 | return 1; |
113 | } | 114 | } |
114 | 115 | ||
115 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
116 | /* this is only used a cookie - it should not be dereferenced */ | 116 | /* this is only used a cookie - it should not be dereferenced */ |
117 | static struct pci_dev *vga_default; | 117 | static struct pci_dev *vga_default; |
118 | #endif | ||
119 | 118 | ||
120 | static void vga_arb_device_card_gone(struct pci_dev *pdev); | 119 | static void vga_arb_device_card_gone(struct pci_dev *pdev); |
121 | 120 | ||
@@ -131,7 +130,6 @@ static struct vga_device *vgadev_find(struct pci_dev *pdev) | |||
131 | } | 130 | } |
132 | 131 | ||
133 | /* Returns the default VGA device (vgacon's babe) */ | 132 | /* Returns the default VGA device (vgacon's babe) */ |
134 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
135 | struct pci_dev *vga_default_device(void) | 133 | struct pci_dev *vga_default_device(void) |
136 | { | 134 | { |
137 | return vga_default; | 135 | return vga_default; |
@@ -147,7 +145,6 @@ void vga_set_default_device(struct pci_dev *pdev) | |||
147 | pci_dev_put(vga_default); | 145 | pci_dev_put(vga_default); |
148 | vga_default = pci_dev_get(pdev); | 146 | vga_default = pci_dev_get(pdev); |
149 | } | 147 | } |
150 | #endif | ||
151 | 148 | ||
152 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) | 149 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) |
153 | { | 150 | { |
@@ -583,11 +580,12 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) | |||
583 | /* Deal with VGA default device. Use first enabled one | 580 | /* Deal with VGA default device. Use first enabled one |
584 | * by default if arch doesn't have it's own hook | 581 | * by default if arch doesn't have it's own hook |
585 | */ | 582 | */ |
586 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
587 | if (vga_default == NULL && | 583 | if (vga_default == NULL && |
588 | ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) | 584 | ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) { |
585 | pr_info("vgaarb: setting as boot device: PCI:%s\n", | ||
586 | pci_name(pdev)); | ||
589 | vga_set_default_device(pdev); | 587 | vga_set_default_device(pdev); |
590 | #endif | 588 | } |
591 | 589 | ||
592 | vga_arbiter_check_bridge_sharing(vgadev); | 590 | vga_arbiter_check_bridge_sharing(vgadev); |
593 | 591 | ||
@@ -621,10 +619,8 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev) | |||
621 | goto bail; | 619 | goto bail; |
622 | } | 620 | } |
623 | 621 | ||
624 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
625 | if (vga_default == pdev) | 622 | if (vga_default == pdev) |
626 | vga_set_default_device(NULL); | 623 | vga_set_default_device(NULL); |
627 | #endif | ||
628 | 624 | ||
629 | if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) | 625 | if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) |
630 | vga_decode_count--; | 626 | vga_decode_count--; |
@@ -1320,6 +1316,38 @@ static int __init vga_arb_device_init(void) | |||
1320 | pr_info("vgaarb: loaded\n"); | 1316 | pr_info("vgaarb: loaded\n"); |
1321 | 1317 | ||
1322 | list_for_each_entry(vgadev, &vga_list, list) { | 1318 | list_for_each_entry(vgadev, &vga_list, list) { |
1319 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
1320 | /* Override I/O based detection done by vga_arbiter_add_pci_device() | ||
1321 | * as it may take the wrong device (e.g. on Apple system under EFI). | ||
1322 | * | ||
1323 | * Select the device owning the boot framebuffer if there is one. | ||
1324 | */ | ||
1325 | resource_size_t start, end; | ||
1326 | int i; | ||
1327 | |||
1328 | /* Does firmware framebuffer belong to us? */ | ||
1329 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
1330 | if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM)) | ||
1331 | continue; | ||
1332 | |||
1333 | start = pci_resource_start(vgadev->pdev, i); | ||
1334 | end = pci_resource_end(vgadev->pdev, i); | ||
1335 | |||
1336 | if (!start || !end) | ||
1337 | continue; | ||
1338 | |||
1339 | if (screen_info.lfb_base < start || | ||
1340 | (screen_info.lfb_base + screen_info.lfb_size) >= end) | ||
1341 | continue; | ||
1342 | if (!vga_default_device()) | ||
1343 | pr_info("vgaarb: setting as boot device: PCI:%s\n", | ||
1344 | pci_name(vgadev->pdev)); | ||
1345 | else if (vgadev->pdev != vga_default_device()) | ||
1346 | pr_info("vgaarb: overriding boot device: PCI:%s\n", | ||
1347 | pci_name(vgadev->pdev)); | ||
1348 | vga_set_default_device(vgadev->pdev); | ||
1349 | } | ||
1350 | #endif | ||
1323 | if (vgadev->bridge_has_one_vga) | 1351 | if (vgadev->bridge_has_one_vga) |
1324 | pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); | 1352 | pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); |
1325 | else | 1353 | else |
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c index 1bdcccc54a1d..f745d2c1325e 100644 --- a/drivers/hid/hid-cherry.c +++ b/drivers/hid/hid-cherry.c | |||
@@ -28,7 +28,7 @@ | |||
28 | static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 28 | static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
29 | unsigned int *rsize) | 29 | unsigned int *rsize) |
30 | { | 30 | { |
31 | if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { | 31 | if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { |
32 | hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n"); | 32 | hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n"); |
33 | rdesc[11] = rdesc[16] = 0xff; | 33 | rdesc[11] = rdesc[16] = 0xff; |
34 | rdesc[12] = rdesc[17] = 0x03; | 34 | rdesc[12] = rdesc[17] = 0x03; |
diff --git a/drivers/hid/hid-huion.c b/drivers/hid/hid-huion.c index 60f44cd1b0ed..61b68ca27790 100644 --- a/drivers/hid/hid-huion.c +++ b/drivers/hid/hid-huion.c | |||
@@ -84,6 +84,15 @@ static const __u8 huion_tablet_rdesc_template[] = { | |||
84 | 0xC0 /* End Collection */ | 84 | 0xC0 /* End Collection */ |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* Parameter indices */ | ||
88 | enum huion_prm { | ||
89 | HUION_PRM_X_LM = 1, | ||
90 | HUION_PRM_Y_LM = 2, | ||
91 | HUION_PRM_PRESSURE_LM = 4, | ||
92 | HUION_PRM_RESOLUTION = 5, | ||
93 | HUION_PRM_NUM | ||
94 | }; | ||
95 | |||
87 | /* Driver data */ | 96 | /* Driver data */ |
88 | struct huion_drvdata { | 97 | struct huion_drvdata { |
89 | __u8 *rdesc; | 98 | __u8 *rdesc; |
@@ -115,7 +124,12 @@ static int huion_tablet_enable(struct hid_device *hdev) | |||
115 | int rc; | 124 | int rc; |
116 | struct usb_device *usb_dev = hid_to_usb_dev(hdev); | 125 | struct usb_device *usb_dev = hid_to_usb_dev(hdev); |
117 | struct huion_drvdata *drvdata = hid_get_drvdata(hdev); | 126 | struct huion_drvdata *drvdata = hid_get_drvdata(hdev); |
118 | __le16 buf[6]; | 127 | __le16 *buf = NULL; |
128 | size_t len; | ||
129 | s32 params[HUION_PH_ID_NUM]; | ||
130 | s32 resolution; | ||
131 | __u8 *p; | ||
132 | s32 v; | ||
119 | 133 | ||
120 | /* | 134 | /* |
121 | * Read string descriptor containing tablet parameters. The specific | 135 | * Read string descriptor containing tablet parameters. The specific |
@@ -123,65 +137,79 @@ static int huion_tablet_enable(struct hid_device *hdev) | |||
123 | * driver traffic. | 137 | * driver traffic. |
124 | * NOTE: This enables fully-functional tablet mode. | 138 | * NOTE: This enables fully-functional tablet mode. |
125 | */ | 139 | */ |
140 | len = HUION_PRM_NUM * sizeof(*buf); | ||
141 | buf = kmalloc(len, GFP_KERNEL); | ||
142 | if (buf == NULL) { | ||
143 | hid_err(hdev, "failed to allocate parameter buffer\n"); | ||
144 | rc = -ENOMEM; | ||
145 | goto cleanup; | ||
146 | } | ||
126 | rc = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), | 147 | rc = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), |
127 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, | 148 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, |
128 | (USB_DT_STRING << 8) + 0x64, | 149 | (USB_DT_STRING << 8) + 0x64, |
129 | 0x0409, buf, sizeof(buf), | 150 | 0x0409, buf, len, |
130 | USB_CTRL_GET_TIMEOUT); | 151 | USB_CTRL_GET_TIMEOUT); |
131 | if (rc == -EPIPE) | 152 | if (rc == -EPIPE) { |
132 | hid_warn(hdev, "device parameters not found\n"); | 153 | hid_err(hdev, "device parameters not found\n"); |
133 | else if (rc < 0) | 154 | rc = -ENODEV; |
134 | hid_warn(hdev, "failed to get device parameters: %d\n", rc); | 155 | goto cleanup; |
135 | else if (rc != sizeof(buf)) | 156 | } else if (rc < 0) { |
136 | hid_warn(hdev, "invalid device parameters\n"); | 157 | hid_err(hdev, "failed to get device parameters: %d\n", rc); |
137 | else { | 158 | rc = -ENODEV; |
138 | s32 params[HUION_PH_ID_NUM]; | 159 | goto cleanup; |
139 | s32 resolution; | 160 | } else if (rc != len) { |
140 | __u8 *p; | 161 | hid_err(hdev, "invalid device parameters\n"); |
141 | s32 v; | 162 | rc = -ENODEV; |
163 | goto cleanup; | ||
164 | } | ||
142 | 165 | ||
143 | /* Extract device parameters */ | 166 | /* Extract device parameters */ |
144 | params[HUION_PH_ID_X_LM] = le16_to_cpu(buf[1]); | 167 | params[HUION_PH_ID_X_LM] = le16_to_cpu(buf[HUION_PRM_X_LM]); |
145 | params[HUION_PH_ID_Y_LM] = le16_to_cpu(buf[2]); | 168 | params[HUION_PH_ID_Y_LM] = le16_to_cpu(buf[HUION_PRM_Y_LM]); |
146 | params[HUION_PH_ID_PRESSURE_LM] = le16_to_cpu(buf[4]); | 169 | params[HUION_PH_ID_PRESSURE_LM] = |
147 | resolution = le16_to_cpu(buf[5]); | 170 | le16_to_cpu(buf[HUION_PRM_PRESSURE_LM]); |
148 | if (resolution == 0) { | 171 | resolution = le16_to_cpu(buf[HUION_PRM_RESOLUTION]); |
149 | params[HUION_PH_ID_X_PM] = 0; | 172 | if (resolution == 0) { |
150 | params[HUION_PH_ID_Y_PM] = 0; | 173 | params[HUION_PH_ID_X_PM] = 0; |
151 | } else { | 174 | params[HUION_PH_ID_Y_PM] = 0; |
152 | params[HUION_PH_ID_X_PM] = params[HUION_PH_ID_X_LM] * | 175 | } else { |
153 | 1000 / resolution; | 176 | params[HUION_PH_ID_X_PM] = params[HUION_PH_ID_X_LM] * |
154 | params[HUION_PH_ID_Y_PM] = params[HUION_PH_ID_Y_LM] * | 177 | 1000 / resolution; |
155 | 1000 / resolution; | 178 | params[HUION_PH_ID_Y_PM] = params[HUION_PH_ID_Y_LM] * |
156 | } | 179 | 1000 / resolution; |
180 | } | ||
157 | 181 | ||
158 | /* Allocate fixed report descriptor */ | 182 | /* Allocate fixed report descriptor */ |
159 | drvdata->rdesc = devm_kmalloc(&hdev->dev, | 183 | drvdata->rdesc = devm_kmalloc(&hdev->dev, |
160 | sizeof(huion_tablet_rdesc_template), | 184 | sizeof(huion_tablet_rdesc_template), |
161 | GFP_KERNEL); | 185 | GFP_KERNEL); |
162 | if (drvdata->rdesc == NULL) { | 186 | if (drvdata->rdesc == NULL) { |
163 | hid_err(hdev, "failed to allocate fixed rdesc\n"); | 187 | hid_err(hdev, "failed to allocate fixed rdesc\n"); |
164 | return -ENOMEM; | 188 | rc = -ENOMEM; |
165 | } | 189 | goto cleanup; |
166 | drvdata->rsize = sizeof(huion_tablet_rdesc_template); | 190 | } |
191 | drvdata->rsize = sizeof(huion_tablet_rdesc_template); | ||
167 | 192 | ||
168 | /* Format fixed report descriptor */ | 193 | /* Format fixed report descriptor */ |
169 | memcpy(drvdata->rdesc, huion_tablet_rdesc_template, | 194 | memcpy(drvdata->rdesc, huion_tablet_rdesc_template, |
170 | drvdata->rsize); | 195 | drvdata->rsize); |
171 | for (p = drvdata->rdesc; | 196 | for (p = drvdata->rdesc; |
172 | p <= drvdata->rdesc + drvdata->rsize - 4;) { | 197 | p <= drvdata->rdesc + drvdata->rsize - 4;) { |
173 | if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D && | 198 | if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D && |
174 | p[3] < sizeof(params)) { | 199 | p[3] < sizeof(params)) { |
175 | v = params[p[3]]; | 200 | v = params[p[3]]; |
176 | put_unaligned(cpu_to_le32(v), (s32 *)p); | 201 | put_unaligned(cpu_to_le32(v), (s32 *)p); |
177 | p += 4; | 202 | p += 4; |
178 | } else { | 203 | } else { |
179 | p++; | 204 | p++; |
180 | } | ||
181 | } | 205 | } |
182 | } | 206 | } |
183 | 207 | ||
184 | return 0; | 208 | rc = 0; |
209 | |||
210 | cleanup: | ||
211 | kfree(buf); | ||
212 | return rc; | ||
185 | } | 213 | } |
186 | 214 | ||
187 | static int huion_probe(struct hid_device *hdev, const struct hid_device_id *id) | 215 | static int huion_probe(struct hid_device *hdev, const struct hid_device_id *id) |
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c index e77696367591..b92bf01a1ae8 100644 --- a/drivers/hid/hid-kye.c +++ b/drivers/hid/hid-kye.c | |||
@@ -300,7 +300,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
300 | * - change the button usage range to 4-7 for the extra | 300 | * - change the button usage range to 4-7 for the extra |
301 | * buttons | 301 | * buttons |
302 | */ | 302 | */ |
303 | if (*rsize >= 74 && | 303 | if (*rsize >= 75 && |
304 | rdesc[61] == 0x05 && rdesc[62] == 0x08 && | 304 | rdesc[61] == 0x05 && rdesc[62] == 0x08 && |
305 | rdesc[63] == 0x19 && rdesc[64] == 0x08 && | 305 | rdesc[63] == 0x19 && rdesc[64] == 0x08 && |
306 | rdesc[65] == 0x29 && rdesc[66] == 0x0f && | 306 | rdesc[65] == 0x29 && rdesc[66] == 0x0f && |
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index a976f48263f6..f91ff145db9a 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c | |||
@@ -345,14 +345,14 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
345 | struct usb_device_descriptor *udesc; | 345 | struct usb_device_descriptor *udesc; |
346 | __u16 bcdDevice, rev_maj, rev_min; | 346 | __u16 bcdDevice, rev_maj, rev_min; |
347 | 347 | ||
348 | if ((drv_data->quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 && | 348 | if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 && |
349 | rdesc[84] == 0x8c && rdesc[85] == 0x02) { | 349 | rdesc[84] == 0x8c && rdesc[85] == 0x02) { |
350 | hid_info(hdev, | 350 | hid_info(hdev, |
351 | "fixing up Logitech keyboard report descriptor\n"); | 351 | "fixing up Logitech keyboard report descriptor\n"); |
352 | rdesc[84] = rdesc[89] = 0x4d; | 352 | rdesc[84] = rdesc[89] = 0x4d; |
353 | rdesc[85] = rdesc[90] = 0x10; | 353 | rdesc[85] = rdesc[90] = 0x10; |
354 | } | 354 | } |
355 | if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 50 && | 355 | if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 51 && |
356 | rdesc[32] == 0x81 && rdesc[33] == 0x06 && | 356 | rdesc[32] == 0x81 && rdesc[33] == 0x06 && |
357 | rdesc[49] == 0x81 && rdesc[50] == 0x06) { | 357 | rdesc[49] == 0x81 && rdesc[50] == 0x06) { |
358 | hid_info(hdev, | 358 | hid_info(hdev, |
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index cc2bd2022198..7835717bc020 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c | |||
@@ -451,13 +451,13 @@ static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *at | |||
451 | drv_data = hid_get_drvdata(hid); | 451 | drv_data = hid_get_drvdata(hid); |
452 | if (!drv_data) { | 452 | if (!drv_data) { |
453 | hid_err(hid, "Private driver data not found!\n"); | 453 | hid_err(hid, "Private driver data not found!\n"); |
454 | return 0; | 454 | return -EINVAL; |
455 | } | 455 | } |
456 | 456 | ||
457 | entry = drv_data->device_props; | 457 | entry = drv_data->device_props; |
458 | if (!entry) { | 458 | if (!entry) { |
459 | hid_err(hid, "Device properties not found!\n"); | 459 | hid_err(hid, "Device properties not found!\n"); |
460 | return 0; | 460 | return -EINVAL; |
461 | } | 461 | } |
462 | 462 | ||
463 | if (range == 0) | 463 | if (range == 0) |
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 486dbde2ba2d..9bf8637747a5 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -238,13 +238,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
238 | return; | 238 | return; |
239 | } | 239 | } |
240 | 240 | ||
241 | if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || | ||
242 | (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { | ||
243 | dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n", | ||
244 | __func__, dj_report->device_index); | ||
245 | return; | ||
246 | } | ||
247 | |||
248 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { | 241 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { |
249 | /* The device is already known. No need to reallocate it. */ | 242 | /* The device is already known. No need to reallocate it. */ |
250 | dbg_hid("%s: device is already known\n", __func__); | 243 | dbg_hid("%s: device is already known\n", __func__); |
@@ -557,7 +550,7 @@ static int logi_dj_ll_raw_request(struct hid_device *hid, | |||
557 | if (!out_buf) | 550 | if (!out_buf) |
558 | return -ENOMEM; | 551 | return -ENOMEM; |
559 | 552 | ||
560 | if (count < DJREPORT_SHORT_LENGTH - 2) | 553 | if (count > DJREPORT_SHORT_LENGTH - 2) |
561 | count = DJREPORT_SHORT_LENGTH - 2; | 554 | count = DJREPORT_SHORT_LENGTH - 2; |
562 | 555 | ||
563 | out_buf[0] = REPORT_ID_DJ_SHORT; | 556 | out_buf[0] = REPORT_ID_DJ_SHORT; |
@@ -663,7 +656,6 @@ static int logi_dj_raw_event(struct hid_device *hdev, | |||
663 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); | 656 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); |
664 | struct dj_report *dj_report = (struct dj_report *) data; | 657 | struct dj_report *dj_report = (struct dj_report *) data; |
665 | unsigned long flags; | 658 | unsigned long flags; |
666 | bool report_processed = false; | ||
667 | 659 | ||
668 | dbg_hid("%s, size:%d\n", __func__, size); | 660 | dbg_hid("%s, size:%d\n", __func__, size); |
669 | 661 | ||
@@ -691,27 +683,41 @@ static int logi_dj_raw_event(struct hid_device *hdev, | |||
691 | * anything else with it. | 683 | * anything else with it. |
692 | */ | 684 | */ |
693 | 685 | ||
686 | /* case 1) */ | ||
687 | if (data[0] != REPORT_ID_DJ_SHORT) | ||
688 | return false; | ||
689 | |||
690 | if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || | ||
691 | (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { | ||
692 | /* | ||
693 | * Device index is wrong, bail out. | ||
694 | * This driver can ignore safely the receiver notifications, | ||
695 | * so ignore those reports too. | ||
696 | */ | ||
697 | if (dj_report->device_index != DJ_RECEIVER_INDEX) | ||
698 | dev_err(&hdev->dev, "%s: invalid device index:%d\n", | ||
699 | __func__, dj_report->device_index); | ||
700 | return false; | ||
701 | } | ||
702 | |||
694 | spin_lock_irqsave(&djrcv_dev->lock, flags); | 703 | spin_lock_irqsave(&djrcv_dev->lock, flags); |
695 | if (dj_report->report_id == REPORT_ID_DJ_SHORT) { | 704 | switch (dj_report->report_type) { |
696 | switch (dj_report->report_type) { | 705 | case REPORT_TYPE_NOTIF_DEVICE_PAIRED: |
697 | case REPORT_TYPE_NOTIF_DEVICE_PAIRED: | 706 | case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: |
698 | case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: | 707 | logi_dj_recv_queue_notification(djrcv_dev, dj_report); |
699 | logi_dj_recv_queue_notification(djrcv_dev, dj_report); | 708 | break; |
700 | break; | 709 | case REPORT_TYPE_NOTIF_CONNECTION_STATUS: |
701 | case REPORT_TYPE_NOTIF_CONNECTION_STATUS: | 710 | if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == |
702 | if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == | 711 | STATUS_LINKLOSS) { |
703 | STATUS_LINKLOSS) { | 712 | logi_dj_recv_forward_null_report(djrcv_dev, dj_report); |
704 | logi_dj_recv_forward_null_report(djrcv_dev, dj_report); | ||
705 | } | ||
706 | break; | ||
707 | default: | ||
708 | logi_dj_recv_forward_report(djrcv_dev, dj_report); | ||
709 | } | 713 | } |
710 | report_processed = true; | 714 | break; |
715 | default: | ||
716 | logi_dj_recv_forward_report(djrcv_dev, dj_report); | ||
711 | } | 717 | } |
712 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); | 718 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); |
713 | 719 | ||
714 | return report_processed; | 720 | return true; |
715 | } | 721 | } |
716 | 722 | ||
717 | static int logi_dj_probe(struct hid_device *hdev, | 723 | static int logi_dj_probe(struct hid_device *hdev, |
diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h index 4a4000340ce1..daeb0aa4bee9 100644 --- a/drivers/hid/hid-logitech-dj.h +++ b/drivers/hid/hid-logitech-dj.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #define DJ_MAX_PAIRED_DEVICES 6 | 28 | #define DJ_MAX_PAIRED_DEVICES 6 |
29 | #define DJ_MAX_NUMBER_NOTIFICATIONS 8 | 29 | #define DJ_MAX_NUMBER_NOTIFICATIONS 8 |
30 | #define DJ_RECEIVER_INDEX 0 | ||
30 | #define DJ_DEVICE_INDEX_MIN 1 | 31 | #define DJ_DEVICE_INDEX_MIN 1 |
31 | #define DJ_DEVICE_INDEX_MAX 6 | 32 | #define DJ_DEVICE_INDEX_MAX 6 |
32 | 33 | ||
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index ecc2cbf300cc..29a74c1efcb8 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -290,6 +290,11 @@ static int magicmouse_raw_event(struct hid_device *hdev, | |||
290 | if (size < 4 || ((size - 4) % 9) != 0) | 290 | if (size < 4 || ((size - 4) % 9) != 0) |
291 | return 0; | 291 | return 0; |
292 | npoints = (size - 4) / 9; | 292 | npoints = (size - 4) / 9; |
293 | if (npoints > 15) { | ||
294 | hid_warn(hdev, "invalid size value (%d) for TRACKPAD_REPORT_ID\n", | ||
295 | size); | ||
296 | return 0; | ||
297 | } | ||
293 | msc->ntouches = 0; | 298 | msc->ntouches = 0; |
294 | for (ii = 0; ii < npoints; ii++) | 299 | for (ii = 0; ii < npoints; ii++) |
295 | magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); | 300 | magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); |
@@ -307,6 +312,11 @@ static int magicmouse_raw_event(struct hid_device *hdev, | |||
307 | if (size < 6 || ((size - 6) % 8) != 0) | 312 | if (size < 6 || ((size - 6) % 8) != 0) |
308 | return 0; | 313 | return 0; |
309 | npoints = (size - 6) / 8; | 314 | npoints = (size - 6) / 8; |
315 | if (npoints > 15) { | ||
316 | hid_warn(hdev, "invalid size value (%d) for MOUSE_REPORT_ID\n", | ||
317 | size); | ||
318 | return 0; | ||
319 | } | ||
310 | msc->ntouches = 0; | 320 | msc->ntouches = 0; |
311 | for (ii = 0; ii < npoints; ii++) | 321 | for (ii = 0; ii < npoints; ii++) |
312 | magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); | 322 | magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); |
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c index 9e14c00eb1b6..25daf28b26bd 100644 --- a/drivers/hid/hid-monterey.c +++ b/drivers/hid/hid-monterey.c | |||
@@ -24,7 +24,7 @@ | |||
24 | static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 24 | static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
25 | unsigned int *rsize) | 25 | unsigned int *rsize) |
26 | { | 26 | { |
27 | if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { | 27 | if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { |
28 | hid_info(hdev, "fixing up button/consumer in HID report descriptor\n"); | 28 | hid_info(hdev, "fixing up button/consumer in HID report descriptor\n"); |
29 | rdesc[30] = 0x0c; | 29 | rdesc[30] = 0x0c; |
30 | } | 30 | } |
diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c index 736b2502df4f..6aca4f2554bf 100644 --- a/drivers/hid/hid-petalynx.c +++ b/drivers/hid/hid-petalynx.c | |||
@@ -25,7 +25,7 @@ | |||
25 | static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 25 | static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
26 | unsigned int *rsize) | 26 | unsigned int *rsize) |
27 | { | 27 | { |
28 | if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && | 28 | if (*rsize >= 62 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && |
29 | rdesc[41] == 0x00 && rdesc[59] == 0x26 && | 29 | rdesc[41] == 0x00 && rdesc[59] == 0x26 && |
30 | rdesc[60] == 0xf9 && rdesc[61] == 0x00) { | 30 | rdesc[60] == 0xf9 && rdesc[61] == 0x00) { |
31 | hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n"); | 31 | hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n"); |
diff --git a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c index acbb021065ec..020df3c2e8b4 100644 --- a/drivers/hid/hid-picolcd_core.c +++ b/drivers/hid/hid-picolcd_core.c | |||
@@ -350,6 +350,12 @@ static int picolcd_raw_event(struct hid_device *hdev, | |||
350 | if (!data) | 350 | if (!data) |
351 | return 1; | 351 | return 1; |
352 | 352 | ||
353 | if (size > 64) { | ||
354 | hid_warn(hdev, "invalid size value (%d) for picolcd raw event\n", | ||
355 | size); | ||
356 | return 0; | ||
357 | } | ||
358 | |||
353 | if (report->id == REPORT_KEY_STATE) { | 359 | if (report->id == REPORT_KEY_STATE) { |
354 | if (data->input_keys) | 360 | if (data->input_keys) |
355 | ret = picolcd_raw_keypad(data, report, raw_data+1, size-1); | 361 | ret = picolcd_raw_keypad(data, report, raw_data+1, size-1); |
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 0dc25142f451..8389e8109218 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c | |||
@@ -909,10 +909,15 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
909 | return ret; | 909 | return ret; |
910 | } | 910 | } |
911 | 911 | ||
912 | if (!test_bit(RMI_STARTED, &data->flags)) { | 912 | if (!test_bit(RMI_STARTED, &data->flags)) |
913 | hid_hw_stop(hdev); | 913 | /* |
914 | return -EIO; | 914 | * The device maybe in the bootloader if rmi_input_configured |
915 | } | 915 | * failed to find F11 in the PDT. Print an error, but don't |
916 | * return an error from rmi_probe so that hidraw will be | ||
917 | * accessible from userspace. That way a userspace tool | ||
918 | * can be used to reload working firmware on the touchpad. | ||
919 | */ | ||
920 | hid_err(hdev, "Device failed to be properly configured\n"); | ||
916 | 921 | ||
917 | return 0; | 922 | return 0; |
918 | } | 923 | } |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index e244e449cbba..2ac25760a9a9 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -604,9 +604,9 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
604 | ret = -EINVAL; | 604 | ret = -EINVAL; |
605 | goto err_stop_hw; | 605 | goto err_stop_hw; |
606 | } | 606 | } |
607 | sd->hid_sensor_hub_client_devs = kzalloc(dev_cnt * | 607 | sd->hid_sensor_hub_client_devs = devm_kzalloc(&hdev->dev, dev_cnt * |
608 | sizeof(struct mfd_cell), | 608 | sizeof(struct mfd_cell), |
609 | GFP_KERNEL); | 609 | GFP_KERNEL); |
610 | if (sd->hid_sensor_hub_client_devs == NULL) { | 610 | if (sd->hid_sensor_hub_client_devs == NULL) { |
611 | hid_err(hdev, "Failed to allocate memory for mfd cells\n"); | 611 | hid_err(hdev, "Failed to allocate memory for mfd cells\n"); |
612 | ret = -ENOMEM; | 612 | ret = -ENOMEM; |
@@ -618,11 +618,12 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
618 | 618 | ||
619 | if (collection->type == HID_COLLECTION_PHYSICAL) { | 619 | if (collection->type == HID_COLLECTION_PHYSICAL) { |
620 | 620 | ||
621 | hsdev = kzalloc(sizeof(*hsdev), GFP_KERNEL); | 621 | hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev), |
622 | GFP_KERNEL); | ||
622 | if (!hsdev) { | 623 | if (!hsdev) { |
623 | hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); | 624 | hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); |
624 | ret = -ENOMEM; | 625 | ret = -ENOMEM; |
625 | goto err_no_mem; | 626 | goto err_stop_hw; |
626 | } | 627 | } |
627 | hsdev->hdev = hdev; | 628 | hsdev->hdev = hdev; |
628 | hsdev->vendor_id = hdev->vendor; | 629 | hsdev->vendor_id = hdev->vendor; |
@@ -631,13 +632,13 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
631 | if (last_hsdev) | 632 | if (last_hsdev) |
632 | last_hsdev->end_collection_index = i; | 633 | last_hsdev->end_collection_index = i; |
633 | last_hsdev = hsdev; | 634 | last_hsdev = hsdev; |
634 | name = kasprintf(GFP_KERNEL, "HID-SENSOR-%x", | 635 | name = devm_kasprintf(&hdev->dev, GFP_KERNEL, |
635 | collection->usage); | 636 | "HID-SENSOR-%x", |
637 | collection->usage); | ||
636 | if (name == NULL) { | 638 | if (name == NULL) { |
637 | hid_err(hdev, "Failed MFD device name\n"); | 639 | hid_err(hdev, "Failed MFD device name\n"); |
638 | ret = -ENOMEM; | 640 | ret = -ENOMEM; |
639 | kfree(hsdev); | 641 | goto err_stop_hw; |
640 | goto err_no_mem; | ||
641 | } | 642 | } |
642 | sd->hid_sensor_hub_client_devs[ | 643 | sd->hid_sensor_hub_client_devs[ |
643 | sd->hid_sensor_client_cnt].id = | 644 | sd->hid_sensor_client_cnt].id = |
@@ -661,16 +662,10 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
661 | ret = mfd_add_devices(&hdev->dev, 0, sd->hid_sensor_hub_client_devs, | 662 | ret = mfd_add_devices(&hdev->dev, 0, sd->hid_sensor_hub_client_devs, |
662 | sd->hid_sensor_client_cnt, NULL, 0, NULL); | 663 | sd->hid_sensor_client_cnt, NULL, 0, NULL); |
663 | if (ret < 0) | 664 | if (ret < 0) |
664 | goto err_no_mem; | 665 | goto err_stop_hw; |
665 | 666 | ||
666 | return ret; | 667 | return ret; |
667 | 668 | ||
668 | err_no_mem: | ||
669 | for (i = 0; i < sd->hid_sensor_client_cnt; ++i) { | ||
670 | kfree(sd->hid_sensor_hub_client_devs[i].name); | ||
671 | kfree(sd->hid_sensor_hub_client_devs[i].platform_data); | ||
672 | } | ||
673 | kfree(sd->hid_sensor_hub_client_devs); | ||
674 | err_stop_hw: | 669 | err_stop_hw: |
675 | hid_hw_stop(hdev); | 670 | hid_hw_stop(hdev); |
676 | 671 | ||
@@ -681,7 +676,6 @@ static void sensor_hub_remove(struct hid_device *hdev) | |||
681 | { | 676 | { |
682 | struct sensor_hub_data *data = hid_get_drvdata(hdev); | 677 | struct sensor_hub_data *data = hid_get_drvdata(hdev); |
683 | unsigned long flags; | 678 | unsigned long flags; |
684 | int i; | ||
685 | 679 | ||
686 | hid_dbg(hdev, " hardware removed\n"); | 680 | hid_dbg(hdev, " hardware removed\n"); |
687 | hid_hw_close(hdev); | 681 | hid_hw_close(hdev); |
@@ -691,11 +685,6 @@ static void sensor_hub_remove(struct hid_device *hdev) | |||
691 | complete(&data->pending.ready); | 685 | complete(&data->pending.ready); |
692 | spin_unlock_irqrestore(&data->lock, flags); | 686 | spin_unlock_irqrestore(&data->lock, flags); |
693 | mfd_remove_devices(&hdev->dev); | 687 | mfd_remove_devices(&hdev->dev); |
694 | for (i = 0; i < data->hid_sensor_client_cnt; ++i) { | ||
695 | kfree(data->hid_sensor_hub_client_devs[i].name); | ||
696 | kfree(data->hid_sensor_hub_client_devs[i].platform_data); | ||
697 | } | ||
698 | kfree(data->hid_sensor_hub_client_devs); | ||
699 | hid_set_drvdata(hdev, NULL); | 688 | hid_set_drvdata(hdev, NULL); |
700 | mutex_destroy(&data->mutex); | 689 | mutex_destroy(&data->mutex); |
701 | } | 690 | } |
diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c index 87fc91e1c8de..91072fa54663 100644 --- a/drivers/hid/hid-sunplus.c +++ b/drivers/hid/hid-sunplus.c | |||
@@ -24,7 +24,7 @@ | |||
24 | static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 24 | static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
25 | unsigned int *rsize) | 25 | unsigned int *rsize) |
26 | { | 26 | { |
27 | if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && | 27 | if (*rsize >= 112 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && |
28 | rdesc[106] == 0x03) { | 28 | rdesc[106] == 0x03) { |
29 | hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n"); | 29 | hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n"); |
30 | rdesc[105] = rdesc[110] = 0x03; | 30 | rdesc[105] = rdesc[110] = 0x03; |
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index fc6f5d54e7f7..8890870309e4 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -309,6 +309,7 @@ static ssize_t set_convrate(struct device *dev, struct device_attribute *da, | |||
309 | data->conf |= (resol << DS1621_REG_CONFIG_RESOL_SHIFT); | 309 | data->conf |= (resol << DS1621_REG_CONFIG_RESOL_SHIFT); |
310 | i2c_smbus_write_byte_data(client, DS1621_REG_CONF, data->conf); | 310 | i2c_smbus_write_byte_data(client, DS1621_REG_CONF, data->conf); |
311 | data->update_interval = ds1721_convrates[resol]; | 311 | data->update_interval = ds1721_convrates[resol]; |
312 | data->zbits = 7 - resol; | ||
312 | mutex_unlock(&data->update_lock); | 313 | mutex_unlock(&data->update_lock); |
313 | 314 | ||
314 | return count; | 315 | return count; |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 4a7cbfad1d74..fcdbde4ec692 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -93,13 +93,29 @@ static ssize_t show_power_crit(struct device *dev, | |||
93 | } | 93 | } |
94 | static DEVICE_ATTR(power1_crit, S_IRUGO, show_power_crit, NULL); | 94 | static DEVICE_ATTR(power1_crit, S_IRUGO, show_power_crit, NULL); |
95 | 95 | ||
96 | static umode_t fam15h_power_is_visible(struct kobject *kobj, | ||
97 | struct attribute *attr, | ||
98 | int index) | ||
99 | { | ||
100 | /* power1_input is only reported for Fam15h, Models 00h-0fh */ | ||
101 | if (attr == &dev_attr_power1_input.attr && | ||
102 | (boot_cpu_data.x86 != 0x15 || boot_cpu_data.x86_model > 0xf)) | ||
103 | return 0; | ||
104 | |||
105 | return attr->mode; | ||
106 | } | ||
107 | |||
96 | static struct attribute *fam15h_power_attrs[] = { | 108 | static struct attribute *fam15h_power_attrs[] = { |
97 | &dev_attr_power1_input.attr, | 109 | &dev_attr_power1_input.attr, |
98 | &dev_attr_power1_crit.attr, | 110 | &dev_attr_power1_crit.attr, |
99 | NULL | 111 | NULL |
100 | }; | 112 | }; |
101 | 113 | ||
102 | ATTRIBUTE_GROUPS(fam15h_power); | 114 | static const struct attribute_group fam15h_power_group = { |
115 | .attrs = fam15h_power_attrs, | ||
116 | .is_visible = fam15h_power_is_visible, | ||
117 | }; | ||
118 | __ATTRIBUTE_GROUPS(fam15h_power); | ||
103 | 119 | ||
104 | static bool fam15h_power_is_internal_node0(struct pci_dev *f4) | 120 | static bool fam15h_power_is_internal_node0(struct pci_dev *f4) |
105 | { | 121 | { |
@@ -216,7 +232,9 @@ static int fam15h_power_probe(struct pci_dev *pdev, | |||
216 | 232 | ||
217 | static const struct pci_device_id fam15h_power_id_table[] = { | 233 | static const struct pci_device_id fam15h_power_id_table[] = { |
218 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 234 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
235 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, | ||
219 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, | 236 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, |
237 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | ||
220 | {} | 238 | {} |
221 | }; | 239 | }; |
222 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); | 240 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); |
diff --git a/drivers/hwmon/tmp103.c b/drivers/hwmon/tmp103.c index e42964f07f67..ad571ec795a3 100644 --- a/drivers/hwmon/tmp103.c +++ b/drivers/hwmon/tmp103.c | |||
@@ -145,7 +145,7 @@ static int tmp103_probe(struct i2c_client *client, | |||
145 | } | 145 | } |
146 | 146 | ||
147 | i2c_set_clientdata(client, regmap); | 147 | i2c_set_clientdata(client, regmap); |
148 | hwmon_dev = hwmon_device_register_with_groups(dev, client->name, | 148 | hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, |
149 | regmap, tmp103_groups); | 149 | regmap, tmp103_groups); |
150 | return PTR_ERR_OR_ZERO(hwmon_dev); | 150 | return PTR_ERR_OR_ZERO(hwmon_dev); |
151 | } | 151 | } |
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 3e3b680dc007..b51a402752c4 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig | |||
@@ -23,17 +23,14 @@ config I2C | |||
23 | This I2C support can also be built as a module. If so, the module | 23 | This I2C support can also be built as a module. If so, the module |
24 | will be called i2c-core. | 24 | will be called i2c-core. |
25 | 25 | ||
26 | config I2C_ACPI | 26 | config ACPI_I2C_OPREGION |
27 | bool "I2C ACPI support" | 27 | bool "ACPI I2C Operation region support" |
28 | select I2C | 28 | depends on I2C=y && ACPI |
29 | depends on ACPI | ||
30 | default y | 29 | default y |
31 | help | 30 | help |
32 | Say Y here if you want to enable ACPI I2C support. This includes support | 31 | Say Y here if you want to enable ACPI I2C operation region support. |
33 | for automatic enumeration of I2C slave devices and support for ACPI I2C | 32 | Operation Regions allow firmware (BIOS) code to access I2C slave devices, |
34 | Operation Regions. Operation Regions allow firmware (BIOS) code to | 33 | such as smart batteries through an I2C host controller driver. |
35 | access I2C slave devices, such as smart batteries through an I2C host | ||
36 | controller driver. | ||
37 | 34 | ||
38 | if I2C | 35 | if I2C |
39 | 36 | ||
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index a1f590cbb435..1722f50f2473 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -2,11 +2,8 @@ | |||
2 | # Makefile for the i2c core. | 2 | # Makefile for the i2c core. |
3 | # | 3 | # |
4 | 4 | ||
5 | i2ccore-y := i2c-core.o | ||
6 | i2ccore-$(CONFIG_I2C_ACPI) += i2c-acpi.o | ||
7 | |||
8 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o | 5 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o |
9 | obj-$(CONFIG_I2C) += i2ccore.o | 6 | obj-$(CONFIG_I2C) += i2c-core.o |
10 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o | 7 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o |
11 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | 8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o |
12 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o | 9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 79a68999a696..917d54588d95 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -101,6 +101,7 @@ struct at91_twi_dev { | |||
101 | unsigned twi_cwgr_reg; | 101 | unsigned twi_cwgr_reg; |
102 | struct at91_twi_pdata *pdata; | 102 | struct at91_twi_pdata *pdata; |
103 | bool use_dma; | 103 | bool use_dma; |
104 | bool recv_len_abort; | ||
104 | struct at91_twi_dma dma; | 105 | struct at91_twi_dma dma; |
105 | }; | 106 | }; |
106 | 107 | ||
@@ -267,12 +268,24 @@ static void at91_twi_read_next_byte(struct at91_twi_dev *dev) | |||
267 | *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff; | 268 | *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff; |
268 | --dev->buf_len; | 269 | --dev->buf_len; |
269 | 270 | ||
271 | /* return if aborting, we only needed to read RHR to clear RXRDY*/ | ||
272 | if (dev->recv_len_abort) | ||
273 | return; | ||
274 | |||
270 | /* handle I2C_SMBUS_BLOCK_DATA */ | 275 | /* handle I2C_SMBUS_BLOCK_DATA */ |
271 | if (unlikely(dev->msg->flags & I2C_M_RECV_LEN)) { | 276 | if (unlikely(dev->msg->flags & I2C_M_RECV_LEN)) { |
272 | dev->msg->flags &= ~I2C_M_RECV_LEN; | 277 | /* ensure length byte is a valid value */ |
273 | dev->buf_len += *dev->buf; | 278 | if (*dev->buf <= I2C_SMBUS_BLOCK_MAX && *dev->buf > 0) { |
274 | dev->msg->len = dev->buf_len + 1; | 279 | dev->msg->flags &= ~I2C_M_RECV_LEN; |
275 | dev_dbg(dev->dev, "received block length %d\n", dev->buf_len); | 280 | dev->buf_len += *dev->buf; |
281 | dev->msg->len = dev->buf_len + 1; | ||
282 | dev_dbg(dev->dev, "received block length %d\n", | ||
283 | dev->buf_len); | ||
284 | } else { | ||
285 | /* abort and send the stop by reading one more byte */ | ||
286 | dev->recv_len_abort = true; | ||
287 | dev->buf_len = 1; | ||
288 | } | ||
276 | } | 289 | } |
277 | 290 | ||
278 | /* send stop if second but last byte has been read */ | 291 | /* send stop if second but last byte has been read */ |
@@ -421,8 +434,8 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) | |||
421 | } | 434 | } |
422 | } | 435 | } |
423 | 436 | ||
424 | ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | 437 | ret = wait_for_completion_io_timeout(&dev->cmd_complete, |
425 | dev->adapter.timeout); | 438 | dev->adapter.timeout); |
426 | if (ret == 0) { | 439 | if (ret == 0) { |
427 | dev_err(dev->dev, "controller timed out\n"); | 440 | dev_err(dev->dev, "controller timed out\n"); |
428 | at91_init_twi_bus(dev); | 441 | at91_init_twi_bus(dev); |
@@ -444,6 +457,12 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) | |||
444 | ret = -EIO; | 457 | ret = -EIO; |
445 | goto error; | 458 | goto error; |
446 | } | 459 | } |
460 | if (dev->recv_len_abort) { | ||
461 | dev_err(dev->dev, "invalid smbus block length recvd\n"); | ||
462 | ret = -EPROTO; | ||
463 | goto error; | ||
464 | } | ||
465 | |||
447 | dev_dbg(dev->dev, "transfer complete\n"); | 466 | dev_dbg(dev->dev, "transfer complete\n"); |
448 | 467 | ||
449 | return 0; | 468 | return 0; |
@@ -500,6 +519,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) | |||
500 | dev->buf_len = m_start->len; | 519 | dev->buf_len = m_start->len; |
501 | dev->buf = m_start->buf; | 520 | dev->buf = m_start->buf; |
502 | dev->msg = m_start; | 521 | dev->msg = m_start; |
522 | dev->recv_len_abort = false; | ||
503 | 523 | ||
504 | ret = at91_do_twi_transfer(dev); | 524 | ret = at91_do_twi_transfer(dev); |
505 | 525 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 2994690b26e9..10467a327749 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -164,6 +164,7 @@ | |||
164 | 164 | ||
165 | /* Older devices have their ID defined in <linux/pci_ids.h> */ | 165 | /* Older devices have their ID defined in <linux/pci_ids.h> */ |
166 | #define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 | 166 | #define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 |
167 | #define PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS 0x2292 | ||
167 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 | 168 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 |
168 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 | 169 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 |
169 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ | 170 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ |
@@ -828,6 +829,7 @@ static const struct pci_device_id i801_ids[] = { | |||
828 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_SMBUS) }, | 829 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_SMBUS) }, |
829 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS) }, | 830 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS) }, |
830 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS) }, | 831 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS) }, |
832 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS) }, | ||
831 | { 0, } | 833 | { 0, } |
832 | }; | 834 | }; |
833 | 835 | ||
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index 984492553e95..d9ee43c80cde 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
@@ -497,7 +497,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, | |||
497 | desc->wr_len_cmd = dma_size; | 497 | desc->wr_len_cmd = dma_size; |
498 | desc->control |= ISMT_DESC_BLK; | 498 | desc->control |= ISMT_DESC_BLK; |
499 | priv->dma_buffer[0] = command; | 499 | priv->dma_buffer[0] = command; |
500 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); | 500 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); |
501 | } else { | 501 | } else { |
502 | /* Block Read */ | 502 | /* Block Read */ |
503 | dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); | 503 | dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); |
@@ -525,7 +525,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, | |||
525 | desc->wr_len_cmd = dma_size; | 525 | desc->wr_len_cmd = dma_size; |
526 | desc->control |= ISMT_DESC_I2C; | 526 | desc->control |= ISMT_DESC_I2C; |
527 | priv->dma_buffer[0] = command; | 527 | priv->dma_buffer[0] = command; |
528 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); | 528 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); |
529 | } else { | 529 | } else { |
530 | /* i2c Block Read */ | 530 | /* i2c Block Read */ |
531 | dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); | 531 | dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 6dc5ded86f62..2f64273d3f2b 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -746,8 +746,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, | |||
746 | } | 746 | } |
747 | tclk = clk_get_rate(drv_data->clk); | 747 | tclk = clk_get_rate(drv_data->clk); |
748 | 748 | ||
749 | rc = of_property_read_u32(np, "clock-frequency", &bus_freq); | 749 | if (of_property_read_u32(np, "clock-frequency", &bus_freq)) |
750 | if (rc) | ||
751 | bus_freq = 100000; /* 100kHz by default */ | 750 | bus_freq = 100000; /* 100kHz by default */ |
752 | 751 | ||
753 | if (!mv64xxx_find_baud_factors(bus_freq, tclk, | 752 | if (!mv64xxx_find_baud_factors(bus_freq, tclk, |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 7170fc892829..65a21fed08b5 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -429,7 +429,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap, | |||
429 | ret = mxs_i2c_pio_wait_xfer_end(i2c); | 429 | ret = mxs_i2c_pio_wait_xfer_end(i2c); |
430 | if (ret) { | 430 | if (ret) { |
431 | dev_err(i2c->dev, | 431 | dev_err(i2c->dev, |
432 | "PIO: Failed to send SELECT command!\n"); | 432 | "PIO: Failed to send READ command!\n"); |
433 | goto cleanup; | 433 | goto cleanup; |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index f3c7139dfa25..e506fcd3ca04 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/spinlock.h> | ||
37 | 38 | ||
38 | /* register offsets */ | 39 | /* register offsets */ |
39 | #define ICSCR 0x00 /* slave ctrl */ | 40 | #define ICSCR 0x00 /* slave ctrl */ |
@@ -75,8 +76,8 @@ | |||
75 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) | 76 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) |
76 | #define RCAR_IRQ_STOP (MST) | 77 | #define RCAR_IRQ_STOP (MST) |
77 | 78 | ||
78 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE)) | 79 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE) & 0xFF) |
79 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR)) | 80 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR) & 0xFF) |
80 | 81 | ||
81 | #define ID_LAST_MSG (1 << 0) | 82 | #define ID_LAST_MSG (1 << 0) |
82 | #define ID_IOERROR (1 << 1) | 83 | #define ID_IOERROR (1 << 1) |
@@ -95,6 +96,7 @@ struct rcar_i2c_priv { | |||
95 | struct i2c_msg *msg; | 96 | struct i2c_msg *msg; |
96 | struct clk *clk; | 97 | struct clk *clk; |
97 | 98 | ||
99 | spinlock_t lock; | ||
98 | wait_queue_head_t wait; | 100 | wait_queue_head_t wait; |
99 | 101 | ||
100 | int pos; | 102 | int pos; |
@@ -365,20 +367,20 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) | |||
365 | struct rcar_i2c_priv *priv = ptr; | 367 | struct rcar_i2c_priv *priv = ptr; |
366 | u32 msr; | 368 | u32 msr; |
367 | 369 | ||
370 | /*-------------- spin lock -----------------*/ | ||
371 | spin_lock(&priv->lock); | ||
372 | |||
368 | msr = rcar_i2c_read(priv, ICMSR); | 373 | msr = rcar_i2c_read(priv, ICMSR); |
369 | 374 | ||
375 | /* Only handle interrupts that are currently enabled */ | ||
376 | msr &= rcar_i2c_read(priv, ICMIER); | ||
377 | |||
370 | /* Arbitration lost */ | 378 | /* Arbitration lost */ |
371 | if (msr & MAL) { | 379 | if (msr & MAL) { |
372 | rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST)); | 380 | rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST)); |
373 | goto out; | 381 | goto out; |
374 | } | 382 | } |
375 | 383 | ||
376 | /* Stop */ | ||
377 | if (msr & MST) { | ||
378 | rcar_i2c_flags_set(priv, ID_DONE); | ||
379 | goto out; | ||
380 | } | ||
381 | |||
382 | /* Nack */ | 384 | /* Nack */ |
383 | if (msr & MNR) { | 385 | if (msr & MNR) { |
384 | /* go to stop phase */ | 386 | /* go to stop phase */ |
@@ -388,6 +390,12 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) | |||
388 | goto out; | 390 | goto out; |
389 | } | 391 | } |
390 | 392 | ||
393 | /* Stop */ | ||
394 | if (msr & MST) { | ||
395 | rcar_i2c_flags_set(priv, ID_DONE); | ||
396 | goto out; | ||
397 | } | ||
398 | |||
391 | if (rcar_i2c_is_recv(priv)) | 399 | if (rcar_i2c_is_recv(priv)) |
392 | rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr)); | 400 | rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr)); |
393 | else | 401 | else |
@@ -400,6 +408,9 @@ out: | |||
400 | wake_up(&priv->wait); | 408 | wake_up(&priv->wait); |
401 | } | 409 | } |
402 | 410 | ||
411 | spin_unlock(&priv->lock); | ||
412 | /*-------------- spin unlock -----------------*/ | ||
413 | |||
403 | return IRQ_HANDLED; | 414 | return IRQ_HANDLED; |
404 | } | 415 | } |
405 | 416 | ||
@@ -409,14 +420,21 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
409 | { | 420 | { |
410 | struct rcar_i2c_priv *priv = i2c_get_adapdata(adap); | 421 | struct rcar_i2c_priv *priv = i2c_get_adapdata(adap); |
411 | struct device *dev = rcar_i2c_priv_to_dev(priv); | 422 | struct device *dev = rcar_i2c_priv_to_dev(priv); |
423 | unsigned long flags; | ||
412 | int i, ret, timeout; | 424 | int i, ret, timeout; |
413 | 425 | ||
414 | pm_runtime_get_sync(dev); | 426 | pm_runtime_get_sync(dev); |
415 | 427 | ||
428 | /*-------------- spin lock -----------------*/ | ||
429 | spin_lock_irqsave(&priv->lock, flags); | ||
430 | |||
416 | rcar_i2c_init(priv); | 431 | rcar_i2c_init(priv); |
417 | /* start clock */ | 432 | /* start clock */ |
418 | rcar_i2c_write(priv, ICCCR, priv->icccr); | 433 | rcar_i2c_write(priv, ICCCR, priv->icccr); |
419 | 434 | ||
435 | spin_unlock_irqrestore(&priv->lock, flags); | ||
436 | /*-------------- spin unlock -----------------*/ | ||
437 | |||
420 | ret = rcar_i2c_bus_barrier(priv); | 438 | ret = rcar_i2c_bus_barrier(priv); |
421 | if (ret < 0) | 439 | if (ret < 0) |
422 | goto out; | 440 | goto out; |
@@ -428,6 +446,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
428 | break; | 446 | break; |
429 | } | 447 | } |
430 | 448 | ||
449 | /*-------------- spin lock -----------------*/ | ||
450 | spin_lock_irqsave(&priv->lock, flags); | ||
451 | |||
431 | /* init each data */ | 452 | /* init each data */ |
432 | priv->msg = &msgs[i]; | 453 | priv->msg = &msgs[i]; |
433 | priv->pos = 0; | 454 | priv->pos = 0; |
@@ -437,6 +458,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
437 | 458 | ||
438 | ret = rcar_i2c_prepare_msg(priv); | 459 | ret = rcar_i2c_prepare_msg(priv); |
439 | 460 | ||
461 | spin_unlock_irqrestore(&priv->lock, flags); | ||
462 | /*-------------- spin unlock -----------------*/ | ||
463 | |||
440 | if (ret < 0) | 464 | if (ret < 0) |
441 | break; | 465 | break; |
442 | 466 | ||
@@ -540,6 +564,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) | |||
540 | 564 | ||
541 | irq = platform_get_irq(pdev, 0); | 565 | irq = platform_get_irq(pdev, 0); |
542 | init_waitqueue_head(&priv->wait); | 566 | init_waitqueue_head(&priv->wait); |
567 | spin_lock_init(&priv->lock); | ||
543 | 568 | ||
544 | adap = &priv->adap; | 569 | adap = &priv->adap; |
545 | adap->nr = pdev->id; | 570 | adap->nr = pdev->id; |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 69e11853e8bf..93cfc837200b 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
@@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) | |||
323 | /* ack interrupt */ | 323 | /* ack interrupt */ |
324 | i2c_writel(i2c, REG_INT_MBRF, REG_IPD); | 324 | i2c_writel(i2c, REG_INT_MBRF, REG_IPD); |
325 | 325 | ||
326 | /* Can only handle a maximum of 32 bytes at a time */ | ||
327 | if (len > 32) | ||
328 | len = 32; | ||
329 | |||
326 | /* read the data from receive buffer */ | 330 | /* read the data from receive buffer */ |
327 | for (i = 0; i < len; ++i) { | 331 | for (i = 0; i < len; ++i) { |
328 | if (i % 4 == 0) | 332 | if (i % 4 == 0) |
@@ -429,12 +433,11 @@ static void rk3x_i2c_set_scl_rate(struct rk3x_i2c *i2c, unsigned long scl_rate) | |||
429 | unsigned long i2c_rate = clk_get_rate(i2c->clk); | 433 | unsigned long i2c_rate = clk_get_rate(i2c->clk); |
430 | unsigned int div; | 434 | unsigned int div; |
431 | 435 | ||
432 | /* SCL rate = (clk rate) / (8 * DIV) */ | 436 | /* set DIV = DIVH = DIVL |
433 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 8); | 437 | * SCL rate = (clk rate) / (8 * (DIVH + 1 + DIVL + 1)) |
434 | 438 | * = (clk rate) / (16 * (DIV + 1)) | |
435 | /* The lower and upper half of the CLKDIV reg describe the length of | 439 | */ |
436 | * SCL low & high periods. */ | 440 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 16) - 1; |
437 | div = DIV_ROUND_UP(div, 2); | ||
438 | 441 | ||
439 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); | 442 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); |
440 | } | 443 | } |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 87d0371cebb7..efba1ebe16ba 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -380,34 +380,33 @@ static inline int tegra_i2c_clock_enable(struct tegra_i2c_dev *i2c_dev) | |||
380 | { | 380 | { |
381 | int ret; | 381 | int ret; |
382 | if (!i2c_dev->hw->has_single_clk_source) { | 382 | if (!i2c_dev->hw->has_single_clk_source) { |
383 | ret = clk_prepare_enable(i2c_dev->fast_clk); | 383 | ret = clk_enable(i2c_dev->fast_clk); |
384 | if (ret < 0) { | 384 | if (ret < 0) { |
385 | dev_err(i2c_dev->dev, | 385 | dev_err(i2c_dev->dev, |
386 | "Enabling fast clk failed, err %d\n", ret); | 386 | "Enabling fast clk failed, err %d\n", ret); |
387 | return ret; | 387 | return ret; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | ret = clk_prepare_enable(i2c_dev->div_clk); | 390 | ret = clk_enable(i2c_dev->div_clk); |
391 | if (ret < 0) { | 391 | if (ret < 0) { |
392 | dev_err(i2c_dev->dev, | 392 | dev_err(i2c_dev->dev, |
393 | "Enabling div clk failed, err %d\n", ret); | 393 | "Enabling div clk failed, err %d\n", ret); |
394 | clk_disable_unprepare(i2c_dev->fast_clk); | 394 | clk_disable(i2c_dev->fast_clk); |
395 | } | 395 | } |
396 | return ret; | 396 | return ret; |
397 | } | 397 | } |
398 | 398 | ||
399 | static inline void tegra_i2c_clock_disable(struct tegra_i2c_dev *i2c_dev) | 399 | static inline void tegra_i2c_clock_disable(struct tegra_i2c_dev *i2c_dev) |
400 | { | 400 | { |
401 | clk_disable_unprepare(i2c_dev->div_clk); | 401 | clk_disable(i2c_dev->div_clk); |
402 | if (!i2c_dev->hw->has_single_clk_source) | 402 | if (!i2c_dev->hw->has_single_clk_source) |
403 | clk_disable_unprepare(i2c_dev->fast_clk); | 403 | clk_disable(i2c_dev->fast_clk); |
404 | } | 404 | } |
405 | 405 | ||
406 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | 406 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) |
407 | { | 407 | { |
408 | u32 val; | 408 | u32 val; |
409 | int err = 0; | 409 | int err = 0; |
410 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | ||
411 | u32 clk_divisor; | 410 | u32 clk_divisor; |
412 | 411 | ||
413 | err = tegra_i2c_clock_enable(i2c_dev); | 412 | err = tegra_i2c_clock_enable(i2c_dev); |
@@ -428,9 +427,6 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
428 | i2c_writel(i2c_dev, val, I2C_CNFG); | 427 | i2c_writel(i2c_dev, val, I2C_CNFG); |
429 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); | 428 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); |
430 | 429 | ||
431 | clk_multiplier *= (i2c_dev->hw->clk_divisor_std_fast_mode + 1); | ||
432 | clk_set_rate(i2c_dev->div_clk, i2c_dev->bus_clk_rate * clk_multiplier); | ||
433 | |||
434 | /* Make sure clock divisor programmed correctly */ | 430 | /* Make sure clock divisor programmed correctly */ |
435 | clk_divisor = i2c_dev->hw->clk_divisor_hs_mode; | 431 | clk_divisor = i2c_dev->hw->clk_divisor_hs_mode; |
436 | clk_divisor |= i2c_dev->hw->clk_divisor_std_fast_mode << | 432 | clk_divisor |= i2c_dev->hw->clk_divisor_std_fast_mode << |
@@ -712,6 +708,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
712 | void __iomem *base; | 708 | void __iomem *base; |
713 | int irq; | 709 | int irq; |
714 | int ret = 0; | 710 | int ret = 0; |
711 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | ||
715 | 712 | ||
716 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 713 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
717 | base = devm_ioremap_resource(&pdev->dev, res); | 714 | base = devm_ioremap_resource(&pdev->dev, res); |
@@ -777,17 +774,39 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
777 | 774 | ||
778 | platform_set_drvdata(pdev, i2c_dev); | 775 | platform_set_drvdata(pdev, i2c_dev); |
779 | 776 | ||
777 | if (!i2c_dev->hw->has_single_clk_source) { | ||
778 | ret = clk_prepare(i2c_dev->fast_clk); | ||
779 | if (ret < 0) { | ||
780 | dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); | ||
781 | return ret; | ||
782 | } | ||
783 | } | ||
784 | |||
785 | clk_multiplier *= (i2c_dev->hw->clk_divisor_std_fast_mode + 1); | ||
786 | ret = clk_set_rate(i2c_dev->div_clk, | ||
787 | i2c_dev->bus_clk_rate * clk_multiplier); | ||
788 | if (ret) { | ||
789 | dev_err(i2c_dev->dev, "Clock rate change failed %d\n", ret); | ||
790 | goto unprepare_fast_clk; | ||
791 | } | ||
792 | |||
793 | ret = clk_prepare(i2c_dev->div_clk); | ||
794 | if (ret < 0) { | ||
795 | dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); | ||
796 | goto unprepare_fast_clk; | ||
797 | } | ||
798 | |||
780 | ret = tegra_i2c_init(i2c_dev); | 799 | ret = tegra_i2c_init(i2c_dev); |
781 | if (ret) { | 800 | if (ret) { |
782 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); | 801 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); |
783 | return ret; | 802 | goto unprepare_div_clk; |
784 | } | 803 | } |
785 | 804 | ||
786 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, | 805 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, |
787 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); | 806 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); |
788 | if (ret) { | 807 | if (ret) { |
789 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); | 808 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); |
790 | return ret; | 809 | goto unprepare_div_clk; |
791 | } | 810 | } |
792 | 811 | ||
793 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); | 812 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); |
@@ -803,16 +822,30 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
803 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); | 822 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); |
804 | if (ret) { | 823 | if (ret) { |
805 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); | 824 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); |
806 | return ret; | 825 | goto unprepare_div_clk; |
807 | } | 826 | } |
808 | 827 | ||
809 | return 0; | 828 | return 0; |
829 | |||
830 | unprepare_div_clk: | ||
831 | clk_unprepare(i2c_dev->div_clk); | ||
832 | |||
833 | unprepare_fast_clk: | ||
834 | if (!i2c_dev->hw->has_single_clk_source) | ||
835 | clk_unprepare(i2c_dev->fast_clk); | ||
836 | |||
837 | return ret; | ||
810 | } | 838 | } |
811 | 839 | ||
812 | static int tegra_i2c_remove(struct platform_device *pdev) | 840 | static int tegra_i2c_remove(struct platform_device *pdev) |
813 | { | 841 | { |
814 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); | 842 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); |
815 | i2c_del_adapter(&i2c_dev->adapter); | 843 | i2c_del_adapter(&i2c_dev->adapter); |
844 | |||
845 | clk_unprepare(i2c_dev->div_clk); | ||
846 | if (!i2c_dev->hw->has_single_clk_source) | ||
847 | clk_unprepare(i2c_dev->fast_clk); | ||
848 | |||
816 | return 0; | 849 | return 0; |
817 | } | 850 | } |
818 | 851 | ||
diff --git a/drivers/i2c/i2c-acpi.c b/drivers/i2c/i2c-acpi.c deleted file mode 100644 index e8b61967334b..000000000000 --- a/drivers/i2c/i2c-acpi.c +++ /dev/null | |||
@@ -1,362 +0,0 @@ | |||
1 | /* | ||
2 | * I2C ACPI code | ||
3 | * | ||
4 | * Copyright (C) 2014 Intel Corp | ||
5 | * | ||
6 | * Author: Lan Tianyu <tianyu.lan@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
15 | * for more details. | ||
16 | */ | ||
17 | #define pr_fmt(fmt) "I2C/ACPI : " fmt | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/i2c.h> | ||
23 | #include <linux/acpi.h> | ||
24 | |||
25 | struct acpi_i2c_handler_data { | ||
26 | struct acpi_connection_info info; | ||
27 | struct i2c_adapter *adapter; | ||
28 | }; | ||
29 | |||
30 | struct gsb_buffer { | ||
31 | u8 status; | ||
32 | u8 len; | ||
33 | union { | ||
34 | u16 wdata; | ||
35 | u8 bdata; | ||
36 | u8 data[0]; | ||
37 | }; | ||
38 | } __packed; | ||
39 | |||
40 | static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data) | ||
41 | { | ||
42 | struct i2c_board_info *info = data; | ||
43 | |||
44 | if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
45 | struct acpi_resource_i2c_serialbus *sb; | ||
46 | |||
47 | sb = &ares->data.i2c_serial_bus; | ||
48 | if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
49 | info->addr = sb->slave_address; | ||
50 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
51 | info->flags |= I2C_CLIENT_TEN; | ||
52 | } | ||
53 | } else if (info->irq < 0) { | ||
54 | struct resource r; | ||
55 | |||
56 | if (acpi_dev_resource_interrupt(ares, 0, &r)) | ||
57 | info->irq = r.start; | ||
58 | } | ||
59 | |||
60 | /* Tell the ACPI core to skip this resource */ | ||
61 | return 1; | ||
62 | } | ||
63 | |||
64 | static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | ||
65 | void *data, void **return_value) | ||
66 | { | ||
67 | struct i2c_adapter *adapter = data; | ||
68 | struct list_head resource_list; | ||
69 | struct i2c_board_info info; | ||
70 | struct acpi_device *adev; | ||
71 | int ret; | ||
72 | |||
73 | if (acpi_bus_get_device(handle, &adev)) | ||
74 | return AE_OK; | ||
75 | if (acpi_bus_get_status(adev) || !adev->status.present) | ||
76 | return AE_OK; | ||
77 | |||
78 | memset(&info, 0, sizeof(info)); | ||
79 | info.acpi_node.companion = adev; | ||
80 | info.irq = -1; | ||
81 | |||
82 | INIT_LIST_HEAD(&resource_list); | ||
83 | ret = acpi_dev_get_resources(adev, &resource_list, | ||
84 | acpi_i2c_add_resource, &info); | ||
85 | acpi_dev_free_resource_list(&resource_list); | ||
86 | |||
87 | if (ret < 0 || !info.addr) | ||
88 | return AE_OK; | ||
89 | |||
90 | adev->power.flags.ignore_parent = true; | ||
91 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); | ||
92 | if (!i2c_new_device(adapter, &info)) { | ||
93 | adev->power.flags.ignore_parent = false; | ||
94 | dev_err(&adapter->dev, | ||
95 | "failed to add I2C device %s from ACPI\n", | ||
96 | dev_name(&adev->dev)); | ||
97 | } | ||
98 | |||
99 | return AE_OK; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter | ||
104 | * @adap: pointer to adapter | ||
105 | * | ||
106 | * Enumerate all I2C slave devices behind this adapter by walking the ACPI | ||
107 | * namespace. When a device is found it will be added to the Linux device | ||
108 | * model and bound to the corresponding ACPI handle. | ||
109 | */ | ||
110 | void acpi_i2c_register_devices(struct i2c_adapter *adap) | ||
111 | { | ||
112 | acpi_handle handle; | ||
113 | acpi_status status; | ||
114 | |||
115 | if (!adap->dev.parent) | ||
116 | return; | ||
117 | |||
118 | handle = ACPI_HANDLE(adap->dev.parent); | ||
119 | if (!handle) | ||
120 | return; | ||
121 | |||
122 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
123 | acpi_i2c_add_device, NULL, | ||
124 | adap, NULL); | ||
125 | if (ACPI_FAILURE(status)) | ||
126 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | ||
127 | } | ||
128 | |||
129 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | ||
130 | u8 cmd, u8 *data, u8 data_len) | ||
131 | { | ||
132 | |||
133 | struct i2c_msg msgs[2]; | ||
134 | int ret; | ||
135 | u8 *buffer; | ||
136 | |||
137 | buffer = kzalloc(data_len, GFP_KERNEL); | ||
138 | if (!buffer) | ||
139 | return AE_NO_MEMORY; | ||
140 | |||
141 | msgs[0].addr = client->addr; | ||
142 | msgs[0].flags = client->flags; | ||
143 | msgs[0].len = 1; | ||
144 | msgs[0].buf = &cmd; | ||
145 | |||
146 | msgs[1].addr = client->addr; | ||
147 | msgs[1].flags = client->flags | I2C_M_RD; | ||
148 | msgs[1].len = data_len; | ||
149 | msgs[1].buf = buffer; | ||
150 | |||
151 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
152 | if (ret < 0) | ||
153 | dev_err(&client->adapter->dev, "i2c read failed\n"); | ||
154 | else | ||
155 | memcpy(data, buffer, data_len); | ||
156 | |||
157 | kfree(buffer); | ||
158 | return ret; | ||
159 | } | ||
160 | |||
161 | static int acpi_gsb_i2c_write_bytes(struct i2c_client *client, | ||
162 | u8 cmd, u8 *data, u8 data_len) | ||
163 | { | ||
164 | |||
165 | struct i2c_msg msgs[1]; | ||
166 | u8 *buffer; | ||
167 | int ret = AE_OK; | ||
168 | |||
169 | buffer = kzalloc(data_len + 1, GFP_KERNEL); | ||
170 | if (!buffer) | ||
171 | return AE_NO_MEMORY; | ||
172 | |||
173 | buffer[0] = cmd; | ||
174 | memcpy(buffer + 1, data, data_len); | ||
175 | |||
176 | msgs[0].addr = client->addr; | ||
177 | msgs[0].flags = client->flags; | ||
178 | msgs[0].len = data_len + 1; | ||
179 | msgs[0].buf = buffer; | ||
180 | |||
181 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
182 | if (ret < 0) | ||
183 | dev_err(&client->adapter->dev, "i2c write failed\n"); | ||
184 | |||
185 | kfree(buffer); | ||
186 | return ret; | ||
187 | } | ||
188 | |||
189 | static acpi_status | ||
190 | acpi_i2c_space_handler(u32 function, acpi_physical_address command, | ||
191 | u32 bits, u64 *value64, | ||
192 | void *handler_context, void *region_context) | ||
193 | { | ||
194 | struct gsb_buffer *gsb = (struct gsb_buffer *)value64; | ||
195 | struct acpi_i2c_handler_data *data = handler_context; | ||
196 | struct acpi_connection_info *info = &data->info; | ||
197 | struct acpi_resource_i2c_serialbus *sb; | ||
198 | struct i2c_adapter *adapter = data->adapter; | ||
199 | struct i2c_client client; | ||
200 | struct acpi_resource *ares; | ||
201 | u32 accessor_type = function >> 16; | ||
202 | u8 action = function & ACPI_IO_MASK; | ||
203 | acpi_status ret = AE_OK; | ||
204 | int status; | ||
205 | |||
206 | ret = acpi_buffer_to_resource(info->connection, info->length, &ares); | ||
207 | if (ACPI_FAILURE(ret)) | ||
208 | return ret; | ||
209 | |||
210 | if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
211 | ret = AE_BAD_PARAMETER; | ||
212 | goto err; | ||
213 | } | ||
214 | |||
215 | sb = &ares->data.i2c_serial_bus; | ||
216 | if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
217 | ret = AE_BAD_PARAMETER; | ||
218 | goto err; | ||
219 | } | ||
220 | |||
221 | memset(&client, 0, sizeof(client)); | ||
222 | client.adapter = adapter; | ||
223 | client.addr = sb->slave_address; | ||
224 | client.flags = 0; | ||
225 | |||
226 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
227 | client.flags |= I2C_CLIENT_TEN; | ||
228 | |||
229 | switch (accessor_type) { | ||
230 | case ACPI_GSB_ACCESS_ATTRIB_SEND_RCV: | ||
231 | if (action == ACPI_READ) { | ||
232 | status = i2c_smbus_read_byte(&client); | ||
233 | if (status >= 0) { | ||
234 | gsb->bdata = status; | ||
235 | status = 0; | ||
236 | } | ||
237 | } else { | ||
238 | status = i2c_smbus_write_byte(&client, gsb->bdata); | ||
239 | } | ||
240 | break; | ||
241 | |||
242 | case ACPI_GSB_ACCESS_ATTRIB_BYTE: | ||
243 | if (action == ACPI_READ) { | ||
244 | status = i2c_smbus_read_byte_data(&client, command); | ||
245 | if (status >= 0) { | ||
246 | gsb->bdata = status; | ||
247 | status = 0; | ||
248 | } | ||
249 | } else { | ||
250 | status = i2c_smbus_write_byte_data(&client, command, | ||
251 | gsb->bdata); | ||
252 | } | ||
253 | break; | ||
254 | |||
255 | case ACPI_GSB_ACCESS_ATTRIB_WORD: | ||
256 | if (action == ACPI_READ) { | ||
257 | status = i2c_smbus_read_word_data(&client, command); | ||
258 | if (status >= 0) { | ||
259 | gsb->wdata = status; | ||
260 | status = 0; | ||
261 | } | ||
262 | } else { | ||
263 | status = i2c_smbus_write_word_data(&client, command, | ||
264 | gsb->wdata); | ||
265 | } | ||
266 | break; | ||
267 | |||
268 | case ACPI_GSB_ACCESS_ATTRIB_BLOCK: | ||
269 | if (action == ACPI_READ) { | ||
270 | status = i2c_smbus_read_block_data(&client, command, | ||
271 | gsb->data); | ||
272 | if (status >= 0) { | ||
273 | gsb->len = status; | ||
274 | status = 0; | ||
275 | } | ||
276 | } else { | ||
277 | status = i2c_smbus_write_block_data(&client, command, | ||
278 | gsb->len, gsb->data); | ||
279 | } | ||
280 | break; | ||
281 | |||
282 | case ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE: | ||
283 | if (action == ACPI_READ) { | ||
284 | status = acpi_gsb_i2c_read_bytes(&client, command, | ||
285 | gsb->data, info->access_length); | ||
286 | if (status > 0) | ||
287 | status = 0; | ||
288 | } else { | ||
289 | status = acpi_gsb_i2c_write_bytes(&client, command, | ||
290 | gsb->data, info->access_length); | ||
291 | } | ||
292 | break; | ||
293 | |||
294 | default: | ||
295 | pr_info("protocol(0x%02x) is not supported.\n", accessor_type); | ||
296 | ret = AE_BAD_PARAMETER; | ||
297 | goto err; | ||
298 | } | ||
299 | |||
300 | gsb->status = status; | ||
301 | |||
302 | err: | ||
303 | ACPI_FREE(ares); | ||
304 | return ret; | ||
305 | } | ||
306 | |||
307 | |||
308 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
309 | { | ||
310 | acpi_handle handle = ACPI_HANDLE(adapter->dev.parent); | ||
311 | struct acpi_i2c_handler_data *data; | ||
312 | acpi_status status; | ||
313 | |||
314 | if (!handle) | ||
315 | return -ENODEV; | ||
316 | |||
317 | data = kzalloc(sizeof(struct acpi_i2c_handler_data), | ||
318 | GFP_KERNEL); | ||
319 | if (!data) | ||
320 | return -ENOMEM; | ||
321 | |||
322 | data->adapter = adapter; | ||
323 | status = acpi_bus_attach_private_data(handle, (void *)data); | ||
324 | if (ACPI_FAILURE(status)) { | ||
325 | kfree(data); | ||
326 | return -ENOMEM; | ||
327 | } | ||
328 | |||
329 | status = acpi_install_address_space_handler(handle, | ||
330 | ACPI_ADR_SPACE_GSBUS, | ||
331 | &acpi_i2c_space_handler, | ||
332 | NULL, | ||
333 | data); | ||
334 | if (ACPI_FAILURE(status)) { | ||
335 | dev_err(&adapter->dev, "Error installing i2c space handler\n"); | ||
336 | acpi_bus_detach_private_data(handle); | ||
337 | kfree(data); | ||
338 | return -ENOMEM; | ||
339 | } | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
345 | { | ||
346 | acpi_handle handle = ACPI_HANDLE(adapter->dev.parent); | ||
347 | struct acpi_i2c_handler_data *data; | ||
348 | acpi_status status; | ||
349 | |||
350 | if (!handle) | ||
351 | return; | ||
352 | |||
353 | acpi_remove_address_space_handler(handle, | ||
354 | ACPI_ADR_SPACE_GSBUS, | ||
355 | &acpi_i2c_space_handler); | ||
356 | |||
357 | status = acpi_bus_get_private_data(handle, (void **)&data); | ||
358 | if (ACPI_SUCCESS(status)) | ||
359 | kfree(data); | ||
360 | |||
361 | acpi_bus_detach_private_data(handle); | ||
362 | } | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 632057a44615..ccfbbab82a15 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -27,6 +27,8 @@ | |||
27 | OF support is copyright (c) 2008 Jochen Friedrich <jochen@scram.de> | 27 | OF support is copyright (c) 2008 Jochen Friedrich <jochen@scram.de> |
28 | (based on a previous patch from Jon Smirl <jonsmirl@gmail.com>) and | 28 | (based on a previous patch from Jon Smirl <jonsmirl@gmail.com>) and |
29 | (c) 2013 Wolfram Sang <wsa@the-dreams.de> | 29 | (c) 2013 Wolfram Sang <wsa@the-dreams.de> |
30 | I2C ACPI code Copyright (C) 2014 Intel Corp | ||
31 | Author: Lan Tianyu <tianyu.lan@intel.com> | ||
30 | */ | 32 | */ |
31 | 33 | ||
32 | #include <linux/module.h> | 34 | #include <linux/module.h> |
@@ -78,6 +80,368 @@ void i2c_transfer_trace_unreg(void) | |||
78 | static_key_slow_dec(&i2c_trace_msg); | 80 | static_key_slow_dec(&i2c_trace_msg); |
79 | } | 81 | } |
80 | 82 | ||
83 | #if defined(CONFIG_ACPI) | ||
84 | struct acpi_i2c_handler_data { | ||
85 | struct acpi_connection_info info; | ||
86 | struct i2c_adapter *adapter; | ||
87 | }; | ||
88 | |||
89 | struct gsb_buffer { | ||
90 | u8 status; | ||
91 | u8 len; | ||
92 | union { | ||
93 | u16 wdata; | ||
94 | u8 bdata; | ||
95 | u8 data[0]; | ||
96 | }; | ||
97 | } __packed; | ||
98 | |||
99 | static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data) | ||
100 | { | ||
101 | struct i2c_board_info *info = data; | ||
102 | |||
103 | if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
104 | struct acpi_resource_i2c_serialbus *sb; | ||
105 | |||
106 | sb = &ares->data.i2c_serial_bus; | ||
107 | if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
108 | info->addr = sb->slave_address; | ||
109 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
110 | info->flags |= I2C_CLIENT_TEN; | ||
111 | } | ||
112 | } else if (info->irq < 0) { | ||
113 | struct resource r; | ||
114 | |||
115 | if (acpi_dev_resource_interrupt(ares, 0, &r)) | ||
116 | info->irq = r.start; | ||
117 | } | ||
118 | |||
119 | /* Tell the ACPI core to skip this resource */ | ||
120 | return 1; | ||
121 | } | ||
122 | |||
123 | static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | ||
124 | void *data, void **return_value) | ||
125 | { | ||
126 | struct i2c_adapter *adapter = data; | ||
127 | struct list_head resource_list; | ||
128 | struct i2c_board_info info; | ||
129 | struct acpi_device *adev; | ||
130 | int ret; | ||
131 | |||
132 | if (acpi_bus_get_device(handle, &adev)) | ||
133 | return AE_OK; | ||
134 | if (acpi_bus_get_status(adev) || !adev->status.present) | ||
135 | return AE_OK; | ||
136 | |||
137 | memset(&info, 0, sizeof(info)); | ||
138 | info.acpi_node.companion = adev; | ||
139 | info.irq = -1; | ||
140 | |||
141 | INIT_LIST_HEAD(&resource_list); | ||
142 | ret = acpi_dev_get_resources(adev, &resource_list, | ||
143 | acpi_i2c_add_resource, &info); | ||
144 | acpi_dev_free_resource_list(&resource_list); | ||
145 | |||
146 | if (ret < 0 || !info.addr) | ||
147 | return AE_OK; | ||
148 | |||
149 | adev->power.flags.ignore_parent = true; | ||
150 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); | ||
151 | if (!i2c_new_device(adapter, &info)) { | ||
152 | adev->power.flags.ignore_parent = false; | ||
153 | dev_err(&adapter->dev, | ||
154 | "failed to add I2C device %s from ACPI\n", | ||
155 | dev_name(&adev->dev)); | ||
156 | } | ||
157 | |||
158 | return AE_OK; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter | ||
163 | * @adap: pointer to adapter | ||
164 | * | ||
165 | * Enumerate all I2C slave devices behind this adapter by walking the ACPI | ||
166 | * namespace. When a device is found it will be added to the Linux device | ||
167 | * model and bound to the corresponding ACPI handle. | ||
168 | */ | ||
169 | static void acpi_i2c_register_devices(struct i2c_adapter *adap) | ||
170 | { | ||
171 | acpi_handle handle; | ||
172 | acpi_status status; | ||
173 | |||
174 | if (!adap->dev.parent) | ||
175 | return; | ||
176 | |||
177 | handle = ACPI_HANDLE(adap->dev.parent); | ||
178 | if (!handle) | ||
179 | return; | ||
180 | |||
181 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
182 | acpi_i2c_add_device, NULL, | ||
183 | adap, NULL); | ||
184 | if (ACPI_FAILURE(status)) | ||
185 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | ||
186 | } | ||
187 | |||
188 | #else /* CONFIG_ACPI */ | ||
189 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } | ||
190 | #endif /* CONFIG_ACPI */ | ||
191 | |||
192 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
193 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | ||
194 | u8 cmd, u8 *data, u8 data_len) | ||
195 | { | ||
196 | |||
197 | struct i2c_msg msgs[2]; | ||
198 | int ret; | ||
199 | u8 *buffer; | ||
200 | |||
201 | buffer = kzalloc(data_len, GFP_KERNEL); | ||
202 | if (!buffer) | ||
203 | return AE_NO_MEMORY; | ||
204 | |||
205 | msgs[0].addr = client->addr; | ||
206 | msgs[0].flags = client->flags; | ||
207 | msgs[0].len = 1; | ||
208 | msgs[0].buf = &cmd; | ||
209 | |||
210 | msgs[1].addr = client->addr; | ||
211 | msgs[1].flags = client->flags | I2C_M_RD; | ||
212 | msgs[1].len = data_len; | ||
213 | msgs[1].buf = buffer; | ||
214 | |||
215 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
216 | if (ret < 0) | ||
217 | dev_err(&client->adapter->dev, "i2c read failed\n"); | ||
218 | else | ||
219 | memcpy(data, buffer, data_len); | ||
220 | |||
221 | kfree(buffer); | ||
222 | return ret; | ||
223 | } | ||
224 | |||
225 | static int acpi_gsb_i2c_write_bytes(struct i2c_client *client, | ||
226 | u8 cmd, u8 *data, u8 data_len) | ||
227 | { | ||
228 | |||
229 | struct i2c_msg msgs[1]; | ||
230 | u8 *buffer; | ||
231 | int ret = AE_OK; | ||
232 | |||
233 | buffer = kzalloc(data_len + 1, GFP_KERNEL); | ||
234 | if (!buffer) | ||
235 | return AE_NO_MEMORY; | ||
236 | |||
237 | buffer[0] = cmd; | ||
238 | memcpy(buffer + 1, data, data_len); | ||
239 | |||
240 | msgs[0].addr = client->addr; | ||
241 | msgs[0].flags = client->flags; | ||
242 | msgs[0].len = data_len + 1; | ||
243 | msgs[0].buf = buffer; | ||
244 | |||
245 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
246 | if (ret < 0) | ||
247 | dev_err(&client->adapter->dev, "i2c write failed\n"); | ||
248 | |||
249 | kfree(buffer); | ||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | static acpi_status | ||
254 | acpi_i2c_space_handler(u32 function, acpi_physical_address command, | ||
255 | u32 bits, u64 *value64, | ||
256 | void *handler_context, void *region_context) | ||
257 | { | ||
258 | struct gsb_buffer *gsb = (struct gsb_buffer *)value64; | ||
259 | struct acpi_i2c_handler_data *data = handler_context; | ||
260 | struct acpi_connection_info *info = &data->info; | ||
261 | struct acpi_resource_i2c_serialbus *sb; | ||
262 | struct i2c_adapter *adapter = data->adapter; | ||
263 | struct i2c_client client; | ||
264 | struct acpi_resource *ares; | ||
265 | u32 accessor_type = function >> 16; | ||
266 | u8 action = function & ACPI_IO_MASK; | ||
267 | acpi_status ret = AE_OK; | ||
268 | int status; | ||
269 | |||
270 | ret = acpi_buffer_to_resource(info->connection, info->length, &ares); | ||
271 | if (ACPI_FAILURE(ret)) | ||
272 | return ret; | ||
273 | |||
274 | if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
275 | ret = AE_BAD_PARAMETER; | ||
276 | goto err; | ||
277 | } | ||
278 | |||
279 | sb = &ares->data.i2c_serial_bus; | ||
280 | if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
281 | ret = AE_BAD_PARAMETER; | ||
282 | goto err; | ||
283 | } | ||
284 | |||
285 | memset(&client, 0, sizeof(client)); | ||
286 | client.adapter = adapter; | ||
287 | client.addr = sb->slave_address; | ||
288 | client.flags = 0; | ||
289 | |||
290 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
291 | client.flags |= I2C_CLIENT_TEN; | ||
292 | |||
293 | switch (accessor_type) { | ||
294 | case ACPI_GSB_ACCESS_ATTRIB_SEND_RCV: | ||
295 | if (action == ACPI_READ) { | ||
296 | status = i2c_smbus_read_byte(&client); | ||
297 | if (status >= 0) { | ||
298 | gsb->bdata = status; | ||
299 | status = 0; | ||
300 | } | ||
301 | } else { | ||
302 | status = i2c_smbus_write_byte(&client, gsb->bdata); | ||
303 | } | ||
304 | break; | ||
305 | |||
306 | case ACPI_GSB_ACCESS_ATTRIB_BYTE: | ||
307 | if (action == ACPI_READ) { | ||
308 | status = i2c_smbus_read_byte_data(&client, command); | ||
309 | if (status >= 0) { | ||
310 | gsb->bdata = status; | ||
311 | status = 0; | ||
312 | } | ||
313 | } else { | ||
314 | status = i2c_smbus_write_byte_data(&client, command, | ||
315 | gsb->bdata); | ||
316 | } | ||
317 | break; | ||
318 | |||
319 | case ACPI_GSB_ACCESS_ATTRIB_WORD: | ||
320 | if (action == ACPI_READ) { | ||
321 | status = i2c_smbus_read_word_data(&client, command); | ||
322 | if (status >= 0) { | ||
323 | gsb->wdata = status; | ||
324 | status = 0; | ||
325 | } | ||
326 | } else { | ||
327 | status = i2c_smbus_write_word_data(&client, command, | ||
328 | gsb->wdata); | ||
329 | } | ||
330 | break; | ||
331 | |||
332 | case ACPI_GSB_ACCESS_ATTRIB_BLOCK: | ||
333 | if (action == ACPI_READ) { | ||
334 | status = i2c_smbus_read_block_data(&client, command, | ||
335 | gsb->data); | ||
336 | if (status >= 0) { | ||
337 | gsb->len = status; | ||
338 | status = 0; | ||
339 | } | ||
340 | } else { | ||
341 | status = i2c_smbus_write_block_data(&client, command, | ||
342 | gsb->len, gsb->data); | ||
343 | } | ||
344 | break; | ||
345 | |||
346 | case ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE: | ||
347 | if (action == ACPI_READ) { | ||
348 | status = acpi_gsb_i2c_read_bytes(&client, command, | ||
349 | gsb->data, info->access_length); | ||
350 | if (status > 0) | ||
351 | status = 0; | ||
352 | } else { | ||
353 | status = acpi_gsb_i2c_write_bytes(&client, command, | ||
354 | gsb->data, info->access_length); | ||
355 | } | ||
356 | break; | ||
357 | |||
358 | default: | ||
359 | pr_info("protocol(0x%02x) is not supported.\n", accessor_type); | ||
360 | ret = AE_BAD_PARAMETER; | ||
361 | goto err; | ||
362 | } | ||
363 | |||
364 | gsb->status = status; | ||
365 | |||
366 | err: | ||
367 | ACPI_FREE(ares); | ||
368 | return ret; | ||
369 | } | ||
370 | |||
371 | |||
372 | static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
373 | { | ||
374 | acpi_handle handle; | ||
375 | struct acpi_i2c_handler_data *data; | ||
376 | acpi_status status; | ||
377 | |||
378 | if (!adapter->dev.parent) | ||
379 | return -ENODEV; | ||
380 | |||
381 | handle = ACPI_HANDLE(adapter->dev.parent); | ||
382 | |||
383 | if (!handle) | ||
384 | return -ENODEV; | ||
385 | |||
386 | data = kzalloc(sizeof(struct acpi_i2c_handler_data), | ||
387 | GFP_KERNEL); | ||
388 | if (!data) | ||
389 | return -ENOMEM; | ||
390 | |||
391 | data->adapter = adapter; | ||
392 | status = acpi_bus_attach_private_data(handle, (void *)data); | ||
393 | if (ACPI_FAILURE(status)) { | ||
394 | kfree(data); | ||
395 | return -ENOMEM; | ||
396 | } | ||
397 | |||
398 | status = acpi_install_address_space_handler(handle, | ||
399 | ACPI_ADR_SPACE_GSBUS, | ||
400 | &acpi_i2c_space_handler, | ||
401 | NULL, | ||
402 | data); | ||
403 | if (ACPI_FAILURE(status)) { | ||
404 | dev_err(&adapter->dev, "Error installing i2c space handler\n"); | ||
405 | acpi_bus_detach_private_data(handle); | ||
406 | kfree(data); | ||
407 | return -ENOMEM; | ||
408 | } | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
414 | { | ||
415 | acpi_handle handle; | ||
416 | struct acpi_i2c_handler_data *data; | ||
417 | acpi_status status; | ||
418 | |||
419 | if (!adapter->dev.parent) | ||
420 | return; | ||
421 | |||
422 | handle = ACPI_HANDLE(adapter->dev.parent); | ||
423 | |||
424 | if (!handle) | ||
425 | return; | ||
426 | |||
427 | acpi_remove_address_space_handler(handle, | ||
428 | ACPI_ADR_SPACE_GSBUS, | ||
429 | &acpi_i2c_space_handler); | ||
430 | |||
431 | status = acpi_bus_get_private_data(handle, (void **)&data); | ||
432 | if (ACPI_SUCCESS(status)) | ||
433 | kfree(data); | ||
434 | |||
435 | acpi_bus_detach_private_data(handle); | ||
436 | } | ||
437 | #else /* CONFIG_ACPI_I2C_OPREGION */ | ||
438 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
439 | { } | ||
440 | |||
441 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
442 | { return 0; } | ||
443 | #endif /* CONFIG_ACPI_I2C_OPREGION */ | ||
444 | |||
81 | /* ------------------------------------------------------------------------- */ | 445 | /* ------------------------------------------------------------------------- */ |
82 | 446 | ||
83 | static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, | 447 | static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, |
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index a077cc86421b..19100fddd2ed 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c | |||
@@ -571,7 +571,7 @@ static int bma180_probe(struct i2c_client *client, | |||
571 | trig->ops = &bma180_trigger_ops; | 571 | trig->ops = &bma180_trigger_ops; |
572 | iio_trigger_set_drvdata(trig, indio_dev); | 572 | iio_trigger_set_drvdata(trig, indio_dev); |
573 | data->trig = trig; | 573 | data->trig = trig; |
574 | indio_dev->trig = trig; | 574 | indio_dev->trig = iio_trigger_get(trig); |
575 | 575 | ||
576 | ret = iio_trigger_register(trig); | 576 | ret = iio_trigger_register(trig); |
577 | if (ret) | 577 | if (ret) |
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index c55b81f7f970..d10bd0c97233 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c | |||
@@ -472,7 +472,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev) | |||
472 | goto error_free_irq; | 472 | goto error_free_irq; |
473 | 473 | ||
474 | /* select default trigger */ | 474 | /* select default trigger */ |
475 | indio_dev->trig = sigma_delta->trig; | 475 | indio_dev->trig = iio_trigger_get(sigma_delta->trig); |
476 | 476 | ||
477 | return 0; | 477 | return 0; |
478 | 478 | ||
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 772e869c280e..7eadaf16adc1 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -196,6 +196,7 @@ struct at91_adc_state { | |||
196 | bool done; | 196 | bool done; |
197 | int irq; | 197 | int irq; |
198 | u16 last_value; | 198 | u16 last_value; |
199 | int chnb; | ||
199 | struct mutex lock; | 200 | struct mutex lock; |
200 | u8 num_channels; | 201 | u8 num_channels; |
201 | void __iomem *reg_base; | 202 | void __iomem *reg_base; |
@@ -274,7 +275,7 @@ void handle_adc_eoc_trigger(int irq, struct iio_dev *idev) | |||
274 | disable_irq_nosync(irq); | 275 | disable_irq_nosync(irq); |
275 | iio_trigger_poll(idev->trig); | 276 | iio_trigger_poll(idev->trig); |
276 | } else { | 277 | } else { |
277 | st->last_value = at91_adc_readl(st, AT91_ADC_LCDR); | 278 | st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb)); |
278 | st->done = true; | 279 | st->done = true; |
279 | wake_up_interruptible(&st->wq_data_avail); | 280 | wake_up_interruptible(&st->wq_data_avail); |
280 | } | 281 | } |
@@ -351,7 +352,7 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private) | |||
351 | unsigned int reg; | 352 | unsigned int reg; |
352 | 353 | ||
353 | status &= at91_adc_readl(st, AT91_ADC_IMR); | 354 | status &= at91_adc_readl(st, AT91_ADC_IMR); |
354 | if (status & st->registers->drdy_mask) | 355 | if (status & GENMASK(st->num_channels - 1, 0)) |
355 | handle_adc_eoc_trigger(irq, idev); | 356 | handle_adc_eoc_trigger(irq, idev); |
356 | 357 | ||
357 | if (status & AT91RL_ADC_IER_PEN) { | 358 | if (status & AT91RL_ADC_IER_PEN) { |
@@ -418,7 +419,7 @@ static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private) | |||
418 | AT91_ADC_IER_YRDY | | 419 | AT91_ADC_IER_YRDY | |
419 | AT91_ADC_IER_PRDY; | 420 | AT91_ADC_IER_PRDY; |
420 | 421 | ||
421 | if (status & st->registers->drdy_mask) | 422 | if (status & GENMASK(st->num_channels - 1, 0)) |
422 | handle_adc_eoc_trigger(irq, idev); | 423 | handle_adc_eoc_trigger(irq, idev); |
423 | 424 | ||
424 | if (status & AT91_ADC_IER_PEN) { | 425 | if (status & AT91_ADC_IER_PEN) { |
@@ -689,9 +690,10 @@ static int at91_adc_read_raw(struct iio_dev *idev, | |||
689 | case IIO_CHAN_INFO_RAW: | 690 | case IIO_CHAN_INFO_RAW: |
690 | mutex_lock(&st->lock); | 691 | mutex_lock(&st->lock); |
691 | 692 | ||
693 | st->chnb = chan->channel; | ||
692 | at91_adc_writel(st, AT91_ADC_CHER, | 694 | at91_adc_writel(st, AT91_ADC_CHER, |
693 | AT91_ADC_CH(chan->channel)); | 695 | AT91_ADC_CH(chan->channel)); |
694 | at91_adc_writel(st, AT91_ADC_IER, st->registers->drdy_mask); | 696 | at91_adc_writel(st, AT91_ADC_IER, BIT(chan->channel)); |
695 | at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_START); | 697 | at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_START); |
696 | 698 | ||
697 | ret = wait_event_interruptible_timeout(st->wq_data_avail, | 699 | ret = wait_event_interruptible_timeout(st->wq_data_avail, |
@@ -708,7 +710,7 @@ static int at91_adc_read_raw(struct iio_dev *idev, | |||
708 | 710 | ||
709 | at91_adc_writel(st, AT91_ADC_CHDR, | 711 | at91_adc_writel(st, AT91_ADC_CHDR, |
710 | AT91_ADC_CH(chan->channel)); | 712 | AT91_ADC_CH(chan->channel)); |
711 | at91_adc_writel(st, AT91_ADC_IDR, st->registers->drdy_mask); | 713 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); |
712 | 714 | ||
713 | st->last_value = 0; | 715 | st->last_value = 0; |
714 | st->done = false; | 716 | st->done = false; |
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index fd2745c62943..626b39749767 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c | |||
@@ -1126,7 +1126,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np, | |||
1126 | chan->address = XADC_REG_VPVN; | 1126 | chan->address = XADC_REG_VPVN; |
1127 | } else { | 1127 | } else { |
1128 | chan->scan_index = 15 + reg; | 1128 | chan->scan_index = 15 + reg; |
1129 | chan->scan_index = XADC_REG_VAUX(reg - 1); | 1129 | chan->address = XADC_REG_VAUX(reg - 1); |
1130 | } | 1130 | } |
1131 | num_channels++; | 1131 | num_channels++; |
1132 | chan++; | 1132 | chan++; |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index a3109a6f4d86..92068cdbf8c7 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -122,7 +122,8 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, | |||
122 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); | 122 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); |
123 | goto error_free_trig; | 123 | goto error_free_trig; |
124 | } | 124 | } |
125 | indio_dev->trig = attrb->trigger = trig; | 125 | attrb->trigger = trig; |
126 | indio_dev->trig = iio_trigger_get(trig); | ||
126 | 127 | ||
127 | return ret; | 128 | return ret; |
128 | 129 | ||
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c index 8fc3a97eb266..8d8ca6f1e16a 100644 --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c | |||
@@ -49,7 +49,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
49 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); | 49 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); |
50 | goto iio_trigger_register_error; | 50 | goto iio_trigger_register_error; |
51 | } | 51 | } |
52 | indio_dev->trig = sdata->trig; | 52 | indio_dev->trig = iio_trigger_get(sdata->trig); |
53 | 53 | ||
54 | return 0; | 54 | return 0; |
55 | 55 | ||
diff --git a/drivers/iio/gyro/itg3200_buffer.c b/drivers/iio/gyro/itg3200_buffer.c index e3b3c5084070..eef50e91f17c 100644 --- a/drivers/iio/gyro/itg3200_buffer.c +++ b/drivers/iio/gyro/itg3200_buffer.c | |||
@@ -132,7 +132,7 @@ int itg3200_probe_trigger(struct iio_dev *indio_dev) | |||
132 | goto error_free_irq; | 132 | goto error_free_irq; |
133 | 133 | ||
134 | /* select default trigger */ | 134 | /* select default trigger */ |
135 | indio_dev->trig = st->trig; | 135 | indio_dev->trig = iio_trigger_get(st->trig); |
136 | 136 | ||
137 | return 0; | 137 | return 0; |
138 | 138 | ||
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c index 03b9372c1212..926fccea8de0 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | |||
@@ -135,7 +135,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) | |||
135 | ret = iio_trigger_register(st->trig); | 135 | ret = iio_trigger_register(st->trig); |
136 | if (ret) | 136 | if (ret) |
137 | goto error_free_irq; | 137 | goto error_free_irq; |
138 | indio_dev->trig = st->trig; | 138 | indio_dev->trig = iio_trigger_get(st->trig); |
139 | 139 | ||
140 | return 0; | 140 | return 0; |
141 | 141 | ||
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index c7497009d60a..f0846108d006 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -178,7 +178,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
178 | index = of_property_match_string(np, "io-channel-names", | 178 | index = of_property_match_string(np, "io-channel-names", |
179 | name); | 179 | name); |
180 | chan = of_iio_channel_get(np, index); | 180 | chan = of_iio_channel_get(np, index); |
181 | if (!IS_ERR(chan)) | 181 | if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER) |
182 | break; | 182 | break; |
183 | else if (name && index >= 0) { | 183 | else if (name && index >= 0) { |
184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", | 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", |
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index a4b64130ac2f..68cae86dbd29 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c | |||
@@ -42,7 +42,8 @@ | |||
42 | #define ST_MAGN_FS_AVL_5600MG 5600 | 42 | #define ST_MAGN_FS_AVL_5600MG 5600 |
43 | #define ST_MAGN_FS_AVL_8000MG 8000 | 43 | #define ST_MAGN_FS_AVL_8000MG 8000 |
44 | #define ST_MAGN_FS_AVL_8100MG 8100 | 44 | #define ST_MAGN_FS_AVL_8100MG 8100 |
45 | #define ST_MAGN_FS_AVL_10000MG 10000 | 45 | #define ST_MAGN_FS_AVL_12000MG 12000 |
46 | #define ST_MAGN_FS_AVL_16000MG 16000 | ||
46 | 47 | ||
47 | /* CUSTOM VALUES FOR SENSOR 1 */ | 48 | /* CUSTOM VALUES FOR SENSOR 1 */ |
48 | #define ST_MAGN_1_WAI_EXP 0x3c | 49 | #define ST_MAGN_1_WAI_EXP 0x3c |
@@ -69,20 +70,20 @@ | |||
69 | #define ST_MAGN_1_FS_AVL_4700_VAL 0x05 | 70 | #define ST_MAGN_1_FS_AVL_4700_VAL 0x05 |
70 | #define ST_MAGN_1_FS_AVL_5600_VAL 0x06 | 71 | #define ST_MAGN_1_FS_AVL_5600_VAL 0x06 |
71 | #define ST_MAGN_1_FS_AVL_8100_VAL 0x07 | 72 | #define ST_MAGN_1_FS_AVL_8100_VAL 0x07 |
72 | #define ST_MAGN_1_FS_AVL_1300_GAIN_XY 1100 | 73 | #define ST_MAGN_1_FS_AVL_1300_GAIN_XY 909 |
73 | #define ST_MAGN_1_FS_AVL_1900_GAIN_XY 855 | 74 | #define ST_MAGN_1_FS_AVL_1900_GAIN_XY 1169 |
74 | #define ST_MAGN_1_FS_AVL_2500_GAIN_XY 670 | 75 | #define ST_MAGN_1_FS_AVL_2500_GAIN_XY 1492 |
75 | #define ST_MAGN_1_FS_AVL_4000_GAIN_XY 450 | 76 | #define ST_MAGN_1_FS_AVL_4000_GAIN_XY 2222 |
76 | #define ST_MAGN_1_FS_AVL_4700_GAIN_XY 400 | 77 | #define ST_MAGN_1_FS_AVL_4700_GAIN_XY 2500 |
77 | #define ST_MAGN_1_FS_AVL_5600_GAIN_XY 330 | 78 | #define ST_MAGN_1_FS_AVL_5600_GAIN_XY 3030 |
78 | #define ST_MAGN_1_FS_AVL_8100_GAIN_XY 230 | 79 | #define ST_MAGN_1_FS_AVL_8100_GAIN_XY 4347 |
79 | #define ST_MAGN_1_FS_AVL_1300_GAIN_Z 980 | 80 | #define ST_MAGN_1_FS_AVL_1300_GAIN_Z 1020 |
80 | #define ST_MAGN_1_FS_AVL_1900_GAIN_Z 760 | 81 | #define ST_MAGN_1_FS_AVL_1900_GAIN_Z 1315 |
81 | #define ST_MAGN_1_FS_AVL_2500_GAIN_Z 600 | 82 | #define ST_MAGN_1_FS_AVL_2500_GAIN_Z 1666 |
82 | #define ST_MAGN_1_FS_AVL_4000_GAIN_Z 400 | 83 | #define ST_MAGN_1_FS_AVL_4000_GAIN_Z 2500 |
83 | #define ST_MAGN_1_FS_AVL_4700_GAIN_Z 355 | 84 | #define ST_MAGN_1_FS_AVL_4700_GAIN_Z 2816 |
84 | #define ST_MAGN_1_FS_AVL_5600_GAIN_Z 295 | 85 | #define ST_MAGN_1_FS_AVL_5600_GAIN_Z 3389 |
85 | #define ST_MAGN_1_FS_AVL_8100_GAIN_Z 205 | 86 | #define ST_MAGN_1_FS_AVL_8100_GAIN_Z 4878 |
86 | #define ST_MAGN_1_MULTIREAD_BIT false | 87 | #define ST_MAGN_1_MULTIREAD_BIT false |
87 | 88 | ||
88 | /* CUSTOM VALUES FOR SENSOR 2 */ | 89 | /* CUSTOM VALUES FOR SENSOR 2 */ |
@@ -105,10 +106,12 @@ | |||
105 | #define ST_MAGN_2_FS_MASK 0x60 | 106 | #define ST_MAGN_2_FS_MASK 0x60 |
106 | #define ST_MAGN_2_FS_AVL_4000_VAL 0x00 | 107 | #define ST_MAGN_2_FS_AVL_4000_VAL 0x00 |
107 | #define ST_MAGN_2_FS_AVL_8000_VAL 0x01 | 108 | #define ST_MAGN_2_FS_AVL_8000_VAL 0x01 |
108 | #define ST_MAGN_2_FS_AVL_10000_VAL 0x02 | 109 | #define ST_MAGN_2_FS_AVL_12000_VAL 0x02 |
109 | #define ST_MAGN_2_FS_AVL_4000_GAIN 430 | 110 | #define ST_MAGN_2_FS_AVL_16000_VAL 0x03 |
110 | #define ST_MAGN_2_FS_AVL_8000_GAIN 230 | 111 | #define ST_MAGN_2_FS_AVL_4000_GAIN 146 |
111 | #define ST_MAGN_2_FS_AVL_10000_GAIN 230 | 112 | #define ST_MAGN_2_FS_AVL_8000_GAIN 292 |
113 | #define ST_MAGN_2_FS_AVL_12000_GAIN 438 | ||
114 | #define ST_MAGN_2_FS_AVL_16000_GAIN 584 | ||
112 | #define ST_MAGN_2_MULTIREAD_BIT false | 115 | #define ST_MAGN_2_MULTIREAD_BIT false |
113 | #define ST_MAGN_2_OUT_X_L_ADDR 0x28 | 116 | #define ST_MAGN_2_OUT_X_L_ADDR 0x28 |
114 | #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a | 117 | #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a |
@@ -266,9 +269,14 @@ static const struct st_sensors st_magn_sensors[] = { | |||
266 | .gain = ST_MAGN_2_FS_AVL_8000_GAIN, | 269 | .gain = ST_MAGN_2_FS_AVL_8000_GAIN, |
267 | }, | 270 | }, |
268 | [2] = { | 271 | [2] = { |
269 | .num = ST_MAGN_FS_AVL_10000MG, | 272 | .num = ST_MAGN_FS_AVL_12000MG, |
270 | .value = ST_MAGN_2_FS_AVL_10000_VAL, | 273 | .value = ST_MAGN_2_FS_AVL_12000_VAL, |
271 | .gain = ST_MAGN_2_FS_AVL_10000_GAIN, | 274 | .gain = ST_MAGN_2_FS_AVL_12000_GAIN, |
275 | }, | ||
276 | [3] = { | ||
277 | .num = ST_MAGN_FS_AVL_16000MG, | ||
278 | .value = ST_MAGN_2_FS_AVL_16000_VAL, | ||
279 | .gain = ST_MAGN_2_FS_AVL_16000_GAIN, | ||
272 | }, | 280 | }, |
273 | }, | 281 | }, |
274 | }, | 282 | }, |
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index a3a2e9c1639b..df0c4f605a21 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -105,6 +105,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, | |||
105 | umem->length = size; | 105 | umem->length = size; |
106 | umem->offset = addr & ~PAGE_MASK; | 106 | umem->offset = addr & ~PAGE_MASK; |
107 | umem->page_size = PAGE_SIZE; | 107 | umem->page_size = PAGE_SIZE; |
108 | umem->pid = get_task_pid(current, PIDTYPE_PID); | ||
108 | /* | 109 | /* |
109 | * We ask for writable memory if any access flags other than | 110 | * We ask for writable memory if any access flags other than |
110 | * "remote read" are set. "Local write" and "remote write" | 111 | * "remote read" are set. "Local write" and "remote write" |
@@ -198,6 +199,7 @@ out: | |||
198 | if (ret < 0) { | 199 | if (ret < 0) { |
199 | if (need_release) | 200 | if (need_release) |
200 | __ib_umem_release(context->device, umem, 0); | 201 | __ib_umem_release(context->device, umem, 0); |
202 | put_pid(umem->pid); | ||
201 | kfree(umem); | 203 | kfree(umem); |
202 | } else | 204 | } else |
203 | current->mm->pinned_vm = locked; | 205 | current->mm->pinned_vm = locked; |
@@ -230,15 +232,19 @@ void ib_umem_release(struct ib_umem *umem) | |||
230 | { | 232 | { |
231 | struct ib_ucontext *context = umem->context; | 233 | struct ib_ucontext *context = umem->context; |
232 | struct mm_struct *mm; | 234 | struct mm_struct *mm; |
235 | struct task_struct *task; | ||
233 | unsigned long diff; | 236 | unsigned long diff; |
234 | 237 | ||
235 | __ib_umem_release(umem->context->device, umem, 1); | 238 | __ib_umem_release(umem->context->device, umem, 1); |
236 | 239 | ||
237 | mm = get_task_mm(current); | 240 | task = get_pid_task(umem->pid, PIDTYPE_PID); |
238 | if (!mm) { | 241 | put_pid(umem->pid); |
239 | kfree(umem); | 242 | if (!task) |
240 | return; | 243 | goto out; |
241 | } | 244 | mm = get_task_mm(task); |
245 | put_task_struct(task); | ||
246 | if (!mm) | ||
247 | goto out; | ||
242 | 248 | ||
243 | diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT; | 249 | diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT; |
244 | 250 | ||
@@ -262,9 +268,10 @@ void ib_umem_release(struct ib_umem *umem) | |||
262 | } else | 268 | } else |
263 | down_write(&mm->mmap_sem); | 269 | down_write(&mm->mmap_sem); |
264 | 270 | ||
265 | current->mm->pinned_vm -= diff; | 271 | mm->pinned_vm -= diff; |
266 | up_write(&mm->mmap_sem); | 272 | up_write(&mm->mmap_sem); |
267 | mmput(mm); | 273 | mmput(mm); |
274 | out: | ||
268 | kfree(umem); | 275 | kfree(umem); |
269 | } | 276 | } |
270 | EXPORT_SYMBOL(ib_umem_release); | 277 | EXPORT_SYMBOL(ib_umem_release); |
diff --git a/drivers/infiniband/core/uverbs_marshall.c b/drivers/infiniband/core/uverbs_marshall.c index e7bee46868d1..abd97247443e 100644 --- a/drivers/infiniband/core/uverbs_marshall.c +++ b/drivers/infiniband/core/uverbs_marshall.c | |||
@@ -140,5 +140,9 @@ void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst, | |||
140 | dst->packet_life_time = src->packet_life_time; | 140 | dst->packet_life_time = src->packet_life_time; |
141 | dst->preference = src->preference; | 141 | dst->preference = src->preference; |
142 | dst->packet_life_time_selector = src->packet_life_time_selector; | 142 | dst->packet_life_time_selector = src->packet_life_time_selector; |
143 | |||
144 | memset(dst->smac, 0, sizeof(dst->smac)); | ||
145 | memset(dst->dmac, 0, sizeof(dst->dmac)); | ||
146 | dst->vlan_id = 0xffff; | ||
143 | } | 147 | } |
144 | EXPORT_SYMBOL(ib_copy_path_rec_from_user); | 148 | EXPORT_SYMBOL(ib_copy_path_rec_from_user); |
diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c index dc66c4506916..1da1252dcdb3 100644 --- a/drivers/infiniband/hw/ipath/ipath_user_pages.c +++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c | |||
@@ -54,7 +54,7 @@ static void __ipath_release_user_pages(struct page **p, size_t num_pages, | |||
54 | 54 | ||
55 | /* call with current->mm->mmap_sem held */ | 55 | /* call with current->mm->mmap_sem held */ |
56 | static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, | 56 | static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, |
57 | struct page **p, struct vm_area_struct **vma) | 57 | struct page **p) |
58 | { | 58 | { |
59 | unsigned long lock_limit; | 59 | unsigned long lock_limit; |
60 | size_t got; | 60 | size_t got; |
@@ -74,7 +74,7 @@ static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, | |||
74 | ret = get_user_pages(current, current->mm, | 74 | ret = get_user_pages(current, current->mm, |
75 | start_page + got * PAGE_SIZE, | 75 | start_page + got * PAGE_SIZE, |
76 | num_pages - got, 1, 1, | 76 | num_pages - got, 1, 1, |
77 | p + got, vma); | 77 | p + got, NULL); |
78 | if (ret < 0) | 78 | if (ret < 0) |
79 | goto bail_release; | 79 | goto bail_release; |
80 | } | 80 | } |
@@ -165,7 +165,7 @@ int ipath_get_user_pages(unsigned long start_page, size_t num_pages, | |||
165 | 165 | ||
166 | down_write(¤t->mm->mmap_sem); | 166 | down_write(¤t->mm->mmap_sem); |
167 | 167 | ||
168 | ret = __ipath_get_user_pages(start_page, num_pages, p, NULL); | 168 | ret = __ipath_get_user_pages(start_page, num_pages, p); |
169 | 169 | ||
170 | up_write(¤t->mm->mmap_sem); | 170 | up_write(¤t->mm->mmap_sem); |
171 | 171 | ||
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index e1e558a3d692..bda5994ceb68 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -59,6 +59,7 @@ | |||
59 | 59 | ||
60 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF | 60 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF |
61 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF | 61 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF |
62 | #define MLX4_IB_CARD_REV_A0 0xA0 | ||
62 | 63 | ||
63 | MODULE_AUTHOR("Roland Dreier"); | 64 | MODULE_AUTHOR("Roland Dreier"); |
64 | MODULE_DESCRIPTION("Mellanox ConnectX HCA InfiniBand driver"); | 65 | MODULE_DESCRIPTION("Mellanox ConnectX HCA InfiniBand driver"); |
@@ -119,6 +120,17 @@ static int check_flow_steering_support(struct mlx4_dev *dev) | |||
119 | return dmfs; | 120 | return dmfs; |
120 | } | 121 | } |
121 | 122 | ||
123 | static int num_ib_ports(struct mlx4_dev *dev) | ||
124 | { | ||
125 | int ib_ports = 0; | ||
126 | int i; | ||
127 | |||
128 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
129 | ib_ports++; | ||
130 | |||
131 | return ib_ports; | ||
132 | } | ||
133 | |||
122 | static int mlx4_ib_query_device(struct ib_device *ibdev, | 134 | static int mlx4_ib_query_device(struct ib_device *ibdev, |
123 | struct ib_device_attr *props) | 135 | struct ib_device_attr *props) |
124 | { | 136 | { |
@@ -126,6 +138,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
126 | struct ib_smp *in_mad = NULL; | 138 | struct ib_smp *in_mad = NULL; |
127 | struct ib_smp *out_mad = NULL; | 139 | struct ib_smp *out_mad = NULL; |
128 | int err = -ENOMEM; | 140 | int err = -ENOMEM; |
141 | int have_ib_ports; | ||
129 | 142 | ||
130 | in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); | 143 | in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); |
131 | out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); | 144 | out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); |
@@ -142,6 +155,8 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
142 | 155 | ||
143 | memset(props, 0, sizeof *props); | 156 | memset(props, 0, sizeof *props); |
144 | 157 | ||
158 | have_ib_ports = num_ib_ports(dev->dev); | ||
159 | |||
145 | props->fw_ver = dev->dev->caps.fw_ver; | 160 | props->fw_ver = dev->dev->caps.fw_ver; |
146 | props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | | 161 | props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | |
147 | IB_DEVICE_PORT_ACTIVE_EVENT | | 162 | IB_DEVICE_PORT_ACTIVE_EVENT | |
@@ -152,13 +167,15 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
152 | props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; | 167 | props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; |
153 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR) | 168 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR) |
154 | props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR; | 169 | props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR; |
155 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM) | 170 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM && have_ib_ports) |
156 | props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG; | 171 | props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG; |
157 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT) | 172 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT) |
158 | props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE; | 173 | props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE; |
159 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_IPOIB_CSUM) | 174 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_IPOIB_CSUM) |
160 | props->device_cap_flags |= IB_DEVICE_UD_IP_CSUM; | 175 | props->device_cap_flags |= IB_DEVICE_UD_IP_CSUM; |
161 | if (dev->dev->caps.max_gso_sz && dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BLH) | 176 | if (dev->dev->caps.max_gso_sz && |
177 | (dev->dev->rev_id != MLX4_IB_CARD_REV_A0) && | ||
178 | (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BLH)) | ||
162 | props->device_cap_flags |= IB_DEVICE_UD_TSO; | 179 | props->device_cap_flags |= IB_DEVICE_UD_TSO; |
163 | if (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_RESERVED_LKEY) | 180 | if (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_RESERVED_LKEY) |
164 | props->device_cap_flags |= IB_DEVICE_LOCAL_DMA_LKEY; | 181 | props->device_cap_flags |= IB_DEVICE_LOCAL_DMA_LKEY; |
@@ -357,7 +374,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, | |||
357 | props->state = IB_PORT_DOWN; | 374 | props->state = IB_PORT_DOWN; |
358 | props->phys_state = state_to_phys_state(props->state); | 375 | props->phys_state = state_to_phys_state(props->state); |
359 | props->active_mtu = IB_MTU_256; | 376 | props->active_mtu = IB_MTU_256; |
360 | spin_lock(&iboe->lock); | 377 | spin_lock_bh(&iboe->lock); |
361 | ndev = iboe->netdevs[port - 1]; | 378 | ndev = iboe->netdevs[port - 1]; |
362 | if (!ndev) | 379 | if (!ndev) |
363 | goto out_unlock; | 380 | goto out_unlock; |
@@ -369,7 +386,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, | |||
369 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 386 | IB_PORT_ACTIVE : IB_PORT_DOWN; |
370 | props->phys_state = state_to_phys_state(props->state); | 387 | props->phys_state = state_to_phys_state(props->state); |
371 | out_unlock: | 388 | out_unlock: |
372 | spin_unlock(&iboe->lock); | 389 | spin_unlock_bh(&iboe->lock); |
373 | out: | 390 | out: |
374 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); | 391 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); |
375 | return err; | 392 | return err; |
@@ -811,11 +828,11 @@ int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp, | |||
811 | if (!mqp->port) | 828 | if (!mqp->port) |
812 | return 0; | 829 | return 0; |
813 | 830 | ||
814 | spin_lock(&mdev->iboe.lock); | 831 | spin_lock_bh(&mdev->iboe.lock); |
815 | ndev = mdev->iboe.netdevs[mqp->port - 1]; | 832 | ndev = mdev->iboe.netdevs[mqp->port - 1]; |
816 | if (ndev) | 833 | if (ndev) |
817 | dev_hold(ndev); | 834 | dev_hold(ndev); |
818 | spin_unlock(&mdev->iboe.lock); | 835 | spin_unlock_bh(&mdev->iboe.lock); |
819 | 836 | ||
820 | if (ndev) { | 837 | if (ndev) { |
821 | ret = 1; | 838 | ret = 1; |
@@ -1089,6 +1106,30 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id) | |||
1089 | return err; | 1106 | return err; |
1090 | } | 1107 | } |
1091 | 1108 | ||
1109 | static int mlx4_ib_tunnel_steer_add(struct ib_qp *qp, struct ib_flow_attr *flow_attr, | ||
1110 | u64 *reg_id) | ||
1111 | { | ||
1112 | void *ib_flow; | ||
1113 | union ib_flow_spec *ib_spec; | ||
1114 | struct mlx4_dev *dev = to_mdev(qp->device)->dev; | ||
1115 | int err = 0; | ||
1116 | |||
1117 | if (dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | ||
1118 | return 0; /* do nothing */ | ||
1119 | |||
1120 | ib_flow = flow_attr + 1; | ||
1121 | ib_spec = (union ib_flow_spec *)ib_flow; | ||
1122 | |||
1123 | if (ib_spec->type != IB_FLOW_SPEC_ETH || flow_attr->num_of_specs != 1) | ||
1124 | return 0; /* do nothing */ | ||
1125 | |||
1126 | err = mlx4_tunnel_steer_add(to_mdev(qp->device)->dev, ib_spec->eth.val.dst_mac, | ||
1127 | flow_attr->port, qp->qp_num, | ||
1128 | MLX4_DOMAIN_UVERBS | (flow_attr->priority & 0xff), | ||
1129 | reg_id); | ||
1130 | return err; | ||
1131 | } | ||
1132 | |||
1092 | static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, | 1133 | static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, |
1093 | struct ib_flow_attr *flow_attr, | 1134 | struct ib_flow_attr *flow_attr, |
1094 | int domain) | 1135 | int domain) |
@@ -1136,6 +1177,12 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, | |||
1136 | i++; | 1177 | i++; |
1137 | } | 1178 | } |
1138 | 1179 | ||
1180 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { | ||
1181 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); | ||
1182 | if (err) | ||
1183 | goto err_free; | ||
1184 | } | ||
1185 | |||
1139 | return &mflow->ibflow; | 1186 | return &mflow->ibflow; |
1140 | 1187 | ||
1141 | err_free: | 1188 | err_free: |
@@ -1262,11 +1309,11 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
1262 | mutex_lock(&mqp->mutex); | 1309 | mutex_lock(&mqp->mutex); |
1263 | ge = find_gid_entry(mqp, gid->raw); | 1310 | ge = find_gid_entry(mqp, gid->raw); |
1264 | if (ge) { | 1311 | if (ge) { |
1265 | spin_lock(&mdev->iboe.lock); | 1312 | spin_lock_bh(&mdev->iboe.lock); |
1266 | ndev = ge->added ? mdev->iboe.netdevs[ge->port - 1] : NULL; | 1313 | ndev = ge->added ? mdev->iboe.netdevs[ge->port - 1] : NULL; |
1267 | if (ndev) | 1314 | if (ndev) |
1268 | dev_hold(ndev); | 1315 | dev_hold(ndev); |
1269 | spin_unlock(&mdev->iboe.lock); | 1316 | spin_unlock_bh(&mdev->iboe.lock); |
1270 | if (ndev) | 1317 | if (ndev) |
1271 | dev_put(ndev); | 1318 | dev_put(ndev); |
1272 | list_del(&ge->list); | 1319 | list_del(&ge->list); |
@@ -1387,6 +1434,9 @@ static void update_gids_task(struct work_struct *work) | |||
1387 | int err; | 1434 | int err; |
1388 | struct mlx4_dev *dev = gw->dev->dev; | 1435 | struct mlx4_dev *dev = gw->dev->dev; |
1389 | 1436 | ||
1437 | if (!gw->dev->ib_active) | ||
1438 | return; | ||
1439 | |||
1390 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 1440 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
1391 | if (IS_ERR(mailbox)) { | 1441 | if (IS_ERR(mailbox)) { |
1392 | pr_warn("update gid table failed %ld\n", PTR_ERR(mailbox)); | 1442 | pr_warn("update gid table failed %ld\n", PTR_ERR(mailbox)); |
@@ -1417,6 +1467,9 @@ static void reset_gids_task(struct work_struct *work) | |||
1417 | int err; | 1467 | int err; |
1418 | struct mlx4_dev *dev = gw->dev->dev; | 1468 | struct mlx4_dev *dev = gw->dev->dev; |
1419 | 1469 | ||
1470 | if (!gw->dev->ib_active) | ||
1471 | return; | ||
1472 | |||
1420 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 1473 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
1421 | if (IS_ERR(mailbox)) { | 1474 | if (IS_ERR(mailbox)) { |
1422 | pr_warn("reset gid table failed\n"); | 1475 | pr_warn("reset gid table failed\n"); |
@@ -1551,7 +1604,7 @@ static int mlx4_ib_addr_event(int event, struct net_device *event_netdev, | |||
1551 | return 0; | 1604 | return 0; |
1552 | 1605 | ||
1553 | iboe = &ibdev->iboe; | 1606 | iboe = &ibdev->iboe; |
1554 | spin_lock(&iboe->lock); | 1607 | spin_lock_bh(&iboe->lock); |
1555 | 1608 | ||
1556 | for (port = 1; port <= ibdev->dev->caps.num_ports; ++port) | 1609 | for (port = 1; port <= ibdev->dev->caps.num_ports; ++port) |
1557 | if ((netif_is_bond_master(real_dev) && | 1610 | if ((netif_is_bond_master(real_dev) && |
@@ -1561,7 +1614,7 @@ static int mlx4_ib_addr_event(int event, struct net_device *event_netdev, | |||
1561 | update_gid_table(ibdev, port, gid, | 1614 | update_gid_table(ibdev, port, gid, |
1562 | event == NETDEV_DOWN, 0); | 1615 | event == NETDEV_DOWN, 0); |
1563 | 1616 | ||
1564 | spin_unlock(&iboe->lock); | 1617 | spin_unlock_bh(&iboe->lock); |
1565 | return 0; | 1618 | return 0; |
1566 | 1619 | ||
1567 | } | 1620 | } |
@@ -1634,13 +1687,21 @@ static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev, | |||
1634 | new_smac = mlx4_mac_to_u64(dev->dev_addr); | 1687 | new_smac = mlx4_mac_to_u64(dev->dev_addr); |
1635 | read_unlock(&dev_base_lock); | 1688 | read_unlock(&dev_base_lock); |
1636 | 1689 | ||
1690 | atomic64_set(&ibdev->iboe.mac[port - 1], new_smac); | ||
1691 | |||
1692 | /* no need for update QP1 and mac registration in non-SRIOV */ | ||
1693 | if (!mlx4_is_mfunc(ibdev->dev)) | ||
1694 | return; | ||
1695 | |||
1637 | mutex_lock(&ibdev->qp1_proxy_lock[port - 1]); | 1696 | mutex_lock(&ibdev->qp1_proxy_lock[port - 1]); |
1638 | qp = ibdev->qp1_proxy[port - 1]; | 1697 | qp = ibdev->qp1_proxy[port - 1]; |
1639 | if (qp) { | 1698 | if (qp) { |
1640 | int new_smac_index; | 1699 | int new_smac_index; |
1641 | u64 old_smac = qp->pri.smac; | 1700 | u64 old_smac; |
1642 | struct mlx4_update_qp_params update_params; | 1701 | struct mlx4_update_qp_params update_params; |
1643 | 1702 | ||
1703 | mutex_lock(&qp->mutex); | ||
1704 | old_smac = qp->pri.smac; | ||
1644 | if (new_smac == old_smac) | 1705 | if (new_smac == old_smac) |
1645 | goto unlock; | 1706 | goto unlock; |
1646 | 1707 | ||
@@ -1650,22 +1711,25 @@ static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev, | |||
1650 | goto unlock; | 1711 | goto unlock; |
1651 | 1712 | ||
1652 | update_params.smac_index = new_smac_index; | 1713 | update_params.smac_index = new_smac_index; |
1653 | if (mlx4_update_qp(ibdev->dev, &qp->mqp, MLX4_UPDATE_QP_SMAC, | 1714 | if (mlx4_update_qp(ibdev->dev, qp->mqp.qpn, MLX4_UPDATE_QP_SMAC, |
1654 | &update_params)) { | 1715 | &update_params)) { |
1655 | release_mac = new_smac; | 1716 | release_mac = new_smac; |
1656 | goto unlock; | 1717 | goto unlock; |
1657 | } | 1718 | } |
1658 | 1719 | /* if old port was zero, no mac was yet registered for this QP */ | |
1720 | if (qp->pri.smac_port) | ||
1721 | release_mac = old_smac; | ||
1659 | qp->pri.smac = new_smac; | 1722 | qp->pri.smac = new_smac; |
1723 | qp->pri.smac_port = port; | ||
1660 | qp->pri.smac_index = new_smac_index; | 1724 | qp->pri.smac_index = new_smac_index; |
1661 | |||
1662 | release_mac = old_smac; | ||
1663 | } | 1725 | } |
1664 | 1726 | ||
1665 | unlock: | 1727 | unlock: |
1666 | mutex_unlock(&ibdev->qp1_proxy_lock[port - 1]); | ||
1667 | if (release_mac != MLX4_IB_INVALID_MAC) | 1728 | if (release_mac != MLX4_IB_INVALID_MAC) |
1668 | mlx4_unregister_mac(ibdev->dev, port, release_mac); | 1729 | mlx4_unregister_mac(ibdev->dev, port, release_mac); |
1730 | if (qp) | ||
1731 | mutex_unlock(&qp->mutex); | ||
1732 | mutex_unlock(&ibdev->qp1_proxy_lock[port - 1]); | ||
1669 | } | 1733 | } |
1670 | 1734 | ||
1671 | static void mlx4_ib_get_dev_addr(struct net_device *dev, | 1735 | static void mlx4_ib_get_dev_addr(struct net_device *dev, |
@@ -1676,6 +1740,7 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev, | |||
1676 | struct inet6_dev *in6_dev; | 1740 | struct inet6_dev *in6_dev; |
1677 | union ib_gid *pgid; | 1741 | union ib_gid *pgid; |
1678 | struct inet6_ifaddr *ifp; | 1742 | struct inet6_ifaddr *ifp; |
1743 | union ib_gid default_gid; | ||
1679 | #endif | 1744 | #endif |
1680 | union ib_gid gid; | 1745 | union ib_gid gid; |
1681 | 1746 | ||
@@ -1696,12 +1761,15 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev, | |||
1696 | in_dev_put(in_dev); | 1761 | in_dev_put(in_dev); |
1697 | } | 1762 | } |
1698 | #if IS_ENABLED(CONFIG_IPV6) | 1763 | #if IS_ENABLED(CONFIG_IPV6) |
1764 | mlx4_make_default_gid(dev, &default_gid); | ||
1699 | /* IPv6 gids */ | 1765 | /* IPv6 gids */ |
1700 | in6_dev = in6_dev_get(dev); | 1766 | in6_dev = in6_dev_get(dev); |
1701 | if (in6_dev) { | 1767 | if (in6_dev) { |
1702 | read_lock_bh(&in6_dev->lock); | 1768 | read_lock_bh(&in6_dev->lock); |
1703 | list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { | 1769 | list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { |
1704 | pgid = (union ib_gid *)&ifp->addr; | 1770 | pgid = (union ib_gid *)&ifp->addr; |
1771 | if (!memcmp(pgid, &default_gid, sizeof(*pgid))) | ||
1772 | continue; | ||
1705 | update_gid_table(ibdev, port, pgid, 0, 0); | 1773 | update_gid_table(ibdev, port, pgid, 0, 0); |
1706 | } | 1774 | } |
1707 | read_unlock_bh(&in6_dev->lock); | 1775 | read_unlock_bh(&in6_dev->lock); |
@@ -1723,24 +1791,33 @@ static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev) | |||
1723 | struct net_device *dev; | 1791 | struct net_device *dev; |
1724 | struct mlx4_ib_iboe *iboe = &ibdev->iboe; | 1792 | struct mlx4_ib_iboe *iboe = &ibdev->iboe; |
1725 | int i; | 1793 | int i; |
1794 | int err = 0; | ||
1726 | 1795 | ||
1727 | for (i = 1; i <= ibdev->num_ports; ++i) | 1796 | for (i = 1; i <= ibdev->num_ports; ++i) { |
1728 | if (reset_gid_table(ibdev, i)) | 1797 | if (rdma_port_get_link_layer(&ibdev->ib_dev, i) == |
1729 | return -1; | 1798 | IB_LINK_LAYER_ETHERNET) { |
1799 | err = reset_gid_table(ibdev, i); | ||
1800 | if (err) | ||
1801 | goto out; | ||
1802 | } | ||
1803 | } | ||
1730 | 1804 | ||
1731 | read_lock(&dev_base_lock); | 1805 | read_lock(&dev_base_lock); |
1732 | spin_lock(&iboe->lock); | 1806 | spin_lock_bh(&iboe->lock); |
1733 | 1807 | ||
1734 | for_each_netdev(&init_net, dev) { | 1808 | for_each_netdev(&init_net, dev) { |
1735 | u8 port = mlx4_ib_get_dev_port(dev, ibdev); | 1809 | u8 port = mlx4_ib_get_dev_port(dev, ibdev); |
1736 | if (port) | 1810 | /* port will be non-zero only for ETH ports */ |
1811 | if (port) { | ||
1812 | mlx4_ib_set_default_gid(ibdev, dev, port); | ||
1737 | mlx4_ib_get_dev_addr(dev, ibdev, port); | 1813 | mlx4_ib_get_dev_addr(dev, ibdev, port); |
1814 | } | ||
1738 | } | 1815 | } |
1739 | 1816 | ||
1740 | spin_unlock(&iboe->lock); | 1817 | spin_unlock_bh(&iboe->lock); |
1741 | read_unlock(&dev_base_lock); | 1818 | read_unlock(&dev_base_lock); |
1742 | 1819 | out: | |
1743 | return 0; | 1820 | return err; |
1744 | } | 1821 | } |
1745 | 1822 | ||
1746 | static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, | 1823 | static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, |
@@ -1754,7 +1831,7 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, | |||
1754 | 1831 | ||
1755 | iboe = &ibdev->iboe; | 1832 | iboe = &ibdev->iboe; |
1756 | 1833 | ||
1757 | spin_lock(&iboe->lock); | 1834 | spin_lock_bh(&iboe->lock); |
1758 | mlx4_foreach_ib_transport_port(port, ibdev->dev) { | 1835 | mlx4_foreach_ib_transport_port(port, ibdev->dev) { |
1759 | enum ib_port_state port_state = IB_PORT_NOP; | 1836 | enum ib_port_state port_state = IB_PORT_NOP; |
1760 | struct net_device *old_master = iboe->masters[port - 1]; | 1837 | struct net_device *old_master = iboe->masters[port - 1]; |
@@ -1786,35 +1863,47 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, | |||
1786 | port_state = (netif_running(curr_netdev) && netif_carrier_ok(curr_netdev)) ? | 1863 | port_state = (netif_running(curr_netdev) && netif_carrier_ok(curr_netdev)) ? |
1787 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 1864 | IB_PORT_ACTIVE : IB_PORT_DOWN; |
1788 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | 1865 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); |
1789 | } else { | 1866 | if (curr_master) { |
1790 | reset_gid_table(ibdev, port); | 1867 | /* if using bonding/team and a slave port is down, we |
1791 | } | 1868 | * don't want the bond IP based gids in the table since |
1792 | /* if using bonding/team and a slave port is down, we don't the bond IP | 1869 | * flows that select port by gid may get the down port. |
1793 | * based gids in the table since flows that select port by gid may get | 1870 | */ |
1794 | * the down port. | 1871 | if (port_state == IB_PORT_DOWN) { |
1795 | */ | 1872 | reset_gid_table(ibdev, port); |
1796 | if (curr_master && (port_state == IB_PORT_DOWN)) { | 1873 | mlx4_ib_set_default_gid(ibdev, |
1797 | reset_gid_table(ibdev, port); | 1874 | curr_netdev, |
1798 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | 1875 | port); |
1799 | } | 1876 | } else { |
1800 | /* if bonding is used it is possible that we add it to masters | 1877 | /* gids from the upper dev (bond/team) |
1801 | * only after IP address is assigned to the net bonding | 1878 | * should appear in port's gid table |
1802 | * interface. | 1879 | */ |
1803 | */ | 1880 | mlx4_ib_get_dev_addr(curr_master, |
1804 | if (curr_master && (old_master != curr_master)) { | 1881 | ibdev, port); |
1805 | reset_gid_table(ibdev, port); | 1882 | } |
1806 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | 1883 | } |
1807 | mlx4_ib_get_dev_addr(curr_master, ibdev, port); | 1884 | /* if bonding is used it is possible that we add it to |
1808 | } | 1885 | * masters only after IP address is assigned to the |
1886 | * net bonding interface. | ||
1887 | */ | ||
1888 | if (curr_master && (old_master != curr_master)) { | ||
1889 | reset_gid_table(ibdev, port); | ||
1890 | mlx4_ib_set_default_gid(ibdev, | ||
1891 | curr_netdev, port); | ||
1892 | mlx4_ib_get_dev_addr(curr_master, ibdev, port); | ||
1893 | } | ||
1809 | 1894 | ||
1810 | if (!curr_master && (old_master != curr_master)) { | 1895 | if (!curr_master && (old_master != curr_master)) { |
1896 | reset_gid_table(ibdev, port); | ||
1897 | mlx4_ib_set_default_gid(ibdev, | ||
1898 | curr_netdev, port); | ||
1899 | mlx4_ib_get_dev_addr(curr_netdev, ibdev, port); | ||
1900 | } | ||
1901 | } else { | ||
1811 | reset_gid_table(ibdev, port); | 1902 | reset_gid_table(ibdev, port); |
1812 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | ||
1813 | mlx4_ib_get_dev_addr(curr_netdev, ibdev, port); | ||
1814 | } | 1903 | } |
1815 | } | 1904 | } |
1816 | 1905 | ||
1817 | spin_unlock(&iboe->lock); | 1906 | spin_unlock_bh(&iboe->lock); |
1818 | 1907 | ||
1819 | if (update_qps_port > 0) | 1908 | if (update_qps_port > 0) |
1820 | mlx4_ib_update_qps(ibdev, dev, update_qps_port); | 1909 | mlx4_ib_update_qps(ibdev, dev, update_qps_port); |
@@ -2156,6 +2245,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
2156 | goto err_steer_free_bitmap; | 2245 | goto err_steer_free_bitmap; |
2157 | } | 2246 | } |
2158 | 2247 | ||
2248 | for (j = 1; j <= ibdev->dev->caps.num_ports; j++) | ||
2249 | atomic64_set(&iboe->mac[j - 1], ibdev->dev->caps.def_mac[j]); | ||
2250 | |||
2159 | if (ib_register_device(&ibdev->ib_dev, NULL)) | 2251 | if (ib_register_device(&ibdev->ib_dev, NULL)) |
2160 | goto err_steer_free_bitmap; | 2252 | goto err_steer_free_bitmap; |
2161 | 2253 | ||
@@ -2192,12 +2284,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
2192 | } | 2284 | } |
2193 | } | 2285 | } |
2194 | #endif | 2286 | #endif |
2195 | for (i = 1 ; i <= ibdev->num_ports ; ++i) | 2287 | if (mlx4_ib_init_gid_table(ibdev)) |
2196 | reset_gid_table(ibdev, i); | 2288 | goto err_notif; |
2197 | rtnl_lock(); | ||
2198 | mlx4_ib_scan_netdevs(ibdev, NULL, 0); | ||
2199 | rtnl_unlock(); | ||
2200 | mlx4_ib_init_gid_table(ibdev); | ||
2201 | } | 2289 | } |
2202 | 2290 | ||
2203 | for (j = 0; j < ARRAY_SIZE(mlx4_class_attributes); ++j) { | 2291 | for (j = 0; j < ARRAY_SIZE(mlx4_class_attributes); ++j) { |
@@ -2345,6 +2433,9 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) | |||
2345 | struct mlx4_ib_dev *ibdev = ibdev_ptr; | 2433 | struct mlx4_ib_dev *ibdev = ibdev_ptr; |
2346 | int p; | 2434 | int p; |
2347 | 2435 | ||
2436 | ibdev->ib_active = false; | ||
2437 | flush_workqueue(wq); | ||
2438 | |||
2348 | mlx4_ib_close_sriov(ibdev); | 2439 | mlx4_ib_close_sriov(ibdev); |
2349 | mlx4_ib_mad_cleanup(ibdev); | 2440 | mlx4_ib_mad_cleanup(ibdev); |
2350 | ib_unregister_device(&ibdev->ib_dev); | 2441 | ib_unregister_device(&ibdev->ib_dev); |
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index e8cad3926bfc..6eb743f65f6f 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
@@ -451,6 +451,7 @@ struct mlx4_ib_iboe { | |||
451 | spinlock_t lock; | 451 | spinlock_t lock; |
452 | struct net_device *netdevs[MLX4_MAX_PORTS]; | 452 | struct net_device *netdevs[MLX4_MAX_PORTS]; |
453 | struct net_device *masters[MLX4_MAX_PORTS]; | 453 | struct net_device *masters[MLX4_MAX_PORTS]; |
454 | atomic64_t mac[MLX4_MAX_PORTS]; | ||
454 | struct notifier_block nb; | 455 | struct notifier_block nb; |
455 | struct notifier_block nb_inet; | 456 | struct notifier_block nb_inet; |
456 | struct notifier_block nb_inet6; | 457 | struct notifier_block nb_inet6; |
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index 9b0e80e59b08..8f9325cfc85d 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c | |||
@@ -234,14 +234,13 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, | |||
234 | 0); | 234 | 0); |
235 | if (IS_ERR(mmr->umem)) { | 235 | if (IS_ERR(mmr->umem)) { |
236 | err = PTR_ERR(mmr->umem); | 236 | err = PTR_ERR(mmr->umem); |
237 | /* Prevent mlx4_ib_dereg_mr from free'ing invalid pointer */ | ||
237 | mmr->umem = NULL; | 238 | mmr->umem = NULL; |
238 | goto release_mpt_entry; | 239 | goto release_mpt_entry; |
239 | } | 240 | } |
240 | n = ib_umem_page_count(mmr->umem); | 241 | n = ib_umem_page_count(mmr->umem); |
241 | shift = ilog2(mmr->umem->page_size); | 242 | shift = ilog2(mmr->umem->page_size); |
242 | 243 | ||
243 | mmr->mmr.iova = virt_addr; | ||
244 | mmr->mmr.size = length; | ||
245 | err = mlx4_mr_rereg_mem_write(dev->dev, &mmr->mmr, | 244 | err = mlx4_mr_rereg_mem_write(dev->dev, &mmr->mmr, |
246 | virt_addr, length, n, shift, | 245 | virt_addr, length, n, shift, |
247 | *pmpt_entry); | 246 | *pmpt_entry); |
@@ -249,6 +248,8 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, | |||
249 | ib_umem_release(mmr->umem); | 248 | ib_umem_release(mmr->umem); |
250 | goto release_mpt_entry; | 249 | goto release_mpt_entry; |
251 | } | 250 | } |
251 | mmr->mmr.iova = virt_addr; | ||
252 | mmr->mmr.size = length; | ||
252 | 253 | ||
253 | err = mlx4_ib_umem_write_mtt(dev, &mmr->mmr.mtt, mmr->umem); | 254 | err = mlx4_ib_umem_write_mtt(dev, &mmr->mmr.mtt, mmr->umem); |
254 | if (err) { | 255 | if (err) { |
@@ -262,6 +263,8 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, | |||
262 | * return a failure. But dereg_mr will free the resources. | 263 | * return a failure. But dereg_mr will free the resources. |
263 | */ | 264 | */ |
264 | err = mlx4_mr_hw_write_mpt(dev->dev, &mmr->mmr, pmpt_entry); | 265 | err = mlx4_mr_hw_write_mpt(dev->dev, &mmr->mmr, pmpt_entry); |
266 | if (!err && flags & IB_MR_REREG_ACCESS) | ||
267 | mmr->mmr.access = mr_access_flags; | ||
265 | 268 | ||
266 | release_mpt_entry: | 269 | release_mpt_entry: |
267 | mlx4_mr_hw_put_mpt(dev->dev, pmpt_entry); | 270 | mlx4_mr_hw_put_mpt(dev->dev, pmpt_entry); |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 67780452f0cf..9c5150c3cb31 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -964,9 +964,10 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, | |||
964 | MLX4_QP_STATE_RST, NULL, 0, 0, &qp->mqp)) | 964 | MLX4_QP_STATE_RST, NULL, 0, 0, &qp->mqp)) |
965 | pr_warn("modify QP %06x to RESET failed.\n", | 965 | pr_warn("modify QP %06x to RESET failed.\n", |
966 | qp->mqp.qpn); | 966 | qp->mqp.qpn); |
967 | if (qp->pri.smac) { | 967 | if (qp->pri.smac || (!qp->pri.smac && qp->pri.smac_port)) { |
968 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); | 968 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); |
969 | qp->pri.smac = 0; | 969 | qp->pri.smac = 0; |
970 | qp->pri.smac_port = 0; | ||
970 | } | 971 | } |
971 | if (qp->alt.smac) { | 972 | if (qp->alt.smac) { |
972 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); | 973 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); |
@@ -1325,7 +1326,8 @@ static int _mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah, | |||
1325 | * If one was already assigned, but the new mac differs, | 1326 | * If one was already assigned, but the new mac differs, |
1326 | * unregister the old one and register the new one. | 1327 | * unregister the old one and register the new one. |
1327 | */ | 1328 | */ |
1328 | if (!smac_info->smac || smac_info->smac != smac) { | 1329 | if ((!smac_info->smac && !smac_info->smac_port) || |
1330 | smac_info->smac != smac) { | ||
1329 | /* register candidate now, unreg if needed, after success */ | 1331 | /* register candidate now, unreg if needed, after success */ |
1330 | smac_index = mlx4_register_mac(dev->dev, port, smac); | 1332 | smac_index = mlx4_register_mac(dev->dev, port, smac); |
1331 | if (smac_index >= 0) { | 1333 | if (smac_index >= 0) { |
@@ -1390,21 +1392,13 @@ static void update_mcg_macs(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp) | |||
1390 | static int handle_eth_ud_smac_index(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, u8 *smac, | 1392 | static int handle_eth_ud_smac_index(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, u8 *smac, |
1391 | struct mlx4_qp_context *context) | 1393 | struct mlx4_qp_context *context) |
1392 | { | 1394 | { |
1393 | struct net_device *ndev; | ||
1394 | u64 u64_mac; | 1395 | u64 u64_mac; |
1395 | int smac_index; | 1396 | int smac_index; |
1396 | 1397 | ||
1397 | 1398 | u64_mac = atomic64_read(&dev->iboe.mac[qp->port - 1]); | |
1398 | ndev = dev->iboe.netdevs[qp->port - 1]; | ||
1399 | if (ndev) { | ||
1400 | smac = ndev->dev_addr; | ||
1401 | u64_mac = mlx4_mac_to_u64(smac); | ||
1402 | } else { | ||
1403 | u64_mac = dev->dev->caps.def_mac[qp->port]; | ||
1404 | } | ||
1405 | 1399 | ||
1406 | context->pri_path.sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE | ((qp->port - 1) << 6); | 1400 | context->pri_path.sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE | ((qp->port - 1) << 6); |
1407 | if (!qp->pri.smac) { | 1401 | if (!qp->pri.smac && !qp->pri.smac_port) { |
1408 | smac_index = mlx4_register_mac(dev->dev, qp->port, u64_mac); | 1402 | smac_index = mlx4_register_mac(dev->dev, qp->port, u64_mac); |
1409 | if (smac_index >= 0) { | 1403 | if (smac_index >= 0) { |
1410 | qp->pri.candidate_smac_index = smac_index; | 1404 | qp->pri.candidate_smac_index = smac_index; |
@@ -1432,6 +1426,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1432 | int steer_qp = 0; | 1426 | int steer_qp = 0; |
1433 | int err = -EINVAL; | 1427 | int err = -EINVAL; |
1434 | 1428 | ||
1429 | /* APM is not supported under RoCE */ | ||
1430 | if (attr_mask & IB_QP_ALT_PATH && | ||
1431 | rdma_port_get_link_layer(&dev->ib_dev, qp->port) == | ||
1432 | IB_LINK_LAYER_ETHERNET) | ||
1433 | return -ENOTSUPP; | ||
1434 | |||
1435 | context = kzalloc(sizeof *context, GFP_KERNEL); | 1435 | context = kzalloc(sizeof *context, GFP_KERNEL); |
1436 | if (!context) | 1436 | if (!context) |
1437 | return -ENOMEM; | 1437 | return -ENOMEM; |
@@ -1677,9 +1677,15 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1677 | } | 1677 | } |
1678 | } | 1678 | } |
1679 | 1679 | ||
1680 | if (qp->ibqp.qp_type == IB_QPT_RAW_PACKET) | 1680 | if (qp->ibqp.qp_type == IB_QPT_RAW_PACKET) { |
1681 | context->pri_path.ackto = (context->pri_path.ackto & 0xf8) | | 1681 | context->pri_path.ackto = (context->pri_path.ackto & 0xf8) | |
1682 | MLX4_IB_LINK_TYPE_ETH; | 1682 | MLX4_IB_LINK_TYPE_ETH; |
1683 | if (dev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | ||
1684 | /* set QP to receive both tunneled & non-tunneled packets */ | ||
1685 | if (!(context->flags & cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET))) | ||
1686 | context->srqn = cpu_to_be32(7 << 28); | ||
1687 | } | ||
1688 | } | ||
1683 | 1689 | ||
1684 | if (ibqp->qp_type == IB_QPT_UD && (new_state == IB_QPS_RTR)) { | 1690 | if (ibqp->qp_type == IB_QPT_UD && (new_state == IB_QPS_RTR)) { |
1685 | int is_eth = rdma_port_get_link_layer( | 1691 | int is_eth = rdma_port_get_link_layer( |
@@ -1780,9 +1786,10 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1780 | if (qp->flags & MLX4_IB_QP_NETIF) | 1786 | if (qp->flags & MLX4_IB_QP_NETIF) |
1781 | mlx4_ib_steer_qp_reg(dev, qp, 0); | 1787 | mlx4_ib_steer_qp_reg(dev, qp, 0); |
1782 | } | 1788 | } |
1783 | if (qp->pri.smac) { | 1789 | if (qp->pri.smac || (!qp->pri.smac && qp->pri.smac_port)) { |
1784 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); | 1790 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); |
1785 | qp->pri.smac = 0; | 1791 | qp->pri.smac = 0; |
1792 | qp->pri.smac_port = 0; | ||
1786 | } | 1793 | } |
1787 | if (qp->alt.smac) { | 1794 | if (qp->alt.smac) { |
1788 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); | 1795 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); |
@@ -1806,11 +1813,12 @@ out: | |||
1806 | if (err && steer_qp) | 1813 | if (err && steer_qp) |
1807 | mlx4_ib_steer_qp_reg(dev, qp, 0); | 1814 | mlx4_ib_steer_qp_reg(dev, qp, 0); |
1808 | kfree(context); | 1815 | kfree(context); |
1809 | if (qp->pri.candidate_smac) { | 1816 | if (qp->pri.candidate_smac || |
1817 | (!qp->pri.candidate_smac && qp->pri.candidate_smac_port)) { | ||
1810 | if (err) { | 1818 | if (err) { |
1811 | mlx4_unregister_mac(dev->dev, qp->pri.candidate_smac_port, qp->pri.candidate_smac); | 1819 | mlx4_unregister_mac(dev->dev, qp->pri.candidate_smac_port, qp->pri.candidate_smac); |
1812 | } else { | 1820 | } else { |
1813 | if (qp->pri.smac) | 1821 | if (qp->pri.smac || (!qp->pri.smac && qp->pri.smac_port)) |
1814 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); | 1822 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); |
1815 | qp->pri.smac = qp->pri.candidate_smac; | 1823 | qp->pri.smac = qp->pri.candidate_smac; |
1816 | qp->pri.smac_index = qp->pri.candidate_smac_index; | 1824 | qp->pri.smac_index = qp->pri.candidate_smac_index; |
@@ -2083,6 +2091,16 @@ static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp, | |||
2083 | return 0; | 2091 | return 0; |
2084 | } | 2092 | } |
2085 | 2093 | ||
2094 | static void mlx4_u64_to_smac(u8 *dst_mac, u64 src_mac) | ||
2095 | { | ||
2096 | int i; | ||
2097 | |||
2098 | for (i = ETH_ALEN; i; i--) { | ||
2099 | dst_mac[i - 1] = src_mac & 0xff; | ||
2100 | src_mac >>= 8; | ||
2101 | } | ||
2102 | } | ||
2103 | |||
2086 | static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | 2104 | static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, |
2087 | void *wqe, unsigned *mlx_seg_len) | 2105 | void *wqe, unsigned *mlx_seg_len) |
2088 | { | 2106 | { |
@@ -2197,7 +2215,6 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
2197 | } | 2215 | } |
2198 | 2216 | ||
2199 | if (is_eth) { | 2217 | if (is_eth) { |
2200 | u8 *smac; | ||
2201 | struct in6_addr in6; | 2218 | struct in6_addr in6; |
2202 | 2219 | ||
2203 | u16 pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29) << 13; | 2220 | u16 pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29) << 13; |
@@ -2210,12 +2227,17 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
2210 | memcpy(&ctrl->imm, ah->av.eth.mac + 2, 4); | 2227 | memcpy(&ctrl->imm, ah->av.eth.mac + 2, 4); |
2211 | memcpy(&in6, sgid.raw, sizeof(in6)); | 2228 | memcpy(&in6, sgid.raw, sizeof(in6)); |
2212 | 2229 | ||
2213 | if (!mlx4_is_mfunc(to_mdev(ib_dev)->dev)) | 2230 | if (!mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { |
2214 | smac = to_mdev(sqp->qp.ibqp.device)-> | 2231 | u64 mac = atomic64_read(&to_mdev(ib_dev)->iboe.mac[sqp->qp.port - 1]); |
2215 | iboe.netdevs[sqp->qp.port - 1]->dev_addr; | 2232 | u8 smac[ETH_ALEN]; |
2216 | else /* use the src mac of the tunnel */ | 2233 | |
2217 | smac = ah->av.eth.s_mac; | 2234 | mlx4_u64_to_smac(smac, mac); |
2218 | memcpy(sqp->ud_header.eth.smac_h, smac, 6); | 2235 | memcpy(sqp->ud_header.eth.smac_h, smac, ETH_ALEN); |
2236 | } else { | ||
2237 | /* use the src mac of the tunnel */ | ||
2238 | memcpy(sqp->ud_header.eth.smac_h, ah->av.eth.s_mac, ETH_ALEN); | ||
2239 | } | ||
2240 | |||
2219 | if (!memcmp(sqp->ud_header.eth.smac_h, sqp->ud_header.eth.dmac_h, 6)) | 2241 | if (!memcmp(sqp->ud_header.eth.smac_h, sqp->ud_header.eth.dmac_h, 6)) |
2220 | mlx->flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK); | 2242 | mlx->flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK); |
2221 | if (!is_vlan) { | 2243 | if (!is_vlan) { |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index 40f8536c10b0..ac02ce4e8040 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #define OCRDMA_VID_PCP_SHIFT 0xD | 38 | #define OCRDMA_VID_PCP_SHIFT 0xD |
39 | 39 | ||
40 | static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | 40 | static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, |
41 | struct ib_ah_attr *attr, int pdid) | 41 | struct ib_ah_attr *attr, union ib_gid *sgid, int pdid) |
42 | { | 42 | { |
43 | int status = 0; | 43 | int status = 0; |
44 | u16 vlan_tag; bool vlan_enabled = false; | 44 | u16 vlan_tag; bool vlan_enabled = false; |
@@ -49,8 +49,7 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
49 | memset(ð, 0, sizeof(eth)); | 49 | memset(ð, 0, sizeof(eth)); |
50 | memset(&grh, 0, sizeof(grh)); | 50 | memset(&grh, 0, sizeof(grh)); |
51 | 51 | ||
52 | ah->sgid_index = attr->grh.sgid_index; | 52 | /* VLAN */ |
53 | |||
54 | vlan_tag = attr->vlan_id; | 53 | vlan_tag = attr->vlan_id; |
55 | if (!vlan_tag || (vlan_tag > 0xFFF)) | 54 | if (!vlan_tag || (vlan_tag > 0xFFF)) |
56 | vlan_tag = dev->pvid; | 55 | vlan_tag = dev->pvid; |
@@ -65,15 +64,14 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
65 | eth.eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); | 64 | eth.eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); |
66 | eth_sz = sizeof(struct ocrdma_eth_basic); | 65 | eth_sz = sizeof(struct ocrdma_eth_basic); |
67 | } | 66 | } |
67 | /* MAC */ | ||
68 | memcpy(ð.smac[0], &dev->nic_info.mac_addr[0], ETH_ALEN); | 68 | memcpy(ð.smac[0], &dev->nic_info.mac_addr[0], ETH_ALEN); |
69 | memcpy(ð.dmac[0], attr->dmac, ETH_ALEN); | ||
70 | status = ocrdma_resolve_dmac(dev, attr, ð.dmac[0]); | 69 | status = ocrdma_resolve_dmac(dev, attr, ð.dmac[0]); |
71 | if (status) | 70 | if (status) |
72 | return status; | 71 | return status; |
73 | status = ocrdma_query_gid(&dev->ibdev, 1, attr->grh.sgid_index, | 72 | ah->sgid_index = attr->grh.sgid_index; |
74 | (union ib_gid *)&grh.sgid[0]); | 73 | memcpy(&grh.sgid[0], sgid->raw, sizeof(union ib_gid)); |
75 | if (status) | 74 | memcpy(&grh.dgid[0], attr->grh.dgid.raw, sizeof(attr->grh.dgid.raw)); |
76 | return status; | ||
77 | 75 | ||
78 | grh.tclass_flow = cpu_to_be32((6 << 28) | | 76 | grh.tclass_flow = cpu_to_be32((6 << 28) | |
79 | (attr->grh.traffic_class << 24) | | 77 | (attr->grh.traffic_class << 24) | |
@@ -81,8 +79,7 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
81 | /* 0x1b is next header value in GRH */ | 79 | /* 0x1b is next header value in GRH */ |
82 | grh.pdid_hoplimit = cpu_to_be32((pdid << 16) | | 80 | grh.pdid_hoplimit = cpu_to_be32((pdid << 16) | |
83 | (0x1b << 8) | attr->grh.hop_limit); | 81 | (0x1b << 8) | attr->grh.hop_limit); |
84 | 82 | /* Eth HDR */ | |
85 | memcpy(&grh.dgid[0], attr->grh.dgid.raw, sizeof(attr->grh.dgid.raw)); | ||
86 | memcpy(&ah->av->eth_hdr, ð, eth_sz); | 83 | memcpy(&ah->av->eth_hdr, ð, eth_sz); |
87 | memcpy((u8 *)ah->av + eth_sz, &grh, sizeof(struct ocrdma_grh)); | 84 | memcpy((u8 *)ah->av + eth_sz, &grh, sizeof(struct ocrdma_grh)); |
88 | if (vlan_enabled) | 85 | if (vlan_enabled) |
@@ -98,6 +95,8 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr) | |||
98 | struct ocrdma_ah *ah; | 95 | struct ocrdma_ah *ah; |
99 | struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); | 96 | struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); |
100 | struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device); | 97 | struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device); |
98 | union ib_gid sgid; | ||
99 | u8 zmac[ETH_ALEN]; | ||
101 | 100 | ||
102 | if (!(attr->ah_flags & IB_AH_GRH)) | 101 | if (!(attr->ah_flags & IB_AH_GRH)) |
103 | return ERR_PTR(-EINVAL); | 102 | return ERR_PTR(-EINVAL); |
@@ -111,7 +110,27 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr) | |||
111 | status = ocrdma_alloc_av(dev, ah); | 110 | status = ocrdma_alloc_av(dev, ah); |
112 | if (status) | 111 | if (status) |
113 | goto av_err; | 112 | goto av_err; |
114 | status = set_av_attr(dev, ah, attr, pd->id); | 113 | |
114 | status = ocrdma_query_gid(&dev->ibdev, 1, attr->grh.sgid_index, &sgid); | ||
115 | if (status) { | ||
116 | pr_err("%s(): Failed to query sgid, status = %d\n", | ||
117 | __func__, status); | ||
118 | goto av_conf_err; | ||
119 | } | ||
120 | |||
121 | memset(&zmac, 0, ETH_ALEN); | ||
122 | if (pd->uctx && | ||
123 | memcmp(attr->dmac, &zmac, ETH_ALEN)) { | ||
124 | status = rdma_addr_find_dmac_by_grh(&sgid, &attr->grh.dgid, | ||
125 | attr->dmac, &attr->vlan_id); | ||
126 | if (status) { | ||
127 | pr_err("%s(): Failed to resolve dmac from gid." | ||
128 | "status = %d\n", __func__, status); | ||
129 | goto av_conf_err; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | status = set_av_attr(dev, ah, attr, &sgid, pd->id); | ||
115 | if (status) | 134 | if (status) |
116 | goto av_conf_err; | 135 | goto av_conf_err; |
117 | 136 | ||
@@ -145,7 +164,7 @@ int ocrdma_query_ah(struct ib_ah *ibah, struct ib_ah_attr *attr) | |||
145 | struct ocrdma_av *av = ah->av; | 164 | struct ocrdma_av *av = ah->av; |
146 | struct ocrdma_grh *grh; | 165 | struct ocrdma_grh *grh; |
147 | attr->ah_flags |= IB_AH_GRH; | 166 | attr->ah_flags |= IB_AH_GRH; |
148 | if (ah->av->valid & Bit(1)) { | 167 | if (ah->av->valid & OCRDMA_AV_VALID) { |
149 | grh = (struct ocrdma_grh *)((u8 *)ah->av + | 168 | grh = (struct ocrdma_grh *)((u8 *)ah->av + |
150 | sizeof(struct ocrdma_eth_vlan)); | 169 | sizeof(struct ocrdma_eth_vlan)); |
151 | attr->sl = be16_to_cpu(av->eth_hdr.vlan_tag) >> 13; | 170 | attr->sl = be16_to_cpu(av->eth_hdr.vlan_tag) >> 13; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index acb434d16903..8f5f2577f288 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -101,7 +101,7 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr) | |||
101 | attr->max_srq_sge = dev->attr.max_srq_sge; | 101 | attr->max_srq_sge = dev->attr.max_srq_sge; |
102 | attr->max_srq_wr = dev->attr.max_rqe; | 102 | attr->max_srq_wr = dev->attr.max_rqe; |
103 | attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay; | 103 | attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay; |
104 | attr->max_fast_reg_page_list_len = 0; | 104 | attr->max_fast_reg_page_list_len = dev->attr.max_pages_per_frmr; |
105 | attr->max_pkeys = 1; | 105 | attr->max_pkeys = 1; |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
@@ -2846,11 +2846,9 @@ int ocrdma_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags cq_flags) | |||
2846 | if (cq->first_arm) { | 2846 | if (cq->first_arm) { |
2847 | ocrdma_ring_cq_db(dev, cq_id, arm_needed, sol_needed, 0); | 2847 | ocrdma_ring_cq_db(dev, cq_id, arm_needed, sol_needed, 0); |
2848 | cq->first_arm = false; | 2848 | cq->first_arm = false; |
2849 | goto skip_defer; | ||
2850 | } | 2849 | } |
2851 | cq->deferred_arm = true; | ||
2852 | 2850 | ||
2853 | skip_defer: | 2851 | cq->deferred_arm = true; |
2854 | cq->deferred_sol = sol_needed; | 2852 | cq->deferred_sol = sol_needed; |
2855 | spin_unlock_irqrestore(&cq->cq_lock, flags); | 2853 | spin_unlock_irqrestore(&cq->cq_lock, flags); |
2856 | 2854 | ||
diff --git a/drivers/infiniband/hw/qib/qib_debugfs.c b/drivers/infiniband/hw/qib/qib_debugfs.c index 799a0c3bffc4..6abd3ed3cd51 100644 --- a/drivers/infiniband/hw/qib/qib_debugfs.c +++ b/drivers/infiniband/hw/qib/qib_debugfs.c | |||
@@ -193,6 +193,7 @@ static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) | |||
193 | struct qib_qp_iter *iter; | 193 | struct qib_qp_iter *iter; |
194 | loff_t n = *pos; | 194 | loff_t n = *pos; |
195 | 195 | ||
196 | rcu_read_lock(); | ||
196 | iter = qib_qp_iter_init(s->private); | 197 | iter = qib_qp_iter_init(s->private); |
197 | if (!iter) | 198 | if (!iter) |
198 | return NULL; | 199 | return NULL; |
@@ -224,7 +225,7 @@ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, | |||
224 | 225 | ||
225 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) | 226 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) |
226 | { | 227 | { |
227 | /* nothing for now */ | 228 | rcu_read_unlock(); |
228 | } | 229 | } |
229 | 230 | ||
230 | static int _qp_stats_seq_show(struct seq_file *s, void *iter_ptr) | 231 | static int _qp_stats_seq_show(struct seq_file *s, void *iter_ptr) |
diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c index 7fcc150d603c..6ddc0264aad2 100644 --- a/drivers/infiniband/hw/qib/qib_qp.c +++ b/drivers/infiniband/hw/qib/qib_qp.c | |||
@@ -1325,7 +1325,6 @@ int qib_qp_iter_next(struct qib_qp_iter *iter) | |||
1325 | struct qib_qp *pqp = iter->qp; | 1325 | struct qib_qp *pqp = iter->qp; |
1326 | struct qib_qp *qp; | 1326 | struct qib_qp *qp; |
1327 | 1327 | ||
1328 | rcu_read_lock(); | ||
1329 | for (; n < dev->qp_table_size; n++) { | 1328 | for (; n < dev->qp_table_size; n++) { |
1330 | if (pqp) | 1329 | if (pqp) |
1331 | qp = rcu_dereference(pqp->next); | 1330 | qp = rcu_dereference(pqp->next); |
@@ -1333,18 +1332,11 @@ int qib_qp_iter_next(struct qib_qp_iter *iter) | |||
1333 | qp = rcu_dereference(dev->qp_table[n]); | 1332 | qp = rcu_dereference(dev->qp_table[n]); |
1334 | pqp = qp; | 1333 | pqp = qp; |
1335 | if (qp) { | 1334 | if (qp) { |
1336 | if (iter->qp) | ||
1337 | atomic_dec(&iter->qp->refcount); | ||
1338 | atomic_inc(&qp->refcount); | ||
1339 | rcu_read_unlock(); | ||
1340 | iter->qp = qp; | 1335 | iter->qp = qp; |
1341 | iter->n = n; | 1336 | iter->n = n; |
1342 | return 0; | 1337 | return 0; |
1343 | } | 1338 | } |
1344 | } | 1339 | } |
1345 | rcu_read_unlock(); | ||
1346 | if (iter->qp) | ||
1347 | atomic_dec(&iter->qp->refcount); | ||
1348 | return ret; | 1340 | return ret; |
1349 | } | 1341 | } |
1350 | 1342 | ||
diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c index 2bc1d2b96298..74f90b2619f6 100644 --- a/drivers/infiniband/hw/qib/qib_user_pages.c +++ b/drivers/infiniband/hw/qib/qib_user_pages.c | |||
@@ -52,7 +52,7 @@ static void __qib_release_user_pages(struct page **p, size_t num_pages, | |||
52 | * Call with current->mm->mmap_sem held. | 52 | * Call with current->mm->mmap_sem held. |
53 | */ | 53 | */ |
54 | static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, | 54 | static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, |
55 | struct page **p, struct vm_area_struct **vma) | 55 | struct page **p) |
56 | { | 56 | { |
57 | unsigned long lock_limit; | 57 | unsigned long lock_limit; |
58 | size_t got; | 58 | size_t got; |
@@ -69,7 +69,7 @@ static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, | |||
69 | ret = get_user_pages(current, current->mm, | 69 | ret = get_user_pages(current, current->mm, |
70 | start_page + got * PAGE_SIZE, | 70 | start_page + got * PAGE_SIZE, |
71 | num_pages - got, 1, 1, | 71 | num_pages - got, 1, 1, |
72 | p + got, vma); | 72 | p + got, NULL); |
73 | if (ret < 0) | 73 | if (ret < 0) |
74 | goto bail_release; | 74 | goto bail_release; |
75 | } | 75 | } |
@@ -136,7 +136,7 @@ int qib_get_user_pages(unsigned long start_page, size_t num_pages, | |||
136 | 136 | ||
137 | down_write(¤t->mm->mmap_sem); | 137 | down_write(¤t->mm->mmap_sem); |
138 | 138 | ||
139 | ret = __qib_get_user_pages(start_page, num_pages, p, NULL); | 139 | ret = __qib_get_user_pages(start_page, num_pages, p); |
140 | 140 | ||
141 | up_write(¤t->mm->mmap_sem); | 141 | up_write(¤t->mm->mmap_sem); |
142 | 142 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 3edce617c31b..d7562beb5423 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -131,6 +131,12 @@ struct ipoib_cb { | |||
131 | u8 hwaddr[INFINIBAND_ALEN]; | 131 | u8 hwaddr[INFINIBAND_ALEN]; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | static inline struct ipoib_cb *ipoib_skb_cb(const struct sk_buff *skb) | ||
135 | { | ||
136 | BUILD_BUG_ON(sizeof(skb->cb) < sizeof(struct ipoib_cb)); | ||
137 | return (struct ipoib_cb *)skb->cb; | ||
138 | } | ||
139 | |||
134 | /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ | 140 | /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ |
135 | struct ipoib_mcast { | 141 | struct ipoib_mcast { |
136 | struct ib_sa_mcmember_rec mcmember; | 142 | struct ib_sa_mcmember_rec mcmember; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 1310acf6bf92..13e6e0431592 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -716,7 +716,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
716 | { | 716 | { |
717 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 717 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
718 | struct ipoib_neigh *neigh; | 718 | struct ipoib_neigh *neigh; |
719 | struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | 719 | struct ipoib_cb *cb = ipoib_skb_cb(skb); |
720 | struct ipoib_header *header; | 720 | struct ipoib_header *header; |
721 | unsigned long flags; | 721 | unsigned long flags; |
722 | 722 | ||
@@ -813,7 +813,7 @@ static int ipoib_hard_header(struct sk_buff *skb, | |||
813 | const void *daddr, const void *saddr, unsigned len) | 813 | const void *daddr, const void *saddr, unsigned len) |
814 | { | 814 | { |
815 | struct ipoib_header *header; | 815 | struct ipoib_header *header; |
816 | struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | 816 | struct ipoib_cb *cb = ipoib_skb_cb(skb); |
817 | 817 | ||
818 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); | 818 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); |
819 | 819 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index d4e005720d01..ffb83b5f7e80 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -529,21 +529,13 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
529 | port_attr.state); | 529 | port_attr.state); |
530 | return; | 530 | return; |
531 | } | 531 | } |
532 | priv->local_lid = port_attr.lid; | ||
532 | 533 | ||
533 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid)) | 534 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid)) |
534 | ipoib_warn(priv, "ib_query_gid() failed\n"); | 535 | ipoib_warn(priv, "ib_query_gid() failed\n"); |
535 | else | 536 | else |
536 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); | 537 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); |
537 | 538 | ||
538 | { | ||
539 | struct ib_port_attr attr; | ||
540 | |||
541 | if (!ib_query_port(priv->ca, priv->port, &attr)) | ||
542 | priv->local_lid = attr.lid; | ||
543 | else | ||
544 | ipoib_warn(priv, "ib_query_port failed\n"); | ||
545 | } | ||
546 | |||
547 | if (!priv->broadcast) { | 539 | if (!priv->broadcast) { |
548 | struct ipoib_mcast *broadcast; | 540 | struct ipoib_mcast *broadcast; |
549 | 541 | ||
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 61ee91d88380..93ce62fe1594 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -344,7 +344,6 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
344 | int is_leading) | 344 | int is_leading) |
345 | { | 345 | { |
346 | struct iscsi_conn *conn = cls_conn->dd_data; | 346 | struct iscsi_conn *conn = cls_conn->dd_data; |
347 | struct iscsi_session *session; | ||
348 | struct iser_conn *ib_conn; | 347 | struct iser_conn *ib_conn; |
349 | struct iscsi_endpoint *ep; | 348 | struct iscsi_endpoint *ep; |
350 | int error; | 349 | int error; |
@@ -363,9 +362,17 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
363 | } | 362 | } |
364 | ib_conn = ep->dd_data; | 363 | ib_conn = ep->dd_data; |
365 | 364 | ||
366 | session = conn->session; | 365 | mutex_lock(&ib_conn->state_mutex); |
367 | if (iser_alloc_rx_descriptors(ib_conn, session)) | 366 | if (ib_conn->state != ISER_CONN_UP) { |
368 | return -ENOMEM; | 367 | error = -EINVAL; |
368 | iser_err("iser_conn %p state is %d, teardown started\n", | ||
369 | ib_conn, ib_conn->state); | ||
370 | goto out; | ||
371 | } | ||
372 | |||
373 | error = iser_alloc_rx_descriptors(ib_conn, conn->session); | ||
374 | if (error) | ||
375 | goto out; | ||
369 | 376 | ||
370 | /* binds the iSER connection retrieved from the previously | 377 | /* binds the iSER connection retrieved from the previously |
371 | * connected ep_handle to the iSCSI layer connection. exchanges | 378 | * connected ep_handle to the iSCSI layer connection. exchanges |
@@ -375,7 +382,9 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
375 | conn->dd_data = ib_conn; | 382 | conn->dd_data = ib_conn; |
376 | ib_conn->iscsi_conn = conn; | 383 | ib_conn->iscsi_conn = conn; |
377 | 384 | ||
378 | return 0; | 385 | out: |
386 | mutex_unlock(&ib_conn->state_mutex); | ||
387 | return error; | ||
379 | } | 388 | } |
380 | 389 | ||
381 | static int | 390 | static int |
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index c877dad381cb..9f0e0e34d6ca 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
@@ -69,7 +69,7 @@ | |||
69 | 69 | ||
70 | #define DRV_NAME "iser" | 70 | #define DRV_NAME "iser" |
71 | #define PFX DRV_NAME ": " | 71 | #define PFX DRV_NAME ": " |
72 | #define DRV_VER "1.4" | 72 | #define DRV_VER "1.4.1" |
73 | 73 | ||
74 | #define iser_dbg(fmt, arg...) \ | 74 | #define iser_dbg(fmt, arg...) \ |
75 | do { \ | 75 | do { \ |
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 3ef167f97d6f..3bfec4bbda52 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
@@ -73,7 +73,7 @@ static int iser_create_device_ib_res(struct iser_device *device) | |||
73 | { | 73 | { |
74 | struct iser_cq_desc *cq_desc; | 74 | struct iser_cq_desc *cq_desc; |
75 | struct ib_device_attr *dev_attr = &device->dev_attr; | 75 | struct ib_device_attr *dev_attr = &device->dev_attr; |
76 | int ret, i, j; | 76 | int ret, i; |
77 | 77 | ||
78 | ret = ib_query_device(device->ib_device, dev_attr); | 78 | ret = ib_query_device(device->ib_device, dev_attr); |
79 | if (ret) { | 79 | if (ret) { |
@@ -125,16 +125,20 @@ static int iser_create_device_ib_res(struct iser_device *device) | |||
125 | iser_cq_event_callback, | 125 | iser_cq_event_callback, |
126 | (void *)&cq_desc[i], | 126 | (void *)&cq_desc[i], |
127 | ISER_MAX_RX_CQ_LEN, i); | 127 | ISER_MAX_RX_CQ_LEN, i); |
128 | if (IS_ERR(device->rx_cq[i])) | 128 | if (IS_ERR(device->rx_cq[i])) { |
129 | device->rx_cq[i] = NULL; | ||
129 | goto cq_err; | 130 | goto cq_err; |
131 | } | ||
130 | 132 | ||
131 | device->tx_cq[i] = ib_create_cq(device->ib_device, | 133 | device->tx_cq[i] = ib_create_cq(device->ib_device, |
132 | NULL, iser_cq_event_callback, | 134 | NULL, iser_cq_event_callback, |
133 | (void *)&cq_desc[i], | 135 | (void *)&cq_desc[i], |
134 | ISER_MAX_TX_CQ_LEN, i); | 136 | ISER_MAX_TX_CQ_LEN, i); |
135 | 137 | ||
136 | if (IS_ERR(device->tx_cq[i])) | 138 | if (IS_ERR(device->tx_cq[i])) { |
139 | device->tx_cq[i] = NULL; | ||
137 | goto cq_err; | 140 | goto cq_err; |
141 | } | ||
138 | 142 | ||
139 | if (ib_req_notify_cq(device->rx_cq[i], IB_CQ_NEXT_COMP)) | 143 | if (ib_req_notify_cq(device->rx_cq[i], IB_CQ_NEXT_COMP)) |
140 | goto cq_err; | 144 | goto cq_err; |
@@ -160,14 +164,14 @@ static int iser_create_device_ib_res(struct iser_device *device) | |||
160 | handler_err: | 164 | handler_err: |
161 | ib_dereg_mr(device->mr); | 165 | ib_dereg_mr(device->mr); |
162 | dma_mr_err: | 166 | dma_mr_err: |
163 | for (j = 0; j < device->cqs_used; j++) | 167 | for (i = 0; i < device->cqs_used; i++) |
164 | tasklet_kill(&device->cq_tasklet[j]); | 168 | tasklet_kill(&device->cq_tasklet[i]); |
165 | cq_err: | 169 | cq_err: |
166 | for (j = 0; j < i; j++) { | 170 | for (i = 0; i < device->cqs_used; i++) { |
167 | if (device->tx_cq[j]) | 171 | if (device->tx_cq[i]) |
168 | ib_destroy_cq(device->tx_cq[j]); | 172 | ib_destroy_cq(device->tx_cq[i]); |
169 | if (device->rx_cq[j]) | 173 | if (device->rx_cq[i]) |
170 | ib_destroy_cq(device->rx_cq[j]); | 174 | ib_destroy_cq(device->rx_cq[i]); |
171 | } | 175 | } |
172 | ib_dealloc_pd(device->pd); | 176 | ib_dealloc_pd(device->pd); |
173 | pd_err: | 177 | pd_err: |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index d4c7928a0f36..da8ff124762a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -586,17 +586,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
586 | init_completion(&isert_conn->conn_wait); | 586 | init_completion(&isert_conn->conn_wait); |
587 | init_completion(&isert_conn->conn_wait_comp_err); | 587 | init_completion(&isert_conn->conn_wait_comp_err); |
588 | kref_init(&isert_conn->conn_kref); | 588 | kref_init(&isert_conn->conn_kref); |
589 | kref_get(&isert_conn->conn_kref); | ||
590 | mutex_init(&isert_conn->conn_mutex); | 589 | mutex_init(&isert_conn->conn_mutex); |
591 | spin_lock_init(&isert_conn->conn_lock); | 590 | spin_lock_init(&isert_conn->conn_lock); |
592 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); | 591 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); |
593 | 592 | ||
594 | cma_id->context = isert_conn; | 593 | cma_id->context = isert_conn; |
595 | isert_conn->conn_cm_id = cma_id; | 594 | isert_conn->conn_cm_id = cma_id; |
596 | isert_conn->responder_resources = event->param.conn.responder_resources; | ||
597 | isert_conn->initiator_depth = event->param.conn.initiator_depth; | ||
598 | pr_debug("Using responder_resources: %u initiator_depth: %u\n", | ||
599 | isert_conn->responder_resources, isert_conn->initiator_depth); | ||
600 | 595 | ||
601 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + | 596 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + |
602 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); | 597 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); |
@@ -643,6 +638,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
643 | goto out_rsp_dma_map; | 638 | goto out_rsp_dma_map; |
644 | } | 639 | } |
645 | 640 | ||
641 | /* Set max inflight RDMA READ requests */ | ||
642 | isert_conn->initiator_depth = min_t(u8, | ||
643 | event->param.conn.initiator_depth, | ||
644 | device->dev_attr.max_qp_init_rd_atom); | ||
645 | pr_debug("Using initiator_depth: %u\n", isert_conn->initiator_depth); | ||
646 | |||
646 | isert_conn->conn_device = device; | 647 | isert_conn->conn_device = device; |
647 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); | 648 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); |
648 | if (IS_ERR(isert_conn->conn_pd)) { | 649 | if (IS_ERR(isert_conn->conn_pd)) { |
@@ -746,7 +747,9 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
746 | static void | 747 | static void |
747 | isert_connected_handler(struct rdma_cm_id *cma_id) | 748 | isert_connected_handler(struct rdma_cm_id *cma_id) |
748 | { | 749 | { |
749 | return; | 750 | struct isert_conn *isert_conn = cma_id->context; |
751 | |||
752 | kref_get(&isert_conn->conn_kref); | ||
750 | } | 753 | } |
751 | 754 | ||
752 | static void | 755 | static void |
@@ -798,7 +801,6 @@ isert_disconnect_work(struct work_struct *work) | |||
798 | 801 | ||
799 | wake_up: | 802 | wake_up: |
800 | complete(&isert_conn->conn_wait); | 803 | complete(&isert_conn->conn_wait); |
801 | isert_put_conn(isert_conn); | ||
802 | } | 804 | } |
803 | 805 | ||
804 | static void | 806 | static void |
@@ -3067,7 +3069,6 @@ isert_rdma_accept(struct isert_conn *isert_conn) | |||
3067 | int ret; | 3069 | int ret; |
3068 | 3070 | ||
3069 | memset(&cp, 0, sizeof(struct rdma_conn_param)); | 3071 | memset(&cp, 0, sizeof(struct rdma_conn_param)); |
3070 | cp.responder_resources = isert_conn->responder_resources; | ||
3071 | cp.initiator_depth = isert_conn->initiator_depth; | 3072 | cp.initiator_depth = isert_conn->initiator_depth; |
3072 | cp.retry_count = 7; | 3073 | cp.retry_count = 7; |
3073 | cp.rnr_retry_count = 7; | 3074 | cp.rnr_retry_count = 7; |
@@ -3215,7 +3216,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
3215 | pr_debug("isert_wait_conn: Starting \n"); | 3216 | pr_debug("isert_wait_conn: Starting \n"); |
3216 | 3217 | ||
3217 | mutex_lock(&isert_conn->conn_mutex); | 3218 | mutex_lock(&isert_conn->conn_mutex); |
3218 | if (isert_conn->conn_cm_id) { | 3219 | if (isert_conn->conn_cm_id && !isert_conn->disconnect) { |
3219 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); | 3220 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); |
3220 | rdma_disconnect(isert_conn->conn_cm_id); | 3221 | rdma_disconnect(isert_conn->conn_cm_id); |
3221 | } | 3222 | } |
@@ -3234,6 +3235,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
3234 | wait_for_completion(&isert_conn->conn_wait_comp_err); | 3235 | wait_for_completion(&isert_conn->conn_wait_comp_err); |
3235 | 3236 | ||
3236 | wait_for_completion(&isert_conn->conn_wait); | 3237 | wait_for_completion(&isert_conn->conn_wait); |
3238 | isert_put_conn(isert_conn); | ||
3237 | } | 3239 | } |
3238 | 3240 | ||
3239 | static void isert_free_conn(struct iscsi_conn *conn) | 3241 | static void isert_free_conn(struct iscsi_conn *conn) |
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index c30204f2fa30..fbe29fcb15c5 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c | |||
@@ -236,6 +236,18 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) | |||
236 | } | 236 | } |
237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); | 237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); |
238 | 238 | ||
239 | static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt) | ||
240 | { | ||
241 | int i; | ||
242 | |||
243 | for (i = 0; i < mt->num_slots; i++) { | ||
244 | if (!input_mt_is_used(mt, &mt->slots[i])) { | ||
245 | input_mt_slot(dev, i); | ||
246 | input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | |||
239 | /** | 251 | /** |
240 | * input_mt_drop_unused() - Inactivate slots not seen in this frame | 252 | * input_mt_drop_unused() - Inactivate slots not seen in this frame |
241 | * @dev: input device with allocated MT slots | 253 | * @dev: input device with allocated MT slots |
@@ -245,19 +257,11 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation); | |||
245 | void input_mt_drop_unused(struct input_dev *dev) | 257 | void input_mt_drop_unused(struct input_dev *dev) |
246 | { | 258 | { |
247 | struct input_mt *mt = dev->mt; | 259 | struct input_mt *mt = dev->mt; |
248 | int i; | ||
249 | 260 | ||
250 | if (!mt) | 261 | if (mt) { |
251 | return; | 262 | __input_mt_drop_unused(dev, mt); |
252 | 263 | mt->frame++; | |
253 | for (i = 0; i < mt->num_slots; i++) { | ||
254 | if (!input_mt_is_used(mt, &mt->slots[i])) { | ||
255 | input_mt_slot(dev, i); | ||
256 | input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | ||
257 | } | ||
258 | } | 264 | } |
259 | |||
260 | mt->frame++; | ||
261 | } | 265 | } |
262 | EXPORT_SYMBOL(input_mt_drop_unused); | 266 | EXPORT_SYMBOL(input_mt_drop_unused); |
263 | 267 | ||
@@ -278,12 +282,14 @@ void input_mt_sync_frame(struct input_dev *dev) | |||
278 | return; | 282 | return; |
279 | 283 | ||
280 | if (mt->flags & INPUT_MT_DROP_UNUSED) | 284 | if (mt->flags & INPUT_MT_DROP_UNUSED) |
281 | input_mt_drop_unused(dev); | 285 | __input_mt_drop_unused(dev, mt); |
282 | 286 | ||
283 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) | 287 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) |
284 | use_count = true; | 288 | use_count = true; |
285 | 289 | ||
286 | input_mt_report_pointer_emulation(dev, use_count); | 290 | input_mt_report_pointer_emulation(dev, use_count); |
291 | |||
292 | mt->frame++; | ||
287 | } | 293 | } |
288 | EXPORT_SYMBOL(input_mt_sync_frame); | 294 | EXPORT_SYMBOL(input_mt_sync_frame); |
289 | 295 | ||
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 2dd1d0dd4f7d..6f5d79569136 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -1791,14 +1791,6 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { | |||
1791 | { | 1791 | { |
1792 | .matches = { | 1792 | .matches = { |
1793 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), | 1793 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), |
1794 | DMI_MATCH(DMI_PRODUCT_NAME, "LW25-B7HV"), | ||
1795 | }, | ||
1796 | .callback = atkbd_deactivate_fixup, | ||
1797 | }, | ||
1798 | { | ||
1799 | .matches = { | ||
1800 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), | ||
1801 | DMI_MATCH(DMI_PRODUCT_NAME, "P1-J273B"), | ||
1802 | }, | 1794 | }, |
1803 | .callback = atkbd_deactivate_fixup, | 1795 | .callback = atkbd_deactivate_fixup, |
1804 | }, | 1796 | }, |
diff --git a/drivers/input/keyboard/cap1106.c b/drivers/input/keyboard/cap1106.c index 180b184ab90f..d70b65a14ced 100644 --- a/drivers/input/keyboard/cap1106.c +++ b/drivers/input/keyboard/cap1106.c | |||
@@ -33,8 +33,8 @@ | |||
33 | #define CAP1106_REG_SENSOR_CONFIG 0x22 | 33 | #define CAP1106_REG_SENSOR_CONFIG 0x22 |
34 | #define CAP1106_REG_SENSOR_CONFIG2 0x23 | 34 | #define CAP1106_REG_SENSOR_CONFIG2 0x23 |
35 | #define CAP1106_REG_SAMPLING_CONFIG 0x24 | 35 | #define CAP1106_REG_SAMPLING_CONFIG 0x24 |
36 | #define CAP1106_REG_CALIBRATION 0x25 | 36 | #define CAP1106_REG_CALIBRATION 0x26 |
37 | #define CAP1106_REG_INT_ENABLE 0x26 | 37 | #define CAP1106_REG_INT_ENABLE 0x27 |
38 | #define CAP1106_REG_REPEAT_RATE 0x28 | 38 | #define CAP1106_REG_REPEAT_RATE 0x28 |
39 | #define CAP1106_REG_MT_CONFIG 0x2a | 39 | #define CAP1106_REG_MT_CONFIG 0x2a |
40 | #define CAP1106_REG_MT_PATTERN_CONFIG 0x2b | 40 | #define CAP1106_REG_MT_PATTERN_CONFIG 0x2b |
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 8d2e19e81e1e..e651fa692afe 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -332,23 +332,24 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev, | |||
332 | } | 332 | } |
333 | 333 | ||
334 | if (pdata->clustered_irq > 0) { | 334 | if (pdata->clustered_irq > 0) { |
335 | err = request_irq(pdata->clustered_irq, | 335 | err = request_any_context_irq(pdata->clustered_irq, |
336 | matrix_keypad_interrupt, | 336 | matrix_keypad_interrupt, |
337 | pdata->clustered_irq_flags, | 337 | pdata->clustered_irq_flags, |
338 | "matrix-keypad", keypad); | 338 | "matrix-keypad", keypad); |
339 | if (err) { | 339 | if (err < 0) { |
340 | dev_err(&pdev->dev, | 340 | dev_err(&pdev->dev, |
341 | "Unable to acquire clustered interrupt\n"); | 341 | "Unable to acquire clustered interrupt\n"); |
342 | goto err_free_rows; | 342 | goto err_free_rows; |
343 | } | 343 | } |
344 | } else { | 344 | } else { |
345 | for (i = 0; i < pdata->num_row_gpios; i++) { | 345 | for (i = 0; i < pdata->num_row_gpios; i++) { |
346 | err = request_irq(gpio_to_irq(pdata->row_gpios[i]), | 346 | err = request_any_context_irq( |
347 | gpio_to_irq(pdata->row_gpios[i]), | ||
347 | matrix_keypad_interrupt, | 348 | matrix_keypad_interrupt, |
348 | IRQF_TRIGGER_RISING | | 349 | IRQF_TRIGGER_RISING | |
349 | IRQF_TRIGGER_FALLING, | 350 | IRQF_TRIGGER_FALLING, |
350 | "matrix-keypad", keypad); | 351 | "matrix-keypad", keypad); |
351 | if (err) { | 352 | if (err < 0) { |
352 | dev_err(&pdev->dev, | 353 | dev_err(&pdev->dev, |
353 | "Unable to acquire interrupt for GPIO line %i\n", | 354 | "Unable to acquire interrupt for GPIO line %i\n", |
354 | pdata->row_gpios[i]); | 355 | pdata->row_gpios[i]); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index a59a1a64b674..35a49bf57227 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -2234,8 +2234,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) | |||
2234 | return 0; | 2234 | return 0; |
2235 | } | 2235 | } |
2236 | 2236 | ||
2237 | psmouse_info(psmouse, | 2237 | psmouse_dbg(psmouse, |
2238 | "Unknown ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); | 2238 | "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); |
2239 | 2239 | ||
2240 | return -EINVAL; | 2240 | return -EINVAL; |
2241 | } | 2241 | } |
@@ -2373,6 +2373,10 @@ int alps_init(struct psmouse *psmouse) | |||
2373 | dev2->keybit[BIT_WORD(BTN_LEFT)] = | 2373 | dev2->keybit[BIT_WORD(BTN_LEFT)] = |
2374 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 2374 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); |
2375 | 2375 | ||
2376 | __set_bit(INPUT_PROP_POINTER, dev2->propbit); | ||
2377 | if (priv->flags & ALPS_DUALPOINT) | ||
2378 | __set_bit(INPUT_PROP_POINTING_STICK, dev2->propbit); | ||
2379 | |||
2376 | if (input_register_device(priv->dev2)) | 2380 | if (input_register_device(priv->dev2)) |
2377 | goto init_fail; | 2381 | goto init_fail; |
2378 | 2382 | ||
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index ee2a04d90d20..06fc6e76ffbe 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/input/mt.h> | 18 | #include <linux/input/mt.h> |
19 | #include <linux/serio.h> | 19 | #include <linux/serio.h> |
20 | #include <linux/libps2.h> | 20 | #include <linux/libps2.h> |
21 | #include <asm/unaligned.h> | ||
21 | #include "psmouse.h" | 22 | #include "psmouse.h" |
22 | #include "elantech.h" | 23 | #include "elantech.h" |
23 | 24 | ||
@@ -403,6 +404,68 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) | |||
403 | input_sync(dev); | 404 | input_sync(dev); |
404 | } | 405 | } |
405 | 406 | ||
407 | static void elantech_report_trackpoint(struct psmouse *psmouse, | ||
408 | int packet_type) | ||
409 | { | ||
410 | /* | ||
411 | * byte 0: 0 0 sx sy 0 M R L | ||
412 | * byte 1:~sx 0 0 0 0 0 0 0 | ||
413 | * byte 2:~sy 0 0 0 0 0 0 0 | ||
414 | * byte 3: 0 0 ~sy ~sx 0 1 1 0 | ||
415 | * byte 4: x7 x6 x5 x4 x3 x2 x1 x0 | ||
416 | * byte 5: y7 y6 y5 y4 y3 y2 y1 y0 | ||
417 | * | ||
418 | * x and y are written in two's complement spread | ||
419 | * over 9 bits with sx/sy the relative top bit and | ||
420 | * x7..x0 and y7..y0 the lower bits. | ||
421 | * The sign of y is opposite to what the input driver | ||
422 | * expects for a relative movement | ||
423 | */ | ||
424 | |||
425 | struct elantech_data *etd = psmouse->private; | ||
426 | struct input_dev *tp_dev = etd->tp_dev; | ||
427 | unsigned char *packet = psmouse->packet; | ||
428 | int x, y; | ||
429 | u32 t; | ||
430 | |||
431 | if (dev_WARN_ONCE(&psmouse->ps2dev.serio->dev, | ||
432 | !tp_dev, | ||
433 | psmouse_fmt("Unexpected trackpoint message\n"))) { | ||
434 | if (etd->debug == 1) | ||
435 | elantech_packet_dump(psmouse); | ||
436 | return; | ||
437 | } | ||
438 | |||
439 | t = get_unaligned_le32(&packet[0]); | ||
440 | |||
441 | switch (t & ~7U) { | ||
442 | case 0x06000030U: | ||
443 | case 0x16008020U: | ||
444 | case 0x26800010U: | ||
445 | case 0x36808000U: | ||
446 | x = packet[4] - (int)((packet[1]^0x80) << 1); | ||
447 | y = (int)((packet[2]^0x80) << 1) - packet[5]; | ||
448 | |||
449 | input_report_key(tp_dev, BTN_LEFT, packet[0] & 0x01); | ||
450 | input_report_key(tp_dev, BTN_RIGHT, packet[0] & 0x02); | ||
451 | input_report_key(tp_dev, BTN_MIDDLE, packet[0] & 0x04); | ||
452 | |||
453 | input_report_rel(tp_dev, REL_X, x); | ||
454 | input_report_rel(tp_dev, REL_Y, y); | ||
455 | |||
456 | input_sync(tp_dev); | ||
457 | |||
458 | break; | ||
459 | |||
460 | default: | ||
461 | /* Dump unexpected packet sequences if debug=1 (default) */ | ||
462 | if (etd->debug == 1) | ||
463 | elantech_packet_dump(psmouse); | ||
464 | |||
465 | break; | ||
466 | } | ||
467 | } | ||
468 | |||
406 | /* | 469 | /* |
407 | * Interpret complete data packets and report absolute mode input events for | 470 | * Interpret complete data packets and report absolute mode input events for |
408 | * hardware version 3. (12 byte packets for two fingers) | 471 | * hardware version 3. (12 byte packets for two fingers) |
@@ -715,6 +778,8 @@ static int elantech_packet_check_v3(struct psmouse *psmouse) | |||
715 | 778 | ||
716 | if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c) | 779 | if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c) |
717 | return PACKET_V3_TAIL; | 780 | return PACKET_V3_TAIL; |
781 | if ((packet[3] & 0x0f) == 0x06) | ||
782 | return PACKET_TRACKPOINT; | ||
718 | } | 783 | } |
719 | 784 | ||
720 | return PACKET_UNKNOWN; | 785 | return PACKET_UNKNOWN; |
@@ -791,14 +856,23 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) | |||
791 | 856 | ||
792 | case 3: | 857 | case 3: |
793 | packet_type = elantech_packet_check_v3(psmouse); | 858 | packet_type = elantech_packet_check_v3(psmouse); |
794 | /* ignore debounce */ | 859 | switch (packet_type) { |
795 | if (packet_type == PACKET_DEBOUNCE) | 860 | case PACKET_UNKNOWN: |
796 | return PSMOUSE_FULL_PACKET; | ||
797 | |||
798 | if (packet_type == PACKET_UNKNOWN) | ||
799 | return PSMOUSE_BAD_DATA; | 861 | return PSMOUSE_BAD_DATA; |
800 | 862 | ||
801 | elantech_report_absolute_v3(psmouse, packet_type); | 863 | case PACKET_DEBOUNCE: |
864 | /* ignore debounce */ | ||
865 | break; | ||
866 | |||
867 | case PACKET_TRACKPOINT: | ||
868 | elantech_report_trackpoint(psmouse, packet_type); | ||
869 | break; | ||
870 | |||
871 | default: | ||
872 | elantech_report_absolute_v3(psmouse, packet_type); | ||
873 | break; | ||
874 | } | ||
875 | |||
802 | break; | 876 | break; |
803 | 877 | ||
804 | case 4: | 878 | case 4: |
@@ -1018,8 +1092,10 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, | |||
1018 | * Asus UX31 0x361f00 20, 15, 0e clickpad | 1092 | * Asus UX31 0x361f00 20, 15, 0e clickpad |
1019 | * Asus UX32VD 0x361f02 00, 15, 0e clickpad | 1093 | * Asus UX32VD 0x361f02 00, 15, 0e clickpad |
1020 | * Avatar AVIU-145A2 0x361f00 ? clickpad | 1094 | * Avatar AVIU-145A2 0x361f00 ? clickpad |
1095 | * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) | ||
1021 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons | 1096 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons |
1022 | * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) | 1097 | * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) |
1098 | * Lenovo L530 0x350f02 b9, 15, 0c 2 hw buttons (*) | ||
1023 | * Samsung NF210 0x150b00 78, 14, 0a 2 hw buttons | 1099 | * Samsung NF210 0x150b00 78, 14, 0a 2 hw buttons |
1024 | * Samsung NP770Z5E 0x575f01 10, 15, 0f clickpad | 1100 | * Samsung NP770Z5E 0x575f01 10, 15, 0f clickpad |
1025 | * Samsung NP700Z5B 0x361f06 21, 15, 0f clickpad | 1101 | * Samsung NP700Z5B 0x361f06 21, 15, 0f clickpad |
@@ -1029,6 +1105,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, | |||
1029 | * Samsung RF710 0x450f00 ? 2 hw buttons | 1105 | * Samsung RF710 0x450f00 ? 2 hw buttons |
1030 | * System76 Pangolin 0x250f01 ? 2 hw buttons | 1106 | * System76 Pangolin 0x250f01 ? 2 hw buttons |
1031 | * (*) + 3 trackpoint buttons | 1107 | * (*) + 3 trackpoint buttons |
1108 | * (**) + 0 trackpoint buttons | ||
1109 | * Note: Lenovo L430 and Lenovo L430 have the same fw_version/caps | ||
1032 | */ | 1110 | */ |
1033 | static void elantech_set_buttonpad_prop(struct psmouse *psmouse) | 1111 | static void elantech_set_buttonpad_prop(struct psmouse *psmouse) |
1034 | { | 1112 | { |
@@ -1253,6 +1331,13 @@ static bool elantech_is_signature_valid(const unsigned char *param) | |||
1253 | if (param[1] == 0) | 1331 | if (param[1] == 0) |
1254 | return true; | 1332 | return true; |
1255 | 1333 | ||
1334 | /* | ||
1335 | * Some models have a revision higher then 20. Meaning param[2] may | ||
1336 | * be 10 or 20, skip the rates check for these. | ||
1337 | */ | ||
1338 | if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40) | ||
1339 | return true; | ||
1340 | |||
1256 | for (i = 0; i < ARRAY_SIZE(rates); i++) | 1341 | for (i = 0; i < ARRAY_SIZE(rates); i++) |
1257 | if (param[2] == rates[i]) | 1342 | if (param[2] == rates[i]) |
1258 | return false; | 1343 | return false; |
@@ -1324,6 +1409,10 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties) | |||
1324 | */ | 1409 | */ |
1325 | static void elantech_disconnect(struct psmouse *psmouse) | 1410 | static void elantech_disconnect(struct psmouse *psmouse) |
1326 | { | 1411 | { |
1412 | struct elantech_data *etd = psmouse->private; | ||
1413 | |||
1414 | if (etd->tp_dev) | ||
1415 | input_unregister_device(etd->tp_dev); | ||
1327 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, | 1416 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, |
1328 | &elantech_attr_group); | 1417 | &elantech_attr_group); |
1329 | kfree(psmouse->private); | 1418 | kfree(psmouse->private); |
@@ -1438,8 +1527,10 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1438 | int elantech_init(struct psmouse *psmouse) | 1527 | int elantech_init(struct psmouse *psmouse) |
1439 | { | 1528 | { |
1440 | struct elantech_data *etd; | 1529 | struct elantech_data *etd; |
1441 | int i, error; | 1530 | int i; |
1531 | int error = -EINVAL; | ||
1442 | unsigned char param[3]; | 1532 | unsigned char param[3]; |
1533 | struct input_dev *tp_dev; | ||
1443 | 1534 | ||
1444 | psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); | 1535 | psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); |
1445 | if (!etd) | 1536 | if (!etd) |
@@ -1498,14 +1589,53 @@ int elantech_init(struct psmouse *psmouse) | |||
1498 | goto init_fail; | 1589 | goto init_fail; |
1499 | } | 1590 | } |
1500 | 1591 | ||
1592 | /* The MSB indicates the presence of the trackpoint */ | ||
1593 | if ((etd->capabilities[0] & 0x80) == 0x80) { | ||
1594 | tp_dev = input_allocate_device(); | ||
1595 | |||
1596 | if (!tp_dev) { | ||
1597 | error = -ENOMEM; | ||
1598 | goto init_fail_tp_alloc; | ||
1599 | } | ||
1600 | |||
1601 | etd->tp_dev = tp_dev; | ||
1602 | snprintf(etd->tp_phys, sizeof(etd->tp_phys), "%s/input1", | ||
1603 | psmouse->ps2dev.serio->phys); | ||
1604 | tp_dev->phys = etd->tp_phys; | ||
1605 | tp_dev->name = "Elantech PS/2 TrackPoint"; | ||
1606 | tp_dev->id.bustype = BUS_I8042; | ||
1607 | tp_dev->id.vendor = 0x0002; | ||
1608 | tp_dev->id.product = PSMOUSE_ELANTECH; | ||
1609 | tp_dev->id.version = 0x0000; | ||
1610 | tp_dev->dev.parent = &psmouse->ps2dev.serio->dev; | ||
1611 | tp_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | ||
1612 | tp_dev->relbit[BIT_WORD(REL_X)] = | ||
1613 | BIT_MASK(REL_X) | BIT_MASK(REL_Y); | ||
1614 | tp_dev->keybit[BIT_WORD(BTN_LEFT)] = | ||
1615 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | | ||
1616 | BIT_MASK(BTN_RIGHT); | ||
1617 | |||
1618 | __set_bit(INPUT_PROP_POINTER, tp_dev->propbit); | ||
1619 | __set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit); | ||
1620 | |||
1621 | error = input_register_device(etd->tp_dev); | ||
1622 | if (error < 0) | ||
1623 | goto init_fail_tp_reg; | ||
1624 | } | ||
1625 | |||
1501 | psmouse->protocol_handler = elantech_process_byte; | 1626 | psmouse->protocol_handler = elantech_process_byte; |
1502 | psmouse->disconnect = elantech_disconnect; | 1627 | psmouse->disconnect = elantech_disconnect; |
1503 | psmouse->reconnect = elantech_reconnect; | 1628 | psmouse->reconnect = elantech_reconnect; |
1504 | psmouse->pktsize = etd->hw_version > 1 ? 6 : 4; | 1629 | psmouse->pktsize = etd->hw_version > 1 ? 6 : 4; |
1505 | 1630 | ||
1506 | return 0; | 1631 | return 0; |
1507 | 1632 | init_fail_tp_reg: | |
1633 | input_free_device(tp_dev); | ||
1634 | init_fail_tp_alloc: | ||
1635 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, | ||
1636 | &elantech_attr_group); | ||
1508 | init_fail: | 1637 | init_fail: |
1638 | psmouse_reset(psmouse); | ||
1509 | kfree(etd); | 1639 | kfree(etd); |
1510 | return -1; | 1640 | return error; |
1511 | } | 1641 | } |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index 9e0e2a1f340d..6f3afec02f03 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
@@ -94,6 +94,7 @@ | |||
94 | #define PACKET_V4_HEAD 0x05 | 94 | #define PACKET_V4_HEAD 0x05 |
95 | #define PACKET_V4_MOTION 0x06 | 95 | #define PACKET_V4_MOTION 0x06 |
96 | #define PACKET_V4_STATUS 0x07 | 96 | #define PACKET_V4_STATUS 0x07 |
97 | #define PACKET_TRACKPOINT 0x08 | ||
97 | 98 | ||
98 | /* | 99 | /* |
99 | * track up to 5 fingers for v4 hardware | 100 | * track up to 5 fingers for v4 hardware |
@@ -114,6 +115,8 @@ struct finger_pos { | |||
114 | }; | 115 | }; |
115 | 116 | ||
116 | struct elantech_data { | 117 | struct elantech_data { |
118 | struct input_dev *tp_dev; /* Relative device for trackpoint */ | ||
119 | char tp_phys[32]; | ||
117 | unsigned char reg_07; | 120 | unsigned char reg_07; |
118 | unsigned char reg_10; | 121 | unsigned char reg_10; |
119 | unsigned char reg_11; | 122 | unsigned char reg_11; |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index cff065f6261c..b4e1f014ddc2 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -670,6 +670,8 @@ static void psmouse_apply_defaults(struct psmouse *psmouse) | |||
670 | __set_bit(REL_X, input_dev->relbit); | 670 | __set_bit(REL_X, input_dev->relbit); |
671 | __set_bit(REL_Y, input_dev->relbit); | 671 | __set_bit(REL_Y, input_dev->relbit); |
672 | 672 | ||
673 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
674 | |||
673 | psmouse->set_rate = psmouse_set_rate; | 675 | psmouse->set_rate = psmouse_set_rate; |
674 | psmouse->set_resolution = psmouse_set_resolution; | 676 | psmouse->set_resolution = psmouse_set_resolution; |
675 | psmouse->poll = psmouse_poll; | 677 | psmouse->poll = psmouse_poll; |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index e8573c68f77e..fd23181c1fb7 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -629,10 +629,61 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
629 | ((buf[0] & 0x04) >> 1) | | 629 | ((buf[0] & 0x04) >> 1) | |
630 | ((buf[3] & 0x04) >> 2)); | 630 | ((buf[3] & 0x04) >> 2)); |
631 | 631 | ||
632 | if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || | ||
633 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && | ||
634 | hw->w == 2) { | ||
635 | synaptics_parse_agm(buf, priv, hw); | ||
636 | return 1; | ||
637 | } | ||
638 | |||
639 | hw->x = (((buf[3] & 0x10) << 8) | | ||
640 | ((buf[1] & 0x0f) << 8) | | ||
641 | buf[4]); | ||
642 | hw->y = (((buf[3] & 0x20) << 7) | | ||
643 | ((buf[1] & 0xf0) << 4) | | ||
644 | buf[5]); | ||
645 | hw->z = buf[2]; | ||
646 | |||
632 | hw->left = (buf[0] & 0x01) ? 1 : 0; | 647 | hw->left = (buf[0] & 0x01) ? 1 : 0; |
633 | hw->right = (buf[0] & 0x02) ? 1 : 0; | 648 | hw->right = (buf[0] & 0x02) ? 1 : 0; |
634 | 649 | ||
635 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 650 | if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) { |
651 | /* | ||
652 | * ForcePads, like Clickpads, use middle button | ||
653 | * bits to report primary button clicks. | ||
654 | * Unfortunately they report primary button not | ||
655 | * only when user presses on the pad above certain | ||
656 | * threshold, but also when there are more than one | ||
657 | * finger on the touchpad, which interferes with | ||
658 | * out multi-finger gestures. | ||
659 | */ | ||
660 | if (hw->z == 0) { | ||
661 | /* No contacts */ | ||
662 | priv->press = priv->report_press = false; | ||
663 | } else if (hw->w >= 4 && ((buf[0] ^ buf[3]) & 0x01)) { | ||
664 | /* | ||
665 | * Single-finger touch with pressure above | ||
666 | * the threshold. If pressure stays long | ||
667 | * enough, we'll start reporting primary | ||
668 | * button. We rely on the device continuing | ||
669 | * sending data even if finger does not | ||
670 | * move. | ||
671 | */ | ||
672 | if (!priv->press) { | ||
673 | priv->press_start = jiffies; | ||
674 | priv->press = true; | ||
675 | } else if (time_after(jiffies, | ||
676 | priv->press_start + | ||
677 | msecs_to_jiffies(50))) { | ||
678 | priv->report_press = true; | ||
679 | } | ||
680 | } else { | ||
681 | priv->press = false; | ||
682 | } | ||
683 | |||
684 | hw->left = priv->report_press; | ||
685 | |||
686 | } else if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | ||
636 | /* | 687 | /* |
637 | * Clickpad's button is transmitted as middle button, | 688 | * Clickpad's button is transmitted as middle button, |
638 | * however, since it is primary button, we will report | 689 | * however, since it is primary button, we will report |
@@ -651,21 +702,6 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
651 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; | 702 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; |
652 | } | 703 | } |
653 | 704 | ||
654 | if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || | ||
655 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && | ||
656 | hw->w == 2) { | ||
657 | synaptics_parse_agm(buf, priv, hw); | ||
658 | return 1; | ||
659 | } | ||
660 | |||
661 | hw->x = (((buf[3] & 0x10) << 8) | | ||
662 | ((buf[1] & 0x0f) << 8) | | ||
663 | buf[4]); | ||
664 | hw->y = (((buf[3] & 0x20) << 7) | | ||
665 | ((buf[1] & 0xf0) << 4) | | ||
666 | buf[5]); | ||
667 | hw->z = buf[2]; | ||
668 | |||
669 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && | 705 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && |
670 | ((buf[0] ^ buf[3]) & 0x02)) { | 706 | ((buf[0] ^ buf[3]) & 0x02)) { |
671 | switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { | 707 | switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index e594af0b264b..fb2e076738ae 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -78,6 +78,11 @@ | |||
78 | * 2 0x08 image sensor image sensor tracks 5 fingers, but only | 78 | * 2 0x08 image sensor image sensor tracks 5 fingers, but only |
79 | * reports 2. | 79 | * reports 2. |
80 | * 2 0x20 report min query 0x0f gives min coord reported | 80 | * 2 0x20 report min query 0x0f gives min coord reported |
81 | * 2 0x80 forcepad forcepad is a variant of clickpad that | ||
82 | * does not have physical buttons but rather | ||
83 | * uses pressure above certain threshold to | ||
84 | * report primary clicks. Forcepads also have | ||
85 | * clickpad bit set. | ||
81 | */ | 86 | */ |
82 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ | 87 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ |
83 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ | 88 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ |
@@ -86,6 +91,7 @@ | |||
86 | #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000) | 91 | #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000) |
87 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) | 92 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) |
88 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) | 93 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) |
94 | #define SYN_CAP_FORCEPAD(ex0c) ((ex0c) & 0x008000) | ||
89 | 95 | ||
90 | /* synaptics modes query bits */ | 96 | /* synaptics modes query bits */ |
91 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) | 97 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) |
@@ -177,6 +183,11 @@ struct synaptics_data { | |||
177 | */ | 183 | */ |
178 | struct synaptics_hw_state agm; | 184 | struct synaptics_hw_state agm; |
179 | bool agm_pending; /* new AGM packet received */ | 185 | bool agm_pending; /* new AGM packet received */ |
186 | |||
187 | /* ForcePad handling */ | ||
188 | unsigned long press_start; | ||
189 | bool press; | ||
190 | bool report_press; | ||
180 | }; | 191 | }; |
181 | 192 | ||
182 | void synaptics_module_init(void); | 193 | void synaptics_module_init(void); |
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c index e122bda16aab..6bcc0189c1c9 100644 --- a/drivers/input/mouse/synaptics_usb.c +++ b/drivers/input/mouse/synaptics_usb.c | |||
@@ -387,6 +387,7 @@ static int synusb_probe(struct usb_interface *intf, | |||
387 | __set_bit(EV_REL, input_dev->evbit); | 387 | __set_bit(EV_REL, input_dev->evbit); |
388 | __set_bit(REL_X, input_dev->relbit); | 388 | __set_bit(REL_X, input_dev->relbit); |
389 | __set_bit(REL_Y, input_dev->relbit); | 389 | __set_bit(REL_Y, input_dev->relbit); |
390 | __set_bit(INPUT_PROP_POINTING_STICK, input_dev->propbit); | ||
390 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0); | 391 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0); |
391 | } else { | 392 | } else { |
392 | input_set_abs_params(input_dev, ABS_X, | 393 | input_set_abs_params(input_dev, ABS_X, |
@@ -401,6 +402,11 @@ static int synusb_probe(struct usb_interface *intf, | |||
401 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | 402 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); |
402 | } | 403 | } |
403 | 404 | ||
405 | if (synusb->flags & SYNUSB_TOUCHSCREEN) | ||
406 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
407 | else | ||
408 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
409 | |||
404 | __set_bit(BTN_LEFT, input_dev->keybit); | 410 | __set_bit(BTN_LEFT, input_dev->keybit); |
405 | __set_bit(BTN_RIGHT, input_dev->keybit); | 411 | __set_bit(BTN_RIGHT, input_dev->keybit); |
406 | __set_bit(BTN_MIDDLE, input_dev->keybit); | 412 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index ca843b6cf6bd..30c8b6998808 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -393,6 +393,9 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
393 | if ((button_info & 0x0f) >= 3) | 393 | if ((button_info & 0x0f) >= 3) |
394 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | 394 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
395 | 395 | ||
396 | __set_bit(INPUT_PROP_POINTER, psmouse->dev->propbit); | ||
397 | __set_bit(INPUT_PROP_POINTING_STICK, psmouse->dev->propbit); | ||
398 | |||
396 | trackpoint_defaults(psmouse->private); | 399 | trackpoint_defaults(psmouse->private); |
397 | 400 | ||
398 | error = trackpoint_power_on_reset(&psmouse->ps2dev); | 401 | error = trackpoint_power_on_reset(&psmouse->ps2dev); |
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index d6aa4c67dbb6..93cb7912703c 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h | |||
@@ -17,7 +17,6 @@ static int i8042_aux_irq = -1; | |||
17 | #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" | 17 | #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" |
18 | 18 | ||
19 | static void __iomem *kbd_iobase; | 19 | static void __iomem *kbd_iobase; |
20 | static struct resource *kbd_res; | ||
21 | 20 | ||
22 | #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) | 21 | #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) |
23 | #define I8042_DATA_REG (kbd_iobase + 0x60UL) | 22 | #define I8042_DATA_REG (kbd_iobase + 0x60UL) |
@@ -44,6 +43,8 @@ static inline void i8042_write_command(int val) | |||
44 | 43 | ||
45 | #ifdef CONFIG_PCI | 44 | #ifdef CONFIG_PCI |
46 | 45 | ||
46 | static struct resource *kbd_res; | ||
47 | |||
47 | #define OBP_PS2KBD_NAME1 "kb_ps2" | 48 | #define OBP_PS2KBD_NAME1 "kb_ps2" |
48 | #define OBP_PS2KBD_NAME2 "keyboard" | 49 | #define OBP_PS2KBD_NAME2 "keyboard" |
49 | #define OBP_PS2MS_NAME1 "kdmouse" | 50 | #define OBP_PS2MS_NAME1 "kdmouse" |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 136b7b204f56..40b7d6c0ff17 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -465,6 +465,20 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
465 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | 465 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), |
466 | }, | 466 | }, |
467 | }, | 467 | }, |
468 | { | ||
469 | /* Asus X450LCP */ | ||
470 | .matches = { | ||
471 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), | ||
472 | DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"), | ||
473 | }, | ||
474 | }, | ||
475 | { | ||
476 | /* Avatar AVIU-145A6 */ | ||
477 | .matches = { | ||
478 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), | ||
479 | DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"), | ||
480 | }, | ||
481 | }, | ||
468 | { } | 482 | { } |
469 | }; | 483 | }; |
470 | 484 | ||
@@ -608,6 +622,14 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { | |||
608 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | 622 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), |
609 | }, | 623 | }, |
610 | }, | 624 | }, |
625 | { | ||
626 | /* Fujitsu U574 laptop */ | ||
627 | /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ | ||
628 | .matches = { | ||
629 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
630 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"), | ||
631 | }, | ||
632 | }, | ||
611 | { } | 633 | { } |
612 | }; | 634 | }; |
613 | 635 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 3807c3e971cc..f5a98af3b325 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -1254,6 +1254,8 @@ static int __init i8042_create_aux_port(int idx) | |||
1254 | } else { | 1254 | } else { |
1255 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); | 1255 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); |
1256 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); | 1256 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); |
1257 | strlcpy(serio->firmware_id, i8042_aux_firmware_id, | ||
1258 | sizeof(serio->firmware_id)); | ||
1257 | } | 1259 | } |
1258 | 1260 | ||
1259 | port->serio = serio; | 1261 | port->serio = serio; |
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 0cb7ef59071b..69175b825346 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/serio.h> | 22 | #include <linux/serio.h> |
23 | #include <linux/tty.h> | 23 | #include <linux/tty.h> |
24 | #include <linux/compat.h> | ||
24 | 25 | ||
25 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 26 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
26 | MODULE_DESCRIPTION("Input device TTY line discipline"); | 27 | MODULE_DESCRIPTION("Input device TTY line discipline"); |
@@ -198,28 +199,55 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u | |||
198 | return 0; | 199 | return 0; |
199 | } | 200 | } |
200 | 201 | ||
202 | static void serport_set_type(struct tty_struct *tty, unsigned long type) | ||
203 | { | ||
204 | struct serport *serport = tty->disc_data; | ||
205 | |||
206 | serport->id.proto = type & 0x000000ff; | ||
207 | serport->id.id = (type & 0x0000ff00) >> 8; | ||
208 | serport->id.extra = (type & 0x00ff0000) >> 16; | ||
209 | } | ||
210 | |||
201 | /* | 211 | /* |
202 | * serport_ldisc_ioctl() allows to set the port protocol, and device ID | 212 | * serport_ldisc_ioctl() allows to set the port protocol, and device ID |
203 | */ | 213 | */ |
204 | 214 | ||
205 | static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) | 215 | static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, |
216 | unsigned int cmd, unsigned long arg) | ||
206 | { | 217 | { |
207 | struct serport *serport = (struct serport*) tty->disc_data; | ||
208 | unsigned long type; | ||
209 | |||
210 | if (cmd == SPIOCSTYPE) { | 218 | if (cmd == SPIOCSTYPE) { |
219 | unsigned long type; | ||
220 | |||
211 | if (get_user(type, (unsigned long __user *) arg)) | 221 | if (get_user(type, (unsigned long __user *) arg)) |
212 | return -EFAULT; | 222 | return -EFAULT; |
213 | 223 | ||
214 | serport->id.proto = type & 0x000000ff; | 224 | serport_set_type(tty, type); |
215 | serport->id.id = (type & 0x0000ff00) >> 8; | 225 | return 0; |
216 | serport->id.extra = (type & 0x00ff0000) >> 16; | 226 | } |
227 | |||
228 | return -EINVAL; | ||
229 | } | ||
230 | |||
231 | #ifdef CONFIG_COMPAT | ||
232 | #define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t) | ||
233 | static long serport_ldisc_compat_ioctl(struct tty_struct *tty, | ||
234 | struct file *file, | ||
235 | unsigned int cmd, unsigned long arg) | ||
236 | { | ||
237 | if (cmd == COMPAT_SPIOCSTYPE) { | ||
238 | void __user *uarg = compat_ptr(arg); | ||
239 | compat_ulong_t compat_type; | ||
240 | |||
241 | if (get_user(compat_type, (compat_ulong_t __user *)uarg)) | ||
242 | return -EFAULT; | ||
217 | 243 | ||
244 | serport_set_type(tty, compat_type); | ||
218 | return 0; | 245 | return 0; |
219 | } | 246 | } |
220 | 247 | ||
221 | return -EINVAL; | 248 | return -EINVAL; |
222 | } | 249 | } |
250 | #endif | ||
223 | 251 | ||
224 | static void serport_ldisc_write_wakeup(struct tty_struct * tty) | 252 | static void serport_ldisc_write_wakeup(struct tty_struct * tty) |
225 | { | 253 | { |
@@ -243,6 +271,9 @@ static struct tty_ldisc_ops serport_ldisc = { | |||
243 | .close = serport_ldisc_close, | 271 | .close = serport_ldisc_close, |
244 | .read = serport_ldisc_read, | 272 | .read = serport_ldisc_read, |
245 | .ioctl = serport_ldisc_ioctl, | 273 | .ioctl = serport_ldisc_ioctl, |
274 | #ifdef CONFIG_COMPAT | ||
275 | .compat_ioctl = serport_ldisc_compat_ioctl, | ||
276 | #endif | ||
246 | .receive_buf = serport_ldisc_receive, | 277 | .receive_buf = serport_ldisc_receive, |
247 | .write_wakeup = serport_ldisc_write_wakeup | 278 | .write_wakeup = serport_ldisc_write_wakeup |
248 | }; | 279 | }; |
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index db178ed2b47e..aaacf8bfa61f 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -837,7 +837,12 @@ static irqreturn_t mxt_process_messages_t44(struct mxt_data *data) | |||
837 | count = data->msg_buf[0]; | 837 | count = data->msg_buf[0]; |
838 | 838 | ||
839 | if (count == 0) { | 839 | if (count == 0) { |
840 | dev_warn(dev, "Interrupt triggered but zero messages\n"); | 840 | /* |
841 | * This condition is caused by the CHG line being configured | ||
842 | * in Mode 0. It results in unnecessary I2C operations but it | ||
843 | * is benign. | ||
844 | */ | ||
845 | dev_dbg(dev, "Interrupt triggered but zero messages\n"); | ||
841 | return IRQ_NONE; | 846 | return IRQ_NONE; |
842 | } else if (count > data->max_reportid) { | 847 | } else if (count > data->max_reportid) { |
843 | dev_err(dev, "T44 count %d exceeded max report id\n", count); | 848 | dev_err(dev, "T44 count %d exceeded max report id\n", count); |
@@ -1374,11 +1379,16 @@ static int mxt_get_info(struct mxt_data *data) | |||
1374 | return 0; | 1379 | return 0; |
1375 | } | 1380 | } |
1376 | 1381 | ||
1377 | static void mxt_free_object_table(struct mxt_data *data) | 1382 | static void mxt_free_input_device(struct mxt_data *data) |
1378 | { | 1383 | { |
1379 | input_unregister_device(data->input_dev); | 1384 | if (data->input_dev) { |
1380 | data->input_dev = NULL; | 1385 | input_unregister_device(data->input_dev); |
1386 | data->input_dev = NULL; | ||
1387 | } | ||
1388 | } | ||
1381 | 1389 | ||
1390 | static void mxt_free_object_table(struct mxt_data *data) | ||
1391 | { | ||
1382 | kfree(data->object_table); | 1392 | kfree(data->object_table); |
1383 | data->object_table = NULL; | 1393 | data->object_table = NULL; |
1384 | kfree(data->msg_buf); | 1394 | kfree(data->msg_buf); |
@@ -1957,11 +1967,13 @@ static int mxt_load_fw(struct device *dev, const char *fn) | |||
1957 | ret = mxt_lookup_bootloader_address(data, 0); | 1967 | ret = mxt_lookup_bootloader_address(data, 0); |
1958 | if (ret) | 1968 | if (ret) |
1959 | goto release_firmware; | 1969 | goto release_firmware; |
1970 | |||
1971 | mxt_free_input_device(data); | ||
1972 | mxt_free_object_table(data); | ||
1960 | } else { | 1973 | } else { |
1961 | enable_irq(data->irq); | 1974 | enable_irq(data->irq); |
1962 | } | 1975 | } |
1963 | 1976 | ||
1964 | mxt_free_object_table(data); | ||
1965 | reinit_completion(&data->bl_completion); | 1977 | reinit_completion(&data->bl_completion); |
1966 | 1978 | ||
1967 | ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD, false); | 1979 | ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD, false); |
@@ -2210,6 +2222,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
2210 | return 0; | 2222 | return 0; |
2211 | 2223 | ||
2212 | err_free_object: | 2224 | err_free_object: |
2225 | mxt_free_input_device(data); | ||
2213 | mxt_free_object_table(data); | 2226 | mxt_free_object_table(data); |
2214 | err_free_irq: | 2227 | err_free_irq: |
2215 | free_irq(client->irq, data); | 2228 | free_irq(client->irq, data); |
@@ -2224,7 +2237,7 @@ static int mxt_remove(struct i2c_client *client) | |||
2224 | 2237 | ||
2225 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); | 2238 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); |
2226 | free_irq(data->irq, data); | 2239 | free_irq(data->irq, data); |
2227 | input_unregister_device(data->input_dev); | 2240 | mxt_free_input_device(data); |
2228 | mxt_free_object_table(data); | 2241 | mxt_free_object_table(data); |
2229 | kfree(data); | 2242 | kfree(data); |
2230 | 2243 | ||
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c index 16b52115c27f..705ffa1e064a 100644 --- a/drivers/input/touchscreen/wm9712.c +++ b/drivers/input/touchscreen/wm9712.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | static int rpu = 8; | 42 | static int rpu = 8; |
43 | module_param(rpu, int, 0); | 43 | module_param(rpu, int, 0); |
44 | MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect."); | 44 | MODULE_PARM_DESC(rpu, "Set internal pull up resistor for pen detect."); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Set current used for pressure measurement. | 47 | * Set current used for pressure measurement. |
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c index 7405353199d7..572a5a64face 100644 --- a/drivers/input/touchscreen/wm9713.c +++ b/drivers/input/touchscreen/wm9713.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | static int rpu = 8; | 42 | static int rpu = 8; |
43 | module_param(rpu, int, 0); | 43 | module_param(rpu, int, 0); |
44 | MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect."); | 44 | MODULE_PARM_DESC(rpu, "Set internal pull up resistor for pen detect."); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Set current used for pressure measurement. | 47 | * Set current used for pressure measurement. |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 18405314168b..ecb0109a5360 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -3149,14 +3149,16 @@ free_domains: | |||
3149 | 3149 | ||
3150 | static void cleanup_domain(struct protection_domain *domain) | 3150 | static void cleanup_domain(struct protection_domain *domain) |
3151 | { | 3151 | { |
3152 | struct iommu_dev_data *dev_data, *next; | 3152 | struct iommu_dev_data *entry; |
3153 | unsigned long flags; | 3153 | unsigned long flags; |
3154 | 3154 | ||
3155 | write_lock_irqsave(&amd_iommu_devtable_lock, flags); | 3155 | write_lock_irqsave(&amd_iommu_devtable_lock, flags); |
3156 | 3156 | ||
3157 | list_for_each_entry_safe(dev_data, next, &domain->dev_list, list) { | 3157 | while (!list_empty(&domain->dev_list)) { |
3158 | __detach_device(dev_data); | 3158 | entry = list_first_entry(&domain->dev_list, |
3159 | atomic_set(&dev_data->bind, 0); | 3159 | struct iommu_dev_data, list); |
3160 | __detach_device(entry); | ||
3161 | atomic_set(&entry->bind, 0); | ||
3160 | } | 3162 | } |
3161 | 3163 | ||
3162 | write_unlock_irqrestore(&amd_iommu_devtable_lock, flags); | 3164 | write_unlock_irqrestore(&amd_iommu_devtable_lock, flags); |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index ca18d6d42a9b..a83cc2a2a2ca 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -146,6 +146,8 @@ | |||
146 | #define ID0_CTTW (1 << 14) | 146 | #define ID0_CTTW (1 << 14) |
147 | #define ID0_NUMIRPT_SHIFT 16 | 147 | #define ID0_NUMIRPT_SHIFT 16 |
148 | #define ID0_NUMIRPT_MASK 0xff | 148 | #define ID0_NUMIRPT_MASK 0xff |
149 | #define ID0_NUMSIDB_SHIFT 9 | ||
150 | #define ID0_NUMSIDB_MASK 0xf | ||
149 | #define ID0_NUMSMRG_SHIFT 0 | 151 | #define ID0_NUMSMRG_SHIFT 0 |
150 | #define ID0_NUMSMRG_MASK 0xff | 152 | #define ID0_NUMSMRG_MASK 0xff |
151 | 153 | ||
@@ -524,9 +526,18 @@ static int register_smmu_master(struct arm_smmu_device *smmu, | |||
524 | master->of_node = masterspec->np; | 526 | master->of_node = masterspec->np; |
525 | master->cfg.num_streamids = masterspec->args_count; | 527 | master->cfg.num_streamids = masterspec->args_count; |
526 | 528 | ||
527 | for (i = 0; i < master->cfg.num_streamids; ++i) | 529 | for (i = 0; i < master->cfg.num_streamids; ++i) { |
528 | master->cfg.streamids[i] = masterspec->args[i]; | 530 | u16 streamid = masterspec->args[i]; |
529 | 531 | ||
532 | if (!(smmu->features & ARM_SMMU_FEAT_STREAM_MATCH) && | ||
533 | (streamid >= smmu->num_mapping_groups)) { | ||
534 | dev_err(dev, | ||
535 | "stream ID for master device %s greater than maximum allowed (%d)\n", | ||
536 | masterspec->np->name, smmu->num_mapping_groups); | ||
537 | return -ERANGE; | ||
538 | } | ||
539 | master->cfg.streamids[i] = streamid; | ||
540 | } | ||
530 | return insert_smmu_master(smmu, master); | 541 | return insert_smmu_master(smmu, master); |
531 | } | 542 | } |
532 | 543 | ||
@@ -623,7 +634,7 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) | |||
623 | 634 | ||
624 | if (fsr & FSR_IGN) | 635 | if (fsr & FSR_IGN) |
625 | dev_err_ratelimited(smmu->dev, | 636 | dev_err_ratelimited(smmu->dev, |
626 | "Unexpected context fault (fsr 0x%u)\n", | 637 | "Unexpected context fault (fsr 0x%x)\n", |
627 | fsr); | 638 | fsr); |
628 | 639 | ||
629 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); | 640 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); |
@@ -752,6 +763,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
752 | reg = (TTBCR2_ADDR_36 << TTBCR2_SEP_SHIFT); | 763 | reg = (TTBCR2_ADDR_36 << TTBCR2_SEP_SHIFT); |
753 | break; | 764 | break; |
754 | case 39: | 765 | case 39: |
766 | case 40: | ||
755 | reg = (TTBCR2_ADDR_40 << TTBCR2_SEP_SHIFT); | 767 | reg = (TTBCR2_ADDR_40 << TTBCR2_SEP_SHIFT); |
756 | break; | 768 | break; |
757 | case 42: | 769 | case 42: |
@@ -773,6 +785,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
773 | reg |= (TTBCR2_ADDR_36 << TTBCR2_PASIZE_SHIFT); | 785 | reg |= (TTBCR2_ADDR_36 << TTBCR2_PASIZE_SHIFT); |
774 | break; | 786 | break; |
775 | case 39: | 787 | case 39: |
788 | case 40: | ||
776 | reg |= (TTBCR2_ADDR_40 << TTBCR2_PASIZE_SHIFT); | 789 | reg |= (TTBCR2_ADDR_40 << TTBCR2_PASIZE_SHIFT); |
777 | break; | 790 | break; |
778 | case 42: | 791 | case 42: |
@@ -843,8 +856,11 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
843 | reg |= TTBCR_EAE | | 856 | reg |= TTBCR_EAE | |
844 | (TTBCR_SH_IS << TTBCR_SH0_SHIFT) | | 857 | (TTBCR_SH_IS << TTBCR_SH0_SHIFT) | |
845 | (TTBCR_RGN_WBWA << TTBCR_ORGN0_SHIFT) | | 858 | (TTBCR_RGN_WBWA << TTBCR_ORGN0_SHIFT) | |
846 | (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT) | | 859 | (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT); |
847 | (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); | 860 | |
861 | if (!stage1) | ||
862 | reg |= (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); | ||
863 | |||
848 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); | 864 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); |
849 | 865 | ||
850 | /* MAIR0 (stage-1 only) */ | 866 | /* MAIR0 (stage-1 only) */ |
@@ -868,10 +884,15 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
868 | static int arm_smmu_init_domain_context(struct iommu_domain *domain, | 884 | static int arm_smmu_init_domain_context(struct iommu_domain *domain, |
869 | struct arm_smmu_device *smmu) | 885 | struct arm_smmu_device *smmu) |
870 | { | 886 | { |
871 | int irq, ret, start; | 887 | int irq, start, ret = 0; |
888 | unsigned long flags; | ||
872 | struct arm_smmu_domain *smmu_domain = domain->priv; | 889 | struct arm_smmu_domain *smmu_domain = domain->priv; |
873 | struct arm_smmu_cfg *cfg = &smmu_domain->cfg; | 890 | struct arm_smmu_cfg *cfg = &smmu_domain->cfg; |
874 | 891 | ||
892 | spin_lock_irqsave(&smmu_domain->lock, flags); | ||
893 | if (smmu_domain->smmu) | ||
894 | goto out_unlock; | ||
895 | |||
875 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { | 896 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { |
876 | /* | 897 | /* |
877 | * We will likely want to change this if/when KVM gets | 898 | * We will likely want to change this if/when KVM gets |
@@ -890,7 +911,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
890 | ret = __arm_smmu_alloc_bitmap(smmu->context_map, start, | 911 | ret = __arm_smmu_alloc_bitmap(smmu->context_map, start, |
891 | smmu->num_context_banks); | 912 | smmu->num_context_banks); |
892 | if (IS_ERR_VALUE(ret)) | 913 | if (IS_ERR_VALUE(ret)) |
893 | return ret; | 914 | goto out_unlock; |
894 | 915 | ||
895 | cfg->cbndx = ret; | 916 | cfg->cbndx = ret; |
896 | if (smmu->version == 1) { | 917 | if (smmu->version == 1) { |
@@ -900,6 +921,10 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
900 | cfg->irptndx = cfg->cbndx; | 921 | cfg->irptndx = cfg->cbndx; |
901 | } | 922 | } |
902 | 923 | ||
924 | ACCESS_ONCE(smmu_domain->smmu) = smmu; | ||
925 | arm_smmu_init_context_bank(smmu_domain); | ||
926 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
927 | |||
903 | irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; | 928 | irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; |
904 | ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, | 929 | ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, |
905 | "arm-smmu-context-fault", domain); | 930 | "arm-smmu-context-fault", domain); |
@@ -907,15 +932,12 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
907 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", | 932 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", |
908 | cfg->irptndx, irq); | 933 | cfg->irptndx, irq); |
909 | cfg->irptndx = INVALID_IRPTNDX; | 934 | cfg->irptndx = INVALID_IRPTNDX; |
910 | goto out_free_context; | ||
911 | } | 935 | } |
912 | 936 | ||
913 | smmu_domain->smmu = smmu; | ||
914 | arm_smmu_init_context_bank(smmu_domain); | ||
915 | return 0; | 937 | return 0; |
916 | 938 | ||
917 | out_free_context: | 939 | out_unlock: |
918 | __arm_smmu_free_bitmap(smmu->context_map, cfg->cbndx); | 940 | spin_unlock_irqrestore(&smmu_domain->lock, flags); |
919 | return ret; | 941 | return ret; |
920 | } | 942 | } |
921 | 943 | ||
@@ -975,7 +997,6 @@ static void arm_smmu_free_ptes(pmd_t *pmd) | |||
975 | { | 997 | { |
976 | pgtable_t table = pmd_pgtable(*pmd); | 998 | pgtable_t table = pmd_pgtable(*pmd); |
977 | 999 | ||
978 | pgtable_page_dtor(table); | ||
979 | __free_page(table); | 1000 | __free_page(table); |
980 | } | 1001 | } |
981 | 1002 | ||
@@ -1108,6 +1129,9 @@ static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu, | |||
1108 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | 1129 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); |
1109 | struct arm_smmu_smr *smrs = cfg->smrs; | 1130 | struct arm_smmu_smr *smrs = cfg->smrs; |
1110 | 1131 | ||
1132 | if (!smrs) | ||
1133 | return; | ||
1134 | |||
1111 | /* Invalidate the SMRs before freeing back to the allocator */ | 1135 | /* Invalidate the SMRs before freeing back to the allocator */ |
1112 | for (i = 0; i < cfg->num_streamids; ++i) { | 1136 | for (i = 0; i < cfg->num_streamids; ++i) { |
1113 | u8 idx = smrs[i].idx; | 1137 | u8 idx = smrs[i].idx; |
@@ -1120,20 +1144,6 @@ static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu, | |||
1120 | kfree(smrs); | 1144 | kfree(smrs); |
1121 | } | 1145 | } |
1122 | 1146 | ||
1123 | static void arm_smmu_bypass_stream_mapping(struct arm_smmu_device *smmu, | ||
1124 | struct arm_smmu_master_cfg *cfg) | ||
1125 | { | ||
1126 | int i; | ||
1127 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | ||
1128 | |||
1129 | for (i = 0; i < cfg->num_streamids; ++i) { | ||
1130 | u16 sid = cfg->streamids[i]; | ||
1131 | |||
1132 | writel_relaxed(S2CR_TYPE_BYPASS, | ||
1133 | gr0_base + ARM_SMMU_GR0_S2CR(sid)); | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, | 1147 | static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, |
1138 | struct arm_smmu_master_cfg *cfg) | 1148 | struct arm_smmu_master_cfg *cfg) |
1139 | { | 1149 | { |
@@ -1160,23 +1170,30 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, | |||
1160 | static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain, | 1170 | static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain, |
1161 | struct arm_smmu_master_cfg *cfg) | 1171 | struct arm_smmu_master_cfg *cfg) |
1162 | { | 1172 | { |
1173 | int i; | ||
1163 | struct arm_smmu_device *smmu = smmu_domain->smmu; | 1174 | struct arm_smmu_device *smmu = smmu_domain->smmu; |
1175 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | ||
1164 | 1176 | ||
1165 | /* | 1177 | /* |
1166 | * We *must* clear the S2CR first, because freeing the SMR means | 1178 | * We *must* clear the S2CR first, because freeing the SMR means |
1167 | * that it can be re-allocated immediately. | 1179 | * that it can be re-allocated immediately. |
1168 | */ | 1180 | */ |
1169 | arm_smmu_bypass_stream_mapping(smmu, cfg); | 1181 | for (i = 0; i < cfg->num_streamids; ++i) { |
1182 | u32 idx = cfg->smrs ? cfg->smrs[i].idx : cfg->streamids[i]; | ||
1183 | |||
1184 | writel_relaxed(S2CR_TYPE_BYPASS, | ||
1185 | gr0_base + ARM_SMMU_GR0_S2CR(idx)); | ||
1186 | } | ||
1187 | |||
1170 | arm_smmu_master_free_smrs(smmu, cfg); | 1188 | arm_smmu_master_free_smrs(smmu, cfg); |
1171 | } | 1189 | } |
1172 | 1190 | ||
1173 | static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | 1191 | static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) |
1174 | { | 1192 | { |
1175 | int ret = -EINVAL; | 1193 | int ret; |
1176 | struct arm_smmu_domain *smmu_domain = domain->priv; | 1194 | struct arm_smmu_domain *smmu_domain = domain->priv; |
1177 | struct arm_smmu_device *smmu; | 1195 | struct arm_smmu_device *smmu, *dom_smmu; |
1178 | struct arm_smmu_master_cfg *cfg; | 1196 | struct arm_smmu_master_cfg *cfg; |
1179 | unsigned long flags; | ||
1180 | 1197 | ||
1181 | smmu = dev_get_master_dev(dev)->archdata.iommu; | 1198 | smmu = dev_get_master_dev(dev)->archdata.iommu; |
1182 | if (!smmu) { | 1199 | if (!smmu) { |
@@ -1188,20 +1205,22 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1188 | * Sanity check the domain. We don't support domains across | 1205 | * Sanity check the domain. We don't support domains across |
1189 | * different SMMUs. | 1206 | * different SMMUs. |
1190 | */ | 1207 | */ |
1191 | spin_lock_irqsave(&smmu_domain->lock, flags); | 1208 | dom_smmu = ACCESS_ONCE(smmu_domain->smmu); |
1192 | if (!smmu_domain->smmu) { | 1209 | if (!dom_smmu) { |
1193 | /* Now that we have a master, we can finalise the domain */ | 1210 | /* Now that we have a master, we can finalise the domain */ |
1194 | ret = arm_smmu_init_domain_context(domain, smmu); | 1211 | ret = arm_smmu_init_domain_context(domain, smmu); |
1195 | if (IS_ERR_VALUE(ret)) | 1212 | if (IS_ERR_VALUE(ret)) |
1196 | goto err_unlock; | 1213 | return ret; |
1197 | } else if (smmu_domain->smmu != smmu) { | 1214 | |
1215 | dom_smmu = smmu_domain->smmu; | ||
1216 | } | ||
1217 | |||
1218 | if (dom_smmu != smmu) { | ||
1198 | dev_err(dev, | 1219 | dev_err(dev, |
1199 | "cannot attach to SMMU %s whilst already attached to domain on SMMU %s\n", | 1220 | "cannot attach to SMMU %s whilst already attached to domain on SMMU %s\n", |
1200 | dev_name(smmu_domain->smmu->dev), | 1221 | dev_name(smmu_domain->smmu->dev), dev_name(smmu->dev)); |
1201 | dev_name(smmu->dev)); | 1222 | return -EINVAL; |
1202 | goto err_unlock; | ||
1203 | } | 1223 | } |
1204 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
1205 | 1224 | ||
1206 | /* Looks ok, so add the device to the domain */ | 1225 | /* Looks ok, so add the device to the domain */ |
1207 | cfg = find_smmu_master_cfg(smmu_domain->smmu, dev); | 1226 | cfg = find_smmu_master_cfg(smmu_domain->smmu, dev); |
@@ -1209,10 +1228,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1209 | return -ENODEV; | 1228 | return -ENODEV; |
1210 | 1229 | ||
1211 | return arm_smmu_domain_add_master(smmu_domain, cfg); | 1230 | return arm_smmu_domain_add_master(smmu_domain, cfg); |
1212 | |||
1213 | err_unlock: | ||
1214 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
1215 | return ret; | ||
1216 | } | 1231 | } |
1217 | 1232 | ||
1218 | static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) | 1233 | static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) |
@@ -1247,10 +1262,6 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, | |||
1247 | return -ENOMEM; | 1262 | return -ENOMEM; |
1248 | 1263 | ||
1249 | arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE); | 1264 | arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE); |
1250 | if (!pgtable_page_ctor(table)) { | ||
1251 | __free_page(table); | ||
1252 | return -ENOMEM; | ||
1253 | } | ||
1254 | pmd_populate(NULL, pmd, table); | 1265 | pmd_populate(NULL, pmd, table); |
1255 | arm_smmu_flush_pgtable(smmu, pmd, sizeof(*pmd)); | 1266 | arm_smmu_flush_pgtable(smmu, pmd, sizeof(*pmd)); |
1256 | } | 1267 | } |
@@ -1626,7 +1637,7 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu) | |||
1626 | 1637 | ||
1627 | /* Mark all SMRn as invalid and all S2CRn as bypass */ | 1638 | /* Mark all SMRn as invalid and all S2CRn as bypass */ |
1628 | for (i = 0; i < smmu->num_mapping_groups; ++i) { | 1639 | for (i = 0; i < smmu->num_mapping_groups; ++i) { |
1629 | writel_relaxed(~SMR_VALID, gr0_base + ARM_SMMU_GR0_SMR(i)); | 1640 | writel_relaxed(0, gr0_base + ARM_SMMU_GR0_SMR(i)); |
1630 | writel_relaxed(S2CR_TYPE_BYPASS, | 1641 | writel_relaxed(S2CR_TYPE_BYPASS, |
1631 | gr0_base + ARM_SMMU_GR0_S2CR(i)); | 1642 | gr0_base + ARM_SMMU_GR0_S2CR(i)); |
1632 | } | 1643 | } |
@@ -1761,6 +1772,9 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1761 | dev_notice(smmu->dev, | 1772 | dev_notice(smmu->dev, |
1762 | "\tstream matching with %u register groups, mask 0x%x", | 1773 | "\tstream matching with %u register groups, mask 0x%x", |
1763 | smmu->num_mapping_groups, mask); | 1774 | smmu->num_mapping_groups, mask); |
1775 | } else { | ||
1776 | smmu->num_mapping_groups = (id >> ID0_NUMSIDB_SHIFT) & | ||
1777 | ID0_NUMSIDB_MASK; | ||
1764 | } | 1778 | } |
1765 | 1779 | ||
1766 | /* ID1 */ | 1780 | /* ID1 */ |
@@ -1794,11 +1808,16 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1794 | * Stage-1 output limited by stage-2 input size due to pgd | 1808 | * Stage-1 output limited by stage-2 input size due to pgd |
1795 | * allocation (PTRS_PER_PGD). | 1809 | * allocation (PTRS_PER_PGD). |
1796 | */ | 1810 | */ |
1811 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { | ||
1797 | #ifdef CONFIG_64BIT | 1812 | #ifdef CONFIG_64BIT |
1798 | smmu->s1_output_size = min_t(unsigned long, VA_BITS, size); | 1813 | smmu->s1_output_size = min_t(unsigned long, VA_BITS, size); |
1799 | #else | 1814 | #else |
1800 | smmu->s1_output_size = min(32UL, size); | 1815 | smmu->s1_output_size = min(32UL, size); |
1801 | #endif | 1816 | #endif |
1817 | } else { | ||
1818 | smmu->s1_output_size = min_t(unsigned long, PHYS_MASK_SHIFT, | ||
1819 | size); | ||
1820 | } | ||
1802 | 1821 | ||
1803 | /* The stage-2 output mask is also applied for bypass */ | 1822 | /* The stage-2 output mask is also applied for bypass */ |
1804 | size = arm_smmu_id_size_to_bits((id >> ID2_OAS_SHIFT) & ID2_OAS_MASK); | 1823 | size = arm_smmu_id_size_to_bits((id >> ID2_OAS_SHIFT) & ID2_OAS_MASK); |
@@ -1889,6 +1908,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1889 | smmu->irqs[i] = irq; | 1908 | smmu->irqs[i] = irq; |
1890 | } | 1909 | } |
1891 | 1910 | ||
1911 | err = arm_smmu_device_cfg_probe(smmu); | ||
1912 | if (err) | ||
1913 | return err; | ||
1914 | |||
1892 | i = 0; | 1915 | i = 0; |
1893 | smmu->masters = RB_ROOT; | 1916 | smmu->masters = RB_ROOT; |
1894 | while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters", | 1917 | while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters", |
@@ -1905,10 +1928,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1905 | } | 1928 | } |
1906 | dev_notice(dev, "registered %d master devices\n", i); | 1929 | dev_notice(dev, "registered %d master devices\n", i); |
1907 | 1930 | ||
1908 | err = arm_smmu_device_cfg_probe(smmu); | ||
1909 | if (err) | ||
1910 | goto out_put_masters; | ||
1911 | |||
1912 | parse_driver_options(smmu); | 1931 | parse_driver_options(smmu); |
1913 | 1932 | ||
1914 | if (smmu->version > 1 && | 1933 | if (smmu->version > 1 && |
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 60ab474bfff3..06d268abe951 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -678,8 +678,7 @@ static int __init dmar_acpi_dev_scope_init(void) | |||
678 | andd->device_name); | 678 | andd->device_name); |
679 | continue; | 679 | continue; |
680 | } | 680 | } |
681 | acpi_bus_get_device(h, &adev); | 681 | if (acpi_bus_get_device(h, &adev)) { |
682 | if (!adev) { | ||
683 | pr_err("Failed to get device for ACPI object %s\n", | 682 | pr_err("Failed to get device for ACPI object %s\n", |
684 | andd->device_name); | 683 | andd->device_name); |
685 | continue; | 684 | continue; |
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 61d1dafa242d..56feed7cec15 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
@@ -984,7 +984,7 @@ static int fsl_pamu_add_device(struct device *dev) | |||
984 | struct iommu_group *group = ERR_PTR(-ENODEV); | 984 | struct iommu_group *group = ERR_PTR(-ENODEV); |
985 | struct pci_dev *pdev; | 985 | struct pci_dev *pdev; |
986 | const u32 *prop; | 986 | const u32 *prop; |
987 | int ret, len; | 987 | int ret = 0, len; |
988 | 988 | ||
989 | /* | 989 | /* |
990 | * For platform devices we allocate a separate group for | 990 | * For platform devices we allocate a separate group for |
@@ -1007,7 +1007,13 @@ static int fsl_pamu_add_device(struct device *dev) | |||
1007 | if (IS_ERR(group)) | 1007 | if (IS_ERR(group)) |
1008 | return PTR_ERR(group); | 1008 | return PTR_ERR(group); |
1009 | 1009 | ||
1010 | ret = iommu_group_add_device(group, dev); | 1010 | /* |
1011 | * Check if device has already been added to an iommu group. | ||
1012 | * Group could have already been created for a PCI device in | ||
1013 | * the iommu_group_get_for_dev path. | ||
1014 | */ | ||
1015 | if (!dev->iommu_group) | ||
1016 | ret = iommu_group_add_device(group, dev); | ||
1011 | 1017 | ||
1012 | iommu_group_put(group); | 1018 | iommu_group_put(group); |
1013 | return ret; | 1019 | return ret; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index d1f5caad04f9..5619f264862d 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -3869,6 +3869,14 @@ static int device_notifier(struct notifier_block *nb, | |||
3869 | action != BUS_NOTIFY_DEL_DEVICE) | 3869 | action != BUS_NOTIFY_DEL_DEVICE) |
3870 | return 0; | 3870 | return 0; |
3871 | 3871 | ||
3872 | /* | ||
3873 | * If the device is still attached to a device driver we can't | ||
3874 | * tear down the domain yet as DMA mappings may still be in use. | ||
3875 | * Wait for the BUS_NOTIFY_UNBOUND_DRIVER event to do that. | ||
3876 | */ | ||
3877 | if (action == BUS_NOTIFY_DEL_DEVICE && dev->driver != NULL) | ||
3878 | return 0; | ||
3879 | |||
3872 | domain = find_domain(dev); | 3880 | domain = find_domain(dev); |
3873 | if (!domain) | 3881 | if (!domain) |
3874 | return 0; | 3882 | return 0; |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 169836020208..0639b9274b11 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -678,15 +678,17 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev) | |||
678 | */ | 678 | */ |
679 | struct iommu_group *iommu_group_get_for_dev(struct device *dev) | 679 | struct iommu_group *iommu_group_get_for_dev(struct device *dev) |
680 | { | 680 | { |
681 | struct iommu_group *group = ERR_PTR(-EIO); | 681 | struct iommu_group *group; |
682 | int ret; | 682 | int ret; |
683 | 683 | ||
684 | group = iommu_group_get(dev); | 684 | group = iommu_group_get(dev); |
685 | if (group) | 685 | if (group) |
686 | return group; | 686 | return group; |
687 | 687 | ||
688 | if (dev_is_pci(dev)) | 688 | if (!dev_is_pci(dev)) |
689 | group = iommu_group_get_for_pci_dev(to_pci_dev(dev)); | 689 | return ERR_PTR(-EINVAL); |
690 | |||
691 | group = iommu_group_get_for_pci_dev(to_pci_dev(dev)); | ||
690 | 692 | ||
691 | if (IS_ERR(group)) | 693 | if (IS_ERR(group)) |
692 | return group; | 694 | return group; |
@@ -995,7 +997,7 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova, | |||
995 | size_t orig_size = size; | 997 | size_t orig_size = size; |
996 | int ret = 0; | 998 | int ret = 0; |
997 | 999 | ||
998 | if (unlikely(domain->ops->unmap == NULL || | 1000 | if (unlikely(domain->ops->map == NULL || |
999 | domain->ops->pgsize_bitmap == 0UL)) | 1001 | domain->ops->pgsize_bitmap == 0UL)) |
1000 | return -ENODEV; | 1002 | return -ENODEV; |
1001 | 1003 | ||
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c index f8636a650cf6..5945223b73fa 100644 --- a/drivers/irqchip/exynos-combiner.c +++ b/drivers/irqchip/exynos-combiner.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/irqdomain.h> | 16 | #include <linux/irqdomain.h> |
17 | #include <linux/irqchip/chained_irq.h> | 17 | #include <linux/irqchip/chained_irq.h> |
18 | #include <linux/interrupt.h> | ||
18 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
19 | #include <linux/of_irq.h> | 20 | #include <linux/of_irq.h> |
20 | 21 | ||
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index 85c2985d8bcb..bbbaf5de65d2 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c | |||
@@ -220,7 +220,7 @@ static int __init crossbar_of_init(struct device_node *node) | |||
220 | of_property_read_u32_index(node, | 220 | of_property_read_u32_index(node, |
221 | "ti,irqs-reserved", | 221 | "ti,irqs-reserved", |
222 | i, &entry); | 222 | i, &entry); |
223 | if (entry > max) { | 223 | if (entry >= max) { |
224 | pr_err("Invalid reserved entry\n"); | 224 | pr_err("Invalid reserved entry\n"); |
225 | ret = -EINVAL; | 225 | ret = -EINVAL; |
226 | goto err_irq_map; | 226 | goto err_irq_map; |
@@ -238,7 +238,7 @@ static int __init crossbar_of_init(struct device_node *node) | |||
238 | of_property_read_u32_index(node, | 238 | of_property_read_u32_index(node, |
239 | "ti,irqs-skip", | 239 | "ti,irqs-skip", |
240 | i, &entry); | 240 | i, &entry); |
241 | if (entry > max) { | 241 | if (entry >= max) { |
242 | pr_err("Invalid skip entry\n"); | 242 | pr_err("Invalid skip entry\n"); |
243 | ret = -EINVAL; | 243 | ret = -EINVAL; |
244 | goto err_irq_map; | 244 | goto err_irq_map; |
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 57eaa5a0b1e3..a0698b4f0303 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c | |||
@@ -36,7 +36,7 @@ | |||
36 | struct gic_chip_data { | 36 | struct gic_chip_data { |
37 | void __iomem *dist_base; | 37 | void __iomem *dist_base; |
38 | void __iomem **redist_base; | 38 | void __iomem **redist_base; |
39 | void __percpu __iomem **rdist; | 39 | void __iomem * __percpu *rdist; |
40 | struct irq_domain *domain; | 40 | struct irq_domain *domain; |
41 | u64 redist_stride; | 41 | u64 redist_stride; |
42 | u32 redist_regions; | 42 | u32 redist_regions; |
@@ -104,7 +104,7 @@ static void gic_redist_wait_for_rwp(void) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /* Low level accessors */ | 106 | /* Low level accessors */ |
107 | static u64 gic_read_iar(void) | 107 | static u64 __maybe_unused gic_read_iar(void) |
108 | { | 108 | { |
109 | u64 irqstat; | 109 | u64 irqstat; |
110 | 110 | ||
@@ -112,24 +112,24 @@ static u64 gic_read_iar(void) | |||
112 | return irqstat; | 112 | return irqstat; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void gic_write_pmr(u64 val) | 115 | static void __maybe_unused gic_write_pmr(u64 val) |
116 | { | 116 | { |
117 | asm volatile("msr_s " __stringify(ICC_PMR_EL1) ", %0" : : "r" (val)); | 117 | asm volatile("msr_s " __stringify(ICC_PMR_EL1) ", %0" : : "r" (val)); |
118 | } | 118 | } |
119 | 119 | ||
120 | static void gic_write_ctlr(u64 val) | 120 | static void __maybe_unused gic_write_ctlr(u64 val) |
121 | { | 121 | { |
122 | asm volatile("msr_s " __stringify(ICC_CTLR_EL1) ", %0" : : "r" (val)); | 122 | asm volatile("msr_s " __stringify(ICC_CTLR_EL1) ", %0" : : "r" (val)); |
123 | isb(); | 123 | isb(); |
124 | } | 124 | } |
125 | 125 | ||
126 | static void gic_write_grpen1(u64 val) | 126 | static void __maybe_unused gic_write_grpen1(u64 val) |
127 | { | 127 | { |
128 | asm volatile("msr_s " __stringify(ICC_GRPEN1_EL1) ", %0" : : "r" (val)); | 128 | asm volatile("msr_s " __stringify(ICC_GRPEN1_EL1) ", %0" : : "r" (val)); |
129 | isb(); | 129 | isb(); |
130 | } | 130 | } |
131 | 131 | ||
132 | static void gic_write_sgi1r(u64 val) | 132 | static void __maybe_unused gic_write_sgi1r(u64 val) |
133 | { | 133 | { |
134 | asm volatile("msr_s " __stringify(ICC_SGI1R_EL1) ", %0" : : "r" (val)); | 134 | asm volatile("msr_s " __stringify(ICC_SGI1R_EL1) ", %0" : : "r" (val)); |
135 | } | 135 | } |
@@ -200,19 +200,6 @@ static void gic_poke_irq(struct irq_data *d, u32 offset) | |||
200 | rwp_wait(); | 200 | rwp_wait(); |
201 | } | 201 | } |
202 | 202 | ||
203 | static int gic_peek_irq(struct irq_data *d, u32 offset) | ||
204 | { | ||
205 | u32 mask = 1 << (gic_irq(d) % 32); | ||
206 | void __iomem *base; | ||
207 | |||
208 | if (gic_irq_in_rdist(d)) | ||
209 | base = gic_data_rdist_sgi_base(); | ||
210 | else | ||
211 | base = gic_data.dist_base; | ||
212 | |||
213 | return !!(readl_relaxed(base + offset + (gic_irq(d) / 32) * 4) & mask); | ||
214 | } | ||
215 | |||
216 | static void gic_mask_irq(struct irq_data *d) | 203 | static void gic_mask_irq(struct irq_data *d) |
217 | { | 204 | { |
218 | gic_poke_irq(d, GICD_ICENABLER); | 205 | gic_poke_irq(d, GICD_ICENABLER); |
@@ -401,6 +388,19 @@ static void gic_cpu_init(void) | |||
401 | } | 388 | } |
402 | 389 | ||
403 | #ifdef CONFIG_SMP | 390 | #ifdef CONFIG_SMP |
391 | static int gic_peek_irq(struct irq_data *d, u32 offset) | ||
392 | { | ||
393 | u32 mask = 1 << (gic_irq(d) % 32); | ||
394 | void __iomem *base; | ||
395 | |||
396 | if (gic_irq_in_rdist(d)) | ||
397 | base = gic_data_rdist_sgi_base(); | ||
398 | else | ||
399 | base = gic_data.dist_base; | ||
400 | |||
401 | return !!(readl_relaxed(base + offset + (gic_irq(d) / 32) * 4) & mask); | ||
402 | } | ||
403 | |||
404 | static int gic_secondary_init(struct notifier_block *nfb, | 404 | static int gic_secondary_init(struct notifier_block *nfb, |
405 | unsigned long action, void *hcpu) | 405 | unsigned long action, void *hcpu) |
406 | { | 406 | { |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 4b959e606fe8..dda6dbc23565 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -867,7 +867,7 @@ static int gic_routable_irq_domain_xlate(struct irq_domain *d, | |||
867 | return 0; | 867 | return 0; |
868 | } | 868 | } |
869 | 869 | ||
870 | const struct irq_domain_ops gic_default_routable_irq_domain_ops = { | 870 | static const struct irq_domain_ops gic_default_routable_irq_domain_ops = { |
871 | .map = gic_routable_irq_domain_map, | 871 | .map = gic_routable_irq_domain_map, |
872 | .unmap = gic_routable_irq_domain_unmap, | 872 | .unmap = gic_routable_irq_domain_unmap, |
873 | .xlate = gic_routable_irq_domain_xlate, | 873 | .xlate = gic_routable_irq_domain_xlate, |
diff --git a/drivers/isdn/hardware/eicon/xdi_msg.h b/drivers/isdn/hardware/eicon/xdi_msg.h index 58368f7b5cba..2498c349a32e 100644 --- a/drivers/isdn/hardware/eicon/xdi_msg.h +++ b/drivers/isdn/hardware/eicon/xdi_msg.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* $Id: xdi_msg.h,v 1.1.2.2 2001/02/16 08:40:36 armin Exp $ */ | 1 | /* $Id: xdi_msg.h,v 1.1.2.2 2001/02/16 08:40:36 armin Exp $ */ |
2 | 2 | ||
3 | #ifndef __DIVA_XDI_UM_CFG_MESSSGE_H__ | 3 | #ifndef __DIVA_XDI_UM_CFG_MESSAGE_H__ |
4 | #define __DIVA_XDI_UM_CFG_MESSAGE_H__ | 4 | #define __DIVA_XDI_UM_CFG_MESSAGE_H__ |
5 | 5 | ||
6 | /* | 6 | /* |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 129729d35478..aa29198fca3e 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -15,10 +15,10 @@ | |||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/timer.h> | ||
18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
19 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
20 | #include <linux/leds.h> | 21 | #include <linux/leds.h> |
21 | #include <linux/workqueue.h> | ||
22 | #include "leds.h" | 22 | #include "leds.h" |
23 | 23 | ||
24 | static struct class *leds_class; | 24 | static struct class *leds_class; |
@@ -97,10 +97,9 @@ static const struct attribute_group *led_groups[] = { | |||
97 | NULL, | 97 | NULL, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static void led_work_function(struct work_struct *ws) | 100 | static void led_timer_function(unsigned long data) |
101 | { | 101 | { |
102 | struct led_classdev *led_cdev = | 102 | struct led_classdev *led_cdev = (void *)data; |
103 | container_of(ws, struct led_classdev, blink_work.work); | ||
104 | unsigned long brightness; | 103 | unsigned long brightness; |
105 | unsigned long delay; | 104 | unsigned long delay; |
106 | 105 | ||
@@ -144,8 +143,7 @@ static void led_work_function(struct work_struct *ws) | |||
144 | } | 143 | } |
145 | } | 144 | } |
146 | 145 | ||
147 | queue_delayed_work(system_wq, &led_cdev->blink_work, | 146 | mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); |
148 | msecs_to_jiffies(delay)); | ||
149 | } | 147 | } |
150 | 148 | ||
151 | static void set_brightness_delayed(struct work_struct *ws) | 149 | static void set_brightness_delayed(struct work_struct *ws) |
@@ -233,7 +231,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
233 | 231 | ||
234 | INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); | 232 | INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); |
235 | 233 | ||
236 | INIT_DELAYED_WORK(&led_cdev->blink_work, led_work_function); | 234 | init_timer(&led_cdev->blink_timer); |
235 | led_cdev->blink_timer.function = led_timer_function; | ||
236 | led_cdev->blink_timer.data = (unsigned long)led_cdev; | ||
237 | 237 | ||
238 | #ifdef CONFIG_LEDS_TRIGGERS | 238 | #ifdef CONFIG_LEDS_TRIGGERS |
239 | led_trigger_set_default(led_cdev); | 239 | led_trigger_set_default(led_cdev); |
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index 4bb116867b88..71b40d3bf776 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/rwsem.h> | 17 | #include <linux/rwsem.h> |
18 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
19 | #include <linux/workqueue.h> | ||
20 | #include "leds.h" | 19 | #include "leds.h" |
21 | 20 | ||
22 | DECLARE_RWSEM(leds_list_lock); | 21 | DECLARE_RWSEM(leds_list_lock); |
@@ -52,7 +51,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev, | |||
52 | return; | 51 | return; |
53 | } | 52 | } |
54 | 53 | ||
55 | queue_delayed_work(system_wq, &led_cdev->blink_work, 1); | 54 | mod_timer(&led_cdev->blink_timer, jiffies + 1); |
56 | } | 55 | } |
57 | 56 | ||
58 | 57 | ||
@@ -76,7 +75,7 @@ void led_blink_set(struct led_classdev *led_cdev, | |||
76 | unsigned long *delay_on, | 75 | unsigned long *delay_on, |
77 | unsigned long *delay_off) | 76 | unsigned long *delay_off) |
78 | { | 77 | { |
79 | cancel_delayed_work_sync(&led_cdev->blink_work); | 78 | del_timer_sync(&led_cdev->blink_timer); |
80 | 79 | ||
81 | led_cdev->flags &= ~LED_BLINK_ONESHOT; | 80 | led_cdev->flags &= ~LED_BLINK_ONESHOT; |
82 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; | 81 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; |
@@ -91,7 +90,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev, | |||
91 | int invert) | 90 | int invert) |
92 | { | 91 | { |
93 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && | 92 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && |
94 | delayed_work_pending(&led_cdev->blink_work)) | 93 | timer_pending(&led_cdev->blink_timer)) |
95 | return; | 94 | return; |
96 | 95 | ||
97 | led_cdev->flags |= LED_BLINK_ONESHOT; | 96 | led_cdev->flags |= LED_BLINK_ONESHOT; |
@@ -108,7 +107,7 @@ EXPORT_SYMBOL(led_blink_set_oneshot); | |||
108 | 107 | ||
109 | void led_stop_software_blink(struct led_classdev *led_cdev) | 108 | void led_stop_software_blink(struct led_classdev *led_cdev) |
110 | { | 109 | { |
111 | cancel_delayed_work_sync(&led_cdev->blink_work); | 110 | del_timer_sync(&led_cdev->blink_timer); |
112 | led_cdev->blink_delay_on = 0; | 111 | led_cdev->blink_delay_on = 0; |
113 | led_cdev->blink_delay_off = 0; | 112 | led_cdev->blink_delay_off = 0; |
114 | } | 113 | } |
@@ -117,7 +116,7 @@ EXPORT_SYMBOL_GPL(led_stop_software_blink); | |||
117 | void led_set_brightness(struct led_classdev *led_cdev, | 116 | void led_set_brightness(struct led_classdev *led_cdev, |
118 | enum led_brightness brightness) | 117 | enum led_brightness brightness) |
119 | { | 118 | { |
120 | /* delay brightness setting if need to stop soft-blink work */ | 119 | /* delay brightness setting if need to stop soft-blink timer */ |
121 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { | 120 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { |
122 | led_cdev->delayed_set_value = brightness; | 121 | led_cdev->delayed_set_value = brightness; |
123 | schedule_work(&led_cdev->set_brightness_work); | 122 | schedule_work(&led_cdev->set_brightness_work); |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1af40ee209e2..7130505c2425 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -895,8 +895,8 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) | |||
895 | struct cache *cache = mg->cache; | 895 | struct cache *cache = mg->cache; |
896 | 896 | ||
897 | if (mg->writeback) { | 897 | if (mg->writeback) { |
898 | cell_defer(cache, mg->old_ocell, false); | ||
899 | clear_dirty(cache, mg->old_oblock, mg->cblock); | 898 | clear_dirty(cache, mg->old_oblock, mg->cblock); |
899 | cell_defer(cache, mg->old_ocell, false); | ||
900 | cleanup_migration(mg); | 900 | cleanup_migration(mg); |
901 | return; | 901 | return; |
902 | 902 | ||
@@ -951,13 +951,13 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) | |||
951 | } | 951 | } |
952 | 952 | ||
953 | } else { | 953 | } else { |
954 | clear_dirty(cache, mg->new_oblock, mg->cblock); | ||
954 | if (mg->requeue_holder) | 955 | if (mg->requeue_holder) |
955 | cell_defer(cache, mg->new_ocell, true); | 956 | cell_defer(cache, mg->new_ocell, true); |
956 | else { | 957 | else { |
957 | bio_endio(mg->new_ocell->holder, 0); | 958 | bio_endio(mg->new_ocell->holder, 0); |
958 | cell_defer(cache, mg->new_ocell, false); | 959 | cell_defer(cache, mg->new_ocell, false); |
959 | } | 960 | } |
960 | clear_dirty(cache, mg->new_oblock, mg->cblock); | ||
961 | cleanup_migration(mg); | 961 | cleanup_migration(mg); |
962 | } | 962 | } |
963 | } | 963 | } |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 2785007e0e46..cd15e0801228 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1688,6 +1688,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1688 | unsigned int key_size, opt_params; | 1688 | unsigned int key_size, opt_params; |
1689 | unsigned long long tmpll; | 1689 | unsigned long long tmpll; |
1690 | int ret; | 1690 | int ret; |
1691 | size_t iv_size_padding; | ||
1691 | struct dm_arg_set as; | 1692 | struct dm_arg_set as; |
1692 | const char *opt_string; | 1693 | const char *opt_string; |
1693 | char dummy; | 1694 | char dummy; |
@@ -1724,20 +1725,32 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1724 | 1725 | ||
1725 | cc->dmreq_start = sizeof(struct ablkcipher_request); | 1726 | cc->dmreq_start = sizeof(struct ablkcipher_request); |
1726 | cc->dmreq_start += crypto_ablkcipher_reqsize(any_tfm(cc)); | 1727 | cc->dmreq_start += crypto_ablkcipher_reqsize(any_tfm(cc)); |
1727 | cc->dmreq_start = ALIGN(cc->dmreq_start, crypto_tfm_ctx_alignment()); | 1728 | cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request)); |
1728 | cc->dmreq_start += crypto_ablkcipher_alignmask(any_tfm(cc)) & | 1729 | |
1729 | ~(crypto_tfm_ctx_alignment() - 1); | 1730 | if (crypto_ablkcipher_alignmask(any_tfm(cc)) < CRYPTO_MINALIGN) { |
1731 | /* Allocate the padding exactly */ | ||
1732 | iv_size_padding = -(cc->dmreq_start + sizeof(struct dm_crypt_request)) | ||
1733 | & crypto_ablkcipher_alignmask(any_tfm(cc)); | ||
1734 | } else { | ||
1735 | /* | ||
1736 | * If the cipher requires greater alignment than kmalloc | ||
1737 | * alignment, we don't know the exact position of the | ||
1738 | * initialization vector. We must assume worst case. | ||
1739 | */ | ||
1740 | iv_size_padding = crypto_ablkcipher_alignmask(any_tfm(cc)); | ||
1741 | } | ||
1730 | 1742 | ||
1731 | cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start + | 1743 | cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start + |
1732 | sizeof(struct dm_crypt_request) + cc->iv_size); | 1744 | sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size); |
1733 | if (!cc->req_pool) { | 1745 | if (!cc->req_pool) { |
1734 | ti->error = "Cannot allocate crypt request mempool"; | 1746 | ti->error = "Cannot allocate crypt request mempool"; |
1735 | goto bad; | 1747 | goto bad; |
1736 | } | 1748 | } |
1737 | 1749 | ||
1738 | cc->per_bio_data_size = ti->per_bio_data_size = | 1750 | cc->per_bio_data_size = ti->per_bio_data_size = |
1739 | sizeof(struct dm_crypt_io) + cc->dmreq_start + | 1751 | ALIGN(sizeof(struct dm_crypt_io) + cc->dmreq_start + |
1740 | sizeof(struct dm_crypt_request) + cc->iv_size; | 1752 | sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size, |
1753 | ARCH_KMALLOC_MINALIGN); | ||
1741 | 1754 | ||
1742 | cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); | 1755 | cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); |
1743 | if (!cc->page_pool) { | 1756 | if (!cc->page_pool) { |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d7690f86fdb9..55de4f6f7eaf 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -540,11 +540,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
540 | has_nonrot_disk = 0; | 540 | has_nonrot_disk = 0; |
541 | choose_next_idle = 0; | 541 | choose_next_idle = 0; |
542 | 542 | ||
543 | if (conf->mddev->recovery_cp < MaxSector && | 543 | choose_first = (conf->mddev->recovery_cp < this_sector + sectors); |
544 | (this_sector + sectors >= conf->next_resync)) | ||
545 | choose_first = 1; | ||
546 | else | ||
547 | choose_first = 0; | ||
548 | 544 | ||
549 | for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { | 545 | for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { |
550 | sector_t dist; | 546 | sector_t dist; |
@@ -831,7 +827,7 @@ static void flush_pending_writes(struct r1conf *conf) | |||
831 | * there is no normal IO happeing. It must arrange to call | 827 | * there is no normal IO happeing. It must arrange to call |
832 | * lower_barrier when the particular background IO completes. | 828 | * lower_barrier when the particular background IO completes. |
833 | */ | 829 | */ |
834 | static void raise_barrier(struct r1conf *conf) | 830 | static void raise_barrier(struct r1conf *conf, sector_t sector_nr) |
835 | { | 831 | { |
836 | spin_lock_irq(&conf->resync_lock); | 832 | spin_lock_irq(&conf->resync_lock); |
837 | 833 | ||
@@ -841,6 +837,7 @@ static void raise_barrier(struct r1conf *conf) | |||
841 | 837 | ||
842 | /* block any new IO from starting */ | 838 | /* block any new IO from starting */ |
843 | conf->barrier++; | 839 | conf->barrier++; |
840 | conf->next_resync = sector_nr; | ||
844 | 841 | ||
845 | /* For these conditions we must wait: | 842 | /* For these conditions we must wait: |
846 | * A: while the array is in frozen state | 843 | * A: while the array is in frozen state |
@@ -849,14 +846,17 @@ static void raise_barrier(struct r1conf *conf) | |||
849 | * C: next_resync + RESYNC_SECTORS > start_next_window, meaning | 846 | * C: next_resync + RESYNC_SECTORS > start_next_window, meaning |
850 | * next resync will reach to the window which normal bios are | 847 | * next resync will reach to the window which normal bios are |
851 | * handling. | 848 | * handling. |
849 | * D: while there are any active requests in the current window. | ||
852 | */ | 850 | */ |
853 | wait_event_lock_irq(conf->wait_barrier, | 851 | wait_event_lock_irq(conf->wait_barrier, |
854 | !conf->array_frozen && | 852 | !conf->array_frozen && |
855 | conf->barrier < RESYNC_DEPTH && | 853 | conf->barrier < RESYNC_DEPTH && |
854 | conf->current_window_requests == 0 && | ||
856 | (conf->start_next_window >= | 855 | (conf->start_next_window >= |
857 | conf->next_resync + RESYNC_SECTORS), | 856 | conf->next_resync + RESYNC_SECTORS), |
858 | conf->resync_lock); | 857 | conf->resync_lock); |
859 | 858 | ||
859 | conf->nr_pending++; | ||
860 | spin_unlock_irq(&conf->resync_lock); | 860 | spin_unlock_irq(&conf->resync_lock); |
861 | } | 861 | } |
862 | 862 | ||
@@ -866,6 +866,7 @@ static void lower_barrier(struct r1conf *conf) | |||
866 | BUG_ON(conf->barrier <= 0); | 866 | BUG_ON(conf->barrier <= 0); |
867 | spin_lock_irqsave(&conf->resync_lock, flags); | 867 | spin_lock_irqsave(&conf->resync_lock, flags); |
868 | conf->barrier--; | 868 | conf->barrier--; |
869 | conf->nr_pending--; | ||
869 | spin_unlock_irqrestore(&conf->resync_lock, flags); | 870 | spin_unlock_irqrestore(&conf->resync_lock, flags); |
870 | wake_up(&conf->wait_barrier); | 871 | wake_up(&conf->wait_barrier); |
871 | } | 872 | } |
@@ -877,12 +878,10 @@ static bool need_to_wait_for_sync(struct r1conf *conf, struct bio *bio) | |||
877 | if (conf->array_frozen || !bio) | 878 | if (conf->array_frozen || !bio) |
878 | wait = true; | 879 | wait = true; |
879 | else if (conf->barrier && bio_data_dir(bio) == WRITE) { | 880 | else if (conf->barrier && bio_data_dir(bio) == WRITE) { |
880 | if (conf->next_resync < RESYNC_WINDOW_SECTORS) | 881 | if ((conf->mddev->curr_resync_completed |
881 | wait = true; | 882 | >= bio_end_sector(bio)) || |
882 | else if ((conf->next_resync - RESYNC_WINDOW_SECTORS | 883 | (conf->next_resync + NEXT_NORMALIO_DISTANCE |
883 | >= bio_end_sector(bio)) || | 884 | <= bio->bi_iter.bi_sector)) |
884 | (conf->next_resync + NEXT_NORMALIO_DISTANCE | ||
885 | <= bio->bi_iter.bi_sector)) | ||
886 | wait = false; | 885 | wait = false; |
887 | else | 886 | else |
888 | wait = true; | 887 | wait = true; |
@@ -919,8 +918,8 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) | |||
919 | } | 918 | } |
920 | 919 | ||
921 | if (bio && bio_data_dir(bio) == WRITE) { | 920 | if (bio && bio_data_dir(bio) == WRITE) { |
922 | if (conf->next_resync + NEXT_NORMALIO_DISTANCE | 921 | if (bio->bi_iter.bi_sector >= |
923 | <= bio->bi_iter.bi_sector) { | 922 | conf->mddev->curr_resync_completed) { |
924 | if (conf->start_next_window == MaxSector) | 923 | if (conf->start_next_window == MaxSector) |
925 | conf->start_next_window = | 924 | conf->start_next_window = |
926 | conf->next_resync + | 925 | conf->next_resync + |
@@ -1186,6 +1185,7 @@ read_again: | |||
1186 | atomic_read(&bitmap->behind_writes) == 0); | 1185 | atomic_read(&bitmap->behind_writes) == 0); |
1187 | } | 1186 | } |
1188 | r1_bio->read_disk = rdisk; | 1187 | r1_bio->read_disk = rdisk; |
1188 | r1_bio->start_next_window = 0; | ||
1189 | 1189 | ||
1190 | read_bio = bio_clone_mddev(bio, GFP_NOIO, mddev); | 1190 | read_bio = bio_clone_mddev(bio, GFP_NOIO, mddev); |
1191 | bio_trim(read_bio, r1_bio->sector - bio->bi_iter.bi_sector, | 1191 | bio_trim(read_bio, r1_bio->sector - bio->bi_iter.bi_sector, |
@@ -1548,8 +1548,13 @@ static void close_sync(struct r1conf *conf) | |||
1548 | mempool_destroy(conf->r1buf_pool); | 1548 | mempool_destroy(conf->r1buf_pool); |
1549 | conf->r1buf_pool = NULL; | 1549 | conf->r1buf_pool = NULL; |
1550 | 1550 | ||
1551 | spin_lock_irq(&conf->resync_lock); | ||
1551 | conf->next_resync = 0; | 1552 | conf->next_resync = 0; |
1552 | conf->start_next_window = MaxSector; | 1553 | conf->start_next_window = MaxSector; |
1554 | conf->current_window_requests += | ||
1555 | conf->next_window_requests; | ||
1556 | conf->next_window_requests = 0; | ||
1557 | spin_unlock_irq(&conf->resync_lock); | ||
1553 | } | 1558 | } |
1554 | 1559 | ||
1555 | static int raid1_spare_active(struct mddev *mddev) | 1560 | static int raid1_spare_active(struct mddev *mddev) |
@@ -2150,7 +2155,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk, | |||
2150 | d--; | 2155 | d--; |
2151 | rdev = conf->mirrors[d].rdev; | 2156 | rdev = conf->mirrors[d].rdev; |
2152 | if (rdev && | 2157 | if (rdev && |
2153 | test_bit(In_sync, &rdev->flags)) | 2158 | !test_bit(Faulty, &rdev->flags)) |
2154 | r1_sync_page_io(rdev, sect, s, | 2159 | r1_sync_page_io(rdev, sect, s, |
2155 | conf->tmppage, WRITE); | 2160 | conf->tmppage, WRITE); |
2156 | } | 2161 | } |
@@ -2162,7 +2167,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk, | |||
2162 | d--; | 2167 | d--; |
2163 | rdev = conf->mirrors[d].rdev; | 2168 | rdev = conf->mirrors[d].rdev; |
2164 | if (rdev && | 2169 | if (rdev && |
2165 | test_bit(In_sync, &rdev->flags)) { | 2170 | !test_bit(Faulty, &rdev->flags)) { |
2166 | if (r1_sync_page_io(rdev, sect, s, | 2171 | if (r1_sync_page_io(rdev, sect, s, |
2167 | conf->tmppage, READ)) { | 2172 | conf->tmppage, READ)) { |
2168 | atomic_add(s, &rdev->corrected_errors); | 2173 | atomic_add(s, &rdev->corrected_errors); |
@@ -2541,9 +2546,8 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp | |||
2541 | 2546 | ||
2542 | bitmap_cond_end_sync(mddev->bitmap, sector_nr); | 2547 | bitmap_cond_end_sync(mddev->bitmap, sector_nr); |
2543 | r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); | 2548 | r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); |
2544 | raise_barrier(conf); | ||
2545 | 2549 | ||
2546 | conf->next_resync = sector_nr; | 2550 | raise_barrier(conf, sector_nr); |
2547 | 2551 | ||
2548 | rcu_read_lock(); | 2552 | rcu_read_lock(); |
2549 | /* | 2553 | /* |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index b08c18871323..6703751d87d7 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2953,6 +2953,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
2953 | */ | 2953 | */ |
2954 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) { | 2954 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) { |
2955 | end_reshape(conf); | 2955 | end_reshape(conf); |
2956 | close_sync(conf); | ||
2956 | return 0; | 2957 | return 0; |
2957 | } | 2958 | } |
2958 | 2959 | ||
@@ -3081,6 +3082,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3081 | } | 3082 | } |
3082 | 3083 | ||
3083 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); | 3084 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); |
3085 | r10_bio->state = 0; | ||
3084 | raise_barrier(conf, rb2 != NULL); | 3086 | raise_barrier(conf, rb2 != NULL); |
3085 | atomic_set(&r10_bio->remaining, 0); | 3087 | atomic_set(&r10_bio->remaining, 0); |
3086 | 3088 | ||
@@ -3269,6 +3271,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3269 | if (sync_blocks < max_sync) | 3271 | if (sync_blocks < max_sync) |
3270 | max_sync = sync_blocks; | 3272 | max_sync = sync_blocks; |
3271 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); | 3273 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); |
3274 | r10_bio->state = 0; | ||
3272 | 3275 | ||
3273 | r10_bio->mddev = mddev; | 3276 | r10_bio->mddev = mddev; |
3274 | atomic_set(&r10_bio->remaining, 0); | 3277 | atomic_set(&r10_bio->remaining, 0); |
@@ -4384,6 +4387,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, | |||
4384 | read_more: | 4387 | read_more: |
4385 | /* Now schedule reads for blocks from sector_nr to last */ | 4388 | /* Now schedule reads for blocks from sector_nr to last */ |
4386 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); | 4389 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); |
4390 | r10_bio->state = 0; | ||
4387 | raise_barrier(conf, sectors_done != 0); | 4391 | raise_barrier(conf, sectors_done != 0); |
4388 | atomic_set(&r10_bio->remaining, 0); | 4392 | atomic_set(&r10_bio->remaining, 0); |
4389 | r10_bio->mddev = mddev; | 4393 | r10_bio->mddev = mddev; |
@@ -4398,6 +4402,7 @@ read_more: | |||
4398 | * on all the target devices. | 4402 | * on all the target devices. |
4399 | */ | 4403 | */ |
4400 | // FIXME | 4404 | // FIXME |
4405 | mempool_free(r10_bio, conf->r10buf_pool); | ||
4401 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 4406 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
4402 | return sectors_done; | 4407 | return sectors_done; |
4403 | } | 4408 | } |
@@ -4410,7 +4415,7 @@ read_more: | |||
4410 | read_bio->bi_private = r10_bio; | 4415 | read_bio->bi_private = r10_bio; |
4411 | read_bio->bi_end_io = end_sync_read; | 4416 | read_bio->bi_end_io = end_sync_read; |
4412 | read_bio->bi_rw = READ; | 4417 | read_bio->bi_rw = READ; |
4413 | read_bio->bi_flags &= ~(BIO_POOL_MASK - 1); | 4418 | read_bio->bi_flags &= (~0UL << BIO_RESET_BITS); |
4414 | read_bio->bi_flags |= 1 << BIO_UPTODATE; | 4419 | read_bio->bi_flags |= 1 << BIO_UPTODATE; |
4415 | read_bio->bi_vcnt = 0; | 4420 | read_bio->bi_vcnt = 0; |
4416 | read_bio->bi_iter.bi_size = 0; | 4421 | read_bio->bi_iter.bi_size = 0; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6234b2e84587..183588b11fc1 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2922,7 +2922,7 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s, | |||
2922 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) && | 2922 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) && |
2923 | !test_bit(R5_OVERWRITE, &fdev[0]->flags)) || | 2923 | !test_bit(R5_OVERWRITE, &fdev[0]->flags)) || |
2924 | (sh->raid_conf->level == 6 && s->failed && s->to_write && | 2924 | (sh->raid_conf->level == 6 && s->failed && s->to_write && |
2925 | s->to_write < sh->raid_conf->raid_disks - 2 && | 2925 | s->to_write - s->non_overwrite < sh->raid_conf->raid_disks - 2 && |
2926 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))))) { | 2926 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))))) { |
2927 | /* we would like to get this block, possibly by computing it, | 2927 | /* we would like to get this block, possibly by computing it, |
2928 | * otherwise read it if the backing disk is insync | 2928 | * otherwise read it if the backing disk is insync |
@@ -3817,6 +3817,8 @@ static void handle_stripe(struct stripe_head *sh) | |||
3817 | set_bit(R5_Wantwrite, &dev->flags); | 3817 | set_bit(R5_Wantwrite, &dev->flags); |
3818 | if (prexor) | 3818 | if (prexor) |
3819 | continue; | 3819 | continue; |
3820 | if (s.failed > 1) | ||
3821 | continue; | ||
3820 | if (!test_bit(R5_Insync, &dev->flags) || | 3822 | if (!test_bit(R5_Insync, &dev->flags) || |
3821 | ((i == sh->pd_idx || i == sh->qd_idx) && | 3823 | ((i == sh->pd_idx || i == sh->qd_idx) && |
3822 | s.failed == 0)) | 3824 | s.failed == 0)) |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index f60bad491eb6..3c89fcbc621e 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -182,7 +182,6 @@ config MEDIA_SUBDRV_AUTOSELECT | |||
182 | depends on HAS_IOMEM | 182 | depends on HAS_IOMEM |
183 | select I2C | 183 | select I2C |
184 | select I2C_MUX | 184 | select I2C_MUX |
185 | select SPI | ||
186 | default y | 185 | default y |
187 | help | 186 | help |
188 | By default, a media driver auto-selects all possible ancillary | 187 | By default, a media driver auto-selects all possible ancillary |
diff --git a/drivers/media/common/cx2341x.c b/drivers/media/common/cx2341x.c index 103ef6bad2e2..be763150b8aa 100644 --- a/drivers/media/common/cx2341x.c +++ b/drivers/media/common/cx2341x.c | |||
@@ -1490,6 +1490,7 @@ static struct v4l2_ctrl *cx2341x_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, | |||
1490 | { | 1490 | { |
1491 | struct v4l2_ctrl_config cfg; | 1491 | struct v4l2_ctrl_config cfg; |
1492 | 1492 | ||
1493 | memset(&cfg, 0, sizeof(cfg)); | ||
1493 | cx2341x_ctrl_fill(id, &cfg.name, &cfg.type, &min, &max, &step, &def, &cfg.flags); | 1494 | cx2341x_ctrl_fill(id, &cfg.name, &cfg.type, &min, &max, &step, &def, &cfg.flags); |
1494 | cfg.ops = &cx2341x_ops; | 1495 | cfg.ops = &cx2341x_ops; |
1495 | cfg.id = id; | 1496 | cfg.id = id; |
diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index 5135a096bfa6..12ce19c98ded 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h | |||
@@ -280,6 +280,8 @@ | |||
280 | #define USB_PID_PCTV_400E 0x020f | 280 | #define USB_PID_PCTV_400E 0x020f |
281 | #define USB_PID_PCTV_450E 0x0222 | 281 | #define USB_PID_PCTV_450E 0x0222 |
282 | #define USB_PID_PCTV_452E 0x021f | 282 | #define USB_PID_PCTV_452E 0x021f |
283 | #define USB_PID_PCTV_78E 0x025a | ||
284 | #define USB_PID_PCTV_79E 0x0262 | ||
283 | #define USB_PID_REALTEK_RTL2831U 0x2831 | 285 | #define USB_PID_REALTEK_RTL2831U 0x2831 |
284 | #define USB_PID_REALTEK_RTL2832U 0x2832 | 286 | #define USB_PID_REALTEK_RTL2832U 0x2832 |
285 | #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 | 287 | #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 |
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index be4bec2a9640..5c90ea683a7e 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c | |||
@@ -314,6 +314,19 @@ static int af9033_init(struct dvb_frontend *fe) | |||
314 | goto err; | 314 | goto err; |
315 | } | 315 | } |
316 | 316 | ||
317 | /* feed clock to RF tuner */ | ||
318 | switch (state->cfg.tuner) { | ||
319 | case AF9033_TUNER_IT9135_38: | ||
320 | case AF9033_TUNER_IT9135_51: | ||
321 | case AF9033_TUNER_IT9135_52: | ||
322 | case AF9033_TUNER_IT9135_60: | ||
323 | case AF9033_TUNER_IT9135_61: | ||
324 | case AF9033_TUNER_IT9135_62: | ||
325 | ret = af9033_wr_reg(state, 0x80fba8, 0x00); | ||
326 | if (ret < 0) | ||
327 | goto err; | ||
328 | } | ||
329 | |||
317 | /* settings for TS interface */ | 330 | /* settings for TS interface */ |
318 | if (state->cfg.ts_mode == AF9033_TS_MODE_USB) { | 331 | if (state->cfg.ts_mode == AF9033_TS_MODE_USB) { |
319 | ret = af9033_wr_reg_mask(state, 0x80f9a5, 0x00, 0x01); | 332 | ret = af9033_wr_reg_mask(state, 0x80f9a5, 0x00, 0x01); |
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h index fc2ad581e302..ded7b67d7526 100644 --- a/drivers/media/dvb-frontends/af9033_priv.h +++ b/drivers/media/dvb-frontends/af9033_priv.h | |||
@@ -1418,7 +1418,7 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1418 | { 0x800068, 0x0a }, | 1418 | { 0x800068, 0x0a }, |
1419 | { 0x80006a, 0x03 }, | 1419 | { 0x80006a, 0x03 }, |
1420 | { 0x800070, 0x0a }, | 1420 | { 0x800070, 0x0a }, |
1421 | { 0x800071, 0x05 }, | 1421 | { 0x800071, 0x0a }, |
1422 | { 0x800072, 0x02 }, | 1422 | { 0x800072, 0x02 }, |
1423 | { 0x800075, 0x8c }, | 1423 | { 0x800075, 0x8c }, |
1424 | { 0x800076, 0x8c }, | 1424 | { 0x800076, 0x8c }, |
@@ -1484,7 +1484,6 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1484 | { 0x800104, 0x02 }, | 1484 | { 0x800104, 0x02 }, |
1485 | { 0x800105, 0xbe }, | 1485 | { 0x800105, 0xbe }, |
1486 | { 0x800106, 0x00 }, | 1486 | { 0x800106, 0x00 }, |
1487 | { 0x800109, 0x02 }, | ||
1488 | { 0x800115, 0x0a }, | 1487 | { 0x800115, 0x0a }, |
1489 | { 0x800116, 0x03 }, | 1488 | { 0x800116, 0x03 }, |
1490 | { 0x80011a, 0xbe }, | 1489 | { 0x80011a, 0xbe }, |
@@ -1510,7 +1509,6 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1510 | { 0x80014b, 0x8c }, | 1509 | { 0x80014b, 0x8c }, |
1511 | { 0x80014d, 0xac }, | 1510 | { 0x80014d, 0xac }, |
1512 | { 0x80014e, 0xc6 }, | 1511 | { 0x80014e, 0xc6 }, |
1513 | { 0x80014f, 0x03 }, | ||
1514 | { 0x800151, 0x1e }, | 1512 | { 0x800151, 0x1e }, |
1515 | { 0x800153, 0xbc }, | 1513 | { 0x800153, 0xbc }, |
1516 | { 0x800178, 0x09 }, | 1514 | { 0x800178, 0x09 }, |
@@ -1522,9 +1520,10 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1522 | { 0x80018d, 0x5f }, | 1520 | { 0x80018d, 0x5f }, |
1523 | { 0x80018f, 0xa0 }, | 1521 | { 0x80018f, 0xa0 }, |
1524 | { 0x800190, 0x5a }, | 1522 | { 0x800190, 0x5a }, |
1525 | { 0x80ed02, 0xff }, | 1523 | { 0x800191, 0x00 }, |
1526 | { 0x80ee42, 0xff }, | 1524 | { 0x80ed02, 0x40 }, |
1527 | { 0x80ee82, 0xff }, | 1525 | { 0x80ee42, 0x40 }, |
1526 | { 0x80ee82, 0x40 }, | ||
1528 | { 0x80f000, 0x0f }, | 1527 | { 0x80f000, 0x0f }, |
1529 | { 0x80f01f, 0x8c }, | 1528 | { 0x80f01f, 0x8c }, |
1530 | { 0x80f020, 0x00 }, | 1529 | { 0x80f020, 0x00 }, |
@@ -1699,7 +1698,6 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1699 | { 0x800104, 0x02 }, | 1698 | { 0x800104, 0x02 }, |
1700 | { 0x800105, 0xc8 }, | 1699 | { 0x800105, 0xc8 }, |
1701 | { 0x800106, 0x00 }, | 1700 | { 0x800106, 0x00 }, |
1702 | { 0x800109, 0x02 }, | ||
1703 | { 0x800115, 0x0a }, | 1701 | { 0x800115, 0x0a }, |
1704 | { 0x800116, 0x03 }, | 1702 | { 0x800116, 0x03 }, |
1705 | { 0x80011a, 0xc6 }, | 1703 | { 0x80011a, 0xc6 }, |
@@ -1725,7 +1723,6 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1725 | { 0x80014b, 0x8c }, | 1723 | { 0x80014b, 0x8c }, |
1726 | { 0x80014d, 0xa8 }, | 1724 | { 0x80014d, 0xa8 }, |
1727 | { 0x80014e, 0xc6 }, | 1725 | { 0x80014e, 0xc6 }, |
1728 | { 0x80014f, 0x03 }, | ||
1729 | { 0x800151, 0x28 }, | 1726 | { 0x800151, 0x28 }, |
1730 | { 0x800153, 0xcc }, | 1727 | { 0x800153, 0xcc }, |
1731 | { 0x800178, 0x09 }, | 1728 | { 0x800178, 0x09 }, |
@@ -1737,9 +1734,10 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1737 | { 0x80018d, 0x5f }, | 1734 | { 0x80018d, 0x5f }, |
1738 | { 0x80018f, 0xfb }, | 1735 | { 0x80018f, 0xfb }, |
1739 | { 0x800190, 0x5c }, | 1736 | { 0x800190, 0x5c }, |
1740 | { 0x80ed02, 0xff }, | 1737 | { 0x800191, 0x00 }, |
1741 | { 0x80ee42, 0xff }, | 1738 | { 0x80ed02, 0x40 }, |
1742 | { 0x80ee82, 0xff }, | 1739 | { 0x80ee42, 0x40 }, |
1740 | { 0x80ee82, 0x40 }, | ||
1743 | { 0x80f000, 0x0f }, | 1741 | { 0x80f000, 0x0f }, |
1744 | { 0x80f01f, 0x8c }, | 1742 | { 0x80f01f, 0x8c }, |
1745 | { 0x80f020, 0x00 }, | 1743 | { 0x80f020, 0x00 }, |
diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c index 72fb5838cae0..7975c6608e20 100644 --- a/drivers/media/dvb-frontends/cx24123.c +++ b/drivers/media/dvb-frontends/cx24123.c | |||
@@ -1095,6 +1095,7 @@ struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, | |||
1095 | sizeof(state->tuner_i2c_adapter.name)); | 1095 | sizeof(state->tuner_i2c_adapter.name)); |
1096 | state->tuner_i2c_adapter.algo = &cx24123_tuner_i2c_algo; | 1096 | state->tuner_i2c_adapter.algo = &cx24123_tuner_i2c_algo; |
1097 | state->tuner_i2c_adapter.algo_data = NULL; | 1097 | state->tuner_i2c_adapter.algo_data = NULL; |
1098 | state->tuner_i2c_adapter.dev.parent = i2c->dev.parent; | ||
1098 | i2c_set_adapdata(&state->tuner_i2c_adapter, state); | 1099 | i2c_set_adapdata(&state->tuner_i2c_adapter, state); |
1099 | if (i2c_add_adapter(&state->tuner_i2c_adapter) < 0) { | 1100 | if (i2c_add_adapter(&state->tuner_i2c_adapter) < 0) { |
1100 | err("tuner i2c bus could not be initialized\n"); | 1101 | err("tuner i2c bus could not be initialized\n"); |
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index d4fa213ba74a..de88b980a837 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -2325,7 +2325,7 @@ static int adv7604_log_status(struct v4l2_subdev *sd) | |||
2325 | v4l2_info(sd, "HDCP keys read: %s%s\n", | 2325 | v4l2_info(sd, "HDCP keys read: %s%s\n", |
2326 | (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", | 2326 | (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", |
2327 | (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); | 2327 | (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); |
2328 | if (!is_hdmi(sd)) { | 2328 | if (is_hdmi(sd)) { |
2329 | bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; | 2329 | bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; |
2330 | bool audio_sample_packet_detect = hdmi_read(sd, 0x18) & 0x01; | 2330 | bool audio_sample_packet_detect = hdmi_read(sd, 0x18) & 0x01; |
2331 | bool audio_mute = io_read(sd, 0x65) & 0x40; | 2331 | bool audio_mute = io_read(sd, 0x65) & 0x40; |
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 1eaf975d3612..62acb10630f9 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c | |||
@@ -1282,19 +1282,12 @@ static int smiapp_set_power(struct v4l2_subdev *subdev, int on) | |||
1282 | 1282 | ||
1283 | mutex_lock(&sensor->power_mutex); | 1283 | mutex_lock(&sensor->power_mutex); |
1284 | 1284 | ||
1285 | /* | 1285 | if (on && !sensor->power_count) { |
1286 | * If the power count is modified from 0 to != 0 or from != 0 | ||
1287 | * to 0, update the power state. | ||
1288 | */ | ||
1289 | if (!sensor->power_count == !on) | ||
1290 | goto out; | ||
1291 | |||
1292 | if (on) { | ||
1293 | /* Power on and perform initialisation. */ | 1286 | /* Power on and perform initialisation. */ |
1294 | ret = smiapp_power_on(sensor); | 1287 | ret = smiapp_power_on(sensor); |
1295 | if (ret < 0) | 1288 | if (ret < 0) |
1296 | goto out; | 1289 | goto out; |
1297 | } else { | 1290 | } else if (!on && sensor->power_count == 1) { |
1298 | smiapp_power_off(sensor); | 1291 | smiapp_power_off(sensor); |
1299 | } | 1292 | } |
1300 | 1293 | ||
@@ -2572,7 +2565,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev) | |||
2572 | 2565 | ||
2573 | this->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; | 2566 | this->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; |
2574 | this->sd.internal_ops = &smiapp_internal_ops; | 2567 | this->sd.internal_ops = &smiapp_internal_ops; |
2575 | this->sd.owner = NULL; | 2568 | this->sd.owner = THIS_MODULE; |
2576 | v4l2_set_subdevdata(&this->sd, client); | 2569 | v4l2_set_subdevdata(&this->sd, client); |
2577 | 2570 | ||
2578 | rval = media_entity_init(&this->sd.entity, | 2571 | rval = media_entity_init(&this->sd.entity, |
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 716bdc57fac6..83f5074706f9 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c | |||
@@ -1091,6 +1091,7 @@ static int cx18_probe(struct pci_dev *pci_dev, | |||
1091 | setup.addr = ADDR_UNSET; | 1091 | setup.addr = ADDR_UNSET; |
1092 | setup.type = cx->options.tuner; | 1092 | setup.type = cx->options.tuner; |
1093 | setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ | 1093 | setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ |
1094 | setup.config = NULL; | ||
1094 | if (cx->options.radio > 0) | 1095 | if (cx->options.radio > 0) |
1095 | setup.mode_mask |= T_RADIO; | 1096 | setup.mode_mask |= T_RADIO; |
1096 | setup.tuner_callback = (setup.type == TUNER_XC2028) ? | 1097 | setup.tuner_callback = (setup.type == TUNER_XC2028) ? |
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c index 998919e97dfe..7b35e633118d 100644 --- a/drivers/media/radio/radio-miropcm20.c +++ b/drivers/media/radio/radio-miropcm20.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/io.h> | ||
30 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
31 | #include <linux/videodev2.h> | 32 | #include <linux/videodev2.h> |
32 | #include <linux/kthread.h> | 33 | #include <linux/kthread.h> |
diff --git a/drivers/media/tuners/tuner_it913x.c b/drivers/media/tuners/tuner_it913x.c index 6f30d7e535b8..3d83c425bccf 100644 --- a/drivers/media/tuners/tuner_it913x.c +++ b/drivers/media/tuners/tuner_it913x.c | |||
@@ -396,6 +396,7 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, | |||
396 | struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config) | 396 | struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config) |
397 | { | 397 | { |
398 | struct it913x_state *state = NULL; | 398 | struct it913x_state *state = NULL; |
399 | int ret; | ||
399 | 400 | ||
400 | /* allocate memory for the internal state */ | 401 | /* allocate memory for the internal state */ |
401 | state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL); | 402 | state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL); |
@@ -425,6 +426,11 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, | |||
425 | state->tuner_type = config; | 426 | state->tuner_type = config; |
426 | state->firmware_ver = 1; | 427 | state->firmware_ver = 1; |
427 | 428 | ||
429 | /* tuner RF initial */ | ||
430 | ret = it913x_wr_reg(state, PRO_DMOD, 0xec4c, 0x68); | ||
431 | if (ret < 0) | ||
432 | goto error; | ||
433 | |||
428 | fe->tuner_priv = state; | 434 | fe->tuner_priv = state; |
429 | memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, | 435 | memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, |
430 | sizeof(struct dvb_tuner_ops)); | 436 | sizeof(struct dvb_tuner_ops)); |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 75ec1c659fdd..c82beac0e0cb 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -1575,6 +1575,10 @@ static const struct usb_device_id af9035_id_table[] = { | |||
1575 | &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, | 1575 | &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, |
1576 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, | 1576 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, |
1577 | &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) }, | 1577 | &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) }, |
1578 | { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_78E, | ||
1579 | &af9035_props, "PCTV 78e", RC_MAP_IT913X_V1) }, | ||
1580 | { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_79E, | ||
1581 | &af9035_props, "PCTV 79e", RC_MAP_IT913X_V2) }, | ||
1578 | { } | 1582 | { } |
1579 | }; | 1583 | }; |
1580 | MODULE_DEVICE_TABLE(usb, af9035_id_table); | 1584 | MODULE_DEVICE_TABLE(usb, af9035_id_table); |
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 90dec2955f1c..29abc379551e 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c | |||
@@ -1342,7 +1342,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1342 | struct em28xx *dev = video_drvdata(file); | 1342 | struct em28xx *dev = video_drvdata(file); |
1343 | struct em28xx_v4l2 *v4l2 = dev->v4l2; | 1343 | struct em28xx_v4l2 *v4l2 = dev->v4l2; |
1344 | 1344 | ||
1345 | if (v4l2->streaming_users > 0) | 1345 | if (vb2_is_busy(&v4l2->vb_vidq)) |
1346 | return -EBUSY; | 1346 | return -EBUSY; |
1347 | 1347 | ||
1348 | vidioc_try_fmt_vid_cap(file, priv, f); | 1348 | vidioc_try_fmt_vid_cap(file, priv, f); |
@@ -1883,8 +1883,9 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1883 | return -EINVAL; | 1883 | return -EINVAL; |
1884 | } | 1884 | } |
1885 | 1885 | ||
1886 | em28xx_videodbg("open dev=%s type=%s\n", | 1886 | em28xx_videodbg("open dev=%s type=%s users=%d\n", |
1887 | video_device_node_name(vdev), v4l2_type_names[fh_type]); | 1887 | video_device_node_name(vdev), v4l2_type_names[fh_type], |
1888 | v4l2->users); | ||
1888 | 1889 | ||
1889 | if (mutex_lock_interruptible(&dev->lock)) | 1890 | if (mutex_lock_interruptible(&dev->lock)) |
1890 | return -ERESTARTSYS; | 1891 | return -ERESTARTSYS; |
@@ -1897,9 +1898,7 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1897 | return ret; | 1898 | return ret; |
1898 | } | 1899 | } |
1899 | 1900 | ||
1900 | if (v4l2_fh_is_singular_file(filp)) { | 1901 | if (v4l2->users == 0) { |
1901 | em28xx_videodbg("first opened filehandle, initializing device\n"); | ||
1902 | |||
1903 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 1902 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
1904 | 1903 | ||
1905 | if (vdev->vfl_type != VFL_TYPE_RADIO) | 1904 | if (vdev->vfl_type != VFL_TYPE_RADIO) |
@@ -1910,8 +1909,6 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1910 | * of some i2c devices | 1909 | * of some i2c devices |
1911 | */ | 1910 | */ |
1912 | em28xx_wake_i2c(dev); | 1911 | em28xx_wake_i2c(dev); |
1913 | } else { | ||
1914 | em28xx_videodbg("further filehandles are already opened\n"); | ||
1915 | } | 1912 | } |
1916 | 1913 | ||
1917 | if (vdev->vfl_type == VFL_TYPE_RADIO) { | 1914 | if (vdev->vfl_type == VFL_TYPE_RADIO) { |
@@ -1921,6 +1918,7 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1921 | 1918 | ||
1922 | kref_get(&dev->ref); | 1919 | kref_get(&dev->ref); |
1923 | kref_get(&v4l2->ref); | 1920 | kref_get(&v4l2->ref); |
1921 | v4l2->users++; | ||
1924 | 1922 | ||
1925 | mutex_unlock(&dev->lock); | 1923 | mutex_unlock(&dev->lock); |
1926 | 1924 | ||
@@ -2027,11 +2025,12 @@ static int em28xx_v4l2_close(struct file *filp) | |||
2027 | struct em28xx_v4l2 *v4l2 = dev->v4l2; | 2025 | struct em28xx_v4l2 *v4l2 = dev->v4l2; |
2028 | int errCode; | 2026 | int errCode; |
2029 | 2027 | ||
2030 | mutex_lock(&dev->lock); | 2028 | em28xx_videodbg("users=%d\n", v4l2->users); |
2031 | 2029 | ||
2032 | if (v4l2_fh_is_singular_file(filp)) { | 2030 | vb2_fop_release(filp); |
2033 | em28xx_videodbg("last opened filehandle, shutting down device\n"); | 2031 | mutex_lock(&dev->lock); |
2034 | 2032 | ||
2033 | if (v4l2->users == 1) { | ||
2035 | /* No sense to try to write to the device */ | 2034 | /* No sense to try to write to the device */ |
2036 | if (dev->disconnected) | 2035 | if (dev->disconnected) |
2037 | goto exit; | 2036 | goto exit; |
@@ -2050,12 +2049,10 @@ static int em28xx_v4l2_close(struct file *filp) | |||
2050 | em28xx_errdev("cannot change alternate number to " | 2049 | em28xx_errdev("cannot change alternate number to " |
2051 | "0 (error=%i)\n", errCode); | 2050 | "0 (error=%i)\n", errCode); |
2052 | } | 2051 | } |
2053 | } else { | ||
2054 | em28xx_videodbg("further opened filehandles left\n"); | ||
2055 | } | 2052 | } |
2056 | 2053 | ||
2057 | exit: | 2054 | exit: |
2058 | vb2_fop_release(filp); | 2055 | v4l2->users--; |
2059 | kref_put(&v4l2->ref, em28xx_free_v4l2); | 2056 | kref_put(&v4l2->ref, em28xx_free_v4l2); |
2060 | mutex_unlock(&dev->lock); | 2057 | mutex_unlock(&dev->lock); |
2061 | kref_put(&dev->ref, em28xx_free_device); | 2058 | kref_put(&dev->ref, em28xx_free_device); |
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 84ef8efdb148..4360338e7b31 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h | |||
@@ -524,6 +524,7 @@ struct em28xx_v4l2 { | |||
524 | int sensor_yres; | 524 | int sensor_yres; |
525 | int sensor_xtal; | 525 | int sensor_xtal; |
526 | 526 | ||
527 | int users; /* user count for exclusive use */ | ||
527 | int streaming_users; /* number of actively streaming users */ | 528 | int streaming_users; /* number of actively streaming users */ |
528 | 529 | ||
529 | u32 frequency; /* selected tuner frequency */ | 530 | u32 frequency; /* selected tuner frequency */ |
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index c359006074a8..25d3ae2188cb 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -971,6 +971,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
971 | * to the userspace. | 971 | * to the userspace. |
972 | */ | 972 | */ |
973 | req->count = allocated_buffers; | 973 | req->count = allocated_buffers; |
974 | q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); | ||
974 | 975 | ||
975 | return 0; | 976 | return 0; |
976 | } | 977 | } |
@@ -1018,6 +1019,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create | |||
1018 | memset(q->plane_sizes, 0, sizeof(q->plane_sizes)); | 1019 | memset(q->plane_sizes, 0, sizeof(q->plane_sizes)); |
1019 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); | 1020 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); |
1020 | q->memory = create->memory; | 1021 | q->memory = create->memory; |
1022 | q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); | ||
1021 | } | 1023 | } |
1022 | 1024 | ||
1023 | num_buffers = min(create->count, VIDEO_MAX_FRAME - q->num_buffers); | 1025 | num_buffers = min(create->count, VIDEO_MAX_FRAME - q->num_buffers); |
@@ -1130,7 +1132,7 @@ EXPORT_SYMBOL_GPL(vb2_plane_vaddr); | |||
1130 | */ | 1132 | */ |
1131 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) | 1133 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) |
1132 | { | 1134 | { |
1133 | if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) | 1135 | if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv) |
1134 | return NULL; | 1136 | return NULL; |
1135 | 1137 | ||
1136 | return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); | 1138 | return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); |
@@ -1165,13 +1167,10 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
1165 | if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE)) | 1167 | if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE)) |
1166 | return; | 1168 | return; |
1167 | 1169 | ||
1168 | if (!q->start_streaming_called) { | 1170 | if (WARN_ON(state != VB2_BUF_STATE_DONE && |
1169 | if (WARN_ON(state != VB2_BUF_STATE_QUEUED)) | 1171 | state != VB2_BUF_STATE_ERROR && |
1170 | state = VB2_BUF_STATE_QUEUED; | 1172 | state != VB2_BUF_STATE_QUEUED)) |
1171 | } else if (WARN_ON(state != VB2_BUF_STATE_DONE && | 1173 | state = VB2_BUF_STATE_ERROR; |
1172 | state != VB2_BUF_STATE_ERROR)) { | ||
1173 | state = VB2_BUF_STATE_ERROR; | ||
1174 | } | ||
1175 | 1174 | ||
1176 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1175 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1177 | /* | 1176 | /* |
@@ -1762,6 +1761,12 @@ static int vb2_start_streaming(struct vb2_queue *q) | |||
1762 | q->start_streaming_called = 0; | 1761 | q->start_streaming_called = 0; |
1763 | 1762 | ||
1764 | dprintk(1, "driver refused to start streaming\n"); | 1763 | dprintk(1, "driver refused to start streaming\n"); |
1764 | /* | ||
1765 | * If you see this warning, then the driver isn't cleaning up properly | ||
1766 | * after a failed start_streaming(). See the start_streaming() | ||
1767 | * documentation in videobuf2-core.h for more information how buffers | ||
1768 | * should be returned to vb2 in start_streaming(). | ||
1769 | */ | ||
1765 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { | 1770 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { |
1766 | unsigned i; | 1771 | unsigned i; |
1767 | 1772 | ||
@@ -1777,6 +1782,12 @@ static int vb2_start_streaming(struct vb2_queue *q) | |||
1777 | /* Must be zero now */ | 1782 | /* Must be zero now */ |
1778 | WARN_ON(atomic_read(&q->owned_by_drv_count)); | 1783 | WARN_ON(atomic_read(&q->owned_by_drv_count)); |
1779 | } | 1784 | } |
1785 | /* | ||
1786 | * If done_list is not empty, then start_streaming() didn't call | ||
1787 | * vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED) but STATE_ERROR or | ||
1788 | * STATE_DONE. | ||
1789 | */ | ||
1790 | WARN_ON(!list_empty(&q->done_list)); | ||
1780 | return ret; | 1791 | return ret; |
1781 | } | 1792 | } |
1782 | 1793 | ||
@@ -1812,6 +1823,7 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) | |||
1812 | */ | 1823 | */ |
1813 | list_add_tail(&vb->queued_entry, &q->queued_list); | 1824 | list_add_tail(&vb->queued_entry, &q->queued_list); |
1814 | q->queued_count++; | 1825 | q->queued_count++; |
1826 | q->waiting_for_buffers = false; | ||
1815 | vb->state = VB2_BUF_STATE_QUEUED; | 1827 | vb->state = VB2_BUF_STATE_QUEUED; |
1816 | if (V4L2_TYPE_IS_OUTPUT(q->type)) { | 1828 | if (V4L2_TYPE_IS_OUTPUT(q->type)) { |
1817 | /* | 1829 | /* |
@@ -2123,6 +2135,12 @@ static void __vb2_queue_cancel(struct vb2_queue *q) | |||
2123 | if (q->start_streaming_called) | 2135 | if (q->start_streaming_called) |
2124 | call_void_qop(q, stop_streaming, q); | 2136 | call_void_qop(q, stop_streaming, q); |
2125 | 2137 | ||
2138 | /* | ||
2139 | * If you see this warning, then the driver isn't cleaning up properly | ||
2140 | * in stop_streaming(). See the stop_streaming() documentation in | ||
2141 | * videobuf2-core.h for more information how buffers should be returned | ||
2142 | * to vb2 in stop_streaming(). | ||
2143 | */ | ||
2126 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { | 2144 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { |
2127 | for (i = 0; i < q->num_buffers; ++i) | 2145 | for (i = 0; i < q->num_buffers; ++i) |
2128 | if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) | 2146 | if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) |
@@ -2272,6 +2290,7 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type) | |||
2272 | * their normal dequeued state. | 2290 | * their normal dequeued state. |
2273 | */ | 2291 | */ |
2274 | __vb2_queue_cancel(q); | 2292 | __vb2_queue_cancel(q); |
2293 | q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); | ||
2275 | 2294 | ||
2276 | dprintk(3, "successful\n"); | 2295 | dprintk(3, "successful\n"); |
2277 | return 0; | 2296 | return 0; |
@@ -2590,10 +2609,17 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) | |||
2590 | } | 2609 | } |
2591 | 2610 | ||
2592 | /* | 2611 | /* |
2593 | * There is nothing to wait for if no buffer has been queued and the | 2612 | * There is nothing to wait for if the queue isn't streaming, or if the |
2594 | * queue isn't streaming, or if the error flag is set. | 2613 | * error flag is set. |
2614 | */ | ||
2615 | if (!vb2_is_streaming(q) || q->error) | ||
2616 | return res | POLLERR; | ||
2617 | /* | ||
2618 | * For compatibility with vb1: if QBUF hasn't been called yet, then | ||
2619 | * return POLLERR as well. This only affects capture queues, output | ||
2620 | * queues will always initialize waiting_for_buffers to false. | ||
2595 | */ | 2621 | */ |
2596 | if ((list_empty(&q->queued_list) && !vb2_is_streaming(q)) || q->error) | 2622 | if (q->waiting_for_buffers) |
2597 | return res | POLLERR; | 2623 | return res | POLLERR; |
2598 | 2624 | ||
2599 | /* | 2625 | /* |
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index adefc31bb853..9b163a440f89 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c | |||
@@ -113,7 +113,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_fla | |||
113 | goto fail_pages_alloc; | 113 | goto fail_pages_alloc; |
114 | 114 | ||
115 | ret = sg_alloc_table_from_pages(&buf->sg_table, buf->pages, | 115 | ret = sg_alloc_table_from_pages(&buf->sg_table, buf->pages, |
116 | buf->num_pages, 0, size, gfp_flags); | 116 | buf->num_pages, 0, size, GFP_KERNEL); |
117 | if (ret) | 117 | if (ret) |
118 | goto fail_table_alloc; | 118 | goto fail_table_alloc; |
119 | 119 | ||
diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig index a34a11d2fef2..63ca9841db10 100644 --- a/drivers/message/fusion/Kconfig +++ b/drivers/message/fusion/Kconfig | |||
@@ -29,7 +29,7 @@ config FUSION_SPI | |||
29 | config FUSION_FC | 29 | config FUSION_FC |
30 | tristate "Fusion MPT ScsiHost drivers for FC" | 30 | tristate "Fusion MPT ScsiHost drivers for FC" |
31 | depends on PCI && SCSI | 31 | depends on PCI && SCSI |
32 | select SCSI_FC_ATTRS | 32 | depends on SCSI_FC_ATTRS |
33 | ---help--- | 33 | ---help--- |
34 | SCSI HOST support for a Fiber Channel host adapters. | 34 | SCSI HOST support for a Fiber Channel host adapters. |
35 | 35 | ||
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index ce48aa72bb42..bde2fc072410 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -1754,7 +1754,7 @@ static int ab8500_probe(struct platform_device *pdev) | |||
1754 | if (ret) | 1754 | if (ret) |
1755 | return ret; | 1755 | return ret; |
1756 | 1756 | ||
1757 | #if CONFIG_DEBUG_FS | 1757 | #ifdef CONFIG_DEBUG_FS |
1758 | /* Pass to debugfs */ | 1758 | /* Pass to debugfs */ |
1759 | ab8500_debug_resources[0].start = ab8500->irq; | 1759 | ab8500_debug_resources[0].start = ab8500->irq; |
1760 | ab8500_debug_resources[0].end = ab8500->irq; | 1760 | ab8500_debug_resources[0].end = ab8500->irq; |
diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c index b44f0203983b..6bdb78c2ac77 100644 --- a/drivers/mfd/htc-i2cpld.c +++ b/drivers/mfd/htc-i2cpld.c | |||
@@ -404,7 +404,7 @@ static int htcpld_register_chip_i2c( | |||
404 | } | 404 | } |
405 | 405 | ||
406 | i2c_set_clientdata(client, chip); | 406 | i2c_set_clientdata(client, chip); |
407 | snprintf(client->name, I2C_NAME_SIZE, "Chip_0x%d", client->addr); | 407 | snprintf(client->name, I2C_NAME_SIZE, "Chip_0x%x", client->addr); |
408 | chip->client = client; | 408 | chip->client = client; |
409 | 409 | ||
410 | /* Reset the chip */ | 410 | /* Reset the chip */ |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 33a9234b701c..83dab2f0a50e 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -647,7 +647,7 @@ static int usbhs_omap_probe(struct platform_device *pdev) | |||
647 | default: | 647 | default: |
648 | omap->nports = OMAP3_HS_USB_PORTS; | 648 | omap->nports = OMAP3_HS_USB_PORTS; |
649 | dev_dbg(dev, | 649 | dev_dbg(dev, |
650 | "USB HOST Rev:0x%d not recognized, assuming %d ports\n", | 650 | "USB HOST Rev:0x%x not recognized, assuming %d ports\n", |
651 | omap->usbhs_rev, omap->nports); | 651 | omap->usbhs_rev, omap->nports); |
652 | break; | 652 | break; |
653 | } | 653 | } |
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 3bc969a5916b..4d3ff3771491 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
@@ -724,24 +724,24 @@ static struct twl4030_script *omap3_idle_scripts[] = { | |||
724 | * above. | 724 | * above. |
725 | */ | 725 | */ |
726 | static struct twl4030_resconfig omap3_idle_rconfig[] = { | 726 | static struct twl4030_resconfig omap3_idle_rconfig[] = { |
727 | TWL_REMAP_SLEEP(RES_VAUX1, DEV_GRP_NULL, 0, 0), | 727 | TWL_REMAP_SLEEP(RES_VAUX1, TWL4030_RESCONFIG_UNDEF, 0, 0), |
728 | TWL_REMAP_SLEEP(RES_VAUX2, DEV_GRP_NULL, 0, 0), | 728 | TWL_REMAP_SLEEP(RES_VAUX2, TWL4030_RESCONFIG_UNDEF, 0, 0), |
729 | TWL_REMAP_SLEEP(RES_VAUX3, DEV_GRP_NULL, 0, 0), | 729 | TWL_REMAP_SLEEP(RES_VAUX3, TWL4030_RESCONFIG_UNDEF, 0, 0), |
730 | TWL_REMAP_SLEEP(RES_VAUX4, DEV_GRP_NULL, 0, 0), | 730 | TWL_REMAP_SLEEP(RES_VAUX4, TWL4030_RESCONFIG_UNDEF, 0, 0), |
731 | TWL_REMAP_SLEEP(RES_VMMC1, DEV_GRP_NULL, 0, 0), | 731 | TWL_REMAP_SLEEP(RES_VMMC1, TWL4030_RESCONFIG_UNDEF, 0, 0), |
732 | TWL_REMAP_SLEEP(RES_VMMC2, DEV_GRP_NULL, 0, 0), | 732 | TWL_REMAP_SLEEP(RES_VMMC2, TWL4030_RESCONFIG_UNDEF, 0, 0), |
733 | TWL_REMAP_OFF(RES_VPLL1, DEV_GRP_P1, 3, 1), | 733 | TWL_REMAP_OFF(RES_VPLL1, DEV_GRP_P1, 3, 1), |
734 | TWL_REMAP_SLEEP(RES_VPLL2, DEV_GRP_P1, 0, 0), | 734 | TWL_REMAP_SLEEP(RES_VPLL2, DEV_GRP_P1, 0, 0), |
735 | TWL_REMAP_SLEEP(RES_VSIM, DEV_GRP_NULL, 0, 0), | 735 | TWL_REMAP_SLEEP(RES_VSIM, TWL4030_RESCONFIG_UNDEF, 0, 0), |
736 | TWL_REMAP_SLEEP(RES_VDAC, DEV_GRP_NULL, 0, 0), | 736 | TWL_REMAP_SLEEP(RES_VDAC, TWL4030_RESCONFIG_UNDEF, 0, 0), |
737 | TWL_REMAP_SLEEP(RES_VINTANA1, TWL_DEV_GRP_P123, 1, 2), | 737 | TWL_REMAP_SLEEP(RES_VINTANA1, TWL_DEV_GRP_P123, 1, 2), |
738 | TWL_REMAP_SLEEP(RES_VINTANA2, TWL_DEV_GRP_P123, 0, 2), | 738 | TWL_REMAP_SLEEP(RES_VINTANA2, TWL_DEV_GRP_P123, 0, 2), |
739 | TWL_REMAP_SLEEP(RES_VINTDIG, TWL_DEV_GRP_P123, 1, 2), | 739 | TWL_REMAP_SLEEP(RES_VINTDIG, TWL_DEV_GRP_P123, 1, 2), |
740 | TWL_REMAP_SLEEP(RES_VIO, TWL_DEV_GRP_P123, 2, 2), | 740 | TWL_REMAP_SLEEP(RES_VIO, TWL_DEV_GRP_P123, 2, 2), |
741 | TWL_REMAP_OFF(RES_VDD1, DEV_GRP_P1, 4, 1), | 741 | TWL_REMAP_OFF(RES_VDD1, DEV_GRP_P1, 4, 1), |
742 | TWL_REMAP_OFF(RES_VDD2, DEV_GRP_P1, 3, 1), | 742 | TWL_REMAP_OFF(RES_VDD2, DEV_GRP_P1, 3, 1), |
743 | TWL_REMAP_SLEEP(RES_VUSB_1V5, DEV_GRP_NULL, 0, 0), | 743 | TWL_REMAP_SLEEP(RES_VUSB_1V5, TWL4030_RESCONFIG_UNDEF, 0, 0), |
744 | TWL_REMAP_SLEEP(RES_VUSB_1V8, DEV_GRP_NULL, 0, 0), | 744 | TWL_REMAP_SLEEP(RES_VUSB_1V8, TWL4030_RESCONFIG_UNDEF, 0, 0), |
745 | TWL_REMAP_SLEEP(RES_VUSB_3V1, TWL_DEV_GRP_P123, 0, 0), | 745 | TWL_REMAP_SLEEP(RES_VUSB_3V1, TWL_DEV_GRP_P123, 0, 0), |
746 | /* Resource #20 USB charge pump skipped */ | 746 | /* Resource #20 USB charge pump skipped */ |
747 | TWL_REMAP_SLEEP(RES_REGEN, TWL_DEV_GRP_P123, 2, 1), | 747 | TWL_REMAP_SLEEP(RES_REGEN, TWL_DEV_GRP_P123, 2, 1), |
diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c index 7ffdb589841e..7e1efd5f58f0 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c | |||
@@ -79,6 +79,11 @@ static void firmware_load(const struct firmware *fw, void *context) | |||
79 | u32 jedec_id; | 79 | u32 jedec_id; |
80 | u32 status; | 80 | u32 status; |
81 | 81 | ||
82 | if (fw == NULL) { | ||
83 | dev_err(&spi->dev, "Cannot load firmware, aborting\n"); | ||
84 | return; | ||
85 | } | ||
86 | |||
82 | if (fw->size == 0) { | 87 | if (fw->size == 0) { |
83 | dev_err(&spi->dev, "Error: Firmware size is 0!\n"); | 88 | dev_err(&spi->dev, "Error: Firmware size is 0!\n"); |
84 | return; | 89 | return; |
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 324e1de93687..2da05c0e113d 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
@@ -601,6 +601,7 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file) | |||
601 | cl->timer_count = MEI_CONNECT_TIMEOUT; | 601 | cl->timer_count = MEI_CONNECT_TIMEOUT; |
602 | list_add_tail(&cb->list, &dev->ctrl_rd_list.list); | 602 | list_add_tail(&cb->list, &dev->ctrl_rd_list.list); |
603 | } else { | 603 | } else { |
604 | cl->state = MEI_FILE_INITIALIZING; | ||
604 | list_add_tail(&cb->list, &dev->ctrl_wr_list.list); | 605 | list_add_tail(&cb->list, &dev->ctrl_wr_list.list); |
605 | } | 606 | } |
606 | 607 | ||
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c index 3095fc514a65..5ccc23bc7690 100644 --- a/drivers/misc/mei/nfc.c +++ b/drivers/misc/mei/nfc.c | |||
@@ -342,9 +342,10 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) | |||
342 | ndev = (struct mei_nfc_dev *) cldev->priv_data; | 342 | ndev = (struct mei_nfc_dev *) cldev->priv_data; |
343 | dev = ndev->cl->dev; | 343 | dev = ndev->cl->dev; |
344 | 344 | ||
345 | err = -ENOMEM; | ||
345 | mei_buf = kzalloc(length + MEI_NFC_HEADER_SIZE, GFP_KERNEL); | 346 | mei_buf = kzalloc(length + MEI_NFC_HEADER_SIZE, GFP_KERNEL); |
346 | if (!mei_buf) | 347 | if (!mei_buf) |
347 | return -ENOMEM; | 348 | goto out; |
348 | 349 | ||
349 | hdr = (struct mei_nfc_hci_hdr *) mei_buf; | 350 | hdr = (struct mei_nfc_hci_hdr *) mei_buf; |
350 | hdr->cmd = MEI_NFC_CMD_HCI_SEND; | 351 | hdr->cmd = MEI_NFC_CMD_HCI_SEND; |
@@ -354,12 +355,9 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) | |||
354 | hdr->data_size = length; | 355 | hdr->data_size = length; |
355 | 356 | ||
356 | memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); | 357 | memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); |
357 | |||
358 | err = __mei_cl_send(ndev->cl, mei_buf, length + MEI_NFC_HEADER_SIZE); | 358 | err = __mei_cl_send(ndev->cl, mei_buf, length + MEI_NFC_HEADER_SIZE); |
359 | if (err < 0) | 359 | if (err < 0) |
360 | return err; | 360 | goto out; |
361 | |||
362 | kfree(mei_buf); | ||
363 | 361 | ||
364 | if (!wait_event_interruptible_timeout(ndev->send_wq, | 362 | if (!wait_event_interruptible_timeout(ndev->send_wq, |
365 | ndev->recv_req_id == ndev->req_id, HZ)) { | 363 | ndev->recv_req_id == ndev->req_id, HZ)) { |
@@ -368,7 +366,8 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) | |||
368 | } else { | 366 | } else { |
369 | ndev->req_id++; | 367 | ndev->req_id++; |
370 | } | 368 | } |
371 | 369 | out: | |
370 | kfree(mei_buf); | ||
372 | return err; | 371 | return err; |
373 | } | 372 | } |
374 | 373 | ||
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 5a4bfe33112a..46c4643b7a07 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -1434,6 +1434,10 @@ static int cfi_amdstd_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, | |||
1434 | 1434 | ||
1435 | mutex_lock(&chip->mutex); | 1435 | mutex_lock(&chip->mutex); |
1436 | ret = get_chip(map, chip, base, FL_LOCKING); | 1436 | ret = get_chip(map, chip, base, FL_LOCKING); |
1437 | if (ret) { | ||
1438 | mutex_unlock(&chip->mutex); | ||
1439 | return ret; | ||
1440 | } | ||
1437 | 1441 | ||
1438 | /* Enter lock register command */ | 1442 | /* Enter lock register command */ |
1439 | cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, | 1443 | cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index f0ed92e210a1..5967b385141b 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -931,7 +931,7 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const u_char *dat, | |||
931 | u32 val; | 931 | u32 val; |
932 | 932 | ||
933 | val = readl(info->reg.gpmc_ecc_config); | 933 | val = readl(info->reg.gpmc_ecc_config); |
934 | if (((val >> ECC_CONFIG_CS_SHIFT) & ~CS_MASK) != info->gpmc_cs) | 934 | if (((val >> ECC_CONFIG_CS_SHIFT) & CS_MASK) != info->gpmc_cs) |
935 | return -EINVAL; | 935 | return -EINVAL; |
936 | 936 | ||
937 | /* read ecc result */ | 937 | /* read ecc result */ |
@@ -1794,9 +1794,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | /* populate MTD interface based on ECC scheme */ | 1796 | /* populate MTD interface based on ECC scheme */ |
1797 | nand_chip->ecc.layout = &omap_oobinfo; | ||
1798 | ecclayout = &omap_oobinfo; | 1797 | ecclayout = &omap_oobinfo; |
1799 | switch (info->ecc_opt) { | 1798 | switch (info->ecc_opt) { |
1799 | case OMAP_ECC_HAM1_CODE_SW: | ||
1800 | nand_chip->ecc.mode = NAND_ECC_SOFT; | ||
1801 | break; | ||
1802 | |||
1800 | case OMAP_ECC_HAM1_CODE_HW: | 1803 | case OMAP_ECC_HAM1_CODE_HW: |
1801 | pr_info("nand: using OMAP_ECC_HAM1_CODE_HW\n"); | 1804 | pr_info("nand: using OMAP_ECC_HAM1_CODE_HW\n"); |
1802 | nand_chip->ecc.mode = NAND_ECC_HW; | 1805 | nand_chip->ecc.mode = NAND_ECC_HW; |
@@ -1848,7 +1851,7 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1848 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1851 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1849 | nand_chip->ecc.size, | 1852 | nand_chip->ecc.size, |
1850 | nand_chip->ecc.bytes, | 1853 | nand_chip->ecc.bytes, |
1851 | &nand_chip->ecc.layout); | 1854 | &ecclayout); |
1852 | if (!nand_chip->ecc.priv) { | 1855 | if (!nand_chip->ecc.priv) { |
1853 | pr_err("nand: error: unable to use s/w BCH library\n"); | 1856 | pr_err("nand: error: unable to use s/w BCH library\n"); |
1854 | err = -EINVAL; | 1857 | err = -EINVAL; |
@@ -1923,7 +1926,7 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1923 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1926 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1924 | nand_chip->ecc.size, | 1927 | nand_chip->ecc.size, |
1925 | nand_chip->ecc.bytes, | 1928 | nand_chip->ecc.bytes, |
1926 | &nand_chip->ecc.layout); | 1929 | &ecclayout); |
1927 | if (!nand_chip->ecc.priv) { | 1930 | if (!nand_chip->ecc.priv) { |
1928 | pr_err("nand: error: unable to use s/w BCH library\n"); | 1931 | pr_err("nand: error: unable to use s/w BCH library\n"); |
1929 | err = -EINVAL; | 1932 | err = -EINVAL; |
@@ -2012,6 +2015,9 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
2012 | goto return_error; | 2015 | goto return_error; |
2013 | } | 2016 | } |
2014 | 2017 | ||
2018 | if (info->ecc_opt == OMAP_ECC_HAM1_CODE_SW) | ||
2019 | goto scan_tail; | ||
2020 | |||
2015 | /* all OOB bytes from oobfree->offset till end off OOB are free */ | 2021 | /* all OOB bytes from oobfree->offset till end off OOB are free */ |
2016 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; | 2022 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; |
2017 | /* check if NAND device's OOB is enough to store ECC signatures */ | 2023 | /* check if NAND device's OOB is enough to store ECC signatures */ |
@@ -2021,7 +2027,9 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
2021 | err = -EINVAL; | 2027 | err = -EINVAL; |
2022 | goto return_error; | 2028 | goto return_error; |
2023 | } | 2029 | } |
2030 | nand_chip->ecc.layout = ecclayout; | ||
2024 | 2031 | ||
2032 | scan_tail: | ||
2025 | /* second phase scan */ | 2033 | /* second phase scan */ |
2026 | if (nand_scan_tail(mtd)) { | 2034 | if (nand_scan_tail(mtd)) { |
2027 | err = -ENXIO; | 2035 | err = -ENXIO; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f0f5eab0fab1..798ae69fb63c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -175,7 +175,7 @@ MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to " | |||
175 | "the same MAC; 0 for none (default), " | 175 | "the same MAC; 0 for none (default), " |
176 | "1 for active, 2 for follow"); | 176 | "1 for active, 2 for follow"); |
177 | module_param(all_slaves_active, int, 0); | 177 | module_param(all_slaves_active, int, 0); |
178 | MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface" | 178 | MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface " |
179 | "by setting active flag for all slaves; " | 179 | "by setting active flag for all slaves; " |
180 | "0 for never (default), 1 for always."); | 180 | "0 for never (default), 1 for always."); |
181 | module_param(resend_igmp, int, 0); | 181 | module_param(resend_igmp, int, 0); |
@@ -3659,8 +3659,14 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev | |||
3659 | else | 3659 | else |
3660 | bond_xmit_slave_id(bond, skb, 0); | 3660 | bond_xmit_slave_id(bond, skb, 0); |
3661 | } else { | 3661 | } else { |
3662 | slave_id = bond_rr_gen_slave_id(bond); | 3662 | int slave_cnt = ACCESS_ONCE(bond->slave_cnt); |
3663 | bond_xmit_slave_id(bond, skb, slave_id % bond->slave_cnt); | 3663 | |
3664 | if (likely(slave_cnt)) { | ||
3665 | slave_id = bond_rr_gen_slave_id(bond); | ||
3666 | bond_xmit_slave_id(bond, skb, slave_id % slave_cnt); | ||
3667 | } else { | ||
3668 | dev_kfree_skb_any(skb); | ||
3669 | } | ||
3664 | } | 3670 | } |
3665 | 3671 | ||
3666 | return NETDEV_TX_OK; | 3672 | return NETDEV_TX_OK; |
@@ -3691,8 +3697,13 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
3691 | static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) | 3697 | static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) |
3692 | { | 3698 | { |
3693 | struct bonding *bond = netdev_priv(bond_dev); | 3699 | struct bonding *bond = netdev_priv(bond_dev); |
3700 | int slave_cnt = ACCESS_ONCE(bond->slave_cnt); | ||
3694 | 3701 | ||
3695 | bond_xmit_slave_id(bond, skb, bond_xmit_hash(bond, skb) % bond->slave_cnt); | 3702 | if (likely(slave_cnt)) |
3703 | bond_xmit_slave_id(bond, skb, | ||
3704 | bond_xmit_hash(bond, skb) % slave_cnt); | ||
3705 | else | ||
3706 | dev_kfree_skb_any(skb); | ||
3696 | 3707 | ||
3697 | return NETDEV_TX_OK; | 3708 | return NETDEV_TX_OK; |
3698 | } | 3709 | } |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index f07fa89b5fd5..05e1aa090add 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -1123,7 +1123,9 @@ static int at91_open(struct net_device *dev) | |||
1123 | struct at91_priv *priv = netdev_priv(dev); | 1123 | struct at91_priv *priv = netdev_priv(dev); |
1124 | int err; | 1124 | int err; |
1125 | 1125 | ||
1126 | clk_enable(priv->clk); | 1126 | err = clk_prepare_enable(priv->clk); |
1127 | if (err) | ||
1128 | return err; | ||
1127 | 1129 | ||
1128 | /* check or determine and set bittime */ | 1130 | /* check or determine and set bittime */ |
1129 | err = open_candev(dev); | 1131 | err = open_candev(dev); |
@@ -1149,7 +1151,7 @@ static int at91_open(struct net_device *dev) | |||
1149 | out_close: | 1151 | out_close: |
1150 | close_candev(dev); | 1152 | close_candev(dev); |
1151 | out: | 1153 | out: |
1152 | clk_disable(priv->clk); | 1154 | clk_disable_unprepare(priv->clk); |
1153 | 1155 | ||
1154 | return err; | 1156 | return err; |
1155 | } | 1157 | } |
@@ -1166,7 +1168,7 @@ static int at91_close(struct net_device *dev) | |||
1166 | at91_chip_stop(dev, CAN_STATE_STOPPED); | 1168 | at91_chip_stop(dev, CAN_STATE_STOPPED); |
1167 | 1169 | ||
1168 | free_irq(dev->irq, dev); | 1170 | free_irq(dev->irq, dev); |
1169 | clk_disable(priv->clk); | 1171 | clk_disable_unprepare(priv->clk); |
1170 | 1172 | ||
1171 | close_candev(dev); | 1173 | close_candev(dev); |
1172 | 1174 | ||
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index 5dede6e64376..fb279d6ae484 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c | |||
@@ -97,14 +97,14 @@ static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable) | |||
97 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); | 97 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); |
98 | writel(ctrl, priv->raminit_ctrlreg); | 98 | writel(ctrl, priv->raminit_ctrlreg); |
99 | ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance); | 99 | ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance); |
100 | c_can_hw_raminit_wait_ti(priv, ctrl, mask); | 100 | c_can_hw_raminit_wait_ti(priv, mask, ctrl); |
101 | 101 | ||
102 | if (enable) { | 102 | if (enable) { |
103 | /* Set start bit and wait for the done bit. */ | 103 | /* Set start bit and wait for the done bit. */ |
104 | ctrl |= CAN_RAMINIT_START_MASK(priv->instance); | 104 | ctrl |= CAN_RAMINIT_START_MASK(priv->instance); |
105 | writel(ctrl, priv->raminit_ctrlreg); | 105 | writel(ctrl, priv->raminit_ctrlreg); |
106 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); | 106 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); |
107 | c_can_hw_raminit_wait_ti(priv, ctrl, mask); | 107 | c_can_hw_raminit_wait_ti(priv, mask, ctrl); |
108 | } | 108 | } |
109 | spin_unlock(&raminit_lock); | 109 | spin_unlock(&raminit_lock); |
110 | } | 110 | } |
@@ -280,7 +280,7 @@ static int c_can_plat_probe(struct platform_device *pdev) | |||
280 | 280 | ||
281 | priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start, | 281 | priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start, |
282 | resource_size(res)); | 282 | resource_size(res)); |
283 | if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0) | 283 | if (!priv->raminit_ctrlreg || priv->instance < 0) |
284 | dev_info(&pdev->dev, "control memory is not used for raminit\n"); | 284 | dev_info(&pdev->dev, "control memory is not used for raminit\n"); |
285 | else | 285 | else |
286 | priv->raminit = c_can_hw_raminit_ti; | 286 | priv->raminit = c_can_hw_raminit_ti; |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index f425ec2c7839..6586309329e6 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #define FLEXCAN_MCR_BCC BIT(16) | 62 | #define FLEXCAN_MCR_BCC BIT(16) |
63 | #define FLEXCAN_MCR_LPRIO_EN BIT(13) | 63 | #define FLEXCAN_MCR_LPRIO_EN BIT(13) |
64 | #define FLEXCAN_MCR_AEN BIT(12) | 64 | #define FLEXCAN_MCR_AEN BIT(12) |
65 | #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x1f) | 65 | #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x7f) |
66 | #define FLEXCAN_MCR_IDAM_A (0 << 8) | 66 | #define FLEXCAN_MCR_IDAM_A (0 << 8) |
67 | #define FLEXCAN_MCR_IDAM_B (1 << 8) | 67 | #define FLEXCAN_MCR_IDAM_B (1 << 8) |
68 | #define FLEXCAN_MCR_IDAM_C (2 << 8) | 68 | #define FLEXCAN_MCR_IDAM_C (2 << 8) |
@@ -125,7 +125,9 @@ | |||
125 | FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) | 125 | FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) |
126 | 126 | ||
127 | /* FLEXCAN interrupt flag register (IFLAG) bits */ | 127 | /* FLEXCAN interrupt flag register (IFLAG) bits */ |
128 | #define FLEXCAN_TX_BUF_ID 8 | 128 | /* Errata ERR005829 step7: Reserve first valid MB */ |
129 | #define FLEXCAN_TX_BUF_RESERVED 8 | ||
130 | #define FLEXCAN_TX_BUF_ID 9 | ||
129 | #define FLEXCAN_IFLAG_BUF(x) BIT(x) | 131 | #define FLEXCAN_IFLAG_BUF(x) BIT(x) |
130 | #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) | 132 | #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) |
131 | #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) | 133 | #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) |
@@ -136,6 +138,17 @@ | |||
136 | 138 | ||
137 | /* FLEXCAN message buffers */ | 139 | /* FLEXCAN message buffers */ |
138 | #define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24) | 140 | #define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24) |
141 | #define FLEXCAN_MB_CODE_RX_INACTIVE (0x0 << 24) | ||
142 | #define FLEXCAN_MB_CODE_RX_EMPTY (0x4 << 24) | ||
143 | #define FLEXCAN_MB_CODE_RX_FULL (0x2 << 24) | ||
144 | #define FLEXCAN_MB_CODE_RX_OVERRRUN (0x6 << 24) | ||
145 | #define FLEXCAN_MB_CODE_RX_RANSWER (0xa << 24) | ||
146 | |||
147 | #define FLEXCAN_MB_CODE_TX_INACTIVE (0x8 << 24) | ||
148 | #define FLEXCAN_MB_CODE_TX_ABORT (0x9 << 24) | ||
149 | #define FLEXCAN_MB_CODE_TX_DATA (0xc << 24) | ||
150 | #define FLEXCAN_MB_CODE_TX_TANSWER (0xe << 24) | ||
151 | |||
139 | #define FLEXCAN_MB_CNT_SRR BIT(22) | 152 | #define FLEXCAN_MB_CNT_SRR BIT(22) |
140 | #define FLEXCAN_MB_CNT_IDE BIT(21) | 153 | #define FLEXCAN_MB_CNT_IDE BIT(21) |
141 | #define FLEXCAN_MB_CNT_RTR BIT(20) | 154 | #define FLEXCAN_MB_CNT_RTR BIT(20) |
@@ -298,7 +311,7 @@ static int flexcan_chip_enable(struct flexcan_priv *priv) | |||
298 | flexcan_write(reg, ®s->mcr); | 311 | flexcan_write(reg, ®s->mcr); |
299 | 312 | ||
300 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 313 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
301 | usleep_range(10, 20); | 314 | udelay(10); |
302 | 315 | ||
303 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) | 316 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) |
304 | return -ETIMEDOUT; | 317 | return -ETIMEDOUT; |
@@ -317,7 +330,7 @@ static int flexcan_chip_disable(struct flexcan_priv *priv) | |||
317 | flexcan_write(reg, ®s->mcr); | 330 | flexcan_write(reg, ®s->mcr); |
318 | 331 | ||
319 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 332 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
320 | usleep_range(10, 20); | 333 | udelay(10); |
321 | 334 | ||
322 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 335 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
323 | return -ETIMEDOUT; | 336 | return -ETIMEDOUT; |
@@ -336,7 +349,7 @@ static int flexcan_chip_freeze(struct flexcan_priv *priv) | |||
336 | flexcan_write(reg, ®s->mcr); | 349 | flexcan_write(reg, ®s->mcr); |
337 | 350 | ||
338 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 351 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
339 | usleep_range(100, 200); | 352 | udelay(100); |
340 | 353 | ||
341 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 354 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
342 | return -ETIMEDOUT; | 355 | return -ETIMEDOUT; |
@@ -355,7 +368,7 @@ static int flexcan_chip_unfreeze(struct flexcan_priv *priv) | |||
355 | flexcan_write(reg, ®s->mcr); | 368 | flexcan_write(reg, ®s->mcr); |
356 | 369 | ||
357 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 370 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
358 | usleep_range(10, 20); | 371 | udelay(10); |
359 | 372 | ||
360 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) | 373 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) |
361 | return -ETIMEDOUT; | 374 | return -ETIMEDOUT; |
@@ -370,7 +383,7 @@ static int flexcan_chip_softreset(struct flexcan_priv *priv) | |||
370 | 383 | ||
371 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); | 384 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); |
372 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) | 385 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) |
373 | usleep_range(10, 20); | 386 | udelay(10); |
374 | 387 | ||
375 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) | 388 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) |
376 | return -ETIMEDOUT; | 389 | return -ETIMEDOUT; |
@@ -428,6 +441,14 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
428 | flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id); | 441 | flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id); |
429 | flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | 442 | flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); |
430 | 443 | ||
444 | /* Errata ERR005829 step8: | ||
445 | * Write twice INACTIVE(0x8) code to first MB. | ||
446 | */ | ||
447 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
448 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
449 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
450 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
451 | |||
431 | return NETDEV_TX_OK; | 452 | return NETDEV_TX_OK; |
432 | } | 453 | } |
433 | 454 | ||
@@ -549,6 +570,13 @@ static void do_state(struct net_device *dev, | |||
549 | 570 | ||
550 | /* process state changes depending on the new state */ | 571 | /* process state changes depending on the new state */ |
551 | switch (new_state) { | 572 | switch (new_state) { |
573 | case CAN_STATE_ERROR_WARNING: | ||
574 | netdev_dbg(dev, "Error Warning\n"); | ||
575 | cf->can_id |= CAN_ERR_CRTL; | ||
576 | cf->data[1] = (bec.txerr > bec.rxerr) ? | ||
577 | CAN_ERR_CRTL_TX_WARNING : | ||
578 | CAN_ERR_CRTL_RX_WARNING; | ||
579 | break; | ||
552 | case CAN_STATE_ERROR_ACTIVE: | 580 | case CAN_STATE_ERROR_ACTIVE: |
553 | netdev_dbg(dev, "Error Active\n"); | 581 | netdev_dbg(dev, "Error Active\n"); |
554 | cf->can_id |= CAN_ERR_PROT; | 582 | cf->can_id |= CAN_ERR_PROT; |
@@ -737,6 +765,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) | |||
737 | stats->tx_bytes += can_get_echo_skb(dev, 0); | 765 | stats->tx_bytes += can_get_echo_skb(dev, 0); |
738 | stats->tx_packets++; | 766 | stats->tx_packets++; |
739 | can_led_event(dev, CAN_LED_EVENT_TX); | 767 | can_led_event(dev, CAN_LED_EVENT_TX); |
768 | /* after sending a RTR frame mailbox is in RX mode */ | ||
769 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
770 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | ||
740 | flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1); | 771 | flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1); |
741 | netif_wake_queue(dev); | 772 | netif_wake_queue(dev); |
742 | } | 773 | } |
@@ -794,6 +825,7 @@ static int flexcan_chip_start(struct net_device *dev) | |||
794 | struct flexcan_regs __iomem *regs = priv->base; | 825 | struct flexcan_regs __iomem *regs = priv->base; |
795 | int err; | 826 | int err; |
796 | u32 reg_mcr, reg_ctrl; | 827 | u32 reg_mcr, reg_ctrl; |
828 | int i; | ||
797 | 829 | ||
798 | /* enable module */ | 830 | /* enable module */ |
799 | err = flexcan_chip_enable(priv); | 831 | err = flexcan_chip_enable(priv); |
@@ -852,14 +884,26 @@ static int flexcan_chip_start(struct net_device *dev) | |||
852 | if (priv->devtype_data->features & FLEXCAN_HAS_BROKEN_ERR_STATE || | 884 | if (priv->devtype_data->features & FLEXCAN_HAS_BROKEN_ERR_STATE || |
853 | priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) | 885 | priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) |
854 | reg_ctrl |= FLEXCAN_CTRL_ERR_MSK; | 886 | reg_ctrl |= FLEXCAN_CTRL_ERR_MSK; |
887 | else | ||
888 | reg_ctrl &= ~FLEXCAN_CTRL_ERR_MSK; | ||
855 | 889 | ||
856 | /* save for later use */ | 890 | /* save for later use */ |
857 | priv->reg_ctrl_default = reg_ctrl; | 891 | priv->reg_ctrl_default = reg_ctrl; |
858 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); | 892 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); |
859 | flexcan_write(reg_ctrl, ®s->ctrl); | 893 | flexcan_write(reg_ctrl, ®s->ctrl); |
860 | 894 | ||
861 | /* Abort any pending TX, mark Mailbox as INACTIVE */ | 895 | /* clear and invalidate all mailboxes first */ |
862 | flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), | 896 | for (i = FLEXCAN_TX_BUF_ID; i < ARRAY_SIZE(regs->cantxfg); i++) { |
897 | flexcan_write(FLEXCAN_MB_CODE_RX_INACTIVE, | ||
898 | ®s->cantxfg[i].can_ctrl); | ||
899 | } | ||
900 | |||
901 | /* Errata ERR005829: mark first TX mailbox as INACTIVE */ | ||
902 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
903 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
904 | |||
905 | /* mark TX mailbox as INACTIVE */ | ||
906 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
863 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | 907 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); |
864 | 908 | ||
865 | /* acceptance mask/acceptance code (accept everything) */ | 909 | /* acceptance mask/acceptance code (accept everything) */ |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 7a85590fefb9..e5fac368068a 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -70,6 +70,8 @@ struct peak_pci_chan { | |||
70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ | 70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ |
71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ | 71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ |
72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ | 72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ |
73 | #define PEAK_PCIE_OEM_ID 0x0009 /* PCAN-PCI Express OEM */ | ||
74 | #define PEAK_PCIEC34_DEVICE_ID 0x000A /* PCAN-PCI Express 34 (one channel) */ | ||
73 | 75 | ||
74 | #define PEAK_PCI_CHAN_MAX 4 | 76 | #define PEAK_PCI_CHAN_MAX 4 |
75 | 77 | ||
@@ -87,6 +89,7 @@ static const struct pci_device_id peak_pci_tbl[] = { | |||
87 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 89 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
88 | #ifdef CONFIG_CAN_PEAK_PCIEC | 90 | #ifdef CONFIG_CAN_PEAK_PCIEC |
89 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 91 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
92 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
90 | #endif | 93 | #endif |
91 | {0,} | 94 | {0,} |
92 | }; | 95 | }; |
@@ -653,7 +656,8 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
653 | * This must be done *before* register_sja1000dev() but | 656 | * This must be done *before* register_sja1000dev() but |
654 | * *after* devices linkage | 657 | * *after* devices linkage |
655 | */ | 658 | */ |
656 | if (pdev->device == PEAK_PCIEC_DEVICE_ID) { | 659 | if (pdev->device == PEAK_PCIEC_DEVICE_ID || |
660 | pdev->device == PEAK_PCIEC34_DEVICE_ID) { | ||
657 | err = peak_pciec_probe(pdev, dev); | 661 | err = peak_pciec_probe(pdev, dev); |
658 | if (err) { | 662 | if (err) { |
659 | dev_err(&pdev->dev, | 663 | dev_err(&pdev->dev, |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index d1692154ed1b..b27ac6074afb 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -172,6 +172,35 @@ static void set_normal_mode(struct net_device *dev) | |||
172 | netdev_err(dev, "setting SJA1000 into normal mode failed!\n"); | 172 | netdev_err(dev, "setting SJA1000 into normal mode failed!\n"); |
173 | } | 173 | } |
174 | 174 | ||
175 | /* | ||
176 | * initialize SJA1000 chip: | ||
177 | * - reset chip | ||
178 | * - set output mode | ||
179 | * - set baudrate | ||
180 | * - enable interrupts | ||
181 | * - start operating mode | ||
182 | */ | ||
183 | static void chipset_init(struct net_device *dev) | ||
184 | { | ||
185 | struct sja1000_priv *priv = netdev_priv(dev); | ||
186 | |||
187 | /* set clock divider and output control register */ | ||
188 | priv->write_reg(priv, SJA1000_CDR, priv->cdr | CDR_PELICAN); | ||
189 | |||
190 | /* set acceptance filter (accept all) */ | ||
191 | priv->write_reg(priv, SJA1000_ACCC0, 0x00); | ||
192 | priv->write_reg(priv, SJA1000_ACCC1, 0x00); | ||
193 | priv->write_reg(priv, SJA1000_ACCC2, 0x00); | ||
194 | priv->write_reg(priv, SJA1000_ACCC3, 0x00); | ||
195 | |||
196 | priv->write_reg(priv, SJA1000_ACCM0, 0xFF); | ||
197 | priv->write_reg(priv, SJA1000_ACCM1, 0xFF); | ||
198 | priv->write_reg(priv, SJA1000_ACCM2, 0xFF); | ||
199 | priv->write_reg(priv, SJA1000_ACCM3, 0xFF); | ||
200 | |||
201 | priv->write_reg(priv, SJA1000_OCR, priv->ocr | OCR_MODE_NORMAL); | ||
202 | } | ||
203 | |||
175 | static void sja1000_start(struct net_device *dev) | 204 | static void sja1000_start(struct net_device *dev) |
176 | { | 205 | { |
177 | struct sja1000_priv *priv = netdev_priv(dev); | 206 | struct sja1000_priv *priv = netdev_priv(dev); |
@@ -180,6 +209,10 @@ static void sja1000_start(struct net_device *dev) | |||
180 | if (priv->can.state != CAN_STATE_STOPPED) | 209 | if (priv->can.state != CAN_STATE_STOPPED) |
181 | set_reset_mode(dev); | 210 | set_reset_mode(dev); |
182 | 211 | ||
212 | /* Initialize chip if uninitialized at this stage */ | ||
213 | if (!(priv->read_reg(priv, SJA1000_CDR) & CDR_PELICAN)) | ||
214 | chipset_init(dev); | ||
215 | |||
183 | /* Clear error counters and error code capture */ | 216 | /* Clear error counters and error code capture */ |
184 | priv->write_reg(priv, SJA1000_TXERR, 0x0); | 217 | priv->write_reg(priv, SJA1000_TXERR, 0x0); |
185 | priv->write_reg(priv, SJA1000_RXERR, 0x0); | 218 | priv->write_reg(priv, SJA1000_RXERR, 0x0); |
@@ -237,35 +270,6 @@ static int sja1000_get_berr_counter(const struct net_device *dev, | |||
237 | } | 270 | } |
238 | 271 | ||
239 | /* | 272 | /* |
240 | * initialize SJA1000 chip: | ||
241 | * - reset chip | ||
242 | * - set output mode | ||
243 | * - set baudrate | ||
244 | * - enable interrupts | ||
245 | * - start operating mode | ||
246 | */ | ||
247 | static void chipset_init(struct net_device *dev) | ||
248 | { | ||
249 | struct sja1000_priv *priv = netdev_priv(dev); | ||
250 | |||
251 | /* set clock divider and output control register */ | ||
252 | priv->write_reg(priv, SJA1000_CDR, priv->cdr | CDR_PELICAN); | ||
253 | |||
254 | /* set acceptance filter (accept all) */ | ||
255 | priv->write_reg(priv, SJA1000_ACCC0, 0x00); | ||
256 | priv->write_reg(priv, SJA1000_ACCC1, 0x00); | ||
257 | priv->write_reg(priv, SJA1000_ACCC2, 0x00); | ||
258 | priv->write_reg(priv, SJA1000_ACCC3, 0x00); | ||
259 | |||
260 | priv->write_reg(priv, SJA1000_ACCM0, 0xFF); | ||
261 | priv->write_reg(priv, SJA1000_ACCM1, 0xFF); | ||
262 | priv->write_reg(priv, SJA1000_ACCM2, 0xFF); | ||
263 | priv->write_reg(priv, SJA1000_ACCM3, 0xFF); | ||
264 | |||
265 | priv->write_reg(priv, SJA1000_OCR, priv->ocr | OCR_MODE_NORMAL); | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * transmit a CAN message | 273 | * transmit a CAN message |
270 | * message layout in the sk_buff should be like this: | 274 | * message layout in the sk_buff should be like this: |
271 | * xx xx xx xx ff ll 00 11 22 33 44 55 66 77 | 275 | * xx xx xx xx ff ll 00 11 22 33 44 55 66 77 |
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 059c7414e303..8ca49f04acec 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
@@ -2129,6 +2129,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2129 | int entry = vp->cur_tx % TX_RING_SIZE; | 2129 | int entry = vp->cur_tx % TX_RING_SIZE; |
2130 | struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; | 2130 | struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; |
2131 | unsigned long flags; | 2131 | unsigned long flags; |
2132 | dma_addr_t dma_addr; | ||
2132 | 2133 | ||
2133 | if (vortex_debug > 6) { | 2134 | if (vortex_debug > 6) { |
2134 | pr_debug("boomerang_start_xmit()\n"); | 2135 | pr_debug("boomerang_start_xmit()\n"); |
@@ -2163,24 +2164,48 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2163 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); | 2164 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); |
2164 | 2165 | ||
2165 | if (!skb_shinfo(skb)->nr_frags) { | 2166 | if (!skb_shinfo(skb)->nr_frags) { |
2166 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, | 2167 | dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, |
2167 | skb->len, PCI_DMA_TODEVICE)); | 2168 | PCI_DMA_TODEVICE); |
2169 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2170 | goto out_dma_err; | ||
2171 | |||
2172 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); | ||
2168 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); | 2173 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); |
2169 | } else { | 2174 | } else { |
2170 | int i; | 2175 | int i; |
2171 | 2176 | ||
2172 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, | 2177 | dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, |
2173 | skb_headlen(skb), PCI_DMA_TODEVICE)); | 2178 | skb_headlen(skb), PCI_DMA_TODEVICE); |
2179 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2180 | goto out_dma_err; | ||
2181 | |||
2182 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); | ||
2174 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); | 2183 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); |
2175 | 2184 | ||
2176 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2185 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
2177 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 2186 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
2178 | 2187 | ||
2188 | dma_addr = skb_frag_dma_map(&VORTEX_PCI(vp)->dev, frag, | ||
2189 | 0, | ||
2190 | frag->size, | ||
2191 | DMA_TO_DEVICE); | ||
2192 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) { | ||
2193 | for(i = i-1; i >= 0; i--) | ||
2194 | dma_unmap_page(&VORTEX_PCI(vp)->dev, | ||
2195 | le32_to_cpu(vp->tx_ring[entry].frag[i+1].addr), | ||
2196 | le32_to_cpu(vp->tx_ring[entry].frag[i+1].length), | ||
2197 | DMA_TO_DEVICE); | ||
2198 | |||
2199 | pci_unmap_single(VORTEX_PCI(vp), | ||
2200 | le32_to_cpu(vp->tx_ring[entry].frag[0].addr), | ||
2201 | le32_to_cpu(vp->tx_ring[entry].frag[0].length), | ||
2202 | PCI_DMA_TODEVICE); | ||
2203 | |||
2204 | goto out_dma_err; | ||
2205 | } | ||
2206 | |||
2179 | vp->tx_ring[entry].frag[i+1].addr = | 2207 | vp->tx_ring[entry].frag[i+1].addr = |
2180 | cpu_to_le32(pci_map_single( | 2208 | cpu_to_le32(dma_addr); |
2181 | VORTEX_PCI(vp), | ||
2182 | (void *)skb_frag_address(frag), | ||
2183 | skb_frag_size(frag), PCI_DMA_TODEVICE)); | ||
2184 | 2209 | ||
2185 | if (i == skb_shinfo(skb)->nr_frags-1) | 2210 | if (i == skb_shinfo(skb)->nr_frags-1) |
2186 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); | 2211 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); |
@@ -2189,7 +2214,10 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2189 | } | 2214 | } |
2190 | } | 2215 | } |
2191 | #else | 2216 | #else |
2192 | vp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE)); | 2217 | dma_addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE)); |
2218 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2219 | goto out_dma_err; | ||
2220 | vp->tx_ring[entry].addr = cpu_to_le32(dma_addr); | ||
2193 | vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); | 2221 | vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); |
2194 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); | 2222 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); |
2195 | #endif | 2223 | #endif |
@@ -2217,7 +2245,11 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2217 | skb_tx_timestamp(skb); | 2245 | skb_tx_timestamp(skb); |
2218 | iowrite16(DownUnstall, ioaddr + EL3_CMD); | 2246 | iowrite16(DownUnstall, ioaddr + EL3_CMD); |
2219 | spin_unlock_irqrestore(&vp->lock, flags); | 2247 | spin_unlock_irqrestore(&vp->lock, flags); |
2248 | out: | ||
2220 | return NETDEV_TX_OK; | 2249 | return NETDEV_TX_OK; |
2250 | out_dma_err: | ||
2251 | dev_err(&VORTEX_PCI(vp)->dev, "Error mapping dma buffer\n"); | ||
2252 | goto out; | ||
2221 | } | 2253 | } |
2222 | 2254 | ||
2223 | /* The interrupt handler does all of the Rx thread work and cleans up | 2255 | /* The interrupt handler does all of the Rx thread work and cleans up |
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index 23578dfee249..3005155e412b 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c | |||
@@ -123,6 +123,12 @@ static inline void greth_enable_tx(struct greth_private *greth) | |||
123 | GRETH_REGORIN(greth->regs->control, GRETH_TXEN); | 123 | GRETH_REGORIN(greth->regs->control, GRETH_TXEN); |
124 | } | 124 | } |
125 | 125 | ||
126 | static inline void greth_enable_tx_and_irq(struct greth_private *greth) | ||
127 | { | ||
128 | wmb(); /* BDs must been written to memory before enabling TX */ | ||
129 | GRETH_REGORIN(greth->regs->control, GRETH_TXEN | GRETH_TXI); | ||
130 | } | ||
131 | |||
126 | static inline void greth_disable_tx(struct greth_private *greth) | 132 | static inline void greth_disable_tx(struct greth_private *greth) |
127 | { | 133 | { |
128 | GRETH_REGANDIN(greth->regs->control, ~GRETH_TXEN); | 134 | GRETH_REGANDIN(greth->regs->control, ~GRETH_TXEN); |
@@ -447,29 +453,30 @@ out: | |||
447 | return err; | 453 | return err; |
448 | } | 454 | } |
449 | 455 | ||
456 | static inline u16 greth_num_free_bds(u16 tx_last, u16 tx_next) | ||
457 | { | ||
458 | if (tx_next < tx_last) | ||
459 | return (tx_last - tx_next) - 1; | ||
460 | else | ||
461 | return GRETH_TXBD_NUM - (tx_next - tx_last) - 1; | ||
462 | } | ||
450 | 463 | ||
451 | static netdev_tx_t | 464 | static netdev_tx_t |
452 | greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | 465 | greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) |
453 | { | 466 | { |
454 | struct greth_private *greth = netdev_priv(dev); | 467 | struct greth_private *greth = netdev_priv(dev); |
455 | struct greth_bd *bdp; | 468 | struct greth_bd *bdp; |
456 | u32 status = 0, dma_addr, ctrl; | 469 | u32 status, dma_addr; |
457 | int curr_tx, nr_frags, i, err = NETDEV_TX_OK; | 470 | int curr_tx, nr_frags, i, err = NETDEV_TX_OK; |
458 | unsigned long flags; | 471 | unsigned long flags; |
472 | u16 tx_last; | ||
459 | 473 | ||
460 | nr_frags = skb_shinfo(skb)->nr_frags; | 474 | nr_frags = skb_shinfo(skb)->nr_frags; |
475 | tx_last = greth->tx_last; | ||
476 | rmb(); /* tx_last is updated by the poll task */ | ||
461 | 477 | ||
462 | /* Clean TX Ring */ | 478 | if (greth_num_free_bds(tx_last, greth->tx_next) < nr_frags + 1) { |
463 | greth_clean_tx_gbit(dev); | ||
464 | |||
465 | if (greth->tx_free < nr_frags + 1) { | ||
466 | spin_lock_irqsave(&greth->devlock, flags);/*save from poll/irq*/ | ||
467 | ctrl = GRETH_REGLOAD(greth->regs->control); | ||
468 | /* Enable TX IRQ only if not already in poll() routine */ | ||
469 | if (ctrl & GRETH_RXI) | ||
470 | GRETH_REGSAVE(greth->regs->control, ctrl | GRETH_TXI); | ||
471 | netif_stop_queue(dev); | 479 | netif_stop_queue(dev); |
472 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
473 | err = NETDEV_TX_BUSY; | 480 | err = NETDEV_TX_BUSY; |
474 | goto out; | 481 | goto out; |
475 | } | 482 | } |
@@ -488,6 +495,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
488 | /* Linear buf */ | 495 | /* Linear buf */ |
489 | if (nr_frags != 0) | 496 | if (nr_frags != 0) |
490 | status = GRETH_TXBD_MORE; | 497 | status = GRETH_TXBD_MORE; |
498 | else | ||
499 | status = GRETH_BD_IE; | ||
491 | 500 | ||
492 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 501 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
493 | status |= GRETH_TXBD_CSALL; | 502 | status |= GRETH_TXBD_CSALL; |
@@ -545,14 +554,12 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
545 | 554 | ||
546 | /* Enable the descriptor chain by enabling the first descriptor */ | 555 | /* Enable the descriptor chain by enabling the first descriptor */ |
547 | bdp = greth->tx_bd_base + greth->tx_next; | 556 | bdp = greth->tx_bd_base + greth->tx_next; |
548 | greth_write_bd(&bdp->stat, greth_read_bd(&bdp->stat) | GRETH_BD_EN); | 557 | greth_write_bd(&bdp->stat, |
549 | greth->tx_next = curr_tx; | 558 | greth_read_bd(&bdp->stat) | GRETH_BD_EN); |
550 | greth->tx_free -= nr_frags + 1; | ||
551 | |||
552 | wmb(); | ||
553 | 559 | ||
554 | spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/ | 560 | spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/ |
555 | greth_enable_tx(greth); | 561 | greth->tx_next = curr_tx; |
562 | greth_enable_tx_and_irq(greth); | ||
556 | spin_unlock_irqrestore(&greth->devlock, flags); | 563 | spin_unlock_irqrestore(&greth->devlock, flags); |
557 | 564 | ||
558 | return NETDEV_TX_OK; | 565 | return NETDEV_TX_OK; |
@@ -648,7 +655,6 @@ static void greth_clean_tx(struct net_device *dev) | |||
648 | if (greth->tx_free > 0) { | 655 | if (greth->tx_free > 0) { |
649 | netif_wake_queue(dev); | 656 | netif_wake_queue(dev); |
650 | } | 657 | } |
651 | |||
652 | } | 658 | } |
653 | 659 | ||
654 | static inline void greth_update_tx_stats(struct net_device *dev, u32 stat) | 660 | static inline void greth_update_tx_stats(struct net_device *dev, u32 stat) |
@@ -670,20 +676,22 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
670 | { | 676 | { |
671 | struct greth_private *greth; | 677 | struct greth_private *greth; |
672 | struct greth_bd *bdp, *bdp_last_frag; | 678 | struct greth_bd *bdp, *bdp_last_frag; |
673 | struct sk_buff *skb; | 679 | struct sk_buff *skb = NULL; |
674 | u32 stat; | 680 | u32 stat; |
675 | int nr_frags, i; | 681 | int nr_frags, i; |
682 | u16 tx_last; | ||
676 | 683 | ||
677 | greth = netdev_priv(dev); | 684 | greth = netdev_priv(dev); |
685 | tx_last = greth->tx_last; | ||
678 | 686 | ||
679 | while (greth->tx_free < GRETH_TXBD_NUM) { | 687 | while (tx_last != greth->tx_next) { |
680 | 688 | ||
681 | skb = greth->tx_skbuff[greth->tx_last]; | 689 | skb = greth->tx_skbuff[tx_last]; |
682 | 690 | ||
683 | nr_frags = skb_shinfo(skb)->nr_frags; | 691 | nr_frags = skb_shinfo(skb)->nr_frags; |
684 | 692 | ||
685 | /* We only clean fully completed SKBs */ | 693 | /* We only clean fully completed SKBs */ |
686 | bdp_last_frag = greth->tx_bd_base + SKIP_TX(greth->tx_last, nr_frags); | 694 | bdp_last_frag = greth->tx_bd_base + SKIP_TX(tx_last, nr_frags); |
687 | 695 | ||
688 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_TE | GRETH_INT_TX); | 696 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_TE | GRETH_INT_TX); |
689 | mb(); | 697 | mb(); |
@@ -692,14 +700,14 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
692 | if (stat & GRETH_BD_EN) | 700 | if (stat & GRETH_BD_EN) |
693 | break; | 701 | break; |
694 | 702 | ||
695 | greth->tx_skbuff[greth->tx_last] = NULL; | 703 | greth->tx_skbuff[tx_last] = NULL; |
696 | 704 | ||
697 | greth_update_tx_stats(dev, stat); | 705 | greth_update_tx_stats(dev, stat); |
698 | dev->stats.tx_bytes += skb->len; | 706 | dev->stats.tx_bytes += skb->len; |
699 | 707 | ||
700 | bdp = greth->tx_bd_base + greth->tx_last; | 708 | bdp = greth->tx_bd_base + tx_last; |
701 | 709 | ||
702 | greth->tx_last = NEXT_TX(greth->tx_last); | 710 | tx_last = NEXT_TX(tx_last); |
703 | 711 | ||
704 | dma_unmap_single(greth->dev, | 712 | dma_unmap_single(greth->dev, |
705 | greth_read_bd(&bdp->addr), | 713 | greth_read_bd(&bdp->addr), |
@@ -708,21 +716,26 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
708 | 716 | ||
709 | for (i = 0; i < nr_frags; i++) { | 717 | for (i = 0; i < nr_frags; i++) { |
710 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 718 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
711 | bdp = greth->tx_bd_base + greth->tx_last; | 719 | bdp = greth->tx_bd_base + tx_last; |
712 | 720 | ||
713 | dma_unmap_page(greth->dev, | 721 | dma_unmap_page(greth->dev, |
714 | greth_read_bd(&bdp->addr), | 722 | greth_read_bd(&bdp->addr), |
715 | skb_frag_size(frag), | 723 | skb_frag_size(frag), |
716 | DMA_TO_DEVICE); | 724 | DMA_TO_DEVICE); |
717 | 725 | ||
718 | greth->tx_last = NEXT_TX(greth->tx_last); | 726 | tx_last = NEXT_TX(tx_last); |
719 | } | 727 | } |
720 | greth->tx_free += nr_frags+1; | ||
721 | dev_kfree_skb(skb); | 728 | dev_kfree_skb(skb); |
722 | } | 729 | } |
730 | if (skb) { /* skb is set only if the above while loop was entered */ | ||
731 | wmb(); | ||
732 | greth->tx_last = tx_last; | ||
723 | 733 | ||
724 | if (netif_queue_stopped(dev) && (greth->tx_free > (MAX_SKB_FRAGS+1))) | 734 | if (netif_queue_stopped(dev) && |
725 | netif_wake_queue(dev); | 735 | (greth_num_free_bds(tx_last, greth->tx_next) > |
736 | (MAX_SKB_FRAGS+1))) | ||
737 | netif_wake_queue(dev); | ||
738 | } | ||
726 | } | 739 | } |
727 | 740 | ||
728 | static int greth_rx(struct net_device *dev, int limit) | 741 | static int greth_rx(struct net_device *dev, int limit) |
@@ -965,16 +978,12 @@ static int greth_poll(struct napi_struct *napi, int budget) | |||
965 | greth = container_of(napi, struct greth_private, napi); | 978 | greth = container_of(napi, struct greth_private, napi); |
966 | 979 | ||
967 | restart_txrx_poll: | 980 | restart_txrx_poll: |
968 | if (netif_queue_stopped(greth->netdev)) { | ||
969 | if (greth->gbit_mac) | ||
970 | greth_clean_tx_gbit(greth->netdev); | ||
971 | else | ||
972 | greth_clean_tx(greth->netdev); | ||
973 | } | ||
974 | |||
975 | if (greth->gbit_mac) { | 981 | if (greth->gbit_mac) { |
982 | greth_clean_tx_gbit(greth->netdev); | ||
976 | work_done += greth_rx_gbit(greth->netdev, budget - work_done); | 983 | work_done += greth_rx_gbit(greth->netdev, budget - work_done); |
977 | } else { | 984 | } else { |
985 | if (netif_queue_stopped(greth->netdev)) | ||
986 | greth_clean_tx(greth->netdev); | ||
978 | work_done += greth_rx(greth->netdev, budget - work_done); | 987 | work_done += greth_rx(greth->netdev, budget - work_done); |
979 | } | 988 | } |
980 | 989 | ||
@@ -983,7 +992,8 @@ restart_txrx_poll: | |||
983 | spin_lock_irqsave(&greth->devlock, flags); | 992 | spin_lock_irqsave(&greth->devlock, flags); |
984 | 993 | ||
985 | ctrl = GRETH_REGLOAD(greth->regs->control); | 994 | ctrl = GRETH_REGLOAD(greth->regs->control); |
986 | if (netif_queue_stopped(greth->netdev)) { | 995 | if ((greth->gbit_mac && (greth->tx_last != greth->tx_next)) || |
996 | (!greth->gbit_mac && netif_queue_stopped(greth->netdev))) { | ||
987 | GRETH_REGSAVE(greth->regs->control, | 997 | GRETH_REGSAVE(greth->regs->control, |
988 | ctrl | GRETH_TXI | GRETH_RXI); | 998 | ctrl | GRETH_TXI | GRETH_RXI); |
989 | mask = GRETH_INT_RX | GRETH_INT_RE | | 999 | mask = GRETH_INT_RX | GRETH_INT_RE | |
diff --git a/drivers/net/ethernet/aeroflex/greth.h b/drivers/net/ethernet/aeroflex/greth.h index 232a622a85b7..ae16ac94daf8 100644 --- a/drivers/net/ethernet/aeroflex/greth.h +++ b/drivers/net/ethernet/aeroflex/greth.h | |||
@@ -107,7 +107,7 @@ struct greth_private { | |||
107 | 107 | ||
108 | u16 tx_next; | 108 | u16 tx_next; |
109 | u16 tx_last; | 109 | u16 tx_last; |
110 | u16 tx_free; | 110 | u16 tx_free; /* only used on 10/100Mbit */ |
111 | u16 rx_cur; | 111 | u16 rx_cur; |
112 | 112 | ||
113 | struct greth_regs *regs; /* Address of controller registers. */ | 113 | struct greth_regs *regs; /* Address of controller registers. */ |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c index 346592dca33c..a3c11355a34d 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | |||
@@ -272,8 +272,8 @@ static ssize_t xpcs_reg_value_read(struct file *filp, char __user *buffer, | |||
272 | struct xgbe_prv_data *pdata = filp->private_data; | 272 | struct xgbe_prv_data *pdata = filp->private_data; |
273 | unsigned int value; | 273 | unsigned int value; |
274 | 274 | ||
275 | value = pdata->hw_if.read_mmd_regs(pdata, pdata->debugfs_xpcs_mmd, | 275 | value = XMDIO_READ(pdata, pdata->debugfs_xpcs_mmd, |
276 | pdata->debugfs_xpcs_reg); | 276 | pdata->debugfs_xpcs_reg); |
277 | 277 | ||
278 | return xgbe_common_read(buffer, count, ppos, value); | 278 | return xgbe_common_read(buffer, count, ppos, value); |
279 | } | 279 | } |
@@ -290,8 +290,8 @@ static ssize_t xpcs_reg_value_write(struct file *filp, | |||
290 | if (len < 0) | 290 | if (len < 0) |
291 | return len; | 291 | return len; |
292 | 292 | ||
293 | pdata->hw_if.write_mmd_regs(pdata, pdata->debugfs_xpcs_mmd, | 293 | XMDIO_WRITE(pdata, pdata->debugfs_xpcs_mmd, pdata->debugfs_xpcs_reg, |
294 | pdata->debugfs_xpcs_reg, value); | 294 | value); |
295 | 295 | ||
296 | return len; | 296 | return len; |
297 | } | 297 | } |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c index edaca4496264..ea273836d999 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c | |||
@@ -348,7 +348,7 @@ static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata) | |||
348 | 348 | ||
349 | /* Clear MAC flow control */ | 349 | /* Clear MAC flow control */ |
350 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; | 350 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
351 | q_count = min_t(unsigned int, pdata->rx_q_count, max_q_count); | 351 | q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); |
352 | reg = MAC_Q0TFCR; | 352 | reg = MAC_Q0TFCR; |
353 | for (i = 0; i < q_count; i++) { | 353 | for (i = 0; i < q_count; i++) { |
354 | reg_val = XGMAC_IOREAD(pdata, reg); | 354 | reg_val = XGMAC_IOREAD(pdata, reg); |
@@ -373,7 +373,7 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) | |||
373 | 373 | ||
374 | /* Set MAC flow control */ | 374 | /* Set MAC flow control */ |
375 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; | 375 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
376 | q_count = min_t(unsigned int, pdata->rx_q_count, max_q_count); | 376 | q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); |
377 | reg = MAC_Q0TFCR; | 377 | reg = MAC_Q0TFCR; |
378 | for (i = 0; i < q_count; i++) { | 378 | for (i = 0; i < q_count; i++) { |
379 | reg_val = XGMAC_IOREAD(pdata, reg); | 379 | reg_val = XGMAC_IOREAD(pdata, reg); |
@@ -509,8 +509,8 @@ static void xgbe_enable_mac_interrupts(struct xgbe_prv_data *pdata) | |||
509 | XGMAC_IOWRITE(pdata, MAC_IER, mac_ier); | 509 | XGMAC_IOWRITE(pdata, MAC_IER, mac_ier); |
510 | 510 | ||
511 | /* Enable all counter interrupts */ | 511 | /* Enable all counter interrupts */ |
512 | XGMAC_IOWRITE_BITS(pdata, MMC_RIER, ALL_INTERRUPTS, 0xff); | 512 | XGMAC_IOWRITE_BITS(pdata, MMC_RIER, ALL_INTERRUPTS, 0xffffffff); |
513 | XGMAC_IOWRITE_BITS(pdata, MMC_TIER, ALL_INTERRUPTS, 0xff); | 513 | XGMAC_IOWRITE_BITS(pdata, MMC_TIER, ALL_INTERRUPTS, 0xffffffff); |
514 | } | 514 | } |
515 | 515 | ||
516 | static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) | 516 | static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) |
@@ -1633,6 +1633,9 @@ static int xgbe_flush_tx_queues(struct xgbe_prv_data *pdata) | |||
1633 | { | 1633 | { |
1634 | unsigned int i, count; | 1634 | unsigned int i, count; |
1635 | 1635 | ||
1636 | if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) < 0x21) | ||
1637 | return 0; | ||
1638 | |||
1636 | for (i = 0; i < pdata->tx_q_count; i++) | 1639 | for (i = 0; i < pdata->tx_q_count; i++) |
1637 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_TQOMR, FTQ, 1); | 1640 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_TQOMR, FTQ, 1); |
1638 | 1641 | ||
@@ -1703,8 +1706,8 @@ static void xgbe_config_mtl_mode(struct xgbe_prv_data *pdata) | |||
1703 | XGMAC_IOWRITE_BITS(pdata, MTL_OMR, RAA, MTL_RAA_SP); | 1706 | XGMAC_IOWRITE_BITS(pdata, MTL_OMR, RAA, MTL_RAA_SP); |
1704 | } | 1707 | } |
1705 | 1708 | ||
1706 | static unsigned int xgbe_calculate_per_queue_fifo(unsigned long fifo_size, | 1709 | static unsigned int xgbe_calculate_per_queue_fifo(unsigned int fifo_size, |
1707 | unsigned char queue_count) | 1710 | unsigned int queue_count) |
1708 | { | 1711 | { |
1709 | unsigned int q_fifo_size = 0; | 1712 | unsigned int q_fifo_size = 0; |
1710 | enum xgbe_mtl_fifo_size p_fifo = XGMAC_MTL_FIFO_SIZE_256; | 1713 | enum xgbe_mtl_fifo_size p_fifo = XGMAC_MTL_FIFO_SIZE_256; |
@@ -1748,6 +1751,10 @@ static unsigned int xgbe_calculate_per_queue_fifo(unsigned long fifo_size, | |||
1748 | q_fifo_size = XGBE_FIFO_SIZE_KB(256); | 1751 | q_fifo_size = XGBE_FIFO_SIZE_KB(256); |
1749 | break; | 1752 | break; |
1750 | } | 1753 | } |
1754 | |||
1755 | /* The configured value is not the actual amount of fifo RAM */ | ||
1756 | q_fifo_size = min_t(unsigned int, XGBE_FIFO_MAX, q_fifo_size); | ||
1757 | |||
1751 | q_fifo_size = q_fifo_size / queue_count; | 1758 | q_fifo_size = q_fifo_size / queue_count; |
1752 | 1759 | ||
1753 | /* Set the queue fifo size programmable value */ | 1760 | /* Set the queue fifo size programmable value */ |
@@ -1947,6 +1954,32 @@ static void xgbe_config_vlan_support(struct xgbe_prv_data *pdata) | |||
1947 | xgbe_disable_rx_vlan_stripping(pdata); | 1954 | xgbe_disable_rx_vlan_stripping(pdata); |
1948 | } | 1955 | } |
1949 | 1956 | ||
1957 | static u64 xgbe_mmc_read(struct xgbe_prv_data *pdata, unsigned int reg_lo) | ||
1958 | { | ||
1959 | bool read_hi; | ||
1960 | u64 val; | ||
1961 | |||
1962 | switch (reg_lo) { | ||
1963 | /* These registers are always 64 bit */ | ||
1964 | case MMC_TXOCTETCOUNT_GB_LO: | ||
1965 | case MMC_TXOCTETCOUNT_G_LO: | ||
1966 | case MMC_RXOCTETCOUNT_GB_LO: | ||
1967 | case MMC_RXOCTETCOUNT_G_LO: | ||
1968 | read_hi = true; | ||
1969 | break; | ||
1970 | |||
1971 | default: | ||
1972 | read_hi = false; | ||
1973 | }; | ||
1974 | |||
1975 | val = XGMAC_IOREAD(pdata, reg_lo); | ||
1976 | |||
1977 | if (read_hi) | ||
1978 | val |= ((u64)XGMAC_IOREAD(pdata, reg_lo + 4) << 32); | ||
1979 | |||
1980 | return val; | ||
1981 | } | ||
1982 | |||
1950 | static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) | 1983 | static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) |
1951 | { | 1984 | { |
1952 | struct xgbe_mmc_stats *stats = &pdata->mmc_stats; | 1985 | struct xgbe_mmc_stats *stats = &pdata->mmc_stats; |
@@ -1954,75 +1987,75 @@ static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) | |||
1954 | 1987 | ||
1955 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_GB)) | 1988 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_GB)) |
1956 | stats->txoctetcount_gb += | 1989 | stats->txoctetcount_gb += |
1957 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO); | 1990 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); |
1958 | 1991 | ||
1959 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_GB)) | 1992 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_GB)) |
1960 | stats->txframecount_gb += | 1993 | stats->txframecount_gb += |
1961 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO); | 1994 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); |
1962 | 1995 | ||
1963 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_G)) | 1996 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_G)) |
1964 | stats->txbroadcastframes_g += | 1997 | stats->txbroadcastframes_g += |
1965 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO); | 1998 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); |
1966 | 1999 | ||
1967 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_G)) | 2000 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_G)) |
1968 | stats->txmulticastframes_g += | 2001 | stats->txmulticastframes_g += |
1969 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO); | 2002 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); |
1970 | 2003 | ||
1971 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX64OCTETS_GB)) | 2004 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX64OCTETS_GB)) |
1972 | stats->tx64octets_gb += | 2005 | stats->tx64octets_gb += |
1973 | XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO); | 2006 | xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); |
1974 | 2007 | ||
1975 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX65TO127OCTETS_GB)) | 2008 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX65TO127OCTETS_GB)) |
1976 | stats->tx65to127octets_gb += | 2009 | stats->tx65to127octets_gb += |
1977 | XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO); | 2010 | xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); |
1978 | 2011 | ||
1979 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX128TO255OCTETS_GB)) | 2012 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX128TO255OCTETS_GB)) |
1980 | stats->tx128to255octets_gb += | 2013 | stats->tx128to255octets_gb += |
1981 | XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO); | 2014 | xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); |
1982 | 2015 | ||
1983 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX256TO511OCTETS_GB)) | 2016 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX256TO511OCTETS_GB)) |
1984 | stats->tx256to511octets_gb += | 2017 | stats->tx256to511octets_gb += |
1985 | XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO); | 2018 | xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); |
1986 | 2019 | ||
1987 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX512TO1023OCTETS_GB)) | 2020 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX512TO1023OCTETS_GB)) |
1988 | stats->tx512to1023octets_gb += | 2021 | stats->tx512to1023octets_gb += |
1989 | XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO); | 2022 | xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); |
1990 | 2023 | ||
1991 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX1024TOMAXOCTETS_GB)) | 2024 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX1024TOMAXOCTETS_GB)) |
1992 | stats->tx1024tomaxoctets_gb += | 2025 | stats->tx1024tomaxoctets_gb += |
1993 | XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | 2026 | xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); |
1994 | 2027 | ||
1995 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNICASTFRAMES_GB)) | 2028 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNICASTFRAMES_GB)) |
1996 | stats->txunicastframes_gb += | 2029 | stats->txunicastframes_gb += |
1997 | XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO); | 2030 | xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); |
1998 | 2031 | ||
1999 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_GB)) | 2032 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_GB)) |
2000 | stats->txmulticastframes_gb += | 2033 | stats->txmulticastframes_gb += |
2001 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | 2034 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); |
2002 | 2035 | ||
2003 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_GB)) | 2036 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_GB)) |
2004 | stats->txbroadcastframes_g += | 2037 | stats->txbroadcastframes_g += |
2005 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | 2038 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); |
2006 | 2039 | ||
2007 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNDERFLOWERROR)) | 2040 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNDERFLOWERROR)) |
2008 | stats->txunderflowerror += | 2041 | stats->txunderflowerror += |
2009 | XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO); | 2042 | xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); |
2010 | 2043 | ||
2011 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_G)) | 2044 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_G)) |
2012 | stats->txoctetcount_g += | 2045 | stats->txoctetcount_g += |
2013 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO); | 2046 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); |
2014 | 2047 | ||
2015 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_G)) | 2048 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_G)) |
2016 | stats->txframecount_g += | 2049 | stats->txframecount_g += |
2017 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO); | 2050 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); |
2018 | 2051 | ||
2019 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXPAUSEFRAMES)) | 2052 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXPAUSEFRAMES)) |
2020 | stats->txpauseframes += | 2053 | stats->txpauseframes += |
2021 | XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO); | 2054 | xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); |
2022 | 2055 | ||
2023 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXVLANFRAMES_G)) | 2056 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXVLANFRAMES_G)) |
2024 | stats->txvlanframes_g += | 2057 | stats->txvlanframes_g += |
2025 | XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO); | 2058 | xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); |
2026 | } | 2059 | } |
2027 | 2060 | ||
2028 | static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) | 2061 | static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) |
@@ -2032,95 +2065,95 @@ static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) | |||
2032 | 2065 | ||
2033 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFRAMECOUNT_GB)) | 2066 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFRAMECOUNT_GB)) |
2034 | stats->rxframecount_gb += | 2067 | stats->rxframecount_gb += |
2035 | XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO); | 2068 | xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); |
2036 | 2069 | ||
2037 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_GB)) | 2070 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_GB)) |
2038 | stats->rxoctetcount_gb += | 2071 | stats->rxoctetcount_gb += |
2039 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO); | 2072 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); |
2040 | 2073 | ||
2041 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_G)) | 2074 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_G)) |
2042 | stats->rxoctetcount_g += | 2075 | stats->rxoctetcount_g += |
2043 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO); | 2076 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); |
2044 | 2077 | ||
2045 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXBROADCASTFRAMES_G)) | 2078 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXBROADCASTFRAMES_G)) |
2046 | stats->rxbroadcastframes_g += | 2079 | stats->rxbroadcastframes_g += |
2047 | XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO); | 2080 | xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); |
2048 | 2081 | ||
2049 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXMULTICASTFRAMES_G)) | 2082 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXMULTICASTFRAMES_G)) |
2050 | stats->rxmulticastframes_g += | 2083 | stats->rxmulticastframes_g += |
2051 | XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO); | 2084 | xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); |
2052 | 2085 | ||
2053 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXCRCERROR)) | 2086 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXCRCERROR)) |
2054 | stats->rxcrcerror += | 2087 | stats->rxcrcerror += |
2055 | XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO); | 2088 | xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO); |
2056 | 2089 | ||
2057 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXRUNTERROR)) | 2090 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXRUNTERROR)) |
2058 | stats->rxrunterror += | 2091 | stats->rxrunterror += |
2059 | XGMAC_IOREAD(pdata, MMC_RXRUNTERROR); | 2092 | xgbe_mmc_read(pdata, MMC_RXRUNTERROR); |
2060 | 2093 | ||
2061 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXJABBERERROR)) | 2094 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXJABBERERROR)) |
2062 | stats->rxjabbererror += | 2095 | stats->rxjabbererror += |
2063 | XGMAC_IOREAD(pdata, MMC_RXJABBERERROR); | 2096 | xgbe_mmc_read(pdata, MMC_RXJABBERERROR); |
2064 | 2097 | ||
2065 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNDERSIZE_G)) | 2098 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNDERSIZE_G)) |
2066 | stats->rxundersize_g += | 2099 | stats->rxundersize_g += |
2067 | XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G); | 2100 | xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G); |
2068 | 2101 | ||
2069 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOVERSIZE_G)) | 2102 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOVERSIZE_G)) |
2070 | stats->rxoversize_g += | 2103 | stats->rxoversize_g += |
2071 | XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G); | 2104 | xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G); |
2072 | 2105 | ||
2073 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX64OCTETS_GB)) | 2106 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX64OCTETS_GB)) |
2074 | stats->rx64octets_gb += | 2107 | stats->rx64octets_gb += |
2075 | XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO); | 2108 | xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); |
2076 | 2109 | ||
2077 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX65TO127OCTETS_GB)) | 2110 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX65TO127OCTETS_GB)) |
2078 | stats->rx65to127octets_gb += | 2111 | stats->rx65to127octets_gb += |
2079 | XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO); | 2112 | xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); |
2080 | 2113 | ||
2081 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX128TO255OCTETS_GB)) | 2114 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX128TO255OCTETS_GB)) |
2082 | stats->rx128to255octets_gb += | 2115 | stats->rx128to255octets_gb += |
2083 | XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO); | 2116 | xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); |
2084 | 2117 | ||
2085 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX256TO511OCTETS_GB)) | 2118 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX256TO511OCTETS_GB)) |
2086 | stats->rx256to511octets_gb += | 2119 | stats->rx256to511octets_gb += |
2087 | XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO); | 2120 | xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); |
2088 | 2121 | ||
2089 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX512TO1023OCTETS_GB)) | 2122 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX512TO1023OCTETS_GB)) |
2090 | stats->rx512to1023octets_gb += | 2123 | stats->rx512to1023octets_gb += |
2091 | XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO); | 2124 | xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); |
2092 | 2125 | ||
2093 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX1024TOMAXOCTETS_GB)) | 2126 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX1024TOMAXOCTETS_GB)) |
2094 | stats->rx1024tomaxoctets_gb += | 2127 | stats->rx1024tomaxoctets_gb += |
2095 | XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | 2128 | xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); |
2096 | 2129 | ||
2097 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNICASTFRAMES_G)) | 2130 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNICASTFRAMES_G)) |
2098 | stats->rxunicastframes_g += | 2131 | stats->rxunicastframes_g += |
2099 | XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO); | 2132 | xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); |
2100 | 2133 | ||
2101 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXLENGTHERROR)) | 2134 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXLENGTHERROR)) |
2102 | stats->rxlengtherror += | 2135 | stats->rxlengtherror += |
2103 | XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO); | 2136 | xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO); |
2104 | 2137 | ||
2105 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOUTOFRANGETYPE)) | 2138 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOUTOFRANGETYPE)) |
2106 | stats->rxoutofrangetype += | 2139 | stats->rxoutofrangetype += |
2107 | XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO); | 2140 | xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); |
2108 | 2141 | ||
2109 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXPAUSEFRAMES)) | 2142 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXPAUSEFRAMES)) |
2110 | stats->rxpauseframes += | 2143 | stats->rxpauseframes += |
2111 | XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO); | 2144 | xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); |
2112 | 2145 | ||
2113 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFIFOOVERFLOW)) | 2146 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFIFOOVERFLOW)) |
2114 | stats->rxfifooverflow += | 2147 | stats->rxfifooverflow += |
2115 | XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO); | 2148 | xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); |
2116 | 2149 | ||
2117 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXVLANFRAMES_GB)) | 2150 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXVLANFRAMES_GB)) |
2118 | stats->rxvlanframes_gb += | 2151 | stats->rxvlanframes_gb += |
2119 | XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO); | 2152 | xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); |
2120 | 2153 | ||
2121 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXWATCHDOGERROR)) | 2154 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXWATCHDOGERROR)) |
2122 | stats->rxwatchdogerror += | 2155 | stats->rxwatchdogerror += |
2123 | XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR); | 2156 | xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR); |
2124 | } | 2157 | } |
2125 | 2158 | ||
2126 | static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) | 2159 | static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) |
@@ -2131,127 +2164,127 @@ static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) | |||
2131 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 1); | 2164 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 1); |
2132 | 2165 | ||
2133 | stats->txoctetcount_gb += | 2166 | stats->txoctetcount_gb += |
2134 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO); | 2167 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); |
2135 | 2168 | ||
2136 | stats->txframecount_gb += | 2169 | stats->txframecount_gb += |
2137 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO); | 2170 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); |
2138 | 2171 | ||
2139 | stats->txbroadcastframes_g += | 2172 | stats->txbroadcastframes_g += |
2140 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO); | 2173 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); |
2141 | 2174 | ||
2142 | stats->txmulticastframes_g += | 2175 | stats->txmulticastframes_g += |
2143 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO); | 2176 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); |
2144 | 2177 | ||
2145 | stats->tx64octets_gb += | 2178 | stats->tx64octets_gb += |
2146 | XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO); | 2179 | xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); |
2147 | 2180 | ||
2148 | stats->tx65to127octets_gb += | 2181 | stats->tx65to127octets_gb += |
2149 | XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO); | 2182 | xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); |
2150 | 2183 | ||
2151 | stats->tx128to255octets_gb += | 2184 | stats->tx128to255octets_gb += |
2152 | XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO); | 2185 | xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); |
2153 | 2186 | ||
2154 | stats->tx256to511octets_gb += | 2187 | stats->tx256to511octets_gb += |
2155 | XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO); | 2188 | xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); |
2156 | 2189 | ||
2157 | stats->tx512to1023octets_gb += | 2190 | stats->tx512to1023octets_gb += |
2158 | XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO); | 2191 | xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); |
2159 | 2192 | ||
2160 | stats->tx1024tomaxoctets_gb += | 2193 | stats->tx1024tomaxoctets_gb += |
2161 | XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | 2194 | xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); |
2162 | 2195 | ||
2163 | stats->txunicastframes_gb += | 2196 | stats->txunicastframes_gb += |
2164 | XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO); | 2197 | xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); |
2165 | 2198 | ||
2166 | stats->txmulticastframes_gb += | 2199 | stats->txmulticastframes_gb += |
2167 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | 2200 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); |
2168 | 2201 | ||
2169 | stats->txbroadcastframes_g += | 2202 | stats->txbroadcastframes_g += |
2170 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | 2203 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); |
2171 | 2204 | ||
2172 | stats->txunderflowerror += | 2205 | stats->txunderflowerror += |
2173 | XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO); | 2206 | xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); |
2174 | 2207 | ||
2175 | stats->txoctetcount_g += | 2208 | stats->txoctetcount_g += |
2176 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO); | 2209 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); |
2177 | 2210 | ||
2178 | stats->txframecount_g += | 2211 | stats->txframecount_g += |
2179 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO); | 2212 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); |
2180 | 2213 | ||
2181 | stats->txpauseframes += | 2214 | stats->txpauseframes += |
2182 | XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO); | 2215 | xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); |
2183 | 2216 | ||
2184 | stats->txvlanframes_g += | 2217 | stats->txvlanframes_g += |
2185 | XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO); | 2218 | xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); |
2186 | 2219 | ||
2187 | stats->rxframecount_gb += | 2220 | stats->rxframecount_gb += |
2188 | XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO); | 2221 | xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); |
2189 | 2222 | ||
2190 | stats->rxoctetcount_gb += | 2223 | stats->rxoctetcount_gb += |
2191 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO); | 2224 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); |
2192 | 2225 | ||
2193 | stats->rxoctetcount_g += | 2226 | stats->rxoctetcount_g += |
2194 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO); | 2227 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); |
2195 | 2228 | ||
2196 | stats->rxbroadcastframes_g += | 2229 | stats->rxbroadcastframes_g += |
2197 | XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO); | 2230 | xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); |
2198 | 2231 | ||
2199 | stats->rxmulticastframes_g += | 2232 | stats->rxmulticastframes_g += |
2200 | XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO); | 2233 | xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); |
2201 | 2234 | ||
2202 | stats->rxcrcerror += | 2235 | stats->rxcrcerror += |
2203 | XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO); | 2236 | xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO); |
2204 | 2237 | ||
2205 | stats->rxrunterror += | 2238 | stats->rxrunterror += |
2206 | XGMAC_IOREAD(pdata, MMC_RXRUNTERROR); | 2239 | xgbe_mmc_read(pdata, MMC_RXRUNTERROR); |
2207 | 2240 | ||
2208 | stats->rxjabbererror += | 2241 | stats->rxjabbererror += |
2209 | XGMAC_IOREAD(pdata, MMC_RXJABBERERROR); | 2242 | xgbe_mmc_read(pdata, MMC_RXJABBERERROR); |
2210 | 2243 | ||
2211 | stats->rxundersize_g += | 2244 | stats->rxundersize_g += |
2212 | XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G); | 2245 | xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G); |
2213 | 2246 | ||
2214 | stats->rxoversize_g += | 2247 | stats->rxoversize_g += |
2215 | XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G); | 2248 | xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G); |
2216 | 2249 | ||
2217 | stats->rx64octets_gb += | 2250 | stats->rx64octets_gb += |
2218 | XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO); | 2251 | xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); |
2219 | 2252 | ||
2220 | stats->rx65to127octets_gb += | 2253 | stats->rx65to127octets_gb += |
2221 | XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO); | 2254 | xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); |
2222 | 2255 | ||
2223 | stats->rx128to255octets_gb += | 2256 | stats->rx128to255octets_gb += |
2224 | XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO); | 2257 | xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); |
2225 | 2258 | ||
2226 | stats->rx256to511octets_gb += | 2259 | stats->rx256to511octets_gb += |
2227 | XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO); | 2260 | xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); |
2228 | 2261 | ||
2229 | stats->rx512to1023octets_gb += | 2262 | stats->rx512to1023octets_gb += |
2230 | XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO); | 2263 | xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); |
2231 | 2264 | ||
2232 | stats->rx1024tomaxoctets_gb += | 2265 | stats->rx1024tomaxoctets_gb += |
2233 | XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | 2266 | xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); |
2234 | 2267 | ||
2235 | stats->rxunicastframes_g += | 2268 | stats->rxunicastframes_g += |
2236 | XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO); | 2269 | xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); |
2237 | 2270 | ||
2238 | stats->rxlengtherror += | 2271 | stats->rxlengtherror += |
2239 | XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO); | 2272 | xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO); |
2240 | 2273 | ||
2241 | stats->rxoutofrangetype += | 2274 | stats->rxoutofrangetype += |
2242 | XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO); | 2275 | xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); |
2243 | 2276 | ||
2244 | stats->rxpauseframes += | 2277 | stats->rxpauseframes += |
2245 | XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO); | 2278 | xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); |
2246 | 2279 | ||
2247 | stats->rxfifooverflow += | 2280 | stats->rxfifooverflow += |
2248 | XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO); | 2281 | xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); |
2249 | 2282 | ||
2250 | stats->rxvlanframes_gb += | 2283 | stats->rxvlanframes_gb += |
2251 | XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO); | 2284 | xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); |
2252 | 2285 | ||
2253 | stats->rxwatchdogerror += | 2286 | stats->rxwatchdogerror += |
2254 | XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR); | 2287 | xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR); |
2255 | 2288 | ||
2256 | /* Un-freeze counters */ | 2289 | /* Un-freeze counters */ |
2257 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 0); | 2290 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 0); |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index dc84f7193c2d..b26d75856553 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
@@ -361,6 +361,8 @@ void xgbe_get_all_hw_features(struct xgbe_prv_data *pdata) | |||
361 | 361 | ||
362 | memset(hw_feat, 0, sizeof(*hw_feat)); | 362 | memset(hw_feat, 0, sizeof(*hw_feat)); |
363 | 363 | ||
364 | hw_feat->version = XGMAC_IOREAD(pdata, MAC_VR); | ||
365 | |||
364 | /* Hardware feature register 0 */ | 366 | /* Hardware feature register 0 */ |
365 | hw_feat->gmii = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, GMIISEL); | 367 | hw_feat->gmii = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, GMIISEL); |
366 | hw_feat->vlhash = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, VLHASH); | 368 | hw_feat->vlhash = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, VLHASH); |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c index a076aca138a1..46f613028e9c 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | |||
@@ -361,15 +361,16 @@ static void xgbe_get_drvinfo(struct net_device *netdev, | |||
361 | struct ethtool_drvinfo *drvinfo) | 361 | struct ethtool_drvinfo *drvinfo) |
362 | { | 362 | { |
363 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 363 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
364 | struct xgbe_hw_features *hw_feat = &pdata->hw_feat; | ||
364 | 365 | ||
365 | strlcpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver)); | 366 | strlcpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver)); |
366 | strlcpy(drvinfo->version, XGBE_DRV_VERSION, sizeof(drvinfo->version)); | 367 | strlcpy(drvinfo->version, XGBE_DRV_VERSION, sizeof(drvinfo->version)); |
367 | strlcpy(drvinfo->bus_info, dev_name(pdata->dev), | 368 | strlcpy(drvinfo->bus_info, dev_name(pdata->dev), |
368 | sizeof(drvinfo->bus_info)); | 369 | sizeof(drvinfo->bus_info)); |
369 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d", | 370 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d", |
370 | XGMAC_IOREAD_BITS(pdata, MAC_VR, USERVER), | 371 | XGMAC_GET_BITS(hw_feat->version, MAC_VR, USERVER), |
371 | XGMAC_IOREAD_BITS(pdata, MAC_VR, DEVID), | 372 | XGMAC_GET_BITS(hw_feat->version, MAC_VR, DEVID), |
372 | XGMAC_IOREAD_BITS(pdata, MAC_VR, SNPSVER)); | 373 | XGMAC_GET_BITS(hw_feat->version, MAC_VR, SNPSVER)); |
373 | drvinfo->n_stats = XGBE_STATS_COUNT; | 374 | drvinfo->n_stats = XGBE_STATS_COUNT; |
374 | } | 375 | } |
375 | 376 | ||
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index 8aa6a9353f7b..bdf9cfa70e88 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c | |||
@@ -172,7 +172,7 @@ static struct xgbe_channel *xgbe_alloc_rings(struct xgbe_prv_data *pdata) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | if (i < pdata->rx_ring_count) { | 174 | if (i < pdata->rx_ring_count) { |
175 | spin_lock_init(&tx_ring->lock); | 175 | spin_lock_init(&rx_ring->lock); |
176 | channel->rx_ring = rx_ring++; | 176 | channel->rx_ring = rx_ring++; |
177 | } | 177 | } |
178 | 178 | ||
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h index 07bf70a82908..e9fe6e6ddcc3 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h | |||
@@ -183,6 +183,7 @@ | |||
183 | #define XGMAC_DRIVER_CONTEXT 1 | 183 | #define XGMAC_DRIVER_CONTEXT 1 |
184 | #define XGMAC_IOCTL_CONTEXT 2 | 184 | #define XGMAC_IOCTL_CONTEXT 2 |
185 | 185 | ||
186 | #define XGBE_FIFO_MAX 81920 | ||
186 | #define XGBE_FIFO_SIZE_B(x) (x) | 187 | #define XGBE_FIFO_SIZE_B(x) (x) |
187 | #define XGBE_FIFO_SIZE_KB(x) (x * 1024) | 188 | #define XGBE_FIFO_SIZE_KB(x) (x * 1024) |
188 | 189 | ||
@@ -526,6 +527,9 @@ struct xgbe_desc_if { | |||
526 | * or configurations are present in the device. | 527 | * or configurations are present in the device. |
527 | */ | 528 | */ |
528 | struct xgbe_hw_features { | 529 | struct xgbe_hw_features { |
530 | /* HW Version */ | ||
531 | unsigned int version; | ||
532 | |||
529 | /* HW Feature Register0 */ | 533 | /* HW Feature Register0 */ |
530 | unsigned int gmii; /* 1000 Mbps support */ | 534 | unsigned int gmii; /* 1000 Mbps support */ |
531 | unsigned int vlhash; /* VLAN Hash Filter */ | 535 | unsigned int vlhash; /* VLAN Hash Filter */ |
diff --git a/drivers/net/ethernet/apm/xgene/Kconfig b/drivers/net/ethernet/apm/xgene/Kconfig index 616dff6d3f5f..f4054d242f3c 100644 --- a/drivers/net/ethernet/apm/xgene/Kconfig +++ b/drivers/net/ethernet/apm/xgene/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config NET_XGENE | 1 | config NET_XGENE |
2 | tristate "APM X-Gene SoC Ethernet Driver" | 2 | tristate "APM X-Gene SoC Ethernet Driver" |
3 | depends on HAS_DMA | ||
3 | select PHYLIB | 4 | select PHYLIB |
4 | help | 5 | help |
5 | This is the Ethernet driver for the on-chip ethernet interface on the | 6 | This is the Ethernet driver for the on-chip ethernet interface on the |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index e1a8f4e19983..e4222af2baa6 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c | |||
@@ -563,15 +563,21 @@ static void xgene_enet_free_desc_rings(struct xgene_enet_pdata *pdata) | |||
563 | struct xgene_enet_desc_ring *ring; | 563 | struct xgene_enet_desc_ring *ring; |
564 | 564 | ||
565 | ring = pdata->tx_ring; | 565 | ring = pdata->tx_ring; |
566 | if (ring && ring->cp_ring && ring->cp_ring->cp_skb) | 566 | if (ring) { |
567 | devm_kfree(dev, ring->cp_ring->cp_skb); | 567 | if (ring->cp_ring && ring->cp_ring->cp_skb) |
568 | xgene_enet_free_desc_ring(ring); | 568 | devm_kfree(dev, ring->cp_ring->cp_skb); |
569 | xgene_enet_free_desc_ring(ring); | ||
570 | } | ||
569 | 571 | ||
570 | ring = pdata->rx_ring; | 572 | ring = pdata->rx_ring; |
571 | if (ring && ring->buf_pool && ring->buf_pool->rx_skb) | 573 | if (ring) { |
572 | devm_kfree(dev, ring->buf_pool->rx_skb); | 574 | if (ring->buf_pool) { |
573 | xgene_enet_free_desc_ring(ring->buf_pool); | 575 | if (ring->buf_pool->rx_skb) |
574 | xgene_enet_free_desc_ring(ring); | 576 | devm_kfree(dev, ring->buf_pool->rx_skb); |
577 | xgene_enet_free_desc_ring(ring->buf_pool); | ||
578 | } | ||
579 | xgene_enet_free_desc_ring(ring); | ||
580 | } | ||
575 | } | 581 | } |
576 | 582 | ||
577 | static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring( | 583 | static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring( |
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index fe5cfeace6e3..5919394d9f58 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c | |||
@@ -30,6 +30,17 @@ | |||
30 | #define DRV_VERSION "1.0" | 30 | #define DRV_VERSION "1.0" |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * arc_emac_tx_avail - Return the number of available slots in the tx ring. | ||
34 | * @priv: Pointer to ARC EMAC private data structure. | ||
35 | * | ||
36 | * returns: the number of slots available for transmission in tx the ring. | ||
37 | */ | ||
38 | static inline int arc_emac_tx_avail(struct arc_emac_priv *priv) | ||
39 | { | ||
40 | return (priv->txbd_dirty + TX_BD_NUM - priv->txbd_curr - 1) % TX_BD_NUM; | ||
41 | } | ||
42 | |||
43 | /** | ||
33 | * arc_emac_adjust_link - Adjust the PHY link duplex. | 44 | * arc_emac_adjust_link - Adjust the PHY link duplex. |
34 | * @ndev: Pointer to the net_device structure. | 45 | * @ndev: Pointer to the net_device structure. |
35 | * | 46 | * |
@@ -180,10 +191,15 @@ static void arc_emac_tx_clean(struct net_device *ndev) | |||
180 | txbd->info = 0; | 191 | txbd->info = 0; |
181 | 192 | ||
182 | *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; | 193 | *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; |
183 | |||
184 | if (netif_queue_stopped(ndev)) | ||
185 | netif_wake_queue(ndev); | ||
186 | } | 194 | } |
195 | |||
196 | /* Ensure that txbd_dirty is visible to tx() before checking | ||
197 | * for queue stopped. | ||
198 | */ | ||
199 | smp_mb(); | ||
200 | |||
201 | if (netif_queue_stopped(ndev) && arc_emac_tx_avail(priv)) | ||
202 | netif_wake_queue(ndev); | ||
187 | } | 203 | } |
188 | 204 | ||
189 | /** | 205 | /** |
@@ -298,7 +314,7 @@ static int arc_emac_poll(struct napi_struct *napi, int budget) | |||
298 | work_done = arc_emac_rx(ndev, budget); | 314 | work_done = arc_emac_rx(ndev, budget); |
299 | if (work_done < budget) { | 315 | if (work_done < budget) { |
300 | napi_complete(napi); | 316 | napi_complete(napi); |
301 | arc_reg_or(priv, R_ENABLE, RXINT_MASK); | 317 | arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); |
302 | } | 318 | } |
303 | 319 | ||
304 | return work_done; | 320 | return work_done; |
@@ -327,9 +343,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance) | |||
327 | /* Reset all flags except "MDIO complete" */ | 343 | /* Reset all flags except "MDIO complete" */ |
328 | arc_reg_set(priv, R_STATUS, status); | 344 | arc_reg_set(priv, R_STATUS, status); |
329 | 345 | ||
330 | if (status & RXINT_MASK) { | 346 | if (status & (RXINT_MASK | TXINT_MASK)) { |
331 | if (likely(napi_schedule_prep(&priv->napi))) { | 347 | if (likely(napi_schedule_prep(&priv->napi))) { |
332 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK); | 348 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); |
333 | __napi_schedule(&priv->napi); | 349 | __napi_schedule(&priv->napi); |
334 | } | 350 | } |
335 | } | 351 | } |
@@ -440,7 +456,7 @@ static int arc_emac_open(struct net_device *ndev) | |||
440 | arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); | 456 | arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); |
441 | 457 | ||
442 | /* Enable interrupts */ | 458 | /* Enable interrupts */ |
443 | arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK); | 459 | arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); |
444 | 460 | ||
445 | /* Set CONTROL */ | 461 | /* Set CONTROL */ |
446 | arc_reg_set(priv, R_CTRL, | 462 | arc_reg_set(priv, R_CTRL, |
@@ -511,7 +527,7 @@ static int arc_emac_stop(struct net_device *ndev) | |||
511 | netif_stop_queue(ndev); | 527 | netif_stop_queue(ndev); |
512 | 528 | ||
513 | /* Disable interrupts */ | 529 | /* Disable interrupts */ |
514 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK); | 530 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); |
515 | 531 | ||
516 | /* Disable EMAC */ | 532 | /* Disable EMAC */ |
517 | arc_reg_clr(priv, R_CTRL, EN_MASK); | 533 | arc_reg_clr(priv, R_CTRL, EN_MASK); |
@@ -574,11 +590,9 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) | |||
574 | 590 | ||
575 | len = max_t(unsigned int, ETH_ZLEN, skb->len); | 591 | len = max_t(unsigned int, ETH_ZLEN, skb->len); |
576 | 592 | ||
577 | /* EMAC still holds this buffer in its possession. | 593 | if (unlikely(!arc_emac_tx_avail(priv))) { |
578 | * CPU must not modify this buffer descriptor | ||
579 | */ | ||
580 | if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) { | ||
581 | netif_stop_queue(ndev); | 594 | netif_stop_queue(ndev); |
595 | netdev_err(ndev, "BUG! Tx Ring full when queue awake!\n"); | ||
582 | return NETDEV_TX_BUSY; | 596 | return NETDEV_TX_BUSY; |
583 | } | 597 | } |
584 | 598 | ||
@@ -607,12 +621,19 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) | |||
607 | /* Increment index to point to the next BD */ | 621 | /* Increment index to point to the next BD */ |
608 | *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; | 622 | *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; |
609 | 623 | ||
610 | /* Get "info" of the next BD */ | 624 | /* Ensure that tx_clean() sees the new txbd_curr before |
611 | info = &priv->txbd[*txbd_curr].info; | 625 | * checking the queue status. This prevents an unneeded wake |
626 | * of the queue in tx_clean(). | ||
627 | */ | ||
628 | smp_mb(); | ||
612 | 629 | ||
613 | /* Check if if Tx BD ring is full - next BD is still owned by EMAC */ | 630 | if (!arc_emac_tx_avail(priv)) { |
614 | if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) | ||
615 | netif_stop_queue(ndev); | 631 | netif_stop_queue(ndev); |
632 | /* Refresh tx_dirty */ | ||
633 | smp_mb(); | ||
634 | if (arc_emac_tx_avail(priv)) | ||
635 | netif_start_queue(ndev); | ||
636 | } | ||
616 | 637 | ||
617 | arc_reg_set(priv, R_STATUS, TXPL_MASK); | 638 | arc_reg_set(priv, R_STATUS, TXPL_MASK); |
618 | 639 | ||
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig index 7dcfb19a31c8..d8d07a818b89 100644 --- a/drivers/net/ethernet/broadcom/Kconfig +++ b/drivers/net/ethernet/broadcom/Kconfig | |||
@@ -84,7 +84,7 @@ config BNX2 | |||
84 | 84 | ||
85 | config CNIC | 85 | config CNIC |
86 | tristate "QLogic CNIC support" | 86 | tristate "QLogic CNIC support" |
87 | depends on PCI | 87 | depends on PCI && (IPV6 || IPV6=n) |
88 | select BNX2 | 88 | select BNX2 |
89 | select UIO | 89 | select UIO |
90 | ---help--- | 90 | ---help--- |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 4a7028d65912..d588136b23b9 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -1697,7 +1697,7 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev, | |||
1697 | hwstat->tx_underruns + | 1697 | hwstat->tx_underruns + |
1698 | hwstat->tx_excessive_cols + | 1698 | hwstat->tx_excessive_cols + |
1699 | hwstat->tx_late_cols); | 1699 | hwstat->tx_late_cols); |
1700 | nstat->multicast = hwstat->tx_multicast_pkts; | 1700 | nstat->multicast = hwstat->rx_multicast_pkts; |
1701 | nstat->collisions = hwstat->tx_total_cols; | 1701 | nstat->collisions = hwstat->tx_total_cols; |
1702 | 1702 | ||
1703 | nstat->rx_length_errors = (hwstat->rx_oversize_pkts + | 1703 | nstat->rx_length_errors = (hwstat->rx_oversize_pkts + |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 6f4e18644bd4..d9b9170ed2fc 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -534,6 +534,25 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, | |||
534 | while ((processed < to_process) && (processed < budget)) { | 534 | while ((processed < to_process) && (processed < budget)) { |
535 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | 535 | cb = &priv->rx_cbs[priv->rx_read_ptr]; |
536 | skb = cb->skb; | 536 | skb = cb->skb; |
537 | |||
538 | processed++; | ||
539 | priv->rx_read_ptr++; | ||
540 | |||
541 | if (priv->rx_read_ptr == priv->num_rx_bds) | ||
542 | priv->rx_read_ptr = 0; | ||
543 | |||
544 | /* We do not have a backing SKB, so we do not a corresponding | ||
545 | * DMA mapping for this incoming packet since | ||
546 | * bcm_sysport_rx_refill always either has both skb and mapping | ||
547 | * or none. | ||
548 | */ | ||
549 | if (unlikely(!skb)) { | ||
550 | netif_err(priv, rx_err, ndev, "out of memory!\n"); | ||
551 | ndev->stats.rx_dropped++; | ||
552 | ndev->stats.rx_errors++; | ||
553 | goto refill; | ||
554 | } | ||
555 | |||
537 | dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr), | 556 | dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr), |
538 | RX_BUF_LENGTH, DMA_FROM_DEVICE); | 557 | RX_BUF_LENGTH, DMA_FROM_DEVICE); |
539 | 558 | ||
@@ -543,23 +562,11 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, | |||
543 | status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) & | 562 | status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) & |
544 | DESC_STATUS_MASK; | 563 | DESC_STATUS_MASK; |
545 | 564 | ||
546 | processed++; | ||
547 | priv->rx_read_ptr++; | ||
548 | if (priv->rx_read_ptr == priv->num_rx_bds) | ||
549 | priv->rx_read_ptr = 0; | ||
550 | |||
551 | netif_dbg(priv, rx_status, ndev, | 565 | netif_dbg(priv, rx_status, ndev, |
552 | "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n", | 566 | "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n", |
553 | p_index, priv->rx_c_index, priv->rx_read_ptr, | 567 | p_index, priv->rx_c_index, priv->rx_read_ptr, |
554 | len, status); | 568 | len, status); |
555 | 569 | ||
556 | if (unlikely(!skb)) { | ||
557 | netif_err(priv, rx_err, ndev, "out of memory!\n"); | ||
558 | ndev->stats.rx_dropped++; | ||
559 | ndev->stats.rx_errors++; | ||
560 | goto refill; | ||
561 | } | ||
562 | |||
563 | if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { | 570 | if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { |
564 | netif_err(priv, rx_status, ndev, "fragmented packet!\n"); | 571 | netif_err(priv, rx_status, ndev, "fragmented packet!\n"); |
565 | ndev->stats.rx_dropped++; | 572 | ndev->stats.rx_dropped++; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 4e6c82e20224..4ccc806b1150 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -483,11 +483,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, | |||
483 | 483 | ||
484 | #ifdef BNX2X_STOP_ON_ERROR | 484 | #ifdef BNX2X_STOP_ON_ERROR |
485 | fp->tpa_queue_used |= (1 << queue); | 485 | fp->tpa_queue_used |= (1 << queue); |
486 | #ifdef _ASM_GENERIC_INT_L64_H | ||
487 | DP(NETIF_MSG_RX_STATUS, "fp->tpa_queue_used = 0x%lx\n", | ||
488 | #else | ||
489 | DP(NETIF_MSG_RX_STATUS, "fp->tpa_queue_used = 0x%llx\n", | 486 | DP(NETIF_MSG_RX_STATUS, "fp->tpa_queue_used = 0x%llx\n", |
490 | #endif | ||
491 | fp->tpa_queue_used); | 487 | fp->tpa_queue_used); |
492 | #endif | 488 | #endif |
493 | } | 489 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 5ba8af50c84f..c4daa068f1db 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
@@ -2233,7 +2233,12 @@ struct shmem2_region { | |||
2233 | u32 reserved3; /* Offset 0x14C */ | 2233 | u32 reserved3; /* Offset 0x14C */ |
2234 | u32 reserved4; /* Offset 0x150 */ | 2234 | u32 reserved4; /* Offset 0x150 */ |
2235 | u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */ | 2235 | u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */ |
2236 | #define LINK_ATTR_SYNC_KR2_ENABLE (1<<0) | 2236 | #define LINK_ATTR_SYNC_KR2_ENABLE 0x00000001 |
2237 | #define LINK_SFP_EEPROM_COMP_CODE_MASK 0x0000ff00 | ||
2238 | #define LINK_SFP_EEPROM_COMP_CODE_SHIFT 8 | ||
2239 | #define LINK_SFP_EEPROM_COMP_CODE_SR 0x00001000 | ||
2240 | #define LINK_SFP_EEPROM_COMP_CODE_LR 0x00002000 | ||
2241 | #define LINK_SFP_EEPROM_COMP_CODE_LRM 0x00004000 | ||
2237 | 2242 | ||
2238 | u32 reserved5[2]; | 2243 | u32 reserved5[2]; |
2239 | u32 reserved6[PORT_MAX]; | 2244 | u32 reserved6[PORT_MAX]; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 53fb4fa61b40..549549eaf580 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -154,15 +154,22 @@ typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy, | |||
154 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) | 154 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) |
155 | 155 | ||
156 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 | 156 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 |
157 | #define SFP_EEPROM_CON_TYPE_VAL_UNKNOWN 0x0 | ||
157 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 | 158 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 |
158 | #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 | 159 | #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 |
159 | #define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22 | 160 | #define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22 |
160 | 161 | ||
161 | 162 | ||
162 | #define SFP_EEPROM_COMP_CODE_ADDR 0x3 | 163 | #define SFP_EEPROM_10G_COMP_CODE_ADDR 0x3 |
163 | #define SFP_EEPROM_COMP_CODE_SR_MASK (1<<4) | 164 | #define SFP_EEPROM_10G_COMP_CODE_SR_MASK (1<<4) |
164 | #define SFP_EEPROM_COMP_CODE_LR_MASK (1<<5) | 165 | #define SFP_EEPROM_10G_COMP_CODE_LR_MASK (1<<5) |
165 | #define SFP_EEPROM_COMP_CODE_LRM_MASK (1<<6) | 166 | #define SFP_EEPROM_10G_COMP_CODE_LRM_MASK (1<<6) |
167 | |||
168 | #define SFP_EEPROM_1G_COMP_CODE_ADDR 0x6 | ||
169 | #define SFP_EEPROM_1G_COMP_CODE_SX (1<<0) | ||
170 | #define SFP_EEPROM_1G_COMP_CODE_LX (1<<1) | ||
171 | #define SFP_EEPROM_1G_COMP_CODE_CX (1<<2) | ||
172 | #define SFP_EEPROM_1G_COMP_CODE_BASE_T (1<<3) | ||
166 | 173 | ||
167 | #define SFP_EEPROM_FC_TX_TECH_ADDR 0x8 | 174 | #define SFP_EEPROM_FC_TX_TECH_ADDR 0x8 |
168 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4 | 175 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4 |
@@ -3633,8 +3640,8 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy, | |||
3633 | reg_set[i].val); | 3640 | reg_set[i].val); |
3634 | 3641 | ||
3635 | /* Start KR2 work-around timer which handles BCM8073 link-parner */ | 3642 | /* Start KR2 work-around timer which handles BCM8073 link-parner */ |
3636 | vars->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; | 3643 | params->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; |
3637 | bnx2x_update_link_attr(params, vars->link_attr_sync); | 3644 | bnx2x_update_link_attr(params, params->link_attr_sync); |
3638 | } | 3645 | } |
3639 | 3646 | ||
3640 | static void bnx2x_disable_kr2(struct link_params *params, | 3647 | static void bnx2x_disable_kr2(struct link_params *params, |
@@ -3666,8 +3673,8 @@ static void bnx2x_disable_kr2(struct link_params *params, | |||
3666 | for (i = 0; i < ARRAY_SIZE(reg_set); i++) | 3673 | for (i = 0; i < ARRAY_SIZE(reg_set); i++) |
3667 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3674 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3668 | reg_set[i].val); | 3675 | reg_set[i].val); |
3669 | vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | 3676 | params->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; |
3670 | bnx2x_update_link_attr(params, vars->link_attr_sync); | 3677 | bnx2x_update_link_attr(params, params->link_attr_sync); |
3671 | 3678 | ||
3672 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; | 3679 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; |
3673 | } | 3680 | } |
@@ -4810,7 +4817,7 @@ void bnx2x_link_status_update(struct link_params *params, | |||
4810 | ~FEATURE_CONFIG_PFC_ENABLED; | 4817 | ~FEATURE_CONFIG_PFC_ENABLED; |
4811 | 4818 | ||
4812 | if (SHMEM2_HAS(bp, link_attr_sync)) | 4819 | if (SHMEM2_HAS(bp, link_attr_sync)) |
4813 | vars->link_attr_sync = SHMEM2_RD(bp, | 4820 | params->link_attr_sync = SHMEM2_RD(bp, |
4814 | link_attr_sync[params->port]); | 4821 | link_attr_sync[params->port]); |
4815 | 4822 | ||
4816 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", | 4823 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", |
@@ -8057,21 +8064,24 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8057 | { | 8064 | { |
8058 | struct bnx2x *bp = params->bp; | 8065 | struct bnx2x *bp = params->bp; |
8059 | u32 sync_offset = 0, phy_idx, media_types; | 8066 | u32 sync_offset = 0, phy_idx, media_types; |
8060 | u8 gport, val[2], check_limiting_mode = 0; | 8067 | u8 val[SFP_EEPROM_FC_TX_TECH_ADDR + 1], check_limiting_mode = 0; |
8061 | *edc_mode = EDC_MODE_LIMITING; | 8068 | *edc_mode = EDC_MODE_LIMITING; |
8062 | phy->media_type = ETH_PHY_UNSPECIFIED; | 8069 | phy->media_type = ETH_PHY_UNSPECIFIED; |
8063 | /* First check for copper cable */ | 8070 | /* First check for copper cable */ |
8064 | if (bnx2x_read_sfp_module_eeprom(phy, | 8071 | if (bnx2x_read_sfp_module_eeprom(phy, |
8065 | params, | 8072 | params, |
8066 | I2C_DEV_ADDR_A0, | 8073 | I2C_DEV_ADDR_A0, |
8067 | SFP_EEPROM_CON_TYPE_ADDR, | 8074 | 0, |
8068 | 2, | 8075 | SFP_EEPROM_FC_TX_TECH_ADDR + 1, |
8069 | (u8 *)val) != 0) { | 8076 | (u8 *)val) != 0) { |
8070 | DP(NETIF_MSG_LINK, "Failed to read from SFP+ module EEPROM\n"); | 8077 | DP(NETIF_MSG_LINK, "Failed to read from SFP+ module EEPROM\n"); |
8071 | return -EINVAL; | 8078 | return -EINVAL; |
8072 | } | 8079 | } |
8073 | 8080 | params->link_attr_sync &= ~LINK_SFP_EEPROM_COMP_CODE_MASK; | |
8074 | switch (val[0]) { | 8081 | params->link_attr_sync |= val[SFP_EEPROM_10G_COMP_CODE_ADDR] << |
8082 | LINK_SFP_EEPROM_COMP_CODE_SHIFT; | ||
8083 | bnx2x_update_link_attr(params, params->link_attr_sync); | ||
8084 | switch (val[SFP_EEPROM_CON_TYPE_ADDR]) { | ||
8075 | case SFP_EEPROM_CON_TYPE_VAL_COPPER: | 8085 | case SFP_EEPROM_CON_TYPE_VAL_COPPER: |
8076 | { | 8086 | { |
8077 | u8 copper_module_type; | 8087 | u8 copper_module_type; |
@@ -8079,17 +8089,7 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8079 | /* Check if its active cable (includes SFP+ module) | 8089 | /* Check if its active cable (includes SFP+ module) |
8080 | * of passive cable | 8090 | * of passive cable |
8081 | */ | 8091 | */ |
8082 | if (bnx2x_read_sfp_module_eeprom(phy, | 8092 | copper_module_type = val[SFP_EEPROM_FC_TX_TECH_ADDR]; |
8083 | params, | ||
8084 | I2C_DEV_ADDR_A0, | ||
8085 | SFP_EEPROM_FC_TX_TECH_ADDR, | ||
8086 | 1, | ||
8087 | &copper_module_type) != 0) { | ||
8088 | DP(NETIF_MSG_LINK, | ||
8089 | "Failed to read copper-cable-type" | ||
8090 | " from SFP+ EEPROM\n"); | ||
8091 | return -EINVAL; | ||
8092 | } | ||
8093 | 8093 | ||
8094 | if (copper_module_type & | 8094 | if (copper_module_type & |
8095 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) { | 8095 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) { |
@@ -8115,16 +8115,18 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8115 | } | 8115 | } |
8116 | break; | 8116 | break; |
8117 | } | 8117 | } |
8118 | case SFP_EEPROM_CON_TYPE_VAL_UNKNOWN: | ||
8118 | case SFP_EEPROM_CON_TYPE_VAL_LC: | 8119 | case SFP_EEPROM_CON_TYPE_VAL_LC: |
8119 | case SFP_EEPROM_CON_TYPE_VAL_RJ45: | 8120 | case SFP_EEPROM_CON_TYPE_VAL_RJ45: |
8120 | check_limiting_mode = 1; | 8121 | check_limiting_mode = 1; |
8121 | if ((val[1] & (SFP_EEPROM_COMP_CODE_SR_MASK | | 8122 | if ((val[SFP_EEPROM_10G_COMP_CODE_ADDR] & |
8122 | SFP_EEPROM_COMP_CODE_LR_MASK | | 8123 | (SFP_EEPROM_10G_COMP_CODE_SR_MASK | |
8123 | SFP_EEPROM_COMP_CODE_LRM_MASK)) == 0) { | 8124 | SFP_EEPROM_10G_COMP_CODE_LR_MASK | |
8125 | SFP_EEPROM_10G_COMP_CODE_LRM_MASK)) == 0) { | ||
8124 | DP(NETIF_MSG_LINK, "1G SFP module detected\n"); | 8126 | DP(NETIF_MSG_LINK, "1G SFP module detected\n"); |
8125 | gport = params->port; | ||
8126 | phy->media_type = ETH_PHY_SFP_1G_FIBER; | 8127 | phy->media_type = ETH_PHY_SFP_1G_FIBER; |
8127 | if (phy->req_line_speed != SPEED_1000) { | 8128 | if (phy->req_line_speed != SPEED_1000) { |
8129 | u8 gport = params->port; | ||
8128 | phy->req_line_speed = SPEED_1000; | 8130 | phy->req_line_speed = SPEED_1000; |
8129 | if (!CHIP_IS_E1x(bp)) { | 8131 | if (!CHIP_IS_E1x(bp)) { |
8130 | gport = BP_PATH(bp) + | 8132 | gport = BP_PATH(bp) + |
@@ -8134,6 +8136,12 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8134 | "Warning: Link speed was forced to 1000Mbps. Current SFP module in port %d is not compliant with 10G Ethernet\n", | 8136 | "Warning: Link speed was forced to 1000Mbps. Current SFP module in port %d is not compliant with 10G Ethernet\n", |
8135 | gport); | 8137 | gport); |
8136 | } | 8138 | } |
8139 | if (val[SFP_EEPROM_1G_COMP_CODE_ADDR] & | ||
8140 | SFP_EEPROM_1G_COMP_CODE_BASE_T) { | ||
8141 | bnx2x_sfp_set_transmitter(params, phy, 0); | ||
8142 | msleep(40); | ||
8143 | bnx2x_sfp_set_transmitter(params, phy, 1); | ||
8144 | } | ||
8137 | } else { | 8145 | } else { |
8138 | int idx, cfg_idx = 0; | 8146 | int idx, cfg_idx = 0; |
8139 | DP(NETIF_MSG_LINK, "10G Optic module detected\n"); | 8147 | DP(NETIF_MSG_LINK, "10G Optic module detected\n"); |
@@ -8149,7 +8157,7 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8149 | break; | 8157 | break; |
8150 | default: | 8158 | default: |
8151 | DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n", | 8159 | DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n", |
8152 | val[0]); | 8160 | val[SFP_EEPROM_CON_TYPE_ADDR]); |
8153 | return -EINVAL; | 8161 | return -EINVAL; |
8154 | } | 8162 | } |
8155 | sync_offset = params->shmem_base + | 8163 | sync_offset = params->shmem_base + |
@@ -13507,7 +13515,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13507 | 13515 | ||
13508 | sigdet = bnx2x_warpcore_get_sigdet(phy, params); | 13516 | sigdet = bnx2x_warpcore_get_sigdet(phy, params); |
13509 | if (!sigdet) { | 13517 | if (!sigdet) { |
13510 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | 13518 | if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { |
13511 | bnx2x_kr2_recovery(params, vars, phy); | 13519 | bnx2x_kr2_recovery(params, vars, phy); |
13512 | DP(NETIF_MSG_LINK, "No sigdet\n"); | 13520 | DP(NETIF_MSG_LINK, "No sigdet\n"); |
13513 | } | 13521 | } |
@@ -13525,7 +13533,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13525 | 13533 | ||
13526 | /* CL73 has not begun yet */ | 13534 | /* CL73 has not begun yet */ |
13527 | if (base_page == 0) { | 13535 | if (base_page == 0) { |
13528 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | 13536 | if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { |
13529 | bnx2x_kr2_recovery(params, vars, phy); | 13537 | bnx2x_kr2_recovery(params, vars, phy); |
13530 | DP(NETIF_MSG_LINK, "No BP\n"); | 13538 | DP(NETIF_MSG_LINK, "No BP\n"); |
13531 | } | 13539 | } |
@@ -13541,7 +13549,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13541 | ((next_page & 0xe0) == 0x20)))); | 13549 | ((next_page & 0xe0) == 0x20)))); |
13542 | 13550 | ||
13543 | /* In case KR2 is already disabled, check if we need to re-enable it */ | 13551 | /* In case KR2 is already disabled, check if we need to re-enable it */ |
13544 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | 13552 | if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { |
13545 | if (!not_kr2_device) { | 13553 | if (!not_kr2_device) { |
13546 | DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, | 13554 | DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, |
13547 | next_page); | 13555 | next_page); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h index 389f5f8cb0a3..d9cce4c3899b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h | |||
@@ -323,6 +323,9 @@ struct link_params { | |||
323 | #define LINK_FLAGS_INT_DISABLED (1<<0) | 323 | #define LINK_FLAGS_INT_DISABLED (1<<0) |
324 | #define PHY_INITIALIZED (1<<1) | 324 | #define PHY_INITIALIZED (1<<1) |
325 | u32 lfa_base; | 325 | u32 lfa_base; |
326 | |||
327 | /* The same definitions as the shmem2 parameter */ | ||
328 | u32 link_attr_sync; | ||
326 | }; | 329 | }; |
327 | 330 | ||
328 | /* Output parameters */ | 331 | /* Output parameters */ |
@@ -364,8 +367,6 @@ struct link_vars { | |||
364 | u8 rx_tx_asic_rst; | 367 | u8 rx_tx_asic_rst; |
365 | u8 turn_to_run_wc_rt; | 368 | u8 turn_to_run_wc_rt; |
366 | u16 rsrv2; | 369 | u16 rsrv2; |
367 | /* The same definitions as the shmem2 parameter */ | ||
368 | u32 link_attr_sync; | ||
369 | }; | 370 | }; |
370 | 371 | ||
371 | /***********************************************************/ | 372 | /***********************************************************/ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index c13364b6cc19..d1c093dcb054 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -6849,6 +6849,37 @@ static void bnx2x__common_init_phy(struct bnx2x *bp) | |||
6849 | bnx2x_release_phy_lock(bp); | 6849 | bnx2x_release_phy_lock(bp); |
6850 | } | 6850 | } |
6851 | 6851 | ||
6852 | static void bnx2x_config_endianity(struct bnx2x *bp, u32 val) | ||
6853 | { | ||
6854 | REG_WR(bp, PXP2_REG_RQ_QM_ENDIAN_M, val); | ||
6855 | REG_WR(bp, PXP2_REG_RQ_TM_ENDIAN_M, val); | ||
6856 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, val); | ||
6857 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, val); | ||
6858 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, val); | ||
6859 | |||
6860 | /* make sure this value is 0 */ | ||
6861 | REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 0); | ||
6862 | |||
6863 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, val); | ||
6864 | REG_WR(bp, PXP2_REG_RD_TM_SWAP_MODE, val); | ||
6865 | REG_WR(bp, PXP2_REG_RD_SRC_SWAP_MODE, val); | ||
6866 | REG_WR(bp, PXP2_REG_RD_CDURD_SWAP_MODE, val); | ||
6867 | } | ||
6868 | |||
6869 | static void bnx2x_set_endianity(struct bnx2x *bp) | ||
6870 | { | ||
6871 | #ifdef __BIG_ENDIAN | ||
6872 | bnx2x_config_endianity(bp, 1); | ||
6873 | #else | ||
6874 | bnx2x_config_endianity(bp, 0); | ||
6875 | #endif | ||
6876 | } | ||
6877 | |||
6878 | static void bnx2x_reset_endianity(struct bnx2x *bp) | ||
6879 | { | ||
6880 | bnx2x_config_endianity(bp, 0); | ||
6881 | } | ||
6882 | |||
6852 | /** | 6883 | /** |
6853 | * bnx2x_init_hw_common - initialize the HW at the COMMON phase. | 6884 | * bnx2x_init_hw_common - initialize the HW at the COMMON phase. |
6854 | * | 6885 | * |
@@ -6915,23 +6946,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) | |||
6915 | 6946 | ||
6916 | bnx2x_init_block(bp, BLOCK_PXP2, PHASE_COMMON); | 6947 | bnx2x_init_block(bp, BLOCK_PXP2, PHASE_COMMON); |
6917 | bnx2x_init_pxp(bp); | 6948 | bnx2x_init_pxp(bp); |
6918 | 6949 | bnx2x_set_endianity(bp); | |
6919 | #ifdef __BIG_ENDIAN | ||
6920 | REG_WR(bp, PXP2_REG_RQ_QM_ENDIAN_M, 1); | ||
6921 | REG_WR(bp, PXP2_REG_RQ_TM_ENDIAN_M, 1); | ||
6922 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); | ||
6923 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); | ||
6924 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); | ||
6925 | /* make sure this value is 0 */ | ||
6926 | REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 0); | ||
6927 | |||
6928 | /* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ | ||
6929 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); | ||
6930 | REG_WR(bp, PXP2_REG_RD_TM_SWAP_MODE, 1); | ||
6931 | REG_WR(bp, PXP2_REG_RD_SRC_SWAP_MODE, 1); | ||
6932 | REG_WR(bp, PXP2_REG_RD_CDURD_SWAP_MODE, 1); | ||
6933 | #endif | ||
6934 | |||
6935 | bnx2x_ilt_init_page_size(bp, INITOP_SET); | 6950 | bnx2x_ilt_init_page_size(bp, INITOP_SET); |
6936 | 6951 | ||
6937 | if (CHIP_REV_IS_FPGA(bp) && CHIP_IS_E1H(bp)) | 6952 | if (CHIP_REV_IS_FPGA(bp) && CHIP_IS_E1H(bp)) |
@@ -10052,6 +10067,8 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, | |||
10052 | } | 10067 | } |
10053 | 10068 | ||
10054 | #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4)) | 10069 | #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4)) |
10070 | #define BNX2X_PREV_UNDI_PROD_ADDR_H(f) (BAR_TSTRORM_INTMEM + \ | ||
10071 | 0x1848 + ((f) << 4)) | ||
10055 | #define BNX2X_PREV_UNDI_RCQ(val) ((val) & 0xffff) | 10072 | #define BNX2X_PREV_UNDI_RCQ(val) ((val) & 0xffff) |
10056 | #define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff) | 10073 | #define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff) |
10057 | #define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq)) | 10074 | #define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq)) |
@@ -10059,8 +10076,6 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, | |||
10059 | #define BCM_5710_UNDI_FW_MF_MAJOR (0x07) | 10076 | #define BCM_5710_UNDI_FW_MF_MAJOR (0x07) |
10060 | #define BCM_5710_UNDI_FW_MF_MINOR (0x08) | 10077 | #define BCM_5710_UNDI_FW_MF_MINOR (0x08) |
10061 | #define BCM_5710_UNDI_FW_MF_VERS (0x05) | 10078 | #define BCM_5710_UNDI_FW_MF_VERS (0x05) |
10062 | #define BNX2X_PREV_UNDI_MF_PORT(p) (BAR_TSTRORM_INTMEM + 0x150c + ((p) << 4)) | ||
10063 | #define BNX2X_PREV_UNDI_MF_FUNC(f) (BAR_TSTRORM_INTMEM + 0x184c + ((f) << 4)) | ||
10064 | 10079 | ||
10065 | static bool bnx2x_prev_is_after_undi(struct bnx2x *bp) | 10080 | static bool bnx2x_prev_is_after_undi(struct bnx2x *bp) |
10066 | { | 10081 | { |
@@ -10079,72 +10094,25 @@ static bool bnx2x_prev_is_after_undi(struct bnx2x *bp) | |||
10079 | return false; | 10094 | return false; |
10080 | } | 10095 | } |
10081 | 10096 | ||
10082 | static bool bnx2x_prev_unload_undi_fw_supports_mf(struct bnx2x *bp) | 10097 | static void bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 inc) |
10083 | { | ||
10084 | u8 major, minor, version; | ||
10085 | u32 fw; | ||
10086 | |||
10087 | /* Must check that FW is loaded */ | ||
10088 | if (!(REG_RD(bp, MISC_REG_RESET_REG_1) & | ||
10089 | MISC_REGISTERS_RESET_REG_1_RST_XSEM)) { | ||
10090 | BNX2X_DEV_INFO("XSEM is reset - UNDI MF FW is not loaded\n"); | ||
10091 | return false; | ||
10092 | } | ||
10093 | |||
10094 | /* Read Currently loaded FW version */ | ||
10095 | fw = REG_RD(bp, XSEM_REG_PRAM); | ||
10096 | major = fw & 0xff; | ||
10097 | minor = (fw >> 0x8) & 0xff; | ||
10098 | version = (fw >> 0x10) & 0xff; | ||
10099 | BNX2X_DEV_INFO("Loaded FW: 0x%08x: Major 0x%02x Minor 0x%02x Version 0x%02x\n", | ||
10100 | fw, major, minor, version); | ||
10101 | |||
10102 | if (major > BCM_5710_UNDI_FW_MF_MAJOR) | ||
10103 | return true; | ||
10104 | |||
10105 | if ((major == BCM_5710_UNDI_FW_MF_MAJOR) && | ||
10106 | (minor > BCM_5710_UNDI_FW_MF_MINOR)) | ||
10107 | return true; | ||
10108 | |||
10109 | if ((major == BCM_5710_UNDI_FW_MF_MAJOR) && | ||
10110 | (minor == BCM_5710_UNDI_FW_MF_MINOR) && | ||
10111 | (version >= BCM_5710_UNDI_FW_MF_VERS)) | ||
10112 | return true; | ||
10113 | |||
10114 | return false; | ||
10115 | } | ||
10116 | |||
10117 | static void bnx2x_prev_unload_undi_mf(struct bnx2x *bp) | ||
10118 | { | ||
10119 | int i; | ||
10120 | |||
10121 | /* Due to legacy (FW) code, the first function on each engine has a | ||
10122 | * different offset macro from the rest of the functions. | ||
10123 | * Setting this for all 8 functions is harmless regardless of whether | ||
10124 | * this is actually a multi-function device. | ||
10125 | */ | ||
10126 | for (i = 0; i < 2; i++) | ||
10127 | REG_WR(bp, BNX2X_PREV_UNDI_MF_PORT(i), 1); | ||
10128 | |||
10129 | for (i = 2; i < 8; i++) | ||
10130 | REG_WR(bp, BNX2X_PREV_UNDI_MF_FUNC(i - 2), 1); | ||
10131 | |||
10132 | BNX2X_DEV_INFO("UNDI FW (MF) set to discard\n"); | ||
10133 | } | ||
10134 | |||
10135 | static void bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, u8 inc) | ||
10136 | { | 10098 | { |
10137 | u16 rcq, bd; | 10099 | u16 rcq, bd; |
10138 | u32 tmp_reg = REG_RD(bp, BNX2X_PREV_UNDI_PROD_ADDR(port)); | 10100 | u32 addr, tmp_reg; |
10101 | |||
10102 | if (BP_FUNC(bp) < 2) | ||
10103 | addr = BNX2X_PREV_UNDI_PROD_ADDR(BP_PORT(bp)); | ||
10104 | else | ||
10105 | addr = BNX2X_PREV_UNDI_PROD_ADDR_H(BP_FUNC(bp) - 2); | ||
10139 | 10106 | ||
10107 | tmp_reg = REG_RD(bp, addr); | ||
10140 | rcq = BNX2X_PREV_UNDI_RCQ(tmp_reg) + inc; | 10108 | rcq = BNX2X_PREV_UNDI_RCQ(tmp_reg) + inc; |
10141 | bd = BNX2X_PREV_UNDI_BD(tmp_reg) + inc; | 10109 | bd = BNX2X_PREV_UNDI_BD(tmp_reg) + inc; |
10142 | 10110 | ||
10143 | tmp_reg = BNX2X_PREV_UNDI_PROD(rcq, bd); | 10111 | tmp_reg = BNX2X_PREV_UNDI_PROD(rcq, bd); |
10144 | REG_WR(bp, BNX2X_PREV_UNDI_PROD_ADDR(port), tmp_reg); | 10112 | REG_WR(bp, addr, tmp_reg); |
10145 | 10113 | ||
10146 | BNX2X_DEV_INFO("UNDI producer [%d] rings bd -> 0x%04x, rcq -> 0x%04x\n", | 10114 | BNX2X_DEV_INFO("UNDI producer [%d/%d][%08x] rings bd -> 0x%04x, rcq -> 0x%04x\n", |
10147 | port, bd, rcq); | 10115 | BP_PORT(bp), BP_FUNC(bp), addr, bd, rcq); |
10148 | } | 10116 | } |
10149 | 10117 | ||
10150 | static int bnx2x_prev_mcp_done(struct bnx2x *bp) | 10118 | static int bnx2x_prev_mcp_done(struct bnx2x *bp) |
@@ -10383,7 +10351,6 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) | |||
10383 | /* Reset should be performed after BRB is emptied */ | 10351 | /* Reset should be performed after BRB is emptied */ |
10384 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) { | 10352 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) { |
10385 | u32 timer_count = 1000; | 10353 | u32 timer_count = 1000; |
10386 | bool need_write = true; | ||
10387 | 10354 | ||
10388 | /* Close the MAC Rx to prevent BRB from filling up */ | 10355 | /* Close the MAC Rx to prevent BRB from filling up */ |
10389 | bnx2x_prev_unload_close_mac(bp, &mac_vals); | 10356 | bnx2x_prev_unload_close_mac(bp, &mac_vals); |
@@ -10420,20 +10387,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) | |||
10420 | else | 10387 | else |
10421 | timer_count--; | 10388 | timer_count--; |
10422 | 10389 | ||
10423 | /* New UNDI FW supports MF and contains better | 10390 | /* If UNDI resides in memory, manually increment it */ |
10424 | * cleaning methods - might be redundant but harmless. | 10391 | if (prev_undi) |
10425 | */ | 10392 | bnx2x_prev_unload_undi_inc(bp, 1); |
10426 | if (bnx2x_prev_unload_undi_fw_supports_mf(bp)) { | 10393 | |
10427 | if (need_write) { | ||
10428 | bnx2x_prev_unload_undi_mf(bp); | ||
10429 | need_write = false; | ||
10430 | } | ||
10431 | } else if (prev_undi) { | ||
10432 | /* If UNDI resides in memory, | ||
10433 | * manually increment it | ||
10434 | */ | ||
10435 | bnx2x_prev_unload_undi_inc(bp, BP_PORT(bp), 1); | ||
10436 | } | ||
10437 | udelay(10); | 10394 | udelay(10); |
10438 | } | 10395 | } |
10439 | 10396 | ||
@@ -13227,9 +13184,15 @@ static void __bnx2x_remove(struct pci_dev *pdev, | |||
13227 | bnx2x_iov_remove_one(bp); | 13184 | bnx2x_iov_remove_one(bp); |
13228 | 13185 | ||
13229 | /* Power on: we can't let PCI layer write to us while we are in D3 */ | 13186 | /* Power on: we can't let PCI layer write to us while we are in D3 */ |
13230 | if (IS_PF(bp)) | 13187 | if (IS_PF(bp)) { |
13231 | bnx2x_set_power_state(bp, PCI_D0); | 13188 | bnx2x_set_power_state(bp, PCI_D0); |
13232 | 13189 | ||
13190 | /* Set endianity registers to reset values in case next driver | ||
13191 | * boots in different endianty environment. | ||
13192 | */ | ||
13193 | bnx2x_reset_endianity(bp); | ||
13194 | } | ||
13195 | |||
13233 | /* Disable MSI/MSI-X */ | 13196 | /* Disable MSI/MSI-X */ |
13234 | bnx2x_disable_msi(bp); | 13197 | bnx2x_disable_msi(bp); |
13235 | 13198 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 27861a6c7ca5..a6a9f284c8dd 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/if_vlan.h> | 31 | #include <linux/if_vlan.h> |
32 | #include <linux/prefetch.h> | 32 | #include <linux/prefetch.h> |
33 | #include <linux/random.h> | 33 | #include <linux/random.h> |
34 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 34 | #if IS_ENABLED(CONFIG_VLAN_8021Q) |
35 | #define BCM_VLAN 1 | 35 | #define BCM_VLAN 1 |
36 | #endif | 36 | #endif |
37 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -3685,7 +3685,7 @@ static int cnic_get_v4_route(struct sockaddr_in *dst_addr, | |||
3685 | static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr, | 3685 | static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr, |
3686 | struct dst_entry **dst) | 3686 | struct dst_entry **dst) |
3687 | { | 3687 | { |
3688 | #if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE)) | 3688 | #if IS_ENABLED(CONFIG_IPV6) |
3689 | struct flowi6 fl6; | 3689 | struct flowi6 fl6; |
3690 | 3690 | ||
3691 | memset(&fl6, 0, sizeof(fl6)); | 3691 | memset(&fl6, 0, sizeof(fl6)); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 3f9d4de8173c..5cc9cae21ed5 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -875,6 +875,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
875 | int last_tx_cn, last_c_index, num_tx_bds; | 875 | int last_tx_cn, last_c_index, num_tx_bds; |
876 | struct enet_cb *tx_cb_ptr; | 876 | struct enet_cb *tx_cb_ptr; |
877 | struct netdev_queue *txq; | 877 | struct netdev_queue *txq; |
878 | unsigned int bds_compl; | ||
878 | unsigned int c_index; | 879 | unsigned int c_index; |
879 | 880 | ||
880 | /* Compute how many buffers are transmitted since last xmit call */ | 881 | /* Compute how many buffers are transmitted since last xmit call */ |
@@ -899,7 +900,9 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
899 | /* Reclaim transmitted buffers */ | 900 | /* Reclaim transmitted buffers */ |
900 | while (last_tx_cn-- > 0) { | 901 | while (last_tx_cn-- > 0) { |
901 | tx_cb_ptr = ring->cbs + last_c_index; | 902 | tx_cb_ptr = ring->cbs + last_c_index; |
903 | bds_compl = 0; | ||
902 | if (tx_cb_ptr->skb) { | 904 | if (tx_cb_ptr->skb) { |
905 | bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1; | ||
903 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; | 906 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; |
904 | dma_unmap_single(&dev->dev, | 907 | dma_unmap_single(&dev->dev, |
905 | dma_unmap_addr(tx_cb_ptr, dma_addr), | 908 | dma_unmap_addr(tx_cb_ptr, dma_addr), |
@@ -916,7 +919,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
916 | dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0); | 919 | dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0); |
917 | } | 920 | } |
918 | dev->stats.tx_packets++; | 921 | dev->stats.tx_packets++; |
919 | ring->free_bds += 1; | 922 | ring->free_bds += bds_compl; |
920 | 923 | ||
921 | last_c_index++; | 924 | last_c_index++; |
922 | last_c_index &= (num_tx_bds - 1); | 925 | last_c_index &= (num_tx_bds - 1); |
@@ -1274,12 +1277,29 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, | |||
1274 | 1277 | ||
1275 | while ((rxpktprocessed < rxpkttoprocess) && | 1278 | while ((rxpktprocessed < rxpkttoprocess) && |
1276 | (rxpktprocessed < budget)) { | 1279 | (rxpktprocessed < budget)) { |
1280 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | ||
1281 | skb = cb->skb; | ||
1282 | |||
1283 | rxpktprocessed++; | ||
1284 | |||
1285 | priv->rx_read_ptr++; | ||
1286 | priv->rx_read_ptr &= (priv->num_rx_bds - 1); | ||
1287 | |||
1288 | /* We do not have a backing SKB, so we do not have a | ||
1289 | * corresponding DMA mapping for this incoming packet since | ||
1290 | * bcmgenet_rx_refill always either has both skb and mapping or | ||
1291 | * none. | ||
1292 | */ | ||
1293 | if (unlikely(!skb)) { | ||
1294 | dev->stats.rx_dropped++; | ||
1295 | dev->stats.rx_errors++; | ||
1296 | goto refill; | ||
1297 | } | ||
1298 | |||
1277 | /* Unmap the packet contents such that we can use the | 1299 | /* Unmap the packet contents such that we can use the |
1278 | * RSV from the 64 bytes descriptor when enabled and save | 1300 | * RSV from the 64 bytes descriptor when enabled and save |
1279 | * a 32-bits register read | 1301 | * a 32-bits register read |
1280 | */ | 1302 | */ |
1281 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | ||
1282 | skb = cb->skb; | ||
1283 | dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr), | 1303 | dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr), |
1284 | priv->rx_buf_len, DMA_FROM_DEVICE); | 1304 | priv->rx_buf_len, DMA_FROM_DEVICE); |
1285 | 1305 | ||
@@ -1307,18 +1327,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, | |||
1307 | __func__, p_index, priv->rx_c_index, | 1327 | __func__, p_index, priv->rx_c_index, |
1308 | priv->rx_read_ptr, dma_length_status); | 1328 | priv->rx_read_ptr, dma_length_status); |
1309 | 1329 | ||
1310 | rxpktprocessed++; | ||
1311 | |||
1312 | priv->rx_read_ptr++; | ||
1313 | priv->rx_read_ptr &= (priv->num_rx_bds - 1); | ||
1314 | |||
1315 | /* out of memory, just drop packets at the hardware level */ | ||
1316 | if (unlikely(!skb)) { | ||
1317 | dev->stats.rx_dropped++; | ||
1318 | dev->stats.rx_errors++; | ||
1319 | goto refill; | ||
1320 | } | ||
1321 | |||
1322 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { | 1330 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { |
1323 | netif_err(priv, rx_status, dev, | 1331 | netif_err(priv, rx_status, dev, |
1324 | "dropping fragmented packet!\n"); | 1332 | "dropping fragmented packet!\n"); |
@@ -1736,13 +1744,63 @@ static void bcmgenet_init_multiq(struct net_device *dev) | |||
1736 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | 1744 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); |
1737 | } | 1745 | } |
1738 | 1746 | ||
1747 | static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | ||
1748 | { | ||
1749 | int ret = 0; | ||
1750 | int timeout = 0; | ||
1751 | u32 reg; | ||
1752 | |||
1753 | /* Disable TDMA to stop add more frames in TX DMA */ | ||
1754 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | ||
1755 | reg &= ~DMA_EN; | ||
1756 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | ||
1757 | |||
1758 | /* Check TDMA status register to confirm TDMA is disabled */ | ||
1759 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
1760 | reg = bcmgenet_tdma_readl(priv, DMA_STATUS); | ||
1761 | if (reg & DMA_DISABLED) | ||
1762 | break; | ||
1763 | |||
1764 | udelay(1); | ||
1765 | } | ||
1766 | |||
1767 | if (timeout == DMA_TIMEOUT_VAL) { | ||
1768 | netdev_warn(priv->dev, "Timed out while disabling TX DMA\n"); | ||
1769 | ret = -ETIMEDOUT; | ||
1770 | } | ||
1771 | |||
1772 | /* Wait 10ms for packet drain in both tx and rx dma */ | ||
1773 | usleep_range(10000, 20000); | ||
1774 | |||
1775 | /* Disable RDMA */ | ||
1776 | reg = bcmgenet_rdma_readl(priv, DMA_CTRL); | ||
1777 | reg &= ~DMA_EN; | ||
1778 | bcmgenet_rdma_writel(priv, reg, DMA_CTRL); | ||
1779 | |||
1780 | timeout = 0; | ||
1781 | /* Check RDMA status register to confirm RDMA is disabled */ | ||
1782 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
1783 | reg = bcmgenet_rdma_readl(priv, DMA_STATUS); | ||
1784 | if (reg & DMA_DISABLED) | ||
1785 | break; | ||
1786 | |||
1787 | udelay(1); | ||
1788 | } | ||
1789 | |||
1790 | if (timeout == DMA_TIMEOUT_VAL) { | ||
1791 | netdev_warn(priv->dev, "Timed out while disabling RX DMA\n"); | ||
1792 | ret = -ETIMEDOUT; | ||
1793 | } | ||
1794 | |||
1795 | return ret; | ||
1796 | } | ||
1797 | |||
1739 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | 1798 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) |
1740 | { | 1799 | { |
1741 | int i; | 1800 | int i; |
1742 | 1801 | ||
1743 | /* disable DMA */ | 1802 | /* disable DMA */ |
1744 | bcmgenet_rdma_writel(priv, 0, DMA_CTRL); | 1803 | bcmgenet_dma_teardown(priv); |
1745 | bcmgenet_tdma_writel(priv, 0, DMA_CTRL); | ||
1746 | 1804 | ||
1747 | for (i = 0; i < priv->num_tx_bds; i++) { | 1805 | for (i = 0; i < priv->num_tx_bds; i++) { |
1748 | if (priv->tx_cbs[i].skb != NULL) { | 1806 | if (priv->tx_cbs[i].skb != NULL) { |
@@ -2101,57 +2159,6 @@ err_clk_disable: | |||
2101 | return ret; | 2159 | return ret; |
2102 | } | 2160 | } |
2103 | 2161 | ||
2104 | static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | ||
2105 | { | ||
2106 | int ret = 0; | ||
2107 | int timeout = 0; | ||
2108 | u32 reg; | ||
2109 | |||
2110 | /* Disable TDMA to stop add more frames in TX DMA */ | ||
2111 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | ||
2112 | reg &= ~DMA_EN; | ||
2113 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | ||
2114 | |||
2115 | /* Check TDMA status register to confirm TDMA is disabled */ | ||
2116 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
2117 | reg = bcmgenet_tdma_readl(priv, DMA_STATUS); | ||
2118 | if (reg & DMA_DISABLED) | ||
2119 | break; | ||
2120 | |||
2121 | udelay(1); | ||
2122 | } | ||
2123 | |||
2124 | if (timeout == DMA_TIMEOUT_VAL) { | ||
2125 | netdev_warn(priv->dev, "Timed out while disabling TX DMA\n"); | ||
2126 | ret = -ETIMEDOUT; | ||
2127 | } | ||
2128 | |||
2129 | /* Wait 10ms for packet drain in both tx and rx dma */ | ||
2130 | usleep_range(10000, 20000); | ||
2131 | |||
2132 | /* Disable RDMA */ | ||
2133 | reg = bcmgenet_rdma_readl(priv, DMA_CTRL); | ||
2134 | reg &= ~DMA_EN; | ||
2135 | bcmgenet_rdma_writel(priv, reg, DMA_CTRL); | ||
2136 | |||
2137 | timeout = 0; | ||
2138 | /* Check RDMA status register to confirm RDMA is disabled */ | ||
2139 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
2140 | reg = bcmgenet_rdma_readl(priv, DMA_STATUS); | ||
2141 | if (reg & DMA_DISABLED) | ||
2142 | break; | ||
2143 | |||
2144 | udelay(1); | ||
2145 | } | ||
2146 | |||
2147 | if (timeout == DMA_TIMEOUT_VAL) { | ||
2148 | netdev_warn(priv->dev, "Timed out while disabling RX DMA\n"); | ||
2149 | ret = -ETIMEDOUT; | ||
2150 | } | ||
2151 | |||
2152 | return ret; | ||
2153 | } | ||
2154 | |||
2155 | static void bcmgenet_netif_stop(struct net_device *dev) | 2162 | static void bcmgenet_netif_stop(struct net_device *dev) |
2156 | { | 2163 | { |
2157 | struct bcmgenet_priv *priv = netdev_priv(dev); | 2164 | struct bcmgenet_priv *priv = netdev_priv(dev); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3ac5d23454a8..e7d3a620d96a 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7914 | 7914 | ||
7915 | entry = tnapi->tx_prod; | 7915 | entry = tnapi->tx_prod; |
7916 | base_flags = 0; | 7916 | base_flags = 0; |
7917 | if (skb->ip_summed == CHECKSUM_PARTIAL) | ||
7918 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | ||
7919 | 7917 | ||
7920 | mss = skb_shinfo(skb)->gso_size; | 7918 | mss = skb_shinfo(skb)->gso_size; |
7921 | if (mss) { | 7919 | if (mss) { |
@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7929 | 7927 | ||
7930 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; | 7928 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; |
7931 | 7929 | ||
7930 | /* HW/FW can not correctly segment packets that have been | ||
7931 | * vlan encapsulated. | ||
7932 | */ | ||
7933 | if (skb->protocol == htons(ETH_P_8021Q) || | ||
7934 | skb->protocol == htons(ETH_P_8021AD)) | ||
7935 | return tg3_tso_bug(tp, tnapi, txq, skb); | ||
7936 | |||
7932 | if (!skb_is_gso_v6(skb)) { | 7937 | if (!skb_is_gso_v6(skb)) { |
7933 | if (unlikely((ETH_HLEN + hdr_len) > 80) && | 7938 | if (unlikely((ETH_HLEN + hdr_len) > 80) && |
7934 | tg3_flag(tp, TSO_BUG)) | 7939 | tg3_flag(tp, TSO_BUG)) |
@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7979 | base_flags |= tsflags << 12; | 7984 | base_flags |= tsflags << 12; |
7980 | } | 7985 | } |
7981 | } | 7986 | } |
7987 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
7988 | /* HW/FW can not correctly checksum packets that have been | ||
7989 | * vlan encapsulated. | ||
7990 | */ | ||
7991 | if (skb->protocol == htons(ETH_P_8021Q) || | ||
7992 | skb->protocol == htons(ETH_P_8021AD)) { | ||
7993 | if (skb_checksum_help(skb)) | ||
7994 | goto drop; | ||
7995 | } else { | ||
7996 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | ||
7997 | } | ||
7982 | } | 7998 | } |
7983 | 7999 | ||
7984 | if (tg3_flag(tp, USE_JUMBO_BDFLAG) && | 8000 | if (tg3_flag(tp, USE_JUMBO_BDFLAG) && |
@@ -11617,6 +11633,12 @@ static int tg3_open(struct net_device *dev) | |||
11617 | struct tg3 *tp = netdev_priv(dev); | 11633 | struct tg3 *tp = netdev_priv(dev); |
11618 | int err; | 11634 | int err; |
11619 | 11635 | ||
11636 | if (tp->pcierr_recovery) { | ||
11637 | netdev_err(dev, "Failed to open device. PCI error recovery " | ||
11638 | "in progress\n"); | ||
11639 | return -EAGAIN; | ||
11640 | } | ||
11641 | |||
11620 | if (tp->fw_needed) { | 11642 | if (tp->fw_needed) { |
11621 | err = tg3_request_firmware(tp); | 11643 | err = tg3_request_firmware(tp); |
11622 | if (tg3_asic_rev(tp) == ASIC_REV_57766) { | 11644 | if (tg3_asic_rev(tp) == ASIC_REV_57766) { |
@@ -11674,6 +11696,12 @@ static int tg3_close(struct net_device *dev) | |||
11674 | { | 11696 | { |
11675 | struct tg3 *tp = netdev_priv(dev); | 11697 | struct tg3 *tp = netdev_priv(dev); |
11676 | 11698 | ||
11699 | if (tp->pcierr_recovery) { | ||
11700 | netdev_err(dev, "Failed to close device. PCI error recovery " | ||
11701 | "in progress\n"); | ||
11702 | return -EAGAIN; | ||
11703 | } | ||
11704 | |||
11677 | tg3_ptp_fini(tp); | 11705 | tg3_ptp_fini(tp); |
11678 | 11706 | ||
11679 | tg3_stop(tp); | 11707 | tg3_stop(tp); |
@@ -17561,6 +17589,7 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
17561 | tp->rx_mode = TG3_DEF_RX_MODE; | 17589 | tp->rx_mode = TG3_DEF_RX_MODE; |
17562 | tp->tx_mode = TG3_DEF_TX_MODE; | 17590 | tp->tx_mode = TG3_DEF_TX_MODE; |
17563 | tp->irq_sync = 1; | 17591 | tp->irq_sync = 1; |
17592 | tp->pcierr_recovery = false; | ||
17564 | 17593 | ||
17565 | if (tg3_debug > 0) | 17594 | if (tg3_debug > 0) |
17566 | tp->msg_enable = tg3_debug; | 17595 | tp->msg_enable = tg3_debug; |
@@ -18071,6 +18100,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | |||
18071 | 18100 | ||
18072 | rtnl_lock(); | 18101 | rtnl_lock(); |
18073 | 18102 | ||
18103 | tp->pcierr_recovery = true; | ||
18104 | |||
18074 | /* We probably don't have netdev yet */ | 18105 | /* We probably don't have netdev yet */ |
18075 | if (!netdev || !netif_running(netdev)) | 18106 | if (!netdev || !netif_running(netdev)) |
18076 | goto done; | 18107 | goto done; |
@@ -18195,6 +18226,7 @@ static void tg3_io_resume(struct pci_dev *pdev) | |||
18195 | tg3_phy_start(tp); | 18226 | tg3_phy_start(tp); |
18196 | 18227 | ||
18197 | done: | 18228 | done: |
18229 | tp->pcierr_recovery = false; | ||
18198 | rtnl_unlock(); | 18230 | rtnl_unlock(); |
18199 | } | 18231 | } |
18200 | 18232 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index 461accaf0aa4..31c9f8295953 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -3407,6 +3407,7 @@ struct tg3 { | |||
3407 | 3407 | ||
3408 | struct device *hwmon_dev; | 3408 | struct device *hwmon_dev; |
3409 | bool link_up; | 3409 | bool link_up; |
3410 | bool pcierr_recovery; | ||
3410 | }; | 3411 | }; |
3411 | 3412 | ||
3412 | /* Accessor macros for chip and asic attributes | 3413 | /* Accessor macros for chip and asic attributes |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ff8cae5e2535..ffc92a41d75b 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -2506,7 +2506,7 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb) | |||
2506 | * For TSO, the TCP checksum field is seeded with pseudo-header sum | 2506 | * For TSO, the TCP checksum field is seeded with pseudo-header sum |
2507 | * excluding the length field. | 2507 | * excluding the length field. |
2508 | */ | 2508 | */ |
2509 | if (skb->protocol == htons(ETH_P_IP)) { | 2509 | if (vlan_get_protocol(skb) == htons(ETH_P_IP)) { |
2510 | struct iphdr *iph = ip_hdr(skb); | 2510 | struct iphdr *iph = ip_hdr(skb); |
2511 | 2511 | ||
2512 | /* Do we really need these? */ | 2512 | /* Do we really need these? */ |
@@ -2870,12 +2870,13 @@ bnad_txq_wi_prepare(struct bnad *bnad, struct bna_tcb *tcb, | |||
2870 | } | 2870 | } |
2871 | 2871 | ||
2872 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2872 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2873 | __be16 net_proto = vlan_get_protocol(skb); | ||
2873 | u8 proto = 0; | 2874 | u8 proto = 0; |
2874 | 2875 | ||
2875 | if (skb->protocol == htons(ETH_P_IP)) | 2876 | if (net_proto == htons(ETH_P_IP)) |
2876 | proto = ip_hdr(skb)->protocol; | 2877 | proto = ip_hdr(skb)->protocol; |
2877 | #ifdef NETIF_F_IPV6_CSUM | 2878 | #ifdef NETIF_F_IPV6_CSUM |
2878 | else if (skb->protocol == htons(ETH_P_IPV6)) { | 2879 | else if (net_proto == htons(ETH_P_IPV6)) { |
2879 | /* nexthdr may not be TCP immediately. */ | 2880 | /* nexthdr may not be TCP immediately. */ |
2880 | proto = ipv6_hdr(skb)->nexthdr; | 2881 | proto = ipv6_hdr(skb)->nexthdr; |
2881 | } | 2882 | } |
diff --git a/drivers/net/ethernet/calxeda/Kconfig b/drivers/net/ethernet/calxeda/Kconfig index 184a063bed5f..07d2201530d2 100644 --- a/drivers/net/ethernet/calxeda/Kconfig +++ b/drivers/net/ethernet/calxeda/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config NET_CALXEDA_XGMAC | 1 | config NET_CALXEDA_XGMAC |
2 | tristate "Calxeda 1G/10G XGMAC Ethernet driver" | 2 | tristate "Calxeda 1G/10G XGMAC Ethernet driver" |
3 | depends on HAS_IOMEM && HAS_DMA | 3 | depends on HAS_IOMEM && HAS_DMA |
4 | depends on ARCH_HIGHBANK || COMPILE_TEST | ||
4 | select CRC32 | 5 | select CRC32 |
5 | help | 6 | help |
6 | This is the driver for the XGMAC Ethernet IP block found on Calxeda | 7 | This is the driver for the XGMAC Ethernet IP block found on Calxeda |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index d57282172ea5..c067b7888ac4 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -652,6 +652,7 @@ struct adapter { | |||
652 | struct tid_info tids; | 652 | struct tid_info tids; |
653 | void **tid_release_head; | 653 | void **tid_release_head; |
654 | spinlock_t tid_release_lock; | 654 | spinlock_t tid_release_lock; |
655 | struct workqueue_struct *workq; | ||
655 | struct work_struct tid_release_task; | 656 | struct work_struct tid_release_task; |
656 | struct work_struct db_full_task; | 657 | struct work_struct db_full_task; |
657 | struct work_struct db_drop_task; | 658 | struct work_struct db_drop_task; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 1afee70ce856..e5be511a3c38 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -643,8 +643,6 @@ static int set_rxmode(struct net_device *dev, int mtu, bool sleep_ok) | |||
643 | return ret; | 643 | return ret; |
644 | } | 644 | } |
645 | 645 | ||
646 | static struct workqueue_struct *workq; | ||
647 | |||
648 | /** | 646 | /** |
649 | * link_start - enable a port | 647 | * link_start - enable a port |
650 | * @dev: the port to enable | 648 | * @dev: the port to enable |
@@ -1255,7 +1253,9 @@ freeout: t4_free_sge_resources(adap); | |||
1255 | goto freeout; | 1253 | goto freeout; |
1256 | } | 1254 | } |
1257 | 1255 | ||
1258 | t4_write_reg(adap, MPS_TRC_RSS_CONTROL, | 1256 | t4_write_reg(adap, is_t4(adap->params.chip) ? |
1257 | MPS_TRC_RSS_CONTROL : | ||
1258 | MPS_T5_TRC_RSS_CONTROL, | ||
1259 | RSSCONTROL(netdev2pinfo(adap->port[0])->tx_chan) | | 1259 | RSSCONTROL(netdev2pinfo(adap->port[0])->tx_chan) | |
1260 | QUEUENUMBER(s->ethrxq[0].rspq.abs_id)); | 1260 | QUEUENUMBER(s->ethrxq[0].rspq.abs_id)); |
1261 | return 0; | 1261 | return 0; |
@@ -1763,7 +1763,8 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
1763 | 0xd004, 0xd03c, | 1763 | 0xd004, 0xd03c, |
1764 | 0xdfc0, 0xdfe0, | 1764 | 0xdfc0, 0xdfe0, |
1765 | 0xe000, 0xea7c, | 1765 | 0xe000, 0xea7c, |
1766 | 0xf000, 0x11190, | 1766 | 0xf000, 0x11110, |
1767 | 0x11118, 0x11190, | ||
1767 | 0x19040, 0x1906c, | 1768 | 0x19040, 0x1906c, |
1768 | 0x19078, 0x19080, | 1769 | 0x19078, 0x19080, |
1769 | 0x1908c, 0x19124, | 1770 | 0x1908c, 0x19124, |
@@ -1970,7 +1971,8 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
1970 | 0xd004, 0xd03c, | 1971 | 0xd004, 0xd03c, |
1971 | 0xdfc0, 0xdfe0, | 1972 | 0xdfc0, 0xdfe0, |
1972 | 0xe000, 0x11088, | 1973 | 0xe000, 0x11088, |
1973 | 0x1109c, 0x1117c, | 1974 | 0x1109c, 0x11110, |
1975 | 0x11118, 0x1117c, | ||
1974 | 0x11190, 0x11204, | 1976 | 0x11190, 0x11204, |
1975 | 0x19040, 0x1906c, | 1977 | 0x19040, 0x1906c, |
1976 | 0x19078, 0x19080, | 1978 | 0x19078, 0x19080, |
@@ -3340,7 +3342,7 @@ static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, | |||
3340 | adap->tid_release_head = (void **)((uintptr_t)p | chan); | 3342 | adap->tid_release_head = (void **)((uintptr_t)p | chan); |
3341 | if (!adap->tid_release_task_busy) { | 3343 | if (!adap->tid_release_task_busy) { |
3342 | adap->tid_release_task_busy = true; | 3344 | adap->tid_release_task_busy = true; |
3343 | queue_work(workq, &adap->tid_release_task); | 3345 | queue_work(adap->workq, &adap->tid_release_task); |
3344 | } | 3346 | } |
3345 | spin_unlock_bh(&adap->tid_release_lock); | 3347 | spin_unlock_bh(&adap->tid_release_lock); |
3346 | } | 3348 | } |
@@ -4140,7 +4142,7 @@ void t4_db_full(struct adapter *adap) | |||
4140 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); | 4142 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); |
4141 | t4_set_reg_field(adap, SGE_INT_ENABLE3, | 4143 | t4_set_reg_field(adap, SGE_INT_ENABLE3, |
4142 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); | 4144 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); |
4143 | queue_work(workq, &adap->db_full_task); | 4145 | queue_work(adap->workq, &adap->db_full_task); |
4144 | } | 4146 | } |
4145 | } | 4147 | } |
4146 | 4148 | ||
@@ -4150,7 +4152,7 @@ void t4_db_dropped(struct adapter *adap) | |||
4150 | disable_dbs(adap); | 4152 | disable_dbs(adap); |
4151 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); | 4153 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); |
4152 | } | 4154 | } |
4153 | queue_work(workq, &adap->db_drop_task); | 4155 | queue_work(adap->workq, &adap->db_drop_task); |
4154 | } | 4156 | } |
4155 | 4157 | ||
4156 | static void uld_attach(struct adapter *adap, unsigned int uld) | 4158 | static void uld_attach(struct adapter *adap, unsigned int uld) |
@@ -5957,7 +5959,8 @@ static int adap_init0(struct adapter *adap) | |||
5957 | params[3] = FW_PARAM_PFVF(CQ_END); | 5959 | params[3] = FW_PARAM_PFVF(CQ_END); |
5958 | params[4] = FW_PARAM_PFVF(OCQ_START); | 5960 | params[4] = FW_PARAM_PFVF(OCQ_START); |
5959 | params[5] = FW_PARAM_PFVF(OCQ_END); | 5961 | params[5] = FW_PARAM_PFVF(OCQ_END); |
5960 | ret = t4_query_params(adap, 0, 0, 0, 6, params, val); | 5962 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6, params, |
5963 | val); | ||
5961 | if (ret < 0) | 5964 | if (ret < 0) |
5962 | goto bye; | 5965 | goto bye; |
5963 | adap->vres.qp.start = val[0]; | 5966 | adap->vres.qp.start = val[0]; |
@@ -5969,7 +5972,8 @@ static int adap_init0(struct adapter *adap) | |||
5969 | 5972 | ||
5970 | params[0] = FW_PARAM_DEV(MAXORDIRD_QP); | 5973 | params[0] = FW_PARAM_DEV(MAXORDIRD_QP); |
5971 | params[1] = FW_PARAM_DEV(MAXIRD_ADAPTER); | 5974 | params[1] = FW_PARAM_DEV(MAXIRD_ADAPTER); |
5972 | ret = t4_query_params(adap, 0, 0, 0, 2, params, val); | 5975 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, |
5976 | val); | ||
5973 | if (ret < 0) { | 5977 | if (ret < 0) { |
5974 | adap->params.max_ordird_qp = 8; | 5978 | adap->params.max_ordird_qp = 8; |
5975 | adap->params.max_ird_adapter = 32 * adap->tids.ntids; | 5979 | adap->params.max_ird_adapter = 32 * adap->tids.ntids; |
@@ -6474,6 +6478,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6474 | struct port_info *pi; | 6478 | struct port_info *pi; |
6475 | bool highdma = false; | 6479 | bool highdma = false; |
6476 | struct adapter *adapter = NULL; | 6480 | struct adapter *adapter = NULL; |
6481 | void __iomem *regs; | ||
6477 | 6482 | ||
6478 | printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); | 6483 | printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); |
6479 | 6484 | ||
@@ -6490,19 +6495,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6490 | goto out_release_regions; | 6495 | goto out_release_regions; |
6491 | } | 6496 | } |
6492 | 6497 | ||
6498 | regs = pci_ioremap_bar(pdev, 0); | ||
6499 | if (!regs) { | ||
6500 | dev_err(&pdev->dev, "cannot map device registers\n"); | ||
6501 | err = -ENOMEM; | ||
6502 | goto out_disable_device; | ||
6503 | } | ||
6504 | |||
6505 | /* We control everything through one PF */ | ||
6506 | func = SOURCEPF_GET(readl(regs + PL_WHOAMI)); | ||
6507 | if (func != ent->driver_data) { | ||
6508 | iounmap(regs); | ||
6509 | pci_disable_device(pdev); | ||
6510 | pci_save_state(pdev); /* to restore SR-IOV later */ | ||
6511 | goto sriov; | ||
6512 | } | ||
6513 | |||
6493 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | 6514 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
6494 | highdma = true; | 6515 | highdma = true; |
6495 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 6516 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); |
6496 | if (err) { | 6517 | if (err) { |
6497 | dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " | 6518 | dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " |
6498 | "coherent allocations\n"); | 6519 | "coherent allocations\n"); |
6499 | goto out_disable_device; | 6520 | goto out_unmap_bar0; |
6500 | } | 6521 | } |
6501 | } else { | 6522 | } else { |
6502 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 6523 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
6503 | if (err) { | 6524 | if (err) { |
6504 | dev_err(&pdev->dev, "no usable DMA configuration\n"); | 6525 | dev_err(&pdev->dev, "no usable DMA configuration\n"); |
6505 | goto out_disable_device; | 6526 | goto out_unmap_bar0; |
6506 | } | 6527 | } |
6507 | } | 6528 | } |
6508 | 6529 | ||
@@ -6514,26 +6535,19 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6514 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); | 6535 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); |
6515 | if (!adapter) { | 6536 | if (!adapter) { |
6516 | err = -ENOMEM; | 6537 | err = -ENOMEM; |
6517 | goto out_disable_device; | 6538 | goto out_unmap_bar0; |
6518 | } | 6539 | } |
6519 | 6540 | ||
6520 | /* PCI device has been enabled */ | 6541 | adapter->workq = create_singlethread_workqueue("cxgb4"); |
6521 | adapter->flags |= DEV_ENABLED; | 6542 | if (!adapter->workq) { |
6522 | |||
6523 | adapter->regs = pci_ioremap_bar(pdev, 0); | ||
6524 | if (!adapter->regs) { | ||
6525 | dev_err(&pdev->dev, "cannot map device registers\n"); | ||
6526 | err = -ENOMEM; | 6543 | err = -ENOMEM; |
6527 | goto out_free_adapter; | 6544 | goto out_free_adapter; |
6528 | } | 6545 | } |
6529 | 6546 | ||
6530 | /* We control everything through one PF */ | 6547 | /* PCI device has been enabled */ |
6531 | func = SOURCEPF_GET(readl(adapter->regs + PL_WHOAMI)); | 6548 | adapter->flags |= DEV_ENABLED; |
6532 | if (func != ent->driver_data) { | ||
6533 | pci_save_state(pdev); /* to restore SR-IOV later */ | ||
6534 | goto sriov; | ||
6535 | } | ||
6536 | 6549 | ||
6550 | adapter->regs = regs; | ||
6537 | adapter->pdev = pdev; | 6551 | adapter->pdev = pdev; |
6538 | adapter->pdev_dev = &pdev->dev; | 6552 | adapter->pdev_dev = &pdev->dev; |
6539 | adapter->mbox = func; | 6553 | adapter->mbox = func; |
@@ -6550,7 +6564,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6550 | 6564 | ||
6551 | err = t4_prep_adapter(adapter); | 6565 | err = t4_prep_adapter(adapter); |
6552 | if (err) | 6566 | if (err) |
6553 | goto out_unmap_bar0; | 6567 | goto out_free_adapter; |
6568 | |||
6554 | 6569 | ||
6555 | if (!is_t4(adapter->params.chip)) { | 6570 | if (!is_t4(adapter->params.chip)) { |
6556 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; | 6571 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; |
@@ -6567,14 +6582,14 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6567 | dev_err(&pdev->dev, | 6582 | dev_err(&pdev->dev, |
6568 | "Incorrect number of egress queues per page\n"); | 6583 | "Incorrect number of egress queues per page\n"); |
6569 | err = -EINVAL; | 6584 | err = -EINVAL; |
6570 | goto out_unmap_bar0; | 6585 | goto out_free_adapter; |
6571 | } | 6586 | } |
6572 | adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2), | 6587 | adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2), |
6573 | pci_resource_len(pdev, 2)); | 6588 | pci_resource_len(pdev, 2)); |
6574 | if (!adapter->bar2) { | 6589 | if (!adapter->bar2) { |
6575 | dev_err(&pdev->dev, "cannot map device bar2 region\n"); | 6590 | dev_err(&pdev->dev, "cannot map device bar2 region\n"); |
6576 | err = -ENOMEM; | 6591 | err = -ENOMEM; |
6577 | goto out_unmap_bar0; | 6592 | goto out_free_adapter; |
6578 | } | 6593 | } |
6579 | } | 6594 | } |
6580 | 6595 | ||
@@ -6712,10 +6727,13 @@ sriov: | |||
6712 | out_unmap_bar: | 6727 | out_unmap_bar: |
6713 | if (!is_t4(adapter->params.chip)) | 6728 | if (!is_t4(adapter->params.chip)) |
6714 | iounmap(adapter->bar2); | 6729 | iounmap(adapter->bar2); |
6715 | out_unmap_bar0: | ||
6716 | iounmap(adapter->regs); | ||
6717 | out_free_adapter: | 6730 | out_free_adapter: |
6731 | if (adapter->workq) | ||
6732 | destroy_workqueue(adapter->workq); | ||
6733 | |||
6718 | kfree(adapter); | 6734 | kfree(adapter); |
6735 | out_unmap_bar0: | ||
6736 | iounmap(regs); | ||
6719 | out_disable_device: | 6737 | out_disable_device: |
6720 | pci_disable_pcie_error_reporting(pdev); | 6738 | pci_disable_pcie_error_reporting(pdev); |
6721 | pci_disable_device(pdev); | 6739 | pci_disable_device(pdev); |
@@ -6736,6 +6754,11 @@ static void remove_one(struct pci_dev *pdev) | |||
6736 | if (adapter) { | 6754 | if (adapter) { |
6737 | int i; | 6755 | int i; |
6738 | 6756 | ||
6757 | /* Tear down per-adapter Work Queue first since it can contain | ||
6758 | * references to our adapter data structure. | ||
6759 | */ | ||
6760 | destroy_workqueue(adapter->workq); | ||
6761 | |||
6739 | if (is_offload(adapter)) | 6762 | if (is_offload(adapter)) |
6740 | detach_ulds(adapter); | 6763 | detach_ulds(adapter); |
6741 | 6764 | ||
@@ -6788,20 +6811,14 @@ static int __init cxgb4_init_module(void) | |||
6788 | { | 6811 | { |
6789 | int ret; | 6812 | int ret; |
6790 | 6813 | ||
6791 | workq = create_singlethread_workqueue("cxgb4"); | ||
6792 | if (!workq) | ||
6793 | return -ENOMEM; | ||
6794 | |||
6795 | /* Debugfs support is optional, just warn if this fails */ | 6814 | /* Debugfs support is optional, just warn if this fails */ |
6796 | cxgb4_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); | 6815 | cxgb4_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); |
6797 | if (!cxgb4_debugfs_root) | 6816 | if (!cxgb4_debugfs_root) |
6798 | pr_warn("could not create debugfs entry, continuing\n"); | 6817 | pr_warn("could not create debugfs entry, continuing\n"); |
6799 | 6818 | ||
6800 | ret = pci_register_driver(&cxgb4_driver); | 6819 | ret = pci_register_driver(&cxgb4_driver); |
6801 | if (ret < 0) { | 6820 | if (ret < 0) |
6802 | debugfs_remove(cxgb4_debugfs_root); | 6821 | debugfs_remove(cxgb4_debugfs_root); |
6803 | destroy_workqueue(workq); | ||
6804 | } | ||
6805 | 6822 | ||
6806 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6823 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
6807 | 6824 | ||
@@ -6813,8 +6830,6 @@ static void __exit cxgb4_cleanup_module(void) | |||
6813 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6830 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
6814 | pci_unregister_driver(&cxgb4_driver); | 6831 | pci_unregister_driver(&cxgb4_driver); |
6815 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ | 6832 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ |
6816 | flush_workqueue(workq); | ||
6817 | destroy_workqueue(workq); | ||
6818 | } | 6833 | } |
6819 | 6834 | ||
6820 | module_init(cxgb4_init_module); | 6835 | module_init(cxgb4_init_module); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index b0bba32d69d5..d22d728d4e5c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -2303,7 +2303,8 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, | |||
2303 | FW_EQ_ETH_CMD_PFN(adap->fn) | FW_EQ_ETH_CMD_VFN(0)); | 2303 | FW_EQ_ETH_CMD_PFN(adap->fn) | FW_EQ_ETH_CMD_VFN(0)); |
2304 | c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC | | 2304 | c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC | |
2305 | FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); | 2305 | FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); |
2306 | c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid)); | 2306 | c.viid_pkd = htonl(FW_EQ_ETH_CMD_AUTOEQUEQE | |
2307 | FW_EQ_ETH_CMD_VIID(pi->viid)); | ||
2307 | c.fetchszm_to_iqid = htonl(FW_EQ_ETH_CMD_HOSTFCMODE(2) | | 2308 | c.fetchszm_to_iqid = htonl(FW_EQ_ETH_CMD_HOSTFCMODE(2) | |
2308 | FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | | 2309 | FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | |
2309 | FW_EQ_ETH_CMD_FETCHRO(1) | | 2310 | FW_EQ_ETH_CMD_FETCHRO(1) | |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index a853133d8db8..41d04462b72e 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -168,6 +168,34 @@ void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * t4_report_fw_error - report firmware error | ||
172 | * @adap: the adapter | ||
173 | * | ||
174 | * The adapter firmware can indicate error conditions to the host. | ||
175 | * If the firmware has indicated an error, print out the reason for | ||
176 | * the firmware error. | ||
177 | */ | ||
178 | static void t4_report_fw_error(struct adapter *adap) | ||
179 | { | ||
180 | static const char *const reason[] = { | ||
181 | "Crash", /* PCIE_FW_EVAL_CRASH */ | ||
182 | "During Device Preparation", /* PCIE_FW_EVAL_PREP */ | ||
183 | "During Device Configuration", /* PCIE_FW_EVAL_CONF */ | ||
184 | "During Device Initialization", /* PCIE_FW_EVAL_INIT */ | ||
185 | "Unexpected Event", /* PCIE_FW_EVAL_UNEXPECTEDEVENT */ | ||
186 | "Insufficient Airflow", /* PCIE_FW_EVAL_OVERHEAT */ | ||
187 | "Device Shutdown", /* PCIE_FW_EVAL_DEVICESHUTDOWN */ | ||
188 | "Reserved", /* reserved */ | ||
189 | }; | ||
190 | u32 pcie_fw; | ||
191 | |||
192 | pcie_fw = t4_read_reg(adap, MA_PCIE_FW); | ||
193 | if (pcie_fw & FW_PCIE_FW_ERR) | ||
194 | dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n", | ||
195 | reason[FW_PCIE_FW_EVAL_GET(pcie_fw)]); | ||
196 | } | ||
197 | |||
198 | /* | ||
171 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. | 199 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. |
172 | */ | 200 | */ |
173 | static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, | 201 | static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, |
@@ -300,6 +328,7 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, | |||
300 | dump_mbox(adap, mbox, data_reg); | 328 | dump_mbox(adap, mbox, data_reg); |
301 | dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n", | 329 | dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n", |
302 | *(const u8 *)cmd, mbox); | 330 | *(const u8 *)cmd, mbox); |
331 | t4_report_fw_error(adap); | ||
303 | return -ETIMEDOUT; | 332 | return -ETIMEDOUT; |
304 | } | 333 | } |
305 | 334 | ||
@@ -566,6 +595,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
566 | #define VPD_BASE 0x400 | 595 | #define VPD_BASE 0x400 |
567 | #define VPD_BASE_OLD 0 | 596 | #define VPD_BASE_OLD 0 |
568 | #define VPD_LEN 1024 | 597 | #define VPD_LEN 1024 |
598 | #define CHELSIO_VPD_UNIQUE_ID 0x82 | ||
569 | 599 | ||
570 | /** | 600 | /** |
571 | * t4_seeprom_wp - enable/disable EEPROM write protection | 601 | * t4_seeprom_wp - enable/disable EEPROM write protection |
@@ -603,7 +633,14 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
603 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); | 633 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); |
604 | if (ret < 0) | 634 | if (ret < 0) |
605 | goto out; | 635 | goto out; |
606 | addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; | 636 | |
637 | /* The VPD shall have a unique identifier specified by the PCI SIG. | ||
638 | * For chelsio adapters, the identifier is 0x82. The first byte of a VPD | ||
639 | * shall be CHELSIO_VPD_UNIQUE_ID (0x82). The VPD programming software | ||
640 | * is expected to automatically put this entry at the | ||
641 | * beginning of the VPD. | ||
642 | */ | ||
643 | addr = *vpd == CHELSIO_VPD_UNIQUE_ID ? VPD_BASE : VPD_BASE_OLD; | ||
607 | 644 | ||
608 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); | 645 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); |
609 | if (ret < 0) | 646 | if (ret < 0) |
@@ -667,6 +704,7 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
667 | i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE); | 704 | i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE); |
668 | memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); | 705 | memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); |
669 | strim(p->sn); | 706 | strim(p->sn); |
707 | i = pci_vpd_info_field_size(vpd + pn - PCI_VPD_INFO_FLD_HDR_SIZE); | ||
670 | memcpy(p->pn, vpd + pn, min(i, PN_LEN)); | 708 | memcpy(p->pn, vpd + pn, min(i, PN_LEN)); |
671 | strim(p->pn); | 709 | strim(p->pn); |
672 | 710 | ||
@@ -1394,15 +1432,18 @@ static void pcie_intr_handler(struct adapter *adapter) | |||
1394 | 1432 | ||
1395 | int fat; | 1433 | int fat; |
1396 | 1434 | ||
1397 | fat = t4_handle_intr_status(adapter, | 1435 | if (is_t4(adapter->params.chip)) |
1398 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, | 1436 | fat = t4_handle_intr_status(adapter, |
1399 | sysbus_intr_info) + | 1437 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, |
1400 | t4_handle_intr_status(adapter, | 1438 | sysbus_intr_info) + |
1401 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | 1439 | t4_handle_intr_status(adapter, |
1402 | pcie_port_intr_info) + | 1440 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, |
1403 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | 1441 | pcie_port_intr_info) + |
1404 | is_t4(adapter->params.chip) ? | 1442 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE, |
1405 | pcie_intr_info : t5_pcie_intr_info); | 1443 | pcie_intr_info); |
1444 | else | ||
1445 | fat = t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | ||
1446 | t5_pcie_intr_info); | ||
1406 | 1447 | ||
1407 | if (fat) | 1448 | if (fat) |
1408 | t4_fatal_err(adapter); | 1449 | t4_fatal_err(adapter); |
@@ -1521,6 +1562,9 @@ static void cim_intr_handler(struct adapter *adapter) | |||
1521 | 1562 | ||
1522 | int fat; | 1563 | int fat; |
1523 | 1564 | ||
1565 | if (t4_read_reg(adapter, MA_PCIE_FW) & FW_PCIE_FW_ERR) | ||
1566 | t4_report_fw_error(adapter); | ||
1567 | |||
1524 | fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE, | 1568 | fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE, |
1525 | cim_intr_info) + | 1569 | cim_intr_info) + |
1526 | t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE, | 1570 | t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE, |
@@ -1768,10 +1812,16 @@ static void ma_intr_handler(struct adapter *adap) | |||
1768 | { | 1812 | { |
1769 | u32 v, status = t4_read_reg(adap, MA_INT_CAUSE); | 1813 | u32 v, status = t4_read_reg(adap, MA_INT_CAUSE); |
1770 | 1814 | ||
1771 | if (status & MEM_PERR_INT_CAUSE) | 1815 | if (status & MEM_PERR_INT_CAUSE) { |
1772 | dev_alert(adap->pdev_dev, | 1816 | dev_alert(adap->pdev_dev, |
1773 | "MA parity error, parity status %#x\n", | 1817 | "MA parity error, parity status %#x\n", |
1774 | t4_read_reg(adap, MA_PARITY_ERROR_STATUS)); | 1818 | t4_read_reg(adap, MA_PARITY_ERROR_STATUS)); |
1819 | if (is_t5(adap->params.chip)) | ||
1820 | dev_alert(adap->pdev_dev, | ||
1821 | "MA parity error, parity status %#x\n", | ||
1822 | t4_read_reg(adap, | ||
1823 | MA_PARITY_ERROR_STATUS2)); | ||
1824 | } | ||
1775 | if (status & MEM_WRAP_INT_CAUSE) { | 1825 | if (status & MEM_WRAP_INT_CAUSE) { |
1776 | v = t4_read_reg(adap, MA_INT_WRAP_STATUS); | 1826 | v = t4_read_reg(adap, MA_INT_WRAP_STATUS); |
1777 | dev_alert(adap->pdev_dev, "MA address wrap-around error by " | 1827 | dev_alert(adap->pdev_dev, "MA address wrap-around error by " |
@@ -2733,12 +2783,16 @@ retry: | |||
2733 | /* | 2783 | /* |
2734 | * Issue the HELLO command to the firmware. If it's not successful | 2784 | * Issue the HELLO command to the firmware. If it's not successful |
2735 | * but indicates that we got a "busy" or "timeout" condition, retry | 2785 | * but indicates that we got a "busy" or "timeout" condition, retry |
2736 | * the HELLO until we exhaust our retry limit. | 2786 | * the HELLO until we exhaust our retry limit. If we do exceed our |
2787 | * retry limit, check to see if the firmware left us any error | ||
2788 | * information and report that if so. | ||
2737 | */ | 2789 | */ |
2738 | ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); | 2790 | ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); |
2739 | if (ret < 0) { | 2791 | if (ret < 0) { |
2740 | if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0) | 2792 | if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0) |
2741 | goto retry; | 2793 | goto retry; |
2794 | if (t4_read_reg(adap, MA_PCIE_FW) & FW_PCIE_FW_ERR) | ||
2795 | t4_report_fw_error(adap); | ||
2742 | return ret; | 2796 | return ret; |
2743 | } | 2797 | } |
2744 | 2798 | ||
@@ -3742,6 +3796,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) | |||
3742 | lc->link_ok = link_ok; | 3796 | lc->link_ok = link_ok; |
3743 | lc->speed = speed; | 3797 | lc->speed = speed; |
3744 | lc->fc = fc; | 3798 | lc->fc = fc; |
3799 | lc->supported = be16_to_cpu(p->u.info.pcap); | ||
3745 | t4_os_link_changed(adap, port, link_ok); | 3800 | t4_os_link_changed(adap, port, link_ok); |
3746 | } | 3801 | } |
3747 | if (mod != pi->mod_type) { | 3802 | if (mod != pi->mod_type) { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index e3146e83df20..39fb325474f7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -511,6 +511,7 @@ | |||
511 | #define MEM_WRAP_CLIENT_NUM_GET(x) (((x) & MEM_WRAP_CLIENT_NUM_MASK) >> MEM_WRAP_CLIENT_NUM_SHIFT) | 511 | #define MEM_WRAP_CLIENT_NUM_GET(x) (((x) & MEM_WRAP_CLIENT_NUM_MASK) >> MEM_WRAP_CLIENT_NUM_SHIFT) |
512 | #define MA_PCIE_FW 0x30b8 | 512 | #define MA_PCIE_FW 0x30b8 |
513 | #define MA_PARITY_ERROR_STATUS 0x77f4 | 513 | #define MA_PARITY_ERROR_STATUS 0x77f4 |
514 | #define MA_PARITY_ERROR_STATUS2 0x7804 | ||
514 | 515 | ||
515 | #define MA_EXT_MEMORY1_BAR 0x7808 | 516 | #define MA_EXT_MEMORY1_BAR 0x7808 |
516 | #define EDC_0_BASE_ADDR 0x7900 | 517 | #define EDC_0_BASE_ADDR 0x7900 |
@@ -959,6 +960,7 @@ | |||
959 | #define TRCMULTIFILTER 0x00000001U | 960 | #define TRCMULTIFILTER 0x00000001U |
960 | 961 | ||
961 | #define MPS_TRC_RSS_CONTROL 0x9808 | 962 | #define MPS_TRC_RSS_CONTROL 0x9808 |
963 | #define MPS_T5_TRC_RSS_CONTROL 0xa00c | ||
962 | #define RSSCONTROL_MASK 0x00ff0000U | 964 | #define RSSCONTROL_MASK 0x00ff0000U |
963 | #define RSSCONTROL_SHIFT 16 | 965 | #define RSSCONTROL_SHIFT 16 |
964 | #define RSSCONTROL(x) ((x) << RSSCONTROL_SHIFT) | 966 | #define RSSCONTROL(x) ((x) << RSSCONTROL_SHIFT) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h index 0549170d7e2e..3409756a85b9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | |||
@@ -1227,6 +1227,7 @@ struct fw_eq_eth_cmd { | |||
1227 | #define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16) | 1227 | #define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16) |
1228 | #define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0) | 1228 | #define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0) |
1229 | 1229 | ||
1230 | #define FW_EQ_ETH_CMD_AUTOEQUEQE (1U << 30) | ||
1230 | #define FW_EQ_ETH_CMD_VIID(x) ((x) << 16) | 1231 | #define FW_EQ_ETH_CMD_VIID(x) ((x) << 16) |
1231 | 1232 | ||
1232 | struct fw_eq_ctrl_cmd { | 1233 | struct fw_eq_ctrl_cmd { |
@@ -2227,6 +2228,10 @@ struct fw_debug_cmd { | |||
2227 | #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT) | 2228 | #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT) |
2228 | #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \ | 2229 | #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \ |
2229 | FW_PCIE_FW_MASTER_MASK) | 2230 | FW_PCIE_FW_MASTER_MASK) |
2231 | #define FW_PCIE_FW_EVAL_MASK 0x7 | ||
2232 | #define FW_PCIE_FW_EVAL_SHIFT 24 | ||
2233 | #define FW_PCIE_FW_EVAL_GET(x) (((x) >> FW_PCIE_FW_EVAL_SHIFT) & \ | ||
2234 | FW_PCIE_FW_EVAL_MASK) | ||
2230 | 2235 | ||
2231 | struct fw_hdr { | 2236 | struct fw_hdr { |
2232 | u8 ver; | 2237 | u8 ver; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index bdfa80ca5e31..a5fb9493dee8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -2250,7 +2250,8 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2250 | cmd.alloc_to_len16 = cpu_to_be32(FW_EQ_ETH_CMD_ALLOC | | 2250 | cmd.alloc_to_len16 = cpu_to_be32(FW_EQ_ETH_CMD_ALLOC | |
2251 | FW_EQ_ETH_CMD_EQSTART | | 2251 | FW_EQ_ETH_CMD_EQSTART | |
2252 | FW_LEN16(cmd)); | 2252 | FW_LEN16(cmd)); |
2253 | cmd.viid_pkd = cpu_to_be32(FW_EQ_ETH_CMD_VIID(pi->viid)); | 2253 | cmd.viid_pkd = cpu_to_be32(FW_EQ_ETH_CMD_AUTOEQUEQE | |
2254 | FW_EQ_ETH_CMD_VIID(pi->viid)); | ||
2254 | cmd.fetchszm_to_iqid = | 2255 | cmd.fetchszm_to_iqid = |
2255 | cpu_to_be32(FW_EQ_ETH_CMD_HOSTFCMODE(SGE_HOSTFCMODE_STPG) | | 2256 | cpu_to_be32(FW_EQ_ETH_CMD_HOSTFCMODE(SGE_HOSTFCMODE_STPG) | |
2256 | FW_EQ_ETH_CMD_PCIECHN(pi->port_id) | | 2257 | FW_EQ_ETH_CMD_PCIECHN(pi->port_id) | |
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 9b33057a9477..70089c29d307 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -1399,7 +1399,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev) | |||
1399 | const void *mac_addr; | 1399 | const void *mac_addr; |
1400 | 1400 | ||
1401 | if (!IS_ENABLED(CONFIG_OF) || !np) | 1401 | if (!IS_ENABLED(CONFIG_OF) || !np) |
1402 | return NULL; | 1402 | return ERR_PTR(-ENXIO); |
1403 | 1403 | ||
1404 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 1404 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
1405 | if (!pdata) | 1405 | if (!pdata) |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 9f7fa644a397..ee41d98b44b6 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -275,6 +275,9 @@ struct fec_enet_private { | |||
275 | struct clk *clk_enet_out; | 275 | struct clk *clk_enet_out; |
276 | struct clk *clk_ptp; | 276 | struct clk *clk_ptp; |
277 | 277 | ||
278 | bool ptp_clk_on; | ||
279 | struct mutex ptp_clk_mutex; | ||
280 | |||
278 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ | 281 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ |
279 | unsigned char *tx_bounce[TX_RING_SIZE]; | 282 | unsigned char *tx_bounce[TX_RING_SIZE]; |
280 | struct sk_buff *tx_skbuff[TX_RING_SIZE]; | 283 | struct sk_buff *tx_skbuff[TX_RING_SIZE]; |
@@ -335,7 +338,7 @@ struct fec_enet_private { | |||
335 | u32 cycle_speed; | 338 | u32 cycle_speed; |
336 | int hwts_rx_en; | 339 | int hwts_rx_en; |
337 | int hwts_tx_en; | 340 | int hwts_tx_en; |
338 | struct timer_list time_keep; | 341 | struct delayed_work time_keep; |
339 | struct regulator *reg_phy; | 342 | struct regulator *reg_phy; |
340 | }; | 343 | }; |
341 | 344 | ||
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 4f87dffcb9b2..89355a719625 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -1611,17 +1611,27 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) | |||
1611 | goto failed_clk_enet_out; | 1611 | goto failed_clk_enet_out; |
1612 | } | 1612 | } |
1613 | if (fep->clk_ptp) { | 1613 | if (fep->clk_ptp) { |
1614 | mutex_lock(&fep->ptp_clk_mutex); | ||
1614 | ret = clk_prepare_enable(fep->clk_ptp); | 1615 | ret = clk_prepare_enable(fep->clk_ptp); |
1615 | if (ret) | 1616 | if (ret) { |
1617 | mutex_unlock(&fep->ptp_clk_mutex); | ||
1616 | goto failed_clk_ptp; | 1618 | goto failed_clk_ptp; |
1619 | } else { | ||
1620 | fep->ptp_clk_on = true; | ||
1621 | } | ||
1622 | mutex_unlock(&fep->ptp_clk_mutex); | ||
1617 | } | 1623 | } |
1618 | } else { | 1624 | } else { |
1619 | clk_disable_unprepare(fep->clk_ahb); | 1625 | clk_disable_unprepare(fep->clk_ahb); |
1620 | clk_disable_unprepare(fep->clk_ipg); | 1626 | clk_disable_unprepare(fep->clk_ipg); |
1621 | if (fep->clk_enet_out) | 1627 | if (fep->clk_enet_out) |
1622 | clk_disable_unprepare(fep->clk_enet_out); | 1628 | clk_disable_unprepare(fep->clk_enet_out); |
1623 | if (fep->clk_ptp) | 1629 | if (fep->clk_ptp) { |
1630 | mutex_lock(&fep->ptp_clk_mutex); | ||
1624 | clk_disable_unprepare(fep->clk_ptp); | 1631 | clk_disable_unprepare(fep->clk_ptp); |
1632 | fep->ptp_clk_on = false; | ||
1633 | mutex_unlock(&fep->ptp_clk_mutex); | ||
1634 | } | ||
1625 | } | 1635 | } |
1626 | 1636 | ||
1627 | return 0; | 1637 | return 0; |
@@ -2625,6 +2635,8 @@ fec_probe(struct platform_device *pdev) | |||
2625 | if (IS_ERR(fep->clk_enet_out)) | 2635 | if (IS_ERR(fep->clk_enet_out)) |
2626 | fep->clk_enet_out = NULL; | 2636 | fep->clk_enet_out = NULL; |
2627 | 2637 | ||
2638 | fep->ptp_clk_on = false; | ||
2639 | mutex_init(&fep->ptp_clk_mutex); | ||
2628 | fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp"); | 2640 | fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp"); |
2629 | fep->bufdesc_ex = | 2641 | fep->bufdesc_ex = |
2630 | pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX; | 2642 | pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX; |
@@ -2715,10 +2727,10 @@ fec_drv_remove(struct platform_device *pdev) | |||
2715 | struct net_device *ndev = platform_get_drvdata(pdev); | 2727 | struct net_device *ndev = platform_get_drvdata(pdev); |
2716 | struct fec_enet_private *fep = netdev_priv(ndev); | 2728 | struct fec_enet_private *fep = netdev_priv(ndev); |
2717 | 2729 | ||
2730 | cancel_delayed_work_sync(&fep->time_keep); | ||
2718 | cancel_work_sync(&fep->tx_timeout_work); | 2731 | cancel_work_sync(&fep->tx_timeout_work); |
2719 | unregister_netdev(ndev); | 2732 | unregister_netdev(ndev); |
2720 | fec_enet_mii_remove(fep); | 2733 | fec_enet_mii_remove(fep); |
2721 | del_timer_sync(&fep->time_keep); | ||
2722 | if (fep->reg_phy) | 2734 | if (fep->reg_phy) |
2723 | regulator_disable(fep->reg_phy); | 2735 | regulator_disable(fep->reg_phy); |
2724 | if (fep->ptp_clock) | 2736 | if (fep->ptp_clock) |
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 82386b29914a..cca3617a2321 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c | |||
@@ -245,12 +245,20 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp, | |||
245 | u64 ns; | 245 | u64 ns; |
246 | unsigned long flags; | 246 | unsigned long flags; |
247 | 247 | ||
248 | mutex_lock(&fep->ptp_clk_mutex); | ||
249 | /* Check the ptp clock */ | ||
250 | if (!fep->ptp_clk_on) { | ||
251 | mutex_unlock(&fep->ptp_clk_mutex); | ||
252 | return -EINVAL; | ||
253 | } | ||
254 | |||
248 | ns = ts->tv_sec * 1000000000ULL; | 255 | ns = ts->tv_sec * 1000000000ULL; |
249 | ns += ts->tv_nsec; | 256 | ns += ts->tv_nsec; |
250 | 257 | ||
251 | spin_lock_irqsave(&fep->tmreg_lock, flags); | 258 | spin_lock_irqsave(&fep->tmreg_lock, flags); |
252 | timecounter_init(&fep->tc, &fep->cc, ns); | 259 | timecounter_init(&fep->tc, &fep->cc, ns); |
253 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); | 260 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); |
261 | mutex_unlock(&fep->ptp_clk_mutex); | ||
254 | return 0; | 262 | return 0; |
255 | } | 263 | } |
256 | 264 | ||
@@ -338,17 +346,22 @@ int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr) | |||
338 | * fec_time_keep - call timecounter_read every second to avoid timer overrun | 346 | * fec_time_keep - call timecounter_read every second to avoid timer overrun |
339 | * because ENET just support 32bit counter, will timeout in 4s | 347 | * because ENET just support 32bit counter, will timeout in 4s |
340 | */ | 348 | */ |
341 | static void fec_time_keep(unsigned long _data) | 349 | static void fec_time_keep(struct work_struct *work) |
342 | { | 350 | { |
343 | struct fec_enet_private *fep = (struct fec_enet_private *)_data; | 351 | struct delayed_work *dwork = to_delayed_work(work); |
352 | struct fec_enet_private *fep = container_of(dwork, struct fec_enet_private, time_keep); | ||
344 | u64 ns; | 353 | u64 ns; |
345 | unsigned long flags; | 354 | unsigned long flags; |
346 | 355 | ||
347 | spin_lock_irqsave(&fep->tmreg_lock, flags); | 356 | mutex_lock(&fep->ptp_clk_mutex); |
348 | ns = timecounter_read(&fep->tc); | 357 | if (fep->ptp_clk_on) { |
349 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); | 358 | spin_lock_irqsave(&fep->tmreg_lock, flags); |
359 | ns = timecounter_read(&fep->tc); | ||
360 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); | ||
361 | } | ||
362 | mutex_unlock(&fep->ptp_clk_mutex); | ||
350 | 363 | ||
351 | mod_timer(&fep->time_keep, jiffies + HZ); | 364 | schedule_delayed_work(&fep->time_keep, HZ); |
352 | } | 365 | } |
353 | 366 | ||
354 | /** | 367 | /** |
@@ -386,15 +399,13 @@ void fec_ptp_init(struct platform_device *pdev) | |||
386 | 399 | ||
387 | fec_ptp_start_cyclecounter(ndev); | 400 | fec_ptp_start_cyclecounter(ndev); |
388 | 401 | ||
389 | init_timer(&fep->time_keep); | 402 | INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep); |
390 | fep->time_keep.data = (unsigned long)fep; | ||
391 | fep->time_keep.function = fec_time_keep; | ||
392 | fep->time_keep.expires = jiffies + HZ; | ||
393 | add_timer(&fep->time_keep); | ||
394 | 403 | ||
395 | fep->ptp_clock = ptp_clock_register(&fep->ptp_caps, &pdev->dev); | 404 | fep->ptp_clock = ptp_clock_register(&fep->ptp_caps, &pdev->dev); |
396 | if (IS_ERR(fep->ptp_clock)) { | 405 | if (IS_ERR(fep->ptp_clock)) { |
397 | fep->ptp_clock = NULL; | 406 | fep->ptp_clock = NULL; |
398 | pr_err("ptp_clock_register failed\n"); | 407 | pr_err("ptp_clock_register failed\n"); |
399 | } | 408 | } |
409 | |||
410 | schedule_delayed_work(&fep->time_keep, HZ); | ||
400 | } | 411 | } |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index a0b418e007a0..566b17db135a 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -1994,7 +1994,7 @@ static void xmit_common(struct sk_buff *skb, struct ehea_swqe *swqe) | |||
1994 | { | 1994 | { |
1995 | swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT | EHEA_SWQE_CRC; | 1995 | swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT | EHEA_SWQE_CRC; |
1996 | 1996 | ||
1997 | if (skb->protocol != htons(ETH_P_IP)) | 1997 | if (vlan_get_protocol(skb) != htons(ETH_P_IP)) |
1998 | return; | 1998 | return; |
1999 | 1999 | ||
2000 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 2000 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index c9127562bd22..21978cc019e7 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
@@ -292,6 +292,18 @@ failure: | |||
292 | atomic_add(buffers_added, &(pool->available)); | 292 | atomic_add(buffers_added, &(pool->available)); |
293 | } | 293 | } |
294 | 294 | ||
295 | /* | ||
296 | * The final 8 bytes of the buffer list is a counter of frames dropped | ||
297 | * because there was not a buffer in the buffer list capable of holding | ||
298 | * the frame. | ||
299 | */ | ||
300 | static void ibmveth_update_rx_no_buffer(struct ibmveth_adapter *adapter) | ||
301 | { | ||
302 | __be64 *p = adapter->buffer_list_addr + 4096 - 8; | ||
303 | |||
304 | adapter->rx_no_buffer = be64_to_cpup(p); | ||
305 | } | ||
306 | |||
295 | /* replenish routine */ | 307 | /* replenish routine */ |
296 | static void ibmveth_replenish_task(struct ibmveth_adapter *adapter) | 308 | static void ibmveth_replenish_task(struct ibmveth_adapter *adapter) |
297 | { | 309 | { |
@@ -307,8 +319,7 @@ static void ibmveth_replenish_task(struct ibmveth_adapter *adapter) | |||
307 | ibmveth_replenish_buffer_pool(adapter, pool); | 319 | ibmveth_replenish_buffer_pool(adapter, pool); |
308 | } | 320 | } |
309 | 321 | ||
310 | adapter->rx_no_buffer = *(u64 *)(((char*)adapter->buffer_list_addr) + | 322 | ibmveth_update_rx_no_buffer(adapter); |
311 | 4096 - 8); | ||
312 | } | 323 | } |
313 | 324 | ||
314 | /* empty and free ana buffer pool - also used to do cleanup in error paths */ | 325 | /* empty and free ana buffer pool - also used to do cleanup in error paths */ |
@@ -698,8 +709,7 @@ static int ibmveth_close(struct net_device *netdev) | |||
698 | 709 | ||
699 | free_irq(netdev->irq, netdev); | 710 | free_irq(netdev->irq, netdev); |
700 | 711 | ||
701 | adapter->rx_no_buffer = *(u64 *)(((char *)adapter->buffer_list_addr) + | 712 | ibmveth_update_rx_no_buffer(adapter); |
702 | 4096 - 8); | ||
703 | 713 | ||
704 | ibmveth_cleanup(adapter); | 714 | ibmveth_cleanup(adapter); |
705 | 715 | ||
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index cbc330b301cd..ad3d5d12173f 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -2674,7 +2674,8 @@ set_itr_now: | |||
2674 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 | 2674 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
2675 | 2675 | ||
2676 | static int e1000_tso(struct e1000_adapter *adapter, | 2676 | static int e1000_tso(struct e1000_adapter *adapter, |
2677 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb) | 2677 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb, |
2678 | __be16 protocol) | ||
2678 | { | 2679 | { |
2679 | struct e1000_context_desc *context_desc; | 2680 | struct e1000_context_desc *context_desc; |
2680 | struct e1000_buffer *buffer_info; | 2681 | struct e1000_buffer *buffer_info; |
@@ -2692,7 +2693,7 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
2692 | 2693 | ||
2693 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 2694 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
2694 | mss = skb_shinfo(skb)->gso_size; | 2695 | mss = skb_shinfo(skb)->gso_size; |
2695 | if (skb->protocol == htons(ETH_P_IP)) { | 2696 | if (protocol == htons(ETH_P_IP)) { |
2696 | struct iphdr *iph = ip_hdr(skb); | 2697 | struct iphdr *iph = ip_hdr(skb); |
2697 | iph->tot_len = 0; | 2698 | iph->tot_len = 0; |
2698 | iph->check = 0; | 2699 | iph->check = 0; |
@@ -2702,7 +2703,7 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
2702 | 0); | 2703 | 0); |
2703 | cmd_length = E1000_TXD_CMD_IP; | 2704 | cmd_length = E1000_TXD_CMD_IP; |
2704 | ipcse = skb_transport_offset(skb) - 1; | 2705 | ipcse = skb_transport_offset(skb) - 1; |
2705 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 2706 | } else if (skb_is_gso_v6(skb)) { |
2706 | ipv6_hdr(skb)->payload_len = 0; | 2707 | ipv6_hdr(skb)->payload_len = 0; |
2707 | tcp_hdr(skb)->check = | 2708 | tcp_hdr(skb)->check = |
2708 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 2709 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
@@ -2745,7 +2746,8 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
2745 | } | 2746 | } |
2746 | 2747 | ||
2747 | static bool e1000_tx_csum(struct e1000_adapter *adapter, | 2748 | static bool e1000_tx_csum(struct e1000_adapter *adapter, |
2748 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb) | 2749 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb, |
2750 | __be16 protocol) | ||
2749 | { | 2751 | { |
2750 | struct e1000_context_desc *context_desc; | 2752 | struct e1000_context_desc *context_desc; |
2751 | struct e1000_buffer *buffer_info; | 2753 | struct e1000_buffer *buffer_info; |
@@ -2756,7 +2758,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, | |||
2756 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 2758 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
2757 | return false; | 2759 | return false; |
2758 | 2760 | ||
2759 | switch (skb->protocol) { | 2761 | switch (protocol) { |
2760 | case cpu_to_be16(ETH_P_IP): | 2762 | case cpu_to_be16(ETH_P_IP): |
2761 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 2763 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
2762 | cmd_len |= E1000_TXD_CMD_TCP; | 2764 | cmd_len |= E1000_TXD_CMD_TCP; |
@@ -3097,6 +3099,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3097 | int count = 0; | 3099 | int count = 0; |
3098 | int tso; | 3100 | int tso; |
3099 | unsigned int f; | 3101 | unsigned int f; |
3102 | __be16 protocol = vlan_get_protocol(skb); | ||
3100 | 3103 | ||
3101 | /* This goes back to the question of how to logically map a Tx queue | 3104 | /* This goes back to the question of how to logically map a Tx queue |
3102 | * to a flow. Right now, performance is impacted slightly negatively | 3105 | * to a flow. Right now, performance is impacted slightly negatively |
@@ -3210,7 +3213,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3210 | 3213 | ||
3211 | first = tx_ring->next_to_use; | 3214 | first = tx_ring->next_to_use; |
3212 | 3215 | ||
3213 | tso = e1000_tso(adapter, tx_ring, skb); | 3216 | tso = e1000_tso(adapter, tx_ring, skb, protocol); |
3214 | if (tso < 0) { | 3217 | if (tso < 0) { |
3215 | dev_kfree_skb_any(skb); | 3218 | dev_kfree_skb_any(skb); |
3216 | return NETDEV_TX_OK; | 3219 | return NETDEV_TX_OK; |
@@ -3220,10 +3223,10 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3220 | if (likely(hw->mac_type != e1000_82544)) | 3223 | if (likely(hw->mac_type != e1000_82544)) |
3221 | tx_ring->last_tx_tso = true; | 3224 | tx_ring->last_tx_tso = true; |
3222 | tx_flags |= E1000_TX_FLAGS_TSO; | 3225 | tx_flags |= E1000_TX_FLAGS_TSO; |
3223 | } else if (likely(e1000_tx_csum(adapter, tx_ring, skb))) | 3226 | } else if (likely(e1000_tx_csum(adapter, tx_ring, skb, protocol))) |
3224 | tx_flags |= E1000_TX_FLAGS_CSUM; | 3227 | tx_flags |= E1000_TX_FLAGS_CSUM; |
3225 | 3228 | ||
3226 | if (likely(skb->protocol == htons(ETH_P_IP))) | 3229 | if (protocol == htons(ETH_P_IP)) |
3227 | tx_flags |= E1000_TX_FLAGS_IPV4; | 3230 | tx_flags |= E1000_TX_FLAGS_IPV4; |
3228 | 3231 | ||
3229 | if (unlikely(skb->no_fcs)) | 3232 | if (unlikely(skb->no_fcs)) |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 65c3aef2bd36..247335d2c7ec 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -5164,7 +5164,8 @@ link_up: | |||
5164 | #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 | 5164 | #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 |
5165 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 | 5165 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
5166 | 5166 | ||
5167 | static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) | 5167 | static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb, |
5168 | __be16 protocol) | ||
5168 | { | 5169 | { |
5169 | struct e1000_context_desc *context_desc; | 5170 | struct e1000_context_desc *context_desc; |
5170 | struct e1000_buffer *buffer_info; | 5171 | struct e1000_buffer *buffer_info; |
@@ -5183,7 +5184,7 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) | |||
5183 | 5184 | ||
5184 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 5185 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
5185 | mss = skb_shinfo(skb)->gso_size; | 5186 | mss = skb_shinfo(skb)->gso_size; |
5186 | if (skb->protocol == htons(ETH_P_IP)) { | 5187 | if (protocol == htons(ETH_P_IP)) { |
5187 | struct iphdr *iph = ip_hdr(skb); | 5188 | struct iphdr *iph = ip_hdr(skb); |
5188 | iph->tot_len = 0; | 5189 | iph->tot_len = 0; |
5189 | iph->check = 0; | 5190 | iph->check = 0; |
@@ -5231,7 +5232,8 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) | |||
5231 | return 1; | 5232 | return 1; |
5232 | } | 5233 | } |
5233 | 5234 | ||
5234 | static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb) | 5235 | static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb, |
5236 | __be16 protocol) | ||
5235 | { | 5237 | { |
5236 | struct e1000_adapter *adapter = tx_ring->adapter; | 5238 | struct e1000_adapter *adapter = tx_ring->adapter; |
5237 | struct e1000_context_desc *context_desc; | 5239 | struct e1000_context_desc *context_desc; |
@@ -5239,16 +5241,10 @@ static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb) | |||
5239 | unsigned int i; | 5241 | unsigned int i; |
5240 | u8 css; | 5242 | u8 css; |
5241 | u32 cmd_len = E1000_TXD_CMD_DEXT; | 5243 | u32 cmd_len = E1000_TXD_CMD_DEXT; |
5242 | __be16 protocol; | ||
5243 | 5244 | ||
5244 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 5245 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
5245 | return false; | 5246 | return false; |
5246 | 5247 | ||
5247 | if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) | ||
5248 | protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; | ||
5249 | else | ||
5250 | protocol = skb->protocol; | ||
5251 | |||
5252 | switch (protocol) { | 5248 | switch (protocol) { |
5253 | case cpu_to_be16(ETH_P_IP): | 5249 | case cpu_to_be16(ETH_P_IP): |
5254 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 5250 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
@@ -5546,6 +5542,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
5546 | int count = 0; | 5542 | int count = 0; |
5547 | int tso; | 5543 | int tso; |
5548 | unsigned int f; | 5544 | unsigned int f; |
5545 | __be16 protocol = vlan_get_protocol(skb); | ||
5549 | 5546 | ||
5550 | if (test_bit(__E1000_DOWN, &adapter->state)) { | 5547 | if (test_bit(__E1000_DOWN, &adapter->state)) { |
5551 | dev_kfree_skb_any(skb); | 5548 | dev_kfree_skb_any(skb); |
@@ -5620,7 +5617,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
5620 | 5617 | ||
5621 | first = tx_ring->next_to_use; | 5618 | first = tx_ring->next_to_use; |
5622 | 5619 | ||
5623 | tso = e1000_tso(tx_ring, skb); | 5620 | tso = e1000_tso(tx_ring, skb, protocol); |
5624 | if (tso < 0) { | 5621 | if (tso < 0) { |
5625 | dev_kfree_skb_any(skb); | 5622 | dev_kfree_skb_any(skb); |
5626 | return NETDEV_TX_OK; | 5623 | return NETDEV_TX_OK; |
@@ -5628,14 +5625,14 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
5628 | 5625 | ||
5629 | if (tso) | 5626 | if (tso) |
5630 | tx_flags |= E1000_TX_FLAGS_TSO; | 5627 | tx_flags |= E1000_TX_FLAGS_TSO; |
5631 | else if (e1000_tx_csum(tx_ring, skb)) | 5628 | else if (e1000_tx_csum(tx_ring, skb, protocol)) |
5632 | tx_flags |= E1000_TX_FLAGS_CSUM; | 5629 | tx_flags |= E1000_TX_FLAGS_CSUM; |
5633 | 5630 | ||
5634 | /* Old method was to assume IPv4 packet by default if TSO was enabled. | 5631 | /* Old method was to assume IPv4 packet by default if TSO was enabled. |
5635 | * 82571 hardware supports TSO capabilities for IPv6 as well... | 5632 | * 82571 hardware supports TSO capabilities for IPv6 as well... |
5636 | * no longer assume, we must. | 5633 | * no longer assume, we must. |
5637 | */ | 5634 | */ |
5638 | if (skb->protocol == htons(ETH_P_IP)) | 5635 | if (protocol == htons(ETH_P_IP)) |
5639 | tx_flags |= E1000_TX_FLAGS_IPV4; | 5636 | tx_flags |= E1000_TX_FLAGS_IPV4; |
5640 | 5637 | ||
5641 | if (unlikely(skb->no_fcs)) | 5638 | if (unlikely(skb->no_fcs)) |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c index bb7fe98b3a6c..537b6216971d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c | |||
@@ -247,7 +247,7 @@ void i40e_ptp_rx_hang(struct i40e_vsi *vsi) | |||
247 | u32 prttsyn_stat; | 247 | u32 prttsyn_stat; |
248 | int n; | 248 | int n; |
249 | 249 | ||
250 | if (pf->flags & I40E_FLAG_PTP) | 250 | if (!(pf->flags & I40E_FLAG_PTP)) |
251 | return; | 251 | return; |
252 | 252 | ||
253 | prttsyn_stat = rd32(hw, I40E_PRTTSYN_STAT_1); | 253 | prttsyn_stat = rd32(hw, I40E_PRTTSYN_STAT_1); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index a51aa37b7b5a..369848e107f8 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
@@ -2295,7 +2295,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
2295 | goto out_drop; | 2295 | goto out_drop; |
2296 | 2296 | ||
2297 | /* obtain protocol of skb */ | 2297 | /* obtain protocol of skb */ |
2298 | protocol = skb->protocol; | 2298 | protocol = vlan_get_protocol(skb); |
2299 | 2299 | ||
2300 | /* record the location of the first descriptor for this packet */ | 2300 | /* record the location of the first descriptor for this packet */ |
2301 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; | 2301 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 89672551dce9..3ac6a0d2f143 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | |||
@@ -1003,11 +1003,19 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) | |||
1003 | static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, | 1003 | static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, |
1004 | u32 v_retval, u8 *msg, u16 msglen) | 1004 | u32 v_retval, u8 *msg, u16 msglen) |
1005 | { | 1005 | { |
1006 | struct i40e_pf *pf = vf->pf; | 1006 | struct i40e_pf *pf; |
1007 | struct i40e_hw *hw = &pf->hw; | 1007 | struct i40e_hw *hw; |
1008 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | 1008 | int abs_vf_id; |
1009 | i40e_status aq_ret; | 1009 | i40e_status aq_ret; |
1010 | 1010 | ||
1011 | /* validate the request */ | ||
1012 | if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) | ||
1013 | return -EINVAL; | ||
1014 | |||
1015 | pf = vf->pf; | ||
1016 | hw = &pf->hw; | ||
1017 | abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1018 | |||
1011 | /* single place to detect unsuccessful return values */ | 1019 | /* single place to detect unsuccessful return values */ |
1012 | if (v_retval) { | 1020 | if (v_retval) { |
1013 | vf->num_invalid_msgs++; | 1021 | vf->num_invalid_msgs++; |
@@ -1928,17 +1936,20 @@ static void i40e_vc_vf_broadcast(struct i40e_pf *pf, | |||
1928 | { | 1936 | { |
1929 | struct i40e_hw *hw = &pf->hw; | 1937 | struct i40e_hw *hw = &pf->hw; |
1930 | struct i40e_vf *vf = pf->vf; | 1938 | struct i40e_vf *vf = pf->vf; |
1931 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1932 | int i; | 1939 | int i; |
1933 | 1940 | ||
1934 | for (i = 0; i < pf->num_alloc_vfs; i++) { | 1941 | for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { |
1942 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1943 | /* Not all vfs are enabled so skip the ones that are not */ | ||
1944 | if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && | ||
1945 | !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) | ||
1946 | continue; | ||
1947 | |||
1935 | /* Ignore return value on purpose - a given VF may fail, but | 1948 | /* Ignore return value on purpose - a given VF may fail, but |
1936 | * we need to keep going and send to all of them | 1949 | * we need to keep going and send to all of them |
1937 | */ | 1950 | */ |
1938 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval, | 1951 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval, |
1939 | msg, msglen, NULL); | 1952 | msg, msglen, NULL); |
1940 | vf++; | ||
1941 | abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1942 | } | 1953 | } |
1943 | } | 1954 | } |
1944 | 1955 | ||
@@ -1954,12 +1965,12 @@ void i40e_vc_notify_link_state(struct i40e_pf *pf) | |||
1954 | struct i40e_hw *hw = &pf->hw; | 1965 | struct i40e_hw *hw = &pf->hw; |
1955 | struct i40e_vf *vf = pf->vf; | 1966 | struct i40e_vf *vf = pf->vf; |
1956 | struct i40e_link_status *ls = &pf->hw.phy.link_info; | 1967 | struct i40e_link_status *ls = &pf->hw.phy.link_info; |
1957 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1958 | int i; | 1968 | int i; |
1959 | 1969 | ||
1960 | pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; | 1970 | pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; |
1961 | pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; | 1971 | pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; |
1962 | for (i = 0; i < pf->num_alloc_vfs; i++) { | 1972 | for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { |
1973 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1963 | if (vf->link_forced) { | 1974 | if (vf->link_forced) { |
1964 | pfe.event_data.link_event.link_status = vf->link_up; | 1975 | pfe.event_data.link_event.link_status = vf->link_up; |
1965 | pfe.event_data.link_event.link_speed = | 1976 | pfe.event_data.link_event.link_speed = |
@@ -1972,8 +1983,6 @@ void i40e_vc_notify_link_state(struct i40e_pf *pf) | |||
1972 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, | 1983 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, |
1973 | 0, (u8 *)&pfe, sizeof(pfe), | 1984 | 0, (u8 *)&pfe, sizeof(pfe), |
1974 | NULL); | 1985 | NULL); |
1975 | vf++; | ||
1976 | abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1977 | } | 1986 | } |
1978 | } | 1987 | } |
1979 | 1988 | ||
@@ -2002,7 +2011,18 @@ void i40e_vc_notify_reset(struct i40e_pf *pf) | |||
2002 | void i40e_vc_notify_vf_reset(struct i40e_vf *vf) | 2011 | void i40e_vc_notify_vf_reset(struct i40e_vf *vf) |
2003 | { | 2012 | { |
2004 | struct i40e_virtchnl_pf_event pfe; | 2013 | struct i40e_virtchnl_pf_event pfe; |
2005 | int abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; | 2014 | int abs_vf_id; |
2015 | |||
2016 | /* validate the request */ | ||
2017 | if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) | ||
2018 | return; | ||
2019 | |||
2020 | /* verify if the VF is in either init or active before proceeding */ | ||
2021 | if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && | ||
2022 | !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) | ||
2023 | return; | ||
2024 | |||
2025 | abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; | ||
2006 | 2026 | ||
2007 | pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; | 2027 | pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; |
2008 | pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; | 2028 | pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index 79bf96ca6489..95a3ec236b49 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c | |||
@@ -1597,7 +1597,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
1597 | goto out_drop; | 1597 | goto out_drop; |
1598 | 1598 | ||
1599 | /* obtain protocol of skb */ | 1599 | /* obtain protocol of skb */ |
1600 | protocol = skb->protocol; | 1600 | protocol = vlan_get_protocol(skb); |
1601 | 1601 | ||
1602 | /* record the location of the first descriptor for this packet */ | 1602 | /* record the location of the first descriptor for this packet */ |
1603 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; | 1603 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index c9f1d1b7ef37..ade067de1689 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/mbus.h> | 20 | #include <linux/mbus.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/if_vlan.h> | ||
23 | #include <net/ip.h> | 24 | #include <net/ip.h> |
24 | #include <net/ipv6.h> | 25 | #include <net/ipv6.h> |
25 | #include <linux/io.h> | 26 | #include <linux/io.h> |
@@ -1371,15 +1372,16 @@ static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) | |||
1371 | { | 1372 | { |
1372 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1373 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1373 | int ip_hdr_len = 0; | 1374 | int ip_hdr_len = 0; |
1375 | __be16 l3_proto = vlan_get_protocol(skb); | ||
1374 | u8 l4_proto; | 1376 | u8 l4_proto; |
1375 | 1377 | ||
1376 | if (skb->protocol == htons(ETH_P_IP)) { | 1378 | if (l3_proto == htons(ETH_P_IP)) { |
1377 | struct iphdr *ip4h = ip_hdr(skb); | 1379 | struct iphdr *ip4h = ip_hdr(skb); |
1378 | 1380 | ||
1379 | /* Calculate IPv4 checksum and L4 checksum */ | 1381 | /* Calculate IPv4 checksum and L4 checksum */ |
1380 | ip_hdr_len = ip4h->ihl; | 1382 | ip_hdr_len = ip4h->ihl; |
1381 | l4_proto = ip4h->protocol; | 1383 | l4_proto = ip4h->protocol; |
1382 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 1384 | } else if (l3_proto == htons(ETH_P_IPV6)) { |
1383 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 1385 | struct ipv6hdr *ip6h = ipv6_hdr(skb); |
1384 | 1386 | ||
1385 | /* Read l4_protocol from one of IPv6 extra headers */ | 1387 | /* Read l4_protocol from one of IPv6 extra headers */ |
@@ -1390,7 +1392,7 @@ static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) | |||
1390 | return MVNETA_TX_L4_CSUM_NOT; | 1392 | return MVNETA_TX_L4_CSUM_NOT; |
1391 | 1393 | ||
1392 | return mvneta_txq_desc_csum(skb_network_offset(skb), | 1394 | return mvneta_txq_desc_csum(skb_network_offset(skb), |
1393 | skb->protocol, ip_hdr_len, l4_proto); | 1395 | l3_proto, ip_hdr_len, l4_proto); |
1394 | } | 1396 | } |
1395 | 1397 | ||
1396 | return MVNETA_TX_L4_CSUM_NOT; | 1398 | return MVNETA_TX_L4_CSUM_NOT; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 65a4a0f88ea0..02a2e90d581a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -2389,6 +2389,22 @@ struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv( | |||
2389 | } | 2389 | } |
2390 | EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv); | 2390 | EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv); |
2391 | 2391 | ||
2392 | static int mlx4_slaves_closest_port(struct mlx4_dev *dev, int slave, int port) | ||
2393 | { | ||
2394 | struct mlx4_active_ports actv_ports = mlx4_get_active_ports(dev, slave); | ||
2395 | int min_port = find_first_bit(actv_ports.ports, dev->caps.num_ports) | ||
2396 | + 1; | ||
2397 | int max_port = min_port + | ||
2398 | bitmap_weight(actv_ports.ports, dev->caps.num_ports); | ||
2399 | |||
2400 | if (port < min_port) | ||
2401 | port = min_port; | ||
2402 | else if (port >= max_port) | ||
2403 | port = max_port - 1; | ||
2404 | |||
2405 | return port; | ||
2406 | } | ||
2407 | |||
2392 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) | 2408 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) |
2393 | { | 2409 | { |
2394 | struct mlx4_priv *priv = mlx4_priv(dev); | 2410 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -2402,6 +2418,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) | |||
2402 | if (slave < 0) | 2418 | if (slave < 0) |
2403 | return -EINVAL; | 2419 | return -EINVAL; |
2404 | 2420 | ||
2421 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2405 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2422 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2406 | s_info->mac = mac; | 2423 | s_info->mac = mac; |
2407 | mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n", | 2424 | mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n", |
@@ -2428,6 +2445,7 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos) | |||
2428 | if (slave < 0) | 2445 | if (slave < 0) |
2429 | return -EINVAL; | 2446 | return -EINVAL; |
2430 | 2447 | ||
2448 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2431 | vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2449 | vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2432 | 2450 | ||
2433 | if ((0 == vlan) && (0 == qos)) | 2451 | if ((0 == vlan) && (0 == qos)) |
@@ -2455,6 +2473,7 @@ bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave, | |||
2455 | struct mlx4_priv *priv; | 2473 | struct mlx4_priv *priv; |
2456 | 2474 | ||
2457 | priv = mlx4_priv(dev); | 2475 | priv = mlx4_priv(dev); |
2476 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2458 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; | 2477 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; |
2459 | 2478 | ||
2460 | if (MLX4_VGT != vp_oper->state.default_vlan) { | 2479 | if (MLX4_VGT != vp_oper->state.default_vlan) { |
@@ -2482,6 +2501,7 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting) | |||
2482 | if (slave < 0) | 2501 | if (slave < 0) |
2483 | return -EINVAL; | 2502 | return -EINVAL; |
2484 | 2503 | ||
2504 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2485 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2505 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2486 | s_info->spoofchk = setting; | 2506 | s_info->spoofchk = setting; |
2487 | 2507 | ||
@@ -2535,6 +2555,7 @@ int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_stat | |||
2535 | if (slave < 0) | 2555 | if (slave < 0) |
2536 | return -EINVAL; | 2556 | return -EINVAL; |
2537 | 2557 | ||
2558 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2538 | switch (link_state) { | 2559 | switch (link_state) { |
2539 | case IFLA_VF_LINK_STATE_AUTO: | 2560 | case IFLA_VF_LINK_STATE_AUTO: |
2540 | /* get current link state */ | 2561 | /* get current link state */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index e22f24f784fc..35ff2925110a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -487,6 +487,9 @@ static int mlx4_en_set_pauseparam(struct net_device *dev, | |||
487 | struct mlx4_en_dev *mdev = priv->mdev; | 487 | struct mlx4_en_dev *mdev = priv->mdev; |
488 | int err; | 488 | int err; |
489 | 489 | ||
490 | if (pause->autoneg) | ||
491 | return -EINVAL; | ||
492 | |||
490 | priv->prof->tx_pause = pause->tx_pause != 0; | 493 | priv->prof->tx_pause = pause->tx_pause != 0; |
491 | priv->prof->rx_pause = pause->rx_pause != 0; | 494 | priv->prof->rx_pause = pause->rx_pause != 0; |
492 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 495 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index bb536aa613f4..abddcf8c40aa 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -474,39 +474,12 @@ static int mlx4_en_tunnel_steer_add(struct mlx4_en_priv *priv, unsigned char *ad | |||
474 | int qpn, u64 *reg_id) | 474 | int qpn, u64 *reg_id) |
475 | { | 475 | { |
476 | int err; | 476 | int err; |
477 | struct mlx4_spec_list spec_eth_outer = { {NULL} }; | ||
478 | struct mlx4_spec_list spec_vxlan = { {NULL} }; | ||
479 | struct mlx4_spec_list spec_eth_inner = { {NULL} }; | ||
480 | |||
481 | struct mlx4_net_trans_rule rule = { | ||
482 | .queue_mode = MLX4_NET_TRANS_Q_FIFO, | ||
483 | .exclusive = 0, | ||
484 | .allow_loopback = 1, | ||
485 | .promisc_mode = MLX4_FS_REGULAR, | ||
486 | .priority = MLX4_DOMAIN_NIC, | ||
487 | }; | ||
488 | |||
489 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | ||
490 | 477 | ||
491 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | 478 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
492 | return 0; /* do nothing */ | 479 | return 0; /* do nothing */ |
493 | 480 | ||
494 | rule.port = priv->port; | 481 | err = mlx4_tunnel_steer_add(priv->mdev->dev, addr, priv->port, qpn, |
495 | rule.qpn = qpn; | 482 | MLX4_DOMAIN_NIC, reg_id); |
496 | INIT_LIST_HEAD(&rule.list); | ||
497 | |||
498 | spec_eth_outer.id = MLX4_NET_TRANS_RULE_ID_ETH; | ||
499 | memcpy(spec_eth_outer.eth.dst_mac, addr, ETH_ALEN); | ||
500 | memcpy(spec_eth_outer.eth.dst_mac_msk, &mac_mask, ETH_ALEN); | ||
501 | |||
502 | spec_vxlan.id = MLX4_NET_TRANS_RULE_ID_VXLAN; /* any vxlan header */ | ||
503 | spec_eth_inner.id = MLX4_NET_TRANS_RULE_ID_ETH; /* any inner eth header */ | ||
504 | |||
505 | list_add_tail(&spec_eth_outer.list, &rule.list); | ||
506 | list_add_tail(&spec_vxlan.list, &rule.list); | ||
507 | list_add_tail(&spec_eth_inner.list, &rule.list); | ||
508 | |||
509 | err = mlx4_flow_attach(priv->mdev->dev, &rule, reg_id); | ||
510 | if (err) { | 483 | if (err) { |
511 | en_err(priv, "failed to add vxlan steering rule, err %d\n", err); | 484 | en_err(priv, "failed to add vxlan steering rule, err %d\n", err); |
512 | return err; | 485 | return err; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index d80e7a6fac74..ca0f98c95105 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -1020,6 +1020,44 @@ int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id) | |||
1020 | } | 1020 | } |
1021 | EXPORT_SYMBOL_GPL(mlx4_flow_detach); | 1021 | EXPORT_SYMBOL_GPL(mlx4_flow_detach); |
1022 | 1022 | ||
1023 | int mlx4_tunnel_steer_add(struct mlx4_dev *dev, unsigned char *addr, | ||
1024 | int port, int qpn, u16 prio, u64 *reg_id) | ||
1025 | { | ||
1026 | int err; | ||
1027 | struct mlx4_spec_list spec_eth_outer = { {NULL} }; | ||
1028 | struct mlx4_spec_list spec_vxlan = { {NULL} }; | ||
1029 | struct mlx4_spec_list spec_eth_inner = { {NULL} }; | ||
1030 | |||
1031 | struct mlx4_net_trans_rule rule = { | ||
1032 | .queue_mode = MLX4_NET_TRANS_Q_FIFO, | ||
1033 | .exclusive = 0, | ||
1034 | .allow_loopback = 1, | ||
1035 | .promisc_mode = MLX4_FS_REGULAR, | ||
1036 | }; | ||
1037 | |||
1038 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | ||
1039 | |||
1040 | rule.port = port; | ||
1041 | rule.qpn = qpn; | ||
1042 | rule.priority = prio; | ||
1043 | INIT_LIST_HEAD(&rule.list); | ||
1044 | |||
1045 | spec_eth_outer.id = MLX4_NET_TRANS_RULE_ID_ETH; | ||
1046 | memcpy(spec_eth_outer.eth.dst_mac, addr, ETH_ALEN); | ||
1047 | memcpy(spec_eth_outer.eth.dst_mac_msk, &mac_mask, ETH_ALEN); | ||
1048 | |||
1049 | spec_vxlan.id = MLX4_NET_TRANS_RULE_ID_VXLAN; /* any vxlan header */ | ||
1050 | spec_eth_inner.id = MLX4_NET_TRANS_RULE_ID_ETH; /* any inner eth header */ | ||
1051 | |||
1052 | list_add_tail(&spec_eth_outer.list, &rule.list); | ||
1053 | list_add_tail(&spec_vxlan.list, &rule.list); | ||
1054 | list_add_tail(&spec_eth_inner.list, &rule.list); | ||
1055 | |||
1056 | err = mlx4_flow_attach(dev, &rule, reg_id); | ||
1057 | return err; | ||
1058 | } | ||
1059 | EXPORT_SYMBOL(mlx4_tunnel_steer_add); | ||
1060 | |||
1023 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, | 1061 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, |
1024 | u32 max_range_qpn) | 1062 | u32 max_range_qpn) |
1025 | { | 1063 | { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c index 7d717eccb7b0..193a6adb5d04 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mr.c +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c | |||
@@ -298,6 +298,7 @@ static int mlx4_HW2SW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox | |||
298 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); | 298 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); |
299 | } | 299 | } |
300 | 300 | ||
301 | /* Must protect against concurrent access */ | ||
301 | int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | 302 | int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, |
302 | struct mlx4_mpt_entry ***mpt_entry) | 303 | struct mlx4_mpt_entry ***mpt_entry) |
303 | { | 304 | { |
@@ -305,13 +306,10 @@ int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | |||
305 | int key = key_to_hw_index(mmr->key) & (dev->caps.num_mpts - 1); | 306 | int key = key_to_hw_index(mmr->key) & (dev->caps.num_mpts - 1); |
306 | struct mlx4_cmd_mailbox *mailbox = NULL; | 307 | struct mlx4_cmd_mailbox *mailbox = NULL; |
307 | 308 | ||
308 | /* Make sure that at this point we have single-threaded access only */ | ||
309 | |||
310 | if (mmr->enabled != MLX4_MPT_EN_HW) | 309 | if (mmr->enabled != MLX4_MPT_EN_HW) |
311 | return -EINVAL; | 310 | return -EINVAL; |
312 | 311 | ||
313 | err = mlx4_HW2SW_MPT(dev, NULL, key); | 312 | err = mlx4_HW2SW_MPT(dev, NULL, key); |
314 | |||
315 | if (err) { | 313 | if (err) { |
316 | mlx4_warn(dev, "HW2SW_MPT failed (%d).", err); | 314 | mlx4_warn(dev, "HW2SW_MPT failed (%d).", err); |
317 | mlx4_warn(dev, "Most likely the MR has MWs bound to it.\n"); | 315 | mlx4_warn(dev, "Most likely the MR has MWs bound to it.\n"); |
@@ -333,7 +331,6 @@ int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | |||
333 | 0, MLX4_CMD_QUERY_MPT, | 331 | 0, MLX4_CMD_QUERY_MPT, |
334 | MLX4_CMD_TIME_CLASS_B, | 332 | MLX4_CMD_TIME_CLASS_B, |
335 | MLX4_CMD_WRAPPED); | 333 | MLX4_CMD_WRAPPED); |
336 | |||
337 | if (err) | 334 | if (err) |
338 | goto free_mailbox; | 335 | goto free_mailbox; |
339 | 336 | ||
@@ -378,9 +375,10 @@ int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | |||
378 | err = mlx4_SW2HW_MPT(dev, mailbox, key); | 375 | err = mlx4_SW2HW_MPT(dev, mailbox, key); |
379 | } | 376 | } |
380 | 377 | ||
381 | mmr->pd = be32_to_cpu((*mpt_entry)->pd_flags) & MLX4_MPT_PD_MASK; | 378 | if (!err) { |
382 | if (!err) | 379 | mmr->pd = be32_to_cpu((*mpt_entry)->pd_flags) & MLX4_MPT_PD_MASK; |
383 | mmr->enabled = MLX4_MPT_EN_HW; | 380 | mmr->enabled = MLX4_MPT_EN_HW; |
381 | } | ||
384 | return err; | 382 | return err; |
385 | } | 383 | } |
386 | EXPORT_SYMBOL_GPL(mlx4_mr_hw_write_mpt); | 384 | EXPORT_SYMBOL_GPL(mlx4_mr_hw_write_mpt); |
@@ -400,11 +398,12 @@ EXPORT_SYMBOL_GPL(mlx4_mr_hw_put_mpt); | |||
400 | int mlx4_mr_hw_change_pd(struct mlx4_dev *dev, struct mlx4_mpt_entry *mpt_entry, | 398 | int mlx4_mr_hw_change_pd(struct mlx4_dev *dev, struct mlx4_mpt_entry *mpt_entry, |
401 | u32 pdn) | 399 | u32 pdn) |
402 | { | 400 | { |
403 | u32 pd_flags = be32_to_cpu(mpt_entry->pd_flags); | 401 | u32 pd_flags = be32_to_cpu(mpt_entry->pd_flags) & ~MLX4_MPT_PD_MASK; |
404 | /* The wrapper function will put the slave's id here */ | 402 | /* The wrapper function will put the slave's id here */ |
405 | if (mlx4_is_mfunc(dev)) | 403 | if (mlx4_is_mfunc(dev)) |
406 | pd_flags &= ~MLX4_MPT_PD_VF_MASK; | 404 | pd_flags &= ~MLX4_MPT_PD_VF_MASK; |
407 | mpt_entry->pd_flags = cpu_to_be32((pd_flags & ~MLX4_MPT_PD_MASK) | | 405 | |
406 | mpt_entry->pd_flags = cpu_to_be32(pd_flags | | ||
408 | (pdn & MLX4_MPT_PD_MASK) | 407 | (pdn & MLX4_MPT_PD_MASK) |
409 | | MLX4_MPT_PD_FLAG_EN_INV); | 408 | | MLX4_MPT_PD_FLAG_EN_INV); |
410 | return 0; | 409 | return 0; |
@@ -600,14 +599,18 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr, | |||
600 | { | 599 | { |
601 | int err; | 600 | int err; |
602 | 601 | ||
603 | mpt_entry->start = cpu_to_be64(mr->iova); | 602 | mpt_entry->start = cpu_to_be64(iova); |
604 | mpt_entry->length = cpu_to_be64(mr->size); | 603 | mpt_entry->length = cpu_to_be64(size); |
605 | mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); | 604 | mpt_entry->entity_size = cpu_to_be32(page_shift); |
606 | 605 | ||
607 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); | 606 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); |
608 | if (err) | 607 | if (err) |
609 | return err; | 608 | return err; |
610 | 609 | ||
610 | mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK | | ||
611 | MLX4_MPT_PD_FLAG_EN_INV); | ||
612 | mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE | | ||
613 | MLX4_MPT_FLAG_SW_OWNS); | ||
611 | if (mr->mtt.order < 0) { | 614 | if (mr->mtt.order < 0) { |
612 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL); | 615 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL); |
613 | mpt_entry->mtt_addr = 0; | 616 | mpt_entry->mtt_addr = 0; |
@@ -617,6 +620,14 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr, | |||
617 | if (mr->mtt.page_shift == 0) | 620 | if (mr->mtt.page_shift == 0) |
618 | mpt_entry->mtt_sz = cpu_to_be32(1 << mr->mtt.order); | 621 | mpt_entry->mtt_sz = cpu_to_be32(1 << mr->mtt.order); |
619 | } | 622 | } |
623 | if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { | ||
624 | /* fast register MR in free state */ | ||
625 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE); | ||
626 | mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG | | ||
627 | MLX4_MPT_PD_FLAG_RAE); | ||
628 | } else { | ||
629 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS); | ||
630 | } | ||
620 | mr->enabled = MLX4_MPT_EN_SW; | 631 | mr->enabled = MLX4_MPT_EN_SW; |
621 | 632 | ||
622 | return 0; | 633 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 9ba0c1ca10d5..94eeb2c7d7e4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -103,7 +103,8 @@ static int find_index(struct mlx4_dev *dev, | |||
103 | int i; | 103 | int i; |
104 | 104 | ||
105 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { | 105 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { |
106 | if ((mac & MLX4_MAC_MASK) == | 106 | if (table->refs[i] && |
107 | (MLX4_MAC_MASK & mac) == | ||
107 | (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) | 108 | (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) |
108 | return i; | 109 | return i; |
109 | } | 110 | } |
@@ -165,12 +166,14 @@ int __mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac) | |||
165 | 166 | ||
166 | mutex_lock(&table->mutex); | 167 | mutex_lock(&table->mutex); |
167 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { | 168 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { |
168 | if (free < 0 && !table->entries[i]) { | 169 | if (!table->refs[i]) { |
169 | free = i; | 170 | if (free < 0) |
171 | free = i; | ||
170 | continue; | 172 | continue; |
171 | } | 173 | } |
172 | 174 | ||
173 | if (mac == (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) { | 175 | if ((MLX4_MAC_MASK & mac) == |
176 | (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) { | ||
174 | /* MAC already registered, increment ref count */ | 177 | /* MAC already registered, increment ref count */ |
175 | err = i; | 178 | err = i; |
176 | ++table->refs[i]; | 179 | ++table->refs[i]; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 0dc31d85fc3b..2301365c79c7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c | |||
@@ -390,13 +390,14 @@ err_icm: | |||
390 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); | 390 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); |
391 | 391 | ||
392 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC | 392 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC |
393 | int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | 393 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, |
394 | enum mlx4_update_qp_attr attr, | 394 | enum mlx4_update_qp_attr attr, |
395 | struct mlx4_update_qp_params *params) | 395 | struct mlx4_update_qp_params *params) |
396 | { | 396 | { |
397 | struct mlx4_cmd_mailbox *mailbox; | 397 | struct mlx4_cmd_mailbox *mailbox; |
398 | struct mlx4_update_qp_context *cmd; | 398 | struct mlx4_update_qp_context *cmd; |
399 | u64 pri_addr_path_mask = 0; | 399 | u64 pri_addr_path_mask = 0; |
400 | u64 qp_mask = 0; | ||
400 | int err = 0; | 401 | int err = 0; |
401 | 402 | ||
402 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 403 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
@@ -413,9 +414,16 @@ int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | |||
413 | cmd->qp_context.pri_path.grh_mylmc = params->smac_index; | 414 | cmd->qp_context.pri_path.grh_mylmc = params->smac_index; |
414 | } | 415 | } |
415 | 416 | ||
417 | if (attr & MLX4_UPDATE_QP_VSD) { | ||
418 | qp_mask |= 1ULL << MLX4_UPD_QP_MASK_VSD; | ||
419 | if (params->flags & MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE) | ||
420 | cmd->qp_context.param3 |= cpu_to_be32(MLX4_STRIP_VLAN); | ||
421 | } | ||
422 | |||
416 | cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); | 423 | cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); |
424 | cmd->qp_mask = cpu_to_be64(qp_mask); | ||
417 | 425 | ||
418 | err = mlx4_cmd(dev, mailbox->dma, qp->qpn & 0xffffff, 0, | 426 | err = mlx4_cmd(dev, mailbox->dma, qpn & 0xffffff, 0, |
419 | MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, | 427 | MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, |
420 | MLX4_CMD_NATIVE); | 428 | MLX4_CMD_NATIVE); |
421 | 429 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 1089367fed22..5d2498dcf536 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -702,11 +702,13 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
702 | struct mlx4_qp_context *qpc = inbox->buf + 8; | 702 | struct mlx4_qp_context *qpc = inbox->buf + 8; |
703 | struct mlx4_vport_oper_state *vp_oper; | 703 | struct mlx4_vport_oper_state *vp_oper; |
704 | struct mlx4_priv *priv; | 704 | struct mlx4_priv *priv; |
705 | u32 qp_type; | ||
705 | int port; | 706 | int port; |
706 | 707 | ||
707 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; | 708 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; |
708 | priv = mlx4_priv(dev); | 709 | priv = mlx4_priv(dev); |
709 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; | 710 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; |
711 | qp_type = (be32_to_cpu(qpc->flags) >> 16) & 0xff; | ||
710 | 712 | ||
711 | if (MLX4_VGT != vp_oper->state.default_vlan) { | 713 | if (MLX4_VGT != vp_oper->state.default_vlan) { |
712 | /* the reserved QPs (special, proxy, tunnel) | 714 | /* the reserved QPs (special, proxy, tunnel) |
@@ -715,8 +717,20 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
715 | if (mlx4_is_qp_reserved(dev, qpn)) | 717 | if (mlx4_is_qp_reserved(dev, qpn)) |
716 | return 0; | 718 | return 0; |
717 | 719 | ||
718 | /* force strip vlan by clear vsd */ | 720 | /* force strip vlan by clear vsd, MLX QP refers to Raw Ethernet */ |
719 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | 721 | if (qp_type == MLX4_QP_ST_UD || |
722 | (qp_type == MLX4_QP_ST_MLX && mlx4_is_eth(dev, port))) { | ||
723 | if (dev->caps.bmme_flags & MLX4_BMME_FLAG_VSD_INIT2RTR) { | ||
724 | *(__be32 *)inbox->buf = | ||
725 | cpu_to_be32(be32_to_cpu(*(__be32 *)inbox->buf) | | ||
726 | MLX4_QP_OPTPAR_VLAN_STRIPPING); | ||
727 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | ||
728 | } else { | ||
729 | struct mlx4_update_qp_params params = {.flags = 0}; | ||
730 | |||
731 | mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, ¶ms); | ||
732 | } | ||
733 | } | ||
720 | 734 | ||
721 | if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE && | 735 | if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE && |
722 | dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) { | 736 | dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) { |
@@ -3998,13 +4012,17 @@ int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave, | |||
3998 | } | 4012 | } |
3999 | 4013 | ||
4000 | port = (rqp->sched_queue >> 6 & 1) + 1; | 4014 | port = (rqp->sched_queue >> 6 & 1) + 1; |
4001 | smac_index = cmd->qp_context.pri_path.grh_mylmc; | 4015 | |
4002 | err = mac_find_smac_ix_in_slave(dev, slave, port, | 4016 | if (pri_addr_path_mask & (1ULL << MLX4_UPD_QP_PATH_MASK_MAC_INDEX)) { |
4003 | smac_index, &mac); | 4017 | smac_index = cmd->qp_context.pri_path.grh_mylmc; |
4004 | if (err) { | 4018 | err = mac_find_smac_ix_in_slave(dev, slave, port, |
4005 | mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", | 4019 | smac_index, &mac); |
4006 | qpn, smac_index); | 4020 | |
4007 | goto err_mac; | 4021 | if (err) { |
4022 | mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", | ||
4023 | qpn, smac_index); | ||
4024 | goto err_mac; | ||
4025 | } | ||
4008 | } | 4026 | } |
4009 | 4027 | ||
4010 | err = mlx4_cmd(dev, inbox->dma, | 4028 | err = mlx4_cmd(dev, inbox->dma, |
@@ -4818,7 +4836,7 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work) | |||
4818 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; | 4836 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; |
4819 | 4837 | ||
4820 | upd_context = mailbox->buf; | 4838 | upd_context = mailbox->buf; |
4821 | upd_context->qp_mask = cpu_to_be64(MLX4_UPD_QP_MASK_VSD); | 4839 | upd_context->qp_mask = cpu_to_be64(1ULL << MLX4_UPD_QP_MASK_VSD); |
4822 | 4840 | ||
4823 | spin_lock_irq(mlx4_tlock(dev)); | 4841 | spin_lock_irq(mlx4_tlock(dev)); |
4824 | list_for_each_entry_safe(qp, tmp, qp_list, com.list) { | 4842 | list_for_each_entry_safe(qp, tmp, qp_list, com.list) { |
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index 5020fd47825d..2f12c88c66ab 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c | |||
@@ -206,7 +206,7 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
206 | int rx_head = priv->rx_head; | 206 | int rx_head = priv->rx_head; |
207 | int rx = 0; | 207 | int rx = 0; |
208 | 208 | ||
209 | while (1) { | 209 | while (rx < budget) { |
210 | desc = priv->rx_desc_base + (RX_REG_DESC_SIZE * rx_head); | 210 | desc = priv->rx_desc_base + (RX_REG_DESC_SIZE * rx_head); |
211 | desc0 = readl(desc + RX_REG_OFFSET_DESC0); | 211 | desc0 = readl(desc + RX_REG_OFFSET_DESC0); |
212 | 212 | ||
@@ -218,7 +218,7 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
218 | net_dbg_ratelimited("packet error\n"); | 218 | net_dbg_ratelimited("packet error\n"); |
219 | priv->stats.rx_dropped++; | 219 | priv->stats.rx_dropped++; |
220 | priv->stats.rx_errors++; | 220 | priv->stats.rx_errors++; |
221 | continue; | 221 | goto rx_next; |
222 | } | 222 | } |
223 | 223 | ||
224 | len = desc0 & RX_DESC0_FRAME_LEN_MASK; | 224 | len = desc0 & RX_DESC0_FRAME_LEN_MASK; |
@@ -226,13 +226,19 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
226 | if (len > RX_BUF_SIZE) | 226 | if (len > RX_BUF_SIZE) |
227 | len = RX_BUF_SIZE; | 227 | len = RX_BUF_SIZE; |
228 | 228 | ||
229 | skb = build_skb(priv->rx_buf[rx_head], priv->rx_buf_size); | 229 | dma_sync_single_for_cpu(&ndev->dev, |
230 | priv->rx_mapping[rx_head], | ||
231 | priv->rx_buf_size, DMA_FROM_DEVICE); | ||
232 | skb = netdev_alloc_skb_ip_align(ndev, len); | ||
233 | |||
230 | if (unlikely(!skb)) { | 234 | if (unlikely(!skb)) { |
231 | net_dbg_ratelimited("build_skb failed\n"); | 235 | net_dbg_ratelimited("netdev_alloc_skb_ip_align failed\n"); |
232 | priv->stats.rx_dropped++; | 236 | priv->stats.rx_dropped++; |
233 | priv->stats.rx_errors++; | 237 | priv->stats.rx_errors++; |
238 | goto rx_next; | ||
234 | } | 239 | } |
235 | 240 | ||
241 | memcpy(skb->data, priv->rx_buf[rx_head], len); | ||
236 | skb_put(skb, len); | 242 | skb_put(skb, len); |
237 | skb->protocol = eth_type_trans(skb, ndev); | 243 | skb->protocol = eth_type_trans(skb, ndev); |
238 | napi_gro_receive(&priv->napi, skb); | 244 | napi_gro_receive(&priv->napi, skb); |
@@ -244,18 +250,15 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
244 | if (desc0 & RX_DESC0_MULTICAST) | 250 | if (desc0 & RX_DESC0_MULTICAST) |
245 | priv->stats.multicast++; | 251 | priv->stats.multicast++; |
246 | 252 | ||
253 | rx_next: | ||
247 | writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); | 254 | writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); |
248 | 255 | ||
249 | rx_head = RX_NEXT(rx_head); | 256 | rx_head = RX_NEXT(rx_head); |
250 | priv->rx_head = rx_head; | 257 | priv->rx_head = rx_head; |
251 | |||
252 | if (rx >= budget) | ||
253 | break; | ||
254 | } | 258 | } |
255 | 259 | ||
256 | if (rx < budget) { | 260 | if (rx < budget) { |
257 | napi_gro_flush(napi, false); | 261 | napi_complete(napi); |
258 | __napi_complete(napi); | ||
259 | } | 262 | } |
260 | 263 | ||
261 | priv->reg_imr |= RPKT_FINISH_M; | 264 | priv->reg_imr |= RPKT_FINISH_M; |
@@ -346,10 +349,12 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
346 | len = ETH_ZLEN; | 349 | len = ETH_ZLEN; |
347 | } | 350 | } |
348 | 351 | ||
349 | txdes1 = readl(desc + TX_REG_OFFSET_DESC1); | 352 | dma_sync_single_for_device(&ndev->dev, priv->tx_mapping[tx_head], |
350 | txdes1 |= TX_DESC1_LTS | TX_DESC1_FTS; | 353 | priv->tx_buf_size, DMA_TO_DEVICE); |
351 | txdes1 &= ~(TX_DESC1_FIFO_COMPLETE | TX_DESC1_INTR_COMPLETE); | 354 | |
352 | txdes1 |= (len & TX_DESC1_BUF_SIZE_MASK); | 355 | txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); |
356 | if (tx_head == TX_DESC_NUM_MASK) | ||
357 | txdes1 |= TX_DESC1_END; | ||
353 | writel(txdes1, desc + TX_REG_OFFSET_DESC1); | 358 | writel(txdes1, desc + TX_REG_OFFSET_DESC1); |
354 | writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); | 359 | writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); |
355 | 360 | ||
@@ -465,8 +470,7 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
465 | spin_lock_init(&priv->txlock); | 470 | spin_lock_init(&priv->txlock); |
466 | 471 | ||
467 | priv->tx_buf_size = TX_BUF_SIZE; | 472 | priv->tx_buf_size = TX_BUF_SIZE; |
468 | priv->rx_buf_size = RX_BUF_SIZE + | 473 | priv->rx_buf_size = RX_BUF_SIZE; |
469 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | ||
470 | 474 | ||
471 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * | 475 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * |
472 | TX_DESC_NUM, &priv->tx_base, | 476 | TX_DESC_NUM, &priv->tx_base, |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 8706c0dbd0c3..a44a03c45014 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1220,6 +1220,9 @@ static int lpc_eth_open(struct net_device *ndev) | |||
1220 | 1220 | ||
1221 | __lpc_eth_clock_enable(pldat, true); | 1221 | __lpc_eth_clock_enable(pldat, true); |
1222 | 1222 | ||
1223 | /* Suspended PHY makes LPC ethernet core block, so resume now */ | ||
1224 | phy_resume(pldat->phy_dev); | ||
1225 | |||
1223 | /* Reset and initialize */ | 1226 | /* Reset and initialize */ |
1224 | __lpc_eth_reset(pldat); | 1227 | __lpc_eth_reset(pldat); |
1225 | __lpc_eth_init(pldat); | 1228 | __lpc_eth_init(pldat); |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index 979c6980639f..a42293092ea4 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
@@ -290,9 +290,11 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) | |||
290 | /* Read the hardware TX timestamp if one was recorded */ | 290 | /* Read the hardware TX timestamp if one was recorded */ |
291 | if (unlikely(re.s.tstamp)) { | 291 | if (unlikely(re.s.tstamp)) { |
292 | struct skb_shared_hwtstamps ts; | 292 | struct skb_shared_hwtstamps ts; |
293 | u64 ns; | ||
294 | |||
293 | memset(&ts, 0, sizeof(ts)); | 295 | memset(&ts, 0, sizeof(ts)); |
294 | /* Read the timestamp */ | 296 | /* Read the timestamp */ |
295 | u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port)); | 297 | ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port)); |
296 | /* Remove the timestamp from the FIFO */ | 298 | /* Remove the timestamp from the FIFO */ |
297 | cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0); | 299 | cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0); |
298 | /* Tell the kernel about the timestamp */ | 300 | /* Tell the kernel about the timestamp */ |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig index 44c8be1c6805..5f7a35212796 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig +++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | |||
@@ -7,6 +7,7 @@ config PCH_GBE | |||
7 | depends on PCI && (X86_32 || COMPILE_TEST) | 7 | depends on PCI && (X86_32 || COMPILE_TEST) |
8 | select MII | 8 | select MII |
9 | select PTP_1588_CLOCK_PCH | 9 | select PTP_1588_CLOCK_PCH |
10 | select NET_PTP_CLASSIFY | ||
10 | ---help--- | 11 | ---help--- |
11 | This is a gigabit ethernet driver for EG20T PCH. | 12 | This is a gigabit ethernet driver for EG20T PCH. |
12 | EG20T PCH is the platform controller hub that is used in Intel's | 13 | EG20T PCH is the platform controller hub that is used in Intel's |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 16039d1497b8..b84f5ea3d659 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -268,7 +268,7 @@ struct qlcnic_fdt { | |||
268 | u16 cksum; | 268 | u16 cksum; |
269 | u16 unused; | 269 | u16 unused; |
270 | u8 model[16]; | 270 | u8 model[16]; |
271 | u16 mfg_id; | 271 | u8 mfg_id; |
272 | u16 id; | 272 | u16 id; |
273 | u8 flag; | 273 | u8 flag; |
274 | u8 erase_cmd; | 274 | u8 erase_cmd; |
@@ -2362,6 +2362,19 @@ static inline u32 qlcnic_get_vnic_func_count(struct qlcnic_adapter *adapter) | |||
2362 | return QLC_DEFAULT_VNIC_COUNT; | 2362 | return QLC_DEFAULT_VNIC_COUNT; |
2363 | } | 2363 | } |
2364 | 2364 | ||
2365 | static inline void qlcnic_swap32_buffer(u32 *buffer, int count) | ||
2366 | { | ||
2367 | #if defined(__BIG_ENDIAN) | ||
2368 | u32 *tmp = buffer; | ||
2369 | int i; | ||
2370 | |||
2371 | for (i = 0; i < count; i++) { | ||
2372 | *tmp = swab32(*tmp); | ||
2373 | tmp++; | ||
2374 | } | ||
2375 | #endif | ||
2376 | } | ||
2377 | |||
2365 | #ifdef CONFIG_QLCNIC_HWMON | 2378 | #ifdef CONFIG_QLCNIC_HWMON |
2366 | void qlcnic_register_hwmon_dev(struct qlcnic_adapter *); | 2379 | void qlcnic_register_hwmon_dev(struct qlcnic_adapter *); |
2367 | void qlcnic_unregister_hwmon_dev(struct qlcnic_adapter *); | 2380 | void qlcnic_unregister_hwmon_dev(struct qlcnic_adapter *); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index a4a4ec0b68f8..476e4998ef99 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -2603,7 +2603,7 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, | |||
2603 | } | 2603 | } |
2604 | 2604 | ||
2605 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_DIRECT_WINDOW, | 2605 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_DIRECT_WINDOW, |
2606 | (addr)); | 2606 | (addr & 0xFFFF0000)); |
2607 | 2607 | ||
2608 | range = flash_offset + (count * sizeof(u32)); | 2608 | range = flash_offset + (count * sizeof(u32)); |
2609 | /* Check if data is spread across multiple sectors */ | 2609 | /* Check if data is spread across multiple sectors */ |
@@ -2753,7 +2753,7 @@ int qlcnic_83xx_read_flash_descriptor_table(struct qlcnic_adapter *adapter) | |||
2753 | ret = qlcnic_83xx_lockless_flash_read32(adapter, QLCNIC_FDT_LOCATION, | 2753 | ret = qlcnic_83xx_lockless_flash_read32(adapter, QLCNIC_FDT_LOCATION, |
2754 | (u8 *)&adapter->ahw->fdt, | 2754 | (u8 *)&adapter->ahw->fdt, |
2755 | count); | 2755 | count); |
2756 | 2756 | qlcnic_swap32_buffer((u32 *)&adapter->ahw->fdt, count); | |
2757 | qlcnic_83xx_unlock_flash(adapter); | 2757 | qlcnic_83xx_unlock_flash(adapter); |
2758 | return ret; | 2758 | return ret; |
2759 | } | 2759 | } |
@@ -2788,7 +2788,7 @@ int qlcnic_83xx_erase_flash_sector(struct qlcnic_adapter *adapter, | |||
2788 | 2788 | ||
2789 | addr1 = (sector_start_addr & 0xFF) << 16; | 2789 | addr1 = (sector_start_addr & 0xFF) << 16; |
2790 | addr2 = (sector_start_addr & 0xFF0000) >> 16; | 2790 | addr2 = (sector_start_addr & 0xFF0000) >> 16; |
2791 | reversed_addr = addr1 | addr2; | 2791 | reversed_addr = addr1 | addr2 | (sector_start_addr & 0xFF00); |
2792 | 2792 | ||
2793 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, | 2793 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, |
2794 | reversed_addr); | 2794 | reversed_addr); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index f33559b72528..86783e1afcf7 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -1378,31 +1378,45 @@ static int qlcnic_83xx_copy_fw_file(struct qlcnic_adapter *adapter) | |||
1378 | { | 1378 | { |
1379 | struct qlc_83xx_fw_info *fw_info = adapter->ahw->fw_info; | 1379 | struct qlc_83xx_fw_info *fw_info = adapter->ahw->fw_info; |
1380 | const struct firmware *fw = fw_info->fw; | 1380 | const struct firmware *fw = fw_info->fw; |
1381 | u32 dest, *p_cache; | 1381 | u32 dest, *p_cache, *temp; |
1382 | int i, ret = -EIO; | 1382 | int i, ret = -EIO; |
1383 | __le32 *temp_le; | ||
1383 | u8 data[16]; | 1384 | u8 data[16]; |
1384 | size_t size; | 1385 | size_t size; |
1385 | u64 addr; | 1386 | u64 addr; |
1386 | 1387 | ||
1388 | temp = kzalloc(fw->size, GFP_KERNEL); | ||
1389 | if (!temp) { | ||
1390 | release_firmware(fw); | ||
1391 | fw_info->fw = NULL; | ||
1392 | return -ENOMEM; | ||
1393 | } | ||
1394 | |||
1395 | temp_le = (__le32 *)fw->data; | ||
1396 | |||
1397 | /* FW image in file is in little endian, swap the data to nullify | ||
1398 | * the effect of writel() operation on big endian platform. | ||
1399 | */ | ||
1400 | for (i = 0; i < fw->size / sizeof(u32); i++) | ||
1401 | temp[i] = __le32_to_cpu(temp_le[i]); | ||
1402 | |||
1387 | dest = QLCRDX(adapter->ahw, QLCNIC_FW_IMAGE_ADDR); | 1403 | dest = QLCRDX(adapter->ahw, QLCNIC_FW_IMAGE_ADDR); |
1388 | size = (fw->size & ~0xF); | 1404 | size = (fw->size & ~0xF); |
1389 | p_cache = (u32 *)fw->data; | 1405 | p_cache = temp; |
1390 | addr = (u64)dest; | 1406 | addr = (u64)dest; |
1391 | 1407 | ||
1392 | ret = qlcnic_ms_mem_write128(adapter, addr, | 1408 | ret = qlcnic_ms_mem_write128(adapter, addr, |
1393 | p_cache, size / 16); | 1409 | p_cache, size / 16); |
1394 | if (ret) { | 1410 | if (ret) { |
1395 | dev_err(&adapter->pdev->dev, "MS memory write failed\n"); | 1411 | dev_err(&adapter->pdev->dev, "MS memory write failed\n"); |
1396 | release_firmware(fw); | 1412 | goto exit; |
1397 | fw_info->fw = NULL; | ||
1398 | return -EIO; | ||
1399 | } | 1413 | } |
1400 | 1414 | ||
1401 | /* alignment check */ | 1415 | /* alignment check */ |
1402 | if (fw->size & 0xF) { | 1416 | if (fw->size & 0xF) { |
1403 | addr = dest + size; | 1417 | addr = dest + size; |
1404 | for (i = 0; i < (fw->size & 0xF); i++) | 1418 | for (i = 0; i < (fw->size & 0xF); i++) |
1405 | data[i] = fw->data[size + i]; | 1419 | data[i] = temp[size + i]; |
1406 | for (; i < 16; i++) | 1420 | for (; i < 16; i++) |
1407 | data[i] = 0; | 1421 | data[i] = 0; |
1408 | ret = qlcnic_ms_mem_write128(adapter, addr, | 1422 | ret = qlcnic_ms_mem_write128(adapter, addr, |
@@ -1410,15 +1424,16 @@ static int qlcnic_83xx_copy_fw_file(struct qlcnic_adapter *adapter) | |||
1410 | if (ret) { | 1424 | if (ret) { |
1411 | dev_err(&adapter->pdev->dev, | 1425 | dev_err(&adapter->pdev->dev, |
1412 | "MS memory write failed\n"); | 1426 | "MS memory write failed\n"); |
1413 | release_firmware(fw); | 1427 | goto exit; |
1414 | fw_info->fw = NULL; | ||
1415 | return -EIO; | ||
1416 | } | 1428 | } |
1417 | } | 1429 | } |
1430 | |||
1431 | exit: | ||
1418 | release_firmware(fw); | 1432 | release_firmware(fw); |
1419 | fw_info->fw = NULL; | 1433 | fw_info->fw = NULL; |
1434 | kfree(temp); | ||
1420 | 1435 | ||
1421 | return 0; | 1436 | return ret; |
1422 | } | 1437 | } |
1423 | 1438 | ||
1424 | static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | 1439 | static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c index e46fc39d425d..c9f57fb84b9e 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c | |||
@@ -47,15 +47,26 @@ struct qlcnic_common_entry_hdr { | |||
47 | u32 type; | 47 | u32 type; |
48 | u32 offset; | 48 | u32 offset; |
49 | u32 cap_size; | 49 | u32 cap_size; |
50 | #if defined(__LITTLE_ENDIAN) | ||
50 | u8 mask; | 51 | u8 mask; |
51 | u8 rsvd[2]; | 52 | u8 rsvd[2]; |
52 | u8 flags; | 53 | u8 flags; |
54 | #else | ||
55 | u8 flags; | ||
56 | u8 rsvd[2]; | ||
57 | u8 mask; | ||
58 | #endif | ||
53 | } __packed; | 59 | } __packed; |
54 | 60 | ||
55 | struct __crb { | 61 | struct __crb { |
56 | u32 addr; | 62 | u32 addr; |
63 | #if defined(__LITTLE_ENDIAN) | ||
57 | u8 stride; | 64 | u8 stride; |
58 | u8 rsvd1[3]; | 65 | u8 rsvd1[3]; |
66 | #else | ||
67 | u8 rsvd1[3]; | ||
68 | u8 stride; | ||
69 | #endif | ||
59 | u32 data_size; | 70 | u32 data_size; |
60 | u32 no_ops; | 71 | u32 no_ops; |
61 | u32 rsvd2[4]; | 72 | u32 rsvd2[4]; |
@@ -63,15 +74,28 @@ struct __crb { | |||
63 | 74 | ||
64 | struct __ctrl { | 75 | struct __ctrl { |
65 | u32 addr; | 76 | u32 addr; |
77 | #if defined(__LITTLE_ENDIAN) | ||
66 | u8 stride; | 78 | u8 stride; |
67 | u8 index_a; | 79 | u8 index_a; |
68 | u16 timeout; | 80 | u16 timeout; |
81 | #else | ||
82 | u16 timeout; | ||
83 | u8 index_a; | ||
84 | u8 stride; | ||
85 | #endif | ||
69 | u32 data_size; | 86 | u32 data_size; |
70 | u32 no_ops; | 87 | u32 no_ops; |
88 | #if defined(__LITTLE_ENDIAN) | ||
71 | u8 opcode; | 89 | u8 opcode; |
72 | u8 index_v; | 90 | u8 index_v; |
73 | u8 shl_val; | 91 | u8 shl_val; |
74 | u8 shr_val; | 92 | u8 shr_val; |
93 | #else | ||
94 | u8 shr_val; | ||
95 | u8 shl_val; | ||
96 | u8 index_v; | ||
97 | u8 opcode; | ||
98 | #endif | ||
75 | u32 val1; | 99 | u32 val1; |
76 | u32 val2; | 100 | u32 val2; |
77 | u32 val3; | 101 | u32 val3; |
@@ -79,16 +103,27 @@ struct __ctrl { | |||
79 | 103 | ||
80 | struct __cache { | 104 | struct __cache { |
81 | u32 addr; | 105 | u32 addr; |
106 | #if defined(__LITTLE_ENDIAN) | ||
82 | u16 stride; | 107 | u16 stride; |
83 | u16 init_tag_val; | 108 | u16 init_tag_val; |
109 | #else | ||
110 | u16 init_tag_val; | ||
111 | u16 stride; | ||
112 | #endif | ||
84 | u32 size; | 113 | u32 size; |
85 | u32 no_ops; | 114 | u32 no_ops; |
86 | u32 ctrl_addr; | 115 | u32 ctrl_addr; |
87 | u32 ctrl_val; | 116 | u32 ctrl_val; |
88 | u32 read_addr; | 117 | u32 read_addr; |
118 | #if defined(__LITTLE_ENDIAN) | ||
89 | u8 read_addr_stride; | 119 | u8 read_addr_stride; |
90 | u8 read_addr_num; | 120 | u8 read_addr_num; |
91 | u8 rsvd1[2]; | 121 | u8 rsvd1[2]; |
122 | #else | ||
123 | u8 rsvd1[2]; | ||
124 | u8 read_addr_num; | ||
125 | u8 read_addr_stride; | ||
126 | #endif | ||
92 | } __packed; | 127 | } __packed; |
93 | 128 | ||
94 | struct __ocm { | 129 | struct __ocm { |
@@ -122,23 +157,39 @@ struct __mux { | |||
122 | 157 | ||
123 | struct __queue { | 158 | struct __queue { |
124 | u32 sel_addr; | 159 | u32 sel_addr; |
160 | #if defined(__LITTLE_ENDIAN) | ||
125 | u16 stride; | 161 | u16 stride; |
126 | u8 rsvd[2]; | 162 | u8 rsvd[2]; |
163 | #else | ||
164 | u8 rsvd[2]; | ||
165 | u16 stride; | ||
166 | #endif | ||
127 | u32 size; | 167 | u32 size; |
128 | u32 no_ops; | 168 | u32 no_ops; |
129 | u8 rsvd2[8]; | 169 | u8 rsvd2[8]; |
130 | u32 read_addr; | 170 | u32 read_addr; |
171 | #if defined(__LITTLE_ENDIAN) | ||
131 | u8 read_addr_stride; | 172 | u8 read_addr_stride; |
132 | u8 read_addr_cnt; | 173 | u8 read_addr_cnt; |
133 | u8 rsvd3[2]; | 174 | u8 rsvd3[2]; |
175 | #else | ||
176 | u8 rsvd3[2]; | ||
177 | u8 read_addr_cnt; | ||
178 | u8 read_addr_stride; | ||
179 | #endif | ||
134 | } __packed; | 180 | } __packed; |
135 | 181 | ||
136 | struct __pollrd { | 182 | struct __pollrd { |
137 | u32 sel_addr; | 183 | u32 sel_addr; |
138 | u32 read_addr; | 184 | u32 read_addr; |
139 | u32 sel_val; | 185 | u32 sel_val; |
186 | #if defined(__LITTLE_ENDIAN) | ||
140 | u16 sel_val_stride; | 187 | u16 sel_val_stride; |
141 | u16 no_ops; | 188 | u16 no_ops; |
189 | #else | ||
190 | u16 no_ops; | ||
191 | u16 sel_val_stride; | ||
192 | #endif | ||
142 | u32 poll_wait; | 193 | u32 poll_wait; |
143 | u32 poll_mask; | 194 | u32 poll_mask; |
144 | u32 data_size; | 195 | u32 data_size; |
@@ -153,9 +204,15 @@ struct __mux2 { | |||
153 | u32 no_ops; | 204 | u32 no_ops; |
154 | u32 sel_val_mask; | 205 | u32 sel_val_mask; |
155 | u32 read_addr; | 206 | u32 read_addr; |
207 | #if defined(__LITTLE_ENDIAN) | ||
156 | u8 sel_val_stride; | 208 | u8 sel_val_stride; |
157 | u8 data_size; | 209 | u8 data_size; |
158 | u8 rsvd[2]; | 210 | u8 rsvd[2]; |
211 | #else | ||
212 | u8 rsvd[2]; | ||
213 | u8 data_size; | ||
214 | u8 sel_val_stride; | ||
215 | #endif | ||
159 | } __packed; | 216 | } __packed; |
160 | 217 | ||
161 | struct __pollrdmwr { | 218 | struct __pollrdmwr { |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index f5786d5792df..59a721fba018 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -280,6 +280,7 @@ static ssize_t qlcnic_sysfs_read_crb(struct file *filp, struct kobject *kobj, | |||
280 | if (ret != 0) | 280 | if (ret != 0) |
281 | return ret; | 281 | return ret; |
282 | qlcnic_read_crb(adapter, buf, offset, size); | 282 | qlcnic_read_crb(adapter, buf, offset, size); |
283 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
283 | 284 | ||
284 | return size; | 285 | return size; |
285 | } | 286 | } |
@@ -296,6 +297,7 @@ static ssize_t qlcnic_sysfs_write_crb(struct file *filp, struct kobject *kobj, | |||
296 | if (ret != 0) | 297 | if (ret != 0) |
297 | return ret; | 298 | return ret; |
298 | 299 | ||
300 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
299 | qlcnic_write_crb(adapter, buf, offset, size); | 301 | qlcnic_write_crb(adapter, buf, offset, size); |
300 | return size; | 302 | return size; |
301 | } | 303 | } |
@@ -329,6 +331,7 @@ static ssize_t qlcnic_sysfs_read_mem(struct file *filp, struct kobject *kobj, | |||
329 | return -EIO; | 331 | return -EIO; |
330 | 332 | ||
331 | memcpy(buf, &data, size); | 333 | memcpy(buf, &data, size); |
334 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
332 | 335 | ||
333 | return size; | 336 | return size; |
334 | } | 337 | } |
@@ -346,6 +349,7 @@ static ssize_t qlcnic_sysfs_write_mem(struct file *filp, struct kobject *kobj, | |||
346 | if (ret != 0) | 349 | if (ret != 0) |
347 | return ret; | 350 | return ret; |
348 | 351 | ||
352 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
349 | memcpy(&data, buf, size); | 353 | memcpy(&data, buf, size); |
350 | 354 | ||
351 | if (qlcnic_pci_mem_write_2M(adapter, offset, data)) | 355 | if (qlcnic_pci_mem_write_2M(adapter, offset, data)) |
@@ -412,6 +416,7 @@ static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp, | |||
412 | if (rem) | 416 | if (rem) |
413 | return QL_STATUS_INVALID_PARAM; | 417 | return QL_STATUS_INVALID_PARAM; |
414 | 418 | ||
419 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
415 | pm_cfg = (struct qlcnic_pm_func_cfg *)buf; | 420 | pm_cfg = (struct qlcnic_pm_func_cfg *)buf; |
416 | ret = validate_pm_config(adapter, pm_cfg, count); | 421 | ret = validate_pm_config(adapter, pm_cfg, count); |
417 | 422 | ||
@@ -474,6 +479,7 @@ static ssize_t qlcnic_sysfs_read_pm_config(struct file *filp, | |||
474 | pm_cfg[pci_func].dest_npar = 0; | 479 | pm_cfg[pci_func].dest_npar = 0; |
475 | pm_cfg[pci_func].pci_func = i; | 480 | pm_cfg[pci_func].pci_func = i; |
476 | } | 481 | } |
482 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
477 | return size; | 483 | return size; |
478 | } | 484 | } |
479 | 485 | ||
@@ -555,6 +561,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file, | |||
555 | if (rem) | 561 | if (rem) |
556 | return QL_STATUS_INVALID_PARAM; | 562 | return QL_STATUS_INVALID_PARAM; |
557 | 563 | ||
564 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
558 | esw_cfg = (struct qlcnic_esw_func_cfg *)buf; | 565 | esw_cfg = (struct qlcnic_esw_func_cfg *)buf; |
559 | ret = validate_esw_config(adapter, esw_cfg, count); | 566 | ret = validate_esw_config(adapter, esw_cfg, count); |
560 | if (ret) | 567 | if (ret) |
@@ -649,6 +656,7 @@ static ssize_t qlcnic_sysfs_read_esw_config(struct file *file, | |||
649 | if (qlcnic_get_eswitch_port_config(adapter, &esw_cfg[pci_func])) | 656 | if (qlcnic_get_eswitch_port_config(adapter, &esw_cfg[pci_func])) |
650 | return QL_STATUS_INVALID_PARAM; | 657 | return QL_STATUS_INVALID_PARAM; |
651 | } | 658 | } |
659 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
652 | return size; | 660 | return size; |
653 | } | 661 | } |
654 | 662 | ||
@@ -688,6 +696,7 @@ static ssize_t qlcnic_sysfs_write_npar_config(struct file *file, | |||
688 | if (rem) | 696 | if (rem) |
689 | return QL_STATUS_INVALID_PARAM; | 697 | return QL_STATUS_INVALID_PARAM; |
690 | 698 | ||
699 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
691 | np_cfg = (struct qlcnic_npar_func_cfg *)buf; | 700 | np_cfg = (struct qlcnic_npar_func_cfg *)buf; |
692 | ret = validate_npar_config(adapter, np_cfg, count); | 701 | ret = validate_npar_config(adapter, np_cfg, count); |
693 | if (ret) | 702 | if (ret) |
@@ -759,6 +768,7 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file, | |||
759 | np_cfg[pci_func].max_tx_queues = nic_info.max_tx_ques; | 768 | np_cfg[pci_func].max_tx_queues = nic_info.max_tx_ques; |
760 | np_cfg[pci_func].max_rx_queues = nic_info.max_rx_ques; | 769 | np_cfg[pci_func].max_rx_queues = nic_info.max_rx_ques; |
761 | } | 770 | } |
771 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
762 | return size; | 772 | return size; |
763 | } | 773 | } |
764 | 774 | ||
@@ -916,6 +926,7 @@ static ssize_t qlcnic_sysfs_read_pci_config(struct file *file, | |||
916 | 926 | ||
917 | pci_cfg = (struct qlcnic_pci_func_cfg *)buf; | 927 | pci_cfg = (struct qlcnic_pci_func_cfg *)buf; |
918 | count = size / sizeof(struct qlcnic_pci_func_cfg); | 928 | count = size / sizeof(struct qlcnic_pci_func_cfg); |
929 | qlcnic_swap32_buffer((u32 *)pci_info, size / sizeof(u32)); | ||
919 | for (i = 0; i < count; i++) { | 930 | for (i = 0; i < count; i++) { |
920 | pci_cfg[i].pci_func = pci_info[i].id; | 931 | pci_cfg[i].pci_func = pci_info[i].id; |
921 | pci_cfg[i].func_type = pci_info[i].type; | 932 | pci_cfg[i].func_type = pci_info[i].type; |
@@ -969,6 +980,7 @@ static ssize_t qlcnic_83xx_sysfs_flash_read_handler(struct file *filp, | |||
969 | } | 980 | } |
970 | 981 | ||
971 | qlcnic_83xx_unlock_flash(adapter); | 982 | qlcnic_83xx_unlock_flash(adapter); |
983 | qlcnic_swap32_buffer((u32 *)p_read_buf, count); | ||
972 | memcpy(buf, p_read_buf, size); | 984 | memcpy(buf, p_read_buf, size); |
973 | kfree(p_read_buf); | 985 | kfree(p_read_buf); |
974 | 986 | ||
@@ -986,9 +998,10 @@ static int qlcnic_83xx_sysfs_flash_bulk_write(struct qlcnic_adapter *adapter, | |||
986 | if (!p_cache) | 998 | if (!p_cache) |
987 | return -ENOMEM; | 999 | return -ENOMEM; |
988 | 1000 | ||
1001 | count = size / sizeof(u32); | ||
1002 | qlcnic_swap32_buffer((u32 *)buf, count); | ||
989 | memcpy(p_cache, buf, size); | 1003 | memcpy(p_cache, buf, size); |
990 | p_src = p_cache; | 1004 | p_src = p_cache; |
991 | count = size / sizeof(u32); | ||
992 | 1005 | ||
993 | if (qlcnic_83xx_lock_flash(adapter) != 0) { | 1006 | if (qlcnic_83xx_lock_flash(adapter) != 0) { |
994 | kfree(p_cache); | 1007 | kfree(p_cache); |
@@ -1053,6 +1066,7 @@ static int qlcnic_83xx_sysfs_flash_write(struct qlcnic_adapter *adapter, | |||
1053 | if (!p_cache) | 1066 | if (!p_cache) |
1054 | return -ENOMEM; | 1067 | return -ENOMEM; |
1055 | 1068 | ||
1069 | qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32)); | ||
1056 | memcpy(p_cache, buf, size); | 1070 | memcpy(p_cache, buf, size); |
1057 | p_src = p_cache; | 1071 | p_src = p_cache; |
1058 | count = size / sizeof(u32); | 1072 | count = size / sizeof(u32); |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 188626e2a861..3e96f269150d 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -2556,6 +2556,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) | |||
2556 | 2556 | ||
2557 | if (skb_is_gso(skb)) { | 2557 | if (skb_is_gso(skb)) { |
2558 | int err; | 2558 | int err; |
2559 | __be16 l3_proto = vlan_get_protocol(skb); | ||
2559 | 2560 | ||
2560 | err = skb_cow_head(skb, 0); | 2561 | err = skb_cow_head(skb, 0); |
2561 | if (err < 0) | 2562 | if (err < 0) |
@@ -2572,7 +2573,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) | |||
2572 | << OB_MAC_TRANSPORT_HDR_SHIFT); | 2573 | << OB_MAC_TRANSPORT_HDR_SHIFT); |
2573 | mac_iocb_ptr->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | 2574 | mac_iocb_ptr->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
2574 | mac_iocb_ptr->flags2 |= OB_MAC_TSO_IOCB_LSO; | 2575 | mac_iocb_ptr->flags2 |= OB_MAC_TSO_IOCB_LSO; |
2575 | if (likely(skb->protocol == htons(ETH_P_IP))) { | 2576 | if (likely(l3_proto == htons(ETH_P_IP))) { |
2576 | struct iphdr *iph = ip_hdr(skb); | 2577 | struct iphdr *iph = ip_hdr(skb); |
2577 | iph->check = 0; | 2578 | iph->check = 0; |
2578 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP4; | 2579 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP4; |
@@ -2580,7 +2581,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) | |||
2580 | iph->daddr, 0, | 2581 | iph->daddr, 0, |
2581 | IPPROTO_TCP, | 2582 | IPPROTO_TCP, |
2582 | 0); | 2583 | 0); |
2583 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 2584 | } else if (l3_proto == htons(ETH_P_IPV6)) { |
2584 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP6; | 2585 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP6; |
2585 | tcp_hdr(skb)->check = | 2586 | tcp_hdr(skb)->check = |
2586 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 2587 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 91652e7235e4..0921302553c6 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -1783,33 +1783,31 @@ static void __rtl8169_set_features(struct net_device *dev, | |||
1783 | netdev_features_t features) | 1783 | netdev_features_t features) |
1784 | { | 1784 | { |
1785 | struct rtl8169_private *tp = netdev_priv(dev); | 1785 | struct rtl8169_private *tp = netdev_priv(dev); |
1786 | netdev_features_t changed = features ^ dev->features; | ||
1787 | void __iomem *ioaddr = tp->mmio_addr; | 1786 | void __iomem *ioaddr = tp->mmio_addr; |
1787 | u32 rx_config; | ||
1788 | 1788 | ||
1789 | if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM | | 1789 | rx_config = RTL_R32(RxConfig); |
1790 | NETIF_F_HW_VLAN_CTAG_RX))) | 1790 | if (features & NETIF_F_RXALL) |
1791 | return; | 1791 | rx_config |= (AcceptErr | AcceptRunt); |
1792 | else | ||
1793 | rx_config &= ~(AcceptErr | AcceptRunt); | ||
1792 | 1794 | ||
1793 | if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX)) { | 1795 | RTL_W32(RxConfig, rx_config); |
1794 | if (features & NETIF_F_RXCSUM) | ||
1795 | tp->cp_cmd |= RxChkSum; | ||
1796 | else | ||
1797 | tp->cp_cmd &= ~RxChkSum; | ||
1798 | 1796 | ||
1799 | if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) | 1797 | if (features & NETIF_F_RXCSUM) |
1800 | tp->cp_cmd |= RxVlan; | 1798 | tp->cp_cmd |= RxChkSum; |
1801 | else | 1799 | else |
1802 | tp->cp_cmd &= ~RxVlan; | 1800 | tp->cp_cmd &= ~RxChkSum; |
1803 | 1801 | ||
1804 | RTL_W16(CPlusCmd, tp->cp_cmd); | 1802 | if (features & NETIF_F_HW_VLAN_CTAG_RX) |
1805 | RTL_R16(CPlusCmd); | 1803 | tp->cp_cmd |= RxVlan; |
1806 | } | 1804 | else |
1807 | if (changed & NETIF_F_RXALL) { | 1805 | tp->cp_cmd &= ~RxVlan; |
1808 | int tmp = (RTL_R32(RxConfig) & ~(AcceptErr | AcceptRunt)); | 1806 | |
1809 | if (features & NETIF_F_RXALL) | 1807 | tp->cp_cmd |= RTL_R16(CPlusCmd) & ~(RxVlan | RxChkSum); |
1810 | tmp |= (AcceptErr | AcceptRunt); | 1808 | |
1811 | RTL_W32(RxConfig, tmp); | 1809 | RTL_W16(CPlusCmd, tp->cp_cmd); |
1812 | } | 1810 | RTL_R16(CPlusCmd); |
1813 | } | 1811 | } |
1814 | 1812 | ||
1815 | static int rtl8169_set_features(struct net_device *dev, | 1813 | static int rtl8169_set_features(struct net_device *dev, |
@@ -1817,8 +1815,11 @@ static int rtl8169_set_features(struct net_device *dev, | |||
1817 | { | 1815 | { |
1818 | struct rtl8169_private *tp = netdev_priv(dev); | 1816 | struct rtl8169_private *tp = netdev_priv(dev); |
1819 | 1817 | ||
1818 | features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; | ||
1819 | |||
1820 | rtl_lock_work(tp); | 1820 | rtl_lock_work(tp); |
1821 | __rtl8169_set_features(dev, features); | 1821 | if (features ^ dev->features) |
1822 | __rtl8169_set_features(dev, features); | ||
1822 | rtl_unlock_work(tp); | 1823 | rtl_unlock_work(tp); |
1823 | 1824 | ||
1824 | return 0; | 1825 | return 0; |
@@ -7118,8 +7119,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp) | |||
7118 | } | 7119 | } |
7119 | } | 7120 | } |
7120 | 7121 | ||
7121 | static int | 7122 | static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
7122 | rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
7123 | { | 7123 | { |
7124 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; | 7124 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; |
7125 | const unsigned int region = cfg->region; | 7125 | const unsigned int region = cfg->region; |
@@ -7194,7 +7194,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7194 | goto err_out_mwi_2; | 7194 | goto err_out_mwi_2; |
7195 | } | 7195 | } |
7196 | 7196 | ||
7197 | tp->cp_cmd = RxChkSum; | 7197 | tp->cp_cmd = 0; |
7198 | 7198 | ||
7199 | if ((sizeof(dma_addr_t) > 4) && | 7199 | if ((sizeof(dma_addr_t) > 4) && |
7200 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | 7200 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { |
@@ -7235,13 +7235,6 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7235 | 7235 | ||
7236 | pci_set_master(pdev); | 7236 | pci_set_master(pdev); |
7237 | 7237 | ||
7238 | /* | ||
7239 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7240 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7241 | */ | ||
7242 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
7243 | tp->cp_cmd |= RxVlan; | ||
7244 | |||
7245 | rtl_init_mdio_ops(tp); | 7238 | rtl_init_mdio_ops(tp); |
7246 | rtl_init_pll_power_ops(tp); | 7239 | rtl_init_pll_power_ops(tp); |
7247 | rtl_init_jumbo_ops(tp); | 7240 | rtl_init_jumbo_ops(tp); |
@@ -7302,8 +7295,14 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7302 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | 7295 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | |
7303 | NETIF_F_HIGHDMA; | 7296 | NETIF_F_HIGHDMA; |
7304 | 7297 | ||
7298 | tp->cp_cmd |= RxChkSum | RxVlan; | ||
7299 | |||
7300 | /* | ||
7301 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7302 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7303 | */ | ||
7305 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | 7304 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) |
7306 | /* 8110SCd requires hardware Rx VLAN - disallow toggling */ | 7305 | /* Disallow toggling */ |
7307 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; | 7306 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; |
7308 | 7307 | ||
7309 | if (tp->txd_version == RTL_TD_0) | 7308 | if (tp->txd_version == RTL_TD_0) |
diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig index 9e757c792d84..196e98a2d93b 100644 --- a/drivers/net/ethernet/renesas/Kconfig +++ b/drivers/net/ethernet/renesas/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config SH_ETH | 5 | config SH_ETH |
6 | tristate "Renesas SuperH Ethernet support" | 6 | tristate "Renesas SuperH Ethernet support" |
7 | depends on HAS_DMA | 7 | depends on HAS_DMA |
8 | depends on ARCH_SHMOBILE || SUPERH || COMPILE_TEST | ||
8 | select CRC32 | 9 | select CRC32 |
9 | select MII | 10 | select MII |
10 | select MDIO_BITBANG | 11 | select MDIO_BITBANG |
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 0537381cd2f6..6859437b59fb 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c | |||
@@ -2933,6 +2933,9 @@ void efx_farch_filter_sync_rx_mode(struct efx_nic *efx) | |||
2933 | u32 crc; | 2933 | u32 crc; |
2934 | int bit; | 2934 | int bit; |
2935 | 2935 | ||
2936 | if (!efx_dev_registered(efx)) | ||
2937 | return; | ||
2938 | |||
2936 | netif_addr_lock_bh(net_dev); | 2939 | netif_addr_lock_bh(net_dev); |
2937 | 2940 | ||
2938 | efx->unicast_filter = !(net_dev->flags & IFF_PROMISC); | 2941 | efx->unicast_filter = !(net_dev->flags & IFF_PROMISC); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c index c553f6b5a913..cf28daba4346 100644 --- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "stmmac.h" | 29 | #include "stmmac.h" |
30 | 30 | ||
31 | static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | 31 | static int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) |
32 | { | 32 | { |
33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
34 | unsigned int txsize = priv->dma_tx_size; | 34 | unsigned int txsize = priv->dma_tx_size; |
@@ -47,7 +47,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
47 | 47 | ||
48 | desc->des2 = dma_map_single(priv->device, skb->data, | 48 | desc->des2 = dma_map_single(priv->device, skb->data, |
49 | bmax, DMA_TO_DEVICE); | 49 | bmax, DMA_TO_DEVICE); |
50 | priv->tx_skbuff_dma[entry] = desc->des2; | 50 | if (dma_mapping_error(priv->device, desc->des2)) |
51 | return -1; | ||
52 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
51 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, STMMAC_CHAIN_MODE); | 53 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, STMMAC_CHAIN_MODE); |
52 | 54 | ||
53 | while (len != 0) { | 55 | while (len != 0) { |
@@ -59,7 +61,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
59 | desc->des2 = dma_map_single(priv->device, | 61 | desc->des2 = dma_map_single(priv->device, |
60 | (skb->data + bmax * i), | 62 | (skb->data + bmax * i), |
61 | bmax, DMA_TO_DEVICE); | 63 | bmax, DMA_TO_DEVICE); |
62 | priv->tx_skbuff_dma[entry] = desc->des2; | 64 | if (dma_mapping_error(priv->device, desc->des2)) |
65 | return -1; | ||
66 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
63 | priv->hw->desc->prepare_tx_desc(desc, 0, bmax, csum, | 67 | priv->hw->desc->prepare_tx_desc(desc, 0, bmax, csum, |
64 | STMMAC_CHAIN_MODE); | 68 | STMMAC_CHAIN_MODE); |
65 | priv->hw->desc->set_tx_owner(desc); | 69 | priv->hw->desc->set_tx_owner(desc); |
@@ -69,7 +73,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
69 | desc->des2 = dma_map_single(priv->device, | 73 | desc->des2 = dma_map_single(priv->device, |
70 | (skb->data + bmax * i), len, | 74 | (skb->data + bmax * i), len, |
71 | DMA_TO_DEVICE); | 75 | DMA_TO_DEVICE); |
72 | priv->tx_skbuff_dma[entry] = desc->des2; | 76 | if (dma_mapping_error(priv->device, desc->des2)) |
77 | return -1; | ||
78 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
73 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, | 79 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, |
74 | STMMAC_CHAIN_MODE); | 80 | STMMAC_CHAIN_MODE); |
75 | priv->hw->desc->set_tx_owner(desc); | 81 | priv->hw->desc->set_tx_owner(desc); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index de507c32036c..593e6c4144a7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h | |||
@@ -220,10 +220,10 @@ enum dma_irq_status { | |||
220 | handle_tx = 0x8, | 220 | handle_tx = 0x8, |
221 | }; | 221 | }; |
222 | 222 | ||
223 | #define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 1) | 223 | #define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 0) |
224 | #define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 2) | 224 | #define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 1) |
225 | #define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 3) | 225 | #define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 2) |
226 | #define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 4) | 226 | #define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 3) |
227 | 227 | ||
228 | #define CORE_PCS_ANE_COMPLETE (1 << 5) | 228 | #define CORE_PCS_ANE_COMPLETE (1 << 5) |
229 | #define CORE_PCS_LINK_STATUS (1 << 6) | 229 | #define CORE_PCS_LINK_STATUS (1 << 6) |
@@ -287,7 +287,7 @@ struct dma_features { | |||
287 | 287 | ||
288 | /* Default LPI timers */ | 288 | /* Default LPI timers */ |
289 | #define STMMAC_DEFAULT_LIT_LS 0x3E8 | 289 | #define STMMAC_DEFAULT_LIT_LS 0x3E8 |
290 | #define STMMAC_DEFAULT_TWT_LS 0x0 | 290 | #define STMMAC_DEFAULT_TWT_LS 0x1E |
291 | 291 | ||
292 | #define STMMAC_CHAIN_MODE 0x1 | 292 | #define STMMAC_CHAIN_MODE 0x1 |
293 | #define STMMAC_RING_MODE 0x2 | 293 | #define STMMAC_RING_MODE 0x2 |
@@ -425,7 +425,7 @@ struct stmmac_mode_ops { | |||
425 | void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, | 425 | void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, |
426 | unsigned int extend_desc); | 426 | unsigned int extend_desc); |
427 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); | 427 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); |
428 | unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); | 428 | int (*jumbo_frm)(void *priv, struct sk_buff *skb, int csum); |
429 | int (*set_16kib_bfsize)(int mtu); | 429 | int (*set_16kib_bfsize)(int mtu); |
430 | void (*init_desc3)(struct dma_desc *p); | 430 | void (*init_desc3)(struct dma_desc *p); |
431 | void (*refill_desc3) (void *priv, struct dma_desc *p); | 431 | void (*refill_desc3) (void *priv, struct dma_desc *p); |
@@ -445,6 +445,7 @@ struct mac_device_info { | |||
445 | int multicast_filter_bins; | 445 | int multicast_filter_bins; |
446 | int unicast_filter_entries; | 446 | int unicast_filter_entries; |
447 | int mcast_bits_log2; | 447 | int mcast_bits_log2; |
448 | unsigned int rx_csum; | ||
448 | }; | 449 | }; |
449 | 450 | ||
450 | struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins, | 451 | struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins, |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h index 71b5419256c1..64d8f56a9c17 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | |||
@@ -153,7 +153,7 @@ enum inter_frame_gap { | |||
153 | #define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */ | 153 | #define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */ |
154 | 154 | ||
155 | #define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \ | 155 | #define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \ |
156 | GMAC_CONTROL_BE) | 156 | GMAC_CONTROL_BE | GMAC_CONTROL_DCRS) |
157 | 157 | ||
158 | /* GMAC Frame Filter defines */ | 158 | /* GMAC Frame Filter defines */ |
159 | #define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */ | 159 | #define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index d8ef18786a1c..5efe60ea6526 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | |||
@@ -58,7 +58,11 @@ static int dwmac1000_rx_ipc_enable(struct mac_device_info *hw) | |||
58 | void __iomem *ioaddr = hw->pcsr; | 58 | void __iomem *ioaddr = hw->pcsr; |
59 | u32 value = readl(ioaddr + GMAC_CONTROL); | 59 | u32 value = readl(ioaddr + GMAC_CONTROL); |
60 | 60 | ||
61 | value |= GMAC_CONTROL_IPC; | 61 | if (hw->rx_csum) |
62 | value |= GMAC_CONTROL_IPC; | ||
63 | else | ||
64 | value &= ~GMAC_CONTROL_IPC; | ||
65 | |||
62 | writel(value, ioaddr + GMAC_CONTROL); | 66 | writel(value, ioaddr + GMAC_CONTROL); |
63 | 67 | ||
64 | value = readl(ioaddr + GMAC_CONTROL); | 68 | value = readl(ioaddr + GMAC_CONTROL); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc.h b/drivers/net/ethernet/stmicro/stmmac/mmc.h index 8607488cbcfc..192c2491330b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc.h +++ b/drivers/net/ethernet/stmicro/stmmac/mmc.h | |||
@@ -68,7 +68,7 @@ struct stmmac_counters { | |||
68 | unsigned int mmc_rx_octetcount_g; | 68 | unsigned int mmc_rx_octetcount_g; |
69 | unsigned int mmc_rx_broadcastframe_g; | 69 | unsigned int mmc_rx_broadcastframe_g; |
70 | unsigned int mmc_rx_multicastframe_g; | 70 | unsigned int mmc_rx_multicastframe_g; |
71 | unsigned int mmc_rx_crc_errror; | 71 | unsigned int mmc_rx_crc_error; |
72 | unsigned int mmc_rx_align_error; | 72 | unsigned int mmc_rx_align_error; |
73 | unsigned int mmc_rx_run_error; | 73 | unsigned int mmc_rx_run_error; |
74 | unsigned int mmc_rx_jabber_error; | 74 | unsigned int mmc_rx_jabber_error; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c index 50617c5a0bdb..08c483bd2ec7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c | |||
@@ -196,7 +196,7 @@ void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc) | |||
196 | mmc->mmc_rx_octetcount_g += readl(ioaddr + MMC_RX_OCTETCOUNT_G); | 196 | mmc->mmc_rx_octetcount_g += readl(ioaddr + MMC_RX_OCTETCOUNT_G); |
197 | mmc->mmc_rx_broadcastframe_g += readl(ioaddr + MMC_RX_BROADCASTFRAME_G); | 197 | mmc->mmc_rx_broadcastframe_g += readl(ioaddr + MMC_RX_BROADCASTFRAME_G); |
198 | mmc->mmc_rx_multicastframe_g += readl(ioaddr + MMC_RX_MULTICASTFRAME_G); | 198 | mmc->mmc_rx_multicastframe_g += readl(ioaddr + MMC_RX_MULTICASTFRAME_G); |
199 | mmc->mmc_rx_crc_errror += readl(ioaddr + MMC_RX_CRC_ERRROR); | 199 | mmc->mmc_rx_crc_error += readl(ioaddr + MMC_RX_CRC_ERRROR); |
200 | mmc->mmc_rx_align_error += readl(ioaddr + MMC_RX_ALIGN_ERROR); | 200 | mmc->mmc_rx_align_error += readl(ioaddr + MMC_RX_ALIGN_ERROR); |
201 | mmc->mmc_rx_run_error += readl(ioaddr + MMC_RX_RUN_ERROR); | 201 | mmc->mmc_rx_run_error += readl(ioaddr + MMC_RX_RUN_ERROR); |
202 | mmc->mmc_rx_jabber_error += readl(ioaddr + MMC_RX_JABBER_ERROR); | 202 | mmc->mmc_rx_jabber_error += readl(ioaddr + MMC_RX_JABBER_ERROR); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index 650a4be6bce5..5dd50c6cda5b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "stmmac.h" | 29 | #include "stmmac.h" |
30 | 30 | ||
31 | static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | 31 | static int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) |
32 | { | 32 | { |
33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
34 | unsigned int txsize = priv->dma_tx_size; | 34 | unsigned int txsize = priv->dma_tx_size; |
@@ -53,7 +53,10 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
53 | 53 | ||
54 | desc->des2 = dma_map_single(priv->device, skb->data, | 54 | desc->des2 = dma_map_single(priv->device, skb->data, |
55 | bmax, DMA_TO_DEVICE); | 55 | bmax, DMA_TO_DEVICE); |
56 | priv->tx_skbuff_dma[entry] = desc->des2; | 56 | if (dma_mapping_error(priv->device, desc->des2)) |
57 | return -1; | ||
58 | |||
59 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
57 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 60 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
58 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, | 61 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, |
59 | STMMAC_RING_MODE); | 62 | STMMAC_RING_MODE); |
@@ -68,7 +71,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
68 | 71 | ||
69 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, | 72 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, |
70 | len, DMA_TO_DEVICE); | 73 | len, DMA_TO_DEVICE); |
71 | priv->tx_skbuff_dma[entry] = desc->des2; | 74 | if (dma_mapping_error(priv->device, desc->des2)) |
75 | return -1; | ||
76 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
72 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 77 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
73 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, | 78 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, |
74 | STMMAC_RING_MODE); | 79 | STMMAC_RING_MODE); |
@@ -77,7 +82,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
77 | } else { | 82 | } else { |
78 | desc->des2 = dma_map_single(priv->device, skb->data, | 83 | desc->des2 = dma_map_single(priv->device, skb->data, |
79 | nopaged_len, DMA_TO_DEVICE); | 84 | nopaged_len, DMA_TO_DEVICE); |
80 | priv->tx_skbuff_dma[entry] = desc->des2; | 85 | if (dma_mapping_error(priv->device, desc->des2)) |
86 | return -1; | ||
87 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
81 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 88 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
82 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, csum, | 89 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, csum, |
83 | STMMAC_RING_MODE); | 90 | STMMAC_RING_MODE); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index ca01035634a7..58097c0e2ad5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -34,6 +34,11 @@ | |||
34 | #include <linux/ptp_clock_kernel.h> | 34 | #include <linux/ptp_clock_kernel.h> |
35 | #include <linux/reset.h> | 35 | #include <linux/reset.h> |
36 | 36 | ||
37 | struct stmmac_tx_info { | ||
38 | dma_addr_t buf; | ||
39 | bool map_as_page; | ||
40 | }; | ||
41 | |||
37 | struct stmmac_priv { | 42 | struct stmmac_priv { |
38 | /* Frequently used values are kept adjacent for cache effect */ | 43 | /* Frequently used values are kept adjacent for cache effect */ |
39 | struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; | 44 | struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; |
@@ -45,7 +50,7 @@ struct stmmac_priv { | |||
45 | u32 tx_count_frames; | 50 | u32 tx_count_frames; |
46 | u32 tx_coal_frames; | 51 | u32 tx_coal_frames; |
47 | u32 tx_coal_timer; | 52 | u32 tx_coal_timer; |
48 | dma_addr_t *tx_skbuff_dma; | 53 | struct stmmac_tx_info *tx_skbuff_dma; |
49 | dma_addr_t dma_tx_phy; | 54 | dma_addr_t dma_tx_phy; |
50 | int tx_coalesce; | 55 | int tx_coalesce; |
51 | int hwts_tx_en; | 56 | int hwts_tx_en; |
@@ -105,6 +110,8 @@ struct stmmac_priv { | |||
105 | struct ptp_clock *ptp_clock; | 110 | struct ptp_clock *ptp_clock; |
106 | struct ptp_clock_info ptp_clock_ops; | 111 | struct ptp_clock_info ptp_clock_ops; |
107 | unsigned int default_addend; | 112 | unsigned int default_addend; |
113 | struct clk *clk_ptp_ref; | ||
114 | unsigned int clk_ptp_rate; | ||
108 | u32 adv_ts; | 115 | u32 adv_ts; |
109 | int use_riwt; | 116 | int use_riwt; |
110 | int irq_wake; | 117 | int irq_wake; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 9af50bae4dde..cf4f38db1c0a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | |||
@@ -175,7 +175,7 @@ static const struct stmmac_stats stmmac_mmc[] = { | |||
175 | STMMAC_MMC_STAT(mmc_rx_octetcount_g), | 175 | STMMAC_MMC_STAT(mmc_rx_octetcount_g), |
176 | STMMAC_MMC_STAT(mmc_rx_broadcastframe_g), | 176 | STMMAC_MMC_STAT(mmc_rx_broadcastframe_g), |
177 | STMMAC_MMC_STAT(mmc_rx_multicastframe_g), | 177 | STMMAC_MMC_STAT(mmc_rx_multicastframe_g), |
178 | STMMAC_MMC_STAT(mmc_rx_crc_errror), | 178 | STMMAC_MMC_STAT(mmc_rx_crc_error), |
179 | STMMAC_MMC_STAT(mmc_rx_align_error), | 179 | STMMAC_MMC_STAT(mmc_rx_align_error), |
180 | STMMAC_MMC_STAT(mmc_rx_run_error), | 180 | STMMAC_MMC_STAT(mmc_rx_run_error), |
181 | STMMAC_MMC_STAT(mmc_rx_jabber_error), | 181 | STMMAC_MMC_STAT(mmc_rx_jabber_error), |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 08addd653728..6e6ee226de04 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -275,6 +275,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) | |||
275 | */ | 275 | */ |
276 | bool stmmac_eee_init(struct stmmac_priv *priv) | 276 | bool stmmac_eee_init(struct stmmac_priv *priv) |
277 | { | 277 | { |
278 | char *phy_bus_name = priv->plat->phy_bus_name; | ||
278 | bool ret = false; | 279 | bool ret = false; |
279 | 280 | ||
280 | /* Using PCS we cannot dial with the phy registers at this stage | 281 | /* Using PCS we cannot dial with the phy registers at this stage |
@@ -284,6 +285,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
284 | (priv->pcs == STMMAC_PCS_RTBI)) | 285 | (priv->pcs == STMMAC_PCS_RTBI)) |
285 | goto out; | 286 | goto out; |
286 | 287 | ||
288 | /* Never init EEE in case of a switch is attached */ | ||
289 | if (phy_bus_name && (!strcmp(phy_bus_name, "fixed"))) | ||
290 | goto out; | ||
291 | |||
287 | /* MAC core supports the EEE feature. */ | 292 | /* MAC core supports the EEE feature. */ |
288 | if (priv->dma_cap.eee) { | 293 | if (priv->dma_cap.eee) { |
289 | int tx_lpi_timer = priv->tx_lpi_timer; | 294 | int tx_lpi_timer = priv->tx_lpi_timer; |
@@ -316,10 +321,9 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
316 | priv->hw->mac->set_eee_timer(priv->hw, | 321 | priv->hw->mac->set_eee_timer(priv->hw, |
317 | STMMAC_DEFAULT_LIT_LS, | 322 | STMMAC_DEFAULT_LIT_LS, |
318 | tx_lpi_timer); | 323 | tx_lpi_timer); |
319 | } else | 324 | } |
320 | /* Set HW EEE according to the speed */ | 325 | /* Set HW EEE according to the speed */ |
321 | priv->hw->mac->set_eee_pls(priv->hw, | 326 | priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); |
322 | priv->phydev->link); | ||
323 | 327 | ||
324 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); | 328 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); |
325 | 329 | ||
@@ -603,16 +607,16 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
603 | /* calculate default added value: | 607 | /* calculate default added value: |
604 | * formula is : | 608 | * formula is : |
605 | * addend = (2^32)/freq_div_ratio; | 609 | * addend = (2^32)/freq_div_ratio; |
606 | * where, freq_div_ratio = STMMAC_SYSCLOCK/50MHz | 610 | * where, freq_div_ratio = clk_ptp_ref_i/50MHz |
607 | * hence, addend = ((2^32) * 50MHz)/STMMAC_SYSCLOCK; | 611 | * hence, addend = ((2^32) * 50MHz)/clk_ptp_ref_i; |
608 | * NOTE: STMMAC_SYSCLOCK should be >= 50MHz to | 612 | * NOTE: clk_ptp_ref_i should be >= 50MHz to |
609 | * achive 20ns accuracy. | 613 | * achive 20ns accuracy. |
610 | * | 614 | * |
611 | * 2^x * y == (y << x), hence | 615 | * 2^x * y == (y << x), hence |
612 | * 2^32 * 50000000 ==> (50000000 << 32) | 616 | * 2^32 * 50000000 ==> (50000000 << 32) |
613 | */ | 617 | */ |
614 | temp = (u64) (50000000ULL << 32); | 618 | temp = (u64) (50000000ULL << 32); |
615 | priv->default_addend = div_u64(temp, STMMAC_SYSCLOCK); | 619 | priv->default_addend = div_u64(temp, priv->clk_ptp_rate); |
616 | priv->hw->ptp->config_addend(priv->ioaddr, | 620 | priv->hw->ptp->config_addend(priv->ioaddr, |
617 | priv->default_addend); | 621 | priv->default_addend); |
618 | 622 | ||
@@ -638,6 +642,16 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) | |||
638 | if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) | 642 | if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) |
639 | return -EOPNOTSUPP; | 643 | return -EOPNOTSUPP; |
640 | 644 | ||
645 | /* Fall-back to main clock in case of no PTP ref is passed */ | ||
646 | priv->clk_ptp_ref = devm_clk_get(priv->device, "clk_ptp_ref"); | ||
647 | if (IS_ERR(priv->clk_ptp_ref)) { | ||
648 | priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk); | ||
649 | priv->clk_ptp_ref = NULL; | ||
650 | } else { | ||
651 | clk_prepare_enable(priv->clk_ptp_ref); | ||
652 | priv->clk_ptp_rate = clk_get_rate(priv->clk_ptp_ref); | ||
653 | } | ||
654 | |||
641 | priv->adv_ts = 0; | 655 | priv->adv_ts = 0; |
642 | if (priv->dma_cap.atime_stamp && priv->extend_desc) | 656 | if (priv->dma_cap.atime_stamp && priv->extend_desc) |
643 | priv->adv_ts = 1; | 657 | priv->adv_ts = 1; |
@@ -657,6 +671,8 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) | |||
657 | 671 | ||
658 | static void stmmac_release_ptp(struct stmmac_priv *priv) | 672 | static void stmmac_release_ptp(struct stmmac_priv *priv) |
659 | { | 673 | { |
674 | if (priv->clk_ptp_ref) | ||
675 | clk_disable_unprepare(priv->clk_ptp_ref); | ||
660 | stmmac_ptp_unregister(priv); | 676 | stmmac_ptp_unregister(priv); |
661 | } | 677 | } |
662 | 678 | ||
@@ -1061,7 +1077,8 @@ static int init_dma_desc_rings(struct net_device *dev) | |||
1061 | else | 1077 | else |
1062 | p = priv->dma_tx + i; | 1078 | p = priv->dma_tx + i; |
1063 | p->des2 = 0; | 1079 | p->des2 = 0; |
1064 | priv->tx_skbuff_dma[i] = 0; | 1080 | priv->tx_skbuff_dma[i].buf = 0; |
1081 | priv->tx_skbuff_dma[i].map_as_page = false; | ||
1065 | priv->tx_skbuff[i] = NULL; | 1082 | priv->tx_skbuff[i] = NULL; |
1066 | } | 1083 | } |
1067 | 1084 | ||
@@ -1100,17 +1117,24 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv) | |||
1100 | else | 1117 | else |
1101 | p = priv->dma_tx + i; | 1118 | p = priv->dma_tx + i; |
1102 | 1119 | ||
1103 | if (priv->tx_skbuff_dma[i]) { | 1120 | if (priv->tx_skbuff_dma[i].buf) { |
1104 | dma_unmap_single(priv->device, | 1121 | if (priv->tx_skbuff_dma[i].map_as_page) |
1105 | priv->tx_skbuff_dma[i], | 1122 | dma_unmap_page(priv->device, |
1106 | priv->hw->desc->get_tx_len(p), | 1123 | priv->tx_skbuff_dma[i].buf, |
1107 | DMA_TO_DEVICE); | 1124 | priv->hw->desc->get_tx_len(p), |
1108 | priv->tx_skbuff_dma[i] = 0; | 1125 | DMA_TO_DEVICE); |
1126 | else | ||
1127 | dma_unmap_single(priv->device, | ||
1128 | priv->tx_skbuff_dma[i].buf, | ||
1129 | priv->hw->desc->get_tx_len(p), | ||
1130 | DMA_TO_DEVICE); | ||
1109 | } | 1131 | } |
1110 | 1132 | ||
1111 | if (priv->tx_skbuff[i] != NULL) { | 1133 | if (priv->tx_skbuff[i] != NULL) { |
1112 | dev_kfree_skb_any(priv->tx_skbuff[i]); | 1134 | dev_kfree_skb_any(priv->tx_skbuff[i]); |
1113 | priv->tx_skbuff[i] = NULL; | 1135 | priv->tx_skbuff[i] = NULL; |
1136 | priv->tx_skbuff_dma[i].buf = 0; | ||
1137 | priv->tx_skbuff_dma[i].map_as_page = false; | ||
1114 | } | 1138 | } |
1115 | } | 1139 | } |
1116 | } | 1140 | } |
@@ -1131,7 +1155,8 @@ static int alloc_dma_desc_resources(struct stmmac_priv *priv) | |||
1131 | if (!priv->rx_skbuff) | 1155 | if (!priv->rx_skbuff) |
1132 | goto err_rx_skbuff; | 1156 | goto err_rx_skbuff; |
1133 | 1157 | ||
1134 | priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), | 1158 | priv->tx_skbuff_dma = kmalloc_array(txsize, |
1159 | sizeof(*priv->tx_skbuff_dma), | ||
1135 | GFP_KERNEL); | 1160 | GFP_KERNEL); |
1136 | if (!priv->tx_skbuff_dma) | 1161 | if (!priv->tx_skbuff_dma) |
1137 | goto err_tx_skbuff_dma; | 1162 | goto err_tx_skbuff_dma; |
@@ -1293,12 +1318,19 @@ static void stmmac_tx_clean(struct stmmac_priv *priv) | |||
1293 | pr_debug("%s: curr %d, dirty %d\n", __func__, | 1318 | pr_debug("%s: curr %d, dirty %d\n", __func__, |
1294 | priv->cur_tx, priv->dirty_tx); | 1319 | priv->cur_tx, priv->dirty_tx); |
1295 | 1320 | ||
1296 | if (likely(priv->tx_skbuff_dma[entry])) { | 1321 | if (likely(priv->tx_skbuff_dma[entry].buf)) { |
1297 | dma_unmap_single(priv->device, | 1322 | if (priv->tx_skbuff_dma[entry].map_as_page) |
1298 | priv->tx_skbuff_dma[entry], | 1323 | dma_unmap_page(priv->device, |
1299 | priv->hw->desc->get_tx_len(p), | 1324 | priv->tx_skbuff_dma[entry].buf, |
1300 | DMA_TO_DEVICE); | 1325 | priv->hw->desc->get_tx_len(p), |
1301 | priv->tx_skbuff_dma[entry] = 0; | 1326 | DMA_TO_DEVICE); |
1327 | else | ||
1328 | dma_unmap_single(priv->device, | ||
1329 | priv->tx_skbuff_dma[entry].buf, | ||
1330 | priv->hw->desc->get_tx_len(p), | ||
1331 | DMA_TO_DEVICE); | ||
1332 | priv->tx_skbuff_dma[entry].buf = 0; | ||
1333 | priv->tx_skbuff_dma[entry].map_as_page = false; | ||
1302 | } | 1334 | } |
1303 | priv->hw->mode->clean_desc3(priv, p); | 1335 | priv->hw->mode->clean_desc3(priv, p); |
1304 | 1336 | ||
@@ -1637,6 +1669,13 @@ static int stmmac_hw_setup(struct net_device *dev) | |||
1637 | /* Initialize the MAC Core */ | 1669 | /* Initialize the MAC Core */ |
1638 | priv->hw->mac->core_init(priv->hw, dev->mtu); | 1670 | priv->hw->mac->core_init(priv->hw, dev->mtu); |
1639 | 1671 | ||
1672 | ret = priv->hw->mac->rx_ipc(priv->hw); | ||
1673 | if (!ret) { | ||
1674 | pr_warn(" RX IPC Checksum Offload disabled\n"); | ||
1675 | priv->plat->rx_coe = STMMAC_RX_COE_NONE; | ||
1676 | priv->hw->rx_csum = 0; | ||
1677 | } | ||
1678 | |||
1640 | /* Enable the MAC Rx/Tx */ | 1679 | /* Enable the MAC Rx/Tx */ |
1641 | stmmac_set_mac(priv->ioaddr, true); | 1680 | stmmac_set_mac(priv->ioaddr, true); |
1642 | 1681 | ||
@@ -1887,12 +1926,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1887 | if (likely(!is_jumbo)) { | 1926 | if (likely(!is_jumbo)) { |
1888 | desc->des2 = dma_map_single(priv->device, skb->data, | 1927 | desc->des2 = dma_map_single(priv->device, skb->data, |
1889 | nopaged_len, DMA_TO_DEVICE); | 1928 | nopaged_len, DMA_TO_DEVICE); |
1890 | priv->tx_skbuff_dma[entry] = desc->des2; | 1929 | if (dma_mapping_error(priv->device, desc->des2)) |
1930 | goto dma_map_err; | ||
1931 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
1891 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, | 1932 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, |
1892 | csum_insertion, priv->mode); | 1933 | csum_insertion, priv->mode); |
1893 | } else { | 1934 | } else { |
1894 | desc = first; | 1935 | desc = first; |
1895 | entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion); | 1936 | entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion); |
1937 | if (unlikely(entry < 0)) | ||
1938 | goto dma_map_err; | ||
1896 | } | 1939 | } |
1897 | 1940 | ||
1898 | for (i = 0; i < nfrags; i++) { | 1941 | for (i = 0; i < nfrags; i++) { |
@@ -1908,7 +1951,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1908 | 1951 | ||
1909 | desc->des2 = skb_frag_dma_map(priv->device, frag, 0, len, | 1952 | desc->des2 = skb_frag_dma_map(priv->device, frag, 0, len, |
1910 | DMA_TO_DEVICE); | 1953 | DMA_TO_DEVICE); |
1911 | priv->tx_skbuff_dma[entry] = desc->des2; | 1954 | if (dma_mapping_error(priv->device, desc->des2)) |
1955 | goto dma_map_err; /* should reuse desc w/o issues */ | ||
1956 | |||
1957 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
1958 | priv->tx_skbuff_dma[entry].map_as_page = true; | ||
1912 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion, | 1959 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion, |
1913 | priv->mode); | 1960 | priv->mode); |
1914 | wmb(); | 1961 | wmb(); |
@@ -1975,7 +2022,12 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1975 | priv->hw->dma->enable_dma_transmission(priv->ioaddr); | 2022 | priv->hw->dma->enable_dma_transmission(priv->ioaddr); |
1976 | 2023 | ||
1977 | spin_unlock(&priv->tx_lock); | 2024 | spin_unlock(&priv->tx_lock); |
2025 | return NETDEV_TX_OK; | ||
1978 | 2026 | ||
2027 | dma_map_err: | ||
2028 | dev_err(priv->device, "Tx dma map failed\n"); | ||
2029 | dev_kfree_skb(skb); | ||
2030 | priv->dev->stats.tx_dropped++; | ||
1979 | return NETDEV_TX_OK; | 2031 | return NETDEV_TX_OK; |
1980 | } | 2032 | } |
1981 | 2033 | ||
@@ -2028,7 +2080,12 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) | |||
2028 | priv->rx_skbuff_dma[entry] = | 2080 | priv->rx_skbuff_dma[entry] = |
2029 | dma_map_single(priv->device, skb->data, bfsize, | 2081 | dma_map_single(priv->device, skb->data, bfsize, |
2030 | DMA_FROM_DEVICE); | 2082 | DMA_FROM_DEVICE); |
2031 | 2083 | if (dma_mapping_error(priv->device, | |
2084 | priv->rx_skbuff_dma[entry])) { | ||
2085 | dev_err(priv->device, "Rx dma map failed\n"); | ||
2086 | dev_kfree_skb(skb); | ||
2087 | break; | ||
2088 | } | ||
2032 | p->des2 = priv->rx_skbuff_dma[entry]; | 2089 | p->des2 = priv->rx_skbuff_dma[entry]; |
2033 | 2090 | ||
2034 | priv->hw->mode->refill_desc3(priv, p); | 2091 | priv->hw->mode->refill_desc3(priv, p); |
@@ -2055,7 +2112,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) | |||
2055 | unsigned int entry = priv->cur_rx % rxsize; | 2112 | unsigned int entry = priv->cur_rx % rxsize; |
2056 | unsigned int next_entry; | 2113 | unsigned int next_entry; |
2057 | unsigned int count = 0; | 2114 | unsigned int count = 0; |
2058 | int coe = priv->plat->rx_coe; | 2115 | int coe = priv->hw->rx_csum; |
2059 | 2116 | ||
2060 | if (netif_msg_rx_status(priv)) { | 2117 | if (netif_msg_rx_status(priv)) { |
2061 | pr_debug("%s: descriptor ring:\n", __func__); | 2118 | pr_debug("%s: descriptor ring:\n", __func__); |
@@ -2276,8 +2333,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, | |||
2276 | 2333 | ||
2277 | if (priv->plat->rx_coe == STMMAC_RX_COE_NONE) | 2334 | if (priv->plat->rx_coe == STMMAC_RX_COE_NONE) |
2278 | features &= ~NETIF_F_RXCSUM; | 2335 | features &= ~NETIF_F_RXCSUM; |
2279 | else if (priv->plat->rx_coe == STMMAC_RX_COE_TYPE1) | 2336 | |
2280 | features &= ~NETIF_F_IPV6_CSUM; | ||
2281 | if (!priv->plat->tx_coe) | 2337 | if (!priv->plat->tx_coe) |
2282 | features &= ~NETIF_F_ALL_CSUM; | 2338 | features &= ~NETIF_F_ALL_CSUM; |
2283 | 2339 | ||
@@ -2292,6 +2348,24 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, | |||
2292 | return features; | 2348 | return features; |
2293 | } | 2349 | } |
2294 | 2350 | ||
2351 | static int stmmac_set_features(struct net_device *netdev, | ||
2352 | netdev_features_t features) | ||
2353 | { | ||
2354 | struct stmmac_priv *priv = netdev_priv(netdev); | ||
2355 | |||
2356 | /* Keep the COE Type in case of csum is supporting */ | ||
2357 | if (features & NETIF_F_RXCSUM) | ||
2358 | priv->hw->rx_csum = priv->plat->rx_coe; | ||
2359 | else | ||
2360 | priv->hw->rx_csum = 0; | ||
2361 | /* No check needed because rx_coe has been set before and it will be | ||
2362 | * fixed in case of issue. | ||
2363 | */ | ||
2364 | priv->hw->mac->rx_ipc(priv->hw); | ||
2365 | |||
2366 | return 0; | ||
2367 | } | ||
2368 | |||
2295 | /** | 2369 | /** |
2296 | * stmmac_interrupt - main ISR | 2370 | * stmmac_interrupt - main ISR |
2297 | * @irq: interrupt number. | 2371 | * @irq: interrupt number. |
@@ -2572,6 +2646,7 @@ static const struct net_device_ops stmmac_netdev_ops = { | |||
2572 | .ndo_stop = stmmac_release, | 2646 | .ndo_stop = stmmac_release, |
2573 | .ndo_change_mtu = stmmac_change_mtu, | 2647 | .ndo_change_mtu = stmmac_change_mtu, |
2574 | .ndo_fix_features = stmmac_fix_features, | 2648 | .ndo_fix_features = stmmac_fix_features, |
2649 | .ndo_set_features = stmmac_set_features, | ||
2575 | .ndo_set_rx_mode = stmmac_set_rx_mode, | 2650 | .ndo_set_rx_mode = stmmac_set_rx_mode, |
2576 | .ndo_tx_timeout = stmmac_tx_timeout, | 2651 | .ndo_tx_timeout = stmmac_tx_timeout, |
2577 | .ndo_do_ioctl = stmmac_ioctl, | 2652 | .ndo_do_ioctl = stmmac_ioctl, |
@@ -2592,7 +2667,6 @@ static const struct net_device_ops stmmac_netdev_ops = { | |||
2592 | */ | 2667 | */ |
2593 | static int stmmac_hw_init(struct stmmac_priv *priv) | 2668 | static int stmmac_hw_init(struct stmmac_priv *priv) |
2594 | { | 2669 | { |
2595 | int ret; | ||
2596 | struct mac_device_info *mac; | 2670 | struct mac_device_info *mac; |
2597 | 2671 | ||
2598 | /* Identify the MAC HW device */ | 2672 | /* Identify the MAC HW device */ |
@@ -2649,15 +2723,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
2649 | /* To use alternate (extended) or normal descriptor structures */ | 2723 | /* To use alternate (extended) or normal descriptor structures */ |
2650 | stmmac_selec_desc_mode(priv); | 2724 | stmmac_selec_desc_mode(priv); |
2651 | 2725 | ||
2652 | ret = priv->hw->mac->rx_ipc(priv->hw); | 2726 | if (priv->plat->rx_coe) { |
2653 | if (!ret) { | 2727 | priv->hw->rx_csum = priv->plat->rx_coe; |
2654 | pr_warn(" RX IPC Checksum Offload not configured.\n"); | ||
2655 | priv->plat->rx_coe = STMMAC_RX_COE_NONE; | ||
2656 | } | ||
2657 | |||
2658 | if (priv->plat->rx_coe) | ||
2659 | pr_info(" RX Checksum Offload Engine supported (type %d)\n", | 2728 | pr_info(" RX Checksum Offload Engine supported (type %d)\n", |
2660 | priv->plat->rx_coe); | 2729 | priv->plat->rx_coe); |
2730 | } | ||
2661 | if (priv->plat->tx_coe) | 2731 | if (priv->plat->tx_coe) |
2662 | pr_info(" TX Checksum insertion supported\n"); | 2732 | pr_info(" TX Checksum insertion supported\n"); |
2663 | 2733 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index b7ad3565566c..c5ee79d8a8c5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | |||
@@ -206,6 +206,7 @@ void stmmac_ptp_unregister(struct stmmac_priv *priv) | |||
206 | { | 206 | { |
207 | if (priv->ptp_clock) { | 207 | if (priv->ptp_clock) { |
208 | ptp_clock_unregister(priv->ptp_clock); | 208 | ptp_clock_unregister(priv->ptp_clock); |
209 | priv->ptp_clock = NULL; | ||
209 | pr_debug("Removed PTP HW clock successfully on %s\n", | 210 | pr_debug("Removed PTP HW clock successfully on %s\n", |
210 | priv->dev->name); | 211 | priv->dev->name); |
211 | } | 212 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h index 3dbc047622fa..4535df37c227 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h | |||
@@ -25,8 +25,6 @@ | |||
25 | #ifndef __STMMAC_PTP_H__ | 25 | #ifndef __STMMAC_PTP_H__ |
26 | #define __STMMAC_PTP_H__ | 26 | #define __STMMAC_PTP_H__ |
27 | 27 | ||
28 | #define STMMAC_SYSCLOCK 62500000 | ||
29 | |||
30 | /* IEEE 1588 PTP register offsets */ | 28 | /* IEEE 1588 PTP register offsets */ |
31 | #define PTP_TCR 0x0700 /* Timestamp Control Reg */ | 29 | #define PTP_TCR 0x0700 /* Timestamp Control Reg */ |
32 | #define PTP_SSIR 0x0704 /* Sub-Second Increment Reg */ | 30 | #define PTP_SSIR 0x0704 /* Sub-Second Increment Reg */ |
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 23c89ab5a6ad..f67539650c38 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
@@ -350,14 +350,17 @@ static int vnet_walk_rx_one(struct vnet_port *port, | |||
350 | if (IS_ERR(desc)) | 350 | if (IS_ERR(desc)) |
351 | return PTR_ERR(desc); | 351 | return PTR_ERR(desc); |
352 | 352 | ||
353 | if (desc->hdr.state != VIO_DESC_READY) | ||
354 | return 1; | ||
355 | |||
356 | rmb(); | ||
357 | |||
353 | viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n", | 358 | viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n", |
354 | desc->hdr.state, desc->hdr.ack, | 359 | desc->hdr.state, desc->hdr.ack, |
355 | desc->size, desc->ncookies, | 360 | desc->size, desc->ncookies, |
356 | desc->cookies[0].cookie_addr, | 361 | desc->cookies[0].cookie_addr, |
357 | desc->cookies[0].cookie_size); | 362 | desc->cookies[0].cookie_size); |
358 | 363 | ||
359 | if (desc->hdr.state != VIO_DESC_READY) | ||
360 | return 1; | ||
361 | err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies); | 364 | err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies); |
362 | if (err == -ECONNRESET) | 365 | if (err == -ECONNRESET) |
363 | return err; | 366 | return err; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 999fb72688d2..e2a00287f8eb 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -699,6 +699,28 @@ static void cpsw_rx_handler(void *token, int len, int status) | |||
699 | cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); | 699 | cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); |
700 | 700 | ||
701 | if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { | 701 | if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { |
702 | bool ndev_status = false; | ||
703 | struct cpsw_slave *slave = priv->slaves; | ||
704 | int n; | ||
705 | |||
706 | if (priv->data.dual_emac) { | ||
707 | /* In dual emac mode check for all interfaces */ | ||
708 | for (n = priv->data.slaves; n; n--, slave++) | ||
709 | if (netif_running(slave->ndev)) | ||
710 | ndev_status = true; | ||
711 | } | ||
712 | |||
713 | if (ndev_status && (status >= 0)) { | ||
714 | /* The packet received is for the interface which | ||
715 | * is already down and the other interface is up | ||
716 | * and running, intead of freeing which results | ||
717 | * in reducing of the number of rx descriptor in | ||
718 | * DMA engine, requeue skb back to cpdma. | ||
719 | */ | ||
720 | new_skb = skb; | ||
721 | goto requeue; | ||
722 | } | ||
723 | |||
702 | /* the interface is going down, skbs are purged */ | 724 | /* the interface is going down, skbs are purged */ |
703 | dev_kfree_skb_any(skb); | 725 | dev_kfree_skb_any(skb); |
704 | return; | 726 | return; |
@@ -717,6 +739,7 @@ static void cpsw_rx_handler(void *token, int len, int status) | |||
717 | new_skb = skb; | 739 | new_skb = skb; |
718 | } | 740 | } |
719 | 741 | ||
742 | requeue: | ||
720 | ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data, | 743 | ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data, |
721 | skb_tailroom(new_skb), 0); | 744 | skb_tailroom(new_skb), 0); |
722 | if (WARN_ON(ret < 0)) | 745 | if (WARN_ON(ret < 0)) |
@@ -2311,10 +2334,19 @@ static int cpsw_suspend(struct device *dev) | |||
2311 | struct net_device *ndev = platform_get_drvdata(pdev); | 2334 | struct net_device *ndev = platform_get_drvdata(pdev); |
2312 | struct cpsw_priv *priv = netdev_priv(ndev); | 2335 | struct cpsw_priv *priv = netdev_priv(ndev); |
2313 | 2336 | ||
2314 | if (netif_running(ndev)) | 2337 | if (priv->data.dual_emac) { |
2315 | cpsw_ndo_stop(ndev); | 2338 | int i; |
2316 | 2339 | ||
2317 | for_each_slave(priv, soft_reset_slave); | 2340 | for (i = 0; i < priv->data.slaves; i++) { |
2341 | if (netif_running(priv->slaves[i].ndev)) | ||
2342 | cpsw_ndo_stop(priv->slaves[i].ndev); | ||
2343 | soft_reset_slave(priv->slaves + i); | ||
2344 | } | ||
2345 | } else { | ||
2346 | if (netif_running(ndev)) | ||
2347 | cpsw_ndo_stop(ndev); | ||
2348 | for_each_slave(priv, soft_reset_slave); | ||
2349 | } | ||
2318 | 2350 | ||
2319 | pm_runtime_put_sync(&pdev->dev); | 2351 | pm_runtime_put_sync(&pdev->dev); |
2320 | 2352 | ||
@@ -2328,14 +2360,24 @@ static int cpsw_resume(struct device *dev) | |||
2328 | { | 2360 | { |
2329 | struct platform_device *pdev = to_platform_device(dev); | 2361 | struct platform_device *pdev = to_platform_device(dev); |
2330 | struct net_device *ndev = platform_get_drvdata(pdev); | 2362 | struct net_device *ndev = platform_get_drvdata(pdev); |
2363 | struct cpsw_priv *priv = netdev_priv(ndev); | ||
2331 | 2364 | ||
2332 | pm_runtime_get_sync(&pdev->dev); | 2365 | pm_runtime_get_sync(&pdev->dev); |
2333 | 2366 | ||
2334 | /* Select default pin state */ | 2367 | /* Select default pin state */ |
2335 | pinctrl_pm_select_default_state(&pdev->dev); | 2368 | pinctrl_pm_select_default_state(&pdev->dev); |
2336 | 2369 | ||
2337 | if (netif_running(ndev)) | 2370 | if (priv->data.dual_emac) { |
2338 | cpsw_ndo_open(ndev); | 2371 | int i; |
2372 | |||
2373 | for (i = 0; i < priv->data.slaves; i++) { | ||
2374 | if (netif_running(priv->slaves[i].ndev)) | ||
2375 | cpsw_ndo_open(priv->slaves[i].ndev); | ||
2376 | } | ||
2377 | } else { | ||
2378 | if (netif_running(ndev)) | ||
2379 | cpsw_ndo_open(ndev); | ||
2380 | } | ||
2339 | return 0; | 2381 | return 0; |
2340 | } | 2382 | } |
2341 | 2383 | ||
diff --git a/drivers/net/fddi/skfp/h/skfbi.h b/drivers/net/fddi/skfp/h/skfbi.h index c1ba26c06d73..3de2f0d15fe2 100644 --- a/drivers/net/fddi/skfp/h/skfbi.h +++ b/drivers/net/fddi/skfp/h/skfbi.h | |||
@@ -147,11 +147,6 @@ | |||
147 | #define PCI_MEM64BIT (2<<1) /* Base addr anywhere in 64 Bit range */ | 147 | #define PCI_MEM64BIT (2<<1) /* Base addr anywhere in 64 Bit range */ |
148 | #define PCI_MEMSPACE 0x00000001L /* Bit 0: Memory Space Indic. */ | 148 | #define PCI_MEMSPACE 0x00000001L /* Bit 0: Memory Space Indic. */ |
149 | 149 | ||
150 | /* PCI_BASE_2ND 32 bit 2nd Base address */ | ||
151 | #define PCI_IOBASE 0xffffff00L /* Bit 31..8: I/O Base address */ | ||
152 | #define PCI_IOSIZE 0x000000fcL /* Bit 7..2: I/O Size Requirements */ | ||
153 | #define PCI_IOSPACE 0x00000001L /* Bit 0: I/O Space Indicator */ | ||
154 | |||
155 | /* PCI_SUB_VID 16 bit Subsystem Vendor ID */ | 150 | /* PCI_SUB_VID 16 bit Subsystem Vendor ID */ |
156 | /* PCI_SUB_ID 16 bit Subsystem ID */ | 151 | /* PCI_SUB_ID 16 bit Subsystem ID */ |
157 | 152 | ||
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 60e4ca01ccbb..726edabff26b 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/netpoll.h> | 36 | #include <linux/netpoll.h> |
37 | 37 | ||
38 | #define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE) | 38 | #define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE) |
39 | #define MACVLAN_BC_QUEUE_LEN 1000 | ||
39 | 40 | ||
40 | struct macvlan_port { | 41 | struct macvlan_port { |
41 | struct net_device *dev; | 42 | struct net_device *dev; |
@@ -248,7 +249,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port, | |||
248 | goto err; | 249 | goto err; |
249 | 250 | ||
250 | spin_lock(&port->bc_queue.lock); | 251 | spin_lock(&port->bc_queue.lock); |
251 | if (skb_queue_len(&port->bc_queue) < skb->dev->tx_queue_len) { | 252 | if (skb_queue_len(&port->bc_queue) < MACVLAN_BC_QUEUE_LEN) { |
252 | __skb_queue_tail(&port->bc_queue, nskb); | 253 | __skb_queue_tail(&port->bc_queue, nskb); |
253 | err = 0; | 254 | err = 0; |
254 | } | 255 | } |
@@ -739,7 +740,10 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], | |||
739 | struct macvlan_dev *vlan = netdev_priv(dev); | 740 | struct macvlan_dev *vlan = netdev_priv(dev); |
740 | int err = -EINVAL; | 741 | int err = -EINVAL; |
741 | 742 | ||
742 | if (!vlan->port->passthru) | 743 | /* Support unicast filter only on passthru devices. |
744 | * Multicast filter should be allowed on all devices. | ||
745 | */ | ||
746 | if (!vlan->port->passthru && is_unicast_ether_addr(addr)) | ||
743 | return -EOPNOTSUPP; | 747 | return -EOPNOTSUPP; |
744 | 748 | ||
745 | if (flags & NLM_F_REPLACE) | 749 | if (flags & NLM_F_REPLACE) |
@@ -760,7 +764,10 @@ static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], | |||
760 | struct macvlan_dev *vlan = netdev_priv(dev); | 764 | struct macvlan_dev *vlan = netdev_priv(dev); |
761 | int err = -EINVAL; | 765 | int err = -EINVAL; |
762 | 766 | ||
763 | if (!vlan->port->passthru) | 767 | /* Support unicast filter only on passthru devices. |
768 | * Multicast filter should be allowed on all devices. | ||
769 | */ | ||
770 | if (!vlan->port->passthru && is_unicast_ether_addr(addr)) | ||
764 | return -EOPNOTSUPP; | 771 | return -EOPNOTSUPP; |
765 | 772 | ||
766 | if (is_unicast_ether_addr(addr)) | 773 | if (is_unicast_ether_addr(addr)) |
@@ -800,6 +807,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev, | |||
800 | features, | 807 | features, |
801 | mask); | 808 | mask); |
802 | features |= ALWAYS_ON_FEATURES; | 809 | features |= ALWAYS_ON_FEATURES; |
810 | features &= ~NETIF_F_NETNS_LOCAL; | ||
803 | 811 | ||
804 | return features; | 812 | return features; |
805 | } | 813 | } |
diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c index 526b94cea569..fdce1ea28790 100644 --- a/drivers/net/phy/bcm7xxx.c +++ b/drivers/net/phy/bcm7xxx.c | |||
@@ -157,6 +157,23 @@ static int bcm7xxx_28nm_config_init(struct phy_device *phydev) | |||
157 | return bcm7xxx_28nm_afe_config_init(phydev); | 157 | return bcm7xxx_28nm_afe_config_init(phydev); |
158 | } | 158 | } |
159 | 159 | ||
160 | static int bcm7xxx_28nm_resume(struct phy_device *phydev) | ||
161 | { | ||
162 | int ret; | ||
163 | |||
164 | /* Re-apply workarounds coming out suspend/resume */ | ||
165 | ret = bcm7xxx_28nm_config_init(phydev); | ||
166 | if (ret) | ||
167 | return ret; | ||
168 | |||
169 | /* 28nm Gigabit PHYs come out of reset without any half-duplex | ||
170 | * or "hub" compliant advertised mode, fix that. This does not | ||
171 | * cause any problems with the PHY library since genphy_config_aneg() | ||
172 | * gracefully handles auto-negotiated and forced modes. | ||
173 | */ | ||
174 | return genphy_config_aneg(phydev); | ||
175 | } | ||
176 | |||
160 | static int phy_set_clr_bits(struct phy_device *dev, int location, | 177 | static int phy_set_clr_bits(struct phy_device *dev, int location, |
161 | int set_mask, int clr_mask) | 178 | int set_mask, int clr_mask) |
162 | { | 179 | { |
@@ -212,7 +229,7 @@ static int bcm7xxx_config_init(struct phy_device *phydev) | |||
212 | } | 229 | } |
213 | 230 | ||
214 | /* Workaround for putting the PHY in IDDQ mode, required | 231 | /* Workaround for putting the PHY in IDDQ mode, required |
215 | * for all BCM7XXX PHYs | 232 | * for all BCM7XXX 40nm and 65nm PHYs |
216 | */ | 233 | */ |
217 | static int bcm7xxx_suspend(struct phy_device *phydev) | 234 | static int bcm7xxx_suspend(struct phy_device *phydev) |
218 | { | 235 | { |
@@ -257,8 +274,7 @@ static struct phy_driver bcm7xxx_driver[] = { | |||
257 | .config_init = bcm7xxx_28nm_afe_config_init, | 274 | .config_init = bcm7xxx_28nm_afe_config_init, |
258 | .config_aneg = genphy_config_aneg, | 275 | .config_aneg = genphy_config_aneg, |
259 | .read_status = genphy_read_status, | 276 | .read_status = genphy_read_status, |
260 | .suspend = bcm7xxx_suspend, | 277 | .resume = bcm7xxx_28nm_resume, |
261 | .resume = bcm7xxx_28nm_afe_config_init, | ||
262 | .driver = { .owner = THIS_MODULE }, | 278 | .driver = { .owner = THIS_MODULE }, |
263 | }, { | 279 | }, { |
264 | .phy_id = PHY_ID_BCM7439, | 280 | .phy_id = PHY_ID_BCM7439, |
@@ -270,8 +286,7 @@ static struct phy_driver bcm7xxx_driver[] = { | |||
270 | .config_init = bcm7xxx_28nm_afe_config_init, | 286 | .config_init = bcm7xxx_28nm_afe_config_init, |
271 | .config_aneg = genphy_config_aneg, | 287 | .config_aneg = genphy_config_aneg, |
272 | .read_status = genphy_read_status, | 288 | .read_status = genphy_read_status, |
273 | .suspend = bcm7xxx_suspend, | 289 | .resume = bcm7xxx_28nm_resume, |
274 | .resume = bcm7xxx_28nm_afe_config_init, | ||
275 | .driver = { .owner = THIS_MODULE }, | 290 | .driver = { .owner = THIS_MODULE }, |
276 | }, { | 291 | }, { |
277 | .phy_id = PHY_ID_BCM7445, | 292 | .phy_id = PHY_ID_BCM7445, |
@@ -283,21 +298,7 @@ static struct phy_driver bcm7xxx_driver[] = { | |||
283 | .config_init = bcm7xxx_28nm_config_init, | 298 | .config_init = bcm7xxx_28nm_config_init, |
284 | .config_aneg = genphy_config_aneg, | 299 | .config_aneg = genphy_config_aneg, |
285 | .read_status = genphy_read_status, | 300 | .read_status = genphy_read_status, |
286 | .suspend = bcm7xxx_suspend, | 301 | .resume = bcm7xxx_28nm_afe_config_init, |
287 | .resume = bcm7xxx_28nm_config_init, | ||
288 | .driver = { .owner = THIS_MODULE }, | ||
289 | }, { | ||
290 | .name = "Broadcom BCM7XXX 28nm", | ||
291 | .phy_id = PHY_ID_BCM7XXX_28, | ||
292 | .phy_id_mask = PHY_BCM_OUI_MASK, | ||
293 | .features = PHY_GBIT_FEATURES | | ||
294 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, | ||
295 | .flags = PHY_IS_INTERNAL, | ||
296 | .config_init = bcm7xxx_28nm_config_init, | ||
297 | .config_aneg = genphy_config_aneg, | ||
298 | .read_status = genphy_read_status, | ||
299 | .suspend = bcm7xxx_suspend, | ||
300 | .resume = bcm7xxx_28nm_config_init, | ||
301 | .driver = { .owner = THIS_MODULE }, | 302 | .driver = { .owner = THIS_MODULE }, |
302 | }, { | 303 | }, { |
303 | .phy_id = PHY_BCM_OUI_4, | 304 | .phy_id = PHY_BCM_OUI_4, |
@@ -331,7 +332,6 @@ static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = { | |||
331 | { PHY_ID_BCM7366, 0xfffffff0, }, | 332 | { PHY_ID_BCM7366, 0xfffffff0, }, |
332 | { PHY_ID_BCM7439, 0xfffffff0, }, | 333 | { PHY_ID_BCM7439, 0xfffffff0, }, |
333 | { PHY_ID_BCM7445, 0xfffffff0, }, | 334 | { PHY_ID_BCM7445, 0xfffffff0, }, |
334 | { PHY_ID_BCM7XXX_28, 0xfffffc00 }, | ||
335 | { PHY_BCM_OUI_4, 0xffff0000 }, | 335 | { PHY_BCM_OUI_4, 0xffff0000 }, |
336 | { PHY_BCM_OUI_5, 0xffffff00 }, | 336 | { PHY_BCM_OUI_5, 0xffffff00 }, |
337 | { } | 337 | { } |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index fd0ea7c50ee6..011dbda2b2f1 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -592,8 +592,7 @@ static struct phy_driver ksphy_driver[] = { | |||
592 | .phy_id = PHY_ID_KSZ9031, | 592 | .phy_id = PHY_ID_KSZ9031, |
593 | .phy_id_mask = 0x00fffff0, | 593 | .phy_id_mask = 0x00fffff0, |
594 | .name = "Micrel KSZ9031 Gigabit PHY", | 594 | .name = "Micrel KSZ9031 Gigabit PHY", |
595 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | 595 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), |
596 | | SUPPORTED_Asym_Pause), | ||
597 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 596 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
598 | .config_init = ksz9031_config_init, | 597 | .config_init = ksz9031_config_init, |
599 | .config_aneg = genphy_config_aneg, | 598 | .config_aneg = genphy_config_aneg, |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c94e2a27446a..a854d38c231d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -1036,31 +1036,31 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1036 | /* First check if the EEE ability is supported */ | 1036 | /* First check if the EEE ability is supported */ |
1037 | eee_cap = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, | 1037 | eee_cap = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, |
1038 | MDIO_MMD_PCS, phydev->addr); | 1038 | MDIO_MMD_PCS, phydev->addr); |
1039 | if (eee_cap < 0) | 1039 | if (eee_cap <= 0) |
1040 | return eee_cap; | 1040 | goto eee_exit_err; |
1041 | 1041 | ||
1042 | cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); | 1042 | cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); |
1043 | if (!cap) | 1043 | if (!cap) |
1044 | return -EPROTONOSUPPORT; | 1044 | goto eee_exit_err; |
1045 | 1045 | ||
1046 | /* Check which link settings negotiated and verify it in | 1046 | /* Check which link settings negotiated and verify it in |
1047 | * the EEE advertising registers. | 1047 | * the EEE advertising registers. |
1048 | */ | 1048 | */ |
1049 | eee_lp = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_LPABLE, | 1049 | eee_lp = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_LPABLE, |
1050 | MDIO_MMD_AN, phydev->addr); | 1050 | MDIO_MMD_AN, phydev->addr); |
1051 | if (eee_lp < 0) | 1051 | if (eee_lp <= 0) |
1052 | return eee_lp; | 1052 | goto eee_exit_err; |
1053 | 1053 | ||
1054 | eee_adv = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV, | 1054 | eee_adv = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV, |
1055 | MDIO_MMD_AN, phydev->addr); | 1055 | MDIO_MMD_AN, phydev->addr); |
1056 | if (eee_adv < 0) | 1056 | if (eee_adv <= 0) |
1057 | return eee_adv; | 1057 | goto eee_exit_err; |
1058 | 1058 | ||
1059 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); | 1059 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); |
1060 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); | 1060 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); |
1061 | idx = phy_find_setting(phydev->speed, phydev->duplex); | 1061 | idx = phy_find_setting(phydev->speed, phydev->duplex); |
1062 | if (!(lp & adv & settings[idx].setting)) | 1062 | if (!(lp & adv & settings[idx].setting)) |
1063 | return -EPROTONOSUPPORT; | 1063 | goto eee_exit_err; |
1064 | 1064 | ||
1065 | if (clk_stop_enable) { | 1065 | if (clk_stop_enable) { |
1066 | /* Configure the PHY to stop receiving xMII | 1066 | /* Configure the PHY to stop receiving xMII |
@@ -1080,7 +1080,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1080 | 1080 | ||
1081 | return 0; /* EEE supported */ | 1081 | return 0; /* EEE supported */ |
1082 | } | 1082 | } |
1083 | 1083 | eee_exit_err: | |
1084 | return -EPROTONOSUPPORT; | 1084 | return -EPROTONOSUPPORT; |
1085 | } | 1085 | } |
1086 | EXPORT_SYMBOL(phy_init_eee); | 1086 | EXPORT_SYMBOL(phy_init_eee); |
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 180c49479c42..a4b08198fb9f 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
@@ -43,6 +43,22 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev) | |||
43 | 43 | ||
44 | static int smsc_phy_config_init(struct phy_device *phydev) | 44 | static int smsc_phy_config_init(struct phy_device *phydev) |
45 | { | 45 | { |
46 | int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); | ||
47 | |||
48 | if (rc < 0) | ||
49 | return rc; | ||
50 | |||
51 | /* Enable energy detect mode for this SMSC Transceivers */ | ||
52 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, | ||
53 | rc | MII_LAN83C185_EDPWRDOWN); | ||
54 | if (rc < 0) | ||
55 | return rc; | ||
56 | |||
57 | return smsc_phy_ack_interrupt(phydev); | ||
58 | } | ||
59 | |||
60 | static int smsc_phy_reset(struct phy_device *phydev) | ||
61 | { | ||
46 | int rc = phy_read(phydev, MII_LAN83C185_SPECIAL_MODES); | 62 | int rc = phy_read(phydev, MII_LAN83C185_SPECIAL_MODES); |
47 | if (rc < 0) | 63 | if (rc < 0) |
48 | return rc; | 64 | return rc; |
@@ -66,18 +82,7 @@ static int smsc_phy_config_init(struct phy_device *phydev) | |||
66 | rc = phy_read(phydev, MII_BMCR); | 82 | rc = phy_read(phydev, MII_BMCR); |
67 | } while (rc & BMCR_RESET); | 83 | } while (rc & BMCR_RESET); |
68 | } | 84 | } |
69 | 85 | return 0; | |
70 | rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); | ||
71 | if (rc < 0) | ||
72 | return rc; | ||
73 | |||
74 | /* Enable energy detect mode for this SMSC Transceivers */ | ||
75 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, | ||
76 | rc | MII_LAN83C185_EDPWRDOWN); | ||
77 | if (rc < 0) | ||
78 | return rc; | ||
79 | |||
80 | return smsc_phy_ack_interrupt (phydev); | ||
81 | } | 86 | } |
82 | 87 | ||
83 | static int lan911x_config_init(struct phy_device *phydev) | 88 | static int lan911x_config_init(struct phy_device *phydev) |
@@ -142,6 +147,7 @@ static struct phy_driver smsc_phy_driver[] = { | |||
142 | .config_aneg = genphy_config_aneg, | 147 | .config_aneg = genphy_config_aneg, |
143 | .read_status = genphy_read_status, | 148 | .read_status = genphy_read_status, |
144 | .config_init = smsc_phy_config_init, | 149 | .config_init = smsc_phy_config_init, |
150 | .soft_reset = smsc_phy_reset, | ||
145 | 151 | ||
146 | /* IRQ related */ | 152 | /* IRQ related */ |
147 | .ack_interrupt = smsc_phy_ack_interrupt, | 153 | .ack_interrupt = smsc_phy_ack_interrupt, |
@@ -164,6 +170,7 @@ static struct phy_driver smsc_phy_driver[] = { | |||
164 | .config_aneg = genphy_config_aneg, | 170 | .config_aneg = genphy_config_aneg, |
165 | .read_status = genphy_read_status, | 171 | .read_status = genphy_read_status, |
166 | .config_init = smsc_phy_config_init, | 172 | .config_init = smsc_phy_config_init, |
173 | .soft_reset = smsc_phy_reset, | ||
167 | 174 | ||
168 | /* IRQ related */ | 175 | /* IRQ related */ |
169 | .ack_interrupt = smsc_phy_ack_interrupt, | 176 | .ack_interrupt = smsc_phy_ack_interrupt, |
@@ -186,6 +193,7 @@ static struct phy_driver smsc_phy_driver[] = { | |||
186 | .config_aneg = genphy_config_aneg, | 193 | .config_aneg = genphy_config_aneg, |
187 | .read_status = genphy_read_status, | 194 | .read_status = genphy_read_status, |
188 | .config_init = smsc_phy_config_init, | 195 | .config_init = smsc_phy_config_init, |
196 | .soft_reset = smsc_phy_reset, | ||
189 | 197 | ||
190 | /* IRQ related */ | 198 | /* IRQ related */ |
191 | .ack_interrupt = smsc_phy_ack_interrupt, | 199 | .ack_interrupt = smsc_phy_ack_interrupt, |
@@ -230,6 +238,7 @@ static struct phy_driver smsc_phy_driver[] = { | |||
230 | .config_aneg = genphy_config_aneg, | 238 | .config_aneg = genphy_config_aneg, |
231 | .read_status = lan87xx_read_status, | 239 | .read_status = lan87xx_read_status, |
232 | .config_init = smsc_phy_config_init, | 240 | .config_init = smsc_phy_config_init, |
241 | .soft_reset = smsc_phy_reset, | ||
233 | 242 | ||
234 | /* IRQ related */ | 243 | /* IRQ related */ |
235 | .ack_interrupt = smsc_phy_ack_interrupt, | 244 | .ack_interrupt = smsc_phy_ack_interrupt, |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 87f710476217..74760e8143e3 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -2019,7 +2019,7 @@ static int rtl8153_enable(struct r8152 *tp) | |||
2019 | return rtl_enable(tp); | 2019 | return rtl_enable(tp); |
2020 | } | 2020 | } |
2021 | 2021 | ||
2022 | static void rtl8152_disable(struct r8152 *tp) | 2022 | static void rtl_disable(struct r8152 *tp) |
2023 | { | 2023 | { |
2024 | u32 ocp_data; | 2024 | u32 ocp_data; |
2025 | int i; | 2025 | int i; |
@@ -2232,6 +2232,13 @@ static inline void r8152b_enable_aldps(struct r8152 *tp) | |||
2232 | LINKENA | DIS_SDSAVE); | 2232 | LINKENA | DIS_SDSAVE); |
2233 | } | 2233 | } |
2234 | 2234 | ||
2235 | static void rtl8152_disable(struct r8152 *tp) | ||
2236 | { | ||
2237 | r8152b_disable_aldps(tp); | ||
2238 | rtl_disable(tp); | ||
2239 | r8152b_enable_aldps(tp); | ||
2240 | } | ||
2241 | |||
2235 | static void r8152b_hw_phy_cfg(struct r8152 *tp) | 2242 | static void r8152b_hw_phy_cfg(struct r8152 *tp) |
2236 | { | 2243 | { |
2237 | u16 data; | 2244 | u16 data; |
@@ -2242,11 +2249,8 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp) | |||
2242 | r8152_mdio_write(tp, MII_BMCR, data); | 2249 | r8152_mdio_write(tp, MII_BMCR, data); |
2243 | } | 2250 | } |
2244 | 2251 | ||
2245 | r8152b_disable_aldps(tp); | ||
2246 | |||
2247 | rtl_clear_bp(tp); | 2252 | rtl_clear_bp(tp); |
2248 | 2253 | ||
2249 | r8152b_enable_aldps(tp); | ||
2250 | set_bit(PHY_RESET, &tp->flags); | 2254 | set_bit(PHY_RESET, &tp->flags); |
2251 | } | 2255 | } |
2252 | 2256 | ||
@@ -2255,9 +2259,6 @@ static void r8152b_exit_oob(struct r8152 *tp) | |||
2255 | u32 ocp_data; | 2259 | u32 ocp_data; |
2256 | int i; | 2260 | int i; |
2257 | 2261 | ||
2258 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2259 | return; | ||
2260 | |||
2261 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); | 2262 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); |
2262 | ocp_data &= ~RCR_ACPT_ALL; | 2263 | ocp_data &= ~RCR_ACPT_ALL; |
2263 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); | 2264 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); |
@@ -2347,7 +2348,7 @@ static void r8152b_enter_oob(struct r8152 *tp) | |||
2347 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB); | 2348 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB); |
2348 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB); | 2349 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB); |
2349 | 2350 | ||
2350 | rtl8152_disable(tp); | 2351 | rtl_disable(tp); |
2351 | 2352 | ||
2352 | for (i = 0; i < 1000; i++) { | 2353 | for (i = 0; i < 1000; i++) { |
2353 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2354 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
@@ -2485,9 +2486,6 @@ static void r8153_first_init(struct r8152 *tp) | |||
2485 | u32 ocp_data; | 2486 | u32 ocp_data; |
2486 | int i; | 2487 | int i; |
2487 | 2488 | ||
2488 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2489 | return; | ||
2490 | |||
2491 | rxdy_gated_en(tp, true); | 2489 | rxdy_gated_en(tp, true); |
2492 | r8153_teredo_off(tp); | 2490 | r8153_teredo_off(tp); |
2493 | 2491 | ||
@@ -2560,7 +2558,7 @@ static void r8153_enter_oob(struct r8152 *tp) | |||
2560 | ocp_data &= ~NOW_IS_OOB; | 2558 | ocp_data &= ~NOW_IS_OOB; |
2561 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); | 2559 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); |
2562 | 2560 | ||
2563 | rtl8152_disable(tp); | 2561 | rtl_disable(tp); |
2564 | 2562 | ||
2565 | for (i = 0; i < 1000; i++) { | 2563 | for (i = 0; i < 1000; i++) { |
2566 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2564 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
@@ -2624,6 +2622,13 @@ static void r8153_enable_aldps(struct r8152 *tp) | |||
2624 | ocp_reg_write(tp, OCP_POWER_CFG, data); | 2622 | ocp_reg_write(tp, OCP_POWER_CFG, data); |
2625 | } | 2623 | } |
2626 | 2624 | ||
2625 | static void rtl8153_disable(struct r8152 *tp) | ||
2626 | { | ||
2627 | r8153_disable_aldps(tp); | ||
2628 | rtl_disable(tp); | ||
2629 | r8153_enable_aldps(tp); | ||
2630 | } | ||
2631 | |||
2627 | static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) | 2632 | static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) |
2628 | { | 2633 | { |
2629 | u16 bmcr, anar, gbcr; | 2634 | u16 bmcr, anar, gbcr; |
@@ -2714,6 +2719,16 @@ out: | |||
2714 | return ret; | 2719 | return ret; |
2715 | } | 2720 | } |
2716 | 2721 | ||
2722 | static void rtl8152_up(struct r8152 *tp) | ||
2723 | { | ||
2724 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2725 | return; | ||
2726 | |||
2727 | r8152b_disable_aldps(tp); | ||
2728 | r8152b_exit_oob(tp); | ||
2729 | r8152b_enable_aldps(tp); | ||
2730 | } | ||
2731 | |||
2717 | static void rtl8152_down(struct r8152 *tp) | 2732 | static void rtl8152_down(struct r8152 *tp) |
2718 | { | 2733 | { |
2719 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { | 2734 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { |
@@ -2727,6 +2742,16 @@ static void rtl8152_down(struct r8152 *tp) | |||
2727 | r8152b_enable_aldps(tp); | 2742 | r8152b_enable_aldps(tp); |
2728 | } | 2743 | } |
2729 | 2744 | ||
2745 | static void rtl8153_up(struct r8152 *tp) | ||
2746 | { | ||
2747 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2748 | return; | ||
2749 | |||
2750 | r8153_disable_aldps(tp); | ||
2751 | r8153_first_init(tp); | ||
2752 | r8153_enable_aldps(tp); | ||
2753 | } | ||
2754 | |||
2730 | static void rtl8153_down(struct r8152 *tp) | 2755 | static void rtl8153_down(struct r8152 *tp) |
2731 | { | 2756 | { |
2732 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { | 2757 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { |
@@ -2946,6 +2971,8 @@ static void r8152b_init(struct r8152 *tp) | |||
2946 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 2971 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
2947 | return; | 2972 | return; |
2948 | 2973 | ||
2974 | r8152b_disable_aldps(tp); | ||
2975 | |||
2949 | if (tp->version == RTL_VER_01) { | 2976 | if (tp->version == RTL_VER_01) { |
2950 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); | 2977 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); |
2951 | ocp_data &= ~LED_MODE_MASK; | 2978 | ocp_data &= ~LED_MODE_MASK; |
@@ -2984,6 +3011,7 @@ static void r8153_init(struct r8152 *tp) | |||
2984 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3011 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
2985 | return; | 3012 | return; |
2986 | 3013 | ||
3014 | r8153_disable_aldps(tp); | ||
2987 | r8153_u1u2en(tp, false); | 3015 | r8153_u1u2en(tp, false); |
2988 | 3016 | ||
2989 | for (i = 0; i < 500; i++) { | 3017 | for (i = 0; i < 500; i++) { |
@@ -3392,7 +3420,7 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3392 | ops->init = r8152b_init; | 3420 | ops->init = r8152b_init; |
3393 | ops->enable = rtl8152_enable; | 3421 | ops->enable = rtl8152_enable; |
3394 | ops->disable = rtl8152_disable; | 3422 | ops->disable = rtl8152_disable; |
3395 | ops->up = r8152b_exit_oob; | 3423 | ops->up = rtl8152_up; |
3396 | ops->down = rtl8152_down; | 3424 | ops->down = rtl8152_down; |
3397 | ops->unload = rtl8152_unload; | 3425 | ops->unload = rtl8152_unload; |
3398 | ret = 0; | 3426 | ret = 0; |
@@ -3400,8 +3428,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3400 | case PRODUCT_ID_RTL8153: | 3428 | case PRODUCT_ID_RTL8153: |
3401 | ops->init = r8153_init; | 3429 | ops->init = r8153_init; |
3402 | ops->enable = rtl8153_enable; | 3430 | ops->enable = rtl8153_enable; |
3403 | ops->disable = rtl8152_disable; | 3431 | ops->disable = rtl8153_disable; |
3404 | ops->up = r8153_first_init; | 3432 | ops->up = rtl8153_up; |
3405 | ops->down = rtl8153_down; | 3433 | ops->down = rtl8153_down; |
3406 | ops->unload = rtl8153_unload; | 3434 | ops->unload = rtl8153_unload; |
3407 | ret = 0; | 3435 | ret = 0; |
@@ -3416,8 +3444,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3416 | case PRODUCT_ID_SAMSUNG: | 3444 | case PRODUCT_ID_SAMSUNG: |
3417 | ops->init = r8153_init; | 3445 | ops->init = r8153_init; |
3418 | ops->enable = rtl8153_enable; | 3446 | ops->enable = rtl8153_enable; |
3419 | ops->disable = rtl8152_disable; | 3447 | ops->disable = rtl8153_disable; |
3420 | ops->up = r8153_first_init; | 3448 | ops->up = rtl8153_up; |
3421 | ops->down = rtl8153_down; | 3449 | ops->down = rtl8153_down; |
3422 | ops->unload = rtl8153_unload; | 3450 | ops->unload = rtl8153_unload; |
3423 | ret = 0; | 3451 | ret = 0; |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index d6e90c72c257..6dfcbf523936 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2056,7 +2056,6 @@ vmxnet3_set_mc(struct net_device *netdev) | |||
2056 | if (!netdev_mc_empty(netdev)) { | 2056 | if (!netdev_mc_empty(netdev)) { |
2057 | new_table = vmxnet3_copy_mc(netdev); | 2057 | new_table = vmxnet3_copy_mc(netdev); |
2058 | if (new_table) { | 2058 | if (new_table) { |
2059 | new_mode |= VMXNET3_RXM_MCAST; | ||
2060 | rxConf->mfTableLen = cpu_to_le16( | 2059 | rxConf->mfTableLen = cpu_to_le16( |
2061 | netdev_mc_count(netdev) * ETH_ALEN); | 2060 | netdev_mc_count(netdev) * ETH_ALEN); |
2062 | new_table_pa = dma_map_single( | 2061 | new_table_pa = dma_map_single( |
@@ -2064,15 +2063,18 @@ vmxnet3_set_mc(struct net_device *netdev) | |||
2064 | new_table, | 2063 | new_table, |
2065 | rxConf->mfTableLen, | 2064 | rxConf->mfTableLen, |
2066 | PCI_DMA_TODEVICE); | 2065 | PCI_DMA_TODEVICE); |
2066 | } | ||
2067 | |||
2068 | if (new_table_pa) { | ||
2069 | new_mode |= VMXNET3_RXM_MCAST; | ||
2067 | rxConf->mfTablePA = cpu_to_le64(new_table_pa); | 2070 | rxConf->mfTablePA = cpu_to_le64(new_table_pa); |
2068 | } else { | 2071 | } else { |
2069 | netdev_info(netdev, "failed to copy mcast list" | 2072 | netdev_info(netdev, |
2070 | ", setting ALL_MULTI\n"); | 2073 | "failed to copy mcast list, setting ALL_MULTI\n"); |
2071 | new_mode |= VMXNET3_RXM_ALL_MULTI; | 2074 | new_mode |= VMXNET3_RXM_ALL_MULTI; |
2072 | } | 2075 | } |
2073 | } | 2076 | } |
2074 | 2077 | ||
2075 | |||
2076 | if (!(new_mode & VMXNET3_RXM_MCAST)) { | 2078 | if (!(new_mode & VMXNET3_RXM_MCAST)) { |
2077 | rxConf->mfTableLen = 0; | 2079 | rxConf->mfTableLen = 0; |
2078 | rxConf->mfTablePA = 0; | 2080 | rxConf->mfTablePA = 0; |
@@ -2091,11 +2093,10 @@ vmxnet3_set_mc(struct net_device *netdev) | |||
2091 | VMXNET3_CMD_UPDATE_MAC_FILTERS); | 2093 | VMXNET3_CMD_UPDATE_MAC_FILTERS); |
2092 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); | 2094 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
2093 | 2095 | ||
2094 | if (new_table) { | 2096 | if (new_table_pa) |
2095 | dma_unmap_single(&adapter->pdev->dev, new_table_pa, | 2097 | dma_unmap_single(&adapter->pdev->dev, new_table_pa, |
2096 | rxConf->mfTableLen, PCI_DMA_TODEVICE); | 2098 | rxConf->mfTableLen, PCI_DMA_TODEVICE); |
2097 | kfree(new_table); | 2099 | kfree(new_table); |
2098 | } | ||
2099 | } | 2100 | } |
2100 | 2101 | ||
2101 | void | 2102 | void |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 29ee77f2c97f..3759479f959a 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -69,10 +69,10 @@ | |||
69 | /* | 69 | /* |
70 | * Version numbers | 70 | * Version numbers |
71 | */ | 71 | */ |
72 | #define VMXNET3_DRIVER_VERSION_STRING "1.2.0.0-k" | 72 | #define VMXNET3_DRIVER_VERSION_STRING "1.2.1.0-k" |
73 | 73 | ||
74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | 74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01020000 | 75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01020100 |
76 | 76 | ||
77 | #if defined(CONFIG_PCI_MSI) | 77 | #if defined(CONFIG_PCI_MSI) |
78 | /* RSS only makes sense if MSI-X is supported. */ | 78 | /* RSS only makes sense if MSI-X is supported. */ |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1fb7b37d1402..beb377b2d4b7 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -1327,7 +1327,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb) | |||
1327 | } else if (vxlan->flags & VXLAN_F_L3MISS) { | 1327 | } else if (vxlan->flags & VXLAN_F_L3MISS) { |
1328 | union vxlan_addr ipa = { | 1328 | union vxlan_addr ipa = { |
1329 | .sin.sin_addr.s_addr = tip, | 1329 | .sin.sin_addr.s_addr = tip, |
1330 | .sa.sa_family = AF_INET, | 1330 | .sin.sin_family = AF_INET, |
1331 | }; | 1331 | }; |
1332 | 1332 | ||
1333 | vxlan_ip_miss(dev, &ipa); | 1333 | vxlan_ip_miss(dev, &ipa); |
@@ -1488,7 +1488,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) | |||
1488 | } else if (vxlan->flags & VXLAN_F_L3MISS) { | 1488 | } else if (vxlan->flags & VXLAN_F_L3MISS) { |
1489 | union vxlan_addr ipa = { | 1489 | union vxlan_addr ipa = { |
1490 | .sin6.sin6_addr = msg->target, | 1490 | .sin6.sin6_addr = msg->target, |
1491 | .sa.sa_family = AF_INET6, | 1491 | .sin6.sin6_family = AF_INET6, |
1492 | }; | 1492 | }; |
1493 | 1493 | ||
1494 | vxlan_ip_miss(dev, &ipa); | 1494 | vxlan_ip_miss(dev, &ipa); |
@@ -1521,7 +1521,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) | |||
1521 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { | 1521 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { |
1522 | union vxlan_addr ipa = { | 1522 | union vxlan_addr ipa = { |
1523 | .sin.sin_addr.s_addr = pip->daddr, | 1523 | .sin.sin_addr.s_addr = pip->daddr, |
1524 | .sa.sa_family = AF_INET, | 1524 | .sin.sin_family = AF_INET, |
1525 | }; | 1525 | }; |
1526 | 1526 | ||
1527 | vxlan_ip_miss(dev, &ipa); | 1527 | vxlan_ip_miss(dev, &ipa); |
@@ -1542,7 +1542,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) | |||
1542 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { | 1542 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { |
1543 | union vxlan_addr ipa = { | 1543 | union vxlan_addr ipa = { |
1544 | .sin6.sin6_addr = pip6->daddr, | 1544 | .sin6.sin6_addr = pip6->daddr, |
1545 | .sa.sa_family = AF_INET6, | 1545 | .sin6.sin6_family = AF_INET6, |
1546 | }; | 1546 | }; |
1547 | 1547 | ||
1548 | vxlan_ip_miss(dev, &ipa); | 1548 | vxlan_ip_miss(dev, &ipa); |
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 334c2ece855a..da92bfa76b7c 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -2423,8 +2423,6 @@ static void at76_delete_device(struct at76_priv *priv) | |||
2423 | 2423 | ||
2424 | kfree_skb(priv->rx_skb); | 2424 | kfree_skb(priv->rx_skb); |
2425 | 2425 | ||
2426 | usb_put_dev(priv->udev); | ||
2427 | |||
2428 | at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", | 2426 | at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", |
2429 | __func__); | 2427 | __func__); |
2430 | ieee80211_free_hw(priv->hw); | 2428 | ieee80211_free_hw(priv->hw); |
@@ -2558,6 +2556,7 @@ static void at76_disconnect(struct usb_interface *interface) | |||
2558 | 2556 | ||
2559 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); | 2557 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); |
2560 | at76_delete_device(priv); | 2558 | at76_delete_device(priv); |
2559 | usb_put_dev(priv->udev); | ||
2561 | dev_info(&interface->dev, "disconnected\n"); | 2560 | dev_info(&interface->dev, "disconnected\n"); |
2562 | } | 2561 | } |
2563 | 2562 | ||
diff --git a/drivers/net/wireless/ath/ath9k/common-beacon.c b/drivers/net/wireless/ath/ath9k/common-beacon.c index 733be5178481..6ad44470d0f2 100644 --- a/drivers/net/wireless/ath/ath9k/common-beacon.c +++ b/drivers/net/wireless/ath/ath9k/common-beacon.c | |||
@@ -57,7 +57,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
57 | struct ath9k_beacon_state *bs) | 57 | struct ath9k_beacon_state *bs) |
58 | { | 58 | { |
59 | struct ath_common *common = ath9k_hw_common(ah); | 59 | struct ath_common *common = ath9k_hw_common(ah); |
60 | int dtim_intval, sleepduration; | 60 | int dtim_intval; |
61 | u64 tsf; | 61 | u64 tsf; |
62 | 62 | ||
63 | /* No need to configure beacon if we are not associated */ | 63 | /* No need to configure beacon if we are not associated */ |
@@ -75,7 +75,6 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
75 | * last beacon we received (which may be none). | 75 | * last beacon we received (which may be none). |
76 | */ | 76 | */ |
77 | dtim_intval = conf->intval * conf->dtim_period; | 77 | dtim_intval = conf->intval * conf->dtim_period; |
78 | sleepduration = ah->hw->conf.listen_interval * conf->intval; | ||
79 | 78 | ||
80 | /* | 79 | /* |
81 | * Pull nexttbtt forward to reflect the current | 80 | * Pull nexttbtt forward to reflect the current |
@@ -113,7 +112,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
113 | */ | 112 | */ |
114 | 113 | ||
115 | bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100), | 114 | bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100), |
116 | sleepduration)); | 115 | conf->intval)); |
117 | if (bs->bs_sleepduration > bs->bs_dtimperiod) | 116 | if (bs->bs_sleepduration > bs->bs_dtimperiod) |
118 | bs->bs_sleepduration = bs->bs_dtimperiod; | 117 | bs->bs_sleepduration = bs->bs_dtimperiod; |
119 | 118 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index bb86eb2ffc95..f0484b1b617e 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -978,7 +978,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
978 | struct ath_hw *ah = common->ah; | 978 | struct ath_hw *ah = common->ah; |
979 | struct ath_htc_rx_status *rxstatus; | 979 | struct ath_htc_rx_status *rxstatus; |
980 | struct ath_rx_status rx_stats; | 980 | struct ath_rx_status rx_stats; |
981 | bool decrypt_error; | 981 | bool decrypt_error = false; |
982 | 982 | ||
983 | if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { | 983 | if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { |
984 | ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", | 984 | ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index e6ac8d2e610c..4b148bbb2bf6 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -513,7 +513,7 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
513 | * touch anything. Note this can happen early | 513 | * touch anything. Note this can happen early |
514 | * on if the IRQ is shared. | 514 | * on if the IRQ is shared. |
515 | */ | 515 | */ |
516 | if (test_bit(ATH_OP_INVALID, &common->op_flags)) | 516 | if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags)) |
517 | return IRQ_NONE; | 517 | return IRQ_NONE; |
518 | 518 | ||
519 | /* shared irq, not for us */ | 519 | /* shared irq, not for us */ |
diff --git a/drivers/net/wireless/ath/ath9k/spectral.c b/drivers/net/wireless/ath/ath9k/spectral.c index 5fe29b9f8fa2..8f68426ca653 100644 --- a/drivers/net/wireless/ath/ath9k/spectral.c +++ b/drivers/net/wireless/ath/ath9k/spectral.c | |||
@@ -253,7 +253,7 @@ static ssize_t write_file_spec_scan_ctl(struct file *file, | |||
253 | 253 | ||
254 | if (strncmp("trigger", buf, 7) == 0) { | 254 | if (strncmp("trigger", buf, 7) == 0) { |
255 | ath9k_spectral_scan_trigger(sc->hw); | 255 | ath9k_spectral_scan_trigger(sc->hw); |
256 | } else if (strncmp("background", buf, 9) == 0) { | 256 | } else if (strncmp("background", buf, 10) == 0) { |
257 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_BACKGROUND); | 257 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_BACKGROUND); |
258 | ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); | 258 | ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); |
259 | } else if (strncmp("chanscan", buf, 8) == 0) { | 259 | } else if (strncmp("chanscan", buf, 8) == 0) { |
diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig index b8e2561ea645..fe3dc126b149 100644 --- a/drivers/net/wireless/brcm80211/Kconfig +++ b/drivers/net/wireless/brcm80211/Kconfig | |||
@@ -27,10 +27,17 @@ config BRCMFMAC | |||
27 | one of the bus interface support. If you choose to build a module, | 27 | one of the bus interface support. If you choose to build a module, |
28 | it'll be called brcmfmac.ko. | 28 | it'll be called brcmfmac.ko. |
29 | 29 | ||
30 | config BRCMFMAC_PROTO_BCDC | ||
31 | bool | ||
32 | |||
33 | config BRCMFMAC_PROTO_MSGBUF | ||
34 | bool | ||
35 | |||
30 | config BRCMFMAC_SDIO | 36 | config BRCMFMAC_SDIO |
31 | bool "SDIO bus interface support for FullMAC driver" | 37 | bool "SDIO bus interface support for FullMAC driver" |
32 | depends on (MMC = y || MMC = BRCMFMAC) | 38 | depends on (MMC = y || MMC = BRCMFMAC) |
33 | depends on BRCMFMAC | 39 | depends on BRCMFMAC |
40 | select BRCMFMAC_PROTO_BCDC | ||
34 | select FW_LOADER | 41 | select FW_LOADER |
35 | default y | 42 | default y |
36 | ---help--- | 43 | ---help--- |
@@ -42,6 +49,7 @@ config BRCMFMAC_USB | |||
42 | bool "USB bus interface support for FullMAC driver" | 49 | bool "USB bus interface support for FullMAC driver" |
43 | depends on (USB = y || USB = BRCMFMAC) | 50 | depends on (USB = y || USB = BRCMFMAC) |
44 | depends on BRCMFMAC | 51 | depends on BRCMFMAC |
52 | select BRCMFMAC_PROTO_BCDC | ||
45 | select FW_LOADER | 53 | select FW_LOADER |
46 | ---help--- | 54 | ---help--- |
47 | This option enables the USB bus interface support for Broadcom | 55 | This option enables the USB bus interface support for Broadcom |
@@ -52,6 +60,8 @@ config BRCMFMAC_PCIE | |||
52 | bool "PCIE bus interface support for FullMAC driver" | 60 | bool "PCIE bus interface support for FullMAC driver" |
53 | depends on BRCMFMAC | 61 | depends on BRCMFMAC |
54 | depends on PCI | 62 | depends on PCI |
63 | depends on HAS_DMA | ||
64 | select BRCMFMAC_PROTO_MSGBUF | ||
55 | select FW_LOADER | 65 | select FW_LOADER |
56 | ---help--- | 66 | ---help--- |
57 | This option enables the PCIE bus interface support for Broadcom | 67 | This option enables the PCIE bus interface support for Broadcom |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/brcm80211/brcmfmac/Makefile index c35adf4bc70b..90a977fe9a64 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile +++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile | |||
@@ -30,16 +30,18 @@ brcmfmac-objs += \ | |||
30 | fwsignal.o \ | 30 | fwsignal.o \ |
31 | p2p.o \ | 31 | p2p.o \ |
32 | proto.o \ | 32 | proto.o \ |
33 | bcdc.o \ | ||
34 | commonring.o \ | ||
35 | flowring.o \ | ||
36 | msgbuf.o \ | ||
37 | dhd_common.o \ | 33 | dhd_common.o \ |
38 | dhd_linux.o \ | 34 | dhd_linux.o \ |
39 | firmware.o \ | 35 | firmware.o \ |
40 | feature.o \ | 36 | feature.o \ |
41 | btcoex.o \ | 37 | btcoex.o \ |
42 | vendor.o | 38 | vendor.o |
39 | brcmfmac-$(CONFIG_BRCMFMAC_PROTO_BCDC) += \ | ||
40 | bcdc.o | ||
41 | brcmfmac-$(CONFIG_BRCMFMAC_PROTO_MSGBUF) += \ | ||
42 | commonring.o \ | ||
43 | flowring.o \ | ||
44 | msgbuf.o | ||
43 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ | 45 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ |
44 | dhd_sdio.o \ | 46 | dhd_sdio.o \ |
45 | bcmsdh.o | 47 | bcmsdh.o |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h index 17e8c039ff32..6003179c0ceb 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h | |||
@@ -16,9 +16,12 @@ | |||
16 | #ifndef BRCMFMAC_BCDC_H | 16 | #ifndef BRCMFMAC_BCDC_H |
17 | #define BRCMFMAC_BCDC_H | 17 | #define BRCMFMAC_BCDC_H |
18 | 18 | ||
19 | 19 | #ifdef CONFIG_BRCMFMAC_PROTO_BCDC | |
20 | int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); | 20 | int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); |
21 | void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); | 21 | void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); |
22 | 22 | #else | |
23 | static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } | ||
24 | static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} | ||
25 | #endif | ||
23 | 26 | ||
24 | #endif /* BRCMFMAC_BCDC_H */ | 27 | #endif /* BRCMFMAC_BCDC_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 4f1daabc551b..44fc85f68f7a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c | |||
@@ -185,7 +185,13 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, | 185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, |
186 | ifevent->flags, ifevent->role); | 186 | ifevent->flags, ifevent->role); |
187 | 187 | ||
188 | if (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) { | 188 | /* The P2P Device interface event must not be ignored |
189 | * contrary to what firmware tells us. The only way to | ||
190 | * distinguish the P2P Device is by looking at the ifidx | ||
191 | * and bssidx received. | ||
192 | */ | ||
193 | if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) && | ||
194 | (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) { | ||
189 | brcmf_dbg(EVENT, "event can be ignored\n"); | 195 | brcmf_dbg(EVENT, "event can be ignored\n"); |
190 | return; | 196 | return; |
191 | } | 197 | } |
@@ -210,12 +216,12 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
210 | return; | 216 | return; |
211 | } | 217 | } |
212 | 218 | ||
213 | if (ifevent->action == BRCMF_E_IF_CHANGE) | 219 | if (ifp && ifevent->action == BRCMF_E_IF_CHANGE) |
214 | brcmf_fws_reset_interface(ifp); | 220 | brcmf_fws_reset_interface(ifp); |
215 | 221 | ||
216 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); | 222 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); |
217 | 223 | ||
218 | if (ifevent->action == BRCMF_E_IF_DEL) { | 224 | if (ifp && ifevent->action == BRCMF_E_IF_DEL) { |
219 | brcmf_fws_del_interface(ifp); | 225 | brcmf_fws_del_interface(ifp); |
220 | brcmf_del_if(drvr, ifevent->bssidx); | 226 | brcmf_del_if(drvr, ifevent->bssidx); |
221 | } | 227 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h index dd20b1862d44..cbf033f59109 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h | |||
@@ -172,6 +172,8 @@ enum brcmf_fweh_event_code { | |||
172 | #define BRCMF_E_IF_ROLE_STA 0 | 172 | #define BRCMF_E_IF_ROLE_STA 0 |
173 | #define BRCMF_E_IF_ROLE_AP 1 | 173 | #define BRCMF_E_IF_ROLE_AP 1 |
174 | #define BRCMF_E_IF_ROLE_WDS 2 | 174 | #define BRCMF_E_IF_ROLE_WDS 2 |
175 | #define BRCMF_E_IF_ROLE_P2P_GO 3 | ||
176 | #define BRCMF_E_IF_ROLE_P2P_CLIENT 4 | ||
175 | 177 | ||
176 | /** | 178 | /** |
177 | * definitions for event packet validation. | 179 | * definitions for event packet validation. |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h index f901ae52bf2b..77a51b8c1e12 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #ifndef BRCMFMAC_MSGBUF_H | 15 | #ifndef BRCMFMAC_MSGBUF_H |
16 | #define BRCMFMAC_MSGBUF_H | 16 | #define BRCMFMAC_MSGBUF_H |
17 | 17 | ||
18 | #ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF | ||
18 | 19 | ||
19 | #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20 | 20 | #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20 |
20 | #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256 | 21 | #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256 |
@@ -32,9 +33,15 @@ | |||
32 | 33 | ||
33 | 34 | ||
34 | int brcmf_proto_msgbuf_rx_trigger(struct device *dev); | 35 | int brcmf_proto_msgbuf_rx_trigger(struct device *dev); |
36 | void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); | ||
35 | int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); | 37 | int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); |
36 | void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); | 38 | void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); |
37 | void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); | 39 | #else |
38 | 40 | static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) | |
41 | { | ||
42 | return 0; | ||
43 | } | ||
44 | static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {} | ||
45 | #endif | ||
39 | 46 | ||
40 | #endif /* BRCMFMAC_MSGBUF_H */ | 47 | #endif /* BRCMFMAC_MSGBUF_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 02fe706fc9ec..16a246bfc343 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -497,8 +497,11 @@ brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable) | |||
497 | static void | 497 | static void |
498 | brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) | 498 | brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) |
499 | { | 499 | { |
500 | struct net_device *ndev = wdev->netdev; | 500 | struct brcmf_cfg80211_vif *vif; |
501 | struct brcmf_if *ifp = netdev_priv(ndev); | 501 | struct brcmf_if *ifp; |
502 | |||
503 | vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); | ||
504 | ifp = vif->ifp; | ||
502 | 505 | ||
503 | if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || | 506 | if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || |
504 | (wdev->iftype == NL80211_IFTYPE_AP) || | 507 | (wdev->iftype == NL80211_IFTYPE_AP) || |
@@ -4918,7 +4921,7 @@ static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg, | |||
4918 | struct brcmu_chan ch; | 4921 | struct brcmu_chan ch; |
4919 | int i; | 4922 | int i; |
4920 | 4923 | ||
4921 | for (i = 0; i <= total; i++) { | 4924 | for (i = 0; i < total; i++) { |
4922 | ch.chspec = (u16)le32_to_cpu(chlist->element[i]); | 4925 | ch.chspec = (u16)le32_to_cpu(chlist->element[i]); |
4923 | cfg->d11inf.decchspec(&ch); | 4926 | cfg->d11inf.decchspec(&ch); |
4924 | 4927 | ||
@@ -5143,6 +5146,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) | |||
5143 | 5146 | ||
5144 | ch.band = BRCMU_CHAN_BAND_2G; | 5147 | ch.band = BRCMU_CHAN_BAND_2G; |
5145 | ch.bw = BRCMU_CHAN_BW_40; | 5148 | ch.bw = BRCMU_CHAN_BW_40; |
5149 | ch.sb = BRCMU_CHAN_SB_NONE; | ||
5146 | ch.chnum = 0; | 5150 | ch.chnum = 0; |
5147 | cfg->d11inf.encchspec(&ch); | 5151 | cfg->d11inf.encchspec(&ch); |
5148 | 5152 | ||
@@ -5176,6 +5180,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) | |||
5176 | 5180 | ||
5177 | brcmf_update_bw40_channel_flag(&band->channels[j], &ch); | 5181 | brcmf_update_bw40_channel_flag(&band->channels[j], &ch); |
5178 | } | 5182 | } |
5183 | kfree(pbuf); | ||
5179 | } | 5184 | } |
5180 | return err; | 5185 | return err; |
5181 | } | 5186 | } |
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index 6451d2b6abcf..824f5e287783 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -51,7 +51,6 @@ config IWLWIFI_LEDS | |||
51 | 51 | ||
52 | config IWLDVM | 52 | config IWLDVM |
53 | tristate "Intel Wireless WiFi DVM Firmware support" | 53 | tristate "Intel Wireless WiFi DVM Firmware support" |
54 | depends on m | ||
55 | default IWLWIFI | 54 | default IWLWIFI |
56 | help | 55 | help |
57 | This is the driver that supports the DVM firmware which is | 56 | This is the driver that supports the DVM firmware which is |
@@ -60,7 +59,6 @@ config IWLDVM | |||
60 | 59 | ||
61 | config IWLMVM | 60 | config IWLMVM |
62 | tristate "Intel Wireless WiFi MVM Firmware support" | 61 | tristate "Intel Wireless WiFi MVM Firmware support" |
63 | depends on m | ||
64 | help | 62 | help |
65 | This is the driver that supports the MVM firmware which is | 63 | This is the driver that supports the MVM firmware which is |
66 | currently only available for 7260 and 3160 devices. | 64 | currently only available for 7260 and 3160 devices. |
diff --git a/drivers/net/wireless/iwlwifi/dvm/power.c b/drivers/net/wireless/iwlwifi/dvm/power.c index 760c45c34ef3..1513dbc79c14 100644 --- a/drivers/net/wireless/iwlwifi/dvm/power.c +++ b/drivers/net/wireless/iwlwifi/dvm/power.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "commands.h" | 40 | #include "commands.h" |
41 | #include "power.h" | 41 | #include "power.h" |
42 | 42 | ||
43 | static bool force_cam; | 43 | static bool force_cam = true; |
44 | module_param(force_cam, bool, 0644); | 44 | module_param(force_cam, bool, 0644); |
45 | MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)"); | 45 | MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)"); |
46 | 46 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index 6dc5dd3ced44..ed50de6362ed 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
@@ -1068,6 +1068,13 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
1068 | /* recalculate basic rates */ | 1068 | /* recalculate basic rates */ |
1069 | iwl_calc_basic_rates(priv, ctx); | 1069 | iwl_calc_basic_rates(priv, ctx); |
1070 | 1070 | ||
1071 | /* | ||
1072 | * force CTS-to-self frames protection if RTS-CTS is not preferred | ||
1073 | * one aggregation protection method | ||
1074 | */ | ||
1075 | if (!priv->hw_params.use_rts_for_aggregation) | ||
1076 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
1077 | |||
1071 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || | 1078 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || |
1072 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) | 1079 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) |
1073 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; | 1080 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
@@ -1473,6 +1480,11 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1473 | else | 1480 | else |
1474 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | 1481 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
1475 | 1482 | ||
1483 | if (bss_conf->use_cts_prot) | ||
1484 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
1485 | else | ||
1486 | ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; | ||
1487 | |||
1476 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); | 1488 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); |
1477 | 1489 | ||
1478 | if (vif->type == NL80211_IFTYPE_AP || | 1490 | if (vif->type == NL80211_IFTYPE_AP || |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index 48730064da73..d53adc245497 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -67,8 +67,8 @@ | |||
67 | #include "iwl-agn-hw.h" | 67 | #include "iwl-agn-hw.h" |
68 | 68 | ||
69 | /* Highest firmware API version supported */ | 69 | /* Highest firmware API version supported */ |
70 | #define IWL7260_UCODE_API_MAX 9 | 70 | #define IWL7260_UCODE_API_MAX 10 |
71 | #define IWL3160_UCODE_API_MAX 9 | 71 | #define IWL3160_UCODE_API_MAX 10 |
72 | 72 | ||
73 | /* Oldest version we won't warn about */ | 73 | /* Oldest version we won't warn about */ |
74 | #define IWL7260_UCODE_API_OK 9 | 74 | #define IWL7260_UCODE_API_OK 9 |
@@ -83,6 +83,8 @@ | |||
83 | #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ | 83 | #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ |
84 | #define IWL3160_NVM_VERSION 0x709 | 84 | #define IWL3160_NVM_VERSION 0x709 |
85 | #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ | 85 | #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ |
86 | #define IWL3165_NVM_VERSION 0x709 | ||
87 | #define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */ | ||
86 | #define IWL7265_NVM_VERSION 0x0a1d | 88 | #define IWL7265_NVM_VERSION 0x0a1d |
87 | #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ | 89 | #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ |
88 | 90 | ||
@@ -92,6 +94,9 @@ | |||
92 | #define IWL3160_FW_PRE "iwlwifi-3160-" | 94 | #define IWL3160_FW_PRE "iwlwifi-3160-" |
93 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" | 95 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" |
94 | 96 | ||
97 | #define IWL3165_FW_PRE "iwlwifi-3165-" | ||
98 | #define IWL3165_MODULE_FIRMWARE(api) IWL3165_FW_PRE __stringify(api) ".ucode" | ||
99 | |||
95 | #define IWL7265_FW_PRE "iwlwifi-7265-" | 100 | #define IWL7265_FW_PRE "iwlwifi-7265-" |
96 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" | 101 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" |
97 | 102 | ||
@@ -213,6 +218,16 @@ static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = { | |||
213 | {0}, | 218 | {0}, |
214 | }; | 219 | }; |
215 | 220 | ||
221 | const struct iwl_cfg iwl3165_2ac_cfg = { | ||
222 | .name = "Intel(R) Dual Band Wireless AC 3165", | ||
223 | .fw_name_pre = IWL3165_FW_PRE, | ||
224 | IWL_DEVICE_7000, | ||
225 | .ht_params = &iwl7000_ht_params, | ||
226 | .nvm_ver = IWL3165_NVM_VERSION, | ||
227 | .nvm_calib_ver = IWL3165_TX_POWER_VERSION, | ||
228 | .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, | ||
229 | }; | ||
230 | |||
216 | const struct iwl_cfg iwl7265_2ac_cfg = { | 231 | const struct iwl_cfg iwl7265_2ac_cfg = { |
217 | .name = "Intel(R) Dual Band Wireless AC 7265", | 232 | .name = "Intel(R) Dual Band Wireless AC 7265", |
218 | .fw_name_pre = IWL7265_FW_PRE, | 233 | .fw_name_pre = IWL7265_FW_PRE, |
@@ -245,4 +260,5 @@ const struct iwl_cfg iwl7265_n_cfg = { | |||
245 | 260 | ||
246 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 261 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
247 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | 262 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); |
263 | MODULE_FIRMWARE(IWL3165_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | ||
248 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 264 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c index 44b19e015102..e93c6972290b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/iwlwifi/iwl-8000.c | |||
@@ -67,7 +67,7 @@ | |||
67 | #include "iwl-agn-hw.h" | 67 | #include "iwl-agn-hw.h" |
68 | 68 | ||
69 | /* Highest firmware API version supported */ | 69 | /* Highest firmware API version supported */ |
70 | #define IWL8000_UCODE_API_MAX 9 | 70 | #define IWL8000_UCODE_API_MAX 10 |
71 | 71 | ||
72 | /* Oldest version we won't warn about */ | 72 | /* Oldest version we won't warn about */ |
73 | #define IWL8000_UCODE_API_OK 8 | 73 | #define IWL8000_UCODE_API_OK 8 |
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index 8da596db9abe..3d7cc37420ae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -120,6 +120,8 @@ enum iwl_led_mode { | |||
120 | #define IWL_LONG_WD_TIMEOUT 10000 | 120 | #define IWL_LONG_WD_TIMEOUT 10000 |
121 | #define IWL_MAX_WD_TIMEOUT 120000 | 121 | #define IWL_MAX_WD_TIMEOUT 120000 |
122 | 122 | ||
123 | #define IWL_DEFAULT_MAX_TX_POWER 22 | ||
124 | |||
123 | /* Antenna presence definitions */ | 125 | /* Antenna presence definitions */ |
124 | #define ANT_NONE 0x0 | 126 | #define ANT_NONE 0x0 |
125 | #define ANT_A BIT(0) | 127 | #define ANT_A BIT(0) |
@@ -335,6 +337,7 @@ extern const struct iwl_cfg iwl7260_n_cfg; | |||
335 | extern const struct iwl_cfg iwl3160_2ac_cfg; | 337 | extern const struct iwl_cfg iwl3160_2ac_cfg; |
336 | extern const struct iwl_cfg iwl3160_2n_cfg; | 338 | extern const struct iwl_cfg iwl3160_2n_cfg; |
337 | extern const struct iwl_cfg iwl3160_n_cfg; | 339 | extern const struct iwl_cfg iwl3160_n_cfg; |
340 | extern const struct iwl_cfg iwl3165_2ac_cfg; | ||
338 | extern const struct iwl_cfg iwl7265_2ac_cfg; | 341 | extern const struct iwl_cfg iwl7265_2ac_cfg; |
339 | extern const struct iwl_cfg iwl7265_2n_cfg; | 342 | extern const struct iwl_cfg iwl7265_2n_cfg; |
340 | extern const struct iwl_cfg iwl7265_n_cfg; | 343 | extern const struct iwl_cfg iwl7265_n_cfg; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 018af2957d3b..354255f08754 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
@@ -146,8 +146,6 @@ static const u8 iwl_nvm_channels_family_8000[] = { | |||
146 | #define LAST_2GHZ_HT_PLUS 9 | 146 | #define LAST_2GHZ_HT_PLUS 9 |
147 | #define LAST_5GHZ_HT 161 | 147 | #define LAST_5GHZ_HT 161 |
148 | 148 | ||
149 | #define DEFAULT_MAX_TX_POWER 16 | ||
150 | |||
151 | /* rate data (static) */ | 149 | /* rate data (static) */ |
152 | static struct ieee80211_rate iwl_cfg80211_rates[] = { | 150 | static struct ieee80211_rate iwl_cfg80211_rates[] = { |
153 | { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, | 151 | { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, |
@@ -295,7 +293,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
295 | * Default value - highest tx power value. max_power | 293 | * Default value - highest tx power value. max_power |
296 | * is not used in mvm, and is used for backwards compatibility | 294 | * is not used in mvm, and is used for backwards compatibility |
297 | */ | 295 | */ |
298 | channel->max_power = DEFAULT_MAX_TX_POWER; | 296 | channel->max_power = IWL_DEFAULT_MAX_TX_POWER; |
299 | is_5ghz = channel->band == IEEE80211_BAND_5GHZ; | 297 | is_5ghz = channel->band == IEEE80211_BAND_5GHZ; |
300 | IWL_DEBUG_EEPROM(dev, | 298 | IWL_DEBUG_EEPROM(dev, |
301 | "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", | 299 | "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 2291bbcaaeab..ce71625f497f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -585,8 +585,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
585 | lockdep_assert_held(&mvm->mutex); | 585 | lockdep_assert_held(&mvm->mutex); |
586 | 586 | ||
587 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { | 587 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { |
588 | u32 mode; | ||
589 | |||
590 | switch (mvm->bt_force_ant_mode) { | 588 | switch (mvm->bt_force_ant_mode) { |
591 | case BT_FORCE_ANT_BT: | 589 | case BT_FORCE_ANT_BT: |
592 | mode = BT_COEX_BT; | 590 | mode = BT_COEX_BT; |
@@ -756,7 +754,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
756 | struct iwl_bt_iterator_data *data = _data; | 754 | struct iwl_bt_iterator_data *data = _data; |
757 | struct iwl_mvm *mvm = data->mvm; | 755 | struct iwl_mvm *mvm = data->mvm; |
758 | struct ieee80211_chanctx_conf *chanctx_conf; | 756 | struct ieee80211_chanctx_conf *chanctx_conf; |
759 | enum ieee80211_smps_mode smps_mode; | 757 | /* default smps_mode is AUTOMATIC - only used for client modes */ |
758 | enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
760 | u32 bt_activity_grading; | 759 | u32 bt_activity_grading; |
761 | int ave_rssi; | 760 | int ave_rssi; |
762 | 761 | ||
@@ -764,8 +763,6 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
764 | 763 | ||
765 | switch (vif->type) { | 764 | switch (vif->type) { |
766 | case NL80211_IFTYPE_STATION: | 765 | case NL80211_IFTYPE_STATION: |
767 | /* default smps_mode for BSS / P2P client is AUTOMATIC */ | ||
768 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
769 | break; | 766 | break; |
770 | case NL80211_IFTYPE_AP: | 767 | case NL80211_IFTYPE_AP: |
771 | if (!mvmvif->ap_ibss_active) | 768 | if (!mvmvif->ap_ibss_active) |
@@ -797,7 +794,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
797 | else if (bt_activity_grading >= BT_LOW_TRAFFIC) | 794 | else if (bt_activity_grading >= BT_LOW_TRAFFIC) |
798 | smps_mode = IEEE80211_SMPS_DYNAMIC; | 795 | smps_mode = IEEE80211_SMPS_DYNAMIC; |
799 | 796 | ||
800 | /* relax SMPS contraints for next association */ | 797 | /* relax SMPS constraints for next association */ |
801 | if (!vif->bss_conf.assoc) | 798 | if (!vif->bss_conf.assoc) |
802 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 799 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
803 | 800 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c index 2e90ff795c13..87e517bffedc 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | |||
@@ -74,8 +74,7 @@ static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm, | |||
74 | 74 | ||
75 | switch (param) { | 75 | switch (param) { |
76 | case MVM_DEBUGFS_PM_KEEP_ALIVE: { | 76 | case MVM_DEBUGFS_PM_KEEP_ALIVE: { |
77 | struct ieee80211_hw *hw = mvm->hw; | 77 | int dtimper = vif->bss_conf.dtim_period ?: 1; |
78 | int dtimper = hw->conf.ps_dtim_period ?: 1; | ||
79 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; | 78 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; |
80 | 79 | ||
81 | IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val); | 80 | IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 95f5b3274efb..9a922f3bd16b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -1563,14 +1563,14 @@ enum iwl_sf_scenario { | |||
1563 | 1563 | ||
1564 | /** | 1564 | /** |
1565 | * Smart Fifo configuration command. | 1565 | * Smart Fifo configuration command. |
1566 | * @state: smart fifo state, types listed in iwl_sf_sate. | 1566 | * @state: smart fifo state, types listed in enum %iwl_sf_sate. |
1567 | * @watermark: Minimum allowed availabe free space in RXF for transient state. | 1567 | * @watermark: Minimum allowed availabe free space in RXF for transient state. |
1568 | * @long_delay_timeouts: aging and idle timer values for each scenario | 1568 | * @long_delay_timeouts: aging and idle timer values for each scenario |
1569 | * in long delay state. | 1569 | * in long delay state. |
1570 | * @full_on_timeouts: timer values for each scenario in full on state. | 1570 | * @full_on_timeouts: timer values for each scenario in full on state. |
1571 | */ | 1571 | */ |
1572 | struct iwl_sf_cfg_cmd { | 1572 | struct iwl_sf_cfg_cmd { |
1573 | enum iwl_sf_state state; | 1573 | __le32 state; |
1574 | __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; | 1574 | __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; |
1575 | __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; | 1575 | __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; |
1576 | __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; | 1576 | __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 0e523e28cabf..8242e689ddb1 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -721,11 +721,6 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, | |||
721 | !force_assoc_off) { | 721 | !force_assoc_off) { |
722 | u32 dtim_offs; | 722 | u32 dtim_offs; |
723 | 723 | ||
724 | /* Allow beacons to pass through as long as we are not | ||
725 | * associated, or we do not have dtim period information. | ||
726 | */ | ||
727 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
728 | |||
729 | /* | 724 | /* |
730 | * The DTIM count counts down, so when it is N that means N | 725 | * The DTIM count counts down, so when it is N that means N |
731 | * more beacon intervals happen until the DTIM TBTT. Therefore | 726 | * more beacon intervals happen until the DTIM TBTT. Therefore |
@@ -759,6 +754,11 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, | |||
759 | ctxt_sta->is_assoc = cpu_to_le32(1); | 754 | ctxt_sta->is_assoc = cpu_to_le32(1); |
760 | } else { | 755 | } else { |
761 | ctxt_sta->is_assoc = cpu_to_le32(0); | 756 | ctxt_sta->is_assoc = cpu_to_le32(0); |
757 | |||
758 | /* Allow beacons to pass through as long as we are not | ||
759 | * associated, or we do not have dtim period information. | ||
760 | */ | ||
761 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
762 | } | 762 | } |
763 | 763 | ||
764 | ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); | 764 | ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 7c8796584c25..cdc272d776e7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -396,12 +396,14 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
396 | else | 396 | else |
397 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 397 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
398 | 398 | ||
399 | /* TODO: enable that only for firmwares that don't crash */ | 399 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 10) { |
400 | /* hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; */ | 400 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
401 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; | 401 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; |
402 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; | 402 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; |
403 | /* we create the 802.11 header and zero length SSID IE. */ | 403 | /* we create the 802.11 header and zero length SSID IE. */ |
404 | hw->wiphy->max_sched_scan_ie_len = SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; | 404 | hw->wiphy->max_sched_scan_ie_len = |
405 | SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; | ||
406 | } | ||
405 | 407 | ||
406 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | | 408 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | |
407 | NL80211_FEATURE_LOW_PRIORITY_SCAN | | 409 | NL80211_FEATURE_LOW_PRIORITY_SCAN | |
@@ -1524,11 +1526,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1524 | */ | 1526 | */ |
1525 | iwl_mvm_remove_time_event(mvm, mvmvif, | 1527 | iwl_mvm_remove_time_event(mvm, mvmvif, |
1526 | &mvmvif->time_event_data); | 1528 | &mvmvif->time_event_data); |
1527 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | | ||
1528 | BSS_CHANGED_QOS)) { | ||
1529 | ret = iwl_mvm_power_update_mac(mvm); | ||
1530 | if (ret) | ||
1531 | IWL_ERR(mvm, "failed to update power mode\n"); | ||
1532 | } | 1529 | } |
1533 | 1530 | ||
1534 | if (changes & BSS_CHANGED_BEACON_INFO) { | 1531 | if (changes & BSS_CHANGED_BEACON_INFO) { |
@@ -1536,6 +1533,12 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1536 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); | 1533 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); |
1537 | } | 1534 | } |
1538 | 1535 | ||
1536 | if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | BSS_CHANGED_QOS)) { | ||
1537 | ret = iwl_mvm_power_update_mac(mvm); | ||
1538 | if (ret) | ||
1539 | IWL_ERR(mvm, "failed to update power mode\n"); | ||
1540 | } | ||
1541 | |||
1539 | if (changes & BSS_CHANGED_TXPOWER) { | 1542 | if (changes & BSS_CHANGED_TXPOWER) { |
1540 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", | 1543 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", |
1541 | bss_conf->txpower); | 1544 | bss_conf->txpower); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c index 2b2d10800a55..d9769a23c68b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/iwlwifi/mvm/power.c | |||
@@ -281,7 +281,6 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
281 | struct ieee80211_vif *vif, | 281 | struct ieee80211_vif *vif, |
282 | struct iwl_mac_power_cmd *cmd) | 282 | struct iwl_mac_power_cmd *cmd) |
283 | { | 283 | { |
284 | struct ieee80211_hw *hw = mvm->hw; | ||
285 | struct ieee80211_chanctx_conf *chanctx_conf; | 284 | struct ieee80211_chanctx_conf *chanctx_conf; |
286 | struct ieee80211_channel *chan; | 285 | struct ieee80211_channel *chan; |
287 | int dtimper, dtimper_msec; | 286 | int dtimper, dtimper_msec; |
@@ -292,7 +291,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
292 | 291 | ||
293 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, | 292 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, |
294 | mvmvif->color)); | 293 | mvmvif->color)); |
295 | dtimper = hw->conf.ps_dtim_period ?: 1; | 294 | dtimper = vif->bss_conf.dtim_period; |
296 | 295 | ||
297 | /* | 296 | /* |
298 | * Regardless of power management state the driver must set | 297 | * Regardless of power management state the driver must set |
@@ -885,7 +884,7 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, | |||
885 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); | 884 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); |
886 | if (enable) { | 885 | if (enable) { |
887 | /* configure skip over dtim up to 300 msec */ | 886 | /* configure skip over dtim up to 300 msec */ |
888 | int dtimper = mvm->hw->conf.ps_dtim_period ?: 1; | 887 | int dtimper = vif->bss_conf.dtim_period ?: 1; |
889 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; | 888 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; |
890 | 889 | ||
891 | if (WARN_ON(!dtimper_msec)) | 890 | if (WARN_ON(!dtimper_msec)) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c index 4b98987fc413..bf5cd8c8b0f7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/iwlwifi/mvm/rx.c | |||
@@ -149,13 +149,13 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm, | |||
149 | le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]); | 149 | le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]); |
150 | energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >> | 150 | energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >> |
151 | IWL_RX_INFO_ENERGY_ANT_A_POS; | 151 | IWL_RX_INFO_ENERGY_ANT_A_POS; |
152 | energy_a = energy_a ? -energy_a : -256; | 152 | energy_a = energy_a ? -energy_a : S8_MIN; |
153 | energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >> | 153 | energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >> |
154 | IWL_RX_INFO_ENERGY_ANT_B_POS; | 154 | IWL_RX_INFO_ENERGY_ANT_B_POS; |
155 | energy_b = energy_b ? -energy_b : -256; | 155 | energy_b = energy_b ? -energy_b : S8_MIN; |
156 | energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >> | 156 | energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >> |
157 | IWL_RX_INFO_ENERGY_ANT_C_POS; | 157 | IWL_RX_INFO_ENERGY_ANT_C_POS; |
158 | energy_c = energy_c ? -energy_c : -256; | 158 | energy_c = energy_c ? -energy_c : S8_MIN; |
159 | max_energy = max(energy_a, energy_b); | 159 | max_energy = max(energy_a, energy_b); |
160 | max_energy = max(max_energy, energy_c); | 160 | max_energy = max(max_energy, energy_c); |
161 | 161 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c index 7edfd15efc9d..e843b67f2201 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sf.c +++ b/drivers/net/wireless/iwlwifi/mvm/sf.c | |||
@@ -172,7 +172,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, | |||
172 | enum iwl_sf_state new_state) | 172 | enum iwl_sf_state new_state) |
173 | { | 173 | { |
174 | struct iwl_sf_cfg_cmd sf_cmd = { | 174 | struct iwl_sf_cfg_cmd sf_cmd = { |
175 | .state = new_state, | 175 | .state = cpu_to_le32(new_state), |
176 | }; | 176 | }; |
177 | struct ieee80211_sta *sta; | 177 | struct ieee80211_sta *sta; |
178 | int ret = 0; | 178 | int ret = 0; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index dbc870713882..9ee410bf6da2 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -168,10 +168,14 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, | |||
168 | 168 | ||
169 | /* | 169 | /* |
170 | * for data packets, rate info comes from the table inside the fw. This | 170 | * for data packets, rate info comes from the table inside the fw. This |
171 | * table is controlled by LINK_QUALITY commands | 171 | * table is controlled by LINK_QUALITY commands. Exclude ctrl port |
172 | * frames like EAPOLs which should be treated as mgmt frames. This | ||
173 | * avoids them being sent initially in high rates which increases the | ||
174 | * chances for completion of the 4-Way handshake. | ||
172 | */ | 175 | */ |
173 | 176 | ||
174 | if (ieee80211_is_data(fc) && sta) { | 177 | if (ieee80211_is_data(fc) && sta && |
178 | !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) { | ||
175 | tx_cmd->initial_rate_index = 0; | 179 | tx_cmd->initial_rate_index = 0; |
176 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); | 180 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); |
177 | return; | 181 | return; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index f0e722ced080..073a68b97a72 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -352,11 +352,17 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
352 | {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, | 352 | {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, |
353 | {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, | 353 | {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, |
354 | {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, | 354 | {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, |
355 | {IWL_PCI_DEVICE(0x08B4, 0x8370, iwl3160_2ac_cfg)}, | ||
356 | {IWL_PCI_DEVICE(0x08B4, 0x8272, iwl3160_2ac_cfg)}, | ||
355 | {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, | 357 | {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, |
356 | {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, | 358 | {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, |
357 | {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, | 359 | {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, |
358 | {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, | 360 | {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, |
359 | 361 | ||
362 | /* 3165 Series */ | ||
363 | {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)}, | ||
364 | {IWL_PCI_DEVICE(0x3165, 0x4210, iwl3165_2ac_cfg)}, | ||
365 | |||
360 | /* 7265 Series */ | 366 | /* 7265 Series */ |
361 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, | 367 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, |
362 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, | 368 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, |
@@ -378,6 +384,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
378 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, | 384 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, |
379 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, | 385 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, |
380 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, | 386 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, |
387 | {IWL_PCI_DEVICE(0x095A, 0x900A, iwl7265_2ac_cfg)}, | ||
381 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, | 388 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, |
382 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, | 389 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, |
383 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, | 390 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, |
diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c index 33da3dfcfa4f..d4bd550f505c 100644 --- a/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c +++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c | |||
@@ -101,7 +101,7 @@ static bool halbtc_legacy(struct rtl_priv *adapter) | |||
101 | 101 | ||
102 | bool is_legacy = false; | 102 | bool is_legacy = false; |
103 | 103 | ||
104 | if ((mac->mode == WIRELESS_MODE_B) || (mac->mode == WIRELESS_MODE_B)) | 104 | if ((mac->mode == WIRELESS_MODE_B) || (mac->mode == WIRELESS_MODE_G)) |
105 | is_legacy = true; | 105 | is_legacy = true; |
106 | 106 | ||
107 | return is_legacy; | 107 | return is_legacy; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index 361435f8608a..1ac6383e7947 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -317,6 +317,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
317 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ | 317 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ |
318 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 318 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
319 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 319 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
320 | {RTL_USB_DEVICE(0x0df6, 0x0070, rtl92cu_hal_cfg)}, /*Sitecom - 150N */ | ||
320 | {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ | 321 | {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ |
321 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ | 322 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ |
322 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ | 323 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index e29e15dca86e..f379689dde30 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -576,6 +576,9 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, | |||
576 | init_waitqueue_head(&queue->dealloc_wq); | 576 | init_waitqueue_head(&queue->dealloc_wq); |
577 | atomic_set(&queue->inflight_packets, 0); | 577 | atomic_set(&queue->inflight_packets, 0); |
578 | 578 | ||
579 | netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, | ||
580 | XENVIF_NAPI_WEIGHT); | ||
581 | |||
579 | if (tx_evtchn == rx_evtchn) { | 582 | if (tx_evtchn == rx_evtchn) { |
580 | /* feature-split-event-channels == 0 */ | 583 | /* feature-split-event-channels == 0 */ |
581 | err = bind_interdomain_evtchn_to_irqhandler( | 584 | err = bind_interdomain_evtchn_to_irqhandler( |
@@ -629,9 +632,6 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, | |||
629 | wake_up_process(queue->task); | 632 | wake_up_process(queue->task); |
630 | wake_up_process(queue->dealloc_task); | 633 | wake_up_process(queue->dealloc_task); |
631 | 634 | ||
632 | netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, | ||
633 | XENVIF_NAPI_WEIGHT); | ||
634 | |||
635 | return 0; | 635 | return 0; |
636 | 636 | ||
637 | err_rx_unbind: | 637 | err_rx_unbind: |
diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c index f868333271aa..963a4a5dc88e 100644 --- a/drivers/nfc/microread/microread.c +++ b/drivers/nfc/microread/microread.c | |||
@@ -501,9 +501,13 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, | |||
501 | targets->sens_res = | 501 | targets->sens_res = |
502 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]); | 502 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]); |
503 | targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK]; | 503 | targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK]; |
504 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A_UID], | ||
505 | skb->data[MICROREAD_EMCF_A_LEN]); | ||
506 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN]; | 504 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN]; |
505 | if (targets->nfcid1_len > sizeof(targets->nfcid1)) { | ||
506 | r = -EINVAL; | ||
507 | goto exit_free; | ||
508 | } | ||
509 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A_UID], | ||
510 | targets->nfcid1_len); | ||
507 | break; | 511 | break; |
508 | case MICROREAD_GATE_ID_MREAD_ISO_A_3: | 512 | case MICROREAD_GATE_ID_MREAD_ISO_A_3: |
509 | targets->supported_protocols = | 513 | targets->supported_protocols = |
@@ -511,9 +515,13 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, | |||
511 | targets->sens_res = | 515 | targets->sens_res = |
512 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]); | 516 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]); |
513 | targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK]; | 517 | targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK]; |
514 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A3_UID], | ||
515 | skb->data[MICROREAD_EMCF_A3_LEN]); | ||
516 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN]; | 518 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN]; |
519 | if (targets->nfcid1_len > sizeof(targets->nfcid1)) { | ||
520 | r = -EINVAL; | ||
521 | goto exit_free; | ||
522 | } | ||
523 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A3_UID], | ||
524 | targets->nfcid1_len); | ||
517 | break; | 525 | break; |
518 | case MICROREAD_GATE_ID_MREAD_ISO_B: | 526 | case MICROREAD_GATE_ID_MREAD_ISO_B: |
519 | targets->supported_protocols = NFC_PROTO_ISO14443_B_MASK; | 527 | targets->supported_protocols = NFC_PROTO_ISO14443_B_MASK; |
diff --git a/drivers/nfc/st21nfca/Makefile b/drivers/nfc/st21nfca/Makefile index db7a38ae05f7..7d688f97aa27 100644 --- a/drivers/nfc/st21nfca/Makefile +++ b/drivers/nfc/st21nfca/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Makefile for ST21NFCA HCI based NFC driver | 2 | # Makefile for ST21NFCA HCI based NFC driver |
3 | # | 3 | # |
4 | 4 | ||
5 | st21nfca_i2c-objs = i2c.o | 5 | st21nfca_hci-objs = st21nfca.o st21nfca_dep.o |
6 | obj-$(CONFIG_NFC_ST21NFCA) += st21nfca_hci.o | ||
6 | 7 | ||
7 | obj-$(CONFIG_NFC_ST21NFCA) += st21nfca.o st21nfca_dep.o | 8 | st21nfca_i2c-objs = i2c.o |
8 | obj-$(CONFIG_NFC_ST21NFCA_I2C) += st21nfca_i2c.o | 9 | obj-$(CONFIG_NFC_ST21NFCA_I2C) += st21nfca_i2c.o |
diff --git a/drivers/nfc/st21nfcb/Makefile b/drivers/nfc/st21nfcb/Makefile index 13d9f03b2fea..f4d835dd15f2 100644 --- a/drivers/nfc/st21nfcb/Makefile +++ b/drivers/nfc/st21nfcb/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Makefile for ST21NFCB NCI based NFC driver | 2 | # Makefile for ST21NFCB NCI based NFC driver |
3 | # | 3 | # |
4 | 4 | ||
5 | st21nfcb_i2c-objs = i2c.o | 5 | st21nfcb_nci-objs = ndlc.o st21nfcb.o |
6 | obj-$(CONFIG_NFC_ST21NFCB) += st21nfcb_nci.o | ||
6 | 7 | ||
7 | obj-$(CONFIG_NFC_ST21NFCB) += st21nfcb.o ndlc.o | 8 | st21nfcb_i2c-objs = i2c.o |
8 | obj-$(CONFIG_NFC_ST21NFCB_I2C) += st21nfcb_i2c.o | 9 | obj-$(CONFIG_NFC_ST21NFCB_I2C) += st21nfcb_i2c.o |
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 9dd63b822025..e9bf2f47b61a 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
@@ -510,7 +510,7 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt, | |||
510 | 510 | ||
511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); | 511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); |
512 | 512 | ||
513 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 513 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
514 | num_qps_mw = nt->max_qps / mw_max + 1; | 514 | num_qps_mw = nt->max_qps / mw_max + 1; |
515 | else | 515 | else |
516 | num_qps_mw = nt->max_qps / mw_max; | 516 | num_qps_mw = nt->max_qps / mw_max; |
@@ -576,6 +576,19 @@ static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size) | |||
576 | return -ENOMEM; | 576 | return -ENOMEM; |
577 | } | 577 | } |
578 | 578 | ||
579 | /* | ||
580 | * we must ensure that the memory address allocated is BAR size | ||
581 | * aligned in order for the XLAT register to take the value. This | ||
582 | * is a requirement of the hardware. It is recommended to setup CMA | ||
583 | * for BAR sizes equal or greater than 4MB. | ||
584 | */ | ||
585 | if (!IS_ALIGNED(mw->dma_addr, mw->size)) { | ||
586 | dev_err(&pdev->dev, "DMA memory %pad not aligned to BAR size\n", | ||
587 | &mw->dma_addr); | ||
588 | ntb_free_mw(nt, num_mw); | ||
589 | return -ENOMEM; | ||
590 | } | ||
591 | |||
579 | /* Notify HW the memory location of the receive buffer */ | 592 | /* Notify HW the memory location of the receive buffer */ |
580 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); | 593 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); |
581 | 594 | ||
@@ -856,7 +869,7 @@ static int ntb_transport_init_queue(struct ntb_transport *nt, | |||
856 | qp->client_ready = NTB_LINK_DOWN; | 869 | qp->client_ready = NTB_LINK_DOWN; |
857 | qp->event_handler = NULL; | 870 | qp->event_handler = NULL; |
858 | 871 | ||
859 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 872 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
860 | num_qps_mw = nt->max_qps / mw_max + 1; | 873 | num_qps_mw = nt->max_qps / mw_max + 1; |
861 | else | 874 | else |
862 | num_qps_mw = nt->max_qps / mw_max; | 875 | num_qps_mw = nt->max_qps / mw_max; |
diff --git a/drivers/of/base.c b/drivers/of/base.c index d8574adf0d62..293ed4b687ba 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -138,6 +138,9 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp) | |||
138 | /* Important: Don't leak passwords */ | 138 | /* Important: Don't leak passwords */ |
139 | bool secure = strncmp(pp->name, "security-", 9) == 0; | 139 | bool secure = strncmp(pp->name, "security-", 9) == 0; |
140 | 140 | ||
141 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
142 | return 0; | ||
143 | |||
141 | if (!of_kset || !of_node_is_attached(np)) | 144 | if (!of_kset || !of_node_is_attached(np)) |
142 | return 0; | 145 | return 0; |
143 | 146 | ||
@@ -158,6 +161,9 @@ int __of_attach_node_sysfs(struct device_node *np) | |||
158 | struct property *pp; | 161 | struct property *pp; |
159 | int rc; | 162 | int rc; |
160 | 163 | ||
164 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
165 | return 0; | ||
166 | |||
161 | if (!of_kset) | 167 | if (!of_kset) |
162 | return 0; | 168 | return 0; |
163 | 169 | ||
@@ -1713,6 +1719,9 @@ int __of_remove_property(struct device_node *np, struct property *prop) | |||
1713 | 1719 | ||
1714 | void __of_remove_property_sysfs(struct device_node *np, struct property *prop) | 1720 | void __of_remove_property_sysfs(struct device_node *np, struct property *prop) |
1715 | { | 1721 | { |
1722 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
1723 | return; | ||
1724 | |||
1716 | /* at early boot, bail here and defer setup to of_init() */ | 1725 | /* at early boot, bail here and defer setup to of_init() */ |
1717 | if (of_kset && of_node_is_attached(np)) | 1726 | if (of_kset && of_node_is_attached(np)) |
1718 | sysfs_remove_bin_file(&np->kobj, &prop->attr); | 1727 | sysfs_remove_bin_file(&np->kobj, &prop->attr); |
@@ -1777,6 +1786,9 @@ int __of_update_property(struct device_node *np, struct property *newprop, | |||
1777 | void __of_update_property_sysfs(struct device_node *np, struct property *newprop, | 1786 | void __of_update_property_sysfs(struct device_node *np, struct property *newprop, |
1778 | struct property *oldprop) | 1787 | struct property *oldprop) |
1779 | { | 1788 | { |
1789 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
1790 | return; | ||
1791 | |||
1780 | /* At early boot, bail out and defer setup to of_init() */ | 1792 | /* At early boot, bail out and defer setup to of_init() */ |
1781 | if (!of_kset) | 1793 | if (!of_kset) |
1782 | return; | 1794 | return; |
@@ -1847,6 +1859,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
1847 | { | 1859 | { |
1848 | struct property *pp; | 1860 | struct property *pp; |
1849 | 1861 | ||
1862 | of_aliases = of_find_node_by_path("/aliases"); | ||
1850 | of_chosen = of_find_node_by_path("/chosen"); | 1863 | of_chosen = of_find_node_by_path("/chosen"); |
1851 | if (of_chosen == NULL) | 1864 | if (of_chosen == NULL) |
1852 | of_chosen = of_find_node_by_path("/chosen@0"); | 1865 | of_chosen = of_find_node_by_path("/chosen@0"); |
@@ -1862,7 +1875,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
1862 | of_stdout = of_find_node_by_path(name); | 1875 | of_stdout = of_find_node_by_path(name); |
1863 | } | 1876 | } |
1864 | 1877 | ||
1865 | of_aliases = of_find_node_by_path("/aliases"); | ||
1866 | if (!of_aliases) | 1878 | if (!of_aliases) |
1867 | return; | 1879 | return; |
1868 | 1880 | ||
@@ -1986,7 +1998,7 @@ bool of_console_check(struct device_node *dn, char *name, int index) | |||
1986 | { | 1998 | { |
1987 | if (!dn || dn != of_stdout || console_set_on_cmdline) | 1999 | if (!dn || dn != of_stdout || console_set_on_cmdline) |
1988 | return false; | 2000 | return false; |
1989 | return add_preferred_console(name, index, NULL); | 2001 | return !add_preferred_console(name, index, NULL); |
1990 | } | 2002 | } |
1991 | EXPORT_SYMBOL_GPL(of_console_check); | 2003 | EXPORT_SYMBOL_GPL(of_console_check); |
1992 | 2004 | ||
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 54fecc49a1fe..f297891d8529 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c | |||
@@ -45,6 +45,9 @@ void __of_detach_node_sysfs(struct device_node *np) | |||
45 | { | 45 | { |
46 | struct property *pp; | 46 | struct property *pp; |
47 | 47 | ||
48 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
49 | return; | ||
50 | |||
48 | BUG_ON(!of_node_is_initialized(np)); | 51 | BUG_ON(!of_node_is_initialized(np)); |
49 | if (!of_kset) | 52 | if (!of_kset) |
50 | return; | 53 | return; |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index f46a24ffa3fe..d1ffca8b34ea 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -453,7 +453,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, | |||
453 | base = dt_mem_next_cell(dt_root_addr_cells, &prop); | 453 | base = dt_mem_next_cell(dt_root_addr_cells, &prop); |
454 | size = dt_mem_next_cell(dt_root_size_cells, &prop); | 454 | size = dt_mem_next_cell(dt_root_size_cells, &prop); |
455 | 455 | ||
456 | if (base && size && | 456 | if (size && |
457 | early_init_dt_reserve_memory_arch(base, size, nomap) == 0) | 457 | early_init_dt_reserve_memory_arch(base, size, nomap) == 0) |
458 | pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n", | 458 | pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n", |
459 | uname, &base, (unsigned long)size / SZ_1M); | 459 | uname, &base, (unsigned long)size / SZ_1M); |
@@ -928,7 +928,11 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | 928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) |
929 | { | 929 | { |
930 | const u64 phys_offset = __pa(PAGE_OFFSET); | 930 | const u64 phys_offset = __pa(PAGE_OFFSET); |
931 | base &= PAGE_MASK; | 931 | |
932 | if (!PAGE_ALIGNED(base)) { | ||
933 | size -= PAGE_SIZE - (base & ~PAGE_MASK); | ||
934 | base = PAGE_ALIGN(base); | ||
935 | } | ||
932 | size &= PAGE_MASK; | 936 | size &= PAGE_MASK; |
933 | 937 | ||
934 | if (base > MAX_PHYS_ADDR) { | 938 | if (base > MAX_PHYS_ADDR) { |
@@ -937,10 +941,10 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
937 | return; | 941 | return; |
938 | } | 942 | } |
939 | 943 | ||
940 | if (base + size > MAX_PHYS_ADDR) { | 944 | if (base + size - 1 > MAX_PHYS_ADDR) { |
941 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | 945 | pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", |
942 | ULONG_MAX, base + size); | 946 | ((u64)MAX_PHYS_ADDR) + 1, base + size); |
943 | size = MAX_PHYS_ADDR - base; | 947 | size = MAX_PHYS_ADDR - base + 1; |
944 | } | 948 | } |
945 | 949 | ||
946 | if (base + size < phys_offset) { | 950 | if (base + size < phys_offset) { |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 3e06a699352d..1471e0a223a5 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -301,16 +301,17 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar | |||
301 | /* Get the reg property (if any) */ | 301 | /* Get the reg property (if any) */ |
302 | addr = of_get_property(device, "reg", NULL); | 302 | addr = of_get_property(device, "reg", NULL); |
303 | 303 | ||
304 | /* Try the new-style interrupts-extended first */ | ||
305 | res = of_parse_phandle_with_args(device, "interrupts-extended", | ||
306 | "#interrupt-cells", index, out_irq); | ||
307 | if (!res) | ||
308 | return of_irq_parse_raw(addr, out_irq); | ||
309 | |||
304 | /* Get the interrupts property */ | 310 | /* Get the interrupts property */ |
305 | intspec = of_get_property(device, "interrupts", &intlen); | 311 | intspec = of_get_property(device, "interrupts", &intlen); |
306 | if (intspec == NULL) { | 312 | if (intspec == NULL) |
307 | /* Try the new-style interrupts-extended */ | 313 | return -EINVAL; |
308 | res = of_parse_phandle_with_args(device, "interrupts-extended", | 314 | |
309 | "#interrupt-cells", index, out_irq); | ||
310 | if (res) | ||
311 | return -EINVAL; | ||
312 | return of_irq_parse_raw(addr, out_irq); | ||
313 | } | ||
314 | intlen /= sizeof(*intspec); | 315 | intlen /= sizeof(*intspec); |
315 | 316 | ||
316 | pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); | 317 | pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index d41002667833..a737cb5974de 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -27,6 +27,7 @@ static struct selftest_results { | |||
27 | #define NO_OF_NODES 2 | 27 | #define NO_OF_NODES 2 |
28 | static struct device_node *nodes[NO_OF_NODES]; | 28 | static struct device_node *nodes[NO_OF_NODES]; |
29 | static int last_node_index; | 29 | static int last_node_index; |
30 | static bool selftest_live_tree; | ||
30 | 31 | ||
31 | #define selftest(result, fmt, ...) { \ | 32 | #define selftest(result, fmt, ...) { \ |
32 | if (!(result)) { \ | 33 | if (!(result)) { \ |
@@ -630,13 +631,6 @@ static int attach_node_and_children(struct device_node *np) | |||
630 | { | 631 | { |
631 | struct device_node *next, *root = np, *dup; | 632 | struct device_node *next, *root = np, *dup; |
632 | 633 | ||
633 | if (!np) { | ||
634 | pr_warn("%s: No tree to attach; not running tests\n", | ||
635 | __func__); | ||
636 | return -ENODATA; | ||
637 | } | ||
638 | |||
639 | |||
640 | /* skip root node */ | 634 | /* skip root node */ |
641 | np = np->child; | 635 | np = np->child; |
642 | /* storing a copy in temporary node */ | 636 | /* storing a copy in temporary node */ |
@@ -672,12 +666,12 @@ static int attach_node_and_children(struct device_node *np) | |||
672 | static int __init selftest_data_add(void) | 666 | static int __init selftest_data_add(void) |
673 | { | 667 | { |
674 | void *selftest_data; | 668 | void *selftest_data; |
675 | struct device_node *selftest_data_node; | 669 | struct device_node *selftest_data_node, *np; |
676 | extern uint8_t __dtb_testcases_begin[]; | 670 | extern uint8_t __dtb_testcases_begin[]; |
677 | extern uint8_t __dtb_testcases_end[]; | 671 | extern uint8_t __dtb_testcases_end[]; |
678 | const int size = __dtb_testcases_end - __dtb_testcases_begin; | 672 | const int size = __dtb_testcases_end - __dtb_testcases_begin; |
679 | 673 | ||
680 | if (!size || !of_allnodes) { | 674 | if (!size) { |
681 | pr_warn("%s: No testcase data to attach; not running tests\n", | 675 | pr_warn("%s: No testcase data to attach; not running tests\n", |
682 | __func__); | 676 | __func__); |
683 | return -ENODATA; | 677 | return -ENODATA; |
@@ -692,6 +686,22 @@ static int __init selftest_data_add(void) | |||
692 | return -ENOMEM; | 686 | return -ENOMEM; |
693 | } | 687 | } |
694 | of_fdt_unflatten_tree(selftest_data, &selftest_data_node); | 688 | of_fdt_unflatten_tree(selftest_data, &selftest_data_node); |
689 | if (!selftest_data_node) { | ||
690 | pr_warn("%s: No tree to attach; not running tests\n", __func__); | ||
691 | return -ENODATA; | ||
692 | } | ||
693 | |||
694 | if (!of_allnodes) { | ||
695 | /* enabling flag for removing nodes */ | ||
696 | selftest_live_tree = true; | ||
697 | of_allnodes = selftest_data_node; | ||
698 | |||
699 | for_each_of_allnodes(np) | ||
700 | __of_attach_node_sysfs(np); | ||
701 | of_aliases = of_find_node_by_path("/aliases"); | ||
702 | of_chosen = of_find_node_by_path("/chosen"); | ||
703 | return 0; | ||
704 | } | ||
695 | 705 | ||
696 | /* attach the sub-tree to live tree */ | 706 | /* attach the sub-tree to live tree */ |
697 | return attach_node_and_children(selftest_data_node); | 707 | return attach_node_and_children(selftest_data_node); |
@@ -723,6 +733,18 @@ static void selftest_data_remove(void) | |||
723 | struct device_node *np; | 733 | struct device_node *np; |
724 | struct property *prop; | 734 | struct property *prop; |
725 | 735 | ||
736 | if (selftest_live_tree) { | ||
737 | of_node_put(of_aliases); | ||
738 | of_node_put(of_chosen); | ||
739 | of_aliases = NULL; | ||
740 | of_chosen = NULL; | ||
741 | for_each_child_of_node(of_allnodes, np) | ||
742 | detach_node_and_children(np); | ||
743 | __of_detach_node_sysfs(of_allnodes); | ||
744 | of_allnodes = NULL; | ||
745 | return; | ||
746 | } | ||
747 | |||
726 | while (last_node_index >= 0) { | 748 | while (last_node_index >= 0) { |
727 | if (nodes[last_node_index]) { | 749 | if (nodes[last_node_index]) { |
728 | np = of_find_node_by_path(nodes[last_node_index]->full_name); | 750 | np = of_find_node_by_path(nodes[last_node_index]->full_name); |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 9eae9834bcc7..a0580afe1713 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -913,7 +913,7 @@ static int __init dino_probe(struct parisc_device *dev) | |||
913 | printk("%s version %s found at 0x%lx\n", name, version, hpa); | 913 | printk("%s version %s found at 0x%lx\n", name, version, hpa); |
914 | 914 | ||
915 | if (!request_mem_region(hpa, PAGE_SIZE, name)) { | 915 | if (!request_mem_region(hpa, PAGE_SIZE, name)) { |
916 | printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%ld)!\n", | 916 | printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%lx)!\n", |
917 | hpa); | 917 | hpa); |
918 | return 1; | 918 | return 1; |
919 | } | 919 | } |
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 0f54ab6260df..3651c3871d5b 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -278,7 +278,7 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun | |||
278 | { | 278 | { |
279 | struct hardware_path hwpath; | 279 | struct hardware_path hwpath; |
280 | unsigned short i; | 280 | unsigned short i; |
281 | char in[count+1], *temp; | 281 | char in[64], *temp; |
282 | struct device *dev; | 282 | struct device *dev; |
283 | int ret; | 283 | int ret; |
284 | 284 | ||
@@ -286,8 +286,9 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun | |||
286 | return -EINVAL; | 286 | return -EINVAL; |
287 | 287 | ||
288 | /* We'll use a local copy of buf */ | 288 | /* We'll use a local copy of buf */ |
289 | memset(in, 0, count+1); | 289 | count = min_t(size_t, count, sizeof(in)-1); |
290 | strncpy(in, buf, count); | 290 | strncpy(in, buf, count); |
291 | in[count] = '\0'; | ||
291 | 292 | ||
292 | /* Let's clean up the target. 0xff is a blank pattern */ | 293 | /* Let's clean up the target. 0xff is a blank pattern */ |
293 | memset(&hwpath, 0xff, sizeof(hwpath)); | 294 | memset(&hwpath, 0xff, sizeof(hwpath)); |
@@ -393,14 +394,15 @@ pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count | |||
393 | { | 394 | { |
394 | unsigned int layers[6]; /* device-specific info (ctlr#, unit#, ...) */ | 395 | unsigned int layers[6]; /* device-specific info (ctlr#, unit#, ...) */ |
395 | unsigned short i; | 396 | unsigned short i; |
396 | char in[count+1], *temp; | 397 | char in[64], *temp; |
397 | 398 | ||
398 | if (!entry || !buf || !count) | 399 | if (!entry || !buf || !count) |
399 | return -EINVAL; | 400 | return -EINVAL; |
400 | 401 | ||
401 | /* We'll use a local copy of buf */ | 402 | /* We'll use a local copy of buf */ |
402 | memset(in, 0, count+1); | 403 | count = min_t(size_t, count, sizeof(in)-1); |
403 | strncpy(in, buf, count); | 404 | strncpy(in, buf, count); |
405 | in[count] = '\0'; | ||
404 | 406 | ||
405 | /* Let's clean up the target. 0 is a blank pattern */ | 407 | /* Let's clean up the target. 0 is a blank pattern */ |
406 | memset(&layers, 0, sizeof(layers)); | 408 | memset(&layers, 0, sizeof(layers)); |
@@ -755,7 +757,7 @@ static ssize_t pdcs_auto_write(struct kobject *kobj, | |||
755 | { | 757 | { |
756 | struct pdcspath_entry *pathentry; | 758 | struct pdcspath_entry *pathentry; |
757 | unsigned char flags; | 759 | unsigned char flags; |
758 | char in[count+1], *temp; | 760 | char in[8], *temp; |
759 | char c; | 761 | char c; |
760 | 762 | ||
761 | if (!capable(CAP_SYS_ADMIN)) | 763 | if (!capable(CAP_SYS_ADMIN)) |
@@ -765,8 +767,9 @@ static ssize_t pdcs_auto_write(struct kobject *kobj, | |||
765 | return -EINVAL; | 767 | return -EINVAL; |
766 | 768 | ||
767 | /* We'll use a local copy of buf */ | 769 | /* We'll use a local copy of buf */ |
768 | memset(in, 0, count+1); | 770 | count = min_t(size_t, count, sizeof(in)-1); |
769 | strncpy(in, buf, count); | 771 | strncpy(in, buf, count); |
772 | in[count] = '\0'; | ||
770 | 773 | ||
771 | /* Current flags are stored in primary boot path entry */ | 774 | /* Current flags are stored in primary boot path entry */ |
772 | pathentry = &pdcspath_entry_primary; | 775 | pathentry = &pdcspath_entry_primary; |
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig index 2d8a4d05d78f..90f5ccacce4b 100644 --- a/drivers/pci/host/Kconfig +++ b/drivers/pci/host/Kconfig | |||
@@ -1,9 +1,18 @@ | |||
1 | menu "PCI host controller drivers" | 1 | menu "PCI host controller drivers" |
2 | depends on PCI | 2 | depends on PCI |
3 | 3 | ||
4 | config PCI_DRA7XX | ||
5 | bool "TI DRA7xx PCIe controller" | ||
6 | select PCIE_DW | ||
7 | depends on OF && HAS_IOMEM && TI_PIPE3 | ||
8 | help | ||
9 | Enables support for the PCIe controller in the DRA7xx SoC. There | ||
10 | are two instances of PCIe controller in DRA7xx. This controller can | ||
11 | act both as EP and RC. This reuses the Designware core. | ||
12 | |||
4 | config PCI_MVEBU | 13 | config PCI_MVEBU |
5 | bool "Marvell EBU PCIe controller" | 14 | bool "Marvell EBU PCIe controller" |
6 | depends on ARCH_MVEBU || ARCH_DOVE || ARCH_KIRKWOOD | 15 | depends on ARCH_MVEBU || ARCH_DOVE |
7 | depends on OF | 16 | depends on OF |
8 | 17 | ||
9 | config PCIE_DW | 18 | config PCIE_DW |
@@ -47,7 +56,7 @@ config PCI_HOST_GENERIC | |||
47 | controller, such as the one emulated by kvmtool. | 56 | controller, such as the one emulated by kvmtool. |
48 | 57 | ||
49 | config PCIE_SPEAR13XX | 58 | config PCIE_SPEAR13XX |
50 | tristate "STMicroelectronics SPEAr PCIe controller" | 59 | bool "STMicroelectronics SPEAr PCIe controller" |
51 | depends on ARCH_SPEAR13XX | 60 | depends on ARCH_SPEAR13XX |
52 | select PCIEPORTBUS | 61 | select PCIEPORTBUS |
53 | select PCIE_DW | 62 | select PCIE_DW |
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile index 0daec7941aba..d0e88f114ff9 100644 --- a/drivers/pci/host/Makefile +++ b/drivers/pci/host/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | obj-$(CONFIG_PCIE_DW) += pcie-designware.o | 1 | obj-$(CONFIG_PCIE_DW) += pcie-designware.o |
2 | obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o | ||
2 | obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o | 3 | obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o |
3 | obj-$(CONFIG_PCI_IMX6) += pci-imx6.o | 4 | obj-$(CONFIG_PCI_IMX6) += pci-imx6.o |
4 | obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o | 5 | obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o |
diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c new file mode 100644 index 000000000000..52b34fee07fd --- /dev/null +++ b/drivers/pci/host/pci-dra7xx.c | |||
@@ -0,0 +1,458 @@ | |||
1 | /* | ||
2 | * pcie-dra7xx - PCIe controller driver for TI DRA7xx SoCs | ||
3 | * | ||
4 | * Copyright (C) 2013-2014 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * | ||
6 | * Authors: Kishon Vijay Abraham I <kishon@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/delay.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/irq.h> | ||
17 | #include <linux/irqdomain.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/pci.h> | ||
21 | #include <linux/phy/phy.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/pm_runtime.h> | ||
24 | #include <linux/resource.h> | ||
25 | #include <linux/types.h> | ||
26 | |||
27 | #include "pcie-designware.h" | ||
28 | |||
29 | /* PCIe controller wrapper DRA7XX configuration registers */ | ||
30 | |||
31 | #define PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN 0x0024 | ||
32 | #define PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN 0x0028 | ||
33 | #define ERR_SYS BIT(0) | ||
34 | #define ERR_FATAL BIT(1) | ||
35 | #define ERR_NONFATAL BIT(2) | ||
36 | #define ERR_COR BIT(3) | ||
37 | #define ERR_AXI BIT(4) | ||
38 | #define ERR_ECRC BIT(5) | ||
39 | #define PME_TURN_OFF BIT(8) | ||
40 | #define PME_TO_ACK BIT(9) | ||
41 | #define PM_PME BIT(10) | ||
42 | #define LINK_REQ_RST BIT(11) | ||
43 | #define LINK_UP_EVT BIT(12) | ||
44 | #define CFG_BME_EVT BIT(13) | ||
45 | #define CFG_MSE_EVT BIT(14) | ||
46 | #define INTERRUPTS (ERR_SYS | ERR_FATAL | ERR_NONFATAL | ERR_COR | ERR_AXI | \ | ||
47 | ERR_ECRC | PME_TURN_OFF | PME_TO_ACK | PM_PME | \ | ||
48 | LINK_REQ_RST | LINK_UP_EVT | CFG_BME_EVT | CFG_MSE_EVT) | ||
49 | |||
50 | #define PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI 0x0034 | ||
51 | #define PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI 0x0038 | ||
52 | #define INTA BIT(0) | ||
53 | #define INTB BIT(1) | ||
54 | #define INTC BIT(2) | ||
55 | #define INTD BIT(3) | ||
56 | #define MSI BIT(4) | ||
57 | #define LEG_EP_INTERRUPTS (INTA | INTB | INTC | INTD) | ||
58 | |||
59 | #define PCIECTRL_DRA7XX_CONF_DEVICE_CMD 0x0104 | ||
60 | #define LTSSM_EN 0x1 | ||
61 | |||
62 | #define PCIECTRL_DRA7XX_CONF_PHY_CS 0x010C | ||
63 | #define LINK_UP BIT(16) | ||
64 | |||
65 | struct dra7xx_pcie { | ||
66 | void __iomem *base; | ||
67 | struct phy **phy; | ||
68 | int phy_count; | ||
69 | struct device *dev; | ||
70 | struct pcie_port pp; | ||
71 | }; | ||
72 | |||
73 | #define to_dra7xx_pcie(x) container_of((x), struct dra7xx_pcie, pp) | ||
74 | |||
75 | static inline u32 dra7xx_pcie_readl(struct dra7xx_pcie *pcie, u32 offset) | ||
76 | { | ||
77 | return readl(pcie->base + offset); | ||
78 | } | ||
79 | |||
80 | static inline void dra7xx_pcie_writel(struct dra7xx_pcie *pcie, u32 offset, | ||
81 | u32 value) | ||
82 | { | ||
83 | writel(value, pcie->base + offset); | ||
84 | } | ||
85 | |||
86 | static int dra7xx_pcie_link_up(struct pcie_port *pp) | ||
87 | { | ||
88 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
89 | u32 reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_PHY_CS); | ||
90 | |||
91 | return !!(reg & LINK_UP); | ||
92 | } | ||
93 | |||
94 | static int dra7xx_pcie_establish_link(struct pcie_port *pp) | ||
95 | { | ||
96 | u32 reg; | ||
97 | unsigned int retries = 1000; | ||
98 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
99 | |||
100 | if (dw_pcie_link_up(pp)) { | ||
101 | dev_err(pp->dev, "link is already up\n"); | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD); | ||
106 | reg |= LTSSM_EN; | ||
107 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg); | ||
108 | |||
109 | while (retries--) { | ||
110 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_PHY_CS); | ||
111 | if (reg & LINK_UP) | ||
112 | break; | ||
113 | usleep_range(10, 20); | ||
114 | } | ||
115 | |||
116 | if (retries == 0) { | ||
117 | dev_err(pp->dev, "link is not up\n"); | ||
118 | return -ETIMEDOUT; | ||
119 | } | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | static void dra7xx_pcie_enable_interrupts(struct pcie_port *pp) | ||
125 | { | ||
126 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
127 | |||
128 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN, | ||
129 | ~INTERRUPTS); | ||
130 | dra7xx_pcie_writel(dra7xx, | ||
131 | PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN, INTERRUPTS); | ||
132 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, | ||
133 | ~LEG_EP_INTERRUPTS & ~MSI); | ||
134 | |||
135 | if (IS_ENABLED(CONFIG_PCI_MSI)) | ||
136 | dra7xx_pcie_writel(dra7xx, | ||
137 | PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI, MSI); | ||
138 | else | ||
139 | dra7xx_pcie_writel(dra7xx, | ||
140 | PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI, | ||
141 | LEG_EP_INTERRUPTS); | ||
142 | } | ||
143 | |||
144 | static void dra7xx_pcie_host_init(struct pcie_port *pp) | ||
145 | { | ||
146 | dw_pcie_setup_rc(pp); | ||
147 | dra7xx_pcie_establish_link(pp); | ||
148 | if (IS_ENABLED(CONFIG_PCI_MSI)) | ||
149 | dw_pcie_msi_init(pp); | ||
150 | dra7xx_pcie_enable_interrupts(pp); | ||
151 | } | ||
152 | |||
153 | static struct pcie_host_ops dra7xx_pcie_host_ops = { | ||
154 | .link_up = dra7xx_pcie_link_up, | ||
155 | .host_init = dra7xx_pcie_host_init, | ||
156 | }; | ||
157 | |||
158 | static int dra7xx_pcie_intx_map(struct irq_domain *domain, unsigned int irq, | ||
159 | irq_hw_number_t hwirq) | ||
160 | { | ||
161 | irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); | ||
162 | irq_set_chip_data(irq, domain->host_data); | ||
163 | set_irq_flags(irq, IRQF_VALID); | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static const struct irq_domain_ops intx_domain_ops = { | ||
169 | .map = dra7xx_pcie_intx_map, | ||
170 | }; | ||
171 | |||
172 | static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp) | ||
173 | { | ||
174 | struct device *dev = pp->dev; | ||
175 | struct device_node *node = dev->of_node; | ||
176 | struct device_node *pcie_intc_node = of_get_next_child(node, NULL); | ||
177 | |||
178 | if (!pcie_intc_node) { | ||
179 | dev_err(dev, "No PCIe Intc node found\n"); | ||
180 | return PTR_ERR(pcie_intc_node); | ||
181 | } | ||
182 | |||
183 | pp->irq_domain = irq_domain_add_linear(pcie_intc_node, 4, | ||
184 | &intx_domain_ops, pp); | ||
185 | if (!pp->irq_domain) { | ||
186 | dev_err(dev, "Failed to get a INTx IRQ domain\n"); | ||
187 | return PTR_ERR(pp->irq_domain); | ||
188 | } | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static irqreturn_t dra7xx_pcie_msi_irq_handler(int irq, void *arg) | ||
194 | { | ||
195 | struct pcie_port *pp = arg; | ||
196 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
197 | u32 reg; | ||
198 | |||
199 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI); | ||
200 | |||
201 | switch (reg) { | ||
202 | case MSI: | ||
203 | dw_handle_msi_irq(pp); | ||
204 | break; | ||
205 | case INTA: | ||
206 | case INTB: | ||
207 | case INTC: | ||
208 | case INTD: | ||
209 | generic_handle_irq(irq_find_mapping(pp->irq_domain, ffs(reg))); | ||
210 | break; | ||
211 | } | ||
212 | |||
213 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, reg); | ||
214 | |||
215 | return IRQ_HANDLED; | ||
216 | } | ||
217 | |||
218 | |||
219 | static irqreturn_t dra7xx_pcie_irq_handler(int irq, void *arg) | ||
220 | { | ||
221 | struct dra7xx_pcie *dra7xx = arg; | ||
222 | u32 reg; | ||
223 | |||
224 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN); | ||
225 | |||
226 | if (reg & ERR_SYS) | ||
227 | dev_dbg(dra7xx->dev, "System Error\n"); | ||
228 | |||
229 | if (reg & ERR_FATAL) | ||
230 | dev_dbg(dra7xx->dev, "Fatal Error\n"); | ||
231 | |||
232 | if (reg & ERR_NONFATAL) | ||
233 | dev_dbg(dra7xx->dev, "Non Fatal Error\n"); | ||
234 | |||
235 | if (reg & ERR_COR) | ||
236 | dev_dbg(dra7xx->dev, "Correctable Error\n"); | ||
237 | |||
238 | if (reg & ERR_AXI) | ||
239 | dev_dbg(dra7xx->dev, "AXI tag lookup fatal Error\n"); | ||
240 | |||
241 | if (reg & ERR_ECRC) | ||
242 | dev_dbg(dra7xx->dev, "ECRC Error\n"); | ||
243 | |||
244 | if (reg & PME_TURN_OFF) | ||
245 | dev_dbg(dra7xx->dev, | ||
246 | "Power Management Event Turn-Off message received\n"); | ||
247 | |||
248 | if (reg & PME_TO_ACK) | ||
249 | dev_dbg(dra7xx->dev, | ||
250 | "Power Management Turn-Off Ack message received\n"); | ||
251 | |||
252 | if (reg & PM_PME) | ||
253 | dev_dbg(dra7xx->dev, | ||
254 | "PM Power Management Event message received\n"); | ||
255 | |||
256 | if (reg & LINK_REQ_RST) | ||
257 | dev_dbg(dra7xx->dev, "Link Request Reset\n"); | ||
258 | |||
259 | if (reg & LINK_UP_EVT) | ||
260 | dev_dbg(dra7xx->dev, "Link-up state change\n"); | ||
261 | |||
262 | if (reg & CFG_BME_EVT) | ||
263 | dev_dbg(dra7xx->dev, "CFG 'Bus Master Enable' change\n"); | ||
264 | |||
265 | if (reg & CFG_MSE_EVT) | ||
266 | dev_dbg(dra7xx->dev, "CFG 'Memory Space Enable' change\n"); | ||
267 | |||
268 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN, reg); | ||
269 | |||
270 | return IRQ_HANDLED; | ||
271 | } | ||
272 | |||
273 | static int add_pcie_port(struct dra7xx_pcie *dra7xx, | ||
274 | struct platform_device *pdev) | ||
275 | { | ||
276 | int ret; | ||
277 | struct pcie_port *pp; | ||
278 | struct resource *res; | ||
279 | struct device *dev = &pdev->dev; | ||
280 | |||
281 | pp = &dra7xx->pp; | ||
282 | pp->dev = dev; | ||
283 | pp->ops = &dra7xx_pcie_host_ops; | ||
284 | |||
285 | pp->irq = platform_get_irq(pdev, 1); | ||
286 | if (pp->irq < 0) { | ||
287 | dev_err(dev, "missing IRQ resource\n"); | ||
288 | return -EINVAL; | ||
289 | } | ||
290 | |||
291 | ret = devm_request_irq(&pdev->dev, pp->irq, | ||
292 | dra7xx_pcie_msi_irq_handler, IRQF_SHARED, | ||
293 | "dra7-pcie-msi", pp); | ||
294 | if (ret) { | ||
295 | dev_err(&pdev->dev, "failed to request irq\n"); | ||
296 | return ret; | ||
297 | } | ||
298 | |||
299 | if (!IS_ENABLED(CONFIG_PCI_MSI)) { | ||
300 | ret = dra7xx_pcie_init_irq_domain(pp); | ||
301 | if (ret < 0) | ||
302 | return ret; | ||
303 | } | ||
304 | |||
305 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rc_dbics"); | ||
306 | pp->dbi_base = devm_ioremap(dev, res->start, resource_size(res)); | ||
307 | if (!pp->dbi_base) | ||
308 | return -ENOMEM; | ||
309 | |||
310 | ret = dw_pcie_host_init(pp); | ||
311 | if (ret) { | ||
312 | dev_err(dra7xx->dev, "failed to initialize host\n"); | ||
313 | return ret; | ||
314 | } | ||
315 | |||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | static int __init dra7xx_pcie_probe(struct platform_device *pdev) | ||
320 | { | ||
321 | u32 reg; | ||
322 | int ret; | ||
323 | int irq; | ||
324 | int i; | ||
325 | int phy_count; | ||
326 | struct phy **phy; | ||
327 | void __iomem *base; | ||
328 | struct resource *res; | ||
329 | struct dra7xx_pcie *dra7xx; | ||
330 | struct device *dev = &pdev->dev; | ||
331 | struct device_node *np = dev->of_node; | ||
332 | char name[10]; | ||
333 | |||
334 | dra7xx = devm_kzalloc(dev, sizeof(*dra7xx), GFP_KERNEL); | ||
335 | if (!dra7xx) | ||
336 | return -ENOMEM; | ||
337 | |||
338 | irq = platform_get_irq(pdev, 0); | ||
339 | if (irq < 0) { | ||
340 | dev_err(dev, "missing IRQ resource\n"); | ||
341 | return -EINVAL; | ||
342 | } | ||
343 | |||
344 | ret = devm_request_irq(dev, irq, dra7xx_pcie_irq_handler, | ||
345 | IRQF_SHARED, "dra7xx-pcie-main", dra7xx); | ||
346 | if (ret) { | ||
347 | dev_err(dev, "failed to request irq\n"); | ||
348 | return ret; | ||
349 | } | ||
350 | |||
351 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ti_conf"); | ||
352 | base = devm_ioremap_nocache(dev, res->start, resource_size(res)); | ||
353 | if (!base) | ||
354 | return -ENOMEM; | ||
355 | |||
356 | phy_count = of_property_count_strings(np, "phy-names"); | ||
357 | if (phy_count < 0) { | ||
358 | dev_err(dev, "unable to find the strings\n"); | ||
359 | return phy_count; | ||
360 | } | ||
361 | |||
362 | phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL); | ||
363 | if (!phy) | ||
364 | return -ENOMEM; | ||
365 | |||
366 | for (i = 0; i < phy_count; i++) { | ||
367 | snprintf(name, sizeof(name), "pcie-phy%d", i); | ||
368 | phy[i] = devm_phy_get(dev, name); | ||
369 | if (IS_ERR(phy[i])) | ||
370 | return PTR_ERR(phy[i]); | ||
371 | |||
372 | ret = phy_init(phy[i]); | ||
373 | if (ret < 0) | ||
374 | goto err_phy; | ||
375 | |||
376 | ret = phy_power_on(phy[i]); | ||
377 | if (ret < 0) { | ||
378 | phy_exit(phy[i]); | ||
379 | goto err_phy; | ||
380 | } | ||
381 | } | ||
382 | |||
383 | dra7xx->base = base; | ||
384 | dra7xx->phy = phy; | ||
385 | dra7xx->dev = dev; | ||
386 | dra7xx->phy_count = phy_count; | ||
387 | |||
388 | pm_runtime_enable(dev); | ||
389 | ret = pm_runtime_get_sync(dev); | ||
390 | if (IS_ERR_VALUE(ret)) { | ||
391 | dev_err(dev, "pm_runtime_get_sync failed\n"); | ||
392 | goto err_phy; | ||
393 | } | ||
394 | |||
395 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD); | ||
396 | reg &= ~LTSSM_EN; | ||
397 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg); | ||
398 | |||
399 | platform_set_drvdata(pdev, dra7xx); | ||
400 | |||
401 | ret = add_pcie_port(dra7xx, pdev); | ||
402 | if (ret < 0) | ||
403 | goto err_add_port; | ||
404 | |||
405 | return 0; | ||
406 | |||
407 | err_add_port: | ||
408 | pm_runtime_put(dev); | ||
409 | pm_runtime_disable(dev); | ||
410 | |||
411 | err_phy: | ||
412 | while (--i >= 0) { | ||
413 | phy_power_off(phy[i]); | ||
414 | phy_exit(phy[i]); | ||
415 | } | ||
416 | |||
417 | return ret; | ||
418 | } | ||
419 | |||
420 | static int __exit dra7xx_pcie_remove(struct platform_device *pdev) | ||
421 | { | ||
422 | struct dra7xx_pcie *dra7xx = platform_get_drvdata(pdev); | ||
423 | struct pcie_port *pp = &dra7xx->pp; | ||
424 | struct device *dev = &pdev->dev; | ||
425 | int count = dra7xx->phy_count; | ||
426 | |||
427 | if (pp->irq_domain) | ||
428 | irq_domain_remove(pp->irq_domain); | ||
429 | pm_runtime_put(dev); | ||
430 | pm_runtime_disable(dev); | ||
431 | while (count--) { | ||
432 | phy_power_off(dra7xx->phy[count]); | ||
433 | phy_exit(dra7xx->phy[count]); | ||
434 | } | ||
435 | |||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | static const struct of_device_id of_dra7xx_pcie_match[] = { | ||
440 | { .compatible = "ti,dra7-pcie", }, | ||
441 | {}, | ||
442 | }; | ||
443 | MODULE_DEVICE_TABLE(of, of_dra7xx_pcie_match); | ||
444 | |||
445 | static struct platform_driver dra7xx_pcie_driver = { | ||
446 | .remove = __exit_p(dra7xx_pcie_remove), | ||
447 | .driver = { | ||
448 | .name = "dra7-pcie", | ||
449 | .owner = THIS_MODULE, | ||
450 | .of_match_table = of_dra7xx_pcie_match, | ||
451 | }, | ||
452 | }; | ||
453 | |||
454 | module_platform_driver_probe(dra7xx_pcie_driver, dra7xx_pcie_probe); | ||
455 | |||
456 | MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>"); | ||
457 | MODULE_DESCRIPTION("TI PCIe controller driver"); | ||
458 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index a568efaa331c..35fc73a8d0b3 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -49,6 +49,9 @@ struct imx6_pcie { | |||
49 | 49 | ||
50 | /* PCIe Port Logic registers (memory-mapped) */ | 50 | /* PCIe Port Logic registers (memory-mapped) */ |
51 | #define PL_OFFSET 0x700 | 51 | #define PL_OFFSET 0x700 |
52 | #define PCIE_PL_PFLR (PL_OFFSET + 0x08) | ||
53 | #define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) | ||
54 | #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) | ||
52 | #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) | 55 | #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) |
53 | #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) | 56 | #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) |
54 | #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) | 57 | #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) |
@@ -214,6 +217,32 @@ static int imx6q_pcie_abort_handler(unsigned long addr, | |||
214 | static int imx6_pcie_assert_core_reset(struct pcie_port *pp) | 217 | static int imx6_pcie_assert_core_reset(struct pcie_port *pp) |
215 | { | 218 | { |
216 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | 219 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); |
220 | u32 val, gpr1, gpr12; | ||
221 | |||
222 | /* | ||
223 | * If the bootloader already enabled the link we need some special | ||
224 | * handling to get the core back into a state where it is safe to | ||
225 | * touch it for configuration. As there is no dedicated reset signal | ||
226 | * wired up for MX6QDL, we need to manually force LTSSM into "detect" | ||
227 | * state before completely disabling LTSSM, which is a prerequisite | ||
228 | * for core configuration. | ||
229 | * | ||
230 | * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong | ||
231 | * indication that the bootloader activated the link. | ||
232 | */ | ||
233 | regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, &gpr1); | ||
234 | regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, &gpr12); | ||
235 | |||
236 | if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) && | ||
237 | (gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) { | ||
238 | val = readl(pp->dbi_base + PCIE_PL_PFLR); | ||
239 | val &= ~PCIE_PL_PFLR_LINK_STATE_MASK; | ||
240 | val |= PCIE_PL_PFLR_FORCE_LINK; | ||
241 | writel(val, pp->dbi_base + PCIE_PL_PFLR); | ||
242 | |||
243 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
244 | IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); | ||
245 | } | ||
217 | 246 | ||
218 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | 247 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, |
219 | IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); | 248 | IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); |
@@ -589,6 +618,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) | |||
589 | return 0; | 618 | return 0; |
590 | } | 619 | } |
591 | 620 | ||
621 | static void imx6_pcie_shutdown(struct platform_device *pdev) | ||
622 | { | ||
623 | struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev); | ||
624 | |||
625 | /* bring down link, so bootloader gets clean state in case of reboot */ | ||
626 | imx6_pcie_assert_core_reset(&imx6_pcie->pp); | ||
627 | } | ||
628 | |||
592 | static const struct of_device_id imx6_pcie_of_match[] = { | 629 | static const struct of_device_id imx6_pcie_of_match[] = { |
593 | { .compatible = "fsl,imx6q-pcie", }, | 630 | { .compatible = "fsl,imx6q-pcie", }, |
594 | {}, | 631 | {}, |
@@ -601,6 +638,7 @@ static struct platform_driver imx6_pcie_driver = { | |||
601 | .owner = THIS_MODULE, | 638 | .owner = THIS_MODULE, |
602 | .of_match_table = imx6_pcie_of_match, | 639 | .of_match_table = imx6_pcie_of_match, |
603 | }, | 640 | }, |
641 | .shutdown = imx6_pcie_shutdown, | ||
604 | }; | 642 | }; |
605 | 643 | ||
606 | /* Freescale PCIe driver does not allow module unload */ | 644 | /* Freescale PCIe driver does not allow module unload */ |
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index abd65784618d..0fb0fdb223d5 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/debugfs.h> | ||
28 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
29 | #include <linux/export.h> | 30 | #include <linux/export.h> |
30 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
@@ -276,6 +277,7 @@ struct tegra_pcie { | |||
276 | unsigned int num_supplies; | 277 | unsigned int num_supplies; |
277 | 278 | ||
278 | const struct tegra_pcie_soc_data *soc_data; | 279 | const struct tegra_pcie_soc_data *soc_data; |
280 | struct dentry *debugfs; | ||
279 | }; | 281 | }; |
280 | 282 | ||
281 | struct tegra_pcie_port { | 283 | struct tegra_pcie_port { |
@@ -1739,6 +1741,115 @@ static const struct of_device_id tegra_pcie_of_match[] = { | |||
1739 | }; | 1741 | }; |
1740 | MODULE_DEVICE_TABLE(of, tegra_pcie_of_match); | 1742 | MODULE_DEVICE_TABLE(of, tegra_pcie_of_match); |
1741 | 1743 | ||
1744 | static void *tegra_pcie_ports_seq_start(struct seq_file *s, loff_t *pos) | ||
1745 | { | ||
1746 | struct tegra_pcie *pcie = s->private; | ||
1747 | |||
1748 | if (list_empty(&pcie->ports)) | ||
1749 | return NULL; | ||
1750 | |||
1751 | seq_printf(s, "Index Status\n"); | ||
1752 | |||
1753 | return seq_list_start(&pcie->ports, *pos); | ||
1754 | } | ||
1755 | |||
1756 | static void *tegra_pcie_ports_seq_next(struct seq_file *s, void *v, loff_t *pos) | ||
1757 | { | ||
1758 | struct tegra_pcie *pcie = s->private; | ||
1759 | |||
1760 | return seq_list_next(v, &pcie->ports, pos); | ||
1761 | } | ||
1762 | |||
1763 | static void tegra_pcie_ports_seq_stop(struct seq_file *s, void *v) | ||
1764 | { | ||
1765 | } | ||
1766 | |||
1767 | static int tegra_pcie_ports_seq_show(struct seq_file *s, void *v) | ||
1768 | { | ||
1769 | bool up = false, active = false; | ||
1770 | struct tegra_pcie_port *port; | ||
1771 | unsigned int value; | ||
1772 | |||
1773 | port = list_entry(v, struct tegra_pcie_port, list); | ||
1774 | |||
1775 | value = readl(port->base + RP_VEND_XP); | ||
1776 | |||
1777 | if (value & RP_VEND_XP_DL_UP) | ||
1778 | up = true; | ||
1779 | |||
1780 | value = readl(port->base + RP_LINK_CONTROL_STATUS); | ||
1781 | |||
1782 | if (value & RP_LINK_CONTROL_STATUS_DL_LINK_ACTIVE) | ||
1783 | active = true; | ||
1784 | |||
1785 | seq_printf(s, "%2u ", port->index); | ||
1786 | |||
1787 | if (up) | ||
1788 | seq_printf(s, "up"); | ||
1789 | |||
1790 | if (active) { | ||
1791 | if (up) | ||
1792 | seq_printf(s, ", "); | ||
1793 | |||
1794 | seq_printf(s, "active"); | ||
1795 | } | ||
1796 | |||
1797 | seq_printf(s, "\n"); | ||
1798 | return 0; | ||
1799 | } | ||
1800 | |||
1801 | static const struct seq_operations tegra_pcie_ports_seq_ops = { | ||
1802 | .start = tegra_pcie_ports_seq_start, | ||
1803 | .next = tegra_pcie_ports_seq_next, | ||
1804 | .stop = tegra_pcie_ports_seq_stop, | ||
1805 | .show = tegra_pcie_ports_seq_show, | ||
1806 | }; | ||
1807 | |||
1808 | static int tegra_pcie_ports_open(struct inode *inode, struct file *file) | ||
1809 | { | ||
1810 | struct tegra_pcie *pcie = inode->i_private; | ||
1811 | struct seq_file *s; | ||
1812 | int err; | ||
1813 | |||
1814 | err = seq_open(file, &tegra_pcie_ports_seq_ops); | ||
1815 | if (err) | ||
1816 | return err; | ||
1817 | |||
1818 | s = file->private_data; | ||
1819 | s->private = pcie; | ||
1820 | |||
1821 | return 0; | ||
1822 | } | ||
1823 | |||
1824 | static const struct file_operations tegra_pcie_ports_ops = { | ||
1825 | .owner = THIS_MODULE, | ||
1826 | .open = tegra_pcie_ports_open, | ||
1827 | .read = seq_read, | ||
1828 | .llseek = seq_lseek, | ||
1829 | .release = seq_release, | ||
1830 | }; | ||
1831 | |||
1832 | static int tegra_pcie_debugfs_init(struct tegra_pcie *pcie) | ||
1833 | { | ||
1834 | struct dentry *file; | ||
1835 | |||
1836 | pcie->debugfs = debugfs_create_dir("pcie", NULL); | ||
1837 | if (!pcie->debugfs) | ||
1838 | return -ENOMEM; | ||
1839 | |||
1840 | file = debugfs_create_file("ports", S_IFREG | S_IRUGO, pcie->debugfs, | ||
1841 | pcie, &tegra_pcie_ports_ops); | ||
1842 | if (!file) | ||
1843 | goto remove; | ||
1844 | |||
1845 | return 0; | ||
1846 | |||
1847 | remove: | ||
1848 | debugfs_remove_recursive(pcie->debugfs); | ||
1849 | pcie->debugfs = NULL; | ||
1850 | return -ENOMEM; | ||
1851 | } | ||
1852 | |||
1742 | static int tegra_pcie_probe(struct platform_device *pdev) | 1853 | static int tegra_pcie_probe(struct platform_device *pdev) |
1743 | { | 1854 | { |
1744 | const struct of_device_id *match; | 1855 | const struct of_device_id *match; |
@@ -1793,6 +1904,13 @@ static int tegra_pcie_probe(struct platform_device *pdev) | |||
1793 | goto disable_msi; | 1904 | goto disable_msi; |
1794 | } | 1905 | } |
1795 | 1906 | ||
1907 | if (IS_ENABLED(CONFIG_DEBUG_FS)) { | ||
1908 | err = tegra_pcie_debugfs_init(pcie); | ||
1909 | if (err < 0) | ||
1910 | dev_err(&pdev->dev, "failed to setup debugfs: %d\n", | ||
1911 | err); | ||
1912 | } | ||
1913 | |||
1796 | platform_set_drvdata(pdev, pcie); | 1914 | platform_set_drvdata(pdev, pcie); |
1797 | return 0; | 1915 | return 0; |
1798 | 1916 | ||
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 1eaf4df3618a..52bd3a143563 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/of_pci.h> | 20 | #include <linux/of_pci.h> |
21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
22 | #include <linux/pci_regs.h> | 22 | #include <linux/pci_regs.h> |
23 | #include <linux/platform_device.h> | ||
23 | #include <linux/types.h> | 24 | #include <linux/types.h> |
24 | 25 | ||
25 | #include "pcie-designware.h" | 26 | #include "pcie-designware.h" |
@@ -217,27 +218,47 @@ static int find_valid_pos0(struct pcie_port *pp, int msgvec, int pos, int *pos0) | |||
217 | return 0; | 218 | return 0; |
218 | } | 219 | } |
219 | 220 | ||
221 | static void dw_pcie_msi_clear_irq(struct pcie_port *pp, int irq) | ||
222 | { | ||
223 | unsigned int res, bit, val; | ||
224 | |||
225 | res = (irq / 32) * 12; | ||
226 | bit = irq % 32; | ||
227 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | ||
228 | val &= ~(1 << bit); | ||
229 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
230 | } | ||
231 | |||
220 | static void clear_irq_range(struct pcie_port *pp, unsigned int irq_base, | 232 | static void clear_irq_range(struct pcie_port *pp, unsigned int irq_base, |
221 | unsigned int nvec, unsigned int pos) | 233 | unsigned int nvec, unsigned int pos) |
222 | { | 234 | { |
223 | unsigned int i, res, bit, val; | 235 | unsigned int i; |
224 | 236 | ||
225 | for (i = 0; i < nvec; i++) { | 237 | for (i = 0; i < nvec; i++) { |
226 | irq_set_msi_desc_off(irq_base, i, NULL); | 238 | irq_set_msi_desc_off(irq_base, i, NULL); |
227 | clear_bit(pos + i, pp->msi_irq_in_use); | 239 | clear_bit(pos + i, pp->msi_irq_in_use); |
228 | /* Disable corresponding interrupt on MSI controller */ | 240 | /* Disable corresponding interrupt on MSI controller */ |
229 | res = ((pos + i) / 32) * 12; | 241 | if (pp->ops->msi_clear_irq) |
230 | bit = (pos + i) % 32; | 242 | pp->ops->msi_clear_irq(pp, pos + i); |
231 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | 243 | else |
232 | val &= ~(1 << bit); | 244 | dw_pcie_msi_clear_irq(pp, pos + i); |
233 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
234 | } | 245 | } |
235 | } | 246 | } |
236 | 247 | ||
248 | static void dw_pcie_msi_set_irq(struct pcie_port *pp, int irq) | ||
249 | { | ||
250 | unsigned int res, bit, val; | ||
251 | |||
252 | res = (irq / 32) * 12; | ||
253 | bit = irq % 32; | ||
254 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | ||
255 | val |= 1 << bit; | ||
256 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
257 | } | ||
258 | |||
237 | static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) | 259 | static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) |
238 | { | 260 | { |
239 | int res, bit, irq, pos0, pos1, i; | 261 | int irq, pos0, pos1, i; |
240 | u32 val; | ||
241 | struct pcie_port *pp = sys_to_pcie(desc->dev->bus->sysdata); | 262 | struct pcie_port *pp = sys_to_pcie(desc->dev->bus->sysdata); |
242 | 263 | ||
243 | if (!pp) { | 264 | if (!pp) { |
@@ -281,11 +302,10 @@ static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) | |||
281 | } | 302 | } |
282 | set_bit(pos0 + i, pp->msi_irq_in_use); | 303 | set_bit(pos0 + i, pp->msi_irq_in_use); |
283 | /*Enable corresponding interrupt in MSI interrupt controller */ | 304 | /*Enable corresponding interrupt in MSI interrupt controller */ |
284 | res = ((pos0 + i) / 32) * 12; | 305 | if (pp->ops->msi_set_irq) |
285 | bit = (pos0 + i) % 32; | 306 | pp->ops->msi_set_irq(pp, pos0 + i); |
286 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | 307 | else |
287 | val |= 1 << bit; | 308 | dw_pcie_msi_set_irq(pp, pos0 + i); |
288 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
289 | } | 309 | } |
290 | 310 | ||
291 | *pos = pos0; | 311 | *pos = pos0; |
@@ -353,7 +373,10 @@ static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, | |||
353 | */ | 373 | */ |
354 | desc->msi_attrib.multiple = msgvec; | 374 | desc->msi_attrib.multiple = msgvec; |
355 | 375 | ||
356 | msg.address_lo = virt_to_phys((void *)pp->msi_data); | 376 | if (pp->ops->get_msi_data) |
377 | msg.address_lo = pp->ops->get_msi_data(pp); | ||
378 | else | ||
379 | msg.address_lo = virt_to_phys((void *)pp->msi_data); | ||
357 | msg.address_hi = 0x0; | 380 | msg.address_hi = 0x0; |
358 | msg.data = pos; | 381 | msg.data = pos; |
359 | write_msi_msg(irq, &msg); | 382 | write_msi_msg(irq, &msg); |
@@ -396,10 +419,35 @@ static const struct irq_domain_ops msi_domain_ops = { | |||
396 | int __init dw_pcie_host_init(struct pcie_port *pp) | 419 | int __init dw_pcie_host_init(struct pcie_port *pp) |
397 | { | 420 | { |
398 | struct device_node *np = pp->dev->of_node; | 421 | struct device_node *np = pp->dev->of_node; |
422 | struct platform_device *pdev = to_platform_device(pp->dev); | ||
399 | struct of_pci_range range; | 423 | struct of_pci_range range; |
400 | struct of_pci_range_parser parser; | 424 | struct of_pci_range_parser parser; |
401 | u32 val; | 425 | struct resource *cfg_res; |
402 | int i; | 426 | u32 val, na, ns; |
427 | const __be32 *addrp; | ||
428 | int i, index; | ||
429 | |||
430 | /* Find the address cell size and the number of cells in order to get | ||
431 | * the untranslated address. | ||
432 | */ | ||
433 | of_property_read_u32(np, "#address-cells", &na); | ||
434 | ns = of_n_size_cells(np); | ||
435 | |||
436 | cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config"); | ||
437 | if (cfg_res) { | ||
438 | pp->config.cfg0_size = resource_size(cfg_res)/2; | ||
439 | pp->config.cfg1_size = resource_size(cfg_res)/2; | ||
440 | pp->cfg0_base = cfg_res->start; | ||
441 | pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; | ||
442 | |||
443 | /* Find the untranslated configuration space address */ | ||
444 | index = of_property_match_string(np, "reg-names", "config"); | ||
445 | addrp = of_get_address(np, index, false, false); | ||
446 | pp->cfg0_mod_base = of_read_number(addrp, ns); | ||
447 | pp->cfg1_mod_base = pp->cfg0_mod_base + pp->config.cfg0_size; | ||
448 | } else { | ||
449 | dev_err(pp->dev, "missing *config* reg space\n"); | ||
450 | } | ||
403 | 451 | ||
404 | if (of_pci_range_parser_init(&parser, np)) { | 452 | if (of_pci_range_parser_init(&parser, np)) { |
405 | dev_err(pp->dev, "missing ranges property\n"); | 453 | dev_err(pp->dev, "missing ranges property\n"); |
@@ -422,17 +470,33 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
422 | pp->config.io_size = resource_size(&pp->io); | 470 | pp->config.io_size = resource_size(&pp->io); |
423 | pp->config.io_bus_addr = range.pci_addr; | 471 | pp->config.io_bus_addr = range.pci_addr; |
424 | pp->io_base = range.cpu_addr; | 472 | pp->io_base = range.cpu_addr; |
473 | |||
474 | /* Find the untranslated IO space address */ | ||
475 | pp->io_mod_base = of_read_number(parser.range - | ||
476 | parser.np + na, ns); | ||
425 | } | 477 | } |
426 | if (restype == IORESOURCE_MEM) { | 478 | if (restype == IORESOURCE_MEM) { |
427 | of_pci_range_to_resource(&range, np, &pp->mem); | 479 | of_pci_range_to_resource(&range, np, &pp->mem); |
428 | pp->mem.name = "MEM"; | 480 | pp->mem.name = "MEM"; |
429 | pp->config.mem_size = resource_size(&pp->mem); | 481 | pp->config.mem_size = resource_size(&pp->mem); |
430 | pp->config.mem_bus_addr = range.pci_addr; | 482 | pp->config.mem_bus_addr = range.pci_addr; |
483 | |||
484 | /* Find the untranslated MEM space address */ | ||
485 | pp->mem_mod_base = of_read_number(parser.range - | ||
486 | parser.np + na, ns); | ||
431 | } | 487 | } |
432 | if (restype == 0) { | 488 | if (restype == 0) { |
433 | of_pci_range_to_resource(&range, np, &pp->cfg); | 489 | of_pci_range_to_resource(&range, np, &pp->cfg); |
434 | pp->config.cfg0_size = resource_size(&pp->cfg)/2; | 490 | pp->config.cfg0_size = resource_size(&pp->cfg)/2; |
435 | pp->config.cfg1_size = resource_size(&pp->cfg)/2; | 491 | pp->config.cfg1_size = resource_size(&pp->cfg)/2; |
492 | pp->cfg0_base = pp->cfg.start; | ||
493 | pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; | ||
494 | |||
495 | /* Find the untranslated configuration space address */ | ||
496 | pp->cfg0_mod_base = of_read_number(parser.range - | ||
497 | parser.np + na, ns); | ||
498 | pp->cfg1_mod_base = pp->cfg0_mod_base + | ||
499 | pp->config.cfg0_size; | ||
436 | } | 500 | } |
437 | } | 501 | } |
438 | 502 | ||
@@ -445,8 +509,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
445 | } | 509 | } |
446 | } | 510 | } |
447 | 511 | ||
448 | pp->cfg0_base = pp->cfg.start; | ||
449 | pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; | ||
450 | pp->mem_base = pp->mem.start; | 512 | pp->mem_base = pp->mem.start; |
451 | 513 | ||
452 | pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, | 514 | pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, |
@@ -509,9 +571,9 @@ static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev) | |||
509 | /* Program viewport 0 : OUTBOUND : CFG0 */ | 571 | /* Program viewport 0 : OUTBOUND : CFG0 */ |
510 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, | 572 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, |
511 | PCIE_ATU_VIEWPORT); | 573 | PCIE_ATU_VIEWPORT); |
512 | dw_pcie_writel_rc(pp, pp->cfg0_base, PCIE_ATU_LOWER_BASE); | 574 | dw_pcie_writel_rc(pp, pp->cfg0_mod_base, PCIE_ATU_LOWER_BASE); |
513 | dw_pcie_writel_rc(pp, (pp->cfg0_base >> 32), PCIE_ATU_UPPER_BASE); | 575 | dw_pcie_writel_rc(pp, (pp->cfg0_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
514 | dw_pcie_writel_rc(pp, pp->cfg0_base + pp->config.cfg0_size - 1, | 576 | dw_pcie_writel_rc(pp, pp->cfg0_mod_base + pp->config.cfg0_size - 1, |
515 | PCIE_ATU_LIMIT); | 577 | PCIE_ATU_LIMIT); |
516 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); | 578 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); |
517 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); | 579 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); |
@@ -525,9 +587,9 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev) | |||
525 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, | 587 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
526 | PCIE_ATU_VIEWPORT); | 588 | PCIE_ATU_VIEWPORT); |
527 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); | 589 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); |
528 | dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE); | 590 | dw_pcie_writel_rc(pp, pp->cfg1_mod_base, PCIE_ATU_LOWER_BASE); |
529 | dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE); | 591 | dw_pcie_writel_rc(pp, (pp->cfg1_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
530 | dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1, | 592 | dw_pcie_writel_rc(pp, pp->cfg1_mod_base + pp->config.cfg1_size - 1, |
531 | PCIE_ATU_LIMIT); | 593 | PCIE_ATU_LIMIT); |
532 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); | 594 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); |
533 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); | 595 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); |
@@ -540,9 +602,9 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) | |||
540 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, | 602 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, |
541 | PCIE_ATU_VIEWPORT); | 603 | PCIE_ATU_VIEWPORT); |
542 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); | 604 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); |
543 | dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE); | 605 | dw_pcie_writel_rc(pp, pp->mem_mod_base, PCIE_ATU_LOWER_BASE); |
544 | dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE); | 606 | dw_pcie_writel_rc(pp, (pp->mem_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
545 | dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1, | 607 | dw_pcie_writel_rc(pp, pp->mem_mod_base + pp->config.mem_size - 1, |
546 | PCIE_ATU_LIMIT); | 608 | PCIE_ATU_LIMIT); |
547 | dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); | 609 | dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); |
548 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), | 610 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), |
@@ -556,9 +618,9 @@ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) | |||
556 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, | 618 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
557 | PCIE_ATU_VIEWPORT); | 619 | PCIE_ATU_VIEWPORT); |
558 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); | 620 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); |
559 | dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE); | 621 | dw_pcie_writel_rc(pp, pp->io_mod_base, PCIE_ATU_LOWER_BASE); |
560 | dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE); | 622 | dw_pcie_writel_rc(pp, (pp->io_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
561 | dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1, | 623 | dw_pcie_writel_rc(pp, pp->io_mod_base + pp->config.io_size - 1, |
562 | PCIE_ATU_LIMIT); | 624 | PCIE_ATU_LIMIT); |
563 | dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); | 625 | dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); |
564 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), | 626 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), |
@@ -656,7 +718,11 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | |||
656 | } | 718 | } |
657 | 719 | ||
658 | if (bus->number != pp->root_bus_nr) | 720 | if (bus->number != pp->root_bus_nr) |
659 | ret = dw_pcie_rd_other_conf(pp, bus, devfn, | 721 | if (pp->ops->rd_other_conf) |
722 | ret = pp->ops->rd_other_conf(pp, bus, devfn, | ||
723 | where, size, val); | ||
724 | else | ||
725 | ret = dw_pcie_rd_other_conf(pp, bus, devfn, | ||
660 | where, size, val); | 726 | where, size, val); |
661 | else | 727 | else |
662 | ret = dw_pcie_rd_own_conf(pp, where, size, val); | 728 | ret = dw_pcie_rd_own_conf(pp, where, size, val); |
@@ -679,7 +745,11 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | |||
679 | return PCIBIOS_DEVICE_NOT_FOUND; | 745 | return PCIBIOS_DEVICE_NOT_FOUND; |
680 | 746 | ||
681 | if (bus->number != pp->root_bus_nr) | 747 | if (bus->number != pp->root_bus_nr) |
682 | ret = dw_pcie_wr_other_conf(pp, bus, devfn, | 748 | if (pp->ops->wr_other_conf) |
749 | ret = pp->ops->wr_other_conf(pp, bus, devfn, | ||
750 | where, size, val); | ||
751 | else | ||
752 | ret = dw_pcie_wr_other_conf(pp, bus, devfn, | ||
683 | where, size, val); | 753 | where, size, val); |
684 | else | 754 | else |
685 | ret = dw_pcie_wr_own_conf(pp, where, size, val); | 755 | ret = dw_pcie_wr_own_conf(pp, where, size, val); |
diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index 77f592faa7bf..daf81f922cda 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h | |||
@@ -36,11 +36,15 @@ struct pcie_port { | |||
36 | u8 root_bus_nr; | 36 | u8 root_bus_nr; |
37 | void __iomem *dbi_base; | 37 | void __iomem *dbi_base; |
38 | u64 cfg0_base; | 38 | u64 cfg0_base; |
39 | u64 cfg0_mod_base; | ||
39 | void __iomem *va_cfg0_base; | 40 | void __iomem *va_cfg0_base; |
40 | u64 cfg1_base; | 41 | u64 cfg1_base; |
42 | u64 cfg1_mod_base; | ||
41 | void __iomem *va_cfg1_base; | 43 | void __iomem *va_cfg1_base; |
42 | u64 io_base; | 44 | u64 io_base; |
45 | u64 io_mod_base; | ||
43 | u64 mem_base; | 46 | u64 mem_base; |
47 | u64 mem_mod_base; | ||
44 | struct resource cfg; | 48 | struct resource cfg; |
45 | struct resource io; | 49 | struct resource io; |
46 | struct resource mem; | 50 | struct resource mem; |
@@ -61,8 +65,15 @@ struct pcie_host_ops { | |||
61 | u32 val, void __iomem *dbi_base); | 65 | u32 val, void __iomem *dbi_base); |
62 | int (*rd_own_conf)(struct pcie_port *pp, int where, int size, u32 *val); | 66 | int (*rd_own_conf)(struct pcie_port *pp, int where, int size, u32 *val); |
63 | int (*wr_own_conf)(struct pcie_port *pp, int where, int size, u32 val); | 67 | int (*wr_own_conf)(struct pcie_port *pp, int where, int size, u32 val); |
68 | int (*rd_other_conf)(struct pcie_port *pp, struct pci_bus *bus, | ||
69 | unsigned int devfn, int where, int size, u32 *val); | ||
70 | int (*wr_other_conf)(struct pcie_port *pp, struct pci_bus *bus, | ||
71 | unsigned int devfn, int where, int size, u32 val); | ||
64 | int (*link_up)(struct pcie_port *pp); | 72 | int (*link_up)(struct pcie_port *pp); |
65 | void (*host_init)(struct pcie_port *pp); | 73 | void (*host_init)(struct pcie_port *pp); |
74 | void (*msi_set_irq)(struct pcie_port *pp, int irq); | ||
75 | void (*msi_clear_irq)(struct pcie_port *pp, int irq); | ||
76 | u32 (*get_msi_data)(struct pcie_port *pp); | ||
66 | }; | 77 | }; |
67 | 78 | ||
68 | int dw_pcie_cfg_read(void __iomem *addr, int where, int size, u32 *val); | 79 | int dw_pcie_cfg_read(void __iomem *addr, int where, int size, u32 *val); |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 70741c8c46a0..6cd5160fc057 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -560,19 +560,15 @@ static void disable_slot(struct acpiphp_slot *slot) | |||
560 | slot->flags &= (~SLOT_ENABLED); | 560 | slot->flags &= (~SLOT_ENABLED); |
561 | } | 561 | } |
562 | 562 | ||
563 | static bool acpiphp_no_hotplug(struct acpi_device *adev) | ||
564 | { | ||
565 | return adev && adev->flags.no_hotplug; | ||
566 | } | ||
567 | |||
568 | static bool slot_no_hotplug(struct acpiphp_slot *slot) | 563 | static bool slot_no_hotplug(struct acpiphp_slot *slot) |
569 | { | 564 | { |
570 | struct acpiphp_func *func; | 565 | struct pci_bus *bus = slot->bus; |
566 | struct pci_dev *dev; | ||
571 | 567 | ||
572 | list_for_each_entry(func, &slot->funcs, sibling) | 568 | list_for_each_entry(dev, &bus->devices, bus_list) { |
573 | if (acpiphp_no_hotplug(func_to_acpi_device(func))) | 569 | if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug) |
574 | return true; | 570 | return true; |
575 | 571 | } | |
576 | return false; | 572 | return false; |
577 | } | 573 | } |
578 | 574 | ||
@@ -645,7 +641,7 @@ static void trim_stale_devices(struct pci_dev *dev) | |||
645 | 641 | ||
646 | status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); | 642 | status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); |
647 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) | 643 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) |
648 | || acpiphp_no_hotplug(adev); | 644 | || dev->ignore_hotplug; |
649 | } | 645 | } |
650 | if (!alive) | 646 | if (!alive) |
651 | alive = pci_device_is_present(dev); | 647 | alive = pci_device_is_present(dev); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 9da84b8b27d8..2a412fa3b338 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -160,7 +160,7 @@ static void pcie_wait_cmd(struct controller *ctrl) | |||
160 | ctrl->slot_ctrl & PCI_EXP_SLTCTL_CCIE) | 160 | ctrl->slot_ctrl & PCI_EXP_SLTCTL_CCIE) |
161 | rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout); | 161 | rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout); |
162 | else | 162 | else |
163 | rc = pcie_poll_cmd(ctrl, timeout); | 163 | rc = pcie_poll_cmd(ctrl, jiffies_to_msecs(timeout)); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * Controllers with errata like Intel CF118 don't generate | 166 | * Controllers with errata like Intel CF118 don't generate |
@@ -506,6 +506,8 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
506 | { | 506 | { |
507 | struct controller *ctrl = (struct controller *)dev_id; | 507 | struct controller *ctrl = (struct controller *)dev_id; |
508 | struct pci_dev *pdev = ctrl_dev(ctrl); | 508 | struct pci_dev *pdev = ctrl_dev(ctrl); |
509 | struct pci_bus *subordinate = pdev->subordinate; | ||
510 | struct pci_dev *dev; | ||
509 | struct slot *slot = ctrl->slot; | 511 | struct slot *slot = ctrl->slot; |
510 | u16 detected, intr_loc; | 512 | u16 detected, intr_loc; |
511 | 513 | ||
@@ -539,6 +541,16 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
539 | wake_up(&ctrl->queue); | 541 | wake_up(&ctrl->queue); |
540 | } | 542 | } |
541 | 543 | ||
544 | if (subordinate) { | ||
545 | list_for_each_entry(dev, &subordinate->devices, bus_list) { | ||
546 | if (dev->ignore_hotplug) { | ||
547 | ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n", | ||
548 | intr_loc, pci_name(dev)); | ||
549 | return IRQ_HANDLED; | ||
550 | } | ||
551 | } | ||
552 | } | ||
553 | |||
542 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) | 554 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) |
543 | return IRQ_HANDLED; | 555 | return IRQ_HANDLED; |
544 | 556 | ||
diff --git a/drivers/pci/hotplug/pcihp_slot.c b/drivers/pci/hotplug/pcihp_slot.c index e246a10a0d2c..3e36ec8d708a 100644 --- a/drivers/pci/hotplug/pcihp_slot.c +++ b/drivers/pci/hotplug/pcihp_slot.c | |||
@@ -46,7 +46,6 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp) | |||
46 | */ | 46 | */ |
47 | if (pci_is_pcie(dev)) | 47 | if (pci_is_pcie(dev)) |
48 | return; | 48 | return; |
49 | dev_info(&dev->dev, "using default PCI settings\n"); | ||
50 | hpp = &pci_default_type0; | 49 | hpp = &pci_default_type0; |
51 | } | 50 | } |
52 | 51 | ||
@@ -153,7 +152,6 @@ void pci_configure_slot(struct pci_dev *dev) | |||
153 | { | 152 | { |
154 | struct pci_dev *cdev; | 153 | struct pci_dev *cdev; |
155 | struct hotplug_params hpp; | 154 | struct hotplug_params hpp; |
156 | int ret; | ||
157 | 155 | ||
158 | if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || | 156 | if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || |
159 | (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && | 157 | (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && |
@@ -163,9 +161,7 @@ void pci_configure_slot(struct pci_dev *dev) | |||
163 | pcie_bus_configure_settings(dev->bus); | 161 | pcie_bus_configure_settings(dev->bus); |
164 | 162 | ||
165 | memset(&hpp, 0, sizeof(hpp)); | 163 | memset(&hpp, 0, sizeof(hpp)); |
166 | ret = pci_get_hp_params(dev, &hpp); | 164 | pci_get_hp_params(dev, &hpp); |
167 | if (ret) | ||
168 | dev_warn(&dev->dev, "no hotplug settings from platform\n"); | ||
169 | 165 | ||
170 | program_hpp_type2(dev, hpp.t2); | 166 | program_hpp_type2(dev, hpp.t2); |
171 | program_hpp_type1(dev, hpp.t1); | 167 | program_hpp_type1(dev, hpp.t1); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index e3cf8a2e6292..4170113cde61 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -775,7 +775,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
775 | /* Check if setup is sensible at all */ | 775 | /* Check if setup is sensible at all */ |
776 | if (!pass && | 776 | if (!pass && |
777 | (primary != bus->number || secondary <= bus->number || | 777 | (primary != bus->number || secondary <= bus->number || |
778 | secondary > subordinate || subordinate > bus->busn_res.end)) { | 778 | secondary > subordinate)) { |
779 | dev_info(&dev->dev, "bridge configuration invalid ([bus %02x-%02x]), reconfiguring\n", | 779 | dev_info(&dev->dev, "bridge configuration invalid ([bus %02x-%02x]), reconfiguring\n", |
780 | secondary, subordinate); | 780 | secondary, subordinate); |
781 | broken = 1; | 781 | broken = 1; |
@@ -838,23 +838,18 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
838 | goto out; | 838 | goto out; |
839 | } | 839 | } |
840 | 840 | ||
841 | if (max >= bus->busn_res.end) { | ||
842 | dev_warn(&dev->dev, "can't allocate child bus %02x from %pR\n", | ||
843 | max, &bus->busn_res); | ||
844 | goto out; | ||
845 | } | ||
846 | |||
847 | /* Clear errors */ | 841 | /* Clear errors */ |
848 | pci_write_config_word(dev, PCI_STATUS, 0xffff); | 842 | pci_write_config_word(dev, PCI_STATUS, 0xffff); |
849 | 843 | ||
850 | /* The bus will already exist if we are rescanning */ | 844 | /* Prevent assigning a bus number that already exists. |
845 | * This can happen when a bridge is hot-plugged, so in | ||
846 | * this case we only re-scan this bus. */ | ||
851 | child = pci_find_bus(pci_domain_nr(bus), max+1); | 847 | child = pci_find_bus(pci_domain_nr(bus), max+1); |
852 | if (!child) { | 848 | if (!child) { |
853 | child = pci_add_new_bus(bus, dev, max+1); | 849 | child = pci_add_new_bus(bus, dev, max+1); |
854 | if (!child) | 850 | if (!child) |
855 | goto out; | 851 | goto out; |
856 | pci_bus_insert_busn_res(child, max+1, | 852 | pci_bus_insert_busn_res(child, max+1, 0xff); |
857 | bus->busn_res.end); | ||
858 | } | 853 | } |
859 | max++; | 854 | max++; |
860 | buses = (buses & 0xff000000) | 855 | buses = (buses & 0xff000000) |
@@ -913,11 +908,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
913 | /* | 908 | /* |
914 | * Set the subordinate bus number to its real value. | 909 | * Set the subordinate bus number to its real value. |
915 | */ | 910 | */ |
916 | if (max > bus->busn_res.end) { | ||
917 | dev_warn(&dev->dev, "max busn %02x is outside %pR\n", | ||
918 | max, &bus->busn_res); | ||
919 | max = bus->busn_res.end; | ||
920 | } | ||
921 | pci_bus_update_busn_res_end(child, max); | 911 | pci_bus_update_busn_res_end(child, max); |
922 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); | 912 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); |
923 | } | 913 | } |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 0dd742719154..f833aa271a2e 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -41,9 +41,9 @@ config PHY_MVEBU_SATA | |||
41 | config PHY_MIPHY365X | 41 | config PHY_MIPHY365X |
42 | tristate "STMicroelectronics MIPHY365X PHY driver for STiH41x series" | 42 | tristate "STMicroelectronics MIPHY365X PHY driver for STiH41x series" |
43 | depends on ARCH_STI | 43 | depends on ARCH_STI |
44 | depends on GENERIC_PHY | ||
45 | depends on HAS_IOMEM | 44 | depends on HAS_IOMEM |
46 | depends on OF | 45 | depends on OF |
46 | select GENERIC_PHY | ||
47 | help | 47 | help |
48 | Enable this to support the miphy transceiver (for SATA/PCIE) | 48 | Enable this to support the miphy transceiver (for SATA/PCIE) |
49 | that is part of STMicroelectronics STiH41x SoC series. | 49 | that is part of STMicroelectronics STiH41x SoC series. |
@@ -214,12 +214,14 @@ config PHY_QCOM_IPQ806X_SATA | |||
214 | config PHY_ST_SPEAR1310_MIPHY | 214 | config PHY_ST_SPEAR1310_MIPHY |
215 | tristate "ST SPEAR1310-MIPHY driver" | 215 | tristate "ST SPEAR1310-MIPHY driver" |
216 | select GENERIC_PHY | 216 | select GENERIC_PHY |
217 | depends on MACH_SPEAR1310 || COMPILE_TEST | ||
217 | help | 218 | help |
218 | Support for ST SPEAr1310 MIPHY which can be used for PCIe and SATA. | 219 | Support for ST SPEAr1310 MIPHY which can be used for PCIe and SATA. |
219 | 220 | ||
220 | config PHY_ST_SPEAR1340_MIPHY | 221 | config PHY_ST_SPEAR1340_MIPHY |
221 | tristate "ST SPEAR1340-MIPHY driver" | 222 | tristate "ST SPEAR1340-MIPHY driver" |
222 | select GENERIC_PHY | 223 | select GENERIC_PHY |
224 | depends on MACH_SPEAR1340 || COMPILE_TEST | ||
223 | help | 225 | help |
224 | Support for ST SPEAr1340 MIPHY which can be used for PCIe and SATA. | 226 | Support for ST SPEAr1340 MIPHY which can be used for PCIe and SATA. |
225 | 227 | ||
diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index b05302b09c9f..392101c8d6b0 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c | |||
@@ -542,6 +542,7 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { | |||
542 | }, | 542 | }, |
543 | { }, | 543 | { }, |
544 | }; | 544 | }; |
545 | MODULE_DEVICE_TABLE(of, exynos5_usbdrd_phy_of_match); | ||
545 | 546 | ||
546 | static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) | 547 | static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) |
547 | { | 548 | { |
diff --git a/drivers/phy/phy-miphy365x.c b/drivers/phy/phy-miphy365x.c index e111baf187ce..e0fb7a1e5a5a 100644 --- a/drivers/phy/phy-miphy365x.c +++ b/drivers/phy/phy-miphy365x.c | |||
@@ -163,6 +163,7 @@ enum miphy_sata_gen { | |||
163 | }; | 163 | }; |
164 | 164 | ||
165 | static u8 rx_tx_spd[] = { | 165 | static u8 rx_tx_spd[] = { |
166 | 0, /* GEN0 doesn't exist. */ | ||
166 | TX_SPDSEL_GEN1_VAL | RX_SPDSEL_GEN1_VAL, | 167 | TX_SPDSEL_GEN1_VAL | RX_SPDSEL_GEN1_VAL, |
167 | TX_SPDSEL_GEN2_VAL | RX_SPDSEL_GEN2_VAL, | 168 | TX_SPDSEL_GEN2_VAL | RX_SPDSEL_GEN2_VAL, |
168 | TX_SPDSEL_GEN3_VAL | RX_SPDSEL_GEN3_VAL | 169 | TX_SPDSEL_GEN3_VAL | RX_SPDSEL_GEN3_VAL |
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index e1a6623d4696..9cd33a4bcfb1 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/usb/otg.h> | 35 | #include <linux/usb/otg.h> |
36 | #include <linux/phy/phy.h> | 36 | #include <linux/phy/phy.h> |
37 | #include <linux/pm_runtime.h> | ||
37 | #include <linux/usb/musb-omap.h> | 38 | #include <linux/usb/musb-omap.h> |
38 | #include <linux/usb/ulpi.h> | 39 | #include <linux/usb/ulpi.h> |
39 | #include <linux/i2c/twl.h> | 40 | #include <linux/i2c/twl.h> |
@@ -422,37 +423,55 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on) | |||
422 | } | 423 | } |
423 | } | 424 | } |
424 | 425 | ||
425 | static int twl4030_phy_power_off(struct phy *phy) | 426 | static int twl4030_usb_runtime_suspend(struct device *dev) |
426 | { | 427 | { |
427 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 428 | struct twl4030_usb *twl = dev_get_drvdata(dev); |
428 | 429 | ||
430 | dev_dbg(twl->dev, "%s\n", __func__); | ||
429 | if (twl->asleep) | 431 | if (twl->asleep) |
430 | return 0; | 432 | return 0; |
431 | 433 | ||
432 | twl4030_phy_power(twl, 0); | 434 | twl4030_phy_power(twl, 0); |
433 | twl->asleep = 1; | 435 | twl->asleep = 1; |
434 | dev_dbg(twl->dev, "%s\n", __func__); | 436 | |
435 | return 0; | 437 | return 0; |
436 | } | 438 | } |
437 | 439 | ||
438 | static void __twl4030_phy_power_on(struct twl4030_usb *twl) | 440 | static int twl4030_usb_runtime_resume(struct device *dev) |
439 | { | 441 | { |
442 | struct twl4030_usb *twl = dev_get_drvdata(dev); | ||
443 | |||
444 | dev_dbg(twl->dev, "%s\n", __func__); | ||
445 | if (!twl->asleep) | ||
446 | return 0; | ||
447 | |||
440 | twl4030_phy_power(twl, 1); | 448 | twl4030_phy_power(twl, 1); |
441 | twl4030_i2c_access(twl, 1); | 449 | twl->asleep = 0; |
442 | twl4030_usb_set_mode(twl, twl->usb_mode); | 450 | |
443 | if (twl->usb_mode == T2_USB_MODE_ULPI) | 451 | return 0; |
444 | twl4030_i2c_access(twl, 0); | 452 | } |
453 | |||
454 | static int twl4030_phy_power_off(struct phy *phy) | ||
455 | { | ||
456 | struct twl4030_usb *twl = phy_get_drvdata(phy); | ||
457 | |||
458 | dev_dbg(twl->dev, "%s\n", __func__); | ||
459 | pm_runtime_mark_last_busy(twl->dev); | ||
460 | pm_runtime_put_autosuspend(twl->dev); | ||
461 | |||
462 | return 0; | ||
445 | } | 463 | } |
446 | 464 | ||
447 | static int twl4030_phy_power_on(struct phy *phy) | 465 | static int twl4030_phy_power_on(struct phy *phy) |
448 | { | 466 | { |
449 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 467 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
450 | 468 | ||
451 | if (!twl->asleep) | ||
452 | return 0; | ||
453 | __twl4030_phy_power_on(twl); | ||
454 | twl->asleep = 0; | ||
455 | dev_dbg(twl->dev, "%s\n", __func__); | 469 | dev_dbg(twl->dev, "%s\n", __func__); |
470 | pm_runtime_get_sync(twl->dev); | ||
471 | twl4030_i2c_access(twl, 1); | ||
472 | twl4030_usb_set_mode(twl, twl->usb_mode); | ||
473 | if (twl->usb_mode == T2_USB_MODE_ULPI) | ||
474 | twl4030_i2c_access(twl, 0); | ||
456 | 475 | ||
457 | /* | 476 | /* |
458 | * XXX When VBUS gets driven after musb goes to A mode, | 477 | * XXX When VBUS gets driven after musb goes to A mode, |
@@ -558,9 +577,27 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
558 | * USB_LINK_VBUS state. musb_hdrc won't care until it | 577 | * USB_LINK_VBUS state. musb_hdrc won't care until it |
559 | * starts to handle softconnect right. | 578 | * starts to handle softconnect right. |
560 | */ | 579 | */ |
580 | if ((status == OMAP_MUSB_VBUS_VALID) || | ||
581 | (status == OMAP_MUSB_ID_GROUND)) { | ||
582 | if (twl->asleep) | ||
583 | pm_runtime_get_sync(twl->dev); | ||
584 | } else { | ||
585 | if (!twl->asleep) { | ||
586 | pm_runtime_mark_last_busy(twl->dev); | ||
587 | pm_runtime_put_autosuspend(twl->dev); | ||
588 | } | ||
589 | } | ||
561 | omap_musb_mailbox(status); | 590 | omap_musb_mailbox(status); |
562 | } | 591 | } |
563 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 592 | |
593 | /* don't schedule during sleep - irq works right then */ | ||
594 | if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { | ||
595 | cancel_delayed_work(&twl->id_workaround_work); | ||
596 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
597 | } | ||
598 | |||
599 | if (irq) | ||
600 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | ||
564 | 601 | ||
565 | return IRQ_HANDLED; | 602 | return IRQ_HANDLED; |
566 | } | 603 | } |
@@ -569,29 +606,8 @@ static void twl4030_id_workaround_work(struct work_struct *work) | |||
569 | { | 606 | { |
570 | struct twl4030_usb *twl = container_of(work, struct twl4030_usb, | 607 | struct twl4030_usb *twl = container_of(work, struct twl4030_usb, |
571 | id_workaround_work.work); | 608 | id_workaround_work.work); |
572 | enum omap_musb_vbus_id_status status; | ||
573 | bool status_changed = false; | ||
574 | |||
575 | status = twl4030_usb_linkstat(twl); | ||
576 | |||
577 | spin_lock_irq(&twl->lock); | ||
578 | if (status >= 0 && status != twl->linkstat) { | ||
579 | twl->linkstat = status; | ||
580 | status_changed = true; | ||
581 | } | ||
582 | spin_unlock_irq(&twl->lock); | ||
583 | |||
584 | if (status_changed) { | ||
585 | dev_dbg(twl->dev, "handle missing status change to %d\n", | ||
586 | status); | ||
587 | omap_musb_mailbox(status); | ||
588 | } | ||
589 | 609 | ||
590 | /* don't schedule during sleep - irq works right then */ | 610 | twl4030_usb_irq(0, twl); |
591 | if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { | ||
592 | cancel_delayed_work(&twl->id_workaround_work); | ||
593 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
594 | } | ||
595 | } | 611 | } |
596 | 612 | ||
597 | static int twl4030_phy_init(struct phy *phy) | 613 | static int twl4030_phy_init(struct phy *phy) |
@@ -599,22 +615,17 @@ static int twl4030_phy_init(struct phy *phy) | |||
599 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 615 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
600 | enum omap_musb_vbus_id_status status; | 616 | enum omap_musb_vbus_id_status status; |
601 | 617 | ||
602 | /* | 618 | pm_runtime_get_sync(twl->dev); |
603 | * Start in sleep state, we'll get called through set_suspend() | ||
604 | * callback when musb is runtime resumed and it's time to start. | ||
605 | */ | ||
606 | __twl4030_phy_power(twl, 0); | ||
607 | twl->asleep = 1; | ||
608 | |||
609 | status = twl4030_usb_linkstat(twl); | 619 | status = twl4030_usb_linkstat(twl); |
610 | twl->linkstat = status; | 620 | twl->linkstat = status; |
611 | 621 | ||
612 | if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) { | 622 | if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) |
613 | omap_musb_mailbox(twl->linkstat); | 623 | omap_musb_mailbox(twl->linkstat); |
614 | twl4030_phy_power_on(phy); | ||
615 | } | ||
616 | 624 | ||
617 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 625 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); |
626 | pm_runtime_mark_last_busy(twl->dev); | ||
627 | pm_runtime_put_autosuspend(twl->dev); | ||
628 | |||
618 | return 0; | 629 | return 0; |
619 | } | 630 | } |
620 | 631 | ||
@@ -650,6 +661,11 @@ static const struct phy_ops ops = { | |||
650 | .owner = THIS_MODULE, | 661 | .owner = THIS_MODULE, |
651 | }; | 662 | }; |
652 | 663 | ||
664 | static const struct dev_pm_ops twl4030_usb_pm_ops = { | ||
665 | SET_RUNTIME_PM_OPS(twl4030_usb_runtime_suspend, | ||
666 | twl4030_usb_runtime_resume, NULL) | ||
667 | }; | ||
668 | |||
653 | static int twl4030_usb_probe(struct platform_device *pdev) | 669 | static int twl4030_usb_probe(struct platform_device *pdev) |
654 | { | 670 | { |
655 | struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev); | 671 | struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev); |
@@ -726,6 +742,11 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
726 | 742 | ||
727 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); | 743 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); |
728 | 744 | ||
745 | pm_runtime_use_autosuspend(&pdev->dev); | ||
746 | pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); | ||
747 | pm_runtime_enable(&pdev->dev); | ||
748 | pm_runtime_get_sync(&pdev->dev); | ||
749 | |||
729 | /* Our job is to use irqs and status from the power module | 750 | /* Our job is to use irqs and status from the power module |
730 | * to keep the transceiver disabled when nothing's connected. | 751 | * to keep the transceiver disabled when nothing's connected. |
731 | * | 752 | * |
@@ -744,6 +765,9 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
744 | return status; | 765 | return status; |
745 | } | 766 | } |
746 | 767 | ||
768 | pm_runtime_mark_last_busy(&pdev->dev); | ||
769 | pm_runtime_put_autosuspend(twl->dev); | ||
770 | |||
747 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); | 771 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); |
748 | return 0; | 772 | return 0; |
749 | } | 773 | } |
@@ -753,6 +777,7 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
753 | struct twl4030_usb *twl = platform_get_drvdata(pdev); | 777 | struct twl4030_usb *twl = platform_get_drvdata(pdev); |
754 | int val; | 778 | int val; |
755 | 779 | ||
780 | pm_runtime_get_sync(twl->dev); | ||
756 | cancel_delayed_work(&twl->id_workaround_work); | 781 | cancel_delayed_work(&twl->id_workaround_work); |
757 | device_remove_file(twl->dev, &dev_attr_vbus); | 782 | device_remove_file(twl->dev, &dev_attr_vbus); |
758 | 783 | ||
@@ -772,9 +797,8 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
772 | 797 | ||
773 | /* disable complete OTG block */ | 798 | /* disable complete OTG block */ |
774 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); | 799 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); |
775 | 800 | pm_runtime_mark_last_busy(twl->dev); | |
776 | if (!twl->asleep) | 801 | pm_runtime_put(twl->dev); |
777 | twl4030_phy_power(twl, 0); | ||
778 | 802 | ||
779 | return 0; | 803 | return 0; |
780 | } | 804 | } |
@@ -792,6 +816,7 @@ static struct platform_driver twl4030_usb_driver = { | |||
792 | .remove = twl4030_usb_remove, | 816 | .remove = twl4030_usb_remove, |
793 | .driver = { | 817 | .driver = { |
794 | .name = "twl4030_usb", | 818 | .name = "twl4030_usb", |
819 | .pm = &twl4030_usb_pm_ops, | ||
795 | .owner = THIS_MODULE, | 820 | .owner = THIS_MODULE, |
796 | .of_match_table = of_match_ptr(twl4030_usb_id_table), | 821 | .of_match_table = of_match_ptr(twl4030_usb_id_table), |
797 | }, | 822 | }, |
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c index a53a689a2bfa..8c6fd8d4dd3c 100644 --- a/drivers/pinctrl/nomadik/pinctrl-abx500.c +++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c | |||
@@ -620,8 +620,7 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s, | |||
620 | } else | 620 | } else |
621 | seq_printf(s, " %-9s", chip->get(chip, offset) ? "hi" : "lo"); | 621 | seq_printf(s, " %-9s", chip->get(chip, offset) ? "hi" : "lo"); |
622 | 622 | ||
623 | if (pctldev) | 623 | mode = abx500_get_mode(pctldev, chip, offset); |
624 | mode = abx500_get_mode(pctldev, chip, offset); | ||
625 | 624 | ||
626 | seq_printf(s, " %s", (mode < 0) ? "unknown" : modes[mode]); | 625 | seq_printf(s, " %s", (mode < 0) ? "unknown" : modes[mode]); |
627 | 626 | ||
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index af1ba4fc150d..60464a2648aa 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
@@ -497,10 +497,10 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = { | |||
497 | static void at91_pin_dbg(const struct device *dev, const struct at91_pmx_pin *pin) | 497 | static void at91_pin_dbg(const struct device *dev, const struct at91_pmx_pin *pin) |
498 | { | 498 | { |
499 | if (pin->mux) { | 499 | if (pin->mux) { |
500 | dev_dbg(dev, "pio%c%d configured as periph%c with conf = 0x%lu\n", | 500 | dev_dbg(dev, "pio%c%d configured as periph%c with conf = 0x%lx\n", |
501 | pin->bank + 'A', pin->pin, pin->mux - 1 + 'A', pin->conf); | 501 | pin->bank + 'A', pin->pin, pin->mux - 1 + 'A', pin->conf); |
502 | } else { | 502 | } else { |
503 | dev_dbg(dev, "pio%c%d configured as gpio with conf = 0x%lu\n", | 503 | dev_dbg(dev, "pio%c%d configured as gpio with conf = 0x%lx\n", |
504 | pin->bank + 'A', pin->pin, pin->conf); | 504 | pin->bank + 'A', pin->pin, pin->conf); |
505 | } | 505 | } |
506 | } | 506 | } |
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 9ca59a018743..e12e5b07f6d7 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -461,6 +461,7 @@ static struct irq_chip byt_irqchip = { | |||
461 | .irq_mask = byt_irq_mask, | 461 | .irq_mask = byt_irq_mask, |
462 | .irq_unmask = byt_irq_unmask, | 462 | .irq_unmask = byt_irq_unmask, |
463 | .irq_set_type = byt_irq_type, | 463 | .irq_set_type = byt_irq_type, |
464 | .flags = IRQCHIP_SKIP_SET_WAKE, | ||
464 | }; | 465 | }; |
465 | 466 | ||
466 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) | 467 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) |
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 5e8b2e04cd7a..0c372a300cb8 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
@@ -438,7 +438,7 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) | |||
438 | int reg, ret, mask; | 438 | int reg, ret, mask; |
439 | unsigned long flags; | 439 | unsigned long flags; |
440 | u8 bit; | 440 | u8 bit; |
441 | u32 data; | 441 | u32 data, rmask; |
442 | 442 | ||
443 | if (iomux_num > 3) | 443 | if (iomux_num > 3) |
444 | return -EINVAL; | 444 | return -EINVAL; |
@@ -478,8 +478,9 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) | |||
478 | spin_lock_irqsave(&bank->slock, flags); | 478 | spin_lock_irqsave(&bank->slock, flags); |
479 | 479 | ||
480 | data = (mask << (bit + 16)); | 480 | data = (mask << (bit + 16)); |
481 | rmask = data | (data >> 16); | ||
481 | data |= (mux & mask) << bit; | 482 | data |= (mux & mask) << bit; |
482 | ret = regmap_write(regmap, reg, data); | 483 | ret = regmap_update_bits(regmap, reg, rmask, data); |
483 | 484 | ||
484 | spin_unlock_irqrestore(&bank->slock, flags); | 485 | spin_unlock_irqrestore(&bank->slock, flags); |
485 | 486 | ||
@@ -634,7 +635,7 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num, | |||
634 | struct regmap *regmap; | 635 | struct regmap *regmap; |
635 | unsigned long flags; | 636 | unsigned long flags; |
636 | int reg, ret, i; | 637 | int reg, ret, i; |
637 | u32 data; | 638 | u32 data, rmask; |
638 | u8 bit; | 639 | u8 bit; |
639 | 640 | ||
640 | rk3288_calc_drv_reg_and_bit(bank, pin_num, ®map, ®, &bit); | 641 | rk3288_calc_drv_reg_and_bit(bank, pin_num, ®map, ®, &bit); |
@@ -657,9 +658,10 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num, | |||
657 | 658 | ||
658 | /* enable the write to the equivalent lower bits */ | 659 | /* enable the write to the equivalent lower bits */ |
659 | data = ((1 << RK3288_DRV_BITS_PER_PIN) - 1) << (bit + 16); | 660 | data = ((1 << RK3288_DRV_BITS_PER_PIN) - 1) << (bit + 16); |
661 | rmask = data | (data >> 16); | ||
660 | data |= (ret << bit); | 662 | data |= (ret << bit); |
661 | 663 | ||
662 | ret = regmap_write(regmap, reg, data); | 664 | ret = regmap_update_bits(regmap, reg, rmask, data); |
663 | spin_unlock_irqrestore(&bank->slock, flags); | 665 | spin_unlock_irqrestore(&bank->slock, flags); |
664 | 666 | ||
665 | return ret; | 667 | return ret; |
@@ -722,7 +724,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, | |||
722 | int reg, ret; | 724 | int reg, ret; |
723 | unsigned long flags; | 725 | unsigned long flags; |
724 | u8 bit; | 726 | u8 bit; |
725 | u32 data; | 727 | u32 data, rmask; |
726 | 728 | ||
727 | dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", | 729 | dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", |
728 | bank->bank_num, pin_num, pull); | 730 | bank->bank_num, pin_num, pull); |
@@ -750,6 +752,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, | |||
750 | 752 | ||
751 | /* enable the write to the equivalent lower bits */ | 753 | /* enable the write to the equivalent lower bits */ |
752 | data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); | 754 | data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); |
755 | rmask = data | (data >> 16); | ||
753 | 756 | ||
754 | switch (pull) { | 757 | switch (pull) { |
755 | case PIN_CONFIG_BIAS_DISABLE: | 758 | case PIN_CONFIG_BIAS_DISABLE: |
@@ -770,7 +773,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, | |||
770 | return -EINVAL; | 773 | return -EINVAL; |
771 | } | 774 | } |
772 | 775 | ||
773 | ret = regmap_write(regmap, reg, data); | 776 | ret = regmap_update_bits(regmap, reg, rmask, data); |
774 | 777 | ||
775 | spin_unlock_irqrestore(&bank->slock, flags); | 778 | spin_unlock_irqrestore(&bank->slock, flags); |
776 | break; | 779 | break; |
diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c index a06620474845..e641b4226c42 100644 --- a/drivers/pinctrl/pinctrl-tegra-xusb.c +++ b/drivers/pinctrl/pinctrl-tegra-xusb.c | |||
@@ -680,7 +680,7 @@ static struct phy *tegra_xusb_padctl_xlate(struct device *dev, | |||
680 | if (args->args_count <= 0) | 680 | if (args->args_count <= 0) |
681 | return ERR_PTR(-EINVAL); | 681 | return ERR_PTR(-EINVAL); |
682 | 682 | ||
683 | if (index > ARRAY_SIZE(padctl->phys)) | 683 | if (index >= ARRAY_SIZE(padctl->phys)) |
684 | return ERR_PTR(-EINVAL); | 684 | return ERR_PTR(-EINVAL); |
685 | 685 | ||
686 | return padctl->phys[index]; | 686 | return padctl->phys[index]; |
@@ -930,7 +930,8 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev) | |||
930 | 930 | ||
931 | padctl->provider = devm_of_phy_provider_register(&pdev->dev, | 931 | padctl->provider = devm_of_phy_provider_register(&pdev->dev, |
932 | tegra_xusb_padctl_xlate); | 932 | tegra_xusb_padctl_xlate); |
933 | if (err < 0) { | 933 | if (IS_ERR(padctl->provider)) { |
934 | err = PTR_ERR(padctl->provider); | ||
934 | dev_err(&pdev->dev, "failed to register PHYs: %d\n", err); | 935 | dev_err(&pdev->dev, "failed to register PHYs: %d\n", err); |
935 | goto unregister; | 936 | goto unregister; |
936 | } | 937 | } |
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 003bfd874a61..d7154ed0b0eb 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c | |||
@@ -127,14 +127,10 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) | |||
127 | struct irq_chip *chip = irq_data_get_irq_chip(irqd); | 127 | struct irq_chip *chip = irq_data_get_irq_chip(irqd); |
128 | struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); | 128 | struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); |
129 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); | 129 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
130 | struct samsung_pin_bank_type *bank_type = bank->type; | ||
131 | struct samsung_pinctrl_drv_data *d = bank->drvdata; | 130 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
132 | unsigned int pin = irqd->hwirq; | 131 | unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; |
133 | unsigned int shift = EXYNOS_EINT_CON_LEN * pin; | ||
134 | unsigned int con, trig_type; | 132 | unsigned int con, trig_type; |
135 | unsigned long reg_con = our_chip->eint_con + bank->eint_offset; | 133 | unsigned long reg_con = our_chip->eint_con + bank->eint_offset; |
136 | unsigned long flags; | ||
137 | unsigned int mask; | ||
138 | 134 | ||
139 | switch (type) { | 135 | switch (type) { |
140 | case IRQ_TYPE_EDGE_RISING: | 136 | case IRQ_TYPE_EDGE_RISING: |
@@ -167,8 +163,32 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) | |||
167 | con |= trig_type << shift; | 163 | con |= trig_type << shift; |
168 | writel(con, d->virt_base + reg_con); | 164 | writel(con, d->virt_base + reg_con); |
169 | 165 | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | static int exynos_irq_request_resources(struct irq_data *irqd) | ||
170 | { | ||
171 | struct irq_chip *chip = irq_data_get_irq_chip(irqd); | ||
172 | struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); | ||
173 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); | ||
174 | struct samsung_pin_bank_type *bank_type = bank->type; | ||
175 | struct samsung_pinctrl_drv_data *d = bank->drvdata; | ||
176 | unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; | ||
177 | unsigned long reg_con = our_chip->eint_con + bank->eint_offset; | ||
178 | unsigned long flags; | ||
179 | unsigned int mask; | ||
180 | unsigned int con; | ||
181 | int ret; | ||
182 | |||
183 | ret = gpio_lock_as_irq(&bank->gpio_chip, irqd->hwirq); | ||
184 | if (ret) { | ||
185 | dev_err(bank->gpio_chip.dev, "unable to lock pin %s-%lu IRQ\n", | ||
186 | bank->name, irqd->hwirq); | ||
187 | return ret; | ||
188 | } | ||
189 | |||
170 | reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; | 190 | reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; |
171 | shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC]; | 191 | shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC]; |
172 | mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; | 192 | mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; |
173 | 193 | ||
174 | spin_lock_irqsave(&bank->slock, flags); | 194 | spin_lock_irqsave(&bank->slock, flags); |
@@ -180,9 +200,42 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) | |||
180 | 200 | ||
181 | spin_unlock_irqrestore(&bank->slock, flags); | 201 | spin_unlock_irqrestore(&bank->slock, flags); |
182 | 202 | ||
203 | exynos_irq_unmask(irqd); | ||
204 | |||
183 | return 0; | 205 | return 0; |
184 | } | 206 | } |
185 | 207 | ||
208 | static void exynos_irq_release_resources(struct irq_data *irqd) | ||
209 | { | ||
210 | struct irq_chip *chip = irq_data_get_irq_chip(irqd); | ||
211 | struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); | ||
212 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); | ||
213 | struct samsung_pin_bank_type *bank_type = bank->type; | ||
214 | struct samsung_pinctrl_drv_data *d = bank->drvdata; | ||
215 | unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; | ||
216 | unsigned long reg_con = our_chip->eint_con + bank->eint_offset; | ||
217 | unsigned long flags; | ||
218 | unsigned int mask; | ||
219 | unsigned int con; | ||
220 | |||
221 | reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; | ||
222 | shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC]; | ||
223 | mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; | ||
224 | |||
225 | exynos_irq_mask(irqd); | ||
226 | |||
227 | spin_lock_irqsave(&bank->slock, flags); | ||
228 | |||
229 | con = readl(d->virt_base + reg_con); | ||
230 | con &= ~(mask << shift); | ||
231 | con |= FUNC_INPUT << shift; | ||
232 | writel(con, d->virt_base + reg_con); | ||
233 | |||
234 | spin_unlock_irqrestore(&bank->slock, flags); | ||
235 | |||
236 | gpio_unlock_as_irq(&bank->gpio_chip, irqd->hwirq); | ||
237 | } | ||
238 | |||
186 | /* | 239 | /* |
187 | * irq_chip for gpio interrupts. | 240 | * irq_chip for gpio interrupts. |
188 | */ | 241 | */ |
@@ -193,6 +246,8 @@ static struct exynos_irq_chip exynos_gpio_irq_chip = { | |||
193 | .irq_mask = exynos_irq_mask, | 246 | .irq_mask = exynos_irq_mask, |
194 | .irq_ack = exynos_irq_ack, | 247 | .irq_ack = exynos_irq_ack, |
195 | .irq_set_type = exynos_irq_set_type, | 248 | .irq_set_type = exynos_irq_set_type, |
249 | .irq_request_resources = exynos_irq_request_resources, | ||
250 | .irq_release_resources = exynos_irq_release_resources, | ||
196 | }, | 251 | }, |
197 | .eint_con = EXYNOS_GPIO_ECON_OFFSET, | 252 | .eint_con = EXYNOS_GPIO_ECON_OFFSET, |
198 | .eint_mask = EXYNOS_GPIO_EMASK_OFFSET, | 253 | .eint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
@@ -336,6 +391,8 @@ static struct exynos_irq_chip exynos_wkup_irq_chip = { | |||
336 | .irq_ack = exynos_irq_ack, | 391 | .irq_ack = exynos_irq_ack, |
337 | .irq_set_type = exynos_irq_set_type, | 392 | .irq_set_type = exynos_irq_set_type, |
338 | .irq_set_wake = exynos_wkup_irq_set_wake, | 393 | .irq_set_wake = exynos_wkup_irq_set_wake, |
394 | .irq_request_resources = exynos_irq_request_resources, | ||
395 | .irq_release_resources = exynos_irq_release_resources, | ||
339 | }, | 396 | }, |
340 | .eint_con = EXYNOS_WKUP_ECON_OFFSET, | 397 | .eint_con = EXYNOS_WKUP_ECON_OFFSET, |
341 | .eint_mask = EXYNOS_WKUP_EMASK_OFFSET, | 398 | .eint_mask = EXYNOS_WKUP_EMASK_OFFSET, |
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h index 2b882320e8e9..5cedc9d26390 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.h +++ b/drivers/pinctrl/samsung/pinctrl-samsung.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
27 | 27 | ||
28 | /* pinmux function number for pin as gpio output line */ | 28 | /* pinmux function number for pin as gpio output line */ |
29 | #define FUNC_INPUT 0x0 | ||
29 | #define FUNC_OUTPUT 0x1 | 30 | #define FUNC_OUTPUT 0x1 |
30 | 31 | ||
31 | /** | 32 | /** |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c index 576d41b459e9..c6e5deba238e 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c | |||
@@ -4509,24 +4509,24 @@ static const char * const audio_clk_groups[] = { | |||
4509 | }; | 4509 | }; |
4510 | 4510 | ||
4511 | static const char * const can0_groups[] = { | 4511 | static const char * const can0_groups[] = { |
4512 | "can0_data_a", | 4512 | "can0_data", |
4513 | "can0_data_b", | 4513 | "can0_data_b", |
4514 | "can0_data_c", | 4514 | "can0_data_c", |
4515 | "can0_data_d", | 4515 | "can0_data_d", |
4516 | "can0_data_e", | 4516 | "can0_data_e", |
4517 | "can0_data_f", | 4517 | "can0_data_f", |
4518 | "can_clk_a", | 4518 | "can_clk", |
4519 | "can_clk_b", | 4519 | "can_clk_b", |
4520 | "can_clk_c", | 4520 | "can_clk_c", |
4521 | "can_clk_d", | 4521 | "can_clk_d", |
4522 | }; | 4522 | }; |
4523 | 4523 | ||
4524 | static const char * const can1_groups[] = { | 4524 | static const char * const can1_groups[] = { |
4525 | "can1_data_a", | 4525 | "can1_data", |
4526 | "can1_data_b", | 4526 | "can1_data_b", |
4527 | "can1_data_c", | 4527 | "can1_data_c", |
4528 | "can1_data_d", | 4528 | "can1_data_d", |
4529 | "can_clk_a", | 4529 | "can_clk", |
4530 | "can_clk_b", | 4530 | "can_clk_b", |
4531 | "can_clk_c", | 4531 | "can_clk_c", |
4532 | "can_clk_d", | 4532 | "can_clk_d", |
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index fc468a3d95ce..02152de135b5 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
@@ -88,7 +88,6 @@ struct ideapad_private { | |||
88 | struct dentry *debug; | 88 | struct dentry *debug; |
89 | unsigned long cfg; | 89 | unsigned long cfg; |
90 | bool has_hw_rfkill_switch; | 90 | bool has_hw_rfkill_switch; |
91 | bool has_touchpad_control; | ||
92 | }; | 91 | }; |
93 | 92 | ||
94 | static bool no_bt_rfkill; | 93 | static bool no_bt_rfkill; |
@@ -456,7 +455,7 @@ struct ideapad_rfk_data { | |||
456 | int type; | 455 | int type; |
457 | }; | 456 | }; |
458 | 457 | ||
459 | const const struct ideapad_rfk_data ideapad_rfk_data[] = { | 458 | static const struct ideapad_rfk_data ideapad_rfk_data[] = { |
460 | { "ideapad_wlan", CFG_WIFI_BIT, VPCCMD_W_WIFI, RFKILL_TYPE_WLAN }, | 459 | { "ideapad_wlan", CFG_WIFI_BIT, VPCCMD_W_WIFI, RFKILL_TYPE_WLAN }, |
461 | { "ideapad_bluetooth", CFG_BT_BIT, VPCCMD_W_BT, RFKILL_TYPE_BLUETOOTH }, | 460 | { "ideapad_bluetooth", CFG_BT_BIT, VPCCMD_W_BT, RFKILL_TYPE_BLUETOOTH }, |
462 | { "ideapad_3g", CFG_3G_BIT, VPCCMD_W_3G, RFKILL_TYPE_WWAN }, | 461 | { "ideapad_3g", CFG_3G_BIT, VPCCMD_W_3G, RFKILL_TYPE_WWAN }, |
@@ -767,9 +766,6 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv) | |||
767 | { | 766 | { |
768 | unsigned long value; | 767 | unsigned long value; |
769 | 768 | ||
770 | if (!priv->has_touchpad_control) | ||
771 | return; | ||
772 | |||
773 | /* Without reading from EC touchpad LED doesn't switch state */ | 769 | /* Without reading from EC touchpad LED doesn't switch state */ |
774 | if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { | 770 | if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { |
775 | /* Some IdeaPads don't really turn off touchpad - they only | 771 | /* Some IdeaPads don't really turn off touchpad - they only |
@@ -833,29 +829,7 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
833 | * always results in 0 on these models, causing ideapad_laptop to wrongly | 829 | * always results in 0 on these models, causing ideapad_laptop to wrongly |
834 | * report all radios as hardware-blocked. | 830 | * report all radios as hardware-blocked. |
835 | */ | 831 | */ |
836 | static struct dmi_system_id no_hw_rfkill_list[] = { | 832 | static const struct dmi_system_id no_hw_rfkill_list[] = { |
837 | { | ||
838 | .ident = "Lenovo Yoga 2 11 / 13 / Pro", | ||
839 | .matches = { | ||
840 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
841 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"), | ||
842 | }, | ||
843 | }, | ||
844 | {} | ||
845 | }; | ||
846 | |||
847 | /* | ||
848 | * Some models don't offer touchpad ctrl through the ideapad interface, causing | ||
849 | * ideapad_sync_touchpad_state to send wrong touchpad enable/disable events. | ||
850 | */ | ||
851 | static struct dmi_system_id no_touchpad_ctrl_list[] = { | ||
852 | { | ||
853 | .ident = "Lenovo Yoga 1 series", | ||
854 | .matches = { | ||
855 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
856 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga"), | ||
857 | }, | ||
858 | }, | ||
859 | { | 833 | { |
860 | .ident = "Lenovo Yoga 2 11 / 13 / Pro", | 834 | .ident = "Lenovo Yoga 2 11 / 13 / Pro", |
861 | .matches = { | 835 | .matches = { |
@@ -889,7 +863,6 @@ static int ideapad_acpi_add(struct platform_device *pdev) | |||
889 | priv->adev = adev; | 863 | priv->adev = adev; |
890 | priv->platform_device = pdev; | 864 | priv->platform_device = pdev; |
891 | priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list); | 865 | priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list); |
892 | priv->has_touchpad_control = !dmi_check_system(no_touchpad_ctrl_list); | ||
893 | 866 | ||
894 | ret = ideapad_sysfs_init(priv); | 867 | ret = ideapad_sysfs_init(priv); |
895 | if (ret) | 868 | if (ret) |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index e4da61bcbf8b..d0dce734b2ed 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1255,10 +1255,15 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | |||
1255 | const char *buf, size_t count) | 1255 | const char *buf, size_t count) |
1256 | { | 1256 | { |
1257 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); | 1257 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); |
1258 | int mode = -1; | 1258 | int mode; |
1259 | int time = -1; | 1259 | int time; |
1260 | int ret; | ||
1260 | 1261 | ||
1261 | if (sscanf(buf, "%i", &mode) != 1 || (mode != 2 || mode != 1)) | 1262 | |
1263 | ret = kstrtoint(buf, 0, &mode); | ||
1264 | if (ret) | ||
1265 | return ret; | ||
1266 | if (mode != SCI_KBD_MODE_FNZ && mode != SCI_KBD_MODE_AUTO) | ||
1262 | return -EINVAL; | 1267 | return -EINVAL; |
1263 | 1268 | ||
1264 | /* Set the Keyboard Backlight Mode where: | 1269 | /* Set the Keyboard Backlight Mode where: |
@@ -1266,11 +1271,12 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | |||
1266 | * Auto - KBD backlight turns off automatically in given time | 1271 | * Auto - KBD backlight turns off automatically in given time |
1267 | * FN-Z - KBD backlight "toggles" when hotkey pressed | 1272 | * FN-Z - KBD backlight "toggles" when hotkey pressed |
1268 | */ | 1273 | */ |
1269 | if (mode != -1 && toshiba->kbd_mode != mode) { | 1274 | if (toshiba->kbd_mode != mode) { |
1270 | time = toshiba->kbd_time << HCI_MISC_SHIFT; | 1275 | time = toshiba->kbd_time << HCI_MISC_SHIFT; |
1271 | time = time + toshiba->kbd_mode; | 1276 | time = time + toshiba->kbd_mode; |
1272 | if (toshiba_kbd_illum_status_set(toshiba, time) < 0) | 1277 | ret = toshiba_kbd_illum_status_set(toshiba, time); |
1273 | return -EIO; | 1278 | if (ret) |
1279 | return ret; | ||
1274 | toshiba->kbd_mode = mode; | 1280 | toshiba->kbd_mode = mode; |
1275 | } | 1281 | } |
1276 | 1282 | ||
@@ -1857,9 +1863,16 @@ static int toshiba_acpi_resume(struct device *device) | |||
1857 | { | 1863 | { |
1858 | struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device)); | 1864 | struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device)); |
1859 | u32 result; | 1865 | u32 result; |
1866 | acpi_status status; | ||
1867 | |||
1868 | if (dev->hotkey_dev) { | ||
1869 | status = acpi_evaluate_object(dev->acpi_dev->handle, "ENAB", | ||
1870 | NULL, NULL); | ||
1871 | if (ACPI_FAILURE(status)) | ||
1872 | pr_info("Unable to re-enable hotkeys\n"); | ||
1860 | 1873 | ||
1861 | if (dev->hotkey_dev) | ||
1862 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result); | 1874 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result); |
1875 | } | ||
1863 | 1876 | ||
1864 | return 0; | 1877 | return 0; |
1865 | } | 1878 | } |
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index b1cda6ffdbcc..45e05b32f9b6 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c | |||
@@ -953,6 +953,7 @@ static const struct x86_cpu_id rapl_ids[] = { | |||
953 | { X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */ | 953 | { X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */ |
954 | { X86_VENDOR_INTEL, 6, 0x3c},/* Haswell */ | 954 | { X86_VENDOR_INTEL, 6, 0x3c},/* Haswell */ |
955 | { X86_VENDOR_INTEL, 6, 0x3d},/* Broadwell */ | 955 | { X86_VENDOR_INTEL, 6, 0x3d},/* Broadwell */ |
956 | { X86_VENDOR_INTEL, 6, 0x3f},/* Haswell */ | ||
956 | { X86_VENDOR_INTEL, 6, 0x45},/* Haswell ULT */ | 957 | { X86_VENDOR_INTEL, 6, 0x45},/* Haswell ULT */ |
957 | /* TODO: Add more CPU IDs after testing */ | 958 | /* TODO: Add more CPU IDs after testing */ |
958 | {} | 959 | {} |
@@ -1166,11 +1167,10 @@ static int rapl_detect_domains(struct rapl_package *rp, int cpu) | |||
1166 | 1167 | ||
1167 | for (i = 0; i < RAPL_DOMAIN_MAX; i++) { | 1168 | for (i = 0; i < RAPL_DOMAIN_MAX; i++) { |
1168 | /* use physical package id to read counters */ | 1169 | /* use physical package id to read counters */ |
1169 | if (!rapl_check_domain(cpu, i)) | 1170 | if (!rapl_check_domain(cpu, i)) { |
1170 | rp->domain_map |= 1 << i; | 1171 | rp->domain_map |= 1 << i; |
1171 | else | 1172 | pr_info("Found RAPL domain %s\n", rapl_domain_names[i]); |
1172 | pr_warn("RAPL domain %s detection failed\n", | 1173 | } |
1173 | rapl_domain_names[i]); | ||
1174 | } | 1174 | } |
1175 | rp->nr_domains = bitmap_weight(&rp->domain_map, RAPL_DOMAIN_MAX); | 1175 | rp->nr_domains = bitmap_weight(&rp->domain_map, RAPL_DOMAIN_MAX); |
1176 | if (!rp->nr_domains) { | 1176 | if (!rp->nr_domains) { |
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 4b66bf09ee55..d2c35920ff08 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
@@ -606,6 +606,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
606 | unsigned int best = 0; | 606 | unsigned int best = 0; |
607 | struct pwm_lookup *p; | 607 | struct pwm_lookup *p; |
608 | unsigned int match; | 608 | unsigned int match; |
609 | unsigned int period; | ||
610 | enum pwm_polarity polarity; | ||
609 | 611 | ||
610 | /* look up via DT first */ | 612 | /* look up via DT first */ |
611 | if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) | 613 | if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) |
@@ -653,6 +655,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
653 | if (match > best) { | 655 | if (match > best) { |
654 | chip = pwmchip_find_by_name(p->provider); | 656 | chip = pwmchip_find_by_name(p->provider); |
655 | index = p->index; | 657 | index = p->index; |
658 | period = p->period; | ||
659 | polarity = p->polarity; | ||
656 | 660 | ||
657 | if (match != 3) | 661 | if (match != 3) |
658 | best = match; | 662 | best = match; |
@@ -668,8 +672,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
668 | if (IS_ERR(pwm)) | 672 | if (IS_ERR(pwm)) |
669 | return pwm; | 673 | return pwm; |
670 | 674 | ||
671 | pwm_set_period(pwm, p->period); | 675 | pwm_set_period(pwm, period); |
672 | pwm_set_polarity(pwm, p->polarity); | 676 | pwm_set_polarity(pwm, polarity); |
673 | 677 | ||
674 | 678 | ||
675 | return pwm; | 679 | return pwm; |
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 337634ad0562..6d77dcd7dcf6 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -319,7 +319,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, | |||
319 | struct regulator_config *config) | 319 | struct regulator_config *config) |
320 | { | 320 | { |
321 | struct device_node *nproot, *np; | 321 | struct device_node *nproot, *np; |
322 | nproot = of_node_get(pdev->dev.parent->of_node); | 322 | nproot = pdev->dev.parent->of_node; |
323 | if (!nproot) | 323 | if (!nproot) |
324 | return -ENODEV; | 324 | return -ENODEV; |
325 | nproot = of_get_child_by_name(nproot, "regulators"); | 325 | nproot = of_get_child_by_name(nproot, "regulators"); |
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index fdb6ea8ae7e6..00033625a09c 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
@@ -422,9 +422,9 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
422 | config.init_data = pdata->regulators[pdev->id]; | 422 | config.init_data = pdata->regulators[pdev->id]; |
423 | } else { | 423 | } else { |
424 | #ifdef CONFIG_OF | 424 | #ifdef CONFIG_OF |
425 | struct device_node *nproot, *np; | 425 | struct device_node *nproot = da9052->dev->of_node; |
426 | struct device_node *np; | ||
426 | 427 | ||
427 | nproot = of_node_get(da9052->dev->of_node); | ||
428 | if (!nproot) | 428 | if (!nproot) |
429 | return -ENODEV; | 429 | return -ENODEV; |
430 | 430 | ||
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index 9623e9e290bf..3426be89c9f6 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
@@ -226,7 +226,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
226 | struct device_node *np, *regulators; | 226 | struct device_node *np, *regulators; |
227 | int ret; | 227 | int ret; |
228 | 228 | ||
229 | np = of_node_get(pdev->dev.parent->of_node); | 229 | np = pdev->dev.parent->of_node; |
230 | if (!np) | 230 | if (!np) |
231 | return 0; | 231 | return 0; |
232 | 232 | ||
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index dad2bcd14e96..7770777befc4 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
@@ -250,7 +250,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, | |||
250 | struct device_node *nproot, *np; | 250 | struct device_node *nproot, *np; |
251 | int rcount; | 251 | int rcount; |
252 | 252 | ||
253 | nproot = of_node_get(pdev->dev.parent->of_node); | 253 | nproot = pdev->dev.parent->of_node; |
254 | if (!nproot) | 254 | if (!nproot) |
255 | return -ENODEV; | 255 | return -ENODEV; |
256 | np = of_get_child_by_name(nproot, "regulators"); | 256 | np = of_get_child_by_name(nproot, "regulators"); |
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 90b4c530dee5..9c31e215a521 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -917,7 +917,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
917 | struct max8997_regulator_data *rdata; | 917 | struct max8997_regulator_data *rdata; |
918 | unsigned int i, dvs_voltage_nr = 1, ret; | 918 | unsigned int i, dvs_voltage_nr = 1, ret; |
919 | 919 | ||
920 | pmic_np = of_node_get(iodev->dev->of_node); | 920 | pmic_np = iodev->dev->of_node; |
921 | if (!pmic_np) { | 921 | if (!pmic_np) { |
922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); | 922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); |
923 | return -ENODEV; | 923 | return -ENODEV; |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index a7ce34d1b5f2..1878e5b567ef 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -1427,7 +1427,6 @@ static void palmas_dt_to_pdata(struct device *dev, | |||
1427 | u32 prop; | 1427 | u32 prop; |
1428 | int idx, ret; | 1428 | int idx, ret; |
1429 | 1429 | ||
1430 | node = of_node_get(node); | ||
1431 | regulators = of_get_child_by_name(node, "regulators"); | 1430 | regulators = of_get_child_by_name(node, "regulators"); |
1432 | if (!regulators) { | 1431 | if (!regulators) { |
1433 | dev_info(dev, "regulator node not found\n"); | 1432 | dev_info(dev, "regulator node not found\n"); |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index fa7db8847578..e584c998b55f 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -1014,7 +1014,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
1014 | if (!pmic_plat_data) | 1014 | if (!pmic_plat_data) |
1015 | return NULL; | 1015 | return NULL; |
1016 | 1016 | ||
1017 | np = of_node_get(pdev->dev.parent->of_node); | 1017 | np = pdev->dev.parent->of_node; |
1018 | regulators = of_get_child_by_name(np, "regulators"); | 1018 | regulators = of_get_child_by_name(np, "regulators"); |
1019 | if (!regulators) { | 1019 | if (!regulators) { |
1020 | dev_err(&pdev->dev, "regulator node not found\n"); | 1020 | dev_err(&pdev->dev, "regulator node not found\n"); |
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 8225b89de810..c384fec6d173 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c | |||
@@ -232,6 +232,7 @@ static struct platform_driver efi_rtc_driver = { | |||
232 | 232 | ||
233 | module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); | 233 | module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); |
234 | 234 | ||
235 | MODULE_ALIAS("platform:rtc-efi"); | ||
235 | MODULE_AUTHOR("dann frazier <dannf@hp.com>"); | 236 | MODULE_AUTHOR("dann frazier <dannf@hp.com>"); |
236 | MODULE_LICENSE("GPL"); | 237 | MODULE_LICENSE("GPL"); |
237 | MODULE_DESCRIPTION("EFI RTC driver"); | 238 | MODULE_DESCRIPTION("EFI RTC driver"); |
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index 8f06250a0389..8754c33361e8 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c | |||
@@ -717,12 +717,14 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
717 | info->device_type = s5m87xx->device_type; | 717 | info->device_type = s5m87xx->device_type; |
718 | info->wtsr_smpl = s5m87xx->wtsr_smpl; | 718 | info->wtsr_smpl = s5m87xx->wtsr_smpl; |
719 | 719 | ||
720 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); | 720 | if (s5m87xx->irq_data) { |
721 | if (info->irq <= 0) { | 721 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); |
722 | ret = -EINVAL; | 722 | if (info->irq <= 0) { |
723 | dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", | 723 | ret = -EINVAL; |
724 | dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", | ||
724 | alarm_irq); | 725 | alarm_irq); |
725 | goto err; | 726 | goto err; |
727 | } | ||
726 | } | 728 | } |
727 | 729 | ||
728 | platform_set_drvdata(pdev, info); | 730 | platform_set_drvdata(pdev, info); |
@@ -744,6 +746,11 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
744 | goto err; | 746 | goto err; |
745 | } | 747 | } |
746 | 748 | ||
749 | if (!info->irq) { | ||
750 | dev_info(&pdev->dev, "Alarm IRQ not available\n"); | ||
751 | return 0; | ||
752 | } | ||
753 | |||
747 | ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, | 754 | ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, |
748 | s5m_rtc_alarm_irq, 0, "rtc-alarm0", | 755 | s5m_rtc_alarm_irq, 0, "rtc-alarm0", |
749 | info); | 756 | info); |
@@ -802,7 +809,7 @@ static int s5m_rtc_resume(struct device *dev) | |||
802 | struct s5m_rtc_info *info = dev_get_drvdata(dev); | 809 | struct s5m_rtc_info *info = dev_get_drvdata(dev); |
803 | int ret = 0; | 810 | int ret = 0; |
804 | 811 | ||
805 | if (device_may_wakeup(dev)) | 812 | if (info->irq && device_may_wakeup(dev)) |
806 | ret = disable_irq_wake(info->irq); | 813 | ret = disable_irq_wake(info->irq); |
807 | 814 | ||
808 | return ret; | 815 | return ret; |
@@ -813,7 +820,7 @@ static int s5m_rtc_suspend(struct device *dev) | |||
813 | struct s5m_rtc_info *info = dev_get_drvdata(dev); | 820 | struct s5m_rtc_info *info = dev_get_drvdata(dev); |
814 | int ret = 0; | 821 | int ret = 0; |
815 | 822 | ||
816 | if (device_may_wakeup(dev)) | 823 | if (info->irq && device_may_wakeup(dev)) |
817 | ret = enable_irq_wake(info->irq); | 824 | ret = enable_irq_wake(info->irq); |
818 | 825 | ||
819 | return ret; | 826 | return ret; |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 2ead7e78c456..14ba80bfa571 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -77,7 +77,7 @@ EXPORT_SYMBOL_GPL(dasd_nofcx); | |||
77 | * strings when running as a module. | 77 | * strings when running as a module. |
78 | */ | 78 | */ |
79 | static char *dasd[256]; | 79 | static char *dasd[256]; |
80 | module_param_array(dasd, charp, NULL, 0); | 80 | module_param_array(dasd, charp, NULL, S_IRUGO); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Single spinlock to protect devmap and servermap structures and lists. | 83 | * Single spinlock to protect devmap and servermap structures and lists. |
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index a6d47e5eee9e..c43aca69fb30 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
@@ -1035,12 +1035,26 @@ static int tty3215_write(struct tty_struct * tty, | |||
1035 | const unsigned char *buf, int count) | 1035 | const unsigned char *buf, int count) |
1036 | { | 1036 | { |
1037 | struct raw3215_info *raw; | 1037 | struct raw3215_info *raw; |
1038 | int i, written; | ||
1038 | 1039 | ||
1039 | if (!tty) | 1040 | if (!tty) |
1040 | return 0; | 1041 | return 0; |
1041 | raw = (struct raw3215_info *) tty->driver_data; | 1042 | raw = (struct raw3215_info *) tty->driver_data; |
1042 | raw3215_write(raw, buf, count); | 1043 | written = count; |
1043 | return count; | 1044 | while (count > 0) { |
1045 | for (i = 0; i < count; i++) | ||
1046 | if (buf[i] == '\t' || buf[i] == '\n') | ||
1047 | break; | ||
1048 | raw3215_write(raw, buf, i); | ||
1049 | count -= i; | ||
1050 | buf += i; | ||
1051 | if (count > 0) { | ||
1052 | raw3215_putchar(raw, *buf); | ||
1053 | count--; | ||
1054 | buf++; | ||
1055 | } | ||
1056 | } | ||
1057 | return written; | ||
1044 | } | 1058 | } |
1045 | 1059 | ||
1046 | /* | 1060 | /* |
@@ -1188,7 +1202,7 @@ static int __init tty3215_init(void) | |||
1188 | driver->subtype = SYSTEM_TYPE_TTY; | 1202 | driver->subtype = SYSTEM_TYPE_TTY; |
1189 | driver->init_termios = tty_std_termios; | 1203 | driver->init_termios = tty_std_termios; |
1190 | driver->init_termios.c_iflag = IGNBRK | IGNPAR; | 1204 | driver->init_termios.c_iflag = IGNBRK | IGNPAR; |
1191 | driver->init_termios.c_oflag = ONLCR | XTABS; | 1205 | driver->init_termios.c_oflag = ONLCR; |
1192 | driver->init_termios.c_lflag = ISIG; | 1206 | driver->init_termios.c_lflag = ISIG; |
1193 | driver->flags = TTY_DRIVER_REAL_RAW; | 1207 | driver->flags = TTY_DRIVER_REAL_RAW; |
1194 | tty_set_operations(driver, &tty3215_ops); | 1208 | tty_set_operations(driver, &tty3215_ops); |
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 7ed7a5987816..003663288e29 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c | |||
@@ -559,7 +559,7 @@ sclp_tty_init(void) | |||
559 | driver->subtype = SYSTEM_TYPE_TTY; | 559 | driver->subtype = SYSTEM_TYPE_TTY; |
560 | driver->init_termios = tty_std_termios; | 560 | driver->init_termios = tty_std_termios; |
561 | driver->init_termios.c_iflag = IGNBRK | IGNPAR; | 561 | driver->init_termios.c_iflag = IGNBRK | IGNPAR; |
562 | driver->init_termios.c_oflag = ONLCR | XTABS; | 562 | driver->init_termios.c_oflag = ONLCR; |
563 | driver->init_termios.c_lflag = ISIG | ECHO; | 563 | driver->init_termios.c_lflag = ISIG | ECHO; |
564 | driver->flags = TTY_DRIVER_REAL_RAW; | 564 | driver->flags = TTY_DRIVER_REAL_RAW; |
565 | tty_set_operations(driver, &sclp_ops); | 565 | tty_set_operations(driver, &sclp_ops); |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 97ef37b51068..e7646ce3d659 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -889,6 +889,7 @@ extern const struct attribute_group *qeth_generic_attr_groups[]; | |||
889 | extern const struct attribute_group *qeth_osn_attr_groups[]; | 889 | extern const struct attribute_group *qeth_osn_attr_groups[]; |
890 | extern struct workqueue_struct *qeth_wq; | 890 | extern struct workqueue_struct *qeth_wq; |
891 | 891 | ||
892 | int qeth_card_hw_is_reachable(struct qeth_card *); | ||
892 | const char *qeth_get_cardname_short(struct qeth_card *); | 893 | const char *qeth_get_cardname_short(struct qeth_card *); |
893 | int qeth_realloc_buffer_pool(struct qeth_card *, int); | 894 | int qeth_realloc_buffer_pool(struct qeth_card *, int); |
894 | int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); | 895 | int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index c0d6ba8655c7..fd22c811cbe1 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -73,6 +73,13 @@ static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *, int); | |||
73 | struct workqueue_struct *qeth_wq; | 73 | struct workqueue_struct *qeth_wq; |
74 | EXPORT_SYMBOL_GPL(qeth_wq); | 74 | EXPORT_SYMBOL_GPL(qeth_wq); |
75 | 75 | ||
76 | int qeth_card_hw_is_reachable(struct qeth_card *card) | ||
77 | { | ||
78 | return (card->state == CARD_STATE_SOFTSETUP) || | ||
79 | (card->state == CARD_STATE_UP); | ||
80 | } | ||
81 | EXPORT_SYMBOL_GPL(qeth_card_hw_is_reachable); | ||
82 | |||
76 | static void qeth_close_dev_handler(struct work_struct *work) | 83 | static void qeth_close_dev_handler(struct work_struct *work) |
77 | { | 84 | { |
78 | struct qeth_card *card; | 85 | struct qeth_card *card; |
@@ -5790,6 +5797,7 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, | |||
5790 | struct qeth_card *card = netdev->ml_priv; | 5797 | struct qeth_card *card = netdev->ml_priv; |
5791 | enum qeth_link_types link_type; | 5798 | enum qeth_link_types link_type; |
5792 | struct carrier_info carrier_info; | 5799 | struct carrier_info carrier_info; |
5800 | int rc; | ||
5793 | u32 speed; | 5801 | u32 speed; |
5794 | 5802 | ||
5795 | if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) | 5803 | if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) |
@@ -5832,8 +5840,14 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, | |||
5832 | /* Check if we can obtain more accurate information. */ | 5840 | /* Check if we can obtain more accurate information. */ |
5833 | /* If QUERY_CARD_INFO command is not supported or fails, */ | 5841 | /* If QUERY_CARD_INFO command is not supported or fails, */ |
5834 | /* just return the heuristics that was filled above. */ | 5842 | /* just return the heuristics that was filled above. */ |
5835 | if (qeth_query_card_info(card, &carrier_info) != 0) | 5843 | if (!qeth_card_hw_is_reachable(card)) |
5844 | return -ENODEV; | ||
5845 | rc = qeth_query_card_info(card, &carrier_info); | ||
5846 | if (rc == -EOPNOTSUPP) /* for old hardware, return heuristic */ | ||
5836 | return 0; | 5847 | return 0; |
5848 | if (rc) /* report error from the hardware operation */ | ||
5849 | return rc; | ||
5850 | /* on success, fill in the information got from the hardware */ | ||
5837 | 5851 | ||
5838 | netdev_dbg(netdev, | 5852 | netdev_dbg(netdev, |
5839 | "card info: card_type=0x%02x, port_mode=0x%04x, port_speed=0x%08x\n", | 5853 | "card info: card_type=0x%02x, port_mode=0x%04x, port_speed=0x%08x\n", |
diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c index ae1bc04b8653..59e3aa538b4d 100644 --- a/drivers/s390/net/qeth_l2_sys.c +++ b/drivers/s390/net/qeth_l2_sys.c | |||
@@ -5,17 +5,12 @@ | |||
5 | 5 | ||
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | #include <asm/ebcdic.h> | 7 | #include <asm/ebcdic.h> |
8 | #include "qeth_core.h" | ||
8 | #include "qeth_l2.h" | 9 | #include "qeth_l2.h" |
9 | 10 | ||
10 | #define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \ | 11 | #define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \ |
11 | struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store) | 12 | struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store) |
12 | 13 | ||
13 | static int qeth_card_hw_is_reachable(struct qeth_card *card) | ||
14 | { | ||
15 | return (card->state == CARD_STATE_SOFTSETUP) || | ||
16 | (card->state == CARD_STATE_UP); | ||
17 | } | ||
18 | |||
19 | static ssize_t qeth_bridge_port_role_state_show(struct device *dev, | 14 | static ssize_t qeth_bridge_port_role_state_show(struct device *dev, |
20 | struct device_attribute *attr, char *buf, | 15 | struct device_attribute *attr, char *buf, |
21 | int show_state) | 16 | int show_state) |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 18a3358eb1d4..bd85fb4978e0 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -43,7 +43,7 @@ config SCSI_DMA | |||
43 | config SCSI_NETLINK | 43 | config SCSI_NETLINK |
44 | bool | 44 | bool |
45 | default n | 45 | default n |
46 | select NET | 46 | depends on NET |
47 | 47 | ||
48 | config SCSI_PROC_FS | 48 | config SCSI_PROC_FS |
49 | bool "legacy /proc/scsi/ support" | 49 | bool "legacy /proc/scsi/ support" |
@@ -257,7 +257,7 @@ config SCSI_SPI_ATTRS | |||
257 | 257 | ||
258 | config SCSI_FC_ATTRS | 258 | config SCSI_FC_ATTRS |
259 | tristate "FiberChannel Transport Attributes" | 259 | tristate "FiberChannel Transport Attributes" |
260 | depends on SCSI | 260 | depends on SCSI && NET |
261 | select SCSI_NETLINK | 261 | select SCSI_NETLINK |
262 | help | 262 | help |
263 | If you wish to export transport-specific information about | 263 | If you wish to export transport-specific information about |
@@ -585,28 +585,28 @@ config HYPERV_STORAGE | |||
585 | 585 | ||
586 | config LIBFC | 586 | config LIBFC |
587 | tristate "LibFC module" | 587 | tristate "LibFC module" |
588 | select SCSI_FC_ATTRS | 588 | depends on SCSI_FC_ATTRS |
589 | select CRC32 | 589 | select CRC32 |
590 | ---help--- | 590 | ---help--- |
591 | Fibre Channel library module | 591 | Fibre Channel library module |
592 | 592 | ||
593 | config LIBFCOE | 593 | config LIBFCOE |
594 | tristate "LibFCoE module" | 594 | tristate "LibFCoE module" |
595 | select LIBFC | 595 | depends on LIBFC |
596 | ---help--- | 596 | ---help--- |
597 | Library for Fibre Channel over Ethernet module | 597 | Library for Fibre Channel over Ethernet module |
598 | 598 | ||
599 | config FCOE | 599 | config FCOE |
600 | tristate "FCoE module" | 600 | tristate "FCoE module" |
601 | depends on PCI | 601 | depends on PCI |
602 | select LIBFCOE | 602 | depends on LIBFCOE |
603 | ---help--- | 603 | ---help--- |
604 | Fibre Channel over Ethernet module | 604 | Fibre Channel over Ethernet module |
605 | 605 | ||
606 | config FCOE_FNIC | 606 | config FCOE_FNIC |
607 | tristate "Cisco FNIC Driver" | 607 | tristate "Cisco FNIC Driver" |
608 | depends on PCI && X86 | 608 | depends on PCI && X86 |
609 | select LIBFCOE | 609 | depends on LIBFCOE |
610 | help | 610 | help |
611 | This is support for the Cisco PCI-Express FCoE HBA. | 611 | This is support for the Cisco PCI-Express FCoE HBA. |
612 | 612 | ||
@@ -816,7 +816,7 @@ config SCSI_IBMVSCSI | |||
816 | config SCSI_IBMVFC | 816 | config SCSI_IBMVFC |
817 | tristate "IBM Virtual FC support" | 817 | tristate "IBM Virtual FC support" |
818 | depends on PPC_PSERIES && SCSI | 818 | depends on PPC_PSERIES && SCSI |
819 | select SCSI_FC_ATTRS | 819 | depends on SCSI_FC_ATTRS |
820 | help | 820 | help |
821 | This is the IBM POWER Virtual FC Client | 821 | This is the IBM POWER Virtual FC Client |
822 | 822 | ||
@@ -1266,7 +1266,7 @@ source "drivers/scsi/qla4xxx/Kconfig" | |||
1266 | config SCSI_LPFC | 1266 | config SCSI_LPFC |
1267 | tristate "Emulex LightPulse Fibre Channel Support" | 1267 | tristate "Emulex LightPulse Fibre Channel Support" |
1268 | depends on PCI && SCSI | 1268 | depends on PCI && SCSI |
1269 | select SCSI_FC_ATTRS | 1269 | depends on SCSI_FC_ATTRS |
1270 | select CRC_T10DIF | 1270 | select CRC_T10DIF |
1271 | help | 1271 | help |
1272 | This lpfc driver supports the Emulex LightPulse | 1272 | This lpfc driver supports the Emulex LightPulse |
@@ -1676,7 +1676,7 @@ config SCSI_SUNESP | |||
1676 | config ZFCP | 1676 | config ZFCP |
1677 | tristate "FCP host bus adapter driver for IBM eServer zSeries" | 1677 | tristate "FCP host bus adapter driver for IBM eServer zSeries" |
1678 | depends on S390 && QDIO && SCSI | 1678 | depends on S390 && QDIO && SCSI |
1679 | select SCSI_FC_ATTRS | 1679 | depends on SCSI_FC_ATTRS |
1680 | help | 1680 | help |
1681 | If you want to access SCSI devices attached to your IBM eServer | 1681 | If you want to access SCSI devices attached to your IBM eServer |
1682 | zSeries by means of Fibre Channel interfaces say Y. | 1682 | zSeries by means of Fibre Channel interfaces say Y. |
@@ -1704,7 +1704,7 @@ config SCSI_PM8001 | |||
1704 | config SCSI_BFA_FC | 1704 | config SCSI_BFA_FC |
1705 | tristate "Brocade BFA Fibre Channel Support" | 1705 | tristate "Brocade BFA Fibre Channel Support" |
1706 | depends on PCI && SCSI | 1706 | depends on PCI && SCSI |
1707 | select SCSI_FC_ATTRS | 1707 | depends on SCSI_FC_ATTRS |
1708 | help | 1708 | help |
1709 | This bfa driver supports all Brocade PCIe FC/FCOE host adapters. | 1709 | This bfa driver supports all Brocade PCIe FC/FCOE host adapters. |
1710 | 1710 | ||
diff --git a/drivers/scsi/bnx2fc/Kconfig b/drivers/scsi/bnx2fc/Kconfig index f245d543d7b1..097882882649 100644 --- a/drivers/scsi/bnx2fc/Kconfig +++ b/drivers/scsi/bnx2fc/Kconfig | |||
@@ -1,11 +1,12 @@ | |||
1 | config SCSI_BNX2X_FCOE | 1 | config SCSI_BNX2X_FCOE |
2 | tristate "QLogic NetXtreme II FCoE support" | 2 | tristate "QLogic NetXtreme II FCoE support" |
3 | depends on PCI | 3 | depends on PCI |
4 | depends on (IPV6 || IPV6=n) | ||
5 | depends on LIBFC | ||
6 | depends on LIBFCOE | ||
4 | select NETDEVICES | 7 | select NETDEVICES |
5 | select ETHERNET | 8 | select ETHERNET |
6 | select NET_VENDOR_BROADCOM | 9 | select NET_VENDOR_BROADCOM |
7 | select LIBFC | ||
8 | select LIBFCOE | ||
9 | select CNIC | 10 | select CNIC |
10 | ---help--- | 11 | ---help--- |
11 | This driver supports FCoE offload for the QLogic NetXtreme II | 12 | This driver supports FCoE offload for the QLogic NetXtreme II |
diff --git a/drivers/scsi/bnx2i/Kconfig b/drivers/scsi/bnx2i/Kconfig index 44ce54e536e5..ba30ff86d581 100644 --- a/drivers/scsi/bnx2i/Kconfig +++ b/drivers/scsi/bnx2i/Kconfig | |||
@@ -2,6 +2,7 @@ config SCSI_BNX2_ISCSI | |||
2 | tristate "QLogic NetXtreme II iSCSI support" | 2 | tristate "QLogic NetXtreme II iSCSI support" |
3 | depends on NET | 3 | depends on NET |
4 | depends on PCI | 4 | depends on PCI |
5 | depends on (IPV6 || IPV6=n) | ||
5 | select SCSI_ISCSI_ATTRS | 6 | select SCSI_ISCSI_ATTRS |
6 | select NETDEVICES | 7 | select NETDEVICES |
7 | select ETHERNET | 8 | select ETHERNET |
diff --git a/drivers/scsi/csiostor/Kconfig b/drivers/scsi/csiostor/Kconfig index 4d03b032aa10..7c7e5085968b 100644 --- a/drivers/scsi/csiostor/Kconfig +++ b/drivers/scsi/csiostor/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config SCSI_CHELSIO_FCOE | 1 | config SCSI_CHELSIO_FCOE |
2 | tristate "Chelsio Communications FCoE support" | 2 | tristate "Chelsio Communications FCoE support" |
3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI |
4 | select SCSI_FC_ATTRS | 4 | depends on SCSI_FC_ATTRS |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | help | 6 | help |
7 | This driver supports FCoE Offload functionality over | 7 | This driver supports FCoE Offload functionality over |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index ea025e4806b6..191b59793519 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -717,11 +717,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
717 | return NULL; | 717 | return NULL; |
718 | } | 718 | } |
719 | 719 | ||
720 | if (data_size > ISCSI_DEF_MAX_RECV_SEG_LEN) { | ||
721 | iscsi_conn_printk(KERN_ERR, conn, "Invalid buffer len of %u for login task. Max len is %u\n", data_size, ISCSI_DEF_MAX_RECV_SEG_LEN); | ||
722 | return NULL; | ||
723 | } | ||
724 | |||
720 | task = conn->login_task; | 725 | task = conn->login_task; |
721 | } else { | 726 | } else { |
722 | if (session->state != ISCSI_STATE_LOGGED_IN) | 727 | if (session->state != ISCSI_STATE_LOGGED_IN) |
723 | return NULL; | 728 | return NULL; |
724 | 729 | ||
730 | if (data_size != 0) { | ||
731 | iscsi_conn_printk(KERN_ERR, conn, "Can not send data buffer of len %u for op 0x%x\n", data_size, opcode); | ||
732 | return NULL; | ||
733 | } | ||
734 | |||
725 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); | 735 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); |
726 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); | 736 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); |
727 | 737 | ||
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig index 23d607218ae8..113e6c9826a1 100644 --- a/drivers/scsi/qla2xxx/Kconfig +++ b/drivers/scsi/qla2xxx/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config SCSI_QLA_FC | 1 | config SCSI_QLA_FC |
2 | tristate "QLogic QLA2XXX Fibre Channel Support" | 2 | tristate "QLogic QLA2XXX Fibre Channel Support" |
3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI |
4 | select SCSI_FC_ATTRS | 4 | depends on SCSI_FC_ATTRS |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | ---help--- | 6 | ---help--- |
7 | This qla2xxx driver supports all QLogic Fibre Channel | 7 | This qla2xxx driver supports all QLogic Fibre Channel |
@@ -31,7 +31,7 @@ config SCSI_QLA_FC | |||
31 | config TCM_QLA2XXX | 31 | config TCM_QLA2XXX |
32 | tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs" | 32 | tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs" |
33 | depends on SCSI_QLA_FC && TARGET_CORE | 33 | depends on SCSI_QLA_FC && TARGET_CORE |
34 | select LIBFC | 34 | depends on LIBFC |
35 | select BTREE | 35 | select BTREE |
36 | default n | 36 | default n |
37 | ---help--- | 37 | ---help--- |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index df3306019a7e..d81f3cc43ff1 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -377,6 +377,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) | |||
377 | pool->slab_flags |= SLAB_CACHE_DMA; | 377 | pool->slab_flags |= SLAB_CACHE_DMA; |
378 | pool->gfp_mask = __GFP_DMA; | 378 | pool->gfp_mask = __GFP_DMA; |
379 | } | 379 | } |
380 | |||
381 | if (hostt->cmd_size) | ||
382 | hostt->cmd_pool = pool; | ||
383 | |||
380 | return pool; | 384 | return pool; |
381 | } | 385 | } |
382 | 386 | ||
@@ -421,8 +425,10 @@ out: | |||
421 | out_free_slab: | 425 | out_free_slab: |
422 | kmem_cache_destroy(pool->cmd_slab); | 426 | kmem_cache_destroy(pool->cmd_slab); |
423 | out_free_pool: | 427 | out_free_pool: |
424 | if (hostt->cmd_size) | 428 | if (hostt->cmd_size) { |
425 | scsi_free_host_cmd_pool(pool); | 429 | scsi_free_host_cmd_pool(pool); |
430 | hostt->cmd_pool = NULL; | ||
431 | } | ||
426 | goto out; | 432 | goto out; |
427 | } | 433 | } |
428 | 434 | ||
@@ -444,8 +450,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost) | |||
444 | if (!--pool->users) { | 450 | if (!--pool->users) { |
445 | kmem_cache_destroy(pool->cmd_slab); | 451 | kmem_cache_destroy(pool->cmd_slab); |
446 | kmem_cache_destroy(pool->sense_slab); | 452 | kmem_cache_destroy(pool->sense_slab); |
447 | if (hostt->cmd_size) | 453 | if (hostt->cmd_size) { |
448 | scsi_free_host_cmd_pool(pool); | 454 | scsi_free_host_cmd_pool(pool); |
455 | hostt->cmd_pool = NULL; | ||
456 | } | ||
449 | } | 457 | } |
450 | mutex_unlock(&host_cmd_pool_mutex); | 458 | mutex_unlock(&host_cmd_pool_mutex); |
451 | } | 459 | } |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9c44392b748f..aaea4b98af16 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -733,12 +733,13 @@ static bool scsi_end_request(struct request *req, int error, | |||
733 | } else { | 733 | } else { |
734 | unsigned long flags; | 734 | unsigned long flags; |
735 | 735 | ||
736 | if (bidi_bytes) | ||
737 | scsi_release_bidi_buffers(cmd); | ||
738 | |||
736 | spin_lock_irqsave(q->queue_lock, flags); | 739 | spin_lock_irqsave(q->queue_lock, flags); |
737 | blk_finish_request(req, error); | 740 | blk_finish_request(req, error); |
738 | spin_unlock_irqrestore(q->queue_lock, flags); | 741 | spin_unlock_irqrestore(q->queue_lock, flags); |
739 | 742 | ||
740 | if (bidi_bytes) | ||
741 | scsi_release_bidi_buffers(cmd); | ||
742 | scsi_release_buffers(cmd); | 743 | scsi_release_buffers(cmd); |
743 | scsi_next_command(cmd); | 744 | scsi_next_command(cmd); |
744 | } | 745 | } |
@@ -1774,7 +1775,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1774 | blk_requeue_request(q, req); | 1775 | blk_requeue_request(q, req); |
1775 | atomic_dec(&sdev->device_busy); | 1776 | atomic_dec(&sdev->device_busy); |
1776 | out_delay: | 1777 | out_delay: |
1777 | if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev)) | 1778 | if (!atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev)) |
1778 | blk_delay_queue(q, SCSI_QUEUE_DELAY); | 1779 | blk_delay_queue(q, SCSI_QUEUE_DELAY); |
1779 | } | 1780 | } |
1780 | 1781 | ||
@@ -1808,7 +1809,6 @@ static int scsi_mq_prep_fn(struct request *req) | |||
1808 | 1809 | ||
1809 | cmd->tag = req->tag; | 1810 | cmd->tag = req->tag; |
1810 | 1811 | ||
1811 | req->cmd = req->__cmd; | ||
1812 | cmd->cmnd = req->cmd; | 1812 | cmd->cmnd = req->cmd; |
1813 | cmd->prot_op = SCSI_PROT_NORMAL; | 1813 | cmd->prot_op = SCSI_PROT_NORMAL; |
1814 | 1814 | ||
diff --git a/drivers/sh/Makefile b/drivers/sh/Makefile index 788ed9b59b4e..114203f32843 100644 --- a/drivers/sh/Makefile +++ b/drivers/sh/Makefile | |||
@@ -1,8 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Makefile for the SuperH specific drivers. | 2 | # Makefile for the SuperH specific drivers. |
3 | # | 3 | # |
4 | obj-$(CONFIG_SUPERH) += intc/ | 4 | obj-$(CONFIG_SH_INTC) += intc/ |
5 | obj-$(CONFIG_ARCH_SHMOBILE_LEGACY) += intc/ | ||
6 | ifneq ($(CONFIG_COMMON_CLK),y) | 5 | ifneq ($(CONFIG_COMMON_CLK),y) |
7 | obj-$(CONFIG_HAVE_CLK) += clk/ | 6 | obj-$(CONFIG_HAVE_CLK) += clk/ |
8 | endif | 7 | endif |
diff --git a/drivers/sh/intc/Kconfig b/drivers/sh/intc/Kconfig index 60228fae943f..6a1b05ddc8c9 100644 --- a/drivers/sh/intc/Kconfig +++ b/drivers/sh/intc/Kconfig | |||
@@ -1,7 +1,9 @@ | |||
1 | config SH_INTC | 1 | config SH_INTC |
2 | def_bool y | 2 | bool |
3 | select IRQ_DOMAIN | 3 | select IRQ_DOMAIN |
4 | 4 | ||
5 | if SH_INTC | ||
6 | |||
5 | comment "Interrupt controller options" | 7 | comment "Interrupt controller options" |
6 | 8 | ||
7 | config INTC_USERIMASK | 9 | config INTC_USERIMASK |
@@ -37,3 +39,5 @@ config INTC_MAPPING_DEBUG | |||
37 | between system IRQs and the per-controller id tables. | 39 | between system IRQs and the per-controller id tables. |
38 | 40 | ||
39 | If in doubt, say N. | 41 | If in doubt, say N. |
42 | |||
43 | endif | ||
diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c index 447458e696a9..7e1f120f2b32 100644 --- a/drivers/soc/qcom/qcom_gsbi.c +++ b/drivers/soc/qcom/qcom_gsbi.c | |||
@@ -22,44 +22,63 @@ | |||
22 | #define GSBI_CTRL_REG 0x0000 | 22 | #define GSBI_CTRL_REG 0x0000 |
23 | #define GSBI_PROTOCOL_SHIFT 4 | 23 | #define GSBI_PROTOCOL_SHIFT 4 |
24 | 24 | ||
25 | struct gsbi_info { | ||
26 | struct clk *hclk; | ||
27 | u32 mode; | ||
28 | u32 crci; | ||
29 | }; | ||
30 | |||
25 | static int gsbi_probe(struct platform_device *pdev) | 31 | static int gsbi_probe(struct platform_device *pdev) |
26 | { | 32 | { |
27 | struct device_node *node = pdev->dev.of_node; | 33 | struct device_node *node = pdev->dev.of_node; |
28 | struct resource *res; | 34 | struct resource *res; |
29 | void __iomem *base; | 35 | void __iomem *base; |
30 | struct clk *hclk; | 36 | struct gsbi_info *gsbi; |
31 | u32 mode, crci = 0; | 37 | |
38 | gsbi = devm_kzalloc(&pdev->dev, sizeof(*gsbi), GFP_KERNEL); | ||
39 | |||
40 | if (!gsbi) | ||
41 | return -ENOMEM; | ||
32 | 42 | ||
33 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 43 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
34 | base = devm_ioremap_resource(&pdev->dev, res); | 44 | base = devm_ioremap_resource(&pdev->dev, res); |
35 | if (IS_ERR(base)) | 45 | if (IS_ERR(base)) |
36 | return PTR_ERR(base); | 46 | return PTR_ERR(base); |
37 | 47 | ||
38 | if (of_property_read_u32(node, "qcom,mode", &mode)) { | 48 | if (of_property_read_u32(node, "qcom,mode", &gsbi->mode)) { |
39 | dev_err(&pdev->dev, "missing mode configuration\n"); | 49 | dev_err(&pdev->dev, "missing mode configuration\n"); |
40 | return -EINVAL; | 50 | return -EINVAL; |
41 | } | 51 | } |
42 | 52 | ||
43 | /* not required, so default to 0 if not present */ | 53 | /* not required, so default to 0 if not present */ |
44 | of_property_read_u32(node, "qcom,crci", &crci); | 54 | of_property_read_u32(node, "qcom,crci", &gsbi->crci); |
45 | 55 | ||
46 | dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", mode, crci); | 56 | dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", |
57 | gsbi->mode, gsbi->crci); | ||
58 | gsbi->hclk = devm_clk_get(&pdev->dev, "iface"); | ||
59 | if (IS_ERR(gsbi->hclk)) | ||
60 | return PTR_ERR(gsbi->hclk); | ||
47 | 61 | ||
48 | hclk = devm_clk_get(&pdev->dev, "iface"); | 62 | clk_prepare_enable(gsbi->hclk); |
49 | if (IS_ERR(hclk)) | ||
50 | return PTR_ERR(hclk); | ||
51 | 63 | ||
52 | clk_prepare_enable(hclk); | 64 | writel_relaxed((gsbi->mode << GSBI_PROTOCOL_SHIFT) | gsbi->crci, |
53 | |||
54 | writel_relaxed((mode << GSBI_PROTOCOL_SHIFT) | crci, | ||
55 | base + GSBI_CTRL_REG); | 65 | base + GSBI_CTRL_REG); |
56 | 66 | ||
57 | /* make sure the gsbi control write is not reordered */ | 67 | /* make sure the gsbi control write is not reordered */ |
58 | wmb(); | 68 | wmb(); |
59 | 69 | ||
60 | clk_disable_unprepare(hclk); | 70 | platform_set_drvdata(pdev, gsbi); |
71 | |||
72 | return of_platform_populate(node, NULL, NULL, &pdev->dev); | ||
73 | } | ||
74 | |||
75 | static int gsbi_remove(struct platform_device *pdev) | ||
76 | { | ||
77 | struct gsbi_info *gsbi = platform_get_drvdata(pdev); | ||
78 | |||
79 | clk_disable_unprepare(gsbi->hclk); | ||
61 | 80 | ||
62 | return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); | 81 | return 0; |
63 | } | 82 | } |
64 | 83 | ||
65 | static const struct of_device_id gsbi_dt_match[] = { | 84 | static const struct of_device_id gsbi_dt_match[] = { |
@@ -76,6 +95,7 @@ static struct platform_driver gsbi_driver = { | |||
76 | .of_match_table = gsbi_dt_match, | 95 | .of_match_table = gsbi_dt_match, |
77 | }, | 96 | }, |
78 | .probe = gsbi_probe, | 97 | .probe = gsbi_probe, |
98 | .remove = gsbi_remove, | ||
79 | }; | 99 | }; |
80 | 100 | ||
81 | module_platform_driver(gsbi_driver); | 101 | module_platform_driver(gsbi_driver); |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 6343df87afb3..84e7c9e6ccef 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -69,6 +69,7 @@ config SPI_ATH79 | |||
69 | 69 | ||
70 | config SPI_ATMEL | 70 | config SPI_ATMEL |
71 | tristate "Atmel SPI Controller" | 71 | tristate "Atmel SPI Controller" |
72 | depends on HAS_DMA | ||
72 | depends on (ARCH_AT91 || AVR32 || COMPILE_TEST) | 73 | depends on (ARCH_AT91 || AVR32 || COMPILE_TEST) |
73 | help | 74 | help |
74 | This selects a driver for the Atmel SPI Controller, present on | 75 | This selects a driver for the Atmel SPI Controller, present on |
@@ -112,6 +113,14 @@ config SPI_AU1550 | |||
112 | If you say yes to this option, support will be included for the | 113 | If you say yes to this option, support will be included for the |
113 | PSC SPI controller found on Au1550, Au1200 and Au1300 series. | 114 | PSC SPI controller found on Au1550, Au1200 and Au1300 series. |
114 | 115 | ||
116 | config SPI_BCM53XX | ||
117 | tristate "Broadcom BCM53xx SPI controller" | ||
118 | depends on ARCH_BCM_5301X | ||
119 | depends on BCMA_POSSIBLE | ||
120 | select BCMA | ||
121 | help | ||
122 | Enable support for the SPI controller on Broadcom BCM53xx ARM SoCs. | ||
123 | |||
115 | config SPI_BCM63XX | 124 | config SPI_BCM63XX |
116 | tristate "Broadcom BCM63xx SPI controller" | 125 | tristate "Broadcom BCM63xx SPI controller" |
117 | depends on BCM63XX | 126 | depends on BCM63XX |
@@ -185,6 +194,7 @@ config SPI_EFM32 | |||
185 | 194 | ||
186 | config SPI_EP93XX | 195 | config SPI_EP93XX |
187 | tristate "Cirrus Logic EP93xx SPI controller" | 196 | tristate "Cirrus Logic EP93xx SPI controller" |
197 | depends on HAS_DMA | ||
188 | depends on ARCH_EP93XX || COMPILE_TEST | 198 | depends on ARCH_EP93XX || COMPILE_TEST |
189 | help | 199 | help |
190 | This enables using the Cirrus EP93xx SPI controller in master | 200 | This enables using the Cirrus EP93xx SPI controller in master |
@@ -314,6 +324,7 @@ config SPI_OMAP_UWIRE | |||
314 | 324 | ||
315 | config SPI_OMAP24XX | 325 | config SPI_OMAP24XX |
316 | tristate "McSPI driver for OMAP" | 326 | tristate "McSPI driver for OMAP" |
327 | depends on HAS_DMA | ||
317 | depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SUPERH | 328 | depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SUPERH |
318 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | 329 | depends on ARCH_OMAP2PLUS || COMPILE_TEST |
319 | help | 330 | help |
@@ -380,7 +391,7 @@ config SPI_PXA2XX | |||
380 | additional documentation can be found a Documentation/spi/pxa2xx. | 391 | additional documentation can be found a Documentation/spi/pxa2xx. |
381 | 392 | ||
382 | config SPI_PXA2XX_PCI | 393 | config SPI_PXA2XX_PCI |
383 | def_tristate SPI_PXA2XX && PCI | 394 | def_tristate SPI_PXA2XX && PCI && COMMON_CLK |
384 | 395 | ||
385 | config SPI_ROCKCHIP | 396 | config SPI_ROCKCHIP |
386 | tristate "Rockchip SPI controller driver" | 397 | tristate "Rockchip SPI controller driver" |
@@ -500,7 +511,7 @@ config SPI_MXS | |||
500 | config SPI_TEGRA114 | 511 | config SPI_TEGRA114 |
501 | tristate "NVIDIA Tegra114 SPI Controller" | 512 | tristate "NVIDIA Tegra114 SPI Controller" |
502 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST | 513 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST |
503 | depends on RESET_CONTROLLER | 514 | depends on RESET_CONTROLLER && HAS_DMA |
504 | help | 515 | help |
505 | SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller | 516 | SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller |
506 | is different than the older SoCs SPI controller and also register interface | 517 | is different than the older SoCs SPI controller and also register interface |
@@ -518,7 +529,7 @@ config SPI_TEGRA20_SFLASH | |||
518 | config SPI_TEGRA20_SLINK | 529 | config SPI_TEGRA20_SLINK |
519 | tristate "Nvidia Tegra20/Tegra30 SLINK Controller" | 530 | tristate "Nvidia Tegra20/Tegra30 SLINK Controller" |
520 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST | 531 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST |
521 | depends on RESET_CONTROLLER | 532 | depends on RESET_CONTROLLER && HAS_DMA |
522 | help | 533 | help |
523 | SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface. | 534 | SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface. |
524 | 535 | ||
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 762da0741148..78f24ca36fcf 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -15,6 +15,7 @@ obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o | |||
15 | obj-$(CONFIG_SPI_ATH79) += spi-ath79.o | 15 | obj-$(CONFIG_SPI_ATH79) += spi-ath79.o |
16 | obj-$(CONFIG_SPI_AU1550) += spi-au1550.o | 16 | obj-$(CONFIG_SPI_AU1550) += spi-au1550.o |
17 | obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o | 17 | obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o |
18 | obj-$(CONFIG_SPI_BCM53XX) += spi-bcm53xx.o | ||
18 | obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o | 19 | obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o |
19 | obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o | 20 | obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o |
20 | obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o | 21 | obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o |
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 40c3d43c9292..f40b34cdf2fc 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c | |||
@@ -945,7 +945,7 @@ static int au1550_spi_remove(struct platform_device *pdev) | |||
945 | spi_bitbang_stop(&hw->bitbang); | 945 | spi_bitbang_stop(&hw->bitbang); |
946 | free_irq(hw->irq, hw); | 946 | free_irq(hw->irq, hw); |
947 | iounmap((void __iomem *)hw->regs); | 947 | iounmap((void __iomem *)hw->regs); |
948 | release_mem_region(r->start, sizeof(psc_spi_t)); | 948 | release_mem_region(hw->ioarea->start, sizeof(psc_spi_t)); |
949 | 949 | ||
950 | if (hw->usedma) { | 950 | if (hw->usedma) { |
951 | au1550_spi_dma_rxtmp_free(hw); | 951 | au1550_spi_dma_rxtmp_free(hw); |
diff --git a/drivers/spi/spi-bcm53xx.c b/drivers/spi/spi-bcm53xx.c new file mode 100644 index 000000000000..17b34cbadc03 --- /dev/null +++ b/drivers/spi/spi-bcm53xx.c | |||
@@ -0,0 +1,299 @@ | |||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
2 | |||
3 | #include <linux/kernel.h> | ||
4 | #include <linux/module.h> | ||
5 | #include <linux/slab.h> | ||
6 | #include <linux/delay.h> | ||
7 | #include <linux/bcma/bcma.h> | ||
8 | #include <linux/spi/spi.h> | ||
9 | |||
10 | #include "spi-bcm53xx.h" | ||
11 | |||
12 | #define BCM53XXSPI_MAX_SPI_BAUD 13500000 /* 216 MHz? */ | ||
13 | |||
14 | /* The longest observed required wait was 19 ms */ | ||
15 | #define BCM53XXSPI_SPE_TIMEOUT_MS 80 | ||
16 | |||
17 | struct bcm53xxspi { | ||
18 | struct bcma_device *core; | ||
19 | struct spi_master *master; | ||
20 | |||
21 | size_t read_offset; | ||
22 | }; | ||
23 | |||
24 | static inline u32 bcm53xxspi_read(struct bcm53xxspi *b53spi, u16 offset) | ||
25 | { | ||
26 | return bcma_read32(b53spi->core, offset); | ||
27 | } | ||
28 | |||
29 | static inline void bcm53xxspi_write(struct bcm53xxspi *b53spi, u16 offset, | ||
30 | u32 value) | ||
31 | { | ||
32 | bcma_write32(b53spi->core, offset, value); | ||
33 | } | ||
34 | |||
35 | static inline unsigned int bcm53xxspi_calc_timeout(size_t len) | ||
36 | { | ||
37 | /* Do some magic calculation based on length and buad. Add 10% and 1. */ | ||
38 | return (len * 9000 / BCM53XXSPI_MAX_SPI_BAUD * 110 / 100) + 1; | ||
39 | } | ||
40 | |||
41 | static int bcm53xxspi_wait(struct bcm53xxspi *b53spi, unsigned int timeout_ms) | ||
42 | { | ||
43 | unsigned long deadline; | ||
44 | u32 tmp; | ||
45 | |||
46 | /* SPE bit has to be 0 before we read MSPI STATUS */ | ||
47 | deadline = jiffies + BCM53XXSPI_SPE_TIMEOUT_MS * HZ / 1000; | ||
48 | do { | ||
49 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_SPCR2); | ||
50 | if (!(tmp & B53SPI_MSPI_SPCR2_SPE)) | ||
51 | break; | ||
52 | udelay(5); | ||
53 | } while (!time_after_eq(jiffies, deadline)); | ||
54 | |||
55 | if (tmp & B53SPI_MSPI_SPCR2_SPE) | ||
56 | goto spi_timeout; | ||
57 | |||
58 | /* Check status */ | ||
59 | deadline = jiffies + timeout_ms * HZ / 1000; | ||
60 | do { | ||
61 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_MSPI_STATUS); | ||
62 | if (tmp & B53SPI_MSPI_MSPI_STATUS_SPIF) { | ||
63 | bcm53xxspi_write(b53spi, B53SPI_MSPI_MSPI_STATUS, 0); | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | cpu_relax(); | ||
68 | udelay(100); | ||
69 | } while (!time_after_eq(jiffies, deadline)); | ||
70 | |||
71 | spi_timeout: | ||
72 | bcm53xxspi_write(b53spi, B53SPI_MSPI_MSPI_STATUS, 0); | ||
73 | |||
74 | pr_err("Timeout waiting for SPI to be ready!\n"); | ||
75 | |||
76 | return -EBUSY; | ||
77 | } | ||
78 | |||
79 | static void bcm53xxspi_buf_write(struct bcm53xxspi *b53spi, u8 *w_buf, | ||
80 | size_t len, bool cont) | ||
81 | { | ||
82 | u32 tmp; | ||
83 | int i; | ||
84 | |||
85 | for (i = 0; i < len; i++) { | ||
86 | /* Transmit Register File MSB */ | ||
87 | bcm53xxspi_write(b53spi, B53SPI_MSPI_TXRAM + 4 * (i * 2), | ||
88 | (unsigned int)w_buf[i]); | ||
89 | } | ||
90 | |||
91 | for (i = 0; i < len; i++) { | ||
92 | tmp = B53SPI_CDRAM_CONT | B53SPI_CDRAM_PCS_DISABLE_ALL | | ||
93 | B53SPI_CDRAM_PCS_DSCK; | ||
94 | if (!cont && i == len - 1) | ||
95 | tmp &= ~B53SPI_CDRAM_CONT; | ||
96 | tmp &= ~0x1; | ||
97 | /* Command Register File */ | ||
98 | bcm53xxspi_write(b53spi, B53SPI_MSPI_CDRAM + 4 * i, tmp); | ||
99 | } | ||
100 | |||
101 | /* Set queue pointers */ | ||
102 | bcm53xxspi_write(b53spi, B53SPI_MSPI_NEWQP, 0); | ||
103 | bcm53xxspi_write(b53spi, B53SPI_MSPI_ENDQP, len - 1); | ||
104 | |||
105 | if (cont) | ||
106 | bcm53xxspi_write(b53spi, B53SPI_MSPI_WRITE_LOCK, 1); | ||
107 | |||
108 | /* Start SPI transfer */ | ||
109 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_SPCR2); | ||
110 | tmp |= B53SPI_MSPI_SPCR2_SPE; | ||
111 | if (cont) | ||
112 | tmp |= B53SPI_MSPI_SPCR2_CONT_AFTER_CMD; | ||
113 | bcm53xxspi_write(b53spi, B53SPI_MSPI_SPCR2, tmp); | ||
114 | |||
115 | /* Wait for SPI to finish */ | ||
116 | bcm53xxspi_wait(b53spi, bcm53xxspi_calc_timeout(len)); | ||
117 | |||
118 | if (!cont) | ||
119 | bcm53xxspi_write(b53spi, B53SPI_MSPI_WRITE_LOCK, 0); | ||
120 | |||
121 | b53spi->read_offset = len; | ||
122 | } | ||
123 | |||
124 | static void bcm53xxspi_buf_read(struct bcm53xxspi *b53spi, u8 *r_buf, | ||
125 | size_t len, bool cont) | ||
126 | { | ||
127 | u32 tmp; | ||
128 | int i; | ||
129 | |||
130 | for (i = 0; i < b53spi->read_offset + len; i++) { | ||
131 | tmp = B53SPI_CDRAM_CONT | B53SPI_CDRAM_PCS_DISABLE_ALL | | ||
132 | B53SPI_CDRAM_PCS_DSCK; | ||
133 | if (!cont && i == b53spi->read_offset + len - 1) | ||
134 | tmp &= ~B53SPI_CDRAM_CONT; | ||
135 | tmp &= ~0x1; | ||
136 | /* Command Register File */ | ||
137 | bcm53xxspi_write(b53spi, B53SPI_MSPI_CDRAM + 4 * i, tmp); | ||
138 | } | ||
139 | |||
140 | /* Set queue pointers */ | ||
141 | bcm53xxspi_write(b53spi, B53SPI_MSPI_NEWQP, 0); | ||
142 | bcm53xxspi_write(b53spi, B53SPI_MSPI_ENDQP, | ||
143 | b53spi->read_offset + len - 1); | ||
144 | |||
145 | if (cont) | ||
146 | bcm53xxspi_write(b53spi, B53SPI_MSPI_WRITE_LOCK, 1); | ||
147 | |||
148 | /* Start SPI transfer */ | ||
149 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_SPCR2); | ||
150 | tmp |= B53SPI_MSPI_SPCR2_SPE; | ||
151 | if (cont) | ||
152 | tmp |= B53SPI_MSPI_SPCR2_CONT_AFTER_CMD; | ||
153 | bcm53xxspi_write(b53spi, B53SPI_MSPI_SPCR2, tmp); | ||
154 | |||
155 | /* Wait for SPI to finish */ | ||
156 | bcm53xxspi_wait(b53spi, bcm53xxspi_calc_timeout(len)); | ||
157 | |||
158 | if (!cont) | ||
159 | bcm53xxspi_write(b53spi, B53SPI_MSPI_WRITE_LOCK, 0); | ||
160 | |||
161 | for (i = 0; i < len; ++i) { | ||
162 | int offset = b53spi->read_offset + i; | ||
163 | |||
164 | /* Data stored in the transmit register file LSB */ | ||
165 | r_buf[i] = (u8)bcm53xxspi_read(b53spi, B53SPI_MSPI_RXRAM + 4 * (1 + offset * 2)); | ||
166 | } | ||
167 | |||
168 | b53spi->read_offset = 0; | ||
169 | } | ||
170 | |||
171 | static int bcm53xxspi_transfer_one(struct spi_master *master, | ||
172 | struct spi_device *spi, | ||
173 | struct spi_transfer *t) | ||
174 | { | ||
175 | struct bcm53xxspi *b53spi = spi_master_get_devdata(master); | ||
176 | u8 *buf; | ||
177 | size_t left; | ||
178 | |||
179 | if (t->tx_buf) { | ||
180 | buf = (u8 *)t->tx_buf; | ||
181 | left = t->len; | ||
182 | while (left) { | ||
183 | size_t to_write = min_t(size_t, 16, left); | ||
184 | bool cont = left - to_write > 0; | ||
185 | |||
186 | bcm53xxspi_buf_write(b53spi, buf, to_write, cont); | ||
187 | left -= to_write; | ||
188 | buf += to_write; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | if (t->rx_buf) { | ||
193 | buf = (u8 *)t->rx_buf; | ||
194 | left = t->len; | ||
195 | while (left) { | ||
196 | size_t to_read = min_t(size_t, 16 - b53spi->read_offset, | ||
197 | left); | ||
198 | bool cont = left - to_read > 0; | ||
199 | |||
200 | bcm53xxspi_buf_read(b53spi, buf, to_read, cont); | ||
201 | left -= to_read; | ||
202 | buf += to_read; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | return 0; | ||
207 | } | ||
208 | |||
209 | /************************************************** | ||
210 | * BCMA | ||
211 | **************************************************/ | ||
212 | |||
213 | static struct spi_board_info bcm53xx_info = { | ||
214 | .modalias = "bcm53xxspiflash", | ||
215 | }; | ||
216 | |||
217 | static const struct bcma_device_id bcm53xxspi_bcma_tbl[] = { | ||
218 | BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_QSPI, BCMA_ANY_REV, BCMA_ANY_CLASS), | ||
219 | BCMA_CORETABLE_END | ||
220 | }; | ||
221 | MODULE_DEVICE_TABLE(bcma, bcm53xxspi_bcma_tbl); | ||
222 | |||
223 | static int bcm53xxspi_bcma_probe(struct bcma_device *core) | ||
224 | { | ||
225 | struct bcm53xxspi *b53spi; | ||
226 | struct spi_master *master; | ||
227 | int err; | ||
228 | |||
229 | if (core->bus->drv_cc.core->id.rev != 42) { | ||
230 | pr_err("SPI on SoC with unsupported ChipCommon rev\n"); | ||
231 | return -ENOTSUPP; | ||
232 | } | ||
233 | |||
234 | master = spi_alloc_master(&core->dev, sizeof(*b53spi)); | ||
235 | if (!master) | ||
236 | return -ENOMEM; | ||
237 | |||
238 | b53spi = spi_master_get_devdata(master); | ||
239 | b53spi->master = master; | ||
240 | b53spi->core = core; | ||
241 | |||
242 | master->transfer_one = bcm53xxspi_transfer_one; | ||
243 | |||
244 | bcma_set_drvdata(core, b53spi); | ||
245 | |||
246 | err = devm_spi_register_master(&core->dev, master); | ||
247 | if (err) { | ||
248 | spi_master_put(master); | ||
249 | bcma_set_drvdata(core, NULL); | ||
250 | goto out; | ||
251 | } | ||
252 | |||
253 | /* Broadcom SoCs (at least with the CC rev 42) use SPI for flash only */ | ||
254 | spi_new_device(master, &bcm53xx_info); | ||
255 | |||
256 | out: | ||
257 | return err; | ||
258 | } | ||
259 | |||
260 | static void bcm53xxspi_bcma_remove(struct bcma_device *core) | ||
261 | { | ||
262 | struct bcm53xxspi *b53spi = bcma_get_drvdata(core); | ||
263 | |||
264 | spi_unregister_master(b53spi->master); | ||
265 | } | ||
266 | |||
267 | static struct bcma_driver bcm53xxspi_bcma_driver = { | ||
268 | .name = KBUILD_MODNAME, | ||
269 | .id_table = bcm53xxspi_bcma_tbl, | ||
270 | .probe = bcm53xxspi_bcma_probe, | ||
271 | .remove = bcm53xxspi_bcma_remove, | ||
272 | }; | ||
273 | |||
274 | /************************************************** | ||
275 | * Init & exit | ||
276 | **************************************************/ | ||
277 | |||
278 | static int __init bcm53xxspi_module_init(void) | ||
279 | { | ||
280 | int err = 0; | ||
281 | |||
282 | err = bcma_driver_register(&bcm53xxspi_bcma_driver); | ||
283 | if (err) | ||
284 | pr_err("Failed to register bcma driver: %d\n", err); | ||
285 | |||
286 | return err; | ||
287 | } | ||
288 | |||
289 | static void __exit bcm53xxspi_module_exit(void) | ||
290 | { | ||
291 | bcma_driver_unregister(&bcm53xxspi_bcma_driver); | ||
292 | } | ||
293 | |||
294 | module_init(bcm53xxspi_module_init); | ||
295 | module_exit(bcm53xxspi_module_exit); | ||
296 | |||
297 | MODULE_DESCRIPTION("Broadcom BCM53xx SPI Controller driver"); | ||
298 | MODULE_AUTHOR("Rafał Miłecki <zajec5@gmail.com>"); | ||
299 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/spi-bcm53xx.h b/drivers/spi/spi-bcm53xx.h new file mode 100644 index 000000000000..73575dfe6916 --- /dev/null +++ b/drivers/spi/spi-bcm53xx.h | |||
@@ -0,0 +1,72 @@ | |||
1 | #ifndef SPI_BCM53XX_H | ||
2 | #define SPI_BCM53XX_H | ||
3 | |||
4 | #define B53SPI_BSPI_REVISION_ID 0x000 | ||
5 | #define B53SPI_BSPI_SCRATCH 0x004 | ||
6 | #define B53SPI_BSPI_MAST_N_BOOT_CTRL 0x008 | ||
7 | #define B53SPI_BSPI_BUSY_STATUS 0x00c | ||
8 | #define B53SPI_BSPI_INTR_STATUS 0x010 | ||
9 | #define B53SPI_BSPI_B0_STATUS 0x014 | ||
10 | #define B53SPI_BSPI_B0_CTRL 0x018 | ||
11 | #define B53SPI_BSPI_B1_STATUS 0x01c | ||
12 | #define B53SPI_BSPI_B1_CTRL 0x020 | ||
13 | #define B53SPI_BSPI_STRAP_OVERRIDE_CTRL 0x024 | ||
14 | #define B53SPI_BSPI_FLEX_MODE_ENABLE 0x028 | ||
15 | #define B53SPI_BSPI_BITS_PER_CYCLE 0x02c | ||
16 | #define B53SPI_BSPI_BITS_PER_PHASE 0x030 | ||
17 | #define B53SPI_BSPI_CMD_AND_MODE_BYTE 0x034 | ||
18 | #define B53SPI_BSPI_BSPI_FLASH_UPPER_ADDR_BYTE 0x038 | ||
19 | #define B53SPI_BSPI_BSPI_XOR_VALUE 0x03c | ||
20 | #define B53SPI_BSPI_BSPI_XOR_ENABLE 0x040 | ||
21 | #define B53SPI_BSPI_BSPI_PIO_MODE_ENABLE 0x044 | ||
22 | #define B53SPI_BSPI_BSPI_PIO_IODIR 0x048 | ||
23 | #define B53SPI_BSPI_BSPI_PIO_DATA 0x04c | ||
24 | |||
25 | /* RAF */ | ||
26 | #define B53SPI_RAF_START_ADDR 0x100 | ||
27 | #define B53SPI_RAF_NUM_WORDS 0x104 | ||
28 | #define B53SPI_RAF_CTRL 0x108 | ||
29 | #define B53SPI_RAF_FULLNESS 0x10c | ||
30 | #define B53SPI_RAF_WATERMARK 0x110 | ||
31 | #define B53SPI_RAF_STATUS 0x114 | ||
32 | #define B53SPI_RAF_READ_DATA 0x118 | ||
33 | #define B53SPI_RAF_WORD_CNT 0x11c | ||
34 | #define B53SPI_RAF_CURR_ADDR 0x120 | ||
35 | |||
36 | /* MSPI */ | ||
37 | #define B53SPI_MSPI_SPCR0_LSB 0x200 | ||
38 | #define B53SPI_MSPI_SPCR0_MSB 0x204 | ||
39 | #define B53SPI_MSPI_SPCR1_LSB 0x208 | ||
40 | #define B53SPI_MSPI_SPCR1_MSB 0x20c | ||
41 | #define B53SPI_MSPI_NEWQP 0x210 | ||
42 | #define B53SPI_MSPI_ENDQP 0x214 | ||
43 | #define B53SPI_MSPI_SPCR2 0x218 | ||
44 | #define B53SPI_MSPI_SPCR2_SPE 0x00000040 | ||
45 | #define B53SPI_MSPI_SPCR2_CONT_AFTER_CMD 0x00000080 | ||
46 | #define B53SPI_MSPI_MSPI_STATUS 0x220 | ||
47 | #define B53SPI_MSPI_MSPI_STATUS_SPIF 0x00000001 | ||
48 | #define B53SPI_MSPI_CPTQP 0x224 | ||
49 | #define B53SPI_MSPI_TXRAM 0x240 /* 32 registers, up to 0x2b8 */ | ||
50 | #define B53SPI_MSPI_RXRAM 0x2c0 /* 32 registers, up to 0x33c */ | ||
51 | #define B53SPI_MSPI_CDRAM 0x340 /* 16 registers, up to 0x37c */ | ||
52 | #define B53SPI_CDRAM_PCS_PCS0 0x00000001 | ||
53 | #define B53SPI_CDRAM_PCS_PCS1 0x00000002 | ||
54 | #define B53SPI_CDRAM_PCS_PCS2 0x00000004 | ||
55 | #define B53SPI_CDRAM_PCS_PCS3 0x00000008 | ||
56 | #define B53SPI_CDRAM_PCS_DISABLE_ALL 0x0000000f | ||
57 | #define B53SPI_CDRAM_PCS_DSCK 0x00000010 | ||
58 | #define B53SPI_CDRAM_BITSE 0x00000040 | ||
59 | #define B53SPI_CDRAM_CONT 0x00000080 | ||
60 | #define B53SPI_MSPI_WRITE_LOCK 0x380 | ||
61 | #define B53SPI_MSPI_DISABLE_FLUSH_GEN 0x384 | ||
62 | |||
63 | /* Interrupt */ | ||
64 | #define B53SPI_INTR_RAF_LR_FULLNESS_REACHED 0x3a0 | ||
65 | #define B53SPI_INTR_RAF_LR_TRUNCATED 0x3a4 | ||
66 | #define B53SPI_INTR_RAF_LR_IMPATIENT 0x3a8 | ||
67 | #define B53SPI_INTR_RAF_LR_SESSION_DONE 0x3ac | ||
68 | #define B53SPI_INTR_RAF_LR_OVERREAD 0x3b0 | ||
69 | #define B53SPI_INTR_MSPI_DONE 0x3b4 | ||
70 | #define B53SPI_INTR_MSPI_HALT_SET_TRANSACTION_DONE 0x3b8 | ||
71 | |||
72 | #endif /* SPI_BCM53XX_H */ | ||
diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index 562ff83debd9..7b811e38c7ad 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c | |||
@@ -677,7 +677,6 @@ static struct platform_driver cdns_spi_driver = { | |||
677 | .remove = cdns_spi_remove, | 677 | .remove = cdns_spi_remove, |
678 | .driver = { | 678 | .driver = { |
679 | .name = CDNS_SPI_NAME, | 679 | .name = CDNS_SPI_NAME, |
680 | .owner = THIS_MODULE, | ||
681 | .of_match_table = cdns_spi_of_match, | 680 | .of_match_table = cdns_spi_of_match, |
682 | .pm = &cdns_spi_dev_pm_ops, | 681 | .pm = &cdns_spi_dev_pm_ops, |
683 | }, | 682 | }, |
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index ce538dad526b..181cf2262006 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c | |||
@@ -30,7 +30,6 @@ | |||
30 | struct spi_clps711x_data { | 30 | struct spi_clps711x_data { |
31 | void __iomem *syncio; | 31 | void __iomem *syncio; |
32 | struct regmap *syscon; | 32 | struct regmap *syscon; |
33 | struct regmap *syscon1; | ||
34 | struct clk *spi_clk; | 33 | struct clk *spi_clk; |
35 | 34 | ||
36 | u8 *tx_buf; | 35 | u8 *tx_buf; |
@@ -47,27 +46,6 @@ static int spi_clps711x_setup(struct spi_device *spi) | |||
47 | return 0; | 46 | return 0; |
48 | } | 47 | } |
49 | 48 | ||
50 | static void spi_clps711x_setup_xfer(struct spi_device *spi, | ||
51 | struct spi_transfer *xfer) | ||
52 | { | ||
53 | struct spi_master *master = spi->master; | ||
54 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); | ||
55 | |||
56 | /* Setup SPI frequency divider */ | ||
57 | if (xfer->speed_hz >= master->max_speed_hz) | ||
58 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, | ||
59 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(3)); | ||
60 | else if (xfer->speed_hz >= (master->max_speed_hz / 2)) | ||
61 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, | ||
62 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(2)); | ||
63 | else if (xfer->speed_hz >= (master->max_speed_hz / 8)) | ||
64 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, | ||
65 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(1)); | ||
66 | else | ||
67 | regmap_update_bits(hw->syscon1, SYSCON_OFFSET, | ||
68 | SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(0)); | ||
69 | } | ||
70 | |||
71 | static int spi_clps711x_prepare_message(struct spi_master *master, | 49 | static int spi_clps711x_prepare_message(struct spi_master *master, |
72 | struct spi_message *msg) | 50 | struct spi_message *msg) |
73 | { | 51 | { |
@@ -87,7 +65,7 @@ static int spi_clps711x_transfer_one(struct spi_master *master, | |||
87 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); | 65 | struct spi_clps711x_data *hw = spi_master_get_devdata(master); |
88 | u8 data; | 66 | u8 data; |
89 | 67 | ||
90 | spi_clps711x_setup_xfer(spi, xfer); | 68 | clk_set_rate(hw->spi_clk, xfer->speed_hz ? : spi->max_speed_hz); |
91 | 69 | ||
92 | hw->len = xfer->len; | 70 | hw->len = xfer->len; |
93 | hw->bpw = xfer->bits_per_word; | 71 | hw->bpw = xfer->bits_per_word; |
@@ -176,13 +154,11 @@ static int spi_clps711x_probe(struct platform_device *pdev) | |||
176 | } | 154 | } |
177 | } | 155 | } |
178 | 156 | ||
179 | hw->spi_clk = devm_clk_get(&pdev->dev, "spi"); | 157 | hw->spi_clk = devm_clk_get(&pdev->dev, NULL); |
180 | if (IS_ERR(hw->spi_clk)) { | 158 | if (IS_ERR(hw->spi_clk)) { |
181 | dev_err(&pdev->dev, "Can't get clocks\n"); | ||
182 | ret = PTR_ERR(hw->spi_clk); | 159 | ret = PTR_ERR(hw->spi_clk); |
183 | goto err_out; | 160 | goto err_out; |
184 | } | 161 | } |
185 | master->max_speed_hz = clk_get_rate(hw->spi_clk); | ||
186 | 162 | ||
187 | hw->syscon = syscon_regmap_lookup_by_pdevname("syscon.3"); | 163 | hw->syscon = syscon_regmap_lookup_by_pdevname("syscon.3"); |
188 | if (IS_ERR(hw->syscon)) { | 164 | if (IS_ERR(hw->syscon)) { |
@@ -190,12 +166,6 @@ static int spi_clps711x_probe(struct platform_device *pdev) | |||
190 | goto err_out; | 166 | goto err_out; |
191 | } | 167 | } |
192 | 168 | ||
193 | hw->syscon1 = syscon_regmap_lookup_by_pdevname("syscon.1"); | ||
194 | if (IS_ERR(hw->syscon1)) { | ||
195 | ret = PTR_ERR(hw->syscon1); | ||
196 | goto err_out; | ||
197 | } | ||
198 | |||
199 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 169 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
200 | hw->syncio = devm_ioremap_resource(&pdev->dev, res); | 170 | hw->syncio = devm_ioremap_resource(&pdev->dev, res); |
201 | if (IS_ERR(hw->syncio)) { | 171 | if (IS_ERR(hw->syncio)) { |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 514852cb7b3c..63700ab7bd9f 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -65,6 +65,7 @@ | |||
65 | 65 | ||
66 | /* SPIDAT1 (upper 16 bit defines) */ | 66 | /* SPIDAT1 (upper 16 bit defines) */ |
67 | #define SPIDAT1_CSHOLD_MASK BIT(12) | 67 | #define SPIDAT1_CSHOLD_MASK BIT(12) |
68 | #define SPIDAT1_WDEL BIT(10) | ||
68 | 69 | ||
69 | /* SPIGCR1 */ | 70 | /* SPIGCR1 */ |
70 | #define SPIGCR1_CLKMOD_MASK BIT(1) | 71 | #define SPIGCR1_CLKMOD_MASK BIT(1) |
@@ -213,6 +214,7 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) | |||
213 | { | 214 | { |
214 | struct davinci_spi *dspi; | 215 | struct davinci_spi *dspi; |
215 | struct davinci_spi_platform_data *pdata; | 216 | struct davinci_spi_platform_data *pdata; |
217 | struct davinci_spi_config *spicfg = spi->controller_data; | ||
216 | u8 chip_sel = spi->chip_select; | 218 | u8 chip_sel = spi->chip_select; |
217 | u16 spidat1 = CS_DEFAULT; | 219 | u16 spidat1 = CS_DEFAULT; |
218 | bool gpio_chipsel = false; | 220 | bool gpio_chipsel = false; |
@@ -227,6 +229,10 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) | |||
227 | gpio = spi->cs_gpio; | 229 | gpio = spi->cs_gpio; |
228 | } | 230 | } |
229 | 231 | ||
232 | /* program delay transfers if tx_delay is non zero */ | ||
233 | if (spicfg->wdelay) | ||
234 | spidat1 |= SPIDAT1_WDEL; | ||
235 | |||
230 | /* | 236 | /* |
231 | * Board specific chip select logic decides the polarity and cs | 237 | * Board specific chip select logic decides the polarity and cs |
232 | * line for the controller | 238 | * line for the controller |
@@ -241,9 +247,9 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) | |||
241 | spidat1 |= SPIDAT1_CSHOLD_MASK; | 247 | spidat1 |= SPIDAT1_CSHOLD_MASK; |
242 | spidat1 &= ~(0x1 << chip_sel); | 248 | spidat1 &= ~(0x1 << chip_sel); |
243 | } | 249 | } |
244 | |||
245 | iowrite16(spidat1, dspi->base + SPIDAT1 + 2); | ||
246 | } | 250 | } |
251 | |||
252 | iowrite16(spidat1, dspi->base + SPIDAT1 + 2); | ||
247 | } | 253 | } |
248 | 254 | ||
249 | /** | 255 | /** |
@@ -289,7 +295,7 @@ static int davinci_spi_setup_transfer(struct spi_device *spi, | |||
289 | int prescale; | 295 | int prescale; |
290 | 296 | ||
291 | dspi = spi_master_get_devdata(spi->master); | 297 | dspi = spi_master_get_devdata(spi->master); |
292 | spicfg = (struct davinci_spi_config *)spi->controller_data; | 298 | spicfg = spi->controller_data; |
293 | if (!spicfg) | 299 | if (!spicfg) |
294 | spicfg = &davinci_spi_default_cfg; | 300 | spicfg = &davinci_spi_default_cfg; |
295 | 301 | ||
@@ -337,6 +343,14 @@ static int davinci_spi_setup_transfer(struct spi_device *spi, | |||
337 | spifmt |= SPIFMT_PHASE_MASK; | 343 | spifmt |= SPIFMT_PHASE_MASK; |
338 | 344 | ||
339 | /* | 345 | /* |
346 | * Assume wdelay is used only on SPI peripherals that has this field | ||
347 | * in SPIFMTn register and when it's configured from board file or DT. | ||
348 | */ | ||
349 | if (spicfg->wdelay) | ||
350 | spifmt |= ((spicfg->wdelay << SPIFMT_WDELAY_SHIFT) | ||
351 | & SPIFMT_WDELAY_MASK); | ||
352 | |||
353 | /* | ||
340 | * Version 1 hardware supports two basic SPI modes: | 354 | * Version 1 hardware supports two basic SPI modes: |
341 | * - Standard SPI mode uses 4 pins, with chipselect | 355 | * - Standard SPI mode uses 4 pins, with chipselect |
342 | * - 3 pin SPI is a 4 pin variant without CS (SPI_NO_CS) | 356 | * - 3 pin SPI is a 4 pin variant without CS (SPI_NO_CS) |
@@ -353,9 +367,6 @@ static int davinci_spi_setup_transfer(struct spi_device *spi, | |||
353 | 367 | ||
354 | u32 delay = 0; | 368 | u32 delay = 0; |
355 | 369 | ||
356 | spifmt |= ((spicfg->wdelay << SPIFMT_WDELAY_SHIFT) | ||
357 | & SPIFMT_WDELAY_MASK); | ||
358 | |||
359 | if (spicfg->odd_parity) | 370 | if (spicfg->odd_parity) |
360 | spifmt |= SPIFMT_ODD_PARITY_MASK; | 371 | spifmt |= SPIFMT_ODD_PARITY_MASK; |
361 | 372 | ||
@@ -387,6 +398,26 @@ static int davinci_spi_setup_transfer(struct spi_device *spi, | |||
387 | return 0; | 398 | return 0; |
388 | } | 399 | } |
389 | 400 | ||
401 | static int davinci_spi_of_setup(struct spi_device *spi) | ||
402 | { | ||
403 | struct davinci_spi_config *spicfg = spi->controller_data; | ||
404 | struct device_node *np = spi->dev.of_node; | ||
405 | u32 prop; | ||
406 | |||
407 | if (spicfg == NULL && np) { | ||
408 | spicfg = kzalloc(sizeof(*spicfg), GFP_KERNEL); | ||
409 | if (!spicfg) | ||
410 | return -ENOMEM; | ||
411 | *spicfg = davinci_spi_default_cfg; | ||
412 | /* override with dt configured values */ | ||
413 | if (!of_property_read_u32(np, "ti,spi-wdelay", &prop)) | ||
414 | spicfg->wdelay = (u8)prop; | ||
415 | spi->controller_data = spicfg; | ||
416 | } | ||
417 | |||
418 | return 0; | ||
419 | } | ||
420 | |||
390 | /** | 421 | /** |
391 | * davinci_spi_setup - This functions will set default transfer method | 422 | * davinci_spi_setup - This functions will set default transfer method |
392 | * @spi: spi device on which data transfer to be done | 423 | * @spi: spi device on which data transfer to be done |
@@ -401,36 +432,33 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
401 | struct spi_master *master = spi->master; | 432 | struct spi_master *master = spi->master; |
402 | struct device_node *np = spi->dev.of_node; | 433 | struct device_node *np = spi->dev.of_node; |
403 | bool internal_cs = true; | 434 | bool internal_cs = true; |
404 | unsigned long flags = GPIOF_DIR_OUT; | ||
405 | 435 | ||
406 | dspi = spi_master_get_devdata(spi->master); | 436 | dspi = spi_master_get_devdata(spi->master); |
407 | pdata = &dspi->pdata; | 437 | pdata = &dspi->pdata; |
408 | 438 | ||
409 | flags |= (spi->mode & SPI_CS_HIGH) ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH; | ||
410 | |||
411 | if (!(spi->mode & SPI_NO_CS)) { | 439 | if (!(spi->mode & SPI_NO_CS)) { |
412 | if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { | 440 | if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { |
413 | retval = gpio_request_one(spi->cs_gpio, | 441 | retval = gpio_direction_output( |
414 | flags, dev_name(&spi->dev)); | 442 | spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
415 | internal_cs = false; | 443 | internal_cs = false; |
416 | } else if (pdata->chip_sel && | 444 | } else if (pdata->chip_sel && |
417 | spi->chip_select < pdata->num_chipselect && | 445 | spi->chip_select < pdata->num_chipselect && |
418 | pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { | 446 | pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { |
419 | spi->cs_gpio = pdata->chip_sel[spi->chip_select]; | 447 | spi->cs_gpio = pdata->chip_sel[spi->chip_select]; |
420 | retval = gpio_request_one(spi->cs_gpio, | 448 | retval = gpio_direction_output( |
421 | flags, dev_name(&spi->dev)); | 449 | spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
422 | internal_cs = false; | 450 | internal_cs = false; |
423 | } | 451 | } |
424 | } | ||
425 | 452 | ||
426 | if (retval) { | 453 | if (retval) { |
427 | dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", | 454 | dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", |
428 | spi->cs_gpio, retval); | 455 | spi->cs_gpio, retval); |
429 | return retval; | 456 | return retval; |
430 | } | 457 | } |
431 | 458 | ||
432 | if (internal_cs) | 459 | if (internal_cs) |
433 | set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); | 460 | set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); |
461 | } | ||
434 | 462 | ||
435 | if (spi->mode & SPI_READY) | 463 | if (spi->mode & SPI_READY) |
436 | set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK); | 464 | set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK); |
@@ -440,13 +468,16 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
440 | else | 468 | else |
441 | clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_LOOPBACK_MASK); | 469 | clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_LOOPBACK_MASK); |
442 | 470 | ||
443 | return retval; | 471 | return davinci_spi_of_setup(spi); |
444 | } | 472 | } |
445 | 473 | ||
446 | static void davinci_spi_cleanup(struct spi_device *spi) | 474 | static void davinci_spi_cleanup(struct spi_device *spi) |
447 | { | 475 | { |
448 | if (spi->cs_gpio >= 0) | 476 | struct davinci_spi_config *spicfg = spi->controller_data; |
449 | gpio_free(spi->cs_gpio); | 477 | |
478 | spi->controller_data = NULL; | ||
479 | if (spi->dev.of_node) | ||
480 | kfree(spicfg); | ||
450 | } | 481 | } |
451 | 482 | ||
452 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) | 483 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) |
@@ -971,6 +1002,27 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
971 | if (dspi->version == SPI_VERSION_2) | 1002 | if (dspi->version == SPI_VERSION_2) |
972 | dspi->bitbang.flags |= SPI_READY; | 1003 | dspi->bitbang.flags |= SPI_READY; |
973 | 1004 | ||
1005 | if (pdev->dev.of_node) { | ||
1006 | int i; | ||
1007 | |||
1008 | for (i = 0; i < pdata->num_chipselect; i++) { | ||
1009 | int cs_gpio = of_get_named_gpio(pdev->dev.of_node, | ||
1010 | "cs-gpios", i); | ||
1011 | |||
1012 | if (cs_gpio == -EPROBE_DEFER) { | ||
1013 | ret = cs_gpio; | ||
1014 | goto free_clk; | ||
1015 | } | ||
1016 | |||
1017 | if (gpio_is_valid(cs_gpio)) { | ||
1018 | ret = devm_gpio_request(&pdev->dev, cs_gpio, | ||
1019 | dev_name(&pdev->dev)); | ||
1020 | if (ret) | ||
1021 | goto free_clk; | ||
1022 | } | ||
1023 | } | ||
1024 | } | ||
1025 | |||
974 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 1026 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
975 | if (r) | 1027 | if (r) |
976 | dma_rx_chan = r->start; | 1028 | dma_rx_chan = r->start; |
diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 1ca8f66ca2ea..46c6d58e1fda 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c | |||
@@ -113,8 +113,7 @@ static void dw_spi_dma_done(void *arg) | |||
113 | 113 | ||
114 | static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | 114 | static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) |
115 | { | 115 | { |
116 | struct dma_async_tx_descriptor *txdesc = NULL, *rxdesc = NULL; | 116 | struct dma_async_tx_descriptor *txdesc, *rxdesc; |
117 | struct dma_chan *txchan, *rxchan; | ||
118 | struct dma_slave_config txconf, rxconf; | 117 | struct dma_slave_config txconf, rxconf; |
119 | u16 dma_ctrl = 0; | 118 | u16 dma_ctrl = 0; |
120 | 119 | ||
@@ -124,16 +123,14 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
124 | dw_writew(dws, DW_SPI_DMARDLR, 0xf); | 123 | dw_writew(dws, DW_SPI_DMARDLR, 0xf); |
125 | dw_writew(dws, DW_SPI_DMATDLR, 0x10); | 124 | dw_writew(dws, DW_SPI_DMATDLR, 0x10); |
126 | if (dws->tx_dma) | 125 | if (dws->tx_dma) |
127 | dma_ctrl |= 0x2; | 126 | dma_ctrl |= SPI_DMA_TDMAE; |
128 | if (dws->rx_dma) | 127 | if (dws->rx_dma) |
129 | dma_ctrl |= 0x1; | 128 | dma_ctrl |= SPI_DMA_RDMAE; |
130 | dw_writew(dws, DW_SPI_DMACR, dma_ctrl); | 129 | dw_writew(dws, DW_SPI_DMACR, dma_ctrl); |
131 | spi_enable_chip(dws, 1); | 130 | spi_enable_chip(dws, 1); |
132 | } | 131 | } |
133 | 132 | ||
134 | dws->dma_chan_done = 0; | 133 | dws->dma_chan_done = 0; |
135 | txchan = dws->txchan; | ||
136 | rxchan = dws->rxchan; | ||
137 | 134 | ||
138 | /* 2. Prepare the TX dma transfer */ | 135 | /* 2. Prepare the TX dma transfer */ |
139 | txconf.direction = DMA_MEM_TO_DEV; | 136 | txconf.direction = DMA_MEM_TO_DEV; |
@@ -143,17 +140,17 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
143 | txconf.dst_addr_width = dws->dma_width; | 140 | txconf.dst_addr_width = dws->dma_width; |
144 | txconf.device_fc = false; | 141 | txconf.device_fc = false; |
145 | 142 | ||
146 | dmaengine_slave_config(txchan, &txconf); | 143 | dmaengine_slave_config(dws->txchan, &txconf); |
147 | 144 | ||
148 | memset(&dws->tx_sgl, 0, sizeof(dws->tx_sgl)); | 145 | memset(&dws->tx_sgl, 0, sizeof(dws->tx_sgl)); |
149 | dws->tx_sgl.dma_address = dws->tx_dma; | 146 | dws->tx_sgl.dma_address = dws->tx_dma; |
150 | dws->tx_sgl.length = dws->len; | 147 | dws->tx_sgl.length = dws->len; |
151 | 148 | ||
152 | txdesc = dmaengine_prep_slave_sg(txchan, | 149 | txdesc = dmaengine_prep_slave_sg(dws->txchan, |
153 | &dws->tx_sgl, | 150 | &dws->tx_sgl, |
154 | 1, | 151 | 1, |
155 | DMA_MEM_TO_DEV, | 152 | DMA_MEM_TO_DEV, |
156 | DMA_PREP_INTERRUPT); | 153 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
157 | txdesc->callback = dw_spi_dma_done; | 154 | txdesc->callback = dw_spi_dma_done; |
158 | txdesc->callback_param = dws; | 155 | txdesc->callback_param = dws; |
159 | 156 | ||
@@ -165,23 +162,27 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
165 | rxconf.src_addr_width = dws->dma_width; | 162 | rxconf.src_addr_width = dws->dma_width; |
166 | rxconf.device_fc = false; | 163 | rxconf.device_fc = false; |
167 | 164 | ||
168 | dmaengine_slave_config(txchan, &rxconf); | 165 | dmaengine_slave_config(dws->rxchan, &rxconf); |
169 | 166 | ||
170 | memset(&dws->rx_sgl, 0, sizeof(dws->rx_sgl)); | 167 | memset(&dws->rx_sgl, 0, sizeof(dws->rx_sgl)); |
171 | dws->rx_sgl.dma_address = dws->rx_dma; | 168 | dws->rx_sgl.dma_address = dws->rx_dma; |
172 | dws->rx_sgl.length = dws->len; | 169 | dws->rx_sgl.length = dws->len; |
173 | 170 | ||
174 | rxdesc = dmaengine_prep_slave_sg(rxchan, | 171 | rxdesc = dmaengine_prep_slave_sg(dws->rxchan, |
175 | &dws->rx_sgl, | 172 | &dws->rx_sgl, |
176 | 1, | 173 | 1, |
177 | DMA_DEV_TO_MEM, | 174 | DMA_DEV_TO_MEM, |
178 | DMA_PREP_INTERRUPT); | 175 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
179 | rxdesc->callback = dw_spi_dma_done; | 176 | rxdesc->callback = dw_spi_dma_done; |
180 | rxdesc->callback_param = dws; | 177 | rxdesc->callback_param = dws; |
181 | 178 | ||
182 | /* rx must be started before tx due to spi instinct */ | 179 | /* rx must be started before tx due to spi instinct */ |
183 | rxdesc->tx_submit(rxdesc); | 180 | dmaengine_submit(rxdesc); |
184 | txdesc->tx_submit(txdesc); | 181 | dma_async_issue_pending(dws->rxchan); |
182 | |||
183 | dmaengine_submit(txdesc); | ||
184 | dma_async_issue_pending(dws->txchan); | ||
185 | |||
185 | return 0; | 186 | return 0; |
186 | } | 187 | } |
187 | 188 | ||
diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index c90a45009b9b..ba68da12cdf0 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c | |||
@@ -63,6 +63,8 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
63 | if (ret) | 63 | if (ret) |
64 | return ret; | 64 | return ret; |
65 | 65 | ||
66 | dws->regs = pcim_iomap_table(pdev)[pci_bar]; | ||
67 | |||
66 | dws->bus_num = 0; | 68 | dws->bus_num = 0; |
67 | dws->num_cs = 4; | 69 | dws->num_cs = 4; |
68 | dws->irq = pdev->irq; | 70 | dws->irq = pdev->irq; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 6bb484919e58..72e12bad14b9 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -265,7 +265,7 @@ static void giveback(struct dw_spi *dws) | |||
265 | transfer_list); | 265 | transfer_list); |
266 | 266 | ||
267 | if (!last_transfer->cs_change) | 267 | if (!last_transfer->cs_change) |
268 | spi_chip_sel(dws, dws->cur_msg->spi, 0); | 268 | spi_chip_sel(dws, msg->spi, 0); |
269 | 269 | ||
270 | spi_finalize_current_message(dws->master); | 270 | spi_finalize_current_message(dws->master); |
271 | } | 271 | } |
@@ -542,8 +542,7 @@ static int dw_spi_setup(struct spi_device *spi) | |||
542 | /* Only alloc on first setup */ | 542 | /* Only alloc on first setup */ |
543 | chip = spi_get_ctldata(spi); | 543 | chip = spi_get_ctldata(spi); |
544 | if (!chip) { | 544 | if (!chip) { |
545 | chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), | 545 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); |
546 | GFP_KERNEL); | ||
547 | if (!chip) | 546 | if (!chip) |
548 | return -ENOMEM; | 547 | return -ENOMEM; |
549 | spi_set_ctldata(spi, chip); | 548 | spi_set_ctldata(spi, chip); |
@@ -604,6 +603,14 @@ static int dw_spi_setup(struct spi_device *spi) | |||
604 | return 0; | 603 | return 0; |
605 | } | 604 | } |
606 | 605 | ||
606 | static void dw_spi_cleanup(struct spi_device *spi) | ||
607 | { | ||
608 | struct chip_data *chip = spi_get_ctldata(spi); | ||
609 | |||
610 | kfree(chip); | ||
611 | spi_set_ctldata(spi, NULL); | ||
612 | } | ||
613 | |||
607 | /* Restart the controller, disable all interrupts, clean rx fifo */ | 614 | /* Restart the controller, disable all interrupts, clean rx fifo */ |
608 | static void spi_hw_init(struct dw_spi *dws) | 615 | static void spi_hw_init(struct dw_spi *dws) |
609 | { | 616 | { |
@@ -659,8 +666,10 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
659 | master->bus_num = dws->bus_num; | 666 | master->bus_num = dws->bus_num; |
660 | master->num_chipselect = dws->num_cs; | 667 | master->num_chipselect = dws->num_cs; |
661 | master->setup = dw_spi_setup; | 668 | master->setup = dw_spi_setup; |
669 | master->cleanup = dw_spi_cleanup; | ||
662 | master->transfer_one_message = dw_spi_transfer_one_message; | 670 | master->transfer_one_message = dw_spi_transfer_one_message; |
663 | master->max_speed_hz = dws->max_freq; | 671 | master->max_speed_hz = dws->max_freq; |
672 | master->dev.of_node = dev->of_node; | ||
664 | 673 | ||
665 | /* Basic HW init */ | 674 | /* Basic HW init */ |
666 | spi_hw_init(dws); | 675 | spi_hw_init(dws); |
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index 089fc4ba3ace..83a103a76481 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h | |||
@@ -74,6 +74,10 @@ | |||
74 | #define SPI_INT_RXFI (1 << 4) | 74 | #define SPI_INT_RXFI (1 << 4) |
75 | #define SPI_INT_MSTI (1 << 5) | 75 | #define SPI_INT_MSTI (1 << 5) |
76 | 76 | ||
77 | /* Bit fields in DMACR */ | ||
78 | #define SPI_DMA_RDMAE (1 << 0) | ||
79 | #define SPI_DMA_TDMAE (1 << 1) | ||
80 | |||
77 | /* TX RX interrupt level threshold, max can be 256 */ | 81 | /* TX RX interrupt level threshold, max can be 256 */ |
78 | #define SPI_INT_THRESHOLD 32 | 82 | #define SPI_INT_THRESHOLD 32 |
79 | 83 | ||
diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c index 54b06376f03c..c5dd20beee22 100644 --- a/drivers/spi/spi-fsl-cpm.c +++ b/drivers/spi/spi-fsl-cpm.c | |||
@@ -15,17 +15,17 @@ | |||
15 | * Free Software Foundation; either version 2 of the License, or (at your | 15 | * Free Software Foundation; either version 2 of the License, or (at your |
16 | * option) any later version. | 16 | * option) any later version. |
17 | */ | 17 | */ |
18 | #include <linux/types.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/spi/spi.h> | ||
21 | #include <linux/fsl_devices.h> | ||
22 | #include <linux/dma-mapping.h> | ||
23 | #include <linux/of_address.h> | ||
24 | #include <asm/cpm.h> | 18 | #include <asm/cpm.h> |
25 | #include <asm/qe.h> | 19 | #include <asm/qe.h> |
20 | #include <linux/dma-mapping.h> | ||
21 | #include <linux/fsl_devices.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/of_address.h> | ||
24 | #include <linux/spi/spi.h> | ||
25 | #include <linux/types.h> | ||
26 | 26 | ||
27 | #include "spi-fsl-lib.h" | ||
28 | #include "spi-fsl-cpm.h" | 27 | #include "spi-fsl-cpm.h" |
28 | #include "spi-fsl-lib.h" | ||
29 | #include "spi-fsl-spi.h" | 29 | #include "spi-fsl-spi.h" |
30 | 30 | ||
31 | /* CPM1 and CPM2 are mutually exclusive. */ | 31 | /* CPM1 and CPM2 are mutually exclusive. */ |
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 5021ddf03f60..448216025ce8 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c | |||
@@ -13,22 +13,22 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/clk.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/io.h> | ||
16 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 23 | #include <linux/module.h> |
18 | #include <linux/interrupt.h> | 24 | #include <linux/of.h> |
19 | #include <linux/errno.h> | 25 | #include <linux/of_device.h> |
20 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/pm_runtime.h> | ||
21 | #include <linux/regmap.h> | 28 | #include <linux/regmap.h> |
22 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
23 | #include <linux/delay.h> | ||
24 | #include <linux/io.h> | ||
25 | #include <linux/clk.h> | ||
26 | #include <linux/err.h> | ||
27 | #include <linux/spi/spi.h> | 30 | #include <linux/spi/spi.h> |
28 | #include <linux/spi/spi_bitbang.h> | 31 | #include <linux/spi/spi_bitbang.h> |
29 | #include <linux/pm_runtime.h> | ||
30 | #include <linux/of.h> | ||
31 | #include <linux/of_device.h> | ||
32 | 32 | ||
33 | #define DRIVER_NAME "fsl-dspi" | 33 | #define DRIVER_NAME "fsl-dspi" |
34 | 34 | ||
@@ -493,9 +493,6 @@ static int dspi_probe(struct platform_device *pdev) | |||
493 | } | 493 | } |
494 | 494 | ||
495 | dspi_regmap_config.lock_arg = dspi; | 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, | 496 | dspi->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "dspi", base, |
500 | &dspi_regmap_config); | 497 | &dspi_regmap_config); |
501 | if (IS_ERR(dspi->regmap)) { | 498 | if (IS_ERR(dspi->regmap)) { |
@@ -535,7 +532,6 @@ static int dspi_probe(struct platform_device *pdev) | |||
535 | goto out_clk_put; | 532 | goto out_clk_put; |
536 | } | 533 | } |
537 | 534 | ||
538 | pr_info(KERN_INFO "Freescale DSPI master initialized\n"); | ||
539 | return ret; | 535 | return ret; |
540 | 536 | ||
541 | out_clk_put: | 537 | out_clk_put: |
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 8ebd724e4c59..a7f94b6a9e70 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -8,19 +8,19 @@ | |||
8 | * Free Software Foundation; either version 2 of the License, or (at your | 8 | * Free Software Foundation; either version 2 of the License, or (at your |
9 | * option) any later version. | 9 | * option) any later version. |
10 | */ | 10 | */ |
11 | #include <linux/module.h> | ||
12 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
13 | #include <linux/irq.h> | 12 | #include <linux/err.h> |
14 | #include <linux/spi/spi.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/fsl_devices.h> | 13 | #include <linux/fsl_devices.h> |
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
20 | #include <linux/of_irq.h> | 20 | #include <linux/of_irq.h> |
21 | #include <linux/of_platform.h> | 21 | #include <linux/of_platform.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/err.h> | 23 | #include <linux/spi/spi.h> |
24 | #include <sysdev/fsl_soc.h> | 24 | #include <sysdev/fsl_soc.h> |
25 | 25 | ||
26 | #include "spi-fsl-lib.h" | 26 | #include "spi-fsl-lib.h" |
@@ -452,16 +452,16 @@ static int fsl_espi_setup(struct spi_device *spi) | |||
452 | int retval; | 452 | int retval; |
453 | u32 hw_mode; | 453 | u32 hw_mode; |
454 | u32 loop_mode; | 454 | u32 loop_mode; |
455 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 455 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
456 | 456 | ||
457 | if (!spi->max_speed_hz) | 457 | if (!spi->max_speed_hz) |
458 | return -EINVAL; | 458 | return -EINVAL; |
459 | 459 | ||
460 | if (!cs) { | 460 | if (!cs) { |
461 | cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); | 461 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); |
462 | if (!cs) | 462 | if (!cs) |
463 | return -ENOMEM; | 463 | return -ENOMEM; |
464 | spi->controller_state = cs; | 464 | spi_set_ctldata(spi, cs); |
465 | } | 465 | } |
466 | 466 | ||
467 | mpc8xxx_spi = spi_master_get_devdata(spi->master); | 467 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
@@ -496,6 +496,14 @@ static int fsl_espi_setup(struct spi_device *spi) | |||
496 | return 0; | 496 | return 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | static void fsl_espi_cleanup(struct spi_device *spi) | ||
500 | { | ||
501 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); | ||
502 | |||
503 | kfree(cs); | ||
504 | spi_set_ctldata(spi, NULL); | ||
505 | } | ||
506 | |||
499 | void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | 507 | void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) |
500 | { | 508 | { |
501 | struct fsl_espi_reg *reg_base = mspi->reg_base; | 509 | struct fsl_espi_reg *reg_base = mspi->reg_base; |
@@ -605,6 +613,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev, | |||
605 | 613 | ||
606 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); | 614 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); |
607 | master->setup = fsl_espi_setup; | 615 | master->setup = fsl_espi_setup; |
616 | master->cleanup = fsl_espi_cleanup; | ||
608 | 617 | ||
609 | mpc8xxx_spi = spi_master_get_devdata(master); | 618 | mpc8xxx_spi = spi_master_get_devdata(master); |
610 | mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; | 619 | mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; |
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index e0b773fc29cb..5ddb5b098e4e 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c | |||
@@ -16,10 +16,10 @@ | |||
16 | * Free Software Foundation; either version 2 of the License, or (at your | 16 | * Free Software Foundation; either version 2 of the License, or (at your |
17 | * option) any later version. | 17 | * option) any later version. |
18 | */ | 18 | */ |
19 | #include <linux/kernel.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/fsl_devices.h> | ||
22 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/fsl_devices.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
25 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 9452f6740997..ed792880c9d6 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -19,25 +19,25 @@ | |||
19 | * Free Software Foundation; either version 2 of the License, or (at your | 19 | * Free Software Foundation; either version 2 of the License, or (at your |
20 | * option) any later version. | 20 | * option) any later version. |
21 | */ | 21 | */ |
22 | #include <linux/module.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
27 | #include <linux/irq.h> | ||
28 | #include <linux/spi/spi.h> | ||
29 | #include <linux/spi/spi_bitbang.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/fsl_devices.h> | ||
32 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
24 | #include <linux/fsl_devices.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/irq.h> | ||
28 | #include <linux/kernel.h> | ||
33 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
30 | #include <linux/module.h> | ||
34 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
35 | #include <linux/of.h> | 32 | #include <linux/of.h> |
36 | #include <linux/of_platform.h> | ||
37 | #include <linux/of_address.h> | 33 | #include <linux/of_address.h> |
38 | #include <linux/of_irq.h> | 34 | #include <linux/of_irq.h> |
39 | #include <linux/gpio.h> | ||
40 | #include <linux/of_gpio.h> | 35 | #include <linux/of_gpio.h> |
36 | #include <linux/of_platform.h> | ||
37 | #include <linux/platform_device.h> | ||
38 | #include <linux/spi/spi.h> | ||
39 | #include <linux/spi/spi_bitbang.h> | ||
40 | #include <linux/types.h> | ||
41 | 41 | ||
42 | #include "spi-fsl-lib.h" | 42 | #include "spi-fsl-lib.h" |
43 | #include "spi-fsl-cpm.h" | 43 | #include "spi-fsl-cpm.h" |
@@ -425,16 +425,16 @@ static int fsl_spi_setup(struct spi_device *spi) | |||
425 | struct fsl_spi_reg *reg_base; | 425 | struct fsl_spi_reg *reg_base; |
426 | int retval; | 426 | int retval; |
427 | u32 hw_mode; | 427 | u32 hw_mode; |
428 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 428 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
429 | 429 | ||
430 | if (!spi->max_speed_hz) | 430 | if (!spi->max_speed_hz) |
431 | return -EINVAL; | 431 | return -EINVAL; |
432 | 432 | ||
433 | if (!cs) { | 433 | if (!cs) { |
434 | cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); | 434 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); |
435 | if (!cs) | 435 | if (!cs) |
436 | return -ENOMEM; | 436 | return -ENOMEM; |
437 | spi->controller_state = cs; | 437 | spi_set_ctldata(spi, cs); |
438 | } | 438 | } |
439 | mpc8xxx_spi = spi_master_get_devdata(spi->master); | 439 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
440 | 440 | ||
@@ -496,9 +496,13 @@ static int fsl_spi_setup(struct spi_device *spi) | |||
496 | static void fsl_spi_cleanup(struct spi_device *spi) | 496 | static void fsl_spi_cleanup(struct spi_device *spi) |
497 | { | 497 | { |
498 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 498 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
499 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); | ||
499 | 500 | ||
500 | if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) | 501 | if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) |
501 | gpio_free(spi->cs_gpio); | 502 | gpio_free(spi->cs_gpio); |
503 | |||
504 | kfree(cs); | ||
505 | spi_set_ctldata(spi, NULL); | ||
502 | } | 506 | } |
503 | 507 | ||
504 | static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | 508 | static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 5daff2054ae4..3637847b5370 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/completion.h> | 22 | #include <linux/completion.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/dmaengine.h> | ||
25 | #include <linux/dma-mapping.h> | ||
24 | #include <linux/err.h> | 26 | #include <linux/err.h> |
25 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
26 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
@@ -37,6 +39,7 @@ | |||
37 | #include <linux/of_device.h> | 39 | #include <linux/of_device.h> |
38 | #include <linux/of_gpio.h> | 40 | #include <linux/of_gpio.h> |
39 | 41 | ||
42 | #include <linux/platform_data/dma-imx.h> | ||
40 | #include <linux/platform_data/spi-imx.h> | 43 | #include <linux/platform_data/spi-imx.h> |
41 | 44 | ||
42 | #define DRIVER_NAME "spi_imx" | 45 | #define DRIVER_NAME "spi_imx" |
@@ -51,6 +54,9 @@ | |||
51 | #define MXC_INT_RR (1 << 0) /* Receive data ready interrupt */ | 54 | #define MXC_INT_RR (1 << 0) /* Receive data ready interrupt */ |
52 | #define MXC_INT_TE (1 << 1) /* Transmit FIFO empty interrupt */ | 55 | #define MXC_INT_TE (1 << 1) /* Transmit FIFO empty interrupt */ |
53 | 56 | ||
57 | /* The maximum bytes that a sdma BD can transfer.*/ | ||
58 | #define MAX_SDMA_BD_BYTES (1 << 15) | ||
59 | #define IMX_DMA_TIMEOUT (msecs_to_jiffies(3000)) | ||
54 | struct spi_imx_config { | 60 | struct spi_imx_config { |
55 | unsigned int speed_hz; | 61 | unsigned int speed_hz; |
56 | unsigned int bpw; | 62 | unsigned int bpw; |
@@ -95,6 +101,16 @@ struct spi_imx_data { | |||
95 | const void *tx_buf; | 101 | const void *tx_buf; |
96 | unsigned int txfifo; /* number of words pushed in tx FIFO */ | 102 | unsigned int txfifo; /* number of words pushed in tx FIFO */ |
97 | 103 | ||
104 | /* DMA */ | ||
105 | unsigned int dma_is_inited; | ||
106 | unsigned int dma_finished; | ||
107 | bool usedma; | ||
108 | u32 rx_wml; | ||
109 | u32 tx_wml; | ||
110 | u32 rxt_wml; | ||
111 | struct completion dma_rx_completion; | ||
112 | struct completion dma_tx_completion; | ||
113 | |||
98 | const struct spi_imx_devtype_data *devtype_data; | 114 | const struct spi_imx_devtype_data *devtype_data; |
99 | int chipselect[0]; | 115 | int chipselect[0]; |
100 | }; | 116 | }; |
@@ -181,9 +197,21 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin, | |||
181 | return 7; | 197 | return 7; |
182 | } | 198 | } |
183 | 199 | ||
200 | static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi, | ||
201 | struct spi_transfer *transfer) | ||
202 | { | ||
203 | struct spi_imx_data *spi_imx = spi_master_get_devdata(master); | ||
204 | |||
205 | if (spi_imx->dma_is_inited && (transfer->len > spi_imx->rx_wml) | ||
206 | && (transfer->len > spi_imx->tx_wml)) | ||
207 | return true; | ||
208 | return false; | ||
209 | } | ||
210 | |||
184 | #define MX51_ECSPI_CTRL 0x08 | 211 | #define MX51_ECSPI_CTRL 0x08 |
185 | #define MX51_ECSPI_CTRL_ENABLE (1 << 0) | 212 | #define MX51_ECSPI_CTRL_ENABLE (1 << 0) |
186 | #define MX51_ECSPI_CTRL_XCH (1 << 2) | 213 | #define MX51_ECSPI_CTRL_XCH (1 << 2) |
214 | #define MX51_ECSPI_CTRL_SMC (1 << 3) | ||
187 | #define MX51_ECSPI_CTRL_MODE_MASK (0xf << 4) | 215 | #define MX51_ECSPI_CTRL_MODE_MASK (0xf << 4) |
188 | #define MX51_ECSPI_CTRL_POSTDIV_OFFSET 8 | 216 | #define MX51_ECSPI_CTRL_POSTDIV_OFFSET 8 |
189 | #define MX51_ECSPI_CTRL_PREDIV_OFFSET 12 | 217 | #define MX51_ECSPI_CTRL_PREDIV_OFFSET 12 |
@@ -201,6 +229,18 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin, | |||
201 | #define MX51_ECSPI_INT_TEEN (1 << 0) | 229 | #define MX51_ECSPI_INT_TEEN (1 << 0) |
202 | #define MX51_ECSPI_INT_RREN (1 << 3) | 230 | #define MX51_ECSPI_INT_RREN (1 << 3) |
203 | 231 | ||
232 | #define MX51_ECSPI_DMA 0x14 | ||
233 | #define MX51_ECSPI_DMA_TX_WML_OFFSET 0 | ||
234 | #define MX51_ECSPI_DMA_TX_WML_MASK 0x3F | ||
235 | #define MX51_ECSPI_DMA_RX_WML_OFFSET 16 | ||
236 | #define MX51_ECSPI_DMA_RX_WML_MASK (0x3F << 16) | ||
237 | #define MX51_ECSPI_DMA_RXT_WML_OFFSET 24 | ||
238 | #define MX51_ECSPI_DMA_RXT_WML_MASK (0x3F << 24) | ||
239 | |||
240 | #define MX51_ECSPI_DMA_TEDEN_OFFSET 7 | ||
241 | #define MX51_ECSPI_DMA_RXDEN_OFFSET 23 | ||
242 | #define MX51_ECSPI_DMA_RXTDEN_OFFSET 31 | ||
243 | |||
204 | #define MX51_ECSPI_STAT 0x18 | 244 | #define MX51_ECSPI_STAT 0x18 |
205 | #define MX51_ECSPI_STAT_RR (1 << 3) | 245 | #define MX51_ECSPI_STAT_RR (1 << 3) |
206 | 246 | ||
@@ -257,17 +297,22 @@ static void __maybe_unused mx51_ecspi_intctrl(struct spi_imx_data *spi_imx, int | |||
257 | 297 | ||
258 | static void __maybe_unused mx51_ecspi_trigger(struct spi_imx_data *spi_imx) | 298 | static void __maybe_unused mx51_ecspi_trigger(struct spi_imx_data *spi_imx) |
259 | { | 299 | { |
260 | u32 reg; | 300 | u32 reg = readl(spi_imx->base + MX51_ECSPI_CTRL); |
261 | 301 | ||
262 | reg = readl(spi_imx->base + MX51_ECSPI_CTRL); | 302 | if (!spi_imx->usedma) |
263 | reg |= MX51_ECSPI_CTRL_XCH; | 303 | reg |= MX51_ECSPI_CTRL_XCH; |
304 | else if (!spi_imx->dma_finished) | ||
305 | reg |= MX51_ECSPI_CTRL_SMC; | ||
306 | else | ||
307 | reg &= ~MX51_ECSPI_CTRL_SMC; | ||
264 | writel(reg, spi_imx->base + MX51_ECSPI_CTRL); | 308 | writel(reg, spi_imx->base + MX51_ECSPI_CTRL); |
265 | } | 309 | } |
266 | 310 | ||
267 | static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx, | 311 | static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx, |
268 | struct spi_imx_config *config) | 312 | struct spi_imx_config *config) |
269 | { | 313 | { |
270 | u32 ctrl = MX51_ECSPI_CTRL_ENABLE, cfg = 0; | 314 | u32 ctrl = MX51_ECSPI_CTRL_ENABLE, cfg = 0, dma = 0; |
315 | u32 tx_wml_cfg, rx_wml_cfg, rxt_wml_cfg; | ||
271 | u32 clk = config->speed_hz, delay; | 316 | u32 clk = config->speed_hz, delay; |
272 | 317 | ||
273 | /* | 318 | /* |
@@ -319,6 +364,30 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx, | |||
319 | else /* SCLK is _very_ slow */ | 364 | else /* SCLK is _very_ slow */ |
320 | usleep_range(delay, delay + 10); | 365 | usleep_range(delay, delay + 10); |
321 | 366 | ||
367 | /* | ||
368 | * Configure the DMA register: setup the watermark | ||
369 | * and enable DMA request. | ||
370 | */ | ||
371 | if (spi_imx->dma_is_inited) { | ||
372 | dma = readl(spi_imx->base + MX51_ECSPI_DMA); | ||
373 | |||
374 | spi_imx->tx_wml = spi_imx_get_fifosize(spi_imx) / 2; | ||
375 | spi_imx->rx_wml = spi_imx_get_fifosize(spi_imx) / 2; | ||
376 | spi_imx->rxt_wml = spi_imx_get_fifosize(spi_imx) / 2; | ||
377 | rx_wml_cfg = spi_imx->rx_wml << MX51_ECSPI_DMA_RX_WML_OFFSET; | ||
378 | tx_wml_cfg = spi_imx->tx_wml << MX51_ECSPI_DMA_TX_WML_OFFSET; | ||
379 | rxt_wml_cfg = spi_imx->rxt_wml << MX51_ECSPI_DMA_RXT_WML_OFFSET; | ||
380 | dma = (dma & ~MX51_ECSPI_DMA_TX_WML_MASK | ||
381 | & ~MX51_ECSPI_DMA_RX_WML_MASK | ||
382 | & ~MX51_ECSPI_DMA_RXT_WML_MASK) | ||
383 | | rx_wml_cfg | tx_wml_cfg | rxt_wml_cfg | ||
384 | |(1 << MX51_ECSPI_DMA_TEDEN_OFFSET) | ||
385 | |(1 << MX51_ECSPI_DMA_RXDEN_OFFSET) | ||
386 | |(1 << MX51_ECSPI_DMA_RXTDEN_OFFSET); | ||
387 | |||
388 | writel(dma, spi_imx->base + MX51_ECSPI_DMA); | ||
389 | } | ||
390 | |||
322 | return 0; | 391 | return 0; |
323 | } | 392 | } |
324 | 393 | ||
@@ -730,7 +799,186 @@ static int spi_imx_setupxfer(struct spi_device *spi, | |||
730 | return 0; | 799 | return 0; |
731 | } | 800 | } |
732 | 801 | ||
733 | static int spi_imx_transfer(struct spi_device *spi, | 802 | static void spi_imx_sdma_exit(struct spi_imx_data *spi_imx) |
803 | { | ||
804 | struct spi_master *master = spi_imx->bitbang.master; | ||
805 | |||
806 | if (master->dma_rx) { | ||
807 | dma_release_channel(master->dma_rx); | ||
808 | master->dma_rx = NULL; | ||
809 | } | ||
810 | |||
811 | if (master->dma_tx) { | ||
812 | dma_release_channel(master->dma_tx); | ||
813 | master->dma_tx = NULL; | ||
814 | } | ||
815 | |||
816 | spi_imx->dma_is_inited = 0; | ||
817 | } | ||
818 | |||
819 | static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx, | ||
820 | struct spi_master *master, | ||
821 | const struct resource *res) | ||
822 | { | ||
823 | struct dma_slave_config slave_config = {}; | ||
824 | int ret; | ||
825 | |||
826 | /* Prepare for TX DMA: */ | ||
827 | master->dma_tx = dma_request_slave_channel(dev, "tx"); | ||
828 | if (!master->dma_tx) { | ||
829 | dev_err(dev, "cannot get the TX DMA channel!\n"); | ||
830 | ret = -EINVAL; | ||
831 | goto err; | ||
832 | } | ||
833 | |||
834 | slave_config.direction = DMA_MEM_TO_DEV; | ||
835 | slave_config.dst_addr = res->start + MXC_CSPITXDATA; | ||
836 | slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; | ||
837 | slave_config.dst_maxburst = spi_imx_get_fifosize(spi_imx) / 2; | ||
838 | ret = dmaengine_slave_config(master->dma_tx, &slave_config); | ||
839 | if (ret) { | ||
840 | dev_err(dev, "error in TX dma configuration.\n"); | ||
841 | goto err; | ||
842 | } | ||
843 | |||
844 | /* Prepare for RX : */ | ||
845 | master->dma_rx = dma_request_slave_channel(dev, "rx"); | ||
846 | if (!master->dma_rx) { | ||
847 | dev_dbg(dev, "cannot get the DMA channel.\n"); | ||
848 | ret = -EINVAL; | ||
849 | goto err; | ||
850 | } | ||
851 | |||
852 | slave_config.direction = DMA_DEV_TO_MEM; | ||
853 | slave_config.src_addr = res->start + MXC_CSPIRXDATA; | ||
854 | slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; | ||
855 | slave_config.src_maxburst = spi_imx_get_fifosize(spi_imx) / 2; | ||
856 | ret = dmaengine_slave_config(master->dma_rx, &slave_config); | ||
857 | if (ret) { | ||
858 | dev_err(dev, "error in RX dma configuration.\n"); | ||
859 | goto err; | ||
860 | } | ||
861 | |||
862 | init_completion(&spi_imx->dma_rx_completion); | ||
863 | init_completion(&spi_imx->dma_tx_completion); | ||
864 | master->can_dma = spi_imx_can_dma; | ||
865 | master->max_dma_len = MAX_SDMA_BD_BYTES; | ||
866 | spi_imx->bitbang.master->flags = SPI_MASTER_MUST_RX | | ||
867 | SPI_MASTER_MUST_TX; | ||
868 | spi_imx->dma_is_inited = 1; | ||
869 | |||
870 | return 0; | ||
871 | err: | ||
872 | spi_imx_sdma_exit(spi_imx); | ||
873 | return ret; | ||
874 | } | ||
875 | |||
876 | static void spi_imx_dma_rx_callback(void *cookie) | ||
877 | { | ||
878 | struct spi_imx_data *spi_imx = (struct spi_imx_data *)cookie; | ||
879 | |||
880 | complete(&spi_imx->dma_rx_completion); | ||
881 | } | ||
882 | |||
883 | static void spi_imx_dma_tx_callback(void *cookie) | ||
884 | { | ||
885 | struct spi_imx_data *spi_imx = (struct spi_imx_data *)cookie; | ||
886 | |||
887 | complete(&spi_imx->dma_tx_completion); | ||
888 | } | ||
889 | |||
890 | static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx, | ||
891 | struct spi_transfer *transfer) | ||
892 | { | ||
893 | struct dma_async_tx_descriptor *desc_tx = NULL, *desc_rx = NULL; | ||
894 | int ret; | ||
895 | u32 dma; | ||
896 | int left; | ||
897 | struct spi_master *master = spi_imx->bitbang.master; | ||
898 | struct sg_table *tx = &transfer->tx_sg, *rx = &transfer->rx_sg; | ||
899 | |||
900 | if (tx) { | ||
901 | desc_tx = dmaengine_prep_slave_sg(master->dma_tx, | ||
902 | tx->sgl, tx->nents, DMA_TO_DEVICE, | ||
903 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
904 | if (!desc_tx) | ||
905 | goto no_dma; | ||
906 | |||
907 | desc_tx->callback = spi_imx_dma_tx_callback; | ||
908 | desc_tx->callback_param = (void *)spi_imx; | ||
909 | dmaengine_submit(desc_tx); | ||
910 | } | ||
911 | |||
912 | if (rx) { | ||
913 | desc_rx = dmaengine_prep_slave_sg(master->dma_rx, | ||
914 | rx->sgl, rx->nents, DMA_FROM_DEVICE, | ||
915 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
916 | if (!desc_rx) | ||
917 | goto no_dma; | ||
918 | |||
919 | desc_rx->callback = spi_imx_dma_rx_callback; | ||
920 | desc_rx->callback_param = (void *)spi_imx; | ||
921 | dmaengine_submit(desc_rx); | ||
922 | } | ||
923 | |||
924 | reinit_completion(&spi_imx->dma_rx_completion); | ||
925 | reinit_completion(&spi_imx->dma_tx_completion); | ||
926 | |||
927 | /* Trigger the cspi module. */ | ||
928 | spi_imx->dma_finished = 0; | ||
929 | |||
930 | dma = readl(spi_imx->base + MX51_ECSPI_DMA); | ||
931 | dma = dma & (~MX51_ECSPI_DMA_RXT_WML_MASK); | ||
932 | /* Change RX_DMA_LENGTH trigger dma fetch tail data */ | ||
933 | left = transfer->len % spi_imx->rxt_wml; | ||
934 | if (left) | ||
935 | writel(dma | (left << MX51_ECSPI_DMA_RXT_WML_OFFSET), | ||
936 | spi_imx->base + MX51_ECSPI_DMA); | ||
937 | spi_imx->devtype_data->trigger(spi_imx); | ||
938 | |||
939 | dma_async_issue_pending(master->dma_tx); | ||
940 | dma_async_issue_pending(master->dma_rx); | ||
941 | /* Wait SDMA to finish the data transfer.*/ | ||
942 | ret = wait_for_completion_timeout(&spi_imx->dma_tx_completion, | ||
943 | IMX_DMA_TIMEOUT); | ||
944 | if (!ret) { | ||
945 | pr_warn("%s %s: I/O Error in DMA TX\n", | ||
946 | dev_driver_string(&master->dev), | ||
947 | dev_name(&master->dev)); | ||
948 | dmaengine_terminate_all(master->dma_tx); | ||
949 | } else { | ||
950 | ret = wait_for_completion_timeout(&spi_imx->dma_rx_completion, | ||
951 | IMX_DMA_TIMEOUT); | ||
952 | if (!ret) { | ||
953 | pr_warn("%s %s: I/O Error in DMA RX\n", | ||
954 | dev_driver_string(&master->dev), | ||
955 | dev_name(&master->dev)); | ||
956 | spi_imx->devtype_data->reset(spi_imx); | ||
957 | dmaengine_terminate_all(master->dma_rx); | ||
958 | } | ||
959 | writel(dma | | ||
960 | spi_imx->rxt_wml << MX51_ECSPI_DMA_RXT_WML_OFFSET, | ||
961 | spi_imx->base + MX51_ECSPI_DMA); | ||
962 | } | ||
963 | |||
964 | spi_imx->dma_finished = 1; | ||
965 | spi_imx->devtype_data->trigger(spi_imx); | ||
966 | |||
967 | if (!ret) | ||
968 | ret = -ETIMEDOUT; | ||
969 | else if (ret > 0) | ||
970 | ret = transfer->len; | ||
971 | |||
972 | return ret; | ||
973 | |||
974 | no_dma: | ||
975 | pr_warn_once("%s %s: DMA not available, falling back to PIO\n", | ||
976 | dev_driver_string(&master->dev), | ||
977 | dev_name(&master->dev)); | ||
978 | return -EAGAIN; | ||
979 | } | ||
980 | |||
981 | static int spi_imx_pio_transfer(struct spi_device *spi, | ||
734 | struct spi_transfer *transfer) | 982 | struct spi_transfer *transfer) |
735 | { | 983 | { |
736 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); | 984 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
@@ -751,6 +999,24 @@ static int spi_imx_transfer(struct spi_device *spi, | |||
751 | return transfer->len; | 999 | return transfer->len; |
752 | } | 1000 | } |
753 | 1001 | ||
1002 | static int spi_imx_transfer(struct spi_device *spi, | ||
1003 | struct spi_transfer *transfer) | ||
1004 | { | ||
1005 | int ret; | ||
1006 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); | ||
1007 | |||
1008 | if (spi_imx->bitbang.master->can_dma && | ||
1009 | spi_imx_can_dma(spi_imx->bitbang.master, spi, transfer)) { | ||
1010 | spi_imx->usedma = true; | ||
1011 | ret = spi_imx_dma_transfer(spi_imx, transfer); | ||
1012 | if (ret != -EAGAIN) | ||
1013 | return ret; | ||
1014 | } | ||
1015 | spi_imx->usedma = false; | ||
1016 | |||
1017 | return spi_imx_pio_transfer(spi, transfer); | ||
1018 | } | ||
1019 | |||
754 | static int spi_imx_setup(struct spi_device *spi) | 1020 | static int spi_imx_setup(struct spi_device *spi) |
755 | { | 1021 | { |
756 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); | 1022 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
@@ -911,6 +1177,13 @@ static int spi_imx_probe(struct platform_device *pdev) | |||
911 | goto out_put_per; | 1177 | goto out_put_per; |
912 | 1178 | ||
913 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per); | 1179 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per); |
1180 | /* | ||
1181 | * Only validated on i.mx6 now, can remove the constrain if validated on | ||
1182 | * other chips. | ||
1183 | */ | ||
1184 | if (spi_imx->devtype_data == &imx51_ecspi_devtype_data | ||
1185 | && spi_imx_sdma_init(&pdev->dev, spi_imx, master, res)) | ||
1186 | dev_err(&pdev->dev, "dma setup error,use pio instead\n"); | ||
914 | 1187 | ||
915 | spi_imx->devtype_data->reset(spi_imx); | 1188 | spi_imx->devtype_data->reset(spi_imx); |
916 | 1189 | ||
@@ -949,6 +1222,7 @@ static int spi_imx_remove(struct platform_device *pdev) | |||
949 | writel(0, spi_imx->base + MXC_CSPICTRL); | 1222 | writel(0, spi_imx->base + MXC_CSPICTRL); |
950 | clk_unprepare(spi_imx->clk_ipg); | 1223 | clk_unprepare(spi_imx->clk_ipg); |
951 | clk_unprepare(spi_imx->clk_per); | 1224 | clk_unprepare(spi_imx->clk_per); |
1225 | spi_imx_sdma_exit(spi_imx); | ||
952 | spi_master_put(master); | 1226 | spi_master_put(master); |
953 | 1227 | ||
954 | return 0; | 1228 | return 0; |
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index c3f8d3a22472..51460878af04 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -85,7 +85,7 @@ static int mxs_spi_setup_transfer(struct spi_device *dev, | |||
85 | mxs_ssp_set_clk_rate(ssp, hz); | 85 | mxs_ssp_set_clk_rate(ssp, hz); |
86 | /* | 86 | /* |
87 | * Save requested rate, hz, rather than the actual rate, | 87 | * Save requested rate, hz, rather than the actual rate, |
88 | * ssp->clk_rate. Otherwise we would set the rate every trasfer | 88 | * ssp->clk_rate. Otherwise we would set the rate every transfer |
89 | * when the actual rate is not quite the same as requested rate. | 89 | * when the actual rate is not quite the same as requested rate. |
90 | */ | 90 | */ |
91 | spi->sck = hz; | 91 | spi->sck = hz; |
diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 5e91858f6f01..fb522765ce5a 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c | |||
@@ -70,10 +70,6 @@ | |||
70 | #define SPI_STATUS_WE (1UL << 1) | 70 | #define SPI_STATUS_WE (1UL << 1) |
71 | #define SPI_STATUS_RD (1UL << 0) | 71 | #define SPI_STATUS_RD (1UL << 0) |
72 | 72 | ||
73 | #define WRITE 0 | ||
74 | #define READ 1 | ||
75 | |||
76 | |||
77 | /* use PIO for small transfers, avoiding DMA setup/teardown overhead and | 73 | /* use PIO for small transfers, avoiding DMA setup/teardown overhead and |
78 | * cache operations; better heuristics consider wordsize and bitrate. | 74 | * cache operations; better heuristics consider wordsize and bitrate. |
79 | */ | 75 | */ |
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 68441fa448de..352eed7463ac 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
@@ -329,7 +329,8 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, | |||
329 | disable_fifo: | 329 | disable_fifo: |
330 | if (t->rx_buf != NULL) | 330 | if (t->rx_buf != NULL) |
331 | chconf &= ~OMAP2_MCSPI_CHCONF_FFER; | 331 | chconf &= ~OMAP2_MCSPI_CHCONF_FFER; |
332 | else | 332 | |
333 | if (t->tx_buf != NULL) | ||
333 | chconf &= ~OMAP2_MCSPI_CHCONF_FFET; | 334 | chconf &= ~OMAP2_MCSPI_CHCONF_FFET; |
334 | 335 | ||
335 | mcspi_write_chconf0(spi, chconf); | 336 | mcspi_write_chconf0(spi, chconf); |
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 345e7d61c399..835cdda6f4f5 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
20 | #include <linux/of.h> | 20 | #include <linux/of.h> |
21 | #include <linux/of_device.h> | ||
21 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
22 | #include <linux/sizes.h> | 23 | #include <linux/sizes.h> |
23 | #include <asm/unaligned.h> | 24 | #include <asm/unaligned.h> |
@@ -40,13 +41,27 @@ | |||
40 | #define ORION_SPI_MODE_CPHA (1 << 12) | 41 | #define ORION_SPI_MODE_CPHA (1 << 12) |
41 | #define ORION_SPI_IF_8_16_BIT_MODE (1 << 5) | 42 | #define ORION_SPI_IF_8_16_BIT_MODE (1 << 5) |
42 | #define ORION_SPI_CLK_PRESCALE_MASK 0x1F | 43 | #define ORION_SPI_CLK_PRESCALE_MASK 0x1F |
44 | #define ARMADA_SPI_CLK_PRESCALE_MASK 0xDF | ||
43 | #define ORION_SPI_MODE_MASK (ORION_SPI_MODE_CPOL | \ | 45 | #define ORION_SPI_MODE_MASK (ORION_SPI_MODE_CPOL | \ |
44 | ORION_SPI_MODE_CPHA) | 46 | ORION_SPI_MODE_CPHA) |
45 | 47 | ||
48 | enum orion_spi_type { | ||
49 | ORION_SPI, | ||
50 | ARMADA_SPI, | ||
51 | }; | ||
52 | |||
53 | struct orion_spi_dev { | ||
54 | enum orion_spi_type typ; | ||
55 | unsigned int min_divisor; | ||
56 | unsigned int max_divisor; | ||
57 | u32 prescale_mask; | ||
58 | }; | ||
59 | |||
46 | struct orion_spi { | 60 | struct orion_spi { |
47 | struct spi_master *master; | 61 | struct spi_master *master; |
48 | void __iomem *base; | 62 | void __iomem *base; |
49 | struct clk *clk; | 63 | struct clk *clk; |
64 | const struct orion_spi_dev *devdata; | ||
50 | }; | 65 | }; |
51 | 66 | ||
52 | static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg) | 67 | static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg) |
@@ -83,30 +98,66 @@ static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed) | |||
83 | u32 prescale; | 98 | u32 prescale; |
84 | u32 reg; | 99 | u32 reg; |
85 | struct orion_spi *orion_spi; | 100 | struct orion_spi *orion_spi; |
101 | const struct orion_spi_dev *devdata; | ||
86 | 102 | ||
87 | orion_spi = spi_master_get_devdata(spi->master); | 103 | orion_spi = spi_master_get_devdata(spi->master); |
104 | devdata = orion_spi->devdata; | ||
88 | 105 | ||
89 | tclk_hz = clk_get_rate(orion_spi->clk); | 106 | tclk_hz = clk_get_rate(orion_spi->clk); |
90 | 107 | ||
91 | /* | 108 | if (devdata->typ == ARMADA_SPI) { |
92 | * the supported rates are: 4,6,8...30 | 109 | unsigned int clk, spr, sppr, sppr2, err; |
93 | * round up as we look for equal or less speed | 110 | unsigned int best_spr, best_sppr, best_err; |
94 | */ | 111 | |
95 | rate = DIV_ROUND_UP(tclk_hz, speed); | 112 | best_err = speed; |
96 | rate = roundup(rate, 2); | 113 | best_spr = 0; |
114 | best_sppr = 0; | ||
115 | |||
116 | /* Iterate over the valid range looking for best fit */ | ||
117 | for (sppr = 0; sppr < 8; sppr++) { | ||
118 | sppr2 = 0x1 << sppr; | ||
119 | |||
120 | spr = tclk_hz / sppr2; | ||
121 | spr = DIV_ROUND_UP(spr, speed); | ||
122 | if ((spr == 0) || (spr > 15)) | ||
123 | continue; | ||
97 | 124 | ||
98 | /* check if requested speed is too small */ | 125 | clk = tclk_hz / (spr * sppr2); |
99 | if (rate > 30) | 126 | err = speed - clk; |
100 | return -EINVAL; | ||
101 | 127 | ||
102 | if (rate < 4) | 128 | if (err < best_err) { |
103 | rate = 4; | 129 | best_spr = spr; |
130 | best_sppr = sppr; | ||
131 | best_err = err; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | if ((best_sppr == 0) && (best_spr == 0)) | ||
136 | return -EINVAL; | ||
137 | |||
138 | prescale = ((best_sppr & 0x6) << 5) | | ||
139 | ((best_sppr & 0x1) << 4) | best_spr; | ||
140 | } else { | ||
141 | /* | ||
142 | * the supported rates are: 4,6,8...30 | ||
143 | * round up as we look for equal or less speed | ||
144 | */ | ||
145 | rate = DIV_ROUND_UP(tclk_hz, speed); | ||
146 | rate = roundup(rate, 2); | ||
147 | |||
148 | /* check if requested speed is too small */ | ||
149 | if (rate > 30) | ||
150 | return -EINVAL; | ||
104 | 151 | ||
105 | /* Convert the rate to SPI clock divisor value. */ | 152 | if (rate < 4) |
106 | prescale = 0x10 + rate/2; | 153 | rate = 4; |
154 | |||
155 | /* Convert the rate to SPI clock divisor value. */ | ||
156 | prescale = 0x10 + rate/2; | ||
157 | } | ||
107 | 158 | ||
108 | reg = readl(spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG)); | 159 | reg = readl(spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG)); |
109 | reg = ((reg & ~ORION_SPI_CLK_PRESCALE_MASK) | prescale); | 160 | reg = ((reg & ~devdata->prescale_mask) | prescale); |
110 | writel(reg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG)); | 161 | writel(reg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG)); |
111 | 162 | ||
112 | return 0; | 163 | return 0; |
@@ -342,8 +393,31 @@ static int orion_spi_reset(struct orion_spi *orion_spi) | |||
342 | return 0; | 393 | return 0; |
343 | } | 394 | } |
344 | 395 | ||
396 | static const struct orion_spi_dev orion_spi_dev_data = { | ||
397 | .typ = ORION_SPI, | ||
398 | .min_divisor = 4, | ||
399 | .max_divisor = 30, | ||
400 | .prescale_mask = ORION_SPI_CLK_PRESCALE_MASK, | ||
401 | }; | ||
402 | |||
403 | static const struct orion_spi_dev armada_spi_dev_data = { | ||
404 | .typ = ARMADA_SPI, | ||
405 | .min_divisor = 1, | ||
406 | .max_divisor = 1920, | ||
407 | .prescale_mask = ARMADA_SPI_CLK_PRESCALE_MASK, | ||
408 | }; | ||
409 | |||
410 | static const struct of_device_id orion_spi_of_match_table[] = { | ||
411 | { .compatible = "marvell,orion-spi", .data = &orion_spi_dev_data, }, | ||
412 | { .compatible = "marvell,armada-370-spi", .data = &armada_spi_dev_data, }, | ||
413 | {} | ||
414 | }; | ||
415 | MODULE_DEVICE_TABLE(of, orion_spi_of_match_table); | ||
416 | |||
345 | static int orion_spi_probe(struct platform_device *pdev) | 417 | static int orion_spi_probe(struct platform_device *pdev) |
346 | { | 418 | { |
419 | const struct of_device_id *of_id; | ||
420 | const struct orion_spi_dev *devdata; | ||
347 | struct spi_master *master; | 421 | struct spi_master *master; |
348 | struct orion_spi *spi; | 422 | struct orion_spi *spi; |
349 | struct resource *r; | 423 | struct resource *r; |
@@ -379,6 +453,10 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
379 | spi = spi_master_get_devdata(master); | 453 | spi = spi_master_get_devdata(master); |
380 | spi->master = master; | 454 | spi->master = master; |
381 | 455 | ||
456 | of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); | ||
457 | devdata = of_id->data; | ||
458 | spi->devdata = devdata; | ||
459 | |||
382 | spi->clk = devm_clk_get(&pdev->dev, NULL); | 460 | spi->clk = devm_clk_get(&pdev->dev, NULL); |
383 | if (IS_ERR(spi->clk)) { | 461 | if (IS_ERR(spi->clk)) { |
384 | status = PTR_ERR(spi->clk); | 462 | status = PTR_ERR(spi->clk); |
@@ -390,8 +468,8 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
390 | goto out; | 468 | goto out; |
391 | 469 | ||
392 | tclk_hz = clk_get_rate(spi->clk); | 470 | tclk_hz = clk_get_rate(spi->clk); |
393 | master->max_speed_hz = DIV_ROUND_UP(tclk_hz, 4); | 471 | master->max_speed_hz = DIV_ROUND_UP(tclk_hz, devdata->min_divisor); |
394 | master->min_speed_hz = DIV_ROUND_UP(tclk_hz, 30); | 472 | master->min_speed_hz = DIV_ROUND_UP(tclk_hz, devdata->max_divisor); |
395 | 473 | ||
396 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 474 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
397 | spi->base = devm_ioremap_resource(&pdev->dev, r); | 475 | spi->base = devm_ioremap_resource(&pdev->dev, r); |
@@ -470,12 +548,6 @@ static const struct dev_pm_ops orion_spi_pm_ops = { | |||
470 | NULL) | 548 | NULL) |
471 | }; | 549 | }; |
472 | 550 | ||
473 | static const struct of_device_id orion_spi_of_match_table[] = { | ||
474 | { .compatible = "marvell,orion-spi", }, | ||
475 | {} | ||
476 | }; | ||
477 | MODULE_DEVICE_TABLE(of, orion_spi_of_match_table); | ||
478 | |||
479 | static struct platform_driver orion_spi_driver = { | 551 | static struct platform_driver orion_spi_driver = { |
480 | .driver = { | 552 | .driver = { |
481 | .name = DRIVER_NAME, | 553 | .name = DRIVER_NAME, |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 1189cfd96477..f35f723816ea 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -82,6 +82,7 @@ | |||
82 | #define SSP_MIS(r) (r + 0x01C) | 82 | #define SSP_MIS(r) (r + 0x01C) |
83 | #define SSP_ICR(r) (r + 0x020) | 83 | #define SSP_ICR(r) (r + 0x020) |
84 | #define SSP_DMACR(r) (r + 0x024) | 84 | #define SSP_DMACR(r) (r + 0x024) |
85 | #define SSP_CSR(r) (r + 0x030) /* vendor extension */ | ||
85 | #define SSP_ITCR(r) (r + 0x080) | 86 | #define SSP_ITCR(r) (r + 0x080) |
86 | #define SSP_ITIP(r) (r + 0x084) | 87 | #define SSP_ITIP(r) (r + 0x084) |
87 | #define SSP_ITOP(r) (r + 0x088) | 88 | #define SSP_ITOP(r) (r + 0x088) |
@@ -198,6 +199,12 @@ | |||
198 | #define SSP_DMACR_MASK_TXDMAE (0x1UL << 1) | 199 | #define SSP_DMACR_MASK_TXDMAE (0x1UL << 1) |
199 | 200 | ||
200 | /* | 201 | /* |
202 | * SSP Chip Select Control Register - SSP_CSR | ||
203 | * (vendor extension) | ||
204 | */ | ||
205 | #define SSP_CSR_CSVALUE_MASK (0x1FUL << 0) | ||
206 | |||
207 | /* | ||
201 | * SSP Integration Test control Register - SSP_ITCR | 208 | * SSP Integration Test control Register - SSP_ITCR |
202 | */ | 209 | */ |
203 | #define SSP_ITCR_MASK_ITEN (0x1UL << 0) | 210 | #define SSP_ITCR_MASK_ITEN (0x1UL << 0) |
@@ -313,6 +320,7 @@ enum ssp_writing { | |||
313 | * @extended_cr: 32 bit wide control register 0 with extra | 320 | * @extended_cr: 32 bit wide control register 0 with extra |
314 | * features and extra features in CR1 as found in the ST variants | 321 | * features and extra features in CR1 as found in the ST variants |
315 | * @pl023: supports a subset of the ST extensions called "PL023" | 322 | * @pl023: supports a subset of the ST extensions called "PL023" |
323 | * @internal_cs_ctrl: supports chip select control register | ||
316 | */ | 324 | */ |
317 | struct vendor_data { | 325 | struct vendor_data { |
318 | int fifodepth; | 326 | int fifodepth; |
@@ -321,6 +329,7 @@ struct vendor_data { | |||
321 | bool extended_cr; | 329 | bool extended_cr; |
322 | bool pl023; | 330 | bool pl023; |
323 | bool loopback; | 331 | bool loopback; |
332 | bool internal_cs_ctrl; | ||
324 | }; | 333 | }; |
325 | 334 | ||
326 | /** | 335 | /** |
@@ -440,9 +449,32 @@ static void null_cs_control(u32 command) | |||
440 | pr_debug("pl022: dummy chip select control, CS=0x%x\n", command); | 449 | pr_debug("pl022: dummy chip select control, CS=0x%x\n", command); |
441 | } | 450 | } |
442 | 451 | ||
452 | /** | ||
453 | * internal_cs_control - Control chip select signals via SSP_CSR. | ||
454 | * @pl022: SSP driver private data structure | ||
455 | * @command: select/delect the chip | ||
456 | * | ||
457 | * Used on controller with internal chip select control via SSP_CSR register | ||
458 | * (vendor extension). Each of the 5 LSB in the register controls one chip | ||
459 | * select signal. | ||
460 | */ | ||
461 | static void internal_cs_control(struct pl022 *pl022, u32 command) | ||
462 | { | ||
463 | u32 tmp; | ||
464 | |||
465 | tmp = readw(SSP_CSR(pl022->virtbase)); | ||
466 | if (command == SSP_CHIP_SELECT) | ||
467 | tmp &= ~BIT(pl022->cur_cs); | ||
468 | else | ||
469 | tmp |= BIT(pl022->cur_cs); | ||
470 | writew(tmp, SSP_CSR(pl022->virtbase)); | ||
471 | } | ||
472 | |||
443 | static void pl022_cs_control(struct pl022 *pl022, u32 command) | 473 | static void pl022_cs_control(struct pl022 *pl022, u32 command) |
444 | { | 474 | { |
445 | if (gpio_is_valid(pl022->cur_cs)) | 475 | if (pl022->vendor->internal_cs_ctrl) |
476 | internal_cs_control(pl022, command); | ||
477 | else if (gpio_is_valid(pl022->cur_cs)) | ||
446 | gpio_set_value(pl022->cur_cs, command); | 478 | gpio_set_value(pl022->cur_cs, command); |
447 | else | 479 | else |
448 | pl022->cur_chip->cs_control(command); | 480 | pl022->cur_chip->cs_control(command); |
@@ -2100,6 +2132,10 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2100 | pl022->vendor = id->data; | 2132 | pl022->vendor = id->data; |
2101 | pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int), | 2133 | pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int), |
2102 | GFP_KERNEL); | 2134 | GFP_KERNEL); |
2135 | if (!pl022->chipselects) { | ||
2136 | status = -ENOMEM; | ||
2137 | goto err_no_mem; | ||
2138 | } | ||
2103 | 2139 | ||
2104 | /* | 2140 | /* |
2105 | * Bus Number Which has been Assigned to this SSP controller | 2141 | * Bus Number Which has been Assigned to this SSP controller |
@@ -2118,6 +2154,9 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2118 | if (platform_info->num_chipselect && platform_info->chipselects) { | 2154 | if (platform_info->num_chipselect && platform_info->chipselects) { |
2119 | for (i = 0; i < num_cs; i++) | 2155 | for (i = 0; i < num_cs; i++) |
2120 | pl022->chipselects[i] = platform_info->chipselects[i]; | 2156 | pl022->chipselects[i] = platform_info->chipselects[i]; |
2157 | } else if (pl022->vendor->internal_cs_ctrl) { | ||
2158 | for (i = 0; i < num_cs; i++) | ||
2159 | pl022->chipselects[i] = i; | ||
2121 | } else if (IS_ENABLED(CONFIG_OF)) { | 2160 | } else if (IS_ENABLED(CONFIG_OF)) { |
2122 | for (i = 0; i < num_cs; i++) { | 2161 | for (i = 0; i < num_cs; i++) { |
2123 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); | 2162 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); |
@@ -2136,7 +2175,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2136 | cs_gpio); | 2175 | cs_gpio); |
2137 | else if (gpio_direction_output(cs_gpio, 1)) | 2176 | else if (gpio_direction_output(cs_gpio, 1)) |
2138 | dev_err(&adev->dev, | 2177 | dev_err(&adev->dev, |
2139 | "could set gpio %d as output\n", | 2178 | "could not set gpio %d as output\n", |
2140 | cs_gpio); | 2179 | cs_gpio); |
2141 | } | 2180 | } |
2142 | } | 2181 | } |
@@ -2241,6 +2280,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2241 | amba_release_regions(adev); | 2280 | amba_release_regions(adev); |
2242 | err_no_ioregion: | 2281 | err_no_ioregion: |
2243 | err_no_gpio: | 2282 | err_no_gpio: |
2283 | err_no_mem: | ||
2244 | spi_master_put(master); | 2284 | spi_master_put(master); |
2245 | return status; | 2285 | return status; |
2246 | } | 2286 | } |
@@ -2347,6 +2387,7 @@ static struct vendor_data vendor_arm = { | |||
2347 | .extended_cr = false, | 2387 | .extended_cr = false, |
2348 | .pl023 = false, | 2388 | .pl023 = false, |
2349 | .loopback = true, | 2389 | .loopback = true, |
2390 | .internal_cs_ctrl = false, | ||
2350 | }; | 2391 | }; |
2351 | 2392 | ||
2352 | static struct vendor_data vendor_st = { | 2393 | static struct vendor_data vendor_st = { |
@@ -2356,6 +2397,7 @@ static struct vendor_data vendor_st = { | |||
2356 | .extended_cr = true, | 2397 | .extended_cr = true, |
2357 | .pl023 = false, | 2398 | .pl023 = false, |
2358 | .loopback = true, | 2399 | .loopback = true, |
2400 | .internal_cs_ctrl = false, | ||
2359 | }; | 2401 | }; |
2360 | 2402 | ||
2361 | static struct vendor_data vendor_st_pl023 = { | 2403 | static struct vendor_data vendor_st_pl023 = { |
@@ -2365,6 +2407,17 @@ static struct vendor_data vendor_st_pl023 = { | |||
2365 | .extended_cr = true, | 2407 | .extended_cr = true, |
2366 | .pl023 = true, | 2408 | .pl023 = true, |
2367 | .loopback = false, | 2409 | .loopback = false, |
2410 | .internal_cs_ctrl = false, | ||
2411 | }; | ||
2412 | |||
2413 | static struct vendor_data vendor_lsi = { | ||
2414 | .fifodepth = 8, | ||
2415 | .max_bpw = 16, | ||
2416 | .unidir = false, | ||
2417 | .extended_cr = false, | ||
2418 | .pl023 = false, | ||
2419 | .loopback = true, | ||
2420 | .internal_cs_ctrl = true, | ||
2368 | }; | 2421 | }; |
2369 | 2422 | ||
2370 | static struct amba_id pl022_ids[] = { | 2423 | static struct amba_id pl022_ids[] = { |
@@ -2398,6 +2451,15 @@ static struct amba_id pl022_ids[] = { | |||
2398 | .mask = 0xffffffff, | 2451 | .mask = 0xffffffff, |
2399 | .data = &vendor_st_pl023, | 2452 | .data = &vendor_st_pl023, |
2400 | }, | 2453 | }, |
2454 | { | ||
2455 | /* | ||
2456 | * PL022 variant that has a chip select control register whih | ||
2457 | * allows control of 5 output signals nCS[0:4]. | ||
2458 | */ | ||
2459 | .id = 0x000b6022, | ||
2460 | .mask = 0x000fffff, | ||
2461 | .data = &vendor_lsi, | ||
2462 | }, | ||
2401 | { 0, 0 }, | 2463 | { 0, 0 }, |
2402 | }; | 2464 | }; |
2403 | 2465 | ||
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index c1865c92ccb9..536c863bebf1 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c | |||
@@ -7,6 +7,8 @@ | |||
7 | #include <linux/of_device.h> | 7 | #include <linux/of_device.h> |
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/spi/pxa2xx_spi.h> | 9 | #include <linux/spi/pxa2xx_spi.h> |
10 | #include <linux/clk.h> | ||
11 | #include <linux/clk-provider.h> | ||
10 | 12 | ||
11 | enum { | 13 | enum { |
12 | PORT_CE4100, | 14 | PORT_CE4100, |
@@ -21,6 +23,7 @@ struct pxa_spi_info { | |||
21 | int tx_chan_id; | 23 | int tx_chan_id; |
22 | int rx_slave_id; | 24 | int rx_slave_id; |
23 | int rx_chan_id; | 25 | int rx_chan_id; |
26 | unsigned long max_clk_rate; | ||
24 | }; | 27 | }; |
25 | 28 | ||
26 | static struct pxa_spi_info spi_info_configs[] = { | 29 | static struct pxa_spi_info spi_info_configs[] = { |
@@ -32,6 +35,7 @@ static struct pxa_spi_info spi_info_configs[] = { | |||
32 | .tx_chan_id = -1, | 35 | .tx_chan_id = -1, |
33 | .rx_slave_id = -1, | 36 | .rx_slave_id = -1, |
34 | .rx_chan_id = -1, | 37 | .rx_chan_id = -1, |
38 | .max_clk_rate = 3686400, | ||
35 | }, | 39 | }, |
36 | [PORT_BYT] = { | 40 | [PORT_BYT] = { |
37 | .type = LPSS_SSP, | 41 | .type = LPSS_SSP, |
@@ -41,6 +45,7 @@ static struct pxa_spi_info spi_info_configs[] = { | |||
41 | .tx_chan_id = 0, | 45 | .tx_chan_id = 0, |
42 | .rx_slave_id = 1, | 46 | .rx_slave_id = 1, |
43 | .rx_chan_id = 1, | 47 | .rx_chan_id = 1, |
48 | .max_clk_rate = 50000000, | ||
44 | }, | 49 | }, |
45 | }; | 50 | }; |
46 | 51 | ||
@@ -53,6 +58,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, | |||
53 | struct pxa2xx_spi_master spi_pdata; | 58 | struct pxa2xx_spi_master spi_pdata; |
54 | struct ssp_device *ssp; | 59 | struct ssp_device *ssp; |
55 | struct pxa_spi_info *c; | 60 | struct pxa_spi_info *c; |
61 | char buf[40]; | ||
56 | 62 | ||
57 | ret = pcim_enable_device(dev); | 63 | ret = pcim_enable_device(dev); |
58 | if (ret) | 64 | if (ret) |
@@ -84,6 +90,12 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, | |||
84 | ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn; | 90 | ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn; |
85 | ssp->type = c->type; | 91 | ssp->type = c->type; |
86 | 92 | ||
93 | snprintf(buf, sizeof(buf), "pxa2xx-spi.%d", ssp->port_id); | ||
94 | ssp->clk = clk_register_fixed_rate(&dev->dev, buf , NULL, | ||
95 | CLK_IS_ROOT, c->max_clk_rate); | ||
96 | if (IS_ERR(ssp->clk)) | ||
97 | return PTR_ERR(ssp->clk); | ||
98 | |||
87 | memset(&pi, 0, sizeof(pi)); | 99 | memset(&pi, 0, sizeof(pi)); |
88 | pi.parent = &dev->dev; | 100 | pi.parent = &dev->dev; |
89 | pi.name = "pxa2xx-spi"; | 101 | pi.name = "pxa2xx-spi"; |
@@ -92,8 +104,10 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, | |||
92 | pi.size_data = sizeof(spi_pdata); | 104 | pi.size_data = sizeof(spi_pdata); |
93 | 105 | ||
94 | pdev = platform_device_register_full(&pi); | 106 | pdev = platform_device_register_full(&pi); |
95 | if (IS_ERR(pdev)) | 107 | if (IS_ERR(pdev)) { |
108 | clk_unregister(ssp->clk); | ||
96 | return PTR_ERR(pdev); | 109 | return PTR_ERR(pdev); |
110 | } | ||
97 | 111 | ||
98 | pci_set_drvdata(dev, pdev); | 112 | pci_set_drvdata(dev, pdev); |
99 | 113 | ||
@@ -103,8 +117,12 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, | |||
103 | static void pxa2xx_spi_pci_remove(struct pci_dev *dev) | 117 | static void pxa2xx_spi_pci_remove(struct pci_dev *dev) |
104 | { | 118 | { |
105 | struct platform_device *pdev = pci_get_drvdata(dev); | 119 | struct platform_device *pdev = pci_get_drvdata(dev); |
120 | struct pxa2xx_spi_master *spi_pdata; | ||
121 | |||
122 | spi_pdata = dev_get_platdata(&pdev->dev); | ||
106 | 123 | ||
107 | platform_device_unregister(pdev); | 124 | platform_device_unregister(pdev); |
125 | clk_unregister(spi_pdata->ssp.clk); | ||
108 | } | 126 | } |
109 | 127 | ||
110 | static const struct pci_device_id pxa2xx_spi_pci_devices[] = { | 128 | static const struct pci_device_id pxa2xx_spi_pci_devices[] = { |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index fe792106bdc5..46f45ca2c694 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -1074,6 +1074,7 @@ static struct acpi_device_id pxa2xx_spi_acpi_match[] = { | |||
1074 | { "INT3430", 0 }, | 1074 | { "INT3430", 0 }, |
1075 | { "INT3431", 0 }, | 1075 | { "INT3431", 0 }, |
1076 | { "80860F0E", 0 }, | 1076 | { "80860F0E", 0 }, |
1077 | { "8086228E", 0 }, | ||
1077 | { }, | 1078 | { }, |
1078 | }; | 1079 | }; |
1079 | MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); | 1080 | MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); |
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index c0743604b906..f96ea8a38d64 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
@@ -220,7 +220,7 @@ static inline void wait_for_idle(struct rockchip_spi *rs) | |||
220 | do { | 220 | do { |
221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) | 221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) |
222 | return; | 222 | return; |
223 | } while (time_before(jiffies, timeout)); | 223 | } while (!time_after(jiffies, timeout)); |
224 | 224 | ||
225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); | 225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); |
226 | } | 226 | } |
@@ -415,7 +415,7 @@ static void rockchip_spi_dma_txcb(void *data) | |||
415 | spin_unlock_irqrestore(&rs->lock, flags); | 415 | spin_unlock_irqrestore(&rs->lock, flags); |
416 | } | 416 | } |
417 | 417 | ||
418 | static int rockchip_spi_dma_transfer(struct rockchip_spi *rs) | 418 | static void rockchip_spi_prepare_dma(struct rockchip_spi *rs) |
419 | { | 419 | { |
420 | unsigned long flags; | 420 | unsigned long flags; |
421 | struct dma_slave_config rxconf, txconf; | 421 | struct dma_slave_config rxconf, txconf; |
@@ -474,8 +474,6 @@ static int rockchip_spi_dma_transfer(struct rockchip_spi *rs) | |||
474 | dmaengine_submit(txdesc); | 474 | dmaengine_submit(txdesc); |
475 | dma_async_issue_pending(rs->dma_tx.ch); | 475 | dma_async_issue_pending(rs->dma_tx.ch); |
476 | } | 476 | } |
477 | |||
478 | return 1; | ||
479 | } | 477 | } |
480 | 478 | ||
481 | static void rockchip_spi_config(struct rockchip_spi *rs) | 479 | static void rockchip_spi_config(struct rockchip_spi *rs) |
@@ -499,7 +497,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs) | |||
499 | } | 497 | } |
500 | 498 | ||
501 | /* div doesn't support odd number */ | 499 | /* div doesn't support odd number */ |
502 | div = rs->max_freq / rs->speed; | 500 | div = max_t(u32, rs->max_freq / rs->speed, 1); |
503 | div = (div + 1) & 0xfffe; | 501 | div = (div + 1) & 0xfffe; |
504 | 502 | ||
505 | spi_enable_chip(rs, 0); | 503 | spi_enable_chip(rs, 0); |
@@ -529,7 +527,8 @@ static int rockchip_spi_transfer_one( | |||
529 | int ret = 0; | 527 | int ret = 0; |
530 | struct rockchip_spi *rs = spi_master_get_devdata(master); | 528 | struct rockchip_spi *rs = spi_master_get_devdata(master); |
531 | 529 | ||
532 | WARN_ON((readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | 530 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && |
531 | (readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | ||
533 | 532 | ||
534 | if (!xfer->tx_buf && !xfer->rx_buf) { | 533 | if (!xfer->tx_buf && !xfer->rx_buf) { |
535 | dev_err(rs->dev, "No buffer for transfer\n"); | 534 | dev_err(rs->dev, "No buffer for transfer\n"); |
@@ -556,16 +555,17 @@ static int rockchip_spi_transfer_one( | |||
556 | else if (rs->rx) | 555 | else if (rs->rx) |
557 | rs->tmode = CR0_XFM_RO; | 556 | rs->tmode = CR0_XFM_RO; |
558 | 557 | ||
559 | if (master->can_dma && master->can_dma(master, spi, xfer)) | 558 | /* we need prepare dma before spi was enabled */ |
559 | if (master->can_dma && master->can_dma(master, spi, xfer)) { | ||
560 | rs->use_dma = 1; | 560 | rs->use_dma = 1; |
561 | else | 561 | rockchip_spi_prepare_dma(rs); |
562 | } else { | ||
562 | rs->use_dma = 0; | 563 | rs->use_dma = 0; |
564 | } | ||
563 | 565 | ||
564 | rockchip_spi_config(rs); | 566 | rockchip_spi_config(rs); |
565 | 567 | ||
566 | if (rs->use_dma) | 568 | if (!rs->use_dma) |
567 | ret = rockchip_spi_dma_transfer(rs); | ||
568 | else | ||
569 | ret = rockchip_spi_pio_transfer(rs); | 569 | ret = rockchip_spi_pio_transfer(rs); |
570 | 570 | ||
571 | return ret; | 571 | return ret; |
@@ -678,7 +678,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) | |||
678 | rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); | 678 | rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); |
679 | rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); | 679 | rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); |
680 | rs->dma_tx.direction = DMA_MEM_TO_DEV; | 680 | rs->dma_tx.direction = DMA_MEM_TO_DEV; |
681 | rs->dma_tx.direction = DMA_DEV_TO_MEM; | 681 | rs->dma_rx.direction = DMA_DEV_TO_MEM; |
682 | 682 | ||
683 | master->can_dma = rockchip_spi_can_dma; | 683 | master->can_dma = rockchip_spi_can_dma; |
684 | master->dma_tx = rs->dma_tx.ch; | 684 | master->dma_tx = rs->dma_tx.ch; |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index c850dfdfa9e3..54bb0faec155 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -87,7 +87,7 @@ | |||
87 | /* RSPI on SH only */ | 87 | /* RSPI on SH only */ |
88 | #define SPCR_TXMD 0x02 /* TX Only Mode (vs. Full Duplex) */ | 88 | #define SPCR_TXMD 0x02 /* TX Only Mode (vs. Full Duplex) */ |
89 | #define SPCR_SPMS 0x01 /* 3-wire Mode (vs. 4-wire) */ | 89 | #define SPCR_SPMS 0x01 /* 3-wire Mode (vs. 4-wire) */ |
90 | /* QSPI on R-Car M2 only */ | 90 | /* QSPI on R-Car Gen2 only */ |
91 | #define SPCR_WSWAP 0x02 /* Word Swap of read-data for DMAC */ | 91 | #define SPCR_WSWAP 0x02 /* Word Swap of read-data for DMAC */ |
92 | #define SPCR_BSWAP 0x01 /* Byte Swap of read-data for DMAC */ | 92 | #define SPCR_BSWAP 0x01 /* Byte Swap of read-data for DMAC */ |
93 | 93 | ||
@@ -472,25 +472,52 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, | |||
472 | dma_cookie_t cookie; | 472 | dma_cookie_t cookie; |
473 | int ret; | 473 | int ret; |
474 | 474 | ||
475 | if (tx) { | 475 | /* First prepare and submit the DMA request(s), as this may fail */ |
476 | desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx, | ||
477 | tx->sgl, tx->nents, DMA_TO_DEVICE, | ||
478 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
479 | if (!desc_tx) | ||
480 | goto no_dma; | ||
481 | |||
482 | irq_mask |= SPCR_SPTIE; | ||
483 | } | ||
484 | if (rx) { | 476 | if (rx) { |
485 | desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx, | 477 | desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx, |
486 | rx->sgl, rx->nents, DMA_FROM_DEVICE, | 478 | rx->sgl, rx->nents, DMA_FROM_DEVICE, |
487 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 479 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
488 | if (!desc_rx) | 480 | if (!desc_rx) { |
489 | goto no_dma; | 481 | ret = -EAGAIN; |
482 | goto no_dma_rx; | ||
483 | } | ||
484 | |||
485 | desc_rx->callback = rspi_dma_complete; | ||
486 | desc_rx->callback_param = rspi; | ||
487 | cookie = dmaengine_submit(desc_rx); | ||
488 | if (dma_submit_error(cookie)) { | ||
489 | ret = cookie; | ||
490 | goto no_dma_rx; | ||
491 | } | ||
490 | 492 | ||
491 | irq_mask |= SPCR_SPRIE; | 493 | irq_mask |= SPCR_SPRIE; |
492 | } | 494 | } |
493 | 495 | ||
496 | if (tx) { | ||
497 | desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx, | ||
498 | tx->sgl, tx->nents, DMA_TO_DEVICE, | ||
499 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
500 | if (!desc_tx) { | ||
501 | ret = -EAGAIN; | ||
502 | goto no_dma_tx; | ||
503 | } | ||
504 | |||
505 | if (rx) { | ||
506 | /* No callback */ | ||
507 | desc_tx->callback = NULL; | ||
508 | } else { | ||
509 | desc_tx->callback = rspi_dma_complete; | ||
510 | desc_tx->callback_param = rspi; | ||
511 | } | ||
512 | cookie = dmaengine_submit(desc_tx); | ||
513 | if (dma_submit_error(cookie)) { | ||
514 | ret = cookie; | ||
515 | goto no_dma_tx; | ||
516 | } | ||
517 | |||
518 | irq_mask |= SPCR_SPTIE; | ||
519 | } | ||
520 | |||
494 | /* | 521 | /* |
495 | * DMAC needs SPxIE, but if SPxIE is set, the IRQ routine will be | 522 | * DMAC needs SPxIE, but if SPxIE is set, the IRQ routine will be |
496 | * called. So, this driver disables the IRQ while DMA transfer. | 523 | * called. So, this driver disables the IRQ while DMA transfer. |
@@ -503,34 +530,24 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, | |||
503 | rspi_enable_irq(rspi, irq_mask); | 530 | rspi_enable_irq(rspi, irq_mask); |
504 | rspi->dma_callbacked = 0; | 531 | rspi->dma_callbacked = 0; |
505 | 532 | ||
506 | if (rx) { | 533 | /* Now start DMA */ |
507 | desc_rx->callback = rspi_dma_complete; | 534 | if (rx) |
508 | desc_rx->callback_param = rspi; | ||
509 | cookie = dmaengine_submit(desc_rx); | ||
510 | if (dma_submit_error(cookie)) | ||
511 | return cookie; | ||
512 | dma_async_issue_pending(rspi->master->dma_rx); | 535 | dma_async_issue_pending(rspi->master->dma_rx); |
513 | } | 536 | if (tx) |
514 | if (tx) { | ||
515 | if (rx) { | ||
516 | /* No callback */ | ||
517 | desc_tx->callback = NULL; | ||
518 | } else { | ||
519 | desc_tx->callback = rspi_dma_complete; | ||
520 | desc_tx->callback_param = rspi; | ||
521 | } | ||
522 | cookie = dmaengine_submit(desc_tx); | ||
523 | if (dma_submit_error(cookie)) | ||
524 | return cookie; | ||
525 | dma_async_issue_pending(rspi->master->dma_tx); | 537 | dma_async_issue_pending(rspi->master->dma_tx); |
526 | } | ||
527 | 538 | ||
528 | ret = wait_event_interruptible_timeout(rspi->wait, | 539 | ret = wait_event_interruptible_timeout(rspi->wait, |
529 | rspi->dma_callbacked, HZ); | 540 | rspi->dma_callbacked, HZ); |
530 | if (ret > 0 && rspi->dma_callbacked) | 541 | if (ret > 0 && rspi->dma_callbacked) |
531 | ret = 0; | 542 | ret = 0; |
532 | else if (!ret) | 543 | else if (!ret) { |
544 | dev_err(&rspi->master->dev, "DMA timeout\n"); | ||
533 | ret = -ETIMEDOUT; | 545 | ret = -ETIMEDOUT; |
546 | if (tx) | ||
547 | dmaengine_terminate_all(rspi->master->dma_tx); | ||
548 | if (rx) | ||
549 | dmaengine_terminate_all(rspi->master->dma_rx); | ||
550 | } | ||
534 | 551 | ||
535 | rspi_disable_irq(rspi, irq_mask); | 552 | rspi_disable_irq(rspi, irq_mask); |
536 | 553 | ||
@@ -541,11 +558,16 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, | |||
541 | 558 | ||
542 | return ret; | 559 | return ret; |
543 | 560 | ||
544 | no_dma: | 561 | no_dma_tx: |
545 | pr_warn_once("%s %s: DMA not available, falling back to PIO\n", | 562 | if (rx) |
546 | dev_driver_string(&rspi->master->dev), | 563 | dmaengine_terminate_all(rspi->master->dma_rx); |
547 | dev_name(&rspi->master->dev)); | 564 | no_dma_rx: |
548 | return -EAGAIN; | 565 | if (ret == -EAGAIN) { |
566 | pr_warn_once("%s %s: DMA not available, falling back to PIO\n", | ||
567 | dev_driver_string(&rspi->master->dev), | ||
568 | dev_name(&rspi->master->dev)); | ||
569 | } | ||
570 | return ret; | ||
549 | } | 571 | } |
550 | 572 | ||
551 | static void rspi_receive_init(const struct rspi_data *rspi) | 573 | static void rspi_receive_init(const struct rspi_data *rspi) |
@@ -887,20 +909,24 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev, | |||
887 | dma_cap_zero(mask); | 909 | dma_cap_zero(mask); |
888 | dma_cap_set(DMA_SLAVE, mask); | 910 | dma_cap_set(DMA_SLAVE, mask); |
889 | 911 | ||
890 | chan = dma_request_channel(mask, shdma_chan_filter, | 912 | chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, |
891 | (void *)(unsigned long)id); | 913 | (void *)(unsigned long)id, dev, |
914 | dir == DMA_MEM_TO_DEV ? "tx" : "rx"); | ||
892 | if (!chan) { | 915 | if (!chan) { |
893 | dev_warn(dev, "dma_request_channel failed\n"); | 916 | dev_warn(dev, "dma_request_slave_channel_compat failed\n"); |
894 | return NULL; | 917 | return NULL; |
895 | } | 918 | } |
896 | 919 | ||
897 | memset(&cfg, 0, sizeof(cfg)); | 920 | memset(&cfg, 0, sizeof(cfg)); |
898 | cfg.slave_id = id; | 921 | cfg.slave_id = id; |
899 | cfg.direction = dir; | 922 | cfg.direction = dir; |
900 | if (dir == DMA_MEM_TO_DEV) | 923 | if (dir == DMA_MEM_TO_DEV) { |
901 | cfg.dst_addr = port_addr; | 924 | cfg.dst_addr = port_addr; |
902 | else | 925 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; |
926 | } else { | ||
903 | cfg.src_addr = port_addr; | 927 | cfg.src_addr = port_addr; |
928 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; | ||
929 | } | ||
904 | 930 | ||
905 | ret = dmaengine_slave_config(chan, &cfg); | 931 | ret = dmaengine_slave_config(chan, &cfg); |
906 | if (ret) { | 932 | if (ret) { |
@@ -916,22 +942,30 @@ static int rspi_request_dma(struct device *dev, struct spi_master *master, | |||
916 | const struct resource *res) | 942 | const struct resource *res) |
917 | { | 943 | { |
918 | const struct rspi_plat_data *rspi_pd = dev_get_platdata(dev); | 944 | const struct rspi_plat_data *rspi_pd = dev_get_platdata(dev); |
945 | unsigned int dma_tx_id, dma_rx_id; | ||
946 | |||
947 | if (dev->of_node) { | ||
948 | /* In the OF case we will get the slave IDs from the DT */ | ||
949 | dma_tx_id = 0; | ||
950 | dma_rx_id = 0; | ||
951 | } else if (rspi_pd && rspi_pd->dma_tx_id && rspi_pd->dma_rx_id) { | ||
952 | dma_tx_id = rspi_pd->dma_tx_id; | ||
953 | dma_rx_id = rspi_pd->dma_rx_id; | ||
954 | } else { | ||
955 | /* The driver assumes no error. */ | ||
956 | return 0; | ||
957 | } | ||
919 | 958 | ||
920 | if (!rspi_pd || !rspi_pd->dma_rx_id || !rspi_pd->dma_tx_id) | 959 | master->dma_tx = rspi_request_dma_chan(dev, DMA_MEM_TO_DEV, dma_tx_id, |
921 | return 0; /* The driver assumes no error. */ | ||
922 | |||
923 | master->dma_rx = rspi_request_dma_chan(dev, DMA_DEV_TO_MEM, | ||
924 | rspi_pd->dma_rx_id, | ||
925 | res->start + RSPI_SPDR); | 960 | res->start + RSPI_SPDR); |
926 | if (!master->dma_rx) | 961 | if (!master->dma_tx) |
927 | return -ENODEV; | 962 | return -ENODEV; |
928 | 963 | ||
929 | master->dma_tx = rspi_request_dma_chan(dev, DMA_MEM_TO_DEV, | 964 | master->dma_rx = rspi_request_dma_chan(dev, DMA_DEV_TO_MEM, dma_rx_id, |
930 | rspi_pd->dma_tx_id, | ||
931 | res->start + RSPI_SPDR); | 965 | res->start + RSPI_SPDR); |
932 | if (!master->dma_tx) { | 966 | if (!master->dma_rx) { |
933 | dma_release_channel(master->dma_rx); | 967 | dma_release_channel(master->dma_tx); |
934 | master->dma_rx = NULL; | 968 | master->dma_tx = NULL; |
935 | return -ENODEV; | 969 | return -ENODEV; |
936 | } | 970 | } |
937 | 971 | ||
@@ -1024,12 +1058,11 @@ static int rspi_request_irq(struct device *dev, unsigned int irq, | |||
1024 | irq_handler_t handler, const char *suffix, | 1058 | irq_handler_t handler, const char *suffix, |
1025 | void *dev_id) | 1059 | void *dev_id) |
1026 | { | 1060 | { |
1027 | const char *base = dev_name(dev); | 1061 | const char *name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", |
1028 | size_t len = strlen(base) + strlen(suffix) + 2; | 1062 | dev_name(dev), suffix); |
1029 | char *name = devm_kzalloc(dev, len, GFP_KERNEL); | ||
1030 | if (!name) | 1063 | if (!name) |
1031 | return -ENOMEM; | 1064 | return -ENOMEM; |
1032 | snprintf(name, len, "%s:%s", base, suffix); | 1065 | |
1033 | return devm_request_irq(dev, irq, handler, 0, name, dev_id); | 1066 | return devm_request_irq(dev, irq, handler, 0, name, dev_id); |
1034 | } | 1067 | } |
1035 | 1068 | ||
@@ -1062,7 +1095,7 @@ static int rspi_probe(struct platform_device *pdev) | |||
1062 | master->num_chipselect = rspi_pd->num_chipselect; | 1095 | master->num_chipselect = rspi_pd->num_chipselect; |
1063 | else | 1096 | else |
1064 | master->num_chipselect = 2; /* default */ | 1097 | master->num_chipselect = 2; /* default */ |
1065 | }; | 1098 | } |
1066 | 1099 | ||
1067 | /* ops parameter check */ | 1100 | /* ops parameter check */ |
1068 | if (!ops->set_config_register) { | 1101 | if (!ops->set_config_register) { |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 2a4354dcd661..3f365402fcc0 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
@@ -636,17 +636,7 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, | |||
636 | dma_cookie_t cookie; | 636 | dma_cookie_t cookie; |
637 | int ret; | 637 | int ret; |
638 | 638 | ||
639 | if (tx) { | 639 | /* First prepare and submit the DMA request(s), as this may fail */ |
640 | ier_bits |= IER_TDREQE | IER_TDMAE; | ||
641 | dma_sync_single_for_device(p->master->dma_tx->device->dev, | ||
642 | p->tx_dma_addr, len, DMA_TO_DEVICE); | ||
643 | desc_tx = dmaengine_prep_slave_single(p->master->dma_tx, | ||
644 | p->tx_dma_addr, len, DMA_TO_DEVICE, | ||
645 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
646 | if (!desc_tx) | ||
647 | return -EAGAIN; | ||
648 | } | ||
649 | |||
650 | if (rx) { | 640 | if (rx) { |
651 | ier_bits |= IER_RDREQE | IER_RDMAE; | 641 | ier_bits |= IER_RDREQE | IER_RDMAE; |
652 | desc_rx = dmaengine_prep_slave_single(p->master->dma_rx, | 642 | desc_rx = dmaengine_prep_slave_single(p->master->dma_rx, |
@@ -654,30 +644,26 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, | |||
654 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 644 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
655 | if (!desc_rx) | 645 | if (!desc_rx) |
656 | return -EAGAIN; | 646 | return -EAGAIN; |
657 | } | ||
658 | |||
659 | /* 1 stage FIFO watermarks for DMA */ | ||
660 | sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1); | ||
661 | 647 | ||
662 | /* setup msiof transfer mode registers (32-bit words) */ | ||
663 | sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4); | ||
664 | |||
665 | sh_msiof_write(p, IER, ier_bits); | ||
666 | |||
667 | reinit_completion(&p->done); | ||
668 | |||
669 | if (rx) { | ||
670 | desc_rx->callback = sh_msiof_dma_complete; | 648 | desc_rx->callback = sh_msiof_dma_complete; |
671 | desc_rx->callback_param = p; | 649 | desc_rx->callback_param = p; |
672 | cookie = dmaengine_submit(desc_rx); | 650 | cookie = dmaengine_submit(desc_rx); |
673 | if (dma_submit_error(cookie)) { | 651 | if (dma_submit_error(cookie)) |
674 | ret = cookie; | 652 | return cookie; |
675 | goto stop_ier; | ||
676 | } | ||
677 | dma_async_issue_pending(p->master->dma_rx); | ||
678 | } | 653 | } |
679 | 654 | ||
680 | if (tx) { | 655 | if (tx) { |
656 | ier_bits |= IER_TDREQE | IER_TDMAE; | ||
657 | dma_sync_single_for_device(p->master->dma_tx->device->dev, | ||
658 | p->tx_dma_addr, len, DMA_TO_DEVICE); | ||
659 | desc_tx = dmaengine_prep_slave_single(p->master->dma_tx, | ||
660 | p->tx_dma_addr, len, DMA_TO_DEVICE, | ||
661 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
662 | if (!desc_tx) { | ||
663 | ret = -EAGAIN; | ||
664 | goto no_dma_tx; | ||
665 | } | ||
666 | |||
681 | if (rx) { | 667 | if (rx) { |
682 | /* No callback */ | 668 | /* No callback */ |
683 | desc_tx->callback = NULL; | 669 | desc_tx->callback = NULL; |
@@ -688,15 +674,30 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, | |||
688 | cookie = dmaengine_submit(desc_tx); | 674 | cookie = dmaengine_submit(desc_tx); |
689 | if (dma_submit_error(cookie)) { | 675 | if (dma_submit_error(cookie)) { |
690 | ret = cookie; | 676 | ret = cookie; |
691 | goto stop_rx; | 677 | goto no_dma_tx; |
692 | } | 678 | } |
693 | dma_async_issue_pending(p->master->dma_tx); | ||
694 | } | 679 | } |
695 | 680 | ||
681 | /* 1 stage FIFO watermarks for DMA */ | ||
682 | sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1); | ||
683 | |||
684 | /* setup msiof transfer mode registers (32-bit words) */ | ||
685 | sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4); | ||
686 | |||
687 | sh_msiof_write(p, IER, ier_bits); | ||
688 | |||
689 | reinit_completion(&p->done); | ||
690 | |||
691 | /* Now start DMA */ | ||
692 | if (rx) | ||
693 | dma_async_issue_pending(p->master->dma_rx); | ||
694 | if (tx) | ||
695 | dma_async_issue_pending(p->master->dma_tx); | ||
696 | |||
696 | ret = sh_msiof_spi_start(p, rx); | 697 | ret = sh_msiof_spi_start(p, rx); |
697 | if (ret) { | 698 | if (ret) { |
698 | dev_err(&p->pdev->dev, "failed to start hardware\n"); | 699 | dev_err(&p->pdev->dev, "failed to start hardware\n"); |
699 | goto stop_tx; | 700 | goto stop_dma; |
700 | } | 701 | } |
701 | 702 | ||
702 | /* wait for tx fifo to be emptied / rx fifo to be filled */ | 703 | /* wait for tx fifo to be emptied / rx fifo to be filled */ |
@@ -726,13 +727,12 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, | |||
726 | stop_reset: | 727 | stop_reset: |
727 | sh_msiof_reset_str(p); | 728 | sh_msiof_reset_str(p); |
728 | sh_msiof_spi_stop(p, rx); | 729 | sh_msiof_spi_stop(p, rx); |
729 | stop_tx: | 730 | stop_dma: |
730 | if (tx) | 731 | if (tx) |
731 | dmaengine_terminate_all(p->master->dma_tx); | 732 | dmaengine_terminate_all(p->master->dma_tx); |
732 | stop_rx: | 733 | no_dma_tx: |
733 | if (rx) | 734 | if (rx) |
734 | dmaengine_terminate_all(p->master->dma_rx); | 735 | dmaengine_terminate_all(p->master->dma_rx); |
735 | stop_ier: | ||
736 | sh_msiof_write(p, IER, 0); | 736 | sh_msiof_write(p, IER, 0); |
737 | return ret; | 737 | return ret; |
738 | } | 738 | } |
@@ -928,6 +928,9 @@ static const struct of_device_id sh_msiof_match[] = { | |||
928 | { .compatible = "renesas,sh-mobile-msiof", .data = &sh_data }, | 928 | { .compatible = "renesas,sh-mobile-msiof", .data = &sh_data }, |
929 | { .compatible = "renesas,msiof-r8a7790", .data = &r8a779x_data }, | 929 | { .compatible = "renesas,msiof-r8a7790", .data = &r8a779x_data }, |
930 | { .compatible = "renesas,msiof-r8a7791", .data = &r8a779x_data }, | 930 | { .compatible = "renesas,msiof-r8a7791", .data = &r8a779x_data }, |
931 | { .compatible = "renesas,msiof-r8a7792", .data = &r8a779x_data }, | ||
932 | { .compatible = "renesas,msiof-r8a7793", .data = &r8a779x_data }, | ||
933 | { .compatible = "renesas,msiof-r8a7794", .data = &r8a779x_data }, | ||
931 | {}, | 934 | {}, |
932 | }; | 935 | }; |
933 | MODULE_DEVICE_TABLE(of, sh_msiof_match); | 936 | MODULE_DEVICE_TABLE(of, sh_msiof_match); |
@@ -972,20 +975,24 @@ static struct dma_chan *sh_msiof_request_dma_chan(struct device *dev, | |||
972 | dma_cap_zero(mask); | 975 | dma_cap_zero(mask); |
973 | dma_cap_set(DMA_SLAVE, mask); | 976 | dma_cap_set(DMA_SLAVE, mask); |
974 | 977 | ||
975 | chan = dma_request_channel(mask, shdma_chan_filter, | 978 | chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, |
976 | (void *)(unsigned long)id); | 979 | (void *)(unsigned long)id, dev, |
980 | dir == DMA_MEM_TO_DEV ? "tx" : "rx"); | ||
977 | if (!chan) { | 981 | if (!chan) { |
978 | dev_warn(dev, "dma_request_channel failed\n"); | 982 | dev_warn(dev, "dma_request_slave_channel_compat failed\n"); |
979 | return NULL; | 983 | return NULL; |
980 | } | 984 | } |
981 | 985 | ||
982 | memset(&cfg, 0, sizeof(cfg)); | 986 | memset(&cfg, 0, sizeof(cfg)); |
983 | cfg.slave_id = id; | 987 | cfg.slave_id = id; |
984 | cfg.direction = dir; | 988 | cfg.direction = dir; |
985 | if (dir == DMA_MEM_TO_DEV) | 989 | if (dir == DMA_MEM_TO_DEV) { |
986 | cfg.dst_addr = port_addr; | 990 | cfg.dst_addr = port_addr; |
987 | else | 991 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
992 | } else { | ||
988 | cfg.src_addr = port_addr; | 993 | cfg.src_addr = port_addr; |
994 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
995 | } | ||
989 | 996 | ||
990 | ret = dmaengine_slave_config(chan, &cfg); | 997 | ret = dmaengine_slave_config(chan, &cfg); |
991 | if (ret) { | 998 | if (ret) { |
@@ -1002,12 +1009,22 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p) | |||
1002 | struct platform_device *pdev = p->pdev; | 1009 | struct platform_device *pdev = p->pdev; |
1003 | struct device *dev = &pdev->dev; | 1010 | struct device *dev = &pdev->dev; |
1004 | const struct sh_msiof_spi_info *info = dev_get_platdata(dev); | 1011 | const struct sh_msiof_spi_info *info = dev_get_platdata(dev); |
1012 | unsigned int dma_tx_id, dma_rx_id; | ||
1005 | const struct resource *res; | 1013 | const struct resource *res; |
1006 | struct spi_master *master; | 1014 | struct spi_master *master; |
1007 | struct device *tx_dev, *rx_dev; | 1015 | struct device *tx_dev, *rx_dev; |
1008 | 1016 | ||
1009 | if (!info || !info->dma_tx_id || !info->dma_rx_id) | 1017 | if (dev->of_node) { |
1010 | return 0; /* The driver assumes no error */ | 1018 | /* In the OF case we will get the slave IDs from the DT */ |
1019 | dma_tx_id = 0; | ||
1020 | dma_rx_id = 0; | ||
1021 | } else if (info && info->dma_tx_id && info->dma_rx_id) { | ||
1022 | dma_tx_id = info->dma_tx_id; | ||
1023 | dma_rx_id = info->dma_rx_id; | ||
1024 | } else { | ||
1025 | /* The driver assumes no error */ | ||
1026 | return 0; | ||
1027 | } | ||
1011 | 1028 | ||
1012 | /* The DMA engine uses the second register set, if present */ | 1029 | /* The DMA engine uses the second register set, if present */ |
1013 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1030 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
@@ -1016,13 +1033,13 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p) | |||
1016 | 1033 | ||
1017 | master = p->master; | 1034 | master = p->master; |
1018 | master->dma_tx = sh_msiof_request_dma_chan(dev, DMA_MEM_TO_DEV, | 1035 | master->dma_tx = sh_msiof_request_dma_chan(dev, DMA_MEM_TO_DEV, |
1019 | info->dma_tx_id, | 1036 | dma_tx_id, |
1020 | res->start + TFDR); | 1037 | res->start + TFDR); |
1021 | if (!master->dma_tx) | 1038 | if (!master->dma_tx) |
1022 | return -ENODEV; | 1039 | return -ENODEV; |
1023 | 1040 | ||
1024 | master->dma_rx = sh_msiof_request_dma_chan(dev, DMA_DEV_TO_MEM, | 1041 | master->dma_rx = sh_msiof_request_dma_chan(dev, DMA_DEV_TO_MEM, |
1025 | info->dma_rx_id, | 1042 | dma_rx_id, |
1026 | res->start + RFDR); | 1043 | res->start + RFDR); |
1027 | if (!master->dma_rx) | 1044 | if (!master->dma_rx) |
1028 | goto free_tx_chan; | 1045 | goto free_tx_chan; |
@@ -1205,6 +1222,9 @@ static struct platform_device_id spi_driver_ids[] = { | |||
1205 | { "spi_sh_msiof", (kernel_ulong_t)&sh_data }, | 1222 | { "spi_sh_msiof", (kernel_ulong_t)&sh_data }, |
1206 | { "spi_r8a7790_msiof", (kernel_ulong_t)&r8a779x_data }, | 1223 | { "spi_r8a7790_msiof", (kernel_ulong_t)&r8a779x_data }, |
1207 | { "spi_r8a7791_msiof", (kernel_ulong_t)&r8a779x_data }, | 1224 | { "spi_r8a7791_msiof", (kernel_ulong_t)&r8a779x_data }, |
1225 | { "spi_r8a7792_msiof", (kernel_ulong_t)&r8a779x_data }, | ||
1226 | { "spi_r8a7793_msiof", (kernel_ulong_t)&r8a779x_data }, | ||
1227 | { "spi_r8a7794_msiof", (kernel_ulong_t)&r8a779x_data }, | ||
1208 | {}, | 1228 | {}, |
1209 | }; | 1229 | }; |
1210 | MODULE_DEVICE_TABLE(platform, spi_driver_ids); | 1230 | MODULE_DEVICE_TABLE(platform, spi_driver_ids); |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 95ac276eaafe..39e2c0a55a28 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -62,15 +62,15 @@ | |||
62 | #define SIRFSOC_SPI_TRAN_DAT_FORMAT_12 (1 << 26) | 62 | #define SIRFSOC_SPI_TRAN_DAT_FORMAT_12 (1 << 26) |
63 | #define SIRFSOC_SPI_TRAN_DAT_FORMAT_16 (2 << 26) | 63 | #define SIRFSOC_SPI_TRAN_DAT_FORMAT_16 (2 << 26) |
64 | #define SIRFSOC_SPI_TRAN_DAT_FORMAT_32 (3 << 26) | 64 | #define SIRFSOC_SPI_TRAN_DAT_FORMAT_32 (3 << 26) |
65 | #define SIRFSOC_SPI_CMD_BYTE_NUM(x) ((x & 3) << 28) | 65 | #define SIRFSOC_SPI_CMD_BYTE_NUM(x) ((x & 3) << 28) |
66 | #define SIRFSOC_SPI_ENA_AUTO_CLR BIT(30) | 66 | #define SIRFSOC_SPI_ENA_AUTO_CLR BIT(30) |
67 | #define SIRFSOC_SPI_MUL_DAT_MODE BIT(31) | 67 | #define SIRFSOC_SPI_MUL_DAT_MODE BIT(31) |
68 | 68 | ||
69 | /* Interrupt Enable */ | 69 | /* Interrupt Enable */ |
70 | #define SIRFSOC_SPI_RX_DONE_INT_EN BIT(0) | 70 | #define SIRFSOC_SPI_RX_DONE_INT_EN BIT(0) |
71 | #define SIRFSOC_SPI_TX_DONE_INT_EN BIT(1) | 71 | #define SIRFSOC_SPI_TX_DONE_INT_EN BIT(1) |
72 | #define SIRFSOC_SPI_RX_OFLOW_INT_EN BIT(2) | 72 | #define SIRFSOC_SPI_RX_OFLOW_INT_EN BIT(2) |
73 | #define SIRFSOC_SPI_TX_UFLOW_INT_EN BIT(3) | 73 | #define SIRFSOC_SPI_TX_UFLOW_INT_EN BIT(3) |
74 | #define SIRFSOC_SPI_RX_IO_DMA_INT_EN BIT(4) | 74 | #define SIRFSOC_SPI_RX_IO_DMA_INT_EN BIT(4) |
75 | #define SIRFSOC_SPI_TX_IO_DMA_INT_EN BIT(5) | 75 | #define SIRFSOC_SPI_TX_IO_DMA_INT_EN BIT(5) |
76 | #define SIRFSOC_SPI_RXFIFO_FULL_INT_EN BIT(6) | 76 | #define SIRFSOC_SPI_RXFIFO_FULL_INT_EN BIT(6) |
@@ -79,7 +79,7 @@ | |||
79 | #define SIRFSOC_SPI_TXFIFO_THD_INT_EN BIT(9) | 79 | #define SIRFSOC_SPI_TXFIFO_THD_INT_EN BIT(9) |
80 | #define SIRFSOC_SPI_FRM_END_INT_EN BIT(10) | 80 | #define SIRFSOC_SPI_FRM_END_INT_EN BIT(10) |
81 | 81 | ||
82 | #define SIRFSOC_SPI_INT_MASK_ALL 0x1FFF | 82 | #define SIRFSOC_SPI_INT_MASK_ALL 0x1FFF |
83 | 83 | ||
84 | /* Interrupt status */ | 84 | /* Interrupt status */ |
85 | #define SIRFSOC_SPI_RX_DONE BIT(0) | 85 | #define SIRFSOC_SPI_RX_DONE BIT(0) |
@@ -170,8 +170,7 @@ struct sirfsoc_spi { | |||
170 | * command model | 170 | * command model |
171 | */ | 171 | */ |
172 | bool tx_by_cmd; | 172 | bool tx_by_cmd; |
173 | 173 | bool hw_cs; | |
174 | int chipselect[0]; | ||
175 | }; | 174 | }; |
176 | 175 | ||
177 | static void spi_sirfsoc_rx_word_u8(struct sirfsoc_spi *sspi) | 176 | static void spi_sirfsoc_rx_word_u8(struct sirfsoc_spi *sspi) |
@@ -304,7 +303,7 @@ static void spi_sirfsoc_dma_fini_callback(void *data) | |||
304 | complete(dma_complete); | 303 | complete(dma_complete); |
305 | } | 304 | } |
306 | 305 | ||
307 | static int spi_sirfsoc_cmd_transfer(struct spi_device *spi, | 306 | static void spi_sirfsoc_cmd_transfer(struct spi_device *spi, |
308 | struct spi_transfer *t) | 307 | struct spi_transfer *t) |
309 | { | 308 | { |
310 | struct sirfsoc_spi *sspi; | 309 | struct sirfsoc_spi *sspi; |
@@ -312,6 +311,8 @@ static int spi_sirfsoc_cmd_transfer(struct spi_device *spi, | |||
312 | u32 cmd; | 311 | u32 cmd; |
313 | 312 | ||
314 | sspi = spi_master_get_devdata(spi->master); | 313 | sspi = spi_master_get_devdata(spi->master); |
314 | writel(SIRFSOC_SPI_FIFO_RESET, sspi->base + SIRFSOC_SPI_TXFIFO_OP); | ||
315 | writel(SIRFSOC_SPI_FIFO_START, sspi->base + SIRFSOC_SPI_TXFIFO_OP); | ||
315 | memcpy(&cmd, sspi->tx, t->len); | 316 | memcpy(&cmd, sspi->tx, t->len); |
316 | if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) | 317 | if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) |
317 | cmd = cpu_to_be32(cmd) >> | 318 | cmd = cpu_to_be32(cmd) >> |
@@ -326,10 +327,9 @@ static int spi_sirfsoc_cmd_transfer(struct spi_device *spi, | |||
326 | sspi->base + SIRFSOC_SPI_TX_RX_EN); | 327 | sspi->base + SIRFSOC_SPI_TX_RX_EN); |
327 | if (wait_for_completion_timeout(&sspi->tx_done, timeout) == 0) { | 328 | if (wait_for_completion_timeout(&sspi->tx_done, timeout) == 0) { |
328 | dev_err(&spi->dev, "cmd transfer timeout\n"); | 329 | dev_err(&spi->dev, "cmd transfer timeout\n"); |
329 | return 0; | 330 | return; |
330 | } | 331 | } |
331 | 332 | sspi->left_rx_word -= t->len; | |
332 | return t->len; | ||
333 | } | 333 | } |
334 | 334 | ||
335 | static void spi_sirfsoc_dma_transfer(struct spi_device *spi, | 335 | static void spi_sirfsoc_dma_transfer(struct spi_device *spi, |
@@ -438,7 +438,8 @@ static void spi_sirfsoc_pio_transfer(struct spi_device *spi, | |||
438 | sspi->tx_word(sspi); | 438 | sspi->tx_word(sspi); |
439 | writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | | 439 | writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | |
440 | SIRFSOC_SPI_TX_UFLOW_INT_EN | | 440 | SIRFSOC_SPI_TX_UFLOW_INT_EN | |
441 | SIRFSOC_SPI_RX_OFLOW_INT_EN, | 441 | SIRFSOC_SPI_RX_OFLOW_INT_EN | |
442 | SIRFSOC_SPI_RX_IO_DMA_INT_EN, | ||
442 | sspi->base + SIRFSOC_SPI_INT_EN); | 443 | sspi->base + SIRFSOC_SPI_INT_EN); |
443 | writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, | 444 | writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, |
444 | sspi->base + SIRFSOC_SPI_TX_RX_EN); | 445 | sspi->base + SIRFSOC_SPI_TX_RX_EN); |
@@ -484,7 +485,7 @@ static void spi_sirfsoc_chipselect(struct spi_device *spi, int value) | |||
484 | { | 485 | { |
485 | struct sirfsoc_spi *sspi = spi_master_get_devdata(spi->master); | 486 | struct sirfsoc_spi *sspi = spi_master_get_devdata(spi->master); |
486 | 487 | ||
487 | if (sspi->chipselect[spi->chip_select] == 0) { | 488 | if (sspi->hw_cs) { |
488 | u32 regval = readl(sspi->base + SIRFSOC_SPI_CTRL); | 489 | u32 regval = readl(sspi->base + SIRFSOC_SPI_CTRL); |
489 | switch (value) { | 490 | switch (value) { |
490 | case BITBANG_CS_ACTIVE: | 491 | case BITBANG_CS_ACTIVE: |
@@ -502,14 +503,13 @@ static void spi_sirfsoc_chipselect(struct spi_device *spi, int value) | |||
502 | } | 503 | } |
503 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); | 504 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); |
504 | } else { | 505 | } else { |
505 | int gpio = sspi->chipselect[spi->chip_select]; | ||
506 | switch (value) { | 506 | switch (value) { |
507 | case BITBANG_CS_ACTIVE: | 507 | case BITBANG_CS_ACTIVE: |
508 | gpio_direction_output(gpio, | 508 | gpio_direction_output(spi->cs_gpio, |
509 | spi->mode & SPI_CS_HIGH ? 1 : 0); | 509 | spi->mode & SPI_CS_HIGH ? 1 : 0); |
510 | break; | 510 | break; |
511 | case BITBANG_CS_INACTIVE: | 511 | case BITBANG_CS_INACTIVE: |
512 | gpio_direction_output(gpio, | 512 | gpio_direction_output(spi->cs_gpio, |
513 | spi->mode & SPI_CS_HIGH ? 0 : 1); | 513 | spi->mode & SPI_CS_HIGH ? 0 : 1); |
514 | break; | 514 | break; |
515 | } | 515 | } |
@@ -603,8 +603,8 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
603 | sspi->tx_by_cmd = false; | 603 | sspi->tx_by_cmd = false; |
604 | } | 604 | } |
605 | /* | 605 | /* |
606 | * set spi controller in RISC chipselect mode, we are controlling CS by | 606 | * it should never set to hardware cs mode because in hardware cs mode, |
607 | * software BITBANG_CS_ACTIVE and BITBANG_CS_INACTIVE. | 607 | * cs signal can't controlled by driver. |
608 | */ | 608 | */ |
609 | regval |= SIRFSOC_SPI_CS_IO_MODE; | 609 | regval |= SIRFSOC_SPI_CS_IO_MODE; |
610 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); | 610 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); |
@@ -627,9 +627,17 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
627 | 627 | ||
628 | static int spi_sirfsoc_setup(struct spi_device *spi) | 628 | static int spi_sirfsoc_setup(struct spi_device *spi) |
629 | { | 629 | { |
630 | struct sirfsoc_spi *sspi; | ||
631 | |||
630 | if (!spi->max_speed_hz) | 632 | if (!spi->max_speed_hz) |
631 | return -EINVAL; | 633 | return -EINVAL; |
632 | 634 | ||
635 | sspi = spi_master_get_devdata(spi->master); | ||
636 | |||
637 | if (spi->cs_gpio == -ENOENT) | ||
638 | sspi->hw_cs = true; | ||
639 | else | ||
640 | sspi->hw_cs = false; | ||
633 | return spi_sirfsoc_setup_transfer(spi, NULL); | 641 | return spi_sirfsoc_setup_transfer(spi, NULL); |
634 | } | 642 | } |
635 | 643 | ||
@@ -638,19 +646,10 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) | |||
638 | struct sirfsoc_spi *sspi; | 646 | struct sirfsoc_spi *sspi; |
639 | struct spi_master *master; | 647 | struct spi_master *master; |
640 | struct resource *mem_res; | 648 | struct resource *mem_res; |
641 | int num_cs, cs_gpio, irq; | 649 | int irq; |
642 | int i; | 650 | int i, ret; |
643 | int ret; | ||
644 | 651 | ||
645 | ret = of_property_read_u32(pdev->dev.of_node, | 652 | master = spi_alloc_master(&pdev->dev, sizeof(*sspi)); |
646 | "sirf,spi-num-chipselects", &num_cs); | ||
647 | if (ret < 0) { | ||
648 | dev_err(&pdev->dev, "Unable to get chip select number\n"); | ||
649 | goto err_cs; | ||
650 | } | ||
651 | |||
652 | master = spi_alloc_master(&pdev->dev, | ||
653 | sizeof(*sspi) + sizeof(int) * num_cs); | ||
654 | if (!master) { | 653 | if (!master) { |
655 | dev_err(&pdev->dev, "Unable to allocate SPI master\n"); | 654 | dev_err(&pdev->dev, "Unable to allocate SPI master\n"); |
656 | return -ENOMEM; | 655 | return -ENOMEM; |
@@ -658,32 +657,6 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) | |||
658 | platform_set_drvdata(pdev, master); | 657 | platform_set_drvdata(pdev, master); |
659 | sspi = spi_master_get_devdata(master); | 658 | sspi = spi_master_get_devdata(master); |
660 | 659 | ||
661 | master->num_chipselect = num_cs; | ||
662 | |||
663 | for (i = 0; i < master->num_chipselect; i++) { | ||
664 | cs_gpio = of_get_named_gpio(pdev->dev.of_node, "cs-gpios", i); | ||
665 | if (cs_gpio < 0) { | ||
666 | dev_err(&pdev->dev, "can't get cs gpio from DT\n"); | ||
667 | ret = -ENODEV; | ||
668 | goto free_master; | ||
669 | } | ||
670 | |||
671 | sspi->chipselect[i] = cs_gpio; | ||
672 | if (cs_gpio == 0) | ||
673 | continue; /* use cs from spi controller */ | ||
674 | |||
675 | ret = gpio_request(cs_gpio, DRIVER_NAME); | ||
676 | if (ret) { | ||
677 | while (i > 0) { | ||
678 | i--; | ||
679 | if (sspi->chipselect[i] > 0) | ||
680 | gpio_free(sspi->chipselect[i]); | ||
681 | } | ||
682 | dev_err(&pdev->dev, "fail to request cs gpios\n"); | ||
683 | goto free_master; | ||
684 | } | ||
685 | } | ||
686 | |||
687 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 660 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
688 | sspi->base = devm_ioremap_resource(&pdev->dev, mem_res); | 661 | sspi->base = devm_ioremap_resource(&pdev->dev, mem_res); |
689 | if (IS_ERR(sspi->base)) { | 662 | if (IS_ERR(sspi->base)) { |
@@ -753,7 +726,21 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) | |||
753 | ret = spi_bitbang_start(&sspi->bitbang); | 726 | ret = spi_bitbang_start(&sspi->bitbang); |
754 | if (ret) | 727 | if (ret) |
755 | goto free_dummypage; | 728 | goto free_dummypage; |
756 | 729 | for (i = 0; master->cs_gpios && i < master->num_chipselect; i++) { | |
730 | if (master->cs_gpios[i] == -ENOENT) | ||
731 | continue; | ||
732 | if (!gpio_is_valid(master->cs_gpios[i])) { | ||
733 | dev_err(&pdev->dev, "no valid gpio\n"); | ||
734 | ret = -EINVAL; | ||
735 | goto free_dummypage; | ||
736 | } | ||
737 | ret = devm_gpio_request(&pdev->dev, | ||
738 | master->cs_gpios[i], DRIVER_NAME); | ||
739 | if (ret) { | ||
740 | dev_err(&pdev->dev, "failed to request gpio\n"); | ||
741 | goto free_dummypage; | ||
742 | } | ||
743 | } | ||
757 | dev_info(&pdev->dev, "registerred, bus number = %d\n", master->bus_num); | 744 | dev_info(&pdev->dev, "registerred, bus number = %d\n", master->bus_num); |
758 | 745 | ||
759 | return 0; | 746 | return 0; |
@@ -768,7 +755,7 @@ free_rx_dma: | |||
768 | dma_release_channel(sspi->rx_chan); | 755 | dma_release_channel(sspi->rx_chan); |
769 | free_master: | 756 | free_master: |
770 | spi_master_put(master); | 757 | spi_master_put(master); |
771 | err_cs: | 758 | |
772 | return ret; | 759 | return ret; |
773 | } | 760 | } |
774 | 761 | ||
@@ -776,16 +763,11 @@ static int spi_sirfsoc_remove(struct platform_device *pdev) | |||
776 | { | 763 | { |
777 | struct spi_master *master; | 764 | struct spi_master *master; |
778 | struct sirfsoc_spi *sspi; | 765 | struct sirfsoc_spi *sspi; |
779 | int i; | ||
780 | 766 | ||
781 | master = platform_get_drvdata(pdev); | 767 | master = platform_get_drvdata(pdev); |
782 | sspi = spi_master_get_devdata(master); | 768 | sspi = spi_master_get_devdata(master); |
783 | 769 | ||
784 | spi_bitbang_stop(&sspi->bitbang); | 770 | spi_bitbang_stop(&sspi->bitbang); |
785 | for (i = 0; i < master->num_chipselect; i++) { | ||
786 | if (sspi->chipselect[i] > 0) | ||
787 | gpio_free(sspi->chipselect[i]); | ||
788 | } | ||
789 | kfree(sspi->dummypage); | 771 | kfree(sspi->dummypage); |
790 | clk_disable_unprepare(sspi->clk); | 772 | clk_disable_unprepare(sspi->clk); |
791 | clk_put(sspi->clk); | 773 | clk_put(sspi->clk); |
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 4d8efb16573d..79bd84f43430 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
@@ -471,7 +471,6 @@ static struct platform_driver xilinx_spi_driver = { | |||
471 | .remove = xilinx_spi_remove, | 471 | .remove = xilinx_spi_remove, |
472 | .driver = { | 472 | .driver = { |
473 | .name = XILINX_SPI_NAME, | 473 | .name = XILINX_SPI_NAME, |
474 | .owner = THIS_MODULE, | ||
475 | .of_match_table = xilinx_spi_of_match, | 474 | .of_match_table = xilinx_spi_of_match, |
476 | }, | 475 | }, |
477 | }; | 476 | }; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index e0531baf2782..e19512ffc40e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -552,6 +552,9 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n) | |||
552 | struct boardinfo *bi; | 552 | struct boardinfo *bi; |
553 | int i; | 553 | int i; |
554 | 554 | ||
555 | if (!n) | ||
556 | return -EINVAL; | ||
557 | |||
555 | bi = kzalloc(n * sizeof(*bi), GFP_KERNEL); | 558 | bi = kzalloc(n * sizeof(*bi), GFP_KERNEL); |
556 | if (!bi) | 559 | if (!bi) |
557 | return -ENOMEM; | 560 | return -ENOMEM; |
@@ -789,27 +792,35 @@ static int spi_transfer_one_message(struct spi_master *master, | |||
789 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 792 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
790 | trace_spi_transfer_start(msg, xfer); | 793 | trace_spi_transfer_start(msg, xfer); |
791 | 794 | ||
792 | reinit_completion(&master->xfer_completion); | 795 | if (xfer->tx_buf || xfer->rx_buf) { |
796 | reinit_completion(&master->xfer_completion); | ||
793 | 797 | ||
794 | ret = master->transfer_one(master, msg->spi, xfer); | 798 | ret = master->transfer_one(master, msg->spi, xfer); |
795 | if (ret < 0) { | 799 | if (ret < 0) { |
796 | dev_err(&msg->spi->dev, | 800 | dev_err(&msg->spi->dev, |
797 | "SPI transfer failed: %d\n", ret); | 801 | "SPI transfer failed: %d\n", ret); |
798 | goto out; | 802 | goto out; |
799 | } | 803 | } |
800 | 804 | ||
801 | if (ret > 0) { | 805 | if (ret > 0) { |
802 | ret = 0; | 806 | ret = 0; |
803 | ms = xfer->len * 8 * 1000 / xfer->speed_hz; | 807 | ms = xfer->len * 8 * 1000 / xfer->speed_hz; |
804 | ms += ms + 100; /* some tolerance */ | 808 | ms += ms + 100; /* some tolerance */ |
805 | 809 | ||
806 | ms = wait_for_completion_timeout(&master->xfer_completion, | 810 | ms = wait_for_completion_timeout(&master->xfer_completion, |
807 | msecs_to_jiffies(ms)); | 811 | msecs_to_jiffies(ms)); |
808 | } | 812 | } |
809 | 813 | ||
810 | if (ms == 0) { | 814 | if (ms == 0) { |
811 | dev_err(&msg->spi->dev, "SPI transfer timed out\n"); | 815 | dev_err(&msg->spi->dev, |
812 | msg->status = -ETIMEDOUT; | 816 | "SPI transfer timed out\n"); |
817 | msg->status = -ETIMEDOUT; | ||
818 | } | ||
819 | } else { | ||
820 | if (xfer->len) | ||
821 | dev_err(&msg->spi->dev, | ||
822 | "Bufferless transfer has length %u\n", | ||
823 | xfer->len); | ||
813 | } | 824 | } |
814 | 825 | ||
815 | trace_spi_transfer_stop(msg, xfer); | 826 | trace_spi_transfer_stop(msg, xfer); |
@@ -848,6 +859,7 @@ out: | |||
848 | 859 | ||
849 | /** | 860 | /** |
850 | * spi_finalize_current_transfer - report completion of a transfer | 861 | * spi_finalize_current_transfer - report completion of a transfer |
862 | * @master: the master reporting completion | ||
851 | * | 863 | * |
852 | * Called by SPI drivers using the core transfer_one_message() | 864 | * Called by SPI drivers using the core transfer_one_message() |
853 | * implementation to notify it that the current interrupt driven | 865 | * implementation to notify it that the current interrupt driven |
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c index 19396dc4ee47..bed2fedeb057 100644 --- a/drivers/ssb/b43_pci_bridge.c +++ b/drivers/ssb/b43_pci_bridge.c | |||
@@ -38,6 +38,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = { | |||
38 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432b) }, | 38 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432b) }, |
39 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432c) }, | 39 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432c) }, |
40 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4350) }, | 40 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4350) }, |
41 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4351) }, | ||
41 | { 0, }, | 42 | { 0, }, |
42 | }; | 43 | }; |
43 | MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl); | 44 | MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl); |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 2c486ea6236b..35b494f5667f 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -28,8 +28,6 @@ source "drivers/staging/et131x/Kconfig" | |||
28 | 28 | ||
29 | source "drivers/staging/slicoss/Kconfig" | 29 | source "drivers/staging/slicoss/Kconfig" |
30 | 30 | ||
31 | source "drivers/staging/usbip/Kconfig" | ||
32 | |||
33 | source "drivers/staging/wlan-ng/Kconfig" | 31 | source "drivers/staging/wlan-ng/Kconfig" |
34 | 32 | ||
35 | source "drivers/staging/comedi/Kconfig" | 33 | source "drivers/staging/comedi/Kconfig" |
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 1e1a3a10faf7..e66a5dbd9b02 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile | |||
@@ -6,7 +6,6 @@ obj-$(CONFIG_STAGING) += staging.o | |||
6 | obj-y += media/ | 6 | obj-y += media/ |
7 | obj-$(CONFIG_ET131X) += et131x/ | 7 | obj-$(CONFIG_ET131X) += et131x/ |
8 | obj-$(CONFIG_SLICOSS) += slicoss/ | 8 | obj-$(CONFIG_SLICOSS) += slicoss/ |
9 | obj-$(CONFIG_USBIP_CORE) += usbip/ | ||
10 | obj-$(CONFIG_PRISM2_USB) += wlan-ng/ | 9 | obj-$(CONFIG_PRISM2_USB) += wlan-ng/ |
11 | obj-$(CONFIG_COMEDI) += comedi/ | 10 | obj-$(CONFIG_COMEDI) += comedi/ |
12 | obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/ | 11 | obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/ |
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index 9b47e66599a3..0bf0d24d12d5 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c | |||
@@ -790,7 +790,7 @@ static int __init create_log(char *log_name, int size) | |||
790 | if (unlikely(ret)) { | 790 | if (unlikely(ret)) { |
791 | pr_err("failed to register misc device for log '%s'!\n", | 791 | pr_err("failed to register misc device for log '%s'!\n", |
792 | log->misc.name); | 792 | log->misc.name); |
793 | goto out_free_log; | 793 | goto out_free_misc_name; |
794 | } | 794 | } |
795 | 795 | ||
796 | pr_info("created %luK log '%s'\n", | 796 | pr_info("created %luK log '%s'\n", |
@@ -798,6 +798,9 @@ static int __init create_log(char *log_name, int size) | |||
798 | 798 | ||
799 | return 0; | 799 | return 0; |
800 | 800 | ||
801 | out_free_misc_name: | ||
802 | kfree(log->misc.name); | ||
803 | |||
801 | out_free_log: | 804 | out_free_log: |
802 | kfree(log); | 805 | kfree(log); |
803 | 806 | ||
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index e7b2e0234196..69139ce7420d 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c | |||
@@ -199,7 +199,6 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) | |||
199 | fence->num_fences = 1; | 199 | fence->num_fences = 1; |
200 | atomic_set(&fence->status, 1); | 200 | atomic_set(&fence->status, 1); |
201 | 201 | ||
202 | fence_get(&pt->base); | ||
203 | fence->cbs[0].sync_pt = &pt->base; | 202 | fence->cbs[0].sync_pt = &pt->base; |
204 | fence->cbs[0].fence = fence; | 203 | fence->cbs[0].fence = fence; |
205 | if (fence_add_callback(&pt->base, &fence->cbs[0].cb, | 204 | if (fence_add_callback(&pt->base, &fence->cbs[0].cb, |
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 8bf1eb485163..831b7c6fe494 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c | |||
@@ -1421,22 +1421,16 @@ static int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value) | |||
1421 | * @reg: the register to read | 1421 | * @reg: the register to read |
1422 | * @value: 16-bit value to write | 1422 | * @value: 16-bit value to write |
1423 | */ | 1423 | */ |
1424 | static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) | 1424 | static int et131x_mii_write(struct et131x_adapter *adapter, u8 addr, u8 reg, |
1425 | u16 value) | ||
1425 | { | 1426 | { |
1426 | struct mac_regs __iomem *mac = &adapter->regs->mac; | 1427 | struct mac_regs __iomem *mac = &adapter->regs->mac; |
1427 | struct phy_device *phydev = adapter->phydev; | ||
1428 | int status = 0; | 1428 | int status = 0; |
1429 | u8 addr; | ||
1430 | u32 delay = 0; | 1429 | u32 delay = 0; |
1431 | u32 mii_addr; | 1430 | u32 mii_addr; |
1432 | u32 mii_cmd; | 1431 | u32 mii_cmd; |
1433 | u32 mii_indicator; | 1432 | u32 mii_indicator; |
1434 | 1433 | ||
1435 | if (!phydev) | ||
1436 | return -EIO; | ||
1437 | |||
1438 | addr = phydev->addr; | ||
1439 | |||
1440 | /* Save a local copy of the registers we are dealing with so we can | 1434 | /* Save a local copy of the registers we are dealing with so we can |
1441 | * set them back | 1435 | * set them back |
1442 | */ | 1436 | */ |
@@ -1631,17 +1625,7 @@ static int et131x_mdio_write(struct mii_bus *bus, int phy_addr, | |||
1631 | struct net_device *netdev = bus->priv; | 1625 | struct net_device *netdev = bus->priv; |
1632 | struct et131x_adapter *adapter = netdev_priv(netdev); | 1626 | struct et131x_adapter *adapter = netdev_priv(netdev); |
1633 | 1627 | ||
1634 | return et131x_mii_write(adapter, reg, value); | 1628 | return et131x_mii_write(adapter, phy_addr, reg, value); |
1635 | } | ||
1636 | |||
1637 | static int et131x_mdio_reset(struct mii_bus *bus) | ||
1638 | { | ||
1639 | struct net_device *netdev = bus->priv; | ||
1640 | struct et131x_adapter *adapter = netdev_priv(netdev); | ||
1641 | |||
1642 | et131x_mii_write(adapter, MII_BMCR, BMCR_RESET); | ||
1643 | |||
1644 | return 0; | ||
1645 | } | 1629 | } |
1646 | 1630 | ||
1647 | /* et1310_phy_power_switch - PHY power control | 1631 | /* et1310_phy_power_switch - PHY power control |
@@ -1656,18 +1640,20 @@ static int et131x_mdio_reset(struct mii_bus *bus) | |||
1656 | static void et1310_phy_power_switch(struct et131x_adapter *adapter, bool down) | 1640 | static void et1310_phy_power_switch(struct et131x_adapter *adapter, bool down) |
1657 | { | 1641 | { |
1658 | u16 data; | 1642 | u16 data; |
1643 | struct phy_device *phydev = adapter->phydev; | ||
1659 | 1644 | ||
1660 | et131x_mii_read(adapter, MII_BMCR, &data); | 1645 | et131x_mii_read(adapter, MII_BMCR, &data); |
1661 | data &= ~BMCR_PDOWN; | 1646 | data &= ~BMCR_PDOWN; |
1662 | if (down) | 1647 | if (down) |
1663 | data |= BMCR_PDOWN; | 1648 | data |= BMCR_PDOWN; |
1664 | et131x_mii_write(adapter, MII_BMCR, data); | 1649 | et131x_mii_write(adapter, phydev->addr, MII_BMCR, data); |
1665 | } | 1650 | } |
1666 | 1651 | ||
1667 | /* et131x_xcvr_init - Init the phy if we are setting it into force mode */ | 1652 | /* et131x_xcvr_init - Init the phy if we are setting it into force mode */ |
1668 | static void et131x_xcvr_init(struct et131x_adapter *adapter) | 1653 | static void et131x_xcvr_init(struct et131x_adapter *adapter) |
1669 | { | 1654 | { |
1670 | u16 lcr2; | 1655 | u16 lcr2; |
1656 | struct phy_device *phydev = adapter->phydev; | ||
1671 | 1657 | ||
1672 | /* Set the LED behavior such that LED 1 indicates speed (off = | 1658 | /* Set the LED behavior such that LED 1 indicates speed (off = |
1673 | * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates | 1659 | * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates |
@@ -1688,7 +1674,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter) | |||
1688 | else | 1674 | else |
1689 | lcr2 |= (LED_VAL_LINKON << LED_TXRX_SHIFT); | 1675 | lcr2 |= (LED_VAL_LINKON << LED_TXRX_SHIFT); |
1690 | 1676 | ||
1691 | et131x_mii_write(adapter, PHY_LED_2, lcr2); | 1677 | et131x_mii_write(adapter, phydev->addr, PHY_LED_2, lcr2); |
1692 | } | 1678 | } |
1693 | } | 1679 | } |
1694 | 1680 | ||
@@ -3643,14 +3629,14 @@ static void et131x_adjust_link(struct net_device *netdev) | |||
3643 | 3629 | ||
3644 | et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, | 3630 | et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, |
3645 | ®ister18); | 3631 | ®ister18); |
3646 | et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | 3632 | et131x_mii_write(adapter, phydev->addr, |
3647 | register18 | 0x4); | 3633 | PHY_MPHY_CONTROL_REG, register18 | 0x4); |
3648 | et131x_mii_write(adapter, PHY_INDEX_REG, | 3634 | et131x_mii_write(adapter, phydev->addr, PHY_INDEX_REG, |
3649 | register18 | 0x8402); | 3635 | register18 | 0x8402); |
3650 | et131x_mii_write(adapter, PHY_DATA_REG, | 3636 | et131x_mii_write(adapter, phydev->addr, PHY_DATA_REG, |
3651 | register18 | 511); | 3637 | register18 | 511); |
3652 | et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | 3638 | et131x_mii_write(adapter, phydev->addr, |
3653 | register18); | 3639 | PHY_MPHY_CONTROL_REG, register18); |
3654 | } | 3640 | } |
3655 | 3641 | ||
3656 | et1310_config_flow_control(adapter); | 3642 | et1310_config_flow_control(adapter); |
@@ -3662,7 +3648,8 @@ static void et131x_adjust_link(struct net_device *netdev) | |||
3662 | et131x_mii_read(adapter, PHY_CONFIG, ®); | 3648 | et131x_mii_read(adapter, PHY_CONFIG, ®); |
3663 | reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH; | 3649 | reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH; |
3664 | reg |= ET_PHY_CONFIG_FIFO_DEPTH_32; | 3650 | reg |= ET_PHY_CONFIG_FIFO_DEPTH_32; |
3665 | et131x_mii_write(adapter, PHY_CONFIG, reg); | 3651 | et131x_mii_write(adapter, phydev->addr, PHY_CONFIG, |
3652 | reg); | ||
3666 | } | 3653 | } |
3667 | 3654 | ||
3668 | et131x_set_rx_dma_timer(adapter); | 3655 | et131x_set_rx_dma_timer(adapter); |
@@ -3675,14 +3662,14 @@ static void et131x_adjust_link(struct net_device *netdev) | |||
3675 | 3662 | ||
3676 | et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, | 3663 | et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, |
3677 | ®ister18); | 3664 | ®ister18); |
3678 | et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | 3665 | et131x_mii_write(adapter, phydev->addr, |
3679 | register18 | 0x4); | 3666 | PHY_MPHY_CONTROL_REG, register18 | 0x4); |
3680 | et131x_mii_write(adapter, PHY_INDEX_REG, | 3667 | et131x_mii_write(adapter, phydev->addr, |
3681 | register18 | 0x8402); | 3668 | PHY_INDEX_REG, register18 | 0x8402); |
3682 | et131x_mii_write(adapter, PHY_DATA_REG, | 3669 | et131x_mii_write(adapter, phydev->addr, |
3683 | register18 | 511); | 3670 | PHY_DATA_REG, register18 | 511); |
3684 | et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | 3671 | et131x_mii_write(adapter, phydev->addr, |
3685 | register18); | 3672 | PHY_MPHY_CONTROL_REG, register18); |
3686 | } | 3673 | } |
3687 | 3674 | ||
3688 | /* Free the packets being actively sent & stopped */ | 3675 | /* Free the packets being actively sent & stopped */ |
@@ -4644,10 +4631,6 @@ static int et131x_pci_setup(struct pci_dev *pdev, | |||
4644 | /* Copy address into the net_device struct */ | 4631 | /* Copy address into the net_device struct */ |
4645 | memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN); | 4632 | memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN); |
4646 | 4633 | ||
4647 | /* Init variable for counting how long we do not have link status */ | ||
4648 | adapter->boot_coma = 0; | ||
4649 | et1310_disable_phy_coma(adapter); | ||
4650 | |||
4651 | rc = -ENOMEM; | 4634 | rc = -ENOMEM; |
4652 | 4635 | ||
4653 | /* Setup the mii_bus struct */ | 4636 | /* Setup the mii_bus struct */ |
@@ -4663,7 +4646,6 @@ static int et131x_pci_setup(struct pci_dev *pdev, | |||
4663 | adapter->mii_bus->priv = netdev; | 4646 | adapter->mii_bus->priv = netdev; |
4664 | adapter->mii_bus->read = et131x_mdio_read; | 4647 | adapter->mii_bus->read = et131x_mdio_read; |
4665 | adapter->mii_bus->write = et131x_mdio_write; | 4648 | adapter->mii_bus->write = et131x_mdio_write; |
4666 | adapter->mii_bus->reset = et131x_mdio_reset; | ||
4667 | adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), | 4649 | adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), |
4668 | GFP_KERNEL); | 4650 | GFP_KERNEL); |
4669 | if (!adapter->mii_bus->irq) | 4651 | if (!adapter->mii_bus->irq) |
@@ -4687,6 +4669,10 @@ static int et131x_pci_setup(struct pci_dev *pdev, | |||
4687 | /* Setup et1310 as per the documentation */ | 4669 | /* Setup et1310 as per the documentation */ |
4688 | et131x_adapter_setup(adapter); | 4670 | et131x_adapter_setup(adapter); |
4689 | 4671 | ||
4672 | /* Init variable for counting how long we do not have link status */ | ||
4673 | adapter->boot_coma = 0; | ||
4674 | et1310_disable_phy_coma(adapter); | ||
4675 | |||
4690 | /* We can enable interrupts now | 4676 | /* We can enable interrupts now |
4691 | * | 4677 | * |
4692 | * NOTE - Because registration of interrupt handler is done in the | 4678 | * NOTE - Because registration of interrupt handler is done in the |
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c index ea01b8f7a2c3..6f45ce0478d7 100644 --- a/drivers/staging/iio/meter/ade7758_trigger.c +++ b/drivers/staging/iio/meter/ade7758_trigger.c | |||
@@ -85,7 +85,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev) | |||
85 | ret = iio_trigger_register(st->trig); | 85 | ret = iio_trigger_register(st->trig); |
86 | 86 | ||
87 | /* select default trigger */ | 87 | /* select default trigger */ |
88 | indio_dev->trig = st->trig; | 88 | indio_dev->trig = iio_trigger_get(st->trig); |
89 | if (ret) | 89 | if (ret) |
90 | goto error_free_irq; | 90 | goto error_free_irq; |
91 | 91 | ||
diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index 7e3f019d7e72..4662e00b456a 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c | |||
@@ -574,6 +574,9 @@ static void imx_ldb_unbind(struct device *dev, struct device *master, | |||
574 | for (i = 0; i < 2; i++) { | 574 | for (i = 0; i < 2; i++) { |
575 | struct imx_ldb_channel *channel = &imx_ldb->channel[i]; | 575 | struct imx_ldb_channel *channel = &imx_ldb->channel[i]; |
576 | 576 | ||
577 | if (!channel->connector.funcs) | ||
578 | continue; | ||
579 | |||
577 | channel->connector.funcs->destroy(&channel->connector); | 580 | channel->connector.funcs->destroy(&channel->connector); |
578 | channel->encoder.funcs->destroy(&channel->encoder); | 581 | channel->encoder.funcs->destroy(&channel->encoder); |
579 | } | 582 | } |
diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c index 6f393a11f44d..50de10a550e9 100644 --- a/drivers/staging/imx-drm/ipuv3-plane.c +++ b/drivers/staging/imx-drm/ipuv3-plane.c | |||
@@ -281,7 +281,8 @@ static void ipu_plane_dpms(struct ipu_plane *ipu_plane, int mode) | |||
281 | 281 | ||
282 | ipu_idmac_put(ipu_plane->ipu_ch); | 282 | ipu_idmac_put(ipu_plane->ipu_ch); |
283 | ipu_dmfc_put(ipu_plane->dmfc); | 283 | ipu_dmfc_put(ipu_plane->dmfc); |
284 | ipu_dp_put(ipu_plane->dp); | 284 | if (ipu_plane->dp) |
285 | ipu_dp_put(ipu_plane->dp); | ||
285 | } | 286 | } |
286 | } | 287 | } |
287 | 288 | ||
diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index 65629579bd7d..03ab9e046784 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c | |||
@@ -365,6 +365,7 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, | |||
365 | return -ENOMEM; | 365 | return -ENOMEM; |
366 | 366 | ||
367 | strncpy(sched->ws_name, name, CFS_WS_NAME_LEN); | 367 | strncpy(sched->ws_name, name, CFS_WS_NAME_LEN); |
368 | sched->ws_name[CFS_WS_NAME_LEN - 1] = '\0'; | ||
368 | sched->ws_cptab = cptab; | 369 | sched->ws_cptab = cptab; |
369 | sched->ws_cpt = cpt; | 370 | sched->ws_cpt = cpt; |
370 | 371 | ||
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 0367f5a2cfe4..0c59e26c0805 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c | |||
@@ -568,7 +568,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, | |||
568 | if (sb->s_root == NULL) { | 568 | if (sb->s_root == NULL) { |
569 | CERROR("%s: can't make root dentry\n", | 569 | CERROR("%s: can't make root dentry\n", |
570 | ll_get_fsname(sb, NULL, 0)); | 570 | ll_get_fsname(sb, NULL, 0)); |
571 | GOTO(out_root, err = -ENOMEM); | 571 | GOTO(out_lock_cn_cb, err = -ENOMEM); |
572 | } | 572 | } |
573 | 573 | ||
574 | sbi->ll_sdev_orig = sb->s_dev; | 574 | sbi->ll_sdev_orig = sb->s_dev; |
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 8b19f3caa68f..701c6a776524 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #define DEBUG_SUBSYSTEM S_CLASS | 37 | #define DEBUG_SUBSYSTEM S_CLASS |
38 | # include <asm/atomic.h> | 38 | # include <linux/atomic.h> |
39 | 39 | ||
40 | #include "../include/obd_support.h" | 40 | #include "../include/obd_support.h" |
41 | #include "../include/obd_class.h" | 41 | #include "../include/obd_class.h" |
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index b8676ac77b0c..407a318b09db 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
@@ -43,9 +43,11 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
43 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ | 43 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ |
44 | /*=== Customer ID ===*/ | 44 | /*=== Customer ID ===*/ |
45 | /****** 8188EUS ********/ | 45 | /****** 8188EUS ********/ |
46 | {USB_DEVICE(0x056e, 0x4008)}, /* Elecom WDC-150SU2M */ | ||
46 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ | 47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
47 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
48 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | 49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ |
50 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ | ||
49 | {} /* Terminating entry */ | 51 | {} /* Terminating entry */ |
50 | }; | 52 | }; |
51 | 53 | ||
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index f105c2ac091b..164136b07a68 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c | |||
@@ -350,6 +350,9 @@ static int hostap_set_generic_element(PSDevice pDevice, | |||
350 | { | 350 | { |
351 | PSMgmtObject pMgmt = pDevice->pMgmt; | 351 | PSMgmtObject pMgmt = pDevice->pMgmt; |
352 | 352 | ||
353 | if (param->u.generic_elem.len > sizeof(pMgmt->abyWPAIE)) | ||
354 | return -EINVAL; | ||
355 | |||
353 | memcpy(pMgmt->abyWPAIE, | 356 | memcpy(pMgmt->abyWPAIE, |
354 | param->u.generic_elem.data, | 357 | param->u.generic_elem.data, |
355 | param->u.generic_elem.len | 358 | param->u.generic_elem.len |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 1f4c794f5fcc..260c3e1e312c 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid( | |||
4540 | { | 4540 | { |
4541 | struct iscsi_conn *l_conn; | 4541 | struct iscsi_conn *l_conn; |
4542 | struct iscsi_session *sess = conn->sess; | 4542 | struct iscsi_session *sess = conn->sess; |
4543 | bool conn_found = false; | ||
4543 | 4544 | ||
4544 | if (!sess) | 4545 | if (!sess) |
4545 | return; | 4546 | return; |
@@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid( | |||
4548 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { | 4549 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { |
4549 | if (l_conn->cid == cid) { | 4550 | if (l_conn->cid == cid) { |
4550 | iscsit_inc_conn_usage_count(l_conn); | 4551 | iscsit_inc_conn_usage_count(l_conn); |
4552 | conn_found = true; | ||
4551 | break; | 4553 | break; |
4552 | } | 4554 | } |
4553 | } | 4555 | } |
4554 | spin_unlock_bh(&sess->conn_lock); | 4556 | spin_unlock_bh(&sess->conn_lock); |
4555 | 4557 | ||
4556 | if (!l_conn) | 4558 | if (!conn_found) |
4557 | return; | 4559 | return; |
4558 | 4560 | ||
4559 | if (l_conn->sock) | 4561 | if (l_conn->sock) |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 02f9de26f38a..18c29260b4a2 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
@@ -601,7 +601,7 @@ int iscsi_copy_param_list( | |||
601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); | 601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); |
602 | if (!param_list) { | 602 | if (!param_list) { |
603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); | 603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); |
604 | goto err_out; | 604 | return -1; |
605 | } | 605 | } |
606 | INIT_LIST_HEAD(¶m_list->param_list); | 606 | INIT_LIST_HEAD(¶m_list->param_list); |
607 | INIT_LIST_HEAD(¶m_list->extra_response_list); | 607 | INIT_LIST_HEAD(¶m_list->extra_response_list); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index fd90b28f1d94..73355f4fca74 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -400,6 +400,8 @@ struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump( | |||
400 | 400 | ||
401 | spin_lock_bh(&conn->cmd_lock); | 401 | spin_lock_bh(&conn->cmd_lock); |
402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { | 402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { |
403 | if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) | ||
404 | continue; | ||
403 | if (cmd->init_task_tag == init_task_tag) { | 405 | if (cmd->init_task_tag == init_task_tag) { |
404 | spin_unlock_bh(&conn->cmd_lock); | 406 | spin_unlock_bh(&conn->cmd_lock); |
405 | return cmd; | 407 | return cmd; |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index bf55c5a04cfa..756def38c77a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -2363,7 +2363,7 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\ | |||
2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ | 2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ |
2364 | return -EINVAL; \ | 2364 | return -EINVAL; \ |
2365 | } \ | 2365 | } \ |
2366 | if (!tmp) \ | 2366 | if (tmp) \ |
2367 | t->_var |= _bit; \ | 2367 | t->_var |= _bit; \ |
2368 | else \ | 2368 | else \ |
2369 | t->_var &= ~_bit; \ | 2369 | t->_var &= ~_bit; \ |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 6cd7222738fc..bc286a67af7c 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -664,7 +664,7 @@ spc_emulate_evpd_b3(struct se_cmd *cmd, unsigned char *buf) | |||
664 | buf[0] = dev->transport->get_device_type(dev); | 664 | buf[0] = dev->transport->get_device_type(dev); |
665 | buf[3] = 0x0c; | 665 | buf[3] = 0x0c; |
666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); | 666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); |
667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[12]); | 667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_multiplier, &buf[12]); |
668 | 668 | ||
669 | return 0; | 669 | return 0; |
670 | } | 670 | } |
diff --git a/drivers/thunderbolt/path.c b/drivers/thunderbolt/path.c index 8fcf8a7b6c22..9562cd026dc0 100644 --- a/drivers/thunderbolt/path.c +++ b/drivers/thunderbolt/path.c | |||
@@ -150,7 +150,26 @@ int tb_path_activate(struct tb_path *path) | |||
150 | 150 | ||
151 | /* Activate hops. */ | 151 | /* Activate hops. */ |
152 | for (i = path->path_length - 1; i >= 0; i--) { | 152 | for (i = path->path_length - 1; i >= 0; i--) { |
153 | struct tb_regs_hop hop; | 153 | struct tb_regs_hop hop = { 0 }; |
154 | |||
155 | /* | ||
156 | * We do (currently) not tear down paths setup by the firmeware. | ||
157 | * If a firmware device is unplugged and plugged in again then | ||
158 | * it can happen that we reuse some of the hops from the (now | ||
159 | * defunct) firmeware path. This causes the hotplug operation to | ||
160 | * fail (the pci device does not show up). Clearing the hop | ||
161 | * before overwriting it fixes the problem. | ||
162 | * | ||
163 | * Should be removed once we discover and tear down firmeware | ||
164 | * paths. | ||
165 | */ | ||
166 | res = tb_port_write(path->hops[i].in_port, &hop, TB_CFG_HOPS, | ||
167 | 2 * path->hops[i].in_hop_index, 2); | ||
168 | if (res) { | ||
169 | __tb_path_deactivate_hops(path, i); | ||
170 | __tb_path_deallocate_nfc(path, 0); | ||
171 | goto err; | ||
172 | } | ||
154 | 173 | ||
155 | /* dword 0 */ | 174 | /* dword 0 */ |
156 | hop.next_hop = path->hops[i].next_hop_index; | 175 | hop.next_hop = path->hops[i].next_hop_index; |
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 4db7987ec225..57d9df84ce5d 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
@@ -540,6 +540,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = { | |||
540 | { "INT3434", 0 }, | 540 | { "INT3434", 0 }, |
541 | { "INT3435", 0 }, | 541 | { "INT3435", 0 }, |
542 | { "80860F0A", 0 }, | 542 | { "80860F0A", 0 }, |
543 | { "8086228A", 0 }, | ||
543 | { }, | 544 | { }, |
544 | }; | 545 | }; |
545 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); | 546 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 7b63677475c1..d7d4584549a5 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -527,6 +527,45 @@ static void atmel_enable_ms(struct uart_port *port) | |||
527 | } | 527 | } |
528 | 528 | ||
529 | /* | 529 | /* |
530 | * Disable modem status interrupts | ||
531 | */ | ||
532 | static void atmel_disable_ms(struct uart_port *port) | ||
533 | { | ||
534 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | ||
535 | uint32_t idr = 0; | ||
536 | |||
537 | /* | ||
538 | * Interrupt should not be disabled twice | ||
539 | */ | ||
540 | if (!atmel_port->ms_irq_enabled) | ||
541 | return; | ||
542 | |||
543 | atmel_port->ms_irq_enabled = false; | ||
544 | |||
545 | if (atmel_port->gpio_irq[UART_GPIO_CTS] >= 0) | ||
546 | disable_irq(atmel_port->gpio_irq[UART_GPIO_CTS]); | ||
547 | else | ||
548 | idr |= ATMEL_US_CTSIC; | ||
549 | |||
550 | if (atmel_port->gpio_irq[UART_GPIO_DSR] >= 0) | ||
551 | disable_irq(atmel_port->gpio_irq[UART_GPIO_DSR]); | ||
552 | else | ||
553 | idr |= ATMEL_US_DSRIC; | ||
554 | |||
555 | if (atmel_port->gpio_irq[UART_GPIO_RI] >= 0) | ||
556 | disable_irq(atmel_port->gpio_irq[UART_GPIO_RI]); | ||
557 | else | ||
558 | idr |= ATMEL_US_RIIC; | ||
559 | |||
560 | if (atmel_port->gpio_irq[UART_GPIO_DCD] >= 0) | ||
561 | disable_irq(atmel_port->gpio_irq[UART_GPIO_DCD]); | ||
562 | else | ||
563 | idr |= ATMEL_US_DCDIC; | ||
564 | |||
565 | UART_PUT_IDR(port, idr); | ||
566 | } | ||
567 | |||
568 | /* | ||
530 | * Control the transmission of a break signal | 569 | * Control the transmission of a break signal |
531 | */ | 570 | */ |
532 | static void atmel_break_ctl(struct uart_port *port, int break_state) | 571 | static void atmel_break_ctl(struct uart_port *port, int break_state) |
@@ -1993,7 +2032,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1993 | 2032 | ||
1994 | /* CTS flow-control and modem-status interrupts */ | 2033 | /* CTS flow-control and modem-status interrupts */ |
1995 | if (UART_ENABLE_MS(port, termios->c_cflag)) | 2034 | if (UART_ENABLE_MS(port, termios->c_cflag)) |
1996 | port->ops->enable_ms(port); | 2035 | atmel_enable_ms(port); |
2036 | else | ||
2037 | atmel_disable_ms(port); | ||
1997 | 2038 | ||
1998 | spin_unlock_irqrestore(&port->lock, flags); | 2039 | spin_unlock_irqrestore(&port->lock, flags); |
1999 | } | 2040 | } |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 01951d27cc03..806e4bcadbd7 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -581,7 +581,7 @@ static unsigned int cdns_uart_tx_empty(struct uart_port *port) | |||
581 | { | 581 | { |
582 | unsigned int status; | 582 | unsigned int status; |
583 | 583 | ||
584 | status = cdns_uart_readl(CDNS_UART_ISR_OFFSET) & CDNS_UART_IXR_TXEMPTY; | 584 | status = cdns_uart_readl(CDNS_UART_SR_OFFSET) & CDNS_UART_SR_TXEMPTY; |
585 | return status ? TIOCSER_TEMT : 0; | 585 | return status ? TIOCSER_TEMT : 0; |
586 | } | 586 | } |
587 | 587 | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index e0cad4418085..cf1b19bca306 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -92,6 +92,8 @@ source "drivers/usb/storage/Kconfig" | |||
92 | 92 | ||
93 | source "drivers/usb/image/Kconfig" | 93 | source "drivers/usb/image/Kconfig" |
94 | 94 | ||
95 | source "drivers/usb/usbip/Kconfig" | ||
96 | |||
95 | endif | 97 | endif |
96 | 98 | ||
97 | source "drivers/usb/musb/Kconfig" | 99 | source "drivers/usb/musb/Kconfig" |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index 3cba892b83a2..d7be71778059 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -60,3 +60,5 @@ obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/ | |||
60 | obj-$(CONFIG_USB_GADGET) += gadget/ | 60 | obj-$(CONFIG_USB_GADGET) += gadget/ |
61 | 61 | ||
62 | obj-$(CONFIG_USB_COMMON) += common/ | 62 | obj-$(CONFIG_USB_COMMON) += common/ |
63 | |||
64 | obj-$(CONFIG_USBIP_CORE) += usbip/ | ||
diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index d72b9d2de2c5..4935ac38fd00 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c | |||
@@ -20,13 +20,13 @@ | |||
20 | static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) | 20 | static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) |
21 | { | 21 | { |
22 | struct device *dev = ci->gadget.dev.parent; | 22 | struct device *dev = ci->gadget.dev.parent; |
23 | int val; | ||
24 | 23 | ||
25 | switch (event) { | 24 | switch (event) { |
26 | case CI_HDRC_CONTROLLER_RESET_EVENT: | 25 | case CI_HDRC_CONTROLLER_RESET_EVENT: |
27 | dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); | 26 | dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); |
28 | writel(0, USB_AHBBURST); | 27 | writel(0, USB_AHBBURST); |
29 | writel(0, USB_AHBMODE); | 28 | writel(0, USB_AHBMODE); |
29 | usb_phy_init(ci->transceiver); | ||
30 | break; | 30 | break; |
31 | case CI_HDRC_CONTROLLER_STOPPED_EVENT: | 31 | case CI_HDRC_CONTROLLER_STOPPED_EVENT: |
32 | dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); | 32 | dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); |
@@ -34,10 +34,7 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) | |||
34 | * Put the transceiver in non-driving mode. Otherwise host | 34 | * Put the transceiver in non-driving mode. Otherwise host |
35 | * may not detect soft-disconnection. | 35 | * may not detect soft-disconnection. |
36 | */ | 36 | */ |
37 | val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); | 37 | usb_phy_notify_disconnect(ci->transceiver, USB_SPEED_UNKNOWN); |
38 | val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | ||
39 | val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | ||
40 | usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); | ||
41 | break; | 38 | break; |
42 | default: | 39 | default: |
43 | dev_dbg(dev, "unknown ci_hdrc event\n"); | 40 | dev_dbg(dev, "unknown ci_hdrc event\n"); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 8a4dcbc7a75f..d481c99a20d7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1728,8 +1728,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1728 | * - Change autosuspend delay of hub can avoid unnecessary auto | 1728 | * - Change autosuspend delay of hub can avoid unnecessary auto |
1729 | * suspend timer for hub, also may decrease power consumption | 1729 | * suspend timer for hub, also may decrease power consumption |
1730 | * of USB bus. | 1730 | * of USB bus. |
1731 | * | ||
1732 | * - If user has indicated to prevent autosuspend by passing | ||
1733 | * usbcore.autosuspend = -1 then keep autosuspend disabled. | ||
1731 | */ | 1734 | */ |
1732 | pm_runtime_set_autosuspend_delay(&hdev->dev, 0); | 1735 | #ifdef CONFIG_PM_RUNTIME |
1736 | if (hdev->dev.power.autosuspend_delay >= 0) | ||
1737 | pm_runtime_set_autosuspend_delay(&hdev->dev, 0); | ||
1738 | #endif | ||
1733 | 1739 | ||
1734 | /* | 1740 | /* |
1735 | * Hubs have proper suspend/resume support, except for root hubs | 1741 | * Hubs have proper suspend/resume support, except for root hubs |
@@ -2107,8 +2113,8 @@ void usb_disconnect(struct usb_device **pdev) | |||
2107 | { | 2113 | { |
2108 | struct usb_port *port_dev = NULL; | 2114 | struct usb_port *port_dev = NULL; |
2109 | struct usb_device *udev = *pdev; | 2115 | struct usb_device *udev = *pdev; |
2110 | struct usb_hub *hub; | 2116 | struct usb_hub *hub = NULL; |
2111 | int port1; | 2117 | int port1 = 1; |
2112 | 2118 | ||
2113 | /* mark the device as inactive, so any further urb submissions for | 2119 | /* mark the device as inactive, so any further urb submissions for |
2114 | * this device (and any of its children) will fail immediately. | 2120 | * this device (and any of its children) will fail immediately. |
@@ -4631,9 +4637,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, | |||
4631 | if (status != -ENODEV && | 4637 | if (status != -ENODEV && |
4632 | port1 != unreliable_port && | 4638 | port1 != unreliable_port && |
4633 | printk_ratelimit()) | 4639 | printk_ratelimit()) |
4634 | dev_err(&udev->dev, "connect-debounce failed, port %d disabled\n", | 4640 | dev_err(&port_dev->dev, "connect-debounce failed\n"); |
4635 | port1); | ||
4636 | |||
4637 | portstatus &= ~USB_PORT_STAT_CONNECTION; | 4641 | portstatus &= ~USB_PORT_STAT_CONNECTION; |
4638 | unreliable_port = port1; | 4642 | unreliable_port = port1; |
4639 | } else { | 4643 | } else { |
@@ -5020,9 +5024,10 @@ static void hub_events(void) | |||
5020 | 5024 | ||
5021 | hub = list_entry(tmp, struct usb_hub, event_list); | 5025 | hub = list_entry(tmp, struct usb_hub, event_list); |
5022 | kref_get(&hub->kref); | 5026 | kref_get(&hub->kref); |
5027 | hdev = hub->hdev; | ||
5028 | usb_get_dev(hdev); | ||
5023 | spin_unlock_irq(&hub_event_lock); | 5029 | spin_unlock_irq(&hub_event_lock); |
5024 | 5030 | ||
5025 | hdev = hub->hdev; | ||
5026 | hub_dev = hub->intfdev; | 5031 | hub_dev = hub->intfdev; |
5027 | intf = to_usb_interface(hub_dev); | 5032 | intf = to_usb_interface(hub_dev); |
5028 | dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", | 5033 | dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", |
@@ -5135,6 +5140,7 @@ static void hub_events(void) | |||
5135 | usb_autopm_put_interface(intf); | 5140 | usb_autopm_put_interface(intf); |
5136 | loop_disconnected: | 5141 | loop_disconnected: |
5137 | usb_unlock_device(hdev); | 5142 | usb_unlock_device(hdev); |
5143 | usb_put_dev(hdev); | ||
5138 | kref_put(&hub->kref, hub_release); | 5144 | kref_put(&hub->kref, hub_release); |
5139 | 5145 | ||
5140 | } /* end while (1) */ | 5146 | } /* end while (1) */ |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 0ba9c335b584..ce6071d65d51 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -1649,6 +1649,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx) | |||
1649 | dev_err(hsotg->dev, | 1649 | dev_err(hsotg->dev, |
1650 | "%s: timeout flushing fifo (GRSTCTL=%08x)\n", | 1650 | "%s: timeout flushing fifo (GRSTCTL=%08x)\n", |
1651 | __func__, val); | 1651 | __func__, val); |
1652 | break; | ||
1652 | } | 1653 | } |
1653 | 1654 | ||
1654 | udelay(1); | 1655 | udelay(1); |
@@ -1901,7 +1902,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, | |||
1901 | static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) | 1902 | static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) |
1902 | { | 1903 | { |
1903 | u32 dsts = readl(hsotg->regs + DSTS); | 1904 | u32 dsts = readl(hsotg->regs + DSTS); |
1904 | int ep0_mps = 0, ep_mps; | 1905 | int ep0_mps = 0, ep_mps = 8; |
1905 | 1906 | ||
1906 | /* | 1907 | /* |
1907 | * This should signal the finish of the enumeration phase | 1908 | * This should signal the finish of the enumeration phase |
@@ -2747,13 +2748,14 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) | |||
2747 | 2748 | ||
2748 | dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); | 2749 | dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); |
2749 | 2750 | ||
2750 | if (hsotg->phy) { | 2751 | if (hsotg->uphy) |
2751 | phy_init(hsotg->phy); | ||
2752 | phy_power_on(hsotg->phy); | ||
2753 | } else if (hsotg->uphy) | ||
2754 | usb_phy_init(hsotg->uphy); | 2752 | usb_phy_init(hsotg->uphy); |
2755 | else if (hsotg->plat->phy_init) | 2753 | else if (hsotg->plat && hsotg->plat->phy_init) |
2756 | hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); | 2754 | hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); |
2755 | else { | ||
2756 | phy_init(hsotg->phy); | ||
2757 | phy_power_on(hsotg->phy); | ||
2758 | } | ||
2757 | } | 2759 | } |
2758 | 2760 | ||
2759 | /** | 2761 | /** |
@@ -2767,13 +2769,14 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) | |||
2767 | { | 2769 | { |
2768 | struct platform_device *pdev = to_platform_device(hsotg->dev); | 2770 | struct platform_device *pdev = to_platform_device(hsotg->dev); |
2769 | 2771 | ||
2770 | if (hsotg->phy) { | 2772 | if (hsotg->uphy) |
2771 | phy_power_off(hsotg->phy); | ||
2772 | phy_exit(hsotg->phy); | ||
2773 | } else if (hsotg->uphy) | ||
2774 | usb_phy_shutdown(hsotg->uphy); | 2773 | usb_phy_shutdown(hsotg->uphy); |
2775 | else if (hsotg->plat->phy_exit) | 2774 | else if (hsotg->plat && hsotg->plat->phy_exit) |
2776 | hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); | 2775 | hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); |
2776 | else { | ||
2777 | phy_power_off(hsotg->phy); | ||
2778 | phy_exit(hsotg->phy); | ||
2779 | } | ||
2777 | } | 2780 | } |
2778 | 2781 | ||
2779 | /** | 2782 | /** |
@@ -2892,13 +2895,11 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
2892 | return -ENODEV; | 2895 | return -ENODEV; |
2893 | 2896 | ||
2894 | /* all endpoints should be shutdown */ | 2897 | /* all endpoints should be shutdown */ |
2895 | for (ep = 0; ep < hsotg->num_of_eps; ep++) | 2898 | for (ep = 1; ep < hsotg->num_of_eps; ep++) |
2896 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | 2899 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); |
2897 | 2900 | ||
2898 | spin_lock_irqsave(&hsotg->lock, flags); | 2901 | spin_lock_irqsave(&hsotg->lock, flags); |
2899 | 2902 | ||
2900 | s3c_hsotg_phy_disable(hsotg); | ||
2901 | |||
2902 | if (!driver) | 2903 | if (!driver) |
2903 | hsotg->driver = NULL; | 2904 | hsotg->driver = NULL; |
2904 | 2905 | ||
@@ -2941,7 +2942,6 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) | |||
2941 | s3c_hsotg_phy_enable(hsotg); | 2942 | s3c_hsotg_phy_enable(hsotg); |
2942 | s3c_hsotg_core_init(hsotg); | 2943 | s3c_hsotg_core_init(hsotg); |
2943 | } else { | 2944 | } else { |
2944 | s3c_hsotg_disconnect(hsotg); | ||
2945 | s3c_hsotg_phy_disable(hsotg); | 2945 | s3c_hsotg_phy_disable(hsotg); |
2946 | } | 2946 | } |
2947 | 2947 | ||
@@ -3441,13 +3441,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3441 | 3441 | ||
3442 | hsotg->irq = ret; | 3442 | hsotg->irq = ret; |
3443 | 3443 | ||
3444 | ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, | ||
3445 | dev_name(dev), hsotg); | ||
3446 | if (ret < 0) { | ||
3447 | dev_err(dev, "cannot claim IRQ\n"); | ||
3448 | goto err_clk; | ||
3449 | } | ||
3450 | |||
3451 | dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); | 3444 | dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); |
3452 | 3445 | ||
3453 | hsotg->gadget.max_speed = USB_SPEED_HIGH; | 3446 | hsotg->gadget.max_speed = USB_SPEED_HIGH; |
@@ -3488,9 +3481,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3488 | if (hsotg->phy && (phy_get_bus_width(phy) == 8)) | 3481 | if (hsotg->phy && (phy_get_bus_width(phy) == 8)) |
3489 | hsotg->phyif = GUSBCFG_PHYIF8; | 3482 | hsotg->phyif = GUSBCFG_PHYIF8; |
3490 | 3483 | ||
3491 | if (hsotg->phy) | ||
3492 | phy_init(hsotg->phy); | ||
3493 | |||
3494 | /* usb phy enable */ | 3484 | /* usb phy enable */ |
3495 | s3c_hsotg_phy_enable(hsotg); | 3485 | s3c_hsotg_phy_enable(hsotg); |
3496 | 3486 | ||
@@ -3498,6 +3488,17 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3498 | s3c_hsotg_init(hsotg); | 3488 | s3c_hsotg_init(hsotg); |
3499 | s3c_hsotg_hw_cfg(hsotg); | 3489 | s3c_hsotg_hw_cfg(hsotg); |
3500 | 3490 | ||
3491 | ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, | ||
3492 | dev_name(dev), hsotg); | ||
3493 | if (ret < 0) { | ||
3494 | s3c_hsotg_phy_disable(hsotg); | ||
3495 | clk_disable_unprepare(hsotg->clk); | ||
3496 | regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), | ||
3497 | hsotg->supplies); | ||
3498 | dev_err(dev, "cannot claim IRQ\n"); | ||
3499 | goto err_clk; | ||
3500 | } | ||
3501 | |||
3501 | /* hsotg->num_of_eps holds number of EPs other than ep0 */ | 3502 | /* hsotg->num_of_eps holds number of EPs other than ep0 */ |
3502 | 3503 | ||
3503 | if (hsotg->num_of_eps == 0) { | 3504 | if (hsotg->num_of_eps == 0) { |
@@ -3582,9 +3583,6 @@ static int s3c_hsotg_remove(struct platform_device *pdev) | |||
3582 | usb_gadget_unregister_driver(hsotg->driver); | 3583 | usb_gadget_unregister_driver(hsotg->driver); |
3583 | } | 3584 | } |
3584 | 3585 | ||
3585 | s3c_hsotg_phy_disable(hsotg); | ||
3586 | if (hsotg->phy) | ||
3587 | phy_exit(hsotg->phy); | ||
3588 | clk_disable_unprepare(hsotg->clk); | 3586 | clk_disable_unprepare(hsotg->clk); |
3589 | 3587 | ||
3590 | return 0; | 3588 | return 0; |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b769c1faaf03..9069984fe5cf 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -799,20 +799,21 @@ static int dwc3_remove(struct platform_device *pdev) | |||
799 | { | 799 | { |
800 | struct dwc3 *dwc = platform_get_drvdata(pdev); | 800 | struct dwc3 *dwc = platform_get_drvdata(pdev); |
801 | 801 | ||
802 | dwc3_debugfs_exit(dwc); | ||
803 | dwc3_core_exit_mode(dwc); | ||
804 | dwc3_event_buffers_cleanup(dwc); | ||
805 | dwc3_free_event_buffers(dwc); | ||
806 | |||
802 | usb_phy_set_suspend(dwc->usb2_phy, 1); | 807 | usb_phy_set_suspend(dwc->usb2_phy, 1); |
803 | usb_phy_set_suspend(dwc->usb3_phy, 1); | 808 | usb_phy_set_suspend(dwc->usb3_phy, 1); |
804 | phy_power_off(dwc->usb2_generic_phy); | 809 | phy_power_off(dwc->usb2_generic_phy); |
805 | phy_power_off(dwc->usb3_generic_phy); | 810 | phy_power_off(dwc->usb3_generic_phy); |
806 | 811 | ||
812 | dwc3_core_exit(dwc); | ||
813 | |||
807 | pm_runtime_put_sync(&pdev->dev); | 814 | pm_runtime_put_sync(&pdev->dev); |
808 | pm_runtime_disable(&pdev->dev); | 815 | pm_runtime_disable(&pdev->dev); |
809 | 816 | ||
810 | dwc3_debugfs_exit(dwc); | ||
811 | dwc3_core_exit_mode(dwc); | ||
812 | dwc3_event_buffers_cleanup(dwc); | ||
813 | dwc3_free_event_buffers(dwc); | ||
814 | dwc3_core_exit(dwc); | ||
815 | |||
816 | return 0; | 817 | return 0; |
817 | } | 818 | } |
818 | 819 | ||
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index ef4936ff626c..fc0de3753648 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -425,7 +425,7 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) | |||
425 | 425 | ||
426 | static int dwc3_omap_extcon_register(struct dwc3_omap *omap) | 426 | static int dwc3_omap_extcon_register(struct dwc3_omap *omap) |
427 | { | 427 | { |
428 | u32 ret; | 428 | int ret; |
429 | struct device_node *node = omap->dev->of_node; | 429 | struct device_node *node = omap->dev->of_node; |
430 | struct extcon_dev *edev; | 430 | struct extcon_dev *edev; |
431 | 431 | ||
@@ -576,9 +576,9 @@ static int dwc3_omap_remove(struct platform_device *pdev) | |||
576 | if (omap->extcon_id_dev.edev) | 576 | if (omap->extcon_id_dev.edev) |
577 | extcon_unregister_interest(&omap->extcon_id_dev); | 577 | extcon_unregister_interest(&omap->extcon_id_dev); |
578 | dwc3_omap_disable_irqs(omap); | 578 | dwc3_omap_disable_irqs(omap); |
579 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); | ||
579 | pm_runtime_put_sync(&pdev->dev); | 580 | pm_runtime_put_sync(&pdev->dev); |
580 | pm_runtime_disable(&pdev->dev); | 581 | pm_runtime_disable(&pdev->dev); |
581 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); | ||
582 | 582 | ||
583 | return 0; | 583 | return 0; |
584 | } | 584 | } |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 349cacc577d8..490a6ca00733 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -527,7 +527,7 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, | |||
527 | dep->stream_capable = true; | 527 | dep->stream_capable = true; |
528 | } | 528 | } |
529 | 529 | ||
530 | if (usb_endpoint_xfer_isoc(desc)) | 530 | if (!usb_endpoint_xfer_control(desc)) |
531 | params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN; | 531 | params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN; |
532 | 532 | ||
533 | /* | 533 | /* |
@@ -1225,16 +1225,17 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, | |||
1225 | 1225 | ||
1226 | int ret; | 1226 | int ret; |
1227 | 1227 | ||
1228 | spin_lock_irqsave(&dwc->lock, flags); | ||
1228 | if (!dep->endpoint.desc) { | 1229 | if (!dep->endpoint.desc) { |
1229 | dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", | 1230 | dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", |
1230 | request, ep->name); | 1231 | request, ep->name); |
1232 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
1231 | return -ESHUTDOWN; | 1233 | return -ESHUTDOWN; |
1232 | } | 1234 | } |
1233 | 1235 | ||
1234 | dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", | 1236 | dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", |
1235 | request, ep->name, request->length); | 1237 | request, ep->name, request->length); |
1236 | 1238 | ||
1237 | spin_lock_irqsave(&dwc->lock, flags); | ||
1238 | ret = __dwc3_gadget_ep_queue(dep, req); | 1239 | ret = __dwc3_gadget_ep_queue(dep, req); |
1239 | spin_unlock_irqrestore(&dwc->lock, flags); | 1240 | spin_unlock_irqrestore(&dwc->lock, flags); |
1240 | 1241 | ||
@@ -2041,12 +2042,6 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, | |||
2041 | dwc3_endpoint_transfer_complete(dwc, dep, event); | 2042 | dwc3_endpoint_transfer_complete(dwc, dep, event); |
2042 | break; | 2043 | break; |
2043 | case DWC3_DEPEVT_XFERINPROGRESS: | 2044 | case DWC3_DEPEVT_XFERINPROGRESS: |
2044 | if (!usb_endpoint_xfer_isoc(dep->endpoint.desc)) { | ||
2045 | dev_dbg(dwc->dev, "%s is not an Isochronous endpoint\n", | ||
2046 | dep->name); | ||
2047 | return; | ||
2048 | } | ||
2049 | |||
2050 | dwc3_endpoint_transfer_complete(dwc, dep, event); | 2045 | dwc3_endpoint_transfer_complete(dwc, dep, event); |
2051 | break; | 2046 | break; |
2052 | case DWC3_DEPEVT_XFERNOTREADY: | 2047 | case DWC3_DEPEVT_XFERNOTREADY: |
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index a186afeaa700..9add915d41f7 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | subdir-ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG | 4 | subdir-ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG |
5 | subdir-ccflags-$(CONFIG_USB_GADGET_VERBOSE) += -DVERBOSE_DEBUG | 5 | subdir-ccflags-$(CONFIG_USB_GADGET_VERBOSE) += -DVERBOSE_DEBUG |
6 | ccflags-y += -I$(PWD)/drivers/usb/gadget/udc | 6 | ccflags-y += -Idrivers/usb/gadget/udc |
7 | 7 | ||
8 | obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o | 8 | obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o |
9 | libcomposite-y := usbstring.o config.o epautoconf.o | 9 | libcomposite-y := usbstring.o config.o epautoconf.o |
diff --git a/drivers/usb/gadget/function/Makefile b/drivers/usb/gadget/function/Makefile index 6d91f21b52a6..83ae1065149d 100644 --- a/drivers/usb/gadget/function/Makefile +++ b/drivers/usb/gadget/function/Makefile | |||
@@ -2,8 +2,8 @@ | |||
2 | # USB peripheral controller drivers | 2 | # USB peripheral controller drivers |
3 | # | 3 | # |
4 | 4 | ||
5 | ccflags-y := -I$(PWD)/drivers/usb/gadget/ | 5 | ccflags-y := -Idrivers/usb/gadget/ |
6 | ccflags-y += -I$(PWD)/drivers/usb/gadget/udc/ | 6 | ccflags-y += -Idrivers/usb/gadget/udc/ |
7 | 7 | ||
8 | # USB Functions | 8 | # USB Functions |
9 | usb_f_acm-y := f_acm.o | 9 | usb_f_acm-y := f_acm.o |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index dc30adf15a01..0dc3552d1360 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -155,6 +155,12 @@ struct ffs_io_data { | |||
155 | struct usb_request *req; | 155 | struct usb_request *req; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | struct ffs_desc_helper { | ||
159 | struct ffs_data *ffs; | ||
160 | unsigned interfaces_count; | ||
161 | unsigned eps_count; | ||
162 | }; | ||
163 | |||
158 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); | 164 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); |
159 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); | 165 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); |
160 | 166 | ||
@@ -1830,7 +1836,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1830 | u8 *valuep, struct usb_descriptor_header *desc, | 1836 | u8 *valuep, struct usb_descriptor_header *desc, |
1831 | void *priv) | 1837 | void *priv) |
1832 | { | 1838 | { |
1833 | struct ffs_data *ffs = priv; | 1839 | struct ffs_desc_helper *helper = priv; |
1840 | struct usb_endpoint_descriptor *d; | ||
1834 | 1841 | ||
1835 | ENTER(); | 1842 | ENTER(); |
1836 | 1843 | ||
@@ -1844,8 +1851,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1844 | * encountered interface "n" then there are at least | 1851 | * encountered interface "n" then there are at least |
1845 | * "n+1" interfaces. | 1852 | * "n+1" interfaces. |
1846 | */ | 1853 | */ |
1847 | if (*valuep >= ffs->interfaces_count) | 1854 | if (*valuep >= helper->interfaces_count) |
1848 | ffs->interfaces_count = *valuep + 1; | 1855 | helper->interfaces_count = *valuep + 1; |
1849 | break; | 1856 | break; |
1850 | 1857 | ||
1851 | case FFS_STRING: | 1858 | case FFS_STRING: |
@@ -1853,14 +1860,22 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1853 | * Strings are indexed from 1 (0 is magic ;) reserved | 1860 | * Strings are indexed from 1 (0 is magic ;) reserved |
1854 | * for languages list or some such) | 1861 | * for languages list or some such) |
1855 | */ | 1862 | */ |
1856 | if (*valuep > ffs->strings_count) | 1863 | if (*valuep > helper->ffs->strings_count) |
1857 | ffs->strings_count = *valuep; | 1864 | helper->ffs->strings_count = *valuep; |
1858 | break; | 1865 | break; |
1859 | 1866 | ||
1860 | case FFS_ENDPOINT: | 1867 | case FFS_ENDPOINT: |
1861 | /* Endpoints are indexed from 1 as well. */ | 1868 | d = (void *)desc; |
1862 | if ((*valuep & USB_ENDPOINT_NUMBER_MASK) > ffs->eps_count) | 1869 | helper->eps_count++; |
1863 | ffs->eps_count = (*valuep & USB_ENDPOINT_NUMBER_MASK); | 1870 | if (helper->eps_count >= 15) |
1871 | return -EINVAL; | ||
1872 | /* Check if descriptors for any speed were already parsed */ | ||
1873 | if (!helper->ffs->eps_count && !helper->ffs->interfaces_count) | ||
1874 | helper->ffs->eps_addrmap[helper->eps_count] = | ||
1875 | d->bEndpointAddress; | ||
1876 | else if (helper->ffs->eps_addrmap[helper->eps_count] != | ||
1877 | d->bEndpointAddress) | ||
1878 | return -EINVAL; | ||
1864 | break; | 1879 | break; |
1865 | } | 1880 | } |
1866 | 1881 | ||
@@ -2053,6 +2068,7 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | |||
2053 | char *data = _data, *raw_descs; | 2068 | char *data = _data, *raw_descs; |
2054 | unsigned os_descs_count = 0, counts[3], flags; | 2069 | unsigned os_descs_count = 0, counts[3], flags; |
2055 | int ret = -EINVAL, i; | 2070 | int ret = -EINVAL, i; |
2071 | struct ffs_desc_helper helper; | ||
2056 | 2072 | ||
2057 | ENTER(); | 2073 | ENTER(); |
2058 | 2074 | ||
@@ -2101,13 +2117,29 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | |||
2101 | 2117 | ||
2102 | /* Read descriptors */ | 2118 | /* Read descriptors */ |
2103 | raw_descs = data; | 2119 | raw_descs = data; |
2120 | helper.ffs = ffs; | ||
2104 | for (i = 0; i < 3; ++i) { | 2121 | for (i = 0; i < 3; ++i) { |
2105 | if (!counts[i]) | 2122 | if (!counts[i]) |
2106 | continue; | 2123 | continue; |
2124 | helper.interfaces_count = 0; | ||
2125 | helper.eps_count = 0; | ||
2107 | ret = ffs_do_descs(counts[i], data, len, | 2126 | ret = ffs_do_descs(counts[i], data, len, |
2108 | __ffs_data_do_entity, ffs); | 2127 | __ffs_data_do_entity, &helper); |
2109 | if (ret < 0) | 2128 | if (ret < 0) |
2110 | goto error; | 2129 | goto error; |
2130 | if (!ffs->eps_count && !ffs->interfaces_count) { | ||
2131 | ffs->eps_count = helper.eps_count; | ||
2132 | ffs->interfaces_count = helper.interfaces_count; | ||
2133 | } else { | ||
2134 | if (ffs->eps_count != helper.eps_count) { | ||
2135 | ret = -EINVAL; | ||
2136 | goto error; | ||
2137 | } | ||
2138 | if (ffs->interfaces_count != helper.interfaces_count) { | ||
2139 | ret = -EINVAL; | ||
2140 | goto error; | ||
2141 | } | ||
2142 | } | ||
2111 | data += ret; | 2143 | data += ret; |
2112 | len -= ret; | 2144 | len -= ret; |
2113 | } | 2145 | } |
@@ -2342,9 +2374,18 @@ static void ffs_event_add(struct ffs_data *ffs, | |||
2342 | spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); | 2374 | spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); |
2343 | } | 2375 | } |
2344 | 2376 | ||
2345 | |||
2346 | /* Bind/unbind USB function hooks *******************************************/ | 2377 | /* Bind/unbind USB function hooks *******************************************/ |
2347 | 2378 | ||
2379 | static int ffs_ep_addr2idx(struct ffs_data *ffs, u8 endpoint_address) | ||
2380 | { | ||
2381 | int i; | ||
2382 | |||
2383 | for (i = 1; i < ARRAY_SIZE(ffs->eps_addrmap); ++i) | ||
2384 | if (ffs->eps_addrmap[i] == endpoint_address) | ||
2385 | return i; | ||
2386 | return -ENOENT; | ||
2387 | } | ||
2388 | |||
2348 | static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | 2389 | static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, |
2349 | struct usb_descriptor_header *desc, | 2390 | struct usb_descriptor_header *desc, |
2350 | void *priv) | 2391 | void *priv) |
@@ -2378,7 +2419,10 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | |||
2378 | if (!desc || desc->bDescriptorType != USB_DT_ENDPOINT) | 2419 | if (!desc || desc->bDescriptorType != USB_DT_ENDPOINT) |
2379 | return 0; | 2420 | return 0; |
2380 | 2421 | ||
2381 | idx = (ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) - 1; | 2422 | idx = ffs_ep_addr2idx(func->ffs, ds->bEndpointAddress) - 1; |
2423 | if (idx < 0) | ||
2424 | return idx; | ||
2425 | |||
2382 | ffs_ep = func->eps + idx; | 2426 | ffs_ep = func->eps + idx; |
2383 | 2427 | ||
2384 | if (unlikely(ffs_ep->descs[ep_desc_id])) { | 2428 | if (unlikely(ffs_ep->descs[ep_desc_id])) { |
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index d50adda913cf..6e6f87656e7b 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c | |||
@@ -1127,10 +1127,7 @@ void gether_disconnect(struct gether *link) | |||
1127 | 1127 | ||
1128 | DBG(dev, "%s\n", __func__); | 1128 | DBG(dev, "%s\n", __func__); |
1129 | 1129 | ||
1130 | netif_tx_lock(dev->net); | ||
1131 | netif_stop_queue(dev->net); | 1130 | netif_stop_queue(dev->net); |
1132 | netif_tx_unlock(dev->net); | ||
1133 | |||
1134 | netif_carrier_off(dev->net); | 1131 | netif_carrier_off(dev->net); |
1135 | 1132 | ||
1136 | /* disable endpoints, forcing (synchronous) completion | 1133 | /* disable endpoints, forcing (synchronous) completion |
diff --git a/drivers/usb/gadget/function/u_fs.h b/drivers/usb/gadget/function/u_fs.h index 63d6e71569c1..d48897e8ffeb 100644 --- a/drivers/usb/gadget/function/u_fs.h +++ b/drivers/usb/gadget/function/u_fs.h | |||
@@ -224,6 +224,8 @@ struct ffs_data { | |||
224 | void *ms_os_descs_ext_prop_name_avail; | 224 | void *ms_os_descs_ext_prop_name_avail; |
225 | void *ms_os_descs_ext_prop_data_avail; | 225 | void *ms_os_descs_ext_prop_data_avail; |
226 | 226 | ||
227 | u8 eps_addrmap[15]; | ||
228 | |||
227 | unsigned short strings_count; | 229 | unsigned short strings_count; |
228 | unsigned short interfaces_count; | 230 | unsigned short interfaces_count; |
229 | unsigned short eps_count; | 231 | unsigned short eps_count; |
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index 71e896d4c5ae..a5eb9a3fbb7a 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c | |||
@@ -195,6 +195,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req) | |||
195 | printk(KERN_INFO "Failed to queue request (%d).\n", ret); | 195 | printk(KERN_INFO "Failed to queue request (%d).\n", ret); |
196 | usb_ep_set_halt(ep); | 196 | usb_ep_set_halt(ep); |
197 | spin_unlock_irqrestore(&video->queue.irqlock, flags); | 197 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
198 | uvc_queue_cancel(queue, 0); | ||
198 | goto requeue; | 199 | goto requeue; |
199 | } | 200 | } |
200 | spin_unlock_irqrestore(&video->queue.irqlock, flags); | 201 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
@@ -281,6 +282,7 @@ error: | |||
281 | static int | 282 | static int |
282 | uvc_video_pump(struct uvc_video *video) | 283 | uvc_video_pump(struct uvc_video *video) |
283 | { | 284 | { |
285 | struct uvc_video_queue *queue = &video->queue; | ||
284 | struct usb_request *req; | 286 | struct usb_request *req; |
285 | struct uvc_buffer *buf; | 287 | struct uvc_buffer *buf; |
286 | unsigned long flags; | 288 | unsigned long flags; |
@@ -322,6 +324,7 @@ uvc_video_pump(struct uvc_video *video) | |||
322 | printk(KERN_INFO "Failed to queue request (%d)\n", ret); | 324 | printk(KERN_INFO "Failed to queue request (%d)\n", ret); |
323 | usb_ep_set_halt(video->ep); | 325 | usb_ep_set_halt(video->ep); |
324 | spin_unlock_irqrestore(&video->queue.irqlock, flags); | 326 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
327 | uvc_queue_cancel(queue, 0); | ||
325 | break; | 328 | break; |
326 | } | 329 | } |
327 | spin_unlock_irqrestore(&video->queue.irqlock, flags); | 330 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
diff --git a/drivers/usb/gadget/legacy/Makefile b/drivers/usb/gadget/legacy/Makefile index a11aad5635df..edba2d1ee0f3 100644 --- a/drivers/usb/gadget/legacy/Makefile +++ b/drivers/usb/gadget/legacy/Makefile | |||
@@ -2,9 +2,9 @@ | |||
2 | # USB gadget drivers | 2 | # USB gadget drivers |
3 | # | 3 | # |
4 | 4 | ||
5 | ccflags-y := -I$(PWD)/drivers/usb/gadget/ | 5 | ccflags-y := -Idrivers/usb/gadget/ |
6 | ccflags-y += -I$(PWD)/drivers/usb/gadget/udc/ | 6 | ccflags-y += -Idrivers/usb/gadget/udc/ |
7 | ccflags-y += -I$(PWD)/drivers/usb/gadget/function/ | 7 | ccflags-y += -Idrivers/usb/gadget/function/ |
8 | 8 | ||
9 | g_zero-y := zero.o | 9 | g_zero-y := zero.o |
10 | g_audio-y := audio.o | 10 | g_audio-y := audio.o |
diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c index 986fc511a2ed..225e385a6160 100644 --- a/drivers/usb/gadget/legacy/dbgp.c +++ b/drivers/usb/gadget/legacy/dbgp.c | |||
@@ -222,10 +222,12 @@ static void dbgp_unbind(struct usb_gadget *gadget) | |||
222 | { | 222 | { |
223 | #ifdef CONFIG_USB_G_DBGP_SERIAL | 223 | #ifdef CONFIG_USB_G_DBGP_SERIAL |
224 | kfree(dbgp.serial); | 224 | kfree(dbgp.serial); |
225 | dbgp.serial = NULL; | ||
225 | #endif | 226 | #endif |
226 | if (dbgp.req) { | 227 | if (dbgp.req) { |
227 | kfree(dbgp.req->buf); | 228 | kfree(dbgp.req->buf); |
228 | usb_ep_free_request(gadget->ep0, dbgp.req); | 229 | usb_ep_free_request(gadget->ep0, dbgp.req); |
230 | dbgp.req = NULL; | ||
229 | } | 231 | } |
230 | 232 | ||
231 | gadget->ep0->driver_data = NULL; | 233 | gadget->ep0->driver_data = NULL; |
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 2e4ce7704908..e96077b8bf79 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
@@ -440,7 +440,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
440 | 440 | ||
441 | value = -ENOMEM; | 441 | value = -ENOMEM; |
442 | kbuf = memdup_user(buf, len); | 442 | kbuf = memdup_user(buf, len); |
443 | if (!kbuf) { | 443 | if (IS_ERR(kbuf)) { |
444 | value = PTR_ERR(kbuf); | 444 | value = PTR_ERR(kbuf); |
445 | goto free1; | 445 | goto free1; |
446 | } | 446 | } |
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index 5151f947a4f5..34ebaa68504c 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig | |||
@@ -332,7 +332,7 @@ config USB_GOKU | |||
332 | gadget drivers to also be dynamically linked. | 332 | gadget drivers to also be dynamically linked. |
333 | 333 | ||
334 | config USB_EG20T | 334 | config USB_EG20T |
335 | tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" | 335 | tristate "Intel QUARK X1000/EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" |
336 | depends on PCI | 336 | depends on PCI |
337 | help | 337 | help |
338 | This is a USB device driver for EG20T PCH. | 338 | This is a USB device driver for EG20T PCH. |
@@ -353,6 +353,7 @@ config USB_EG20T | |||
353 | ML7213/ML7831 is companion chip for Intel Atom E6xx series. | 353 | ML7213/ML7831 is companion chip for Intel Atom E6xx series. |
354 | ML7213/ML7831 is completely compatible for Intel EG20T PCH. | 354 | ML7213/ML7831 is completely compatible for Intel EG20T PCH. |
355 | 355 | ||
356 | This driver can be used with Intel's Quark X1000 SOC platform | ||
356 | # | 357 | # |
357 | # LAST -- dummy/emulated controller | 358 | # LAST -- dummy/emulated controller |
358 | # | 359 | # |
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 906e65f0e4fa..c9fe67e29d35 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c | |||
@@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) | |||
1661 | if (dma_status) { | 1661 | if (dma_status) { |
1662 | int i; | 1662 | int i; |
1663 | 1663 | ||
1664 | for (i = 1; i < USBA_NR_DMAS; i++) | 1664 | for (i = 1; i <= USBA_NR_DMAS; i++) |
1665 | if (dma_status & (1 << i)) | 1665 | if (dma_status & (1 << i)) |
1666 | usba_dma_irq(udc, &udc->usba_ep[i]); | 1666 | usba_dma_irq(udc, &udc->usba_ep[i]); |
1667 | } | 1667 | } |
diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c index d40255f784df..5c5d1adda7eb 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.c +++ b/drivers/usb/gadget/udc/fusb300_udc.c | |||
@@ -1398,13 +1398,17 @@ static int fusb300_probe(struct platform_device *pdev) | |||
1398 | 1398 | ||
1399 | /* initialize udc */ | 1399 | /* initialize udc */ |
1400 | fusb300 = kzalloc(sizeof(struct fusb300), GFP_KERNEL); | 1400 | fusb300 = kzalloc(sizeof(struct fusb300), GFP_KERNEL); |
1401 | if (fusb300 == NULL) | 1401 | if (fusb300 == NULL) { |
1402 | ret = -ENOMEM; | ||
1402 | goto clean_up; | 1403 | goto clean_up; |
1404 | } | ||
1403 | 1405 | ||
1404 | for (i = 0; i < FUSB300_MAX_NUM_EP; i++) { | 1406 | for (i = 0; i < FUSB300_MAX_NUM_EP; i++) { |
1405 | _ep[i] = kzalloc(sizeof(struct fusb300_ep), GFP_KERNEL); | 1407 | _ep[i] = kzalloc(sizeof(struct fusb300_ep), GFP_KERNEL); |
1406 | if (_ep[i] == NULL) | 1408 | if (_ep[i] == NULL) { |
1409 | ret = -ENOMEM; | ||
1407 | goto clean_up; | 1410 | goto clean_up; |
1411 | } | ||
1408 | fusb300->ep[i] = _ep[i]; | 1412 | fusb300->ep[i] = _ep[i]; |
1409 | } | 1413 | } |
1410 | 1414 | ||
diff --git a/drivers/usb/gadget/udc/fusb300_udc.h b/drivers/usb/gadget/udc/fusb300_udc.h index ae811d8d38b4..ad39f892d200 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.h +++ b/drivers/usb/gadget/udc/fusb300_udc.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | 13 | ||
14 | #ifndef __FUSB300_UDC_H__ | 14 | #ifndef __FUSB300_UDC_H__ |
15 | #define __FUSB300_UDC_H_ | 15 | #define __FUSB300_UDC_H__ |
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | 18 | ||
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index f4eac113690e..2e95715b50c0 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c | |||
@@ -3320,7 +3320,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | |||
3320 | if (stat & tmp) { | 3320 | if (stat & tmp) { |
3321 | writel(tmp, &dev->regs->irqstat1); | 3321 | writel(tmp, &dev->regs->irqstat1); |
3322 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && | 3322 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && |
3323 | (readl(&dev->usb->usbstat) & mask)) || | 3323 | ((readl(&dev->usb->usbstat) & mask) == 0)) || |
3324 | ((readl(&dev->usb->usbctl) & | 3324 | ((readl(&dev->usb->usbctl) & |
3325 | BIT(VBUS_PIN)) == 0)) && | 3325 | BIT(VBUS_PIN)) == 0)) && |
3326 | (dev->gadget.speed != USB_SPEED_UNKNOWN)) { | 3326 | (dev->gadget.speed != USB_SPEED_UNKNOWN)) { |
diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index eb8c3bedb57a..460d953c91b6 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c | |||
@@ -343,6 +343,7 @@ struct pch_vbus_gpio_data { | |||
343 | * @setup_data: Received setup data | 343 | * @setup_data: Received setup data |
344 | * @phys_addr: of device memory | 344 | * @phys_addr: of device memory |
345 | * @base_addr: for mapped device memory | 345 | * @base_addr: for mapped device memory |
346 | * @bar: Indicates which PCI BAR for USB regs | ||
346 | * @irq: IRQ line for the device | 347 | * @irq: IRQ line for the device |
347 | * @cfg_data: current cfg, intf, and alt in use | 348 | * @cfg_data: current cfg, intf, and alt in use |
348 | * @vbus_gpio: GPIO informaton for detecting VBUS | 349 | * @vbus_gpio: GPIO informaton for detecting VBUS |
@@ -370,14 +371,17 @@ struct pch_udc_dev { | |||
370 | struct usb_ctrlrequest setup_data; | 371 | struct usb_ctrlrequest setup_data; |
371 | unsigned long phys_addr; | 372 | unsigned long phys_addr; |
372 | void __iomem *base_addr; | 373 | void __iomem *base_addr; |
374 | unsigned bar; | ||
373 | unsigned irq; | 375 | unsigned irq; |
374 | struct pch_udc_cfg_data cfg_data; | 376 | struct pch_udc_cfg_data cfg_data; |
375 | struct pch_vbus_gpio_data vbus_gpio; | 377 | struct pch_vbus_gpio_data vbus_gpio; |
376 | }; | 378 | }; |
377 | #define to_pch_udc(g) (container_of((g), struct pch_udc_dev, gadget)) | 379 | #define to_pch_udc(g) (container_of((g), struct pch_udc_dev, gadget)) |
378 | 380 | ||
381 | #define PCH_UDC_PCI_BAR_QUARK_X1000 0 | ||
379 | #define PCH_UDC_PCI_BAR 1 | 382 | #define PCH_UDC_PCI_BAR 1 |
380 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 | 383 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 |
384 | #define PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC 0x0939 | ||
381 | #define PCI_VENDOR_ID_ROHM 0x10DB | 385 | #define PCI_VENDOR_ID_ROHM 0x10DB |
382 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D | 386 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D |
383 | #define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808 | 387 | #define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808 |
@@ -3076,7 +3080,7 @@ static void pch_udc_remove(struct pci_dev *pdev) | |||
3076 | iounmap(dev->base_addr); | 3080 | iounmap(dev->base_addr); |
3077 | if (dev->mem_region) | 3081 | if (dev->mem_region) |
3078 | release_mem_region(dev->phys_addr, | 3082 | release_mem_region(dev->phys_addr, |
3079 | pci_resource_len(pdev, PCH_UDC_PCI_BAR)); | 3083 | pci_resource_len(pdev, dev->bar)); |
3080 | if (dev->active) | 3084 | if (dev->active) |
3081 | pci_disable_device(pdev); | 3085 | pci_disable_device(pdev); |
3082 | kfree(dev); | 3086 | kfree(dev); |
@@ -3144,9 +3148,15 @@ static int pch_udc_probe(struct pci_dev *pdev, | |||
3144 | dev->active = 1; | 3148 | dev->active = 1; |
3145 | pci_set_drvdata(pdev, dev); | 3149 | pci_set_drvdata(pdev, dev); |
3146 | 3150 | ||
3151 | /* Determine BAR based on PCI ID */ | ||
3152 | if (id->device == PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC) | ||
3153 | dev->bar = PCH_UDC_PCI_BAR_QUARK_X1000; | ||
3154 | else | ||
3155 | dev->bar = PCH_UDC_PCI_BAR; | ||
3156 | |||
3147 | /* PCI resource allocation */ | 3157 | /* PCI resource allocation */ |
3148 | resource = pci_resource_start(pdev, 1); | 3158 | resource = pci_resource_start(pdev, dev->bar); |
3149 | len = pci_resource_len(pdev, 1); | 3159 | len = pci_resource_len(pdev, dev->bar); |
3150 | 3160 | ||
3151 | if (!request_mem_region(resource, len, KBUILD_MODNAME)) { | 3161 | if (!request_mem_region(resource, len, KBUILD_MODNAME)) { |
3152 | dev_err(&pdev->dev, "%s: pci device used already\n", __func__); | 3162 | dev_err(&pdev->dev, "%s: pci device used already\n", __func__); |
@@ -3212,6 +3222,12 @@ finished: | |||
3212 | 3222 | ||
3213 | static const struct pci_device_id pch_udc_pcidev_id[] = { | 3223 | static const struct pci_device_id pch_udc_pcidev_id[] = { |
3214 | { | 3224 | { |
3225 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, | ||
3226 | PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC), | ||
3227 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | ||
3228 | .class_mask = 0xffffffff, | ||
3229 | }, | ||
3230 | { | ||
3215 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EG20T_UDC), | 3231 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EG20T_UDC), |
3216 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | 3232 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, |
3217 | .class_mask = 0xffffffff, | 3233 | .class_mask = 0xffffffff, |
diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 46008421c1ec..de2a8713b428 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c | |||
@@ -1868,8 +1868,8 @@ static int r8a66597_probe(struct platform_device *pdev) | |||
1868 | 1868 | ||
1869 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1869 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1870 | reg = devm_ioremap_resource(&pdev->dev, res); | 1870 | reg = devm_ioremap_resource(&pdev->dev, res); |
1871 | if (!reg) | 1871 | if (IS_ERR(reg)) |
1872 | return -ENODEV; | 1872 | return PTR_ERR(reg); |
1873 | 1873 | ||
1874 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 1874 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
1875 | irq = ires->start; | 1875 | irq = ires->start; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 81cda09b47e3..488a30836c36 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -965,8 +965,6 @@ rescan: | |||
965 | } | 965 | } |
966 | 966 | ||
967 | qh->exception = 1; | 967 | qh->exception = 1; |
968 | if (ehci->rh_state < EHCI_RH_RUNNING) | ||
969 | qh->qh_state = QH_STATE_IDLE; | ||
970 | switch (qh->qh_state) { | 968 | switch (qh->qh_state) { |
971 | case QH_STATE_LINKED: | 969 | case QH_STATE_LINKED: |
972 | WARN_ON(!list_empty(&qh->qtd_list)); | 970 | WARN_ON(!list_empty(&qh->qtd_list)); |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index cc305c71ac3d..6130b7574908 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -1230,7 +1230,7 @@ int ehci_hub_control( | |||
1230 | if (selector == EHSET_TEST_SINGLE_STEP_SET_FEATURE) { | 1230 | if (selector == EHSET_TEST_SINGLE_STEP_SET_FEATURE) { |
1231 | spin_unlock_irqrestore(&ehci->lock, flags); | 1231 | spin_unlock_irqrestore(&ehci->lock, flags); |
1232 | retval = ehset_single_step_set_feature(hcd, | 1232 | retval = ehset_single_step_set_feature(hcd, |
1233 | wIndex); | 1233 | wIndex + 1); |
1234 | spin_lock_irqsave(&ehci->lock, flags); | 1234 | spin_lock_irqsave(&ehci->lock, flags); |
1235 | break; | 1235 | break; |
1236 | } | 1236 | } |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index aa79e8749040..69aece31143a 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -468,7 +468,8 @@ static void xhci_hub_report_usb2_link_state(u32 *status, u32 status_reg) | |||
468 | } | 468 | } |
469 | 469 | ||
470 | /* Updates Link Status for super Speed port */ | 470 | /* Updates Link Status for super Speed port */ |
471 | static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) | 471 | static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, |
472 | u32 *status, u32 status_reg) | ||
472 | { | 473 | { |
473 | u32 pls = status_reg & PORT_PLS_MASK; | 474 | u32 pls = status_reg & PORT_PLS_MASK; |
474 | 475 | ||
@@ -507,7 +508,8 @@ static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) | |||
507 | * in which sometimes the port enters compliance mode | 508 | * in which sometimes the port enters compliance mode |
508 | * caused by a delay on the host-device negotiation. | 509 | * caused by a delay on the host-device negotiation. |
509 | */ | 510 | */ |
510 | if (pls == USB_SS_PORT_LS_COMP_MOD) | 511 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
512 | (pls == USB_SS_PORT_LS_COMP_MOD)) | ||
511 | pls |= USB_PORT_STAT_CONNECTION; | 513 | pls |= USB_PORT_STAT_CONNECTION; |
512 | } | 514 | } |
513 | 515 | ||
@@ -666,7 +668,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | |||
666 | } | 668 | } |
667 | /* Update Port Link State */ | 669 | /* Update Port Link State */ |
668 | if (hcd->speed == HCD_USB3) { | 670 | if (hcd->speed == HCD_USB3) { |
669 | xhci_hub_report_usb3_link_state(&status, raw_port_status); | 671 | xhci_hub_report_usb3_link_state(xhci, &status, raw_port_status); |
670 | /* | 672 | /* |
671 | * Verify if all USB3 Ports Have entered U0 already. | 673 | * Verify if all USB3 Ports Have entered U0 already. |
672 | * Delete Compliance Mode Timer if so. | 674 | * Delete Compliance Mode Timer if so. |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 8056d90690ee..8936211b161d 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1812,6 +1812,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1812 | 1812 | ||
1813 | if (xhci->lpm_command) | 1813 | if (xhci->lpm_command) |
1814 | xhci_free_command(xhci, xhci->lpm_command); | 1814 | xhci_free_command(xhci, xhci->lpm_command); |
1815 | xhci->lpm_command = NULL; | ||
1815 | if (xhci->cmd_ring) | 1816 | if (xhci->cmd_ring) |
1816 | xhci_ring_free(xhci, xhci->cmd_ring); | 1817 | xhci_ring_free(xhci, xhci->cmd_ring); |
1817 | xhci->cmd_ring = NULL; | 1818 | xhci->cmd_ring = NULL; |
@@ -1819,7 +1820,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1819 | xhci_cleanup_command_queue(xhci); | 1820 | xhci_cleanup_command_queue(xhci); |
1820 | 1821 | ||
1821 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | 1822 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
1822 | for (i = 0; i < num_ports; i++) { | 1823 | for (i = 0; i < num_ports && xhci->rh_bw; i++) { |
1823 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; | 1824 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; |
1824 | for (j = 0; j < XHCI_MAX_INTERVAL; j++) { | 1825 | for (j = 0; j < XHCI_MAX_INTERVAL; j++) { |
1825 | struct list_head *ep = &bwt->interval_bw[j].endpoints; | 1826 | struct list_head *ep = &bwt->interval_bw[j].endpoints; |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 687d36608155..c22a3e15a16e 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -101,6 +101,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
101 | /* AMD PLL quirk */ | 101 | /* AMD PLL quirk */ |
102 | if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) | 102 | if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) |
103 | xhci->quirks |= XHCI_AMD_PLL_FIX; | 103 | xhci->quirks |= XHCI_AMD_PLL_FIX; |
104 | |||
105 | if (pdev->vendor == PCI_VENDOR_ID_AMD) | ||
106 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; | ||
107 | |||
104 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { | 108 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { |
105 | xhci->quirks |= XHCI_LPM_SUPPORT; | 109 | xhci->quirks |= XHCI_LPM_SUPPORT; |
106 | xhci->quirks |= XHCI_INTEL_HOST; | 110 | xhci->quirks |= XHCI_INTEL_HOST; |
@@ -151,6 +155,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
151 | if (pdev->vendor == PCI_VENDOR_ID_VIA) | 155 | if (pdev->vendor == PCI_VENDOR_ID_VIA) |
152 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 156 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
153 | 157 | ||
158 | /* See https://bugzilla.kernel.org/show_bug.cgi?id=79511 */ | ||
159 | if (pdev->vendor == PCI_VENDOR_ID_VIA && | ||
160 | pdev->device == 0x3432) | ||
161 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
162 | |||
154 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | 163 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
155 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | 164 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
156 | "QUIRK: Resetting on resume"); | 165 | "QUIRK: Resetting on resume"); |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 60fb52ae864b..abed30b82905 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -364,32 +364,6 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci, | |||
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | /* | ||
368 | * Find the segment that trb is in. Start searching in start_seg. | ||
369 | * If we must move past a segment that has a link TRB with a toggle cycle state | ||
370 | * bit set, then we will toggle the value pointed at by cycle_state. | ||
371 | */ | ||
372 | static struct xhci_segment *find_trb_seg( | ||
373 | struct xhci_segment *start_seg, | ||
374 | union xhci_trb *trb, int *cycle_state) | ||
375 | { | ||
376 | struct xhci_segment *cur_seg = start_seg; | ||
377 | struct xhci_generic_trb *generic_trb; | ||
378 | |||
379 | while (cur_seg->trbs > trb || | ||
380 | &cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) { | ||
381 | generic_trb = &cur_seg->trbs[TRBS_PER_SEGMENT - 1].generic; | ||
382 | if (generic_trb->field[3] & cpu_to_le32(LINK_TOGGLE)) | ||
383 | *cycle_state ^= 0x1; | ||
384 | cur_seg = cur_seg->next; | ||
385 | if (cur_seg == start_seg) | ||
386 | /* Looped over the entire list. Oops! */ | ||
387 | return NULL; | ||
388 | } | ||
389 | return cur_seg; | ||
390 | } | ||
391 | |||
392 | |||
393 | static struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci, | 367 | static struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci, |
394 | unsigned int slot_id, unsigned int ep_index, | 368 | unsigned int slot_id, unsigned int ep_index, |
395 | unsigned int stream_id) | 369 | unsigned int stream_id) |
@@ -459,9 +433,12 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
459 | struct xhci_virt_device *dev = xhci->devs[slot_id]; | 433 | struct xhci_virt_device *dev = xhci->devs[slot_id]; |
460 | struct xhci_virt_ep *ep = &dev->eps[ep_index]; | 434 | struct xhci_virt_ep *ep = &dev->eps[ep_index]; |
461 | struct xhci_ring *ep_ring; | 435 | struct xhci_ring *ep_ring; |
462 | struct xhci_generic_trb *trb; | 436 | struct xhci_segment *new_seg; |
437 | union xhci_trb *new_deq; | ||
463 | dma_addr_t addr; | 438 | dma_addr_t addr; |
464 | u64 hw_dequeue; | 439 | u64 hw_dequeue; |
440 | bool cycle_found = false; | ||
441 | bool td_last_trb_found = false; | ||
465 | 442 | ||
466 | ep_ring = xhci_triad_to_transfer_ring(xhci, slot_id, | 443 | ep_ring = xhci_triad_to_transfer_ring(xhci, slot_id, |
467 | ep_index, stream_id); | 444 | ep_index, stream_id); |
@@ -486,45 +463,45 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
486 | hw_dequeue = le64_to_cpu(ep_ctx->deq); | 463 | hw_dequeue = le64_to_cpu(ep_ctx->deq); |
487 | } | 464 | } |
488 | 465 | ||
489 | /* Find virtual address and segment of hardware dequeue pointer */ | 466 | new_seg = ep_ring->deq_seg; |
490 | state->new_deq_seg = ep_ring->deq_seg; | 467 | new_deq = ep_ring->dequeue; |
491 | state->new_deq_ptr = ep_ring->dequeue; | 468 | state->new_cycle_state = hw_dequeue & 0x1; |
492 | while (xhci_trb_virt_to_dma(state->new_deq_seg, state->new_deq_ptr) | 469 | |
493 | != (dma_addr_t)(hw_dequeue & ~0xf)) { | ||
494 | next_trb(xhci, ep_ring, &state->new_deq_seg, | ||
495 | &state->new_deq_ptr); | ||
496 | if (state->new_deq_ptr == ep_ring->dequeue) { | ||
497 | WARN_ON(1); | ||
498 | return; | ||
499 | } | ||
500 | } | ||
501 | /* | 470 | /* |
502 | * Find cycle state for last_trb, starting at old cycle state of | 471 | * We want to find the pointer, segment and cycle state of the new trb |
503 | * hw_dequeue. If there is only one segment ring, find_trb_seg() will | 472 | * (the one after current TD's last_trb). We know the cycle state at |
504 | * return immediately and cannot toggle the cycle state if this search | 473 | * hw_dequeue, so walk the ring until both hw_dequeue and last_trb are |
505 | * wraps around, so add one more toggle manually in that case. | 474 | * found. |
506 | */ | 475 | */ |
507 | state->new_cycle_state = hw_dequeue & 0x1; | 476 | do { |
508 | if (ep_ring->first_seg == ep_ring->first_seg->next && | 477 | if (!cycle_found && xhci_trb_virt_to_dma(new_seg, new_deq) |
509 | cur_td->last_trb < state->new_deq_ptr) | 478 | == (dma_addr_t)(hw_dequeue & ~0xf)) { |
510 | state->new_cycle_state ^= 0x1; | 479 | cycle_found = true; |
480 | if (td_last_trb_found) | ||
481 | break; | ||
482 | } | ||
483 | if (new_deq == cur_td->last_trb) | ||
484 | td_last_trb_found = true; | ||
511 | 485 | ||
512 | state->new_deq_ptr = cur_td->last_trb; | 486 | if (cycle_found && |
513 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 487 | TRB_TYPE_LINK_LE32(new_deq->generic.field[3]) && |
514 | "Finding segment containing last TRB in TD."); | 488 | new_deq->generic.field[3] & cpu_to_le32(LINK_TOGGLE)) |
515 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, | 489 | state->new_cycle_state ^= 0x1; |
516 | state->new_deq_ptr, &state->new_cycle_state); | 490 | |
517 | if (!state->new_deq_seg) { | 491 | next_trb(xhci, ep_ring, &new_seg, &new_deq); |
518 | WARN_ON(1); | 492 | |
519 | return; | 493 | /* Search wrapped around, bail out */ |
520 | } | 494 | if (new_deq == ep->ring->dequeue) { |
495 | xhci_err(xhci, "Error: Failed finding new dequeue state\n"); | ||
496 | state->new_deq_seg = NULL; | ||
497 | state->new_deq_ptr = NULL; | ||
498 | return; | ||
499 | } | ||
500 | |||
501 | } while (!cycle_found || !td_last_trb_found); | ||
521 | 502 | ||
522 | /* Increment to find next TRB after last_trb. Cycle if appropriate. */ | 503 | state->new_deq_seg = new_seg; |
523 | trb = &state->new_deq_ptr->generic; | 504 | state->new_deq_ptr = new_deq; |
524 | if (TRB_TYPE_LINK_LE32(trb->field[3]) && | ||
525 | (trb->field[3] & cpu_to_le32(LINK_TOGGLE))) | ||
526 | state->new_cycle_state ^= 0x1; | ||
527 | next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr); | ||
528 | 505 | ||
529 | /* Don't update the ring cycle state for the producer (us). */ | 506 | /* Don't update the ring cycle state for the producer (us). */ |
530 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 507 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
@@ -2487,7 +2464,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
2487 | * last TRB of the previous TD. The command completion handle | 2464 | * last TRB of the previous TD. The command completion handle |
2488 | * will take care the rest. | 2465 | * will take care the rest. |
2489 | */ | 2466 | */ |
2490 | if (!event_seg && trb_comp_code == COMP_STOP_INVAL) { | 2467 | if (!event_seg && (trb_comp_code == COMP_STOP || |
2468 | trb_comp_code == COMP_STOP_INVAL)) { | ||
2491 | ret = 0; | 2469 | ret = 0; |
2492 | goto cleanup; | 2470 | goto cleanup; |
2493 | } | 2471 | } |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b6f21175b872..c4a8fca8ae93 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -2880,6 +2880,9 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, | |||
2880 | ep_index, ep->stopped_stream, ep->stopped_td, | 2880 | ep_index, ep->stopped_stream, ep->stopped_td, |
2881 | &deq_state); | 2881 | &deq_state); |
2882 | 2882 | ||
2883 | if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg) | ||
2884 | return; | ||
2885 | |||
2883 | /* HW with the reset endpoint quirk will use the saved dequeue state to | 2886 | /* HW with the reset endpoint quirk will use the saved dequeue state to |
2884 | * issue a configure endpoint command later. | 2887 | * issue a configure endpoint command later. |
2885 | */ | 2888 | */ |
@@ -3968,13 +3971,21 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, | |||
3968 | int ret; | 3971 | int ret; |
3969 | 3972 | ||
3970 | spin_lock_irqsave(&xhci->lock, flags); | 3973 | spin_lock_irqsave(&xhci->lock, flags); |
3971 | if (max_exit_latency == xhci->devs[udev->slot_id]->current_mel) { | 3974 | |
3975 | virt_dev = xhci->devs[udev->slot_id]; | ||
3976 | |||
3977 | /* | ||
3978 | * virt_dev might not exists yet if xHC resumed from hibernate (S4) and | ||
3979 | * xHC was re-initialized. Exit latency will be set later after | ||
3980 | * hub_port_finish_reset() is done and xhci->devs[] are re-allocated | ||
3981 | */ | ||
3982 | |||
3983 | if (!virt_dev || max_exit_latency == virt_dev->current_mel) { | ||
3972 | spin_unlock_irqrestore(&xhci->lock, flags); | 3984 | spin_unlock_irqrestore(&xhci->lock, flags); |
3973 | return 0; | 3985 | return 0; |
3974 | } | 3986 | } |
3975 | 3987 | ||
3976 | /* Attempt to issue an Evaluate Context command to change the MEL. */ | 3988 | /* Attempt to issue an Evaluate Context command to change the MEL. */ |
3977 | virt_dev = xhci->devs[udev->slot_id]; | ||
3978 | command = xhci->lpm_command; | 3989 | command = xhci->lpm_command; |
3979 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 3990 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); |
3980 | if (!ctrl_ctx) { | 3991 | if (!ctrl_ctx) { |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 06b5d77cd9ad..633caf643122 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -3250,6 +3250,7 @@ static const struct usb_device_id sisusb_table[] = { | |||
3250 | { USB_DEVICE(0x0711, 0x0918) }, | 3250 | { USB_DEVICE(0x0711, 0x0918) }, |
3251 | { USB_DEVICE(0x0711, 0x0920) }, | 3251 | { USB_DEVICE(0x0711, 0x0920) }, |
3252 | { USB_DEVICE(0x0711, 0x0950) }, | 3252 | { USB_DEVICE(0x0711, 0x0950) }, |
3253 | { USB_DEVICE(0x0711, 0x5200) }, | ||
3253 | { USB_DEVICE(0x182d, 0x021c) }, | 3254 | { USB_DEVICE(0x182d, 0x021c) }, |
3254 | { USB_DEVICE(0x182d, 0x0269) }, | 3255 | { USB_DEVICE(0x182d, 0x0269) }, |
3255 | { } | 3256 | { } |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 47ae6455d073..3ee133f675ab 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -39,6 +39,7 @@ struct cppi41_dma_channel { | |||
39 | u32 transferred; | 39 | u32 transferred; |
40 | u32 packet_sz; | 40 | u32 packet_sz; |
41 | struct list_head tx_check; | 41 | struct list_head tx_check; |
42 | int tx_zlp; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | #define MUSB_DMA_NUM_CHANNELS 15 | 45 | #define MUSB_DMA_NUM_CHANNELS 15 |
@@ -122,6 +123,8 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
122 | { | 123 | { |
123 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; | 124 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; |
124 | struct musb *musb = hw_ep->musb; | 125 | struct musb *musb = hw_ep->musb; |
126 | void __iomem *epio = hw_ep->regs; | ||
127 | u16 csr; | ||
125 | 128 | ||
126 | if (!cppi41_channel->prog_len || | 129 | if (!cppi41_channel->prog_len || |
127 | (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)) { | 130 | (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)) { |
@@ -131,15 +134,24 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
131 | cppi41_channel->transferred; | 134 | cppi41_channel->transferred; |
132 | cppi41_channel->channel.status = MUSB_DMA_STATUS_FREE; | 135 | cppi41_channel->channel.status = MUSB_DMA_STATUS_FREE; |
133 | cppi41_channel->channel.rx_packet_done = true; | 136 | cppi41_channel->channel.rx_packet_done = true; |
137 | |||
138 | /* | ||
139 | * transmit ZLP using PIO mode for transfers which size is | ||
140 | * multiple of EP packet size. | ||
141 | */ | ||
142 | if (cppi41_channel->tx_zlp && (cppi41_channel->transferred % | ||
143 | cppi41_channel->packet_sz) == 0) { | ||
144 | musb_ep_select(musb->mregs, hw_ep->epnum); | ||
145 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY; | ||
146 | musb_writew(epio, MUSB_TXCSR, csr); | ||
147 | } | ||
134 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); | 148 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); |
135 | } else { | 149 | } else { |
136 | /* next iteration, reload */ | 150 | /* next iteration, reload */ |
137 | struct dma_chan *dc = cppi41_channel->dc; | 151 | struct dma_chan *dc = cppi41_channel->dc; |
138 | struct dma_async_tx_descriptor *dma_desc; | 152 | struct dma_async_tx_descriptor *dma_desc; |
139 | enum dma_transfer_direction direction; | 153 | enum dma_transfer_direction direction; |
140 | u16 csr; | ||
141 | u32 remain_bytes; | 154 | u32 remain_bytes; |
142 | void __iomem *epio = cppi41_channel->hw_ep->regs; | ||
143 | 155 | ||
144 | cppi41_channel->buf_addr += cppi41_channel->packet_sz; | 156 | cppi41_channel->buf_addr += cppi41_channel->packet_sz; |
145 | 157 | ||
@@ -363,6 +375,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
363 | cppi41_channel->total_len = len; | 375 | cppi41_channel->total_len = len; |
364 | cppi41_channel->transferred = 0; | 376 | cppi41_channel->transferred = 0; |
365 | cppi41_channel->packet_sz = packet_sz; | 377 | cppi41_channel->packet_sz = packet_sz; |
378 | cppi41_channel->tx_zlp = (cppi41_channel->is_tx && mode) ? 1 : 0; | ||
366 | 379 | ||
367 | /* | 380 | /* |
368 | * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more | 381 | * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more |
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index 9aad00f11bd5..221faed9f074 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c | |||
@@ -96,7 +96,7 @@ static bool ux500_configure_channel(struct dma_channel *channel, | |||
96 | struct musb *musb = ux500_channel->controller->private_data; | 96 | struct musb *musb = ux500_channel->controller->private_data; |
97 | 97 | ||
98 | dev_dbg(musb->controller, | 98 | dev_dbg(musb->controller, |
99 | "packet_sz=%d, mode=%d, dma_addr=0x%llu, len=%d is_tx=%d\n", | 99 | "packet_sz=%d, mode=%d, dma_addr=0x%llx, len=%d is_tx=%d\n", |
100 | packet_sz, mode, (unsigned long long) dma_addr, | 100 | packet_sz, mode, (unsigned long long) dma_addr, |
101 | len, ux500_channel->is_tx); | 101 | len, ux500_channel->is_tx); |
102 | 102 | ||
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c index ea9e705555df..f4b14bd97e14 100644 --- a/drivers/usb/phy/phy-gpio-vbus-usb.c +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c | |||
@@ -260,10 +260,8 @@ static int gpio_vbus_probe(struct platform_device *pdev) | |||
260 | 260 | ||
261 | gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), | 261 | gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), |
262 | GFP_KERNEL); | 262 | GFP_KERNEL); |
263 | if (!gpio_vbus->phy.otg) { | 263 | if (!gpio_vbus->phy.otg) |
264 | kfree(gpio_vbus); | ||
265 | return -ENOMEM; | 264 | return -ENOMEM; |
266 | } | ||
267 | 265 | ||
268 | platform_set_drvdata(pdev, gpio_vbus); | 266 | platform_set_drvdata(pdev, gpio_vbus); |
269 | gpio_vbus->dev = &pdev->dev; | 267 | gpio_vbus->dev = &pdev->dev; |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index e4108eec5ef4..afc09087ec36 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
@@ -1601,8 +1601,8 @@ static int msm_otg_probe(struct platform_device *pdev) | |||
1601 | */ | 1601 | */ |
1602 | if (motg->phy_number) { | 1602 | if (motg->phy_number) { |
1603 | phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4); | 1603 | phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4); |
1604 | if (IS_ERR(phy_select)) | 1604 | if (!phy_select) |
1605 | return PTR_ERR(phy_select); | 1605 | return -ENOMEM; |
1606 | /* Enable second PHY with the OTG port */ | 1606 | /* Enable second PHY with the OTG port */ |
1607 | writel(0x1, phy_select); | 1607 | writel(0x1, phy_select); |
1608 | } | 1608 | } |
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index c42bdf0c4a1f..00972eca04e7 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2012-2013 Freescale Semiconductor, Inc. | 2 | * Copyright 2012-2014 Freescale Semiconductor, Inc. |
3 | * Copyright (C) 2012 Marek Vasut <marex@denx.de> | 3 | * Copyright (C) 2012 Marek Vasut <marex@denx.de> |
4 | * on behalf of DENX Software Engineering GmbH | 4 | * on behalf of DENX Software Engineering GmbH |
5 | * | 5 | * |
@@ -125,7 +125,13 @@ static const struct mxs_phy_data imx6sl_phy_data = { | |||
125 | MXS_PHY_NEED_IP_FIX, | 125 | MXS_PHY_NEED_IP_FIX, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static const struct mxs_phy_data imx6sx_phy_data = { | ||
129 | .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | | ||
130 | MXS_PHY_NEED_IP_FIX, | ||
131 | }; | ||
132 | |||
128 | static const struct of_device_id mxs_phy_dt_ids[] = { | 133 | static const struct of_device_id mxs_phy_dt_ids[] = { |
134 | { .compatible = "fsl,imx6sx-usbphy", .data = &imx6sx_phy_data, }, | ||
129 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, | 135 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, |
130 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, | 136 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, |
131 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, | 137 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, |
diff --git a/drivers/usb/phy/phy-samsung-usb.h b/drivers/usb/phy/phy-samsung-usb.h index 68771bfd1825..80eedd45a20a 100644 --- a/drivers/usb/phy/phy-samsung-usb.h +++ b/drivers/usb/phy/phy-samsung-usb.h | |||
@@ -216,7 +216,7 @@ | |||
216 | 216 | ||
217 | #define EXYNOS5_DRD_PHYPARAM1 (0x20) | 217 | #define EXYNOS5_DRD_PHYPARAM1 (0x20) |
218 | 218 | ||
219 | #define PHYPARAM1_PCS_TXDEEMPH_MASK (0x1f << 0) | 219 | #define PHYPARAM1_PCS_TXDEEMPH_MASK (0x3f << 0) |
220 | #define PHYPARAM1_PCS_TXDEEMPH (0x1c) | 220 | #define PHYPARAM1_PCS_TXDEEMPH (0x1c) |
221 | 221 | ||
222 | #define EXYNOS5_DRD_PHYTERM (0x24) | 222 | #define EXYNOS5_DRD_PHYTERM (0x24) |
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index 13b4fa287da8..886f1807a67b 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c | |||
@@ -878,8 +878,8 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, | |||
878 | return -ENOMEM; | 878 | return -ENOMEM; |
879 | } | 879 | } |
880 | 880 | ||
881 | tegra_phy->config = devm_kzalloc(&pdev->dev, | 881 | tegra_phy->config = devm_kzalloc(&pdev->dev, sizeof(*config), |
882 | sizeof(*tegra_phy->config), GFP_KERNEL); | 882 | GFP_KERNEL); |
883 | if (!tegra_phy->config) { | 883 | if (!tegra_phy->config) { |
884 | dev_err(&pdev->dev, | 884 | dev_err(&pdev->dev, |
885 | "unable to allocate memory for USB UTMIP config\n"); | 885 | "unable to allocate memory for USB UTMIP config\n"); |
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 6d0f6080eceb..045cd309367a 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c | |||
@@ -232,6 +232,9 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) | |||
232 | phy = __usb_find_phy_dev(dev, &phy_bind_list, index); | 232 | phy = __usb_find_phy_dev(dev, &phy_bind_list, index); |
233 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { | 233 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
234 | dev_dbg(dev, "unable to find transceiver\n"); | 234 | dev_dbg(dev, "unable to find transceiver\n"); |
235 | if (!IS_ERR(phy)) | ||
236 | phy = ERR_PTR(-ENODEV); | ||
237 | |||
235 | goto err0; | 238 | goto err0; |
236 | } | 239 | } |
237 | 240 | ||
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 4fd36530bfa3..b0c97a3f1bfe 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -108,19 +108,45 @@ static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe) | |||
108 | return list_first_entry(&pipe->list, struct usbhs_pkt, node); | 108 | return list_first_entry(&pipe->list, struct usbhs_pkt, node); |
109 | } | 109 | } |
110 | 110 | ||
111 | static void usbhsf_fifo_clear(struct usbhs_pipe *pipe, | ||
112 | struct usbhs_fifo *fifo); | ||
113 | static void usbhsf_fifo_unselect(struct usbhs_pipe *pipe, | ||
114 | struct usbhs_fifo *fifo); | ||
115 | static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo, | ||
116 | struct usbhs_pkt *pkt); | ||
117 | #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) | ||
118 | #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) | ||
119 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map); | ||
111 | struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) | 120 | struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) |
112 | { | 121 | { |
113 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | 122 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
123 | struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe); | ||
114 | unsigned long flags; | 124 | unsigned long flags; |
115 | 125 | ||
116 | /******************** spin lock ********************/ | 126 | /******************** spin lock ********************/ |
117 | usbhs_lock(priv, flags); | 127 | usbhs_lock(priv, flags); |
118 | 128 | ||
129 | usbhs_pipe_disable(pipe); | ||
130 | |||
119 | if (!pkt) | 131 | if (!pkt) |
120 | pkt = __usbhsf_pkt_get(pipe); | 132 | pkt = __usbhsf_pkt_get(pipe); |
121 | 133 | ||
122 | if (pkt) | 134 | if (pkt) { |
135 | struct dma_chan *chan = NULL; | ||
136 | |||
137 | if (fifo) | ||
138 | chan = usbhsf_dma_chan_get(fifo, pkt); | ||
139 | if (chan) { | ||
140 | dmaengine_terminate_all(chan); | ||
141 | usbhsf_fifo_clear(pipe, fifo); | ||
142 | usbhsf_dma_unmap(pkt); | ||
143 | } | ||
144 | |||
123 | __usbhsf_pkt_del(pkt); | 145 | __usbhsf_pkt_del(pkt); |
146 | } | ||
147 | |||
148 | if (fifo) | ||
149 | usbhsf_fifo_unselect(pipe, fifo); | ||
124 | 150 | ||
125 | usbhs_unlock(priv, flags); | 151 | usbhs_unlock(priv, flags); |
126 | /******************** spin unlock ******************/ | 152 | /******************** spin unlock ******************/ |
@@ -544,6 +570,7 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done) | |||
544 | usbhsf_send_terminator(pipe, fifo); | 570 | usbhsf_send_terminator(pipe, fifo); |
545 | 571 | ||
546 | usbhsf_tx_irq_ctrl(pipe, !*is_done); | 572 | usbhsf_tx_irq_ctrl(pipe, !*is_done); |
573 | usbhs_pipe_running(pipe, !*is_done); | ||
547 | usbhs_pipe_enable(pipe); | 574 | usbhs_pipe_enable(pipe); |
548 | 575 | ||
549 | dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n", | 576 | dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n", |
@@ -570,12 +597,21 @@ usbhs_fifo_write_busy: | |||
570 | * retry in interrupt | 597 | * retry in interrupt |
571 | */ | 598 | */ |
572 | usbhsf_tx_irq_ctrl(pipe, 1); | 599 | usbhsf_tx_irq_ctrl(pipe, 1); |
600 | usbhs_pipe_running(pipe, 1); | ||
573 | 601 | ||
574 | return ret; | 602 | return ret; |
575 | } | 603 | } |
576 | 604 | ||
605 | static int usbhsf_pio_prepare_push(struct usbhs_pkt *pkt, int *is_done) | ||
606 | { | ||
607 | if (usbhs_pipe_is_running(pkt->pipe)) | ||
608 | return 0; | ||
609 | |||
610 | return usbhsf_pio_try_push(pkt, is_done); | ||
611 | } | ||
612 | |||
577 | struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { | 613 | struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { |
578 | .prepare = usbhsf_pio_try_push, | 614 | .prepare = usbhsf_pio_prepare_push, |
579 | .try_run = usbhsf_pio_try_push, | 615 | .try_run = usbhsf_pio_try_push, |
580 | }; | 616 | }; |
581 | 617 | ||
@@ -589,6 +625,9 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | |||
589 | if (usbhs_pipe_is_busy(pipe)) | 625 | if (usbhs_pipe_is_busy(pipe)) |
590 | return 0; | 626 | return 0; |
591 | 627 | ||
628 | if (usbhs_pipe_is_running(pipe)) | ||
629 | return 0; | ||
630 | |||
592 | /* | 631 | /* |
593 | * pipe enable to prepare packet receive | 632 | * pipe enable to prepare packet receive |
594 | */ | 633 | */ |
@@ -597,6 +636,7 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | |||
597 | 636 | ||
598 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); | 637 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); |
599 | usbhs_pipe_enable(pipe); | 638 | usbhs_pipe_enable(pipe); |
639 | usbhs_pipe_running(pipe, 1); | ||
600 | usbhsf_rx_irq_ctrl(pipe, 1); | 640 | usbhsf_rx_irq_ctrl(pipe, 1); |
601 | 641 | ||
602 | return 0; | 642 | return 0; |
@@ -642,6 +682,7 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done) | |||
642 | (total_len < maxp)) { /* short packet */ | 682 | (total_len < maxp)) { /* short packet */ |
643 | *is_done = 1; | 683 | *is_done = 1; |
644 | usbhsf_rx_irq_ctrl(pipe, 0); | 684 | usbhsf_rx_irq_ctrl(pipe, 0); |
685 | usbhs_pipe_running(pipe, 0); | ||
645 | usbhs_pipe_disable(pipe); /* disable pipe first */ | 686 | usbhs_pipe_disable(pipe); /* disable pipe first */ |
646 | } | 687 | } |
647 | 688 | ||
@@ -763,8 +804,6 @@ static void __usbhsf_dma_ctrl(struct usbhs_pipe *pipe, | |||
763 | usbhs_bset(priv, fifo->sel, DREQE, dreqe); | 804 | usbhs_bset(priv, fifo->sel, DREQE, dreqe); |
764 | } | 805 | } |
765 | 806 | ||
766 | #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) | ||
767 | #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) | ||
768 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map) | 807 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map) |
769 | { | 808 | { |
770 | struct usbhs_pipe *pipe = pkt->pipe; | 809 | struct usbhs_pipe *pipe = pkt->pipe; |
@@ -805,6 +844,7 @@ static void xfer_work(struct work_struct *work) | |||
805 | dev_dbg(dev, " %s %d (%d/ %d)\n", | 844 | dev_dbg(dev, " %s %d (%d/ %d)\n", |
806 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); | 845 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); |
807 | 846 | ||
847 | usbhs_pipe_running(pipe, 1); | ||
808 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); | 848 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); |
809 | usbhs_pipe_enable(pipe); | 849 | usbhs_pipe_enable(pipe); |
810 | usbhsf_dma_start(pipe, fifo); | 850 | usbhsf_dma_start(pipe, fifo); |
@@ -836,6 +876,10 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) | |||
836 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ | 876 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ |
837 | goto usbhsf_pio_prepare_push; | 877 | goto usbhsf_pio_prepare_push; |
838 | 878 | ||
879 | /* return at this time if the pipe is running */ | ||
880 | if (usbhs_pipe_is_running(pipe)) | ||
881 | return 0; | ||
882 | |||
839 | /* get enable DMA fifo */ | 883 | /* get enable DMA fifo */ |
840 | fifo = usbhsf_get_dma_fifo(priv, pkt); | 884 | fifo = usbhsf_get_dma_fifo(priv, pkt); |
841 | if (!fifo) | 885 | if (!fifo) |
@@ -869,15 +913,29 @@ usbhsf_pio_prepare_push: | |||
869 | static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) | 913 | static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) |
870 | { | 914 | { |
871 | struct usbhs_pipe *pipe = pkt->pipe; | 915 | struct usbhs_pipe *pipe = pkt->pipe; |
916 | int is_short = pkt->trans % usbhs_pipe_get_maxpacket(pipe); | ||
917 | |||
918 | pkt->actual += pkt->trans; | ||
872 | 919 | ||
873 | pkt->actual = pkt->trans; | 920 | if (pkt->actual < pkt->length) |
921 | *is_done = 0; /* there are remainder data */ | ||
922 | else if (is_short) | ||
923 | *is_done = 1; /* short packet */ | ||
924 | else | ||
925 | *is_done = !pkt->zero; /* send zero packet? */ | ||
874 | 926 | ||
875 | *is_done = !pkt->zero; /* send zero packet ? */ | 927 | usbhs_pipe_running(pipe, !*is_done); |
876 | 928 | ||
877 | usbhsf_dma_stop(pipe, pipe->fifo); | 929 | usbhsf_dma_stop(pipe, pipe->fifo); |
878 | usbhsf_dma_unmap(pkt); | 930 | usbhsf_dma_unmap(pkt); |
879 | usbhsf_fifo_unselect(pipe, pipe->fifo); | 931 | usbhsf_fifo_unselect(pipe, pipe->fifo); |
880 | 932 | ||
933 | if (!*is_done) { | ||
934 | /* change handler to PIO */ | ||
935 | pkt->handler = &usbhs_fifo_pio_push_handler; | ||
936 | return pkt->handler->try_run(pkt, is_done); | ||
937 | } | ||
938 | |||
881 | return 0; | 939 | return 0; |
882 | } | 940 | } |
883 | 941 | ||
@@ -972,8 +1030,10 @@ static int usbhsf_dma_pop_done(struct usbhs_pkt *pkt, int *is_done) | |||
972 | if ((pkt->actual == pkt->length) || /* receive all data */ | 1030 | if ((pkt->actual == pkt->length) || /* receive all data */ |
973 | (pkt->trans < maxp)) { /* short packet */ | 1031 | (pkt->trans < maxp)) { /* short packet */ |
974 | *is_done = 1; | 1032 | *is_done = 1; |
1033 | usbhs_pipe_running(pipe, 0); | ||
975 | } else { | 1034 | } else { |
976 | /* re-enable */ | 1035 | /* re-enable */ |
1036 | usbhs_pipe_running(pipe, 0); | ||
977 | usbhsf_prepare_pop(pkt, is_done); | 1037 | usbhsf_prepare_pop(pkt, is_done); |
978 | } | 1038 | } |
979 | 1039 | ||
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index 6a030b931a3b..9a705b15b3a1 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c | |||
@@ -213,7 +213,10 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv, | |||
213 | { | 213 | { |
214 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); | 214 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); |
215 | u16 intenb0, intenb1; | 215 | u16 intenb0, intenb1; |
216 | unsigned long flags; | ||
216 | 217 | ||
218 | /******************** spin lock ********************/ | ||
219 | usbhs_lock(priv, flags); | ||
217 | state->intsts0 = usbhs_read(priv, INTSTS0); | 220 | state->intsts0 = usbhs_read(priv, INTSTS0); |
218 | state->intsts1 = usbhs_read(priv, INTSTS1); | 221 | state->intsts1 = usbhs_read(priv, INTSTS1); |
219 | 222 | ||
@@ -229,6 +232,8 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv, | |||
229 | state->bempsts &= mod->irq_bempsts; | 232 | state->bempsts &= mod->irq_bempsts; |
230 | state->brdysts &= mod->irq_brdysts; | 233 | state->brdysts &= mod->irq_brdysts; |
231 | } | 234 | } |
235 | usbhs_unlock(priv, flags); | ||
236 | /******************** spin unlock ******************/ | ||
232 | 237 | ||
233 | /* | 238 | /* |
234 | * Check whether the irq enable registers and the irq status are set | 239 | * Check whether the irq enable registers and the irq status are set |
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 75fbcf6b102e..040bcefcb040 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c | |||
@@ -578,6 +578,19 @@ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe) | |||
578 | return usbhsp_flags_has(pipe, IS_DIR_HOST); | 578 | return usbhsp_flags_has(pipe, IS_DIR_HOST); |
579 | } | 579 | } |
580 | 580 | ||
581 | int usbhs_pipe_is_running(struct usbhs_pipe *pipe) | ||
582 | { | ||
583 | return usbhsp_flags_has(pipe, IS_RUNNING); | ||
584 | } | ||
585 | |||
586 | void usbhs_pipe_running(struct usbhs_pipe *pipe, int running) | ||
587 | { | ||
588 | if (running) | ||
589 | usbhsp_flags_set(pipe, IS_RUNNING); | ||
590 | else | ||
591 | usbhsp_flags_clr(pipe, IS_RUNNING); | ||
592 | } | ||
593 | |||
581 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) | 594 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) |
582 | { | 595 | { |
583 | u16 mask = (SQCLR | SQSET); | 596 | u16 mask = (SQCLR | SQSET); |
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h index 406f36d050e4..d24a05972370 100644 --- a/drivers/usb/renesas_usbhs/pipe.h +++ b/drivers/usb/renesas_usbhs/pipe.h | |||
@@ -36,6 +36,7 @@ struct usbhs_pipe { | |||
36 | #define USBHS_PIPE_FLAGS_IS_USED (1 << 0) | 36 | #define USBHS_PIPE_FLAGS_IS_USED (1 << 0) |
37 | #define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) | 37 | #define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) |
38 | #define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2) | 38 | #define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2) |
39 | #define USBHS_PIPE_FLAGS_IS_RUNNING (1 << 3) | ||
39 | 40 | ||
40 | struct usbhs_pkt_handle *handler; | 41 | struct usbhs_pkt_handle *handler; |
41 | 42 | ||
@@ -80,6 +81,9 @@ int usbhs_pipe_probe(struct usbhs_priv *priv); | |||
80 | void usbhs_pipe_remove(struct usbhs_priv *priv); | 81 | void usbhs_pipe_remove(struct usbhs_priv *priv); |
81 | int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe); | 82 | int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe); |
82 | int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe); | 83 | int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe); |
84 | int usbhs_pipe_is_running(struct usbhs_pipe *pipe); | ||
85 | void usbhs_pipe_running(struct usbhs_pipe *pipe, int running); | ||
86 | |||
83 | void usbhs_pipe_init(struct usbhs_priv *priv, | 87 | void usbhs_pipe_init(struct usbhs_priv *priv, |
84 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); | 88 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); |
85 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); | 89 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 216ce3078270..dc72b924c399 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -146,6 +146,7 @@ static const struct usb_device_id id_table_combined[] = { | |||
146 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, | 146 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, |
147 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, | 147 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, |
148 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, | 148 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, |
149 | { USB_DEVICE(FTDI_VID, FTDI_BM_ATOM_NANO_PID) }, | ||
149 | { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) }, | 150 | { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) }, |
150 | { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) }, | 151 | { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) }, |
151 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, | 152 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, |
@@ -727,6 +728,7 @@ static const struct usb_device_id id_table_combined[] = { | |||
727 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | 728 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), |
728 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 729 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
729 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 730 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
731 | { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, | ||
730 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, | 732 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, |
731 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, | 733 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, |
732 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, | 734 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, |
@@ -934,8 +936,12 @@ static const struct usb_device_id id_table_combined[] = { | |||
934 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, | 936 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, |
935 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, | 937 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, |
936 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, | 938 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, |
939 | /* ekey Devices */ | ||
940 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, | ||
937 | /* Infineon Devices */ | 941 | /* Infineon Devices */ |
938 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | 942 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, |
943 | /* GE Healthcare devices */ | ||
944 | { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, | ||
939 | { } /* Terminating entry */ | 945 | { } /* Terminating entry */ |
940 | }; | 946 | }; |
941 | 947 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 1e58d90a0b6c..5937b2d242f2 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -42,6 +42,8 @@ | |||
42 | /* www.candapter.com Ewert Energy Systems CANdapter device */ | 42 | /* www.candapter.com Ewert Energy Systems CANdapter device */ |
43 | #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */ | 43 | #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */ |
44 | 44 | ||
45 | #define FTDI_BM_ATOM_NANO_PID 0xa559 /* Basic Micro ATOM Nano USB2Serial */ | ||
46 | |||
45 | /* | 47 | /* |
46 | * Texas Instruments XDS100v2 JTAG / BeagleBone A3 | 48 | * Texas Instruments XDS100v2 JTAG / BeagleBone A3 |
47 | * http://processors.wiki.ti.com/index.php/XDS100 | 49 | * http://processors.wiki.ti.com/index.php/XDS100 |
@@ -835,6 +837,12 @@ | |||
835 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ | 837 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ |
836 | 838 | ||
837 | /* | 839 | /* |
840 | * NOVITUS printers | ||
841 | */ | ||
842 | #define NOVITUS_VID 0x1a28 | ||
843 | #define NOVITUS_BONO_E_PID 0x6010 | ||
844 | |||
845 | /* | ||
838 | * RT Systems programming cables for various ham radios | 846 | * RT Systems programming cables for various ham radios |
839 | */ | 847 | */ |
840 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 848 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
@@ -1378,3 +1386,14 @@ | |||
1378 | #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */ | 1386 | #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */ |
1379 | #define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */ | 1387 | #define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */ |
1380 | #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */ | 1388 | #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */ |
1389 | |||
1390 | /* | ||
1391 | * ekey biometric systems GmbH (http://ekey.net/) | ||
1392 | */ | ||
1393 | #define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ | ||
1394 | |||
1395 | /* | ||
1396 | * GE Healthcare devices | ||
1397 | */ | ||
1398 | #define GE_HEALTHCARE_VID 0x1901 | ||
1399 | #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index a9688940543d..54a8120897a6 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -275,8 +275,12 @@ static void option_instat_callback(struct urb *urb); | |||
275 | #define ZTE_PRODUCT_MF622 0x0001 | 275 | #define ZTE_PRODUCT_MF622 0x0001 |
276 | #define ZTE_PRODUCT_MF628 0x0015 | 276 | #define ZTE_PRODUCT_MF628 0x0015 |
277 | #define ZTE_PRODUCT_MF626 0x0031 | 277 | #define ZTE_PRODUCT_MF626 0x0031 |
278 | #define ZTE_PRODUCT_MC2718 0xffe8 | ||
279 | #define ZTE_PRODUCT_AC2726 0xfff1 | 278 | #define ZTE_PRODUCT_AC2726 0xfff1 |
279 | #define ZTE_PRODUCT_CDMA_TECH 0xfffe | ||
280 | #define ZTE_PRODUCT_AC8710T 0xffff | ||
281 | #define ZTE_PRODUCT_MC2718 0xffe8 | ||
282 | #define ZTE_PRODUCT_AD3812 0xffeb | ||
283 | #define ZTE_PRODUCT_MC2716 0xffed | ||
280 | 284 | ||
281 | #define BENQ_VENDOR_ID 0x04a5 | 285 | #define BENQ_VENDOR_ID 0x04a5 |
282 | #define BENQ_PRODUCT_H10 0x4068 | 286 | #define BENQ_PRODUCT_H10 0x4068 |
@@ -494,6 +498,10 @@ static void option_instat_callback(struct urb *urb); | |||
494 | #define INOVIA_VENDOR_ID 0x20a6 | 498 | #define INOVIA_VENDOR_ID 0x20a6 |
495 | #define INOVIA_SEW858 0x1105 | 499 | #define INOVIA_SEW858 0x1105 |
496 | 500 | ||
501 | /* VIA Telecom */ | ||
502 | #define VIATELECOM_VENDOR_ID 0x15eb | ||
503 | #define VIATELECOM_PRODUCT_CDS7 0x0001 | ||
504 | |||
497 | /* some devices interfaces need special handling due to a number of reasons */ | 505 | /* some devices interfaces need special handling due to a number of reasons */ |
498 | enum option_blacklist_reason { | 506 | enum option_blacklist_reason { |
499 | OPTION_BLACKLIST_NONE = 0, | 507 | OPTION_BLACKLIST_NONE = 0, |
@@ -527,10 +535,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = { | |||
527 | .reserved = BIT(4), | 535 | .reserved = BIT(4), |
528 | }; | 536 | }; |
529 | 537 | ||
538 | static const struct option_blacklist_info zte_ad3812_z_blacklist = { | ||
539 | .sendsetup = BIT(0) | BIT(1) | BIT(2), | ||
540 | }; | ||
541 | |||
530 | static const struct option_blacklist_info zte_mc2718_z_blacklist = { | 542 | static const struct option_blacklist_info zte_mc2718_z_blacklist = { |
531 | .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), | 543 | .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), |
532 | }; | 544 | }; |
533 | 545 | ||
546 | static const struct option_blacklist_info zte_mc2716_z_blacklist = { | ||
547 | .sendsetup = BIT(1) | BIT(2) | BIT(3), | ||
548 | }; | ||
549 | |||
534 | static const struct option_blacklist_info huawei_cdc12_blacklist = { | 550 | static const struct option_blacklist_info huawei_cdc12_blacklist = { |
535 | .reserved = BIT(1) | BIT(2), | 551 | .reserved = BIT(1) | BIT(2), |
536 | }; | 552 | }; |
@@ -1070,6 +1086,7 @@ static const struct usb_device_id option_ids[] = { | |||
1070 | { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, | 1086 | { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, |
1071 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, | 1087 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, |
1072 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, | 1088 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
1089 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ | ||
1073 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 1090 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
1074 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ | 1091 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ |
1075 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ | 1092 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
@@ -1544,13 +1561,18 @@ static const struct usb_device_id option_ids[] = { | |||
1544 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, | 1561 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, |
1545 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, | 1562 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, |
1546 | 1563 | ||
1547 | /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */ | 1564 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, |
1565 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | ||
1566 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, | ||
1548 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), | 1567 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), |
1549 | .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, | 1568 | .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, |
1569 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff), | ||
1570 | .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, | ||
1571 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), | ||
1572 | .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, | ||
1550 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, | 1573 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, |
1551 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, | 1574 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, |
1552 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, | 1575 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, |
1553 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | ||
1554 | 1576 | ||
1555 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | 1577 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, |
1556 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, | 1578 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, |
@@ -1724,6 +1746,7 @@ static const struct usb_device_id option_ids[] = { | |||
1724 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ | 1746 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ |
1725 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ | 1747 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ |
1726 | { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, | 1748 | { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, |
1749 | { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, | ||
1727 | { } /* Terminating entry */ | 1750 | { } /* Terminating entry */ |
1728 | }; | 1751 | }; |
1729 | MODULE_DEVICE_TABLE(usb, option_ids); | 1752 | MODULE_DEVICE_TABLE(usb, option_ids); |
@@ -1916,6 +1939,8 @@ static void option_instat_callback(struct urb *urb) | |||
1916 | dev_dbg(dev, "%s: type %x req %x\n", __func__, | 1939 | dev_dbg(dev, "%s: type %x req %x\n", __func__, |
1917 | req_pkt->bRequestType, req_pkt->bRequest); | 1940 | req_pkt->bRequestType, req_pkt->bRequest); |
1918 | } | 1941 | } |
1942 | } else if (status == -ENOENT || status == -ESHUTDOWN) { | ||
1943 | dev_dbg(dev, "%s: urb stopped: %d\n", __func__, status); | ||
1919 | } else | 1944 | } else |
1920 | dev_err(dev, "%s: error %d\n", __func__, status); | 1945 | dev_err(dev, "%s: error %d\n", __func__, status); |
1921 | 1946 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index b3d5a35c0d4b..e9bad928039f 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -45,6 +45,7 @@ static const struct usb_device_id id_table[] = { | |||
45 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, | 45 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
46 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, | 46 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
47 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, | 47 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, |
48 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) }, | ||
48 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 49 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
49 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 50 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
50 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 51 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 42bc082896ac..71fd9da1d6e7 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 | 22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 |
23 | #define PL2303_PRODUCT_ID_HCR331 0x331a | 23 | #define PL2303_PRODUCT_ID_HCR331 0x331a |
24 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 | 24 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 |
25 | #define PL2303_PRODUCT_ID_ZTEK 0xe1f1 | ||
25 | 26 | ||
26 | #define ATEN_VENDOR_ID 0x0557 | 27 | #define ATEN_VENDOR_ID 0x0557 |
27 | #define ATEN_VENDOR_ID2 0x0547 | 28 | #define ATEN_VENDOR_ID2 0x0547 |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 6f7f01eb556a..46179a0828eb 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -282,14 +282,19 @@ static const struct usb_device_id id_table[] = { | |||
282 | /* Sierra Wireless HSPA Non-Composite Device */ | 282 | /* Sierra Wireless HSPA Non-Composite Device */ |
283 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 283 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
284 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | 284 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
285 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 285 | /* Sierra Wireless Direct IP modems */ |
286 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68A3, 0xFF, 0xFF, 0xFF), | ||
287 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
288 | }, | ||
289 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), | ||
286 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
287 | }, | 291 | }, |
288 | /* AT&T Direct IP LTE modems */ | 292 | /* AT&T Direct IP LTE modems */ |
289 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), | 293 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), |
290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 294 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
291 | }, | 295 | }, |
292 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ | 296 | /* Airprime/Sierra Wireless Direct IP modems */ |
297 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68A3, 0xFF, 0xFF, 0xFF), | ||
293 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 298 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
294 | }, | 299 | }, |
295 | 300 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 02de3110fe94..475723c006f9 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -764,29 +764,39 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
764 | if (usb_endpoint_is_bulk_in(endpoint)) { | 764 | if (usb_endpoint_is_bulk_in(endpoint)) { |
765 | /* we found a bulk in endpoint */ | 765 | /* we found a bulk in endpoint */ |
766 | dev_dbg(ddev, "found bulk in on endpoint %d\n", i); | 766 | dev_dbg(ddev, "found bulk in on endpoint %d\n", i); |
767 | bulk_in_endpoint[num_bulk_in] = endpoint; | 767 | if (num_bulk_in < MAX_NUM_PORTS) { |
768 | ++num_bulk_in; | 768 | bulk_in_endpoint[num_bulk_in] = endpoint; |
769 | ++num_bulk_in; | ||
770 | } | ||
769 | } | 771 | } |
770 | 772 | ||
771 | if (usb_endpoint_is_bulk_out(endpoint)) { | 773 | if (usb_endpoint_is_bulk_out(endpoint)) { |
772 | /* we found a bulk out endpoint */ | 774 | /* we found a bulk out endpoint */ |
773 | dev_dbg(ddev, "found bulk out on endpoint %d\n", i); | 775 | dev_dbg(ddev, "found bulk out on endpoint %d\n", i); |
774 | bulk_out_endpoint[num_bulk_out] = endpoint; | 776 | if (num_bulk_out < MAX_NUM_PORTS) { |
775 | ++num_bulk_out; | 777 | bulk_out_endpoint[num_bulk_out] = endpoint; |
778 | ++num_bulk_out; | ||
779 | } | ||
776 | } | 780 | } |
777 | 781 | ||
778 | if (usb_endpoint_is_int_in(endpoint)) { | 782 | if (usb_endpoint_is_int_in(endpoint)) { |
779 | /* we found a interrupt in endpoint */ | 783 | /* we found a interrupt in endpoint */ |
780 | dev_dbg(ddev, "found interrupt in on endpoint %d\n", i); | 784 | dev_dbg(ddev, "found interrupt in on endpoint %d\n", i); |
781 | interrupt_in_endpoint[num_interrupt_in] = endpoint; | 785 | if (num_interrupt_in < MAX_NUM_PORTS) { |
782 | ++num_interrupt_in; | 786 | interrupt_in_endpoint[num_interrupt_in] = |
787 | endpoint; | ||
788 | ++num_interrupt_in; | ||
789 | } | ||
783 | } | 790 | } |
784 | 791 | ||
785 | if (usb_endpoint_is_int_out(endpoint)) { | 792 | if (usb_endpoint_is_int_out(endpoint)) { |
786 | /* we found an interrupt out endpoint */ | 793 | /* we found an interrupt out endpoint */ |
787 | dev_dbg(ddev, "found interrupt out on endpoint %d\n", i); | 794 | dev_dbg(ddev, "found interrupt out on endpoint %d\n", i); |
788 | interrupt_out_endpoint[num_interrupt_out] = endpoint; | 795 | if (num_interrupt_out < MAX_NUM_PORTS) { |
789 | ++num_interrupt_out; | 796 | interrupt_out_endpoint[num_interrupt_out] = |
797 | endpoint; | ||
798 | ++num_interrupt_out; | ||
799 | } | ||
790 | } | 800 | } |
791 | } | 801 | } |
792 | 802 | ||
@@ -809,8 +819,10 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
809 | if (usb_endpoint_is_int_in(endpoint)) { | 819 | if (usb_endpoint_is_int_in(endpoint)) { |
810 | /* we found a interrupt in endpoint */ | 820 | /* we found a interrupt in endpoint */ |
811 | dev_dbg(ddev, "found interrupt in for Prolific device on separate interface\n"); | 821 | dev_dbg(ddev, "found interrupt in for Prolific device on separate interface\n"); |
812 | interrupt_in_endpoint[num_interrupt_in] = endpoint; | 822 | if (num_interrupt_in < MAX_NUM_PORTS) { |
813 | ++num_interrupt_in; | 823 | interrupt_in_endpoint[num_interrupt_in] = endpoint; |
824 | ++num_interrupt_in; | ||
825 | } | ||
814 | } | 826 | } |
815 | } | 827 | } |
816 | } | 828 | } |
@@ -850,6 +862,11 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
850 | num_ports = type->num_ports; | 862 | num_ports = type->num_ports; |
851 | } | 863 | } |
852 | 864 | ||
865 | if (num_ports > MAX_NUM_PORTS) { | ||
866 | dev_warn(ddev, "too many ports requested: %d\n", num_ports); | ||
867 | num_ports = MAX_NUM_PORTS; | ||
868 | } | ||
869 | |||
853 | serial->num_ports = num_ports; | 870 | serial->num_ports = num_ports; |
854 | serial->num_bulk_in = num_bulk_in; | 871 | serial->num_bulk_in = num_bulk_in; |
855 | serial->num_bulk_out = num_bulk_out; | 872 | serial->num_bulk_out = num_bulk_out; |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index e62f2dff8b7d..6c3734d2b45a 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -514,6 +514,10 @@ static void command_port_read_callback(struct urb *urb) | |||
514 | dev_dbg(&urb->dev->dev, "%s - command_info is NULL, exiting.\n", __func__); | 514 | dev_dbg(&urb->dev->dev, "%s - command_info is NULL, exiting.\n", __func__); |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | if (!urb->actual_length) { | ||
518 | dev_dbg(&urb->dev->dev, "%s - empty response, exiting.\n", __func__); | ||
519 | return; | ||
520 | } | ||
517 | if (status) { | 521 | if (status) { |
518 | dev_dbg(&urb->dev->dev, "%s - nonzero urb status: %d\n", __func__, status); | 522 | dev_dbg(&urb->dev->dev, "%s - nonzero urb status: %d\n", __func__, status); |
519 | if (status != -ENOENT) | 523 | if (status != -ENOENT) |
@@ -534,7 +538,8 @@ static void command_port_read_callback(struct urb *urb) | |||
534 | /* These are unsolicited reports from the firmware, hence no | 538 | /* These are unsolicited reports from the firmware, hence no |
535 | waiting command to wakeup */ | 539 | waiting command to wakeup */ |
536 | dev_dbg(&urb->dev->dev, "%s - event received\n", __func__); | 540 | dev_dbg(&urb->dev->dev, "%s - event received\n", __func__); |
537 | } else if (data[0] == WHITEHEAT_GET_DTR_RTS) { | 541 | } else if ((data[0] == WHITEHEAT_GET_DTR_RTS) && |
542 | (urb->actual_length - 1 <= sizeof(command_info->result_buffer))) { | ||
538 | memcpy(command_info->result_buffer, &data[1], | 543 | memcpy(command_info->result_buffer, &data[1], |
539 | urb->actual_length - 1); | 544 | urb->actual_length - 1); |
540 | command_info->command_finished = WHITEHEAT_CMD_COMPLETE; | 545 | command_info->command_finished = WHITEHEAT_CMD_COMPLETE; |
diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c index e40ab739c4a6..c9bb107d5e5c 100644 --- a/drivers/usb/serial/zte_ev.c +++ b/drivers/usb/serial/zte_ev.c | |||
@@ -272,28 +272,16 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | static const struct usb_device_id id_table[] = { | 274 | static const struct usb_device_id id_table[] = { |
275 | /* AC8710, AC8710T */ | 275 | { USB_DEVICE(0x19d2, 0xffec) }, |
276 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) }, | 276 | { USB_DEVICE(0x19d2, 0xffee) }, |
277 | /* AC8700 */ | ||
278 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) }, | ||
279 | /* MG880 */ | ||
280 | { USB_DEVICE(0x19d2, 0xfffd) }, | ||
281 | { USB_DEVICE(0x19d2, 0xfffc) }, | ||
282 | { USB_DEVICE(0x19d2, 0xfffb) }, | ||
283 | /* AC8710_V3 */ | ||
284 | { USB_DEVICE(0x19d2, 0xfff6) }, | 277 | { USB_DEVICE(0x19d2, 0xfff6) }, |
285 | { USB_DEVICE(0x19d2, 0xfff7) }, | 278 | { USB_DEVICE(0x19d2, 0xfff7) }, |
286 | { USB_DEVICE(0x19d2, 0xfff8) }, | 279 | { USB_DEVICE(0x19d2, 0xfff8) }, |
287 | { USB_DEVICE(0x19d2, 0xfff9) }, | 280 | { USB_DEVICE(0x19d2, 0xfff9) }, |
288 | { USB_DEVICE(0x19d2, 0xffee) }, | 281 | { USB_DEVICE(0x19d2, 0xfffb) }, |
289 | /* AC2716, MC2716 */ | 282 | { USB_DEVICE(0x19d2, 0xfffc) }, |
290 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) }, | 283 | /* MG880 */ |
291 | /* AD3812 */ | 284 | { USB_DEVICE(0x19d2, 0xfffd) }, |
292 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffeb, 0xff, 0xff, 0xff) }, | ||
293 | { USB_DEVICE(0x19d2, 0xffec) }, | ||
294 | { USB_DEVICE(0x05C6, 0x3197) }, | ||
295 | { USB_DEVICE(0x05C6, 0x6000) }, | ||
296 | { USB_DEVICE(0x05C6, 0x9008) }, | ||
297 | { }, | 285 | { }, |
298 | }; | 286 | }; |
299 | MODULE_DEVICE_TABLE(usb, id_table); | 287 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h index 503ac5c8d80f..8a6f371ed6e7 100644 --- a/drivers/usb/storage/uas-detect.h +++ b/drivers/usb/storage/uas-detect.h | |||
@@ -59,10 +59,6 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
59 | unsigned long flags = id->driver_info; | 59 | unsigned long flags = id->driver_info; |
60 | int r, alt; | 60 | int r, alt; |
61 | 61 | ||
62 | usb_stor_adjust_quirks(udev, &flags); | ||
63 | |||
64 | if (flags & US_FL_IGNORE_UAS) | ||
65 | return 0; | ||
66 | 62 | ||
67 | alt = uas_find_uas_alt_setting(intf); | 63 | alt = uas_find_uas_alt_setting(intf); |
68 | if (alt < 0) | 64 | if (alt < 0) |
@@ -72,6 +68,29 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
72 | if (r < 0) | 68 | if (r < 0) |
73 | return 0; | 69 | return 0; |
74 | 70 | ||
71 | /* | ||
72 | * ASM1051 and older ASM1053 devices have the same usb-id, and UAS is | ||
73 | * broken on the ASM1051, use the number of streams to differentiate. | ||
74 | * New ASM1053-s also support 32 streams, but have a different prod-id. | ||
75 | */ | ||
76 | if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c && | ||
77 | le16_to_cpu(udev->descriptor.idProduct) == 0x55aa) { | ||
78 | if (udev->speed < USB_SPEED_SUPER) { | ||
79 | /* No streams info, assume ASM1051 */ | ||
80 | flags |= US_FL_IGNORE_UAS; | ||
81 | } else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) { | ||
82 | flags |= US_FL_IGNORE_UAS; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | usb_stor_adjust_quirks(udev, &flags); | ||
87 | |||
88 | if (flags & US_FL_IGNORE_UAS) { | ||
89 | dev_warn(&udev->dev, | ||
90 | "UAS is blacklisted for this device, using usb-storage instead\n"); | ||
91 | return 0; | ||
92 | } | ||
93 | |||
75 | if (udev->bus->sg_tablesize == 0) { | 94 | if (udev->bus->sg_tablesize == 0) { |
76 | dev_warn(&udev->dev, | 95 | dev_warn(&udev->dev, |
77 | "The driver for the USB controller %s does not support scatter-gather which is\n", | 96 | "The driver for the USB controller %s does not support scatter-gather which is\n", |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 80a5b366255f..4a5c68a47e46 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -101,6 +101,12 @@ UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x0001, | |||
101 | "PhotoSmart R707", | 101 | "PhotoSmart R707", |
102 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), | 102 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), |
103 | 103 | ||
104 | UNUSUAL_DEV( 0x03f3, 0x0001, 0x0000, 0x9999, | ||
105 | "Adaptec", | ||
106 | "USBConnect 2000", | ||
107 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
108 | US_FL_SCM_MULT_TARG ), | ||
109 | |||
104 | /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> | 110 | /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> |
105 | * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) | 111 | * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) |
106 | * for USB floppies that need the SINGLE_LUN enforcement. | 112 | * for USB floppies that need the SINGLE_LUN enforcement. |
@@ -741,6 +747,12 @@ UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x0100, | |||
741 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 747 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
742 | US_FL_SINGLE_LUN ), | 748 | US_FL_SINGLE_LUN ), |
743 | 749 | ||
750 | UNUSUAL_DEV( 0x059b, 0x0040, 0x0100, 0x0100, | ||
751 | "Iomega", | ||
752 | "Jaz USB Adapter", | ||
753 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
754 | US_FL_SINGLE_LUN ), | ||
755 | |||
744 | /* Reported by <Hendryk.Pfeiffer@gmx.de> */ | 756 | /* Reported by <Hendryk.Pfeiffer@gmx.de> */ |
745 | UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, | 757 | UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, |
746 | "LaCie", | 758 | "LaCie", |
@@ -922,6 +934,12 @@ UNUSUAL_DEV( 0x069b, 0x3004, 0x0001, 0x0001, | |||
922 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 934 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
923 | US_FL_FIX_CAPACITY ), | 935 | US_FL_FIX_CAPACITY ), |
924 | 936 | ||
937 | UNUSUAL_DEV( 0x06ca, 0x2003, 0x0100, 0x0100, | ||
938 | "Newer Technology", | ||
939 | "uSCSI", | ||
940 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
941 | US_FL_SCM_MULT_TARG ), | ||
942 | |||
925 | /* Reported by Adrian Pilchowiec <adi1981@epf.pl> */ | 943 | /* Reported by Adrian Pilchowiec <adi1981@epf.pl> */ |
926 | UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000, | 944 | UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000, |
927 | "RockChip", | 945 | "RockChip", |
@@ -1113,6 +1131,18 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200, | |||
1113 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1131 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1114 | US_FL_NOT_LOCKABLE), | 1132 | US_FL_NOT_LOCKABLE), |
1115 | 1133 | ||
1134 | UNUSUAL_DEV( 0x085a, 0x0026, 0x0100, 0x0133, | ||
1135 | "Xircom", | ||
1136 | "PortGear USB-SCSI (Mac USB Dock)", | ||
1137 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1138 | US_FL_SCM_MULT_TARG ), | ||
1139 | |||
1140 | UNUSUAL_DEV( 0x085a, 0x0028, 0x0100, 0x0133, | ||
1141 | "Xircom", | ||
1142 | "PortGear USB to SCSI Converter", | ||
1143 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1144 | US_FL_SCM_MULT_TARG ), | ||
1145 | |||
1116 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ | 1146 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ |
1117 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, | 1147 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, |
1118 | "CITIZEN", | 1148 | "CITIZEN", |
@@ -1952,6 +1982,14 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100, | |||
1952 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1982 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1953 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | 1983 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), |
1954 | 1984 | ||
1985 | /* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) | ||
1986 | * and Mac USB Dock USB-SCSI */ | ||
1987 | UNUSUAL_DEV( 0x1645, 0x0007, 0x0100, 0x0133, | ||
1988 | "Entrega Technologies", | ||
1989 | "USB to SCSI Converter", | ||
1990 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1991 | US_FL_SCM_MULT_TARG ), | ||
1992 | |||
1955 | /* Reported by Robert Schedel <r.schedel@yahoo.de> | 1993 | /* Reported by Robert Schedel <r.schedel@yahoo.de> |
1956 | * Note: this is a 'super top' device like the above 14cd/6600 device */ | 1994 | * Note: this is a 'super top' device like the above 14cd/6600 device */ |
1957 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, | 1995 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, |
@@ -1974,6 +2012,12 @@ UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000, | |||
1974 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2012 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1975 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), | 2013 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), |
1976 | 2014 | ||
2015 | UNUSUAL_DEV( 0x1822, 0x0001, 0x0000, 0x9999, | ||
2016 | "Ariston Technologies", | ||
2017 | "iConnect USB to SCSI adapter", | ||
2018 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
2019 | US_FL_SCM_MULT_TARG ), | ||
2020 | |||
1977 | /* Reported by Hans de Goede <hdegoede@redhat.com> | 2021 | /* Reported by Hans de Goede <hdegoede@redhat.com> |
1978 | * These Appotech controllers are found in Picture Frames, they provide a | 2022 | * These Appotech controllers are found in Picture Frames, they provide a |
1979 | * (buggy) emulation of a cdrom drive which contains the windows software | 2023 | * (buggy) emulation of a cdrom drive which contains the windows software |
diff --git a/drivers/staging/usbip/Kconfig b/drivers/usb/usbip/Kconfig index bd99e9e47e50..bd99e9e47e50 100644 --- a/drivers/staging/usbip/Kconfig +++ b/drivers/usb/usbip/Kconfig | |||
diff --git a/drivers/staging/usbip/Makefile b/drivers/usb/usbip/Makefile index 9ecd61545be1..9ecd61545be1 100644 --- a/drivers/staging/usbip/Makefile +++ b/drivers/usb/usbip/Makefile | |||
diff --git a/drivers/staging/usbip/README b/drivers/usb/usbip/README index 41a2cf2e77a6..41a2cf2e77a6 100644 --- a/drivers/staging/usbip/README +++ b/drivers/usb/usbip/README | |||
diff --git a/drivers/staging/usbip/stub.h b/drivers/usb/usbip/stub.h index 266e2b0ce9a8..266e2b0ce9a8 100644 --- a/drivers/staging/usbip/stub.h +++ b/drivers/usb/usbip/stub.h | |||
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c index 51d0c7188738..fac20e0434c0 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/usb/usbip/stub_dev.c | |||
@@ -26,33 +26,6 @@ | |||
26 | #include "stub.h" | 26 | #include "stub.h" |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Define device IDs here if you want to explicitly limit exportable devices. | ||
30 | * In most cases, wildcard matching will be okay because driver binding can be | ||
31 | * changed dynamically by a userland program. | ||
32 | */ | ||
33 | static struct usb_device_id stub_table[] = { | ||
34 | #if 0 | ||
35 | /* just an example */ | ||
36 | { USB_DEVICE(0x05ac, 0x0301) }, /* Mac 1 button mouse */ | ||
37 | { USB_DEVICE(0x0430, 0x0009) }, /* Plat Home Keyboard */ | ||
38 | { USB_DEVICE(0x059b, 0x0001) }, /* Iomega USB Zip 100 */ | ||
39 | { USB_DEVICE(0x04b3, 0x4427) }, /* IBM USB CD-ROM */ | ||
40 | { USB_DEVICE(0x05a9, 0xa511) }, /* LifeView USB cam */ | ||
41 | { USB_DEVICE(0x55aa, 0x0201) }, /* Imation card reader */ | ||
42 | { USB_DEVICE(0x046d, 0x0870) }, /* Qcam Express(QV-30) */ | ||
43 | { USB_DEVICE(0x04bb, 0x0101) }, /* IO-DATA HD 120GB */ | ||
44 | { USB_DEVICE(0x04bb, 0x0904) }, /* IO-DATA USB-ET/TX */ | ||
45 | { USB_DEVICE(0x04bb, 0x0201) }, /* IO-DATA USB-ET/TX */ | ||
46 | { USB_DEVICE(0x08bb, 0x2702) }, /* ONKYO USB Speaker */ | ||
47 | { USB_DEVICE(0x046d, 0x08b2) }, /* Logicool Qcam 4000 Pro */ | ||
48 | #endif | ||
49 | /* magic for wild card */ | ||
50 | { .driver_info = 1 }, | ||
51 | { 0, } /* Terminating entry */ | ||
52 | }; | ||
53 | MODULE_DEVICE_TABLE(usb, stub_table); | ||
54 | |||
55 | /* | ||
56 | * usbip_status shows the status of usbip-host as long as this driver is bound | 29 | * usbip_status shows the status of usbip-host as long as this driver is bound |
57 | * to the target device. | 30 | * to the target device. |
58 | */ | 31 | */ |
diff --git a/drivers/staging/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c index 44ab43fc4fcc..44ab43fc4fcc 100644 --- a/drivers/staging/usbip/stub_main.c +++ b/drivers/usb/usbip/stub_main.c | |||
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c index 00e475c51a12..00e475c51a12 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/usb/usbip/stub_rx.c | |||
diff --git a/drivers/staging/usbip/stub_tx.c b/drivers/usb/usbip/stub_tx.c index dbcabc9dbe0d..dbcabc9dbe0d 100644 --- a/drivers/staging/usbip/stub_tx.c +++ b/drivers/usb/usbip/stub_tx.c | |||
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/usb/usbip/usbip_common.c index facaaf003f19..facaaf003f19 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/usb/usbip/usbip_common.c | |||
diff --git a/drivers/staging/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h index 4da3866a037d..86b08475c254 100644 --- a/drivers/staging/usbip/usbip_common.h +++ b/drivers/usb/usbip/usbip_common.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #include <linux/usb.h> | 30 | #include <linux/usb.h> |
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | #include "uapi/usbip.h" | 32 | #include <uapi/linux/usbip.h> |
33 | 33 | ||
34 | #define USBIP_VERSION "1.0.0" | 34 | #define USBIP_VERSION "1.0.0" |
35 | 35 | ||
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c index 64933b993d7a..64933b993d7a 100644 --- a/drivers/staging/usbip/usbip_event.c +++ b/drivers/usb/usbip/usbip_event.c | |||
diff --git a/drivers/staging/usbip/usbip_protocol.txt b/drivers/usb/usbip/usbip_protocol.txt index 16b6fe27284c..16b6fe27284c 100644 --- a/drivers/staging/usbip/usbip_protocol.txt +++ b/drivers/usb/usbip/usbip_protocol.txt | |||
diff --git a/drivers/staging/usbip/vhci.h b/drivers/usb/usbip/vhci.h index a863a98a91ce..a863a98a91ce 100644 --- a/drivers/staging/usbip/vhci.h +++ b/drivers/usb/usbip/vhci.h | |||
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index c02374b6049c..c02374b6049c 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c | |||
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/usb/usbip/vhci_rx.c index 00e4a54308e4..00e4a54308e4 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/usb/usbip/vhci_rx.c | |||
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c index 211f43f67ea2..211f43f67ea2 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/usb/usbip/vhci_sysfs.c | |||
diff --git a/drivers/staging/usbip/vhci_tx.c b/drivers/usb/usbip/vhci_tx.c index 409fd99f3257..409fd99f3257 100644 --- a/drivers/staging/usbip/vhci_tx.c +++ b/drivers/usb/usbip/vhci_tx.c | |||
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c index 3e2e4ed20157..e279015be466 100644 --- a/drivers/usb/wusbcore/wa-xfer.c +++ b/drivers/usb/wusbcore/wa-xfer.c | |||
@@ -2602,6 +2602,7 @@ static void wa_buf_in_cb(struct urb *urb) | |||
2602 | dev = &wa->usb_iface->dev; | 2602 | dev = &wa->usb_iface->dev; |
2603 | --(wa->active_buf_in_urbs); | 2603 | --(wa->active_buf_in_urbs); |
2604 | active_buf_in_urbs = wa->active_buf_in_urbs; | 2604 | active_buf_in_urbs = wa->active_buf_in_urbs; |
2605 | rpipe = xfer->ep->hcpriv; | ||
2605 | 2606 | ||
2606 | if (usb_pipeisoc(xfer->urb->pipe)) { | 2607 | if (usb_pipeisoc(xfer->urb->pipe)) { |
2607 | struct usb_iso_packet_descriptor *iso_frame_desc = | 2608 | struct usb_iso_packet_descriptor *iso_frame_desc = |
@@ -2659,7 +2660,6 @@ static void wa_buf_in_cb(struct urb *urb) | |||
2659 | resubmit_dti = (isoc_data_frame_count == | 2660 | resubmit_dti = (isoc_data_frame_count == |
2660 | urb_frame_count); | 2661 | urb_frame_count); |
2661 | } else if (active_buf_in_urbs == 0) { | 2662 | } else if (active_buf_in_urbs == 0) { |
2662 | rpipe = xfer->ep->hcpriv; | ||
2663 | dev_dbg(dev, | 2663 | dev_dbg(dev, |
2664 | "xfer %p 0x%08X#%u: data in done (%zu bytes)\n", | 2664 | "xfer %p 0x%08X#%u: data in done (%zu bytes)\n", |
2665 | xfer, wa_xfer_id(xfer), seg->index, | 2665 | xfer, wa_xfer_id(xfer), seg->index, |
@@ -2685,7 +2685,6 @@ static void wa_buf_in_cb(struct urb *urb) | |||
2685 | */ | 2685 | */ |
2686 | resubmit_dti = wa->dti_state != WA_DTI_TRANSFER_RESULT_PENDING; | 2686 | resubmit_dti = wa->dti_state != WA_DTI_TRANSFER_RESULT_PENDING; |
2687 | spin_lock_irqsave(&xfer->lock, flags); | 2687 | spin_lock_irqsave(&xfer->lock, flags); |
2688 | rpipe = xfer->ep->hcpriv; | ||
2689 | if (printk_ratelimit()) | 2688 | if (printk_ratelimit()) |
2690 | dev_err(dev, "xfer %p 0x%08X#%u: data in error %d\n", | 2689 | dev_err(dev, "xfer %p 0x%08X#%u: data in error %d\n", |
2691 | xfer, wa_xfer_id(xfer), seg->index, | 2690 | xfer, wa_xfer_id(xfer), seg->index, |
diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c index 80079b8fed15..d0303f0dbe15 100644 --- a/drivers/uwb/lc-dev.c +++ b/drivers/uwb/lc-dev.c | |||
@@ -431,16 +431,19 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) | |||
431 | uwb_dev->mac_addr = *bce->mac_addr; | 431 | uwb_dev->mac_addr = *bce->mac_addr; |
432 | uwb_dev->dev_addr = bce->dev_addr; | 432 | uwb_dev->dev_addr = bce->dev_addr; |
433 | dev_set_name(&uwb_dev->dev, "%s", macbuf); | 433 | dev_set_name(&uwb_dev->dev, "%s", macbuf); |
434 | |||
435 | /* plug the beacon cache */ | ||
436 | bce->uwb_dev = uwb_dev; | ||
437 | uwb_dev->bce = bce; | ||
438 | uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ | ||
439 | |||
434 | result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc); | 440 | result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc); |
435 | if (result < 0) { | 441 | if (result < 0) { |
436 | dev_err(dev, "new device %s: cannot instantiate device\n", | 442 | dev_err(dev, "new device %s: cannot instantiate device\n", |
437 | macbuf); | 443 | macbuf); |
438 | goto error_dev_add; | 444 | goto error_dev_add; |
439 | } | 445 | } |
440 | /* plug the beacon cache */ | 446 | |
441 | bce->uwb_dev = uwb_dev; | ||
442 | uwb_dev->bce = bce; | ||
443 | uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ | ||
444 | dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n", | 447 | dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n", |
445 | macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name, | 448 | macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name, |
446 | dev_name(rc->uwb_dev.dev.parent)); | 449 | dev_name(rc->uwb_dev.dev.parent)); |
@@ -448,6 +451,8 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) | |||
448 | return; | 451 | return; |
449 | 452 | ||
450 | error_dev_add: | 453 | error_dev_add: |
454 | bce->uwb_dev = NULL; | ||
455 | uwb_bce_put(bce); | ||
451 | kfree(uwb_dev); | 456 | kfree(uwb_dev); |
452 | return; | 457 | return; |
453 | } | 458 | } |
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index d7a3d13e72ec..b85983e97f0a 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
@@ -173,6 +173,7 @@ static int pwm_backlight_parse_dt(struct device *dev, | |||
173 | data->max_brightness--; | 173 | data->max_brightness--; |
174 | } | 174 | } |
175 | 175 | ||
176 | data->enable_gpio = -EINVAL; | ||
176 | return 0; | 177 | return 0; |
177 | } | 178 | } |
178 | 179 | ||
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index beadd3edaa17..6ad23bd3523a 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/amba/bus.h> | 25 | #include <linux/amba/bus.h> |
26 | #include <linux/amba/clcd.h> | 26 | #include <linux/amba/clcd.h> |
27 | #include <linux/bitops.h> | ||
27 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
28 | #include <linux/hardirq.h> | 29 | #include <linux/hardirq.h> |
29 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
@@ -638,9 +639,7 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) | |||
638 | if (g0 != panels[i].g0) | 639 | if (g0 != panels[i].g0) |
639 | continue; | 640 | continue; |
640 | if (r0 == panels[i].r0 && b0 == panels[i].b0) | 641 | if (r0 == panels[i].r0 && b0 == panels[i].b0) |
641 | fb->panel->caps = panels[i].caps & CLCD_CAP_RGB; | 642 | fb->panel->caps = panels[i].caps; |
642 | if (r0 == panels[i].b0 && b0 == panels[i].r0) | ||
643 | fb->panel->caps = panels[i].caps & CLCD_CAP_BGR; | ||
644 | } | 643 | } |
645 | 644 | ||
646 | return fb->panel->caps ? 0 : -EINVAL; | 645 | return fb->panel->caps ? 0 : -EINVAL; |
@@ -650,6 +649,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) | |||
650 | { | 649 | { |
651 | struct device_node *endpoint; | 650 | struct device_node *endpoint; |
652 | int err; | 651 | int err; |
652 | unsigned int bpp; | ||
653 | u32 max_bandwidth; | 653 | u32 max_bandwidth; |
654 | u32 tft_r0b0g0[3]; | 654 | u32 tft_r0b0g0[3]; |
655 | 655 | ||
@@ -667,11 +667,22 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) | |||
667 | 667 | ||
668 | err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", | 668 | err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", |
669 | &max_bandwidth); | 669 | &max_bandwidth); |
670 | if (!err) | 670 | if (!err) { |
671 | fb->panel->bpp = 8 * max_bandwidth / (fb->panel->mode.xres * | 671 | /* |
672 | fb->panel->mode.yres * fb->panel->mode.refresh); | 672 | * max_bandwidth is in bytes per second and pixclock in |
673 | else | 673 | * pico-seconds, so the maximum allowed bits per pixel is |
674 | fb->panel->bpp = 32; | 674 | * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000) |
675 | * Rearrange this calculation to avoid overflow and then ensure | ||
676 | * result is a valid format. | ||
677 | */ | ||
678 | bpp = max_bandwidth / (1000 / 8) | ||
679 | / PICOS2KHZ(fb->panel->mode.pixclock); | ||
680 | bpp = rounddown_pow_of_two(bpp); | ||
681 | if (bpp > 32) | ||
682 | bpp = 32; | ||
683 | } else | ||
684 | bpp = 32; | ||
685 | fb->panel->bpp = bpp; | ||
675 | 686 | ||
676 | #ifdef CONFIG_CPU_BIG_ENDIAN | 687 | #ifdef CONFIG_CPU_BIG_ENDIAN |
677 | fb->panel->cntl |= CNTL_BEBO; | 688 | fb->panel->cntl |= CNTL_BEBO; |
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index 92640d46770a..1d8bdb92939b 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
@@ -1102,12 +1102,14 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
1102 | timings = of_get_display_timings(display_np); | 1102 | timings = of_get_display_timings(display_np); |
1103 | if (!timings) { | 1103 | if (!timings) { |
1104 | dev_err(dev, "failed to get display timings\n"); | 1104 | dev_err(dev, "failed to get display timings\n"); |
1105 | ret = -EINVAL; | ||
1105 | goto put_display_node; | 1106 | goto put_display_node; |
1106 | } | 1107 | } |
1107 | 1108 | ||
1108 | timings_np = of_find_node_by_name(display_np, "display-timings"); | 1109 | timings_np = of_find_node_by_name(display_np, "display-timings"); |
1109 | if (!timings_np) { | 1110 | if (!timings_np) { |
1110 | dev_err(dev, "failed to find display-timings node\n"); | 1111 | dev_err(dev, "failed to find display-timings node\n"); |
1112 | ret = -ENODEV; | ||
1111 | goto put_display_node; | 1113 | goto put_display_node; |
1112 | } | 1114 | } |
1113 | 1115 | ||
diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c index 206a66b61072..59abdc6a97f6 100644 --- a/drivers/video/fbdev/chipsfb.c +++ b/drivers/video/fbdev/chipsfb.c | |||
@@ -273,7 +273,7 @@ static struct chips_init_reg chips_init_xr[] = { | |||
273 | { 0xa8, 0x00 } | 273 | { 0xa8, 0x00 } |
274 | }; | 274 | }; |
275 | 275 | ||
276 | static void __init chips_hw_init(void) | 276 | static void chips_hw_init(void) |
277 | { | 277 | { |
278 | int i; | 278 | int i; |
279 | 279 | ||
diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 788f6b37fce7..10c876c95772 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c | |||
@@ -419,7 +419,7 @@ static void lcd_cfg_horizontal_sync(int back_porch, int pulse_width, | |||
419 | { | 419 | { |
420 | u32 reg; | 420 | u32 reg; |
421 | 421 | ||
422 | reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0xf; | 422 | reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0x3ff; |
423 | reg |= (((back_porch-1) & 0xff) << 24) | 423 | reg |= (((back_porch-1) & 0xff) << 24) |
424 | | (((front_porch-1) & 0xff) << 16) | 424 | | (((front_porch-1) & 0xff) << 16) |
425 | | (((pulse_width-1) & 0x3f) << 10); | 425 | | (((pulse_width-1) & 0x3f) << 10); |
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 987edf110038..5c098d5b4043 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c | |||
@@ -236,6 +236,7 @@ timingfail: | |||
236 | if (native_mode) | 236 | if (native_mode) |
237 | of_node_put(native_mode); | 237 | of_node_put(native_mode); |
238 | display_timings_release(disp); | 238 | display_timings_release(disp); |
239 | disp = NULL; | ||
239 | entryfail: | 240 | entryfail: |
240 | kfree(disp); | 241 | kfree(disp); |
241 | dispfail: | 242 | dispfail: |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 5c660c77f03b..1e0a317d3dcd 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -230,8 +230,8 @@ static enum bp_state reserve_additional_memory(long credit) | |||
230 | rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); | 230 | rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); |
231 | 231 | ||
232 | if (rc) { | 232 | if (rc) { |
233 | pr_info("%s: add_memory() failed: %i\n", __func__, rc); | 233 | pr_warn("Cannot add additional memory (%i)\n", rc); |
234 | return BP_EAGAIN; | 234 | return BP_ECANCELED; |
235 | } | 235 | } |
236 | 236 | ||
237 | balloon_hotplug -= credit; | 237 | balloon_hotplug -= credit; |
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index 787d17945418..e53fe191738c 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c | |||
@@ -124,7 +124,7 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, | |||
124 | int i, rc, readonly; | 124 | int i, rc, readonly; |
125 | LIST_HEAD(queue_gref); | 125 | LIST_HEAD(queue_gref); |
126 | LIST_HEAD(queue_file); | 126 | LIST_HEAD(queue_file); |
127 | struct gntalloc_gref *gref; | 127 | struct gntalloc_gref *gref, *next; |
128 | 128 | ||
129 | readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); | 129 | readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); |
130 | rc = -ENOMEM; | 130 | rc = -ENOMEM; |
@@ -141,13 +141,11 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, | |||
141 | goto undo; | 141 | goto undo; |
142 | 142 | ||
143 | /* Grant foreign access to the page. */ | 143 | /* Grant foreign access to the page. */ |
144 | gref->gref_id = gnttab_grant_foreign_access(op->domid, | 144 | rc = gnttab_grant_foreign_access(op->domid, |
145 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); | 145 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); |
146 | if ((int)gref->gref_id < 0) { | 146 | if (rc < 0) |
147 | rc = gref->gref_id; | ||
148 | goto undo; | 147 | goto undo; |
149 | } | 148 | gref_ids[i] = gref->gref_id = rc; |
150 | gref_ids[i] = gref->gref_id; | ||
151 | } | 149 | } |
152 | 150 | ||
153 | /* Add to gref lists. */ | 151 | /* Add to gref lists. */ |
@@ -162,8 +160,8 @@ undo: | |||
162 | mutex_lock(&gref_mutex); | 160 | mutex_lock(&gref_mutex); |
163 | gref_size -= (op->count - i); | 161 | gref_size -= (op->count - i); |
164 | 162 | ||
165 | list_for_each_entry(gref, &queue_file, next_file) { | 163 | list_for_each_entry_safe(gref, next, &queue_file, next_file) { |
166 | /* __del_gref does not remove from queue_file */ | 164 | list_del(&gref->next_file); |
167 | __del_gref(gref); | 165 | __del_gref(gref); |
168 | } | 166 | } |
169 | 167 | ||
@@ -193,7 +191,7 @@ static void __del_gref(struct gntalloc_gref *gref) | |||
193 | 191 | ||
194 | gref->notify.flags = 0; | 192 | gref->notify.flags = 0; |
195 | 193 | ||
196 | if (gref->gref_id > 0) { | 194 | if (gref->gref_id) { |
197 | if (gnttab_query_foreign_access(gref->gref_id)) | 195 | if (gnttab_query_foreign_access(gref->gref_id)) |
198 | return; | 196 | return; |
199 | 197 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 5f1e1f3cd186..f8bb36f9d9ce 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -103,16 +103,11 @@ static void do_suspend(void) | |||
103 | 103 | ||
104 | shutting_down = SHUTDOWN_SUSPEND; | 104 | shutting_down = SHUTDOWN_SUSPEND; |
105 | 105 | ||
106 | #ifdef CONFIG_PREEMPT | ||
107 | /* If the kernel is preemptible, we need to freeze all the processes | ||
108 | to prevent them from being in the middle of a pagetable update | ||
109 | during suspend. */ | ||
110 | err = freeze_processes(); | 106 | err = freeze_processes(); |
111 | if (err) { | 107 | if (err) { |
112 | pr_err("%s: freeze failed %d\n", __func__, err); | 108 | pr_err("%s: freeze failed %d\n", __func__, err); |
113 | goto out; | 109 | goto out; |
114 | } | 110 | } |
115 | #endif | ||
116 | 111 | ||
117 | err = dpm_suspend_start(PMSG_FREEZE); | 112 | err = dpm_suspend_start(PMSG_FREEZE); |
118 | if (err) { | 113 | if (err) { |
@@ -157,10 +152,8 @@ out_resume: | |||
157 | dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); | 152 | dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); |
158 | 153 | ||
159 | out_thaw: | 154 | out_thaw: |
160 | #ifdef CONFIG_PREEMPT | ||
161 | thaw_processes(); | 155 | thaw_processes(); |
162 | out: | 156 | out: |
163 | #endif | ||
164 | shutting_down = SHUTDOWN_INVALID; | 157 | shutting_down = SHUTDOWN_INVALID; |
165 | } | 158 | } |
166 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ | 159 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
@@ -141,6 +141,7 @@ struct kioctx { | |||
141 | 141 | ||
142 | struct { | 142 | struct { |
143 | unsigned tail; | 143 | unsigned tail; |
144 | unsigned completed_events; | ||
144 | spinlock_t completion_lock; | 145 | spinlock_t completion_lock; |
145 | } ____cacheline_aligned_in_smp; | 146 | } ____cacheline_aligned_in_smp; |
146 | 147 | ||
@@ -792,6 +793,8 @@ void exit_aio(struct mm_struct *mm) | |||
792 | 793 | ||
793 | for (i = 0; i < table->nr; ++i) { | 794 | for (i = 0; i < table->nr; ++i) { |
794 | struct kioctx *ctx = table->table[i]; | 795 | struct kioctx *ctx = table->table[i]; |
796 | struct completion requests_done = | ||
797 | COMPLETION_INITIALIZER_ONSTACK(requests_done); | ||
795 | 798 | ||
796 | if (!ctx) | 799 | if (!ctx) |
797 | continue; | 800 | continue; |
@@ -803,7 +806,10 @@ void exit_aio(struct mm_struct *mm) | |||
803 | * that it needs to unmap the area, just set it to 0. | 806 | * that it needs to unmap the area, just set it to 0. |
804 | */ | 807 | */ |
805 | ctx->mmap_size = 0; | 808 | ctx->mmap_size = 0; |
806 | kill_ioctx(mm, ctx, NULL); | 809 | kill_ioctx(mm, ctx, &requests_done); |
810 | |||
811 | /* Wait until all IO for the context are done. */ | ||
812 | wait_for_completion(&requests_done); | ||
807 | } | 813 | } |
808 | 814 | ||
809 | RCU_INIT_POINTER(mm->ioctx_table, NULL); | 815 | RCU_INIT_POINTER(mm->ioctx_table, NULL); |
@@ -857,6 +863,68 @@ out: | |||
857 | return ret; | 863 | return ret; |
858 | } | 864 | } |
859 | 865 | ||
866 | /* refill_reqs_available | ||
867 | * Updates the reqs_available reference counts used for tracking the | ||
868 | * number of free slots in the completion ring. This can be called | ||
869 | * from aio_complete() (to optimistically update reqs_available) or | ||
870 | * from aio_get_req() (the we're out of events case). It must be | ||
871 | * called holding ctx->completion_lock. | ||
872 | */ | ||
873 | static void refill_reqs_available(struct kioctx *ctx, unsigned head, | ||
874 | unsigned tail) | ||
875 | { | ||
876 | unsigned events_in_ring, completed; | ||
877 | |||
878 | /* Clamp head since userland can write to it. */ | ||
879 | head %= ctx->nr_events; | ||
880 | if (head <= tail) | ||
881 | events_in_ring = tail - head; | ||
882 | else | ||
883 | events_in_ring = ctx->nr_events - (head - tail); | ||
884 | |||
885 | completed = ctx->completed_events; | ||
886 | if (events_in_ring < completed) | ||
887 | completed -= events_in_ring; | ||
888 | else | ||
889 | completed = 0; | ||
890 | |||
891 | if (!completed) | ||
892 | return; | ||
893 | |||
894 | ctx->completed_events -= completed; | ||
895 | put_reqs_available(ctx, completed); | ||
896 | } | ||
897 | |||
898 | /* user_refill_reqs_available | ||
899 | * Called to refill reqs_available when aio_get_req() encounters an | ||
900 | * out of space in the completion ring. | ||
901 | */ | ||
902 | static void user_refill_reqs_available(struct kioctx *ctx) | ||
903 | { | ||
904 | spin_lock_irq(&ctx->completion_lock); | ||
905 | if (ctx->completed_events) { | ||
906 | struct aio_ring *ring; | ||
907 | unsigned head; | ||
908 | |||
909 | /* Access of ring->head may race with aio_read_events_ring() | ||
910 | * here, but that's okay since whether we read the old version | ||
911 | * or the new version, and either will be valid. The important | ||
912 | * part is that head cannot pass tail since we prevent | ||
913 | * aio_complete() from updating tail by holding | ||
914 | * ctx->completion_lock. Even if head is invalid, the check | ||
915 | * against ctx->completed_events below will make sure we do the | ||
916 | * safe/right thing. | ||
917 | */ | ||
918 | ring = kmap_atomic(ctx->ring_pages[0]); | ||
919 | head = ring->head; | ||
920 | kunmap_atomic(ring); | ||
921 | |||
922 | refill_reqs_available(ctx, head, ctx->tail); | ||
923 | } | ||
924 | |||
925 | spin_unlock_irq(&ctx->completion_lock); | ||
926 | } | ||
927 | |||
860 | /* aio_get_req | 928 | /* aio_get_req |
861 | * Allocate a slot for an aio request. | 929 | * Allocate a slot for an aio request. |
862 | * Returns NULL if no requests are free. | 930 | * Returns NULL if no requests are free. |
@@ -865,8 +933,11 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx) | |||
865 | { | 933 | { |
866 | struct kiocb *req; | 934 | struct kiocb *req; |
867 | 935 | ||
868 | if (!get_reqs_available(ctx)) | 936 | if (!get_reqs_available(ctx)) { |
869 | return NULL; | 937 | user_refill_reqs_available(ctx); |
938 | if (!get_reqs_available(ctx)) | ||
939 | return NULL; | ||
940 | } | ||
870 | 941 | ||
871 | req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO); | 942 | req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO); |
872 | if (unlikely(!req)) | 943 | if (unlikely(!req)) |
@@ -925,8 +996,8 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
925 | struct kioctx *ctx = iocb->ki_ctx; | 996 | struct kioctx *ctx = iocb->ki_ctx; |
926 | struct aio_ring *ring; | 997 | struct aio_ring *ring; |
927 | struct io_event *ev_page, *event; | 998 | struct io_event *ev_page, *event; |
999 | unsigned tail, pos, head; | ||
928 | unsigned long flags; | 1000 | unsigned long flags; |
929 | unsigned tail, pos; | ||
930 | 1001 | ||
931 | /* | 1002 | /* |
932 | * Special case handling for sync iocbs: | 1003 | * Special case handling for sync iocbs: |
@@ -987,10 +1058,14 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
987 | ctx->tail = tail; | 1058 | ctx->tail = tail; |
988 | 1059 | ||
989 | ring = kmap_atomic(ctx->ring_pages[0]); | 1060 | ring = kmap_atomic(ctx->ring_pages[0]); |
1061 | head = ring->head; | ||
990 | ring->tail = tail; | 1062 | ring->tail = tail; |
991 | kunmap_atomic(ring); | 1063 | kunmap_atomic(ring); |
992 | flush_dcache_page(ctx->ring_pages[0]); | 1064 | flush_dcache_page(ctx->ring_pages[0]); |
993 | 1065 | ||
1066 | ctx->completed_events++; | ||
1067 | if (ctx->completed_events > 1) | ||
1068 | refill_reqs_available(ctx, head, tail); | ||
994 | spin_unlock_irqrestore(&ctx->completion_lock, flags); | 1069 | spin_unlock_irqrestore(&ctx->completion_lock, flags); |
995 | 1070 | ||
996 | pr_debug("added to ring %p at [%u]\n", iocb, tail); | 1071 | pr_debug("added to ring %p at [%u]\n", iocb, tail); |
@@ -1005,7 +1080,6 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
1005 | 1080 | ||
1006 | /* everything turned out well, dispose of the aiocb. */ | 1081 | /* everything turned out well, dispose of the aiocb. */ |
1007 | kiocb_free(iocb); | 1082 | kiocb_free(iocb); |
1008 | put_reqs_available(ctx, 1); | ||
1009 | 1083 | ||
1010 | /* | 1084 | /* |
1011 | * We have to order our ring_info tail store above and test | 1085 | * We have to order our ring_info tail store above and test |
@@ -1042,6 +1116,12 @@ static long aio_read_events_ring(struct kioctx *ctx, | |||
1042 | tail = ring->tail; | 1116 | tail = ring->tail; |
1043 | kunmap_atomic(ring); | 1117 | kunmap_atomic(ring); |
1044 | 1118 | ||
1119 | /* | ||
1120 | * Ensure that once we've read the current tail pointer, that | ||
1121 | * we also see the events that were stored up to the tail. | ||
1122 | */ | ||
1123 | smp_rmb(); | ||
1124 | |||
1045 | pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); | 1125 | pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); |
1046 | 1126 | ||
1047 | if (head == tail) | 1127 | if (head == tail) |
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 5a201d81049c..fbd76ded9a34 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/freezer.h> | 24 | #include <linux/freezer.h> |
25 | #include <linux/workqueue.h> | ||
26 | #include "async-thread.h" | 25 | #include "async-thread.h" |
27 | #include "ctree.h" | 26 | #include "ctree.h" |
28 | 27 | ||
@@ -55,8 +54,39 @@ struct btrfs_workqueue { | |||
55 | struct __btrfs_workqueue *high; | 54 | struct __btrfs_workqueue *high; |
56 | }; | 55 | }; |
57 | 56 | ||
58 | static inline struct __btrfs_workqueue | 57 | static void normal_work_helper(struct btrfs_work *work); |
59 | *__btrfs_alloc_workqueue(const char *name, int flags, int max_active, | 58 | |
59 | #define BTRFS_WORK_HELPER(name) \ | ||
60 | void btrfs_##name(struct work_struct *arg) \ | ||
61 | { \ | ||
62 | struct btrfs_work *work = container_of(arg, struct btrfs_work, \ | ||
63 | normal_work); \ | ||
64 | normal_work_helper(work); \ | ||
65 | } | ||
66 | |||
67 | BTRFS_WORK_HELPER(worker_helper); | ||
68 | BTRFS_WORK_HELPER(delalloc_helper); | ||
69 | BTRFS_WORK_HELPER(flush_delalloc_helper); | ||
70 | BTRFS_WORK_HELPER(cache_helper); | ||
71 | BTRFS_WORK_HELPER(submit_helper); | ||
72 | BTRFS_WORK_HELPER(fixup_helper); | ||
73 | BTRFS_WORK_HELPER(endio_helper); | ||
74 | BTRFS_WORK_HELPER(endio_meta_helper); | ||
75 | BTRFS_WORK_HELPER(endio_meta_write_helper); | ||
76 | BTRFS_WORK_HELPER(endio_raid56_helper); | ||
77 | BTRFS_WORK_HELPER(rmw_helper); | ||
78 | BTRFS_WORK_HELPER(endio_write_helper); | ||
79 | BTRFS_WORK_HELPER(freespace_write_helper); | ||
80 | BTRFS_WORK_HELPER(delayed_meta_helper); | ||
81 | BTRFS_WORK_HELPER(readahead_helper); | ||
82 | BTRFS_WORK_HELPER(qgroup_rescan_helper); | ||
83 | BTRFS_WORK_HELPER(extent_refs_helper); | ||
84 | BTRFS_WORK_HELPER(scrub_helper); | ||
85 | BTRFS_WORK_HELPER(scrubwrc_helper); | ||
86 | BTRFS_WORK_HELPER(scrubnc_helper); | ||
87 | |||
88 | static struct __btrfs_workqueue * | ||
89 | __btrfs_alloc_workqueue(const char *name, int flags, int max_active, | ||
60 | int thresh) | 90 | int thresh) |
61 | { | 91 | { |
62 | struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS); | 92 | struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS); |
@@ -232,13 +262,11 @@ static void run_ordered_work(struct __btrfs_workqueue *wq) | |||
232 | spin_unlock_irqrestore(lock, flags); | 262 | spin_unlock_irqrestore(lock, flags); |
233 | } | 263 | } |
234 | 264 | ||
235 | static void normal_work_helper(struct work_struct *arg) | 265 | static void normal_work_helper(struct btrfs_work *work) |
236 | { | 266 | { |
237 | struct btrfs_work *work; | ||
238 | struct __btrfs_workqueue *wq; | 267 | struct __btrfs_workqueue *wq; |
239 | int need_order = 0; | 268 | int need_order = 0; |
240 | 269 | ||
241 | work = container_of(arg, struct btrfs_work, normal_work); | ||
242 | /* | 270 | /* |
243 | * We should not touch things inside work in the following cases: | 271 | * We should not touch things inside work in the following cases: |
244 | * 1) after work->func() if it has no ordered_free | 272 | * 1) after work->func() if it has no ordered_free |
@@ -262,7 +290,7 @@ static void normal_work_helper(struct work_struct *arg) | |||
262 | trace_btrfs_all_work_done(work); | 290 | trace_btrfs_all_work_done(work); |
263 | } | 291 | } |
264 | 292 | ||
265 | void btrfs_init_work(struct btrfs_work *work, | 293 | void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t uniq_func, |
266 | btrfs_func_t func, | 294 | btrfs_func_t func, |
267 | btrfs_func_t ordered_func, | 295 | btrfs_func_t ordered_func, |
268 | btrfs_func_t ordered_free) | 296 | btrfs_func_t ordered_free) |
@@ -270,7 +298,7 @@ void btrfs_init_work(struct btrfs_work *work, | |||
270 | work->func = func; | 298 | work->func = func; |
271 | work->ordered_func = ordered_func; | 299 | work->ordered_func = ordered_func; |
272 | work->ordered_free = ordered_free; | 300 | work->ordered_free = ordered_free; |
273 | INIT_WORK(&work->normal_work, normal_work_helper); | 301 | INIT_WORK(&work->normal_work, uniq_func); |
274 | INIT_LIST_HEAD(&work->ordered_list); | 302 | INIT_LIST_HEAD(&work->ordered_list); |
275 | work->flags = 0; | 303 | work->flags = 0; |
276 | } | 304 | } |
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h index 9c6b66d15fb0..e9e31c94758f 100644 --- a/fs/btrfs/async-thread.h +++ b/fs/btrfs/async-thread.h | |||
@@ -19,12 +19,14 @@ | |||
19 | 19 | ||
20 | #ifndef __BTRFS_ASYNC_THREAD_ | 20 | #ifndef __BTRFS_ASYNC_THREAD_ |
21 | #define __BTRFS_ASYNC_THREAD_ | 21 | #define __BTRFS_ASYNC_THREAD_ |
22 | #include <linux/workqueue.h> | ||
22 | 23 | ||
23 | struct btrfs_workqueue; | 24 | struct btrfs_workqueue; |
24 | /* Internal use only */ | 25 | /* Internal use only */ |
25 | struct __btrfs_workqueue; | 26 | struct __btrfs_workqueue; |
26 | struct btrfs_work; | 27 | struct btrfs_work; |
27 | typedef void (*btrfs_func_t)(struct btrfs_work *arg); | 28 | typedef void (*btrfs_func_t)(struct btrfs_work *arg); |
29 | typedef void (*btrfs_work_func_t)(struct work_struct *arg); | ||
28 | 30 | ||
29 | struct btrfs_work { | 31 | struct btrfs_work { |
30 | btrfs_func_t func; | 32 | btrfs_func_t func; |
@@ -38,11 +40,35 @@ struct btrfs_work { | |||
38 | unsigned long flags; | 40 | unsigned long flags; |
39 | }; | 41 | }; |
40 | 42 | ||
43 | #define BTRFS_WORK_HELPER_PROTO(name) \ | ||
44 | void btrfs_##name(struct work_struct *arg) | ||
45 | |||
46 | BTRFS_WORK_HELPER_PROTO(worker_helper); | ||
47 | BTRFS_WORK_HELPER_PROTO(delalloc_helper); | ||
48 | BTRFS_WORK_HELPER_PROTO(flush_delalloc_helper); | ||
49 | BTRFS_WORK_HELPER_PROTO(cache_helper); | ||
50 | BTRFS_WORK_HELPER_PROTO(submit_helper); | ||
51 | BTRFS_WORK_HELPER_PROTO(fixup_helper); | ||
52 | BTRFS_WORK_HELPER_PROTO(endio_helper); | ||
53 | BTRFS_WORK_HELPER_PROTO(endio_meta_helper); | ||
54 | BTRFS_WORK_HELPER_PROTO(endio_meta_write_helper); | ||
55 | BTRFS_WORK_HELPER_PROTO(endio_raid56_helper); | ||
56 | BTRFS_WORK_HELPER_PROTO(rmw_helper); | ||
57 | BTRFS_WORK_HELPER_PROTO(endio_write_helper); | ||
58 | BTRFS_WORK_HELPER_PROTO(freespace_write_helper); | ||
59 | BTRFS_WORK_HELPER_PROTO(delayed_meta_helper); | ||
60 | BTRFS_WORK_HELPER_PROTO(readahead_helper); | ||
61 | BTRFS_WORK_HELPER_PROTO(qgroup_rescan_helper); | ||
62 | BTRFS_WORK_HELPER_PROTO(extent_refs_helper); | ||
63 | BTRFS_WORK_HELPER_PROTO(scrub_helper); | ||
64 | BTRFS_WORK_HELPER_PROTO(scrubwrc_helper); | ||
65 | BTRFS_WORK_HELPER_PROTO(scrubnc_helper); | ||
66 | |||
41 | struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name, | 67 | struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name, |
42 | int flags, | 68 | int flags, |
43 | int max_active, | 69 | int max_active, |
44 | int thresh); | 70 | int thresh); |
45 | void btrfs_init_work(struct btrfs_work *work, | 71 | void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t helper, |
46 | btrfs_func_t func, | 72 | btrfs_func_t func, |
47 | btrfs_func_t ordered_func, | 73 | btrfs_func_t ordered_func, |
48 | btrfs_func_t ordered_free); | 74 | btrfs_func_t ordered_free); |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 43527fd78825..56b8522d5767 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -234,8 +234,17 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | |||
234 | BTRFS_I(inode)->last_sub_trans <= | 234 | BTRFS_I(inode)->last_sub_trans <= |
235 | BTRFS_I(inode)->last_log_commit && | 235 | BTRFS_I(inode)->last_log_commit && |
236 | BTRFS_I(inode)->last_sub_trans <= | 236 | BTRFS_I(inode)->last_sub_trans <= |
237 | BTRFS_I(inode)->root->last_log_commit) | 237 | BTRFS_I(inode)->root->last_log_commit) { |
238 | return 1; | 238 | /* |
239 | * After a ranged fsync we might have left some extent maps | ||
240 | * (that fall outside the fsync's range). So return false | ||
241 | * here if the list isn't empty, to make sure btrfs_log_inode() | ||
242 | * will be called and process those extent maps. | ||
243 | */ | ||
244 | smp_mb(); | ||
245 | if (list_empty(&BTRFS_I(inode)->extent_tree.modified_extents)) | ||
246 | return 1; | ||
247 | } | ||
239 | return 0; | 248 | return 0; |
240 | } | 249 | } |
241 | 250 | ||
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index da775bfdebc9..a2e90f855d7d 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
@@ -1395,8 +1395,8 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, | |||
1395 | return -ENOMEM; | 1395 | return -ENOMEM; |
1396 | 1396 | ||
1397 | async_work->delayed_root = delayed_root; | 1397 | async_work->delayed_root = delayed_root; |
1398 | btrfs_init_work(&async_work->work, btrfs_async_run_delayed_root, | 1398 | btrfs_init_work(&async_work->work, btrfs_delayed_meta_helper, |
1399 | NULL, NULL); | 1399 | btrfs_async_run_delayed_root, NULL, NULL); |
1400 | async_work->nr = nr; | 1400 | async_work->nr = nr; |
1401 | 1401 | ||
1402 | btrfs_queue_work(root->fs_info->delayed_workers, &async_work->work); | 1402 | btrfs_queue_work(root->fs_info->delayed_workers, &async_work->work); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index d0ed9e664f7d..a1d36e62179c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include "btrfs_inode.h" | 39 | #include "btrfs_inode.h" |
40 | #include "volumes.h" | 40 | #include "volumes.h" |
41 | #include "print-tree.h" | 41 | #include "print-tree.h" |
42 | #include "async-thread.h" | ||
43 | #include "locking.h" | 42 | #include "locking.h" |
44 | #include "tree-log.h" | 43 | #include "tree-log.h" |
45 | #include "free-space-cache.h" | 44 | #include "free-space-cache.h" |
@@ -693,35 +692,41 @@ static void end_workqueue_bio(struct bio *bio, int err) | |||
693 | { | 692 | { |
694 | struct end_io_wq *end_io_wq = bio->bi_private; | 693 | struct end_io_wq *end_io_wq = bio->bi_private; |
695 | struct btrfs_fs_info *fs_info; | 694 | struct btrfs_fs_info *fs_info; |
695 | struct btrfs_workqueue *wq; | ||
696 | btrfs_work_func_t func; | ||
696 | 697 | ||
697 | fs_info = end_io_wq->info; | 698 | fs_info = end_io_wq->info; |
698 | end_io_wq->error = err; | 699 | end_io_wq->error = err; |
699 | btrfs_init_work(&end_io_wq->work, end_workqueue_fn, NULL, NULL); | ||
700 | 700 | ||
701 | if (bio->bi_rw & REQ_WRITE) { | 701 | if (bio->bi_rw & REQ_WRITE) { |
702 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) | 702 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) { |
703 | btrfs_queue_work(fs_info->endio_meta_write_workers, | 703 | wq = fs_info->endio_meta_write_workers; |
704 | &end_io_wq->work); | 704 | func = btrfs_endio_meta_write_helper; |
705 | else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_FREE_SPACE) | 705 | } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_FREE_SPACE) { |
706 | btrfs_queue_work(fs_info->endio_freespace_worker, | 706 | wq = fs_info->endio_freespace_worker; |
707 | &end_io_wq->work); | 707 | func = btrfs_freespace_write_helper; |
708 | else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) | 708 | } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) { |
709 | btrfs_queue_work(fs_info->endio_raid56_workers, | 709 | wq = fs_info->endio_raid56_workers; |
710 | &end_io_wq->work); | 710 | func = btrfs_endio_raid56_helper; |
711 | else | 711 | } else { |
712 | btrfs_queue_work(fs_info->endio_write_workers, | 712 | wq = fs_info->endio_write_workers; |
713 | &end_io_wq->work); | 713 | func = btrfs_endio_write_helper; |
714 | } | ||
714 | } else { | 715 | } else { |
715 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) | 716 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) { |
716 | btrfs_queue_work(fs_info->endio_raid56_workers, | 717 | wq = fs_info->endio_raid56_workers; |
717 | &end_io_wq->work); | 718 | func = btrfs_endio_raid56_helper; |
718 | else if (end_io_wq->metadata) | 719 | } else if (end_io_wq->metadata) { |
719 | btrfs_queue_work(fs_info->endio_meta_workers, | 720 | wq = fs_info->endio_meta_workers; |
720 | &end_io_wq->work); | 721 | func = btrfs_endio_meta_helper; |
721 | else | 722 | } else { |
722 | btrfs_queue_work(fs_info->endio_workers, | 723 | wq = fs_info->endio_workers; |
723 | &end_io_wq->work); | 724 | func = btrfs_endio_helper; |
725 | } | ||
724 | } | 726 | } |
727 | |||
728 | btrfs_init_work(&end_io_wq->work, func, end_workqueue_fn, NULL, NULL); | ||
729 | btrfs_queue_work(wq, &end_io_wq->work); | ||
725 | } | 730 | } |
726 | 731 | ||
727 | /* | 732 | /* |
@@ -828,7 +833,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
828 | async->submit_bio_start = submit_bio_start; | 833 | async->submit_bio_start = submit_bio_start; |
829 | async->submit_bio_done = submit_bio_done; | 834 | async->submit_bio_done = submit_bio_done; |
830 | 835 | ||
831 | btrfs_init_work(&async->work, run_one_async_start, | 836 | btrfs_init_work(&async->work, btrfs_worker_helper, run_one_async_start, |
832 | run_one_async_done, run_one_async_free); | 837 | run_one_async_done, run_one_async_free); |
833 | 838 | ||
834 | async->bio_flags = bio_flags; | 839 | async->bio_flags = bio_flags; |
@@ -3450,7 +3455,8 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
3450 | btrfs_set_stack_device_generation(dev_item, 0); | 3455 | btrfs_set_stack_device_generation(dev_item, 0); |
3451 | btrfs_set_stack_device_type(dev_item, dev->type); | 3456 | btrfs_set_stack_device_type(dev_item, dev->type); |
3452 | btrfs_set_stack_device_id(dev_item, dev->devid); | 3457 | btrfs_set_stack_device_id(dev_item, dev->devid); |
3453 | btrfs_set_stack_device_total_bytes(dev_item, dev->total_bytes); | 3458 | btrfs_set_stack_device_total_bytes(dev_item, |
3459 | dev->disk_total_bytes); | ||
3454 | btrfs_set_stack_device_bytes_used(dev_item, dev->bytes_used); | 3460 | btrfs_set_stack_device_bytes_used(dev_item, dev->bytes_used); |
3455 | btrfs_set_stack_device_io_align(dev_item, dev->io_align); | 3461 | btrfs_set_stack_device_io_align(dev_item, dev->io_align); |
3456 | btrfs_set_stack_device_io_width(dev_item, dev->io_width); | 3462 | btrfs_set_stack_device_io_width(dev_item, dev->io_width); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 102ed3143976..3efe1c3877bf 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -552,7 +552,8 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, | |||
552 | caching_ctl->block_group = cache; | 552 | caching_ctl->block_group = cache; |
553 | caching_ctl->progress = cache->key.objectid; | 553 | caching_ctl->progress = cache->key.objectid; |
554 | atomic_set(&caching_ctl->count, 1); | 554 | atomic_set(&caching_ctl->count, 1); |
555 | btrfs_init_work(&caching_ctl->work, caching_thread, NULL, NULL); | 555 | btrfs_init_work(&caching_ctl->work, btrfs_cache_helper, |
556 | caching_thread, NULL, NULL); | ||
556 | 557 | ||
557 | spin_lock(&cache->lock); | 558 | spin_lock(&cache->lock); |
558 | /* | 559 | /* |
@@ -2749,8 +2750,8 @@ int btrfs_async_run_delayed_refs(struct btrfs_root *root, | |||
2749 | async->sync = 0; | 2750 | async->sync = 0; |
2750 | init_completion(&async->wait); | 2751 | init_completion(&async->wait); |
2751 | 2752 | ||
2752 | btrfs_init_work(&async->work, delayed_ref_async_start, | 2753 | btrfs_init_work(&async->work, btrfs_extent_refs_helper, |
2753 | NULL, NULL); | 2754 | delayed_ref_async_start, NULL, NULL); |
2754 | 2755 | ||
2755 | btrfs_queue_work(root->fs_info->extent_workers, &async->work); | 2756 | btrfs_queue_work(root->fs_info->extent_workers, &async->work); |
2756 | 2757 | ||
@@ -3586,13 +3587,7 @@ static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) | |||
3586 | */ | 3587 | */ |
3587 | static u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags) | 3588 | static u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags) |
3588 | { | 3589 | { |
3589 | /* | 3590 | u64 num_devices = root->fs_info->fs_devices->rw_devices; |
3590 | * we add in the count of missing devices because we want | ||
3591 | * to make sure that any RAID levels on a degraded FS | ||
3592 | * continue to be honored. | ||
3593 | */ | ||
3594 | u64 num_devices = root->fs_info->fs_devices->rw_devices + | ||
3595 | root->fs_info->fs_devices->missing_devices; | ||
3596 | u64 target; | 3591 | u64 target; |
3597 | u64 tmp; | 3592 | u64 tmp; |
3598 | 3593 | ||
@@ -8440,13 +8435,7 @@ static u64 update_block_group_flags(struct btrfs_root *root, u64 flags) | |||
8440 | if (stripped) | 8435 | if (stripped) |
8441 | return extended_to_chunk(stripped); | 8436 | return extended_to_chunk(stripped); |
8442 | 8437 | ||
8443 | /* | 8438 | num_devices = root->fs_info->fs_devices->rw_devices; |
8444 | * we add in the count of missing devices because we want | ||
8445 | * to make sure that any RAID levels on a degraded FS | ||
8446 | * continue to be honored. | ||
8447 | */ | ||
8448 | num_devices = root->fs_info->fs_devices->rw_devices + | ||
8449 | root->fs_info->fs_devices->missing_devices; | ||
8450 | 8439 | ||
8451 | stripped = BTRFS_BLOCK_GROUP_RAID0 | | 8440 | stripped = BTRFS_BLOCK_GROUP_RAID0 | |
8452 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | | 8441 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 3e11aab9f391..af0359dcf337 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2532,6 +2532,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
2532 | test_bit(BIO_UPTODATE, &bio->bi_flags); | 2532 | test_bit(BIO_UPTODATE, &bio->bi_flags); |
2533 | if (err) | 2533 | if (err) |
2534 | uptodate = 0; | 2534 | uptodate = 0; |
2535 | offset += len; | ||
2535 | continue; | 2536 | continue; |
2536 | } | 2537 | } |
2537 | } | 2538 | } |
@@ -4207,8 +4208,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
4207 | return -ENOMEM; | 4208 | return -ENOMEM; |
4208 | path->leave_spinning = 1; | 4209 | path->leave_spinning = 1; |
4209 | 4210 | ||
4210 | start = ALIGN(start, BTRFS_I(inode)->root->sectorsize); | 4211 | start = round_down(start, BTRFS_I(inode)->root->sectorsize); |
4211 | len = ALIGN(len, BTRFS_I(inode)->root->sectorsize); | 4212 | len = round_up(max, BTRFS_I(inode)->root->sectorsize) - start; |
4212 | 4213 | ||
4213 | /* | 4214 | /* |
4214 | * lookup the last file extent. We're not using i_size here | 4215 | * lookup the last file extent. We're not using i_size here |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index d3afac292d67..ff1cc0399b9a 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1840,7 +1840,15 @@ int btrfs_release_file(struct inode *inode, struct file *filp) | |||
1840 | { | 1840 | { |
1841 | if (filp->private_data) | 1841 | if (filp->private_data) |
1842 | btrfs_ioctl_trans_end(filp); | 1842 | btrfs_ioctl_trans_end(filp); |
1843 | filemap_flush(inode->i_mapping); | 1843 | /* |
1844 | * ordered_data_close is set by settattr when we are about to truncate | ||
1845 | * a file from a non-zero size to a zero size. This tries to | ||
1846 | * flush down new bytes that may have been written if the | ||
1847 | * application were using truncate to replace a file in place. | ||
1848 | */ | ||
1849 | if (test_and_clear_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, | ||
1850 | &BTRFS_I(inode)->runtime_flags)) | ||
1851 | filemap_flush(inode->i_mapping); | ||
1844 | return 0; | 1852 | return 0; |
1845 | } | 1853 | } |
1846 | 1854 | ||
@@ -1958,7 +1966,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
1958 | 1966 | ||
1959 | btrfs_init_log_ctx(&ctx); | 1967 | btrfs_init_log_ctx(&ctx); |
1960 | 1968 | ||
1961 | ret = btrfs_log_dentry_safe(trans, root, dentry, &ctx); | 1969 | ret = btrfs_log_dentry_safe(trans, root, dentry, start, end, &ctx); |
1962 | if (ret < 0) { | 1970 | if (ret < 0) { |
1963 | /* Fallthrough and commit/free transaction. */ | 1971 | /* Fallthrough and commit/free transaction. */ |
1964 | ret = 1; | 1972 | ret = 1; |
@@ -2088,10 +2096,9 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, | |||
2088 | goto out; | 2096 | goto out; |
2089 | } | 2097 | } |
2090 | 2098 | ||
2091 | if (hole_mergeable(inode, leaf, path->slots[0]+1, offset, end)) { | 2099 | if (hole_mergeable(inode, leaf, path->slots[0], offset, end)) { |
2092 | u64 num_bytes; | 2100 | u64 num_bytes; |
2093 | 2101 | ||
2094 | path->slots[0]++; | ||
2095 | key.offset = offset; | 2102 | key.offset = offset; |
2096 | btrfs_set_item_key_safe(root, path, &key); | 2103 | btrfs_set_item_key_safe(root, path, &key); |
2097 | fi = btrfs_item_ptr(leaf, path->slots[0], | 2104 | fi = btrfs_item_ptr(leaf, path->slots[0], |
@@ -2216,7 +2223,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2216 | goto out_only_mutex; | 2223 | goto out_only_mutex; |
2217 | } | 2224 | } |
2218 | 2225 | ||
2219 | lockstart = round_up(offset , BTRFS_I(inode)->root->sectorsize); | 2226 | lockstart = round_up(offset, BTRFS_I(inode)->root->sectorsize); |
2220 | lockend = round_down(offset + len, | 2227 | lockend = round_down(offset + len, |
2221 | BTRFS_I(inode)->root->sectorsize) - 1; | 2228 | BTRFS_I(inode)->root->sectorsize) - 1; |
2222 | same_page = ((offset >> PAGE_CACHE_SHIFT) == | 2229 | same_page = ((offset >> PAGE_CACHE_SHIFT) == |
@@ -2277,7 +2284,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2277 | tail_start + tail_len, 0, 1); | 2284 | tail_start + tail_len, 0, 1); |
2278 | if (ret) | 2285 | if (ret) |
2279 | goto out_only_mutex; | 2286 | goto out_only_mutex; |
2280 | } | 2287 | } |
2281 | } | 2288 | } |
2282 | } | 2289 | } |
2283 | 2290 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 03708ef3deef..016c403bfe7e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -778,8 +778,12 @@ retry: | |||
778 | ins.offset, | 778 | ins.offset, |
779 | BTRFS_ORDERED_COMPRESSED, | 779 | BTRFS_ORDERED_COMPRESSED, |
780 | async_extent->compress_type); | 780 | async_extent->compress_type); |
781 | if (ret) | 781 | if (ret) { |
782 | btrfs_drop_extent_cache(inode, async_extent->start, | ||
783 | async_extent->start + | ||
784 | async_extent->ram_size - 1, 0); | ||
782 | goto out_free_reserve; | 785 | goto out_free_reserve; |
786 | } | ||
783 | 787 | ||
784 | /* | 788 | /* |
785 | * clear dirty, set writeback and unlock the pages. | 789 | * clear dirty, set writeback and unlock the pages. |
@@ -971,14 +975,14 @@ static noinline int cow_file_range(struct inode *inode, | |||
971 | ret = btrfs_add_ordered_extent(inode, start, ins.objectid, | 975 | ret = btrfs_add_ordered_extent(inode, start, ins.objectid, |
972 | ram_size, cur_alloc_size, 0); | 976 | ram_size, cur_alloc_size, 0); |
973 | if (ret) | 977 | if (ret) |
974 | goto out_reserve; | 978 | goto out_drop_extent_cache; |
975 | 979 | ||
976 | if (root->root_key.objectid == | 980 | if (root->root_key.objectid == |
977 | BTRFS_DATA_RELOC_TREE_OBJECTID) { | 981 | BTRFS_DATA_RELOC_TREE_OBJECTID) { |
978 | ret = btrfs_reloc_clone_csums(inode, start, | 982 | ret = btrfs_reloc_clone_csums(inode, start, |
979 | cur_alloc_size); | 983 | cur_alloc_size); |
980 | if (ret) | 984 | if (ret) |
981 | goto out_reserve; | 985 | goto out_drop_extent_cache; |
982 | } | 986 | } |
983 | 987 | ||
984 | if (disk_num_bytes < cur_alloc_size) | 988 | if (disk_num_bytes < cur_alloc_size) |
@@ -1006,6 +1010,8 @@ static noinline int cow_file_range(struct inode *inode, | |||
1006 | out: | 1010 | out: |
1007 | return ret; | 1011 | return ret; |
1008 | 1012 | ||
1013 | out_drop_extent_cache: | ||
1014 | btrfs_drop_extent_cache(inode, start, start + ram_size - 1, 0); | ||
1009 | out_reserve: | 1015 | out_reserve: |
1010 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); | 1016 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); |
1011 | out_unlock: | 1017 | out_unlock: |
@@ -1096,8 +1102,10 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
1096 | async_cow->end = cur_end; | 1102 | async_cow->end = cur_end; |
1097 | INIT_LIST_HEAD(&async_cow->extents); | 1103 | INIT_LIST_HEAD(&async_cow->extents); |
1098 | 1104 | ||
1099 | btrfs_init_work(&async_cow->work, async_cow_start, | 1105 | btrfs_init_work(&async_cow->work, |
1100 | async_cow_submit, async_cow_free); | 1106 | btrfs_delalloc_helper, |
1107 | async_cow_start, async_cow_submit, | ||
1108 | async_cow_free); | ||
1101 | 1109 | ||
1102 | nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> | 1110 | nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> |
1103 | PAGE_CACHE_SHIFT; | 1111 | PAGE_CACHE_SHIFT; |
@@ -1881,7 +1889,8 @@ static int btrfs_writepage_start_hook(struct page *page, u64 start, u64 end) | |||
1881 | 1889 | ||
1882 | SetPageChecked(page); | 1890 | SetPageChecked(page); |
1883 | page_cache_get(page); | 1891 | page_cache_get(page); |
1884 | btrfs_init_work(&fixup->work, btrfs_writepage_fixup_worker, NULL, NULL); | 1892 | btrfs_init_work(&fixup->work, btrfs_fixup_helper, |
1893 | btrfs_writepage_fixup_worker, NULL, NULL); | ||
1885 | fixup->page = page; | 1894 | fixup->page = page; |
1886 | btrfs_queue_work(root->fs_info->fixup_workers, &fixup->work); | 1895 | btrfs_queue_work(root->fs_info->fixup_workers, &fixup->work); |
1887 | return -EBUSY; | 1896 | return -EBUSY; |
@@ -2822,7 +2831,8 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | |||
2822 | struct inode *inode = page->mapping->host; | 2831 | struct inode *inode = page->mapping->host; |
2823 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2832 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2824 | struct btrfs_ordered_extent *ordered_extent = NULL; | 2833 | struct btrfs_ordered_extent *ordered_extent = NULL; |
2825 | struct btrfs_workqueue *workers; | 2834 | struct btrfs_workqueue *wq; |
2835 | btrfs_work_func_t func; | ||
2826 | 2836 | ||
2827 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); | 2837 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); |
2828 | 2838 | ||
@@ -2831,13 +2841,17 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | |||
2831 | end - start + 1, uptodate)) | 2841 | end - start + 1, uptodate)) |
2832 | return 0; | 2842 | return 0; |
2833 | 2843 | ||
2834 | btrfs_init_work(&ordered_extent->work, finish_ordered_fn, NULL, NULL); | 2844 | if (btrfs_is_free_space_inode(inode)) { |
2845 | wq = root->fs_info->endio_freespace_worker; | ||
2846 | func = btrfs_freespace_write_helper; | ||
2847 | } else { | ||
2848 | wq = root->fs_info->endio_write_workers; | ||
2849 | func = btrfs_endio_write_helper; | ||
2850 | } | ||
2835 | 2851 | ||
2836 | if (btrfs_is_free_space_inode(inode)) | 2852 | btrfs_init_work(&ordered_extent->work, func, finish_ordered_fn, NULL, |
2837 | workers = root->fs_info->endio_freespace_worker; | 2853 | NULL); |
2838 | else | 2854 | btrfs_queue_work(wq, &ordered_extent->work); |
2839 | workers = root->fs_info->endio_write_workers; | ||
2840 | btrfs_queue_work(workers, &ordered_extent->work); | ||
2841 | 2855 | ||
2842 | return 0; | 2856 | return 0; |
2843 | } | 2857 | } |
@@ -4234,7 +4248,8 @@ out: | |||
4234 | btrfs_abort_transaction(trans, root, ret); | 4248 | btrfs_abort_transaction(trans, root, ret); |
4235 | } | 4249 | } |
4236 | error: | 4250 | error: |
4237 | if (last_size != (u64)-1) | 4251 | if (last_size != (u64)-1 && |
4252 | root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) | ||
4238 | btrfs_ordered_update_i_size(inode, last_size, NULL); | 4253 | btrfs_ordered_update_i_size(inode, last_size, NULL); |
4239 | btrfs_free_path(path); | 4254 | btrfs_free_path(path); |
4240 | return err; | 4255 | return err; |
@@ -4674,6 +4689,11 @@ static void evict_inode_truncate_pages(struct inode *inode) | |||
4674 | clear_bit(EXTENT_FLAG_LOGGING, &em->flags); | 4689 | clear_bit(EXTENT_FLAG_LOGGING, &em->flags); |
4675 | remove_extent_mapping(map_tree, em); | 4690 | remove_extent_mapping(map_tree, em); |
4676 | free_extent_map(em); | 4691 | free_extent_map(em); |
4692 | if (need_resched()) { | ||
4693 | write_unlock(&map_tree->lock); | ||
4694 | cond_resched(); | ||
4695 | write_lock(&map_tree->lock); | ||
4696 | } | ||
4677 | } | 4697 | } |
4678 | write_unlock(&map_tree->lock); | 4698 | write_unlock(&map_tree->lock); |
4679 | 4699 | ||
@@ -4696,6 +4716,7 @@ static void evict_inode_truncate_pages(struct inode *inode) | |||
4696 | &cached_state, GFP_NOFS); | 4716 | &cached_state, GFP_NOFS); |
4697 | free_extent_state(state); | 4717 | free_extent_state(state); |
4698 | 4718 | ||
4719 | cond_resched(); | ||
4699 | spin_lock(&io_tree->lock); | 4720 | spin_lock(&io_tree->lock); |
4700 | } | 4721 | } |
4701 | spin_unlock(&io_tree->lock); | 4722 | spin_unlock(&io_tree->lock); |
@@ -5181,6 +5202,42 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
5181 | iput(inode); | 5202 | iput(inode); |
5182 | inode = ERR_PTR(ret); | 5203 | inode = ERR_PTR(ret); |
5183 | } | 5204 | } |
5205 | /* | ||
5206 | * If orphan cleanup did remove any orphans, it means the tree | ||
5207 | * was modified and therefore the commit root is not the same as | ||
5208 | * the current root anymore. This is a problem, because send | ||
5209 | * uses the commit root and therefore can see inode items that | ||
5210 | * don't exist in the current root anymore, and for example make | ||
5211 | * calls to btrfs_iget, which will do tree lookups based on the | ||
5212 | * current root and not on the commit root. Those lookups will | ||
5213 | * fail, returning a -ESTALE error, and making send fail with | ||
5214 | * that error. So make sure a send does not see any orphans we | ||
5215 | * have just removed, and that it will see the same inodes | ||
5216 | * regardless of whether a transaction commit happened before | ||
5217 | * it started (meaning that the commit root will be the same as | ||
5218 | * the current root) or not. | ||
5219 | */ | ||
5220 | if (sub_root->node != sub_root->commit_root) { | ||
5221 | u64 sub_flags = btrfs_root_flags(&sub_root->root_item); | ||
5222 | |||
5223 | if (sub_flags & BTRFS_ROOT_SUBVOL_RDONLY) { | ||
5224 | struct extent_buffer *eb; | ||
5225 | |||
5226 | /* | ||
5227 | * Assert we can't have races between dentry | ||
5228 | * lookup called through the snapshot creation | ||
5229 | * ioctl and the VFS. | ||
5230 | */ | ||
5231 | ASSERT(mutex_is_locked(&dir->i_mutex)); | ||
5232 | |||
5233 | down_write(&root->fs_info->commit_root_sem); | ||
5234 | eb = sub_root->commit_root; | ||
5235 | sub_root->commit_root = | ||
5236 | btrfs_root_node(sub_root); | ||
5237 | up_write(&root->fs_info->commit_root_sem); | ||
5238 | free_extent_buffer(eb); | ||
5239 | } | ||
5240 | } | ||
5184 | } | 5241 | } |
5185 | 5242 | ||
5186 | return inode; | 5243 | return inode; |
@@ -5577,6 +5634,17 @@ int btrfs_set_inode_index(struct inode *dir, u64 *index) | |||
5577 | return ret; | 5634 | return ret; |
5578 | } | 5635 | } |
5579 | 5636 | ||
5637 | static int btrfs_insert_inode_locked(struct inode *inode) | ||
5638 | { | ||
5639 | struct btrfs_iget_args args; | ||
5640 | args.location = &BTRFS_I(inode)->location; | ||
5641 | args.root = BTRFS_I(inode)->root; | ||
5642 | |||
5643 | return insert_inode_locked4(inode, | ||
5644 | btrfs_inode_hash(inode->i_ino, BTRFS_I(inode)->root), | ||
5645 | btrfs_find_actor, &args); | ||
5646 | } | ||
5647 | |||
5580 | static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | 5648 | static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, |
5581 | struct btrfs_root *root, | 5649 | struct btrfs_root *root, |
5582 | struct inode *dir, | 5650 | struct inode *dir, |
@@ -5606,6 +5674,13 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5606 | } | 5674 | } |
5607 | 5675 | ||
5608 | /* | 5676 | /* |
5677 | * O_TMPFILE, set link count to 0, so that after this point, | ||
5678 | * we fill in an inode item with the correct link count. | ||
5679 | */ | ||
5680 | if (!name) | ||
5681 | set_nlink(inode, 0); | ||
5682 | |||
5683 | /* | ||
5609 | * we have to initialize this early, so we can reclaim the inode | 5684 | * we have to initialize this early, so we can reclaim the inode |
5610 | * number if we fail afterwards in this function. | 5685 | * number if we fail afterwards in this function. |
5611 | */ | 5686 | */ |
@@ -5662,10 +5737,19 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5662 | sizes[1] = name_len + sizeof(*ref); | 5737 | sizes[1] = name_len + sizeof(*ref); |
5663 | } | 5738 | } |
5664 | 5739 | ||
5740 | location = &BTRFS_I(inode)->location; | ||
5741 | location->objectid = objectid; | ||
5742 | location->offset = 0; | ||
5743 | btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY); | ||
5744 | |||
5745 | ret = btrfs_insert_inode_locked(inode); | ||
5746 | if (ret < 0) | ||
5747 | goto fail; | ||
5748 | |||
5665 | path->leave_spinning = 1; | 5749 | path->leave_spinning = 1; |
5666 | ret = btrfs_insert_empty_items(trans, root, path, key, sizes, nitems); | 5750 | ret = btrfs_insert_empty_items(trans, root, path, key, sizes, nitems); |
5667 | if (ret != 0) | 5751 | if (ret != 0) |
5668 | goto fail; | 5752 | goto fail_unlock; |
5669 | 5753 | ||
5670 | inode_init_owner(inode, dir, mode); | 5754 | inode_init_owner(inode, dir, mode); |
5671 | inode_set_bytes(inode, 0); | 5755 | inode_set_bytes(inode, 0); |
@@ -5688,11 +5772,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5688 | btrfs_mark_buffer_dirty(path->nodes[0]); | 5772 | btrfs_mark_buffer_dirty(path->nodes[0]); |
5689 | btrfs_free_path(path); | 5773 | btrfs_free_path(path); |
5690 | 5774 | ||
5691 | location = &BTRFS_I(inode)->location; | ||
5692 | location->objectid = objectid; | ||
5693 | location->offset = 0; | ||
5694 | btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY); | ||
5695 | |||
5696 | btrfs_inherit_iflags(inode, dir); | 5775 | btrfs_inherit_iflags(inode, dir); |
5697 | 5776 | ||
5698 | if (S_ISREG(mode)) { | 5777 | if (S_ISREG(mode)) { |
@@ -5703,7 +5782,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5703 | BTRFS_INODE_NODATASUM; | 5782 | BTRFS_INODE_NODATASUM; |
5704 | } | 5783 | } |
5705 | 5784 | ||
5706 | btrfs_insert_inode_hash(inode); | ||
5707 | inode_tree_add(inode); | 5785 | inode_tree_add(inode); |
5708 | 5786 | ||
5709 | trace_btrfs_inode_new(inode); | 5787 | trace_btrfs_inode_new(inode); |
@@ -5718,6 +5796,9 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5718 | btrfs_ino(inode), root->root_key.objectid, ret); | 5796 | btrfs_ino(inode), root->root_key.objectid, ret); |
5719 | 5797 | ||
5720 | return inode; | 5798 | return inode; |
5799 | |||
5800 | fail_unlock: | ||
5801 | unlock_new_inode(inode); | ||
5721 | fail: | 5802 | fail: |
5722 | if (dir && name) | 5803 | if (dir && name) |
5723 | BTRFS_I(dir)->index_cnt--; | 5804 | BTRFS_I(dir)->index_cnt--; |
@@ -5852,28 +5933,28 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
5852 | goto out_unlock; | 5933 | goto out_unlock; |
5853 | } | 5934 | } |
5854 | 5935 | ||
5855 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
5856 | if (err) { | ||
5857 | drop_inode = 1; | ||
5858 | goto out_unlock; | ||
5859 | } | ||
5860 | |||
5861 | /* | 5936 | /* |
5862 | * If the active LSM wants to access the inode during | 5937 | * If the active LSM wants to access the inode during |
5863 | * d_instantiate it needs these. Smack checks to see | 5938 | * d_instantiate it needs these. Smack checks to see |
5864 | * if the filesystem supports xattrs by looking at the | 5939 | * if the filesystem supports xattrs by looking at the |
5865 | * ops vector. | 5940 | * ops vector. |
5866 | */ | 5941 | */ |
5867 | |||
5868 | inode->i_op = &btrfs_special_inode_operations; | 5942 | inode->i_op = &btrfs_special_inode_operations; |
5869 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 5943 | init_special_inode(inode, inode->i_mode, rdev); |
5944 | |||
5945 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
5870 | if (err) | 5946 | if (err) |
5871 | drop_inode = 1; | 5947 | goto out_unlock_inode; |
5872 | else { | 5948 | |
5873 | init_special_inode(inode, inode->i_mode, rdev); | 5949 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
5950 | if (err) { | ||
5951 | goto out_unlock_inode; | ||
5952 | } else { | ||
5874 | btrfs_update_inode(trans, root, inode); | 5953 | btrfs_update_inode(trans, root, inode); |
5954 | unlock_new_inode(inode); | ||
5875 | d_instantiate(dentry, inode); | 5955 | d_instantiate(dentry, inode); |
5876 | } | 5956 | } |
5957 | |||
5877 | out_unlock: | 5958 | out_unlock: |
5878 | btrfs_end_transaction(trans, root); | 5959 | btrfs_end_transaction(trans, root); |
5879 | btrfs_balance_delayed_items(root); | 5960 | btrfs_balance_delayed_items(root); |
@@ -5883,6 +5964,12 @@ out_unlock: | |||
5883 | iput(inode); | 5964 | iput(inode); |
5884 | } | 5965 | } |
5885 | return err; | 5966 | return err; |
5967 | |||
5968 | out_unlock_inode: | ||
5969 | drop_inode = 1; | ||
5970 | unlock_new_inode(inode); | ||
5971 | goto out_unlock; | ||
5972 | |||
5886 | } | 5973 | } |
5887 | 5974 | ||
5888 | static int btrfs_create(struct inode *dir, struct dentry *dentry, | 5975 | static int btrfs_create(struct inode *dir, struct dentry *dentry, |
@@ -5917,15 +6004,6 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
5917 | goto out_unlock; | 6004 | goto out_unlock; |
5918 | } | 6005 | } |
5919 | drop_inode_on_err = 1; | 6006 | drop_inode_on_err = 1; |
5920 | |||
5921 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
5922 | if (err) | ||
5923 | goto out_unlock; | ||
5924 | |||
5925 | err = btrfs_update_inode(trans, root, inode); | ||
5926 | if (err) | ||
5927 | goto out_unlock; | ||
5928 | |||
5929 | /* | 6007 | /* |
5930 | * If the active LSM wants to access the inode during | 6008 | * If the active LSM wants to access the inode during |
5931 | * d_instantiate it needs these. Smack checks to see | 6009 | * d_instantiate it needs these. Smack checks to see |
@@ -5934,14 +6012,23 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
5934 | */ | 6012 | */ |
5935 | inode->i_fop = &btrfs_file_operations; | 6013 | inode->i_fop = &btrfs_file_operations; |
5936 | inode->i_op = &btrfs_file_inode_operations; | 6014 | inode->i_op = &btrfs_file_inode_operations; |
6015 | inode->i_mapping->a_ops = &btrfs_aops; | ||
6016 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
6017 | |||
6018 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
6019 | if (err) | ||
6020 | goto out_unlock_inode; | ||
6021 | |||
6022 | err = btrfs_update_inode(trans, root, inode); | ||
6023 | if (err) | ||
6024 | goto out_unlock_inode; | ||
5937 | 6025 | ||
5938 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 6026 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
5939 | if (err) | 6027 | if (err) |
5940 | goto out_unlock; | 6028 | goto out_unlock_inode; |
5941 | 6029 | ||
5942 | inode->i_mapping->a_ops = &btrfs_aops; | ||
5943 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
5944 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 6030 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
6031 | unlock_new_inode(inode); | ||
5945 | d_instantiate(dentry, inode); | 6032 | d_instantiate(dentry, inode); |
5946 | 6033 | ||
5947 | out_unlock: | 6034 | out_unlock: |
@@ -5953,6 +6040,11 @@ out_unlock: | |||
5953 | btrfs_balance_delayed_items(root); | 6040 | btrfs_balance_delayed_items(root); |
5954 | btrfs_btree_balance_dirty(root); | 6041 | btrfs_btree_balance_dirty(root); |
5955 | return err; | 6042 | return err; |
6043 | |||
6044 | out_unlock_inode: | ||
6045 | unlock_new_inode(inode); | ||
6046 | goto out_unlock; | ||
6047 | |||
5956 | } | 6048 | } |
5957 | 6049 | ||
5958 | static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | 6050 | static int btrfs_link(struct dentry *old_dentry, struct inode *dir, |
@@ -6060,25 +6152,30 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
6060 | } | 6152 | } |
6061 | 6153 | ||
6062 | drop_on_err = 1; | 6154 | drop_on_err = 1; |
6155 | /* these must be set before we unlock the inode */ | ||
6156 | inode->i_op = &btrfs_dir_inode_operations; | ||
6157 | inode->i_fop = &btrfs_dir_file_operations; | ||
6063 | 6158 | ||
6064 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 6159 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
6065 | if (err) | 6160 | if (err) |
6066 | goto out_fail; | 6161 | goto out_fail_inode; |
6067 | |||
6068 | inode->i_op = &btrfs_dir_inode_operations; | ||
6069 | inode->i_fop = &btrfs_dir_file_operations; | ||
6070 | 6162 | ||
6071 | btrfs_i_size_write(inode, 0); | 6163 | btrfs_i_size_write(inode, 0); |
6072 | err = btrfs_update_inode(trans, root, inode); | 6164 | err = btrfs_update_inode(trans, root, inode); |
6073 | if (err) | 6165 | if (err) |
6074 | goto out_fail; | 6166 | goto out_fail_inode; |
6075 | 6167 | ||
6076 | err = btrfs_add_link(trans, dir, inode, dentry->d_name.name, | 6168 | err = btrfs_add_link(trans, dir, inode, dentry->d_name.name, |
6077 | dentry->d_name.len, 0, index); | 6169 | dentry->d_name.len, 0, index); |
6078 | if (err) | 6170 | if (err) |
6079 | goto out_fail; | 6171 | goto out_fail_inode; |
6080 | 6172 | ||
6081 | d_instantiate(dentry, inode); | 6173 | d_instantiate(dentry, inode); |
6174 | /* | ||
6175 | * mkdir is special. We're unlocking after we call d_instantiate | ||
6176 | * to avoid a race with nfsd calling d_instantiate. | ||
6177 | */ | ||
6178 | unlock_new_inode(inode); | ||
6082 | drop_on_err = 0; | 6179 | drop_on_err = 0; |
6083 | 6180 | ||
6084 | out_fail: | 6181 | out_fail: |
@@ -6088,6 +6185,10 @@ out_fail: | |||
6088 | btrfs_balance_delayed_items(root); | 6185 | btrfs_balance_delayed_items(root); |
6089 | btrfs_btree_balance_dirty(root); | 6186 | btrfs_btree_balance_dirty(root); |
6090 | return err; | 6187 | return err; |
6188 | |||
6189 | out_fail_inode: | ||
6190 | unlock_new_inode(inode); | ||
6191 | goto out_fail; | ||
6091 | } | 6192 | } |
6092 | 6193 | ||
6093 | /* helper for btfs_get_extent. Given an existing extent in the tree, | 6194 | /* helper for btfs_get_extent. Given an existing extent in the tree, |
@@ -6097,14 +6198,14 @@ out_fail: | |||
6097 | static int merge_extent_mapping(struct extent_map_tree *em_tree, | 6198 | static int merge_extent_mapping(struct extent_map_tree *em_tree, |
6098 | struct extent_map *existing, | 6199 | struct extent_map *existing, |
6099 | struct extent_map *em, | 6200 | struct extent_map *em, |
6100 | u64 map_start, u64 map_len) | 6201 | u64 map_start) |
6101 | { | 6202 | { |
6102 | u64 start_diff; | 6203 | u64 start_diff; |
6103 | 6204 | ||
6104 | BUG_ON(map_start < em->start || map_start >= extent_map_end(em)); | 6205 | BUG_ON(map_start < em->start || map_start >= extent_map_end(em)); |
6105 | start_diff = map_start - em->start; | 6206 | start_diff = map_start - em->start; |
6106 | em->start = map_start; | 6207 | em->start = map_start; |
6107 | em->len = map_len; | 6208 | em->len = existing->start - em->start; |
6108 | if (em->block_start < EXTENT_MAP_LAST_BYTE && | 6209 | if (em->block_start < EXTENT_MAP_LAST_BYTE && |
6109 | !test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) { | 6210 | !test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) { |
6110 | em->block_start += start_diff; | 6211 | em->block_start += start_diff; |
@@ -6275,6 +6376,8 @@ next: | |||
6275 | goto not_found; | 6376 | goto not_found; |
6276 | if (start + len <= found_key.offset) | 6377 | if (start + len <= found_key.offset) |
6277 | goto not_found; | 6378 | goto not_found; |
6379 | if (start > found_key.offset) | ||
6380 | goto next; | ||
6278 | em->start = start; | 6381 | em->start = start; |
6279 | em->orig_start = start; | 6382 | em->orig_start = start; |
6280 | em->len = found_key.offset - start; | 6383 | em->len = found_key.offset - start; |
@@ -6390,8 +6493,7 @@ insert: | |||
6390 | em->len); | 6493 | em->len); |
6391 | if (existing) { | 6494 | if (existing) { |
6392 | err = merge_extent_mapping(em_tree, existing, | 6495 | err = merge_extent_mapping(em_tree, existing, |
6393 | em, start, | 6496 | em, start); |
6394 | root->sectorsize); | ||
6395 | free_extent_map(existing); | 6497 | free_extent_map(existing); |
6396 | if (err) { | 6498 | if (err) { |
6397 | free_extent_map(em); | 6499 | free_extent_map(em); |
@@ -7158,7 +7260,8 @@ again: | |||
7158 | if (!ret) | 7260 | if (!ret) |
7159 | goto out_test; | 7261 | goto out_test; |
7160 | 7262 | ||
7161 | btrfs_init_work(&ordered->work, finish_ordered_fn, NULL, NULL); | 7263 | btrfs_init_work(&ordered->work, btrfs_endio_write_helper, |
7264 | finish_ordered_fn, NULL, NULL); | ||
7162 | btrfs_queue_work(root->fs_info->endio_write_workers, | 7265 | btrfs_queue_work(root->fs_info->endio_write_workers, |
7163 | &ordered->work); | 7266 | &ordered->work); |
7164 | out_test: | 7267 | out_test: |
@@ -7306,10 +7409,8 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
7306 | map_length = orig_bio->bi_iter.bi_size; | 7409 | map_length = orig_bio->bi_iter.bi_size; |
7307 | ret = btrfs_map_block(root->fs_info, rw, start_sector << 9, | 7410 | ret = btrfs_map_block(root->fs_info, rw, start_sector << 9, |
7308 | &map_length, NULL, 0); | 7411 | &map_length, NULL, 0); |
7309 | if (ret) { | 7412 | if (ret) |
7310 | bio_put(orig_bio); | ||
7311 | return -EIO; | 7413 | return -EIO; |
7312 | } | ||
7313 | 7414 | ||
7314 | if (map_length >= orig_bio->bi_iter.bi_size) { | 7415 | if (map_length >= orig_bio->bi_iter.bi_size) { |
7315 | bio = orig_bio; | 7416 | bio = orig_bio; |
@@ -7326,6 +7427,7 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
7326 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); | 7427 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); |
7327 | if (!bio) | 7428 | if (!bio) |
7328 | return -ENOMEM; | 7429 | return -ENOMEM; |
7430 | |||
7329 | bio->bi_private = dip; | 7431 | bio->bi_private = dip; |
7330 | bio->bi_end_io = btrfs_end_dio_bio; | 7432 | bio->bi_end_io = btrfs_end_dio_bio; |
7331 | atomic_inc(&dip->pending_bios); | 7433 | atomic_inc(&dip->pending_bios); |
@@ -7534,7 +7636,8 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
7534 | count = iov_iter_count(iter); | 7636 | count = iov_iter_count(iter); |
7535 | if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, | 7637 | if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, |
7536 | &BTRFS_I(inode)->runtime_flags)) | 7638 | &BTRFS_I(inode)->runtime_flags)) |
7537 | filemap_fdatawrite_range(inode->i_mapping, offset, count); | 7639 | filemap_fdatawrite_range(inode->i_mapping, offset, |
7640 | offset + count - 1); | ||
7538 | 7641 | ||
7539 | if (rw & WRITE) { | 7642 | if (rw & WRITE) { |
7540 | /* | 7643 | /* |
@@ -8041,6 +8144,7 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, | |||
8041 | 8144 | ||
8042 | set_nlink(inode, 1); | 8145 | set_nlink(inode, 1); |
8043 | btrfs_i_size_write(inode, 0); | 8146 | btrfs_i_size_write(inode, 0); |
8147 | unlock_new_inode(inode); | ||
8044 | 8148 | ||
8045 | err = btrfs_subvol_inherit_props(trans, new_root, parent_root); | 8149 | err = btrfs_subvol_inherit_props(trans, new_root, parent_root); |
8046 | if (err) | 8150 | if (err) |
@@ -8495,7 +8599,9 @@ struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode, | |||
8495 | work->inode = inode; | 8599 | work->inode = inode; |
8496 | work->wait = wait; | 8600 | work->wait = wait; |
8497 | work->delay_iput = delay_iput; | 8601 | work->delay_iput = delay_iput; |
8498 | btrfs_init_work(&work->work, btrfs_run_delalloc_work, NULL, NULL); | 8602 | WARN_ON_ONCE(!inode); |
8603 | btrfs_init_work(&work->work, btrfs_flush_delalloc_helper, | ||
8604 | btrfs_run_delalloc_work, NULL, NULL); | ||
8499 | 8605 | ||
8500 | return work; | 8606 | return work; |
8501 | } | 8607 | } |
@@ -8699,12 +8805,6 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8699 | goto out_unlock; | 8805 | goto out_unlock; |
8700 | } | 8806 | } |
8701 | 8807 | ||
8702 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
8703 | if (err) { | ||
8704 | drop_inode = 1; | ||
8705 | goto out_unlock; | ||
8706 | } | ||
8707 | |||
8708 | /* | 8808 | /* |
8709 | * If the active LSM wants to access the inode during | 8809 | * If the active LSM wants to access the inode during |
8710 | * d_instantiate it needs these. Smack checks to see | 8810 | * d_instantiate it needs these. Smack checks to see |
@@ -8713,23 +8813,22 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8713 | */ | 8813 | */ |
8714 | inode->i_fop = &btrfs_file_operations; | 8814 | inode->i_fop = &btrfs_file_operations; |
8715 | inode->i_op = &btrfs_file_inode_operations; | 8815 | inode->i_op = &btrfs_file_inode_operations; |
8816 | inode->i_mapping->a_ops = &btrfs_aops; | ||
8817 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
8818 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | ||
8819 | |||
8820 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
8821 | if (err) | ||
8822 | goto out_unlock_inode; | ||
8716 | 8823 | ||
8717 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 8824 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
8718 | if (err) | 8825 | if (err) |
8719 | drop_inode = 1; | 8826 | goto out_unlock_inode; |
8720 | else { | ||
8721 | inode->i_mapping->a_ops = &btrfs_aops; | ||
8722 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
8723 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | ||
8724 | } | ||
8725 | if (drop_inode) | ||
8726 | goto out_unlock; | ||
8727 | 8827 | ||
8728 | path = btrfs_alloc_path(); | 8828 | path = btrfs_alloc_path(); |
8729 | if (!path) { | 8829 | if (!path) { |
8730 | err = -ENOMEM; | 8830 | err = -ENOMEM; |
8731 | drop_inode = 1; | 8831 | goto out_unlock_inode; |
8732 | goto out_unlock; | ||
8733 | } | 8832 | } |
8734 | key.objectid = btrfs_ino(inode); | 8833 | key.objectid = btrfs_ino(inode); |
8735 | key.offset = 0; | 8834 | key.offset = 0; |
@@ -8738,9 +8837,8 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8738 | err = btrfs_insert_empty_item(trans, root, path, &key, | 8837 | err = btrfs_insert_empty_item(trans, root, path, &key, |
8739 | datasize); | 8838 | datasize); |
8740 | if (err) { | 8839 | if (err) { |
8741 | drop_inode = 1; | ||
8742 | btrfs_free_path(path); | 8840 | btrfs_free_path(path); |
8743 | goto out_unlock; | 8841 | goto out_unlock_inode; |
8744 | } | 8842 | } |
8745 | leaf = path->nodes[0]; | 8843 | leaf = path->nodes[0]; |
8746 | ei = btrfs_item_ptr(leaf, path->slots[0], | 8844 | ei = btrfs_item_ptr(leaf, path->slots[0], |
@@ -8764,12 +8862,15 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8764 | inode_set_bytes(inode, name_len); | 8862 | inode_set_bytes(inode, name_len); |
8765 | btrfs_i_size_write(inode, name_len); | 8863 | btrfs_i_size_write(inode, name_len); |
8766 | err = btrfs_update_inode(trans, root, inode); | 8864 | err = btrfs_update_inode(trans, root, inode); |
8767 | if (err) | 8865 | if (err) { |
8768 | drop_inode = 1; | 8866 | drop_inode = 1; |
8867 | goto out_unlock_inode; | ||
8868 | } | ||
8869 | |||
8870 | unlock_new_inode(inode); | ||
8871 | d_instantiate(dentry, inode); | ||
8769 | 8872 | ||
8770 | out_unlock: | 8873 | out_unlock: |
8771 | if (!err) | ||
8772 | d_instantiate(dentry, inode); | ||
8773 | btrfs_end_transaction(trans, root); | 8874 | btrfs_end_transaction(trans, root); |
8774 | if (drop_inode) { | 8875 | if (drop_inode) { |
8775 | inode_dec_link_count(inode); | 8876 | inode_dec_link_count(inode); |
@@ -8777,6 +8878,11 @@ out_unlock: | |||
8777 | } | 8878 | } |
8778 | btrfs_btree_balance_dirty(root); | 8879 | btrfs_btree_balance_dirty(root); |
8779 | return err; | 8880 | return err; |
8881 | |||
8882 | out_unlock_inode: | ||
8883 | drop_inode = 1; | ||
8884 | unlock_new_inode(inode); | ||
8885 | goto out_unlock; | ||
8780 | } | 8886 | } |
8781 | 8887 | ||
8782 | static int __btrfs_prealloc_file_range(struct inode *inode, int mode, | 8888 | static int __btrfs_prealloc_file_range(struct inode *inode, int mode, |
@@ -8960,14 +9066,6 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
8960 | goto out; | 9066 | goto out; |
8961 | } | 9067 | } |
8962 | 9068 | ||
8963 | ret = btrfs_init_inode_security(trans, inode, dir, NULL); | ||
8964 | if (ret) | ||
8965 | goto out; | ||
8966 | |||
8967 | ret = btrfs_update_inode(trans, root, inode); | ||
8968 | if (ret) | ||
8969 | goto out; | ||
8970 | |||
8971 | inode->i_fop = &btrfs_file_operations; | 9069 | inode->i_fop = &btrfs_file_operations; |
8972 | inode->i_op = &btrfs_file_inode_operations; | 9070 | inode->i_op = &btrfs_file_inode_operations; |
8973 | 9071 | ||
@@ -8975,10 +9073,26 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
8975 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 9073 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
8976 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 9074 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
8977 | 9075 | ||
9076 | ret = btrfs_init_inode_security(trans, inode, dir, NULL); | ||
9077 | if (ret) | ||
9078 | goto out_inode; | ||
9079 | |||
9080 | ret = btrfs_update_inode(trans, root, inode); | ||
9081 | if (ret) | ||
9082 | goto out_inode; | ||
8978 | ret = btrfs_orphan_add(trans, inode); | 9083 | ret = btrfs_orphan_add(trans, inode); |
8979 | if (ret) | 9084 | if (ret) |
8980 | goto out; | 9085 | goto out_inode; |
8981 | 9086 | ||
9087 | /* | ||
9088 | * We set number of links to 0 in btrfs_new_inode(), and here we set | ||
9089 | * it to 1 because d_tmpfile() will issue a warning if the count is 0, | ||
9090 | * through: | ||
9091 | * | ||
9092 | * d_tmpfile() -> inode_dec_link_count() -> drop_nlink() | ||
9093 | */ | ||
9094 | set_nlink(inode, 1); | ||
9095 | unlock_new_inode(inode); | ||
8982 | d_tmpfile(dentry, inode); | 9096 | d_tmpfile(dentry, inode); |
8983 | mark_inode_dirty(inode); | 9097 | mark_inode_dirty(inode); |
8984 | 9098 | ||
@@ -8988,8 +9102,12 @@ out: | |||
8988 | iput(inode); | 9102 | iput(inode); |
8989 | btrfs_balance_delayed_items(root); | 9103 | btrfs_balance_delayed_items(root); |
8990 | btrfs_btree_balance_dirty(root); | 9104 | btrfs_btree_balance_dirty(root); |
8991 | |||
8992 | return ret; | 9105 | return ret; |
9106 | |||
9107 | out_inode: | ||
9108 | unlock_new_inode(inode); | ||
9109 | goto out; | ||
9110 | |||
8993 | } | 9111 | } |
8994 | 9112 | ||
8995 | static const struct inode_operations btrfs_dir_inode_operations = { | 9113 | static const struct inode_operations btrfs_dir_inode_operations = { |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 47aceb494d1d..8a8e29878c34 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -711,39 +711,6 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
711 | if (ret) | 711 | if (ret) |
712 | goto fail; | 712 | goto fail; |
713 | 713 | ||
714 | ret = btrfs_orphan_cleanup(pending_snapshot->snap); | ||
715 | if (ret) | ||
716 | goto fail; | ||
717 | |||
718 | /* | ||
719 | * If orphan cleanup did remove any orphans, it means the tree was | ||
720 | * modified and therefore the commit root is not the same as the | ||
721 | * current root anymore. This is a problem, because send uses the | ||
722 | * commit root and therefore can see inode items that don't exist | ||
723 | * in the current root anymore, and for example make calls to | ||
724 | * btrfs_iget, which will do tree lookups based on the current root | ||
725 | * and not on the commit root. Those lookups will fail, returning a | ||
726 | * -ESTALE error, and making send fail with that error. So make sure | ||
727 | * a send does not see any orphans we have just removed, and that it | ||
728 | * will see the same inodes regardless of whether a transaction | ||
729 | * commit happened before it started (meaning that the commit root | ||
730 | * will be the same as the current root) or not. | ||
731 | */ | ||
732 | if (readonly && pending_snapshot->snap->node != | ||
733 | pending_snapshot->snap->commit_root) { | ||
734 | trans = btrfs_join_transaction(pending_snapshot->snap); | ||
735 | if (IS_ERR(trans) && PTR_ERR(trans) != -ENOENT) { | ||
736 | ret = PTR_ERR(trans); | ||
737 | goto fail; | ||
738 | } | ||
739 | if (!IS_ERR(trans)) { | ||
740 | ret = btrfs_commit_transaction(trans, | ||
741 | pending_snapshot->snap); | ||
742 | if (ret) | ||
743 | goto fail; | ||
744 | } | ||
745 | } | ||
746 | |||
747 | inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); | 714 | inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); |
748 | if (IS_ERR(inode)) { | 715 | if (IS_ERR(inode)) { |
749 | ret = PTR_ERR(inode); | 716 | ret = PTR_ERR(inode); |
@@ -1052,8 +1019,10 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em) | |||
1052 | return false; | 1019 | return false; |
1053 | 1020 | ||
1054 | next = defrag_lookup_extent(inode, em->start + em->len); | 1021 | next = defrag_lookup_extent(inode, em->start + em->len); |
1055 | if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE || | 1022 | if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE) |
1056 | (em->block_start + em->block_len == next->block_start)) | 1023 | ret = false; |
1024 | else if ((em->block_start + em->block_len == next->block_start) && | ||
1025 | (em->block_len > 128 * 1024 && next->block_len > 128 * 1024)) | ||
1057 | ret = false; | 1026 | ret = false; |
1058 | 1027 | ||
1059 | free_extent_map(next); | 1028 | free_extent_map(next); |
@@ -1088,7 +1057,6 @@ static int should_defrag_range(struct inode *inode, u64 start, int thresh, | |||
1088 | } | 1057 | } |
1089 | 1058 | ||
1090 | next_mergeable = defrag_check_next_extent(inode, em); | 1059 | next_mergeable = defrag_check_next_extent(inode, em); |
1091 | |||
1092 | /* | 1060 | /* |
1093 | * we hit a real extent, if it is big or the next extent is not a | 1061 | * we hit a real extent, if it is big or the next extent is not a |
1094 | * real extent, don't bother defragging it | 1062 | * real extent, don't bother defragging it |
@@ -1735,7 +1703,7 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file, | |||
1735 | ~(BTRFS_SUBVOL_CREATE_ASYNC | BTRFS_SUBVOL_RDONLY | | 1703 | ~(BTRFS_SUBVOL_CREATE_ASYNC | BTRFS_SUBVOL_RDONLY | |
1736 | BTRFS_SUBVOL_QGROUP_INHERIT)) { | 1704 | BTRFS_SUBVOL_QGROUP_INHERIT)) { |
1737 | ret = -EOPNOTSUPP; | 1705 | ret = -EOPNOTSUPP; |
1738 | goto out; | 1706 | goto free_args; |
1739 | } | 1707 | } |
1740 | 1708 | ||
1741 | if (vol_args->flags & BTRFS_SUBVOL_CREATE_ASYNC) | 1709 | if (vol_args->flags & BTRFS_SUBVOL_CREATE_ASYNC) |
@@ -1745,27 +1713,31 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file, | |||
1745 | if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) { | 1713 | if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) { |
1746 | if (vol_args->size > PAGE_CACHE_SIZE) { | 1714 | if (vol_args->size > PAGE_CACHE_SIZE) { |
1747 | ret = -EINVAL; | 1715 | ret = -EINVAL; |
1748 | goto out; | 1716 | goto free_args; |
1749 | } | 1717 | } |
1750 | inherit = memdup_user(vol_args->qgroup_inherit, vol_args->size); | 1718 | inherit = memdup_user(vol_args->qgroup_inherit, vol_args->size); |
1751 | if (IS_ERR(inherit)) { | 1719 | if (IS_ERR(inherit)) { |
1752 | ret = PTR_ERR(inherit); | 1720 | ret = PTR_ERR(inherit); |
1753 | goto out; | 1721 | goto free_args; |
1754 | } | 1722 | } |
1755 | } | 1723 | } |
1756 | 1724 | ||
1757 | ret = btrfs_ioctl_snap_create_transid(file, vol_args->name, | 1725 | ret = btrfs_ioctl_snap_create_transid(file, vol_args->name, |
1758 | vol_args->fd, subvol, ptr, | 1726 | vol_args->fd, subvol, ptr, |
1759 | readonly, inherit); | 1727 | readonly, inherit); |
1728 | if (ret) | ||
1729 | goto free_inherit; | ||
1760 | 1730 | ||
1761 | if (ret == 0 && ptr && | 1731 | if (ptr && copy_to_user(arg + |
1762 | copy_to_user(arg + | 1732 | offsetof(struct btrfs_ioctl_vol_args_v2, |
1763 | offsetof(struct btrfs_ioctl_vol_args_v2, | 1733 | transid), |
1764 | transid), ptr, sizeof(*ptr))) | 1734 | ptr, sizeof(*ptr))) |
1765 | ret = -EFAULT; | 1735 | ret = -EFAULT; |
1766 | out: | 1736 | |
1767 | kfree(vol_args); | 1737 | free_inherit: |
1768 | kfree(inherit); | 1738 | kfree(inherit); |
1739 | free_args: | ||
1740 | kfree(vol_args); | ||
1769 | return ret; | 1741 | return ret; |
1770 | } | 1742 | } |
1771 | 1743 | ||
@@ -2685,7 +2657,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) | |||
2685 | vol_args = memdup_user(arg, sizeof(*vol_args)); | 2657 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
2686 | if (IS_ERR(vol_args)) { | 2658 | if (IS_ERR(vol_args)) { |
2687 | ret = PTR_ERR(vol_args); | 2659 | ret = PTR_ERR(vol_args); |
2688 | goto out; | 2660 | goto err_drop; |
2689 | } | 2661 | } |
2690 | 2662 | ||
2691 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | 2663 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; |
@@ -2703,6 +2675,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) | |||
2703 | 2675 | ||
2704 | out: | 2676 | out: |
2705 | kfree(vol_args); | 2677 | kfree(vol_args); |
2678 | err_drop: | ||
2706 | mnt_drop_write_file(file); | 2679 | mnt_drop_write_file(file); |
2707 | return ret; | 2680 | return ret; |
2708 | } | 2681 | } |
@@ -3527,7 +3500,8 @@ process_slot: | |||
3527 | btrfs_mark_buffer_dirty(leaf); | 3500 | btrfs_mark_buffer_dirty(leaf); |
3528 | btrfs_release_path(path); | 3501 | btrfs_release_path(path); |
3529 | 3502 | ||
3530 | last_dest_end = new_key.offset + datal; | 3503 | last_dest_end = ALIGN(new_key.offset + datal, |
3504 | root->sectorsize); | ||
3531 | ret = clone_finish_inode_update(trans, inode, | 3505 | ret = clone_finish_inode_update(trans, inode, |
3532 | last_dest_end, | 3506 | last_dest_end, |
3533 | destoff, olen); | 3507 | destoff, olen); |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 963895c1f801..ac734ec4cc20 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -615,6 +615,7 @@ int btrfs_wait_ordered_extents(struct btrfs_root *root, int nr) | |||
615 | spin_unlock(&root->ordered_extent_lock); | 615 | spin_unlock(&root->ordered_extent_lock); |
616 | 616 | ||
617 | btrfs_init_work(&ordered->flush_work, | 617 | btrfs_init_work(&ordered->flush_work, |
618 | btrfs_flush_delalloc_helper, | ||
618 | btrfs_run_ordered_extent_work, NULL, NULL); | 619 | btrfs_run_ordered_extent_work, NULL, NULL); |
619 | list_add_tail(&ordered->work_list, &works); | 620 | list_add_tail(&ordered->work_list, &works); |
620 | btrfs_queue_work(root->fs_info->flush_workers, | 621 | btrfs_queue_work(root->fs_info->flush_workers, |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index b497498484be..ded5c601d916 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1973,7 +1973,7 @@ static int qgroup_subtree_accounting(struct btrfs_trans_handle *trans, | |||
1973 | elem.seq, &roots); | 1973 | elem.seq, &roots); |
1974 | btrfs_put_tree_mod_seq(fs_info, &elem); | 1974 | btrfs_put_tree_mod_seq(fs_info, &elem); |
1975 | if (ret < 0) | 1975 | if (ret < 0) |
1976 | return ret; | 1976 | goto out; |
1977 | 1977 | ||
1978 | if (roots->nnodes != 1) | 1978 | if (roots->nnodes != 1) |
1979 | goto out; | 1979 | goto out; |
@@ -2720,6 +2720,7 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, | |||
2720 | memset(&fs_info->qgroup_rescan_work, 0, | 2720 | memset(&fs_info->qgroup_rescan_work, 0, |
2721 | sizeof(fs_info->qgroup_rescan_work)); | 2721 | sizeof(fs_info->qgroup_rescan_work)); |
2722 | btrfs_init_work(&fs_info->qgroup_rescan_work, | 2722 | btrfs_init_work(&fs_info->qgroup_rescan_work, |
2723 | btrfs_qgroup_rescan_helper, | ||
2723 | btrfs_qgroup_rescan_worker, NULL, NULL); | 2724 | btrfs_qgroup_rescan_worker, NULL, NULL); |
2724 | 2725 | ||
2725 | if (ret) { | 2726 | if (ret) { |
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 4a88f073fdd7..0a6b6e4bcbb9 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
@@ -1416,7 +1416,8 @@ cleanup: | |||
1416 | 1416 | ||
1417 | static void async_rmw_stripe(struct btrfs_raid_bio *rbio) | 1417 | static void async_rmw_stripe(struct btrfs_raid_bio *rbio) |
1418 | { | 1418 | { |
1419 | btrfs_init_work(&rbio->work, rmw_work, NULL, NULL); | 1419 | btrfs_init_work(&rbio->work, btrfs_rmw_helper, |
1420 | rmw_work, NULL, NULL); | ||
1420 | 1421 | ||
1421 | btrfs_queue_work(rbio->fs_info->rmw_workers, | 1422 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
1422 | &rbio->work); | 1423 | &rbio->work); |
@@ -1424,7 +1425,8 @@ static void async_rmw_stripe(struct btrfs_raid_bio *rbio) | |||
1424 | 1425 | ||
1425 | static void async_read_rebuild(struct btrfs_raid_bio *rbio) | 1426 | static void async_read_rebuild(struct btrfs_raid_bio *rbio) |
1426 | { | 1427 | { |
1427 | btrfs_init_work(&rbio->work, read_rebuild_work, NULL, NULL); | 1428 | btrfs_init_work(&rbio->work, btrfs_rmw_helper, |
1429 | read_rebuild_work, NULL, NULL); | ||
1428 | 1430 | ||
1429 | btrfs_queue_work(rbio->fs_info->rmw_workers, | 1431 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
1430 | &rbio->work); | 1432 | &rbio->work); |
@@ -1665,7 +1667,8 @@ static void btrfs_raid_unplug(struct blk_plug_cb *cb, bool from_schedule) | |||
1665 | plug = container_of(cb, struct btrfs_plug_cb, cb); | 1667 | plug = container_of(cb, struct btrfs_plug_cb, cb); |
1666 | 1668 | ||
1667 | if (from_schedule) { | 1669 | if (from_schedule) { |
1668 | btrfs_init_work(&plug->work, unplug_work, NULL, NULL); | 1670 | btrfs_init_work(&plug->work, btrfs_rmw_helper, |
1671 | unplug_work, NULL, NULL); | ||
1669 | btrfs_queue_work(plug->info->rmw_workers, | 1672 | btrfs_queue_work(plug->info->rmw_workers, |
1670 | &plug->work); | 1673 | &plug->work); |
1671 | return; | 1674 | return; |
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index 09230cf3a244..20408c6b665a 100644 --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c | |||
@@ -798,7 +798,8 @@ static void reada_start_machine(struct btrfs_fs_info *fs_info) | |||
798 | /* FIXME we cannot handle this properly right now */ | 798 | /* FIXME we cannot handle this properly right now */ |
799 | BUG(); | 799 | BUG(); |
800 | } | 800 | } |
801 | btrfs_init_work(&rmw->work, reada_start_machine_worker, NULL, NULL); | 801 | btrfs_init_work(&rmw->work, btrfs_readahead_helper, |
802 | reada_start_machine_worker, NULL, NULL); | ||
802 | rmw->fs_info = fs_info; | 803 | rmw->fs_info = fs_info; |
803 | 804 | ||
804 | btrfs_queue_work(fs_info->readahead_workers, &rmw->work); | 805 | btrfs_queue_work(fs_info->readahead_workers, &rmw->work); |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index b6d198f5181e..f4a41f37be22 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -428,8 +428,8 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace) | |||
428 | sbio->index = i; | 428 | sbio->index = i; |
429 | sbio->sctx = sctx; | 429 | sbio->sctx = sctx; |
430 | sbio->page_count = 0; | 430 | sbio->page_count = 0; |
431 | btrfs_init_work(&sbio->work, scrub_bio_end_io_worker, | 431 | btrfs_init_work(&sbio->work, btrfs_scrub_helper, |
432 | NULL, NULL); | 432 | scrub_bio_end_io_worker, NULL, NULL); |
433 | 433 | ||
434 | if (i != SCRUB_BIOS_PER_SCTX - 1) | 434 | if (i != SCRUB_BIOS_PER_SCTX - 1) |
435 | sctx->bios[i]->next_free = i + 1; | 435 | sctx->bios[i]->next_free = i + 1; |
@@ -999,8 +999,8 @@ nodatasum_case: | |||
999 | fixup_nodatasum->root = fs_info->extent_root; | 999 | fixup_nodatasum->root = fs_info->extent_root; |
1000 | fixup_nodatasum->mirror_num = failed_mirror_index + 1; | 1000 | fixup_nodatasum->mirror_num = failed_mirror_index + 1; |
1001 | scrub_pending_trans_workers_inc(sctx); | 1001 | scrub_pending_trans_workers_inc(sctx); |
1002 | btrfs_init_work(&fixup_nodatasum->work, scrub_fixup_nodatasum, | 1002 | btrfs_init_work(&fixup_nodatasum->work, btrfs_scrub_helper, |
1003 | NULL, NULL); | 1003 | scrub_fixup_nodatasum, NULL, NULL); |
1004 | btrfs_queue_work(fs_info->scrub_workers, | 1004 | btrfs_queue_work(fs_info->scrub_workers, |
1005 | &fixup_nodatasum->work); | 1005 | &fixup_nodatasum->work); |
1006 | goto out; | 1006 | goto out; |
@@ -1616,7 +1616,8 @@ static void scrub_wr_bio_end_io(struct bio *bio, int err) | |||
1616 | sbio->err = err; | 1616 | sbio->err = err; |
1617 | sbio->bio = bio; | 1617 | sbio->bio = bio; |
1618 | 1618 | ||
1619 | btrfs_init_work(&sbio->work, scrub_wr_bio_end_io_worker, NULL, NULL); | 1619 | btrfs_init_work(&sbio->work, btrfs_scrubwrc_helper, |
1620 | scrub_wr_bio_end_io_worker, NULL, NULL); | ||
1620 | btrfs_queue_work(fs_info->scrub_wr_completion_workers, &sbio->work); | 1621 | btrfs_queue_work(fs_info->scrub_wr_completion_workers, &sbio->work); |
1621 | } | 1622 | } |
1622 | 1623 | ||
@@ -2904,6 +2905,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, | |||
2904 | struct scrub_ctx *sctx; | 2905 | struct scrub_ctx *sctx; |
2905 | int ret; | 2906 | int ret; |
2906 | struct btrfs_device *dev; | 2907 | struct btrfs_device *dev; |
2908 | struct rcu_string *name; | ||
2907 | 2909 | ||
2908 | if (btrfs_fs_closing(fs_info)) | 2910 | if (btrfs_fs_closing(fs_info)) |
2909 | return -EINVAL; | 2911 | return -EINVAL; |
@@ -2965,6 +2967,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, | |||
2965 | return -ENODEV; | 2967 | return -ENODEV; |
2966 | } | 2968 | } |
2967 | 2969 | ||
2970 | if (!is_dev_replace && !readonly && !dev->writeable) { | ||
2971 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | ||
2972 | rcu_read_lock(); | ||
2973 | name = rcu_dereference(dev->name); | ||
2974 | btrfs_err(fs_info, "scrub: device %s is not writable", | ||
2975 | name->str); | ||
2976 | rcu_read_unlock(); | ||
2977 | return -EROFS; | ||
2978 | } | ||
2979 | |||
2968 | mutex_lock(&fs_info->scrub_lock); | 2980 | mutex_lock(&fs_info->scrub_lock); |
2969 | if (!dev->in_fs_metadata || dev->is_tgtdev_for_dev_replace) { | 2981 | if (!dev->in_fs_metadata || dev->is_tgtdev_for_dev_replace) { |
2970 | mutex_unlock(&fs_info->scrub_lock); | 2982 | mutex_unlock(&fs_info->scrub_lock); |
@@ -3203,7 +3215,8 @@ static int copy_nocow_pages(struct scrub_ctx *sctx, u64 logical, u64 len, | |||
3203 | nocow_ctx->len = len; | 3215 | nocow_ctx->len = len; |
3204 | nocow_ctx->mirror_num = mirror_num; | 3216 | nocow_ctx->mirror_num = mirror_num; |
3205 | nocow_ctx->physical_for_dev_replace = physical_for_dev_replace; | 3217 | nocow_ctx->physical_for_dev_replace = physical_for_dev_replace; |
3206 | btrfs_init_work(&nocow_ctx->work, copy_nocow_pages_worker, NULL, NULL); | 3218 | btrfs_init_work(&nocow_ctx->work, btrfs_scrubnc_helper, |
3219 | copy_nocow_pages_worker, NULL, NULL); | ||
3207 | INIT_LIST_HEAD(&nocow_ctx->inodes); | 3220 | INIT_LIST_HEAD(&nocow_ctx->inodes); |
3208 | btrfs_queue_work(fs_info->scrub_nocow_workers, | 3221 | btrfs_queue_work(fs_info->scrub_nocow_workers, |
3209 | &nocow_ctx->work); | 3222 | &nocow_ctx->work); |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 78699364f537..12e53556e214 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
@@ -614,7 +614,7 @@ int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, | |||
614 | if (!fs_info->device_dir_kobj) | 614 | if (!fs_info->device_dir_kobj) |
615 | return -EINVAL; | 615 | return -EINVAL; |
616 | 616 | ||
617 | if (one_device) { | 617 | if (one_device && one_device->bdev) { |
618 | disk = one_device->bdev->bd_part; | 618 | disk = one_device->bdev->bd_part; |
619 | disk_kobj = &part_to_dev(disk)->kobj; | 619 | disk_kobj = &part_to_dev(disk)->kobj; |
620 | 620 | ||
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 9e1f2cd5e67a..1d1ba083ca6e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -94,8 +94,10 @@ | |||
94 | #define LOG_WALK_REPLAY_ALL 3 | 94 | #define LOG_WALK_REPLAY_ALL 3 |
95 | 95 | ||
96 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, | 96 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
97 | struct btrfs_root *root, struct inode *inode, | 97 | struct btrfs_root *root, struct inode *inode, |
98 | int inode_only); | 98 | int inode_only, |
99 | const loff_t start, | ||
100 | const loff_t end); | ||
99 | static int link_to_fixup_dir(struct btrfs_trans_handle *trans, | 101 | static int link_to_fixup_dir(struct btrfs_trans_handle *trans, |
100 | struct btrfs_root *root, | 102 | struct btrfs_root *root, |
101 | struct btrfs_path *path, u64 objectid); | 103 | struct btrfs_path *path, u64 objectid); |
@@ -3298,7 +3300,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, | |||
3298 | struct list_head ordered_sums; | 3300 | struct list_head ordered_sums; |
3299 | int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; | 3301 | int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; |
3300 | bool has_extents = false; | 3302 | bool has_extents = false; |
3301 | bool need_find_last_extent = (*last_extent == 0); | 3303 | bool need_find_last_extent = true; |
3302 | bool done = false; | 3304 | bool done = false; |
3303 | 3305 | ||
3304 | INIT_LIST_HEAD(&ordered_sums); | 3306 | INIT_LIST_HEAD(&ordered_sums); |
@@ -3352,8 +3354,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, | |||
3352 | */ | 3354 | */ |
3353 | if (ins_keys[i].type == BTRFS_EXTENT_DATA_KEY) { | 3355 | if (ins_keys[i].type == BTRFS_EXTENT_DATA_KEY) { |
3354 | has_extents = true; | 3356 | has_extents = true; |
3355 | if (need_find_last_extent && | 3357 | if (first_key.objectid == (u64)-1) |
3356 | first_key.objectid == (u64)-1) | ||
3357 | first_key = ins_keys[i]; | 3358 | first_key = ins_keys[i]; |
3358 | } else { | 3359 | } else { |
3359 | need_find_last_extent = false; | 3360 | need_find_last_extent = false; |
@@ -3427,6 +3428,16 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, | |||
3427 | if (!has_extents) | 3428 | if (!has_extents) |
3428 | return ret; | 3429 | return ret; |
3429 | 3430 | ||
3431 | if (need_find_last_extent && *last_extent == first_key.offset) { | ||
3432 | /* | ||
3433 | * We don't have any leafs between our current one and the one | ||
3434 | * we processed before that can have file extent items for our | ||
3435 | * inode (and have a generation number smaller than our current | ||
3436 | * transaction id). | ||
3437 | */ | ||
3438 | need_find_last_extent = false; | ||
3439 | } | ||
3440 | |||
3430 | /* | 3441 | /* |
3431 | * Because we use btrfs_search_forward we could skip leaves that were | 3442 | * Because we use btrfs_search_forward we could skip leaves that were |
3432 | * not modified and then assume *last_extent is valid when it really | 3443 | * not modified and then assume *last_extent is valid when it really |
@@ -3537,7 +3548,7 @@ fill_holes: | |||
3537 | 0, 0); | 3548 | 0, 0); |
3538 | if (ret) | 3549 | if (ret) |
3539 | break; | 3550 | break; |
3540 | *last_extent = offset + len; | 3551 | *last_extent = extent_end; |
3541 | } | 3552 | } |
3542 | /* | 3553 | /* |
3543 | * Need to let the callers know we dropped the path so they should | 3554 | * Need to let the callers know we dropped the path so they should |
@@ -3849,8 +3860,10 @@ process: | |||
3849 | * This handles both files and directories. | 3860 | * This handles both files and directories. |
3850 | */ | 3861 | */ |
3851 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, | 3862 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
3852 | struct btrfs_root *root, struct inode *inode, | 3863 | struct btrfs_root *root, struct inode *inode, |
3853 | int inode_only) | 3864 | int inode_only, |
3865 | const loff_t start, | ||
3866 | const loff_t end) | ||
3854 | { | 3867 | { |
3855 | struct btrfs_path *path; | 3868 | struct btrfs_path *path; |
3856 | struct btrfs_path *dst_path; | 3869 | struct btrfs_path *dst_path; |
@@ -3867,6 +3880,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, | |||
3867 | int ins_nr; | 3880 | int ins_nr; |
3868 | bool fast_search = false; | 3881 | bool fast_search = false; |
3869 | u64 ino = btrfs_ino(inode); | 3882 | u64 ino = btrfs_ino(inode); |
3883 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; | ||
3870 | 3884 | ||
3871 | path = btrfs_alloc_path(); | 3885 | path = btrfs_alloc_path(); |
3872 | if (!path) | 3886 | if (!path) |
@@ -4040,13 +4054,35 @@ log_extents: | |||
4040 | goto out_unlock; | 4054 | goto out_unlock; |
4041 | } | 4055 | } |
4042 | } else if (inode_only == LOG_INODE_ALL) { | 4056 | } else if (inode_only == LOG_INODE_ALL) { |
4043 | struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree; | ||
4044 | struct extent_map *em, *n; | 4057 | struct extent_map *em, *n; |
4045 | 4058 | ||
4046 | write_lock(&tree->lock); | 4059 | write_lock(&em_tree->lock); |
4047 | list_for_each_entry_safe(em, n, &tree->modified_extents, list) | 4060 | /* |
4048 | list_del_init(&em->list); | 4061 | * We can't just remove every em if we're called for a ranged |
4049 | write_unlock(&tree->lock); | 4062 | * fsync - that is, one that doesn't cover the whole possible |
4063 | * file range (0 to LLONG_MAX). This is because we can have | ||
4064 | * em's that fall outside the range we're logging and therefore | ||
4065 | * their ordered operations haven't completed yet | ||
4066 | * (btrfs_finish_ordered_io() not invoked yet). This means we | ||
4067 | * didn't get their respective file extent item in the fs/subvol | ||
4068 | * tree yet, and need to let the next fast fsync (one which | ||
4069 | * consults the list of modified extent maps) find the em so | ||
4070 | * that it logs a matching file extent item and waits for the | ||
4071 | * respective ordered operation to complete (if it's still | ||
4072 | * running). | ||
4073 | * | ||
4074 | * Removing every em outside the range we're logging would make | ||
4075 | * the next fast fsync not log their matching file extent items, | ||
4076 | * therefore making us lose data after a log replay. | ||
4077 | */ | ||
4078 | list_for_each_entry_safe(em, n, &em_tree->modified_extents, | ||
4079 | list) { | ||
4080 | const u64 mod_end = em->mod_start + em->mod_len - 1; | ||
4081 | |||
4082 | if (em->mod_start >= start && mod_end <= end) | ||
4083 | list_del_init(&em->list); | ||
4084 | } | ||
4085 | write_unlock(&em_tree->lock); | ||
4050 | } | 4086 | } |
4051 | 4087 | ||
4052 | if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { | 4088 | if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { |
@@ -4056,6 +4092,7 @@ log_extents: | |||
4056 | goto out_unlock; | 4092 | goto out_unlock; |
4057 | } | 4093 | } |
4058 | } | 4094 | } |
4095 | |||
4059 | BTRFS_I(inode)->logged_trans = trans->transid; | 4096 | BTRFS_I(inode)->logged_trans = trans->transid; |
4060 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans; | 4097 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans; |
4061 | out_unlock: | 4098 | out_unlock: |
@@ -4152,7 +4189,10 @@ out: | |||
4152 | */ | 4189 | */ |
4153 | static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | 4190 | static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, |
4154 | struct btrfs_root *root, struct inode *inode, | 4191 | struct btrfs_root *root, struct inode *inode, |
4155 | struct dentry *parent, int exists_only, | 4192 | struct dentry *parent, |
4193 | const loff_t start, | ||
4194 | const loff_t end, | ||
4195 | int exists_only, | ||
4156 | struct btrfs_log_ctx *ctx) | 4196 | struct btrfs_log_ctx *ctx) |
4157 | { | 4197 | { |
4158 | int inode_only = exists_only ? LOG_INODE_EXISTS : LOG_INODE_ALL; | 4198 | int inode_only = exists_only ? LOG_INODE_EXISTS : LOG_INODE_ALL; |
@@ -4198,7 +4238,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
4198 | if (ret) | 4238 | if (ret) |
4199 | goto end_no_trans; | 4239 | goto end_no_trans; |
4200 | 4240 | ||
4201 | ret = btrfs_log_inode(trans, root, inode, inode_only); | 4241 | ret = btrfs_log_inode(trans, root, inode, inode_only, start, end); |
4202 | if (ret) | 4242 | if (ret) |
4203 | goto end_trans; | 4243 | goto end_trans; |
4204 | 4244 | ||
@@ -4226,7 +4266,8 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
4226 | 4266 | ||
4227 | if (BTRFS_I(inode)->generation > | 4267 | if (BTRFS_I(inode)->generation > |
4228 | root->fs_info->last_trans_committed) { | 4268 | root->fs_info->last_trans_committed) { |
4229 | ret = btrfs_log_inode(trans, root, inode, inode_only); | 4269 | ret = btrfs_log_inode(trans, root, inode, inode_only, |
4270 | 0, LLONG_MAX); | ||
4230 | if (ret) | 4271 | if (ret) |
4231 | goto end_trans; | 4272 | goto end_trans; |
4232 | } | 4273 | } |
@@ -4260,13 +4301,15 @@ end_no_trans: | |||
4260 | */ | 4301 | */ |
4261 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, | 4302 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, |
4262 | struct btrfs_root *root, struct dentry *dentry, | 4303 | struct btrfs_root *root, struct dentry *dentry, |
4304 | const loff_t start, | ||
4305 | const loff_t end, | ||
4263 | struct btrfs_log_ctx *ctx) | 4306 | struct btrfs_log_ctx *ctx) |
4264 | { | 4307 | { |
4265 | struct dentry *parent = dget_parent(dentry); | 4308 | struct dentry *parent = dget_parent(dentry); |
4266 | int ret; | 4309 | int ret; |
4267 | 4310 | ||
4268 | ret = btrfs_log_inode_parent(trans, root, dentry->d_inode, parent, | 4311 | ret = btrfs_log_inode_parent(trans, root, dentry->d_inode, parent, |
4269 | 0, ctx); | 4312 | start, end, 0, ctx); |
4270 | dput(parent); | 4313 | dput(parent); |
4271 | 4314 | ||
4272 | return ret; | 4315 | return ret; |
@@ -4503,6 +4546,7 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans, | |||
4503 | root->fs_info->last_trans_committed)) | 4546 | root->fs_info->last_trans_committed)) |
4504 | return 0; | 4547 | return 0; |
4505 | 4548 | ||
4506 | return btrfs_log_inode_parent(trans, root, inode, parent, 1, NULL); | 4549 | return btrfs_log_inode_parent(trans, root, inode, parent, 0, |
4550 | LLONG_MAX, 1, NULL); | ||
4507 | } | 4551 | } |
4508 | 4552 | ||
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index 7f5b41bd5373..e2e798ae7cd7 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h | |||
@@ -59,6 +59,8 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans, | |||
59 | int btrfs_recover_log_trees(struct btrfs_root *tree_root); | 59 | int btrfs_recover_log_trees(struct btrfs_root *tree_root); |
60 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, | 60 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, |
61 | struct btrfs_root *root, struct dentry *dentry, | 61 | struct btrfs_root *root, struct dentry *dentry, |
62 | const loff_t start, | ||
63 | const loff_t end, | ||
62 | struct btrfs_log_ctx *ctx); | 64 | struct btrfs_log_ctx *ctx); |
63 | int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, | 65 | int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, |
64 | struct btrfs_root *root, | 66 | struct btrfs_root *root, |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6cb82f62cb7c..2c2d6d1d8eee 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -508,6 +508,43 @@ static noinline int device_list_add(const char *path, | |||
508 | ret = 1; | 508 | ret = 1; |
509 | device->fs_devices = fs_devices; | 509 | device->fs_devices = fs_devices; |
510 | } else if (!device->name || strcmp(device->name->str, path)) { | 510 | } else if (!device->name || strcmp(device->name->str, path)) { |
511 | /* | ||
512 | * When FS is already mounted. | ||
513 | * 1. If you are here and if the device->name is NULL that | ||
514 | * means this device was missing at time of FS mount. | ||
515 | * 2. If you are here and if the device->name is different | ||
516 | * from 'path' that means either | ||
517 | * a. The same device disappeared and reappeared with | ||
518 | * different name. or | ||
519 | * b. The missing-disk-which-was-replaced, has | ||
520 | * reappeared now. | ||
521 | * | ||
522 | * We must allow 1 and 2a above. But 2b would be a spurious | ||
523 | * and unintentional. | ||
524 | * | ||
525 | * Further in case of 1 and 2a above, the disk at 'path' | ||
526 | * would have missed some transaction when it was away and | ||
527 | * in case of 2a the stale bdev has to be updated as well. | ||
528 | * 2b must not be allowed at all time. | ||
529 | */ | ||
530 | |||
531 | /* | ||
532 | * For now, we do allow update to btrfs_fs_device through the | ||
533 | * btrfs dev scan cli after FS has been mounted. We're still | ||
534 | * tracking a problem where systems fail mount by subvolume id | ||
535 | * when we reject replacement on a mounted FS. | ||
536 | */ | ||
537 | if (!fs_devices->opened && found_transid < device->generation) { | ||
538 | /* | ||
539 | * That is if the FS is _not_ mounted and if you | ||
540 | * are here, that means there is more than one | ||
541 | * disk with same uuid and devid.We keep the one | ||
542 | * with larger generation number or the last-in if | ||
543 | * generation are equal. | ||
544 | */ | ||
545 | return -EEXIST; | ||
546 | } | ||
547 | |||
511 | name = rcu_string_strdup(path, GFP_NOFS); | 548 | name = rcu_string_strdup(path, GFP_NOFS); |
512 | if (!name) | 549 | if (!name) |
513 | return -ENOMEM; | 550 | return -ENOMEM; |
@@ -519,6 +556,15 @@ static noinline int device_list_add(const char *path, | |||
519 | } | 556 | } |
520 | } | 557 | } |
521 | 558 | ||
559 | /* | ||
560 | * Unmount does not free the btrfs_device struct but would zero | ||
561 | * generation along with most of the other members. So just update | ||
562 | * it back. We need it to pick the disk with largest generation | ||
563 | * (as above). | ||
564 | */ | ||
565 | if (!fs_devices->opened) | ||
566 | device->generation = found_transid; | ||
567 | |||
522 | if (found_transid > fs_devices->latest_trans) { | 568 | if (found_transid > fs_devices->latest_trans) { |
523 | fs_devices->latest_devid = devid; | 569 | fs_devices->latest_devid = devid; |
524 | fs_devices->latest_trans = found_transid; | 570 | fs_devices->latest_trans = found_transid; |
@@ -1436,7 +1482,7 @@ static int btrfs_add_device(struct btrfs_trans_handle *trans, | |||
1436 | btrfs_set_device_io_align(leaf, dev_item, device->io_align); | 1482 | btrfs_set_device_io_align(leaf, dev_item, device->io_align); |
1437 | btrfs_set_device_io_width(leaf, dev_item, device->io_width); | 1483 | btrfs_set_device_io_width(leaf, dev_item, device->io_width); |
1438 | btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); | 1484 | btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); |
1439 | btrfs_set_device_total_bytes(leaf, dev_item, device->total_bytes); | 1485 | btrfs_set_device_total_bytes(leaf, dev_item, device->disk_total_bytes); |
1440 | btrfs_set_device_bytes_used(leaf, dev_item, device->bytes_used); | 1486 | btrfs_set_device_bytes_used(leaf, dev_item, device->bytes_used); |
1441 | btrfs_set_device_group(leaf, dev_item, 0); | 1487 | btrfs_set_device_group(leaf, dev_item, 0); |
1442 | btrfs_set_device_seek_speed(leaf, dev_item, 0); | 1488 | btrfs_set_device_seek_speed(leaf, dev_item, 0); |
@@ -1671,7 +1717,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1671 | device->fs_devices->total_devices--; | 1717 | device->fs_devices->total_devices--; |
1672 | 1718 | ||
1673 | if (device->missing) | 1719 | if (device->missing) |
1674 | root->fs_info->fs_devices->missing_devices--; | 1720 | device->fs_devices->missing_devices--; |
1675 | 1721 | ||
1676 | next_device = list_entry(root->fs_info->fs_devices->devices.next, | 1722 | next_device = list_entry(root->fs_info->fs_devices->devices.next, |
1677 | struct btrfs_device, dev_list); | 1723 | struct btrfs_device, dev_list); |
@@ -1801,8 +1847,12 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info, | |||
1801 | if (srcdev->bdev) { | 1847 | if (srcdev->bdev) { |
1802 | fs_info->fs_devices->open_devices--; | 1848 | fs_info->fs_devices->open_devices--; |
1803 | 1849 | ||
1804 | /* zero out the old super */ | 1850 | /* |
1805 | btrfs_scratch_superblock(srcdev); | 1851 | * zero out the old super if it is not writable |
1852 | * (e.g. seed device) | ||
1853 | */ | ||
1854 | if (srcdev->writeable) | ||
1855 | btrfs_scratch_superblock(srcdev); | ||
1806 | } | 1856 | } |
1807 | 1857 | ||
1808 | call_rcu(&srcdev->rcu, free_device); | 1858 | call_rcu(&srcdev->rcu, free_device); |
@@ -1941,6 +1991,9 @@ static int btrfs_prepare_sprout(struct btrfs_root *root) | |||
1941 | fs_devices->seeding = 0; | 1991 | fs_devices->seeding = 0; |
1942 | fs_devices->num_devices = 0; | 1992 | fs_devices->num_devices = 0; |
1943 | fs_devices->open_devices = 0; | 1993 | fs_devices->open_devices = 0; |
1994 | fs_devices->missing_devices = 0; | ||
1995 | fs_devices->num_can_discard = 0; | ||
1996 | fs_devices->rotating = 0; | ||
1944 | fs_devices->seed = seed_devices; | 1997 | fs_devices->seed = seed_devices; |
1945 | 1998 | ||
1946 | generate_random_uuid(fs_devices->fsid); | 1999 | generate_random_uuid(fs_devices->fsid); |
@@ -5800,7 +5853,8 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info, | |||
5800 | else | 5853 | else |
5801 | generate_random_uuid(dev->uuid); | 5854 | generate_random_uuid(dev->uuid); |
5802 | 5855 | ||
5803 | btrfs_init_work(&dev->work, pending_bios_fn, NULL, NULL); | 5856 | btrfs_init_work(&dev->work, btrfs_submit_helper, |
5857 | pending_bios_fn, NULL, NULL); | ||
5804 | 5858 | ||
5805 | return dev; | 5859 | return dev; |
5806 | } | 5860 | } |
diff --git a/fs/buffer.c b/fs/buffer.c index 8f05111bbb8b..3588a80854b2 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1022,7 +1022,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
1022 | bh = page_buffers(page); | 1022 | bh = page_buffers(page); |
1023 | if (bh->b_size == size) { | 1023 | if (bh->b_size == size) { |
1024 | end_block = init_page_buffers(page, bdev, | 1024 | end_block = init_page_buffers(page, bdev, |
1025 | index << sizebits, size); | 1025 | (sector_t)index << sizebits, |
1026 | size); | ||
1026 | goto done; | 1027 | goto done; |
1027 | } | 1028 | } |
1028 | if (!try_to_free_buffers(page)) | 1029 | if (!try_to_free_buffers(page)) |
@@ -1043,7 +1044,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
1043 | */ | 1044 | */ |
1044 | spin_lock(&inode->i_mapping->private_lock); | 1045 | spin_lock(&inode->i_mapping->private_lock); |
1045 | link_dev_buffers(page, bh); | 1046 | link_dev_buffers(page, bh); |
1046 | end_block = init_page_buffers(page, bdev, index << sizebits, size); | 1047 | end_block = init_page_buffers(page, bdev, (sector_t)index << sizebits, |
1048 | size); | ||
1047 | spin_unlock(&inode->i_mapping->private_lock); | 1049 | spin_unlock(&inode->i_mapping->private_lock); |
1048 | done: | 1050 | done: |
1049 | ret = (block < end_block) ? 1 : -ENXIO; | 1051 | ret = (block < end_block) ? 1 : -ENXIO; |
diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c index d749731dc0ee..fbb08e97438d 100644 --- a/fs/cachefiles/bind.c +++ b/fs/cachefiles/bind.c | |||
@@ -50,18 +50,18 @@ int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args) | |||
50 | cache->brun_percent < 100); | 50 | cache->brun_percent < 100); |
51 | 51 | ||
52 | if (*args) { | 52 | if (*args) { |
53 | pr_err("'bind' command doesn't take an argument"); | 53 | pr_err("'bind' command doesn't take an argument\n"); |
54 | return -EINVAL; | 54 | return -EINVAL; |
55 | } | 55 | } |
56 | 56 | ||
57 | if (!cache->rootdirname) { | 57 | if (!cache->rootdirname) { |
58 | pr_err("No cache directory specified"); | 58 | pr_err("No cache directory specified\n"); |
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | } | 60 | } |
61 | 61 | ||
62 | /* don't permit already bound caches to be re-bound */ | 62 | /* don't permit already bound caches to be re-bound */ |
63 | if (test_bit(CACHEFILES_READY, &cache->flags)) { | 63 | if (test_bit(CACHEFILES_READY, &cache->flags)) { |
64 | pr_err("Cache already bound"); | 64 | pr_err("Cache already bound\n"); |
65 | return -EBUSY; | 65 | return -EBUSY; |
66 | } | 66 | } |
67 | 67 | ||
@@ -248,7 +248,7 @@ error_open_root: | |||
248 | kmem_cache_free(cachefiles_object_jar, fsdef); | 248 | kmem_cache_free(cachefiles_object_jar, fsdef); |
249 | error_root_object: | 249 | error_root_object: |
250 | cachefiles_end_secure(cache, saved_cred); | 250 | cachefiles_end_secure(cache, saved_cred); |
251 | pr_err("Failed to register: %d", ret); | 251 | pr_err("Failed to register: %d\n", ret); |
252 | return ret; | 252 | return ret; |
253 | } | 253 | } |
254 | 254 | ||
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index b078d3081d6c..ce1b115dcc28 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c | |||
@@ -315,7 +315,7 @@ static unsigned int cachefiles_daemon_poll(struct file *file, | |||
315 | static int cachefiles_daemon_range_error(struct cachefiles_cache *cache, | 315 | static int cachefiles_daemon_range_error(struct cachefiles_cache *cache, |
316 | char *args) | 316 | char *args) |
317 | { | 317 | { |
318 | pr_err("Free space limits must be in range 0%%<=stop<cull<run<100%%"); | 318 | pr_err("Free space limits must be in range 0%%<=stop<cull<run<100%%\n"); |
319 | 319 | ||
320 | return -EINVAL; | 320 | return -EINVAL; |
321 | } | 321 | } |
@@ -475,12 +475,12 @@ static int cachefiles_daemon_dir(struct cachefiles_cache *cache, char *args) | |||
475 | _enter(",%s", args); | 475 | _enter(",%s", args); |
476 | 476 | ||
477 | if (!*args) { | 477 | if (!*args) { |
478 | pr_err("Empty directory specified"); | 478 | pr_err("Empty directory specified\n"); |
479 | return -EINVAL; | 479 | return -EINVAL; |
480 | } | 480 | } |
481 | 481 | ||
482 | if (cache->rootdirname) { | 482 | if (cache->rootdirname) { |
483 | pr_err("Second cache directory specified"); | 483 | pr_err("Second cache directory specified\n"); |
484 | return -EEXIST; | 484 | return -EEXIST; |
485 | } | 485 | } |
486 | 486 | ||
@@ -503,12 +503,12 @@ static int cachefiles_daemon_secctx(struct cachefiles_cache *cache, char *args) | |||
503 | _enter(",%s", args); | 503 | _enter(",%s", args); |
504 | 504 | ||
505 | if (!*args) { | 505 | if (!*args) { |
506 | pr_err("Empty security context specified"); | 506 | pr_err("Empty security context specified\n"); |
507 | return -EINVAL; | 507 | return -EINVAL; |
508 | } | 508 | } |
509 | 509 | ||
510 | if (cache->secctx) { | 510 | if (cache->secctx) { |
511 | pr_err("Second security context specified"); | 511 | pr_err("Second security context specified\n"); |
512 | return -EINVAL; | 512 | return -EINVAL; |
513 | } | 513 | } |
514 | 514 | ||
@@ -531,7 +531,7 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args) | |||
531 | _enter(",%s", args); | 531 | _enter(",%s", args); |
532 | 532 | ||
533 | if (!*args) { | 533 | if (!*args) { |
534 | pr_err("Empty tag specified"); | 534 | pr_err("Empty tag specified\n"); |
535 | return -EINVAL; | 535 | return -EINVAL; |
536 | } | 536 | } |
537 | 537 | ||
@@ -562,12 +562,12 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
562 | goto inval; | 562 | goto inval; |
563 | 563 | ||
564 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { | 564 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { |
565 | pr_err("cull applied to unready cache"); | 565 | pr_err("cull applied to unready cache\n"); |
566 | return -EIO; | 566 | return -EIO; |
567 | } | 567 | } |
568 | 568 | ||
569 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { | 569 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { |
570 | pr_err("cull applied to dead cache"); | 570 | pr_err("cull applied to dead cache\n"); |
571 | return -EIO; | 571 | return -EIO; |
572 | } | 572 | } |
573 | 573 | ||
@@ -587,11 +587,11 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
587 | 587 | ||
588 | notdir: | 588 | notdir: |
589 | path_put(&path); | 589 | path_put(&path); |
590 | pr_err("cull command requires dirfd to be a directory"); | 590 | pr_err("cull command requires dirfd to be a directory\n"); |
591 | return -ENOTDIR; | 591 | return -ENOTDIR; |
592 | 592 | ||
593 | inval: | 593 | inval: |
594 | pr_err("cull command requires dirfd and filename"); | 594 | pr_err("cull command requires dirfd and filename\n"); |
595 | return -EINVAL; | 595 | return -EINVAL; |
596 | } | 596 | } |
597 | 597 | ||
@@ -614,7 +614,7 @@ static int cachefiles_daemon_debug(struct cachefiles_cache *cache, char *args) | |||
614 | return 0; | 614 | return 0; |
615 | 615 | ||
616 | inval: | 616 | inval: |
617 | pr_err("debug command requires mask"); | 617 | pr_err("debug command requires mask\n"); |
618 | return -EINVAL; | 618 | return -EINVAL; |
619 | } | 619 | } |
620 | 620 | ||
@@ -634,12 +634,12 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
634 | goto inval; | 634 | goto inval; |
635 | 635 | ||
636 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { | 636 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { |
637 | pr_err("inuse applied to unready cache"); | 637 | pr_err("inuse applied to unready cache\n"); |
638 | return -EIO; | 638 | return -EIO; |
639 | } | 639 | } |
640 | 640 | ||
641 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { | 641 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { |
642 | pr_err("inuse applied to dead cache"); | 642 | pr_err("inuse applied to dead cache\n"); |
643 | return -EIO; | 643 | return -EIO; |
644 | } | 644 | } |
645 | 645 | ||
@@ -659,11 +659,11 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
659 | 659 | ||
660 | notdir: | 660 | notdir: |
661 | path_put(&path); | 661 | path_put(&path); |
662 | pr_err("inuse command requires dirfd to be a directory"); | 662 | pr_err("inuse command requires dirfd to be a directory\n"); |
663 | return -ENOTDIR; | 663 | return -ENOTDIR; |
664 | 664 | ||
665 | inval: | 665 | inval: |
666 | pr_err("inuse command requires dirfd and filename"); | 666 | pr_err("inuse command requires dirfd and filename\n"); |
667 | return -EINVAL; | 667 | return -EINVAL; |
668 | } | 668 | } |
669 | 669 | ||
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index 3d50998abf57..8c52472d2efa 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h | |||
@@ -255,7 +255,7 @@ extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache, | |||
255 | 255 | ||
256 | #define cachefiles_io_error(___cache, FMT, ...) \ | 256 | #define cachefiles_io_error(___cache, FMT, ...) \ |
257 | do { \ | 257 | do { \ |
258 | pr_err("I/O Error: " FMT, ##__VA_ARGS__); \ | 258 | pr_err("I/O Error: " FMT"\n", ##__VA_ARGS__); \ |
259 | fscache_io_error(&(___cache)->cache); \ | 259 | fscache_io_error(&(___cache)->cache); \ |
260 | set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ | 260 | set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ |
261 | } while (0) | 261 | } while (0) |
diff --git a/fs/cachefiles/main.c b/fs/cachefiles/main.c index 180edfb45f66..711f13d8c2de 100644 --- a/fs/cachefiles/main.c +++ b/fs/cachefiles/main.c | |||
@@ -84,7 +84,7 @@ error_proc: | |||
84 | error_object_jar: | 84 | error_object_jar: |
85 | misc_deregister(&cachefiles_dev); | 85 | misc_deregister(&cachefiles_dev); |
86 | error_dev: | 86 | error_dev: |
87 | pr_err("failed to register: %d", ret); | 87 | pr_err("failed to register: %d\n", ret); |
88 | return ret; | 88 | return ret; |
89 | } | 89 | } |
90 | 90 | ||
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 5bf2b41e66d3..dad7d9542a24 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -543,7 +543,7 @@ lookup_again: | |||
543 | next, next->d_inode, next->d_inode->i_ino); | 543 | next, next->d_inode, next->d_inode->i_ino); |
544 | 544 | ||
545 | } else if (!S_ISDIR(next->d_inode->i_mode)) { | 545 | } else if (!S_ISDIR(next->d_inode->i_mode)) { |
546 | pr_err("inode %lu is not a directory", | 546 | pr_err("inode %lu is not a directory\n", |
547 | next->d_inode->i_ino); | 547 | next->d_inode->i_ino); |
548 | ret = -ENOBUFS; | 548 | ret = -ENOBUFS; |
549 | goto error; | 549 | goto error; |
@@ -574,7 +574,7 @@ lookup_again: | |||
574 | } else if (!S_ISDIR(next->d_inode->i_mode) && | 574 | } else if (!S_ISDIR(next->d_inode->i_mode) && |
575 | !S_ISREG(next->d_inode->i_mode) | 575 | !S_ISREG(next->d_inode->i_mode) |
576 | ) { | 576 | ) { |
577 | pr_err("inode %lu is not a file or directory", | 577 | pr_err("inode %lu is not a file or directory\n", |
578 | next->d_inode->i_ino); | 578 | next->d_inode->i_ino); |
579 | ret = -ENOBUFS; | 579 | ret = -ENOBUFS; |
580 | goto error; | 580 | goto error; |
@@ -768,7 +768,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
768 | ASSERT(subdir->d_inode); | 768 | ASSERT(subdir->d_inode); |
769 | 769 | ||
770 | if (!S_ISDIR(subdir->d_inode->i_mode)) { | 770 | if (!S_ISDIR(subdir->d_inode->i_mode)) { |
771 | pr_err("%s is not a directory", dirname); | 771 | pr_err("%s is not a directory\n", dirname); |
772 | ret = -EIO; | 772 | ret = -EIO; |
773 | goto check_error; | 773 | goto check_error; |
774 | } | 774 | } |
@@ -779,7 +779,8 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
779 | !subdir->d_inode->i_op->lookup || | 779 | !subdir->d_inode->i_op->lookup || |
780 | !subdir->d_inode->i_op->mkdir || | 780 | !subdir->d_inode->i_op->mkdir || |
781 | !subdir->d_inode->i_op->create || | 781 | !subdir->d_inode->i_op->create || |
782 | !subdir->d_inode->i_op->rename || | 782 | (!subdir->d_inode->i_op->rename && |
783 | !subdir->d_inode->i_op->rename2) || | ||
783 | !subdir->d_inode->i_op->rmdir || | 784 | !subdir->d_inode->i_op->rmdir || |
784 | !subdir->d_inode->i_op->unlink) | 785 | !subdir->d_inode->i_op->unlink) |
785 | goto check_error; | 786 | goto check_error; |
@@ -795,13 +796,13 @@ check_error: | |||
795 | mkdir_error: | 796 | mkdir_error: |
796 | mutex_unlock(&dir->d_inode->i_mutex); | 797 | mutex_unlock(&dir->d_inode->i_mutex); |
797 | dput(subdir); | 798 | dput(subdir); |
798 | pr_err("mkdir %s failed with error %d", dirname, ret); | 799 | pr_err("mkdir %s failed with error %d\n", dirname, ret); |
799 | return ERR_PTR(ret); | 800 | return ERR_PTR(ret); |
800 | 801 | ||
801 | lookup_error: | 802 | lookup_error: |
802 | mutex_unlock(&dir->d_inode->i_mutex); | 803 | mutex_unlock(&dir->d_inode->i_mutex); |
803 | ret = PTR_ERR(subdir); | 804 | ret = PTR_ERR(subdir); |
804 | pr_err("Lookup %s failed with error %d", dirname, ret); | 805 | pr_err("Lookup %s failed with error %d\n", dirname, ret); |
805 | return ERR_PTR(ret); | 806 | return ERR_PTR(ret); |
806 | 807 | ||
807 | nomem_d_alloc: | 808 | nomem_d_alloc: |
@@ -891,7 +892,7 @@ lookup_error: | |||
891 | if (ret == -EIO) { | 892 | if (ret == -EIO) { |
892 | cachefiles_io_error(cache, "Lookup failed"); | 893 | cachefiles_io_error(cache, "Lookup failed"); |
893 | } else if (ret != -ENOMEM) { | 894 | } else if (ret != -ENOMEM) { |
894 | pr_err("Internal error: %d", ret); | 895 | pr_err("Internal error: %d\n", ret); |
895 | ret = -EIO; | 896 | ret = -EIO; |
896 | } | 897 | } |
897 | 898 | ||
@@ -950,7 +951,7 @@ error: | |||
950 | } | 951 | } |
951 | 952 | ||
952 | if (ret != -ENOMEM) { | 953 | if (ret != -ENOMEM) { |
953 | pr_err("Internal error: %d", ret); | 954 | pr_err("Internal error: %d\n", ret); |
954 | ret = -EIO; | 955 | ret = -EIO; |
955 | } | 956 | } |
956 | 957 | ||
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 4b1fb5ca65b8..25e745b8eb1b 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -151,7 +151,6 @@ static void cachefiles_read_copier(struct fscache_operation *_op) | |||
151 | struct cachefiles_one_read *monitor; | 151 | struct cachefiles_one_read *monitor; |
152 | struct cachefiles_object *object; | 152 | struct cachefiles_object *object; |
153 | struct fscache_retrieval *op; | 153 | struct fscache_retrieval *op; |
154 | struct pagevec pagevec; | ||
155 | int error, max; | 154 | int error, max; |
156 | 155 | ||
157 | op = container_of(_op, struct fscache_retrieval, op); | 156 | op = container_of(_op, struct fscache_retrieval, op); |
@@ -160,8 +159,6 @@ static void cachefiles_read_copier(struct fscache_operation *_op) | |||
160 | 159 | ||
161 | _enter("{ino=%lu}", object->backer->d_inode->i_ino); | 160 | _enter("{ino=%lu}", object->backer->d_inode->i_ino); |
162 | 161 | ||
163 | pagevec_init(&pagevec, 0); | ||
164 | |||
165 | max = 8; | 162 | max = 8; |
166 | spin_lock_irq(&object->work_lock); | 163 | spin_lock_irq(&object->work_lock); |
167 | 164 | ||
@@ -396,7 +393,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
396 | { | 393 | { |
397 | struct cachefiles_object *object; | 394 | struct cachefiles_object *object; |
398 | struct cachefiles_cache *cache; | 395 | struct cachefiles_cache *cache; |
399 | struct pagevec pagevec; | ||
400 | struct inode *inode; | 396 | struct inode *inode; |
401 | sector_t block0, block; | 397 | sector_t block0, block; |
402 | unsigned shift; | 398 | unsigned shift; |
@@ -427,8 +423,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
427 | op->op.flags |= FSCACHE_OP_ASYNC; | 423 | op->op.flags |= FSCACHE_OP_ASYNC; |
428 | op->op.processor = cachefiles_read_copier; | 424 | op->op.processor = cachefiles_read_copier; |
429 | 425 | ||
430 | pagevec_init(&pagevec, 0); | ||
431 | |||
432 | /* we assume the absence or presence of the first block is a good | 426 | /* we assume the absence or presence of the first block is a good |
433 | * enough indication for the page as a whole | 427 | * enough indication for the page as a whole |
434 | * - TODO: don't use bmap() for this as it is _not_ actually good | 428 | * - TODO: don't use bmap() for this as it is _not_ actually good |
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index 1ad51ffbb275..acbc1f094fb1 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
@@ -51,7 +51,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | if (ret != -EEXIST) { | 53 | if (ret != -EEXIST) { |
54 | pr_err("Can't set xattr on %*.*s [%lu] (err %d)", | 54 | pr_err("Can't set xattr on %*.*s [%lu] (err %d)\n", |
55 | dentry->d_name.len, dentry->d_name.len, | 55 | dentry->d_name.len, dentry->d_name.len, |
56 | dentry->d_name.name, dentry->d_inode->i_ino, | 56 | dentry->d_name.name, dentry->d_inode->i_ino, |
57 | -ret); | 57 | -ret); |
@@ -64,7 +64,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
64 | if (ret == -ERANGE) | 64 | if (ret == -ERANGE) |
65 | goto bad_type_length; | 65 | goto bad_type_length; |
66 | 66 | ||
67 | pr_err("Can't read xattr on %*.*s [%lu] (err %d)", | 67 | pr_err("Can't read xattr on %*.*s [%lu] (err %d)\n", |
68 | dentry->d_name.len, dentry->d_name.len, | 68 | dentry->d_name.len, dentry->d_name.len, |
69 | dentry->d_name.name, dentry->d_inode->i_ino, | 69 | dentry->d_name.name, dentry->d_inode->i_ino, |
70 | -ret); | 70 | -ret); |
@@ -85,14 +85,14 @@ error: | |||
85 | return ret; | 85 | return ret; |
86 | 86 | ||
87 | bad_type_length: | 87 | bad_type_length: |
88 | pr_err("Cache object %lu type xattr length incorrect", | 88 | pr_err("Cache object %lu type xattr length incorrect\n", |
89 | dentry->d_inode->i_ino); | 89 | dentry->d_inode->i_ino); |
90 | ret = -EIO; | 90 | ret = -EIO; |
91 | goto error; | 91 | goto error; |
92 | 92 | ||
93 | bad_type: | 93 | bad_type: |
94 | xtype[2] = 0; | 94 | xtype[2] = 0; |
95 | pr_err("Cache object %*.*s [%lu] type %s not %s", | 95 | pr_err("Cache object %*.*s [%lu] type %s not %s\n", |
96 | dentry->d_name.len, dentry->d_name.len, | 96 | dentry->d_name.len, dentry->d_name.len, |
97 | dentry->d_name.name, dentry->d_inode->i_ino, | 97 | dentry->d_name.name, dentry->d_inode->i_ino, |
98 | xtype, type); | 98 | xtype, type); |
@@ -293,7 +293,7 @@ error: | |||
293 | return ret; | 293 | return ret; |
294 | 294 | ||
295 | bad_type_length: | 295 | bad_type_length: |
296 | pr_err("Cache object %lu xattr length incorrect", | 296 | pr_err("Cache object %lu xattr length incorrect\n", |
297 | dentry->d_inode->i_ino); | 297 | dentry->d_inode->i_ino); |
298 | ret = -EIO; | 298 | ret = -EIO; |
299 | goto error; | 299 | goto error; |
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig index 603f18a65c12..a2172f3f69e3 100644 --- a/fs/cifs/Kconfig +++ b/fs/cifs/Kconfig | |||
@@ -22,6 +22,11 @@ config CIFS | |||
22 | support for OS/2 and Windows ME and similar servers is provided as | 22 | support for OS/2 and Windows ME and similar servers is provided as |
23 | well. | 23 | well. |
24 | 24 | ||
25 | The module also provides optional support for the followon | ||
26 | protocols for CIFS including SMB3, which enables | ||
27 | useful performance and security features (see the description | ||
28 | of CONFIG_CIFS_SMB2). | ||
29 | |||
25 | The cifs module provides an advanced network file system | 30 | The cifs module provides an advanced network file system |
26 | client for mounting to CIFS compliant servers. It includes | 31 | client for mounting to CIFS compliant servers. It includes |
27 | support for DFS (hierarchical name space), secure per-user | 32 | support for DFS (hierarchical name space), secure per-user |
@@ -121,7 +126,8 @@ config CIFS_ACL | |||
121 | depends on CIFS_XATTR && KEYS | 126 | depends on CIFS_XATTR && KEYS |
122 | help | 127 | help |
123 | Allows fetching CIFS/NTFS ACL from the server. The DACL blob | 128 | Allows fetching CIFS/NTFS ACL from the server. The DACL blob |
124 | is handed over to the application/caller. | 129 | is handed over to the application/caller. See the man |
130 | page for getcifsacl for more information. | ||
125 | 131 | ||
126 | config CIFS_DEBUG | 132 | config CIFS_DEBUG |
127 | bool "Enable CIFS debugging routines" | 133 | bool "Enable CIFS debugging routines" |
@@ -162,7 +168,7 @@ config CIFS_NFSD_EXPORT | |||
162 | Allows NFS server to export a CIFS mounted share (nfsd over cifs) | 168 | Allows NFS server to export a CIFS mounted share (nfsd over cifs) |
163 | 169 | ||
164 | config CIFS_SMB2 | 170 | config CIFS_SMB2 |
165 | bool "SMB2 network file system support" | 171 | bool "SMB2 and SMB3 network file system support" |
166 | depends on CIFS && INET | 172 | depends on CIFS && INET |
167 | select NLS | 173 | select NLS |
168 | select KEYS | 174 | select KEYS |
@@ -170,16 +176,21 @@ config CIFS_SMB2 | |||
170 | select DNS_RESOLVER | 176 | select DNS_RESOLVER |
171 | 177 | ||
172 | help | 178 | help |
173 | This enables experimental support for the SMB2 (Server Message Block | 179 | This enables support for the Server Message Block version 2 |
174 | version 2) protocol. The SMB2 protocol is the successor to the | 180 | family of protocols, including SMB3. SMB3 support is |
175 | popular CIFS and SMB network file sharing protocols. SMB2 is the | 181 | enabled on mount by specifying "vers=3.0" in the mount |
176 | native file sharing mechanism for recent versions of Windows | 182 | options. These protocols are the successors to the popular |
177 | operating systems (since Vista). SMB2 enablement will eventually | 183 | CIFS and SMB network file sharing protocols. SMB3 is the |
178 | allow users better performance, security and features, than would be | 184 | native file sharing mechanism for the more recent |
179 | possible with cifs. Note that smb2 mount options also are simpler | 185 | versions of Windows (Windows 8 and Windows 2012 and |
180 | (compared to cifs) due to protocol improvements. | 186 | later) and Samba server and many others support SMB3 well. |
181 | 187 | In general SMB3 enables better performance, security | |
182 | Unless you are a developer or tester, say N. | 188 | and features, than would be possible with CIFS (Note that |
189 | when mounting to Samba, due to the CIFS POSIX extensions, | ||
190 | CIFS mounts can provide slightly better POSIX compatibility | ||
191 | than SMB3 mounts do though). Note that SMB2/SMB3 mount | ||
192 | options are also slightly simpler (compared to CIFS) due | ||
193 | to protocol improvements. | ||
183 | 194 | ||
184 | config CIFS_FSCACHE | 195 | config CIFS_FSCACHE |
185 | bool "Provide CIFS client caching support" | 196 | bool "Provide CIFS client caching support" |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index ac4f260155c8..889b98455750 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -207,6 +207,19 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
210 | static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len) | ||
211 | { | ||
212 | struct super_block *sb = file->f_path.dentry->d_sb; | ||
213 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | ||
214 | struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); | ||
215 | struct TCP_Server_Info *server = tcon->ses->server; | ||
216 | |||
217 | if (server->ops->fallocate) | ||
218 | return server->ops->fallocate(file, tcon, mode, off, len); | ||
219 | |||
220 | return -EOPNOTSUPP; | ||
221 | } | ||
222 | |||
210 | static int cifs_permission(struct inode *inode, int mask) | 223 | static int cifs_permission(struct inode *inode, int mask) |
211 | { | 224 | { |
212 | struct cifs_sb_info *cifs_sb; | 225 | struct cifs_sb_info *cifs_sb; |
@@ -812,8 +825,9 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) | |||
812 | if (!(S_ISREG(inode->i_mode))) | 825 | if (!(S_ISREG(inode->i_mode))) |
813 | return -EINVAL; | 826 | return -EINVAL; |
814 | 827 | ||
815 | /* check if file is oplocked */ | 828 | /* Check if file is oplocked if this is request for new lease */ |
816 | if (((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) || | 829 | if (arg == F_UNLCK || |
830 | ((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) || | ||
817 | ((arg == F_WRLCK) && CIFS_CACHE_WRITE(CIFS_I(inode)))) | 831 | ((arg == F_WRLCK) && CIFS_CACHE_WRITE(CIFS_I(inode)))) |
818 | return generic_setlease(file, arg, lease); | 832 | return generic_setlease(file, arg, lease); |
819 | else if (tlink_tcon(cfile->tlink)->local_lease && | 833 | else if (tlink_tcon(cfile->tlink)->local_lease && |
@@ -908,6 +922,7 @@ const struct file_operations cifs_file_ops = { | |||
908 | .unlocked_ioctl = cifs_ioctl, | 922 | .unlocked_ioctl = cifs_ioctl, |
909 | #endif /* CONFIG_CIFS_POSIX */ | 923 | #endif /* CONFIG_CIFS_POSIX */ |
910 | .setlease = cifs_setlease, | 924 | .setlease = cifs_setlease, |
925 | .fallocate = cifs_fallocate, | ||
911 | }; | 926 | }; |
912 | 927 | ||
913 | const struct file_operations cifs_file_strict_ops = { | 928 | const struct file_operations cifs_file_strict_ops = { |
@@ -927,6 +942,7 @@ const struct file_operations cifs_file_strict_ops = { | |||
927 | .unlocked_ioctl = cifs_ioctl, | 942 | .unlocked_ioctl = cifs_ioctl, |
928 | #endif /* CONFIG_CIFS_POSIX */ | 943 | #endif /* CONFIG_CIFS_POSIX */ |
929 | .setlease = cifs_setlease, | 944 | .setlease = cifs_setlease, |
945 | .fallocate = cifs_fallocate, | ||
930 | }; | 946 | }; |
931 | 947 | ||
932 | const struct file_operations cifs_file_direct_ops = { | 948 | const struct file_operations cifs_file_direct_ops = { |
@@ -947,6 +963,7 @@ const struct file_operations cifs_file_direct_ops = { | |||
947 | #endif /* CONFIG_CIFS_POSIX */ | 963 | #endif /* CONFIG_CIFS_POSIX */ |
948 | .llseek = cifs_llseek, | 964 | .llseek = cifs_llseek, |
949 | .setlease = cifs_setlease, | 965 | .setlease = cifs_setlease, |
966 | .fallocate = cifs_fallocate, | ||
950 | }; | 967 | }; |
951 | 968 | ||
952 | const struct file_operations cifs_file_nobrl_ops = { | 969 | const struct file_operations cifs_file_nobrl_ops = { |
@@ -965,6 +982,7 @@ const struct file_operations cifs_file_nobrl_ops = { | |||
965 | .unlocked_ioctl = cifs_ioctl, | 982 | .unlocked_ioctl = cifs_ioctl, |
966 | #endif /* CONFIG_CIFS_POSIX */ | 983 | #endif /* CONFIG_CIFS_POSIX */ |
967 | .setlease = cifs_setlease, | 984 | .setlease = cifs_setlease, |
985 | .fallocate = cifs_fallocate, | ||
968 | }; | 986 | }; |
969 | 987 | ||
970 | const struct file_operations cifs_file_strict_nobrl_ops = { | 988 | const struct file_operations cifs_file_strict_nobrl_ops = { |
@@ -983,6 +1001,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = { | |||
983 | .unlocked_ioctl = cifs_ioctl, | 1001 | .unlocked_ioctl = cifs_ioctl, |
984 | #endif /* CONFIG_CIFS_POSIX */ | 1002 | #endif /* CONFIG_CIFS_POSIX */ |
985 | .setlease = cifs_setlease, | 1003 | .setlease = cifs_setlease, |
1004 | .fallocate = cifs_fallocate, | ||
986 | }; | 1005 | }; |
987 | 1006 | ||
988 | const struct file_operations cifs_file_direct_nobrl_ops = { | 1007 | const struct file_operations cifs_file_direct_nobrl_ops = { |
@@ -1002,6 +1021,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = { | |||
1002 | #endif /* CONFIG_CIFS_POSIX */ | 1021 | #endif /* CONFIG_CIFS_POSIX */ |
1003 | .llseek = cifs_llseek, | 1022 | .llseek = cifs_llseek, |
1004 | .setlease = cifs_setlease, | 1023 | .setlease = cifs_setlease, |
1024 | .fallocate = cifs_fallocate, | ||
1005 | }; | 1025 | }; |
1006 | 1026 | ||
1007 | const struct file_operations cifs_dir_ops = { | 1027 | const struct file_operations cifs_dir_ops = { |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index b0fafa499505..002e0c173939 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -136,5 +136,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
136 | extern const struct export_operations cifs_export_ops; | 136 | extern const struct export_operations cifs_export_ops; |
137 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ | 137 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
138 | 138 | ||
139 | #define CIFS_VERSION "2.04" | 139 | #define CIFS_VERSION "2.05" |
140 | #endif /* _CIFSFS_H */ | 140 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 0012e1e291d4..25b8392bfdd2 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -70,11 +70,6 @@ | |||
70 | #define SERVER_NAME_LENGTH 40 | 70 | #define SERVER_NAME_LENGTH 40 |
71 | #define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) | 71 | #define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) |
72 | 72 | ||
73 | /* used to define string lengths for reversing unicode strings */ | ||
74 | /* (256+1)*2 = 514 */ | ||
75 | /* (max path length + 1 for null) * 2 for unicode */ | ||
76 | #define MAX_NAME 514 | ||
77 | |||
78 | /* SMB echo "timeout" -- FIXME: tunable? */ | 73 | /* SMB echo "timeout" -- FIXME: tunable? */ |
79 | #define SMB_ECHO_INTERVAL (60 * HZ) | 74 | #define SMB_ECHO_INTERVAL (60 * HZ) |
80 | 75 | ||
@@ -409,6 +404,10 @@ struct smb_version_operations { | |||
409 | /* get mtu credits */ | 404 | /* get mtu credits */ |
410 | int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int, | 405 | int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int, |
411 | unsigned int *, unsigned int *); | 406 | unsigned int *, unsigned int *); |
407 | /* check if we need to issue closedir */ | ||
408 | bool (*dir_needs_close)(struct cifsFileInfo *); | ||
409 | long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, | ||
410 | loff_t); | ||
412 | }; | 411 | }; |
413 | 412 | ||
414 | struct smb_version_values { | 413 | struct smb_version_values { |
@@ -883,6 +882,7 @@ struct cifs_tcon { | |||
883 | for this mount even if server would support */ | 882 | for this mount even if server would support */ |
884 | bool local_lease:1; /* check leases (only) on local system not remote */ | 883 | bool local_lease:1; /* check leases (only) on local system not remote */ |
885 | bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */ | 884 | bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */ |
885 | bool broken_sparse_sup; /* if server or share does not support sparse */ | ||
886 | bool need_reconnect:1; /* connection reset, tid now invalid */ | 886 | bool need_reconnect:1; /* connection reset, tid now invalid */ |
887 | #ifdef CONFIG_CIFS_SMB2 | 887 | #ifdef CONFIG_CIFS_SMB2 |
888 | bool print:1; /* set if connection to printer share */ | 888 | bool print:1; /* set if connection to printer share */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 33df36ef9d52..5f9822ac0245 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -2253,6 +2253,29 @@ typedef struct { | |||
2253 | /* minimum includes first three fields, and empty FS Name */ | 2253 | /* minimum includes first three fields, and empty FS Name */ |
2254 | #define MIN_FS_ATTR_INFO_SIZE 12 | 2254 | #define MIN_FS_ATTR_INFO_SIZE 12 |
2255 | 2255 | ||
2256 | |||
2257 | /* List of FileSystemAttributes - see 2.5.1 of MS-FSCC */ | ||
2258 | #define FILE_SUPPORT_INTEGRITY_STREAMS 0x04000000 | ||
2259 | #define FILE_SUPPORTS_USN_JOURNAL 0x02000000 | ||
2260 | #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000 | ||
2261 | #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000 | ||
2262 | #define FILE_SUPPORTS_HARD_LINKS 0x00400000 | ||
2263 | #define FILE_SUPPORTS_TRANSACTIONS 0x00200000 | ||
2264 | #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 | ||
2265 | #define FILE_READ_ONLY_VOLUME 0x00080000 | ||
2266 | #define FILE_NAMED_STREAMS 0x00040000 | ||
2267 | #define FILE_SUPPORTS_ENCRYPTION 0x00020000 | ||
2268 | #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 | ||
2269 | #define FILE_VOLUME_IS_COMPRESSED 0x00008000 | ||
2270 | #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 | ||
2271 | #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 | ||
2272 | #define FILE_SUPPORTS_SPARSE_FILES 0x00000040 | ||
2273 | #define FILE_VOLUME_QUOTAS 0x00000020 | ||
2274 | #define FILE_FILE_COMPRESSION 0x00000010 | ||
2275 | #define FILE_PERSISTENT_ACLS 0x00000008 | ||
2276 | #define FILE_UNICODE_ON_DISK 0x00000004 | ||
2277 | #define FILE_CASE_PRESERVED_NAMES 0x00000002 | ||
2278 | #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 | ||
2256 | typedef struct { | 2279 | typedef struct { |
2257 | __le32 Attributes; | 2280 | __le32 Attributes; |
2258 | __le32 MaxPathNameComponentLength; | 2281 | __le32 MaxPathNameComponentLength; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 03ed8a09581c..36ca2045009b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1600,6 +1600,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1600 | tmp_end++; | 1600 | tmp_end++; |
1601 | if (!(tmp_end < end && tmp_end[1] == delim)) { | 1601 | if (!(tmp_end < end && tmp_end[1] == delim)) { |
1602 | /* No it is not. Set the password to NULL */ | 1602 | /* No it is not. Set the password to NULL */ |
1603 | kfree(vol->password); | ||
1603 | vol->password = NULL; | 1604 | vol->password = NULL; |
1604 | break; | 1605 | break; |
1605 | } | 1606 | } |
@@ -1637,6 +1638,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1637 | options = end; | 1638 | options = end; |
1638 | } | 1639 | } |
1639 | 1640 | ||
1641 | kfree(vol->password); | ||
1640 | /* Now build new password string */ | 1642 | /* Now build new password string */ |
1641 | temp_len = strlen(value); | 1643 | temp_len = strlen(value); |
1642 | vol->password = kzalloc(temp_len+1, GFP_KERNEL); | 1644 | vol->password = kzalloc(temp_len+1, GFP_KERNEL); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 3db0c5fd9a11..6cbd9c688cfe 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -497,6 +497,14 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, | |||
497 | goto out; | 497 | goto out; |
498 | } | 498 | } |
499 | 499 | ||
500 | if (file->f_flags & O_DIRECT && | ||
501 | CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) { | ||
502 | if (CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
503 | file->f_op = &cifs_file_direct_nobrl_ops; | ||
504 | else | ||
505 | file->f_op = &cifs_file_direct_ops; | ||
506 | } | ||
507 | |||
500 | file_info = cifs_new_fileinfo(&fid, file, tlink, oplock); | 508 | file_info = cifs_new_fileinfo(&fid, file, tlink, oplock); |
501 | if (file_info == NULL) { | 509 | if (file_info == NULL) { |
502 | if (server->ops->close) | 510 | if (server->ops->close) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 4ab2f79ffa7a..7c018a1c52f7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -467,6 +467,14 @@ int cifs_open(struct inode *inode, struct file *file) | |||
467 | cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n", | 467 | cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n", |
468 | inode, file->f_flags, full_path); | 468 | inode, file->f_flags, full_path); |
469 | 469 | ||
470 | if (file->f_flags & O_DIRECT && | ||
471 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) { | ||
472 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
473 | file->f_op = &cifs_file_direct_nobrl_ops; | ||
474 | else | ||
475 | file->f_op = &cifs_file_direct_ops; | ||
476 | } | ||
477 | |||
470 | if (server->oplocks) | 478 | if (server->oplocks) |
471 | oplock = REQ_OPLOCK; | 479 | oplock = REQ_OPLOCK; |
472 | else | 480 | else |
@@ -762,7 +770,7 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
762 | 770 | ||
763 | cifs_dbg(FYI, "Freeing private data in close dir\n"); | 771 | cifs_dbg(FYI, "Freeing private data in close dir\n"); |
764 | spin_lock(&cifs_file_list_lock); | 772 | spin_lock(&cifs_file_list_lock); |
765 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { | 773 | if (server->ops->dir_needs_close(cfile)) { |
766 | cfile->invalidHandle = true; | 774 | cfile->invalidHandle = true; |
767 | spin_unlock(&cifs_file_list_lock); | 775 | spin_unlock(&cifs_file_list_lock); |
768 | if (server->ops->close_dir) | 776 | if (server->ops->close_dir) |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 426d6c6ad8bf..7899a40465b3 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1720,13 +1720,22 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, | |||
1720 | unlink_target: | 1720 | unlink_target: |
1721 | /* Try unlinking the target dentry if it's not negative */ | 1721 | /* Try unlinking the target dentry if it's not negative */ |
1722 | if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { | 1722 | if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { |
1723 | tmprc = cifs_unlink(target_dir, target_dentry); | 1723 | if (d_is_dir(target_dentry)) |
1724 | tmprc = cifs_rmdir(target_dir, target_dentry); | ||
1725 | else | ||
1726 | tmprc = cifs_unlink(target_dir, target_dentry); | ||
1724 | if (tmprc) | 1727 | if (tmprc) |
1725 | goto cifs_rename_exit; | 1728 | goto cifs_rename_exit; |
1726 | rc = cifs_do_rename(xid, source_dentry, from_name, | 1729 | rc = cifs_do_rename(xid, source_dentry, from_name, |
1727 | target_dentry, to_name); | 1730 | target_dentry, to_name); |
1728 | } | 1731 | } |
1729 | 1732 | ||
1733 | /* force revalidate to go get info when needed */ | ||
1734 | CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0; | ||
1735 | |||
1736 | source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime = | ||
1737 | target_dir->i_mtime = current_fs_time(source_dir->i_sb); | ||
1738 | |||
1730 | cifs_rename_exit: | 1739 | cifs_rename_exit: |
1731 | kfree(info_buf_source); | 1740 | kfree(info_buf_source); |
1732 | kfree(from_name); | 1741 | kfree(from_name); |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 68559fd557fb..5657416d3483 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -213,8 +213,12 @@ create_mf_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
213 | if (rc) | 213 | if (rc) |
214 | goto out; | 214 | goto out; |
215 | 215 | ||
216 | rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, cifs_sb, | 216 | if (tcon->ses->server->ops->create_mf_symlink) |
217 | fromName, buf, &bytes_written); | 217 | rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, |
218 | cifs_sb, fromName, buf, &bytes_written); | ||
219 | else | ||
220 | rc = -EOPNOTSUPP; | ||
221 | |||
218 | if (rc) | 222 | if (rc) |
219 | goto out; | 223 | goto out; |
220 | 224 | ||
@@ -339,9 +343,11 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, | |||
339 | if (rc) | 343 | if (rc) |
340 | return rc; | 344 | return rc; |
341 | 345 | ||
342 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) | 346 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { |
347 | rc = -ENOENT; | ||
343 | /* it's not a symlink */ | 348 | /* it's not a symlink */ |
344 | goto out; | 349 | goto out; |
350 | } | ||
345 | 351 | ||
346 | io_parms.netfid = fid.netfid; | 352 | io_parms.netfid = fid.netfid; |
347 | io_parms.pid = current->tgid; | 353 | io_parms.pid = current->tgid; |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 81340c6253eb..b7415d596dbd 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -574,13 +574,6 @@ void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock) | |||
574 | cinode->oplock = 0; | 574 | cinode->oplock = 0; |
575 | } | 575 | } |
576 | 576 | ||
577 | static int | ||
578 | cifs_oplock_break_wait(void *unused) | ||
579 | { | ||
580 | schedule(); | ||
581 | return signal_pending(current) ? -ERESTARTSYS : 0; | ||
582 | } | ||
583 | |||
584 | /* | 577 | /* |
585 | * We wait for oplock breaks to be processed before we attempt to perform | 578 | * We wait for oplock breaks to be processed before we attempt to perform |
586 | * writes. | 579 | * writes. |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 6834b9c3bec1..b333ff60781d 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -925,11 +925,23 @@ cifs_NTtimeToUnix(__le64 ntutc) | |||
925 | /* BB what about the timezone? BB */ | 925 | /* BB what about the timezone? BB */ |
926 | 926 | ||
927 | /* Subtract the NTFS time offset, then convert to 1s intervals. */ | 927 | /* Subtract the NTFS time offset, then convert to 1s intervals. */ |
928 | u64 t; | 928 | s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; |
929 | |||
930 | /* | ||
931 | * Unfortunately can not use normal 64 bit division on 32 bit arch, but | ||
932 | * the alternative, do_div, does not work with negative numbers so have | ||
933 | * to special case them | ||
934 | */ | ||
935 | if (t < 0) { | ||
936 | t = -t; | ||
937 | ts.tv_nsec = (long)(do_div(t, 10000000) * 100); | ||
938 | ts.tv_nsec = -ts.tv_nsec; | ||
939 | ts.tv_sec = -t; | ||
940 | } else { | ||
941 | ts.tv_nsec = (long)do_div(t, 10000000) * 100; | ||
942 | ts.tv_sec = t; | ||
943 | } | ||
929 | 944 | ||
930 | t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; | ||
931 | ts.tv_nsec = do_div(t, 10000000) * 100; | ||
932 | ts.tv_sec = t; | ||
933 | return ts; | 945 | return ts; |
934 | } | 946 | } |
935 | 947 | ||
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index b15862e0f68c..b334a89d6a66 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -593,11 +593,11 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos, | |||
593 | /* close and restart search */ | 593 | /* close and restart search */ |
594 | cifs_dbg(FYI, "search backing up - close and restart search\n"); | 594 | cifs_dbg(FYI, "search backing up - close and restart search\n"); |
595 | spin_lock(&cifs_file_list_lock); | 595 | spin_lock(&cifs_file_list_lock); |
596 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { | 596 | if (server->ops->dir_needs_close(cfile)) { |
597 | cfile->invalidHandle = true; | 597 | cfile->invalidHandle = true; |
598 | spin_unlock(&cifs_file_list_lock); | 598 | spin_unlock(&cifs_file_list_lock); |
599 | if (server->ops->close) | 599 | if (server->ops->close_dir) |
600 | server->ops->close(xid, tcon, &cfile->fid); | 600 | server->ops->close_dir(xid, tcon, &cfile->fid); |
601 | } else | 601 | } else |
602 | spin_unlock(&cifs_file_list_lock); | 602 | spin_unlock(&cifs_file_list_lock); |
603 | if (cfile->srch_inf.ntwrk_buf_start) { | 603 | if (cfile->srch_inf.ntwrk_buf_start) { |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 39ee32688eac..57db63ff88da 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -243,10 +243,11 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft, | |||
243 | kfree(ses->serverOS); | 243 | kfree(ses->serverOS); |
244 | 244 | ||
245 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); | 245 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); |
246 | if (ses->serverOS) | 246 | if (ses->serverOS) { |
247 | strncpy(ses->serverOS, bcc_ptr, len); | 247 | strncpy(ses->serverOS, bcc_ptr, len); |
248 | if (strncmp(ses->serverOS, "OS/2", 4) == 0) | 248 | if (strncmp(ses->serverOS, "OS/2", 4) == 0) |
249 | cifs_dbg(FYI, "OS/2 server\n"); | 249 | cifs_dbg(FYI, "OS/2 server\n"); |
250 | } | ||
250 | 251 | ||
251 | bcc_ptr += len + 1; | 252 | bcc_ptr += len + 1; |
252 | bleft -= len + 1; | 253 | bleft -= len + 1; |
@@ -744,14 +745,6 @@ out: | |||
744 | sess_free_buffer(sess_data); | 745 | sess_free_buffer(sess_data); |
745 | } | 746 | } |
746 | 747 | ||
747 | #else | ||
748 | |||
749 | static void | ||
750 | sess_auth_lanman(struct sess_data *sess_data) | ||
751 | { | ||
752 | sess_data->result = -EOPNOTSUPP; | ||
753 | sess_data->func = NULL; | ||
754 | } | ||
755 | #endif | 748 | #endif |
756 | 749 | ||
757 | static void | 750 | static void |
@@ -1102,15 +1095,6 @@ out: | |||
1102 | ses->auth_key.response = NULL; | 1095 | ses->auth_key.response = NULL; |
1103 | } | 1096 | } |
1104 | 1097 | ||
1105 | #else | ||
1106 | |||
1107 | static void | ||
1108 | sess_auth_kerberos(struct sess_data *sess_data) | ||
1109 | { | ||
1110 | cifs_dbg(VFS, "Kerberos negotiated but upcall support disabled!\n"); | ||
1111 | sess_data->result = -ENOSYS; | ||
1112 | sess_data->func = NULL; | ||
1113 | } | ||
1114 | #endif /* ! CONFIG_CIFS_UPCALL */ | 1098 | #endif /* ! CONFIG_CIFS_UPCALL */ |
1115 | 1099 | ||
1116 | /* | 1100 | /* |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 5e8c22d6c7b9..1a6df4b03f67 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -1015,6 +1015,12 @@ cifs_wp_retry_size(struct inode *inode) | |||
1015 | return CIFS_SB(inode->i_sb)->wsize; | 1015 | return CIFS_SB(inode->i_sb)->wsize; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | static bool | ||
1019 | cifs_dir_needs_close(struct cifsFileInfo *cfile) | ||
1020 | { | ||
1021 | return !cfile->srch_inf.endOfSearch && !cfile->invalidHandle; | ||
1022 | } | ||
1023 | |||
1018 | struct smb_version_operations smb1_operations = { | 1024 | struct smb_version_operations smb1_operations = { |
1019 | .send_cancel = send_nt_cancel, | 1025 | .send_cancel = send_nt_cancel, |
1020 | .compare_fids = cifs_compare_fids, | 1026 | .compare_fids = cifs_compare_fids, |
@@ -1086,6 +1092,7 @@ struct smb_version_operations smb1_operations = { | |||
1086 | .create_mf_symlink = cifs_create_mf_symlink, | 1092 | .create_mf_symlink = cifs_create_mf_symlink, |
1087 | .is_read_op = cifs_is_read_op, | 1093 | .is_read_op = cifs_is_read_op, |
1088 | .wp_retry_size = cifs_wp_retry_size, | 1094 | .wp_retry_size = cifs_wp_retry_size, |
1095 | .dir_needs_close = cifs_dir_needs_close, | ||
1089 | #ifdef CONFIG_CIFS_XATTR | 1096 | #ifdef CONFIG_CIFS_XATTR |
1090 | .query_all_EAs = CIFSSMBQAllEAs, | 1097 | .query_all_EAs = CIFSSMBQAllEAs, |
1091 | .set_EA = CIFSSMBSetEA, | 1098 | .set_EA = CIFSSMBSetEA, |
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index 3f17b4550831..45992944e238 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c | |||
@@ -50,7 +50,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, | |||
50 | goto out; | 50 | goto out; |
51 | } | 51 | } |
52 | 52 | ||
53 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 53 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
54 | GFP_KERNEL); | 54 | GFP_KERNEL); |
55 | if (smb2_data == NULL) { | 55 | if (smb2_data == NULL) { |
56 | rc = -ENOMEM; | 56 | rc = -ENOMEM; |
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 0150182a4494..899bbc86f73e 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c | |||
@@ -131,7 +131,7 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, | |||
131 | *adjust_tz = false; | 131 | *adjust_tz = false; |
132 | *symlink = false; | 132 | *symlink = false; |
133 | 133 | ||
134 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 134 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
135 | GFP_KERNEL); | 135 | GFP_KERNEL); |
136 | if (smb2_data == NULL) | 136 | if (smb2_data == NULL) |
137 | return -ENOMEM; | 137 | return -ENOMEM; |
diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c index e31a9dfdcd39..af59d03db492 100644 --- a/fs/cifs/smb2maperror.c +++ b/fs/cifs/smb2maperror.c | |||
@@ -214,7 +214,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { | |||
214 | {STATUS_BREAKPOINT, -EIO, "STATUS_BREAKPOINT"}, | 214 | {STATUS_BREAKPOINT, -EIO, "STATUS_BREAKPOINT"}, |
215 | {STATUS_SINGLE_STEP, -EIO, "STATUS_SINGLE_STEP"}, | 215 | {STATUS_SINGLE_STEP, -EIO, "STATUS_SINGLE_STEP"}, |
216 | {STATUS_BUFFER_OVERFLOW, -EIO, "STATUS_BUFFER_OVERFLOW"}, | 216 | {STATUS_BUFFER_OVERFLOW, -EIO, "STATUS_BUFFER_OVERFLOW"}, |
217 | {STATUS_NO_MORE_FILES, -EIO, "STATUS_NO_MORE_FILES"}, | 217 | {STATUS_NO_MORE_FILES, -ENODATA, "STATUS_NO_MORE_FILES"}, |
218 | {STATUS_WAKE_SYSTEM_DEBUGGER, -EIO, "STATUS_WAKE_SYSTEM_DEBUGGER"}, | 218 | {STATUS_WAKE_SYSTEM_DEBUGGER, -EIO, "STATUS_WAKE_SYSTEM_DEBUGGER"}, |
219 | {STATUS_HANDLES_CLOSED, -EIO, "STATUS_HANDLES_CLOSED"}, | 219 | {STATUS_HANDLES_CLOSED, -EIO, "STATUS_HANDLES_CLOSED"}, |
220 | {STATUS_NO_INHERITANCE, -EIO, "STATUS_NO_INHERITANCE"}, | 220 | {STATUS_NO_INHERITANCE, -EIO, "STATUS_NO_INHERITANCE"}, |
@@ -298,7 +298,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { | |||
298 | {STATUS_INVALID_PARAMETER, -EINVAL, "STATUS_INVALID_PARAMETER"}, | 298 | {STATUS_INVALID_PARAMETER, -EINVAL, "STATUS_INVALID_PARAMETER"}, |
299 | {STATUS_NO_SUCH_DEVICE, -ENODEV, "STATUS_NO_SUCH_DEVICE"}, | 299 | {STATUS_NO_SUCH_DEVICE, -ENODEV, "STATUS_NO_SUCH_DEVICE"}, |
300 | {STATUS_NO_SUCH_FILE, -ENOENT, "STATUS_NO_SUCH_FILE"}, | 300 | {STATUS_NO_SUCH_FILE, -ENOENT, "STATUS_NO_SUCH_FILE"}, |
301 | {STATUS_INVALID_DEVICE_REQUEST, -EIO, "STATUS_INVALID_DEVICE_REQUEST"}, | 301 | {STATUS_INVALID_DEVICE_REQUEST, -EOPNOTSUPP, "STATUS_INVALID_DEVICE_REQUEST"}, |
302 | {STATUS_END_OF_FILE, -ENODATA, "STATUS_END_OF_FILE"}, | 302 | {STATUS_END_OF_FILE, -ENODATA, "STATUS_END_OF_FILE"}, |
303 | {STATUS_WRONG_VOLUME, -EIO, "STATUS_WRONG_VOLUME"}, | 303 | {STATUS_WRONG_VOLUME, -EIO, "STATUS_WRONG_VOLUME"}, |
304 | {STATUS_NO_MEDIA_IN_DEVICE, -EIO, "STATUS_NO_MEDIA_IN_DEVICE"}, | 304 | {STATUS_NO_MEDIA_IN_DEVICE, -EIO, "STATUS_NO_MEDIA_IN_DEVICE"}, |
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index f2e6ac29a8d6..4aa7a0f07d6e 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c | |||
@@ -178,9 +178,24 @@ smb2_check_message(char *buf, unsigned int length) | |||
178 | /* Windows 7 server returns 24 bytes more */ | 178 | /* Windows 7 server returns 24 bytes more */ |
179 | if (clc_len + 20 == len && command == SMB2_OPLOCK_BREAK_HE) | 179 | if (clc_len + 20 == len && command == SMB2_OPLOCK_BREAK_HE) |
180 | return 0; | 180 | return 0; |
181 | /* server can return one byte more */ | 181 | /* server can return one byte more due to implied bcc[0] */ |
182 | if (clc_len == 4 + len + 1) | 182 | if (clc_len == 4 + len + 1) |
183 | return 0; | 183 | return 0; |
184 | |||
185 | /* | ||
186 | * MacOS server pads after SMB2.1 write response with 3 bytes | ||
187 | * of junk. Other servers match RFC1001 len to actual | ||
188 | * SMB2/SMB3 frame length (header + smb2 response specific data) | ||
189 | * Log the server error (once), but allow it and continue | ||
190 | * since the frame is parseable. | ||
191 | */ | ||
192 | if (clc_len < 4 /* RFC1001 header size */ + len) { | ||
193 | printk_once(KERN_WARNING | ||
194 | "SMB2 server sent bad RFC1001 len %d not %d\n", | ||
195 | len, clc_len - 4); | ||
196 | return 0; | ||
197 | } | ||
198 | |||
184 | return 1; | 199 | return 1; |
185 | } | 200 | } |
186 | return 0; | 201 | return 0; |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 77f8aeb9c2fc..f522193b7184 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -389,7 +389,7 @@ smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon, | |||
389 | int rc; | 389 | int rc; |
390 | struct smb2_file_all_info *smb2_data; | 390 | struct smb2_file_all_info *smb2_data; |
391 | 391 | ||
392 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 392 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
393 | GFP_KERNEL); | 393 | GFP_KERNEL); |
394 | if (smb2_data == NULL) | 394 | if (smb2_data == NULL) |
395 | return -ENOMEM; | 395 | return -ENOMEM; |
@@ -731,11 +731,72 @@ smb2_sync_write(const unsigned int xid, struct cifsFileInfo *cfile, | |||
731 | return SMB2_write(xid, parms, written, iov, nr_segs); | 731 | return SMB2_write(xid, parms, written, iov, nr_segs); |
732 | } | 732 | } |
733 | 733 | ||
734 | /* Set or clear the SPARSE_FILE attribute based on value passed in setsparse */ | ||
735 | static bool smb2_set_sparse(const unsigned int xid, struct cifs_tcon *tcon, | ||
736 | struct cifsFileInfo *cfile, struct inode *inode, __u8 setsparse) | ||
737 | { | ||
738 | struct cifsInodeInfo *cifsi; | ||
739 | int rc; | ||
740 | |||
741 | cifsi = CIFS_I(inode); | ||
742 | |||
743 | /* if file already sparse don't bother setting sparse again */ | ||
744 | if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) && setsparse) | ||
745 | return true; /* already sparse */ | ||
746 | |||
747 | if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) && !setsparse) | ||
748 | return true; /* already not sparse */ | ||
749 | |||
750 | /* | ||
751 | * Can't check for sparse support on share the usual way via the | ||
752 | * FS attribute info (FILE_SUPPORTS_SPARSE_FILES) on the share | ||
753 | * since Samba server doesn't set the flag on the share, yet | ||
754 | * supports the set sparse FSCTL and returns sparse correctly | ||
755 | * in the file attributes. If we fail setting sparse though we | ||
756 | * mark that server does not support sparse files for this share | ||
757 | * to avoid repeatedly sending the unsupported fsctl to server | ||
758 | * if the file is repeatedly extended. | ||
759 | */ | ||
760 | if (tcon->broken_sparse_sup) | ||
761 | return false; | ||
762 | |||
763 | rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, | ||
764 | cfile->fid.volatile_fid, FSCTL_SET_SPARSE, | ||
765 | true /* is_fctl */, &setsparse, 1, NULL, NULL); | ||
766 | if (rc) { | ||
767 | tcon->broken_sparse_sup = true; | ||
768 | cifs_dbg(FYI, "set sparse rc = %d\n", rc); | ||
769 | return false; | ||
770 | } | ||
771 | |||
772 | if (setsparse) | ||
773 | cifsi->cifsAttrs |= FILE_ATTRIBUTE_SPARSE_FILE; | ||
774 | else | ||
775 | cifsi->cifsAttrs &= (~FILE_ATTRIBUTE_SPARSE_FILE); | ||
776 | |||
777 | return true; | ||
778 | } | ||
779 | |||
734 | static int | 780 | static int |
735 | smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, | 781 | smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, |
736 | struct cifsFileInfo *cfile, __u64 size, bool set_alloc) | 782 | struct cifsFileInfo *cfile, __u64 size, bool set_alloc) |
737 | { | 783 | { |
738 | __le64 eof = cpu_to_le64(size); | 784 | __le64 eof = cpu_to_le64(size); |
785 | struct inode *inode; | ||
786 | |||
787 | /* | ||
788 | * If extending file more than one page make sparse. Many Linux fs | ||
789 | * make files sparse by default when extending via ftruncate | ||
790 | */ | ||
791 | inode = cfile->dentry->d_inode; | ||
792 | |||
793 | if (!set_alloc && (size > inode->i_size + 8192)) { | ||
794 | __u8 set_sparse = 1; | ||
795 | |||
796 | /* whether set sparse succeeds or not, extend the file */ | ||
797 | smb2_set_sparse(xid, tcon, cfile, inode, set_sparse); | ||
798 | } | ||
799 | |||
739 | return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, | 800 | return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, |
740 | cfile->fid.volatile_fid, cfile->pid, &eof, false); | 801 | cfile->fid.volatile_fid, cfile->pid, &eof, false); |
741 | } | 802 | } |
@@ -954,6 +1015,105 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
954 | return rc; | 1015 | return rc; |
955 | } | 1016 | } |
956 | 1017 | ||
1018 | static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | ||
1019 | loff_t offset, loff_t len, bool keep_size) | ||
1020 | { | ||
1021 | struct inode *inode; | ||
1022 | struct cifsInodeInfo *cifsi; | ||
1023 | struct cifsFileInfo *cfile = file->private_data; | ||
1024 | struct file_zero_data_information fsctl_buf; | ||
1025 | long rc; | ||
1026 | unsigned int xid; | ||
1027 | |||
1028 | xid = get_xid(); | ||
1029 | |||
1030 | inode = cfile->dentry->d_inode; | ||
1031 | cifsi = CIFS_I(inode); | ||
1032 | |||
1033 | /* if file not oplocked can't be sure whether asking to extend size */ | ||
1034 | if (!CIFS_CACHE_READ(cifsi)) | ||
1035 | if (keep_size == false) | ||
1036 | return -EOPNOTSUPP; | ||
1037 | |||
1038 | /* | ||
1039 | * Must check if file sparse since fallocate -z (zero range) assumes | ||
1040 | * non-sparse allocation | ||
1041 | */ | ||
1042 | if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)) | ||
1043 | return -EOPNOTSUPP; | ||
1044 | |||
1045 | /* | ||
1046 | * need to make sure we are not asked to extend the file since the SMB3 | ||
1047 | * fsctl does not change the file size. In the future we could change | ||
1048 | * this to zero the first part of the range then set the file size | ||
1049 | * which for a non sparse file would zero the newly extended range | ||
1050 | */ | ||
1051 | if (keep_size == false) | ||
1052 | if (i_size_read(inode) < offset + len) | ||
1053 | return -EOPNOTSUPP; | ||
1054 | |||
1055 | cifs_dbg(FYI, "offset %lld len %lld", offset, len); | ||
1056 | |||
1057 | fsctl_buf.FileOffset = cpu_to_le64(offset); | ||
1058 | fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); | ||
1059 | |||
1060 | rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, | ||
1061 | cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, | ||
1062 | true /* is_fctl */, (char *)&fsctl_buf, | ||
1063 | sizeof(struct file_zero_data_information), NULL, NULL); | ||
1064 | free_xid(xid); | ||
1065 | return rc; | ||
1066 | } | ||
1067 | |||
1068 | static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, | ||
1069 | loff_t offset, loff_t len) | ||
1070 | { | ||
1071 | struct inode *inode; | ||
1072 | struct cifsInodeInfo *cifsi; | ||
1073 | struct cifsFileInfo *cfile = file->private_data; | ||
1074 | struct file_zero_data_information fsctl_buf; | ||
1075 | long rc; | ||
1076 | unsigned int xid; | ||
1077 | __u8 set_sparse = 1; | ||
1078 | |||
1079 | xid = get_xid(); | ||
1080 | |||
1081 | inode = cfile->dentry->d_inode; | ||
1082 | cifsi = CIFS_I(inode); | ||
1083 | |||
1084 | /* Need to make file sparse, if not already, before freeing range. */ | ||
1085 | /* Consider adding equivalent for compressed since it could also work */ | ||
1086 | if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse)) | ||
1087 | return -EOPNOTSUPP; | ||
1088 | |||
1089 | cifs_dbg(FYI, "offset %lld len %lld", offset, len); | ||
1090 | |||
1091 | fsctl_buf.FileOffset = cpu_to_le64(offset); | ||
1092 | fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); | ||
1093 | |||
1094 | rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, | ||
1095 | cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, | ||
1096 | true /* is_fctl */, (char *)&fsctl_buf, | ||
1097 | sizeof(struct file_zero_data_information), NULL, NULL); | ||
1098 | free_xid(xid); | ||
1099 | return rc; | ||
1100 | } | ||
1101 | |||
1102 | static long smb3_fallocate(struct file *file, struct cifs_tcon *tcon, int mode, | ||
1103 | loff_t off, loff_t len) | ||
1104 | { | ||
1105 | /* KEEP_SIZE already checked for by do_fallocate */ | ||
1106 | if (mode & FALLOC_FL_PUNCH_HOLE) | ||
1107 | return smb3_punch_hole(file, tcon, off, len); | ||
1108 | else if (mode & FALLOC_FL_ZERO_RANGE) { | ||
1109 | if (mode & FALLOC_FL_KEEP_SIZE) | ||
1110 | return smb3_zero_range(file, tcon, off, len, true); | ||
1111 | return smb3_zero_range(file, tcon, off, len, false); | ||
1112 | } | ||
1113 | |||
1114 | return -EOPNOTSUPP; | ||
1115 | } | ||
1116 | |||
957 | static void | 1117 | static void |
958 | smb2_downgrade_oplock(struct TCP_Server_Info *server, | 1118 | smb2_downgrade_oplock(struct TCP_Server_Info *server, |
959 | struct cifsInodeInfo *cinode, bool set_level2) | 1119 | struct cifsInodeInfo *cinode, bool set_level2) |
@@ -1161,6 +1321,12 @@ smb2_wp_retry_size(struct inode *inode) | |||
1161 | SMB2_MAX_BUFFER_SIZE); | 1321 | SMB2_MAX_BUFFER_SIZE); |
1162 | } | 1322 | } |
1163 | 1323 | ||
1324 | static bool | ||
1325 | smb2_dir_needs_close(struct cifsFileInfo *cfile) | ||
1326 | { | ||
1327 | return !cfile->invalidHandle; | ||
1328 | } | ||
1329 | |||
1164 | struct smb_version_operations smb20_operations = { | 1330 | struct smb_version_operations smb20_operations = { |
1165 | .compare_fids = smb2_compare_fids, | 1331 | .compare_fids = smb2_compare_fids, |
1166 | .setup_request = smb2_setup_request, | 1332 | .setup_request = smb2_setup_request, |
@@ -1236,6 +1402,7 @@ struct smb_version_operations smb20_operations = { | |||
1236 | .parse_lease_buf = smb2_parse_lease_buf, | 1402 | .parse_lease_buf = smb2_parse_lease_buf, |
1237 | .clone_range = smb2_clone_range, | 1403 | .clone_range = smb2_clone_range, |
1238 | .wp_retry_size = smb2_wp_retry_size, | 1404 | .wp_retry_size = smb2_wp_retry_size, |
1405 | .dir_needs_close = smb2_dir_needs_close, | ||
1239 | }; | 1406 | }; |
1240 | 1407 | ||
1241 | struct smb_version_operations smb21_operations = { | 1408 | struct smb_version_operations smb21_operations = { |
@@ -1313,6 +1480,7 @@ struct smb_version_operations smb21_operations = { | |||
1313 | .parse_lease_buf = smb2_parse_lease_buf, | 1480 | .parse_lease_buf = smb2_parse_lease_buf, |
1314 | .clone_range = smb2_clone_range, | 1481 | .clone_range = smb2_clone_range, |
1315 | .wp_retry_size = smb2_wp_retry_size, | 1482 | .wp_retry_size = smb2_wp_retry_size, |
1483 | .dir_needs_close = smb2_dir_needs_close, | ||
1316 | }; | 1484 | }; |
1317 | 1485 | ||
1318 | struct smb_version_operations smb30_operations = { | 1486 | struct smb_version_operations smb30_operations = { |
@@ -1393,6 +1561,8 @@ struct smb_version_operations smb30_operations = { | |||
1393 | .clone_range = smb2_clone_range, | 1561 | .clone_range = smb2_clone_range, |
1394 | .validate_negotiate = smb3_validate_negotiate, | 1562 | .validate_negotiate = smb3_validate_negotiate, |
1395 | .wp_retry_size = smb2_wp_retry_size, | 1563 | .wp_retry_size = smb2_wp_retry_size, |
1564 | .dir_needs_close = smb2_dir_needs_close, | ||
1565 | .fallocate = smb3_fallocate, | ||
1396 | }; | 1566 | }; |
1397 | 1567 | ||
1398 | struct smb_version_values smb20_values = { | 1568 | struct smb_version_values smb20_values = { |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 42ebc1a8be6c..74b3a6684383 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -530,7 +530,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, | |||
530 | struct smb2_sess_setup_rsp *rsp = NULL; | 530 | struct smb2_sess_setup_rsp *rsp = NULL; |
531 | struct kvec iov[2]; | 531 | struct kvec iov[2]; |
532 | int rc = 0; | 532 | int rc = 0; |
533 | int resp_buftype; | 533 | int resp_buftype = CIFS_NO_BUFFER; |
534 | __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ | 534 | __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ |
535 | struct TCP_Server_Info *server = ses->server; | 535 | struct TCP_Server_Info *server = ses->server; |
536 | u16 blob_length = 0; | 536 | u16 blob_length = 0; |
@@ -907,7 +907,8 @@ tcon_exit: | |||
907 | tcon_error_exit: | 907 | tcon_error_exit: |
908 | if (rsp->hdr.Status == STATUS_BAD_NETWORK_NAME) { | 908 | if (rsp->hdr.Status == STATUS_BAD_NETWORK_NAME) { |
909 | cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree); | 909 | cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree); |
910 | tcon->bad_network_name = true; | 910 | if (tcon) |
911 | tcon->bad_network_name = true; | ||
911 | } | 912 | } |
912 | goto tcon_exit; | 913 | goto tcon_exit; |
913 | } | 914 | } |
@@ -1224,7 +1225,9 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, | |||
1224 | 1225 | ||
1225 | cifs_dbg(FYI, "SMB2 IOCTL\n"); | 1226 | cifs_dbg(FYI, "SMB2 IOCTL\n"); |
1226 | 1227 | ||
1227 | *out_data = NULL; | 1228 | if (out_data != NULL) |
1229 | *out_data = NULL; | ||
1230 | |||
1228 | /* zero out returned data len, in case of error */ | 1231 | /* zero out returned data len, in case of error */ |
1229 | if (plen) | 1232 | if (plen) |
1230 | *plen = 0; | 1233 | *plen = 0; |
@@ -1400,8 +1403,7 @@ SMB2_close(const unsigned int xid, struct cifs_tcon *tcon, | |||
1400 | rsp = (struct smb2_close_rsp *)iov[0].iov_base; | 1403 | rsp = (struct smb2_close_rsp *)iov[0].iov_base; |
1401 | 1404 | ||
1402 | if (rc != 0) { | 1405 | if (rc != 0) { |
1403 | if (tcon) | 1406 | cifs_stats_fail_inc(tcon, SMB2_CLOSE_HE); |
1404 | cifs_stats_fail_inc(tcon, SMB2_CLOSE_HE); | ||
1405 | goto close_exit; | 1407 | goto close_exit; |
1406 | } | 1408 | } |
1407 | 1409 | ||
@@ -1530,7 +1532,7 @@ SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon, | |||
1530 | { | 1532 | { |
1531 | return query_info(xid, tcon, persistent_fid, volatile_fid, | 1533 | return query_info(xid, tcon, persistent_fid, volatile_fid, |
1532 | FILE_ALL_INFORMATION, | 1534 | FILE_ALL_INFORMATION, |
1533 | sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 1535 | sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
1534 | sizeof(struct smb2_file_all_info), data); | 1536 | sizeof(struct smb2_file_all_info), data); |
1535 | } | 1537 | } |
1536 | 1538 | ||
@@ -2177,6 +2179,10 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, | |||
2177 | rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; | 2179 | rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; |
2178 | 2180 | ||
2179 | if (rc) { | 2181 | if (rc) { |
2182 | if (rc == -ENODATA && rsp->hdr.Status == STATUS_NO_MORE_FILES) { | ||
2183 | srch_inf->endOfSearch = true; | ||
2184 | rc = 0; | ||
2185 | } | ||
2180 | cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); | 2186 | cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); |
2181 | goto qdir_exit; | 2187 | goto qdir_exit; |
2182 | } | 2188 | } |
@@ -2214,11 +2220,6 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, | |||
2214 | else | 2220 | else |
2215 | cifs_dbg(VFS, "illegal search buffer type\n"); | 2221 | cifs_dbg(VFS, "illegal search buffer type\n"); |
2216 | 2222 | ||
2217 | if (rsp->hdr.Status == STATUS_NO_MORE_FILES) | ||
2218 | srch_inf->endOfSearch = 1; | ||
2219 | else | ||
2220 | srch_inf->endOfSearch = 0; | ||
2221 | |||
2222 | return rc; | 2223 | return rc; |
2223 | 2224 | ||
2224 | qdir_exit: | 2225 | qdir_exit: |
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 69f3595d3952..fbe486c285a9 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h | |||
@@ -573,6 +573,12 @@ struct copychunk_ioctl { | |||
573 | __u32 Reserved2; | 573 | __u32 Reserved2; |
574 | } __packed; | 574 | } __packed; |
575 | 575 | ||
576 | /* this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA */ | ||
577 | struct file_zero_data_information { | ||
578 | __le64 FileOffset; | ||
579 | __le64 BeyondFinalZero; | ||
580 | } __packed; | ||
581 | |||
576 | struct copychunk_ioctl_rsp { | 582 | struct copychunk_ioctl_rsp { |
577 | __le32 ChunksWritten; | 583 | __le32 ChunksWritten; |
578 | __le32 ChunkBytesWritten; | 584 | __le32 ChunkBytesWritten; |
diff --git a/fs/cifs/smbfsctl.h b/fs/cifs/smbfsctl.h index 0e538b5c9622..83efa59535be 100644 --- a/fs/cifs/smbfsctl.h +++ b/fs/cifs/smbfsctl.h | |||
@@ -63,7 +63,7 @@ | |||
63 | #define FSCTL_SET_OBJECT_ID_EXTENDED 0x000900BC /* BB add struct */ | 63 | #define FSCTL_SET_OBJECT_ID_EXTENDED 0x000900BC /* BB add struct */ |
64 | #define FSCTL_CREATE_OR_GET_OBJECT_ID 0x000900C0 /* BB add struct */ | 64 | #define FSCTL_CREATE_OR_GET_OBJECT_ID 0x000900C0 /* BB add struct */ |
65 | #define FSCTL_SET_SPARSE 0x000900C4 /* BB add struct */ | 65 | #define FSCTL_SET_SPARSE 0x000900C4 /* BB add struct */ |
66 | #define FSCTL_SET_ZERO_DATA 0x000900C8 /* BB add struct */ | 66 | #define FSCTL_SET_ZERO_DATA 0x000980C8 |
67 | #define FSCTL_SET_ENCRYPTION 0x000900D7 /* BB add struct */ | 67 | #define FSCTL_SET_ENCRYPTION 0x000900D7 /* BB add struct */ |
68 | #define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB /* BB add struct */ | 68 | #define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB /* BB add struct */ |
69 | #define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF /* BB add struct */ | 69 | #define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF /* BB add struct */ |
diff --git a/fs/dcache.c b/fs/dcache.c index d30ce699ae4b..cb25a1a5e307 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -106,8 +106,7 @@ static inline struct hlist_bl_head *d_hash(const struct dentry *parent, | |||
106 | unsigned int hash) | 106 | unsigned int hash) |
107 | { | 107 | { |
108 | hash += (unsigned long) parent / L1_CACHE_BYTES; | 108 | hash += (unsigned long) parent / L1_CACHE_BYTES; |
109 | hash = hash + (hash >> d_hash_shift); | 109 | return dentry_hashtable + hash_32(hash, d_hash_shift); |
110 | return dentry_hashtable + (hash & d_hash_mask); | ||
111 | } | 110 | } |
112 | 111 | ||
113 | /* Statistics gathering. */ | 112 | /* Statistics gathering. */ |
@@ -2373,7 +2372,8 @@ void dentry_update_name_case(struct dentry *dentry, struct qstr *name) | |||
2373 | } | 2372 | } |
2374 | EXPORT_SYMBOL(dentry_update_name_case); | 2373 | EXPORT_SYMBOL(dentry_update_name_case); |
2375 | 2374 | ||
2376 | static void switch_names(struct dentry *dentry, struct dentry *target) | 2375 | static void switch_names(struct dentry *dentry, struct dentry *target, |
2376 | bool exchange) | ||
2377 | { | 2377 | { |
2378 | if (dname_external(target)) { | 2378 | if (dname_external(target)) { |
2379 | if (dname_external(dentry)) { | 2379 | if (dname_external(dentry)) { |
@@ -2407,13 +2407,19 @@ static void switch_names(struct dentry *dentry, struct dentry *target) | |||
2407 | */ | 2407 | */ |
2408 | unsigned int i; | 2408 | unsigned int i; |
2409 | BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); | 2409 | BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); |
2410 | if (!exchange) { | ||
2411 | memcpy(dentry->d_iname, target->d_name.name, | ||
2412 | target->d_name.len + 1); | ||
2413 | dentry->d_name.hash_len = target->d_name.hash_len; | ||
2414 | return; | ||
2415 | } | ||
2410 | for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { | 2416 | for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { |
2411 | swap(((long *) &dentry->d_iname)[i], | 2417 | swap(((long *) &dentry->d_iname)[i], |
2412 | ((long *) &target->d_iname)[i]); | 2418 | ((long *) &target->d_iname)[i]); |
2413 | } | 2419 | } |
2414 | } | 2420 | } |
2415 | } | 2421 | } |
2416 | swap(dentry->d_name.len, target->d_name.len); | 2422 | swap(dentry->d_name.hash_len, target->d_name.hash_len); |
2417 | } | 2423 | } |
2418 | 2424 | ||
2419 | static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) | 2425 | static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) |
@@ -2443,25 +2449,29 @@ static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) | |||
2443 | } | 2449 | } |
2444 | } | 2450 | } |
2445 | 2451 | ||
2446 | static void dentry_unlock_parents_for_move(struct dentry *dentry, | 2452 | static void dentry_unlock_for_move(struct dentry *dentry, struct dentry *target) |
2447 | struct dentry *target) | ||
2448 | { | 2453 | { |
2449 | if (target->d_parent != dentry->d_parent) | 2454 | if (target->d_parent != dentry->d_parent) |
2450 | spin_unlock(&dentry->d_parent->d_lock); | 2455 | spin_unlock(&dentry->d_parent->d_lock); |
2451 | if (target->d_parent != target) | 2456 | if (target->d_parent != target) |
2452 | spin_unlock(&target->d_parent->d_lock); | 2457 | spin_unlock(&target->d_parent->d_lock); |
2458 | spin_unlock(&target->d_lock); | ||
2459 | spin_unlock(&dentry->d_lock); | ||
2453 | } | 2460 | } |
2454 | 2461 | ||
2455 | /* | 2462 | /* |
2456 | * When switching names, the actual string doesn't strictly have to | 2463 | * When switching names, the actual string doesn't strictly have to |
2457 | * be preserved in the target - because we're dropping the target | 2464 | * be preserved in the target - because we're dropping the target |
2458 | * anyway. As such, we can just do a simple memcpy() to copy over | 2465 | * anyway. As such, we can just do a simple memcpy() to copy over |
2459 | * the new name before we switch. | 2466 | * the new name before we switch, unless we are going to rehash |
2460 | * | 2467 | * it. Note that if we *do* unhash the target, we are not allowed |
2461 | * Note that we have to be a lot more careful about getting the hash | 2468 | * to rehash it without giving it a new name/hash key - whether |
2462 | * switched - we have to switch the hash value properly even if it | 2469 | * we swap or overwrite the names here, resulting name won't match |
2463 | * then no longer matches the actual (corrupted) string of the target. | 2470 | * the reality in filesystem; it's only there for d_path() purposes. |
2464 | * The hash value has to match the hash queue that the dentry is on.. | 2471 | * Note that all of this is happening under rename_lock, so the |
2472 | * any hash lookup seeing it in the middle of manipulations will | ||
2473 | * be discarded anyway. So we do not care what happens to the hash | ||
2474 | * key in that case. | ||
2465 | */ | 2475 | */ |
2466 | /* | 2476 | /* |
2467 | * __d_move - move a dentry | 2477 | * __d_move - move a dentry |
@@ -2507,36 +2517,30 @@ static void __d_move(struct dentry *dentry, struct dentry *target, | |||
2507 | d_hash(dentry->d_parent, dentry->d_name.hash)); | 2517 | d_hash(dentry->d_parent, dentry->d_name.hash)); |
2508 | } | 2518 | } |
2509 | 2519 | ||
2510 | list_del(&dentry->d_u.d_child); | ||
2511 | list_del(&target->d_u.d_child); | ||
2512 | |||
2513 | /* Switch the names.. */ | 2520 | /* Switch the names.. */ |
2514 | switch_names(dentry, target); | 2521 | switch_names(dentry, target, exchange); |
2515 | swap(dentry->d_name.hash, target->d_name.hash); | ||
2516 | 2522 | ||
2517 | /* ... and switch the parents */ | 2523 | /* ... and switch them in the tree */ |
2518 | if (IS_ROOT(dentry)) { | 2524 | if (IS_ROOT(dentry)) { |
2525 | /* splicing a tree */ | ||
2519 | dentry->d_parent = target->d_parent; | 2526 | dentry->d_parent = target->d_parent; |
2520 | target->d_parent = target; | 2527 | target->d_parent = target; |
2521 | INIT_LIST_HEAD(&target->d_u.d_child); | 2528 | list_del_init(&target->d_u.d_child); |
2529 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2522 | } else { | 2530 | } else { |
2531 | /* swapping two dentries */ | ||
2523 | swap(dentry->d_parent, target->d_parent); | 2532 | swap(dentry->d_parent, target->d_parent); |
2524 | 2533 | list_move(&target->d_u.d_child, &target->d_parent->d_subdirs); | |
2525 | /* And add them back to the (new) parent lists */ | 2534 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); |
2526 | list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); | 2535 | if (exchange) |
2536 | fsnotify_d_move(target); | ||
2537 | fsnotify_d_move(dentry); | ||
2527 | } | 2538 | } |
2528 | 2539 | ||
2529 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2530 | |||
2531 | write_seqcount_end(&target->d_seq); | 2540 | write_seqcount_end(&target->d_seq); |
2532 | write_seqcount_end(&dentry->d_seq); | 2541 | write_seqcount_end(&dentry->d_seq); |
2533 | 2542 | ||
2534 | dentry_unlock_parents_for_move(dentry, target); | 2543 | dentry_unlock_for_move(dentry, target); |
2535 | if (exchange) | ||
2536 | fsnotify_d_move(target); | ||
2537 | spin_unlock(&target->d_lock); | ||
2538 | fsnotify_d_move(dentry); | ||
2539 | spin_unlock(&dentry->d_lock); | ||
2540 | } | 2544 | } |
2541 | 2545 | ||
2542 | /* | 2546 | /* |
@@ -2634,39 +2638,6 @@ out_err: | |||
2634 | return ret; | 2638 | return ret; |
2635 | } | 2639 | } |
2636 | 2640 | ||
2637 | /* | ||
2638 | * Prepare an anonymous dentry for life in the superblock's dentry tree as a | ||
2639 | * named dentry in place of the dentry to be replaced. | ||
2640 | * returns with anon->d_lock held! | ||
2641 | */ | ||
2642 | static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | ||
2643 | { | ||
2644 | struct dentry *dparent; | ||
2645 | |||
2646 | dentry_lock_for_move(anon, dentry); | ||
2647 | |||
2648 | write_seqcount_begin(&dentry->d_seq); | ||
2649 | write_seqcount_begin_nested(&anon->d_seq, DENTRY_D_LOCK_NESTED); | ||
2650 | |||
2651 | dparent = dentry->d_parent; | ||
2652 | |||
2653 | switch_names(dentry, anon); | ||
2654 | swap(dentry->d_name.hash, anon->d_name.hash); | ||
2655 | |||
2656 | dentry->d_parent = dentry; | ||
2657 | list_del_init(&dentry->d_u.d_child); | ||
2658 | anon->d_parent = dparent; | ||
2659 | list_move(&anon->d_u.d_child, &dparent->d_subdirs); | ||
2660 | |||
2661 | write_seqcount_end(&dentry->d_seq); | ||
2662 | write_seqcount_end(&anon->d_seq); | ||
2663 | |||
2664 | dentry_unlock_parents_for_move(anon, dentry); | ||
2665 | spin_unlock(&dentry->d_lock); | ||
2666 | |||
2667 | /* anon->d_lock still locked, returns locked */ | ||
2668 | } | ||
2669 | |||
2670 | /** | 2641 | /** |
2671 | * d_splice_alias - splice a disconnected dentry into the tree if one exists | 2642 | * d_splice_alias - splice a disconnected dentry into the tree if one exists |
2672 | * @inode: the inode which may have a disconnected dentry | 2643 | * @inode: the inode which may have a disconnected dentry |
@@ -2712,11 +2683,8 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
2712 | return ERR_PTR(-EIO); | 2683 | return ERR_PTR(-EIO); |
2713 | } | 2684 | } |
2714 | write_seqlock(&rename_lock); | 2685 | write_seqlock(&rename_lock); |
2715 | __d_materialise_dentry(dentry, new); | 2686 | __d_move(new, dentry, false); |
2716 | write_sequnlock(&rename_lock); | 2687 | write_sequnlock(&rename_lock); |
2717 | __d_drop(new); | ||
2718 | _d_rehash(new); | ||
2719 | spin_unlock(&new->d_lock); | ||
2720 | spin_unlock(&inode->i_lock); | 2688 | spin_unlock(&inode->i_lock); |
2721 | security_d_instantiate(new, inode); | 2689 | security_d_instantiate(new, inode); |
2722 | iput(inode); | 2690 | iput(inode); |
@@ -2776,9 +2744,8 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2776 | } else if (IS_ROOT(alias)) { | 2744 | } else if (IS_ROOT(alias)) { |
2777 | /* Is this an anonymous mountpoint that we | 2745 | /* Is this an anonymous mountpoint that we |
2778 | * could splice into our tree? */ | 2746 | * could splice into our tree? */ |
2779 | __d_materialise_dentry(dentry, alias); | 2747 | __d_move(alias, dentry, false); |
2780 | write_sequnlock(&rename_lock); | 2748 | write_sequnlock(&rename_lock); |
2781 | __d_drop(alias); | ||
2782 | goto found; | 2749 | goto found; |
2783 | } else { | 2750 | } else { |
2784 | /* Nope, but we must(!) avoid directory | 2751 | /* Nope, but we must(!) avoid directory |
@@ -2804,13 +2771,9 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2804 | actual = __d_instantiate_unique(dentry, inode); | 2771 | actual = __d_instantiate_unique(dentry, inode); |
2805 | if (!actual) | 2772 | if (!actual) |
2806 | actual = dentry; | 2773 | actual = dentry; |
2807 | else | ||
2808 | BUG_ON(!d_unhashed(actual)); | ||
2809 | 2774 | ||
2810 | spin_lock(&actual->d_lock); | 2775 | d_rehash(actual); |
2811 | found: | 2776 | found: |
2812 | _d_rehash(actual); | ||
2813 | spin_unlock(&actual->d_lock); | ||
2814 | spin_unlock(&inode->i_lock); | 2777 | spin_unlock(&inode->i_lock); |
2815 | out_nolock: | 2778 | out_nolock: |
2816 | if (actual == dentry) { | 2779 | if (actual == dentry) { |
diff --git a/fs/direct-io.c b/fs/direct-io.c index c3116404ab49..e181b6b2e297 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -158,7 +158,7 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio) | |||
158 | { | 158 | { |
159 | ssize_t ret; | 159 | ssize_t ret; |
160 | 160 | ||
161 | ret = iov_iter_get_pages(sdio->iter, dio->pages, DIO_PAGES, | 161 | ret = iov_iter_get_pages(sdio->iter, dio->pages, LONG_MAX, DIO_PAGES, |
162 | &sdio->from); | 162 | &sdio->from); |
163 | 163 | ||
164 | if (ret < 0 && sdio->blocks_available && (dio->rw & WRITE)) { | 164 | if (ret < 0 && sdio->blocks_available && (dio->rw & WRITE)) { |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index b10b48c2a7af..7bcfff900f05 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1852,7 +1852,8 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1852 | goto error_tgt_fput; | 1852 | goto error_tgt_fput; |
1853 | 1853 | ||
1854 | /* Check if EPOLLWAKEUP is allowed */ | 1854 | /* Check if EPOLLWAKEUP is allowed */ |
1855 | ep_take_care_of_epollwakeup(&epds); | 1855 | if (ep_op_has_event(op)) |
1856 | ep_take_care_of_epollwakeup(&epds); | ||
1856 | 1857 | ||
1857 | /* | 1858 | /* |
1858 | * We have to check that the file structure underneath the file descriptor | 1859 | * We have to check that the file structure underneath the file descriptor |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 08cdfe5461e3..622e88249024 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -2828,8 +2828,9 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) | |||
2828 | */ | 2828 | */ |
2829 | overhead += ngroups * (2 + sbi->s_itb_per_group); | 2829 | overhead += ngroups * (2 + sbi->s_itb_per_group); |
2830 | 2830 | ||
2831 | /* Add the journal blocks as well */ | 2831 | /* Add the internal journal blocks as well */ |
2832 | overhead += sbi->s_journal->j_maxlen; | 2832 | if (sbi->s_journal && !sbi->journal_bdev) |
2833 | overhead += sbi->s_journal->j_maxlen; | ||
2833 | 2834 | ||
2834 | sbi->s_overhead_last = overhead; | 2835 | sbi->s_overhead_last = overhead; |
2835 | smp_wmb(); | 2836 | smp_wmb(); |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 5b19760b1de5..b0c225cdb52c 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1825,7 +1825,7 @@ ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no) | |||
1825 | /* | 1825 | /* |
1826 | * Special error return code only used by dx_probe() and its callers. | 1826 | * Special error return code only used by dx_probe() and its callers. |
1827 | */ | 1827 | */ |
1828 | #define ERR_BAD_DX_DIR -75000 | 1828 | #define ERR_BAD_DX_DIR (-(MAX_ERRNO - 1)) |
1829 | 1829 | ||
1830 | /* | 1830 | /* |
1831 | * Timeout and state flag for lazy initialization inode thread. | 1831 | * Timeout and state flag for lazy initialization inode thread. |
@@ -2454,6 +2454,22 @@ static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize) | |||
2454 | up_write(&EXT4_I(inode)->i_data_sem); | 2454 | up_write(&EXT4_I(inode)->i_data_sem); |
2455 | } | 2455 | } |
2456 | 2456 | ||
2457 | /* Update i_size, i_disksize. Requires i_mutex to avoid races with truncate */ | ||
2458 | static inline int ext4_update_inode_size(struct inode *inode, loff_t newsize) | ||
2459 | { | ||
2460 | int changed = 0; | ||
2461 | |||
2462 | if (newsize > inode->i_size) { | ||
2463 | i_size_write(inode, newsize); | ||
2464 | changed = 1; | ||
2465 | } | ||
2466 | if (newsize > EXT4_I(inode)->i_disksize) { | ||
2467 | ext4_update_i_disksize(inode, newsize); | ||
2468 | changed |= 2; | ||
2469 | } | ||
2470 | return changed; | ||
2471 | } | ||
2472 | |||
2457 | struct ext4_group_info { | 2473 | struct ext4_group_info { |
2458 | unsigned long bb_state; | 2474 | unsigned long bb_state; |
2459 | struct rb_root bb_free_root; | 2475 | struct rb_root bb_free_root; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 76c2df382b7d..74292a71b384 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4665,7 +4665,8 @@ retry: | |||
4665 | } | 4665 | } |
4666 | 4666 | ||
4667 | static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, | 4667 | static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, |
4668 | ext4_lblk_t len, int flags, int mode) | 4668 | ext4_lblk_t len, loff_t new_size, |
4669 | int flags, int mode) | ||
4669 | { | 4670 | { |
4670 | struct inode *inode = file_inode(file); | 4671 | struct inode *inode = file_inode(file); |
4671 | handle_t *handle; | 4672 | handle_t *handle; |
@@ -4674,8 +4675,10 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, | |||
4674 | int retries = 0; | 4675 | int retries = 0; |
4675 | struct ext4_map_blocks map; | 4676 | struct ext4_map_blocks map; |
4676 | unsigned int credits; | 4677 | unsigned int credits; |
4678 | loff_t epos; | ||
4677 | 4679 | ||
4678 | map.m_lblk = offset; | 4680 | map.m_lblk = offset; |
4681 | map.m_len = len; | ||
4679 | /* | 4682 | /* |
4680 | * Don't normalize the request if it can fit in one extent so | 4683 | * Don't normalize the request if it can fit in one extent so |
4681 | * that it doesn't get unnecessarily split into multiple | 4684 | * that it doesn't get unnecessarily split into multiple |
@@ -4690,9 +4693,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, | |||
4690 | credits = ext4_chunk_trans_blocks(inode, len); | 4693 | credits = ext4_chunk_trans_blocks(inode, len); |
4691 | 4694 | ||
4692 | retry: | 4695 | retry: |
4693 | while (ret >= 0 && ret < len) { | 4696 | while (ret >= 0 && len) { |
4694 | map.m_lblk = map.m_lblk + ret; | ||
4695 | map.m_len = len = len - ret; | ||
4696 | handle = ext4_journal_start(inode, EXT4_HT_MAP_BLOCKS, | 4697 | handle = ext4_journal_start(inode, EXT4_HT_MAP_BLOCKS, |
4697 | credits); | 4698 | credits); |
4698 | if (IS_ERR(handle)) { | 4699 | if (IS_ERR(handle)) { |
@@ -4709,6 +4710,21 @@ retry: | |||
4709 | ret2 = ext4_journal_stop(handle); | 4710 | ret2 = ext4_journal_stop(handle); |
4710 | break; | 4711 | break; |
4711 | } | 4712 | } |
4713 | map.m_lblk += ret; | ||
4714 | map.m_len = len = len - ret; | ||
4715 | epos = (loff_t)map.m_lblk << inode->i_blkbits; | ||
4716 | inode->i_ctime = ext4_current_time(inode); | ||
4717 | if (new_size) { | ||
4718 | if (epos > new_size) | ||
4719 | epos = new_size; | ||
4720 | if (ext4_update_inode_size(inode, epos) & 0x1) | ||
4721 | inode->i_mtime = inode->i_ctime; | ||
4722 | } else { | ||
4723 | if (epos > inode->i_size) | ||
4724 | ext4_set_inode_flag(inode, | ||
4725 | EXT4_INODE_EOFBLOCKS); | ||
4726 | } | ||
4727 | ext4_mark_inode_dirty(handle, inode); | ||
4712 | ret2 = ext4_journal_stop(handle); | 4728 | ret2 = ext4_journal_stop(handle); |
4713 | if (ret2) | 4729 | if (ret2) |
4714 | break; | 4730 | break; |
@@ -4731,7 +4747,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4731 | loff_t new_size = 0; | 4747 | loff_t new_size = 0; |
4732 | int ret = 0; | 4748 | int ret = 0; |
4733 | int flags; | 4749 | int flags; |
4734 | int partial; | 4750 | int credits; |
4751 | int partial_begin, partial_end; | ||
4735 | loff_t start, end; | 4752 | loff_t start, end; |
4736 | ext4_lblk_t lblk; | 4753 | ext4_lblk_t lblk; |
4737 | struct address_space *mapping = inode->i_mapping; | 4754 | struct address_space *mapping = inode->i_mapping; |
@@ -4771,7 +4788,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4771 | 4788 | ||
4772 | if (start < offset || end > offset + len) | 4789 | if (start < offset || end > offset + len) |
4773 | return -EINVAL; | 4790 | return -EINVAL; |
4774 | partial = (offset + len) & ((1 << blkbits) - 1); | 4791 | partial_begin = offset & ((1 << blkbits) - 1); |
4792 | partial_end = (offset + len) & ((1 << blkbits) - 1); | ||
4775 | 4793 | ||
4776 | lblk = start >> blkbits; | 4794 | lblk = start >> blkbits; |
4777 | max_blocks = (end >> blkbits); | 4795 | max_blocks = (end >> blkbits); |
@@ -4805,7 +4823,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4805 | * If we have a partial block after EOF we have to allocate | 4823 | * If we have a partial block after EOF we have to allocate |
4806 | * the entire block. | 4824 | * the entire block. |
4807 | */ | 4825 | */ |
4808 | if (partial) | 4826 | if (partial_end) |
4809 | max_blocks += 1; | 4827 | max_blocks += 1; |
4810 | } | 4828 | } |
4811 | 4829 | ||
@@ -4813,6 +4831,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4813 | 4831 | ||
4814 | /* Now release the pages and zero block aligned part of pages*/ | 4832 | /* Now release the pages and zero block aligned part of pages*/ |
4815 | truncate_pagecache_range(inode, start, end - 1); | 4833 | truncate_pagecache_range(inode, start, end - 1); |
4834 | inode->i_mtime = inode->i_ctime = ext4_current_time(inode); | ||
4816 | 4835 | ||
4817 | /* Wait all existing dio workers, newcomers will block on i_mutex */ | 4836 | /* Wait all existing dio workers, newcomers will block on i_mutex */ |
4818 | ext4_inode_block_unlocked_dio(inode); | 4837 | ext4_inode_block_unlocked_dio(inode); |
@@ -4825,13 +4844,22 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4825 | if (ret) | 4844 | if (ret) |
4826 | goto out_dio; | 4845 | goto out_dio; |
4827 | 4846 | ||
4828 | ret = ext4_alloc_file_blocks(file, lblk, max_blocks, flags, | 4847 | ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, |
4829 | mode); | 4848 | flags, mode); |
4830 | if (ret) | 4849 | if (ret) |
4831 | goto out_dio; | 4850 | goto out_dio; |
4832 | } | 4851 | } |
4852 | if (!partial_begin && !partial_end) | ||
4853 | goto out_dio; | ||
4833 | 4854 | ||
4834 | handle = ext4_journal_start(inode, EXT4_HT_MISC, 4); | 4855 | /* |
4856 | * In worst case we have to writeout two nonadjacent unwritten | ||
4857 | * blocks and update the inode | ||
4858 | */ | ||
4859 | credits = (2 * ext4_ext_index_trans_blocks(inode, 2)) + 1; | ||
4860 | if (ext4_should_journal_data(inode)) | ||
4861 | credits += 2; | ||
4862 | handle = ext4_journal_start(inode, EXT4_HT_MISC, credits); | ||
4835 | if (IS_ERR(handle)) { | 4863 | if (IS_ERR(handle)) { |
4836 | ret = PTR_ERR(handle); | 4864 | ret = PTR_ERR(handle); |
4837 | ext4_std_error(inode->i_sb, ret); | 4865 | ext4_std_error(inode->i_sb, ret); |
@@ -4839,12 +4867,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4839 | } | 4867 | } |
4840 | 4868 | ||
4841 | inode->i_mtime = inode->i_ctime = ext4_current_time(inode); | 4869 | inode->i_mtime = inode->i_ctime = ext4_current_time(inode); |
4842 | |||
4843 | if (new_size) { | 4870 | if (new_size) { |
4844 | if (new_size > i_size_read(inode)) | 4871 | ext4_update_inode_size(inode, new_size); |
4845 | i_size_write(inode, new_size); | ||
4846 | if (new_size > EXT4_I(inode)->i_disksize) | ||
4847 | ext4_update_i_disksize(inode, new_size); | ||
4848 | } else { | 4872 | } else { |
4849 | /* | 4873 | /* |
4850 | * Mark that we allocate beyond EOF so the subsequent truncate | 4874 | * Mark that we allocate beyond EOF so the subsequent truncate |
@@ -4853,7 +4877,6 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4853 | if ((offset + len) > i_size_read(inode)) | 4877 | if ((offset + len) > i_size_read(inode)) |
4854 | ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS); | 4878 | ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS); |
4855 | } | 4879 | } |
4856 | |||
4857 | ext4_mark_inode_dirty(handle, inode); | 4880 | ext4_mark_inode_dirty(handle, inode); |
4858 | 4881 | ||
4859 | /* Zero out partial block at the edges of the range */ | 4882 | /* Zero out partial block at the edges of the range */ |
@@ -4880,13 +4903,11 @@ out_mutex: | |||
4880 | long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | 4903 | long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) |
4881 | { | 4904 | { |
4882 | struct inode *inode = file_inode(file); | 4905 | struct inode *inode = file_inode(file); |
4883 | handle_t *handle; | ||
4884 | loff_t new_size = 0; | 4906 | loff_t new_size = 0; |
4885 | unsigned int max_blocks; | 4907 | unsigned int max_blocks; |
4886 | int ret = 0; | 4908 | int ret = 0; |
4887 | int flags; | 4909 | int flags; |
4888 | ext4_lblk_t lblk; | 4910 | ext4_lblk_t lblk; |
4889 | struct timespec tv; | ||
4890 | unsigned int blkbits = inode->i_blkbits; | 4911 | unsigned int blkbits = inode->i_blkbits; |
4891 | 4912 | ||
4892 | /* Return error if mode is not supported */ | 4913 | /* Return error if mode is not supported */ |
@@ -4937,36 +4958,15 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4937 | goto out; | 4958 | goto out; |
4938 | } | 4959 | } |
4939 | 4960 | ||
4940 | ret = ext4_alloc_file_blocks(file, lblk, max_blocks, flags, mode); | 4961 | ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, |
4962 | flags, mode); | ||
4941 | if (ret) | 4963 | if (ret) |
4942 | goto out; | 4964 | goto out; |
4943 | 4965 | ||
4944 | handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); | 4966 | if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) { |
4945 | if (IS_ERR(handle)) | 4967 | ret = jbd2_complete_transaction(EXT4_SB(inode->i_sb)->s_journal, |
4946 | goto out; | 4968 | EXT4_I(inode)->i_sync_tid); |
4947 | |||
4948 | tv = inode->i_ctime = ext4_current_time(inode); | ||
4949 | |||
4950 | if (new_size) { | ||
4951 | if (new_size > i_size_read(inode)) { | ||
4952 | i_size_write(inode, new_size); | ||
4953 | inode->i_mtime = tv; | ||
4954 | } | ||
4955 | if (new_size > EXT4_I(inode)->i_disksize) | ||
4956 | ext4_update_i_disksize(inode, new_size); | ||
4957 | } else { | ||
4958 | /* | ||
4959 | * Mark that we allocate beyond EOF so the subsequent truncate | ||
4960 | * can proceed even if the new size is the same as i_size. | ||
4961 | */ | ||
4962 | if ((offset + len) > i_size_read(inode)) | ||
4963 | ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS); | ||
4964 | } | 4969 | } |
4965 | ext4_mark_inode_dirty(handle, inode); | ||
4966 | if (file->f_flags & O_SYNC) | ||
4967 | ext4_handle_sync(handle); | ||
4968 | |||
4969 | ext4_journal_stop(handle); | ||
4970 | out: | 4970 | out: |
4971 | mutex_unlock(&inode->i_mutex); | 4971 | mutex_unlock(&inode->i_mutex); |
4972 | trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); | 4972 | trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 367a60c07cf0..3aa26e9117c4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1055,27 +1055,11 @@ static int ext4_write_end(struct file *file, | |||
1055 | } else | 1055 | } else |
1056 | copied = block_write_end(file, mapping, pos, | 1056 | copied = block_write_end(file, mapping, pos, |
1057 | len, copied, page, fsdata); | 1057 | len, copied, page, fsdata); |
1058 | |||
1059 | /* | 1058 | /* |
1060 | * No need to use i_size_read() here, the i_size | 1059 | * it's important to update i_size while still holding page lock: |
1061 | * cannot change under us because we hole i_mutex. | ||
1062 | * | ||
1063 | * But it's important to update i_size while still holding page lock: | ||
1064 | * page writeout could otherwise come in and zero beyond i_size. | 1060 | * page writeout could otherwise come in and zero beyond i_size. |
1065 | */ | 1061 | */ |
1066 | if (pos + copied > inode->i_size) { | 1062 | i_size_changed = ext4_update_inode_size(inode, pos + copied); |
1067 | i_size_write(inode, pos + copied); | ||
1068 | i_size_changed = 1; | ||
1069 | } | ||
1070 | |||
1071 | if (pos + copied > EXT4_I(inode)->i_disksize) { | ||
1072 | /* We need to mark inode dirty even if | ||
1073 | * new_i_size is less that inode->i_size | ||
1074 | * but greater than i_disksize. (hint delalloc) | ||
1075 | */ | ||
1076 | ext4_update_i_disksize(inode, (pos + copied)); | ||
1077 | i_size_changed = 1; | ||
1078 | } | ||
1079 | unlock_page(page); | 1063 | unlock_page(page); |
1080 | page_cache_release(page); | 1064 | page_cache_release(page); |
1081 | 1065 | ||
@@ -1123,7 +1107,7 @@ static int ext4_journalled_write_end(struct file *file, | |||
1123 | int ret = 0, ret2; | 1107 | int ret = 0, ret2; |
1124 | int partial = 0; | 1108 | int partial = 0; |
1125 | unsigned from, to; | 1109 | unsigned from, to; |
1126 | loff_t new_i_size; | 1110 | int size_changed = 0; |
1127 | 1111 | ||
1128 | trace_ext4_journalled_write_end(inode, pos, len, copied); | 1112 | trace_ext4_journalled_write_end(inode, pos, len, copied); |
1129 | from = pos & (PAGE_CACHE_SIZE - 1); | 1113 | from = pos & (PAGE_CACHE_SIZE - 1); |
@@ -1146,20 +1130,18 @@ static int ext4_journalled_write_end(struct file *file, | |||
1146 | if (!partial) | 1130 | if (!partial) |
1147 | SetPageUptodate(page); | 1131 | SetPageUptodate(page); |
1148 | } | 1132 | } |
1149 | new_i_size = pos + copied; | 1133 | size_changed = ext4_update_inode_size(inode, pos + copied); |
1150 | if (new_i_size > inode->i_size) | ||
1151 | i_size_write(inode, pos+copied); | ||
1152 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); | 1134 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); |
1153 | EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid; | 1135 | EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid; |
1154 | if (new_i_size > EXT4_I(inode)->i_disksize) { | 1136 | unlock_page(page); |
1155 | ext4_update_i_disksize(inode, new_i_size); | 1137 | page_cache_release(page); |
1138 | |||
1139 | if (size_changed) { | ||
1156 | ret2 = ext4_mark_inode_dirty(handle, inode); | 1140 | ret2 = ext4_mark_inode_dirty(handle, inode); |
1157 | if (!ret) | 1141 | if (!ret) |
1158 | ret = ret2; | 1142 | ret = ret2; |
1159 | } | 1143 | } |
1160 | 1144 | ||
1161 | unlock_page(page); | ||
1162 | page_cache_release(page); | ||
1163 | if (pos + len > inode->i_size && ext4_can_truncate(inode)) | 1145 | if (pos + len > inode->i_size && ext4_can_truncate(inode)) |
1164 | /* if we have allocated more blocks and copied | 1146 | /* if we have allocated more blocks and copied |
1165 | * less. We will have blocks allocated outside | 1147 | * less. We will have blocks allocated outside |
@@ -2095,6 +2077,7 @@ static int mpage_map_and_submit_extent(handle_t *handle, | |||
2095 | struct ext4_map_blocks *map = &mpd->map; | 2077 | struct ext4_map_blocks *map = &mpd->map; |
2096 | int err; | 2078 | int err; |
2097 | loff_t disksize; | 2079 | loff_t disksize; |
2080 | int progress = 0; | ||
2098 | 2081 | ||
2099 | mpd->io_submit.io_end->offset = | 2082 | mpd->io_submit.io_end->offset = |
2100 | ((loff_t)map->m_lblk) << inode->i_blkbits; | 2083 | ((loff_t)map->m_lblk) << inode->i_blkbits; |
@@ -2111,8 +2094,11 @@ static int mpage_map_and_submit_extent(handle_t *handle, | |||
2111 | * is non-zero, a commit should free up blocks. | 2094 | * is non-zero, a commit should free up blocks. |
2112 | */ | 2095 | */ |
2113 | if ((err == -ENOMEM) || | 2096 | if ((err == -ENOMEM) || |
2114 | (err == -ENOSPC && ext4_count_free_clusters(sb))) | 2097 | (err == -ENOSPC && ext4_count_free_clusters(sb))) { |
2098 | if (progress) | ||
2099 | goto update_disksize; | ||
2115 | return err; | 2100 | return err; |
2101 | } | ||
2116 | ext4_msg(sb, KERN_CRIT, | 2102 | ext4_msg(sb, KERN_CRIT, |
2117 | "Delayed block allocation failed for " | 2103 | "Delayed block allocation failed for " |
2118 | "inode %lu at logical offset %llu with" | 2104 | "inode %lu at logical offset %llu with" |
@@ -2129,15 +2115,17 @@ static int mpage_map_and_submit_extent(handle_t *handle, | |||
2129 | *give_up_on_write = true; | 2115 | *give_up_on_write = true; |
2130 | return err; | 2116 | return err; |
2131 | } | 2117 | } |
2118 | progress = 1; | ||
2132 | /* | 2119 | /* |
2133 | * Update buffer state, submit mapped pages, and get us new | 2120 | * Update buffer state, submit mapped pages, and get us new |
2134 | * extent to map | 2121 | * extent to map |
2135 | */ | 2122 | */ |
2136 | err = mpage_map_and_submit_buffers(mpd); | 2123 | err = mpage_map_and_submit_buffers(mpd); |
2137 | if (err < 0) | 2124 | if (err < 0) |
2138 | return err; | 2125 | goto update_disksize; |
2139 | } while (map->m_len); | 2126 | } while (map->m_len); |
2140 | 2127 | ||
2128 | update_disksize: | ||
2141 | /* | 2129 | /* |
2142 | * Update on-disk size after IO is submitted. Races with | 2130 | * Update on-disk size after IO is submitted. Races with |
2143 | * truncate are avoided by checking i_size under i_data_sem. | 2131 | * truncate are avoided by checking i_size under i_data_sem. |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 956027711faf..8b0f9ef517d6 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1412,6 +1412,8 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
1412 | int last = first + count - 1; | 1412 | int last = first + count - 1; |
1413 | struct super_block *sb = e4b->bd_sb; | 1413 | struct super_block *sb = e4b->bd_sb; |
1414 | 1414 | ||
1415 | if (WARN_ON(count == 0)) | ||
1416 | return; | ||
1415 | BUG_ON(last >= (sb->s_blocksize << 3)); | 1417 | BUG_ON(last >= (sb->s_blocksize << 3)); |
1416 | assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); | 1418 | assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); |
1417 | /* Don't bother if the block group is corrupt. */ | 1419 | /* Don't bother if the block group is corrupt. */ |
@@ -3221,6 +3223,8 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac) | |||
3221 | int err; | 3223 | int err; |
3222 | 3224 | ||
3223 | if (pa == NULL) { | 3225 | if (pa == NULL) { |
3226 | if (ac->ac_f_ex.fe_len == 0) | ||
3227 | return; | ||
3224 | err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b); | 3228 | err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b); |
3225 | if (err) { | 3229 | if (err) { |
3226 | /* | 3230 | /* |
@@ -3235,6 +3239,7 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac) | |||
3235 | mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start, | 3239 | mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start, |
3236 | ac->ac_f_ex.fe_len); | 3240 | ac->ac_f_ex.fe_len); |
3237 | ext4_unlock_group(ac->ac_sb, ac->ac_f_ex.fe_group); | 3241 | ext4_unlock_group(ac->ac_sb, ac->ac_f_ex.fe_group); |
3242 | ext4_mb_unload_buddy(&e4b); | ||
3238 | return; | 3243 | return; |
3239 | } | 3244 | } |
3240 | if (pa->pa_type == MB_INODE_PA) | 3245 | if (pa->pa_type == MB_INODE_PA) |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index b147a67baa0d..603e4ebbd0ac 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1227,7 +1227,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, | |||
1227 | buffer */ | 1227 | buffer */ |
1228 | int num = 0; | 1228 | int num = 0; |
1229 | ext4_lblk_t nblocks; | 1229 | ext4_lblk_t nblocks; |
1230 | int i, err; | 1230 | int i, err = 0; |
1231 | int namelen; | 1231 | int namelen; |
1232 | 1232 | ||
1233 | *res_dir = NULL; | 1233 | *res_dir = NULL; |
@@ -1264,7 +1264,11 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, | |||
1264 | * return. Otherwise, fall back to doing a search the | 1264 | * return. Otherwise, fall back to doing a search the |
1265 | * old fashioned way. | 1265 | * old fashioned way. |
1266 | */ | 1266 | */ |
1267 | if (bh || (err != ERR_BAD_DX_DIR)) | 1267 | if (err == -ENOENT) |
1268 | return NULL; | ||
1269 | if (err && err != ERR_BAD_DX_DIR) | ||
1270 | return ERR_PTR(err); | ||
1271 | if (bh) | ||
1268 | return bh; | 1272 | return bh; |
1269 | dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, " | 1273 | dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, " |
1270 | "falling back\n")); | 1274 | "falling back\n")); |
@@ -1295,6 +1299,11 @@ restart: | |||
1295 | } | 1299 | } |
1296 | num++; | 1300 | num++; |
1297 | bh = ext4_getblk(NULL, dir, b++, 0, &err); | 1301 | bh = ext4_getblk(NULL, dir, b++, 0, &err); |
1302 | if (unlikely(err)) { | ||
1303 | if (ra_max == 0) | ||
1304 | return ERR_PTR(err); | ||
1305 | break; | ||
1306 | } | ||
1298 | bh_use[ra_max] = bh; | 1307 | bh_use[ra_max] = bh; |
1299 | if (bh) | 1308 | if (bh) |
1300 | ll_rw_block(READ | REQ_META | REQ_PRIO, | 1309 | ll_rw_block(READ | REQ_META | REQ_PRIO, |
@@ -1417,6 +1426,8 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi | |||
1417 | return ERR_PTR(-ENAMETOOLONG); | 1426 | return ERR_PTR(-ENAMETOOLONG); |
1418 | 1427 | ||
1419 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 1428 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
1429 | if (IS_ERR(bh)) | ||
1430 | return (struct dentry *) bh; | ||
1420 | inode = NULL; | 1431 | inode = NULL; |
1421 | if (bh) { | 1432 | if (bh) { |
1422 | __u32 ino = le32_to_cpu(de->inode); | 1433 | __u32 ino = le32_to_cpu(de->inode); |
@@ -1450,6 +1461,8 @@ struct dentry *ext4_get_parent(struct dentry *child) | |||
1450 | struct buffer_head *bh; | 1461 | struct buffer_head *bh; |
1451 | 1462 | ||
1452 | bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL); | 1463 | bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL); |
1464 | if (IS_ERR(bh)) | ||
1465 | return (struct dentry *) bh; | ||
1453 | if (!bh) | 1466 | if (!bh) |
1454 | return ERR_PTR(-ENOENT); | 1467 | return ERR_PTR(-ENOENT); |
1455 | ino = le32_to_cpu(de->inode); | 1468 | ino = le32_to_cpu(de->inode); |
@@ -2727,6 +2740,8 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) | |||
2727 | 2740 | ||
2728 | retval = -ENOENT; | 2741 | retval = -ENOENT; |
2729 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 2742 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
2743 | if (IS_ERR(bh)) | ||
2744 | return PTR_ERR(bh); | ||
2730 | if (!bh) | 2745 | if (!bh) |
2731 | goto end_rmdir; | 2746 | goto end_rmdir; |
2732 | 2747 | ||
@@ -2794,6 +2809,8 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) | |||
2794 | 2809 | ||
2795 | retval = -ENOENT; | 2810 | retval = -ENOENT; |
2796 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 2811 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
2812 | if (IS_ERR(bh)) | ||
2813 | return PTR_ERR(bh); | ||
2797 | if (!bh) | 2814 | if (!bh) |
2798 | goto end_unlink; | 2815 | goto end_unlink; |
2799 | 2816 | ||
@@ -3121,6 +3138,8 @@ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, | |||
3121 | struct ext4_dir_entry_2 *de; | 3138 | struct ext4_dir_entry_2 *de; |
3122 | 3139 | ||
3123 | bh = ext4_find_entry(dir, d_name, &de, NULL); | 3140 | bh = ext4_find_entry(dir, d_name, &de, NULL); |
3141 | if (IS_ERR(bh)) | ||
3142 | return PTR_ERR(bh); | ||
3124 | if (bh) { | 3143 | if (bh) { |
3125 | retval = ext4_delete_entry(handle, dir, de, bh); | 3144 | retval = ext4_delete_entry(handle, dir, de, bh); |
3126 | brelse(bh); | 3145 | brelse(bh); |
@@ -3128,7 +3147,8 @@ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, | |||
3128 | return retval; | 3147 | return retval; |
3129 | } | 3148 | } |
3130 | 3149 | ||
3131 | static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent) | 3150 | static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent, |
3151 | int force_reread) | ||
3132 | { | 3152 | { |
3133 | int retval; | 3153 | int retval; |
3134 | /* | 3154 | /* |
@@ -3140,7 +3160,8 @@ static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent) | |||
3140 | if (le32_to_cpu(ent->de->inode) != ent->inode->i_ino || | 3160 | if (le32_to_cpu(ent->de->inode) != ent->inode->i_ino || |
3141 | ent->de->name_len != ent->dentry->d_name.len || | 3161 | ent->de->name_len != ent->dentry->d_name.len || |
3142 | strncmp(ent->de->name, ent->dentry->d_name.name, | 3162 | strncmp(ent->de->name, ent->dentry->d_name.name, |
3143 | ent->de->name_len)) { | 3163 | ent->de->name_len) || |
3164 | force_reread) { | ||
3144 | retval = ext4_find_delete_entry(handle, ent->dir, | 3165 | retval = ext4_find_delete_entry(handle, ent->dir, |
3145 | &ent->dentry->d_name); | 3166 | &ent->dentry->d_name); |
3146 | } else { | 3167 | } else { |
@@ -3191,6 +3212,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3191 | .dentry = new_dentry, | 3212 | .dentry = new_dentry, |
3192 | .inode = new_dentry->d_inode, | 3213 | .inode = new_dentry->d_inode, |
3193 | }; | 3214 | }; |
3215 | int force_reread; | ||
3194 | int retval; | 3216 | int retval; |
3195 | 3217 | ||
3196 | dquot_initialize(old.dir); | 3218 | dquot_initialize(old.dir); |
@@ -3202,6 +3224,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3202 | dquot_initialize(new.inode); | 3224 | dquot_initialize(new.inode); |
3203 | 3225 | ||
3204 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); | 3226 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); |
3227 | if (IS_ERR(old.bh)) | ||
3228 | return PTR_ERR(old.bh); | ||
3205 | /* | 3229 | /* |
3206 | * Check for inode number is _not_ due to possible IO errors. | 3230 | * Check for inode number is _not_ due to possible IO errors. |
3207 | * We might rmdir the source, keep it as pwd of some process | 3231 | * We might rmdir the source, keep it as pwd of some process |
@@ -3214,6 +3238,11 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3214 | 3238 | ||
3215 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, | 3239 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, |
3216 | &new.de, &new.inlined); | 3240 | &new.de, &new.inlined); |
3241 | if (IS_ERR(new.bh)) { | ||
3242 | retval = PTR_ERR(new.bh); | ||
3243 | new.bh = NULL; | ||
3244 | goto end_rename; | ||
3245 | } | ||
3217 | if (new.bh) { | 3246 | if (new.bh) { |
3218 | if (!new.inode) { | 3247 | if (!new.inode) { |
3219 | brelse(new.bh); | 3248 | brelse(new.bh); |
@@ -3246,6 +3275,15 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3246 | if (retval) | 3275 | if (retval) |
3247 | goto end_rename; | 3276 | goto end_rename; |
3248 | } | 3277 | } |
3278 | /* | ||
3279 | * If we're renaming a file within an inline_data dir and adding or | ||
3280 | * setting the new dirent causes a conversion from inline_data to | ||
3281 | * extents/blockmap, we need to force the dirent delete code to | ||
3282 | * re-read the directory, or else we end up trying to delete a dirent | ||
3283 | * from what is now the extent tree root (or a block map). | ||
3284 | */ | ||
3285 | force_reread = (new.dir->i_ino == old.dir->i_ino && | ||
3286 | ext4_test_inode_flag(new.dir, EXT4_INODE_INLINE_DATA)); | ||
3249 | if (!new.bh) { | 3287 | if (!new.bh) { |
3250 | retval = ext4_add_entry(handle, new.dentry, old.inode); | 3288 | retval = ext4_add_entry(handle, new.dentry, old.inode); |
3251 | if (retval) | 3289 | if (retval) |
@@ -3256,6 +3294,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3256 | if (retval) | 3294 | if (retval) |
3257 | goto end_rename; | 3295 | goto end_rename; |
3258 | } | 3296 | } |
3297 | if (force_reread) | ||
3298 | force_reread = !ext4_test_inode_flag(new.dir, | ||
3299 | EXT4_INODE_INLINE_DATA); | ||
3259 | 3300 | ||
3260 | /* | 3301 | /* |
3261 | * Like most other Unix systems, set the ctime for inodes on a | 3302 | * Like most other Unix systems, set the ctime for inodes on a |
@@ -3267,7 +3308,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3267 | /* | 3308 | /* |
3268 | * ok, that's it | 3309 | * ok, that's it |
3269 | */ | 3310 | */ |
3270 | ext4_rename_delete(handle, &old); | 3311 | ext4_rename_delete(handle, &old, force_reread); |
3271 | 3312 | ||
3272 | if (new.inode) { | 3313 | if (new.inode) { |
3273 | ext4_dec_count(handle, new.inode); | 3314 | ext4_dec_count(handle, new.inode); |
@@ -3330,6 +3371,8 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3330 | 3371 | ||
3331 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, | 3372 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, |
3332 | &old.de, &old.inlined); | 3373 | &old.de, &old.inlined); |
3374 | if (IS_ERR(old.bh)) | ||
3375 | return PTR_ERR(old.bh); | ||
3333 | /* | 3376 | /* |
3334 | * Check for inode number is _not_ due to possible IO errors. | 3377 | * Check for inode number is _not_ due to possible IO errors. |
3335 | * We might rmdir the source, keep it as pwd of some process | 3378 | * We might rmdir the source, keep it as pwd of some process |
@@ -3342,6 +3385,11 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3342 | 3385 | ||
3343 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, | 3386 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, |
3344 | &new.de, &new.inlined); | 3387 | &new.de, &new.inlined); |
3388 | if (IS_ERR(new.bh)) { | ||
3389 | retval = PTR_ERR(new.bh); | ||
3390 | new.bh = NULL; | ||
3391 | goto end_rename; | ||
3392 | } | ||
3345 | 3393 | ||
3346 | /* RENAME_EXCHANGE case: old *and* new must both exist */ | 3394 | /* RENAME_EXCHANGE case: old *and* new must both exist */ |
3347 | if (!new.bh || le32_to_cpu(new.de->inode) != new.inode->i_ino) | 3395 | if (!new.bh || le32_to_cpu(new.de->inode) != new.inode->i_ino) |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index bb0e80f03e2e..1e43b905ff98 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -575,6 +575,7 @@ handle_bb: | |||
575 | bh = bclean(handle, sb, block); | 575 | bh = bclean(handle, sb, block); |
576 | if (IS_ERR(bh)) { | 576 | if (IS_ERR(bh)) { |
577 | err = PTR_ERR(bh); | 577 | err = PTR_ERR(bh); |
578 | bh = NULL; | ||
578 | goto out; | 579 | goto out; |
579 | } | 580 | } |
580 | overhead = ext4_group_overhead_blocks(sb, group); | 581 | overhead = ext4_group_overhead_blocks(sb, group); |
@@ -603,6 +604,7 @@ handle_ib: | |||
603 | bh = bclean(handle, sb, block); | 604 | bh = bclean(handle, sb, block); |
604 | if (IS_ERR(bh)) { | 605 | if (IS_ERR(bh)) { |
605 | err = PTR_ERR(bh); | 606 | err = PTR_ERR(bh); |
607 | bh = NULL; | ||
606 | goto out; | 608 | goto out; |
607 | } | 609 | } |
608 | 610 | ||
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 32b43ad154b9..0b28b36e7915 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3181,9 +3181,9 @@ static int set_journal_csum_feature_set(struct super_block *sb) | |||
3181 | 3181 | ||
3182 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, | 3182 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, |
3183 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { | 3183 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { |
3184 | /* journal checksum v2 */ | 3184 | /* journal checksum v3 */ |
3185 | compat = 0; | 3185 | compat = 0; |
3186 | incompat = JBD2_FEATURE_INCOMPAT_CSUM_V2; | 3186 | incompat = JBD2_FEATURE_INCOMPAT_CSUM_V3; |
3187 | } else { | 3187 | } else { |
3188 | /* journal checksum v1 */ | 3188 | /* journal checksum v1 */ |
3189 | compat = JBD2_FEATURE_COMPAT_CHECKSUM; | 3189 | compat = JBD2_FEATURE_COMPAT_CHECKSUM; |
@@ -3205,6 +3205,7 @@ static int set_journal_csum_feature_set(struct super_block *sb) | |||
3205 | jbd2_journal_clear_features(sbi->s_journal, | 3205 | jbd2_journal_clear_features(sbi->s_journal, |
3206 | JBD2_FEATURE_COMPAT_CHECKSUM, 0, | 3206 | JBD2_FEATURE_COMPAT_CHECKSUM, 0, |
3207 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | | 3207 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | |
3208 | JBD2_FEATURE_INCOMPAT_CSUM_V3 | | ||
3208 | JBD2_FEATURE_INCOMPAT_CSUM_V2); | 3209 | JBD2_FEATURE_INCOMPAT_CSUM_V2); |
3209 | } | 3210 | } |
3210 | 3211 | ||
diff --git a/fs/f2fs/Kconfig b/fs/f2fs/Kconfig index 214fe1054fce..736a348509f7 100644 --- a/fs/f2fs/Kconfig +++ b/fs/f2fs/Kconfig | |||
@@ -23,7 +23,7 @@ config F2FS_STAT_FS | |||
23 | mounted as f2fs. Each file shows the whole f2fs information. | 23 | mounted as f2fs. Each file shows the whole f2fs information. |
24 | 24 | ||
25 | /sys/kernel/debug/f2fs/status includes: | 25 | /sys/kernel/debug/f2fs/status includes: |
26 | - major file system information managed by f2fs currently | 26 | - major filesystem information managed by f2fs currently |
27 | - average SIT information about whole segments | 27 | - average SIT information about whole segments |
28 | - current memory footprint consumed by f2fs. | 28 | - current memory footprint consumed by f2fs. |
29 | 29 | ||
@@ -68,6 +68,6 @@ config F2FS_CHECK_FS | |||
68 | bool "F2FS consistency checking feature" | 68 | bool "F2FS consistency checking feature" |
69 | depends on F2FS_FS | 69 | depends on F2FS_FS |
70 | help | 70 | help |
71 | Enables BUG_ONs which check the file system consistency in runtime. | 71 | Enables BUG_ONs which check the filesystem consistency in runtime. |
72 | 72 | ||
73 | If you want to improve the performance, say N. | 73 | If you want to improve the performance, say N. |
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 6aeed5bada52..ec3b7a5381fa 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
@@ -160,14 +160,11 @@ static int f2fs_write_meta_page(struct page *page, | |||
160 | goto redirty_out; | 160 | goto redirty_out; |
161 | if (wbc->for_reclaim) | 161 | if (wbc->for_reclaim) |
162 | goto redirty_out; | 162 | goto redirty_out; |
163 | 163 | if (unlikely(f2fs_cp_error(sbi))) | |
164 | /* Should not write any meta pages, if any IO error was occurred */ | 164 | goto redirty_out; |
165 | if (unlikely(is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG))) | ||
166 | goto no_write; | ||
167 | 165 | ||
168 | f2fs_wait_on_page_writeback(page, META); | 166 | f2fs_wait_on_page_writeback(page, META); |
169 | write_meta_page(sbi, page); | 167 | write_meta_page(sbi, page); |
170 | no_write: | ||
171 | dec_page_count(sbi, F2FS_DIRTY_META); | 168 | dec_page_count(sbi, F2FS_DIRTY_META); |
172 | unlock_page(page); | 169 | unlock_page(page); |
173 | return 0; | 170 | return 0; |
@@ -348,7 +345,7 @@ bool exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode) | |||
348 | return e ? true : false; | 345 | return e ? true : false; |
349 | } | 346 | } |
350 | 347 | ||
351 | static void release_dirty_inode(struct f2fs_sb_info *sbi) | 348 | void release_dirty_inode(struct f2fs_sb_info *sbi) |
352 | { | 349 | { |
353 | struct ino_entry *e, *tmp; | 350 | struct ino_entry *e, *tmp; |
354 | int i; | 351 | int i; |
@@ -446,8 +443,8 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) | |||
446 | struct f2fs_orphan_block *orphan_blk = NULL; | 443 | struct f2fs_orphan_block *orphan_blk = NULL; |
447 | unsigned int nentries = 0; | 444 | unsigned int nentries = 0; |
448 | unsigned short index; | 445 | unsigned short index; |
449 | unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans + | 446 | unsigned short orphan_blocks = |
450 | (F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK); | 447 | (unsigned short)GET_ORPHAN_BLOCKS(sbi->n_orphans); |
451 | struct page *page = NULL; | 448 | struct page *page = NULL; |
452 | struct ino_entry *orphan = NULL; | 449 | struct ino_entry *orphan = NULL; |
453 | 450 | ||
@@ -737,7 +734,7 @@ retry: | |||
737 | /* | 734 | /* |
738 | * Freeze all the FS-operations for checkpoint. | 735 | * Freeze all the FS-operations for checkpoint. |
739 | */ | 736 | */ |
740 | static void block_operations(struct f2fs_sb_info *sbi) | 737 | static int block_operations(struct f2fs_sb_info *sbi) |
741 | { | 738 | { |
742 | struct writeback_control wbc = { | 739 | struct writeback_control wbc = { |
743 | .sync_mode = WB_SYNC_ALL, | 740 | .sync_mode = WB_SYNC_ALL, |
@@ -745,6 +742,7 @@ static void block_operations(struct f2fs_sb_info *sbi) | |||
745 | .for_reclaim = 0, | 742 | .for_reclaim = 0, |
746 | }; | 743 | }; |
747 | struct blk_plug plug; | 744 | struct blk_plug plug; |
745 | int err = 0; | ||
748 | 746 | ||
749 | blk_start_plug(&plug); | 747 | blk_start_plug(&plug); |
750 | 748 | ||
@@ -754,11 +752,15 @@ retry_flush_dents: | |||
754 | if (get_pages(sbi, F2FS_DIRTY_DENTS)) { | 752 | if (get_pages(sbi, F2FS_DIRTY_DENTS)) { |
755 | f2fs_unlock_all(sbi); | 753 | f2fs_unlock_all(sbi); |
756 | sync_dirty_dir_inodes(sbi); | 754 | sync_dirty_dir_inodes(sbi); |
755 | if (unlikely(f2fs_cp_error(sbi))) { | ||
756 | err = -EIO; | ||
757 | goto out; | ||
758 | } | ||
757 | goto retry_flush_dents; | 759 | goto retry_flush_dents; |
758 | } | 760 | } |
759 | 761 | ||
760 | /* | 762 | /* |
761 | * POR: we should ensure that there is no dirty node pages | 763 | * POR: we should ensure that there are no dirty node pages |
762 | * until finishing nat/sit flush. | 764 | * until finishing nat/sit flush. |
763 | */ | 765 | */ |
764 | retry_flush_nodes: | 766 | retry_flush_nodes: |
@@ -767,9 +769,16 @@ retry_flush_nodes: | |||
767 | if (get_pages(sbi, F2FS_DIRTY_NODES)) { | 769 | if (get_pages(sbi, F2FS_DIRTY_NODES)) { |
768 | up_write(&sbi->node_write); | 770 | up_write(&sbi->node_write); |
769 | sync_node_pages(sbi, 0, &wbc); | 771 | sync_node_pages(sbi, 0, &wbc); |
772 | if (unlikely(f2fs_cp_error(sbi))) { | ||
773 | f2fs_unlock_all(sbi); | ||
774 | err = -EIO; | ||
775 | goto out; | ||
776 | } | ||
770 | goto retry_flush_nodes; | 777 | goto retry_flush_nodes; |
771 | } | 778 | } |
779 | out: | ||
772 | blk_finish_plug(&plug); | 780 | blk_finish_plug(&plug); |
781 | return err; | ||
773 | } | 782 | } |
774 | 783 | ||
775 | static void unblock_operations(struct f2fs_sb_info *sbi) | 784 | static void unblock_operations(struct f2fs_sb_info *sbi) |
@@ -813,8 +822,11 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
813 | discard_next_dnode(sbi, NEXT_FREE_BLKADDR(sbi, curseg)); | 822 | discard_next_dnode(sbi, NEXT_FREE_BLKADDR(sbi, curseg)); |
814 | 823 | ||
815 | /* Flush all the NAT/SIT pages */ | 824 | /* Flush all the NAT/SIT pages */ |
816 | while (get_pages(sbi, F2FS_DIRTY_META)) | 825 | while (get_pages(sbi, F2FS_DIRTY_META)) { |
817 | sync_meta_pages(sbi, META, LONG_MAX); | 826 | sync_meta_pages(sbi, META, LONG_MAX); |
827 | if (unlikely(f2fs_cp_error(sbi))) | ||
828 | return; | ||
829 | } | ||
818 | 830 | ||
819 | next_free_nid(sbi, &last_nid); | 831 | next_free_nid(sbi, &last_nid); |
820 | 832 | ||
@@ -825,7 +837,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
825 | ckpt->elapsed_time = cpu_to_le64(get_mtime(sbi)); | 837 | ckpt->elapsed_time = cpu_to_le64(get_mtime(sbi)); |
826 | ckpt->valid_block_count = cpu_to_le64(valid_user_blocks(sbi)); | 838 | ckpt->valid_block_count = cpu_to_le64(valid_user_blocks(sbi)); |
827 | ckpt->free_segment_count = cpu_to_le32(free_segments(sbi)); | 839 | ckpt->free_segment_count = cpu_to_le32(free_segments(sbi)); |
828 | for (i = 0; i < 3; i++) { | 840 | for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) { |
829 | ckpt->cur_node_segno[i] = | 841 | ckpt->cur_node_segno[i] = |
830 | cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_NODE)); | 842 | cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_NODE)); |
831 | ckpt->cur_node_blkoff[i] = | 843 | ckpt->cur_node_blkoff[i] = |
@@ -833,7 +845,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
833 | ckpt->alloc_type[i + CURSEG_HOT_NODE] = | 845 | ckpt->alloc_type[i + CURSEG_HOT_NODE] = |
834 | curseg_alloc_type(sbi, i + CURSEG_HOT_NODE); | 846 | curseg_alloc_type(sbi, i + CURSEG_HOT_NODE); |
835 | } | 847 | } |
836 | for (i = 0; i < 3; i++) { | 848 | for (i = 0; i < NR_CURSEG_DATA_TYPE; i++) { |
837 | ckpt->cur_data_segno[i] = | 849 | ckpt->cur_data_segno[i] = |
838 | cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_DATA)); | 850 | cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_DATA)); |
839 | ckpt->cur_data_blkoff[i] = | 851 | ckpt->cur_data_blkoff[i] = |
@@ -848,24 +860,23 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
848 | 860 | ||
849 | /* 2 cp + n data seg summary + orphan inode blocks */ | 861 | /* 2 cp + n data seg summary + orphan inode blocks */ |
850 | data_sum_blocks = npages_for_summary_flush(sbi); | 862 | data_sum_blocks = npages_for_summary_flush(sbi); |
851 | if (data_sum_blocks < 3) | 863 | if (data_sum_blocks < NR_CURSEG_DATA_TYPE) |
852 | set_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); | 864 | set_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); |
853 | else | 865 | else |
854 | clear_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); | 866 | clear_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); |
855 | 867 | ||
856 | orphan_blocks = (sbi->n_orphans + F2FS_ORPHANS_PER_BLOCK - 1) | 868 | orphan_blocks = GET_ORPHAN_BLOCKS(sbi->n_orphans); |
857 | / F2FS_ORPHANS_PER_BLOCK; | ||
858 | ckpt->cp_pack_start_sum = cpu_to_le32(1 + cp_payload_blks + | 869 | ckpt->cp_pack_start_sum = cpu_to_le32(1 + cp_payload_blks + |
859 | orphan_blocks); | 870 | orphan_blocks); |
860 | 871 | ||
861 | if (is_umount) { | 872 | if (is_umount) { |
862 | set_ckpt_flags(ckpt, CP_UMOUNT_FLAG); | 873 | set_ckpt_flags(ckpt, CP_UMOUNT_FLAG); |
863 | ckpt->cp_pack_total_block_count = cpu_to_le32(2 + | 874 | ckpt->cp_pack_total_block_count = cpu_to_le32(F2FS_CP_PACKS+ |
864 | cp_payload_blks + data_sum_blocks + | 875 | cp_payload_blks + data_sum_blocks + |
865 | orphan_blocks + NR_CURSEG_NODE_TYPE); | 876 | orphan_blocks + NR_CURSEG_NODE_TYPE); |
866 | } else { | 877 | } else { |
867 | clear_ckpt_flags(ckpt, CP_UMOUNT_FLAG); | 878 | clear_ckpt_flags(ckpt, CP_UMOUNT_FLAG); |
868 | ckpt->cp_pack_total_block_count = cpu_to_le32(2 + | 879 | ckpt->cp_pack_total_block_count = cpu_to_le32(F2FS_CP_PACKS + |
869 | cp_payload_blks + data_sum_blocks + | 880 | cp_payload_blks + data_sum_blocks + |
870 | orphan_blocks); | 881 | orphan_blocks); |
871 | } | 882 | } |
@@ -924,6 +935,9 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
924 | /* wait for previous submitted node/meta pages writeback */ | 935 | /* wait for previous submitted node/meta pages writeback */ |
925 | wait_on_all_pages_writeback(sbi); | 936 | wait_on_all_pages_writeback(sbi); |
926 | 937 | ||
938 | if (unlikely(f2fs_cp_error(sbi))) | ||
939 | return; | ||
940 | |||
927 | filemap_fdatawait_range(NODE_MAPPING(sbi), 0, LONG_MAX); | 941 | filemap_fdatawait_range(NODE_MAPPING(sbi), 0, LONG_MAX); |
928 | filemap_fdatawait_range(META_MAPPING(sbi), 0, LONG_MAX); | 942 | filemap_fdatawait_range(META_MAPPING(sbi), 0, LONG_MAX); |
929 | 943 | ||
@@ -934,15 +948,17 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
934 | /* Here, we only have one bio having CP pack */ | 948 | /* Here, we only have one bio having CP pack */ |
935 | sync_meta_pages(sbi, META_FLUSH, LONG_MAX); | 949 | sync_meta_pages(sbi, META_FLUSH, LONG_MAX); |
936 | 950 | ||
937 | if (!is_set_ckpt_flags(ckpt, CP_ERROR_FLAG)) { | 951 | release_dirty_inode(sbi); |
938 | clear_prefree_segments(sbi); | 952 | |
939 | release_dirty_inode(sbi); | 953 | if (unlikely(f2fs_cp_error(sbi))) |
940 | F2FS_RESET_SB_DIRT(sbi); | 954 | return; |
941 | } | 955 | |
956 | clear_prefree_segments(sbi); | ||
957 | F2FS_RESET_SB_DIRT(sbi); | ||
942 | } | 958 | } |
943 | 959 | ||
944 | /* | 960 | /* |
945 | * We guarantee that this checkpoint procedure should not fail. | 961 | * We guarantee that this checkpoint procedure will not fail. |
946 | */ | 962 | */ |
947 | void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | 963 | void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) |
948 | { | 964 | { |
@@ -952,7 +968,13 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
952 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "start block_ops"); | 968 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "start block_ops"); |
953 | 969 | ||
954 | mutex_lock(&sbi->cp_mutex); | 970 | mutex_lock(&sbi->cp_mutex); |
955 | block_operations(sbi); | 971 | |
972 | if (!sbi->s_dirty) | ||
973 | goto out; | ||
974 | if (unlikely(f2fs_cp_error(sbi))) | ||
975 | goto out; | ||
976 | if (block_operations(sbi)) | ||
977 | goto out; | ||
956 | 978 | ||
957 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish block_ops"); | 979 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish block_ops"); |
958 | 980 | ||
@@ -976,9 +998,9 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
976 | do_checkpoint(sbi, is_umount); | 998 | do_checkpoint(sbi, is_umount); |
977 | 999 | ||
978 | unblock_operations(sbi); | 1000 | unblock_operations(sbi); |
979 | mutex_unlock(&sbi->cp_mutex); | ||
980 | |||
981 | stat_inc_cp_count(sbi->stat_info); | 1001 | stat_inc_cp_count(sbi->stat_info); |
1002 | out: | ||
1003 | mutex_unlock(&sbi->cp_mutex); | ||
982 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint"); | 1004 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint"); |
983 | } | 1005 | } |
984 | 1006 | ||
@@ -999,8 +1021,8 @@ void init_ino_entry_info(struct f2fs_sb_info *sbi) | |||
999 | * for cp pack we can have max 1020*504 orphan entries | 1021 | * for cp pack we can have max 1020*504 orphan entries |
1000 | */ | 1022 | */ |
1001 | sbi->n_orphans = 0; | 1023 | sbi->n_orphans = 0; |
1002 | sbi->max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE) | 1024 | sbi->max_orphans = (sbi->blocks_per_seg - F2FS_CP_PACKS - |
1003 | * F2FS_ORPHANS_PER_BLOCK; | 1025 | NR_CURSEG_TYPE) * F2FS_ORPHANS_PER_BLOCK; |
1004 | } | 1026 | } |
1005 | 1027 | ||
1006 | int __init create_checkpoint_caches(void) | 1028 | int __init create_checkpoint_caches(void) |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 03313099c51c..76de83e25a89 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -53,7 +53,7 @@ static void f2fs_write_end_io(struct bio *bio, int err) | |||
53 | struct page *page = bvec->bv_page; | 53 | struct page *page = bvec->bv_page; |
54 | 54 | ||
55 | if (unlikely(err)) { | 55 | if (unlikely(err)) { |
56 | SetPageError(page); | 56 | set_page_dirty(page); |
57 | set_bit(AS_EIO, &page->mapping->flags); | 57 | set_bit(AS_EIO, &page->mapping->flags); |
58 | f2fs_stop_checkpoint(sbi); | 58 | f2fs_stop_checkpoint(sbi); |
59 | } | 59 | } |
@@ -691,7 +691,7 @@ get_next: | |||
691 | allocated = true; | 691 | allocated = true; |
692 | blkaddr = dn.data_blkaddr; | 692 | blkaddr = dn.data_blkaddr; |
693 | } | 693 | } |
694 | /* Give more consecutive addresses for the read ahead */ | 694 | /* Give more consecutive addresses for the readahead */ |
695 | if (blkaddr == (bh_result->b_blocknr + ofs)) { | 695 | if (blkaddr == (bh_result->b_blocknr + ofs)) { |
696 | ofs++; | 696 | ofs++; |
697 | dn.ofs_in_node++; | 697 | dn.ofs_in_node++; |
@@ -739,7 +739,7 @@ static int f2fs_read_data_page(struct file *file, struct page *page) | |||
739 | 739 | ||
740 | trace_f2fs_readpage(page, DATA); | 740 | trace_f2fs_readpage(page, DATA); |
741 | 741 | ||
742 | /* If the file has inline data, try to read it directlly */ | 742 | /* If the file has inline data, try to read it directly */ |
743 | if (f2fs_has_inline_data(inode)) | 743 | if (f2fs_has_inline_data(inode)) |
744 | ret = f2fs_read_inline_data(inode, page); | 744 | ret = f2fs_read_inline_data(inode, page); |
745 | else | 745 | else |
@@ -836,10 +836,19 @@ write: | |||
836 | 836 | ||
837 | /* Dentry blocks are controlled by checkpoint */ | 837 | /* Dentry blocks are controlled by checkpoint */ |
838 | if (S_ISDIR(inode->i_mode)) { | 838 | if (S_ISDIR(inode->i_mode)) { |
839 | if (unlikely(f2fs_cp_error(sbi))) | ||
840 | goto redirty_out; | ||
839 | err = do_write_data_page(page, &fio); | 841 | err = do_write_data_page(page, &fio); |
840 | goto done; | 842 | goto done; |
841 | } | 843 | } |
842 | 844 | ||
845 | /* we should bypass data pages to proceed the kworkder jobs */ | ||
846 | if (unlikely(f2fs_cp_error(sbi))) { | ||
847 | SetPageError(page); | ||
848 | unlock_page(page); | ||
849 | return 0; | ||
850 | } | ||
851 | |||
843 | if (!wbc->for_reclaim) | 852 | if (!wbc->for_reclaim) |
844 | need_balance_fs = true; | 853 | need_balance_fs = true; |
845 | else if (has_not_enough_free_secs(sbi, 0)) | 854 | else if (has_not_enough_free_secs(sbi, 0)) |
@@ -927,7 +936,7 @@ static void f2fs_write_failed(struct address_space *mapping, loff_t to) | |||
927 | 936 | ||
928 | if (to > inode->i_size) { | 937 | if (to > inode->i_size) { |
929 | truncate_pagecache(inode, inode->i_size); | 938 | truncate_pagecache(inode, inode->i_size); |
930 | truncate_blocks(inode, inode->i_size); | 939 | truncate_blocks(inode, inode->i_size, true); |
931 | } | 940 | } |
932 | } | 941 | } |
933 | 942 | ||
@@ -946,7 +955,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, | |||
946 | 955 | ||
947 | f2fs_balance_fs(sbi); | 956 | f2fs_balance_fs(sbi); |
948 | repeat: | 957 | repeat: |
949 | err = f2fs_convert_inline_data(inode, pos + len); | 958 | err = f2fs_convert_inline_data(inode, pos + len, NULL); |
950 | if (err) | 959 | if (err) |
951 | goto fail; | 960 | goto fail; |
952 | 961 | ||
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index a441ba33be11..fecebdbfd781 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c | |||
@@ -32,7 +32,7 @@ static void update_general_status(struct f2fs_sb_info *sbi) | |||
32 | struct f2fs_stat_info *si = F2FS_STAT(sbi); | 32 | struct f2fs_stat_info *si = F2FS_STAT(sbi); |
33 | int i; | 33 | int i; |
34 | 34 | ||
35 | /* valid check of the segment numbers */ | 35 | /* validation check of the segment numbers */ |
36 | si->hit_ext = sbi->read_hit_ext; | 36 | si->hit_ext = sbi->read_hit_ext; |
37 | si->total_ext = sbi->total_hit_ext; | 37 | si->total_ext = sbi->total_hit_ext; |
38 | si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES); | 38 | si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES); |
@@ -152,7 +152,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi) | |||
152 | si->base_mem += NR_DIRTY_TYPE * f2fs_bitmap_size(TOTAL_SEGS(sbi)); | 152 | si->base_mem += NR_DIRTY_TYPE * f2fs_bitmap_size(TOTAL_SEGS(sbi)); |
153 | si->base_mem += f2fs_bitmap_size(TOTAL_SECS(sbi)); | 153 | si->base_mem += f2fs_bitmap_size(TOTAL_SECS(sbi)); |
154 | 154 | ||
155 | /* buld nm */ | 155 | /* build nm */ |
156 | si->base_mem += sizeof(struct f2fs_nm_info); | 156 | si->base_mem += sizeof(struct f2fs_nm_info); |
157 | si->base_mem += __bitmap_size(sbi, NAT_BITMAP); | 157 | si->base_mem += __bitmap_size(sbi, NAT_BITMAP); |
158 | 158 | ||
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index bcf893c3d903..155fb056b7f1 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -124,7 +124,7 @@ static struct f2fs_dir_entry *find_in_block(struct page *dentry_page, | |||
124 | 124 | ||
125 | /* | 125 | /* |
126 | * For the most part, it should be a bug when name_len is zero. | 126 | * For the most part, it should be a bug when name_len is zero. |
127 | * We stop here for figuring out where the bugs are occurred. | 127 | * We stop here for figuring out where the bugs has occurred. |
128 | */ | 128 | */ |
129 | f2fs_bug_on(!de->name_len); | 129 | f2fs_bug_on(!de->name_len); |
130 | 130 | ||
@@ -391,7 +391,7 @@ put_error: | |||
391 | error: | 391 | error: |
392 | /* once the failed inode becomes a bad inode, i_mode is S_IFREG */ | 392 | /* once the failed inode becomes a bad inode, i_mode is S_IFREG */ |
393 | truncate_inode_pages(&inode->i_data, 0); | 393 | truncate_inode_pages(&inode->i_data, 0); |
394 | truncate_blocks(inode, 0); | 394 | truncate_blocks(inode, 0, false); |
395 | remove_dirty_dir_inode(inode); | 395 | remove_dirty_dir_inode(inode); |
396 | remove_inode_page(inode); | 396 | remove_inode_page(inode); |
397 | return ERR_PTR(err); | 397 | return ERR_PTR(err); |
@@ -563,7 +563,7 @@ fail: | |||
563 | } | 563 | } |
564 | 564 | ||
565 | /* | 565 | /* |
566 | * It only removes the dentry from the dentry page,corresponding name | 566 | * It only removes the dentry from the dentry page, corresponding name |
567 | * entry in name page does not need to be touched during deletion. | 567 | * entry in name page does not need to be touched during deletion. |
568 | */ | 568 | */ |
569 | void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, | 569 | void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 4dab5338a97a..e921242186f6 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #define f2fs_bug_on(condition) BUG_ON(condition) | 24 | #define f2fs_bug_on(condition) BUG_ON(condition) |
25 | #define f2fs_down_write(x, y) down_write_nest_lock(x, y) | 25 | #define f2fs_down_write(x, y) down_write_nest_lock(x, y) |
26 | #else | 26 | #else |
27 | #define f2fs_bug_on(condition) | 27 | #define f2fs_bug_on(condition) WARN_ON(condition) |
28 | #define f2fs_down_write(x, y) down_write(x) | 28 | #define f2fs_down_write(x, y) down_write(x) |
29 | #endif | 29 | #endif |
30 | 30 | ||
@@ -395,7 +395,7 @@ enum count_type { | |||
395 | }; | 395 | }; |
396 | 396 | ||
397 | /* | 397 | /* |
398 | * The below are the page types of bios used in submti_bio(). | 398 | * The below are the page types of bios used in submit_bio(). |
399 | * The available types are: | 399 | * The available types are: |
400 | * DATA User data pages. It operates as async mode. | 400 | * DATA User data pages. It operates as async mode. |
401 | * NODE Node pages. It operates as async mode. | 401 | * NODE Node pages. It operates as async mode. |
@@ -470,7 +470,7 @@ struct f2fs_sb_info { | |||
470 | struct list_head dir_inode_list; /* dir inode list */ | 470 | struct list_head dir_inode_list; /* dir inode list */ |
471 | spinlock_t dir_inode_lock; /* for dir inode list lock */ | 471 | spinlock_t dir_inode_lock; /* for dir inode list lock */ |
472 | 472 | ||
473 | /* basic file system units */ | 473 | /* basic filesystem units */ |
474 | unsigned int log_sectors_per_block; /* log2 sectors per block */ | 474 | unsigned int log_sectors_per_block; /* log2 sectors per block */ |
475 | unsigned int log_blocksize; /* log2 block size */ | 475 | unsigned int log_blocksize; /* log2 block size */ |
476 | unsigned int blocksize; /* block size */ | 476 | unsigned int blocksize; /* block size */ |
@@ -799,7 +799,7 @@ static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi) | |||
799 | 799 | ||
800 | /* | 800 | /* |
801 | * odd numbered checkpoint should at cp segment 0 | 801 | * odd numbered checkpoint should at cp segment 0 |
802 | * and even segent must be at cp segment 1 | 802 | * and even segment must be at cp segment 1 |
803 | */ | 803 | */ |
804 | if (!(ckpt_version & 1)) | 804 | if (!(ckpt_version & 1)) |
805 | start_addr += sbi->blocks_per_seg; | 805 | start_addr += sbi->blocks_per_seg; |
@@ -1096,6 +1096,11 @@ static inline int f2fs_readonly(struct super_block *sb) | |||
1096 | return sb->s_flags & MS_RDONLY; | 1096 | return sb->s_flags & MS_RDONLY; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) | ||
1100 | { | ||
1101 | return is_set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); | ||
1102 | } | ||
1103 | |||
1099 | static inline void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi) | 1104 | static inline void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi) |
1100 | { | 1105 | { |
1101 | set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); | 1106 | set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); |
@@ -1117,7 +1122,7 @@ static inline void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi) | |||
1117 | */ | 1122 | */ |
1118 | int f2fs_sync_file(struct file *, loff_t, loff_t, int); | 1123 | int f2fs_sync_file(struct file *, loff_t, loff_t, int); |
1119 | void truncate_data_blocks(struct dnode_of_data *); | 1124 | void truncate_data_blocks(struct dnode_of_data *); |
1120 | int truncate_blocks(struct inode *, u64); | 1125 | int truncate_blocks(struct inode *, u64, bool); |
1121 | void f2fs_truncate(struct inode *); | 1126 | void f2fs_truncate(struct inode *); |
1122 | int f2fs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 1127 | int f2fs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
1123 | int f2fs_setattr(struct dentry *, struct iattr *); | 1128 | int f2fs_setattr(struct dentry *, struct iattr *); |
@@ -1202,10 +1207,8 @@ int sync_node_pages(struct f2fs_sb_info *, nid_t, struct writeback_control *); | |||
1202 | bool alloc_nid(struct f2fs_sb_info *, nid_t *); | 1207 | bool alloc_nid(struct f2fs_sb_info *, nid_t *); |
1203 | void alloc_nid_done(struct f2fs_sb_info *, nid_t); | 1208 | void alloc_nid_done(struct f2fs_sb_info *, nid_t); |
1204 | void alloc_nid_failed(struct f2fs_sb_info *, nid_t); | 1209 | void alloc_nid_failed(struct f2fs_sb_info *, nid_t); |
1205 | void recover_node_page(struct f2fs_sb_info *, struct page *, | ||
1206 | struct f2fs_summary *, struct node_info *, block_t); | ||
1207 | void recover_inline_xattr(struct inode *, struct page *); | 1210 | void recover_inline_xattr(struct inode *, struct page *); |
1208 | bool recover_xattr_data(struct inode *, struct page *, block_t); | 1211 | void recover_xattr_data(struct inode *, struct page *, block_t); |
1209 | int recover_inode_page(struct f2fs_sb_info *, struct page *); | 1212 | int recover_inode_page(struct f2fs_sb_info *, struct page *); |
1210 | int restore_node_summary(struct f2fs_sb_info *, unsigned int, | 1213 | int restore_node_summary(struct f2fs_sb_info *, unsigned int, |
1211 | struct f2fs_summary_block *); | 1214 | struct f2fs_summary_block *); |
@@ -1238,8 +1241,6 @@ void write_data_page(struct page *, struct dnode_of_data *, block_t *, | |||
1238 | void rewrite_data_page(struct page *, block_t, struct f2fs_io_info *); | 1241 | void rewrite_data_page(struct page *, block_t, struct f2fs_io_info *); |
1239 | void recover_data_page(struct f2fs_sb_info *, struct page *, | 1242 | void recover_data_page(struct f2fs_sb_info *, struct page *, |
1240 | struct f2fs_summary *, block_t, block_t); | 1243 | struct f2fs_summary *, block_t, block_t); |
1241 | void rewrite_node_page(struct f2fs_sb_info *, struct page *, | ||
1242 | struct f2fs_summary *, block_t, block_t); | ||
1243 | void allocate_data_block(struct f2fs_sb_info *, struct page *, | 1244 | void allocate_data_block(struct f2fs_sb_info *, struct page *, |
1244 | block_t, block_t *, struct f2fs_summary *, int); | 1245 | block_t, block_t *, struct f2fs_summary *, int); |
1245 | void f2fs_wait_on_page_writeback(struct page *, enum page_type); | 1246 | void f2fs_wait_on_page_writeback(struct page *, enum page_type); |
@@ -1262,6 +1263,7 @@ int ra_meta_pages(struct f2fs_sb_info *, int, int, int); | |||
1262 | long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long); | 1263 | long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long); |
1263 | void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type); | 1264 | void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type); |
1264 | void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type); | 1265 | void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type); |
1266 | void release_dirty_inode(struct f2fs_sb_info *); | ||
1265 | bool exist_written_data(struct f2fs_sb_info *, nid_t, int); | 1267 | bool exist_written_data(struct f2fs_sb_info *, nid_t, int); |
1266 | int acquire_orphan_inode(struct f2fs_sb_info *); | 1268 | int acquire_orphan_inode(struct f2fs_sb_info *); |
1267 | void release_orphan_inode(struct f2fs_sb_info *); | 1269 | void release_orphan_inode(struct f2fs_sb_info *); |
@@ -1439,8 +1441,8 @@ extern const struct inode_operations f2fs_special_inode_operations; | |||
1439 | */ | 1441 | */ |
1440 | bool f2fs_may_inline(struct inode *); | 1442 | bool f2fs_may_inline(struct inode *); |
1441 | int f2fs_read_inline_data(struct inode *, struct page *); | 1443 | int f2fs_read_inline_data(struct inode *, struct page *); |
1442 | int f2fs_convert_inline_data(struct inode *, pgoff_t); | 1444 | int f2fs_convert_inline_data(struct inode *, pgoff_t, struct page *); |
1443 | int f2fs_write_inline_data(struct inode *, struct page *, unsigned int); | 1445 | int f2fs_write_inline_data(struct inode *, struct page *, unsigned int); |
1444 | void truncate_inline_data(struct inode *, u64); | 1446 | void truncate_inline_data(struct inode *, u64); |
1445 | int recover_inline_data(struct inode *, struct page *); | 1447 | bool recover_inline_data(struct inode *, struct page *); |
1446 | #endif | 1448 | #endif |
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 208f1a9bd569..060aee65aee8 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -41,6 +41,11 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, | |||
41 | 41 | ||
42 | sb_start_pagefault(inode->i_sb); | 42 | sb_start_pagefault(inode->i_sb); |
43 | 43 | ||
44 | /* force to convert with normal data indices */ | ||
45 | err = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, page); | ||
46 | if (err) | ||
47 | goto out; | ||
48 | |||
44 | /* block allocation */ | 49 | /* block allocation */ |
45 | f2fs_lock_op(sbi); | 50 | f2fs_lock_op(sbi); |
46 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 51 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
@@ -110,6 +115,25 @@ static int get_parent_ino(struct inode *inode, nid_t *pino) | |||
110 | return 1; | 115 | return 1; |
111 | } | 116 | } |
112 | 117 | ||
118 | static inline bool need_do_checkpoint(struct inode *inode) | ||
119 | { | ||
120 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | ||
121 | bool need_cp = false; | ||
122 | |||
123 | if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1) | ||
124 | need_cp = true; | ||
125 | else if (file_wrong_pino(inode)) | ||
126 | need_cp = true; | ||
127 | else if (!space_for_roll_forward(sbi)) | ||
128 | need_cp = true; | ||
129 | else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino)) | ||
130 | need_cp = true; | ||
131 | else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi))) | ||
132 | need_cp = true; | ||
133 | |||
134 | return need_cp; | ||
135 | } | ||
136 | |||
113 | int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | 137 | int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
114 | { | 138 | { |
115 | struct inode *inode = file->f_mapping->host; | 139 | struct inode *inode = file->f_mapping->host; |
@@ -154,23 +178,12 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
154 | /* guarantee free sections for fsync */ | 178 | /* guarantee free sections for fsync */ |
155 | f2fs_balance_fs(sbi); | 179 | f2fs_balance_fs(sbi); |
156 | 180 | ||
157 | down_read(&fi->i_sem); | ||
158 | |||
159 | /* | 181 | /* |
160 | * Both of fdatasync() and fsync() are able to be recovered from | 182 | * Both of fdatasync() and fsync() are able to be recovered from |
161 | * sudden-power-off. | 183 | * sudden-power-off. |
162 | */ | 184 | */ |
163 | if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1) | 185 | down_read(&fi->i_sem); |
164 | need_cp = true; | 186 | need_cp = need_do_checkpoint(inode); |
165 | else if (file_wrong_pino(inode)) | ||
166 | need_cp = true; | ||
167 | else if (!space_for_roll_forward(sbi)) | ||
168 | need_cp = true; | ||
169 | else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino)) | ||
170 | need_cp = true; | ||
171 | else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi))) | ||
172 | need_cp = true; | ||
173 | |||
174 | up_read(&fi->i_sem); | 187 | up_read(&fi->i_sem); |
175 | 188 | ||
176 | if (need_cp) { | 189 | if (need_cp) { |
@@ -288,7 +301,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence) | |||
288 | if (err && err != -ENOENT) { | 301 | if (err && err != -ENOENT) { |
289 | goto fail; | 302 | goto fail; |
290 | } else if (err == -ENOENT) { | 303 | } else if (err == -ENOENT) { |
291 | /* direct node is not exist */ | 304 | /* direct node does not exists */ |
292 | if (whence == SEEK_DATA) { | 305 | if (whence == SEEK_DATA) { |
293 | pgofs = PGOFS_OF_NEXT_DNODE(pgofs, | 306 | pgofs = PGOFS_OF_NEXT_DNODE(pgofs, |
294 | F2FS_I(inode)); | 307 | F2FS_I(inode)); |
@@ -417,7 +430,7 @@ out: | |||
417 | f2fs_put_page(page, 1); | 430 | f2fs_put_page(page, 1); |
418 | } | 431 | } |
419 | 432 | ||
420 | int truncate_blocks(struct inode *inode, u64 from) | 433 | int truncate_blocks(struct inode *inode, u64 from, bool lock) |
421 | { | 434 | { |
422 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 435 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
423 | unsigned int blocksize = inode->i_sb->s_blocksize; | 436 | unsigned int blocksize = inode->i_sb->s_blocksize; |
@@ -433,14 +446,16 @@ int truncate_blocks(struct inode *inode, u64 from) | |||
433 | free_from = (pgoff_t) | 446 | free_from = (pgoff_t) |
434 | ((from + blocksize - 1) >> (sbi->log_blocksize)); | 447 | ((from + blocksize - 1) >> (sbi->log_blocksize)); |
435 | 448 | ||
436 | f2fs_lock_op(sbi); | 449 | if (lock) |
450 | f2fs_lock_op(sbi); | ||
437 | 451 | ||
438 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 452 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
439 | err = get_dnode_of_data(&dn, free_from, LOOKUP_NODE); | 453 | err = get_dnode_of_data(&dn, free_from, LOOKUP_NODE); |
440 | if (err) { | 454 | if (err) { |
441 | if (err == -ENOENT) | 455 | if (err == -ENOENT) |
442 | goto free_next; | 456 | goto free_next; |
443 | f2fs_unlock_op(sbi); | 457 | if (lock) |
458 | f2fs_unlock_op(sbi); | ||
444 | trace_f2fs_truncate_blocks_exit(inode, err); | 459 | trace_f2fs_truncate_blocks_exit(inode, err); |
445 | return err; | 460 | return err; |
446 | } | 461 | } |
@@ -458,7 +473,8 @@ int truncate_blocks(struct inode *inode, u64 from) | |||
458 | f2fs_put_dnode(&dn); | 473 | f2fs_put_dnode(&dn); |
459 | free_next: | 474 | free_next: |
460 | err = truncate_inode_blocks(inode, free_from); | 475 | err = truncate_inode_blocks(inode, free_from); |
461 | f2fs_unlock_op(sbi); | 476 | if (lock) |
477 | f2fs_unlock_op(sbi); | ||
462 | done: | 478 | done: |
463 | /* lastly zero out the first data page */ | 479 | /* lastly zero out the first data page */ |
464 | truncate_partial_data_page(inode, from); | 480 | truncate_partial_data_page(inode, from); |
@@ -475,7 +491,7 @@ void f2fs_truncate(struct inode *inode) | |||
475 | 491 | ||
476 | trace_f2fs_truncate(inode); | 492 | trace_f2fs_truncate(inode); |
477 | 493 | ||
478 | if (!truncate_blocks(inode, i_size_read(inode))) { | 494 | if (!truncate_blocks(inode, i_size_read(inode), true)) { |
479 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 495 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
480 | mark_inode_dirty(inode); | 496 | mark_inode_dirty(inode); |
481 | } | 497 | } |
@@ -533,7 +549,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) | |||
533 | 549 | ||
534 | if ((attr->ia_valid & ATTR_SIZE) && | 550 | if ((attr->ia_valid & ATTR_SIZE) && |
535 | attr->ia_size != i_size_read(inode)) { | 551 | attr->ia_size != i_size_read(inode)) { |
536 | err = f2fs_convert_inline_data(inode, attr->ia_size); | 552 | err = f2fs_convert_inline_data(inode, attr->ia_size, NULL); |
537 | if (err) | 553 | if (err) |
538 | return err; | 554 | return err; |
539 | 555 | ||
@@ -622,7 +638,7 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
622 | loff_t off_start, off_end; | 638 | loff_t off_start, off_end; |
623 | int ret = 0; | 639 | int ret = 0; |
624 | 640 | ||
625 | ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1); | 641 | ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, NULL); |
626 | if (ret) | 642 | if (ret) |
627 | return ret; | 643 | return ret; |
628 | 644 | ||
@@ -678,7 +694,7 @@ static int expand_inode_data(struct inode *inode, loff_t offset, | |||
678 | if (ret) | 694 | if (ret) |
679 | return ret; | 695 | return ret; |
680 | 696 | ||
681 | ret = f2fs_convert_inline_data(inode, offset + len); | 697 | ret = f2fs_convert_inline_data(inode, offset + len, NULL); |
682 | if (ret) | 698 | if (ret) |
683 | return ret; | 699 | return ret; |
684 | 700 | ||
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index d7947d90ccc3..943a31db7cc3 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -58,7 +58,7 @@ static int gc_thread_func(void *data) | |||
58 | * 3. IO subsystem is idle by checking the # of requests in | 58 | * 3. IO subsystem is idle by checking the # of requests in |
59 | * bdev's request list. | 59 | * bdev's request list. |
60 | * | 60 | * |
61 | * Note) We have to avoid triggering GCs too much frequently. | 61 | * Note) We have to avoid triggering GCs frequently. |
62 | * Because it is possible that some segments can be | 62 | * Because it is possible that some segments can be |
63 | * invalidated soon after by user update or deletion. | 63 | * invalidated soon after by user update or deletion. |
64 | * So, I'd like to wait some time to collect dirty segments. | 64 | * So, I'd like to wait some time to collect dirty segments. |
@@ -222,7 +222,7 @@ static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno) | |||
222 | 222 | ||
223 | u = (vblocks * 100) >> sbi->log_blocks_per_seg; | 223 | u = (vblocks * 100) >> sbi->log_blocks_per_seg; |
224 | 224 | ||
225 | /* Handle if the system time is changed by user */ | 225 | /* Handle if the system time has changed by the user */ |
226 | if (mtime < sit_i->min_mtime) | 226 | if (mtime < sit_i->min_mtime) |
227 | sit_i->min_mtime = mtime; | 227 | sit_i->min_mtime = mtime; |
228 | if (mtime > sit_i->max_mtime) | 228 | if (mtime > sit_i->max_mtime) |
@@ -593,7 +593,7 @@ next_step: | |||
593 | 593 | ||
594 | if (phase == 2) { | 594 | if (phase == 2) { |
595 | inode = f2fs_iget(sb, dni.ino); | 595 | inode = f2fs_iget(sb, dni.ino); |
596 | if (IS_ERR(inode)) | 596 | if (IS_ERR(inode) || is_bad_inode(inode)) |
597 | continue; | 597 | continue; |
598 | 598 | ||
599 | start_bidx = start_bidx_of_node(nofs, F2FS_I(inode)); | 599 | start_bidx = start_bidx_of_node(nofs, F2FS_I(inode)); |
@@ -693,7 +693,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi) | |||
693 | gc_more: | 693 | gc_more: |
694 | if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE))) | 694 | if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE))) |
695 | goto stop; | 695 | goto stop; |
696 | if (unlikely(is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG))) | 696 | if (unlikely(f2fs_cp_error(sbi))) |
697 | goto stop; | 697 | goto stop; |
698 | 698 | ||
699 | if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) { | 699 | if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) { |
diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 5d5eb6047bf4..16f0b2b22999 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h | |||
@@ -91,7 +91,7 @@ static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi) | |||
91 | block_t invalid_user_blocks = sbi->user_block_count - | 91 | block_t invalid_user_blocks = sbi->user_block_count - |
92 | written_block_count(sbi); | 92 | written_block_count(sbi); |
93 | /* | 93 | /* |
94 | * Background GC is triggered with the following condition. | 94 | * Background GC is triggered with the following conditions. |
95 | * 1. There are a number of invalid blocks. | 95 | * 1. There are a number of invalid blocks. |
96 | * 2. There is not enough free space. | 96 | * 2. There is not enough free space. |
97 | */ | 97 | */ |
diff --git a/fs/f2fs/hash.c b/fs/f2fs/hash.c index 948d17bf7281..a844fcfb9a8d 100644 --- a/fs/f2fs/hash.c +++ b/fs/f2fs/hash.c | |||
@@ -42,7 +42,8 @@ static void TEA_transform(unsigned int buf[4], unsigned int const in[]) | |||
42 | buf[1] += b1; | 42 | buf[1] += b1; |
43 | } | 43 | } |
44 | 44 | ||
45 | static void str2hashbuf(const char *msg, size_t len, unsigned int *buf, int num) | 45 | static void str2hashbuf(const unsigned char *msg, size_t len, |
46 | unsigned int *buf, int num) | ||
46 | { | 47 | { |
47 | unsigned pad, val; | 48 | unsigned pad, val; |
48 | int i; | 49 | int i; |
@@ -73,9 +74,9 @@ f2fs_hash_t f2fs_dentry_hash(const struct qstr *name_info) | |||
73 | { | 74 | { |
74 | __u32 hash; | 75 | __u32 hash; |
75 | f2fs_hash_t f2fs_hash; | 76 | f2fs_hash_t f2fs_hash; |
76 | const char *p; | 77 | const unsigned char *p; |
77 | __u32 in[8], buf[4]; | 78 | __u32 in[8], buf[4]; |
78 | const char *name = name_info->name; | 79 | const unsigned char *name = name_info->name; |
79 | size_t len = name_info->len; | 80 | size_t len = name_info->len; |
80 | 81 | ||
81 | if ((len <= 2) && (name[0] == '.') && | 82 | if ((len <= 2) && (name[0] == '.') && |
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 5beeccef9ae1..3e8ecdf3742b 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c | |||
@@ -68,7 +68,7 @@ out: | |||
68 | 68 | ||
69 | static int __f2fs_convert_inline_data(struct inode *inode, struct page *page) | 69 | static int __f2fs_convert_inline_data(struct inode *inode, struct page *page) |
70 | { | 70 | { |
71 | int err; | 71 | int err = 0; |
72 | struct page *ipage; | 72 | struct page *ipage; |
73 | struct dnode_of_data dn; | 73 | struct dnode_of_data dn; |
74 | void *src_addr, *dst_addr; | 74 | void *src_addr, *dst_addr; |
@@ -86,6 +86,10 @@ static int __f2fs_convert_inline_data(struct inode *inode, struct page *page) | |||
86 | goto out; | 86 | goto out; |
87 | } | 87 | } |
88 | 88 | ||
89 | /* someone else converted inline_data already */ | ||
90 | if (!f2fs_has_inline_data(inode)) | ||
91 | goto out; | ||
92 | |||
89 | /* | 93 | /* |
90 | * i_addr[0] is not used for inline data, | 94 | * i_addr[0] is not used for inline data, |
91 | * so reserving new block will not destroy inline data | 95 | * so reserving new block will not destroy inline data |
@@ -124,9 +128,10 @@ out: | |||
124 | return err; | 128 | return err; |
125 | } | 129 | } |
126 | 130 | ||
127 | int f2fs_convert_inline_data(struct inode *inode, pgoff_t to_size) | 131 | int f2fs_convert_inline_data(struct inode *inode, pgoff_t to_size, |
132 | struct page *page) | ||
128 | { | 133 | { |
129 | struct page *page; | 134 | struct page *new_page = page; |
130 | int err; | 135 | int err; |
131 | 136 | ||
132 | if (!f2fs_has_inline_data(inode)) | 137 | if (!f2fs_has_inline_data(inode)) |
@@ -134,17 +139,20 @@ int f2fs_convert_inline_data(struct inode *inode, pgoff_t to_size) | |||
134 | else if (to_size <= MAX_INLINE_DATA) | 139 | else if (to_size <= MAX_INLINE_DATA) |
135 | return 0; | 140 | return 0; |
136 | 141 | ||
137 | page = grab_cache_page(inode->i_mapping, 0); | 142 | if (!page || page->index != 0) { |
138 | if (!page) | 143 | new_page = grab_cache_page(inode->i_mapping, 0); |
139 | return -ENOMEM; | 144 | if (!new_page) |
145 | return -ENOMEM; | ||
146 | } | ||
140 | 147 | ||
141 | err = __f2fs_convert_inline_data(inode, page); | 148 | err = __f2fs_convert_inline_data(inode, new_page); |
142 | f2fs_put_page(page, 1); | 149 | if (!page || page->index != 0) |
150 | f2fs_put_page(new_page, 1); | ||
143 | return err; | 151 | return err; |
144 | } | 152 | } |
145 | 153 | ||
146 | int f2fs_write_inline_data(struct inode *inode, | 154 | int f2fs_write_inline_data(struct inode *inode, |
147 | struct page *page, unsigned size) | 155 | struct page *page, unsigned size) |
148 | { | 156 | { |
149 | void *src_addr, *dst_addr; | 157 | void *src_addr, *dst_addr; |
150 | struct page *ipage; | 158 | struct page *ipage; |
@@ -199,7 +207,7 @@ void truncate_inline_data(struct inode *inode, u64 from) | |||
199 | f2fs_put_page(ipage, 1); | 207 | f2fs_put_page(ipage, 1); |
200 | } | 208 | } |
201 | 209 | ||
202 | int recover_inline_data(struct inode *inode, struct page *npage) | 210 | bool recover_inline_data(struct inode *inode, struct page *npage) |
203 | { | 211 | { |
204 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 212 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
205 | struct f2fs_inode *ri = NULL; | 213 | struct f2fs_inode *ri = NULL; |
@@ -218,7 +226,7 @@ int recover_inline_data(struct inode *inode, struct page *npage) | |||
218 | ri = F2FS_INODE(npage); | 226 | ri = F2FS_INODE(npage); |
219 | 227 | ||
220 | if (f2fs_has_inline_data(inode) && | 228 | if (f2fs_has_inline_data(inode) && |
221 | ri && ri->i_inline & F2FS_INLINE_DATA) { | 229 | ri && (ri->i_inline & F2FS_INLINE_DATA)) { |
222 | process_inline: | 230 | process_inline: |
223 | ipage = get_node_page(sbi, inode->i_ino); | 231 | ipage = get_node_page(sbi, inode->i_ino); |
224 | f2fs_bug_on(IS_ERR(ipage)); | 232 | f2fs_bug_on(IS_ERR(ipage)); |
@@ -230,7 +238,7 @@ process_inline: | |||
230 | memcpy(dst_addr, src_addr, MAX_INLINE_DATA); | 238 | memcpy(dst_addr, src_addr, MAX_INLINE_DATA); |
231 | update_inode(inode, ipage); | 239 | update_inode(inode, ipage); |
232 | f2fs_put_page(ipage, 1); | 240 | f2fs_put_page(ipage, 1); |
233 | return -1; | 241 | return true; |
234 | } | 242 | } |
235 | 243 | ||
236 | if (f2fs_has_inline_data(inode)) { | 244 | if (f2fs_has_inline_data(inode)) { |
@@ -242,10 +250,10 @@ process_inline: | |||
242 | clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA); | 250 | clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA); |
243 | update_inode(inode, ipage); | 251 | update_inode(inode, ipage); |
244 | f2fs_put_page(ipage, 1); | 252 | f2fs_put_page(ipage, 1); |
245 | } else if (ri && ri->i_inline & F2FS_INLINE_DATA) { | 253 | } else if (ri && (ri->i_inline & F2FS_INLINE_DATA)) { |
246 | truncate_blocks(inode, 0); | 254 | truncate_blocks(inode, 0, false); |
247 | set_inode_flag(F2FS_I(inode), FI_INLINE_DATA); | 255 | set_inode_flag(F2FS_I(inode), FI_INLINE_DATA); |
248 | goto process_inline; | 256 | goto process_inline; |
249 | } | 257 | } |
250 | return 0; | 258 | return false; |
251 | } | 259 | } |
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 27b03776ffd2..ee103fd7283c 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -134,9 +134,7 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
134 | return 0; | 134 | return 0; |
135 | out: | 135 | out: |
136 | clear_nlink(inode); | 136 | clear_nlink(inode); |
137 | unlock_new_inode(inode); | 137 | iget_failed(inode); |
138 | make_bad_inode(inode); | ||
139 | iput(inode); | ||
140 | alloc_nid_failed(sbi, ino); | 138 | alloc_nid_failed(sbi, ino); |
141 | return err; | 139 | return err; |
142 | } | 140 | } |
@@ -229,7 +227,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) | |||
229 | f2fs_delete_entry(de, page, inode); | 227 | f2fs_delete_entry(de, page, inode); |
230 | f2fs_unlock_op(sbi); | 228 | f2fs_unlock_op(sbi); |
231 | 229 | ||
232 | /* In order to evict this inode, we set it dirty */ | 230 | /* In order to evict this inode, we set it dirty */ |
233 | mark_inode_dirty(inode); | 231 | mark_inode_dirty(inode); |
234 | fail: | 232 | fail: |
235 | trace_f2fs_unlink_exit(inode, err); | 233 | trace_f2fs_unlink_exit(inode, err); |
@@ -267,9 +265,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, | |||
267 | return err; | 265 | return err; |
268 | out: | 266 | out: |
269 | clear_nlink(inode); | 267 | clear_nlink(inode); |
270 | unlock_new_inode(inode); | 268 | iget_failed(inode); |
271 | make_bad_inode(inode); | ||
272 | iput(inode); | ||
273 | alloc_nid_failed(sbi, inode->i_ino); | 269 | alloc_nid_failed(sbi, inode->i_ino); |
274 | return err; | 270 | return err; |
275 | } | 271 | } |
@@ -308,9 +304,7 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
308 | out_fail: | 304 | out_fail: |
309 | clear_inode_flag(F2FS_I(inode), FI_INC_LINK); | 305 | clear_inode_flag(F2FS_I(inode), FI_INC_LINK); |
310 | clear_nlink(inode); | 306 | clear_nlink(inode); |
311 | unlock_new_inode(inode); | 307 | iget_failed(inode); |
312 | make_bad_inode(inode); | ||
313 | iput(inode); | ||
314 | alloc_nid_failed(sbi, inode->i_ino); | 308 | alloc_nid_failed(sbi, inode->i_ino); |
315 | return err; | 309 | return err; |
316 | } | 310 | } |
@@ -354,9 +348,7 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry, | |||
354 | return 0; | 348 | return 0; |
355 | out: | 349 | out: |
356 | clear_nlink(inode); | 350 | clear_nlink(inode); |
357 | unlock_new_inode(inode); | 351 | iget_failed(inode); |
358 | make_bad_inode(inode); | ||
359 | iput(inode); | ||
360 | alloc_nid_failed(sbi, inode->i_ino); | 352 | alloc_nid_failed(sbi, inode->i_ino); |
361 | return err; | 353 | return err; |
362 | } | 354 | } |
@@ -688,9 +680,7 @@ release_out: | |||
688 | out: | 680 | out: |
689 | f2fs_unlock_op(sbi); | 681 | f2fs_unlock_op(sbi); |
690 | clear_nlink(inode); | 682 | clear_nlink(inode); |
691 | unlock_new_inode(inode); | 683 | iget_failed(inode); |
692 | make_bad_inode(inode); | ||
693 | iput(inode); | ||
694 | alloc_nid_failed(sbi, inode->i_ino); | 684 | alloc_nid_failed(sbi, inode->i_ino); |
695 | return err; | 685 | return err; |
696 | } | 686 | } |
@@ -704,7 +694,6 @@ const struct inode_operations f2fs_dir_inode_operations = { | |||
704 | .mkdir = f2fs_mkdir, | 694 | .mkdir = f2fs_mkdir, |
705 | .rmdir = f2fs_rmdir, | 695 | .rmdir = f2fs_rmdir, |
706 | .mknod = f2fs_mknod, | 696 | .mknod = f2fs_mknod, |
707 | .rename = f2fs_rename, | ||
708 | .rename2 = f2fs_rename2, | 697 | .rename2 = f2fs_rename2, |
709 | .tmpfile = f2fs_tmpfile, | 698 | .tmpfile = f2fs_tmpfile, |
710 | .getattr = f2fs_getattr, | 699 | .getattr = f2fs_getattr, |
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index d3d90d284631..45378196e19a 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -237,7 +237,7 @@ retry: | |||
237 | nat_get_blkaddr(e) != NULL_ADDR && | 237 | nat_get_blkaddr(e) != NULL_ADDR && |
238 | new_blkaddr == NEW_ADDR); | 238 | new_blkaddr == NEW_ADDR); |
239 | 239 | ||
240 | /* increament version no as node is removed */ | 240 | /* increment version no as node is removed */ |
241 | if (nat_get_blkaddr(e) != NEW_ADDR && new_blkaddr == NULL_ADDR) { | 241 | if (nat_get_blkaddr(e) != NEW_ADDR && new_blkaddr == NULL_ADDR) { |
242 | unsigned char version = nat_get_version(e); | 242 | unsigned char version = nat_get_version(e); |
243 | nat_set_version(e, inc_node_version(version)); | 243 | nat_set_version(e, inc_node_version(version)); |
@@ -274,7 +274,7 @@ int try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink) | |||
274 | } | 274 | } |
275 | 275 | ||
276 | /* | 276 | /* |
277 | * This function returns always success | 277 | * This function always returns success |
278 | */ | 278 | */ |
279 | void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni) | 279 | void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni) |
280 | { | 280 | { |
@@ -650,7 +650,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, | |||
650 | 650 | ||
651 | /* get indirect nodes in the path */ | 651 | /* get indirect nodes in the path */ |
652 | for (i = 0; i < idx + 1; i++) { | 652 | for (i = 0; i < idx + 1; i++) { |
653 | /* refernece count'll be increased */ | 653 | /* reference count'll be increased */ |
654 | pages[i] = get_node_page(sbi, nid[i]); | 654 | pages[i] = get_node_page(sbi, nid[i]); |
655 | if (IS_ERR(pages[i])) { | 655 | if (IS_ERR(pages[i])) { |
656 | err = PTR_ERR(pages[i]); | 656 | err = PTR_ERR(pages[i]); |
@@ -823,22 +823,26 @@ int truncate_xattr_node(struct inode *inode, struct page *page) | |||
823 | */ | 823 | */ |
824 | void remove_inode_page(struct inode *inode) | 824 | void remove_inode_page(struct inode *inode) |
825 | { | 825 | { |
826 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | ||
827 | struct page *page; | ||
828 | nid_t ino = inode->i_ino; | ||
829 | struct dnode_of_data dn; | 826 | struct dnode_of_data dn; |
830 | 827 | ||
831 | page = get_node_page(sbi, ino); | 828 | set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); |
832 | if (IS_ERR(page)) | 829 | if (get_dnode_of_data(&dn, 0, LOOKUP_NODE)) |
833 | return; | 830 | return; |
834 | 831 | ||
835 | if (truncate_xattr_node(inode, page)) { | 832 | if (truncate_xattr_node(inode, dn.inode_page)) { |
836 | f2fs_put_page(page, 1); | 833 | f2fs_put_dnode(&dn); |
837 | return; | 834 | return; |
838 | } | 835 | } |
839 | /* 0 is possible, after f2fs_new_inode() is failed */ | 836 | |
837 | /* remove potential inline_data blocks */ | ||
838 | if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | ||
839 | S_ISLNK(inode->i_mode)) | ||
840 | truncate_data_blocks_range(&dn, 1); | ||
841 | |||
842 | /* 0 is possible, after f2fs_new_inode() has failed */ | ||
840 | f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1); | 843 | f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1); |
841 | set_new_dnode(&dn, inode, page, page, ino); | 844 | |
845 | /* will put inode & node pages */ | ||
842 | truncate_node(&dn); | 846 | truncate_node(&dn); |
843 | } | 847 | } |
844 | 848 | ||
@@ -1129,8 +1133,11 @@ continue_unlock: | |||
1129 | set_fsync_mark(page, 0); | 1133 | set_fsync_mark(page, 0); |
1130 | set_dentry_mark(page, 0); | 1134 | set_dentry_mark(page, 0); |
1131 | } | 1135 | } |
1132 | NODE_MAPPING(sbi)->a_ops->writepage(page, wbc); | 1136 | |
1133 | wrote++; | 1137 | if (NODE_MAPPING(sbi)->a_ops->writepage(page, wbc)) |
1138 | unlock_page(page); | ||
1139 | else | ||
1140 | wrote++; | ||
1134 | 1141 | ||
1135 | if (--wbc->nr_to_write == 0) | 1142 | if (--wbc->nr_to_write == 0) |
1136 | break; | 1143 | break; |
@@ -1212,6 +1219,8 @@ static int f2fs_write_node_page(struct page *page, | |||
1212 | 1219 | ||
1213 | if (unlikely(sbi->por_doing)) | 1220 | if (unlikely(sbi->por_doing)) |
1214 | goto redirty_out; | 1221 | goto redirty_out; |
1222 | if (unlikely(f2fs_cp_error(sbi))) | ||
1223 | goto redirty_out; | ||
1215 | 1224 | ||
1216 | f2fs_wait_on_page_writeback(page, NODE); | 1225 | f2fs_wait_on_page_writeback(page, NODE); |
1217 | 1226 | ||
@@ -1540,15 +1549,6 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid) | |||
1540 | kmem_cache_free(free_nid_slab, i); | 1549 | kmem_cache_free(free_nid_slab, i); |
1541 | } | 1550 | } |
1542 | 1551 | ||
1543 | void recover_node_page(struct f2fs_sb_info *sbi, struct page *page, | ||
1544 | struct f2fs_summary *sum, struct node_info *ni, | ||
1545 | block_t new_blkaddr) | ||
1546 | { | ||
1547 | rewrite_node_page(sbi, page, sum, ni->blk_addr, new_blkaddr); | ||
1548 | set_node_addr(sbi, ni, new_blkaddr, false); | ||
1549 | clear_node_page_dirty(page); | ||
1550 | } | ||
1551 | |||
1552 | void recover_inline_xattr(struct inode *inode, struct page *page) | 1552 | void recover_inline_xattr(struct inode *inode, struct page *page) |
1553 | { | 1553 | { |
1554 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 1554 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
@@ -1557,40 +1557,33 @@ void recover_inline_xattr(struct inode *inode, struct page *page) | |||
1557 | struct page *ipage; | 1557 | struct page *ipage; |
1558 | struct f2fs_inode *ri; | 1558 | struct f2fs_inode *ri; |
1559 | 1559 | ||
1560 | if (!f2fs_has_inline_xattr(inode)) | ||
1561 | return; | ||
1562 | |||
1563 | if (!IS_INODE(page)) | ||
1564 | return; | ||
1565 | |||
1566 | ri = F2FS_INODE(page); | ||
1567 | if (!(ri->i_inline & F2FS_INLINE_XATTR)) | ||
1568 | return; | ||
1569 | |||
1570 | ipage = get_node_page(sbi, inode->i_ino); | 1560 | ipage = get_node_page(sbi, inode->i_ino); |
1571 | f2fs_bug_on(IS_ERR(ipage)); | 1561 | f2fs_bug_on(IS_ERR(ipage)); |
1572 | 1562 | ||
1563 | ri = F2FS_INODE(page); | ||
1564 | if (!(ri->i_inline & F2FS_INLINE_XATTR)) { | ||
1565 | clear_inode_flag(F2FS_I(inode), FI_INLINE_XATTR); | ||
1566 | goto update_inode; | ||
1567 | } | ||
1568 | |||
1573 | dst_addr = inline_xattr_addr(ipage); | 1569 | dst_addr = inline_xattr_addr(ipage); |
1574 | src_addr = inline_xattr_addr(page); | 1570 | src_addr = inline_xattr_addr(page); |
1575 | inline_size = inline_xattr_size(inode); | 1571 | inline_size = inline_xattr_size(inode); |
1576 | 1572 | ||
1577 | f2fs_wait_on_page_writeback(ipage, NODE); | 1573 | f2fs_wait_on_page_writeback(ipage, NODE); |
1578 | memcpy(dst_addr, src_addr, inline_size); | 1574 | memcpy(dst_addr, src_addr, inline_size); |
1579 | 1575 | update_inode: | |
1580 | update_inode(inode, ipage); | 1576 | update_inode(inode, ipage); |
1581 | f2fs_put_page(ipage, 1); | 1577 | f2fs_put_page(ipage, 1); |
1582 | } | 1578 | } |
1583 | 1579 | ||
1584 | bool recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr) | 1580 | void recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr) |
1585 | { | 1581 | { |
1586 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 1582 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
1587 | nid_t prev_xnid = F2FS_I(inode)->i_xattr_nid; | 1583 | nid_t prev_xnid = F2FS_I(inode)->i_xattr_nid; |
1588 | nid_t new_xnid = nid_of_node(page); | 1584 | nid_t new_xnid = nid_of_node(page); |
1589 | struct node_info ni; | 1585 | struct node_info ni; |
1590 | 1586 | ||
1591 | if (!f2fs_has_xattr_block(ofs_of_node(page))) | ||
1592 | return false; | ||
1593 | |||
1594 | /* 1: invalidate the previous xattr nid */ | 1587 | /* 1: invalidate the previous xattr nid */ |
1595 | if (!prev_xnid) | 1588 | if (!prev_xnid) |
1596 | goto recover_xnid; | 1589 | goto recover_xnid; |
@@ -1618,7 +1611,6 @@ recover_xnid: | |||
1618 | set_node_addr(sbi, &ni, blkaddr, false); | 1611 | set_node_addr(sbi, &ni, blkaddr, false); |
1619 | 1612 | ||
1620 | update_inode_page(inode); | 1613 | update_inode_page(inode); |
1621 | return true; | ||
1622 | } | 1614 | } |
1623 | 1615 | ||
1624 | int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) | 1616 | int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) |
@@ -1637,7 +1629,7 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) | |||
1637 | if (!ipage) | 1629 | if (!ipage) |
1638 | return -ENOMEM; | 1630 | return -ENOMEM; |
1639 | 1631 | ||
1640 | /* Should not use this inode from free nid list */ | 1632 | /* Should not use this inode from free nid list */ |
1641 | remove_free_nid(NM_I(sbi), ino); | 1633 | remove_free_nid(NM_I(sbi), ino); |
1642 | 1634 | ||
1643 | SetPageUptodate(ipage); | 1635 | SetPageUptodate(ipage); |
@@ -1651,6 +1643,7 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) | |||
1651 | dst->i_blocks = cpu_to_le64(1); | 1643 | dst->i_blocks = cpu_to_le64(1); |
1652 | dst->i_links = cpu_to_le32(1); | 1644 | dst->i_links = cpu_to_le32(1); |
1653 | dst->i_xattr_nid = 0; | 1645 | dst->i_xattr_nid = 0; |
1646 | dst->i_inline = src->i_inline & F2FS_INLINE_XATTR; | ||
1654 | 1647 | ||
1655 | new_ni = old_ni; | 1648 | new_ni = old_ni; |
1656 | new_ni.ino = ino; | 1649 | new_ni.ino = ino; |
@@ -1659,13 +1652,14 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) | |||
1659 | WARN_ON(1); | 1652 | WARN_ON(1); |
1660 | set_node_addr(sbi, &new_ni, NEW_ADDR, false); | 1653 | set_node_addr(sbi, &new_ni, NEW_ADDR, false); |
1661 | inc_valid_inode_count(sbi); | 1654 | inc_valid_inode_count(sbi); |
1655 | set_page_dirty(ipage); | ||
1662 | f2fs_put_page(ipage, 1); | 1656 | f2fs_put_page(ipage, 1); |
1663 | return 0; | 1657 | return 0; |
1664 | } | 1658 | } |
1665 | 1659 | ||
1666 | /* | 1660 | /* |
1667 | * ra_sum_pages() merge contiguous pages into one bio and submit. | 1661 | * ra_sum_pages() merge contiguous pages into one bio and submit. |
1668 | * these pre-readed pages are alloced in bd_inode's mapping tree. | 1662 | * these pre-read pages are allocated in bd_inode's mapping tree. |
1669 | */ | 1663 | */ |
1670 | static int ra_sum_pages(struct f2fs_sb_info *sbi, struct page **pages, | 1664 | static int ra_sum_pages(struct f2fs_sb_info *sbi, struct page **pages, |
1671 | int start, int nrpages) | 1665 | int start, int nrpages) |
@@ -1709,7 +1703,7 @@ int restore_node_summary(struct f2fs_sb_info *sbi, | |||
1709 | for (i = 0; !err && i < last_offset; i += nrpages, addr += nrpages) { | 1703 | for (i = 0; !err && i < last_offset; i += nrpages, addr += nrpages) { |
1710 | nrpages = min(last_offset - i, bio_blocks); | 1704 | nrpages = min(last_offset - i, bio_blocks); |
1711 | 1705 | ||
1712 | /* read ahead node pages */ | 1706 | /* readahead node pages */ |
1713 | nrpages = ra_sum_pages(sbi, pages, addr, nrpages); | 1707 | nrpages = ra_sum_pages(sbi, pages, addr, nrpages); |
1714 | if (!nrpages) | 1708 | if (!nrpages) |
1715 | return -ENOMEM; | 1709 | return -ENOMEM; |
@@ -1967,7 +1961,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi) | |||
1967 | nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks; | 1961 | nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks; |
1968 | 1962 | ||
1969 | /* not used nids: 0, node, meta, (and root counted as valid node) */ | 1963 | /* not used nids: 0, node, meta, (and root counted as valid node) */ |
1970 | nm_i->available_nids = nm_i->max_nid - 3; | 1964 | nm_i->available_nids = nm_i->max_nid - F2FS_RESERVED_NODE_NUM; |
1971 | nm_i->fcnt = 0; | 1965 | nm_i->fcnt = 0; |
1972 | nm_i->nat_cnt = 0; | 1966 | nm_i->nat_cnt = 0; |
1973 | nm_i->ram_thresh = DEF_RAM_THRESHOLD; | 1967 | nm_i->ram_thresh = DEF_RAM_THRESHOLD; |
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index fe1c6d921ba2..756c41cd2582 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c | |||
@@ -62,8 +62,10 @@ static int recover_dentry(struct page *ipage, struct inode *inode) | |||
62 | } | 62 | } |
63 | retry: | 63 | retry: |
64 | de = f2fs_find_entry(dir, &name, &page); | 64 | de = f2fs_find_entry(dir, &name, &page); |
65 | if (de && inode->i_ino == le32_to_cpu(de->ino)) | 65 | if (de && inode->i_ino == le32_to_cpu(de->ino)) { |
66 | clear_inode_flag(F2FS_I(inode), FI_INC_LINK); | ||
66 | goto out_unmap_put; | 67 | goto out_unmap_put; |
68 | } | ||
67 | if (de) { | 69 | if (de) { |
68 | einode = f2fs_iget(inode->i_sb, le32_to_cpu(de->ino)); | 70 | einode = f2fs_iget(inode->i_sb, le32_to_cpu(de->ino)); |
69 | if (IS_ERR(einode)) { | 71 | if (IS_ERR(einode)) { |
@@ -300,14 +302,19 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, | |||
300 | struct node_info ni; | 302 | struct node_info ni; |
301 | int err = 0, recovered = 0; | 303 | int err = 0, recovered = 0; |
302 | 304 | ||
303 | recover_inline_xattr(inode, page); | 305 | /* step 1: recover xattr */ |
304 | 306 | if (IS_INODE(page)) { | |
305 | if (recover_inline_data(inode, page)) | 307 | recover_inline_xattr(inode, page); |
308 | } else if (f2fs_has_xattr_block(ofs_of_node(page))) { | ||
309 | recover_xattr_data(inode, page, blkaddr); | ||
306 | goto out; | 310 | goto out; |
311 | } | ||
307 | 312 | ||
308 | if (recover_xattr_data(inode, page, blkaddr)) | 313 | /* step 2: recover inline data */ |
314 | if (recover_inline_data(inode, page)) | ||
309 | goto out; | 315 | goto out; |
310 | 316 | ||
317 | /* step 3: recover data indices */ | ||
311 | start = start_bidx_of_node(ofs_of_node(page), fi); | 318 | start = start_bidx_of_node(ofs_of_node(page), fi); |
312 | end = start + ADDRS_PER_PAGE(page, fi); | 319 | end = start + ADDRS_PER_PAGE(page, fi); |
313 | 320 | ||
@@ -364,8 +371,6 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, | |||
364 | fill_node_footer(dn.node_page, dn.nid, ni.ino, | 371 | fill_node_footer(dn.node_page, dn.nid, ni.ino, |
365 | ofs_of_node(page), false); | 372 | ofs_of_node(page), false); |
366 | set_page_dirty(dn.node_page); | 373 | set_page_dirty(dn.node_page); |
367 | |||
368 | recover_node_page(sbi, dn.node_page, &sum, &ni, blkaddr); | ||
369 | err: | 374 | err: |
370 | f2fs_put_dnode(&dn); | 375 | f2fs_put_dnode(&dn); |
371 | f2fs_unlock_op(sbi); | 376 | f2fs_unlock_op(sbi); |
@@ -452,6 +457,9 @@ int recover_fsync_data(struct f2fs_sb_info *sbi) | |||
452 | /* step #1: find fsynced inode numbers */ | 457 | /* step #1: find fsynced inode numbers */ |
453 | sbi->por_doing = true; | 458 | sbi->por_doing = true; |
454 | 459 | ||
460 | /* prevent checkpoint */ | ||
461 | mutex_lock(&sbi->cp_mutex); | ||
462 | |||
455 | blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); | 463 | blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); |
456 | 464 | ||
457 | err = find_fsync_dnodes(sbi, &inode_list); | 465 | err = find_fsync_dnodes(sbi, &inode_list); |
@@ -465,7 +473,8 @@ int recover_fsync_data(struct f2fs_sb_info *sbi) | |||
465 | 473 | ||
466 | /* step #2: recover data */ | 474 | /* step #2: recover data */ |
467 | err = recover_data(sbi, &inode_list, CURSEG_WARM_NODE); | 475 | err = recover_data(sbi, &inode_list, CURSEG_WARM_NODE); |
468 | f2fs_bug_on(!list_empty(&inode_list)); | 476 | if (!err) |
477 | f2fs_bug_on(!list_empty(&inode_list)); | ||
469 | out: | 478 | out: |
470 | destroy_fsync_dnodes(&inode_list); | 479 | destroy_fsync_dnodes(&inode_list); |
471 | kmem_cache_destroy(fsync_entry_slab); | 480 | kmem_cache_destroy(fsync_entry_slab); |
@@ -482,8 +491,13 @@ out: | |||
482 | /* Flush all the NAT/SIT pages */ | 491 | /* Flush all the NAT/SIT pages */ |
483 | while (get_pages(sbi, F2FS_DIRTY_META)) | 492 | while (get_pages(sbi, F2FS_DIRTY_META)) |
484 | sync_meta_pages(sbi, META, LONG_MAX); | 493 | sync_meta_pages(sbi, META, LONG_MAX); |
494 | set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); | ||
495 | mutex_unlock(&sbi->cp_mutex); | ||
485 | } else if (need_writecp) { | 496 | } else if (need_writecp) { |
497 | mutex_unlock(&sbi->cp_mutex); | ||
486 | write_checkpoint(sbi, false); | 498 | write_checkpoint(sbi, false); |
499 | } else { | ||
500 | mutex_unlock(&sbi->cp_mutex); | ||
487 | } | 501 | } |
488 | return err; | 502 | return err; |
489 | } | 503 | } |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 0dfeebae2a50..0aa337cd5bba 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -62,7 +62,7 @@ static inline unsigned long __reverse_ffs(unsigned long word) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * __find_rev_next(_zero)_bit is copied from lib/find_next_bit.c becasue | 65 | * __find_rev_next(_zero)_bit is copied from lib/find_next_bit.c because |
66 | * f2fs_set_bit makes MSB and LSB reversed in a byte. | 66 | * f2fs_set_bit makes MSB and LSB reversed in a byte. |
67 | * Example: | 67 | * Example: |
68 | * LSB <--> MSB | 68 | * LSB <--> MSB |
@@ -808,7 +808,7 @@ static void __refresh_next_blkoff(struct f2fs_sb_info *sbi, | |||
808 | } | 808 | } |
809 | 809 | ||
810 | /* | 810 | /* |
811 | * This function always allocates a used segment (from dirty seglist) by SSR | 811 | * This function always allocates a used segment(from dirty seglist) by SSR |
812 | * manner, so it should recover the existing segment information of valid blocks | 812 | * manner, so it should recover the existing segment information of valid blocks |
813 | */ | 813 | */ |
814 | static void change_curseg(struct f2fs_sb_info *sbi, int type, bool reuse) | 814 | static void change_curseg(struct f2fs_sb_info *sbi, int type, bool reuse) |
@@ -1103,55 +1103,6 @@ void recover_data_page(struct f2fs_sb_info *sbi, | |||
1103 | mutex_unlock(&curseg->curseg_mutex); | 1103 | mutex_unlock(&curseg->curseg_mutex); |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | void rewrite_node_page(struct f2fs_sb_info *sbi, | ||
1107 | struct page *page, struct f2fs_summary *sum, | ||
1108 | block_t old_blkaddr, block_t new_blkaddr) | ||
1109 | { | ||
1110 | struct sit_info *sit_i = SIT_I(sbi); | ||
1111 | int type = CURSEG_WARM_NODE; | ||
1112 | struct curseg_info *curseg; | ||
1113 | unsigned int segno, old_cursegno; | ||
1114 | block_t next_blkaddr = next_blkaddr_of_node(page); | ||
1115 | unsigned int next_segno = GET_SEGNO(sbi, next_blkaddr); | ||
1116 | struct f2fs_io_info fio = { | ||
1117 | .type = NODE, | ||
1118 | .rw = WRITE_SYNC, | ||
1119 | }; | ||
1120 | |||
1121 | curseg = CURSEG_I(sbi, type); | ||
1122 | |||
1123 | mutex_lock(&curseg->curseg_mutex); | ||
1124 | mutex_lock(&sit_i->sentry_lock); | ||
1125 | |||
1126 | segno = GET_SEGNO(sbi, new_blkaddr); | ||
1127 | old_cursegno = curseg->segno; | ||
1128 | |||
1129 | /* change the current segment */ | ||
1130 | if (segno != curseg->segno) { | ||
1131 | curseg->next_segno = segno; | ||
1132 | change_curseg(sbi, type, true); | ||
1133 | } | ||
1134 | curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr); | ||
1135 | __add_sum_entry(sbi, type, sum); | ||
1136 | |||
1137 | /* change the current log to the next block addr in advance */ | ||
1138 | if (next_segno != segno) { | ||
1139 | curseg->next_segno = next_segno; | ||
1140 | change_curseg(sbi, type, true); | ||
1141 | } | ||
1142 | curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, next_blkaddr); | ||
1143 | |||
1144 | /* rewrite node page */ | ||
1145 | set_page_writeback(page); | ||
1146 | f2fs_submit_page_mbio(sbi, page, new_blkaddr, &fio); | ||
1147 | f2fs_submit_merged_bio(sbi, NODE, WRITE); | ||
1148 | refresh_sit_entry(sbi, old_blkaddr, new_blkaddr); | ||
1149 | locate_dirty_segment(sbi, old_cursegno); | ||
1150 | |||
1151 | mutex_unlock(&sit_i->sentry_lock); | ||
1152 | mutex_unlock(&curseg->curseg_mutex); | ||
1153 | } | ||
1154 | |||
1155 | static inline bool is_merged_page(struct f2fs_sb_info *sbi, | 1106 | static inline bool is_merged_page(struct f2fs_sb_info *sbi, |
1156 | struct page *page, enum page_type type) | 1107 | struct page *page, enum page_type type) |
1157 | { | 1108 | { |
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 55973f7b0330..ff483257283b 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h | |||
@@ -549,7 +549,7 @@ static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) | |||
549 | } | 549 | } |
550 | 550 | ||
551 | /* | 551 | /* |
552 | * Summary block is always treated as invalid block | 552 | * Summary block is always treated as an invalid block |
553 | */ | 553 | */ |
554 | static inline void check_block_count(struct f2fs_sb_info *sbi, | 554 | static inline void check_block_count(struct f2fs_sb_info *sbi, |
555 | int segno, struct f2fs_sit_entry *raw_sit) | 555 | int segno, struct f2fs_sit_entry *raw_sit) |
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 657582fc7601..41bdf511003d 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -432,9 +432,15 @@ static void f2fs_put_super(struct super_block *sb) | |||
432 | stop_gc_thread(sbi); | 432 | stop_gc_thread(sbi); |
433 | 433 | ||
434 | /* We don't need to do checkpoint when it's clean */ | 434 | /* We don't need to do checkpoint when it's clean */ |
435 | if (sbi->s_dirty && get_pages(sbi, F2FS_DIRTY_NODES)) | 435 | if (sbi->s_dirty) |
436 | write_checkpoint(sbi, true); | 436 | write_checkpoint(sbi, true); |
437 | 437 | ||
438 | /* | ||
439 | * normally superblock is clean, so we need to release this. | ||
440 | * In addition, EIO will skip do checkpoint, we need this as well. | ||
441 | */ | ||
442 | release_dirty_inode(sbi); | ||
443 | |||
438 | iput(sbi->node_inode); | 444 | iput(sbi->node_inode); |
439 | iput(sbi->meta_inode); | 445 | iput(sbi->meta_inode); |
440 | 446 | ||
@@ -457,9 +463,6 @@ int f2fs_sync_fs(struct super_block *sb, int sync) | |||
457 | 463 | ||
458 | trace_f2fs_sync_fs(sb, sync); | 464 | trace_f2fs_sync_fs(sb, sync); |
459 | 465 | ||
460 | if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) | ||
461 | return 0; | ||
462 | |||
463 | if (sync) { | 466 | if (sync) { |
464 | mutex_lock(&sbi->gc_mutex); | 467 | mutex_lock(&sbi->gc_mutex); |
465 | write_checkpoint(sbi, false); | 468 | write_checkpoint(sbi, false); |
@@ -505,8 +508,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
505 | buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count; | 508 | buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count; |
506 | buf->f_bavail = user_block_count - valid_user_blocks(sbi); | 509 | buf->f_bavail = user_block_count - valid_user_blocks(sbi); |
507 | 510 | ||
508 | buf->f_files = sbi->total_node_count; | 511 | buf->f_files = sbi->total_node_count - F2FS_RESERVED_NODE_NUM; |
509 | buf->f_ffree = sbi->total_node_count - valid_inode_count(sbi); | 512 | buf->f_ffree = buf->f_files - valid_inode_count(sbi); |
510 | 513 | ||
511 | buf->f_namelen = F2FS_NAME_LEN; | 514 | buf->f_namelen = F2FS_NAME_LEN; |
512 | buf->f_fsid.val[0] = (u32)id; | 515 | buf->f_fsid.val[0] = (u32)id; |
@@ -663,7 +666,7 @@ restore_gc: | |||
663 | if (need_restart_gc) { | 666 | if (need_restart_gc) { |
664 | if (start_gc_thread(sbi)) | 667 | if (start_gc_thread(sbi)) |
665 | f2fs_msg(sbi->sb, KERN_WARNING, | 668 | f2fs_msg(sbi->sb, KERN_WARNING, |
666 | "background gc thread is stop"); | 669 | "background gc thread has stopped"); |
667 | } else if (need_stop_gc) { | 670 | } else if (need_stop_gc) { |
668 | stop_gc_thread(sbi); | 671 | stop_gc_thread(sbi); |
669 | } | 672 | } |
@@ -812,7 +815,7 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi) | |||
812 | if (unlikely(fsmeta >= total)) | 815 | if (unlikely(fsmeta >= total)) |
813 | return 1; | 816 | return 1; |
814 | 817 | ||
815 | if (unlikely(is_set_ckpt_flags(ckpt, CP_ERROR_FLAG))) { | 818 | if (unlikely(f2fs_cp_error(sbi))) { |
816 | f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck"); | 819 | f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck"); |
817 | return 1; | 820 | return 1; |
818 | } | 821 | } |
@@ -899,8 +902,10 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) | |||
899 | struct buffer_head *raw_super_buf; | 902 | struct buffer_head *raw_super_buf; |
900 | struct inode *root; | 903 | struct inode *root; |
901 | long err = -EINVAL; | 904 | long err = -EINVAL; |
905 | bool retry = true; | ||
902 | int i; | 906 | int i; |
903 | 907 | ||
908 | try_onemore: | ||
904 | /* allocate memory for f2fs-specific super block info */ | 909 | /* allocate memory for f2fs-specific super block info */ |
905 | sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL); | 910 | sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL); |
906 | if (!sbi) | 911 | if (!sbi) |
@@ -1080,9 +1085,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) | |||
1080 | /* recover fsynced data */ | 1085 | /* recover fsynced data */ |
1081 | if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { | 1086 | if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { |
1082 | err = recover_fsync_data(sbi); | 1087 | err = recover_fsync_data(sbi); |
1083 | if (err) | 1088 | if (err) { |
1084 | f2fs_msg(sb, KERN_ERR, | 1089 | f2fs_msg(sb, KERN_ERR, |
1085 | "Cannot recover all fsync data errno=%ld", err); | 1090 | "Cannot recover all fsync data errno=%ld", err); |
1091 | goto free_kobj; | ||
1092 | } | ||
1086 | } | 1093 | } |
1087 | 1094 | ||
1088 | /* | 1095 | /* |
@@ -1123,6 +1130,13 @@ free_sb_buf: | |||
1123 | brelse(raw_super_buf); | 1130 | brelse(raw_super_buf); |
1124 | free_sbi: | 1131 | free_sbi: |
1125 | kfree(sbi); | 1132 | kfree(sbi); |
1133 | |||
1134 | /* give only one another chance */ | ||
1135 | if (retry) { | ||
1136 | retry = 0; | ||
1137 | shrink_dcache_sb(sb); | ||
1138 | goto try_onemore; | ||
1139 | } | ||
1126 | return err; | 1140 | return err; |
1127 | } | 1141 | } |
1128 | 1142 | ||
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 8bea941ee309..728a5dc3dc16 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c | |||
@@ -528,7 +528,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, | |||
528 | int free; | 528 | int free; |
529 | /* | 529 | /* |
530 | * If value is NULL, it is remove operation. | 530 | * If value is NULL, it is remove operation. |
531 | * In case of update operation, we caculate free. | 531 | * In case of update operation, we calculate free. |
532 | */ | 532 | */ |
533 | free = MIN_OFFSET(inode) - ((char *)last - (char *)base_addr); | 533 | free = MIN_OFFSET(inode) - ((char *)last - (char *)base_addr); |
534 | if (found) | 534 | if (found) |
diff --git a/fs/fscache/object.c b/fs/fscache/object.c index d3b4539f1651..da032daf0e0d 100644 --- a/fs/fscache/object.c +++ b/fs/fscache/object.c | |||
@@ -982,6 +982,7 @@ nomem: | |||
982 | submit_op_failed: | 982 | submit_op_failed: |
983 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); | 983 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); |
984 | spin_unlock(&cookie->lock); | 984 | spin_unlock(&cookie->lock); |
985 | fscache_unuse_cookie(object); | ||
985 | kfree(op); | 986 | kfree(op); |
986 | _leave(" [EIO]"); | 987 | _leave(" [EIO]"); |
987 | return transit_to(KILL_OBJECT); | 988 | return transit_to(KILL_OBJECT); |
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index 85332b9d19d1..de33b3fccca6 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
@@ -44,6 +44,19 @@ void __fscache_wait_on_page_write(struct fscache_cookie *cookie, struct page *pa | |||
44 | EXPORT_SYMBOL(__fscache_wait_on_page_write); | 44 | EXPORT_SYMBOL(__fscache_wait_on_page_write); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * wait for a page to finish being written to the cache. Put a timeout here | ||
48 | * since we might be called recursively via parent fs. | ||
49 | */ | ||
50 | static | ||
51 | bool release_page_wait_timeout(struct fscache_cookie *cookie, struct page *page) | ||
52 | { | ||
53 | wait_queue_head_t *wq = bit_waitqueue(&cookie->flags, 0); | ||
54 | |||
55 | return wait_event_timeout(*wq, !__fscache_check_page_write(cookie, page), | ||
56 | HZ); | ||
57 | } | ||
58 | |||
59 | /* | ||
47 | * decide whether a page can be released, possibly by cancelling a store to it | 60 | * decide whether a page can be released, possibly by cancelling a store to it |
48 | * - we're allowed to sleep if __GFP_WAIT is flagged | 61 | * - we're allowed to sleep if __GFP_WAIT is flagged |
49 | */ | 62 | */ |
@@ -115,7 +128,10 @@ page_busy: | |||
115 | } | 128 | } |
116 | 129 | ||
117 | fscache_stat(&fscache_n_store_vmscan_wait); | 130 | fscache_stat(&fscache_n_store_vmscan_wait); |
118 | __fscache_wait_on_page_write(cookie, page); | 131 | if (!release_page_wait_timeout(cookie, page)) |
132 | _debug("fscache writeout timeout page: %p{%lx}", | ||
133 | page, page->index); | ||
134 | |||
119 | gfp &= ~__GFP_WAIT; | 135 | gfp &= ~__GFP_WAIT; |
120 | goto try_again; | 136 | goto try_again; |
121 | } | 137 | } |
@@ -182,7 +198,7 @@ int __fscache_attr_changed(struct fscache_cookie *cookie) | |||
182 | { | 198 | { |
183 | struct fscache_operation *op; | 199 | struct fscache_operation *op; |
184 | struct fscache_object *object; | 200 | struct fscache_object *object; |
185 | bool wake_cookie; | 201 | bool wake_cookie = false; |
186 | 202 | ||
187 | _enter("%p", cookie); | 203 | _enter("%p", cookie); |
188 | 204 | ||
@@ -212,15 +228,16 @@ int __fscache_attr_changed(struct fscache_cookie *cookie) | |||
212 | 228 | ||
213 | __fscache_use_cookie(cookie); | 229 | __fscache_use_cookie(cookie); |
214 | if (fscache_submit_exclusive_op(object, op) < 0) | 230 | if (fscache_submit_exclusive_op(object, op) < 0) |
215 | goto nobufs; | 231 | goto nobufs_dec; |
216 | spin_unlock(&cookie->lock); | 232 | spin_unlock(&cookie->lock); |
217 | fscache_stat(&fscache_n_attr_changed_ok); | 233 | fscache_stat(&fscache_n_attr_changed_ok); |
218 | fscache_put_operation(op); | 234 | fscache_put_operation(op); |
219 | _leave(" = 0"); | 235 | _leave(" = 0"); |
220 | return 0; | 236 | return 0; |
221 | 237 | ||
222 | nobufs: | 238 | nobufs_dec: |
223 | wake_cookie = __fscache_unuse_cookie(cookie); | 239 | wake_cookie = __fscache_unuse_cookie(cookie); |
240 | nobufs: | ||
224 | spin_unlock(&cookie->lock); | 241 | spin_unlock(&cookie->lock); |
225 | kfree(op); | 242 | kfree(op); |
226 | if (wake_cookie) | 243 | if (wake_cookie) |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 912061ac4baf..caa8d95b24e8 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -1305,6 +1305,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii, | |||
1305 | size_t start; | 1305 | size_t start; |
1306 | ssize_t ret = iov_iter_get_pages(ii, | 1306 | ssize_t ret = iov_iter_get_pages(ii, |
1307 | &req->pages[req->num_pages], | 1307 | &req->pages[req->num_pages], |
1308 | *nbytesp - nbytes, | ||
1308 | req->max_pages - req->num_pages, | 1309 | req->max_pages - req->num_pages, |
1309 | &start); | 1310 | &start); |
1310 | if (ret < 0) | 1311 | if (ret < 0) |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index e6ee5b6e8d99..f0b945ab853e 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -359,7 +359,7 @@ static inline void release_metapath(struct metapath *mp) | |||
359 | * Returns: The length of the extent (minimum of one block) | 359 | * Returns: The length of the extent (minimum of one block) |
360 | */ | 360 | */ |
361 | 361 | ||
362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob) | 362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, size_t limit, int *eob) |
363 | { | 363 | { |
364 | const __be64 *end = (start + len); | 364 | const __be64 *end = (start + len); |
365 | const __be64 *first = ptr; | 365 | const __be64 *first = ptr; |
@@ -449,7 +449,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
449 | struct buffer_head *bh_map, struct metapath *mp, | 449 | struct buffer_head *bh_map, struct metapath *mp, |
450 | const unsigned int sheight, | 450 | const unsigned int sheight, |
451 | const unsigned int height, | 451 | const unsigned int height, |
452 | const unsigned int maxlen) | 452 | const size_t maxlen) |
453 | { | 453 | { |
454 | struct gfs2_inode *ip = GFS2_I(inode); | 454 | struct gfs2_inode *ip = GFS2_I(inode); |
455 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 455 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -483,7 +483,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
483 | } else { | 483 | } else { |
484 | /* Need to allocate indirect blocks */ | 484 | /* Need to allocate indirect blocks */ |
485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; | 485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; |
486 | dblks = min(maxlen, ptrs_per_blk - mp->mp_list[end_of_metadata]); | 486 | dblks = min(maxlen, (size_t)(ptrs_per_blk - |
487 | mp->mp_list[end_of_metadata])); | ||
487 | if (height == ip->i_height) { | 488 | if (height == ip->i_height) { |
488 | /* Writing into existing tree, extend tree down */ | 489 | /* Writing into existing tree, extend tree down */ |
489 | iblks = height - sheight; | 490 | iblks = height - sheight; |
@@ -605,7 +606,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, | |||
605 | struct gfs2_inode *ip = GFS2_I(inode); | 606 | struct gfs2_inode *ip = GFS2_I(inode); |
606 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 607 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
607 | unsigned int bsize = sdp->sd_sb.sb_bsize; | 608 | unsigned int bsize = sdp->sd_sb.sb_bsize; |
608 | const unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; | 609 | const size_t maxlen = bh_map->b_size >> inode->i_blkbits; |
609 | const u64 *arr = sdp->sd_heightsize; | 610 | const u64 *arr = sdp->sd_heightsize; |
610 | __be64 *ptr; | 611 | __be64 *ptr; |
611 | u64 size; | 612 | u64 size; |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 26b3f952e6b1..7f4ed3daa38c 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/dlm.h> | 26 | #include <linux/dlm.h> |
27 | #include <linux/dlm_plock.h> | 27 | #include <linux/dlm_plock.h> |
28 | #include <linux/aio.h> | 28 | #include <linux/aio.h> |
29 | #include <linux/delay.h> | ||
29 | 30 | ||
30 | #include "gfs2.h" | 31 | #include "gfs2.h" |
31 | #include "incore.h" | 32 | #include "incore.h" |
@@ -979,9 +980,10 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
979 | unsigned int state; | 980 | unsigned int state; |
980 | int flags; | 981 | int flags; |
981 | int error = 0; | 982 | int error = 0; |
983 | int sleeptime; | ||
982 | 984 | ||
983 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; | 985 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; |
984 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT; | 986 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY_1CB) | GL_EXACT; |
985 | 987 | ||
986 | mutex_lock(&fp->f_fl_mutex); | 988 | mutex_lock(&fp->f_fl_mutex); |
987 | 989 | ||
@@ -1001,7 +1003,14 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
1001 | gfs2_holder_init(gl, state, flags, fl_gh); | 1003 | gfs2_holder_init(gl, state, flags, fl_gh); |
1002 | gfs2_glock_put(gl); | 1004 | gfs2_glock_put(gl); |
1003 | } | 1005 | } |
1004 | error = gfs2_glock_nq(fl_gh); | 1006 | for (sleeptime = 1; sleeptime <= 4; sleeptime <<= 1) { |
1007 | error = gfs2_glock_nq(fl_gh); | ||
1008 | if (error != GLR_TRYFAILED) | ||
1009 | break; | ||
1010 | fl_gh->gh_flags = LM_FLAG_TRY | GL_EXACT; | ||
1011 | fl_gh->gh_error = 0; | ||
1012 | msleep(sleeptime); | ||
1013 | } | ||
1005 | if (error) { | 1014 | if (error) { |
1006 | gfs2_holder_uninit(fl_gh); | 1015 | gfs2_holder_uninit(fl_gh); |
1007 | if (error == GLR_TRYFAILED) | 1016 | if (error == GLR_TRYFAILED) |
@@ -1024,7 +1033,7 @@ static void do_unflock(struct file *file, struct file_lock *fl) | |||
1024 | mutex_lock(&fp->f_fl_mutex); | 1033 | mutex_lock(&fp->f_fl_mutex); |
1025 | flock_lock_file_wait(file, fl); | 1034 | flock_lock_file_wait(file, fl); |
1026 | if (fl_gh->gh_gl) { | 1035 | if (fl_gh->gh_gl) { |
1027 | gfs2_glock_dq_wait(fl_gh); | 1036 | gfs2_glock_dq(fl_gh); |
1028 | gfs2_holder_uninit(fl_gh); | 1037 | gfs2_holder_uninit(fl_gh); |
1029 | } | 1038 | } |
1030 | mutex_unlock(&fp->f_fl_mutex); | 1039 | mutex_unlock(&fp->f_fl_mutex); |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 67d310c9ada3..39e7e9959b74 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -262,6 +262,9 @@ struct gfs2_holder { | |||
262 | unsigned long gh_ip; | 262 | unsigned long gh_ip; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | /* Number of quota types we support */ | ||
266 | #define GFS2_MAXQUOTAS 2 | ||
267 | |||
265 | /* Resource group multi-block reservation, in order of appearance: | 268 | /* Resource group multi-block reservation, in order of appearance: |
266 | 269 | ||
267 | Step 1. Function prepares to write, allocates a mb, sets the size hint. | 270 | Step 1. Function prepares to write, allocates a mb, sets the size hint. |
@@ -282,8 +285,8 @@ struct gfs2_blkreserv { | |||
282 | u64 rs_inum; /* Inode number for reservation */ | 285 | u64 rs_inum; /* Inode number for reservation */ |
283 | 286 | ||
284 | /* ancillary quota stuff */ | 287 | /* ancillary quota stuff */ |
285 | struct gfs2_quota_data *rs_qa_qd[2 * MAXQUOTAS]; | 288 | struct gfs2_quota_data *rs_qa_qd[2 * GFS2_MAXQUOTAS]; |
286 | struct gfs2_holder rs_qa_qd_ghs[2 * MAXQUOTAS]; | 289 | struct gfs2_holder rs_qa_qd_ghs[2 * GFS2_MAXQUOTAS]; |
287 | unsigned int rs_qa_qd_num; | 290 | unsigned int rs_qa_qd_num; |
288 | }; | 291 | }; |
289 | 292 | ||
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index e62e59477884..fc8ac2ee0667 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -626,8 +626,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
626 | if (!IS_ERR(inode)) { | 626 | if (!IS_ERR(inode)) { |
627 | d = d_splice_alias(inode, dentry); | 627 | d = d_splice_alias(inode, dentry); |
628 | error = PTR_ERR(d); | 628 | error = PTR_ERR(d); |
629 | if (IS_ERR(d)) | 629 | if (IS_ERR(d)) { |
630 | inode = ERR_CAST(d); | ||
630 | goto fail_gunlock; | 631 | goto fail_gunlock; |
632 | } | ||
631 | error = 0; | 633 | error = 0; |
632 | if (file) { | 634 | if (file) { |
633 | if (S_ISREG(inode->i_mode)) { | 635 | if (S_ISREG(inode->i_mode)) { |
@@ -840,8 +842,10 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
840 | int error; | 842 | int error; |
841 | 843 | ||
842 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); | 844 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); |
843 | if (!inode) | 845 | if (inode == NULL) { |
846 | d_add(dentry, NULL); | ||
844 | return NULL; | 847 | return NULL; |
848 | } | ||
845 | if (IS_ERR(inode)) | 849 | if (IS_ERR(inode)) |
846 | return ERR_CAST(inode); | 850 | return ERR_CAST(inode); |
847 | 851 | ||
@@ -854,7 +858,6 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
854 | 858 | ||
855 | d = d_splice_alias(inode, dentry); | 859 | d = d_splice_alias(inode, dentry); |
856 | if (IS_ERR(d)) { | 860 | if (IS_ERR(d)) { |
857 | iput(inode); | ||
858 | gfs2_glock_dq_uninit(&gh); | 861 | gfs2_glock_dq_uninit(&gh); |
859 | return d; | 862 | return d; |
860 | } | 863 | } |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 2607ff13d486..a346f56c4c6d 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1294,7 +1294,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1294 | int val; | 1294 | int val; |
1295 | 1295 | ||
1296 | if (is_ancestor(root, sdp->sd_master_dir)) | 1296 | if (is_ancestor(root, sdp->sd_master_dir)) |
1297 | seq_printf(s, ",meta"); | 1297 | seq_puts(s, ",meta"); |
1298 | if (args->ar_lockproto[0]) | 1298 | if (args->ar_lockproto[0]) |
1299 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); | 1299 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); |
1300 | if (args->ar_locktable[0]) | 1300 | if (args->ar_locktable[0]) |
@@ -1302,13 +1302,13 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1302 | if (args->ar_hostdata[0]) | 1302 | if (args->ar_hostdata[0]) |
1303 | seq_printf(s, ",hostdata=%s", args->ar_hostdata); | 1303 | seq_printf(s, ",hostdata=%s", args->ar_hostdata); |
1304 | if (args->ar_spectator) | 1304 | if (args->ar_spectator) |
1305 | seq_printf(s, ",spectator"); | 1305 | seq_puts(s, ",spectator"); |
1306 | if (args->ar_localflocks) | 1306 | if (args->ar_localflocks) |
1307 | seq_printf(s, ",localflocks"); | 1307 | seq_puts(s, ",localflocks"); |
1308 | if (args->ar_debug) | 1308 | if (args->ar_debug) |
1309 | seq_printf(s, ",debug"); | 1309 | seq_puts(s, ",debug"); |
1310 | if (args->ar_posix_acl) | 1310 | if (args->ar_posix_acl) |
1311 | seq_printf(s, ",acl"); | 1311 | seq_puts(s, ",acl"); |
1312 | if (args->ar_quota != GFS2_QUOTA_DEFAULT) { | 1312 | if (args->ar_quota != GFS2_QUOTA_DEFAULT) { |
1313 | char *state; | 1313 | char *state; |
1314 | switch (args->ar_quota) { | 1314 | switch (args->ar_quota) { |
@@ -1328,7 +1328,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1328 | seq_printf(s, ",quota=%s", state); | 1328 | seq_printf(s, ",quota=%s", state); |
1329 | } | 1329 | } |
1330 | if (args->ar_suiddir) | 1330 | if (args->ar_suiddir) |
1331 | seq_printf(s, ",suiddir"); | 1331 | seq_puts(s, ",suiddir"); |
1332 | if (args->ar_data != GFS2_DATA_DEFAULT) { | 1332 | if (args->ar_data != GFS2_DATA_DEFAULT) { |
1333 | char *state; | 1333 | char *state; |
1334 | switch (args->ar_data) { | 1334 | switch (args->ar_data) { |
@@ -1345,7 +1345,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1345 | seq_printf(s, ",data=%s", state); | 1345 | seq_printf(s, ",data=%s", state); |
1346 | } | 1346 | } |
1347 | if (args->ar_discard) | 1347 | if (args->ar_discard) |
1348 | seq_printf(s, ",discard"); | 1348 | seq_puts(s, ",discard"); |
1349 | val = sdp->sd_tune.gt_logd_secs; | 1349 | val = sdp->sd_tune.gt_logd_secs; |
1350 | if (val != 30) | 1350 | if (val != 30) |
1351 | seq_printf(s, ",commit=%d", val); | 1351 | seq_printf(s, ",commit=%d", val); |
@@ -1376,11 +1376,11 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1376 | seq_printf(s, ",errors=%s", state); | 1376 | seq_printf(s, ",errors=%s", state); |
1377 | } | 1377 | } |
1378 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) | 1378 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) |
1379 | seq_printf(s, ",nobarrier"); | 1379 | seq_puts(s, ",nobarrier"); |
1380 | if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) | 1380 | if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) |
1381 | seq_printf(s, ",demote_interface_used"); | 1381 | seq_puts(s, ",demote_interface_used"); |
1382 | if (args->ar_rgrplvb) | 1382 | if (args->ar_rgrplvb) |
1383 | seq_printf(s, ",rgrplvb"); | 1383 | seq_puts(s, ",rgrplvb"); |
1384 | return 0; | 1384 | return 0; |
1385 | } | 1385 | } |
1386 | 1386 | ||
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 4556ce1af5b0..5ddaf8625d3b 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -61,7 +61,7 @@ static void isofs_put_super(struct super_block *sb) | |||
61 | return; | 61 | return; |
62 | } | 62 | } |
63 | 63 | ||
64 | static int isofs_read_inode(struct inode *); | 64 | static int isofs_read_inode(struct inode *, int relocated); |
65 | static int isofs_statfs (struct dentry *, struct kstatfs *); | 65 | static int isofs_statfs (struct dentry *, struct kstatfs *); |
66 | 66 | ||
67 | static struct kmem_cache *isofs_inode_cachep; | 67 | static struct kmem_cache *isofs_inode_cachep; |
@@ -1259,7 +1259,7 @@ out_toomany: | |||
1259 | goto out; | 1259 | goto out; |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | static int isofs_read_inode(struct inode *inode) | 1262 | static int isofs_read_inode(struct inode *inode, int relocated) |
1263 | { | 1263 | { |
1264 | struct super_block *sb = inode->i_sb; | 1264 | struct super_block *sb = inode->i_sb; |
1265 | struct isofs_sb_info *sbi = ISOFS_SB(sb); | 1265 | struct isofs_sb_info *sbi = ISOFS_SB(sb); |
@@ -1404,7 +1404,7 @@ static int isofs_read_inode(struct inode *inode) | |||
1404 | */ | 1404 | */ |
1405 | 1405 | ||
1406 | if (!high_sierra) { | 1406 | if (!high_sierra) { |
1407 | parse_rock_ridge_inode(de, inode); | 1407 | parse_rock_ridge_inode(de, inode, relocated); |
1408 | /* if we want uid/gid set, override the rock ridge setting */ | 1408 | /* if we want uid/gid set, override the rock ridge setting */ |
1409 | if (sbi->s_uid_set) | 1409 | if (sbi->s_uid_set) |
1410 | inode->i_uid = sbi->s_uid; | 1410 | inode->i_uid = sbi->s_uid; |
@@ -1483,9 +1483,10 @@ static int isofs_iget5_set(struct inode *ino, void *data) | |||
1483 | * offset that point to the underlying meta-data for the inode. The | 1483 | * offset that point to the underlying meta-data for the inode. The |
1484 | * code below is otherwise similar to the iget() code in | 1484 | * code below is otherwise similar to the iget() code in |
1485 | * include/linux/fs.h */ | 1485 | * include/linux/fs.h */ |
1486 | struct inode *isofs_iget(struct super_block *sb, | 1486 | struct inode *__isofs_iget(struct super_block *sb, |
1487 | unsigned long block, | 1487 | unsigned long block, |
1488 | unsigned long offset) | 1488 | unsigned long offset, |
1489 | int relocated) | ||
1489 | { | 1490 | { |
1490 | unsigned long hashval; | 1491 | unsigned long hashval; |
1491 | struct inode *inode; | 1492 | struct inode *inode; |
@@ -1507,7 +1508,7 @@ struct inode *isofs_iget(struct super_block *sb, | |||
1507 | return ERR_PTR(-ENOMEM); | 1508 | return ERR_PTR(-ENOMEM); |
1508 | 1509 | ||
1509 | if (inode->i_state & I_NEW) { | 1510 | if (inode->i_state & I_NEW) { |
1510 | ret = isofs_read_inode(inode); | 1511 | ret = isofs_read_inode(inode, relocated); |
1511 | if (ret < 0) { | 1512 | if (ret < 0) { |
1512 | iget_failed(inode); | 1513 | iget_failed(inode); |
1513 | inode = ERR_PTR(ret); | 1514 | inode = ERR_PTR(ret); |
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index 99167238518d..0ac4c1f73fbd 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h | |||
@@ -107,7 +107,7 @@ extern int iso_date(char *, int); | |||
107 | 107 | ||
108 | struct inode; /* To make gcc happy */ | 108 | struct inode; /* To make gcc happy */ |
109 | 109 | ||
110 | extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *); | 110 | extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *, int relocated); |
111 | extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *); | 111 | extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *); |
112 | extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *); | 112 | extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *); |
113 | 113 | ||
@@ -118,9 +118,24 @@ extern struct dentry *isofs_lookup(struct inode *, struct dentry *, unsigned int | |||
118 | extern struct buffer_head *isofs_bread(struct inode *, sector_t); | 118 | extern struct buffer_head *isofs_bread(struct inode *, sector_t); |
119 | extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long); | 119 | extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long); |
120 | 120 | ||
121 | extern struct inode *isofs_iget(struct super_block *sb, | 121 | struct inode *__isofs_iget(struct super_block *sb, |
122 | unsigned long block, | 122 | unsigned long block, |
123 | unsigned long offset); | 123 | unsigned long offset, |
124 | int relocated); | ||
125 | |||
126 | static inline struct inode *isofs_iget(struct super_block *sb, | ||
127 | unsigned long block, | ||
128 | unsigned long offset) | ||
129 | { | ||
130 | return __isofs_iget(sb, block, offset, 0); | ||
131 | } | ||
132 | |||
133 | static inline struct inode *isofs_iget_reloc(struct super_block *sb, | ||
134 | unsigned long block, | ||
135 | unsigned long offset) | ||
136 | { | ||
137 | return __isofs_iget(sb, block, offset, 1); | ||
138 | } | ||
124 | 139 | ||
125 | /* Because the inode number is no longer relevant to finding the | 140 | /* Because the inode number is no longer relevant to finding the |
126 | * underlying meta-data for an inode, we are free to choose a more | 141 | * underlying meta-data for an inode, we are free to choose a more |
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index c0bf42472e40..f488bbae541a 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c | |||
@@ -288,12 +288,16 @@ eio: | |||
288 | goto out; | 288 | goto out; |
289 | } | 289 | } |
290 | 290 | ||
291 | #define RR_REGARD_XA 1 | ||
292 | #define RR_RELOC_DE 2 | ||
293 | |||
291 | static int | 294 | static int |
292 | parse_rock_ridge_inode_internal(struct iso_directory_record *de, | 295 | parse_rock_ridge_inode_internal(struct iso_directory_record *de, |
293 | struct inode *inode, int regard_xa) | 296 | struct inode *inode, int flags) |
294 | { | 297 | { |
295 | int symlink_len = 0; | 298 | int symlink_len = 0; |
296 | int cnt, sig; | 299 | int cnt, sig; |
300 | unsigned int reloc_block; | ||
297 | struct inode *reloc; | 301 | struct inode *reloc; |
298 | struct rock_ridge *rr; | 302 | struct rock_ridge *rr; |
299 | int rootflag; | 303 | int rootflag; |
@@ -305,7 +309,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, | |||
305 | 309 | ||
306 | init_rock_state(&rs, inode); | 310 | init_rock_state(&rs, inode); |
307 | setup_rock_ridge(de, inode, &rs); | 311 | setup_rock_ridge(de, inode, &rs); |
308 | if (regard_xa) { | 312 | if (flags & RR_REGARD_XA) { |
309 | rs.chr += 14; | 313 | rs.chr += 14; |
310 | rs.len -= 14; | 314 | rs.len -= 14; |
311 | if (rs.len < 0) | 315 | if (rs.len < 0) |
@@ -485,12 +489,22 @@ repeat: | |||
485 | "relocated directory\n"); | 489 | "relocated directory\n"); |
486 | goto out; | 490 | goto out; |
487 | case SIG('C', 'L'): | 491 | case SIG('C', 'L'): |
488 | ISOFS_I(inode)->i_first_extent = | 492 | if (flags & RR_RELOC_DE) { |
489 | isonum_733(rr->u.CL.location); | 493 | printk(KERN_ERR |
490 | reloc = | 494 | "ISOFS: Recursive directory relocation " |
491 | isofs_iget(inode->i_sb, | 495 | "is not supported\n"); |
492 | ISOFS_I(inode)->i_first_extent, | 496 | goto eio; |
493 | 0); | 497 | } |
498 | reloc_block = isonum_733(rr->u.CL.location); | ||
499 | if (reloc_block == ISOFS_I(inode)->i_iget5_block && | ||
500 | ISOFS_I(inode)->i_iget5_offset == 0) { | ||
501 | printk(KERN_ERR | ||
502 | "ISOFS: Directory relocation points to " | ||
503 | "itself\n"); | ||
504 | goto eio; | ||
505 | } | ||
506 | ISOFS_I(inode)->i_first_extent = reloc_block; | ||
507 | reloc = isofs_iget_reloc(inode->i_sb, reloc_block, 0); | ||
494 | if (IS_ERR(reloc)) { | 508 | if (IS_ERR(reloc)) { |
495 | ret = PTR_ERR(reloc); | 509 | ret = PTR_ERR(reloc); |
496 | goto out; | 510 | goto out; |
@@ -637,9 +651,11 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) | |||
637 | return rpnt; | 651 | return rpnt; |
638 | } | 652 | } |
639 | 653 | ||
640 | int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode) | 654 | int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode, |
655 | int relocated) | ||
641 | { | 656 | { |
642 | int result = parse_rock_ridge_inode_internal(de, inode, 0); | 657 | int flags = relocated ? RR_RELOC_DE : 0; |
658 | int result = parse_rock_ridge_inode_internal(de, inode, flags); | ||
643 | 659 | ||
644 | /* | 660 | /* |
645 | * if rockridge flag was reset and we didn't look for attributes | 661 | * if rockridge flag was reset and we didn't look for attributes |
@@ -647,7 +663,8 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode) | |||
647 | */ | 663 | */ |
648 | if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1) | 664 | if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1) |
649 | && (ISOFS_SB(inode->i_sb)->s_rock == 2)) { | 665 | && (ISOFS_SB(inode->i_sb)->s_rock == 2)) { |
650 | result = parse_rock_ridge_inode_internal(de, inode, 14); | 666 | result = parse_rock_ridge_inode_internal(de, inode, |
667 | flags | RR_REGARD_XA); | ||
651 | } | 668 | } |
652 | return result; | 669 | return result; |
653 | } | 670 | } |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 6fac74349856..b73e0215baa7 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -97,7 +97,7 @@ static void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh) | |||
97 | struct commit_header *h; | 97 | struct commit_header *h; |
98 | __u32 csum; | 98 | __u32 csum; |
99 | 99 | ||
100 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 100 | if (!jbd2_journal_has_csum_v2or3(j)) |
101 | return; | 101 | return; |
102 | 102 | ||
103 | h = (struct commit_header *)(bh->b_data); | 103 | h = (struct commit_header *)(bh->b_data); |
@@ -313,11 +313,11 @@ static __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh) | |||
313 | return checksum; | 313 | return checksum; |
314 | } | 314 | } |
315 | 315 | ||
316 | static void write_tag_block(int tag_bytes, journal_block_tag_t *tag, | 316 | static void write_tag_block(journal_t *j, journal_block_tag_t *tag, |
317 | unsigned long long block) | 317 | unsigned long long block) |
318 | { | 318 | { |
319 | tag->t_blocknr = cpu_to_be32(block & (u32)~0); | 319 | tag->t_blocknr = cpu_to_be32(block & (u32)~0); |
320 | if (tag_bytes > JBD2_TAG_SIZE32) | 320 | if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_64BIT)) |
321 | tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1); | 321 | tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1); |
322 | } | 322 | } |
323 | 323 | ||
@@ -327,7 +327,7 @@ static void jbd2_descr_block_csum_set(journal_t *j, | |||
327 | struct jbd2_journal_block_tail *tail; | 327 | struct jbd2_journal_block_tail *tail; |
328 | __u32 csum; | 328 | __u32 csum; |
329 | 329 | ||
330 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 330 | if (!jbd2_journal_has_csum_v2or3(j)) |
331 | return; | 331 | return; |
332 | 332 | ||
333 | tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize - | 333 | tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize - |
@@ -340,12 +340,13 @@ static void jbd2_descr_block_csum_set(journal_t *j, | |||
340 | static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, | 340 | static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, |
341 | struct buffer_head *bh, __u32 sequence) | 341 | struct buffer_head *bh, __u32 sequence) |
342 | { | 342 | { |
343 | journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag; | ||
343 | struct page *page = bh->b_page; | 344 | struct page *page = bh->b_page; |
344 | __u8 *addr; | 345 | __u8 *addr; |
345 | __u32 csum32; | 346 | __u32 csum32; |
346 | __be32 seq; | 347 | __be32 seq; |
347 | 348 | ||
348 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 349 | if (!jbd2_journal_has_csum_v2or3(j)) |
349 | return; | 350 | return; |
350 | 351 | ||
351 | seq = cpu_to_be32(sequence); | 352 | seq = cpu_to_be32(sequence); |
@@ -355,8 +356,10 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, | |||
355 | bh->b_size); | 356 | bh->b_size); |
356 | kunmap_atomic(addr); | 357 | kunmap_atomic(addr); |
357 | 358 | ||
358 | /* We only have space to store the lower 16 bits of the crc32c. */ | 359 | if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3)) |
359 | tag->t_checksum = cpu_to_be16(csum32); | 360 | tag3->t_checksum = cpu_to_be32(csum32); |
361 | else | ||
362 | tag->t_checksum = cpu_to_be16(csum32); | ||
360 | } | 363 | } |
361 | /* | 364 | /* |
362 | * jbd2_journal_commit_transaction | 365 | * jbd2_journal_commit_transaction |
@@ -396,7 +399,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
396 | LIST_HEAD(io_bufs); | 399 | LIST_HEAD(io_bufs); |
397 | LIST_HEAD(log_bufs); | 400 | LIST_HEAD(log_bufs); |
398 | 401 | ||
399 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 402 | if (jbd2_journal_has_csum_v2or3(journal)) |
400 | csum_size = sizeof(struct jbd2_journal_block_tail); | 403 | csum_size = sizeof(struct jbd2_journal_block_tail); |
401 | 404 | ||
402 | /* | 405 | /* |
@@ -690,7 +693,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
690 | tag_flag |= JBD2_FLAG_SAME_UUID; | 693 | tag_flag |= JBD2_FLAG_SAME_UUID; |
691 | 694 | ||
692 | tag = (journal_block_tag_t *) tagp; | 695 | tag = (journal_block_tag_t *) tagp; |
693 | write_tag_block(tag_bytes, tag, jh2bh(jh)->b_blocknr); | 696 | write_tag_block(journal, tag, jh2bh(jh)->b_blocknr); |
694 | tag->t_flags = cpu_to_be16(tag_flag); | 697 | tag->t_flags = cpu_to_be16(tag_flag); |
695 | jbd2_block_tag_csum_set(journal, tag, wbuf[bufs], | 698 | jbd2_block_tag_csum_set(journal, tag, wbuf[bufs], |
696 | commit_transaction->t_tid); | 699 | commit_transaction->t_tid); |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 67b8e303946c..19d74d86d99c 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -124,7 +124,7 @@ EXPORT_SYMBOL(__jbd2_debug); | |||
124 | /* Checksumming functions */ | 124 | /* Checksumming functions */ |
125 | static int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb) | 125 | static int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb) |
126 | { | 126 | { |
127 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 127 | if (!jbd2_journal_has_csum_v2or3(j)) |
128 | return 1; | 128 | return 1; |
129 | 129 | ||
130 | return sb->s_checksum_type == JBD2_CRC32C_CHKSUM; | 130 | return sb->s_checksum_type == JBD2_CRC32C_CHKSUM; |
@@ -145,7 +145,7 @@ static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb) | |||
145 | 145 | ||
146 | static int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb) | 146 | static int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb) |
147 | { | 147 | { |
148 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 148 | if (!jbd2_journal_has_csum_v2or3(j)) |
149 | return 1; | 149 | return 1; |
150 | 150 | ||
151 | return sb->s_checksum == jbd2_superblock_csum(j, sb); | 151 | return sb->s_checksum == jbd2_superblock_csum(j, sb); |
@@ -153,7 +153,7 @@ static int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb) | |||
153 | 153 | ||
154 | static void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb) | 154 | static void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb) |
155 | { | 155 | { |
156 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 156 | if (!jbd2_journal_has_csum_v2or3(j)) |
157 | return; | 157 | return; |
158 | 158 | ||
159 | sb->s_checksum = jbd2_superblock_csum(j, sb); | 159 | sb->s_checksum = jbd2_superblock_csum(j, sb); |
@@ -1522,21 +1522,29 @@ static int journal_get_superblock(journal_t *journal) | |||
1522 | goto out; | 1522 | goto out; |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM) && | 1525 | if (jbd2_journal_has_csum_v2or3(journal) && |
1526 | JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) { | 1526 | JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM)) { |
1527 | /* Can't have checksum v1 and v2 on at the same time! */ | 1527 | /* Can't have checksum v1 and v2 on at the same time! */ |
1528 | printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 " | 1528 | printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 " |
1529 | "at the same time!\n"); | 1529 | "at the same time!\n"); |
1530 | goto out; | 1530 | goto out; |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) && | ||
1534 | JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) { | ||
1535 | /* Can't have checksum v2 and v3 at the same time! */ | ||
1536 | printk(KERN_ERR "JBD2: Can't enable checksumming v2 and v3 " | ||
1537 | "at the same time!\n"); | ||
1538 | goto out; | ||
1539 | } | ||
1540 | |||
1533 | if (!jbd2_verify_csum_type(journal, sb)) { | 1541 | if (!jbd2_verify_csum_type(journal, sb)) { |
1534 | printk(KERN_ERR "JBD2: Unknown checksum type\n"); | 1542 | printk(KERN_ERR "JBD2: Unknown checksum type\n"); |
1535 | goto out; | 1543 | goto out; |
1536 | } | 1544 | } |
1537 | 1545 | ||
1538 | /* Load the checksum driver */ | 1546 | /* Load the checksum driver */ |
1539 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) { | 1547 | if (jbd2_journal_has_csum_v2or3(journal)) { |
1540 | journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0); | 1548 | journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0); |
1541 | if (IS_ERR(journal->j_chksum_driver)) { | 1549 | if (IS_ERR(journal->j_chksum_driver)) { |
1542 | printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n"); | 1550 | printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n"); |
@@ -1553,7 +1561,7 @@ static int journal_get_superblock(journal_t *journal) | |||
1553 | } | 1561 | } |
1554 | 1562 | ||
1555 | /* Precompute checksum seed for all metadata */ | 1563 | /* Precompute checksum seed for all metadata */ |
1556 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 1564 | if (jbd2_journal_has_csum_v2or3(journal)) |
1557 | journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid, | 1565 | journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid, |
1558 | sizeof(sb->s_uuid)); | 1566 | sizeof(sb->s_uuid)); |
1559 | 1567 | ||
@@ -1813,8 +1821,14 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, | |||
1813 | if (!jbd2_journal_check_available_features(journal, compat, ro, incompat)) | 1821 | if (!jbd2_journal_check_available_features(journal, compat, ro, incompat)) |
1814 | return 0; | 1822 | return 0; |
1815 | 1823 | ||
1816 | /* Asking for checksumming v2 and v1? Only give them v2. */ | 1824 | /* If enabling v2 checksums, turn on v3 instead */ |
1817 | if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2 && | 1825 | if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2) { |
1826 | incompat &= ~JBD2_FEATURE_INCOMPAT_CSUM_V2; | ||
1827 | incompat |= JBD2_FEATURE_INCOMPAT_CSUM_V3; | ||
1828 | } | ||
1829 | |||
1830 | /* Asking for checksumming v3 and v1? Only give them v3. */ | ||
1831 | if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V3 && | ||
1818 | compat & JBD2_FEATURE_COMPAT_CHECKSUM) | 1832 | compat & JBD2_FEATURE_COMPAT_CHECKSUM) |
1819 | compat &= ~JBD2_FEATURE_COMPAT_CHECKSUM; | 1833 | compat &= ~JBD2_FEATURE_COMPAT_CHECKSUM; |
1820 | 1834 | ||
@@ -1823,8 +1837,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, | |||
1823 | 1837 | ||
1824 | sb = journal->j_superblock; | 1838 | sb = journal->j_superblock; |
1825 | 1839 | ||
1826 | /* If enabling v2 checksums, update superblock */ | 1840 | /* If enabling v3 checksums, update superblock */ |
1827 | if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V2)) { | 1841 | if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V3)) { |
1828 | sb->s_checksum_type = JBD2_CRC32C_CHKSUM; | 1842 | sb->s_checksum_type = JBD2_CRC32C_CHKSUM; |
1829 | sb->s_feature_compat &= | 1843 | sb->s_feature_compat &= |
1830 | ~cpu_to_be32(JBD2_FEATURE_COMPAT_CHECKSUM); | 1844 | ~cpu_to_be32(JBD2_FEATURE_COMPAT_CHECKSUM); |
@@ -1842,8 +1856,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, | |||
1842 | } | 1856 | } |
1843 | 1857 | ||
1844 | /* Precompute checksum seed for all metadata */ | 1858 | /* Precompute checksum seed for all metadata */ |
1845 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 1859 | if (jbd2_journal_has_csum_v2or3(journal)) |
1846 | JBD2_FEATURE_INCOMPAT_CSUM_V2)) | ||
1847 | journal->j_csum_seed = jbd2_chksum(journal, ~0, | 1860 | journal->j_csum_seed = jbd2_chksum(journal, ~0, |
1848 | sb->s_uuid, | 1861 | sb->s_uuid, |
1849 | sizeof(sb->s_uuid)); | 1862 | sizeof(sb->s_uuid)); |
@@ -1852,7 +1865,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, | |||
1852 | /* If enabling v1 checksums, downgrade superblock */ | 1865 | /* If enabling v1 checksums, downgrade superblock */ |
1853 | if (COMPAT_FEATURE_ON(JBD2_FEATURE_COMPAT_CHECKSUM)) | 1866 | if (COMPAT_FEATURE_ON(JBD2_FEATURE_COMPAT_CHECKSUM)) |
1854 | sb->s_feature_incompat &= | 1867 | sb->s_feature_incompat &= |
1855 | ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2); | 1868 | ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2 | |
1869 | JBD2_FEATURE_INCOMPAT_CSUM_V3); | ||
1856 | 1870 | ||
1857 | sb->s_feature_compat |= cpu_to_be32(compat); | 1871 | sb->s_feature_compat |= cpu_to_be32(compat); |
1858 | sb->s_feature_ro_compat |= cpu_to_be32(ro); | 1872 | sb->s_feature_ro_compat |= cpu_to_be32(ro); |
@@ -2165,16 +2179,20 @@ int jbd2_journal_blocks_per_page(struct inode *inode) | |||
2165 | */ | 2179 | */ |
2166 | size_t journal_tag_bytes(journal_t *journal) | 2180 | size_t journal_tag_bytes(journal_t *journal) |
2167 | { | 2181 | { |
2168 | journal_block_tag_t tag; | 2182 | size_t sz; |
2169 | size_t x = 0; | 2183 | |
2184 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) | ||
2185 | return sizeof(journal_block_tag3_t); | ||
2186 | |||
2187 | sz = sizeof(journal_block_tag_t); | ||
2170 | 2188 | ||
2171 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 2189 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) |
2172 | x += sizeof(tag.t_checksum); | 2190 | sz += sizeof(__u16); |
2173 | 2191 | ||
2174 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) | 2192 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
2175 | return x + JBD2_TAG_SIZE64; | 2193 | return sz; |
2176 | else | 2194 | else |
2177 | return x + JBD2_TAG_SIZE32; | 2195 | return sz - sizeof(__u32); |
2178 | } | 2196 | } |
2179 | 2197 | ||
2180 | /* | 2198 | /* |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 3b6bb19d60b1..9b329b55ffe3 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -181,7 +181,7 @@ static int jbd2_descr_block_csum_verify(journal_t *j, | |||
181 | __be32 provided; | 181 | __be32 provided; |
182 | __u32 calculated; | 182 | __u32 calculated; |
183 | 183 | ||
184 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 184 | if (!jbd2_journal_has_csum_v2or3(j)) |
185 | return 1; | 185 | return 1; |
186 | 186 | ||
187 | tail = (struct jbd2_journal_block_tail *)(buf + j->j_blocksize - | 187 | tail = (struct jbd2_journal_block_tail *)(buf + j->j_blocksize - |
@@ -205,7 +205,7 @@ static int count_tags(journal_t *journal, struct buffer_head *bh) | |||
205 | int nr = 0, size = journal->j_blocksize; | 205 | int nr = 0, size = journal->j_blocksize; |
206 | int tag_bytes = journal_tag_bytes(journal); | 206 | int tag_bytes = journal_tag_bytes(journal); |
207 | 207 | ||
208 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 208 | if (jbd2_journal_has_csum_v2or3(journal)) |
209 | size -= sizeof(struct jbd2_journal_block_tail); | 209 | size -= sizeof(struct jbd2_journal_block_tail); |
210 | 210 | ||
211 | tagp = &bh->b_data[sizeof(journal_header_t)]; | 211 | tagp = &bh->b_data[sizeof(journal_header_t)]; |
@@ -338,10 +338,11 @@ int jbd2_journal_skip_recovery(journal_t *journal) | |||
338 | return err; | 338 | return err; |
339 | } | 339 | } |
340 | 340 | ||
341 | static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag) | 341 | static inline unsigned long long read_tag_block(journal_t *journal, |
342 | journal_block_tag_t *tag) | ||
342 | { | 343 | { |
343 | unsigned long long block = be32_to_cpu(tag->t_blocknr); | 344 | unsigned long long block = be32_to_cpu(tag->t_blocknr); |
344 | if (tag_bytes > JBD2_TAG_SIZE32) | 345 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
345 | block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32; | 346 | block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32; |
346 | return block; | 347 | return block; |
347 | } | 348 | } |
@@ -384,7 +385,7 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) | |||
384 | __be32 provided; | 385 | __be32 provided; |
385 | __u32 calculated; | 386 | __u32 calculated; |
386 | 387 | ||
387 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 388 | if (!jbd2_journal_has_csum_v2or3(j)) |
388 | return 1; | 389 | return 1; |
389 | 390 | ||
390 | h = buf; | 391 | h = buf; |
@@ -399,17 +400,21 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) | |||
399 | static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag, | 400 | static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag, |
400 | void *buf, __u32 sequence) | 401 | void *buf, __u32 sequence) |
401 | { | 402 | { |
403 | journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag; | ||
402 | __u32 csum32; | 404 | __u32 csum32; |
403 | __be32 seq; | 405 | __be32 seq; |
404 | 406 | ||
405 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 407 | if (!jbd2_journal_has_csum_v2or3(j)) |
406 | return 1; | 408 | return 1; |
407 | 409 | ||
408 | seq = cpu_to_be32(sequence); | 410 | seq = cpu_to_be32(sequence); |
409 | csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq)); | 411 | csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq)); |
410 | csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize); | 412 | csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize); |
411 | 413 | ||
412 | return tag->t_checksum == cpu_to_be16(csum32); | 414 | if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3)) |
415 | return tag3->t_checksum == cpu_to_be32(csum32); | ||
416 | else | ||
417 | return tag->t_checksum == cpu_to_be16(csum32); | ||
413 | } | 418 | } |
414 | 419 | ||
415 | static int do_one_pass(journal_t *journal, | 420 | static int do_one_pass(journal_t *journal, |
@@ -426,6 +431,7 @@ static int do_one_pass(journal_t *journal, | |||
426 | int tag_bytes = journal_tag_bytes(journal); | 431 | int tag_bytes = journal_tag_bytes(journal); |
427 | __u32 crc32_sum = ~0; /* Transactional Checksums */ | 432 | __u32 crc32_sum = ~0; /* Transactional Checksums */ |
428 | int descr_csum_size = 0; | 433 | int descr_csum_size = 0; |
434 | int block_error = 0; | ||
429 | 435 | ||
430 | /* | 436 | /* |
431 | * First thing is to establish what we expect to find in the log | 437 | * First thing is to establish what we expect to find in the log |
@@ -512,8 +518,7 @@ static int do_one_pass(journal_t *journal, | |||
512 | switch(blocktype) { | 518 | switch(blocktype) { |
513 | case JBD2_DESCRIPTOR_BLOCK: | 519 | case JBD2_DESCRIPTOR_BLOCK: |
514 | /* Verify checksum first */ | 520 | /* Verify checksum first */ |
515 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 521 | if (jbd2_journal_has_csum_v2or3(journal)) |
516 | JBD2_FEATURE_INCOMPAT_CSUM_V2)) | ||
517 | descr_csum_size = | 522 | descr_csum_size = |
518 | sizeof(struct jbd2_journal_block_tail); | 523 | sizeof(struct jbd2_journal_block_tail); |
519 | if (descr_csum_size > 0 && | 524 | if (descr_csum_size > 0 && |
@@ -574,7 +579,7 @@ static int do_one_pass(journal_t *journal, | |||
574 | unsigned long long blocknr; | 579 | unsigned long long blocknr; |
575 | 580 | ||
576 | J_ASSERT(obh != NULL); | 581 | J_ASSERT(obh != NULL); |
577 | blocknr = read_tag_block(tag_bytes, | 582 | blocknr = read_tag_block(journal, |
578 | tag); | 583 | tag); |
579 | 584 | ||
580 | /* If the block has been | 585 | /* If the block has been |
@@ -598,7 +603,8 @@ static int do_one_pass(journal_t *journal, | |||
598 | "checksum recovering " | 603 | "checksum recovering " |
599 | "block %llu in log\n", | 604 | "block %llu in log\n", |
600 | blocknr); | 605 | blocknr); |
601 | continue; | 606 | block_error = 1; |
607 | goto skip_write; | ||
602 | } | 608 | } |
603 | 609 | ||
604 | /* Find a buffer for the new | 610 | /* Find a buffer for the new |
@@ -797,7 +803,8 @@ static int do_one_pass(journal_t *journal, | |||
797 | success = -EIO; | 803 | success = -EIO; |
798 | } | 804 | } |
799 | } | 805 | } |
800 | 806 | if (block_error && success == 0) | |
807 | success = -EIO; | ||
801 | return success; | 808 | return success; |
802 | 809 | ||
803 | failed: | 810 | failed: |
@@ -811,7 +818,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j, | |||
811 | __be32 provided; | 818 | __be32 provided; |
812 | __u32 calculated; | 819 | __u32 calculated; |
813 | 820 | ||
814 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 821 | if (!jbd2_journal_has_csum_v2or3(j)) |
815 | return 1; | 822 | return 1; |
816 | 823 | ||
817 | tail = (struct jbd2_journal_revoke_tail *)(buf + j->j_blocksize - | 824 | tail = (struct jbd2_journal_revoke_tail *)(buf + j->j_blocksize - |
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index 198c9c10276d..d5e95a175c92 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -91,8 +91,8 @@ | |||
91 | #include <linux/list.h> | 91 | #include <linux/list.h> |
92 | #include <linux/init.h> | 92 | #include <linux/init.h> |
93 | #include <linux/bio.h> | 93 | #include <linux/bio.h> |
94 | #endif | ||
95 | #include <linux/log2.h> | 94 | #include <linux/log2.h> |
95 | #endif | ||
96 | 96 | ||
97 | static struct kmem_cache *jbd2_revoke_record_cache; | 97 | static struct kmem_cache *jbd2_revoke_record_cache; |
98 | static struct kmem_cache *jbd2_revoke_table_cache; | 98 | static struct kmem_cache *jbd2_revoke_table_cache; |
@@ -597,7 +597,7 @@ static void write_one_revoke_record(journal_t *journal, | |||
597 | offset = *offsetp; | 597 | offset = *offsetp; |
598 | 598 | ||
599 | /* Do we need to leave space at the end for a checksum? */ | 599 | /* Do we need to leave space at the end for a checksum? */ |
600 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 600 | if (jbd2_journal_has_csum_v2or3(journal)) |
601 | csum_size = sizeof(struct jbd2_journal_revoke_tail); | 601 | csum_size = sizeof(struct jbd2_journal_revoke_tail); |
602 | 602 | ||
603 | /* Make sure we have a descriptor with space left for the record */ | 603 | /* Make sure we have a descriptor with space left for the record */ |
@@ -644,7 +644,7 @@ static void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh) | |||
644 | struct jbd2_journal_revoke_tail *tail; | 644 | struct jbd2_journal_revoke_tail *tail; |
645 | __u32 csum; | 645 | __u32 csum; |
646 | 646 | ||
647 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 647 | if (!jbd2_journal_has_csum_v2or3(j)) |
648 | return; | 648 | return; |
649 | 649 | ||
650 | tail = (struct jbd2_journal_revoke_tail *)(bh->b_data + j->j_blocksize - | 650 | tail = (struct jbd2_journal_revoke_tail *)(bh->b_data + j->j_blocksize - |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 8f27c93f8d2e..ec9e082f9ecd 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -253,13 +253,11 @@ static int lockd_up_net(struct svc_serv *serv, struct net *net) | |||
253 | 253 | ||
254 | error = make_socks(serv, net); | 254 | error = make_socks(serv, net); |
255 | if (error < 0) | 255 | if (error < 0) |
256 | goto err_socks; | 256 | goto err_bind; |
257 | set_grace_period(net); | 257 | set_grace_period(net); |
258 | dprintk("lockd_up_net: per-net data created; net=%p\n", net); | 258 | dprintk("lockd_up_net: per-net data created; net=%p\n", net); |
259 | return 0; | 259 | return 0; |
260 | 260 | ||
261 | err_socks: | ||
262 | svc_rpcb_cleanup(serv, net); | ||
263 | err_bind: | 261 | err_bind: |
264 | ln->nlmsvc_users--; | 262 | ln->nlmsvc_users--; |
265 | return error; | 263 | return error; |
diff --git a/fs/locks.c b/fs/locks.c index cb66fb05ad4a..bb08857f90b5 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1619,7 +1619,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp | |||
1619 | smp_mb(); | 1619 | smp_mb(); |
1620 | error = check_conflicting_open(dentry, arg); | 1620 | error = check_conflicting_open(dentry, arg); |
1621 | if (error) | 1621 | if (error) |
1622 | locks_unlink_lock(flp); | 1622 | locks_unlink_lock(before); |
1623 | out: | 1623 | out: |
1624 | if (is_deleg) | 1624 | if (is_deleg) |
1625 | mutex_unlock(&inode->i_mutex); | 1625 | mutex_unlock(&inode->i_mutex); |
diff --git a/fs/namei.c b/fs/namei.c index a996bb48dfab..a7b05bf82d31 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/device_cgroup.h> | 34 | #include <linux/device_cgroup.h> |
35 | #include <linux/fs_struct.h> | 35 | #include <linux/fs_struct.h> |
36 | #include <linux/posix_acl.h> | 36 | #include <linux/posix_acl.h> |
37 | #include <linux/hash.h> | ||
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
38 | 39 | ||
39 | #include "internal.h" | 40 | #include "internal.h" |
@@ -643,24 +644,22 @@ static int complete_walk(struct nameidata *nd) | |||
643 | 644 | ||
644 | static __always_inline void set_root(struct nameidata *nd) | 645 | static __always_inline void set_root(struct nameidata *nd) |
645 | { | 646 | { |
646 | if (!nd->root.mnt) | 647 | get_fs_root(current->fs, &nd->root); |
647 | get_fs_root(current->fs, &nd->root); | ||
648 | } | 648 | } |
649 | 649 | ||
650 | static int link_path_walk(const char *, struct nameidata *); | 650 | static int link_path_walk(const char *, struct nameidata *); |
651 | 651 | ||
652 | static __always_inline void set_root_rcu(struct nameidata *nd) | 652 | static __always_inline unsigned set_root_rcu(struct nameidata *nd) |
653 | { | 653 | { |
654 | if (!nd->root.mnt) { | 654 | struct fs_struct *fs = current->fs; |
655 | struct fs_struct *fs = current->fs; | 655 | unsigned seq, res; |
656 | unsigned seq; | ||
657 | 656 | ||
658 | do { | 657 | do { |
659 | seq = read_seqcount_begin(&fs->seq); | 658 | seq = read_seqcount_begin(&fs->seq); |
660 | nd->root = fs->root; | 659 | nd->root = fs->root; |
661 | nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq); | 660 | res = __read_seqcount_begin(&nd->root.dentry->d_seq); |
662 | } while (read_seqcount_retry(&fs->seq, seq)); | 661 | } while (read_seqcount_retry(&fs->seq, seq)); |
663 | } | 662 | return res; |
664 | } | 663 | } |
665 | 664 | ||
666 | static void path_put_conditional(struct path *path, struct nameidata *nd) | 665 | static void path_put_conditional(struct path *path, struct nameidata *nd) |
@@ -860,7 +859,8 @@ follow_link(struct path *link, struct nameidata *nd, void **p) | |||
860 | return PTR_ERR(s); | 859 | return PTR_ERR(s); |
861 | } | 860 | } |
862 | if (*s == '/') { | 861 | if (*s == '/') { |
863 | set_root(nd); | 862 | if (!nd->root.mnt) |
863 | set_root(nd); | ||
864 | path_put(&nd->path); | 864 | path_put(&nd->path); |
865 | nd->path = nd->root; | 865 | nd->path = nd->root; |
866 | path_get(&nd->root); | 866 | path_get(&nd->root); |
@@ -1137,13 +1137,15 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, | |||
1137 | */ | 1137 | */ |
1138 | *inode = path->dentry->d_inode; | 1138 | *inode = path->dentry->d_inode; |
1139 | } | 1139 | } |
1140 | return read_seqretry(&mount_lock, nd->m_seq) && | 1140 | return !read_seqretry(&mount_lock, nd->m_seq) && |
1141 | !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); | 1141 | !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | static int follow_dotdot_rcu(struct nameidata *nd) | 1144 | static int follow_dotdot_rcu(struct nameidata *nd) |
1145 | { | 1145 | { |
1146 | set_root_rcu(nd); | 1146 | struct inode *inode = nd->inode; |
1147 | if (!nd->root.mnt) | ||
1148 | set_root_rcu(nd); | ||
1147 | 1149 | ||
1148 | while (1) { | 1150 | while (1) { |
1149 | if (nd->path.dentry == nd->root.dentry && | 1151 | if (nd->path.dentry == nd->root.dentry && |
@@ -1155,6 +1157,7 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1155 | struct dentry *parent = old->d_parent; | 1157 | struct dentry *parent = old->d_parent; |
1156 | unsigned seq; | 1158 | unsigned seq; |
1157 | 1159 | ||
1160 | inode = parent->d_inode; | ||
1158 | seq = read_seqcount_begin(&parent->d_seq); | 1161 | seq = read_seqcount_begin(&parent->d_seq); |
1159 | if (read_seqcount_retry(&old->d_seq, nd->seq)) | 1162 | if (read_seqcount_retry(&old->d_seq, nd->seq)) |
1160 | goto failed; | 1163 | goto failed; |
@@ -1164,6 +1167,7 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1164 | } | 1167 | } |
1165 | if (!follow_up_rcu(&nd->path)) | 1168 | if (!follow_up_rcu(&nd->path)) |
1166 | break; | 1169 | break; |
1170 | inode = nd->path.dentry->d_inode; | ||
1167 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); | 1171 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); |
1168 | } | 1172 | } |
1169 | while (d_mountpoint(nd->path.dentry)) { | 1173 | while (d_mountpoint(nd->path.dentry)) { |
@@ -1173,11 +1177,12 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1173 | break; | 1177 | break; |
1174 | nd->path.mnt = &mounted->mnt; | 1178 | nd->path.mnt = &mounted->mnt; |
1175 | nd->path.dentry = mounted->mnt.mnt_root; | 1179 | nd->path.dentry = mounted->mnt.mnt_root; |
1180 | inode = nd->path.dentry->d_inode; | ||
1176 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); | 1181 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); |
1177 | if (!read_seqretry(&mount_lock, nd->m_seq)) | 1182 | if (read_seqretry(&mount_lock, nd->m_seq)) |
1178 | goto failed; | 1183 | goto failed; |
1179 | } | 1184 | } |
1180 | nd->inode = nd->path.dentry->d_inode; | 1185 | nd->inode = inode; |
1181 | return 0; | 1186 | return 0; |
1182 | 1187 | ||
1183 | failed: | 1188 | failed: |
@@ -1256,7 +1261,8 @@ static void follow_mount(struct path *path) | |||
1256 | 1261 | ||
1257 | static void follow_dotdot(struct nameidata *nd) | 1262 | static void follow_dotdot(struct nameidata *nd) |
1258 | { | 1263 | { |
1259 | set_root(nd); | 1264 | if (!nd->root.mnt) |
1265 | set_root(nd); | ||
1260 | 1266 | ||
1261 | while(1) { | 1267 | while(1) { |
1262 | struct dentry *old = nd->path.dentry; | 1268 | struct dentry *old = nd->path.dentry; |
@@ -1634,8 +1640,7 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd) | |||
1634 | 1640 | ||
1635 | static inline unsigned int fold_hash(unsigned long hash) | 1641 | static inline unsigned int fold_hash(unsigned long hash) |
1636 | { | 1642 | { |
1637 | hash += hash >> (8*sizeof(int)); | 1643 | return hash_64(hash, 32); |
1638 | return hash; | ||
1639 | } | 1644 | } |
1640 | 1645 | ||
1641 | #else /* 32-bit case */ | 1646 | #else /* 32-bit case */ |
@@ -1669,9 +1674,9 @@ EXPORT_SYMBOL(full_name_hash); | |||
1669 | 1674 | ||
1670 | /* | 1675 | /* |
1671 | * Calculate the length and hash of the path component, and | 1676 | * Calculate the length and hash of the path component, and |
1672 | * return the length of the component; | 1677 | * return the "hash_len" as the result. |
1673 | */ | 1678 | */ |
1674 | static inline unsigned long hash_name(const char *name, unsigned int *hashp) | 1679 | static inline u64 hash_name(const char *name) |
1675 | { | 1680 | { |
1676 | unsigned long a, b, adata, bdata, mask, hash, len; | 1681 | unsigned long a, b, adata, bdata, mask, hash, len; |
1677 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; | 1682 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
@@ -1691,9 +1696,8 @@ static inline unsigned long hash_name(const char *name, unsigned int *hashp) | |||
1691 | mask = create_zero_mask(adata | bdata); | 1696 | mask = create_zero_mask(adata | bdata); |
1692 | 1697 | ||
1693 | hash += a & zero_bytemask(mask); | 1698 | hash += a & zero_bytemask(mask); |
1694 | *hashp = fold_hash(hash); | 1699 | len += find_zero(mask); |
1695 | 1700 | return hashlen_create(fold_hash(hash), len); | |
1696 | return len + find_zero(mask); | ||
1697 | } | 1701 | } |
1698 | 1702 | ||
1699 | #else | 1703 | #else |
@@ -1711,7 +1715,7 @@ EXPORT_SYMBOL(full_name_hash); | |||
1711 | * We know there's a real path component here of at least | 1715 | * We know there's a real path component here of at least |
1712 | * one character. | 1716 | * one character. |
1713 | */ | 1717 | */ |
1714 | static inline unsigned long hash_name(const char *name, unsigned int *hashp) | 1718 | static inline u64 hash_name(const char *name) |
1715 | { | 1719 | { |
1716 | unsigned long hash = init_name_hash(); | 1720 | unsigned long hash = init_name_hash(); |
1717 | unsigned long len = 0, c; | 1721 | unsigned long len = 0, c; |
@@ -1722,8 +1726,7 @@ static inline unsigned long hash_name(const char *name, unsigned int *hashp) | |||
1722 | hash = partial_name_hash(c, hash); | 1726 | hash = partial_name_hash(c, hash); |
1723 | c = (unsigned char)name[len]; | 1727 | c = (unsigned char)name[len]; |
1724 | } while (c && c != '/'); | 1728 | } while (c && c != '/'); |
1725 | *hashp = end_name_hash(hash); | 1729 | return hashlen_create(end_name_hash(hash), len); |
1726 | return len; | ||
1727 | } | 1730 | } |
1728 | 1731 | ||
1729 | #endif | 1732 | #endif |
@@ -1748,20 +1751,17 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1748 | 1751 | ||
1749 | /* At this point we know we have a real path component. */ | 1752 | /* At this point we know we have a real path component. */ |
1750 | for(;;) { | 1753 | for(;;) { |
1751 | struct qstr this; | 1754 | u64 hash_len; |
1752 | long len; | ||
1753 | int type; | 1755 | int type; |
1754 | 1756 | ||
1755 | err = may_lookup(nd); | 1757 | err = may_lookup(nd); |
1756 | if (err) | 1758 | if (err) |
1757 | break; | 1759 | break; |
1758 | 1760 | ||
1759 | len = hash_name(name, &this.hash); | 1761 | hash_len = hash_name(name); |
1760 | this.name = name; | ||
1761 | this.len = len; | ||
1762 | 1762 | ||
1763 | type = LAST_NORM; | 1763 | type = LAST_NORM; |
1764 | if (name[0] == '.') switch (len) { | 1764 | if (name[0] == '.') switch (hashlen_len(hash_len)) { |
1765 | case 2: | 1765 | case 2: |
1766 | if (name[1] == '.') { | 1766 | if (name[1] == '.') { |
1767 | type = LAST_DOTDOT; | 1767 | type = LAST_DOTDOT; |
@@ -1775,29 +1775,32 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1775 | struct dentry *parent = nd->path.dentry; | 1775 | struct dentry *parent = nd->path.dentry; |
1776 | nd->flags &= ~LOOKUP_JUMPED; | 1776 | nd->flags &= ~LOOKUP_JUMPED; |
1777 | if (unlikely(parent->d_flags & DCACHE_OP_HASH)) { | 1777 | if (unlikely(parent->d_flags & DCACHE_OP_HASH)) { |
1778 | struct qstr this = { { .hash_len = hash_len }, .name = name }; | ||
1778 | err = parent->d_op->d_hash(parent, &this); | 1779 | err = parent->d_op->d_hash(parent, &this); |
1779 | if (err < 0) | 1780 | if (err < 0) |
1780 | break; | 1781 | break; |
1782 | hash_len = this.hash_len; | ||
1783 | name = this.name; | ||
1781 | } | 1784 | } |
1782 | } | 1785 | } |
1783 | 1786 | ||
1784 | nd->last = this; | 1787 | nd->last.hash_len = hash_len; |
1788 | nd->last.name = name; | ||
1785 | nd->last_type = type; | 1789 | nd->last_type = type; |
1786 | 1790 | ||
1787 | if (!name[len]) | 1791 | name += hashlen_len(hash_len); |
1792 | if (!*name) | ||
1788 | return 0; | 1793 | return 0; |
1789 | /* | 1794 | /* |
1790 | * If it wasn't NUL, we know it was '/'. Skip that | 1795 | * If it wasn't NUL, we know it was '/'. Skip that |
1791 | * slash, and continue until no more slashes. | 1796 | * slash, and continue until no more slashes. |
1792 | */ | 1797 | */ |
1793 | do { | 1798 | do { |
1794 | len++; | 1799 | name++; |
1795 | } while (unlikely(name[len] == '/')); | 1800 | } while (unlikely(*name == '/')); |
1796 | if (!name[len]) | 1801 | if (!*name) |
1797 | return 0; | 1802 | return 0; |
1798 | 1803 | ||
1799 | name += len; | ||
1800 | |||
1801 | err = walk_component(nd, &next, LOOKUP_FOLLOW); | 1804 | err = walk_component(nd, &next, LOOKUP_FOLLOW); |
1802 | if (err < 0) | 1805 | if (err < 0) |
1803 | return err; | 1806 | return err; |
@@ -1852,7 +1855,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, | |||
1852 | if (*name=='/') { | 1855 | if (*name=='/') { |
1853 | if (flags & LOOKUP_RCU) { | 1856 | if (flags & LOOKUP_RCU) { |
1854 | rcu_read_lock(); | 1857 | rcu_read_lock(); |
1855 | set_root_rcu(nd); | 1858 | nd->seq = set_root_rcu(nd); |
1856 | } else { | 1859 | } else { |
1857 | set_root(nd); | 1860 | set_root(nd); |
1858 | path_get(&nd->root); | 1861 | path_get(&nd->root); |
@@ -1903,7 +1906,14 @@ static int path_init(int dfd, const char *name, unsigned int flags, | |||
1903 | } | 1906 | } |
1904 | 1907 | ||
1905 | nd->inode = nd->path.dentry->d_inode; | 1908 | nd->inode = nd->path.dentry->d_inode; |
1906 | return 0; | 1909 | if (!(flags & LOOKUP_RCU)) |
1910 | return 0; | ||
1911 | if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq))) | ||
1912 | return 0; | ||
1913 | if (!(nd->flags & LOOKUP_ROOT)) | ||
1914 | nd->root.mnt = NULL; | ||
1915 | rcu_read_unlock(); | ||
1916 | return -ECHILD; | ||
1907 | } | 1917 | } |
1908 | 1918 | ||
1909 | static inline int lookup_last(struct nameidata *nd, struct path *path) | 1919 | static inline int lookup_last(struct nameidata *nd, struct path *path) |
diff --git a/fs/namespace.c b/fs/namespace.c index a01c7730e9af..ef42d9bee212 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1217,6 +1217,11 @@ static void namespace_unlock(void) | |||
1217 | head.first->pprev = &head.first; | 1217 | head.first->pprev = &head.first; |
1218 | INIT_HLIST_HEAD(&unmounted); | 1218 | INIT_HLIST_HEAD(&unmounted); |
1219 | 1219 | ||
1220 | /* undo decrements we'd done in umount_tree() */ | ||
1221 | hlist_for_each_entry(mnt, &head, mnt_hash) | ||
1222 | if (mnt->mnt_ex_mountpoint.mnt) | ||
1223 | mntget(mnt->mnt_ex_mountpoint.mnt); | ||
1224 | |||
1220 | up_write(&namespace_sem); | 1225 | up_write(&namespace_sem); |
1221 | 1226 | ||
1222 | synchronize_rcu(); | 1227 | synchronize_rcu(); |
@@ -1253,6 +1258,9 @@ void umount_tree(struct mount *mnt, int how) | |||
1253 | hlist_add_head(&p->mnt_hash, &tmp_list); | 1258 | hlist_add_head(&p->mnt_hash, &tmp_list); |
1254 | } | 1259 | } |
1255 | 1260 | ||
1261 | hlist_for_each_entry(p, &tmp_list, mnt_hash) | ||
1262 | list_del_init(&p->mnt_child); | ||
1263 | |||
1256 | if (how) | 1264 | if (how) |
1257 | propagate_umount(&tmp_list); | 1265 | propagate_umount(&tmp_list); |
1258 | 1266 | ||
@@ -1263,9 +1271,9 @@ void umount_tree(struct mount *mnt, int how) | |||
1263 | p->mnt_ns = NULL; | 1271 | p->mnt_ns = NULL; |
1264 | if (how < 2) | 1272 | if (how < 2) |
1265 | p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; | 1273 | p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; |
1266 | list_del_init(&p->mnt_child); | ||
1267 | if (mnt_has_parent(p)) { | 1274 | if (mnt_has_parent(p)) { |
1268 | put_mountpoint(p->mnt_mp); | 1275 | put_mountpoint(p->mnt_mp); |
1276 | mnt_add_count(p->mnt_parent, -1); | ||
1269 | /* move the reference to mountpoint into ->mnt_ex_mountpoint */ | 1277 | /* move the reference to mountpoint into ->mnt_ex_mountpoint */ |
1270 | p->mnt_ex_mountpoint.dentry = p->mnt_mountpoint; | 1278 | p->mnt_ex_mountpoint.dentry = p->mnt_mountpoint; |
1271 | p->mnt_ex_mountpoint.mnt = &p->mnt_parent->mnt; | 1279 | p->mnt_ex_mountpoint.mnt = &p->mnt_parent->mnt; |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 1c5ff6d58385..6a4f3666e273 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1412,24 +1412,18 @@ int nfs_fs_proc_net_init(struct net *net) | |||
1412 | p = proc_create("volumes", S_IFREG|S_IRUGO, | 1412 | p = proc_create("volumes", S_IFREG|S_IRUGO, |
1413 | nn->proc_nfsfs, &nfs_volume_list_fops); | 1413 | nn->proc_nfsfs, &nfs_volume_list_fops); |
1414 | if (!p) | 1414 | if (!p) |
1415 | goto error_2; | 1415 | goto error_1; |
1416 | return 0; | 1416 | return 0; |
1417 | 1417 | ||
1418 | error_2: | ||
1419 | remove_proc_entry("servers", nn->proc_nfsfs); | ||
1420 | error_1: | 1418 | error_1: |
1421 | remove_proc_entry("fs/nfsfs", NULL); | 1419 | remove_proc_subtree("nfsfs", net->proc_net); |
1422 | error_0: | 1420 | error_0: |
1423 | return -ENOMEM; | 1421 | return -ENOMEM; |
1424 | } | 1422 | } |
1425 | 1423 | ||
1426 | void nfs_fs_proc_net_exit(struct net *net) | 1424 | void nfs_fs_proc_net_exit(struct net *net) |
1427 | { | 1425 | { |
1428 | struct nfs_net *nn = net_generic(net, nfs_net_id); | 1426 | remove_proc_subtree("nfsfs", net->proc_net); |
1429 | |||
1430 | remove_proc_entry("volumes", nn->proc_nfsfs); | ||
1431 | remove_proc_entry("servers", nn->proc_nfsfs); | ||
1432 | remove_proc_entry("fs/nfsfs", NULL); | ||
1433 | } | 1427 | } |
1434 | 1428 | ||
1435 | /* | 1429 | /* |
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index 1359c4a27393..90978075f730 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c | |||
@@ -1269,11 +1269,12 @@ filelayout_search_commit_reqs(struct nfs_commit_info *cinfo, struct page *page) | |||
1269 | static void filelayout_retry_commit(struct nfs_commit_info *cinfo, int idx) | 1269 | static void filelayout_retry_commit(struct nfs_commit_info *cinfo, int idx) |
1270 | { | 1270 | { |
1271 | struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds; | 1271 | struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds; |
1272 | struct pnfs_commit_bucket *bucket = fl_cinfo->buckets; | 1272 | struct pnfs_commit_bucket *bucket; |
1273 | struct pnfs_layout_segment *freeme; | 1273 | struct pnfs_layout_segment *freeme; |
1274 | int i; | 1274 | int i; |
1275 | 1275 | ||
1276 | for (i = idx; i < fl_cinfo->nbuckets; i++, bucket++) { | 1276 | for (i = idx; i < fl_cinfo->nbuckets; i++) { |
1277 | bucket = &fl_cinfo->buckets[i]; | ||
1277 | if (list_empty(&bucket->committing)) | 1278 | if (list_empty(&bucket->committing)) |
1278 | continue; | 1279 | continue; |
1279 | nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo); | 1280 | nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo); |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index d0fec260132a..24c6898159cc 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
@@ -129,7 +129,10 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, | |||
129 | .rpc_argp = &args, | 129 | .rpc_argp = &args, |
130 | .rpc_resp = &fattr, | 130 | .rpc_resp = &fattr, |
131 | }; | 131 | }; |
132 | int status; | 132 | int status = 0; |
133 | |||
134 | if (acl == NULL && (!S_ISDIR(inode->i_mode) || dfacl == NULL)) | ||
135 | goto out; | ||
133 | 136 | ||
134 | status = -EOPNOTSUPP; | 137 | status = -EOPNOTSUPP; |
135 | if (!nfs_server_capable(inode, NFS_CAP_ACLS)) | 138 | if (!nfs_server_capable(inode, NFS_CAP_ACLS)) |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 92193eddb41d..a8b855ab4e22 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -130,16 +130,15 @@ enum { | |||
130 | */ | 130 | */ |
131 | 131 | ||
132 | struct nfs4_lock_state { | 132 | struct nfs4_lock_state { |
133 | struct list_head ls_locks; /* Other lock stateids */ | 133 | struct list_head ls_locks; /* Other lock stateids */ |
134 | struct nfs4_state * ls_state; /* Pointer to open state */ | 134 | struct nfs4_state * ls_state; /* Pointer to open state */ |
135 | #define NFS_LOCK_INITIALIZED 0 | 135 | #define NFS_LOCK_INITIALIZED 0 |
136 | #define NFS_LOCK_LOST 1 | 136 | #define NFS_LOCK_LOST 1 |
137 | unsigned long ls_flags; | 137 | unsigned long ls_flags; |
138 | struct nfs_seqid_counter ls_seqid; | 138 | struct nfs_seqid_counter ls_seqid; |
139 | nfs4_stateid ls_stateid; | 139 | nfs4_stateid ls_stateid; |
140 | atomic_t ls_count; | 140 | atomic_t ls_count; |
141 | fl_owner_t ls_owner; | 141 | fl_owner_t ls_owner; |
142 | struct work_struct ls_release; | ||
143 | }; | 142 | }; |
144 | 143 | ||
145 | /* bits for nfs4_state->flags */ | 144 | /* bits for nfs4_state->flags */ |
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 53e435a95260..ffdb28d86cf8 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
@@ -482,6 +482,16 @@ int nfs40_walk_client_list(struct nfs_client *new, | |||
482 | 482 | ||
483 | spin_lock(&nn->nfs_client_lock); | 483 | spin_lock(&nn->nfs_client_lock); |
484 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { | 484 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { |
485 | |||
486 | if (pos->rpc_ops != new->rpc_ops) | ||
487 | continue; | ||
488 | |||
489 | if (pos->cl_proto != new->cl_proto) | ||
490 | continue; | ||
491 | |||
492 | if (pos->cl_minorversion != new->cl_minorversion) | ||
493 | continue; | ||
494 | |||
485 | /* If "pos" isn't marked ready, we can't trust the | 495 | /* If "pos" isn't marked ready, we can't trust the |
486 | * remaining fields in "pos" */ | 496 | * remaining fields in "pos" */ |
487 | if (pos->cl_cons_state > NFS_CS_READY) { | 497 | if (pos->cl_cons_state > NFS_CS_READY) { |
@@ -501,15 +511,6 @@ int nfs40_walk_client_list(struct nfs_client *new, | |||
501 | if (pos->cl_cons_state != NFS_CS_READY) | 511 | if (pos->cl_cons_state != NFS_CS_READY) |
502 | continue; | 512 | continue; |
503 | 513 | ||
504 | if (pos->rpc_ops != new->rpc_ops) | ||
505 | continue; | ||
506 | |||
507 | if (pos->cl_proto != new->cl_proto) | ||
508 | continue; | ||
509 | |||
510 | if (pos->cl_minorversion != new->cl_minorversion) | ||
511 | continue; | ||
512 | |||
513 | if (pos->cl_clientid != new->cl_clientid) | 514 | if (pos->cl_clientid != new->cl_clientid) |
514 | continue; | 515 | continue; |
515 | 516 | ||
@@ -622,6 +623,16 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
622 | 623 | ||
623 | spin_lock(&nn->nfs_client_lock); | 624 | spin_lock(&nn->nfs_client_lock); |
624 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { | 625 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { |
626 | |||
627 | if (pos->rpc_ops != new->rpc_ops) | ||
628 | continue; | ||
629 | |||
630 | if (pos->cl_proto != new->cl_proto) | ||
631 | continue; | ||
632 | |||
633 | if (pos->cl_minorversion != new->cl_minorversion) | ||
634 | continue; | ||
635 | |||
625 | /* If "pos" isn't marked ready, we can't trust the | 636 | /* If "pos" isn't marked ready, we can't trust the |
626 | * remaining fields in "pos", especially the client | 637 | * remaining fields in "pos", especially the client |
627 | * ID and serverowner fields. Wait for CREATE_SESSION | 638 | * ID and serverowner fields. Wait for CREATE_SESSION |
@@ -647,15 +658,6 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
647 | if (pos->cl_cons_state != NFS_CS_READY) | 658 | if (pos->cl_cons_state != NFS_CS_READY) |
648 | continue; | 659 | continue; |
649 | 660 | ||
650 | if (pos->rpc_ops != new->rpc_ops) | ||
651 | continue; | ||
652 | |||
653 | if (pos->cl_proto != new->cl_proto) | ||
654 | continue; | ||
655 | |||
656 | if (pos->cl_minorversion != new->cl_minorversion) | ||
657 | continue; | ||
658 | |||
659 | if (!nfs4_match_clientids(pos, new)) | 661 | if (!nfs4_match_clientids(pos, new)) |
660 | continue; | 662 | continue; |
661 | 663 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 75ae8d22f067..6ca0c8e7a945 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2226,9 +2226,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
2226 | ret = _nfs4_proc_open(opendata); | 2226 | ret = _nfs4_proc_open(opendata); |
2227 | if (ret != 0) { | 2227 | if (ret != 0) { |
2228 | if (ret == -ENOENT) { | 2228 | if (ret == -ENOENT) { |
2229 | d_drop(opendata->dentry); | 2229 | dentry = opendata->dentry; |
2230 | d_add(opendata->dentry, NULL); | 2230 | if (dentry->d_inode) |
2231 | nfs_set_verifier(opendata->dentry, | 2231 | d_delete(dentry); |
2232 | else if (d_unhashed(dentry)) | ||
2233 | d_add(dentry, NULL); | ||
2234 | |||
2235 | nfs_set_verifier(dentry, | ||
2232 | nfs_save_change_attribute(opendata->dir->d_inode)); | 2236 | nfs_save_change_attribute(opendata->dir->d_inode)); |
2233 | } | 2237 | } |
2234 | goto out; | 2238 | goto out; |
@@ -2560,6 +2564,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2560 | struct nfs4_closedata *calldata = data; | 2564 | struct nfs4_closedata *calldata = data; |
2561 | struct nfs4_state *state = calldata->state; | 2565 | struct nfs4_state *state = calldata->state; |
2562 | struct nfs_server *server = NFS_SERVER(calldata->inode); | 2566 | struct nfs_server *server = NFS_SERVER(calldata->inode); |
2567 | nfs4_stateid *res_stateid = NULL; | ||
2563 | 2568 | ||
2564 | dprintk("%s: begin!\n", __func__); | 2569 | dprintk("%s: begin!\n", __func__); |
2565 | if (!nfs4_sequence_done(task, &calldata->res.seq_res)) | 2570 | if (!nfs4_sequence_done(task, &calldata->res.seq_res)) |
@@ -2570,12 +2575,12 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2570 | */ | 2575 | */ |
2571 | switch (task->tk_status) { | 2576 | switch (task->tk_status) { |
2572 | case 0: | 2577 | case 0: |
2573 | if (calldata->roc) | 2578 | res_stateid = &calldata->res.stateid; |
2579 | if (calldata->arg.fmode == 0 && calldata->roc) | ||
2574 | pnfs_roc_set_barrier(state->inode, | 2580 | pnfs_roc_set_barrier(state->inode, |
2575 | calldata->roc_barrier); | 2581 | calldata->roc_barrier); |
2576 | nfs_clear_open_stateid(state, &calldata->res.stateid, 0); | ||
2577 | renew_lease(server, calldata->timestamp); | 2582 | renew_lease(server, calldata->timestamp); |
2578 | goto out_release; | 2583 | break; |
2579 | case -NFS4ERR_ADMIN_REVOKED: | 2584 | case -NFS4ERR_ADMIN_REVOKED: |
2580 | case -NFS4ERR_STALE_STATEID: | 2585 | case -NFS4ERR_STALE_STATEID: |
2581 | case -NFS4ERR_OLD_STATEID: | 2586 | case -NFS4ERR_OLD_STATEID: |
@@ -2589,7 +2594,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2589 | goto out_release; | 2594 | goto out_release; |
2590 | } | 2595 | } |
2591 | } | 2596 | } |
2592 | nfs_clear_open_stateid(state, NULL, calldata->arg.fmode); | 2597 | nfs_clear_open_stateid(state, res_stateid, calldata->arg.fmode); |
2593 | out_release: | 2598 | out_release: |
2594 | nfs_release_seqid(calldata->arg.seqid); | 2599 | nfs_release_seqid(calldata->arg.seqid); |
2595 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); | 2600 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); |
@@ -2601,6 +2606,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2601 | struct nfs4_closedata *calldata = data; | 2606 | struct nfs4_closedata *calldata = data; |
2602 | struct nfs4_state *state = calldata->state; | 2607 | struct nfs4_state *state = calldata->state; |
2603 | struct inode *inode = calldata->inode; | 2608 | struct inode *inode = calldata->inode; |
2609 | bool is_rdonly, is_wronly, is_rdwr; | ||
2604 | int call_close = 0; | 2610 | int call_close = 0; |
2605 | 2611 | ||
2606 | dprintk("%s: begin!\n", __func__); | 2612 | dprintk("%s: begin!\n", __func__); |
@@ -2608,21 +2614,27 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2608 | goto out_wait; | 2614 | goto out_wait; |
2609 | 2615 | ||
2610 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; | 2616 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; |
2611 | calldata->arg.fmode = FMODE_READ|FMODE_WRITE; | ||
2612 | spin_lock(&state->owner->so_lock); | 2617 | spin_lock(&state->owner->so_lock); |
2618 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); | ||
2619 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); | ||
2620 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); | ||
2613 | /* Calculate the change in open mode */ | 2621 | /* Calculate the change in open mode */ |
2622 | calldata->arg.fmode = 0; | ||
2614 | if (state->n_rdwr == 0) { | 2623 | if (state->n_rdwr == 0) { |
2615 | if (state->n_rdonly == 0) { | 2624 | if (state->n_rdonly == 0) |
2616 | call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags); | 2625 | call_close |= is_rdonly; |
2617 | call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); | 2626 | else if (is_rdonly) |
2618 | calldata->arg.fmode &= ~FMODE_READ; | 2627 | calldata->arg.fmode |= FMODE_READ; |
2619 | } | 2628 | if (state->n_wronly == 0) |
2620 | if (state->n_wronly == 0) { | 2629 | call_close |= is_wronly; |
2621 | call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags); | 2630 | else if (is_wronly) |
2622 | call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); | 2631 | calldata->arg.fmode |= FMODE_WRITE; |
2623 | calldata->arg.fmode &= ~FMODE_WRITE; | 2632 | } else if (is_rdwr) |
2624 | } | 2633 | calldata->arg.fmode |= FMODE_READ|FMODE_WRITE; |
2625 | } | 2634 | |
2635 | if (calldata->arg.fmode == 0) | ||
2636 | call_close |= is_rdwr; | ||
2637 | |||
2626 | if (!nfs4_valid_open_stateid(state)) | 2638 | if (!nfs4_valid_open_stateid(state)) |
2627 | call_close = 0; | 2639 | call_close = 0; |
2628 | spin_unlock(&state->owner->so_lock); | 2640 | spin_unlock(&state->owner->so_lock); |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index a043f618cd5a..22fe35104c0c 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -799,18 +799,6 @@ __nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t fl_owner) | |||
799 | return NULL; | 799 | return NULL; |
800 | } | 800 | } |
801 | 801 | ||
802 | static void | ||
803 | free_lock_state_work(struct work_struct *work) | ||
804 | { | ||
805 | struct nfs4_lock_state *lsp = container_of(work, | ||
806 | struct nfs4_lock_state, ls_release); | ||
807 | struct nfs4_state *state = lsp->ls_state; | ||
808 | struct nfs_server *server = state->owner->so_server; | ||
809 | struct nfs_client *clp = server->nfs_client; | ||
810 | |||
811 | clp->cl_mvops->free_lock_state(server, lsp); | ||
812 | } | ||
813 | |||
814 | /* | 802 | /* |
815 | * Return a compatible lock_state. If no initialized lock_state structure | 803 | * Return a compatible lock_state. If no initialized lock_state structure |
816 | * exists, return an uninitialized one. | 804 | * exists, return an uninitialized one. |
@@ -832,7 +820,6 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f | |||
832 | if (lsp->ls_seqid.owner_id < 0) | 820 | if (lsp->ls_seqid.owner_id < 0) |
833 | goto out_free; | 821 | goto out_free; |
834 | INIT_LIST_HEAD(&lsp->ls_locks); | 822 | INIT_LIST_HEAD(&lsp->ls_locks); |
835 | INIT_WORK(&lsp->ls_release, free_lock_state_work); | ||
836 | return lsp; | 823 | return lsp; |
837 | out_free: | 824 | out_free: |
838 | kfree(lsp); | 825 | kfree(lsp); |
@@ -896,12 +883,13 @@ void nfs4_put_lock_state(struct nfs4_lock_state *lsp) | |||
896 | if (list_empty(&state->lock_states)) | 883 | if (list_empty(&state->lock_states)) |
897 | clear_bit(LK_STATE_IN_USE, &state->flags); | 884 | clear_bit(LK_STATE_IN_USE, &state->flags); |
898 | spin_unlock(&state->state_lock); | 885 | spin_unlock(&state->state_lock); |
899 | if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags)) | 886 | server = state->owner->so_server; |
900 | queue_work(nfsiod_workqueue, &lsp->ls_release); | 887 | if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags)) { |
901 | else { | 888 | struct nfs_client *clp = server->nfs_client; |
902 | server = state->owner->so_server; | 889 | |
890 | clp->cl_mvops->free_lock_state(server, lsp); | ||
891 | } else | ||
903 | nfs4_free_lock_state(server, lsp); | 892 | nfs4_free_lock_state(server, lsp); |
904 | } | ||
905 | } | 893 | } |
906 | 894 | ||
907 | static void nfs4_fl_copy_lock(struct file_lock *dst, struct file_lock *src) | 895 | static void nfs4_fl_copy_lock(struct file_lock *dst, struct file_lock *src) |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index ba491926df5f..be7cbce6e4c7 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -116,7 +116,7 @@ __nfs_iocounter_wait(struct nfs_io_counter *c) | |||
116 | if (atomic_read(&c->io_count) == 0) | 116 | if (atomic_read(&c->io_count) == 0) |
117 | break; | 117 | break; |
118 | ret = nfs_wait_bit_killable(&q.key); | 118 | ret = nfs_wait_bit_killable(&q.key); |
119 | } while (atomic_read(&c->io_count) != 0); | 119 | } while (atomic_read(&c->io_count) != 0 && !ret); |
120 | finish_wait(wq, &q.wait); | 120 | finish_wait(wq, &q.wait); |
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
@@ -139,26 +139,49 @@ nfs_iocounter_wait(struct nfs_io_counter *c) | |||
139 | /* | 139 | /* |
140 | * nfs_page_group_lock - lock the head of the page group | 140 | * nfs_page_group_lock - lock the head of the page group |
141 | * @req - request in group that is to be locked | 141 | * @req - request in group that is to be locked |
142 | * @nonblock - if true don't block waiting for lock | ||
142 | * | 143 | * |
143 | * this lock must be held if modifying the page group list | 144 | * this lock must be held if modifying the page group list |
144 | * | 145 | * |
145 | * returns result from wait_on_bit_lock: 0 on success, < 0 on error | 146 | * return 0 on success, < 0 on error: -EDELAY if nonblocking or the |
147 | * result from wait_on_bit_lock | ||
148 | * | ||
149 | * NOTE: calling with nonblock=false should always have set the | ||
150 | * lock bit (see fs/buffer.c and other uses of wait_on_bit_lock | ||
151 | * with TASK_UNINTERRUPTIBLE), so there is no need to check the result. | ||
146 | */ | 152 | */ |
147 | int | 153 | int |
148 | nfs_page_group_lock(struct nfs_page *req, bool wait) | 154 | nfs_page_group_lock(struct nfs_page *req, bool nonblock) |
149 | { | 155 | { |
150 | struct nfs_page *head = req->wb_head; | 156 | struct nfs_page *head = req->wb_head; |
151 | int ret; | ||
152 | 157 | ||
153 | WARN_ON_ONCE(head != head->wb_head); | 158 | WARN_ON_ONCE(head != head->wb_head); |
154 | 159 | ||
155 | do { | 160 | if (!test_and_set_bit(PG_HEADLOCK, &head->wb_flags)) |
156 | ret = wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, | 161 | return 0; |
157 | TASK_UNINTERRUPTIBLE); | ||
158 | } while (wait && ret != 0); | ||
159 | 162 | ||
160 | WARN_ON_ONCE(ret > 0); | 163 | if (!nonblock) |
161 | return ret; | 164 | return wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, |
165 | TASK_UNINTERRUPTIBLE); | ||
166 | |||
167 | return -EAGAIN; | ||
168 | } | ||
169 | |||
170 | /* | ||
171 | * nfs_page_group_lock_wait - wait for the lock to clear, but don't grab it | ||
172 | * @req - a request in the group | ||
173 | * | ||
174 | * This is a blocking call to wait for the group lock to be cleared. | ||
175 | */ | ||
176 | void | ||
177 | nfs_page_group_lock_wait(struct nfs_page *req) | ||
178 | { | ||
179 | struct nfs_page *head = req->wb_head; | ||
180 | |||
181 | WARN_ON_ONCE(head != head->wb_head); | ||
182 | |||
183 | wait_on_bit(&head->wb_flags, PG_HEADLOCK, | ||
184 | TASK_UNINTERRUPTIBLE); | ||
162 | } | 185 | } |
163 | 186 | ||
164 | /* | 187 | /* |
@@ -219,7 +242,7 @@ bool nfs_page_group_sync_on_bit(struct nfs_page *req, unsigned int bit) | |||
219 | { | 242 | { |
220 | bool ret; | 243 | bool ret; |
221 | 244 | ||
222 | nfs_page_group_lock(req, true); | 245 | nfs_page_group_lock(req, false); |
223 | ret = nfs_page_group_sync_on_bit_locked(req, bit); | 246 | ret = nfs_page_group_sync_on_bit_locked(req, bit); |
224 | nfs_page_group_unlock(req); | 247 | nfs_page_group_unlock(req); |
225 | 248 | ||
@@ -701,10 +724,11 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, | |||
701 | struct nfs_pgio_header *hdr) | 724 | struct nfs_pgio_header *hdr) |
702 | { | 725 | { |
703 | struct nfs_page *req; | 726 | struct nfs_page *req; |
704 | struct page **pages; | 727 | struct page **pages, |
728 | *last_page; | ||
705 | struct list_head *head = &desc->pg_list; | 729 | struct list_head *head = &desc->pg_list; |
706 | struct nfs_commit_info cinfo; | 730 | struct nfs_commit_info cinfo; |
707 | unsigned int pagecount; | 731 | unsigned int pagecount, pageused; |
708 | 732 | ||
709 | pagecount = nfs_page_array_len(desc->pg_base, desc->pg_count); | 733 | pagecount = nfs_page_array_len(desc->pg_base, desc->pg_count); |
710 | if (!nfs_pgarray_set(&hdr->page_array, pagecount)) | 734 | if (!nfs_pgarray_set(&hdr->page_array, pagecount)) |
@@ -712,12 +736,23 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, | |||
712 | 736 | ||
713 | nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq); | 737 | nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq); |
714 | pages = hdr->page_array.pagevec; | 738 | pages = hdr->page_array.pagevec; |
739 | last_page = NULL; | ||
740 | pageused = 0; | ||
715 | while (!list_empty(head)) { | 741 | while (!list_empty(head)) { |
716 | req = nfs_list_entry(head->next); | 742 | req = nfs_list_entry(head->next); |
717 | nfs_list_remove_request(req); | 743 | nfs_list_remove_request(req); |
718 | nfs_list_add_request(req, &hdr->pages); | 744 | nfs_list_add_request(req, &hdr->pages); |
719 | *pages++ = req->wb_page; | 745 | |
746 | if (WARN_ON_ONCE(pageused >= pagecount)) | ||
747 | return nfs_pgio_error(desc, hdr); | ||
748 | |||
749 | if (!last_page || last_page != req->wb_page) { | ||
750 | *pages++ = last_page = req->wb_page; | ||
751 | pageused++; | ||
752 | } | ||
720 | } | 753 | } |
754 | if (WARN_ON_ONCE(pageused != pagecount)) | ||
755 | return nfs_pgio_error(desc, hdr); | ||
721 | 756 | ||
722 | if ((desc->pg_ioflags & FLUSH_COND_STABLE) && | 757 | if ((desc->pg_ioflags & FLUSH_COND_STABLE) && |
723 | (desc->pg_moreio || nfs_reqs_to_commit(&cinfo))) | 758 | (desc->pg_moreio || nfs_reqs_to_commit(&cinfo))) |
@@ -788,6 +823,14 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, | |||
788 | return false; | 823 | return false; |
789 | if (req_offset(req) != req_offset(prev) + prev->wb_bytes) | 824 | if (req_offset(req) != req_offset(prev) + prev->wb_bytes) |
790 | return false; | 825 | return false; |
826 | if (req->wb_page == prev->wb_page) { | ||
827 | if (req->wb_pgbase != prev->wb_pgbase + prev->wb_bytes) | ||
828 | return false; | ||
829 | } else { | ||
830 | if (req->wb_pgbase != 0 || | ||
831 | prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE) | ||
832 | return false; | ||
833 | } | ||
791 | } | 834 | } |
792 | size = pgio->pg_ops->pg_test(pgio, prev, req); | 835 | size = pgio->pg_ops->pg_test(pgio, prev, req); |
793 | WARN_ON_ONCE(size > req->wb_bytes); | 836 | WARN_ON_ONCE(size > req->wb_bytes); |
@@ -858,13 +901,8 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, | |||
858 | struct nfs_page *subreq; | 901 | struct nfs_page *subreq; |
859 | unsigned int bytes_left = 0; | 902 | unsigned int bytes_left = 0; |
860 | unsigned int offset, pgbase; | 903 | unsigned int offset, pgbase; |
861 | int ret; | ||
862 | 904 | ||
863 | ret = nfs_page_group_lock(req, false); | 905 | nfs_page_group_lock(req, false); |
864 | if (ret < 0) { | ||
865 | desc->pg_error = ret; | ||
866 | return 0; | ||
867 | } | ||
868 | 906 | ||
869 | subreq = req; | 907 | subreq = req; |
870 | bytes_left = subreq->wb_bytes; | 908 | bytes_left = subreq->wb_bytes; |
@@ -886,11 +924,7 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, | |||
886 | if (desc->pg_recoalesce) | 924 | if (desc->pg_recoalesce) |
887 | return 0; | 925 | return 0; |
888 | /* retry add_request for this subreq */ | 926 | /* retry add_request for this subreq */ |
889 | ret = nfs_page_group_lock(req, false); | 927 | nfs_page_group_lock(req, false); |
890 | if (ret < 0) { | ||
891 | desc->pg_error = ret; | ||
892 | return 0; | ||
893 | } | ||
894 | continue; | 928 | continue; |
895 | } | 929 | } |
896 | 930 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index e3b5cf28bdc5..175d5d073ccf 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -241,7 +241,7 @@ static bool nfs_page_group_covers_page(struct nfs_page *req) | |||
241 | unsigned int pos = 0; | 241 | unsigned int pos = 0; |
242 | unsigned int len = nfs_page_length(req->wb_page); | 242 | unsigned int len = nfs_page_length(req->wb_page); |
243 | 243 | ||
244 | nfs_page_group_lock(req, true); | 244 | nfs_page_group_lock(req, false); |
245 | 245 | ||
246 | do { | 246 | do { |
247 | tmp = nfs_page_group_search_locked(req->wb_head, pos); | 247 | tmp = nfs_page_group_search_locked(req->wb_head, pos); |
@@ -478,10 +478,23 @@ try_again: | |||
478 | return NULL; | 478 | return NULL; |
479 | } | 479 | } |
480 | 480 | ||
481 | /* lock each request in the page group */ | 481 | /* holding inode lock, so always make a non-blocking call to try the |
482 | ret = nfs_page_group_lock(head, false); | 482 | * page group lock */ |
483 | if (ret < 0) | 483 | ret = nfs_page_group_lock(head, true); |
484 | if (ret < 0) { | ||
485 | spin_unlock(&inode->i_lock); | ||
486 | |||
487 | if (!nonblock && ret == -EAGAIN) { | ||
488 | nfs_page_group_lock_wait(head); | ||
489 | nfs_release_request(head); | ||
490 | goto try_again; | ||
491 | } | ||
492 | |||
493 | nfs_release_request(head); | ||
484 | return ERR_PTR(ret); | 494 | return ERR_PTR(ret); |
495 | } | ||
496 | |||
497 | /* lock each request in the page group */ | ||
485 | subreq = head; | 498 | subreq = head; |
486 | do { | 499 | do { |
487 | /* | 500 | /* |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index f9821ce6658a..e94457c33ad6 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -2657,6 +2657,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, | |||
2657 | struct xdr_stream *xdr = cd->xdr; | 2657 | struct xdr_stream *xdr = cd->xdr; |
2658 | int start_offset = xdr->buf->len; | 2658 | int start_offset = xdr->buf->len; |
2659 | int cookie_offset; | 2659 | int cookie_offset; |
2660 | u32 name_and_cookie; | ||
2660 | int entry_bytes; | 2661 | int entry_bytes; |
2661 | __be32 nfserr = nfserr_toosmall; | 2662 | __be32 nfserr = nfserr_toosmall; |
2662 | __be64 wire_offset; | 2663 | __be64 wire_offset; |
@@ -2718,7 +2719,14 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, | |||
2718 | cd->rd_maxcount -= entry_bytes; | 2719 | cd->rd_maxcount -= entry_bytes; |
2719 | if (!cd->rd_dircount) | 2720 | if (!cd->rd_dircount) |
2720 | goto fail; | 2721 | goto fail; |
2721 | cd->rd_dircount--; | 2722 | /* |
2723 | * RFC 3530 14.2.24 describes rd_dircount as only a "hint", so | ||
2724 | * let's always let through the first entry, at least: | ||
2725 | */ | ||
2726 | name_and_cookie = 4 * XDR_QUADLEN(namlen) + 8; | ||
2727 | if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) | ||
2728 | goto fail; | ||
2729 | cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); | ||
2722 | cd->cookie_offset = cookie_offset; | 2730 | cd->cookie_offset = cookie_offset; |
2723 | skip_entry: | 2731 | skip_entry: |
2724 | cd->common.err = nfs_ok; | 2732 | cd->common.err = nfs_ok; |
@@ -3321,6 +3329,10 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | |||
3321 | } | 3329 | } |
3322 | maxcount = min_t(int, maxcount-16, bytes_left); | 3330 | maxcount = min_t(int, maxcount-16, bytes_left); |
3323 | 3331 | ||
3332 | /* RFC 3530 14.2.24 allows us to ignore dircount when it's 0: */ | ||
3333 | if (!readdir->rd_dircount) | ||
3334 | readdir->rd_dircount = INT_MAX; | ||
3335 | |||
3324 | readdir->xdr = xdr; | 3336 | readdir->xdr = xdr; |
3325 | readdir->rd_maxcount = maxcount; | 3337 | readdir->rd_maxcount = maxcount; |
3326 | readdir->common.err = 0; | 3338 | readdir->common.err = 0; |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 6252b173a465..d071e7f23de2 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/buffer_head.h> | 24 | #include <linux/buffer_head.h> |
25 | #include <linux/gfp.h> | 25 | #include <linux/gfp.h> |
26 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
27 | #include <linux/pagemap.h> | ||
27 | #include <linux/writeback.h> | 28 | #include <linux/writeback.h> |
28 | #include <linux/aio.h> | 29 | #include <linux/aio.h> |
29 | #include "nilfs.h" | 30 | #include "nilfs.h" |
@@ -219,10 +220,10 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc) | |||
219 | 220 | ||
220 | static int nilfs_set_page_dirty(struct page *page) | 221 | static int nilfs_set_page_dirty(struct page *page) |
221 | { | 222 | { |
223 | struct inode *inode = page->mapping->host; | ||
222 | int ret = __set_page_dirty_nobuffers(page); | 224 | int ret = __set_page_dirty_nobuffers(page); |
223 | 225 | ||
224 | if (page_has_buffers(page)) { | 226 | if (page_has_buffers(page)) { |
225 | struct inode *inode = page->mapping->host; | ||
226 | unsigned nr_dirty = 0; | 227 | unsigned nr_dirty = 0; |
227 | struct buffer_head *bh, *head; | 228 | struct buffer_head *bh, *head; |
228 | 229 | ||
@@ -245,6 +246,10 @@ static int nilfs_set_page_dirty(struct page *page) | |||
245 | 246 | ||
246 | if (nr_dirty) | 247 | if (nr_dirty) |
247 | nilfs_set_file_dirty(inode, nr_dirty); | 248 | nilfs_set_file_dirty(inode, nr_dirty); |
249 | } else if (ret) { | ||
250 | unsigned nr_dirty = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits); | ||
251 | |||
252 | nilfs_set_file_dirty(inode, nr_dirty); | ||
248 | } | 253 | } |
249 | return ret; | 254 | return ret; |
250 | } | 255 | } |
diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c index 238a5930cb3c..9d7e2b9659cb 100644 --- a/fs/notify/fdinfo.c +++ b/fs/notify/fdinfo.c | |||
@@ -42,7 +42,7 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | |||
42 | { | 42 | { |
43 | struct { | 43 | struct { |
44 | struct file_handle handle; | 44 | struct file_handle handle; |
45 | u8 pad[64]; | 45 | u8 pad[MAX_HANDLE_SZ]; |
46 | } f; | 46 | } f; |
47 | int size, ret, i; | 47 | int size, ret, i; |
48 | 48 | ||
@@ -50,7 +50,7 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | |||
50 | size = f.handle.handle_bytes >> 2; | 50 | size = f.handle.handle_bytes >> 2; |
51 | 51 | ||
52 | ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0); | 52 | ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0); |
53 | if ((ret == 255) || (ret == -ENOSPC)) { | 53 | if ((ret == FILEID_INVALID) || (ret < 0)) { |
54 | WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret); | 54 | WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret); |
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index 1ec141e758d7..62e8ec619b4c 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c | |||
@@ -160,9 +160,18 @@ static void o2quo_make_decision(struct work_struct *work) | |||
160 | } | 160 | } |
161 | 161 | ||
162 | out: | 162 | out: |
163 | spin_unlock(&qs->qs_lock); | 163 | if (fence) { |
164 | if (fence) | 164 | spin_unlock(&qs->qs_lock); |
165 | o2quo_fence_self(); | 165 | o2quo_fence_self(); |
166 | } else { | ||
167 | mlog(ML_NOTICE, "not fencing this node, heartbeating: %d, " | ||
168 | "connected: %d, lowest: %d (%sreachable)\n", | ||
169 | qs->qs_heartbeating, qs->qs_connected, lowest_hb, | ||
170 | lowest_reachable ? "" : "un"); | ||
171 | spin_unlock(&qs->qs_lock); | ||
172 | |||
173 | } | ||
174 | |||
166 | } | 175 | } |
167 | 176 | ||
168 | static void o2quo_set_hold(struct o2quo_state *qs, u8 node) | 177 | static void o2quo_set_hold(struct o2quo_state *qs, u8 node) |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 681691bc233a..ea34952f9496 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -1480,6 +1480,14 @@ static int o2net_set_nodelay(struct socket *sock) | |||
1480 | return ret; | 1480 | return ret; |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | static int o2net_set_usertimeout(struct socket *sock) | ||
1484 | { | ||
1485 | int user_timeout = O2NET_TCP_USER_TIMEOUT; | ||
1486 | |||
1487 | return kernel_setsockopt(sock, SOL_TCP, TCP_USER_TIMEOUT, | ||
1488 | (char *)&user_timeout, sizeof(user_timeout)); | ||
1489 | } | ||
1490 | |||
1483 | static void o2net_initialize_handshake(void) | 1491 | static void o2net_initialize_handshake(void) |
1484 | { | 1492 | { |
1485 | o2net_hand->o2hb_heartbeat_timeout_ms = cpu_to_be32( | 1493 | o2net_hand->o2hb_heartbeat_timeout_ms = cpu_to_be32( |
@@ -1536,16 +1544,20 @@ static void o2net_idle_timer(unsigned long data) | |||
1536 | #endif | 1544 | #endif |
1537 | 1545 | ||
1538 | printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been " | 1546 | printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been " |
1539 | "idle for %lu.%lu secs, shutting it down.\n", SC_NODEF_ARGS(sc), | 1547 | "idle for %lu.%lu secs.\n", |
1540 | msecs / 1000, msecs % 1000); | 1548 | SC_NODEF_ARGS(sc), msecs / 1000, msecs % 1000); |
1541 | 1549 | ||
1542 | /* | 1550 | /* idle timerout happen, don't shutdown the connection, but |
1543 | * Initialize the nn_timeout so that the next connection attempt | 1551 | * make fence decision. Maybe the connection can recover before |
1544 | * will continue in o2net_start_connect. | 1552 | * the decision is made. |
1545 | */ | 1553 | */ |
1546 | atomic_set(&nn->nn_timeout, 1); | 1554 | atomic_set(&nn->nn_timeout, 1); |
1555 | o2quo_conn_err(o2net_num_from_nn(nn)); | ||
1556 | queue_delayed_work(o2net_wq, &nn->nn_still_up, | ||
1557 | msecs_to_jiffies(O2NET_QUORUM_DELAY_MS)); | ||
1558 | |||
1559 | o2net_sc_reset_idle_timer(sc); | ||
1547 | 1560 | ||
1548 | o2net_sc_queue_work(sc, &sc->sc_shutdown_work); | ||
1549 | } | 1561 | } |
1550 | 1562 | ||
1551 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) | 1563 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) |
@@ -1560,6 +1572,15 @@ static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) | |||
1560 | 1572 | ||
1561 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) | 1573 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) |
1562 | { | 1574 | { |
1575 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); | ||
1576 | |||
1577 | /* clear fence decision since the connection recover from timeout*/ | ||
1578 | if (atomic_read(&nn->nn_timeout)) { | ||
1579 | o2quo_conn_up(o2net_num_from_nn(nn)); | ||
1580 | cancel_delayed_work(&nn->nn_still_up); | ||
1581 | atomic_set(&nn->nn_timeout, 0); | ||
1582 | } | ||
1583 | |||
1563 | /* Only push out an existing timer */ | 1584 | /* Only push out an existing timer */ |
1564 | if (timer_pending(&sc->sc_idle_timeout)) | 1585 | if (timer_pending(&sc->sc_idle_timeout)) |
1565 | o2net_sc_reset_idle_timer(sc); | 1586 | o2net_sc_reset_idle_timer(sc); |
@@ -1650,6 +1671,12 @@ static void o2net_start_connect(struct work_struct *work) | |||
1650 | goto out; | 1671 | goto out; |
1651 | } | 1672 | } |
1652 | 1673 | ||
1674 | ret = o2net_set_usertimeout(sock); | ||
1675 | if (ret) { | ||
1676 | mlog(ML_ERROR, "set TCP_USER_TIMEOUT failed with %d\n", ret); | ||
1677 | goto out; | ||
1678 | } | ||
1679 | |||
1653 | o2net_register_callbacks(sc->sc_sock->sk, sc); | 1680 | o2net_register_callbacks(sc->sc_sock->sk, sc); |
1654 | 1681 | ||
1655 | spin_lock(&nn->nn_lock); | 1682 | spin_lock(&nn->nn_lock); |
@@ -1831,6 +1858,12 @@ static int o2net_accept_one(struct socket *sock, int *more) | |||
1831 | goto out; | 1858 | goto out; |
1832 | } | 1859 | } |
1833 | 1860 | ||
1861 | ret = o2net_set_usertimeout(new_sock); | ||
1862 | if (ret) { | ||
1863 | mlog(ML_ERROR, "set TCP_USER_TIMEOUT failed with %d\n", ret); | ||
1864 | goto out; | ||
1865 | } | ||
1866 | |||
1834 | slen = sizeof(sin); | 1867 | slen = sizeof(sin); |
1835 | ret = new_sock->ops->getname(new_sock, (struct sockaddr *) &sin, | 1868 | ret = new_sock->ops->getname(new_sock, (struct sockaddr *) &sin, |
1836 | &slen, 1); | 1869 | &slen, 1); |
diff --git a/fs/ocfs2/cluster/tcp.h b/fs/ocfs2/cluster/tcp.h index 5bada2a69b50..c571e849fda4 100644 --- a/fs/ocfs2/cluster/tcp.h +++ b/fs/ocfs2/cluster/tcp.h | |||
@@ -63,6 +63,7 @@ typedef void (o2net_post_msg_handler_func)(int status, void *data, | |||
63 | #define O2NET_KEEPALIVE_DELAY_MS_DEFAULT 2000 | 63 | #define O2NET_KEEPALIVE_DELAY_MS_DEFAULT 2000 |
64 | #define O2NET_IDLE_TIMEOUT_MS_DEFAULT 30000 | 64 | #define O2NET_IDLE_TIMEOUT_MS_DEFAULT 30000 |
65 | 65 | ||
66 | #define O2NET_TCP_USER_TIMEOUT 0x7fffffff | ||
66 | 67 | ||
67 | /* TODO: figure this out.... */ | 68 | /* TODO: figure this out.... */ |
68 | static inline int o2net_link_down(int err, struct socket *sock) | 69 | static inline int o2net_link_down(int err, struct socket *sock) |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 3ec906ef5d9a..e3cfa0227026 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -655,12 +655,9 @@ void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm, | |||
655 | clear_bit(bit, res->refmap); | 655 | clear_bit(bit, res->refmap); |
656 | } | 656 | } |
657 | 657 | ||
658 | 658 | static void __dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | |
659 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
660 | struct dlm_lock_resource *res) | 659 | struct dlm_lock_resource *res) |
661 | { | 660 | { |
662 | assert_spin_locked(&res->spinlock); | ||
663 | |||
664 | res->inflight_locks++; | 661 | res->inflight_locks++; |
665 | 662 | ||
666 | mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, | 663 | mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, |
@@ -668,6 +665,13 @@ void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | |||
668 | __builtin_return_address(0)); | 665 | __builtin_return_address(0)); |
669 | } | 666 | } |
670 | 667 | ||
668 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
669 | struct dlm_lock_resource *res) | ||
670 | { | ||
671 | assert_spin_locked(&res->spinlock); | ||
672 | __dlm_lockres_grab_inflight_ref(dlm, res); | ||
673 | } | ||
674 | |||
671 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, | 675 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, |
672 | struct dlm_lock_resource *res) | 676 | struct dlm_lock_resource *res) |
673 | { | 677 | { |
@@ -894,10 +898,8 @@ lookup: | |||
894 | /* finally add the lockres to its hash bucket */ | 898 | /* finally add the lockres to its hash bucket */ |
895 | __dlm_insert_lockres(dlm, res); | 899 | __dlm_insert_lockres(dlm, res); |
896 | 900 | ||
897 | /* Grab inflight ref to pin the resource */ | 901 | /* since this lockres is new it doesn't not require the spinlock */ |
898 | spin_lock(&res->spinlock); | 902 | __dlm_lockres_grab_inflight_ref(dlm, res); |
899 | dlm_lockres_grab_inflight_ref(dlm, res); | ||
900 | spin_unlock(&res->spinlock); | ||
901 | 903 | ||
902 | /* get an extra ref on the mle in case this is a BLOCK | 904 | /* get an extra ref on the mle in case this is a BLOCK |
903 | * if so, the creator of the BLOCK may try to put the last | 905 | * if so, the creator of the BLOCK may try to put the last |
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 6f66b3751ace..53e6c40ed4c6 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -35,9 +35,8 @@ | |||
35 | copy_to_user((typeof(a) __user *)b, &(a), sizeof(a)) | 35 | copy_to_user((typeof(a) __user *)b, &(a), sizeof(a)) |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * This call is void because we are already reporting an error that may | 38 | * This is just a best-effort to tell userspace that this request |
39 | * be -EFAULT. The error will be returned from the ioctl(2) call. It's | 39 | * caused the error. |
40 | * just a best-effort to tell userspace that this request caused the error. | ||
41 | */ | 40 | */ |
42 | static inline void o2info_set_request_error(struct ocfs2_info_request *kreq, | 41 | static inline void o2info_set_request_error(struct ocfs2_info_request *kreq, |
43 | struct ocfs2_info_request __user *req) | 42 | struct ocfs2_info_request __user *req) |
@@ -146,136 +145,105 @@ bail: | |||
146 | static int ocfs2_info_handle_blocksize(struct inode *inode, | 145 | static int ocfs2_info_handle_blocksize(struct inode *inode, |
147 | struct ocfs2_info_request __user *req) | 146 | struct ocfs2_info_request __user *req) |
148 | { | 147 | { |
149 | int status = -EFAULT; | ||
150 | struct ocfs2_info_blocksize oib; | 148 | struct ocfs2_info_blocksize oib; |
151 | 149 | ||
152 | if (o2info_from_user(oib, req)) | 150 | if (o2info_from_user(oib, req)) |
153 | goto bail; | 151 | return -EFAULT; |
154 | 152 | ||
155 | oib.ib_blocksize = inode->i_sb->s_blocksize; | 153 | oib.ib_blocksize = inode->i_sb->s_blocksize; |
156 | 154 | ||
157 | o2info_set_request_filled(&oib.ib_req); | 155 | o2info_set_request_filled(&oib.ib_req); |
158 | 156 | ||
159 | if (o2info_to_user(oib, req)) | 157 | if (o2info_to_user(oib, req)) |
160 | goto bail; | 158 | return -EFAULT; |
161 | |||
162 | status = 0; | ||
163 | bail: | ||
164 | if (status) | ||
165 | o2info_set_request_error(&oib.ib_req, req); | ||
166 | 159 | ||
167 | return status; | 160 | return 0; |
168 | } | 161 | } |
169 | 162 | ||
170 | static int ocfs2_info_handle_clustersize(struct inode *inode, | 163 | static int ocfs2_info_handle_clustersize(struct inode *inode, |
171 | struct ocfs2_info_request __user *req) | 164 | struct ocfs2_info_request __user *req) |
172 | { | 165 | { |
173 | int status = -EFAULT; | ||
174 | struct ocfs2_info_clustersize oic; | 166 | struct ocfs2_info_clustersize oic; |
175 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 167 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
176 | 168 | ||
177 | if (o2info_from_user(oic, req)) | 169 | if (o2info_from_user(oic, req)) |
178 | goto bail; | 170 | return -EFAULT; |
179 | 171 | ||
180 | oic.ic_clustersize = osb->s_clustersize; | 172 | oic.ic_clustersize = osb->s_clustersize; |
181 | 173 | ||
182 | o2info_set_request_filled(&oic.ic_req); | 174 | o2info_set_request_filled(&oic.ic_req); |
183 | 175 | ||
184 | if (o2info_to_user(oic, req)) | 176 | if (o2info_to_user(oic, req)) |
185 | goto bail; | 177 | return -EFAULT; |
186 | |||
187 | status = 0; | ||
188 | bail: | ||
189 | if (status) | ||
190 | o2info_set_request_error(&oic.ic_req, req); | ||
191 | 178 | ||
192 | return status; | 179 | return 0; |
193 | } | 180 | } |
194 | 181 | ||
195 | static int ocfs2_info_handle_maxslots(struct inode *inode, | 182 | static int ocfs2_info_handle_maxslots(struct inode *inode, |
196 | struct ocfs2_info_request __user *req) | 183 | struct ocfs2_info_request __user *req) |
197 | { | 184 | { |
198 | int status = -EFAULT; | ||
199 | struct ocfs2_info_maxslots oim; | 185 | struct ocfs2_info_maxslots oim; |
200 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 186 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
201 | 187 | ||
202 | if (o2info_from_user(oim, req)) | 188 | if (o2info_from_user(oim, req)) |
203 | goto bail; | 189 | return -EFAULT; |
204 | 190 | ||
205 | oim.im_max_slots = osb->max_slots; | 191 | oim.im_max_slots = osb->max_slots; |
206 | 192 | ||
207 | o2info_set_request_filled(&oim.im_req); | 193 | o2info_set_request_filled(&oim.im_req); |
208 | 194 | ||
209 | if (o2info_to_user(oim, req)) | 195 | if (o2info_to_user(oim, req)) |
210 | goto bail; | 196 | return -EFAULT; |
211 | 197 | ||
212 | status = 0; | 198 | return 0; |
213 | bail: | ||
214 | if (status) | ||
215 | o2info_set_request_error(&oim.im_req, req); | ||
216 | |||
217 | return status; | ||
218 | } | 199 | } |
219 | 200 | ||
220 | static int ocfs2_info_handle_label(struct inode *inode, | 201 | static int ocfs2_info_handle_label(struct inode *inode, |
221 | struct ocfs2_info_request __user *req) | 202 | struct ocfs2_info_request __user *req) |
222 | { | 203 | { |
223 | int status = -EFAULT; | ||
224 | struct ocfs2_info_label oil; | 204 | struct ocfs2_info_label oil; |
225 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 205 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
226 | 206 | ||
227 | if (o2info_from_user(oil, req)) | 207 | if (o2info_from_user(oil, req)) |
228 | goto bail; | 208 | return -EFAULT; |
229 | 209 | ||
230 | memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN); | 210 | memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN); |
231 | 211 | ||
232 | o2info_set_request_filled(&oil.il_req); | 212 | o2info_set_request_filled(&oil.il_req); |
233 | 213 | ||
234 | if (o2info_to_user(oil, req)) | 214 | if (o2info_to_user(oil, req)) |
235 | goto bail; | 215 | return -EFAULT; |
236 | 216 | ||
237 | status = 0; | 217 | return 0; |
238 | bail: | ||
239 | if (status) | ||
240 | o2info_set_request_error(&oil.il_req, req); | ||
241 | |||
242 | return status; | ||
243 | } | 218 | } |
244 | 219 | ||
245 | static int ocfs2_info_handle_uuid(struct inode *inode, | 220 | static int ocfs2_info_handle_uuid(struct inode *inode, |
246 | struct ocfs2_info_request __user *req) | 221 | struct ocfs2_info_request __user *req) |
247 | { | 222 | { |
248 | int status = -EFAULT; | ||
249 | struct ocfs2_info_uuid oiu; | 223 | struct ocfs2_info_uuid oiu; |
250 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 224 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
251 | 225 | ||
252 | if (o2info_from_user(oiu, req)) | 226 | if (o2info_from_user(oiu, req)) |
253 | goto bail; | 227 | return -EFAULT; |
254 | 228 | ||
255 | memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1); | 229 | memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1); |
256 | 230 | ||
257 | o2info_set_request_filled(&oiu.iu_req); | 231 | o2info_set_request_filled(&oiu.iu_req); |
258 | 232 | ||
259 | if (o2info_to_user(oiu, req)) | 233 | if (o2info_to_user(oiu, req)) |
260 | goto bail; | 234 | return -EFAULT; |
261 | |||
262 | status = 0; | ||
263 | bail: | ||
264 | if (status) | ||
265 | o2info_set_request_error(&oiu.iu_req, req); | ||
266 | 235 | ||
267 | return status; | 236 | return 0; |
268 | } | 237 | } |
269 | 238 | ||
270 | static int ocfs2_info_handle_fs_features(struct inode *inode, | 239 | static int ocfs2_info_handle_fs_features(struct inode *inode, |
271 | struct ocfs2_info_request __user *req) | 240 | struct ocfs2_info_request __user *req) |
272 | { | 241 | { |
273 | int status = -EFAULT; | ||
274 | struct ocfs2_info_fs_features oif; | 242 | struct ocfs2_info_fs_features oif; |
275 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 243 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
276 | 244 | ||
277 | if (o2info_from_user(oif, req)) | 245 | if (o2info_from_user(oif, req)) |
278 | goto bail; | 246 | return -EFAULT; |
279 | 247 | ||
280 | oif.if_compat_features = osb->s_feature_compat; | 248 | oif.if_compat_features = osb->s_feature_compat; |
281 | oif.if_incompat_features = osb->s_feature_incompat; | 249 | oif.if_incompat_features = osb->s_feature_incompat; |
@@ -284,39 +252,28 @@ static int ocfs2_info_handle_fs_features(struct inode *inode, | |||
284 | o2info_set_request_filled(&oif.if_req); | 252 | o2info_set_request_filled(&oif.if_req); |
285 | 253 | ||
286 | if (o2info_to_user(oif, req)) | 254 | if (o2info_to_user(oif, req)) |
287 | goto bail; | 255 | return -EFAULT; |
288 | 256 | ||
289 | status = 0; | 257 | return 0; |
290 | bail: | ||
291 | if (status) | ||
292 | o2info_set_request_error(&oif.if_req, req); | ||
293 | |||
294 | return status; | ||
295 | } | 258 | } |
296 | 259 | ||
297 | static int ocfs2_info_handle_journal_size(struct inode *inode, | 260 | static int ocfs2_info_handle_journal_size(struct inode *inode, |
298 | struct ocfs2_info_request __user *req) | 261 | struct ocfs2_info_request __user *req) |
299 | { | 262 | { |
300 | int status = -EFAULT; | ||
301 | struct ocfs2_info_journal_size oij; | 263 | struct ocfs2_info_journal_size oij; |
302 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 264 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
303 | 265 | ||
304 | if (o2info_from_user(oij, req)) | 266 | if (o2info_from_user(oij, req)) |
305 | goto bail; | 267 | return -EFAULT; |
306 | 268 | ||
307 | oij.ij_journal_size = i_size_read(osb->journal->j_inode); | 269 | oij.ij_journal_size = i_size_read(osb->journal->j_inode); |
308 | 270 | ||
309 | o2info_set_request_filled(&oij.ij_req); | 271 | o2info_set_request_filled(&oij.ij_req); |
310 | 272 | ||
311 | if (o2info_to_user(oij, req)) | 273 | if (o2info_to_user(oij, req)) |
312 | goto bail; | 274 | return -EFAULT; |
313 | 275 | ||
314 | status = 0; | 276 | return 0; |
315 | bail: | ||
316 | if (status) | ||
317 | o2info_set_request_error(&oij.ij_req, req); | ||
318 | |||
319 | return status; | ||
320 | } | 277 | } |
321 | 278 | ||
322 | static int ocfs2_info_scan_inode_alloc(struct ocfs2_super *osb, | 279 | static int ocfs2_info_scan_inode_alloc(struct ocfs2_super *osb, |
@@ -373,7 +330,7 @@ static int ocfs2_info_handle_freeinode(struct inode *inode, | |||
373 | u32 i; | 330 | u32 i; |
374 | u64 blkno = -1; | 331 | u64 blkno = -1; |
375 | char namebuf[40]; | 332 | char namebuf[40]; |
376 | int status = -EFAULT, type = INODE_ALLOC_SYSTEM_INODE; | 333 | int status, type = INODE_ALLOC_SYSTEM_INODE; |
377 | struct ocfs2_info_freeinode *oifi = NULL; | 334 | struct ocfs2_info_freeinode *oifi = NULL; |
378 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 335 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
379 | struct inode *inode_alloc = NULL; | 336 | struct inode *inode_alloc = NULL; |
@@ -385,8 +342,10 @@ static int ocfs2_info_handle_freeinode(struct inode *inode, | |||
385 | goto out_err; | 342 | goto out_err; |
386 | } | 343 | } |
387 | 344 | ||
388 | if (o2info_from_user(*oifi, req)) | 345 | if (o2info_from_user(*oifi, req)) { |
389 | goto bail; | 346 | status = -EFAULT; |
347 | goto out_free; | ||
348 | } | ||
390 | 349 | ||
391 | oifi->ifi_slotnum = osb->max_slots; | 350 | oifi->ifi_slotnum = osb->max_slots; |
392 | 351 | ||
@@ -424,14 +383,16 @@ static int ocfs2_info_handle_freeinode(struct inode *inode, | |||
424 | 383 | ||
425 | o2info_set_request_filled(&oifi->ifi_req); | 384 | o2info_set_request_filled(&oifi->ifi_req); |
426 | 385 | ||
427 | if (o2info_to_user(*oifi, req)) | 386 | if (o2info_to_user(*oifi, req)) { |
428 | goto bail; | 387 | status = -EFAULT; |
388 | goto out_free; | ||
389 | } | ||
429 | 390 | ||
430 | status = 0; | 391 | status = 0; |
431 | bail: | 392 | bail: |
432 | if (status) | 393 | if (status) |
433 | o2info_set_request_error(&oifi->ifi_req, req); | 394 | o2info_set_request_error(&oifi->ifi_req, req); |
434 | 395 | out_free: | |
435 | kfree(oifi); | 396 | kfree(oifi); |
436 | out_err: | 397 | out_err: |
437 | return status; | 398 | return status; |
@@ -658,7 +619,7 @@ static int ocfs2_info_handle_freefrag(struct inode *inode, | |||
658 | { | 619 | { |
659 | u64 blkno = -1; | 620 | u64 blkno = -1; |
660 | char namebuf[40]; | 621 | char namebuf[40]; |
661 | int status = -EFAULT, type = GLOBAL_BITMAP_SYSTEM_INODE; | 622 | int status, type = GLOBAL_BITMAP_SYSTEM_INODE; |
662 | 623 | ||
663 | struct ocfs2_info_freefrag *oiff; | 624 | struct ocfs2_info_freefrag *oiff; |
664 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 625 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
@@ -671,8 +632,10 @@ static int ocfs2_info_handle_freefrag(struct inode *inode, | |||
671 | goto out_err; | 632 | goto out_err; |
672 | } | 633 | } |
673 | 634 | ||
674 | if (o2info_from_user(*oiff, req)) | 635 | if (o2info_from_user(*oiff, req)) { |
675 | goto bail; | 636 | status = -EFAULT; |
637 | goto out_free; | ||
638 | } | ||
676 | /* | 639 | /* |
677 | * chunksize from userspace should be power of 2. | 640 | * chunksize from userspace should be power of 2. |
678 | */ | 641 | */ |
@@ -711,14 +674,14 @@ static int ocfs2_info_handle_freefrag(struct inode *inode, | |||
711 | 674 | ||
712 | if (o2info_to_user(*oiff, req)) { | 675 | if (o2info_to_user(*oiff, req)) { |
713 | status = -EFAULT; | 676 | status = -EFAULT; |
714 | goto bail; | 677 | goto out_free; |
715 | } | 678 | } |
716 | 679 | ||
717 | status = 0; | 680 | status = 0; |
718 | bail: | 681 | bail: |
719 | if (status) | 682 | if (status) |
720 | o2info_set_request_error(&oiff->iff_req, req); | 683 | o2info_set_request_error(&oiff->iff_req, req); |
721 | 684 | out_free: | |
722 | kfree(oiff); | 685 | kfree(oiff); |
723 | out_err: | 686 | out_err: |
724 | return status; | 687 | return status; |
@@ -727,23 +690,17 @@ out_err: | |||
727 | static int ocfs2_info_handle_unknown(struct inode *inode, | 690 | static int ocfs2_info_handle_unknown(struct inode *inode, |
728 | struct ocfs2_info_request __user *req) | 691 | struct ocfs2_info_request __user *req) |
729 | { | 692 | { |
730 | int status = -EFAULT; | ||
731 | struct ocfs2_info_request oir; | 693 | struct ocfs2_info_request oir; |
732 | 694 | ||
733 | if (o2info_from_user(oir, req)) | 695 | if (o2info_from_user(oir, req)) |
734 | goto bail; | 696 | return -EFAULT; |
735 | 697 | ||
736 | o2info_clear_request_filled(&oir); | 698 | o2info_clear_request_filled(&oir); |
737 | 699 | ||
738 | if (o2info_to_user(oir, req)) | 700 | if (o2info_to_user(oir, req)) |
739 | goto bail; | 701 | return -EFAULT; |
740 | 702 | ||
741 | status = 0; | 703 | return 0; |
742 | bail: | ||
743 | if (status) | ||
744 | o2info_set_request_error(&oir, req); | ||
745 | |||
746 | return status; | ||
747 | } | 704 | } |
748 | 705 | ||
749 | /* | 706 | /* |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index ddb662b32447..4142546aedae 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -2532,6 +2532,7 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb) | |||
2532 | kfree(osb->journal); | 2532 | kfree(osb->journal); |
2533 | kfree(osb->local_alloc_copy); | 2533 | kfree(osb->local_alloc_copy); |
2534 | kfree(osb->uuid_str); | 2534 | kfree(osb->uuid_str); |
2535 | kfree(osb->vol_label); | ||
2535 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); | 2536 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); |
2536 | memset(osb, 0, sizeof(struct ocfs2_super)); | 2537 | memset(osb, 0, sizeof(struct ocfs2_super)); |
2537 | } | 2538 | } |
diff --git a/fs/pnode.c b/fs/pnode.c index 302bf22c4a30..aae331a5d03b 100644 --- a/fs/pnode.c +++ b/fs/pnode.c | |||
@@ -381,6 +381,7 @@ static void __propagate_umount(struct mount *mnt) | |||
381 | * other children | 381 | * other children |
382 | */ | 382 | */ |
383 | if (child && list_empty(&child->mnt_mounts)) { | 383 | if (child && list_empty(&child->mnt_mounts)) { |
384 | list_del_init(&child->mnt_child); | ||
384 | hlist_del_init_rcu(&child->mnt_hash); | 385 | hlist_del_init_rcu(&child->mnt_hash); |
385 | hlist_add_before_rcu(&child->mnt_hash, &mnt->mnt_hash); | 386 | hlist_add_before_rcu(&child->mnt_hash, &mnt->mnt_hash); |
386 | } | 387 | } |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index dfc791c42d64..c34156888d70 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -931,23 +931,32 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end, | |||
931 | while (addr < end) { | 931 | while (addr < end) { |
932 | struct vm_area_struct *vma = find_vma(walk->mm, addr); | 932 | struct vm_area_struct *vma = find_vma(walk->mm, addr); |
933 | pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm->v2)); | 933 | pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm->v2)); |
934 | unsigned long vm_end; | 934 | /* End of address space hole, which we mark as non-present. */ |
935 | unsigned long hole_end; | ||
935 | 936 | ||
936 | if (!vma) { | 937 | if (vma) |
937 | vm_end = end; | 938 | hole_end = min(end, vma->vm_start); |
938 | } else { | 939 | else |
939 | vm_end = min(end, vma->vm_end); | 940 | hole_end = end; |
940 | if (vma->vm_flags & VM_SOFTDIRTY) | 941 | |
941 | pme.pme |= PM_STATUS2(pm->v2, __PM_SOFT_DIRTY); | 942 | for (; addr < hole_end; addr += PAGE_SIZE) { |
943 | err = add_to_pagemap(addr, &pme, pm); | ||
944 | if (err) | ||
945 | goto out; | ||
942 | } | 946 | } |
943 | 947 | ||
944 | for (; addr < vm_end; addr += PAGE_SIZE) { | 948 | if (!vma) |
949 | break; | ||
950 | |||
951 | /* Addresses in the VMA. */ | ||
952 | if (vma->vm_flags & VM_SOFTDIRTY) | ||
953 | pme.pme |= PM_STATUS2(pm->v2, __PM_SOFT_DIRTY); | ||
954 | for (; addr < min(end, vma->vm_end); addr += PAGE_SIZE) { | ||
945 | err = add_to_pagemap(addr, &pme, pm); | 955 | err = add_to_pagemap(addr, &pme, pm); |
946 | if (err) | 956 | if (err) |
947 | goto out; | 957 | goto out; |
948 | } | 958 | } |
949 | } | 959 | } |
950 | |||
951 | out: | 960 | out: |
952 | return err; | 961 | return err; |
953 | } | 962 | } |
@@ -65,7 +65,7 @@ int sync_filesystem(struct super_block *sb) | |||
65 | return ret; | 65 | return ret; |
66 | return __sync_filesystem(sb, 1); | 66 | return __sync_filesystem(sb, 1); |
67 | } | 67 | } |
68 | EXPORT_SYMBOL_GPL(sync_filesystem); | 68 | EXPORT_SYMBOL(sync_filesystem); |
69 | 69 | ||
70 | 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) |
71 | { | 71 | { |
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 6eaf5edf1ea1..e77db621ec89 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -45,7 +45,7 @@ void udf_free_inode(struct inode *inode) | |||
45 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); | 45 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); |
46 | } | 46 | } |
47 | 47 | ||
48 | struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | 48 | struct inode *udf_new_inode(struct inode *dir, umode_t mode) |
49 | { | 49 | { |
50 | struct super_block *sb = dir->i_sb; | 50 | struct super_block *sb = dir->i_sb; |
51 | struct udf_sb_info *sbi = UDF_SB(sb); | 51 | struct udf_sb_info *sbi = UDF_SB(sb); |
@@ -55,14 +55,12 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
55 | struct udf_inode_info *iinfo; | 55 | struct udf_inode_info *iinfo; |
56 | struct udf_inode_info *dinfo = UDF_I(dir); | 56 | struct udf_inode_info *dinfo = UDF_I(dir); |
57 | struct logicalVolIntegrityDescImpUse *lvidiu; | 57 | struct logicalVolIntegrityDescImpUse *lvidiu; |
58 | int err; | ||
58 | 59 | ||
59 | inode = new_inode(sb); | 60 | inode = new_inode(sb); |
60 | 61 | ||
61 | if (!inode) { | 62 | if (!inode) |
62 | *err = -ENOMEM; | 63 | return ERR_PTR(-ENOMEM); |
63 | return NULL; | ||
64 | } | ||
65 | *err = -ENOSPC; | ||
66 | 64 | ||
67 | iinfo = UDF_I(inode); | 65 | iinfo = UDF_I(inode); |
68 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { | 66 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { |
@@ -80,21 +78,22 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
80 | } | 78 | } |
81 | if (!iinfo->i_ext.i_data) { | 79 | if (!iinfo->i_ext.i_data) { |
82 | iput(inode); | 80 | iput(inode); |
83 | *err = -ENOMEM; | 81 | return ERR_PTR(-ENOMEM); |
84 | return NULL; | ||
85 | } | 82 | } |
86 | 83 | ||
84 | err = -ENOSPC; | ||
87 | block = udf_new_block(dir->i_sb, NULL, | 85 | block = udf_new_block(dir->i_sb, NULL, |
88 | dinfo->i_location.partitionReferenceNum, | 86 | dinfo->i_location.partitionReferenceNum, |
89 | start, err); | 87 | start, &err); |
90 | if (*err) { | 88 | if (err) { |
91 | iput(inode); | 89 | iput(inode); |
92 | return NULL; | 90 | return ERR_PTR(err); |
93 | } | 91 | } |
94 | 92 | ||
95 | lvidiu = udf_sb_lvidiu(sb); | 93 | lvidiu = udf_sb_lvidiu(sb); |
96 | if (lvidiu) { | 94 | if (lvidiu) { |
97 | iinfo->i_unique = lvid_get_unique_id(sb); | 95 | iinfo->i_unique = lvid_get_unique_id(sb); |
96 | inode->i_generation = iinfo->i_unique; | ||
98 | mutex_lock(&sbi->s_alloc_mutex); | 97 | mutex_lock(&sbi->s_alloc_mutex); |
99 | if (S_ISDIR(mode)) | 98 | if (S_ISDIR(mode)) |
100 | le32_add_cpu(&lvidiu->numDirs, 1); | 99 | le32_add_cpu(&lvidiu->numDirs, 1); |
@@ -123,9 +122,12 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
123 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 122 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
124 | inode->i_mtime = inode->i_atime = inode->i_ctime = | 123 | inode->i_mtime = inode->i_atime = inode->i_ctime = |
125 | iinfo->i_crtime = current_fs_time(inode->i_sb); | 124 | iinfo->i_crtime = current_fs_time(inode->i_sb); |
126 | insert_inode_hash(inode); | 125 | if (unlikely(insert_inode_locked(inode) < 0)) { |
126 | make_bad_inode(inode); | ||
127 | iput(inode); | ||
128 | return ERR_PTR(-EIO); | ||
129 | } | ||
127 | mark_inode_dirty(inode); | 130 | mark_inode_dirty(inode); |
128 | 131 | ||
129 | *err = 0; | ||
130 | return inode; | 132 | return inode; |
131 | } | 133 | } |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 236cd48184c2..08598843288f 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -51,7 +51,6 @@ MODULE_LICENSE("GPL"); | |||
51 | 51 | ||
52 | static umode_t udf_convert_permissions(struct fileEntry *); | 52 | static umode_t udf_convert_permissions(struct fileEntry *); |
53 | static int udf_update_inode(struct inode *, int); | 53 | static int udf_update_inode(struct inode *, int); |
54 | static void udf_fill_inode(struct inode *, struct buffer_head *); | ||
55 | static int udf_sync_inode(struct inode *inode); | 54 | static int udf_sync_inode(struct inode *inode); |
56 | static int udf_alloc_i_data(struct inode *inode, size_t size); | 55 | static int udf_alloc_i_data(struct inode *inode, size_t size); |
57 | static sector_t inode_getblk(struct inode *, sector_t, int *, int *); | 56 | static sector_t inode_getblk(struct inode *, sector_t, int *, int *); |
@@ -1271,12 +1270,33 @@ update_time: | |||
1271 | return 0; | 1270 | return 0; |
1272 | } | 1271 | } |
1273 | 1272 | ||
1274 | static void __udf_read_inode(struct inode *inode) | 1273 | /* |
1274 | * Maximum length of linked list formed by ICB hierarchy. The chosen number is | ||
1275 | * arbitrary - just that we hopefully don't limit any real use of rewritten | ||
1276 | * inode on write-once media but avoid looping for too long on corrupted media. | ||
1277 | */ | ||
1278 | #define UDF_MAX_ICB_NESTING 1024 | ||
1279 | |||
1280 | static int udf_read_inode(struct inode *inode) | ||
1275 | { | 1281 | { |
1276 | struct buffer_head *bh = NULL; | 1282 | struct buffer_head *bh = NULL; |
1277 | struct fileEntry *fe; | 1283 | struct fileEntry *fe; |
1284 | struct extendedFileEntry *efe; | ||
1278 | uint16_t ident; | 1285 | uint16_t ident; |
1279 | struct udf_inode_info *iinfo = UDF_I(inode); | 1286 | struct udf_inode_info *iinfo = UDF_I(inode); |
1287 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | ||
1288 | struct kernel_lb_addr *iloc = &iinfo->i_location; | ||
1289 | unsigned int link_count; | ||
1290 | unsigned int indirections = 0; | ||
1291 | int ret = -EIO; | ||
1292 | |||
1293 | reread: | ||
1294 | if (iloc->logicalBlockNum >= | ||
1295 | sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) { | ||
1296 | udf_debug("block=%d, partition=%d out of range\n", | ||
1297 | iloc->logicalBlockNum, iloc->partitionReferenceNum); | ||
1298 | return -EIO; | ||
1299 | } | ||
1280 | 1300 | ||
1281 | /* | 1301 | /* |
1282 | * Set defaults, but the inode is still incomplete! | 1302 | * Set defaults, but the inode is still incomplete! |
@@ -1290,78 +1310,54 @@ static void __udf_read_inode(struct inode *inode) | |||
1290 | * i_nlink = 1 | 1310 | * i_nlink = 1 |
1291 | * i_op = NULL; | 1311 | * i_op = NULL; |
1292 | */ | 1312 | */ |
1293 | bh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 0, &ident); | 1313 | bh = udf_read_ptagged(inode->i_sb, iloc, 0, &ident); |
1294 | if (!bh) { | 1314 | if (!bh) { |
1295 | udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino); | 1315 | udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino); |
1296 | make_bad_inode(inode); | 1316 | return -EIO; |
1297 | return; | ||
1298 | } | 1317 | } |
1299 | 1318 | ||
1300 | if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && | 1319 | if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && |
1301 | ident != TAG_IDENT_USE) { | 1320 | ident != TAG_IDENT_USE) { |
1302 | udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n", | 1321 | udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n", |
1303 | inode->i_ino, ident); | 1322 | inode->i_ino, ident); |
1304 | brelse(bh); | 1323 | goto out; |
1305 | make_bad_inode(inode); | ||
1306 | return; | ||
1307 | } | 1324 | } |
1308 | 1325 | ||
1309 | fe = (struct fileEntry *)bh->b_data; | 1326 | fe = (struct fileEntry *)bh->b_data; |
1327 | efe = (struct extendedFileEntry *)bh->b_data; | ||
1310 | 1328 | ||
1311 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { | 1329 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { |
1312 | struct buffer_head *ibh; | 1330 | struct buffer_head *ibh; |
1313 | 1331 | ||
1314 | ibh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 1, | 1332 | ibh = udf_read_ptagged(inode->i_sb, iloc, 1, &ident); |
1315 | &ident); | ||
1316 | if (ident == TAG_IDENT_IE && ibh) { | 1333 | if (ident == TAG_IDENT_IE && ibh) { |
1317 | struct buffer_head *nbh = NULL; | ||
1318 | struct kernel_lb_addr loc; | 1334 | struct kernel_lb_addr loc; |
1319 | struct indirectEntry *ie; | 1335 | struct indirectEntry *ie; |
1320 | 1336 | ||
1321 | ie = (struct indirectEntry *)ibh->b_data; | 1337 | ie = (struct indirectEntry *)ibh->b_data; |
1322 | loc = lelb_to_cpu(ie->indirectICB.extLocation); | 1338 | loc = lelb_to_cpu(ie->indirectICB.extLocation); |
1323 | 1339 | ||
1324 | if (ie->indirectICB.extLength && | 1340 | if (ie->indirectICB.extLength) { |
1325 | (nbh = udf_read_ptagged(inode->i_sb, &loc, 0, | 1341 | brelse(ibh); |
1326 | &ident))) { | 1342 | memcpy(&iinfo->i_location, &loc, |
1327 | if (ident == TAG_IDENT_FE || | 1343 | sizeof(struct kernel_lb_addr)); |
1328 | ident == TAG_IDENT_EFE) { | 1344 | if (++indirections > UDF_MAX_ICB_NESTING) { |
1329 | memcpy(&iinfo->i_location, | 1345 | udf_err(inode->i_sb, |
1330 | &loc, | 1346 | "too many ICBs in ICB hierarchy" |
1331 | sizeof(struct kernel_lb_addr)); | 1347 | " (max %d supported)\n", |
1332 | brelse(bh); | 1348 | UDF_MAX_ICB_NESTING); |
1333 | brelse(ibh); | 1349 | goto out; |
1334 | brelse(nbh); | ||
1335 | __udf_read_inode(inode); | ||
1336 | return; | ||
1337 | } | 1350 | } |
1338 | brelse(nbh); | 1351 | brelse(bh); |
1352 | goto reread; | ||
1339 | } | 1353 | } |
1340 | } | 1354 | } |
1341 | brelse(ibh); | 1355 | brelse(ibh); |
1342 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { | 1356 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { |
1343 | udf_err(inode->i_sb, "unsupported strategy type: %d\n", | 1357 | udf_err(inode->i_sb, "unsupported strategy type: %d\n", |
1344 | le16_to_cpu(fe->icbTag.strategyType)); | 1358 | le16_to_cpu(fe->icbTag.strategyType)); |
1345 | brelse(bh); | 1359 | goto out; |
1346 | make_bad_inode(inode); | ||
1347 | return; | ||
1348 | } | 1360 | } |
1349 | udf_fill_inode(inode, bh); | ||
1350 | |||
1351 | brelse(bh); | ||
1352 | } | ||
1353 | |||
1354 | static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | ||
1355 | { | ||
1356 | struct fileEntry *fe; | ||
1357 | struct extendedFileEntry *efe; | ||
1358 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | ||
1359 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1360 | unsigned int link_count; | ||
1361 | |||
1362 | fe = (struct fileEntry *)bh->b_data; | ||
1363 | efe = (struct extendedFileEntry *)bh->b_data; | ||
1364 | |||
1365 | if (fe->icbTag.strategyType == cpu_to_le16(4)) | 1361 | if (fe->icbTag.strategyType == cpu_to_le16(4)) |
1366 | iinfo->i_strat4096 = 0; | 1362 | iinfo->i_strat4096 = 0; |
1367 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ | 1363 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ |
@@ -1378,11 +1374,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1378 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { | 1374 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { |
1379 | iinfo->i_efe = 1; | 1375 | iinfo->i_efe = 1; |
1380 | iinfo->i_use = 0; | 1376 | iinfo->i_use = 0; |
1381 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1377 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1382 | sizeof(struct extendedFileEntry))) { | 1378 | sizeof(struct extendedFileEntry)); |
1383 | make_bad_inode(inode); | 1379 | if (ret) |
1384 | return; | 1380 | goto out; |
1385 | } | ||
1386 | memcpy(iinfo->i_ext.i_data, | 1381 | memcpy(iinfo->i_ext.i_data, |
1387 | bh->b_data + sizeof(struct extendedFileEntry), | 1382 | bh->b_data + sizeof(struct extendedFileEntry), |
1388 | inode->i_sb->s_blocksize - | 1383 | inode->i_sb->s_blocksize - |
@@ -1390,11 +1385,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1390 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { | 1385 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { |
1391 | iinfo->i_efe = 0; | 1386 | iinfo->i_efe = 0; |
1392 | iinfo->i_use = 0; | 1387 | iinfo->i_use = 0; |
1393 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1388 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1394 | sizeof(struct fileEntry))) { | 1389 | sizeof(struct fileEntry)); |
1395 | make_bad_inode(inode); | 1390 | if (ret) |
1396 | return; | 1391 | goto out; |
1397 | } | ||
1398 | memcpy(iinfo->i_ext.i_data, | 1392 | memcpy(iinfo->i_ext.i_data, |
1399 | bh->b_data + sizeof(struct fileEntry), | 1393 | bh->b_data + sizeof(struct fileEntry), |
1400 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1394 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
@@ -1404,18 +1398,18 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1404 | iinfo->i_lenAlloc = le32_to_cpu( | 1398 | iinfo->i_lenAlloc = le32_to_cpu( |
1405 | ((struct unallocSpaceEntry *)bh->b_data)-> | 1399 | ((struct unallocSpaceEntry *)bh->b_data)-> |
1406 | lengthAllocDescs); | 1400 | lengthAllocDescs); |
1407 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1401 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1408 | sizeof(struct unallocSpaceEntry))) { | 1402 | sizeof(struct unallocSpaceEntry)); |
1409 | make_bad_inode(inode); | 1403 | if (ret) |
1410 | return; | 1404 | goto out; |
1411 | } | ||
1412 | memcpy(iinfo->i_ext.i_data, | 1405 | memcpy(iinfo->i_ext.i_data, |
1413 | bh->b_data + sizeof(struct unallocSpaceEntry), | 1406 | bh->b_data + sizeof(struct unallocSpaceEntry), |
1414 | inode->i_sb->s_blocksize - | 1407 | inode->i_sb->s_blocksize - |
1415 | sizeof(struct unallocSpaceEntry)); | 1408 | sizeof(struct unallocSpaceEntry)); |
1416 | return; | 1409 | return 0; |
1417 | } | 1410 | } |
1418 | 1411 | ||
1412 | ret = -EIO; | ||
1419 | read_lock(&sbi->s_cred_lock); | 1413 | read_lock(&sbi->s_cred_lock); |
1420 | i_uid_write(inode, le32_to_cpu(fe->uid)); | 1414 | i_uid_write(inode, le32_to_cpu(fe->uid)); |
1421 | if (!uid_valid(inode->i_uid) || | 1415 | if (!uid_valid(inode->i_uid) || |
@@ -1441,8 +1435,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1441 | read_unlock(&sbi->s_cred_lock); | 1435 | read_unlock(&sbi->s_cred_lock); |
1442 | 1436 | ||
1443 | link_count = le16_to_cpu(fe->fileLinkCount); | 1437 | link_count = le16_to_cpu(fe->fileLinkCount); |
1444 | if (!link_count) | 1438 | if (!link_count) { |
1445 | link_count = 1; | 1439 | ret = -ESTALE; |
1440 | goto out; | ||
1441 | } | ||
1446 | set_nlink(inode, link_count); | 1442 | set_nlink(inode, link_count); |
1447 | 1443 | ||
1448 | inode->i_size = le64_to_cpu(fe->informationLength); | 1444 | inode->i_size = le64_to_cpu(fe->informationLength); |
@@ -1488,6 +1484,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1488 | iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); | 1484 | iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); |
1489 | iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint); | 1485 | iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint); |
1490 | } | 1486 | } |
1487 | inode->i_generation = iinfo->i_unique; | ||
1491 | 1488 | ||
1492 | switch (fe->icbTag.fileType) { | 1489 | switch (fe->icbTag.fileType) { |
1493 | case ICBTAG_FILE_TYPE_DIRECTORY: | 1490 | case ICBTAG_FILE_TYPE_DIRECTORY: |
@@ -1537,8 +1534,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1537 | default: | 1534 | default: |
1538 | udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n", | 1535 | udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n", |
1539 | inode->i_ino, fe->icbTag.fileType); | 1536 | inode->i_ino, fe->icbTag.fileType); |
1540 | make_bad_inode(inode); | 1537 | goto out; |
1541 | return; | ||
1542 | } | 1538 | } |
1543 | if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { | 1539 | if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { |
1544 | struct deviceSpec *dsea = | 1540 | struct deviceSpec *dsea = |
@@ -1549,8 +1545,12 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1549 | le32_to_cpu(dsea->minorDeviceIdent))); | 1545 | le32_to_cpu(dsea->minorDeviceIdent))); |
1550 | /* Developer ID ??? */ | 1546 | /* Developer ID ??? */ |
1551 | } else | 1547 | } else |
1552 | make_bad_inode(inode); | 1548 | goto out; |
1553 | } | 1549 | } |
1550 | ret = 0; | ||
1551 | out: | ||
1552 | brelse(bh); | ||
1553 | return ret; | ||
1554 | } | 1554 | } |
1555 | 1555 | ||
1556 | static int udf_alloc_i_data(struct inode *inode, size_t size) | 1556 | static int udf_alloc_i_data(struct inode *inode, size_t size) |
@@ -1664,7 +1664,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1664 | FE_PERM_U_DELETE | FE_PERM_U_CHATTR)); | 1664 | FE_PERM_U_DELETE | FE_PERM_U_CHATTR)); |
1665 | fe->permissions = cpu_to_le32(udfperms); | 1665 | fe->permissions = cpu_to_le32(udfperms); |
1666 | 1666 | ||
1667 | if (S_ISDIR(inode->i_mode)) | 1667 | if (S_ISDIR(inode->i_mode) && inode->i_nlink > 0) |
1668 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink - 1); | 1668 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink - 1); |
1669 | else | 1669 | else |
1670 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink); | 1670 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink); |
@@ -1830,32 +1830,23 @@ struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr *ino) | |||
1830 | { | 1830 | { |
1831 | unsigned long block = udf_get_lb_pblock(sb, ino, 0); | 1831 | unsigned long block = udf_get_lb_pblock(sb, ino, 0); |
1832 | struct inode *inode = iget_locked(sb, block); | 1832 | struct inode *inode = iget_locked(sb, block); |
1833 | int err; | ||
1833 | 1834 | ||
1834 | if (!inode) | 1835 | if (!inode) |
1835 | return NULL; | 1836 | return ERR_PTR(-ENOMEM); |
1836 | |||
1837 | if (inode->i_state & I_NEW) { | ||
1838 | memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); | ||
1839 | __udf_read_inode(inode); | ||
1840 | unlock_new_inode(inode); | ||
1841 | } | ||
1842 | 1837 | ||
1843 | if (is_bad_inode(inode)) | 1838 | if (!(inode->i_state & I_NEW)) |
1844 | goto out_iput; | 1839 | return inode; |
1845 | 1840 | ||
1846 | if (ino->logicalBlockNum >= UDF_SB(sb)-> | 1841 | memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); |
1847 | s_partmaps[ino->partitionReferenceNum].s_partition_len) { | 1842 | err = udf_read_inode(inode); |
1848 | udf_debug("block=%d, partition=%d out of range\n", | 1843 | if (err < 0) { |
1849 | ino->logicalBlockNum, ino->partitionReferenceNum); | 1844 | iget_failed(inode); |
1850 | make_bad_inode(inode); | 1845 | return ERR_PTR(err); |
1851 | goto out_iput; | ||
1852 | } | 1846 | } |
1847 | unlock_new_inode(inode); | ||
1853 | 1848 | ||
1854 | return inode; | 1849 | return inode; |
1855 | |||
1856 | out_iput: | ||
1857 | iput(inode); | ||
1858 | return NULL; | ||
1859 | } | 1850 | } |
1860 | 1851 | ||
1861 | int udf_add_aext(struct inode *inode, struct extent_position *epos, | 1852 | int udf_add_aext(struct inode *inode, struct extent_position *epos, |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 9737cba1357d..c12e260fd6c4 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -270,9 +270,8 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
270 | NULL, 0), | 270 | NULL, 0), |
271 | }; | 271 | }; |
272 | inode = udf_iget(dir->i_sb, lb); | 272 | inode = udf_iget(dir->i_sb, lb); |
273 | if (!inode) { | 273 | if (IS_ERR(inode)) |
274 | return ERR_PTR(-EACCES); | 274 | return inode; |
275 | } | ||
276 | } else | 275 | } else |
277 | #endif /* UDF_RECOVERY */ | 276 | #endif /* UDF_RECOVERY */ |
278 | 277 | ||
@@ -285,9 +284,8 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
285 | 284 | ||
286 | loc = lelb_to_cpu(cfi.icb.extLocation); | 285 | loc = lelb_to_cpu(cfi.icb.extLocation); |
287 | inode = udf_iget(dir->i_sb, &loc); | 286 | inode = udf_iget(dir->i_sb, &loc); |
288 | if (!inode) { | 287 | if (IS_ERR(inode)) |
289 | return ERR_PTR(-EACCES); | 288 | return ERR_CAST(inode); |
290 | } | ||
291 | } | 289 | } |
292 | 290 | ||
293 | return d_splice_alias(inode, dentry); | 291 | return d_splice_alias(inode, dentry); |
@@ -550,32 +548,18 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi, | |||
550 | return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL); | 548 | return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL); |
551 | } | 549 | } |
552 | 550 | ||
553 | static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, | 551 | static int udf_add_nondir(struct dentry *dentry, struct inode *inode) |
554 | bool excl) | ||
555 | { | 552 | { |
553 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
554 | struct inode *dir = dentry->d_parent->d_inode; | ||
556 | struct udf_fileident_bh fibh; | 555 | struct udf_fileident_bh fibh; |
557 | struct inode *inode; | ||
558 | struct fileIdentDesc cfi, *fi; | 556 | struct fileIdentDesc cfi, *fi; |
559 | int err; | 557 | int err; |
560 | struct udf_inode_info *iinfo; | ||
561 | |||
562 | inode = udf_new_inode(dir, mode, &err); | ||
563 | if (!inode) { | ||
564 | return err; | ||
565 | } | ||
566 | |||
567 | iinfo = UDF_I(inode); | ||
568 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
569 | inode->i_data.a_ops = &udf_adinicb_aops; | ||
570 | else | ||
571 | inode->i_data.a_ops = &udf_aops; | ||
572 | inode->i_op = &udf_file_inode_operations; | ||
573 | inode->i_fop = &udf_file_operations; | ||
574 | mark_inode_dirty(inode); | ||
575 | 558 | ||
576 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 559 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
577 | if (!fi) { | 560 | if (unlikely(!fi)) { |
578 | inode_dec_link_count(inode); | 561 | inode_dec_link_count(inode); |
562 | unlock_new_inode(inode); | ||
579 | iput(inode); | 563 | iput(inode); |
580 | return err; | 564 | return err; |
581 | } | 565 | } |
@@ -589,23 +573,21 @@ static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
589 | if (fibh.sbh != fibh.ebh) | 573 | if (fibh.sbh != fibh.ebh) |
590 | brelse(fibh.ebh); | 574 | brelse(fibh.ebh); |
591 | brelse(fibh.sbh); | 575 | brelse(fibh.sbh); |
576 | unlock_new_inode(inode); | ||
592 | d_instantiate(dentry, inode); | 577 | d_instantiate(dentry, inode); |
593 | 578 | ||
594 | return 0; | 579 | return 0; |
595 | } | 580 | } |
596 | 581 | ||
597 | static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | 582 | static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
583 | bool excl) | ||
598 | { | 584 | { |
599 | struct inode *inode; | 585 | struct inode *inode = udf_new_inode(dir, mode); |
600 | struct udf_inode_info *iinfo; | ||
601 | int err; | ||
602 | 586 | ||
603 | inode = udf_new_inode(dir, mode, &err); | 587 | if (IS_ERR(inode)) |
604 | if (!inode) | 588 | return PTR_ERR(inode); |
605 | return err; | ||
606 | 589 | ||
607 | iinfo = UDF_I(inode); | 590 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
608 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
609 | inode->i_data.a_ops = &udf_adinicb_aops; | 591 | inode->i_data.a_ops = &udf_adinicb_aops; |
610 | else | 592 | else |
611 | inode->i_data.a_ops = &udf_aops; | 593 | inode->i_data.a_ops = &udf_aops; |
@@ -613,7 +595,25 @@ static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
613 | inode->i_fop = &udf_file_operations; | 595 | inode->i_fop = &udf_file_operations; |
614 | mark_inode_dirty(inode); | 596 | mark_inode_dirty(inode); |
615 | 597 | ||
598 | return udf_add_nondir(dentry, inode); | ||
599 | } | ||
600 | |||
601 | static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | ||
602 | { | ||
603 | struct inode *inode = udf_new_inode(dir, mode); | ||
604 | |||
605 | if (IS_ERR(inode)) | ||
606 | return PTR_ERR(inode); | ||
607 | |||
608 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
609 | inode->i_data.a_ops = &udf_adinicb_aops; | ||
610 | else | ||
611 | inode->i_data.a_ops = &udf_aops; | ||
612 | inode->i_op = &udf_file_inode_operations; | ||
613 | inode->i_fop = &udf_file_operations; | ||
614 | mark_inode_dirty(inode); | ||
616 | d_tmpfile(dentry, inode); | 615 | d_tmpfile(dentry, inode); |
616 | unlock_new_inode(inode); | ||
617 | return 0; | 617 | return 0; |
618 | } | 618 | } |
619 | 619 | ||
@@ -621,44 +621,16 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
621 | dev_t rdev) | 621 | dev_t rdev) |
622 | { | 622 | { |
623 | struct inode *inode; | 623 | struct inode *inode; |
624 | struct udf_fileident_bh fibh; | ||
625 | struct fileIdentDesc cfi, *fi; | ||
626 | int err; | ||
627 | struct udf_inode_info *iinfo; | ||
628 | 624 | ||
629 | if (!old_valid_dev(rdev)) | 625 | if (!old_valid_dev(rdev)) |
630 | return -EINVAL; | 626 | return -EINVAL; |
631 | 627 | ||
632 | err = -EIO; | 628 | inode = udf_new_inode(dir, mode); |
633 | inode = udf_new_inode(dir, mode, &err); | 629 | if (IS_ERR(inode)) |
634 | if (!inode) | 630 | return PTR_ERR(inode); |
635 | goto out; | ||
636 | 631 | ||
637 | iinfo = UDF_I(inode); | ||
638 | init_special_inode(inode, mode, rdev); | 632 | init_special_inode(inode, mode, rdev); |
639 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 633 | return udf_add_nondir(dentry, inode); |
640 | if (!fi) { | ||
641 | inode_dec_link_count(inode); | ||
642 | iput(inode); | ||
643 | return err; | ||
644 | } | ||
645 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | ||
646 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); | ||
647 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | ||
648 | cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); | ||
649 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | ||
650 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
651 | mark_inode_dirty(dir); | ||
652 | mark_inode_dirty(inode); | ||
653 | |||
654 | if (fibh.sbh != fibh.ebh) | ||
655 | brelse(fibh.ebh); | ||
656 | brelse(fibh.sbh); | ||
657 | d_instantiate(dentry, inode); | ||
658 | err = 0; | ||
659 | |||
660 | out: | ||
661 | return err; | ||
662 | } | 634 | } |
663 | 635 | ||
664 | static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 636 | static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
@@ -670,10 +642,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
670 | struct udf_inode_info *dinfo = UDF_I(dir); | 642 | struct udf_inode_info *dinfo = UDF_I(dir); |
671 | struct udf_inode_info *iinfo; | 643 | struct udf_inode_info *iinfo; |
672 | 644 | ||
673 | err = -EIO; | 645 | inode = udf_new_inode(dir, S_IFDIR | mode); |
674 | inode = udf_new_inode(dir, S_IFDIR | mode, &err); | 646 | if (IS_ERR(inode)) |
675 | if (!inode) | 647 | return PTR_ERR(inode); |
676 | goto out; | ||
677 | 648 | ||
678 | iinfo = UDF_I(inode); | 649 | iinfo = UDF_I(inode); |
679 | inode->i_op = &udf_dir_inode_operations; | 650 | inode->i_op = &udf_dir_inode_operations; |
@@ -681,6 +652,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
681 | fi = udf_add_entry(inode, NULL, &fibh, &cfi, &err); | 652 | fi = udf_add_entry(inode, NULL, &fibh, &cfi, &err); |
682 | if (!fi) { | 653 | if (!fi) { |
683 | inode_dec_link_count(inode); | 654 | inode_dec_link_count(inode); |
655 | unlock_new_inode(inode); | ||
684 | iput(inode); | 656 | iput(inode); |
685 | goto out; | 657 | goto out; |
686 | } | 658 | } |
@@ -699,6 +671,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
699 | if (!fi) { | 671 | if (!fi) { |
700 | clear_nlink(inode); | 672 | clear_nlink(inode); |
701 | mark_inode_dirty(inode); | 673 | mark_inode_dirty(inode); |
674 | unlock_new_inode(inode); | ||
702 | iput(inode); | 675 | iput(inode); |
703 | goto out; | 676 | goto out; |
704 | } | 677 | } |
@@ -710,6 +683,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
710 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 683 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
711 | inc_nlink(dir); | 684 | inc_nlink(dir); |
712 | mark_inode_dirty(dir); | 685 | mark_inode_dirty(dir); |
686 | unlock_new_inode(inode); | ||
713 | d_instantiate(dentry, inode); | 687 | d_instantiate(dentry, inode); |
714 | if (fibh.sbh != fibh.ebh) | 688 | if (fibh.sbh != fibh.ebh) |
715 | brelse(fibh.ebh); | 689 | brelse(fibh.ebh); |
@@ -876,14 +850,11 @@ out: | |||
876 | static int udf_symlink(struct inode *dir, struct dentry *dentry, | 850 | static int udf_symlink(struct inode *dir, struct dentry *dentry, |
877 | const char *symname) | 851 | const char *symname) |
878 | { | 852 | { |
879 | struct inode *inode; | 853 | struct inode *inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO); |
880 | struct pathComponent *pc; | 854 | struct pathComponent *pc; |
881 | const char *compstart; | 855 | const char *compstart; |
882 | struct udf_fileident_bh fibh; | ||
883 | struct extent_position epos = {}; | 856 | struct extent_position epos = {}; |
884 | int eoffset, elen = 0; | 857 | int eoffset, elen = 0; |
885 | struct fileIdentDesc *fi; | ||
886 | struct fileIdentDesc cfi; | ||
887 | uint8_t *ea; | 858 | uint8_t *ea; |
888 | int err; | 859 | int err; |
889 | int block; | 860 | int block; |
@@ -892,9 +863,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
892 | struct udf_inode_info *iinfo; | 863 | struct udf_inode_info *iinfo; |
893 | struct super_block *sb = dir->i_sb; | 864 | struct super_block *sb = dir->i_sb; |
894 | 865 | ||
895 | inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); | 866 | if (IS_ERR(inode)) |
896 | if (!inode) | 867 | return PTR_ERR(inode); |
897 | goto out; | ||
898 | 868 | ||
899 | iinfo = UDF_I(inode); | 869 | iinfo = UDF_I(inode); |
900 | down_write(&iinfo->i_data_sem); | 870 | down_write(&iinfo->i_data_sem); |
@@ -1012,24 +982,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
1012 | mark_inode_dirty(inode); | 982 | mark_inode_dirty(inode); |
1013 | up_write(&iinfo->i_data_sem); | 983 | up_write(&iinfo->i_data_sem); |
1014 | 984 | ||
1015 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 985 | err = udf_add_nondir(dentry, inode); |
1016 | if (!fi) | ||
1017 | goto out_no_entry; | ||
1018 | cfi.icb.extLength = cpu_to_le32(sb->s_blocksize); | ||
1019 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); | ||
1020 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { | ||
1021 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | ||
1022 | cpu_to_le32(lvid_get_unique_id(sb)); | ||
1023 | } | ||
1024 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | ||
1025 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
1026 | mark_inode_dirty(dir); | ||
1027 | if (fibh.sbh != fibh.ebh) | ||
1028 | brelse(fibh.ebh); | ||
1029 | brelse(fibh.sbh); | ||
1030 | d_instantiate(dentry, inode); | ||
1031 | err = 0; | ||
1032 | |||
1033 | out: | 986 | out: |
1034 | kfree(name); | 987 | kfree(name); |
1035 | return err; | 988 | return err; |
@@ -1037,6 +990,7 @@ out: | |||
1037 | out_no_entry: | 990 | out_no_entry: |
1038 | up_write(&iinfo->i_data_sem); | 991 | up_write(&iinfo->i_data_sem); |
1039 | inode_dec_link_count(inode); | 992 | inode_dec_link_count(inode); |
993 | unlock_new_inode(inode); | ||
1040 | iput(inode); | 994 | iput(inode); |
1041 | goto out; | 995 | goto out; |
1042 | } | 996 | } |
@@ -1221,7 +1175,7 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
1221 | struct udf_fileident_bh fibh; | 1175 | struct udf_fileident_bh fibh; |
1222 | 1176 | ||
1223 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) | 1177 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) |
1224 | goto out_unlock; | 1178 | return ERR_PTR(-EACCES); |
1225 | 1179 | ||
1226 | if (fibh.sbh != fibh.ebh) | 1180 | if (fibh.sbh != fibh.ebh) |
1227 | brelse(fibh.ebh); | 1181 | brelse(fibh.ebh); |
@@ -1229,12 +1183,10 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
1229 | 1183 | ||
1230 | tloc = lelb_to_cpu(cfi.icb.extLocation); | 1184 | tloc = lelb_to_cpu(cfi.icb.extLocation); |
1231 | inode = udf_iget(child->d_inode->i_sb, &tloc); | 1185 | inode = udf_iget(child->d_inode->i_sb, &tloc); |
1232 | if (!inode) | 1186 | if (IS_ERR(inode)) |
1233 | goto out_unlock; | 1187 | return ERR_CAST(inode); |
1234 | 1188 | ||
1235 | return d_obtain_alias(inode); | 1189 | return d_obtain_alias(inode); |
1236 | out_unlock: | ||
1237 | return ERR_PTR(-EACCES); | ||
1238 | } | 1190 | } |
1239 | 1191 | ||
1240 | 1192 | ||
@@ -1251,8 +1203,8 @@ static struct dentry *udf_nfs_get_inode(struct super_block *sb, u32 block, | |||
1251 | loc.partitionReferenceNum = partref; | 1203 | loc.partitionReferenceNum = partref; |
1252 | inode = udf_iget(sb, &loc); | 1204 | inode = udf_iget(sb, &loc); |
1253 | 1205 | ||
1254 | if (inode == NULL) | 1206 | if (IS_ERR(inode)) |
1255 | return ERR_PTR(-ENOMEM); | 1207 | return ERR_CAST(inode); |
1256 | 1208 | ||
1257 | if (generation && inode->i_generation != generation) { | 1209 | if (generation && inode->i_generation != generation) { |
1258 | iput(inode); | 1210 | iput(inode); |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 813da94d447b..5401fc33f5cc 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -961,12 +961,14 @@ struct inode *udf_find_metadata_inode_efe(struct super_block *sb, | |||
961 | 961 | ||
962 | metadata_fe = udf_iget(sb, &addr); | 962 | metadata_fe = udf_iget(sb, &addr); |
963 | 963 | ||
964 | if (metadata_fe == NULL) | 964 | if (IS_ERR(metadata_fe)) { |
965 | udf_warn(sb, "metadata inode efe not found\n"); | 965 | udf_warn(sb, "metadata inode efe not found\n"); |
966 | else if (UDF_I(metadata_fe)->i_alloc_type != ICBTAG_FLAG_AD_SHORT) { | 966 | return metadata_fe; |
967 | } | ||
968 | if (UDF_I(metadata_fe)->i_alloc_type != ICBTAG_FLAG_AD_SHORT) { | ||
967 | udf_warn(sb, "metadata inode efe does not have short allocation descriptors!\n"); | 969 | udf_warn(sb, "metadata inode efe does not have short allocation descriptors!\n"); |
968 | iput(metadata_fe); | 970 | iput(metadata_fe); |
969 | metadata_fe = NULL; | 971 | return ERR_PTR(-EIO); |
970 | } | 972 | } |
971 | 973 | ||
972 | return metadata_fe; | 974 | return metadata_fe; |
@@ -978,6 +980,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
978 | struct udf_part_map *map; | 980 | struct udf_part_map *map; |
979 | struct udf_meta_data *mdata; | 981 | struct udf_meta_data *mdata; |
980 | struct kernel_lb_addr addr; | 982 | struct kernel_lb_addr addr; |
983 | struct inode *fe; | ||
981 | 984 | ||
982 | map = &sbi->s_partmaps[partition]; | 985 | map = &sbi->s_partmaps[partition]; |
983 | mdata = &map->s_type_specific.s_metadata; | 986 | mdata = &map->s_type_specific.s_metadata; |
@@ -986,22 +989,24 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
986 | udf_debug("Metadata file location: block = %d part = %d\n", | 989 | udf_debug("Metadata file location: block = %d part = %d\n", |
987 | mdata->s_meta_file_loc, map->s_partition_num); | 990 | mdata->s_meta_file_loc, map->s_partition_num); |
988 | 991 | ||
989 | mdata->s_metadata_fe = udf_find_metadata_inode_efe(sb, | 992 | fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc, |
990 | mdata->s_meta_file_loc, map->s_partition_num); | 993 | map->s_partition_num); |
991 | 994 | if (IS_ERR(fe)) { | |
992 | if (mdata->s_metadata_fe == NULL) { | ||
993 | /* mirror file entry */ | 995 | /* mirror file entry */ |
994 | udf_debug("Mirror metadata file location: block = %d part = %d\n", | 996 | udf_debug("Mirror metadata file location: block = %d part = %d\n", |
995 | mdata->s_mirror_file_loc, map->s_partition_num); | 997 | mdata->s_mirror_file_loc, map->s_partition_num); |
996 | 998 | ||
997 | mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb, | 999 | fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, |
998 | mdata->s_mirror_file_loc, map->s_partition_num); | 1000 | map->s_partition_num); |
999 | 1001 | ||
1000 | if (mdata->s_mirror_fe == NULL) { | 1002 | if (IS_ERR(fe)) { |
1001 | udf_err(sb, "Both metadata and mirror metadata inode efe can not found\n"); | 1003 | udf_err(sb, "Both metadata and mirror metadata inode efe can not found\n"); |
1002 | return -EIO; | 1004 | return PTR_ERR(fe); |
1003 | } | 1005 | } |
1004 | } | 1006 | mdata->s_mirror_fe = fe; |
1007 | } else | ||
1008 | mdata->s_metadata_fe = fe; | ||
1009 | |||
1005 | 1010 | ||
1006 | /* | 1011 | /* |
1007 | * bitmap file entry | 1012 | * bitmap file entry |
@@ -1015,15 +1020,16 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
1015 | udf_debug("Bitmap file location: block = %d part = %d\n", | 1020 | udf_debug("Bitmap file location: block = %d part = %d\n", |
1016 | addr.logicalBlockNum, addr.partitionReferenceNum); | 1021 | addr.logicalBlockNum, addr.partitionReferenceNum); |
1017 | 1022 | ||
1018 | mdata->s_bitmap_fe = udf_iget(sb, &addr); | 1023 | fe = udf_iget(sb, &addr); |
1019 | if (mdata->s_bitmap_fe == NULL) { | 1024 | if (IS_ERR(fe)) { |
1020 | if (sb->s_flags & MS_RDONLY) | 1025 | if (sb->s_flags & MS_RDONLY) |
1021 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); | 1026 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); |
1022 | else { | 1027 | else { |
1023 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); | 1028 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); |
1024 | return -EIO; | 1029 | return PTR_ERR(fe); |
1025 | } | 1030 | } |
1026 | } | 1031 | } else |
1032 | mdata->s_bitmap_fe = fe; | ||
1027 | } | 1033 | } |
1028 | 1034 | ||
1029 | udf_debug("udf_load_metadata_files Ok\n"); | 1035 | udf_debug("udf_load_metadata_files Ok\n"); |
@@ -1111,13 +1117,15 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1111 | phd->unallocSpaceTable.extPosition), | 1117 | phd->unallocSpaceTable.extPosition), |
1112 | .partitionReferenceNum = p_index, | 1118 | .partitionReferenceNum = p_index, |
1113 | }; | 1119 | }; |
1120 | struct inode *inode; | ||
1114 | 1121 | ||
1115 | map->s_uspace.s_table = udf_iget(sb, &loc); | 1122 | inode = udf_iget(sb, &loc); |
1116 | if (!map->s_uspace.s_table) { | 1123 | if (IS_ERR(inode)) { |
1117 | udf_debug("cannot load unallocSpaceTable (part %d)\n", | 1124 | udf_debug("cannot load unallocSpaceTable (part %d)\n", |
1118 | p_index); | 1125 | p_index); |
1119 | return -EIO; | 1126 | return PTR_ERR(inode); |
1120 | } | 1127 | } |
1128 | map->s_uspace.s_table = inode; | ||
1121 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; | 1129 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; |
1122 | udf_debug("unallocSpaceTable (part %d) @ %ld\n", | 1130 | udf_debug("unallocSpaceTable (part %d) @ %ld\n", |
1123 | p_index, map->s_uspace.s_table->i_ino); | 1131 | p_index, map->s_uspace.s_table->i_ino); |
@@ -1144,14 +1152,15 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1144 | phd->freedSpaceTable.extPosition), | 1152 | phd->freedSpaceTable.extPosition), |
1145 | .partitionReferenceNum = p_index, | 1153 | .partitionReferenceNum = p_index, |
1146 | }; | 1154 | }; |
1155 | struct inode *inode; | ||
1147 | 1156 | ||
1148 | map->s_fspace.s_table = udf_iget(sb, &loc); | 1157 | inode = udf_iget(sb, &loc); |
1149 | if (!map->s_fspace.s_table) { | 1158 | if (IS_ERR(inode)) { |
1150 | udf_debug("cannot load freedSpaceTable (part %d)\n", | 1159 | udf_debug("cannot load freedSpaceTable (part %d)\n", |
1151 | p_index); | 1160 | p_index); |
1152 | return -EIO; | 1161 | return PTR_ERR(inode); |
1153 | } | 1162 | } |
1154 | 1163 | map->s_fspace.s_table = inode; | |
1155 | map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; | 1164 | map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; |
1156 | udf_debug("freedSpaceTable (part %d) @ %ld\n", | 1165 | udf_debug("freedSpaceTable (part %d) @ %ld\n", |
1157 | p_index, map->s_fspace.s_table->i_ino); | 1166 | p_index, map->s_fspace.s_table->i_ino); |
@@ -1178,6 +1187,7 @@ static void udf_find_vat_block(struct super_block *sb, int p_index, | |||
1178 | struct udf_part_map *map = &sbi->s_partmaps[p_index]; | 1187 | struct udf_part_map *map = &sbi->s_partmaps[p_index]; |
1179 | sector_t vat_block; | 1188 | sector_t vat_block; |
1180 | struct kernel_lb_addr ino; | 1189 | struct kernel_lb_addr ino; |
1190 | struct inode *inode; | ||
1181 | 1191 | ||
1182 | /* | 1192 | /* |
1183 | * VAT file entry is in the last recorded block. Some broken disks have | 1193 | * VAT file entry is in the last recorded block. Some broken disks have |
@@ -1186,10 +1196,13 @@ static void udf_find_vat_block(struct super_block *sb, int p_index, | |||
1186 | ino.partitionReferenceNum = type1_index; | 1196 | ino.partitionReferenceNum = type1_index; |
1187 | for (vat_block = start_block; | 1197 | for (vat_block = start_block; |
1188 | vat_block >= map->s_partition_root && | 1198 | vat_block >= map->s_partition_root && |
1189 | vat_block >= start_block - 3 && | 1199 | vat_block >= start_block - 3; vat_block--) { |
1190 | !sbi->s_vat_inode; vat_block--) { | ||
1191 | ino.logicalBlockNum = vat_block - map->s_partition_root; | 1200 | ino.logicalBlockNum = vat_block - map->s_partition_root; |
1192 | sbi->s_vat_inode = udf_iget(sb, &ino); | 1201 | inode = udf_iget(sb, &ino); |
1202 | if (!IS_ERR(inode)) { | ||
1203 | sbi->s_vat_inode = inode; | ||
1204 | break; | ||
1205 | } | ||
1193 | } | 1206 | } |
1194 | } | 1207 | } |
1195 | 1208 | ||
@@ -2205,10 +2218,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2205 | /* assign inodes by physical block number */ | 2218 | /* assign inodes by physical block number */ |
2206 | /* perhaps it's not extensible enough, but for now ... */ | 2219 | /* perhaps it's not extensible enough, but for now ... */ |
2207 | inode = udf_iget(sb, &rootdir); | 2220 | inode = udf_iget(sb, &rootdir); |
2208 | if (!inode) { | 2221 | if (IS_ERR(inode)) { |
2209 | udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", | 2222 | udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", |
2210 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); | 2223 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); |
2211 | ret = -EIO; | 2224 | ret = PTR_ERR(inode); |
2212 | goto error_out; | 2225 | goto error_out; |
2213 | } | 2226 | } |
2214 | 2227 | ||
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index be7dabbbcb49..742557be9936 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -143,7 +143,6 @@ extern int udf_expand_file_adinicb(struct inode *); | |||
143 | extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); | 143 | extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); |
144 | extern struct buffer_head *udf_bread(struct inode *, int, int, int *); | 144 | extern struct buffer_head *udf_bread(struct inode *, int, int, int *); |
145 | extern int udf_setsize(struct inode *, loff_t); | 145 | extern int udf_setsize(struct inode *, loff_t); |
146 | extern void udf_read_inode(struct inode *); | ||
147 | extern void udf_evict_inode(struct inode *); | 146 | extern void udf_evict_inode(struct inode *); |
148 | extern int udf_write_inode(struct inode *, struct writeback_control *wbc); | 147 | extern int udf_write_inode(struct inode *, struct writeback_control *wbc); |
149 | extern long udf_block_map(struct inode *, sector_t); | 148 | extern long udf_block_map(struct inode *, sector_t); |
@@ -209,7 +208,7 @@ extern int udf_CS0toUTF8(struct ustr *, const struct ustr *); | |||
209 | 208 | ||
210 | /* ialloc.c */ | 209 | /* ialloc.c */ |
211 | extern void udf_free_inode(struct inode *); | 210 | extern void udf_free_inode(struct inode *); |
212 | extern struct inode *udf_new_inode(struct inode *, umode_t, int *); | 211 | extern struct inode *udf_new_inode(struct inode *, umode_t); |
213 | 212 | ||
214 | /* truncate.c */ | 213 | /* truncate.c */ |
215 | extern void udf_truncate_tail_extent(struct inode *); | 214 | extern void udf_truncate_tail_extent(struct inode *); |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index a9cc75ffa925..7caa01652888 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -298,7 +298,10 @@ cg_found: | |||
298 | ufsi->i_oeftflag = 0; | 298 | ufsi->i_oeftflag = 0; |
299 | ufsi->i_dir_start_lookup = 0; | 299 | ufsi->i_dir_start_lookup = 0; |
300 | memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); | 300 | memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); |
301 | insert_inode_hash(inode); | 301 | if (insert_inode_locked(inode) < 0) { |
302 | err = -EIO; | ||
303 | goto failed; | ||
304 | } | ||
302 | mark_inode_dirty(inode); | 305 | mark_inode_dirty(inode); |
303 | 306 | ||
304 | if (uspi->fs_magic == UFS2_MAGIC) { | 307 | if (uspi->fs_magic == UFS2_MAGIC) { |
@@ -337,6 +340,7 @@ cg_found: | |||
337 | fail_remove_inode: | 340 | fail_remove_inode: |
338 | unlock_ufs(sb); | 341 | unlock_ufs(sb); |
339 | clear_nlink(inode); | 342 | clear_nlink(inode); |
343 | unlock_new_inode(inode); | ||
340 | iput(inode); | 344 | iput(inode); |
341 | UFSD("EXIT (FAILED): err %d\n", err); | 345 | UFSD("EXIT (FAILED): err %d\n", err); |
342 | return ERR_PTR(err); | 346 | return ERR_PTR(err); |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 7c580c97990e..be7d42c7d938 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -902,9 +902,6 @@ void ufs_evict_inode(struct inode * inode) | |||
902 | invalidate_inode_buffers(inode); | 902 | invalidate_inode_buffers(inode); |
903 | clear_inode(inode); | 903 | clear_inode(inode); |
904 | 904 | ||
905 | if (want_delete) { | 905 | if (want_delete) |
906 | lock_ufs(inode->i_sb); | 906 | ufs_free_inode(inode); |
907 | ufs_free_inode (inode); | ||
908 | unlock_ufs(inode->i_sb); | ||
909 | } | ||
910 | } | 907 | } |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 90d74b8f8eba..fd65deb4b5f0 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -38,10 +38,12 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | |||
38 | { | 38 | { |
39 | int err = ufs_add_link(dentry, inode); | 39 | int err = ufs_add_link(dentry, inode); |
40 | if (!err) { | 40 | if (!err) { |
41 | unlock_new_inode(inode); | ||
41 | d_instantiate(dentry, inode); | 42 | d_instantiate(dentry, inode); |
42 | return 0; | 43 | return 0; |
43 | } | 44 | } |
44 | inode_dec_link_count(inode); | 45 | inode_dec_link_count(inode); |
46 | unlock_new_inode(inode); | ||
45 | iput(inode); | 47 | iput(inode); |
46 | return err; | 48 | return err; |
47 | } | 49 | } |
@@ -126,12 +128,12 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry, | |||
126 | if (l > sb->s_blocksize) | 128 | if (l > sb->s_blocksize) |
127 | goto out_notlocked; | 129 | goto out_notlocked; |
128 | 130 | ||
129 | lock_ufs(dir->i_sb); | ||
130 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); | 131 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); |
131 | err = PTR_ERR(inode); | 132 | err = PTR_ERR(inode); |
132 | if (IS_ERR(inode)) | 133 | if (IS_ERR(inode)) |
133 | goto out; | 134 | goto out_notlocked; |
134 | 135 | ||
136 | lock_ufs(dir->i_sb); | ||
135 | if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) { | 137 | if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) { |
136 | /* slow symlink */ | 138 | /* slow symlink */ |
137 | inode->i_op = &ufs_symlink_inode_operations; | 139 | inode->i_op = &ufs_symlink_inode_operations; |
@@ -155,6 +157,7 @@ out_notlocked: | |||
155 | 157 | ||
156 | out_fail: | 158 | out_fail: |
157 | inode_dec_link_count(inode); | 159 | inode_dec_link_count(inode); |
160 | unlock_new_inode(inode); | ||
158 | iput(inode); | 161 | iput(inode); |
159 | goto out; | 162 | goto out; |
160 | } | 163 | } |
@@ -181,13 +184,9 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) | |||
181 | struct inode * inode; | 184 | struct inode * inode; |
182 | int err; | 185 | int err; |
183 | 186 | ||
184 | lock_ufs(dir->i_sb); | ||
185 | inode_inc_link_count(dir); | ||
186 | |||
187 | inode = ufs_new_inode(dir, S_IFDIR|mode); | 187 | inode = ufs_new_inode(dir, S_IFDIR|mode); |
188 | err = PTR_ERR(inode); | ||
189 | if (IS_ERR(inode)) | 188 | if (IS_ERR(inode)) |
190 | goto out_dir; | 189 | return PTR_ERR(inode); |
191 | 190 | ||
192 | inode->i_op = &ufs_dir_inode_operations; | 191 | inode->i_op = &ufs_dir_inode_operations; |
193 | inode->i_fop = &ufs_dir_operations; | 192 | inode->i_fop = &ufs_dir_operations; |
@@ -195,6 +194,9 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) | |||
195 | 194 | ||
196 | inode_inc_link_count(inode); | 195 | inode_inc_link_count(inode); |
197 | 196 | ||
197 | lock_ufs(dir->i_sb); | ||
198 | inode_inc_link_count(dir); | ||
199 | |||
198 | err = ufs_make_empty(inode, dir); | 200 | err = ufs_make_empty(inode, dir); |
199 | if (err) | 201 | if (err) |
200 | goto out_fail; | 202 | goto out_fail; |
@@ -211,8 +213,8 @@ out: | |||
211 | out_fail: | 213 | out_fail: |
212 | inode_dec_link_count(inode); | 214 | inode_dec_link_count(inode); |
213 | inode_dec_link_count(inode); | 215 | inode_dec_link_count(inode); |
216 | unlock_new_inode(inode); | ||
214 | iput (inode); | 217 | iput (inode); |
215 | out_dir: | ||
216 | inode_dec_link_count(dir); | 218 | inode_dec_link_count(dir); |
217 | unlock_ufs(dir->i_sb); | 219 | unlock_ufs(dir->i_sb); |
218 | goto out; | 220 | goto out; |
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index de2d26d32844..86df952d3e24 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -5424,7 +5424,7 @@ xfs_bmap_shift_extents( | |||
5424 | struct xfs_bmap_free *flist, | 5424 | struct xfs_bmap_free *flist, |
5425 | int num_exts) | 5425 | int num_exts) |
5426 | { | 5426 | { |
5427 | struct xfs_btree_cur *cur; | 5427 | struct xfs_btree_cur *cur = NULL; |
5428 | struct xfs_bmbt_rec_host *gotp; | 5428 | struct xfs_bmbt_rec_host *gotp; |
5429 | struct xfs_bmbt_irec got; | 5429 | struct xfs_bmbt_irec got; |
5430 | struct xfs_bmbt_irec left; | 5430 | struct xfs_bmbt_irec left; |
@@ -5435,7 +5435,7 @@ xfs_bmap_shift_extents( | |||
5435 | int error = 0; | 5435 | int error = 0; |
5436 | int i; | 5436 | int i; |
5437 | int whichfork = XFS_DATA_FORK; | 5437 | int whichfork = XFS_DATA_FORK; |
5438 | int logflags; | 5438 | int logflags = 0; |
5439 | xfs_filblks_t blockcount = 0; | 5439 | xfs_filblks_t blockcount = 0; |
5440 | int total_extents; | 5440 | int total_extents; |
5441 | 5441 | ||
@@ -5478,16 +5478,11 @@ xfs_bmap_shift_extents( | |||
5478 | } | 5478 | } |
5479 | } | 5479 | } |
5480 | 5480 | ||
5481 | /* We are going to change core inode */ | ||
5482 | logflags = XFS_ILOG_CORE; | ||
5483 | if (ifp->if_flags & XFS_IFBROOT) { | 5481 | if (ifp->if_flags & XFS_IFBROOT) { |
5484 | cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); | 5482 | cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); |
5485 | cur->bc_private.b.firstblock = *firstblock; | 5483 | cur->bc_private.b.firstblock = *firstblock; |
5486 | cur->bc_private.b.flist = flist; | 5484 | cur->bc_private.b.flist = flist; |
5487 | cur->bc_private.b.flags = 0; | 5485 | cur->bc_private.b.flags = 0; |
5488 | } else { | ||
5489 | cur = NULL; | ||
5490 | logflags |= XFS_ILOG_DEXT; | ||
5491 | } | 5486 | } |
5492 | 5487 | ||
5493 | /* | 5488 | /* |
@@ -5545,11 +5540,14 @@ xfs_bmap_shift_extents( | |||
5545 | blockcount = left.br_blockcount + | 5540 | blockcount = left.br_blockcount + |
5546 | got.br_blockcount; | 5541 | got.br_blockcount; |
5547 | xfs_iext_remove(ip, *current_ext, 1, 0); | 5542 | xfs_iext_remove(ip, *current_ext, 1, 0); |
5543 | logflags |= XFS_ILOG_CORE; | ||
5548 | if (cur) { | 5544 | if (cur) { |
5549 | error = xfs_btree_delete(cur, &i); | 5545 | error = xfs_btree_delete(cur, &i); |
5550 | if (error) | 5546 | if (error) |
5551 | goto del_cursor; | 5547 | goto del_cursor; |
5552 | XFS_WANT_CORRUPTED_GOTO(i == 1, del_cursor); | 5548 | XFS_WANT_CORRUPTED_GOTO(i == 1, del_cursor); |
5549 | } else { | ||
5550 | logflags |= XFS_ILOG_DEXT; | ||
5553 | } | 5551 | } |
5554 | XFS_IFORK_NEXT_SET(ip, whichfork, | 5552 | XFS_IFORK_NEXT_SET(ip, whichfork, |
5555 | XFS_IFORK_NEXTENTS(ip, whichfork) - 1); | 5553 | XFS_IFORK_NEXTENTS(ip, whichfork) - 1); |
@@ -5575,6 +5573,7 @@ xfs_bmap_shift_extents( | |||
5575 | got.br_startoff = startoff; | 5573 | got.br_startoff = startoff; |
5576 | } | 5574 | } |
5577 | 5575 | ||
5576 | logflags |= XFS_ILOG_CORE; | ||
5578 | if (cur) { | 5577 | if (cur) { |
5579 | error = xfs_bmbt_update(cur, got.br_startoff, | 5578 | error = xfs_bmbt_update(cur, got.br_startoff, |
5580 | got.br_startblock, | 5579 | got.br_startblock, |
@@ -5582,6 +5581,8 @@ xfs_bmap_shift_extents( | |||
5582 | got.br_state); | 5581 | got.br_state); |
5583 | if (error) | 5582 | if (error) |
5584 | goto del_cursor; | 5583 | goto del_cursor; |
5584 | } else { | ||
5585 | logflags |= XFS_ILOG_DEXT; | ||
5585 | } | 5586 | } |
5586 | 5587 | ||
5587 | (*current_ext)++; | 5588 | (*current_ext)++; |
@@ -5597,6 +5598,7 @@ del_cursor: | |||
5597 | xfs_btree_del_cursor(cur, | 5598 | xfs_btree_del_cursor(cur, |
5598 | error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); | 5599 | error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); |
5599 | 5600 | ||
5600 | xfs_trans_log_inode(tp, ip, logflags); | 5601 | if (logflags) |
5602 | xfs_trans_log_inode(tp, ip, logflags); | ||
5601 | return error; | 5603 | return error; |
5602 | } | 5604 | } |
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 11e9b4caa54f..b984647c24db 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -1753,11 +1753,72 @@ xfs_vm_readpages( | |||
1753 | return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks); | 1753 | return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks); |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | /* | ||
1757 | * This is basically a copy of __set_page_dirty_buffers() with one | ||
1758 | * small tweak: buffers beyond EOF do not get marked dirty. If we mark them | ||
1759 | * dirty, we'll never be able to clean them because we don't write buffers | ||
1760 | * beyond EOF, and that means we can't invalidate pages that span EOF | ||
1761 | * that have been marked dirty. Further, the dirty state can leak into | ||
1762 | * the file interior if the file is extended, resulting in all sorts of | ||
1763 | * bad things happening as the state does not match the underlying data. | ||
1764 | * | ||
1765 | * XXX: this really indicates that bufferheads in XFS need to die. Warts like | ||
1766 | * this only exist because of bufferheads and how the generic code manages them. | ||
1767 | */ | ||
1768 | STATIC int | ||
1769 | xfs_vm_set_page_dirty( | ||
1770 | struct page *page) | ||
1771 | { | ||
1772 | struct address_space *mapping = page->mapping; | ||
1773 | struct inode *inode = mapping->host; | ||
1774 | loff_t end_offset; | ||
1775 | loff_t offset; | ||
1776 | int newly_dirty; | ||
1777 | |||
1778 | if (unlikely(!mapping)) | ||
1779 | return !TestSetPageDirty(page); | ||
1780 | |||
1781 | end_offset = i_size_read(inode); | ||
1782 | offset = page_offset(page); | ||
1783 | |||
1784 | spin_lock(&mapping->private_lock); | ||
1785 | if (page_has_buffers(page)) { | ||
1786 | struct buffer_head *head = page_buffers(page); | ||
1787 | struct buffer_head *bh = head; | ||
1788 | |||
1789 | do { | ||
1790 | if (offset < end_offset) | ||
1791 | set_buffer_dirty(bh); | ||
1792 | bh = bh->b_this_page; | ||
1793 | offset += 1 << inode->i_blkbits; | ||
1794 | } while (bh != head); | ||
1795 | } | ||
1796 | newly_dirty = !TestSetPageDirty(page); | ||
1797 | spin_unlock(&mapping->private_lock); | ||
1798 | |||
1799 | if (newly_dirty) { | ||
1800 | /* sigh - __set_page_dirty() is static, so copy it here, too */ | ||
1801 | unsigned long flags; | ||
1802 | |||
1803 | spin_lock_irqsave(&mapping->tree_lock, flags); | ||
1804 | if (page->mapping) { /* Race with truncate? */ | ||
1805 | WARN_ON_ONCE(!PageUptodate(page)); | ||
1806 | account_page_dirtied(page, mapping); | ||
1807 | radix_tree_tag_set(&mapping->page_tree, | ||
1808 | page_index(page), PAGECACHE_TAG_DIRTY); | ||
1809 | } | ||
1810 | spin_unlock_irqrestore(&mapping->tree_lock, flags); | ||
1811 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | ||
1812 | } | ||
1813 | return newly_dirty; | ||
1814 | } | ||
1815 | |||
1756 | const struct address_space_operations xfs_address_space_operations = { | 1816 | const struct address_space_operations xfs_address_space_operations = { |
1757 | .readpage = xfs_vm_readpage, | 1817 | .readpage = xfs_vm_readpage, |
1758 | .readpages = xfs_vm_readpages, | 1818 | .readpages = xfs_vm_readpages, |
1759 | .writepage = xfs_vm_writepage, | 1819 | .writepage = xfs_vm_writepage, |
1760 | .writepages = xfs_vm_writepages, | 1820 | .writepages = xfs_vm_writepages, |
1821 | .set_page_dirty = xfs_vm_set_page_dirty, | ||
1761 | .releasepage = xfs_vm_releasepage, | 1822 | .releasepage = xfs_vm_releasepage, |
1762 | .invalidatepage = xfs_vm_invalidatepage, | 1823 | .invalidatepage = xfs_vm_invalidatepage, |
1763 | .write_begin = xfs_vm_write_begin, | 1824 | .write_begin = xfs_vm_write_begin, |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 2f1e30d39a35..1707980f9a4b 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -1470,6 +1470,26 @@ xfs_collapse_file_space( | |||
1470 | start_fsb = XFS_B_TO_FSB(mp, offset + len); | 1470 | start_fsb = XFS_B_TO_FSB(mp, offset + len); |
1471 | shift_fsb = XFS_B_TO_FSB(mp, len); | 1471 | shift_fsb = XFS_B_TO_FSB(mp, len); |
1472 | 1472 | ||
1473 | /* | ||
1474 | * Writeback the entire file and force remove any post-eof blocks. The | ||
1475 | * writeback prevents changes to the extent list via concurrent | ||
1476 | * writeback and the eofblocks trim prevents the extent shift algorithm | ||
1477 | * from running into a post-eof delalloc extent. | ||
1478 | * | ||
1479 | * XXX: This is a temporary fix until the extent shift loop below is | ||
1480 | * converted to use offsets and lookups within the ILOCK rather than | ||
1481 | * carrying around the index into the extent list for the next | ||
1482 | * iteration. | ||
1483 | */ | ||
1484 | error = filemap_write_and_wait(VFS_I(ip)->i_mapping); | ||
1485 | if (error) | ||
1486 | return error; | ||
1487 | if (xfs_can_free_eofblocks(ip, true)) { | ||
1488 | error = xfs_free_eofblocks(mp, ip, false); | ||
1489 | if (error) | ||
1490 | return error; | ||
1491 | } | ||
1492 | |||
1473 | error = xfs_free_file_space(ip, offset, len); | 1493 | error = xfs_free_file_space(ip, offset, len); |
1474 | if (error) | 1494 | if (error) |
1475 | return error; | 1495 | return error; |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 076b1708d134..de5368c803f9 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -291,12 +291,22 @@ xfs_file_read_iter( | |||
291 | if (inode->i_mapping->nrpages) { | 291 | if (inode->i_mapping->nrpages) { |
292 | ret = filemap_write_and_wait_range( | 292 | ret = filemap_write_and_wait_range( |
293 | VFS_I(ip)->i_mapping, | 293 | VFS_I(ip)->i_mapping, |
294 | pos, -1); | 294 | pos, pos + size - 1); |
295 | if (ret) { | 295 | if (ret) { |
296 | xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL); | 296 | xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL); |
297 | return ret; | 297 | return ret; |
298 | } | 298 | } |
299 | truncate_pagecache_range(VFS_I(ip), pos, -1); | 299 | |
300 | /* | ||
301 | * Invalidate whole pages. This can return an error if | ||
302 | * we fail to invalidate a page, but this should never | ||
303 | * happen on XFS. Warn if it does fail. | ||
304 | */ | ||
305 | ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, | ||
306 | pos >> PAGE_CACHE_SHIFT, | ||
307 | (pos + size - 1) >> PAGE_CACHE_SHIFT); | ||
308 | WARN_ON_ONCE(ret); | ||
309 | ret = 0; | ||
300 | } | 310 | } |
301 | xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL); | 311 | xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL); |
302 | } | 312 | } |
@@ -632,10 +642,19 @@ xfs_file_dio_aio_write( | |||
632 | 642 | ||
633 | if (mapping->nrpages) { | 643 | if (mapping->nrpages) { |
634 | ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | 644 | ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, |
635 | pos, -1); | 645 | pos, pos + count - 1); |
636 | if (ret) | 646 | if (ret) |
637 | goto out; | 647 | goto out; |
638 | truncate_pagecache_range(VFS_I(ip), pos, -1); | 648 | /* |
649 | * Invalidate whole pages. This can return an error if | ||
650 | * we fail to invalidate a page, but this should never | ||
651 | * happen on XFS. Warn if it does fail. | ||
652 | */ | ||
653 | ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, | ||
654 | pos >> PAGE_CACHE_SHIFT, | ||
655 | (pos + count - 1) >> PAGE_CACHE_SHIFT); | ||
656 | WARN_ON_ONCE(ret); | ||
657 | ret = 0; | ||
639 | } | 658 | } |
640 | 659 | ||
641 | /* | 660 | /* |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index bcfd808b1098..57ee0528aacb 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -118,6 +118,7 @@ struct acpi_device; | |||
118 | struct acpi_hotplug_profile { | 118 | struct acpi_hotplug_profile { |
119 | struct kobject kobj; | 119 | struct kobject kobj; |
120 | int (*scan_dependent)(struct acpi_device *adev); | 120 | int (*scan_dependent)(struct acpi_device *adev); |
121 | void (*notify_online)(struct acpi_device *adev); | ||
121 | bool enabled:1; | 122 | bool enabled:1; |
122 | bool demand_offline:1; | 123 | bool demand_offline:1; |
123 | }; | 124 | }; |
@@ -204,10 +205,9 @@ struct acpi_device_flags { | |||
204 | u32 match_driver:1; | 205 | u32 match_driver:1; |
205 | u32 initialized:1; | 206 | u32 initialized:1; |
206 | u32 visited:1; | 207 | u32 visited:1; |
207 | u32 no_hotplug:1; | ||
208 | u32 hotplug_notify:1; | 208 | u32 hotplug_notify:1; |
209 | u32 is_dock_station:1; | 209 | u32 is_dock_station:1; |
210 | u32 reserved:22; | 210 | u32 reserved:23; |
211 | }; | 211 | }; |
212 | 212 | ||
213 | /* File System */ | 213 | /* File System */ |
@@ -246,7 +246,6 @@ struct acpi_device_pnp { | |||
246 | acpi_device_name device_name; /* Driver-determined */ | 246 | acpi_device_name device_name; /* Driver-determined */ |
247 | acpi_device_class device_class; /* " */ | 247 | acpi_device_class device_class; /* " */ |
248 | union acpi_object *str_obj; /* unicode string for _STR method */ | 248 | union acpi_object *str_obj; /* unicode string for _STR method */ |
249 | unsigned long sun; /* _SUN */ | ||
250 | }; | 249 | }; |
251 | 250 | ||
252 | #define acpi_device_bid(d) ((d)->pnp.bus_id) | 251 | #define acpi_device_bid(d) ((d)->pnp.bus_id) |
@@ -412,7 +411,6 @@ void acpi_bus_private_data_handler(acpi_handle, void *); | |||
412 | int acpi_bus_get_private_data(acpi_handle, void **); | 411 | int acpi_bus_get_private_data(acpi_handle, void **); |
413 | int acpi_bus_attach_private_data(acpi_handle, void *); | 412 | int acpi_bus_attach_private_data(acpi_handle, void *); |
414 | void acpi_bus_detach_private_data(acpi_handle); | 413 | void acpi_bus_detach_private_data(acpi_handle); |
415 | void acpi_bus_no_hotplug(acpi_handle handle); | ||
416 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); | 414 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); |
417 | extern int register_acpi_notifier(struct notifier_block *); | 415 | extern int register_acpi_notifier(struct notifier_block *); |
418 | extern int unregister_acpi_notifier(struct notifier_block *); | 416 | extern int unregister_acpi_notifier(struct notifier_block *); |
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h index 831d786976c5..882675e7c055 100644 --- a/include/crypto/drbg.h +++ b/include/crypto/drbg.h | |||
@@ -162,12 +162,25 @@ static inline size_t drbg_max_request_bytes(struct drbg_state *drbg) | |||
162 | 162 | ||
163 | static inline size_t drbg_max_addtl(struct drbg_state *drbg) | 163 | static inline size_t drbg_max_addtl(struct drbg_state *drbg) |
164 | { | 164 | { |
165 | #if (__BITS_PER_LONG == 32) | ||
166 | /* | ||
167 | * SP800-90A allows smaller maximum numbers to be returned -- we | ||
168 | * return SIZE_MAX - 1 to allow the verification of the enforcement | ||
169 | * of this value in drbg_healthcheck_sanity. | ||
170 | */ | ||
171 | return (SIZE_MAX - 1); | ||
172 | #else | ||
165 | return (1UL<<(drbg->core->max_addtllen)); | 173 | return (1UL<<(drbg->core->max_addtllen)); |
174 | #endif | ||
166 | } | 175 | } |
167 | 176 | ||
168 | static inline size_t drbg_max_requests(struct drbg_state *drbg) | 177 | static inline size_t drbg_max_requests(struct drbg_state *drbg) |
169 | { | 178 | { |
179 | #if (__BITS_PER_LONG == 32) | ||
180 | return SIZE_MAX; | ||
181 | #else | ||
170 | return (1UL<<(drbg->core->max_req)); | 182 | return (1UL<<(drbg->core->max_req)); |
183 | #endif | ||
171 | } | 184 | } |
172 | 185 | ||
173 | /* | 186 | /* |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 6dfd64b3a604..e973540cd15b 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -17,6 +17,7 @@ | |||
17 | {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 17 | {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
18 | {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 18 | {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
19 | {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 19 | {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
20 | {0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
20 | {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 21 | {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
21 | {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 22 | {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
22 | {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 23 | {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
@@ -164,8 +165,11 @@ | |||
164 | {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 165 | {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
165 | {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 166 | {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
166 | {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 167 | {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
168 | {0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
169 | {0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
167 | {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 170 | {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
168 | {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 171 | {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
172 | {0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | ||
169 | {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 173 | {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
170 | {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 174 | {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
171 | {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 175 | {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
@@ -175,6 +179,8 @@ | |||
175 | {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 179 | {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
176 | {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 180 | {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
177 | {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 181 | {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
182 | {0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
183 | {0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
178 | {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | 184 | {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
179 | {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | 185 | {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
180 | {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | 186 | {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
@@ -297,6 +303,7 @@ | |||
297 | {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | 303 | {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ |
298 | {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 304 | {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
299 | {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 305 | {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
306 | {0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
300 | {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 307 | {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
301 | {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 308 | {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
302 | {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 309 | {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index fdd7e1b61f60..c324f5700d1a 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h | |||
@@ -44,10 +44,15 @@ struct amba_driver { | |||
44 | const struct amba_id *id_table; | 44 | const struct amba_id *id_table; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | /* | ||
48 | * Constants for the designer field of the Peripheral ID register. When bit 7 | ||
49 | * is set to '1', bits [6:0] should be the JEP106 manufacturer identity code. | ||
50 | */ | ||
47 | enum amba_vendor { | 51 | enum amba_vendor { |
48 | AMBA_VENDOR_ARM = 0x41, | 52 | AMBA_VENDOR_ARM = 0x41, |
49 | AMBA_VENDOR_ST = 0x80, | 53 | AMBA_VENDOR_ST = 0x80, |
50 | AMBA_VENDOR_QCOM = 0x51, | 54 | AMBA_VENDOR_QCOM = 0x51, |
55 | AMBA_VENDOR_LSI = 0xb6, | ||
51 | }; | 56 | }; |
52 | 57 | ||
53 | extern struct bus_type amba_bustype; | 58 | extern struct bus_type amba_bustype; |
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index eb726b9c5762..a1e31f274fcd 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h | |||
@@ -127,10 +127,9 @@ enum { | |||
127 | BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */ | 127 | BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */ |
128 | 128 | ||
129 | BLK_MQ_F_SHOULD_MERGE = 1 << 0, | 129 | BLK_MQ_F_SHOULD_MERGE = 1 << 0, |
130 | BLK_MQ_F_SHOULD_SORT = 1 << 1, | 130 | BLK_MQ_F_TAG_SHARED = 1 << 1, |
131 | BLK_MQ_F_TAG_SHARED = 1 << 2, | 131 | BLK_MQ_F_SG_MERGE = 1 << 2, |
132 | BLK_MQ_F_SG_MERGE = 1 << 3, | 132 | BLK_MQ_F_SYSFS_UP = 1 << 3, |
133 | BLK_MQ_F_SYSFS_UP = 1 << 4, | ||
134 | 133 | ||
135 | BLK_MQ_S_STOPPED = 0, | 134 | BLK_MQ_S_STOPPED = 0, |
136 | BLK_MQ_S_TAG_ACTIVE = 1, | 135 | BLK_MQ_S_TAG_ACTIVE = 1, |
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 6f76277baf39..61219b9b3445 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #define PHY_ID_BCM7366 0x600d8490 | 16 | #define PHY_ID_BCM7366 0x600d8490 |
17 | #define PHY_ID_BCM7439 0x600d8480 | 17 | #define PHY_ID_BCM7439 0x600d8480 |
18 | #define PHY_ID_BCM7445 0x600d8510 | 18 | #define PHY_ID_BCM7445 0x600d8510 |
19 | #define PHY_ID_BCM7XXX_28 0x600d8400 | ||
20 | 19 | ||
21 | #define PHY_BCM_OUI_MASK 0xfffffc00 | 20 | #define PHY_BCM_OUI_MASK 0xfffffc00 |
22 | #define PHY_BCM_OUI_1 0x00206000 | 21 | #define PHY_BCM_OUI_1 0x00206000 |
diff --git a/include/linux/ccp.h b/include/linux/ccp.h index ebcc9d146219..7f437036baa4 100644 --- a/include/linux/ccp.h +++ b/include/linux/ccp.h | |||
@@ -27,6 +27,13 @@ struct ccp_cmd; | |||
27 | defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) | 27 | defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * ccp_present - check if a CCP device is present | ||
31 | * | ||
32 | * Returns zero if a CCP device is present, -ENODEV otherwise. | ||
33 | */ | ||
34 | int ccp_present(void); | ||
35 | |||
36 | /** | ||
30 | * ccp_enqueue_cmd - queue an operation for processing by the CCP | 37 | * ccp_enqueue_cmd - queue an operation for processing by the CCP |
31 | * | 38 | * |
32 | * @cmd: ccp_cmd struct to be processed | 39 | * @cmd: ccp_cmd struct to be processed |
@@ -53,6 +60,11 @@ int ccp_enqueue_cmd(struct ccp_cmd *cmd); | |||
53 | 60 | ||
54 | #else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ | 61 | #else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ |
55 | 62 | ||
63 | static inline int ccp_present(void) | ||
64 | { | ||
65 | return -ENODEV; | ||
66 | } | ||
67 | |||
56 | static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) | 68 | static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) |
57 | { | 69 | { |
58 | return -ENODEV; | 70 | return -ENODEV; |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index ade2390ffe92..6e39c9bb0dae 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -93,12 +93,12 @@ extern int cpuset_slab_spread_node(void); | |||
93 | 93 | ||
94 | static inline int cpuset_do_page_mem_spread(void) | 94 | static inline int cpuset_do_page_mem_spread(void) |
95 | { | 95 | { |
96 | return current->flags & PF_SPREAD_PAGE; | 96 | return task_spread_page(current); |
97 | } | 97 | } |
98 | 98 | ||
99 | static inline int cpuset_do_slab_mem_spread(void) | 99 | static inline int cpuset_do_slab_mem_spread(void) |
100 | { | 100 | { |
101 | return current->flags & PF_SPREAD_SLAB; | 101 | return task_spread_slab(current); |
102 | } | 102 | } |
103 | 103 | ||
104 | extern int current_cpuset_is_being_rebound(void); | 104 | extern int current_cpuset_is_being_rebound(void); |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index e4ae2ad48d07..75a227cc7ce2 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -55,6 +55,7 @@ struct qstr { | |||
55 | #define QSTR_INIT(n,l) { { { .len = l } }, .name = n } | 55 | #define QSTR_INIT(n,l) { { { .len = l } }, .name = n } |
56 | #define hashlen_hash(hashlen) ((u32) (hashlen)) | 56 | #define hashlen_hash(hashlen) ((u32) (hashlen)) |
57 | #define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) | 57 | #define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) |
58 | #define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash)) | ||
58 | 59 | ||
59 | struct dentry_stat_t { | 60 | struct dentry_stat_t { |
60 | long nr_dentry; | 61 | long nr_dentry; |
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h index 6ff0b0b42d47..08ed2b0a96e6 100644 --- a/include/linux/f2fs_fs.h +++ b/include/linux/f2fs_fs.h | |||
@@ -24,6 +24,9 @@ | |||
24 | #define NULL_ADDR ((block_t)0) /* used as block_t addresses */ | 24 | #define NULL_ADDR ((block_t)0) /* used as block_t addresses */ |
25 | #define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ | 25 | #define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ |
26 | 26 | ||
27 | /* 0, 1(node nid), 2(meta nid) are reserved node id */ | ||
28 | #define F2FS_RESERVED_NODE_NUM 3 | ||
29 | |||
27 | #define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) | 30 | #define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) |
28 | #define F2FS_NODE_INO(sbi) (sbi->node_ino_num) | 31 | #define F2FS_NODE_INO(sbi) (sbi->node_ino_num) |
29 | #define F2FS_META_INO(sbi) (sbi->meta_ino_num) | 32 | #define F2FS_META_INO(sbi) (sbi->meta_ino_num) |
@@ -87,6 +90,8 @@ struct f2fs_super_block { | |||
87 | #define CP_ORPHAN_PRESENT_FLAG 0x00000002 | 90 | #define CP_ORPHAN_PRESENT_FLAG 0x00000002 |
88 | #define CP_UMOUNT_FLAG 0x00000001 | 91 | #define CP_UMOUNT_FLAG 0x00000001 |
89 | 92 | ||
93 | #define F2FS_CP_PACKS 2 /* # of checkpoint packs */ | ||
94 | |||
90 | struct f2fs_checkpoint { | 95 | struct f2fs_checkpoint { |
91 | __le64 checkpoint_ver; /* checkpoint block version number */ | 96 | __le64 checkpoint_ver; /* checkpoint block version number */ |
92 | __le64 user_block_count; /* # of user blocks */ | 97 | __le64 user_block_count; /* # of user blocks */ |
@@ -123,6 +128,9 @@ struct f2fs_checkpoint { | |||
123 | */ | 128 | */ |
124 | #define F2FS_ORPHANS_PER_BLOCK 1020 | 129 | #define F2FS_ORPHANS_PER_BLOCK 1020 |
125 | 130 | ||
131 | #define GET_ORPHAN_BLOCKS(n) ((n + F2FS_ORPHANS_PER_BLOCK - 1) / \ | ||
132 | F2FS_ORPHANS_PER_BLOCK) | ||
133 | |||
126 | struct f2fs_orphan_block { | 134 | struct f2fs_orphan_block { |
127 | __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */ | 135 | __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */ |
128 | __le32 reserved; /* reserved */ | 136 | __le32 reserved; /* reserved */ |
@@ -144,6 +152,7 @@ struct f2fs_extent { | |||
144 | #define F2FS_NAME_LEN 255 | 152 | #define F2FS_NAME_LEN 255 |
145 | #define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */ | 153 | #define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */ |
146 | #define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ | 154 | #define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ |
155 | #define DEF_NIDS_PER_INODE 5 /* Node IDs in an Inode */ | ||
147 | #define ADDRS_PER_INODE(fi) addrs_per_inode(fi) | 156 | #define ADDRS_PER_INODE(fi) addrs_per_inode(fi) |
148 | #define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ | 157 | #define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ |
149 | #define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ | 158 | #define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ |
@@ -163,8 +172,9 @@ struct f2fs_extent { | |||
163 | #define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ | 172 | #define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ |
164 | F2FS_INLINE_XATTR_ADDRS - 1)) | 173 | F2FS_INLINE_XATTR_ADDRS - 1)) |
165 | 174 | ||
166 | #define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \ | 175 | #define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) -\ |
167 | - sizeof(__le32) * (DEF_ADDRS_PER_INODE + 5 - 1)) | 176 | sizeof(__le32) * (DEF_ADDRS_PER_INODE + \ |
177 | DEF_NIDS_PER_INODE - 1)) | ||
168 | 178 | ||
169 | struct f2fs_inode { | 179 | struct f2fs_inode { |
170 | __le16 i_mode; /* file mode */ | 180 | __le16 i_mode; /* file mode */ |
@@ -194,7 +204,7 @@ struct f2fs_inode { | |||
194 | 204 | ||
195 | __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */ | 205 | __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */ |
196 | 206 | ||
197 | __le32 i_nid[5]; /* direct(2), indirect(2), | 207 | __le32 i_nid[DEF_NIDS_PER_INODE]; /* direct(2), indirect(2), |
198 | double_indirect(1) node id */ | 208 | double_indirect(1) node id */ |
199 | } __packed; | 209 | } __packed; |
200 | 210 | ||
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 6bb5e3f2a3b4..f0b0edbf55a9 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -102,6 +102,15 @@ enum { | |||
102 | FTRACE_OPS_FL_DELETED = 1 << 8, | 102 | FTRACE_OPS_FL_DELETED = 1 << 8, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
106 | /* The hash used to know what functions callbacks trace */ | ||
107 | struct ftrace_ops_hash { | ||
108 | struct ftrace_hash *notrace_hash; | ||
109 | struct ftrace_hash *filter_hash; | ||
110 | struct mutex regex_lock; | ||
111 | }; | ||
112 | #endif | ||
113 | |||
105 | /* | 114 | /* |
106 | * Note, ftrace_ops can be referenced outside of RCU protection. | 115 | * Note, ftrace_ops can be referenced outside of RCU protection. |
107 | * (Although, for perf, the control ops prevent that). If ftrace_ops is | 116 | * (Although, for perf, the control ops prevent that). If ftrace_ops is |
@@ -121,10 +130,9 @@ struct ftrace_ops { | |||
121 | int __percpu *disabled; | 130 | int __percpu *disabled; |
122 | #ifdef CONFIG_DYNAMIC_FTRACE | 131 | #ifdef CONFIG_DYNAMIC_FTRACE |
123 | int nr_trampolines; | 132 | int nr_trampolines; |
124 | struct ftrace_hash *notrace_hash; | 133 | struct ftrace_ops_hash local_hash; |
125 | struct ftrace_hash *filter_hash; | 134 | struct ftrace_ops_hash *func_hash; |
126 | struct ftrace_hash *tramp_hash; | 135 | struct ftrace_hash *tramp_hash; |
127 | struct mutex regex_lock; | ||
128 | unsigned long trampoline; | 136 | unsigned long trampoline; |
129 | #endif | 137 | #endif |
130 | }; | 138 | }; |
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index b7ce0c64c6f3..12f146fa6604 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h | |||
@@ -16,8 +16,6 @@ struct device; | |||
16 | */ | 16 | */ |
17 | struct gpio_desc; | 17 | struct gpio_desc; |
18 | 18 | ||
19 | #ifdef CONFIG_GPIOLIB | ||
20 | |||
21 | #define GPIOD_FLAGS_BIT_DIR_SET BIT(0) | 19 | #define GPIOD_FLAGS_BIT_DIR_SET BIT(0) |
22 | #define GPIOD_FLAGS_BIT_DIR_OUT BIT(1) | 20 | #define GPIOD_FLAGS_BIT_DIR_OUT BIT(1) |
23 | #define GPIOD_FLAGS_BIT_DIR_VAL BIT(2) | 21 | #define GPIOD_FLAGS_BIT_DIR_VAL BIT(2) |
@@ -34,64 +32,38 @@ enum gpiod_flags { | |||
34 | GPIOD_FLAGS_BIT_DIR_VAL, | 32 | GPIOD_FLAGS_BIT_DIR_VAL, |
35 | }; | 33 | }; |
36 | 34 | ||
35 | #ifdef CONFIG_GPIOLIB | ||
36 | |||
37 | /* Acquire and dispose GPIOs */ | 37 | /* Acquire and dispose GPIOs */ |
38 | struct gpio_desc *__must_check __gpiod_get(struct device *dev, | 38 | struct gpio_desc *__must_check __gpiod_get(struct device *dev, |
39 | const char *con_id, | 39 | const char *con_id, |
40 | enum gpiod_flags flags); | 40 | enum gpiod_flags flags); |
41 | #define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags) | ||
42 | #define gpiod_get(varargs...) __gpiod_get(varargs, 0) | ||
43 | struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, | 41 | struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, |
44 | const char *con_id, | 42 | const char *con_id, |
45 | unsigned int idx, | 43 | unsigned int idx, |
46 | enum gpiod_flags flags); | 44 | enum gpiod_flags flags); |
47 | #define __gpiod_get_index(dev, con_id, index, flags, ...) \ | ||
48 | __gpiod_get_index(dev, con_id, index, flags) | ||
49 | #define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0) | ||
50 | struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev, | 45 | struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev, |
51 | const char *con_id, | 46 | const char *con_id, |
52 | enum gpiod_flags flags); | 47 | enum gpiod_flags flags); |
53 | #define __gpiod_get_optional(dev, con_id, flags, ...) \ | ||
54 | __gpiod_get_optional(dev, con_id, flags) | ||
55 | #define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0) | ||
56 | struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev, | 48 | struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev, |
57 | const char *con_id, | 49 | const char *con_id, |
58 | unsigned int index, | 50 | unsigned int index, |
59 | enum gpiod_flags flags); | 51 | enum gpiod_flags flags); |
60 | #define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | ||
61 | __gpiod_get_index_optional(dev, con_id, index, flags) | ||
62 | #define gpiod_get_index_optional(varargs...) \ | ||
63 | __gpiod_get_index_optional(varargs, 0) | ||
64 | |||
65 | void gpiod_put(struct gpio_desc *desc); | 52 | void gpiod_put(struct gpio_desc *desc); |
66 | 53 | ||
67 | struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev, | 54 | struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev, |
68 | const char *con_id, | 55 | const char *con_id, |
69 | enum gpiod_flags flags); | 56 | enum gpiod_flags flags); |
70 | #define __devm_gpiod_get(dev, con_id, flags, ...) \ | ||
71 | __devm_gpiod_get(dev, con_id, flags) | ||
72 | #define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0) | ||
73 | struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, | 57 | struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, |
74 | const char *con_id, | 58 | const char *con_id, |
75 | unsigned int idx, | 59 | unsigned int idx, |
76 | enum gpiod_flags flags); | 60 | enum gpiod_flags flags); |
77 | #define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \ | ||
78 | __devm_gpiod_get_index(dev, con_id, index, flags) | ||
79 | #define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0) | ||
80 | struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev, | 61 | struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev, |
81 | const char *con_id, | 62 | const char *con_id, |
82 | enum gpiod_flags flags); | 63 | enum gpiod_flags flags); |
83 | #define __devm_gpiod_get_optional(dev, con_id, flags, ...) \ | ||
84 | __devm_gpiod_get_optional(dev, con_id, flags) | ||
85 | #define devm_gpiod_get_optional(varargs...) \ | ||
86 | __devm_gpiod_get_optional(varargs, 0) | ||
87 | struct gpio_desc *__must_check | 64 | struct gpio_desc *__must_check |
88 | __devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | 65 | __devm_gpiod_get_index_optional(struct device *dev, const char *con_id, |
89 | unsigned int index, enum gpiod_flags flags); | 66 | unsigned int index, enum gpiod_flags flags); |
90 | #define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | ||
91 | __devm_gpiod_get_index_optional(dev, con_id, index, flags) | ||
92 | #define devm_gpiod_get_index_optional(varargs...) \ | ||
93 | __devm_gpiod_get_index_optional(varargs, 0) | ||
94 | |||
95 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); | 67 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); |
96 | 68 | ||
97 | int gpiod_get_direction(const struct gpio_desc *desc); | 69 | int gpiod_get_direction(const struct gpio_desc *desc); |
@@ -124,27 +96,31 @@ int desc_to_gpio(const struct gpio_desc *desc); | |||
124 | 96 | ||
125 | #else /* CONFIG_GPIOLIB */ | 97 | #else /* CONFIG_GPIOLIB */ |
126 | 98 | ||
127 | static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, | 99 | static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, |
128 | const char *con_id) | 100 | const char *con_id, |
101 | enum gpiod_flags flags) | ||
129 | { | 102 | { |
130 | return ERR_PTR(-ENOSYS); | 103 | return ERR_PTR(-ENOSYS); |
131 | } | 104 | } |
132 | static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | 105 | static inline struct gpio_desc *__must_check |
133 | const char *con_id, | 106 | __gpiod_get_index(struct device *dev, |
134 | unsigned int idx) | 107 | const char *con_id, |
108 | unsigned int idx, | ||
109 | enum gpiod_flags flags) | ||
135 | { | 110 | { |
136 | return ERR_PTR(-ENOSYS); | 111 | return ERR_PTR(-ENOSYS); |
137 | } | 112 | } |
138 | 113 | ||
139 | static inline struct gpio_desc *__must_check | 114 | static inline struct gpio_desc *__must_check |
140 | gpiod_get_optional(struct device *dev, const char *con_id) | 115 | __gpiod_get_optional(struct device *dev, const char *con_id, |
116 | enum gpiod_flags flags) | ||
141 | { | 117 | { |
142 | return ERR_PTR(-ENOSYS); | 118 | return ERR_PTR(-ENOSYS); |
143 | } | 119 | } |
144 | 120 | ||
145 | static inline struct gpio_desc *__must_check | 121 | static inline struct gpio_desc *__must_check |
146 | gpiod_get_index_optional(struct device *dev, const char *con_id, | 122 | __gpiod_get_index_optional(struct device *dev, const char *con_id, |
147 | unsigned int index) | 123 | unsigned int index, enum gpiod_flags flags) |
148 | { | 124 | { |
149 | return ERR_PTR(-ENOSYS); | 125 | return ERR_PTR(-ENOSYS); |
150 | } | 126 | } |
@@ -157,28 +133,33 @@ static inline void gpiod_put(struct gpio_desc *desc) | |||
157 | WARN_ON(1); | 133 | WARN_ON(1); |
158 | } | 134 | } |
159 | 135 | ||
160 | static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, | 136 | static inline struct gpio_desc *__must_check |
161 | const char *con_id) | 137 | __devm_gpiod_get(struct device *dev, |
138 | const char *con_id, | ||
139 | enum gpiod_flags flags) | ||
162 | { | 140 | { |
163 | return ERR_PTR(-ENOSYS); | 141 | return ERR_PTR(-ENOSYS); |
164 | } | 142 | } |
165 | static inline | 143 | static inline |
166 | struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, | 144 | struct gpio_desc *__must_check |
167 | const char *con_id, | 145 | __devm_gpiod_get_index(struct device *dev, |
168 | unsigned int idx) | 146 | const char *con_id, |
147 | unsigned int idx, | ||
148 | enum gpiod_flags flags) | ||
169 | { | 149 | { |
170 | return ERR_PTR(-ENOSYS); | 150 | return ERR_PTR(-ENOSYS); |
171 | } | 151 | } |
172 | 152 | ||
173 | static inline struct gpio_desc *__must_check | 153 | static inline struct gpio_desc *__must_check |
174 | devm_gpiod_get_optional(struct device *dev, const char *con_id) | 154 | __devm_gpiod_get_optional(struct device *dev, const char *con_id, |
155 | enum gpiod_flags flags) | ||
175 | { | 156 | { |
176 | return ERR_PTR(-ENOSYS); | 157 | return ERR_PTR(-ENOSYS); |
177 | } | 158 | } |
178 | 159 | ||
179 | static inline struct gpio_desc *__must_check | 160 | static inline struct gpio_desc *__must_check |
180 | devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | 161 | __devm_gpiod_get_index_optional(struct device *dev, const char *con_id, |
181 | unsigned int index) | 162 | unsigned int index, enum gpiod_flags flags) |
182 | { | 163 | { |
183 | return ERR_PTR(-ENOSYS); | 164 | return ERR_PTR(-ENOSYS); |
184 | } | 165 | } |
@@ -303,9 +284,43 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) | |||
303 | return -EINVAL; | 284 | return -EINVAL; |
304 | } | 285 | } |
305 | 286 | ||
306 | |||
307 | #endif /* CONFIG_GPIOLIB */ | 287 | #endif /* CONFIG_GPIOLIB */ |
308 | 288 | ||
289 | /* | ||
290 | * Vararg-hacks! This is done to transition the kernel to always pass | ||
291 | * the options flags argument to the below functions. During a transition | ||
292 | * phase these vararg macros make both old-and-newstyle code compile, | ||
293 | * but when all calls to the elder API are removed, these should go away | ||
294 | * and the __gpiod_get() etc functions above be renamed just gpiod_get() | ||
295 | * etc. | ||
296 | */ | ||
297 | #define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags) | ||
298 | #define gpiod_get(varargs...) __gpiod_get(varargs, 0) | ||
299 | #define __gpiod_get_index(dev, con_id, index, flags, ...) \ | ||
300 | __gpiod_get_index(dev, con_id, index, flags) | ||
301 | #define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0) | ||
302 | #define __gpiod_get_optional(dev, con_id, flags, ...) \ | ||
303 | __gpiod_get_optional(dev, con_id, flags) | ||
304 | #define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0) | ||
305 | #define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | ||
306 | __gpiod_get_index_optional(dev, con_id, index, flags) | ||
307 | #define gpiod_get_index_optional(varargs...) \ | ||
308 | __gpiod_get_index_optional(varargs, 0) | ||
309 | #define __devm_gpiod_get(dev, con_id, flags, ...) \ | ||
310 | __devm_gpiod_get(dev, con_id, flags) | ||
311 | #define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0) | ||
312 | #define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \ | ||
313 | __devm_gpiod_get_index(dev, con_id, index, flags) | ||
314 | #define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0) | ||
315 | #define __devm_gpiod_get_optional(dev, con_id, flags, ...) \ | ||
316 | __devm_gpiod_get_optional(dev, con_id, flags) | ||
317 | #define devm_gpiod_get_optional(varargs...) \ | ||
318 | __devm_gpiod_get_optional(varargs, 0) | ||
319 | #define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | ||
320 | __devm_gpiod_get_index_optional(dev, con_id, index, flags) | ||
321 | #define devm_gpiod_get_index_optional(varargs...) \ | ||
322 | __devm_gpiod_get_index_optional(varargs, 0) | ||
323 | |||
309 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) | 324 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) |
310 | 325 | ||
311 | int gpiod_export(struct gpio_desc *desc, bool direction_may_change); | 326 | int gpiod_export(struct gpio_desc *desc, bool direction_may_change); |
diff --git a/include/linux/hash.h b/include/linux/hash.h index bd1754c7ecef..d0494c399392 100644 --- a/include/linux/hash.h +++ b/include/linux/hash.h | |||
@@ -37,6 +37,9 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits) | |||
37 | { | 37 | { |
38 | u64 hash = val; | 38 | u64 hash = val; |
39 | 39 | ||
40 | #if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 | ||
41 | hash = hash * GOLDEN_RATIO_PRIME_64; | ||
42 | #else | ||
40 | /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ | 43 | /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ |
41 | u64 n = hash; | 44 | u64 n = hash; |
42 | n <<= 18; | 45 | n <<= 18; |
@@ -51,6 +54,7 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits) | |||
51 | hash += n; | 54 | hash += n; |
52 | n <<= 2; | 55 | n <<= 2; |
53 | hash += n; | 56 | hash += n; |
57 | #endif | ||
54 | 58 | ||
55 | /* High bits are more random, so use them. */ | 59 | /* High bits are more random, so use them. */ |
56 | return hash >> (64 - bits); | 60 | return hash >> (64 - bits); |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index ea507665896c..b556e0ab946f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -577,16 +577,4 @@ static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node | |||
577 | } | 577 | } |
578 | #endif /* CONFIG_OF */ | 578 | #endif /* CONFIG_OF */ |
579 | 579 | ||
580 | #ifdef CONFIG_I2C_ACPI | ||
581 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter); | ||
582 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter); | ||
583 | void acpi_i2c_register_devices(struct i2c_adapter *adap); | ||
584 | #else | ||
585 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } | ||
586 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
587 | { } | ||
588 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
589 | { return 0; } | ||
590 | #endif | ||
591 | |||
592 | #endif /* _LINUX_I2C_H */ | 580 | #endif /* _LINUX_I2C_H */ |
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index 4b79ffe7b188..fa76c79a52a1 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h | |||
@@ -84,10 +84,12 @@ static inline void iio_trigger_put(struct iio_trigger *trig) | |||
84 | put_device(&trig->dev); | 84 | put_device(&trig->dev); |
85 | } | 85 | } |
86 | 86 | ||
87 | static inline void iio_trigger_get(struct iio_trigger *trig) | 87 | static inline struct iio_trigger *iio_trigger_get(struct iio_trigger *trig) |
88 | { | 88 | { |
89 | get_device(&trig->dev); | 89 | get_device(&trig->dev); |
90 | __module_get(trig->ops->owner); | 90 | __module_get(trig->ops->owner); |
91 | |||
92 | return trig; | ||
91 | } | 93 | } |
92 | 94 | ||
93 | /** | 95 | /** |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index d5b50a19463c..0dae71e9971c 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -159,7 +159,11 @@ typedef struct journal_header_s | |||
159 | * journal_block_tag (in the descriptor). The other h_chksum* fields are | 159 | * journal_block_tag (in the descriptor). The other h_chksum* fields are |
160 | * not used. | 160 | * not used. |
161 | * | 161 | * |
162 | * Checksum v1 and v2 are mutually exclusive features. | 162 | * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses |
163 | * journal_block_tag3_t to store a full 32-bit checksum. Everything else | ||
164 | * is the same as v2. | ||
165 | * | ||
166 | * Checksum v1, v2, and v3 are mutually exclusive features. | ||
163 | */ | 167 | */ |
164 | struct commit_header { | 168 | struct commit_header { |
165 | __be32 h_magic; | 169 | __be32 h_magic; |
@@ -179,6 +183,14 @@ struct commit_header { | |||
179 | * raw struct shouldn't be used for pointer math or sizeof() - use | 183 | * raw struct shouldn't be used for pointer math or sizeof() - use |
180 | * journal_tag_bytes(journal) instead to compute this. | 184 | * journal_tag_bytes(journal) instead to compute this. |
181 | */ | 185 | */ |
186 | typedef struct journal_block_tag3_s | ||
187 | { | ||
188 | __be32 t_blocknr; /* The on-disk block number */ | ||
189 | __be32 t_flags; /* See below */ | ||
190 | __be32 t_blocknr_high; /* most-significant high 32bits. */ | ||
191 | __be32 t_checksum; /* crc32c(uuid+seq+block) */ | ||
192 | } journal_block_tag3_t; | ||
193 | |||
182 | typedef struct journal_block_tag_s | 194 | typedef struct journal_block_tag_s |
183 | { | 195 | { |
184 | __be32 t_blocknr; /* The on-disk block number */ | 196 | __be32 t_blocknr; /* The on-disk block number */ |
@@ -187,9 +199,6 @@ typedef struct journal_block_tag_s | |||
187 | __be32 t_blocknr_high; /* most-significant high 32bits. */ | 199 | __be32 t_blocknr_high; /* most-significant high 32bits. */ |
188 | } journal_block_tag_t; | 200 | } journal_block_tag_t; |
189 | 201 | ||
190 | #define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high)) | ||
191 | #define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t)) | ||
192 | |||
193 | /* Tail of descriptor block, for checksumming */ | 202 | /* Tail of descriptor block, for checksumming */ |
194 | struct jbd2_journal_block_tail { | 203 | struct jbd2_journal_block_tail { |
195 | __be32 t_checksum; /* crc32c(uuid+descr_block) */ | 204 | __be32 t_checksum; /* crc32c(uuid+descr_block) */ |
@@ -284,6 +293,7 @@ typedef struct journal_superblock_s | |||
284 | #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 | 293 | #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 |
285 | #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 | 294 | #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 |
286 | #define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 | 295 | #define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 |
296 | #define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010 | ||
287 | 297 | ||
288 | /* Features known to this kernel version: */ | 298 | /* Features known to this kernel version: */ |
289 | #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM | 299 | #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM |
@@ -291,7 +301,8 @@ typedef struct journal_superblock_s | |||
291 | #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ | 301 | #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ |
292 | JBD2_FEATURE_INCOMPAT_64BIT | \ | 302 | JBD2_FEATURE_INCOMPAT_64BIT | \ |
293 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ | 303 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ |
294 | JBD2_FEATURE_INCOMPAT_CSUM_V2) | 304 | JBD2_FEATURE_INCOMPAT_CSUM_V2 | \ |
305 | JBD2_FEATURE_INCOMPAT_CSUM_V3) | ||
295 | 306 | ||
296 | #ifdef __KERNEL__ | 307 | #ifdef __KERNEL__ |
297 | 308 | ||
@@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t y) | |||
1296 | extern int jbd2_journal_blocks_per_page(struct inode *inode); | 1307 | extern int jbd2_journal_blocks_per_page(struct inode *inode); |
1297 | extern size_t journal_tag_bytes(journal_t *journal); | 1308 | extern size_t journal_tag_bytes(journal_t *journal); |
1298 | 1309 | ||
1310 | static inline int jbd2_journal_has_csum_v2or3(journal_t *journal) | ||
1311 | { | ||
1312 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) || | ||
1313 | JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) | ||
1314 | return 1; | ||
1315 | |||
1316 | return 0; | ||
1317 | } | ||
1318 | |||
1299 | /* | 1319 | /* |
1300 | * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for | 1320 | * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for |
1301 | * transaction control blocks. | 1321 | * transaction control blocks. |
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 1f44466c1e9d..c367cbdf73ab 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -258,23 +258,11 @@ extern unsigned long preset_lpj; | |||
258 | #define SEC_JIFFIE_SC (32 - SHIFT_HZ) | 258 | #define SEC_JIFFIE_SC (32 - SHIFT_HZ) |
259 | #endif | 259 | #endif |
260 | #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) | 260 | #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) |
261 | #define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19) | ||
262 | #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ | 261 | #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ |
263 | TICK_NSEC -1) / (u64)TICK_NSEC)) | 262 | TICK_NSEC -1) / (u64)TICK_NSEC)) |
264 | 263 | ||
265 | #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ | 264 | #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ |
266 | TICK_NSEC -1) / (u64)TICK_NSEC)) | 265 | TICK_NSEC -1) / (u64)TICK_NSEC)) |
267 | #define USEC_CONVERSION \ | ||
268 | ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\ | ||
269 | TICK_NSEC -1) / (u64)TICK_NSEC)) | ||
270 | /* | ||
271 | * USEC_ROUND is used in the timeval to jiffie conversion. See there | ||
272 | * for more details. It is the scaled resolution rounding value. Note | ||
273 | * that it is a 64-bit value. Since, when it is applied, we are already | ||
274 | * in jiffies (albit scaled), it is nothing but the bits we will shift | ||
275 | * off. | ||
276 | */ | ||
277 | #define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1) | ||
278 | /* | 266 | /* |
279 | * The maximum jiffie value is (MAX_INT >> 1). Here we translate that | 267 | * The maximum jiffie value is (MAX_INT >> 1). Here we translate that |
280 | * into seconds. The 64-bit case will overflow if we are not careful, | 268 | * into seconds. The 64-bit case will overflow if we are not careful, |
diff --git a/include/linux/leds.h b/include/linux/leds.h index 6a599dce7f9d..e43686472197 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/rwsem.h> | 17 | #include <linux/rwsem.h> |
18 | #include <linux/timer.h> | ||
18 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
19 | 20 | ||
20 | struct device; | 21 | struct device; |
@@ -68,7 +69,7 @@ struct led_classdev { | |||
68 | const char *default_trigger; /* Trigger to use */ | 69 | const char *default_trigger; /* Trigger to use */ |
69 | 70 | ||
70 | unsigned long blink_delay_on, blink_delay_off; | 71 | unsigned long blink_delay_on, blink_delay_off; |
71 | struct delayed_work blink_work; | 72 | struct timer_list blink_timer; |
72 | int blink_brightness; | 73 | int blink_brightness; |
73 | 74 | ||
74 | struct work_struct set_brightness_work; | 75 | struct work_struct set_brightness_work; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 071f6b234604..a5b7d7cfcedf 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -209,6 +209,7 @@ enum { | |||
209 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | 209 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, |
210 | MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, | 210 | MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, |
211 | MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, | 211 | MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, |
212 | MLX4_BMME_FLAG_VSD_INIT2RTR = 1 << 28, | ||
212 | }; | 213 | }; |
213 | 214 | ||
214 | enum mlx4_event { | 215 | enum mlx4_event { |
@@ -1196,6 +1197,9 @@ int mlx4_map_sw_to_hw_steering_id(struct mlx4_dev *dev, | |||
1196 | enum mlx4_net_trans_rule_id id); | 1197 | enum mlx4_net_trans_rule_id id); |
1197 | int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id); | 1198 | int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id); |
1198 | 1199 | ||
1200 | int mlx4_tunnel_steer_add(struct mlx4_dev *dev, unsigned char *addr, | ||
1201 | int port, int qpn, u16 prio, u64 *reg_id); | ||
1202 | |||
1199 | void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, | 1203 | void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, |
1200 | int i, int val); | 1204 | int i, int val); |
1201 | 1205 | ||
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 7040dc98ff8b..5f4e36cf0091 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -56,7 +56,8 @@ enum mlx4_qp_optpar { | |||
56 | MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13, | 56 | MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13, |
57 | MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, | 57 | MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, |
58 | MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16, | 58 | MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16, |
59 | MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20 | 59 | MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20, |
60 | MLX4_QP_OPTPAR_VLAN_STRIPPING = 1 << 21, | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | enum mlx4_qp_state { | 63 | enum mlx4_qp_state { |
@@ -423,13 +424,20 @@ struct mlx4_wqe_inline_seg { | |||
423 | 424 | ||
424 | enum mlx4_update_qp_attr { | 425 | enum mlx4_update_qp_attr { |
425 | MLX4_UPDATE_QP_SMAC = 1 << 0, | 426 | MLX4_UPDATE_QP_SMAC = 1 << 0, |
427 | MLX4_UPDATE_QP_VSD = 1 << 2, | ||
428 | MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 | ||
429 | }; | ||
430 | |||
431 | enum mlx4_update_qp_params_flags { | ||
432 | MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE = 1 << 0, | ||
426 | }; | 433 | }; |
427 | 434 | ||
428 | struct mlx4_update_qp_params { | 435 | struct mlx4_update_qp_params { |
429 | u8 smac_index; | 436 | u8 smac_index; |
437 | u32 flags; | ||
430 | }; | 438 | }; |
431 | 439 | ||
432 | int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | 440 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, |
433 | enum mlx4_update_qp_attr attr, | 441 | enum mlx4_update_qp_attr attr, |
434 | struct mlx4_update_qp_params *params); | 442 | struct mlx4_update_qp_params *params); |
435 | int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | 443 | int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 3083c53e0270..c300db3ae285 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -949,7 +949,7 @@ static inline int jedec_feature(struct nand_chip *chip) | |||
949 | : 0; | 949 | : 0; |
950 | } | 950 | } |
951 | 951 | ||
952 | /** | 952 | /* |
953 | * struct nand_sdr_timings - SDR NAND chip timings | 953 | * struct nand_sdr_timings - SDR NAND chip timings |
954 | * | 954 | * |
955 | * This struct defines the timing requirements of a SDR NAND chip. | 955 | * This struct defines the timing requirements of a SDR NAND chip. |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 38377392d082..c8e388e5fccc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -3176,7 +3176,7 @@ static inline int __dev_uc_sync(struct net_device *dev, | |||
3176 | } | 3176 | } |
3177 | 3177 | ||
3178 | /** | 3178 | /** |
3179 | * __dev_uc_unsync - Remove synchonized addresses from device | 3179 | * __dev_uc_unsync - Remove synchronized addresses from device |
3180 | * @dev: device to sync | 3180 | * @dev: device to sync |
3181 | * @unsync: function to call if address should be removed | 3181 | * @unsync: function to call if address should be removed |
3182 | * | 3182 | * |
@@ -3220,7 +3220,7 @@ static inline int __dev_mc_sync(struct net_device *dev, | |||
3220 | } | 3220 | } |
3221 | 3221 | ||
3222 | /** | 3222 | /** |
3223 | * __dev_mc_unsync - Remove synchonized addresses from device | 3223 | * __dev_mc_unsync - Remove synchronized addresses from device |
3224 | * @dev: device to sync | 3224 | * @dev: device to sync |
3225 | * @unsync: function to call if address should be removed | 3225 | * @unsync: function to call if address should be removed |
3226 | * | 3226 | * |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 2077489f9887..2517ece98820 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/in6.h> | 9 | #include <linux/in6.h> |
10 | #include <linux/wait.h> | 10 | #include <linux/wait.h> |
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | #include <linux/static_key.h> | ||
12 | #include <uapi/linux/netfilter.h> | 13 | #include <uapi/linux/netfilter.h> |
13 | #ifdef CONFIG_NETFILTER | 14 | #ifdef CONFIG_NETFILTER |
14 | static inline int NF_DROP_GETERR(int verdict) | 15 | static inline int NF_DROP_GETERR(int verdict) |
@@ -99,9 +100,9 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg); | |||
99 | 100 | ||
100 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 101 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
101 | 102 | ||
102 | #if defined(CONFIG_JUMP_LABEL) | 103 | #ifdef HAVE_JUMP_LABEL |
103 | #include <linux/static_key.h> | ||
104 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 104 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
105 | |||
105 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) | 106 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) |
106 | { | 107 | { |
107 | if (__builtin_constant_p(pf) && | 108 | if (__builtin_constant_p(pf) && |
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 6ad2bbcad405..6c3e06ee2fb7 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
@@ -123,6 +123,7 @@ extern int nfs_wait_on_request(struct nfs_page *); | |||
123 | extern void nfs_unlock_request(struct nfs_page *req); | 123 | extern void nfs_unlock_request(struct nfs_page *req); |
124 | extern void nfs_unlock_and_release_request(struct nfs_page *); | 124 | extern void nfs_unlock_and_release_request(struct nfs_page *); |
125 | extern int nfs_page_group_lock(struct nfs_page *, bool); | 125 | extern int nfs_page_group_lock(struct nfs_page *, bool); |
126 | extern void nfs_page_group_lock_wait(struct nfs_page *); | ||
126 | extern void nfs_page_group_unlock(struct nfs_page *); | 127 | extern void nfs_page_group_unlock(struct nfs_page *); |
127 | extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); | 128 | extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); |
128 | 129 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 61978a460841..96453f9bc8ba 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -303,6 +303,7 @@ struct pci_dev { | |||
303 | D3cold, not set for devices | 303 | D3cold, not set for devices |
304 | powered on/off by the | 304 | powered on/off by the |
305 | corresponding bridge */ | 305 | corresponding bridge */ |
306 | unsigned int ignore_hotplug:1; /* Ignore hotplug events */ | ||
306 | unsigned int d3_delay; /* D3->D0 transition time in ms */ | 307 | unsigned int d3_delay; /* D3->D0 transition time in ms */ |
307 | unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ | 308 | unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ |
308 | 309 | ||
@@ -1021,6 +1022,11 @@ bool pci_dev_run_wake(struct pci_dev *dev); | |||
1021 | bool pci_check_pme_status(struct pci_dev *dev); | 1022 | bool pci_check_pme_status(struct pci_dev *dev); |
1022 | void pci_pme_wakeup_bus(struct pci_bus *bus); | 1023 | void pci_pme_wakeup_bus(struct pci_bus *bus); |
1023 | 1024 | ||
1025 | static inline void pci_ignore_hotplug(struct pci_dev *dev) | ||
1026 | { | ||
1027 | dev->ignore_hotplug = 1; | ||
1028 | } | ||
1029 | |||
1024 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | 1030 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
1025 | bool enable) | 1031 | bool enable) |
1026 | { | 1032 | { |
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index 3dfbf237cd8f..ef5894ca8e50 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h | |||
@@ -71,6 +71,7 @@ void percpu_ref_reinit(struct percpu_ref *ref); | |||
71 | void percpu_ref_exit(struct percpu_ref *ref); | 71 | void percpu_ref_exit(struct percpu_ref *ref); |
72 | void percpu_ref_kill_and_confirm(struct percpu_ref *ref, | 72 | void percpu_ref_kill_and_confirm(struct percpu_ref *ref, |
73 | percpu_ref_func_t *confirm_kill); | 73 | percpu_ref_func_t *confirm_kill); |
74 | void __percpu_ref_kill_expedited(struct percpu_ref *ref); | ||
74 | 75 | ||
75 | /** | 76 | /** |
76 | * percpu_ref_kill - drop the initial ref | 77 | * percpu_ref_kill - drop the initial ref |
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h index 660c029d694f..16ec262dfcc8 100644 --- a/include/linux/platform_data/mtd-nand-omap2.h +++ b/include/linux/platform_data/mtd-nand-omap2.h | |||
@@ -21,8 +21,17 @@ enum nand_io { | |||
21 | }; | 21 | }; |
22 | 22 | ||
23 | enum omap_ecc { | 23 | enum omap_ecc { |
24 | /* 1-bit ECC calculation by GPMC, Error detection by Software */ | 24 | /* |
25 | OMAP_ECC_HAM1_CODE_HW = 0, | 25 | * 1-bit ECC: calculation and correction by SW |
26 | * ECC stored at end of spare area | ||
27 | */ | ||
28 | OMAP_ECC_HAM1_CODE_SW = 0, | ||
29 | |||
30 | /* | ||
31 | * 1-bit ECC: calculation by GPMC, Error detection by Software | ||
32 | * ECC layout compatible with ROM code layout | ||
33 | */ | ||
34 | OMAP_ECC_HAM1_CODE_HW, | ||
26 | /* 4-bit ECC calculation by GPMC, Error detection by Software */ | 35 | /* 4-bit ECC calculation by GPMC, Error detection by Software */ |
27 | OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, | 36 | OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, |
28 | /* 4-bit ECC calculation by GPMC, Error detection by ELM */ | 37 | /* 4-bit ECC calculation by GPMC, Error detection by ELM */ |
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 7c1d252b20c0..ebc4c76ffb73 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h | |||
@@ -60,7 +60,7 @@ struct generic_pm_domain { | |||
60 | struct mutex lock; | 60 | struct mutex lock; |
61 | struct dev_power_governor *gov; | 61 | struct dev_power_governor *gov; |
62 | struct work_struct power_off_work; | 62 | struct work_struct power_off_work; |
63 | char *name; | 63 | const char *name; |
64 | unsigned int in_progress; /* Number of devices being suspended now */ | 64 | unsigned int in_progress; /* Number of devices being suspended now */ |
65 | atomic_t sd_count; /* Number of subdomains with power "on" */ | 65 | atomic_t sd_count; /* Number of subdomains with power "on" */ |
66 | enum gpd_status status; /* Current state of the domain */ | 66 | enum gpd_status status; /* Current state of the domain */ |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index bbe03a1924c0..4efa1ed8a2b0 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -218,6 +218,8 @@ enum regulator_type { | |||
218 | * @linear_min_sel: Minimal selector for starting linear mapping | 218 | * @linear_min_sel: Minimal selector for starting linear mapping |
219 | * @fixed_uV: Fixed voltage of rails. | 219 | * @fixed_uV: Fixed voltage of rails. |
220 | * @ramp_delay: Time to settle down after voltage change (unit: uV/us) | 220 | * @ramp_delay: Time to settle down after voltage change (unit: uV/us) |
221 | * @linear_ranges: A constant table of possible voltage ranges. | ||
222 | * @n_linear_ranges: Number of entries in the @linear_ranges table. | ||
221 | * @volt_table: Voltage mapping table (if table based mapping) | 223 | * @volt_table: Voltage mapping table (if table based mapping) |
222 | * | 224 | * |
223 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ | 225 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 730e638c5589..0b08d05d470b 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
@@ -85,6 +85,7 @@ struct regulator_state { | |||
85 | * bootloader then it will be enabled when the constraints are | 85 | * bootloader then it will be enabled when the constraints are |
86 | * applied. | 86 | * applied. |
87 | * @apply_uV: Apply the voltage constraint when initialising. | 87 | * @apply_uV: Apply the voltage constraint when initialising. |
88 | * @ramp_disable: Disable ramp delay when initialising or when setting voltage. | ||
88 | * | 89 | * |
89 | * @input_uV: Input voltage for regulator when supplied by another regulator. | 90 | * @input_uV: Input voltage for regulator when supplied by another regulator. |
90 | * | 91 | * |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5c2c885ee52b..b867a4dab38a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1903,8 +1903,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, | |||
1903 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ | 1903 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ |
1904 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ | 1904 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ |
1905 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ | 1905 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
1906 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ | ||
1907 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ | ||
1908 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ | 1906 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ |
1909 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ | 1907 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
1910 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1908 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
@@ -1957,17 +1955,31 @@ static inline void memalloc_noio_restore(unsigned int flags) | |||
1957 | } | 1955 | } |
1958 | 1956 | ||
1959 | /* Per-process atomic flags. */ | 1957 | /* Per-process atomic flags. */ |
1960 | #define PFA_NO_NEW_PRIVS 0x00000001 /* May not gain new privileges. */ | 1958 | #define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */ |
1959 | #define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */ | ||
1960 | #define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */ | ||
1961 | 1961 | ||
1962 | static inline bool task_no_new_privs(struct task_struct *p) | ||
1963 | { | ||
1964 | return test_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); | ||
1965 | } | ||
1966 | 1962 | ||
1967 | static inline void task_set_no_new_privs(struct task_struct *p) | 1963 | #define TASK_PFA_TEST(name, func) \ |
1968 | { | 1964 | static inline bool task_##func(struct task_struct *p) \ |
1969 | set_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); | 1965 | { return test_bit(PFA_##name, &p->atomic_flags); } |
1970 | } | 1966 | #define TASK_PFA_SET(name, func) \ |
1967 | static inline void task_set_##func(struct task_struct *p) \ | ||
1968 | { set_bit(PFA_##name, &p->atomic_flags); } | ||
1969 | #define TASK_PFA_CLEAR(name, func) \ | ||
1970 | static inline void task_clear_##func(struct task_struct *p) \ | ||
1971 | { clear_bit(PFA_##name, &p->atomic_flags); } | ||
1972 | |||
1973 | TASK_PFA_TEST(NO_NEW_PRIVS, no_new_privs) | ||
1974 | TASK_PFA_SET(NO_NEW_PRIVS, no_new_privs) | ||
1975 | |||
1976 | TASK_PFA_TEST(SPREAD_PAGE, spread_page) | ||
1977 | TASK_PFA_SET(SPREAD_PAGE, spread_page) | ||
1978 | TASK_PFA_CLEAR(SPREAD_PAGE, spread_page) | ||
1979 | |||
1980 | TASK_PFA_TEST(SPREAD_SLAB, spread_slab) | ||
1981 | TASK_PFA_SET(SPREAD_SLAB, spread_slab) | ||
1982 | TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab) | ||
1971 | 1983 | ||
1972 | /* | 1984 | /* |
1973 | * task->jobctl flags | 1985 | * task->jobctl flags |
@@ -2608,9 +2620,22 @@ static inline void setup_thread_stack(struct task_struct *p, struct task_struct | |||
2608 | task_thread_info(p)->task = p; | 2620 | task_thread_info(p)->task = p; |
2609 | } | 2621 | } |
2610 | 2622 | ||
2623 | /* | ||
2624 | * Return the address of the last usable long on the stack. | ||
2625 | * | ||
2626 | * When the stack grows down, this is just above the thread | ||
2627 | * info struct. Going any lower will corrupt the threadinfo. | ||
2628 | * | ||
2629 | * When the stack grows up, this is the highest address. | ||
2630 | * Beyond that position, we corrupt data on the next page. | ||
2631 | */ | ||
2611 | static inline unsigned long *end_of_stack(struct task_struct *p) | 2632 | static inline unsigned long *end_of_stack(struct task_struct *p) |
2612 | { | 2633 | { |
2634 | #ifdef CONFIG_STACK_GROWSUP | ||
2635 | return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1; | ||
2636 | #else | ||
2613 | return (unsigned long *)(task_thread_info(p) + 1); | 2637 | return (unsigned long *)(task_thread_info(p) + 1); |
2638 | #endif | ||
2614 | } | 2639 | } |
2615 | 2640 | ||
2616 | #endif | 2641 | #endif |
diff --git a/include/linux/seqno-fence.h b/include/linux/seqno-fence.h index 3d6003de4b0d..a1ba6a5ccdd6 100644 --- a/include/linux/seqno-fence.h +++ b/include/linux/seqno-fence.h | |||
@@ -62,6 +62,7 @@ to_seqno_fence(struct fence *fence) | |||
62 | * @context: the execution context this fence is a part of | 62 | * @context: the execution context this fence is a part of |
63 | * @seqno_ofs: the offset within @sync_buf | 63 | * @seqno_ofs: the offset within @sync_buf |
64 | * @seqno: the sequence # to signal on | 64 | * @seqno: the sequence # to signal on |
65 | * @cond: fence wait condition | ||
65 | * @ops: the fence_ops for operations on this seqno fence | 66 | * @ops: the fence_ops for operations on this seqno fence |
66 | * | 67 | * |
67 | * This function initializes a struct seqno_fence with passed parameters, | 68 | * This function initializes a struct seqno_fence with passed parameters, |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index e713543336f1..46d188a9947c 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -253,6 +253,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
253 | * the device whose settings are being modified. | 253 | * the device whose settings are being modified. |
254 | * @transfer: adds a message to the controller's transfer queue. | 254 | * @transfer: adds a message to the controller's transfer queue. |
255 | * @cleanup: frees controller-specific state | 255 | * @cleanup: frees controller-specific state |
256 | * @can_dma: determine whether this master supports DMA | ||
256 | * @queued: whether this master is providing an internal message queue | 257 | * @queued: whether this master is providing an internal message queue |
257 | * @kworker: thread struct for message pump | 258 | * @kworker: thread struct for message pump |
258 | * @kworker_task: pointer to task for message pump kworker thread | 259 | * @kworker_task: pointer to task for message pump kworker thread |
@@ -262,6 +263,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
262 | * @cur_msg: the currently in-flight message | 263 | * @cur_msg: the currently in-flight message |
263 | * @cur_msg_prepared: spi_prepare_message was called for the currently | 264 | * @cur_msg_prepared: spi_prepare_message was called for the currently |
264 | * in-flight message | 265 | * in-flight message |
266 | * @cur_msg_mapped: message has been mapped for DMA | ||
265 | * @xfer_completion: used by core transfer_one_message() | 267 | * @xfer_completion: used by core transfer_one_message() |
266 | * @busy: message pump is busy | 268 | * @busy: message pump is busy |
267 | * @running: message pump is running | 269 | * @running: message pump is running |
@@ -299,6 +301,10 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
299 | * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS | 301 | * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS |
300 | * number. Any individual value may be -ENOENT for CS lines that | 302 | * number. Any individual value may be -ENOENT for CS lines that |
301 | * are not GPIOs (driven by the SPI controller itself). | 303 | * are not GPIOs (driven by the SPI controller itself). |
304 | * @dma_tx: DMA transmit channel | ||
305 | * @dma_rx: DMA receive channel | ||
306 | * @dummy_rx: dummy receive buffer for full-duplex devices | ||
307 | * @dummy_tx: dummy transmit buffer for full-duplex devices | ||
302 | * | 308 | * |
303 | * Each SPI master controller can communicate with one or more @spi_device | 309 | * Each SPI master controller can communicate with one or more @spi_device |
304 | * children. These make a small bus, sharing MOSI, MISO and SCK signals | 310 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
@@ -632,6 +638,7 @@ struct spi_transfer { | |||
632 | * addresses for each transfer buffer | 638 | * addresses for each transfer buffer |
633 | * @complete: called to report transaction completions | 639 | * @complete: called to report transaction completions |
634 | * @context: the argument to complete() when it's called | 640 | * @context: the argument to complete() when it's called |
641 | * @frame_length: the total number of bytes in the message | ||
635 | * @actual_length: the total number of bytes that were transferred in all | 642 | * @actual_length: the total number of bytes that were transferred in all |
636 | * successful segments | 643 | * successful segments |
637 | * @status: zero for success, else negative errno | 644 | * @status: zero for success, else negative errno |
diff --git a/include/linux/tick.h b/include/linux/tick.h index 059052306831..9a82c7dc3fdd 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -183,13 +183,8 @@ static inline bool tick_nohz_full_cpu(int cpu) | |||
183 | 183 | ||
184 | extern void tick_nohz_init(void); | 184 | extern void tick_nohz_init(void); |
185 | extern void __tick_nohz_full_check(void); | 185 | extern void __tick_nohz_full_check(void); |
186 | extern void tick_nohz_full_kick(void); | ||
186 | extern void tick_nohz_full_kick_cpu(int cpu); | 187 | extern void tick_nohz_full_kick_cpu(int cpu); |
187 | |||
188 | static inline void tick_nohz_full_kick(void) | ||
189 | { | ||
190 | tick_nohz_full_kick_cpu(smp_processor_id()); | ||
191 | } | ||
192 | |||
193 | extern void tick_nohz_full_kick_all(void); | 188 | extern void tick_nohz_full_kick_all(void); |
194 | extern void __tick_nohz_task_switch(struct task_struct *tsk); | 189 | extern void __tick_nohz_task_switch(struct task_struct *tsk); |
195 | #else | 190 | #else |
diff --git a/include/linux/uio.h b/include/linux/uio.h index 48d64e6ab292..290fbf0b6b8a 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -84,7 +84,7 @@ unsigned long iov_iter_alignment(const struct iov_iter *i); | |||
84 | void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, | 84 | void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, |
85 | unsigned long nr_segs, size_t count); | 85 | unsigned long nr_segs, size_t count); |
86 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, | 86 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, |
87 | unsigned maxpages, size_t *start); | 87 | size_t maxsize, unsigned maxpages, size_t *start); |
88 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, | 88 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, |
89 | size_t maxsize, size_t *start); | 89 | size_t maxsize, size_t *start); |
90 | int iov_iter_npages(const struct iov_iter *i, int maxpages); | 90 | int iov_iter_npages(const struct iov_iter *i, int maxpages); |
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h index 502073a53dd3..b483abd34493 100644 --- a/include/linux/vga_switcheroo.h +++ b/include/linux/vga_switcheroo.h | |||
@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(struct pci_dev *dev); | |||
64 | void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); | 64 | void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); |
65 | 65 | ||
66 | int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); | 66 | int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); |
67 | void vga_switcheroo_fini_domain_pm_ops(struct device *dev); | ||
67 | int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); | 68 | int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); |
68 | #else | 69 | #else |
69 | 70 | ||
@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return | |||
82 | static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} | 83 | static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} |
83 | 84 | ||
84 | static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } | 85 | static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } |
86 | static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {} | ||
85 | static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } | 87 | static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } |
86 | 88 | ||
87 | #endif | 89 | #endif |
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index 2c02f3a8d2ba..c37bd4d06739 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h | |||
@@ -182,7 +182,6 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc); | |||
182 | * vga_get()... | 182 | * vga_get()... |
183 | */ | 183 | */ |
184 | 184 | ||
185 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
186 | #ifdef CONFIG_VGA_ARB | 185 | #ifdef CONFIG_VGA_ARB |
187 | extern struct pci_dev *vga_default_device(void); | 186 | extern struct pci_dev *vga_default_device(void); |
188 | extern void vga_set_default_device(struct pci_dev *pdev); | 187 | extern void vga_set_default_device(struct pci_dev *pdev); |
@@ -190,7 +189,6 @@ extern void vga_set_default_device(struct pci_dev *pdev); | |||
190 | static inline struct pci_dev *vga_default_device(void) { return NULL; }; | 189 | static inline struct pci_dev *vga_default_device(void) { return NULL; }; |
191 | static inline void vga_set_default_device(struct pci_dev *pdev) { }; | 190 | static inline void vga_set_default_device(struct pci_dev *pdev) { }; |
192 | #endif | 191 | #endif |
193 | #endif | ||
194 | 192 | ||
195 | /** | 193 | /** |
196 | * vga_conflicts | 194 | * vga_conflicts |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index a0cc2e95ed1b..b996e6cde6bb 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -419,7 +419,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, | |||
419 | alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ | 419 | alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ |
420 | 1, (name)) | 420 | 1, (name)) |
421 | #define create_singlethread_workqueue(name) \ | 421 | #define create_singlethread_workqueue(name) \ |
422 | alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name)) | 422 | alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name) |
423 | 423 | ||
424 | extern void destroy_workqueue(struct workqueue_struct *wq); | 424 | extern void destroy_workqueue(struct workqueue_struct *wq); |
425 | 425 | ||
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index fc910a622451..2fefcf491aa8 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -295,7 +295,7 @@ struct vb2_buffer { | |||
295 | * can return an error if hardware fails, in that case all | 295 | * can return an error if hardware fails, in that case all |
296 | * buffers that have been already given by the @buf_queue | 296 | * buffers that have been already given by the @buf_queue |
297 | * callback are to be returned by the driver by calling | 297 | * callback are to be returned by the driver by calling |
298 | * @vb2_buffer_done(VB2_BUF_STATE_DEQUEUED). | 298 | * @vb2_buffer_done(VB2_BUF_STATE_QUEUED). |
299 | * If you need a minimum number of buffers before you can | 299 | * If you need a minimum number of buffers before you can |
300 | * start streaming, then set @min_buffers_needed in the | 300 | * start streaming, then set @min_buffers_needed in the |
301 | * vb2_queue structure. If that is non-zero then | 301 | * vb2_queue structure. If that is non-zero then |
@@ -380,6 +380,9 @@ struct v4l2_fh; | |||
380 | * @start_streaming_called: start_streaming() was called successfully and we | 380 | * @start_streaming_called: start_streaming() was called successfully and we |
381 | * started streaming. | 381 | * started streaming. |
382 | * @error: a fatal error occurred on the queue | 382 | * @error: a fatal error occurred on the queue |
383 | * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for | ||
384 | * buffers. Only set for capture queues if qbuf has not yet been | ||
385 | * called since poll() needs to return POLLERR in that situation. | ||
383 | * @fileio: file io emulator internal data, used only if emulator is active | 386 | * @fileio: file io emulator internal data, used only if emulator is active |
384 | * @threadio: thread io internal data, used only if thread is active | 387 | * @threadio: thread io internal data, used only if thread is active |
385 | */ | 388 | */ |
@@ -417,6 +420,7 @@ struct vb2_queue { | |||
417 | unsigned int streaming:1; | 420 | unsigned int streaming:1; |
418 | unsigned int start_streaming_called:1; | 421 | unsigned int start_streaming_called:1; |
419 | unsigned int error:1; | 422 | unsigned int error:1; |
423 | unsigned int waiting_for_buffers:1; | ||
420 | 424 | ||
421 | struct vb2_fileio_data *fileio; | 425 | struct vb2_fileio_data *fileio; |
422 | struct vb2_threadio_data *threadio; | 426 | struct vb2_threadio_data *threadio; |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index f679877bb601..ec51e673b4b6 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -204,6 +204,7 @@ void ipv6_sock_ac_close(struct sock *sk); | |||
204 | 204 | ||
205 | int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); | 205 | int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); |
206 | int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); | 206 | int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); |
207 | void ipv6_ac_destroy_dev(struct inet6_dev *idev); | ||
207 | bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, | 208 | bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, |
208 | const struct in6_addr *addr); | 209 | const struct in6_addr *addr); |
209 | bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev, | 210 | bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev, |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index b5d5af3aa469..6f884e6c731e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -464,6 +464,8 @@ struct hci_conn_params { | |||
464 | HCI_AUTO_CONN_ALWAYS, | 464 | HCI_AUTO_CONN_ALWAYS, |
465 | HCI_AUTO_CONN_LINK_LOSS, | 465 | HCI_AUTO_CONN_LINK_LOSS, |
466 | } auto_connect; | 466 | } auto_connect; |
467 | |||
468 | struct hci_conn *conn; | ||
467 | }; | 469 | }; |
468 | 470 | ||
469 | extern struct list_head hci_dev_list; | 471 | extern struct list_head hci_dev_list; |
diff --git a/include/net/dst.h b/include/net/dst.h index 71c60f42be48..a8ae4e760778 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -480,6 +480,7 @@ void dst_init(void); | |||
480 | /* Flags for xfrm_lookup flags argument. */ | 480 | /* Flags for xfrm_lookup flags argument. */ |
481 | enum { | 481 | enum { |
482 | XFRM_LOOKUP_ICMP = 1 << 0, | 482 | XFRM_LOOKUP_ICMP = 1 << 0, |
483 | XFRM_LOOKUP_QUEUE = 1 << 1, | ||
483 | }; | 484 | }; |
484 | 485 | ||
485 | struct flowi; | 486 | struct flowi; |
@@ -490,7 +491,16 @@ static inline struct dst_entry *xfrm_lookup(struct net *net, | |||
490 | int flags) | 491 | int flags) |
491 | { | 492 | { |
492 | return dst_orig; | 493 | return dst_orig; |
493 | } | 494 | } |
495 | |||
496 | static inline struct dst_entry *xfrm_lookup_route(struct net *net, | ||
497 | struct dst_entry *dst_orig, | ||
498 | const struct flowi *fl, | ||
499 | struct sock *sk, | ||
500 | int flags) | ||
501 | { | ||
502 | return dst_orig; | ||
503 | } | ||
494 | 504 | ||
495 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) | 505 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) |
496 | { | 506 | { |
@@ -502,6 +512,10 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
502 | const struct flowi *fl, struct sock *sk, | 512 | const struct flowi *fl, struct sock *sk, |
503 | int flags); | 513 | int flags); |
504 | 514 | ||
515 | struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, | ||
516 | const struct flowi *fl, struct sock *sk, | ||
517 | int flags); | ||
518 | |||
505 | /* skb attached with this dst needs transformation if dst->xfrm is valid */ | 519 | /* skb attached with this dst needs transformation if dst->xfrm is valid */ |
506 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) | 520 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) |
507 | { | 521 | { |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 93695f0e22a5..af10c2cf8a1d 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -394,4 +394,12 @@ static inline int genl_set_err(struct genl_family *family, struct net *net, | |||
394 | return netlink_set_err(net->genl_sock, portid, group, code); | 394 | return netlink_set_err(net->genl_sock, portid, group, code); |
395 | } | 395 | } |
396 | 396 | ||
397 | static inline int genl_has_listeners(struct genl_family *family, | ||
398 | struct sock *sk, unsigned int group) | ||
399 | { | ||
400 | if (WARN_ON_ONCE(group >= family->n_mcgrps)) | ||
401 | return -EINVAL; | ||
402 | group = family->mcgrp_offset + group; | ||
403 | return netlink_has_listeners(sk, group); | ||
404 | } | ||
397 | #endif /* __NET_GENERIC_NETLINK_H */ | 405 | #endif /* __NET_GENERIC_NETLINK_H */ |
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h index e2070960bac0..8170f8d7052b 100644 --- a/include/net/netns/ieee802154_6lowpan.h +++ b/include/net/netns/ieee802154_6lowpan.h | |||
@@ -16,7 +16,6 @@ struct netns_sysctl_lowpan { | |||
16 | struct netns_ieee802154_lowpan { | 16 | struct netns_ieee802154_lowpan { |
17 | struct netns_sysctl_lowpan sysctl; | 17 | struct netns_sysctl_lowpan sysctl; |
18 | struct netns_frags frags; | 18 | struct netns_frags frags; |
19 | int max_dsize; | ||
20 | }; | 19 | }; |
21 | 20 | ||
22 | #endif | 21 | #endif |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index 259992444e80..dad7ab20a8cb 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
@@ -167,7 +167,7 @@ struct ieee80211_reg_rule { | |||
167 | struct ieee80211_regdomain { | 167 | struct ieee80211_regdomain { |
168 | struct rcu_head rcu_head; | 168 | struct rcu_head rcu_head; |
169 | u32 n_reg_rules; | 169 | u32 n_reg_rules; |
170 | char alpha2[2]; | 170 | char alpha2[3]; |
171 | enum nl80211_dfs_regions dfs_region; | 171 | enum nl80211_dfs_regions dfs_region; |
172 | struct ieee80211_reg_rule reg_rules[]; | 172 | struct ieee80211_reg_rule reg_rules[]; |
173 | }; | 173 | }; |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index a3cfb8ebeb53..620e086c0cbe 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -231,7 +231,8 @@ struct qdisc_skb_cb { | |||
231 | unsigned int pkt_len; | 231 | unsigned int pkt_len; |
232 | u16 slave_dev_queue_mapping; | 232 | u16 slave_dev_queue_mapping; |
233 | u16 _pad; | 233 | u16 _pad; |
234 | unsigned char data[24]; | 234 | #define QDISC_CB_PRIV_LEN 20 |
235 | unsigned char data[QDISC_CB_PRIV_LEN]; | ||
235 | }; | 236 | }; |
236 | 237 | ||
237 | static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) | 238 | static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index f6e7397e799d..9fbd856e6713 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -320,6 +320,19 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | |||
320 | return asoc ? asoc->assoc_id : 0; | 320 | return asoc ? asoc->assoc_id : 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | static inline enum sctp_sstat_state | ||
324 | sctp_assoc_to_state(const struct sctp_association *asoc) | ||
325 | { | ||
326 | /* SCTP's uapi always had SCTP_EMPTY(=0) as a dummy state, but we | ||
327 | * got rid of it in kernel space. Therefore SCTP_CLOSED et al | ||
328 | * start at =1 in user space, but actually as =0 in kernel space. | ||
329 | * Now that we can not break user space and SCTP_EMPTY is exposed | ||
330 | * there, we need to fix it up with an ugly offset not to break | ||
331 | * applications. :( | ||
332 | */ | ||
333 | return asoc->state + 1; | ||
334 | } | ||
335 | |||
323 | /* Look up the association by its id. */ | 336 | /* Look up the association by its id. */ |
324 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); | 337 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); |
325 | 338 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 7f2ab72f321a..b9a5bd0ed9f3 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -2165,9 +2165,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
2165 | */ | 2165 | */ |
2166 | if (sock_flag(sk, SOCK_RCVTSTAMP) || | 2166 | if (sock_flag(sk, SOCK_RCVTSTAMP) || |
2167 | (sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) || | 2167 | (sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) || |
2168 | (kt.tv64 && | 2168 | (kt.tv64 && sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) || |
2169 | (sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE || | ||
2170 | skb_shinfo(skb)->tx_flags & SKBTX_ANY_SW_TSTAMP)) || | ||
2171 | (hwtstamps->hwtstamp.tv64 && | 2169 | (hwtstamps->hwtstamp.tv64 && |
2172 | (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE))) | 2170 | (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE))) |
2173 | __sock_recv_timestamp(msg, sk, skb); | 2171 | __sock_recv_timestamp(msg, sk, skb); |
diff --git a/include/net/wimax.h b/include/net/wimax.h index e52ef5357e08..c52b68577cb0 100644 --- a/include/net/wimax.h +++ b/include/net/wimax.h | |||
@@ -290,7 +290,7 @@ struct wimax_dev; | |||
290 | * This operation has to be synchronous, and return only when the | 290 | * This operation has to be synchronous, and return only when the |
291 | * reset is complete. In case of having had to resort to bus/cold | 291 | * reset is complete. In case of having had to resort to bus/cold |
292 | * reset implying a device disconnection, the call is allowed to | 292 | * reset implying a device disconnection, the call is allowed to |
293 | * return inmediately. | 293 | * return immediately. |
294 | * NOTE: wimax_dev->mutex is NOT locked when this op is being | 294 | * NOTE: wimax_dev->mutex is NOT locked when this op is being |
295 | * called; however, wimax_dev->mutex_reset IS locked to ensure | 295 | * called; however, wimax_dev->mutex_reset IS locked to ensure |
296 | * serialization of calls to wimax_reset(). | 296 | * serialization of calls to wimax_reset(). |
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h index 1ea0b65c4cfb..a2bf41e0bde9 100644 --- a/include/rdma/ib_umem.h +++ b/include/rdma/ib_umem.h | |||
@@ -47,6 +47,7 @@ struct ib_umem { | |||
47 | int writable; | 47 | int writable; |
48 | int hugetlb; | 48 | int hugetlb; |
49 | struct work_struct work; | 49 | struct work_struct work; |
50 | struct pid *pid; | ||
50 | struct mm_struct *mm; | 51 | struct mm_struct *mm; |
51 | unsigned long diff; | 52 | unsigned long diff; |
52 | struct sg_table sg_head; | 53 | struct sg_table sg_head; |
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index cdcc90b07ecb..e64583560701 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -68,7 +68,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) | |||
68 | return; | 68 | return; |
69 | 69 | ||
70 | if (!shost_use_blk_mq(sdev->host) && | 70 | if (!shost_use_blk_mq(sdev->host) && |
71 | blk_queue_tagged(sdev->request_queue)) | 71 | !blk_queue_tagged(sdev->request_queue)) |
72 | blk_queue_init_tags(sdev->request_queue, depth, | 72 | blk_queue_init_tags(sdev->request_queue, depth, |
73 | sdev->host->bqt); | 73 | sdev->host->bqt); |
74 | 74 | ||
diff --git a/include/sound/soc.h b/include/sound/soc.h index be6ecae247b0..c83a334dd00f 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -277,7 +277,7 @@ | |||
277 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ | 277 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ |
278 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | 278 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
279 | .tlv.c = (snd_soc_bytes_tlv_callback), \ | 279 | .tlv.c = (snd_soc_bytes_tlv_callback), \ |
280 | .info = snd_soc_info_bytes_ext, \ | 280 | .info = snd_soc_bytes_info_ext, \ |
281 | .private_value = (unsigned long)&(struct soc_bytes_ext) \ | 281 | .private_value = (unsigned long)&(struct soc_bytes_ext) \ |
282 | {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } | 282 | {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } |
283 | #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ | 283 | #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ |
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h index 1c09820df585..3608bebd3d9c 100644 --- a/include/trace/events/irq.h +++ b/include/trace/events/irq.h | |||
@@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(softirq, | |||
107 | * @vec_nr: softirq vector number | 107 | * @vec_nr: softirq vector number |
108 | * | 108 | * |
109 | * When used in combination with the softirq_exit tracepoint | 109 | * When used in combination with the softirq_exit tracepoint |
110 | * we can determine the softirq handler runtine. | 110 | * we can determine the softirq handler routine. |
111 | */ | 111 | */ |
112 | DEFINE_EVENT(softirq, softirq_entry, | 112 | DEFINE_EVENT(softirq, softirq_entry, |
113 | 113 | ||
@@ -121,7 +121,7 @@ DEFINE_EVENT(softirq, softirq_entry, | |||
121 | * @vec_nr: softirq vector number | 121 | * @vec_nr: softirq vector number |
122 | * | 122 | * |
123 | * When used in combination with the softirq_entry tracepoint | 123 | * When used in combination with the softirq_entry tracepoint |
124 | * we can determine the softirq handler runtine. | 124 | * we can determine the softirq handler routine. |
125 | */ | 125 | */ |
126 | DEFINE_EVENT(softirq, softirq_exit, | 126 | DEFINE_EVENT(softirq, softirq_exit, |
127 | 127 | ||
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index f1afd607f043..11d11bc5c78f 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h | |||
@@ -703,9 +703,11 @@ __SYSCALL(__NR_renameat2, sys_renameat2) | |||
703 | __SYSCALL(__NR_seccomp, sys_seccomp) | 703 | __SYSCALL(__NR_seccomp, sys_seccomp) |
704 | #define __NR_getrandom 278 | 704 | #define __NR_getrandom 278 |
705 | __SYSCALL(__NR_getrandom, sys_getrandom) | 705 | __SYSCALL(__NR_getrandom, sys_getrandom) |
706 | #define __NR_memfd_create 279 | ||
707 | __SYSCALL(__NR_memfd_create, sys_memfd_create) | ||
706 | 708 | ||
707 | #undef __NR_syscalls | 709 | #undef __NR_syscalls |
708 | #define __NR_syscalls 279 | 710 | #define __NR_syscalls 280 |
709 | 711 | ||
710 | /* | 712 | /* |
711 | * All syscalls below here should go away really, | 713 | * All syscalls below here should go away really, |
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h index 509b2d7a41b7..fea6099608ef 100644 --- a/include/uapi/drm/radeon_drm.h +++ b/include/uapi/drm/radeon_drm.h | |||
@@ -944,6 +944,7 @@ struct drm_radeon_cs_chunk { | |||
944 | }; | 944 | }; |
945 | 945 | ||
946 | /* drm_radeon_cs_reloc.flags */ | 946 | /* drm_radeon_cs_reloc.flags */ |
947 | #define RADEON_RELOC_PRIO_MASK (0xf << 0) | ||
947 | 948 | ||
948 | struct drm_radeon_cs_reloc { | 949 | struct drm_radeon_cs_reloc { |
949 | uint32_t handle; | 950 | uint32_t handle; |
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 24e9033f8b3f..be88166349a1 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
@@ -240,6 +240,7 @@ header-y += matroxfb.h | |||
240 | header-y += mdio.h | 240 | header-y += mdio.h |
241 | header-y += media.h | 241 | header-y += media.h |
242 | header-y += mei.h | 242 | header-y += mei.h |
243 | header-y += memfd.h | ||
243 | header-y += mempolicy.h | 244 | header-y += mempolicy.h |
244 | header-y += meye.h | 245 | header-y += meye.h |
245 | header-y += mic_common.h | 246 | header-y += mic_common.h |
@@ -395,6 +396,7 @@ header-y += un.h | |||
395 | header-y += unistd.h | 396 | header-y += unistd.h |
396 | header-y += unix_diag.h | 397 | header-y += unix_diag.h |
397 | header-y += usbdevice_fs.h | 398 | header-y += usbdevice_fs.h |
399 | header-y += usbip.h | ||
398 | header-y += utime.h | 400 | header-y += utime.h |
399 | header-y += utsname.h | 401 | header-y += utsname.h |
400 | header-y += uuid.h | 402 | header-y += uuid.h |
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 19df18c9b8be..1874ebe9ac1e 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h | |||
@@ -165,6 +165,7 @@ struct input_keymap_entry { | |||
165 | #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ | 165 | #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ |
166 | #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ | 166 | #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ |
167 | #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ | 167 | #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ |
168 | #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ | ||
168 | 169 | ||
169 | #define INPUT_PROP_MAX 0x1f | 170 | #define INPUT_PROP_MAX 0x1f |
170 | #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) | 171 | #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) |
diff --git a/drivers/staging/usbip/uapi/usbip.h b/include/uapi/linux/usbip.h index fa5db30ede36..fa5db30ede36 100644 --- a/drivers/staging/usbip/uapi/usbip.h +++ b/include/uapi/linux/usbip.h | |||
diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h index c38355c1f3c9..1590c49cae57 100644 --- a/include/uapi/linux/xattr.h +++ b/include/uapi/linux/xattr.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #ifndef _UAPI_LINUX_XATTR_H | 13 | #ifndef _UAPI_LINUX_XATTR_H |
14 | #define _UAPI_LINUX_XATTR_H | 14 | #define _UAPI_LINUX_XATTR_H |
15 | 15 | ||
16 | #ifdef __UAPI_DEF_XATTR | 16 | #if __UAPI_DEF_XATTR |
17 | #define __USE_KERNEL_XATTR_DEFS | 17 | #define __USE_KERNEL_XATTR_DEFS |
18 | 18 | ||
19 | #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ | 19 | #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ |
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h index 131a6ccdba25..14334d0161d5 100644 --- a/include/xen/interface/features.h +++ b/include/xen/interface/features.h | |||
@@ -53,6 +53,9 @@ | |||
53 | /* operation as Dom0 is supported */ | 53 | /* operation as Dom0 is supported */ |
54 | #define XENFEAT_dom0 11 | 54 | #define XENFEAT_dom0 11 |
55 | 55 | ||
56 | /* Xen also maps grant references at pfn = mfn */ | ||
57 | #define XENFEAT_grant_map_identity 12 | ||
58 | |||
56 | #define XENFEAT_NR_SUBMAPS 1 | 59 | #define XENFEAT_NR_SUBMAPS 1 |
57 | 60 | ||
58 | #endif /* __XEN_PUBLIC_FEATURES_H__ */ | 61 | #endif /* __XEN_PUBLIC_FEATURES_H__ */ |
diff --git a/init/do_mounts.c b/init/do_mounts.c index b6237c31b0e2..82f22885c87e 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -539,6 +539,12 @@ void __init prepare_namespace(void) | |||
539 | { | 539 | { |
540 | int is_floppy; | 540 | int is_floppy; |
541 | 541 | ||
542 | if (root_delay) { | ||
543 | printk(KERN_INFO "Waiting %d sec before mounting root device...\n", | ||
544 | root_delay); | ||
545 | ssleep(root_delay); | ||
546 | } | ||
547 | |||
542 | /* | 548 | /* |
543 | * wait for the known devices to complete their probing | 549 | * wait for the known devices to complete their probing |
544 | * | 550 | * |
@@ -565,12 +571,6 @@ void __init prepare_namespace(void) | |||
565 | if (initrd_load()) | 571 | if (initrd_load()) |
566 | goto out; | 572 | goto out; |
567 | 573 | ||
568 | if (root_delay) { | ||
569 | pr_info("Waiting %d sec before mounting root device...\n", | ||
570 | root_delay); | ||
571 | ssleep(root_delay); | ||
572 | } | ||
573 | |||
574 | /* wait for any asynchronous scanning to complete */ | 574 | /* wait for any asynchronous scanning to complete */ |
575 | if ((ROOT_DEV == 0) && root_wait) { | 575 | if ((ROOT_DEV == 0) && root_wait) { |
576 | printk(KERN_INFO "Waiting for root device %s...\n", | 576 | printk(KERN_INFO "Waiting for root device %s...\n", |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 7dc8788cfd52..3a73f995a81e 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1035,6 +1035,11 @@ static void cgroup_get(struct cgroup *cgrp) | |||
1035 | css_get(&cgrp->self); | 1035 | css_get(&cgrp->self); |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | static bool cgroup_tryget(struct cgroup *cgrp) | ||
1039 | { | ||
1040 | return css_tryget(&cgrp->self); | ||
1041 | } | ||
1042 | |||
1038 | static void cgroup_put(struct cgroup *cgrp) | 1043 | static void cgroup_put(struct cgroup *cgrp) |
1039 | { | 1044 | { |
1040 | css_put(&cgrp->self); | 1045 | css_put(&cgrp->self); |
@@ -1147,7 +1152,8 @@ static struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn) | |||
1147 | * protection against removal. Ensure @cgrp stays accessible and | 1152 | * protection against removal. Ensure @cgrp stays accessible and |
1148 | * break the active_ref protection. | 1153 | * break the active_ref protection. |
1149 | */ | 1154 | */ |
1150 | cgroup_get(cgrp); | 1155 | if (!cgroup_tryget(cgrp)) |
1156 | return NULL; | ||
1151 | kernfs_break_active_protection(kn); | 1157 | kernfs_break_active_protection(kn); |
1152 | 1158 | ||
1153 | mutex_lock(&cgroup_mutex); | 1159 | mutex_lock(&cgroup_mutex); |
@@ -3271,8 +3277,17 @@ int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts) | |||
3271 | { | 3277 | { |
3272 | struct cftype *cft; | 3278 | struct cftype *cft; |
3273 | 3279 | ||
3274 | for (cft = cfts; cft && cft->name[0] != '\0'; cft++) | 3280 | /* |
3275 | cft->flags |= __CFTYPE_NOT_ON_DFL; | 3281 | * If legacy_flies_on_dfl, we want to show the legacy files on the |
3282 | * dfl hierarchy but iff the target subsystem hasn't been updated | ||
3283 | * for the dfl hierarchy yet. | ||
3284 | */ | ||
3285 | if (!cgroup_legacy_files_on_dfl || | ||
3286 | ss->dfl_cftypes != ss->legacy_cftypes) { | ||
3287 | for (cft = cfts; cft && cft->name[0] != '\0'; cft++) | ||
3288 | cft->flags |= __CFTYPE_NOT_ON_DFL; | ||
3289 | } | ||
3290 | |||
3276 | return cgroup_add_cftypes(ss, cfts); | 3291 | return cgroup_add_cftypes(ss, cfts); |
3277 | } | 3292 | } |
3278 | 3293 | ||
@@ -3970,7 +3985,6 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, | |||
3970 | 3985 | ||
3971 | l = cgroup_pidlist_find_create(cgrp, type); | 3986 | l = cgroup_pidlist_find_create(cgrp, type); |
3972 | if (!l) { | 3987 | if (!l) { |
3973 | mutex_unlock(&cgrp->pidlist_mutex); | ||
3974 | pidlist_free(array); | 3988 | pidlist_free(array); |
3975 | return -ENOMEM; | 3989 | return -ENOMEM; |
3976 | } | 3990 | } |
@@ -4387,6 +4401,15 @@ static void css_release_work_fn(struct work_struct *work) | |||
4387 | /* cgroup release path */ | 4401 | /* cgroup release path */ |
4388 | cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id); | 4402 | cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id); |
4389 | cgrp->id = -1; | 4403 | cgrp->id = -1; |
4404 | |||
4405 | /* | ||
4406 | * There are two control paths which try to determine | ||
4407 | * cgroup from dentry without going through kernfs - | ||
4408 | * cgroupstats_build() and css_tryget_online_from_dir(). | ||
4409 | * Those are supported by RCU protecting clearing of | ||
4410 | * cgrp->kn->priv backpointer. | ||
4411 | */ | ||
4412 | RCU_INIT_POINTER(*(void __rcu __force **)&cgrp->kn->priv, NULL); | ||
4390 | } | 4413 | } |
4391 | 4414 | ||
4392 | mutex_unlock(&cgroup_mutex); | 4415 | mutex_unlock(&cgroup_mutex); |
@@ -4543,6 +4566,11 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, | |||
4543 | struct cftype *base_files; | 4566 | struct cftype *base_files; |
4544 | int ssid, ret; | 4567 | int ssid, ret; |
4545 | 4568 | ||
4569 | /* Do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable. | ||
4570 | */ | ||
4571 | if (strchr(name, '\n')) | ||
4572 | return -EINVAL; | ||
4573 | |||
4546 | parent = cgroup_kn_lock_live(parent_kn); | 4574 | parent = cgroup_kn_lock_live(parent_kn); |
4547 | if (!parent) | 4575 | if (!parent) |
4548 | return -ENODEV; | 4576 | return -ENODEV; |
@@ -4820,16 +4848,6 @@ static int cgroup_rmdir(struct kernfs_node *kn) | |||
4820 | 4848 | ||
4821 | cgroup_kn_unlock(kn); | 4849 | cgroup_kn_unlock(kn); |
4822 | 4850 | ||
4823 | /* | ||
4824 | * There are two control paths which try to determine cgroup from | ||
4825 | * dentry without going through kernfs - cgroupstats_build() and | ||
4826 | * css_tryget_online_from_dir(). Those are supported by RCU | ||
4827 | * protecting clearing of cgrp->kn->priv backpointer, which should | ||
4828 | * happen after all files under it have been removed. | ||
4829 | */ | ||
4830 | if (!ret) | ||
4831 | RCU_INIT_POINTER(*(void __rcu __force **)&kn->priv, NULL); | ||
4832 | |||
4833 | cgroup_put(cgrp); | 4851 | cgroup_put(cgrp); |
4834 | return ret; | 4852 | return ret; |
4835 | } | 4853 | } |
@@ -5416,7 +5434,7 @@ struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry, | |||
5416 | /* | 5434 | /* |
5417 | * This path doesn't originate from kernfs and @kn could already | 5435 | * This path doesn't originate from kernfs and @kn could already |
5418 | * have been or be removed at any point. @kn->priv is RCU | 5436 | * have been or be removed at any point. @kn->priv is RCU |
5419 | * protected for this access. See cgroup_rmdir() for details. | 5437 | * protected for this access. See css_release_work_fn() for details. |
5420 | */ | 5438 | */ |
5421 | cgrp = rcu_dereference(kn->priv); | 5439 | cgrp = rcu_dereference(kn->priv); |
5422 | if (cgrp) | 5440 | if (cgrp) |
diff --git a/kernel/compat.c b/kernel/compat.c index 633394f442f8..ebb3c369d03d 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -226,7 +226,7 @@ static long compat_nanosleep_restart(struct restart_block *restart) | |||
226 | ret = hrtimer_nanosleep_restart(restart); | 226 | ret = hrtimer_nanosleep_restart(restart); |
227 | set_fs(oldfs); | 227 | set_fs(oldfs); |
228 | 228 | ||
229 | if (ret) { | 229 | if (ret == -ERESTART_RESTARTBLOCK) { |
230 | rmtp = restart->nanosleep.compat_rmtp; | 230 | rmtp = restart->nanosleep.compat_rmtp; |
231 | 231 | ||
232 | if (rmtp && compat_put_timespec(&rmt, rmtp)) | 232 | if (rmtp && compat_put_timespec(&rmt, rmtp)) |
@@ -256,7 +256,26 @@ COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp, | |||
256 | HRTIMER_MODE_REL, CLOCK_MONOTONIC); | 256 | HRTIMER_MODE_REL, CLOCK_MONOTONIC); |
257 | set_fs(oldfs); | 257 | set_fs(oldfs); |
258 | 258 | ||
259 | if (ret) { | 259 | /* |
260 | * hrtimer_nanosleep() can only return 0 or | ||
261 | * -ERESTART_RESTARTBLOCK here because: | ||
262 | * | ||
263 | * - we call it with HRTIMER_MODE_REL and therefor exclude the | ||
264 | * -ERESTARTNOHAND return path. | ||
265 | * | ||
266 | * - we supply the rmtp argument from the task stack (due to | ||
267 | * the necessary compat conversion. So the update cannot | ||
268 | * fail, which excludes the -EFAULT return path as well. If | ||
269 | * it fails nevertheless we have a bigger problem and wont | ||
270 | * reach this place anymore. | ||
271 | * | ||
272 | * - if the return value is 0, we do not have to update rmtp | ||
273 | * because there is no remaining time. | ||
274 | * | ||
275 | * We check for -ERESTART_RESTARTBLOCK nevertheless if the | ||
276 | * core implementation decides to return random nonsense. | ||
277 | */ | ||
278 | if (ret == -ERESTART_RESTARTBLOCK) { | ||
260 | struct restart_block *restart | 279 | struct restart_block *restart |
261 | = ¤t_thread_info()->restart_block; | 280 | = ¤t_thread_info()->restart_block; |
262 | 281 | ||
@@ -266,7 +285,6 @@ COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp, | |||
266 | if (rmtp && compat_put_timespec(&rmt, rmtp)) | 285 | if (rmtp && compat_put_timespec(&rmt, rmtp)) |
267 | return -EFAULT; | 286 | return -EFAULT; |
268 | } | 287 | } |
269 | |||
270 | return ret; | 288 | return ret; |
271 | } | 289 | } |
272 | 290 | ||
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 22874d7cf2c0..52cb04c993b7 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -365,13 +365,14 @@ static void cpuset_update_task_spread_flag(struct cpuset *cs, | |||
365 | struct task_struct *tsk) | 365 | struct task_struct *tsk) |
366 | { | 366 | { |
367 | if (is_spread_page(cs)) | 367 | if (is_spread_page(cs)) |
368 | tsk->flags |= PF_SPREAD_PAGE; | 368 | task_set_spread_page(tsk); |
369 | else | 369 | else |
370 | tsk->flags &= ~PF_SPREAD_PAGE; | 370 | task_clear_spread_page(tsk); |
371 | |||
371 | if (is_spread_slab(cs)) | 372 | if (is_spread_slab(cs)) |
372 | tsk->flags |= PF_SPREAD_SLAB; | 373 | task_set_spread_slab(tsk); |
373 | else | 374 | else |
374 | tsk->flags &= ~PF_SPREAD_SLAB; | 375 | task_clear_spread_slab(tsk); |
375 | } | 376 | } |
376 | 377 | ||
377 | /* | 378 | /* |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 1cf24b3e42ec..d640a8b4dcbc 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/cgroup.h> | 41 | #include <linux/cgroup.h> |
42 | #include <linux/module.h> | 42 | #include <linux/module.h> |
43 | #include <linux/mman.h> | 43 | #include <linux/mman.h> |
44 | #include <linux/compat.h> | ||
44 | 45 | ||
45 | #include "internal.h" | 46 | #include "internal.h" |
46 | 47 | ||
@@ -1523,6 +1524,11 @@ retry: | |||
1523 | */ | 1524 | */ |
1524 | if (ctx->is_active) { | 1525 | if (ctx->is_active) { |
1525 | raw_spin_unlock_irq(&ctx->lock); | 1526 | raw_spin_unlock_irq(&ctx->lock); |
1527 | /* | ||
1528 | * Reload the task pointer, it might have been changed by | ||
1529 | * a concurrent perf_event_context_sched_out(). | ||
1530 | */ | ||
1531 | task = ctx->task; | ||
1526 | goto retry; | 1532 | goto retry; |
1527 | } | 1533 | } |
1528 | 1534 | ||
@@ -1966,6 +1972,11 @@ retry: | |||
1966 | */ | 1972 | */ |
1967 | if (ctx->is_active) { | 1973 | if (ctx->is_active) { |
1968 | raw_spin_unlock_irq(&ctx->lock); | 1974 | raw_spin_unlock_irq(&ctx->lock); |
1975 | /* | ||
1976 | * Reload the task pointer, it might have been changed by | ||
1977 | * a concurrent perf_event_context_sched_out(). | ||
1978 | */ | ||
1979 | task = ctx->task; | ||
1969 | goto retry; | 1980 | goto retry; |
1970 | } | 1981 | } |
1971 | 1982 | ||
@@ -3717,6 +3728,26 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
3717 | return 0; | 3728 | return 0; |
3718 | } | 3729 | } |
3719 | 3730 | ||
3731 | #ifdef CONFIG_COMPAT | ||
3732 | static long perf_compat_ioctl(struct file *file, unsigned int cmd, | ||
3733 | unsigned long arg) | ||
3734 | { | ||
3735 | switch (_IOC_NR(cmd)) { | ||
3736 | case _IOC_NR(PERF_EVENT_IOC_SET_FILTER): | ||
3737 | case _IOC_NR(PERF_EVENT_IOC_ID): | ||
3738 | /* Fix up pointer size (usually 4 -> 8 in 32-on-64-bit case */ | ||
3739 | if (_IOC_SIZE(cmd) == sizeof(compat_uptr_t)) { | ||
3740 | cmd &= ~IOCSIZE_MASK; | ||
3741 | cmd |= sizeof(void *) << IOCSIZE_SHIFT; | ||
3742 | } | ||
3743 | break; | ||
3744 | } | ||
3745 | return perf_ioctl(file, cmd, arg); | ||
3746 | } | ||
3747 | #else | ||
3748 | # define perf_compat_ioctl NULL | ||
3749 | #endif | ||
3750 | |||
3720 | int perf_event_task_enable(void) | 3751 | int perf_event_task_enable(void) |
3721 | { | 3752 | { |
3722 | struct perf_event *event; | 3753 | struct perf_event *event; |
@@ -4222,7 +4253,7 @@ static const struct file_operations perf_fops = { | |||
4222 | .read = perf_read, | 4253 | .read = perf_read, |
4223 | .poll = perf_poll, | 4254 | .poll = perf_poll, |
4224 | .unlocked_ioctl = perf_ioctl, | 4255 | .unlocked_ioctl = perf_ioctl, |
4225 | .compat_ioctl = perf_ioctl, | 4256 | .compat_ioctl = perf_compat_ioctl, |
4226 | .mmap = perf_mmap, | 4257 | .mmap = perf_mmap, |
4227 | .fasync = perf_fasync, | 4258 | .fasync = perf_fasync, |
4228 | }; | 4259 | }; |
diff --git a/kernel/futex.c b/kernel/futex.c index d3a9d946d0b7..815d7af2ffe8 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -2592,6 +2592,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, | |||
2592 | * shared futexes. We need to compare the keys: | 2592 | * shared futexes. We need to compare the keys: |
2593 | */ | 2593 | */ |
2594 | if (match_futex(&q.key, &key2)) { | 2594 | if (match_futex(&q.key, &key2)) { |
2595 | queue_unlock(hb); | ||
2595 | ret = -EINVAL; | 2596 | ret = -EINVAL; |
2596 | goto out_put_keys; | 2597 | goto out_put_keys; |
2597 | } | 2598 | } |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index a2b28a2fd7b1..6223fab9a9d2 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -517,6 +517,7 @@ out: | |||
517 | chip->irq_eoi(&desc->irq_data); | 517 | chip->irq_eoi(&desc->irq_data); |
518 | raw_spin_unlock(&desc->lock); | 518 | raw_spin_unlock(&desc->lock); |
519 | } | 519 | } |
520 | EXPORT_SYMBOL_GPL(handle_fasteoi_irq); | ||
520 | 521 | ||
521 | /** | 522 | /** |
522 | * handle_edge_irq - edge type IRQ handler | 523 | * handle_edge_irq - edge type IRQ handler |
diff --git a/kernel/kcmp.c b/kernel/kcmp.c index e30ac0fe61c3..0aa69ea1d8fd 100644 --- a/kernel/kcmp.c +++ b/kernel/kcmp.c | |||
@@ -44,11 +44,12 @@ static long kptr_obfuscate(long v, int type) | |||
44 | */ | 44 | */ |
45 | static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type) | 45 | static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type) |
46 | { | 46 | { |
47 | long ret; | 47 | long t1, t2; |
48 | 48 | ||
49 | ret = kptr_obfuscate((long)v1, type) - kptr_obfuscate((long)v2, type); | 49 | t1 = kptr_obfuscate((long)v1, type); |
50 | t2 = kptr_obfuscate((long)v2, type); | ||
50 | 51 | ||
51 | return (ret < 0) | ((ret > 0) << 1); | 52 | return (t1 < t2) | ((t1 > t2) << 1); |
52 | } | 53 | } |
53 | 54 | ||
54 | /* The caller must have pinned the task */ | 55 | /* The caller must have pinned the task */ |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 0b49a0a58102..2bee072268d9 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -64,7 +64,9 @@ bool kexec_in_progress = false; | |||
64 | char __weak kexec_purgatory[0]; | 64 | char __weak kexec_purgatory[0]; |
65 | size_t __weak kexec_purgatory_size = 0; | 65 | size_t __weak kexec_purgatory_size = 0; |
66 | 66 | ||
67 | #ifdef CONFIG_KEXEC_FILE | ||
67 | static int kexec_calculate_store_digests(struct kimage *image); | 68 | static int kexec_calculate_store_digests(struct kimage *image); |
69 | #endif | ||
68 | 70 | ||
69 | /* Location of the reserved area for the crash kernel */ | 71 | /* Location of the reserved area for the crash kernel */ |
70 | struct resource crashk_res = { | 72 | struct resource crashk_res = { |
@@ -341,6 +343,7 @@ out_free_image: | |||
341 | return ret; | 343 | return ret; |
342 | } | 344 | } |
343 | 345 | ||
346 | #ifdef CONFIG_KEXEC_FILE | ||
344 | static int copy_file_from_fd(int fd, void **buf, unsigned long *buf_len) | 347 | static int copy_file_from_fd(int fd, void **buf, unsigned long *buf_len) |
345 | { | 348 | { |
346 | struct fd f = fdget(fd); | 349 | struct fd f = fdget(fd); |
@@ -612,6 +615,9 @@ out_free_image: | |||
612 | kfree(image); | 615 | kfree(image); |
613 | return ret; | 616 | return ret; |
614 | } | 617 | } |
618 | #else /* CONFIG_KEXEC_FILE */ | ||
619 | static inline void kimage_file_post_load_cleanup(struct kimage *image) { } | ||
620 | #endif /* CONFIG_KEXEC_FILE */ | ||
615 | 621 | ||
616 | static int kimage_is_destination_range(struct kimage *image, | 622 | static int kimage_is_destination_range(struct kimage *image, |
617 | unsigned long start, | 623 | unsigned long start, |
@@ -1375,6 +1381,7 @@ COMPAT_SYSCALL_DEFINE4(kexec_load, compat_ulong_t, entry, | |||
1375 | } | 1381 | } |
1376 | #endif | 1382 | #endif |
1377 | 1383 | ||
1384 | #ifdef CONFIG_KEXEC_FILE | ||
1378 | SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd, | 1385 | SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd, |
1379 | unsigned long, cmdline_len, const char __user *, cmdline_ptr, | 1386 | unsigned long, cmdline_len, const char __user *, cmdline_ptr, |
1380 | unsigned long, flags) | 1387 | unsigned long, flags) |
@@ -1451,6 +1458,8 @@ out: | |||
1451 | return ret; | 1458 | return ret; |
1452 | } | 1459 | } |
1453 | 1460 | ||
1461 | #endif /* CONFIG_KEXEC_FILE */ | ||
1462 | |||
1454 | void crash_kexec(struct pt_regs *regs) | 1463 | void crash_kexec(struct pt_regs *regs) |
1455 | { | 1464 | { |
1456 | /* Take the kexec_mutex here to prevent sys_kexec_load | 1465 | /* Take the kexec_mutex here to prevent sys_kexec_load |
@@ -2006,6 +2015,7 @@ static int __init crash_save_vmcoreinfo_init(void) | |||
2006 | 2015 | ||
2007 | subsys_initcall(crash_save_vmcoreinfo_init); | 2016 | subsys_initcall(crash_save_vmcoreinfo_init); |
2008 | 2017 | ||
2018 | #ifdef CONFIG_KEXEC_FILE | ||
2009 | static int __kexec_add_segment(struct kimage *image, char *buf, | 2019 | static int __kexec_add_segment(struct kimage *image, char *buf, |
2010 | unsigned long bufsz, unsigned long mem, | 2020 | unsigned long bufsz, unsigned long mem, |
2011 | unsigned long memsz) | 2021 | unsigned long memsz) |
@@ -2682,6 +2692,7 @@ int kexec_purgatory_get_set_symbol(struct kimage *image, const char *name, | |||
2682 | 2692 | ||
2683 | return 0; | 2693 | return 0; |
2684 | } | 2694 | } |
2695 | #endif /* CONFIG_KEXEC_FILE */ | ||
2685 | 2696 | ||
2686 | /* | 2697 | /* |
2687 | * Move into place and start executing a preloaded standalone | 2698 | * Move into place and start executing a preloaded standalone |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 734e9a7d280b..3995f546d0f3 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -1778,7 +1778,18 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs) | |||
1778 | unsigned long hash, flags = 0; | 1778 | unsigned long hash, flags = 0; |
1779 | struct kretprobe_instance *ri; | 1779 | struct kretprobe_instance *ri; |
1780 | 1780 | ||
1781 | /*TODO: consider to only swap the RA after the last pre_handler fired */ | 1781 | /* |
1782 | * To avoid deadlocks, prohibit return probing in NMI contexts, | ||
1783 | * just skip the probe and increase the (inexact) 'nmissed' | ||
1784 | * statistical counter, so that the user is informed that | ||
1785 | * something happened: | ||
1786 | */ | ||
1787 | if (unlikely(in_nmi())) { | ||
1788 | rp->nmissed++; | ||
1789 | return 0; | ||
1790 | } | ||
1791 | |||
1792 | /* TODO: consider to only swap the RA after the last pre_handler fired */ | ||
1782 | hash = hash_ptr(current, KPROBE_HASH_BITS); | 1793 | hash = hash_ptr(current, KPROBE_HASH_BITS); |
1783 | raw_spin_lock_irqsave(&rp->lock, flags); | 1794 | raw_spin_lock_irqsave(&rp->lock, flags); |
1784 | if (!hlist_empty(&rp->free_instances)) { | 1795 | if (!hlist_empty(&rp->free_instances)) { |
diff --git a/kernel/power/power.h b/kernel/power/power.h index 5d49dcac2537..2df883a9d3cb 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
@@ -179,6 +179,7 @@ extern void swsusp_show_speed(struct timeval *, struct timeval *, | |||
179 | 179 | ||
180 | #ifdef CONFIG_SUSPEND | 180 | #ifdef CONFIG_SUSPEND |
181 | /* kernel/power/suspend.c */ | 181 | /* kernel/power/suspend.c */ |
182 | extern const char *pm_labels[]; | ||
182 | extern const char *pm_states[]; | 183 | extern const char *pm_states[]; |
183 | 184 | ||
184 | extern int suspend_devices_and_enter(suspend_state_t state); | 185 | extern int suspend_devices_and_enter(suspend_state_t state); |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index c4b8093c80b3..f1604d8cf489 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -725,14 +725,6 @@ static void memory_bm_clear_bit(struct memory_bitmap *bm, unsigned long pfn) | |||
725 | clear_bit(bit, addr); | 725 | clear_bit(bit, addr); |
726 | } | 726 | } |
727 | 727 | ||
728 | static void memory_bm_clear_current(struct memory_bitmap *bm) | ||
729 | { | ||
730 | int bit; | ||
731 | |||
732 | bit = max(bm->cur.node_bit - 1, 0); | ||
733 | clear_bit(bit, bm->cur.node->data); | ||
734 | } | ||
735 | |||
736 | static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) | 728 | static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) |
737 | { | 729 | { |
738 | void *addr; | 730 | void *addr; |
@@ -1341,35 +1333,23 @@ static struct memory_bitmap copy_bm; | |||
1341 | 1333 | ||
1342 | void swsusp_free(void) | 1334 | void swsusp_free(void) |
1343 | { | 1335 | { |
1344 | unsigned long fb_pfn, fr_pfn; | 1336 | struct zone *zone; |
1345 | 1337 | unsigned long pfn, max_zone_pfn; | |
1346 | memory_bm_position_reset(forbidden_pages_map); | ||
1347 | memory_bm_position_reset(free_pages_map); | ||
1348 | |||
1349 | loop: | ||
1350 | fr_pfn = memory_bm_next_pfn(free_pages_map); | ||
1351 | fb_pfn = memory_bm_next_pfn(forbidden_pages_map); | ||
1352 | |||
1353 | /* | ||
1354 | * Find the next bit set in both bitmaps. This is guaranteed to | ||
1355 | * terminate when fb_pfn == fr_pfn == BM_END_OF_MAP. | ||
1356 | */ | ||
1357 | do { | ||
1358 | if (fb_pfn < fr_pfn) | ||
1359 | fb_pfn = memory_bm_next_pfn(forbidden_pages_map); | ||
1360 | if (fr_pfn < fb_pfn) | ||
1361 | fr_pfn = memory_bm_next_pfn(free_pages_map); | ||
1362 | } while (fb_pfn != fr_pfn); | ||
1363 | |||
1364 | if (fr_pfn != BM_END_OF_MAP && pfn_valid(fr_pfn)) { | ||
1365 | struct page *page = pfn_to_page(fr_pfn); | ||
1366 | 1338 | ||
1367 | memory_bm_clear_current(forbidden_pages_map); | 1339 | for_each_populated_zone(zone) { |
1368 | memory_bm_clear_current(free_pages_map); | 1340 | max_zone_pfn = zone_end_pfn(zone); |
1369 | __free_page(page); | 1341 | for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) |
1370 | goto loop; | 1342 | if (pfn_valid(pfn)) { |
1343 | struct page *page = pfn_to_page(pfn); | ||
1344 | |||
1345 | if (swsusp_page_is_forbidden(page) && | ||
1346 | swsusp_page_is_free(page)) { | ||
1347 | swsusp_unset_page_forbidden(page); | ||
1348 | swsusp_unset_page_free(page); | ||
1349 | __free_page(page); | ||
1350 | } | ||
1351 | } | ||
1371 | } | 1352 | } |
1372 | |||
1373 | nr_copy_pages = 0; | 1353 | nr_copy_pages = 0; |
1374 | nr_meta_pages = 0; | 1354 | nr_meta_pages = 0; |
1375 | restore_pblist = NULL; | 1355 | restore_pblist = NULL; |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 6dadb25cb0d8..18c62195660f 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #include "power.h" | 32 | #include "power.h" |
33 | 33 | ||
34 | static const char *pm_labels[] = { "mem", "standby", "freeze", }; | 34 | const char *pm_labels[] = { "mem", "standby", "freeze", NULL }; |
35 | const char *pm_states[PM_SUSPEND_MAX]; | 35 | const char *pm_states[PM_SUSPEND_MAX]; |
36 | 36 | ||
37 | static const struct platform_suspend_ops *suspend_ops; | 37 | static const struct platform_suspend_ops *suspend_ops; |
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index 2f524928b6aa..bd91bc177c93 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c | |||
@@ -129,20 +129,20 @@ static int __init has_wakealarm(struct device *dev, const void *data) | |||
129 | * at startup time. They're normally disabled, for faster boot and because | 129 | * at startup time. They're normally disabled, for faster boot and because |
130 | * we can't know which states really work on this particular system. | 130 | * we can't know which states really work on this particular system. |
131 | */ | 131 | */ |
132 | static suspend_state_t test_state __initdata = PM_SUSPEND_ON; | 132 | static const char *test_state_label __initdata; |
133 | 133 | ||
134 | static char warn_bad_state[] __initdata = | 134 | static char warn_bad_state[] __initdata = |
135 | KERN_WARNING "PM: can't test '%s' suspend state\n"; | 135 | KERN_WARNING "PM: can't test '%s' suspend state\n"; |
136 | 136 | ||
137 | static int __init setup_test_suspend(char *value) | 137 | static int __init setup_test_suspend(char *value) |
138 | { | 138 | { |
139 | suspend_state_t i; | 139 | int i; |
140 | 140 | ||
141 | /* "=mem" ==> "mem" */ | 141 | /* "=mem" ==> "mem" */ |
142 | value++; | 142 | value++; |
143 | for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) | 143 | for (i = 0; pm_labels[i]; i++) |
144 | if (!strcmp(pm_states[i], value)) { | 144 | if (!strcmp(pm_labels[i], value)) { |
145 | test_state = i; | 145 | test_state_label = pm_labels[i]; |
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
148 | 148 | ||
@@ -158,13 +158,21 @@ static int __init test_suspend(void) | |||
158 | 158 | ||
159 | struct rtc_device *rtc = NULL; | 159 | struct rtc_device *rtc = NULL; |
160 | struct device *dev; | 160 | struct device *dev; |
161 | suspend_state_t test_state; | ||
161 | 162 | ||
162 | /* PM is initialized by now; is that state testable? */ | 163 | /* PM is initialized by now; is that state testable? */ |
163 | if (test_state == PM_SUSPEND_ON) | 164 | if (!test_state_label) |
164 | goto done; | 165 | return 0; |
165 | if (!pm_states[test_state]) { | 166 | |
166 | printk(warn_bad_state, pm_states[test_state]); | 167 | for (test_state = PM_SUSPEND_MIN; test_state < PM_SUSPEND_MAX; test_state++) { |
167 | goto done; | 168 | const char *state_label = pm_states[test_state]; |
169 | |||
170 | if (state_label && !strcmp(test_state_label, state_label)) | ||
171 | break; | ||
172 | } | ||
173 | if (test_state == PM_SUSPEND_MAX) { | ||
174 | printk(warn_bad_state, test_state_label); | ||
175 | return 0; | ||
168 | } | 176 | } |
169 | 177 | ||
170 | /* RTCs have initialized by now too ... can we use one? */ | 178 | /* RTCs have initialized by now too ... can we use one? */ |
@@ -173,13 +181,12 @@ static int __init test_suspend(void) | |||
173 | rtc = rtc_class_open(dev_name(dev)); | 181 | rtc = rtc_class_open(dev_name(dev)); |
174 | if (!rtc) { | 182 | if (!rtc) { |
175 | printk(warn_no_rtc); | 183 | printk(warn_no_rtc); |
176 | goto done; | 184 | return 0; |
177 | } | 185 | } |
178 | 186 | ||
179 | /* go for it */ | 187 | /* go for it */ |
180 | test_wakealarm(rtc, test_state); | 188 | test_wakealarm(rtc, test_state); |
181 | rtc_class_close(rtc); | 189 | rtc_class_close(rtc); |
182 | done: | ||
183 | return 0; | 190 | return 0; |
184 | } | 191 | } |
185 | late_initcall(test_suspend); | 192 | late_initcall(test_suspend); |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index e04c455a0e38..1ce770687ea8 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1665,15 +1665,15 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1665 | raw_spin_lock(&logbuf_lock); | 1665 | raw_spin_lock(&logbuf_lock); |
1666 | logbuf_cpu = this_cpu; | 1666 | logbuf_cpu = this_cpu; |
1667 | 1667 | ||
1668 | if (recursion_bug) { | 1668 | if (unlikely(recursion_bug)) { |
1669 | static const char recursion_msg[] = | 1669 | static const char recursion_msg[] = |
1670 | "BUG: recent printk recursion!"; | 1670 | "BUG: recent printk recursion!"; |
1671 | 1671 | ||
1672 | recursion_bug = 0; | 1672 | recursion_bug = 0; |
1673 | text_len = strlen(recursion_msg); | ||
1674 | /* emit KERN_CRIT message */ | 1673 | /* emit KERN_CRIT message */ |
1675 | printed_len += log_store(0, 2, LOG_PREFIX|LOG_NEWLINE, 0, | 1674 | printed_len += log_store(0, 2, LOG_PREFIX|LOG_NEWLINE, 0, |
1676 | NULL, 0, recursion_msg, text_len); | 1675 | NULL, 0, recursion_msg, |
1676 | strlen(recursion_msg)); | ||
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | /* | 1679 | /* |
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index 71e64c718f75..6a86eb7bac45 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h | |||
@@ -358,7 +358,7 @@ struct rcu_data { | |||
358 | struct rcu_head **nocb_gp_tail; | 358 | struct rcu_head **nocb_gp_tail; |
359 | long nocb_gp_count; | 359 | long nocb_gp_count; |
360 | long nocb_gp_count_lazy; | 360 | long nocb_gp_count_lazy; |
361 | bool nocb_leader_wake; /* Is the nocb leader thread awake? */ | 361 | bool nocb_leader_sleep; /* Is the nocb leader thread asleep? */ |
362 | struct rcu_data *nocb_next_follower; | 362 | struct rcu_data *nocb_next_follower; |
363 | /* Next follower in wakeup chain. */ | 363 | /* Next follower in wakeup chain. */ |
364 | 364 | ||
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 00dc411e9676..a7997e272564 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -2074,9 +2074,9 @@ static void wake_nocb_leader(struct rcu_data *rdp, bool force) | |||
2074 | 2074 | ||
2075 | if (!ACCESS_ONCE(rdp_leader->nocb_kthread)) | 2075 | if (!ACCESS_ONCE(rdp_leader->nocb_kthread)) |
2076 | return; | 2076 | return; |
2077 | if (!ACCESS_ONCE(rdp_leader->nocb_leader_wake) || force) { | 2077 | if (ACCESS_ONCE(rdp_leader->nocb_leader_sleep) || force) { |
2078 | /* Prior xchg orders against prior callback enqueue. */ | 2078 | /* Prior xchg orders against prior callback enqueue. */ |
2079 | ACCESS_ONCE(rdp_leader->nocb_leader_wake) = true; | 2079 | ACCESS_ONCE(rdp_leader->nocb_leader_sleep) = false; |
2080 | wake_up(&rdp_leader->nocb_wq); | 2080 | wake_up(&rdp_leader->nocb_wq); |
2081 | } | 2081 | } |
2082 | } | 2082 | } |
@@ -2253,7 +2253,7 @@ wait_again: | |||
2253 | if (!rcu_nocb_poll) { | 2253 | if (!rcu_nocb_poll) { |
2254 | trace_rcu_nocb_wake(my_rdp->rsp->name, my_rdp->cpu, "Sleep"); | 2254 | trace_rcu_nocb_wake(my_rdp->rsp->name, my_rdp->cpu, "Sleep"); |
2255 | wait_event_interruptible(my_rdp->nocb_wq, | 2255 | wait_event_interruptible(my_rdp->nocb_wq, |
2256 | ACCESS_ONCE(my_rdp->nocb_leader_wake)); | 2256 | !ACCESS_ONCE(my_rdp->nocb_leader_sleep)); |
2257 | /* Memory barrier handled by smp_mb() calls below and repoll. */ | 2257 | /* Memory barrier handled by smp_mb() calls below and repoll. */ |
2258 | } else if (firsttime) { | 2258 | } else if (firsttime) { |
2259 | firsttime = false; /* Don't drown trace log with "Poll"! */ | 2259 | firsttime = false; /* Don't drown trace log with "Poll"! */ |
@@ -2292,12 +2292,12 @@ wait_again: | |||
2292 | schedule_timeout_interruptible(1); | 2292 | schedule_timeout_interruptible(1); |
2293 | 2293 | ||
2294 | /* Rescan in case we were a victim of memory ordering. */ | 2294 | /* Rescan in case we were a victim of memory ordering. */ |
2295 | my_rdp->nocb_leader_wake = false; | 2295 | my_rdp->nocb_leader_sleep = true; |
2296 | smp_mb(); /* Ensure _wake false before scan. */ | 2296 | smp_mb(); /* Ensure _sleep true before scan. */ |
2297 | for (rdp = my_rdp; rdp; rdp = rdp->nocb_next_follower) | 2297 | for (rdp = my_rdp; rdp; rdp = rdp->nocb_next_follower) |
2298 | if (ACCESS_ONCE(rdp->nocb_head)) { | 2298 | if (ACCESS_ONCE(rdp->nocb_head)) { |
2299 | /* Found CB, so short-circuit next wait. */ | 2299 | /* Found CB, so short-circuit next wait. */ |
2300 | my_rdp->nocb_leader_wake = true; | 2300 | my_rdp->nocb_leader_sleep = false; |
2301 | break; | 2301 | break; |
2302 | } | 2302 | } |
2303 | goto wait_again; | 2303 | goto wait_again; |
@@ -2307,17 +2307,17 @@ wait_again: | |||
2307 | rcu_nocb_wait_gp(my_rdp); | 2307 | rcu_nocb_wait_gp(my_rdp); |
2308 | 2308 | ||
2309 | /* | 2309 | /* |
2310 | * We left ->nocb_leader_wake set to reduce cache thrashing. | 2310 | * We left ->nocb_leader_sleep unset to reduce cache thrashing. |
2311 | * We clear it now, but recheck for new callbacks while | 2311 | * We set it now, but recheck for new callbacks while |
2312 | * traversing our follower list. | 2312 | * traversing our follower list. |
2313 | */ | 2313 | */ |
2314 | my_rdp->nocb_leader_wake = false; | 2314 | my_rdp->nocb_leader_sleep = true; |
2315 | smp_mb(); /* Ensure _wake false before scan of ->nocb_head. */ | 2315 | smp_mb(); /* Ensure _sleep true before scan of ->nocb_head. */ |
2316 | 2316 | ||
2317 | /* Each pass through the following loop wakes a follower, if needed. */ | 2317 | /* Each pass through the following loop wakes a follower, if needed. */ |
2318 | for (rdp = my_rdp; rdp; rdp = rdp->nocb_next_follower) { | 2318 | for (rdp = my_rdp; rdp; rdp = rdp->nocb_next_follower) { |
2319 | if (ACCESS_ONCE(rdp->nocb_head)) | 2319 | if (ACCESS_ONCE(rdp->nocb_head)) |
2320 | my_rdp->nocb_leader_wake = true; /* No need to wait. */ | 2320 | my_rdp->nocb_leader_sleep = false;/* No need to sleep.*/ |
2321 | if (!rdp->nocb_gp_head) | 2321 | if (!rdp->nocb_gp_head) |
2322 | continue; /* No CBs, so no need to wake follower. */ | 2322 | continue; /* No CBs, so no need to wake follower. */ |
2323 | 2323 | ||
diff --git a/kernel/resource.c b/kernel/resource.c index da14b8d09296..60c5a3856ab7 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -351,15 +351,12 @@ static int find_next_iomem_res(struct resource *res, char *name, | |||
351 | end = res->end; | 351 | end = res->end; |
352 | BUG_ON(start >= end); | 352 | BUG_ON(start >= end); |
353 | 353 | ||
354 | read_lock(&resource_lock); | 354 | if (first_level_children_only) |
355 | |||
356 | if (first_level_children_only) { | ||
357 | p = iomem_resource.child; | ||
358 | sibling_only = true; | 355 | sibling_only = true; |
359 | } else | ||
360 | p = &iomem_resource; | ||
361 | 356 | ||
362 | while ((p = next_resource(p, sibling_only))) { | 357 | read_lock(&resource_lock); |
358 | |||
359 | for (p = iomem_resource.child; p; p = next_resource(p, sibling_only)) { | ||
363 | if (p->flags != res->flags) | 360 | if (p->flags != res->flags) |
364 | continue; | 361 | continue; |
365 | if (name && strcmp(p->name, name)) | 362 | if (name && strcmp(p->name, name)) |
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 4aec4a457431..a7077d3ae52f 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
@@ -464,18 +464,26 @@ static enum alarmtimer_type clock2alarm(clockid_t clockid) | |||
464 | static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, | 464 | static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, |
465 | ktime_t now) | 465 | ktime_t now) |
466 | { | 466 | { |
467 | unsigned long flags; | ||
467 | struct k_itimer *ptr = container_of(alarm, struct k_itimer, | 468 | struct k_itimer *ptr = container_of(alarm, struct k_itimer, |
468 | it.alarm.alarmtimer); | 469 | it.alarm.alarmtimer); |
469 | if (posix_timer_event(ptr, 0) != 0) | 470 | enum alarmtimer_restart result = ALARMTIMER_NORESTART; |
470 | ptr->it_overrun++; | 471 | |
472 | spin_lock_irqsave(&ptr->it_lock, flags); | ||
473 | if ((ptr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) { | ||
474 | if (posix_timer_event(ptr, 0) != 0) | ||
475 | ptr->it_overrun++; | ||
476 | } | ||
471 | 477 | ||
472 | /* Re-add periodic timers */ | 478 | /* Re-add periodic timers */ |
473 | if (ptr->it.alarm.interval.tv64) { | 479 | if (ptr->it.alarm.interval.tv64) { |
474 | ptr->it_overrun += alarm_forward(alarm, now, | 480 | ptr->it_overrun += alarm_forward(alarm, now, |
475 | ptr->it.alarm.interval); | 481 | ptr->it.alarm.interval); |
476 | return ALARMTIMER_RESTART; | 482 | result = ALARMTIMER_RESTART; |
477 | } | 483 | } |
478 | return ALARMTIMER_NORESTART; | 484 | spin_unlock_irqrestore(&ptr->it_lock, flags); |
485 | |||
486 | return result; | ||
479 | } | 487 | } |
480 | 488 | ||
481 | /** | 489 | /** |
@@ -541,18 +549,22 @@ static int alarm_timer_create(struct k_itimer *new_timer) | |||
541 | * @new_timer: k_itimer pointer | 549 | * @new_timer: k_itimer pointer |
542 | * @cur_setting: itimerspec data to fill | 550 | * @cur_setting: itimerspec data to fill |
543 | * | 551 | * |
544 | * Copies the itimerspec data out from the k_itimer | 552 | * Copies out the current itimerspec data |
545 | */ | 553 | */ |
546 | static void alarm_timer_get(struct k_itimer *timr, | 554 | static void alarm_timer_get(struct k_itimer *timr, |
547 | struct itimerspec *cur_setting) | 555 | struct itimerspec *cur_setting) |
548 | { | 556 | { |
549 | memset(cur_setting, 0, sizeof(struct itimerspec)); | 557 | ktime_t relative_expiry_time = |
558 | alarm_expires_remaining(&(timr->it.alarm.alarmtimer)); | ||
559 | |||
560 | if (ktime_to_ns(relative_expiry_time) > 0) { | ||
561 | cur_setting->it_value = ktime_to_timespec(relative_expiry_time); | ||
562 | } else { | ||
563 | cur_setting->it_value.tv_sec = 0; | ||
564 | cur_setting->it_value.tv_nsec = 0; | ||
565 | } | ||
550 | 566 | ||
551 | cur_setting->it_interval = | 567 | cur_setting->it_interval = ktime_to_timespec(timr->it.alarm.interval); |
552 | ktime_to_timespec(timr->it.alarm.interval); | ||
553 | cur_setting->it_value = | ||
554 | ktime_to_timespec(timr->it.alarm.alarmtimer.node.expires); | ||
555 | return; | ||
556 | } | 568 | } |
557 | 569 | ||
558 | /** | 570 | /** |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 99aa6ee3908f..f654a8a298fa 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -225,6 +225,20 @@ static DEFINE_PER_CPU(struct irq_work, nohz_full_kick_work) = { | |||
225 | }; | 225 | }; |
226 | 226 | ||
227 | /* | 227 | /* |
228 | * Kick this CPU if it's full dynticks in order to force it to | ||
229 | * re-evaluate its dependency on the tick and restart it if necessary. | ||
230 | * This kick, unlike tick_nohz_full_kick_cpu() and tick_nohz_full_kick_all(), | ||
231 | * is NMI safe. | ||
232 | */ | ||
233 | void tick_nohz_full_kick(void) | ||
234 | { | ||
235 | if (!tick_nohz_full_cpu(smp_processor_id())) | ||
236 | return; | ||
237 | |||
238 | irq_work_queue(&__get_cpu_var(nohz_full_kick_work)); | ||
239 | } | ||
240 | |||
241 | /* | ||
228 | * Kick the CPU if it's full dynticks in order to force it to | 242 | * Kick the CPU if it's full dynticks in order to force it to |
229 | * re-evaluate its dependency on the tick and restart it if necessary. | 243 | * re-evaluate its dependency on the tick and restart it if necessary. |
230 | */ | 244 | */ |
diff --git a/kernel/time/time.c b/kernel/time/time.c index f0294ba14634..a9ae20fb0b11 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c | |||
@@ -559,17 +559,20 @@ EXPORT_SYMBOL(usecs_to_jiffies); | |||
559 | * that a remainder subtract here would not do the right thing as the | 559 | * that a remainder subtract here would not do the right thing as the |
560 | * resolution values don't fall on second boundries. I.e. the line: | 560 | * resolution values don't fall on second boundries. I.e. the line: |
561 | * nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding. | 561 | * nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding. |
562 | * Note that due to the small error in the multiplier here, this | ||
563 | * rounding is incorrect for sufficiently large values of tv_nsec, but | ||
564 | * well formed timespecs should have tv_nsec < NSEC_PER_SEC, so we're | ||
565 | * OK. | ||
562 | * | 566 | * |
563 | * Rather, we just shift the bits off the right. | 567 | * Rather, we just shift the bits off the right. |
564 | * | 568 | * |
565 | * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec | 569 | * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec |
566 | * value to a scaled second value. | 570 | * value to a scaled second value. |
567 | */ | 571 | */ |
568 | unsigned long | 572 | static unsigned long |
569 | timespec_to_jiffies(const struct timespec *value) | 573 | __timespec_to_jiffies(unsigned long sec, long nsec) |
570 | { | 574 | { |
571 | unsigned long sec = value->tv_sec; | 575 | nsec = nsec + TICK_NSEC - 1; |
572 | long nsec = value->tv_nsec + TICK_NSEC - 1; | ||
573 | 576 | ||
574 | if (sec >= MAX_SEC_IN_JIFFIES){ | 577 | if (sec >= MAX_SEC_IN_JIFFIES){ |
575 | sec = MAX_SEC_IN_JIFFIES; | 578 | sec = MAX_SEC_IN_JIFFIES; |
@@ -580,6 +583,13 @@ timespec_to_jiffies(const struct timespec *value) | |||
580 | (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | 583 | (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; |
581 | 584 | ||
582 | } | 585 | } |
586 | |||
587 | unsigned long | ||
588 | timespec_to_jiffies(const struct timespec *value) | ||
589 | { | ||
590 | return __timespec_to_jiffies(value->tv_sec, value->tv_nsec); | ||
591 | } | ||
592 | |||
583 | EXPORT_SYMBOL(timespec_to_jiffies); | 593 | EXPORT_SYMBOL(timespec_to_jiffies); |
584 | 594 | ||
585 | void | 595 | void |
@@ -596,31 +606,27 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) | |||
596 | } | 606 | } |
597 | EXPORT_SYMBOL(jiffies_to_timespec); | 607 | EXPORT_SYMBOL(jiffies_to_timespec); |
598 | 608 | ||
599 | /* Same for "timeval" | 609 | /* |
600 | * | 610 | * We could use a similar algorithm to timespec_to_jiffies (with a |
601 | * Well, almost. The problem here is that the real system resolution is | 611 | * different multiplier for usec instead of nsec). But this has a |
602 | * in nanoseconds and the value being converted is in micro seconds. | 612 | * problem with rounding: we can't exactly add TICK_NSEC - 1 to the |
603 | * Also for some machines (those that use HZ = 1024, in-particular), | 613 | * usec value, since it's not necessarily integral. |
604 | * there is a LARGE error in the tick size in microseconds. | 614 | * |
605 | 615 | * We could instead round in the intermediate scaled representation | |
606 | * The solution we use is to do the rounding AFTER we convert the | 616 | * (i.e. in units of 1/2^(large scale) jiffies) but that's also |
607 | * microsecond part. Thus the USEC_ROUND, the bits to be shifted off. | 617 | * perilous: the scaling introduces a small positive error, which |
608 | * Instruction wise, this should cost only an additional add with carry | 618 | * combined with a division-rounding-upward (i.e. adding 2^(scale) - 1 |
609 | * instruction above the way it was done above. | 619 | * units to the intermediate before shifting) leads to accidental |
620 | * overflow and overestimates. | ||
621 | * | ||
622 | * At the cost of one additional multiplication by a constant, just | ||
623 | * use the timespec implementation. | ||
610 | */ | 624 | */ |
611 | unsigned long | 625 | unsigned long |
612 | timeval_to_jiffies(const struct timeval *value) | 626 | timeval_to_jiffies(const struct timeval *value) |
613 | { | 627 | { |
614 | unsigned long sec = value->tv_sec; | 628 | return __timespec_to_jiffies(value->tv_sec, |
615 | long usec = value->tv_usec; | 629 | value->tv_usec * NSEC_PER_USEC); |
616 | |||
617 | if (sec >= MAX_SEC_IN_JIFFIES){ | ||
618 | sec = MAX_SEC_IN_JIFFIES; | ||
619 | usec = 0; | ||
620 | } | ||
621 | return (((u64)sec * SEC_CONVERSION) + | ||
622 | (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> | ||
623 | (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | ||
624 | } | 630 | } |
625 | EXPORT_SYMBOL(timeval_to_jiffies); | 631 | EXPORT_SYMBOL(timeval_to_jiffies); |
626 | 632 | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index fb4a9c2cf8d9..ec1791fae965 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -442,11 +442,12 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action) | |||
442 | tk->ntp_error = 0; | 442 | tk->ntp_error = 0; |
443 | ntp_clear(); | 443 | ntp_clear(); |
444 | } | 444 | } |
445 | update_vsyscall(tk); | ||
446 | update_pvclock_gtod(tk, action & TK_CLOCK_WAS_SET); | ||
447 | 445 | ||
448 | tk_update_ktime_data(tk); | 446 | tk_update_ktime_data(tk); |
449 | 447 | ||
448 | update_vsyscall(tk); | ||
449 | update_pvclock_gtod(tk, action & TK_CLOCK_WAS_SET); | ||
450 | |||
450 | if (action & TK_MIRROR) | 451 | if (action & TK_MIRROR) |
451 | memcpy(&shadow_timekeeper, &tk_core.timekeeper, | 452 | memcpy(&shadow_timekeeper, &tk_core.timekeeper, |
452 | sizeof(tk_core.timekeeper)); | 453 | sizeof(tk_core.timekeeper)); |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 1654b12c891a..5916a8e59e87 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -65,15 +65,21 @@ | |||
65 | #define FL_GLOBAL_CONTROL_MASK (FTRACE_OPS_FL_CONTROL) | 65 | #define FL_GLOBAL_CONTROL_MASK (FTRACE_OPS_FL_CONTROL) |
66 | 66 | ||
67 | #ifdef CONFIG_DYNAMIC_FTRACE | 67 | #ifdef CONFIG_DYNAMIC_FTRACE |
68 | #define INIT_REGEX_LOCK(opsname) \ | 68 | #define INIT_OPS_HASH(opsname) \ |
69 | .regex_lock = __MUTEX_INITIALIZER(opsname.regex_lock), | 69 | .func_hash = &opsname.local_hash, \ |
70 | .local_hash.regex_lock = __MUTEX_INITIALIZER(opsname.local_hash.regex_lock), | ||
71 | #define ASSIGN_OPS_HASH(opsname, val) \ | ||
72 | .func_hash = val, \ | ||
73 | .local_hash.regex_lock = __MUTEX_INITIALIZER(opsname.local_hash.regex_lock), | ||
70 | #else | 74 | #else |
71 | #define INIT_REGEX_LOCK(opsname) | 75 | #define INIT_OPS_HASH(opsname) |
76 | #define ASSIGN_OPS_HASH(opsname, val) | ||
72 | #endif | 77 | #endif |
73 | 78 | ||
74 | static struct ftrace_ops ftrace_list_end __read_mostly = { | 79 | static struct ftrace_ops ftrace_list_end __read_mostly = { |
75 | .func = ftrace_stub, | 80 | .func = ftrace_stub, |
76 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_STUB, | 81 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_STUB, |
82 | INIT_OPS_HASH(ftrace_list_end) | ||
77 | }; | 83 | }; |
78 | 84 | ||
79 | /* ftrace_enabled is a method to turn ftrace on or off */ | 85 | /* ftrace_enabled is a method to turn ftrace on or off */ |
@@ -140,7 +146,8 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops) | |||
140 | { | 146 | { |
141 | #ifdef CONFIG_DYNAMIC_FTRACE | 147 | #ifdef CONFIG_DYNAMIC_FTRACE |
142 | if (!(ops->flags & FTRACE_OPS_FL_INITIALIZED)) { | 148 | if (!(ops->flags & FTRACE_OPS_FL_INITIALIZED)) { |
143 | mutex_init(&ops->regex_lock); | 149 | mutex_init(&ops->local_hash.regex_lock); |
150 | ops->func_hash = &ops->local_hash; | ||
144 | ops->flags |= FTRACE_OPS_FL_INITIALIZED; | 151 | ops->flags |= FTRACE_OPS_FL_INITIALIZED; |
145 | } | 152 | } |
146 | #endif | 153 | #endif |
@@ -899,7 +906,7 @@ static void unregister_ftrace_profiler(void) | |||
899 | static struct ftrace_ops ftrace_profile_ops __read_mostly = { | 906 | static struct ftrace_ops ftrace_profile_ops __read_mostly = { |
900 | .func = function_profile_call, | 907 | .func = function_profile_call, |
901 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, | 908 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, |
902 | INIT_REGEX_LOCK(ftrace_profile_ops) | 909 | INIT_OPS_HASH(ftrace_profile_ops) |
903 | }; | 910 | }; |
904 | 911 | ||
905 | static int register_ftrace_profiler(void) | 912 | static int register_ftrace_profiler(void) |
@@ -1081,11 +1088,12 @@ static const struct ftrace_hash empty_hash = { | |||
1081 | #define EMPTY_HASH ((struct ftrace_hash *)&empty_hash) | 1088 | #define EMPTY_HASH ((struct ftrace_hash *)&empty_hash) |
1082 | 1089 | ||
1083 | static struct ftrace_ops global_ops = { | 1090 | static struct ftrace_ops global_ops = { |
1084 | .func = ftrace_stub, | 1091 | .func = ftrace_stub, |
1085 | .notrace_hash = EMPTY_HASH, | 1092 | .local_hash.notrace_hash = EMPTY_HASH, |
1086 | .filter_hash = EMPTY_HASH, | 1093 | .local_hash.filter_hash = EMPTY_HASH, |
1087 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, | 1094 | INIT_OPS_HASH(global_ops) |
1088 | INIT_REGEX_LOCK(global_ops) | 1095 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | |
1096 | FTRACE_OPS_FL_INITIALIZED, | ||
1089 | }; | 1097 | }; |
1090 | 1098 | ||
1091 | struct ftrace_page { | 1099 | struct ftrace_page { |
@@ -1226,8 +1234,8 @@ static void free_ftrace_hash_rcu(struct ftrace_hash *hash) | |||
1226 | void ftrace_free_filter(struct ftrace_ops *ops) | 1234 | void ftrace_free_filter(struct ftrace_ops *ops) |
1227 | { | 1235 | { |
1228 | ftrace_ops_init(ops); | 1236 | ftrace_ops_init(ops); |
1229 | free_ftrace_hash(ops->filter_hash); | 1237 | free_ftrace_hash(ops->func_hash->filter_hash); |
1230 | free_ftrace_hash(ops->notrace_hash); | 1238 | free_ftrace_hash(ops->func_hash->notrace_hash); |
1231 | } | 1239 | } |
1232 | 1240 | ||
1233 | static struct ftrace_hash *alloc_ftrace_hash(int size_bits) | 1241 | static struct ftrace_hash *alloc_ftrace_hash(int size_bits) |
@@ -1288,9 +1296,9 @@ alloc_and_copy_ftrace_hash(int size_bits, struct ftrace_hash *hash) | |||
1288 | } | 1296 | } |
1289 | 1297 | ||
1290 | static void | 1298 | static void |
1291 | ftrace_hash_rec_disable(struct ftrace_ops *ops, int filter_hash); | 1299 | ftrace_hash_rec_disable_modify(struct ftrace_ops *ops, int filter_hash); |
1292 | static void | 1300 | static void |
1293 | ftrace_hash_rec_enable(struct ftrace_ops *ops, int filter_hash); | 1301 | ftrace_hash_rec_enable_modify(struct ftrace_ops *ops, int filter_hash); |
1294 | 1302 | ||
1295 | static int | 1303 | static int |
1296 | ftrace_hash_move(struct ftrace_ops *ops, int enable, | 1304 | ftrace_hash_move(struct ftrace_ops *ops, int enable, |
@@ -1342,13 +1350,13 @@ update: | |||
1342 | * Remove the current set, update the hash and add | 1350 | * Remove the current set, update the hash and add |
1343 | * them back. | 1351 | * them back. |
1344 | */ | 1352 | */ |
1345 | ftrace_hash_rec_disable(ops, enable); | 1353 | ftrace_hash_rec_disable_modify(ops, enable); |
1346 | 1354 | ||
1347 | old_hash = *dst; | 1355 | old_hash = *dst; |
1348 | rcu_assign_pointer(*dst, new_hash); | 1356 | rcu_assign_pointer(*dst, new_hash); |
1349 | free_ftrace_hash_rcu(old_hash); | 1357 | free_ftrace_hash_rcu(old_hash); |
1350 | 1358 | ||
1351 | ftrace_hash_rec_enable(ops, enable); | 1359 | ftrace_hash_rec_enable_modify(ops, enable); |
1352 | 1360 | ||
1353 | return 0; | 1361 | return 0; |
1354 | } | 1362 | } |
@@ -1382,8 +1390,8 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs) | |||
1382 | return 0; | 1390 | return 0; |
1383 | #endif | 1391 | #endif |
1384 | 1392 | ||
1385 | filter_hash = rcu_dereference_raw_notrace(ops->filter_hash); | 1393 | filter_hash = rcu_dereference_raw_notrace(ops->func_hash->filter_hash); |
1386 | notrace_hash = rcu_dereference_raw_notrace(ops->notrace_hash); | 1394 | notrace_hash = rcu_dereference_raw_notrace(ops->func_hash->notrace_hash); |
1387 | 1395 | ||
1388 | if ((ftrace_hash_empty(filter_hash) || | 1396 | if ((ftrace_hash_empty(filter_hash) || |
1389 | ftrace_lookup_ip(filter_hash, ip)) && | 1397 | ftrace_lookup_ip(filter_hash, ip)) && |
@@ -1503,25 +1511,38 @@ static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec) | |||
1503 | static void ftrace_remove_tramp(struct ftrace_ops *ops, | 1511 | static void ftrace_remove_tramp(struct ftrace_ops *ops, |
1504 | struct dyn_ftrace *rec) | 1512 | struct dyn_ftrace *rec) |
1505 | { | 1513 | { |
1506 | struct ftrace_func_entry *entry; | 1514 | /* If TRAMP is not set, no ops should have a trampoline for this */ |
1507 | 1515 | if (!(rec->flags & FTRACE_FL_TRAMP)) | |
1508 | entry = ftrace_lookup_ip(ops->tramp_hash, rec->ip); | ||
1509 | if (!entry) | ||
1510 | return; | 1516 | return; |
1511 | 1517 | ||
1518 | rec->flags &= ~FTRACE_FL_TRAMP; | ||
1519 | |||
1520 | if ((!ftrace_hash_empty(ops->func_hash->filter_hash) && | ||
1521 | !ftrace_lookup_ip(ops->func_hash->filter_hash, rec->ip)) || | ||
1522 | ftrace_lookup_ip(ops->func_hash->notrace_hash, rec->ip)) | ||
1523 | return; | ||
1512 | /* | 1524 | /* |
1513 | * The tramp_hash entry will be removed at time | 1525 | * The tramp_hash entry will be removed at time |
1514 | * of update. | 1526 | * of update. |
1515 | */ | 1527 | */ |
1516 | ops->nr_trampolines--; | 1528 | ops->nr_trampolines--; |
1517 | rec->flags &= ~FTRACE_FL_TRAMP; | ||
1518 | } | 1529 | } |
1519 | 1530 | ||
1520 | static void ftrace_clear_tramps(struct dyn_ftrace *rec) | 1531 | static void ftrace_clear_tramps(struct dyn_ftrace *rec, struct ftrace_ops *ops) |
1521 | { | 1532 | { |
1522 | struct ftrace_ops *op; | 1533 | struct ftrace_ops *op; |
1523 | 1534 | ||
1535 | /* If TRAMP is not set, no ops should have a trampoline for this */ | ||
1536 | if (!(rec->flags & FTRACE_FL_TRAMP)) | ||
1537 | return; | ||
1538 | |||
1524 | do_for_each_ftrace_op(op, ftrace_ops_list) { | 1539 | do_for_each_ftrace_op(op, ftrace_ops_list) { |
1540 | /* | ||
1541 | * This function is called to clear other tramps | ||
1542 | * not the one that is being updated. | ||
1543 | */ | ||
1544 | if (op == ops) | ||
1545 | continue; | ||
1525 | if (op->nr_trampolines) | 1546 | if (op->nr_trampolines) |
1526 | ftrace_remove_tramp(op, rec); | 1547 | ftrace_remove_tramp(op, rec); |
1527 | } while_for_each_ftrace_op(op); | 1548 | } while_for_each_ftrace_op(op); |
@@ -1554,14 +1575,14 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops, | |||
1554 | * gets inversed. | 1575 | * gets inversed. |
1555 | */ | 1576 | */ |
1556 | if (filter_hash) { | 1577 | if (filter_hash) { |
1557 | hash = ops->filter_hash; | 1578 | hash = ops->func_hash->filter_hash; |
1558 | other_hash = ops->notrace_hash; | 1579 | other_hash = ops->func_hash->notrace_hash; |
1559 | if (ftrace_hash_empty(hash)) | 1580 | if (ftrace_hash_empty(hash)) |
1560 | all = 1; | 1581 | all = 1; |
1561 | } else { | 1582 | } else { |
1562 | inc = !inc; | 1583 | inc = !inc; |
1563 | hash = ops->notrace_hash; | 1584 | hash = ops->func_hash->notrace_hash; |
1564 | other_hash = ops->filter_hash; | 1585 | other_hash = ops->func_hash->filter_hash; |
1565 | /* | 1586 | /* |
1566 | * If the notrace hash has no items, | 1587 | * If the notrace hash has no items, |
1567 | * then there's nothing to do. | 1588 | * then there's nothing to do. |
@@ -1622,13 +1643,10 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops, | |||
1622 | /* | 1643 | /* |
1623 | * If we are adding another function callback | 1644 | * If we are adding another function callback |
1624 | * to this function, and the previous had a | 1645 | * to this function, and the previous had a |
1625 | * trampoline used, then we need to go back to | 1646 | * custom trampoline in use, then we need to go |
1626 | * the default trampoline. | 1647 | * back to the default trampoline. |
1627 | */ | 1648 | */ |
1628 | rec->flags &= ~FTRACE_FL_TRAMP; | 1649 | ftrace_clear_tramps(rec, ops); |
1629 | |||
1630 | /* remove trampolines from any ops for this rec */ | ||
1631 | ftrace_clear_tramps(rec); | ||
1632 | } | 1650 | } |
1633 | 1651 | ||
1634 | /* | 1652 | /* |
@@ -1682,6 +1700,41 @@ static void ftrace_hash_rec_enable(struct ftrace_ops *ops, | |||
1682 | __ftrace_hash_rec_update(ops, filter_hash, 1); | 1700 | __ftrace_hash_rec_update(ops, filter_hash, 1); |
1683 | } | 1701 | } |
1684 | 1702 | ||
1703 | static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, | ||
1704 | int filter_hash, int inc) | ||
1705 | { | ||
1706 | struct ftrace_ops *op; | ||
1707 | |||
1708 | __ftrace_hash_rec_update(ops, filter_hash, inc); | ||
1709 | |||
1710 | if (ops->func_hash != &global_ops.local_hash) | ||
1711 | return; | ||
1712 | |||
1713 | /* | ||
1714 | * If the ops shares the global_ops hash, then we need to update | ||
1715 | * all ops that are enabled and use this hash. | ||
1716 | */ | ||
1717 | do_for_each_ftrace_op(op, ftrace_ops_list) { | ||
1718 | /* Already done */ | ||
1719 | if (op == ops) | ||
1720 | continue; | ||
1721 | if (op->func_hash == &global_ops.local_hash) | ||
1722 | __ftrace_hash_rec_update(op, filter_hash, inc); | ||
1723 | } while_for_each_ftrace_op(op); | ||
1724 | } | ||
1725 | |||
1726 | static void ftrace_hash_rec_disable_modify(struct ftrace_ops *ops, | ||
1727 | int filter_hash) | ||
1728 | { | ||
1729 | ftrace_hash_rec_update_modify(ops, filter_hash, 0); | ||
1730 | } | ||
1731 | |||
1732 | static void ftrace_hash_rec_enable_modify(struct ftrace_ops *ops, | ||
1733 | int filter_hash) | ||
1734 | { | ||
1735 | ftrace_hash_rec_update_modify(ops, filter_hash, 1); | ||
1736 | } | ||
1737 | |||
1685 | static void print_ip_ins(const char *fmt, unsigned char *p) | 1738 | static void print_ip_ins(const char *fmt, unsigned char *p) |
1686 | { | 1739 | { |
1687 | int i; | 1740 | int i; |
@@ -1896,8 +1949,8 @@ unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec) | |||
1896 | if (rec->flags & FTRACE_FL_TRAMP) { | 1949 | if (rec->flags & FTRACE_FL_TRAMP) { |
1897 | ops = ftrace_find_tramp_ops_new(rec); | 1950 | ops = ftrace_find_tramp_ops_new(rec); |
1898 | if (FTRACE_WARN_ON(!ops || !ops->trampoline)) { | 1951 | if (FTRACE_WARN_ON(!ops || !ops->trampoline)) { |
1899 | pr_warning("Bad trampoline accounting at: %p (%pS)\n", | 1952 | pr_warn("Bad trampoline accounting at: %p (%pS) (%lx)\n", |
1900 | (void *)rec->ip, (void *)rec->ip); | 1953 | (void *)rec->ip, (void *)rec->ip, rec->flags); |
1901 | /* Ftrace is shutting down, return anything */ | 1954 | /* Ftrace is shutting down, return anything */ |
1902 | return (unsigned long)FTRACE_ADDR; | 1955 | return (unsigned long)FTRACE_ADDR; |
1903 | } | 1956 | } |
@@ -1964,7 +2017,7 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable) | |||
1964 | return ftrace_make_call(rec, ftrace_addr); | 2017 | return ftrace_make_call(rec, ftrace_addr); |
1965 | 2018 | ||
1966 | case FTRACE_UPDATE_MAKE_NOP: | 2019 | case FTRACE_UPDATE_MAKE_NOP: |
1967 | return ftrace_make_nop(NULL, rec, ftrace_addr); | 2020 | return ftrace_make_nop(NULL, rec, ftrace_old_addr); |
1968 | 2021 | ||
1969 | case FTRACE_UPDATE_MODIFY_CALL: | 2022 | case FTRACE_UPDATE_MODIFY_CALL: |
1970 | return ftrace_modify_call(rec, ftrace_old_addr, ftrace_addr); | 2023 | return ftrace_modify_call(rec, ftrace_old_addr, ftrace_addr); |
@@ -2227,7 +2280,10 @@ static int ftrace_save_ops_tramp_hash(struct ftrace_ops *ops) | |||
2227 | } while_for_each_ftrace_rec(); | 2280 | } while_for_each_ftrace_rec(); |
2228 | 2281 | ||
2229 | /* The number of recs in the hash must match nr_trampolines */ | 2282 | /* The number of recs in the hash must match nr_trampolines */ |
2230 | FTRACE_WARN_ON(ops->tramp_hash->count != ops->nr_trampolines); | 2283 | if (FTRACE_WARN_ON(ops->tramp_hash->count != ops->nr_trampolines)) |
2284 | pr_warn("count=%ld trampolines=%d\n", | ||
2285 | ops->tramp_hash->count, | ||
2286 | ops->nr_trampolines); | ||
2231 | 2287 | ||
2232 | return 0; | 2288 | return 0; |
2233 | } | 2289 | } |
@@ -2436,8 +2492,8 @@ static inline int ops_traces_mod(struct ftrace_ops *ops) | |||
2436 | * Filter_hash being empty will default to trace module. | 2492 | * Filter_hash being empty will default to trace module. |
2437 | * But notrace hash requires a test of individual module functions. | 2493 | * But notrace hash requires a test of individual module functions. |
2438 | */ | 2494 | */ |
2439 | return ftrace_hash_empty(ops->filter_hash) && | 2495 | return ftrace_hash_empty(ops->func_hash->filter_hash) && |
2440 | ftrace_hash_empty(ops->notrace_hash); | 2496 | ftrace_hash_empty(ops->func_hash->notrace_hash); |
2441 | } | 2497 | } |
2442 | 2498 | ||
2443 | /* | 2499 | /* |
@@ -2459,12 +2515,12 @@ ops_references_rec(struct ftrace_ops *ops, struct dyn_ftrace *rec) | |||
2459 | return 0; | 2515 | return 0; |
2460 | 2516 | ||
2461 | /* The function must be in the filter */ | 2517 | /* The function must be in the filter */ |
2462 | if (!ftrace_hash_empty(ops->filter_hash) && | 2518 | if (!ftrace_hash_empty(ops->func_hash->filter_hash) && |
2463 | !ftrace_lookup_ip(ops->filter_hash, rec->ip)) | 2519 | !ftrace_lookup_ip(ops->func_hash->filter_hash, rec->ip)) |
2464 | return 0; | 2520 | return 0; |
2465 | 2521 | ||
2466 | /* If in notrace hash, we ignore it too */ | 2522 | /* If in notrace hash, we ignore it too */ |
2467 | if (ftrace_lookup_ip(ops->notrace_hash, rec->ip)) | 2523 | if (ftrace_lookup_ip(ops->func_hash->notrace_hash, rec->ip)) |
2468 | return 0; | 2524 | return 0; |
2469 | 2525 | ||
2470 | return 1; | 2526 | return 1; |
@@ -2785,10 +2841,10 @@ t_next(struct seq_file *m, void *v, loff_t *pos) | |||
2785 | } else { | 2841 | } else { |
2786 | rec = &iter->pg->records[iter->idx++]; | 2842 | rec = &iter->pg->records[iter->idx++]; |
2787 | if (((iter->flags & FTRACE_ITER_FILTER) && | 2843 | if (((iter->flags & FTRACE_ITER_FILTER) && |
2788 | !(ftrace_lookup_ip(ops->filter_hash, rec->ip))) || | 2844 | !(ftrace_lookup_ip(ops->func_hash->filter_hash, rec->ip))) || |
2789 | 2845 | ||
2790 | ((iter->flags & FTRACE_ITER_NOTRACE) && | 2846 | ((iter->flags & FTRACE_ITER_NOTRACE) && |
2791 | !ftrace_lookup_ip(ops->notrace_hash, rec->ip)) || | 2847 | !ftrace_lookup_ip(ops->func_hash->notrace_hash, rec->ip)) || |
2792 | 2848 | ||
2793 | ((iter->flags & FTRACE_ITER_ENABLED) && | 2849 | ((iter->flags & FTRACE_ITER_ENABLED) && |
2794 | !(rec->flags & FTRACE_FL_ENABLED))) { | 2850 | !(rec->flags & FTRACE_FL_ENABLED))) { |
@@ -2837,9 +2893,9 @@ static void *t_start(struct seq_file *m, loff_t *pos) | |||
2837 | * functions are enabled. | 2893 | * functions are enabled. |
2838 | */ | 2894 | */ |
2839 | if ((iter->flags & FTRACE_ITER_FILTER && | 2895 | if ((iter->flags & FTRACE_ITER_FILTER && |
2840 | ftrace_hash_empty(ops->filter_hash)) || | 2896 | ftrace_hash_empty(ops->func_hash->filter_hash)) || |
2841 | (iter->flags & FTRACE_ITER_NOTRACE && | 2897 | (iter->flags & FTRACE_ITER_NOTRACE && |
2842 | ftrace_hash_empty(ops->notrace_hash))) { | 2898 | ftrace_hash_empty(ops->func_hash->notrace_hash))) { |
2843 | if (*pos > 0) | 2899 | if (*pos > 0) |
2844 | return t_hash_start(m, pos); | 2900 | return t_hash_start(m, pos); |
2845 | iter->flags |= FTRACE_ITER_PRINTALL; | 2901 | iter->flags |= FTRACE_ITER_PRINTALL; |
@@ -3001,12 +3057,12 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag, | |||
3001 | iter->ops = ops; | 3057 | iter->ops = ops; |
3002 | iter->flags = flag; | 3058 | iter->flags = flag; |
3003 | 3059 | ||
3004 | mutex_lock(&ops->regex_lock); | 3060 | mutex_lock(&ops->func_hash->regex_lock); |
3005 | 3061 | ||
3006 | if (flag & FTRACE_ITER_NOTRACE) | 3062 | if (flag & FTRACE_ITER_NOTRACE) |
3007 | hash = ops->notrace_hash; | 3063 | hash = ops->func_hash->notrace_hash; |
3008 | else | 3064 | else |
3009 | hash = ops->filter_hash; | 3065 | hash = ops->func_hash->filter_hash; |
3010 | 3066 | ||
3011 | if (file->f_mode & FMODE_WRITE) { | 3067 | if (file->f_mode & FMODE_WRITE) { |
3012 | const int size_bits = FTRACE_HASH_DEFAULT_BITS; | 3068 | const int size_bits = FTRACE_HASH_DEFAULT_BITS; |
@@ -3041,7 +3097,7 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag, | |||
3041 | file->private_data = iter; | 3097 | file->private_data = iter; |
3042 | 3098 | ||
3043 | out_unlock: | 3099 | out_unlock: |
3044 | mutex_unlock(&ops->regex_lock); | 3100 | mutex_unlock(&ops->func_hash->regex_lock); |
3045 | 3101 | ||
3046 | return ret; | 3102 | return ret; |
3047 | } | 3103 | } |
@@ -3279,7 +3335,7 @@ static struct ftrace_ops trace_probe_ops __read_mostly = | |||
3279 | { | 3335 | { |
3280 | .func = function_trace_probe_call, | 3336 | .func = function_trace_probe_call, |
3281 | .flags = FTRACE_OPS_FL_INITIALIZED, | 3337 | .flags = FTRACE_OPS_FL_INITIALIZED, |
3282 | INIT_REGEX_LOCK(trace_probe_ops) | 3338 | INIT_OPS_HASH(trace_probe_ops) |
3283 | }; | 3339 | }; |
3284 | 3340 | ||
3285 | static int ftrace_probe_registered; | 3341 | static int ftrace_probe_registered; |
@@ -3342,7 +3398,7 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3342 | void *data) | 3398 | void *data) |
3343 | { | 3399 | { |
3344 | struct ftrace_func_probe *entry; | 3400 | struct ftrace_func_probe *entry; |
3345 | struct ftrace_hash **orig_hash = &trace_probe_ops.filter_hash; | 3401 | struct ftrace_hash **orig_hash = &trace_probe_ops.func_hash->filter_hash; |
3346 | struct ftrace_hash *hash; | 3402 | struct ftrace_hash *hash; |
3347 | struct ftrace_page *pg; | 3403 | struct ftrace_page *pg; |
3348 | struct dyn_ftrace *rec; | 3404 | struct dyn_ftrace *rec; |
@@ -3359,7 +3415,7 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3359 | if (WARN_ON(not)) | 3415 | if (WARN_ON(not)) |
3360 | return -EINVAL; | 3416 | return -EINVAL; |
3361 | 3417 | ||
3362 | mutex_lock(&trace_probe_ops.regex_lock); | 3418 | mutex_lock(&trace_probe_ops.func_hash->regex_lock); |
3363 | 3419 | ||
3364 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); | 3420 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); |
3365 | if (!hash) { | 3421 | if (!hash) { |
@@ -3428,7 +3484,7 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3428 | out_unlock: | 3484 | out_unlock: |
3429 | mutex_unlock(&ftrace_lock); | 3485 | mutex_unlock(&ftrace_lock); |
3430 | out: | 3486 | out: |
3431 | mutex_unlock(&trace_probe_ops.regex_lock); | 3487 | mutex_unlock(&trace_probe_ops.func_hash->regex_lock); |
3432 | free_ftrace_hash(hash); | 3488 | free_ftrace_hash(hash); |
3433 | 3489 | ||
3434 | return count; | 3490 | return count; |
@@ -3446,7 +3502,7 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3446 | struct ftrace_func_entry *rec_entry; | 3502 | struct ftrace_func_entry *rec_entry; |
3447 | struct ftrace_func_probe *entry; | 3503 | struct ftrace_func_probe *entry; |
3448 | struct ftrace_func_probe *p; | 3504 | struct ftrace_func_probe *p; |
3449 | struct ftrace_hash **orig_hash = &trace_probe_ops.filter_hash; | 3505 | struct ftrace_hash **orig_hash = &trace_probe_ops.func_hash->filter_hash; |
3450 | struct list_head free_list; | 3506 | struct list_head free_list; |
3451 | struct ftrace_hash *hash; | 3507 | struct ftrace_hash *hash; |
3452 | struct hlist_node *tmp; | 3508 | struct hlist_node *tmp; |
@@ -3468,7 +3524,7 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3468 | return; | 3524 | return; |
3469 | } | 3525 | } |
3470 | 3526 | ||
3471 | mutex_lock(&trace_probe_ops.regex_lock); | 3527 | mutex_lock(&trace_probe_ops.func_hash->regex_lock); |
3472 | 3528 | ||
3473 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); | 3529 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); |
3474 | if (!hash) | 3530 | if (!hash) |
@@ -3521,7 +3577,7 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3521 | mutex_unlock(&ftrace_lock); | 3577 | mutex_unlock(&ftrace_lock); |
3522 | 3578 | ||
3523 | out_unlock: | 3579 | out_unlock: |
3524 | mutex_unlock(&trace_probe_ops.regex_lock); | 3580 | mutex_unlock(&trace_probe_ops.func_hash->regex_lock); |
3525 | free_ftrace_hash(hash); | 3581 | free_ftrace_hash(hash); |
3526 | } | 3582 | } |
3527 | 3583 | ||
@@ -3717,12 +3773,12 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3717 | if (unlikely(ftrace_disabled)) | 3773 | if (unlikely(ftrace_disabled)) |
3718 | return -ENODEV; | 3774 | return -ENODEV; |
3719 | 3775 | ||
3720 | mutex_lock(&ops->regex_lock); | 3776 | mutex_lock(&ops->func_hash->regex_lock); |
3721 | 3777 | ||
3722 | if (enable) | 3778 | if (enable) |
3723 | orig_hash = &ops->filter_hash; | 3779 | orig_hash = &ops->func_hash->filter_hash; |
3724 | else | 3780 | else |
3725 | orig_hash = &ops->notrace_hash; | 3781 | orig_hash = &ops->func_hash->notrace_hash; |
3726 | 3782 | ||
3727 | if (reset) | 3783 | if (reset) |
3728 | hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); | 3784 | hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); |
@@ -3752,7 +3808,7 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3752 | mutex_unlock(&ftrace_lock); | 3808 | mutex_unlock(&ftrace_lock); |
3753 | 3809 | ||
3754 | out_regex_unlock: | 3810 | out_regex_unlock: |
3755 | mutex_unlock(&ops->regex_lock); | 3811 | mutex_unlock(&ops->func_hash->regex_lock); |
3756 | 3812 | ||
3757 | free_ftrace_hash(hash); | 3813 | free_ftrace_hash(hash); |
3758 | return ret; | 3814 | return ret; |
@@ -3975,15 +4031,15 @@ int ftrace_regex_release(struct inode *inode, struct file *file) | |||
3975 | 4031 | ||
3976 | trace_parser_put(parser); | 4032 | trace_parser_put(parser); |
3977 | 4033 | ||
3978 | mutex_lock(&iter->ops->regex_lock); | 4034 | mutex_lock(&iter->ops->func_hash->regex_lock); |
3979 | 4035 | ||
3980 | if (file->f_mode & FMODE_WRITE) { | 4036 | if (file->f_mode & FMODE_WRITE) { |
3981 | filter_hash = !!(iter->flags & FTRACE_ITER_FILTER); | 4037 | filter_hash = !!(iter->flags & FTRACE_ITER_FILTER); |
3982 | 4038 | ||
3983 | if (filter_hash) | 4039 | if (filter_hash) |
3984 | orig_hash = &iter->ops->filter_hash; | 4040 | orig_hash = &iter->ops->func_hash->filter_hash; |
3985 | else | 4041 | else |
3986 | orig_hash = &iter->ops->notrace_hash; | 4042 | orig_hash = &iter->ops->func_hash->notrace_hash; |
3987 | 4043 | ||
3988 | mutex_lock(&ftrace_lock); | 4044 | mutex_lock(&ftrace_lock); |
3989 | ret = ftrace_hash_move(iter->ops, filter_hash, | 4045 | ret = ftrace_hash_move(iter->ops, filter_hash, |
@@ -3994,7 +4050,7 @@ int ftrace_regex_release(struct inode *inode, struct file *file) | |||
3994 | mutex_unlock(&ftrace_lock); | 4050 | mutex_unlock(&ftrace_lock); |
3995 | } | 4051 | } |
3996 | 4052 | ||
3997 | mutex_unlock(&iter->ops->regex_lock); | 4053 | mutex_unlock(&iter->ops->func_hash->regex_lock); |
3998 | free_ftrace_hash(iter->hash); | 4054 | free_ftrace_hash(iter->hash); |
3999 | kfree(iter); | 4055 | kfree(iter); |
4000 | 4056 | ||
@@ -4611,7 +4667,6 @@ void __init ftrace_init(void) | |||
4611 | static struct ftrace_ops global_ops = { | 4667 | static struct ftrace_ops global_ops = { |
4612 | .func = ftrace_stub, | 4668 | .func = ftrace_stub, |
4613 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, | 4669 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, |
4614 | INIT_REGEX_LOCK(global_ops) | ||
4615 | }; | 4670 | }; |
4616 | 4671 | ||
4617 | static int __init ftrace_nodyn_init(void) | 4672 | static int __init ftrace_nodyn_init(void) |
@@ -4713,7 +4768,7 @@ ftrace_ops_control_func(unsigned long ip, unsigned long parent_ip, | |||
4713 | static struct ftrace_ops control_ops = { | 4768 | static struct ftrace_ops control_ops = { |
4714 | .func = ftrace_ops_control_func, | 4769 | .func = ftrace_ops_control_func, |
4715 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, | 4770 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED, |
4716 | INIT_REGEX_LOCK(control_ops) | 4771 | INIT_OPS_HASH(control_ops) |
4717 | }; | 4772 | }; |
4718 | 4773 | ||
4719 | static inline void | 4774 | static inline void |
@@ -5145,6 +5200,17 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
5145 | 5200 | ||
5146 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 5201 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
5147 | 5202 | ||
5203 | static struct ftrace_ops graph_ops = { | ||
5204 | .func = ftrace_stub, | ||
5205 | .flags = FTRACE_OPS_FL_RECURSION_SAFE | | ||
5206 | FTRACE_OPS_FL_INITIALIZED | | ||
5207 | FTRACE_OPS_FL_STUB, | ||
5208 | #ifdef FTRACE_GRAPH_TRAMP_ADDR | ||
5209 | .trampoline = FTRACE_GRAPH_TRAMP_ADDR, | ||
5210 | #endif | ||
5211 | ASSIGN_OPS_HASH(graph_ops, &global_ops.local_hash) | ||
5212 | }; | ||
5213 | |||
5148 | static int ftrace_graph_active; | 5214 | static int ftrace_graph_active; |
5149 | 5215 | ||
5150 | int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace) | 5216 | int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace) |
@@ -5307,12 +5373,28 @@ static int ftrace_graph_entry_test(struct ftrace_graph_ent *trace) | |||
5307 | */ | 5373 | */ |
5308 | static void update_function_graph_func(void) | 5374 | static void update_function_graph_func(void) |
5309 | { | 5375 | { |
5310 | if (ftrace_ops_list == &ftrace_list_end || | 5376 | struct ftrace_ops *op; |
5311 | (ftrace_ops_list == &global_ops && | 5377 | bool do_test = false; |
5312 | global_ops.next == &ftrace_list_end)) | 5378 | |
5313 | ftrace_graph_entry = __ftrace_graph_entry; | 5379 | /* |
5314 | else | 5380 | * The graph and global ops share the same set of functions |
5381 | * to test. If any other ops is on the list, then | ||
5382 | * the graph tracing needs to test if its the function | ||
5383 | * it should call. | ||
5384 | */ | ||
5385 | do_for_each_ftrace_op(op, ftrace_ops_list) { | ||
5386 | if (op != &global_ops && op != &graph_ops && | ||
5387 | op != &ftrace_list_end) { | ||
5388 | do_test = true; | ||
5389 | /* in double loop, break out with goto */ | ||
5390 | goto out; | ||
5391 | } | ||
5392 | } while_for_each_ftrace_op(op); | ||
5393 | out: | ||
5394 | if (do_test) | ||
5315 | ftrace_graph_entry = ftrace_graph_entry_test; | 5395 | ftrace_graph_entry = ftrace_graph_entry_test; |
5396 | else | ||
5397 | ftrace_graph_entry = __ftrace_graph_entry; | ||
5316 | } | 5398 | } |
5317 | 5399 | ||
5318 | static struct notifier_block ftrace_suspend_notifier = { | 5400 | static struct notifier_block ftrace_suspend_notifier = { |
@@ -5353,16 +5435,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc, | |||
5353 | ftrace_graph_entry = ftrace_graph_entry_test; | 5435 | ftrace_graph_entry = ftrace_graph_entry_test; |
5354 | update_function_graph_func(); | 5436 | update_function_graph_func(); |
5355 | 5437 | ||
5356 | /* Function graph doesn't use the .func field of global_ops */ | 5438 | ret = ftrace_startup(&graph_ops, FTRACE_START_FUNC_RET); |
5357 | global_ops.flags |= FTRACE_OPS_FL_STUB; | ||
5358 | |||
5359 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
5360 | /* Optimize function graph calling (if implemented by arch) */ | ||
5361 | if (FTRACE_GRAPH_TRAMP_ADDR != 0) | ||
5362 | global_ops.trampoline = FTRACE_GRAPH_TRAMP_ADDR; | ||
5363 | #endif | ||
5364 | |||
5365 | ret = ftrace_startup(&global_ops, FTRACE_START_FUNC_RET); | ||
5366 | 5439 | ||
5367 | out: | 5440 | out: |
5368 | mutex_unlock(&ftrace_lock); | 5441 | mutex_unlock(&ftrace_lock); |
@@ -5380,12 +5453,7 @@ void unregister_ftrace_graph(void) | |||
5380 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; | 5453 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
5381 | ftrace_graph_entry = ftrace_graph_entry_stub; | 5454 | ftrace_graph_entry = ftrace_graph_entry_stub; |
5382 | __ftrace_graph_entry = ftrace_graph_entry_stub; | 5455 | __ftrace_graph_entry = ftrace_graph_entry_stub; |
5383 | ftrace_shutdown(&global_ops, FTRACE_STOP_FUNC_RET); | 5456 | ftrace_shutdown(&graph_ops, FTRACE_STOP_FUNC_RET); |
5384 | global_ops.flags &= ~FTRACE_OPS_FL_STUB; | ||
5385 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
5386 | if (FTRACE_GRAPH_TRAMP_ADDR != 0) | ||
5387 | global_ops.trampoline = 0; | ||
5388 | #endif | ||
5389 | unregister_pm_notifier(&ftrace_suspend_notifier); | 5457 | unregister_pm_notifier(&ftrace_suspend_notifier); |
5390 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL); | 5458 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL); |
5391 | 5459 | ||
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index afb04b9b818a..b38fb2b9e237 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -626,8 +626,22 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, | |||
626 | work = &cpu_buffer->irq_work; | 626 | work = &cpu_buffer->irq_work; |
627 | } | 627 | } |
628 | 628 | ||
629 | work->waiters_pending = true; | ||
630 | poll_wait(filp, &work->waiters, poll_table); | 629 | poll_wait(filp, &work->waiters, poll_table); |
630 | work->waiters_pending = true; | ||
631 | /* | ||
632 | * There's a tight race between setting the waiters_pending and | ||
633 | * checking if the ring buffer is empty. Once the waiters_pending bit | ||
634 | * is set, the next event will wake the task up, but we can get stuck | ||
635 | * if there's only a single event in. | ||
636 | * | ||
637 | * FIXME: Ideally, we need a memory barrier on the writer side as well, | ||
638 | * but adding a memory barrier to all events will cause too much of a | ||
639 | * performance hit in the fast path. We only need a memory barrier when | ||
640 | * the buffer goes from empty to having content. But as this race is | ||
641 | * extremely small, and it's not a problem if another event comes in, we | ||
642 | * will fix it later. | ||
643 | */ | ||
644 | smp_mb(); | ||
631 | 645 | ||
632 | if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) || | 646 | if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) || |
633 | (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu))) | 647 | (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu))) |
diff --git a/lib/Kconfig b/lib/Kconfig index a5ce0c7f6c30..54cf309a92a5 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -51,6 +51,9 @@ config PERCPU_RWSEM | |||
51 | config ARCH_USE_CMPXCHG_LOCKREF | 51 | config ARCH_USE_CMPXCHG_LOCKREF |
52 | bool | 52 | bool |
53 | 53 | ||
54 | config ARCH_HAS_FAST_MULTIPLIER | ||
55 | bool | ||
56 | |||
54 | config CRC_CCITT | 57 | config CRC_CCITT |
55 | tristate "CRC-CCITT functions" | 58 | tristate "CRC-CCITT functions" |
56 | help | 59 | help |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 07c28323f88f..a28590083622 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -892,6 +892,10 @@ config DEBUG_WW_MUTEX_SLOWPATH | |||
892 | the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this | 892 | the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this |
893 | will test all possible w/w mutex interface abuse with the | 893 | will test all possible w/w mutex interface abuse with the |
894 | exception of simply not acquiring all the required locks. | 894 | exception of simply not acquiring all the required locks. |
895 | Note that this feature can introduce significant overhead, so | ||
896 | it really should not be enabled in a production or distro kernel, | ||
897 | even a debug kernel. If you are a driver writer, enable it. If | ||
898 | you are a distro, do not. | ||
895 | 899 | ||
896 | config DEBUG_LOCK_ALLOC | 900 | config DEBUG_LOCK_ALLOC |
897 | bool "Lock debugging: detect incorrect freeing of live locks" | 901 | bool "Lock debugging: detect incorrect freeing of live locks" |
@@ -1032,8 +1036,13 @@ config TRACE_IRQFLAGS | |||
1032 | either tracing or lock debugging. | 1036 | either tracing or lock debugging. |
1033 | 1037 | ||
1034 | config STACKTRACE | 1038 | config STACKTRACE |
1035 | bool | 1039 | bool "Stack backtrace support" |
1036 | depends on STACKTRACE_SUPPORT | 1040 | depends on STACKTRACE_SUPPORT |
1041 | help | ||
1042 | This option causes the kernel to create a /proc/pid/stack for | ||
1043 | every process, showing its current stack trace. | ||
1044 | It is also used by various kernel debugging features that require | ||
1045 | stack trace generation. | ||
1037 | 1046 | ||
1038 | config DEBUG_KOBJECT | 1047 | config DEBUG_KOBJECT |
1039 | bool "kobject debugging" | 1048 | bool "kobject debugging" |
diff --git a/lib/assoc_array.c b/lib/assoc_array.c index c0b1007011e1..2404d03e251a 100644 --- a/lib/assoc_array.c +++ b/lib/assoc_array.c | |||
@@ -1723,11 +1723,13 @@ ascend_old_tree: | |||
1723 | shortcut = assoc_array_ptr_to_shortcut(ptr); | 1723 | shortcut = assoc_array_ptr_to_shortcut(ptr); |
1724 | slot = shortcut->parent_slot; | 1724 | slot = shortcut->parent_slot; |
1725 | cursor = shortcut->back_pointer; | 1725 | cursor = shortcut->back_pointer; |
1726 | if (!cursor) | ||
1727 | goto gc_complete; | ||
1726 | } else { | 1728 | } else { |
1727 | slot = node->parent_slot; | 1729 | slot = node->parent_slot; |
1728 | cursor = ptr; | 1730 | cursor = ptr; |
1729 | } | 1731 | } |
1730 | BUG_ON(!ptr); | 1732 | BUG_ON(!cursor); |
1731 | node = assoc_array_ptr_to_node(cursor); | 1733 | node = assoc_array_ptr_to_node(cursor); |
1732 | slot++; | 1734 | slot++; |
1733 | goto continue_node; | 1735 | goto continue_node; |
@@ -1735,7 +1737,7 @@ ascend_old_tree: | |||
1735 | gc_complete: | 1737 | gc_complete: |
1736 | edit->set[0].to = new_root; | 1738 | edit->set[0].to = new_root; |
1737 | assoc_array_apply_edit(edit); | 1739 | assoc_array_apply_edit(edit); |
1738 | edit->array->nr_leaves_on_tree = nr_leaves_on_tree; | 1740 | array->nr_leaves_on_tree = nr_leaves_on_tree; |
1739 | return 0; | 1741 | return 0; |
1740 | 1742 | ||
1741 | enomem: | 1743 | enomem: |
diff --git a/lib/genalloc.c b/lib/genalloc.c index bdb9a456bcbb..38d2db82228c 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
@@ -588,6 +588,7 @@ struct gen_pool *of_get_named_gen_pool(struct device_node *np, | |||
588 | if (!np_pool) | 588 | if (!np_pool) |
589 | return NULL; | 589 | return NULL; |
590 | pdev = of_find_device_by_node(np_pool); | 590 | pdev = of_find_device_by_node(np_pool); |
591 | of_node_put(np_pool); | ||
591 | if (!pdev) | 592 | if (!pdev) |
592 | return NULL; | 593 | return NULL; |
593 | return dev_get_gen_pool(&pdev->dev); | 594 | return dev_get_gen_pool(&pdev->dev); |
diff --git a/lib/hweight.c b/lib/hweight.c index b7d81ba143d1..9a5c1f221558 100644 --- a/lib/hweight.c +++ b/lib/hweight.c | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | unsigned int __sw_hweight32(unsigned int w) | 12 | unsigned int __sw_hweight32(unsigned int w) |
13 | { | 13 | { |
14 | #ifdef ARCH_HAS_FAST_MULTIPLIER | 14 | #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER |
15 | w -= (w >> 1) & 0x55555555; | 15 | w -= (w >> 1) & 0x55555555; |
16 | w = (w & 0x33333333) + ((w >> 2) & 0x33333333); | 16 | w = (w & 0x33333333) + ((w >> 2) & 0x33333333); |
17 | w = (w + (w >> 4)) & 0x0f0f0f0f; | 17 | w = (w + (w >> 4)) & 0x0f0f0f0f; |
@@ -49,7 +49,7 @@ unsigned long __sw_hweight64(__u64 w) | |||
49 | return __sw_hweight32((unsigned int)(w >> 32)) + | 49 | return __sw_hweight32((unsigned int)(w >> 32)) + |
50 | __sw_hweight32((unsigned int)w); | 50 | __sw_hweight32((unsigned int)w); |
51 | #elif BITS_PER_LONG == 64 | 51 | #elif BITS_PER_LONG == 64 |
52 | #ifdef ARCH_HAS_FAST_MULTIPLIER | 52 | #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER |
53 | w -= (w >> 1) & 0x5555555555555555ul; | 53 | w -= (w >> 1) & 0x5555555555555555ul; |
54 | w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); | 54 | w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); |
55 | w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; | 55 | w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; |
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index fe5a3342e960..a89cf09a8268 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c | |||
@@ -184,3 +184,19 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref, | |||
184 | call_rcu_sched(&ref->rcu, percpu_ref_kill_rcu); | 184 | call_rcu_sched(&ref->rcu, percpu_ref_kill_rcu); |
185 | } | 185 | } |
186 | EXPORT_SYMBOL_GPL(percpu_ref_kill_and_confirm); | 186 | EXPORT_SYMBOL_GPL(percpu_ref_kill_and_confirm); |
187 | |||
188 | /* | ||
189 | * XXX: Temporary kludge to work around SCSI blk-mq stall. Used only by | ||
190 | * block/blk-mq.c::blk_mq_freeze_queue(). Will be removed during v3.18 | ||
191 | * devel cycle. Do not use anywhere else. | ||
192 | */ | ||
193 | void __percpu_ref_kill_expedited(struct percpu_ref *ref) | ||
194 | { | ||
195 | WARN_ONCE(ref->pcpu_count_ptr & PCPU_REF_DEAD, | ||
196 | "percpu_ref_kill() called more than once on %pf!", | ||
197 | ref->release); | ||
198 | |||
199 | ref->pcpu_count_ptr |= PCPU_REF_DEAD; | ||
200 | synchronize_sched_expedited(); | ||
201 | percpu_ref_kill_rcu(&ref->rcu); | ||
202 | } | ||
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index a2c78810ebc1..7b36e4d40ed7 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/hash.h> | 23 | #include <linux/hash.h> |
24 | #include <linux/random.h> | 24 | #include <linux/random.h> |
25 | #include <linux/rhashtable.h> | 25 | #include <linux/rhashtable.h> |
26 | #include <linux/log2.h> | ||
27 | 26 | ||
28 | #define HASH_DEFAULT_SIZE 64UL | 27 | #define HASH_DEFAULT_SIZE 64UL |
29 | #define HASH_MIN_SIZE 4UL | 28 | #define HASH_MIN_SIZE 4UL |
diff --git a/lib/string.c b/lib/string.c index 992bf30af759..f3c6ff596414 100644 --- a/lib/string.c +++ b/lib/string.c | |||
@@ -807,9 +807,9 @@ void *memchr_inv(const void *start, int c, size_t bytes) | |||
807 | return check_bytes8(start, value, bytes); | 807 | return check_bytes8(start, value, bytes); |
808 | 808 | ||
809 | value64 = value; | 809 | value64 = value; |
810 | #if defined(ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 | 810 | #if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 |
811 | value64 *= 0x0101010101010101; | 811 | value64 *= 0x0101010101010101; |
812 | #elif defined(ARCH_HAS_FAST_MULTIPLIER) | 812 | #elif defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) |
813 | value64 *= 0x01010101; | 813 | value64 *= 0x01010101; |
814 | value64 |= value64 << 32; | 814 | value64 |= value64 << 32; |
815 | #else | 815 | #else |
diff --git a/mm/dmapool.c b/mm/dmapool.c index 306baa594f95..ba8019b063e1 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c | |||
@@ -176,7 +176,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev, | |||
176 | if (list_empty(&dev->dma_pools) && | 176 | if (list_empty(&dev->dma_pools) && |
177 | device_create_file(dev, &dev_attr_pools)) { | 177 | device_create_file(dev, &dev_attr_pools)) { |
178 | kfree(retval); | 178 | kfree(retval); |
179 | return NULL; | 179 | retval = NULL; |
180 | } else | 180 | } else |
181 | list_add(&retval->pools, &dev->dma_pools); | 181 | list_add(&retval->pools, &dev->dma_pools); |
182 | mutex_unlock(&pools_lock); | 182 | mutex_unlock(&pools_lock); |
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 9eebfadeeee1..a67c26e0f360 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c | |||
@@ -217,7 +217,7 @@ void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, | |||
217 | 217 | ||
218 | if (hugetlb_cgroup_disabled()) | 218 | if (hugetlb_cgroup_disabled()) |
219 | return; | 219 | return; |
220 | VM_BUG_ON(!spin_is_locked(&hugetlb_lock)); | 220 | lockdep_assert_held(&hugetlb_lock); |
221 | h_cg = hugetlb_cgroup_from_page(page); | 221 | h_cg = hugetlb_cgroup_from_page(page); |
222 | if (unlikely(!h_cg)) | 222 | if (unlikely(!h_cg)) |
223 | return; | 223 | return; |
diff --git a/mm/iov_iter.c b/mm/iov_iter.c index ab88dc0ea1d3..9a09f2034fcc 100644 --- a/mm/iov_iter.c +++ b/mm/iov_iter.c | |||
@@ -310,7 +310,7 @@ void iov_iter_init(struct iov_iter *i, int direction, | |||
310 | EXPORT_SYMBOL(iov_iter_init); | 310 | EXPORT_SYMBOL(iov_iter_init); |
311 | 311 | ||
312 | static ssize_t get_pages_iovec(struct iov_iter *i, | 312 | static ssize_t get_pages_iovec(struct iov_iter *i, |
313 | struct page **pages, unsigned maxpages, | 313 | struct page **pages, size_t maxsize, unsigned maxpages, |
314 | size_t *start) | 314 | size_t *start) |
315 | { | 315 | { |
316 | size_t offset = i->iov_offset; | 316 | size_t offset = i->iov_offset; |
@@ -323,6 +323,8 @@ static ssize_t get_pages_iovec(struct iov_iter *i, | |||
323 | len = iov->iov_len - offset; | 323 | len = iov->iov_len - offset; |
324 | if (len > i->count) | 324 | if (len > i->count) |
325 | len = i->count; | 325 | len = i->count; |
326 | if (len > maxsize) | ||
327 | len = maxsize; | ||
326 | addr = (unsigned long)iov->iov_base + offset; | 328 | addr = (unsigned long)iov->iov_base + offset; |
327 | len += *start = addr & (PAGE_SIZE - 1); | 329 | len += *start = addr & (PAGE_SIZE - 1); |
328 | if (len > maxpages * PAGE_SIZE) | 330 | if (len > maxpages * PAGE_SIZE) |
@@ -588,13 +590,15 @@ static unsigned long alignment_bvec(const struct iov_iter *i) | |||
588 | } | 590 | } |
589 | 591 | ||
590 | static ssize_t get_pages_bvec(struct iov_iter *i, | 592 | static ssize_t get_pages_bvec(struct iov_iter *i, |
591 | struct page **pages, unsigned maxpages, | 593 | struct page **pages, size_t maxsize, unsigned maxpages, |
592 | size_t *start) | 594 | size_t *start) |
593 | { | 595 | { |
594 | const struct bio_vec *bvec = i->bvec; | 596 | const struct bio_vec *bvec = i->bvec; |
595 | size_t len = bvec->bv_len - i->iov_offset; | 597 | size_t len = bvec->bv_len - i->iov_offset; |
596 | if (len > i->count) | 598 | if (len > i->count) |
597 | len = i->count; | 599 | len = i->count; |
600 | if (len > maxsize) | ||
601 | len = maxsize; | ||
598 | /* can't be more than PAGE_SIZE */ | 602 | /* can't be more than PAGE_SIZE */ |
599 | *start = bvec->bv_offset + i->iov_offset; | 603 | *start = bvec->bv_offset + i->iov_offset; |
600 | 604 | ||
@@ -711,13 +715,13 @@ unsigned long iov_iter_alignment(const struct iov_iter *i) | |||
711 | EXPORT_SYMBOL(iov_iter_alignment); | 715 | EXPORT_SYMBOL(iov_iter_alignment); |
712 | 716 | ||
713 | ssize_t iov_iter_get_pages(struct iov_iter *i, | 717 | ssize_t iov_iter_get_pages(struct iov_iter *i, |
714 | struct page **pages, unsigned maxpages, | 718 | struct page **pages, size_t maxsize, unsigned maxpages, |
715 | size_t *start) | 719 | size_t *start) |
716 | { | 720 | { |
717 | if (i->type & ITER_BVEC) | 721 | if (i->type & ITER_BVEC) |
718 | return get_pages_bvec(i, pages, maxpages, start); | 722 | return get_pages_bvec(i, pages, maxsize, maxpages, start); |
719 | else | 723 | else |
720 | return get_pages_iovec(i, pages, maxpages, start); | 724 | return get_pages_iovec(i, pages, maxsize, maxpages, start); |
721 | } | 725 | } |
722 | EXPORT_SYMBOL(iov_iter_get_pages); | 726 | EXPORT_SYMBOL(iov_iter_get_pages); |
723 | 727 | ||
diff --git a/mm/memblock.c b/mm/memblock.c index 6d2f219a48b0..6ecb0d937fb5 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -192,8 +192,7 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size, | |||
192 | phys_addr_t align, phys_addr_t start, | 192 | phys_addr_t align, phys_addr_t start, |
193 | phys_addr_t end, int nid) | 193 | phys_addr_t end, int nid) |
194 | { | 194 | { |
195 | int ret; | 195 | phys_addr_t kernel_end, ret; |
196 | phys_addr_t kernel_end; | ||
197 | 196 | ||
198 | /* pump up @end */ | 197 | /* pump up @end */ |
199 | if (end == MEMBLOCK_ALLOC_ACCESSIBLE) | 198 | if (end == MEMBLOCK_ALLOC_ACCESSIBLE) |
@@ -817,6 +816,10 @@ void __init_memblock __next_mem_range(u64 *idx, int nid, | |||
817 | if (nid != NUMA_NO_NODE && nid != m_nid) | 816 | if (nid != NUMA_NO_NODE && nid != m_nid) |
818 | continue; | 817 | continue; |
819 | 818 | ||
819 | /* skip hotpluggable memory regions if needed */ | ||
820 | if (movable_node_is_enabled() && memblock_is_hotpluggable(m)) | ||
821 | continue; | ||
822 | |||
820 | if (!type_b) { | 823 | if (!type_b) { |
821 | if (out_start) | 824 | if (out_start) |
822 | *out_start = m_start; | 825 | *out_start = m_start; |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ec4dcf1b9562..085dc6d2f876 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2534,6 +2534,8 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, | |||
2534 | unsigned long long size; | 2534 | unsigned long long size; |
2535 | int ret = 0; | 2535 | int ret = 0; |
2536 | 2536 | ||
2537 | if (mem_cgroup_is_root(memcg)) | ||
2538 | goto done; | ||
2537 | retry: | 2539 | retry: |
2538 | if (consume_stock(memcg, nr_pages)) | 2540 | if (consume_stock(memcg, nr_pages)) |
2539 | goto done; | 2541 | goto done; |
@@ -2611,9 +2613,7 @@ nomem: | |||
2611 | if (!(gfp_mask & __GFP_NOFAIL)) | 2613 | if (!(gfp_mask & __GFP_NOFAIL)) |
2612 | return -ENOMEM; | 2614 | return -ENOMEM; |
2613 | bypass: | 2615 | bypass: |
2614 | memcg = root_mem_cgroup; | 2616 | return -EINTR; |
2615 | ret = -EINTR; | ||
2616 | goto retry; | ||
2617 | 2617 | ||
2618 | done_restock: | 2618 | done_restock: |
2619 | if (batch > nr_pages) | 2619 | if (batch > nr_pages) |
@@ -2626,6 +2626,9 @@ static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages) | |||
2626 | { | 2626 | { |
2627 | unsigned long bytes = nr_pages * PAGE_SIZE; | 2627 | unsigned long bytes = nr_pages * PAGE_SIZE; |
2628 | 2628 | ||
2629 | if (mem_cgroup_is_root(memcg)) | ||
2630 | return; | ||
2631 | |||
2629 | res_counter_uncharge(&memcg->res, bytes); | 2632 | res_counter_uncharge(&memcg->res, bytes); |
2630 | if (do_swap_account) | 2633 | if (do_swap_account) |
2631 | res_counter_uncharge(&memcg->memsw, bytes); | 2634 | res_counter_uncharge(&memcg->memsw, bytes); |
@@ -2640,6 +2643,9 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg, | |||
2640 | { | 2643 | { |
2641 | unsigned long bytes = nr_pages * PAGE_SIZE; | 2644 | unsigned long bytes = nr_pages * PAGE_SIZE; |
2642 | 2645 | ||
2646 | if (mem_cgroup_is_root(memcg)) | ||
2647 | return; | ||
2648 | |||
2643 | res_counter_uncharge_until(&memcg->res, memcg->res.parent, bytes); | 2649 | res_counter_uncharge_until(&memcg->res, memcg->res.parent, bytes); |
2644 | if (do_swap_account) | 2650 | if (do_swap_account) |
2645 | res_counter_uncharge_until(&memcg->memsw, | 2651 | res_counter_uncharge_until(&memcg->memsw, |
@@ -4093,6 +4099,46 @@ out: | |||
4093 | return retval; | 4099 | return retval; |
4094 | } | 4100 | } |
4095 | 4101 | ||
4102 | static unsigned long mem_cgroup_recursive_stat(struct mem_cgroup *memcg, | ||
4103 | enum mem_cgroup_stat_index idx) | ||
4104 | { | ||
4105 | struct mem_cgroup *iter; | ||
4106 | long val = 0; | ||
4107 | |||
4108 | /* Per-cpu values can be negative, use a signed accumulator */ | ||
4109 | for_each_mem_cgroup_tree(iter, memcg) | ||
4110 | val += mem_cgroup_read_stat(iter, idx); | ||
4111 | |||
4112 | if (val < 0) /* race ? */ | ||
4113 | val = 0; | ||
4114 | return val; | ||
4115 | } | ||
4116 | |||
4117 | static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap) | ||
4118 | { | ||
4119 | u64 val; | ||
4120 | |||
4121 | if (!mem_cgroup_is_root(memcg)) { | ||
4122 | if (!swap) | ||
4123 | return res_counter_read_u64(&memcg->res, RES_USAGE); | ||
4124 | else | ||
4125 | return res_counter_read_u64(&memcg->memsw, RES_USAGE); | ||
4126 | } | ||
4127 | |||
4128 | /* | ||
4129 | * Transparent hugepages are still accounted for in MEM_CGROUP_STAT_RSS | ||
4130 | * as well as in MEM_CGROUP_STAT_RSS_HUGE. | ||
4131 | */ | ||
4132 | val = mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_CACHE); | ||
4133 | val += mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_RSS); | ||
4134 | |||
4135 | if (swap) | ||
4136 | val += mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_SWAP); | ||
4137 | |||
4138 | return val << PAGE_SHIFT; | ||
4139 | } | ||
4140 | |||
4141 | |||
4096 | static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css, | 4142 | static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css, |
4097 | struct cftype *cft) | 4143 | struct cftype *cft) |
4098 | { | 4144 | { |
@@ -4102,8 +4148,12 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css, | |||
4102 | 4148 | ||
4103 | switch (type) { | 4149 | switch (type) { |
4104 | case _MEM: | 4150 | case _MEM: |
4151 | if (name == RES_USAGE) | ||
4152 | return mem_cgroup_usage(memcg, false); | ||
4105 | return res_counter_read_u64(&memcg->res, name); | 4153 | return res_counter_read_u64(&memcg->res, name); |
4106 | case _MEMSWAP: | 4154 | case _MEMSWAP: |
4155 | if (name == RES_USAGE) | ||
4156 | return mem_cgroup_usage(memcg, true); | ||
4107 | return res_counter_read_u64(&memcg->memsw, name); | 4157 | return res_counter_read_u64(&memcg->memsw, name); |
4108 | case _KMEM: | 4158 | case _KMEM: |
4109 | return res_counter_read_u64(&memcg->kmem, name); | 4159 | return res_counter_read_u64(&memcg->kmem, name); |
@@ -4572,10 +4622,7 @@ static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap) | |||
4572 | if (!t) | 4622 | if (!t) |
4573 | goto unlock; | 4623 | goto unlock; |
4574 | 4624 | ||
4575 | if (!swap) | 4625 | usage = mem_cgroup_usage(memcg, swap); |
4576 | usage = res_counter_read_u64(&memcg->res, RES_USAGE); | ||
4577 | else | ||
4578 | usage = res_counter_read_u64(&memcg->memsw, RES_USAGE); | ||
4579 | 4626 | ||
4580 | /* | 4627 | /* |
4581 | * current_threshold points to threshold just below or equal to usage. | 4628 | * current_threshold points to threshold just below or equal to usage. |
@@ -4673,10 +4720,10 @@ static int __mem_cgroup_usage_register_event(struct mem_cgroup *memcg, | |||
4673 | 4720 | ||
4674 | if (type == _MEM) { | 4721 | if (type == _MEM) { |
4675 | thresholds = &memcg->thresholds; | 4722 | thresholds = &memcg->thresholds; |
4676 | usage = res_counter_read_u64(&memcg->res, RES_USAGE); | 4723 | usage = mem_cgroup_usage(memcg, false); |
4677 | } else if (type == _MEMSWAP) { | 4724 | } else if (type == _MEMSWAP) { |
4678 | thresholds = &memcg->memsw_thresholds; | 4725 | thresholds = &memcg->memsw_thresholds; |
4679 | usage = res_counter_read_u64(&memcg->memsw, RES_USAGE); | 4726 | usage = mem_cgroup_usage(memcg, true); |
4680 | } else | 4727 | } else |
4681 | BUG(); | 4728 | BUG(); |
4682 | 4729 | ||
@@ -4762,10 +4809,10 @@ static void __mem_cgroup_usage_unregister_event(struct mem_cgroup *memcg, | |||
4762 | 4809 | ||
4763 | if (type == _MEM) { | 4810 | if (type == _MEM) { |
4764 | thresholds = &memcg->thresholds; | 4811 | thresholds = &memcg->thresholds; |
4765 | usage = res_counter_read_u64(&memcg->res, RES_USAGE); | 4812 | usage = mem_cgroup_usage(memcg, false); |
4766 | } else if (type == _MEMSWAP) { | 4813 | } else if (type == _MEMSWAP) { |
4767 | thresholds = &memcg->memsw_thresholds; | 4814 | thresholds = &memcg->memsw_thresholds; |
4768 | usage = res_counter_read_u64(&memcg->memsw, RES_USAGE); | 4815 | usage = mem_cgroup_usage(memcg, true); |
4769 | } else | 4816 | } else |
4770 | BUG(); | 4817 | BUG(); |
4771 | 4818 | ||
@@ -5525,9 +5572,9 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css) | |||
5525 | * core guarantees its existence. | 5572 | * core guarantees its existence. |
5526 | */ | 5573 | */ |
5527 | } else { | 5574 | } else { |
5528 | res_counter_init(&memcg->res, &root_mem_cgroup->res); | 5575 | res_counter_init(&memcg->res, NULL); |
5529 | res_counter_init(&memcg->memsw, &root_mem_cgroup->memsw); | 5576 | res_counter_init(&memcg->memsw, NULL); |
5530 | res_counter_init(&memcg->kmem, &root_mem_cgroup->kmem); | 5577 | res_counter_init(&memcg->kmem, NULL); |
5531 | /* | 5578 | /* |
5532 | * Deeper hierachy with use_hierarchy == false doesn't make | 5579 | * Deeper hierachy with use_hierarchy == false doesn't make |
5533 | * much sense so let cgroup subsystem know about this | 5580 | * much sense so let cgroup subsystem know about this |
@@ -5969,8 +6016,9 @@ static void __mem_cgroup_clear_mc(void) | |||
5969 | /* we must fixup refcnts and charges */ | 6016 | /* we must fixup refcnts and charges */ |
5970 | if (mc.moved_swap) { | 6017 | if (mc.moved_swap) { |
5971 | /* uncharge swap account from the old cgroup */ | 6018 | /* uncharge swap account from the old cgroup */ |
5972 | res_counter_uncharge(&mc.from->memsw, | 6019 | if (!mem_cgroup_is_root(mc.from)) |
5973 | PAGE_SIZE * mc.moved_swap); | 6020 | res_counter_uncharge(&mc.from->memsw, |
6021 | PAGE_SIZE * mc.moved_swap); | ||
5974 | 6022 | ||
5975 | for (i = 0; i < mc.moved_swap; i++) | 6023 | for (i = 0; i < mc.moved_swap; i++) |
5976 | css_put(&mc.from->css); | 6024 | css_put(&mc.from->css); |
@@ -5979,8 +6027,9 @@ static void __mem_cgroup_clear_mc(void) | |||
5979 | * we charged both to->res and to->memsw, so we should | 6027 | * we charged both to->res and to->memsw, so we should |
5980 | * uncharge to->res. | 6028 | * uncharge to->res. |
5981 | */ | 6029 | */ |
5982 | res_counter_uncharge(&mc.to->res, | 6030 | if (!mem_cgroup_is_root(mc.to)) |
5983 | PAGE_SIZE * mc.moved_swap); | 6031 | res_counter_uncharge(&mc.to->res, |
6032 | PAGE_SIZE * mc.moved_swap); | ||
5984 | /* we've already done css_get(mc.to) */ | 6033 | /* we've already done css_get(mc.to) */ |
5985 | mc.moved_swap = 0; | 6034 | mc.moved_swap = 0; |
5986 | } | 6035 | } |
@@ -6345,7 +6394,8 @@ void mem_cgroup_uncharge_swap(swp_entry_t entry) | |||
6345 | rcu_read_lock(); | 6394 | rcu_read_lock(); |
6346 | memcg = mem_cgroup_lookup(id); | 6395 | memcg = mem_cgroup_lookup(id); |
6347 | if (memcg) { | 6396 | if (memcg) { |
6348 | res_counter_uncharge(&memcg->memsw, PAGE_SIZE); | 6397 | if (!mem_cgroup_is_root(memcg)) |
6398 | res_counter_uncharge(&memcg->memsw, PAGE_SIZE); | ||
6349 | mem_cgroup_swap_statistics(memcg, false); | 6399 | mem_cgroup_swap_statistics(memcg, false); |
6350 | css_put(&memcg->css); | 6400 | css_put(&memcg->css); |
6351 | } | 6401 | } |
@@ -6509,12 +6559,15 @@ static void uncharge_batch(struct mem_cgroup *memcg, unsigned long pgpgout, | |||
6509 | { | 6559 | { |
6510 | unsigned long flags; | 6560 | unsigned long flags; |
6511 | 6561 | ||
6512 | if (nr_mem) | 6562 | if (!mem_cgroup_is_root(memcg)) { |
6513 | res_counter_uncharge(&memcg->res, nr_mem * PAGE_SIZE); | 6563 | if (nr_mem) |
6514 | if (nr_memsw) | 6564 | res_counter_uncharge(&memcg->res, |
6515 | res_counter_uncharge(&memcg->memsw, nr_memsw * PAGE_SIZE); | 6565 | nr_mem * PAGE_SIZE); |
6516 | 6566 | if (nr_memsw) | |
6517 | memcg_oom_recover(memcg); | 6567 | res_counter_uncharge(&memcg->memsw, |
6568 | nr_memsw * PAGE_SIZE); | ||
6569 | memcg_oom_recover(memcg); | ||
6570 | } | ||
6518 | 6571 | ||
6519 | local_irq_save(flags); | 6572 | local_irq_save(flags); |
6520 | __this_cpu_sub(memcg->stat->count[MEM_CGROUP_STAT_RSS], nr_anon); | 6573 | __this_cpu_sub(memcg->stat->count[MEM_CGROUP_STAT_RSS], nr_anon); |
diff --git a/mm/memory.c b/mm/memory.c index ab3537bcfed2..e229970e4223 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -118,6 +118,8 @@ __setup("norandmaps", disable_randmaps); | |||
118 | unsigned long zero_pfn __read_mostly; | 118 | unsigned long zero_pfn __read_mostly; |
119 | unsigned long highest_memmap_pfn __read_mostly; | 119 | unsigned long highest_memmap_pfn __read_mostly; |
120 | 120 | ||
121 | EXPORT_SYMBOL(zero_pfn); | ||
122 | |||
121 | /* | 123 | /* |
122 | * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init() | 124 | * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init() |
123 | */ | 125 | */ |
@@ -751,7 +753,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | |||
751 | unsigned long pfn = pte_pfn(pte); | 753 | unsigned long pfn = pte_pfn(pte); |
752 | 754 | ||
753 | if (HAVE_PTE_SPECIAL) { | 755 | if (HAVE_PTE_SPECIAL) { |
754 | if (likely(!pte_special(pte) || pte_numa(pte))) | 756 | if (likely(!pte_special(pte))) |
755 | goto check_pfn; | 757 | goto check_pfn; |
756 | if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)) | 758 | if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)) |
757 | return NULL; | 759 | return NULL; |
@@ -777,15 +779,14 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | |||
777 | } | 779 | } |
778 | } | 780 | } |
779 | 781 | ||
782 | if (is_zero_pfn(pfn)) | ||
783 | return NULL; | ||
780 | check_pfn: | 784 | check_pfn: |
781 | if (unlikely(pfn > highest_memmap_pfn)) { | 785 | if (unlikely(pfn > highest_memmap_pfn)) { |
782 | print_bad_pte(vma, addr, pte, NULL); | 786 | print_bad_pte(vma, addr, pte, NULL); |
783 | return NULL; | 787 | return NULL; |
784 | } | 788 | } |
785 | 789 | ||
786 | if (is_zero_pfn(pfn)) | ||
787 | return NULL; | ||
788 | |||
789 | /* | 790 | /* |
790 | * NOTE! We still have PageReserved() pages in the page tables. | 791 | * NOTE! We still have PageReserved() pages in the page tables. |
791 | * eg. VDSO mappings can cause them to exist. | 792 | * eg. VDSO mappings can cause them to exist. |
@@ -1126,7 +1127,7 @@ again: | |||
1126 | addr) != page->index) { | 1127 | addr) != page->index) { |
1127 | pte_t ptfile = pgoff_to_pte(page->index); | 1128 | pte_t ptfile = pgoff_to_pte(page->index); |
1128 | if (pte_soft_dirty(ptent)) | 1129 | if (pte_soft_dirty(ptent)) |
1129 | pte_file_mksoft_dirty(ptfile); | 1130 | ptfile = pte_file_mksoft_dirty(ptfile); |
1130 | set_pte_at(mm, addr, pte, ptfile); | 1131 | set_pte_at(mm, addr, pte, ptfile); |
1131 | } | 1132 | } |
1132 | if (PageAnon(page)) | 1133 | if (PageAnon(page)) |
@@ -369,20 +369,20 @@ static int browse_rb(struct rb_root *root) | |||
369 | struct vm_area_struct *vma; | 369 | struct vm_area_struct *vma; |
370 | vma = rb_entry(nd, struct vm_area_struct, vm_rb); | 370 | vma = rb_entry(nd, struct vm_area_struct, vm_rb); |
371 | if (vma->vm_start < prev) { | 371 | if (vma->vm_start < prev) { |
372 | pr_info("vm_start %lx prev %lx\n", vma->vm_start, prev); | 372 | pr_emerg("vm_start %lx prev %lx\n", vma->vm_start, prev); |
373 | bug = 1; | 373 | bug = 1; |
374 | } | 374 | } |
375 | if (vma->vm_start < pend) { | 375 | if (vma->vm_start < pend) { |
376 | pr_info("vm_start %lx pend %lx\n", vma->vm_start, pend); | 376 | pr_emerg("vm_start %lx pend %lx\n", vma->vm_start, pend); |
377 | bug = 1; | 377 | bug = 1; |
378 | } | 378 | } |
379 | if (vma->vm_start > vma->vm_end) { | 379 | if (vma->vm_start > vma->vm_end) { |
380 | pr_info("vm_end %lx < vm_start %lx\n", | 380 | pr_emerg("vm_end %lx < vm_start %lx\n", |
381 | vma->vm_end, vma->vm_start); | 381 | vma->vm_end, vma->vm_start); |
382 | bug = 1; | 382 | bug = 1; |
383 | } | 383 | } |
384 | if (vma->rb_subtree_gap != vma_compute_subtree_gap(vma)) { | 384 | if (vma->rb_subtree_gap != vma_compute_subtree_gap(vma)) { |
385 | pr_info("free gap %lx, correct %lx\n", | 385 | pr_emerg("free gap %lx, correct %lx\n", |
386 | vma->rb_subtree_gap, | 386 | vma->rb_subtree_gap, |
387 | vma_compute_subtree_gap(vma)); | 387 | vma_compute_subtree_gap(vma)); |
388 | bug = 1; | 388 | bug = 1; |
@@ -396,7 +396,7 @@ static int browse_rb(struct rb_root *root) | |||
396 | for (nd = pn; nd; nd = rb_prev(nd)) | 396 | for (nd = pn; nd; nd = rb_prev(nd)) |
397 | j++; | 397 | j++; |
398 | if (i != j) { | 398 | if (i != j) { |
399 | pr_info("backwards %d, forwards %d\n", j, i); | 399 | pr_emerg("backwards %d, forwards %d\n", j, i); |
400 | bug = 1; | 400 | bug = 1; |
401 | } | 401 | } |
402 | return bug ? -1 : i; | 402 | return bug ? -1 : i; |
@@ -431,17 +431,17 @@ static void validate_mm(struct mm_struct *mm) | |||
431 | i++; | 431 | i++; |
432 | } | 432 | } |
433 | if (i != mm->map_count) { | 433 | if (i != mm->map_count) { |
434 | pr_info("map_count %d vm_next %d\n", mm->map_count, i); | 434 | pr_emerg("map_count %d vm_next %d\n", mm->map_count, i); |
435 | bug = 1; | 435 | bug = 1; |
436 | } | 436 | } |
437 | if (highest_address != mm->highest_vm_end) { | 437 | if (highest_address != mm->highest_vm_end) { |
438 | pr_info("mm->highest_vm_end %lx, found %lx\n", | 438 | pr_emerg("mm->highest_vm_end %lx, found %lx\n", |
439 | mm->highest_vm_end, highest_address); | 439 | mm->highest_vm_end, highest_address); |
440 | bug = 1; | 440 | bug = 1; |
441 | } | 441 | } |
442 | i = browse_rb(&mm->mm_rb); | 442 | i = browse_rb(&mm->mm_rb); |
443 | if (i != mm->map_count) { | 443 | if (i != mm->map_count) { |
444 | pr_info("map_count %d rb %d\n", mm->map_count, i); | 444 | pr_emerg("map_count %d rb %d\n", mm->map_count, i); |
445 | bug = 1; | 445 | bug = 1; |
446 | } | 446 | } |
447 | BUG_ON(bug); | 447 | BUG_ON(bug); |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 7ed58602e71b..7c7ab32ee503 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -119,6 +119,8 @@ static unsigned long __init free_low_memory_core_early(void) | |||
119 | phys_addr_t start, end; | 119 | phys_addr_t start, end; |
120 | u64 i; | 120 | u64 i; |
121 | 121 | ||
122 | memblock_clear_hotplug(0, -1); | ||
123 | |||
122 | for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL) | 124 | for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL) |
123 | count += __free_memory_core(start, end); | 125 | count += __free_memory_core(start, end); |
124 | 126 | ||
diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c index 3707c71ae4cd..51108165f829 100644 --- a/mm/percpu-vm.c +++ b/mm/percpu-vm.c | |||
@@ -108,7 +108,7 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk, | |||
108 | int page_start, int page_end) | 108 | int page_start, int page_end) |
109 | { | 109 | { |
110 | const gfp_t gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_COLD; | 110 | const gfp_t gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_COLD; |
111 | unsigned int cpu; | 111 | unsigned int cpu, tcpu; |
112 | int i; | 112 | int i; |
113 | 113 | ||
114 | for_each_possible_cpu(cpu) { | 114 | for_each_possible_cpu(cpu) { |
@@ -116,14 +116,23 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk, | |||
116 | struct page **pagep = &pages[pcpu_page_idx(cpu, i)]; | 116 | struct page **pagep = &pages[pcpu_page_idx(cpu, i)]; |
117 | 117 | ||
118 | *pagep = alloc_pages_node(cpu_to_node(cpu), gfp, 0); | 118 | *pagep = alloc_pages_node(cpu_to_node(cpu), gfp, 0); |
119 | if (!*pagep) { | 119 | if (!*pagep) |
120 | pcpu_free_pages(chunk, pages, populated, | 120 | goto err; |
121 | page_start, page_end); | ||
122 | return -ENOMEM; | ||
123 | } | ||
124 | } | 121 | } |
125 | } | 122 | } |
126 | return 0; | 123 | return 0; |
124 | |||
125 | err: | ||
126 | while (--i >= page_start) | ||
127 | __free_page(pages[pcpu_page_idx(cpu, i)]); | ||
128 | |||
129 | for_each_possible_cpu(tcpu) { | ||
130 | if (tcpu == cpu) | ||
131 | break; | ||
132 | for (i = page_start; i < page_end; i++) | ||
133 | __free_page(pages[pcpu_page_idx(tcpu, i)]); | ||
134 | } | ||
135 | return -ENOMEM; | ||
127 | } | 136 | } |
128 | 137 | ||
129 | /** | 138 | /** |
@@ -263,6 +272,7 @@ err: | |||
263 | __pcpu_unmap_pages(pcpu_chunk_addr(chunk, tcpu, page_start), | 272 | __pcpu_unmap_pages(pcpu_chunk_addr(chunk, tcpu, page_start), |
264 | page_end - page_start); | 273 | page_end - page_start); |
265 | } | 274 | } |
275 | pcpu_post_unmap_tlb_flush(chunk, page_start, page_end); | ||
266 | return err; | 276 | return err; |
267 | } | 277 | } |
268 | 278 | ||
diff --git a/mm/percpu.c b/mm/percpu.c index 2139e30a4b44..da997f9800bd 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -1932,6 +1932,8 @@ void __init setup_per_cpu_areas(void) | |||
1932 | 1932 | ||
1933 | if (pcpu_setup_first_chunk(ai, fc) < 0) | 1933 | if (pcpu_setup_first_chunk(ai, fc) < 0) |
1934 | panic("Failed to initialize percpu areas."); | 1934 | panic("Failed to initialize percpu areas."); |
1935 | |||
1936 | pcpu_free_alloc_info(ai); | ||
1935 | } | 1937 | } |
1936 | 1938 | ||
1937 | #endif /* CONFIG_SMP */ | 1939 | #endif /* CONFIG_SMP */ |
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index a8b919925934..dfb79e028ecb 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c | |||
@@ -195,7 +195,7 @@ void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, | |||
195 | pmd_t entry = *pmdp; | 195 | pmd_t entry = *pmdp; |
196 | if (pmd_numa(entry)) | 196 | if (pmd_numa(entry)) |
197 | entry = pmd_mknonnuma(entry); | 197 | entry = pmd_mknonnuma(entry); |
198 | set_pmd_at(vma->vm_mm, address, pmdp, pmd_mknotpresent(*pmdp)); | 198 | set_pmd_at(vma->vm_mm, address, pmdp, pmd_mknotpresent(entry)); |
199 | flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE); | 199 | flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE); |
200 | } | 200 | } |
201 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 201 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
diff --git a/mm/shmem.c b/mm/shmem.c index 0e5fb225007c..469f90d56051 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2367,8 +2367,10 @@ static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struc | |||
2367 | 2367 | ||
2368 | if (new_dentry->d_inode) { | 2368 | if (new_dentry->d_inode) { |
2369 | (void) shmem_unlink(new_dir, new_dentry); | 2369 | (void) shmem_unlink(new_dir, new_dentry); |
2370 | if (they_are_dirs) | 2370 | if (they_are_dirs) { |
2371 | drop_nlink(new_dentry->d_inode); | ||
2371 | drop_nlink(old_dir); | 2372 | drop_nlink(old_dir); |
2373 | } | ||
2372 | } else if (they_are_dirs) { | 2374 | } else if (they_are_dirs) { |
2373 | drop_nlink(old_dir); | 2375 | drop_nlink(old_dir); |
2374 | inc_nlink(new_dir); | 2376 | inc_nlink(new_dir); |
@@ -2124,7 +2124,8 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp) | |||
2124 | int | 2124 | int |
2125 | __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) | 2125 | __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) |
2126 | { | 2126 | { |
2127 | size_t left_over, freelist_size, ralign; | 2127 | size_t left_over, freelist_size; |
2128 | size_t ralign = BYTES_PER_WORD; | ||
2128 | gfp_t gfp; | 2129 | gfp_t gfp; |
2129 | int err; | 2130 | int err; |
2130 | size_t size = cachep->size; | 2131 | size_t size = cachep->size; |
@@ -2157,14 +2158,6 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) | |||
2157 | size &= ~(BYTES_PER_WORD - 1); | 2158 | size &= ~(BYTES_PER_WORD - 1); |
2158 | } | 2159 | } |
2159 | 2160 | ||
2160 | /* | ||
2161 | * Redzoning and user store require word alignment or possibly larger. | ||
2162 | * Note this will be overridden by architecture or caller mandated | ||
2163 | * alignment if either is greater than BYTES_PER_WORD. | ||
2164 | */ | ||
2165 | if (flags & SLAB_STORE_USER) | ||
2166 | ralign = BYTES_PER_WORD; | ||
2167 | |||
2168 | if (flags & SLAB_RED_ZONE) { | 2161 | if (flags & SLAB_RED_ZONE) { |
2169 | ralign = REDZONE_ALIGN; | 2162 | ralign = REDZONE_ALIGN; |
2170 | /* If redzoning, ensure that the second redzone is suitably | 2163 | /* If redzoning, ensure that the second redzone is suitably |
@@ -2994,7 +2987,7 @@ out: | |||
2994 | 2987 | ||
2995 | #ifdef CONFIG_NUMA | 2988 | #ifdef CONFIG_NUMA |
2996 | /* | 2989 | /* |
2997 | * Try allocating on another node if PF_SPREAD_SLAB is a mempolicy is set. | 2990 | * Try allocating on another node if PFA_SPREAD_SLAB is a mempolicy is set. |
2998 | * | 2991 | * |
2999 | * If we are in_interrupt, then process context, including cpusets and | 2992 | * If we are in_interrupt, then process context, including cpusets and |
3000 | * mempolicy, may not apply and should not be used for allocation policy. | 2993 | * mempolicy, may not apply and should not be used for allocation policy. |
@@ -3226,7 +3219,7 @@ __do_cache_alloc(struct kmem_cache *cache, gfp_t flags) | |||
3226 | { | 3219 | { |
3227 | void *objp; | 3220 | void *objp; |
3228 | 3221 | ||
3229 | if (current->mempolicy || unlikely(current->flags & PF_SPREAD_SLAB)) { | 3222 | if (current->mempolicy || cpuset_do_slab_mem_spread()) { |
3230 | objp = alternate_node_alloc(cache, flags); | 3223 | objp = alternate_node_alloc(cache, flags); |
3231 | if (objp) | 3224 | if (objp) |
3232 | goto out; | 3225 | goto out; |
@@ -195,6 +195,7 @@ static struct zpool_driver zbud_zpool_driver = { | |||
195 | .total_size = zbud_zpool_total_size, | 195 | .total_size = zbud_zpool_total_size, |
196 | }; | 196 | }; |
197 | 197 | ||
198 | MODULE_ALIAS("zpool-zbud"); | ||
198 | #endif /* CONFIG_ZPOOL */ | 199 | #endif /* CONFIG_ZPOOL */ |
199 | 200 | ||
200 | /***************** | 201 | /***************** |
diff --git a/mm/zpool.c b/mm/zpool.c index e40612a1df00..739cdf0d183a 100644 --- a/mm/zpool.c +++ b/mm/zpool.c | |||
@@ -150,7 +150,7 @@ struct zpool *zpool_create_pool(char *type, gfp_t gfp, struct zpool_ops *ops) | |||
150 | driver = zpool_get_driver(type); | 150 | driver = zpool_get_driver(type); |
151 | 151 | ||
152 | if (!driver) { | 152 | if (!driver) { |
153 | request_module(type); | 153 | request_module("zpool-%s", type); |
154 | driver = zpool_get_driver(type); | 154 | driver = zpool_get_driver(type); |
155 | } | 155 | } |
156 | 156 | ||
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 4e2fc83cb394..94f38fac5e81 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c | |||
@@ -315,6 +315,7 @@ static struct zpool_driver zs_zpool_driver = { | |||
315 | .total_size = zs_zpool_total_size, | 315 | .total_size = zs_zpool_total_size, |
316 | }; | 316 | }; |
317 | 317 | ||
318 | MODULE_ALIAS("zpool-zsmalloc"); | ||
318 | #endif /* CONFIG_ZPOOL */ | 319 | #endif /* CONFIG_ZPOOL */ |
319 | 320 | ||
320 | /* per-cpu VM mapping areas for zspage accesses that cross page boundaries */ | 321 | /* per-cpu VM mapping areas for zspage accesses that cross page boundaries */ |
diff --git a/net/atm/lec.c b/net/atm/lec.c index e4853b50cf40..4b98f897044a 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -410,9 +410,11 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) | |||
410 | priv->lane2_ops = NULL; | 410 | priv->lane2_ops = NULL; |
411 | if (priv->lane_version > 1) | 411 | if (priv->lane_version > 1) |
412 | priv->lane2_ops = &lane2_ops; | 412 | priv->lane2_ops = &lane2_ops; |
413 | rtnl_lock(); | ||
413 | if (dev_set_mtu(dev, mesg->content.config.mtu)) | 414 | if (dev_set_mtu(dev, mesg->content.config.mtu)) |
414 | pr_info("%s: change_mtu to %d failed\n", | 415 | pr_info("%s: change_mtu to %d failed\n", |
415 | dev->name, mesg->content.config.mtu); | 416 | dev->name, mesg->content.config.mtu); |
417 | rtnl_unlock(); | ||
416 | priv->is_proxy = mesg->content.config.is_proxy; | 418 | priv->is_proxy = mesg->content.config.is_proxy; |
417 | break; | 419 | break; |
418 | case l_flush_tran_id: | 420 | case l_flush_tran_id: |
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 52c43f904220..fc1835c6bb40 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c | |||
@@ -188,7 +188,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, | |||
188 | 188 | ||
189 | /* Reached the end of the list, so insert after 'frag_entry_last'. */ | 189 | /* Reached the end of the list, so insert after 'frag_entry_last'. */ |
190 | if (likely(frag_entry_last)) { | 190 | if (likely(frag_entry_last)) { |
191 | hlist_add_behind(&frag_entry_last->list, &frag_entry_new->list); | 191 | hlist_add_behind(&frag_entry_new->list, &frag_entry_last->list); |
192 | chain->size += skb->len - hdr_size; | 192 | chain->size += skb->len - hdr_size; |
193 | chain->timestamp = jiffies; | 193 | chain->timestamp = jiffies; |
194 | ret = true; | 194 | ret = true; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index b50dabb3f86a..faff6247ac8f 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -589,6 +589,14 @@ EXPORT_SYMBOL(hci_get_route); | |||
589 | void hci_le_conn_failed(struct hci_conn *conn, u8 status) | 589 | void hci_le_conn_failed(struct hci_conn *conn, u8 status) |
590 | { | 590 | { |
591 | struct hci_dev *hdev = conn->hdev; | 591 | struct hci_dev *hdev = conn->hdev; |
592 | struct hci_conn_params *params; | ||
593 | |||
594 | params = hci_pend_le_action_lookup(&hdev->pend_le_conns, &conn->dst, | ||
595 | conn->dst_type); | ||
596 | if (params && params->conn) { | ||
597 | hci_conn_drop(params->conn); | ||
598 | params->conn = NULL; | ||
599 | } | ||
592 | 600 | ||
593 | conn->state = BT_CLOSED; | 601 | conn->state = BT_CLOSED; |
594 | 602 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index c32d361c0cf7..1d9c29a00568 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2536,8 +2536,13 @@ static void hci_pend_le_actions_clear(struct hci_dev *hdev) | |||
2536 | { | 2536 | { |
2537 | struct hci_conn_params *p; | 2537 | struct hci_conn_params *p; |
2538 | 2538 | ||
2539 | list_for_each_entry(p, &hdev->le_conn_params, list) | 2539 | list_for_each_entry(p, &hdev->le_conn_params, list) { |
2540 | if (p->conn) { | ||
2541 | hci_conn_drop(p->conn); | ||
2542 | p->conn = NULL; | ||
2543 | } | ||
2540 | list_del_init(&p->action); | 2544 | list_del_init(&p->action); |
2545 | } | ||
2541 | 2546 | ||
2542 | BT_DBG("All LE pending actions cleared"); | 2547 | BT_DBG("All LE pending actions cleared"); |
2543 | } | 2548 | } |
@@ -2578,8 +2583,8 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
2578 | 2583 | ||
2579 | hci_dev_lock(hdev); | 2584 | hci_dev_lock(hdev); |
2580 | hci_inquiry_cache_flush(hdev); | 2585 | hci_inquiry_cache_flush(hdev); |
2581 | hci_conn_hash_flush(hdev); | ||
2582 | hci_pend_le_actions_clear(hdev); | 2586 | hci_pend_le_actions_clear(hdev); |
2587 | hci_conn_hash_flush(hdev); | ||
2583 | hci_dev_unlock(hdev); | 2588 | hci_dev_unlock(hdev); |
2584 | 2589 | ||
2585 | hci_notify(hdev, HCI_DEV_DOWN); | 2590 | hci_notify(hdev, HCI_DEV_DOWN); |
@@ -3727,6 +3732,9 @@ void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) | |||
3727 | if (!params) | 3732 | if (!params) |
3728 | return; | 3733 | return; |
3729 | 3734 | ||
3735 | if (params->conn) | ||
3736 | hci_conn_drop(params->conn); | ||
3737 | |||
3730 | list_del(¶ms->action); | 3738 | list_del(¶ms->action); |
3731 | list_del(¶ms->list); | 3739 | list_del(¶ms->list); |
3732 | kfree(params); | 3740 | kfree(params); |
@@ -3757,6 +3765,8 @@ void hci_conn_params_clear_all(struct hci_dev *hdev) | |||
3757 | struct hci_conn_params *params, *tmp; | 3765 | struct hci_conn_params *params, *tmp; |
3758 | 3766 | ||
3759 | list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) { | 3767 | list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) { |
3768 | if (params->conn) | ||
3769 | hci_conn_drop(params->conn); | ||
3760 | list_del(¶ms->action); | 3770 | list_del(¶ms->action); |
3761 | list_del(¶ms->list); | 3771 | list_del(¶ms->list); |
3762 | kfree(params); | 3772 | kfree(params); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index be35598984d9..a6000823f0ff 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -4221,8 +4221,13 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
4221 | hci_proto_connect_cfm(conn, ev->status); | 4221 | hci_proto_connect_cfm(conn, ev->status); |
4222 | 4222 | ||
4223 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); | 4223 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); |
4224 | if (params) | 4224 | if (params) { |
4225 | list_del_init(¶ms->action); | 4225 | list_del_init(¶ms->action); |
4226 | if (params->conn) { | ||
4227 | hci_conn_drop(params->conn); | ||
4228 | params->conn = NULL; | ||
4229 | } | ||
4230 | } | ||
4226 | 4231 | ||
4227 | unlock: | 4232 | unlock: |
4228 | hci_update_background_scan(hdev); | 4233 | hci_update_background_scan(hdev); |
@@ -4304,8 +4309,16 @@ static void check_pending_le_conn(struct hci_dev *hdev, bdaddr_t *addr, | |||
4304 | 4309 | ||
4305 | conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW, | 4310 | conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW, |
4306 | HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER); | 4311 | HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER); |
4307 | if (!IS_ERR(conn)) | 4312 | if (!IS_ERR(conn)) { |
4313 | /* Store the pointer since we don't really have any | ||
4314 | * other owner of the object besides the params that | ||
4315 | * triggered it. This way we can abort the connection if | ||
4316 | * the parameters get removed and keep the reference | ||
4317 | * count consistent once the connection is established. | ||
4318 | */ | ||
4319 | params->conn = conn; | ||
4308 | return; | 4320 | return; |
4321 | } | ||
4309 | 4322 | ||
4310 | switch (PTR_ERR(conn)) { | 4323 | switch (PTR_ERR(conn)) { |
4311 | case -EBUSY: | 4324 | case -EBUSY: |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 62a7fa2e3569..b6c04cbcfdc5 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -309,6 +309,9 @@ struct br_input_skb_cb { | |||
309 | int igmp; | 309 | int igmp; |
310 | int mrouters_only; | 310 | int mrouters_only; |
311 | #endif | 311 | #endif |
312 | #ifdef CONFIG_BRIDGE_VLAN_FILTERING | ||
313 | bool vlan_filtered; | ||
314 | #endif | ||
312 | }; | 315 | }; |
313 | 316 | ||
314 | #define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb) | 317 | #define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb) |
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index e1bcd653899b..3ba57fcdcd13 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c | |||
@@ -27,9 +27,13 @@ static void __vlan_add_flags(struct net_port_vlans *v, u16 vid, u16 flags) | |||
27 | { | 27 | { |
28 | if (flags & BRIDGE_VLAN_INFO_PVID) | 28 | if (flags & BRIDGE_VLAN_INFO_PVID) |
29 | __vlan_add_pvid(v, vid); | 29 | __vlan_add_pvid(v, vid); |
30 | else | ||
31 | __vlan_delete_pvid(v, vid); | ||
30 | 32 | ||
31 | if (flags & BRIDGE_VLAN_INFO_UNTAGGED) | 33 | if (flags & BRIDGE_VLAN_INFO_UNTAGGED) |
32 | set_bit(vid, v->untagged_bitmap); | 34 | set_bit(vid, v->untagged_bitmap); |
35 | else | ||
36 | clear_bit(vid, v->untagged_bitmap); | ||
33 | } | 37 | } |
34 | 38 | ||
35 | static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags) | 39 | static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags) |
@@ -125,7 +129,8 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br, | |||
125 | { | 129 | { |
126 | u16 vid; | 130 | u16 vid; |
127 | 131 | ||
128 | if (!br->vlan_enabled) | 132 | /* If this packet was not filtered at input, let it pass */ |
133 | if (!BR_INPUT_SKB_CB(skb)->vlan_filtered) | ||
129 | goto out; | 134 | goto out; |
130 | 135 | ||
131 | /* Vlan filter table must be configured at this point. The | 136 | /* Vlan filter table must be configured at this point. The |
@@ -164,8 +169,10 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, | |||
164 | /* If VLAN filtering is disabled on the bridge, all packets are | 169 | /* If VLAN filtering is disabled on the bridge, all packets are |
165 | * permitted. | 170 | * permitted. |
166 | */ | 171 | */ |
167 | if (!br->vlan_enabled) | 172 | if (!br->vlan_enabled) { |
173 | BR_INPUT_SKB_CB(skb)->vlan_filtered = false; | ||
168 | return true; | 174 | return true; |
175 | } | ||
169 | 176 | ||
170 | /* If there are no vlan in the permitted list, all packets are | 177 | /* If there are no vlan in the permitted list, all packets are |
171 | * rejected. | 178 | * rejected. |
@@ -173,6 +180,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, | |||
173 | if (!v) | 180 | if (!v) |
174 | goto drop; | 181 | goto drop; |
175 | 182 | ||
183 | BR_INPUT_SKB_CB(skb)->vlan_filtered = true; | ||
176 | proto = br->vlan_proto; | 184 | proto = br->vlan_proto; |
177 | 185 | ||
178 | /* If vlan tx offload is disabled on bridge device and frame was | 186 | /* If vlan tx offload is disabled on bridge device and frame was |
@@ -251,7 +259,8 @@ bool br_allowed_egress(struct net_bridge *br, | |||
251 | { | 259 | { |
252 | u16 vid; | 260 | u16 vid; |
253 | 261 | ||
254 | if (!br->vlan_enabled) | 262 | /* If this packet was not filtered at input, let it pass */ |
263 | if (!BR_INPUT_SKB_CB(skb)->vlan_filtered) | ||
255 | return true; | 264 | return true; |
256 | 265 | ||
257 | if (!v) | 266 | if (!v) |
@@ -270,6 +279,7 @@ bool br_should_learn(struct net_bridge_port *p, struct sk_buff *skb, u16 *vid) | |||
270 | struct net_bridge *br = p->br; | 279 | struct net_bridge *br = p->br; |
271 | struct net_port_vlans *v; | 280 | struct net_port_vlans *v; |
272 | 281 | ||
282 | /* If filtering was disabled at input, let it pass. */ | ||
273 | if (!br->vlan_enabled) | 283 | if (!br->vlan_enabled) |
274 | return true; | 284 | return true; |
275 | 285 | ||
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index 96238ba95f2b..de6662b14e1f 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c | |||
@@ -13,8 +13,6 @@ | |||
13 | #include "auth_x.h" | 13 | #include "auth_x.h" |
14 | #include "auth_x_protocol.h" | 14 | #include "auth_x_protocol.h" |
15 | 15 | ||
16 | #define TEMP_TICKET_BUF_LEN 256 | ||
17 | |||
18 | static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); | 16 | static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); |
19 | 17 | ||
20 | static int ceph_x_is_authenticated(struct ceph_auth_client *ac) | 18 | static int ceph_x_is_authenticated(struct ceph_auth_client *ac) |
@@ -64,7 +62,7 @@ static int ceph_x_encrypt(struct ceph_crypto_key *secret, | |||
64 | } | 62 | } |
65 | 63 | ||
66 | static int ceph_x_decrypt(struct ceph_crypto_key *secret, | 64 | static int ceph_x_decrypt(struct ceph_crypto_key *secret, |
67 | void **p, void *end, void *obuf, size_t olen) | 65 | void **p, void *end, void **obuf, size_t olen) |
68 | { | 66 | { |
69 | struct ceph_x_encrypt_header head; | 67 | struct ceph_x_encrypt_header head; |
70 | size_t head_len = sizeof(head); | 68 | size_t head_len = sizeof(head); |
@@ -75,8 +73,14 @@ static int ceph_x_decrypt(struct ceph_crypto_key *secret, | |||
75 | return -EINVAL; | 73 | return -EINVAL; |
76 | 74 | ||
77 | dout("ceph_x_decrypt len %d\n", len); | 75 | dout("ceph_x_decrypt len %d\n", len); |
78 | ret = ceph_decrypt2(secret, &head, &head_len, obuf, &olen, | 76 | if (*obuf == NULL) { |
79 | *p, len); | 77 | *obuf = kmalloc(len, GFP_NOFS); |
78 | if (!*obuf) | ||
79 | return -ENOMEM; | ||
80 | olen = len; | ||
81 | } | ||
82 | |||
83 | ret = ceph_decrypt2(secret, &head, &head_len, *obuf, &olen, *p, len); | ||
80 | if (ret) | 84 | if (ret) |
81 | return ret; | 85 | return ret; |
82 | if (head.struct_v != 1 || le64_to_cpu(head.magic) != CEPHX_ENC_MAGIC) | 86 | if (head.struct_v != 1 || le64_to_cpu(head.magic) != CEPHX_ENC_MAGIC) |
@@ -129,139 +133,120 @@ static void remove_ticket_handler(struct ceph_auth_client *ac, | |||
129 | kfree(th); | 133 | kfree(th); |
130 | } | 134 | } |
131 | 135 | ||
132 | static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | 136 | static int process_one_ticket(struct ceph_auth_client *ac, |
133 | struct ceph_crypto_key *secret, | 137 | struct ceph_crypto_key *secret, |
134 | void *buf, void *end) | 138 | void **p, void *end) |
135 | { | 139 | { |
136 | struct ceph_x_info *xi = ac->private; | 140 | struct ceph_x_info *xi = ac->private; |
137 | int num; | 141 | int type; |
138 | void *p = buf; | 142 | u8 tkt_struct_v, blob_struct_v; |
143 | struct ceph_x_ticket_handler *th; | ||
144 | void *dbuf = NULL; | ||
145 | void *dp, *dend; | ||
146 | int dlen; | ||
147 | char is_enc; | ||
148 | struct timespec validity; | ||
149 | struct ceph_crypto_key old_key; | ||
150 | void *ticket_buf = NULL; | ||
151 | void *tp, *tpend; | ||
152 | struct ceph_timespec new_validity; | ||
153 | struct ceph_crypto_key new_session_key; | ||
154 | struct ceph_buffer *new_ticket_blob; | ||
155 | unsigned long new_expires, new_renew_after; | ||
156 | u64 new_secret_id; | ||
139 | int ret; | 157 | int ret; |
140 | char *dbuf; | ||
141 | char *ticket_buf; | ||
142 | u8 reply_struct_v; | ||
143 | 158 | ||
144 | dbuf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); | 159 | ceph_decode_need(p, end, sizeof(u32) + 1, bad); |
145 | if (!dbuf) | ||
146 | return -ENOMEM; | ||
147 | 160 | ||
148 | ret = -ENOMEM; | 161 | type = ceph_decode_32(p); |
149 | ticket_buf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); | 162 | dout(" ticket type %d %s\n", type, ceph_entity_type_name(type)); |
150 | if (!ticket_buf) | ||
151 | goto out_dbuf; | ||
152 | 163 | ||
153 | ceph_decode_need(&p, end, 1 + sizeof(u32), bad); | 164 | tkt_struct_v = ceph_decode_8(p); |
154 | reply_struct_v = ceph_decode_8(&p); | 165 | if (tkt_struct_v != 1) |
155 | if (reply_struct_v != 1) | ||
156 | goto bad; | 166 | goto bad; |
157 | num = ceph_decode_32(&p); | ||
158 | dout("%d tickets\n", num); | ||
159 | while (num--) { | ||
160 | int type; | ||
161 | u8 tkt_struct_v, blob_struct_v; | ||
162 | struct ceph_x_ticket_handler *th; | ||
163 | void *dp, *dend; | ||
164 | int dlen; | ||
165 | char is_enc; | ||
166 | struct timespec validity; | ||
167 | struct ceph_crypto_key old_key; | ||
168 | void *tp, *tpend; | ||
169 | struct ceph_timespec new_validity; | ||
170 | struct ceph_crypto_key new_session_key; | ||
171 | struct ceph_buffer *new_ticket_blob; | ||
172 | unsigned long new_expires, new_renew_after; | ||
173 | u64 new_secret_id; | ||
174 | |||
175 | ceph_decode_need(&p, end, sizeof(u32) + 1, bad); | ||
176 | |||
177 | type = ceph_decode_32(&p); | ||
178 | dout(" ticket type %d %s\n", type, ceph_entity_type_name(type)); | ||
179 | |||
180 | tkt_struct_v = ceph_decode_8(&p); | ||
181 | if (tkt_struct_v != 1) | ||
182 | goto bad; | ||
183 | |||
184 | th = get_ticket_handler(ac, type); | ||
185 | if (IS_ERR(th)) { | ||
186 | ret = PTR_ERR(th); | ||
187 | goto out; | ||
188 | } | ||
189 | 167 | ||
190 | /* blob for me */ | 168 | th = get_ticket_handler(ac, type); |
191 | dlen = ceph_x_decrypt(secret, &p, end, dbuf, | 169 | if (IS_ERR(th)) { |
192 | TEMP_TICKET_BUF_LEN); | 170 | ret = PTR_ERR(th); |
193 | if (dlen <= 0) { | 171 | goto out; |
194 | ret = dlen; | 172 | } |
195 | goto out; | ||
196 | } | ||
197 | dout(" decrypted %d bytes\n", dlen); | ||
198 | dend = dbuf + dlen; | ||
199 | dp = dbuf; | ||
200 | 173 | ||
201 | tkt_struct_v = ceph_decode_8(&dp); | 174 | /* blob for me */ |
202 | if (tkt_struct_v != 1) | 175 | dlen = ceph_x_decrypt(secret, p, end, &dbuf, 0); |
203 | goto bad; | 176 | if (dlen <= 0) { |
177 | ret = dlen; | ||
178 | goto out; | ||
179 | } | ||
180 | dout(" decrypted %d bytes\n", dlen); | ||
181 | dp = dbuf; | ||
182 | dend = dp + dlen; | ||
204 | 183 | ||
205 | memcpy(&old_key, &th->session_key, sizeof(old_key)); | 184 | tkt_struct_v = ceph_decode_8(&dp); |
206 | ret = ceph_crypto_key_decode(&new_session_key, &dp, dend); | 185 | if (tkt_struct_v != 1) |
207 | if (ret) | 186 | goto bad; |
208 | goto out; | ||
209 | 187 | ||
210 | ceph_decode_copy(&dp, &new_validity, sizeof(new_validity)); | 188 | memcpy(&old_key, &th->session_key, sizeof(old_key)); |
211 | ceph_decode_timespec(&validity, &new_validity); | 189 | ret = ceph_crypto_key_decode(&new_session_key, &dp, dend); |
212 | new_expires = get_seconds() + validity.tv_sec; | 190 | if (ret) |
213 | new_renew_after = new_expires - (validity.tv_sec / 4); | 191 | goto out; |
214 | dout(" expires=%lu renew_after=%lu\n", new_expires, | ||
215 | new_renew_after); | ||
216 | 192 | ||
217 | /* ticket blob for service */ | 193 | ceph_decode_copy(&dp, &new_validity, sizeof(new_validity)); |
218 | ceph_decode_8_safe(&p, end, is_enc, bad); | 194 | ceph_decode_timespec(&validity, &new_validity); |
219 | tp = ticket_buf; | 195 | new_expires = get_seconds() + validity.tv_sec; |
220 | if (is_enc) { | 196 | new_renew_after = new_expires - (validity.tv_sec / 4); |
221 | /* encrypted */ | 197 | dout(" expires=%lu renew_after=%lu\n", new_expires, |
222 | dout(" encrypted ticket\n"); | 198 | new_renew_after); |
223 | dlen = ceph_x_decrypt(&old_key, &p, end, ticket_buf, | 199 | |
224 | TEMP_TICKET_BUF_LEN); | 200 | /* ticket blob for service */ |
225 | if (dlen < 0) { | 201 | ceph_decode_8_safe(p, end, is_enc, bad); |
226 | ret = dlen; | 202 | if (is_enc) { |
227 | goto out; | 203 | /* encrypted */ |
228 | } | 204 | dout(" encrypted ticket\n"); |
229 | dlen = ceph_decode_32(&tp); | 205 | dlen = ceph_x_decrypt(&old_key, p, end, &ticket_buf, 0); |
230 | } else { | 206 | if (dlen < 0) { |
231 | /* unencrypted */ | 207 | ret = dlen; |
232 | ceph_decode_32_safe(&p, end, dlen, bad); | 208 | goto out; |
233 | ceph_decode_need(&p, end, dlen, bad); | ||
234 | ceph_decode_copy(&p, ticket_buf, dlen); | ||
235 | } | 209 | } |
236 | tpend = tp + dlen; | 210 | tp = ticket_buf; |
237 | dout(" ticket blob is %d bytes\n", dlen); | 211 | dlen = ceph_decode_32(&tp); |
238 | ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); | 212 | } else { |
239 | blob_struct_v = ceph_decode_8(&tp); | 213 | /* unencrypted */ |
240 | new_secret_id = ceph_decode_64(&tp); | 214 | ceph_decode_32_safe(p, end, dlen, bad); |
241 | ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); | 215 | ticket_buf = kmalloc(dlen, GFP_NOFS); |
242 | if (ret) | 216 | if (!ticket_buf) { |
217 | ret = -ENOMEM; | ||
243 | goto out; | 218 | goto out; |
244 | 219 | } | |
245 | /* all is well, update our ticket */ | 220 | tp = ticket_buf; |
246 | ceph_crypto_key_destroy(&th->session_key); | 221 | ceph_decode_need(p, end, dlen, bad); |
247 | if (th->ticket_blob) | 222 | ceph_decode_copy(p, ticket_buf, dlen); |
248 | ceph_buffer_put(th->ticket_blob); | ||
249 | th->session_key = new_session_key; | ||
250 | th->ticket_blob = new_ticket_blob; | ||
251 | th->validity = new_validity; | ||
252 | th->secret_id = new_secret_id; | ||
253 | th->expires = new_expires; | ||
254 | th->renew_after = new_renew_after; | ||
255 | dout(" got ticket service %d (%s) secret_id %lld len %d\n", | ||
256 | type, ceph_entity_type_name(type), th->secret_id, | ||
257 | (int)th->ticket_blob->vec.iov_len); | ||
258 | xi->have_keys |= th->service; | ||
259 | } | 223 | } |
224 | tpend = tp + dlen; | ||
225 | dout(" ticket blob is %d bytes\n", dlen); | ||
226 | ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); | ||
227 | blob_struct_v = ceph_decode_8(&tp); | ||
228 | new_secret_id = ceph_decode_64(&tp); | ||
229 | ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); | ||
230 | if (ret) | ||
231 | goto out; | ||
232 | |||
233 | /* all is well, update our ticket */ | ||
234 | ceph_crypto_key_destroy(&th->session_key); | ||
235 | if (th->ticket_blob) | ||
236 | ceph_buffer_put(th->ticket_blob); | ||
237 | th->session_key = new_session_key; | ||
238 | th->ticket_blob = new_ticket_blob; | ||
239 | th->validity = new_validity; | ||
240 | th->secret_id = new_secret_id; | ||
241 | th->expires = new_expires; | ||
242 | th->renew_after = new_renew_after; | ||
243 | dout(" got ticket service %d (%s) secret_id %lld len %d\n", | ||
244 | type, ceph_entity_type_name(type), th->secret_id, | ||
245 | (int)th->ticket_blob->vec.iov_len); | ||
246 | xi->have_keys |= th->service; | ||
260 | 247 | ||
261 | ret = 0; | ||
262 | out: | 248 | out: |
263 | kfree(ticket_buf); | 249 | kfree(ticket_buf); |
264 | out_dbuf: | ||
265 | kfree(dbuf); | 250 | kfree(dbuf); |
266 | return ret; | 251 | return ret; |
267 | 252 | ||
@@ -270,6 +255,34 @@ bad: | |||
270 | goto out; | 255 | goto out; |
271 | } | 256 | } |
272 | 257 | ||
258 | static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | ||
259 | struct ceph_crypto_key *secret, | ||
260 | void *buf, void *end) | ||
261 | { | ||
262 | void *p = buf; | ||
263 | u8 reply_struct_v; | ||
264 | u32 num; | ||
265 | int ret; | ||
266 | |||
267 | ceph_decode_8_safe(&p, end, reply_struct_v, bad); | ||
268 | if (reply_struct_v != 1) | ||
269 | return -EINVAL; | ||
270 | |||
271 | ceph_decode_32_safe(&p, end, num, bad); | ||
272 | dout("%d tickets\n", num); | ||
273 | |||
274 | while (num--) { | ||
275 | ret = process_one_ticket(ac, secret, &p, end); | ||
276 | if (ret) | ||
277 | return ret; | ||
278 | } | ||
279 | |||
280 | return 0; | ||
281 | |||
282 | bad: | ||
283 | return -EINVAL; | ||
284 | } | ||
285 | |||
273 | static int ceph_x_build_authorizer(struct ceph_auth_client *ac, | 286 | static int ceph_x_build_authorizer(struct ceph_auth_client *ac, |
274 | struct ceph_x_ticket_handler *th, | 287 | struct ceph_x_ticket_handler *th, |
275 | struct ceph_x_authorizer *au) | 288 | struct ceph_x_authorizer *au) |
@@ -583,13 +596,14 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, | |||
583 | struct ceph_x_ticket_handler *th; | 596 | struct ceph_x_ticket_handler *th; |
584 | int ret = 0; | 597 | int ret = 0; |
585 | struct ceph_x_authorize_reply reply; | 598 | struct ceph_x_authorize_reply reply; |
599 | void *preply = &reply; | ||
586 | void *p = au->reply_buf; | 600 | void *p = au->reply_buf; |
587 | void *end = p + sizeof(au->reply_buf); | 601 | void *end = p + sizeof(au->reply_buf); |
588 | 602 | ||
589 | th = get_ticket_handler(ac, au->service); | 603 | th = get_ticket_handler(ac, au->service); |
590 | if (IS_ERR(th)) | 604 | if (IS_ERR(th)) |
591 | return PTR_ERR(th); | 605 | return PTR_ERR(th); |
592 | ret = ceph_x_decrypt(&th->session_key, &p, end, &reply, sizeof(reply)); | 606 | ret = ceph_x_decrypt(&th->session_key, &p, end, &preply, sizeof(reply)); |
593 | if (ret < 0) | 607 | if (ret < 0) |
594 | return ret; | 608 | return ret; |
595 | if (ret != sizeof(reply)) | 609 | if (ret != sizeof(reply)) |
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 067d3af2eaf6..61fcfc304f68 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -1181,7 +1181,15 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, | |||
1181 | if (!m) { | 1181 | if (!m) { |
1182 | pr_info("alloc_msg unknown type %d\n", type); | 1182 | pr_info("alloc_msg unknown type %d\n", type); |
1183 | *skip = 1; | 1183 | *skip = 1; |
1184 | } else if (front_len > m->front_alloc_len) { | ||
1185 | pr_warning("mon_alloc_msg front %d > prealloc %d (%u#%llu)\n", | ||
1186 | front_len, m->front_alloc_len, | ||
1187 | (unsigned int)con->peer_name.type, | ||
1188 | le64_to_cpu(con->peer_name.num)); | ||
1189 | ceph_msg_put(m); | ||
1190 | m = ceph_msg_new(type, front_len, GFP_NOFS, false); | ||
1184 | } | 1191 | } |
1192 | |||
1185 | return m; | 1193 | return m; |
1186 | } | 1194 | } |
1187 | 1195 | ||
diff --git a/net/core/datagram.c b/net/core/datagram.c index 488dd1a825c0..fdbc9a81d4c2 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -775,7 +775,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb) | |||
775 | EXPORT_SYMBOL(__skb_checksum_complete); | 775 | EXPORT_SYMBOL(__skb_checksum_complete); |
776 | 776 | ||
777 | /** | 777 | /** |
778 | * skb_copy_and_csum_datagram_iovec - Copy and checkum skb to user iovec. | 778 | * skb_copy_and_csum_datagram_iovec - Copy and checksum skb to user iovec. |
779 | * @skb: skbuff | 779 | * @skb: skbuff |
780 | * @hlen: hardware length | 780 | * @hlen: hardware length |
781 | * @iov: io vector | 781 | * @iov: io vector |
diff --git a/net/core/dev.c b/net/core/dev.c index b65a5051361f..cf8a95f48cff 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2587,13 +2587,19 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) | |||
2587 | return harmonize_features(skb, features); | 2587 | return harmonize_features(skb, features); |
2588 | } | 2588 | } |
2589 | 2589 | ||
2590 | features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | | 2590 | features = netdev_intersect_features(features, |
2591 | NETIF_F_HW_VLAN_STAG_TX); | 2591 | skb->dev->vlan_features | |
2592 | NETIF_F_HW_VLAN_CTAG_TX | | ||
2593 | NETIF_F_HW_VLAN_STAG_TX); | ||
2592 | 2594 | ||
2593 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) | 2595 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) |
2594 | features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | | 2596 | features = netdev_intersect_features(features, |
2595 | NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX | | 2597 | NETIF_F_SG | |
2596 | NETIF_F_HW_VLAN_STAG_TX; | 2598 | NETIF_F_HIGHDMA | |
2599 | NETIF_F_FRAGLIST | | ||
2600 | NETIF_F_GEN_CSUM | | ||
2601 | NETIF_F_HW_VLAN_CTAG_TX | | ||
2602 | NETIF_F_HW_VLAN_STAG_TX); | ||
2597 | 2603 | ||
2598 | return harmonize_features(skb, features); | 2604 | return harmonize_features(skb, features); |
2599 | } | 2605 | } |
@@ -4803,9 +4809,14 @@ static void netdev_adjacent_sysfs_del(struct net_device *dev, | |||
4803 | sysfs_remove_link(&(dev->dev.kobj), linkname); | 4809 | sysfs_remove_link(&(dev->dev.kobj), linkname); |
4804 | } | 4810 | } |
4805 | 4811 | ||
4806 | #define netdev_adjacent_is_neigh_list(dev, dev_list) \ | 4812 | static inline bool netdev_adjacent_is_neigh_list(struct net_device *dev, |
4807 | (dev_list == &dev->adj_list.upper || \ | 4813 | struct net_device *adj_dev, |
4808 | dev_list == &dev->adj_list.lower) | 4814 | struct list_head *dev_list) |
4815 | { | ||
4816 | return (dev_list == &dev->adj_list.upper || | ||
4817 | dev_list == &dev->adj_list.lower) && | ||
4818 | net_eq(dev_net(dev), dev_net(adj_dev)); | ||
4819 | } | ||
4809 | 4820 | ||
4810 | static int __netdev_adjacent_dev_insert(struct net_device *dev, | 4821 | static int __netdev_adjacent_dev_insert(struct net_device *dev, |
4811 | struct net_device *adj_dev, | 4822 | struct net_device *adj_dev, |
@@ -4835,7 +4846,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev, | |||
4835 | pr_debug("dev_hold for %s, because of link added from %s to %s\n", | 4846 | pr_debug("dev_hold for %s, because of link added from %s to %s\n", |
4836 | adj_dev->name, dev->name, adj_dev->name); | 4847 | adj_dev->name, dev->name, adj_dev->name); |
4837 | 4848 | ||
4838 | if (netdev_adjacent_is_neigh_list(dev, dev_list)) { | 4849 | if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) { |
4839 | ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); | 4850 | ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); |
4840 | if (ret) | 4851 | if (ret) |
4841 | goto free_adj; | 4852 | goto free_adj; |
@@ -4856,7 +4867,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev, | |||
4856 | return 0; | 4867 | return 0; |
4857 | 4868 | ||
4858 | remove_symlinks: | 4869 | remove_symlinks: |
4859 | if (netdev_adjacent_is_neigh_list(dev, dev_list)) | 4870 | if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) |
4860 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); | 4871 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); |
4861 | free_adj: | 4872 | free_adj: |
4862 | kfree(adj); | 4873 | kfree(adj); |
@@ -4889,7 +4900,7 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev, | |||
4889 | if (adj->master) | 4900 | if (adj->master) |
4890 | sysfs_remove_link(&(dev->dev.kobj), "master"); | 4901 | sysfs_remove_link(&(dev->dev.kobj), "master"); |
4891 | 4902 | ||
4892 | if (netdev_adjacent_is_neigh_list(dev, dev_list)) | 4903 | if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) |
4893 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); | 4904 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); |
4894 | 4905 | ||
4895 | list_del_rcu(&adj->list); | 4906 | list_del_rcu(&adj->list); |
@@ -5159,11 +5170,65 @@ void netdev_upper_dev_unlink(struct net_device *dev, | |||
5159 | } | 5170 | } |
5160 | EXPORT_SYMBOL(netdev_upper_dev_unlink); | 5171 | EXPORT_SYMBOL(netdev_upper_dev_unlink); |
5161 | 5172 | ||
5173 | void netdev_adjacent_add_links(struct net_device *dev) | ||
5174 | { | ||
5175 | struct netdev_adjacent *iter; | ||
5176 | |||
5177 | struct net *net = dev_net(dev); | ||
5178 | |||
5179 | list_for_each_entry(iter, &dev->adj_list.upper, list) { | ||
5180 | if (!net_eq(net,dev_net(iter->dev))) | ||
5181 | continue; | ||
5182 | netdev_adjacent_sysfs_add(iter->dev, dev, | ||
5183 | &iter->dev->adj_list.lower); | ||
5184 | netdev_adjacent_sysfs_add(dev, iter->dev, | ||
5185 | &dev->adj_list.upper); | ||
5186 | } | ||
5187 | |||
5188 | list_for_each_entry(iter, &dev->adj_list.lower, list) { | ||
5189 | if (!net_eq(net,dev_net(iter->dev))) | ||
5190 | continue; | ||
5191 | netdev_adjacent_sysfs_add(iter->dev, dev, | ||
5192 | &iter->dev->adj_list.upper); | ||
5193 | netdev_adjacent_sysfs_add(dev, iter->dev, | ||
5194 | &dev->adj_list.lower); | ||
5195 | } | ||
5196 | } | ||
5197 | |||
5198 | void netdev_adjacent_del_links(struct net_device *dev) | ||
5199 | { | ||
5200 | struct netdev_adjacent *iter; | ||
5201 | |||
5202 | struct net *net = dev_net(dev); | ||
5203 | |||
5204 | list_for_each_entry(iter, &dev->adj_list.upper, list) { | ||
5205 | if (!net_eq(net,dev_net(iter->dev))) | ||
5206 | continue; | ||
5207 | netdev_adjacent_sysfs_del(iter->dev, dev->name, | ||
5208 | &iter->dev->adj_list.lower); | ||
5209 | netdev_adjacent_sysfs_del(dev, iter->dev->name, | ||
5210 | &dev->adj_list.upper); | ||
5211 | } | ||
5212 | |||
5213 | list_for_each_entry(iter, &dev->adj_list.lower, list) { | ||
5214 | if (!net_eq(net,dev_net(iter->dev))) | ||
5215 | continue; | ||
5216 | netdev_adjacent_sysfs_del(iter->dev, dev->name, | ||
5217 | &iter->dev->adj_list.upper); | ||
5218 | netdev_adjacent_sysfs_del(dev, iter->dev->name, | ||
5219 | &dev->adj_list.lower); | ||
5220 | } | ||
5221 | } | ||
5222 | |||
5162 | void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) | 5223 | void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) |
5163 | { | 5224 | { |
5164 | struct netdev_adjacent *iter; | 5225 | struct netdev_adjacent *iter; |
5165 | 5226 | ||
5227 | struct net *net = dev_net(dev); | ||
5228 | |||
5166 | list_for_each_entry(iter, &dev->adj_list.upper, list) { | 5229 | list_for_each_entry(iter, &dev->adj_list.upper, list) { |
5230 | if (!net_eq(net,dev_net(iter->dev))) | ||
5231 | continue; | ||
5167 | netdev_adjacent_sysfs_del(iter->dev, oldname, | 5232 | netdev_adjacent_sysfs_del(iter->dev, oldname, |
5168 | &iter->dev->adj_list.lower); | 5233 | &iter->dev->adj_list.lower); |
5169 | netdev_adjacent_sysfs_add(iter->dev, dev, | 5234 | netdev_adjacent_sysfs_add(iter->dev, dev, |
@@ -5171,6 +5236,8 @@ void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) | |||
5171 | } | 5236 | } |
5172 | 5237 | ||
5173 | list_for_each_entry(iter, &dev->adj_list.lower, list) { | 5238 | list_for_each_entry(iter, &dev->adj_list.lower, list) { |
5239 | if (!net_eq(net,dev_net(iter->dev))) | ||
5240 | continue; | ||
5174 | netdev_adjacent_sysfs_del(iter->dev, oldname, | 5241 | netdev_adjacent_sysfs_del(iter->dev, oldname, |
5175 | &iter->dev->adj_list.upper); | 5242 | &iter->dev->adj_list.upper); |
5176 | netdev_adjacent_sysfs_add(iter->dev, dev, | 5243 | netdev_adjacent_sysfs_add(iter->dev, dev, |
@@ -6773,6 +6840,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
6773 | 6840 | ||
6774 | /* Send a netdev-removed uevent to the old namespace */ | 6841 | /* Send a netdev-removed uevent to the old namespace */ |
6775 | kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE); | 6842 | kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE); |
6843 | netdev_adjacent_del_links(dev); | ||
6776 | 6844 | ||
6777 | /* Actually switch the network namespace */ | 6845 | /* Actually switch the network namespace */ |
6778 | dev_net_set(dev, net); | 6846 | dev_net_set(dev, net); |
@@ -6787,6 +6855,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
6787 | 6855 | ||
6788 | /* Send a netdev-add uevent to the new namespace */ | 6856 | /* Send a netdev-add uevent to the new namespace */ |
6789 | kobject_uevent(&dev->dev.kobj, KOBJ_ADD); | 6857 | kobject_uevent(&dev->dev.kobj, KOBJ_ADD); |
6858 | netdev_adjacent_add_links(dev); | ||
6790 | 6859 | ||
6791 | /* Fixup kobjects */ | 6860 | /* Fixup kobjects */ |
6792 | err = device_rename(&dev->dev, dev->name); | 6861 | err = device_rename(&dev->dev, dev->name); |
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 6b5b6e7013ca..9d33dfffca19 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c | |||
@@ -197,7 +197,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats | |||
197 | * as destination. A new timer with the interval specified in the | 197 | * as destination. A new timer with the interval specified in the |
198 | * configuration TLV is created. Upon each interval, the latest statistics | 198 | * configuration TLV is created. Upon each interval, the latest statistics |
199 | * will be read from &bstats and the estimated rate will be stored in | 199 | * will be read from &bstats and the estimated rate will be stored in |
200 | * &rate_est with the statistics lock grabed during this period. | 200 | * &rate_est with the statistics lock grabbed during this period. |
201 | * | 201 | * |
202 | * Returns 0 on success or a negative error code. | 202 | * Returns 0 on success or a negative error code. |
203 | * | 203 | * |
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index 9d3d9e78397b..2ddbce4cce14 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c | |||
@@ -206,7 +206,7 @@ EXPORT_SYMBOL(gnet_stats_copy_queue); | |||
206 | * @st: application specific statistics data | 206 | * @st: application specific statistics data |
207 | * @len: length of data | 207 | * @len: length of data |
208 | * | 208 | * |
209 | * Appends the application sepecific statistics to the top level TLV created by | 209 | * Appends the application specific statistics to the top level TLV created by |
210 | * gnet_stats_start_copy() and remembers the data for XSTATS if the dumping | 210 | * gnet_stats_start_copy() and remembers the data for XSTATS if the dumping |
211 | * handle is in backward compatibility mode. | 211 | * handle is in backward compatibility mode. |
212 | * | 212 | * |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 163b673f9e62..da1378a3e2c7 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2647,7 +2647,7 @@ EXPORT_SYMBOL(skb_prepare_seq_read); | |||
2647 | * skb_seq_read() will return the remaining part of the block. | 2647 | * skb_seq_read() will return the remaining part of the block. |
2648 | * | 2648 | * |
2649 | * Note 1: The size of each block of data returned can be arbitrary, | 2649 | * Note 1: The size of each block of data returned can be arbitrary, |
2650 | * this limitation is the cost for zerocopy seqeuental | 2650 | * this limitation is the cost for zerocopy sequential |
2651 | * reads of potentially non linear data. | 2651 | * reads of potentially non linear data. |
2652 | * | 2652 | * |
2653 | * Note 2: Fragment lists within fragments are not implemented | 2653 | * Note 2: Fragment lists within fragments are not implemented |
@@ -2781,7 +2781,7 @@ EXPORT_SYMBOL(skb_find_text); | |||
2781 | /** | 2781 | /** |
2782 | * skb_append_datato_frags - append the user data to a skb | 2782 | * skb_append_datato_frags - append the user data to a skb |
2783 | * @sk: sock structure | 2783 | * @sk: sock structure |
2784 | * @skb: skb structure to be appened with user data. | 2784 | * @skb: skb structure to be appended with user data. |
2785 | * @getfrag: call back function to be used for getting the user data | 2785 | * @getfrag: call back function to be used for getting the user data |
2786 | * @from: pointer to user message iov | 2786 | * @from: pointer to user message iov |
2787 | * @length: length of the iov message | 2787 | * @length: length of the iov message |
diff --git a/net/core/sock.c b/net/core/sock.c index 2714811afbd8..9c3f823e76a9 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(sk_ns_capable); | |||
166 | /** | 166 | /** |
167 | * sk_capable - Socket global capability test | 167 | * sk_capable - Socket global capability test |
168 | * @sk: Socket to use a capability on or through | 168 | * @sk: Socket to use a capability on or through |
169 | * @cap: The global capbility to use | 169 | * @cap: The global capability to use |
170 | * | 170 | * |
171 | * Test to see if the opener of the socket had when the socket was | 171 | * Test to see if the opener of the socket had when the socket was |
172 | * created and the current process has the capability @cap in all user | 172 | * created and the current process has the capability @cap in all user |
@@ -183,7 +183,7 @@ EXPORT_SYMBOL(sk_capable); | |||
183 | * @sk: Socket to use a capability on or through | 183 | * @sk: Socket to use a capability on or through |
184 | * @cap: The capability to use | 184 | * @cap: The capability to use |
185 | * | 185 | * |
186 | * Test to see if the opener of the socket had when the socke was created | 186 | * Test to see if the opener of the socket had when the socket was created |
187 | * and the current process has the capability @cap over the network namespace | 187 | * and the current process has the capability @cap over the network namespace |
188 | * the socket is a member of. | 188 | * the socket is a member of. |
189 | */ | 189 | */ |
@@ -1822,6 +1822,9 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, | |||
1822 | order); | 1822 | order); |
1823 | if (page) | 1823 | if (page) |
1824 | goto fill_page; | 1824 | goto fill_page; |
1825 | /* Do not retry other high order allocations */ | ||
1826 | order = 1; | ||
1827 | max_page_order = 0; | ||
1825 | } | 1828 | } |
1826 | order--; | 1829 | order--; |
1827 | } | 1830 | } |
@@ -1863,16 +1866,14 @@ EXPORT_SYMBOL(sock_alloc_send_skb); | |||
1863 | * skb_page_frag_refill - check that a page_frag contains enough room | 1866 | * skb_page_frag_refill - check that a page_frag contains enough room |
1864 | * @sz: minimum size of the fragment we want to get | 1867 | * @sz: minimum size of the fragment we want to get |
1865 | * @pfrag: pointer to page_frag | 1868 | * @pfrag: pointer to page_frag |
1866 | * @prio: priority for memory allocation | 1869 | * @gfp: priority for memory allocation |
1867 | * | 1870 | * |
1868 | * Note: While this allocator tries to use high order pages, there is | 1871 | * Note: While this allocator tries to use high order pages, there is |
1869 | * no guarantee that allocations succeed. Therefore, @sz MUST be | 1872 | * no guarantee that allocations succeed. Therefore, @sz MUST be |
1870 | * less or equal than PAGE_SIZE. | 1873 | * less or equal than PAGE_SIZE. |
1871 | */ | 1874 | */ |
1872 | bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio) | 1875 | bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) |
1873 | { | 1876 | { |
1874 | int order; | ||
1875 | |||
1876 | if (pfrag->page) { | 1877 | if (pfrag->page) { |
1877 | if (atomic_read(&pfrag->page->_count) == 1) { | 1878 | if (atomic_read(&pfrag->page->_count) == 1) { |
1878 | pfrag->offset = 0; | 1879 | pfrag->offset = 0; |
@@ -1883,20 +1884,21 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio) | |||
1883 | put_page(pfrag->page); | 1884 | put_page(pfrag->page); |
1884 | } | 1885 | } |
1885 | 1886 | ||
1886 | order = SKB_FRAG_PAGE_ORDER; | 1887 | pfrag->offset = 0; |
1887 | do { | 1888 | if (SKB_FRAG_PAGE_ORDER) { |
1888 | gfp_t gfp = prio; | 1889 | pfrag->page = alloc_pages(gfp | __GFP_COMP | |
1889 | 1890 | __GFP_NOWARN | __GFP_NORETRY, | |
1890 | if (order) | 1891 | SKB_FRAG_PAGE_ORDER); |
1891 | gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY; | ||
1892 | pfrag->page = alloc_pages(gfp, order); | ||
1893 | if (likely(pfrag->page)) { | 1892 | if (likely(pfrag->page)) { |
1894 | pfrag->offset = 0; | 1893 | pfrag->size = PAGE_SIZE << SKB_FRAG_PAGE_ORDER; |
1895 | pfrag->size = PAGE_SIZE << order; | ||
1896 | return true; | 1894 | return true; |
1897 | } | 1895 | } |
1898 | } while (--order >= 0); | 1896 | } |
1899 | 1897 | pfrag->page = alloc_page(gfp); | |
1898 | if (likely(pfrag->page)) { | ||
1899 | pfrag->size = PAGE_SIZE; | ||
1900 | return true; | ||
1901 | } | ||
1900 | return false; | 1902 | return false; |
1901 | } | 1903 | } |
1902 | EXPORT_SYMBOL(skb_page_frag_refill); | 1904 | EXPORT_SYMBOL(skb_page_frag_refill); |
diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c index 016b77ee88f0..6591d27e53a4 100644 --- a/net/ieee802154/6lowpan_rtnl.c +++ b/net/ieee802154/6lowpan_rtnl.c | |||
@@ -246,7 +246,7 @@ lowpan_alloc_frag(struct sk_buff *skb, int size, | |||
246 | return ERR_PTR(-rc); | 246 | return ERR_PTR(-rc); |
247 | } | 247 | } |
248 | } else { | 248 | } else { |
249 | frag = ERR_PTR(ENOMEM); | 249 | frag = ERR_PTR(-ENOMEM); |
250 | } | 250 | } |
251 | 251 | ||
252 | return frag; | 252 | return frag; |
@@ -437,7 +437,7 @@ static void lowpan_setup(struct net_device *dev) | |||
437 | /* Frame Control + Sequence Number + Address fields + Security Header */ | 437 | /* Frame Control + Sequence Number + Address fields + Security Header */ |
438 | dev->hard_header_len = 2 + 1 + 20 + 14; | 438 | dev->hard_header_len = 2 + 1 + 20 + 14; |
439 | dev->needed_tailroom = 2; /* FCS */ | 439 | dev->needed_tailroom = 2; /* FCS */ |
440 | dev->mtu = 1281; | 440 | dev->mtu = IPV6_MIN_MTU; |
441 | dev->tx_queue_len = 0; | 441 | dev->tx_queue_len = 0; |
442 | dev->flags = IFF_BROADCAST | IFF_MULTICAST; | 442 | dev->flags = IFF_BROADCAST | IFF_MULTICAST; |
443 | dev->watchdog_timeo = 0; | 443 | dev->watchdog_timeo = 0; |
diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c index ffec6ce51005..32755cb7e64e 100644 --- a/net/ieee802154/reassembly.c +++ b/net/ieee802154/reassembly.c | |||
@@ -355,8 +355,6 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type) | |||
355 | struct net *net = dev_net(skb->dev); | 355 | struct net *net = dev_net(skb->dev); |
356 | struct lowpan_frag_info *frag_info = lowpan_cb(skb); | 356 | struct lowpan_frag_info *frag_info = lowpan_cb(skb); |
357 | struct ieee802154_addr source, dest; | 357 | struct ieee802154_addr source, dest; |
358 | struct netns_ieee802154_lowpan *ieee802154_lowpan = | ||
359 | net_ieee802154_lowpan(net); | ||
360 | int err; | 358 | int err; |
361 | 359 | ||
362 | source = mac_cb(skb)->source; | 360 | source = mac_cb(skb)->source; |
@@ -366,8 +364,10 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type) | |||
366 | if (err < 0) | 364 | if (err < 0) |
367 | goto err; | 365 | goto err; |
368 | 366 | ||
369 | if (frag_info->d_size > ieee802154_lowpan->max_dsize) | 367 | if (frag_info->d_size > IPV6_MIN_MTU) { |
368 | net_warn_ratelimited("lowpan_frag_rcv: datagram size exceeds MTU\n"); | ||
370 | goto err; | 369 | goto err; |
370 | } | ||
371 | 371 | ||
372 | fq = fq_find(net, frag_info, &source, &dest); | 372 | fq = fq_find(net, frag_info, &source, &dest); |
373 | if (fq != NULL) { | 373 | if (fq != NULL) { |
@@ -415,13 +415,6 @@ static struct ctl_table lowpan_frags_ns_ctl_table[] = { | |||
415 | .mode = 0644, | 415 | .mode = 0644, |
416 | .proc_handler = proc_dointvec_jiffies, | 416 | .proc_handler = proc_dointvec_jiffies, |
417 | }, | 417 | }, |
418 | { | ||
419 | .procname = "6lowpanfrag_max_datagram_size", | ||
420 | .data = &init_net.ieee802154_lowpan.max_dsize, | ||
421 | .maxlen = sizeof(int), | ||
422 | .mode = 0644, | ||
423 | .proc_handler = proc_dointvec | ||
424 | }, | ||
425 | { } | 418 | { } |
426 | }; | 419 | }; |
427 | 420 | ||
@@ -458,7 +451,6 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net) | |||
458 | table[1].data = &ieee802154_lowpan->frags.low_thresh; | 451 | table[1].data = &ieee802154_lowpan->frags.low_thresh; |
459 | table[1].extra2 = &ieee802154_lowpan->frags.high_thresh; | 452 | table[1].extra2 = &ieee802154_lowpan->frags.high_thresh; |
460 | table[2].data = &ieee802154_lowpan->frags.timeout; | 453 | table[2].data = &ieee802154_lowpan->frags.timeout; |
461 | table[3].data = &ieee802154_lowpan->max_dsize; | ||
462 | 454 | ||
463 | /* Don't export sysctls to unprivileged users */ | 455 | /* Don't export sysctls to unprivileged users */ |
464 | if (net->user_ns != &init_user_ns) | 456 | if (net->user_ns != &init_user_ns) |
@@ -533,7 +525,6 @@ static int __net_init lowpan_frags_init_net(struct net *net) | |||
533 | ieee802154_lowpan->frags.high_thresh = IPV6_FRAG_HIGH_THRESH; | 525 | ieee802154_lowpan->frags.high_thresh = IPV6_FRAG_HIGH_THRESH; |
534 | ieee802154_lowpan->frags.low_thresh = IPV6_FRAG_LOW_THRESH; | 526 | ieee802154_lowpan->frags.low_thresh = IPV6_FRAG_LOW_THRESH; |
535 | ieee802154_lowpan->frags.timeout = IPV6_FRAG_TIMEOUT; | 527 | ieee802154_lowpan->frags.timeout = IPV6_FRAG_TIMEOUT; |
536 | ieee802154_lowpan->max_dsize = 0xFFFF; | ||
537 | 528 | ||
538 | inet_frags_init_net(&ieee802154_lowpan->frags); | 529 | inet_frags_init_net(&ieee802154_lowpan->frags); |
539 | 530 | ||
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index afed1aac2638..bd41dd1948b6 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -79,10 +79,10 @@ static void __tunnel_dst_set(struct ip_tunnel_dst *idst, | |||
79 | idst->saddr = saddr; | 79 | idst->saddr = saddr; |
80 | } | 80 | } |
81 | 81 | ||
82 | static void tunnel_dst_set(struct ip_tunnel *t, | 82 | static noinline void tunnel_dst_set(struct ip_tunnel *t, |
83 | struct dst_entry *dst, __be32 saddr) | 83 | struct dst_entry *dst, __be32 saddr) |
84 | { | 84 | { |
85 | __tunnel_dst_set(this_cpu_ptr(t->dst_cache), dst, saddr); | 85 | __tunnel_dst_set(raw_cpu_ptr(t->dst_cache), dst, saddr); |
86 | } | 86 | } |
87 | 87 | ||
88 | static void tunnel_dst_reset(struct ip_tunnel *t) | 88 | static void tunnel_dst_reset(struct ip_tunnel *t) |
@@ -106,7 +106,7 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, | |||
106 | struct dst_entry *dst; | 106 | struct dst_entry *dst; |
107 | 107 | ||
108 | rcu_read_lock(); | 108 | rcu_read_lock(); |
109 | idst = this_cpu_ptr(t->dst_cache); | 109 | idst = raw_cpu_ptr(t->dst_cache); |
110 | dst = rcu_dereference(idst->dst); | 110 | dst = rcu_dereference(idst->dst); |
111 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) | 111 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) |
112 | dst = NULL; | 112 | dst = NULL; |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index fb173126f03d..7cbcaf4f0194 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -82,6 +82,52 @@ config NF_TABLES_ARP | |||
82 | help | 82 | help |
83 | This option enables the ARP support for nf_tables. | 83 | This option enables the ARP support for nf_tables. |
84 | 84 | ||
85 | config NF_NAT_IPV4 | ||
86 | tristate "IPv4 NAT" | ||
87 | depends on NF_CONNTRACK_IPV4 | ||
88 | default m if NETFILTER_ADVANCED=n | ||
89 | select NF_NAT | ||
90 | help | ||
91 | The IPv4 NAT option allows masquerading, port forwarding and other | ||
92 | forms of full Network Address Port Translation. This can be | ||
93 | controlled by iptables or nft. | ||
94 | |||
95 | if NF_NAT_IPV4 | ||
96 | |||
97 | config NF_NAT_SNMP_BASIC | ||
98 | tristate "Basic SNMP-ALG support" | ||
99 | depends on NF_CONNTRACK_SNMP | ||
100 | depends on NETFILTER_ADVANCED | ||
101 | default NF_NAT && NF_CONNTRACK_SNMP | ||
102 | ---help--- | ||
103 | |||
104 | This module implements an Application Layer Gateway (ALG) for | ||
105 | SNMP payloads. In conjunction with NAT, it allows a network | ||
106 | management system to access multiple private networks with | ||
107 | conflicting addresses. It works by modifying IP addresses | ||
108 | inside SNMP payloads to match IP-layer NAT mapping. | ||
109 | |||
110 | This is the "basic" form of SNMP-ALG, as described in RFC 2962 | ||
111 | |||
112 | To compile it as a module, choose M here. If unsure, say N. | ||
113 | |||
114 | config NF_NAT_PROTO_GRE | ||
115 | tristate | ||
116 | depends on NF_CT_PROTO_GRE | ||
117 | |||
118 | config NF_NAT_PPTP | ||
119 | tristate | ||
120 | depends on NF_CONNTRACK | ||
121 | default NF_CONNTRACK_PPTP | ||
122 | select NF_NAT_PROTO_GRE | ||
123 | |||
124 | config NF_NAT_H323 | ||
125 | tristate | ||
126 | depends on NF_CONNTRACK | ||
127 | default NF_CONNTRACK_H323 | ||
128 | |||
129 | endif # NF_NAT_IPV4 | ||
130 | |||
85 | config IP_NF_IPTABLES | 131 | config IP_NF_IPTABLES |
86 | tristate "IP tables support (required for filtering/masq/NAT)" | 132 | tristate "IP tables support (required for filtering/masq/NAT)" |
87 | default m if NETFILTER_ADVANCED=n | 133 | default m if NETFILTER_ADVANCED=n |
@@ -170,19 +216,21 @@ config IP_NF_TARGET_SYNPROXY | |||
170 | To compile it as a module, choose M here. If unsure, say N. | 216 | To compile it as a module, choose M here. If unsure, say N. |
171 | 217 | ||
172 | # NAT + specific targets: nf_conntrack | 218 | # NAT + specific targets: nf_conntrack |
173 | config NF_NAT_IPV4 | 219 | config IP_NF_NAT |
174 | tristate "IPv4 NAT" | 220 | tristate "iptables NAT support" |
175 | depends on NF_CONNTRACK_IPV4 | 221 | depends on NF_CONNTRACK_IPV4 |
176 | default m if NETFILTER_ADVANCED=n | 222 | default m if NETFILTER_ADVANCED=n |
177 | select NF_NAT | 223 | select NF_NAT |
224 | select NF_NAT_IPV4 | ||
225 | select NETFILTER_XT_NAT | ||
178 | help | 226 | help |
179 | The IPv4 NAT option allows masquerading, port forwarding and other | 227 | This enables the `nat' table in iptables. This allows masquerading, |
180 | forms of full Network Address Port Translation. It is controlled by | 228 | port forwarding and other forms of full Network Address Port |
181 | the `nat' table in iptables: see the man page for iptables(8). | 229 | Translation. |
182 | 230 | ||
183 | To compile it as a module, choose M here. If unsure, say N. | 231 | To compile it as a module, choose M here. If unsure, say N. |
184 | 232 | ||
185 | if NF_NAT_IPV4 | 233 | if IP_NF_NAT |
186 | 234 | ||
187 | config IP_NF_TARGET_MASQUERADE | 235 | config IP_NF_TARGET_MASQUERADE |
188 | tristate "MASQUERADE target support" | 236 | tristate "MASQUERADE target support" |
@@ -214,47 +262,7 @@ config IP_NF_TARGET_REDIRECT | |||
214 | (e.g. when running oldconfig). It selects | 262 | (e.g. when running oldconfig). It selects |
215 | CONFIG_NETFILTER_XT_TARGET_REDIRECT. | 263 | CONFIG_NETFILTER_XT_TARGET_REDIRECT. |
216 | 264 | ||
217 | endif | 265 | endif # IP_NF_NAT |
218 | |||
219 | config NF_NAT_SNMP_BASIC | ||
220 | tristate "Basic SNMP-ALG support" | ||
221 | depends on NF_CONNTRACK_SNMP && NF_NAT_IPV4 | ||
222 | depends on NETFILTER_ADVANCED | ||
223 | default NF_NAT && NF_CONNTRACK_SNMP | ||
224 | ---help--- | ||
225 | |||
226 | This module implements an Application Layer Gateway (ALG) for | ||
227 | SNMP payloads. In conjunction with NAT, it allows a network | ||
228 | management system to access multiple private networks with | ||
229 | conflicting addresses. It works by modifying IP addresses | ||
230 | inside SNMP payloads to match IP-layer NAT mapping. | ||
231 | |||
232 | This is the "basic" form of SNMP-ALG, as described in RFC 2962 | ||
233 | |||
234 | To compile it as a module, choose M here. If unsure, say N. | ||
235 | |||
236 | # If they want FTP, set to $CONFIG_IP_NF_NAT (m or y), | ||
237 | # or $CONFIG_IP_NF_FTP (m or y), whichever is weaker. | ||
238 | # From kconfig-language.txt: | ||
239 | # | ||
240 | # <expr> '&&' <expr> (6) | ||
241 | # | ||
242 | # (6) Returns the result of min(/expr/, /expr/). | ||
243 | |||
244 | config NF_NAT_PROTO_GRE | ||
245 | tristate | ||
246 | depends on NF_NAT_IPV4 && NF_CT_PROTO_GRE | ||
247 | |||
248 | config NF_NAT_PPTP | ||
249 | tristate | ||
250 | depends on NF_CONNTRACK && NF_NAT_IPV4 | ||
251 | default NF_NAT_IPV4 && NF_CONNTRACK_PPTP | ||
252 | select NF_NAT_PROTO_GRE | ||
253 | |||
254 | config NF_NAT_H323 | ||
255 | tristate | ||
256 | depends on NF_CONNTRACK && NF_NAT_IPV4 | ||
257 | default NF_NAT_IPV4 && NF_CONNTRACK_H323 | ||
258 | 266 | ||
259 | # mangle + specific targets | 267 | # mangle + specific targets |
260 | config IP_NF_MANGLE | 268 | config IP_NF_MANGLE |
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index 33001621465b..edf4af32e9f2 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile | |||
@@ -43,7 +43,7 @@ obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o | |||
43 | # the three instances of ip_tables | 43 | # the three instances of ip_tables |
44 | obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o | 44 | obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o |
45 | obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o | 45 | obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o |
46 | obj-$(CONFIG_NF_NAT_IPV4) += iptable_nat.o | 46 | obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o |
47 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o | 47 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o |
48 | obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o | 48 | obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o |
49 | 49 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index eaa4b000c7b4..173e7ea54c70 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2265,9 +2265,9 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, | |||
2265 | return rt; | 2265 | return rt; |
2266 | 2266 | ||
2267 | if (flp4->flowi4_proto) | 2267 | if (flp4->flowi4_proto) |
2268 | rt = (struct rtable *) xfrm_lookup(net, &rt->dst, | 2268 | rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst, |
2269 | flowi4_to_flowi(flp4), | 2269 | flowi4_to_flowi(flp4), |
2270 | sk, 0); | 2270 | sk, 0); |
2271 | 2271 | ||
2272 | return rt; | 2272 | return rt; |
2273 | } | 2273 | } |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 0b239fc1816e..3342ee64f2e3 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1690,14 +1690,12 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp) | |||
1690 | addrconf_mod_dad_work(ifp, 0); | 1690 | addrconf_mod_dad_work(ifp, 0); |
1691 | } | 1691 | } |
1692 | 1692 | ||
1693 | /* Join to solicited addr multicast group. */ | 1693 | /* Join to solicited addr multicast group. |
1694 | 1694 | * caller must hold RTNL */ | |
1695 | void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr) | 1695 | void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr) |
1696 | { | 1696 | { |
1697 | struct in6_addr maddr; | 1697 | struct in6_addr maddr; |
1698 | 1698 | ||
1699 | ASSERT_RTNL(); | ||
1700 | |||
1701 | if (dev->flags&(IFF_LOOPBACK|IFF_NOARP)) | 1699 | if (dev->flags&(IFF_LOOPBACK|IFF_NOARP)) |
1702 | return; | 1700 | return; |
1703 | 1701 | ||
@@ -1705,12 +1703,11 @@ void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr) | |||
1705 | ipv6_dev_mc_inc(dev, &maddr); | 1703 | ipv6_dev_mc_inc(dev, &maddr); |
1706 | } | 1704 | } |
1707 | 1705 | ||
1706 | /* caller must hold RTNL */ | ||
1708 | void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) | 1707 | void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) |
1709 | { | 1708 | { |
1710 | struct in6_addr maddr; | 1709 | struct in6_addr maddr; |
1711 | 1710 | ||
1712 | ASSERT_RTNL(); | ||
1713 | |||
1714 | if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP)) | 1711 | if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP)) |
1715 | return; | 1712 | return; |
1716 | 1713 | ||
@@ -1718,12 +1715,11 @@ void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) | |||
1718 | __ipv6_dev_mc_dec(idev, &maddr); | 1715 | __ipv6_dev_mc_dec(idev, &maddr); |
1719 | } | 1716 | } |
1720 | 1717 | ||
1718 | /* caller must hold RTNL */ | ||
1721 | static void addrconf_join_anycast(struct inet6_ifaddr *ifp) | 1719 | static void addrconf_join_anycast(struct inet6_ifaddr *ifp) |
1722 | { | 1720 | { |
1723 | struct in6_addr addr; | 1721 | struct in6_addr addr; |
1724 | 1722 | ||
1725 | ASSERT_RTNL(); | ||
1726 | |||
1727 | if (ifp->prefix_len >= 127) /* RFC 6164 */ | 1723 | if (ifp->prefix_len >= 127) /* RFC 6164 */ |
1728 | return; | 1724 | return; |
1729 | ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); | 1725 | ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); |
@@ -1732,12 +1728,11 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp) | |||
1732 | ipv6_dev_ac_inc(ifp->idev->dev, &addr); | 1728 | ipv6_dev_ac_inc(ifp->idev->dev, &addr); |
1733 | } | 1729 | } |
1734 | 1730 | ||
1731 | /* caller must hold RTNL */ | ||
1735 | static void addrconf_leave_anycast(struct inet6_ifaddr *ifp) | 1732 | static void addrconf_leave_anycast(struct inet6_ifaddr *ifp) |
1736 | { | 1733 | { |
1737 | struct in6_addr addr; | 1734 | struct in6_addr addr; |
1738 | 1735 | ||
1739 | ASSERT_RTNL(); | ||
1740 | |||
1741 | if (ifp->prefix_len >= 127) /* RFC 6164 */ | 1736 | if (ifp->prefix_len >= 127) /* RFC 6164 */ |
1742 | return; | 1737 | return; |
1743 | ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); | 1738 | ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); |
@@ -3099,11 +3094,13 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
3099 | 3094 | ||
3100 | write_unlock_bh(&idev->lock); | 3095 | write_unlock_bh(&idev->lock); |
3101 | 3096 | ||
3102 | /* Step 5: Discard multicast list */ | 3097 | /* Step 5: Discard anycast and multicast list */ |
3103 | if (how) | 3098 | if (how) { |
3099 | ipv6_ac_destroy_dev(idev); | ||
3104 | ipv6_mc_destroy_dev(idev); | 3100 | ipv6_mc_destroy_dev(idev); |
3105 | else | 3101 | } else { |
3106 | ipv6_mc_down(idev); | 3102 | ipv6_mc_down(idev); |
3103 | } | ||
3107 | 3104 | ||
3108 | idev->tstamp = jiffies; | 3105 | idev->tstamp = jiffies; |
3109 | 3106 | ||
@@ -4773,15 +4770,11 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | |||
4773 | addrconf_leave_solict(ifp->idev, &ifp->addr); | 4770 | addrconf_leave_solict(ifp->idev, &ifp->addr); |
4774 | if (!ipv6_addr_any(&ifp->peer_addr)) { | 4771 | if (!ipv6_addr_any(&ifp->peer_addr)) { |
4775 | struct rt6_info *rt; | 4772 | struct rt6_info *rt; |
4776 | struct net_device *dev = ifp->idev->dev; | 4773 | |
4777 | 4774 | rt = addrconf_get_prefix_route(&ifp->peer_addr, 128, | |
4778 | rt = rt6_lookup(dev_net(dev), &ifp->peer_addr, NULL, | 4775 | ifp->idev->dev, 0, 0); |
4779 | dev->ifindex, 1); | 4776 | if (rt && ip6_del_rt(rt)) |
4780 | if (rt) { | 4777 | dst_free(&rt->dst); |
4781 | dst_hold(&rt->dst); | ||
4782 | if (ip6_del_rt(rt)) | ||
4783 | dst_free(&rt->dst); | ||
4784 | } | ||
4785 | } | 4778 | } |
4786 | dst_hold(&ifp->rt->dst); | 4779 | dst_hold(&ifp->rt->dst); |
4787 | 4780 | ||
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 210183244689..9a386842fd62 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -77,6 +77,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
77 | pac->acl_next = NULL; | 77 | pac->acl_next = NULL; |
78 | pac->acl_addr = *addr; | 78 | pac->acl_addr = *addr; |
79 | 79 | ||
80 | rtnl_lock(); | ||
80 | rcu_read_lock(); | 81 | rcu_read_lock(); |
81 | if (ifindex == 0) { | 82 | if (ifindex == 0) { |
82 | struct rt6_info *rt; | 83 | struct rt6_info *rt; |
@@ -137,6 +138,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
137 | 138 | ||
138 | error: | 139 | error: |
139 | rcu_read_unlock(); | 140 | rcu_read_unlock(); |
141 | rtnl_unlock(); | ||
140 | if (pac) | 142 | if (pac) |
141 | sock_kfree_s(sk, pac, sizeof(*pac)); | 143 | sock_kfree_s(sk, pac, sizeof(*pac)); |
142 | return err; | 144 | return err; |
@@ -171,11 +173,13 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
171 | 173 | ||
172 | spin_unlock_bh(&ipv6_sk_ac_lock); | 174 | spin_unlock_bh(&ipv6_sk_ac_lock); |
173 | 175 | ||
176 | rtnl_lock(); | ||
174 | rcu_read_lock(); | 177 | rcu_read_lock(); |
175 | dev = dev_get_by_index_rcu(net, pac->acl_ifindex); | 178 | dev = dev_get_by_index_rcu(net, pac->acl_ifindex); |
176 | if (dev) | 179 | if (dev) |
177 | ipv6_dev_ac_dec(dev, &pac->acl_addr); | 180 | ipv6_dev_ac_dec(dev, &pac->acl_addr); |
178 | rcu_read_unlock(); | 181 | rcu_read_unlock(); |
182 | rtnl_unlock(); | ||
179 | 183 | ||
180 | sock_kfree_s(sk, pac, sizeof(*pac)); | 184 | sock_kfree_s(sk, pac, sizeof(*pac)); |
181 | return 0; | 185 | return 0; |
@@ -198,6 +202,7 @@ void ipv6_sock_ac_close(struct sock *sk) | |||
198 | spin_unlock_bh(&ipv6_sk_ac_lock); | 202 | spin_unlock_bh(&ipv6_sk_ac_lock); |
199 | 203 | ||
200 | prev_index = 0; | 204 | prev_index = 0; |
205 | rtnl_lock(); | ||
201 | rcu_read_lock(); | 206 | rcu_read_lock(); |
202 | while (pac) { | 207 | while (pac) { |
203 | struct ipv6_ac_socklist *next = pac->acl_next; | 208 | struct ipv6_ac_socklist *next = pac->acl_next; |
@@ -212,6 +217,7 @@ void ipv6_sock_ac_close(struct sock *sk) | |||
212 | pac = next; | 217 | pac = next; |
213 | } | 218 | } |
214 | rcu_read_unlock(); | 219 | rcu_read_unlock(); |
220 | rtnl_unlock(); | ||
215 | } | 221 | } |
216 | 222 | ||
217 | static void aca_put(struct ifacaddr6 *ac) | 223 | static void aca_put(struct ifacaddr6 *ac) |
@@ -233,6 +239,8 @@ int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr) | |||
233 | struct rt6_info *rt; | 239 | struct rt6_info *rt; |
234 | int err; | 240 | int err; |
235 | 241 | ||
242 | ASSERT_RTNL(); | ||
243 | |||
236 | idev = in6_dev_get(dev); | 244 | idev = in6_dev_get(dev); |
237 | 245 | ||
238 | if (idev == NULL) | 246 | if (idev == NULL) |
@@ -302,6 +310,8 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr) | |||
302 | { | 310 | { |
303 | struct ifacaddr6 *aca, *prev_aca; | 311 | struct ifacaddr6 *aca, *prev_aca; |
304 | 312 | ||
313 | ASSERT_RTNL(); | ||
314 | |||
305 | write_lock_bh(&idev->lock); | 315 | write_lock_bh(&idev->lock); |
306 | prev_aca = NULL; | 316 | prev_aca = NULL; |
307 | for (aca = idev->ac_list; aca; aca = aca->aca_next) { | 317 | for (aca = idev->ac_list; aca; aca = aca->aca_next) { |
@@ -341,6 +351,27 @@ static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr) | |||
341 | return __ipv6_dev_ac_dec(idev, addr); | 351 | return __ipv6_dev_ac_dec(idev, addr); |
342 | } | 352 | } |
343 | 353 | ||
354 | void ipv6_ac_destroy_dev(struct inet6_dev *idev) | ||
355 | { | ||
356 | struct ifacaddr6 *aca; | ||
357 | |||
358 | write_lock_bh(&idev->lock); | ||
359 | while ((aca = idev->ac_list) != NULL) { | ||
360 | idev->ac_list = aca->aca_next; | ||
361 | write_unlock_bh(&idev->lock); | ||
362 | |||
363 | addrconf_leave_solict(idev, &aca->aca_addr); | ||
364 | |||
365 | dst_hold(&aca->aca_rt->dst); | ||
366 | ip6_del_rt(aca->aca_rt); | ||
367 | |||
368 | aca_put(aca); | ||
369 | |||
370 | write_lock_bh(&idev->lock); | ||
371 | } | ||
372 | write_unlock_bh(&idev->lock); | ||
373 | } | ||
374 | |||
344 | /* | 375 | /* |
345 | * check if the interface has this anycast address | 376 | * check if the interface has this anycast address |
346 | * called with rcu_read_lock() | 377 | * called with rcu_read_lock() |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index cb4459bd1d29..76b7f5ee8f4c 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -643,7 +643,7 @@ static int fib6_commit_metrics(struct dst_entry *dst, | |||
643 | if (dst->flags & DST_HOST) { | 643 | if (dst->flags & DST_HOST) { |
644 | mp = dst_metrics_write_ptr(dst); | 644 | mp = dst_metrics_write_ptr(dst); |
645 | } else { | 645 | } else { |
646 | mp = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); | 646 | mp = kzalloc(sizeof(u32) * RTAX_MAX, GFP_ATOMIC); |
647 | if (!mp) | 647 | if (!mp) |
648 | return -ENOMEM; | 648 | return -ENOMEM; |
649 | dst_init_metrics(dst, mp, 0); | 649 | dst_init_metrics(dst, mp, 0); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 315a55d66079..0a3448b2888f 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1009,7 +1009,7 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, | |||
1009 | if (final_dst) | 1009 | if (final_dst) |
1010 | fl6->daddr = *final_dst; | 1010 | fl6->daddr = *final_dst; |
1011 | 1011 | ||
1012 | return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); | 1012 | return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); |
1013 | } | 1013 | } |
1014 | EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); | 1014 | EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); |
1015 | 1015 | ||
@@ -1041,7 +1041,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, | |||
1041 | if (final_dst) | 1041 | if (final_dst) |
1042 | fl6->daddr = *final_dst; | 1042 | fl6->daddr = *final_dst; |
1043 | 1043 | ||
1044 | return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); | 1044 | return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); |
1045 | } | 1045 | } |
1046 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); | 1046 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); |
1047 | 1047 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 617f0958e164..a23b655a7627 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -172,6 +172,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
172 | mc_lst->next = NULL; | 172 | mc_lst->next = NULL; |
173 | mc_lst->addr = *addr; | 173 | mc_lst->addr = *addr; |
174 | 174 | ||
175 | rtnl_lock(); | ||
175 | rcu_read_lock(); | 176 | rcu_read_lock(); |
176 | if (ifindex == 0) { | 177 | if (ifindex == 0) { |
177 | struct rt6_info *rt; | 178 | struct rt6_info *rt; |
@@ -185,6 +186,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
185 | 186 | ||
186 | if (dev == NULL) { | 187 | if (dev == NULL) { |
187 | rcu_read_unlock(); | 188 | rcu_read_unlock(); |
189 | rtnl_unlock(); | ||
188 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); | 190 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); |
189 | return -ENODEV; | 191 | return -ENODEV; |
190 | } | 192 | } |
@@ -202,6 +204,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
202 | 204 | ||
203 | if (err) { | 205 | if (err) { |
204 | rcu_read_unlock(); | 206 | rcu_read_unlock(); |
207 | rtnl_unlock(); | ||
205 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); | 208 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); |
206 | return err; | 209 | return err; |
207 | } | 210 | } |
@@ -212,6 +215,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
212 | spin_unlock(&ipv6_sk_mc_lock); | 215 | spin_unlock(&ipv6_sk_mc_lock); |
213 | 216 | ||
214 | rcu_read_unlock(); | 217 | rcu_read_unlock(); |
218 | rtnl_unlock(); | ||
215 | 219 | ||
216 | return 0; | 220 | return 0; |
217 | } | 221 | } |
@@ -229,6 +233,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
229 | if (!ipv6_addr_is_multicast(addr)) | 233 | if (!ipv6_addr_is_multicast(addr)) |
230 | return -EINVAL; | 234 | return -EINVAL; |
231 | 235 | ||
236 | rtnl_lock(); | ||
232 | spin_lock(&ipv6_sk_mc_lock); | 237 | spin_lock(&ipv6_sk_mc_lock); |
233 | for (lnk = &np->ipv6_mc_list; | 238 | for (lnk = &np->ipv6_mc_list; |
234 | (mc_lst = rcu_dereference_protected(*lnk, | 239 | (mc_lst = rcu_dereference_protected(*lnk, |
@@ -252,12 +257,15 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
252 | } else | 257 | } else |
253 | (void) ip6_mc_leave_src(sk, mc_lst, NULL); | 258 | (void) ip6_mc_leave_src(sk, mc_lst, NULL); |
254 | rcu_read_unlock(); | 259 | rcu_read_unlock(); |
260 | rtnl_unlock(); | ||
261 | |||
255 | atomic_sub(sizeof(*mc_lst), &sk->sk_omem_alloc); | 262 | atomic_sub(sizeof(*mc_lst), &sk->sk_omem_alloc); |
256 | kfree_rcu(mc_lst, rcu); | 263 | kfree_rcu(mc_lst, rcu); |
257 | return 0; | 264 | return 0; |
258 | } | 265 | } |
259 | } | 266 | } |
260 | spin_unlock(&ipv6_sk_mc_lock); | 267 | spin_unlock(&ipv6_sk_mc_lock); |
268 | rtnl_unlock(); | ||
261 | 269 | ||
262 | return -EADDRNOTAVAIL; | 270 | return -EADDRNOTAVAIL; |
263 | } | 271 | } |
@@ -302,6 +310,7 @@ void ipv6_sock_mc_close(struct sock *sk) | |||
302 | if (!rcu_access_pointer(np->ipv6_mc_list)) | 310 | if (!rcu_access_pointer(np->ipv6_mc_list)) |
303 | return; | 311 | return; |
304 | 312 | ||
313 | rtnl_lock(); | ||
305 | spin_lock(&ipv6_sk_mc_lock); | 314 | spin_lock(&ipv6_sk_mc_lock); |
306 | while ((mc_lst = rcu_dereference_protected(np->ipv6_mc_list, | 315 | while ((mc_lst = rcu_dereference_protected(np->ipv6_mc_list, |
307 | lockdep_is_held(&ipv6_sk_mc_lock))) != NULL) { | 316 | lockdep_is_held(&ipv6_sk_mc_lock))) != NULL) { |
@@ -328,6 +337,7 @@ void ipv6_sock_mc_close(struct sock *sk) | |||
328 | spin_lock(&ipv6_sk_mc_lock); | 337 | spin_lock(&ipv6_sk_mc_lock); |
329 | } | 338 | } |
330 | spin_unlock(&ipv6_sk_mc_lock); | 339 | spin_unlock(&ipv6_sk_mc_lock); |
340 | rtnl_unlock(); | ||
331 | } | 341 | } |
332 | 342 | ||
333 | int ip6_mc_source(int add, int omode, struct sock *sk, | 343 | int ip6_mc_source(int add, int omode, struct sock *sk, |
@@ -845,6 +855,8 @@ int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr) | |||
845 | struct ifmcaddr6 *mc; | 855 | struct ifmcaddr6 *mc; |
846 | struct inet6_dev *idev; | 856 | struct inet6_dev *idev; |
847 | 857 | ||
858 | ASSERT_RTNL(); | ||
859 | |||
848 | /* we need to take a reference on idev */ | 860 | /* we need to take a reference on idev */ |
849 | idev = in6_dev_get(dev); | 861 | idev = in6_dev_get(dev); |
850 | 862 | ||
@@ -916,6 +928,8 @@ int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr) | |||
916 | { | 928 | { |
917 | struct ifmcaddr6 *ma, **map; | 929 | struct ifmcaddr6 *ma, **map; |
918 | 930 | ||
931 | ASSERT_RTNL(); | ||
932 | |||
919 | write_lock_bh(&idev->lock); | 933 | write_lock_bh(&idev->lock); |
920 | for (map = &idev->mc_list; (ma=*map) != NULL; map = &ma->next) { | 934 | for (map = &idev->mc_list; (ma=*map) != NULL; map = &ma->next) { |
921 | if (ipv6_addr_equal(&ma->mca_addr, addr)) { | 935 | if (ipv6_addr_equal(&ma->mca_addr, addr)) { |
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index ac93df16f5af..2812816aabdc 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
@@ -57,9 +57,19 @@ config NFT_REJECT_IPV6 | |||
57 | 57 | ||
58 | config NF_LOG_IPV6 | 58 | config NF_LOG_IPV6 |
59 | tristate "IPv6 packet logging" | 59 | tristate "IPv6 packet logging" |
60 | depends on NETFILTER_ADVANCED | 60 | default m if NETFILTER_ADVANCED=n |
61 | select NF_LOG_COMMON | 61 | select NF_LOG_COMMON |
62 | 62 | ||
63 | config NF_NAT_IPV6 | ||
64 | tristate "IPv6 NAT" | ||
65 | depends on NF_CONNTRACK_IPV6 | ||
66 | depends on NETFILTER_ADVANCED | ||
67 | select NF_NAT | ||
68 | help | ||
69 | The IPv6 NAT option allows masquerading, port forwarding and other | ||
70 | forms of full Network Address Port Translation. This can be | ||
71 | controlled by iptables or nft. | ||
72 | |||
63 | config IP6_NF_IPTABLES | 73 | config IP6_NF_IPTABLES |
64 | tristate "IP6 tables support (required for filtering)" | 74 | tristate "IP6 tables support (required for filtering)" |
65 | depends on INET && IPV6 | 75 | depends on INET && IPV6 |
@@ -232,19 +242,21 @@ config IP6_NF_SECURITY | |||
232 | 242 | ||
233 | If unsure, say N. | 243 | If unsure, say N. |
234 | 244 | ||
235 | config NF_NAT_IPV6 | 245 | config IP6_NF_NAT |
236 | tristate "IPv6 NAT" | 246 | tristate "ip6tables NAT support" |
237 | depends on NF_CONNTRACK_IPV6 | 247 | depends on NF_CONNTRACK_IPV6 |
238 | depends on NETFILTER_ADVANCED | 248 | depends on NETFILTER_ADVANCED |
239 | select NF_NAT | 249 | select NF_NAT |
250 | select NF_NAT_IPV6 | ||
251 | select NETFILTER_XT_NAT | ||
240 | help | 252 | help |
241 | The IPv6 NAT option allows masquerading, port forwarding and other | 253 | This enables the `nat' table in ip6tables. This allows masquerading, |
242 | forms of full Network Address Port Translation. It is controlled by | 254 | port forwarding and other forms of full Network Address Port |
243 | the `nat' table in ip6tables, see the man page for ip6tables(8). | 255 | Translation. |
244 | 256 | ||
245 | To compile it as a module, choose M here. If unsure, say N. | 257 | To compile it as a module, choose M here. If unsure, say N. |
246 | 258 | ||
247 | if NF_NAT_IPV6 | 259 | if IP6_NF_NAT |
248 | 260 | ||
249 | config IP6_NF_TARGET_MASQUERADE | 261 | config IP6_NF_TARGET_MASQUERADE |
250 | tristate "MASQUERADE target support" | 262 | tristate "MASQUERADE target support" |
@@ -265,7 +277,7 @@ config IP6_NF_TARGET_NPT | |||
265 | 277 | ||
266 | To compile it as a module, choose M here. If unsure, say N. | 278 | To compile it as a module, choose M here. If unsure, say N. |
267 | 279 | ||
268 | endif # NF_NAT_IPV6 | 280 | endif # IP6_NF_NAT |
269 | 281 | ||
270 | endif # IP6_NF_IPTABLES | 282 | endif # IP6_NF_IPTABLES |
271 | 283 | ||
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile index c0b263104ed2..c3d3286db4bb 100644 --- a/net/ipv6/netfilter/Makefile +++ b/net/ipv6/netfilter/Makefile | |||
@@ -8,7 +8,7 @@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o | |||
8 | obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o | 8 | obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o |
9 | obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o | 9 | obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o |
10 | obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o | 10 | obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o |
11 | obj-$(CONFIG_NF_NAT_IPV6) += ip6table_nat.o | 11 | obj-$(CONFIG_IP6_NF_NAT) += ip6table_nat.o |
12 | 12 | ||
13 | # objects for l3 independent conntrack | 13 | # objects for l3 independent conntrack |
14 | nf_conntrack_ipv6-y := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o | 14 | nf_conntrack_ipv6-y := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o |
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 13752d96275e..b704a9356208 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -755,7 +755,8 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
755 | /* If PMTU discovery was enabled, use the MTU that was discovered */ | 755 | /* If PMTU discovery was enabled, use the MTU that was discovered */ |
756 | dst = sk_dst_get(tunnel->sock); | 756 | dst = sk_dst_get(tunnel->sock); |
757 | if (dst != NULL) { | 757 | if (dst != NULL) { |
758 | u32 pmtu = dst_mtu(__sk_dst_get(tunnel->sock)); | 758 | u32 pmtu = dst_mtu(dst); |
759 | |||
759 | if (pmtu != 0) | 760 | if (pmtu != 0) |
760 | session->mtu = session->mru = pmtu - | 761 | session->mtu = session->mru = pmtu - |
761 | PPPOL2TP_HEADER_OVERHEAD; | 762 | PPPOL2TP_HEADER_OVERHEAD; |
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 6d537f03c0ba..399ad82c997f 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -541,6 +541,8 @@ static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, | |||
541 | continue; | 541 | continue; |
542 | if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf) | 542 | if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf) |
543 | continue; | 543 | continue; |
544 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | ||
545 | continue; | ||
544 | 546 | ||
545 | if (!compat) | 547 | if (!compat) |
546 | compat = &sdata->vif.bss_conf.chandef; | 548 | compat = &sdata->vif.bss_conf.chandef; |
@@ -1444,7 +1446,7 @@ ieee80211_vif_use_reserved_switch(struct ieee80211_local *local) | |||
1444 | 1446 | ||
1445 | list_del(&sdata->reserved_chanctx_list); | 1447 | list_del(&sdata->reserved_chanctx_list); |
1446 | list_move(&sdata->assigned_chanctx_list, | 1448 | list_move(&sdata->assigned_chanctx_list, |
1447 | &new_ctx->assigned_vifs); | 1449 | &ctx->assigned_vifs); |
1448 | sdata->reserved_chanctx = NULL; | 1450 | sdata->reserved_chanctx = NULL; |
1449 | 1451 | ||
1450 | ieee80211_vif_chanctx_reservation_complete(sdata); | 1452 | ieee80211_vif_chanctx_reservation_complete(sdata); |
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 3db96648b45a..86173c0de40e 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -167,7 +167,7 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, | |||
167 | p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n", | 167 | p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n", |
168 | sta->ampdu_mlme.dialog_token_allocator + 1); | 168 | sta->ampdu_mlme.dialog_token_allocator + 1); |
169 | p += scnprintf(p, sizeof(buf) + buf - p, | 169 | p += scnprintf(p, sizeof(buf) + buf - p, |
170 | "TID\t\tRX active\tDTKN\tSSN\t\tTX\tDTKN\tpending\n"); | 170 | "TID\t\tRX\tDTKN\tSSN\t\tTX\tDTKN\tpending\n"); |
171 | 171 | ||
172 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) { | 172 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) { |
173 | tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]); | 173 | tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 01eede7406a5..f75e5f132c5a 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1175,8 +1175,8 @@ static void ieee80211_iface_work(struct work_struct *work) | |||
1175 | if (sta) { | 1175 | if (sta) { |
1176 | u16 last_seq; | 1176 | u16 last_seq; |
1177 | 1177 | ||
1178 | last_seq = le16_to_cpu( | 1178 | last_seq = IEEE80211_SEQ_TO_SN(le16_to_cpu( |
1179 | sta->last_seq_ctrl[rx_agg->tid]); | 1179 | sta->last_seq_ctrl[rx_agg->tid])); |
1180 | 1180 | ||
1181 | __ieee80211_start_rx_ba_session(sta, | 1181 | __ieee80211_start_rx_ba_session(sta, |
1182 | 0, 0, | 1182 | 0, 0, |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 63b874101b27..c47194d27149 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -959,7 +959,8 @@ mesh_plink_get_event(struct ieee80211_sub_if_data *sdata, | |||
959 | if (!matches_local) | 959 | if (!matches_local) |
960 | event = CNF_RJCT; | 960 | event = CNF_RJCT; |
961 | if (!mesh_plink_free_count(sdata) || | 961 | if (!mesh_plink_free_count(sdata) || |
962 | (sta->llid != llid || sta->plid != plid)) | 962 | sta->llid != llid || |
963 | (sta->plid && sta->plid != plid)) | ||
963 | event = CNF_IGNR; | 964 | event = CNF_IGNR; |
964 | else | 965 | else |
965 | event = CNF_ACPT; | 966 | event = CNF_ACPT; |
@@ -1080,6 +1081,10 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata, | |||
1080 | goto unlock_rcu; | 1081 | goto unlock_rcu; |
1081 | } | 1082 | } |
1082 | 1083 | ||
1084 | /* 802.11-2012 13.3.7.2 - update plid on CNF if not set */ | ||
1085 | if (!sta->plid && event == CNF_ACPT) | ||
1086 | sta->plid = plid; | ||
1087 | |||
1083 | changed |= mesh_plink_fsm(sdata, sta, event); | 1088 | changed |= mesh_plink_fsm(sdata, sta, event); |
1084 | 1089 | ||
1085 | unlock_rcu: | 1090 | unlock_rcu: |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 31a8afaf7332..b82a12a9f0f1 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -4376,8 +4376,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
4376 | rcu_read_unlock(); | 4376 | rcu_read_unlock(); |
4377 | 4377 | ||
4378 | if (bss->wmm_used && bss->uapsd_supported && | 4378 | if (bss->wmm_used && bss->uapsd_supported && |
4379 | (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) && | 4379 | (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)) { |
4380 | sdata->wmm_acm != 0xff) { | ||
4381 | assoc_data->uapsd = true; | 4380 | assoc_data->uapsd = true; |
4382 | ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; | 4381 | ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; |
4383 | } else { | 4382 | } else { |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index c6ee2139fbc5..a1e433b88c66 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -1094,8 +1094,11 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
1094 | unsigned long flags; | 1094 | unsigned long flags; |
1095 | struct ps_data *ps; | 1095 | struct ps_data *ps; |
1096 | 1096 | ||
1097 | if (sdata->vif.type == NL80211_IFTYPE_AP || | 1097 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
1098 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 1098 | sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, |
1099 | u.ap); | ||
1100 | |||
1101 | if (sdata->vif.type == NL80211_IFTYPE_AP) | ||
1099 | ps = &sdata->bss->ps; | 1102 | ps = &sdata->bss->ps; |
1100 | else if (ieee80211_vif_is_mesh(&sdata->vif)) | 1103 | else if (ieee80211_vif_is_mesh(&sdata->vif)) |
1101 | ps = &sdata->u.mesh.ps; | 1104 | ps = &sdata->u.mesh.ps; |
@@ -1819,7 +1822,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
1819 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; | 1822 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; |
1820 | if (sdata->vif.bss_conf.use_short_slot) | 1823 | if (sdata->vif.bss_conf.use_short_slot) |
1821 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; | 1824 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; |
1822 | sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period; | 1825 | sinfo->bss_param.dtim_period = sdata->vif.bss_conf.dtim_period; |
1823 | sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; | 1826 | sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; |
1824 | 1827 | ||
1825 | sinfo->sta_flags.set = 0; | 1828 | sinfo->sta_flags.set = 0; |
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 3c3069fd6971..547838822d5e 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c | |||
@@ -462,7 +462,10 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb, | |||
462 | skb->pkt_type = PACKET_OTHERHOST; | 462 | skb->pkt_type = PACKET_OTHERHOST; |
463 | break; | 463 | break; |
464 | default: | 464 | default: |
465 | break; | 465 | spin_unlock_bh(&sdata->mib_lock); |
466 | pr_debug("invalid dest mode\n"); | ||
467 | kfree_skb(skb); | ||
468 | return NET_RX_DROP; | ||
466 | } | 469 | } |
467 | 470 | ||
468 | spin_unlock_bh(&sdata->mib_lock); | 471 | spin_unlock_bh(&sdata->mib_lock); |
@@ -573,6 +576,7 @@ void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb) | |||
573 | ret = mac802154_parse_frame_start(skb, &hdr); | 576 | ret = mac802154_parse_frame_start(skb, &hdr); |
574 | if (ret) { | 577 | if (ret) { |
575 | pr_debug("got invalid frame\n"); | 578 | pr_debug("got invalid frame\n"); |
579 | kfree_skb(skb); | ||
576 | return; | 580 | return; |
577 | } | 581 | } |
578 | 582 | ||
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index ad751fe2e82b..b5c1d3aadb41 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -499,7 +499,7 @@ config NFT_LIMIT | |||
499 | config NFT_NAT | 499 | config NFT_NAT |
500 | depends on NF_TABLES | 500 | depends on NF_TABLES |
501 | depends on NF_CONNTRACK | 501 | depends on NF_CONNTRACK |
502 | depends on NF_NAT | 502 | select NF_NAT |
503 | tristate "Netfilter nf_tables nat module" | 503 | tristate "Netfilter nf_tables nat module" |
504 | help | 504 | help |
505 | This option adds the "nat" expression that you can use to perform | 505 | This option adds the "nat" expression that you can use to perform |
@@ -747,7 +747,9 @@ config NETFILTER_XT_TARGET_LED | |||
747 | 747 | ||
748 | config NETFILTER_XT_TARGET_LOG | 748 | config NETFILTER_XT_TARGET_LOG |
749 | tristate "LOG target support" | 749 | tristate "LOG target support" |
750 | depends on NF_LOG_IPV4 && NF_LOG_IPV6 | 750 | select NF_LOG_COMMON |
751 | select NF_LOG_IPV4 | ||
752 | select NF_LOG_IPV6 if IPV6 | ||
751 | default m if NETFILTER_ADVANCED=n | 753 | default m if NETFILTER_ADVANCED=n |
752 | help | 754 | help |
753 | This option adds a `LOG' target, which allows you to create rules in | 755 | This option adds a `LOG' target, which allows you to create rules in |
@@ -764,6 +766,14 @@ config NETFILTER_XT_TARGET_MARK | |||
764 | (e.g. when running oldconfig). It selects | 766 | (e.g. when running oldconfig). It selects |
765 | CONFIG_NETFILTER_XT_MARK (combined mark/MARK module). | 767 | CONFIG_NETFILTER_XT_MARK (combined mark/MARK module). |
766 | 768 | ||
769 | config NETFILTER_XT_NAT | ||
770 | tristate '"SNAT and DNAT" targets support' | ||
771 | depends on NF_NAT | ||
772 | ---help--- | ||
773 | This option enables the SNAT and DNAT targets. | ||
774 | |||
775 | To compile it as a module, choose M here. If unsure, say N. | ||
776 | |||
767 | config NETFILTER_XT_TARGET_NETMAP | 777 | config NETFILTER_XT_TARGET_NETMAP |
768 | tristate '"NETMAP" target support' | 778 | tristate '"NETMAP" target support' |
769 | depends on NF_NAT | 779 | depends on NF_NAT |
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile index 8308624a406a..fad5fdba34e5 100644 --- a/net/netfilter/Makefile +++ b/net/netfilter/Makefile | |||
@@ -95,7 +95,7 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o | |||
95 | obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o | 95 | obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o |
96 | obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o | 96 | obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o |
97 | obj-$(CONFIG_NETFILTER_XT_SET) += xt_set.o | 97 | obj-$(CONFIG_NETFILTER_XT_SET) += xt_set.o |
98 | obj-$(CONFIG_NF_NAT) += xt_nat.o | 98 | obj-$(CONFIG_NETFILTER_XT_NAT) += xt_nat.o |
99 | 99 | ||
100 | # targets | 100 | # targets |
101 | obj-$(CONFIG_NETFILTER_XT_TARGET_AUDIT) += xt_AUDIT.o | 101 | obj-$(CONFIG_NETFILTER_XT_TARGET_AUDIT) += xt_AUDIT.o |
diff --git a/net/netfilter/core.c b/net/netfilter/core.c index a93c97f106d4..024a2e25c8a4 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c | |||
@@ -54,7 +54,7 @@ EXPORT_SYMBOL_GPL(nf_unregister_afinfo); | |||
54 | struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly; | 54 | struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly; |
55 | EXPORT_SYMBOL(nf_hooks); | 55 | EXPORT_SYMBOL(nf_hooks); |
56 | 56 | ||
57 | #if defined(CONFIG_JUMP_LABEL) | 57 | #ifdef HAVE_JUMP_LABEL |
58 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 58 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
59 | EXPORT_SYMBOL(nf_hooks_needed); | 59 | EXPORT_SYMBOL(nf_hooks_needed); |
60 | #endif | 60 | #endif |
@@ -72,7 +72,7 @@ int nf_register_hook(struct nf_hook_ops *reg) | |||
72 | } | 72 | } |
73 | list_add_rcu(®->list, elem->list.prev); | 73 | list_add_rcu(®->list, elem->list.prev); |
74 | mutex_unlock(&nf_hook_mutex); | 74 | mutex_unlock(&nf_hook_mutex); |
75 | #if defined(CONFIG_JUMP_LABEL) | 75 | #ifdef HAVE_JUMP_LABEL |
76 | static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]); | 76 | static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]); |
77 | #endif | 77 | #endif |
78 | return 0; | 78 | return 0; |
@@ -84,7 +84,7 @@ void nf_unregister_hook(struct nf_hook_ops *reg) | |||
84 | mutex_lock(&nf_hook_mutex); | 84 | mutex_lock(&nf_hook_mutex); |
85 | list_del_rcu(®->list); | 85 | list_del_rcu(®->list); |
86 | mutex_unlock(&nf_hook_mutex); | 86 | mutex_unlock(&nf_hook_mutex); |
87 | #if defined(CONFIG_JUMP_LABEL) | 87 | #ifdef HAVE_JUMP_LABEL |
88 | static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]); | 88 | static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]); |
89 | #endif | 89 | #endif |
90 | synchronize_net(); | 90 | synchronize_net(); |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index e6836755c45d..5c34e8d42e01 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1906,7 +1906,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
1906 | { | 1906 | { |
1907 | .hook = ip_vs_local_reply6, | 1907 | .hook = ip_vs_local_reply6, |
1908 | .owner = THIS_MODULE, | 1908 | .owner = THIS_MODULE, |
1909 | .pf = NFPROTO_IPV4, | 1909 | .pf = NFPROTO_IPV6, |
1910 | .hooknum = NF_INET_LOCAL_OUT, | 1910 | .hooknum = NF_INET_LOCAL_OUT, |
1911 | .priority = NF_IP6_PRI_NAT_DST + 1, | 1911 | .priority = NF_IP6_PRI_NAT_DST + 1, |
1912 | }, | 1912 | }, |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 6f70bdd3a90a..56896a412bce 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <net/route.h> /* for ip_route_output */ | 38 | #include <net/route.h> /* for ip_route_output */ |
39 | #include <net/ipv6.h> | 39 | #include <net/ipv6.h> |
40 | #include <net/ip6_route.h> | 40 | #include <net/ip6_route.h> |
41 | #include <net/ip_tunnels.h> | ||
41 | #include <net/addrconf.h> | 42 | #include <net/addrconf.h> |
42 | #include <linux/icmpv6.h> | 43 | #include <linux/icmpv6.h> |
43 | #include <linux/netfilter.h> | 44 | #include <linux/netfilter.h> |
@@ -862,11 +863,15 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
862 | old_iph = ip_hdr(skb); | 863 | old_iph = ip_hdr(skb); |
863 | } | 864 | } |
864 | 865 | ||
865 | skb->transport_header = skb->network_header; | ||
866 | |||
867 | /* fix old IP header checksum */ | 866 | /* fix old IP header checksum */ |
868 | ip_send_check(old_iph); | 867 | ip_send_check(old_iph); |
869 | 868 | ||
869 | skb = iptunnel_handle_offloads(skb, false, SKB_GSO_IPIP); | ||
870 | if (IS_ERR(skb)) | ||
871 | goto tx_error; | ||
872 | |||
873 | skb->transport_header = skb->network_header; | ||
874 | |||
870 | skb_push(skb, sizeof(struct iphdr)); | 875 | skb_push(skb, sizeof(struct iphdr)); |
871 | skb_reset_network_header(skb); | 876 | skb_reset_network_header(skb); |
872 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 877 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
@@ -900,7 +905,8 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
900 | return NF_STOLEN; | 905 | return NF_STOLEN; |
901 | 906 | ||
902 | tx_error: | 907 | tx_error: |
903 | kfree_skb(skb); | 908 | if (!IS_ERR(skb)) |
909 | kfree_skb(skb); | ||
904 | rcu_read_unlock(); | 910 | rcu_read_unlock(); |
905 | LeaveFunction(10); | 911 | LeaveFunction(10); |
906 | return NF_STOLEN; | 912 | return NF_STOLEN; |
@@ -953,6 +959,11 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
953 | old_iph = ipv6_hdr(skb); | 959 | old_iph = ipv6_hdr(skb); |
954 | } | 960 | } |
955 | 961 | ||
962 | /* GSO: we need to provide proper SKB_GSO_ value for IPv6 */ | ||
963 | skb = iptunnel_handle_offloads(skb, false, 0); /* SKB_GSO_SIT/IPV6 */ | ||
964 | if (IS_ERR(skb)) | ||
965 | goto tx_error; | ||
966 | |||
956 | skb->transport_header = skb->network_header; | 967 | skb->transport_header = skb->network_header; |
957 | 968 | ||
958 | skb_push(skb, sizeof(struct ipv6hdr)); | 969 | skb_push(skb, sizeof(struct ipv6hdr)); |
@@ -988,7 +999,8 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
988 | return NF_STOLEN; | 999 | return NF_STOLEN; |
989 | 1000 | ||
990 | tx_error: | 1001 | tx_error: |
991 | kfree_skb(skb); | 1002 | if (!IS_ERR(skb)) |
1003 | kfree_skb(skb); | ||
992 | rcu_read_unlock(); | 1004 | rcu_read_unlock(); |
993 | LeaveFunction(10); | 1005 | LeaveFunction(10); |
994 | return NF_STOLEN; | 1006 | return NF_STOLEN; |
diff --git a/net/netfilter/xt_cgroup.c b/net/netfilter/xt_cgroup.c index f4e833005320..7198d660b4de 100644 --- a/net/netfilter/xt_cgroup.c +++ b/net/netfilter/xt_cgroup.c | |||
@@ -31,7 +31,7 @@ static int cgroup_mt_check(const struct xt_mtchk_param *par) | |||
31 | if (info->invert & ~1) | 31 | if (info->invert & ~1) |
32 | return -EINVAL; | 32 | return -EINVAL; |
33 | 33 | ||
34 | return info->id ? 0 : -EINVAL; | 34 | return 0; |
35 | } | 35 | } |
36 | 36 | ||
37 | static bool | 37 | static bool |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index fe5cda0deb39..5231652a95d9 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -42,6 +42,9 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
42 | 42 | ||
43 | static int make_writable(struct sk_buff *skb, int write_len) | 43 | static int make_writable(struct sk_buff *skb, int write_len) |
44 | { | 44 | { |
45 | if (!pskb_may_pull(skb, write_len)) | ||
46 | return -ENOMEM; | ||
47 | |||
45 | if (!skb_cloned(skb) || skb_clone_writable(skb, write_len)) | 48 | if (!skb_cloned(skb) || skb_clone_writable(skb, write_len)) |
46 | return 0; | 49 | return 0; |
47 | 50 | ||
@@ -70,6 +73,8 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci) | |||
70 | 73 | ||
71 | vlan_set_encap_proto(skb, vhdr); | 74 | vlan_set_encap_proto(skb, vhdr); |
72 | skb->mac_header += VLAN_HLEN; | 75 | skb->mac_header += VLAN_HLEN; |
76 | if (skb_network_offset(skb) < ETH_HLEN) | ||
77 | skb_set_network_header(skb, ETH_HLEN); | ||
73 | skb_reset_mac_len(skb); | 78 | skb_reset_mac_len(skb); |
74 | 79 | ||
75 | return 0; | 80 | return 0; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 7228ec3faf19..64dc864a417f 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -78,11 +78,12 @@ static const struct genl_multicast_group ovs_dp_vport_multicast_group = { | |||
78 | 78 | ||
79 | /* Check if need to build a reply message. | 79 | /* Check if need to build a reply message. |
80 | * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */ | 80 | * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */ |
81 | static bool ovs_must_notify(struct genl_info *info, | 81 | static bool ovs_must_notify(struct genl_family *family, struct genl_info *info, |
82 | const struct genl_multicast_group *grp) | 82 | unsigned int group) |
83 | { | 83 | { |
84 | return info->nlhdr->nlmsg_flags & NLM_F_ECHO || | 84 | return info->nlhdr->nlmsg_flags & NLM_F_ECHO || |
85 | netlink_has_listeners(genl_info_net(info)->genl_sock, 0); | 85 | genl_has_listeners(family, genl_info_net(info)->genl_sock, |
86 | group); | ||
86 | } | 87 | } |
87 | 88 | ||
88 | static void ovs_notify(struct genl_family *family, | 89 | static void ovs_notify(struct genl_family *family, |
@@ -265,8 +266,11 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb) | |||
265 | upcall.key = &key; | 266 | upcall.key = &key; |
266 | upcall.userdata = NULL; | 267 | upcall.userdata = NULL; |
267 | upcall.portid = ovs_vport_find_upcall_portid(p, skb); | 268 | upcall.portid = ovs_vport_find_upcall_portid(p, skb); |
268 | ovs_dp_upcall(dp, skb, &upcall); | 269 | error = ovs_dp_upcall(dp, skb, &upcall); |
269 | consume_skb(skb); | 270 | if (unlikely(error)) |
271 | kfree_skb(skb); | ||
272 | else | ||
273 | consume_skb(skb); | ||
270 | stats_counter = &stats->n_missed; | 274 | stats_counter = &stats->n_missed; |
271 | goto out; | 275 | goto out; |
272 | } | 276 | } |
@@ -404,7 +408,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, | |||
404 | { | 408 | { |
405 | struct ovs_header *upcall; | 409 | struct ovs_header *upcall; |
406 | struct sk_buff *nskb = NULL; | 410 | struct sk_buff *nskb = NULL; |
407 | struct sk_buff *user_skb; /* to be queued to userspace */ | 411 | struct sk_buff *user_skb = NULL; /* to be queued to userspace */ |
408 | struct nlattr *nla; | 412 | struct nlattr *nla; |
409 | struct genl_info info = { | 413 | struct genl_info info = { |
410 | .dst_sk = ovs_dp_get_net(dp)->genl_sock, | 414 | .dst_sk = ovs_dp_get_net(dp)->genl_sock, |
@@ -494,9 +498,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, | |||
494 | ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len; | 498 | ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len; |
495 | 499 | ||
496 | err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); | 500 | err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); |
501 | user_skb = NULL; | ||
497 | out: | 502 | out: |
498 | if (err) | 503 | if (err) |
499 | skb_tx_error(skb); | 504 | skb_tx_error(skb); |
505 | kfree_skb(user_skb); | ||
500 | kfree_skb(nskb); | 506 | kfree_skb(nskb); |
501 | return err; | 507 | return err; |
502 | } | 508 | } |
@@ -758,7 +764,7 @@ static struct sk_buff *ovs_flow_cmd_alloc_info(const struct sw_flow_actions *act | |||
758 | { | 764 | { |
759 | struct sk_buff *skb; | 765 | struct sk_buff *skb; |
760 | 766 | ||
761 | if (!always && !ovs_must_notify(info, &ovs_dp_flow_multicast_group)) | 767 | if (!always && !ovs_must_notify(&dp_flow_genl_family, info, 0)) |
762 | return NULL; | 768 | return NULL; |
763 | 769 | ||
764 | skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL); | 770 | skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL); |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8d9f8042705a..93896d2092f6 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -632,6 +632,7 @@ static void init_prb_bdqc(struct packet_sock *po, | |||
632 | p1->tov_in_jiffies = msecs_to_jiffies(p1->retire_blk_tov); | 632 | p1->tov_in_jiffies = msecs_to_jiffies(p1->retire_blk_tov); |
633 | p1->blk_sizeof_priv = req_u->req3.tp_sizeof_priv; | 633 | p1->blk_sizeof_priv = req_u->req3.tp_sizeof_priv; |
634 | 634 | ||
635 | p1->max_frame_len = p1->kblk_size - BLK_PLUS_PRIV(p1->blk_sizeof_priv); | ||
635 | prb_init_ft_ops(p1, req_u); | 636 | prb_init_ft_ops(p1, req_u); |
636 | prb_setup_retire_blk_timer(po, tx_ring); | 637 | prb_setup_retire_blk_timer(po, tx_ring); |
637 | prb_open_block(p1, pbd); | 638 | prb_open_block(p1, pbd); |
@@ -1942,6 +1943,18 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1942 | if ((int)snaplen < 0) | 1943 | if ((int)snaplen < 0) |
1943 | snaplen = 0; | 1944 | snaplen = 0; |
1944 | } | 1945 | } |
1946 | } else if (unlikely(macoff + snaplen > | ||
1947 | GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len)) { | ||
1948 | u32 nval; | ||
1949 | |||
1950 | nval = GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len - macoff; | ||
1951 | pr_err_once("tpacket_rcv: packet too big, clamped from %u to %u. macoff=%u\n", | ||
1952 | snaplen, nval, macoff); | ||
1953 | snaplen = nval; | ||
1954 | if (unlikely((int)snaplen < 0)) { | ||
1955 | snaplen = 0; | ||
1956 | macoff = GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len; | ||
1957 | } | ||
1945 | } | 1958 | } |
1946 | spin_lock(&sk->sk_receive_queue.lock); | 1959 | spin_lock(&sk->sk_receive_queue.lock); |
1947 | h.raw = packet_current_rx_frame(po, skb, | 1960 | h.raw = packet_current_rx_frame(po, skb, |
@@ -3783,6 +3796,10 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
3783 | goto out; | 3796 | goto out; |
3784 | if (unlikely(req->tp_block_size & (PAGE_SIZE - 1))) | 3797 | if (unlikely(req->tp_block_size & (PAGE_SIZE - 1))) |
3785 | goto out; | 3798 | goto out; |
3799 | if (po->tp_version >= TPACKET_V3 && | ||
3800 | (int)(req->tp_block_size - | ||
3801 | BLK_PLUS_PRIV(req_u->req3.tp_sizeof_priv)) <= 0) | ||
3802 | goto out; | ||
3786 | if (unlikely(req->tp_frame_size < po->tp_hdrlen + | 3803 | if (unlikely(req->tp_frame_size < po->tp_hdrlen + |
3787 | po->tp_reserve)) | 3804 | po->tp_reserve)) |
3788 | goto out; | 3805 | goto out; |
diff --git a/net/packet/internal.h b/net/packet/internal.h index eb9580a6b25f..cdddf6a30399 100644 --- a/net/packet/internal.h +++ b/net/packet/internal.h | |||
@@ -29,6 +29,7 @@ struct tpacket_kbdq_core { | |||
29 | char *pkblk_start; | 29 | char *pkblk_start; |
30 | char *pkblk_end; | 30 | char *pkblk_end; |
31 | int kblk_size; | 31 | int kblk_size; |
32 | unsigned int max_frame_len; | ||
32 | unsigned int knum_blocks; | 33 | unsigned int knum_blocks; |
33 | uint64_t knxt_seq_num; | 34 | uint64_t knxt_seq_num; |
34 | char *prev; | 35 | char *prev; |
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 14c98e48f261..0f62326c0f5e 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c | |||
@@ -54,7 +54,7 @@ static int rfkill_gpio_set_power(void *data, bool blocked) | |||
54 | if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled) | 54 | if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled) |
55 | clk_disable(rfkill->clk); | 55 | clk_disable(rfkill->clk); |
56 | 56 | ||
57 | rfkill->clk_enabled = blocked; | 57 | rfkill->clk_enabled = !blocked; |
58 | 58 | ||
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
@@ -158,10 +158,12 @@ static const struct acpi_device_id rfkill_acpi_match[] = { | |||
158 | { "BCM2E1A", RFKILL_TYPE_BLUETOOTH }, | 158 | { "BCM2E1A", RFKILL_TYPE_BLUETOOTH }, |
159 | { "BCM2E39", RFKILL_TYPE_BLUETOOTH }, | 159 | { "BCM2E39", RFKILL_TYPE_BLUETOOTH }, |
160 | { "BCM2E3D", RFKILL_TYPE_BLUETOOTH }, | 160 | { "BCM2E3D", RFKILL_TYPE_BLUETOOTH }, |
161 | { "BCM2E64", RFKILL_TYPE_BLUETOOTH }, | ||
161 | { "BCM4752", RFKILL_TYPE_GPS }, | 162 | { "BCM4752", RFKILL_TYPE_GPS }, |
162 | { "LNV4752", RFKILL_TYPE_GPS }, | 163 | { "LNV4752", RFKILL_TYPE_GPS }, |
163 | { }, | 164 | { }, |
164 | }; | 165 | }; |
166 | MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match); | ||
165 | #endif | 167 | #endif |
166 | 168 | ||
167 | static struct platform_driver rfkill_gpio_driver = { | 169 | static struct platform_driver rfkill_gpio_driver = { |
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c index b45d080e64a7..1b24191167f1 100644 --- a/net/rxrpc/ar-key.c +++ b/net/rxrpc/ar-key.c | |||
@@ -1143,7 +1143,7 @@ static long rxrpc_read(const struct key *key, | |||
1143 | if (copy_to_user(xdr, (s), _l) != 0) \ | 1143 | if (copy_to_user(xdr, (s), _l) != 0) \ |
1144 | goto fault; \ | 1144 | goto fault; \ |
1145 | if (_l & 3 && \ | 1145 | if (_l & 3 && \ |
1146 | copy_to_user((u8 *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \ | 1146 | copy_to_user((u8 __user *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \ |
1147 | goto fault; \ | 1147 | goto fault; \ |
1148 | xdr += (_l + 3) >> 2; \ | 1148 | xdr += (_l + 3) >> 2; \ |
1149 | } while(0) | 1149 | } while(0) |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index ead526467cca..762a04bb8f6d 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -159,7 +159,6 @@ struct cbq_sched_data { | |||
159 | struct cbq_class *tx_borrowed; | 159 | struct cbq_class *tx_borrowed; |
160 | int tx_len; | 160 | int tx_len; |
161 | psched_time_t now; /* Cached timestamp */ | 161 | psched_time_t now; /* Cached timestamp */ |
162 | psched_time_t now_rt; /* Cached real time */ | ||
163 | unsigned int pmask; | 162 | unsigned int pmask; |
164 | 163 | ||
165 | struct hrtimer delay_timer; | 164 | struct hrtimer delay_timer; |
@@ -353,12 +352,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl) | |||
353 | int toplevel = q->toplevel; | 352 | int toplevel = q->toplevel; |
354 | 353 | ||
355 | if (toplevel > cl->level && !(qdisc_is_throttled(cl->q))) { | 354 | if (toplevel > cl->level && !(qdisc_is_throttled(cl->q))) { |
356 | psched_time_t now; | 355 | psched_time_t now = psched_get_time(); |
357 | psched_tdiff_t incr; | ||
358 | |||
359 | now = psched_get_time(); | ||
360 | incr = now - q->now_rt; | ||
361 | now = q->now + incr; | ||
362 | 356 | ||
363 | do { | 357 | do { |
364 | if (cl->undertime < now) { | 358 | if (cl->undertime < now) { |
@@ -700,8 +694,13 @@ cbq_update(struct cbq_sched_data *q) | |||
700 | struct cbq_class *this = q->tx_class; | 694 | struct cbq_class *this = q->tx_class; |
701 | struct cbq_class *cl = this; | 695 | struct cbq_class *cl = this; |
702 | int len = q->tx_len; | 696 | int len = q->tx_len; |
697 | psched_time_t now; | ||
703 | 698 | ||
704 | q->tx_class = NULL; | 699 | q->tx_class = NULL; |
700 | /* Time integrator. We calculate EOS time | ||
701 | * by adding expected packet transmission time. | ||
702 | */ | ||
703 | now = q->now + L2T(&q->link, len); | ||
705 | 704 | ||
706 | for ( ; cl; cl = cl->share) { | 705 | for ( ; cl; cl = cl->share) { |
707 | long avgidle = cl->avgidle; | 706 | long avgidle = cl->avgidle; |
@@ -717,7 +716,7 @@ cbq_update(struct cbq_sched_data *q) | |||
717 | * idle = (now - last) - last_pktlen/rate | 716 | * idle = (now - last) - last_pktlen/rate |
718 | */ | 717 | */ |
719 | 718 | ||
720 | idle = q->now - cl->last; | 719 | idle = now - cl->last; |
721 | if ((unsigned long)idle > 128*1024*1024) { | 720 | if ((unsigned long)idle > 128*1024*1024) { |
722 | avgidle = cl->maxidle; | 721 | avgidle = cl->maxidle; |
723 | } else { | 722 | } else { |
@@ -761,7 +760,7 @@ cbq_update(struct cbq_sched_data *q) | |||
761 | idle -= L2T(&q->link, len); | 760 | idle -= L2T(&q->link, len); |
762 | idle += L2T(cl, len); | 761 | idle += L2T(cl, len); |
763 | 762 | ||
764 | cl->undertime = q->now + idle; | 763 | cl->undertime = now + idle; |
765 | } else { | 764 | } else { |
766 | /* Underlimit */ | 765 | /* Underlimit */ |
767 | 766 | ||
@@ -771,7 +770,8 @@ cbq_update(struct cbq_sched_data *q) | |||
771 | else | 770 | else |
772 | cl->avgidle = avgidle; | 771 | cl->avgidle = avgidle; |
773 | } | 772 | } |
774 | cl->last = q->now; | 773 | if ((s64)(now - cl->last) > 0) |
774 | cl->last = now; | ||
775 | } | 775 | } |
776 | 776 | ||
777 | cbq_update_toplevel(q, this, q->tx_borrowed); | 777 | cbq_update_toplevel(q, this, q->tx_borrowed); |
@@ -943,31 +943,13 @@ cbq_dequeue(struct Qdisc *sch) | |||
943 | struct sk_buff *skb; | 943 | struct sk_buff *skb; |
944 | struct cbq_sched_data *q = qdisc_priv(sch); | 944 | struct cbq_sched_data *q = qdisc_priv(sch); |
945 | psched_time_t now; | 945 | psched_time_t now; |
946 | psched_tdiff_t incr; | ||
947 | 946 | ||
948 | now = psched_get_time(); | 947 | now = psched_get_time(); |
949 | incr = now - q->now_rt; | 948 | |
950 | 949 | if (q->tx_class) | |
951 | if (q->tx_class) { | ||
952 | psched_tdiff_t incr2; | ||
953 | /* Time integrator. We calculate EOS time | ||
954 | * by adding expected packet transmission time. | ||
955 | * If real time is greater, we warp artificial clock, | ||
956 | * so that: | ||
957 | * | ||
958 | * cbq_time = max(real_time, work); | ||
959 | */ | ||
960 | incr2 = L2T(&q->link, q->tx_len); | ||
961 | q->now += incr2; | ||
962 | cbq_update(q); | 950 | cbq_update(q); |
963 | if ((incr -= incr2) < 0) | 951 | |
964 | incr = 0; | 952 | q->now = now; |
965 | q->now += incr; | ||
966 | } else { | ||
967 | if (now > q->now) | ||
968 | q->now = now; | ||
969 | } | ||
970 | q->now_rt = now; | ||
971 | 953 | ||
972 | for (;;) { | 954 | for (;;) { |
973 | q->wd_expires = 0; | 955 | q->wd_expires = 0; |
@@ -1223,7 +1205,6 @@ cbq_reset(struct Qdisc *sch) | |||
1223 | hrtimer_cancel(&q->delay_timer); | 1205 | hrtimer_cancel(&q->delay_timer); |
1224 | q->toplevel = TC_CBQ_MAXLEVEL; | 1206 | q->toplevel = TC_CBQ_MAXLEVEL; |
1225 | q->now = psched_get_time(); | 1207 | q->now = psched_get_time(); |
1226 | q->now_rt = q->now; | ||
1227 | 1208 | ||
1228 | for (prio = 0; prio <= TC_CBQ_MAXPRIO; prio++) | 1209 | for (prio = 0; prio <= TC_CBQ_MAXPRIO; prio++) |
1229 | q->active[prio] = NULL; | 1210 | q->active[prio] = NULL; |
@@ -1407,7 +1388,6 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt) | |||
1407 | q->delay_timer.function = cbq_undelay; | 1388 | q->delay_timer.function = cbq_undelay; |
1408 | q->toplevel = TC_CBQ_MAXLEVEL; | 1389 | q->toplevel = TC_CBQ_MAXLEVEL; |
1409 | q->now = psched_get_time(); | 1390 | q->now = psched_get_time(); |
1410 | q->now_rt = q->now; | ||
1411 | 1391 | ||
1412 | cbq_link_class(&q->link); | 1392 | cbq_link_class(&q->link); |
1413 | 1393 | ||
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index ed30e436128b..fb666d1e4de3 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
@@ -133,10 +133,16 @@ static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx) | |||
133 | --sch->q.qlen; | 133 | --sch->q.qlen; |
134 | } | 134 | } |
135 | 135 | ||
136 | /* private part of skb->cb[] that a qdisc is allowed to use | ||
137 | * is limited to QDISC_CB_PRIV_LEN bytes. | ||
138 | * As a flow key might be too large, we store a part of it only. | ||
139 | */ | ||
140 | #define CHOKE_K_LEN min_t(u32, sizeof(struct flow_keys), QDISC_CB_PRIV_LEN - 3) | ||
141 | |||
136 | struct choke_skb_cb { | 142 | struct choke_skb_cb { |
137 | u16 classid; | 143 | u16 classid; |
138 | u8 keys_valid; | 144 | u8 keys_valid; |
139 | struct flow_keys keys; | 145 | u8 keys[QDISC_CB_PRIV_LEN - 3]; |
140 | }; | 146 | }; |
141 | 147 | ||
142 | static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) | 148 | static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) |
@@ -163,22 +169,26 @@ static u16 choke_get_classid(const struct sk_buff *skb) | |||
163 | static bool choke_match_flow(struct sk_buff *skb1, | 169 | static bool choke_match_flow(struct sk_buff *skb1, |
164 | struct sk_buff *skb2) | 170 | struct sk_buff *skb2) |
165 | { | 171 | { |
172 | struct flow_keys temp; | ||
173 | |||
166 | if (skb1->protocol != skb2->protocol) | 174 | if (skb1->protocol != skb2->protocol) |
167 | return false; | 175 | return false; |
168 | 176 | ||
169 | if (!choke_skb_cb(skb1)->keys_valid) { | 177 | if (!choke_skb_cb(skb1)->keys_valid) { |
170 | choke_skb_cb(skb1)->keys_valid = 1; | 178 | choke_skb_cb(skb1)->keys_valid = 1; |
171 | skb_flow_dissect(skb1, &choke_skb_cb(skb1)->keys); | 179 | skb_flow_dissect(skb1, &temp); |
180 | memcpy(&choke_skb_cb(skb1)->keys, &temp, CHOKE_K_LEN); | ||
172 | } | 181 | } |
173 | 182 | ||
174 | if (!choke_skb_cb(skb2)->keys_valid) { | 183 | if (!choke_skb_cb(skb2)->keys_valid) { |
175 | choke_skb_cb(skb2)->keys_valid = 1; | 184 | choke_skb_cb(skb2)->keys_valid = 1; |
176 | skb_flow_dissect(skb2, &choke_skb_cb(skb2)->keys); | 185 | skb_flow_dissect(skb2, &temp); |
186 | memcpy(&choke_skb_cb(skb2)->keys, &temp, CHOKE_K_LEN); | ||
177 | } | 187 | } |
178 | 188 | ||
179 | return !memcmp(&choke_skb_cb(skb1)->keys, | 189 | return !memcmp(&choke_skb_cb(skb1)->keys, |
180 | &choke_skb_cb(skb2)->keys, | 190 | &choke_skb_cb(skb2)->keys, |
181 | sizeof(struct flow_keys)); | 191 | CHOKE_K_LEN); |
182 | } | 192 | } |
183 | 193 | ||
184 | /* | 194 | /* |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 06a9ee6b2d3a..a88b8524846e 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -813,6 +813,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
813 | else { | 813 | else { |
814 | dst_release(transport->dst); | 814 | dst_release(transport->dst); |
815 | transport->dst = NULL; | 815 | transport->dst = NULL; |
816 | ulp_notify = false; | ||
816 | } | 817 | } |
817 | 818 | ||
818 | spc_state = SCTP_ADDR_UNREACHABLE; | 819 | spc_state = SCTP_ADDR_UNREACHABLE; |
@@ -1244,7 +1245,7 @@ static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr, | |||
1244 | { | 1245 | { |
1245 | u8 score_curr, score_best; | 1246 | u8 score_curr, score_best; |
1246 | 1247 | ||
1247 | if (best == NULL) | 1248 | if (best == NULL || curr == best) |
1248 | return curr; | 1249 | return curr; |
1249 | 1250 | ||
1250 | score_curr = sctp_trans_score(curr); | 1251 | score_curr = sctp_trans_score(curr); |
@@ -1355,14 +1356,11 @@ static void sctp_select_active_and_retran_path(struct sctp_association *asoc) | |||
1355 | trans_sec = trans_pri; | 1356 | trans_sec = trans_pri; |
1356 | 1357 | ||
1357 | /* If we failed to find a usable transport, just camp on the | 1358 | /* If we failed to find a usable transport, just camp on the |
1358 | * primary or retran, even if they are inactive, if possible | 1359 | * active or pick a PF iff it's the better choice. |
1359 | * pick a PF iff it's the better choice. | ||
1360 | */ | 1360 | */ |
1361 | if (trans_pri == NULL) { | 1361 | if (trans_pri == NULL) { |
1362 | trans_pri = sctp_trans_elect_best(asoc->peer.primary_path, | 1362 | trans_pri = sctp_trans_elect_best(asoc->peer.active_path, trans_pf); |
1363 | asoc->peer.retran_path); | 1363 | trans_sec = trans_pri; |
1364 | trans_pri = sctp_trans_elect_best(trans_pri, trans_pf); | ||
1365 | trans_sec = asoc->peer.primary_path; | ||
1366 | } | 1364 | } |
1367 | 1365 | ||
1368 | /* Set the active and retran transports. */ | 1366 | /* Set the active and retran transports. */ |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index eb71d49e7653..634a2abb5f3a 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4243,7 +4243,7 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, | |||
4243 | transport = asoc->peer.primary_path; | 4243 | transport = asoc->peer.primary_path; |
4244 | 4244 | ||
4245 | status.sstat_assoc_id = sctp_assoc2id(asoc); | 4245 | status.sstat_assoc_id = sctp_assoc2id(asoc); |
4246 | status.sstat_state = asoc->state; | 4246 | status.sstat_state = sctp_assoc_to_state(asoc); |
4247 | status.sstat_rwnd = asoc->peer.rwnd; | 4247 | status.sstat_rwnd = asoc->peer.rwnd; |
4248 | status.sstat_unackdata = asoc->unack_data; | 4248 | status.sstat_unackdata = asoc->unack_data; |
4249 | 4249 | ||
diff --git a/net/socket.c b/net/socket.c index 95ee7d8682e7..4cdbc107606f 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -734,8 +734,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, | |||
734 | } | 734 | } |
735 | 735 | ||
736 | memset(&tss, 0, sizeof(tss)); | 736 | memset(&tss, 0, sizeof(tss)); |
737 | if ((sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE || | 737 | if ((sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) && |
738 | skb_shinfo(skb)->tx_flags & SKBTX_ANY_SW_TSTAMP) && | ||
739 | ktime_to_timespec_cond(skb->tstamp, tss.ts + 0)) | 738 | ktime_to_timespec_cond(skb->tstamp, tss.ts + 0)) |
740 | empty = 0; | 739 | empty = 0; |
741 | if (shhwtstamps && | 740 | if (shhwtstamps && |
@@ -1997,6 +1996,9 @@ static int copy_msghdr_from_user(struct msghdr *kmsg, | |||
1997 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) | 1996 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) |
1998 | return -EFAULT; | 1997 | return -EFAULT; |
1999 | 1998 | ||
1999 | if (kmsg->msg_name == NULL) | ||
2000 | kmsg->msg_namelen = 0; | ||
2001 | |||
2000 | if (kmsg->msg_namelen < 0) | 2002 | if (kmsg->msg_namelen < 0) |
2001 | return -EINVAL; | 2003 | return -EINVAL; |
2002 | 2004 | ||
@@ -2602,7 +2604,7 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
2602 | * | 2604 | * |
2603 | * This function is called by a protocol handler that wants to | 2605 | * This function is called by a protocol handler that wants to |
2604 | * advertise its address family, and have it linked into the | 2606 | * advertise its address family, and have it linked into the |
2605 | * socket interface. The value ops->family coresponds to the | 2607 | * socket interface. The value ops->family corresponds to the |
2606 | * socket system call protocol family. | 2608 | * socket system call protocol family. |
2607 | */ | 2609 | */ |
2608 | int sock_register(const struct net_proto_family *ops) | 2610 | int sock_register(const struct net_proto_family *ops) |
diff --git a/net/tipc/port.h b/net/tipc/port.h index 3f93454592b6..3087da39ee47 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -179,9 +179,12 @@ static inline int tipc_port_importance(struct tipc_port *port) | |||
179 | return msg_importance(&port->phdr); | 179 | return msg_importance(&port->phdr); |
180 | } | 180 | } |
181 | 181 | ||
182 | static inline void tipc_port_set_importance(struct tipc_port *port, int imp) | 182 | static inline int tipc_port_set_importance(struct tipc_port *port, int imp) |
183 | { | 183 | { |
184 | if (imp > TIPC_CRITICAL_IMPORTANCE) | ||
185 | return -EINVAL; | ||
184 | msg_set_importance(&port->phdr, (u32)imp); | 186 | msg_set_importance(&port->phdr, (u32)imp); |
187 | return 0; | ||
185 | } | 188 | } |
186 | 189 | ||
187 | #endif | 190 | #endif |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 7d423ee10897..ff8c8118d56e 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1973,7 +1973,7 @@ static int tipc_setsockopt(struct socket *sock, int lvl, int opt, | |||
1973 | 1973 | ||
1974 | switch (opt) { | 1974 | switch (opt) { |
1975 | case TIPC_IMPORTANCE: | 1975 | case TIPC_IMPORTANCE: |
1976 | tipc_port_set_importance(port, value); | 1976 | res = tipc_port_set_importance(port, value); |
1977 | break; | 1977 | break; |
1978 | case TIPC_SRC_DROPPABLE: | 1978 | case TIPC_SRC_DROPPABLE: |
1979 | if (sock->type != SOCK_STREAM) | 1979 | if (sock->type != SOCK_STREAM) |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index df7b1332a1ec..7257164af91b 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -6969,6 +6969,9 @@ void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp) | |||
6969 | struct nlattr *data = ((void **)skb->cb)[2]; | 6969 | struct nlattr *data = ((void **)skb->cb)[2]; |
6970 | enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; | 6970 | enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; |
6971 | 6971 | ||
6972 | /* clear CB data for netlink core to own from now on */ | ||
6973 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
6974 | |||
6972 | nla_nest_end(skb, data); | 6975 | nla_nest_end(skb, data); |
6973 | genlmsg_end(skb, hdr); | 6976 | genlmsg_end(skb, hdr); |
6974 | 6977 | ||
@@ -9294,6 +9297,9 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb) | |||
9294 | void *hdr = ((void **)skb->cb)[1]; | 9297 | void *hdr = ((void **)skb->cb)[1]; |
9295 | struct nlattr *data = ((void **)skb->cb)[2]; | 9298 | struct nlattr *data = ((void **)skb->cb)[2]; |
9296 | 9299 | ||
9300 | /* clear CB data for netlink core to own from now on */ | ||
9301 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
9302 | |||
9297 | if (WARN_ON(!rdev->cur_cmd_info)) { | 9303 | if (WARN_ON(!rdev->cur_cmd_info)) { |
9298 | kfree_skb(skb); | 9304 | kfree_skb(skb); |
9299 | return -EINVAL; | 9305 | return -EINVAL; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index beeed602aeb3..fdde51f4271a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -39,6 +39,11 @@ | |||
39 | #define XFRM_QUEUE_TMO_MAX ((unsigned)(60*HZ)) | 39 | #define XFRM_QUEUE_TMO_MAX ((unsigned)(60*HZ)) |
40 | #define XFRM_MAX_QUEUE_LEN 100 | 40 | #define XFRM_MAX_QUEUE_LEN 100 |
41 | 41 | ||
42 | struct xfrm_flo { | ||
43 | struct dst_entry *dst_orig; | ||
44 | u8 flags; | ||
45 | }; | ||
46 | |||
42 | static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock); | 47 | static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock); |
43 | static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[NPROTO] | 48 | static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[NPROTO] |
44 | __read_mostly; | 49 | __read_mostly; |
@@ -1877,13 +1882,14 @@ static int xdst_queue_output(struct sock *sk, struct sk_buff *skb) | |||
1877 | } | 1882 | } |
1878 | 1883 | ||
1879 | static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, | 1884 | static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, |
1880 | struct dst_entry *dst, | 1885 | struct xfrm_flo *xflo, |
1881 | const struct flowi *fl, | 1886 | const struct flowi *fl, |
1882 | int num_xfrms, | 1887 | int num_xfrms, |
1883 | u16 family) | 1888 | u16 family) |
1884 | { | 1889 | { |
1885 | int err; | 1890 | int err; |
1886 | struct net_device *dev; | 1891 | struct net_device *dev; |
1892 | struct dst_entry *dst; | ||
1887 | struct dst_entry *dst1; | 1893 | struct dst_entry *dst1; |
1888 | struct xfrm_dst *xdst; | 1894 | struct xfrm_dst *xdst; |
1889 | 1895 | ||
@@ -1891,9 +1897,12 @@ static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, | |||
1891 | if (IS_ERR(xdst)) | 1897 | if (IS_ERR(xdst)) |
1892 | return xdst; | 1898 | return xdst; |
1893 | 1899 | ||
1894 | if (net->xfrm.sysctl_larval_drop || num_xfrms <= 0) | 1900 | if (!(xflo->flags & XFRM_LOOKUP_QUEUE) || |
1901 | net->xfrm.sysctl_larval_drop || | ||
1902 | num_xfrms <= 0) | ||
1895 | return xdst; | 1903 | return xdst; |
1896 | 1904 | ||
1905 | dst = xflo->dst_orig; | ||
1897 | dst1 = &xdst->u.dst; | 1906 | dst1 = &xdst->u.dst; |
1898 | dst_hold(dst); | 1907 | dst_hold(dst); |
1899 | xdst->route = dst; | 1908 | xdst->route = dst; |
@@ -1935,7 +1944,7 @@ static struct flow_cache_object * | |||
1935 | xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, | 1944 | xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, |
1936 | struct flow_cache_object *oldflo, void *ctx) | 1945 | struct flow_cache_object *oldflo, void *ctx) |
1937 | { | 1946 | { |
1938 | struct dst_entry *dst_orig = (struct dst_entry *)ctx; | 1947 | struct xfrm_flo *xflo = (struct xfrm_flo *)ctx; |
1939 | struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; | 1948 | struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; |
1940 | struct xfrm_dst *xdst, *new_xdst; | 1949 | struct xfrm_dst *xdst, *new_xdst; |
1941 | int num_pols = 0, num_xfrms = 0, i, err, pol_dead; | 1950 | int num_pols = 0, num_xfrms = 0, i, err, pol_dead; |
@@ -1976,7 +1985,8 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, | |||
1976 | goto make_dummy_bundle; | 1985 | goto make_dummy_bundle; |
1977 | } | 1986 | } |
1978 | 1987 | ||
1979 | new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, dst_orig); | 1988 | new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, |
1989 | xflo->dst_orig); | ||
1980 | if (IS_ERR(new_xdst)) { | 1990 | if (IS_ERR(new_xdst)) { |
1981 | err = PTR_ERR(new_xdst); | 1991 | err = PTR_ERR(new_xdst); |
1982 | if (err != -EAGAIN) | 1992 | if (err != -EAGAIN) |
@@ -2010,7 +2020,7 @@ make_dummy_bundle: | |||
2010 | /* We found policies, but there's no bundles to instantiate: | 2020 | /* We found policies, but there's no bundles to instantiate: |
2011 | * either because the policy blocks, has no transformations or | 2021 | * either because the policy blocks, has no transformations or |
2012 | * we could not build template (no xfrm_states).*/ | 2022 | * we could not build template (no xfrm_states).*/ |
2013 | xdst = xfrm_create_dummy_bundle(net, dst_orig, fl, num_xfrms, family); | 2023 | xdst = xfrm_create_dummy_bundle(net, xflo, fl, num_xfrms, family); |
2014 | if (IS_ERR(xdst)) { | 2024 | if (IS_ERR(xdst)) { |
2015 | xfrm_pols_put(pols, num_pols); | 2025 | xfrm_pols_put(pols, num_pols); |
2016 | return ERR_CAST(xdst); | 2026 | return ERR_CAST(xdst); |
@@ -2104,13 +2114,18 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
2104 | } | 2114 | } |
2105 | 2115 | ||
2106 | if (xdst == NULL) { | 2116 | if (xdst == NULL) { |
2117 | struct xfrm_flo xflo; | ||
2118 | |||
2119 | xflo.dst_orig = dst_orig; | ||
2120 | xflo.flags = flags; | ||
2121 | |||
2107 | /* To accelerate a bit... */ | 2122 | /* To accelerate a bit... */ |
2108 | if ((dst_orig->flags & DST_NOXFRM) || | 2123 | if ((dst_orig->flags & DST_NOXFRM) || |
2109 | !net->xfrm.policy_count[XFRM_POLICY_OUT]) | 2124 | !net->xfrm.policy_count[XFRM_POLICY_OUT]) |
2110 | goto nopol; | 2125 | goto nopol; |
2111 | 2126 | ||
2112 | flo = flow_cache_lookup(net, fl, family, dir, | 2127 | flo = flow_cache_lookup(net, fl, family, dir, |
2113 | xfrm_bundle_lookup, dst_orig); | 2128 | xfrm_bundle_lookup, &xflo); |
2114 | if (flo == NULL) | 2129 | if (flo == NULL) |
2115 | goto nopol; | 2130 | goto nopol; |
2116 | if (IS_ERR(flo)) { | 2131 | if (IS_ERR(flo)) { |
@@ -2138,7 +2153,7 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
2138 | xfrm_pols_put(pols, drop_pols); | 2153 | xfrm_pols_put(pols, drop_pols); |
2139 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); | 2154 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); |
2140 | 2155 | ||
2141 | return make_blackhole(net, family, dst_orig); | 2156 | return ERR_PTR(-EREMOTE); |
2142 | } | 2157 | } |
2143 | 2158 | ||
2144 | err = -EAGAIN; | 2159 | err = -EAGAIN; |
@@ -2195,6 +2210,23 @@ dropdst: | |||
2195 | } | 2210 | } |
2196 | EXPORT_SYMBOL(xfrm_lookup); | 2211 | EXPORT_SYMBOL(xfrm_lookup); |
2197 | 2212 | ||
2213 | /* Callers of xfrm_lookup_route() must ensure a call to dst_output(). | ||
2214 | * Otherwise we may send out blackholed packets. | ||
2215 | */ | ||
2216 | struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, | ||
2217 | const struct flowi *fl, | ||
2218 | struct sock *sk, int flags) | ||
2219 | { | ||
2220 | struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, | ||
2221 | flags | XFRM_LOOKUP_QUEUE); | ||
2222 | |||
2223 | if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) | ||
2224 | return make_blackhole(net, dst_orig->ops->family, dst_orig); | ||
2225 | |||
2226 | return dst; | ||
2227 | } | ||
2228 | EXPORT_SYMBOL(xfrm_lookup_route); | ||
2229 | |||
2198 | static inline int | 2230 | static inline int |
2199 | xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl) | 2231 | xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl) |
2200 | { | 2232 | { |
@@ -2460,7 +2492,7 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) | |||
2460 | 2492 | ||
2461 | skb_dst_force(skb); | 2493 | skb_dst_force(skb); |
2462 | 2494 | ||
2463 | dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, 0); | 2495 | dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE); |
2464 | if (IS_ERR(dst)) { | 2496 | if (IS_ERR(dst)) { |
2465 | res = 0; | 2497 | res = 0; |
2466 | dst = NULL; | 2498 | dst = NULL; |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 31a731e06f50..4d08b398411f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2133,7 +2133,10 @@ sub process { | |||
2133 | # Check for improperly formed commit descriptions | 2133 | # Check for improperly formed commit descriptions |
2134 | if ($in_commit_log && | 2134 | if ($in_commit_log && |
2135 | $line =~ /\bcommit\s+[0-9a-f]{5,}/i && | 2135 | $line =~ /\bcommit\s+[0-9a-f]{5,}/i && |
2136 | $line !~ /\b[Cc]ommit [0-9a-f]{12,16} \("/) { | 2136 | !($line =~ /\b[Cc]ommit [0-9a-f]{12,40} \("/ || |
2137 | ($line =~ /\b[Cc]ommit [0-9a-f]{12,40}\s*$/ && | ||
2138 | defined $rawlines[$linenr] && | ||
2139 | $rawlines[$linenr] =~ /^\s*\("/))) { | ||
2137 | $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i; | 2140 | $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i; |
2138 | my $init_char = $1; | 2141 | my $init_char = $1; |
2139 | my $orig_commit = lc($2); | 2142 | my $orig_commit = lc($2); |
@@ -2141,7 +2144,7 @@ sub process { | |||
2141 | my $desc = 'commit description'; | 2144 | my $desc = 'commit description'; |
2142 | ($id, $desc) = git_commit_info($orig_commit, $id, $desc); | 2145 | ($id, $desc) = git_commit_info($orig_commit, $id, $desc); |
2143 | ERROR("GIT_COMMIT_ID", | 2146 | ERROR("GIT_COMMIT_ID", |
2144 | "Please use 12 to 16 chars for the git commit ID like: '${init_char}ommit $id (\"$desc\")'\n" . $herecurr); | 2147 | "Please use 12 or more chars for the git commit ID like: '${init_char}ommit $id (\"$desc\")'\n" . $herecurr); |
2145 | } | 2148 | } |
2146 | 2149 | ||
2147 | # Check for added, moved or deleted files | 2150 | # Check for added, moved or deleted files |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 16a07cfa4d34..70bea942b413 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -2085,6 +2085,7 @@ sub dump_function($$) { | |||
2085 | $prototype =~ s/^noinline +//; | 2085 | $prototype =~ s/^noinline +//; |
2086 | $prototype =~ s/__init +//; | 2086 | $prototype =~ s/__init +//; |
2087 | $prototype =~ s/__init_or_module +//; | 2087 | $prototype =~ s/__init_or_module +//; |
2088 | $prototype =~ s/__meminit +//; | ||
2088 | $prototype =~ s/__must_check +//; | 2089 | $prototype =~ s/__must_check +//; |
2089 | $prototype =~ s/__weak +//; | 2090 | $prototype =~ s/__weak +//; |
2090 | my $define = $prototype =~ s/^#\s*define\s+//; #ak added | 2091 | my $define = $prototype =~ s/^#\s*define\s+//; #ak added |
diff --git a/scripts/tags.sh b/scripts/tags.sh index cbfd269a6011..293828bfd4ac 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -197,6 +197,9 @@ exuberant() | |||
197 | --regex-c++='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ | 197 | --regex-c++='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ |
198 | --regex-c++='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ | 198 | --regex-c++='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ |
199 | --regex-c++='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ | 199 | --regex-c++='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ |
200 | --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ | ||
201 | --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ | ||
202 | --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\ | ||
200 | --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ | 203 | --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ |
201 | --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ | 204 | --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ |
202 | --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ | 205 | --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ |
@@ -260,6 +263,9 @@ emacs() | |||
260 | --regex='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ | 263 | --regex='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ |
261 | --regex='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ | 264 | --regex='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ |
262 | --regex='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ | 265 | --regex='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ |
266 | --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ | ||
267 | --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ | ||
268 | --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \ | ||
263 | --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ | 269 | --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ |
264 | --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ | 270 | --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ |
265 | --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ | 271 | --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ |
diff --git a/security/keys/key.c b/security/keys/key.c index b90a68c4e2c4..6d0cad16f002 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
@@ -27,8 +27,8 @@ DEFINE_SPINLOCK(key_serial_lock); | |||
27 | struct rb_root key_user_tree; /* tree of quota records indexed by UID */ | 27 | struct rb_root key_user_tree; /* tree of quota records indexed by UID */ |
28 | DEFINE_SPINLOCK(key_user_lock); | 28 | DEFINE_SPINLOCK(key_user_lock); |
29 | 29 | ||
30 | unsigned int key_quota_root_maxkeys = 200; /* root's key count quota */ | 30 | unsigned int key_quota_root_maxkeys = 1000000; /* root's key count quota */ |
31 | unsigned int key_quota_root_maxbytes = 20000; /* root's key space quota */ | 31 | unsigned int key_quota_root_maxbytes = 25000000; /* root's key space quota */ |
32 | unsigned int key_quota_maxkeys = 200; /* general key count quota */ | 32 | unsigned int key_quota_maxkeys = 200; /* general key count quota */ |
33 | unsigned int key_quota_maxbytes = 20000; /* general key space quota */ | 33 | unsigned int key_quota_maxbytes = 20000; /* general key space quota */ |
34 | 34 | ||
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index a3386d119425..bed745c8b1a3 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer, | |||
173 | * Use filesystem name if filesystem does not support rename() | 173 | * Use filesystem name if filesystem does not support rename() |
174 | * operation. | 174 | * operation. |
175 | */ | 175 | */ |
176 | if (!inode->i_op->rename) | 176 | if (!inode->i_op->rename && !inode->i_op->rename2) |
177 | goto prepend_filesystem_name; | 177 | goto prepend_filesystem_name; |
178 | } | 178 | } |
179 | /* Prepend device name. */ | 179 | /* Prepend device name. */ |
@@ -282,7 +282,8 @@ char *tomoyo_realpath_from_path(struct path *path) | |||
282 | * Get local name for filesystems without rename() operation | 282 | * Get local name for filesystems without rename() operation |
283 | * or dentry without vfsmount. | 283 | * or dentry without vfsmount. |
284 | */ | 284 | */ |
285 | if (!path->mnt || !inode->i_op->rename) | 285 | if (!path->mnt || |
286 | (!inode->i_op->rename && !inode->i_op->rename2)) | ||
286 | pos = tomoyo_get_local_path(path->dentry, buf, | 287 | pos = tomoyo_get_local_path(path->dentry, buf, |
287 | buf_len - 1); | 288 | buf_len - 1); |
288 | /* Get absolute name for the rest. */ | 289 | /* Get absolute name for the rest. */ |
diff --git a/sound/core/info.c b/sound/core/info.c index 051d55b05521..9f404e965ea2 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -684,7 +684,7 @@ int snd_info_card_free(struct snd_card *card) | |||
684 | * snd_info_get_line - read one line from the procfs buffer | 684 | * snd_info_get_line - read one line from the procfs buffer |
685 | * @buffer: the procfs buffer | 685 | * @buffer: the procfs buffer |
686 | * @line: the buffer to store | 686 | * @line: the buffer to store |
687 | * @len: the max. buffer size - 1 | 687 | * @len: the max. buffer size |
688 | * | 688 | * |
689 | * Reads one line from the buffer and stores the string. | 689 | * Reads one line from the buffer and stores the string. |
690 | * | 690 | * |
@@ -704,7 +704,7 @@ int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len) | |||
704 | buffer->stop = 1; | 704 | buffer->stop = 1; |
705 | if (c == '\n') | 705 | if (c == '\n') |
706 | break; | 706 | break; |
707 | if (len) { | 707 | if (len > 1) { |
708 | len--; | 708 | len--; |
709 | *line++ = c; | 709 | *line++ = c; |
710 | } | 710 | } |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 9acc77eae487..0032278567ad 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1782,14 +1782,16 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, | |||
1782 | { | 1782 | { |
1783 | struct snd_pcm_hw_params *params = arg; | 1783 | struct snd_pcm_hw_params *params = arg; |
1784 | snd_pcm_format_t format; | 1784 | snd_pcm_format_t format; |
1785 | int channels, width; | 1785 | int channels; |
1786 | ssize_t frame_size; | ||
1786 | 1787 | ||
1787 | params->fifo_size = substream->runtime->hw.fifo_size; | 1788 | params->fifo_size = substream->runtime->hw.fifo_size; |
1788 | if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_FIFO_IN_FRAMES)) { | 1789 | if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_FIFO_IN_FRAMES)) { |
1789 | format = params_format(params); | 1790 | format = params_format(params); |
1790 | channels = params_channels(params); | 1791 | channels = params_channels(params); |
1791 | width = snd_pcm_format_physical_width(format); | 1792 | frame_size = snd_pcm_format_size(format, channels); |
1792 | params->fifo_size /= width * channels; | 1793 | if (frame_size > 0) |
1794 | params->fifo_size /= (unsigned)frame_size; | ||
1793 | } | 1795 | } |
1794 | return 0; | 1796 | return 0; |
1795 | } | 1797 | } |
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index 4560ca0e5651..2c6fd80e0bd1 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c | |||
@@ -142,11 +142,11 @@ static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = { | |||
142 | }, | 142 | }, |
143 | [SNDRV_PCM_FORMAT_DSD_U8] = { | 143 | [SNDRV_PCM_FORMAT_DSD_U8] = { |
144 | .width = 8, .phys = 8, .le = 1, .signd = 0, | 144 | .width = 8, .phys = 8, .le = 1, .signd = 0, |
145 | .silence = {}, | 145 | .silence = { 0x69 }, |
146 | }, | 146 | }, |
147 | [SNDRV_PCM_FORMAT_DSD_U16_LE] = { | 147 | [SNDRV_PCM_FORMAT_DSD_U16_LE] = { |
148 | .width = 16, .phys = 16, .le = 1, .signd = 0, | 148 | .width = 16, .phys = 16, .le = 1, .signd = 0, |
149 | .silence = {}, | 149 | .silence = { 0x69, 0x69 }, |
150 | }, | 150 | }, |
151 | /* FIXME: the following three formats are not defined properly yet */ | 151 | /* FIXME: the following three formats are not defined properly yet */ |
152 | [SNDRV_PCM_FORMAT_MPEG] = { | 152 | [SNDRV_PCM_FORMAT_MPEG] = { |
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index f96bf4c7c232..95fc2eaf11dc 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c | |||
@@ -507,7 +507,16 @@ static void amdtp_pull_midi(struct amdtp_stream *s, | |||
507 | static void update_pcm_pointers(struct amdtp_stream *s, | 507 | static void update_pcm_pointers(struct amdtp_stream *s, |
508 | struct snd_pcm_substream *pcm, | 508 | struct snd_pcm_substream *pcm, |
509 | unsigned int frames) | 509 | unsigned int frames) |
510 | { unsigned int ptr; | 510 | { |
511 | unsigned int ptr; | ||
512 | |||
513 | /* | ||
514 | * In IEC 61883-6, one data block represents one event. In ALSA, one | ||
515 | * event equals to one PCM frame. But Dice has a quirk to transfer | ||
516 | * two PCM frames in one data block. | ||
517 | */ | ||
518 | if (s->double_pcm_frames) | ||
519 | frames *= 2; | ||
511 | 520 | ||
512 | ptr = s->pcm_buffer_pointer + frames; | 521 | ptr = s->pcm_buffer_pointer + frames; |
513 | if (ptr >= pcm->runtime->buffer_size) | 522 | if (ptr >= pcm->runtime->buffer_size) |
diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h index d8ee7b0e9386..4823c08196ac 100644 --- a/sound/firewire/amdtp.h +++ b/sound/firewire/amdtp.h | |||
@@ -125,6 +125,7 @@ struct amdtp_stream { | |||
125 | unsigned int pcm_buffer_pointer; | 125 | unsigned int pcm_buffer_pointer; |
126 | unsigned int pcm_period_pointer; | 126 | unsigned int pcm_period_pointer; |
127 | bool pointer_flush; | 127 | bool pointer_flush; |
128 | bool double_pcm_frames; | ||
128 | 129 | ||
129 | struct snd_rawmidi_substream *midi[AMDTP_MAX_CHANNELS_FOR_MIDI * 8]; | 130 | struct snd_rawmidi_substream *midi[AMDTP_MAX_CHANNELS_FOR_MIDI * 8]; |
130 | 131 | ||
diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c index a9a30c0161f1..e3a04d69c853 100644 --- a/sound/firewire/dice.c +++ b/sound/firewire/dice.c | |||
@@ -567,10 +567,14 @@ static int dice_hw_params(struct snd_pcm_substream *substream, | |||
567 | return err; | 567 | return err; |
568 | 568 | ||
569 | /* | 569 | /* |
570 | * At rates above 96 kHz, pretend that the stream runs at half the | 570 | * At 176.4/192.0 kHz, Dice has a quirk to transfer two PCM frames in |
571 | * actual sample rate with twice the number of channels; two samples | 571 | * one data block of AMDTP packet. Thus sampling transfer frequency is |
572 | * of a channel are stored consecutively in the packet. Requires | 572 | * a half of PCM sampling frequency, i.e. PCM frames at 192.0 kHz are |
573 | * blocking mode and PCM buffer size should be aligned to SYT_INTERVAL. | 573 | * transferred on AMDTP packets at 96 kHz. Two successive samples of a |
574 | * channel are stored consecutively in the packet. This quirk is called | ||
575 | * as 'Dual Wire'. | ||
576 | * For this quirk, blocking mode is required and PCM buffer size should | ||
577 | * be aligned to SYT_INTERVAL. | ||
574 | */ | 578 | */ |
575 | channels = params_channels(hw_params); | 579 | channels = params_channels(hw_params); |
576 | if (rate_index > 4) { | 580 | if (rate_index > 4) { |
@@ -579,18 +583,25 @@ static int dice_hw_params(struct snd_pcm_substream *substream, | |||
579 | return err; | 583 | return err; |
580 | } | 584 | } |
581 | 585 | ||
582 | for (i = 0; i < channels; i++) { | ||
583 | dice->stream.pcm_positions[i * 2] = i; | ||
584 | dice->stream.pcm_positions[i * 2 + 1] = i + channels; | ||
585 | } | ||
586 | |||
587 | rate /= 2; | 586 | rate /= 2; |
588 | channels *= 2; | 587 | channels *= 2; |
588 | dice->stream.double_pcm_frames = true; | ||
589 | } else { | ||
590 | dice->stream.double_pcm_frames = false; | ||
589 | } | 591 | } |
590 | 592 | ||
591 | mode = rate_index_to_mode(rate_index); | 593 | mode = rate_index_to_mode(rate_index); |
592 | amdtp_stream_set_parameters(&dice->stream, rate, channels, | 594 | amdtp_stream_set_parameters(&dice->stream, rate, channels, |
593 | dice->rx_midi_ports[mode]); | 595 | dice->rx_midi_ports[mode]); |
596 | if (rate_index > 4) { | ||
597 | channels /= 2; | ||
598 | |||
599 | for (i = 0; i < channels; i++) { | ||
600 | dice->stream.pcm_positions[i] = i * 2; | ||
601 | dice->stream.pcm_positions[i + channels] = i * 2 + 1; | ||
602 | } | ||
603 | } | ||
604 | |||
594 | amdtp_stream_set_pcm_format(&dice->stream, | 605 | amdtp_stream_set_pcm_format(&dice->stream, |
595 | params_format(hw_params)); | 606 | params_format(hw_params)); |
596 | 607 | ||
diff --git a/sound/pci/ctxfi/ct20k1reg.h b/sound/pci/ctxfi/ct20k1reg.h index f2e34e3f27ee..5851249f11d9 100644 --- a/sound/pci/ctxfi/ct20k1reg.h +++ b/sound/pci/ctxfi/ct20k1reg.h | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #ifndef CT20K1REG_H | 9 | #ifndef CT20K1REG_H |
10 | #define CT20k1REG_H | 10 | #define CT20K1REG_H |
11 | 11 | ||
12 | /* 20k1 registers */ | 12 | /* 20k1 registers */ |
13 | #define DSPXRAM_START 0x000000 | 13 | #define DSPXRAM_START 0x000000 |
@@ -632,5 +632,3 @@ | |||
632 | #define I2SD_R 0x19L | 632 | #define I2SD_R 0x19L |
633 | 633 | ||
634 | #endif /* CT20K1REG_H */ | 634 | #endif /* CT20K1REG_H */ |
635 | |||
636 | |||
diff --git a/sound/pci/hda/ca0132_regs.h b/sound/pci/hda/ca0132_regs.h index 07e760937d3c..8371274aa811 100644 --- a/sound/pci/hda/ca0132_regs.h +++ b/sound/pci/hda/ca0132_regs.h | |||
@@ -20,7 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef __CA0132_REGS_H | 22 | #ifndef __CA0132_REGS_H |
23 | #define __CA0312_REGS_H | 23 | #define __CA0132_REGS_H |
24 | 24 | ||
25 | #define DSP_CHIP_OFFSET 0x100000 | 25 | #define DSP_CHIP_OFFSET 0x100000 |
26 | #define DSP_DBGCNTL_MODULE_OFFSET 0xE30 | 26 | #define DSP_DBGCNTL_MODULE_OFFSET 0xE30 |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 6f2fa838b635..47ccb8f44adb 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -217,6 +217,7 @@ enum { | |||
217 | CXT_FIXUP_HEADPHONE_MIC_PIN, | 217 | CXT_FIXUP_HEADPHONE_MIC_PIN, |
218 | CXT_FIXUP_HEADPHONE_MIC, | 218 | CXT_FIXUP_HEADPHONE_MIC, |
219 | CXT_FIXUP_GPIO1, | 219 | CXT_FIXUP_GPIO1, |
220 | CXT_FIXUP_ASPIRE_DMIC, | ||
220 | CXT_FIXUP_THINKPAD_ACPI, | 221 | CXT_FIXUP_THINKPAD_ACPI, |
221 | CXT_FIXUP_OLPC_XO, | 222 | CXT_FIXUP_OLPC_XO, |
222 | CXT_FIXUP_CAP_MIX_AMP, | 223 | CXT_FIXUP_CAP_MIX_AMP, |
@@ -664,6 +665,12 @@ static const struct hda_fixup cxt_fixups[] = { | |||
664 | { } | 665 | { } |
665 | }, | 666 | }, |
666 | }, | 667 | }, |
668 | [CXT_FIXUP_ASPIRE_DMIC] = { | ||
669 | .type = HDA_FIXUP_FUNC, | ||
670 | .v.func = cxt_fixup_stereo_dmic, | ||
671 | .chained = true, | ||
672 | .chain_id = CXT_FIXUP_GPIO1, | ||
673 | }, | ||
667 | [CXT_FIXUP_THINKPAD_ACPI] = { | 674 | [CXT_FIXUP_THINKPAD_ACPI] = { |
668 | .type = HDA_FIXUP_FUNC, | 675 | .type = HDA_FIXUP_FUNC, |
669 | .v.func = hda_fixup_thinkpad_acpi, | 676 | .v.func = hda_fixup_thinkpad_acpi, |
@@ -744,7 +751,7 @@ static const struct hda_model_fixup cxt5051_fixup_models[] = { | |||
744 | 751 | ||
745 | static const struct snd_pci_quirk cxt5066_fixups[] = { | 752 | static const struct snd_pci_quirk cxt5066_fixups[] = { |
746 | SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), | 753 | SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), |
747 | SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_GPIO1), | 754 | SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), |
748 | SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), | 755 | SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), |
749 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), | 756 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), |
750 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), | 757 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), |
@@ -770,6 +777,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = { | |||
770 | { .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" }, | 777 | { .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" }, |
771 | { .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" }, | 778 | { .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" }, |
772 | { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, | 779 | { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, |
780 | { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, | ||
773 | { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, | 781 | { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, |
774 | {} | 782 | {} |
775 | }; | 783 | }; |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 36badba2dcec..99d7d7fecaad 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -50,6 +50,8 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); | |||
50 | #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec)) | 50 | #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec)) |
51 | 51 | ||
52 | #define is_valleyview(codec) ((codec)->vendor_id == 0x80862882) | 52 | #define is_valleyview(codec) ((codec)->vendor_id == 0x80862882) |
53 | #define is_cherryview(codec) ((codec)->vendor_id == 0x80862883) | ||
54 | #define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) | ||
53 | 55 | ||
54 | struct hdmi_spec_per_cvt { | 56 | struct hdmi_spec_per_cvt { |
55 | hda_nid_t cvt_nid; | 57 | hda_nid_t cvt_nid; |
@@ -1459,7 +1461,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, | |||
1459 | mux_idx); | 1461 | mux_idx); |
1460 | 1462 | ||
1461 | /* configure unused pins to choose other converters */ | 1463 | /* configure unused pins to choose other converters */ |
1462 | if (is_haswell_plus(codec) || is_valleyview(codec)) | 1464 | if (is_haswell_plus(codec) || is_valleyview_plus(codec)) |
1463 | intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx); | 1465 | intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx); |
1464 | 1466 | ||
1465 | snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); | 1467 | snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); |
@@ -1598,7 +1600,8 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | |||
1598 | * and this can make HW reset converter selection on a pin. | 1600 | * and this can make HW reset converter selection on a pin. |
1599 | */ | 1601 | */ |
1600 | if (eld->eld_valid && !old_eld_valid && per_pin->setup) { | 1602 | if (eld->eld_valid && !old_eld_valid && per_pin->setup) { |
1601 | if (is_haswell_plus(codec) || is_valleyview(codec)) { | 1603 | if (is_haswell_plus(codec) || |
1604 | is_valleyview_plus(codec)) { | ||
1602 | intel_verify_pin_cvt_connect(codec, per_pin); | 1605 | intel_verify_pin_cvt_connect(codec, per_pin); |
1603 | intel_not_share_assigned_cvt(codec, pin_nid, | 1606 | intel_not_share_assigned_cvt(codec, pin_nid, |
1604 | per_pin->mux_idx); | 1607 | per_pin->mux_idx); |
@@ -1779,7 +1782,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1779 | bool non_pcm; | 1782 | bool non_pcm; |
1780 | int pinctl; | 1783 | int pinctl; |
1781 | 1784 | ||
1782 | if (is_haswell_plus(codec) || is_valleyview(codec)) { | 1785 | if (is_haswell_plus(codec) || is_valleyview_plus(codec)) { |
1783 | /* Verify pin:cvt selections to avoid silent audio after S3. | 1786 | /* Verify pin:cvt selections to avoid silent audio after S3. |
1784 | * After S3, the audio driver restores pin:cvt selections | 1787 | * After S3, the audio driver restores pin:cvt selections |
1785 | * but this can happen before gfx is ready and such selection | 1788 | * but this can happen before gfx is ready and such selection |
@@ -2330,9 +2333,8 @@ static int patch_generic_hdmi(struct hda_codec *codec) | |||
2330 | intel_haswell_fixup_enable_dp12(codec); | 2333 | intel_haswell_fixup_enable_dp12(codec); |
2331 | } | 2334 | } |
2332 | 2335 | ||
2333 | if (is_haswell(codec) || is_valleyview(codec)) { | 2336 | if (is_haswell_plus(codec) || is_valleyview_plus(codec)) |
2334 | codec->depop_delay = 0; | 2337 | codec->depop_delay = 0; |
2335 | } | ||
2336 | 2338 | ||
2337 | if (hdmi_parse_codec(codec) < 0) { | 2339 | if (hdmi_parse_codec(codec) < 0) { |
2338 | codec->spec = NULL; | 2340 | codec->spec = NULL; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6b38ec3c6e57..1ba22fb527c2 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -181,6 +181,8 @@ static void alc_fix_pll(struct hda_codec *codec) | |||
181 | spec->pll_coef_idx); | 181 | spec->pll_coef_idx); |
182 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | 182 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
183 | AC_VERB_GET_PROC_COEF, 0); | 183 | AC_VERB_GET_PROC_COEF, 0); |
184 | if (val == -1) | ||
185 | return; | ||
184 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | 186 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
185 | spec->pll_coef_idx); | 187 | spec->pll_coef_idx); |
186 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | 188 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
@@ -326,6 +328,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) | |||
326 | case 0x10ec0885: | 328 | case 0x10ec0885: |
327 | case 0x10ec0887: | 329 | case 0x10ec0887: |
328 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ | 330 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
331 | case 0x10ec0900: | ||
329 | alc889_coef_init(codec); | 332 | alc889_coef_init(codec); |
330 | break; | 333 | break; |
331 | case 0x10ec0888: | 334 | case 0x10ec0888: |
@@ -2348,6 +2351,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
2348 | switch (codec->vendor_id) { | 2351 | switch (codec->vendor_id) { |
2349 | case 0x10ec0882: | 2352 | case 0x10ec0882: |
2350 | case 0x10ec0885: | 2353 | case 0x10ec0885: |
2354 | case 0x10ec0900: | ||
2351 | break; | 2355 | break; |
2352 | default: | 2356 | default: |
2353 | /* ALC883 and variants */ | 2357 | /* ALC883 and variants */ |
@@ -2806,6 +2810,8 @@ static void alc286_shutup(struct hda_codec *codec) | |||
2806 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) | 2810 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) |
2807 | { | 2811 | { |
2808 | int val = alc_read_coef_idx(codec, 0x04); | 2812 | int val = alc_read_coef_idx(codec, 0x04); |
2813 | if (val == -1) | ||
2814 | return; | ||
2809 | if (power_up) | 2815 | if (power_up) |
2810 | val |= 1 << 11; | 2816 | val |= 1 << 11; |
2811 | else | 2817 | else |
@@ -3264,6 +3270,15 @@ static int alc269_resume(struct hda_codec *codec) | |||
3264 | snd_hda_codec_resume_cache(codec); | 3270 | snd_hda_codec_resume_cache(codec); |
3265 | alc_inv_dmic_sync(codec, true); | 3271 | alc_inv_dmic_sync(codec, true); |
3266 | hda_call_check_power_status(codec, 0x01); | 3272 | hda_call_check_power_status(codec, 0x01); |
3273 | |||
3274 | /* on some machine, the BIOS will clear the codec gpio data when enter | ||
3275 | * suspend, and won't restore the data after resume, so we restore it | ||
3276 | * in the driver. | ||
3277 | */ | ||
3278 | if (spec->gpio_led) | ||
3279 | snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA, | ||
3280 | spec->gpio_led); | ||
3281 | |||
3267 | if (spec->has_alc5505_dsp) | 3282 | if (spec->has_alc5505_dsp) |
3268 | alc5505_dsp_resume(codec); | 3283 | alc5505_dsp_resume(codec); |
3269 | 3284 | ||
@@ -4395,6 +4410,7 @@ enum { | |||
4395 | ALC292_FIXUP_TPT440_DOCK, | 4410 | ALC292_FIXUP_TPT440_DOCK, |
4396 | ALC283_FIXUP_BXBT2807_MIC, | 4411 | ALC283_FIXUP_BXBT2807_MIC, |
4397 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, | 4412 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, |
4413 | ALC282_FIXUP_ASPIRE_V5_PINS, | ||
4398 | }; | 4414 | }; |
4399 | 4415 | ||
4400 | static const struct hda_fixup alc269_fixups[] = { | 4416 | static const struct hda_fixup alc269_fixups[] = { |
@@ -4842,6 +4858,22 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4842 | .chained_before = true, | 4858 | .chained_before = true, |
4843 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | 4859 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
4844 | }, | 4860 | }, |
4861 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { | ||
4862 | .type = HDA_FIXUP_PINS, | ||
4863 | .v.pins = (const struct hda_pintbl[]) { | ||
4864 | { 0x12, 0x90a60130 }, | ||
4865 | { 0x14, 0x90170110 }, | ||
4866 | { 0x17, 0x40000008 }, | ||
4867 | { 0x18, 0x411111f0 }, | ||
4868 | { 0x19, 0x411111f0 }, | ||
4869 | { 0x1a, 0x411111f0 }, | ||
4870 | { 0x1b, 0x411111f0 }, | ||
4871 | { 0x1d, 0x40f89b2d }, | ||
4872 | { 0x1e, 0x411111f0 }, | ||
4873 | { 0x21, 0x0321101f }, | ||
4874 | { }, | ||
4875 | }, | ||
4876 | }, | ||
4845 | 4877 | ||
4846 | }; | 4878 | }; |
4847 | 4879 | ||
@@ -4853,6 +4885,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4853 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), | 4885 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), |
4854 | SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), | 4886 | SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), |
4855 | SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), | 4887 | SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
4888 | SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), | ||
4856 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 4889 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
4857 | SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4890 | SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
4858 | SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4891 | SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
@@ -5311,27 +5344,30 @@ static void alc269_fill_coef(struct hda_codec *codec) | |||
5311 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { | 5344 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
5312 | val = alc_read_coef_idx(codec, 0x04); | 5345 | val = alc_read_coef_idx(codec, 0x04); |
5313 | /* Power up output pin */ | 5346 | /* Power up output pin */ |
5314 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | 5347 | if (val != -1) |
5348 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | ||
5315 | } | 5349 | } |
5316 | 5350 | ||
5317 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { | 5351 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
5318 | val = alc_read_coef_idx(codec, 0xd); | 5352 | val = alc_read_coef_idx(codec, 0xd); |
5319 | if ((val & 0x0c00) >> 10 != 0x1) { | 5353 | if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { |
5320 | /* Capless ramp up clock control */ | 5354 | /* Capless ramp up clock control */ |
5321 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); | 5355 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); |
5322 | } | 5356 | } |
5323 | val = alc_read_coef_idx(codec, 0x17); | 5357 | val = alc_read_coef_idx(codec, 0x17); |
5324 | if ((val & 0x01c0) >> 6 != 0x4) { | 5358 | if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { |
5325 | /* Class D power on reset */ | 5359 | /* Class D power on reset */ |
5326 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); | 5360 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); |
5327 | } | 5361 | } |
5328 | } | 5362 | } |
5329 | 5363 | ||
5330 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ | 5364 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ |
5331 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); | 5365 | if (val != -1) |
5366 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); | ||
5332 | 5367 | ||
5333 | val = alc_read_coef_idx(codec, 0x4); /* HP */ | 5368 | val = alc_read_coef_idx(codec, 0x4); /* HP */ |
5334 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); | 5369 | if (val != -1) |
5370 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); | ||
5335 | } | 5371 | } |
5336 | 5372 | ||
5337 | /* | 5373 | /* |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index ea823e1100da..98cd1908c039 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -566,8 +566,8 @@ static void stac_init_power_map(struct hda_codec *codec) | |||
566 | if (snd_hda_jack_tbl_get(codec, nid)) | 566 | if (snd_hda_jack_tbl_get(codec, nid)) |
567 | continue; | 567 | continue; |
568 | if (def_conf == AC_JACK_PORT_COMPLEX && | 568 | if (def_conf == AC_JACK_PORT_COMPLEX && |
569 | !(spec->vref_mute_led_nid == nid || | 569 | spec->vref_mute_led_nid != nid && |
570 | is_jack_detectable(codec, nid))) { | 570 | is_jack_detectable(codec, nid)) { |
571 | snd_hda_jack_detect_enable_callback(codec, nid, | 571 | snd_hda_jack_detect_enable_callback(codec, nid, |
572 | STAC_PWR_EVENT, | 572 | STAC_PWR_EVENT, |
573 | jack_update_power); | 573 | jack_update_power); |
@@ -4276,11 +4276,18 @@ static int stac_parse_auto_config(struct hda_codec *codec) | |||
4276 | return err; | 4276 | return err; |
4277 | } | 4277 | } |
4278 | 4278 | ||
4279 | stac_init_power_map(codec); | ||
4280 | |||
4281 | return 0; | 4279 | return 0; |
4282 | } | 4280 | } |
4283 | 4281 | ||
4282 | static int stac_build_controls(struct hda_codec *codec) | ||
4283 | { | ||
4284 | int err = snd_hda_gen_build_controls(codec); | ||
4285 | |||
4286 | if (err < 0) | ||
4287 | return err; | ||
4288 | stac_init_power_map(codec); | ||
4289 | return 0; | ||
4290 | } | ||
4284 | 4291 | ||
4285 | static int stac_init(struct hda_codec *codec) | 4292 | static int stac_init(struct hda_codec *codec) |
4286 | { | 4293 | { |
@@ -4392,7 +4399,7 @@ static int stac_suspend(struct hda_codec *codec) | |||
4392 | #endif /* CONFIG_PM */ | 4399 | #endif /* CONFIG_PM */ |
4393 | 4400 | ||
4394 | static const struct hda_codec_ops stac_patch_ops = { | 4401 | static const struct hda_codec_ops stac_patch_ops = { |
4395 | .build_controls = snd_hda_gen_build_controls, | 4402 | .build_controls = stac_build_controls, |
4396 | .build_pcms = snd_hda_gen_build_pcms, | 4403 | .build_pcms = snd_hda_gen_build_pcms, |
4397 | .init = stac_init, | 4404 | .init = stac_init, |
4398 | .free = stac_free, | 4405 | .free = stac_free, |
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index bd41ee4da078..2c71f16bd661 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -1278,6 +1278,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
1278 | else | 1278 | else |
1279 | rates = &arizona_48k_bclk_rates[0]; | 1279 | rates = &arizona_48k_bclk_rates[0]; |
1280 | 1280 | ||
1281 | wl = snd_pcm_format_width(params_format(params)); | ||
1282 | |||
1281 | if (tdm_slots) { | 1283 | if (tdm_slots) { |
1282 | arizona_aif_dbg(dai, "Configuring for %d %d bit TDM slots\n", | 1284 | arizona_aif_dbg(dai, "Configuring for %d %d bit TDM slots\n", |
1283 | tdm_slots, tdm_width); | 1285 | tdm_slots, tdm_width); |
@@ -1285,6 +1287,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
1285 | channels = tdm_slots; | 1287 | channels = tdm_slots; |
1286 | } else { | 1288 | } else { |
1287 | bclk_target = snd_soc_params_to_bclk(params); | 1289 | bclk_target = snd_soc_params_to_bclk(params); |
1290 | tdm_width = wl; | ||
1288 | } | 1291 | } |
1289 | 1292 | ||
1290 | if (chan_limit && chan_limit < channels) { | 1293 | if (chan_limit && chan_limit < channels) { |
@@ -1319,8 +1322,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
1319 | arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", | 1322 | arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", |
1320 | rates[bclk], rates[bclk] / lrclk); | 1323 | rates[bclk], rates[bclk] / lrclk); |
1321 | 1324 | ||
1322 | wl = snd_pcm_format_width(params_format(params)); | 1325 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | tdm_width; |
1323 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | wl; | ||
1324 | 1326 | ||
1325 | reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame); | 1327 | reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame); |
1326 | 1328 | ||
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c index a20b30ca52c0..69a85164357c 100644 --- a/sound/soc/codecs/cs4265.c +++ b/sound/soc/codecs/cs4265.c | |||
@@ -282,10 +282,10 @@ static const struct cs4265_clk_para clk_map_table[] = { | |||
282 | 282 | ||
283 | /*64k*/ | 283 | /*64k*/ |
284 | {8192000, 64000, 1, 0}, | 284 | {8192000, 64000, 1, 0}, |
285 | {1228800, 64000, 1, 1}, | 285 | {12288000, 64000, 1, 1}, |
286 | {1693440, 64000, 1, 2}, | 286 | {16934400, 64000, 1, 2}, |
287 | {2457600, 64000, 1, 3}, | 287 | {24576000, 64000, 1, 3}, |
288 | {3276800, 64000, 1, 4}, | 288 | {32768000, 64000, 1, 4}, |
289 | 289 | ||
290 | /* 88.2k */ | 290 | /* 88.2k */ |
291 | {11289600, 88200, 1, 0}, | 291 | {11289600, 88200, 1, 0}, |
@@ -435,10 +435,10 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, | |||
435 | index = cs4265_get_clk_index(cs4265->sysclk, params_rate(params)); | 435 | index = cs4265_get_clk_index(cs4265->sysclk, params_rate(params)); |
436 | if (index >= 0) { | 436 | if (index >= 0) { |
437 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 437 | snd_soc_update_bits(codec, CS4265_ADC_CTL, |
438 | CS4265_ADC_FM, clk_map_table[index].fm_mode); | 438 | CS4265_ADC_FM, clk_map_table[index].fm_mode << 6); |
439 | snd_soc_update_bits(codec, CS4265_MCLK_FREQ, | 439 | snd_soc_update_bits(codec, CS4265_MCLK_FREQ, |
440 | CS4265_MCLK_FREQ_MASK, | 440 | CS4265_MCLK_FREQ_MASK, |
441 | clk_map_table[index].mclkdiv); | 441 | clk_map_table[index].mclkdiv << 4); |
442 | 442 | ||
443 | } else { | 443 | } else { |
444 | dev_err(codec->dev, "can't get correct mclk\n"); | 444 | dev_err(codec->dev, "can't get correct mclk\n"); |
@@ -458,12 +458,12 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, | |||
458 | if (params_width(params) == 16) { | 458 | if (params_width(params) == 16) { |
459 | snd_soc_update_bits(codec, CS4265_DAC_CTL, | 459 | snd_soc_update_bits(codec, CS4265_DAC_CTL, |
460 | CS4265_DAC_CTL_DIF, (1 << 5)); | 460 | CS4265_DAC_CTL_DIF, (1 << 5)); |
461 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 461 | snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, |
462 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); | 462 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); |
463 | } else { | 463 | } else { |
464 | snd_soc_update_bits(codec, CS4265_DAC_CTL, | 464 | snd_soc_update_bits(codec, CS4265_DAC_CTL, |
465 | CS4265_DAC_CTL_DIF, (3 << 5)); | 465 | CS4265_DAC_CTL_DIF, (3 << 5)); |
466 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 466 | snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, |
467 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); | 467 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); |
468 | } | 468 | } |
469 | break; | 469 | break; |
@@ -472,7 +472,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, | |||
472 | CS4265_DAC_CTL_DIF, 0); | 472 | CS4265_DAC_CTL_DIF, 0); |
473 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 473 | snd_soc_update_bits(codec, CS4265_ADC_CTL, |
474 | CS4265_ADC_DIF, 0); | 474 | CS4265_ADC_DIF, 0); |
475 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 475 | snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, |
476 | CS4265_SPDIF_CTL2_DIF, (1 << 6)); | 476 | CS4265_SPDIF_CTL2_DIF, (1 << 6)); |
477 | 477 | ||
478 | break; | 478 | break; |
diff --git a/sound/soc/codecs/da732x.h b/sound/soc/codecs/da732x.h index 1dceafeec415..f586cbd30b77 100644 --- a/sound/soc/codecs/da732x.h +++ b/sound/soc/codecs/da732x.h | |||
@@ -11,7 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef __DA732X_H_ | 13 | #ifndef __DA732X_H_ |
14 | #define __DA732X_H | 14 | #define __DA732X_H_ |
15 | 15 | ||
16 | #include <sound/soc.h> | 16 | #include <sound/soc.h> |
17 | 17 | ||
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index 163ec3855fd4..0c8aefab404c 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c | |||
@@ -259,13 +259,13 @@ static const struct soc_enum pcm512x_veds = | |||
259 | pcm512x_ramp_step_text); | 259 | pcm512x_ramp_step_text); |
260 | 260 | ||
261 | static const struct snd_kcontrol_new pcm512x_controls[] = { | 261 | static const struct snd_kcontrol_new pcm512x_controls[] = { |
262 | SOC_DOUBLE_R_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2, | 262 | SOC_DOUBLE_R_TLV("Digital Playback Volume", PCM512x_DIGITAL_VOLUME_2, |
263 | PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv), | 263 | PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv), |
264 | SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL, | 264 | SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL, |
265 | PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv), | 265 | PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv), |
266 | SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST, | 266 | SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST, |
267 | PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv), | 267 | PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv), |
268 | SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT, | 268 | SOC_DOUBLE("Digital Playback Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT, |
269 | PCM512x_RQMR_SHIFT, 1, 1), | 269 | PCM512x_RQMR_SHIFT, 1, 1), |
270 | 270 | ||
271 | SOC_SINGLE("Deemphasis Switch", PCM512x_DSP, PCM512x_DEMP_SHIFT, 1, 1), | 271 | SOC_SINGLE("Deemphasis Switch", PCM512x_DSP, PCM512x_DEMP_SHIFT, 1, 1), |
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 6bc6efdec550..f1ec6e6bd08a 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c | |||
@@ -2059,6 +2059,7 @@ static struct snd_soc_codec_driver soc_codec_dev_rt5640 = { | |||
2059 | static const struct regmap_config rt5640_regmap = { | 2059 | static const struct regmap_config rt5640_regmap = { |
2060 | .reg_bits = 8, | 2060 | .reg_bits = 8, |
2061 | .val_bits = 16, | 2061 | .val_bits = 16, |
2062 | .use_single_rw = true, | ||
2062 | 2063 | ||
2063 | .max_register = RT5640_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5640_ranges) * | 2064 | .max_register = RT5640_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5640_ranges) * |
2064 | RT5640_PR_SPACING), | 2065 | RT5640_PR_SPACING), |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 67f14556462f..5337c448b5e3 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -2135,10 +2135,10 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
2135 | { "BST2", NULL, "IN2P" }, | 2135 | { "BST2", NULL, "IN2P" }, |
2136 | { "BST2", NULL, "IN2N" }, | 2136 | { "BST2", NULL, "IN2N" }, |
2137 | 2137 | ||
2138 | { "IN1P", NULL, "micbias1" }, | 2138 | { "IN1P", NULL, "MICBIAS1" }, |
2139 | { "IN1N", NULL, "micbias1" }, | 2139 | { "IN1N", NULL, "MICBIAS1" }, |
2140 | { "IN2P", NULL, "micbias1" }, | 2140 | { "IN2P", NULL, "MICBIAS1" }, |
2141 | { "IN2N", NULL, "micbias1" }, | 2141 | { "IN2N", NULL, "MICBIAS1" }, |
2142 | 2142 | ||
2143 | { "ADC 1", NULL, "BST1" }, | 2143 | { "ADC 1", NULL, "BST1" }, |
2144 | { "ADC 1", NULL, "ADC 1 power" }, | 2144 | { "ADC 1", NULL, "ADC 1 power" }, |
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c index 9aa1323fb2ab..89c748dd3d6e 100644 --- a/sound/soc/codecs/sta529.c +++ b/sound/soc/codecs/sta529.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver | 4 | * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> | 7 | * Rajeev Kumar <rajeevkumar.linux@gmail.com> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -426,5 +426,5 @@ static struct i2c_driver sta529_i2c_driver = { | |||
426 | module_i2c_driver(sta529_i2c_driver); | 426 | module_i2c_driver(sta529_i2c_driver); |
427 | 427 | ||
428 | MODULE_DESCRIPTION("ASoC STA529 codec driver"); | 428 | MODULE_DESCRIPTION("ASoC STA529 codec driver"); |
429 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 429 | MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>"); |
430 | MODULE_LICENSE("GPL"); | 430 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 0f64c7890eed..aea9e1ff9126 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c | |||
@@ -189,46 +189,57 @@ static const struct aic31xx_rate_divs aic31xx_divs[] = { | |||
189 | /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */ | 189 | /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */ |
190 | /* 8k rate */ | 190 | /* 8k rate */ |
191 | {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2}, | 191 | {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2}, |
192 | {12000000, 8000, 1, 8, 1920, 128, 32, 3, 128, 32, 3}, | ||
192 | {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2}, | 193 | {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2}, |
193 | {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2}, | 194 | {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2}, |
194 | /* 11.025k rate */ | 195 | /* 11.025k rate */ |
195 | {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2}, | 196 | {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2}, |
197 | {12000000, 11025, 1, 8, 4672, 128, 24, 3, 128, 24, 3}, | ||
196 | {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2}, | 198 | {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2}, |
197 | {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2}, | 199 | {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2}, |
198 | /* 16k rate */ | 200 | /* 16k rate */ |
199 | {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2}, | 201 | {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2}, |
202 | {12000000, 16000, 1, 8, 1920, 128, 16, 3, 128, 16, 3}, | ||
200 | {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2}, | 203 | {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2}, |
201 | {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2}, | 204 | {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2}, |
202 | /* 22.05k rate */ | 205 | /* 22.05k rate */ |
203 | {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2}, | 206 | {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2}, |
207 | {12000000, 22050, 1, 8, 4672, 128, 12, 3, 128, 12, 3}, | ||
204 | {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2}, | 208 | {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2}, |
205 | {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2}, | 209 | {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2}, |
206 | /* 32k rate */ | 210 | /* 32k rate */ |
207 | {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2}, | 211 | {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2}, |
212 | {12000000, 32000, 1, 8, 1920, 128, 8, 3, 128, 8, 3}, | ||
208 | {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2}, | 213 | {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2}, |
209 | {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2}, | 214 | {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2}, |
210 | /* 44.1k rate */ | 215 | /* 44.1k rate */ |
211 | {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2}, | 216 | {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2}, |
217 | {12000000, 44100, 1, 8, 4672, 128, 6, 3, 128, 6, 3}, | ||
212 | {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2}, | 218 | {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2}, |
213 | {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2}, | 219 | {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2}, |
214 | /* 48k rate */ | 220 | /* 48k rate */ |
215 | {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2}, | 221 | {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2}, |
222 | {12000000, 48000, 1, 7, 6800, 96, 5, 4, 96, 5, 4}, | ||
216 | {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2}, | 223 | {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2}, |
217 | {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2}, | 224 | {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2}, |
218 | /* 88.2k rate */ | 225 | /* 88.2k rate */ |
219 | {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2}, | 226 | {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2}, |
227 | {12000000, 88200, 1, 8, 4672, 64, 6, 3, 64, 6, 3}, | ||
220 | {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2}, | 228 | {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2}, |
221 | {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2}, | 229 | {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2}, |
222 | /* 96k rate */ | 230 | /* 96k rate */ |
223 | {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2}, | 231 | {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2}, |
232 | {12000000, 96000, 1, 7, 6800, 48, 5, 4, 48, 5, 4}, | ||
224 | {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2}, | 233 | {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2}, |
225 | {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2}, | 234 | {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2}, |
226 | /* 176.4k rate */ | 235 | /* 176.4k rate */ |
227 | {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2}, | 236 | {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2}, |
237 | {12000000, 176400, 1, 8, 4672, 32, 6, 3, 32, 6, 3}, | ||
228 | {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2}, | 238 | {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2}, |
229 | {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2}, | 239 | {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2}, |
230 | /* 192k rate */ | 240 | /* 192k rate */ |
231 | {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2}, | 241 | {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2}, |
242 | {12000000, 192000, 1, 7, 6800, 24, 5, 4, 24, 5, 4}, | ||
232 | {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2}, | 243 | {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2}, |
233 | {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2}, | 244 | {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2}, |
234 | }; | 245 | }; |
@@ -680,7 +691,9 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, | |||
680 | struct snd_pcm_hw_params *params) | 691 | struct snd_pcm_hw_params *params) |
681 | { | 692 | { |
682 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); | 693 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); |
694 | int bclk_score = snd_soc_params_to_frame_size(params); | ||
683 | int bclk_n = 0; | 695 | int bclk_n = 0; |
696 | int match = -1; | ||
684 | int i; | 697 | int i; |
685 | 698 | ||
686 | /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */ | 699 | /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */ |
@@ -691,15 +704,37 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, | |||
691 | 704 | ||
692 | for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) { | 705 | for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) { |
693 | if (aic31xx_divs[i].rate == params_rate(params) && | 706 | if (aic31xx_divs[i].rate == params_rate(params) && |
694 | aic31xx_divs[i].mclk == aic31xx->sysclk) | 707 | aic31xx_divs[i].mclk == aic31xx->sysclk) { |
695 | break; | 708 | int s = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) % |
709 | snd_soc_params_to_frame_size(params); | ||
710 | int bn = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) / | ||
711 | snd_soc_params_to_frame_size(params); | ||
712 | if (s < bclk_score && bn > 0) { | ||
713 | match = i; | ||
714 | bclk_n = bn; | ||
715 | bclk_score = s; | ||
716 | } | ||
717 | } | ||
696 | } | 718 | } |
697 | 719 | ||
698 | if (i == ARRAY_SIZE(aic31xx_divs)) { | 720 | if (match == -1) { |
699 | dev_err(codec->dev, "%s: Sampling rate %u not supported\n", | 721 | dev_err(codec->dev, |
722 | "%s: Sample rate (%u) and format not supported\n", | ||
700 | __func__, params_rate(params)); | 723 | __func__, params_rate(params)); |
724 | /* See bellow for details how fix this. */ | ||
701 | return -EINVAL; | 725 | return -EINVAL; |
702 | } | 726 | } |
727 | if (bclk_score != 0) { | ||
728 | dev_warn(codec->dev, "Can not produce exact bitclock"); | ||
729 | /* This is fine if using dsp format, but if using i2s | ||
730 | there may be trouble. To fix the issue edit the | ||
731 | aic31xx_divs table for your mclk and sample | ||
732 | rate. Details can be found from: | ||
733 | http://www.ti.com/lit/ds/symlink/tlv320aic3100.pdf | ||
734 | Section: 5.6 CLOCK Generation and PLL | ||
735 | */ | ||
736 | } | ||
737 | i = match; | ||
703 | 738 | ||
704 | /* PLL configuration */ | 739 | /* PLL configuration */ |
705 | snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK, | 740 | snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK, |
@@ -729,14 +764,6 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, | |||
729 | snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr); | 764 | snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr); |
730 | 765 | ||
731 | /* Bit clock divider configuration. */ | 766 | /* Bit clock divider configuration. */ |
732 | bclk_n = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) | ||
733 | / snd_soc_params_to_frame_size(params); | ||
734 | if (bclk_n == 0) { | ||
735 | dev_err(codec->dev, "%s: Not enough BLCK bandwidth\n", | ||
736 | __func__); | ||
737 | return -EINVAL; | ||
738 | } | ||
739 | |||
740 | snd_soc_update_bits(codec, AIC31XX_BCLKN, | 767 | snd_soc_update_bits(codec, AIC31XX_BCLKN, |
741 | AIC31XX_PLL_MASK, bclk_n); | 768 | AIC31XX_PLL_MASK, bclk_n); |
742 | 769 | ||
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index c28508da34cf..68347b55f6e1 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -403,7 +403,8 @@ out: | |||
403 | return ret; | 403 | return ret; |
404 | } | 404 | } |
405 | 405 | ||
406 | static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) | 406 | static int __davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, |
407 | int div, bool explicit) | ||
407 | { | 408 | { |
408 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); | 409 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); |
409 | 410 | ||
@@ -420,7 +421,8 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div | |||
420 | ACLKXDIV(div - 1), ACLKXDIV_MASK); | 421 | ACLKXDIV(div - 1), ACLKXDIV_MASK); |
421 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, | 422 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, |
422 | ACLKRDIV(div - 1), ACLKRDIV_MASK); | 423 | ACLKRDIV(div - 1), ACLKRDIV_MASK); |
423 | mcasp->bclk_div = div; | 424 | if (explicit) |
425 | mcasp->bclk_div = div; | ||
424 | break; | 426 | break; |
425 | 427 | ||
426 | case 2: /* BCLK/LRCLK ratio */ | 428 | case 2: /* BCLK/LRCLK ratio */ |
@@ -434,6 +436,12 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div | |||
434 | return 0; | 436 | return 0; |
435 | } | 437 | } |
436 | 438 | ||
439 | static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, | ||
440 | int div) | ||
441 | { | ||
442 | return __davinci_mcasp_set_clkdiv(dai, div_id, div, 1); | ||
443 | } | ||
444 | |||
437 | static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, | 445 | static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
438 | unsigned int freq, int dir) | 446 | unsigned int freq, int dir) |
439 | { | 447 | { |
@@ -459,8 +467,17 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp, | |||
459 | { | 467 | { |
460 | u32 fmt; | 468 | u32 fmt; |
461 | u32 tx_rotate = (word_length / 4) & 0x7; | 469 | u32 tx_rotate = (word_length / 4) & 0x7; |
462 | u32 rx_rotate = (32 - word_length) / 4; | ||
463 | u32 mask = (1ULL << word_length) - 1; | 470 | u32 mask = (1ULL << word_length) - 1; |
471 | /* | ||
472 | * For captured data we should not rotate, inversion and masking is | ||
473 | * enoguh to get the data to the right position: | ||
474 | * Format data from bus after reverse (XRBUF) | ||
475 | * S16_LE: |LSB|MSB|xxx|xxx| |xxx|xxx|MSB|LSB| | ||
476 | * S24_3LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| | ||
477 | * S24_LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| | ||
478 | * S32_LE: |LSB|DAT|DAT|MSB| |MSB|DAT|DAT|LSB| | ||
479 | */ | ||
480 | u32 rx_rotate = 0; | ||
464 | 481 | ||
465 | /* | 482 | /* |
466 | * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() | 483 | * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() |
@@ -738,7 +755,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
738 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", | 755 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", |
739 | mcasp->sysclk_freq, div, bclk_freq); | 756 | mcasp->sysclk_freq, div, bclk_freq); |
740 | } | 757 | } |
741 | davinci_mcasp_set_clkdiv(cpu_dai, 1, div); | 758 | __davinci_mcasp_set_clkdiv(cpu_dai, 1, div, 0); |
742 | } | 759 | } |
743 | 760 | ||
744 | ret = mcasp_common_hw_param(mcasp, substream->stream, | 761 | ret = mcasp_common_hw_param(mcasp, substream->stream, |
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index 25c31f1655f6..e961388e6e9c 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * sound/soc/dwc/designware_i2s.c | 4 | * sound/soc/dwc/designware_i2s.c |
5 | * | 5 | * |
6 | * Copyright (C) 2010 ST Microelectronics | 6 | * Copyright (C) 2010 ST Microelectronics |
7 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> | 7 | * Rajeev Kumar <rajeevkumar.linux@gmail.com> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -455,7 +455,7 @@ static struct platform_driver dw_i2s_driver = { | |||
455 | 455 | ||
456 | module_platform_driver(dw_i2s_driver); | 456 | module_platform_driver(dw_i2s_driver); |
457 | 457 | ||
458 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 458 | MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>"); |
459 | MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface"); | 459 | MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface"); |
460 | MODULE_LICENSE("GPL"); | 460 | MODULE_LICENSE("GPL"); |
461 | MODULE_ALIAS("platform:designware_i2s"); | 461 | MODULE_ALIAS("platform:designware_i2s"); |
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index f54a8fc99291..f3012b645b51 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -49,7 +49,6 @@ config SND_SOC_FSL_ESAI | |||
49 | tristate "Enhanced Serial Audio Interface (ESAI) module support" | 49 | tristate "Enhanced Serial Audio Interface (ESAI) module support" |
50 | select REGMAP_MMIO | 50 | select REGMAP_MMIO |
51 | select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n | 51 | select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n |
52 | select SND_SOC_FSL_UTILS | ||
53 | help | 52 | help |
54 | Say Y if you want to add Enhanced Synchronous Audio Interface | 53 | Say Y if you want to add Enhanced Synchronous Audio Interface |
55 | (ESAI) support for the Freescale CPUs. | 54 | (ESAI) support for the Freescale CPUs. |
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 72d154e7dd03..a3b29ed84963 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | #include "fsl_esai.h" | 19 | #include "fsl_esai.h" |
20 | #include "imx-pcm.h" | 20 | #include "imx-pcm.h" |
21 | #include "fsl_utils.h" | ||
22 | 21 | ||
23 | #define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000 | 22 | #define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000 |
24 | #define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ | 23 | #define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ |
@@ -607,7 +606,6 @@ static struct snd_soc_dai_ops fsl_esai_dai_ops = { | |||
607 | .hw_params = fsl_esai_hw_params, | 606 | .hw_params = fsl_esai_hw_params, |
608 | .set_sysclk = fsl_esai_set_dai_sysclk, | 607 | .set_sysclk = fsl_esai_set_dai_sysclk, |
609 | .set_fmt = fsl_esai_set_dai_fmt, | 608 | .set_fmt = fsl_esai_set_dai_fmt, |
610 | .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask, | ||
611 | .set_tdm_slot = fsl_esai_set_dai_tdm_slot, | 609 | .set_tdm_slot = fsl_esai_set_dai_tdm_slot, |
612 | }; | 610 | }; |
613 | 611 | ||
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 159e517fa09a..cef7776b712c 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -481,12 +481,19 @@ static int asoc_simple_card_probe(struct platform_device *pdev) | |||
481 | snd_soc_card_set_drvdata(&priv->snd_card, priv); | 481 | snd_soc_card_set_drvdata(&priv->snd_card, priv); |
482 | 482 | ||
483 | ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card); | 483 | ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card); |
484 | if (ret >= 0) | ||
485 | return ret; | ||
484 | 486 | ||
485 | err: | 487 | err: |
486 | asoc_simple_card_unref(pdev); | 488 | asoc_simple_card_unref(pdev); |
487 | return ret; | 489 | return ret; |
488 | } | 490 | } |
489 | 491 | ||
492 | static int asoc_simple_card_remove(struct platform_device *pdev) | ||
493 | { | ||
494 | return asoc_simple_card_unref(pdev); | ||
495 | } | ||
496 | |||
490 | static const struct of_device_id asoc_simple_of_match[] = { | 497 | static const struct of_device_id asoc_simple_of_match[] = { |
491 | { .compatible = "simple-audio-card", }, | 498 | { .compatible = "simple-audio-card", }, |
492 | {}, | 499 | {}, |
@@ -500,6 +507,7 @@ static struct platform_driver asoc_simple_card = { | |||
500 | .of_match_table = asoc_simple_of_match, | 507 | .of_match_table = asoc_simple_of_match, |
501 | }, | 508 | }, |
502 | .probe = asoc_simple_card_probe, | 509 | .probe = asoc_simple_card_probe, |
510 | .remove = asoc_simple_card_remove, | ||
503 | }; | 511 | }; |
504 | 512 | ||
505 | module_platform_driver(asoc_simple_card); | 513 | module_platform_driver(asoc_simple_card); |
diff --git a/sound/soc/intel/sst-acpi.c b/sound/soc/intel/sst-acpi.c index 42edc6f4fc4a..03d0a166b635 100644 --- a/sound/soc/intel/sst-acpi.c +++ b/sound/soc/intel/sst-acpi.c | |||
@@ -246,8 +246,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = { | |||
246 | }; | 246 | }; |
247 | 247 | ||
248 | static struct sst_acpi_mach baytrail_machines[] = { | 248 | static struct sst_acpi_mach baytrail_machines[] = { |
249 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-i2s_master" }, | 249 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, |
250 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-i2s_master" }, | 250 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, |
251 | {} | 251 | {} |
252 | }; | 252 | }; |
253 | 253 | ||
diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c index 67673a2c0f41..b4ad98c43e5c 100644 --- a/sound/soc/intel/sst-baytrail-ipc.c +++ b/sound/soc/intel/sst-baytrail-ipc.c | |||
@@ -817,7 +817,7 @@ static struct sst_dsp_device byt_dev = { | |||
817 | .ops = &sst_byt_ops, | 817 | .ops = &sst_byt_ops, |
818 | }; | 818 | }; |
819 | 819 | ||
820 | int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata) | 820 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata) |
821 | { | 821 | { |
822 | struct sst_byt *byt = pdata->dsp; | 822 | struct sst_byt *byt = pdata->dsp; |
823 | 823 | ||
@@ -826,14 +826,6 @@ int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata) | |||
826 | sst_byt_drop_all(byt); | 826 | sst_byt_drop_all(byt); |
827 | dev_dbg(byt->dev, "dsp in reset\n"); | 827 | dev_dbg(byt->dev, "dsp in reset\n"); |
828 | 828 | ||
829 | return 0; | ||
830 | } | ||
831 | EXPORT_SYMBOL_GPL(sst_byt_dsp_suspend_noirq); | ||
832 | |||
833 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata) | ||
834 | { | ||
835 | struct sst_byt *byt = pdata->dsp; | ||
836 | |||
837 | dev_dbg(byt->dev, "free all blocks and unload fw\n"); | 829 | dev_dbg(byt->dev, "free all blocks and unload fw\n"); |
838 | sst_fw_unload(byt->fw); | 830 | sst_fw_unload(byt->fw); |
839 | 831 | ||
diff --git a/sound/soc/intel/sst-baytrail-ipc.h b/sound/soc/intel/sst-baytrail-ipc.h index 06a4d202689b..8faff6dcf25d 100644 --- a/sound/soc/intel/sst-baytrail-ipc.h +++ b/sound/soc/intel/sst-baytrail-ipc.h | |||
@@ -66,7 +66,6 @@ int sst_byt_get_dsp_position(struct sst_byt *byt, | |||
66 | int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata); | 66 | int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata); |
67 | void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata); | 67 | void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata); |
68 | struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt); | 68 | struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt); |
69 | int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata); | ||
70 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata); | 69 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata); |
71 | int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata); | 70 | int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata); |
72 | int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata); | 71 | int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata); |
diff --git a/sound/soc/intel/sst-baytrail-pcm.c b/sound/soc/intel/sst-baytrail-pcm.c index 599401c0c655..eab1c7d85187 100644 --- a/sound/soc/intel/sst-baytrail-pcm.c +++ b/sound/soc/intel/sst-baytrail-pcm.c | |||
@@ -59,6 +59,9 @@ struct sst_byt_priv_data { | |||
59 | 59 | ||
60 | /* DAI data */ | 60 | /* DAI data */ |
61 | struct sst_byt_pcm_data pcm[BYT_PCM_COUNT]; | 61 | struct sst_byt_pcm_data pcm[BYT_PCM_COUNT]; |
62 | |||
63 | /* flag indicating is stream context restore needed after suspend */ | ||
64 | bool restore_stream; | ||
62 | }; | 65 | }; |
63 | 66 | ||
64 | /* this may get called several times by oss emulation */ | 67 | /* this may get called several times by oss emulation */ |
@@ -184,7 +187,10 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
184 | sst_byt_stream_start(byt, pcm_data->stream, 0); | 187 | sst_byt_stream_start(byt, pcm_data->stream, 0); |
185 | break; | 188 | break; |
186 | case SNDRV_PCM_TRIGGER_RESUME: | 189 | case SNDRV_PCM_TRIGGER_RESUME: |
187 | schedule_work(&pcm_data->work); | 190 | if (pdata->restore_stream == true) |
191 | schedule_work(&pcm_data->work); | ||
192 | else | ||
193 | sst_byt_stream_resume(byt, pcm_data->stream); | ||
188 | break; | 194 | break; |
189 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 195 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
190 | sst_byt_stream_resume(byt, pcm_data->stream); | 196 | sst_byt_stream_resume(byt, pcm_data->stream); |
@@ -193,6 +199,7 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
193 | sst_byt_stream_stop(byt, pcm_data->stream); | 199 | sst_byt_stream_stop(byt, pcm_data->stream); |
194 | break; | 200 | break; |
195 | case SNDRV_PCM_TRIGGER_SUSPEND: | 201 | case SNDRV_PCM_TRIGGER_SUSPEND: |
202 | pdata->restore_stream = false; | ||
196 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 203 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
197 | sst_byt_stream_pause(byt, pcm_data->stream); | 204 | sst_byt_stream_pause(byt, pcm_data->stream); |
198 | break; | 205 | break; |
@@ -404,26 +411,10 @@ static const struct snd_soc_component_driver byt_dai_component = { | |||
404 | }; | 411 | }; |
405 | 412 | ||
406 | #ifdef CONFIG_PM | 413 | #ifdef CONFIG_PM |
407 | static int sst_byt_pcm_dev_suspend_noirq(struct device *dev) | ||
408 | { | ||
409 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | ||
410 | int ret; | ||
411 | |||
412 | dev_dbg(dev, "suspending noirq\n"); | ||
413 | |||
414 | /* at this point all streams will be stopped and context saved */ | ||
415 | ret = sst_byt_dsp_suspend_noirq(dev, sst_pdata); | ||
416 | if (ret < 0) { | ||
417 | dev_err(dev, "failed to suspend %d\n", ret); | ||
418 | return ret; | ||
419 | } | ||
420 | |||
421 | return ret; | ||
422 | } | ||
423 | |||
424 | static int sst_byt_pcm_dev_suspend_late(struct device *dev) | 414 | static int sst_byt_pcm_dev_suspend_late(struct device *dev) |
425 | { | 415 | { |
426 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | 416 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); |
417 | struct sst_byt_priv_data *priv_data = dev_get_drvdata(dev); | ||
427 | int ret; | 418 | int ret; |
428 | 419 | ||
429 | dev_dbg(dev, "suspending late\n"); | 420 | dev_dbg(dev, "suspending late\n"); |
@@ -434,34 +425,30 @@ static int sst_byt_pcm_dev_suspend_late(struct device *dev) | |||
434 | return ret; | 425 | return ret; |
435 | } | 426 | } |
436 | 427 | ||
428 | priv_data->restore_stream = true; | ||
429 | |||
437 | return ret; | 430 | return ret; |
438 | } | 431 | } |
439 | 432 | ||
440 | static int sst_byt_pcm_dev_resume_early(struct device *dev) | 433 | static int sst_byt_pcm_dev_resume_early(struct device *dev) |
441 | { | 434 | { |
442 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | 435 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); |
436 | int ret; | ||
443 | 437 | ||
444 | dev_dbg(dev, "resume early\n"); | 438 | dev_dbg(dev, "resume early\n"); |
445 | 439 | ||
446 | /* load fw and boot DSP */ | 440 | /* load fw and boot DSP */ |
447 | return sst_byt_dsp_boot(dev, sst_pdata); | 441 | ret = sst_byt_dsp_boot(dev, sst_pdata); |
448 | } | 442 | if (ret) |
449 | 443 | return ret; | |
450 | static int sst_byt_pcm_dev_resume(struct device *dev) | ||
451 | { | ||
452 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | ||
453 | |||
454 | dev_dbg(dev, "resume\n"); | ||
455 | 444 | ||
456 | /* wait for FW to finish booting */ | 445 | /* wait for FW to finish booting */ |
457 | return sst_byt_dsp_wait_for_ready(dev, sst_pdata); | 446 | return sst_byt_dsp_wait_for_ready(dev, sst_pdata); |
458 | } | 447 | } |
459 | 448 | ||
460 | static const struct dev_pm_ops sst_byt_pm_ops = { | 449 | static const struct dev_pm_ops sst_byt_pm_ops = { |
461 | .suspend_noirq = sst_byt_pcm_dev_suspend_noirq, | ||
462 | .suspend_late = sst_byt_pcm_dev_suspend_late, | 450 | .suspend_late = sst_byt_pcm_dev_suspend_late, |
463 | .resume_early = sst_byt_pcm_dev_resume_early, | 451 | .resume_early = sst_byt_pcm_dev_resume_early, |
464 | .resume = sst_byt_pcm_dev_resume, | ||
465 | }; | 452 | }; |
466 | 453 | ||
467 | #define SST_BYT_PM_OPS (&sst_byt_pm_ops) | 454 | #define SST_BYT_PM_OPS (&sst_byt_pm_ops) |
diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c index f8a6adc2d81c..4336d1831485 100644 --- a/sound/soc/omap/omap-twl4030.c +++ b/sound/soc/omap/omap-twl4030.c | |||
@@ -260,7 +260,7 @@ static struct snd_soc_dai_link omap_twl4030_dai_links[] = { | |||
260 | .stream_name = "TWL4030 Voice", | 260 | .stream_name = "TWL4030 Voice", |
261 | .cpu_dai_name = "omap-mcbsp.3", | 261 | .cpu_dai_name = "omap-mcbsp.3", |
262 | .codec_dai_name = "twl4030-voice", | 262 | .codec_dai_name = "twl4030-voice", |
263 | .platform_name = "omap-mcbsp.2", | 263 | .platform_name = "omap-mcbsp.3", |
264 | .codec_name = "twl4030-codec", | 264 | .codec_name = "twl4030-codec", |
265 | .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | | 265 | .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | |
266 | SND_SOC_DAIFMT_CBM_CFM, | 266 | SND_SOC_DAIFMT_CBM_CFM, |
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 0109f6c2334e..a8e097433074 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -765,9 +765,7 @@ static int pxa_ssp_remove(struct snd_soc_dai *dai) | |||
765 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ | 765 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ |
766 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) | 766 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) |
767 | 767 | ||
768 | #define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ | 768 | #define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) |
769 | SNDRV_PCM_FMTBIT_S24_LE | \ | ||
770 | SNDRV_PCM_FMTBIT_S32_LE) | ||
771 | 769 | ||
772 | static const struct snd_soc_dai_ops pxa_ssp_dai_ops = { | 770 | static const struct snd_soc_dai_ops pxa_ssp_dai_ops = { |
773 | .startup = pxa_ssp_startup, | 771 | .startup = pxa_ssp_startup, |
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 8d8e4b59049f..fb9e05c9f471 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c | |||
@@ -165,13 +165,14 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | |||
165 | struct rk_i2s_dev *i2s = to_info(cpu_dai); | 165 | struct rk_i2s_dev *i2s = to_info(cpu_dai); |
166 | unsigned int mask = 0, val = 0; | 166 | unsigned int mask = 0, val = 0; |
167 | 167 | ||
168 | mask = I2S_CKR_MSS_SLAVE; | 168 | mask = I2S_CKR_MSS_MASK; |
169 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 169 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
170 | case SND_SOC_DAIFMT_CBS_CFS: | 170 | case SND_SOC_DAIFMT_CBS_CFS: |
171 | val = I2S_CKR_MSS_SLAVE; | 171 | /* Set source clock in Master mode */ |
172 | val = I2S_CKR_MSS_MASTER; | ||
172 | break; | 173 | break; |
173 | case SND_SOC_DAIFMT_CBM_CFM: | 174 | case SND_SOC_DAIFMT_CBM_CFM: |
174 | val = I2S_CKR_MSS_MASTER; | 175 | val = I2S_CKR_MSS_SLAVE; |
175 | break; | 176 | break; |
176 | default: | 177 | default: |
177 | return -EINVAL; | 178 | return -EINVAL; |
@@ -361,6 +362,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg) | |||
361 | case I2S_XFER: | 362 | case I2S_XFER: |
362 | case I2S_CLR: | 363 | case I2S_CLR: |
363 | case I2S_RXDR: | 364 | case I2S_RXDR: |
365 | case I2S_FIFOLR: | ||
366 | case I2S_INTSR: | ||
364 | return true; | 367 | return true; |
365 | default: | 368 | default: |
366 | return false; | 369 | return false; |
@@ -370,8 +373,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg) | |||
370 | static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) | 373 | static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) |
371 | { | 374 | { |
372 | switch (reg) { | 375 | switch (reg) { |
373 | case I2S_FIFOLR: | ||
374 | case I2S_INTSR: | 376 | case I2S_INTSR: |
377 | case I2S_CLR: | ||
375 | return true; | 378 | return true; |
376 | default: | 379 | default: |
377 | return false; | 380 | return false; |
@@ -381,8 +384,6 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) | |||
381 | static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) | 384 | static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) |
382 | { | 385 | { |
383 | switch (reg) { | 386 | switch (reg) { |
384 | case I2S_FIFOLR: | ||
385 | return true; | ||
386 | default: | 387 | default: |
387 | return false; | 388 | return false; |
388 | } | 389 | } |
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 03eec22f0f46..9d513473b300 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -462,7 +462,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, | |||
462 | if (dir == SND_SOC_CLOCK_IN) | 462 | if (dir == SND_SOC_CLOCK_IN) |
463 | rfs = 0; | 463 | rfs = 0; |
464 | 464 | ||
465 | if ((rfs && other->rfs && (other->rfs != rfs)) || | 465 | if ((rfs && other && other->rfs && (other->rfs != rfs)) || |
466 | (any_active(i2s) && | 466 | (any_active(i2s) && |
467 | (((dir == SND_SOC_CLOCK_IN) | 467 | (((dir == SND_SOC_CLOCK_IN) |
468 | && !(mod & MOD_CDCLKCON)) || | 468 | && !(mod & MOD_CDCLKCON)) || |
@@ -762,7 +762,8 @@ static void i2s_shutdown(struct snd_pcm_substream *substream, | |||
762 | } else { | 762 | } else { |
763 | u32 mod = readl(i2s->addr + I2SMOD); | 763 | u32 mod = readl(i2s->addr + I2SMOD); |
764 | i2s->cdclk_out = !(mod & MOD_CDCLKCON); | 764 | i2s->cdclk_out = !(mod & MOD_CDCLKCON); |
765 | other->cdclk_out = i2s->cdclk_out; | 765 | if (other) |
766 | other->cdclk_out = i2s->cdclk_out; | ||
766 | } | 767 | } |
767 | /* Reset any constraint on RFS and BFS */ | 768 | /* Reset any constraint on RFS and BFS */ |
768 | i2s->rfs = 0; | 769 | i2s->rfs = 0; |
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c index 3fdf3be7b99a..f95e7ab135e8 100644 --- a/sound/soc/sh/rcar/gen.c +++ b/sound/soc/sh/rcar/gen.c | |||
@@ -247,7 +247,7 @@ rsnd_gen2_dma_addr(struct rsnd_priv *priv, | |||
247 | }; | 247 | }; |
248 | 248 | ||
249 | /* it shouldn't happen */ | 249 | /* it shouldn't happen */ |
250 | if (use_dvc & !use_src) | 250 | if (use_dvc && !use_src) |
251 | dev_err(dev, "DVC is selected without SRC\n"); | 251 | dev_err(dev, "DVC is selected without SRC\n"); |
252 | 252 | ||
253 | /* use SSIU or SSI ? */ | 253 | /* use SSIU or SSI ? */ |
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 27c06acce205..3092b58fede6 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c | |||
@@ -101,7 +101,11 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) | |||
101 | 101 | ||
102 | fe->dpcm[stream].runtime = fe_substream->runtime; | 102 | fe->dpcm[stream].runtime = fe_substream->runtime; |
103 | 103 | ||
104 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 104 | ret = dpcm_path_get(fe, stream, &list); |
105 | if (ret < 0) { | ||
106 | mutex_unlock(&fe->card->mutex); | ||
107 | goto fe_err; | ||
108 | } else if (ret == 0) { | ||
105 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 109 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
106 | fe->dai_link->name, stream ? "capture" : "playback"); | 110 | fe->dai_link->name, stream ? "capture" : "playback"); |
107 | } | 111 | } |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d4bfd4a9076f..889f4e3d35dc 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1325,7 +1325,7 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd, | |||
1325 | device_initialize(rtd->dev); | 1325 | device_initialize(rtd->dev); |
1326 | rtd->dev->parent = rtd->card->dev; | 1326 | rtd->dev->parent = rtd->card->dev; |
1327 | rtd->dev->release = rtd_release; | 1327 | rtd->dev->release = rtd_release; |
1328 | rtd->dev->init_name = name; | 1328 | dev_set_name(rtd->dev, "%s", name); |
1329 | dev_set_drvdata(rtd->dev, rtd); | 1329 | dev_set_drvdata(rtd->dev, rtd); |
1330 | mutex_init(&rtd->pcm_mutex); | 1330 | mutex_init(&rtd->pcm_mutex); |
1331 | INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); | 1331 | INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8348352dc2c6..177bd8639ef9 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -2860,12 +2860,14 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
2860 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 2860 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); |
2861 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 2861 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
2862 | unsigned int reg_val, val; | 2862 | unsigned int reg_val, val; |
2863 | int ret = 0; | ||
2864 | 2863 | ||
2865 | if (e->reg != SND_SOC_NOPM) | 2864 | if (e->reg != SND_SOC_NOPM) { |
2866 | ret = soc_dapm_read(dapm, e->reg, ®_val); | 2865 | int ret = soc_dapm_read(dapm, e->reg, ®_val); |
2867 | else | 2866 | if (ret) |
2867 | return ret; | ||
2868 | } else { | ||
2868 | reg_val = dapm_kcontrol_get_value(kcontrol); | 2869 | reg_val = dapm_kcontrol_get_value(kcontrol); |
2870 | } | ||
2869 | 2871 | ||
2870 | val = (reg_val >> e->shift_l) & e->mask; | 2872 | val = (reg_val >> e->shift_l) & e->mask; |
2871 | ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); | 2873 | ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); |
@@ -2875,7 +2877,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
2875 | ucontrol->value.enumerated.item[1] = val; | 2877 | ucontrol->value.enumerated.item[1] = val; |
2876 | } | 2878 | } |
2877 | 2879 | ||
2878 | return ret; | 2880 | return 0; |
2879 | } | 2881 | } |
2880 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); | 2882 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); |
2881 | 2883 | ||
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 731fdb5b5f9b..642c86240752 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -2352,7 +2352,11 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) | |||
2352 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 2352 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
2353 | fe->dpcm[stream].runtime = fe_substream->runtime; | 2353 | fe->dpcm[stream].runtime = fe_substream->runtime; |
2354 | 2354 | ||
2355 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 2355 | ret = dpcm_path_get(fe, stream, &list); |
2356 | if (ret < 0) { | ||
2357 | mutex_unlock(&fe->card->mutex); | ||
2358 | return ret; | ||
2359 | } else if (ret == 0) { | ||
2356 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 2360 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
2357 | fe->dai_link->name, stream ? "capture" : "playback"); | 2361 | fe->dai_link->name, stream ? "capture" : "playback"); |
2358 | } | 2362 | } |
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 0e5a8f35d0ad..a7dc3c56f44d 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * sound/soc/spear/spear_pcm.c | 4 | * sound/soc/spear/spear_pcm.c |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | 7 | * Rajeev Kumar<rajeevkumar.linux@gmail.com> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -50,6 +50,6 @@ int devm_spear_pcm_platform_register(struct device *dev, | |||
50 | } | 50 | } |
51 | EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); | 51 | EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); |
52 | 52 | ||
53 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 53 | MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>"); |
54 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); | 54 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); |
55 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/tegra/tegra_asoc_utils.h b/sound/soc/tegra/tegra_asoc_utils.h index 9577121ce971..ca8037634100 100644 --- a/sound/soc/tegra/tegra_asoc_utils.h +++ b/sound/soc/tegra/tegra_asoc_utils.h | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef __TEGRA_ASOC_UTILS_H__ | 23 | #ifndef __TEGRA_ASOC_UTILS_H__ |
24 | #define __TEGRA_ASOC_UTILS_H_ | 24 | #define __TEGRA_ASOC_UTILS_H__ |
25 | 25 | ||
26 | struct clk; | 26 | struct clk; |
27 | struct device; | 27 | struct device; |
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c index f65fc0987cfb..b7a7c805d63f 100644 --- a/sound/usb/caiaq/control.c +++ b/sound/usb/caiaq/control.c | |||
@@ -100,15 +100,19 @@ static int control_put(struct snd_kcontrol *kcontrol, | |||
100 | struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); | 100 | struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); |
101 | int pos = kcontrol->private_value; | 101 | int pos = kcontrol->private_value; |
102 | int v = ucontrol->value.integer.value[0]; | 102 | int v = ucontrol->value.integer.value[0]; |
103 | unsigned char cmd = EP1_CMD_WRITE_IO; | 103 | unsigned char cmd; |
104 | 104 | ||
105 | if (cdev->chip.usb_id == | 105 | switch (cdev->chip.usb_id) { |
106 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) | 106 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER): |
107 | cmd = EP1_CMD_DIMM_LEDS; | 107 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
108 | 108 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): | |
109 | if (cdev->chip.usb_id == | 109 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): |
110 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER)) | ||
111 | cmd = EP1_CMD_DIMM_LEDS; | 110 | cmd = EP1_CMD_DIMM_LEDS; |
111 | break; | ||
112 | default: | ||
113 | cmd = EP1_CMD_WRITE_IO; | ||
114 | break; | ||
115 | } | ||
112 | 116 | ||
113 | if (pos & CNT_INTVAL) { | 117 | if (pos & CNT_INTVAL) { |
114 | int i = pos & ~CNT_INTVAL; | 118 | int i = pos & ~CNT_INTVAL; |
diff --git a/tools/testing/selftests/ipc/Makefile b/tools/testing/selftests/ipc/Makefile index 5386fd7c43ae..74bbefdeaf4c 100644 --- a/tools/testing/selftests/ipc/Makefile +++ b/tools/testing/selftests/ipc/Makefile | |||
@@ -1,18 +1,18 @@ | |||
1 | uname_M := $(shell uname -m 2>/dev/null || echo not) | 1 | uname_M := $(shell uname -m 2>/dev/null || echo not) |
2 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) | 2 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) |
3 | ifeq ($(ARCH),i386) | 3 | ifeq ($(ARCH),i386) |
4 | ARCH := X86 | 4 | ARCH := x86 |
5 | CFLAGS := -DCONFIG_X86_32 -D__i386__ | 5 | CFLAGS := -DCONFIG_X86_32 -D__i386__ |
6 | endif | 6 | endif |
7 | ifeq ($(ARCH),x86_64) | 7 | ifeq ($(ARCH),x86_64) |
8 | ARCH := X86 | 8 | ARCH := x86 |
9 | CFLAGS := -DCONFIG_X86_64 -D__x86_64__ | 9 | CFLAGS := -DCONFIG_X86_64 -D__x86_64__ |
10 | endif | 10 | endif |
11 | 11 | ||
12 | CFLAGS += -I../../../../usr/include/ | 12 | CFLAGS += -I../../../../usr/include/ |
13 | 13 | ||
14 | all: | 14 | all: |
15 | ifeq ($(ARCH),X86) | 15 | ifeq ($(ARCH),x86) |
16 | gcc $(CFLAGS) msgque.c -o msgque_test | 16 | gcc $(CFLAGS) msgque.c -o msgque_test |
17 | else | 17 | else |
18 | echo "Not an x86 target, can't build msgque selftest" | 18 | echo "Not an x86 target, can't build msgque selftest" |
diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile index d7d6bbeeff2f..8aabd82db9e4 100644 --- a/tools/testing/selftests/kcmp/Makefile +++ b/tools/testing/selftests/kcmp/Makefile | |||
@@ -1,11 +1,11 @@ | |||
1 | uname_M := $(shell uname -m 2>/dev/null || echo not) | 1 | uname_M := $(shell uname -m 2>/dev/null || echo not) |
2 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) | 2 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) |
3 | ifeq ($(ARCH),i386) | 3 | ifeq ($(ARCH),i386) |
4 | ARCH := X86 | 4 | ARCH := x86 |
5 | CFLAGS := -DCONFIG_X86_32 -D__i386__ | 5 | CFLAGS := -DCONFIG_X86_32 -D__i386__ |
6 | endif | 6 | endif |
7 | ifeq ($(ARCH),x86_64) | 7 | ifeq ($(ARCH),x86_64) |
8 | ARCH := X86 | 8 | ARCH := x86 |
9 | CFLAGS := -DCONFIG_X86_64 -D__x86_64__ | 9 | CFLAGS := -DCONFIG_X86_64 -D__x86_64__ |
10 | endif | 10 | endif |
11 | 11 | ||
@@ -15,7 +15,7 @@ CFLAGS += -I../../../../usr/include/ | |||
15 | CFLAGS += -I../../../../arch/x86/include/ | 15 | CFLAGS += -I../../../../arch/x86/include/ |
16 | 16 | ||
17 | all: | 17 | all: |
18 | ifeq ($(ARCH),X86) | 18 | ifeq ($(ARCH),x86) |
19 | gcc $(CFLAGS) kcmp_test.c -o kcmp_test | 19 | gcc $(CFLAGS) kcmp_test.c -o kcmp_test |
20 | else | 20 | else |
21 | echo "Not an x86 target, can't build kcmp selftest" | 21 | echo "Not an x86 target, can't build kcmp selftest" |
diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile index 6816c491c5ff..ad4ab01cd28f 100644 --- a/tools/testing/selftests/memfd/Makefile +++ b/tools/testing/selftests/memfd/Makefile | |||
@@ -1,10 +1,10 @@ | |||
1 | uname_M := $(shell uname -m 2>/dev/null || echo not) | 1 | uname_M := $(shell uname -m 2>/dev/null || echo not) |
2 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) | 2 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) |
3 | ifeq ($(ARCH),i386) | 3 | ifeq ($(ARCH),i386) |
4 | ARCH := X86 | 4 | ARCH := x86 |
5 | endif | 5 | endif |
6 | ifeq ($(ARCH),x86_64) | 6 | ifeq ($(ARCH),x86_64) |
7 | ARCH := X86 | 7 | ARCH := x86 |
8 | endif | 8 | endif |
9 | 9 | ||
10 | CFLAGS += -D_FILE_OFFSET_BITS=64 | 10 | CFLAGS += -D_FILE_OFFSET_BITS=64 |
@@ -14,20 +14,20 @@ CFLAGS += -I../../../../include/uapi/ | |||
14 | CFLAGS += -I../../../../include/ | 14 | CFLAGS += -I../../../../include/ |
15 | 15 | ||
16 | all: | 16 | all: |
17 | ifeq ($(ARCH),X86) | 17 | ifeq ($(ARCH),x86) |
18 | gcc $(CFLAGS) memfd_test.c -o memfd_test | 18 | gcc $(CFLAGS) memfd_test.c -o memfd_test |
19 | else | 19 | else |
20 | echo "Not an x86 target, can't build memfd selftest" | 20 | echo "Not an x86 target, can't build memfd selftest" |
21 | endif | 21 | endif |
22 | 22 | ||
23 | run_tests: all | 23 | run_tests: all |
24 | ifeq ($(ARCH),X86) | 24 | ifeq ($(ARCH),x86) |
25 | gcc $(CFLAGS) memfd_test.c -o memfd_test | 25 | gcc $(CFLAGS) memfd_test.c -o memfd_test |
26 | endif | 26 | endif |
27 | @./memfd_test || echo "memfd_test: [FAIL]" | 27 | @./memfd_test || echo "memfd_test: [FAIL]" |
28 | 28 | ||
29 | build_fuse: | 29 | build_fuse: |
30 | ifeq ($(ARCH),X86) | 30 | ifeq ($(ARCH),x86) |
31 | gcc $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt | 31 | gcc $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt |
32 | gcc $(CFLAGS) fuse_test.c -o fuse_test | 32 | gcc $(CFLAGS) fuse_test.c -o fuse_test |
33 | else | 33 | else |
diff --git a/drivers/staging/usbip/userspace/.gitignore b/tools/usb/usbip/.gitignore index 9aad9e30a8ba..9aad9e30a8ba 100644 --- a/drivers/staging/usbip/userspace/.gitignore +++ b/tools/usb/usbip/.gitignore | |||
diff --git a/drivers/staging/usbip/userspace/AUTHORS b/tools/usb/usbip/AUTHORS index a27ea8d03aec..a27ea8d03aec 100644 --- a/drivers/staging/usbip/userspace/AUTHORS +++ b/tools/usb/usbip/AUTHORS | |||
diff --git a/drivers/staging/usbip/userspace/COPYING b/tools/usb/usbip/COPYING index c5611e48a8e1..c5611e48a8e1 100644 --- a/drivers/staging/usbip/userspace/COPYING +++ b/tools/usb/usbip/COPYING | |||
diff --git a/drivers/staging/usbip/userspace/INSTALL b/tools/usb/usbip/INSTALL index d3c5b40a9409..d3c5b40a9409 100644 --- a/drivers/staging/usbip/userspace/INSTALL +++ b/tools/usb/usbip/INSTALL | |||
diff --git a/drivers/staging/usbip/userspace/Makefile.am b/tools/usb/usbip/Makefile.am index 66f8bf038c9f..66f8bf038c9f 100644 --- a/drivers/staging/usbip/userspace/Makefile.am +++ b/tools/usb/usbip/Makefile.am | |||
diff --git a/drivers/staging/usbip/userspace/README b/tools/usb/usbip/README index 831f49fea3ce..831f49fea3ce 100644 --- a/drivers/staging/usbip/userspace/README +++ b/tools/usb/usbip/README | |||
diff --git a/drivers/staging/usbip/userspace/autogen.sh b/tools/usb/usbip/autogen.sh index e1112d3fcbf6..e1112d3fcbf6 100755 --- a/drivers/staging/usbip/userspace/autogen.sh +++ b/tools/usb/usbip/autogen.sh | |||
diff --git a/drivers/staging/usbip/userspace/cleanup.sh b/tools/usb/usbip/cleanup.sh index 955c3ccb729a..955c3ccb729a 100755 --- a/drivers/staging/usbip/userspace/cleanup.sh +++ b/tools/usb/usbip/cleanup.sh | |||
diff --git a/drivers/staging/usbip/userspace/configure.ac b/tools/usb/usbip/configure.ac index 607d05c5ccfd..607d05c5ccfd 100644 --- a/drivers/staging/usbip/userspace/configure.ac +++ b/tools/usb/usbip/configure.ac | |||
diff --git a/drivers/staging/usbip/userspace/doc/usbip.8 b/tools/usb/usbip/doc/usbip.8 index a6097be25d28..a6097be25d28 100644 --- a/drivers/staging/usbip/userspace/doc/usbip.8 +++ b/tools/usb/usbip/doc/usbip.8 | |||
diff --git a/drivers/staging/usbip/userspace/doc/usbipd.8 b/tools/usb/usbip/doc/usbipd.8 index ac4635db3f03..ac4635db3f03 100644 --- a/drivers/staging/usbip/userspace/doc/usbipd.8 +++ b/tools/usb/usbip/doc/usbipd.8 | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/Makefile.am b/tools/usb/usbip/libsrc/Makefile.am index 7c8f8a4d54e4..7c8f8a4d54e4 100644 --- a/drivers/staging/usbip/userspace/libsrc/Makefile.am +++ b/tools/usb/usbip/libsrc/Makefile.am | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/list.h b/tools/usb/usbip/libsrc/list.h index 8d0c936e184f..8d0c936e184f 100644 --- a/drivers/staging/usbip/userspace/libsrc/list.h +++ b/tools/usb/usbip/libsrc/list.h | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/tools/usb/usbip/libsrc/names.c index 81ff8522405c..81ff8522405c 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/tools/usb/usbip/libsrc/names.c | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/names.h b/tools/usb/usbip/libsrc/names.h index 680926512de2..680926512de2 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.h +++ b/tools/usb/usbip/libsrc/names.h | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/sysfs_utils.c b/tools/usb/usbip/libsrc/sysfs_utils.c index 36ac88ece0b8..36ac88ece0b8 100644 --- a/drivers/staging/usbip/userspace/libsrc/sysfs_utils.c +++ b/tools/usb/usbip/libsrc/sysfs_utils.c | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/sysfs_utils.h b/tools/usb/usbip/libsrc/sysfs_utils.h index 32ac1d105d18..32ac1d105d18 100644 --- a/drivers/staging/usbip/userspace/libsrc/sysfs_utils.h +++ b/tools/usb/usbip/libsrc/sysfs_utils.h | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/tools/usb/usbip/libsrc/usbip_common.c index ac73710473de..ac73710473de 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c +++ b/tools/usb/usbip/libsrc/usbip_common.c | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.h b/tools/usb/usbip/libsrc/usbip_common.h index 5a0e95edf4df..15fe792e1e96 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.h +++ b/tools/usb/usbip/libsrc/usbip_common.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <syslog.h> | 15 | #include <syslog.h> |
16 | #include <unistd.h> | 16 | #include <unistd.h> |
17 | #include <linux/usb/ch9.h> | 17 | #include <linux/usb/ch9.h> |
18 | #include "../../uapi/usbip.h" | 18 | #include <linux/usbip.h> |
19 | 19 | ||
20 | #ifndef USBIDS_FILE | 20 | #ifndef USBIDS_FILE |
21 | #define USBIDS_FILE "/usr/share/hwdata/usb.ids" | 21 | #define USBIDS_FILE "/usr/share/hwdata/usb.ids" |
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c b/tools/usb/usbip/libsrc/usbip_host_driver.c index bef08d5c44e8..bef08d5c44e8 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +++ b/tools/usb/usbip/libsrc/usbip_host_driver.c | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.h b/tools/usb/usbip/libsrc/usbip_host_driver.h index 2a31f855c616..2a31f855c616 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.h +++ b/tools/usb/usbip/libsrc/usbip_host_driver.h | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index ad9204773533..ad9204773533 100644 --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c | |||
diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h b/tools/usb/usbip/libsrc/vhci_driver.h index fa2316cf2cac..fa2316cf2cac 100644 --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h +++ b/tools/usb/usbip/libsrc/vhci_driver.h | |||
diff --git a/drivers/staging/usbip/userspace/src/Makefile.am b/tools/usb/usbip/src/Makefile.am index e81a4ebadeff..e81a4ebadeff 100644 --- a/drivers/staging/usbip/userspace/src/Makefile.am +++ b/tools/usb/usbip/src/Makefile.am | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip.c b/tools/usb/usbip/src/usbip.c index d7599d943529..d7599d943529 100644 --- a/drivers/staging/usbip/userspace/src/usbip.c +++ b/tools/usb/usbip/src/usbip.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip.h b/tools/usb/usbip/src/usbip.h index 84fe66a9d8ad..84fe66a9d8ad 100644 --- a/drivers/staging/usbip/userspace/src/usbip.h +++ b/tools/usb/usbip/src/usbip.h | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_attach.c b/tools/usb/usbip/src/usbip_attach.c index d58a14dfc094..d58a14dfc094 100644 --- a/drivers/staging/usbip/userspace/src/usbip_attach.c +++ b/tools/usb/usbip/src/usbip_attach.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_bind.c b/tools/usb/usbip/src/usbip_bind.c index fa46141ae68b..fa46141ae68b 100644 --- a/drivers/staging/usbip/userspace/src/usbip_bind.c +++ b/tools/usb/usbip/src/usbip_bind.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c index 05c6d15856eb..05c6d15856eb 100644 --- a/drivers/staging/usbip/userspace/src/usbip_detach.c +++ b/tools/usb/usbip/src/usbip_detach.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c index d5ce34a410e7..d5ce34a410e7 100644 --- a/drivers/staging/usbip/userspace/src/usbip_list.c +++ b/tools/usb/usbip/src/usbip_list.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_network.c b/tools/usb/usbip/src/usbip_network.c index b4c37e76a6e0..b4c37e76a6e0 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.c +++ b/tools/usb/usbip/src/usbip_network.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_network.h b/tools/usb/usbip/src/usbip_network.h index c1e875cf1078..c1e875cf1078 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.h +++ b/tools/usb/usbip/src/usbip_network.h | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_port.c b/tools/usb/usbip/src/usbip_port.c index a2e884fd9226..a2e884fd9226 100644 --- a/drivers/staging/usbip/userspace/src/usbip_port.c +++ b/tools/usb/usbip/src/usbip_port.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbip_unbind.c b/tools/usb/usbip/src/usbip_unbind.c index a4a496c9cbaf..a4a496c9cbaf 100644 --- a/drivers/staging/usbip/userspace/src/usbip_unbind.c +++ b/tools/usb/usbip/src/usbip_unbind.c | |||
diff --git a/drivers/staging/usbip/userspace/src/usbipd.c b/tools/usb/usbip/src/usbipd.c index 2f87f2d348ba..2f87f2d348ba 100644 --- a/drivers/staging/usbip/userspace/src/usbipd.c +++ b/tools/usb/usbip/src/usbipd.c | |||
diff --git a/drivers/staging/usbip/userspace/src/utils.c b/tools/usb/usbip/src/utils.c index 2b3d6d235015..2b3d6d235015 100644 --- a/drivers/staging/usbip/userspace/src/utils.c +++ b/tools/usb/usbip/src/utils.c | |||
diff --git a/drivers/staging/usbip/userspace/src/utils.h b/tools/usb/usbip/src/utils.h index 5916fd3e02a6..5916fd3e02a6 100644 --- a/drivers/staging/usbip/userspace/src/utils.h +++ b/tools/usb/usbip/src/utils.h | |||
diff --git a/virt/kvm/arm/vgic-v2.c b/virt/kvm/arm/vgic-v2.c index 01124ef3690a..416baedfc89f 100644 --- a/virt/kvm/arm/vgic-v2.c +++ b/virt/kvm/arm/vgic-v2.c | |||
@@ -71,7 +71,7 @@ static void vgic_v2_sync_lr_elrsr(struct kvm_vcpu *vcpu, int lr, | |||
71 | struct vgic_lr lr_desc) | 71 | struct vgic_lr lr_desc) |
72 | { | 72 | { |
73 | if (!(lr_desc.state & LR_STATE_MASK)) | 73 | if (!(lr_desc.state & LR_STATE_MASK)) |
74 | set_bit(lr, (unsigned long *)vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr); | 74 | __set_bit(lr, (unsigned long *)vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr); |
75 | } | 75 | } |
76 | 76 | ||
77 | static u64 vgic_v2_get_elrsr(const struct kvm_vcpu *vcpu) | 77 | static u64 vgic_v2_get_elrsr(const struct kvm_vcpu *vcpu) |
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index bf06577fea51..5819a2708d7e 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
@@ -526,8 +526,10 @@ static int assign_guest_irq(struct kvm *kvm, | |||
526 | dev->irq_requested_type |= guest_irq_type; | 526 | dev->irq_requested_type |= guest_irq_type; |
527 | if (dev->ack_notifier.gsi != -1) | 527 | if (dev->ack_notifier.gsi != -1) |
528 | kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier); | 528 | kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier); |
529 | } else | 529 | } else { |
530 | kvm_free_irq_source_id(kvm, dev->irq_source_id); | 530 | kvm_free_irq_source_id(kvm, dev->irq_source_id); |
531 | dev->irq_source_id = -1; | ||
532 | } | ||
531 | 533 | ||
532 | return r; | 534 | return r; |
533 | } | 535 | } |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 0df7d4b34dfe..714b94932312 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
@@ -61,6 +61,14 @@ static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn, | |||
61 | return pfn; | 61 | return pfn; |
62 | } | 62 | } |
63 | 63 | ||
64 | static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages) | ||
65 | { | ||
66 | unsigned long i; | ||
67 | |||
68 | for (i = 0; i < npages; ++i) | ||
69 | kvm_release_pfn_clean(pfn + i); | ||
70 | } | ||
71 | |||
64 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | 72 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) |
65 | { | 73 | { |
66 | gfn_t gfn, end_gfn; | 74 | gfn_t gfn, end_gfn; |
@@ -123,6 +131,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | |||
123 | if (r) { | 131 | if (r) { |
124 | printk(KERN_ERR "kvm_iommu_map_address:" | 132 | printk(KERN_ERR "kvm_iommu_map_address:" |
125 | "iommu failed to map pfn=%llx\n", pfn); | 133 | "iommu failed to map pfn=%llx\n", pfn); |
134 | kvm_unpin_pages(kvm, pfn, page_size); | ||
126 | goto unmap_pages; | 135 | goto unmap_pages; |
127 | } | 136 | } |
128 | 137 | ||
@@ -134,7 +143,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | |||
134 | return 0; | 143 | return 0; |
135 | 144 | ||
136 | unmap_pages: | 145 | unmap_pages: |
137 | kvm_iommu_put_pages(kvm, slot->base_gfn, gfn); | 146 | kvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn); |
138 | return r; | 147 | return r; |
139 | } | 148 | } |
140 | 149 | ||
@@ -266,14 +275,6 @@ out_unlock: | |||
266 | return r; | 275 | return r; |
267 | } | 276 | } |
268 | 277 | ||
269 | static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages) | ||
270 | { | ||
271 | unsigned long i; | ||
272 | |||
273 | for (i = 0; i < npages; ++i) | ||
274 | kvm_release_pfn_clean(pfn + i); | ||
275 | } | ||
276 | |||
277 | static void kvm_iommu_put_pages(struct kvm *kvm, | 278 | static void kvm_iommu_put_pages(struct kvm *kvm, |
278 | gfn_t base_gfn, unsigned long npages) | 279 | gfn_t base_gfn, unsigned long npages) |
279 | { | 280 | { |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 33712fb26eb1..95519bc959ed 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -110,7 +110,7 @@ static bool largepages_enabled = true; | |||
110 | bool kvm_is_mmio_pfn(pfn_t pfn) | 110 | bool kvm_is_mmio_pfn(pfn_t pfn) |
111 | { | 111 | { |
112 | if (pfn_valid(pfn)) | 112 | if (pfn_valid(pfn)) |
113 | return PageReserved(pfn_to_page(pfn)); | 113 | return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn)); |
114 | 114 | ||
115 | return true; | 115 | return true; |
116 | } | 116 | } |
@@ -1725,7 +1725,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target) | |||
1725 | rcu_read_lock(); | 1725 | rcu_read_lock(); |
1726 | pid = rcu_dereference(target->pid); | 1726 | pid = rcu_dereference(target->pid); |
1727 | if (pid) | 1727 | if (pid) |
1728 | task = get_pid_task(target->pid, PIDTYPE_PID); | 1728 | task = get_pid_task(pid, PIDTYPE_PID); |
1729 | rcu_read_unlock(); | 1729 | rcu_read_unlock(); |
1730 | if (!task) | 1730 | if (!task) |
1731 | return ret; | 1731 | return ret; |