diff options
388 files changed, 3348 insertions, 3427 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index c75e5d6b8fa8..a6eb7dcd4dd5 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -12,7 +12,7 @@ DOCBOOKS := z8530book.xml \ | |||
12 | kernel-api.xml filesystems.xml lsm.xml kgdb.xml \ | 12 | kernel-api.xml filesystems.xml lsm.xml kgdb.xml \ |
13 | gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ | 13 | gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ |
14 | genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ | 14 | genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ |
15 | 80211.xml sh.xml regulator.xml w1.xml \ | 15 | sh.xml regulator.xml w1.xml \ |
16 | writing_musb_glue_layer.xml iio.xml | 16 | writing_musb_glue_layer.xml iio.xml |
17 | 17 | ||
18 | ifeq ($(DOCBOOKS),) | 18 | ifeq ($(DOCBOOKS),) |
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 21e2d8863705..be7c0d9506b1 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
@@ -106,6 +106,16 @@ | |||
106 | use by PCI | 106 | use by PCI |
107 | Format: <irq>,<irq>... | 107 | Format: <irq>,<irq>... |
108 | 108 | ||
109 | acpi_mask_gpe= [HW,ACPI] | ||
110 | Due to the existence of _Lxx/_Exx, some GPEs triggered | ||
111 | by unsupported hardware/firmware features can result in | ||
112 | GPE floodings that cannot be automatically disabled by | ||
113 | the GPE dispatcher. | ||
114 | This facility can be used to prevent such uncontrolled | ||
115 | GPE floodings. | ||
116 | Format: <int> | ||
117 | Support masking of GPEs numbered from 0x00 to 0x7f. | ||
118 | |||
109 | acpi_no_auto_serialize [HW,ACPI] | 119 | acpi_no_auto_serialize [HW,ACPI] |
110 | Disable auto-serialization of AML methods | 120 | Disable auto-serialization of AML methods |
111 | AML control methods that contain the opcodes to create | 121 | AML control methods that contain the opcodes to create |
@@ -3811,10 +3821,11 @@ | |||
3811 | it if 0 is given (See Documentation/cgroup-v1/memory.txt) | 3821 | it if 0 is given (See Documentation/cgroup-v1/memory.txt) |
3812 | 3822 | ||
3813 | swiotlb= [ARM,IA-64,PPC,MIPS,X86] | 3823 | swiotlb= [ARM,IA-64,PPC,MIPS,X86] |
3814 | Format: { <int> | force } | 3824 | Format: { <int> | force | noforce } |
3815 | <int> -- Number of I/O TLB slabs | 3825 | <int> -- Number of I/O TLB slabs |
3816 | force -- force using of bounce buffers even if they | 3826 | force -- force using of bounce buffers even if they |
3817 | wouldn't be automatically used by the kernel | 3827 | wouldn't be automatically used by the kernel |
3828 | noforce -- Never use bounce buffers (for debugging) | ||
3818 | 3829 | ||
3819 | switches= [HW,M68k] | 3830 | switches= [HW,M68k] |
3820 | 3831 | ||
diff --git a/Documentation/arm/sunxi/README b/Documentation/arm/sunxi/README index cd0243302bc1..d7b1f016bd62 100644 --- a/Documentation/arm/sunxi/README +++ b/Documentation/arm/sunxi/README | |||
@@ -63,10 +63,18 @@ SunXi family | |||
63 | + User Manual | 63 | + User Manual |
64 | http://dl.linux-sunxi.org/A33/A33%20user%20manual%20release%201.1.pdf | 64 | http://dl.linux-sunxi.org/A33/A33%20user%20manual%20release%201.1.pdf |
65 | 65 | ||
66 | - Allwinner H2+ (sun8i) | ||
67 | + No document available now, but is known to be working properly with | ||
68 | H3 drivers and memory map. | ||
69 | |||
66 | - Allwinner H3 (sun8i) | 70 | - Allwinner H3 (sun8i) |
67 | + Datasheet | 71 | + Datasheet |
68 | http://dl.linux-sunxi.org/H3/Allwinner_H3_Datasheet_V1.0.pdf | 72 | http://dl.linux-sunxi.org/H3/Allwinner_H3_Datasheet_V1.0.pdf |
69 | 73 | ||
74 | - Allwinner V3s (sun8i) | ||
75 | + Datasheet | ||
76 | http://linux-sunxi.org/File:Allwinner_V3s_Datasheet_V1.0.pdf | ||
77 | |||
70 | * Quad ARM Cortex-A15, Quad ARM Cortex-A7 based SoCs | 78 | * Quad ARM Cortex-A15, Quad ARM Cortex-A7 based SoCs |
71 | - Allwinner A80 | 79 | - Allwinner A80 |
72 | + Datasheet | 80 | + Datasheet |
diff --git a/Documentation/block/queue-sysfs.txt b/Documentation/block/queue-sysfs.txt index 51642159aedb..c0a3bb5a6e4e 100644 --- a/Documentation/block/queue-sysfs.txt +++ b/Documentation/block/queue-sysfs.txt | |||
@@ -54,9 +54,9 @@ This is the hardware sector size of the device, in bytes. | |||
54 | 54 | ||
55 | io_poll (RW) | 55 | io_poll (RW) |
56 | ------------ | 56 | ------------ |
57 | When read, this file shows the total number of block IO polls and how | 57 | When read, this file shows whether polling is enabled (1) or disabled |
58 | many returned success. Writing '0' to this file will disable polling | 58 | (0). Writing '0' to this file will disable polling for this device. |
59 | for this device. Writing any non-zero value will enable this feature. | 59 | Writing any non-zero value will enable this feature. |
60 | 60 | ||
61 | io_poll_delay (RW) | 61 | io_poll_delay (RW) |
62 | ------------------ | 62 | ------------------ |
diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt index a1bcfeed5f24..3c2fd72d0bf9 100644 --- a/Documentation/devicetree/bindings/arm/cpus.txt +++ b/Documentation/devicetree/bindings/arm/cpus.txt | |||
@@ -202,6 +202,7 @@ nodes to be present and contain the properties described below. | |||
202 | "marvell,armada-380-smp" | 202 | "marvell,armada-380-smp" |
203 | "marvell,armada-390-smp" | 203 | "marvell,armada-390-smp" |
204 | "marvell,armada-xp-smp" | 204 | "marvell,armada-xp-smp" |
205 | "marvell,98dx3236-smp" | ||
205 | "mediatek,mt6589-smp" | 206 | "mediatek,mt6589-smp" |
206 | "mediatek,mt81xx-tz-smp" | 207 | "mediatek,mt81xx-tz-smp" |
207 | "qcom,gcc-msm8660" | 208 | "qcom,gcc-msm8660" |
diff --git a/Documentation/devicetree/bindings/arm/marvell/98dx3236-resume-ctrl.txt b/Documentation/devicetree/bindings/arm/marvell/98dx3236-resume-ctrl.txt new file mode 100644 index 000000000000..26eb9d3aa630 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/marvell/98dx3236-resume-ctrl.txt | |||
@@ -0,0 +1,16 @@ | |||
1 | Resume Control | ||
2 | -------------- | ||
3 | Available on Marvell SOCs: 98DX3336 and 98DX4251 | ||
4 | |||
5 | Required properties: | ||
6 | |||
7 | - compatible: must be "marvell,98dx3336-resume-ctrl" | ||
8 | |||
9 | - reg: Should contain resume control registers location and length | ||
10 | |||
11 | Example: | ||
12 | |||
13 | resume@20980 { | ||
14 | compatible = "marvell,98dx3336-resume-ctrl"; | ||
15 | reg = <0x20980 0x10>; | ||
16 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/sunxi.txt b/Documentation/devicetree/bindings/arm/sunxi.txt index 4d6467cc2aa2..d2c46449b4eb 100644 --- a/Documentation/devicetree/bindings/arm/sunxi.txt +++ b/Documentation/devicetree/bindings/arm/sunxi.txt | |||
@@ -12,6 +12,7 @@ using one of the following compatible strings: | |||
12 | allwinner,sun8i-a23 | 12 | allwinner,sun8i-a23 |
13 | allwinner,sun8i-a33 | 13 | allwinner,sun8i-a33 |
14 | allwinner,sun8i-a83t | 14 | allwinner,sun8i-a83t |
15 | allwinner,sun8i-h2-plus | ||
15 | allwinner,sun8i-h3 | 16 | allwinner,sun8i-h3 |
16 | allwinner,sun9i-a80 | 17 | allwinner,sun9i-a80 |
17 | allwinner,sun50i-a64 | 18 | allwinner,sun50i-a64 |
diff --git a/Documentation/devicetree/bindings/display/exynos/exynos7-decon.txt b/Documentation/devicetree/bindings/display/exynos/exynos7-decon.txt index 3938caacf11c..8346fb18a358 100644 --- a/Documentation/devicetree/bindings/display/exynos/exynos7-decon.txt +++ b/Documentation/devicetree/bindings/display/exynos/exynos7-decon.txt | |||
@@ -33,7 +33,7 @@ Required properties: | |||
33 | - i80-if-timings: timing configuration for lcd i80 interface support. | 33 | - i80-if-timings: timing configuration for lcd i80 interface support. |
34 | 34 | ||
35 | Optional Properties: | 35 | Optional Properties: |
36 | - samsung,power-domain: a phandle to DECON power domain node. | 36 | - power-domains: a phandle to DECON power domain node. |
37 | - display-timings: timing settings for DECON, as described in document [1]. | 37 | - display-timings: timing settings for DECON, as described in document [1]. |
38 | Can be used in case timings cannot be provided otherwise | 38 | Can be used in case timings cannot be provided otherwise |
39 | or to override timings provided by the panel. | 39 | or to override timings provided by the panel. |
diff --git a/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt b/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt index 3e5b9793341f..8682ab6d4a50 100644 --- a/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt +++ b/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt | |||
@@ -8,8 +8,9 @@ This driver provides a simple power button event via an Interrupt. | |||
8 | Required properties: | 8 | Required properties: |
9 | - compatible: should be "ti,tps65217-pwrbutton" or "ti,tps65218-pwrbutton" | 9 | - compatible: should be "ti,tps65217-pwrbutton" or "ti,tps65218-pwrbutton" |
10 | 10 | ||
11 | Required properties for TPS65218: | 11 | Required properties: |
12 | - interrupts: should be one of the following | 12 | - interrupts: should be one of the following |
13 | - <2>: For controllers compatible with tps65217 | ||
13 | - <3 IRQ_TYPE_EDGE_BOTH>: For controllers compatible with tps65218 | 14 | - <3 IRQ_TYPE_EDGE_BOTH>: For controllers compatible with tps65218 |
14 | 15 | ||
15 | Examples: | 16 | Examples: |
@@ -17,6 +18,7 @@ Examples: | |||
17 | &tps { | 18 | &tps { |
18 | tps65217-pwrbutton { | 19 | tps65217-pwrbutton { |
19 | compatible = "ti,tps65217-pwrbutton"; | 20 | compatible = "ti,tps65217-pwrbutton"; |
21 | interrupts = <2>; | ||
20 | }; | 22 | }; |
21 | }; | 23 | }; |
22 | 24 | ||
diff --git a/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt b/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt index 98d131acee95..a11072c5a866 100644 --- a/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt +++ b/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt | |||
@@ -2,11 +2,16 @@ TPS65217 Charger | |||
2 | 2 | ||
3 | Required Properties: | 3 | Required Properties: |
4 | -compatible: "ti,tps65217-charger" | 4 | -compatible: "ti,tps65217-charger" |
5 | -interrupts: TPS65217 interrupt numbers for the AC and USB charger input change. | ||
6 | Should be <0> for the USB charger and <1> for the AC adapter. | ||
7 | -interrupt-names: Should be "USB" and "AC" | ||
5 | 8 | ||
6 | This node is a subnode of the tps65217 PMIC. | 9 | This node is a subnode of the tps65217 PMIC. |
7 | 10 | ||
8 | Example: | 11 | Example: |
9 | 12 | ||
10 | tps65217-charger { | 13 | tps65217-charger { |
11 | compatible = "ti,tps65090-charger"; | 14 | compatible = "ti,tps65217-charger"; |
15 | interrupts = <0>, <1>; | ||
16 | interrupt-names = "USB", "AC"; | ||
12 | }; | 17 | }; |
diff --git a/Documentation/driver-api/infrastructure.rst b/Documentation/driver-api/infrastructure.rst index 0bb0b5fc9512..6d9ff316b608 100644 --- a/Documentation/driver-api/infrastructure.rst +++ b/Documentation/driver-api/infrastructure.rst | |||
@@ -55,21 +55,6 @@ Device Drivers DMA Management | |||
55 | .. kernel-doc:: drivers/base/dma-mapping.c | 55 | .. kernel-doc:: drivers/base/dma-mapping.c |
56 | :export: | 56 | :export: |
57 | 57 | ||
58 | Device Drivers Power Management | ||
59 | ------------------------------- | ||
60 | |||
61 | .. kernel-doc:: drivers/base/power/main.c | ||
62 | :export: | ||
63 | |||
64 | Device Drivers ACPI Support | ||
65 | --------------------------- | ||
66 | |||
67 | .. kernel-doc:: drivers/acpi/scan.c | ||
68 | :export: | ||
69 | |||
70 | .. kernel-doc:: drivers/acpi/scan.c | ||
71 | :internal: | ||
72 | |||
73 | Device drivers PnP support | 58 | Device drivers PnP support |
74 | -------------------------- | 59 | -------------------------- |
75 | 60 | ||
diff --git a/Documentation/networking/mpls-sysctl.txt b/Documentation/networking/mpls-sysctl.txt index 9ed15f86c17c..15d8d16934fd 100644 --- a/Documentation/networking/mpls-sysctl.txt +++ b/Documentation/networking/mpls-sysctl.txt | |||
@@ -5,8 +5,8 @@ platform_labels - INTEGER | |||
5 | possible to configure forwarding for label values equal to or | 5 | possible to configure forwarding for label values equal to or |
6 | greater than the number of platform labels. | 6 | greater than the number of platform labels. |
7 | 7 | ||
8 | A dense utliziation of the entries in the platform label table | 8 | A dense utilization of the entries in the platform label table |
9 | is possible and expected aas the platform labels are locally | 9 | is possible and expected as the platform labels are locally |
10 | allocated. | 10 | allocated. |
11 | 11 | ||
12 | If the number of platform label table entries is set to 0 no | 12 | If the number of platform label table entries is set to 0 no |
diff --git a/Documentation/unaligned-memory-access.txt b/Documentation/unaligned-memory-access.txt index a445da098bc6..3f76c0c37920 100644 --- a/Documentation/unaligned-memory-access.txt +++ b/Documentation/unaligned-memory-access.txt | |||
@@ -151,7 +151,7 @@ bool ether_addr_equal(const u8 *addr1, const u8 *addr2) | |||
151 | #else | 151 | #else |
152 | const u16 *a = (const u16 *)addr1; | 152 | const u16 *a = (const u16 *)addr1; |
153 | const u16 *b = (const u16 *)addr2; | 153 | const u16 *b = (const u16 *)addr2; |
154 | return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; | 154 | return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0; |
155 | #endif | 155 | #endif |
156 | } | 156 | } |
157 | 157 | ||
diff --git a/Documentation/vfio-mediated-device.txt b/Documentation/vfio-mediated-device.txt index b38afec35edc..d226c7a5ba8b 100644 --- a/Documentation/vfio-mediated-device.txt +++ b/Documentation/vfio-mediated-device.txt | |||
@@ -127,22 +127,22 @@ the VFIO when devices are unbound from the driver. | |||
127 | Physical Device Driver Interface | 127 | Physical Device Driver Interface |
128 | -------------------------------- | 128 | -------------------------------- |
129 | 129 | ||
130 | The physical device driver interface provides the parent_ops[3] structure to | 130 | The physical device driver interface provides the mdev_parent_ops[3] structure |
131 | define the APIs to manage work in the mediated core driver that is related to | 131 | to define the APIs to manage work in the mediated core driver that is related |
132 | the physical device. | 132 | to the physical device. |
133 | 133 | ||
134 | The structures in the parent_ops structure are as follows: | 134 | The structures in the mdev_parent_ops structure are as follows: |
135 | 135 | ||
136 | * dev_attr_groups: attributes of the parent device | 136 | * dev_attr_groups: attributes of the parent device |
137 | * mdev_attr_groups: attributes of the mediated device | 137 | * mdev_attr_groups: attributes of the mediated device |
138 | * supported_config: attributes to define supported configurations | 138 | * supported_config: attributes to define supported configurations |
139 | 139 | ||
140 | The functions in the parent_ops structure are as follows: | 140 | The functions in the mdev_parent_ops structure are as follows: |
141 | 141 | ||
142 | * create: allocate basic resources in a driver for a mediated device | 142 | * create: allocate basic resources in a driver for a mediated device |
143 | * remove: free resources in a driver when a mediated device is destroyed | 143 | * remove: free resources in a driver when a mediated device is destroyed |
144 | 144 | ||
145 | The callbacks in the parent_ops structure are as follows: | 145 | The callbacks in the mdev_parent_ops structure are as follows: |
146 | 146 | ||
147 | * open: open callback of mediated device | 147 | * open: open callback of mediated device |
148 | * close: close callback of mediated device | 148 | * close: close callback of mediated device |
@@ -151,14 +151,14 @@ The callbacks in the parent_ops structure are as follows: | |||
151 | * write: write emulation callback | 151 | * write: write emulation callback |
152 | * mmap: mmap emulation callback | 152 | * mmap: mmap emulation callback |
153 | 153 | ||
154 | A driver should use the parent_ops structure in the function call to register | 154 | A driver should use the mdev_parent_ops structure in the function call to |
155 | itself with the mdev core driver: | 155 | register itself with the mdev core driver: |
156 | 156 | ||
157 | extern int mdev_register_device(struct device *dev, | 157 | extern int mdev_register_device(struct device *dev, |
158 | const struct parent_ops *ops); | 158 | const struct mdev_parent_ops *ops); |
159 | 159 | ||
160 | However, the parent_ops structure is not required in the function call that a | 160 | However, the mdev_parent_ops structure is not required in the function call |
161 | driver should use to unregister itself with the mdev core driver: | 161 | that a driver should use to unregister itself with the mdev core driver: |
162 | 162 | ||
163 | extern void mdev_unregister_device(struct device *dev); | 163 | extern void mdev_unregister_device(struct device *dev); |
164 | 164 | ||
@@ -223,6 +223,9 @@ Directories and files under the sysfs for Each Physical Device | |||
223 | 223 | ||
224 | sprintf(buf, "%s-%s", dev_driver_string(parent->dev), group->name); | 224 | sprintf(buf, "%s-%s", dev_driver_string(parent->dev), group->name); |
225 | 225 | ||
226 | (or using mdev_parent_dev(mdev) to arrive at the parent device outside | ||
227 | of the core mdev code) | ||
228 | |||
226 | * device_api | 229 | * device_api |
227 | 230 | ||
228 | This attribute should show which device API is being created, for example, | 231 | This attribute should show which device API is being created, for example, |
@@ -394,5 +397,5 @@ References | |||
394 | 397 | ||
395 | [1] See Documentation/vfio.txt for more information on VFIO. | 398 | [1] See Documentation/vfio.txt for more information on VFIO. |
396 | [2] struct mdev_driver in include/linux/mdev.h | 399 | [2] struct mdev_driver in include/linux/mdev.h |
397 | [3] struct parent_ops in include/linux/mdev.h | 400 | [3] struct mdev_parent_ops in include/linux/mdev.h |
398 | [4] struct vfio_iommu_driver_ops in include/linux/vfio.h | 401 | [4] struct vfio_iommu_driver_ops in include/linux/vfio.h |
diff --git a/MAINTAINERS b/MAINTAINERS index cfff2c9e3d94..575c284c660f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1227,13 +1227,9 @@ S: Maintained | |||
1227 | N: efm32 | 1227 | N: efm32 |
1228 | 1228 | ||
1229 | ARM/EZX SMARTPHONES (A780, A910, A1200, E680, ROKR E2 and ROKR E6) | 1229 | ARM/EZX SMARTPHONES (A780, A910, A1200, E680, ROKR E2 and ROKR E6) |
1230 | M: Daniel Ribeiro <drwyrm@gmail.com> | 1230 | M: Robert Jarzmik <robert.jarzmik@free.fr> |
1231 | M: Stefan Schmidt <stefan@openezx.org> | 1231 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1232 | M: Harald Welte <laforge@openezx.org> | ||
1233 | L: openezx-devel@lists.openezx.org (moderated for non-subscribers) | ||
1234 | W: http://www.openezx.org/ | ||
1235 | S: Maintained | 1232 | S: Maintained |
1236 | T: topgit git://git.openezx.org/openezx.git | ||
1237 | F: arch/arm/mach-pxa/ezx.c | 1233 | F: arch/arm/mach-pxa/ezx.c |
1238 | 1234 | ||
1239 | ARM/FARADAY FA526 PORT | 1235 | ARM/FARADAY FA526 PORT |
@@ -2624,7 +2620,7 @@ M: Lee Jones <lee@kernel.org> | |||
2624 | M: Eric Anholt <eric@anholt.net> | 2620 | M: Eric Anholt <eric@anholt.net> |
2625 | L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) | 2621 | L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) |
2626 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 2622 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
2627 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rpi/linux-rpi.git | 2623 | T: git git://github.com/anholt/linux |
2628 | S: Maintained | 2624 | S: Maintained |
2629 | N: bcm2835 | 2625 | N: bcm2835 |
2630 | F: drivers/staging/vc04_services | 2626 | F: drivers/staging/vc04_services |
@@ -3800,6 +3796,7 @@ F: include/linux/devcoredump.h | |||
3800 | DEVICE FREQUENCY (DEVFREQ) | 3796 | DEVICE FREQUENCY (DEVFREQ) |
3801 | M: MyungJoo Ham <myungjoo.ham@samsung.com> | 3797 | M: MyungJoo Ham <myungjoo.ham@samsung.com> |
3802 | M: Kyungmin Park <kyungmin.park@samsung.com> | 3798 | M: Kyungmin Park <kyungmin.park@samsung.com> |
3799 | R: Chanwoo Choi <cw00.choi@samsung.com> | ||
3803 | L: linux-pm@vger.kernel.org | 3800 | L: linux-pm@vger.kernel.org |
3804 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq.git | 3801 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq.git |
3805 | S: Maintained | 3802 | S: Maintained |
@@ -5080,9 +5077,11 @@ F: drivers/net/wan/dlci.c | |||
5080 | F: drivers/net/wan/sdla.c | 5077 | F: drivers/net/wan/sdla.c |
5081 | 5078 | ||
5082 | FRAMEBUFFER LAYER | 5079 | FRAMEBUFFER LAYER |
5080 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | ||
5083 | L: linux-fbdev@vger.kernel.org | 5081 | L: linux-fbdev@vger.kernel.org |
5082 | T: git git://github.com/bzolnier/linux.git | ||
5084 | Q: http://patchwork.kernel.org/project/linux-fbdev/list/ | 5083 | Q: http://patchwork.kernel.org/project/linux-fbdev/list/ |
5085 | S: Orphan | 5084 | S: Maintained |
5086 | F: Documentation/fb/ | 5085 | F: Documentation/fb/ |
5087 | F: drivers/video/ | 5086 | F: drivers/video/ |
5088 | F: include/video/ | 5087 | F: include/video/ |
@@ -5504,6 +5503,7 @@ M: Alex Elder <elder@kernel.org> | |||
5504 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 5503 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
5505 | S: Maintained | 5504 | S: Maintained |
5506 | F: drivers/staging/greybus/ | 5505 | F: drivers/staging/greybus/ |
5506 | L: greybus-dev@lists.linaro.org | ||
5507 | 5507 | ||
5508 | GREYBUS AUDIO PROTOCOLS DRIVERS | 5508 | GREYBUS AUDIO PROTOCOLS DRIVERS |
5509 | M: Vaibhav Agarwal <vaibhav.sr@gmail.com> | 5509 | M: Vaibhav Agarwal <vaibhav.sr@gmail.com> |
@@ -5961,6 +5961,7 @@ F: drivers/media/platform/sti/hva | |||
5961 | Hyper-V CORE AND DRIVERS | 5961 | Hyper-V CORE AND DRIVERS |
5962 | M: "K. Y. Srinivasan" <kys@microsoft.com> | 5962 | M: "K. Y. Srinivasan" <kys@microsoft.com> |
5963 | M: Haiyang Zhang <haiyangz@microsoft.com> | 5963 | M: Haiyang Zhang <haiyangz@microsoft.com> |
5964 | M: Stephen Hemminger <sthemmin@microsoft.com> | ||
5964 | L: devel@linuxdriverproject.org | 5965 | L: devel@linuxdriverproject.org |
5965 | S: Maintained | 5966 | S: Maintained |
5966 | F: arch/x86/include/asm/mshyperv.h | 5967 | F: arch/x86/include/asm/mshyperv.h |
@@ -8852,17 +8853,22 @@ F: drivers/video/fbdev/nvidia/ | |||
8852 | NVM EXPRESS DRIVER | 8853 | NVM EXPRESS DRIVER |
8853 | M: Keith Busch <keith.busch@intel.com> | 8854 | M: Keith Busch <keith.busch@intel.com> |
8854 | M: Jens Axboe <axboe@fb.com> | 8855 | M: Jens Axboe <axboe@fb.com> |
8856 | M: Christoph Hellwig <hch@lst.de> | ||
8857 | M: Sagi Grimberg <sagi@grimberg.me> | ||
8855 | L: linux-nvme@lists.infradead.org | 8858 | L: linux-nvme@lists.infradead.org |
8856 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git | 8859 | T: git://git.infradead.org/nvme.git |
8857 | W: https://kernel.googlesource.com/pub/scm/linux/kernel/git/axboe/linux-block/ | 8860 | W: http://git.infradead.org/nvme.git |
8858 | S: Supported | 8861 | S: Supported |
8859 | F: drivers/nvme/host/ | 8862 | F: drivers/nvme/host/ |
8860 | F: include/linux/nvme.h | 8863 | F: include/linux/nvme.h |
8864 | F: include/uapi/linux/nvme_ioctl.h | ||
8861 | 8865 | ||
8862 | NVM EXPRESS TARGET DRIVER | 8866 | NVM EXPRESS TARGET DRIVER |
8863 | M: Christoph Hellwig <hch@lst.de> | 8867 | M: Christoph Hellwig <hch@lst.de> |
8864 | M: Sagi Grimberg <sagi@grimberg.me> | 8868 | M: Sagi Grimberg <sagi@grimberg.me> |
8865 | L: linux-nvme@lists.infradead.org | 8869 | L: linux-nvme@lists.infradead.org |
8870 | T: git://git.infradead.org/nvme.git | ||
8871 | W: http://git.infradead.org/nvme.git | ||
8866 | S: Supported | 8872 | S: Supported |
8867 | F: drivers/nvme/target/ | 8873 | F: drivers/nvme/target/ |
8868 | 8874 | ||
@@ -8909,7 +8915,20 @@ M: Josh Poimboeuf <jpoimboe@redhat.com> | |||
8909 | S: Supported | 8915 | S: Supported |
8910 | F: tools/objtool/ | 8916 | F: tools/objtool/ |
8911 | 8917 | ||
8912 | OMAP SUPPORT | 8918 | OMAP1 SUPPORT |
8919 | M: Aaro Koskinen <aaro.koskinen@iki.fi> | ||
8920 | M: Tony Lindgren <tony@atomide.com> | ||
8921 | L: linux-omap@vger.kernel.org | ||
8922 | Q: http://patchwork.kernel.org/project/linux-omap/list/ | ||
8923 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git | ||
8924 | S: Maintained | ||
8925 | F: arch/arm/mach-omap1/ | ||
8926 | F: arch/arm/plat-omap/ | ||
8927 | F: arch/arm/configs/omap1_defconfig | ||
8928 | F: drivers/i2c/busses/i2c-omap.c | ||
8929 | F: include/linux/i2c-omap.h | ||
8930 | |||
8931 | OMAP2+ SUPPORT | ||
8913 | M: Tony Lindgren <tony@atomide.com> | 8932 | M: Tony Lindgren <tony@atomide.com> |
8914 | L: linux-omap@vger.kernel.org | 8933 | L: linux-omap@vger.kernel.org |
8915 | W: http://www.muru.com/linux/omap/ | 8934 | W: http://www.muru.com/linux/omap/ |
@@ -8917,8 +8936,8 @@ W: http://linux.omap.com/ | |||
8917 | Q: http://patchwork.kernel.org/project/linux-omap/list/ | 8936 | Q: http://patchwork.kernel.org/project/linux-omap/list/ |
8918 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git | 8937 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git |
8919 | S: Maintained | 8938 | S: Maintained |
8920 | F: arch/arm/*omap*/ | 8939 | F: arch/arm/mach-omap2/ |
8921 | F: arch/arm/configs/omap1_defconfig | 8940 | F: arch/arm/plat-omap/ |
8922 | F: arch/arm/configs/omap2plus_defconfig | 8941 | F: arch/arm/configs/omap2plus_defconfig |
8923 | F: drivers/i2c/busses/i2c-omap.c | 8942 | F: drivers/i2c/busses/i2c-omap.c |
8924 | F: drivers/irqchip/irq-omap-intc.c | 8943 | F: drivers/irqchip/irq-omap-intc.c |
@@ -9842,7 +9861,7 @@ M: Mark Rutland <mark.rutland@arm.com> | |||
9842 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 9861 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
9843 | L: linux-arm-kernel@lists.infradead.org | 9862 | L: linux-arm-kernel@lists.infradead.org |
9844 | S: Maintained | 9863 | S: Maintained |
9845 | F: drivers/firmware/psci.c | 9864 | F: drivers/firmware/psci*.c |
9846 | F: include/linux/psci.h | 9865 | F: include/linux/psci.h |
9847 | F: include/uapi/linux/psci.h | 9866 | F: include/uapi/linux/psci.h |
9848 | 9867 | ||
@@ -13527,11 +13546,11 @@ F: arch/x86/xen/*swiotlb* | |||
13527 | F: drivers/xen/*swiotlb* | 13546 | F: drivers/xen/*swiotlb* |
13528 | 13547 | ||
13529 | XFS FILESYSTEM | 13548 | XFS FILESYSTEM |
13530 | M: Dave Chinner <david@fromorbit.com> | 13549 | M: Darrick J. Wong <darrick.wong@oracle.com> |
13531 | M: linux-xfs@vger.kernel.org | 13550 | M: linux-xfs@vger.kernel.org |
13532 | L: linux-xfs@vger.kernel.org | 13551 | L: linux-xfs@vger.kernel.org |
13533 | W: http://xfs.org/ | 13552 | W: http://xfs.org/ |
13534 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git | 13553 | T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git |
13535 | S: Supported | 13554 | S: Supported |
13536 | F: Documentation/filesystems/xfs.txt | 13555 | F: Documentation/filesystems/xfs.txt |
13537 | F: fs/xfs/ | 13556 | F: fs/xfs/ |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 10 | 2 | PATCHLEVEL = 10 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc3 |
5 | NAME = Roaring Lionus | 5 | NAME = Roaring Lionus |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5fab553fd03a..186c4c214e0a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1502,8 +1502,7 @@ source kernel/Kconfig.preempt | |||
1502 | 1502 | ||
1503 | config HZ_FIXED | 1503 | config HZ_FIXED |
1504 | int | 1504 | int |
1505 | default 200 if ARCH_EBSA110 || ARCH_S3C24XX || \ | 1505 | default 200 if ARCH_EBSA110 |
1506 | ARCH_S5PV210 || ARCH_EXYNOS4 | ||
1507 | default 128 if SOC_AT91RM9200 | 1506 | default 128 if SOC_AT91RM9200 |
1508 | default 0 | 1507 | default 0 |
1509 | 1508 | ||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index cccdbcb557b6..7327250f0bb6 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -501,6 +501,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \ | |||
501 | am3517-evm.dtb \ | 501 | am3517-evm.dtb \ |
502 | am3517_mt_ventoux.dtb \ | 502 | am3517_mt_ventoux.dtb \ |
503 | logicpd-torpedo-37xx-devkit.dtb \ | 503 | logicpd-torpedo-37xx-devkit.dtb \ |
504 | logicpd-som-lv-37xx-devkit.dtb \ | ||
504 | omap3430-sdp.dtb \ | 505 | omap3430-sdp.dtb \ |
505 | omap3-beagle.dtb \ | 506 | omap3-beagle.dtb \ |
506 | omap3-beagle-xm.dtb \ | 507 | omap3-beagle-xm.dtb \ |
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi index dc561d505bbe..3e32dd18fd25 100644 --- a/arch/arm/boot/dts/am335x-bone-common.dtsi +++ b/arch/arm/boot/dts/am335x-bone-common.dtsi | |||
@@ -6,8 +6,6 @@ | |||
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <dt-bindings/mfd/tps65217.h> | ||
10 | |||
11 | / { | 9 | / { |
12 | cpus { | 10 | cpus { |
13 | cpu@0 { | 11 | cpu@0 { |
@@ -319,13 +317,13 @@ | |||
319 | ti,pmic-shutdown-controller; | 317 | ti,pmic-shutdown-controller; |
320 | 318 | ||
321 | charger { | 319 | charger { |
322 | interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>; | 320 | interrupts = <0>, <1>; |
323 | interrupts-names = "AC", "USB"; | 321 | interrupt-names = "USB", "AC"; |
324 | status = "okay"; | 322 | status = "okay"; |
325 | }; | 323 | }; |
326 | 324 | ||
327 | pwrbutton { | 325 | pwrbutton { |
328 | interrupts = <TPS65217_IRQ_PB>; | 326 | interrupts = <2>; |
329 | status = "okay"; | 327 | status = "okay"; |
330 | }; | 328 | }; |
331 | 329 | ||
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 64c8aa9057a3..18d72a245e88 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi | |||
@@ -16,6 +16,7 @@ | |||
16 | interrupt-parent = <&intc>; | 16 | interrupt-parent = <&intc>; |
17 | #address-cells = <1>; | 17 | #address-cells = <1>; |
18 | #size-cells = <1>; | 18 | #size-cells = <1>; |
19 | chosen { }; | ||
19 | 20 | ||
20 | aliases { | 21 | aliases { |
21 | i2c0 = &i2c0; | 22 | i2c0 = &i2c0; |
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi index ac55f93fc91e..2df9e6050c2f 100644 --- a/arch/arm/boot/dts/am4372.dtsi +++ b/arch/arm/boot/dts/am4372.dtsi | |||
@@ -16,6 +16,7 @@ | |||
16 | interrupt-parent = <&wakeupgen>; | 16 | interrupt-parent = <&wakeupgen>; |
17 | #address-cells = <1>; | 17 | #address-cells = <1>; |
18 | #size-cells = <1>; | 18 | #size-cells = <1>; |
19 | chosen { }; | ||
19 | 20 | ||
20 | memory@0 { | 21 | memory@0 { |
21 | device_type = "memory"; | 22 | device_type = "memory"; |
diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts index d6e43e5184c1..ad68d1eb3bc3 100644 --- a/arch/arm/boot/dts/am571x-idk.dts +++ b/arch/arm/boot/dts/am571x-idk.dts | |||
@@ -62,11 +62,6 @@ | |||
62 | linux,default-trigger = "mmc0"; | 62 | linux,default-trigger = "mmc0"; |
63 | }; | 63 | }; |
64 | }; | 64 | }; |
65 | |||
66 | extcon_usb2: extcon_usb2 { | ||
67 | compatible = "linux,extcon-usb-gpio"; | ||
68 | id-gpio = <&gpio5 7 GPIO_ACTIVE_HIGH>; | ||
69 | }; | ||
70 | }; | 65 | }; |
71 | 66 | ||
72 | &mmc1 { | 67 | &mmc1 { |
@@ -79,3 +74,8 @@ | |||
79 | &omap_dwc3_2 { | 74 | &omap_dwc3_2 { |
80 | extcon = <&extcon_usb2>; | 75 | extcon = <&extcon_usb2>; |
81 | }; | 76 | }; |
77 | |||
78 | &extcon_usb2 { | ||
79 | id-gpio = <&gpio5 7 GPIO_ACTIVE_HIGH>; | ||
80 | vbus-gpio = <&gpio7 22 GPIO_ACTIVE_HIGH>; | ||
81 | }; | ||
diff --git a/arch/arm/boot/dts/am572x-idk.dts b/arch/arm/boot/dts/am572x-idk.dts index 27d9149cedba..8350b4b34b08 100644 --- a/arch/arm/boot/dts/am572x-idk.dts +++ b/arch/arm/boot/dts/am572x-idk.dts | |||
@@ -23,11 +23,6 @@ | |||
23 | reg = <0x0 0x80000000 0x0 0x80000000>; | 23 | reg = <0x0 0x80000000 0x0 0x80000000>; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | extcon_usb2: extcon_usb2 { | ||
27 | compatible = "linux,extcon-usb-gpio"; | ||
28 | id-gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>; | ||
29 | }; | ||
30 | |||
31 | status-leds { | 26 | status-leds { |
32 | compatible = "gpio-leds"; | 27 | compatible = "gpio-leds"; |
33 | cpu0-led { | 28 | cpu0-led { |
@@ -76,6 +71,11 @@ | |||
76 | extcon = <&extcon_usb2>; | 71 | extcon = <&extcon_usb2>; |
77 | }; | 72 | }; |
78 | 73 | ||
74 | &extcon_usb2 { | ||
75 | id-gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>; | ||
76 | vbus-gpio = <&gpio3 26 GPIO_ACTIVE_HIGH>; | ||
77 | }; | ||
78 | |||
79 | &mmc1 { | 79 | &mmc1 { |
80 | status = "okay"; | 80 | status = "okay"; |
81 | vmmc-supply = <&v3_3d>; | 81 | vmmc-supply = <&v3_3d>; |
@@ -87,3 +87,7 @@ | |||
87 | &sn65hvs882 { | 87 | &sn65hvs882 { |
88 | load-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>; | 88 | load-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>; |
89 | }; | 89 | }; |
90 | |||
91 | &pcie1 { | ||
92 | gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; | ||
93 | }; | ||
diff --git a/arch/arm/boot/dts/am57xx-idk-common.dtsi b/arch/arm/boot/dts/am57xx-idk-common.dtsi index 555ae21f2b9a..814a720d5c3d 100644 --- a/arch/arm/boot/dts/am57xx-idk-common.dtsi +++ b/arch/arm/boot/dts/am57xx-idk-common.dtsi | |||
@@ -303,6 +303,13 @@ | |||
303 | gpio-controller; | 303 | gpio-controller; |
304 | #gpio-cells = <2>; | 304 | #gpio-cells = <2>; |
305 | }; | 305 | }; |
306 | |||
307 | extcon_usb2: tps659038_usb { | ||
308 | compatible = "ti,palmas-usb-vid"; | ||
309 | ti,enable-vbus-detection; | ||
310 | ti,enable-id-detection; | ||
311 | /* ID & VBUS GPIOs provided in board dts */ | ||
312 | }; | ||
306 | }; | 313 | }; |
307 | }; | 314 | }; |
308 | 315 | ||
@@ -369,7 +376,7 @@ | |||
369 | }; | 376 | }; |
370 | 377 | ||
371 | &usb2 { | 378 | &usb2 { |
372 | dr_mode = "otg"; | 379 | dr_mode = "peripheral"; |
373 | }; | 380 | }; |
374 | 381 | ||
375 | &mmc2 { | 382 | &mmc2 { |
diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi index 1facc5f12cef..81b8cecb5820 100644 --- a/arch/arm/boot/dts/dm814x.dtsi +++ b/arch/arm/boot/dts/dm814x.dtsi | |||
@@ -12,6 +12,7 @@ | |||
12 | interrupt-parent = <&intc>; | 12 | interrupt-parent = <&intc>; |
13 | #address-cells = <1>; | 13 | #address-cells = <1>; |
14 | #size-cells = <1>; | 14 | #size-cells = <1>; |
15 | chosen { }; | ||
15 | 16 | ||
16 | aliases { | 17 | aliases { |
17 | i2c0 = &i2c1; | 18 | i2c0 = &i2c1; |
diff --git a/arch/arm/boot/dts/dm816x.dtsi b/arch/arm/boot/dts/dm816x.dtsi index 61dd2f6b02bc..6db652ae9bd5 100644 --- a/arch/arm/boot/dts/dm816x.dtsi +++ b/arch/arm/boot/dts/dm816x.dtsi | |||
@@ -12,6 +12,7 @@ | |||
12 | interrupt-parent = <&intc>; | 12 | interrupt-parent = <&intc>; |
13 | #address-cells = <1>; | 13 | #address-cells = <1>; |
14 | #size-cells = <1>; | 14 | #size-cells = <1>; |
15 | chosen { }; | ||
15 | 16 | ||
16 | aliases { | 17 | aliases { |
17 | i2c0 = &i2c1; | 18 | i2c0 = &i2c1; |
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index addb7530cfbe..1faf24acd521 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | compatible = "ti,dra7xx"; | 19 | compatible = "ti,dra7xx"; |
20 | interrupt-parent = <&crossbar_mpu>; | 20 | interrupt-parent = <&crossbar_mpu>; |
21 | chosen { }; | ||
21 | 22 | ||
22 | aliases { | 23 | aliases { |
23 | i2c0 = &i2c1; | 24 | i2c0 = &i2c1; |
diff --git a/arch/arm/boot/dts/dra72-evm-tps65917.dtsi b/arch/arm/boot/dts/dra72-evm-tps65917.dtsi index ee6dac44edf1..e6df676886c0 100644 --- a/arch/arm/boot/dts/dra72-evm-tps65917.dtsi +++ b/arch/arm/boot/dts/dra72-evm-tps65917.dtsi | |||
@@ -132,3 +132,19 @@ | |||
132 | ti,palmas-long-press-seconds = <6>; | 132 | ti,palmas-long-press-seconds = <6>; |
133 | }; | 133 | }; |
134 | }; | 134 | }; |
135 | |||
136 | &usb2_phy1 { | ||
137 | phy-supply = <&ldo4_reg>; | ||
138 | }; | ||
139 | |||
140 | &usb2_phy2 { | ||
141 | phy-supply = <&ldo4_reg>; | ||
142 | }; | ||
143 | |||
144 | &dss { | ||
145 | vdda_video-supply = <&ldo5_reg>; | ||
146 | }; | ||
147 | |||
148 | &mmc1 { | ||
149 | vmmc_aux-supply = <&ldo1_reg>; | ||
150 | }; | ||
diff --git a/arch/arm/boot/dts/imx31.dtsi b/arch/arm/boot/dts/imx31.dtsi index 685916e3d8a1..85cd8be22f71 100644 --- a/arch/arm/boot/dts/imx31.dtsi +++ b/arch/arm/boot/dts/imx31.dtsi | |||
@@ -31,11 +31,11 @@ | |||
31 | }; | 31 | }; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | avic: avic-interrupt-controller@60000000 { | 34 | avic: interrupt-controller@68000000 { |
35 | compatible = "fsl,imx31-avic", "fsl,avic"; | 35 | compatible = "fsl,imx31-avic", "fsl,avic"; |
36 | interrupt-controller; | 36 | interrupt-controller; |
37 | #interrupt-cells = <1>; | 37 | #interrupt-cells = <1>; |
38 | reg = <0x60000000 0x100000>; | 38 | reg = <0x68000000 0x100000>; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | soc { | 41 | soc { |
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi index e476d01959ea..26d060484728 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | |||
@@ -533,7 +533,6 @@ | |||
533 | MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17071 | 533 | MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17071 |
534 | MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17071 | 534 | MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17071 |
535 | MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17071 | 535 | MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17071 |
536 | MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x000b0 | ||
537 | >; | 536 | >; |
538 | }; | 537 | }; |
539 | 538 | ||
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index 53e6e63cbb02..89b834f3fa17 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi | |||
@@ -1100,6 +1100,7 @@ | |||
1100 | interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; | 1100 | interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; |
1101 | clocks = <&clks IMX6QDL_CLK_EIM_SLOW>; | 1101 | clocks = <&clks IMX6QDL_CLK_EIM_SLOW>; |
1102 | fsl,weim-cs-gpr = <&gpr>; | 1102 | fsl,weim-cs-gpr = <&gpr>; |
1103 | status = "disabled"; | ||
1103 | }; | 1104 | }; |
1104 | 1105 | ||
1105 | ocotp: ocotp@021bc000 { | 1106 | ocotp: ocotp@021bc000 { |
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 4fd6de29f07d..19cbd879c448 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi | |||
@@ -900,6 +900,7 @@ | |||
900 | reg = <0x021b8000 0x4000>; | 900 | reg = <0x021b8000 0x4000>; |
901 | interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; | 901 | interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; |
902 | fsl,weim-cs-gpr = <&gpr>; | 902 | fsl,weim-cs-gpr = <&gpr>; |
903 | status = "disabled"; | ||
903 | }; | 904 | }; |
904 | 905 | ||
905 | ocotp: ocotp@021bc000 { | 906 | ocotp: ocotp@021bc000 { |
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi index 076a30f9bcae..10f333016197 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi | |||
@@ -977,6 +977,7 @@ | |||
977 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; | 977 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; |
978 | clocks = <&clks IMX6SX_CLK_EIM_SLOW>; | 978 | clocks = <&clks IMX6SX_CLK_EIM_SLOW>; |
979 | fsl,weim-cs-gpr = <&gpr>; | 979 | fsl,weim-cs-gpr = <&gpr>; |
980 | status = "disabled"; | ||
980 | }; | 981 | }; |
981 | 982 | ||
982 | ocotp: ocotp@021bc000 { | 983 | ocotp: ocotp@021bc000 { |
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi index 4f793a025a72..f1d6de8b3c19 100644 --- a/arch/arm/boot/dts/omap2.dtsi +++ b/arch/arm/boot/dts/omap2.dtsi | |||
@@ -17,6 +17,7 @@ | |||
17 | interrupt-parent = <&intc>; | 17 | interrupt-parent = <&intc>; |
18 | #address-cells = <1>; | 18 | #address-cells = <1>; |
19 | #size-cells = <1>; | 19 | #size-cells = <1>; |
20 | chosen { }; | ||
20 | 21 | ||
21 | aliases { | 22 | aliases { |
22 | serial0 = &uart1; | 23 | serial0 = &uart1; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 87ca50b53002..4d448f145ed1 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -734,6 +734,8 @@ | |||
734 | vmmc_aux-supply = <&vsim>; | 734 | vmmc_aux-supply = <&vsim>; |
735 | bus-width = <8>; | 735 | bus-width = <8>; |
736 | non-removable; | 736 | non-removable; |
737 | no-sdio; | ||
738 | no-sd; | ||
737 | }; | 739 | }; |
738 | 740 | ||
739 | &mmc3 { | 741 | &mmc3 { |
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index ecf5eb584c75..a3ff4933dbc1 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi | |||
@@ -17,6 +17,7 @@ | |||
17 | interrupt-parent = <&intc>; | 17 | interrupt-parent = <&intc>; |
18 | #address-cells = <1>; | 18 | #address-cells = <1>; |
19 | #size-cells = <1>; | 19 | #size-cells = <1>; |
20 | chosen { }; | ||
20 | 21 | ||
21 | aliases { | 22 | aliases { |
22 | i2c0 = &i2c1; | 23 | i2c0 = &i2c1; |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 8087456b5fbe..578c53f08309 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
@@ -15,6 +15,7 @@ | |||
15 | interrupt-parent = <&wakeupgen>; | 15 | interrupt-parent = <&wakeupgen>; |
16 | #address-cells = <1>; | 16 | #address-cells = <1>; |
17 | #size-cells = <1>; | 17 | #size-cells = <1>; |
18 | chosen { }; | ||
18 | 19 | ||
19 | aliases { | 20 | aliases { |
20 | i2c0 = &i2c1; | 21 | i2c0 = &i2c1; |
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 968c67a49dbd..7cd92babc41a 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | compatible = "ti,omap5"; | 18 | compatible = "ti,omap5"; |
19 | interrupt-parent = <&wakeupgen>; | 19 | interrupt-parent = <&wakeupgen>; |
20 | chosen { }; | ||
20 | 21 | ||
21 | aliases { | 22 | aliases { |
22 | i2c0 = &i2c1; | 23 | i2c0 = &i2c1; |
diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi index 268bd470c865..407a4610f4a7 100644 --- a/arch/arm/boot/dts/qcom-apq8064.dtsi +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <dt-bindings/clock/qcom,gcc-msm8960.h> | 4 | #include <dt-bindings/clock/qcom,gcc-msm8960.h> |
5 | #include <dt-bindings/reset/qcom,gcc-msm8960.h> | 5 | #include <dt-bindings/reset/qcom,gcc-msm8960.h> |
6 | #include <dt-bindings/clock/qcom,mmcc-msm8960.h> | 6 | #include <dt-bindings/clock/qcom,mmcc-msm8960.h> |
7 | #include <dt-bindings/clock/qcom,rpmcc.h> | ||
7 | #include <dt-bindings/soc/qcom,gsbi.h> | 8 | #include <dt-bindings/soc/qcom,gsbi.h> |
8 | #include <dt-bindings/interrupt-controller/irq.h> | 9 | #include <dt-bindings/interrupt-controller/irq.h> |
9 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 10 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
@@ -303,6 +304,9 @@ | |||
303 | firmware { | 304 | firmware { |
304 | scm { | 305 | scm { |
305 | compatible = "qcom,scm-apq8064"; | 306 | compatible = "qcom,scm-apq8064"; |
307 | |||
308 | clocks = <&rpmcc RPM_DAYTONA_FABRIC_CLK>; | ||
309 | clock-names = "core"; | ||
306 | }; | 310 | }; |
307 | }; | 311 | }; |
308 | 312 | ||
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts index 102838fcc588..15f4fd3f4695 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts | |||
@@ -81,7 +81,7 @@ | |||
81 | #address-cells = <0>; | 81 | #address-cells = <0>; |
82 | interrupt-controller; | 82 | interrupt-controller; |
83 | reg = <0 0x2c001000 0 0x1000>, | 83 | reg = <0 0x2c001000 0 0x1000>, |
84 | <0 0x2c002000 0 0x1000>, | 84 | <0 0x2c002000 0 0x2000>, |
85 | <0 0x2c004000 0 0x2000>, | 85 | <0 0x2c004000 0 0x2000>, |
86 | <0 0x2c006000 0 0x2000>; | 86 | <0 0x2c006000 0 0x2000>; |
87 | interrupts = <1 9 0xf04>; | 87 | interrupts = <1 9 0xf04>; |
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index 45d08cc37b01..bd107c5a0226 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | |||
@@ -131,7 +131,7 @@ | |||
131 | #address-cells = <0>; | 131 | #address-cells = <0>; |
132 | interrupt-controller; | 132 | interrupt-controller; |
133 | reg = <0 0x2c001000 0 0x1000>, | 133 | reg = <0 0x2c001000 0 0x1000>, |
134 | <0 0x2c002000 0 0x1000>, | 134 | <0 0x2c002000 0 0x2000>, |
135 | <0 0x2c004000 0 0x2000>, | 135 | <0 0x2c004000 0 0x2000>, |
136 | <0 0x2c006000 0 0x2000>; | 136 | <0 0x2c006000 0 0x2000>; |
137 | interrupts = <1 9 0xf04>; | 137 | interrupts = <1 9 0xf04>; |
diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts index 7ea617e47fe4..958b4c42d320 100644 --- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts +++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | |||
@@ -153,7 +153,8 @@ | |||
153 | switch0phy1: switch1phy0@1 { | 153 | switch0phy1: switch1phy0@1 { |
154 | reg = <1>; | 154 | reg = <1>; |
155 | interrupt-parent = <&switch0>; | 155 | interrupt-parent = <&switch0>; |
156 | interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; }; | 156 | interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; |
157 | }; | ||
157 | switch0phy2: switch1phy0@2 { | 158 | switch0phy2: switch1phy0@2 { |
158 | reg = <2>; | 159 | reg = <2>; |
159 | interrupt-parent = <&switch0>; | 160 | interrupt-parent = <&switch0>; |
diff --git a/arch/arm/mach-aspeed/Kconfig b/arch/arm/mach-aspeed/Kconfig index 5225fbcb250d..f3f8c5c658db 100644 --- a/arch/arm/mach-aspeed/Kconfig +++ b/arch/arm/mach-aspeed/Kconfig | |||
@@ -5,6 +5,8 @@ menuconfig ARCH_ASPEED | |||
5 | select WATCHDOG | 5 | select WATCHDOG |
6 | select ASPEED_WATCHDOG | 6 | select ASPEED_WATCHDOG |
7 | select MOXART_TIMER | 7 | select MOXART_TIMER |
8 | select MFD_SYSCON | ||
9 | select PINCTRL | ||
8 | help | 10 | help |
9 | Say Y here if you want to run your kernel on an ASpeed BMC SoC. | 11 | Say Y here if you want to run your kernel on an ASpeed BMC SoC. |
10 | 12 | ||
@@ -14,6 +16,7 @@ config MACH_ASPEED_G4 | |||
14 | bool "Aspeed SoC 4th Generation" | 16 | bool "Aspeed SoC 4th Generation" |
15 | depends on ARCH_MULTI_V5 | 17 | depends on ARCH_MULTI_V5 |
16 | select CPU_ARM926T | 18 | select CPU_ARM926T |
19 | select PINCTRL_ASPEED_G4 | ||
17 | help | 20 | help |
18 | Say yes if you intend to run on an Aspeed ast2400 or similar | 21 | Say yes if you intend to run on an Aspeed ast2400 or similar |
19 | fourth generation BMCs, such as those used by OpenPower Power8 | 22 | fourth generation BMCs, such as those used by OpenPower Power8 |
@@ -23,6 +26,7 @@ config MACH_ASPEED_G5 | |||
23 | bool "Aspeed SoC 5th Generation" | 26 | bool "Aspeed SoC 5th Generation" |
24 | depends on ARCH_MULTI_V6 | 27 | depends on ARCH_MULTI_V6 |
25 | select CPU_V6 | 28 | select CPU_V6 |
29 | select PINCTRL_ASPEED_G5 | ||
26 | help | 30 | help |
27 | Say yes if you intend to run on an Aspeed ast2500 or similar | 31 | Say yes if you intend to run on an Aspeed ast2500 or similar |
28 | fifth generation Aspeed BMCs. | 32 | fifth generation Aspeed BMCs. |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index b4332b727e9c..3d89b7905bd9 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -55,7 +55,7 @@ static struct { | |||
55 | int memctrl; | 55 | int memctrl; |
56 | } at91_pm_data; | 56 | } at91_pm_data; |
57 | 57 | ||
58 | void __iomem *at91_ramc_base[2]; | 58 | static void __iomem *at91_ramc_base[2]; |
59 | 59 | ||
60 | static int at91_pm_valid_state(suspend_state_t state) | 60 | static int at91_pm_valid_state(suspend_state_t state) |
61 | { | 61 | { |
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index 3fcf8810f14e..bf980c6ef294 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h | |||
@@ -18,8 +18,6 @@ | |||
18 | #include <soc/at91/at91sam9_sdramc.h> | 18 | #include <soc/at91/at91sam9_sdramc.h> |
19 | 19 | ||
20 | #ifndef __ASSEMBLY__ | 20 | #ifndef __ASSEMBLY__ |
21 | extern void __iomem *at91_ramc_base[]; | ||
22 | |||
23 | #define at91_ramc_read(id, field) \ | 21 | #define at91_ramc_read(id, field) \ |
24 | __raw_readl(at91_ramc_base[id] + field) | 22 | __raw_readl(at91_ramc_base[id] + field) |
25 | 23 | ||
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index df42c93a93d6..f5dce9b4e617 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c | |||
@@ -31,10 +31,10 @@ static LIST_HEAD(clocks); | |||
31 | static DEFINE_MUTEX(clocks_mutex); | 31 | static DEFINE_MUTEX(clocks_mutex); |
32 | static DEFINE_SPINLOCK(clockfw_lock); | 32 | static DEFINE_SPINLOCK(clockfw_lock); |
33 | 33 | ||
34 | static void __clk_enable(struct clk *clk) | 34 | void davinci_clk_enable(struct clk *clk) |
35 | { | 35 | { |
36 | if (clk->parent) | 36 | if (clk->parent) |
37 | __clk_enable(clk->parent); | 37 | davinci_clk_enable(clk->parent); |
38 | if (clk->usecount++ == 0) { | 38 | if (clk->usecount++ == 0) { |
39 | if (clk->flags & CLK_PSC) | 39 | if (clk->flags & CLK_PSC) |
40 | davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, | 40 | davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, |
@@ -44,7 +44,7 @@ static void __clk_enable(struct clk *clk) | |||
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | static void __clk_disable(struct clk *clk) | 47 | void davinci_clk_disable(struct clk *clk) |
48 | { | 48 | { |
49 | if (WARN_ON(clk->usecount == 0)) | 49 | if (WARN_ON(clk->usecount == 0)) |
50 | return; | 50 | return; |
@@ -56,7 +56,7 @@ static void __clk_disable(struct clk *clk) | |||
56 | clk->clk_disable(clk); | 56 | clk->clk_disable(clk); |
57 | } | 57 | } |
58 | if (clk->parent) | 58 | if (clk->parent) |
59 | __clk_disable(clk->parent); | 59 | davinci_clk_disable(clk->parent); |
60 | } | 60 | } |
61 | 61 | ||
62 | int davinci_clk_reset(struct clk *clk, bool reset) | 62 | int davinci_clk_reset(struct clk *clk, bool reset) |
@@ -103,7 +103,7 @@ int clk_enable(struct clk *clk) | |||
103 | return -EINVAL; | 103 | return -EINVAL; |
104 | 104 | ||
105 | spin_lock_irqsave(&clockfw_lock, flags); | 105 | spin_lock_irqsave(&clockfw_lock, flags); |
106 | __clk_enable(clk); | 106 | davinci_clk_enable(clk); |
107 | spin_unlock_irqrestore(&clockfw_lock, flags); | 107 | spin_unlock_irqrestore(&clockfw_lock, flags); |
108 | 108 | ||
109 | return 0; | 109 | return 0; |
@@ -118,7 +118,7 @@ void clk_disable(struct clk *clk) | |||
118 | return; | 118 | return; |
119 | 119 | ||
120 | spin_lock_irqsave(&clockfw_lock, flags); | 120 | spin_lock_irqsave(&clockfw_lock, flags); |
121 | __clk_disable(clk); | 121 | davinci_clk_disable(clk); |
122 | spin_unlock_irqrestore(&clockfw_lock, flags); | 122 | spin_unlock_irqrestore(&clockfw_lock, flags); |
123 | } | 123 | } |
124 | EXPORT_SYMBOL(clk_disable); | 124 | EXPORT_SYMBOL(clk_disable); |
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h index e2a5437a1aee..fa2b83752e03 100644 --- a/arch/arm/mach-davinci/clock.h +++ b/arch/arm/mach-davinci/clock.h | |||
@@ -132,6 +132,8 @@ int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate); | |||
132 | int davinci_set_refclk_rate(unsigned long rate); | 132 | int davinci_set_refclk_rate(unsigned long rate); |
133 | int davinci_simple_set_rate(struct clk *clk, unsigned long rate); | 133 | int davinci_simple_set_rate(struct clk *clk, unsigned long rate); |
134 | int davinci_clk_reset(struct clk *clk, bool reset); | 134 | int davinci_clk_reset(struct clk *clk, bool reset); |
135 | void davinci_clk_enable(struct clk *clk); | ||
136 | void davinci_clk_disable(struct clk *clk); | ||
135 | 137 | ||
136 | extern struct platform_device davinci_wdt_device; | 138 | extern struct platform_device davinci_wdt_device; |
137 | extern void davinci_watchdog_reset(struct platform_device *); | 139 | extern void davinci_watchdog_reset(struct platform_device *); |
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 8ab3c099e9aa..d09765ba246b 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
@@ -319,6 +319,16 @@ static struct clk emac_clk = { | |||
319 | .gpsc = 1, | 319 | .gpsc = 1, |
320 | }; | 320 | }; |
321 | 321 | ||
322 | /* | ||
323 | * In order to avoid adding the emac_clk to the clock lookup table twice (and | ||
324 | * screwing up the linked list in the process) create a separate clock for | ||
325 | * mdio inheriting the rate from emac_clk. | ||
326 | */ | ||
327 | static struct clk mdio_clk = { | ||
328 | .name = "mdio", | ||
329 | .parent = &emac_clk, | ||
330 | }; | ||
331 | |||
322 | static struct clk mcasp_clk = { | 332 | static struct clk mcasp_clk = { |
323 | .name = "mcasp", | 333 | .name = "mcasp", |
324 | .parent = &async3_clk, | 334 | .parent = &async3_clk, |
@@ -367,6 +377,16 @@ static struct clk aemif_clk = { | |||
367 | .flags = ALWAYS_ENABLED, | 377 | .flags = ALWAYS_ENABLED, |
368 | }; | 378 | }; |
369 | 379 | ||
380 | /* | ||
381 | * In order to avoid adding the aemif_clk to the clock lookup table twice (and | ||
382 | * screwing up the linked list in the process) create a separate clock for | ||
383 | * nand inheriting the rate from aemif_clk. | ||
384 | */ | ||
385 | static struct clk aemif_nand_clk = { | ||
386 | .name = "nand", | ||
387 | .parent = &aemif_clk, | ||
388 | }; | ||
389 | |||
370 | static struct clk usb11_clk = { | 390 | static struct clk usb11_clk = { |
371 | .name = "usb11", | 391 | .name = "usb11", |
372 | .parent = &pll0_sysclk4, | 392 | .parent = &pll0_sysclk4, |
@@ -529,7 +549,7 @@ static struct clk_lookup da850_clks[] = { | |||
529 | CLK(NULL, "arm", &arm_clk), | 549 | CLK(NULL, "arm", &arm_clk), |
530 | CLK(NULL, "rmii", &rmii_clk), | 550 | CLK(NULL, "rmii", &rmii_clk), |
531 | CLK("davinci_emac.1", NULL, &emac_clk), | 551 | CLK("davinci_emac.1", NULL, &emac_clk), |
532 | CLK("davinci_mdio.0", "fck", &emac_clk), | 552 | CLK("davinci_mdio.0", "fck", &mdio_clk), |
533 | CLK("davinci-mcasp.0", NULL, &mcasp_clk), | 553 | CLK("davinci-mcasp.0", NULL, &mcasp_clk), |
534 | CLK("davinci-mcbsp.0", NULL, &mcbsp0_clk), | 554 | CLK("davinci-mcbsp.0", NULL, &mcbsp0_clk), |
535 | CLK("davinci-mcbsp.1", NULL, &mcbsp1_clk), | 555 | CLK("davinci-mcbsp.1", NULL, &mcbsp1_clk), |
@@ -537,7 +557,15 @@ static struct clk_lookup da850_clks[] = { | |||
537 | CLK("da830-mmc.0", NULL, &mmcsd0_clk), | 557 | CLK("da830-mmc.0", NULL, &mmcsd0_clk), |
538 | CLK("da830-mmc.1", NULL, &mmcsd1_clk), | 558 | CLK("da830-mmc.1", NULL, &mmcsd1_clk), |
539 | CLK("ti-aemif", NULL, &aemif_clk), | 559 | CLK("ti-aemif", NULL, &aemif_clk), |
540 | CLK(NULL, "aemif", &aemif_clk), | 560 | /* |
561 | * The only user of this clock is davinci_nand and it get's it through | ||
562 | * con_id. The nand node itself is created from within the aemif | ||
563 | * driver to guarantee that it's probed after the aemif timing | ||
564 | * parameters are configured. of_dev_auxdata is not accessible from | ||
565 | * the aemif driver and can't be passed to of_platform_populate(). For | ||
566 | * that reason we're leaving the dev_id here as NULL. | ||
567 | */ | ||
568 | CLK(NULL, "aemif", &aemif_nand_clk), | ||
541 | CLK("ohci-da8xx", "usb11", &usb11_clk), | 569 | CLK("ohci-da8xx", "usb11", &usb11_clk), |
542 | CLK("musb-da8xx", "usb20", &usb20_clk), | 570 | CLK("musb-da8xx", "usb20", &usb20_clk), |
543 | CLK("spi_davinci.0", NULL, &spi0_clk), | 571 | CLK("spi_davinci.0", NULL, &spi0_clk), |
diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c index c6feecf7ae24..9a6af0bd5dc3 100644 --- a/arch/arm/mach-davinci/usb-da8xx.c +++ b/arch/arm/mach-davinci/usb-da8xx.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #define DA8XX_USB0_BASE 0x01e00000 | 22 | #define DA8XX_USB0_BASE 0x01e00000 |
23 | #define DA8XX_USB1_BASE 0x01e25000 | 23 | #define DA8XX_USB1_BASE 0x01e25000 |
24 | 24 | ||
25 | static struct clk *usb20_clk; | ||
26 | |||
25 | static struct platform_device da8xx_usb_phy = { | 27 | static struct platform_device da8xx_usb_phy = { |
26 | .name = "da8xx-usb-phy", | 28 | .name = "da8xx-usb-phy", |
27 | .id = -1, | 29 | .id = -1, |
@@ -158,26 +160,13 @@ int __init da8xx_register_usb_refclkin(int rate) | |||
158 | 160 | ||
159 | static void usb20_phy_clk_enable(struct clk *clk) | 161 | static void usb20_phy_clk_enable(struct clk *clk) |
160 | { | 162 | { |
161 | struct clk *usb20_clk; | ||
162 | int err; | ||
163 | u32 val; | 163 | u32 val; |
164 | u32 timeout = 500000; /* 500 msec */ | 164 | u32 timeout = 500000; /* 500 msec */ |
165 | 165 | ||
166 | val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); | 166 | val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); |
167 | 167 | ||
168 | usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20"); | ||
169 | if (IS_ERR(usb20_clk)) { | ||
170 | pr_err("could not get usb20 clk: %ld\n", PTR_ERR(usb20_clk)); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | /* The USB 2.O PLL requires that the USB 2.O PSC is enabled as well. */ | 168 | /* The USB 2.O PLL requires that the USB 2.O PSC is enabled as well. */ |
175 | err = clk_prepare_enable(usb20_clk); | 169 | davinci_clk_enable(usb20_clk); |
176 | if (err) { | ||
177 | pr_err("failed to enable usb20 clk: %d\n", err); | ||
178 | clk_put(usb20_clk); | ||
179 | return; | ||
180 | } | ||
181 | 170 | ||
182 | /* | 171 | /* |
183 | * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1 | 172 | * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1 |
@@ -197,8 +186,7 @@ static void usb20_phy_clk_enable(struct clk *clk) | |||
197 | 186 | ||
198 | pr_err("Timeout waiting for USB 2.0 PHY clock good\n"); | 187 | pr_err("Timeout waiting for USB 2.0 PHY clock good\n"); |
199 | done: | 188 | done: |
200 | clk_disable_unprepare(usb20_clk); | 189 | davinci_clk_disable(usb20_clk); |
201 | clk_put(usb20_clk); | ||
202 | } | 190 | } |
203 | 191 | ||
204 | static void usb20_phy_clk_disable(struct clk *clk) | 192 | static void usb20_phy_clk_disable(struct clk *clk) |
@@ -285,11 +273,19 @@ static struct clk_lookup usb20_phy_clk_lookup = | |||
285 | int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin) | 273 | int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin) |
286 | { | 274 | { |
287 | struct clk *parent; | 275 | struct clk *parent; |
288 | int ret = 0; | 276 | int ret; |
277 | |||
278 | usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20"); | ||
279 | ret = PTR_ERR_OR_ZERO(usb20_clk); | ||
280 | if (ret) | ||
281 | return ret; | ||
289 | 282 | ||
290 | parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux"); | 283 | parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux"); |
291 | if (IS_ERR(parent)) | 284 | ret = PTR_ERR_OR_ZERO(parent); |
292 | return PTR_ERR(parent); | 285 | if (ret) { |
286 | clk_put(usb20_clk); | ||
287 | return ret; | ||
288 | } | ||
293 | 289 | ||
294 | usb20_phy_clk.parent = parent; | 290 | usb20_phy_clk.parent = parent; |
295 | ret = clk_register(&usb20_phy_clk); | 291 | ret = clk_register(&usb20_phy_clk); |
diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h index 03c42e5400d2..b0cf2de77f81 100644 --- a/arch/arm/mach-ep93xx/include/mach/uncompress.h +++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <mach/ep93xx-regs.h> | 12 | #include <mach/ep93xx-regs.h> |
13 | #include <asm/mach-types.h> | ||
13 | 14 | ||
14 | static unsigned char __raw_readb(unsigned int ptr) | 15 | static unsigned char __raw_readb(unsigned int ptr) |
15 | { | 16 | { |
@@ -75,8 +76,19 @@ static void ethernet_reset(void) | |||
75 | ; | 76 | ; |
76 | } | 77 | } |
77 | 78 | ||
79 | #define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000 | ||
80 | #define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000 | ||
81 | #define TS72XX_WDT_FEED_VAL 0x05 | ||
82 | |||
83 | static void __maybe_unused ts72xx_watchdog_disable(void) | ||
84 | { | ||
85 | __raw_writeb(TS72XX_WDT_FEED_VAL, TS72XX_WDT_FEED_PHYS_BASE); | ||
86 | __raw_writeb(0, TS72XX_WDT_CONTROL_PHYS_BASE); | ||
87 | } | ||
78 | 88 | ||
79 | static void arch_decomp_setup(void) | 89 | static void arch_decomp_setup(void) |
80 | { | 90 | { |
91 | if (machine_is_ts72xx()) | ||
92 | ts72xx_watchdog_disable(); | ||
81 | ethernet_reset(); | 93 | ethernet_reset(); |
82 | } | 94 | } |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 0bb63b8d21e7..0a99140b6ba2 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -95,11 +95,6 @@ config SOC_EXYNOS4412 | |||
95 | default y | 95 | default y |
96 | depends on ARCH_EXYNOS4 | 96 | depends on ARCH_EXYNOS4 |
97 | 97 | ||
98 | config SOC_EXYNOS4415 | ||
99 | bool "SAMSUNG EXYNOS4415" | ||
100 | default y | ||
101 | depends on ARCH_EXYNOS4 | ||
102 | |||
103 | config SOC_EXYNOS5250 | 98 | config SOC_EXYNOS5250 |
104 | bool "SAMSUNG EXYNOS5250" | 99 | bool "SAMSUNG EXYNOS5250" |
105 | default y | 100 | default y |
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 757fc11de30d..c404c15ad07f 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c | |||
@@ -45,8 +45,8 @@ static struct platform_device exynos_cpuidle = { | |||
45 | .id = -1, | 45 | .id = -1, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | void __iomem *sysram_base_addr; | 48 | void __iomem *sysram_base_addr __ro_after_init; |
49 | void __iomem *sysram_ns_base_addr; | 49 | void __iomem *sysram_ns_base_addr __ro_after_init; |
50 | 50 | ||
51 | void __init exynos_sysram_init(void) | 51 | void __init exynos_sysram_init(void) |
52 | { | 52 | { |
@@ -210,7 +210,6 @@ static char const *const exynos_dt_compat[] __initconst = { | |||
210 | "samsung,exynos4210", | 210 | "samsung,exynos4210", |
211 | "samsung,exynos4212", | 211 | "samsung,exynos4212", |
212 | "samsung,exynos4412", | 212 | "samsung,exynos4412", |
213 | "samsung,exynos4415", | ||
214 | "samsung,exynos5", | 213 | "samsung,exynos5", |
215 | "samsung,exynos5250", | 214 | "samsung,exynos5250", |
216 | "samsung,exynos5260", | 215 | "samsung,exynos5260", |
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index f086bf615b29..038fd8c993d0 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #define EXYNOS5420_USE_ARM_CORE_DOWN_STATE BIT(29) | 32 | #define EXYNOS5420_USE_ARM_CORE_DOWN_STATE BIT(29) |
33 | #define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30) | 33 | #define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30) |
34 | 34 | ||
35 | static void __iomem *ns_sram_base_addr; | 35 | static void __iomem *ns_sram_base_addr __ro_after_init; |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * The common v7_exit_coherency_flush API could not be used because of the | 38 | * The common v7_exit_coherency_flush API could not be used because of the |
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 98ffe1e62ad5..a5d68411a037 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c | |||
@@ -385,36 +385,6 @@ fail: | |||
385 | return pen_release != -1 ? ret : 0; | 385 | return pen_release != -1 ? ret : 0; |
386 | } | 386 | } |
387 | 387 | ||
388 | /* | ||
389 | * Initialise the CPU possible map early - this describes the CPUs | ||
390 | * which may be present or become present in the system. | ||
391 | */ | ||
392 | |||
393 | static void __init exynos_smp_init_cpus(void) | ||
394 | { | ||
395 | void __iomem *scu_base = scu_base_addr(); | ||
396 | unsigned int i, ncores; | ||
397 | |||
398 | if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) | ||
399 | ncores = scu_base ? scu_get_core_count(scu_base) : 1; | ||
400 | else | ||
401 | /* | ||
402 | * CPU Nodes are passed thru DT and set_cpu_possible | ||
403 | * is set by "arm_dt_init_cpu_maps". | ||
404 | */ | ||
405 | return; | ||
406 | |||
407 | /* sanity check */ | ||
408 | if (ncores > nr_cpu_ids) { | ||
409 | pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", | ||
410 | ncores, nr_cpu_ids); | ||
411 | ncores = nr_cpu_ids; | ||
412 | } | ||
413 | |||
414 | for (i = 0; i < ncores; i++) | ||
415 | set_cpu_possible(i, true); | ||
416 | } | ||
417 | |||
418 | static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) | 388 | static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) |
419 | { | 389 | { |
420 | int i; | 390 | int i; |
@@ -479,7 +449,6 @@ static void exynos_cpu_die(unsigned int cpu) | |||
479 | #endif /* CONFIG_HOTPLUG_CPU */ | 449 | #endif /* CONFIG_HOTPLUG_CPU */ |
480 | 450 | ||
481 | const struct smp_operations exynos_smp_ops __initconst = { | 451 | const struct smp_operations exynos_smp_ops __initconst = { |
482 | .smp_init_cpus = exynos_smp_init_cpus, | ||
483 | .smp_prepare_cpus = exynos_smp_prepare_cpus, | 452 | .smp_prepare_cpus = exynos_smp_prepare_cpus, |
484 | .smp_secondary_init = exynos_secondary_init, | 453 | .smp_secondary_init = exynos_secondary_init, |
485 | .smp_boot_secondary = exynos_boot_secondary, | 454 | .smp_boot_secondary = exynos_boot_secondary, |
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 06332f626565..25e7c5326259 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c | |||
@@ -57,7 +57,7 @@ struct exynos_wkup_irq { | |||
57 | struct exynos_pm_data { | 57 | struct exynos_pm_data { |
58 | const struct exynos_wkup_irq *wkup_irq; | 58 | const struct exynos_wkup_irq *wkup_irq; |
59 | unsigned int wake_disable_mask; | 59 | unsigned int wake_disable_mask; |
60 | unsigned int *release_ret_regs; | 60 | const unsigned int *release_ret_regs; |
61 | 61 | ||
62 | void (*pm_prepare)(void); | 62 | void (*pm_prepare)(void); |
63 | void (*pm_resume_prepare)(void); | 63 | void (*pm_resume_prepare)(void); |
@@ -66,7 +66,7 @@ struct exynos_pm_data { | |||
66 | int (*cpu_suspend)(unsigned long); | 66 | int (*cpu_suspend)(unsigned long); |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static const struct exynos_pm_data *pm_data; | 69 | static const struct exynos_pm_data *pm_data __ro_after_init; |
70 | 70 | ||
71 | static int exynos5420_cpu_state; | 71 | static int exynos5420_cpu_state; |
72 | static unsigned int exynos_pmu_spare3; | 72 | static unsigned int exynos_pmu_spare3; |
@@ -95,7 +95,7 @@ static const struct exynos_wkup_irq exynos5250_wkup_irq[] = { | |||
95 | { /* sentinel */ }, | 95 | { /* sentinel */ }, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | static unsigned int exynos_release_ret_regs[] = { | 98 | static const unsigned int exynos_release_ret_regs[] = { |
99 | S5P_PAD_RET_MAUDIO_OPTION, | 99 | S5P_PAD_RET_MAUDIO_OPTION, |
100 | S5P_PAD_RET_GPIO_OPTION, | 100 | S5P_PAD_RET_GPIO_OPTION, |
101 | S5P_PAD_RET_UART_OPTION, | 101 | S5P_PAD_RET_UART_OPTION, |
@@ -106,7 +106,7 @@ static unsigned int exynos_release_ret_regs[] = { | |||
106 | REG_TABLE_END, | 106 | REG_TABLE_END, |
107 | }; | 107 | }; |
108 | 108 | ||
109 | static unsigned int exynos3250_release_ret_regs[] = { | 109 | static const unsigned int exynos3250_release_ret_regs[] = { |
110 | S5P_PAD_RET_MAUDIO_OPTION, | 110 | S5P_PAD_RET_MAUDIO_OPTION, |
111 | S5P_PAD_RET_GPIO_OPTION, | 111 | S5P_PAD_RET_GPIO_OPTION, |
112 | S5P_PAD_RET_UART_OPTION, | 112 | S5P_PAD_RET_UART_OPTION, |
@@ -119,7 +119,7 @@ static unsigned int exynos3250_release_ret_regs[] = { | |||
119 | REG_TABLE_END, | 119 | REG_TABLE_END, |
120 | }; | 120 | }; |
121 | 121 | ||
122 | static unsigned int exynos5420_release_ret_regs[] = { | 122 | static const unsigned int exynos5420_release_ret_regs[] = { |
123 | EXYNOS_PAD_RET_DRAM_OPTION, | 123 | EXYNOS_PAD_RET_DRAM_OPTION, |
124 | EXYNOS_PAD_RET_MAUDIO_OPTION, | 124 | EXYNOS_PAD_RET_MAUDIO_OPTION, |
125 | EXYNOS_PAD_RET_JTAG_OPTION, | 125 | EXYNOS_PAD_RET_JTAG_OPTION, |
@@ -270,7 +270,6 @@ EXYNOS_PMU_IRQ(exynos3250_pmu_irq, "samsung,exynos3250-pmu"); | |||
270 | EXYNOS_PMU_IRQ(exynos4210_pmu_irq, "samsung,exynos4210-pmu"); | 270 | EXYNOS_PMU_IRQ(exynos4210_pmu_irq, "samsung,exynos4210-pmu"); |
271 | EXYNOS_PMU_IRQ(exynos4212_pmu_irq, "samsung,exynos4212-pmu"); | 271 | EXYNOS_PMU_IRQ(exynos4212_pmu_irq, "samsung,exynos4212-pmu"); |
272 | EXYNOS_PMU_IRQ(exynos4412_pmu_irq, "samsung,exynos4412-pmu"); | 272 | EXYNOS_PMU_IRQ(exynos4412_pmu_irq, "samsung,exynos4412-pmu"); |
273 | EXYNOS_PMU_IRQ(exynos4415_pmu_irq, "samsung,exynos4415-pmu"); | ||
274 | EXYNOS_PMU_IRQ(exynos5250_pmu_irq, "samsung,exynos5250-pmu"); | 273 | EXYNOS_PMU_IRQ(exynos5250_pmu_irq, "samsung,exynos5250-pmu"); |
275 | EXYNOS_PMU_IRQ(exynos5420_pmu_irq, "samsung,exynos5420-pmu"); | 274 | EXYNOS_PMU_IRQ(exynos5420_pmu_irq, "samsung,exynos5420-pmu"); |
276 | 275 | ||
diff --git a/arch/arm/mach-hisi/core.h b/arch/arm/mach-hisi/core.h index e883583a23f1..c58b68ab0cb6 100644 --- a/arch/arm/mach-hisi/core.h +++ b/arch/arm/mach-hisi/core.h | |||
@@ -15,5 +15,4 @@ extern void hix5hd2_set_cpu(int cpu, bool enable); | |||
15 | extern void hix5hd2_cpu_die(unsigned int cpu); | 15 | extern void hix5hd2_cpu_die(unsigned int cpu); |
16 | 16 | ||
17 | extern void hip01_set_cpu(int cpu, bool enable); | 17 | extern void hip01_set_cpu(int cpu, bool enable); |
18 | extern void hip01_cpu_die(unsigned int cpu); | ||
19 | #endif | 18 | #endif |
diff --git a/arch/arm/mach-imx/devices/platform-flexcan.c b/arch/arm/mach-imx/devices/platform-flexcan.c index 55d61eaf63c6..8a1a2fc4ce10 100644 --- a/arch/arm/mach-imx/devices/platform-flexcan.c +++ b/arch/arm/mach-imx/devices/platform-flexcan.c | |||
@@ -19,15 +19,6 @@ | |||
19 | #define imx_flexcan_data_entry(soc, _id, _hwid, _size) \ | 19 | #define imx_flexcan_data_entry(soc, _id, _hwid, _size) \ |
20 | [_id] = imx_flexcan_data_entry_single(soc, _id, _hwid, _size) | 20 | [_id] = imx_flexcan_data_entry_single(soc, _id, _hwid, _size) |
21 | 21 | ||
22 | #ifdef CONFIG_SOC_IMX25 | ||
23 | const struct imx_flexcan_data imx25_flexcan_data[] __initconst = { | ||
24 | #define imx25_flexcan_data_entry(_id, _hwid) \ | ||
25 | imx_flexcan_data_entry(MX25, _id, _hwid, SZ_16K) | ||
26 | imx25_flexcan_data_entry(0, 1), | ||
27 | imx25_flexcan_data_entry(1, 2), | ||
28 | }; | ||
29 | #endif /* ifdef CONFIG_SOC_IMX25 */ | ||
30 | |||
31 | #ifdef CONFIG_SOC_IMX35 | 22 | #ifdef CONFIG_SOC_IMX35 |
32 | const struct imx_flexcan_data imx35_flexcan_data[] __initconst = { | 23 | const struct imx_flexcan_data imx35_flexcan_data[] __initconst = { |
33 | #define imx35_flexcan_data_entry(_id, _hwid) \ | 24 | #define imx35_flexcan_data_entry(_id, _hwid) \ |
diff --git a/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c index 3d039ef021e0..466c9ccc6675 100644 --- a/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c +++ b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c | |||
@@ -22,16 +22,6 @@ | |||
22 | #define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \ | 22 | #define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \ |
23 | [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid) | 23 | [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid) |
24 | 24 | ||
25 | #ifdef CONFIG_SOC_IMX25 | ||
26 | const struct imx_sdhci_esdhc_imx_data | ||
27 | imx25_sdhci_esdhc_imx_data[] __initconst = { | ||
28 | #define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \ | ||
29 | imx_sdhci_esdhc_imx_data_entry(MX25, "sdhci-esdhc-imx25", _id, _hwid) | ||
30 | imx25_sdhci_esdhc_imx_data_entry(0, 1), | ||
31 | imx25_sdhci_esdhc_imx_data_entry(1, 2), | ||
32 | }; | ||
33 | #endif /* ifdef CONFIG_SOC_IMX25 */ | ||
34 | |||
35 | #ifdef CONFIG_SOC_IMX35 | 25 | #ifdef CONFIG_SOC_IMX35 |
36 | const struct imx_sdhci_esdhc_imx_data | 26 | const struct imx_sdhci_esdhc_imx_data |
37 | imx35_sdhci_esdhc_imx_data[] __initconst = { | 27 | imx35_sdhci_esdhc_imx_data[] __initconst = { |
diff --git a/arch/arm/mach-imx/mach-imx1.c b/arch/arm/mach-imx/mach-imx1.c index de5ab8d88549..3a8406e45b65 100644 --- a/arch/arm/mach-imx/mach-imx1.c +++ b/arch/arm/mach-imx/mach-imx1.c | |||
@@ -37,7 +37,6 @@ static const char * const imx1_dt_board_compat[] __initconst = { | |||
37 | }; | 37 | }; |
38 | 38 | ||
39 | DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)") | 39 | DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)") |
40 | .map_io = debug_ll_io_init, | ||
41 | .init_early = imx1_init_early, | 40 | .init_early = imx1_init_early, |
42 | .init_irq = imx1_init_irq, | 41 | .init_irq = imx1_init_irq, |
43 | .dt_compat = imx1_dt_board_compat, | 42 | .dt_compat = imx1_dt_board_compat, |
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 7ba651a9b5b8..45e16bd7e2f2 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/regulator/machine.h> | 31 | #include <linux/regulator/machine.h> |
32 | #include <linux/spi/l4f00242t03.h> | 32 | #include <linux/spi/l4f00242t03.h> |
33 | 33 | ||
34 | #include <media/soc_camera.h> | ||
35 | 34 | ||
36 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
37 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
@@ -53,8 +52,6 @@ | |||
53 | #define SD1_CD IMX_GPIO_NR(2, 26) | 52 | #define SD1_CD IMX_GPIO_NR(2, 26) |
54 | #define LCD_RESET IMX_GPIO_NR(1, 3) | 53 | #define LCD_RESET IMX_GPIO_NR(1, 3) |
55 | #define LCD_ENABLE IMX_GPIO_NR(1, 31) | 54 | #define LCD_ENABLE IMX_GPIO_NR(1, 31) |
56 | #define CSI_PWRDWN IMX_GPIO_NR(4, 19) | ||
57 | #define CSI_RESET IMX_GPIO_NR(3, 6) | ||
58 | 55 | ||
59 | static const int mx27pdk_pins[] __initconst = { | 56 | static const int mx27pdk_pins[] __initconst = { |
60 | /* UART1 */ | 57 | /* UART1 */ |
@@ -144,21 +141,6 @@ static const int mx27pdk_pins[] __initconst = { | |||
144 | PA30_PF_CONTRAST, | 141 | PA30_PF_CONTRAST, |
145 | LCD_ENABLE | GPIO_GPIO | GPIO_OUT, | 142 | LCD_ENABLE | GPIO_GPIO | GPIO_OUT, |
146 | LCD_RESET | GPIO_GPIO | GPIO_OUT, | 143 | LCD_RESET | GPIO_GPIO | GPIO_OUT, |
147 | /* CSI */ | ||
148 | PB10_PF_CSI_D0, | ||
149 | PB11_PF_CSI_D1, | ||
150 | PB12_PF_CSI_D2, | ||
151 | PB13_PF_CSI_D3, | ||
152 | PB14_PF_CSI_D4, | ||
153 | PB15_PF_CSI_MCLK, | ||
154 | PB16_PF_CSI_PIXCLK, | ||
155 | PB17_PF_CSI_D5, | ||
156 | PB18_PF_CSI_D6, | ||
157 | PB19_PF_CSI_D7, | ||
158 | PB20_PF_CSI_VSYNC, | ||
159 | PB21_PF_CSI_HSYNC, | ||
160 | CSI_PWRDWN | GPIO_GPIO | GPIO_OUT, | ||
161 | CSI_RESET | GPIO_GPIO | GPIO_OUT, | ||
162 | /* SSI4 */ | 144 | /* SSI4 */ |
163 | PC16_PF_SSI4_FS, | 145 | PC16_PF_SSI4_FS, |
164 | PC17_PF_SSI4_RXD, | 146 | PC17_PF_SSI4_RXD, |
@@ -166,11 +148,6 @@ static const int mx27pdk_pins[] __initconst = { | |||
166 | PC19_PF_SSI4_CLK, | 148 | PC19_PF_SSI4_CLK, |
167 | }; | 149 | }; |
168 | 150 | ||
169 | static struct gpio mx27_3ds_camera_gpios[] = { | ||
170 | { CSI_PWRDWN, GPIOF_OUT_INIT_HIGH, "camera-power" }, | ||
171 | { CSI_RESET, GPIOF_OUT_INIT_HIGH, "camera-reset" }, | ||
172 | }; | ||
173 | |||
174 | static const struct imxuart_platform_data uart_pdata __initconst = { | 151 | static const struct imxuart_platform_data uart_pdata __initconst = { |
175 | .flags = IMXUART_HAVE_RTSCTS, | 152 | .flags = IMXUART_HAVE_RTSCTS, |
176 | }; | 153 | }; |
@@ -270,7 +247,6 @@ static struct regulator_init_data gpo_init = { | |||
270 | 247 | ||
271 | static struct regulator_consumer_supply vmmc1_consumers[] = { | 248 | static struct regulator_consumer_supply vmmc1_consumers[] = { |
272 | REGULATOR_SUPPLY("vcore", "spi0.0"), | 249 | REGULATOR_SUPPLY("vcore", "spi0.0"), |
273 | REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), | ||
274 | }; | 250 | }; |
275 | 251 | ||
276 | static struct regulator_init_data vmmc1_init = { | 252 | static struct regulator_init_data vmmc1_init = { |
@@ -299,22 +275,6 @@ static struct regulator_init_data vgen_init = { | |||
299 | .consumer_supplies = vgen_consumers, | 275 | .consumer_supplies = vgen_consumers, |
300 | }; | 276 | }; |
301 | 277 | ||
302 | static struct regulator_consumer_supply vvib_consumers[] = { | ||
303 | REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"), | ||
304 | }; | ||
305 | |||
306 | static struct regulator_init_data vvib_init = { | ||
307 | .constraints = { | ||
308 | .min_uV = 1300000, | ||
309 | .max_uV = 1300000, | ||
310 | .apply_uV = 1, | ||
311 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
312 | REGULATOR_CHANGE_STATUS, | ||
313 | }, | ||
314 | .num_consumer_supplies = ARRAY_SIZE(vvib_consumers), | ||
315 | .consumer_supplies = vvib_consumers, | ||
316 | }; | ||
317 | |||
318 | static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | 278 | static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { |
319 | { | 279 | { |
320 | .id = MC13783_REG_VMMC1, | 280 | .id = MC13783_REG_VMMC1, |
@@ -328,9 +288,6 @@ static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | |||
328 | }, { | 288 | }, { |
329 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ | 289 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ |
330 | .init_data = &gpo_init, | 290 | .init_data = &gpo_init, |
331 | }, { | ||
332 | .id = MC13783_REG_VVIB, /* Power OV2640 */ | ||
333 | .init_data = &vvib_init, | ||
334 | }, | 291 | }, |
335 | }; | 292 | }; |
336 | 293 | ||
@@ -370,51 +327,6 @@ static const struct spi_imx_master spi2_pdata __initconst = { | |||
370 | .num_chipselect = ARRAY_SIZE(spi2_chipselect), | 327 | .num_chipselect = ARRAY_SIZE(spi2_chipselect), |
371 | }; | 328 | }; |
372 | 329 | ||
373 | static int mx27_3ds_camera_power(struct device *dev, int on) | ||
374 | { | ||
375 | /* enable or disable the camera */ | ||
376 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); | ||
377 | gpio_set_value(CSI_PWRDWN, on ? 0 : 1); | ||
378 | |||
379 | if (!on) | ||
380 | goto out; | ||
381 | |||
382 | /* If enabled, give a reset impulse */ | ||
383 | gpio_set_value(CSI_RESET, 0); | ||
384 | msleep(20); | ||
385 | gpio_set_value(CSI_RESET, 1); | ||
386 | msleep(100); | ||
387 | |||
388 | out: | ||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static struct i2c_board_info mx27_3ds_i2c_camera = { | ||
393 | I2C_BOARD_INFO("ov2640", 0x30), | ||
394 | }; | ||
395 | |||
396 | static struct regulator_bulk_data mx27_3ds_camera_regs[] = { | ||
397 | { .supply = "cmos_vcore" }, | ||
398 | { .supply = "cmos_2v8" }, | ||
399 | }; | ||
400 | |||
401 | static struct soc_camera_link iclink_ov2640 = { | ||
402 | .bus_id = 0, | ||
403 | .board_info = &mx27_3ds_i2c_camera, | ||
404 | .i2c_adapter_id = 0, | ||
405 | .power = mx27_3ds_camera_power, | ||
406 | .regulators = mx27_3ds_camera_regs, | ||
407 | .num_regulators = ARRAY_SIZE(mx27_3ds_camera_regs), | ||
408 | }; | ||
409 | |||
410 | static struct platform_device mx27_3ds_ov2640 = { | ||
411 | .name = "soc-camera-pdrv", | ||
412 | .id = 0, | ||
413 | .dev = { | ||
414 | .platform_data = &iclink_ov2640, | ||
415 | }, | ||
416 | }; | ||
417 | |||
418 | static struct imx_fb_videomode mx27_3ds_modes[] = { | 330 | static struct imx_fb_videomode mx27_3ds_modes[] = { |
419 | { /* 480x640 @ 60 Hz */ | 331 | { /* 480x640 @ 60 Hz */ |
420 | .mode = { | 332 | .mode = { |
@@ -471,14 +383,6 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { | |||
471 | }, | 383 | }, |
472 | }; | 384 | }; |
473 | 385 | ||
474 | static struct platform_device *devices[] __initdata = { | ||
475 | &mx27_3ds_ov2640, | ||
476 | }; | ||
477 | |||
478 | static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = { | ||
479 | .clk = 26000000, | ||
480 | }; | ||
481 | |||
482 | static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { | 386 | static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { |
483 | .bitrate = 100000, | 387 | .bitrate = 100000, |
484 | }; | 388 | }; |
@@ -498,7 +402,6 @@ static void __init mx27pdk_init(void) | |||
498 | imx27_add_spi_imx0(&spi1_pdata); | 402 | imx27_add_spi_imx0(&spi1_pdata); |
499 | 403 | ||
500 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); | 404 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); |
501 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
502 | imx27_add_imx_fb(&mx27_3ds_fb_data); | 405 | imx27_add_imx_fb(&mx27_3ds_fb_data); |
503 | 406 | ||
504 | imx27_add_imx_ssi(0, &mx27_3ds_ssi_pdata); | 407 | imx27_add_imx_ssi(0, &mx27_3ds_ssi_pdata); |
@@ -506,8 +409,6 @@ static void __init mx27pdk_init(void) | |||
506 | 409 | ||
507 | static void __init mx27pdk_late_init(void) | 410 | static void __init mx27pdk_late_init(void) |
508 | { | 411 | { |
509 | int ret; | ||
510 | |||
511 | mx27_3ds_sdhc1_enable_level_translator(); | 412 | mx27_3ds_sdhc1_enable_level_translator(); |
512 | imx27_add_mxc_mmc(0, &sdhc1_pdata); | 413 | imx27_add_mxc_mmc(0, &sdhc1_pdata); |
513 | 414 | ||
@@ -531,14 +432,6 @@ static void __init mx27pdk_late_init(void) | |||
531 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, IMX_GPIO_NR(3, 28))) | 432 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, IMX_GPIO_NR(3, 28))) |
532 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); | 433 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); |
533 | 434 | ||
534 | ret = gpio_request_array(mx27_3ds_camera_gpios, | ||
535 | ARRAY_SIZE(mx27_3ds_camera_gpios)); | ||
536 | if (ret) { | ||
537 | pr_err("Failed to request camera gpios"); | ||
538 | iclink_ov2640.power = NULL; | ||
539 | } | ||
540 | |||
541 | imx27_add_mx2_camera(&mx27_3ds_cam_pdata); | ||
542 | 435 | ||
543 | imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0); | 436 | imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0); |
544 | } | 437 | } |
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c index 12b8a52c9cb4..558e5f8589cb 100644 --- a/arch/arm/mach-imx/mach-mx31_3ds.c +++ b/arch/arm/mach-imx/mach-mx31_3ds.c | |||
@@ -26,16 +26,12 @@ | |||
26 | #include <linux/regulator/machine.h> | 26 | #include <linux/regulator/machine.h> |
27 | #include <linux/usb/otg.h> | 27 | #include <linux/usb/otg.h> |
28 | #include <linux/usb/ulpi.h> | 28 | #include <linux/usb/ulpi.h> |
29 | #include <linux/memblock.h> | ||
30 | |||
31 | #include <media/soc_camera.h> | ||
32 | 29 | ||
33 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
34 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
35 | #include <asm/mach/time.h> | 32 | #include <asm/mach/time.h> |
36 | #include <asm/memory.h> | 33 | #include <asm/memory.h> |
37 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
38 | #include <asm/memblock.h> | ||
39 | 35 | ||
40 | #include "3ds_debugboard.h" | 36 | #include "3ds_debugboard.h" |
41 | #include "common.h" | 37 | #include "common.h" |
@@ -137,23 +133,6 @@ static int mx31_3ds_pins[] = { | |||
137 | MX31_PIN_HSYNC__HSYNC, | 133 | MX31_PIN_HSYNC__HSYNC, |
138 | MX31_PIN_FPSHIFT__FPSHIFT, | 134 | MX31_PIN_FPSHIFT__FPSHIFT, |
139 | MX31_PIN_CONTRAST__CONTRAST, | 135 | MX31_PIN_CONTRAST__CONTRAST, |
140 | /* CSI */ | ||
141 | MX31_PIN_CSI_D6__CSI_D6, | ||
142 | MX31_PIN_CSI_D7__CSI_D7, | ||
143 | MX31_PIN_CSI_D8__CSI_D8, | ||
144 | MX31_PIN_CSI_D9__CSI_D9, | ||
145 | MX31_PIN_CSI_D10__CSI_D10, | ||
146 | MX31_PIN_CSI_D11__CSI_D11, | ||
147 | MX31_PIN_CSI_D12__CSI_D12, | ||
148 | MX31_PIN_CSI_D13__CSI_D13, | ||
149 | MX31_PIN_CSI_D14__CSI_D14, | ||
150 | MX31_PIN_CSI_D15__CSI_D15, | ||
151 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, | ||
152 | MX31_PIN_CSI_MCLK__CSI_MCLK, | ||
153 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, | ||
154 | MX31_PIN_CSI_VSYNC__CSI_VSYNC, | ||
155 | MX31_PIN_CSI_D5__GPIO3_5, /* CMOS PWDN */ | ||
156 | IOMUX_MODE(MX31_PIN_RI_DTE1, IOMUX_CONFIG_GPIO), /* CMOS reset */ | ||
157 | /* SSI */ | 136 | /* SSI */ |
158 | MX31_PIN_STXD4__STXD4, | 137 | MX31_PIN_STXD4__STXD4, |
159 | MX31_PIN_SRXD4__SRXD4, | 138 | MX31_PIN_SRXD4__SRXD4, |
@@ -162,98 +141,6 @@ static int mx31_3ds_pins[] = { | |||
162 | }; | 141 | }; |
163 | 142 | ||
164 | /* | 143 | /* |
165 | * Camera support | ||
166 | */ | ||
167 | static phys_addr_t mx3_camera_base __initdata; | ||
168 | #define MX31_3DS_CAMERA_BUF_SIZE SZ_8M | ||
169 | |||
170 | #define MX31_3DS_GPIO_CAMERA_PW IOMUX_TO_GPIO(MX31_PIN_CSI_D5) | ||
171 | #define MX31_3DS_GPIO_CAMERA_RST IOMUX_TO_GPIO(MX31_PIN_RI_DTE1) | ||
172 | |||
173 | static struct gpio mx31_3ds_camera_gpios[] = { | ||
174 | { MX31_3DS_GPIO_CAMERA_PW, GPIOF_OUT_INIT_HIGH, "camera-power" }, | ||
175 | { MX31_3DS_GPIO_CAMERA_RST, GPIOF_OUT_INIT_HIGH, "camera-reset" }, | ||
176 | }; | ||
177 | |||
178 | static const struct mx3_camera_pdata mx31_3ds_camera_pdata __initconst = { | ||
179 | .flags = MX3_CAMERA_DATAWIDTH_10, | ||
180 | .mclk_10khz = 2600, | ||
181 | }; | ||
182 | |||
183 | static int __init mx31_3ds_init_camera(void) | ||
184 | { | ||
185 | int dma, ret = -ENOMEM; | ||
186 | struct platform_device *pdev = | ||
187 | imx31_alloc_mx3_camera(&mx31_3ds_camera_pdata); | ||
188 | |||
189 | if (IS_ERR(pdev)) | ||
190 | return PTR_ERR(pdev); | ||
191 | |||
192 | if (!mx3_camera_base) | ||
193 | goto err; | ||
194 | |||
195 | dma = dma_declare_coherent_memory(&pdev->dev, | ||
196 | mx3_camera_base, mx3_camera_base, | ||
197 | MX31_3DS_CAMERA_BUF_SIZE, | ||
198 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
199 | |||
200 | if (!(dma & DMA_MEMORY_MAP)) | ||
201 | goto err; | ||
202 | |||
203 | ret = platform_device_add(pdev); | ||
204 | if (ret) | ||
205 | err: | ||
206 | platform_device_put(pdev); | ||
207 | |||
208 | return ret; | ||
209 | } | ||
210 | |||
211 | static int mx31_3ds_camera_power(struct device *dev, int on) | ||
212 | { | ||
213 | /* enable or disable the camera */ | ||
214 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); | ||
215 | gpio_set_value(MX31_3DS_GPIO_CAMERA_PW, on ? 0 : 1); | ||
216 | |||
217 | if (!on) | ||
218 | goto out; | ||
219 | |||
220 | /* If enabled, give a reset impulse */ | ||
221 | gpio_set_value(MX31_3DS_GPIO_CAMERA_RST, 0); | ||
222 | msleep(20); | ||
223 | gpio_set_value(MX31_3DS_GPIO_CAMERA_RST, 1); | ||
224 | msleep(100); | ||
225 | |||
226 | out: | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static struct i2c_board_info mx31_3ds_i2c_camera = { | ||
231 | I2C_BOARD_INFO("ov2640", 0x30), | ||
232 | }; | ||
233 | |||
234 | static struct regulator_bulk_data mx31_3ds_camera_regs[] = { | ||
235 | { .supply = "cmos_vcore" }, | ||
236 | { .supply = "cmos_2v8" }, | ||
237 | }; | ||
238 | |||
239 | static struct soc_camera_link iclink_ov2640 = { | ||
240 | .bus_id = 0, | ||
241 | .board_info = &mx31_3ds_i2c_camera, | ||
242 | .i2c_adapter_id = 0, | ||
243 | .power = mx31_3ds_camera_power, | ||
244 | .regulators = mx31_3ds_camera_regs, | ||
245 | .num_regulators = ARRAY_SIZE(mx31_3ds_camera_regs), | ||
246 | }; | ||
247 | |||
248 | static struct platform_device mx31_3ds_ov2640 = { | ||
249 | .name = "soc-camera-pdrv", | ||
250 | .id = 0, | ||
251 | .dev = { | ||
252 | .platform_data = &iclink_ov2640, | ||
253 | }, | ||
254 | }; | ||
255 | |||
256 | /* | ||
257 | * FB support | 144 | * FB support |
258 | */ | 145 | */ |
259 | static const struct fb_videomode fb_modedb[] = { | 146 | static const struct fb_videomode fb_modedb[] = { |
@@ -410,7 +297,6 @@ static struct regulator_init_data vmmc2_init = { | |||
410 | 297 | ||
411 | static struct regulator_consumer_supply vmmc1_consumers[] = { | 298 | static struct regulator_consumer_supply vmmc1_consumers[] = { |
412 | REGULATOR_SUPPLY("vcore", "spi0.0"), | 299 | REGULATOR_SUPPLY("vcore", "spi0.0"), |
413 | REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), | ||
414 | }; | 300 | }; |
415 | 301 | ||
416 | static struct regulator_init_data vmmc1_init = { | 302 | static struct regulator_init_data vmmc1_init = { |
@@ -441,22 +327,6 @@ static struct regulator_init_data vgen_init = { | |||
441 | .consumer_supplies = vgen_consumers, | 327 | .consumer_supplies = vgen_consumers, |
442 | }; | 328 | }; |
443 | 329 | ||
444 | static struct regulator_consumer_supply vvib_consumers[] = { | ||
445 | REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"), | ||
446 | }; | ||
447 | |||
448 | static struct regulator_init_data vvib_init = { | ||
449 | .constraints = { | ||
450 | .min_uV = 1300000, | ||
451 | .max_uV = 1300000, | ||
452 | .apply_uV = 1, | ||
453 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
454 | REGULATOR_CHANGE_STATUS, | ||
455 | }, | ||
456 | .num_consumer_supplies = ARRAY_SIZE(vvib_consumers), | ||
457 | .consumer_supplies = vvib_consumers, | ||
458 | }; | ||
459 | |||
460 | static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = { | 330 | static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = { |
461 | { | 331 | { |
462 | .id = MC13783_REG_PWGT1SPI, /* Power Gate for ARM core. */ | 332 | .id = MC13783_REG_PWGT1SPI, /* Power Gate for ARM core. */ |
@@ -480,9 +350,6 @@ static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = { | |||
480 | }, { | 350 | }, { |
481 | .id = MC13783_REG_VGEN, /* Power LCD */ | 351 | .id = MC13783_REG_VGEN, /* Power LCD */ |
482 | .init_data = &vgen_init, | 352 | .init_data = &vgen_init, |
483 | }, { | ||
484 | .id = MC13783_REG_VVIB, /* Power CMOS */ | ||
485 | .init_data = &vvib_init, | ||
486 | }, | 353 | }, |
487 | }; | 354 | }; |
488 | 355 | ||
@@ -688,10 +555,6 @@ static const struct imxi2c_platform_data mx31_3ds_i2c0_data __initconst = { | |||
688 | .bitrate = 100000, | 555 | .bitrate = 100000, |
689 | }; | 556 | }; |
690 | 557 | ||
691 | static struct platform_device *devices[] __initdata = { | ||
692 | &mx31_3ds_ov2640, | ||
693 | }; | ||
694 | |||
695 | static void __init mx31_3ds_init(void) | 558 | static void __init mx31_3ds_init(void) |
696 | { | 559 | { |
697 | imx31_soc_init(); | 560 | imx31_soc_init(); |
@@ -723,14 +586,10 @@ static void __init mx31_3ds_init(void) | |||
723 | 586 | ||
724 | static void __init mx31_3ds_late(void) | 587 | static void __init mx31_3ds_late(void) |
725 | { | 588 | { |
726 | int ret; | ||
727 | |||
728 | mx31_3ds_spi_devs[0].irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); | 589 | mx31_3ds_spi_devs[0].irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); |
729 | spi_register_board_info(mx31_3ds_spi_devs, | 590 | spi_register_board_info(mx31_3ds_spi_devs, |
730 | ARRAY_SIZE(mx31_3ds_spi_devs)); | 591 | ARRAY_SIZE(mx31_3ds_spi_devs)); |
731 | 592 | ||
732 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
733 | |||
734 | mx31_3ds_usbotg_init(); | 593 | mx31_3ds_usbotg_init(); |
735 | if (otg_mode_host) { | 594 | if (otg_mode_host) { |
736 | otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | | 595 | otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
@@ -751,17 +610,6 @@ static void __init mx31_3ds_late(void) | |||
751 | "devices on the debug board are unusable.\n"); | 610 | "devices on the debug board are unusable.\n"); |
752 | 611 | ||
753 | imx31_add_mxc_mmc(0, &sdhc1_pdata); | 612 | imx31_add_mxc_mmc(0, &sdhc1_pdata); |
754 | |||
755 | /* CSI */ | ||
756 | /* Camera power: default - off */ | ||
757 | ret = gpio_request_array(mx31_3ds_camera_gpios, | ||
758 | ARRAY_SIZE(mx31_3ds_camera_gpios)); | ||
759 | if (ret) { | ||
760 | pr_err("Failed to request camera gpios"); | ||
761 | iclink_ov2640.power = NULL; | ||
762 | } | ||
763 | |||
764 | mx31_3ds_init_camera(); | ||
765 | } | 613 | } |
766 | 614 | ||
767 | static void __init mx31_3ds_timer_init(void) | 615 | static void __init mx31_3ds_timer_init(void) |
@@ -769,13 +617,6 @@ static void __init mx31_3ds_timer_init(void) | |||
769 | mx31_clocks_init(26000000); | 617 | mx31_clocks_init(26000000); |
770 | } | 618 | } |
771 | 619 | ||
772 | static void __init mx31_3ds_reserve(void) | ||
773 | { | ||
774 | /* reserve MX31_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */ | ||
775 | mx3_camera_base = arm_memblock_steal(MX31_3DS_CAMERA_BUF_SIZE, | ||
776 | MX31_3DS_CAMERA_BUF_SIZE); | ||
777 | } | ||
778 | |||
779 | MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)") | 620 | MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)") |
780 | /* Maintainer: Freescale Semiconductor, Inc. */ | 621 | /* Maintainer: Freescale Semiconductor, Inc. */ |
781 | .atag_offset = 0x100, | 622 | .atag_offset = 0x100, |
@@ -785,6 +626,5 @@ MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)") | |||
785 | .init_time = mx31_3ds_timer_init, | 626 | .init_time = mx31_3ds_timer_init, |
786 | .init_machine = mx31_3ds_init, | 627 | .init_machine = mx31_3ds_init, |
787 | .init_late = mx31_3ds_late, | 628 | .init_late = mx31_3ds_late, |
788 | .reserve = mx31_3ds_reserve, | ||
789 | .restart = mxc_restart, | 629 | .restart = mxc_restart, |
790 | MACHINE_END | 630 | MACHINE_END |
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c index c8c2e0956048..1c33a6ce326c 100644 --- a/arch/arm/mach-imx/mach-mx35_3ds.c +++ b/arch/arm/mach-imx/mach-mx35_3ds.c | |||
@@ -41,12 +41,9 @@ | |||
41 | #include <asm/mach/arch.h> | 41 | #include <asm/mach/arch.h> |
42 | #include <asm/mach/time.h> | 42 | #include <asm/mach/time.h> |
43 | #include <asm/mach/map.h> | 43 | #include <asm/mach/map.h> |
44 | #include <asm/memblock.h> | ||
45 | 44 | ||
46 | #include <video/platform_lcd.h> | 45 | #include <video/platform_lcd.h> |
47 | 46 | ||
48 | #include <media/soc_camera.h> | ||
49 | |||
50 | #include "3ds_debugboard.h" | 47 | #include "3ds_debugboard.h" |
51 | #include "common.h" | 48 | #include "common.h" |
52 | #include "devices-imx35.h" | 49 | #include "devices-imx35.h" |
@@ -233,83 +230,10 @@ static const iomux_v3_cfg_t mx35pdk_pads[] __initconst = { | |||
233 | MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, | 230 | MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, |
234 | MX35_PAD_D3_REV__IPU_DISPB_D3_REV, | 231 | MX35_PAD_D3_REV__IPU_DISPB_D3_REV, |
235 | MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, | 232 | MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, |
236 | /* CSI */ | ||
237 | MX35_PAD_TX1__IPU_CSI_D_6, | ||
238 | MX35_PAD_TX0__IPU_CSI_D_7, | ||
239 | MX35_PAD_CSI_D8__IPU_CSI_D_8, | ||
240 | MX35_PAD_CSI_D9__IPU_CSI_D_9, | ||
241 | MX35_PAD_CSI_D10__IPU_CSI_D_10, | ||
242 | MX35_PAD_CSI_D11__IPU_CSI_D_11, | ||
243 | MX35_PAD_CSI_D12__IPU_CSI_D_12, | ||
244 | MX35_PAD_CSI_D13__IPU_CSI_D_13, | ||
245 | MX35_PAD_CSI_D14__IPU_CSI_D_14, | ||
246 | MX35_PAD_CSI_D15__IPU_CSI_D_15, | ||
247 | MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC, | ||
248 | MX35_PAD_CSI_MCLK__IPU_CSI_MCLK, | ||
249 | MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK, | ||
250 | MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC, | ||
251 | /*PMIC IRQ*/ | 233 | /*PMIC IRQ*/ |
252 | MX35_PAD_GPIO2_0__GPIO2_0, | 234 | MX35_PAD_GPIO2_0__GPIO2_0, |
253 | }; | 235 | }; |
254 | 236 | ||
255 | /* | ||
256 | * Camera support | ||
257 | */ | ||
258 | static phys_addr_t mx3_camera_base __initdata; | ||
259 | #define MX35_3DS_CAMERA_BUF_SIZE SZ_8M | ||
260 | |||
261 | static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = { | ||
262 | .flags = MX3_CAMERA_DATAWIDTH_8, | ||
263 | .mclk_10khz = 2000, | ||
264 | }; | ||
265 | |||
266 | static int __init imx35_3ds_init_camera(void) | ||
267 | { | ||
268 | int dma, ret = -ENOMEM; | ||
269 | struct platform_device *pdev = | ||
270 | imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata); | ||
271 | |||
272 | if (IS_ERR(pdev)) | ||
273 | return PTR_ERR(pdev); | ||
274 | |||
275 | if (!mx3_camera_base) | ||
276 | goto err; | ||
277 | |||
278 | dma = dma_declare_coherent_memory(&pdev->dev, | ||
279 | mx3_camera_base, mx3_camera_base, | ||
280 | MX35_3DS_CAMERA_BUF_SIZE, | ||
281 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
282 | |||
283 | if (!(dma & DMA_MEMORY_MAP)) | ||
284 | goto err; | ||
285 | |||
286 | ret = platform_device_add(pdev); | ||
287 | if (ret) | ||
288 | err: | ||
289 | platform_device_put(pdev); | ||
290 | |||
291 | return ret; | ||
292 | } | ||
293 | |||
294 | static struct i2c_board_info mx35_3ds_i2c_camera = { | ||
295 | I2C_BOARD_INFO("ov2640", 0x30), | ||
296 | }; | ||
297 | |||
298 | static struct soc_camera_link iclink_ov2640 = { | ||
299 | .bus_id = 0, | ||
300 | .board_info = &mx35_3ds_i2c_camera, | ||
301 | .i2c_adapter_id = 0, | ||
302 | .power = NULL, | ||
303 | }; | ||
304 | |||
305 | static struct platform_device mx35_3ds_ov2640 = { | ||
306 | .name = "soc-camera-pdrv", | ||
307 | .id = 0, | ||
308 | .dev = { | ||
309 | .platform_data = &iclink_ov2640, | ||
310 | }, | ||
311 | }; | ||
312 | |||
313 | static struct regulator_consumer_supply sw1_consumers[] = { | 237 | static struct regulator_consumer_supply sw1_consumers[] = { |
314 | { | 238 | { |
315 | .supply = "cpu_vcc", | 239 | .supply = "cpu_vcc", |
@@ -321,10 +245,6 @@ static struct regulator_consumer_supply vcam_consumers[] = { | |||
321 | REGULATOR_SUPPLY("VDDA", "0-000a"), | 245 | REGULATOR_SUPPLY("VDDA", "0-000a"), |
322 | }; | 246 | }; |
323 | 247 | ||
324 | static struct regulator_consumer_supply vaudio_consumers[] = { | ||
325 | REGULATOR_SUPPLY("cmos_vio", "soc-camera-pdrv.0"), | ||
326 | }; | ||
327 | |||
328 | static struct regulator_init_data sw1_init = { | 248 | static struct regulator_init_data sw1_init = { |
329 | .constraints = { | 249 | .constraints = { |
330 | .name = "SW1", | 250 | .name = "SW1", |
@@ -405,18 +325,6 @@ static struct regulator_init_data vvideo_init = { | |||
405 | } | 325 | } |
406 | }; | 326 | }; |
407 | 327 | ||
408 | static struct regulator_init_data vaudio_init = { | ||
409 | .constraints = { | ||
410 | .name = "VAUDIO", | ||
411 | .min_uV = 2300000, | ||
412 | .max_uV = 3000000, | ||
413 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
414 | .boot_on = 1 | ||
415 | }, | ||
416 | .num_consumer_supplies = ARRAY_SIZE(vaudio_consumers), | ||
417 | .consumer_supplies = vaudio_consumers, | ||
418 | }; | ||
419 | |||
420 | static struct regulator_init_data vcam_init = { | 328 | static struct regulator_init_data vcam_init = { |
421 | .constraints = { | 329 | .constraints = { |
422 | .name = "VCAM", | 330 | .name = "VCAM", |
@@ -460,7 +368,6 @@ static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = { | |||
460 | { .id = MC13892_VDIG, .init_data = &vdig_init }, | 368 | { .id = MC13892_VDIG, .init_data = &vdig_init }, |
461 | { .id = MC13892_VUSB2, .init_data = &vusb2_init }, | 369 | { .id = MC13892_VUSB2, .init_data = &vusb2_init }, |
462 | { .id = MC13892_VVIDEO, .init_data = &vvideo_init }, | 370 | { .id = MC13892_VVIDEO, .init_data = &vvideo_init }, |
463 | { .id = MC13892_VAUDIO, .init_data = &vaudio_init }, | ||
464 | { .id = MC13892_VCAM, .init_data = &vcam_init }, | 371 | { .id = MC13892_VCAM, .init_data = &vcam_init }, |
465 | { .id = MC13892_VGEN1, .init_data = &vgen1_init }, | 372 | { .id = MC13892_VGEN1, .init_data = &vgen1_init }, |
466 | { .id = MC13892_VGEN2, .init_data = &vgen2_init }, | 373 | { .id = MC13892_VGEN2, .init_data = &vgen2_init }, |
@@ -583,8 +490,6 @@ static void __init mx35_3ds_init(void) | |||
583 | 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds)); | 490 | 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds)); |
584 | 491 | ||
585 | imx35_add_ipu_core(); | 492 | imx35_add_ipu_core(); |
586 | platform_device_register(&mx35_3ds_ov2640); | ||
587 | imx35_3ds_init_camera(); | ||
588 | } | 493 | } |
589 | 494 | ||
590 | static void __init mx35_3ds_late_init(void) | 495 | static void __init mx35_3ds_late_init(void) |
@@ -607,13 +512,6 @@ static void __init mx35pdk_timer_init(void) | |||
607 | mx35_clocks_init(); | 512 | mx35_clocks_init(); |
608 | } | 513 | } |
609 | 514 | ||
610 | static void __init mx35_3ds_reserve(void) | ||
611 | { | ||
612 | /* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */ | ||
613 | mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE, | ||
614 | MX35_3DS_CAMERA_BUF_SIZE); | ||
615 | } | ||
616 | |||
617 | MACHINE_START(MX35_3DS, "Freescale MX35PDK") | 515 | MACHINE_START(MX35_3DS, "Freescale MX35PDK") |
618 | /* Maintainer: Freescale Semiconductor, Inc */ | 516 | /* Maintainer: Freescale Semiconductor, Inc */ |
619 | .atag_offset = 0x100, | 517 | .atag_offset = 0x100, |
@@ -623,6 +521,5 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK") | |||
623 | .init_time = mx35pdk_timer_init, | 521 | .init_time = mx35pdk_timer_init, |
624 | .init_machine = mx35_3ds_init, | 522 | .init_machine = mx35_3ds_init, |
625 | .init_late = mx35_3ds_late_init, | 523 | .init_late = mx35_3ds_late_init, |
626 | .reserve = mx35_3ds_reserve, | ||
627 | .restart = mxc_restart, | 524 | .restart = mxc_restart, |
628 | MACHINE_END | 525 | MACHINE_END |
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c index 9f0f55b0422c..b787ba6897e4 100644 --- a/arch/arm/mach-imx/mach-pcm037.c +++ b/arch/arm/mach-imx/mach-pcm037.c | |||
@@ -31,17 +31,13 @@ | |||
31 | #include <linux/usb/otg.h> | 31 | #include <linux/usb/otg.h> |
32 | #include <linux/usb/ulpi.h> | 32 | #include <linux/usb/ulpi.h> |
33 | #include <linux/gfp.h> | 33 | #include <linux/gfp.h> |
34 | #include <linux/memblock.h> | ||
35 | #include <linux/regulator/machine.h> | 34 | #include <linux/regulator/machine.h> |
36 | #include <linux/regulator/fixed.h> | 35 | #include <linux/regulator/fixed.h> |
37 | 36 | ||
38 | #include <media/soc_camera.h> | ||
39 | |||
40 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
41 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
42 | #include <asm/mach/time.h> | 39 | #include <asm/mach/time.h> |
43 | #include <asm/mach/map.h> | 40 | #include <asm/mach/map.h> |
44 | #include <asm/memblock.h> | ||
45 | 41 | ||
46 | #include "common.h" | 42 | #include "common.h" |
47 | #include "devices-imx31.h" | 43 | #include "devices-imx31.h" |
@@ -150,22 +146,6 @@ static unsigned int pcm037_pins[] = { | |||
150 | MX31_PIN_D3_SPL__D3_SPL, | 146 | MX31_PIN_D3_SPL__D3_SPL, |
151 | MX31_PIN_D3_CLS__D3_CLS, | 147 | MX31_PIN_D3_CLS__D3_CLS, |
152 | MX31_PIN_LCS0__GPIO3_23, | 148 | MX31_PIN_LCS0__GPIO3_23, |
153 | /* CSI */ | ||
154 | IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_GPIO), | ||
155 | MX31_PIN_CSI_D6__CSI_D6, | ||
156 | MX31_PIN_CSI_D7__CSI_D7, | ||
157 | MX31_PIN_CSI_D8__CSI_D8, | ||
158 | MX31_PIN_CSI_D9__CSI_D9, | ||
159 | MX31_PIN_CSI_D10__CSI_D10, | ||
160 | MX31_PIN_CSI_D11__CSI_D11, | ||
161 | MX31_PIN_CSI_D12__CSI_D12, | ||
162 | MX31_PIN_CSI_D13__CSI_D13, | ||
163 | MX31_PIN_CSI_D14__CSI_D14, | ||
164 | MX31_PIN_CSI_D15__CSI_D15, | ||
165 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, | ||
166 | MX31_PIN_CSI_MCLK__CSI_MCLK, | ||
167 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, | ||
168 | MX31_PIN_CSI_VSYNC__CSI_VSYNC, | ||
169 | /* GPIO */ | 149 | /* GPIO */ |
170 | IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO), | 150 | IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO), |
171 | /* OTG */ | 151 | /* OTG */ |
@@ -289,34 +269,6 @@ static struct at24_platform_data board_eeprom = { | |||
289 | .flags = AT24_FLAG_ADDR16, | 269 | .flags = AT24_FLAG_ADDR16, |
290 | }; | 270 | }; |
291 | 271 | ||
292 | static int pcm037_camera_power(struct device *dev, int on) | ||
293 | { | ||
294 | /* disable or enable the camera in X7 or X8 PCM970 connector */ | ||
295 | gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), !on); | ||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | static struct i2c_board_info pcm037_i2c_camera[] = { | ||
300 | { | ||
301 | I2C_BOARD_INFO("mt9t031", 0x5d), | ||
302 | }, { | ||
303 | I2C_BOARD_INFO("mt9v022", 0x48), | ||
304 | }, | ||
305 | }; | ||
306 | |||
307 | static struct soc_camera_link iclink_mt9v022 = { | ||
308 | .bus_id = 0, /* Must match with the camera ID */ | ||
309 | .board_info = &pcm037_i2c_camera[1], | ||
310 | .i2c_adapter_id = 2, | ||
311 | }; | ||
312 | |||
313 | static struct soc_camera_link iclink_mt9t031 = { | ||
314 | .bus_id = 0, /* Must match with the camera ID */ | ||
315 | .power = pcm037_camera_power, | ||
316 | .board_info = &pcm037_i2c_camera[0], | ||
317 | .i2c_adapter_id = 2, | ||
318 | }; | ||
319 | |||
320 | static struct i2c_board_info pcm037_i2c_devices[] = { | 272 | static struct i2c_board_info pcm037_i2c_devices[] = { |
321 | { | 273 | { |
322 | I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ | 274 | I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ |
@@ -326,22 +278,6 @@ static struct i2c_board_info pcm037_i2c_devices[] = { | |||
326 | } | 278 | } |
327 | }; | 279 | }; |
328 | 280 | ||
329 | static struct platform_device pcm037_mt9t031 = { | ||
330 | .name = "soc-camera-pdrv", | ||
331 | .id = 0, | ||
332 | .dev = { | ||
333 | .platform_data = &iclink_mt9t031, | ||
334 | }, | ||
335 | }; | ||
336 | |||
337 | static struct platform_device pcm037_mt9v022 = { | ||
338 | .name = "soc-camera-pdrv", | ||
339 | .id = 1, | ||
340 | .dev = { | ||
341 | .platform_data = &iclink_mt9v022, | ||
342 | }, | ||
343 | }; | ||
344 | |||
345 | /* Not connected by default */ | 281 | /* Not connected by default */ |
346 | #ifdef PCM970_SDHC_RW_SWITCH | 282 | #ifdef PCM970_SDHC_RW_SWITCH |
347 | static int pcm970_sdhc1_get_ro(struct device *dev) | 283 | static int pcm970_sdhc1_get_ro(struct device *dev) |
@@ -403,42 +339,9 @@ static const struct imxmmc_platform_data sdhc_pdata __initconst = { | |||
403 | .exit = pcm970_sdhc1_exit, | 339 | .exit = pcm970_sdhc1_exit, |
404 | }; | 340 | }; |
405 | 341 | ||
406 | struct mx3_camera_pdata camera_pdata __initdata = { | ||
407 | .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, | ||
408 | .mclk_10khz = 2000, | ||
409 | }; | ||
410 | |||
411 | static phys_addr_t mx3_camera_base __initdata; | ||
412 | #define MX3_CAMERA_BUF_SIZE SZ_4M | ||
413 | |||
414 | static int __init pcm037_init_camera(void) | ||
415 | { | ||
416 | int dma, ret = -ENOMEM; | ||
417 | struct platform_device *pdev = imx31_alloc_mx3_camera(&camera_pdata); | ||
418 | |||
419 | if (IS_ERR(pdev)) | ||
420 | return PTR_ERR(pdev); | ||
421 | |||
422 | dma = dma_declare_coherent_memory(&pdev->dev, | ||
423 | mx3_camera_base, mx3_camera_base, | ||
424 | MX3_CAMERA_BUF_SIZE, | ||
425 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
426 | if (!(dma & DMA_MEMORY_MAP)) | ||
427 | goto err; | ||
428 | |||
429 | ret = platform_device_add(pdev); | ||
430 | if (ret) | ||
431 | err: | ||
432 | platform_device_put(pdev); | ||
433 | |||
434 | return ret; | ||
435 | } | ||
436 | |||
437 | static struct platform_device *devices[] __initdata = { | 342 | static struct platform_device *devices[] __initdata = { |
438 | &pcm037_flash, | 343 | &pcm037_flash, |
439 | &pcm037_sram_device, | 344 | &pcm037_sram_device, |
440 | &pcm037_mt9t031, | ||
441 | &pcm037_mt9v022, | ||
442 | }; | 345 | }; |
443 | 346 | ||
444 | static const struct fb_videomode fb_modedb[] = { | 347 | static const struct fb_videomode fb_modedb[] = { |
@@ -651,13 +554,6 @@ static void __init pcm037_timer_init(void) | |||
651 | mx31_clocks_init(26000000); | 554 | mx31_clocks_init(26000000); |
652 | } | 555 | } |
653 | 556 | ||
654 | static void __init pcm037_reserve(void) | ||
655 | { | ||
656 | /* reserve 4 MiB for mx3-camera */ | ||
657 | mx3_camera_base = arm_memblock_steal(MX3_CAMERA_BUF_SIZE, | ||
658 | MX3_CAMERA_BUF_SIZE); | ||
659 | } | ||
660 | |||
661 | static void __init pcm037_init_late(void) | 557 | static void __init pcm037_init_late(void) |
662 | { | 558 | { |
663 | int ret; | 559 | int ret; |
@@ -677,16 +573,6 @@ static void __init pcm037_init_late(void) | |||
677 | 573 | ||
678 | imx31_add_mxc_mmc(0, &sdhc_pdata); | 574 | imx31_add_mxc_mmc(0, &sdhc_pdata); |
679 | 575 | ||
680 | /* CSI */ | ||
681 | /* Camera power: default - off */ | ||
682 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), "mt9t031-power"); | ||
683 | if (!ret) | ||
684 | gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1); | ||
685 | else | ||
686 | iclink_mt9t031.power = NULL; | ||
687 | |||
688 | pcm037_init_camera(); | ||
689 | |||
690 | pcm970_sja1000_resources[1].start = | 576 | pcm970_sja1000_resources[1].start = |
691 | gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105))); | 577 | gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105))); |
692 | pcm970_sja1000_resources[1].end = | 578 | pcm970_sja1000_resources[1].end = |
@@ -699,7 +585,6 @@ static void __init pcm037_init_late(void) | |||
699 | MACHINE_START(PCM037, "Phytec Phycore pcm037") | 585 | MACHINE_START(PCM037, "Phytec Phycore pcm037") |
700 | /* Maintainer: Pengutronix */ | 586 | /* Maintainer: Pengutronix */ |
701 | .atag_offset = 0x100, | 587 | .atag_offset = 0x100, |
702 | .reserve = pcm037_reserve, | ||
703 | .map_io = mx31_map_io, | 588 | .map_io = mx31_map_io, |
704 | .init_early = imx31_init_early, | 589 | .init_early = imx31_init_early, |
705 | .init_irq = mx31_init_irq, | 590 | .init_irq = mx31_init_irq, |
diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c index 2e895a82a6eb..922d49175cb4 100644 --- a/arch/arm/mach-imx/mx31moboard-marxbot.c +++ b/arch/arm/mach-imx/mx31moboard-marxbot.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #include <linux/usb/otg.h> | 25 | #include <linux/usb/otg.h> |
26 | 26 | ||
27 | #include <media/soc_camera.h> | ||
28 | |||
29 | #include "common.h" | 27 | #include "common.h" |
30 | #include "devices-imx31.h" | 28 | #include "devices-imx31.h" |
31 | #include "ehci.h" | 29 | #include "ehci.h" |
@@ -39,17 +37,6 @@ static unsigned int marxbot_pins[] = { | |||
39 | MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0, | 37 | MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0, |
40 | MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, | 38 | MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, |
41 | MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, | 39 | MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, |
42 | /* CSI */ | ||
43 | MX31_PIN_CSI_D6__CSI_D6, MX31_PIN_CSI_D7__CSI_D7, | ||
44 | MX31_PIN_CSI_D8__CSI_D8, MX31_PIN_CSI_D9__CSI_D9, | ||
45 | MX31_PIN_CSI_D10__CSI_D10, MX31_PIN_CSI_D11__CSI_D11, | ||
46 | MX31_PIN_CSI_D12__CSI_D12, MX31_PIN_CSI_D13__CSI_D13, | ||
47 | MX31_PIN_CSI_D14__CSI_D14, MX31_PIN_CSI_D15__CSI_D15, | ||
48 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, MX31_PIN_CSI_MCLK__CSI_MCLK, | ||
49 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC, | ||
50 | MX31_PIN_CSI_D4__GPIO3_4, MX31_PIN_CSI_D5__GPIO3_5, | ||
51 | MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1, | ||
52 | MX31_PIN_TXD2__GPIO1_28, | ||
53 | /* dsPIC resets */ | 40 | /* dsPIC resets */ |
54 | MX31_PIN_STXD5__GPIO1_21, MX31_PIN_SRXD5__GPIO1_22, | 41 | MX31_PIN_STXD5__GPIO1_21, MX31_PIN_SRXD5__GPIO1_22, |
55 | /*battery detection */ | 42 | /*battery detection */ |
@@ -143,82 +130,6 @@ static struct spi_board_info marxbot_spi_board_info[] __initdata = { | |||
143 | }, | 130 | }, |
144 | }; | 131 | }; |
145 | 132 | ||
146 | #define TURRETCAM_POWER IOMUX_TO_GPIO(MX31_PIN_GPIO3_1) | ||
147 | #define BASECAM_POWER IOMUX_TO_GPIO(MX31_PIN_CSI_D5) | ||
148 | #define TURRETCAM_RST_B IOMUX_TO_GPIO(MX31_PIN_GPIO3_0) | ||
149 | #define BASECAM_RST_B IOMUX_TO_GPIO(MX31_PIN_CSI_D4) | ||
150 | #define CAM_CHOICE IOMUX_TO_GPIO(MX31_PIN_TXD2) | ||
151 | |||
152 | static int marxbot_basecam_power(struct device *dev, int on) | ||
153 | { | ||
154 | gpio_set_value(BASECAM_POWER, !on); | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static int marxbot_basecam_reset(struct device *dev) | ||
159 | { | ||
160 | gpio_set_value(BASECAM_RST_B, 0); | ||
161 | udelay(100); | ||
162 | gpio_set_value(BASECAM_RST_B, 1); | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | static struct i2c_board_info marxbot_i2c_devices[] = { | ||
167 | { | ||
168 | I2C_BOARD_INFO("mt9t031", 0x5d), | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static struct soc_camera_link base_iclink = { | ||
173 | .bus_id = 0, /* Must match with the camera ID */ | ||
174 | .power = marxbot_basecam_power, | ||
175 | .reset = marxbot_basecam_reset, | ||
176 | .board_info = &marxbot_i2c_devices[0], | ||
177 | .i2c_adapter_id = 0, | ||
178 | }; | ||
179 | |||
180 | static struct platform_device marxbot_camera[] = { | ||
181 | { | ||
182 | .name = "soc-camera-pdrv", | ||
183 | .id = 0, | ||
184 | .dev = { | ||
185 | .platform_data = &base_iclink, | ||
186 | }, | ||
187 | }, | ||
188 | }; | ||
189 | |||
190 | static struct platform_device *marxbot_cameras[] __initdata = { | ||
191 | &marxbot_camera[0], | ||
192 | }; | ||
193 | |||
194 | static int __init marxbot_cam_init(void) | ||
195 | { | ||
196 | int ret = gpio_request(CAM_CHOICE, "cam-choice"); | ||
197 | if (ret) | ||
198 | return ret; | ||
199 | gpio_direction_output(CAM_CHOICE, 0); | ||
200 | |||
201 | ret = gpio_request(BASECAM_RST_B, "basecam-reset"); | ||
202 | if (ret) | ||
203 | return ret; | ||
204 | gpio_direction_output(BASECAM_RST_B, 1); | ||
205 | ret = gpio_request(BASECAM_POWER, "basecam-standby"); | ||
206 | if (ret) | ||
207 | return ret; | ||
208 | gpio_direction_output(BASECAM_POWER, 0); | ||
209 | |||
210 | ret = gpio_request(TURRETCAM_RST_B, "turretcam-reset"); | ||
211 | if (ret) | ||
212 | return ret; | ||
213 | gpio_direction_output(TURRETCAM_RST_B, 1); | ||
214 | ret = gpio_request(TURRETCAM_POWER, "turretcam-standby"); | ||
215 | if (ret) | ||
216 | return ret; | ||
217 | gpio_direction_output(TURRETCAM_POWER, 0); | ||
218 | |||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | #define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1) | 133 | #define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1) |
223 | #define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1) | 134 | #define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1) |
224 | #define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1) | 135 | #define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1) |
@@ -356,9 +267,6 @@ void __init mx31moboard_marxbot_init(void) | |||
356 | spi_register_board_info(marxbot_spi_board_info, | 267 | spi_register_board_info(marxbot_spi_board_info, |
357 | ARRAY_SIZE(marxbot_spi_board_info)); | 268 | ARRAY_SIZE(marxbot_spi_board_info)); |
358 | 269 | ||
359 | marxbot_cam_init(); | ||
360 | platform_add_devices(marxbot_cameras, ARRAY_SIZE(marxbot_cameras)); | ||
361 | |||
362 | /* battery present pin */ | 270 | /* battery present pin */ |
363 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present"); | 271 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present"); |
364 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0)); | 272 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0)); |
diff --git a/arch/arm/mach-imx/mx31moboard-smartbot.c b/arch/arm/mach-imx/mx31moboard-smartbot.c index 89fc35a64448..5cdd7abce515 100644 --- a/arch/arm/mach-imx/mx31moboard-smartbot.c +++ b/arch/arm/mach-imx/mx31moboard-smartbot.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <linux/usb/otg.h> | 23 | #include <linux/usb/otg.h> |
24 | #include <linux/usb/ulpi.h> | 24 | #include <linux/usb/ulpi.h> |
25 | 25 | ||
26 | #include <media/soc_camera.h> | ||
27 | |||
28 | #include "board-mx31moboard.h" | 26 | #include "board-mx31moboard.h" |
29 | #include "common.h" | 27 | #include "common.h" |
30 | #include "devices-imx31.h" | 28 | #include "devices-imx31.h" |
@@ -37,16 +35,6 @@ static unsigned int smartbot_pins[] = { | |||
37 | /* UART1 */ | 35 | /* UART1 */ |
38 | MX31_PIN_CTS2__CTS2, MX31_PIN_RTS2__RTS2, | 36 | MX31_PIN_CTS2__CTS2, MX31_PIN_RTS2__RTS2, |
39 | MX31_PIN_TXD2__TXD2, MX31_PIN_RXD2__RXD2, | 37 | MX31_PIN_TXD2__TXD2, MX31_PIN_RXD2__RXD2, |
40 | /* CSI */ | ||
41 | MX31_PIN_CSI_D4__CSI_D4, MX31_PIN_CSI_D5__CSI_D5, | ||
42 | MX31_PIN_CSI_D6__CSI_D6, MX31_PIN_CSI_D7__CSI_D7, | ||
43 | MX31_PIN_CSI_D8__CSI_D8, MX31_PIN_CSI_D9__CSI_D9, | ||
44 | MX31_PIN_CSI_D10__CSI_D10, MX31_PIN_CSI_D11__CSI_D11, | ||
45 | MX31_PIN_CSI_D12__CSI_D12, MX31_PIN_CSI_D13__CSI_D13, | ||
46 | MX31_PIN_CSI_D14__CSI_D14, MX31_PIN_CSI_D15__CSI_D15, | ||
47 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, MX31_PIN_CSI_MCLK__CSI_MCLK, | ||
48 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC, | ||
49 | MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1, | ||
50 | /* ENABLES */ | 38 | /* ENABLES */ |
51 | MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9, | 39 | MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9, |
52 | MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11, | 40 | MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11, |
@@ -56,65 +44,6 @@ static const struct imxuart_platform_data uart_pdata __initconst = { | |||
56 | .flags = IMXUART_HAVE_RTSCTS, | 44 | .flags = IMXUART_HAVE_RTSCTS, |
57 | }; | 45 | }; |
58 | 46 | ||
59 | #define CAM_POWER IOMUX_TO_GPIO(MX31_PIN_GPIO3_1) | ||
60 | #define CAM_RST_B IOMUX_TO_GPIO(MX31_PIN_GPIO3_0) | ||
61 | |||
62 | static int smartbot_cam_power(struct device *dev, int on) | ||
63 | { | ||
64 | gpio_set_value(CAM_POWER, !on); | ||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | static int smartbot_cam_reset(struct device *dev) | ||
69 | { | ||
70 | gpio_set_value(CAM_RST_B, 0); | ||
71 | udelay(100); | ||
72 | gpio_set_value(CAM_RST_B, 1); | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | static struct i2c_board_info smartbot_i2c_devices[] = { | ||
77 | { | ||
78 | I2C_BOARD_INFO("mt9t031", 0x5d), | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | static struct soc_camera_link base_iclink = { | ||
83 | .bus_id = 0, /* Must match with the camera ID */ | ||
84 | .power = smartbot_cam_power, | ||
85 | .reset = smartbot_cam_reset, | ||
86 | .board_info = &smartbot_i2c_devices[0], | ||
87 | .i2c_adapter_id = 0, | ||
88 | }; | ||
89 | |||
90 | static struct platform_device smartbot_camera[] = { | ||
91 | { | ||
92 | .name = "soc-camera-pdrv", | ||
93 | .id = 0, | ||
94 | .dev = { | ||
95 | .platform_data = &base_iclink, | ||
96 | }, | ||
97 | }, | ||
98 | }; | ||
99 | |||
100 | static struct platform_device *smartbot_cameras[] __initdata = { | ||
101 | &smartbot_camera[0], | ||
102 | }; | ||
103 | |||
104 | static int __init smartbot_cam_init(void) | ||
105 | { | ||
106 | int ret = gpio_request(CAM_RST_B, "cam-reset"); | ||
107 | if (ret) | ||
108 | return ret; | ||
109 | gpio_direction_output(CAM_RST_B, 1); | ||
110 | ret = gpio_request(CAM_POWER, "cam-standby"); | ||
111 | if (ret) | ||
112 | return ret; | ||
113 | gpio_direction_output(CAM_POWER, 0); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static const struct fsl_usb2_platform_data usb_pdata __initconst = { | 47 | static const struct fsl_usb2_platform_data usb_pdata __initconst = { |
119 | .operating_mode = FSL_USB2_DR_DEVICE, | 48 | .operating_mode = FSL_USB2_DR_DEVICE, |
120 | .phy_mode = FSL_USB2_PHY_ULPI, | 49 | .phy_mode = FSL_USB2_PHY_ULPI, |
@@ -201,7 +130,4 @@ void __init mx31moboard_smartbot_init(int board) | |||
201 | } | 130 | } |
202 | 131 | ||
203 | smartbot_resets_init(); | 132 | smartbot_resets_init(); |
204 | |||
205 | smartbot_cam_init(); | ||
206 | platform_add_devices(smartbot_cameras, ARRAY_SIZE(smartbot_cameras)); | ||
207 | } | 133 | } |
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index 13a7d72ee0c4..81ff4327a962 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c | |||
@@ -29,7 +29,7 @@ struct pcie_port { | |||
29 | u8 root_bus_nr; | 29 | u8 root_bus_nr; |
30 | void __iomem *base; | 30 | void __iomem *base; |
31 | spinlock_t conf_lock; | 31 | spinlock_t conf_lock; |
32 | char mem_space_name[16]; | 32 | char mem_space_name[20]; |
33 | struct resource res; | 33 | struct resource res; |
34 | }; | 34 | }; |
35 | 35 | ||
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c index 46c742d3bd41..e62273aacb43 100644 --- a/arch/arm/mach-mvebu/platsmp.c +++ b/arch/arm/mach-mvebu/platsmp.c | |||
@@ -184,3 +184,78 @@ const struct smp_operations armada_xp_smp_ops __initconst = { | |||
184 | 184 | ||
185 | CPU_METHOD_OF_DECLARE(armada_xp_smp, "marvell,armada-xp-smp", | 185 | CPU_METHOD_OF_DECLARE(armada_xp_smp, "marvell,armada-xp-smp", |
186 | &armada_xp_smp_ops); | 186 | &armada_xp_smp_ops); |
187 | |||
188 | #define MV98DX3236_CPU_RESUME_CTRL_REG 0x08 | ||
189 | #define MV98DX3236_CPU_RESUME_ADDR_REG 0x04 | ||
190 | |||
191 | static const struct of_device_id of_mv98dx3236_resume_table[] = { | ||
192 | { | ||
193 | .compatible = "marvell,98dx3336-resume-ctrl", | ||
194 | }, | ||
195 | { /* end of list */ }, | ||
196 | }; | ||
197 | |||
198 | static int mv98dx3236_resume_set_cpu_boot_addr(int hw_cpu, void *boot_addr) | ||
199 | { | ||
200 | struct device_node *np; | ||
201 | void __iomem *base; | ||
202 | WARN_ON(hw_cpu != 1); | ||
203 | |||
204 | np = of_find_matching_node(NULL, of_mv98dx3236_resume_table); | ||
205 | if (!np) | ||
206 | return -ENODEV; | ||
207 | |||
208 | base = of_io_request_and_map(np, 0, of_node_full_name(np)); | ||
209 | of_node_put(np); | ||
210 | if (IS_ERR(base)) | ||
211 | return PTR_ERR(base); | ||
212 | |||
213 | writel(0, base + MV98DX3236_CPU_RESUME_CTRL_REG); | ||
214 | writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG); | ||
215 | |||
216 | iounmap(base); | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static int mv98dx3236_boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
222 | { | ||
223 | int ret, hw_cpu; | ||
224 | |||
225 | hw_cpu = cpu_logical_map(cpu); | ||
226 | set_secondary_cpu_clock(hw_cpu); | ||
227 | mv98dx3236_resume_set_cpu_boot_addr(hw_cpu, | ||
228 | armada_xp_secondary_startup); | ||
229 | |||
230 | /* | ||
231 | * This is needed to wake up CPUs in the offline state after | ||
232 | * using CPU hotplug. | ||
233 | */ | ||
234 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); | ||
235 | |||
236 | /* | ||
237 | * This is needed to take secondary CPUs out of reset on the | ||
238 | * initial boot. | ||
239 | */ | ||
240 | ret = mvebu_cpu_reset_deassert(hw_cpu); | ||
241 | if (ret) { | ||
242 | pr_warn("unable to boot CPU: %d\n", ret); | ||
243 | return ret; | ||
244 | } | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static const struct smp_operations mv98dx3236_smp_ops __initconst = { | ||
250 | .smp_init_cpus = armada_xp_smp_init_cpus, | ||
251 | .smp_prepare_cpus = armada_xp_smp_prepare_cpus, | ||
252 | .smp_boot_secondary = mv98dx3236_boot_secondary, | ||
253 | .smp_secondary_init = armada_xp_secondary_init, | ||
254 | #ifdef CONFIG_HOTPLUG_CPU | ||
255 | .cpu_die = armada_xp_cpu_die, | ||
256 | .cpu_kill = armada_xp_cpu_kill, | ||
257 | #endif | ||
258 | }; | ||
259 | |||
260 | CPU_METHOD_OF_DECLARE(mv98dx3236_smp, "marvell,98dx3236-smp", | ||
261 | &mv98dx3236_smp_ops); | ||
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 4f5fd4a084c0..43e3e188f521 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
@@ -720,26 +720,6 @@ EXPORT_SYMBOL(clk_get_parent); | |||
720 | * OMAP specific clock functions shared between omap1 and omap2 | 720 | * OMAP specific clock functions shared between omap1 and omap2 |
721 | */ | 721 | */ |
722 | 722 | ||
723 | int __initdata mpurate; | ||
724 | |||
725 | /* | ||
726 | * By default we use the rate set by the bootloader. | ||
727 | * You can override this with mpurate= cmdline option. | ||
728 | */ | ||
729 | static int __init omap_clk_setup(char *str) | ||
730 | { | ||
731 | get_option(&str, &mpurate); | ||
732 | |||
733 | if (!mpurate) | ||
734 | return 1; | ||
735 | |||
736 | if (mpurate < 1000) | ||
737 | mpurate *= 1000000; | ||
738 | |||
739 | return 1; | ||
740 | } | ||
741 | __setup("mpurate=", omap_clk_setup); | ||
742 | |||
743 | /* Used for clocks that always have same value as the parent clock */ | 723 | /* Used for clocks that always have same value as the parent clock */ |
744 | unsigned long followparent_recalc(struct clk *clk) | 724 | unsigned long followparent_recalc(struct clk *clk) |
745 | { | 725 | { |
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h index 1e4918a3a5ee..f2d1be211723 100644 --- a/arch/arm/mach-omap1/clock.h +++ b/arch/arm/mach-omap1/clock.h | |||
@@ -173,8 +173,6 @@ struct clk_functions { | |||
173 | void (*clk_disable_unused)(struct clk *clk); | 173 | void (*clk_disable_unused)(struct clk *clk); |
174 | }; | 174 | }; |
175 | 175 | ||
176 | extern int mpurate; | ||
177 | |||
178 | extern int clk_init(struct clk_functions *custom_clocks); | 176 | extern int clk_init(struct clk_functions *custom_clocks); |
179 | extern void clk_preinit(struct clk *clk); | 177 | extern void clk_preinit(struct clk *clk); |
180 | extern int clk_register(struct clk *clk); | 178 | extern int clk_register(struct clk *clk); |
diff --git a/arch/arm/mach-omap1/include/mach/usb.h b/arch/arm/mach-omap1/include/mach/usb.h index a7c5559caef2..eb76628ff843 100644 --- a/arch/arm/mach-omap1/include/mach/usb.h +++ b/arch/arm/mach-omap1/include/mach/usb.h | |||
@@ -10,8 +10,6 @@ | |||
10 | 10 | ||
11 | #include <linux/platform_data/usb-omap1.h> | 11 | #include <linux/platform_data/usb-omap1.h> |
12 | 12 | ||
13 | void omap_otg_init(struct omap_usb_config *config); | ||
14 | |||
15 | #if IS_ENABLED(CONFIG_USB) | 13 | #if IS_ENABLED(CONFIG_USB) |
16 | void omap1_usb_init(struct omap_usb_config *pdata); | 14 | void omap1_usb_init(struct omap_usb_config *pdata); |
17 | #else | 15 | #else |
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c index 2506e598a067..455e2cf2866d 100644 --- a/arch/arm/mach-omap1/usb.c +++ b/arch/arm/mach-omap1/usb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Platform level USB initialization for FS USB OTG controller on omap1 and 24xx | 2 | * Platform level USB initialization for FS USB OTG controller on omap1 |
3 | * | 3 | * |
4 | * Copyright (C) 2004 Texas Instruments, Inc. | 4 | * Copyright (C) 2004 Texas Instruments, Inc. |
5 | * | 5 | * |
@@ -58,11 +58,12 @@ | |||
58 | 58 | ||
59 | #ifdef CONFIG_ARCH_OMAP_OTG | 59 | #ifdef CONFIG_ARCH_OMAP_OTG |
60 | 60 | ||
61 | void __init | 61 | static void __init |
62 | omap_otg_init(struct omap_usb_config *config) | 62 | omap_otg_init(struct omap_usb_config *config) |
63 | { | 63 | { |
64 | u32 syscon; | 64 | u32 syscon; |
65 | int alt_pingroup = 0; | 65 | int alt_pingroup = 0; |
66 | u16 w; | ||
66 | 67 | ||
67 | /* NOTE: no bus or clock setup (yet?) */ | 68 | /* NOTE: no bus or clock setup (yet?) */ |
68 | 69 | ||
@@ -87,39 +88,35 @@ omap_otg_init(struct omap_usb_config *config) | |||
87 | if (config->otg) | 88 | if (config->otg) |
88 | syscon |= OTG_EN; | 89 | syscon |= OTG_EN; |
89 | #endif | 90 | #endif |
90 | if (cpu_class_is_omap1()) | 91 | pr_debug("USB_TRANSCEIVER_CTRL = %03x\n", |
91 | pr_debug("USB_TRANSCEIVER_CTRL = %03x\n", | 92 | omap_readl(USB_TRANSCEIVER_CTRL)); |
92 | omap_readl(USB_TRANSCEIVER_CTRL)); | ||
93 | pr_debug("OTG_SYSCON_2 = %08x\n", omap_readl(OTG_SYSCON_2)); | 93 | pr_debug("OTG_SYSCON_2 = %08x\n", omap_readl(OTG_SYSCON_2)); |
94 | omap_writel(syscon, OTG_SYSCON_2); | 94 | omap_writel(syscon, OTG_SYSCON_2); |
95 | 95 | ||
96 | printk("USB: hmc %d", config->hmc_mode); | 96 | printk("USB: hmc %d", config->hmc_mode); |
97 | if (!alt_pingroup) | 97 | if (!alt_pingroup) |
98 | printk(", usb2 alt %d wires", config->pins[2]); | 98 | pr_cont(", usb2 alt %d wires", config->pins[2]); |
99 | else if (config->pins[0]) | 99 | else if (config->pins[0]) |
100 | printk(", usb0 %d wires%s", config->pins[0], | 100 | pr_cont(", usb0 %d wires%s", config->pins[0], |
101 | is_usb0_device(config) ? " (dev)" : ""); | 101 | is_usb0_device(config) ? " (dev)" : ""); |
102 | if (config->pins[1]) | 102 | if (config->pins[1]) |
103 | printk(", usb1 %d wires", config->pins[1]); | 103 | pr_cont(", usb1 %d wires", config->pins[1]); |
104 | if (!alt_pingroup && config->pins[2]) | 104 | if (!alt_pingroup && config->pins[2]) |
105 | printk(", usb2 %d wires", config->pins[2]); | 105 | pr_cont(", usb2 %d wires", config->pins[2]); |
106 | if (config->otg) | 106 | if (config->otg) |
107 | printk(", Mini-AB on usb%d", config->otg - 1); | 107 | pr_cont(", Mini-AB on usb%d", config->otg - 1); |
108 | printk("\n"); | 108 | pr_cont("\n"); |
109 | 109 | ||
110 | if (cpu_class_is_omap1()) { | 110 | /* leave USB clocks/controllers off until needed */ |
111 | u16 w; | 111 | w = omap_readw(ULPD_SOFT_REQ); |
112 | w &= ~SOFT_USB_CLK_REQ; | ||
113 | omap_writew(w, ULPD_SOFT_REQ); | ||
112 | 114 | ||
113 | /* leave USB clocks/controllers off until needed */ | 115 | w = omap_readw(ULPD_CLOCK_CTRL); |
114 | w = omap_readw(ULPD_SOFT_REQ); | 116 | w &= ~USB_MCLK_EN; |
115 | w &= ~SOFT_USB_CLK_REQ; | 117 | w |= DIS_USB_PVCI_CLK; |
116 | omap_writew(w, ULPD_SOFT_REQ); | 118 | omap_writew(w, ULPD_CLOCK_CTRL); |
117 | 119 | ||
118 | w = omap_readw(ULPD_CLOCK_CTRL); | ||
119 | w &= ~USB_MCLK_EN; | ||
120 | w |= DIS_USB_PVCI_CLK; | ||
121 | omap_writew(w, ULPD_CLOCK_CTRL); | ||
122 | } | ||
123 | syscon = omap_readl(OTG_SYSCON_1); | 120 | syscon = omap_readl(OTG_SYSCON_1); |
124 | syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; | 121 | syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; |
125 | 122 | ||
@@ -166,7 +163,7 @@ omap_otg_init(struct omap_usb_config *config) | |||
166 | } | 163 | } |
167 | 164 | ||
168 | #else | 165 | #else |
169 | void omap_otg_init(struct omap_usb_config *config) {} | 166 | static void omap_otg_init(struct omap_usb_config *config) {} |
170 | #endif | 167 | #endif |
171 | 168 | ||
172 | #if IS_ENABLED(CONFIG_USB_OMAP) | 169 | #if IS_ENABLED(CONFIG_USB_OMAP) |
@@ -573,13 +570,13 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config) | |||
573 | 570 | ||
574 | printk("USB: hmc %d", config->hmc_mode); | 571 | printk("USB: hmc %d", config->hmc_mode); |
575 | if (config->pins[0]) | 572 | if (config->pins[0]) |
576 | printk(", usb0 %d wires%s", config->pins[0], | 573 | pr_cont(", usb0 %d wires%s", config->pins[0], |
577 | is_usb0_device(config) ? " (dev)" : ""); | 574 | is_usb0_device(config) ? " (dev)" : ""); |
578 | if (config->pins[1]) | 575 | if (config->pins[1]) |
579 | printk(", usb1 %d wires", config->pins[1]); | 576 | pr_cont(", usb1 %d wires", config->pins[1]); |
580 | if (config->pins[2]) | 577 | if (config->pins[2]) |
581 | printk(", usb2 %d wires", config->pins[2]); | 578 | pr_cont(", usb2 %d wires", config->pins[2]); |
582 | printk("\n"); | 579 | pr_cont("\n"); |
583 | 580 | ||
584 | /* use DPLL for 48 MHz function clock */ | 581 | /* use DPLL for 48 MHz function clock */ |
585 | pr_debug("APLL %04x DPLL %04x REQ %04x\n", omap_readw(ULPD_APLL_CTRL), | 582 | pr_debug("APLL %04x DPLL %04x REQ %04x\n", omap_readw(ULPD_APLL_CTRL), |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 469894082fea..093458b62c8d 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -7,7 +7,7 @@ ccflags-y := -I$(srctree)/$(src)/include \ | |||
7 | 7 | ||
8 | # Common support | 8 | # Common support |
9 | obj-y := id.o io.o control.o devices.o fb.o timer.o pm.o \ | 9 | obj-y := id.o io.o control.o devices.o fb.o timer.o pm.o \ |
10 | common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ | 10 | common.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ |
11 | omap_device.o omap-headsmp.o sram.o drm.o | 11 | omap_device.o omap-headsmp.o sram.o drm.o |
12 | 12 | ||
13 | hwmod-common = omap_hwmod.o omap_hwmod_reset.o \ | 13 | hwmod-common = omap_hwmod.o omap_hwmod_reset.o \ |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 36d9943205ca..dc9e34e670a2 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -304,7 +304,7 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)") | |||
304 | .init_late = am43xx_init_late, | 304 | .init_late = am43xx_init_late, |
305 | .init_irq = omap_gic_of_init, | 305 | .init_irq = omap_gic_of_init, |
306 | .init_machine = omap_generic_init, | 306 | .init_machine = omap_generic_init, |
307 | .init_time = omap4_local_timer_init, | 307 | .init_time = omap3_gptimer_timer_init, |
308 | .dt_compat = am43_boards_compat, | 308 | .dt_compat = am43_boards_compat, |
309 | .restart = omap44xx_restart, | 309 | .restart = omap44xx_restart, |
310 | MACHINE_END | 310 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index d058125876d8..1270afdcacdf 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -78,8 +78,6 @@ int __init omap2_clk_setup_ll_ops(void) | |||
78 | * OMAP2+ specific clock functions | 78 | * OMAP2+ specific clock functions |
79 | */ | 79 | */ |
80 | 80 | ||
81 | /* Private functions */ | ||
82 | |||
83 | /* Public functions */ | 81 | /* Public functions */ |
84 | 82 | ||
85 | /** | 83 | /** |
@@ -112,65 +110,6 @@ void omap2_init_clk_clkdm(struct clk_hw *hw) | |||
112 | } | 110 | } |
113 | } | 111 | } |
114 | 112 | ||
115 | static int __initdata mpurate; | ||
116 | |||
117 | /* | ||
118 | * By default we use the rate set by the bootloader. | ||
119 | * You can override this with mpurate= cmdline option. | ||
120 | */ | ||
121 | static int __init omap_clk_setup(char *str) | ||
122 | { | ||
123 | get_option(&str, &mpurate); | ||
124 | |||
125 | if (!mpurate) | ||
126 | return 1; | ||
127 | |||
128 | if (mpurate < 1000) | ||
129 | mpurate *= 1000000; | ||
130 | |||
131 | return 1; | ||
132 | } | ||
133 | __setup("mpurate=", omap_clk_setup); | ||
134 | |||
135 | /** | ||
136 | * omap2_clk_print_new_rates - print summary of current clock tree rates | ||
137 | * @hfclkin_ck_name: clk name for the off-chip HF oscillator | ||
138 | * @core_ck_name: clk name for the on-chip CORE_CLK | ||
139 | * @mpu_ck_name: clk name for the ARM MPU clock | ||
140 | * | ||
141 | * Prints a short message to the console with the HFCLKIN oscillator | ||
142 | * rate, the rate of the CORE clock, and the rate of the ARM MPU clock. | ||
143 | * Called by the boot-time MPU rate switching code. XXX This is intended | ||
144 | * to be handled by the OPP layer code in the near future and should be | ||
145 | * removed from the clock code. No return value. | ||
146 | */ | ||
147 | void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name, | ||
148 | const char *core_ck_name, | ||
149 | const char *mpu_ck_name) | ||
150 | { | ||
151 | struct clk *hfclkin_ck, *core_ck, *mpu_ck; | ||
152 | unsigned long hfclkin_rate; | ||
153 | |||
154 | mpu_ck = clk_get(NULL, mpu_ck_name); | ||
155 | if (WARN(IS_ERR(mpu_ck), "clock: failed to get %s.\n", mpu_ck_name)) | ||
156 | return; | ||
157 | |||
158 | core_ck = clk_get(NULL, core_ck_name); | ||
159 | if (WARN(IS_ERR(core_ck), "clock: failed to get %s.\n", core_ck_name)) | ||
160 | return; | ||
161 | |||
162 | hfclkin_ck = clk_get(NULL, hfclkin_ck_name); | ||
163 | if (WARN(IS_ERR(hfclkin_ck), "Failed to get %s.\n", hfclkin_ck_name)) | ||
164 | return; | ||
165 | |||
166 | hfclkin_rate = clk_get_rate(hfclkin_ck); | ||
167 | |||
168 | pr_info("Switched to new clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n", | ||
169 | (hfclkin_rate / 1000000), ((hfclkin_rate / 100000) % 10), | ||
170 | (clk_get_rate(core_ck) / 1000000), | ||
171 | (clk_get_rate(mpu_ck) / 1000000)); | ||
172 | } | ||
173 | |||
174 | /** | 113 | /** |
175 | * ti_clk_init_features - init clock features struct for the SoC | 114 | * ti_clk_init_features - init clock features struct for the SoC |
176 | * | 115 | * |
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 67da640ba1c7..4e66295dca25 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -64,10 +64,6 @@ | |||
64 | #define OMAP4XXX_EN_DPLL_FRBYPASS 0x6 | 64 | #define OMAP4XXX_EN_DPLL_FRBYPASS 0x6 |
65 | #define OMAP4XXX_EN_DPLL_LOCKED 0x7 | 65 | #define OMAP4XXX_EN_DPLL_LOCKED 0x7 |
66 | 66 | ||
67 | void omap2_clk_print_new_rates(const char *hfclkin_ck_name, | ||
68 | const char *core_ck_name, | ||
69 | const char *mpu_ck_name); | ||
70 | |||
71 | extern u16 cpu_mask; | 67 | extern u16 cpu_mask; |
72 | 68 | ||
73 | extern const struct clkops clkops_omap2_dflt_wait; | 69 | extern const struct clkops clkops_omap2_dflt_wait; |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index e71cca0950e9..8fa01c0ecdb2 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -46,8 +46,6 @@ | |||
46 | #define DISPC_CONTROL3 0x0848 | 46 | #define DISPC_CONTROL3 0x0848 |
47 | #define DISPC_IRQSTATUS 0x0018 | 47 | #define DISPC_IRQSTATUS 0x0018 |
48 | 48 | ||
49 | #define DSS_SYSCONFIG 0x10 | ||
50 | #define DSS_SYSSTATUS 0x14 | ||
51 | #define DSS_CONTROL 0x40 | 49 | #define DSS_CONTROL 0x40 |
52 | #define DSS_SDI_CONTROL 0x44 | 50 | #define DSS_SDI_CONTROL 0x44 |
53 | #define DSS_PLL_CONTROL 0x48 | 51 | #define DSS_PLL_CONTROL 0x48 |
@@ -76,36 +74,6 @@ static struct platform_device omap_display_device = { | |||
76 | }, | 74 | }, |
77 | }; | 75 | }; |
78 | 76 | ||
79 | struct omap_dss_hwmod_data { | ||
80 | const char *oh_name; | ||
81 | const char *dev_name; | ||
82 | const int id; | ||
83 | }; | ||
84 | |||
85 | static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initconst = { | ||
86 | { "dss_core", "omapdss_dss", -1 }, | ||
87 | { "dss_dispc", "omapdss_dispc", -1 }, | ||
88 | { "dss_rfbi", "omapdss_rfbi", -1 }, | ||
89 | { "dss_venc", "omapdss_venc", -1 }, | ||
90 | }; | ||
91 | |||
92 | static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initconst = { | ||
93 | { "dss_core", "omapdss_dss", -1 }, | ||
94 | { "dss_dispc", "omapdss_dispc", -1 }, | ||
95 | { "dss_rfbi", "omapdss_rfbi", -1 }, | ||
96 | { "dss_venc", "omapdss_venc", -1 }, | ||
97 | { "dss_dsi1", "omapdss_dsi", 0 }, | ||
98 | }; | ||
99 | |||
100 | static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initconst = { | ||
101 | { "dss_core", "omapdss_dss", -1 }, | ||
102 | { "dss_dispc", "omapdss_dispc", -1 }, | ||
103 | { "dss_rfbi", "omapdss_rfbi", -1 }, | ||
104 | { "dss_dsi1", "omapdss_dsi", 0 }, | ||
105 | { "dss_dsi2", "omapdss_dsi", 1 }, | ||
106 | { "dss_hdmi", "omapdss_hdmi", -1 }, | ||
107 | }; | ||
108 | |||
109 | #define OMAP4_DSIPHY_SYSCON_OFFSET 0x78 | 77 | #define OMAP4_DSIPHY_SYSCON_OFFSET 0x78 |
110 | 78 | ||
111 | static struct regmap *omap4_dsi_mux_syscon; | 79 | static struct regmap *omap4_dsi_mux_syscon; |
@@ -162,104 +130,6 @@ static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput) | |||
162 | return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput); | 130 | return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput); |
163 | } | 131 | } |
164 | 132 | ||
165 | static struct platform_device *create_dss_pdev(const char *pdev_name, | ||
166 | int pdev_id, const char *oh_name, void *pdata, int pdata_len, | ||
167 | struct platform_device *parent) | ||
168 | { | ||
169 | struct platform_device *pdev; | ||
170 | struct omap_device *od; | ||
171 | struct omap_hwmod *ohs[1]; | ||
172 | struct omap_hwmod *oh; | ||
173 | int r; | ||
174 | |||
175 | oh = omap_hwmod_lookup(oh_name); | ||
176 | if (!oh) { | ||
177 | pr_err("Could not look up %s\n", oh_name); | ||
178 | r = -ENODEV; | ||
179 | goto err; | ||
180 | } | ||
181 | |||
182 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
183 | if (!pdev) { | ||
184 | pr_err("Could not create pdev for %s\n", pdev_name); | ||
185 | r = -ENOMEM; | ||
186 | goto err; | ||
187 | } | ||
188 | |||
189 | if (parent != NULL) | ||
190 | pdev->dev.parent = &parent->dev; | ||
191 | |||
192 | if (pdev->id != -1) | ||
193 | dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); | ||
194 | else | ||
195 | dev_set_name(&pdev->dev, "%s", pdev->name); | ||
196 | |||
197 | ohs[0] = oh; | ||
198 | od = omap_device_alloc(pdev, ohs, 1); | ||
199 | if (IS_ERR(od)) { | ||
200 | pr_err("Could not alloc omap_device for %s\n", pdev_name); | ||
201 | r = -ENOMEM; | ||
202 | goto err; | ||
203 | } | ||
204 | |||
205 | r = platform_device_add_data(pdev, pdata, pdata_len); | ||
206 | if (r) { | ||
207 | pr_err("Could not set pdata for %s\n", pdev_name); | ||
208 | goto err; | ||
209 | } | ||
210 | |||
211 | r = omap_device_register(pdev); | ||
212 | if (r) { | ||
213 | pr_err("Could not register omap_device for %s\n", pdev_name); | ||
214 | goto err; | ||
215 | } | ||
216 | |||
217 | return pdev; | ||
218 | |||
219 | err: | ||
220 | return ERR_PTR(r); | ||
221 | } | ||
222 | |||
223 | static struct platform_device *create_simple_dss_pdev(const char *pdev_name, | ||
224 | int pdev_id, void *pdata, int pdata_len, | ||
225 | struct platform_device *parent) | ||
226 | { | ||
227 | struct platform_device *pdev; | ||
228 | int r; | ||
229 | |||
230 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
231 | if (!pdev) { | ||
232 | pr_err("Could not create pdev for %s\n", pdev_name); | ||
233 | r = -ENOMEM; | ||
234 | goto err; | ||
235 | } | ||
236 | |||
237 | if (parent != NULL) | ||
238 | pdev->dev.parent = &parent->dev; | ||
239 | |||
240 | if (pdev->id != -1) | ||
241 | dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); | ||
242 | else | ||
243 | dev_set_name(&pdev->dev, "%s", pdev->name); | ||
244 | |||
245 | r = platform_device_add_data(pdev, pdata, pdata_len); | ||
246 | if (r) { | ||
247 | pr_err("Could not set pdata for %s\n", pdev_name); | ||
248 | goto err; | ||
249 | } | ||
250 | |||
251 | r = platform_device_add(pdev); | ||
252 | if (r) { | ||
253 | pr_err("Could not register platform_device for %s\n", pdev_name); | ||
254 | goto err; | ||
255 | } | ||
256 | |||
257 | return pdev; | ||
258 | |||
259 | err: | ||
260 | return ERR_PTR(r); | ||
261 | } | ||
262 | |||
263 | static enum omapdss_version __init omap_display_get_version(void) | 133 | static enum omapdss_version __init omap_display_get_version(void) |
264 | { | 134 | { |
265 | if (cpu_is_omap24xx()) | 135 | if (cpu_is_omap24xx()) |
@@ -293,132 +163,6 @@ static enum omapdss_version __init omap_display_get_version(void) | |||
293 | return OMAPDSS_VER_UNKNOWN; | 163 | return OMAPDSS_VER_UNKNOWN; |
294 | } | 164 | } |
295 | 165 | ||
296 | int __init omap_display_init(struct omap_dss_board_info *board_data) | ||
297 | { | ||
298 | int r = 0; | ||
299 | struct platform_device *pdev; | ||
300 | int i, oh_count; | ||
301 | const struct omap_dss_hwmod_data *curr_dss_hwmod; | ||
302 | struct platform_device *dss_pdev; | ||
303 | enum omapdss_version ver; | ||
304 | |||
305 | /* create omapdss device */ | ||
306 | |||
307 | ver = omap_display_get_version(); | ||
308 | |||
309 | if (ver == OMAPDSS_VER_UNKNOWN) { | ||
310 | pr_err("DSS not supported on this SoC\n"); | ||
311 | return -ENODEV; | ||
312 | } | ||
313 | |||
314 | board_data->version = ver; | ||
315 | board_data->dsi_enable_pads = omap_dsi_enable_pads; | ||
316 | board_data->dsi_disable_pads = omap_dsi_disable_pads; | ||
317 | board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; | ||
318 | |||
319 | omap_display_device.dev.platform_data = board_data; | ||
320 | |||
321 | r = platform_device_register(&omap_display_device); | ||
322 | if (r < 0) { | ||
323 | pr_err("Unable to register omapdss device\n"); | ||
324 | return r; | ||
325 | } | ||
326 | |||
327 | /* create devices for dss hwmods */ | ||
328 | |||
329 | if (cpu_is_omap24xx()) { | ||
330 | curr_dss_hwmod = omap2_dss_hwmod_data; | ||
331 | oh_count = ARRAY_SIZE(omap2_dss_hwmod_data); | ||
332 | } else if (cpu_is_omap34xx()) { | ||
333 | curr_dss_hwmod = omap3_dss_hwmod_data; | ||
334 | oh_count = ARRAY_SIZE(omap3_dss_hwmod_data); | ||
335 | } else { | ||
336 | curr_dss_hwmod = omap4_dss_hwmod_data; | ||
337 | oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); | ||
338 | } | ||
339 | |||
340 | /* | ||
341 | * First create the pdev for dss_core, which is used as a parent device | ||
342 | * by the other dss pdevs. Note: dss_core has to be the first item in | ||
343 | * the hwmod list. | ||
344 | */ | ||
345 | dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name, | ||
346 | curr_dss_hwmod[0].id, | ||
347 | curr_dss_hwmod[0].oh_name, | ||
348 | board_data, sizeof(*board_data), | ||
349 | NULL); | ||
350 | |||
351 | if (IS_ERR(dss_pdev)) { | ||
352 | pr_err("Could not build omap_device for %s\n", | ||
353 | curr_dss_hwmod[0].oh_name); | ||
354 | |||
355 | return PTR_ERR(dss_pdev); | ||
356 | } | ||
357 | |||
358 | for (i = 1; i < oh_count; i++) { | ||
359 | pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name, | ||
360 | curr_dss_hwmod[i].id, | ||
361 | curr_dss_hwmod[i].oh_name, | ||
362 | board_data, sizeof(*board_data), | ||
363 | dss_pdev); | ||
364 | |||
365 | if (IS_ERR(pdev)) { | ||
366 | pr_err("Could not build omap_device for %s\n", | ||
367 | curr_dss_hwmod[i].oh_name); | ||
368 | |||
369 | return PTR_ERR(pdev); | ||
370 | } | ||
371 | } | ||
372 | |||
373 | /* Create devices for DPI and SDI */ | ||
374 | |||
375 | pdev = create_simple_dss_pdev("omapdss_dpi", 0, | ||
376 | board_data, sizeof(*board_data), dss_pdev); | ||
377 | if (IS_ERR(pdev)) { | ||
378 | pr_err("Could not build platform_device for omapdss_dpi\n"); | ||
379 | return PTR_ERR(pdev); | ||
380 | } | ||
381 | |||
382 | if (cpu_is_omap34xx()) { | ||
383 | pdev = create_simple_dss_pdev("omapdss_sdi", 0, | ||
384 | board_data, sizeof(*board_data), dss_pdev); | ||
385 | if (IS_ERR(pdev)) { | ||
386 | pr_err("Could not build platform_device for omapdss_sdi\n"); | ||
387 | return PTR_ERR(pdev); | ||
388 | } | ||
389 | } | ||
390 | |||
391 | /* create DRM device */ | ||
392 | r = omap_init_drm(); | ||
393 | if (r < 0) { | ||
394 | pr_err("Unable to register omapdrm device\n"); | ||
395 | return r; | ||
396 | } | ||
397 | |||
398 | /* create vrfb device */ | ||
399 | r = omap_init_vrfb(); | ||
400 | if (r < 0) { | ||
401 | pr_err("Unable to register omapvrfb device\n"); | ||
402 | return r; | ||
403 | } | ||
404 | |||
405 | /* create FB device */ | ||
406 | r = omap_init_fb(); | ||
407 | if (r < 0) { | ||
408 | pr_err("Unable to register omapfb device\n"); | ||
409 | return r; | ||
410 | } | ||
411 | |||
412 | /* create V4L2 display device */ | ||
413 | r = omap_init_vout(); | ||
414 | if (r < 0) { | ||
415 | pr_err("Unable to register omap_vout device\n"); | ||
416 | return r; | ||
417 | } | ||
418 | |||
419 | return 0; | ||
420 | } | ||
421 | |||
422 | static void dispc_disable_outputs(void) | 166 | static void dispc_disable_outputs(void) |
423 | { | 167 | { |
424 | u32 v, irq_mask = 0; | 168 | u32 v, irq_mask = 0; |
@@ -573,7 +317,7 @@ static const char * const omapdss_compat_names[] __initconst = { | |||
573 | "ti,dra7-dss", | 317 | "ti,dra7-dss", |
574 | }; | 318 | }; |
575 | 319 | ||
576 | struct device_node * __init omapdss_find_dss_of_node(void) | 320 | static struct device_node * __init omapdss_find_dss_of_node(void) |
577 | { | 321 | { |
578 | struct device_node *node; | 322 | struct device_node *node; |
579 | int i; | 323 | int i; |
diff --git a/arch/arm/mach-omap2/display.h b/arch/arm/mach-omap2/display.h index 78f253005279..9a39646d4316 100644 --- a/arch/arm/mach-omap2/display.h +++ b/arch/arm/mach-omap2/display.h | |||
@@ -31,11 +31,4 @@ int omap_init_vrfb(void); | |||
31 | int omap_init_fb(void); | 31 | int omap_init_fb(void); |
32 | int omap_init_vout(void); | 32 | int omap_init_vout(void); |
33 | 33 | ||
34 | struct device_node * __init omapdss_find_dss_of_node(void); | ||
35 | |||
36 | struct omap_dss_board_info; | ||
37 | |||
38 | /* Init with the board info */ | ||
39 | int omap_display_init(struct omap_dss_board_info *board_data); | ||
40 | |||
41 | #endif | 34 | #endif |
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c deleted file mode 100644 index 7a577145b68b..000000000000 --- a/arch/arm/mach-omap2/gpio.c +++ /dev/null | |||
@@ -1,160 +0,0 @@ | |||
1 | /* | ||
2 | * OMAP2+ specific gpio initialization | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * | ||
6 | * Author: | ||
7 | * Charulatha V <charu@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License as | ||
11 | * published by the Free Software Foundation version 2. | ||
12 | * | ||
13 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
14 | * kind, whether express or implied; without even the implied warranty | ||
15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | */ | ||
18 | |||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/slab.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/of.h> | ||
24 | #include <linux/platform_data/gpio-omap.h> | ||
25 | |||
26 | #include "soc.h" | ||
27 | #include "omap_hwmod.h" | ||
28 | #include "omap_device.h" | ||
29 | #include "omap-pm.h" | ||
30 | |||
31 | #include "powerdomain.h" | ||
32 | |||
33 | static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) | ||
34 | { | ||
35 | struct platform_device *pdev; | ||
36 | struct omap_gpio_platform_data *pdata; | ||
37 | struct omap_gpio_dev_attr *dev_attr; | ||
38 | char *name = "omap_gpio"; | ||
39 | int id; | ||
40 | struct powerdomain *pwrdm; | ||
41 | |||
42 | /* | ||
43 | * extract the device id from name field available in the | ||
44 | * hwmod database and use the same for constructing ids for | ||
45 | * gpio devices. | ||
46 | * CAUTION: Make sure the name in the hwmod database does | ||
47 | * not change. If changed, make corresponding change here | ||
48 | * or make use of static variable mechanism to handle this. | ||
49 | */ | ||
50 | sscanf(oh->name, "gpio%d", &id); | ||
51 | |||
52 | pdata = kzalloc(sizeof(struct omap_gpio_platform_data), GFP_KERNEL); | ||
53 | if (!pdata) { | ||
54 | pr_err("gpio%d: Memory allocation failed\n", id); | ||
55 | return -ENOMEM; | ||
56 | } | ||
57 | |||
58 | dev_attr = (struct omap_gpio_dev_attr *)oh->dev_attr; | ||
59 | pdata->bank_width = dev_attr->bank_width; | ||
60 | pdata->dbck_flag = dev_attr->dbck_flag; | ||
61 | pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count; | ||
62 | pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL); | ||
63 | if (!pdata->regs) { | ||
64 | pr_err("gpio%d: Memory allocation failed\n", id); | ||
65 | kfree(pdata); | ||
66 | return -ENOMEM; | ||
67 | } | ||
68 | |||
69 | switch (oh->class->rev) { | ||
70 | case 0: | ||
71 | if (id == 1) | ||
72 | /* non-wakeup GPIO pins for OMAP2 Bank1 */ | ||
73 | pdata->non_wakeup_gpios = 0xe203ffc0; | ||
74 | else if (id == 2) | ||
75 | /* non-wakeup GPIO pins for OMAP2 Bank2 */ | ||
76 | pdata->non_wakeup_gpios = 0x08700040; | ||
77 | /* fall through */ | ||
78 | |||
79 | case 1: | ||
80 | pdata->regs->revision = OMAP24XX_GPIO_REVISION; | ||
81 | pdata->regs->direction = OMAP24XX_GPIO_OE; | ||
82 | pdata->regs->datain = OMAP24XX_GPIO_DATAIN; | ||
83 | pdata->regs->dataout = OMAP24XX_GPIO_DATAOUT; | ||
84 | pdata->regs->set_dataout = OMAP24XX_GPIO_SETDATAOUT; | ||
85 | pdata->regs->clr_dataout = OMAP24XX_GPIO_CLEARDATAOUT; | ||
86 | pdata->regs->irqstatus = OMAP24XX_GPIO_IRQSTATUS1; | ||
87 | pdata->regs->irqstatus2 = OMAP24XX_GPIO_IRQSTATUS2; | ||
88 | pdata->regs->irqenable = OMAP24XX_GPIO_IRQENABLE1; | ||
89 | pdata->regs->irqenable2 = OMAP24XX_GPIO_IRQENABLE2; | ||
90 | pdata->regs->set_irqenable = OMAP24XX_GPIO_SETIRQENABLE1; | ||
91 | pdata->regs->clr_irqenable = OMAP24XX_GPIO_CLEARIRQENABLE1; | ||
92 | pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL; | ||
93 | pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN; | ||
94 | pdata->regs->ctrl = OMAP24XX_GPIO_CTRL; | ||
95 | pdata->regs->wkup_en = OMAP24XX_GPIO_WAKE_EN; | ||
96 | pdata->regs->leveldetect0 = OMAP24XX_GPIO_LEVELDETECT0; | ||
97 | pdata->regs->leveldetect1 = OMAP24XX_GPIO_LEVELDETECT1; | ||
98 | pdata->regs->risingdetect = OMAP24XX_GPIO_RISINGDETECT; | ||
99 | pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT; | ||
100 | break; | ||
101 | case 2: | ||
102 | pdata->regs->revision = OMAP4_GPIO_REVISION; | ||
103 | pdata->regs->direction = OMAP4_GPIO_OE; | ||
104 | pdata->regs->datain = OMAP4_GPIO_DATAIN; | ||
105 | pdata->regs->dataout = OMAP4_GPIO_DATAOUT; | ||
106 | pdata->regs->set_dataout = OMAP4_GPIO_SETDATAOUT; | ||
107 | pdata->regs->clr_dataout = OMAP4_GPIO_CLEARDATAOUT; | ||
108 | pdata->regs->irqstatus_raw0 = OMAP4_GPIO_IRQSTATUSRAW0; | ||
109 | pdata->regs->irqstatus_raw1 = OMAP4_GPIO_IRQSTATUSRAW1; | ||
110 | pdata->regs->irqstatus = OMAP4_GPIO_IRQSTATUS0; | ||
111 | pdata->regs->irqstatus2 = OMAP4_GPIO_IRQSTATUS1; | ||
112 | pdata->regs->irqenable = OMAP4_GPIO_IRQSTATUSSET0; | ||
113 | pdata->regs->irqenable2 = OMAP4_GPIO_IRQSTATUSSET1; | ||
114 | pdata->regs->set_irqenable = OMAP4_GPIO_IRQSTATUSSET0; | ||
115 | pdata->regs->clr_irqenable = OMAP4_GPIO_IRQSTATUSCLR0; | ||
116 | pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME; | ||
117 | pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE; | ||
118 | pdata->regs->ctrl = OMAP4_GPIO_CTRL; | ||
119 | pdata->regs->wkup_en = OMAP4_GPIO_IRQWAKEN0; | ||
120 | pdata->regs->leveldetect0 = OMAP4_GPIO_LEVELDETECT0; | ||
121 | pdata->regs->leveldetect1 = OMAP4_GPIO_LEVELDETECT1; | ||
122 | pdata->regs->risingdetect = OMAP4_GPIO_RISINGDETECT; | ||
123 | pdata->regs->fallingdetect = OMAP4_GPIO_FALLINGDETECT; | ||
124 | break; | ||
125 | default: | ||
126 | WARN(1, "Invalid gpio bank_type\n"); | ||
127 | kfree(pdata->regs); | ||
128 | kfree(pdata); | ||
129 | return -EINVAL; | ||
130 | } | ||
131 | |||
132 | pwrdm = omap_hwmod_get_pwrdm(oh); | ||
133 | pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm); | ||
134 | |||
135 | pdev = omap_device_build(name, id - 1, oh, pdata, sizeof(*pdata)); | ||
136 | kfree(pdata); | ||
137 | |||
138 | if (IS_ERR(pdev)) { | ||
139 | WARN(1, "Can't build omap_device for %s:%s.\n", | ||
140 | name, oh->name); | ||
141 | return PTR_ERR(pdev); | ||
142 | } | ||
143 | |||
144 | return 0; | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * gpio_init needs to be done before | ||
149 | * machine_init functions access gpio APIs. | ||
150 | * Hence gpio_init is a omap_postcore_initcall. | ||
151 | */ | ||
152 | static int __init omap2_gpio_init(void) | ||
153 | { | ||
154 | /* If dtb is there, the devices will be created dynamically */ | ||
155 | if (of_have_populated_dt()) | ||
156 | return -ENODEV; | ||
157 | |||
158 | return omap_hwmod_for_each_by_class("gpio", omap2_gpio_dev_init, NULL); | ||
159 | } | ||
160 | omap_postcore_initcall(omap2_gpio_init); | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 759e1d45ba25..0da4f2ea76c4 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -741,14 +741,14 @@ static int _init_main_clk(struct omap_hwmod *oh) | |||
741 | int ret = 0; | 741 | int ret = 0; |
742 | char name[MOD_CLK_MAX_NAME_LEN]; | 742 | char name[MOD_CLK_MAX_NAME_LEN]; |
743 | struct clk *clk; | 743 | struct clk *clk; |
744 | static const char modck[] = "_mod_ck"; | ||
744 | 745 | ||
745 | /* +7 magic comes from '_mod_ck' suffix */ | 746 | if (strlen(oh->name) >= MOD_CLK_MAX_NAME_LEN - strlen(modck)) |
746 | if (strlen(oh->name) + 7 > MOD_CLK_MAX_NAME_LEN) | ||
747 | pr_warn("%s: warning: cropping name for %s\n", __func__, | 747 | pr_warn("%s: warning: cropping name for %s\n", __func__, |
748 | oh->name); | 748 | oh->name); |
749 | 749 | ||
750 | strncpy(name, oh->name, MOD_CLK_MAX_NAME_LEN - 7); | 750 | strlcpy(name, oh->name, MOD_CLK_MAX_NAME_LEN - strlen(modck)); |
751 | strcat(name, "_mod_ck"); | 751 | strlcat(name, modck, MOD_CLK_MAX_NAME_LEN); |
752 | 752 | ||
753 | clk = clk_get(NULL, name); | 753 | clk = clk_get(NULL, name); |
754 | if (!IS_ERR(clk)) { | 754 | if (!IS_ERR(clk)) { |
@@ -3249,6 +3249,36 @@ int __init omap_hwmod_setup_one(const char *oh_name) | |||
3249 | } | 3249 | } |
3250 | 3250 | ||
3251 | /** | 3251 | /** |
3252 | * omap_hwmod_setup_earlycon_flags - set up flags for early console | ||
3253 | * | ||
3254 | * Enable DEBUG_OMAPUART_FLAGS for uart hwmod that is being used as | ||
3255 | * early concole so that hwmod core doesn't reset and keep it in idle | ||
3256 | * that specific uart. | ||
3257 | */ | ||
3258 | #ifdef CONFIG_SERIAL_EARLYCON | ||
3259 | static void __init omap_hwmod_setup_earlycon_flags(void) | ||
3260 | { | ||
3261 | struct device_node *np; | ||
3262 | struct omap_hwmod *oh; | ||
3263 | const char *uart; | ||
3264 | |||
3265 | np = of_find_node_by_path("/chosen"); | ||
3266 | if (np) { | ||
3267 | uart = of_get_property(np, "stdout-path", NULL); | ||
3268 | if (uart) { | ||
3269 | np = of_find_node_by_path(uart); | ||
3270 | if (np) { | ||
3271 | uart = of_get_property(np, "ti,hwmods", NULL); | ||
3272 | oh = omap_hwmod_lookup(uart); | ||
3273 | if (oh) | ||
3274 | oh->flags |= DEBUG_OMAPUART_FLAGS; | ||
3275 | } | ||
3276 | } | ||
3277 | } | ||
3278 | } | ||
3279 | #endif | ||
3280 | |||
3281 | /** | ||
3252 | * omap_hwmod_setup_all - set up all registered IP blocks | 3282 | * omap_hwmod_setup_all - set up all registered IP blocks |
3253 | * | 3283 | * |
3254 | * Initialize and set up all IP blocks registered with the hwmod code. | 3284 | * Initialize and set up all IP blocks registered with the hwmod code. |
@@ -3261,6 +3291,9 @@ static int __init omap_hwmod_setup_all(void) | |||
3261 | _ensure_mpu_hwmod_is_setup(NULL); | 3291 | _ensure_mpu_hwmod_is_setup(NULL); |
3262 | 3292 | ||
3263 | omap_hwmod_for_each(_init, NULL); | 3293 | omap_hwmod_for_each(_init, NULL); |
3294 | #ifdef CONFIG_SERIAL_EARLYCON | ||
3295 | omap_hwmod_setup_earlycon_flags(); | ||
3296 | #endif | ||
3264 | omap_hwmod_for_each(_setup, NULL); | 3297 | omap_hwmod_for_each(_setup, NULL); |
3265 | 3298 | ||
3266 | return 0; | 3299 | return 0; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h index cdfbb44ceb0c..f22e9cb39f4a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_common_data.h +++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h | |||
@@ -121,10 +121,6 @@ extern struct omap_hwmod_irq_info omap2_uart3_mpu_irqs[]; | |||
121 | extern struct omap_hwmod_irq_info omap2_dispc_irqs[]; | 121 | extern struct omap_hwmod_irq_info omap2_dispc_irqs[]; |
122 | extern struct omap_hwmod_irq_info omap2_i2c1_mpu_irqs[]; | 122 | extern struct omap_hwmod_irq_info omap2_i2c1_mpu_irqs[]; |
123 | extern struct omap_hwmod_irq_info omap2_i2c2_mpu_irqs[]; | 123 | extern struct omap_hwmod_irq_info omap2_i2c2_mpu_irqs[]; |
124 | extern struct omap_hwmod_irq_info omap2_gpio1_irqs[]; | ||
125 | extern struct omap_hwmod_irq_info omap2_gpio2_irqs[]; | ||
126 | extern struct omap_hwmod_irq_info omap2_gpio3_irqs[]; | ||
127 | extern struct omap_hwmod_irq_info omap2_gpio4_irqs[]; | ||
128 | extern struct omap_hwmod_irq_info omap2_dma_system_irqs[]; | 124 | extern struct omap_hwmod_irq_info omap2_dma_system_irqs[]; |
129 | extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[]; | 125 | extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[]; |
130 | extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[]; | 126 | extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[]; |
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index 5b2f5138d938..2b138b65129a 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c | |||
@@ -295,10 +295,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup) | |||
295 | GFP_KERNEL); | 295 | GFP_KERNEL); |
296 | 296 | ||
297 | if (!prcm_irq_chips || !prcm_irq_setup->saved_mask || | 297 | if (!prcm_irq_chips || !prcm_irq_setup->saved_mask || |
298 | !prcm_irq_setup->priority_mask) { | 298 | !prcm_irq_setup->priority_mask) |
299 | pr_err("PRCM: kzalloc failed\n"); | ||
300 | goto err; | 299 | goto err; |
301 | } | ||
302 | 300 | ||
303 | memset(mask, 0, sizeof(mask)); | 301 | memset(mask, 0, sizeof(mask)); |
304 | 302 | ||
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 56128da23c3a..07dd692c4737 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -510,18 +510,19 @@ void __init omap3_secure_sync32k_timer_init(void) | |||
510 | } | 510 | } |
511 | #endif /* CONFIG_ARCH_OMAP3 */ | 511 | #endif /* CONFIG_ARCH_OMAP3 */ |
512 | 512 | ||
513 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) | 513 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) || \ |
514 | defined(CONFIG_SOC_AM43XX) | ||
514 | void __init omap3_gptimer_timer_init(void) | 515 | void __init omap3_gptimer_timer_init(void) |
515 | { | 516 | { |
516 | __omap_sync32k_timer_init(2, "timer_sys_ck", NULL, | 517 | __omap_sync32k_timer_init(2, "timer_sys_ck", NULL, |
517 | 1, "timer_sys_ck", "ti,timer-alwon", true); | 518 | 1, "timer_sys_ck", "ti,timer-alwon", true); |
518 | 519 | if (of_have_populated_dt()) | |
519 | clocksource_probe(); | 520 | clocksource_probe(); |
520 | } | 521 | } |
521 | #endif | 522 | #endif |
522 | 523 | ||
523 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ | 524 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ |
524 | defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM43XX) | 525 | defined(CONFIG_SOC_DRA7XX) |
525 | static void __init omap4_sync32k_timer_init(void) | 526 | static void __init omap4_sync32k_timer_init(void) |
526 | { | 527 | { |
527 | __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon", | 528 | __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon", |
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index 0b8300e6fca3..a057cf9c0e7b 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -696,32 +696,7 @@ static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { | |||
696 | }; | 696 | }; |
697 | #endif /* CONFIG_MACH_EZX_E2 */ | 697 | #endif /* CONFIG_MACH_EZX_E2 */ |
698 | 698 | ||
699 | #ifdef CONFIG_MACH_EZX_A780 | 699 | #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910) |
700 | /* gpio_keys */ | ||
701 | static struct gpio_keys_button a780_buttons[] = { | ||
702 | [0] = { | ||
703 | .code = SW_LID, | ||
704 | .gpio = GPIO12_A780_FLIP_LID, | ||
705 | .active_low = 0, | ||
706 | .desc = "A780 flip lid", | ||
707 | .type = EV_SW, | ||
708 | .wakeup = 1, | ||
709 | }, | ||
710 | }; | ||
711 | |||
712 | static struct gpio_keys_platform_data a780_gpio_keys_platform_data = { | ||
713 | .buttons = a780_buttons, | ||
714 | .nbuttons = ARRAY_SIZE(a780_buttons), | ||
715 | }; | ||
716 | |||
717 | static struct platform_device a780_gpio_keys = { | ||
718 | .name = "gpio-keys", | ||
719 | .id = -1, | ||
720 | .dev = { | ||
721 | .platform_data = &a780_gpio_keys_platform_data, | ||
722 | }, | ||
723 | }; | ||
724 | |||
725 | /* camera */ | 700 | /* camera */ |
726 | static struct regulator_consumer_supply camera_dummy_supplies[] = { | 701 | static struct regulator_consumer_supply camera_dummy_supplies[] = { |
727 | REGULATOR_SUPPLY("vdd", "0-005d"), | 702 | REGULATOR_SUPPLY("vdd", "0-005d"), |
@@ -750,6 +725,35 @@ static struct platform_device camera_supply_dummy_device = { | |||
750 | .platform_data = &camera_dummy_config, | 725 | .platform_data = &camera_dummy_config, |
751 | }, | 726 | }, |
752 | }; | 727 | }; |
728 | #endif | ||
729 | |||
730 | #ifdef CONFIG_MACH_EZX_A780 | ||
731 | /* gpio_keys */ | ||
732 | static struct gpio_keys_button a780_buttons[] = { | ||
733 | [0] = { | ||
734 | .code = SW_LID, | ||
735 | .gpio = GPIO12_A780_FLIP_LID, | ||
736 | .active_low = 0, | ||
737 | .desc = "A780 flip lid", | ||
738 | .type = EV_SW, | ||
739 | .wakeup = 1, | ||
740 | }, | ||
741 | }; | ||
742 | |||
743 | static struct gpio_keys_platform_data a780_gpio_keys_platform_data = { | ||
744 | .buttons = a780_buttons, | ||
745 | .nbuttons = ARRAY_SIZE(a780_buttons), | ||
746 | }; | ||
747 | |||
748 | static struct platform_device a780_gpio_keys = { | ||
749 | .name = "gpio-keys", | ||
750 | .id = -1, | ||
751 | .dev = { | ||
752 | .platform_data = &a780_gpio_keys_platform_data, | ||
753 | }, | ||
754 | }; | ||
755 | |||
756 | /* camera */ | ||
753 | static int a780_camera_reset(struct device *dev) | 757 | static int a780_camera_reset(struct device *dev) |
754 | { | 758 | { |
755 | gpio_set_value(GPIO19_GEN1_CAM_RST, 0); | 759 | gpio_set_value(GPIO19_GEN1_CAM_RST, 0); |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index d1db32b1a2c6..88e0068f92a8 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/leds.h> | ||
22 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
23 | #include <linux/fb.h> | 24 | #include <linux/fb.h> |
24 | 25 | ||
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c index 2bb08961e934..ad8f4cd7c327 100644 --- a/arch/arm/mach-s3c24xx/bast-irq.c +++ b/arch/arm/mach-s3c24xx/bast-irq.c | |||
@@ -44,7 +44,7 @@ | |||
44 | /* table of ISA irq nos to the relevant mask... zero means | 44 | /* table of ISA irq nos to the relevant mask... zero means |
45 | * the irq is not implemented | 45 | * the irq is not implemented |
46 | */ | 46 | */ |
47 | static unsigned char bast_pc104_irqmasks[] = { | 47 | static const unsigned char bast_pc104_irqmasks[] = { |
48 | 0, /* 0 */ | 48 | 0, /* 0 */ |
49 | 0, /* 1 */ | 49 | 0, /* 1 */ |
50 | 0, /* 2 */ | 50 | 0, /* 2 */ |
@@ -63,7 +63,7 @@ static unsigned char bast_pc104_irqmasks[] = { | |||
63 | 0, /* 15 */ | 63 | 0, /* 15 */ |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 }; | 66 | static const unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 }; |
67 | 67 | ||
68 | static void | 68 | static void |
69 | bast_pc104_mask(struct irq_data *data) | 69 | bast_pc104_mask(struct irq_data *data) |
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c index f6c3f151d0d4..b59f4f4f256f 100644 --- a/arch/arm/mach-s3c24xx/common.c +++ b/arch/arm/mach-s3c24xx/common.c | |||
@@ -345,10 +345,40 @@ static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = { | |||
345 | [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), }, | 345 | [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), }, |
346 | }; | 346 | }; |
347 | 347 | ||
348 | static const struct dma_slave_map s3c2410_dma_slave_map[] = { | ||
349 | { "s3c2410-sdi", "rx-tx", (void *)DMACH_SDI }, | ||
350 | { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0_RX }, | ||
351 | { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0_TX }, | ||
352 | { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1_RX }, | ||
353 | { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1_TX }, | ||
354 | /* | ||
355 | * The DMA request source[1] (DMACH_UARTx_SRC2) are | ||
356 | * not used in the UART driver. | ||
357 | */ | ||
358 | { "s3c2410-uart.0", "rx", (void *)DMACH_UART0 }, | ||
359 | { "s3c2410-uart.0", "tx", (void *)DMACH_UART0 }, | ||
360 | { "s3c2410-uart.1", "rx", (void *)DMACH_UART1 }, | ||
361 | { "s3c2410-uart.1", "tx", (void *)DMACH_UART1 }, | ||
362 | { "s3c2410-uart.2", "rx", (void *)DMACH_UART2 }, | ||
363 | { "s3c2410-uart.2", "tx", (void *)DMACH_UART2 }, | ||
364 | { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN }, | ||
365 | { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT }, | ||
366 | { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 }, | ||
367 | { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 }, | ||
368 | { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 }, | ||
369 | { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 }, | ||
370 | { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 }, | ||
371 | { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 }, | ||
372 | { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 }, | ||
373 | { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 } | ||
374 | }; | ||
375 | |||
348 | static struct s3c24xx_dma_platdata s3c2410_dma_platdata = { | 376 | static struct s3c24xx_dma_platdata s3c2410_dma_platdata = { |
349 | .num_phy_channels = 4, | 377 | .num_phy_channels = 4, |
350 | .channels = s3c2410_dma_channels, | 378 | .channels = s3c2410_dma_channels, |
351 | .num_channels = DMACH_MAX, | 379 | .num_channels = DMACH_MAX, |
380 | .slave_map = s3c2410_dma_slave_map, | ||
381 | .slavecnt = ARRAY_SIZE(s3c2410_dma_slave_map), | ||
352 | }; | 382 | }; |
353 | 383 | ||
354 | struct platform_device s3c2410_device_dma = { | 384 | struct platform_device s3c2410_device_dma = { |
@@ -388,10 +418,36 @@ static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = { | |||
388 | [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 }, | 418 | [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 }, |
389 | }; | 419 | }; |
390 | 420 | ||
421 | static const struct dma_slave_map s3c2412_dma_slave_map[] = { | ||
422 | { "s3c2412-sdi", "rx-tx", (void *)DMACH_SDI }, | ||
423 | { "s3c2412-spi.0", "rx", (void *)DMACH_SPI0_RX }, | ||
424 | { "s3c2412-spi.0", "tx", (void *)DMACH_SPI0_TX }, | ||
425 | { "s3c2412-spi.1", "rx", (void *)DMACH_SPI1_RX }, | ||
426 | { "s3c2412-spi.1", "tx", (void *)DMACH_SPI1_TX }, | ||
427 | { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 }, | ||
428 | { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 }, | ||
429 | { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 }, | ||
430 | { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 }, | ||
431 | { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 }, | ||
432 | { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 }, | ||
433 | { "s3c2412-iis", "rx", (void *)DMACH_I2S_IN }, | ||
434 | { "s3c2412-iis", "tx", (void *)DMACH_I2S_OUT }, | ||
435 | { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 }, | ||
436 | { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 }, | ||
437 | { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 }, | ||
438 | { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 }, | ||
439 | { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 }, | ||
440 | { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 }, | ||
441 | { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 }, | ||
442 | { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 } | ||
443 | }; | ||
444 | |||
391 | static struct s3c24xx_dma_platdata s3c2412_dma_platdata = { | 445 | static struct s3c24xx_dma_platdata s3c2412_dma_platdata = { |
392 | .num_phy_channels = 4, | 446 | .num_phy_channels = 4, |
393 | .channels = s3c2412_dma_channels, | 447 | .channels = s3c2412_dma_channels, |
394 | .num_channels = DMACH_MAX, | 448 | .num_channels = DMACH_MAX, |
449 | .slave_map = s3c2412_dma_slave_map, | ||
450 | .slavecnt = ARRAY_SIZE(s3c2412_dma_slave_map), | ||
395 | }; | 451 | }; |
396 | 452 | ||
397 | struct platform_device s3c2412_device_dma = { | 453 | struct platform_device s3c2412_device_dma = { |
@@ -534,10 +590,30 @@ static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = { | |||
534 | [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 }, | 590 | [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 }, |
535 | }; | 591 | }; |
536 | 592 | ||
593 | static const struct dma_slave_map s3c2443_dma_slave_map[] = { | ||
594 | { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI }, | ||
595 | { "s3c2443-spi.0", "rx", (void *)DMACH_SPI0_RX }, | ||
596 | { "s3c2443-spi.0", "tx", (void *)DMACH_SPI0_TX }, | ||
597 | { "s3c2443-spi.1", "rx", (void *)DMACH_SPI1_RX }, | ||
598 | { "s3c2443-spi.1", "tx", (void *)DMACH_SPI1_TX }, | ||
599 | { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 }, | ||
600 | { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 }, | ||
601 | { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 }, | ||
602 | { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 }, | ||
603 | { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 }, | ||
604 | { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 }, | ||
605 | { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 }, | ||
606 | { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 }, | ||
607 | { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN }, | ||
608 | { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT }, | ||
609 | }; | ||
610 | |||
537 | static struct s3c24xx_dma_platdata s3c2443_dma_platdata = { | 611 | static struct s3c24xx_dma_platdata s3c2443_dma_platdata = { |
538 | .num_phy_channels = 6, | 612 | .num_phy_channels = 6, |
539 | .channels = s3c2443_dma_channels, | 613 | .channels = s3c2443_dma_channels, |
540 | .num_channels = DMACH_MAX, | 614 | .num_channels = DMACH_MAX, |
615 | .slave_map = s3c2443_dma_slave_map, | ||
616 | .slavecnt = ARRAY_SIZE(s3c2443_dma_slave_map), | ||
541 | }; | 617 | }; |
542 | 618 | ||
543 | struct platform_device s3c2443_device_dma = { | 619 | struct platform_device s3c2443_device_dma = { |
diff --git a/arch/arm/mach-s3c24xx/iotiming-s3c2410.c b/arch/arm/mach-s3c24xx/iotiming-s3c2410.c index 65e5f9cb650f..b7970f1fa3d5 100644 --- a/arch/arm/mach-s3c24xx/iotiming-s3c2410.c +++ b/arch/arm/mach-s3c24xx/iotiming-s3c2410.c | |||
@@ -249,7 +249,7 @@ static int s3c2410_calc_bank(struct s3c_cpufreq_config *cfg, | |||
249 | return 0; | 249 | return 0; |
250 | } | 250 | } |
251 | 251 | ||
252 | static unsigned int tacc_tab[] = { | 252 | static const unsigned int tacc_tab[] = { |
253 | [0] = 1, | 253 | [0] = 1, |
254 | [1] = 2, | 254 | [1] = 2, |
255 | [2] = 3, | 255 | [2] = 3, |
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2412.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c index d75f95e487ee..0ae4d47a4663 100644 --- a/arch/arm/mach-s3c24xx/pm-s3c2412.c +++ b/arch/arm/mach-s3c24xx/pm-s3c2412.c | |||
@@ -53,7 +53,7 @@ static int s3c2412_cpu_suspend(unsigned long arg) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /* mapping of interrupts to parts of the wakeup mask */ | 55 | /* mapping of interrupts to parts of the wakeup mask */ |
56 | static struct samsung_wakeup_mask wake_irqs[] = { | 56 | static const struct samsung_wakeup_mask wake_irqs[] = { |
57 | { .irq = IRQ_RTC, .bit = S3C2412_PWRCFG_RTC_MASKIRQ, }, | 57 | { .irq = IRQ_RTC, .bit = S3C2412_PWRCFG_RTC_MASKIRQ, }, |
58 | }; | 58 | }; |
59 | 59 | ||
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c index 7c66ce1a6bb6..9843eb4dd04e 100644 --- a/arch/arm/mach-s3c64xx/common.c +++ b/arch/arm/mach-s3c64xx/common.c | |||
@@ -56,7 +56,8 @@ | |||
56 | #include "watchdog-reset.h" | 56 | #include "watchdog-reset.h" |
57 | 57 | ||
58 | /* External clock frequency */ | 58 | /* External clock frequency */ |
59 | static unsigned long xtal_f = 12000000, xusbxti_f = 48000000; | 59 | static unsigned long xtal_f __ro_after_init = 12000000; |
60 | static unsigned long xusbxti_f __ro_after_init = 48000000; | ||
60 | 61 | ||
61 | void __init s3c64xx_set_xtal_freq(unsigned long freq) | 62 | void __init s3c64xx_set_xtal_freq(unsigned long freq) |
62 | { | 63 | { |
diff --git a/arch/arm/mach-s3c64xx/dev-audio.c b/arch/arm/mach-s3c64xx/dev-audio.c index b57783371d52..a3f39dd114f9 100644 --- a/arch/arm/mach-s3c64xx/dev-audio.c +++ b/arch/arm/mach-s3c64xx/dev-audio.c | |||
@@ -58,9 +58,6 @@ static struct resource s3c64xx_iis0_resource[] = { | |||
58 | 58 | ||
59 | static struct s3c_audio_pdata i2s0_pdata = { | 59 | static struct s3c_audio_pdata i2s0_pdata = { |
60 | .cfg_gpio = s3c64xx_i2s_cfg_gpio, | 60 | .cfg_gpio = s3c64xx_i2s_cfg_gpio, |
61 | .dma_filter = pl08x_filter_id, | ||
62 | .dma_playback = DMACH_I2S0_OUT, | ||
63 | .dma_capture = DMACH_I2S0_IN, | ||
64 | }; | 61 | }; |
65 | 62 | ||
66 | struct platform_device s3c64xx_device_iis0 = { | 63 | struct platform_device s3c64xx_device_iis0 = { |
@@ -80,9 +77,6 @@ static struct resource s3c64xx_iis1_resource[] = { | |||
80 | 77 | ||
81 | static struct s3c_audio_pdata i2s1_pdata = { | 78 | static struct s3c_audio_pdata i2s1_pdata = { |
82 | .cfg_gpio = s3c64xx_i2s_cfg_gpio, | 79 | .cfg_gpio = s3c64xx_i2s_cfg_gpio, |
83 | .dma_filter = pl08x_filter_id, | ||
84 | .dma_playback = DMACH_I2S1_OUT, | ||
85 | .dma_capture = DMACH_I2S1_IN, | ||
86 | }; | 80 | }; |
87 | 81 | ||
88 | struct platform_device s3c64xx_device_iis1 = { | 82 | struct platform_device s3c64xx_device_iis1 = { |
@@ -102,9 +96,6 @@ static struct resource s3c64xx_iisv4_resource[] = { | |||
102 | 96 | ||
103 | static struct s3c_audio_pdata i2sv4_pdata = { | 97 | static struct s3c_audio_pdata i2sv4_pdata = { |
104 | .cfg_gpio = s3c64xx_i2s_cfg_gpio, | 98 | .cfg_gpio = s3c64xx_i2s_cfg_gpio, |
105 | .dma_filter = pl08x_filter_id, | ||
106 | .dma_playback = DMACH_HSI_I2SV40_TX, | ||
107 | .dma_capture = DMACH_HSI_I2SV40_RX, | ||
108 | .type = { | 99 | .type = { |
109 | .i2s = { | 100 | .i2s = { |
110 | .quirks = QUIRK_PRI_6CHAN, | 101 | .quirks = QUIRK_PRI_6CHAN, |
@@ -153,9 +144,6 @@ static struct resource s3c64xx_pcm0_resource[] = { | |||
153 | 144 | ||
154 | static struct s3c_audio_pdata s3c_pcm0_pdata = { | 145 | static struct s3c_audio_pdata s3c_pcm0_pdata = { |
155 | .cfg_gpio = s3c64xx_pcm_cfg_gpio, | 146 | .cfg_gpio = s3c64xx_pcm_cfg_gpio, |
156 | .dma_filter = pl08x_filter_id, | ||
157 | .dma_capture = DMACH_PCM0_RX, | ||
158 | .dma_playback = DMACH_PCM0_TX, | ||
159 | }; | 147 | }; |
160 | 148 | ||
161 | struct platform_device s3c64xx_device_pcm0 = { | 149 | struct platform_device s3c64xx_device_pcm0 = { |
@@ -175,9 +163,6 @@ static struct resource s3c64xx_pcm1_resource[] = { | |||
175 | 163 | ||
176 | static struct s3c_audio_pdata s3c_pcm1_pdata = { | 164 | static struct s3c_audio_pdata s3c_pcm1_pdata = { |
177 | .cfg_gpio = s3c64xx_pcm_cfg_gpio, | 165 | .cfg_gpio = s3c64xx_pcm_cfg_gpio, |
178 | .dma_filter = pl08x_filter_id, | ||
179 | .dma_playback = DMACH_PCM1_TX, | ||
180 | .dma_capture = DMACH_PCM1_RX, | ||
181 | }; | 166 | }; |
182 | 167 | ||
183 | struct platform_device s3c64xx_device_pcm1 = { | 168 | struct platform_device s3c64xx_device_pcm1 = { |
@@ -209,10 +194,6 @@ static struct resource s3c64xx_ac97_resource[] = { | |||
209 | }; | 194 | }; |
210 | 195 | ||
211 | static struct s3c_audio_pdata s3c_ac97_pdata = { | 196 | static struct s3c_audio_pdata s3c_ac97_pdata = { |
212 | .dma_playback = DMACH_AC97_PCMOUT, | ||
213 | .dma_filter = pl08x_filter_id, | ||
214 | .dma_capture = DMACH_AC97_PCMIN, | ||
215 | .dma_capture_mic = DMACH_AC97_MICIN, | ||
216 | }; | 197 | }; |
217 | 198 | ||
218 | static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32); | 199 | static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32); |
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c index 59d91b83b03d..b0be382ff6bb 100644 --- a/arch/arm/mach-s3c64xx/pm.c +++ b/arch/arm/mach-s3c64xx/pm.c | |||
@@ -285,7 +285,7 @@ static int s3c64xx_cpu_suspend(unsigned long arg) | |||
285 | } | 285 | } |
286 | 286 | ||
287 | /* mapping of interrupts to parts of the wakeup mask */ | 287 | /* mapping of interrupts to parts of the wakeup mask */ |
288 | static struct samsung_wakeup_mask wake_irqs[] = { | 288 | static const struct samsung_wakeup_mask wake_irqs[] = { |
289 | { .irq = IRQ_RTC_ALARM, .bit = S3C64XX_PWRCFG_RTC_ALARM_DISABLE, }, | 289 | { .irq = IRQ_RTC_ALARM, .bit = S3C64XX_PWRCFG_RTC_ALARM_DISABLE, }, |
290 | { .irq = IRQ_RTC_TIC, .bit = S3C64XX_PWRCFG_RTC_TICK_DISABLE, }, | 290 | { .irq = IRQ_RTC_TIC, .bit = S3C64XX_PWRCFG_RTC_TICK_DISABLE, }, |
291 | { .irq = IRQ_PENDN, .bit = S3C64XX_PWRCFG_TS_DISABLE, }, | 291 | { .irq = IRQ_PENDN, .bit = S3C64XX_PWRCFG_TS_DISABLE, }, |
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index 0c6bb458b7a4..e19266844e16 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c | |||
@@ -31,9 +31,21 @@ static struct { | |||
31 | int bit; | 31 | int bit; |
32 | } apmu_cpus[NR_CPUS]; | 32 | } apmu_cpus[NR_CPUS]; |
33 | 33 | ||
34 | #define WUPCR_OFFS 0x10 | 34 | #define WUPCR_OFFS 0x10 /* Wake Up Control Register */ |
35 | #define PSTR_OFFS 0x40 | 35 | #define PSTR_OFFS 0x40 /* Power Status Register */ |
36 | #define CPUNCR_OFFS(n) (0x100 + (0x10 * (n))) | 36 | #define CPUNCR_OFFS(n) (0x100 + (0x10 * (n))) |
37 | /* CPUn Power Status Control Register */ | ||
38 | #define DBGRCR_OFFS 0x180 /* Debug Resource Reset Control Reg. */ | ||
39 | |||
40 | /* Power Status Register */ | ||
41 | #define CPUNST(r, n) (((r) >> (n * 4)) & 3) /* CPUn Status Bit */ | ||
42 | #define CPUST_RUN 0 /* Run Mode */ | ||
43 | #define CPUST_STANDBY 3 /* CoreStandby Mode */ | ||
44 | |||
45 | /* Debug Resource Reset Control Register */ | ||
46 | #define DBGCPUREN BIT(24) /* CPU Other Reset Request Enable */ | ||
47 | #define DBGCPUNREN(n) BIT((n) + 20) /* CPUn Reset Request Enable */ | ||
48 | #define DBGCPUPREN BIT(19) /* CPU Peripheral Reset Req. Enable */ | ||
37 | 49 | ||
38 | static int __maybe_unused apmu_power_on(void __iomem *p, int bit) | 50 | static int __maybe_unused apmu_power_on(void __iomem *p, int bit) |
39 | { | 51 | { |
@@ -59,7 +71,7 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit) | |||
59 | int k; | 71 | int k; |
60 | 72 | ||
61 | for (k = 0; k < 1000; k++) { | 73 | for (k = 0; k < 1000; k++) { |
62 | if (((readl_relaxed(p + PSTR_OFFS) >> (bit * 4)) & 0x03) == 3) | 74 | if (CPUNST(readl_relaxed(p + PSTR_OFFS), bit) == CPUST_STANDBY) |
63 | return 1; | 75 | return 1; |
64 | 76 | ||
65 | mdelay(1); | 77 | mdelay(1); |
@@ -78,6 +90,8 @@ static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu) | |||
78 | #ifdef CONFIG_SMP | 90 | #ifdef CONFIG_SMP |
79 | static void apmu_init_cpu(struct resource *res, int cpu, int bit) | 91 | static void apmu_init_cpu(struct resource *res, int cpu, int bit) |
80 | { | 92 | { |
93 | u32 x; | ||
94 | |||
81 | if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem) | 95 | if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem) |
82 | return; | 96 | return; |
83 | 97 | ||
@@ -85,6 +99,11 @@ static void apmu_init_cpu(struct resource *res, int cpu, int bit) | |||
85 | apmu_cpus[cpu].bit = bit; | 99 | apmu_cpus[cpu].bit = bit; |
86 | 100 | ||
87 | pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res); | 101 | pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res); |
102 | |||
103 | /* Setup for debug mode */ | ||
104 | x = readl(apmu_cpus[cpu].iomem + DBGRCR_OFFS); | ||
105 | x |= DBGCPUREN | DBGCPUNREN(bit) | DBGCPUPREN; | ||
106 | writel(x, apmu_cpus[cpu].iomem + DBGRCR_OFFS); | ||
88 | } | 107 | } |
89 | 108 | ||
90 | static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit), | 109 | static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit), |
@@ -197,21 +216,9 @@ static void __init shmobile_smp_apmu_prepare_cpus_dt(unsigned int max_cpus) | |||
197 | rcar_gen2_pm_init(); | 216 | rcar_gen2_pm_init(); |
198 | } | 217 | } |
199 | 218 | ||
200 | static int shmobile_smp_apmu_boot_secondary_md21(unsigned int cpu, | ||
201 | struct task_struct *idle) | ||
202 | { | ||
203 | /* Error out when hardware debug mode is enabled */ | ||
204 | if (rcar_gen2_read_mode_pins() & BIT(21)) { | ||
205 | pr_warn("Unable to boot CPU%u when MD21 is set\n", cpu); | ||
206 | return -ENOTSUPP; | ||
207 | } | ||
208 | |||
209 | return shmobile_smp_apmu_boot_secondary(cpu, idle); | ||
210 | } | ||
211 | |||
212 | static struct smp_operations apmu_smp_ops __initdata = { | 219 | static struct smp_operations apmu_smp_ops __initdata = { |
213 | .smp_prepare_cpus = shmobile_smp_apmu_prepare_cpus_dt, | 220 | .smp_prepare_cpus = shmobile_smp_apmu_prepare_cpus_dt, |
214 | .smp_boot_secondary = shmobile_smp_apmu_boot_secondary_md21, | 221 | .smp_boot_secondary = shmobile_smp_apmu_boot_secondary, |
215 | #ifdef CONFIG_HOTPLUG_CPU | 222 | #ifdef CONFIG_HOTPLUG_CPU |
216 | .cpu_can_disable = shmobile_smp_cpu_can_disable, | 223 | .cpu_can_disable = shmobile_smp_cpu_can_disable, |
217 | .cpu_die = shmobile_smp_apmu_cpu_die, | 224 | .cpu_die = shmobile_smp_apmu_cpu_die, |
diff --git a/arch/arm/mach-shmobile/pm-rcar-gen2.c b/arch/arm/mach-shmobile/pm-rcar-gen2.c index dd9ac366868f..0178da7ace82 100644 --- a/arch/arm/mach-shmobile/pm-rcar-gen2.c +++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c | |||
@@ -20,14 +20,30 @@ | |||
20 | 20 | ||
21 | /* RST */ | 21 | /* RST */ |
22 | #define RST 0xe6160000 | 22 | #define RST 0xe6160000 |
23 | #define CA15BAR 0x0020 | 23 | |
24 | #define CA7BAR 0x0030 | 24 | #define CA15BAR 0x0020 /* CA15 Boot Address Register */ |
25 | #define CA15RESCNT 0x0040 | 25 | #define CA7BAR 0x0030 /* CA7 Boot Address Register */ |
26 | #define CA7RESCNT 0x0044 | 26 | #define CA15RESCNT 0x0040 /* CA15 Reset Control Register */ |
27 | #define CA7RESCNT 0x0044 /* CA7 Reset Control Register */ | ||
28 | |||
29 | /* SYS Boot Address Register */ | ||
30 | #define SBAR_BAREN BIT(4) /* SBAR is valid */ | ||
31 | |||
32 | /* Reset Control Registers */ | ||
33 | #define CA15RESCNT_CODE 0xa5a50000 | ||
34 | #define CA15RESCNT_CPUS 0xf /* CPU0-3 */ | ||
35 | #define CA7RESCNT_CODE 0x5a5a0000 | ||
36 | #define CA7RESCNT_CPUS 0xf /* CPU0-3 */ | ||
37 | |||
27 | 38 | ||
28 | /* On-chip RAM */ | 39 | /* On-chip RAM */ |
29 | #define ICRAM1 0xe63c0000 /* Inter Connect RAM1 (4 KiB) */ | 40 | #define ICRAM1 0xe63c0000 /* Inter Connect RAM1 (4 KiB) */ |
30 | 41 | ||
42 | static inline u32 phys_to_sbar(phys_addr_t addr) | ||
43 | { | ||
44 | return (addr >> 8) & 0xfffffc00; | ||
45 | } | ||
46 | |||
31 | /* SYSC */ | 47 | /* SYSC */ |
32 | #define SYSCIER 0x0c | 48 | #define SYSCIER 0x0c |
33 | #define SYSCIMR 0x10 | 49 | #define SYSCIMR 0x10 |
@@ -82,22 +98,24 @@ void __init rcar_gen2_pm_init(void) | |||
82 | 98 | ||
83 | /* setup reset vectors */ | 99 | /* setup reset vectors */ |
84 | p = ioremap_nocache(RST, 0x63); | 100 | p = ioremap_nocache(RST, 0x63); |
85 | bar = (boot_vector_addr >> 8) & 0xfffffc00; | 101 | bar = phys_to_sbar(boot_vector_addr); |
86 | if (has_a15) { | 102 | if (has_a15) { |
87 | writel_relaxed(bar, p + CA15BAR); | 103 | writel_relaxed(bar, p + CA15BAR); |
88 | writel_relaxed(bar | 0x10, p + CA15BAR); | 104 | writel_relaxed(bar | SBAR_BAREN, p + CA15BAR); |
89 | 105 | ||
90 | /* de-assert reset for CA15 CPUs */ | 106 | /* de-assert reset for CA15 CPUs */ |
91 | writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | | 107 | writel_relaxed((readl_relaxed(p + CA15RESCNT) & |
92 | 0xa5a50000, p + CA15RESCNT); | 108 | ~CA15RESCNT_CPUS) | CA15RESCNT_CODE, |
109 | p + CA15RESCNT); | ||
93 | } | 110 | } |
94 | if (has_a7) { | 111 | if (has_a7) { |
95 | writel_relaxed(bar, p + CA7BAR); | 112 | writel_relaxed(bar, p + CA7BAR); |
96 | writel_relaxed(bar | 0x10, p + CA7BAR); | 113 | writel_relaxed(bar | SBAR_BAREN, p + CA7BAR); |
97 | 114 | ||
98 | /* de-assert reset for CA7 CPUs */ | 115 | /* de-assert reset for CA7 CPUs */ |
99 | writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | | 116 | writel_relaxed((readl_relaxed(p + CA7RESCNT) & |
100 | 0x5a5a0000, p + CA7RESCNT); | 117 | ~CA7RESCNT_CPUS) | CA7RESCNT_CODE, |
118 | p + CA7RESCNT); | ||
101 | } | 119 | } |
102 | iounmap(p); | 120 | iounmap(p); |
103 | 121 | ||
diff --git a/arch/arm/mach-shmobile/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h index 8a66b4aae035..6792e249cf56 100644 --- a/arch/arm/mach-shmobile/rcar-gen2.h +++ b/arch/arm/mach-shmobile/rcar-gen2.h | |||
@@ -2,8 +2,6 @@ | |||
2 | #define __ASM_RCAR_GEN2_H__ | 2 | #define __ASM_RCAR_GEN2_H__ |
3 | 3 | ||
4 | void rcar_gen2_timer_init(void); | 4 | void rcar_gen2_timer_init(void); |
5 | #define MD(nr) BIT(nr) | ||
6 | u32 rcar_gen2_read_mode_pins(void); | ||
7 | void rcar_gen2_reserve(void); | 5 | void rcar_gen2_reserve(void); |
8 | void rcar_gen2_pm_init(void); | 6 | void rcar_gen2_pm_init(void); |
9 | 7 | ||
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c index ac63fa407b64..52d466b75973 100644 --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c | |||
@@ -29,24 +29,6 @@ | |||
29 | #include "common.h" | 29 | #include "common.h" |
30 | #include "rcar-gen2.h" | 30 | #include "rcar-gen2.h" |
31 | 31 | ||
32 | #define MODEMR 0xe6160060 | ||
33 | |||
34 | u32 rcar_gen2_read_mode_pins(void) | ||
35 | { | ||
36 | static u32 mode; | ||
37 | static bool mode_valid; | ||
38 | |||
39 | if (!mode_valid) { | ||
40 | void __iomem *modemr = ioremap_nocache(MODEMR, 4); | ||
41 | BUG_ON(!modemr); | ||
42 | mode = ioread32(modemr); | ||
43 | iounmap(modemr); | ||
44 | mode_valid = true; | ||
45 | } | ||
46 | |||
47 | return mode; | ||
48 | } | ||
49 | |||
50 | static unsigned int __init get_extal_freq(void) | 32 | static unsigned int __init get_extal_freq(void) |
51 | { | 33 | { |
52 | struct device_node *cpg, *extal; | 34 | struct device_node *cpg, *extal; |
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c index 2d6417af73b5..2948c22cfc53 100644 --- a/arch/arm/mach-shmobile/smp-r8a7791.c +++ b/arch/arm/mach-shmobile/smp-r8a7791.c | |||
@@ -42,21 +42,9 @@ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus) | |||
42 | rcar_gen2_pm_init(); | 42 | rcar_gen2_pm_init(); |
43 | } | 43 | } |
44 | 44 | ||
45 | static int r8a7791_smp_boot_secondary(unsigned int cpu, | ||
46 | struct task_struct *idle) | ||
47 | { | ||
48 | /* Error out when hardware debug mode is enabled */ | ||
49 | if (rcar_gen2_read_mode_pins() & BIT(21)) { | ||
50 | pr_warn("Unable to boot CPU%u when MD21 is set\n", cpu); | ||
51 | return -ENOTSUPP; | ||
52 | } | ||
53 | |||
54 | return shmobile_smp_apmu_boot_secondary(cpu, idle); | ||
55 | } | ||
56 | |||
57 | const struct smp_operations r8a7791_smp_ops __initconst = { | 45 | const struct smp_operations r8a7791_smp_ops __initconst = { |
58 | .smp_prepare_cpus = r8a7791_smp_prepare_cpus, | 46 | .smp_prepare_cpus = r8a7791_smp_prepare_cpus, |
59 | .smp_boot_secondary = r8a7791_smp_boot_secondary, | 47 | .smp_boot_secondary = shmobile_smp_apmu_boot_secondary, |
60 | #ifdef CONFIG_HOTPLUG_CPU | 48 | #ifdef CONFIG_HOTPLUG_CPU |
61 | .cpu_can_disable = shmobile_smp_cpu_can_disable, | 49 | .cpu_can_disable = shmobile_smp_cpu_can_disable, |
62 | .cpu_die = shmobile_smp_apmu_cpu_die, | 50 | .cpu_die = shmobile_smp_apmu_cpu_die, |
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index 2e2bde271205..f44e3acb5c90 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c | |||
@@ -63,7 +63,9 @@ static const char * const sun8i_board_dt_compat[] = { | |||
63 | "allwinner,sun8i-a23", | 63 | "allwinner,sun8i-a23", |
64 | "allwinner,sun8i-a33", | 64 | "allwinner,sun8i-a33", |
65 | "allwinner,sun8i-a83t", | 65 | "allwinner,sun8i-a83t", |
66 | "allwinner,sun8i-h2-plus", | ||
66 | "allwinner,sun8i-h3", | 67 | "allwinner,sun8i-h3", |
68 | "allwinner,sun8i-v3s", | ||
67 | NULL, | 69 | NULL, |
68 | }; | 70 | }; |
69 | 71 | ||
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c index 7478f6fb3664..ea6bff404161 100644 --- a/arch/arm/mach-tegra/board-paz00.c +++ b/arch/arm/mach-tegra/board-paz00.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include "board.h" | 24 | #include "board.h" |
25 | 25 | ||
26 | static struct property_entry __initdata wifi_rfkill_prop[] = { | 26 | static struct property_entry wifi_rfkill_prop[] __initdata = { |
27 | PROPERTY_ENTRY_STRING("name", "wifi_rfkill"), | 27 | PROPERTY_ENTRY_STRING("name", "wifi_rfkill"), |
28 | PROPERTY_ENTRY_STRING("type", "wlan"), | 28 | PROPERTY_ENTRY_STRING("type", "wlan"), |
29 | { }, | 29 | { }, |
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 56d0eb6e254e..c2499bff4986 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | obj-y := pm.o | 5 | obj-y := pm.o |
6 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o | 6 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o |
7 | obj-$(CONFIG_MACH_MOP500) += board-mop500-audio.o | ||
8 | obj-$(CONFIG_SMP) += platsmp.o | 7 | obj-$(CONFIG_SMP) += platsmp.o |
9 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 8 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
10 | obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o | 9 | obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o |
diff --git a/arch/arm/mach-ux500/board-mop500-audio.c b/arch/arm/mach-ux500/board-mop500-audio.c deleted file mode 100644 index b2a0899e7453..000000000000 --- a/arch/arm/mach-ux500/board-mop500-audio.c +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License terms: GNU General Public License (GPL), version 2 | ||
5 | */ | ||
6 | |||
7 | #include <linux/platform_device.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <linux/gpio.h> | ||
10 | #include <linux/platform_data/dma-ste-dma40.h> | ||
11 | |||
12 | #include <linux/platform_data/asoc-ux500-msp.h> | ||
13 | |||
14 | #include "ste-dma40-db8500.h" | ||
15 | #include "board-mop500.h" | ||
16 | |||
17 | static struct stedma40_chan_cfg msp0_dma_rx = { | ||
18 | .high_priority = true, | ||
19 | .dir = DMA_DEV_TO_MEM, | ||
20 | .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0, | ||
21 | }; | ||
22 | |||
23 | static struct stedma40_chan_cfg msp0_dma_tx = { | ||
24 | .high_priority = true, | ||
25 | .dir = DMA_MEM_TO_DEV, | ||
26 | .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0, | ||
27 | }; | ||
28 | |||
29 | struct msp_i2s_platform_data msp0_platform_data = { | ||
30 | .id = 0, | ||
31 | .msp_i2s_dma_rx = &msp0_dma_rx, | ||
32 | .msp_i2s_dma_tx = &msp0_dma_tx, | ||
33 | }; | ||
34 | |||
35 | static struct stedma40_chan_cfg msp1_dma_rx = { | ||
36 | .high_priority = true, | ||
37 | .dir = DMA_DEV_TO_MEM, | ||
38 | .dev_type = DB8500_DMA_DEV30_MSP3, | ||
39 | }; | ||
40 | |||
41 | static struct stedma40_chan_cfg msp1_dma_tx = { | ||
42 | .high_priority = true, | ||
43 | .dir = DMA_MEM_TO_DEV, | ||
44 | .dev_type = DB8500_DMA_DEV30_MSP1, | ||
45 | }; | ||
46 | |||
47 | struct msp_i2s_platform_data msp1_platform_data = { | ||
48 | .id = 1, | ||
49 | .msp_i2s_dma_rx = NULL, | ||
50 | .msp_i2s_dma_tx = &msp1_dma_tx, | ||
51 | }; | ||
52 | |||
53 | static struct stedma40_chan_cfg msp2_dma_rx = { | ||
54 | .high_priority = true, | ||
55 | .dir = DMA_DEV_TO_MEM, | ||
56 | .dev_type = DB8500_DMA_DEV14_MSP2, | ||
57 | }; | ||
58 | |||
59 | static struct stedma40_chan_cfg msp2_dma_tx = { | ||
60 | .high_priority = true, | ||
61 | .dir = DMA_MEM_TO_DEV, | ||
62 | .dev_type = DB8500_DMA_DEV14_MSP2, | ||
63 | .use_fixed_channel = true, | ||
64 | .phy_channel = 1, | ||
65 | }; | ||
66 | |||
67 | struct msp_i2s_platform_data msp2_platform_data = { | ||
68 | .id = 2, | ||
69 | .msp_i2s_dma_rx = &msp2_dma_rx, | ||
70 | .msp_i2s_dma_tx = &msp2_dma_tx, | ||
71 | }; | ||
72 | |||
73 | struct msp_i2s_platform_data msp3_platform_data = { | ||
74 | .id = 3, | ||
75 | .msp_i2s_dma_rx = &msp1_dma_rx, | ||
76 | .msp_i2s_dma_tx = NULL, | ||
77 | }; | ||
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h deleted file mode 100644 index 7c7b0adca582..000000000000 --- a/arch/arm/mach-ux500/board-mop500.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef __BOARD_MOP500_H | ||
8 | #define __BOARD_MOP500_H | ||
9 | |||
10 | #include <linux/platform_data/asoc-ux500-msp.h> | ||
11 | |||
12 | extern struct msp_i2s_platform_data msp0_platform_data; | ||
13 | extern struct msp_i2s_platform_data msp1_platform_data; | ||
14 | extern struct msp_i2s_platform_data msp2_platform_data; | ||
15 | extern struct msp_i2s_platform_data msp3_platform_data; | ||
16 | |||
17 | #endif | ||
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 46b1da1bf5d2..24529cf58df6 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <linux/amba/bus.h> | 14 | #include <linux/amba/bus.h> |
15 | #include <linux/init.h> | ||
16 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
17 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
18 | #include <linux/irqchip.h> | 17 | #include <linux/irqchip.h> |
@@ -34,7 +33,6 @@ | |||
34 | 33 | ||
35 | #include "setup.h" | 34 | #include "setup.h" |
36 | 35 | ||
37 | #include "board-mop500.h" | ||
38 | #include "db8500-regs.h" | 36 | #include "db8500-regs.h" |
39 | 37 | ||
40 | static int __init ux500_l2x0_unlock(void) | 38 | static int __init ux500_l2x0_unlock(void) |
@@ -142,21 +140,6 @@ static struct arm_pmu_platdata db8500_pmu_platdata = { | |||
142 | static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { | 140 | static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { |
143 | /* Requires call-back bindings. */ | 141 | /* Requires call-back bindings. */ |
144 | OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), | 142 | OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), |
145 | /* Requires DMA bindings. */ | ||
146 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, | ||
147 | "ux500-msp-i2s.0", &msp0_platform_data), | ||
148 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000, | ||
149 | "ux500-msp-i2s.1", &msp1_platform_data), | ||
150 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000, | ||
151 | "ux500-msp-i2s.2", &msp2_platform_data), | ||
152 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000, | ||
153 | "ux500-msp-i2s.3", &msp3_platform_data), | ||
154 | /* Requires non-DT:able platform data. */ | ||
155 | OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", NULL), | ||
156 | OF_DEV_AUXDATA("stericsson,ux500-cryp", 0xa03cb000, "cryp1", NULL), | ||
157 | OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL), | ||
158 | OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0", | ||
159 | NULL), | ||
160 | {}, | 143 | {}, |
161 | }; | 144 | }; |
162 | 145 | ||
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index 8f2f615ff958..e0ee139fdebf 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
@@ -31,10 +31,14 @@ | |||
31 | #define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4 | 31 | #define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4 |
32 | #define UX500_CPU1_WAKEMAGIC_OFFSET 0x1FF0 | 32 | #define UX500_CPU1_WAKEMAGIC_OFFSET 0x1FF0 |
33 | 33 | ||
34 | static void wakeup_secondary(void) | 34 | static void __iomem *backupram; |
35 | |||
36 | static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) | ||
35 | { | 37 | { |
36 | struct device_node *np; | 38 | struct device_node *np; |
37 | static void __iomem *backupram; | 39 | static void __iomem *scu_base; |
40 | unsigned int ncores; | ||
41 | int i; | ||
38 | 42 | ||
39 | np = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram"); | 43 | np = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram"); |
40 | if (!np) { | 44 | if (!np) { |
@@ -48,29 +52,6 @@ static void wakeup_secondary(void) | |||
48 | return; | 52 | return; |
49 | } | 53 | } |
50 | 54 | ||
51 | /* | ||
52 | * write the address of secondary startup into the backup ram register | ||
53 | * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the | ||
54 | * backup ram register at offset 0x1FF0, which is what boot rom code | ||
55 | * is waiting for. This will wake up the secondary core from WFE. | ||
56 | */ | ||
57 | writel(virt_to_phys(secondary_startup), | ||
58 | backupram + UX500_CPU1_JUMPADDR_OFFSET); | ||
59 | writel(0xA1FEED01, | ||
60 | backupram + UX500_CPU1_WAKEMAGIC_OFFSET); | ||
61 | |||
62 | /* make sure write buffer is drained */ | ||
63 | mb(); | ||
64 | iounmap(backupram); | ||
65 | } | ||
66 | |||
67 | static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) | ||
68 | { | ||
69 | struct device_node *np; | ||
70 | static void __iomem *scu_base; | ||
71 | unsigned int ncores; | ||
72 | int i; | ||
73 | |||
74 | np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); | 55 | np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); |
75 | if (!np) { | 56 | if (!np) { |
76 | pr_err("No SCU base address\n"); | 57 | pr_err("No SCU base address\n"); |
@@ -92,7 +73,19 @@ static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) | |||
92 | 73 | ||
93 | static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) | 74 | static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) |
94 | { | 75 | { |
95 | wakeup_secondary(); | 76 | /* |
77 | * write the address of secondary startup into the backup ram register | ||
78 | * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the | ||
79 | * backup ram register at offset 0x1FF0, which is what boot rom code | ||
80 | * is waiting for. This will wake up the secondary core from WFE. | ||
81 | */ | ||
82 | writel(virt_to_phys(secondary_startup), | ||
83 | backupram + UX500_CPU1_JUMPADDR_OFFSET); | ||
84 | writel(0xA1FEED01, | ||
85 | backupram + UX500_CPU1_WAKEMAGIC_OFFSET); | ||
86 | |||
87 | /* make sure write buffer is drained */ | ||
88 | mb(); | ||
96 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); | 89 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); |
97 | return 0; | 90 | return 0; |
98 | } | 91 | } |
diff --git a/arch/arm/mach-ux500/ste-dma40-db8500.h b/arch/arm/mach-ux500/ste-dma40-db8500.h deleted file mode 100644 index 0296ae5b0fd9..000000000000 --- a/arch/arm/mach-ux500/ste-dma40-db8500.h +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ux500/ste_dma40_db8500.h | ||
3 | * DB8500-SoC-specific configuration for DMA40 | ||
4 | * | ||
5 | * Copyright (C) ST-Ericsson 2007-2010 | ||
6 | * License terms: GNU General Public License (GPL) version 2 | ||
7 | * Author: Per Friden <per.friden@stericsson.com> | ||
8 | * Author: Jonas Aaberg <jonas.aberg@stericsson.com> | ||
9 | */ | ||
10 | #ifndef STE_DMA40_DB8500_H | ||
11 | #define STE_DMA40_DB8500_H | ||
12 | |||
13 | #define DB8500_DMA_NR_DEV 64 | ||
14 | |||
15 | /* | ||
16 | * Unless otherwise specified, all channels numbers are used for | ||
17 | * TX & RX, and can be used for either source or destination | ||
18 | * channels. | ||
19 | */ | ||
20 | enum dma_dev_type { | ||
21 | DB8500_DMA_DEV0_SPI0 = 0, | ||
22 | DB8500_DMA_DEV1_SD_MMC0 = 1, | ||
23 | DB8500_DMA_DEV2_SD_MMC1 = 2, | ||
24 | DB8500_DMA_DEV3_SD_MMC2 = 3, | ||
25 | DB8500_DMA_DEV4_I2C1 = 4, | ||
26 | DB8500_DMA_DEV5_I2C3 = 5, | ||
27 | DB8500_DMA_DEV6_I2C2 = 6, | ||
28 | DB8500_DMA_DEV7_I2C4 = 7, /* Only on V1 and later */ | ||
29 | DB8500_DMA_DEV8_SSP0 = 8, | ||
30 | DB8500_DMA_DEV9_SSP1 = 9, | ||
31 | DB8500_DMA_DEV10_MCDE_RX = 10, /* RX only */ | ||
32 | DB8500_DMA_DEV11_UART2 = 11, | ||
33 | DB8500_DMA_DEV12_UART1 = 12, | ||
34 | DB8500_DMA_DEV13_UART0 = 13, | ||
35 | DB8500_DMA_DEV14_MSP2 = 14, | ||
36 | DB8500_DMA_DEV15_I2C0 = 15, | ||
37 | DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15 = 16, | ||
38 | DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14 = 17, | ||
39 | DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13 = 18, | ||
40 | DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12 = 19, | ||
41 | DB8500_DMA_DEV20_SLIM0_CH0_HSI_CH0 = 20, | ||
42 | DB8500_DMA_DEV21_SLIM0_CH1_HSI_CH1 = 21, | ||
43 | DB8500_DMA_DEV22_SLIM0_CH2_HSI_CH2 = 22, | ||
44 | DB8500_DMA_DEV23_SLIM0_CH3_HSI_CH3 = 23, | ||
45 | DB8500_DMA_DEV24_SXA0 = 24, | ||
46 | DB8500_DMA_DEV25_SXA1 = 25, | ||
47 | DB8500_DMA_DEV26_SXA2 = 26, | ||
48 | DB8500_DMA_DEV27_SXA3 = 27, | ||
49 | DB8500_DMA_DEV28_SD_MM2 = 28, | ||
50 | DB8500_DMA_DEV29_SD_MM0 = 29, | ||
51 | DB8500_DMA_DEV30_MSP1 = 30, | ||
52 | /* On DB8500v2, MSP3 RX replaces MSP1 RX */ | ||
53 | DB8500_DMA_DEV30_MSP3 = 30, | ||
54 | DB8500_DMA_DEV31_MSP0_SLIM0_CH0 = 31, | ||
55 | DB8500_DMA_DEV32_SD_MM1 = 32, | ||
56 | DB8500_DMA_DEV33_SPI2 = 33, | ||
57 | DB8500_DMA_DEV34_I2C3_RX2_TX2 = 34, | ||
58 | DB8500_DMA_DEV35_SPI1 = 35, | ||
59 | DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11 = 36, | ||
60 | DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10 = 37, | ||
61 | DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9 = 38, | ||
62 | DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8 = 39, | ||
63 | DB8500_DMA_DEV40_SPI3 = 40, | ||
64 | DB8500_DMA_DEV41_SD_MM3 = 41, | ||
65 | DB8500_DMA_DEV42_SD_MM4 = 42, | ||
66 | DB8500_DMA_DEV43_SD_MM5 = 43, | ||
67 | DB8500_DMA_DEV44_SXA4 = 44, | ||
68 | DB8500_DMA_DEV45_SXA5 = 45, | ||
69 | DB8500_DMA_DEV46_SLIM0_CH8_SRC_SXA6 = 46, | ||
70 | DB8500_DMA_DEV47_SLIM0_CH9_SRC_SXA7 = 47, | ||
71 | DB8500_DMA_DEV48_CAC1 = 48, | ||
72 | DB8500_DMA_DEV49_CAC1_TX_HAC1_TX = 49, /* TX only */ | ||
73 | DB8500_DMA_DEV50_HAC1_TX = 50, /* TX only */ | ||
74 | DB8500_DMA_MEMCPY_TX_0 = 51, /* TX only */ | ||
75 | DB8500_DMA_DEV52_SLIM0_CH4_HSI_CH4 = 52, | ||
76 | DB8500_DMA_DEV53_SLIM0_CH5_HSI_CH5 = 53, | ||
77 | DB8500_DMA_DEV54_SLIM0_CH6_HSI_CH6 = 54, | ||
78 | DB8500_DMA_DEV55_SLIM0_CH7_HSI_CH7 = 55, | ||
79 | /* 56 -> 60 are channels reserved for memcpy only */ | ||
80 | DB8500_DMA_DEV61_CAC0 = 61, | ||
81 | DB8500_DMA_DEV62_CAC0_TX_HAC0_TX = 62, /* TX only */ | ||
82 | DB8500_DMA_DEV63_HAC0_TX = 63, /* TX only */ | ||
83 | }; | ||
84 | |||
85 | #endif | ||
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index cf7b95fddbb3..03fac123676d 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c | |||
@@ -77,15 +77,6 @@ static struct resource s3c_ac97_resource[] = { | |||
77 | [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97), | 77 | [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97), |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static struct s3c_audio_pdata s3c_ac97_pdata = { | ||
81 | #ifdef CONFIG_S3C24XX_DMAC | ||
82 | .dma_filter = s3c24xx_dma_filter, | ||
83 | #endif | ||
84 | .dma_playback = (void *)DMACH_PCM_OUT, | ||
85 | .dma_capture = (void *)DMACH_PCM_IN, | ||
86 | .dma_capture_mic = (void *)DMACH_MIC_IN, | ||
87 | }; | ||
88 | |||
89 | struct platform_device s3c_device_ac97 = { | 80 | struct platform_device s3c_device_ac97 = { |
90 | .name = "samsung-ac97", | 81 | .name = "samsung-ac97", |
91 | .id = -1, | 82 | .id = -1, |
@@ -94,7 +85,6 @@ struct platform_device s3c_device_ac97 = { | |||
94 | .dev = { | 85 | .dev = { |
95 | .dma_mask = &samsung_device_dma_mask, | 86 | .dma_mask = &samsung_device_dma_mask, |
96 | .coherent_dma_mask = DMA_BIT_MASK(32), | 87 | .coherent_dma_mask = DMA_BIT_MASK(32), |
97 | .platform_data = &s3c_ac97_pdata, | ||
98 | } | 88 | } |
99 | }; | 89 | }; |
100 | #endif /* CONFIG_CPU_S3C2440 */ | 90 | #endif /* CONFIG_CPU_S3C2440 */ |
@@ -574,14 +564,6 @@ static struct resource s3c_iis_resource[] = { | |||
574 | [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS), | 564 | [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS), |
575 | }; | 565 | }; |
576 | 566 | ||
577 | static struct s3c_audio_pdata s3c_iis_platdata = { | ||
578 | #ifdef CONFIG_S3C24XX_DMAC | ||
579 | .dma_filter = s3c24xx_dma_filter, | ||
580 | #endif | ||
581 | .dma_playback = (void *)DMACH_I2S_OUT, | ||
582 | .dma_capture = (void *)DMACH_I2S_IN, | ||
583 | }; | ||
584 | |||
585 | struct platform_device s3c_device_iis = { | 567 | struct platform_device s3c_device_iis = { |
586 | .name = "s3c24xx-iis", | 568 | .name = "s3c24xx-iis", |
587 | .id = -1, | 569 | .id = -1, |
@@ -590,7 +572,6 @@ struct platform_device s3c_device_iis = { | |||
590 | .dev = { | 572 | .dev = { |
591 | .dma_mask = &samsung_device_dma_mask, | 573 | .dma_mask = &samsung_device_dma_mask, |
592 | .coherent_dma_mask = DMA_BIT_MASK(32), | 574 | .coherent_dma_mask = DMA_BIT_MASK(32), |
593 | .platform_data = &s3c_iis_platdata, | ||
594 | } | 575 | } |
595 | }; | 576 | }; |
596 | #endif /* CONFIG_PLAT_S3C24XX */ | 577 | #endif /* CONFIG_PLAT_S3C24XX */ |
diff --git a/arch/arm/plat-samsung/include/plat/wakeup-mask.h b/arch/arm/plat-samsung/include/plat/wakeup-mask.h index 43e4acd2e1c6..bbfa84b0505a 100644 --- a/arch/arm/plat-samsung/include/plat/wakeup-mask.h +++ b/arch/arm/plat-samsung/include/plat/wakeup-mask.h | |||
@@ -38,7 +38,7 @@ struct samsung_wakeup_mask { | |||
38 | * required to be correct before we enter sleep. | 38 | * required to be correct before we enter sleep. |
39 | */ | 39 | */ |
40 | extern void samsung_sync_wakemask(void __iomem *reg, | 40 | extern void samsung_sync_wakemask(void __iomem *reg, |
41 | struct samsung_wakeup_mask *masks, | 41 | const struct samsung_wakeup_mask *masks, |
42 | int nr_masks); | 42 | int nr_masks); |
43 | 43 | ||
44 | #endif /* __PLAT_WAKEUP_MASK_H */ | 44 | #endif /* __PLAT_WAKEUP_MASK_H */ |
diff --git a/arch/arm/plat-samsung/wakeup-mask.c b/arch/arm/plat-samsung/wakeup-mask.c index 20c3d9117cc2..b9de6b543330 100644 --- a/arch/arm/plat-samsung/wakeup-mask.c +++ b/arch/arm/plat-samsung/wakeup-mask.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <plat/pm.h> | 20 | #include <plat/pm.h> |
21 | 21 | ||
22 | void samsung_sync_wakemask(void __iomem *reg, | 22 | void samsung_sync_wakemask(void __iomem *reg, |
23 | struct samsung_wakeup_mask *mask, int nr_mask) | 23 | const struct samsung_wakeup_mask *mask, int nr_mask) |
24 | { | 24 | { |
25 | struct irq_data *data; | 25 | struct irq_data *data; |
26 | u32 val; | 26 | u32 val; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi index fc033c0d2a0f..eada0b58ba1c 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi | |||
@@ -356,5 +356,21 @@ | |||
356 | status = "disabled"; | 356 | status = "disabled"; |
357 | }; | 357 | }; |
358 | }; | 358 | }; |
359 | |||
360 | vpu: vpu@d0100000 { | ||
361 | compatible = "amlogic,meson-gx-vpu"; | ||
362 | reg = <0x0 0xd0100000 0x0 0x100000>, | ||
363 | <0x0 0xc883c000 0x0 0x1000>, | ||
364 | <0x0 0xc8838000 0x0 0x1000>; | ||
365 | reg-names = "vpu", "hhi", "dmc"; | ||
366 | interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>; | ||
367 | #address-cells = <1>; | ||
368 | #size-cells = <0>; | ||
369 | |||
370 | /* CVBS VDAC output port */ | ||
371 | cvbs_vdac_port: port@0 { | ||
372 | reg = <0>; | ||
373 | }; | ||
374 | }; | ||
359 | }; | 375 | }; |
360 | }; | 376 | }; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts index 969682092e0f..4cbd626a9e88 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts | |||
@@ -142,6 +142,16 @@ | |||
142 | clocks = <&wifi32k>; | 142 | clocks = <&wifi32k>; |
143 | clock-names = "ext_clock"; | 143 | clock-names = "ext_clock"; |
144 | }; | 144 | }; |
145 | |||
146 | cvbs-connector { | ||
147 | compatible = "composite-video-connector"; | ||
148 | |||
149 | port { | ||
150 | cvbs_connector_in: endpoint { | ||
151 | remote-endpoint = <&cvbs_vdac_out>; | ||
152 | }; | ||
153 | }; | ||
154 | }; | ||
145 | }; | 155 | }; |
146 | 156 | ||
147 | &uart_AO { | 157 | &uart_AO { |
@@ -229,3 +239,9 @@ | |||
229 | clocks = <&clkc CLKID_FCLK_DIV4>; | 239 | clocks = <&clkc CLKID_FCLK_DIV4>; |
230 | clock-names = "clkin0"; | 240 | clock-names = "clkin0"; |
231 | }; | 241 | }; |
242 | |||
243 | &cvbs_vdac_port { | ||
244 | cvbs_vdac_out: endpoint { | ||
245 | remote-endpoint = <&cvbs_connector_in>; | ||
246 | }; | ||
247 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi index 203be28978d5..4a96e0f6f926 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi | |||
@@ -125,6 +125,16 @@ | |||
125 | clocks = <&wifi32k>; | 125 | clocks = <&wifi32k>; |
126 | clock-names = "ext_clock"; | 126 | clock-names = "ext_clock"; |
127 | }; | 127 | }; |
128 | |||
129 | cvbs-connector { | ||
130 | compatible = "composite-video-connector"; | ||
131 | |||
132 | port { | ||
133 | cvbs_connector_in: endpoint { | ||
134 | remote-endpoint = <&cvbs_vdac_out>; | ||
135 | }; | ||
136 | }; | ||
137 | }; | ||
128 | }; | 138 | }; |
129 | 139 | ||
130 | /* This UART is brought out to the DB9 connector */ | 140 | /* This UART is brought out to the DB9 connector */ |
@@ -234,3 +244,9 @@ | |||
234 | clocks = <&clkc CLKID_FCLK_DIV4>; | 244 | clocks = <&clkc CLKID_FCLK_DIV4>; |
235 | clock-names = "clkin0"; | 245 | clock-names = "clkin0"; |
236 | }; | 246 | }; |
247 | |||
248 | &cvbs_vdac_port { | ||
249 | cvbs_vdac_out: endpoint { | ||
250 | remote-endpoint = <&cvbs_connector_in>; | ||
251 | }; | ||
252 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi index 51edd5b5c460..596240c38a9c 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | |||
@@ -506,3 +506,7 @@ | |||
506 | <&clkc CLKID_FCLK_DIV2>; | 506 | <&clkc CLKID_FCLK_DIV2>; |
507 | clock-names = "core", "clkin0", "clkin1"; | 507 | clock-names = "core", "clkin0", "clkin1"; |
508 | }; | 508 | }; |
509 | |||
510 | &vpu { | ||
511 | compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu"; | ||
512 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts index e99101ae9664..cea4a3eded9b 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts | |||
@@ -117,6 +117,16 @@ | |||
117 | clocks = <&wifi32k>; | 117 | clocks = <&wifi32k>; |
118 | clock-names = "ext_clock"; | 118 | clock-names = "ext_clock"; |
119 | }; | 119 | }; |
120 | |||
121 | cvbs-connector { | ||
122 | compatible = "composite-video-connector"; | ||
123 | |||
124 | port { | ||
125 | cvbs_connector_in: endpoint { | ||
126 | remote-endpoint = <&cvbs_vdac_out>; | ||
127 | }; | ||
128 | }; | ||
129 | }; | ||
120 | }; | 130 | }; |
121 | 131 | ||
122 | &uart_AO { | 132 | &uart_AO { |
@@ -203,3 +213,9 @@ | |||
203 | clocks = <&clkc CLKID_FCLK_DIV4>; | 213 | clocks = <&clkc CLKID_FCLK_DIV4>; |
204 | clock-names = "clkin0"; | 214 | clock-names = "clkin0"; |
205 | }; | 215 | }; |
216 | |||
217 | &cvbs_vdac_port { | ||
218 | cvbs_vdac_out: endpoint { | ||
219 | remote-endpoint = <&cvbs_connector_in>; | ||
220 | }; | ||
221 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi index 9f89b99c4806..69216246275d 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | |||
@@ -43,7 +43,7 @@ | |||
43 | 43 | ||
44 | #include "meson-gx.dtsi" | 44 | #include "meson-gx.dtsi" |
45 | #include <dt-bindings/clock/gxbb-clkc.h> | 45 | #include <dt-bindings/clock/gxbb-clkc.h> |
46 | #include <dt-bindings/gpio/meson-gxbb-gpio.h> | 46 | #include <dt-bindings/gpio/meson-gxl-gpio.h> |
47 | 47 | ||
48 | / { | 48 | / { |
49 | compatible = "amlogic,meson-gxl"; | 49 | compatible = "amlogic,meson-gxl"; |
@@ -299,3 +299,7 @@ | |||
299 | <&clkc CLKID_FCLK_DIV2>; | 299 | <&clkc CLKID_FCLK_DIV2>; |
300 | clock-names = "core", "clkin0", "clkin1"; | 300 | clock-names = "core", "clkin0", "clkin1"; |
301 | }; | 301 | }; |
302 | |||
303 | &vpu { | ||
304 | compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu"; | ||
305 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts index f859d75db8bd..5a337d339df1 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts | |||
@@ -90,6 +90,16 @@ | |||
90 | compatible = "mmc-pwrseq-emmc"; | 90 | compatible = "mmc-pwrseq-emmc"; |
91 | reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>; | 91 | reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>; |
92 | }; | 92 | }; |
93 | |||
94 | cvbs-connector { | ||
95 | compatible = "composite-video-connector"; | ||
96 | |||
97 | port { | ||
98 | cvbs_connector_in: endpoint { | ||
99 | remote-endpoint = <&cvbs_vdac_out>; | ||
100 | }; | ||
101 | }; | ||
102 | }; | ||
93 | }; | 103 | }; |
94 | 104 | ||
95 | /* This UART is brought out to the DB9 connector */ | 105 | /* This UART is brought out to the DB9 connector */ |
@@ -167,3 +177,9 @@ | |||
167 | max-speed = <1000>; | 177 | max-speed = <1000>; |
168 | }; | 178 | }; |
169 | }; | 179 | }; |
180 | |||
181 | &cvbs_vdac_port { | ||
182 | cvbs_vdac_out: endpoint { | ||
183 | remote-endpoint = <&cvbs_connector_in>; | ||
184 | }; | ||
185 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi index c1974bbbddea..eb2f0c3e5e53 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | |||
@@ -112,3 +112,7 @@ | |||
112 | }; | 112 | }; |
113 | }; | 113 | }; |
114 | }; | 114 | }; |
115 | |||
116 | &vpu { | ||
117 | compatible = "amlogic,meson-gxm-vpu", "amlogic,meson-gx-vpu"; | ||
118 | }; | ||
diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts index a852e28a40e1..a83ed2c6bbf7 100644 --- a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts +++ b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts | |||
@@ -81,7 +81,7 @@ | |||
81 | #address-cells = <0>; | 81 | #address-cells = <0>; |
82 | interrupt-controller; | 82 | interrupt-controller; |
83 | reg = <0x0 0x2c001000 0 0x1000>, | 83 | reg = <0x0 0x2c001000 0 0x1000>, |
84 | <0x0 0x2c002000 0 0x1000>, | 84 | <0x0 0x2c002000 0 0x2000>, |
85 | <0x0 0x2c004000 0 0x2000>, | 85 | <0x0 0x2c004000 0 0x2000>, |
86 | <0x0 0x2c006000 0 0x2000>; | 86 | <0x0 0x2c006000 0 0x2000>; |
87 | interrupts = <1 9 0xf04>; | 87 | interrupts = <1 9 0xf04>; |
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index 9d1d7ad9b075..29ed6b61c737 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi | |||
@@ -64,6 +64,16 @@ | |||
64 | reg = <0x0 0x86000000 0x0 0x200000>; | 64 | reg = <0x0 0x86000000 0x0 0x200000>; |
65 | no-map; | 65 | no-map; |
66 | }; | 66 | }; |
67 | |||
68 | memory@85800000 { | ||
69 | reg = <0x0 0x85800000 0x0 0x800000>; | ||
70 | no-map; | ||
71 | }; | ||
72 | |||
73 | memory@86200000 { | ||
74 | reg = <0x0 0x86200000 0x0 0x2600000>; | ||
75 | no-map; | ||
76 | }; | ||
67 | }; | 77 | }; |
68 | 78 | ||
69 | cpus { | 79 | cpus { |
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts index 6ffb0517421a..dbea2c3d8f0c 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts +++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts | |||
@@ -169,7 +169,7 @@ | |||
169 | power-source = <3300>; | 169 | power-source = <3300>; |
170 | }; | 170 | }; |
171 | 171 | ||
172 | sdhi0_pins_uhs: sd0 { | 172 | sdhi0_pins_uhs: sd0_uhs { |
173 | groups = "sdhi0_data4", "sdhi0_ctrl"; | 173 | groups = "sdhi0_data4", "sdhi0_ctrl"; |
174 | function = "sdhi0"; | 174 | function = "sdhi0"; |
175 | power-source = <1800>; | 175 | power-source = <1800>; |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 869dded0f09f..33b744d54739 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -331,6 +331,7 @@ CONFIG_DRM_VC4=m | |||
331 | CONFIG_DRM_PANEL_SIMPLE=m | 331 | CONFIG_DRM_PANEL_SIMPLE=m |
332 | CONFIG_DRM_I2C_ADV7511=m | 332 | CONFIG_DRM_I2C_ADV7511=m |
333 | CONFIG_DRM_HISI_KIRIN=m | 333 | CONFIG_DRM_HISI_KIRIN=m |
334 | CONFIG_DRM_MESON=m | ||
334 | CONFIG_FB=y | 335 | CONFIG_FB=y |
335 | CONFIG_FB_ARMCLCD=y | 336 | CONFIG_FB_ARMCLCD=y |
336 | CONFIG_BACKLIGHT_GENERIC=m | 337 | CONFIG_BACKLIGHT_GENERIC=m |
diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h new file mode 100644 index 000000000000..df411f3e083c --- /dev/null +++ b/arch/arm64/include/asm/asm-uaccess.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef __ASM_ASM_UACCESS_H | ||
2 | #define __ASM_ASM_UACCESS_H | ||
3 | |||
4 | #include <asm/alternative.h> | ||
5 | #include <asm/kernel-pgtable.h> | ||
6 | #include <asm/sysreg.h> | ||
7 | #include <asm/assembler.h> | ||
8 | |||
9 | /* | ||
10 | * User access enabling/disabling macros. | ||
11 | */ | ||
12 | #ifdef CONFIG_ARM64_SW_TTBR0_PAN | ||
13 | .macro __uaccess_ttbr0_disable, tmp1 | ||
14 | mrs \tmp1, ttbr1_el1 // swapper_pg_dir | ||
15 | add \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir | ||
16 | msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1 | ||
17 | isb | ||
18 | .endm | ||
19 | |||
20 | .macro __uaccess_ttbr0_enable, tmp1 | ||
21 | get_thread_info \tmp1 | ||
22 | ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1 | ||
23 | msr ttbr0_el1, \tmp1 // set the non-PAN TTBR0_EL1 | ||
24 | isb | ||
25 | .endm | ||
26 | |||
27 | .macro uaccess_ttbr0_disable, tmp1 | ||
28 | alternative_if_not ARM64_HAS_PAN | ||
29 | __uaccess_ttbr0_disable \tmp1 | ||
30 | alternative_else_nop_endif | ||
31 | .endm | ||
32 | |||
33 | .macro uaccess_ttbr0_enable, tmp1, tmp2 | ||
34 | alternative_if_not ARM64_HAS_PAN | ||
35 | save_and_disable_irq \tmp2 // avoid preemption | ||
36 | __uaccess_ttbr0_enable \tmp1 | ||
37 | restore_irq \tmp2 | ||
38 | alternative_else_nop_endif | ||
39 | .endm | ||
40 | #else | ||
41 | .macro uaccess_ttbr0_disable, tmp1 | ||
42 | .endm | ||
43 | |||
44 | .macro uaccess_ttbr0_enable, tmp1, tmp2 | ||
45 | .endm | ||
46 | #endif | ||
47 | |||
48 | /* | ||
49 | * These macros are no-ops when UAO is present. | ||
50 | */ | ||
51 | .macro uaccess_disable_not_uao, tmp1 | ||
52 | uaccess_ttbr0_disable \tmp1 | ||
53 | alternative_if ARM64_ALT_PAN_NOT_UAO | ||
54 | SET_PSTATE_PAN(1) | ||
55 | alternative_else_nop_endif | ||
56 | .endm | ||
57 | |||
58 | .macro uaccess_enable_not_uao, tmp1, tmp2 | ||
59 | uaccess_ttbr0_enable \tmp1, \tmp2 | ||
60 | alternative_if ARM64_ALT_PAN_NOT_UAO | ||
61 | SET_PSTATE_PAN(0) | ||
62 | alternative_else_nop_endif | ||
63 | .endm | ||
64 | |||
65 | #endif | ||
diff --git a/arch/arm64/include/asm/current.h b/arch/arm64/include/asm/current.h index f2bcbe2d9889..86c404171305 100644 --- a/arch/arm64/include/asm/current.h +++ b/arch/arm64/include/asm/current.h | |||
@@ -9,9 +9,17 @@ | |||
9 | 9 | ||
10 | struct task_struct; | 10 | struct task_struct; |
11 | 11 | ||
12 | /* | ||
13 | * We don't use read_sysreg() as we want the compiler to cache the value where | ||
14 | * possible. | ||
15 | */ | ||
12 | static __always_inline struct task_struct *get_current(void) | 16 | static __always_inline struct task_struct *get_current(void) |
13 | { | 17 | { |
14 | return (struct task_struct *)read_sysreg(sp_el0); | 18 | unsigned long sp_el0; |
19 | |||
20 | asm ("mrs %0, sp_el0" : "=r" (sp_el0)); | ||
21 | |||
22 | return (struct task_struct *)sp_el0; | ||
15 | } | 23 | } |
16 | 24 | ||
17 | #define current get_current() | 25 | #define current get_current() |
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index d26750ca6e06..46da3ea638bb 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h | |||
@@ -22,8 +22,6 @@ | |||
22 | #include <asm/kernel-pgtable.h> | 22 | #include <asm/kernel-pgtable.h> |
23 | #include <asm/sysreg.h> | 23 | #include <asm/sysreg.h> |
24 | 24 | ||
25 | #ifndef __ASSEMBLY__ | ||
26 | |||
27 | /* | 25 | /* |
28 | * User space memory access functions | 26 | * User space memory access functions |
29 | */ | 27 | */ |
@@ -424,66 +422,4 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count); | |||
424 | extern __must_check long strlen_user(const char __user *str); | 422 | extern __must_check long strlen_user(const char __user *str); |
425 | extern __must_check long strnlen_user(const char __user *str, long n); | 423 | extern __must_check long strnlen_user(const char __user *str, long n); |
426 | 424 | ||
427 | #else /* __ASSEMBLY__ */ | ||
428 | |||
429 | #include <asm/assembler.h> | ||
430 | |||
431 | /* | ||
432 | * User access enabling/disabling macros. | ||
433 | */ | ||
434 | #ifdef CONFIG_ARM64_SW_TTBR0_PAN | ||
435 | .macro __uaccess_ttbr0_disable, tmp1 | ||
436 | mrs \tmp1, ttbr1_el1 // swapper_pg_dir | ||
437 | add \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir | ||
438 | msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1 | ||
439 | isb | ||
440 | .endm | ||
441 | |||
442 | .macro __uaccess_ttbr0_enable, tmp1 | ||
443 | get_thread_info \tmp1 | ||
444 | ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1 | ||
445 | msr ttbr0_el1, \tmp1 // set the non-PAN TTBR0_EL1 | ||
446 | isb | ||
447 | .endm | ||
448 | |||
449 | .macro uaccess_ttbr0_disable, tmp1 | ||
450 | alternative_if_not ARM64_HAS_PAN | ||
451 | __uaccess_ttbr0_disable \tmp1 | ||
452 | alternative_else_nop_endif | ||
453 | .endm | ||
454 | |||
455 | .macro uaccess_ttbr0_enable, tmp1, tmp2 | ||
456 | alternative_if_not ARM64_HAS_PAN | ||
457 | save_and_disable_irq \tmp2 // avoid preemption | ||
458 | __uaccess_ttbr0_enable \tmp1 | ||
459 | restore_irq \tmp2 | ||
460 | alternative_else_nop_endif | ||
461 | .endm | ||
462 | #else | ||
463 | .macro uaccess_ttbr0_disable, tmp1 | ||
464 | .endm | ||
465 | |||
466 | .macro uaccess_ttbr0_enable, tmp1, tmp2 | ||
467 | .endm | ||
468 | #endif | ||
469 | |||
470 | /* | ||
471 | * These macros are no-ops when UAO is present. | ||
472 | */ | ||
473 | .macro uaccess_disable_not_uao, tmp1 | ||
474 | uaccess_ttbr0_disable \tmp1 | ||
475 | alternative_if ARM64_ALT_PAN_NOT_UAO | ||
476 | SET_PSTATE_PAN(1) | ||
477 | alternative_else_nop_endif | ||
478 | .endm | ||
479 | |||
480 | .macro uaccess_enable_not_uao, tmp1, tmp2 | ||
481 | uaccess_ttbr0_enable \tmp1, \tmp2 | ||
482 | alternative_if ARM64_ALT_PAN_NOT_UAO | ||
483 | SET_PSTATE_PAN(0) | ||
484 | alternative_else_nop_endif | ||
485 | .endm | ||
486 | |||
487 | #endif /* __ASSEMBLY__ */ | ||
488 | |||
489 | #endif /* __ASM_UACCESS_H */ | 425 | #endif /* __ASM_UACCESS_H */ |
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index a7504f40d7ee..923841ffe4a9 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <asm/memory.h> | 31 | #include <asm/memory.h> |
32 | #include <asm/ptrace.h> | 32 | #include <asm/ptrace.h> |
33 | #include <asm/thread_info.h> | 33 | #include <asm/thread_info.h> |
34 | #include <linux/uaccess.h> | 34 | #include <asm/asm-uaccess.h> |
35 | #include <asm/unistd.h> | 35 | #include <asm/unistd.h> |
36 | 36 | ||
37 | /* | 37 | /* |
diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S index add4a1334085..e88fb99c1561 100644 --- a/arch/arm64/lib/clear_user.S +++ b/arch/arm64/lib/clear_user.S | |||
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | #include <linux/linkage.h> | 18 | #include <linux/linkage.h> |
19 | 19 | ||
20 | #include <linux/uaccess.h> | 20 | #include <asm/asm-uaccess.h> |
21 | 21 | ||
22 | .text | 22 | .text |
23 | 23 | ||
diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S index fd6cd05593f9..4b5d826895ff 100644 --- a/arch/arm64/lib/copy_from_user.S +++ b/arch/arm64/lib/copy_from_user.S | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/linkage.h> | 17 | #include <linux/linkage.h> |
18 | 18 | ||
19 | #include <asm/cache.h> | 19 | #include <asm/cache.h> |
20 | #include <linux/uaccess.h> | 20 | #include <asm/asm-uaccess.h> |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Copy from user space to a kernel buffer (alignment handled by the hardware) | 23 | * Copy from user space to a kernel buffer (alignment handled by the hardware) |
diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S index d828540ded6f..47184c3a97da 100644 --- a/arch/arm64/lib/copy_in_user.S +++ b/arch/arm64/lib/copy_in_user.S | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/linkage.h> | 19 | #include <linux/linkage.h> |
20 | 20 | ||
21 | #include <asm/cache.h> | 21 | #include <asm/cache.h> |
22 | #include <linux/uaccess.h> | 22 | #include <asm/asm-uaccess.h> |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Copy from user space to user space (alignment handled by the hardware) | 25 | * Copy from user space to user space (alignment handled by the hardware) |
diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S index 3e6ae2663b82..351f0766f7a6 100644 --- a/arch/arm64/lib/copy_to_user.S +++ b/arch/arm64/lib/copy_to_user.S | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/linkage.h> | 17 | #include <linux/linkage.h> |
18 | 18 | ||
19 | #include <asm/cache.h> | 19 | #include <asm/cache.h> |
20 | #include <linux/uaccess.h> | 20 | #include <asm/asm-uaccess.h> |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Copy to user space from a kernel buffer (alignment handled by the hardware) | 23 | * Copy to user space from a kernel buffer (alignment handled by the hardware) |
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 17f422a4dc55..83c27b6e6dca 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <asm/assembler.h> | 23 | #include <asm/assembler.h> |
24 | #include <asm/cpufeature.h> | 24 | #include <asm/cpufeature.h> |
25 | #include <asm/alternative.h> | 25 | #include <asm/alternative.h> |
26 | #include <linux/uaccess.h> | 26 | #include <asm/asm-uaccess.h> |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * flush_icache_range(start,end) | 29 | * flush_icache_range(start,end) |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 290a84f3351f..e04082700bb1 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
@@ -524,7 +524,8 @@ EXPORT_SYMBOL(dummy_dma_ops); | |||
524 | 524 | ||
525 | static int __init arm64_dma_init(void) | 525 | static int __init arm64_dma_init(void) |
526 | { | 526 | { |
527 | if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT)) | 527 | if (swiotlb_force == SWIOTLB_FORCE || |
528 | max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT)) | ||
528 | swiotlb = 1; | 529 | swiotlb = 1; |
529 | 530 | ||
530 | return atomic_pool_init(); | 531 | return atomic_pool_init(); |
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index a78a5c401806..156169c6981b 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c | |||
@@ -88,21 +88,21 @@ void show_pte(struct mm_struct *mm, unsigned long addr) | |||
88 | break; | 88 | break; |
89 | 89 | ||
90 | pud = pud_offset(pgd, addr); | 90 | pud = pud_offset(pgd, addr); |
91 | printk(", *pud=%016llx", pud_val(*pud)); | 91 | pr_cont(", *pud=%016llx", pud_val(*pud)); |
92 | if (pud_none(*pud) || pud_bad(*pud)) | 92 | if (pud_none(*pud) || pud_bad(*pud)) |
93 | break; | 93 | break; |
94 | 94 | ||
95 | pmd = pmd_offset(pud, addr); | 95 | pmd = pmd_offset(pud, addr); |
96 | printk(", *pmd=%016llx", pmd_val(*pmd)); | 96 | pr_cont(", *pmd=%016llx", pmd_val(*pmd)); |
97 | if (pmd_none(*pmd) || pmd_bad(*pmd)) | 97 | if (pmd_none(*pmd) || pmd_bad(*pmd)) |
98 | break; | 98 | break; |
99 | 99 | ||
100 | pte = pte_offset_map(pmd, addr); | 100 | pte = pte_offset_map(pmd, addr); |
101 | printk(", *pte=%016llx", pte_val(*pte)); | 101 | pr_cont(", *pte=%016llx", pte_val(*pte)); |
102 | pte_unmap(pte); | 102 | pte_unmap(pte); |
103 | } while(0); | 103 | } while(0); |
104 | 104 | ||
105 | printk("\n"); | 105 | pr_cont("\n"); |
106 | } | 106 | } |
107 | 107 | ||
108 | #ifdef CONFIG_ARM64_HW_AFDBM | 108 | #ifdef CONFIG_ARM64_HW_AFDBM |
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 212c4d1e2f26..716d1226ba69 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -401,7 +401,8 @@ static void __init free_unused_memmap(void) | |||
401 | */ | 401 | */ |
402 | void __init mem_init(void) | 402 | void __init mem_init(void) |
403 | { | 403 | { |
404 | if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT)) | 404 | if (swiotlb_force == SWIOTLB_FORCE || |
405 | max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT)) | ||
405 | swiotlb_init(1); | 406 | swiotlb_init(1); |
406 | 407 | ||
407 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); | 408 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); |
diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S index 47cf3f9d89ff..947830a459d2 100644 --- a/arch/arm64/xen/hypercall.S +++ b/arch/arm64/xen/hypercall.S | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | #include <linux/linkage.h> | 50 | #include <linux/linkage.h> |
51 | #include <asm/assembler.h> | 51 | #include <asm/assembler.h> |
52 | #include <linux/uaccess.h> | 52 | #include <asm/asm-uaccess.h> |
53 | #include <xen/interface/xen.h> | 53 | #include <xen/interface/xen.h> |
54 | 54 | ||
55 | 55 | ||
diff --git a/arch/mips/kvm/entry.c b/arch/mips/kvm/entry.c index 6a02b3a3fa65..e92fb190e2d6 100644 --- a/arch/mips/kvm/entry.c +++ b/arch/mips/kvm/entry.c | |||
@@ -521,6 +521,9 @@ void *kvm_mips_build_exit(void *addr) | |||
521 | uasm_i_and(&p, V0, V0, AT); | 521 | uasm_i_and(&p, V0, V0, AT); |
522 | uasm_i_lui(&p, AT, ST0_CU0 >> 16); | 522 | uasm_i_lui(&p, AT, ST0_CU0 >> 16); |
523 | uasm_i_or(&p, V0, V0, AT); | 523 | uasm_i_or(&p, V0, V0, AT); |
524 | #ifdef CONFIG_64BIT | ||
525 | uasm_i_ori(&p, V0, V0, ST0_SX | ST0_UX); | ||
526 | #endif | ||
524 | uasm_i_mtc0(&p, V0, C0_STATUS); | 527 | uasm_i_mtc0(&p, V0, C0_STATUS); |
525 | uasm_i_ehb(&p); | 528 | uasm_i_ehb(&p); |
526 | 529 | ||
@@ -643,7 +646,7 @@ static void *kvm_mips_build_ret_to_guest(void *addr) | |||
643 | 646 | ||
644 | /* Setup status register for running guest in UM */ | 647 | /* Setup status register for running guest in UM */ |
645 | uasm_i_ori(&p, V1, V1, ST0_EXL | KSU_USER | ST0_IE); | 648 | uasm_i_ori(&p, V1, V1, ST0_EXL | KSU_USER | ST0_IE); |
646 | UASM_i_LA(&p, AT, ~(ST0_CU0 | ST0_MX)); | 649 | UASM_i_LA(&p, AT, ~(ST0_CU0 | ST0_MX | ST0_SX | ST0_UX)); |
647 | uasm_i_and(&p, V1, V1, AT); | 650 | uasm_i_and(&p, V1, V1, AT); |
648 | uasm_i_mtc0(&p, V1, C0_STATUS); | 651 | uasm_i_mtc0(&p, V1, C0_STATUS); |
649 | uasm_i_ehb(&p); | 652 | uasm_i_ehb(&p); |
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index 06a60b19acfb..29ec9ab3fd55 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c | |||
@@ -360,8 +360,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) | |||
360 | dump_handler("kvm_exit", gebase + 0x2000, vcpu->arch.vcpu_run); | 360 | dump_handler("kvm_exit", gebase + 0x2000, vcpu->arch.vcpu_run); |
361 | 361 | ||
362 | /* Invalidate the icache for these ranges */ | 362 | /* Invalidate the icache for these ranges */ |
363 | local_flush_icache_range((unsigned long)gebase, | 363 | flush_icache_range((unsigned long)gebase, |
364 | (unsigned long)gebase + ALIGN(size, PAGE_SIZE)); | 364 | (unsigned long)gebase + ALIGN(size, PAGE_SIZE)); |
365 | 365 | ||
366 | /* | 366 | /* |
367 | * Allocate comm page for guest kernel, a TLB will be reserved for | 367 | * Allocate comm page for guest kernel, a TLB will be reserved for |
diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S index ef31fc24344e..552544616b9d 100644 --- a/arch/openrisc/kernel/vmlinux.lds.S +++ b/arch/openrisc/kernel/vmlinux.lds.S | |||
@@ -44,6 +44,8 @@ SECTIONS | |||
44 | /* Read-only sections, merged into text segment: */ | 44 | /* Read-only sections, merged into text segment: */ |
45 | . = LOAD_BASE ; | 45 | . = LOAD_BASE ; |
46 | 46 | ||
47 | _text = .; | ||
48 | |||
47 | /* _s_kernel_ro must be page aligned */ | 49 | /* _s_kernel_ro must be page aligned */ |
48 | . = ALIGN(PAGE_SIZE); | 50 | . = ALIGN(PAGE_SIZE); |
49 | _s_kernel_ro = .; | 51 | _s_kernel_ro = .; |
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h index 7581330ea35b..88fe0aad4390 100644 --- a/arch/parisc/include/asm/thread_info.h +++ b/arch/parisc/include/asm/thread_info.h | |||
@@ -49,7 +49,6 @@ struct thread_info { | |||
49 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 49 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
50 | #define TIF_32BIT 4 /* 32 bit binary */ | 50 | #define TIF_32BIT 4 /* 32 bit binary */ |
51 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ | 51 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ |
52 | #define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */ | ||
53 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ | 52 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ |
54 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ | 53 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ |
55 | #define TIF_SINGLESTEP 9 /* single stepping? */ | 54 | #define TIF_SINGLESTEP 9 /* single stepping? */ |
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index da0d9cb63403..1e22f981cd81 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c | |||
@@ -235,9 +235,26 @@ void __init time_init(void) | |||
235 | 235 | ||
236 | cr16_hz = 100 * PAGE0->mem_10msec; /* Hz */ | 236 | cr16_hz = 100 * PAGE0->mem_10msec; /* Hz */ |
237 | 237 | ||
238 | /* register at clocksource framework */ | ||
239 | clocksource_register_hz(&clocksource_cr16, cr16_hz); | ||
240 | |||
241 | /* register as sched_clock source */ | 238 | /* register as sched_clock source */ |
242 | sched_clock_register(read_cr16_sched_clock, BITS_PER_LONG, cr16_hz); | 239 | sched_clock_register(read_cr16_sched_clock, BITS_PER_LONG, cr16_hz); |
243 | } | 240 | } |
241 | |||
242 | static int __init init_cr16_clocksource(void) | ||
243 | { | ||
244 | /* | ||
245 | * The cr16 interval timers are not syncronized across CPUs, so mark | ||
246 | * them unstable and lower rating on SMP systems. | ||
247 | */ | ||
248 | if (num_online_cpus() > 1) { | ||
249 | clocksource_cr16.flags = CLOCK_SOURCE_UNSTABLE; | ||
250 | clocksource_cr16.rating = 0; | ||
251 | } | ||
252 | |||
253 | /* register at clocksource framework */ | ||
254 | clocksource_register_hz(&clocksource_cr16, | ||
255 | 100 * PAGE0->mem_10msec); | ||
256 | |||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | device_initcall(init_cr16_clocksource); | ||
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 8ff9253930af..1a0b4f63f0e9 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c | |||
@@ -234,7 +234,7 @@ show_signal_msg(struct pt_regs *regs, unsigned long code, | |||
234 | tsk->comm, code, address); | 234 | tsk->comm, code, address); |
235 | print_vma_addr(KERN_CONT " in ", regs->iaoq[0]); | 235 | print_vma_addr(KERN_CONT " in ", regs->iaoq[0]); |
236 | 236 | ||
237 | pr_cont(" trap #%lu: %s%c", code, trap_name(code), | 237 | pr_cont("\ntrap #%lu: %s%c", code, trap_name(code), |
238 | vma ? ',':'\n'); | 238 | vma ? ',':'\n'); |
239 | 239 | ||
240 | if (vma) | 240 | if (vma) |
diff --git a/arch/s390/include/asm/asm-prototypes.h b/arch/s390/include/asm/asm-prototypes.h new file mode 100644 index 000000000000..2c3413b0ca52 --- /dev/null +++ b/arch/s390/include/asm/asm-prototypes.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_S390_PROTOTYPES_H | ||
2 | |||
3 | #include <linux/kvm_host.h> | ||
4 | #include <linux/ftrace.h> | ||
5 | #include <asm/fpu/api.h> | ||
6 | #include <asm-generic/asm-prototypes.h> | ||
7 | |||
8 | #endif /* _ASM_S390_PROTOTYPES_H */ | ||
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 6b246aadf311..1b5c5ee9fc1b 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -94,7 +94,7 @@ static void update_mt_scaling(void) | |||
94 | * Update process times based on virtual cpu times stored by entry.S | 94 | * Update process times based on virtual cpu times stored by entry.S |
95 | * to the lowcore fields user_timer, system_timer & steal_clock. | 95 | * to the lowcore fields user_timer, system_timer & steal_clock. |
96 | */ | 96 | */ |
97 | static int do_account_vtime(struct task_struct *tsk, int hardirq_offset) | 97 | static int do_account_vtime(struct task_struct *tsk) |
98 | { | 98 | { |
99 | u64 timer, clock, user, system, steal; | 99 | u64 timer, clock, user, system, steal; |
100 | u64 user_scaled, system_scaled; | 100 | u64 user_scaled, system_scaled; |
@@ -138,7 +138,7 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset) | |||
138 | } | 138 | } |
139 | account_user_time(tsk, user); | 139 | account_user_time(tsk, user); |
140 | tsk->utimescaled += user_scaled; | 140 | tsk->utimescaled += user_scaled; |
141 | account_system_time(tsk, hardirq_offset, system); | 141 | account_system_time(tsk, 0, system); |
142 | tsk->stimescaled += system_scaled; | 142 | tsk->stimescaled += system_scaled; |
143 | 143 | ||
144 | steal = S390_lowcore.steal_timer; | 144 | steal = S390_lowcore.steal_timer; |
@@ -152,7 +152,7 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset) | |||
152 | 152 | ||
153 | void vtime_task_switch(struct task_struct *prev) | 153 | void vtime_task_switch(struct task_struct *prev) |
154 | { | 154 | { |
155 | do_account_vtime(prev, 0); | 155 | do_account_vtime(prev); |
156 | prev->thread.user_timer = S390_lowcore.user_timer; | 156 | prev->thread.user_timer = S390_lowcore.user_timer; |
157 | prev->thread.system_timer = S390_lowcore.system_timer; | 157 | prev->thread.system_timer = S390_lowcore.system_timer; |
158 | S390_lowcore.user_timer = current->thread.user_timer; | 158 | S390_lowcore.user_timer = current->thread.user_timer; |
@@ -166,7 +166,7 @@ void vtime_task_switch(struct task_struct *prev) | |||
166 | */ | 166 | */ |
167 | void vtime_account_user(struct task_struct *tsk) | 167 | void vtime_account_user(struct task_struct *tsk) |
168 | { | 168 | { |
169 | if (do_account_vtime(tsk, HARDIRQ_OFFSET)) | 169 | if (do_account_vtime(tsk)) |
170 | virt_timer_expire(); | 170 | virt_timer_expire(); |
171 | } | 171 | } |
172 | 172 | ||
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 68557f52b961..854022772c5b 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -139,6 +139,19 @@ static __always_inline void __clear_bit(long nr, volatile unsigned long *addr) | |||
139 | asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); | 139 | asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); |
140 | } | 140 | } |
141 | 141 | ||
142 | static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr) | ||
143 | { | ||
144 | bool negative; | ||
145 | asm volatile(LOCK_PREFIX "andb %2,%1\n\t" | ||
146 | CC_SET(s) | ||
147 | : CC_OUT(s) (negative), ADDR | ||
148 | : "ir" ((char) ~(1 << nr)) : "memory"); | ||
149 | return negative; | ||
150 | } | ||
151 | |||
152 | // Let everybody know we have it | ||
153 | #define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte | ||
154 | |||
142 | /* | 155 | /* |
143 | * __clear_bit_unlock - Clears a bit in memory | 156 | * __clear_bit_unlock - Clears a bit in memory |
144 | * @nr: Bit to clear | 157 | * @nr: Bit to clear |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index ffacfdcacb85..a5fd137417a2 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c | |||
@@ -1182,6 +1182,9 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
1182 | const char *name = get_name(bank, NULL); | 1182 | const char *name = get_name(bank, NULL); |
1183 | int err = 0; | 1183 | int err = 0; |
1184 | 1184 | ||
1185 | if (!dev) | ||
1186 | return -ENODEV; | ||
1187 | |||
1185 | if (is_shared_bank(bank)) { | 1188 | if (is_shared_bank(bank)) { |
1186 | nb = node_to_amd_nb(amd_get_nb_id(cpu)); | 1189 | nb = node_to_amd_nb(amd_get_nb_id(cpu)); |
1187 | 1190 | ||
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c index b47edb8f5256..410efb2c7b80 100644 --- a/arch/x86/kernel/pci-swiotlb.c +++ b/arch/x86/kernel/pci-swiotlb.c | |||
@@ -68,12 +68,10 @@ static struct dma_map_ops swiotlb_dma_ops = { | |||
68 | */ | 68 | */ |
69 | int __init pci_swiotlb_detect_override(void) | 69 | int __init pci_swiotlb_detect_override(void) |
70 | { | 70 | { |
71 | int use_swiotlb = swiotlb | swiotlb_force; | 71 | if (swiotlb_force == SWIOTLB_FORCE) |
72 | |||
73 | if (swiotlb_force) | ||
74 | swiotlb = 1; | 72 | swiotlb = 1; |
75 | 73 | ||
76 | return use_swiotlb; | 74 | return swiotlb; |
77 | } | 75 | } |
78 | IOMMU_INIT_FINISH(pci_swiotlb_detect_override, | 76 | IOMMU_INIT_FINISH(pci_swiotlb_detect_override, |
79 | pci_xen_swiotlb_detect, | 77 | pci_xen_swiotlb_detect, |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 24db5fb6f575..a236decb81e4 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -132,12 +132,6 @@ module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO); | |||
132 | 132 | ||
133 | #define VMX_MISC_EMULATED_PREEMPTION_TIMER_RATE 5 | 133 | #define VMX_MISC_EMULATED_PREEMPTION_TIMER_RATE 5 |
134 | 134 | ||
135 | #define VMX_VPID_EXTENT_SUPPORTED_MASK \ | ||
136 | (VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT | \ | ||
137 | VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT | \ | ||
138 | VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT | \ | ||
139 | VMX_VPID_EXTENT_SINGLE_NON_GLOBAL_BIT) | ||
140 | |||
141 | /* | 135 | /* |
142 | * Hyper-V requires all of these, so mark them as supported even though | 136 | * Hyper-V requires all of these, so mark them as supported even though |
143 | * they are just treated the same as all-context. | 137 | * they are just treated the same as all-context. |
@@ -10473,12 +10467,12 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) | |||
10473 | !nested_guest_cr4_valid(vcpu, vmcs12->guest_cr4)) { | 10467 | !nested_guest_cr4_valid(vcpu, vmcs12->guest_cr4)) { |
10474 | nested_vmx_entry_failure(vcpu, vmcs12, | 10468 | nested_vmx_entry_failure(vcpu, vmcs12, |
10475 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); | 10469 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); |
10476 | goto out; | 10470 | return 1; |
10477 | } | 10471 | } |
10478 | if (vmcs12->vmcs_link_pointer != -1ull) { | 10472 | if (vmcs12->vmcs_link_pointer != -1ull) { |
10479 | nested_vmx_entry_failure(vcpu, vmcs12, | 10473 | nested_vmx_entry_failure(vcpu, vmcs12, |
10480 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_VMCS_LINK_PTR); | 10474 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_VMCS_LINK_PTR); |
10481 | goto out; | 10475 | return 1; |
10482 | } | 10476 | } |
10483 | 10477 | ||
10484 | /* | 10478 | /* |
@@ -10498,7 +10492,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) | |||
10498 | ia32e != !!(vmcs12->guest_ia32_efer & EFER_LME))) { | 10492 | ia32e != !!(vmcs12->guest_ia32_efer & EFER_LME))) { |
10499 | nested_vmx_entry_failure(vcpu, vmcs12, | 10493 | nested_vmx_entry_failure(vcpu, vmcs12, |
10500 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); | 10494 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); |
10501 | goto out; | 10495 | return 1; |
10502 | } | 10496 | } |
10503 | } | 10497 | } |
10504 | 10498 | ||
@@ -10516,7 +10510,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) | |||
10516 | ia32e != !!(vmcs12->host_ia32_efer & EFER_LME)) { | 10510 | ia32e != !!(vmcs12->host_ia32_efer & EFER_LME)) { |
10517 | nested_vmx_entry_failure(vcpu, vmcs12, | 10511 | nested_vmx_entry_failure(vcpu, vmcs12, |
10518 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); | 10512 | EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); |
10519 | goto out; | 10513 | return 1; |
10520 | } | 10514 | } |
10521 | } | 10515 | } |
10522 | 10516 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 51ccfe08e32f..2f22810a7e0c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3070,6 +3070,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, | |||
3070 | memset(&events->reserved, 0, sizeof(events->reserved)); | 3070 | memset(&events->reserved, 0, sizeof(events->reserved)); |
3071 | } | 3071 | } |
3072 | 3072 | ||
3073 | static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags); | ||
3074 | |||
3073 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, | 3075 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, |
3074 | struct kvm_vcpu_events *events) | 3076 | struct kvm_vcpu_events *events) |
3075 | { | 3077 | { |
@@ -3106,10 +3108,13 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, | |||
3106 | vcpu->arch.apic->sipi_vector = events->sipi_vector; | 3108 | vcpu->arch.apic->sipi_vector = events->sipi_vector; |
3107 | 3109 | ||
3108 | if (events->flags & KVM_VCPUEVENT_VALID_SMM) { | 3110 | if (events->flags & KVM_VCPUEVENT_VALID_SMM) { |
3111 | u32 hflags = vcpu->arch.hflags; | ||
3109 | if (events->smi.smm) | 3112 | if (events->smi.smm) |
3110 | vcpu->arch.hflags |= HF_SMM_MASK; | 3113 | hflags |= HF_SMM_MASK; |
3111 | else | 3114 | else |
3112 | vcpu->arch.hflags &= ~HF_SMM_MASK; | 3115 | hflags &= ~HF_SMM_MASK; |
3116 | kvm_set_hflags(vcpu, hflags); | ||
3117 | |||
3113 | vcpu->arch.smi_pending = events->smi.pending; | 3118 | vcpu->arch.smi_pending = events->smi.pending; |
3114 | if (events->smi.smm_inside_nmi) | 3119 | if (events->smi.smm_inside_nmi) |
3115 | vcpu->arch.hflags |= HF_SMM_INSIDE_NMI_MASK; | 3120 | vcpu->arch.hflags |= HF_SMM_INSIDE_NMI_MASK; |
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c index a9fafb5c8738..a0b36a9d5df1 100644 --- a/arch/x86/xen/pci-swiotlb-xen.c +++ b/arch/x86/xen/pci-swiotlb-xen.c | |||
@@ -48,7 +48,7 @@ int __init pci_xen_swiotlb_detect(void) | |||
48 | * activate this IOMMU. If running as PV privileged, activate it | 48 | * activate this IOMMU. If running as PV privileged, activate it |
49 | * irregardless. | 49 | * irregardless. |
50 | */ | 50 | */ |
51 | if ((xen_initial_domain() || swiotlb || swiotlb_force)) | 51 | if (xen_initial_domain() || swiotlb || swiotlb_force == SWIOTLB_FORCE) |
52 | xen_swiotlb = 1; | 52 | xen_swiotlb = 1; |
53 | 53 | ||
54 | /* If we are running under Xen, we MUST disable the native SWIOTLB. | 54 | /* If we are running under Xen, we MUST disable the native SWIOTLB. |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 8c394e30e5fe..f3f7b41116f7 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void) | |||
713 | size = PFN_PHYS(xen_start_info->nr_p2m_frames); | 713 | size = PFN_PHYS(xen_start_info->nr_p2m_frames); |
714 | } | 714 | } |
715 | 715 | ||
716 | if (!xen_is_e820_reserved(start, size)) { | 716 | memblock_reserve(start, size); |
717 | memblock_reserve(start, size); | 717 | if (!xen_is_e820_reserved(start, size)) |
718 | return; | 718 | return; |
719 | } | ||
720 | 719 | ||
721 | #ifdef CONFIG_X86_32 | 720 | #ifdef CONFIG_X86_32 |
722 | /* | 721 | /* |
@@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void) | |||
727 | BUG(); | 726 | BUG(); |
728 | #else | 727 | #else |
729 | xen_relocate_p2m(); | 728 | xen_relocate_p2m(); |
729 | memblock_free(start, size); | ||
730 | #endif | 730 | #endif |
731 | } | 731 | } |
732 | 732 | ||
diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 6e82769f4042..f0a9c07b4c7a 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c | |||
@@ -544,6 +544,8 @@ static inline bool may_queue(struct rq_wb *rwb, struct rq_wait *rqw, | |||
544 | * the timer to kick off queuing again. | 544 | * the timer to kick off queuing again. |
545 | */ | 545 | */ |
546 | static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock) | 546 | static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock) |
547 | __releases(lock) | ||
548 | __acquires(lock) | ||
547 | { | 549 | { |
548 | struct rq_wait *rqw = get_rq_wait(rwb, current_is_kswapd()); | 550 | struct rq_wait *rqw = get_rq_wait(rwb, current_is_kswapd()); |
549 | DEFINE_WAIT(wait); | 551 | DEFINE_WAIT(wait); |
@@ -558,13 +560,12 @@ static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock) | |||
558 | if (may_queue(rwb, rqw, &wait, rw)) | 560 | if (may_queue(rwb, rqw, &wait, rw)) |
559 | break; | 561 | break; |
560 | 562 | ||
561 | if (lock) | 563 | if (lock) { |
562 | spin_unlock_irq(lock); | 564 | spin_unlock_irq(lock); |
563 | 565 | io_schedule(); | |
564 | io_schedule(); | ||
565 | |||
566 | if (lock) | ||
567 | spin_lock_irq(lock); | 566 | spin_lock_irq(lock); |
567 | } else | ||
568 | io_schedule(); | ||
568 | } while (1); | 569 | } while (1); |
569 | 570 | ||
570 | finish_wait(&rqw->wait, &wait); | 571 | finish_wait(&rqw->wait, &wait); |
@@ -595,7 +596,7 @@ static inline bool wbt_should_throttle(struct rq_wb *rwb, struct bio *bio) | |||
595 | * in an irq held spinlock, if it holds one when calling this function. | 596 | * in an irq held spinlock, if it holds one when calling this function. |
596 | * If we do sleep, we'll release and re-grab it. | 597 | * If we do sleep, we'll release and re-grab it. |
597 | */ | 598 | */ |
598 | unsigned int wbt_wait(struct rq_wb *rwb, struct bio *bio, spinlock_t *lock) | 599 | enum wbt_flags wbt_wait(struct rq_wb *rwb, struct bio *bio, spinlock_t *lock) |
599 | { | 600 | { |
600 | unsigned int ret = 0; | 601 | unsigned int ret = 0; |
601 | 602 | ||
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index f616ad74cce7..44e888b0b041 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -1461,16 +1461,25 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
1461 | for (i = 0; i < ctcount; i++) { | 1461 | for (i = 0; i < ctcount; i++) { |
1462 | unsigned int dlen = COMP_BUF_SIZE; | 1462 | unsigned int dlen = COMP_BUF_SIZE; |
1463 | int ilen = ctemplate[i].inlen; | 1463 | int ilen = ctemplate[i].inlen; |
1464 | void *input_vec; | ||
1464 | 1465 | ||
1466 | input_vec = kmalloc(ilen, GFP_KERNEL); | ||
1467 | if (!input_vec) { | ||
1468 | ret = -ENOMEM; | ||
1469 | goto out; | ||
1470 | } | ||
1471 | |||
1472 | memcpy(input_vec, ctemplate[i].input, ilen); | ||
1465 | memset(output, 0, dlen); | 1473 | memset(output, 0, dlen); |
1466 | init_completion(&result.completion); | 1474 | init_completion(&result.completion); |
1467 | sg_init_one(&src, ctemplate[i].input, ilen); | 1475 | sg_init_one(&src, input_vec, ilen); |
1468 | sg_init_one(&dst, output, dlen); | 1476 | sg_init_one(&dst, output, dlen); |
1469 | 1477 | ||
1470 | req = acomp_request_alloc(tfm); | 1478 | req = acomp_request_alloc(tfm); |
1471 | if (!req) { | 1479 | if (!req) { |
1472 | pr_err("alg: acomp: request alloc failed for %s\n", | 1480 | pr_err("alg: acomp: request alloc failed for %s\n", |
1473 | algo); | 1481 | algo); |
1482 | kfree(input_vec); | ||
1474 | ret = -ENOMEM; | 1483 | ret = -ENOMEM; |
1475 | goto out; | 1484 | goto out; |
1476 | } | 1485 | } |
@@ -1483,6 +1492,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
1483 | if (ret) { | 1492 | if (ret) { |
1484 | pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n", | 1493 | pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n", |
1485 | i + 1, algo, -ret); | 1494 | i + 1, algo, -ret); |
1495 | kfree(input_vec); | ||
1486 | acomp_request_free(req); | 1496 | acomp_request_free(req); |
1487 | goto out; | 1497 | goto out; |
1488 | } | 1498 | } |
@@ -1491,6 +1501,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
1491 | pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n", | 1501 | pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n", |
1492 | i + 1, algo, req->dlen); | 1502 | i + 1, algo, req->dlen); |
1493 | ret = -EINVAL; | 1503 | ret = -EINVAL; |
1504 | kfree(input_vec); | ||
1494 | acomp_request_free(req); | 1505 | acomp_request_free(req); |
1495 | goto out; | 1506 | goto out; |
1496 | } | 1507 | } |
@@ -1500,26 +1511,37 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
1500 | i + 1, algo); | 1511 | i + 1, algo); |
1501 | hexdump(output, req->dlen); | 1512 | hexdump(output, req->dlen); |
1502 | ret = -EINVAL; | 1513 | ret = -EINVAL; |
1514 | kfree(input_vec); | ||
1503 | acomp_request_free(req); | 1515 | acomp_request_free(req); |
1504 | goto out; | 1516 | goto out; |
1505 | } | 1517 | } |
1506 | 1518 | ||
1519 | kfree(input_vec); | ||
1507 | acomp_request_free(req); | 1520 | acomp_request_free(req); |
1508 | } | 1521 | } |
1509 | 1522 | ||
1510 | for (i = 0; i < dtcount; i++) { | 1523 | for (i = 0; i < dtcount; i++) { |
1511 | unsigned int dlen = COMP_BUF_SIZE; | 1524 | unsigned int dlen = COMP_BUF_SIZE; |
1512 | int ilen = dtemplate[i].inlen; | 1525 | int ilen = dtemplate[i].inlen; |
1526 | void *input_vec; | ||
1527 | |||
1528 | input_vec = kmalloc(ilen, GFP_KERNEL); | ||
1529 | if (!input_vec) { | ||
1530 | ret = -ENOMEM; | ||
1531 | goto out; | ||
1532 | } | ||
1513 | 1533 | ||
1534 | memcpy(input_vec, dtemplate[i].input, ilen); | ||
1514 | memset(output, 0, dlen); | 1535 | memset(output, 0, dlen); |
1515 | init_completion(&result.completion); | 1536 | init_completion(&result.completion); |
1516 | sg_init_one(&src, dtemplate[i].input, ilen); | 1537 | sg_init_one(&src, input_vec, ilen); |
1517 | sg_init_one(&dst, output, dlen); | 1538 | sg_init_one(&dst, output, dlen); |
1518 | 1539 | ||
1519 | req = acomp_request_alloc(tfm); | 1540 | req = acomp_request_alloc(tfm); |
1520 | if (!req) { | 1541 | if (!req) { |
1521 | pr_err("alg: acomp: request alloc failed for %s\n", | 1542 | pr_err("alg: acomp: request alloc failed for %s\n", |
1522 | algo); | 1543 | algo); |
1544 | kfree(input_vec); | ||
1523 | ret = -ENOMEM; | 1545 | ret = -ENOMEM; |
1524 | goto out; | 1546 | goto out; |
1525 | } | 1547 | } |
@@ -1532,6 +1554,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
1532 | if (ret) { | 1554 | if (ret) { |
1533 | pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n", | 1555 | pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n", |
1534 | i + 1, algo, -ret); | 1556 | i + 1, algo, -ret); |
1557 | kfree(input_vec); | ||
1535 | acomp_request_free(req); | 1558 | acomp_request_free(req); |
1536 | goto out; | 1559 | goto out; |
1537 | } | 1560 | } |
@@ -1540,6 +1563,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
1540 | pr_err("alg: acomp: Decompression test %d failed for %s: output len = %d\n", | 1563 | pr_err("alg: acomp: Decompression test %d failed for %s: output len = %d\n", |
1541 | i + 1, algo, req->dlen); | 1564 | i + 1, algo, req->dlen); |
1542 | ret = -EINVAL; | 1565 | ret = -EINVAL; |
1566 | kfree(input_vec); | ||
1543 | acomp_request_free(req); | 1567 | acomp_request_free(req); |
1544 | goto out; | 1568 | goto out; |
1545 | } | 1569 | } |
@@ -1549,10 +1573,12 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
1549 | i + 1, algo); | 1573 | i + 1, algo); |
1550 | hexdump(output, req->dlen); | 1574 | hexdump(output, req->dlen); |
1551 | ret = -EINVAL; | 1575 | ret = -EINVAL; |
1576 | kfree(input_vec); | ||
1552 | acomp_request_free(req); | 1577 | acomp_request_free(req); |
1553 | goto out; | 1578 | goto out; |
1554 | } | 1579 | } |
1555 | 1580 | ||
1581 | kfree(input_vec); | ||
1556 | acomp_request_free(req); | 1582 | acomp_request_free(req); |
1557 | } | 1583 | } |
1558 | 1584 | ||
diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c index 13caebd679f5..8c4e0a18460a 100644 --- a/drivers/acpi/acpi_watchdog.c +++ b/drivers/acpi/acpi_watchdog.c | |||
@@ -114,7 +114,7 @@ void __init acpi_watchdog_init(void) | |||
114 | pdev = platform_device_register_simple("wdat_wdt", PLATFORM_DEVID_NONE, | 114 | pdev = platform_device_register_simple("wdat_wdt", PLATFORM_DEVID_NONE, |
115 | resources, nresources); | 115 | resources, nresources); |
116 | if (IS_ERR(pdev)) | 116 | if (IS_ERR(pdev)) |
117 | pr_err("Failed to create platform device\n"); | 117 | pr_err("Device creation failed: %ld\n", PTR_ERR(pdev)); |
118 | 118 | ||
119 | kfree(resources); | 119 | kfree(resources); |
120 | 120 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index f8d65647ea79..fb19e1cdb641 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -98,7 +98,15 @@ static int find_child_checks(struct acpi_device *adev, bool check_children) | |||
98 | if (check_children && list_empty(&adev->children)) | 98 | if (check_children && list_empty(&adev->children)) |
99 | return -ENODEV; | 99 | return -ENODEV; |
100 | 100 | ||
101 | return sta_present ? FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE; | 101 | /* |
102 | * If the device has a _HID (or _CID) returning a valid ACPI/PNP | ||
103 | * device ID, it is better to make it look less attractive here, so that | ||
104 | * the other device with the same _ADR value (that may not have a valid | ||
105 | * device ID) can be matched going forward. [This means a second spec | ||
106 | * violation in a row, so whatever we do here is best effort anyway.] | ||
107 | */ | ||
108 | return sta_present && list_empty(&adev->pnp.ids) ? | ||
109 | FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE; | ||
102 | } | 110 | } |
103 | 111 | ||
104 | struct acpi_device *acpi_find_child_device(struct acpi_device *parent, | 112 | struct acpi_device *acpi_find_child_device(struct acpi_device *parent, |
@@ -250,7 +258,6 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev) | |||
250 | return 0; | 258 | return 0; |
251 | 259 | ||
252 | err: | 260 | err: |
253 | acpi_dma_deconfigure(dev); | ||
254 | ACPI_COMPANION_SET(dev, NULL); | 261 | ACPI_COMPANION_SET(dev, NULL); |
255 | put_device(dev); | 262 | put_device(dev); |
256 | put_device(&acpi_dev->dev); | 263 | put_device(&acpi_dev->dev); |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 1b41a2739dac..0c452265c111 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -37,6 +37,7 @@ void acpi_amba_init(void); | |||
37 | static inline void acpi_amba_init(void) {} | 37 | static inline void acpi_amba_init(void) {} |
38 | #endif | 38 | #endif |
39 | int acpi_sysfs_init(void); | 39 | int acpi_sysfs_init(void); |
40 | void acpi_gpe_apply_masked_gpes(void); | ||
40 | void acpi_container_init(void); | 41 | void acpi_container_init(void); |
41 | void acpi_memory_hotplug_init(void); | 42 | void acpi_memory_hotplug_init(void); |
42 | #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC | 43 | #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 45dec874ea55..192691880d55 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -2074,6 +2074,7 @@ int __init acpi_scan_init(void) | |||
2074 | } | 2074 | } |
2075 | } | 2075 | } |
2076 | 2076 | ||
2077 | acpi_gpe_apply_masked_gpes(); | ||
2077 | acpi_update_all_gpes(); | 2078 | acpi_update_all_gpes(); |
2078 | acpi_ec_ecdt_start(); | 2079 | acpi_ec_ecdt_start(); |
2079 | 2080 | ||
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 703c26e7022c..cf05ae973381 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -708,6 +708,62 @@ end: | |||
708 | return result ? result : size; | 708 | return result ? result : size; |
709 | } | 709 | } |
710 | 710 | ||
711 | /* | ||
712 | * A Quirk Mechanism for GPE Flooding Prevention: | ||
713 | * | ||
714 | * Quirks may be needed to prevent GPE flooding on a specific GPE. The | ||
715 | * flooding typically cannot be detected and automatically prevented by | ||
716 | * ACPI_GPE_DISPATCH_NONE check because there is a _Lxx/_Exx prepared in | ||
717 | * the AML tables. This normally indicates a feature gap in Linux, thus | ||
718 | * instead of providing endless quirk tables, we provide a boot parameter | ||
719 | * for those who want this quirk. For example, if the users want to prevent | ||
720 | * the GPE flooding for GPE 00, they need to specify the following boot | ||
721 | * parameter: | ||
722 | * acpi_mask_gpe=0x00 | ||
723 | * The masking status can be modified by the following runtime controlling | ||
724 | * interface: | ||
725 | * echo unmask > /sys/firmware/acpi/interrupts/gpe00 | ||
726 | */ | ||
727 | |||
728 | /* | ||
729 | * Currently, the GPE flooding prevention only supports to mask the GPEs | ||
730 | * numbered from 00 to 7f. | ||
731 | */ | ||
732 | #define ACPI_MASKABLE_GPE_MAX 0x80 | ||
733 | |||
734 | static u64 __initdata acpi_masked_gpes; | ||
735 | |||
736 | static int __init acpi_gpe_set_masked_gpes(char *val) | ||
737 | { | ||
738 | u8 gpe; | ||
739 | |||
740 | if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX) | ||
741 | return -EINVAL; | ||
742 | acpi_masked_gpes |= ((u64)1<<gpe); | ||
743 | |||
744 | return 1; | ||
745 | } | ||
746 | __setup("acpi_mask_gpe=", acpi_gpe_set_masked_gpes); | ||
747 | |||
748 | void __init acpi_gpe_apply_masked_gpes(void) | ||
749 | { | ||
750 | acpi_handle handle; | ||
751 | acpi_status status; | ||
752 | u8 gpe; | ||
753 | |||
754 | for (gpe = 0; | ||
755 | gpe < min_t(u8, ACPI_MASKABLE_GPE_MAX, acpi_current_gpe_count); | ||
756 | gpe++) { | ||
757 | if (acpi_masked_gpes & ((u64)1<<gpe)) { | ||
758 | status = acpi_get_gpe_device(gpe, &handle); | ||
759 | if (ACPI_SUCCESS(status)) { | ||
760 | pr_info("Masking GPE 0x%x.\n", gpe); | ||
761 | (void)acpi_mask_gpe(handle, gpe, TRUE); | ||
762 | } | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | |||
711 | void acpi_irq_stats_init(void) | 767 | void acpi_irq_stats_init(void) |
712 | { | 768 | { |
713 | acpi_status status; | 769 | acpi_status status; |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index a5e1262b964b..2997026b4dfb 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -626,6 +626,7 @@ static int genpd_runtime_resume(struct device *dev) | |||
626 | 626 | ||
627 | out: | 627 | out: |
628 | /* Measure resume latency. */ | 628 | /* Measure resume latency. */ |
629 | time_start = 0; | ||
629 | if (timed && runtime_pm) | 630 | if (timed && runtime_pm) |
630 | time_start = ktime_get(); | 631 | time_start = ktime_get(); |
631 | 632 | ||
diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index 5eb05dbf59b8..fc585f370549 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c | |||
@@ -768,5 +768,5 @@ fail: | |||
768 | kfree(clks); | 768 | kfree(clks); |
769 | iounmap(base); | 769 | iounmap(base); |
770 | } | 770 | } |
771 | CLK_OF_DECLARE(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init); | 771 | CLK_OF_DECLARE_DRIVER(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init); |
772 | CLK_OF_DECLARE(stm32f46xx_rcc, "st,stm32f469-rcc", stm32f4_rcc_init); | 772 | CLK_OF_DECLARE_DRIVER(stm32f46xx_rcc, "st,stm32f469-rcc", stm32f4_rcc_init); |
diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c index 9375777776d9..b533f99550e1 100644 --- a/drivers/clk/renesas/clk-mstp.c +++ b/drivers/clk/renesas/clk-mstp.c | |||
@@ -37,12 +37,14 @@ | |||
37 | * @smstpcr: module stop control register | 37 | * @smstpcr: module stop control register |
38 | * @mstpsr: module stop status register (optional) | 38 | * @mstpsr: module stop status register (optional) |
39 | * @lock: protects writes to SMSTPCR | 39 | * @lock: protects writes to SMSTPCR |
40 | * @width_8bit: registers are 8-bit, not 32-bit | ||
40 | */ | 41 | */ |
41 | struct mstp_clock_group { | 42 | struct mstp_clock_group { |
42 | struct clk_onecell_data data; | 43 | struct clk_onecell_data data; |
43 | void __iomem *smstpcr; | 44 | void __iomem *smstpcr; |
44 | void __iomem *mstpsr; | 45 | void __iomem *mstpsr; |
45 | spinlock_t lock; | 46 | spinlock_t lock; |
47 | bool width_8bit; | ||
46 | }; | 48 | }; |
47 | 49 | ||
48 | /** | 50 | /** |
@@ -59,6 +61,18 @@ struct mstp_clock { | |||
59 | 61 | ||
60 | #define to_mstp_clock(_hw) container_of(_hw, struct mstp_clock, hw) | 62 | #define to_mstp_clock(_hw) container_of(_hw, struct mstp_clock, hw) |
61 | 63 | ||
64 | static inline u32 cpg_mstp_read(struct mstp_clock_group *group, | ||
65 | u32 __iomem *reg) | ||
66 | { | ||
67 | return group->width_8bit ? readb(reg) : clk_readl(reg); | ||
68 | } | ||
69 | |||
70 | static inline void cpg_mstp_write(struct mstp_clock_group *group, u32 val, | ||
71 | u32 __iomem *reg) | ||
72 | { | ||
73 | group->width_8bit ? writeb(val, reg) : clk_writel(val, reg); | ||
74 | } | ||
75 | |||
62 | static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable) | 76 | static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable) |
63 | { | 77 | { |
64 | struct mstp_clock *clock = to_mstp_clock(hw); | 78 | struct mstp_clock *clock = to_mstp_clock(hw); |
@@ -70,12 +84,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable) | |||
70 | 84 | ||
71 | spin_lock_irqsave(&group->lock, flags); | 85 | spin_lock_irqsave(&group->lock, flags); |
72 | 86 | ||
73 | value = clk_readl(group->smstpcr); | 87 | value = cpg_mstp_read(group, group->smstpcr); |
74 | if (enable) | 88 | if (enable) |
75 | value &= ~bitmask; | 89 | value &= ~bitmask; |
76 | else | 90 | else |
77 | value |= bitmask; | 91 | value |= bitmask; |
78 | clk_writel(value, group->smstpcr); | 92 | cpg_mstp_write(group, value, group->smstpcr); |
79 | 93 | ||
80 | spin_unlock_irqrestore(&group->lock, flags); | 94 | spin_unlock_irqrestore(&group->lock, flags); |
81 | 95 | ||
@@ -83,7 +97,7 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable) | |||
83 | return 0; | 97 | return 0; |
84 | 98 | ||
85 | for (i = 1000; i > 0; --i) { | 99 | for (i = 1000; i > 0; --i) { |
86 | if (!(clk_readl(group->mstpsr) & bitmask)) | 100 | if (!(cpg_mstp_read(group, group->mstpsr) & bitmask)) |
87 | break; | 101 | break; |
88 | cpu_relax(); | 102 | cpu_relax(); |
89 | } | 103 | } |
@@ -114,9 +128,9 @@ static int cpg_mstp_clock_is_enabled(struct clk_hw *hw) | |||
114 | u32 value; | 128 | u32 value; |
115 | 129 | ||
116 | if (group->mstpsr) | 130 | if (group->mstpsr) |
117 | value = clk_readl(group->mstpsr); | 131 | value = cpg_mstp_read(group, group->mstpsr); |
118 | else | 132 | else |
119 | value = clk_readl(group->smstpcr); | 133 | value = cpg_mstp_read(group, group->smstpcr); |
120 | 134 | ||
121 | return !(value & BIT(clock->bit_index)); | 135 | return !(value & BIT(clock->bit_index)); |
122 | } | 136 | } |
@@ -188,6 +202,9 @@ static void __init cpg_mstp_clocks_init(struct device_node *np) | |||
188 | return; | 202 | return; |
189 | } | 203 | } |
190 | 204 | ||
205 | if (of_device_is_compatible(np, "renesas,r7s72100-mstp-clocks")) | ||
206 | group->width_8bit = true; | ||
207 | |||
191 | for (i = 0; i < MSTP_MAX_CLOCKS; ++i) | 208 | for (i = 0; i < MSTP_MAX_CLOCKS; ++i) |
192 | clks[i] = ERR_PTR(-ENOENT); | 209 | clks[i] = ERR_PTR(-ENOENT); |
193 | 210 | ||
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c index bc97b6a4b1cf..7fcaf26e8f81 100644 --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c | |||
@@ -26,6 +26,8 @@ static const struct of_device_id machines[] __initconst = { | |||
26 | { .compatible = "allwinner,sun8i-a83t", }, | 26 | { .compatible = "allwinner,sun8i-a83t", }, |
27 | { .compatible = "allwinner,sun8i-h3", }, | 27 | { .compatible = "allwinner,sun8i-h3", }, |
28 | 28 | ||
29 | { .compatible = "apm,xgene-shadowcat", }, | ||
30 | |||
29 | { .compatible = "arm,integrator-ap", }, | 31 | { .compatible = "arm,integrator-ap", }, |
30 | { .compatible = "arm,integrator-cp", }, | 32 | { .compatible = "arm,integrator-cp", }, |
31 | 33 | ||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 6acbd4af632e..f91c25718d16 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -857,13 +857,13 @@ static struct freq_attr *hwp_cpufreq_attrs[] = { | |||
857 | NULL, | 857 | NULL, |
858 | }; | 858 | }; |
859 | 859 | ||
860 | static void intel_pstate_hwp_set(const struct cpumask *cpumask) | 860 | static void intel_pstate_hwp_set(struct cpufreq_policy *policy) |
861 | { | 861 | { |
862 | int min, hw_min, max, hw_max, cpu, range, adj_range; | 862 | int min, hw_min, max, hw_max, cpu, range, adj_range; |
863 | struct perf_limits *perf_limits = limits; | 863 | struct perf_limits *perf_limits = limits; |
864 | u64 value, cap; | 864 | u64 value, cap; |
865 | 865 | ||
866 | for_each_cpu(cpu, cpumask) { | 866 | for_each_cpu(cpu, policy->cpus) { |
867 | int max_perf_pct, min_perf_pct; | 867 | int max_perf_pct, min_perf_pct; |
868 | struct cpudata *cpu_data = all_cpu_data[cpu]; | 868 | struct cpudata *cpu_data = all_cpu_data[cpu]; |
869 | s16 epp; | 869 | s16 epp; |
@@ -949,7 +949,7 @@ skip_epp: | |||
949 | static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy) | 949 | static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy) |
950 | { | 950 | { |
951 | if (hwp_active) | 951 | if (hwp_active) |
952 | intel_pstate_hwp_set(policy->cpus); | 952 | intel_pstate_hwp_set(policy); |
953 | 953 | ||
954 | return 0; | 954 | return 0; |
955 | } | 955 | } |
@@ -968,19 +968,28 @@ static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy) | |||
968 | 968 | ||
969 | static int intel_pstate_resume(struct cpufreq_policy *policy) | 969 | static int intel_pstate_resume(struct cpufreq_policy *policy) |
970 | { | 970 | { |
971 | int ret; | ||
972 | |||
971 | if (!hwp_active) | 973 | if (!hwp_active) |
972 | return 0; | 974 | return 0; |
973 | 975 | ||
976 | mutex_lock(&intel_pstate_limits_lock); | ||
977 | |||
974 | all_cpu_data[policy->cpu]->epp_policy = 0; | 978 | all_cpu_data[policy->cpu]->epp_policy = 0; |
975 | 979 | ||
976 | return intel_pstate_hwp_set_policy(policy); | 980 | ret = intel_pstate_hwp_set_policy(policy); |
981 | |||
982 | mutex_unlock(&intel_pstate_limits_lock); | ||
983 | |||
984 | return ret; | ||
977 | } | 985 | } |
978 | 986 | ||
979 | static void intel_pstate_hwp_set_online_cpus(void) | 987 | static void intel_pstate_update_policies(void) |
980 | { | 988 | { |
981 | get_online_cpus(); | 989 | int cpu; |
982 | intel_pstate_hwp_set(cpu_online_mask); | 990 | |
983 | put_online_cpus(); | 991 | for_each_possible_cpu(cpu) |
992 | cpufreq_update_policy(cpu); | ||
984 | } | 993 | } |
985 | 994 | ||
986 | /************************** debugfs begin ************************/ | 995 | /************************** debugfs begin ************************/ |
@@ -1018,10 +1027,6 @@ static void __init intel_pstate_debug_expose_params(void) | |||
1018 | struct dentry *debugfs_parent; | 1027 | struct dentry *debugfs_parent; |
1019 | int i = 0; | 1028 | int i = 0; |
1020 | 1029 | ||
1021 | if (hwp_active || | ||
1022 | pstate_funcs.get_target_pstate == get_target_pstate_use_cpu_load) | ||
1023 | return; | ||
1024 | |||
1025 | debugfs_parent = debugfs_create_dir("pstate_snb", NULL); | 1030 | debugfs_parent = debugfs_create_dir("pstate_snb", NULL); |
1026 | if (IS_ERR_OR_NULL(debugfs_parent)) | 1031 | if (IS_ERR_OR_NULL(debugfs_parent)) |
1027 | return; | 1032 | return; |
@@ -1105,11 +1110,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, | |||
1105 | 1110 | ||
1106 | limits->no_turbo = clamp_t(int, input, 0, 1); | 1111 | limits->no_turbo = clamp_t(int, input, 0, 1); |
1107 | 1112 | ||
1108 | if (hwp_active) | ||
1109 | intel_pstate_hwp_set_online_cpus(); | ||
1110 | |||
1111 | mutex_unlock(&intel_pstate_limits_lock); | 1113 | mutex_unlock(&intel_pstate_limits_lock); |
1112 | 1114 | ||
1115 | intel_pstate_update_policies(); | ||
1116 | |||
1113 | return count; | 1117 | return count; |
1114 | } | 1118 | } |
1115 | 1119 | ||
@@ -1134,11 +1138,10 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, | |||
1134 | limits->max_perf_pct); | 1138 | limits->max_perf_pct); |
1135 | limits->max_perf = div_ext_fp(limits->max_perf_pct, 100); | 1139 | limits->max_perf = div_ext_fp(limits->max_perf_pct, 100); |
1136 | 1140 | ||
1137 | if (hwp_active) | ||
1138 | intel_pstate_hwp_set_online_cpus(); | ||
1139 | |||
1140 | mutex_unlock(&intel_pstate_limits_lock); | 1141 | mutex_unlock(&intel_pstate_limits_lock); |
1141 | 1142 | ||
1143 | intel_pstate_update_policies(); | ||
1144 | |||
1142 | return count; | 1145 | return count; |
1143 | } | 1146 | } |
1144 | 1147 | ||
@@ -1163,11 +1166,10 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, | |||
1163 | limits->min_perf_pct); | 1166 | limits->min_perf_pct); |
1164 | limits->min_perf = div_ext_fp(limits->min_perf_pct, 100); | 1167 | limits->min_perf = div_ext_fp(limits->min_perf_pct, 100); |
1165 | 1168 | ||
1166 | if (hwp_active) | ||
1167 | intel_pstate_hwp_set_online_cpus(); | ||
1168 | |||
1169 | mutex_unlock(&intel_pstate_limits_lock); | 1169 | mutex_unlock(&intel_pstate_limits_lock); |
1170 | 1170 | ||
1171 | intel_pstate_update_policies(); | ||
1172 | |||
1171 | return count; | 1173 | return count; |
1172 | } | 1174 | } |
1173 | 1175 | ||
@@ -2153,8 +2155,12 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) | |||
2153 | if (per_cpu_limits) | 2155 | if (per_cpu_limits) |
2154 | perf_limits = cpu->perf_limits; | 2156 | perf_limits = cpu->perf_limits; |
2155 | 2157 | ||
2158 | mutex_lock(&intel_pstate_limits_lock); | ||
2159 | |||
2156 | intel_pstate_update_perf_limits(policy, perf_limits); | 2160 | intel_pstate_update_perf_limits(policy, perf_limits); |
2157 | 2161 | ||
2162 | mutex_unlock(&intel_pstate_limits_lock); | ||
2163 | |||
2158 | return 0; | 2164 | return 0; |
2159 | } | 2165 | } |
2160 | 2166 | ||
@@ -2487,7 +2493,10 @@ hwp_cpu_matched: | |||
2487 | if (rc) | 2493 | if (rc) |
2488 | goto out; | 2494 | goto out; |
2489 | 2495 | ||
2490 | intel_pstate_debug_expose_params(); | 2496 | if (intel_pstate_driver == &intel_pstate && !hwp_active && |
2497 | pstate_funcs.get_target_pstate != get_target_pstate_use_cpu_load) | ||
2498 | intel_pstate_debug_expose_params(); | ||
2499 | |||
2491 | intel_pstate_sysfs_expose_params(); | 2500 | intel_pstate_sysfs_expose_params(); |
2492 | 2501 | ||
2493 | if (hwp_active) | 2502 | if (hwp_active) |
diff --git a/drivers/crypto/marvell/cesa.h b/drivers/crypto/marvell/cesa.h index a768da7138a1..b7872f62f674 100644 --- a/drivers/crypto/marvell/cesa.h +++ b/drivers/crypto/marvell/cesa.h | |||
@@ -273,7 +273,8 @@ struct mv_cesa_op_ctx { | |||
273 | #define CESA_TDMA_SRC_IN_SRAM BIT(30) | 273 | #define CESA_TDMA_SRC_IN_SRAM BIT(30) |
274 | #define CESA_TDMA_END_OF_REQ BIT(29) | 274 | #define CESA_TDMA_END_OF_REQ BIT(29) |
275 | #define CESA_TDMA_BREAK_CHAIN BIT(28) | 275 | #define CESA_TDMA_BREAK_CHAIN BIT(28) |
276 | #define CESA_TDMA_TYPE_MSK GENMASK(27, 0) | 276 | #define CESA_TDMA_SET_STATE BIT(27) |
277 | #define CESA_TDMA_TYPE_MSK GENMASK(26, 0) | ||
277 | #define CESA_TDMA_DUMMY 0 | 278 | #define CESA_TDMA_DUMMY 0 |
278 | #define CESA_TDMA_DATA 1 | 279 | #define CESA_TDMA_DATA 1 |
279 | #define CESA_TDMA_OP 2 | 280 | #define CESA_TDMA_OP 2 |
diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c index 317cf029c0cf..77c0fb936f47 100644 --- a/drivers/crypto/marvell/hash.c +++ b/drivers/crypto/marvell/hash.c | |||
@@ -280,13 +280,32 @@ static void mv_cesa_ahash_std_prepare(struct ahash_request *req) | |||
280 | sreq->offset = 0; | 280 | sreq->offset = 0; |
281 | } | 281 | } |
282 | 282 | ||
283 | static void mv_cesa_ahash_dma_step(struct ahash_request *req) | ||
284 | { | ||
285 | struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); | ||
286 | struct mv_cesa_req *base = &creq->base; | ||
287 | |||
288 | /* We must explicitly set the digest state. */ | ||
289 | if (base->chain.first->flags & CESA_TDMA_SET_STATE) { | ||
290 | struct mv_cesa_engine *engine = base->engine; | ||
291 | int i; | ||
292 | |||
293 | /* Set the hash state in the IVDIG regs. */ | ||
294 | for (i = 0; i < ARRAY_SIZE(creq->state); i++) | ||
295 | writel_relaxed(creq->state[i], engine->regs + | ||
296 | CESA_IVDIG(i)); | ||
297 | } | ||
298 | |||
299 | mv_cesa_dma_step(base); | ||
300 | } | ||
301 | |||
283 | static void mv_cesa_ahash_step(struct crypto_async_request *req) | 302 | static void mv_cesa_ahash_step(struct crypto_async_request *req) |
284 | { | 303 | { |
285 | struct ahash_request *ahashreq = ahash_request_cast(req); | 304 | struct ahash_request *ahashreq = ahash_request_cast(req); |
286 | struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); | 305 | struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); |
287 | 306 | ||
288 | if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) | 307 | if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) |
289 | mv_cesa_dma_step(&creq->base); | 308 | mv_cesa_ahash_dma_step(ahashreq); |
290 | else | 309 | else |
291 | mv_cesa_ahash_std_step(ahashreq); | 310 | mv_cesa_ahash_std_step(ahashreq); |
292 | } | 311 | } |
@@ -584,12 +603,16 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req) | |||
584 | struct mv_cesa_ahash_dma_iter iter; | 603 | struct mv_cesa_ahash_dma_iter iter; |
585 | struct mv_cesa_op_ctx *op = NULL; | 604 | struct mv_cesa_op_ctx *op = NULL; |
586 | unsigned int frag_len; | 605 | unsigned int frag_len; |
606 | bool set_state = false; | ||
587 | int ret; | 607 | int ret; |
588 | u32 type; | 608 | u32 type; |
589 | 609 | ||
590 | basereq->chain.first = NULL; | 610 | basereq->chain.first = NULL; |
591 | basereq->chain.last = NULL; | 611 | basereq->chain.last = NULL; |
592 | 612 | ||
613 | if (!mv_cesa_mac_op_is_first_frag(&creq->op_tmpl)) | ||
614 | set_state = true; | ||
615 | |||
593 | if (creq->src_nents) { | 616 | if (creq->src_nents) { |
594 | ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, | 617 | ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, |
595 | DMA_TO_DEVICE); | 618 | DMA_TO_DEVICE); |
@@ -683,6 +706,15 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req) | |||
683 | if (type != CESA_TDMA_RESULT) | 706 | if (type != CESA_TDMA_RESULT) |
684 | basereq->chain.last->flags |= CESA_TDMA_BREAK_CHAIN; | 707 | basereq->chain.last->flags |= CESA_TDMA_BREAK_CHAIN; |
685 | 708 | ||
709 | if (set_state) { | ||
710 | /* | ||
711 | * Put the CESA_TDMA_SET_STATE flag on the first tdma desc to | ||
712 | * let the step logic know that the IVDIG registers should be | ||
713 | * explicitly set before launching a TDMA chain. | ||
714 | */ | ||
715 | basereq->chain.first->flags |= CESA_TDMA_SET_STATE; | ||
716 | } | ||
717 | |||
686 | return 0; | 718 | return 0; |
687 | 719 | ||
688 | err_free_tdma: | 720 | err_free_tdma: |
diff --git a/drivers/crypto/marvell/tdma.c b/drivers/crypto/marvell/tdma.c index 4416b88eca70..c76375ff376d 100644 --- a/drivers/crypto/marvell/tdma.c +++ b/drivers/crypto/marvell/tdma.c | |||
@@ -109,7 +109,14 @@ void mv_cesa_tdma_chain(struct mv_cesa_engine *engine, | |||
109 | last->next = dreq->chain.first; | 109 | last->next = dreq->chain.first; |
110 | engine->chain.last = dreq->chain.last; | 110 | engine->chain.last = dreq->chain.last; |
111 | 111 | ||
112 | if (!(last->flags & CESA_TDMA_BREAK_CHAIN)) | 112 | /* |
113 | * Break the DMA chain if the CESA_TDMA_BREAK_CHAIN is set on | ||
114 | * the last element of the current chain, or if the request | ||
115 | * being queued needs the IV regs to be set before lauching | ||
116 | * the request. | ||
117 | */ | ||
118 | if (!(last->flags & CESA_TDMA_BREAK_CHAIN) && | ||
119 | !(dreq->chain.first->flags & CESA_TDMA_SET_STATE)) | ||
113 | last->next_dma = dreq->chain.first->cur_dma; | 120 | last->next_dma = dreq->chain.first->cur_dma; |
114 | } | 121 | } |
115 | } | 122 | } |
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index a324801d6a66..47206a21bb90 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -593,11 +593,16 @@ struct devfreq *devfreq_add_device(struct device *dev, | |||
593 | list_add(&devfreq->node, &devfreq_list); | 593 | list_add(&devfreq->node, &devfreq_list); |
594 | 594 | ||
595 | governor = find_devfreq_governor(devfreq->governor_name); | 595 | governor = find_devfreq_governor(devfreq->governor_name); |
596 | if (!IS_ERR(governor)) | 596 | if (IS_ERR(governor)) { |
597 | devfreq->governor = governor; | 597 | dev_err(dev, "%s: Unable to find governor for the device\n", |
598 | if (devfreq->governor) | 598 | __func__); |
599 | err = devfreq->governor->event_handler(devfreq, | 599 | err = PTR_ERR(governor); |
600 | DEVFREQ_GOV_START, NULL); | 600 | goto err_init; |
601 | } | ||
602 | |||
603 | devfreq->governor = governor; | ||
604 | err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START, | ||
605 | NULL); | ||
601 | if (err) { | 606 | if (err) { |
602 | dev_err(dev, "%s: Unable to start governor for the device\n", | 607 | dev_err(dev, "%s: Unable to start governor for the device\n", |
603 | __func__); | 608 | __func__); |
diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index a8ed7792ece2..9af86f46fbec 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c | |||
@@ -497,7 +497,7 @@ passive: | |||
497 | if (IS_ERR(bus->devfreq)) { | 497 | if (IS_ERR(bus->devfreq)) { |
498 | dev_err(dev, | 498 | dev_err(dev, |
499 | "failed to add devfreq dev with passive governor\n"); | 499 | "failed to add devfreq dev with passive governor\n"); |
500 | ret = -EPROBE_DEFER; | 500 | ret = PTR_ERR(bus->devfreq); |
501 | goto err; | 501 | goto err; |
502 | } | 502 | } |
503 | 503 | ||
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index 70e13230d8db..9ad0b1934be9 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c | |||
@@ -721,11 +721,17 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val) | |||
721 | 721 | ||
722 | ret = scpi_send_message(CMD_SENSOR_VALUE, &id, sizeof(id), | 722 | ret = scpi_send_message(CMD_SENSOR_VALUE, &id, sizeof(id), |
723 | &buf, sizeof(buf)); | 723 | &buf, sizeof(buf)); |
724 | if (!ret) | 724 | if (ret) |
725 | return ret; | ||
726 | |||
727 | if (scpi_info->is_legacy) | ||
728 | /* only 32-bits supported, hi_val can be junk */ | ||
729 | *val = le32_to_cpu(buf.lo_val); | ||
730 | else | ||
725 | *val = (u64)le32_to_cpu(buf.hi_val) << 32 | | 731 | *val = (u64)le32_to_cpu(buf.hi_val) << 32 | |
726 | le32_to_cpu(buf.lo_val); | 732 | le32_to_cpu(buf.lo_val); |
727 | 733 | ||
728 | return ret; | 734 | return 0; |
729 | } | 735 | } |
730 | 736 | ||
731 | static int scpi_device_get_power_state(u16 dev_id) | 737 | static int scpi_device_get_power_state(u16 dev_id) |
diff --git a/drivers/firmware/psci_checker.c b/drivers/firmware/psci_checker.c index 44bdb78f837b..29d58feaf675 100644 --- a/drivers/firmware/psci_checker.c +++ b/drivers/firmware/psci_checker.c | |||
@@ -270,8 +270,7 @@ static int suspend_test_thread(void *arg) | |||
270 | struct cpuidle_device *dev; | 270 | struct cpuidle_device *dev; |
271 | struct cpuidle_driver *drv; | 271 | struct cpuidle_driver *drv; |
272 | /* No need for an actual callback, we just want to wake up the CPU. */ | 272 | /* No need for an actual callback, we just want to wake up the CPU. */ |
273 | struct timer_list wakeup_timer = | 273 | struct timer_list wakeup_timer; |
274 | TIMER_INITIALIZER(dummy_callback, 0, 0); | ||
275 | 274 | ||
276 | /* Wait for the main thread to give the start signal. */ | 275 | /* Wait for the main thread to give the start signal. */ |
277 | wait_for_completion(&suspend_threads_started); | 276 | wait_for_completion(&suspend_threads_started); |
@@ -287,6 +286,7 @@ static int suspend_test_thread(void *arg) | |||
287 | pr_info("CPU %d entering suspend cycles, states 1 through %d\n", | 286 | pr_info("CPU %d entering suspend cycles, states 1 through %d\n", |
288 | cpu, drv->state_count - 1); | 287 | cpu, drv->state_count - 1); |
289 | 288 | ||
289 | setup_timer_on_stack(&wakeup_timer, dummy_callback, 0); | ||
290 | for (i = 0; i < NUM_SUSPEND_CYCLE; ++i) { | 290 | for (i = 0; i < NUM_SUSPEND_CYCLE; ++i) { |
291 | int index; | 291 | int index; |
292 | /* | 292 | /* |
diff --git a/drivers/gpu/drm/i915/gvt/cfg_space.c b/drivers/gpu/drm/i915/gvt/cfg_space.c index db516382a4d4..711c31c8d8b4 100644 --- a/drivers/gpu/drm/i915/gvt/cfg_space.c +++ b/drivers/gpu/drm/i915/gvt/cfg_space.c | |||
@@ -123,6 +123,7 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu, | |||
123 | u8 changed = old ^ new; | 123 | u8 changed = old ^ new; |
124 | int ret; | 124 | int ret; |
125 | 125 | ||
126 | memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes); | ||
126 | if (!(changed & PCI_COMMAND_MEMORY)) | 127 | if (!(changed & PCI_COMMAND_MEMORY)) |
127 | return 0; | 128 | return 0; |
128 | 129 | ||
@@ -142,7 +143,6 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu, | |||
142 | return ret; | 143 | return ret; |
143 | } | 144 | } |
144 | 145 | ||
145 | memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes); | ||
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
148 | 148 | ||
@@ -240,7 +240,7 @@ int intel_vgpu_emulate_cfg_write(struct intel_vgpu *vgpu, unsigned int offset, | |||
240 | if (WARN_ON(bytes > 4)) | 240 | if (WARN_ON(bytes > 4)) |
241 | return -EINVAL; | 241 | return -EINVAL; |
242 | 242 | ||
243 | if (WARN_ON(offset + bytes >= INTEL_GVT_MAX_CFG_SPACE_SZ)) | 243 | if (WARN_ON(offset + bytes > INTEL_GVT_MAX_CFG_SPACE_SZ)) |
244 | return -EINVAL; | 244 | return -EINVAL; |
245 | 245 | ||
246 | /* First check if it's PCI_COMMAND */ | 246 | /* First check if it's PCI_COMMAND */ |
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c index 7eaaf1c9ed2b..6c5fdf5b2ce2 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c | |||
@@ -1998,6 +1998,8 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu) | |||
1998 | INIT_LIST_HEAD(>t->oos_page_list_head); | 1998 | INIT_LIST_HEAD(>t->oos_page_list_head); |
1999 | INIT_LIST_HEAD(>t->post_shadow_list_head); | 1999 | INIT_LIST_HEAD(>t->post_shadow_list_head); |
2000 | 2000 | ||
2001 | intel_vgpu_reset_ggtt(vgpu); | ||
2002 | |||
2001 | ggtt_mm = intel_vgpu_create_mm(vgpu, INTEL_GVT_MM_GGTT, | 2003 | ggtt_mm = intel_vgpu_create_mm(vgpu, INTEL_GVT_MM_GGTT, |
2002 | NULL, 1, 0); | 2004 | NULL, 1, 0); |
2003 | if (IS_ERR(ggtt_mm)) { | 2005 | if (IS_ERR(ggtt_mm)) { |
@@ -2206,6 +2208,7 @@ int intel_vgpu_g2v_destroy_ppgtt_mm(struct intel_vgpu *vgpu, | |||
2206 | int intel_gvt_init_gtt(struct intel_gvt *gvt) | 2208 | int intel_gvt_init_gtt(struct intel_gvt *gvt) |
2207 | { | 2209 | { |
2208 | int ret; | 2210 | int ret; |
2211 | void *page_addr; | ||
2209 | 2212 | ||
2210 | gvt_dbg_core("init gtt\n"); | 2213 | gvt_dbg_core("init gtt\n"); |
2211 | 2214 | ||
@@ -2218,6 +2221,23 @@ int intel_gvt_init_gtt(struct intel_gvt *gvt) | |||
2218 | return -ENODEV; | 2221 | return -ENODEV; |
2219 | } | 2222 | } |
2220 | 2223 | ||
2224 | gvt->gtt.scratch_ggtt_page = | ||
2225 | alloc_page(GFP_KERNEL | GFP_ATOMIC | __GFP_ZERO); | ||
2226 | if (!gvt->gtt.scratch_ggtt_page) { | ||
2227 | gvt_err("fail to allocate scratch ggtt page\n"); | ||
2228 | return -ENOMEM; | ||
2229 | } | ||
2230 | |||
2231 | page_addr = page_address(gvt->gtt.scratch_ggtt_page); | ||
2232 | |||
2233 | gvt->gtt.scratch_ggtt_mfn = | ||
2234 | intel_gvt_hypervisor_virt_to_mfn(page_addr); | ||
2235 | if (gvt->gtt.scratch_ggtt_mfn == INTEL_GVT_INVALID_ADDR) { | ||
2236 | gvt_err("fail to translate scratch ggtt page\n"); | ||
2237 | __free_page(gvt->gtt.scratch_ggtt_page); | ||
2238 | return -EFAULT; | ||
2239 | } | ||
2240 | |||
2221 | if (enable_out_of_sync) { | 2241 | if (enable_out_of_sync) { |
2222 | ret = setup_spt_oos(gvt); | 2242 | ret = setup_spt_oos(gvt); |
2223 | if (ret) { | 2243 | if (ret) { |
@@ -2239,6 +2259,41 @@ int intel_gvt_init_gtt(struct intel_gvt *gvt) | |||
2239 | */ | 2259 | */ |
2240 | void intel_gvt_clean_gtt(struct intel_gvt *gvt) | 2260 | void intel_gvt_clean_gtt(struct intel_gvt *gvt) |
2241 | { | 2261 | { |
2262 | __free_page(gvt->gtt.scratch_ggtt_page); | ||
2263 | |||
2242 | if (enable_out_of_sync) | 2264 | if (enable_out_of_sync) |
2243 | clean_spt_oos(gvt); | 2265 | clean_spt_oos(gvt); |
2244 | } | 2266 | } |
2267 | |||
2268 | /** | ||
2269 | * intel_vgpu_reset_ggtt - reset the GGTT entry | ||
2270 | * @vgpu: a vGPU | ||
2271 | * | ||
2272 | * This function is called at the vGPU create stage | ||
2273 | * to reset all the GGTT entries. | ||
2274 | * | ||
2275 | */ | ||
2276 | void intel_vgpu_reset_ggtt(struct intel_vgpu *vgpu) | ||
2277 | { | ||
2278 | struct intel_gvt *gvt = vgpu->gvt; | ||
2279 | struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops; | ||
2280 | u32 index; | ||
2281 | u32 offset; | ||
2282 | u32 num_entries; | ||
2283 | struct intel_gvt_gtt_entry e; | ||
2284 | |||
2285 | memset(&e, 0, sizeof(struct intel_gvt_gtt_entry)); | ||
2286 | e.type = GTT_TYPE_GGTT_PTE; | ||
2287 | ops->set_pfn(&e, gvt->gtt.scratch_ggtt_mfn); | ||
2288 | e.val64 |= _PAGE_PRESENT; | ||
2289 | |||
2290 | index = vgpu_aperture_gmadr_base(vgpu) >> PAGE_SHIFT; | ||
2291 | num_entries = vgpu_aperture_sz(vgpu) >> PAGE_SHIFT; | ||
2292 | for (offset = 0; offset < num_entries; offset++) | ||
2293 | ops->set_entry(NULL, &e, index + offset, false, 0, vgpu); | ||
2294 | |||
2295 | index = vgpu_hidden_gmadr_base(vgpu) >> PAGE_SHIFT; | ||
2296 | num_entries = vgpu_hidden_sz(vgpu) >> PAGE_SHIFT; | ||
2297 | for (offset = 0; offset < num_entries; offset++) | ||
2298 | ops->set_entry(NULL, &e, index + offset, false, 0, vgpu); | ||
2299 | } | ||
diff --git a/drivers/gpu/drm/i915/gvt/gtt.h b/drivers/gpu/drm/i915/gvt/gtt.h index d250013bc37b..b315ab3593ec 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.h +++ b/drivers/gpu/drm/i915/gvt/gtt.h | |||
@@ -81,6 +81,9 @@ struct intel_gvt_gtt { | |||
81 | struct list_head oos_page_use_list_head; | 81 | struct list_head oos_page_use_list_head; |
82 | struct list_head oos_page_free_list_head; | 82 | struct list_head oos_page_free_list_head; |
83 | struct list_head mm_lru_list_head; | 83 | struct list_head mm_lru_list_head; |
84 | |||
85 | struct page *scratch_ggtt_page; | ||
86 | unsigned long scratch_ggtt_mfn; | ||
84 | }; | 87 | }; |
85 | 88 | ||
86 | enum { | 89 | enum { |
@@ -202,6 +205,7 @@ struct intel_vgpu_gtt { | |||
202 | 205 | ||
203 | extern int intel_vgpu_init_gtt(struct intel_vgpu *vgpu); | 206 | extern int intel_vgpu_init_gtt(struct intel_vgpu *vgpu); |
204 | extern void intel_vgpu_clean_gtt(struct intel_vgpu *vgpu); | 207 | extern void intel_vgpu_clean_gtt(struct intel_vgpu *vgpu); |
208 | void intel_vgpu_reset_ggtt(struct intel_vgpu *vgpu); | ||
205 | 209 | ||
206 | extern int intel_gvt_init_gtt(struct intel_gvt *gvt); | 210 | extern int intel_gvt_init_gtt(struct intel_gvt *gvt); |
207 | extern void intel_gvt_clean_gtt(struct intel_gvt *gvt); | 211 | extern void intel_gvt_clean_gtt(struct intel_gvt *gvt); |
diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h index ad0e9364ee70..0af17016f33f 100644 --- a/drivers/gpu/drm/i915/gvt/gvt.h +++ b/drivers/gpu/drm/i915/gvt/gvt.h | |||
@@ -175,6 +175,7 @@ struct intel_vgpu { | |||
175 | struct notifier_block group_notifier; | 175 | struct notifier_block group_notifier; |
176 | struct kvm *kvm; | 176 | struct kvm *kvm; |
177 | struct work_struct release_work; | 177 | struct work_struct release_work; |
178 | atomic_t released; | ||
178 | } vdev; | 179 | } vdev; |
179 | #endif | 180 | #endif |
180 | }; | 181 | }; |
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index 4dd6722a7339..faaae07ae487 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c | |||
@@ -114,12 +114,15 @@ out: | |||
114 | static kvm_pfn_t gvt_cache_find(struct intel_vgpu *vgpu, gfn_t gfn) | 114 | static kvm_pfn_t gvt_cache_find(struct intel_vgpu *vgpu, gfn_t gfn) |
115 | { | 115 | { |
116 | struct gvt_dma *entry; | 116 | struct gvt_dma *entry; |
117 | kvm_pfn_t pfn; | ||
117 | 118 | ||
118 | mutex_lock(&vgpu->vdev.cache_lock); | 119 | mutex_lock(&vgpu->vdev.cache_lock); |
120 | |||
119 | entry = __gvt_cache_find(vgpu, gfn); | 121 | entry = __gvt_cache_find(vgpu, gfn); |
120 | mutex_unlock(&vgpu->vdev.cache_lock); | 122 | pfn = (entry == NULL) ? 0 : entry->pfn; |
121 | 123 | ||
122 | return entry == NULL ? 0 : entry->pfn; | 124 | mutex_unlock(&vgpu->vdev.cache_lock); |
125 | return pfn; | ||
123 | } | 126 | } |
124 | 127 | ||
125 | static void gvt_cache_add(struct intel_vgpu *vgpu, gfn_t gfn, kvm_pfn_t pfn) | 128 | static void gvt_cache_add(struct intel_vgpu *vgpu, gfn_t gfn, kvm_pfn_t pfn) |
@@ -166,7 +169,7 @@ static void __gvt_cache_remove_entry(struct intel_vgpu *vgpu, | |||
166 | 169 | ||
167 | static void gvt_cache_remove(struct intel_vgpu *vgpu, gfn_t gfn) | 170 | static void gvt_cache_remove(struct intel_vgpu *vgpu, gfn_t gfn) |
168 | { | 171 | { |
169 | struct device *dev = &vgpu->vdev.mdev->dev; | 172 | struct device *dev = mdev_dev(vgpu->vdev.mdev); |
170 | struct gvt_dma *this; | 173 | struct gvt_dma *this; |
171 | unsigned long g1; | 174 | unsigned long g1; |
172 | int rc; | 175 | int rc; |
@@ -195,7 +198,7 @@ static void gvt_cache_destroy(struct intel_vgpu *vgpu) | |||
195 | { | 198 | { |
196 | struct gvt_dma *dma; | 199 | struct gvt_dma *dma; |
197 | struct rb_node *node = NULL; | 200 | struct rb_node *node = NULL; |
198 | struct device *dev = &vgpu->vdev.mdev->dev; | 201 | struct device *dev = mdev_dev(vgpu->vdev.mdev); |
199 | unsigned long gfn; | 202 | unsigned long gfn; |
200 | 203 | ||
201 | mutex_lock(&vgpu->vdev.cache_lock); | 204 | mutex_lock(&vgpu->vdev.cache_lock); |
@@ -396,7 +399,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) | |||
396 | struct device *pdev; | 399 | struct device *pdev; |
397 | void *gvt; | 400 | void *gvt; |
398 | 401 | ||
399 | pdev = mdev->parent->dev; | 402 | pdev = mdev_parent_dev(mdev); |
400 | gvt = kdev_to_i915(pdev)->gvt; | 403 | gvt = kdev_to_i915(pdev)->gvt; |
401 | 404 | ||
402 | type = intel_gvt_find_vgpu_type(gvt, kobject_name(kobj)); | 405 | type = intel_gvt_find_vgpu_type(gvt, kobject_name(kobj)); |
@@ -418,7 +421,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) | |||
418 | mdev_set_drvdata(mdev, vgpu); | 421 | mdev_set_drvdata(mdev, vgpu); |
419 | 422 | ||
420 | gvt_dbg_core("intel_vgpu_create succeeded for mdev: %s\n", | 423 | gvt_dbg_core("intel_vgpu_create succeeded for mdev: %s\n", |
421 | dev_name(&mdev->dev)); | 424 | dev_name(mdev_dev(mdev))); |
422 | return 0; | 425 | return 0; |
423 | } | 426 | } |
424 | 427 | ||
@@ -482,7 +485,7 @@ static int intel_vgpu_open(struct mdev_device *mdev) | |||
482 | vgpu->vdev.group_notifier.notifier_call = intel_vgpu_group_notifier; | 485 | vgpu->vdev.group_notifier.notifier_call = intel_vgpu_group_notifier; |
483 | 486 | ||
484 | events = VFIO_IOMMU_NOTIFY_DMA_UNMAP; | 487 | events = VFIO_IOMMU_NOTIFY_DMA_UNMAP; |
485 | ret = vfio_register_notifier(&mdev->dev, VFIO_IOMMU_NOTIFY, &events, | 488 | ret = vfio_register_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, &events, |
486 | &vgpu->vdev.iommu_notifier); | 489 | &vgpu->vdev.iommu_notifier); |
487 | if (ret != 0) { | 490 | if (ret != 0) { |
488 | gvt_err("vfio_register_notifier for iommu failed: %d\n", ret); | 491 | gvt_err("vfio_register_notifier for iommu failed: %d\n", ret); |
@@ -490,17 +493,26 @@ static int intel_vgpu_open(struct mdev_device *mdev) | |||
490 | } | 493 | } |
491 | 494 | ||
492 | events = VFIO_GROUP_NOTIFY_SET_KVM; | 495 | events = VFIO_GROUP_NOTIFY_SET_KVM; |
493 | ret = vfio_register_notifier(&mdev->dev, VFIO_GROUP_NOTIFY, &events, | 496 | ret = vfio_register_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, &events, |
494 | &vgpu->vdev.group_notifier); | 497 | &vgpu->vdev.group_notifier); |
495 | if (ret != 0) { | 498 | if (ret != 0) { |
496 | gvt_err("vfio_register_notifier for group failed: %d\n", ret); | 499 | gvt_err("vfio_register_notifier for group failed: %d\n", ret); |
497 | goto undo_iommu; | 500 | goto undo_iommu; |
498 | } | 501 | } |
499 | 502 | ||
500 | return kvmgt_guest_init(mdev); | 503 | ret = kvmgt_guest_init(mdev); |
504 | if (ret) | ||
505 | goto undo_group; | ||
506 | |||
507 | atomic_set(&vgpu->vdev.released, 0); | ||
508 | return ret; | ||
509 | |||
510 | undo_group: | ||
511 | vfio_unregister_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, | ||
512 | &vgpu->vdev.group_notifier); | ||
501 | 513 | ||
502 | undo_iommu: | 514 | undo_iommu: |
503 | vfio_unregister_notifier(&mdev->dev, VFIO_IOMMU_NOTIFY, | 515 | vfio_unregister_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, |
504 | &vgpu->vdev.iommu_notifier); | 516 | &vgpu->vdev.iommu_notifier); |
505 | out: | 517 | out: |
506 | return ret; | 518 | return ret; |
@@ -509,17 +521,26 @@ out: | |||
509 | static void __intel_vgpu_release(struct intel_vgpu *vgpu) | 521 | static void __intel_vgpu_release(struct intel_vgpu *vgpu) |
510 | { | 522 | { |
511 | struct kvmgt_guest_info *info; | 523 | struct kvmgt_guest_info *info; |
524 | int ret; | ||
512 | 525 | ||
513 | if (!handle_valid(vgpu->handle)) | 526 | if (!handle_valid(vgpu->handle)) |
514 | return; | 527 | return; |
515 | 528 | ||
516 | vfio_unregister_notifier(&vgpu->vdev.mdev->dev, VFIO_IOMMU_NOTIFY, | 529 | if (atomic_cmpxchg(&vgpu->vdev.released, 0, 1)) |
530 | return; | ||
531 | |||
532 | ret = vfio_unregister_notifier(mdev_dev(vgpu->vdev.mdev), VFIO_IOMMU_NOTIFY, | ||
517 | &vgpu->vdev.iommu_notifier); | 533 | &vgpu->vdev.iommu_notifier); |
518 | vfio_unregister_notifier(&vgpu->vdev.mdev->dev, VFIO_GROUP_NOTIFY, | 534 | WARN(ret, "vfio_unregister_notifier for iommu failed: %d\n", ret); |
535 | |||
536 | ret = vfio_unregister_notifier(mdev_dev(vgpu->vdev.mdev), VFIO_GROUP_NOTIFY, | ||
519 | &vgpu->vdev.group_notifier); | 537 | &vgpu->vdev.group_notifier); |
538 | WARN(ret, "vfio_unregister_notifier for group failed: %d\n", ret); | ||
520 | 539 | ||
521 | info = (struct kvmgt_guest_info *)vgpu->handle; | 540 | info = (struct kvmgt_guest_info *)vgpu->handle; |
522 | kvmgt_guest_exit(info); | 541 | kvmgt_guest_exit(info); |
542 | |||
543 | vgpu->vdev.kvm = NULL; | ||
523 | vgpu->handle = 0; | 544 | vgpu->handle = 0; |
524 | } | 545 | } |
525 | 546 | ||
@@ -534,6 +555,7 @@ static void intel_vgpu_release_work(struct work_struct *work) | |||
534 | { | 555 | { |
535 | struct intel_vgpu *vgpu = container_of(work, struct intel_vgpu, | 556 | struct intel_vgpu *vgpu = container_of(work, struct intel_vgpu, |
536 | vdev.release_work); | 557 | vdev.release_work); |
558 | |||
537 | __intel_vgpu_release(vgpu); | 559 | __intel_vgpu_release(vgpu); |
538 | } | 560 | } |
539 | 561 | ||
@@ -1089,7 +1111,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd, | |||
1089 | return 0; | 1111 | return 0; |
1090 | } | 1112 | } |
1091 | 1113 | ||
1092 | static const struct parent_ops intel_vgpu_ops = { | 1114 | static const struct mdev_parent_ops intel_vgpu_ops = { |
1093 | .supported_type_groups = intel_vgpu_type_groups, | 1115 | .supported_type_groups = intel_vgpu_type_groups, |
1094 | .create = intel_vgpu_create, | 1116 | .create = intel_vgpu_create, |
1095 | .remove = intel_vgpu_remove, | 1117 | .remove = intel_vgpu_remove, |
@@ -1134,6 +1156,10 @@ static int kvmgt_write_protect_add(unsigned long handle, u64 gfn) | |||
1134 | 1156 | ||
1135 | idx = srcu_read_lock(&kvm->srcu); | 1157 | idx = srcu_read_lock(&kvm->srcu); |
1136 | slot = gfn_to_memslot(kvm, gfn); | 1158 | slot = gfn_to_memslot(kvm, gfn); |
1159 | if (!slot) { | ||
1160 | srcu_read_unlock(&kvm->srcu, idx); | ||
1161 | return -EINVAL; | ||
1162 | } | ||
1137 | 1163 | ||
1138 | spin_lock(&kvm->mmu_lock); | 1164 | spin_lock(&kvm->mmu_lock); |
1139 | 1165 | ||
@@ -1164,6 +1190,10 @@ static int kvmgt_write_protect_remove(unsigned long handle, u64 gfn) | |||
1164 | 1190 | ||
1165 | idx = srcu_read_lock(&kvm->srcu); | 1191 | idx = srcu_read_lock(&kvm->srcu); |
1166 | slot = gfn_to_memslot(kvm, gfn); | 1192 | slot = gfn_to_memslot(kvm, gfn); |
1193 | if (!slot) { | ||
1194 | srcu_read_unlock(&kvm->srcu, idx); | ||
1195 | return -EINVAL; | ||
1196 | } | ||
1167 | 1197 | ||
1168 | spin_lock(&kvm->mmu_lock); | 1198 | spin_lock(&kvm->mmu_lock); |
1169 | 1199 | ||
@@ -1311,18 +1341,14 @@ static int kvmgt_guest_init(struct mdev_device *mdev) | |||
1311 | 1341 | ||
1312 | static bool kvmgt_guest_exit(struct kvmgt_guest_info *info) | 1342 | static bool kvmgt_guest_exit(struct kvmgt_guest_info *info) |
1313 | { | 1343 | { |
1314 | struct intel_vgpu *vgpu; | ||
1315 | |||
1316 | if (!info) { | 1344 | if (!info) { |
1317 | gvt_err("kvmgt_guest_info invalid\n"); | 1345 | gvt_err("kvmgt_guest_info invalid\n"); |
1318 | return false; | 1346 | return false; |
1319 | } | 1347 | } |
1320 | 1348 | ||
1321 | vgpu = info->vgpu; | ||
1322 | |||
1323 | kvm_page_track_unregister_notifier(info->kvm, &info->track_node); | 1349 | kvm_page_track_unregister_notifier(info->kvm, &info->track_node); |
1324 | kvmgt_protect_table_destroy(info); | 1350 | kvmgt_protect_table_destroy(info); |
1325 | gvt_cache_destroy(vgpu); | 1351 | gvt_cache_destroy(info->vgpu); |
1326 | vfree(info); | 1352 | vfree(info); |
1327 | 1353 | ||
1328 | return true; | 1354 | return true; |
@@ -1372,7 +1398,7 @@ static unsigned long kvmgt_gfn_to_pfn(unsigned long handle, unsigned long gfn) | |||
1372 | return pfn; | 1398 | return pfn; |
1373 | 1399 | ||
1374 | pfn = INTEL_GVT_INVALID_ADDR; | 1400 | pfn = INTEL_GVT_INVALID_ADDR; |
1375 | dev = &info->vgpu->vdev.mdev->dev; | 1401 | dev = mdev_dev(info->vgpu->vdev.mdev); |
1376 | rc = vfio_pin_pages(dev, &gfn, 1, IOMMU_READ | IOMMU_WRITE, &pfn); | 1402 | rc = vfio_pin_pages(dev, &gfn, 1, IOMMU_READ | IOMMU_WRITE, &pfn); |
1377 | if (rc != 1) { | 1403 | if (rc != 1) { |
1378 | gvt_err("vfio_pin_pages failed for gfn 0x%lx: %d\n", gfn, rc); | 1404 | gvt_err("vfio_pin_pages failed for gfn 0x%lx: %d\n", gfn, rc); |
diff --git a/drivers/gpu/drm/i915/gvt/opregion.c b/drivers/gpu/drm/i915/gvt/opregion.c index d2a0fbc896c3..81cd921770c6 100644 --- a/drivers/gpu/drm/i915/gvt/opregion.c +++ b/drivers/gpu/drm/i915/gvt/opregion.c | |||
@@ -65,7 +65,7 @@ static int map_vgpu_opregion(struct intel_vgpu *vgpu, bool map) | |||
65 | int i, ret; | 65 | int i, ret; |
66 | 66 | ||
67 | for (i = 0; i < INTEL_GVT_OPREGION_PAGES; i++) { | 67 | for (i = 0; i < INTEL_GVT_OPREGION_PAGES; i++) { |
68 | mfn = intel_gvt_hypervisor_virt_to_mfn(vgpu_opregion(vgpu) | 68 | mfn = intel_gvt_hypervisor_virt_to_mfn(vgpu_opregion(vgpu)->va |
69 | + i * PAGE_SIZE); | 69 | + i * PAGE_SIZE); |
70 | if (mfn == INTEL_GVT_INVALID_ADDR) { | 70 | if (mfn == INTEL_GVT_INVALID_ADDR) { |
71 | gvt_err("fail to get MFN from VA\n"); | 71 | gvt_err("fail to get MFN from VA\n"); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 4a31b7a891ec..3dd7fc662859 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -244,14 +244,16 @@ err_phys: | |||
244 | 244 | ||
245 | static void | 245 | static void |
246 | __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj, | 246 | __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj, |
247 | struct sg_table *pages) | 247 | struct sg_table *pages, |
248 | bool needs_clflush) | ||
248 | { | 249 | { |
249 | GEM_BUG_ON(obj->mm.madv == __I915_MADV_PURGED); | 250 | GEM_BUG_ON(obj->mm.madv == __I915_MADV_PURGED); |
250 | 251 | ||
251 | if (obj->mm.madv == I915_MADV_DONTNEED) | 252 | if (obj->mm.madv == I915_MADV_DONTNEED) |
252 | obj->mm.dirty = false; | 253 | obj->mm.dirty = false; |
253 | 254 | ||
254 | if ((obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0 && | 255 | if (needs_clflush && |
256 | (obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0 && | ||
255 | !cpu_cache_is_coherent(obj->base.dev, obj->cache_level)) | 257 | !cpu_cache_is_coherent(obj->base.dev, obj->cache_level)) |
256 | drm_clflush_sg(pages); | 258 | drm_clflush_sg(pages); |
257 | 259 | ||
@@ -263,7 +265,7 @@ static void | |||
263 | i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, | 265 | i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, |
264 | struct sg_table *pages) | 266 | struct sg_table *pages) |
265 | { | 267 | { |
266 | __i915_gem_object_release_shmem(obj, pages); | 268 | __i915_gem_object_release_shmem(obj, pages, false); |
267 | 269 | ||
268 | if (obj->mm.dirty) { | 270 | if (obj->mm.dirty) { |
269 | struct address_space *mapping = obj->base.filp->f_mapping; | 271 | struct address_space *mapping = obj->base.filp->f_mapping; |
@@ -2231,7 +2233,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj, | |||
2231 | struct sgt_iter sgt_iter; | 2233 | struct sgt_iter sgt_iter; |
2232 | struct page *page; | 2234 | struct page *page; |
2233 | 2235 | ||
2234 | __i915_gem_object_release_shmem(obj, pages); | 2236 | __i915_gem_object_release_shmem(obj, pages, true); |
2235 | 2237 | ||
2236 | i915_gem_gtt_finish_pages(obj, pages); | 2238 | i915_gem_gtt_finish_pages(obj, pages); |
2237 | 2239 | ||
@@ -2304,15 +2306,6 @@ unlock: | |||
2304 | mutex_unlock(&obj->mm.lock); | 2306 | mutex_unlock(&obj->mm.lock); |
2305 | } | 2307 | } |
2306 | 2308 | ||
2307 | static unsigned int swiotlb_max_size(void) | ||
2308 | { | ||
2309 | #if IS_ENABLED(CONFIG_SWIOTLB) | ||
2310 | return rounddown(swiotlb_nr_tbl() << IO_TLB_SHIFT, PAGE_SIZE); | ||
2311 | #else | ||
2312 | return 0; | ||
2313 | #endif | ||
2314 | } | ||
2315 | |||
2316 | static void i915_sg_trim(struct sg_table *orig_st) | 2309 | static void i915_sg_trim(struct sg_table *orig_st) |
2317 | { | 2310 | { |
2318 | struct sg_table new_st; | 2311 | struct sg_table new_st; |
@@ -2322,7 +2315,7 @@ static void i915_sg_trim(struct sg_table *orig_st) | |||
2322 | if (orig_st->nents == orig_st->orig_nents) | 2315 | if (orig_st->nents == orig_st->orig_nents) |
2323 | return; | 2316 | return; |
2324 | 2317 | ||
2325 | if (sg_alloc_table(&new_st, orig_st->nents, GFP_KERNEL)) | 2318 | if (sg_alloc_table(&new_st, orig_st->nents, GFP_KERNEL | __GFP_NOWARN)) |
2326 | return; | 2319 | return; |
2327 | 2320 | ||
2328 | new_sg = new_st.sgl; | 2321 | new_sg = new_st.sgl; |
@@ -2360,7 +2353,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) | |||
2360 | GEM_BUG_ON(obj->base.read_domains & I915_GEM_GPU_DOMAINS); | 2353 | GEM_BUG_ON(obj->base.read_domains & I915_GEM_GPU_DOMAINS); |
2361 | GEM_BUG_ON(obj->base.write_domain & I915_GEM_GPU_DOMAINS); | 2354 | GEM_BUG_ON(obj->base.write_domain & I915_GEM_GPU_DOMAINS); |
2362 | 2355 | ||
2363 | max_segment = swiotlb_max_size(); | 2356 | max_segment = swiotlb_max_segment(); |
2364 | if (!max_segment) | 2357 | if (!max_segment) |
2365 | max_segment = rounddown(UINT_MAX, PAGE_SIZE); | 2358 | max_segment = rounddown(UINT_MAX, PAGE_SIZE); |
2366 | 2359 | ||
@@ -2728,6 +2721,7 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine) | |||
2728 | struct drm_i915_gem_request *request; | 2721 | struct drm_i915_gem_request *request; |
2729 | struct i915_gem_context *incomplete_ctx; | 2722 | struct i915_gem_context *incomplete_ctx; |
2730 | struct intel_timeline *timeline; | 2723 | struct intel_timeline *timeline; |
2724 | unsigned long flags; | ||
2731 | bool ring_hung; | 2725 | bool ring_hung; |
2732 | 2726 | ||
2733 | if (engine->irq_seqno_barrier) | 2727 | if (engine->irq_seqno_barrier) |
@@ -2763,13 +2757,20 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine) | |||
2763 | if (i915_gem_context_is_default(incomplete_ctx)) | 2757 | if (i915_gem_context_is_default(incomplete_ctx)) |
2764 | return; | 2758 | return; |
2765 | 2759 | ||
2760 | timeline = i915_gem_context_lookup_timeline(incomplete_ctx, engine); | ||
2761 | |||
2762 | spin_lock_irqsave(&engine->timeline->lock, flags); | ||
2763 | spin_lock(&timeline->lock); | ||
2764 | |||
2766 | list_for_each_entry_continue(request, &engine->timeline->requests, link) | 2765 | list_for_each_entry_continue(request, &engine->timeline->requests, link) |
2767 | if (request->ctx == incomplete_ctx) | 2766 | if (request->ctx == incomplete_ctx) |
2768 | reset_request(request); | 2767 | reset_request(request); |
2769 | 2768 | ||
2770 | timeline = i915_gem_context_lookup_timeline(incomplete_ctx, engine); | ||
2771 | list_for_each_entry(request, &timeline->requests, link) | 2769 | list_for_each_entry(request, &timeline->requests, link) |
2772 | reset_request(request); | 2770 | reset_request(request); |
2771 | |||
2772 | spin_unlock(&timeline->lock); | ||
2773 | spin_unlock_irqrestore(&engine->timeline->lock, flags); | ||
2773 | } | 2774 | } |
2774 | 2775 | ||
2775 | void i915_gem_reset(struct drm_i915_private *dev_priv) | 2776 | void i915_gem_reset(struct drm_i915_private *dev_priv) |
diff --git a/drivers/gpu/drm/i915/i915_gem_request.h b/drivers/gpu/drm/i915/i915_gem_request.h index e2b077df2da0..d229f47d1028 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.h +++ b/drivers/gpu/drm/i915/i915_gem_request.h | |||
@@ -413,6 +413,25 @@ i915_gem_active_set(struct i915_gem_active *active, | |||
413 | rcu_assign_pointer(active->request, request); | 413 | rcu_assign_pointer(active->request, request); |
414 | } | 414 | } |
415 | 415 | ||
416 | /** | ||
417 | * i915_gem_active_set_retire_fn - updates the retirement callback | ||
418 | * @active - the active tracker | ||
419 | * @fn - the routine called when the request is retired | ||
420 | * @mutex - struct_mutex used to guard retirements | ||
421 | * | ||
422 | * i915_gem_active_set_retire_fn() updates the function pointer that | ||
423 | * is called when the final request associated with the @active tracker | ||
424 | * is retired. | ||
425 | */ | ||
426 | static inline void | ||
427 | i915_gem_active_set_retire_fn(struct i915_gem_active *active, | ||
428 | i915_gem_retire_fn fn, | ||
429 | struct mutex *mutex) | ||
430 | { | ||
431 | lockdep_assert_held(mutex); | ||
432 | active->retire = fn ?: i915_gem_retire_noop; | ||
433 | } | ||
434 | |||
416 | static inline struct drm_i915_gem_request * | 435 | static inline struct drm_i915_gem_request * |
417 | __i915_gem_active_peek(const struct i915_gem_active *active) | 436 | __i915_gem_active_peek(const struct i915_gem_active *active) |
418 | { | 437 | { |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 6daad8613760..3dc8724df400 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -16791,7 +16791,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
16791 | 16791 | ||
16792 | for_each_intel_crtc(dev, crtc) { | 16792 | for_each_intel_crtc(dev, crtc) { |
16793 | struct intel_crtc_state *crtc_state = crtc->config; | 16793 | struct intel_crtc_state *crtc_state = crtc->config; |
16794 | int pixclk = 0; | ||
16795 | 16794 | ||
16796 | __drm_atomic_helper_crtc_destroy_state(&crtc_state->base); | 16795 | __drm_atomic_helper_crtc_destroy_state(&crtc_state->base); |
16797 | memset(crtc_state, 0, sizeof(*crtc_state)); | 16796 | memset(crtc_state, 0, sizeof(*crtc_state)); |
@@ -16803,23 +16802,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
16803 | crtc->base.enabled = crtc_state->base.enable; | 16802 | crtc->base.enabled = crtc_state->base.enable; |
16804 | crtc->active = crtc_state->base.active; | 16803 | crtc->active = crtc_state->base.active; |
16805 | 16804 | ||
16806 | if (crtc_state->base.active) { | 16805 | if (crtc_state->base.active) |
16807 | dev_priv->active_crtcs |= 1 << crtc->pipe; | 16806 | dev_priv->active_crtcs |= 1 << crtc->pipe; |
16808 | 16807 | ||
16809 | if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv)) | ||
16810 | pixclk = ilk_pipe_pixel_rate(crtc_state); | ||
16811 | else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) | ||
16812 | pixclk = crtc_state->base.adjusted_mode.crtc_clock; | ||
16813 | else | ||
16814 | WARN_ON(dev_priv->display.modeset_calc_cdclk); | ||
16815 | |||
16816 | /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ | ||
16817 | if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled) | ||
16818 | pixclk = DIV_ROUND_UP(pixclk * 100, 95); | ||
16819 | } | ||
16820 | |||
16821 | dev_priv->min_pixclk[crtc->pipe] = pixclk; | ||
16822 | |||
16823 | readout_plane_state(crtc); | 16808 | readout_plane_state(crtc); |
16824 | 16809 | ||
16825 | DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n", | 16810 | DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n", |
@@ -16892,6 +16877,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
16892 | } | 16877 | } |
16893 | 16878 | ||
16894 | for_each_intel_crtc(dev, crtc) { | 16879 | for_each_intel_crtc(dev, crtc) { |
16880 | int pixclk = 0; | ||
16881 | |||
16895 | crtc->base.hwmode = crtc->config->base.adjusted_mode; | 16882 | crtc->base.hwmode = crtc->config->base.adjusted_mode; |
16896 | 16883 | ||
16897 | memset(&crtc->base.mode, 0, sizeof(crtc->base.mode)); | 16884 | memset(&crtc->base.mode, 0, sizeof(crtc->base.mode)); |
@@ -16919,10 +16906,23 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
16919 | */ | 16906 | */ |
16920 | crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED; | 16907 | crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED; |
16921 | 16908 | ||
16909 | if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv)) | ||
16910 | pixclk = ilk_pipe_pixel_rate(crtc->config); | ||
16911 | else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) | ||
16912 | pixclk = crtc->config->base.adjusted_mode.crtc_clock; | ||
16913 | else | ||
16914 | WARN_ON(dev_priv->display.modeset_calc_cdclk); | ||
16915 | |||
16916 | /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ | ||
16917 | if (IS_BROADWELL(dev_priv) && crtc->config->ips_enabled) | ||
16918 | pixclk = DIV_ROUND_UP(pixclk * 100, 95); | ||
16919 | |||
16922 | drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode); | 16920 | drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode); |
16923 | update_scanline_offset(crtc); | 16921 | update_scanline_offset(crtc); |
16924 | } | 16922 | } |
16925 | 16923 | ||
16924 | dev_priv->min_pixclk[crtc->pipe] = pixclk; | ||
16925 | |||
16926 | intel_pipe_config_sanity_check(dev_priv, crtc->config); | 16926 | intel_pipe_config_sanity_check(dev_priv, crtc->config); |
16927 | } | 16927 | } |
16928 | } | 16928 | } |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index d9bc19be855e..0b8e8eb85c19 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -355,7 +355,8 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev, | |||
355 | struct intel_dp *intel_dp); | 355 | struct intel_dp *intel_dp); |
356 | static void | 356 | static void |
357 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | 357 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, |
358 | struct intel_dp *intel_dp); | 358 | struct intel_dp *intel_dp, |
359 | bool force_disable_vdd); | ||
359 | static void | 360 | static void |
360 | intel_dp_pps_init(struct drm_device *dev, struct intel_dp *intel_dp); | 361 | intel_dp_pps_init(struct drm_device *dev, struct intel_dp *intel_dp); |
361 | 362 | ||
@@ -516,7 +517,7 @@ vlv_power_sequencer_pipe(struct intel_dp *intel_dp) | |||
516 | 517 | ||
517 | /* init power sequencer on this pipe and port */ | 518 | /* init power sequencer on this pipe and port */ |
518 | intel_dp_init_panel_power_sequencer(dev, intel_dp); | 519 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
519 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); | 520 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, true); |
520 | 521 | ||
521 | /* | 522 | /* |
522 | * Even vdd force doesn't work until we've made | 523 | * Even vdd force doesn't work until we've made |
@@ -553,7 +554,7 @@ bxt_power_sequencer_idx(struct intel_dp *intel_dp) | |||
553 | * Only the HW needs to be reprogrammed, the SW state is fixed and | 554 | * Only the HW needs to be reprogrammed, the SW state is fixed and |
554 | * has been setup during connector init. | 555 | * has been setup during connector init. |
555 | */ | 556 | */ |
556 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); | 557 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, false); |
557 | 558 | ||
558 | return 0; | 559 | return 0; |
559 | } | 560 | } |
@@ -636,7 +637,7 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp) | |||
636 | port_name(port), pipe_name(intel_dp->pps_pipe)); | 637 | port_name(port), pipe_name(intel_dp->pps_pipe)); |
637 | 638 | ||
638 | intel_dp_init_panel_power_sequencer(dev, intel_dp); | 639 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
639 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); | 640 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, false); |
640 | } | 641 | } |
641 | 642 | ||
642 | void intel_power_sequencer_reset(struct drm_i915_private *dev_priv) | 643 | void intel_power_sequencer_reset(struct drm_i915_private *dev_priv) |
@@ -2912,7 +2913,7 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp) | |||
2912 | 2913 | ||
2913 | /* init power sequencer on this pipe and port */ | 2914 | /* init power sequencer on this pipe and port */ |
2914 | intel_dp_init_panel_power_sequencer(dev, intel_dp); | 2915 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
2915 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); | 2916 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, true); |
2916 | } | 2917 | } |
2917 | 2918 | ||
2918 | static void vlv_pre_enable_dp(struct intel_encoder *encoder, | 2919 | static void vlv_pre_enable_dp(struct intel_encoder *encoder, |
@@ -5055,7 +5056,8 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev, | |||
5055 | 5056 | ||
5056 | static void | 5057 | static void |
5057 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | 5058 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, |
5058 | struct intel_dp *intel_dp) | 5059 | struct intel_dp *intel_dp, |
5060 | bool force_disable_vdd) | ||
5059 | { | 5061 | { |
5060 | struct drm_i915_private *dev_priv = to_i915(dev); | 5062 | struct drm_i915_private *dev_priv = to_i915(dev); |
5061 | u32 pp_on, pp_off, pp_div, port_sel = 0; | 5063 | u32 pp_on, pp_off, pp_div, port_sel = 0; |
@@ -5068,6 +5070,31 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | |||
5068 | 5070 | ||
5069 | intel_pps_get_registers(dev_priv, intel_dp, ®s); | 5071 | intel_pps_get_registers(dev_priv, intel_dp, ®s); |
5070 | 5072 | ||
5073 | /* | ||
5074 | * On some VLV machines the BIOS can leave the VDD | ||
5075 | * enabled even on power seqeuencers which aren't | ||
5076 | * hooked up to any port. This would mess up the | ||
5077 | * power domain tracking the first time we pick | ||
5078 | * one of these power sequencers for use since | ||
5079 | * edp_panel_vdd_on() would notice that the VDD was | ||
5080 | * already on and therefore wouldn't grab the power | ||
5081 | * domain reference. Disable VDD first to avoid this. | ||
5082 | * This also avoids spuriously turning the VDD on as | ||
5083 | * soon as the new power seqeuencer gets initialized. | ||
5084 | */ | ||
5085 | if (force_disable_vdd) { | ||
5086 | u32 pp = ironlake_get_pp_control(intel_dp); | ||
5087 | |||
5088 | WARN(pp & PANEL_POWER_ON, "Panel power already on\n"); | ||
5089 | |||
5090 | if (pp & EDP_FORCE_VDD) | ||
5091 | DRM_DEBUG_KMS("VDD already on, disabling first\n"); | ||
5092 | |||
5093 | pp &= ~EDP_FORCE_VDD; | ||
5094 | |||
5095 | I915_WRITE(regs.pp_ctrl, pp); | ||
5096 | } | ||
5097 | |||
5071 | pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) | | 5098 | pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) | |
5072 | (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT); | 5099 | (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT); |
5073 | pp_off = (seq->t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) | | 5100 | pp_off = (seq->t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) | |
@@ -5122,7 +5149,7 @@ static void intel_dp_pps_init(struct drm_device *dev, | |||
5122 | vlv_initial_power_sequencer_setup(intel_dp); | 5149 | vlv_initial_power_sequencer_setup(intel_dp); |
5123 | } else { | 5150 | } else { |
5124 | intel_dp_init_panel_power_sequencer(dev, intel_dp); | 5151 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
5125 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); | 5152 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, false); |
5126 | } | 5153 | } |
5127 | } | 5154 | } |
5128 | 5155 | ||
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index fd0e4dac7cc1..e589e17876dc 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -216,7 +216,8 @@ static void intel_overlay_submit_request(struct intel_overlay *overlay, | |||
216 | { | 216 | { |
217 | GEM_BUG_ON(i915_gem_active_peek(&overlay->last_flip, | 217 | GEM_BUG_ON(i915_gem_active_peek(&overlay->last_flip, |
218 | &overlay->i915->drm.struct_mutex)); | 218 | &overlay->i915->drm.struct_mutex)); |
219 | overlay->last_flip.retire = retire; | 219 | i915_gem_active_set_retire_fn(&overlay->last_flip, retire, |
220 | &overlay->i915->drm.struct_mutex); | ||
220 | i915_gem_active_set(&overlay->last_flip, req); | 221 | i915_gem_active_set(&overlay->last_flip, req); |
221 | i915_add_request(req); | 222 | i915_add_request(req); |
222 | } | 223 | } |
@@ -839,8 +840,8 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, | |||
839 | if (ret) | 840 | if (ret) |
840 | goto out_unpin; | 841 | goto out_unpin; |
841 | 842 | ||
842 | i915_gem_track_fb(overlay->vma->obj, new_bo, | 843 | i915_gem_track_fb(overlay->vma ? overlay->vma->obj : NULL, |
843 | INTEL_FRONTBUFFER_OVERLAY(pipe)); | 844 | vma->obj, INTEL_FRONTBUFFER_OVERLAY(pipe)); |
844 | 845 | ||
845 | overlay->old_vma = overlay->vma; | 846 | overlay->old_vma = overlay->vma; |
846 | overlay->vma = vma; | 847 | overlay->vma = vma; |
@@ -1430,6 +1431,8 @@ void intel_setup_overlay(struct drm_i915_private *dev_priv) | |||
1430 | overlay->contrast = 75; | 1431 | overlay->contrast = 75; |
1431 | overlay->saturation = 146; | 1432 | overlay->saturation = 146; |
1432 | 1433 | ||
1434 | init_request_active(&overlay->last_flip, NULL); | ||
1435 | |||
1433 | regs = intel_overlay_map_regs(overlay); | 1436 | regs = intel_overlay_map_regs(overlay); |
1434 | if (!regs) | 1437 | if (!regs) |
1435 | goto out_unpin_bo; | 1438 | goto out_unpin_bo; |
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index d40ed9fdf68d..70b12f89a193 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c | |||
@@ -64,7 +64,8 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); | |||
64 | #define QUIRK_SKIP_INPUT_MAPPING BIT(2) | 64 | #define QUIRK_SKIP_INPUT_MAPPING BIT(2) |
65 | #define QUIRK_IS_MULTITOUCH BIT(3) | 65 | #define QUIRK_IS_MULTITOUCH BIT(3) |
66 | 66 | ||
67 | #define NOTEBOOK_QUIRKS QUIRK_FIX_NOTEBOOK_REPORT | 67 | #define KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ |
68 | QUIRK_NO_INIT_REPORTS) | ||
68 | #define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ | 69 | #define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ |
69 | QUIRK_SKIP_INPUT_MAPPING | \ | 70 | QUIRK_SKIP_INPUT_MAPPING | \ |
70 | QUIRK_IS_MULTITOUCH) | 71 | QUIRK_IS_MULTITOUCH) |
@@ -170,11 +171,11 @@ static int asus_raw_event(struct hid_device *hdev, | |||
170 | 171 | ||
171 | static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) | 172 | static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) |
172 | { | 173 | { |
174 | struct input_dev *input = hi->input; | ||
173 | struct asus_drvdata *drvdata = hid_get_drvdata(hdev); | 175 | struct asus_drvdata *drvdata = hid_get_drvdata(hdev); |
174 | 176 | ||
175 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { | 177 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { |
176 | int ret; | 178 | int ret; |
177 | struct input_dev *input = hi->input; | ||
178 | 179 | ||
179 | input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0); | 180 | input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0); |
180 | input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); | 181 | input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); |
@@ -191,10 +192,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) | |||
191 | hid_err(hdev, "Asus input mt init slots failed: %d\n", ret); | 192 | hid_err(hdev, "Asus input mt init slots failed: %d\n", ret); |
192 | return ret; | 193 | return ret; |
193 | } | 194 | } |
194 | |||
195 | drvdata->input = input; | ||
196 | } | 195 | } |
197 | 196 | ||
197 | drvdata->input = input; | ||
198 | |||
198 | return 0; | 199 | return 0; |
199 | } | 200 | } |
200 | 201 | ||
@@ -286,7 +287,11 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
286 | goto err_stop_hw; | 287 | goto err_stop_hw; |
287 | } | 288 | } |
288 | 289 | ||
289 | drvdata->input->name = "Asus TouchPad"; | 290 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { |
291 | drvdata->input->name = "Asus TouchPad"; | ||
292 | } else { | ||
293 | drvdata->input->name = "Asus Keyboard"; | ||
294 | } | ||
290 | 295 | ||
291 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { | 296 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { |
292 | ret = asus_start_multitouch(hdev); | 297 | ret = asus_start_multitouch(hdev); |
@@ -315,7 +320,7 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
315 | 320 | ||
316 | static const struct hid_device_id asus_devices[] = { | 321 | static const struct hid_device_id asus_devices[] = { |
317 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, | 322 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, |
318 | USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), NOTEBOOK_QUIRKS}, | 323 | USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS}, |
319 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, | 324 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, |
320 | USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS }, | 325 | USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS }, |
321 | { } | 326 | { } |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index ec277b96eaa1..54bd22dc1411 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -319,6 +319,7 @@ | |||
319 | #define USB_VENDOR_ID_DRAGONRISE 0x0079 | 319 | #define USB_VENDOR_ID_DRAGONRISE 0x0079 |
320 | #define USB_DEVICE_ID_DRAGONRISE_WIIU 0x1800 | 320 | #define USB_DEVICE_ID_DRAGONRISE_WIIU 0x1800 |
321 | #define USB_DEVICE_ID_DRAGONRISE_PS3 0x1801 | 321 | #define USB_DEVICE_ID_DRAGONRISE_PS3 0x1801 |
322 | #define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR 0x1803 | ||
322 | #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE 0x1843 | 323 | #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE 0x1843 |
323 | 324 | ||
324 | #define USB_VENDOR_ID_DWAV 0x0eef | 325 | #define USB_VENDOR_ID_DWAV 0x0eef |
@@ -365,6 +366,9 @@ | |||
365 | #define USB_VENDOR_ID_FLATFROG 0x25b5 | 366 | #define USB_VENDOR_ID_FLATFROG 0x25b5 |
366 | #define USB_DEVICE_ID_MULTITOUCH_3200 0x0002 | 367 | #define USB_DEVICE_ID_MULTITOUCH_3200 0x0002 |
367 | 368 | ||
369 | #define USB_VENDOR_ID_FUTABA 0x0547 | ||
370 | #define USB_DEVICE_ID_LED_DISPLAY 0x7000 | ||
371 | |||
368 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f | 372 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f |
369 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 | 373 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 |
370 | 374 | ||
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 5c925228847c..4ef73374a8f9 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -212,7 +212,6 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, | |||
212 | __s32 value; | 212 | __s32 value; |
213 | int ret = 0; | 213 | int ret = 0; |
214 | 214 | ||
215 | memset(buffer, 0, buffer_size); | ||
216 | mutex_lock(&data->mutex); | 215 | mutex_lock(&data->mutex); |
217 | report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); | 216 | report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); |
218 | if (!report || (field_index >= report->maxfield)) { | 217 | if (!report || (field_index >= report->maxfield)) { |
@@ -256,6 +255,8 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, | |||
256 | int buffer_index = 0; | 255 | int buffer_index = 0; |
257 | int i; | 256 | int i; |
258 | 257 | ||
258 | memset(buffer, 0, buffer_size); | ||
259 | |||
259 | mutex_lock(&data->mutex); | 260 | mutex_lock(&data->mutex); |
260 | report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); | 261 | report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); |
261 | if (!report || (field_index >= report->maxfield) || | 262 | if (!report || (field_index >= report->maxfield) || |
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 7687c0875395..f405b07d0381 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -1099,8 +1099,11 @@ struct sony_sc { | |||
1099 | u8 led_delay_on[MAX_LEDS]; | 1099 | u8 led_delay_on[MAX_LEDS]; |
1100 | u8 led_delay_off[MAX_LEDS]; | 1100 | u8 led_delay_off[MAX_LEDS]; |
1101 | u8 led_count; | 1101 | u8 led_count; |
1102 | bool ds4_dongle_connected; | ||
1102 | }; | 1103 | }; |
1103 | 1104 | ||
1105 | static void sony_set_leds(struct sony_sc *sc); | ||
1106 | |||
1104 | static inline void sony_schedule_work(struct sony_sc *sc) | 1107 | static inline void sony_schedule_work(struct sony_sc *sc) |
1105 | { | 1108 | { |
1106 | if (!sc->defer_initialization) | 1109 | if (!sc->defer_initialization) |
@@ -1430,6 +1433,31 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report, | |||
1430 | return -EILSEQ; | 1433 | return -EILSEQ; |
1431 | } | 1434 | } |
1432 | } | 1435 | } |
1436 | |||
1437 | /* | ||
1438 | * In the case of a DS4 USB dongle, bit[2] of byte 31 indicates | ||
1439 | * if a DS4 is actually connected (indicated by '0'). | ||
1440 | * For non-dongle, this bit is always 0 (connected). | ||
1441 | */ | ||
1442 | if (sc->hdev->vendor == USB_VENDOR_ID_SONY && | ||
1443 | sc->hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE) { | ||
1444 | bool connected = (rd[31] & 0x04) ? false : true; | ||
1445 | |||
1446 | if (!sc->ds4_dongle_connected && connected) { | ||
1447 | hid_info(sc->hdev, "DualShock 4 USB dongle: controller connected\n"); | ||
1448 | sony_set_leds(sc); | ||
1449 | sc->ds4_dongle_connected = true; | ||
1450 | } else if (sc->ds4_dongle_connected && !connected) { | ||
1451 | hid_info(sc->hdev, "DualShock 4 USB dongle: controller disconnected\n"); | ||
1452 | sc->ds4_dongle_connected = false; | ||
1453 | /* Return 0, so hidraw can get the report. */ | ||
1454 | return 0; | ||
1455 | } else if (!sc->ds4_dongle_connected) { | ||
1456 | /* Return 0, so hidraw can get the report. */ | ||
1457 | return 0; | ||
1458 | } | ||
1459 | } | ||
1460 | |||
1433 | dualshock4_parse_report(sc, rd, size); | 1461 | dualshock4_parse_report(sc, rd, size); |
1434 | } | 1462 | } |
1435 | 1463 | ||
@@ -2390,6 +2418,12 @@ static int sony_check_add(struct sony_sc *sc) | |||
2390 | } | 2418 | } |
2391 | 2419 | ||
2392 | memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); | 2420 | memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); |
2421 | |||
2422 | snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq), | ||
2423 | "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", | ||
2424 | sc->mac_address[5], sc->mac_address[4], | ||
2425 | sc->mac_address[3], sc->mac_address[2], | ||
2426 | sc->mac_address[1], sc->mac_address[0]); | ||
2393 | } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || | 2427 | } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || |
2394 | (sc->quirks & NAVIGATION_CONTROLLER_USB)) { | 2428 | (sc->quirks & NAVIGATION_CONTROLLER_USB)) { |
2395 | buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL); | 2429 | buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL); |
@@ -2548,7 +2582,7 @@ static int sony_input_configured(struct hid_device *hdev, | |||
2548 | hid_err(sc->hdev, | 2582 | hid_err(sc->hdev, |
2549 | "Unable to initialize multi-touch slots: %d\n", | 2583 | "Unable to initialize multi-touch slots: %d\n", |
2550 | ret); | 2584 | ret); |
2551 | return ret; | 2585 | goto err_stop; |
2552 | } | 2586 | } |
2553 | 2587 | ||
2554 | sony_init_output_report(sc, dualshock4_send_output_report); | 2588 | sony_init_output_report(sc, dualshock4_send_output_report); |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index b3e01c82af05..e9d6cc7cdfc5 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -83,11 +83,13 @@ static const struct hid_blacklist { | |||
83 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 83 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
84 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, | 84 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, |
85 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT }, | 85 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT }, |
86 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR, HID_QUIRK_MULTI_INPUT }, | ||
86 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE, HID_QUIRK_MULTI_INPUT }, | 87 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE, HID_QUIRK_MULTI_INPUT }, |
87 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, | 88 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, |
88 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 89 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
89 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 90 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
90 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 91 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
92 | { USB_VENDOR_ID_FUTABA, USB_DEVICE_ID_LED_DISPLAY, HID_QUIRK_NO_INIT_REPORTS }, | ||
91 | { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL }, | 93 | { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL }, |
92 | { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL }, | 94 | { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL }, |
93 | { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, | 95 | { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 322ed9272811..841f2428e84a 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -1036,7 +1036,7 @@ static const u8 lm90_temp_emerg_index[3] = { | |||
1036 | }; | 1036 | }; |
1037 | 1037 | ||
1038 | static const u8 lm90_min_alarm_bits[3] = { 5, 3, 11 }; | 1038 | static const u8 lm90_min_alarm_bits[3] = { 5, 3, 11 }; |
1039 | static const u8 lm90_max_alarm_bits[3] = { 0, 4, 12 }; | 1039 | static const u8 lm90_max_alarm_bits[3] = { 6, 4, 12 }; |
1040 | static const u8 lm90_crit_alarm_bits[3] = { 0, 1, 9 }; | 1040 | static const u8 lm90_crit_alarm_bits[3] = { 0, 1, 9 }; |
1041 | static const u8 lm90_emergency_alarm_bits[3] = { 15, 13, 14 }; | 1041 | static const u8 lm90_emergency_alarm_bits[3] = { 15, 13, 14 }; |
1042 | static const u8 lm90_fault_bits[3] = { 0, 2, 10 }; | 1042 | static const u8 lm90_fault_bits[3] = { 0, 2, 10 }; |
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index f6b6d42385e1..784670e2736b 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c | |||
@@ -353,12 +353,12 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { | |||
353 | [0] = { | 353 | [0] = { |
354 | .num = ST_ACCEL_FS_AVL_2G, | 354 | .num = ST_ACCEL_FS_AVL_2G, |
355 | .value = 0x00, | 355 | .value = 0x00, |
356 | .gain = IIO_G_TO_M_S_2(1024), | 356 | .gain = IIO_G_TO_M_S_2(1000), |
357 | }, | 357 | }, |
358 | [1] = { | 358 | [1] = { |
359 | .num = ST_ACCEL_FS_AVL_6G, | 359 | .num = ST_ACCEL_FS_AVL_6G, |
360 | .value = 0x01, | 360 | .value = 0x01, |
361 | .gain = IIO_G_TO_M_S_2(340), | 361 | .gain = IIO_G_TO_M_S_2(3000), |
362 | }, | 362 | }, |
363 | }, | 363 | }, |
364 | }, | 364 | }, |
@@ -366,6 +366,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { | |||
366 | .addr = 0x21, | 366 | .addr = 0x21, |
367 | .mask = 0x40, | 367 | .mask = 0x40, |
368 | }, | 368 | }, |
369 | /* | ||
370 | * Data Alignment Setting - needs to be set to get | ||
371 | * left-justified data like all other sensors. | ||
372 | */ | ||
373 | .das = { | ||
374 | .addr = 0x21, | ||
375 | .mask = 0x01, | ||
376 | }, | ||
369 | .drdy_irq = { | 377 | .drdy_irq = { |
370 | .addr = 0x21, | 378 | .addr = 0x21, |
371 | .mask_int1 = 0x04, | 379 | .mask_int1 = 0x04, |
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 38bc319904c4..9c8b558ba19e 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig | |||
@@ -561,7 +561,7 @@ config TI_ADS8688 | |||
561 | 561 | ||
562 | config TI_AM335X_ADC | 562 | config TI_AM335X_ADC |
563 | tristate "TI's AM335X ADC driver" | 563 | tristate "TI's AM335X ADC driver" |
564 | depends on MFD_TI_AM335X_TSCADC | 564 | depends on MFD_TI_AM335X_TSCADC && HAS_DMA |
565 | select IIO_BUFFER | 565 | select IIO_BUFFER |
566 | select IIO_KFIFO_BUF | 566 | select IIO_KFIFO_BUF |
567 | help | 567 | help |
diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c index fe7775bb3740..df4045203a07 100644 --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c | |||
@@ -30,7 +30,9 @@ static int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf) | |||
30 | 30 | ||
31 | for_each_set_bit(i, indio_dev->active_scan_mask, num_data_channels) { | 31 | for_each_set_bit(i, indio_dev->active_scan_mask, num_data_channels) { |
32 | const struct iio_chan_spec *channel = &indio_dev->channels[i]; | 32 | const struct iio_chan_spec *channel = &indio_dev->channels[i]; |
33 | unsigned int bytes_to_read = channel->scan_type.realbits >> 3; | 33 | unsigned int bytes_to_read = |
34 | DIV_ROUND_UP(channel->scan_type.realbits + | ||
35 | channel->scan_type.shift, 8); | ||
34 | unsigned int storage_bytes = | 36 | unsigned int storage_bytes = |
35 | channel->scan_type.storagebits >> 3; | 37 | channel->scan_type.storagebits >> 3; |
36 | 38 | ||
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 975a1f19f747..79c8c7cd70d5 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
@@ -401,6 +401,15 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, | |||
401 | return err; | 401 | return err; |
402 | } | 402 | } |
403 | 403 | ||
404 | /* set DAS */ | ||
405 | if (sdata->sensor_settings->das.addr) { | ||
406 | err = st_sensors_write_data_with_mask(indio_dev, | ||
407 | sdata->sensor_settings->das.addr, | ||
408 | sdata->sensor_settings->das.mask, 1); | ||
409 | if (err < 0) | ||
410 | return err; | ||
411 | } | ||
412 | |||
404 | if (sdata->int_pin_open_drain) { | 413 | if (sdata->int_pin_open_drain) { |
405 | dev_info(&indio_dev->dev, | 414 | dev_info(&indio_dev->dev, |
406 | "set interrupt line to open drain mode\n"); | 415 | "set interrupt line to open drain mode\n"); |
@@ -483,8 +492,10 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev, | |||
483 | int err; | 492 | int err; |
484 | u8 *outdata; | 493 | u8 *outdata; |
485 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 494 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
486 | unsigned int byte_for_channel = ch->scan_type.realbits >> 3; | 495 | unsigned int byte_for_channel; |
487 | 496 | ||
497 | byte_for_channel = DIV_ROUND_UP(ch->scan_type.realbits + | ||
498 | ch->scan_type.shift, 8); | ||
488 | outdata = kmalloc(byte_for_channel, GFP_KERNEL); | 499 | outdata = kmalloc(byte_for_channel, GFP_KERNEL); |
489 | if (!outdata) | 500 | if (!outdata) |
490 | return -ENOMEM; | 501 | return -ENOMEM; |
diff --git a/drivers/iio/counter/104-quad-8.c b/drivers/iio/counter/104-quad-8.c index 2d2ee353dde7..a5913e97945e 100644 --- a/drivers/iio/counter/104-quad-8.c +++ b/drivers/iio/counter/104-quad-8.c | |||
@@ -153,7 +153,7 @@ static int quad8_write_raw(struct iio_dev *indio_dev, | |||
153 | ior_cfg = val | priv->preset_enable[chan->channel] << 1; | 153 | ior_cfg = val | priv->preset_enable[chan->channel] << 1; |
154 | 154 | ||
155 | /* Load I/O control configuration */ | 155 | /* Load I/O control configuration */ |
156 | outb(0x40 | ior_cfg, base_offset); | 156 | outb(0x40 | ior_cfg, base_offset + 1); |
157 | 157 | ||
158 | return 0; | 158 | return 0; |
159 | case IIO_CHAN_INFO_SCALE: | 159 | case IIO_CHAN_INFO_SCALE: |
@@ -233,7 +233,7 @@ static ssize_t quad8_read_set_to_preset_on_index(struct iio_dev *indio_dev, | |||
233 | const struct quad8_iio *const priv = iio_priv(indio_dev); | 233 | const struct quad8_iio *const priv = iio_priv(indio_dev); |
234 | 234 | ||
235 | return snprintf(buf, PAGE_SIZE, "%u\n", | 235 | return snprintf(buf, PAGE_SIZE, "%u\n", |
236 | priv->preset_enable[chan->channel]); | 236 | !priv->preset_enable[chan->channel]); |
237 | } | 237 | } |
238 | 238 | ||
239 | static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, | 239 | static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, |
@@ -241,7 +241,7 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, | |||
241 | size_t len) | 241 | size_t len) |
242 | { | 242 | { |
243 | struct quad8_iio *const priv = iio_priv(indio_dev); | 243 | struct quad8_iio *const priv = iio_priv(indio_dev); |
244 | const int base_offset = priv->base + 2 * chan->channel; | 244 | const int base_offset = priv->base + 2 * chan->channel + 1; |
245 | bool preset_enable; | 245 | bool preset_enable; |
246 | int ret; | 246 | int ret; |
247 | unsigned int ior_cfg; | 247 | unsigned int ior_cfg; |
@@ -250,6 +250,9 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, | |||
250 | if (ret) | 250 | if (ret) |
251 | return ret; | 251 | return ret; |
252 | 252 | ||
253 | /* Preset enable is active low in Input/Output Control register */ | ||
254 | preset_enable = !preset_enable; | ||
255 | |||
253 | priv->preset_enable[chan->channel] = preset_enable; | 256 | priv->preset_enable[chan->channel] = preset_enable; |
254 | 257 | ||
255 | ior_cfg = priv->ab_enable[chan->channel] | | 258 | ior_cfg = priv->ab_enable[chan->channel] | |
@@ -362,7 +365,7 @@ static int quad8_set_synchronous_mode(struct iio_dev *indio_dev, | |||
362 | priv->synchronous_mode[chan->channel] = synchronous_mode; | 365 | priv->synchronous_mode[chan->channel] = synchronous_mode; |
363 | 366 | ||
364 | /* Load Index Control configuration to Index Control Register */ | 367 | /* Load Index Control configuration to Index Control Register */ |
365 | outb(0x40 | idr_cfg, base_offset); | 368 | outb(0x60 | idr_cfg, base_offset); |
366 | 369 | ||
367 | return 0; | 370 | return 0; |
368 | } | 371 | } |
@@ -444,7 +447,7 @@ static int quad8_set_index_polarity(struct iio_dev *indio_dev, | |||
444 | priv->index_polarity[chan->channel] = index_polarity; | 447 | priv->index_polarity[chan->channel] = index_polarity; |
445 | 448 | ||
446 | /* Load Index Control configuration to Index Control Register */ | 449 | /* Load Index Control configuration to Index Control Register */ |
447 | outb(0x40 | idr_cfg, base_offset); | 450 | outb(0x60 | idr_cfg, base_offset); |
448 | 451 | ||
449 | return 0; | 452 | return 0; |
450 | } | 453 | } |
diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c index 5355507f8fa1..c9e319bff58b 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c | |||
@@ -66,10 +66,8 @@ | |||
66 | 66 | ||
67 | #define BMI160_REG_DUMMY 0x7F | 67 | #define BMI160_REG_DUMMY 0x7F |
68 | 68 | ||
69 | #define BMI160_ACCEL_PMU_MIN_USLEEP 3200 | 69 | #define BMI160_ACCEL_PMU_MIN_USLEEP 3800 |
70 | #define BMI160_ACCEL_PMU_MAX_USLEEP 3800 | 70 | #define BMI160_GYRO_PMU_MIN_USLEEP 80000 |
71 | #define BMI160_GYRO_PMU_MIN_USLEEP 55000 | ||
72 | #define BMI160_GYRO_PMU_MAX_USLEEP 80000 | ||
73 | #define BMI160_SOFTRESET_USLEEP 1000 | 71 | #define BMI160_SOFTRESET_USLEEP 1000 |
74 | 72 | ||
75 | #define BMI160_CHANNEL(_type, _axis, _index) { \ | 73 | #define BMI160_CHANNEL(_type, _axis, _index) { \ |
@@ -151,20 +149,9 @@ static struct bmi160_regs bmi160_regs[] = { | |||
151 | }, | 149 | }, |
152 | }; | 150 | }; |
153 | 151 | ||
154 | struct bmi160_pmu_time { | 152 | static unsigned long bmi160_pmu_time[] = { |
155 | unsigned long min; | 153 | [BMI160_ACCEL] = BMI160_ACCEL_PMU_MIN_USLEEP, |
156 | unsigned long max; | 154 | [BMI160_GYRO] = BMI160_GYRO_PMU_MIN_USLEEP, |
157 | }; | ||
158 | |||
159 | static struct bmi160_pmu_time bmi160_pmu_time[] = { | ||
160 | [BMI160_ACCEL] = { | ||
161 | .min = BMI160_ACCEL_PMU_MIN_USLEEP, | ||
162 | .max = BMI160_ACCEL_PMU_MAX_USLEEP | ||
163 | }, | ||
164 | [BMI160_GYRO] = { | ||
165 | .min = BMI160_GYRO_PMU_MIN_USLEEP, | ||
166 | .max = BMI160_GYRO_PMU_MIN_USLEEP, | ||
167 | }, | ||
168 | }; | 155 | }; |
169 | 156 | ||
170 | struct bmi160_scale { | 157 | struct bmi160_scale { |
@@ -289,7 +276,7 @@ int bmi160_set_mode(struct bmi160_data *data, enum bmi160_sensor_type t, | |||
289 | if (ret < 0) | 276 | if (ret < 0) |
290 | return ret; | 277 | return ret; |
291 | 278 | ||
292 | usleep_range(bmi160_pmu_time[t].min, bmi160_pmu_time[t].max); | 279 | usleep_range(bmi160_pmu_time[t], bmi160_pmu_time[t] + 1000); |
293 | 280 | ||
294 | return 0; | 281 | return 0; |
295 | } | 282 | } |
diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c index a144ca3461fc..81bd8e8da4a6 100644 --- a/drivers/iio/light/max44000.c +++ b/drivers/iio/light/max44000.c | |||
@@ -113,7 +113,7 @@ static const char max44000_int_time_avail_str[] = | |||
113 | "0.100 " | 113 | "0.100 " |
114 | "0.025 " | 114 | "0.025 " |
115 | "0.00625 " | 115 | "0.00625 " |
116 | "0.001625"; | 116 | "0.0015625"; |
117 | 117 | ||
118 | /* Available scales (internal to ulux) with pretty manual alignment: */ | 118 | /* Available scales (internal to ulux) with pretty manual alignment: */ |
119 | static const int max44000_scale_avail_ulux_array[] = { | 119 | static const int max44000_scale_avail_ulux_array[] = { |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index c8413fc120e6..7031a8dd4d14 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1682,9 +1682,19 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att | |||
1682 | size += ret; | 1682 | size += ret; |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | if (mlx4_is_master(mdev->dev) && flow_type == MLX4_FS_REGULAR && | ||
1686 | flow_attr->num_of_specs == 1) { | ||
1687 | struct _rule_hw *rule_header = (struct _rule_hw *)(ctrl + 1); | ||
1688 | enum ib_flow_spec_type header_spec = | ||
1689 | ((union ib_flow_spec *)(flow_attr + 1))->type; | ||
1690 | |||
1691 | if (header_spec == IB_FLOW_SPEC_ETH) | ||
1692 | mlx4_handle_eth_header_mcast_prio(ctrl, rule_header); | ||
1693 | } | ||
1694 | |||
1685 | ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0, | 1695 | ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0, |
1686 | MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, | 1696 | MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, |
1687 | MLX4_CMD_WRAPPED); | 1697 | MLX4_CMD_NATIVE); |
1688 | if (ret == -ENOMEM) | 1698 | if (ret == -ENOMEM) |
1689 | pr_err("mcg table is full. Fail to register network rule.\n"); | 1699 | pr_err("mcg table is full. Fail to register network rule.\n"); |
1690 | else if (ret == -ENXIO) | 1700 | else if (ret == -ENXIO) |
@@ -1701,7 +1711,7 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id) | |||
1701 | int err; | 1711 | int err; |
1702 | err = mlx4_cmd(dev, reg_id, 0, 0, | 1712 | err = mlx4_cmd(dev, reg_id, 0, 0, |
1703 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | 1713 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, |
1704 | MLX4_CMD_WRAPPED); | 1714 | MLX4_CMD_NATIVE); |
1705 | if (err) | 1715 | if (err) |
1706 | pr_err("Fail to detach network rule. registration id = 0x%llx\n", | 1716 | pr_err("Fail to detach network rule. registration id = 0x%llx\n", |
1707 | reg_id); | 1717 | reg_id); |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 019e02707cd5..3ef0f42984f2 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -1023,7 +1023,7 @@ again: | |||
1023 | next_tail = (tail + sizeof(*cmd)) % CMD_BUFFER_SIZE; | 1023 | next_tail = (tail + sizeof(*cmd)) % CMD_BUFFER_SIZE; |
1024 | left = (head - next_tail) % CMD_BUFFER_SIZE; | 1024 | left = (head - next_tail) % CMD_BUFFER_SIZE; |
1025 | 1025 | ||
1026 | if (left <= 2) { | 1026 | if (left <= 0x20) { |
1027 | struct iommu_cmd sync_cmd; | 1027 | struct iommu_cmd sync_cmd; |
1028 | int ret; | 1028 | int ret; |
1029 | 1029 | ||
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index a88576d50740..8ccbd7023194 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -903,8 +903,10 @@ int __init detect_intel_iommu(void) | |||
903 | x86_init.iommu.iommu_init = intel_iommu_init; | 903 | x86_init.iommu.iommu_init = intel_iommu_init; |
904 | #endif | 904 | #endif |
905 | 905 | ||
906 | acpi_put_table(dmar_tbl); | 906 | if (dmar_tbl) { |
907 | dmar_tbl = NULL; | 907 | acpi_put_table(dmar_tbl); |
908 | dmar_tbl = NULL; | ||
909 | } | ||
908 | up_write(&dmar_global_lock); | 910 | up_write(&dmar_global_lock); |
909 | 911 | ||
910 | return ret ? 1 : -ENODEV; | 912 | return ret ? 1 : -ENODEV; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c66c273dfd8a..8a185250ae5a 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2037,6 +2037,25 @@ static int domain_context_mapping_one(struct dmar_domain *domain, | |||
2037 | if (context_present(context)) | 2037 | if (context_present(context)) |
2038 | goto out_unlock; | 2038 | goto out_unlock; |
2039 | 2039 | ||
2040 | /* | ||
2041 | * For kdump cases, old valid entries may be cached due to the | ||
2042 | * in-flight DMA and copied pgtable, but there is no unmapping | ||
2043 | * behaviour for them, thus we need an explicit cache flush for | ||
2044 | * the newly-mapped device. For kdump, at this point, the device | ||
2045 | * is supposed to finish reset at its driver probe stage, so no | ||
2046 | * in-flight DMA will exist, and we don't need to worry anymore | ||
2047 | * hereafter. | ||
2048 | */ | ||
2049 | if (context_copied(context)) { | ||
2050 | u16 did_old = context_domain_id(context); | ||
2051 | |||
2052 | if (did_old >= 0 && did_old < cap_ndoms(iommu->cap)) | ||
2053 | iommu->flush.flush_context(iommu, did_old, | ||
2054 | (((u16)bus) << 8) | devfn, | ||
2055 | DMA_CCMD_MASK_NOBIT, | ||
2056 | DMA_CCMD_DEVICE_INVL); | ||
2057 | } | ||
2058 | |||
2040 | pgd = domain->pgd; | 2059 | pgd = domain->pgd; |
2041 | 2060 | ||
2042 | context_clear_entry(context); | 2061 | context_clear_entry(context); |
@@ -5185,6 +5204,25 @@ static void intel_iommu_remove_device(struct device *dev) | |||
5185 | } | 5204 | } |
5186 | 5205 | ||
5187 | #ifdef CONFIG_INTEL_IOMMU_SVM | 5206 | #ifdef CONFIG_INTEL_IOMMU_SVM |
5207 | #define MAX_NR_PASID_BITS (20) | ||
5208 | static inline unsigned long intel_iommu_get_pts(struct intel_iommu *iommu) | ||
5209 | { | ||
5210 | /* | ||
5211 | * Convert ecap_pss to extend context entry pts encoding, also | ||
5212 | * respect the soft pasid_max value set by the iommu. | ||
5213 | * - number of PASID bits = ecap_pss + 1 | ||
5214 | * - number of PASID table entries = 2^(pts + 5) | ||
5215 | * Therefore, pts = ecap_pss - 4 | ||
5216 | * e.g. KBL ecap_pss = 0x13, PASID has 20 bits, pts = 15 | ||
5217 | */ | ||
5218 | if (ecap_pss(iommu->ecap) < 5) | ||
5219 | return 0; | ||
5220 | |||
5221 | /* pasid_max is encoded as actual number of entries not the bits */ | ||
5222 | return find_first_bit((unsigned long *)&iommu->pasid_max, | ||
5223 | MAX_NR_PASID_BITS) - 5; | ||
5224 | } | ||
5225 | |||
5188 | int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev) | 5226 | int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev) |
5189 | { | 5227 | { |
5190 | struct device_domain_info *info; | 5228 | struct device_domain_info *info; |
@@ -5217,7 +5255,9 @@ int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sd | |||
5217 | 5255 | ||
5218 | if (!(ctx_lo & CONTEXT_PASIDE)) { | 5256 | if (!(ctx_lo & CONTEXT_PASIDE)) { |
5219 | context[1].hi = (u64)virt_to_phys(iommu->pasid_state_table); | 5257 | context[1].hi = (u64)virt_to_phys(iommu->pasid_state_table); |
5220 | context[1].lo = (u64)virt_to_phys(iommu->pasid_table) | ecap_pss(iommu->ecap); | 5258 | context[1].lo = (u64)virt_to_phys(iommu->pasid_table) | |
5259 | intel_iommu_get_pts(iommu); | ||
5260 | |||
5221 | wmb(); | 5261 | wmb(); |
5222 | /* CONTEXT_TT_MULTI_LEVEL and CONTEXT_TT_DEV_IOTLB are both | 5262 | /* CONTEXT_TT_MULTI_LEVEL and CONTEXT_TT_DEV_IOTLB are both |
5223 | * extended to permit requests-with-PASID if the PASIDE bit | 5263 | * extended to permit requests-with-PASID if the PASIDE bit |
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 0037153c80a6..2d9c5dd06e42 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c | |||
@@ -450,7 +450,7 @@ bool mei_cldev_enabled(struct mei_cl_device *cldev) | |||
450 | EXPORT_SYMBOL_GPL(mei_cldev_enabled); | 450 | EXPORT_SYMBOL_GPL(mei_cldev_enabled); |
451 | 451 | ||
452 | /** | 452 | /** |
453 | * mei_cldev_enable_device - enable me client device | 453 | * mei_cldev_enable - enable me client device |
454 | * create connection with me client | 454 | * create connection with me client |
455 | * | 455 | * |
456 | * @cldev: me client device | 456 | * @cldev: me client device |
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 391936c1aa04..b0395601c6ae 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
@@ -1541,7 +1541,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, | |||
1541 | 1541 | ||
1542 | rets = first_chunk ? mei_cl_tx_flow_ctrl_creds(cl) : 1; | 1542 | rets = first_chunk ? mei_cl_tx_flow_ctrl_creds(cl) : 1; |
1543 | if (rets < 0) | 1543 | if (rets < 0) |
1544 | return rets; | 1544 | goto err; |
1545 | 1545 | ||
1546 | if (rets == 0) { | 1546 | if (rets == 0) { |
1547 | cl_dbg(dev, cl, "No flow control credentials: not sending.\n"); | 1547 | cl_dbg(dev, cl, "No flow control credentials: not sending.\n"); |
@@ -1575,11 +1575,8 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, | |||
1575 | cb->buf.size, cb->buf_idx); | 1575 | cb->buf.size, cb->buf_idx); |
1576 | 1576 | ||
1577 | rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx); | 1577 | rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx); |
1578 | if (rets) { | 1578 | if (rets) |
1579 | cl->status = rets; | 1579 | goto err; |
1580 | list_move_tail(&cb->list, &cmpl_list->list); | ||
1581 | return rets; | ||
1582 | } | ||
1583 | 1580 | ||
1584 | cl->status = 0; | 1581 | cl->status = 0; |
1585 | cl->writing_state = MEI_WRITING; | 1582 | cl->writing_state = MEI_WRITING; |
@@ -1587,14 +1584,21 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, | |||
1587 | cb->completed = mei_hdr.msg_complete == 1; | 1584 | cb->completed = mei_hdr.msg_complete == 1; |
1588 | 1585 | ||
1589 | if (first_chunk) { | 1586 | if (first_chunk) { |
1590 | if (mei_cl_tx_flow_ctrl_creds_reduce(cl)) | 1587 | if (mei_cl_tx_flow_ctrl_creds_reduce(cl)) { |
1591 | return -EIO; | 1588 | rets = -EIO; |
1589 | goto err; | ||
1590 | } | ||
1592 | } | 1591 | } |
1593 | 1592 | ||
1594 | if (mei_hdr.msg_complete) | 1593 | if (mei_hdr.msg_complete) |
1595 | list_move_tail(&cb->list, &dev->write_waiting_list.list); | 1594 | list_move_tail(&cb->list, &dev->write_waiting_list.list); |
1596 | 1595 | ||
1597 | return 0; | 1596 | return 0; |
1597 | |||
1598 | err: | ||
1599 | cl->status = rets; | ||
1600 | list_move_tail(&cb->list, &cmpl_list->list); | ||
1601 | return rets; | ||
1598 | } | 1602 | } |
1599 | 1603 | ||
1600 | /** | 1604 | /** |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 25d1eb4933d0..7e8cf213fd81 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -1012,15 +1012,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, | |||
1012 | goto out; | 1012 | goto out; |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | /* Insert TSB and checksum infos */ | ||
1016 | if (priv->tsb_en) { | ||
1017 | skb = bcm_sysport_insert_tsb(skb, dev); | ||
1018 | if (!skb) { | ||
1019 | ret = NETDEV_TX_OK; | ||
1020 | goto out; | ||
1021 | } | ||
1022 | } | ||
1023 | |||
1024 | /* The Ethernet switch we are interfaced with needs packets to be at | 1015 | /* The Ethernet switch we are interfaced with needs packets to be at |
1025 | * least 64 bytes (including FCS) otherwise they will be discarded when | 1016 | * least 64 bytes (including FCS) otherwise they will be discarded when |
1026 | * they enter the switch port logic. When Broadcom tags are enabled, we | 1017 | * they enter the switch port logic. When Broadcom tags are enabled, we |
@@ -1028,13 +1019,21 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, | |||
1028 | * (including FCS and tag) because the length verification is done after | 1019 | * (including FCS and tag) because the length verification is done after |
1029 | * the Broadcom tag is stripped off the ingress packet. | 1020 | * the Broadcom tag is stripped off the ingress packet. |
1030 | */ | 1021 | */ |
1031 | if (skb_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) { | 1022 | if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) { |
1032 | ret = NETDEV_TX_OK; | 1023 | ret = NETDEV_TX_OK; |
1033 | goto out; | 1024 | goto out; |
1034 | } | 1025 | } |
1035 | 1026 | ||
1036 | skb_len = skb->len < ETH_ZLEN + ENET_BRCM_TAG_LEN ? | 1027 | /* Insert TSB and checksum infos */ |
1037 | ETH_ZLEN + ENET_BRCM_TAG_LEN : skb->len; | 1028 | if (priv->tsb_en) { |
1029 | skb = bcm_sysport_insert_tsb(skb, dev); | ||
1030 | if (!skb) { | ||
1031 | ret = NETDEV_TX_OK; | ||
1032 | goto out; | ||
1033 | } | ||
1034 | } | ||
1035 | |||
1036 | skb_len = skb->len; | ||
1038 | 1037 | ||
1039 | mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE); | 1038 | mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE); |
1040 | if (dma_mapping_error(kdev, mapping)) { | 1039 | if (dma_mapping_error(kdev, mapping)) { |
diff --git a/drivers/net/ethernet/cadence/macb_pci.c b/drivers/net/ethernet/cadence/macb_pci.c index 92be2cd8f817..9906fda76087 100644 --- a/drivers/net/ethernet/cadence/macb_pci.c +++ b/drivers/net/ethernet/cadence/macb_pci.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * macb_pci.c - Cadence GEM PCI wrapper. | 2 | * Cadence GEM PCI wrapper. |
3 | * | 3 | * |
4 | * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com | 4 | * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com |
5 | * | 5 | * |
@@ -45,32 +45,27 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
45 | struct macb_platform_data plat_data; | 45 | struct macb_platform_data plat_data; |
46 | struct resource res[2]; | 46 | struct resource res[2]; |
47 | 47 | ||
48 | /* sanity check */ | ||
49 | if (!id) | ||
50 | return -EINVAL; | ||
51 | |||
52 | /* enable pci device */ | 48 | /* enable pci device */ |
53 | err = pci_enable_device(pdev); | 49 | err = pcim_enable_device(pdev); |
54 | if (err < 0) { | 50 | if (err < 0) { |
55 | dev_err(&pdev->dev, "Enabling PCI device has failed: 0x%04X", | 51 | dev_err(&pdev->dev, "Enabling PCI device has failed: %d", err); |
56 | err); | 52 | return err; |
57 | return -EACCES; | ||
58 | } | 53 | } |
59 | 54 | ||
60 | pci_set_master(pdev); | 55 | pci_set_master(pdev); |
61 | 56 | ||
62 | /* set up resources */ | 57 | /* set up resources */ |
63 | memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res)); | 58 | memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res)); |
64 | res[0].start = pdev->resource[0].start; | 59 | res[0].start = pci_resource_start(pdev, 0); |
65 | res[0].end = pdev->resource[0].end; | 60 | res[0].end = pci_resource_end(pdev, 0); |
66 | res[0].name = PCI_DRIVER_NAME; | 61 | res[0].name = PCI_DRIVER_NAME; |
67 | res[0].flags = IORESOURCE_MEM; | 62 | res[0].flags = IORESOURCE_MEM; |
68 | res[1].start = pdev->irq; | 63 | res[1].start = pci_irq_vector(pdev, 0); |
69 | res[1].name = PCI_DRIVER_NAME; | 64 | res[1].name = PCI_DRIVER_NAME; |
70 | res[1].flags = IORESOURCE_IRQ; | 65 | res[1].flags = IORESOURCE_IRQ; |
71 | 66 | ||
72 | dev_info(&pdev->dev, "EMAC physical base addr = 0x%p\n", | 67 | dev_info(&pdev->dev, "EMAC physical base addr: %pa\n", |
73 | (void *)(uintptr_t)pci_resource_start(pdev, 0)); | 68 | &res[0].start); |
74 | 69 | ||
75 | /* set up macb platform data */ | 70 | /* set up macb platform data */ |
76 | memset(&plat_data, 0, sizeof(plat_data)); | 71 | memset(&plat_data, 0, sizeof(plat_data)); |
@@ -100,7 +95,7 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
100 | plat_info.num_res = ARRAY_SIZE(res); | 95 | plat_info.num_res = ARRAY_SIZE(res); |
101 | plat_info.data = &plat_data; | 96 | plat_info.data = &plat_data; |
102 | plat_info.size_data = sizeof(plat_data); | 97 | plat_info.size_data = sizeof(plat_data); |
103 | plat_info.dma_mask = DMA_BIT_MASK(32); | 98 | plat_info.dma_mask = pdev->dma_mask; |
104 | 99 | ||
105 | /* register platform device */ | 100 | /* register platform device */ |
106 | plat_dev = platform_device_register_full(&plat_info); | 101 | plat_dev = platform_device_register_full(&plat_info); |
@@ -120,7 +115,6 @@ err_hclk_register: | |||
120 | clk_unregister(plat_data.pclk); | 115 | clk_unregister(plat_data.pclk); |
121 | 116 | ||
122 | err_pclk_register: | 117 | err_pclk_register: |
123 | pci_disable_device(pdev); | ||
124 | return err; | 118 | return err; |
125 | } | 119 | } |
126 | 120 | ||
@@ -130,7 +124,6 @@ static void macb_remove(struct pci_dev *pdev) | |||
130 | struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); | 124 | struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); |
131 | 125 | ||
132 | platform_device_unregister(plat_dev); | 126 | platform_device_unregister(plat_dev); |
133 | pci_disable_device(pdev); | ||
134 | clk_unregister(plat_data->pclk); | 127 | clk_unregister(plat_data->pclk); |
135 | clk_unregister(plat_data->hclk); | 128 | clk_unregister(plat_data->hclk); |
136 | } | 129 | } |
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig index bbc8bd16cb97..dcbce6cac63e 100644 --- a/drivers/net/ethernet/cavium/Kconfig +++ b/drivers/net/ethernet/cavium/Kconfig | |||
@@ -77,7 +77,7 @@ config OCTEON_MGMT_ETHERNET | |||
77 | config LIQUIDIO_VF | 77 | config LIQUIDIO_VF |
78 | tristate "Cavium LiquidIO VF support" | 78 | tristate "Cavium LiquidIO VF support" |
79 | depends on 64BIT && PCI_MSI | 79 | depends on 64BIT && PCI_MSI |
80 | select PTP_1588_CLOCK | 80 | imply PTP_1588_CLOCK |
81 | ---help--- | 81 | ---help--- |
82 | This driver supports Cavium LiquidIO Intelligent Server Adapter | 82 | This driver supports Cavium LiquidIO Intelligent Server Adapter |
83 | based on CN23XX chips. | 83 | based on CN23XX chips. |
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c index 0f0de5b63622..d04a6c163445 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | |||
@@ -133,17 +133,15 @@ cxgb_find_route6(struct cxgb4_lld_info *lldi, | |||
133 | if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) | 133 | if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) |
134 | fl6.flowi6_oif = sin6_scope_id; | 134 | fl6.flowi6_oif = sin6_scope_id; |
135 | dst = ip6_route_output(&init_net, NULL, &fl6); | 135 | dst = ip6_route_output(&init_net, NULL, &fl6); |
136 | if (!dst) | 136 | if (dst->error || |
137 | goto out; | 137 | (!cxgb_our_interface(lldi, get_real_dev, |
138 | if (!cxgb_our_interface(lldi, get_real_dev, | 138 | ip6_dst_idev(dst)->dev) && |
139 | ip6_dst_idev(dst)->dev) && | 139 | !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK))) { |
140 | !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK)) { | ||
141 | dst_release(dst); | 140 | dst_release(dst); |
142 | dst = NULL; | 141 | return NULL; |
143 | } | 142 | } |
144 | } | 143 | } |
145 | 144 | ||
146 | out: | ||
147 | return dst; | 145 | return dst; |
148 | } | 146 | } |
149 | EXPORT_SYMBOL(cxgb_find_route6); | 147 | EXPORT_SYMBOL(cxgb_find_route6); |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 7e1633bf5a22..225e9a4877d7 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -5155,7 +5155,9 @@ static netdev_features_t be_features_check(struct sk_buff *skb, | |||
5155 | skb->inner_protocol_type != ENCAP_TYPE_ETHER || | 5155 | skb->inner_protocol_type != ENCAP_TYPE_ETHER || |
5156 | skb->inner_protocol != htons(ETH_P_TEB) || | 5156 | skb->inner_protocol != htons(ETH_P_TEB) || |
5157 | skb_inner_mac_header(skb) - skb_transport_header(skb) != | 5157 | skb_inner_mac_header(skb) - skb_transport_header(skb) != |
5158 | sizeof(struct udphdr) + sizeof(struct vxlanhdr)) | 5158 | sizeof(struct udphdr) + sizeof(struct vxlanhdr) || |
5159 | !adapter->vxlan_port || | ||
5160 | udp_hdr(skb)->dest != adapter->vxlan_port) | ||
5159 | return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); | 5161 | return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); |
5160 | 5162 | ||
5161 | return features; | 5163 | return features; |
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 624ba9058dc4..c9b7ad65e563 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | |||
@@ -733,6 +733,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) | |||
733 | priv->cgr_data.cgr.cb = dpaa_eth_cgscn; | 733 | priv->cgr_data.cgr.cb = dpaa_eth_cgscn; |
734 | 734 | ||
735 | /* Enable Congestion State Change Notifications and CS taildrop */ | 735 | /* Enable Congestion State Change Notifications and CS taildrop */ |
736 | memset(&initcgr, 0, sizeof(initcgr)); | ||
736 | initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES); | 737 | initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES); |
737 | initcgr.cgr.cscn_en = QM_CGR_EN; | 738 | initcgr.cgr.cscn_en = QM_CGR_EN; |
738 | 739 | ||
@@ -2291,7 +2292,8 @@ static int dpaa_open(struct net_device *net_dev) | |||
2291 | net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev); | 2292 | net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev); |
2292 | if (!net_dev->phydev) { | 2293 | if (!net_dev->phydev) { |
2293 | netif_err(priv, ifup, net_dev, "init_phy() failed\n"); | 2294 | netif_err(priv, ifup, net_dev, "init_phy() failed\n"); |
2294 | return -ENODEV; | 2295 | err = -ENODEV; |
2296 | goto phy_init_failed; | ||
2295 | } | 2297 | } |
2296 | 2298 | ||
2297 | for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { | 2299 | for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { |
@@ -2314,6 +2316,7 @@ mac_start_failed: | |||
2314 | for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) | 2316 | for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) |
2315 | fman_port_disable(mac_dev->port[i]); | 2317 | fman_port_disable(mac_dev->port[i]); |
2316 | 2318 | ||
2319 | phy_init_failed: | ||
2317 | dpaa_eth_napi_disable(priv); | 2320 | dpaa_eth_napi_disable(priv); |
2318 | 2321 | ||
2319 | return err; | 2322 | return err; |
@@ -2420,6 +2423,7 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv) | |||
2420 | } | 2423 | } |
2421 | 2424 | ||
2422 | /* Enable CS TD, but disable Congestion State Change Notifications. */ | 2425 | /* Enable CS TD, but disable Congestion State Change Notifications. */ |
2426 | memset(&initcgr, 0, sizeof(initcgr)); | ||
2423 | initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES); | 2427 | initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES); |
2424 | initcgr.cgr.cscn_en = QM_CGR_EN; | 2428 | initcgr.cgr.cscn_en = QM_CGR_EN; |
2425 | cs_th = DPAA_INGRESS_CS_THRESHOLD; | 2429 | cs_th = DPAA_INGRESS_CS_THRESHOLD; |
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c index cbeea915f026..8037426ec50f 100644 --- a/drivers/net/ethernet/korina.c +++ b/drivers/net/ethernet/korina.c | |||
@@ -900,10 +900,10 @@ static void korina_restart_task(struct work_struct *work) | |||
900 | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR, | 900 | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR, |
901 | &lp->rx_dma_regs->dmasm); | 901 | &lp->rx_dma_regs->dmasm); |
902 | 902 | ||
903 | korina_free_ring(dev); | ||
904 | |||
905 | napi_disable(&lp->napi); | 903 | napi_disable(&lp->napi); |
906 | 904 | ||
905 | korina_free_ring(dev); | ||
906 | |||
907 | if (korina_init(dev) < 0) { | 907 | if (korina_init(dev) < 0) { |
908 | printk(KERN_ERR "%s: cannot restart device\n", dev->name); | 908 | printk(KERN_ERR "%s: cannot restart device\n", dev->name); |
909 | return; | 909 | return; |
@@ -1064,12 +1064,12 @@ static int korina_close(struct net_device *dev) | |||
1064 | tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR; | 1064 | tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR; |
1065 | writel(tmp, &lp->rx_dma_regs->dmasm); | 1065 | writel(tmp, &lp->rx_dma_regs->dmasm); |
1066 | 1066 | ||
1067 | korina_free_ring(dev); | ||
1068 | |||
1069 | napi_disable(&lp->napi); | 1067 | napi_disable(&lp->napi); |
1070 | 1068 | ||
1071 | cancel_work_sync(&lp->restart_task); | 1069 | cancel_work_sync(&lp->restart_task); |
1072 | 1070 | ||
1071 | korina_free_ring(dev); | ||
1072 | |||
1073 | free_irq(lp->rx_irq, dev); | 1073 | free_irq(lp->rx_irq, dev); |
1074 | free_irq(lp->tx_irq, dev); | 1074 | free_irq(lp->tx_irq, dev); |
1075 | free_irq(lp->ovr_irq, dev); | 1075 | free_irq(lp->ovr_irq, dev); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index 015198c14fa8..504461a464c5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c | |||
@@ -245,13 +245,9 @@ static u32 freq_to_shift(u16 freq) | |||
245 | { | 245 | { |
246 | u32 freq_khz = freq * 1000; | 246 | u32 freq_khz = freq * 1000; |
247 | u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC; | 247 | u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC; |
248 | u64 tmp_rounded = | 248 | u64 max_val_cycles_rounded = 1ULL << fls64(max_val_cycles - 1); |
249 | roundup_pow_of_two(max_val_cycles) > max_val_cycles ? | ||
250 | roundup_pow_of_two(max_val_cycles) - 1 : UINT_MAX; | ||
251 | u64 max_val_cycles_rounded = is_power_of_2(max_val_cycles + 1) ? | ||
252 | max_val_cycles : tmp_rounded; | ||
253 | /* calculate max possible multiplier in order to fit in 64bit */ | 249 | /* calculate max possible multiplier in order to fit in 64bit */ |
254 | u64 max_mul = div_u64(0xffffffffffffffffULL, max_val_cycles_rounded); | 250 | u64 max_mul = div64_u64(ULLONG_MAX, max_val_cycles_rounded); |
255 | 251 | ||
256 | /* This comes from the reverse of clocksource_khz2mult */ | 252 | /* This comes from the reverse of clocksource_khz2mult */ |
257 | return ilog2(div_u64(max_mul * freq_khz, 1000000)); | 253 | return ilog2(div_u64(max_mul * freq_khz, 1000000)); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index bcd955339058..edbe200ac2fa 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1638,7 +1638,8 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1638 | 1638 | ||
1639 | /* Configure tx cq's and rings */ | 1639 | /* Configure tx cq's and rings */ |
1640 | for (t = 0 ; t < MLX4_EN_NUM_TX_TYPES; t++) { | 1640 | for (t = 0 ; t < MLX4_EN_NUM_TX_TYPES; t++) { |
1641 | u8 num_tx_rings_p_up = t == TX ? priv->num_tx_rings_p_up : 1; | 1641 | u8 num_tx_rings_p_up = t == TX ? |
1642 | priv->num_tx_rings_p_up : priv->tx_ring_num[t]; | ||
1642 | 1643 | ||
1643 | for (i = 0; i < priv->tx_ring_num[t]; i++) { | 1644 | for (i = 0; i < priv->tx_ring_num[t]; i++) { |
1644 | /* Configure cq */ | 1645 | /* Configure cq */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 3c37e216bbf3..eac527e25ec9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -445,8 +445,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) | |||
445 | ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn; | 445 | ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn; |
446 | 446 | ||
447 | ring->stride = stride; | 447 | ring->stride = stride; |
448 | if (ring->stride <= TXBB_SIZE) | 448 | if (ring->stride <= TXBB_SIZE) { |
449 | /* Stamp first unused send wqe */ | ||
450 | __be32 *ptr = (__be32 *)ring->buf; | ||
451 | __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT); | ||
452 | *ptr = stamp; | ||
453 | /* Move pointer to start of rx section */ | ||
449 | ring->buf += TXBB_SIZE; | 454 | ring->buf += TXBB_SIZE; |
455 | } | ||
450 | 456 | ||
451 | ring->log_stride = ffs(ring->stride) - 1; | 457 | ring->log_stride = ffs(ring->stride) - 1; |
452 | ring->buf_size = ring->size * ring->stride; | 458 | ring->buf_size = ring->size * ring->stride; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c index 2a9dd460a95f..e1f9e7cebf8f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/icm.c +++ b/drivers/net/ethernet/mellanox/mlx4/icm.c | |||
@@ -118,8 +118,13 @@ static int mlx4_alloc_icm_coherent(struct device *dev, struct scatterlist *mem, | |||
118 | if (!buf) | 118 | if (!buf) |
119 | return -ENOMEM; | 119 | return -ENOMEM; |
120 | 120 | ||
121 | if (offset_in_page(buf)) { | ||
122 | dma_free_coherent(dev, PAGE_SIZE << order, | ||
123 | buf, sg_dma_address(mem)); | ||
124 | return -ENOMEM; | ||
125 | } | ||
126 | |||
121 | sg_set_buf(mem, buf, PAGE_SIZE << order); | 127 | sg_set_buf(mem, buf, PAGE_SIZE << order); |
122 | BUG_ON(mem->offset); | ||
123 | sg_dma_len(mem) = PAGE_SIZE << order; | 128 | sg_dma_len(mem) = PAGE_SIZE << order; |
124 | return 0; | 129 | return 0; |
125 | } | 130 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 5e7840a7a33b..bffa6f345f2f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/io-mapping.h> | 42 | #include <linux/io-mapping.h> |
43 | #include <linux/delay.h> | 43 | #include <linux/delay.h> |
44 | #include <linux/kmod.h> | 44 | #include <linux/kmod.h> |
45 | #include <linux/etherdevice.h> | ||
45 | #include <net/devlink.h> | 46 | #include <net/devlink.h> |
46 | 47 | ||
47 | #include <linux/mlx4/device.h> | 48 | #include <linux/mlx4/device.h> |
@@ -782,6 +783,23 @@ int mlx4_is_slave_active(struct mlx4_dev *dev, int slave) | |||
782 | } | 783 | } |
783 | EXPORT_SYMBOL(mlx4_is_slave_active); | 784 | EXPORT_SYMBOL(mlx4_is_slave_active); |
784 | 785 | ||
786 | void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl, | ||
787 | struct _rule_hw *eth_header) | ||
788 | { | ||
789 | if (is_multicast_ether_addr(eth_header->eth.dst_mac) || | ||
790 | is_broadcast_ether_addr(eth_header->eth.dst_mac)) { | ||
791 | struct mlx4_net_trans_rule_hw_eth *eth = | ||
792 | (struct mlx4_net_trans_rule_hw_eth *)eth_header; | ||
793 | struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1); | ||
794 | bool last_rule = next_rule->size == 0 && next_rule->id == 0 && | ||
795 | next_rule->rsvd == 0; | ||
796 | |||
797 | if (last_rule) | ||
798 | ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC); | ||
799 | } | ||
800 | } | ||
801 | EXPORT_SYMBOL(mlx4_handle_eth_header_mcast_prio); | ||
802 | |||
785 | static void slave_adjust_steering_mode(struct mlx4_dev *dev, | 803 | static void slave_adjust_steering_mode(struct mlx4_dev *dev, |
786 | struct mlx4_dev_cap *dev_cap, | 804 | struct mlx4_dev_cap *dev_cap, |
787 | struct mlx4_init_hca_param *hca_param) | 805 | struct mlx4_init_hca_param *hca_param) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index c548beaaf910..56185a0b827d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -4164,22 +4164,6 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header, | |||
4164 | return 0; | 4164 | return 0; |
4165 | } | 4165 | } |
4166 | 4166 | ||
4167 | static void handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl, | ||
4168 | struct _rule_hw *eth_header) | ||
4169 | { | ||
4170 | if (is_multicast_ether_addr(eth_header->eth.dst_mac) || | ||
4171 | is_broadcast_ether_addr(eth_header->eth.dst_mac)) { | ||
4172 | struct mlx4_net_trans_rule_hw_eth *eth = | ||
4173 | (struct mlx4_net_trans_rule_hw_eth *)eth_header; | ||
4174 | struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1); | ||
4175 | bool last_rule = next_rule->size == 0 && next_rule->id == 0 && | ||
4176 | next_rule->rsvd == 0; | ||
4177 | |||
4178 | if (last_rule) | ||
4179 | ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC); | ||
4180 | } | ||
4181 | } | ||
4182 | |||
4183 | /* | 4167 | /* |
4184 | * In case of missing eth header, append eth header with a MAC address | 4168 | * In case of missing eth header, append eth header with a MAC address |
4185 | * assigned to the VF. | 4169 | * assigned to the VF. |
@@ -4363,10 +4347,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
4363 | header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id)); | 4347 | header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id)); |
4364 | 4348 | ||
4365 | if (header_id == MLX4_NET_TRANS_RULE_ID_ETH) | 4349 | if (header_id == MLX4_NET_TRANS_RULE_ID_ETH) |
4366 | handle_eth_header_mcast_prio(ctrl, rule_header); | 4350 | mlx4_handle_eth_header_mcast_prio(ctrl, rule_header); |
4367 | |||
4368 | if (slave == dev->caps.function) | ||
4369 | goto execute; | ||
4370 | 4351 | ||
4371 | switch (header_id) { | 4352 | switch (header_id) { |
4372 | case MLX4_NET_TRANS_RULE_ID_ETH: | 4353 | case MLX4_NET_TRANS_RULE_ID_ETH: |
@@ -4394,7 +4375,6 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
4394 | goto err_put_qp; | 4375 | goto err_put_qp; |
4395 | } | 4376 | } |
4396 | 4377 | ||
4397 | execute: | ||
4398 | err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param, | 4378 | err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param, |
4399 | vhcr->in_modifier, 0, | 4379 | vhcr->in_modifier, 0, |
4400 | MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, | 4380 | MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, |
@@ -4473,6 +4453,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | |||
4473 | struct res_qp *rqp; | 4453 | struct res_qp *rqp; |
4474 | struct res_fs_rule *rrule; | 4454 | struct res_fs_rule *rrule; |
4475 | u64 mirr_reg_id; | 4455 | u64 mirr_reg_id; |
4456 | int qpn; | ||
4476 | 4457 | ||
4477 | if (dev->caps.steering_mode != | 4458 | if (dev->caps.steering_mode != |
4478 | MLX4_STEERING_MODE_DEVICE_MANAGED) | 4459 | MLX4_STEERING_MODE_DEVICE_MANAGED) |
@@ -4489,10 +4470,11 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | |||
4489 | } | 4470 | } |
4490 | mirr_reg_id = rrule->mirr_rule_id; | 4471 | mirr_reg_id = rrule->mirr_rule_id; |
4491 | kfree(rrule->mirr_mbox); | 4472 | kfree(rrule->mirr_mbox); |
4473 | qpn = rrule->qpn; | ||
4492 | 4474 | ||
4493 | /* Release the rule form busy state before removal */ | 4475 | /* Release the rule form busy state before removal */ |
4494 | put_res(dev, slave, vhcr->in_param, RES_FS_RULE); | 4476 | put_res(dev, slave, vhcr->in_param, RES_FS_RULE); |
4495 | err = get_res(dev, slave, rrule->qpn, RES_QP, &rqp); | 4477 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
4496 | if (err) | 4478 | if (err) |
4497 | return err; | 4479 | return err; |
4498 | 4480 | ||
@@ -4517,7 +4499,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | |||
4517 | if (!err) | 4499 | if (!err) |
4518 | atomic_dec(&rqp->ref_count); | 4500 | atomic_dec(&rqp->ref_count); |
4519 | out: | 4501 | out: |
4520 | put_res(dev, slave, rrule->qpn, RES_QP); | 4502 | put_res(dev, slave, qpn, RES_QP); |
4521 | return err; | 4503 | return err; |
4522 | } | 4504 | } |
4523 | 4505 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c index 7f6c225666c1..f0b460f47f29 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | |||
@@ -723,6 +723,9 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv) | |||
723 | int i; | 723 | int i; |
724 | struct ieee_ets ets; | 724 | struct ieee_ets ets; |
725 | 725 | ||
726 | if (!MLX5_CAP_GEN(priv->mdev, ets)) | ||
727 | return; | ||
728 | |||
726 | memset(&ets, 0, sizeof(ets)); | 729 | memset(&ets, 0, sizeof(ets)); |
727 | ets.ets_cap = mlx5_max_tc(priv->mdev) + 1; | 730 | ets.ets_cap = mlx5_max_tc(priv->mdev) + 1; |
728 | for (i = 0; i < ets.ets_cap; i++) { | 731 | for (i = 0; i < ets.ets_cap; i++) { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 352462af8d51..33a399a8b5d5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -171,7 +171,6 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset) | |||
171 | return NUM_SW_COUNTERS + | 171 | return NUM_SW_COUNTERS + |
172 | MLX5E_NUM_Q_CNTRS(priv) + | 172 | MLX5E_NUM_Q_CNTRS(priv) + |
173 | NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS + | 173 | NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS + |
174 | NUM_PCIE_COUNTERS + | ||
175 | MLX5E_NUM_RQ_STATS(priv) + | 174 | MLX5E_NUM_RQ_STATS(priv) + |
176 | MLX5E_NUM_SQ_STATS(priv) + | 175 | MLX5E_NUM_SQ_STATS(priv) + |
177 | MLX5E_NUM_PFC_COUNTERS(priv) + | 176 | MLX5E_NUM_PFC_COUNTERS(priv) + |
@@ -219,14 +218,6 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data) | |||
219 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | 218 | strcpy(data + (idx++) * ETH_GSTRING_LEN, |
220 | pport_2819_stats_desc[i].format); | 219 | pport_2819_stats_desc[i].format); |
221 | 220 | ||
222 | for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++) | ||
223 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | ||
224 | pcie_perf_stats_desc[i].format); | ||
225 | |||
226 | for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++) | ||
227 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | ||
228 | pcie_tas_stats_desc[i].format); | ||
229 | |||
230 | for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { | 221 | for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { |
231 | for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) | 222 | for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) |
232 | sprintf(data + (idx++) * ETH_GSTRING_LEN, | 223 | sprintf(data + (idx++) * ETH_GSTRING_LEN, |
@@ -339,14 +330,6 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev, | |||
339 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters, | 330 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters, |
340 | pport_2819_stats_desc, i); | 331 | pport_2819_stats_desc, i); |
341 | 332 | ||
342 | for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++) | ||
343 | data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters, | ||
344 | pcie_perf_stats_desc, i); | ||
345 | |||
346 | for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++) | ||
347 | data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_tas_counters, | ||
348 | pcie_tas_stats_desc, i); | ||
349 | |||
350 | for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { | 333 | for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { |
351 | for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) | 334 | for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) |
352 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio], | 335 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio], |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c index 3691451c728c..d088effd7160 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | |||
@@ -247,6 +247,7 @@ static int set_flow_attrs(u32 *match_c, u32 *match_v, | |||
247 | } | 247 | } |
248 | if (fs->flow_type & FLOW_MAC_EXT && | 248 | if (fs->flow_type & FLOW_MAC_EXT && |
249 | !is_zero_ether_addr(fs->m_ext.h_dest)) { | 249 | !is_zero_ether_addr(fs->m_ext.h_dest)) { |
250 | mask_spec(fs->m_ext.h_dest, fs->h_ext.h_dest, ETH_ALEN); | ||
250 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, | 251 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, |
251 | outer_headers_c, dmac_47_16), | 252 | outer_headers_c, dmac_47_16), |
252 | fs->m_ext.h_dest); | 253 | fs->m_ext.h_dest); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index cbfa38fc72c0..1236b27b1493 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -291,36 +291,12 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv) | |||
291 | &qcnt->rx_out_of_buffer); | 291 | &qcnt->rx_out_of_buffer); |
292 | } | 292 | } |
293 | 293 | ||
294 | static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv) | ||
295 | { | ||
296 | struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie; | ||
297 | struct mlx5_core_dev *mdev = priv->mdev; | ||
298 | int sz = MLX5_ST_SZ_BYTES(mpcnt_reg); | ||
299 | void *out; | ||
300 | u32 *in; | ||
301 | |||
302 | in = mlx5_vzalloc(sz); | ||
303 | if (!in) | ||
304 | return; | ||
305 | |||
306 | out = pcie_stats->pcie_perf_counters; | ||
307 | MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP); | ||
308 | mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); | ||
309 | |||
310 | out = pcie_stats->pcie_tas_counters; | ||
311 | MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP); | ||
312 | mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); | ||
313 | |||
314 | kvfree(in); | ||
315 | } | ||
316 | |||
317 | void mlx5e_update_stats(struct mlx5e_priv *priv) | 294 | void mlx5e_update_stats(struct mlx5e_priv *priv) |
318 | { | 295 | { |
319 | mlx5e_update_q_counter(priv); | 296 | mlx5e_update_q_counter(priv); |
320 | mlx5e_update_vport_counters(priv); | 297 | mlx5e_update_vport_counters(priv); |
321 | mlx5e_update_pport_counters(priv); | 298 | mlx5e_update_pport_counters(priv); |
322 | mlx5e_update_sw_counters(priv); | 299 | mlx5e_update_sw_counters(priv); |
323 | mlx5e_update_pcie_counters(priv); | ||
324 | } | 300 | } |
325 | 301 | ||
326 | void mlx5e_update_stats_work(struct work_struct *work) | 302 | void mlx5e_update_stats_work(struct work_struct *work) |
@@ -3805,14 +3781,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) | |||
3805 | 3781 | ||
3806 | mlx5_lag_add(mdev, netdev); | 3782 | mlx5_lag_add(mdev, netdev); |
3807 | 3783 | ||
3808 | if (mlx5e_vxlan_allowed(mdev)) { | ||
3809 | rtnl_lock(); | ||
3810 | udp_tunnel_get_rx_info(netdev); | ||
3811 | rtnl_unlock(); | ||
3812 | } | ||
3813 | |||
3814 | mlx5e_enable_async_events(priv); | 3784 | mlx5e_enable_async_events(priv); |
3815 | queue_work(priv->wq, &priv->set_rx_mode_work); | ||
3816 | 3785 | ||
3817 | if (MLX5_CAP_GEN(mdev, vport_group_manager)) { | 3786 | if (MLX5_CAP_GEN(mdev, vport_group_manager)) { |
3818 | mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id); | 3787 | mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id); |
@@ -3822,6 +3791,18 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) | |||
3822 | rep.netdev = netdev; | 3791 | rep.netdev = netdev; |
3823 | mlx5_eswitch_register_vport_rep(esw, 0, &rep); | 3792 | mlx5_eswitch_register_vport_rep(esw, 0, &rep); |
3824 | } | 3793 | } |
3794 | |||
3795 | if (netdev->reg_state != NETREG_REGISTERED) | ||
3796 | return; | ||
3797 | |||
3798 | /* Device already registered: sync netdev system state */ | ||
3799 | if (mlx5e_vxlan_allowed(mdev)) { | ||
3800 | rtnl_lock(); | ||
3801 | udp_tunnel_get_rx_info(netdev); | ||
3802 | rtnl_unlock(); | ||
3803 | } | ||
3804 | |||
3805 | queue_work(priv->wq, &priv->set_rx_mode_work); | ||
3825 | } | 3806 | } |
3826 | 3807 | ||
3827 | static void mlx5e_nic_disable(struct mlx5e_priv *priv) | 3808 | static void mlx5e_nic_disable(struct mlx5e_priv *priv) |
@@ -3966,10 +3947,6 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev) | |||
3966 | const struct mlx5e_profile *profile = priv->profile; | 3947 | const struct mlx5e_profile *profile = priv->profile; |
3967 | 3948 | ||
3968 | set_bit(MLX5E_STATE_DESTROYING, &priv->state); | 3949 | set_bit(MLX5E_STATE_DESTROYING, &priv->state); |
3969 | if (profile->disable) | ||
3970 | profile->disable(priv); | ||
3971 | |||
3972 | flush_workqueue(priv->wq); | ||
3973 | 3950 | ||
3974 | rtnl_lock(); | 3951 | rtnl_lock(); |
3975 | if (netif_running(netdev)) | 3952 | if (netif_running(netdev)) |
@@ -3977,6 +3954,10 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev) | |||
3977 | netif_device_detach(netdev); | 3954 | netif_device_detach(netdev); |
3978 | rtnl_unlock(); | 3955 | rtnl_unlock(); |
3979 | 3956 | ||
3957 | if (profile->disable) | ||
3958 | profile->disable(priv); | ||
3959 | flush_workqueue(priv->wq); | ||
3960 | |||
3980 | mlx5e_destroy_q_counter(priv); | 3961 | mlx5e_destroy_q_counter(priv); |
3981 | profile->cleanup_rx(priv); | 3962 | profile->cleanup_rx(priv); |
3982 | mlx5e_close_drop_rq(priv); | 3963 | mlx5e_close_drop_rq(priv); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h index f202f872f57f..ba5db1dd23a9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \ | 39 | #define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \ |
40 | (*(u32 *)((char *)ptr + dsc[i].offset)) | 40 | (*(u32 *)((char *)ptr + dsc[i].offset)) |
41 | #define MLX5E_READ_CTR32_BE(ptr, dsc, i) \ | 41 | #define MLX5E_READ_CTR32_BE(ptr, dsc, i) \ |
42 | be32_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset)) | 42 | be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset)) |
43 | 43 | ||
44 | #define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld) | 44 | #define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld) |
45 | #define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld) | 45 | #define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld) |
@@ -276,32 +276,6 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = { | |||
276 | { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, | 276 | { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, |
277 | }; | 277 | }; |
278 | 278 | ||
279 | #define PCIE_PERF_OFF(c) \ | ||
280 | MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c) | ||
281 | #define PCIE_PERF_GET(pcie_stats, c) \ | ||
282 | MLX5_GET(mpcnt_reg, pcie_stats->pcie_perf_counters, \ | ||
283 | counter_set.pcie_perf_cntrs_grp_data_layout.c) | ||
284 | #define PCIE_TAS_OFF(c) \ | ||
285 | MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_tas_cntrs_grp_data_layout.c) | ||
286 | #define PCIE_TAS_GET(pcie_stats, c) \ | ||
287 | MLX5_GET(mpcnt_reg, pcie_stats->pcie_tas_counters, \ | ||
288 | counter_set.pcie_tas_cntrs_grp_data_layout.c) | ||
289 | |||
290 | struct mlx5e_pcie_stats { | ||
291 | __be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)]; | ||
292 | __be64 pcie_tas_counters[MLX5_ST_SZ_QW(mpcnt_reg)]; | ||
293 | }; | ||
294 | |||
295 | static const struct counter_desc pcie_perf_stats_desc[] = { | ||
296 | { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) }, | ||
297 | { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) }, | ||
298 | }; | ||
299 | |||
300 | static const struct counter_desc pcie_tas_stats_desc[] = { | ||
301 | { "tx_pci_transport_nonfatal_msg", PCIE_TAS_OFF(non_fatal_err_msg_sent) }, | ||
302 | { "tx_pci_transport_fatal_msg", PCIE_TAS_OFF(fatal_err_msg_sent) }, | ||
303 | }; | ||
304 | |||
305 | struct mlx5e_rq_stats { | 279 | struct mlx5e_rq_stats { |
306 | u64 packets; | 280 | u64 packets; |
307 | u64 bytes; | 281 | u64 bytes; |
@@ -386,8 +360,6 @@ static const struct counter_desc sq_stats_desc[] = { | |||
386 | #define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc) | 360 | #define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc) |
387 | #define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc) | 361 | #define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc) |
388 | #define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc) | 362 | #define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc) |
389 | #define NUM_PCIE_PERF_COUNTERS ARRAY_SIZE(pcie_perf_stats_desc) | ||
390 | #define NUM_PCIE_TAS_COUNTERS ARRAY_SIZE(pcie_tas_stats_desc) | ||
391 | #define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \ | 363 | #define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \ |
392 | ARRAY_SIZE(pport_per_prio_traffic_stats_desc) | 364 | ARRAY_SIZE(pport_per_prio_traffic_stats_desc) |
393 | #define NUM_PPORT_PER_PRIO_PFC_COUNTERS \ | 365 | #define NUM_PPORT_PER_PRIO_PFC_COUNTERS \ |
@@ -397,7 +369,6 @@ static const struct counter_desc sq_stats_desc[] = { | |||
397 | NUM_PPORT_2819_COUNTERS + \ | 369 | NUM_PPORT_2819_COUNTERS + \ |
398 | NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \ | 370 | NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \ |
399 | NUM_PPORT_PRIO) | 371 | NUM_PPORT_PRIO) |
400 | #define NUM_PCIE_COUNTERS (NUM_PCIE_PERF_COUNTERS + NUM_PCIE_TAS_COUNTERS) | ||
401 | #define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc) | 372 | #define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc) |
402 | #define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc) | 373 | #define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc) |
403 | 374 | ||
@@ -406,7 +377,6 @@ struct mlx5e_stats { | |||
406 | struct mlx5e_qcounter_stats qcnt; | 377 | struct mlx5e_qcounter_stats qcnt; |
407 | struct mlx5e_vport_stats vport; | 378 | struct mlx5e_vport_stats vport; |
408 | struct mlx5e_pport_stats pport; | 379 | struct mlx5e_pport_stats pport; |
409 | struct mlx5e_pcie_stats pcie; | ||
410 | struct rtnl_link_stats64 vf_vport; | 380 | struct rtnl_link_stats64 vf_vport; |
411 | }; | 381 | }; |
412 | 382 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index d6807c3cc461..f14d9c9ba773 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, | |||
1860 | 1860 | ||
1861 | if (!ESW_ALLOWED(esw)) | 1861 | if (!ESW_ALLOWED(esw)) |
1862 | return -EPERM; | 1862 | return -EPERM; |
1863 | if (!LEGAL_VPORT(esw, vport)) | 1863 | if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac)) |
1864 | return -EINVAL; | 1864 | return -EINVAL; |
1865 | 1865 | ||
1866 | mutex_lock(&esw->state_lock); | 1866 | mutex_lock(&esw->state_lock); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 466e161010f7..03293ed1cc22 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | |||
@@ -695,6 +695,12 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports) | |||
695 | if (err) | 695 | if (err) |
696 | goto err_reps; | 696 | goto err_reps; |
697 | } | 697 | } |
698 | |||
699 | /* disable PF RoCE so missed packets don't go through RoCE steering */ | ||
700 | mlx5_dev_list_lock(); | ||
701 | mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); | ||
702 | mlx5_dev_list_unlock(); | ||
703 | |||
698 | return 0; | 704 | return 0; |
699 | 705 | ||
700 | err_reps: | 706 | err_reps: |
@@ -718,6 +724,11 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw) | |||
718 | { | 724 | { |
719 | int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; | 725 | int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; |
720 | 726 | ||
727 | /* enable back PF RoCE */ | ||
728 | mlx5_dev_list_lock(); | ||
729 | mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); | ||
730 | mlx5_dev_list_unlock(); | ||
731 | |||
721 | mlx5_eswitch_disable_sriov(esw); | 732 | mlx5_eswitch_disable_sriov(esw); |
722 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); | 733 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); |
723 | if (err) { | 734 | if (err) { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index a263d8904a4c..0ac7a2fc916c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | |||
@@ -1263,6 +1263,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg, | |||
1263 | nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD); | 1263 | nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD); |
1264 | handle = add_rule_fte(fte, fg, dest, dest_num, false); | 1264 | handle = add_rule_fte(fte, fg, dest, dest_num, false); |
1265 | if (IS_ERR(handle)) { | 1265 | if (IS_ERR(handle)) { |
1266 | unlock_ref_node(&fte->node); | ||
1266 | kfree(fte); | 1267 | kfree(fte); |
1267 | goto unlock_fg; | 1268 | goto unlock_fg; |
1268 | } | 1269 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 54e5a786f191..6547f22e6b9b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -503,6 +503,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) | |||
503 | MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size, | 503 | MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size, |
504 | to_fw_pkey_sz(dev, 128)); | 504 | to_fw_pkey_sz(dev, 128)); |
505 | 505 | ||
506 | /* Check log_max_qp from HCA caps to set in current profile */ | ||
507 | if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) { | ||
508 | mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n", | ||
509 | profile[prof_sel].log_max_qp, | ||
510 | MLX5_CAP_GEN_MAX(dev, log_max_qp)); | ||
511 | profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp); | ||
512 | } | ||
506 | if (prof->mask & MLX5_PROF_MASK_QP_SIZE) | 513 | if (prof->mask & MLX5_PROF_MASK_QP_SIZE) |
507 | MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp, | 514 | MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp, |
508 | prof->log_max_qp); | 515 | prof->log_max_qp); |
@@ -575,7 +582,6 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i) | |||
575 | struct mlx5_priv *priv = &mdev->priv; | 582 | struct mlx5_priv *priv = &mdev->priv; |
576 | struct msix_entry *msix = priv->msix_arr; | 583 | struct msix_entry *msix = priv->msix_arr; |
577 | int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector; | 584 | int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector; |
578 | int numa_node = priv->numa_node; | ||
579 | int err; | 585 | int err; |
580 | 586 | ||
581 | if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) { | 587 | if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) { |
@@ -583,7 +589,7 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i) | |||
583 | return -ENOMEM; | 589 | return -ENOMEM; |
584 | } | 590 | } |
585 | 591 | ||
586 | cpumask_set_cpu(cpumask_local_spread(i, numa_node), | 592 | cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node), |
587 | priv->irq_info[i].mask); | 593 | priv->irq_info[i].mask); |
588 | 594 | ||
589 | err = irq_set_affinity_hint(irq, priv->irq_info[i].mask); | 595 | err = irq_set_affinity_hint(irq, priv->irq_info[i].mask); |
@@ -1189,6 +1195,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, | |||
1189 | { | 1195 | { |
1190 | int err = 0; | 1196 | int err = 0; |
1191 | 1197 | ||
1198 | mlx5_drain_health_wq(dev); | ||
1199 | |||
1192 | mutex_lock(&dev->intf_state_mutex); | 1200 | mutex_lock(&dev->intf_state_mutex); |
1193 | if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { | 1201 | if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { |
1194 | dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", | 1202 | dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", |
@@ -1351,10 +1359,9 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, | |||
1351 | 1359 | ||
1352 | mlx5_enter_error_state(dev); | 1360 | mlx5_enter_error_state(dev); |
1353 | mlx5_unload_one(dev, priv, false); | 1361 | mlx5_unload_one(dev, priv, false); |
1354 | /* In case of kernel call save the pci state and drain health wq */ | 1362 | /* In case of kernel call save the pci state */ |
1355 | if (state) { | 1363 | if (state) { |
1356 | pci_save_state(pdev); | 1364 | pci_save_state(pdev); |
1357 | mlx5_drain_health_wq(dev); | ||
1358 | mlx5_pci_disable_device(dev); | 1365 | mlx5_pci_disable_device(dev); |
1359 | } | 1366 | } |
1360 | 1367 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index f9b97f5946f8..44389c90056a 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -326,6 +326,7 @@ enum cfg_version { | |||
326 | static const struct pci_device_id rtl8169_pci_tbl[] = { | 326 | static const struct pci_device_id rtl8169_pci_tbl[] = { |
327 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 }, | 327 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 }, |
328 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 }, | 328 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 }, |
329 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 }, | ||
329 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, | 330 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, |
330 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 }, | 331 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 }, |
331 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, | 332 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index f341c1bc7001..00fafabab1d0 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -819,6 +819,7 @@ static struct sh_eth_cpu_data sh7734_data = { | |||
819 | .tsu = 1, | 819 | .tsu = 1, |
820 | .hw_crc = 1, | 820 | .hw_crc = 1, |
821 | .select_mii = 1, | 821 | .select_mii = 1, |
822 | .shift_rd0 = 1, | ||
822 | }; | 823 | }; |
823 | 824 | ||
824 | /* SH7763 */ | 825 | /* SH7763 */ |
@@ -1656,7 +1657,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
1656 | else | 1657 | else |
1657 | goto out; | 1658 | goto out; |
1658 | 1659 | ||
1659 | if (!likely(mdp->irq_enabled)) { | 1660 | if (unlikely(!mdp->irq_enabled)) { |
1660 | sh_eth_write(ndev, 0, EESIPR); | 1661 | sh_eth_write(ndev, 0, EESIPR); |
1661 | goto out; | 1662 | goto out; |
1662 | } | 1663 | } |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index de2947ccc5ad..5eb0e684fd76 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -1323,7 +1323,8 @@ static int efx_ef10_init_nic(struct efx_nic *efx) | |||
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | /* don't fail init if RSS setup doesn't work */ | 1325 | /* don't fail init if RSS setup doesn't work */ |
1326 | efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table); | 1326 | rc = efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table); |
1327 | efx->rss_active = (rc == 0); | ||
1327 | 1328 | ||
1328 | return 0; | 1329 | return 0; |
1329 | } | 1330 | } |
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c index 87bdc56b4e3a..18ebaea44e82 100644 --- a/drivers/net/ethernet/sfc/ethtool.c +++ b/drivers/net/ethernet/sfc/ethtool.c | |||
@@ -975,6 +975,8 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev, | |||
975 | 975 | ||
976 | case ETHTOOL_GRXFH: { | 976 | case ETHTOOL_GRXFH: { |
977 | info->data = 0; | 977 | info->data = 0; |
978 | if (!efx->rss_active) /* No RSS */ | ||
979 | return 0; | ||
978 | switch (info->flow_type) { | 980 | switch (info->flow_type) { |
979 | case UDP_V4_FLOW: | 981 | case UDP_V4_FLOW: |
980 | if (efx->rx_hash_udp_4tuple) | 982 | if (efx->rx_hash_udp_4tuple) |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 1a635ced62d0..1c62c1a00fca 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -860,6 +860,7 @@ struct vfdi_status; | |||
860 | * @rx_hash_key: Toeplitz hash key for RSS | 860 | * @rx_hash_key: Toeplitz hash key for RSS |
861 | * @rx_indir_table: Indirection table for RSS | 861 | * @rx_indir_table: Indirection table for RSS |
862 | * @rx_scatter: Scatter mode enabled for receives | 862 | * @rx_scatter: Scatter mode enabled for receives |
863 | * @rss_active: RSS enabled on hardware | ||
863 | * @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled | 864 | * @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled |
864 | * @int_error_count: Number of internal errors seen recently | 865 | * @int_error_count: Number of internal errors seen recently |
865 | * @int_error_expire: Time at which error count will be expired | 866 | * @int_error_expire: Time at which error count will be expired |
@@ -998,6 +999,7 @@ struct efx_nic { | |||
998 | u8 rx_hash_key[40]; | 999 | u8 rx_hash_key[40]; |
999 | u32 rx_indir_table[128]; | 1000 | u32 rx_indir_table[128]; |
1000 | bool rx_scatter; | 1001 | bool rx_scatter; |
1002 | bool rss_active; | ||
1001 | bool rx_hash_udp_4tuple; | 1003 | bool rx_hash_udp_4tuple; |
1002 | 1004 | ||
1003 | unsigned int_error_count; | 1005 | unsigned int_error_count; |
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c index a3901bc96586..4e54e5dc9fcb 100644 --- a/drivers/net/ethernet/sfc/siena.c +++ b/drivers/net/ethernet/sfc/siena.c | |||
@@ -403,6 +403,7 @@ static int siena_init_nic(struct efx_nic *efx) | |||
403 | efx_writeo(efx, &temp, FR_AZ_RX_CFG); | 403 | efx_writeo(efx, &temp, FR_AZ_RX_CFG); |
404 | 404 | ||
405 | siena_rx_push_rss_config(efx, false, efx->rx_indir_table); | 405 | siena_rx_push_rss_config(efx, false, efx->rx_indir_table); |
406 | efx->rss_active = true; | ||
406 | 407 | ||
407 | /* Enable event logging */ | 408 | /* Enable event logging */ |
408 | rc = efx_mcdi_log_ctrl(efx, true, false, 0); | 409 | rc = efx_mcdi_log_ctrl(efx, true, false, 0); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c index c35597586121..3dc7d279f805 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | |||
@@ -60,8 +60,9 @@ struct oxnas_dwmac { | |||
60 | struct regmap *regmap; | 60 | struct regmap *regmap; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac) | 63 | static int oxnas_dwmac_init(struct platform_device *pdev, void *priv) |
64 | { | 64 | { |
65 | struct oxnas_dwmac *dwmac = priv; | ||
65 | unsigned int value; | 66 | unsigned int value; |
66 | int ret; | 67 | int ret; |
67 | 68 | ||
@@ -105,20 +106,20 @@ static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac) | |||
105 | return 0; | 106 | return 0; |
106 | } | 107 | } |
107 | 108 | ||
109 | static void oxnas_dwmac_exit(struct platform_device *pdev, void *priv) | ||
110 | { | ||
111 | struct oxnas_dwmac *dwmac = priv; | ||
112 | |||
113 | clk_disable_unprepare(dwmac->clk); | ||
114 | } | ||
115 | |||
108 | static int oxnas_dwmac_probe(struct platform_device *pdev) | 116 | static int oxnas_dwmac_probe(struct platform_device *pdev) |
109 | { | 117 | { |
110 | struct plat_stmmacenet_data *plat_dat; | 118 | struct plat_stmmacenet_data *plat_dat; |
111 | struct stmmac_resources stmmac_res; | 119 | struct stmmac_resources stmmac_res; |
112 | struct device_node *sysctrl; | ||
113 | struct oxnas_dwmac *dwmac; | 120 | struct oxnas_dwmac *dwmac; |
114 | int ret; | 121 | int ret; |
115 | 122 | ||
116 | sysctrl = of_parse_phandle(pdev->dev.of_node, "oxsemi,sys-ctrl", 0); | ||
117 | if (!sysctrl) { | ||
118 | dev_err(&pdev->dev, "failed to get sys-ctrl node\n"); | ||
119 | return -EINVAL; | ||
120 | } | ||
121 | |||
122 | ret = stmmac_get_platform_resources(pdev, &stmmac_res); | 123 | ret = stmmac_get_platform_resources(pdev, &stmmac_res); |
123 | if (ret) | 124 | if (ret) |
124 | return ret; | 125 | return ret; |
@@ -128,72 +129,48 @@ static int oxnas_dwmac_probe(struct platform_device *pdev) | |||
128 | return PTR_ERR(plat_dat); | 129 | return PTR_ERR(plat_dat); |
129 | 130 | ||
130 | dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); | 131 | dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); |
131 | if (!dwmac) | 132 | if (!dwmac) { |
132 | return -ENOMEM; | 133 | ret = -ENOMEM; |
134 | goto err_remove_config_dt; | ||
135 | } | ||
133 | 136 | ||
134 | dwmac->dev = &pdev->dev; | 137 | dwmac->dev = &pdev->dev; |
135 | plat_dat->bsp_priv = dwmac; | 138 | plat_dat->bsp_priv = dwmac; |
139 | plat_dat->init = oxnas_dwmac_init; | ||
140 | plat_dat->exit = oxnas_dwmac_exit; | ||
136 | 141 | ||
137 | dwmac->regmap = syscon_node_to_regmap(sysctrl); | 142 | dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, |
143 | "oxsemi,sys-ctrl"); | ||
138 | if (IS_ERR(dwmac->regmap)) { | 144 | if (IS_ERR(dwmac->regmap)) { |
139 | dev_err(&pdev->dev, "failed to have sysctrl regmap\n"); | 145 | dev_err(&pdev->dev, "failed to have sysctrl regmap\n"); |
140 | return PTR_ERR(dwmac->regmap); | 146 | ret = PTR_ERR(dwmac->regmap); |
147 | goto err_remove_config_dt; | ||
141 | } | 148 | } |
142 | 149 | ||
143 | dwmac->clk = devm_clk_get(&pdev->dev, "gmac"); | 150 | dwmac->clk = devm_clk_get(&pdev->dev, "gmac"); |
144 | if (IS_ERR(dwmac->clk)) | 151 | if (IS_ERR(dwmac->clk)) { |
145 | return PTR_ERR(dwmac->clk); | 152 | ret = PTR_ERR(dwmac->clk); |
153 | goto err_remove_config_dt; | ||
154 | } | ||
146 | 155 | ||
147 | ret = oxnas_dwmac_init(dwmac); | 156 | ret = oxnas_dwmac_init(pdev, plat_dat->bsp_priv); |
148 | if (ret) | 157 | if (ret) |
149 | return ret; | 158 | goto err_remove_config_dt; |
150 | 159 | ||
151 | ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); | 160 | ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
152 | if (ret) | 161 | if (ret) |
153 | clk_disable_unprepare(dwmac->clk); | 162 | goto err_dwmac_exit; |
154 | 163 | ||
155 | return ret; | ||
156 | } | ||
157 | 164 | ||
158 | static int oxnas_dwmac_remove(struct platform_device *pdev) | 165 | return 0; |
159 | { | ||
160 | struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev); | ||
161 | int ret = stmmac_dvr_remove(&pdev->dev); | ||
162 | |||
163 | clk_disable_unprepare(dwmac->clk); | ||
164 | |||
165 | return ret; | ||
166 | } | ||
167 | |||
168 | #ifdef CONFIG_PM_SLEEP | ||
169 | static int oxnas_dwmac_suspend(struct device *dev) | ||
170 | { | ||
171 | struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev); | ||
172 | int ret; | ||
173 | |||
174 | ret = stmmac_suspend(dev); | ||
175 | clk_disable_unprepare(dwmac->clk); | ||
176 | |||
177 | return ret; | ||
178 | } | ||
179 | |||
180 | static int oxnas_dwmac_resume(struct device *dev) | ||
181 | { | ||
182 | struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev); | ||
183 | int ret; | ||
184 | |||
185 | ret = oxnas_dwmac_init(dwmac); | ||
186 | if (ret) | ||
187 | return ret; | ||
188 | 166 | ||
189 | ret = stmmac_resume(dev); | 167 | err_dwmac_exit: |
168 | oxnas_dwmac_exit(pdev, plat_dat->bsp_priv); | ||
169 | err_remove_config_dt: | ||
170 | stmmac_remove_config_dt(pdev, plat_dat); | ||
190 | 171 | ||
191 | return ret; | 172 | return ret; |
192 | } | 173 | } |
193 | #endif /* CONFIG_PM_SLEEP */ | ||
194 | |||
195 | static SIMPLE_DEV_PM_OPS(oxnas_dwmac_pm_ops, | ||
196 | oxnas_dwmac_suspend, oxnas_dwmac_resume); | ||
197 | 174 | ||
198 | static const struct of_device_id oxnas_dwmac_match[] = { | 175 | static const struct of_device_id oxnas_dwmac_match[] = { |
199 | { .compatible = "oxsemi,ox820-dwmac" }, | 176 | { .compatible = "oxsemi,ox820-dwmac" }, |
@@ -203,10 +180,10 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match); | |||
203 | 180 | ||
204 | static struct platform_driver oxnas_dwmac_driver = { | 181 | static struct platform_driver oxnas_dwmac_driver = { |
205 | .probe = oxnas_dwmac_probe, | 182 | .probe = oxnas_dwmac_probe, |
206 | .remove = oxnas_dwmac_remove, | 183 | .remove = stmmac_pltfr_remove, |
207 | .driver = { | 184 | .driver = { |
208 | .name = "oxnas-dwmac", | 185 | .name = "oxnas-dwmac", |
209 | .pm = &oxnas_dwmac_pm_ops, | 186 | .pm = &stmmac_pltfr_pm_ops, |
210 | .of_match_table = oxnas_dwmac_match, | 187 | .of_match_table = oxnas_dwmac_match, |
211 | }, | 188 | }, |
212 | }; | 189 | }; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index bb40382e205d..39eb7a65bb9f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -3339,13 +3339,6 @@ int stmmac_dvr_probe(struct device *device, | |||
3339 | 3339 | ||
3340 | spin_lock_init(&priv->lock); | 3340 | spin_lock_init(&priv->lock); |
3341 | 3341 | ||
3342 | ret = register_netdev(ndev); | ||
3343 | if (ret) { | ||
3344 | netdev_err(priv->dev, "%s: ERROR %i registering the device\n", | ||
3345 | __func__, ret); | ||
3346 | goto error_netdev_register; | ||
3347 | } | ||
3348 | |||
3349 | /* If a specific clk_csr value is passed from the platform | 3342 | /* If a specific clk_csr value is passed from the platform |
3350 | * this means that the CSR Clock Range selection cannot be | 3343 | * this means that the CSR Clock Range selection cannot be |
3351 | * changed at run-time and it is fixed. Viceversa the driver'll try to | 3344 | * changed at run-time and it is fixed. Viceversa the driver'll try to |
@@ -3372,11 +3365,21 @@ int stmmac_dvr_probe(struct device *device, | |||
3372 | } | 3365 | } |
3373 | } | 3366 | } |
3374 | 3367 | ||
3375 | return 0; | 3368 | ret = register_netdev(ndev); |
3369 | if (ret) { | ||
3370 | netdev_err(priv->dev, "%s: ERROR %i registering the device\n", | ||
3371 | __func__, ret); | ||
3372 | goto error_netdev_register; | ||
3373 | } | ||
3374 | |||
3375 | return ret; | ||
3376 | 3376 | ||
3377 | error_mdio_register: | ||
3378 | unregister_netdev(ndev); | ||
3379 | error_netdev_register: | 3377 | error_netdev_register: |
3378 | if (priv->hw->pcs != STMMAC_PCS_RGMII && | ||
3379 | priv->hw->pcs != STMMAC_PCS_TBI && | ||
3380 | priv->hw->pcs != STMMAC_PCS_RTBI) | ||
3381 | stmmac_mdio_unregister(ndev); | ||
3382 | error_mdio_register: | ||
3380 | netif_napi_del(&priv->napi); | 3383 | netif_napi_del(&priv->napi); |
3381 | error_hw_init: | 3384 | error_hw_init: |
3382 | clk_disable_unprepare(priv->pclk); | 3385 | clk_disable_unprepare(priv->pclk); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index fda01f770eff..b0344c213752 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | |||
@@ -116,7 +116,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, | |||
116 | unsigned int mii_address = priv->hw->mii.addr; | 116 | unsigned int mii_address = priv->hw->mii.addr; |
117 | unsigned int mii_data = priv->hw->mii.data; | 117 | unsigned int mii_data = priv->hw->mii.data; |
118 | 118 | ||
119 | u32 value = MII_WRITE | MII_BUSY; | 119 | u32 value = MII_BUSY; |
120 | 120 | ||
121 | value |= (phyaddr << priv->hw->mii.addr_shift) | 121 | value |= (phyaddr << priv->hw->mii.addr_shift) |
122 | & priv->hw->mii.addr_mask; | 122 | & priv->hw->mii.addr_mask; |
@@ -126,6 +126,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, | |||
126 | & priv->hw->mii.clk_csr_mask; | 126 | & priv->hw->mii.clk_csr_mask; |
127 | if (priv->plat->has_gmac4) | 127 | if (priv->plat->has_gmac4) |
128 | value |= MII_GMAC4_WRITE; | 128 | value |= MII_GMAC4_WRITE; |
129 | else | ||
130 | value |= MII_WRITE; | ||
129 | 131 | ||
130 | /* Wait until any existing MII operation is complete */ | 132 | /* Wait until any existing MII operation is complete */ |
131 | if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address)) | 133 | if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address)) |
diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h index 031093e1c25f..dbfbb33ac66c 100644 --- a/drivers/net/ipvlan/ipvlan.h +++ b/drivers/net/ipvlan/ipvlan.h | |||
@@ -99,6 +99,11 @@ struct ipvl_port { | |||
99 | int count; | 99 | int count; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | struct ipvl_skb_cb { | ||
103 | bool tx_pkt; | ||
104 | }; | ||
105 | #define IPVL_SKB_CB(_skb) ((struct ipvl_skb_cb *)&((_skb)->cb[0])) | ||
106 | |||
102 | static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d) | 107 | static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d) |
103 | { | 108 | { |
104 | return rcu_dereference(d->rx_handler_data); | 109 | return rcu_dereference(d->rx_handler_data); |
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index b4e990743e1d..83ce74acf82d 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c | |||
@@ -198,7 +198,7 @@ void ipvlan_process_multicast(struct work_struct *work) | |||
198 | unsigned int mac_hash; | 198 | unsigned int mac_hash; |
199 | int ret; | 199 | int ret; |
200 | u8 pkt_type; | 200 | u8 pkt_type; |
201 | bool hlocal, dlocal; | 201 | bool tx_pkt; |
202 | 202 | ||
203 | __skb_queue_head_init(&list); | 203 | __skb_queue_head_init(&list); |
204 | 204 | ||
@@ -207,8 +207,11 @@ void ipvlan_process_multicast(struct work_struct *work) | |||
207 | spin_unlock_bh(&port->backlog.lock); | 207 | spin_unlock_bh(&port->backlog.lock); |
208 | 208 | ||
209 | while ((skb = __skb_dequeue(&list)) != NULL) { | 209 | while ((skb = __skb_dequeue(&list)) != NULL) { |
210 | struct net_device *dev = skb->dev; | ||
211 | bool consumed = false; | ||
212 | |||
210 | ethh = eth_hdr(skb); | 213 | ethh = eth_hdr(skb); |
211 | hlocal = ether_addr_equal(ethh->h_source, port->dev->dev_addr); | 214 | tx_pkt = IPVL_SKB_CB(skb)->tx_pkt; |
212 | mac_hash = ipvlan_mac_hash(ethh->h_dest); | 215 | mac_hash = ipvlan_mac_hash(ethh->h_dest); |
213 | 216 | ||
214 | if (ether_addr_equal(ethh->h_dest, port->dev->broadcast)) | 217 | if (ether_addr_equal(ethh->h_dest, port->dev->broadcast)) |
@@ -216,41 +219,45 @@ void ipvlan_process_multicast(struct work_struct *work) | |||
216 | else | 219 | else |
217 | pkt_type = PACKET_MULTICAST; | 220 | pkt_type = PACKET_MULTICAST; |
218 | 221 | ||
219 | dlocal = false; | ||
220 | rcu_read_lock(); | 222 | rcu_read_lock(); |
221 | list_for_each_entry_rcu(ipvlan, &port->ipvlans, pnode) { | 223 | list_for_each_entry_rcu(ipvlan, &port->ipvlans, pnode) { |
222 | if (hlocal && (ipvlan->dev == skb->dev)) { | 224 | if (tx_pkt && (ipvlan->dev == skb->dev)) |
223 | dlocal = true; | ||
224 | continue; | 225 | continue; |
225 | } | ||
226 | if (!test_bit(mac_hash, ipvlan->mac_filters)) | 226 | if (!test_bit(mac_hash, ipvlan->mac_filters)) |
227 | continue; | 227 | continue; |
228 | 228 | if (!(ipvlan->dev->flags & IFF_UP)) | |
229 | continue; | ||
229 | ret = NET_RX_DROP; | 230 | ret = NET_RX_DROP; |
230 | len = skb->len + ETH_HLEN; | 231 | len = skb->len + ETH_HLEN; |
231 | nskb = skb_clone(skb, GFP_ATOMIC); | 232 | nskb = skb_clone(skb, GFP_ATOMIC); |
232 | if (!nskb) | 233 | local_bh_disable(); |
233 | goto acct; | 234 | if (nskb) { |
234 | 235 | consumed = true; | |
235 | nskb->pkt_type = pkt_type; | 236 | nskb->pkt_type = pkt_type; |
236 | nskb->dev = ipvlan->dev; | 237 | nskb->dev = ipvlan->dev; |
237 | if (hlocal) | 238 | if (tx_pkt) |
238 | ret = dev_forward_skb(ipvlan->dev, nskb); | 239 | ret = dev_forward_skb(ipvlan->dev, nskb); |
239 | else | 240 | else |
240 | ret = netif_rx(nskb); | 241 | ret = netif_rx(nskb); |
241 | acct: | 242 | } |
242 | ipvlan_count_rx(ipvlan, len, ret == NET_RX_SUCCESS, true); | 243 | ipvlan_count_rx(ipvlan, len, ret == NET_RX_SUCCESS, true); |
244 | local_bh_enable(); | ||
243 | } | 245 | } |
244 | rcu_read_unlock(); | 246 | rcu_read_unlock(); |
245 | 247 | ||
246 | if (dlocal) { | 248 | if (tx_pkt) { |
247 | /* If the packet originated here, send it out. */ | 249 | /* If the packet originated here, send it out. */ |
248 | skb->dev = port->dev; | 250 | skb->dev = port->dev; |
249 | skb->pkt_type = pkt_type; | 251 | skb->pkt_type = pkt_type; |
250 | dev_queue_xmit(skb); | 252 | dev_queue_xmit(skb); |
251 | } else { | 253 | } else { |
252 | kfree_skb(skb); | 254 | if (consumed) |
255 | consume_skb(skb); | ||
256 | else | ||
257 | kfree_skb(skb); | ||
253 | } | 258 | } |
259 | if (dev) | ||
260 | dev_put(dev); | ||
254 | } | 261 | } |
255 | } | 262 | } |
256 | 263 | ||
@@ -470,15 +477,24 @@ out: | |||
470 | } | 477 | } |
471 | 478 | ||
472 | static void ipvlan_multicast_enqueue(struct ipvl_port *port, | 479 | static void ipvlan_multicast_enqueue(struct ipvl_port *port, |
473 | struct sk_buff *skb) | 480 | struct sk_buff *skb, bool tx_pkt) |
474 | { | 481 | { |
475 | if (skb->protocol == htons(ETH_P_PAUSE)) { | 482 | if (skb->protocol == htons(ETH_P_PAUSE)) { |
476 | kfree_skb(skb); | 483 | kfree_skb(skb); |
477 | return; | 484 | return; |
478 | } | 485 | } |
479 | 486 | ||
487 | /* Record that the deferred packet is from TX or RX path. By | ||
488 | * looking at mac-addresses on packet will lead to erronus decisions. | ||
489 | * (This would be true for a loopback-mode on master device or a | ||
490 | * hair-pin mode of the switch.) | ||
491 | */ | ||
492 | IPVL_SKB_CB(skb)->tx_pkt = tx_pkt; | ||
493 | |||
480 | spin_lock(&port->backlog.lock); | 494 | spin_lock(&port->backlog.lock); |
481 | if (skb_queue_len(&port->backlog) < IPVLAN_QBACKLOG_LIMIT) { | 495 | if (skb_queue_len(&port->backlog) < IPVLAN_QBACKLOG_LIMIT) { |
496 | if (skb->dev) | ||
497 | dev_hold(skb->dev); | ||
482 | __skb_queue_tail(&port->backlog, skb); | 498 | __skb_queue_tail(&port->backlog, skb); |
483 | spin_unlock(&port->backlog.lock); | 499 | spin_unlock(&port->backlog.lock); |
484 | schedule_work(&port->wq); | 500 | schedule_work(&port->wq); |
@@ -537,7 +553,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) | |||
537 | 553 | ||
538 | } else if (is_multicast_ether_addr(eth->h_dest)) { | 554 | } else if (is_multicast_ether_addr(eth->h_dest)) { |
539 | ipvlan_skb_crossing_ns(skb, NULL); | 555 | ipvlan_skb_crossing_ns(skb, NULL); |
540 | ipvlan_multicast_enqueue(ipvlan->port, skb); | 556 | ipvlan_multicast_enqueue(ipvlan->port, skb, true); |
541 | return NET_XMIT_SUCCESS; | 557 | return NET_XMIT_SUCCESS; |
542 | } | 558 | } |
543 | 559 | ||
@@ -634,7 +650,7 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb, | |||
634 | */ | 650 | */ |
635 | if (nskb) { | 651 | if (nskb) { |
636 | ipvlan_skb_crossing_ns(nskb, NULL); | 652 | ipvlan_skb_crossing_ns(nskb, NULL); |
637 | ipvlan_multicast_enqueue(port, nskb); | 653 | ipvlan_multicast_enqueue(port, nskb, false); |
638 | } | 654 | } |
639 | } | 655 | } |
640 | } else { | 656 | } else { |
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 693ec5b66222..8b0f99300cbc 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c | |||
@@ -135,6 +135,7 @@ err: | |||
135 | static void ipvlan_port_destroy(struct net_device *dev) | 135 | static void ipvlan_port_destroy(struct net_device *dev) |
136 | { | 136 | { |
137 | struct ipvl_port *port = ipvlan_port_get_rtnl(dev); | 137 | struct ipvl_port *port = ipvlan_port_get_rtnl(dev); |
138 | struct sk_buff *skb; | ||
138 | 139 | ||
139 | dev->priv_flags &= ~IFF_IPVLAN_MASTER; | 140 | dev->priv_flags &= ~IFF_IPVLAN_MASTER; |
140 | if (port->mode == IPVLAN_MODE_L3S) { | 141 | if (port->mode == IPVLAN_MODE_L3S) { |
@@ -144,7 +145,11 @@ static void ipvlan_port_destroy(struct net_device *dev) | |||
144 | } | 145 | } |
145 | netdev_rx_handler_unregister(dev); | 146 | netdev_rx_handler_unregister(dev); |
146 | cancel_work_sync(&port->wq); | 147 | cancel_work_sync(&port->wq); |
147 | __skb_queue_purge(&port->backlog); | 148 | while ((skb = __skb_dequeue(&port->backlog)) != NULL) { |
149 | if (skb->dev) | ||
150 | dev_put(skb->dev); | ||
151 | kfree_skb(skb); | ||
152 | } | ||
148 | kfree(port); | 153 | kfree(port); |
149 | } | 154 | } |
150 | 155 | ||
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 6c646e228833..6e98ede997d3 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -1367,6 +1367,7 @@ static struct usb_driver asix_driver = { | |||
1367 | .probe = usbnet_probe, | 1367 | .probe = usbnet_probe, |
1368 | .suspend = asix_suspend, | 1368 | .suspend = asix_suspend, |
1369 | .resume = asix_resume, | 1369 | .resume = asix_resume, |
1370 | .reset_resume = asix_resume, | ||
1370 | .disconnect = usbnet_disconnect, | 1371 | .disconnect = usbnet_disconnect, |
1371 | .supports_autosuspend = 1, | 1372 | .supports_autosuspend = 1, |
1372 | .disable_hub_initiated_lpm = 1, | 1373 | .disable_hub_initiated_lpm = 1, |
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 7532646c3b7b..23dfb0eac098 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c | |||
@@ -967,6 +967,7 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev, | |||
967 | */ | 967 | */ |
968 | need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); | 968 | need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); |
969 | if (!ipv6_ndisc_frame(skb) && !need_strict) { | 969 | if (!ipv6_ndisc_frame(skb) && !need_strict) { |
970 | vrf_rx_stats(vrf_dev, skb->len); | ||
970 | skb->dev = vrf_dev; | 971 | skb->dev = vrf_dev; |
971 | skb->skb_iif = vrf_dev->ifindex; | 972 | skb->skb_iif = vrf_dev->ifindex; |
972 | 973 | ||
@@ -1011,6 +1012,8 @@ static struct sk_buff *vrf_ip_rcv(struct net_device *vrf_dev, | |||
1011 | goto out; | 1012 | goto out; |
1012 | } | 1013 | } |
1013 | 1014 | ||
1015 | vrf_rx_stats(vrf_dev, skb->len); | ||
1016 | |||
1014 | skb_push(skb, skb->mac_len); | 1017 | skb_push(skb, skb->mac_len); |
1015 | dev_queue_xmit_nit(skb, vrf_dev); | 1018 | dev_queue_xmit_nit(skb, vrf_dev); |
1016 | skb_pull(skb, skb->mac_len); | 1019 | skb_pull(skb, skb->mac_len); |
diff --git a/drivers/net/wan/slic_ds26522.c b/drivers/net/wan/slic_ds26522.c index b776a0ab106c..9d9b4e0def2a 100644 --- a/drivers/net/wan/slic_ds26522.c +++ b/drivers/net/wan/slic_ds26522.c | |||
@@ -218,7 +218,7 @@ static int slic_ds26522_probe(struct spi_device *spi) | |||
218 | 218 | ||
219 | ret = slic_ds26522_init_configure(spi); | 219 | ret = slic_ds26522_init_configure(spi); |
220 | if (ret == 0) | 220 | if (ret == 0) |
221 | pr_info("DS26522 cs%d configurated\n", spi->chip_select); | 221 | pr_info("DS26522 cs%d configured\n", spi->chip_select); |
222 | 222 | ||
223 | return ret; | 223 | return ret; |
224 | } | 224 | } |
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index b40cfb076f02..2fc86dc7a8df 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
@@ -1193,8 +1193,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl, | |||
1193 | blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors); | 1193 | blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors); |
1194 | blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX)); | 1194 | blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX)); |
1195 | } | 1195 | } |
1196 | if (ctrl->stripe_size) | 1196 | if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) |
1197 | blk_queue_chunk_sectors(q, ctrl->stripe_size >> 9); | 1197 | blk_queue_chunk_sectors(q, ctrl->max_hw_sectors); |
1198 | blk_queue_virt_boundary(q, ctrl->page_size - 1); | 1198 | blk_queue_virt_boundary(q, ctrl->page_size - 1); |
1199 | if (ctrl->vwc & NVME_CTRL_VWC_PRESENT) | 1199 | if (ctrl->vwc & NVME_CTRL_VWC_PRESENT) |
1200 | vwc = true; | 1200 | vwc = true; |
@@ -1250,19 +1250,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) | |||
1250 | ctrl->max_hw_sectors = | 1250 | ctrl->max_hw_sectors = |
1251 | min_not_zero(ctrl->max_hw_sectors, max_hw_sectors); | 1251 | min_not_zero(ctrl->max_hw_sectors, max_hw_sectors); |
1252 | 1252 | ||
1253 | if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && id->vs[3]) { | ||
1254 | unsigned int max_hw_sectors; | ||
1255 | |||
1256 | ctrl->stripe_size = 1 << (id->vs[3] + page_shift); | ||
1257 | max_hw_sectors = ctrl->stripe_size >> (page_shift - 9); | ||
1258 | if (ctrl->max_hw_sectors) { | ||
1259 | ctrl->max_hw_sectors = min(max_hw_sectors, | ||
1260 | ctrl->max_hw_sectors); | ||
1261 | } else { | ||
1262 | ctrl->max_hw_sectors = max_hw_sectors; | ||
1263 | } | ||
1264 | } | ||
1265 | |||
1266 | nvme_set_queue_limits(ctrl, ctrl->admin_q); | 1253 | nvme_set_queue_limits(ctrl, ctrl->admin_q); |
1267 | ctrl->sgls = le32_to_cpu(id->sgls); | 1254 | ctrl->sgls = le32_to_cpu(id->sgls); |
1268 | ctrl->kas = le16_to_cpu(id->kas); | 1255 | ctrl->kas = le16_to_cpu(id->kas); |
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 771e2e761872..aa0bc60810a7 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
@@ -1491,19 +1491,20 @@ static int | |||
1491 | nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) | 1491 | nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) |
1492 | { | 1492 | { |
1493 | struct nvme_fc_queue *queue = &ctrl->queues[1]; | 1493 | struct nvme_fc_queue *queue = &ctrl->queues[1]; |
1494 | int i, j, ret; | 1494 | int i, ret; |
1495 | 1495 | ||
1496 | for (i = 1; i < ctrl->queue_count; i++, queue++) { | 1496 | for (i = 1; i < ctrl->queue_count; i++, queue++) { |
1497 | ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize); | 1497 | ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize); |
1498 | if (ret) { | 1498 | if (ret) |
1499 | for (j = i-1; j >= 0; j--) | 1499 | goto delete_queues; |
1500 | __nvme_fc_delete_hw_queue(ctrl, | ||
1501 | &ctrl->queues[j], j); | ||
1502 | return ret; | ||
1503 | } | ||
1504 | } | 1500 | } |
1505 | 1501 | ||
1506 | return 0; | 1502 | return 0; |
1503 | |||
1504 | delete_queues: | ||
1505 | for (; i >= 0; i--) | ||
1506 | __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i); | ||
1507 | return ret; | ||
1507 | } | 1508 | } |
1508 | 1509 | ||
1509 | static int | 1510 | static int |
@@ -2401,8 +2402,8 @@ __nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, | |||
2401 | WARN_ON_ONCE(!changed); | 2402 | WARN_ON_ONCE(!changed); |
2402 | 2403 | ||
2403 | dev_info(ctrl->ctrl.device, | 2404 | dev_info(ctrl->ctrl.device, |
2404 | "NVME-FC{%d}: new ctrl: NQN \"%s\" (%p)\n", | 2405 | "NVME-FC{%d}: new ctrl: NQN \"%s\"\n", |
2405 | ctrl->cnum, ctrl->ctrl.opts->subsysnqn, &ctrl); | 2406 | ctrl->cnum, ctrl->ctrl.opts->subsysnqn); |
2406 | 2407 | ||
2407 | kref_get(&ctrl->ctrl.kref); | 2408 | kref_get(&ctrl->ctrl.kref); |
2408 | 2409 | ||
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index bd5321441d12..6377e14586dc 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h | |||
@@ -135,7 +135,6 @@ struct nvme_ctrl { | |||
135 | 135 | ||
136 | u32 page_size; | 136 | u32 page_size; |
137 | u32 max_hw_sectors; | 137 | u32 max_hw_sectors; |
138 | u32 stripe_size; | ||
139 | u16 oncs; | 138 | u16 oncs; |
140 | u16 vid; | 139 | u16 vid; |
141 | atomic_t abort_limit; | 140 | atomic_t abort_limit; |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 3d21a154dce7..19beeb7b2ac2 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -712,15 +712,8 @@ static void __nvme_process_cq(struct nvme_queue *nvmeq, unsigned int *tag) | |||
712 | req = blk_mq_tag_to_rq(*nvmeq->tags, cqe.command_id); | 712 | req = blk_mq_tag_to_rq(*nvmeq->tags, cqe.command_id); |
713 | nvme_req(req)->result = cqe.result; | 713 | nvme_req(req)->result = cqe.result; |
714 | blk_mq_complete_request(req, le16_to_cpu(cqe.status) >> 1); | 714 | blk_mq_complete_request(req, le16_to_cpu(cqe.status) >> 1); |
715 | |||
716 | } | 715 | } |
717 | 716 | ||
718 | /* If the controller ignores the cq head doorbell and continuously | ||
719 | * writes to the queue, it is theoretically possible to wrap around | ||
720 | * the queue twice and mistakenly return IRQ_NONE. Linux only | ||
721 | * requires that 0.1% of your interrupts are handled, so this isn't | ||
722 | * a big problem. | ||
723 | */ | ||
724 | if (head == nvmeq->cq_head && phase == nvmeq->cq_phase) | 717 | if (head == nvmeq->cq_head && phase == nvmeq->cq_phase) |
725 | return; | 718 | return; |
726 | 719 | ||
@@ -1909,10 +1902,10 @@ static int nvme_dev_map(struct nvme_dev *dev) | |||
1909 | if (!dev->bar) | 1902 | if (!dev->bar) |
1910 | goto release; | 1903 | goto release; |
1911 | 1904 | ||
1912 | return 0; | 1905 | return 0; |
1913 | release: | 1906 | release: |
1914 | pci_release_mem_regions(pdev); | 1907 | pci_release_mem_regions(pdev); |
1915 | return -ENODEV; | 1908 | return -ENODEV; |
1916 | } | 1909 | } |
1917 | 1910 | ||
1918 | static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 1911 | static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c index b71e95044b43..a5c09e703bd8 100644 --- a/drivers/nvme/host/scsi.c +++ b/drivers/nvme/host/scsi.c | |||
@@ -2160,30 +2160,6 @@ static int nvme_trans_synchronize_cache(struct nvme_ns *ns, | |||
2160 | return nvme_trans_status_code(hdr, nvme_sc); | 2160 | return nvme_trans_status_code(hdr, nvme_sc); |
2161 | } | 2161 | } |
2162 | 2162 | ||
2163 | static int nvme_trans_start_stop(struct nvme_ns *ns, struct sg_io_hdr *hdr, | ||
2164 | u8 *cmd) | ||
2165 | { | ||
2166 | u8 immed, no_flush; | ||
2167 | |||
2168 | immed = cmd[1] & 0x01; | ||
2169 | no_flush = cmd[4] & 0x04; | ||
2170 | |||
2171 | if (immed != 0) { | ||
2172 | return nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, | ||
2173 | ILLEGAL_REQUEST, SCSI_ASC_INVALID_CDB, | ||
2174 | SCSI_ASCQ_CAUSE_NOT_REPORTABLE); | ||
2175 | } else { | ||
2176 | if (no_flush == 0) { | ||
2177 | /* Issue NVME FLUSH command prior to START STOP UNIT */ | ||
2178 | int res = nvme_trans_synchronize_cache(ns, hdr); | ||
2179 | if (res) | ||
2180 | return res; | ||
2181 | } | ||
2182 | |||
2183 | return 0; | ||
2184 | } | ||
2185 | } | ||
2186 | |||
2187 | static int nvme_trans_format_unit(struct nvme_ns *ns, struct sg_io_hdr *hdr, | 2163 | static int nvme_trans_format_unit(struct nvme_ns *ns, struct sg_io_hdr *hdr, |
2188 | u8 *cmd) | 2164 | u8 *cmd) |
2189 | { | 2165 | { |
@@ -2439,9 +2415,6 @@ static int nvme_scsi_translate(struct nvme_ns *ns, struct sg_io_hdr *hdr) | |||
2439 | case SECURITY_PROTOCOL_OUT: | 2415 | case SECURITY_PROTOCOL_OUT: |
2440 | retcode = nvme_trans_security_protocol(ns, hdr, cmd); | 2416 | retcode = nvme_trans_security_protocol(ns, hdr, cmd); |
2441 | break; | 2417 | break; |
2442 | case START_STOP: | ||
2443 | retcode = nvme_trans_start_stop(ns, hdr, cmd); | ||
2444 | break; | ||
2445 | case SYNCHRONIZE_CACHE: | 2418 | case SYNCHRONIZE_CACHE: |
2446 | retcode = nvme_trans_synchronize_cache(ns, hdr); | 2419 | retcode = nvme_trans_synchronize_cache(ns, hdr); |
2447 | break; | 2420 | break; |
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index ec1ad2aa0a4c..95ae52390478 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c | |||
@@ -382,7 +382,6 @@ static void nvmet_execute_set_features(struct nvmet_req *req) | |||
382 | { | 382 | { |
383 | struct nvmet_subsys *subsys = req->sq->ctrl->subsys; | 383 | struct nvmet_subsys *subsys = req->sq->ctrl->subsys; |
384 | u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10[0]); | 384 | u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10[0]); |
385 | u64 val; | ||
386 | u32 val32; | 385 | u32 val32; |
387 | u16 status = 0; | 386 | u16 status = 0; |
388 | 387 | ||
@@ -392,8 +391,7 @@ static void nvmet_execute_set_features(struct nvmet_req *req) | |||
392 | (subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16)); | 391 | (subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16)); |
393 | break; | 392 | break; |
394 | case NVME_FEAT_KATO: | 393 | case NVME_FEAT_KATO: |
395 | val = le64_to_cpu(req->cmd->prop_set.value); | 394 | val32 = le32_to_cpu(req->cmd->common.cdw10[1]); |
396 | val32 = val & 0xffff; | ||
397 | req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000); | 395 | req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000); |
398 | nvmet_set_result(req, req->sq->ctrl->kato); | 396 | nvmet_set_result(req, req->sq->ctrl->kato); |
399 | break; | 397 | break; |
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c index bcb8ebeb01c5..4e8e6a22bce1 100644 --- a/drivers/nvme/target/fcloop.c +++ b/drivers/nvme/target/fcloop.c | |||
@@ -845,7 +845,7 @@ fcloop_create_remote_port(struct device *dev, struct device_attribute *attr, | |||
845 | rport->lport = nport->lport; | 845 | rport->lport = nport->lport; |
846 | nport->rport = rport; | 846 | nport->rport = rport; |
847 | 847 | ||
848 | return ret ? ret : count; | 848 | return count; |
849 | } | 849 | } |
850 | 850 | ||
851 | 851 | ||
@@ -952,7 +952,7 @@ fcloop_create_target_port(struct device *dev, struct device_attribute *attr, | |||
952 | tport->lport = nport->lport; | 952 | tport->lport = nport->lport; |
953 | nport->tport = tport; | 953 | nport->tport = tport; |
954 | 954 | ||
955 | return ret ? ret : count; | 955 | return count; |
956 | } | 956 | } |
957 | 957 | ||
958 | 958 | ||
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 965911d9b36a..398ea7f54826 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c | |||
@@ -981,8 +981,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem, | |||
981 | * @cell: nvmem cell to be read. | 981 | * @cell: nvmem cell to be read. |
982 | * @len: pointer to length of cell which will be populated on successful read. | 982 | * @len: pointer to length of cell which will be populated on successful read. |
983 | * | 983 | * |
984 | * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success. | 984 | * Return: ERR_PTR() on error or a valid pointer to a buffer on success. The |
985 | * The buffer should be freed by the consumer with a kfree(). | 985 | * buffer should be freed by the consumer with a kfree(). |
986 | */ | 986 | */ |
987 | void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) | 987 | void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) |
988 | { | 988 | { |
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index ac27b9bac3b9..8e7b120696fa 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c | |||
@@ -71,7 +71,7 @@ static struct nvmem_config imx_ocotp_nvmem_config = { | |||
71 | 71 | ||
72 | static const struct of_device_id imx_ocotp_dt_ids[] = { | 72 | static const struct of_device_id imx_ocotp_dt_ids[] = { |
73 | { .compatible = "fsl,imx6q-ocotp", (void *)128 }, | 73 | { .compatible = "fsl,imx6q-ocotp", (void *)128 }, |
74 | { .compatible = "fsl,imx6sl-ocotp", (void *)32 }, | 74 | { .compatible = "fsl,imx6sl-ocotp", (void *)64 }, |
75 | { .compatible = "fsl,imx6sx-ocotp", (void *)128 }, | 75 | { .compatible = "fsl,imx6sx-ocotp", (void *)128 }, |
76 | { }, | 76 | { }, |
77 | }; | 77 | }; |
diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index b5305f08b184..2bdb6c389328 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c | |||
@@ -21,11 +21,11 @@ static int qfprom_reg_read(void *context, | |||
21 | unsigned int reg, void *_val, size_t bytes) | 21 | unsigned int reg, void *_val, size_t bytes) |
22 | { | 22 | { |
23 | void __iomem *base = context; | 23 | void __iomem *base = context; |
24 | u32 *val = _val; | 24 | u8 *val = _val; |
25 | int i = 0, words = bytes / 4; | 25 | int i = 0, words = bytes; |
26 | 26 | ||
27 | while (words--) | 27 | while (words--) |
28 | *val++ = readl(base + reg + (i++ * 4)); | 28 | *val++ = readb(base + reg + i++); |
29 | 29 | ||
30 | return 0; | 30 | return 0; |
31 | } | 31 | } |
@@ -34,11 +34,11 @@ static int qfprom_reg_write(void *context, | |||
34 | unsigned int reg, void *_val, size_t bytes) | 34 | unsigned int reg, void *_val, size_t bytes) |
35 | { | 35 | { |
36 | void __iomem *base = context; | 36 | void __iomem *base = context; |
37 | u32 *val = _val; | 37 | u8 *val = _val; |
38 | int i = 0, words = bytes / 4; | 38 | int i = 0, words = bytes; |
39 | 39 | ||
40 | while (words--) | 40 | while (words--) |
41 | writel(*val++, base + reg + (i++ * 4)); | 41 | writeb(*val++, base + reg + i++); |
42 | 42 | ||
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
@@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev) | |||
53 | static struct nvmem_config econfig = { | 53 | static struct nvmem_config econfig = { |
54 | .name = "qfprom", | 54 | .name = "qfprom", |
55 | .owner = THIS_MODULE, | 55 | .owner = THIS_MODULE, |
56 | .stride = 4, | 56 | .stride = 1, |
57 | .word_size = 1, | 57 | .word_size = 1, |
58 | .reg_read = qfprom_reg_read, | 58 | .reg_read = qfprom_reg_read, |
59 | .reg_write = qfprom_reg_write, | 59 | .reg_write = qfprom_reg_write, |
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index a579126832af..620c231a2889 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c | |||
@@ -212,7 +212,7 @@ static int meson_pmx_request_gpio(struct pinctrl_dev *pcdev, | |||
212 | { | 212 | { |
213 | struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); | 213 | struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); |
214 | 214 | ||
215 | meson_pmx_disable_other_groups(pc, range->pin_base + offset, -1); | 215 | meson_pmx_disable_other_groups(pc, offset, -1); |
216 | 216 | ||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c index aea310a91821..c9a146948192 100644 --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c | |||
@@ -382,26 +382,21 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
382 | { | 382 | { |
383 | int ret = 0; | 383 | int ret = 0; |
384 | u32 pin_reg; | 384 | u32 pin_reg; |
385 | unsigned long flags; | 385 | unsigned long flags, irq_flags; |
386 | bool level_trig; | ||
387 | u32 active_level; | ||
388 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 386 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
389 | struct amd_gpio *gpio_dev = gpiochip_get_data(gc); | 387 | struct amd_gpio *gpio_dev = gpiochip_get_data(gc); |
390 | 388 | ||
391 | spin_lock_irqsave(&gpio_dev->lock, flags); | 389 | spin_lock_irqsave(&gpio_dev->lock, flags); |
392 | pin_reg = readl(gpio_dev->base + (d->hwirq)*4); | 390 | pin_reg = readl(gpio_dev->base + (d->hwirq)*4); |
393 | 391 | ||
394 | /* | 392 | /* Ignore the settings coming from the client and |
395 | * When level_trig is set EDGE and active_level is set HIGH in BIOS | 393 | * read the values from the ACPI tables |
396 | * default settings, ignore incoming settings from client and use | 394 | * while setting the trigger type |
397 | * BIOS settings to configure GPIO register. | ||
398 | */ | 395 | */ |
399 | level_trig = !(pin_reg & (LEVEL_TRIGGER << LEVEL_TRIG_OFF)); | ||
400 | active_level = pin_reg & (ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF); | ||
401 | 396 | ||
402 | if(level_trig && | 397 | irq_flags = irq_get_trigger_type(d->irq); |
403 | ((active_level >> ACTIVE_LEVEL_OFF) == ACTIVE_HIGH)) | 398 | if (irq_flags != IRQ_TYPE_NONE) |
404 | type = IRQ_TYPE_EDGE_FALLING; | 399 | type = irq_flags; |
405 | 400 | ||
406 | switch (type & IRQ_TYPE_SENSE_MASK) { | 401 | switch (type & IRQ_TYPE_SENSE_MASK) { |
407 | case IRQ_TYPE_EDGE_RISING: | 402 | case IRQ_TYPE_EDGE_RISING: |
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 12f7d1eb65bc..07409fde02b2 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c | |||
@@ -56,6 +56,17 @@ static const struct samsung_pin_bank_type bank_type_alive = { | |||
56 | .reg_offset = { 0x00, 0x04, 0x08, 0x0c, }, | 56 | .reg_offset = { 0x00, 0x04, 0x08, 0x0c, }, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | /* Exynos5433 has the 4bit widths for PINCFG_TYPE_DRV bitfields. */ | ||
60 | static const struct samsung_pin_bank_type exynos5433_bank_type_off = { | ||
61 | .fld_width = { 4, 1, 2, 4, 2, 2, }, | ||
62 | .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, }, | ||
63 | }; | ||
64 | |||
65 | static const struct samsung_pin_bank_type exynos5433_bank_type_alive = { | ||
66 | .fld_width = { 4, 1, 2, 4, }, | ||
67 | .reg_offset = { 0x00, 0x04, 0x08, 0x0c, }, | ||
68 | }; | ||
69 | |||
59 | static void exynos_irq_mask(struct irq_data *irqd) | 70 | static void exynos_irq_mask(struct irq_data *irqd) |
60 | { | 71 | { |
61 | struct irq_chip *chip = irq_data_get_irq_chip(irqd); | 72 | struct irq_chip *chip = irq_data_get_irq_chip(irqd); |
@@ -1335,82 +1346,82 @@ const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = { | |||
1335 | 1346 | ||
1336 | /* pin banks of exynos5433 pin-controller - ALIVE */ | 1347 | /* pin banks of exynos5433 pin-controller - ALIVE */ |
1337 | static const struct samsung_pin_bank_data exynos5433_pin_banks0[] = { | 1348 | static const struct samsung_pin_bank_data exynos5433_pin_banks0[] = { |
1338 | EXYNOS_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00), | 1349 | EXYNOS5433_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00), |
1339 | EXYNOS_PIN_BANK_EINTW(8, 0x020, "gpa1", 0x04), | 1350 | EXYNOS5433_PIN_BANK_EINTW(8, 0x020, "gpa1", 0x04), |
1340 | EXYNOS_PIN_BANK_EINTW(8, 0x040, "gpa2", 0x08), | 1351 | EXYNOS5433_PIN_BANK_EINTW(8, 0x040, "gpa2", 0x08), |
1341 | EXYNOS_PIN_BANK_EINTW(8, 0x060, "gpa3", 0x0c), | 1352 | EXYNOS5433_PIN_BANK_EINTW(8, 0x060, "gpa3", 0x0c), |
1342 | EXYNOS_PIN_BANK_EINTW_EXT(8, 0x020, "gpf1", 0x1004, 1), | 1353 | EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x020, "gpf1", 0x1004, 1), |
1343 | EXYNOS_PIN_BANK_EINTW_EXT(4, 0x040, "gpf2", 0x1008, 1), | 1354 | EXYNOS5433_PIN_BANK_EINTW_EXT(4, 0x040, "gpf2", 0x1008, 1), |
1344 | EXYNOS_PIN_BANK_EINTW_EXT(4, 0x060, "gpf3", 0x100c, 1), | 1355 | EXYNOS5433_PIN_BANK_EINTW_EXT(4, 0x060, "gpf3", 0x100c, 1), |
1345 | EXYNOS_PIN_BANK_EINTW_EXT(8, 0x080, "gpf4", 0x1010, 1), | 1356 | EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x080, "gpf4", 0x1010, 1), |
1346 | EXYNOS_PIN_BANK_EINTW_EXT(8, 0x0a0, "gpf5", 0x1014, 1), | 1357 | EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x0a0, "gpf5", 0x1014, 1), |
1347 | }; | 1358 | }; |
1348 | 1359 | ||
1349 | /* pin banks of exynos5433 pin-controller - AUD */ | 1360 | /* pin banks of exynos5433 pin-controller - AUD */ |
1350 | static const struct samsung_pin_bank_data exynos5433_pin_banks1[] = { | 1361 | static const struct samsung_pin_bank_data exynos5433_pin_banks1[] = { |
1351 | EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz0", 0x00), | 1362 | EXYNOS5433_PIN_BANK_EINTG(7, 0x000, "gpz0", 0x00), |
1352 | EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04), | 1363 | EXYNOS5433_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04), |
1353 | }; | 1364 | }; |
1354 | 1365 | ||
1355 | /* pin banks of exynos5433 pin-controller - CPIF */ | 1366 | /* pin banks of exynos5433 pin-controller - CPIF */ |
1356 | static const struct samsung_pin_bank_data exynos5433_pin_banks2[] = { | 1367 | static const struct samsung_pin_bank_data exynos5433_pin_banks2[] = { |
1357 | EXYNOS_PIN_BANK_EINTG(2, 0x000, "gpv6", 0x00), | 1368 | EXYNOS5433_PIN_BANK_EINTG(2, 0x000, "gpv6", 0x00), |
1358 | }; | 1369 | }; |
1359 | 1370 | ||
1360 | /* pin banks of exynos5433 pin-controller - eSE */ | 1371 | /* pin banks of exynos5433 pin-controller - eSE */ |
1361 | static const struct samsung_pin_bank_data exynos5433_pin_banks3[] = { | 1372 | static const struct samsung_pin_bank_data exynos5433_pin_banks3[] = { |
1362 | EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj2", 0x00), | 1373 | EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj2", 0x00), |
1363 | }; | 1374 | }; |
1364 | 1375 | ||
1365 | /* pin banks of exynos5433 pin-controller - FINGER */ | 1376 | /* pin banks of exynos5433 pin-controller - FINGER */ |
1366 | static const struct samsung_pin_bank_data exynos5433_pin_banks4[] = { | 1377 | static const struct samsung_pin_bank_data exynos5433_pin_banks4[] = { |
1367 | EXYNOS_PIN_BANK_EINTG(4, 0x000, "gpd5", 0x00), | 1378 | EXYNOS5433_PIN_BANK_EINTG(4, 0x000, "gpd5", 0x00), |
1368 | }; | 1379 | }; |
1369 | 1380 | ||
1370 | /* pin banks of exynos5433 pin-controller - FSYS */ | 1381 | /* pin banks of exynos5433 pin-controller - FSYS */ |
1371 | static const struct samsung_pin_bank_data exynos5433_pin_banks5[] = { | 1382 | static const struct samsung_pin_bank_data exynos5433_pin_banks5[] = { |
1372 | EXYNOS_PIN_BANK_EINTG(6, 0x000, "gph1", 0x00), | 1383 | EXYNOS5433_PIN_BANK_EINTG(6, 0x000, "gph1", 0x00), |
1373 | EXYNOS_PIN_BANK_EINTG(7, 0x020, "gpr4", 0x04), | 1384 | EXYNOS5433_PIN_BANK_EINTG(7, 0x020, "gpr4", 0x04), |
1374 | EXYNOS_PIN_BANK_EINTG(5, 0x040, "gpr0", 0x08), | 1385 | EXYNOS5433_PIN_BANK_EINTG(5, 0x040, "gpr0", 0x08), |
1375 | EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpr1", 0x0c), | 1386 | EXYNOS5433_PIN_BANK_EINTG(8, 0x060, "gpr1", 0x0c), |
1376 | EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpr2", 0x10), | 1387 | EXYNOS5433_PIN_BANK_EINTG(2, 0x080, "gpr2", 0x10), |
1377 | EXYNOS_PIN_BANK_EINTG(8, 0x0a0, "gpr3", 0x14), | 1388 | EXYNOS5433_PIN_BANK_EINTG(8, 0x0a0, "gpr3", 0x14), |
1378 | }; | 1389 | }; |
1379 | 1390 | ||
1380 | /* pin banks of exynos5433 pin-controller - IMEM */ | 1391 | /* pin banks of exynos5433 pin-controller - IMEM */ |
1381 | static const struct samsung_pin_bank_data exynos5433_pin_banks6[] = { | 1392 | static const struct samsung_pin_bank_data exynos5433_pin_banks6[] = { |
1382 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpf0", 0x00), | 1393 | EXYNOS5433_PIN_BANK_EINTG(8, 0x000, "gpf0", 0x00), |
1383 | }; | 1394 | }; |
1384 | 1395 | ||
1385 | /* pin banks of exynos5433 pin-controller - NFC */ | 1396 | /* pin banks of exynos5433 pin-controller - NFC */ |
1386 | static const struct samsung_pin_bank_data exynos5433_pin_banks7[] = { | 1397 | static const struct samsung_pin_bank_data exynos5433_pin_banks7[] = { |
1387 | EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj0", 0x00), | 1398 | EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj0", 0x00), |
1388 | }; | 1399 | }; |
1389 | 1400 | ||
1390 | /* pin banks of exynos5433 pin-controller - PERIC */ | 1401 | /* pin banks of exynos5433 pin-controller - PERIC */ |
1391 | static const struct samsung_pin_bank_data exynos5433_pin_banks8[] = { | 1402 | static const struct samsung_pin_bank_data exynos5433_pin_banks8[] = { |
1392 | EXYNOS_PIN_BANK_EINTG(6, 0x000, "gpv7", 0x00), | 1403 | EXYNOS5433_PIN_BANK_EINTG(6, 0x000, "gpv7", 0x00), |
1393 | EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpb0", 0x04), | 1404 | EXYNOS5433_PIN_BANK_EINTG(5, 0x020, "gpb0", 0x04), |
1394 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpc0", 0x08), | 1405 | EXYNOS5433_PIN_BANK_EINTG(8, 0x040, "gpc0", 0x08), |
1395 | EXYNOS_PIN_BANK_EINTG(2, 0x060, "gpc1", 0x0c), | 1406 | EXYNOS5433_PIN_BANK_EINTG(2, 0x060, "gpc1", 0x0c), |
1396 | EXYNOS_PIN_BANK_EINTG(6, 0x080, "gpc2", 0x10), | 1407 | EXYNOS5433_PIN_BANK_EINTG(6, 0x080, "gpc2", 0x10), |
1397 | EXYNOS_PIN_BANK_EINTG(8, 0x0a0, "gpc3", 0x14), | 1408 | EXYNOS5433_PIN_BANK_EINTG(8, 0x0a0, "gpc3", 0x14), |
1398 | EXYNOS_PIN_BANK_EINTG(2, 0x0c0, "gpg0", 0x18), | 1409 | EXYNOS5433_PIN_BANK_EINTG(2, 0x0c0, "gpg0", 0x18), |
1399 | EXYNOS_PIN_BANK_EINTG(4, 0x0e0, "gpd0", 0x1c), | 1410 | EXYNOS5433_PIN_BANK_EINTG(4, 0x0e0, "gpd0", 0x1c), |
1400 | EXYNOS_PIN_BANK_EINTG(6, 0x100, "gpd1", 0x20), | 1411 | EXYNOS5433_PIN_BANK_EINTG(6, 0x100, "gpd1", 0x20), |
1401 | EXYNOS_PIN_BANK_EINTG(8, 0x120, "gpd2", 0x24), | 1412 | EXYNOS5433_PIN_BANK_EINTG(8, 0x120, "gpd2", 0x24), |
1402 | EXYNOS_PIN_BANK_EINTG(5, 0x140, "gpd4", 0x28), | 1413 | EXYNOS5433_PIN_BANK_EINTG(5, 0x140, "gpd4", 0x28), |
1403 | EXYNOS_PIN_BANK_EINTG(2, 0x160, "gpd8", 0x2c), | 1414 | EXYNOS5433_PIN_BANK_EINTG(2, 0x160, "gpd8", 0x2c), |
1404 | EXYNOS_PIN_BANK_EINTG(7, 0x180, "gpd6", 0x30), | 1415 | EXYNOS5433_PIN_BANK_EINTG(7, 0x180, "gpd6", 0x30), |
1405 | EXYNOS_PIN_BANK_EINTG(3, 0x1a0, "gpd7", 0x34), | 1416 | EXYNOS5433_PIN_BANK_EINTG(3, 0x1a0, "gpd7", 0x34), |
1406 | EXYNOS_PIN_BANK_EINTG(5, 0x1c0, "gpg1", 0x38), | 1417 | EXYNOS5433_PIN_BANK_EINTG(5, 0x1c0, "gpg1", 0x38), |
1407 | EXYNOS_PIN_BANK_EINTG(2, 0x1e0, "gpg2", 0x3c), | 1418 | EXYNOS5433_PIN_BANK_EINTG(2, 0x1e0, "gpg2", 0x3c), |
1408 | EXYNOS_PIN_BANK_EINTG(8, 0x200, "gpg3", 0x40), | 1419 | EXYNOS5433_PIN_BANK_EINTG(8, 0x200, "gpg3", 0x40), |
1409 | }; | 1420 | }; |
1410 | 1421 | ||
1411 | /* pin banks of exynos5433 pin-controller - TOUCH */ | 1422 | /* pin banks of exynos5433 pin-controller - TOUCH */ |
1412 | static const struct samsung_pin_bank_data exynos5433_pin_banks9[] = { | 1423 | static const struct samsung_pin_bank_data exynos5433_pin_banks9[] = { |
1413 | EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj1", 0x00), | 1424 | EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj1", 0x00), |
1414 | }; | 1425 | }; |
1415 | 1426 | ||
1416 | /* | 1427 | /* |
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.h b/drivers/pinctrl/samsung/pinctrl-exynos.h index 5821525a2c84..a473092fb8d2 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.h +++ b/drivers/pinctrl/samsung/pinctrl-exynos.h | |||
@@ -90,6 +90,37 @@ | |||
90 | .pctl_res_idx = pctl_idx, \ | 90 | .pctl_res_idx = pctl_idx, \ |
91 | } \ | 91 | } \ |
92 | 92 | ||
93 | #define EXYNOS5433_PIN_BANK_EINTG(pins, reg, id, offs) \ | ||
94 | { \ | ||
95 | .type = &exynos5433_bank_type_off, \ | ||
96 | .pctl_offset = reg, \ | ||
97 | .nr_pins = pins, \ | ||
98 | .eint_type = EINT_TYPE_GPIO, \ | ||
99 | .eint_offset = offs, \ | ||
100 | .name = id \ | ||
101 | } | ||
102 | |||
103 | #define EXYNOS5433_PIN_BANK_EINTW(pins, reg, id, offs) \ | ||
104 | { \ | ||
105 | .type = &exynos5433_bank_type_alive, \ | ||
106 | .pctl_offset = reg, \ | ||
107 | .nr_pins = pins, \ | ||
108 | .eint_type = EINT_TYPE_WKUP, \ | ||
109 | .eint_offset = offs, \ | ||
110 | .name = id \ | ||
111 | } | ||
112 | |||
113 | #define EXYNOS5433_PIN_BANK_EINTW_EXT(pins, reg, id, offs, pctl_idx) \ | ||
114 | { \ | ||
115 | .type = &exynos5433_bank_type_alive, \ | ||
116 | .pctl_offset = reg, \ | ||
117 | .nr_pins = pins, \ | ||
118 | .eint_type = EINT_TYPE_WKUP, \ | ||
119 | .eint_offset = offs, \ | ||
120 | .name = id, \ | ||
121 | .pctl_res_idx = pctl_idx, \ | ||
122 | } \ | ||
123 | |||
93 | /** | 124 | /** |
94 | * struct exynos_weint_data: irq specific data for all the wakeup interrupts | 125 | * struct exynos_weint_data: irq specific data for all the wakeup interrupts |
95 | * generated by the external wakeup interrupt controller. | 126 | * generated by the external wakeup interrupt controller. |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 5fe8be089b8b..59aa8e302bc3 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -1034,7 +1034,7 @@ config SURFACE_PRO3_BUTTON | |||
1034 | 1034 | ||
1035 | config SURFACE_3_BUTTON | 1035 | config SURFACE_3_BUTTON |
1036 | tristate "Power/home/volume buttons driver for Microsoft Surface 3 tablet" | 1036 | tristate "Power/home/volume buttons driver for Microsoft Surface 3 tablet" |
1037 | depends on ACPI && KEYBOARD_GPIO | 1037 | depends on ACPI && KEYBOARD_GPIO && I2C |
1038 | ---help--- | 1038 | ---help--- |
1039 | This driver handles the power/home/volume buttons on the Microsoft Surface 3 tablet. | 1039 | This driver handles the power/home/volume buttons on the Microsoft Surface 3 tablet. |
1040 | 1040 | ||
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 61f39abf5dc8..82d67715ce76 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -177,43 +177,43 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event); | |||
177 | 177 | ||
178 | #if IS_ENABLED(CONFIG_LEDS_CLASS) | 178 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
179 | static enum led_brightness logolamp_get(struct led_classdev *cdev); | 179 | static enum led_brightness logolamp_get(struct led_classdev *cdev); |
180 | static void logolamp_set(struct led_classdev *cdev, | 180 | static int logolamp_set(struct led_classdev *cdev, |
181 | enum led_brightness brightness); | 181 | enum led_brightness brightness); |
182 | 182 | ||
183 | static struct led_classdev logolamp_led = { | 183 | static struct led_classdev logolamp_led = { |
184 | .name = "fujitsu::logolamp", | 184 | .name = "fujitsu::logolamp", |
185 | .brightness_get = logolamp_get, | 185 | .brightness_get = logolamp_get, |
186 | .brightness_set = logolamp_set | 186 | .brightness_set_blocking = logolamp_set |
187 | }; | 187 | }; |
188 | 188 | ||
189 | static enum led_brightness kblamps_get(struct led_classdev *cdev); | 189 | static enum led_brightness kblamps_get(struct led_classdev *cdev); |
190 | static void kblamps_set(struct led_classdev *cdev, | 190 | static int kblamps_set(struct led_classdev *cdev, |
191 | enum led_brightness brightness); | 191 | enum led_brightness brightness); |
192 | 192 | ||
193 | static struct led_classdev kblamps_led = { | 193 | static struct led_classdev kblamps_led = { |
194 | .name = "fujitsu::kblamps", | 194 | .name = "fujitsu::kblamps", |
195 | .brightness_get = kblamps_get, | 195 | .brightness_get = kblamps_get, |
196 | .brightness_set = kblamps_set | 196 | .brightness_set_blocking = kblamps_set |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static enum led_brightness radio_led_get(struct led_classdev *cdev); | 199 | static enum led_brightness radio_led_get(struct led_classdev *cdev); |
200 | static void radio_led_set(struct led_classdev *cdev, | 200 | static int radio_led_set(struct led_classdev *cdev, |
201 | enum led_brightness brightness); | 201 | enum led_brightness brightness); |
202 | 202 | ||
203 | static struct led_classdev radio_led = { | 203 | static struct led_classdev radio_led = { |
204 | .name = "fujitsu::radio_led", | 204 | .name = "fujitsu::radio_led", |
205 | .brightness_get = radio_led_get, | 205 | .brightness_get = radio_led_get, |
206 | .brightness_set = radio_led_set | 206 | .brightness_set_blocking = radio_led_set |
207 | }; | 207 | }; |
208 | 208 | ||
209 | static enum led_brightness eco_led_get(struct led_classdev *cdev); | 209 | static enum led_brightness eco_led_get(struct led_classdev *cdev); |
210 | static void eco_led_set(struct led_classdev *cdev, | 210 | static int eco_led_set(struct led_classdev *cdev, |
211 | enum led_brightness brightness); | 211 | enum led_brightness brightness); |
212 | 212 | ||
213 | static struct led_classdev eco_led = { | 213 | static struct led_classdev eco_led = { |
214 | .name = "fujitsu::eco_led", | 214 | .name = "fujitsu::eco_led", |
215 | .brightness_get = eco_led_get, | 215 | .brightness_get = eco_led_get, |
216 | .brightness_set = eco_led_set | 216 | .brightness_set_blocking = eco_led_set |
217 | }; | 217 | }; |
218 | #endif | 218 | #endif |
219 | 219 | ||
@@ -267,48 +267,48 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2) | |||
267 | #if IS_ENABLED(CONFIG_LEDS_CLASS) | 267 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
268 | /* LED class callbacks */ | 268 | /* LED class callbacks */ |
269 | 269 | ||
270 | static void logolamp_set(struct led_classdev *cdev, | 270 | static int logolamp_set(struct led_classdev *cdev, |
271 | enum led_brightness brightness) | 271 | enum led_brightness brightness) |
272 | { | 272 | { |
273 | if (brightness >= LED_FULL) { | 273 | if (brightness >= LED_FULL) { |
274 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); | 274 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); |
275 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON); | 275 | return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON); |
276 | } else if (brightness >= LED_HALF) { | 276 | } else if (brightness >= LED_HALF) { |
277 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); | 277 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); |
278 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF); | 278 | return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF); |
279 | } else { | 279 | } else { |
280 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF); | 280 | return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | static void kblamps_set(struct led_classdev *cdev, | 284 | static int kblamps_set(struct led_classdev *cdev, |
285 | enum led_brightness brightness) | 285 | enum led_brightness brightness) |
286 | { | 286 | { |
287 | if (brightness >= LED_FULL) | 287 | if (brightness >= LED_FULL) |
288 | call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON); | 288 | return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON); |
289 | else | 289 | else |
290 | call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF); | 290 | return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF); |
291 | } | 291 | } |
292 | 292 | ||
293 | static void radio_led_set(struct led_classdev *cdev, | 293 | static int radio_led_set(struct led_classdev *cdev, |
294 | enum led_brightness brightness) | 294 | enum led_brightness brightness) |
295 | { | 295 | { |
296 | if (brightness >= LED_FULL) | 296 | if (brightness >= LED_FULL) |
297 | call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, RADIO_LED_ON); | 297 | return call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, RADIO_LED_ON); |
298 | else | 298 | else |
299 | call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, 0x0); | 299 | return call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, 0x0); |
300 | } | 300 | } |
301 | 301 | ||
302 | static void eco_led_set(struct led_classdev *cdev, | 302 | static int eco_led_set(struct led_classdev *cdev, |
303 | enum led_brightness brightness) | 303 | enum led_brightness brightness) |
304 | { | 304 | { |
305 | int curr; | 305 | int curr; |
306 | 306 | ||
307 | curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0); | 307 | curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0); |
308 | if (brightness >= LED_FULL) | 308 | if (brightness >= LED_FULL) |
309 | call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON); | 309 | return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON); |
310 | else | 310 | else |
311 | call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON); | 311 | return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON); |
312 | } | 312 | } |
313 | 313 | ||
314 | static enum led_brightness logolamp_get(struct led_classdev *cdev) | 314 | static enum led_brightness logolamp_get(struct led_classdev *cdev) |
diff --git a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c index 039374e9fdc0..95d77ec5c5d7 100644 --- a/drivers/soc/dove/pmu.c +++ b/drivers/soc/dove/pmu.c | |||
@@ -87,7 +87,7 @@ static int pmu_reset_deassert(struct reset_controller_dev *rc, unsigned long id) | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | static struct reset_control_ops pmu_reset_ops = { | 90 | static const struct reset_control_ops pmu_reset_ops = { |
91 | .reset = pmu_reset_reset, | 91 | .reset = pmu_reset_reset, |
92 | .assert = pmu_reset_assert, | 92 | .assert = pmu_reset_assert, |
93 | .deassert = pmu_reset_deassert, | 93 | .deassert = pmu_reset_deassert, |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 8130dfe89745..4971aa54756a 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
@@ -770,6 +770,7 @@ static int cvm_oct_probe(struct platform_device *pdev) | |||
770 | /* Initialize the device private structure. */ | 770 | /* Initialize the device private structure. */ |
771 | struct octeon_ethernet *priv = netdev_priv(dev); | 771 | struct octeon_ethernet *priv = netdev_priv(dev); |
772 | 772 | ||
773 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
773 | dev->netdev_ops = &cvm_oct_pow_netdev_ops; | 774 | dev->netdev_ops = &cvm_oct_pow_netdev_ops; |
774 | priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED; | 775 | priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED; |
775 | priv->port = CVMX_PIP_NUM_INPUT_PORTS; | 776 | priv->port = CVMX_PIP_NUM_INPUT_PORTS; |
@@ -816,6 +817,7 @@ static int cvm_oct_probe(struct platform_device *pdev) | |||
816 | } | 817 | } |
817 | 818 | ||
818 | /* Initialize the device private structure. */ | 819 | /* Initialize the device private structure. */ |
820 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
819 | priv = netdev_priv(dev); | 821 | priv = netdev_priv(dev); |
820 | priv->netdev = dev; | 822 | priv->netdev = dev; |
821 | priv->of_node = cvm_oct_node_for_port(pip, interface, | 823 | priv->of_node = cvm_oct_node_for_port(pip, interface, |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 0aa9e7d697a5..25dbd8c7aec7 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -239,6 +239,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
239 | if (ifp->desc.bNumEndpoints >= num_ep) | 239 | if (ifp->desc.bNumEndpoints >= num_ep) |
240 | goto skip_to_next_endpoint_or_interface_descriptor; | 240 | goto skip_to_next_endpoint_or_interface_descriptor; |
241 | 241 | ||
242 | /* Check for duplicate endpoint addresses */ | ||
243 | for (i = 0; i < ifp->desc.bNumEndpoints; ++i) { | ||
244 | if (ifp->endpoint[i].desc.bEndpointAddress == | ||
245 | d->bEndpointAddress) { | ||
246 | dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", | ||
247 | cfgno, inum, asnum, d->bEndpointAddress); | ||
248 | goto skip_to_next_endpoint_or_interface_descriptor; | ||
249 | } | ||
250 | } | ||
251 | |||
242 | endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; | 252 | endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; |
243 | ++ifp->desc.bNumEndpoints; | 253 | ++ifp->desc.bNumEndpoints; |
244 | 254 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1fa5c0f29c64..a56c75e09786 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -103,8 +103,7 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); | |||
103 | 103 | ||
104 | static void hub_release(struct kref *kref); | 104 | static void hub_release(struct kref *kref); |
105 | static int usb_reset_and_verify_device(struct usb_device *udev); | 105 | static int usb_reset_and_verify_device(struct usb_device *udev); |
106 | static void hub_usb3_port_prepare_disable(struct usb_hub *hub, | 106 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state); |
107 | struct usb_port *port_dev); | ||
108 | 107 | ||
109 | static inline char *portspeed(struct usb_hub *hub, int portstatus) | 108 | static inline char *portspeed(struct usb_hub *hub, int portstatus) |
110 | { | 109 | { |
@@ -903,34 +902,6 @@ static int hub_set_port_link_state(struct usb_hub *hub, int port1, | |||
903 | } | 902 | } |
904 | 903 | ||
905 | /* | 904 | /* |
906 | * USB-3 does not have a similar link state as USB-2 that will avoid negotiating | ||
907 | * a connection with a plugged-in cable but will signal the host when the cable | ||
908 | * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices | ||
909 | */ | ||
910 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
911 | { | ||
912 | struct usb_port *port_dev = hub->ports[port1 - 1]; | ||
913 | struct usb_device *hdev = hub->hdev; | ||
914 | int ret = 0; | ||
915 | |||
916 | if (!hub->error) { | ||
917 | if (hub_is_superspeed(hub->hdev)) { | ||
918 | hub_usb3_port_prepare_disable(hub, port_dev); | ||
919 | ret = hub_set_port_link_state(hub, port_dev->portnum, | ||
920 | USB_SS_PORT_LS_U3); | ||
921 | } else { | ||
922 | ret = usb_clear_port_feature(hdev, port1, | ||
923 | USB_PORT_FEAT_ENABLE); | ||
924 | } | ||
925 | } | ||
926 | if (port_dev->child && set_state) | ||
927 | usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED); | ||
928 | if (ret && ret != -ENODEV) | ||
929 | dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret); | ||
930 | return ret; | ||
931 | } | ||
932 | |||
933 | /* | ||
934 | * Disable a port and mark a logical connect-change event, so that some | 905 | * Disable a port and mark a logical connect-change event, so that some |
935 | * time later hub_wq will disconnect() any existing usb_device on the port | 906 | * time later hub_wq will disconnect() any existing usb_device on the port |
936 | * and will re-enumerate if there actually is a device attached. | 907 | * and will re-enumerate if there actually is a device attached. |
@@ -4162,6 +4133,34 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port, | |||
4162 | 4133 | ||
4163 | #endif /* CONFIG_PM */ | 4134 | #endif /* CONFIG_PM */ |
4164 | 4135 | ||
4136 | /* | ||
4137 | * USB-3 does not have a similar link state as USB-2 that will avoid negotiating | ||
4138 | * a connection with a plugged-in cable but will signal the host when the cable | ||
4139 | * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices | ||
4140 | */ | ||
4141 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
4142 | { | ||
4143 | struct usb_port *port_dev = hub->ports[port1 - 1]; | ||
4144 | struct usb_device *hdev = hub->hdev; | ||
4145 | int ret = 0; | ||
4146 | |||
4147 | if (!hub->error) { | ||
4148 | if (hub_is_superspeed(hub->hdev)) { | ||
4149 | hub_usb3_port_prepare_disable(hub, port_dev); | ||
4150 | ret = hub_set_port_link_state(hub, port_dev->portnum, | ||
4151 | USB_SS_PORT_LS_U3); | ||
4152 | } else { | ||
4153 | ret = usb_clear_port_feature(hdev, port1, | ||
4154 | USB_PORT_FEAT_ENABLE); | ||
4155 | } | ||
4156 | } | ||
4157 | if (port_dev->child && set_state) | ||
4158 | usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED); | ||
4159 | if (ret && ret != -ENODEV) | ||
4160 | dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret); | ||
4161 | return ret; | ||
4162 | } | ||
4163 | |||
4165 | 4164 | ||
4166 | /* USB 2.0 spec, 7.1.7.3 / fig 7-29: | 4165 | /* USB 2.0 spec, 7.1.7.3 / fig 7-29: |
4167 | * | 4166 | * |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index b95930f20d90..c55db4aa54d6 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -3753,7 +3753,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, | |||
3753 | hs_ep->desc_list = dma_alloc_coherent(hsotg->dev, | 3753 | hs_ep->desc_list = dma_alloc_coherent(hsotg->dev, |
3754 | MAX_DMA_DESC_NUM_GENERIC * | 3754 | MAX_DMA_DESC_NUM_GENERIC * |
3755 | sizeof(struct dwc2_dma_desc), | 3755 | sizeof(struct dwc2_dma_desc), |
3756 | &hs_ep->desc_list_dma, GFP_KERNEL); | 3756 | &hs_ep->desc_list_dma, GFP_ATOMIC); |
3757 | if (!hs_ep->desc_list) { | 3757 | if (!hs_ep->desc_list) { |
3758 | ret = -ENOMEM; | 3758 | ret = -ENOMEM; |
3759 | goto error2; | 3759 | goto error2; |
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index a786256535b6..11fe68a4627b 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c | |||
@@ -247,8 +247,6 @@ MODULE_DEVICE_TABLE(of, dwc2_of_match_table); | |||
247 | static void dwc2_get_device_property(struct dwc2_hsotg *hsotg, | 247 | static void dwc2_get_device_property(struct dwc2_hsotg *hsotg, |
248 | char *property, u8 size, u64 *value) | 248 | char *property, u8 size, u64 *value) |
249 | { | 249 | { |
250 | u8 val8; | ||
251 | u16 val16; | ||
252 | u32 val32; | 250 | u32 val32; |
253 | 251 | ||
254 | switch (size) { | 252 | switch (size) { |
@@ -256,17 +254,7 @@ static void dwc2_get_device_property(struct dwc2_hsotg *hsotg, | |||
256 | *value = device_property_read_bool(hsotg->dev, property); | 254 | *value = device_property_read_bool(hsotg->dev, property); |
257 | break; | 255 | break; |
258 | case 1: | 256 | case 1: |
259 | if (device_property_read_u8(hsotg->dev, property, &val8)) | ||
260 | return; | ||
261 | |||
262 | *value = val8; | ||
263 | break; | ||
264 | case 2: | 257 | case 2: |
265 | if (device_property_read_u16(hsotg->dev, property, &val16)) | ||
266 | return; | ||
267 | |||
268 | *value = val16; | ||
269 | break; | ||
270 | case 4: | 258 | case 4: |
271 | if (device_property_read_u32(hsotg->dev, property, &val32)) | 259 | if (device_property_read_u32(hsotg->dev, property, &val32)) |
272 | return; | 260 | return; |
@@ -1100,13 +1088,13 @@ static void dwc2_set_gadget_dma(struct dwc2_hsotg *hsotg) | |||
1100 | /* Buffer DMA */ | 1088 | /* Buffer DMA */ |
1101 | dwc2_set_param_bool(hsotg, &p->g_dma, | 1089 | dwc2_set_param_bool(hsotg, &p->g_dma, |
1102 | false, "gadget-dma", | 1090 | false, "gadget-dma", |
1103 | true, false, | 1091 | dma_capable, false, |
1104 | dma_capable); | 1092 | dma_capable); |
1105 | 1093 | ||
1106 | /* DMA Descriptor */ | 1094 | /* DMA Descriptor */ |
1107 | dwc2_set_param_bool(hsotg, &p->g_dma_desc, false, | 1095 | dwc2_set_param_bool(hsotg, &p->g_dma_desc, false, |
1108 | "gadget-dma-desc", | 1096 | "gadget-dma-desc", |
1109 | p->g_dma, false, | 1097 | !!hw->dma_desc_enable, false, |
1110 | !!hw->dma_desc_enable); | 1098 | !!hw->dma_desc_enable); |
1111 | } | 1099 | } |
1112 | 1100 | ||
@@ -1130,8 +1118,14 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg, | |||
1130 | 1118 | ||
1131 | dwc2_set_param_bool(hsotg, &p->host_dma, | 1119 | dwc2_set_param_bool(hsotg, &p->host_dma, |
1132 | false, "host-dma", | 1120 | false, "host-dma", |
1133 | true, false, | 1121 | dma_capable, false, |
1134 | dma_capable); | 1122 | dma_capable); |
1123 | dwc2_set_param_host_rx_fifo_size(hsotg, | ||
1124 | params->host_rx_fifo_size); | ||
1125 | dwc2_set_param_host_nperio_tx_fifo_size(hsotg, | ||
1126 | params->host_nperio_tx_fifo_size); | ||
1127 | dwc2_set_param_host_perio_tx_fifo_size(hsotg, | ||
1128 | params->host_perio_tx_fifo_size); | ||
1135 | } | 1129 | } |
1136 | dwc2_set_param_dma_desc_enable(hsotg, params->dma_desc_enable); | 1130 | dwc2_set_param_dma_desc_enable(hsotg, params->dma_desc_enable); |
1137 | dwc2_set_param_dma_desc_fs_enable(hsotg, params->dma_desc_fs_enable); | 1131 | dwc2_set_param_dma_desc_fs_enable(hsotg, params->dma_desc_fs_enable); |
@@ -1140,12 +1134,6 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg, | |||
1140 | params->host_support_fs_ls_low_power); | 1134 | params->host_support_fs_ls_low_power); |
1141 | dwc2_set_param_enable_dynamic_fifo(hsotg, | 1135 | dwc2_set_param_enable_dynamic_fifo(hsotg, |
1142 | params->enable_dynamic_fifo); | 1136 | params->enable_dynamic_fifo); |
1143 | dwc2_set_param_host_rx_fifo_size(hsotg, | ||
1144 | params->host_rx_fifo_size); | ||
1145 | dwc2_set_param_host_nperio_tx_fifo_size(hsotg, | ||
1146 | params->host_nperio_tx_fifo_size); | ||
1147 | dwc2_set_param_host_perio_tx_fifo_size(hsotg, | ||
1148 | params->host_perio_tx_fifo_size); | ||
1149 | dwc2_set_param_max_transfer_size(hsotg, | 1137 | dwc2_set_param_max_transfer_size(hsotg, |
1150 | params->max_transfer_size); | 1138 | params->max_transfer_size); |
1151 | dwc2_set_param_max_packet_count(hsotg, | 1139 | dwc2_set_param_max_packet_count(hsotg, |
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index de5a8570be04..14b760209680 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
@@ -45,9 +45,7 @@ | |||
45 | #define DWC3_XHCI_RESOURCES_NUM 2 | 45 | #define DWC3_XHCI_RESOURCES_NUM 2 |
46 | 46 | ||
47 | #define DWC3_SCRATCHBUF_SIZE 4096 /* each buffer is assumed to be 4KiB */ | 47 | #define DWC3_SCRATCHBUF_SIZE 4096 /* each buffer is assumed to be 4KiB */ |
48 | #define DWC3_EVENT_SIZE 4 /* bytes */ | 48 | #define DWC3_EVENT_BUFFERS_SIZE 4096 |
49 | #define DWC3_EVENT_MAX_NUM 64 /* 2 events/endpoint */ | ||
50 | #define DWC3_EVENT_BUFFERS_SIZE (DWC3_EVENT_SIZE * DWC3_EVENT_MAX_NUM) | ||
51 | #define DWC3_EVENT_TYPE_MASK 0xfe | 49 | #define DWC3_EVENT_TYPE_MASK 0xfe |
52 | 50 | ||
53 | #define DWC3_EVENT_TYPE_DEV 0 | 51 | #define DWC3_EVENT_TYPE_DEV 0 |
@@ -311,9 +309,8 @@ | |||
311 | #define DWC3_DCFG_SUPERSPEED_PLUS (5 << 0) /* DWC_usb31 only */ | 309 | #define DWC3_DCFG_SUPERSPEED_PLUS (5 << 0) /* DWC_usb31 only */ |
312 | #define DWC3_DCFG_SUPERSPEED (4 << 0) | 310 | #define DWC3_DCFG_SUPERSPEED (4 << 0) |
313 | #define DWC3_DCFG_HIGHSPEED (0 << 0) | 311 | #define DWC3_DCFG_HIGHSPEED (0 << 0) |
314 | #define DWC3_DCFG_FULLSPEED2 (1 << 0) | 312 | #define DWC3_DCFG_FULLSPEED (1 << 0) |
315 | #define DWC3_DCFG_LOWSPEED (2 << 0) | 313 | #define DWC3_DCFG_LOWSPEED (2 << 0) |
316 | #define DWC3_DCFG_FULLSPEED1 (3 << 0) | ||
317 | 314 | ||
318 | #define DWC3_DCFG_NUMP_SHIFT 17 | 315 | #define DWC3_DCFG_NUMP_SHIFT 17 |
319 | #define DWC3_DCFG_NUMP(n) (((n) >> DWC3_DCFG_NUMP_SHIFT) & 0x1f) | 316 | #define DWC3_DCFG_NUMP(n) (((n) >> DWC3_DCFG_NUMP_SHIFT) & 0x1f) |
@@ -405,9 +402,8 @@ | |||
405 | #define DWC3_DSTS_SUPERSPEED_PLUS (5 << 0) /* DWC_usb31 only */ | 402 | #define DWC3_DSTS_SUPERSPEED_PLUS (5 << 0) /* DWC_usb31 only */ |
406 | #define DWC3_DSTS_SUPERSPEED (4 << 0) | 403 | #define DWC3_DSTS_SUPERSPEED (4 << 0) |
407 | #define DWC3_DSTS_HIGHSPEED (0 << 0) | 404 | #define DWC3_DSTS_HIGHSPEED (0 << 0) |
408 | #define DWC3_DSTS_FULLSPEED2 (1 << 0) | 405 | #define DWC3_DSTS_FULLSPEED (1 << 0) |
409 | #define DWC3_DSTS_LOWSPEED (2 << 0) | 406 | #define DWC3_DSTS_LOWSPEED (2 << 0) |
410 | #define DWC3_DSTS_FULLSPEED1 (3 << 0) | ||
411 | 407 | ||
412 | /* Device Generic Command Register */ | 408 | /* Device Generic Command Register */ |
413 | #define DWC3_DGCMD_SET_LMP 0x01 | 409 | #define DWC3_DGCMD_SET_LMP 0x01 |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 29e80cc9b634..eb1b9cb3f9d1 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/irq.h> | ||
22 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
24 | #include <linux/platform_data/dwc3-omap.h> | 25 | #include <linux/platform_data/dwc3-omap.h> |
@@ -510,7 +511,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
510 | 511 | ||
511 | /* check the DMA Status */ | 512 | /* check the DMA Status */ |
512 | reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG); | 513 | reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG); |
513 | 514 | irq_set_status_flags(omap->irq, IRQ_NOAUTOEN); | |
514 | ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt, | 515 | ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt, |
515 | dwc3_omap_interrupt_thread, IRQF_SHARED, | 516 | dwc3_omap_interrupt_thread, IRQF_SHARED, |
516 | "dwc3-omap", omap); | 517 | "dwc3-omap", omap); |
@@ -531,7 +532,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
531 | } | 532 | } |
532 | 533 | ||
533 | dwc3_omap_enable_irqs(omap); | 534 | dwc3_omap_enable_irqs(omap); |
534 | 535 | enable_irq(omap->irq); | |
535 | return 0; | 536 | return 0; |
536 | 537 | ||
537 | err2: | 538 | err2: |
@@ -552,6 +553,7 @@ static int dwc3_omap_remove(struct platform_device *pdev) | |||
552 | extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb); | 553 | extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb); |
553 | extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb); | 554 | extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb); |
554 | dwc3_omap_disable_irqs(omap); | 555 | dwc3_omap_disable_irqs(omap); |
556 | disable_irq(omap->irq); | ||
555 | of_platform_depopulate(omap->dev); | 557 | of_platform_depopulate(omap->dev); |
556 | pm_runtime_put_sync(&pdev->dev); | 558 | pm_runtime_put_sync(&pdev->dev); |
557 | pm_runtime_disable(&pdev->dev); | 559 | pm_runtime_disable(&pdev->dev); |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 2b73339f286b..cce0a220b6b0 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa | 38 | #define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa |
39 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa | 39 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa |
40 | #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 | 40 | #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 |
41 | #define PCI_DEVICE_ID_INTEL_GLK 0x31aa | ||
41 | 42 | ||
42 | #define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" | 43 | #define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" |
43 | #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 | 44 | #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 |
@@ -73,16 +74,6 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) | |||
73 | { | 74 | { |
74 | struct platform_device *dwc3 = dwc->dwc3; | 75 | struct platform_device *dwc3 = dwc->dwc3; |
75 | struct pci_dev *pdev = dwc->pci; | 76 | struct pci_dev *pdev = dwc->pci; |
76 | int ret; | ||
77 | |||
78 | struct property_entry sysdev_property[] = { | ||
79 | PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), | ||
80 | { }, | ||
81 | }; | ||
82 | |||
83 | ret = platform_device_add_properties(dwc3, sysdev_property); | ||
84 | if (ret) | ||
85 | return ret; | ||
86 | 77 | ||
87 | if (pdev->vendor == PCI_VENDOR_ID_AMD && | 78 | if (pdev->vendor == PCI_VENDOR_ID_AMD && |
88 | pdev->device == PCI_DEVICE_ID_AMD_NL_USB) { | 79 | pdev->device == PCI_DEVICE_ID_AMD_NL_USB) { |
@@ -105,6 +96,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) | |||
105 | PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"), | 96 | PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"), |
106 | PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"), | 97 | PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"), |
107 | PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), | 98 | PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), |
99 | PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), | ||
108 | { }, | 100 | { }, |
109 | }; | 101 | }; |
110 | 102 | ||
@@ -115,7 +107,8 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) | |||
115 | int ret; | 107 | int ret; |
116 | 108 | ||
117 | struct property_entry properties[] = { | 109 | struct property_entry properties[] = { |
118 | PROPERTY_ENTRY_STRING("dr-mode", "peripheral"), | 110 | PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), |
111 | PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), | ||
119 | { } | 112 | { } |
120 | }; | 113 | }; |
121 | 114 | ||
@@ -167,6 +160,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) | |||
167 | PROPERTY_ENTRY_BOOL("snps,usb3_lpm_capable"), | 160 | PROPERTY_ENTRY_BOOL("snps,usb3_lpm_capable"), |
168 | PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"), | 161 | PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"), |
169 | PROPERTY_ENTRY_BOOL("snps,dis_enblslpm_quirk"), | 162 | PROPERTY_ENTRY_BOOL("snps,dis_enblslpm_quirk"), |
163 | PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), | ||
170 | { }, | 164 | { }, |
171 | }; | 165 | }; |
172 | 166 | ||
@@ -274,6 +268,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | |||
274 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, | 268 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, |
275 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, | 269 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, |
276 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, | 270 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, |
271 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), }, | ||
277 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, | 272 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, |
278 | { } /* Terminating Entry */ | 273 | { } /* Terminating Entry */ |
279 | }; | 274 | }; |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 4878d187c7d4..9bb1f8526f3e 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -39,18 +39,13 @@ static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep); | |||
39 | static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | 39 | static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, |
40 | struct dwc3_ep *dep, struct dwc3_request *req); | 40 | struct dwc3_ep *dep, struct dwc3_request *req); |
41 | 41 | ||
42 | static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, | 42 | static void dwc3_ep0_prepare_one_trb(struct dwc3 *dwc, u8 epnum, |
43 | u32 len, u32 type, bool chain) | 43 | dma_addr_t buf_dma, u32 len, u32 type, bool chain) |
44 | { | 44 | { |
45 | struct dwc3_gadget_ep_cmd_params params; | ||
46 | struct dwc3_trb *trb; | 45 | struct dwc3_trb *trb; |
47 | struct dwc3_ep *dep; | 46 | struct dwc3_ep *dep; |
48 | 47 | ||
49 | int ret; | ||
50 | |||
51 | dep = dwc->eps[epnum]; | 48 | dep = dwc->eps[epnum]; |
52 | if (dep->flags & DWC3_EP_BUSY) | ||
53 | return 0; | ||
54 | 49 | ||
55 | trb = &dwc->ep0_trb[dep->trb_enqueue]; | 50 | trb = &dwc->ep0_trb[dep->trb_enqueue]; |
56 | 51 | ||
@@ -71,15 +66,23 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, | |||
71 | trb->ctrl |= (DWC3_TRB_CTRL_IOC | 66 | trb->ctrl |= (DWC3_TRB_CTRL_IOC |
72 | | DWC3_TRB_CTRL_LST); | 67 | | DWC3_TRB_CTRL_LST); |
73 | 68 | ||
74 | if (chain) | 69 | trace_dwc3_prepare_trb(dep, trb); |
70 | } | ||
71 | |||
72 | static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum) | ||
73 | { | ||
74 | struct dwc3_gadget_ep_cmd_params params; | ||
75 | struct dwc3_ep *dep; | ||
76 | int ret; | ||
77 | |||
78 | dep = dwc->eps[epnum]; | ||
79 | if (dep->flags & DWC3_EP_BUSY) | ||
75 | return 0; | 80 | return 0; |
76 | 81 | ||
77 | memset(¶ms, 0, sizeof(params)); | 82 | memset(¶ms, 0, sizeof(params)); |
78 | params.param0 = upper_32_bits(dwc->ep0_trb_addr); | 83 | params.param0 = upper_32_bits(dwc->ep0_trb_addr); |
79 | params.param1 = lower_32_bits(dwc->ep0_trb_addr); | 84 | params.param1 = lower_32_bits(dwc->ep0_trb_addr); |
80 | 85 | ||
81 | trace_dwc3_prepare_trb(dep, trb); | ||
82 | |||
83 | ret = dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_STARTTRANSFER, ¶ms); | 86 | ret = dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_STARTTRANSFER, ¶ms); |
84 | if (ret < 0) | 87 | if (ret < 0) |
85 | return ret; | 88 | return ret; |
@@ -280,8 +283,9 @@ void dwc3_ep0_out_start(struct dwc3 *dwc) | |||
280 | 283 | ||
281 | complete(&dwc->ep0_in_setup); | 284 | complete(&dwc->ep0_in_setup); |
282 | 285 | ||
283 | ret = dwc3_ep0_start_trans(dwc, 0, dwc->ctrl_req_addr, 8, | 286 | dwc3_ep0_prepare_one_trb(dwc, 0, dwc->ctrl_req_addr, 8, |
284 | DWC3_TRBCTL_CONTROL_SETUP, false); | 287 | DWC3_TRBCTL_CONTROL_SETUP, false); |
288 | ret = dwc3_ep0_start_trans(dwc, 0); | ||
285 | WARN_ON(ret < 0); | 289 | WARN_ON(ret < 0); |
286 | } | 290 | } |
287 | 291 | ||
@@ -912,9 +916,9 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
912 | 916 | ||
913 | dwc->ep0_next_event = DWC3_EP0_COMPLETE; | 917 | dwc->ep0_next_event = DWC3_EP0_COMPLETE; |
914 | 918 | ||
915 | ret = dwc3_ep0_start_trans(dwc, epnum, | 919 | dwc3_ep0_prepare_one_trb(dwc, epnum, dwc->ctrl_req_addr, |
916 | dwc->ctrl_req_addr, 0, | 920 | 0, DWC3_TRBCTL_CONTROL_DATA, false); |
917 | DWC3_TRBCTL_CONTROL_DATA, false); | 921 | ret = dwc3_ep0_start_trans(dwc, epnum); |
918 | WARN_ON(ret < 0); | 922 | WARN_ON(ret < 0); |
919 | } | 923 | } |
920 | } | 924 | } |
@@ -993,9 +997,10 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | |||
993 | req->direction = !!dep->number; | 997 | req->direction = !!dep->number; |
994 | 998 | ||
995 | if (req->request.length == 0) { | 999 | if (req->request.length == 0) { |
996 | ret = dwc3_ep0_start_trans(dwc, dep->number, | 1000 | dwc3_ep0_prepare_one_trb(dwc, dep->number, |
997 | dwc->ctrl_req_addr, 0, | 1001 | dwc->ctrl_req_addr, 0, |
998 | DWC3_TRBCTL_CONTROL_DATA, false); | 1002 | DWC3_TRBCTL_CONTROL_DATA, false); |
1003 | ret = dwc3_ep0_start_trans(dwc, dep->number); | ||
999 | } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) | 1004 | } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) |
1000 | && (dep->number == 0)) { | 1005 | && (dep->number == 0)) { |
1001 | u32 transfer_size = 0; | 1006 | u32 transfer_size = 0; |
@@ -1011,7 +1016,7 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | |||
1011 | if (req->request.length > DWC3_EP0_BOUNCE_SIZE) { | 1016 | if (req->request.length > DWC3_EP0_BOUNCE_SIZE) { |
1012 | transfer_size = ALIGN(req->request.length - maxpacket, | 1017 | transfer_size = ALIGN(req->request.length - maxpacket, |
1013 | maxpacket); | 1018 | maxpacket); |
1014 | ret = dwc3_ep0_start_trans(dwc, dep->number, | 1019 | dwc3_ep0_prepare_one_trb(dwc, dep->number, |
1015 | req->request.dma, | 1020 | req->request.dma, |
1016 | transfer_size, | 1021 | transfer_size, |
1017 | DWC3_TRBCTL_CONTROL_DATA, | 1022 | DWC3_TRBCTL_CONTROL_DATA, |
@@ -1023,18 +1028,20 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | |||
1023 | 1028 | ||
1024 | dwc->ep0_bounced = true; | 1029 | dwc->ep0_bounced = true; |
1025 | 1030 | ||
1026 | ret = dwc3_ep0_start_trans(dwc, dep->number, | 1031 | dwc3_ep0_prepare_one_trb(dwc, dep->number, |
1027 | dwc->ep0_bounce_addr, transfer_size, | 1032 | dwc->ep0_bounce_addr, transfer_size, |
1028 | DWC3_TRBCTL_CONTROL_DATA, false); | 1033 | DWC3_TRBCTL_CONTROL_DATA, false); |
1034 | ret = dwc3_ep0_start_trans(dwc, dep->number); | ||
1029 | } else { | 1035 | } else { |
1030 | ret = usb_gadget_map_request_by_dev(dwc->sysdev, | 1036 | ret = usb_gadget_map_request_by_dev(dwc->sysdev, |
1031 | &req->request, dep->number); | 1037 | &req->request, dep->number); |
1032 | if (ret) | 1038 | if (ret) |
1033 | return; | 1039 | return; |
1034 | 1040 | ||
1035 | ret = dwc3_ep0_start_trans(dwc, dep->number, req->request.dma, | 1041 | dwc3_ep0_prepare_one_trb(dwc, dep->number, req->request.dma, |
1036 | req->request.length, DWC3_TRBCTL_CONTROL_DATA, | 1042 | req->request.length, DWC3_TRBCTL_CONTROL_DATA, |
1037 | false); | 1043 | false); |
1044 | ret = dwc3_ep0_start_trans(dwc, dep->number); | ||
1038 | } | 1045 | } |
1039 | 1046 | ||
1040 | WARN_ON(ret < 0); | 1047 | WARN_ON(ret < 0); |
@@ -1048,8 +1055,9 @@ static int dwc3_ep0_start_control_status(struct dwc3_ep *dep) | |||
1048 | type = dwc->three_stage_setup ? DWC3_TRBCTL_CONTROL_STATUS3 | 1055 | type = dwc->three_stage_setup ? DWC3_TRBCTL_CONTROL_STATUS3 |
1049 | : DWC3_TRBCTL_CONTROL_STATUS2; | 1056 | : DWC3_TRBCTL_CONTROL_STATUS2; |
1050 | 1057 | ||
1051 | return dwc3_ep0_start_trans(dwc, dep->number, | 1058 | dwc3_ep0_prepare_one_trb(dwc, dep->number, |
1052 | dwc->ctrl_req_addr, 0, type, false); | 1059 | dwc->ctrl_req_addr, 0, type, false); |
1060 | return dwc3_ep0_start_trans(dwc, dep->number); | ||
1053 | } | 1061 | } |
1054 | 1062 | ||
1055 | static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) | 1063 | static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index efddaf5d11d1..204c754cc647 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -180,11 +180,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, | |||
180 | if (req->request.status == -EINPROGRESS) | 180 | if (req->request.status == -EINPROGRESS) |
181 | req->request.status = status; | 181 | req->request.status = status; |
182 | 182 | ||
183 | if (dwc->ep0_bounced && dep->number == 0) | 183 | if (dwc->ep0_bounced && dep->number <= 1) |
184 | dwc->ep0_bounced = false; | 184 | dwc->ep0_bounced = false; |
185 | else | 185 | |
186 | usb_gadget_unmap_request_by_dev(dwc->sysdev, | 186 | usb_gadget_unmap_request_by_dev(dwc->sysdev, |
187 | &req->request, req->direction); | 187 | &req->request, req->direction); |
188 | 188 | ||
189 | trace_dwc3_gadget_giveback(req); | 189 | trace_dwc3_gadget_giveback(req); |
190 | 190 | ||
@@ -1720,7 +1720,7 @@ static int __dwc3_gadget_start(struct dwc3 *dwc) | |||
1720 | reg |= DWC3_DCFG_LOWSPEED; | 1720 | reg |= DWC3_DCFG_LOWSPEED; |
1721 | break; | 1721 | break; |
1722 | case USB_SPEED_FULL: | 1722 | case USB_SPEED_FULL: |
1723 | reg |= DWC3_DCFG_FULLSPEED1; | 1723 | reg |= DWC3_DCFG_FULLSPEED; |
1724 | break; | 1724 | break; |
1725 | case USB_SPEED_HIGH: | 1725 | case USB_SPEED_HIGH: |
1726 | reg |= DWC3_DCFG_HIGHSPEED; | 1726 | reg |= DWC3_DCFG_HIGHSPEED; |
@@ -2232,9 +2232,14 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, | |||
2232 | 2232 | ||
2233 | dep = dwc->eps[epnum]; | 2233 | dep = dwc->eps[epnum]; |
2234 | 2234 | ||
2235 | if (!(dep->flags & DWC3_EP_ENABLED) && | 2235 | if (!(dep->flags & DWC3_EP_ENABLED)) { |
2236 | !(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) | 2236 | if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) |
2237 | return; | 2237 | return; |
2238 | |||
2239 | /* Handle only EPCMDCMPLT when EP disabled */ | ||
2240 | if (event->endpoint_event != DWC3_DEPEVT_EPCMDCMPLT) | ||
2241 | return; | ||
2242 | } | ||
2238 | 2243 | ||
2239 | if (epnum == 0 || epnum == 1) { | 2244 | if (epnum == 0 || epnum == 1) { |
2240 | dwc3_ep0_interrupt(dwc, event); | 2245 | dwc3_ep0_interrupt(dwc, event); |
@@ -2531,8 +2536,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) | |||
2531 | dwc->gadget.ep0->maxpacket = 64; | 2536 | dwc->gadget.ep0->maxpacket = 64; |
2532 | dwc->gadget.speed = USB_SPEED_HIGH; | 2537 | dwc->gadget.speed = USB_SPEED_HIGH; |
2533 | break; | 2538 | break; |
2534 | case DWC3_DSTS_FULLSPEED2: | 2539 | case DWC3_DSTS_FULLSPEED: |
2535 | case DWC3_DSTS_FULLSPEED1: | ||
2536 | dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(64); | 2540 | dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(64); |
2537 | dwc->gadget.ep0->maxpacket = 64; | 2541 | dwc->gadget.ep0->maxpacket = 64; |
2538 | dwc->gadget.speed = USB_SPEED_FULL; | 2542 | dwc->gadget.speed = USB_SPEED_FULL; |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 41ab61f9b6e0..002822d98fda 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -1694,9 +1694,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1694 | value = min(w_length, (u16) 1); | 1694 | value = min(w_length, (u16) 1); |
1695 | break; | 1695 | break; |
1696 | 1696 | ||
1697 | /* function drivers must handle get/set altsetting; if there's | 1697 | /* function drivers must handle get/set altsetting */ |
1698 | * no get() method, we know only altsetting zero works. | ||
1699 | */ | ||
1700 | case USB_REQ_SET_INTERFACE: | 1698 | case USB_REQ_SET_INTERFACE: |
1701 | if (ctrl->bRequestType != USB_RECIP_INTERFACE) | 1699 | if (ctrl->bRequestType != USB_RECIP_INTERFACE) |
1702 | goto unknown; | 1700 | goto unknown; |
@@ -1705,7 +1703,13 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1705 | f = cdev->config->interface[intf]; | 1703 | f = cdev->config->interface[intf]; |
1706 | if (!f) | 1704 | if (!f) |
1707 | break; | 1705 | break; |
1708 | if (w_value && !f->set_alt) | 1706 | |
1707 | /* | ||
1708 | * If there's no get_alt() method, we know only altsetting zero | ||
1709 | * works. There is no need to check if set_alt() is not NULL | ||
1710 | * as we check this in usb_add_function(). | ||
1711 | */ | ||
1712 | if (w_value && !f->get_alt) | ||
1709 | break; | 1713 | break; |
1710 | value = f->set_alt(f, w_index, w_value); | 1714 | value = f->set_alt(f, w_index, w_value); |
1711 | if (value == USB_GADGET_DELAYED_STATUS) { | 1715 | if (value == USB_GADGET_DELAYED_STATUS) { |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index aab3fc1dbb94..5e746adc8a2d 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -2091,8 +2091,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
2091 | 2091 | ||
2092 | case FFS_STRING: | 2092 | case FFS_STRING: |
2093 | /* | 2093 | /* |
2094 | * Strings are indexed from 1 (0 is magic ;) reserved | 2094 | * Strings are indexed from 1 (0 is reserved |
2095 | * for languages list or some such) | 2095 | * for languages list) |
2096 | */ | 2096 | */ |
2097 | if (*valuep > helper->ffs->strings_count) | 2097 | if (*valuep > helper->ffs->strings_count) |
2098 | helper->ffs->strings_count = *valuep; | 2098 | helper->ffs->strings_count = *valuep; |
@@ -2252,7 +2252,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, | |||
2252 | 2252 | ||
2253 | if (len < sizeof(*d) || | 2253 | if (len < sizeof(*d) || |
2254 | d->bFirstInterfaceNumber >= ffs->interfaces_count || | 2254 | d->bFirstInterfaceNumber >= ffs->interfaces_count || |
2255 | !d->Reserved1) | 2255 | d->Reserved1) |
2256 | return -EINVAL; | 2256 | return -EINVAL; |
2257 | for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) | 2257 | for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) |
2258 | if (d->Reserved2[i]) | 2258 | if (d->Reserved2[i]) |
@@ -3666,6 +3666,7 @@ static void ffs_closed(struct ffs_data *ffs) | |||
3666 | { | 3666 | { |
3667 | struct ffs_dev *ffs_obj; | 3667 | struct ffs_dev *ffs_obj; |
3668 | struct f_fs_opts *opts; | 3668 | struct f_fs_opts *opts; |
3669 | struct config_item *ci; | ||
3669 | 3670 | ||
3670 | ENTER(); | 3671 | ENTER(); |
3671 | ffs_dev_lock(); | 3672 | ffs_dev_lock(); |
@@ -3689,8 +3690,11 @@ static void ffs_closed(struct ffs_data *ffs) | |||
3689 | || !atomic_read(&opts->func_inst.group.cg_item.ci_kref.refcount)) | 3690 | || !atomic_read(&opts->func_inst.group.cg_item.ci_kref.refcount)) |
3690 | goto done; | 3691 | goto done; |
3691 | 3692 | ||
3692 | unregister_gadget_item(ffs_obj->opts-> | 3693 | ci = opts->func_inst.group.cg_item.ci_parent->ci_parent; |
3693 | func_inst.group.cg_item.ci_parent->ci_parent); | 3694 | ffs_dev_unlock(); |
3695 | |||
3696 | unregister_gadget_item(ci); | ||
3697 | return; | ||
3694 | done: | 3698 | done: |
3695 | ffs_dev_unlock(); | 3699 | ffs_dev_unlock(); |
3696 | } | 3700 | } |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 3151d2a0fe59..5f8139b8e601 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -593,7 +593,7 @@ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
593 | } | 593 | } |
594 | status = usb_ep_enable(hidg->out_ep); | 594 | status = usb_ep_enable(hidg->out_ep); |
595 | if (status < 0) { | 595 | if (status < 0) { |
596 | ERROR(cdev, "Enable IN endpoint FAILED!\n"); | 596 | ERROR(cdev, "Enable OUT endpoint FAILED!\n"); |
597 | goto fail; | 597 | goto fail; |
598 | } | 598 | } |
599 | hidg->out_ep->driver_data = hidg; | 599 | hidg->out_ep->driver_data = hidg; |
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index e8f4102d19df..6bde4396927c 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
@@ -1126,7 +1126,7 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
1126 | /* data and/or status stage for control request */ | 1126 | /* data and/or status stage for control request */ |
1127 | } else if (dev->state == STATE_DEV_SETUP) { | 1127 | } else if (dev->state == STATE_DEV_SETUP) { |
1128 | 1128 | ||
1129 | /* IN DATA+STATUS caller makes len <= wLength */ | 1129 | len = min_t(size_t, len, dev->setup_wLength); |
1130 | if (dev->setup_in) { | 1130 | if (dev->setup_in) { |
1131 | retval = setup_req (dev->gadget->ep0, dev->req, len); | 1131 | retval = setup_req (dev->gadget->ep0, dev->req, len); |
1132 | if (retval == 0) { | 1132 | if (retval == 0) { |
@@ -1734,10 +1734,12 @@ static struct usb_gadget_driver gadgetfs_driver = { | |||
1734 | * such as configuration notifications. | 1734 | * such as configuration notifications. |
1735 | */ | 1735 | */ |
1736 | 1736 | ||
1737 | static int is_valid_config (struct usb_config_descriptor *config) | 1737 | static int is_valid_config(struct usb_config_descriptor *config, |
1738 | unsigned int total) | ||
1738 | { | 1739 | { |
1739 | return config->bDescriptorType == USB_DT_CONFIG | 1740 | return config->bDescriptorType == USB_DT_CONFIG |
1740 | && config->bLength == USB_DT_CONFIG_SIZE | 1741 | && config->bLength == USB_DT_CONFIG_SIZE |
1742 | && total >= USB_DT_CONFIG_SIZE | ||
1741 | && config->bConfigurationValue != 0 | 1743 | && config->bConfigurationValue != 0 |
1742 | && (config->bmAttributes & USB_CONFIG_ATT_ONE) != 0 | 1744 | && (config->bmAttributes & USB_CONFIG_ATT_ONE) != 0 |
1743 | && (config->bmAttributes & USB_CONFIG_ATT_WAKEUP) == 0; | 1745 | && (config->bmAttributes & USB_CONFIG_ATT_WAKEUP) == 0; |
@@ -1762,7 +1764,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
1762 | } | 1764 | } |
1763 | spin_unlock_irq(&dev->lock); | 1765 | spin_unlock_irq(&dev->lock); |
1764 | 1766 | ||
1765 | if (len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) | 1767 | if ((len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) || |
1768 | (len > PAGE_SIZE * 4)) | ||
1766 | return -EINVAL; | 1769 | return -EINVAL; |
1767 | 1770 | ||
1768 | /* we might need to change message format someday */ | 1771 | /* we might need to change message format someday */ |
@@ -1786,7 +1789,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
1786 | /* full or low speed config */ | 1789 | /* full or low speed config */ |
1787 | dev->config = (void *) kbuf; | 1790 | dev->config = (void *) kbuf; |
1788 | total = le16_to_cpu(dev->config->wTotalLength); | 1791 | total = le16_to_cpu(dev->config->wTotalLength); |
1789 | if (!is_valid_config (dev->config) || total >= length) | 1792 | if (!is_valid_config(dev->config, total) || |
1793 | total > length - USB_DT_DEVICE_SIZE) | ||
1790 | goto fail; | 1794 | goto fail; |
1791 | kbuf += total; | 1795 | kbuf += total; |
1792 | length -= total; | 1796 | length -= total; |
@@ -1795,10 +1799,13 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
1795 | if (kbuf [1] == USB_DT_CONFIG) { | 1799 | if (kbuf [1] == USB_DT_CONFIG) { |
1796 | dev->hs_config = (void *) kbuf; | 1800 | dev->hs_config = (void *) kbuf; |
1797 | total = le16_to_cpu(dev->hs_config->wTotalLength); | 1801 | total = le16_to_cpu(dev->hs_config->wTotalLength); |
1798 | if (!is_valid_config (dev->hs_config) || total >= length) | 1802 | if (!is_valid_config(dev->hs_config, total) || |
1803 | total > length - USB_DT_DEVICE_SIZE) | ||
1799 | goto fail; | 1804 | goto fail; |
1800 | kbuf += total; | 1805 | kbuf += total; |
1801 | length -= total; | 1806 | length -= total; |
1807 | } else { | ||
1808 | dev->hs_config = NULL; | ||
1802 | } | 1809 | } |
1803 | 1810 | ||
1804 | /* could support multiple configs, using another encoding! */ | 1811 | /* could support multiple configs, using another encoding! */ |
@@ -1811,7 +1818,6 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
1811 | || dev->dev->bDescriptorType != USB_DT_DEVICE | 1818 | || dev->dev->bDescriptorType != USB_DT_DEVICE |
1812 | || dev->dev->bNumConfigurations != 1) | 1819 | || dev->dev->bNumConfigurations != 1) |
1813 | goto fail; | 1820 | goto fail; |
1814 | dev->dev->bNumConfigurations = 1; | ||
1815 | dev->dev->bcdUSB = cpu_to_le16 (0x0200); | 1821 | dev->dev->bcdUSB = cpu_to_le16 (0x0200); |
1816 | 1822 | ||
1817 | /* triggers gadgetfs_bind(); then we can enumerate. */ | 1823 | /* triggers gadgetfs_bind(); then we can enumerate. */ |
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 9483489080f6..0402177f93cd 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c | |||
@@ -1317,7 +1317,11 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) | |||
1317 | if (!ret) | 1317 | if (!ret) |
1318 | break; | 1318 | break; |
1319 | } | 1319 | } |
1320 | if (!ret && !udc->driver) | 1320 | if (ret) |
1321 | ret = -ENODEV; | ||
1322 | else if (udc->driver) | ||
1323 | ret = -EBUSY; | ||
1324 | else | ||
1321 | goto found; | 1325 | goto found; |
1322 | } else { | 1326 | } else { |
1323 | list_for_each_entry(udc, &udc_list, list) { | 1327 | list_for_each_entry(udc, &udc_list, list) { |
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 02b14e91ae6c..c60abe3a68f9 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c | |||
@@ -330,7 +330,7 @@ static void nuke(struct dummy *dum, struct dummy_ep *ep) | |||
330 | /* caller must hold lock */ | 330 | /* caller must hold lock */ |
331 | static void stop_activity(struct dummy *dum) | 331 | static void stop_activity(struct dummy *dum) |
332 | { | 332 | { |
333 | struct dummy_ep *ep; | 333 | int i; |
334 | 334 | ||
335 | /* prevent any more requests */ | 335 | /* prevent any more requests */ |
336 | dum->address = 0; | 336 | dum->address = 0; |
@@ -338,8 +338,8 @@ static void stop_activity(struct dummy *dum) | |||
338 | /* The timer is left running so that outstanding URBs can fail */ | 338 | /* The timer is left running so that outstanding URBs can fail */ |
339 | 339 | ||
340 | /* nuke any pending requests first, so driver i/o is quiesced */ | 340 | /* nuke any pending requests first, so driver i/o is quiesced */ |
341 | list_for_each_entry(ep, &dum->gadget.ep_list, ep.ep_list) | 341 | for (i = 0; i < DUMMY_ENDPOINTS; ++i) |
342 | nuke(dum, ep); | 342 | nuke(dum, &dum->ep[i]); |
343 | 343 | ||
344 | /* driver now does any non-usb quiescing necessary */ | 344 | /* driver now does any non-usb quiescing necessary */ |
345 | } | 345 | } |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index be9e63836881..414e3c376dbb 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -43,7 +43,6 @@ struct at91_usbh_data { | |||
43 | struct gpio_desc *overcurrent_pin[AT91_MAX_USBH_PORTS]; | 43 | struct gpio_desc *overcurrent_pin[AT91_MAX_USBH_PORTS]; |
44 | u8 ports; /* number of ports on root hub */ | 44 | u8 ports; /* number of ports on root hub */ |
45 | u8 overcurrent_supported; | 45 | u8 overcurrent_supported; |
46 | u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS]; | ||
47 | u8 overcurrent_status[AT91_MAX_USBH_PORTS]; | 46 | u8 overcurrent_status[AT91_MAX_USBH_PORTS]; |
48 | u8 overcurrent_changed[AT91_MAX_USBH_PORTS]; | 47 | u8 overcurrent_changed[AT91_MAX_USBH_PORTS]; |
49 | }; | 48 | }; |
@@ -266,8 +265,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int | |||
266 | if (!valid_port(port)) | 265 | if (!valid_port(port)) |
267 | return; | 266 | return; |
268 | 267 | ||
269 | gpiod_set_value(pdata->vbus_pin[port], | 268 | gpiod_set_value(pdata->vbus_pin[port], enable); |
270 | pdata->vbus_pin_active_low[port] ^ enable); | ||
271 | } | 269 | } |
272 | 270 | ||
273 | static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) | 271 | static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) |
@@ -275,8 +273,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) | |||
275 | if (!valid_port(port)) | 273 | if (!valid_port(port)) |
276 | return -EINVAL; | 274 | return -EINVAL; |
277 | 275 | ||
278 | return gpiod_get_value(pdata->vbus_pin[port]) ^ | 276 | return gpiod_get_value(pdata->vbus_pin[port]); |
279 | pdata->vbus_pin_active_low[port]; | ||
280 | } | 277 | } |
281 | 278 | ||
282 | /* | 279 | /* |
@@ -533,18 +530,17 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
533 | pdata->ports = ports; | 530 | pdata->ports = ports; |
534 | 531 | ||
535 | at91_for_each_port(i) { | 532 | at91_for_each_port(i) { |
536 | pdata->vbus_pin[i] = devm_gpiod_get_optional(&pdev->dev, | 533 | if (i >= pdata->ports) |
537 | "atmel,vbus-gpio", | 534 | break; |
538 | GPIOD_IN); | 535 | |
536 | pdata->vbus_pin[i] = | ||
537 | devm_gpiod_get_index_optional(&pdev->dev, "atmel,vbus", | ||
538 | i, GPIOD_OUT_HIGH); | ||
539 | if (IS_ERR(pdata->vbus_pin[i])) { | 539 | if (IS_ERR(pdata->vbus_pin[i])) { |
540 | err = PTR_ERR(pdata->vbus_pin[i]); | 540 | err = PTR_ERR(pdata->vbus_pin[i]); |
541 | dev_err(&pdev->dev, "unable to claim gpio \"vbus\": %d\n", err); | 541 | dev_err(&pdev->dev, "unable to claim gpio \"vbus\": %d\n", err); |
542 | continue; | 542 | continue; |
543 | } | 543 | } |
544 | |||
545 | pdata->vbus_pin_active_low[i] = gpiod_get_value(pdata->vbus_pin[i]); | ||
546 | |||
547 | ohci_at91_usb_set_power(pdata, i, 1); | ||
548 | } | 544 | } |
549 | 545 | ||
550 | at91_for_each_port(i) { | 546 | at91_for_each_port(i) { |
@@ -552,8 +548,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
552 | break; | 548 | break; |
553 | 549 | ||
554 | pdata->overcurrent_pin[i] = | 550 | pdata->overcurrent_pin[i] = |
555 | devm_gpiod_get_optional(&pdev->dev, | 551 | devm_gpiod_get_index_optional(&pdev->dev, "atmel,oc", |
556 | "atmel,oc-gpio", GPIOD_IN); | 552 | i, GPIOD_IN); |
557 | if (IS_ERR(pdata->overcurrent_pin[i])) { | 553 | if (IS_ERR(pdata->overcurrent_pin[i])) { |
558 | err = PTR_ERR(pdata->overcurrent_pin[i]); | 554 | err = PTR_ERR(pdata->overcurrent_pin[i]); |
559 | dev_err(&pdev->dev, "unable to claim gpio \"overcurrent\": %d\n", err); | 555 | dev_err(&pdev->dev, "unable to claim gpio \"overcurrent\": %d\n", err); |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 321de2e0161b..8414ed2a02de 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -979,6 +979,40 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id) | |||
979 | xhci->devs[slot_id] = NULL; | 979 | xhci->devs[slot_id] = NULL; |
980 | } | 980 | } |
981 | 981 | ||
982 | /* | ||
983 | * Free a virt_device structure. | ||
984 | * If the virt_device added a tt_info (a hub) and has children pointing to | ||
985 | * that tt_info, then free the child first. Recursive. | ||
986 | * We can't rely on udev at this point to find child-parent relationships. | ||
987 | */ | ||
988 | void xhci_free_virt_devices_depth_first(struct xhci_hcd *xhci, int slot_id) | ||
989 | { | ||
990 | struct xhci_virt_device *vdev; | ||
991 | struct list_head *tt_list_head; | ||
992 | struct xhci_tt_bw_info *tt_info, *next; | ||
993 | int i; | ||
994 | |||
995 | vdev = xhci->devs[slot_id]; | ||
996 | if (!vdev) | ||
997 | return; | ||
998 | |||
999 | tt_list_head = &(xhci->rh_bw[vdev->real_port - 1].tts); | ||
1000 | list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) { | ||
1001 | /* is this a hub device that added a tt_info to the tts list */ | ||
1002 | if (tt_info->slot_id == slot_id) { | ||
1003 | /* are any devices using this tt_info? */ | ||
1004 | for (i = 1; i < HCS_MAX_SLOTS(xhci->hcs_params1); i++) { | ||
1005 | vdev = xhci->devs[i]; | ||
1006 | if (vdev && (vdev->tt_info == tt_info)) | ||
1007 | xhci_free_virt_devices_depth_first( | ||
1008 | xhci, i); | ||
1009 | } | ||
1010 | } | ||
1011 | } | ||
1012 | /* we are now at a leaf device */ | ||
1013 | xhci_free_virt_device(xhci, slot_id); | ||
1014 | } | ||
1015 | |||
982 | int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, | 1016 | int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, |
983 | struct usb_device *udev, gfp_t flags) | 1017 | struct usb_device *udev, gfp_t flags) |
984 | { | 1018 | { |
@@ -1795,7 +1829,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1795 | int size; | 1829 | int size; |
1796 | int i, j, num_ports; | 1830 | int i, j, num_ports; |
1797 | 1831 | ||
1798 | del_timer_sync(&xhci->cmd_timer); | 1832 | cancel_delayed_work_sync(&xhci->cmd_timer); |
1799 | 1833 | ||
1800 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 1834 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
1801 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 1835 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
@@ -1828,8 +1862,8 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1828 | } | 1862 | } |
1829 | } | 1863 | } |
1830 | 1864 | ||
1831 | for (i = 1; i < MAX_HC_SLOTS; ++i) | 1865 | for (i = HCS_MAX_SLOTS(xhci->hcs_params1); i > 0; i--) |
1832 | xhci_free_virt_device(xhci, i); | 1866 | xhci_free_virt_devices_depth_first(xhci, i); |
1833 | 1867 | ||
1834 | dma_pool_destroy(xhci->segment_pool); | 1868 | dma_pool_destroy(xhci->segment_pool); |
1835 | xhci->segment_pool = NULL; | 1869 | xhci->segment_pool = NULL; |
@@ -2342,9 +2376,9 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2342 | 2376 | ||
2343 | INIT_LIST_HEAD(&xhci->cmd_list); | 2377 | INIT_LIST_HEAD(&xhci->cmd_list); |
2344 | 2378 | ||
2345 | /* init command timeout timer */ | 2379 | /* init command timeout work */ |
2346 | setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout, | 2380 | INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout); |
2347 | (unsigned long)xhci); | 2381 | init_completion(&xhci->cmd_ring_stop_completion); |
2348 | 2382 | ||
2349 | page_size = readl(&xhci->op_regs->page_size); | 2383 | page_size = readl(&xhci->op_regs->page_size); |
2350 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, | 2384 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 1094ebd2838f..bac961cd24ad 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c | |||
@@ -579,8 +579,10 @@ static int xhci_mtk_probe(struct platform_device *pdev) | |||
579 | goto disable_ldos; | 579 | goto disable_ldos; |
580 | 580 | ||
581 | irq = platform_get_irq(pdev, 0); | 581 | irq = platform_get_irq(pdev, 0); |
582 | if (irq < 0) | 582 | if (irq < 0) { |
583 | ret = irq; | ||
583 | goto disable_clk; | 584 | goto disable_clk; |
585 | } | ||
584 | 586 | ||
585 | /* Initialize dma_mask and coherent_dma_mask to 32-bits */ | 587 | /* Initialize dma_mask and coherent_dma_mask to 32-bits */ |
586 | ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); | 588 | ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index e96ae80d107e..954abfd5014d 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -165,7 +165,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
165 | pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || | 165 | pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || |
166 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || | 166 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || |
167 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || | 167 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || |
168 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) { | 168 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || |
169 | pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) { | ||
169 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; | 170 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; |
170 | } | 171 | } |
171 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 172 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index bdf6b13d9b67..25f522b09dd9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -279,23 +279,76 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci) | |||
279 | readl(&xhci->dba->doorbell[0]); | 279 | readl(&xhci->dba->doorbell[0]); |
280 | } | 280 | } |
281 | 281 | ||
282 | static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | 282 | static bool xhci_mod_cmd_timer(struct xhci_hcd *xhci, unsigned long delay) |
283 | { | ||
284 | return mod_delayed_work(system_wq, &xhci->cmd_timer, delay); | ||
285 | } | ||
286 | |||
287 | static struct xhci_command *xhci_next_queued_cmd(struct xhci_hcd *xhci) | ||
288 | { | ||
289 | return list_first_entry_or_null(&xhci->cmd_list, struct xhci_command, | ||
290 | cmd_list); | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * Turn all commands on command ring with status set to "aborted" to no-op trbs. | ||
295 | * If there are other commands waiting then restart the ring and kick the timer. | ||
296 | * This must be called with command ring stopped and xhci->lock held. | ||
297 | */ | ||
298 | static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, | ||
299 | struct xhci_command *cur_cmd) | ||
300 | { | ||
301 | struct xhci_command *i_cmd; | ||
302 | u32 cycle_state; | ||
303 | |||
304 | /* Turn all aborted commands in list to no-ops, then restart */ | ||
305 | list_for_each_entry(i_cmd, &xhci->cmd_list, cmd_list) { | ||
306 | |||
307 | if (i_cmd->status != COMP_CMD_ABORT) | ||
308 | continue; | ||
309 | |||
310 | i_cmd->status = COMP_CMD_STOP; | ||
311 | |||
312 | xhci_dbg(xhci, "Turn aborted command %p to no-op\n", | ||
313 | i_cmd->command_trb); | ||
314 | /* get cycle state from the original cmd trb */ | ||
315 | cycle_state = le32_to_cpu( | ||
316 | i_cmd->command_trb->generic.field[3]) & TRB_CYCLE; | ||
317 | /* modify the command trb to no-op command */ | ||
318 | i_cmd->command_trb->generic.field[0] = 0; | ||
319 | i_cmd->command_trb->generic.field[1] = 0; | ||
320 | i_cmd->command_trb->generic.field[2] = 0; | ||
321 | i_cmd->command_trb->generic.field[3] = cpu_to_le32( | ||
322 | TRB_TYPE(TRB_CMD_NOOP) | cycle_state); | ||
323 | |||
324 | /* | ||
325 | * caller waiting for completion is called when command | ||
326 | * completion event is received for these no-op commands | ||
327 | */ | ||
328 | } | ||
329 | |||
330 | xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; | ||
331 | |||
332 | /* ring command ring doorbell to restart the command ring */ | ||
333 | if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && | ||
334 | !(xhci->xhc_state & XHCI_STATE_DYING)) { | ||
335 | xhci->current_cmd = cur_cmd; | ||
336 | xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); | ||
337 | xhci_ring_cmd_db(xhci); | ||
338 | } | ||
339 | } | ||
340 | |||
341 | /* Must be called with xhci->lock held, releases and aquires lock back */ | ||
342 | static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags) | ||
283 | { | 343 | { |
284 | u64 temp_64; | 344 | u64 temp_64; |
285 | int ret; | 345 | int ret; |
286 | 346 | ||
287 | xhci_dbg(xhci, "Abort command ring\n"); | 347 | xhci_dbg(xhci, "Abort command ring\n"); |
288 | 348 | ||
289 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 349 | reinit_completion(&xhci->cmd_ring_stop_completion); |
290 | xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; | ||
291 | 350 | ||
292 | /* | 351 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
293 | * Writing the CMD_RING_ABORT bit should cause a cmd completion event, | ||
294 | * however on some host hw the CMD_RING_RUNNING bit is correctly cleared | ||
295 | * but the completion event in never sent. Use the cmd timeout timer to | ||
296 | * handle those cases. Use twice the time to cover the bit polling retry | ||
297 | */ | ||
298 | mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT)); | ||
299 | xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, | 352 | xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, |
300 | &xhci->op_regs->cmd_ring); | 353 | &xhci->op_regs->cmd_ring); |
301 | 354 | ||
@@ -315,17 +368,30 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | |||
315 | udelay(1000); | 368 | udelay(1000); |
316 | ret = xhci_handshake(&xhci->op_regs->cmd_ring, | 369 | ret = xhci_handshake(&xhci->op_regs->cmd_ring, |
317 | CMD_RING_RUNNING, 0, 3 * 1000 * 1000); | 370 | CMD_RING_RUNNING, 0, 3 * 1000 * 1000); |
318 | if (ret == 0) | 371 | if (ret < 0) { |
319 | return 0; | 372 | xhci_err(xhci, "Stopped the command ring failed, " |
320 | 373 | "maybe the host is dead\n"); | |
321 | xhci_err(xhci, "Stopped the command ring failed, " | 374 | xhci->xhc_state |= XHCI_STATE_DYING; |
322 | "maybe the host is dead\n"); | 375 | xhci_halt(xhci); |
323 | del_timer(&xhci->cmd_timer); | 376 | return -ESHUTDOWN; |
324 | xhci->xhc_state |= XHCI_STATE_DYING; | 377 | } |
325 | xhci_halt(xhci); | 378 | } |
326 | return -ESHUTDOWN; | 379 | /* |
380 | * Writing the CMD_RING_ABORT bit should cause a cmd completion event, | ||
381 | * however on some host hw the CMD_RING_RUNNING bit is correctly cleared | ||
382 | * but the completion event in never sent. Wait 2 secs (arbitrary | ||
383 | * number) to handle those cases after negation of CMD_RING_RUNNING. | ||
384 | */ | ||
385 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
386 | ret = wait_for_completion_timeout(&xhci->cmd_ring_stop_completion, | ||
387 | msecs_to_jiffies(2000)); | ||
388 | spin_lock_irqsave(&xhci->lock, flags); | ||
389 | if (!ret) { | ||
390 | xhci_dbg(xhci, "No stop event for abort, ring start fail?\n"); | ||
391 | xhci_cleanup_command_queue(xhci); | ||
392 | } else { | ||
393 | xhci_handle_stopped_cmd_ring(xhci, xhci_next_queued_cmd(xhci)); | ||
327 | } | 394 | } |
328 | |||
329 | return 0; | 395 | return 0; |
330 | } | 396 | } |
331 | 397 | ||
@@ -1207,101 +1273,62 @@ void xhci_cleanup_command_queue(struct xhci_hcd *xhci) | |||
1207 | xhci_complete_del_and_free_cmd(cur_cmd, COMP_CMD_ABORT); | 1273 | xhci_complete_del_and_free_cmd(cur_cmd, COMP_CMD_ABORT); |
1208 | } | 1274 | } |
1209 | 1275 | ||
1210 | /* | 1276 | void xhci_handle_command_timeout(struct work_struct *work) |
1211 | * Turn all commands on command ring with status set to "aborted" to no-op trbs. | ||
1212 | * If there are other commands waiting then restart the ring and kick the timer. | ||
1213 | * This must be called with command ring stopped and xhci->lock held. | ||
1214 | */ | ||
1215 | static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, | ||
1216 | struct xhci_command *cur_cmd) | ||
1217 | { | ||
1218 | struct xhci_command *i_cmd, *tmp_cmd; | ||
1219 | u32 cycle_state; | ||
1220 | |||
1221 | /* Turn all aborted commands in list to no-ops, then restart */ | ||
1222 | list_for_each_entry_safe(i_cmd, tmp_cmd, &xhci->cmd_list, | ||
1223 | cmd_list) { | ||
1224 | |||
1225 | if (i_cmd->status != COMP_CMD_ABORT) | ||
1226 | continue; | ||
1227 | |||
1228 | i_cmd->status = COMP_CMD_STOP; | ||
1229 | |||
1230 | xhci_dbg(xhci, "Turn aborted command %p to no-op\n", | ||
1231 | i_cmd->command_trb); | ||
1232 | /* get cycle state from the original cmd trb */ | ||
1233 | cycle_state = le32_to_cpu( | ||
1234 | i_cmd->command_trb->generic.field[3]) & TRB_CYCLE; | ||
1235 | /* modify the command trb to no-op command */ | ||
1236 | i_cmd->command_trb->generic.field[0] = 0; | ||
1237 | i_cmd->command_trb->generic.field[1] = 0; | ||
1238 | i_cmd->command_trb->generic.field[2] = 0; | ||
1239 | i_cmd->command_trb->generic.field[3] = cpu_to_le32( | ||
1240 | TRB_TYPE(TRB_CMD_NOOP) | cycle_state); | ||
1241 | |||
1242 | /* | ||
1243 | * caller waiting for completion is called when command | ||
1244 | * completion event is received for these no-op commands | ||
1245 | */ | ||
1246 | } | ||
1247 | |||
1248 | xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; | ||
1249 | |||
1250 | /* ring command ring doorbell to restart the command ring */ | ||
1251 | if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && | ||
1252 | !(xhci->xhc_state & XHCI_STATE_DYING)) { | ||
1253 | xhci->current_cmd = cur_cmd; | ||
1254 | mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); | ||
1255 | xhci_ring_cmd_db(xhci); | ||
1256 | } | ||
1257 | return; | ||
1258 | } | ||
1259 | |||
1260 | |||
1261 | void xhci_handle_command_timeout(unsigned long data) | ||
1262 | { | 1277 | { |
1263 | struct xhci_hcd *xhci; | 1278 | struct xhci_hcd *xhci; |
1264 | int ret; | 1279 | int ret; |
1265 | unsigned long flags; | 1280 | unsigned long flags; |
1266 | u64 hw_ring_state; | 1281 | u64 hw_ring_state; |
1267 | bool second_timeout = false; | ||
1268 | xhci = (struct xhci_hcd *) data; | ||
1269 | 1282 | ||
1270 | /* mark this command to be cancelled */ | 1283 | xhci = container_of(to_delayed_work(work), struct xhci_hcd, cmd_timer); |
1284 | |||
1271 | spin_lock_irqsave(&xhci->lock, flags); | 1285 | spin_lock_irqsave(&xhci->lock, flags); |
1272 | if (xhci->current_cmd) { | 1286 | |
1273 | if (xhci->current_cmd->status == COMP_CMD_ABORT) | 1287 | /* |
1274 | second_timeout = true; | 1288 | * If timeout work is pending, or current_cmd is NULL, it means we |
1275 | xhci->current_cmd->status = COMP_CMD_ABORT; | 1289 | * raced with command completion. Command is handled so just return. |
1290 | */ | ||
1291 | if (!xhci->current_cmd || delayed_work_pending(&xhci->cmd_timer)) { | ||
1292 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
1293 | return; | ||
1276 | } | 1294 | } |
1295 | /* mark this command to be cancelled */ | ||
1296 | xhci->current_cmd->status = COMP_CMD_ABORT; | ||
1277 | 1297 | ||
1278 | /* Make sure command ring is running before aborting it */ | 1298 | /* Make sure command ring is running before aborting it */ |
1279 | hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 1299 | hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
1280 | if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && | 1300 | if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && |
1281 | (hw_ring_state & CMD_RING_RUNNING)) { | 1301 | (hw_ring_state & CMD_RING_RUNNING)) { |
1282 | spin_unlock_irqrestore(&xhci->lock, flags); | 1302 | /* Prevent new doorbell, and start command abort */ |
1303 | xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; | ||
1283 | xhci_dbg(xhci, "Command timeout\n"); | 1304 | xhci_dbg(xhci, "Command timeout\n"); |
1284 | ret = xhci_abort_cmd_ring(xhci); | 1305 | ret = xhci_abort_cmd_ring(xhci, flags); |
1285 | if (unlikely(ret == -ESHUTDOWN)) { | 1306 | if (unlikely(ret == -ESHUTDOWN)) { |
1286 | xhci_err(xhci, "Abort command ring failed\n"); | 1307 | xhci_err(xhci, "Abort command ring failed\n"); |
1287 | xhci_cleanup_command_queue(xhci); | 1308 | xhci_cleanup_command_queue(xhci); |
1309 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
1288 | usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); | 1310 | usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); |
1289 | xhci_dbg(xhci, "xHCI host controller is dead.\n"); | 1311 | xhci_dbg(xhci, "xHCI host controller is dead.\n"); |
1312 | |||
1313 | return; | ||
1290 | } | 1314 | } |
1291 | return; | 1315 | |
1316 | goto time_out_completed; | ||
1292 | } | 1317 | } |
1293 | 1318 | ||
1294 | /* command ring failed to restart, or host removed. Bail out */ | 1319 | /* host removed. Bail out */ |
1295 | if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) { | 1320 | if (xhci->xhc_state & XHCI_STATE_REMOVING) { |
1296 | spin_unlock_irqrestore(&xhci->lock, flags); | 1321 | xhci_dbg(xhci, "host removed, ring start fail?\n"); |
1297 | xhci_dbg(xhci, "command timed out twice, ring start fail?\n"); | ||
1298 | xhci_cleanup_command_queue(xhci); | 1322 | xhci_cleanup_command_queue(xhci); |
1299 | return; | 1323 | |
1324 | goto time_out_completed; | ||
1300 | } | 1325 | } |
1301 | 1326 | ||
1302 | /* command timeout on stopped ring, ring can't be aborted */ | 1327 | /* command timeout on stopped ring, ring can't be aborted */ |
1303 | xhci_dbg(xhci, "Command timeout on stopped ring\n"); | 1328 | xhci_dbg(xhci, "Command timeout on stopped ring\n"); |
1304 | xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); | 1329 | xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); |
1330 | |||
1331 | time_out_completed: | ||
1305 | spin_unlock_irqrestore(&xhci->lock, flags); | 1332 | spin_unlock_irqrestore(&xhci->lock, flags); |
1306 | return; | 1333 | return; |
1307 | } | 1334 | } |
@@ -1333,7 +1360,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1333 | 1360 | ||
1334 | cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list); | 1361 | cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list); |
1335 | 1362 | ||
1336 | del_timer(&xhci->cmd_timer); | 1363 | cancel_delayed_work(&xhci->cmd_timer); |
1337 | 1364 | ||
1338 | trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event); | 1365 | trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event); |
1339 | 1366 | ||
@@ -1341,7 +1368,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1341 | 1368 | ||
1342 | /* If CMD ring stopped we own the trbs between enqueue and dequeue */ | 1369 | /* If CMD ring stopped we own the trbs between enqueue and dequeue */ |
1343 | if (cmd_comp_code == COMP_CMD_STOP) { | 1370 | if (cmd_comp_code == COMP_CMD_STOP) { |
1344 | xhci_handle_stopped_cmd_ring(xhci, cmd); | 1371 | complete_all(&xhci->cmd_ring_stop_completion); |
1345 | return; | 1372 | return; |
1346 | } | 1373 | } |
1347 | 1374 | ||
@@ -1359,8 +1386,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1359 | */ | 1386 | */ |
1360 | if (cmd_comp_code == COMP_CMD_ABORT) { | 1387 | if (cmd_comp_code == COMP_CMD_ABORT) { |
1361 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; | 1388 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
1362 | if (cmd->status == COMP_CMD_ABORT) | 1389 | if (cmd->status == COMP_CMD_ABORT) { |
1390 | if (xhci->current_cmd == cmd) | ||
1391 | xhci->current_cmd = NULL; | ||
1363 | goto event_handled; | 1392 | goto event_handled; |
1393 | } | ||
1364 | } | 1394 | } |
1365 | 1395 | ||
1366 | cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3])); | 1396 | cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3])); |
@@ -1421,7 +1451,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1421 | if (cmd->cmd_list.next != &xhci->cmd_list) { | 1451 | if (cmd->cmd_list.next != &xhci->cmd_list) { |
1422 | xhci->current_cmd = list_entry(cmd->cmd_list.next, | 1452 | xhci->current_cmd = list_entry(cmd->cmd_list.next, |
1423 | struct xhci_command, cmd_list); | 1453 | struct xhci_command, cmd_list); |
1424 | mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); | 1454 | xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); |
1455 | } else if (xhci->current_cmd == cmd) { | ||
1456 | xhci->current_cmd = NULL; | ||
1425 | } | 1457 | } |
1426 | 1458 | ||
1427 | event_handled: | 1459 | event_handled: |
@@ -1939,8 +1971,9 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1939 | struct xhci_ep_ctx *ep_ctx; | 1971 | struct xhci_ep_ctx *ep_ctx; |
1940 | u32 trb_comp_code; | 1972 | u32 trb_comp_code; |
1941 | u32 remaining, requested; | 1973 | u32 remaining, requested; |
1942 | bool on_data_stage; | 1974 | u32 trb_type; |
1943 | 1975 | ||
1976 | trb_type = TRB_FIELD_TO_TYPE(le32_to_cpu(ep_trb->generic.field[3])); | ||
1944 | slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags)); | 1977 | slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags)); |
1945 | xdev = xhci->devs[slot_id]; | 1978 | xdev = xhci->devs[slot_id]; |
1946 | ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1; | 1979 | ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1; |
@@ -1950,14 +1983,11 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1950 | requested = td->urb->transfer_buffer_length; | 1983 | requested = td->urb->transfer_buffer_length; |
1951 | remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); | 1984 | remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); |
1952 | 1985 | ||
1953 | /* not setup (dequeue), or status stage means we are at data stage */ | ||
1954 | on_data_stage = (ep_trb != ep_ring->dequeue && ep_trb != td->last_trb); | ||
1955 | |||
1956 | switch (trb_comp_code) { | 1986 | switch (trb_comp_code) { |
1957 | case COMP_SUCCESS: | 1987 | case COMP_SUCCESS: |
1958 | if (ep_trb != td->last_trb) { | 1988 | if (trb_type != TRB_STATUS) { |
1959 | xhci_warn(xhci, "WARN: Success on ctrl %s TRB without IOC set?\n", | 1989 | xhci_warn(xhci, "WARN: Success on ctrl %s TRB without IOC set?\n", |
1960 | on_data_stage ? "data" : "setup"); | 1990 | (trb_type == TRB_DATA) ? "data" : "setup"); |
1961 | *status = -ESHUTDOWN; | 1991 | *status = -ESHUTDOWN; |
1962 | break; | 1992 | break; |
1963 | } | 1993 | } |
@@ -1967,15 +1997,25 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1967 | *status = 0; | 1997 | *status = 0; |
1968 | break; | 1998 | break; |
1969 | case COMP_STOP_SHORT: | 1999 | case COMP_STOP_SHORT: |
1970 | if (on_data_stage) | 2000 | if (trb_type == TRB_DATA || trb_type == TRB_NORMAL) |
1971 | td->urb->actual_length = remaining; | 2001 | td->urb->actual_length = remaining; |
1972 | else | 2002 | else |
1973 | xhci_warn(xhci, "WARN: Stopped Short Packet on ctrl setup or status TRB\n"); | 2003 | xhci_warn(xhci, "WARN: Stopped Short Packet on ctrl setup or status TRB\n"); |
1974 | goto finish_td; | 2004 | goto finish_td; |
1975 | case COMP_STOP: | 2005 | case COMP_STOP: |
1976 | if (on_data_stage) | 2006 | switch (trb_type) { |
2007 | case TRB_SETUP: | ||
2008 | td->urb->actual_length = 0; | ||
2009 | goto finish_td; | ||
2010 | case TRB_DATA: | ||
2011 | case TRB_NORMAL: | ||
1977 | td->urb->actual_length = requested - remaining; | 2012 | td->urb->actual_length = requested - remaining; |
1978 | goto finish_td; | 2013 | goto finish_td; |
2014 | default: | ||
2015 | xhci_warn(xhci, "WARN: unexpected TRB Type %d\n", | ||
2016 | trb_type); | ||
2017 | goto finish_td; | ||
2018 | } | ||
1979 | case COMP_STOP_INVAL: | 2019 | case COMP_STOP_INVAL: |
1980 | goto finish_td; | 2020 | goto finish_td; |
1981 | default: | 2021 | default: |
@@ -1987,7 +2027,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1987 | /* else fall through */ | 2027 | /* else fall through */ |
1988 | case COMP_STALL: | 2028 | case COMP_STALL: |
1989 | /* Did we transfer part of the data (middle) phase? */ | 2029 | /* Did we transfer part of the data (middle) phase? */ |
1990 | if (on_data_stage) | 2030 | if (trb_type == TRB_DATA || trb_type == TRB_NORMAL) |
1991 | td->urb->actual_length = requested - remaining; | 2031 | td->urb->actual_length = requested - remaining; |
1992 | else if (!td->urb_length_set) | 2032 | else if (!td->urb_length_set) |
1993 | td->urb->actual_length = 0; | 2033 | td->urb->actual_length = 0; |
@@ -1995,14 +2035,15 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1995 | } | 2035 | } |
1996 | 2036 | ||
1997 | /* stopped at setup stage, no data transferred */ | 2037 | /* stopped at setup stage, no data transferred */ |
1998 | if (ep_trb == ep_ring->dequeue) | 2038 | if (trb_type == TRB_SETUP) |
1999 | goto finish_td; | 2039 | goto finish_td; |
2000 | 2040 | ||
2001 | /* | 2041 | /* |
2002 | * if on data stage then update the actual_length of the URB and flag it | 2042 | * if on data stage then update the actual_length of the URB and flag it |
2003 | * as set, so it won't be overwritten in the event for the last TRB. | 2043 | * as set, so it won't be overwritten in the event for the last TRB. |
2004 | */ | 2044 | */ |
2005 | if (on_data_stage) { | 2045 | if (trb_type == TRB_DATA || |
2046 | trb_type == TRB_NORMAL) { | ||
2006 | td->urb_length_set = true; | 2047 | td->urb_length_set = true; |
2007 | td->urb->actual_length = requested - remaining; | 2048 | td->urb->actual_length = requested - remaining; |
2008 | xhci_dbg(xhci, "Waiting for status stage event\n"); | 2049 | xhci_dbg(xhci, "Waiting for status stage event\n"); |
@@ -3790,9 +3831,9 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd, | |||
3790 | 3831 | ||
3791 | /* if there are no other commands queued we start the timeout timer */ | 3832 | /* if there are no other commands queued we start the timeout timer */ |
3792 | if (xhci->cmd_list.next == &cmd->cmd_list && | 3833 | if (xhci->cmd_list.next == &cmd->cmd_list && |
3793 | !timer_pending(&xhci->cmd_timer)) { | 3834 | !delayed_work_pending(&xhci->cmd_timer)) { |
3794 | xhci->current_cmd = cmd; | 3835 | xhci->current_cmd = cmd; |
3795 | mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); | 3836 | xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); |
3796 | } | 3837 | } |
3797 | 3838 | ||
3798 | queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3, | 3839 | queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3, |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 1cd56417cbec..0c8deb9ed42d 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -3787,8 +3787,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3787 | 3787 | ||
3788 | mutex_lock(&xhci->mutex); | 3788 | mutex_lock(&xhci->mutex); |
3789 | 3789 | ||
3790 | if (xhci->xhc_state) /* dying, removing or halted */ | 3790 | if (xhci->xhc_state) { /* dying, removing or halted */ |
3791 | ret = -ESHUTDOWN; | ||
3791 | goto out; | 3792 | goto out; |
3793 | } | ||
3792 | 3794 | ||
3793 | if (!udev->slot_id) { | 3795 | if (!udev->slot_id) { |
3794 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, | 3796 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 8ccc11a974b8..2d7b6374b58d 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1568,7 +1568,8 @@ struct xhci_hcd { | |||
1568 | #define CMD_RING_STATE_STOPPED (1 << 2) | 1568 | #define CMD_RING_STATE_STOPPED (1 << 2) |
1569 | struct list_head cmd_list; | 1569 | struct list_head cmd_list; |
1570 | unsigned int cmd_ring_reserved_trbs; | 1570 | unsigned int cmd_ring_reserved_trbs; |
1571 | struct timer_list cmd_timer; | 1571 | struct delayed_work cmd_timer; |
1572 | struct completion cmd_ring_stop_completion; | ||
1572 | struct xhci_command *current_cmd; | 1573 | struct xhci_command *current_cmd; |
1573 | struct xhci_ring *event_ring; | 1574 | struct xhci_ring *event_ring; |
1574 | struct xhci_erst erst; | 1575 | struct xhci_erst erst; |
@@ -1934,7 +1935,7 @@ void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci, | |||
1934 | unsigned int slot_id, unsigned int ep_index, | 1935 | unsigned int slot_id, unsigned int ep_index, |
1935 | struct xhci_dequeue_state *deq_state); | 1936 | struct xhci_dequeue_state *deq_state); |
1936 | void xhci_stop_endpoint_command_watchdog(unsigned long arg); | 1937 | void xhci_stop_endpoint_command_watchdog(unsigned long arg); |
1937 | void xhci_handle_command_timeout(unsigned long data); | 1938 | void xhci_handle_command_timeout(struct work_struct *work); |
1938 | 1939 | ||
1939 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, | 1940 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, |
1940 | unsigned int ep_index, unsigned int stream_id); | 1941 | unsigned int ep_index, unsigned int stream_id); |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 310238c6b5cd..896798071817 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -469,6 +469,7 @@ static const struct musb_platform_ops bfin_ops = { | |||
469 | .init = bfin_musb_init, | 469 | .init = bfin_musb_init, |
470 | .exit = bfin_musb_exit, | 470 | .exit = bfin_musb_exit, |
471 | 471 | ||
472 | .fifo_offset = bfin_fifo_offset, | ||
472 | .readb = bfin_readb, | 473 | .readb = bfin_readb, |
473 | .writeb = bfin_writeb, | 474 | .writeb = bfin_writeb, |
474 | .readw = bfin_readw, | 475 | .readw = bfin_readw, |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 9e226468a13e..fca288bbc800 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2050,6 +2050,7 @@ struct musb_pending_work { | |||
2050 | struct list_head node; | 2050 | struct list_head node; |
2051 | }; | 2051 | }; |
2052 | 2052 | ||
2053 | #ifdef CONFIG_PM | ||
2053 | /* | 2054 | /* |
2054 | * Called from musb_runtime_resume(), musb_resume(), and | 2055 | * Called from musb_runtime_resume(), musb_resume(), and |
2055 | * musb_queue_resume_work(). Callers must take musb->lock. | 2056 | * musb_queue_resume_work(). Callers must take musb->lock. |
@@ -2077,6 +2078,7 @@ static int musb_run_resume_work(struct musb *musb) | |||
2077 | 2078 | ||
2078 | return error; | 2079 | return error; |
2079 | } | 2080 | } |
2081 | #endif | ||
2080 | 2082 | ||
2081 | /* | 2083 | /* |
2082 | * Called to run work if device is active or else queue the work to happen | 2084 | * Called to run work if device is active or else queue the work to happen |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index a611e2f67bdc..ade902ea1221 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -216,6 +216,7 @@ struct musb_platform_ops { | |||
216 | void (*pre_root_reset_end)(struct musb *musb); | 216 | void (*pre_root_reset_end)(struct musb *musb); |
217 | void (*post_root_reset_end)(struct musb *musb); | 217 | void (*post_root_reset_end)(struct musb *musb); |
218 | int (*phy_callback)(enum musb_vbus_id_status status); | 218 | int (*phy_callback)(enum musb_vbus_id_status status); |
219 | void (*clear_ep_rxintr)(struct musb *musb, int epnum); | ||
219 | }; | 220 | }; |
220 | 221 | ||
221 | /* | 222 | /* |
@@ -626,6 +627,12 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb) | |||
626 | musb->ops->post_root_reset_end(musb); | 627 | musb->ops->post_root_reset_end(musb); |
627 | } | 628 | } |
628 | 629 | ||
630 | static inline void musb_platform_clear_ep_rxintr(struct musb *musb, int epnum) | ||
631 | { | ||
632 | if (musb->ops->clear_ep_rxintr) | ||
633 | musb->ops->clear_ep_rxintr(musb, epnum); | ||
634 | } | ||
635 | |||
629 | /* | 636 | /* |
630 | * gets the "dr_mode" property from DT and converts it into musb_mode | 637 | * gets the "dr_mode" property from DT and converts it into musb_mode |
631 | * if the property is not found or not recognized returns MUSB_OTG | 638 | * if the property is not found or not recognized returns MUSB_OTG |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index feae1561b9ab..9f125e179acd 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -267,6 +267,17 @@ static void otg_timer(unsigned long _musb) | |||
267 | pm_runtime_put_autosuspend(dev); | 267 | pm_runtime_put_autosuspend(dev); |
268 | } | 268 | } |
269 | 269 | ||
270 | void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum) | ||
271 | { | ||
272 | u32 epintr; | ||
273 | struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); | ||
274 | const struct dsps_musb_wrapper *wrp = glue->wrp; | ||
275 | |||
276 | /* musb->lock might already been held */ | ||
277 | epintr = (1 << epnum) << wrp->rxep_shift; | ||
278 | musb_writel(musb->ctrl_base, wrp->epintr_status, epintr); | ||
279 | } | ||
280 | |||
270 | static irqreturn_t dsps_interrupt(int irq, void *hci) | 281 | static irqreturn_t dsps_interrupt(int irq, void *hci) |
271 | { | 282 | { |
272 | struct musb *musb = hci; | 283 | struct musb *musb = hci; |
@@ -622,6 +633,7 @@ static struct musb_platform_ops dsps_ops = { | |||
622 | 633 | ||
623 | .set_mode = dsps_musb_set_mode, | 634 | .set_mode = dsps_musb_set_mode, |
624 | .recover = dsps_musb_recover, | 635 | .recover = dsps_musb_recover, |
636 | .clear_ep_rxintr = dsps_musb_clear_ep_rxintr, | ||
625 | }; | 637 | }; |
626 | 638 | ||
627 | static u64 musb_dmamask = DMA_BIT_MASK(32); | 639 | static u64 musb_dmamask = DMA_BIT_MASK(32); |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index f6cdbad00dac..ac3a4952abb4 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2374,12 +2374,11 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | |||
2374 | int is_in = usb_pipein(urb->pipe); | 2374 | int is_in = usb_pipein(urb->pipe); |
2375 | int status = 0; | 2375 | int status = 0; |
2376 | u16 csr; | 2376 | u16 csr; |
2377 | struct dma_channel *dma = NULL; | ||
2377 | 2378 | ||
2378 | musb_ep_select(regs, hw_end); | 2379 | musb_ep_select(regs, hw_end); |
2379 | 2380 | ||
2380 | if (is_dma_capable()) { | 2381 | if (is_dma_capable()) { |
2381 | struct dma_channel *dma; | ||
2382 | |||
2383 | dma = is_in ? ep->rx_channel : ep->tx_channel; | 2382 | dma = is_in ? ep->rx_channel : ep->tx_channel; |
2384 | if (dma) { | 2383 | if (dma) { |
2385 | status = ep->musb->dma_controller->channel_abort(dma); | 2384 | status = ep->musb->dma_controller->channel_abort(dma); |
@@ -2395,10 +2394,9 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | |||
2395 | /* giveback saves bulk toggle */ | 2394 | /* giveback saves bulk toggle */ |
2396 | csr = musb_h_flush_rxfifo(ep, 0); | 2395 | csr = musb_h_flush_rxfifo(ep, 0); |
2397 | 2396 | ||
2398 | /* REVISIT we still get an irq; should likely clear the | 2397 | /* clear the endpoint's irq status here to avoid bogus irqs */ |
2399 | * endpoint's irq status here to avoid bogus irqs. | 2398 | if (is_dma_capable() && dma) |
2400 | * clearing that status is platform-specific... | 2399 | musb_platform_clear_ep_rxintr(musb, ep->epnum); |
2401 | */ | ||
2402 | } else if (ep->epnum) { | 2400 | } else if (ep->epnum) { |
2403 | musb_h_tx_flush_fifo(ep); | 2401 | musb_h_tx_flush_fifo(ep); |
2404 | csr = musb_readw(epio, MUSB_TXCSR); | 2402 | csr = musb_readw(epio, MUSB_TXCSR); |
diff --git a/drivers/usb/musb/musbhsdma.h b/drivers/usb/musb/musbhsdma.h index f7b13fd25257..a3dcbd55e436 100644 --- a/drivers/usb/musb/musbhsdma.h +++ b/drivers/usb/musb/musbhsdma.h | |||
@@ -157,5 +157,5 @@ struct musb_dma_controller { | |||
157 | void __iomem *base; | 157 | void __iomem *base; |
158 | u8 channel_count; | 158 | u8 channel_count; |
159 | u8 used_channels; | 159 | u8 used_channels; |
160 | u8 irq; | 160 | int irq; |
161 | }; | 161 | }; |
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 5f17a3b9916d..80260b08398b 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #define CYBERJACK_PRODUCT_ID 0x0100 | 50 | #define CYBERJACK_PRODUCT_ID 0x0100 |
51 | 51 | ||
52 | /* Function prototypes */ | 52 | /* Function prototypes */ |
53 | static int cyberjack_attach(struct usb_serial *serial); | ||
53 | static int cyberjack_port_probe(struct usb_serial_port *port); | 54 | static int cyberjack_port_probe(struct usb_serial_port *port); |
54 | static int cyberjack_port_remove(struct usb_serial_port *port); | 55 | static int cyberjack_port_remove(struct usb_serial_port *port); |
55 | static int cyberjack_open(struct tty_struct *tty, | 56 | static int cyberjack_open(struct tty_struct *tty, |
@@ -77,6 +78,7 @@ static struct usb_serial_driver cyberjack_device = { | |||
77 | .description = "Reiner SCT Cyberjack USB card reader", | 78 | .description = "Reiner SCT Cyberjack USB card reader", |
78 | .id_table = id_table, | 79 | .id_table = id_table, |
79 | .num_ports = 1, | 80 | .num_ports = 1, |
81 | .attach = cyberjack_attach, | ||
80 | .port_probe = cyberjack_port_probe, | 82 | .port_probe = cyberjack_port_probe, |
81 | .port_remove = cyberjack_port_remove, | 83 | .port_remove = cyberjack_port_remove, |
82 | .open = cyberjack_open, | 84 | .open = cyberjack_open, |
@@ -100,6 +102,14 @@ struct cyberjack_private { | |||
100 | short wrsent; /* Data already sent */ | 102 | short wrsent; /* Data already sent */ |
101 | }; | 103 | }; |
102 | 104 | ||
105 | static int cyberjack_attach(struct usb_serial *serial) | ||
106 | { | ||
107 | if (serial->num_bulk_out < serial->num_ports) | ||
108 | return -ENODEV; | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
103 | static int cyberjack_port_probe(struct usb_serial_port *port) | 113 | static int cyberjack_port_probe(struct usb_serial_port *port) |
104 | { | 114 | { |
105 | struct cyberjack_private *priv; | 115 | struct cyberjack_private *priv; |
diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c index 8282a6a18fee..22f23a429a95 100644 --- a/drivers/usb/serial/f81534.c +++ b/drivers/usb/serial/f81534.c | |||
@@ -1237,6 +1237,7 @@ static int f81534_attach(struct usb_serial *serial) | |||
1237 | static int f81534_port_probe(struct usb_serial_port *port) | 1237 | static int f81534_port_probe(struct usb_serial_port *port) |
1238 | { | 1238 | { |
1239 | struct f81534_port_private *port_priv; | 1239 | struct f81534_port_private *port_priv; |
1240 | int ret; | ||
1240 | 1241 | ||
1241 | port_priv = devm_kzalloc(&port->dev, sizeof(*port_priv), GFP_KERNEL); | 1242 | port_priv = devm_kzalloc(&port->dev, sizeof(*port_priv), GFP_KERNEL); |
1242 | if (!port_priv) | 1243 | if (!port_priv) |
@@ -1246,10 +1247,11 @@ static int f81534_port_probe(struct usb_serial_port *port) | |||
1246 | mutex_init(&port_priv->mcr_mutex); | 1247 | mutex_init(&port_priv->mcr_mutex); |
1247 | 1248 | ||
1248 | /* Assign logic-to-phy mapping */ | 1249 | /* Assign logic-to-phy mapping */ |
1249 | port_priv->phy_num = f81534_logic_to_phy_port(port->serial, port); | 1250 | ret = f81534_logic_to_phy_port(port->serial, port); |
1250 | if (port_priv->phy_num < 0 || port_priv->phy_num >= F81534_NUM_PORT) | 1251 | if (ret < 0) |
1251 | return -ENODEV; | 1252 | return ret; |
1252 | 1253 | ||
1254 | port_priv->phy_num = ret; | ||
1253 | usb_set_serial_port_data(port, port_priv); | 1255 | usb_set_serial_port_data(port, port_priv); |
1254 | dev_dbg(&port->dev, "%s: port_number: %d, phy_num: %d\n", __func__, | 1256 | dev_dbg(&port->dev, "%s: port_number: %d, phy_num: %d\n", __func__, |
1255 | port->port_number, port_priv->phy_num); | 1257 | port->port_number, port_priv->phy_num); |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 97cabf803c2f..b2f2e87aed94 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -1043,6 +1043,7 @@ static int garmin_write_bulk(struct usb_serial_port *port, | |||
1043 | "%s - usb_submit_urb(write bulk) failed with status = %d\n", | 1043 | "%s - usb_submit_urb(write bulk) failed with status = %d\n", |
1044 | __func__, status); | 1044 | __func__, status); |
1045 | count = status; | 1045 | count = status; |
1046 | kfree(buffer); | ||
1046 | } | 1047 | } |
1047 | 1048 | ||
1048 | /* we are done with this urb, so let the host driver | 1049 | /* we are done with this urb, so let the host driver |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index dcc0c58aaad5..d50e5773483f 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2751,6 +2751,11 @@ static int edge_startup(struct usb_serial *serial) | |||
2751 | EDGE_COMPATIBILITY_MASK1, | 2751 | EDGE_COMPATIBILITY_MASK1, |
2752 | EDGE_COMPATIBILITY_MASK2 }; | 2752 | EDGE_COMPATIBILITY_MASK2 }; |
2753 | 2753 | ||
2754 | if (serial->num_bulk_in < 1 || serial->num_interrupt_in < 1) { | ||
2755 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
2756 | return -ENODEV; | ||
2757 | } | ||
2758 | |||
2754 | dev = serial->dev; | 2759 | dev = serial->dev; |
2755 | 2760 | ||
2756 | /* create our private serial structure */ | 2761 | /* create our private serial structure */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c339163698eb..9a0db2965fbb 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -1499,8 +1499,7 @@ static int do_boot_mode(struct edgeport_serial *serial, | |||
1499 | 1499 | ||
1500 | dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); | 1500 | dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); |
1501 | 1501 | ||
1502 | /* return an error on purpose */ | 1502 | return 1; |
1503 | return -ENODEV; | ||
1504 | } | 1503 | } |
1505 | 1504 | ||
1506 | stayinbootmode: | 1505 | stayinbootmode: |
@@ -1508,7 +1507,7 @@ stayinbootmode: | |||
1508 | dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); | 1507 | dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); |
1509 | serial->product_info.TiMode = TI_MODE_BOOT; | 1508 | serial->product_info.TiMode = TI_MODE_BOOT; |
1510 | 1509 | ||
1511 | return 0; | 1510 | return 1; |
1512 | } | 1511 | } |
1513 | 1512 | ||
1514 | static int ti_do_config(struct edgeport_port *port, int feature, int on) | 1513 | static int ti_do_config(struct edgeport_port *port, int feature, int on) |
@@ -2546,6 +2545,13 @@ static int edge_startup(struct usb_serial *serial) | |||
2546 | int status; | 2545 | int status; |
2547 | u16 product_id; | 2546 | u16 product_id; |
2548 | 2547 | ||
2548 | /* Make sure we have the required endpoints when in download mode. */ | ||
2549 | if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) { | ||
2550 | if (serial->num_bulk_in < serial->num_ports || | ||
2551 | serial->num_bulk_out < serial->num_ports) | ||
2552 | return -ENODEV; | ||
2553 | } | ||
2554 | |||
2549 | /* create our private serial structure */ | 2555 | /* create our private serial structure */ |
2550 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); | 2556 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); |
2551 | if (!edge_serial) | 2557 | if (!edge_serial) |
@@ -2553,14 +2559,18 @@ static int edge_startup(struct usb_serial *serial) | |||
2553 | 2559 | ||
2554 | mutex_init(&edge_serial->es_lock); | 2560 | mutex_init(&edge_serial->es_lock); |
2555 | edge_serial->serial = serial; | 2561 | edge_serial->serial = serial; |
2562 | INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work); | ||
2556 | usb_set_serial_data(serial, edge_serial); | 2563 | usb_set_serial_data(serial, edge_serial); |
2557 | 2564 | ||
2558 | status = download_fw(edge_serial); | 2565 | status = download_fw(edge_serial); |
2559 | if (status) { | 2566 | if (status < 0) { |
2560 | kfree(edge_serial); | 2567 | kfree(edge_serial); |
2561 | return status; | 2568 | return status; |
2562 | } | 2569 | } |
2563 | 2570 | ||
2571 | if (status > 0) | ||
2572 | return 1; /* bind but do not register any ports */ | ||
2573 | |||
2564 | product_id = le16_to_cpu( | 2574 | product_id = le16_to_cpu( |
2565 | edge_serial->serial->dev->descriptor.idProduct); | 2575 | edge_serial->serial->dev->descriptor.idProduct); |
2566 | 2576 | ||
@@ -2572,7 +2582,6 @@ static int edge_startup(struct usb_serial *serial) | |||
2572 | } | 2582 | } |
2573 | } | 2583 | } |
2574 | 2584 | ||
2575 | INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work); | ||
2576 | edge_heartbeat_schedule(edge_serial); | 2585 | edge_heartbeat_schedule(edge_serial); |
2577 | 2586 | ||
2578 | return 0; | 2587 | return 0; |
@@ -2580,6 +2589,9 @@ static int edge_startup(struct usb_serial *serial) | |||
2580 | 2589 | ||
2581 | static void edge_disconnect(struct usb_serial *serial) | 2590 | static void edge_disconnect(struct usb_serial *serial) |
2582 | { | 2591 | { |
2592 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | ||
2593 | |||
2594 | cancel_delayed_work_sync(&edge_serial->heartbeat_work); | ||
2583 | } | 2595 | } |
2584 | 2596 | ||
2585 | static void edge_release(struct usb_serial *serial) | 2597 | static void edge_release(struct usb_serial *serial) |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 344b4eea4bd5..d57fb5199218 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -68,6 +68,16 @@ struct iuu_private { | |||
68 | u32 clk; | 68 | u32 clk; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static int iuu_attach(struct usb_serial *serial) | ||
72 | { | ||
73 | unsigned char num_ports = serial->num_ports; | ||
74 | |||
75 | if (serial->num_bulk_in < num_ports || serial->num_bulk_out < num_ports) | ||
76 | return -ENODEV; | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
71 | static int iuu_port_probe(struct usb_serial_port *port) | 81 | static int iuu_port_probe(struct usb_serial_port *port) |
72 | { | 82 | { |
73 | struct iuu_private *priv; | 83 | struct iuu_private *priv; |
@@ -1196,6 +1206,7 @@ static struct usb_serial_driver iuu_device = { | |||
1196 | .tiocmset = iuu_tiocmset, | 1206 | .tiocmset = iuu_tiocmset, |
1197 | .set_termios = iuu_set_termios, | 1207 | .set_termios = iuu_set_termios, |
1198 | .init_termios = iuu_init_termios, | 1208 | .init_termios = iuu_init_termios, |
1209 | .attach = iuu_attach, | ||
1199 | .port_probe = iuu_port_probe, | 1210 | .port_probe = iuu_port_probe, |
1200 | .port_remove = iuu_port_remove, | 1211 | .port_remove = iuu_port_remove, |
1201 | }; | 1212 | }; |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index e49ad0c63ad8..83523fcf6fb9 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -699,6 +699,19 @@ MODULE_FIRMWARE("keyspan_pda/keyspan_pda.fw"); | |||
699 | MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw"); | 699 | MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw"); |
700 | #endif | 700 | #endif |
701 | 701 | ||
702 | static int keyspan_pda_attach(struct usb_serial *serial) | ||
703 | { | ||
704 | unsigned char num_ports = serial->num_ports; | ||
705 | |||
706 | if (serial->num_bulk_out < num_ports || | ||
707 | serial->num_interrupt_in < num_ports) { | ||
708 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
709 | return -ENODEV; | ||
710 | } | ||
711 | |||
712 | return 0; | ||
713 | } | ||
714 | |||
702 | static int keyspan_pda_port_probe(struct usb_serial_port *port) | 715 | static int keyspan_pda_port_probe(struct usb_serial_port *port) |
703 | { | 716 | { |
704 | 717 | ||
@@ -776,6 +789,7 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
776 | .break_ctl = keyspan_pda_break_ctl, | 789 | .break_ctl = keyspan_pda_break_ctl, |
777 | .tiocmget = keyspan_pda_tiocmget, | 790 | .tiocmget = keyspan_pda_tiocmget, |
778 | .tiocmset = keyspan_pda_tiocmset, | 791 | .tiocmset = keyspan_pda_tiocmset, |
792 | .attach = keyspan_pda_attach, | ||
779 | .port_probe = keyspan_pda_port_probe, | 793 | .port_probe = keyspan_pda_port_probe, |
780 | .port_remove = keyspan_pda_port_remove, | 794 | .port_remove = keyspan_pda_port_remove, |
781 | }; | 795 | }; |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 2363654cafc9..813035f51fe7 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -51,6 +51,7 @@ | |||
51 | 51 | ||
52 | 52 | ||
53 | /* Function prototypes */ | 53 | /* Function prototypes */ |
54 | static int kobil_attach(struct usb_serial *serial); | ||
54 | static int kobil_port_probe(struct usb_serial_port *probe); | 55 | static int kobil_port_probe(struct usb_serial_port *probe); |
55 | static int kobil_port_remove(struct usb_serial_port *probe); | 56 | static int kobil_port_remove(struct usb_serial_port *probe); |
56 | static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); | 57 | static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); |
@@ -86,6 +87,7 @@ static struct usb_serial_driver kobil_device = { | |||
86 | .description = "KOBIL USB smart card terminal", | 87 | .description = "KOBIL USB smart card terminal", |
87 | .id_table = id_table, | 88 | .id_table = id_table, |
88 | .num_ports = 1, | 89 | .num_ports = 1, |
90 | .attach = kobil_attach, | ||
89 | .port_probe = kobil_port_probe, | 91 | .port_probe = kobil_port_probe, |
90 | .port_remove = kobil_port_remove, | 92 | .port_remove = kobil_port_remove, |
91 | .ioctl = kobil_ioctl, | 93 | .ioctl = kobil_ioctl, |
@@ -113,6 +115,16 @@ struct kobil_private { | |||
113 | }; | 115 | }; |
114 | 116 | ||
115 | 117 | ||
118 | static int kobil_attach(struct usb_serial *serial) | ||
119 | { | ||
120 | if (serial->num_interrupt_out < serial->num_ports) { | ||
121 | dev_err(&serial->interface->dev, "missing interrupt-out endpoint\n"); | ||
122 | return -ENODEV; | ||
123 | } | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
116 | static int kobil_port_probe(struct usb_serial_port *port) | 128 | static int kobil_port_probe(struct usb_serial_port *port) |
117 | { | 129 | { |
118 | struct usb_serial *serial = port->serial; | 130 | struct usb_serial *serial = port->serial; |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index d52caa03679c..91bc170b408a 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -65,8 +65,6 @@ struct moschip_port { | |||
65 | struct urb *write_urb_pool[NUM_URBS]; | 65 | struct urb *write_urb_pool[NUM_URBS]; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static struct usb_serial_driver moschip7720_2port_driver; | ||
69 | |||
70 | #define USB_VENDOR_ID_MOSCHIP 0x9710 | 68 | #define USB_VENDOR_ID_MOSCHIP 0x9710 |
71 | #define MOSCHIP_DEVICE_ID_7720 0x7720 | 69 | #define MOSCHIP_DEVICE_ID_7720 0x7720 |
72 | #define MOSCHIP_DEVICE_ID_7715 0x7715 | 70 | #define MOSCHIP_DEVICE_ID_7715 0x7715 |
@@ -970,25 +968,6 @@ static void mos7720_bulk_out_data_callback(struct urb *urb) | |||
970 | tty_port_tty_wakeup(&mos7720_port->port->port); | 968 | tty_port_tty_wakeup(&mos7720_port->port->port); |
971 | } | 969 | } |
972 | 970 | ||
973 | /* | ||
974 | * mos77xx_probe | ||
975 | * this function installs the appropriate read interrupt endpoint callback | ||
976 | * depending on whether the device is a 7720 or 7715, thus avoiding costly | ||
977 | * run-time checks in the high-frequency callback routine itself. | ||
978 | */ | ||
979 | static int mos77xx_probe(struct usb_serial *serial, | ||
980 | const struct usb_device_id *id) | ||
981 | { | ||
982 | if (id->idProduct == MOSCHIP_DEVICE_ID_7715) | ||
983 | moschip7720_2port_driver.read_int_callback = | ||
984 | mos7715_interrupt_callback; | ||
985 | else | ||
986 | moschip7720_2port_driver.read_int_callback = | ||
987 | mos7720_interrupt_callback; | ||
988 | |||
989 | return 0; | ||
990 | } | ||
991 | |||
992 | static int mos77xx_calc_num_ports(struct usb_serial *serial) | 971 | static int mos77xx_calc_num_ports(struct usb_serial *serial) |
993 | { | 972 | { |
994 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); | 973 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); |
@@ -1917,6 +1896,11 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1917 | u16 product; | 1896 | u16 product; |
1918 | int ret_val; | 1897 | int ret_val; |
1919 | 1898 | ||
1899 | if (serial->num_bulk_in < 2 || serial->num_bulk_out < 2) { | ||
1900 | dev_err(&serial->interface->dev, "missing bulk endpoints\n"); | ||
1901 | return -ENODEV; | ||
1902 | } | ||
1903 | |||
1920 | product = le16_to_cpu(serial->dev->descriptor.idProduct); | 1904 | product = le16_to_cpu(serial->dev->descriptor.idProduct); |
1921 | dev = serial->dev; | 1905 | dev = serial->dev; |
1922 | 1906 | ||
@@ -1941,19 +1925,18 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1941 | tmp->interrupt_in_endpointAddress; | 1925 | tmp->interrupt_in_endpointAddress; |
1942 | serial->port[1]->interrupt_in_urb = NULL; | 1926 | serial->port[1]->interrupt_in_urb = NULL; |
1943 | serial->port[1]->interrupt_in_buffer = NULL; | 1927 | serial->port[1]->interrupt_in_buffer = NULL; |
1928 | |||
1929 | if (serial->port[0]->interrupt_in_urb) { | ||
1930 | struct urb *urb = serial->port[0]->interrupt_in_urb; | ||
1931 | |||
1932 | urb->complete = mos7715_interrupt_callback; | ||
1933 | } | ||
1944 | } | 1934 | } |
1945 | 1935 | ||
1946 | /* setting configuration feature to one */ | 1936 | /* setting configuration feature to one */ |
1947 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 1937 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
1948 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000); | 1938 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000); |
1949 | 1939 | ||
1950 | /* start the interrupt urb */ | ||
1951 | ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); | ||
1952 | if (ret_val) | ||
1953 | dev_err(&dev->dev, | ||
1954 | "%s - Error %d submitting control urb\n", | ||
1955 | __func__, ret_val); | ||
1956 | |||
1957 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT | 1940 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT |
1958 | if (product == MOSCHIP_DEVICE_ID_7715) { | 1941 | if (product == MOSCHIP_DEVICE_ID_7715) { |
1959 | ret_val = mos7715_parport_init(serial); | 1942 | ret_val = mos7715_parport_init(serial); |
@@ -1961,6 +1944,13 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1961 | return ret_val; | 1944 | return ret_val; |
1962 | } | 1945 | } |
1963 | #endif | 1946 | #endif |
1947 | /* start the interrupt urb */ | ||
1948 | ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); | ||
1949 | if (ret_val) { | ||
1950 | dev_err(&dev->dev, "failed to submit interrupt urb: %d\n", | ||
1951 | ret_val); | ||
1952 | } | ||
1953 | |||
1964 | /* LSR For Port 1 */ | 1954 | /* LSR For Port 1 */ |
1965 | read_mos_reg(serial, 0, MOS7720_LSR, &data); | 1955 | read_mos_reg(serial, 0, MOS7720_LSR, &data); |
1966 | dev_dbg(&dev->dev, "LSR:%x\n", data); | 1956 | dev_dbg(&dev->dev, "LSR:%x\n", data); |
@@ -1970,6 +1960,8 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1970 | 1960 | ||
1971 | static void mos7720_release(struct usb_serial *serial) | 1961 | static void mos7720_release(struct usb_serial *serial) |
1972 | { | 1962 | { |
1963 | usb_kill_urb(serial->port[0]->interrupt_in_urb); | ||
1964 | |||
1973 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT | 1965 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT |
1974 | /* close the parallel port */ | 1966 | /* close the parallel port */ |
1975 | 1967 | ||
@@ -2019,11 +2011,6 @@ static int mos7720_port_probe(struct usb_serial_port *port) | |||
2019 | if (!mos7720_port) | 2011 | if (!mos7720_port) |
2020 | return -ENOMEM; | 2012 | return -ENOMEM; |
2021 | 2013 | ||
2022 | /* Initialize all port interrupt end point to port 0 int endpoint. | ||
2023 | * Our device has only one interrupt endpoint common to all ports. | ||
2024 | */ | ||
2025 | port->interrupt_in_endpointAddress = | ||
2026 | port->serial->port[0]->interrupt_in_endpointAddress; | ||
2027 | mos7720_port->port = port; | 2014 | mos7720_port->port = port; |
2028 | 2015 | ||
2029 | usb_set_serial_port_data(port, mos7720_port); | 2016 | usb_set_serial_port_data(port, mos7720_port); |
@@ -2053,7 +2040,6 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
2053 | .close = mos7720_close, | 2040 | .close = mos7720_close, |
2054 | .throttle = mos7720_throttle, | 2041 | .throttle = mos7720_throttle, |
2055 | .unthrottle = mos7720_unthrottle, | 2042 | .unthrottle = mos7720_unthrottle, |
2056 | .probe = mos77xx_probe, | ||
2057 | .attach = mos7720_startup, | 2043 | .attach = mos7720_startup, |
2058 | .release = mos7720_release, | 2044 | .release = mos7720_release, |
2059 | .port_probe = mos7720_port_probe, | 2045 | .port_probe = mos7720_port_probe, |
@@ -2067,7 +2053,7 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
2067 | .chars_in_buffer = mos7720_chars_in_buffer, | 2053 | .chars_in_buffer = mos7720_chars_in_buffer, |
2068 | .break_ctl = mos7720_break, | 2054 | .break_ctl = mos7720_break, |
2069 | .read_bulk_callback = mos7720_bulk_in_callback, | 2055 | .read_bulk_callback = mos7720_bulk_in_callback, |
2070 | .read_int_callback = NULL /* dynamically assigned in probe() */ | 2056 | .read_int_callback = mos7720_interrupt_callback, |
2071 | }; | 2057 | }; |
2072 | 2058 | ||
2073 | static struct usb_serial_driver * const serial_drivers[] = { | 2059 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 9a220b8e810f..ea27fb23967a 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -214,7 +214,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
214 | 214 | ||
215 | struct moschip_port { | 215 | struct moschip_port { |
216 | int port_num; /*Actual port number in the device(1,2,etc) */ | 216 | int port_num; /*Actual port number in the device(1,2,etc) */ |
217 | struct urb *write_urb; /* write URB for this port */ | ||
218 | struct urb *read_urb; /* read URB for this port */ | 217 | struct urb *read_urb; /* read URB for this port */ |
219 | __u8 shadowLCR; /* last LCR value received */ | 218 | __u8 shadowLCR; /* last LCR value received */ |
220 | __u8 shadowMCR; /* last MCR value received */ | 219 | __u8 shadowMCR; /* last MCR value received */ |
@@ -1037,9 +1036,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1037 | serial, | 1036 | serial, |
1038 | serial->port[0]->interrupt_in_urb->interval); | 1037 | serial->port[0]->interrupt_in_urb->interval); |
1039 | 1038 | ||
1040 | /* start interrupt read for mos7840 * | 1039 | /* start interrupt read for mos7840 */ |
1041 | * will continue as long as mos7840 is connected */ | ||
1042 | |||
1043 | response = | 1040 | response = |
1044 | usb_submit_urb(serial->port[0]->interrupt_in_urb, | 1041 | usb_submit_urb(serial->port[0]->interrupt_in_urb, |
1045 | GFP_KERNEL); | 1042 | GFP_KERNEL); |
@@ -1186,7 +1183,6 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1186 | } | 1183 | } |
1187 | } | 1184 | } |
1188 | 1185 | ||
1189 | usb_kill_urb(mos7840_port->write_urb); | ||
1190 | usb_kill_urb(mos7840_port->read_urb); | 1186 | usb_kill_urb(mos7840_port->read_urb); |
1191 | mos7840_port->read_urb_busy = false; | 1187 | mos7840_port->read_urb_busy = false; |
1192 | 1188 | ||
@@ -1199,12 +1195,6 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1199 | } | 1195 | } |
1200 | } | 1196 | } |
1201 | 1197 | ||
1202 | if (mos7840_port->write_urb) { | ||
1203 | /* if this urb had a transfer buffer already (old tx) free it */ | ||
1204 | kfree(mos7840_port->write_urb->transfer_buffer); | ||
1205 | usb_free_urb(mos7840_port->write_urb); | ||
1206 | } | ||
1207 | |||
1208 | Data = 0x0; | 1198 | Data = 0x0; |
1209 | mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data); | 1199 | mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data); |
1210 | 1200 | ||
@@ -2113,6 +2103,17 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
2113 | return mos7840_num_ports; | 2103 | return mos7840_num_ports; |
2114 | } | 2104 | } |
2115 | 2105 | ||
2106 | static int mos7840_attach(struct usb_serial *serial) | ||
2107 | { | ||
2108 | if (serial->num_bulk_in < serial->num_ports || | ||
2109 | serial->num_bulk_out < serial->num_ports) { | ||
2110 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
2111 | return -ENODEV; | ||
2112 | } | ||
2113 | |||
2114 | return 0; | ||
2115 | } | ||
2116 | |||
2116 | static int mos7840_port_probe(struct usb_serial_port *port) | 2117 | static int mos7840_port_probe(struct usb_serial_port *port) |
2117 | { | 2118 | { |
2118 | struct usb_serial *serial = port->serial; | 2119 | struct usb_serial *serial = port->serial; |
@@ -2388,6 +2389,7 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2388 | .tiocmset = mos7840_tiocmset, | 2389 | .tiocmset = mos7840_tiocmset, |
2389 | .tiocmiwait = usb_serial_generic_tiocmiwait, | 2390 | .tiocmiwait = usb_serial_generic_tiocmiwait, |
2390 | .get_icount = usb_serial_generic_get_icount, | 2391 | .get_icount = usb_serial_generic_get_icount, |
2392 | .attach = mos7840_attach, | ||
2391 | .port_probe = mos7840_port_probe, | 2393 | .port_probe = mos7840_port_probe, |
2392 | .port_remove = mos7840_port_remove, | 2394 | .port_remove = mos7840_port_remove, |
2393 | .read_bulk_callback = mos7840_bulk_in_callback, | 2395 | .read_bulk_callback = mos7840_bulk_in_callback, |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index f6c6900bccf0..a180b17d2432 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -38,6 +38,7 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
38 | const unsigned char *buf, int count); | 38 | const unsigned char *buf, int count); |
39 | static int omninet_write_room(struct tty_struct *tty); | 39 | static int omninet_write_room(struct tty_struct *tty); |
40 | static void omninet_disconnect(struct usb_serial *serial); | 40 | static void omninet_disconnect(struct usb_serial *serial); |
41 | static int omninet_attach(struct usb_serial *serial); | ||
41 | static int omninet_port_probe(struct usb_serial_port *port); | 42 | static int omninet_port_probe(struct usb_serial_port *port); |
42 | static int omninet_port_remove(struct usb_serial_port *port); | 43 | static int omninet_port_remove(struct usb_serial_port *port); |
43 | 44 | ||
@@ -56,6 +57,7 @@ static struct usb_serial_driver zyxel_omninet_device = { | |||
56 | .description = "ZyXEL - omni.net lcd plus usb", | 57 | .description = "ZyXEL - omni.net lcd plus usb", |
57 | .id_table = id_table, | 58 | .id_table = id_table, |
58 | .num_ports = 1, | 59 | .num_ports = 1, |
60 | .attach = omninet_attach, | ||
59 | .port_probe = omninet_port_probe, | 61 | .port_probe = omninet_port_probe, |
60 | .port_remove = omninet_port_remove, | 62 | .port_remove = omninet_port_remove, |
61 | .open = omninet_open, | 63 | .open = omninet_open, |
@@ -104,6 +106,17 @@ struct omninet_data { | |||
104 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ | 106 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ |
105 | }; | 107 | }; |
106 | 108 | ||
109 | static int omninet_attach(struct usb_serial *serial) | ||
110 | { | ||
111 | /* The second bulk-out endpoint is used for writing. */ | ||
112 | if (serial->num_bulk_out < 2) { | ||
113 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
114 | return -ENODEV; | ||
115 | } | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
107 | static int omninet_port_probe(struct usb_serial_port *port) | 120 | static int omninet_port_probe(struct usb_serial_port *port) |
108 | { | 121 | { |
109 | struct omninet_data *od; | 122 | struct omninet_data *od; |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index a4b88bc038b6..b8bf52bf7a94 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -134,6 +134,7 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty); | |||
134 | static int oti6858_tiocmget(struct tty_struct *tty); | 134 | static int oti6858_tiocmget(struct tty_struct *tty); |
135 | static int oti6858_tiocmset(struct tty_struct *tty, | 135 | static int oti6858_tiocmset(struct tty_struct *tty, |
136 | unsigned int set, unsigned int clear); | 136 | unsigned int set, unsigned int clear); |
137 | static int oti6858_attach(struct usb_serial *serial); | ||
137 | static int oti6858_port_probe(struct usb_serial_port *port); | 138 | static int oti6858_port_probe(struct usb_serial_port *port); |
138 | static int oti6858_port_remove(struct usb_serial_port *port); | 139 | static int oti6858_port_remove(struct usb_serial_port *port); |
139 | 140 | ||
@@ -158,6 +159,7 @@ static struct usb_serial_driver oti6858_device = { | |||
158 | .write_bulk_callback = oti6858_write_bulk_callback, | 159 | .write_bulk_callback = oti6858_write_bulk_callback, |
159 | .write_room = oti6858_write_room, | 160 | .write_room = oti6858_write_room, |
160 | .chars_in_buffer = oti6858_chars_in_buffer, | 161 | .chars_in_buffer = oti6858_chars_in_buffer, |
162 | .attach = oti6858_attach, | ||
161 | .port_probe = oti6858_port_probe, | 163 | .port_probe = oti6858_port_probe, |
162 | .port_remove = oti6858_port_remove, | 164 | .port_remove = oti6858_port_remove, |
163 | }; | 165 | }; |
@@ -324,6 +326,20 @@ static void send_data(struct work_struct *work) | |||
324 | usb_serial_port_softint(port); | 326 | usb_serial_port_softint(port); |
325 | } | 327 | } |
326 | 328 | ||
329 | static int oti6858_attach(struct usb_serial *serial) | ||
330 | { | ||
331 | unsigned char num_ports = serial->num_ports; | ||
332 | |||
333 | if (serial->num_bulk_in < num_ports || | ||
334 | serial->num_bulk_out < num_ports || | ||
335 | serial->num_interrupt_in < num_ports) { | ||
336 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
337 | return -ENODEV; | ||
338 | } | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | |||
327 | static int oti6858_port_probe(struct usb_serial_port *port) | 343 | static int oti6858_port_probe(struct usb_serial_port *port) |
328 | { | 344 | { |
329 | struct oti6858_private *priv; | 345 | struct oti6858_private *priv; |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ae682e4eeaef..46fca6b75846 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -220,9 +220,17 @@ static int pl2303_probe(struct usb_serial *serial, | |||
220 | static int pl2303_startup(struct usb_serial *serial) | 220 | static int pl2303_startup(struct usb_serial *serial) |
221 | { | 221 | { |
222 | struct pl2303_serial_private *spriv; | 222 | struct pl2303_serial_private *spriv; |
223 | unsigned char num_ports = serial->num_ports; | ||
223 | enum pl2303_type type = TYPE_01; | 224 | enum pl2303_type type = TYPE_01; |
224 | unsigned char *buf; | 225 | unsigned char *buf; |
225 | 226 | ||
227 | if (serial->num_bulk_in < num_ports || | ||
228 | serial->num_bulk_out < num_ports || | ||
229 | serial->num_interrupt_in < num_ports) { | ||
230 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
231 | return -ENODEV; | ||
232 | } | ||
233 | |||
226 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); | 234 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); |
227 | if (!spriv) | 235 | if (!spriv) |
228 | return -ENOMEM; | 236 | return -ENOMEM; |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 659cb8606bd9..5709cc93b083 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -408,16 +408,12 @@ static void qt2_close(struct usb_serial_port *port) | |||
408 | { | 408 | { |
409 | struct usb_serial *serial; | 409 | struct usb_serial *serial; |
410 | struct qt2_port_private *port_priv; | 410 | struct qt2_port_private *port_priv; |
411 | unsigned long flags; | ||
412 | int i; | 411 | int i; |
413 | 412 | ||
414 | serial = port->serial; | 413 | serial = port->serial; |
415 | port_priv = usb_get_serial_port_data(port); | 414 | port_priv = usb_get_serial_port_data(port); |
416 | 415 | ||
417 | spin_lock_irqsave(&port_priv->urb_lock, flags); | ||
418 | usb_kill_urb(port_priv->write_urb); | 416 | usb_kill_urb(port_priv->write_urb); |
419 | port_priv->urb_in_use = false; | ||
420 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); | ||
421 | 417 | ||
422 | /* flush the port transmit buffer */ | 418 | /* flush the port transmit buffer */ |
423 | i = usb_control_msg(serial->dev, | 419 | i = usb_control_msg(serial->dev, |
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index ef0dbf0703c5..475e6c31b266 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -154,6 +154,19 @@ static int spcp8x5_probe(struct usb_serial *serial, | |||
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | 156 | ||
157 | static int spcp8x5_attach(struct usb_serial *serial) | ||
158 | { | ||
159 | unsigned char num_ports = serial->num_ports; | ||
160 | |||
161 | if (serial->num_bulk_in < num_ports || | ||
162 | serial->num_bulk_out < num_ports) { | ||
163 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
164 | return -ENODEV; | ||
165 | } | ||
166 | |||
167 | return 0; | ||
168 | } | ||
169 | |||
157 | static int spcp8x5_port_probe(struct usb_serial_port *port) | 170 | static int spcp8x5_port_probe(struct usb_serial_port *port) |
158 | { | 171 | { |
159 | const struct usb_device_id *id = usb_get_serial_data(port->serial); | 172 | const struct usb_device_id *id = usb_get_serial_data(port->serial); |
@@ -477,6 +490,7 @@ static struct usb_serial_driver spcp8x5_device = { | |||
477 | .tiocmget = spcp8x5_tiocmget, | 490 | .tiocmget = spcp8x5_tiocmget, |
478 | .tiocmset = spcp8x5_tiocmset, | 491 | .tiocmset = spcp8x5_tiocmset, |
479 | .probe = spcp8x5_probe, | 492 | .probe = spcp8x5_probe, |
493 | .attach = spcp8x5_attach, | ||
480 | .port_probe = spcp8x5_port_probe, | 494 | .port_probe = spcp8x5_port_probe, |
481 | .port_remove = spcp8x5_port_remove, | 495 | .port_remove = spcp8x5_port_remove, |
482 | }; | 496 | }; |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 8db9d071d940..64b85b8dedf3 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -579,6 +579,13 @@ static int ti_startup(struct usb_serial *serial) | |||
579 | goto free_tdev; | 579 | goto free_tdev; |
580 | } | 580 | } |
581 | 581 | ||
582 | if (serial->num_bulk_in < serial->num_ports || | ||
583 | serial->num_bulk_out < serial->num_ports) { | ||
584 | dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
585 | status = -ENODEV; | ||
586 | goto free_tdev; | ||
587 | } | ||
588 | |||
582 | return 0; | 589 | return 0; |
583 | 590 | ||
584 | free_tdev: | 591 | free_tdev: |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index af3c7eecff91..16cc18369111 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -2109,6 +2109,13 @@ UNUSUAL_DEV( 0x152d, 0x2566, 0x0114, 0x0114, | |||
2109 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2109 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2110 | US_FL_BROKEN_FUA ), | 2110 | US_FL_BROKEN_FUA ), |
2111 | 2111 | ||
2112 | /* Reported-by George Cherian <george.cherian@cavium.com> */ | ||
2113 | UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999, | ||
2114 | "JMicron", | ||
2115 | "JMS56x", | ||
2116 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
2117 | US_FL_NO_REPORT_OPCODES), | ||
2118 | |||
2112 | /* | 2119 | /* |
2113 | * Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) | 2120 | * Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) |
2114 | * and Mac USB Dock USB-SCSI */ | 2121 | * and Mac USB Dock USB-SCSI */ |
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c index be1ee89ee917..36d75c367d22 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c | |||
@@ -27,6 +27,45 @@ static LIST_HEAD(parent_list); | |||
27 | static DEFINE_MUTEX(parent_list_lock); | 27 | static DEFINE_MUTEX(parent_list_lock); |
28 | static struct class_compat *mdev_bus_compat_class; | 28 | static struct class_compat *mdev_bus_compat_class; |
29 | 29 | ||
30 | static LIST_HEAD(mdev_list); | ||
31 | static DEFINE_MUTEX(mdev_list_lock); | ||
32 | |||
33 | struct device *mdev_parent_dev(struct mdev_device *mdev) | ||
34 | { | ||
35 | return mdev->parent->dev; | ||
36 | } | ||
37 | EXPORT_SYMBOL(mdev_parent_dev); | ||
38 | |||
39 | void *mdev_get_drvdata(struct mdev_device *mdev) | ||
40 | { | ||
41 | return mdev->driver_data; | ||
42 | } | ||
43 | EXPORT_SYMBOL(mdev_get_drvdata); | ||
44 | |||
45 | void mdev_set_drvdata(struct mdev_device *mdev, void *data) | ||
46 | { | ||
47 | mdev->driver_data = data; | ||
48 | } | ||
49 | EXPORT_SYMBOL(mdev_set_drvdata); | ||
50 | |||
51 | struct device *mdev_dev(struct mdev_device *mdev) | ||
52 | { | ||
53 | return &mdev->dev; | ||
54 | } | ||
55 | EXPORT_SYMBOL(mdev_dev); | ||
56 | |||
57 | struct mdev_device *mdev_from_dev(struct device *dev) | ||
58 | { | ||
59 | return dev_is_mdev(dev) ? to_mdev_device(dev) : NULL; | ||
60 | } | ||
61 | EXPORT_SYMBOL(mdev_from_dev); | ||
62 | |||
63 | uuid_le mdev_uuid(struct mdev_device *mdev) | ||
64 | { | ||
65 | return mdev->uuid; | ||
66 | } | ||
67 | EXPORT_SYMBOL(mdev_uuid); | ||
68 | |||
30 | static int _find_mdev_device(struct device *dev, void *data) | 69 | static int _find_mdev_device(struct device *dev, void *data) |
31 | { | 70 | { |
32 | struct mdev_device *mdev; | 71 | struct mdev_device *mdev; |
@@ -42,7 +81,7 @@ static int _find_mdev_device(struct device *dev, void *data) | |||
42 | return 0; | 81 | return 0; |
43 | } | 82 | } |
44 | 83 | ||
45 | static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid) | 84 | static bool mdev_device_exist(struct mdev_parent *parent, uuid_le uuid) |
46 | { | 85 | { |
47 | struct device *dev; | 86 | struct device *dev; |
48 | 87 | ||
@@ -56,9 +95,9 @@ static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid) | |||
56 | } | 95 | } |
57 | 96 | ||
58 | /* Should be called holding parent_list_lock */ | 97 | /* Should be called holding parent_list_lock */ |
59 | static struct parent_device *__find_parent_device(struct device *dev) | 98 | static struct mdev_parent *__find_parent_device(struct device *dev) |
60 | { | 99 | { |
61 | struct parent_device *parent; | 100 | struct mdev_parent *parent; |
62 | 101 | ||
63 | list_for_each_entry(parent, &parent_list, next) { | 102 | list_for_each_entry(parent, &parent_list, next) { |
64 | if (parent->dev == dev) | 103 | if (parent->dev == dev) |
@@ -69,8 +108,8 @@ static struct parent_device *__find_parent_device(struct device *dev) | |||
69 | 108 | ||
70 | static void mdev_release_parent(struct kref *kref) | 109 | static void mdev_release_parent(struct kref *kref) |
71 | { | 110 | { |
72 | struct parent_device *parent = container_of(kref, struct parent_device, | 111 | struct mdev_parent *parent = container_of(kref, struct mdev_parent, |
73 | ref); | 112 | ref); |
74 | struct device *dev = parent->dev; | 113 | struct device *dev = parent->dev; |
75 | 114 | ||
76 | kfree(parent); | 115 | kfree(parent); |
@@ -78,7 +117,7 @@ static void mdev_release_parent(struct kref *kref) | |||
78 | } | 117 | } |
79 | 118 | ||
80 | static | 119 | static |
81 | inline struct parent_device *mdev_get_parent(struct parent_device *parent) | 120 | inline struct mdev_parent *mdev_get_parent(struct mdev_parent *parent) |
82 | { | 121 | { |
83 | if (parent) | 122 | if (parent) |
84 | kref_get(&parent->ref); | 123 | kref_get(&parent->ref); |
@@ -86,7 +125,7 @@ inline struct parent_device *mdev_get_parent(struct parent_device *parent) | |||
86 | return parent; | 125 | return parent; |
87 | } | 126 | } |
88 | 127 | ||
89 | static inline void mdev_put_parent(struct parent_device *parent) | 128 | static inline void mdev_put_parent(struct mdev_parent *parent) |
90 | { | 129 | { |
91 | if (parent) | 130 | if (parent) |
92 | kref_put(&parent->ref, mdev_release_parent); | 131 | kref_put(&parent->ref, mdev_release_parent); |
@@ -95,7 +134,7 @@ static inline void mdev_put_parent(struct parent_device *parent) | |||
95 | static int mdev_device_create_ops(struct kobject *kobj, | 134 | static int mdev_device_create_ops(struct kobject *kobj, |
96 | struct mdev_device *mdev) | 135 | struct mdev_device *mdev) |
97 | { | 136 | { |
98 | struct parent_device *parent = mdev->parent; | 137 | struct mdev_parent *parent = mdev->parent; |
99 | int ret; | 138 | int ret; |
100 | 139 | ||
101 | ret = parent->ops->create(kobj, mdev); | 140 | ret = parent->ops->create(kobj, mdev); |
@@ -122,7 +161,7 @@ static int mdev_device_create_ops(struct kobject *kobj, | |||
122 | */ | 161 | */ |
123 | static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove) | 162 | static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove) |
124 | { | 163 | { |
125 | struct parent_device *parent = mdev->parent; | 164 | struct mdev_parent *parent = mdev->parent; |
126 | int ret; | 165 | int ret; |
127 | 166 | ||
128 | /* | 167 | /* |
@@ -153,10 +192,10 @@ static int mdev_device_remove_cb(struct device *dev, void *data) | |||
153 | * Add device to list of registered parent devices. | 192 | * Add device to list of registered parent devices. |
154 | * Returns a negative value on error, otherwise 0. | 193 | * Returns a negative value on error, otherwise 0. |
155 | */ | 194 | */ |
156 | int mdev_register_device(struct device *dev, const struct parent_ops *ops) | 195 | int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) |
157 | { | 196 | { |
158 | int ret; | 197 | int ret; |
159 | struct parent_device *parent; | 198 | struct mdev_parent *parent; |
160 | 199 | ||
161 | /* check for mandatory ops */ | 200 | /* check for mandatory ops */ |
162 | if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups) | 201 | if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups) |
@@ -229,7 +268,7 @@ EXPORT_SYMBOL(mdev_register_device); | |||
229 | 268 | ||
230 | void mdev_unregister_device(struct device *dev) | 269 | void mdev_unregister_device(struct device *dev) |
231 | { | 270 | { |
232 | struct parent_device *parent; | 271 | struct mdev_parent *parent; |
233 | bool force_remove = true; | 272 | bool force_remove = true; |
234 | 273 | ||
235 | mutex_lock(&parent_list_lock); | 274 | mutex_lock(&parent_list_lock); |
@@ -266,7 +305,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) | |||
266 | { | 305 | { |
267 | int ret; | 306 | int ret; |
268 | struct mdev_device *mdev; | 307 | struct mdev_device *mdev; |
269 | struct parent_device *parent; | 308 | struct mdev_parent *parent; |
270 | struct mdev_type *type = to_mdev_type(kobj); | 309 | struct mdev_type *type = to_mdev_type(kobj); |
271 | 310 | ||
272 | parent = mdev_get_parent(type->parent); | 311 | parent = mdev_get_parent(type->parent); |
@@ -316,6 +355,11 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) | |||
316 | dev_dbg(&mdev->dev, "MDEV: created\n"); | 355 | dev_dbg(&mdev->dev, "MDEV: created\n"); |
317 | 356 | ||
318 | mutex_unlock(&parent->lock); | 357 | mutex_unlock(&parent->lock); |
358 | |||
359 | mutex_lock(&mdev_list_lock); | ||
360 | list_add(&mdev->next, &mdev_list); | ||
361 | mutex_unlock(&mdev_list_lock); | ||
362 | |||
319 | return ret; | 363 | return ret; |
320 | 364 | ||
321 | create_failed: | 365 | create_failed: |
@@ -329,12 +373,30 @@ create_err: | |||
329 | 373 | ||
330 | int mdev_device_remove(struct device *dev, bool force_remove) | 374 | int mdev_device_remove(struct device *dev, bool force_remove) |
331 | { | 375 | { |
332 | struct mdev_device *mdev; | 376 | struct mdev_device *mdev, *tmp; |
333 | struct parent_device *parent; | 377 | struct mdev_parent *parent; |
334 | struct mdev_type *type; | 378 | struct mdev_type *type; |
335 | int ret; | 379 | int ret; |
380 | bool found = false; | ||
336 | 381 | ||
337 | mdev = to_mdev_device(dev); | 382 | mdev = to_mdev_device(dev); |
383 | |||
384 | mutex_lock(&mdev_list_lock); | ||
385 | list_for_each_entry(tmp, &mdev_list, next) { | ||
386 | if (tmp == mdev) { | ||
387 | found = true; | ||
388 | break; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | if (found) | ||
393 | list_del(&mdev->next); | ||
394 | |||
395 | mutex_unlock(&mdev_list_lock); | ||
396 | |||
397 | if (!found) | ||
398 | return -ENODEV; | ||
399 | |||
338 | type = to_mdev_type(mdev->type_kobj); | 400 | type = to_mdev_type(mdev->type_kobj); |
339 | parent = mdev->parent; | 401 | parent = mdev->parent; |
340 | mutex_lock(&parent->lock); | 402 | mutex_lock(&parent->lock); |
@@ -342,6 +404,11 @@ int mdev_device_remove(struct device *dev, bool force_remove) | |||
342 | ret = mdev_device_remove_ops(mdev, force_remove); | 404 | ret = mdev_device_remove_ops(mdev, force_remove); |
343 | if (ret) { | 405 | if (ret) { |
344 | mutex_unlock(&parent->lock); | 406 | mutex_unlock(&parent->lock); |
407 | |||
408 | mutex_lock(&mdev_list_lock); | ||
409 | list_add(&mdev->next, &mdev_list); | ||
410 | mutex_unlock(&mdev_list_lock); | ||
411 | |||
345 | return ret; | 412 | return ret; |
346 | } | 413 | } |
347 | 414 | ||
@@ -349,7 +416,8 @@ int mdev_device_remove(struct device *dev, bool force_remove) | |||
349 | device_unregister(dev); | 416 | device_unregister(dev); |
350 | mutex_unlock(&parent->lock); | 417 | mutex_unlock(&parent->lock); |
351 | mdev_put_parent(parent); | 418 | mdev_put_parent(parent); |
352 | return ret; | 419 | |
420 | return 0; | ||
353 | } | 421 | } |
354 | 422 | ||
355 | static int __init mdev_init(void) | 423 | static int __init mdev_init(void) |
diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h index d35097cbf3d7..a9cefd70a705 100644 --- a/drivers/vfio/mdev/mdev_private.h +++ b/drivers/vfio/mdev/mdev_private.h | |||
@@ -16,10 +16,33 @@ | |||
16 | int mdev_bus_register(void); | 16 | int mdev_bus_register(void); |
17 | void mdev_bus_unregister(void); | 17 | void mdev_bus_unregister(void); |
18 | 18 | ||
19 | struct mdev_parent { | ||
20 | struct device *dev; | ||
21 | const struct mdev_parent_ops *ops; | ||
22 | struct kref ref; | ||
23 | struct mutex lock; | ||
24 | struct list_head next; | ||
25 | struct kset *mdev_types_kset; | ||
26 | struct list_head type_list; | ||
27 | }; | ||
28 | |||
29 | struct mdev_device { | ||
30 | struct device dev; | ||
31 | struct mdev_parent *parent; | ||
32 | uuid_le uuid; | ||
33 | void *driver_data; | ||
34 | struct kref ref; | ||
35 | struct list_head next; | ||
36 | struct kobject *type_kobj; | ||
37 | }; | ||
38 | |||
39 | #define to_mdev_device(dev) container_of(dev, struct mdev_device, dev) | ||
40 | #define dev_is_mdev(d) ((d)->bus == &mdev_bus_type) | ||
41 | |||
19 | struct mdev_type { | 42 | struct mdev_type { |
20 | struct kobject kobj; | 43 | struct kobject kobj; |
21 | struct kobject *devices_kobj; | 44 | struct kobject *devices_kobj; |
22 | struct parent_device *parent; | 45 | struct mdev_parent *parent; |
23 | struct list_head next; | 46 | struct list_head next; |
24 | struct attribute_group *group; | 47 | struct attribute_group *group; |
25 | }; | 48 | }; |
@@ -29,8 +52,8 @@ struct mdev_type { | |||
29 | #define to_mdev_type(_kobj) \ | 52 | #define to_mdev_type(_kobj) \ |
30 | container_of(_kobj, struct mdev_type, kobj) | 53 | container_of(_kobj, struct mdev_type, kobj) |
31 | 54 | ||
32 | int parent_create_sysfs_files(struct parent_device *parent); | 55 | int parent_create_sysfs_files(struct mdev_parent *parent); |
33 | void parent_remove_sysfs_files(struct parent_device *parent); | 56 | void parent_remove_sysfs_files(struct mdev_parent *parent); |
34 | 57 | ||
35 | int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type); | 58 | int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type); |
36 | void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type); | 59 | void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type); |
diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c index 1a53deb2ee10..802df210929b 100644 --- a/drivers/vfio/mdev/mdev_sysfs.c +++ b/drivers/vfio/mdev/mdev_sysfs.c | |||
@@ -92,7 +92,7 @@ static struct kobj_type mdev_type_ktype = { | |||
92 | .release = mdev_type_release, | 92 | .release = mdev_type_release, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | struct mdev_type *add_mdev_supported_type(struct parent_device *parent, | 95 | struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent, |
96 | struct attribute_group *group) | 96 | struct attribute_group *group) |
97 | { | 97 | { |
98 | struct mdev_type *type; | 98 | struct mdev_type *type; |
@@ -158,7 +158,7 @@ static void remove_mdev_supported_type(struct mdev_type *type) | |||
158 | kobject_put(&type->kobj); | 158 | kobject_put(&type->kobj); |
159 | } | 159 | } |
160 | 160 | ||
161 | static int add_mdev_supported_type_groups(struct parent_device *parent) | 161 | static int add_mdev_supported_type_groups(struct mdev_parent *parent) |
162 | { | 162 | { |
163 | int i; | 163 | int i; |
164 | 164 | ||
@@ -183,7 +183,7 @@ static int add_mdev_supported_type_groups(struct parent_device *parent) | |||
183 | } | 183 | } |
184 | 184 | ||
185 | /* mdev sysfs functions */ | 185 | /* mdev sysfs functions */ |
186 | void parent_remove_sysfs_files(struct parent_device *parent) | 186 | void parent_remove_sysfs_files(struct mdev_parent *parent) |
187 | { | 187 | { |
188 | struct mdev_type *type, *tmp; | 188 | struct mdev_type *type, *tmp; |
189 | 189 | ||
@@ -196,7 +196,7 @@ void parent_remove_sysfs_files(struct parent_device *parent) | |||
196 | kset_unregister(parent->mdev_types_kset); | 196 | kset_unregister(parent->mdev_types_kset); |
197 | } | 197 | } |
198 | 198 | ||
199 | int parent_create_sysfs_files(struct parent_device *parent) | 199 | int parent_create_sysfs_files(struct mdev_parent *parent) |
200 | { | 200 | { |
201 | int ret; | 201 | int ret; |
202 | 202 | ||
diff --git a/drivers/vfio/mdev/vfio_mdev.c b/drivers/vfio/mdev/vfio_mdev.c index ffc36758cb84..fa848a701b8b 100644 --- a/drivers/vfio/mdev/vfio_mdev.c +++ b/drivers/vfio/mdev/vfio_mdev.c | |||
@@ -27,7 +27,7 @@ | |||
27 | static int vfio_mdev_open(void *device_data) | 27 | static int vfio_mdev_open(void *device_data) |
28 | { | 28 | { |
29 | struct mdev_device *mdev = device_data; | 29 | struct mdev_device *mdev = device_data; |
30 | struct parent_device *parent = mdev->parent; | 30 | struct mdev_parent *parent = mdev->parent; |
31 | int ret; | 31 | int ret; |
32 | 32 | ||
33 | if (unlikely(!parent->ops->open)) | 33 | if (unlikely(!parent->ops->open)) |
@@ -46,7 +46,7 @@ static int vfio_mdev_open(void *device_data) | |||
46 | static void vfio_mdev_release(void *device_data) | 46 | static void vfio_mdev_release(void *device_data) |
47 | { | 47 | { |
48 | struct mdev_device *mdev = device_data; | 48 | struct mdev_device *mdev = device_data; |
49 | struct parent_device *parent = mdev->parent; | 49 | struct mdev_parent *parent = mdev->parent; |
50 | 50 | ||
51 | if (likely(parent->ops->release)) | 51 | if (likely(parent->ops->release)) |
52 | parent->ops->release(mdev); | 52 | parent->ops->release(mdev); |
@@ -58,7 +58,7 @@ static long vfio_mdev_unlocked_ioctl(void *device_data, | |||
58 | unsigned int cmd, unsigned long arg) | 58 | unsigned int cmd, unsigned long arg) |
59 | { | 59 | { |
60 | struct mdev_device *mdev = device_data; | 60 | struct mdev_device *mdev = device_data; |
61 | struct parent_device *parent = mdev->parent; | 61 | struct mdev_parent *parent = mdev->parent; |
62 | 62 | ||
63 | if (unlikely(!parent->ops->ioctl)) | 63 | if (unlikely(!parent->ops->ioctl)) |
64 | return -EINVAL; | 64 | return -EINVAL; |
@@ -70,7 +70,7 @@ static ssize_t vfio_mdev_read(void *device_data, char __user *buf, | |||
70 | size_t count, loff_t *ppos) | 70 | size_t count, loff_t *ppos) |
71 | { | 71 | { |
72 | struct mdev_device *mdev = device_data; | 72 | struct mdev_device *mdev = device_data; |
73 | struct parent_device *parent = mdev->parent; | 73 | struct mdev_parent *parent = mdev->parent; |
74 | 74 | ||
75 | if (unlikely(!parent->ops->read)) | 75 | if (unlikely(!parent->ops->read)) |
76 | return -EINVAL; | 76 | return -EINVAL; |
@@ -82,7 +82,7 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf, | |||
82 | size_t count, loff_t *ppos) | 82 | size_t count, loff_t *ppos) |
83 | { | 83 | { |
84 | struct mdev_device *mdev = device_data; | 84 | struct mdev_device *mdev = device_data; |
85 | struct parent_device *parent = mdev->parent; | 85 | struct mdev_parent *parent = mdev->parent; |
86 | 86 | ||
87 | if (unlikely(!parent->ops->write)) | 87 | if (unlikely(!parent->ops->write)) |
88 | return -EINVAL; | 88 | return -EINVAL; |
@@ -93,7 +93,7 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf, | |||
93 | static int vfio_mdev_mmap(void *device_data, struct vm_area_struct *vma) | 93 | static int vfio_mdev_mmap(void *device_data, struct vm_area_struct *vma) |
94 | { | 94 | { |
95 | struct mdev_device *mdev = device_data; | 95 | struct mdev_device *mdev = device_data; |
96 | struct parent_device *parent = mdev->parent; | 96 | struct mdev_parent *parent = mdev->parent; |
97 | 97 | ||
98 | if (unlikely(!parent->ops->mmap)) | 98 | if (unlikely(!parent->ops->mmap)) |
99 | return -EINVAL; | 99 | return -EINVAL; |
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index dcd7c2a99618..324c52e3a1a4 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -1142,6 +1142,10 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma) | |||
1142 | return ret; | 1142 | return ret; |
1143 | 1143 | ||
1144 | vdev->barmap[index] = pci_iomap(pdev, index, 0); | 1144 | vdev->barmap[index] = pci_iomap(pdev, index, 0); |
1145 | if (!vdev->barmap[index]) { | ||
1146 | pci_release_selected_regions(pdev, 1 << index); | ||
1147 | return -ENOMEM; | ||
1148 | } | ||
1145 | } | 1149 | } |
1146 | 1150 | ||
1147 | vma->vm_private_data = vdev; | 1151 | vma->vm_private_data = vdev; |
diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c index 5ffd1d9ad4bd..357243d76f10 100644 --- a/drivers/vfio/pci/vfio_pci_rdwr.c +++ b/drivers/vfio/pci/vfio_pci_rdwr.c | |||
@@ -193,7 +193,10 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf, | |||
193 | if (!vdev->has_vga) | 193 | if (!vdev->has_vga) |
194 | return -EINVAL; | 194 | return -EINVAL; |
195 | 195 | ||
196 | switch (pos) { | 196 | if (pos > 0xbfffful) |
197 | return -EINVAL; | ||
198 | |||
199 | switch ((u32)pos) { | ||
197 | case 0xa0000 ... 0xbffff: | 200 | case 0xa0000 ... 0xbffff: |
198 | count = min(count, (size_t)(0xc0000 - pos)); | 201 | count = min(count, (size_t)(0xc0000 - pos)); |
199 | iomem = ioremap_nocache(0xa0000, 0xbffff - 0xa0000 + 1); | 202 | iomem = ioremap_nocache(0xa0000, 0xbffff - 0xa0000 + 1); |
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index f3726ba12aa6..9266271a787a 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c | |||
@@ -268,28 +268,38 @@ static void vfio_lock_acct(struct task_struct *task, long npage) | |||
268 | { | 268 | { |
269 | struct vwork *vwork; | 269 | struct vwork *vwork; |
270 | struct mm_struct *mm; | 270 | struct mm_struct *mm; |
271 | bool is_current; | ||
271 | 272 | ||
272 | if (!npage) | 273 | if (!npage) |
273 | return; | 274 | return; |
274 | 275 | ||
275 | mm = get_task_mm(task); | 276 | is_current = (task->mm == current->mm); |
277 | |||
278 | mm = is_current ? task->mm : get_task_mm(task); | ||
276 | if (!mm) | 279 | if (!mm) |
277 | return; /* process exited or nothing to do */ | 280 | return; /* process exited */ |
278 | 281 | ||
279 | if (down_write_trylock(&mm->mmap_sem)) { | 282 | if (down_write_trylock(&mm->mmap_sem)) { |
280 | mm->locked_vm += npage; | 283 | mm->locked_vm += npage; |
281 | up_write(&mm->mmap_sem); | 284 | up_write(&mm->mmap_sem); |
282 | mmput(mm); | 285 | if (!is_current) |
286 | mmput(mm); | ||
283 | return; | 287 | return; |
284 | } | 288 | } |
285 | 289 | ||
290 | if (is_current) { | ||
291 | mm = get_task_mm(task); | ||
292 | if (!mm) | ||
293 | return; | ||
294 | } | ||
295 | |||
286 | /* | 296 | /* |
287 | * Couldn't get mmap_sem lock, so must setup to update | 297 | * Couldn't get mmap_sem lock, so must setup to update |
288 | * mm->locked_vm later. If locked_vm were atomic, we | 298 | * mm->locked_vm later. If locked_vm were atomic, we |
289 | * wouldn't need this silliness | 299 | * wouldn't need this silliness |
290 | */ | 300 | */ |
291 | vwork = kmalloc(sizeof(struct vwork), GFP_KERNEL); | 301 | vwork = kmalloc(sizeof(struct vwork), GFP_KERNEL); |
292 | if (!vwork) { | 302 | if (WARN_ON(!vwork)) { |
293 | mmput(mm); | 303 | mmput(mm); |
294 | return; | 304 | return; |
295 | } | 305 | } |
@@ -393,77 +403,71 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, | |||
393 | static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr, | 403 | static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr, |
394 | long npage, unsigned long *pfn_base) | 404 | long npage, unsigned long *pfn_base) |
395 | { | 405 | { |
396 | unsigned long limit; | 406 | unsigned long limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; |
397 | bool lock_cap = ns_capable(task_active_pid_ns(dma->task)->user_ns, | 407 | bool lock_cap = capable(CAP_IPC_LOCK); |
398 | CAP_IPC_LOCK); | 408 | long ret, pinned = 0, lock_acct = 0; |
399 | struct mm_struct *mm; | ||
400 | long ret, i = 0, lock_acct = 0; | ||
401 | bool rsvd; | 409 | bool rsvd; |
402 | dma_addr_t iova = vaddr - dma->vaddr + dma->iova; | 410 | dma_addr_t iova = vaddr - dma->vaddr + dma->iova; |
403 | 411 | ||
404 | mm = get_task_mm(dma->task); | 412 | /* This code path is only user initiated */ |
405 | if (!mm) | 413 | if (!current->mm) |
406 | return -ENODEV; | 414 | return -ENODEV; |
407 | 415 | ||
408 | ret = vaddr_get_pfn(mm, vaddr, dma->prot, pfn_base); | 416 | ret = vaddr_get_pfn(current->mm, vaddr, dma->prot, pfn_base); |
409 | if (ret) | 417 | if (ret) |
410 | goto pin_pg_remote_exit; | 418 | return ret; |
411 | 419 | ||
420 | pinned++; | ||
412 | rsvd = is_invalid_reserved_pfn(*pfn_base); | 421 | rsvd = is_invalid_reserved_pfn(*pfn_base); |
413 | limit = task_rlimit(dma->task, RLIMIT_MEMLOCK) >> PAGE_SHIFT; | ||
414 | 422 | ||
415 | /* | 423 | /* |
416 | * Reserved pages aren't counted against the user, externally pinned | 424 | * Reserved pages aren't counted against the user, externally pinned |
417 | * pages are already counted against the user. | 425 | * pages are already counted against the user. |
418 | */ | 426 | */ |
419 | if (!rsvd && !vfio_find_vpfn(dma, iova)) { | 427 | if (!rsvd && !vfio_find_vpfn(dma, iova)) { |
420 | if (!lock_cap && mm->locked_vm + 1 > limit) { | 428 | if (!lock_cap && current->mm->locked_vm + 1 > limit) { |
421 | put_pfn(*pfn_base, dma->prot); | 429 | put_pfn(*pfn_base, dma->prot); |
422 | pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n", __func__, | 430 | pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n", __func__, |
423 | limit << PAGE_SHIFT); | 431 | limit << PAGE_SHIFT); |
424 | ret = -ENOMEM; | 432 | return -ENOMEM; |
425 | goto pin_pg_remote_exit; | ||
426 | } | 433 | } |
427 | lock_acct++; | 434 | lock_acct++; |
428 | } | 435 | } |
429 | 436 | ||
430 | i++; | 437 | if (unlikely(disable_hugepages)) |
431 | if (likely(!disable_hugepages)) { | 438 | goto out; |
432 | /* Lock all the consecutive pages from pfn_base */ | ||
433 | for (vaddr += PAGE_SIZE, iova += PAGE_SIZE; i < npage; | ||
434 | i++, vaddr += PAGE_SIZE, iova += PAGE_SIZE) { | ||
435 | unsigned long pfn = 0; | ||
436 | 439 | ||
437 | ret = vaddr_get_pfn(mm, vaddr, dma->prot, &pfn); | 440 | /* Lock all the consecutive pages from pfn_base */ |
438 | if (ret) | 441 | for (vaddr += PAGE_SIZE, iova += PAGE_SIZE; pinned < npage; |
439 | break; | 442 | pinned++, vaddr += PAGE_SIZE, iova += PAGE_SIZE) { |
443 | unsigned long pfn = 0; | ||
440 | 444 | ||
441 | if (pfn != *pfn_base + i || | 445 | ret = vaddr_get_pfn(current->mm, vaddr, dma->prot, &pfn); |
442 | rsvd != is_invalid_reserved_pfn(pfn)) { | 446 | if (ret) |
447 | break; | ||
448 | |||
449 | if (pfn != *pfn_base + pinned || | ||
450 | rsvd != is_invalid_reserved_pfn(pfn)) { | ||
451 | put_pfn(pfn, dma->prot); | ||
452 | break; | ||
453 | } | ||
454 | |||
455 | if (!rsvd && !vfio_find_vpfn(dma, iova)) { | ||
456 | if (!lock_cap && | ||
457 | current->mm->locked_vm + lock_acct + 1 > limit) { | ||
443 | put_pfn(pfn, dma->prot); | 458 | put_pfn(pfn, dma->prot); |
459 | pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n", | ||
460 | __func__, limit << PAGE_SHIFT); | ||
444 | break; | 461 | break; |
445 | } | 462 | } |
446 | 463 | lock_acct++; | |
447 | if (!rsvd && !vfio_find_vpfn(dma, iova)) { | ||
448 | if (!lock_cap && | ||
449 | mm->locked_vm + lock_acct + 1 > limit) { | ||
450 | put_pfn(pfn, dma->prot); | ||
451 | pr_warn("%s: RLIMIT_MEMLOCK (%ld) " | ||
452 | "exceeded\n", __func__, | ||
453 | limit << PAGE_SHIFT); | ||
454 | break; | ||
455 | } | ||
456 | lock_acct++; | ||
457 | } | ||
458 | } | 464 | } |
459 | } | 465 | } |
460 | 466 | ||
461 | vfio_lock_acct(dma->task, lock_acct); | 467 | out: |
462 | ret = i; | 468 | vfio_lock_acct(current, lock_acct); |
463 | 469 | ||
464 | pin_pg_remote_exit: | 470 | return pinned; |
465 | mmput(mm); | ||
466 | return ret; | ||
467 | } | 471 | } |
468 | 472 | ||
469 | static long vfio_unpin_pages_remote(struct vfio_dma *dma, dma_addr_t iova, | 473 | static long vfio_unpin_pages_remote(struct vfio_dma *dma, dma_addr_t iova, |
@@ -473,10 +477,10 @@ static long vfio_unpin_pages_remote(struct vfio_dma *dma, dma_addr_t iova, | |||
473 | long unlocked = 0, locked = 0; | 477 | long unlocked = 0, locked = 0; |
474 | long i; | 478 | long i; |
475 | 479 | ||
476 | for (i = 0; i < npage; i++) { | 480 | for (i = 0; i < npage; i++, iova += PAGE_SIZE) { |
477 | if (put_pfn(pfn++, dma->prot)) { | 481 | if (put_pfn(pfn++, dma->prot)) { |
478 | unlocked++; | 482 | unlocked++; |
479 | if (vfio_find_vpfn(dma, iova + (i << PAGE_SHIFT))) | 483 | if (vfio_find_vpfn(dma, iova)) |
480 | locked++; | 484 | locked++; |
481 | } | 485 | } |
482 | } | 486 | } |
diff --git a/drivers/video/fbdev/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c index 2d3b691f3fc4..038ac6934fe9 100644 --- a/drivers/video/fbdev/cobalt_lcdfb.c +++ b/drivers/video/fbdev/cobalt_lcdfb.c | |||
@@ -308,6 +308,11 @@ static int cobalt_lcdfb_probe(struct platform_device *dev) | |||
308 | info->screen_size = resource_size(res); | 308 | info->screen_size = resource_size(res); |
309 | info->screen_base = devm_ioremap(&dev->dev, res->start, | 309 | info->screen_base = devm_ioremap(&dev->dev, res->start, |
310 | info->screen_size); | 310 | info->screen_size); |
311 | if (!info->screen_base) { | ||
312 | framebuffer_release(info); | ||
313 | return -ENOMEM; | ||
314 | } | ||
315 | |||
311 | info->fbops = &cobalt_lcd_fbops; | 316 | info->fbops = &cobalt_lcd_fbops; |
312 | info->fix = cobalt_lcdfb_fix; | 317 | info->fix = cobalt_lcdfb_fix; |
313 | info->fix.smem_start = res->start; | 318 | info->fix.smem_start = res->start; |
diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c index 778acf80aacb..85dd20e05726 100644 --- a/drivers/xen/arm-device.c +++ b/drivers/xen/arm-device.c | |||
@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources, | |||
58 | xen_pfn_t *gpfns; | 58 | xen_pfn_t *gpfns; |
59 | xen_ulong_t *idxs; | 59 | xen_ulong_t *idxs; |
60 | int *errs; | 60 | int *errs; |
61 | struct xen_add_to_physmap_range xatp; | ||
62 | 61 | ||
63 | for (i = 0; i < count; i++) { | 62 | for (i = 0; i < count; i++) { |
63 | struct xen_add_to_physmap_range xatp = { | ||
64 | .domid = DOMID_SELF, | ||
65 | .space = XENMAPSPACE_dev_mmio | ||
66 | }; | ||
67 | |||
64 | r = &resources[i]; | 68 | r = &resources[i]; |
65 | nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); | 69 | nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); |
66 | if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) | 70 | if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) |
@@ -87,9 +91,7 @@ static int xen_map_device_mmio(const struct resource *resources, | |||
87 | idxs[j] = XEN_PFN_DOWN(r->start) + j; | 91 | idxs[j] = XEN_PFN_DOWN(r->start) + j; |
88 | } | 92 | } |
89 | 93 | ||
90 | xatp.domid = DOMID_SELF; | ||
91 | xatp.size = nr; | 94 | xatp.size = nr; |
92 | xatp.space = XENMAPSPACE_dev_mmio; | ||
93 | 95 | ||
94 | set_xen_guest_handle(xatp.gpfns, gpfns); | 96 | set_xen_guest_handle(xatp.gpfns, gpfns); |
95 | set_xen_guest_handle(xatp.idxs, idxs); | 97 | set_xen_guest_handle(xatp.idxs, idxs); |
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c index c03f9c86c7e3..3c41470c7fc4 100644 --- a/drivers/xen/events/events_fifo.c +++ b/drivers/xen/events/events_fifo.c | |||
@@ -369,8 +369,7 @@ static void evtchn_fifo_resume(void) | |||
369 | } | 369 | } |
370 | 370 | ||
371 | ret = init_control_block(cpu, control_block); | 371 | ret = init_control_block(cpu, control_block); |
372 | if (ret < 0) | 372 | BUG_ON(ret < 0); |
373 | BUG(); | ||
374 | } | 373 | } |
375 | 374 | ||
376 | /* | 375 | /* |
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index e8c7f09d01be..6890897a6f30 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
@@ -125,7 +125,7 @@ static int add_evtchn(struct per_user_data *u, struct user_evtchn *evtchn) | |||
125 | while (*new) { | 125 | while (*new) { |
126 | struct user_evtchn *this; | 126 | struct user_evtchn *this; |
127 | 127 | ||
128 | this = container_of(*new, struct user_evtchn, node); | 128 | this = rb_entry(*new, struct user_evtchn, node); |
129 | 129 | ||
130 | parent = *new; | 130 | parent = *new; |
131 | if (this->port < evtchn->port) | 131 | if (this->port < evtchn->port) |
@@ -157,7 +157,7 @@ static struct user_evtchn *find_evtchn(struct per_user_data *u, unsigned port) | |||
157 | while (node) { | 157 | while (node) { |
158 | struct user_evtchn *evtchn; | 158 | struct user_evtchn *evtchn; |
159 | 159 | ||
160 | evtchn = container_of(node, struct user_evtchn, node); | 160 | evtchn = rb_entry(node, struct user_evtchn, node); |
161 | 161 | ||
162 | if (evtchn->port < port) | 162 | if (evtchn->port < port) |
163 | node = node->rb_left; | 163 | node = node->rb_left; |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 478fb91e3df2..f905d6eeb048 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
@@ -275,6 +275,10 @@ retry: | |||
275 | rc = 0; | 275 | rc = 0; |
276 | } else | 276 | } else |
277 | rc = swiotlb_late_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs); | 277 | rc = swiotlb_late_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs); |
278 | |||
279 | if (!rc) | ||
280 | swiotlb_set_max_segment(PAGE_SIZE); | ||
281 | |||
278 | return rc; | 282 | return rc; |
279 | error: | 283 | error: |
280 | if (repeat--) { | 284 | if (repeat--) { |
@@ -392,7 +396,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, | |||
392 | if (dma_capable(dev, dev_addr, size) && | 396 | if (dma_capable(dev, dev_addr, size) && |
393 | !range_straddles_page_boundary(phys, size) && | 397 | !range_straddles_page_boundary(phys, size) && |
394 | !xen_arch_need_swiotlb(dev, phys, dev_addr) && | 398 | !xen_arch_need_swiotlb(dev, phys, dev_addr) && |
395 | !swiotlb_force) { | 399 | (swiotlb_force != SWIOTLB_FORCE)) { |
396 | /* we are not interested in the dma_addr returned by | 400 | /* we are not interested in the dma_addr returned by |
397 | * xen_dma_map_page, only in the potential cache flushes executed | 401 | * xen_dma_map_page, only in the potential cache flushes executed |
398 | * by the function. */ | 402 | * by the function. */ |
@@ -552,7 +556,7 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | |||
552 | phys_addr_t paddr = sg_phys(sg); | 556 | phys_addr_t paddr = sg_phys(sg); |
553 | dma_addr_t dev_addr = xen_phys_to_bus(paddr); | 557 | dma_addr_t dev_addr = xen_phys_to_bus(paddr); |
554 | 558 | ||
555 | if (swiotlb_force || | 559 | if (swiotlb_force == SWIOTLB_FORCE || |
556 | xen_arch_need_swiotlb(hwdev, paddr, dev_addr) || | 560 | xen_arch_need_swiotlb(hwdev, paddr, dev_addr) || |
557 | !dma_capable(hwdev, dev_addr, sg->length) || | 561 | !dma_capable(hwdev, dev_addr, sg->length) || |
558 | range_straddles_page_boundary(paddr, sg->length)) { | 562 | range_straddles_page_boundary(paddr, sg->length)) { |
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h index e74f9c1fbd80..867a2e425208 100644 --- a/drivers/xen/xenbus/xenbus_comms.h +++ b/drivers/xen/xenbus/xenbus_comms.h | |||
@@ -42,7 +42,6 @@ int xb_write(const void *data, unsigned len); | |||
42 | int xb_read(void *data, unsigned len); | 42 | int xb_read(void *data, unsigned len); |
43 | int xb_data_to_read(void); | 43 | int xb_data_to_read(void); |
44 | int xb_wait_for_data_to_read(void); | 44 | int xb_wait_for_data_to_read(void); |
45 | int xs_input_avail(void); | ||
46 | extern struct xenstore_domain_interface *xen_store_interface; | 45 | extern struct xenstore_domain_interface *xen_store_interface; |
47 | extern int xen_store_evtchn; | 46 | extern int xen_store_evtchn; |
48 | extern enum xenstore_init xen_store_domain_type; | 47 | extern enum xenstore_init xen_store_domain_type; |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 6c0ead4be784..79130b310247 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
@@ -302,6 +302,29 @@ static void watch_fired(struct xenbus_watch *watch, | |||
302 | mutex_unlock(&adap->dev_data->reply_mutex); | 302 | mutex_unlock(&adap->dev_data->reply_mutex); |
303 | } | 303 | } |
304 | 304 | ||
305 | static int xenbus_command_reply(struct xenbus_file_priv *u, | ||
306 | unsigned int msg_type, const char *reply) | ||
307 | { | ||
308 | struct { | ||
309 | struct xsd_sockmsg hdr; | ||
310 | const char body[16]; | ||
311 | } msg; | ||
312 | int rc; | ||
313 | |||
314 | msg.hdr = u->u.msg; | ||
315 | msg.hdr.type = msg_type; | ||
316 | msg.hdr.len = strlen(reply) + 1; | ||
317 | if (msg.hdr.len > sizeof(msg.body)) | ||
318 | return -E2BIG; | ||
319 | |||
320 | mutex_lock(&u->reply_mutex); | ||
321 | rc = queue_reply(&u->read_buffers, &msg, sizeof(msg.hdr) + msg.hdr.len); | ||
322 | wake_up(&u->read_waitq); | ||
323 | mutex_unlock(&u->reply_mutex); | ||
324 | |||
325 | return rc; | ||
326 | } | ||
327 | |||
305 | static int xenbus_write_transaction(unsigned msg_type, | 328 | static int xenbus_write_transaction(unsigned msg_type, |
306 | struct xenbus_file_priv *u) | 329 | struct xenbus_file_priv *u) |
307 | { | 330 | { |
@@ -316,12 +339,12 @@ static int xenbus_write_transaction(unsigned msg_type, | |||
316 | rc = -ENOMEM; | 339 | rc = -ENOMEM; |
317 | goto out; | 340 | goto out; |
318 | } | 341 | } |
319 | } else if (msg_type == XS_TRANSACTION_END) { | 342 | } else if (u->u.msg.tx_id != 0) { |
320 | list_for_each_entry(trans, &u->transactions, list) | 343 | list_for_each_entry(trans, &u->transactions, list) |
321 | if (trans->handle.id == u->u.msg.tx_id) | 344 | if (trans->handle.id == u->u.msg.tx_id) |
322 | break; | 345 | break; |
323 | if (&trans->list == &u->transactions) | 346 | if (&trans->list == &u->transactions) |
324 | return -ESRCH; | 347 | return xenbus_command_reply(u, XS_ERROR, "ENOENT"); |
325 | } | 348 | } |
326 | 349 | ||
327 | reply = xenbus_dev_request_and_reply(&u->u.msg); | 350 | reply = xenbus_dev_request_and_reply(&u->u.msg); |
@@ -372,12 +395,12 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) | |||
372 | path = u->u.buffer + sizeof(u->u.msg); | 395 | path = u->u.buffer + sizeof(u->u.msg); |
373 | token = memchr(path, 0, u->u.msg.len); | 396 | token = memchr(path, 0, u->u.msg.len); |
374 | if (token == NULL) { | 397 | if (token == NULL) { |
375 | rc = -EILSEQ; | 398 | rc = xenbus_command_reply(u, XS_ERROR, "EINVAL"); |
376 | goto out; | 399 | goto out; |
377 | } | 400 | } |
378 | token++; | 401 | token++; |
379 | if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { | 402 | if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { |
380 | rc = -EILSEQ; | 403 | rc = xenbus_command_reply(u, XS_ERROR, "EINVAL"); |
381 | goto out; | 404 | goto out; |
382 | } | 405 | } |
383 | 406 | ||
@@ -411,23 +434,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) | |||
411 | } | 434 | } |
412 | 435 | ||
413 | /* Success. Synthesize a reply to say all is OK. */ | 436 | /* Success. Synthesize a reply to say all is OK. */ |
414 | { | 437 | rc = xenbus_command_reply(u, msg_type, "OK"); |
415 | struct { | ||
416 | struct xsd_sockmsg hdr; | ||
417 | char body[3]; | ||
418 | } __packed reply = { | ||
419 | { | ||
420 | .type = msg_type, | ||
421 | .len = sizeof(reply.body) | ||
422 | }, | ||
423 | "OK" | ||
424 | }; | ||
425 | |||
426 | mutex_lock(&u->reply_mutex); | ||
427 | rc = queue_reply(&u->read_buffers, &reply, sizeof(reply)); | ||
428 | wake_up(&u->read_waitq); | ||
429 | mutex_unlock(&u->reply_mutex); | ||
430 | } | ||
431 | 438 | ||
432 | out: | 439 | out: |
433 | return rc; | 440 | return rc; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 6254cee8f8f3..5db5d1340d69 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -328,6 +328,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) | |||
328 | struct file *file = iocb->ki_filp; | 328 | struct file *file = iocb->ki_filp; |
329 | struct inode *inode = bdev_file_inode(file); | 329 | struct inode *inode = bdev_file_inode(file); |
330 | struct block_device *bdev = I_BDEV(inode); | 330 | struct block_device *bdev = I_BDEV(inode); |
331 | struct blk_plug plug; | ||
331 | struct blkdev_dio *dio; | 332 | struct blkdev_dio *dio; |
332 | struct bio *bio; | 333 | struct bio *bio; |
333 | bool is_read = (iov_iter_rw(iter) == READ); | 334 | bool is_read = (iov_iter_rw(iter) == READ); |
@@ -353,6 +354,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) | |||
353 | dio->multi_bio = false; | 354 | dio->multi_bio = false; |
354 | dio->should_dirty = is_read && (iter->type == ITER_IOVEC); | 355 | dio->should_dirty = is_read && (iter->type == ITER_IOVEC); |
355 | 356 | ||
357 | blk_start_plug(&plug); | ||
356 | for (;;) { | 358 | for (;;) { |
357 | bio->bi_bdev = bdev; | 359 | bio->bi_bdev = bdev; |
358 | bio->bi_iter.bi_sector = pos >> 9; | 360 | bio->bi_iter.bi_sector = pos >> 9; |
@@ -394,6 +396,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) | |||
394 | submit_bio(bio); | 396 | submit_bio(bio); |
395 | bio = bio_alloc(GFP_KERNEL, nr_pages); | 397 | bio = bio_alloc(GFP_KERNEL, nr_pages); |
396 | } | 398 | } |
399 | blk_finish_plug(&plug); | ||
397 | 400 | ||
398 | if (!dio->is_sync) | 401 | if (!dio->is_sync) |
399 | return -EIOCBQUEUED; | 402 | return -EIOCBQUEUED; |
diff --git a/fs/buffer.c b/fs/buffer.c index d21771fcf7d3..0e87401cf335 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len) | |||
1660 | head = page_buffers(page); | 1660 | head = page_buffers(page); |
1661 | bh = head; | 1661 | bh = head; |
1662 | do { | 1662 | do { |
1663 | if (!buffer_mapped(bh)) | 1663 | if (!buffer_mapped(bh) || (bh->b_blocknr < block)) |
1664 | goto next; | 1664 | goto next; |
1665 | if (bh->b_blocknr >= block + len) | 1665 | if (bh->b_blocknr >= block + len) |
1666 | break; | 1666 | break; |
diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 6eeea1dcba41..95cd4c3b06c3 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c | |||
@@ -248,7 +248,8 @@ retry: | |||
248 | goto out; | 248 | goto out; |
249 | 249 | ||
250 | if (fscrypt_dummy_context_enabled(inode)) { | 250 | if (fscrypt_dummy_context_enabled(inode)) { |
251 | memset(raw_key, 0x42, FS_AES_256_XTS_KEY_SIZE); | 251 | memset(raw_key, 0x42, keysize/2); |
252 | memset(raw_key+keysize/2, 0x24, keysize - (keysize/2)); | ||
252 | goto got_key; | 253 | goto got_key; |
253 | } | 254 | } |
254 | 255 | ||
diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c index 6ed7c2eebeec..d6cd7ea4851d 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c | |||
@@ -179,6 +179,11 @@ int fscrypt_has_permitted_context(struct inode *parent, struct inode *child) | |||
179 | BUG_ON(1); | 179 | BUG_ON(1); |
180 | } | 180 | } |
181 | 181 | ||
182 | /* No restrictions on file types which are never encrypted */ | ||
183 | if (!S_ISREG(child->i_mode) && !S_ISDIR(child->i_mode) && | ||
184 | !S_ISLNK(child->i_mode)) | ||
185 | return 1; | ||
186 | |||
182 | /* no restrictions if the parent directory is not encrypted */ | 187 | /* no restrictions if the parent directory is not encrypted */ |
183 | if (!parent->i_sb->s_cop->is_encrypted(parent)) | 188 | if (!parent->i_sb->s_cop->is_encrypted(parent)) |
184 | return 1; | 189 | return 1; |
@@ -451,16 +451,37 @@ void dax_wake_mapping_entry_waiter(struct address_space *mapping, | |||
451 | __wake_up(wq, TASK_NORMAL, wake_all ? 0 : 1, &key); | 451 | __wake_up(wq, TASK_NORMAL, wake_all ? 0 : 1, &key); |
452 | } | 452 | } |
453 | 453 | ||
454 | static int __dax_invalidate_mapping_entry(struct address_space *mapping, | ||
455 | pgoff_t index, bool trunc) | ||
456 | { | ||
457 | int ret = 0; | ||
458 | void *entry; | ||
459 | struct radix_tree_root *page_tree = &mapping->page_tree; | ||
460 | |||
461 | spin_lock_irq(&mapping->tree_lock); | ||
462 | entry = get_unlocked_mapping_entry(mapping, index, NULL); | ||
463 | if (!entry || !radix_tree_exceptional_entry(entry)) | ||
464 | goto out; | ||
465 | if (!trunc && | ||
466 | (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) || | ||
467 | radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE))) | ||
468 | goto out; | ||
469 | radix_tree_delete(page_tree, index); | ||
470 | mapping->nrexceptional--; | ||
471 | ret = 1; | ||
472 | out: | ||
473 | put_unlocked_mapping_entry(mapping, index, entry); | ||
474 | spin_unlock_irq(&mapping->tree_lock); | ||
475 | return ret; | ||
476 | } | ||
454 | /* | 477 | /* |
455 | * Delete exceptional DAX entry at @index from @mapping. Wait for radix tree | 478 | * Delete exceptional DAX entry at @index from @mapping. Wait for radix tree |
456 | * entry to get unlocked before deleting it. | 479 | * entry to get unlocked before deleting it. |
457 | */ | 480 | */ |
458 | int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index) | 481 | int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index) |
459 | { | 482 | { |
460 | void *entry; | 483 | int ret = __dax_invalidate_mapping_entry(mapping, index, true); |
461 | 484 | ||
462 | spin_lock_irq(&mapping->tree_lock); | ||
463 | entry = get_unlocked_mapping_entry(mapping, index, NULL); | ||
464 | /* | 485 | /* |
465 | * This gets called from truncate / punch_hole path. As such, the caller | 486 | * This gets called from truncate / punch_hole path. As such, the caller |
466 | * must hold locks protecting against concurrent modifications of the | 487 | * must hold locks protecting against concurrent modifications of the |
@@ -468,16 +489,46 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index) | |||
468 | * caller has seen exceptional entry for this index, we better find it | 489 | * caller has seen exceptional entry for this index, we better find it |
469 | * at that index as well... | 490 | * at that index as well... |
470 | */ | 491 | */ |
471 | if (WARN_ON_ONCE(!entry || !radix_tree_exceptional_entry(entry))) { | 492 | WARN_ON_ONCE(!ret); |
472 | spin_unlock_irq(&mapping->tree_lock); | 493 | return ret; |
473 | return 0; | 494 | } |
474 | } | 495 | |
475 | radix_tree_delete(&mapping->page_tree, index); | 496 | /* |
497 | * Invalidate exceptional DAX entry if easily possible. This handles DAX | ||
498 | * entries for invalidate_inode_pages() so we evict the entry only if we can | ||
499 | * do so without blocking. | ||
500 | */ | ||
501 | int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index) | ||
502 | { | ||
503 | int ret = 0; | ||
504 | void *entry, **slot; | ||
505 | struct radix_tree_root *page_tree = &mapping->page_tree; | ||
506 | |||
507 | spin_lock_irq(&mapping->tree_lock); | ||
508 | entry = __radix_tree_lookup(page_tree, index, NULL, &slot); | ||
509 | if (!entry || !radix_tree_exceptional_entry(entry) || | ||
510 | slot_locked(mapping, slot)) | ||
511 | goto out; | ||
512 | if (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) || | ||
513 | radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE)) | ||
514 | goto out; | ||
515 | radix_tree_delete(page_tree, index); | ||
476 | mapping->nrexceptional--; | 516 | mapping->nrexceptional--; |
517 | ret = 1; | ||
518 | out: | ||
477 | spin_unlock_irq(&mapping->tree_lock); | 519 | spin_unlock_irq(&mapping->tree_lock); |
478 | dax_wake_mapping_entry_waiter(mapping, index, entry, true); | 520 | if (ret) |
521 | dax_wake_mapping_entry_waiter(mapping, index, entry, true); | ||
522 | return ret; | ||
523 | } | ||
479 | 524 | ||
480 | return 1; | 525 | /* |
526 | * Invalidate exceptional DAX entry if it is clean. | ||
527 | */ | ||
528 | int dax_invalidate_mapping_entry_sync(struct address_space *mapping, | ||
529 | pgoff_t index) | ||
530 | { | ||
531 | return __dax_invalidate_mapping_entry(mapping, index, false); | ||
481 | } | 532 | } |
482 | 533 | ||
483 | /* | 534 | /* |
@@ -488,15 +539,16 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index) | |||
488 | * otherwise it will simply fall out of the page cache under memory | 539 | * otherwise it will simply fall out of the page cache under memory |
489 | * pressure without ever having been dirtied. | 540 | * pressure without ever having been dirtied. |
490 | */ | 541 | */ |
491 | static int dax_load_hole(struct address_space *mapping, void *entry, | 542 | static int dax_load_hole(struct address_space *mapping, void **entry, |
492 | struct vm_fault *vmf) | 543 | struct vm_fault *vmf) |
493 | { | 544 | { |
494 | struct page *page; | 545 | struct page *page; |
546 | int ret; | ||
495 | 547 | ||
496 | /* Hole page already exists? Return it... */ | 548 | /* Hole page already exists? Return it... */ |
497 | if (!radix_tree_exceptional_entry(entry)) { | 549 | if (!radix_tree_exceptional_entry(*entry)) { |
498 | vmf->page = entry; | 550 | page = *entry; |
499 | return VM_FAULT_LOCKED; | 551 | goto out; |
500 | } | 552 | } |
501 | 553 | ||
502 | /* This will replace locked radix tree entry with a hole page */ | 554 | /* This will replace locked radix tree entry with a hole page */ |
@@ -504,8 +556,17 @@ static int dax_load_hole(struct address_space *mapping, void *entry, | |||
504 | vmf->gfp_mask | __GFP_ZERO); | 556 | vmf->gfp_mask | __GFP_ZERO); |
505 | if (!page) | 557 | if (!page) |
506 | return VM_FAULT_OOM; | 558 | return VM_FAULT_OOM; |
559 | out: | ||
507 | vmf->page = page; | 560 | vmf->page = page; |
508 | return VM_FAULT_LOCKED; | 561 | ret = finish_fault(vmf); |
562 | vmf->page = NULL; | ||
563 | *entry = page; | ||
564 | if (!ret) { | ||
565 | /* Grab reference for PTE that is now referencing the page */ | ||
566 | get_page(page); | ||
567 | return VM_FAULT_NOPAGE; | ||
568 | } | ||
569 | return ret; | ||
509 | } | 570 | } |
510 | 571 | ||
511 | static int copy_user_dax(struct block_device *bdev, sector_t sector, size_t size, | 572 | static int copy_user_dax(struct block_device *bdev, sector_t sector, size_t size, |
@@ -934,6 +995,17 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, | |||
934 | if (WARN_ON_ONCE(iomap->type != IOMAP_MAPPED)) | 995 | if (WARN_ON_ONCE(iomap->type != IOMAP_MAPPED)) |
935 | return -EIO; | 996 | return -EIO; |
936 | 997 | ||
998 | /* | ||
999 | * Write can allocate block for an area which has a hole page mapped | ||
1000 | * into page tables. We have to tear down these mappings so that data | ||
1001 | * written by write(2) is visible in mmap. | ||
1002 | */ | ||
1003 | if ((iomap->flags & IOMAP_F_NEW) && inode->i_mapping->nrpages) { | ||
1004 | invalidate_inode_pages2_range(inode->i_mapping, | ||
1005 | pos >> PAGE_SHIFT, | ||
1006 | (end - 1) >> PAGE_SHIFT); | ||
1007 | } | ||
1008 | |||
937 | while (pos < end) { | 1009 | while (pos < end) { |
938 | unsigned offset = pos & (PAGE_SIZE - 1); | 1010 | unsigned offset = pos & (PAGE_SIZE - 1); |
939 | struct blk_dax_ctl dax = { 0 }; | 1011 | struct blk_dax_ctl dax = { 0 }; |
@@ -992,23 +1064,6 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
992 | if (iov_iter_rw(iter) == WRITE) | 1064 | if (iov_iter_rw(iter) == WRITE) |
993 | flags |= IOMAP_WRITE; | 1065 | flags |= IOMAP_WRITE; |
994 | 1066 | ||
995 | /* | ||
996 | * Yes, even DAX files can have page cache attached to them: A zeroed | ||
997 | * page is inserted into the pagecache when we have to serve a write | ||
998 | * fault on a hole. It should never be dirtied and can simply be | ||
999 | * dropped from the pagecache once we get real data for the page. | ||
1000 | * | ||
1001 | * XXX: This is racy against mmap, and there's nothing we can do about | ||
1002 | * it. We'll eventually need to shift this down even further so that | ||
1003 | * we can check if we allocated blocks over a hole first. | ||
1004 | */ | ||
1005 | if (mapping->nrpages) { | ||
1006 | ret = invalidate_inode_pages2_range(mapping, | ||
1007 | pos >> PAGE_SHIFT, | ||
1008 | (pos + iov_iter_count(iter) - 1) >> PAGE_SHIFT); | ||
1009 | WARN_ON_ONCE(ret); | ||
1010 | } | ||
1011 | |||
1012 | while (iov_iter_count(iter)) { | 1067 | while (iov_iter_count(iter)) { |
1013 | ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops, | 1068 | ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops, |
1014 | iter, dax_iomap_actor); | 1069 | iter, dax_iomap_actor); |
@@ -1023,6 +1078,15 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
1023 | } | 1078 | } |
1024 | EXPORT_SYMBOL_GPL(dax_iomap_rw); | 1079 | EXPORT_SYMBOL_GPL(dax_iomap_rw); |
1025 | 1080 | ||
1081 | static int dax_fault_return(int error) | ||
1082 | { | ||
1083 | if (error == 0) | ||
1084 | return VM_FAULT_NOPAGE; | ||
1085 | if (error == -ENOMEM) | ||
1086 | return VM_FAULT_OOM; | ||
1087 | return VM_FAULT_SIGBUS; | ||
1088 | } | ||
1089 | |||
1026 | /** | 1090 | /** |
1027 | * dax_iomap_fault - handle a page fault on a DAX file | 1091 | * dax_iomap_fault - handle a page fault on a DAX file |
1028 | * @vma: The virtual memory area where the fault occurred | 1092 | * @vma: The virtual memory area where the fault occurred |
@@ -1055,12 +1119,6 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
1055 | if (pos >= i_size_read(inode)) | 1119 | if (pos >= i_size_read(inode)) |
1056 | return VM_FAULT_SIGBUS; | 1120 | return VM_FAULT_SIGBUS; |
1057 | 1121 | ||
1058 | entry = grab_mapping_entry(mapping, vmf->pgoff, 0); | ||
1059 | if (IS_ERR(entry)) { | ||
1060 | error = PTR_ERR(entry); | ||
1061 | goto out; | ||
1062 | } | ||
1063 | |||
1064 | if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page) | 1122 | if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page) |
1065 | flags |= IOMAP_WRITE; | 1123 | flags |= IOMAP_WRITE; |
1066 | 1124 | ||
@@ -1071,9 +1129,15 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
1071 | */ | 1129 | */ |
1072 | error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap); | 1130 | error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap); |
1073 | if (error) | 1131 | if (error) |
1074 | goto unlock_entry; | 1132 | return dax_fault_return(error); |
1075 | if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) { | 1133 | if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) { |
1076 | error = -EIO; /* fs corruption? */ | 1134 | vmf_ret = dax_fault_return(-EIO); /* fs corruption? */ |
1135 | goto finish_iomap; | ||
1136 | } | ||
1137 | |||
1138 | entry = grab_mapping_entry(mapping, vmf->pgoff, 0); | ||
1139 | if (IS_ERR(entry)) { | ||
1140 | vmf_ret = dax_fault_return(PTR_ERR(entry)); | ||
1077 | goto finish_iomap; | 1141 | goto finish_iomap; |
1078 | } | 1142 | } |
1079 | 1143 | ||
@@ -1096,13 +1160,13 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
1096 | } | 1160 | } |
1097 | 1161 | ||
1098 | if (error) | 1162 | if (error) |
1099 | goto finish_iomap; | 1163 | goto error_unlock_entry; |
1100 | 1164 | ||
1101 | __SetPageUptodate(vmf->cow_page); | 1165 | __SetPageUptodate(vmf->cow_page); |
1102 | vmf_ret = finish_fault(vmf); | 1166 | vmf_ret = finish_fault(vmf); |
1103 | if (!vmf_ret) | 1167 | if (!vmf_ret) |
1104 | vmf_ret = VM_FAULT_DONE_COW; | 1168 | vmf_ret = VM_FAULT_DONE_COW; |
1105 | goto finish_iomap; | 1169 | goto unlock_entry; |
1106 | } | 1170 | } |
1107 | 1171 | ||
1108 | switch (iomap.type) { | 1172 | switch (iomap.type) { |
@@ -1114,12 +1178,15 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
1114 | } | 1178 | } |
1115 | error = dax_insert_mapping(mapping, iomap.bdev, sector, | 1179 | error = dax_insert_mapping(mapping, iomap.bdev, sector, |
1116 | PAGE_SIZE, &entry, vma, vmf); | 1180 | PAGE_SIZE, &entry, vma, vmf); |
1181 | /* -EBUSY is fine, somebody else faulted on the same PTE */ | ||
1182 | if (error == -EBUSY) | ||
1183 | error = 0; | ||
1117 | break; | 1184 | break; |
1118 | case IOMAP_UNWRITTEN: | 1185 | case IOMAP_UNWRITTEN: |
1119 | case IOMAP_HOLE: | 1186 | case IOMAP_HOLE: |
1120 | if (!(vmf->flags & FAULT_FLAG_WRITE)) { | 1187 | if (!(vmf->flags & FAULT_FLAG_WRITE)) { |
1121 | vmf_ret = dax_load_hole(mapping, entry, vmf); | 1188 | vmf_ret = dax_load_hole(mapping, &entry, vmf); |
1122 | break; | 1189 | goto unlock_entry; |
1123 | } | 1190 | } |
1124 | /*FALLTHRU*/ | 1191 | /*FALLTHRU*/ |
1125 | default: | 1192 | default: |
@@ -1128,31 +1195,25 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
1128 | break; | 1195 | break; |
1129 | } | 1196 | } |
1130 | 1197 | ||
1198 | error_unlock_entry: | ||
1199 | vmf_ret = dax_fault_return(error) | major; | ||
1200 | unlock_entry: | ||
1201 | put_locked_mapping_entry(mapping, vmf->pgoff, entry); | ||
1131 | finish_iomap: | 1202 | finish_iomap: |
1132 | if (ops->iomap_end) { | 1203 | if (ops->iomap_end) { |
1133 | if (error || (vmf_ret & VM_FAULT_ERROR)) { | 1204 | int copied = PAGE_SIZE; |
1134 | /* keep previous error */ | 1205 | |
1135 | ops->iomap_end(inode, pos, PAGE_SIZE, 0, flags, | 1206 | if (vmf_ret & VM_FAULT_ERROR) |
1136 | &iomap); | 1207 | copied = 0; |
1137 | } else { | 1208 | /* |
1138 | error = ops->iomap_end(inode, pos, PAGE_SIZE, | 1209 | * The fault is done by now and there's no way back (other |
1139 | PAGE_SIZE, flags, &iomap); | 1210 | * thread may be already happily using PTE we have installed). |
1140 | } | 1211 | * Just ignore error from ->iomap_end since we cannot do much |
1141 | } | 1212 | * with it. |
1142 | unlock_entry: | 1213 | */ |
1143 | if (vmf_ret != VM_FAULT_LOCKED || error) | 1214 | ops->iomap_end(inode, pos, PAGE_SIZE, copied, flags, &iomap); |
1144 | put_locked_mapping_entry(mapping, vmf->pgoff, entry); | ||
1145 | out: | ||
1146 | if (error == -ENOMEM) | ||
1147 | return VM_FAULT_OOM | major; | ||
1148 | /* -EBUSY is fine, somebody else faulted on the same PTE */ | ||
1149 | if (error < 0 && error != -EBUSY) | ||
1150 | return VM_FAULT_SIGBUS | major; | ||
1151 | if (vmf_ret) { | ||
1152 | WARN_ON_ONCE(error); /* -EBUSY from ops->iomap_end? */ | ||
1153 | return vmf_ret; | ||
1154 | } | 1215 | } |
1155 | return VM_FAULT_NOPAGE | major; | 1216 | return vmf_ret; |
1156 | } | 1217 | } |
1157 | EXPORT_SYMBOL_GPL(dax_iomap_fault); | 1218 | EXPORT_SYMBOL_GPL(dax_iomap_fault); |
1158 | 1219 | ||
@@ -1277,16 +1338,6 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, | |||
1277 | goto fallback; | 1338 | goto fallback; |
1278 | 1339 | ||
1279 | /* | 1340 | /* |
1280 | * grab_mapping_entry() will make sure we get a 2M empty entry, a DAX | ||
1281 | * PMD or a HZP entry. If it can't (because a 4k page is already in | ||
1282 | * the tree, for instance), it will return -EEXIST and we just fall | ||
1283 | * back to 4k entries. | ||
1284 | */ | ||
1285 | entry = grab_mapping_entry(mapping, pgoff, RADIX_DAX_PMD); | ||
1286 | if (IS_ERR(entry)) | ||
1287 | goto fallback; | ||
1288 | |||
1289 | /* | ||
1290 | * Note that we don't use iomap_apply here. We aren't doing I/O, only | 1341 | * Note that we don't use iomap_apply here. We aren't doing I/O, only |
1291 | * setting up a mapping, so really we're using iomap_begin() as a way | 1342 | * setting up a mapping, so really we're using iomap_begin() as a way |
1292 | * to look up our filesystem block. | 1343 | * to look up our filesystem block. |
@@ -1294,10 +1345,21 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, | |||
1294 | pos = (loff_t)pgoff << PAGE_SHIFT; | 1345 | pos = (loff_t)pgoff << PAGE_SHIFT; |
1295 | error = ops->iomap_begin(inode, pos, PMD_SIZE, iomap_flags, &iomap); | 1346 | error = ops->iomap_begin(inode, pos, PMD_SIZE, iomap_flags, &iomap); |
1296 | if (error) | 1347 | if (error) |
1297 | goto unlock_entry; | 1348 | goto fallback; |
1349 | |||
1298 | if (iomap.offset + iomap.length < pos + PMD_SIZE) | 1350 | if (iomap.offset + iomap.length < pos + PMD_SIZE) |
1299 | goto finish_iomap; | 1351 | goto finish_iomap; |
1300 | 1352 | ||
1353 | /* | ||
1354 | * grab_mapping_entry() will make sure we get a 2M empty entry, a DAX | ||
1355 | * PMD or a HZP entry. If it can't (because a 4k page is already in | ||
1356 | * the tree, for instance), it will return -EEXIST and we just fall | ||
1357 | * back to 4k entries. | ||
1358 | */ | ||
1359 | entry = grab_mapping_entry(mapping, pgoff, RADIX_DAX_PMD); | ||
1360 | if (IS_ERR(entry)) | ||
1361 | goto finish_iomap; | ||
1362 | |||
1301 | vmf.pgoff = pgoff; | 1363 | vmf.pgoff = pgoff; |
1302 | vmf.flags = flags; | 1364 | vmf.flags = flags; |
1303 | vmf.gfp_mask = mapping_gfp_mask(mapping) | __GFP_IO; | 1365 | vmf.gfp_mask = mapping_gfp_mask(mapping) | __GFP_IO; |
@@ -1310,7 +1372,7 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, | |||
1310 | case IOMAP_UNWRITTEN: | 1372 | case IOMAP_UNWRITTEN: |
1311 | case IOMAP_HOLE: | 1373 | case IOMAP_HOLE: |
1312 | if (WARN_ON_ONCE(write)) | 1374 | if (WARN_ON_ONCE(write)) |
1313 | goto finish_iomap; | 1375 | goto unlock_entry; |
1314 | result = dax_pmd_load_hole(vma, pmd, &vmf, address, &iomap, | 1376 | result = dax_pmd_load_hole(vma, pmd, &vmf, address, &iomap, |
1315 | &entry); | 1377 | &entry); |
1316 | break; | 1378 | break; |
@@ -1319,20 +1381,23 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, | |||
1319 | break; | 1381 | break; |
1320 | } | 1382 | } |
1321 | 1383 | ||
1384 | unlock_entry: | ||
1385 | put_locked_mapping_entry(mapping, pgoff, entry); | ||
1322 | finish_iomap: | 1386 | finish_iomap: |
1323 | if (ops->iomap_end) { | 1387 | if (ops->iomap_end) { |
1324 | if (result == VM_FAULT_FALLBACK) { | 1388 | int copied = PMD_SIZE; |
1325 | ops->iomap_end(inode, pos, PMD_SIZE, 0, iomap_flags, | 1389 | |
1326 | &iomap); | 1390 | if (result == VM_FAULT_FALLBACK) |
1327 | } else { | 1391 | copied = 0; |
1328 | error = ops->iomap_end(inode, pos, PMD_SIZE, PMD_SIZE, | 1392 | /* |
1329 | iomap_flags, &iomap); | 1393 | * The fault is done by now and there's no way back (other |
1330 | if (error) | 1394 | * thread may be already happily using PMD we have installed). |
1331 | result = VM_FAULT_FALLBACK; | 1395 | * Just ignore error from ->iomap_end since we cannot do much |
1332 | } | 1396 | * with it. |
1397 | */ | ||
1398 | ops->iomap_end(inode, pos, PMD_SIZE, copied, iomap_flags, | ||
1399 | &iomap); | ||
1333 | } | 1400 | } |
1334 | unlock_entry: | ||
1335 | put_locked_mapping_entry(mapping, pgoff, entry); | ||
1336 | fallback: | 1401 | fallback: |
1337 | if (result == VM_FAULT_FALLBACK) { | 1402 | if (result == VM_FAULT_FALLBACK) { |
1338 | split_huge_pmd(vma, pmd, address); | 1403 | split_huge_pmd(vma, pmd, address); |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 0093ea2512a8..f073bfca694b 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -751,9 +751,8 @@ static int ext2_get_blocks(struct inode *inode, | |||
751 | mutex_unlock(&ei->truncate_mutex); | 751 | mutex_unlock(&ei->truncate_mutex); |
752 | goto cleanup; | 752 | goto cleanup; |
753 | } | 753 | } |
754 | } else { | ||
755 | *new = true; | ||
756 | } | 754 | } |
755 | *new = true; | ||
757 | 756 | ||
758 | ext2_splice_branch(inode, iblock, partial, indirect_blks, count); | 757 | ext2_splice_branch(inode, iblock, partial, indirect_blks, count); |
759 | mutex_unlock(&ei->truncate_mutex); | 758 | mutex_unlock(&ei->truncate_mutex); |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index b5f184493c57..d663d3d7c81c 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -258,7 +258,6 @@ out: | |||
258 | static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 258 | static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
259 | { | 259 | { |
260 | int result; | 260 | int result; |
261 | handle_t *handle = NULL; | ||
262 | struct inode *inode = file_inode(vma->vm_file); | 261 | struct inode *inode = file_inode(vma->vm_file); |
263 | struct super_block *sb = inode->i_sb; | 262 | struct super_block *sb = inode->i_sb; |
264 | bool write = vmf->flags & FAULT_FLAG_WRITE; | 263 | bool write = vmf->flags & FAULT_FLAG_WRITE; |
@@ -266,24 +265,12 @@ static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
266 | if (write) { | 265 | if (write) { |
267 | sb_start_pagefault(sb); | 266 | sb_start_pagefault(sb); |
268 | file_update_time(vma->vm_file); | 267 | file_update_time(vma->vm_file); |
269 | down_read(&EXT4_I(inode)->i_mmap_sem); | 268 | } |
270 | handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, | 269 | down_read(&EXT4_I(inode)->i_mmap_sem); |
271 | EXT4_DATA_TRANS_BLOCKS(sb)); | 270 | result = dax_iomap_fault(vma, vmf, &ext4_iomap_ops); |
272 | } else | 271 | up_read(&EXT4_I(inode)->i_mmap_sem); |
273 | down_read(&EXT4_I(inode)->i_mmap_sem); | 272 | if (write) |
274 | |||
275 | if (IS_ERR(handle)) | ||
276 | result = VM_FAULT_SIGBUS; | ||
277 | else | ||
278 | result = dax_iomap_fault(vma, vmf, &ext4_iomap_ops); | ||
279 | |||
280 | if (write) { | ||
281 | if (!IS_ERR(handle)) | ||
282 | ext4_journal_stop(handle); | ||
283 | up_read(&EXT4_I(inode)->i_mmap_sem); | ||
284 | sb_end_pagefault(sb); | 273 | sb_end_pagefault(sb); |
285 | } else | ||
286 | up_read(&EXT4_I(inode)->i_mmap_sem); | ||
287 | 274 | ||
288 | return result; | 275 | return result; |
289 | } | 276 | } |
@@ -292,7 +279,6 @@ static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr, | |||
292 | pmd_t *pmd, unsigned int flags) | 279 | pmd_t *pmd, unsigned int flags) |
293 | { | 280 | { |
294 | int result; | 281 | int result; |
295 | handle_t *handle = NULL; | ||
296 | struct inode *inode = file_inode(vma->vm_file); | 282 | struct inode *inode = file_inode(vma->vm_file); |
297 | struct super_block *sb = inode->i_sb; | 283 | struct super_block *sb = inode->i_sb; |
298 | bool write = flags & FAULT_FLAG_WRITE; | 284 | bool write = flags & FAULT_FLAG_WRITE; |
@@ -300,27 +286,13 @@ static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr, | |||
300 | if (write) { | 286 | if (write) { |
301 | sb_start_pagefault(sb); | 287 | sb_start_pagefault(sb); |
302 | file_update_time(vma->vm_file); | 288 | file_update_time(vma->vm_file); |
303 | down_read(&EXT4_I(inode)->i_mmap_sem); | ||
304 | handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, | ||
305 | ext4_chunk_trans_blocks(inode, | ||
306 | PMD_SIZE / PAGE_SIZE)); | ||
307 | } else | ||
308 | down_read(&EXT4_I(inode)->i_mmap_sem); | ||
309 | |||
310 | if (IS_ERR(handle)) | ||
311 | result = VM_FAULT_SIGBUS; | ||
312 | else { | ||
313 | result = dax_iomap_pmd_fault(vma, addr, pmd, flags, | ||
314 | &ext4_iomap_ops); | ||
315 | } | 289 | } |
316 | 290 | down_read(&EXT4_I(inode)->i_mmap_sem); | |
317 | if (write) { | 291 | result = dax_iomap_pmd_fault(vma, addr, pmd, flags, |
318 | if (!IS_ERR(handle)) | 292 | &ext4_iomap_ops); |
319 | ext4_journal_stop(handle); | 293 | up_read(&EXT4_I(inode)->i_mmap_sem); |
320 | up_read(&EXT4_I(inode)->i_mmap_sem); | 294 | if (write) |
321 | sb_end_pagefault(sb); | 295 | sb_end_pagefault(sb); |
322 | } else | ||
323 | up_read(&EXT4_I(inode)->i_mmap_sem); | ||
324 | 296 | ||
325 | return result; | 297 | return result; |
326 | } | 298 | } |
diff --git a/fs/notify/mark.c b/fs/notify/mark.c index d3fea0bd89e2..6043306e8e21 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c | |||
@@ -510,18 +510,6 @@ void fsnotify_detach_group_marks(struct fsnotify_group *group) | |||
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old) | ||
514 | { | ||
515 | assert_spin_locked(&old->lock); | ||
516 | new->inode = old->inode; | ||
517 | new->mnt = old->mnt; | ||
518 | if (old->group) | ||
519 | fsnotify_get_group(old->group); | ||
520 | new->group = old->group; | ||
521 | new->mask = old->mask; | ||
522 | new->free_mark = old->free_mark; | ||
523 | } | ||
524 | |||
525 | /* | 513 | /* |
526 | * Nothing fancy, just initialize lists and locks and counters. | 514 | * Nothing fancy, just initialize lists and locks and counters. |
527 | */ | 515 | */ |
diff --git a/fs/xfs/libxfs/xfs_ag_resv.c b/fs/xfs/libxfs/xfs_ag_resv.c index e5ebc3770460..d346d42c54d1 100644 --- a/fs/xfs/libxfs/xfs_ag_resv.c +++ b/fs/xfs/libxfs/xfs_ag_resv.c | |||
@@ -256,6 +256,9 @@ xfs_ag_resv_init( | |||
256 | goto out; | 256 | goto out; |
257 | } | 257 | } |
258 | 258 | ||
259 | ASSERT(xfs_perag_resv(pag, XFS_AG_RESV_METADATA)->ar_reserved + | ||
260 | xfs_perag_resv(pag, XFS_AG_RESV_AGFL)->ar_reserved <= | ||
261 | pag->pagf_freeblks + pag->pagf_flcount); | ||
259 | out: | 262 | out: |
260 | return error; | 263 | return error; |
261 | } | 264 | } |
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.c b/fs/xfs/libxfs/xfs_refcount_btree.c index 6fb2215f8ff7..50add5272807 100644 --- a/fs/xfs/libxfs/xfs_refcount_btree.c +++ b/fs/xfs/libxfs/xfs_refcount_btree.c | |||
@@ -409,13 +409,14 @@ xfs_refcountbt_calc_size( | |||
409 | */ | 409 | */ |
410 | xfs_extlen_t | 410 | xfs_extlen_t |
411 | xfs_refcountbt_max_size( | 411 | xfs_refcountbt_max_size( |
412 | struct xfs_mount *mp) | 412 | struct xfs_mount *mp, |
413 | xfs_agblock_t agblocks) | ||
413 | { | 414 | { |
414 | /* Bail out if we're uninitialized, which can happen in mkfs. */ | 415 | /* Bail out if we're uninitialized, which can happen in mkfs. */ |
415 | if (mp->m_refc_mxr[0] == 0) | 416 | if (mp->m_refc_mxr[0] == 0) |
416 | return 0; | 417 | return 0; |
417 | 418 | ||
418 | return xfs_refcountbt_calc_size(mp, mp->m_sb.sb_agblocks); | 419 | return xfs_refcountbt_calc_size(mp, agblocks); |
419 | } | 420 | } |
420 | 421 | ||
421 | /* | 422 | /* |
@@ -430,22 +431,24 @@ xfs_refcountbt_calc_reserves( | |||
430 | { | 431 | { |
431 | struct xfs_buf *agbp; | 432 | struct xfs_buf *agbp; |
432 | struct xfs_agf *agf; | 433 | struct xfs_agf *agf; |
434 | xfs_agblock_t agblocks; | ||
433 | xfs_extlen_t tree_len; | 435 | xfs_extlen_t tree_len; |
434 | int error; | 436 | int error; |
435 | 437 | ||
436 | if (!xfs_sb_version_hasreflink(&mp->m_sb)) | 438 | if (!xfs_sb_version_hasreflink(&mp->m_sb)) |
437 | return 0; | 439 | return 0; |
438 | 440 | ||
439 | *ask += xfs_refcountbt_max_size(mp); | ||
440 | 441 | ||
441 | error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); | 442 | error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); |
442 | if (error) | 443 | if (error) |
443 | return error; | 444 | return error; |
444 | 445 | ||
445 | agf = XFS_BUF_TO_AGF(agbp); | 446 | agf = XFS_BUF_TO_AGF(agbp); |
447 | agblocks = be32_to_cpu(agf->agf_length); | ||
446 | tree_len = be32_to_cpu(agf->agf_refcount_blocks); | 448 | tree_len = be32_to_cpu(agf->agf_refcount_blocks); |
447 | xfs_buf_relse(agbp); | 449 | xfs_buf_relse(agbp); |
448 | 450 | ||
451 | *ask += xfs_refcountbt_max_size(mp, agblocks); | ||
449 | *used += tree_len; | 452 | *used += tree_len; |
450 | 453 | ||
451 | return error; | 454 | return error; |
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.h b/fs/xfs/libxfs/xfs_refcount_btree.h index 3be7768bd51a..9db008b955b7 100644 --- a/fs/xfs/libxfs/xfs_refcount_btree.h +++ b/fs/xfs/libxfs/xfs_refcount_btree.h | |||
@@ -66,7 +66,8 @@ extern void xfs_refcountbt_compute_maxlevels(struct xfs_mount *mp); | |||
66 | 66 | ||
67 | extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp, | 67 | extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp, |
68 | unsigned long long len); | 68 | unsigned long long len); |
69 | extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp); | 69 | extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp, |
70 | xfs_agblock_t agblocks); | ||
70 | 71 | ||
71 | extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp, | 72 | extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp, |
72 | xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); | 73 | xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); |
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c index de25771764ba..74e5a54bc428 100644 --- a/fs/xfs/libxfs/xfs_rmap_btree.c +++ b/fs/xfs/libxfs/xfs_rmap_btree.c | |||
@@ -550,13 +550,14 @@ xfs_rmapbt_calc_size( | |||
550 | */ | 550 | */ |
551 | xfs_extlen_t | 551 | xfs_extlen_t |
552 | xfs_rmapbt_max_size( | 552 | xfs_rmapbt_max_size( |
553 | struct xfs_mount *mp) | 553 | struct xfs_mount *mp, |
554 | xfs_agblock_t agblocks) | ||
554 | { | 555 | { |
555 | /* Bail out if we're uninitialized, which can happen in mkfs. */ | 556 | /* Bail out if we're uninitialized, which can happen in mkfs. */ |
556 | if (mp->m_rmap_mxr[0] == 0) | 557 | if (mp->m_rmap_mxr[0] == 0) |
557 | return 0; | 558 | return 0; |
558 | 559 | ||
559 | return xfs_rmapbt_calc_size(mp, mp->m_sb.sb_agblocks); | 560 | return xfs_rmapbt_calc_size(mp, agblocks); |
560 | } | 561 | } |
561 | 562 | ||
562 | /* | 563 | /* |
@@ -571,25 +572,24 @@ xfs_rmapbt_calc_reserves( | |||
571 | { | 572 | { |
572 | struct xfs_buf *agbp; | 573 | struct xfs_buf *agbp; |
573 | struct xfs_agf *agf; | 574 | struct xfs_agf *agf; |
574 | xfs_extlen_t pool_len; | 575 | xfs_agblock_t agblocks; |
575 | xfs_extlen_t tree_len; | 576 | xfs_extlen_t tree_len; |
576 | int error; | 577 | int error; |
577 | 578 | ||
578 | if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) | 579 | if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) |
579 | return 0; | 580 | return 0; |
580 | 581 | ||
581 | /* Reserve 1% of the AG or enough for 1 block per record. */ | ||
582 | pool_len = max(mp->m_sb.sb_agblocks / 100, xfs_rmapbt_max_size(mp)); | ||
583 | *ask += pool_len; | ||
584 | |||
585 | error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); | 582 | error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); |
586 | if (error) | 583 | if (error) |
587 | return error; | 584 | return error; |
588 | 585 | ||
589 | agf = XFS_BUF_TO_AGF(agbp); | 586 | agf = XFS_BUF_TO_AGF(agbp); |
587 | agblocks = be32_to_cpu(agf->agf_length); | ||
590 | tree_len = be32_to_cpu(agf->agf_rmap_blocks); | 588 | tree_len = be32_to_cpu(agf->agf_rmap_blocks); |
591 | xfs_buf_relse(agbp); | 589 | xfs_buf_relse(agbp); |
592 | 590 | ||
591 | /* Reserve 1% of the AG or enough for 1 block per record. */ | ||
592 | *ask += max(agblocks / 100, xfs_rmapbt_max_size(mp, agblocks)); | ||
593 | *used += tree_len; | 593 | *used += tree_len; |
594 | 594 | ||
595 | return error; | 595 | return error; |
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.h b/fs/xfs/libxfs/xfs_rmap_btree.h index 2a9ac472fb15..19c08e933049 100644 --- a/fs/xfs/libxfs/xfs_rmap_btree.h +++ b/fs/xfs/libxfs/xfs_rmap_btree.h | |||
@@ -60,7 +60,8 @@ extern void xfs_rmapbt_compute_maxlevels(struct xfs_mount *mp); | |||
60 | 60 | ||
61 | extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp, | 61 | extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp, |
62 | unsigned long long len); | 62 | unsigned long long len); |
63 | extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp); | 63 | extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp, |
64 | xfs_agblock_t agblocks); | ||
64 | 65 | ||
65 | extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp, | 66 | extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp, |
66 | xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); | 67 | xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); |
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 93d12fa2670d..242e8091296d 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -631,6 +631,20 @@ xfs_growfs_data_private( | |||
631 | xfs_set_low_space_thresholds(mp); | 631 | xfs_set_low_space_thresholds(mp); |
632 | mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); | 632 | mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); |
633 | 633 | ||
634 | /* | ||
635 | * If we expanded the last AG, free the per-AG reservation | ||
636 | * so we can reinitialize it with the new size. | ||
637 | */ | ||
638 | if (new) { | ||
639 | struct xfs_perag *pag; | ||
640 | |||
641 | pag = xfs_perag_get(mp, agno); | ||
642 | error = xfs_ag_resv_free(pag); | ||
643 | xfs_perag_put(pag); | ||
644 | if (error) | ||
645 | goto out; | ||
646 | } | ||
647 | |||
634 | /* Reserve AG metadata blocks. */ | 648 | /* Reserve AG metadata blocks. */ |
635 | error = xfs_fs_reserve_ag_blocks(mp); | 649 | error = xfs_fs_reserve_ag_blocks(mp); |
636 | if (error && error != -ENOSPC) | 650 | if (error && error != -ENOSPC) |
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index ff4d6311c7f4..70ca4f608321 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c | |||
@@ -1597,7 +1597,8 @@ xfs_inode_free_cowblocks( | |||
1597 | * If the mapping is dirty or under writeback we cannot touch the | 1597 | * If the mapping is dirty or under writeback we cannot touch the |
1598 | * CoW fork. Leave it alone if we're in the midst of a directio. | 1598 | * CoW fork. Leave it alone if we're in the midst of a directio. |
1599 | */ | 1599 | */ |
1600 | if (mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) || | 1600 | if ((VFS_I(ip)->i_state & I_DIRTY_PAGES) || |
1601 | mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) || | ||
1601 | mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) || | 1602 | mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) || |
1602 | atomic_read(&VFS_I(ip)->i_dio_count)) | 1603 | atomic_read(&VFS_I(ip)->i_dio_count)) |
1603 | return 0; | 1604 | return 0; |
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c index fe86a668a57e..6e4c7446c3d4 100644 --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c | |||
@@ -526,13 +526,14 @@ xfs_cui_recover( | |||
526 | xfs_refcount_finish_one_cleanup(tp, rcur, error); | 526 | xfs_refcount_finish_one_cleanup(tp, rcur, error); |
527 | error = xfs_defer_finish(&tp, &dfops, NULL); | 527 | error = xfs_defer_finish(&tp, &dfops, NULL); |
528 | if (error) | 528 | if (error) |
529 | goto abort_error; | 529 | goto abort_defer; |
530 | set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags); | 530 | set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags); |
531 | error = xfs_trans_commit(tp); | 531 | error = xfs_trans_commit(tp); |
532 | return error; | 532 | return error; |
533 | 533 | ||
534 | abort_error: | 534 | abort_error: |
535 | xfs_refcount_finish_one_cleanup(tp, rcur, error); | 535 | xfs_refcount_finish_one_cleanup(tp, rcur, error); |
536 | abort_defer: | ||
536 | xfs_defer_cancel(&dfops); | 537 | xfs_defer_cancel(&dfops); |
537 | xfs_trans_cancel(tp); | 538 | xfs_trans_cancel(tp); |
538 | return error; | 539 | return error; |
diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c index 276d3023d60f..de6195e38910 100644 --- a/fs/xfs/xfs_sysfs.c +++ b/fs/xfs/xfs_sysfs.c | |||
@@ -396,7 +396,7 @@ max_retries_show( | |||
396 | int retries; | 396 | int retries; |
397 | struct xfs_error_cfg *cfg = to_error_cfg(kobject); | 397 | struct xfs_error_cfg *cfg = to_error_cfg(kobject); |
398 | 398 | ||
399 | if (cfg->retry_timeout == XFS_ERR_RETRY_FOREVER) | 399 | if (cfg->max_retries == XFS_ERR_RETRY_FOREVER) |
400 | retries = -1; | 400 | retries = -1; |
401 | else | 401 | else |
402 | retries = cfg->max_retries; | 402 | retries = cfg->max_retries; |
@@ -422,7 +422,7 @@ max_retries_store( | |||
422 | return -EINVAL; | 422 | return -EINVAL; |
423 | 423 | ||
424 | if (val == -1) | 424 | if (val == -1) |
425 | cfg->retry_timeout = XFS_ERR_RETRY_FOREVER; | 425 | cfg->max_retries = XFS_ERR_RETRY_FOREVER; |
426 | else | 426 | else |
427 | cfg->max_retries = val; | 427 | cfg->max_retries = val; |
428 | return count; | 428 | return count; |
diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h index df13637e4017..939869c772b1 100644 --- a/include/asm-generic/asm-prototypes.h +++ b/include/asm-generic/asm-prototypes.h | |||
@@ -1,7 +1,13 @@ | |||
1 | #include <linux/bitops.h> | 1 | #include <linux/bitops.h> |
2 | #undef __memset | ||
2 | extern void *__memset(void *, int, __kernel_size_t); | 3 | extern void *__memset(void *, int, __kernel_size_t); |
4 | #undef __memcpy | ||
3 | extern void *__memcpy(void *, const void *, __kernel_size_t); | 5 | extern void *__memcpy(void *, const void *, __kernel_size_t); |
6 | #undef __memmove | ||
4 | extern void *__memmove(void *, const void *, __kernel_size_t); | 7 | extern void *__memmove(void *, const void *, __kernel_size_t); |
8 | #undef memset | ||
5 | extern void *memset(void *, int, __kernel_size_t); | 9 | extern void *memset(void *, int, __kernel_size_t); |
10 | #undef memcpy | ||
6 | extern void *memcpy(void *, const void *, __kernel_size_t); | 11 | extern void *memcpy(void *, const void *, __kernel_size_t); |
12 | #undef memmove | ||
7 | extern void *memmove(void *, const void *, __kernel_size_t); | 13 | extern void *memmove(void *, const void *, __kernel_size_t); |
diff --git a/include/dt-bindings/mfd/tps65217.h b/include/dt-bindings/mfd/tps65217.h deleted file mode 100644 index cafb9e60cf12..000000000000 --- a/include/dt-bindings/mfd/tps65217.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * This header provides macros for TI TPS65217 DT bindings. | ||
3 | * | ||
4 | * Copyright (C) 2016 Texas Instruments | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along with | ||
16 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #ifndef __DT_BINDINGS_TPS65217_H__ | ||
20 | #define __DT_BINDINGS_TPS65217_H__ | ||
21 | |||
22 | #define TPS65217_IRQ_USB 0 | ||
23 | #define TPS65217_IRQ_AC 1 | ||
24 | #define TPS65217_IRQ_PB 2 | ||
25 | |||
26 | #endif | ||
diff --git a/include/linux/dax.h b/include/linux/dax.h index f97bcfe79472..24ad71173995 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h | |||
@@ -41,6 +41,9 @@ ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
41 | int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | 41 | int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, |
42 | struct iomap_ops *ops); | 42 | struct iomap_ops *ops); |
43 | int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); | 43 | int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); |
44 | int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index); | ||
45 | int dax_invalidate_mapping_entry_sync(struct address_space *mapping, | ||
46 | pgoff_t index); | ||
44 | void dax_wake_mapping_entry_waiter(struct address_space *mapping, | 47 | void dax_wake_mapping_entry_waiter(struct address_space *mapping, |
45 | pgoff_t index, void *entry, bool wake_all); | 48 | pgoff_t index, void *entry, bool wake_all); |
46 | 49 | ||
diff --git a/include/linux/filter.h b/include/linux/filter.h index 702314253797..a0934e6c9bab 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -610,7 +610,6 @@ bool bpf_helper_changes_pkt_data(void *func); | |||
610 | struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, | 610 | struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, |
611 | const struct bpf_insn *patch, u32 len); | 611 | const struct bpf_insn *patch, u32 len); |
612 | void bpf_warn_invalid_xdp_action(u32 act); | 612 | void bpf_warn_invalid_xdp_action(u32 act); |
613 | void bpf_warn_invalid_xdp_buffer(void); | ||
614 | 613 | ||
615 | #ifdef CONFIG_BPF_JIT | 614 | #ifdef CONFIG_BPF_JIT |
616 | extern int bpf_jit_enable; | 615 | extern int bpf_jit_enable; |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 0cf34d6cc253..487246546ebe 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -323,8 +323,6 @@ extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(str | |||
323 | extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode); | 323 | extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode); |
324 | /* find (and take a reference) to a mark associated with group and vfsmount */ | 324 | /* find (and take a reference) to a mark associated with group and vfsmount */ |
325 | extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt); | 325 | extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt); |
326 | /* copy the values from old into new */ | ||
327 | extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old); | ||
328 | /* set the ignored_mask of a mark */ | 326 | /* set the ignored_mask of a mark */ |
329 | extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask); | 327 | extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask); |
330 | /* set the mask of a mark (might pin the object into memory */ | 328 | /* set the mask of a mark (might pin the object into memory */ |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index e0341af6950e..76f39754e7b0 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -146,15 +146,6 @@ enum { | |||
146 | DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */ | 146 | DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */ |
147 | }; | 147 | }; |
148 | 148 | ||
149 | #define BLK_SCSI_MAX_CMDS (256) | ||
150 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | ||
151 | |||
152 | struct blk_scsi_cmd_filter { | ||
153 | unsigned long read_ok[BLK_SCSI_CMD_PER_LONG]; | ||
154 | unsigned long write_ok[BLK_SCSI_CMD_PER_LONG]; | ||
155 | struct kobject kobj; | ||
156 | }; | ||
157 | |||
158 | struct disk_part_tbl { | 149 | struct disk_part_tbl { |
159 | struct rcu_head rcu_head; | 150 | struct rcu_head rcu_head; |
160 | int len; | 151 | int len; |
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 228bd44efa4c..497f2b3a5a62 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
@@ -116,6 +116,16 @@ struct st_sensor_bdu { | |||
116 | }; | 116 | }; |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * struct st_sensor_das - ST sensor device data alignment selection | ||
120 | * @addr: address of the register. | ||
121 | * @mask: mask to write the das flag for left alignment. | ||
122 | */ | ||
123 | struct st_sensor_das { | ||
124 | u8 addr; | ||
125 | u8 mask; | ||
126 | }; | ||
127 | |||
128 | /** | ||
119 | * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt | 129 | * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt |
120 | * @addr: address of the register. | 130 | * @addr: address of the register. |
121 | * @mask_int1: mask to enable/disable IRQ on INT1 pin. | 131 | * @mask_int1: mask to enable/disable IRQ on INT1 pin. |
@@ -185,6 +195,7 @@ struct st_sensor_transfer_function { | |||
185 | * @enable_axis: Enable one or more axis of the sensor. | 195 | * @enable_axis: Enable one or more axis of the sensor. |
186 | * @fs: Full scale register and full scale list available. | 196 | * @fs: Full scale register and full scale list available. |
187 | * @bdu: Block data update register. | 197 | * @bdu: Block data update register. |
198 | * @das: Data Alignment Selection register. | ||
188 | * @drdy_irq: Data ready register of the sensor. | 199 | * @drdy_irq: Data ready register of the sensor. |
189 | * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read. | 200 | * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read. |
190 | * @bootime: samples to discard when sensor passing from power-down to power-up. | 201 | * @bootime: samples to discard when sensor passing from power-down to power-up. |
@@ -200,6 +211,7 @@ struct st_sensor_settings { | |||
200 | struct st_sensor_axis enable_axis; | 211 | struct st_sensor_axis enable_axis; |
201 | struct st_sensor_fullscale fs; | 212 | struct st_sensor_fullscale fs; |
202 | struct st_sensor_bdu bdu; | 213 | struct st_sensor_bdu bdu; |
214 | struct st_sensor_das das; | ||
203 | struct st_sensor_data_ready_irq drdy_irq; | 215 | struct st_sensor_data_ready_irq drdy_irq; |
204 | bool multi_read_bit; | 216 | bool multi_read_bit; |
205 | unsigned int bootime; | 217 | unsigned int bootime; |
diff --git a/include/linux/mdev.h b/include/linux/mdev.h index ec819e9a115a..b6e048e1045f 100644 --- a/include/linux/mdev.h +++ b/include/linux/mdev.h | |||
@@ -13,34 +13,10 @@ | |||
13 | #ifndef MDEV_H | 13 | #ifndef MDEV_H |
14 | #define MDEV_H | 14 | #define MDEV_H |
15 | 15 | ||
16 | /* Parent device */ | 16 | struct mdev_device; |
17 | struct parent_device { | ||
18 | struct device *dev; | ||
19 | const struct parent_ops *ops; | ||
20 | |||
21 | /* internal */ | ||
22 | struct kref ref; | ||
23 | struct mutex lock; | ||
24 | struct list_head next; | ||
25 | struct kset *mdev_types_kset; | ||
26 | struct list_head type_list; | ||
27 | }; | ||
28 | |||
29 | /* Mediated device */ | ||
30 | struct mdev_device { | ||
31 | struct device dev; | ||
32 | struct parent_device *parent; | ||
33 | uuid_le uuid; | ||
34 | void *driver_data; | ||
35 | |||
36 | /* internal */ | ||
37 | struct kref ref; | ||
38 | struct list_head next; | ||
39 | struct kobject *type_kobj; | ||
40 | }; | ||
41 | 17 | ||
42 | /** | 18 | /** |
43 | * struct parent_ops - Structure to be registered for each parent device to | 19 | * struct mdev_parent_ops - Structure to be registered for each parent device to |
44 | * register the device to mdev module. | 20 | * register the device to mdev module. |
45 | * | 21 | * |
46 | * @owner: The module owner. | 22 | * @owner: The module owner. |
@@ -86,10 +62,9 @@ struct mdev_device { | |||
86 | * @mdev: mediated device structure | 62 | * @mdev: mediated device structure |
87 | * @vma: vma structure | 63 | * @vma: vma structure |
88 | * Parent device that support mediated device should be registered with mdev | 64 | * Parent device that support mediated device should be registered with mdev |
89 | * module with parent_ops structure. | 65 | * module with mdev_parent_ops structure. |
90 | **/ | 66 | **/ |
91 | 67 | struct mdev_parent_ops { | |
92 | struct parent_ops { | ||
93 | struct module *owner; | 68 | struct module *owner; |
94 | const struct attribute_group **dev_attr_groups; | 69 | const struct attribute_group **dev_attr_groups; |
95 | const struct attribute_group **mdev_attr_groups; | 70 | const struct attribute_group **mdev_attr_groups; |
@@ -103,7 +78,7 @@ struct parent_ops { | |||
103 | size_t count, loff_t *ppos); | 78 | size_t count, loff_t *ppos); |
104 | ssize_t (*write)(struct mdev_device *mdev, const char __user *buf, | 79 | ssize_t (*write)(struct mdev_device *mdev, const char __user *buf, |
105 | size_t count, loff_t *ppos); | 80 | size_t count, loff_t *ppos); |
106 | ssize_t (*ioctl)(struct mdev_device *mdev, unsigned int cmd, | 81 | long (*ioctl)(struct mdev_device *mdev, unsigned int cmd, |
107 | unsigned long arg); | 82 | unsigned long arg); |
108 | int (*mmap)(struct mdev_device *mdev, struct vm_area_struct *vma); | 83 | int (*mmap)(struct mdev_device *mdev, struct vm_area_struct *vma); |
109 | }; | 84 | }; |
@@ -142,27 +117,22 @@ struct mdev_driver { | |||
142 | }; | 117 | }; |
143 | 118 | ||
144 | #define to_mdev_driver(drv) container_of(drv, struct mdev_driver, driver) | 119 | #define to_mdev_driver(drv) container_of(drv, struct mdev_driver, driver) |
145 | #define to_mdev_device(dev) container_of(dev, struct mdev_device, dev) | ||
146 | |||
147 | static inline void *mdev_get_drvdata(struct mdev_device *mdev) | ||
148 | { | ||
149 | return mdev->driver_data; | ||
150 | } | ||
151 | 120 | ||
152 | static inline void mdev_set_drvdata(struct mdev_device *mdev, void *data) | 121 | extern void *mdev_get_drvdata(struct mdev_device *mdev); |
153 | { | 122 | extern void mdev_set_drvdata(struct mdev_device *mdev, void *data); |
154 | mdev->driver_data = data; | 123 | extern uuid_le mdev_uuid(struct mdev_device *mdev); |
155 | } | ||
156 | 124 | ||
157 | extern struct bus_type mdev_bus_type; | 125 | extern struct bus_type mdev_bus_type; |
158 | 126 | ||
159 | #define dev_is_mdev(d) ((d)->bus == &mdev_bus_type) | ||
160 | |||
161 | extern int mdev_register_device(struct device *dev, | 127 | extern int mdev_register_device(struct device *dev, |
162 | const struct parent_ops *ops); | 128 | const struct mdev_parent_ops *ops); |
163 | extern void mdev_unregister_device(struct device *dev); | 129 | extern void mdev_unregister_device(struct device *dev); |
164 | 130 | ||
165 | extern int mdev_register_driver(struct mdev_driver *drv, struct module *owner); | 131 | extern int mdev_register_driver(struct mdev_driver *drv, struct module *owner); |
166 | extern void mdev_unregister_driver(struct mdev_driver *drv); | 132 | extern void mdev_unregister_driver(struct mdev_driver *drv); |
167 | 133 | ||
134 | extern struct device *mdev_parent_dev(struct mdev_device *mdev); | ||
135 | extern struct device *mdev_dev(struct mdev_device *mdev); | ||
136 | extern struct mdev_device *mdev_from_dev(struct device *dev); | ||
137 | |||
168 | #endif /* MDEV_H */ | 138 | #endif /* MDEV_H */ |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 93bdb3485192..6533c16e27ad 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -1384,6 +1384,8 @@ int set_phv_bit(struct mlx4_dev *dev, u8 port, int new_val); | |||
1384 | int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv); | 1384 | int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv); |
1385 | int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port, | 1385 | int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port, |
1386 | bool *vlan_offload_disabled); | 1386 | bool *vlan_offload_disabled); |
1387 | void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl, | ||
1388 | struct _rule_hw *eth_header); | ||
1387 | int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); | 1389 | int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); |
1388 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); | 1390 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); |
1389 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); | 1391 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 9f489365b3d3..52b437431c6a 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -1071,11 +1071,6 @@ enum { | |||
1071 | MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20, | 1071 | MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20, |
1072 | }; | 1072 | }; |
1073 | 1073 | ||
1074 | enum { | ||
1075 | MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP = 0x0, | ||
1076 | MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP = 0x2, | ||
1077 | }; | ||
1078 | |||
1079 | static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz) | 1074 | static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz) |
1080 | { | 1075 | { |
1081 | if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE) | 1076 | if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE) |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 0ae55361e674..735b36335f29 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
@@ -123,7 +123,6 @@ enum { | |||
123 | MLX5_REG_HOST_ENDIANNESS = 0x7004, | 123 | MLX5_REG_HOST_ENDIANNESS = 0x7004, |
124 | MLX5_REG_MCIA = 0x9014, | 124 | MLX5_REG_MCIA = 0x9014, |
125 | MLX5_REG_MLCR = 0x902b, | 125 | MLX5_REG_MLCR = 0x902b, |
126 | MLX5_REG_MPCNT = 0x9051, | ||
127 | }; | 126 | }; |
128 | 127 | ||
129 | enum mlx5_dcbx_oper_mode { | 128 | enum mlx5_dcbx_oper_mode { |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 57bec544e20a..a852e9db6f0d 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -1757,80 +1757,6 @@ struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits { | |||
1757 | u8 reserved_at_4c0[0x300]; | 1757 | u8 reserved_at_4c0[0x300]; |
1758 | }; | 1758 | }; |
1759 | 1759 | ||
1760 | struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits { | ||
1761 | u8 life_time_counter_high[0x20]; | ||
1762 | |||
1763 | u8 life_time_counter_low[0x20]; | ||
1764 | |||
1765 | u8 rx_errors[0x20]; | ||
1766 | |||
1767 | u8 tx_errors[0x20]; | ||
1768 | |||
1769 | u8 l0_to_recovery_eieos[0x20]; | ||
1770 | |||
1771 | u8 l0_to_recovery_ts[0x20]; | ||
1772 | |||
1773 | u8 l0_to_recovery_framing[0x20]; | ||
1774 | |||
1775 | u8 l0_to_recovery_retrain[0x20]; | ||
1776 | |||
1777 | u8 crc_error_dllp[0x20]; | ||
1778 | |||
1779 | u8 crc_error_tlp[0x20]; | ||
1780 | |||
1781 | u8 reserved_at_140[0x680]; | ||
1782 | }; | ||
1783 | |||
1784 | struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits { | ||
1785 | u8 life_time_counter_high[0x20]; | ||
1786 | |||
1787 | u8 life_time_counter_low[0x20]; | ||
1788 | |||
1789 | u8 time_to_boot_image_start[0x20]; | ||
1790 | |||
1791 | u8 time_to_link_image[0x20]; | ||
1792 | |||
1793 | u8 calibration_time[0x20]; | ||
1794 | |||
1795 | u8 time_to_first_perst[0x20]; | ||
1796 | |||
1797 | u8 time_to_detect_state[0x20]; | ||
1798 | |||
1799 | u8 time_to_l0[0x20]; | ||
1800 | |||
1801 | u8 time_to_crs_en[0x20]; | ||
1802 | |||
1803 | u8 time_to_plastic_image_start[0x20]; | ||
1804 | |||
1805 | u8 time_to_iron_image_start[0x20]; | ||
1806 | |||
1807 | u8 perst_handler[0x20]; | ||
1808 | |||
1809 | u8 times_in_l1[0x20]; | ||
1810 | |||
1811 | u8 times_in_l23[0x20]; | ||
1812 | |||
1813 | u8 dl_down[0x20]; | ||
1814 | |||
1815 | u8 config_cycle1usec[0x20]; | ||
1816 | |||
1817 | u8 config_cycle2to7usec[0x20]; | ||
1818 | |||
1819 | u8 config_cycle_8to15usec[0x20]; | ||
1820 | |||
1821 | u8 config_cycle_16_to_63usec[0x20]; | ||
1822 | |||
1823 | u8 config_cycle_64usec[0x20]; | ||
1824 | |||
1825 | u8 correctable_err_msg_sent[0x20]; | ||
1826 | |||
1827 | u8 non_fatal_err_msg_sent[0x20]; | ||
1828 | |||
1829 | u8 fatal_err_msg_sent[0x20]; | ||
1830 | |||
1831 | u8 reserved_at_2e0[0x4e0]; | ||
1832 | }; | ||
1833 | |||
1834 | struct mlx5_ifc_cmd_inter_comp_event_bits { | 1760 | struct mlx5_ifc_cmd_inter_comp_event_bits { |
1835 | u8 command_completion_vector[0x20]; | 1761 | u8 command_completion_vector[0x20]; |
1836 | 1762 | ||
@@ -2995,12 +2921,6 @@ union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits { | |||
2995 | u8 reserved_at_0[0x7c0]; | 2921 | u8 reserved_at_0[0x7c0]; |
2996 | }; | 2922 | }; |
2997 | 2923 | ||
2998 | union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits { | ||
2999 | struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits pcie_perf_cntrs_grp_data_layout; | ||
3000 | struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits pcie_tas_cntrs_grp_data_layout; | ||
3001 | u8 reserved_at_0[0x7c0]; | ||
3002 | }; | ||
3003 | |||
3004 | union mlx5_ifc_event_auto_bits { | 2924 | union mlx5_ifc_event_auto_bits { |
3005 | struct mlx5_ifc_comp_event_bits comp_event; | 2925 | struct mlx5_ifc_comp_event_bits comp_event; |
3006 | struct mlx5_ifc_dct_events_bits dct_events; | 2926 | struct mlx5_ifc_dct_events_bits dct_events; |
@@ -7320,18 +7240,6 @@ struct mlx5_ifc_ppcnt_reg_bits { | |||
7320 | union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; | 7240 | union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; |
7321 | }; | 7241 | }; |
7322 | 7242 | ||
7323 | struct mlx5_ifc_mpcnt_reg_bits { | ||
7324 | u8 reserved_at_0[0x8]; | ||
7325 | u8 pcie_index[0x8]; | ||
7326 | u8 reserved_at_10[0xa]; | ||
7327 | u8 grp[0x6]; | ||
7328 | |||
7329 | u8 clr[0x1]; | ||
7330 | u8 reserved_at_21[0x1f]; | ||
7331 | |||
7332 | union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits counter_set; | ||
7333 | }; | ||
7334 | |||
7335 | struct mlx5_ifc_ppad_reg_bits { | 7243 | struct mlx5_ifc_ppad_reg_bits { |
7336 | u8 reserved_at_0[0x3]; | 7244 | u8 reserved_at_0[0x3]; |
7337 | u8 single_mac[0x1]; | 7245 | u8 single_mac[0x1]; |
@@ -7937,7 +7845,6 @@ union mlx5_ifc_ports_control_registers_document_bits { | |||
7937 | struct mlx5_ifc_pmtu_reg_bits pmtu_reg; | 7845 | struct mlx5_ifc_pmtu_reg_bits pmtu_reg; |
7938 | struct mlx5_ifc_ppad_reg_bits ppad_reg; | 7846 | struct mlx5_ifc_ppad_reg_bits ppad_reg; |
7939 | struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg; | 7847 | struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg; |
7940 | struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg; | ||
7941 | struct mlx5_ifc_pplm_reg_bits pplm_reg; | 7848 | struct mlx5_ifc_pplm_reg_bits pplm_reg; |
7942 | struct mlx5_ifc_pplr_reg_bits pplr_reg; | 7849 | struct mlx5_ifc_pplr_reg_bits pplr_reg; |
7943 | struct mlx5_ifc_ppsc_reg_bits ppsc_reg; | 7850 | struct mlx5_ifc_ppsc_reg_bits ppsc_reg; |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index c56b39890a41..6b5818d6de32 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -73,13 +73,13 @@ | |||
73 | */ | 73 | */ |
74 | enum pageflags { | 74 | enum pageflags { |
75 | PG_locked, /* Page is locked. Don't touch. */ | 75 | PG_locked, /* Page is locked. Don't touch. */ |
76 | PG_waiters, /* Page has waiters, check its waitqueue */ | ||
77 | PG_error, | 76 | PG_error, |
78 | PG_referenced, | 77 | PG_referenced, |
79 | PG_uptodate, | 78 | PG_uptodate, |
80 | PG_dirty, | 79 | PG_dirty, |
81 | PG_lru, | 80 | PG_lru, |
82 | PG_active, | 81 | PG_active, |
82 | PG_waiters, /* Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked" */ | ||
83 | PG_slab, | 83 | PG_slab, |
84 | PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/ | 84 | PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/ |
85 | PG_arch_1, | 85 | PG_arch_1, |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 5dea8f6440e4..52bda854593b 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -306,7 +306,9 @@ void radix_tree_iter_replace(struct radix_tree_root *, | |||
306 | void radix_tree_replace_slot(struct radix_tree_root *root, | 306 | void radix_tree_replace_slot(struct radix_tree_root *root, |
307 | void **slot, void *item); | 307 | void **slot, void *item); |
308 | void __radix_tree_delete_node(struct radix_tree_root *root, | 308 | void __radix_tree_delete_node(struct radix_tree_root *root, |
309 | struct radix_tree_node *node); | 309 | struct radix_tree_node *node, |
310 | radix_tree_update_node_t update_node, | ||
311 | void *private); | ||
310 | void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *); | 312 | void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *); |
311 | void *radix_tree_delete(struct radix_tree_root *, unsigned long); | 313 | void *radix_tree_delete(struct radix_tree_root *, unsigned long); |
312 | void radix_tree_clear_tags(struct radix_tree_root *root, | 314 | void radix_tree_clear_tags(struct radix_tree_root *root, |
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 183f37c8a5e1..4ee479f2f355 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h | |||
@@ -9,7 +9,13 @@ struct device; | |||
9 | struct page; | 9 | struct page; |
10 | struct scatterlist; | 10 | struct scatterlist; |
11 | 11 | ||
12 | extern int swiotlb_force; | 12 | enum swiotlb_force { |
13 | SWIOTLB_NORMAL, /* Default - depending on HW DMA mask etc. */ | ||
14 | SWIOTLB_FORCE, /* swiotlb=force */ | ||
15 | SWIOTLB_NO_FORCE, /* swiotlb=noforce */ | ||
16 | }; | ||
17 | |||
18 | extern enum swiotlb_force swiotlb_force; | ||
13 | 19 | ||
14 | /* | 20 | /* |
15 | * Maximum allowable number of contiguous slabs to map, | 21 | * Maximum allowable number of contiguous slabs to map, |
@@ -108,11 +114,14 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask); | |||
108 | 114 | ||
109 | #ifdef CONFIG_SWIOTLB | 115 | #ifdef CONFIG_SWIOTLB |
110 | extern void __init swiotlb_free(void); | 116 | extern void __init swiotlb_free(void); |
117 | unsigned int swiotlb_max_segment(void); | ||
111 | #else | 118 | #else |
112 | static inline void swiotlb_free(void) { } | 119 | static inline void swiotlb_free(void) { } |
120 | static inline unsigned int swiotlb_max_segment(void) { return 0; } | ||
113 | #endif | 121 | #endif |
114 | 122 | ||
115 | extern void swiotlb_print_info(void); | 123 | extern void swiotlb_print_info(void); |
116 | extern int is_swiotlb_buffer(phys_addr_t paddr); | 124 | extern int is_swiotlb_buffer(phys_addr_t paddr); |
125 | extern void swiotlb_set_max_segment(unsigned int); | ||
117 | 126 | ||
118 | #endif /* __LINUX_SWIOTLB_H */ | 127 | #endif /* __LINUX_SWIOTLB_H */ |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index f0cf5a1b777e..0378e88f6fd3 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -110,6 +110,7 @@ struct netns_ipv4 { | |||
110 | int sysctl_tcp_orphan_retries; | 110 | int sysctl_tcp_orphan_retries; |
111 | int sysctl_tcp_fin_timeout; | 111 | int sysctl_tcp_fin_timeout; |
112 | unsigned int sysctl_tcp_notsent_lowat; | 112 | unsigned int sysctl_tcp_notsent_lowat; |
113 | int sysctl_tcp_tw_reuse; | ||
113 | 114 | ||
114 | int sysctl_igmp_max_memberships; | 115 | int sysctl_igmp_max_memberships; |
115 | int sysctl_igmp_max_msf; | 116 | int sysctl_igmp_max_msf; |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 207147b4c6b2..6061963cca98 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -252,7 +252,6 @@ extern int sysctl_tcp_wmem[3]; | |||
252 | extern int sysctl_tcp_rmem[3]; | 252 | extern int sysctl_tcp_rmem[3]; |
253 | extern int sysctl_tcp_app_win; | 253 | extern int sysctl_tcp_app_win; |
254 | extern int sysctl_tcp_adv_win_scale; | 254 | extern int sysctl_tcp_adv_win_scale; |
255 | extern int sysctl_tcp_tw_reuse; | ||
256 | extern int sysctl_tcp_frto; | 255 | extern int sysctl_tcp_frto; |
257 | extern int sysctl_tcp_low_latency; | 256 | extern int sysctl_tcp_low_latency; |
258 | extern int sysctl_tcp_nometrics_save; | 257 | extern int sysctl_tcp_nometrics_save; |
diff --git a/include/trace/events/swiotlb.h b/include/trace/events/swiotlb.h index 7ea4c5e7c448..288c0c54a2b4 100644 --- a/include/trace/events/swiotlb.h +++ b/include/trace/events/swiotlb.h | |||
@@ -11,16 +11,16 @@ TRACE_EVENT(swiotlb_bounced, | |||
11 | TP_PROTO(struct device *dev, | 11 | TP_PROTO(struct device *dev, |
12 | dma_addr_t dev_addr, | 12 | dma_addr_t dev_addr, |
13 | size_t size, | 13 | size_t size, |
14 | int swiotlb_force), | 14 | enum swiotlb_force swiotlb_force), |
15 | 15 | ||
16 | TP_ARGS(dev, dev_addr, size, swiotlb_force), | 16 | TP_ARGS(dev, dev_addr, size, swiotlb_force), |
17 | 17 | ||
18 | TP_STRUCT__entry( | 18 | TP_STRUCT__entry( |
19 | __string( dev_name, dev_name(dev) ) | 19 | __string( dev_name, dev_name(dev) ) |
20 | __field( u64, dma_mask ) | 20 | __field( u64, dma_mask ) |
21 | __field( dma_addr_t, dev_addr ) | 21 | __field( dma_addr_t, dev_addr ) |
22 | __field( size_t, size ) | 22 | __field( size_t, size ) |
23 | __field( int, swiotlb_force ) | 23 | __field( enum swiotlb_force, swiotlb_force ) |
24 | ), | 24 | ), |
25 | 25 | ||
26 | TP_fast_assign( | 26 | TP_fast_assign( |
@@ -37,7 +37,10 @@ TRACE_EVENT(swiotlb_bounced, | |||
37 | __entry->dma_mask, | 37 | __entry->dma_mask, |
38 | (unsigned long long)__entry->dev_addr, | 38 | (unsigned long long)__entry->dev_addr, |
39 | __entry->size, | 39 | __entry->size, |
40 | __entry->swiotlb_force ? "swiotlb_force" : "" ) | 40 | __print_symbolic(__entry->swiotlb_force, |
41 | { SWIOTLB_NORMAL, "NORMAL" }, | ||
42 | { SWIOTLB_FORCE, "FORCE" }, | ||
43 | { SWIOTLB_NO_FORCE, "NO_FORCE" })) | ||
41 | ); | 44 | ); |
42 | 45 | ||
43 | #endif /* _TRACE_SWIOTLB_H */ | 46 | #endif /* _TRACE_SWIOTLB_H */ |
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h index acc63697a0cc..b2a31a55a612 100644 --- a/include/uapi/linux/usb/functionfs.h +++ b/include/uapi/linux/usb/functionfs.h | |||
@@ -93,6 +93,7 @@ struct usb_ext_prop_desc { | |||
93 | * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2 | | 93 | * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2 | |
94 | * | 4 | length | LE32 | length of the whole data chunk | | 94 | * | 4 | length | LE32 | length of the whole data chunk | |
95 | * | 8 | flags | LE32 | combination of functionfs_flags | | 95 | * | 8 | flags | LE32 | combination of functionfs_flags | |
96 | * | | eventfd | LE32 | eventfd file descriptor | | ||
96 | * | | fs_count | LE32 | number of full-speed descriptors | | 97 | * | | fs_count | LE32 | number of full-speed descriptors | |
97 | * | | hs_count | LE32 | number of high-speed descriptors | | 98 | * | | hs_count | LE32 | number of high-speed descriptors | |
98 | * | | ss_count | LE32 | number of super-speed descriptors | | 99 | * | | ss_count | LE32 | number of super-speed descriptors | |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 8b1dde96a0fa..7b44195da81b 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -231,9 +231,11 @@ static void untag_chunk(struct node *p) | |||
231 | if (size) | 231 | if (size) |
232 | new = alloc_chunk(size); | 232 | new = alloc_chunk(size); |
233 | 233 | ||
234 | mutex_lock(&entry->group->mark_mutex); | ||
234 | spin_lock(&entry->lock); | 235 | spin_lock(&entry->lock); |
235 | if (chunk->dead || !entry->inode) { | 236 | if (chunk->dead || !entry->inode) { |
236 | spin_unlock(&entry->lock); | 237 | spin_unlock(&entry->lock); |
238 | mutex_unlock(&entry->group->mark_mutex); | ||
237 | if (new) | 239 | if (new) |
238 | free_chunk(new); | 240 | free_chunk(new); |
239 | goto out; | 241 | goto out; |
@@ -251,6 +253,7 @@ static void untag_chunk(struct node *p) | |||
251 | list_del_rcu(&chunk->hash); | 253 | list_del_rcu(&chunk->hash); |
252 | spin_unlock(&hash_lock); | 254 | spin_unlock(&hash_lock); |
253 | spin_unlock(&entry->lock); | 255 | spin_unlock(&entry->lock); |
256 | mutex_unlock(&entry->group->mark_mutex); | ||
254 | fsnotify_destroy_mark(entry, audit_tree_group); | 257 | fsnotify_destroy_mark(entry, audit_tree_group); |
255 | goto out; | 258 | goto out; |
256 | } | 259 | } |
@@ -258,8 +261,8 @@ static void untag_chunk(struct node *p) | |||
258 | if (!new) | 261 | if (!new) |
259 | goto Fallback; | 262 | goto Fallback; |
260 | 263 | ||
261 | fsnotify_duplicate_mark(&new->mark, entry); | 264 | if (fsnotify_add_mark_locked(&new->mark, entry->group, entry->inode, |
262 | if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.inode, NULL, 1)) { | 265 | NULL, 1)) { |
263 | fsnotify_put_mark(&new->mark); | 266 | fsnotify_put_mark(&new->mark); |
264 | goto Fallback; | 267 | goto Fallback; |
265 | } | 268 | } |
@@ -293,6 +296,7 @@ static void untag_chunk(struct node *p) | |||
293 | owner->root = new; | 296 | owner->root = new; |
294 | spin_unlock(&hash_lock); | 297 | spin_unlock(&hash_lock); |
295 | spin_unlock(&entry->lock); | 298 | spin_unlock(&entry->lock); |
299 | mutex_unlock(&entry->group->mark_mutex); | ||
296 | fsnotify_destroy_mark(entry, audit_tree_group); | 300 | fsnotify_destroy_mark(entry, audit_tree_group); |
297 | fsnotify_put_mark(&new->mark); /* drop initial reference */ | 301 | fsnotify_put_mark(&new->mark); /* drop initial reference */ |
298 | goto out; | 302 | goto out; |
@@ -309,6 +313,7 @@ Fallback: | |||
309 | put_tree(owner); | 313 | put_tree(owner); |
310 | spin_unlock(&hash_lock); | 314 | spin_unlock(&hash_lock); |
311 | spin_unlock(&entry->lock); | 315 | spin_unlock(&entry->lock); |
316 | mutex_unlock(&entry->group->mark_mutex); | ||
312 | out: | 317 | out: |
313 | fsnotify_put_mark(entry); | 318 | fsnotify_put_mark(entry); |
314 | spin_lock(&hash_lock); | 319 | spin_lock(&hash_lock); |
@@ -386,18 +391,21 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
386 | 391 | ||
387 | chunk_entry = &chunk->mark; | 392 | chunk_entry = &chunk->mark; |
388 | 393 | ||
394 | mutex_lock(&old_entry->group->mark_mutex); | ||
389 | spin_lock(&old_entry->lock); | 395 | spin_lock(&old_entry->lock); |
390 | if (!old_entry->inode) { | 396 | if (!old_entry->inode) { |
391 | /* old_entry is being shot, lets just lie */ | 397 | /* old_entry is being shot, lets just lie */ |
392 | spin_unlock(&old_entry->lock); | 398 | spin_unlock(&old_entry->lock); |
399 | mutex_unlock(&old_entry->group->mark_mutex); | ||
393 | fsnotify_put_mark(old_entry); | 400 | fsnotify_put_mark(old_entry); |
394 | free_chunk(chunk); | 401 | free_chunk(chunk); |
395 | return -ENOENT; | 402 | return -ENOENT; |
396 | } | 403 | } |
397 | 404 | ||
398 | fsnotify_duplicate_mark(chunk_entry, old_entry); | 405 | if (fsnotify_add_mark_locked(chunk_entry, old_entry->group, |
399 | if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->inode, NULL, 1)) { | 406 | old_entry->inode, NULL, 1)) { |
400 | spin_unlock(&old_entry->lock); | 407 | spin_unlock(&old_entry->lock); |
408 | mutex_unlock(&old_entry->group->mark_mutex); | ||
401 | fsnotify_put_mark(chunk_entry); | 409 | fsnotify_put_mark(chunk_entry); |
402 | fsnotify_put_mark(old_entry); | 410 | fsnotify_put_mark(old_entry); |
403 | return -ENOSPC; | 411 | return -ENOSPC; |
@@ -413,6 +421,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
413 | chunk->dead = 1; | 421 | chunk->dead = 1; |
414 | spin_unlock(&chunk_entry->lock); | 422 | spin_unlock(&chunk_entry->lock); |
415 | spin_unlock(&old_entry->lock); | 423 | spin_unlock(&old_entry->lock); |
424 | mutex_unlock(&old_entry->group->mark_mutex); | ||
416 | 425 | ||
417 | fsnotify_destroy_mark(chunk_entry, audit_tree_group); | 426 | fsnotify_destroy_mark(chunk_entry, audit_tree_group); |
418 | 427 | ||
@@ -445,6 +454,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
445 | spin_unlock(&hash_lock); | 454 | spin_unlock(&hash_lock); |
446 | spin_unlock(&chunk_entry->lock); | 455 | spin_unlock(&chunk_entry->lock); |
447 | spin_unlock(&old_entry->lock); | 456 | spin_unlock(&old_entry->lock); |
457 | mutex_unlock(&old_entry->group->mark_mutex); | ||
448 | fsnotify_destroy_mark(old_entry, audit_tree_group); | 458 | fsnotify_destroy_mark(old_entry, audit_tree_group); |
449 | fsnotify_put_mark(chunk_entry); /* drop initial reference */ | 459 | fsnotify_put_mark(chunk_entry); /* drop initial reference */ |
450 | fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */ | 460 | fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */ |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 042fd7e8e030..f75c4d031eeb 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -1471,6 +1471,7 @@ int __cpuhp_setup_state(enum cpuhp_state state, | |||
1471 | bool multi_instance) | 1471 | bool multi_instance) |
1472 | { | 1472 | { |
1473 | int cpu, ret = 0; | 1473 | int cpu, ret = 0; |
1474 | bool dynstate; | ||
1474 | 1475 | ||
1475 | if (cpuhp_cb_check(state) || !name) | 1476 | if (cpuhp_cb_check(state) || !name) |
1476 | return -EINVAL; | 1477 | return -EINVAL; |
@@ -1480,6 +1481,12 @@ int __cpuhp_setup_state(enum cpuhp_state state, | |||
1480 | ret = cpuhp_store_callbacks(state, name, startup, teardown, | 1481 | ret = cpuhp_store_callbacks(state, name, startup, teardown, |
1481 | multi_instance); | 1482 | multi_instance); |
1482 | 1483 | ||
1484 | dynstate = state == CPUHP_AP_ONLINE_DYN; | ||
1485 | if (ret > 0 && dynstate) { | ||
1486 | state = ret; | ||
1487 | ret = 0; | ||
1488 | } | ||
1489 | |||
1483 | if (ret || !invoke || !startup) | 1490 | if (ret || !invoke || !startup) |
1484 | goto out; | 1491 | goto out; |
1485 | 1492 | ||
@@ -1508,7 +1515,7 @@ out: | |||
1508 | * If the requested state is CPUHP_AP_ONLINE_DYN, return the | 1515 | * If the requested state is CPUHP_AP_ONLINE_DYN, return the |
1509 | * dynamically allocated state in case of success. | 1516 | * dynamically allocated state in case of success. |
1510 | */ | 1517 | */ |
1511 | if (!ret && state == CPUHP_AP_ONLINE_DYN) | 1518 | if (!ret && dynstate) |
1512 | return state; | 1519 | return state; |
1513 | return ret; | 1520 | return ret; |
1514 | } | 1521 | } |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 6f382e07de77..0b92d605fb69 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -640,6 +640,7 @@ static inline void radix_tree_shrink(struct radix_tree_root *root, | |||
640 | update_node(node, private); | 640 | update_node(node, private); |
641 | } | 641 | } |
642 | 642 | ||
643 | WARN_ON_ONCE(!list_empty(&node->private_list)); | ||
643 | radix_tree_node_free(node); | 644 | radix_tree_node_free(node); |
644 | } | 645 | } |
645 | } | 646 | } |
@@ -666,6 +667,7 @@ static void delete_node(struct radix_tree_root *root, | |||
666 | root->rnode = NULL; | 667 | root->rnode = NULL; |
667 | } | 668 | } |
668 | 669 | ||
670 | WARN_ON_ONCE(!list_empty(&node->private_list)); | ||
669 | radix_tree_node_free(node); | 671 | radix_tree_node_free(node); |
670 | 672 | ||
671 | node = parent; | 673 | node = parent; |
@@ -767,6 +769,7 @@ static void radix_tree_free_nodes(struct radix_tree_node *node) | |||
767 | struct radix_tree_node *old = child; | 769 | struct radix_tree_node *old = child; |
768 | offset = child->offset + 1; | 770 | offset = child->offset + 1; |
769 | child = child->parent; | 771 | child = child->parent; |
772 | WARN_ON_ONCE(!list_empty(&node->private_list)); | ||
770 | radix_tree_node_free(old); | 773 | radix_tree_node_free(old); |
771 | if (old == entry_to_node(node)) | 774 | if (old == entry_to_node(node)) |
772 | return; | 775 | return; |
@@ -1824,15 +1827,19 @@ EXPORT_SYMBOL(radix_tree_gang_lookup_tag_slot); | |||
1824 | * __radix_tree_delete_node - try to free node after clearing a slot | 1827 | * __radix_tree_delete_node - try to free node after clearing a slot |
1825 | * @root: radix tree root | 1828 | * @root: radix tree root |
1826 | * @node: node containing @index | 1829 | * @node: node containing @index |
1830 | * @update_node: callback for changing leaf nodes | ||
1831 | * @private: private data to pass to @update_node | ||
1827 | * | 1832 | * |
1828 | * After clearing the slot at @index in @node from radix tree | 1833 | * After clearing the slot at @index in @node from radix tree |
1829 | * rooted at @root, call this function to attempt freeing the | 1834 | * rooted at @root, call this function to attempt freeing the |
1830 | * node and shrinking the tree. | 1835 | * node and shrinking the tree. |
1831 | */ | 1836 | */ |
1832 | void __radix_tree_delete_node(struct radix_tree_root *root, | 1837 | void __radix_tree_delete_node(struct radix_tree_root *root, |
1833 | struct radix_tree_node *node) | 1838 | struct radix_tree_node *node, |
1839 | radix_tree_update_node_t update_node, | ||
1840 | void *private) | ||
1834 | { | 1841 | { |
1835 | delete_node(root, node, NULL, NULL); | 1842 | delete_node(root, node, update_node, private); |
1836 | } | 1843 | } |
1837 | 1844 | ||
1838 | /** | 1845 | /** |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index cb1b54ee8527..975b8fc4f1e1 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -53,7 +53,7 @@ | |||
53 | */ | 53 | */ |
54 | #define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT) | 54 | #define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT) |
55 | 55 | ||
56 | int swiotlb_force; | 56 | enum swiotlb_force swiotlb_force; |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Used to do a quick range check in swiotlb_tbl_unmap_single and | 59 | * Used to do a quick range check in swiotlb_tbl_unmap_single and |
@@ -83,6 +83,12 @@ static unsigned int *io_tlb_list; | |||
83 | static unsigned int io_tlb_index; | 83 | static unsigned int io_tlb_index; |
84 | 84 | ||
85 | /* | 85 | /* |
86 | * Max segment that we can provide which (if pages are contingous) will | ||
87 | * not be bounced (unless SWIOTLB_FORCE is set). | ||
88 | */ | ||
89 | unsigned int max_segment; | ||
90 | |||
91 | /* | ||
86 | * We need to save away the original address corresponding to a mapped entry | 92 | * We need to save away the original address corresponding to a mapped entry |
87 | * for the sync operations. | 93 | * for the sync operations. |
88 | */ | 94 | */ |
@@ -106,8 +112,12 @@ setup_io_tlb_npages(char *str) | |||
106 | } | 112 | } |
107 | if (*str == ',') | 113 | if (*str == ',') |
108 | ++str; | 114 | ++str; |
109 | if (!strcmp(str, "force")) | 115 | if (!strcmp(str, "force")) { |
110 | swiotlb_force = 1; | 116 | swiotlb_force = SWIOTLB_FORCE; |
117 | } else if (!strcmp(str, "noforce")) { | ||
118 | swiotlb_force = SWIOTLB_NO_FORCE; | ||
119 | io_tlb_nslabs = 1; | ||
120 | } | ||
111 | 121 | ||
112 | return 0; | 122 | return 0; |
113 | } | 123 | } |
@@ -120,6 +130,20 @@ unsigned long swiotlb_nr_tbl(void) | |||
120 | } | 130 | } |
121 | EXPORT_SYMBOL_GPL(swiotlb_nr_tbl); | 131 | EXPORT_SYMBOL_GPL(swiotlb_nr_tbl); |
122 | 132 | ||
133 | unsigned int swiotlb_max_segment(void) | ||
134 | { | ||
135 | return max_segment; | ||
136 | } | ||
137 | EXPORT_SYMBOL_GPL(swiotlb_max_segment); | ||
138 | |||
139 | void swiotlb_set_max_segment(unsigned int val) | ||
140 | { | ||
141 | if (swiotlb_force == SWIOTLB_FORCE) | ||
142 | max_segment = 1; | ||
143 | else | ||
144 | max_segment = rounddown(val, PAGE_SIZE); | ||
145 | } | ||
146 | |||
123 | /* default to 64MB */ | 147 | /* default to 64MB */ |
124 | #define IO_TLB_DEFAULT_SIZE (64UL<<20) | 148 | #define IO_TLB_DEFAULT_SIZE (64UL<<20) |
125 | unsigned long swiotlb_size_or_default(void) | 149 | unsigned long swiotlb_size_or_default(void) |
@@ -201,6 +225,7 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) | |||
201 | if (verbose) | 225 | if (verbose) |
202 | swiotlb_print_info(); | 226 | swiotlb_print_info(); |
203 | 227 | ||
228 | swiotlb_set_max_segment(io_tlb_nslabs << IO_TLB_SHIFT); | ||
204 | return 0; | 229 | return 0; |
205 | } | 230 | } |
206 | 231 | ||
@@ -279,6 +304,7 @@ swiotlb_late_init_with_default_size(size_t default_size) | |||
279 | rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs); | 304 | rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs); |
280 | if (rc) | 305 | if (rc) |
281 | free_pages((unsigned long)vstart, order); | 306 | free_pages((unsigned long)vstart, order); |
307 | |||
282 | return rc; | 308 | return rc; |
283 | } | 309 | } |
284 | 310 | ||
@@ -333,6 +359,8 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | |||
333 | 359 | ||
334 | late_alloc = 1; | 360 | late_alloc = 1; |
335 | 361 | ||
362 | swiotlb_set_max_segment(io_tlb_nslabs << IO_TLB_SHIFT); | ||
363 | |||
336 | return 0; | 364 | return 0; |
337 | 365 | ||
338 | cleanup4: | 366 | cleanup4: |
@@ -347,6 +375,7 @@ cleanup2: | |||
347 | io_tlb_end = 0; | 375 | io_tlb_end = 0; |
348 | io_tlb_start = 0; | 376 | io_tlb_start = 0; |
349 | io_tlb_nslabs = 0; | 377 | io_tlb_nslabs = 0; |
378 | max_segment = 0; | ||
350 | return -ENOMEM; | 379 | return -ENOMEM; |
351 | } | 380 | } |
352 | 381 | ||
@@ -375,6 +404,7 @@ void __init swiotlb_free(void) | |||
375 | PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT)); | 404 | PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT)); |
376 | } | 405 | } |
377 | io_tlb_nslabs = 0; | 406 | io_tlb_nslabs = 0; |
407 | max_segment = 0; | ||
378 | } | 408 | } |
379 | 409 | ||
380 | int is_swiotlb_buffer(phys_addr_t paddr) | 410 | int is_swiotlb_buffer(phys_addr_t paddr) |
@@ -543,8 +573,15 @@ static phys_addr_t | |||
543 | map_single(struct device *hwdev, phys_addr_t phys, size_t size, | 573 | map_single(struct device *hwdev, phys_addr_t phys, size_t size, |
544 | enum dma_data_direction dir, unsigned long attrs) | 574 | enum dma_data_direction dir, unsigned long attrs) |
545 | { | 575 | { |
546 | dma_addr_t start_dma_addr = phys_to_dma(hwdev, io_tlb_start); | 576 | dma_addr_t start_dma_addr; |
547 | 577 | ||
578 | if (swiotlb_force == SWIOTLB_NO_FORCE) { | ||
579 | dev_warn_ratelimited(hwdev, "Cannot do DMA to address %pa\n", | ||
580 | &phys); | ||
581 | return SWIOTLB_MAP_ERROR; | ||
582 | } | ||
583 | |||
584 | start_dma_addr = phys_to_dma(hwdev, io_tlb_start); | ||
548 | return swiotlb_tbl_map_single(hwdev, start_dma_addr, phys, size, | 585 | return swiotlb_tbl_map_single(hwdev, start_dma_addr, phys, size, |
549 | dir, attrs); | 586 | dir, attrs); |
550 | } | 587 | } |
@@ -721,6 +758,9 @@ static void | |||
721 | swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, | 758 | swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, |
722 | int do_panic) | 759 | int do_panic) |
723 | { | 760 | { |
761 | if (swiotlb_force == SWIOTLB_NO_FORCE) | ||
762 | return; | ||
763 | |||
724 | /* | 764 | /* |
725 | * Ran out of IOMMU space for this operation. This is very bad. | 765 | * Ran out of IOMMU space for this operation. This is very bad. |
726 | * Unfortunately the drivers cannot handle this operation properly. | 766 | * Unfortunately the drivers cannot handle this operation properly. |
@@ -763,7 +803,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, | |||
763 | * we can safely return the device addr and not worry about bounce | 803 | * we can safely return the device addr and not worry about bounce |
764 | * buffering it. | 804 | * buffering it. |
765 | */ | 805 | */ |
766 | if (dma_capable(dev, dev_addr, size) && !swiotlb_force) | 806 | if (dma_capable(dev, dev_addr, size) && swiotlb_force != SWIOTLB_FORCE) |
767 | return dev_addr; | 807 | return dev_addr; |
768 | 808 | ||
769 | trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force); | 809 | trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force); |
@@ -904,7 +944,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, | |||
904 | phys_addr_t paddr = sg_phys(sg); | 944 | phys_addr_t paddr = sg_phys(sg); |
905 | dma_addr_t dev_addr = phys_to_dma(hwdev, paddr); | 945 | dma_addr_t dev_addr = phys_to_dma(hwdev, paddr); |
906 | 946 | ||
907 | if (swiotlb_force || | 947 | if (swiotlb_force == SWIOTLB_FORCE || |
908 | !dma_capable(hwdev, dev_addr, sg->length)) { | 948 | !dma_capable(hwdev, dev_addr, sg->length)) { |
909 | phys_addr_t map = map_single(hwdev, sg_phys(sg), | 949 | phys_addr_t map = map_single(hwdev, sg_phys(sg), |
910 | sg->length, dir, attrs); | 950 | sg->length, dir, attrs); |
diff --git a/mm/filemap.c b/mm/filemap.c index 82f26cde830c..d0e4d1002059 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -912,6 +912,29 @@ void add_page_wait_queue(struct page *page, wait_queue_t *waiter) | |||
912 | } | 912 | } |
913 | EXPORT_SYMBOL_GPL(add_page_wait_queue); | 913 | EXPORT_SYMBOL_GPL(add_page_wait_queue); |
914 | 914 | ||
915 | #ifndef clear_bit_unlock_is_negative_byte | ||
916 | |||
917 | /* | ||
918 | * PG_waiters is the high bit in the same byte as PG_lock. | ||
919 | * | ||
920 | * On x86 (and on many other architectures), we can clear PG_lock and | ||
921 | * test the sign bit at the same time. But if the architecture does | ||
922 | * not support that special operation, we just do this all by hand | ||
923 | * instead. | ||
924 | * | ||
925 | * The read of PG_waiters has to be after (or concurrently with) PG_locked | ||
926 | * being cleared, but a memory barrier should be unneccssary since it is | ||
927 | * in the same byte as PG_locked. | ||
928 | */ | ||
929 | static inline bool clear_bit_unlock_is_negative_byte(long nr, volatile void *mem) | ||
930 | { | ||
931 | clear_bit_unlock(nr, mem); | ||
932 | /* smp_mb__after_atomic(); */ | ||
933 | return test_bit(PG_waiters, mem); | ||
934 | } | ||
935 | |||
936 | #endif | ||
937 | |||
915 | /** | 938 | /** |
916 | * unlock_page - unlock a locked page | 939 | * unlock_page - unlock a locked page |
917 | * @page: the page | 940 | * @page: the page |
@@ -921,16 +944,19 @@ EXPORT_SYMBOL_GPL(add_page_wait_queue); | |||
921 | * mechanism between PageLocked pages and PageWriteback pages is shared. | 944 | * mechanism between PageLocked pages and PageWriteback pages is shared. |
922 | * But that's OK - sleepers in wait_on_page_writeback() just go back to sleep. | 945 | * But that's OK - sleepers in wait_on_page_writeback() just go back to sleep. |
923 | * | 946 | * |
924 | * The mb is necessary to enforce ordering between the clear_bit and the read | 947 | * Note that this depends on PG_waiters being the sign bit in the byte |
925 | * of the waitqueue (to avoid SMP races with a parallel wait_on_page_locked()). | 948 | * that contains PG_locked - thus the BUILD_BUG_ON(). That allows us to |
949 | * clear the PG_locked bit and test PG_waiters at the same time fairly | ||
950 | * portably (architectures that do LL/SC can test any bit, while x86 can | ||
951 | * test the sign bit). | ||
926 | */ | 952 | */ |
927 | void unlock_page(struct page *page) | 953 | void unlock_page(struct page *page) |
928 | { | 954 | { |
955 | BUILD_BUG_ON(PG_waiters != 7); | ||
929 | page = compound_head(page); | 956 | page = compound_head(page); |
930 | VM_BUG_ON_PAGE(!PageLocked(page), page); | 957 | VM_BUG_ON_PAGE(!PageLocked(page), page); |
931 | clear_bit_unlock(PG_locked, &page->flags); | 958 | if (clear_bit_unlock_is_negative_byte(PG_locked, &page->flags)) |
932 | smp_mb__after_atomic(); | 959 | wake_up_page_bit(page, PG_locked); |
933 | wake_up_page(page, PG_locked); | ||
934 | } | 960 | } |
935 | EXPORT_SYMBOL(unlock_page); | 961 | EXPORT_SYMBOL(unlock_page); |
936 | 962 | ||
diff --git a/mm/memory.c b/mm/memory.c index 7d23b5050248..9f2c15cdb32c 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3008,13 +3008,6 @@ static int do_set_pmd(struct vm_fault *vmf, struct page *page) | |||
3008 | ret = 0; | 3008 | ret = 0; |
3009 | count_vm_event(THP_FILE_MAPPED); | 3009 | count_vm_event(THP_FILE_MAPPED); |
3010 | out: | 3010 | out: |
3011 | /* | ||
3012 | * If we are going to fallback to pte mapping, do a | ||
3013 | * withdraw with pmd lock held. | ||
3014 | */ | ||
3015 | if (arch_needs_pgtable_deposit() && ret == VM_FAULT_FALLBACK) | ||
3016 | vmf->prealloc_pte = pgtable_trans_huge_withdraw(vma->vm_mm, | ||
3017 | vmf->pmd); | ||
3018 | spin_unlock(vmf->ptl); | 3011 | spin_unlock(vmf->ptl); |
3019 | return ret; | 3012 | return ret; |
3020 | } | 3013 | } |
@@ -3055,20 +3048,18 @@ int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg, | |||
3055 | 3048 | ||
3056 | ret = do_set_pmd(vmf, page); | 3049 | ret = do_set_pmd(vmf, page); |
3057 | if (ret != VM_FAULT_FALLBACK) | 3050 | if (ret != VM_FAULT_FALLBACK) |
3058 | goto fault_handled; | 3051 | return ret; |
3059 | } | 3052 | } |
3060 | 3053 | ||
3061 | if (!vmf->pte) { | 3054 | if (!vmf->pte) { |
3062 | ret = pte_alloc_one_map(vmf); | 3055 | ret = pte_alloc_one_map(vmf); |
3063 | if (ret) | 3056 | if (ret) |
3064 | goto fault_handled; | 3057 | return ret; |
3065 | } | 3058 | } |
3066 | 3059 | ||
3067 | /* Re-check under ptl */ | 3060 | /* Re-check under ptl */ |
3068 | if (unlikely(!pte_none(*vmf->pte))) { | 3061 | if (unlikely(!pte_none(*vmf->pte))) |
3069 | ret = VM_FAULT_NOPAGE; | 3062 | return VM_FAULT_NOPAGE; |
3070 | goto fault_handled; | ||
3071 | } | ||
3072 | 3063 | ||
3073 | flush_icache_page(vma, page); | 3064 | flush_icache_page(vma, page); |
3074 | entry = mk_pte(page, vma->vm_page_prot); | 3065 | entry = mk_pte(page, vma->vm_page_prot); |
@@ -3088,15 +3079,8 @@ int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg, | |||
3088 | 3079 | ||
3089 | /* no need to invalidate: a not-present page won't be cached */ | 3080 | /* no need to invalidate: a not-present page won't be cached */ |
3090 | update_mmu_cache(vma, vmf->address, vmf->pte); | 3081 | update_mmu_cache(vma, vmf->address, vmf->pte); |
3091 | ret = 0; | ||
3092 | 3082 | ||
3093 | fault_handled: | 3083 | return 0; |
3094 | /* preallocated pagetable is unused: free it */ | ||
3095 | if (vmf->prealloc_pte) { | ||
3096 | pte_free(vmf->vma->vm_mm, vmf->prealloc_pte); | ||
3097 | vmf->prealloc_pte = 0; | ||
3098 | } | ||
3099 | return ret; | ||
3100 | } | 3084 | } |
3101 | 3085 | ||
3102 | 3086 | ||
@@ -3360,15 +3344,24 @@ static int do_shared_fault(struct vm_fault *vmf) | |||
3360 | static int do_fault(struct vm_fault *vmf) | 3344 | static int do_fault(struct vm_fault *vmf) |
3361 | { | 3345 | { |
3362 | struct vm_area_struct *vma = vmf->vma; | 3346 | struct vm_area_struct *vma = vmf->vma; |
3347 | int ret; | ||
3363 | 3348 | ||
3364 | /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ | 3349 | /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ |
3365 | if (!vma->vm_ops->fault) | 3350 | if (!vma->vm_ops->fault) |
3366 | return VM_FAULT_SIGBUS; | 3351 | ret = VM_FAULT_SIGBUS; |
3367 | if (!(vmf->flags & FAULT_FLAG_WRITE)) | 3352 | else if (!(vmf->flags & FAULT_FLAG_WRITE)) |
3368 | return do_read_fault(vmf); | 3353 | ret = do_read_fault(vmf); |
3369 | if (!(vma->vm_flags & VM_SHARED)) | 3354 | else if (!(vma->vm_flags & VM_SHARED)) |
3370 | return do_cow_fault(vmf); | 3355 | ret = do_cow_fault(vmf); |
3371 | return do_shared_fault(vmf); | 3356 | else |
3357 | ret = do_shared_fault(vmf); | ||
3358 | |||
3359 | /* preallocated pagetable is unused: free it */ | ||
3360 | if (vmf->prealloc_pte) { | ||
3361 | pte_free(vma->vm_mm, vmf->prealloc_pte); | ||
3362 | vmf->prealloc_pte = 0; | ||
3363 | } | ||
3364 | return ret; | ||
3372 | } | 3365 | } |
3373 | 3366 | ||
3374 | static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, | 3367 | static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, |
diff --git a/mm/truncate.c b/mm/truncate.c index fd97f1dbce29..dd7b24e083c5 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -24,20 +24,12 @@ | |||
24 | #include <linux/rmap.h> | 24 | #include <linux/rmap.h> |
25 | #include "internal.h" | 25 | #include "internal.h" |
26 | 26 | ||
27 | static void clear_exceptional_entry(struct address_space *mapping, | 27 | static void clear_shadow_entry(struct address_space *mapping, pgoff_t index, |
28 | pgoff_t index, void *entry) | 28 | void *entry) |
29 | { | 29 | { |
30 | struct radix_tree_node *node; | 30 | struct radix_tree_node *node; |
31 | void **slot; | 31 | void **slot; |
32 | 32 | ||
33 | /* Handled by shmem itself */ | ||
34 | if (shmem_mapping(mapping)) | ||
35 | return; | ||
36 | |||
37 | if (dax_mapping(mapping)) { | ||
38 | dax_delete_mapping_entry(mapping, index); | ||
39 | return; | ||
40 | } | ||
41 | spin_lock_irq(&mapping->tree_lock); | 33 | spin_lock_irq(&mapping->tree_lock); |
42 | /* | 34 | /* |
43 | * Regular page slots are stabilized by the page lock even | 35 | * Regular page slots are stabilized by the page lock even |
@@ -55,6 +47,56 @@ unlock: | |||
55 | spin_unlock_irq(&mapping->tree_lock); | 47 | spin_unlock_irq(&mapping->tree_lock); |
56 | } | 48 | } |
57 | 49 | ||
50 | /* | ||
51 | * Unconditionally remove exceptional entry. Usually called from truncate path. | ||
52 | */ | ||
53 | static void truncate_exceptional_entry(struct address_space *mapping, | ||
54 | pgoff_t index, void *entry) | ||
55 | { | ||
56 | /* Handled by shmem itself */ | ||
57 | if (shmem_mapping(mapping)) | ||
58 | return; | ||
59 | |||
60 | if (dax_mapping(mapping)) { | ||
61 | dax_delete_mapping_entry(mapping, index); | ||
62 | return; | ||
63 | } | ||
64 | clear_shadow_entry(mapping, index, entry); | ||
65 | } | ||
66 | |||
67 | /* | ||
68 | * Invalidate exceptional entry if easily possible. This handles exceptional | ||
69 | * entries for invalidate_inode_pages() so for DAX it evicts only unlocked and | ||
70 | * clean entries. | ||
71 | */ | ||
72 | static int invalidate_exceptional_entry(struct address_space *mapping, | ||
73 | pgoff_t index, void *entry) | ||
74 | { | ||
75 | /* Handled by shmem itself */ | ||
76 | if (shmem_mapping(mapping)) | ||
77 | return 1; | ||
78 | if (dax_mapping(mapping)) | ||
79 | return dax_invalidate_mapping_entry(mapping, index); | ||
80 | clear_shadow_entry(mapping, index, entry); | ||
81 | return 1; | ||
82 | } | ||
83 | |||
84 | /* | ||
85 | * Invalidate exceptional entry if clean. This handles exceptional entries for | ||
86 | * invalidate_inode_pages2() so for DAX it evicts only clean entries. | ||
87 | */ | ||
88 | static int invalidate_exceptional_entry2(struct address_space *mapping, | ||
89 | pgoff_t index, void *entry) | ||
90 | { | ||
91 | /* Handled by shmem itself */ | ||
92 | if (shmem_mapping(mapping)) | ||
93 | return 1; | ||
94 | if (dax_mapping(mapping)) | ||
95 | return dax_invalidate_mapping_entry_sync(mapping, index); | ||
96 | clear_shadow_entry(mapping, index, entry); | ||
97 | return 1; | ||
98 | } | ||
99 | |||
58 | /** | 100 | /** |
59 | * do_invalidatepage - invalidate part or all of a page | 101 | * do_invalidatepage - invalidate part or all of a page |
60 | * @page: the page which is affected | 102 | * @page: the page which is affected |
@@ -262,7 +304,8 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
262 | break; | 304 | break; |
263 | 305 | ||
264 | if (radix_tree_exceptional_entry(page)) { | 306 | if (radix_tree_exceptional_entry(page)) { |
265 | clear_exceptional_entry(mapping, index, page); | 307 | truncate_exceptional_entry(mapping, index, |
308 | page); | ||
266 | continue; | 309 | continue; |
267 | } | 310 | } |
268 | 311 | ||
@@ -351,7 +394,8 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
351 | } | 394 | } |
352 | 395 | ||
353 | if (radix_tree_exceptional_entry(page)) { | 396 | if (radix_tree_exceptional_entry(page)) { |
354 | clear_exceptional_entry(mapping, index, page); | 397 | truncate_exceptional_entry(mapping, index, |
398 | page); | ||
355 | continue; | 399 | continue; |
356 | } | 400 | } |
357 | 401 | ||
@@ -470,7 +514,8 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, | |||
470 | break; | 514 | break; |
471 | 515 | ||
472 | if (radix_tree_exceptional_entry(page)) { | 516 | if (radix_tree_exceptional_entry(page)) { |
473 | clear_exceptional_entry(mapping, index, page); | 517 | invalidate_exceptional_entry(mapping, index, |
518 | page); | ||
474 | continue; | 519 | continue; |
475 | } | 520 | } |
476 | 521 | ||
@@ -592,7 +637,9 @@ int invalidate_inode_pages2_range(struct address_space *mapping, | |||
592 | break; | 637 | break; |
593 | 638 | ||
594 | if (radix_tree_exceptional_entry(page)) { | 639 | if (radix_tree_exceptional_entry(page)) { |
595 | clear_exceptional_entry(mapping, index, page); | 640 | if (!invalidate_exceptional_entry2(mapping, |
641 | index, page)) | ||
642 | ret = -EBUSY; | ||
596 | continue; | 643 | continue; |
597 | } | 644 | } |
598 | 645 | ||
diff --git a/mm/workingset.c b/mm/workingset.c index 241fa5d6b3b2..abb58ffa3c64 100644 --- a/mm/workingset.c +++ b/mm/workingset.c | |||
@@ -473,7 +473,8 @@ static enum lru_status shadow_lru_isolate(struct list_head *item, | |||
473 | if (WARN_ON_ONCE(node->exceptional)) | 473 | if (WARN_ON_ONCE(node->exceptional)) |
474 | goto out_invalid; | 474 | goto out_invalid; |
475 | inc_node_state(page_pgdat(virt_to_page(node)), WORKINGSET_NODERECLAIM); | 475 | inc_node_state(page_pgdat(virt_to_page(node)), WORKINGSET_NODERECLAIM); |
476 | __radix_tree_delete_node(&mapping->page_tree, node); | 476 | __radix_tree_delete_node(&mapping->page_tree, node, |
477 | workingset_update_node, mapping); | ||
477 | 478 | ||
478 | out_invalid: | 479 | out_invalid: |
479 | spin_unlock(&mapping->tree_lock); | 480 | spin_unlock(&mapping->tree_lock); |
diff --git a/net/atm/lec.c b/net/atm/lec.c index 019557d0a11d..09cfe87f0a44 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -1059,7 +1059,9 @@ static void __exit lane_module_cleanup(void) | |||
1059 | { | 1059 | { |
1060 | int i; | 1060 | int i; |
1061 | 1061 | ||
1062 | #ifdef CONFIG_PROC_FS | ||
1062 | remove_proc_entry("lec", atm_proc_root); | 1063 | remove_proc_entry("lec", atm_proc_root); |
1064 | #endif | ||
1063 | 1065 | ||
1064 | deregister_atm_ioctl(&lane_ioctl_ops); | 1066 | deregister_atm_ioctl(&lane_ioctl_ops); |
1065 | 1067 | ||
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 8e0c0635ee97..fb55327dcfea 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -75,6 +75,7 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
75 | struct nlattr *nla; | 75 | struct nlattr *nla; |
76 | struct sk_buff *skb; | 76 | struct sk_buff *skb; |
77 | unsigned long flags; | 77 | unsigned long flags; |
78 | void *msg_header; | ||
78 | 79 | ||
79 | al = sizeof(struct net_dm_alert_msg); | 80 | al = sizeof(struct net_dm_alert_msg); |
80 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); | 81 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); |
@@ -82,21 +83,41 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
82 | 83 | ||
83 | skb = genlmsg_new(al, GFP_KERNEL); | 84 | skb = genlmsg_new(al, GFP_KERNEL); |
84 | 85 | ||
85 | if (skb) { | 86 | if (!skb) |
86 | genlmsg_put(skb, 0, 0, &net_drop_monitor_family, | 87 | goto err; |
87 | 0, NET_DM_CMD_ALERT); | 88 | |
88 | nla = nla_reserve(skb, NLA_UNSPEC, | 89 | msg_header = genlmsg_put(skb, 0, 0, &net_drop_monitor_family, |
89 | sizeof(struct net_dm_alert_msg)); | 90 | 0, NET_DM_CMD_ALERT); |
90 | msg = nla_data(nla); | 91 | if (!msg_header) { |
91 | memset(msg, 0, al); | 92 | nlmsg_free(skb); |
92 | } else { | 93 | skb = NULL; |
93 | mod_timer(&data->send_timer, jiffies + HZ / 10); | 94 | goto err; |
95 | } | ||
96 | nla = nla_reserve(skb, NLA_UNSPEC, | ||
97 | sizeof(struct net_dm_alert_msg)); | ||
98 | if (!nla) { | ||
99 | nlmsg_free(skb); | ||
100 | skb = NULL; | ||
101 | goto err; | ||
94 | } | 102 | } |
103 | msg = nla_data(nla); | ||
104 | memset(msg, 0, al); | ||
105 | goto out; | ||
95 | 106 | ||
107 | err: | ||
108 | mod_timer(&data->send_timer, jiffies + HZ / 10); | ||
109 | out: | ||
96 | spin_lock_irqsave(&data->lock, flags); | 110 | spin_lock_irqsave(&data->lock, flags); |
97 | swap(data->skb, skb); | 111 | swap(data->skb, skb); |
98 | spin_unlock_irqrestore(&data->lock, flags); | 112 | spin_unlock_irqrestore(&data->lock, flags); |
99 | 113 | ||
114 | if (skb) { | ||
115 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data; | ||
116 | struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh); | ||
117 | |||
118 | genlmsg_end(skb, genlmsg_data(gnlh)); | ||
119 | } | ||
120 | |||
100 | return skb; | 121 | return skb; |
101 | } | 122 | } |
102 | 123 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index e6c412b94dec..1969b3f118c1 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -2972,12 +2972,6 @@ void bpf_warn_invalid_xdp_action(u32 act) | |||
2972 | } | 2972 | } |
2973 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); | 2973 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); |
2974 | 2974 | ||
2975 | void bpf_warn_invalid_xdp_buffer(void) | ||
2976 | { | ||
2977 | WARN_ONCE(1, "Illegal XDP buffer encountered, expect throughput degradation\n"); | ||
2978 | } | ||
2979 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_buffer); | ||
2980 | |||
2981 | static u32 sk_filter_convert_ctx_access(enum bpf_access_type type, int dst_reg, | 2975 | static u32 sk_filter_convert_ctx_access(enum bpf_access_type type, int dst_reg, |
2982 | int src_reg, int ctx_off, | 2976 | int src_reg, int ctx_off, |
2983 | struct bpf_insn *insn_buf, | 2977 | struct bpf_insn *insn_buf, |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index d6447dc10371..fe4e1531976c 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -468,8 +468,9 @@ ip_proto_again: | |||
468 | if (hdr->flags & GRE_ACK) | 468 | if (hdr->flags & GRE_ACK) |
469 | offset += sizeof(((struct pptp_gre_header *)0)->ack); | 469 | offset += sizeof(((struct pptp_gre_header *)0)->ack); |
470 | 470 | ||
471 | ppp_hdr = skb_header_pointer(skb, nhoff + offset, | 471 | ppp_hdr = __skb_header_pointer(skb, nhoff + offset, |
472 | sizeof(_ppp_hdr), _ppp_hdr); | 472 | sizeof(_ppp_hdr), |
473 | data, hlen, _ppp_hdr); | ||
473 | if (!ppp_hdr) | 474 | if (!ppp_hdr) |
474 | goto out_bad; | 475 | goto out_bad; |
475 | 476 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 18b5aae99bec..75e3ea7bda08 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -3898,6 +3898,9 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
3898 | u32 filter_mask; | 3898 | u32 filter_mask; |
3899 | int err; | 3899 | int err; |
3900 | 3900 | ||
3901 | if (nlmsg_len(nlh) < sizeof(*ifsm)) | ||
3902 | return -EINVAL; | ||
3903 | |||
3901 | ifsm = nlmsg_data(nlh); | 3904 | ifsm = nlmsg_data(nlh); |
3902 | if (ifsm->ifindex > 0) | 3905 | if (ifsm->ifindex > 0) |
3903 | dev = __dev_get_by_index(net, ifsm->ifindex); | 3906 | dev = __dev_get_by_index(net, ifsm->ifindex); |
@@ -3947,6 +3950,9 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
3947 | 3950 | ||
3948 | cb->seq = net->dev_base_seq; | 3951 | cb->seq = net->dev_base_seq; |
3949 | 3952 | ||
3953 | if (nlmsg_len(cb->nlh) < sizeof(*ifsm)) | ||
3954 | return -EINVAL; | ||
3955 | |||
3950 | ifsm = nlmsg_data(cb->nlh); | 3956 | ifsm = nlmsg_data(cb->nlh); |
3951 | filter_mask = ifsm->filter_mask; | 3957 | filter_mask = ifsm->filter_mask; |
3952 | if (!filter_mask) | 3958 | if (!filter_mask) |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3ff8938893ec..eae0332b0e8c 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -85,7 +85,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id) | |||
85 | if (tb) | 85 | if (tb) |
86 | return tb; | 86 | return tb; |
87 | 87 | ||
88 | if (id == RT_TABLE_LOCAL) | 88 | if (id == RT_TABLE_LOCAL && !net->ipv4.fib_has_custom_rules) |
89 | alias = fib_new_table(net, RT_TABLE_MAIN); | 89 | alias = fib_new_table(net, RT_TABLE_MAIN); |
90 | 90 | ||
91 | tb = fib_trie_table(id, alias); | 91 | tb = fib_trie_table(id, alias); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 68d622133f53..5b15459955f8 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -219,9 +219,14 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay) | |||
219 | static void igmp_gq_start_timer(struct in_device *in_dev) | 219 | static void igmp_gq_start_timer(struct in_device *in_dev) |
220 | { | 220 | { |
221 | int tv = prandom_u32() % in_dev->mr_maxdelay; | 221 | int tv = prandom_u32() % in_dev->mr_maxdelay; |
222 | unsigned long exp = jiffies + tv + 2; | ||
223 | |||
224 | if (in_dev->mr_gq_running && | ||
225 | time_after_eq(exp, (in_dev->mr_gq_timer).expires)) | ||
226 | return; | ||
222 | 227 | ||
223 | in_dev->mr_gq_running = 1; | 228 | in_dev->mr_gq_running = 1; |
224 | if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) | 229 | if (!mod_timer(&in_dev->mr_gq_timer, exp)) |
225 | in_dev_hold(in_dev); | 230 | in_dev_hold(in_dev); |
226 | } | 231 | } |
227 | 232 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 57e1405e8282..53ae0c6315ad 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1225,8 +1225,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) | |||
1225 | * which has interface index (iif) as the first member of the | 1225 | * which has interface index (iif) as the first member of the |
1226 | * underlying inet{6}_skb_parm struct. This code then overlays | 1226 | * underlying inet{6}_skb_parm struct. This code then overlays |
1227 | * PKTINFO_SKB_CB and in_pktinfo also has iif as the first | 1227 | * PKTINFO_SKB_CB and in_pktinfo also has iif as the first |
1228 | * element so the iif is picked up from the prior IPCB | 1228 | * element so the iif is picked up from the prior IPCB. If iif |
1229 | * is the loopback interface, then return the sending interface | ||
1230 | * (e.g., process binds socket to eth0 for Tx which is | ||
1231 | * redirected to loopback in the rtable/dst). | ||
1229 | */ | 1232 | */ |
1233 | if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX) | ||
1234 | pktinfo->ipi_ifindex = inet_iif(skb); | ||
1235 | |||
1230 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); | 1236 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); |
1231 | } else { | 1237 | } else { |
1232 | pktinfo->ipi_ifindex = 0; | 1238 | pktinfo->ipi_ifindex = 0; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a82a11747b3f..0fcac8e7a2b2 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1914,7 +1914,8 @@ local_input: | |||
1914 | } | 1914 | } |
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type, | 1917 | rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev, |
1918 | flags | RTCF_LOCAL, res.type, | ||
1918 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); | 1919 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); |
1919 | if (!rth) | 1920 | if (!rth) |
1920 | goto e_nobufs; | 1921 | goto e_nobufs; |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 80bc36b25de2..22cbd61079b5 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -433,13 +433,6 @@ static struct ctl_table ipv4_table[] = { | |||
433 | .extra2 = &tcp_adv_win_scale_max, | 433 | .extra2 = &tcp_adv_win_scale_max, |
434 | }, | 434 | }, |
435 | { | 435 | { |
436 | .procname = "tcp_tw_reuse", | ||
437 | .data = &sysctl_tcp_tw_reuse, | ||
438 | .maxlen = sizeof(int), | ||
439 | .mode = 0644, | ||
440 | .proc_handler = proc_dointvec | ||
441 | }, | ||
442 | { | ||
443 | .procname = "tcp_frto", | 436 | .procname = "tcp_frto", |
444 | .data = &sysctl_tcp_frto, | 437 | .data = &sysctl_tcp_frto, |
445 | .maxlen = sizeof(int), | 438 | .maxlen = sizeof(int), |
@@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = { | |||
960 | .mode = 0644, | 953 | .mode = 0644, |
961 | .proc_handler = proc_dointvec, | 954 | .proc_handler = proc_dointvec, |
962 | }, | 955 | }, |
956 | { | ||
957 | .procname = "tcp_tw_reuse", | ||
958 | .data = &init_net.ipv4.sysctl_tcp_tw_reuse, | ||
959 | .maxlen = sizeof(int), | ||
960 | .mode = 0644, | ||
961 | .proc_handler = proc_dointvec | ||
962 | }, | ||
963 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 963 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
964 | { | 964 | { |
965 | .procname = "fib_multipath_use_neigh", | 965 | .procname = "fib_multipath_use_neigh", |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 30d81f533ada..fe9da4fb96bf 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -84,7 +84,6 @@ | |||
84 | #include <crypto/hash.h> | 84 | #include <crypto/hash.h> |
85 | #include <linux/scatterlist.h> | 85 | #include <linux/scatterlist.h> |
86 | 86 | ||
87 | int sysctl_tcp_tw_reuse __read_mostly; | ||
88 | int sysctl_tcp_low_latency __read_mostly; | 87 | int sysctl_tcp_low_latency __read_mostly; |
89 | 88 | ||
90 | #ifdef CONFIG_TCP_MD5SIG | 89 | #ifdef CONFIG_TCP_MD5SIG |
@@ -120,7 +119,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) | |||
120 | and use initial timestamp retrieved from peer table. | 119 | and use initial timestamp retrieved from peer table. |
121 | */ | 120 | */ |
122 | if (tcptw->tw_ts_recent_stamp && | 121 | if (tcptw->tw_ts_recent_stamp && |
123 | (!twp || (sysctl_tcp_tw_reuse && | 122 | (!twp || (sock_net(sk)->ipv4.sysctl_tcp_tw_reuse && |
124 | get_seconds() - tcptw->tw_ts_recent_stamp > 1))) { | 123 | get_seconds() - tcptw->tw_ts_recent_stamp > 1))) { |
125 | tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; | 124 | tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; |
126 | if (tp->write_seq == 0) | 125 | if (tp->write_seq == 0) |
@@ -2456,6 +2455,7 @@ static int __net_init tcp_sk_init(struct net *net) | |||
2456 | net->ipv4.sysctl_tcp_orphan_retries = 0; | 2455 | net->ipv4.sysctl_tcp_orphan_retries = 0; |
2457 | net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT; | 2456 | net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT; |
2458 | net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; | 2457 | net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; |
2458 | net->ipv4.sysctl_tcp_tw_reuse = 0; | ||
2459 | 2459 | ||
2460 | return 0; | 2460 | return 0; |
2461 | fail: | 2461 | fail: |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 70d0de404197..38122d04fadc 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1373,7 +1373,7 @@ emsgsize: | |||
1373 | */ | 1373 | */ |
1374 | 1374 | ||
1375 | cork->length += length; | 1375 | cork->length += length; |
1376 | if (((length > mtu) || | 1376 | if ((((length + fragheaderlen) > mtu) || |
1377 | (skb && skb_is_gso(skb))) && | 1377 | (skb && skb_is_gso(skb))) && |
1378 | (sk->sk_protocol == IPPROTO_UDP) && | 1378 | (sk->sk_protocol == IPPROTO_UDP) && |
1379 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && | 1379 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 8938b6ba57a0..3d73278b86ca 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -47,7 +47,8 @@ static inline struct l2tp_ip_sock *l2tp_ip_sk(const struct sock *sk) | |||
47 | return (struct l2tp_ip_sock *)sk; | 47 | return (struct l2tp_ip_sock *)sk; |
48 | } | 48 | } |
49 | 49 | ||
50 | static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id) | 50 | static struct sock *__l2tp_ip_bind_lookup(const struct net *net, __be32 laddr, |
51 | __be32 raddr, int dif, u32 tunnel_id) | ||
51 | { | 52 | { |
52 | struct sock *sk; | 53 | struct sock *sk; |
53 | 54 | ||
@@ -61,6 +62,7 @@ static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif | |||
61 | if ((l2tp->conn_id == tunnel_id) && | 62 | if ((l2tp->conn_id == tunnel_id) && |
62 | net_eq(sock_net(sk), net) && | 63 | net_eq(sock_net(sk), net) && |
63 | !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && | 64 | !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && |
65 | (!inet->inet_daddr || !raddr || inet->inet_daddr == raddr) && | ||
64 | (!sk->sk_bound_dev_if || !dif || | 66 | (!sk->sk_bound_dev_if || !dif || |
65 | sk->sk_bound_dev_if == dif)) | 67 | sk->sk_bound_dev_if == dif)) |
66 | goto found; | 68 | goto found; |
@@ -71,15 +73,6 @@ found: | |||
71 | return sk; | 73 | return sk; |
72 | } | 74 | } |
73 | 75 | ||
74 | static inline struct sock *l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id) | ||
75 | { | ||
76 | struct sock *sk = __l2tp_ip_bind_lookup(net, laddr, dif, tunnel_id); | ||
77 | if (sk) | ||
78 | sock_hold(sk); | ||
79 | |||
80 | return sk; | ||
81 | } | ||
82 | |||
83 | /* When processing receive frames, there are two cases to | 76 | /* When processing receive frames, there are two cases to |
84 | * consider. Data frames consist of a non-zero session-id and an | 77 | * consider. Data frames consist of a non-zero session-id and an |
85 | * optional cookie. Control frames consist of a regular L2TP header | 78 | * optional cookie. Control frames consist of a regular L2TP header |
@@ -183,8 +176,8 @@ pass_up: | |||
183 | struct iphdr *iph = (struct iphdr *) skb_network_header(skb); | 176 | struct iphdr *iph = (struct iphdr *) skb_network_header(skb); |
184 | 177 | ||
185 | read_lock_bh(&l2tp_ip_lock); | 178 | read_lock_bh(&l2tp_ip_lock); |
186 | sk = __l2tp_ip_bind_lookup(net, iph->daddr, inet_iif(skb), | 179 | sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr, |
187 | tunnel_id); | 180 | inet_iif(skb), tunnel_id); |
188 | if (!sk) { | 181 | if (!sk) { |
189 | read_unlock_bh(&l2tp_ip_lock); | 182 | read_unlock_bh(&l2tp_ip_lock); |
190 | goto discard; | 183 | goto discard; |
@@ -280,7 +273,7 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
280 | inet->inet_saddr = 0; /* Use device */ | 273 | inet->inet_saddr = 0; /* Use device */ |
281 | 274 | ||
282 | write_lock_bh(&l2tp_ip_lock); | 275 | write_lock_bh(&l2tp_ip_lock); |
283 | if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, | 276 | if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 0, |
284 | sk->sk_bound_dev_if, addr->l2tp_conn_id)) { | 277 | sk->sk_bound_dev_if, addr->l2tp_conn_id)) { |
285 | write_unlock_bh(&l2tp_ip_lock); | 278 | write_unlock_bh(&l2tp_ip_lock); |
286 | ret = -EADDRINUSE; | 279 | ret = -EADDRINUSE; |
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index f092ac441fdd..331ccf5a7bad 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -59,12 +59,14 @@ static inline struct l2tp_ip6_sock *l2tp_ip6_sk(const struct sock *sk) | |||
59 | 59 | ||
60 | static struct sock *__l2tp_ip6_bind_lookup(struct net *net, | 60 | static struct sock *__l2tp_ip6_bind_lookup(struct net *net, |
61 | struct in6_addr *laddr, | 61 | struct in6_addr *laddr, |
62 | const struct in6_addr *raddr, | ||
62 | int dif, u32 tunnel_id) | 63 | int dif, u32 tunnel_id) |
63 | { | 64 | { |
64 | struct sock *sk; | 65 | struct sock *sk; |
65 | 66 | ||
66 | sk_for_each_bound(sk, &l2tp_ip6_bind_table) { | 67 | sk_for_each_bound(sk, &l2tp_ip6_bind_table) { |
67 | const struct in6_addr *addr = inet6_rcv_saddr(sk); | 68 | const struct in6_addr *sk_laddr = inet6_rcv_saddr(sk); |
69 | const struct in6_addr *sk_raddr = &sk->sk_v6_daddr; | ||
68 | struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); | 70 | struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); |
69 | 71 | ||
70 | if (l2tp == NULL) | 72 | if (l2tp == NULL) |
@@ -72,7 +74,8 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, | |||
72 | 74 | ||
73 | if ((l2tp->conn_id == tunnel_id) && | 75 | if ((l2tp->conn_id == tunnel_id) && |
74 | net_eq(sock_net(sk), net) && | 76 | net_eq(sock_net(sk), net) && |
75 | (!addr || ipv6_addr_equal(addr, laddr)) && | 77 | (!sk_laddr || ipv6_addr_any(sk_laddr) || ipv6_addr_equal(sk_laddr, laddr)) && |
78 | (!raddr || ipv6_addr_any(sk_raddr) || ipv6_addr_equal(sk_raddr, raddr)) && | ||
76 | (!sk->sk_bound_dev_if || !dif || | 79 | (!sk->sk_bound_dev_if || !dif || |
77 | sk->sk_bound_dev_if == dif)) | 80 | sk->sk_bound_dev_if == dif)) |
78 | goto found; | 81 | goto found; |
@@ -83,17 +86,6 @@ found: | |||
83 | return sk; | 86 | return sk; |
84 | } | 87 | } |
85 | 88 | ||
86 | static inline struct sock *l2tp_ip6_bind_lookup(struct net *net, | ||
87 | struct in6_addr *laddr, | ||
88 | int dif, u32 tunnel_id) | ||
89 | { | ||
90 | struct sock *sk = __l2tp_ip6_bind_lookup(net, laddr, dif, tunnel_id); | ||
91 | if (sk) | ||
92 | sock_hold(sk); | ||
93 | |||
94 | return sk; | ||
95 | } | ||
96 | |||
97 | /* When processing receive frames, there are two cases to | 89 | /* When processing receive frames, there are two cases to |
98 | * consider. Data frames consist of a non-zero session-id and an | 90 | * consider. Data frames consist of a non-zero session-id and an |
99 | * optional cookie. Control frames consist of a regular L2TP header | 91 | * optional cookie. Control frames consist of a regular L2TP header |
@@ -197,8 +189,8 @@ pass_up: | |||
197 | struct ipv6hdr *iph = ipv6_hdr(skb); | 189 | struct ipv6hdr *iph = ipv6_hdr(skb); |
198 | 190 | ||
199 | read_lock_bh(&l2tp_ip6_lock); | 191 | read_lock_bh(&l2tp_ip6_lock); |
200 | sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, inet6_iif(skb), | 192 | sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr, |
201 | tunnel_id); | 193 | inet6_iif(skb), tunnel_id); |
202 | if (!sk) { | 194 | if (!sk) { |
203 | read_unlock_bh(&l2tp_ip6_lock); | 195 | read_unlock_bh(&l2tp_ip6_lock); |
204 | goto discard; | 196 | goto discard; |
@@ -330,7 +322,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
330 | rcu_read_unlock(); | 322 | rcu_read_unlock(); |
331 | 323 | ||
332 | write_lock_bh(&l2tp_ip6_lock); | 324 | write_lock_bh(&l2tp_ip6_lock); |
333 | if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, bound_dev_if, | 325 | if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, NULL, bound_dev_if, |
334 | addr->l2tp_conn_id)) { | 326 | addr->l2tp_conn_id)) { |
335 | write_unlock_bh(&l2tp_ip6_lock); | 327 | write_unlock_bh(&l2tp_ip6_lock); |
336 | err = -EADDRINUSE; | 328 | err = -EADDRINUSE; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 2c21b7039136..0d8b716e509e 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -3287,7 +3287,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | |||
3287 | int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); | 3287 | int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); |
3288 | int hw_headroom = sdata->local->hw.extra_tx_headroom; | 3288 | int hw_headroom = sdata->local->hw.extra_tx_headroom; |
3289 | struct ethhdr eth; | 3289 | struct ethhdr eth; |
3290 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 3290 | struct ieee80211_tx_info *info; |
3291 | struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; | 3291 | struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; |
3292 | struct ieee80211_tx_data tx; | 3292 | struct ieee80211_tx_data tx; |
3293 | ieee80211_tx_result r; | 3293 | ieee80211_tx_result r; |
@@ -3351,6 +3351,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | |||
3351 | memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); | 3351 | memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); |
3352 | memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); | 3352 | memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); |
3353 | 3353 | ||
3354 | info = IEEE80211_SKB_CB(skb); | ||
3354 | memset(info, 0, sizeof(*info)); | 3355 | memset(info, 0, sizeof(*info)); |
3355 | info->band = fast_tx->band; | 3356 | info->band = fast_tx->band; |
3356 | info->control.vif = &sdata->vif; | 3357 | info->control.vif = &sdata->vif; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 2d4c4d3911c0..9c62b6325f7a 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -606,7 +606,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
606 | rcu_assign_pointer(flow->sf_acts, acts); | 606 | rcu_assign_pointer(flow->sf_acts, acts); |
607 | packet->priority = flow->key.phy.priority; | 607 | packet->priority = flow->key.phy.priority; |
608 | packet->mark = flow->key.phy.skb_mark; | 608 | packet->mark = flow->key.phy.skb_mark; |
609 | packet->protocol = flow->key.eth.type; | ||
610 | 609 | ||
611 | rcu_read_lock(); | 610 | rcu_read_lock(); |
612 | dp = get_dp_rcu(net, ovs_header->dp_ifindex); | 611 | dp = get_dp_rcu(net, ovs_header->dp_ifindex); |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 08aa926cd5cf..2c0a00f7f1b7 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -312,7 +312,8 @@ static bool icmp6hdr_ok(struct sk_buff *skb) | |||
312 | * Returns 0 if it encounters a non-vlan or incomplete packet. | 312 | * Returns 0 if it encounters a non-vlan or incomplete packet. |
313 | * Returns 1 after successfully parsing vlan tag. | 313 | * Returns 1 after successfully parsing vlan tag. |
314 | */ | 314 | */ |
315 | static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh) | 315 | static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh, |
316 | bool untag_vlan) | ||
316 | { | 317 | { |
317 | struct vlan_head *vh = (struct vlan_head *)skb->data; | 318 | struct vlan_head *vh = (struct vlan_head *)skb->data; |
318 | 319 | ||
@@ -330,7 +331,20 @@ static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh) | |||
330 | key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT); | 331 | key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT); |
331 | key_vh->tpid = vh->tpid; | 332 | key_vh->tpid = vh->tpid; |
332 | 333 | ||
333 | __skb_pull(skb, sizeof(struct vlan_head)); | 334 | if (unlikely(untag_vlan)) { |
335 | int offset = skb->data - skb_mac_header(skb); | ||
336 | u16 tci; | ||
337 | int err; | ||
338 | |||
339 | __skb_push(skb, offset); | ||
340 | err = __skb_vlan_pop(skb, &tci); | ||
341 | __skb_pull(skb, offset); | ||
342 | if (err) | ||
343 | return err; | ||
344 | __vlan_hwaccel_put_tag(skb, key_vh->tpid, tci); | ||
345 | } else { | ||
346 | __skb_pull(skb, sizeof(struct vlan_head)); | ||
347 | } | ||
334 | return 1; | 348 | return 1; |
335 | } | 349 | } |
336 | 350 | ||
@@ -351,13 +365,13 @@ static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key) | |||
351 | key->eth.vlan.tpid = skb->vlan_proto; | 365 | key->eth.vlan.tpid = skb->vlan_proto; |
352 | } else { | 366 | } else { |
353 | /* Parse outer vlan tag in the non-accelerated case. */ | 367 | /* Parse outer vlan tag in the non-accelerated case. */ |
354 | res = parse_vlan_tag(skb, &key->eth.vlan); | 368 | res = parse_vlan_tag(skb, &key->eth.vlan, true); |
355 | if (res <= 0) | 369 | if (res <= 0) |
356 | return res; | 370 | return res; |
357 | } | 371 | } |
358 | 372 | ||
359 | /* Parse inner vlan tag. */ | 373 | /* Parse inner vlan tag. */ |
360 | res = parse_vlan_tag(skb, &key->eth.cvlan); | 374 | res = parse_vlan_tag(skb, &key->eth.cvlan, false); |
361 | if (res <= 0) | 375 | if (res <= 0) |
362 | return res; | 376 | return res; |
363 | 377 | ||
@@ -800,29 +814,15 @@ int ovs_flow_key_extract_userspace(struct net *net, const struct nlattr *attr, | |||
800 | if (err) | 814 | if (err) |
801 | return err; | 815 | return err; |
802 | 816 | ||
803 | if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) { | 817 | /* key_extract assumes that skb->protocol is set-up for |
804 | /* key_extract assumes that skb->protocol is set-up for | 818 | * layer 3 packets which is the case for other callers, |
805 | * layer 3 packets which is the case for other callers, | 819 | * in particular packets received from the network stack. |
806 | * in particular packets recieved from the network stack. | 820 | * Here the correct value can be set from the metadata |
807 | * Here the correct value can be set from the metadata | 821 | * extracted above. |
808 | * extracted above. | 822 | * For L2 packet key eth type would be zero. skb protocol |
809 | */ | 823 | * would be set to correct value later during key-extact. |
810 | skb->protocol = key->eth.type; | 824 | */ |
811 | } else { | ||
812 | struct ethhdr *eth; | ||
813 | |||
814 | skb_reset_mac_header(skb); | ||
815 | eth = eth_hdr(skb); | ||
816 | |||
817 | /* Normally, setting the skb 'protocol' field would be | ||
818 | * handled by a call to eth_type_trans(), but it assumes | ||
819 | * there's a sending device, which we may not have. | ||
820 | */ | ||
821 | if (eth_proto_is_802_3(eth->h_proto)) | ||
822 | skb->protocol = eth->h_proto; | ||
823 | else | ||
824 | skb->protocol = htons(ETH_P_802_2); | ||
825 | } | ||
826 | 825 | ||
826 | skb->protocol = key->eth.type; | ||
827 | return key_extract(skb, key); | 827 | return key_extract(skb, key); |
828 | } | 828 | } |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 3fbba79a4ef0..1ecdf809b5fa 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -148,13 +148,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) | |||
148 | unsigned long cl; | 148 | unsigned long cl; |
149 | unsigned long fh; | 149 | unsigned long fh; |
150 | int err; | 150 | int err; |
151 | int tp_created = 0; | 151 | int tp_created; |
152 | 152 | ||
153 | if ((n->nlmsg_type != RTM_GETTFILTER) && | 153 | if ((n->nlmsg_type != RTM_GETTFILTER) && |
154 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) | 154 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
155 | return -EPERM; | 155 | return -EPERM; |
156 | 156 | ||
157 | replay: | 157 | replay: |
158 | tp_created = 0; | ||
159 | |||
158 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL); | 160 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL); |
159 | if (err < 0) | 161 | if (err < 0) |
160 | return err; | 162 | return err; |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 333f8e268431..970db7a41684 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -153,10 +153,14 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
153 | 153 | ||
154 | switch (ip_tunnel_info_af(info)) { | 154 | switch (ip_tunnel_info_af(info)) { |
155 | case AF_INET: | 155 | case AF_INET: |
156 | skb_key.enc_control.addr_type = | ||
157 | FLOW_DISSECTOR_KEY_IPV4_ADDRS; | ||
156 | skb_key.enc_ipv4.src = key->u.ipv4.src; | 158 | skb_key.enc_ipv4.src = key->u.ipv4.src; |
157 | skb_key.enc_ipv4.dst = key->u.ipv4.dst; | 159 | skb_key.enc_ipv4.dst = key->u.ipv4.dst; |
158 | break; | 160 | break; |
159 | case AF_INET6: | 161 | case AF_INET6: |
162 | skb_key.enc_control.addr_type = | ||
163 | FLOW_DISSECTOR_KEY_IPV6_ADDRS; | ||
160 | skb_key.enc_ipv6.src = key->u.ipv6.src; | 164 | skb_key.enc_ipv6.src = key->u.ipv6.src; |
161 | skb_key.enc_ipv6.dst = key->u.ipv6.dst; | 165 | skb_key.enc_ipv6.dst = key->u.ipv6.dst; |
162 | break; | 166 | break; |
diff --git a/net/socket.c b/net/socket.c index 8487bf136e5c..a8c2307590b8 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -537,7 +537,7 @@ int sockfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
537 | { | 537 | { |
538 | int err = simple_setattr(dentry, iattr); | 538 | int err = simple_setattr(dentry, iattr); |
539 | 539 | ||
540 | if (!err) { | 540 | if (!err && (iattr->ia_valid & ATTR_UID)) { |
541 | struct socket *sock = SOCKET_I(d_inode(dentry)); | 541 | struct socket *sock = SOCKET_I(d_inode(dentry)); |
542 | 542 | ||
543 | sock->sk->sk_uid = iattr->ia_uid; | 543 | sock->sk->sk_uid = iattr->ia_uid; |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 333c5dae0072..800caaa699a1 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -441,15 +441,19 @@ static void __tipc_shutdown(struct socket *sock, int error) | |||
441 | while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 441 | while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { |
442 | if (TIPC_SKB_CB(skb)->bytes_read) { | 442 | if (TIPC_SKB_CB(skb)->bytes_read) { |
443 | kfree_skb(skb); | 443 | kfree_skb(skb); |
444 | } else { | 444 | continue; |
445 | if (!tipc_sk_type_connectionless(sk) && | 445 | } |
446 | sk->sk_state != TIPC_DISCONNECTING) { | 446 | if (!tipc_sk_type_connectionless(sk) && |
447 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); | 447 | sk->sk_state != TIPC_DISCONNECTING) { |
448 | tipc_node_remove_conn(net, dnode, tsk->portid); | 448 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); |
449 | } | 449 | tipc_node_remove_conn(net, dnode, tsk->portid); |
450 | tipc_sk_respond(sk, skb, error); | ||
451 | } | 450 | } |
451 | tipc_sk_respond(sk, skb, error); | ||
452 | } | 452 | } |
453 | |||
454 | if (tipc_sk_type_connectionless(sk)) | ||
455 | return; | ||
456 | |||
453 | if (sk->sk_state != TIPC_DISCONNECTING) { | 457 | if (sk->sk_state != TIPC_DISCONNECTING) { |
454 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, | 458 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, |
455 | TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, | 459 | TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, |
@@ -457,10 +461,8 @@ static void __tipc_shutdown(struct socket *sock, int error) | |||
457 | tsk->portid, error); | 461 | tsk->portid, error); |
458 | if (skb) | 462 | if (skb) |
459 | tipc_node_xmit_skb(net, skb, dnode, tsk->portid); | 463 | tipc_node_xmit_skb(net, skb, dnode, tsk->portid); |
460 | if (!tipc_sk_type_connectionless(sk)) { | 464 | tipc_node_remove_conn(net, dnode, tsk->portid); |
461 | tipc_node_remove_conn(net, dnode, tsk->portid); | 465 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); |
462 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); | ||
463 | } | ||
464 | } | 466 | } |
465 | } | 467 | } |
466 | 468 | ||
diff --git a/samples/Kconfig b/samples/Kconfig index a6d2a43bbf2e..b124f62ed6cb 100644 --- a/samples/Kconfig +++ b/samples/Kconfig | |||
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS | |||
105 | help | 105 | help |
106 | Build samples of blackfin gptimers sample module. | 106 | Build samples of blackfin gptimers sample module. |
107 | 107 | ||
108 | config SAMPLE_VFIO_MDEV_MTTY | ||
109 | tristate "Build VFIO mtty example mediated device sample code -- loadable modules only" | ||
110 | depends on VFIO_MDEV_DEVICE && m | ||
111 | help | ||
112 | Build a virtual tty sample driver for use as a VFIO | ||
113 | mediated device | ||
114 | |||
108 | endif # SAMPLES | 115 | endif # SAMPLES |
diff --git a/samples/Makefile b/samples/Makefile index e17d66d77f09..86a137e451d9 100644 --- a/samples/Makefile +++ b/samples/Makefile | |||
@@ -2,4 +2,5 @@ | |||
2 | 2 | ||
3 | obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ | 3 | obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ |
4 | hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ | 4 | hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ |
5 | configfs/ connector/ v4l/ trace_printk/ blackfin/ | 5 | configfs/ connector/ v4l/ trace_printk/ blackfin/ \ |
6 | vfio-mdev/ | ||
diff --git a/samples/vfio-mdev/Makefile b/samples/vfio-mdev/Makefile index a932edbe38eb..cbbd868a50a8 100644 --- a/samples/vfio-mdev/Makefile +++ b/samples/vfio-mdev/Makefile | |||
@@ -1,13 +1 @@ | |||
1 | # | obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o | |
2 | # Makefile for mtty.c file | ||
3 | # | ||
4 | KERNEL_DIR:=/lib/modules/$(shell uname -r)/build | ||
5 | |||
6 | obj-m:=mtty.o | ||
7 | |||
8 | modules clean modules_install: | ||
9 | $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@ | ||
10 | |||
11 | default: modules | ||
12 | |||
13 | module: modules | ||
diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c index 6b633a4ea333..1fc57a5093a7 100644 --- a/samples/vfio-mdev/mtty.c +++ b/samples/vfio-mdev/mtty.c | |||
@@ -164,7 +164,7 @@ static struct mdev_state *find_mdev_state_by_uuid(uuid_le uuid) | |||
164 | struct mdev_state *mds; | 164 | struct mdev_state *mds; |
165 | 165 | ||
166 | list_for_each_entry(mds, &mdev_devices_list, next) { | 166 | list_for_each_entry(mds, &mdev_devices_list, next) { |
167 | if (uuid_le_cmp(mds->mdev->uuid, uuid) == 0) | 167 | if (uuid_le_cmp(mdev_uuid(mds->mdev), uuid) == 0) |
168 | return mds; | 168 | return mds; |
169 | } | 169 | } |
170 | 170 | ||
@@ -341,7 +341,8 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state, | |||
341 | pr_err("Serial port %d: Fifo level trigger\n", | 341 | pr_err("Serial port %d: Fifo level trigger\n", |
342 | index); | 342 | index); |
343 | #endif | 343 | #endif |
344 | mtty_trigger_interrupt(mdev_state->mdev->uuid); | 344 | mtty_trigger_interrupt( |
345 | mdev_uuid(mdev_state->mdev)); | ||
345 | } | 346 | } |
346 | } else { | 347 | } else { |
347 | #if defined(DEBUG_INTR) | 348 | #if defined(DEBUG_INTR) |
@@ -355,7 +356,8 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state, | |||
355 | */ | 356 | */ |
356 | if (mdev_state->s[index].uart_reg[UART_IER] & | 357 | if (mdev_state->s[index].uart_reg[UART_IER] & |
357 | UART_IER_RLSI) | 358 | UART_IER_RLSI) |
358 | mtty_trigger_interrupt(mdev_state->mdev->uuid); | 359 | mtty_trigger_interrupt( |
360 | mdev_uuid(mdev_state->mdev)); | ||
359 | } | 361 | } |
360 | mutex_unlock(&mdev_state->rxtx_lock); | 362 | mutex_unlock(&mdev_state->rxtx_lock); |
361 | break; | 363 | break; |
@@ -374,7 +376,8 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state, | |||
374 | pr_err("Serial port %d: IER_THRI write\n", | 376 | pr_err("Serial port %d: IER_THRI write\n", |
375 | index); | 377 | index); |
376 | #endif | 378 | #endif |
377 | mtty_trigger_interrupt(mdev_state->mdev->uuid); | 379 | mtty_trigger_interrupt( |
380 | mdev_uuid(mdev_state->mdev)); | ||
378 | } | 381 | } |
379 | 382 | ||
380 | mutex_unlock(&mdev_state->rxtx_lock); | 383 | mutex_unlock(&mdev_state->rxtx_lock); |
@@ -445,7 +448,7 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state, | |||
445 | #if defined(DEBUG_INTR) | 448 | #if defined(DEBUG_INTR) |
446 | pr_err("Serial port %d: MCR_OUT2 write\n", index); | 449 | pr_err("Serial port %d: MCR_OUT2 write\n", index); |
447 | #endif | 450 | #endif |
448 | mtty_trigger_interrupt(mdev_state->mdev->uuid); | 451 | mtty_trigger_interrupt(mdev_uuid(mdev_state->mdev)); |
449 | } | 452 | } |
450 | 453 | ||
451 | if ((mdev_state->s[index].uart_reg[UART_IER] & UART_IER_MSI) && | 454 | if ((mdev_state->s[index].uart_reg[UART_IER] & UART_IER_MSI) && |
@@ -453,7 +456,7 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state, | |||
453 | #if defined(DEBUG_INTR) | 456 | #if defined(DEBUG_INTR) |
454 | pr_err("Serial port %d: MCR RTS/DTR write\n", index); | 457 | pr_err("Serial port %d: MCR RTS/DTR write\n", index); |
455 | #endif | 458 | #endif |
456 | mtty_trigger_interrupt(mdev_state->mdev->uuid); | 459 | mtty_trigger_interrupt(mdev_uuid(mdev_state->mdev)); |
457 | } | 460 | } |
458 | break; | 461 | break; |
459 | 462 | ||
@@ -504,7 +507,8 @@ static void handle_bar_read(unsigned int index, struct mdev_state *mdev_state, | |||
504 | #endif | 507 | #endif |
505 | if (mdev_state->s[index].uart_reg[UART_IER] & | 508 | if (mdev_state->s[index].uart_reg[UART_IER] & |
506 | UART_IER_THRI) | 509 | UART_IER_THRI) |
507 | mtty_trigger_interrupt(mdev_state->mdev->uuid); | 510 | mtty_trigger_interrupt( |
511 | mdev_uuid(mdev_state->mdev)); | ||
508 | } | 512 | } |
509 | mutex_unlock(&mdev_state->rxtx_lock); | 513 | mutex_unlock(&mdev_state->rxtx_lock); |
510 | 514 | ||
@@ -734,7 +738,7 @@ int mtty_create(struct kobject *kobj, struct mdev_device *mdev) | |||
734 | 738 | ||
735 | for (i = 0; i < 2; i++) { | 739 | for (i = 0; i < 2; i++) { |
736 | snprintf(name, MTTY_STRING_LEN, "%s-%d", | 740 | snprintf(name, MTTY_STRING_LEN, "%s-%d", |
737 | dev_driver_string(mdev->parent->dev), i + 1); | 741 | dev_driver_string(mdev_parent_dev(mdev)), i + 1); |
738 | if (!strcmp(kobj->name, name)) { | 742 | if (!strcmp(kobj->name, name)) { |
739 | nr_ports = i + 1; | 743 | nr_ports = i + 1; |
740 | break; | 744 | break; |
@@ -1298,10 +1302,8 @@ static ssize_t | |||
1298 | sample_mdev_dev_show(struct device *dev, struct device_attribute *attr, | 1302 | sample_mdev_dev_show(struct device *dev, struct device_attribute *attr, |
1299 | char *buf) | 1303 | char *buf) |
1300 | { | 1304 | { |
1301 | struct mdev_device *mdev = to_mdev_device(dev); | 1305 | if (mdev_from_dev(dev)) |
1302 | 1306 | return sprintf(buf, "This is MDEV %s\n", dev_name(dev)); | |
1303 | if (mdev) | ||
1304 | return sprintf(buf, "This is MDEV %s\n", dev_name(&mdev->dev)); | ||
1305 | 1307 | ||
1306 | return sprintf(buf, "\n"); | 1308 | return sprintf(buf, "\n"); |
1307 | } | 1309 | } |
@@ -1402,7 +1404,7 @@ struct attribute_group *mdev_type_groups[] = { | |||
1402 | NULL, | 1404 | NULL, |
1403 | }; | 1405 | }; |
1404 | 1406 | ||
1405 | struct parent_ops mdev_fops = { | 1407 | struct mdev_parent_ops mdev_fops = { |
1406 | .owner = THIS_MODULE, | 1408 | .owner = THIS_MODULE, |
1407 | .dev_attr_groups = mtty_dev_groups, | 1409 | .dev_attr_groups = mtty_dev_groups, |
1408 | .mdev_attr_groups = mdev_dev_groups, | 1410 | .mdev_attr_groups = mdev_dev_groups, |
@@ -1447,6 +1449,7 @@ static int __init mtty_dev_init(void) | |||
1447 | 1449 | ||
1448 | if (IS_ERR(mtty_dev.vd_class)) { | 1450 | if (IS_ERR(mtty_dev.vd_class)) { |
1449 | pr_err("Error: failed to register mtty_dev class\n"); | 1451 | pr_err("Error: failed to register mtty_dev class\n"); |
1452 | ret = PTR_ERR(mtty_dev.vd_class); | ||
1450 | goto failed1; | 1453 | goto failed1; |
1451 | } | 1454 | } |
1452 | 1455 | ||
@@ -1458,7 +1461,8 @@ static int __init mtty_dev_init(void) | |||
1458 | if (ret) | 1461 | if (ret) |
1459 | goto failed2; | 1462 | goto failed2; |
1460 | 1463 | ||
1461 | if (mdev_register_device(&mtty_dev.dev, &mdev_fops) != 0) | 1464 | ret = mdev_register_device(&mtty_dev.dev, &mdev_fops); |
1465 | if (ret) | ||
1462 | goto failed3; | 1466 | goto failed3; |
1463 | 1467 | ||
1464 | mutex_init(&mdev_list_lock); | 1468 | mutex_init(&mdev_list_lock); |
diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h index 950fd2e64bb7..12262c0cc691 100644 --- a/scripts/gcc-plugins/gcc-common.h +++ b/scripts/gcc-plugins/gcc-common.h | |||
@@ -39,6 +39,9 @@ | |||
39 | #include "hash-map.h" | 39 | #include "hash-map.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #if BUILDING_GCC_VERSION >= 7000 | ||
43 | #include "memmodel.h" | ||
44 | #endif | ||
42 | #include "emit-rtl.h" | 45 | #include "emit-rtl.h" |
43 | #include "debug.h" | 46 | #include "debug.h" |
44 | #include "target.h" | 47 | #include "target.h" |
@@ -91,6 +94,9 @@ | |||
91 | #include "tree-ssa-alias.h" | 94 | #include "tree-ssa-alias.h" |
92 | #include "tree-ssa.h" | 95 | #include "tree-ssa.h" |
93 | #include "stringpool.h" | 96 | #include "stringpool.h" |
97 | #if BUILDING_GCC_VERSION >= 7000 | ||
98 | #include "tree-vrp.h" | ||
99 | #endif | ||
94 | #include "tree-ssanames.h" | 100 | #include "tree-ssanames.h" |
95 | #include "print-tree.h" | 101 | #include "print-tree.h" |
96 | #include "tree-eh.h" | 102 | #include "tree-eh.h" |
@@ -287,6 +293,22 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c | |||
287 | return NULL; | 293 | return NULL; |
288 | } | 294 | } |
289 | 295 | ||
296 | static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable) | ||
297 | { | ||
298 | cgraph_node_ptr alias; | ||
299 | |||
300 | if (callback(node, data)) | ||
301 | return true; | ||
302 | |||
303 | for (alias = node->same_body; alias; alias = alias->next) { | ||
304 | if (include_overwritable || cgraph_function_body_availability(alias) > AVAIL_OVERWRITABLE) | ||
305 | if (cgraph_for_node_and_aliases(alias, callback, data, include_overwritable)) | ||
306 | return true; | ||
307 | } | ||
308 | |||
309 | return false; | ||
310 | } | ||
311 | |||
290 | #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ | 312 | #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ |
291 | for ((node) = cgraph_first_function_with_gimple_body(); (node); \ | 313 | for ((node) = cgraph_first_function_with_gimple_body(); (node); \ |
292 | (node) = cgraph_next_function_with_gimple_body(node)) | 314 | (node) = cgraph_next_function_with_gimple_body(node)) |
@@ -399,6 +421,7 @@ typedef union gimple_statement_d gassign; | |||
399 | typedef union gimple_statement_d gcall; | 421 | typedef union gimple_statement_d gcall; |
400 | typedef union gimple_statement_d gcond; | 422 | typedef union gimple_statement_d gcond; |
401 | typedef union gimple_statement_d gdebug; | 423 | typedef union gimple_statement_d gdebug; |
424 | typedef union gimple_statement_d ggoto; | ||
402 | typedef union gimple_statement_d gphi; | 425 | typedef union gimple_statement_d gphi; |
403 | typedef union gimple_statement_d greturn; | 426 | typedef union gimple_statement_d greturn; |
404 | 427 | ||
@@ -452,6 +475,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt) | |||
452 | return stmt; | 475 | return stmt; |
453 | } | 476 | } |
454 | 477 | ||
478 | static inline ggoto *as_a_ggoto(gimple stmt) | ||
479 | { | ||
480 | return stmt; | ||
481 | } | ||
482 | |||
483 | static inline const ggoto *as_a_const_ggoto(const_gimple stmt) | ||
484 | { | ||
485 | return stmt; | ||
486 | } | ||
487 | |||
455 | static inline gphi *as_a_gphi(gimple stmt) | 488 | static inline gphi *as_a_gphi(gimple stmt) |
456 | { | 489 | { |
457 | return stmt; | 490 | return stmt; |
@@ -496,6 +529,14 @@ static inline const greturn *as_a_const_greturn(const_gimple stmt) | |||
496 | 529 | ||
497 | typedef struct rtx_def rtx_insn; | 530 | typedef struct rtx_def rtx_insn; |
498 | 531 | ||
532 | static inline const char *get_decl_section_name(const_tree decl) | ||
533 | { | ||
534 | if (DECL_SECTION_NAME(decl) == NULL_TREE) | ||
535 | return NULL; | ||
536 | |||
537 | return TREE_STRING_POINTER(DECL_SECTION_NAME(decl)); | ||
538 | } | ||
539 | |||
499 | static inline void set_decl_section_name(tree node, const char *value) | 540 | static inline void set_decl_section_name(tree node, const char *value) |
500 | { | 541 | { |
501 | if (value) | 542 | if (value) |
@@ -511,6 +552,7 @@ typedef struct gimple_statement_base gassign; | |||
511 | typedef struct gimple_statement_call gcall; | 552 | typedef struct gimple_statement_call gcall; |
512 | typedef struct gimple_statement_base gcond; | 553 | typedef struct gimple_statement_base gcond; |
513 | typedef struct gimple_statement_base gdebug; | 554 | typedef struct gimple_statement_base gdebug; |
555 | typedef struct gimple_statement_base ggoto; | ||
514 | typedef struct gimple_statement_phi gphi; | 556 | typedef struct gimple_statement_phi gphi; |
515 | typedef struct gimple_statement_base greturn; | 557 | typedef struct gimple_statement_base greturn; |
516 | 558 | ||
@@ -564,6 +606,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt) | |||
564 | return stmt; | 606 | return stmt; |
565 | } | 607 | } |
566 | 608 | ||
609 | static inline ggoto *as_a_ggoto(gimple stmt) | ||
610 | { | ||
611 | return stmt; | ||
612 | } | ||
613 | |||
614 | static inline const ggoto *as_a_const_ggoto(const_gimple stmt) | ||
615 | { | ||
616 | return stmt; | ||
617 | } | ||
618 | |||
567 | static inline gphi *as_a_gphi(gimple stmt) | 619 | static inline gphi *as_a_gphi(gimple stmt) |
568 | { | 620 | { |
569 | return as_a<gphi>(stmt); | 621 | return as_a<gphi>(stmt); |
@@ -611,6 +663,11 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs) | |||
611 | 663 | ||
612 | #define INSN_DELETED_P(insn) (insn)->deleted() | 664 | #define INSN_DELETED_P(insn) (insn)->deleted() |
613 | 665 | ||
666 | static inline const char *get_decl_section_name(const_tree decl) | ||
667 | { | ||
668 | return DECL_SECTION_NAME(decl); | ||
669 | } | ||
670 | |||
614 | /* symtab/cgraph related */ | 671 | /* symtab/cgraph related */ |
615 | #define debug_cgraph_node(node) (node)->debug() | 672 | #define debug_cgraph_node(node) (node)->debug() |
616 | #define cgraph_get_node(decl) cgraph_node::get(decl) | 673 | #define cgraph_get_node(decl) cgraph_node::get(decl) |
@@ -619,6 +676,7 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs) | |||
619 | #define cgraph_n_nodes symtab->cgraph_count | 676 | #define cgraph_n_nodes symtab->cgraph_count |
620 | #define cgraph_max_uid symtab->cgraph_max_uid | 677 | #define cgraph_max_uid symtab->cgraph_max_uid |
621 | #define varpool_get_node(decl) varpool_node::get(decl) | 678 | #define varpool_get_node(decl) varpool_node::get(decl) |
679 | #define dump_varpool_node(file, node) (node)->dump(file) | ||
622 | 680 | ||
623 | #define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ | 681 | #define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
624 | (caller)->create_edge((callee), (call_stmt), (count), (freq)) | 682 | (caller)->create_edge((callee), (call_stmt), (count), (freq)) |
@@ -674,6 +732,11 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node) | |||
674 | return node->get_alias_target(); | 732 | return node->get_alias_target(); |
675 | } | 733 | } |
676 | 734 | ||
735 | static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable) | ||
736 | { | ||
737 | return node->call_for_symbol_thunks_and_aliases(callback, data, include_overwritable); | ||
738 | } | ||
739 | |||
677 | static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data) | 740 | static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data) |
678 | { | 741 | { |
679 | return symtab->add_cgraph_insertion_hook(hook, data); | 742 | return symtab->add_cgraph_insertion_hook(hook, data); |
@@ -731,6 +794,13 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l | |||
731 | 794 | ||
732 | template <> | 795 | template <> |
733 | template <> | 796 | template <> |
797 | inline bool is_a_helper<const ggoto *>::test(const_gimple gs) | ||
798 | { | ||
799 | return gs->code == GIMPLE_GOTO; | ||
800 | } | ||
801 | |||
802 | template <> | ||
803 | template <> | ||
734 | inline bool is_a_helper<const greturn *>::test(const_gimple gs) | 804 | inline bool is_a_helper<const greturn *>::test(const_gimple gs) |
735 | { | 805 | { |
736 | return gs->code == GIMPLE_RETURN; | 806 | return gs->code == GIMPLE_RETURN; |
@@ -766,6 +836,16 @@ static inline const gcall *as_a_const_gcall(const_gimple stmt) | |||
766 | return as_a<const gcall *>(stmt); | 836 | return as_a<const gcall *>(stmt); |
767 | } | 837 | } |
768 | 838 | ||
839 | static inline ggoto *as_a_ggoto(gimple stmt) | ||
840 | { | ||
841 | return as_a<ggoto *>(stmt); | ||
842 | } | ||
843 | |||
844 | static inline const ggoto *as_a_const_ggoto(const_gimple stmt) | ||
845 | { | ||
846 | return as_a<const ggoto *>(stmt); | ||
847 | } | ||
848 | |||
769 | static inline gphi *as_a_gphi(gimple stmt) | 849 | static inline gphi *as_a_gphi(gimple stmt) |
770 | { | 850 | { |
771 | return as_a<gphi *>(stmt); | 851 | return as_a<gphi *>(stmt); |
@@ -828,4 +908,9 @@ static inline void debug_gimple_stmt(const_gimple s) | |||
828 | #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s)) | 908 | #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s)) |
829 | #endif | 909 | #endif |
830 | 910 | ||
911 | #if BUILDING_GCC_VERSION >= 7000 | ||
912 | #define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \ | ||
913 | get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep) | ||
914 | #endif | ||
915 | |||
831 | #endif | 916 | #endif |
diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c index 12541126575b..8ff203ad4809 100644 --- a/scripts/gcc-plugins/latent_entropy_plugin.c +++ b/scripts/gcc-plugins/latent_entropy_plugin.c | |||
@@ -328,9 +328,9 @@ static enum tree_code get_op(tree *rhs) | |||
328 | op = LROTATE_EXPR; | 328 | op = LROTATE_EXPR; |
329 | /* | 329 | /* |
330 | * This code limits the value of random_const to | 330 | * This code limits the value of random_const to |
331 | * the size of a wide int for the rotation | 331 | * the size of a long for the rotation |
332 | */ | 332 | */ |
333 | random_const &= HOST_BITS_PER_WIDE_INT - 1; | 333 | random_const %= TYPE_PRECISION(long_unsigned_type_node); |
334 | break; | 334 | break; |
335 | } | 335 | } |
336 | 336 | ||
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c index ee47924aef0d..827161bc269c 100644 --- a/sound/firewire/fireworks/fireworks_stream.c +++ b/sound/firewire/fireworks/fireworks_stream.c | |||
@@ -117,7 +117,7 @@ destroy_stream(struct snd_efw *efw, struct amdtp_stream *stream) | |||
117 | conn = &efw->in_conn; | 117 | conn = &efw->in_conn; |
118 | 118 | ||
119 | amdtp_stream_destroy(stream); | 119 | amdtp_stream_destroy(stream); |
120 | cmp_connection_destroy(&efw->out_conn); | 120 | cmp_connection_destroy(conn); |
121 | } | 121 | } |
122 | 122 | ||
123 | static int | 123 | static int |
diff --git a/sound/firewire/tascam/tascam-stream.c b/sound/firewire/tascam/tascam-stream.c index 4ad3bd7fd445..f1657a4e0621 100644 --- a/sound/firewire/tascam/tascam-stream.c +++ b/sound/firewire/tascam/tascam-stream.c | |||
@@ -343,7 +343,7 @@ int snd_tscm_stream_init_duplex(struct snd_tscm *tscm) | |||
343 | if (err < 0) | 343 | if (err < 0) |
344 | amdtp_stream_destroy(&tscm->rx_stream); | 344 | amdtp_stream_destroy(&tscm->rx_stream); |
345 | 345 | ||
346 | return 0; | 346 | return err; |
347 | } | 347 | } |
348 | 348 | ||
349 | /* At bus reset, streaming is stopped and some registers are clear. */ | 349 | /* At bus reset, streaming is stopped and some registers are clear. */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 9448daff9d8b..7d660ee1d5e8 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2230,6 +2230,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
2230 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), | 2230 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), |
2231 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), | 2231 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), |
2232 | SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), | 2232 | SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), |
2233 | SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), | ||
2233 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), | 2234 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
2234 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), | 2235 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
2235 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), | 2236 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
@@ -6983,6 +6984,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
6983 | SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), | 6984 | SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), |
6984 | SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), | 6985 | SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), |
6985 | SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), | 6986 | SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), |
6987 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), | ||
6986 | SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), | 6988 | SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), |
6987 | SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), | 6989 | SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
6988 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), | 6990 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 15d1d5c63c3c..c90607ebe155 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -384,6 +384,9 @@ static void snd_complete_urb(struct urb *urb) | |||
384 | if (unlikely(atomic_read(&ep->chip->shutdown))) | 384 | if (unlikely(atomic_read(&ep->chip->shutdown))) |
385 | goto exit_clear; | 385 | goto exit_clear; |
386 | 386 | ||
387 | if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags))) | ||
388 | goto exit_clear; | ||
389 | |||
387 | if (usb_pipeout(ep->pipe)) { | 390 | if (usb_pipeout(ep->pipe)) { |
388 | retire_outbound_urb(ep, ctx); | 391 | retire_outbound_urb(ep, ctx); |
389 | /* can be stopped during retire callback */ | 392 | /* can be stopped during retire callback */ |
@@ -534,6 +537,11 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep) | |||
534 | alive, ep->ep_num); | 537 | alive, ep->ep_num); |
535 | clear_bit(EP_FLAG_STOPPING, &ep->flags); | 538 | clear_bit(EP_FLAG_STOPPING, &ep->flags); |
536 | 539 | ||
540 | ep->data_subs = NULL; | ||
541 | ep->sync_slave = NULL; | ||
542 | ep->retire_data_urb = NULL; | ||
543 | ep->prepare_data_urb = NULL; | ||
544 | |||
537 | return 0; | 545 | return 0; |
538 | } | 546 | } |
539 | 547 | ||
@@ -912,9 +920,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
912 | /** | 920 | /** |
913 | * snd_usb_endpoint_start: start an snd_usb_endpoint | 921 | * snd_usb_endpoint_start: start an snd_usb_endpoint |
914 | * | 922 | * |
915 | * @ep: the endpoint to start | 923 | * @ep: the endpoint to start |
916 | * @can_sleep: flag indicating whether the operation is executed in | ||
917 | * non-atomic context | ||
918 | * | 924 | * |
919 | * A call to this function will increment the use count of the endpoint. | 925 | * A call to this function will increment the use count of the endpoint. |
920 | * In case it is not already running, the URBs for this endpoint will be | 926 | * In case it is not already running, the URBs for this endpoint will be |
@@ -924,7 +930,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
924 | * | 930 | * |
925 | * Returns an error if the URB submission failed, 0 in all other cases. | 931 | * Returns an error if the URB submission failed, 0 in all other cases. |
926 | */ | 932 | */ |
927 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep) | 933 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) |
928 | { | 934 | { |
929 | int err; | 935 | int err; |
930 | unsigned int i; | 936 | unsigned int i; |
@@ -938,8 +944,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep) | |||
938 | 944 | ||
939 | /* just to be sure */ | 945 | /* just to be sure */ |
940 | deactivate_urbs(ep, false); | 946 | deactivate_urbs(ep, false); |
941 | if (can_sleep) | ||
942 | wait_clear_urbs(ep); | ||
943 | 947 | ||
944 | ep->active_mask = 0; | 948 | ep->active_mask = 0; |
945 | ep->unlink_mask = 0; | 949 | ep->unlink_mask = 0; |
@@ -1020,10 +1024,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep) | |||
1020 | 1024 | ||
1021 | if (--ep->use_count == 0) { | 1025 | if (--ep->use_count == 0) { |
1022 | deactivate_urbs(ep, false); | 1026 | deactivate_urbs(ep, false); |
1023 | ep->data_subs = NULL; | ||
1024 | ep->sync_slave = NULL; | ||
1025 | ep->retire_data_urb = NULL; | ||
1026 | ep->prepare_data_urb = NULL; | ||
1027 | set_bit(EP_FLAG_STOPPING, &ep->flags); | 1027 | set_bit(EP_FLAG_STOPPING, &ep->flags); |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h index 6428392d8f62..584f295d7c77 100644 --- a/sound/usb/endpoint.h +++ b/sound/usb/endpoint.h | |||
@@ -18,7 +18,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
18 | struct audioformat *fmt, | 18 | struct audioformat *fmt, |
19 | struct snd_usb_endpoint *sync_ep); | 19 | struct snd_usb_endpoint *sync_ep); |
20 | 20 | ||
21 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep); | 21 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep); |
22 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep); | 22 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep); |
23 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); | 23 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); |
24 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); | 24 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 34c6d4f2c0b6..9aa5b1855481 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -218,7 +218,7 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, | |||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) | 221 | static int start_endpoints(struct snd_usb_substream *subs) |
222 | { | 222 | { |
223 | int err; | 223 | int err; |
224 | 224 | ||
@@ -231,7 +231,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) | |||
231 | dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep); | 231 | dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep); |
232 | 232 | ||
233 | ep->data_subs = subs; | 233 | ep->data_subs = subs; |
234 | err = snd_usb_endpoint_start(ep, can_sleep); | 234 | err = snd_usb_endpoint_start(ep); |
235 | if (err < 0) { | 235 | if (err < 0) { |
236 | clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags); | 236 | clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags); |
237 | return err; | 237 | return err; |
@@ -260,7 +260,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) | |||
260 | dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep); | 260 | dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep); |
261 | 261 | ||
262 | ep->sync_slave = subs->data_endpoint; | 262 | ep->sync_slave = subs->data_endpoint; |
263 | err = snd_usb_endpoint_start(ep, can_sleep); | 263 | err = snd_usb_endpoint_start(ep); |
264 | if (err < 0) { | 264 | if (err < 0) { |
265 | clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); | 265 | clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); |
266 | return err; | 266 | return err; |
@@ -850,7 +850,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
850 | /* for playback, submit the URBs now; otherwise, the first hwptr_done | 850 | /* for playback, submit the URBs now; otherwise, the first hwptr_done |
851 | * updates for all URBs would happen at the same time when starting */ | 851 | * updates for all URBs would happen at the same time when starting */ |
852 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) | 852 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) |
853 | ret = start_endpoints(subs, true); | 853 | ret = start_endpoints(subs); |
854 | 854 | ||
855 | unlock: | 855 | unlock: |
856 | snd_usb_unlock_shutdown(subs->stream->chip); | 856 | snd_usb_unlock_shutdown(subs->stream->chip); |
@@ -1666,7 +1666,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream | |||
1666 | 1666 | ||
1667 | switch (cmd) { | 1667 | switch (cmd) { |
1668 | case SNDRV_PCM_TRIGGER_START: | 1668 | case SNDRV_PCM_TRIGGER_START: |
1669 | err = start_endpoints(subs, false); | 1669 | err = start_endpoints(subs); |
1670 | if (err < 0) | 1670 | if (err < 0) |
1671 | return err; | 1671 | return err; |
1672 | 1672 | ||
diff --git a/usr/Makefile b/usr/Makefile index 17a513268325..0b87e71c00fc 100644 --- a/usr/Makefile +++ b/usr/Makefile | |||
@@ -5,8 +5,10 @@ | |||
5 | klibcdirs:; | 5 | klibcdirs:; |
6 | PHONY += klibcdirs | 6 | PHONY += klibcdirs |
7 | 7 | ||
8 | suffix_y = $(CONFIG_INITRAMFS_COMPRESSION) | 8 | suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION)) |
9 | AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)" | 9 | datafile_y = initramfs_data.cpio$(suffix_y) |
10 | AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)" | ||
11 | |||
10 | 12 | ||
11 | # Generate builtin.o based on initramfs_data.o | 13 | # Generate builtin.o based on initramfs_data.o |
12 | obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o | 14 | obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o |
@@ -14,7 +16,7 @@ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o | |||
14 | # initramfs_data.o contains the compressed initramfs_data.cpio image. | 16 | # initramfs_data.o contains the compressed initramfs_data.cpio image. |
15 | # The image is included using .incbin, a dependency which is not | 17 | # The image is included using .incbin, a dependency which is not |
16 | # tracked automatically. | 18 | # tracked automatically. |
17 | $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE | 19 | $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE |
18 | 20 | ||
19 | ##### | 21 | ##### |
20 | # Generate the initramfs cpio archive | 22 | # Generate the initramfs cpio archive |
@@ -38,10 +40,8 @@ endif | |||
38 | quiet_cmd_initfs = GEN $@ | 40 | quiet_cmd_initfs = GEN $@ |
39 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) | 41 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) |
40 | 42 | ||
41 | targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 \ | 43 | targets := $(datafile_y) |
42 | initramfs_data.cpio.lzma initramfs_data.cpio.xz \ | 44 | |
43 | initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \ | ||
44 | initramfs_data.cpio | ||
45 | # do not try to update files included in initramfs | 45 | # do not try to update files included in initramfs |
46 | $(deps_initramfs): ; | 46 | $(deps_initramfs): ; |
47 | 47 | ||
@@ -51,6 +51,6 @@ $(deps_initramfs): klibcdirs | |||
51 | # 2) There are changes in which files are included (added or deleted) | 51 | # 2) There are changes in which files are included (added or deleted) |
52 | # 3) If gen_init_cpio are newer than initramfs_data.cpio | 52 | # 3) If gen_init_cpio are newer than initramfs_data.cpio |
53 | # 4) arguments to gen_initramfs.sh changes | 53 | # 4) arguments to gen_initramfs.sh changes |
54 | $(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs | 54 | $(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs |
55 | $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d | 55 | $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d |
56 | $(call if_changed,initfs) | 56 | $(call if_changed,initfs) |