diff options
author | Olof Johansson <olof@lixom.net> | 2014-09-24 01:03:03 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2014-09-24 01:03:42 -0400 |
commit | 2fee8c1dd07260329e9788984b79b099456a9d11 (patch) | |
tree | eb7a0b1069ea85a135f4f1df3703236a8003036c | |
parent | 01100c022df5d9b8ac56d3705e33e69dc012a6e2 (diff) | |
parent | 31957609db529d401658adc2e91ef7df7ea42699 (diff) |
Merge tag 'fixes-v3.18-not-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/fixes-non-critical
Merge "non-urgent omap fixes for v3.18 merge window" from Tony Lindgren:
Fixes for omaps that were not considered urgent enough
for the -rc cycle:
- Fixes for .dts files to differentiate panda and beaglebone versions
- Powerdomain fixes from Nishant Menon mostly for newer omaps
- Fixes for __initconst and of_device_ids const usage
* tag 'fixes-v3.18-not-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
ARM: OMAP2+: make of_device_ids const
ARM: omap2: make arrays containing machine compatible strings const
ARM: OMAP4+: PM: Use only valid low power state for CPU hotplug
ARM: OMAP4+: PM: use only valid low power state for suspend
ARM: OMAP4+: PM: Make logic state programmable
ARM: OMAP2+: powerdomain: introduce logic for finding valid power domain
ARM: OMAP2+: powerdomain: pwrdm_for_each_clkdm iterate only valid clkdms
ARM: OMAP5: powerdomain data: fix powerdomain powerstate
ARM: OMAP: DRA7: powerdomain data: fix powerdomain powerstate
ARM: dts: am335x-bone*: Fix model name and update compatibility information
ARM: dts: omap4-panda: Fix model and SoC family details
+ Linux 3.17-rc3
Signed-off-by: Olof Johansson <olof@lixom.net>
580 files changed, 5713 insertions, 2785 deletions
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/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/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/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/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 99b78075a50c..3a34ec04a00d 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> |
@@ -1842,6 +1848,12 @@ S: Orphan | |||
1842 | F: Documentation/filesystems/befs.txt | 1848 | F: Documentation/filesystems/befs.txt |
1843 | F: fs/befs/ | 1849 | F: fs/befs/ |
1844 | 1850 | ||
1851 | BECKHOFF CX5020 ETHERCAT MASTER DRIVER | ||
1852 | M: Dariusz Marcinkiewicz <reksio@newterm.pl> | ||
1853 | L: netdev@vger.kernel.org | ||
1854 | S: Maintained | ||
1855 | F: drivers/net/ethernet/ec_bhf.c | ||
1856 | |||
1845 | BFS FILE SYSTEM | 1857 | BFS FILE SYSTEM |
1846 | M: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk> | 1858 | M: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk> |
1847 | S: Maintained | 1859 | S: Maintained |
@@ -2058,7 +2070,7 @@ S: Supported | |||
2058 | F: drivers/scsi/bnx2i/ | 2070 | F: drivers/scsi/bnx2i/ |
2059 | 2071 | ||
2060 | BROADCOM KONA GPIO DRIVER | 2072 | BROADCOM KONA GPIO DRIVER |
2061 | M: Markus Mayer <markus.mayer@linaro.org> | 2073 | M: Ray Jui <rjui@broadcom.com> |
2062 | L: bcm-kernel-feedback-list@broadcom.com | 2074 | L: bcm-kernel-feedback-list@broadcom.com |
2063 | S: Supported | 2075 | S: Supported |
2064 | F: drivers/gpio/gpio-bcm-kona.c | 2076 | F: drivers/gpio/gpio-bcm-kona.c |
@@ -3114,6 +3126,17 @@ F: include/linux/host1x.h | |||
3114 | F: include/uapi/drm/tegra_drm.h | 3126 | F: include/uapi/drm/tegra_drm.h |
3115 | F: Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt | 3127 | F: Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt |
3116 | 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 | |||
3117 | DSBR100 USB FM RADIO DRIVER | 3140 | DSBR100 USB FM RADIO DRIVER |
3118 | M: Alexey Klimov <klimov.linux@gmail.com> | 3141 | M: Alexey Klimov <klimov.linux@gmail.com> |
3119 | L: linux-media@vger.kernel.org | 3142 | L: linux-media@vger.kernel.org |
@@ -3842,10 +3865,13 @@ F: drivers/tty/serial/ucc_uart.c | |||
3842 | 3865 | ||
3843 | FREESCALE SOC SOUND DRIVERS | 3866 | FREESCALE SOC SOUND DRIVERS |
3844 | 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> | ||
3845 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 3870 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
3846 | L: linuxppc-dev@lists.ozlabs.org | 3871 | L: linuxppc-dev@lists.ozlabs.org |
3847 | S: Maintained | 3872 | S: Maintained |
3848 | F: sound/soc/fsl/fsl* | 3873 | F: sound/soc/fsl/fsl* |
3874 | F: sound/soc/fsl/imx* | ||
3849 | F: sound/soc/fsl/mpc8610_hpcd.c | 3875 | F: sound/soc/fsl/mpc8610_hpcd.c |
3850 | 3876 | ||
3851 | FREEVXFS FILESYSTEM | 3877 | FREEVXFS FILESYSTEM |
@@ -4445,6 +4471,13 @@ F: include/linux/i2c-*.h | |||
4445 | F: include/uapi/linux/i2c.h | 4471 | F: include/uapi/linux/i2c.h |
4446 | F: include/uapi/linux/i2c-*.h | 4472 | F: include/uapi/linux/i2c-*.h |
4447 | 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 | F: drivers/i2c/i2c-acpi.c | ||
4480 | |||
4448 | I2C-TAOS-EVM DRIVER | 4481 | I2C-TAOS-EVM DRIVER |
4449 | M: Jean Delvare <jdelvare@suse.de> | 4482 | M: Jean Delvare <jdelvare@suse.de> |
4450 | L: linux-i2c@vger.kernel.org | 4483 | L: linux-i2c@vger.kernel.org |
@@ -5971,6 +6004,12 @@ T: git git://linuxtv.org/media_tree.git | |||
5971 | S: Maintained | 6004 | S: Maintained |
5972 | F: drivers/media/radio/radio-mr800.c | 6005 | F: drivers/media/radio/radio-mr800.c |
5973 | 6006 | ||
6007 | MRF24J40 IEEE 802.15.4 RADIO DRIVER | ||
6008 | M: Alan Ott <alan@signal11.us> | ||
6009 | L: linux-wpan@vger.kernel.org | ||
6010 | S: Maintained | ||
6011 | F: drivers/net/ieee802154/mrf24j40.c | ||
6012 | |||
5974 | MSI LAPTOP SUPPORT | 6013 | MSI LAPTOP SUPPORT |
5975 | M: "Lee, Chun-Yi" <jlee@suse.com> | 6014 | M: "Lee, Chun-Yi" <jlee@suse.com> |
5976 | L: platform-driver-x86@vger.kernel.org | 6015 | L: platform-driver-x86@vger.kernel.org |
@@ -6857,6 +6896,14 @@ S: Supported | |||
6857 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | 6896 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt |
6858 | F: drivers/pci/host/pci-tegra.c | 6897 | F: drivers/pci/host/pci-tegra.c |
6859 | 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 | |||
6860 | PCI DRIVER FOR RENESAS R-CAR | 6907 | PCI DRIVER FOR RENESAS R-CAR |
6861 | M: Simon Horman <horms@verge.net.au> | 6908 | M: Simon Horman <horms@verge.net.au> |
6862 | L: linux-pci@vger.kernel.org | 6909 | L: linux-pci@vger.kernel.org |
@@ -9514,6 +9561,14 @@ S: Maintained | |||
9514 | F: Documentation/usb/ohci.txt | 9561 | F: Documentation/usb/ohci.txt |
9515 | F: drivers/usb/host/ohci* | 9562 | F: drivers/usb/host/ohci* |
9516 | 9563 | ||
9564 | USB OVER IP DRIVER | ||
9565 | M: Valentina Manea <valentina.manea.m@gmail.com> | ||
9566 | M: Shuah Khan <shuah.kh@samsung.com> | ||
9567 | L: linux-usb@vger.kernel.org | ||
9568 | S: Maintained | ||
9569 | F: drivers/usb/usbip/ | ||
9570 | F: tools/usb/usbip/ | ||
9571 | |||
9517 | USB PEGASUS DRIVER | 9572 | USB PEGASUS DRIVER |
9518 | M: Petko Manolov <petkan@nucleusys.com> | 9573 | M: Petko Manolov <petkan@nucleusys.com> |
9519 | L: linux-usb@vger.kernel.org | 9574 | L: linux-usb@vger.kernel.org |
@@ -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 = -rc3 |
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..e88ddbf990e3 100644 --- a/arch/arc/mm/cache_arc700.c +++ b/arch/arc/mm/cache_arc700.c | |||
@@ -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/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi index bde1777b62be..d9d98697cca9 100644 --- a/arch/arm/boot/dts/am335x-bone-common.dtsi +++ b/arch/arm/boot/dts/am335x-bone-common.dtsi | |||
@@ -7,9 +7,6 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | / { | 9 | / { |
10 | model = "TI AM335x BeagleBone"; | ||
11 | compatible = "ti,am335x-bone", "ti,am33xx"; | ||
12 | |||
13 | cpus { | 10 | cpus { |
14 | cpu@0 { | 11 | cpu@0 { |
15 | cpu0-supply = <&dcdc2_reg>; | 12 | cpu0-supply = <&dcdc2_reg>; |
diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts index 94ee427a6db1..83d40f7655e5 100644 --- a/arch/arm/boot/dts/am335x-bone.dts +++ b/arch/arm/boot/dts/am335x-bone.dts | |||
@@ -10,6 +10,11 @@ | |||
10 | #include "am33xx.dtsi" | 10 | #include "am33xx.dtsi" |
11 | #include "am335x-bone-common.dtsi" | 11 | #include "am335x-bone-common.dtsi" |
12 | 12 | ||
13 | / { | ||
14 | model = "TI AM335x BeagleBone"; | ||
15 | compatible = "ti,am335x-bone", "ti,am33xx"; | ||
16 | }; | ||
17 | |||
13 | &ldo3_reg { | 18 | &ldo3_reg { |
14 | regulator-min-microvolt = <1800000>; | 19 | regulator-min-microvolt = <1800000>; |
15 | regulator-max-microvolt = <3300000>; | 20 | regulator-max-microvolt = <3300000>; |
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts index 305975d3f531..901739fcb85a 100644 --- a/arch/arm/boot/dts/am335x-boneblack.dts +++ b/arch/arm/boot/dts/am335x-boneblack.dts | |||
@@ -10,6 +10,11 @@ | |||
10 | #include "am33xx.dtsi" | 10 | #include "am33xx.dtsi" |
11 | #include "am335x-bone-common.dtsi" | 11 | #include "am335x-bone-common.dtsi" |
12 | 12 | ||
13 | / { | ||
14 | model = "TI AM335x BeagleBone Black"; | ||
15 | compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; | ||
16 | }; | ||
17 | |||
13 | &ldo3_reg { | 18 | &ldo3_reg { |
14 | regulator-min-microvolt = <1800000>; | 19 | regulator-min-microvolt = <1800000>; |
15 | regulator-max-microvolt = <1800000>; | 20 | regulator-max-microvolt = <1800000>; |
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..c6c58c1c00e3 100644 --- a/arch/arm/boot/dts/imx53.dtsi +++ b/arch/arm/boot/dts/imx53.dtsi | |||
@@ -731,7 +731,7 @@ | |||
731 | compatible = "fsl,imx53-vpu"; | 731 | compatible = "fsl,imx53-vpu"; |
732 | reg = <0x63ff4000 0x1000>; | 732 | reg = <0x63ff4000 0x1000>; |
733 | interrupts = <9>; | 733 | interrupts = <9>; |
734 | clocks = <&clks IMX5_CLK_VPU_GATE>, | 734 | clocks = <&clks IMX5_CLK_VPU_REFERENCE_GATE>, |
735 | <&clks IMX5_CLK_VPU_GATE>; | 735 | <&clks IMX5_CLK_VPU_GATE>; |
736 | clock-names = "per", "ahb"; | 736 | clock-names = "per", "ahb"; |
737 | resets = <&src 1>; | 737 | 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/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..1fe45d1f75ec 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -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/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi index 8cfa3c8a72b0..150513506c19 100644 --- a/arch/arm/boot/dts/omap4-panda-common.dtsi +++ b/arch/arm/boot/dts/omap4-panda-common.dtsi | |||
@@ -8,9 +8,6 @@ | |||
8 | #include "elpida_ecb240abacn.dtsi" | 8 | #include "elpida_ecb240abacn.dtsi" |
9 | 9 | ||
10 | / { | 10 | / { |
11 | model = "TI OMAP4 PandaBoard"; | ||
12 | compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4"; | ||
13 | |||
14 | memory { | 11 | memory { |
15 | device_type = "memory"; | 12 | device_type = "memory"; |
16 | reg = <0x80000000 0x40000000>; /* 1 GB */ | 13 | reg = <0x80000000 0x40000000>; /* 1 GB */ |
diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts index 816d1c95b592..2f1dabcc6adf 100644 --- a/arch/arm/boot/dts/omap4-panda-es.dts +++ b/arch/arm/boot/dts/omap4-panda-es.dts | |||
@@ -10,6 +10,11 @@ | |||
10 | #include "omap4460.dtsi" | 10 | #include "omap4460.dtsi" |
11 | #include "omap4-panda-common.dtsi" | 11 | #include "omap4-panda-common.dtsi" |
12 | 12 | ||
13 | / { | ||
14 | model = "TI OMAP4 PandaBoard-ES"; | ||
15 | compatible = "ti,omap4-panda-es", "ti,omap4-panda", "ti,omap4460", "ti,omap4430", "ti,omap4"; | ||
16 | }; | ||
17 | |||
13 | /* Audio routing is differnet between PandaBoard4430 and PandaBoardES */ | 18 | /* Audio routing is differnet between PandaBoard4430 and PandaBoardES */ |
14 | &sound { | 19 | &sound { |
15 | ti,model = "PandaBoardES"; | 20 | ti,model = "PandaBoardES"; |
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts index 6189a8b77d7f..a0e28b2e254e 100644 --- a/arch/arm/boot/dts/omap4-panda.dts +++ b/arch/arm/boot/dts/omap4-panda.dts | |||
@@ -9,3 +9,8 @@ | |||
9 | 9 | ||
10 | #include "omap443x.dtsi" | 10 | #include "omap443x.dtsi" |
11 | #include "omap4-panda-common.dtsi" | 11 | #include "omap4-panda-common.dtsi" |
12 | |||
13 | / { | ||
14 | model = "TI OMAP4 PandaBoard"; | ||
15 | compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4"; | ||
16 | }; | ||
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/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/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/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/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/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-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/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/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 9480997ba616..0b311d51425f 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #define gic_of_init NULL | 27 | #define gic_of_init NULL |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | static struct of_device_id omap_dt_match_table[] __initdata = { | 30 | static const struct of_device_id omap_dt_match_table[] __initconst = { |
31 | { .compatible = "simple-bus", }, | 31 | { .compatible = "simple-bus", }, |
32 | { .compatible = "ti,omap-infra", }, | 32 | { .compatible = "ti,omap-infra", }, |
33 | { } | 33 | { } |
@@ -43,7 +43,7 @@ static void __init omap_generic_init(void) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | #ifdef CONFIG_SOC_OMAP2420 | 45 | #ifdef CONFIG_SOC_OMAP2420 |
46 | static const char *omap242x_boards_compat[] __initconst = { | 46 | static const char *const omap242x_boards_compat[] __initconst = { |
47 | "ti,omap2420", | 47 | "ti,omap2420", |
48 | NULL, | 48 | NULL, |
49 | }; | 49 | }; |
@@ -62,7 +62,7 @@ MACHINE_END | |||
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #ifdef CONFIG_SOC_OMAP2430 | 64 | #ifdef CONFIG_SOC_OMAP2430 |
65 | static const char *omap243x_boards_compat[] __initconst = { | 65 | static const char *const omap243x_boards_compat[] __initconst = { |
66 | "ti,omap2430", | 66 | "ti,omap2430", |
67 | NULL, | 67 | NULL, |
68 | }; | 68 | }; |
@@ -81,7 +81,7 @@ MACHINE_END | |||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | #ifdef CONFIG_ARCH_OMAP3 | 83 | #ifdef CONFIG_ARCH_OMAP3 |
84 | static const char *omap3_boards_compat[] __initconst = { | 84 | static const char *const omap3_boards_compat[] __initconst = { |
85 | "ti,omap3430", | 85 | "ti,omap3430", |
86 | "ti,omap3", | 86 | "ti,omap3", |
87 | NULL, | 87 | NULL, |
@@ -100,7 +100,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") | |||
100 | .restart = omap3xxx_restart, | 100 | .restart = omap3xxx_restart, |
101 | MACHINE_END | 101 | MACHINE_END |
102 | 102 | ||
103 | static const char *omap36xx_boards_compat[] __initconst = { | 103 | static const char *const omap36xx_boards_compat[] __initconst = { |
104 | "ti,omap36xx", | 104 | "ti,omap36xx", |
105 | NULL, | 105 | NULL, |
106 | }; | 106 | }; |
@@ -118,7 +118,7 @@ DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)") | |||
118 | .restart = omap3xxx_restart, | 118 | .restart = omap3xxx_restart, |
119 | MACHINE_END | 119 | MACHINE_END |
120 | 120 | ||
121 | static const char *omap3_gp_boards_compat[] __initconst = { | 121 | static const char *const omap3_gp_boards_compat[] __initconst = { |
122 | "ti,omap3-beagle", | 122 | "ti,omap3-beagle", |
123 | "timll,omap3-devkit8000", | 123 | "timll,omap3-devkit8000", |
124 | NULL, | 124 | NULL, |
@@ -137,7 +137,7 @@ DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)") | |||
137 | .restart = omap3xxx_restart, | 137 | .restart = omap3xxx_restart, |
138 | MACHINE_END | 138 | MACHINE_END |
139 | 139 | ||
140 | static const char *am3517_boards_compat[] __initconst = { | 140 | static const char *const am3517_boards_compat[] __initconst = { |
141 | "ti,am3517", | 141 | "ti,am3517", |
142 | NULL, | 142 | NULL, |
143 | }; | 143 | }; |
@@ -157,7 +157,7 @@ MACHINE_END | |||
157 | #endif | 157 | #endif |
158 | 158 | ||
159 | #ifdef CONFIG_SOC_AM33XX | 159 | #ifdef CONFIG_SOC_AM33XX |
160 | static const char *am33xx_boards_compat[] __initconst = { | 160 | static const char *const am33xx_boards_compat[] __initconst = { |
161 | "ti,am33xx", | 161 | "ti,am33xx", |
162 | NULL, | 162 | NULL, |
163 | }; | 163 | }; |
@@ -177,7 +177,7 @@ MACHINE_END | |||
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | #ifdef CONFIG_ARCH_OMAP4 | 179 | #ifdef CONFIG_ARCH_OMAP4 |
180 | static const char *omap4_boards_compat[] __initconst = { | 180 | static const char *const omap4_boards_compat[] __initconst = { |
181 | "ti,omap4460", | 181 | "ti,omap4460", |
182 | "ti,omap4430", | 182 | "ti,omap4430", |
183 | "ti,omap4", | 183 | "ti,omap4", |
@@ -199,7 +199,7 @@ MACHINE_END | |||
199 | #endif | 199 | #endif |
200 | 200 | ||
201 | #ifdef CONFIG_SOC_OMAP5 | 201 | #ifdef CONFIG_SOC_OMAP5 |
202 | static const char *omap5_boards_compat[] __initconst = { | 202 | static const char *const omap5_boards_compat[] __initconst = { |
203 | "ti,omap5432", | 203 | "ti,omap5432", |
204 | "ti,omap5430", | 204 | "ti,omap5430", |
205 | "ti,omap5", | 205 | "ti,omap5", |
@@ -221,7 +221,7 @@ MACHINE_END | |||
221 | #endif | 221 | #endif |
222 | 222 | ||
223 | #ifdef CONFIG_SOC_AM43XX | 223 | #ifdef CONFIG_SOC_AM43XX |
224 | static const char *am43_boards_compat[] __initconst = { | 224 | static const char *const am43_boards_compat[] __initconst = { |
225 | "ti,am4372", | 225 | "ti,am4372", |
226 | "ti,am43", | 226 | "ti,am43", |
227 | NULL, | 227 | NULL, |
@@ -240,7 +240,7 @@ MACHINE_END | |||
240 | #endif | 240 | #endif |
241 | 241 | ||
242 | #ifdef CONFIG_SOC_DRA7XX | 242 | #ifdef CONFIG_SOC_DRA7XX |
243 | static const char *dra74x_boards_compat[] __initconst = { | 243 | static const char *const dra74x_boards_compat[] __initconst = { |
244 | "ti,dra742", | 244 | "ti,dra742", |
245 | "ti,dra7", | 245 | "ti,dra7", |
246 | NULL, | 246 | NULL, |
@@ -259,7 +259,7 @@ DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)") | |||
259 | .restart = omap44xx_restart, | 259 | .restart = omap44xx_restart, |
260 | MACHINE_END | 260 | MACHINE_END |
261 | 261 | ||
262 | static const char *dra72x_boards_compat[] __initconst = { | 262 | static const char *const dra72x_boards_compat[] __initconst = { |
263 | "ti,dra722", | 263 | "ti,dra722", |
264 | NULL, | 264 | NULL, |
265 | }; | 265 | }; |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index dc571f1d3b8a..79664411e794 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -307,7 +307,7 @@ static inline void omap4_cpu_resume(void) | |||
307 | 307 | ||
308 | #endif | 308 | #endif |
309 | 309 | ||
310 | void pdata_quirks_init(struct of_device_id *); | 310 | void pdata_quirks_init(const struct of_device_id *); |
311 | void omap_auxdata_legacy_init(struct device *dev); | 311 | void omap_auxdata_legacy_init(struct device *dev); |
312 | void omap_pcs_legacy_init(int irq, void (*rearm)(void)); | 312 | void omap_pcs_legacy_init(int irq, void (*rearm)(void)); |
313 | 313 | ||
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..4b26e5efa7f7 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -1244,7 +1244,7 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) | |||
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | #ifdef CONFIG_OF | 1246 | #ifdef CONFIG_OF |
1247 | static struct of_device_id gpmc_dt_ids[] = { | 1247 | static const struct of_device_id gpmc_dt_ids[] = { |
1248 | { .compatible = "ti,omap2420-gpmc" }, | 1248 | { .compatible = "ti,omap2420-gpmc" }, |
1249 | { .compatible = "ti,omap2430-gpmc" }, | 1249 | { .compatible = "ti,omap2430-gpmc" }, |
1250 | { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ | 1250 | { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ |
@@ -1403,8 +1403,11 @@ static int gpmc_probe_nand_child(struct platform_device *pdev, | |||
1403 | pr_err("%s: ti,nand-ecc-opt not found\n", __func__); | 1403 | pr_err("%s: ti,nand-ecc-opt not found\n", __func__); |
1404 | return -ENODEV; | 1404 | return -ENODEV; |
1405 | } | 1405 | } |
1406 | if (!strcmp(s, "ham1") || !strcmp(s, "sw") || | 1406 | |
1407 | !strcmp(s, "hw") || !strcmp(s, "hw-romcode")) | 1407 | if (!strcmp(s, "sw")) |
1408 | gpmc_nand_data->ecc_opt = OMAP_ECC_HAM1_CODE_SW; | ||
1409 | else if (!strcmp(s, "ham1") || | ||
1410 | !strcmp(s, "hw") || !strcmp(s, "hw-romcode")) | ||
1408 | gpmc_nand_data->ecc_opt = | 1411 | gpmc_nand_data->ecc_opt = |
1409 | OMAP_ECC_HAM1_CODE_HW; | 1412 | OMAP_ECC_HAM1_CODE_HW; |
1410 | else if (!strcmp(s, "bch4")) | 1413 | 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/irq.c b/arch/arm/mach-omap2/irq.c index 35b8590c322e..604a976abf14 100644 --- a/arch/arm/mach-omap2/irq.c +++ b/arch/arm/mach-omap2/irq.c | |||
@@ -289,7 +289,7 @@ int __init intc_of_init(struct device_node *node, | |||
289 | return 0; | 289 | return 0; |
290 | } | 290 | } |
291 | 291 | ||
292 | static struct of_device_id irq_match[] __initdata = { | 292 | static const struct of_device_id irq_match[] __initconst = { |
293 | { .compatible = "ti,omap2-intc", .data = intc_of_init, }, | 293 | { .compatible = "ti,omap2-intc", .data = intc_of_init, }, |
294 | { } | 294 | { } |
295 | }; | 295 | }; |
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c index 4001325f90fb..e9cdacfe1923 100644 --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c | |||
@@ -298,6 +298,10 @@ int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) | |||
298 | if (omap_rev() == OMAP4430_REV_ES1_0) | 298 | if (omap_rev() == OMAP4430_REV_ES1_0) |
299 | return -ENXIO; | 299 | return -ENXIO; |
300 | 300 | ||
301 | /* Use the achievable power state for the domain */ | ||
302 | power_state = pwrdm_get_valid_lp_state(pm_info->pwrdm, | ||
303 | false, power_state); | ||
304 | |||
301 | if (power_state == PWRDM_POWER_OFF) | 305 | if (power_state == PWRDM_POWER_OFF) |
302 | cpu_state = 1; | 306 | cpu_state = 1; |
303 | 307 | ||
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..8fd87a3055bf 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -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/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 90c88d498485..05a8c8b07449 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
@@ -405,7 +405,7 @@ static void pdata_quirks_check(struct pdata_init *quirks) | |||
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table) | 408 | void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table) |
409 | { | 409 | { |
410 | omap_sdrc_init(NULL, NULL); | 410 | omap_sdrc_init(NULL, NULL); |
411 | pdata_quirks_check(auxdata_quirks); | 411 | pdata_quirks_check(auxdata_quirks); |
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index 0dda6cf8b855..0bfce38a744a 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c | |||
@@ -29,6 +29,7 @@ u16 pm44xx_errata; | |||
29 | struct power_state { | 29 | struct power_state { |
30 | struct powerdomain *pwrdm; | 30 | struct powerdomain *pwrdm; |
31 | u32 next_state; | 31 | u32 next_state; |
32 | u32 next_logic_state; | ||
32 | #ifdef CONFIG_SUSPEND | 33 | #ifdef CONFIG_SUSPEND |
33 | u32 saved_state; | 34 | u32 saved_state; |
34 | u32 saved_logic_state; | 35 | u32 saved_logic_state; |
@@ -54,7 +55,7 @@ static int omap4_pm_suspend(void) | |||
54 | /* Set targeted power domain states by suspend */ | 55 | /* Set targeted power domain states by suspend */ |
55 | list_for_each_entry(pwrst, &pwrst_list, node) { | 56 | list_for_each_entry(pwrst, &pwrst_list, node) { |
56 | omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); | 57 | omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); |
57 | pwrdm_set_logic_retst(pwrst->pwrdm, PWRDM_POWER_OFF); | 58 | pwrdm_set_logic_retst(pwrst->pwrdm, pwrst->next_logic_state); |
58 | } | 59 | } |
59 | 60 | ||
60 | /* | 61 | /* |
@@ -120,7 +121,11 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | |||
120 | return -ENOMEM; | 121 | return -ENOMEM; |
121 | 122 | ||
122 | pwrst->pwrdm = pwrdm; | 123 | pwrst->pwrdm = pwrdm; |
123 | pwrst->next_state = PWRDM_POWER_RET; | 124 | pwrst->next_state = pwrdm_get_valid_lp_state(pwrdm, false, |
125 | PWRDM_POWER_RET); | ||
126 | pwrst->next_logic_state = pwrdm_get_valid_lp_state(pwrdm, true, | ||
127 | PWRDM_POWER_OFF); | ||
128 | |||
124 | list_add(&pwrst->node, &pwrst_list); | 129 | list_add(&pwrst->node, &pwrst_list); |
125 | 130 | ||
126 | return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); | 131 | return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index faebd5f076af..7fb033eca0a5 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -546,7 +546,8 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm, | |||
546 | return -EINVAL; | 546 | return -EINVAL; |
547 | 547 | ||
548 | for (i = 0; i < PWRDM_MAX_CLKDMS && !ret; i++) | 548 | for (i = 0; i < PWRDM_MAX_CLKDMS && !ret; i++) |
549 | ret = (*fn)(pwrdm, pwrdm->pwrdm_clkdms[i]); | 549 | if (pwrdm->pwrdm_clkdms[i]) |
550 | ret = (*fn)(pwrdm, pwrdm->pwrdm_clkdms[i]); | ||
550 | 551 | ||
551 | return ret; | 552 | return ret; |
552 | } | 553 | } |
@@ -1080,6 +1081,82 @@ int pwrdm_post_transition(struct powerdomain *pwrdm) | |||
1080 | } | 1081 | } |
1081 | 1082 | ||
1082 | /** | 1083 | /** |
1084 | * pwrdm_get_valid_lp_state() - Find best match deep power state | ||
1085 | * @pwrdm: power domain for which we want to find best match | ||
1086 | * @is_logic_state: Are we looking for logic state match here? Should | ||
1087 | * be one of PWRDM_xxx macro values | ||
1088 | * @req_state: requested power state | ||
1089 | * | ||
1090 | * Returns: closest match for requested power state. default fallback | ||
1091 | * is RET for logic state and ON for power state. | ||
1092 | * | ||
1093 | * This does a search from the power domain data looking for the | ||
1094 | * closest valid power domain state that the hardware can achieve. | ||
1095 | * PRCM definitions for PWRSTCTRL allows us to program whatever | ||
1096 | * configuration we'd like, and PRCM will actually attempt such | ||
1097 | * a transition, however if the powerdomain does not actually support it, | ||
1098 | * we endup with a hung system. The valid power domain states are already | ||
1099 | * available in our powerdomain data files. So this function tries to do | ||
1100 | * the following: | ||
1101 | * a) find if we have an exact match to the request - no issues. | ||
1102 | * b) else find if a deeper power state is possible. | ||
1103 | * c) failing which, it tries to find closest higher power state for the | ||
1104 | * request. | ||
1105 | */ | ||
1106 | u8 pwrdm_get_valid_lp_state(struct powerdomain *pwrdm, | ||
1107 | bool is_logic_state, u8 req_state) | ||
1108 | { | ||
1109 | u8 pwrdm_states = is_logic_state ? pwrdm->pwrsts_logic_ret : | ||
1110 | pwrdm->pwrsts; | ||
1111 | /* For logic, ret is highest and others, ON is highest */ | ||
1112 | u8 default_pwrst = is_logic_state ? PWRDM_POWER_RET : PWRDM_POWER_ON; | ||
1113 | u8 new_pwrst; | ||
1114 | bool found; | ||
1115 | |||
1116 | /* If it is already supported, nothing to search */ | ||
1117 | if (pwrdm_states & BIT(req_state)) | ||
1118 | return req_state; | ||
1119 | |||
1120 | if (!req_state) | ||
1121 | goto up_search; | ||
1122 | |||
1123 | /* | ||
1124 | * So, we dont have a exact match | ||
1125 | * Can we get a deeper power state match? | ||
1126 | */ | ||
1127 | new_pwrst = req_state - 1; | ||
1128 | found = true; | ||
1129 | while (!(pwrdm_states & BIT(new_pwrst))) { | ||
1130 | /* No match even at OFF? Not available */ | ||
1131 | if (new_pwrst == PWRDM_POWER_OFF) { | ||
1132 | found = false; | ||
1133 | break; | ||
1134 | } | ||
1135 | new_pwrst--; | ||
1136 | } | ||
1137 | |||
1138 | if (found) | ||
1139 | goto done; | ||
1140 | |||
1141 | up_search: | ||
1142 | /* OK, no deeper ones, can we get a higher match? */ | ||
1143 | new_pwrst = req_state + 1; | ||
1144 | while (!(pwrdm_states & BIT(new_pwrst))) { | ||
1145 | if (new_pwrst > PWRDM_POWER_ON) { | ||
1146 | WARN(1, "powerdomain: %s: Fix max powerstate to ON\n", | ||
1147 | pwrdm->name); | ||
1148 | return PWRDM_POWER_ON; | ||
1149 | } | ||
1150 | |||
1151 | if (new_pwrst == default_pwrst) | ||
1152 | break; | ||
1153 | new_pwrst++; | ||
1154 | } | ||
1155 | done: | ||
1156 | return new_pwrst; | ||
1157 | } | ||
1158 | |||
1159 | /** | ||
1083 | * omap_set_pwrdm_state - change a powerdomain's current power state | 1160 | * omap_set_pwrdm_state - change a powerdomain's current power state |
1084 | * @pwrdm: struct powerdomain * to change the power state of | 1161 | * @pwrdm: struct powerdomain * to change the power state of |
1085 | * @pwrst: power state to change to | 1162 | * @pwrst: power state to change to |
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h index f4727117f6cc..11bd4dd7d8d6 100644 --- a/arch/arm/mach-omap2/powerdomain.h +++ b/arch/arm/mach-omap2/powerdomain.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET) | 39 | #define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET) |
40 | #define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) | 40 | #define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) |
41 | #define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON) | 41 | #define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON) |
42 | #define PWRSTS_INA_ON (PWRSTS_INACTIVE | PWRSTS_ON) | ||
42 | 43 | ||
43 | 44 | ||
44 | /* | 45 | /* |
@@ -219,6 +220,9 @@ struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm); | |||
219 | 220 | ||
220 | int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm); | 221 | int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm); |
221 | 222 | ||
223 | u8 pwrdm_get_valid_lp_state(struct powerdomain *pwrdm, | ||
224 | bool is_logic_state, u8 req_state); | ||
225 | |||
222 | int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); | 226 | int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); |
223 | int pwrdm_read_next_pwrst(struct powerdomain *pwrdm); | 227 | int pwrdm_read_next_pwrst(struct powerdomain *pwrdm); |
224 | int pwrdm_read_pwrst(struct powerdomain *pwrdm); | 228 | int pwrdm_read_pwrst(struct powerdomain *pwrdm); |
diff --git a/arch/arm/mach-omap2/powerdomains54xx_data.c b/arch/arm/mach-omap2/powerdomains54xx_data.c index ce1d752af991..60d7ed8ef8ca 100644 --- a/arch/arm/mach-omap2/powerdomains54xx_data.c +++ b/arch/arm/mach-omap2/powerdomains54xx_data.c | |||
@@ -35,7 +35,7 @@ static struct powerdomain core_54xx_pwrdm = { | |||
35 | .prcm_offs = OMAP54XX_PRM_CORE_INST, | 35 | .prcm_offs = OMAP54XX_PRM_CORE_INST, |
36 | .prcm_partition = OMAP54XX_PRM_PARTITION, | 36 | .prcm_partition = OMAP54XX_PRM_PARTITION, |
37 | .pwrsts = PWRSTS_RET_ON, | 37 | .pwrsts = PWRSTS_RET_ON, |
38 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 38 | .pwrsts_logic_ret = PWRSTS_RET, |
39 | .banks = 5, | 39 | .banks = 5, |
40 | .pwrsts_mem_ret = { | 40 | .pwrsts_mem_ret = { |
41 | [0] = PWRSTS_OFF_RET, /* core_nret_bank */ | 41 | [0] = PWRSTS_OFF_RET, /* core_nret_bank */ |
@@ -107,8 +107,8 @@ static struct powerdomain cpu0_54xx_pwrdm = { | |||
107 | .voltdm = { .name = "mpu" }, | 107 | .voltdm = { .name = "mpu" }, |
108 | .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C0_INST, | 108 | .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C0_INST, |
109 | .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION, | 109 | .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION, |
110 | .pwrsts = PWRSTS_OFF_RET_ON, | 110 | .pwrsts = PWRSTS_RET_ON, |
111 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 111 | .pwrsts_logic_ret = PWRSTS_RET, |
112 | .banks = 1, | 112 | .banks = 1, |
113 | .pwrsts_mem_ret = { | 113 | .pwrsts_mem_ret = { |
114 | [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ | 114 | [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ |
@@ -124,8 +124,8 @@ static struct powerdomain cpu1_54xx_pwrdm = { | |||
124 | .voltdm = { .name = "mpu" }, | 124 | .voltdm = { .name = "mpu" }, |
125 | .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C1_INST, | 125 | .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C1_INST, |
126 | .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION, | 126 | .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION, |
127 | .pwrsts = PWRSTS_OFF_RET_ON, | 127 | .pwrsts = PWRSTS_RET_ON, |
128 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 128 | .pwrsts_logic_ret = PWRSTS_RET, |
129 | .banks = 1, | 129 | .banks = 1, |
130 | .pwrsts_mem_ret = { | 130 | .pwrsts_mem_ret = { |
131 | [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ | 131 | [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ |
@@ -158,7 +158,7 @@ static struct powerdomain mpu_54xx_pwrdm = { | |||
158 | .prcm_offs = OMAP54XX_PRM_MPU_INST, | 158 | .prcm_offs = OMAP54XX_PRM_MPU_INST, |
159 | .prcm_partition = OMAP54XX_PRM_PARTITION, | 159 | .prcm_partition = OMAP54XX_PRM_PARTITION, |
160 | .pwrsts = PWRSTS_RET_ON, | 160 | .pwrsts = PWRSTS_RET_ON, |
161 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 161 | .pwrsts_logic_ret = PWRSTS_RET, |
162 | .banks = 2, | 162 | .banks = 2, |
163 | .pwrsts_mem_ret = { | 163 | .pwrsts_mem_ret = { |
164 | [0] = PWRSTS_OFF_RET, /* mpu_l2 */ | 164 | [0] = PWRSTS_OFF_RET, /* mpu_l2 */ |
diff --git a/arch/arm/mach-omap2/powerdomains7xx_data.c b/arch/arm/mach-omap2/powerdomains7xx_data.c index 48151d1cfde0..287a2037aa16 100644 --- a/arch/arm/mach-omap2/powerdomains7xx_data.c +++ b/arch/arm/mach-omap2/powerdomains7xx_data.c | |||
@@ -160,8 +160,8 @@ static struct powerdomain core_7xx_pwrdm = { | |||
160 | .name = "core_pwrdm", | 160 | .name = "core_pwrdm", |
161 | .prcm_offs = DRA7XX_PRM_CORE_INST, | 161 | .prcm_offs = DRA7XX_PRM_CORE_INST, |
162 | .prcm_partition = DRA7XX_PRM_PARTITION, | 162 | .prcm_partition = DRA7XX_PRM_PARTITION, |
163 | .pwrsts = PWRSTS_RET_ON, | 163 | .pwrsts = PWRSTS_INA_ON, |
164 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 164 | .pwrsts_logic_ret = PWRSTS_RET, |
165 | .banks = 5, | 165 | .banks = 5, |
166 | .pwrsts_mem_ret = { | 166 | .pwrsts_mem_ret = { |
167 | [0] = PWRSTS_OFF_RET, /* core_nret_bank */ | 167 | [0] = PWRSTS_OFF_RET, /* core_nret_bank */ |
@@ -193,8 +193,8 @@ static struct powerdomain cpu0_7xx_pwrdm = { | |||
193 | .name = "cpu0_pwrdm", | 193 | .name = "cpu0_pwrdm", |
194 | .prcm_offs = DRA7XX_MPU_PRCM_PRM_C0_INST, | 194 | .prcm_offs = DRA7XX_MPU_PRCM_PRM_C0_INST, |
195 | .prcm_partition = DRA7XX_MPU_PRCM_PARTITION, | 195 | .prcm_partition = DRA7XX_MPU_PRCM_PARTITION, |
196 | .pwrsts = PWRSTS_OFF_RET_ON, | 196 | .pwrsts = PWRSTS_RET_ON, |
197 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 197 | .pwrsts_logic_ret = PWRSTS_RET, |
198 | .banks = 1, | 198 | .banks = 1, |
199 | .pwrsts_mem_ret = { | 199 | .pwrsts_mem_ret = { |
200 | [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ | 200 | [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ |
@@ -209,8 +209,8 @@ static struct powerdomain cpu1_7xx_pwrdm = { | |||
209 | .name = "cpu1_pwrdm", | 209 | .name = "cpu1_pwrdm", |
210 | .prcm_offs = DRA7XX_MPU_PRCM_PRM_C1_INST, | 210 | .prcm_offs = DRA7XX_MPU_PRCM_PRM_C1_INST, |
211 | .prcm_partition = DRA7XX_MPU_PRCM_PARTITION, | 211 | .prcm_partition = DRA7XX_MPU_PRCM_PARTITION, |
212 | .pwrsts = PWRSTS_OFF_RET_ON, | 212 | .pwrsts = PWRSTS_RET_ON, |
213 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 213 | .pwrsts_logic_ret = PWRSTS_RET, |
214 | .banks = 1, | 214 | .banks = 1, |
215 | .pwrsts_mem_ret = { | 215 | .pwrsts_mem_ret = { |
216 | [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ | 216 | [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ |
@@ -243,7 +243,7 @@ static struct powerdomain mpu_7xx_pwrdm = { | |||
243 | .prcm_offs = DRA7XX_PRM_MPU_INST, | 243 | .prcm_offs = DRA7XX_PRM_MPU_INST, |
244 | .prcm_partition = DRA7XX_PRM_PARTITION, | 244 | .prcm_partition = DRA7XX_PRM_PARTITION, |
245 | .pwrsts = PWRSTS_RET_ON, | 245 | .pwrsts = PWRSTS_RET_ON, |
246 | .pwrsts_logic_ret = PWRSTS_OFF_RET, | 246 | .pwrsts_logic_ret = PWRSTS_RET, |
247 | .banks = 2, | 247 | .banks = 2, |
248 | .pwrsts_mem_ret = { | 248 | .pwrsts_mem_ret = { |
249 | [0] = PWRSTS_OFF_RET, /* mpu_l2 */ | 249 | [0] = PWRSTS_OFF_RET, /* mpu_l2 */ |
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index 76ca320f007c..74054b813600 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c | |||
@@ -467,7 +467,7 @@ int prm_unregister(struct prm_ll_data *pld) | |||
467 | return 0; | 467 | return 0; |
468 | } | 468 | } |
469 | 469 | ||
470 | static struct of_device_id omap_prcm_dt_match_table[] = { | 470 | static const struct of_device_id omap_prcm_dt_match_table[] = { |
471 | { .compatible = "ti,am3-prcm" }, | 471 | { .compatible = "ti,am3-prcm" }, |
472 | { .compatible = "ti,am3-scrm" }, | 472 | { .compatible = "ti,am3-scrm" }, |
473 | { .compatible = "ti,am4-prcm" }, | 473 | { .compatible = "ti,am4-prcm" }, |
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-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 43d03fbf4c0b..4f61148ec168 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -141,7 +141,7 @@ static struct property device_disabled = { | |||
141 | .value = "disabled", | 141 | .value = "disabled", |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static struct of_device_id omap_timer_match[] __initdata = { | 144 | static const struct of_device_id omap_timer_match[] __initconst = { |
145 | { .compatible = "ti,omap2420-timer", }, | 145 | { .compatible = "ti,omap2420-timer", }, |
146 | { .compatible = "ti,omap3430-timer", }, | 146 | { .compatible = "ti,omap3430-timer", }, |
147 | { .compatible = "ti,omap4430-timer", }, | 147 | { .compatible = "ti,omap4430-timer", }, |
@@ -162,7 +162,7 @@ static struct of_device_id omap_timer_match[] __initdata = { | |||
162 | * the timer node in device-tree as disabled, to prevent the kernel from | 162 | * the timer node in device-tree as disabled, to prevent the kernel from |
163 | * registering this timer as a platform device and so no one else can use it. | 163 | * registering this timer as a platform device and so no one else can use it. |
164 | */ | 164 | */ |
165 | static struct device_node * __init omap_get_timer_dt(struct of_device_id *match, | 165 | static struct device_node * __init omap_get_timer_dt(const struct of_device_id *match, |
166 | const char *property) | 166 | const char *property) |
167 | { | 167 | { |
168 | struct device_node *np; | 168 | struct device_node *np; |
@@ -388,7 +388,7 @@ static u64 notrace dmtimer_read_sched_clock(void) | |||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
390 | 390 | ||
391 | static struct of_device_id omap_counter_match[] __initdata = { | 391 | static const struct of_device_id omap_counter_match[] __initconst = { |
392 | { .compatible = "ti,omap-counter32k", }, | 392 | { .compatible = "ti,omap-counter32k", }, |
393 | { } | 393 | { } |
394 | }; | 394 | }; |
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/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/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/head.S b/arch/arm64/kernel/head.S index 144f10567f82..bed028364a93 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 | ||
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 0310811bd77d..70526cfda056 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c | |||
@@ -1115,19 +1115,15 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs) | |||
1115 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 1115 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
1116 | trace_sys_enter(regs, regs->syscallno); | 1116 | trace_sys_enter(regs, regs->syscallno); |
1117 | 1117 | ||
1118 | #ifdef CONFIG_AUDITSYSCALL | ||
1119 | audit_syscall_entry(syscall_get_arch(), regs->syscallno, | 1118 | audit_syscall_entry(syscall_get_arch(), regs->syscallno, |
1120 | regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]); | 1119 | regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]); |
1121 | #endif | ||
1122 | 1120 | ||
1123 | return regs->syscallno; | 1121 | return regs->syscallno; |
1124 | } | 1122 | } |
1125 | 1123 | ||
1126 | asmlinkage void syscall_trace_exit(struct pt_regs *regs) | 1124 | asmlinkage void syscall_trace_exit(struct pt_regs *regs) |
1127 | { | 1125 | { |
1128 | #ifdef CONFIG_AUDITSYSCALL | ||
1129 | audit_syscall_exit(regs); | 1126 | audit_syscall_exit(regs); |
1130 | #endif | ||
1131 | 1127 | ||
1132 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 1128 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
1133 | trace_sys_exit(regs, regs_return_value(regs)); | 1129 | trace_sys_exit(regs, regs_return_value(regs)); |
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 5b4526ee3a01..5472c2401876 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> |
@@ -148,7 +149,8 @@ void __init arm64_memblock_init(void) | |||
148 | memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); | 149 | memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); |
149 | #endif | 150 | #endif |
150 | 151 | ||
151 | early_init_fdt_scan_reserved_mem(); | 152 | if (!efi_enabled(EFI_MEMMAP)) |
153 | early_init_fdt_scan_reserved_mem(); | ||
152 | 154 | ||
153 | /* 4GB maximum for 32-bit only capable devices */ | 155 | /* 4GB maximum for 32-bit only capable devices */ |
154 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | 156 | if (IS_ENABLED(CONFIG_ZONE_DMA)) |
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/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..6a65bb7d0657 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 1339 | ||
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/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/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..900c7e5333b6 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -2396,8 +2396,6 @@ source "kernel/Kconfig.preempt" | |||
2396 | 2396 | ||
2397 | config KEXEC | 2397 | config KEXEC |
2398 | bool "Kexec system call" | 2398 | bool "Kexec system call" |
2399 | select CRYPTO | ||
2400 | select CRYPTO_SHA256 | ||
2401 | help | 2399 | help |
2402 | kexec is a system call that implements the ability to shutdown your | 2400 | 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 | 2401 | current kernel, and to start another kernel. It is like a reboot |
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/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/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-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/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/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/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/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/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 13b964fddc4a..25bb8400156d 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 | ||
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/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/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/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/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/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/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/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..22aac5885ba2 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -2060,6 +2060,13 @@ void s390_reset_system(void (*func)(void *), void *data) | |||
2060 | S390_lowcore.program_new_psw.addr = | 2060 | S390_lowcore.program_new_psw.addr = |
2061 | PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; | 2061 | PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; |
2062 | 2062 | ||
2063 | /* | ||
2064 | * Clear subchannel ID and number to signal new kernel that no CCW or | ||
2065 | * SCSI IPL has been done (for kexec and kdump) | ||
2066 | */ | ||
2067 | S390_lowcore.subchannel_id = 0; | ||
2068 | S390_lowcore.subchannel_nr = 0; | ||
2069 | |||
2063 | /* Store status at absolute zero */ | 2070 | /* Store status at absolute zero */ |
2064 | store_status(); | 2071 | store_status(); |
2065 | 2072 | ||
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/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/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/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..778178f4c7d1 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -1585,9 +1585,6 @@ source kernel/Kconfig.hz | |||
1585 | 1585 | ||
1586 | config KEXEC | 1586 | config KEXEC |
1587 | bool "kexec system call" | 1587 | bool "kexec system call" |
1588 | select BUILD_BIN2C | ||
1589 | select CRYPTO | ||
1590 | select CRYPTO_SHA256 | ||
1591 | ---help--- | 1588 | ---help--- |
1592 | kexec is a system call that implements the ability to shutdown your | 1589 | 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 | 1590 | current kernel, and to start another kernel. It is like a reboot |
@@ -1602,9 +1599,22 @@ config KEXEC | |||
1602 | interface is strongly in flux, so no good recommendation can be | 1599 | interface is strongly in flux, so no good recommendation can be |
1603 | made. | 1600 | made. |
1604 | 1601 | ||
1602 | config KEXEC_FILE | ||
1603 | bool "kexec file based system call" | ||
1604 | select BUILD_BIN2C | ||
1605 | depends on KEXEC | ||
1606 | depends on X86_64 | ||
1607 | depends on CRYPTO=y | ||
1608 | depends on CRYPTO_SHA256=y | ||
1609 | ---help--- | ||
1610 | This is new version of kexec system call. This system call is | ||
1611 | file based and takes file descriptors as system call argument | ||
1612 | for kernel and initramfs as opposed to list of segments as | ||
1613 | accepted by previous system call. | ||
1614 | |||
1605 | config KEXEC_VERIFY_SIG | 1615 | config KEXEC_VERIFY_SIG |
1606 | bool "Verify kernel signature during kexec_file_load() syscall" | 1616 | bool "Verify kernel signature during kexec_file_load() syscall" |
1607 | depends on KEXEC | 1617 | depends on KEXEC_FILE |
1608 | ---help--- | 1618 | ---help--- |
1609 | This option makes kernel signature verification mandatory for | 1619 | This option makes kernel signature verification mandatory for |
1610 | kexec_file_load() syscall. If kernel is signature can not be | 1620 | 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/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 0aeed5ca356e..478c490f3654 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 |
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/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/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/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/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/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/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-mq.c b/block/blk-mq.c index 5189cb1e478a..4aac82615a46 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -112,18 +112,22 @@ 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 | percpu_ref_kill(&q->mq_usage_counter); |
123 | blk_mq_run_queues(q, false); | ||
124 | } | ||
121 | wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); | 125 | wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); |
122 | } | 126 | } |
123 | 127 | ||
124 | static void blk_mq_unfreeze_queue(struct request_queue *q) | 128 | static void blk_mq_unfreeze_queue(struct request_queue *q) |
125 | { | 129 | { |
126 | bool wake = false; | 130 | bool wake; |
127 | 131 | ||
128 | spin_lock_irq(q->queue_lock); | 132 | spin_lock_irq(q->queue_lock); |
129 | wake = !--q->mq_freeze_depth; | 133 | wake = !--q->mq_freeze_depth; |
@@ -172,6 +176,8 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx, | |||
172 | /* tag was already set */ | 176 | /* tag was already set */ |
173 | rq->errors = 0; | 177 | rq->errors = 0; |
174 | 178 | ||
179 | rq->cmd = rq->__cmd; | ||
180 | |||
175 | rq->extra_len = 0; | 181 | rq->extra_len = 0; |
176 | rq->sense_len = 0; | 182 | rq->sense_len = 0; |
177 | rq->resid_len = 0; | 183 | rq->resid_len = 0; |
@@ -1068,13 +1074,17 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio) | |||
1068 | blk_account_io_start(rq, 1); | 1074 | blk_account_io_start(rq, 1); |
1069 | } | 1075 | } |
1070 | 1076 | ||
1077 | static inline bool hctx_allow_merges(struct blk_mq_hw_ctx *hctx) | ||
1078 | { | ||
1079 | return (hctx->flags & BLK_MQ_F_SHOULD_MERGE) && | ||
1080 | !blk_queue_nomerges(hctx->queue); | ||
1081 | } | ||
1082 | |||
1071 | static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx, | 1083 | static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx, |
1072 | struct blk_mq_ctx *ctx, | 1084 | struct blk_mq_ctx *ctx, |
1073 | struct request *rq, struct bio *bio) | 1085 | struct request *rq, struct bio *bio) |
1074 | { | 1086 | { |
1075 | struct request_queue *q = hctx->queue; | 1087 | if (!hctx_allow_merges(hctx)) { |
1076 | |||
1077 | if (!(hctx->flags & BLK_MQ_F_SHOULD_MERGE)) { | ||
1078 | blk_mq_bio_to_request(rq, bio); | 1088 | blk_mq_bio_to_request(rq, bio); |
1079 | spin_lock(&ctx->lock); | 1089 | spin_lock(&ctx->lock); |
1080 | insert_rq: | 1090 | insert_rq: |
@@ -1082,6 +1092,8 @@ insert_rq: | |||
1082 | spin_unlock(&ctx->lock); | 1092 | spin_unlock(&ctx->lock); |
1083 | return false; | 1093 | return false; |
1084 | } else { | 1094 | } else { |
1095 | struct request_queue *q = hctx->queue; | ||
1096 | |||
1085 | spin_lock(&ctx->lock); | 1097 | spin_lock(&ctx->lock); |
1086 | if (!blk_mq_attempt_merge(q, ctx, bio)) { | 1098 | if (!blk_mq_attempt_merge(q, ctx, bio)) { |
1087 | blk_mq_bio_to_request(rq, bio); | 1099 | blk_mq_bio_to_request(rq, bio); |
@@ -1574,7 +1586,7 @@ static int blk_mq_init_hw_queues(struct request_queue *q, | |||
1574 | hctx->tags = set->tags[i]; | 1586 | hctx->tags = set->tags[i]; |
1575 | 1587 | ||
1576 | /* | 1588 | /* |
1577 | * Allocate space for all possible cpus to avoid allocation in | 1589 | * Allocate space for all possible cpus to avoid allocation at |
1578 | * runtime | 1590 | * runtime |
1579 | */ | 1591 | */ |
1580 | hctx->ctxs = kmalloc_node(nr_cpu_ids * sizeof(void *), | 1592 | hctx->ctxs = kmalloc_node(nr_cpu_ids * sizeof(void *), |
@@ -1662,8 +1674,8 @@ static void blk_mq_map_swqueue(struct request_queue *q) | |||
1662 | 1674 | ||
1663 | queue_for_each_hw_ctx(q, hctx, i) { | 1675 | queue_for_each_hw_ctx(q, hctx, i) { |
1664 | /* | 1676 | /* |
1665 | * If not software queues are mapped to this hardware queue, | 1677 | * If no software queues are mapped to this hardware queue, |
1666 | * disable it and free the request entries | 1678 | * disable it and free the request entries. |
1667 | */ | 1679 | */ |
1668 | if (!hctx->nr_ctx) { | 1680 | if (!hctx->nr_ctx) { |
1669 | struct blk_mq_tag_set *set = q->tag_set; | 1681 | struct blk_mq_tag_set *set = q->tag_set; |
@@ -1713,14 +1725,10 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q) | |||
1713 | { | 1725 | { |
1714 | struct blk_mq_tag_set *set = q->tag_set; | 1726 | struct blk_mq_tag_set *set = q->tag_set; |
1715 | 1727 | ||
1716 | blk_mq_freeze_queue(q); | ||
1717 | |||
1718 | mutex_lock(&set->tag_list_lock); | 1728 | mutex_lock(&set->tag_list_lock); |
1719 | list_del_init(&q->tag_set_list); | 1729 | list_del_init(&q->tag_set_list); |
1720 | blk_mq_update_tag_set_depth(set); | 1730 | blk_mq_update_tag_set_depth(set); |
1721 | mutex_unlock(&set->tag_list_lock); | 1731 | mutex_unlock(&set->tag_list_lock); |
1722 | |||
1723 | blk_mq_unfreeze_queue(q); | ||
1724 | } | 1732 | } |
1725 | 1733 | ||
1726 | static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, | 1734 | static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, |
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/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/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index ce06149088c5..9dfec48dd4e5 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) }, |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index a66ab658abbc..9922cc46b15c 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; |
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/scan.c b/drivers/acpi/scan.c index 0a817ad24f16..9a9298994e26 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -922,12 +922,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data) | |||
922 | device->driver->ops.notify(device, event); | 922 | device->driver->ops.notify(device, event); |
923 | } | 923 | } |
924 | 924 | ||
925 | static acpi_status acpi_device_notify_fixed(void *data) | 925 | static void acpi_device_notify_fixed(void *data) |
926 | { | 926 | { |
927 | struct acpi_device *device = data; | 927 | struct acpi_device *device = data; |
928 | 928 | ||
929 | /* Fixed hardware devices have no handles */ | 929 | /* Fixed hardware devices have no handles */ |
930 | acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); | 930 | acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); |
931 | } | ||
932 | |||
933 | static acpi_status acpi_device_fixed_event(void *data) | ||
934 | { | ||
935 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data); | ||
931 | return AE_OK; | 936 | return AE_OK; |
932 | } | 937 | } |
933 | 938 | ||
@@ -938,12 +943,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device) | |||
938 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) | 943 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) |
939 | status = | 944 | status = |
940 | acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, | 945 | acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, |
941 | acpi_device_notify_fixed, | 946 | acpi_device_fixed_event, |
942 | device); | 947 | device); |
943 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) | 948 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) |
944 | status = | 949 | status = |
945 | acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, | 950 | acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, |
946 | acpi_device_notify_fixed, | 951 | acpi_device_fixed_event, |
947 | device); | 952 | device); |
948 | else | 953 | else |
949 | status = acpi_install_notify_handler(device->handle, | 954 | status = acpi_install_notify_handler(device->handle, |
@@ -960,10 +965,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) | |||
960 | { | 965 | { |
961 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) | 966 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) |
962 | acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, | 967 | acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, |
963 | acpi_device_notify_fixed); | 968 | acpi_device_fixed_event); |
964 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) | 969 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) |
965 | acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, | 970 | acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, |
966 | acpi_device_notify_fixed); | 971 | acpi_device_fixed_event); |
967 | else | 972 | else |
968 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | 973 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, |
969 | acpi_device_notify); | 974 | acpi_device_notify); |
@@ -975,7 +980,7 @@ static int acpi_device_probe(struct device *dev) | |||
975 | struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); | 980 | struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); |
976 | int ret; | 981 | int ret; |
977 | 982 | ||
978 | if (acpi_dev->handler) | 983 | if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev)) |
979 | return -EINVAL; | 984 | return -EINVAL; |
980 | 985 | ||
981 | if (!acpi_drv->ops.add) | 986 | if (!acpi_drv->ops.add) |
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c index fc3df47fca35..f1fef74e503c 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c | |||
@@ -24,8 +24,8 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/of_device.h> | 25 | #include <linux/of_device.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/tegra-powergate.h> | ||
28 | #include <linux/regulator/consumer.h> | 27 | #include <linux/regulator/consumer.h> |
28 | #include <soc/tegra/pmc.h> | ||
29 | #include "ahci.h" | 29 | #include "ahci.h" |
30 | 30 | ||
31 | #define SATA_CONFIGURATION_0 0x180 | 31 | #define SATA_CONFIGURATION_0 0x180 |
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index bc281115490b..c6962300b93c 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -344,7 +344,7 @@ static struct ata_port_operations xgene_ahci_ops = { | |||
344 | }; | 344 | }; |
345 | 345 | ||
346 | static const struct ata_port_info xgene_ahci_port_info = { | 346 | static const struct ata_port_info xgene_ahci_port_info = { |
347 | .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ, | 347 | .flags = AHCI_FLAG_COMMON, |
348 | .pio_mask = ATA_PIO4, | 348 | .pio_mask = ATA_PIO4, |
349 | .udma_mask = ATA_UDMA6, | 349 | .udma_mask = ATA_UDMA6, |
350 | .port_ops = &xgene_ahci_ops, | 350 | .port_ops = &xgene_ahci_ops, |
@@ -480,7 +480,7 @@ static int xgene_ahci_probe(struct platform_device *pdev) | |||
480 | /* Configure the host controller */ | 480 | /* Configure the host controller */ |
481 | xgene_ahci_hw_init(hpriv); | 481 | xgene_ahci_hw_init(hpriv); |
482 | 482 | ||
483 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ; | 483 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ; |
484 | 484 | ||
485 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); | 485 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); |
486 | if (rc) | 486 | if (rc) |
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_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/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/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..6f550d9e7a2d 100644 --- a/drivers/bus/arm-ccn.c +++ b/drivers/bus/arm-ccn.c | |||
@@ -662,7 +662,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
662 | } | 662 | } |
663 | if (e->num_vcs && vc >= e->num_vcs) { | 663 | if (e->num_vcs && vc >= e->num_vcs) { |
664 | dev_warn(ccn->dev, "Invalid vc %d for node/XP %d!\n", | 664 | dev_warn(ccn->dev, "Invalid vc %d for node/XP %d!\n", |
665 | port, node_xp); | 665 | vc, node_xp); |
666 | return -EINVAL; | 666 | return -EINVAL; |
667 | } | 667 | } |
668 | valid = 1; | 668 | valid = 1; |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index c5eac949760d..e396ad3f8f3f 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 | } |
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/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/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-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-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/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/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_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..7a830eac5ba3 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1458,7 +1458,7 @@ struct drm_i915_private { | |||
1458 | } hpd_mark; | 1458 | } hpd_mark; |
1459 | } hpd_stats[HPD_NUM_PINS]; | 1459 | } hpd_stats[HPD_NUM_PINS]; |
1460 | u32 hpd_event_bits; | 1460 | u32 hpd_event_bits; |
1461 | struct timer_list hotplug_reenable_timer; | 1461 | struct delayed_work hotplug_reenable_work; |
1462 | 1462 | ||
1463 | struct i915_fbc fbc; | 1463 | struct i915_fbc fbc; |
1464 | struct i915_drrs drrs; | 1464 | struct i915_drrs drrs; |
@@ -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_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/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 2efaf8e8d9c4..e8abfce40976 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; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 018fb7222f60..d074d704f458 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -8462,8 +8462,6 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, | |||
8462 | connector->base.id, connector->name, | 8462 | connector->base.id, connector->name, |
8463 | encoder->base.id, encoder->name); | 8463 | encoder->base.id, encoder->name); |
8464 | 8464 | ||
8465 | drm_modeset_acquire_init(ctx, 0); | ||
8466 | |||
8467 | retry: | 8465 | retry: |
8468 | ret = drm_modeset_lock(&config->connection_mutex, ctx); | 8466 | ret = drm_modeset_lock(&config->connection_mutex, ctx); |
8469 | if (ret) | 8467 | if (ret) |
@@ -8502,10 +8500,14 @@ retry: | |||
8502 | i++; | 8500 | i++; |
8503 | if (!(encoder->possible_crtcs & (1 << i))) | 8501 | if (!(encoder->possible_crtcs & (1 << i))) |
8504 | continue; | 8502 | continue; |
8505 | if (!possible_crtc->enabled) { | 8503 | if (possible_crtc->enabled) |
8506 | crtc = possible_crtc; | 8504 | continue; |
8507 | break; | 8505 | /* This can occur when applying the pipe A quirk on resume. */ |
8508 | } | 8506 | if (to_intel_crtc(possible_crtc)->new_enabled) |
8507 | continue; | ||
8508 | |||
8509 | crtc = possible_crtc; | ||
8510 | break; | ||
8509 | } | 8511 | } |
8510 | 8512 | ||
8511 | /* | 8513 | /* |
@@ -8574,15 +8576,11 @@ fail_unlock: | |||
8574 | goto retry; | 8576 | goto retry; |
8575 | } | 8577 | } |
8576 | 8578 | ||
8577 | drm_modeset_drop_locks(ctx); | ||
8578 | drm_modeset_acquire_fini(ctx); | ||
8579 | |||
8580 | return false; | 8579 | return false; |
8581 | } | 8580 | } |
8582 | 8581 | ||
8583 | void intel_release_load_detect_pipe(struct drm_connector *connector, | 8582 | void intel_release_load_detect_pipe(struct drm_connector *connector, |
8584 | struct intel_load_detect_pipe *old, | 8583 | struct intel_load_detect_pipe *old) |
8585 | struct drm_modeset_acquire_ctx *ctx) | ||
8586 | { | 8584 | { |
8587 | struct intel_encoder *intel_encoder = | 8585 | struct intel_encoder *intel_encoder = |
8588 | intel_attached_encoder(connector); | 8586 | intel_attached_encoder(connector); |
@@ -8606,17 +8604,12 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, | |||
8606 | drm_framebuffer_unreference(old->release_fb); | 8604 | drm_framebuffer_unreference(old->release_fb); |
8607 | } | 8605 | } |
8608 | 8606 | ||
8609 | goto unlock; | ||
8610 | return; | 8607 | return; |
8611 | } | 8608 | } |
8612 | 8609 | ||
8613 | /* Switch crtc and encoder back off if necessary */ | 8610 | /* Switch crtc and encoder back off if necessary */ |
8614 | if (old->dpms_mode != DRM_MODE_DPMS_ON) | 8611 | if (old->dpms_mode != DRM_MODE_DPMS_ON) |
8615 | connector->funcs->dpms(connector, old->dpms_mode); | 8612 | connector->funcs->dpms(connector, old->dpms_mode); |
8616 | |||
8617 | unlock: | ||
8618 | drm_modeset_drop_locks(ctx); | ||
8619 | drm_modeset_acquire_fini(ctx); | ||
8620 | } | 8613 | } |
8621 | 8614 | ||
8622 | static int i9xx_pll_refclk(struct drm_device *dev, | 8615 | static int i9xx_pll_refclk(struct drm_device *dev, |
@@ -11700,8 +11693,8 @@ intel_cursor_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
11700 | }; | 11693 | }; |
11701 | const struct drm_rect clip = { | 11694 | const struct drm_rect clip = { |
11702 | /* integer pixels */ | 11695 | /* integer pixels */ |
11703 | .x2 = intel_crtc->config.pipe_src_w, | 11696 | .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w : 0, |
11704 | .y2 = intel_crtc->config.pipe_src_h, | 11697 | .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h : 0, |
11705 | }; | 11698 | }; |
11706 | bool visible; | 11699 | bool visible; |
11707 | int ret; | 11700 | int ret; |
@@ -12659,7 +12652,7 @@ static void intel_enable_pipe_a(struct drm_device *dev) | |||
12659 | struct intel_connector *connector; | 12652 | struct intel_connector *connector; |
12660 | struct drm_connector *crt = NULL; | 12653 | struct drm_connector *crt = NULL; |
12661 | struct intel_load_detect_pipe load_detect_temp; | 12654 | struct intel_load_detect_pipe load_detect_temp; |
12662 | struct drm_modeset_acquire_ctx ctx; | 12655 | struct drm_modeset_acquire_ctx *ctx = dev->mode_config.acquire_ctx; |
12663 | 12656 | ||
12664 | /* We can't just switch on the pipe A, we need to set things up with a | 12657 | /* 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 | 12658 | * proper mode and output configuration. As a gross hack, enable pipe A |
@@ -12676,10 +12669,8 @@ static void intel_enable_pipe_a(struct drm_device *dev) | |||
12676 | if (!crt) | 12669 | if (!crt) |
12677 | return; | 12670 | return; |
12678 | 12671 | ||
12679 | if (intel_get_load_detect_pipe(crt, NULL, &load_detect_temp, &ctx)) | 12672 | if (intel_get_load_detect_pipe(crt, NULL, &load_detect_temp, ctx)) |
12680 | intel_release_load_detect_pipe(crt, &load_detect_temp, &ctx); | 12673 | intel_release_load_detect_pipe(crt, &load_detect_temp); |
12681 | |||
12682 | |||
12683 | } | 12674 | } |
12684 | 12675 | ||
12685 | static bool | 12676 | static bool |
@@ -13112,7 +13103,7 @@ void intel_modeset_cleanup(struct drm_device *dev) | |||
13112 | * experience fancy races otherwise. | 13103 | * experience fancy races otherwise. |
13113 | */ | 13104 | */ |
13114 | drm_irq_uninstall(dev); | 13105 | drm_irq_uninstall(dev); |
13115 | cancel_work_sync(&dev_priv->hotplug_work); | 13106 | intel_hpd_cancel_work(dev_priv); |
13116 | dev_priv->pm._irqs_disabled = true; | 13107 | dev_priv->pm._irqs_disabled = true; |
13117 | 13108 | ||
13118 | /* | 13109 | /* |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ee3942f0b068..67cfed6d911a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -3553,6 +3553,9 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
3553 | if (WARN_ON(!intel_encoder->base.crtc)) | 3553 | if (WARN_ON(!intel_encoder->base.crtc)) |
3554 | return; | 3554 | return; |
3555 | 3555 | ||
3556 | if (!to_intel_crtc(intel_encoder->base.crtc)->active) | ||
3557 | return; | ||
3558 | |||
3556 | /* Try to read receiver status if the link appears to be up */ | 3559 | /* Try to read receiver status if the link appears to be up */ |
3557 | if (!intel_dp_get_link_status(intel_dp, link_status)) { | 3560 | if (!intel_dp_get_link_status(intel_dp, link_status)) { |
3558 | return; | 3561 | return; |
@@ -4003,6 +4006,16 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
4003 | kfree(intel_dig_port); | 4006 | kfree(intel_dig_port); |
4004 | } | 4007 | } |
4005 | 4008 | ||
4009 | static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) | ||
4010 | { | ||
4011 | struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); | ||
4012 | |||
4013 | if (!is_edp(intel_dp)) | ||
4014 | return; | ||
4015 | |||
4016 | edp_panel_vdd_off_sync(intel_dp); | ||
4017 | } | ||
4018 | |||
4006 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) | 4019 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) |
4007 | { | 4020 | { |
4008 | intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); | 4021 | intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); |
@@ -4037,15 +4050,21 @@ bool | |||
4037 | intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | 4050 | intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) |
4038 | { | 4051 | { |
4039 | struct intel_dp *intel_dp = &intel_dig_port->dp; | 4052 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
4053 | struct intel_encoder *intel_encoder = &intel_dig_port->base; | ||
4040 | struct drm_device *dev = intel_dig_port->base.base.dev; | 4054 | struct drm_device *dev = intel_dig_port->base.base.dev; |
4041 | struct drm_i915_private *dev_priv = dev->dev_private; | 4055 | struct drm_i915_private *dev_priv = dev->dev_private; |
4042 | int ret; | 4056 | enum intel_display_power_domain power_domain; |
4057 | bool ret = true; | ||
4058 | |||
4043 | if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) | 4059 | if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) |
4044 | intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; | 4060 | intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; |
4045 | 4061 | ||
4046 | DRM_DEBUG_KMS("got hpd irq on port %d - %s\n", intel_dig_port->port, | 4062 | DRM_DEBUG_KMS("got hpd irq on port %d - %s\n", intel_dig_port->port, |
4047 | long_hpd ? "long" : "short"); | 4063 | long_hpd ? "long" : "short"); |
4048 | 4064 | ||
4065 | power_domain = intel_display_port_power_domain(intel_encoder); | ||
4066 | intel_display_power_get(dev_priv, power_domain); | ||
4067 | |||
4049 | if (long_hpd) { | 4068 | if (long_hpd) { |
4050 | if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) | 4069 | if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) |
4051 | goto mst_fail; | 4070 | goto mst_fail; |
@@ -4061,8 +4080,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | |||
4061 | 4080 | ||
4062 | } else { | 4081 | } else { |
4063 | if (intel_dp->is_mst) { | 4082 | if (intel_dp->is_mst) { |
4064 | ret = intel_dp_check_mst_status(intel_dp); | 4083 | if (intel_dp_check_mst_status(intel_dp) == -EINVAL) |
4065 | if (ret == -EINVAL) | ||
4066 | goto mst_fail; | 4084 | goto mst_fail; |
4067 | } | 4085 | } |
4068 | 4086 | ||
@@ -4076,7 +4094,8 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | |||
4076 | drm_modeset_unlock(&dev->mode_config.connection_mutex); | 4094 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
4077 | } | 4095 | } |
4078 | } | 4096 | } |
4079 | return false; | 4097 | ret = false; |
4098 | goto put_power; | ||
4080 | mst_fail: | 4099 | mst_fail: |
4081 | /* if we were in MST mode, and device is not there get out of MST mode */ | 4100 | /* if we were in MST mode, and device is not there get out of MST mode */ |
4082 | if (intel_dp->is_mst) { | 4101 | if (intel_dp->is_mst) { |
@@ -4084,7 +4103,10 @@ mst_fail: | |||
4084 | intel_dp->is_mst = false; | 4103 | intel_dp->is_mst = false; |
4085 | drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); | 4104 | drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); |
4086 | } | 4105 | } |
4087 | return true; | 4106 | put_power: |
4107 | intel_display_power_put(dev_priv, power_domain); | ||
4108 | |||
4109 | return ret; | ||
4088 | } | 4110 | } |
4089 | 4111 | ||
4090 | /* Return which DP Port should be selected for Transcoder DP control */ | 4112 | /* Return which DP Port should be selected for Transcoder DP control */ |
@@ -4722,6 +4744,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port) | |||
4722 | intel_encoder->disable = intel_disable_dp; | 4744 | intel_encoder->disable = intel_disable_dp; |
4723 | intel_encoder->get_hw_state = intel_dp_get_hw_state; | 4745 | intel_encoder->get_hw_state = intel_dp_get_hw_state; |
4724 | intel_encoder->get_config = intel_dp_get_config; | 4746 | intel_encoder->get_config = intel_dp_get_config; |
4747 | intel_encoder->suspend = intel_dp_encoder_suspend; | ||
4725 | if (IS_CHERRYVIEW(dev)) { | 4748 | if (IS_CHERRYVIEW(dev)) { |
4726 | intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable; | 4749 | intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable; |
4727 | intel_encoder->pre_enable = chv_pre_enable_dp; | 4750 | 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_tv.c b/drivers/gpu/drm/i915/intel_tv.c index e211eef4b7e4..32186a656816 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -1323,11 +1323,16 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1323 | struct intel_load_detect_pipe tmp; | 1323 | struct intel_load_detect_pipe tmp; |
1324 | struct drm_modeset_acquire_ctx ctx; | 1324 | struct drm_modeset_acquire_ctx ctx; |
1325 | 1325 | ||
1326 | drm_modeset_acquire_init(&ctx, 0); | ||
1327 | |||
1326 | if (intel_get_load_detect_pipe(connector, &mode, &tmp, &ctx)) { | 1328 | if (intel_get_load_detect_pipe(connector, &mode, &tmp, &ctx)) { |
1327 | type = intel_tv_detect_type(intel_tv, connector); | 1329 | type = intel_tv_detect_type(intel_tv, connector); |
1328 | intel_release_load_detect_pipe(connector, &tmp, &ctx); | 1330 | intel_release_load_detect_pipe(connector, &tmp); |
1329 | } else | 1331 | } else |
1330 | return connector_status_unknown; | 1332 | return connector_status_unknown; |
1333 | |||
1334 | drm_modeset_drop_locks(&ctx); | ||
1335 | drm_modeset_acquire_fini(&ctx); | ||
1331 | } else | 1336 | } else |
1332 | return connector->status; | 1337 | return connector->status; |
1333 | 1338 | ||
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..26ee80db17af 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -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/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/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..fa9565957f9d 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 | } |
@@ -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); |
@@ -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..192278bc993c 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -596,7 +596,7 @@ int cik_copy_dma(struct radeon_device *rdev, | |||
596 | return r; | 596 | return r; |
597 | } | 597 | } |
598 | 598 | ||
599 | radeon_ring_unlock_commit(rdev, ring); | 599 | radeon_ring_unlock_commit(rdev, ring, false); |
600 | radeon_semaphore_free(rdev, &sem, *fence); | 600 | radeon_semaphore_free(rdev, &sem, *fence); |
601 | 601 | ||
602 | return r; | 602 | return r; |
@@ -638,7 +638,7 @@ int cik_sdma_ring_test(struct radeon_device *rdev, | |||
638 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr)); | 638 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr)); |
639 | radeon_ring_write(ring, 1); /* number of DWs to follow */ | 639 | radeon_ring_write(ring, 1); /* number of DWs to follow */ |
640 | radeon_ring_write(ring, 0xDEADBEEF); | 640 | radeon_ring_write(ring, 0xDEADBEEF); |
641 | radeon_ring_unlock_commit(rdev, ring); | 641 | radeon_ring_unlock_commit(rdev, ring, false); |
642 | 642 | ||
643 | for (i = 0; i < rdev->usec_timeout; i++) { | 643 | for (i = 0; i < rdev->usec_timeout; i++) { |
644 | tmp = readl(ptr); | 644 | tmp = readl(ptr); |
@@ -695,7 +695,7 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
695 | ib.ptr[4] = 0xDEADBEEF; | 695 | ib.ptr[4] = 0xDEADBEEF; |
696 | ib.length_dw = 5; | 696 | ib.length_dw = 5; |
697 | 697 | ||
698 | r = radeon_ib_schedule(rdev, &ib, NULL); | 698 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
699 | if (r) { | 699 | if (r) { |
700 | radeon_ib_free(rdev, &ib); | 700 | radeon_ib_free(rdev, &ib); |
701 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 701 | 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..dbca60c7d097 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 | } |
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..8b58e11b64fa 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -1438,14 +1438,14 @@ static int kv_update_uvd_dpm(struct radeon_device *rdev, bool gate) | |||
1438 | return kv_enable_uvd_dpm(rdev, !gate); | 1438 | return kv_enable_uvd_dpm(rdev, !gate); |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | static u8 kv_get_vce_boot_level(struct radeon_device *rdev) | 1441 | static u8 kv_get_vce_boot_level(struct radeon_device *rdev, u32 evclk) |
1442 | { | 1442 | { |
1443 | u8 i; | 1443 | u8 i; |
1444 | struct radeon_vce_clock_voltage_dependency_table *table = | 1444 | struct radeon_vce_clock_voltage_dependency_table *table = |
1445 | &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; | 1445 | &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; |
1446 | 1446 | ||
1447 | for (i = 0; i < table->count; i++) { | 1447 | for (i = 0; i < table->count; i++) { |
1448 | if (table->entries[i].evclk >= 0) /* XXX */ | 1448 | if (table->entries[i].evclk >= evclk) |
1449 | break; | 1449 | break; |
1450 | } | 1450 | } |
1451 | 1451 | ||
@@ -1468,7 +1468,7 @@ static int kv_update_vce_dpm(struct radeon_device *rdev, | |||
1468 | if (pi->caps_stable_p_state) | 1468 | if (pi->caps_stable_p_state) |
1469 | pi->vce_boot_level = table->count - 1; | 1469 | pi->vce_boot_level = table->count - 1; |
1470 | else | 1470 | else |
1471 | pi->vce_boot_level = kv_get_vce_boot_level(rdev); | 1471 | pi->vce_boot_level = kv_get_vce_boot_level(rdev, radeon_new_state->evclk); |
1472 | 1472 | ||
1473 | ret = kv_copy_bytes_to_smc(rdev, | 1473 | ret = kv_copy_bytes_to_smc(rdev, |
1474 | pi->dpm_table_start + | 1474 | pi->dpm_table_start + |
@@ -2726,7 +2726,10 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2726 | pi->caps_sclk_ds = true; | 2726 | pi->caps_sclk_ds = true; |
2727 | pi->enable_auto_thermal_throttling = true; | 2727 | pi->enable_auto_thermal_throttling = true; |
2728 | pi->disable_nb_ps3_in_battery = false; | 2728 | pi->disable_nb_ps3_in_battery = false; |
2729 | pi->bapm_enable = true; | 2729 | if (radeon_bapm == 0) |
2730 | pi->bapm_enable = false; | ||
2731 | else | ||
2732 | pi->bapm_enable = true; | ||
2730 | pi->voltage_drop_t = 0; | 2733 | pi->voltage_drop_t = 0; |
2731 | pi->caps_sclk_throttle_low_notification = false; | 2734 | pi->caps_sclk_throttle_low_notification = false; |
2732 | pi->caps_fps = false; /* true? */ | 2735 | 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/r100.c b/drivers/gpu/drm/radeon/r100.c index 04b5940b8923..4c5ec44ff328 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -925,7 +925,7 @@ int r100_copy_blit(struct radeon_device *rdev, | |||
925 | if (fence) { | 925 | if (fence) { |
926 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); | 926 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); |
927 | } | 927 | } |
928 | radeon_ring_unlock_commit(rdev, ring); | 928 | radeon_ring_unlock_commit(rdev, ring, false); |
929 | return r; | 929 | return r; |
930 | } | 930 | } |
931 | 931 | ||
@@ -958,7 +958,7 @@ void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) | |||
958 | RADEON_ISYNC_ANY3D_IDLE2D | | 958 | RADEON_ISYNC_ANY3D_IDLE2D | |
959 | RADEON_ISYNC_WAIT_IDLEGUI | | 959 | RADEON_ISYNC_WAIT_IDLEGUI | |
960 | RADEON_ISYNC_CPSCRATCH_IDLEGUI); | 960 | RADEON_ISYNC_CPSCRATCH_IDLEGUI); |
961 | radeon_ring_unlock_commit(rdev, ring); | 961 | radeon_ring_unlock_commit(rdev, ring, false); |
962 | } | 962 | } |
963 | 963 | ||
964 | 964 | ||
@@ -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..e616eb5f6e7a 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+ */ | ||
2773 | if (emit_wait && (rdev->family >= CHIP_RV770)) { | ||
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; |
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c index 4969cef44a19..51fd98553eaf 100644 --- a/drivers/gpu/drm/radeon/r600_dma.c +++ b/drivers/gpu/drm/radeon/r600_dma.c | |||
@@ -261,7 +261,7 @@ int r600_dma_ring_test(struct radeon_device *rdev, | |||
261 | radeon_ring_write(ring, rdev->vram_scratch.gpu_addr & 0xfffffffc); | 261 | radeon_ring_write(ring, rdev->vram_scratch.gpu_addr & 0xfffffffc); |
262 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff); | 262 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff); |
263 | radeon_ring_write(ring, 0xDEADBEEF); | 263 | radeon_ring_write(ring, 0xDEADBEEF); |
264 | radeon_ring_unlock_commit(rdev, ring); | 264 | radeon_ring_unlock_commit(rdev, ring, false); |
265 | 265 | ||
266 | for (i = 0; i < rdev->usec_timeout; i++) { | 266 | for (i = 0; i < rdev->usec_timeout; i++) { |
267 | tmp = readl(ptr); | 267 | tmp = readl(ptr); |
@@ -368,7 +368,7 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
368 | ib.ptr[3] = 0xDEADBEEF; | 368 | ib.ptr[3] = 0xDEADBEEF; |
369 | ib.length_dw = 4; | 369 | ib.length_dw = 4; |
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 | radeon_ib_free(rdev, &ib); | 373 | radeon_ib_free(rdev, &ib); |
374 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 374 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
@@ -493,7 +493,7 @@ int r600_copy_dma(struct radeon_device *rdev, | |||
493 | return r; | 493 | return r; |
494 | } | 494 | } |
495 | 495 | ||
496 | radeon_ring_unlock_commit(rdev, ring); | 496 | radeon_ring_unlock_commit(rdev, ring, false); |
497 | radeon_semaphore_free(rdev, &sem, *fence); | 497 | radeon_semaphore_free(rdev, &sem, *fence); |
498 | 498 | ||
499 | return r; | 499 | return r; |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index f94e7a9afe75..0c4a7d8d93e0 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -1597,6 +1597,7 @@ | |||
1597 | */ | 1597 | */ |
1598 | # define PACKET3_CP_DMA_CMD_SAIC (1 << 28) | 1598 | # define PACKET3_CP_DMA_CMD_SAIC (1 << 28) |
1599 | # define PACKET3_CP_DMA_CMD_DAIC (1 << 29) | 1599 | # define PACKET3_CP_DMA_CMD_DAIC (1 << 29) |
1600 | #define PACKET3_PFP_SYNC_ME 0x42 /* r7xx+ only */ | ||
1600 | #define PACKET3_SURFACE_SYNC 0x43 | 1601 | #define PACKET3_SURFACE_SYNC 0x43 |
1601 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) | 1602 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) |
1602 | # define PACKET3_FULL_CACHE_ENA (1 << 20) /* r7xx+ only */ | 1603 | # 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..5f05b4c84338 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -105,6 +105,7 @@ 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; | ||
108 | 109 | ||
109 | /* | 110 | /* |
110 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 111 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
@@ -914,6 +915,8 @@ struct radeon_vm_manager { | |||
914 | u64 vram_base_offset; | 915 | u64 vram_base_offset; |
915 | /* is vm enabled? */ | 916 | /* is vm enabled? */ |
916 | bool enabled; | 917 | bool enabled; |
918 | /* for hw to save the PD addr on suspend/resume */ | ||
919 | uint32_t saved_table_addr[RADEON_NUM_VM]; | ||
917 | }; | 920 | }; |
918 | 921 | ||
919 | /* | 922 | /* |
@@ -967,7 +970,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring, | |||
967 | unsigned size); | 970 | unsigned size); |
968 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib); | 971 | 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, | 972 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, |
970 | struct radeon_ib *const_ib); | 973 | struct radeon_ib *const_ib, bool hdp_flush); |
971 | int radeon_ib_pool_init(struct radeon_device *rdev); | 974 | int radeon_ib_pool_init(struct radeon_device *rdev); |
972 | void radeon_ib_pool_fini(struct radeon_device *rdev); | 975 | void radeon_ib_pool_fini(struct radeon_device *rdev); |
973 | int radeon_ib_ring_tests(struct radeon_device *rdev); | 976 | int radeon_ib_ring_tests(struct radeon_device *rdev); |
@@ -977,8 +980,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); | 980 | 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); | 981 | 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); | 982 | 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); | 983 | 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); | 984 | bool hdp_flush); |
985 | void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp, | ||
986 | bool hdp_flush); | ||
982 | void radeon_ring_undo(struct radeon_ring *ring); | 987 | void radeon_ring_undo(struct radeon_ring *ring); |
983 | void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); | 988 | 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); | 989 | int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); |
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..6a219bcee66d 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1680,8 +1680,8 @@ int radeon_gpu_reset(struct radeon_device *rdev) | |||
1680 | radeon_save_bios_scratch_regs(rdev); | 1680 | radeon_save_bios_scratch_regs(rdev); |
1681 | /* block TTM */ | 1681 | /* block TTM */ |
1682 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); | 1682 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); |
1683 | radeon_pm_suspend(rdev); | ||
1684 | radeon_suspend(rdev); | 1683 | radeon_suspend(rdev); |
1684 | radeon_hpd_fini(rdev); | ||
1685 | 1685 | ||
1686 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 1686 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
1687 | ring_sizes[i] = radeon_ring_backup(rdev, &rdev->ring[i], | 1687 | ring_sizes[i] = radeon_ring_backup(rdev, &rdev->ring[i], |
@@ -1726,9 +1726,39 @@ retry: | |||
1726 | } | 1726 | } |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | radeon_pm_resume(rdev); | 1729 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { |
1730 | /* do dpm late init */ | ||
1731 | r = radeon_pm_late_init(rdev); | ||
1732 | if (r) { | ||
1733 | rdev->pm.dpm_enabled = false; | ||
1734 | DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); | ||
1735 | } | ||
1736 | } else { | ||
1737 | /* resume old pm late */ | ||
1738 | radeon_pm_resume(rdev); | ||
1739 | } | ||
1740 | |||
1741 | /* init dig PHYs, disp eng pll */ | ||
1742 | if (rdev->is_atom_bios) { | ||
1743 | radeon_atom_encoder_init(rdev); | ||
1744 | radeon_atom_disp_eng_pll_init(rdev); | ||
1745 | /* turn on the BL */ | ||
1746 | if (rdev->mode_info.bl_encoder) { | ||
1747 | u8 bl_level = radeon_get_backlight_level(rdev, | ||
1748 | rdev->mode_info.bl_encoder); | ||
1749 | radeon_set_backlight_level(rdev, rdev->mode_info.bl_encoder, | ||
1750 | bl_level); | ||
1751 | } | ||
1752 | } | ||
1753 | /* reset hpd state */ | ||
1754 | radeon_hpd_init(rdev); | ||
1755 | |||
1730 | drm_helper_resume_force_mode(rdev->ddev); | 1756 | drm_helper_resume_force_mode(rdev->ddev); |
1731 | 1757 | ||
1758 | /* set the power state here in case we are a PX system or headless */ | ||
1759 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) | ||
1760 | radeon_pm_compute_clocks(rdev); | ||
1761 | |||
1732 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); | 1762 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); |
1733 | if (r) { | 1763 | if (r) { |
1734 | /* bad news, how to tell it to userspace ? */ | 1764 | /* 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..8df888908833 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -180,6 +180,7 @@ 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; | ||
183 | 184 | ||
184 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 185 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
185 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 186 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
@@ -259,6 +260,9 @@ 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))"); | 260 | 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); | 261 | module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444); |
261 | 262 | ||
263 | MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); | ||
264 | module_param_named(bapm, radeon_bapm, int, 0444); | ||
265 | |||
262 | static struct pci_device_id pciidlist[] = { | 266 | static struct pci_device_id pciidlist[] = { |
263 | radeon_PCI_IDS | 267 | radeon_PCI_IDS |
264 | }; | 268 | }; |
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..56d9fd66d8ae 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c | |||
@@ -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/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..6bce40847753 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); |
@@ -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..ef93156a69c6 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c | |||
@@ -677,7 +677,7 @@ static const struct component_ops sti_hdmi_ops = { | |||
677 | .unbind = sti_hdmi_unbind, | 677 | .unbind = sti_hdmi_unbind, |
678 | }; | 678 | }; |
679 | 679 | ||
680 | static struct of_device_id hdmi_of_match[] = { | 680 | static const struct of_device_id hdmi_of_match[] = { |
681 | { | 681 | { |
682 | .compatible = "st,stih416-hdmi", | 682 | .compatible = "st,stih416-hdmi", |
683 | .data = &tx3g0c55phy_ops, | 683 | .data = &tx3g0c55phy_ops, |
@@ -713,8 +713,8 @@ static int sti_hdmi_probe(struct platform_device *pdev) | |||
713 | return -ENOMEM; | 713 | return -ENOMEM; |
714 | } | 714 | } |
715 | hdmi->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); | 715 | hdmi->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
716 | if (IS_ERR(hdmi->regs)) | 716 | if (!hdmi->regs) |
717 | return PTR_ERR(hdmi->regs); | 717 | return -ENOMEM; |
718 | 718 | ||
719 | if (of_device_is_compatible(np, "st,stih416-hdmi")) { | 719 | if (of_device_is_compatible(np, "st,stih416-hdmi")) { |
720 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 720 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -725,8 +725,8 @@ static int sti_hdmi_probe(struct platform_device *pdev) | |||
725 | } | 725 | } |
726 | hdmi->syscfg = devm_ioremap_nocache(dev, res->start, | 726 | hdmi->syscfg = devm_ioremap_nocache(dev, res->start, |
727 | resource_size(res)); | 727 | resource_size(res)); |
728 | if (IS_ERR(hdmi->syscfg)) | 728 | if (!hdmi->syscfg) |
729 | return PTR_ERR(hdmi->syscfg); | 729 | return -ENOMEM; |
730 | 730 | ||
731 | } | 731 | } |
732 | 732 | ||
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/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/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..e0228b228256 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | i2ccore-y := i2c-core.o | 5 | i2ccore-y := i2c-core.o |
6 | i2ccore-$(CONFIG_I2C_ACPI) += i2c-acpi.o | 6 | i2ccore-$(CONFIG_ACPI) += i2c-acpi.o |
7 | 7 | ||
8 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o | 8 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o |
9 | obj-$(CONFIG_I2C) += i2ccore.o | 9 | obj-$(CONFIG_I2C) += i2ccore.o |
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/i2c-acpi.c b/drivers/i2c/i2c-acpi.c index e8b61967334b..0dbc18c15c43 100644 --- a/drivers/i2c/i2c-acpi.c +++ b/drivers/i2c/i2c-acpi.c | |||
@@ -126,6 +126,7 @@ void acpi_i2c_register_devices(struct i2c_adapter *adap) | |||
126 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | 126 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); |
127 | } | 127 | } |
128 | 128 | ||
129 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
129 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | 130 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, |
130 | u8 cmd, u8 *data, u8 data_len) | 131 | u8 cmd, u8 *data, u8 data_len) |
131 | { | 132 | { |
@@ -360,3 +361,4 @@ void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | |||
360 | 361 | ||
361 | acpi_bus_detach_private_data(handle); | 362 | acpi_bus_detach_private_data(handle); |
362 | } | 363 | } |
364 | #endif | ||
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/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..ac4adb337038 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -995,7 +995,7 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova, | |||
995 | size_t orig_size = size; | 995 | size_t orig_size = size; |
996 | int ret = 0; | 996 | int ret = 0; |
997 | 997 | ||
998 | if (unlikely(domain->ops->unmap == NULL || | 998 | if (unlikely(domain->ops->map == NULL || |
999 | domain->ops->pgsize_bitmap == 0UL)) | 999 | domain->ops->pgsize_bitmap == 0UL)) |
1000 | return -ENODEV; | 1000 | return -ENODEV; |
1001 | 1001 | ||
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/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/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/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/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/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/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index 5dede6e64376..109cb44291f5 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c | |||
@@ -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..944aa5d3af6e 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -549,6 +549,13 @@ static void do_state(struct net_device *dev, | |||
549 | 549 | ||
550 | /* process state changes depending on the new state */ | 550 | /* process state changes depending on the new state */ |
551 | switch (new_state) { | 551 | switch (new_state) { |
552 | case CAN_STATE_ERROR_WARNING: | ||
553 | netdev_dbg(dev, "Error Warning\n"); | ||
554 | cf->can_id |= CAN_ERR_CRTL; | ||
555 | cf->data[1] = (bec.txerr > bec.rxerr) ? | ||
556 | CAN_ERR_CRTL_TX_WARNING : | ||
557 | CAN_ERR_CRTL_RX_WARNING; | ||
558 | break; | ||
552 | case CAN_STATE_ERROR_ACTIVE: | 559 | case CAN_STATE_ERROR_ACTIVE: |
553 | netdev_dbg(dev, "Error Active\n"); | 560 | netdev_dbg(dev, "Error Active\n"); |
554 | cf->can_id |= CAN_ERR_PROT; | 561 | cf->can_id |= CAN_ERR_PROT; |
@@ -852,6 +859,8 @@ static int flexcan_chip_start(struct net_device *dev) | |||
852 | if (priv->devtype_data->features & FLEXCAN_HAS_BROKEN_ERR_STATE || | 859 | if (priv->devtype_data->features & FLEXCAN_HAS_BROKEN_ERR_STATE || |
853 | priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) | 860 | priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) |
854 | reg_ctrl |= FLEXCAN_CTRL_ERR_MSK; | 861 | reg_ctrl |= FLEXCAN_CTRL_ERR_MSK; |
862 | else | ||
863 | reg_ctrl &= ~FLEXCAN_CTRL_ERR_MSK; | ||
855 | 864 | ||
856 | /* save for later use */ | 865 | /* save for later use */ |
857 | priv->reg_ctrl_default = reg_ctrl; | 866 | priv->reg_ctrl_default = reg_ctrl; |
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/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/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_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index c13364b6cc19..900cab420810 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -10052,6 +10052,8 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, | |||
10052 | } | 10052 | } |
10053 | 10053 | ||
10054 | #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4)) | 10054 | #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4)) |
10055 | #define BNX2X_PREV_UNDI_PROD_ADDR_H(f) (BAR_TSTRORM_INTMEM + \ | ||
10056 | 0x1848 + ((f) << 4)) | ||
10055 | #define BNX2X_PREV_UNDI_RCQ(val) ((val) & 0xffff) | 10057 | #define BNX2X_PREV_UNDI_RCQ(val) ((val) & 0xffff) |
10056 | #define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff) | 10058 | #define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff) |
10057 | #define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq)) | 10059 | #define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq)) |
@@ -10059,8 +10061,6 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, | |||
10059 | #define BCM_5710_UNDI_FW_MF_MAJOR (0x07) | 10061 | #define BCM_5710_UNDI_FW_MF_MAJOR (0x07) |
10060 | #define BCM_5710_UNDI_FW_MF_MINOR (0x08) | 10062 | #define BCM_5710_UNDI_FW_MF_MINOR (0x08) |
10061 | #define BCM_5710_UNDI_FW_MF_VERS (0x05) | 10063 | #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 | 10064 | ||
10065 | static bool bnx2x_prev_is_after_undi(struct bnx2x *bp) | 10065 | static bool bnx2x_prev_is_after_undi(struct bnx2x *bp) |
10066 | { | 10066 | { |
@@ -10079,72 +10079,25 @@ static bool bnx2x_prev_is_after_undi(struct bnx2x *bp) | |||
10079 | return false; | 10079 | return false; |
10080 | } | 10080 | } |
10081 | 10081 | ||
10082 | static bool bnx2x_prev_unload_undi_fw_supports_mf(struct bnx2x *bp) | 10082 | 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 | { | 10083 | { |
10137 | u16 rcq, bd; | 10084 | u16 rcq, bd; |
10138 | u32 tmp_reg = REG_RD(bp, BNX2X_PREV_UNDI_PROD_ADDR(port)); | 10085 | u32 addr, tmp_reg; |
10139 | 10086 | ||
10087 | if (BP_FUNC(bp) < 2) | ||
10088 | addr = BNX2X_PREV_UNDI_PROD_ADDR(BP_PORT(bp)); | ||
10089 | else | ||
10090 | addr = BNX2X_PREV_UNDI_PROD_ADDR_H(BP_FUNC(bp) - 2); | ||
10091 | |||
10092 | tmp_reg = REG_RD(bp, addr); | ||
10140 | rcq = BNX2X_PREV_UNDI_RCQ(tmp_reg) + inc; | 10093 | rcq = BNX2X_PREV_UNDI_RCQ(tmp_reg) + inc; |
10141 | bd = BNX2X_PREV_UNDI_BD(tmp_reg) + inc; | 10094 | bd = BNX2X_PREV_UNDI_BD(tmp_reg) + inc; |
10142 | 10095 | ||
10143 | tmp_reg = BNX2X_PREV_UNDI_PROD(rcq, bd); | 10096 | tmp_reg = BNX2X_PREV_UNDI_PROD(rcq, bd); |
10144 | REG_WR(bp, BNX2X_PREV_UNDI_PROD_ADDR(port), tmp_reg); | 10097 | REG_WR(bp, addr, tmp_reg); |
10145 | 10098 | ||
10146 | BNX2X_DEV_INFO("UNDI producer [%d] rings bd -> 0x%04x, rcq -> 0x%04x\n", | 10099 | BNX2X_DEV_INFO("UNDI producer [%d/%d][%08x] rings bd -> 0x%04x, rcq -> 0x%04x\n", |
10147 | port, bd, rcq); | 10100 | BP_PORT(bp), BP_FUNC(bp), addr, bd, rcq); |
10148 | } | 10101 | } |
10149 | 10102 | ||
10150 | static int bnx2x_prev_mcp_done(struct bnx2x *bp) | 10103 | static int bnx2x_prev_mcp_done(struct bnx2x *bp) |
@@ -10383,7 +10336,6 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) | |||
10383 | /* Reset should be performed after BRB is emptied */ | 10336 | /* Reset should be performed after BRB is emptied */ |
10384 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) { | 10337 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) { |
10385 | u32 timer_count = 1000; | 10338 | u32 timer_count = 1000; |
10386 | bool need_write = true; | ||
10387 | 10339 | ||
10388 | /* Close the MAC Rx to prevent BRB from filling up */ | 10340 | /* Close the MAC Rx to prevent BRB from filling up */ |
10389 | bnx2x_prev_unload_close_mac(bp, &mac_vals); | 10341 | bnx2x_prev_unload_close_mac(bp, &mac_vals); |
@@ -10420,20 +10372,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) | |||
10420 | else | 10372 | else |
10421 | timer_count--; | 10373 | timer_count--; |
10422 | 10374 | ||
10423 | /* New UNDI FW supports MF and contains better | 10375 | /* If UNDI resides in memory, manually increment it */ |
10424 | * cleaning methods - might be redundant but harmless. | 10376 | if (prev_undi) |
10425 | */ | 10377 | bnx2x_prev_unload_undi_inc(bp, 1); |
10426 | if (bnx2x_prev_unload_undi_fw_supports_mf(bp)) { | 10378 | |
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); | 10379 | udelay(10); |
10438 | } | 10380 | } |
10439 | 10381 | ||
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..18fb9c61d7ba 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 |
@@ -3340,7 +3338,7 @@ static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, | |||
3340 | adap->tid_release_head = (void **)((uintptr_t)p | chan); | 3338 | adap->tid_release_head = (void **)((uintptr_t)p | chan); |
3341 | if (!adap->tid_release_task_busy) { | 3339 | if (!adap->tid_release_task_busy) { |
3342 | adap->tid_release_task_busy = true; | 3340 | adap->tid_release_task_busy = true; |
3343 | queue_work(workq, &adap->tid_release_task); | 3341 | queue_work(adap->workq, &adap->tid_release_task); |
3344 | } | 3342 | } |
3345 | spin_unlock_bh(&adap->tid_release_lock); | 3343 | spin_unlock_bh(&adap->tid_release_lock); |
3346 | } | 3344 | } |
@@ -4140,7 +4138,7 @@ void t4_db_full(struct adapter *adap) | |||
4140 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); | 4138 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); |
4141 | t4_set_reg_field(adap, SGE_INT_ENABLE3, | 4139 | t4_set_reg_field(adap, SGE_INT_ENABLE3, |
4142 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); | 4140 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); |
4143 | queue_work(workq, &adap->db_full_task); | 4141 | queue_work(adap->workq, &adap->db_full_task); |
4144 | } | 4142 | } |
4145 | } | 4143 | } |
4146 | 4144 | ||
@@ -4150,7 +4148,7 @@ void t4_db_dropped(struct adapter *adap) | |||
4150 | disable_dbs(adap); | 4148 | disable_dbs(adap); |
4151 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); | 4149 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); |
4152 | } | 4150 | } |
4153 | queue_work(workq, &adap->db_drop_task); | 4151 | queue_work(adap->workq, &adap->db_drop_task); |
4154 | } | 4152 | } |
4155 | 4153 | ||
4156 | static void uld_attach(struct adapter *adap, unsigned int uld) | 4154 | static void uld_attach(struct adapter *adap, unsigned int uld) |
@@ -6517,6 +6515,12 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6517 | goto out_disable_device; | 6515 | goto out_disable_device; |
6518 | } | 6516 | } |
6519 | 6517 | ||
6518 | adapter->workq = create_singlethread_workqueue("cxgb4"); | ||
6519 | if (!adapter->workq) { | ||
6520 | err = -ENOMEM; | ||
6521 | goto out_free_adapter; | ||
6522 | } | ||
6523 | |||
6520 | /* PCI device has been enabled */ | 6524 | /* PCI device has been enabled */ |
6521 | adapter->flags |= DEV_ENABLED; | 6525 | adapter->flags |= DEV_ENABLED; |
6522 | 6526 | ||
@@ -6715,6 +6719,9 @@ sriov: | |||
6715 | out_unmap_bar0: | 6719 | out_unmap_bar0: |
6716 | iounmap(adapter->regs); | 6720 | iounmap(adapter->regs); |
6717 | out_free_adapter: | 6721 | out_free_adapter: |
6722 | if (adapter->workq) | ||
6723 | destroy_workqueue(adapter->workq); | ||
6724 | |||
6718 | kfree(adapter); | 6725 | kfree(adapter); |
6719 | out_disable_device: | 6726 | out_disable_device: |
6720 | pci_disable_pcie_error_reporting(pdev); | 6727 | pci_disable_pcie_error_reporting(pdev); |
@@ -6736,6 +6743,11 @@ static void remove_one(struct pci_dev *pdev) | |||
6736 | if (adapter) { | 6743 | if (adapter) { |
6737 | int i; | 6744 | int i; |
6738 | 6745 | ||
6746 | /* Tear down per-adapter Work Queue first since it can contain | ||
6747 | * references to our adapter data structure. | ||
6748 | */ | ||
6749 | destroy_workqueue(adapter->workq); | ||
6750 | |||
6739 | if (is_offload(adapter)) | 6751 | if (is_offload(adapter)) |
6740 | detach_ulds(adapter); | 6752 | detach_ulds(adapter); |
6741 | 6753 | ||
@@ -6788,20 +6800,14 @@ static int __init cxgb4_init_module(void) | |||
6788 | { | 6800 | { |
6789 | int ret; | 6801 | int ret; |
6790 | 6802 | ||
6791 | workq = create_singlethread_workqueue("cxgb4"); | ||
6792 | if (!workq) | ||
6793 | return -ENOMEM; | ||
6794 | |||
6795 | /* Debugfs support is optional, just warn if this fails */ | 6803 | /* Debugfs support is optional, just warn if this fails */ |
6796 | cxgb4_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); | 6804 | cxgb4_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); |
6797 | if (!cxgb4_debugfs_root) | 6805 | if (!cxgb4_debugfs_root) |
6798 | pr_warn("could not create debugfs entry, continuing\n"); | 6806 | pr_warn("could not create debugfs entry, continuing\n"); |
6799 | 6807 | ||
6800 | ret = pci_register_driver(&cxgb4_driver); | 6808 | ret = pci_register_driver(&cxgb4_driver); |
6801 | if (ret < 0) { | 6809 | if (ret < 0) |
6802 | debugfs_remove(cxgb4_debugfs_root); | 6810 | debugfs_remove(cxgb4_debugfs_root); |
6803 | destroy_workqueue(workq); | ||
6804 | } | ||
6805 | 6811 | ||
6806 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6812 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
6807 | 6813 | ||
@@ -6813,8 +6819,6 @@ static void __exit cxgb4_cleanup_module(void) | |||
6813 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6819 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
6814 | pci_unregister_driver(&cxgb4_driver); | 6820 | pci_unregister_driver(&cxgb4_driver); |
6815 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ | 6821 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ |
6816 | flush_workqueue(workq); | ||
6817 | destroy_workqueue(workq); | ||
6818 | } | 6822 | } |
6819 | 6823 | ||
6820 | module_init(cxgb4_init_module); | 6824 | 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/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h index 0549170d7e2e..5f2729ebadbe 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 { |
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/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/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/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_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/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/macvlan.c b/drivers/net/macvlan.c index 60e4ca01ccbb..a96955597755 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -739,7 +739,10 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], | |||
739 | struct macvlan_dev *vlan = netdev_priv(dev); | 739 | struct macvlan_dev *vlan = netdev_priv(dev); |
740 | int err = -EINVAL; | 740 | int err = -EINVAL; |
741 | 741 | ||
742 | if (!vlan->port->passthru) | 742 | /* Support unicast filter only on passthru devices. |
743 | * Multicast filter should be allowed on all devices. | ||
744 | */ | ||
745 | if (!vlan->port->passthru && is_unicast_ether_addr(addr)) | ||
743 | return -EOPNOTSUPP; | 746 | return -EOPNOTSUPP; |
744 | 747 | ||
745 | if (flags & NLM_F_REPLACE) | 748 | if (flags & NLM_F_REPLACE) |
@@ -760,7 +763,10 @@ static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], | |||
760 | struct macvlan_dev *vlan = netdev_priv(dev); | 763 | struct macvlan_dev *vlan = netdev_priv(dev); |
761 | int err = -EINVAL; | 764 | int err = -EINVAL; |
762 | 765 | ||
763 | if (!vlan->port->passthru) | 766 | /* Support unicast filter only on passthru devices. |
767 | * Multicast filter should be allowed on all devices. | ||
768 | */ | ||
769 | if (!vlan->port->passthru && is_unicast_ether_addr(addr)) | ||
764 | return -EOPNOTSUPP; | 770 | return -EOPNOTSUPP; |
765 | 771 | ||
766 | if (is_unicast_ether_addr(addr)) | 772 | if (is_unicast_ether_addr(addr)) |
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/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/of/fdt.c b/drivers/of/fdt.c index f46a24ffa3fe..79cb8313c7d8 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); |
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/pci/host/Kconfig b/drivers/pci/host/Kconfig index 2d8a4d05d78f..8922c376456a 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 |
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-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/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-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/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index e4da61bcbf8b..b062d3d7b373 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1258,7 +1258,7 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | |||
1258 | int mode = -1; | 1258 | int mode = -1; |
1259 | int time = -1; | 1259 | int time = -1; |
1260 | 1260 | ||
1261 | if (sscanf(buf, "%i", &mode) != 1 || (mode != 2 || mode != 1)) | 1261 | if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1)) |
1262 | return -EINVAL; | 1262 | return -EINVAL; |
1263 | 1263 | ||
1264 | /* Set the Keyboard Backlight Mode where: | 1264 | /* Set the Keyboard Backlight Mode where: |
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/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/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/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..d837dc180522 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1774 | blk_requeue_request(q, req); | 1774 | blk_requeue_request(q, req); |
1775 | atomic_dec(&sdev->device_busy); | 1775 | atomic_dec(&sdev->device_busy); |
1776 | out_delay: | 1776 | out_delay: |
1777 | if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev)) | 1777 | if (!atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev)) |
1778 | blk_delay_queue(q, SCSI_QUEUE_DELAY); | 1778 | blk_delay_queue(q, SCSI_QUEUE_DELAY); |
1779 | } | 1779 | } |
1780 | 1780 | ||
@@ -1808,7 +1808,6 @@ static int scsi_mq_prep_fn(struct request *req) | |||
1808 | 1808 | ||
1809 | cmd->tag = req->tag; | 1809 | cmd->tag = req->tag; |
1810 | 1810 | ||
1811 | req->cmd = req->__cmd; | ||
1812 | cmd->cmnd = req->cmd; | 1811 | cmd->cmnd = req->cmd; |
1813 | cmd->prot_op = SCSI_PROT_NORMAL; | 1812 | cmd->prot_op = SCSI_PROT_NORMAL; |
1814 | 1813 | ||
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/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-davinci.c b/drivers/spi/spi-davinci.c index 276a3884fb3c..48f1d26e6ad9 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -417,16 +417,16 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
417 | flags, dev_name(&spi->dev)); | 417 | flags, dev_name(&spi->dev)); |
418 | internal_cs = false; | 418 | internal_cs = false; |
419 | } | 419 | } |
420 | } | ||
421 | 420 | ||
422 | if (retval) { | 421 | if (retval) { |
423 | dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", | 422 | dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", |
424 | spi->cs_gpio, retval); | 423 | spi->cs_gpio, retval); |
425 | return retval; | 424 | return retval; |
426 | } | 425 | } |
427 | 426 | ||
428 | if (internal_cs) | 427 | if (internal_cs) |
429 | set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); | 428 | set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); |
429 | } | ||
430 | 430 | ||
431 | if (spi->mode & SPI_READY) | 431 | if (spi->mode & SPI_READY) |
432 | set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK); | 432 | set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK); |
diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index 3f3dc1226edf..e14960470d8d 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c | |||
@@ -62,6 +62,8 @@ static int spi_pci_probe(struct pci_dev *pdev, | |||
62 | if (ret) | 62 | if (ret) |
63 | return ret; | 63 | return ret; |
64 | 64 | ||
65 | dws->regs = pcim_iomap_table(pdev)[pci_bar]; | ||
66 | |||
65 | dws->bus_num = 0; | 67 | dws->bus_num = 0; |
66 | dws->num_cs = 4; | 68 | dws->num_cs = 4; |
67 | dws->irq = pdev->irq; | 69 | dws->irq = pdev->irq; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 29f33143b795..670f0627f3bf 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -271,7 +271,7 @@ static void giveback(struct dw_spi *dws) | |||
271 | transfer_list); | 271 | transfer_list); |
272 | 272 | ||
273 | if (!last_transfer->cs_change) | 273 | if (!last_transfer->cs_change) |
274 | spi_chip_sel(dws, dws->cur_msg->spi, 0); | 274 | spi_chip_sel(dws, msg->spi, 0); |
275 | 275 | ||
276 | spi_finalize_current_message(dws->master); | 276 | spi_finalize_current_message(dws->master); |
277 | } | 277 | } |
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-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..cd0e08b0c9f6 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
@@ -499,7 +499,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs) | |||
499 | } | 499 | } |
500 | 500 | ||
501 | /* div doesn't support odd number */ | 501 | /* div doesn't support odd number */ |
502 | div = rs->max_freq / rs->speed; | 502 | div = max_t(u32, rs->max_freq / rs->speed, 1); |
503 | div = (div + 1) & 0xfffe; | 503 | div = (div + 1) & 0xfffe; |
504 | 504 | ||
505 | spi_enable_chip(rs, 0); | 505 | spi_enable_chip(rs, 0); |
@@ -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..ad87a98f8f68 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -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) |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 2a4354dcd661..543075b80f16 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
@@ -636,48 +636,38 @@ 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, |
653 | p->rx_dma_addr, len, DMA_FROM_DEVICE, | 643 | p->rx_dma_addr, len, DMA_FROM_DEVICE, |
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 | ret = -EAGAIN; |
657 | } | 647 | goto no_dma_rx; |
658 | 648 | } | |
659 | /* 1 stage FIFO watermarks for DMA */ | ||
660 | sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1); | ||
661 | |||
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 | 649 | ||
669 | if (rx) { | ||
670 | desc_rx->callback = sh_msiof_dma_complete; | 650 | desc_rx->callback = sh_msiof_dma_complete; |
671 | desc_rx->callback_param = p; | 651 | desc_rx->callback_param = p; |
672 | cookie = dmaengine_submit(desc_rx); | 652 | cookie = dmaengine_submit(desc_rx); |
673 | if (dma_submit_error(cookie)) { | 653 | if (dma_submit_error(cookie)) { |
674 | ret = cookie; | 654 | ret = cookie; |
675 | goto stop_ier; | 655 | goto no_dma_rx; |
676 | } | 656 | } |
677 | dma_async_issue_pending(p->master->dma_rx); | ||
678 | } | 657 | } |
679 | 658 | ||
680 | if (tx) { | 659 | if (tx) { |
660 | ier_bits |= IER_TDREQE | IER_TDMAE; | ||
661 | dma_sync_single_for_device(p->master->dma_tx->device->dev, | ||
662 | p->tx_dma_addr, len, DMA_TO_DEVICE); | ||
663 | desc_tx = dmaengine_prep_slave_single(p->master->dma_tx, | ||
664 | p->tx_dma_addr, len, DMA_TO_DEVICE, | ||
665 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
666 | if (!desc_tx) { | ||
667 | ret = -EAGAIN; | ||
668 | goto no_dma_tx; | ||
669 | } | ||
670 | |||
681 | if (rx) { | 671 | if (rx) { |
682 | /* No callback */ | 672 | /* No callback */ |
683 | desc_tx->callback = NULL; | 673 | desc_tx->callback = NULL; |
@@ -688,15 +678,30 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, | |||
688 | cookie = dmaengine_submit(desc_tx); | 678 | cookie = dmaengine_submit(desc_tx); |
689 | if (dma_submit_error(cookie)) { | 679 | if (dma_submit_error(cookie)) { |
690 | ret = cookie; | 680 | ret = cookie; |
691 | goto stop_rx; | 681 | goto no_dma_tx; |
692 | } | 682 | } |
693 | dma_async_issue_pending(p->master->dma_tx); | ||
694 | } | 683 | } |
695 | 684 | ||
685 | /* 1 stage FIFO watermarks for DMA */ | ||
686 | sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1); | ||
687 | |||
688 | /* setup msiof transfer mode registers (32-bit words) */ | ||
689 | sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4); | ||
690 | |||
691 | sh_msiof_write(p, IER, ier_bits); | ||
692 | |||
693 | reinit_completion(&p->done); | ||
694 | |||
695 | /* Now start DMA */ | ||
696 | if (rx) | ||
697 | dma_async_issue_pending(p->master->dma_rx); | ||
698 | if (tx) | ||
699 | dma_async_issue_pending(p->master->dma_tx); | ||
700 | |||
696 | ret = sh_msiof_spi_start(p, rx); | 701 | ret = sh_msiof_spi_start(p, rx); |
697 | if (ret) { | 702 | if (ret) { |
698 | dev_err(&p->pdev->dev, "failed to start hardware\n"); | 703 | dev_err(&p->pdev->dev, "failed to start hardware\n"); |
699 | goto stop_tx; | 704 | goto stop_dma; |
700 | } | 705 | } |
701 | 706 | ||
702 | /* wait for tx fifo to be emptied / rx fifo to be filled */ | 707 | /* wait for tx fifo to be emptied / rx fifo to be filled */ |
@@ -726,14 +731,14 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, | |||
726 | stop_reset: | 731 | stop_reset: |
727 | sh_msiof_reset_str(p); | 732 | sh_msiof_reset_str(p); |
728 | sh_msiof_spi_stop(p, rx); | 733 | sh_msiof_spi_stop(p, rx); |
729 | stop_tx: | 734 | stop_dma: |
730 | if (tx) | 735 | if (tx) |
731 | dmaengine_terminate_all(p->master->dma_tx); | 736 | dmaengine_terminate_all(p->master->dma_tx); |
732 | stop_rx: | 737 | no_dma_tx: |
733 | if (rx) | 738 | if (rx) |
734 | dmaengine_terminate_all(p->master->dma_rx); | 739 | dmaengine_terminate_all(p->master->dma_rx); |
735 | stop_ier: | ||
736 | sh_msiof_write(p, IER, 0); | 740 | sh_msiof_write(p, IER, 0); |
741 | no_dma_rx: | ||
737 | return ret; | 742 | return ret; |
738 | } | 743 | } |
739 | 744 | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index e0531baf2782..ca935df80c88 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -848,6 +848,7 @@ out: | |||
848 | 848 | ||
849 | /** | 849 | /** |
850 | * spi_finalize_current_transfer - report completion of a transfer | 850 | * spi_finalize_current_transfer - report completion of a transfer |
851 | * @master: the master reporting completion | ||
851 | * | 852 | * |
852 | * Called by SPI drivers using the core transfer_one_message() | 853 | * Called by SPI drivers using the core transfer_one_message() |
853 | * implementation to notify it that the current interrupt driven | 854 | * implementation to notify it that the current interrupt driven |
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/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/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/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/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/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/core/hub.c b/drivers/usb/core/hub.c index 8a4dcbc7a75f..46f5161c7891 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 { |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 0ba9c335b584..7c9618e916e2 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -1901,7 +1901,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, | |||
1901 | static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) | 1901 | static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) |
1902 | { | 1902 | { |
1903 | u32 dsts = readl(hsotg->regs + DSTS); | 1903 | u32 dsts = readl(hsotg->regs + DSTS); |
1904 | int ep0_mps = 0, ep_mps; | 1904 | int ep0_mps = 0, ep_mps = 8; |
1905 | 1905 | ||
1906 | /* | 1906 | /* |
1907 | * This should signal the finish of the enumeration phase | 1907 | * This should signal the finish of the enumeration phase |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index ef4936ff626c..9dcfbe7cd5f5 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 | ||
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/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/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/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-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-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..c020b094fe7d 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 | */ |
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/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-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.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/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 216ce3078270..824ea5e7ec8b 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) }, |
@@ -934,6 +935,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
934 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, | 935 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, |
935 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, | 936 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, |
936 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, | 937 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, |
938 | /* ekey Devices */ | ||
939 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, | ||
937 | /* Infineon Devices */ | 940 | /* Infineon Devices */ |
938 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | 941 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, |
939 | { } /* Terminating entry */ | 942 | { } /* Terminating entry */ |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 1e58d90a0b6c..70b0b1d88ae9 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 |
@@ -1378,3 +1380,8 @@ | |||
1378 | #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */ | 1380 | #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 */ | 1381 | #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 */ | 1382 | #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */ |
1383 | |||
1384 | /* | ||
1385 | * ekey biometric systems GmbH (http://ekey.net/) | ||
1386 | */ | ||
1387 | #define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ | ||
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/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..1a132e9e947a 100644 --- a/drivers/usb/serial/zte_ev.c +++ b/drivers/usb/serial/zte_ev.c | |||
@@ -272,28 +272,8 @@ 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 */ | ||
276 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) }, | ||
277 | /* AC8700 */ | ||
278 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) }, | ||
279 | /* MG880 */ | 275 | /* MG880 */ |
280 | { USB_DEVICE(0x19d2, 0xfffd) }, | 276 | { USB_DEVICE(0x19d2, 0xfffd) }, |
281 | { USB_DEVICE(0x19d2, 0xfffc) }, | ||
282 | { USB_DEVICE(0x19d2, 0xfffb) }, | ||
283 | /* AC8710_V3 */ | ||
284 | { USB_DEVICE(0x19d2, 0xfff6) }, | ||
285 | { USB_DEVICE(0x19d2, 0xfff7) }, | ||
286 | { USB_DEVICE(0x19d2, 0xfff8) }, | ||
287 | { USB_DEVICE(0x19d2, 0xfff9) }, | ||
288 | { USB_DEVICE(0x19d2, 0xffee) }, | ||
289 | /* AC2716, MC2716 */ | ||
290 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) }, | ||
291 | /* AD3812 */ | ||
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 | { }, | 277 | { }, |
298 | }; | 278 | }; |
299 | MODULE_DEVICE_TABLE(usb, id_table); | 279 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 80a5b366255f..7ef99b2f3aaf 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -922,6 +922,12 @@ UNUSUAL_DEV( 0x069b, 0x3004, 0x0001, 0x0001, | |||
922 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 922 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
923 | US_FL_FIX_CAPACITY ), | 923 | US_FL_FIX_CAPACITY ), |
924 | 924 | ||
925 | UNUSUAL_DEV( 0x06ca, 0x2003, 0x0100, 0x0100, | ||
926 | "Newer Technology", | ||
927 | "uSCSI", | ||
928 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
929 | US_FL_SCM_MULT_TARG ), | ||
930 | |||
925 | /* Reported by Adrian Pilchowiec <adi1981@epf.pl> */ | 931 | /* Reported by Adrian Pilchowiec <adi1981@epf.pl> */ |
926 | UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000, | 932 | UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000, |
927 | "RockChip", | 933 | "RockChip", |
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/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..a7b6217ac87b 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> |
@@ -650,6 +651,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) | |||
650 | { | 651 | { |
651 | struct device_node *endpoint; | 652 | struct device_node *endpoint; |
652 | int err; | 653 | int err; |
654 | unsigned int bpp; | ||
653 | u32 max_bandwidth; | 655 | u32 max_bandwidth; |
654 | u32 tft_r0b0g0[3]; | 656 | u32 tft_r0b0g0[3]; |
655 | 657 | ||
@@ -667,11 +669,22 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) | |||
667 | 669 | ||
668 | err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", | 670 | err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", |
669 | &max_bandwidth); | 671 | &max_bandwidth); |
670 | if (!err) | 672 | if (!err) { |
671 | fb->panel->bpp = 8 * max_bandwidth / (fb->panel->mode.xres * | 673 | /* |
672 | fb->panel->mode.yres * fb->panel->mode.refresh); | 674 | * max_bandwidth is in bytes per second and pixclock in |
673 | else | 675 | * pico-seconds, so the maximum allowed bits per pixel is |
674 | fb->panel->bpp = 32; | 676 | * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000) |
677 | * Rearrange this calculation to avoid overflow and then ensure | ||
678 | * result is a valid format. | ||
679 | */ | ||
680 | bpp = max_bandwidth / (1000 / 8) | ||
681 | / PICOS2KHZ(fb->panel->mode.pixclock); | ||
682 | bpp = rounddown_pow_of_two(bpp); | ||
683 | if (bpp > 32) | ||
684 | bpp = 32; | ||
685 | } else | ||
686 | bpp = 32; | ||
687 | fb->panel->bpp = bpp; | ||
675 | 688 | ||
676 | #ifdef CONFIG_CPU_BIG_ENDIAN | 689 | #ifdef CONFIG_CPU_BIG_ENDIAN |
677 | fb->panel->cntl |= CNTL_BEBO; | 690 | 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: |
@@ -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 | ||
@@ -857,6 +858,68 @@ out: | |||
857 | return ret; | 858 | return ret; |
858 | } | 859 | } |
859 | 860 | ||
861 | /* refill_reqs_available | ||
862 | * Updates the reqs_available reference counts used for tracking the | ||
863 | * number of free slots in the completion ring. This can be called | ||
864 | * from aio_complete() (to optimistically update reqs_available) or | ||
865 | * from aio_get_req() (the we're out of events case). It must be | ||
866 | * called holding ctx->completion_lock. | ||
867 | */ | ||
868 | static void refill_reqs_available(struct kioctx *ctx, unsigned head, | ||
869 | unsigned tail) | ||
870 | { | ||
871 | unsigned events_in_ring, completed; | ||
872 | |||
873 | /* Clamp head since userland can write to it. */ | ||
874 | head %= ctx->nr_events; | ||
875 | if (head <= tail) | ||
876 | events_in_ring = tail - head; | ||
877 | else | ||
878 | events_in_ring = ctx->nr_events - (head - tail); | ||
879 | |||
880 | completed = ctx->completed_events; | ||
881 | if (events_in_ring < completed) | ||
882 | completed -= events_in_ring; | ||
883 | else | ||
884 | completed = 0; | ||
885 | |||
886 | if (!completed) | ||
887 | return; | ||
888 | |||
889 | ctx->completed_events -= completed; | ||
890 | put_reqs_available(ctx, completed); | ||
891 | } | ||
892 | |||
893 | /* user_refill_reqs_available | ||
894 | * Called to refill reqs_available when aio_get_req() encounters an | ||
895 | * out of space in the completion ring. | ||
896 | */ | ||
897 | static void user_refill_reqs_available(struct kioctx *ctx) | ||
898 | { | ||
899 | spin_lock_irq(&ctx->completion_lock); | ||
900 | if (ctx->completed_events) { | ||
901 | struct aio_ring *ring; | ||
902 | unsigned head; | ||
903 | |||
904 | /* Access of ring->head may race with aio_read_events_ring() | ||
905 | * here, but that's okay since whether we read the old version | ||
906 | * or the new version, and either will be valid. The important | ||
907 | * part is that head cannot pass tail since we prevent | ||
908 | * aio_complete() from updating tail by holding | ||
909 | * ctx->completion_lock. Even if head is invalid, the check | ||
910 | * against ctx->completed_events below will make sure we do the | ||
911 | * safe/right thing. | ||
912 | */ | ||
913 | ring = kmap_atomic(ctx->ring_pages[0]); | ||
914 | head = ring->head; | ||
915 | kunmap_atomic(ring); | ||
916 | |||
917 | refill_reqs_available(ctx, head, ctx->tail); | ||
918 | } | ||
919 | |||
920 | spin_unlock_irq(&ctx->completion_lock); | ||
921 | } | ||
922 | |||
860 | /* aio_get_req | 923 | /* aio_get_req |
861 | * Allocate a slot for an aio request. | 924 | * Allocate a slot for an aio request. |
862 | * Returns NULL if no requests are free. | 925 | * Returns NULL if no requests are free. |
@@ -865,8 +928,11 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx) | |||
865 | { | 928 | { |
866 | struct kiocb *req; | 929 | struct kiocb *req; |
867 | 930 | ||
868 | if (!get_reqs_available(ctx)) | 931 | if (!get_reqs_available(ctx)) { |
869 | return NULL; | 932 | user_refill_reqs_available(ctx); |
933 | if (!get_reqs_available(ctx)) | ||
934 | return NULL; | ||
935 | } | ||
870 | 936 | ||
871 | req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO); | 937 | req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO); |
872 | if (unlikely(!req)) | 938 | if (unlikely(!req)) |
@@ -925,8 +991,8 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
925 | struct kioctx *ctx = iocb->ki_ctx; | 991 | struct kioctx *ctx = iocb->ki_ctx; |
926 | struct aio_ring *ring; | 992 | struct aio_ring *ring; |
927 | struct io_event *ev_page, *event; | 993 | struct io_event *ev_page, *event; |
994 | unsigned tail, pos, head; | ||
928 | unsigned long flags; | 995 | unsigned long flags; |
929 | unsigned tail, pos; | ||
930 | 996 | ||
931 | /* | 997 | /* |
932 | * Special case handling for sync iocbs: | 998 | * Special case handling for sync iocbs: |
@@ -987,10 +1053,14 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
987 | ctx->tail = tail; | 1053 | ctx->tail = tail; |
988 | 1054 | ||
989 | ring = kmap_atomic(ctx->ring_pages[0]); | 1055 | ring = kmap_atomic(ctx->ring_pages[0]); |
1056 | head = ring->head; | ||
990 | ring->tail = tail; | 1057 | ring->tail = tail; |
991 | kunmap_atomic(ring); | 1058 | kunmap_atomic(ring); |
992 | flush_dcache_page(ctx->ring_pages[0]); | 1059 | flush_dcache_page(ctx->ring_pages[0]); |
993 | 1060 | ||
1061 | ctx->completed_events++; | ||
1062 | if (ctx->completed_events > 1) | ||
1063 | refill_reqs_available(ctx, head, tail); | ||
994 | spin_unlock_irqrestore(&ctx->completion_lock, flags); | 1064 | spin_unlock_irqrestore(&ctx->completion_lock, flags); |
995 | 1065 | ||
996 | pr_debug("added to ring %p at [%u]\n", iocb, tail); | 1066 | pr_debug("added to ring %p at [%u]\n", iocb, tail); |
@@ -1005,7 +1075,6 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
1005 | 1075 | ||
1006 | /* everything turned out well, dispose of the aiocb. */ | 1076 | /* everything turned out well, dispose of the aiocb. */ |
1007 | kiocb_free(iocb); | 1077 | kiocb_free(iocb); |
1008 | put_reqs_available(ctx, 1); | ||
1009 | 1078 | ||
1010 | /* | 1079 | /* |
1011 | * We have to order our ring_info tail store above and test | 1080 | * We have to order our ring_info tail store above and test |
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/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..36861b7a6757 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 | ||
@@ -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..9c194bd74d6e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1096,8 +1096,10 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
1096 | async_cow->end = cur_end; | 1096 | async_cow->end = cur_end; |
1097 | INIT_LIST_HEAD(&async_cow->extents); | 1097 | INIT_LIST_HEAD(&async_cow->extents); |
1098 | 1098 | ||
1099 | btrfs_init_work(&async_cow->work, async_cow_start, | 1099 | btrfs_init_work(&async_cow->work, |
1100 | async_cow_submit, async_cow_free); | 1100 | btrfs_delalloc_helper, |
1101 | async_cow_start, async_cow_submit, | ||
1102 | async_cow_free); | ||
1101 | 1103 | ||
1102 | nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> | 1104 | nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> |
1103 | PAGE_CACHE_SHIFT; | 1105 | PAGE_CACHE_SHIFT; |
@@ -1881,7 +1883,8 @@ static int btrfs_writepage_start_hook(struct page *page, u64 start, u64 end) | |||
1881 | 1883 | ||
1882 | SetPageChecked(page); | 1884 | SetPageChecked(page); |
1883 | page_cache_get(page); | 1885 | page_cache_get(page); |
1884 | btrfs_init_work(&fixup->work, btrfs_writepage_fixup_worker, NULL, NULL); | 1886 | btrfs_init_work(&fixup->work, btrfs_fixup_helper, |
1887 | btrfs_writepage_fixup_worker, NULL, NULL); | ||
1885 | fixup->page = page; | 1888 | fixup->page = page; |
1886 | btrfs_queue_work(root->fs_info->fixup_workers, &fixup->work); | 1889 | btrfs_queue_work(root->fs_info->fixup_workers, &fixup->work); |
1887 | return -EBUSY; | 1890 | return -EBUSY; |
@@ -2822,7 +2825,8 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | |||
2822 | struct inode *inode = page->mapping->host; | 2825 | struct inode *inode = page->mapping->host; |
2823 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2826 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2824 | struct btrfs_ordered_extent *ordered_extent = NULL; | 2827 | struct btrfs_ordered_extent *ordered_extent = NULL; |
2825 | struct btrfs_workqueue *workers; | 2828 | struct btrfs_workqueue *wq; |
2829 | btrfs_work_func_t func; | ||
2826 | 2830 | ||
2827 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); | 2831 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); |
2828 | 2832 | ||
@@ -2831,13 +2835,17 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | |||
2831 | end - start + 1, uptodate)) | 2835 | end - start + 1, uptodate)) |
2832 | return 0; | 2836 | return 0; |
2833 | 2837 | ||
2834 | btrfs_init_work(&ordered_extent->work, finish_ordered_fn, NULL, NULL); | 2838 | if (btrfs_is_free_space_inode(inode)) { |
2839 | wq = root->fs_info->endio_freespace_worker; | ||
2840 | func = btrfs_freespace_write_helper; | ||
2841 | } else { | ||
2842 | wq = root->fs_info->endio_write_workers; | ||
2843 | func = btrfs_endio_write_helper; | ||
2844 | } | ||
2835 | 2845 | ||
2836 | if (btrfs_is_free_space_inode(inode)) | 2846 | btrfs_init_work(&ordered_extent->work, func, finish_ordered_fn, NULL, |
2837 | workers = root->fs_info->endio_freespace_worker; | 2847 | NULL); |
2838 | else | 2848 | btrfs_queue_work(wq, &ordered_extent->work); |
2839 | workers = root->fs_info->endio_write_workers; | ||
2840 | btrfs_queue_work(workers, &ordered_extent->work); | ||
2841 | 2849 | ||
2842 | return 0; | 2850 | return 0; |
2843 | } | 2851 | } |
@@ -4674,6 +4682,11 @@ static void evict_inode_truncate_pages(struct inode *inode) | |||
4674 | clear_bit(EXTENT_FLAG_LOGGING, &em->flags); | 4682 | clear_bit(EXTENT_FLAG_LOGGING, &em->flags); |
4675 | remove_extent_mapping(map_tree, em); | 4683 | remove_extent_mapping(map_tree, em); |
4676 | free_extent_map(em); | 4684 | free_extent_map(em); |
4685 | if (need_resched()) { | ||
4686 | write_unlock(&map_tree->lock); | ||
4687 | cond_resched(); | ||
4688 | write_lock(&map_tree->lock); | ||
4689 | } | ||
4677 | } | 4690 | } |
4678 | write_unlock(&map_tree->lock); | 4691 | write_unlock(&map_tree->lock); |
4679 | 4692 | ||
@@ -4696,6 +4709,7 @@ static void evict_inode_truncate_pages(struct inode *inode) | |||
4696 | &cached_state, GFP_NOFS); | 4709 | &cached_state, GFP_NOFS); |
4697 | free_extent_state(state); | 4710 | free_extent_state(state); |
4698 | 4711 | ||
4712 | cond_resched(); | ||
4699 | spin_lock(&io_tree->lock); | 4713 | spin_lock(&io_tree->lock); |
4700 | } | 4714 | } |
4701 | spin_unlock(&io_tree->lock); | 4715 | spin_unlock(&io_tree->lock); |
@@ -5181,6 +5195,42 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
5181 | iput(inode); | 5195 | iput(inode); |
5182 | inode = ERR_PTR(ret); | 5196 | inode = ERR_PTR(ret); |
5183 | } | 5197 | } |
5198 | /* | ||
5199 | * If orphan cleanup did remove any orphans, it means the tree | ||
5200 | * was modified and therefore the commit root is not the same as | ||
5201 | * the current root anymore. This is a problem, because send | ||
5202 | * uses the commit root and therefore can see inode items that | ||
5203 | * don't exist in the current root anymore, and for example make | ||
5204 | * calls to btrfs_iget, which will do tree lookups based on the | ||
5205 | * current root and not on the commit root. Those lookups will | ||
5206 | * fail, returning a -ESTALE error, and making send fail with | ||
5207 | * that error. So make sure a send does not see any orphans we | ||
5208 | * have just removed, and that it will see the same inodes | ||
5209 | * regardless of whether a transaction commit happened before | ||
5210 | * it started (meaning that the commit root will be the same as | ||
5211 | * the current root) or not. | ||
5212 | */ | ||
5213 | if (sub_root->node != sub_root->commit_root) { | ||
5214 | u64 sub_flags = btrfs_root_flags(&sub_root->root_item); | ||
5215 | |||
5216 | if (sub_flags & BTRFS_ROOT_SUBVOL_RDONLY) { | ||
5217 | struct extent_buffer *eb; | ||
5218 | |||
5219 | /* | ||
5220 | * Assert we can't have races between dentry | ||
5221 | * lookup called through the snapshot creation | ||
5222 | * ioctl and the VFS. | ||
5223 | */ | ||
5224 | ASSERT(mutex_is_locked(&dir->i_mutex)); | ||
5225 | |||
5226 | down_write(&root->fs_info->commit_root_sem); | ||
5227 | eb = sub_root->commit_root; | ||
5228 | sub_root->commit_root = | ||
5229 | btrfs_root_node(sub_root); | ||
5230 | up_write(&root->fs_info->commit_root_sem); | ||
5231 | free_extent_buffer(eb); | ||
5232 | } | ||
5233 | } | ||
5184 | } | 5234 | } |
5185 | 5235 | ||
5186 | return inode; | 5236 | return inode; |
@@ -5606,6 +5656,13 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5606 | } | 5656 | } |
5607 | 5657 | ||
5608 | /* | 5658 | /* |
5659 | * O_TMPFILE, set link count to 0, so that after this point, | ||
5660 | * we fill in an inode item with the correct link count. | ||
5661 | */ | ||
5662 | if (!name) | ||
5663 | set_nlink(inode, 0); | ||
5664 | |||
5665 | /* | ||
5609 | * we have to initialize this early, so we can reclaim the inode | 5666 | * we have to initialize this early, so we can reclaim the inode |
5610 | * number if we fail afterwards in this function. | 5667 | * number if we fail afterwards in this function. |
5611 | */ | 5668 | */ |
@@ -6097,14 +6154,14 @@ out_fail: | |||
6097 | static int merge_extent_mapping(struct extent_map_tree *em_tree, | 6154 | static int merge_extent_mapping(struct extent_map_tree *em_tree, |
6098 | struct extent_map *existing, | 6155 | struct extent_map *existing, |
6099 | struct extent_map *em, | 6156 | struct extent_map *em, |
6100 | u64 map_start, u64 map_len) | 6157 | u64 map_start) |
6101 | { | 6158 | { |
6102 | u64 start_diff; | 6159 | u64 start_diff; |
6103 | 6160 | ||
6104 | BUG_ON(map_start < em->start || map_start >= extent_map_end(em)); | 6161 | BUG_ON(map_start < em->start || map_start >= extent_map_end(em)); |
6105 | start_diff = map_start - em->start; | 6162 | start_diff = map_start - em->start; |
6106 | em->start = map_start; | 6163 | em->start = map_start; |
6107 | em->len = map_len; | 6164 | em->len = existing->start - em->start; |
6108 | if (em->block_start < EXTENT_MAP_LAST_BYTE && | 6165 | if (em->block_start < EXTENT_MAP_LAST_BYTE && |
6109 | !test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) { | 6166 | !test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) { |
6110 | em->block_start += start_diff; | 6167 | em->block_start += start_diff; |
@@ -6275,6 +6332,8 @@ next: | |||
6275 | goto not_found; | 6332 | goto not_found; |
6276 | if (start + len <= found_key.offset) | 6333 | if (start + len <= found_key.offset) |
6277 | goto not_found; | 6334 | goto not_found; |
6335 | if (start > found_key.offset) | ||
6336 | goto next; | ||
6278 | em->start = start; | 6337 | em->start = start; |
6279 | em->orig_start = start; | 6338 | em->orig_start = start; |
6280 | em->len = found_key.offset - start; | 6339 | em->len = found_key.offset - start; |
@@ -6390,8 +6449,7 @@ insert: | |||
6390 | em->len); | 6449 | em->len); |
6391 | if (existing) { | 6450 | if (existing) { |
6392 | err = merge_extent_mapping(em_tree, existing, | 6451 | err = merge_extent_mapping(em_tree, existing, |
6393 | em, start, | 6452 | em, start); |
6394 | root->sectorsize); | ||
6395 | free_extent_map(existing); | 6453 | free_extent_map(existing); |
6396 | if (err) { | 6454 | if (err) { |
6397 | free_extent_map(em); | 6455 | free_extent_map(em); |
@@ -7158,7 +7216,8 @@ again: | |||
7158 | if (!ret) | 7216 | if (!ret) |
7159 | goto out_test; | 7217 | goto out_test; |
7160 | 7218 | ||
7161 | btrfs_init_work(&ordered->work, finish_ordered_fn, NULL, NULL); | 7219 | btrfs_init_work(&ordered->work, btrfs_endio_write_helper, |
7220 | finish_ordered_fn, NULL, NULL); | ||
7162 | btrfs_queue_work(root->fs_info->endio_write_workers, | 7221 | btrfs_queue_work(root->fs_info->endio_write_workers, |
7163 | &ordered->work); | 7222 | &ordered->work); |
7164 | out_test: | 7223 | out_test: |
@@ -7306,10 +7365,8 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
7306 | map_length = orig_bio->bi_iter.bi_size; | 7365 | map_length = orig_bio->bi_iter.bi_size; |
7307 | ret = btrfs_map_block(root->fs_info, rw, start_sector << 9, | 7366 | ret = btrfs_map_block(root->fs_info, rw, start_sector << 9, |
7308 | &map_length, NULL, 0); | 7367 | &map_length, NULL, 0); |
7309 | if (ret) { | 7368 | if (ret) |
7310 | bio_put(orig_bio); | ||
7311 | return -EIO; | 7369 | return -EIO; |
7312 | } | ||
7313 | 7370 | ||
7314 | if (map_length >= orig_bio->bi_iter.bi_size) { | 7371 | if (map_length >= orig_bio->bi_iter.bi_size) { |
7315 | bio = orig_bio; | 7372 | bio = orig_bio; |
@@ -7326,6 +7383,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); | 7383 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); |
7327 | if (!bio) | 7384 | if (!bio) |
7328 | return -ENOMEM; | 7385 | return -ENOMEM; |
7386 | |||
7329 | bio->bi_private = dip; | 7387 | bio->bi_private = dip; |
7330 | bio->bi_end_io = btrfs_end_dio_bio; | 7388 | bio->bi_end_io = btrfs_end_dio_bio; |
7331 | atomic_inc(&dip->pending_bios); | 7389 | atomic_inc(&dip->pending_bios); |
@@ -7534,7 +7592,8 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
7534 | count = iov_iter_count(iter); | 7592 | count = iov_iter_count(iter); |
7535 | if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, | 7593 | if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, |
7536 | &BTRFS_I(inode)->runtime_flags)) | 7594 | &BTRFS_I(inode)->runtime_flags)) |
7537 | filemap_fdatawrite_range(inode->i_mapping, offset, count); | 7595 | filemap_fdatawrite_range(inode->i_mapping, offset, |
7596 | offset + count - 1); | ||
7538 | 7597 | ||
7539 | if (rw & WRITE) { | 7598 | if (rw & WRITE) { |
7540 | /* | 7599 | /* |
@@ -8495,7 +8554,9 @@ struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode, | |||
8495 | work->inode = inode; | 8554 | work->inode = inode; |
8496 | work->wait = wait; | 8555 | work->wait = wait; |
8497 | work->delay_iput = delay_iput; | 8556 | work->delay_iput = delay_iput; |
8498 | btrfs_init_work(&work->work, btrfs_run_delalloc_work, NULL, NULL); | 8557 | WARN_ON_ONCE(!inode); |
8558 | btrfs_init_work(&work->work, btrfs_flush_delalloc_helper, | ||
8559 | btrfs_run_delalloc_work, NULL, NULL); | ||
8499 | 8560 | ||
8500 | return work; | 8561 | return work; |
8501 | } | 8562 | } |
@@ -8979,6 +9040,14 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
8979 | if (ret) | 9040 | if (ret) |
8980 | goto out; | 9041 | goto out; |
8981 | 9042 | ||
9043 | /* | ||
9044 | * We set number of links to 0 in btrfs_new_inode(), and here we set | ||
9045 | * it to 1 because d_tmpfile() will issue a warning if the count is 0, | ||
9046 | * through: | ||
9047 | * | ||
9048 | * d_tmpfile() -> inode_dec_link_count() -> drop_nlink() | ||
9049 | */ | ||
9050 | set_nlink(inode, 1); | ||
8982 | d_tmpfile(dentry, inode); | 9051 | d_tmpfile(dentry, inode); |
8983 | mark_inode_dirty(inode); | 9052 | mark_inode_dirty(inode); |
8984 | 9053 | ||
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 47aceb494d1d..fce6fd0e3f50 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); |
@@ -3527,7 +3494,8 @@ process_slot: | |||
3527 | btrfs_mark_buffer_dirty(leaf); | 3494 | btrfs_mark_buffer_dirty(leaf); |
3528 | btrfs_release_path(path); | 3495 | btrfs_release_path(path); |
3529 | 3496 | ||
3530 | last_dest_end = new_key.offset + datal; | 3497 | last_dest_end = ALIGN(new_key.offset + datal, |
3498 | root->sectorsize); | ||
3531 | ret = clone_finish_inode_update(trans, inode, | 3499 | ret = clone_finish_inode_update(trans, inode, |
3532 | last_dest_end, | 3500 | last_dest_end, |
3533 | destoff, olen); | 3501 | 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..7e0e6e3029dd 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -3298,7 +3298,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, | |||
3298 | struct list_head ordered_sums; | 3298 | struct list_head ordered_sums; |
3299 | int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; | 3299 | int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; |
3300 | bool has_extents = false; | 3300 | bool has_extents = false; |
3301 | bool need_find_last_extent = (*last_extent == 0); | 3301 | bool need_find_last_extent = true; |
3302 | bool done = false; | 3302 | bool done = false; |
3303 | 3303 | ||
3304 | INIT_LIST_HEAD(&ordered_sums); | 3304 | INIT_LIST_HEAD(&ordered_sums); |
@@ -3352,8 +3352,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, | |||
3352 | */ | 3352 | */ |
3353 | if (ins_keys[i].type == BTRFS_EXTENT_DATA_KEY) { | 3353 | if (ins_keys[i].type == BTRFS_EXTENT_DATA_KEY) { |
3354 | has_extents = true; | 3354 | has_extents = true; |
3355 | if (need_find_last_extent && | 3355 | if (first_key.objectid == (u64)-1) |
3356 | first_key.objectid == (u64)-1) | ||
3357 | first_key = ins_keys[i]; | 3356 | first_key = ins_keys[i]; |
3358 | } else { | 3357 | } else { |
3359 | need_find_last_extent = false; | 3358 | need_find_last_extent = false; |
@@ -3427,6 +3426,16 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, | |||
3427 | if (!has_extents) | 3426 | if (!has_extents) |
3428 | return ret; | 3427 | return ret; |
3429 | 3428 | ||
3429 | if (need_find_last_extent && *last_extent == first_key.offset) { | ||
3430 | /* | ||
3431 | * We don't have any leafs between our current one and the one | ||
3432 | * we processed before that can have file extent items for our | ||
3433 | * inode (and have a generation number smaller than our current | ||
3434 | * transaction id). | ||
3435 | */ | ||
3436 | need_find_last_extent = false; | ||
3437 | } | ||
3438 | |||
3430 | /* | 3439 | /* |
3431 | * Because we use btrfs_search_forward we could skip leaves that were | 3440 | * 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 | 3441 | * not modified and then assume *last_extent is valid when it really |
@@ -3537,7 +3546,7 @@ fill_holes: | |||
3537 | 0, 0); | 3546 | 0, 0); |
3538 | if (ret) | 3547 | if (ret) |
3539 | break; | 3548 | break; |
3540 | *last_extent = offset + len; | 3549 | *last_extent = extent_end; |
3541 | } | 3550 | } |
3542 | /* | 3551 | /* |
3543 | * Need to let the callers know we dropped the path so they should | 3552 | * Need to let the callers know we dropped the path so they should |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6cb82f62cb7c..340a92d08e84 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -508,6 +508,44 @@ 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 | * As of now don't allow update to btrfs_fs_device through | ||
533 | * the btrfs dev scan cli, after FS has been mounted. | ||
534 | */ | ||
535 | if (fs_devices->opened) { | ||
536 | return -EBUSY; | ||
537 | } else { | ||
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 | if (found_transid < device->generation) | ||
546 | return -EEXIST; | ||
547 | } | ||
548 | |||
511 | name = rcu_string_strdup(path, GFP_NOFS); | 549 | name = rcu_string_strdup(path, GFP_NOFS); |
512 | if (!name) | 550 | if (!name) |
513 | return -ENOMEM; | 551 | return -ENOMEM; |
@@ -519,6 +557,15 @@ static noinline int device_list_add(const char *path, | |||
519 | } | 557 | } |
520 | } | 558 | } |
521 | 559 | ||
560 | /* | ||
561 | * Unmount does not free the btrfs_device struct but would zero | ||
562 | * generation along with most of the other members. So just update | ||
563 | * it back. We need it to pick the disk with largest generation | ||
564 | * (as above). | ||
565 | */ | ||
566 | if (!fs_devices->opened) | ||
567 | device->generation = found_transid; | ||
568 | |||
522 | if (found_transid > fs_devices->latest_trans) { | 569 | if (found_transid > fs_devices->latest_trans) { |
523 | fs_devices->latest_devid = devid; | 570 | fs_devices->latest_devid = devid; |
524 | fs_devices->latest_trans = found_transid; | 571 | fs_devices->latest_trans = found_transid; |
@@ -1436,7 +1483,7 @@ static int btrfs_add_device(struct btrfs_trans_handle *trans, | |||
1436 | btrfs_set_device_io_align(leaf, dev_item, device->io_align); | 1483 | btrfs_set_device_io_align(leaf, dev_item, device->io_align); |
1437 | btrfs_set_device_io_width(leaf, dev_item, device->io_width); | 1484 | btrfs_set_device_io_width(leaf, dev_item, device->io_width); |
1438 | btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); | 1485 | btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); |
1439 | btrfs_set_device_total_bytes(leaf, dev_item, device->total_bytes); | 1486 | btrfs_set_device_total_bytes(leaf, dev_item, device->disk_total_bytes); |
1440 | btrfs_set_device_bytes_used(leaf, dev_item, device->bytes_used); | 1487 | btrfs_set_device_bytes_used(leaf, dev_item, device->bytes_used); |
1441 | btrfs_set_device_group(leaf, dev_item, 0); | 1488 | btrfs_set_device_group(leaf, dev_item, 0); |
1442 | btrfs_set_device_seek_speed(leaf, dev_item, 0); | 1489 | btrfs_set_device_seek_speed(leaf, dev_item, 0); |
@@ -1671,7 +1718,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1671 | device->fs_devices->total_devices--; | 1718 | device->fs_devices->total_devices--; |
1672 | 1719 | ||
1673 | if (device->missing) | 1720 | if (device->missing) |
1674 | root->fs_info->fs_devices->missing_devices--; | 1721 | device->fs_devices->missing_devices--; |
1675 | 1722 | ||
1676 | next_device = list_entry(root->fs_info->fs_devices->devices.next, | 1723 | next_device = list_entry(root->fs_info->fs_devices->devices.next, |
1677 | struct btrfs_device, dev_list); | 1724 | struct btrfs_device, dev_list); |
@@ -1801,8 +1848,12 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info, | |||
1801 | if (srcdev->bdev) { | 1848 | if (srcdev->bdev) { |
1802 | fs_info->fs_devices->open_devices--; | 1849 | fs_info->fs_devices->open_devices--; |
1803 | 1850 | ||
1804 | /* zero out the old super */ | 1851 | /* |
1805 | btrfs_scratch_superblock(srcdev); | 1852 | * zero out the old super if it is not writable |
1853 | * (e.g. seed device) | ||
1854 | */ | ||
1855 | if (srcdev->writeable) | ||
1856 | btrfs_scratch_superblock(srcdev); | ||
1806 | } | 1857 | } |
1807 | 1858 | ||
1808 | call_rcu(&srcdev->rcu, free_device); | 1859 | call_rcu(&srcdev->rcu, free_device); |
@@ -1941,6 +1992,9 @@ static int btrfs_prepare_sprout(struct btrfs_root *root) | |||
1941 | fs_devices->seeding = 0; | 1992 | fs_devices->seeding = 0; |
1942 | fs_devices->num_devices = 0; | 1993 | fs_devices->num_devices = 0; |
1943 | fs_devices->open_devices = 0; | 1994 | fs_devices->open_devices = 0; |
1995 | fs_devices->missing_devices = 0; | ||
1996 | fs_devices->num_can_discard = 0; | ||
1997 | fs_devices->rotating = 0; | ||
1944 | fs_devices->seed = seed_devices; | 1998 | fs_devices->seed = seed_devices; |
1945 | 1999 | ||
1946 | generate_random_uuid(fs_devices->fsid); | 2000 | generate_random_uuid(fs_devices->fsid); |
@@ -5800,7 +5854,8 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info, | |||
5800 | else | 5854 | else |
5801 | generate_random_uuid(dev->uuid); | 5855 | generate_random_uuid(dev->uuid); |
5802 | 5856 | ||
5803 | btrfs_init_work(&dev->work, pending_bios_fn, NULL, NULL); | 5857 | btrfs_init_work(&dev->work, btrfs_submit_helper, |
5858 | pending_bios_fn, NULL, NULL); | ||
5804 | 5859 | ||
5805 | return dev; | 5860 | return dev; |
5806 | } | 5861 | } |
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/cifsglob.h b/fs/cifs/cifsglob.h index 0012e1e291d4..dfc731b02aa9 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -409,6 +409,10 @@ struct smb_version_operations { | |||
409 | /* get mtu credits */ | 409 | /* get mtu credits */ |
410 | int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int, | 410 | int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int, |
411 | unsigned int *, unsigned int *); | 411 | unsigned int *, unsigned int *); |
412 | /* check if we need to issue closedir */ | ||
413 | bool (*dir_needs_close)(struct cifsFileInfo *); | ||
414 | long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, | ||
415 | loff_t); | ||
412 | }; | 416 | }; |
413 | 417 | ||
414 | struct smb_version_values { | 418 | struct smb_version_values { |
@@ -883,6 +887,7 @@ struct cifs_tcon { | |||
883 | for this mount even if server would support */ | 887 | for this mount even if server would support */ |
884 | bool local_lease:1; /* check leases (only) on local system not remote */ | 888 | 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 */ | 889 | bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */ |
890 | bool broken_sparse_sup; /* if server or share does not support sparse */ | ||
886 | bool need_reconnect:1; /* connection reset, tid now invalid */ | 891 | bool need_reconnect:1; /* connection reset, tid now invalid */ |
887 | #ifdef CONFIG_CIFS_SMB2 | 892 | #ifdef CONFIG_CIFS_SMB2 |
888 | bool print:1; /* set if connection to printer share */ | 893 | 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/file.c b/fs/cifs/file.c index 4ab2f79ffa7a..d5fec92e0360 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -762,7 +762,7 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
762 | 762 | ||
763 | cifs_dbg(FYI, "Freeing private data in close dir\n"); | 763 | cifs_dbg(FYI, "Freeing private data in close dir\n"); |
764 | spin_lock(&cifs_file_list_lock); | 764 | spin_lock(&cifs_file_list_lock); |
765 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { | 765 | if (server->ops->dir_needs_close(cfile)) { |
766 | cfile->invalidHandle = true; | 766 | cfile->invalidHandle = true; |
767 | spin_unlock(&cifs_file_list_lock); | 767 | spin_unlock(&cifs_file_list_lock); |
768 | if (server->ops->close_dir) | 768 | if (server->ops->close_dir) |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 426d6c6ad8bf..949ec909ec9a 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1727,6 +1727,12 @@ unlink_target: | |||
1727 | target_dentry, to_name); | 1727 | target_dentry, to_name); |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | /* force revalidate to go get info when needed */ | ||
1731 | CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0; | ||
1732 | |||
1733 | source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime = | ||
1734 | target_dir->i_mtime = current_fs_time(source_dir->i_sb); | ||
1735 | |||
1730 | cifs_rename_exit: | 1736 | cifs_rename_exit: |
1731 | kfree(info_buf_source); | 1737 | kfree(info_buf_source); |
1732 | kfree(from_name); | 1738 | kfree(from_name); |
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/readdir.c b/fs/cifs/readdir.c index b15862e0f68c..798c80a41c88 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -593,7 +593,7 @@ 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) |
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/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..5a48aa290dfe 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -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..fa0dd044213b 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -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; |
@@ -2177,6 +2180,10 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, | |||
2177 | rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; | 2180 | rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; |
2178 | 2181 | ||
2179 | if (rc) { | 2182 | if (rc) { |
2183 | if (rc == -ENODATA && rsp->hdr.Status == STATUS_NO_MORE_FILES) { | ||
2184 | srch_inf->endOfSearch = true; | ||
2185 | rc = 0; | ||
2186 | } | ||
2180 | cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); | 2187 | cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); |
2181 | goto qdir_exit; | 2188 | goto qdir_exit; |
2182 | } | 2189 | } |
@@ -2214,11 +2221,6 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, | |||
2214 | else | 2221 | else |
2215 | cifs_dbg(VFS, "illegal search buffer type\n"); | 2222 | cifs_dbg(VFS, "illegal search buffer type\n"); |
2216 | 2223 | ||
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; | 2224 | return rc; |
2223 | 2225 | ||
2224 | qdir_exit: | 2226 | 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/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..90a3cdca3f88 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,10 @@ 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 | goto end_rename; | ||
3244 | } | ||
3217 | if (new.bh) { | 3245 | if (new.bh) { |
3218 | if (!new.inode) { | 3246 | if (!new.inode) { |
3219 | brelse(new.bh); | 3247 | brelse(new.bh); |
@@ -3246,6 +3274,15 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3246 | if (retval) | 3274 | if (retval) |
3247 | goto end_rename; | 3275 | goto end_rename; |
3248 | } | 3276 | } |
3277 | /* | ||
3278 | * If we're renaming a file within an inline_data dir and adding or | ||
3279 | * setting the new dirent causes a conversion from inline_data to | ||
3280 | * extents/blockmap, we need to force the dirent delete code to | ||
3281 | * re-read the directory, or else we end up trying to delete a dirent | ||
3282 | * from what is now the extent tree root (or a block map). | ||
3283 | */ | ||
3284 | force_reread = (new.dir->i_ino == old.dir->i_ino && | ||
3285 | ext4_test_inode_flag(new.dir, EXT4_INODE_INLINE_DATA)); | ||
3249 | if (!new.bh) { | 3286 | if (!new.bh) { |
3250 | retval = ext4_add_entry(handle, new.dentry, old.inode); | 3287 | retval = ext4_add_entry(handle, new.dentry, old.inode); |
3251 | if (retval) | 3288 | if (retval) |
@@ -3256,6 +3293,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3256 | if (retval) | 3293 | if (retval) |
3257 | goto end_rename; | 3294 | goto end_rename; |
3258 | } | 3295 | } |
3296 | if (force_reread) | ||
3297 | force_reread = !ext4_test_inode_flag(new.dir, | ||
3298 | EXT4_INODE_INLINE_DATA); | ||
3259 | 3299 | ||
3260 | /* | 3300 | /* |
3261 | * Like most other Unix systems, set the ctime for inodes on a | 3301 | * Like most other Unix systems, set the ctime for inodes on a |
@@ -3267,7 +3307,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3267 | /* | 3307 | /* |
3268 | * ok, that's it | 3308 | * ok, that's it |
3269 | */ | 3309 | */ |
3270 | ext4_rename_delete(handle, &old); | 3310 | ext4_rename_delete(handle, &old, force_reread); |
3271 | 3311 | ||
3272 | if (new.inode) { | 3312 | if (new.inode) { |
3273 | ext4_dec_count(handle, new.inode); | 3313 | ext4_dec_count(handle, new.inode); |
@@ -3330,6 +3370,8 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3330 | 3370 | ||
3331 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, | 3371 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, |
3332 | &old.de, &old.inlined); | 3372 | &old.de, &old.inlined); |
3373 | if (IS_ERR(old.bh)) | ||
3374 | return PTR_ERR(old.bh); | ||
3333 | /* | 3375 | /* |
3334 | * Check for inode number is _not_ due to possible IO errors. | 3376 | * Check for inode number is _not_ due to possible IO errors. |
3335 | * We might rmdir the source, keep it as pwd of some process | 3377 | * We might rmdir the source, keep it as pwd of some process |
@@ -3342,6 +3384,10 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3342 | 3384 | ||
3343 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, | 3385 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, |
3344 | &new.de, &new.inlined); | 3386 | &new.de, &new.inlined); |
3387 | if (IS_ERR(new.bh)) { | ||
3388 | retval = PTR_ERR(new.bh); | ||
3389 | goto end_rename; | ||
3390 | } | ||
3345 | 3391 | ||
3346 | /* RENAME_EXCHANGE case: old *and* new must both exist */ | 3392 | /* RENAME_EXCHANGE case: old *and* new must both exist */ |
3347 | if (!new.bh || le32_to_cpu(new.de->inode) != new.inode->i_ino) | 3393 | if (!new.bh || le32_to_cpu(new.de->inode) != new.inode->i_ino) |
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/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/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/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/nfs4proc.c b/fs/nfs/nfs4proc.c index 75ae8d22f067..7dd8aca31c29 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2560,6 +2560,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2560 | struct nfs4_closedata *calldata = data; | 2560 | struct nfs4_closedata *calldata = data; |
2561 | struct nfs4_state *state = calldata->state; | 2561 | struct nfs4_state *state = calldata->state; |
2562 | struct nfs_server *server = NFS_SERVER(calldata->inode); | 2562 | struct nfs_server *server = NFS_SERVER(calldata->inode); |
2563 | nfs4_stateid *res_stateid = NULL; | ||
2563 | 2564 | ||
2564 | dprintk("%s: begin!\n", __func__); | 2565 | dprintk("%s: begin!\n", __func__); |
2565 | if (!nfs4_sequence_done(task, &calldata->res.seq_res)) | 2566 | if (!nfs4_sequence_done(task, &calldata->res.seq_res)) |
@@ -2570,12 +2571,12 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2570 | */ | 2571 | */ |
2571 | switch (task->tk_status) { | 2572 | switch (task->tk_status) { |
2572 | case 0: | 2573 | case 0: |
2573 | if (calldata->roc) | 2574 | res_stateid = &calldata->res.stateid; |
2575 | if (calldata->arg.fmode == 0 && calldata->roc) | ||
2574 | pnfs_roc_set_barrier(state->inode, | 2576 | pnfs_roc_set_barrier(state->inode, |
2575 | calldata->roc_barrier); | 2577 | calldata->roc_barrier); |
2576 | nfs_clear_open_stateid(state, &calldata->res.stateid, 0); | ||
2577 | renew_lease(server, calldata->timestamp); | 2578 | renew_lease(server, calldata->timestamp); |
2578 | goto out_release; | 2579 | break; |
2579 | case -NFS4ERR_ADMIN_REVOKED: | 2580 | case -NFS4ERR_ADMIN_REVOKED: |
2580 | case -NFS4ERR_STALE_STATEID: | 2581 | case -NFS4ERR_STALE_STATEID: |
2581 | case -NFS4ERR_OLD_STATEID: | 2582 | case -NFS4ERR_OLD_STATEID: |
@@ -2589,7 +2590,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2589 | goto out_release; | 2590 | goto out_release; |
2590 | } | 2591 | } |
2591 | } | 2592 | } |
2592 | nfs_clear_open_stateid(state, NULL, calldata->arg.fmode); | 2593 | nfs_clear_open_stateid(state, res_stateid, calldata->arg.fmode); |
2593 | out_release: | 2594 | out_release: |
2594 | nfs_release_seqid(calldata->arg.seqid); | 2595 | nfs_release_seqid(calldata->arg.seqid); |
2595 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); | 2596 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); |
@@ -2601,6 +2602,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2601 | struct nfs4_closedata *calldata = data; | 2602 | struct nfs4_closedata *calldata = data; |
2602 | struct nfs4_state *state = calldata->state; | 2603 | struct nfs4_state *state = calldata->state; |
2603 | struct inode *inode = calldata->inode; | 2604 | struct inode *inode = calldata->inode; |
2605 | bool is_rdonly, is_wronly, is_rdwr; | ||
2604 | int call_close = 0; | 2606 | int call_close = 0; |
2605 | 2607 | ||
2606 | dprintk("%s: begin!\n", __func__); | 2608 | dprintk("%s: begin!\n", __func__); |
@@ -2608,18 +2610,24 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2608 | goto out_wait; | 2610 | goto out_wait; |
2609 | 2611 | ||
2610 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; | 2612 | 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); | 2613 | spin_lock(&state->owner->so_lock); |
2614 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); | ||
2615 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); | ||
2616 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); | ||
2617 | /* Calculate the current open share mode */ | ||
2618 | calldata->arg.fmode = 0; | ||
2619 | if (is_rdonly || is_rdwr) | ||
2620 | calldata->arg.fmode |= FMODE_READ; | ||
2621 | if (is_wronly || is_rdwr) | ||
2622 | calldata->arg.fmode |= FMODE_WRITE; | ||
2613 | /* Calculate the change in open mode */ | 2623 | /* Calculate the change in open mode */ |
2614 | if (state->n_rdwr == 0) { | 2624 | if (state->n_rdwr == 0) { |
2615 | if (state->n_rdonly == 0) { | 2625 | if (state->n_rdonly == 0) { |
2616 | call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags); | 2626 | call_close |= is_rdonly || is_rdwr; |
2617 | call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); | ||
2618 | calldata->arg.fmode &= ~FMODE_READ; | 2627 | calldata->arg.fmode &= ~FMODE_READ; |
2619 | } | 2628 | } |
2620 | if (state->n_wronly == 0) { | 2629 | if (state->n_wronly == 0) { |
2621 | call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags); | 2630 | call_close |= is_wronly || is_rdwr; |
2622 | call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); | ||
2623 | calldata->arg.fmode &= ~FMODE_WRITE; | 2631 | calldata->arg.fmode &= ~FMODE_WRITE; |
2624 | } | 2632 | } |
2625 | } | 2633 | } |
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/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/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/udf/namei.c b/fs/udf/namei.c index 9737cba1357d..83a06001742b 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -1014,7 +1014,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
1014 | 1014 | ||
1015 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 1015 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
1016 | if (!fi) | 1016 | if (!fi) |
1017 | goto out_no_entry; | 1017 | goto out_fail; |
1018 | cfi.icb.extLength = cpu_to_le32(sb->s_blocksize); | 1018 | cfi.icb.extLength = cpu_to_le32(sb->s_blocksize); |
1019 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); | 1019 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); |
1020 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { | 1020 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { |
@@ -1036,6 +1036,7 @@ out: | |||
1036 | 1036 | ||
1037 | out_no_entry: | 1037 | out_no_entry: |
1038 | up_write(&iinfo->i_data_sem); | 1038 | up_write(&iinfo->i_data_sem); |
1039 | out_fail: | ||
1039 | inode_dec_link_count(inode); | 1040 | inode_dec_link_count(inode); |
1040 | iput(inode); | 1041 | iput(inode); |
1041 | goto out; | 1042 | goto out; |
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/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/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..c7e17de732f3 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,6 +32,8 @@ 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, |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index ea507665896c..a95efeb53a8b 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -577,16 +577,20 @@ 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 | 580 | #ifdef CONFIG_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); | 581 | void acpi_i2c_register_devices(struct i2c_adapter *adap); |
584 | #else | 582 | #else |
585 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } | 583 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } |
584 | #endif /* CONFIG_ACPI */ | ||
585 | |||
586 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
587 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter); | ||
588 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter); | ||
589 | #else | ||
586 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | 590 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) |
587 | { } | 591 | { } |
588 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | 592 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) |
589 | { return 0; } | 593 | { return 0; } |
590 | #endif | 594 | #endif /* CONFIG_ACPI_I2C_OPREGION */ |
591 | 595 | ||
592 | #endif /* _LINUX_I2C_H */ | 596 | #endif /* _LINUX_I2C_H */ |
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/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/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/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/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/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/kernel/events/core.c b/kernel/events/core.c index 1cf24b3e42ec..f9c1ed002dbc 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 | ||
@@ -3717,6 +3718,26 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
3717 | return 0; | 3718 | return 0; |
3718 | } | 3719 | } |
3719 | 3720 | ||
3721 | #ifdef CONFIG_COMPAT | ||
3722 | static long perf_compat_ioctl(struct file *file, unsigned int cmd, | ||
3723 | unsigned long arg) | ||
3724 | { | ||
3725 | switch (_IOC_NR(cmd)) { | ||
3726 | case _IOC_NR(PERF_EVENT_IOC_SET_FILTER): | ||
3727 | case _IOC_NR(PERF_EVENT_IOC_ID): | ||
3728 | /* Fix up pointer size (usually 4 -> 8 in 32-on-64-bit case */ | ||
3729 | if (_IOC_SIZE(cmd) == sizeof(compat_uptr_t)) { | ||
3730 | cmd &= ~IOCSIZE_MASK; | ||
3731 | cmd |= sizeof(void *) << IOCSIZE_SHIFT; | ||
3732 | } | ||
3733 | break; | ||
3734 | } | ||
3735 | return perf_ioctl(file, cmd, arg); | ||
3736 | } | ||
3737 | #else | ||
3738 | # define perf_compat_ioctl NULL | ||
3739 | #endif | ||
3740 | |||
3720 | int perf_event_task_enable(void) | 3741 | int perf_event_task_enable(void) |
3721 | { | 3742 | { |
3722 | struct perf_event *event; | 3743 | struct perf_event *event; |
@@ -4222,7 +4243,7 @@ static const struct file_operations perf_fops = { | |||
4222 | .read = perf_read, | 4243 | .read = perf_read, |
4223 | .poll = perf_poll, | 4244 | .poll = perf_poll, |
4224 | .unlocked_ioctl = perf_ioctl, | 4245 | .unlocked_ioctl = perf_ioctl, |
4225 | .compat_ioctl = perf_ioctl, | 4246 | .compat_ioctl = perf_compat_ioctl, |
4226 | .mmap = perf_mmap, | 4247 | .mmap = perf_mmap, |
4227 | .fasync = perf_fasync, | 4248 | .fasync = perf_fasync, |
4228 | }; | 4249 | }; |
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/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/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.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/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/memblock.c b/mm/memblock.c index 6d2f219a48b0..70fad0c0dafb 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) |
diff --git a/mm/memory.c b/mm/memory.c index ab3537bcfed2..adeac306610f 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -751,7 +751,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | |||
751 | unsigned long pfn = pte_pfn(pte); | 751 | unsigned long pfn = pte_pfn(pte); |
752 | 752 | ||
753 | if (HAVE_PTE_SPECIAL) { | 753 | if (HAVE_PTE_SPECIAL) { |
754 | if (likely(!pte_special(pte) || pte_numa(pte))) | 754 | if (likely(!pte_special(pte))) |
755 | goto check_pfn; | 755 | goto check_pfn; |
756 | if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)) | 756 | if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)) |
757 | return NULL; | 757 | return NULL; |
@@ -777,15 +777,14 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | |||
777 | } | 777 | } |
778 | } | 778 | } |
779 | 779 | ||
780 | if (is_zero_pfn(pfn)) | ||
781 | return NULL; | ||
780 | check_pfn: | 782 | check_pfn: |
781 | if (unlikely(pfn > highest_memmap_pfn)) { | 783 | if (unlikely(pfn > highest_memmap_pfn)) { |
782 | print_bad_pte(vma, addr, pte, NULL); | 784 | print_bad_pte(vma, addr, pte, NULL); |
783 | return NULL; | 785 | return NULL; |
784 | } | 786 | } |
785 | 787 | ||
786 | if (is_zero_pfn(pfn)) | ||
787 | return NULL; | ||
788 | |||
789 | /* | 788 | /* |
790 | * NOTE! We still have PageReserved() pages in the page tables. | 789 | * NOTE! We still have PageReserved() pages in the page tables. |
791 | * eg. VDSO mappings can cause them to exist. | 790 | * eg. VDSO mappings can cause them to exist. |
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 */ |
@@ -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/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/mac80211/chan.c b/net/mac80211/chan.c index 6d537f03c0ba..0375009ddc0d 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -1444,7 +1444,7 @@ ieee80211_vif_use_reserved_switch(struct ieee80211_local *local) | |||
1444 | 1444 | ||
1445 | list_del(&sdata->reserved_chanctx_list); | 1445 | list_del(&sdata->reserved_chanctx_list); |
1446 | list_move(&sdata->assigned_chanctx_list, | 1446 | list_move(&sdata->assigned_chanctx_list, |
1447 | &new_ctx->assigned_vifs); | 1447 | &ctx->assigned_vifs); |
1448 | sdata->reserved_chanctx = NULL; | 1448 | sdata->reserved_chanctx = NULL; |
1449 | 1449 | ||
1450 | ieee80211_vif_chanctx_reservation_complete(sdata); | 1450 | ieee80211_vif_chanctx_reservation_complete(sdata); |
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/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/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/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/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/scripts/checkpatch.pl b/scripts/checkpatch.pl index 31a731e06f50..b385bcbbf2f5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2133,7 +2133,7 @@ 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(c)ommit\s+([0-9a-f]{5,})/i; | 2137 | $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i; |
2138 | my $init_char = $1; | 2138 | my $init_char = $1; |
2139 | my $orig_commit = lc($2); | 2139 | my $orig_commit = lc($2); |
@@ -2141,7 +2141,7 @@ sub process { | |||
2141 | my $desc = 'commit description'; | 2141 | my $desc = 'commit description'; |
2142 | ($id, $desc) = git_commit_info($orig_commit, $id, $desc); | 2142 | ($id, $desc) = git_commit_info($orig_commit, $id, $desc); |
2143 | ERROR("GIT_COMMIT_ID", | 2143 | ERROR("GIT_COMMIT_ID", |
2144 | "Please use 12 to 16 chars for the git commit ID like: '${init_char}ommit $id (\"$desc\")'\n" . $herecurr); | 2144 | "Please use 12 or more chars for the git commit ID like: '${init_char}ommit $id (\"$desc\")'\n" . $herecurr); |
2145 | } | 2145 | } |
2146 | 2146 | ||
2147 | # Check for added, moved or deleted files | 2147 | # 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/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_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/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_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..d446ac3137b3 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, |
@@ -2806,6 +2808,8 @@ static void alc286_shutup(struct hda_codec *codec) | |||
2806 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) | 2808 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) |
2807 | { | 2809 | { |
2808 | int val = alc_read_coef_idx(codec, 0x04); | 2810 | int val = alc_read_coef_idx(codec, 0x04); |
2811 | if (val == -1) | ||
2812 | return; | ||
2809 | if (power_up) | 2813 | if (power_up) |
2810 | val |= 1 << 11; | 2814 | val |= 1 << 11; |
2811 | else | 2815 | else |
@@ -3264,6 +3268,15 @@ static int alc269_resume(struct hda_codec *codec) | |||
3264 | snd_hda_codec_resume_cache(codec); | 3268 | snd_hda_codec_resume_cache(codec); |
3265 | alc_inv_dmic_sync(codec, true); | 3269 | alc_inv_dmic_sync(codec, true); |
3266 | hda_call_check_power_status(codec, 0x01); | 3270 | hda_call_check_power_status(codec, 0x01); |
3271 | |||
3272 | /* on some machine, the BIOS will clear the codec gpio data when enter | ||
3273 | * suspend, and won't restore the data after resume, so we restore it | ||
3274 | * in the driver. | ||
3275 | */ | ||
3276 | if (spec->gpio_led) | ||
3277 | snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA, | ||
3278 | spec->gpio_led); | ||
3279 | |||
3267 | if (spec->has_alc5505_dsp) | 3280 | if (spec->has_alc5505_dsp) |
3268 | alc5505_dsp_resume(codec); | 3281 | alc5505_dsp_resume(codec); |
3269 | 3282 | ||
@@ -4395,6 +4408,7 @@ enum { | |||
4395 | ALC292_FIXUP_TPT440_DOCK, | 4408 | ALC292_FIXUP_TPT440_DOCK, |
4396 | ALC283_FIXUP_BXBT2807_MIC, | 4409 | ALC283_FIXUP_BXBT2807_MIC, |
4397 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, | 4410 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, |
4411 | ALC282_FIXUP_ASPIRE_V5_PINS, | ||
4398 | }; | 4412 | }; |
4399 | 4413 | ||
4400 | static const struct hda_fixup alc269_fixups[] = { | 4414 | static const struct hda_fixup alc269_fixups[] = { |
@@ -4842,6 +4856,22 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4842 | .chained_before = true, | 4856 | .chained_before = true, |
4843 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | 4857 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
4844 | }, | 4858 | }, |
4859 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { | ||
4860 | .type = HDA_FIXUP_PINS, | ||
4861 | .v.pins = (const struct hda_pintbl[]) { | ||
4862 | { 0x12, 0x90a60130 }, | ||
4863 | { 0x14, 0x90170110 }, | ||
4864 | { 0x17, 0x40000008 }, | ||
4865 | { 0x18, 0x411111f0 }, | ||
4866 | { 0x19, 0x411111f0 }, | ||
4867 | { 0x1a, 0x411111f0 }, | ||
4868 | { 0x1b, 0x411111f0 }, | ||
4869 | { 0x1d, 0x40f89b2d }, | ||
4870 | { 0x1e, 0x411111f0 }, | ||
4871 | { 0x21, 0x0321101f }, | ||
4872 | { }, | ||
4873 | }, | ||
4874 | }, | ||
4845 | 4875 | ||
4846 | }; | 4876 | }; |
4847 | 4877 | ||
@@ -4853,6 +4883,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4853 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), | 4883 | 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), | 4884 | 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), | 4885 | SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
4886 | 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), | 4887 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
4857 | SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4888 | 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), | 4889 | SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
@@ -5311,27 +5342,30 @@ static void alc269_fill_coef(struct hda_codec *codec) | |||
5311 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { | 5342 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
5312 | val = alc_read_coef_idx(codec, 0x04); | 5343 | val = alc_read_coef_idx(codec, 0x04); |
5313 | /* Power up output pin */ | 5344 | /* Power up output pin */ |
5314 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | 5345 | if (val != -1) |
5346 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | ||
5315 | } | 5347 | } |
5316 | 5348 | ||
5317 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { | 5349 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
5318 | val = alc_read_coef_idx(codec, 0xd); | 5350 | val = alc_read_coef_idx(codec, 0xd); |
5319 | if ((val & 0x0c00) >> 10 != 0x1) { | 5351 | if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { |
5320 | /* Capless ramp up clock control */ | 5352 | /* Capless ramp up clock control */ |
5321 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); | 5353 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); |
5322 | } | 5354 | } |
5323 | val = alc_read_coef_idx(codec, 0x17); | 5355 | val = alc_read_coef_idx(codec, 0x17); |
5324 | if ((val & 0x01c0) >> 6 != 0x4) { | 5356 | if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { |
5325 | /* Class D power on reset */ | 5357 | /* Class D power on reset */ |
5326 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); | 5358 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); |
5327 | } | 5359 | } |
5328 | } | 5360 | } |
5329 | 5361 | ||
5330 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ | 5362 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ |
5331 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); | 5363 | if (val != -1) |
5364 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); | ||
5332 | 5365 | ||
5333 | val = alc_read_coef_idx(codec, 0x4); /* HP */ | 5366 | val = alc_read_coef_idx(codec, 0x4); /* HP */ |
5334 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); | 5367 | if (val != -1) |
5368 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); | ||
5335 | } | 5369 | } |
5336 | 5370 | ||
5337 | /* | 5371 | /* |
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/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/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index c28508da34cf..6a6b2ff7d7d7 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 | { |
@@ -738,7 +746,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
738 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", | 746 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", |
739 | mcasp->sysclk_freq, div, bclk_freq); | 747 | mcasp->sysclk_freq, div, bclk_freq); |
740 | } | 748 | } |
741 | davinci_mcasp_set_clkdiv(cpu_dai, 1, div); | 749 | __davinci_mcasp_set_clkdiv(cpu_dai, 1, div, 0); |
742 | } | 750 | } |
743 | 751 | ||
744 | ret = mcasp_common_hw_param(mcasp, substream->stream, | 752 | ret = mcasp_common_hw_param(mcasp, substream->stream, |
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/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/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/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/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..5a0e95edf4df 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.h +++ b/tools/usb/usbip/libsrc/usbip_common.h | |||
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/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 | { |