diff options
author | David S. Miller <davem@davemloft.net> | 2019-02-15 15:38:38 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-15 15:38:38 -0500 |
commit | 3313da8188cc346a205783c22c37e821b4b7016d (patch) | |
tree | 5697cd985220def9bc2e35dfbb832dad04c2d051 | |
parent | 50f444aa50a4f3fab35a04f56d6bb83dc1e8c875 (diff) | |
parent | 24f0a48743a256bdec1bcb80708bc309da4aa261 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
The netfilter conflicts were rather simple overlapping
changes.
However, the cls_tcindex.c stuff was a bit more complex.
On the 'net' side, Cong is fixing several races and memory
leaks. Whilst on the 'net-next' side we have Vlad adding
the rtnl-ness support.
What I've decided to do, in order to resolve this, is revert the
conversion over to using a workqueue that Cong did, bringing us back
to pure RCU. I did it this way because I believe that either Cong's
races don't apply with have Vlad did things, or Cong will have to
implement the race fix slightly differently.
Signed-off-by: David S. Miller <davem@davemloft.net>
272 files changed, 1962 insertions, 1228 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 7afb2fedde0a..bcf2cd519d1e 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
@@ -1701,12 +1701,11 @@ | |||
1701 | By default, super page will be supported if Intel IOMMU | 1701 | By default, super page will be supported if Intel IOMMU |
1702 | has the capability. With this option, super page will | 1702 | has the capability. With this option, super page will |
1703 | not be supported. | 1703 | not be supported. |
1704 | sm_off [Default Off] | 1704 | sm_on [Default Off] |
1705 | By default, scalable mode will be supported if the | 1705 | By default, scalable mode will be disabled even if the |
1706 | hardware advertises that it has support for the scalable | 1706 | hardware advertises that it has support for the scalable |
1707 | mode translation. With this option set, scalable mode | 1707 | mode translation. With this option set, scalable mode |
1708 | will not be used even on hardware which claims to support | 1708 | will be used on hardware which claims to support it. |
1709 | it. | ||
1710 | tboot_noforce [Default Off] | 1709 | tboot_noforce [Default Off] |
1711 | Do not force the Intel IOMMU enabled under tboot. | 1710 | Do not force the Intel IOMMU enabled under tboot. |
1712 | By default, tboot will force Intel IOMMU on, which | 1711 | By default, tboot will force Intel IOMMU on, which |
diff --git a/Documentation/networking/operstates.txt b/Documentation/networking/operstates.txt index 355c6d8ef8ad..b203d1334822 100644 --- a/Documentation/networking/operstates.txt +++ b/Documentation/networking/operstates.txt | |||
@@ -22,8 +22,9 @@ and changeable from userspace under certain rules. | |||
22 | 2. Querying from userspace | 22 | 2. Querying from userspace |
23 | 23 | ||
24 | Both admin and operational state can be queried via the netlink | 24 | Both admin and operational state can be queried via the netlink |
25 | operation RTM_GETLINK. It is also possible to subscribe to RTMGRP_LINK | 25 | operation RTM_GETLINK. It is also possible to subscribe to RTNLGRP_LINK |
26 | to be notified of updates. This is important for setting from userspace. | 26 | to be notified of updates while the interface is admin up. This is |
27 | important for setting from userspace. | ||
27 | 28 | ||
28 | These values contain interface state: | 29 | These values contain interface state: |
29 | 30 | ||
@@ -101,8 +102,9 @@ because some driver controlled protocol establishment has to | |||
101 | complete. Corresponding functions are netif_dormant_on() to set the | 102 | complete. Corresponding functions are netif_dormant_on() to set the |
102 | flag, netif_dormant_off() to clear it and netif_dormant() to query. | 103 | flag, netif_dormant_off() to clear it and netif_dormant() to query. |
103 | 104 | ||
104 | On device allocation, networking core sets the flags equivalent to | 105 | On device allocation, both flags __LINK_STATE_NOCARRIER and |
105 | netif_carrier_ok() and !netif_dormant(). | 106 | __LINK_STATE_DORMANT are cleared, so the effective state is equivalent |
107 | to netif_carrier_ok() and !netif_dormant(). | ||
106 | 108 | ||
107 | 109 | ||
108 | Whenever the driver CHANGES one of these flags, a workqueue event is | 110 | Whenever the driver CHANGES one of these flags, a workqueue event is |
@@ -133,11 +135,11 @@ netif_carrier_ok() && !netif_dormant() is set by the | |||
133 | driver. Afterwards, the userspace application can set IFLA_OPERSTATE | 135 | driver. Afterwards, the userspace application can set IFLA_OPERSTATE |
134 | to IF_OPER_DORMANT or IF_OPER_UP as long as the driver does not set | 136 | to IF_OPER_DORMANT or IF_OPER_UP as long as the driver does not set |
135 | netif_carrier_off() or netif_dormant_on(). Changes made by userspace | 137 | netif_carrier_off() or netif_dormant_on(). Changes made by userspace |
136 | are multicasted on the netlink group RTMGRP_LINK. | 138 | are multicasted on the netlink group RTNLGRP_LINK. |
137 | 139 | ||
138 | So basically a 802.1X supplicant interacts with the kernel like this: | 140 | So basically a 802.1X supplicant interacts with the kernel like this: |
139 | 141 | ||
140 | -subscribe to RTMGRP_LINK | 142 | -subscribe to RTNLGRP_LINK |
141 | -set IFLA_LINKMODE to 1 via RTM_SETLINK | 143 | -set IFLA_LINKMODE to 1 via RTM_SETLINK |
142 | -query RTM_GETLINK once to get initial state | 144 | -query RTM_GETLINK once to get initial state |
143 | -if initial flags are not (IFF_LOWER_UP && !IFF_DORMANT), wait until | 145 | -if initial flags are not (IFF_LOWER_UP && !IFF_DORMANT), wait until |
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt index 58649bd4fcfc..ebc679bcb2dc 100644 --- a/Documentation/sysctl/fs.txt +++ b/Documentation/sysctl/fs.txt | |||
@@ -80,7 +80,9 @@ nonzero when shrink_dcache_pages() has been called and the | |||
80 | dcache isn't pruned yet. | 80 | dcache isn't pruned yet. |
81 | 81 | ||
82 | nr_negative shows the number of unused dentries that are also | 82 | nr_negative shows the number of unused dentries that are also |
83 | negative dentries which do not mapped to actual files. | 83 | negative dentries which do not map to any files. Instead, |
84 | they help speeding up rejection of non-existing files provided | ||
85 | by the users. | ||
84 | 86 | ||
85 | ============================================================== | 87 | ============================================================== |
86 | 88 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index d7da0618d6b3..8c8f509844c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5192,7 +5192,7 @@ DRM DRIVERS FOR XEN | |||
5192 | M: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> | 5192 | M: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> |
5193 | T: git git://anongit.freedesktop.org/drm/drm-misc | 5193 | T: git git://anongit.freedesktop.org/drm/drm-misc |
5194 | L: dri-devel@lists.freedesktop.org | 5194 | L: dri-devel@lists.freedesktop.org |
5195 | L: xen-devel@lists.xen.org | 5195 | L: xen-devel@lists.xenproject.org (moderated for non-subscribers) |
5196 | S: Supported | 5196 | S: Supported |
5197 | F: drivers/gpu/drm/xen/ | 5197 | F: drivers/gpu/drm/xen/ |
5198 | F: Documentation/gpu/xen-front.rst | 5198 | F: Documentation/gpu/xen-front.rst |
@@ -6165,7 +6165,7 @@ FREESCALE SOC SOUND DRIVERS | |||
6165 | M: Timur Tabi <timur@kernel.org> | 6165 | M: Timur Tabi <timur@kernel.org> |
6166 | M: Nicolin Chen <nicoleotsuka@gmail.com> | 6166 | M: Nicolin Chen <nicoleotsuka@gmail.com> |
6167 | M: Xiubo Li <Xiubo.Lee@gmail.com> | 6167 | M: Xiubo Li <Xiubo.Lee@gmail.com> |
6168 | R: Fabio Estevam <fabio.estevam@nxp.com> | 6168 | R: Fabio Estevam <festevam@gmail.com> |
6169 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 6169 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
6170 | L: linuxppc-dev@lists.ozlabs.org | 6170 | L: linuxppc-dev@lists.ozlabs.org |
6171 | S: Maintained | 6171 | S: Maintained |
@@ -10913,7 +10913,7 @@ F: include/linux/nvmem-consumer.h | |||
10913 | F: include/linux/nvmem-provider.h | 10913 | F: include/linux/nvmem-provider.h |
10914 | 10914 | ||
10915 | NXP SGTL5000 DRIVER | 10915 | NXP SGTL5000 DRIVER |
10916 | M: Fabio Estevam <fabio.estevam@nxp.com> | 10916 | M: Fabio Estevam <festevam@gmail.com> |
10917 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 10917 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
10918 | S: Maintained | 10918 | S: Maintained |
10919 | F: Documentation/devicetree/bindings/sound/sgtl5000.txt | 10919 | F: Documentation/devicetree/bindings/sound/sgtl5000.txt |
@@ -11327,10 +11327,12 @@ F: include/dt-bindings/ | |||
11327 | 11327 | ||
11328 | OPENCORES I2C BUS DRIVER | 11328 | OPENCORES I2C BUS DRIVER |
11329 | M: Peter Korsgaard <peter@korsgaard.com> | 11329 | M: Peter Korsgaard <peter@korsgaard.com> |
11330 | M: Andrew Lunn <andrew@lunn.ch> | ||
11330 | L: linux-i2c@vger.kernel.org | 11331 | L: linux-i2c@vger.kernel.org |
11331 | S: Maintained | 11332 | S: Maintained |
11332 | F: Documentation/i2c/busses/i2c-ocores | 11333 | F: Documentation/i2c/busses/i2c-ocores |
11333 | F: drivers/i2c/busses/i2c-ocores.c | 11334 | F: drivers/i2c/busses/i2c-ocores.c |
11335 | F: include/linux/platform_data/i2c-ocores.h | ||
11334 | 11336 | ||
11335 | OPENRISC ARCHITECTURE | 11337 | OPENRISC ARCHITECTURE |
11336 | M: Jonas Bonn <jonas@southpole.se> | 11338 | M: Jonas Bonn <jonas@southpole.se> |
@@ -2,7 +2,7 @@ | |||
2 | VERSION = 5 | 2 | VERSION = 5 |
3 | PATCHLEVEL = 0 | 3 | PATCHLEVEL = 0 |
4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
5 | EXTRAVERSION = -rc5 | 5 | EXTRAVERSION = -rc6 |
6 | NAME = Shy Crocodile | 6 | NAME = Shy Crocodile |
7 | 7 | ||
8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
diff --git a/arch/alpha/include/asm/irq.h b/arch/alpha/include/asm/irq.h index 4d17cacd1462..432402c8e47f 100644 --- a/arch/alpha/include/asm/irq.h +++ b/arch/alpha/include/asm/irq.h | |||
@@ -56,15 +56,15 @@ | |||
56 | 56 | ||
57 | #elif defined(CONFIG_ALPHA_DP264) || \ | 57 | #elif defined(CONFIG_ALPHA_DP264) || \ |
58 | defined(CONFIG_ALPHA_LYNX) || \ | 58 | defined(CONFIG_ALPHA_LYNX) || \ |
59 | defined(CONFIG_ALPHA_SHARK) || \ | 59 | defined(CONFIG_ALPHA_SHARK) |
60 | defined(CONFIG_ALPHA_EIGER) | ||
61 | # define NR_IRQS 64 | 60 | # define NR_IRQS 64 |
62 | 61 | ||
63 | #elif defined(CONFIG_ALPHA_TITAN) | 62 | #elif defined(CONFIG_ALPHA_TITAN) |
64 | #define NR_IRQS 80 | 63 | #define NR_IRQS 80 |
65 | 64 | ||
66 | #elif defined(CONFIG_ALPHA_RAWHIDE) || \ | 65 | #elif defined(CONFIG_ALPHA_RAWHIDE) || \ |
67 | defined(CONFIG_ALPHA_TAKARA) | 66 | defined(CONFIG_ALPHA_TAKARA) || \ |
67 | defined(CONFIG_ALPHA_EIGER) | ||
68 | # define NR_IRQS 128 | 68 | # define NR_IRQS 128 |
69 | 69 | ||
70 | #elif defined(CONFIG_ALPHA_WILDFIRE) | 70 | #elif defined(CONFIG_ALPHA_WILDFIRE) |
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c index d73dc473fbb9..188fc9256baf 100644 --- a/arch/alpha/mm/fault.c +++ b/arch/alpha/mm/fault.c | |||
@@ -78,7 +78,7 @@ __load_new_mm_context(struct mm_struct *next_mm) | |||
78 | /* Macro for exception fixup code to access integer registers. */ | 78 | /* Macro for exception fixup code to access integer registers. */ |
79 | #define dpf_reg(r) \ | 79 | #define dpf_reg(r) \ |
80 | (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ | 80 | (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ |
81 | (r) <= 18 ? (r)+8 : (r)-10]) | 81 | (r) <= 18 ? (r)+10 : (r)-10]) |
82 | 82 | ||
83 | asmlinkage void | 83 | asmlinkage void |
84 | do_page_fault(unsigned long address, unsigned long mmcsr, | 84 | do_page_fault(unsigned long address, unsigned long mmcsr, |
diff --git a/arch/arm/boot/dts/am335x-shc.dts b/arch/arm/boot/dts/am335x-shc.dts index d0fd68873689..5b250060f6dd 100644 --- a/arch/arm/boot/dts/am335x-shc.dts +++ b/arch/arm/boot/dts/am335x-shc.dts | |||
@@ -215,7 +215,7 @@ | |||
215 | pinctrl-names = "default"; | 215 | pinctrl-names = "default"; |
216 | pinctrl-0 = <&mmc1_pins>; | 216 | pinctrl-0 = <&mmc1_pins>; |
217 | bus-width = <0x4>; | 217 | bus-width = <0x4>; |
218 | cd-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; | 218 | cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; |
219 | cd-inverted; | 219 | cd-inverted; |
220 | max-frequency = <26000000>; | 220 | max-frequency = <26000000>; |
221 | vmmc-supply = <&vmmcsd_fixed>; | 221 | vmmc-supply = <&vmmcsd_fixed>; |
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi index 47aa53ba6b92..559659b399d0 100644 --- a/arch/arm/boot/dts/da850.dtsi +++ b/arch/arm/boot/dts/da850.dtsi | |||
@@ -476,7 +476,7 @@ | |||
476 | clocksource: timer@20000 { | 476 | clocksource: timer@20000 { |
477 | compatible = "ti,da830-timer"; | 477 | compatible = "ti,da830-timer"; |
478 | reg = <0x20000 0x1000>; | 478 | reg = <0x20000 0x1000>; |
479 | interrupts = <12>, <13>; | 479 | interrupts = <21>, <22>; |
480 | interrupt-names = "tint12", "tint34"; | 480 | interrupt-names = "tint12", "tint34"; |
481 | clocks = <&pll0_auxclk>; | 481 | clocks = <&pll0_auxclk>; |
482 | }; | 482 | }; |
diff --git a/arch/arm/boot/dts/imx6q-pistachio.dts b/arch/arm/boot/dts/imx6q-pistachio.dts index 5edf858c8b86..a31b17eaf51c 100644 --- a/arch/arm/boot/dts/imx6q-pistachio.dts +++ b/arch/arm/boot/dts/imx6q-pistachio.dts | |||
@@ -103,7 +103,7 @@ | |||
103 | power { | 103 | power { |
104 | label = "Power Button"; | 104 | label = "Power Button"; |
105 | gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; | 105 | gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; |
106 | gpio-key,wakeup; | 106 | wakeup-source; |
107 | linux,code = <KEY_POWER>; | 107 | linux,code = <KEY_POWER>; |
108 | }; | 108 | }; |
109 | }; | 109 | }; |
diff --git a/arch/arm/boot/dts/imx6sll-evk.dts b/arch/arm/boot/dts/imx6sll-evk.dts index d8163705363e..4a31a415f88e 100644 --- a/arch/arm/boot/dts/imx6sll-evk.dts +++ b/arch/arm/boot/dts/imx6sll-evk.dts | |||
@@ -309,7 +309,7 @@ | |||
309 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; | 309 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
310 | cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; | 310 | cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; |
311 | keep-power-in-suspend; | 311 | keep-power-in-suspend; |
312 | enable-sdio-wakeup; | 312 | wakeup-source; |
313 | vmmc-supply = <®_sd3_vmmc>; | 313 | vmmc-supply = <®_sd3_vmmc>; |
314 | status = "okay"; | 314 | status = "okay"; |
315 | }; | 315 | }; |
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi index 272ff6133ec1..d1375d3650fd 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi | |||
@@ -467,7 +467,7 @@ | |||
467 | }; | 467 | }; |
468 | 468 | ||
469 | gpt: gpt@2098000 { | 469 | gpt: gpt@2098000 { |
470 | compatible = "fsl,imx6sx-gpt", "fsl,imx31-gpt"; | 470 | compatible = "fsl,imx6sx-gpt", "fsl,imx6dl-gpt"; |
471 | reg = <0x02098000 0x4000>; | 471 | reg = <0x02098000 0x4000>; |
472 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; | 472 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; |
473 | clocks = <&clks IMX6SX_CLK_GPT_BUS>, | 473 | clocks = <&clks IMX6SX_CLK_GPT_BUS>, |
diff --git a/arch/arm/boot/dts/meson.dtsi b/arch/arm/boot/dts/meson.dtsi index e4645f612712..2ab74860d962 100644 --- a/arch/arm/boot/dts/meson.dtsi +++ b/arch/arm/boot/dts/meson.dtsi | |||
@@ -274,7 +274,7 @@ | |||
274 | compatible = "amlogic,meson6-dwmac", "snps,dwmac"; | 274 | compatible = "amlogic,meson6-dwmac", "snps,dwmac"; |
275 | reg = <0xc9410000 0x10000 | 275 | reg = <0xc9410000 0x10000 |
276 | 0xc1108108 0x4>; | 276 | 0xc1108108 0x4>; |
277 | interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>; | 277 | interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; |
278 | interrupt-names = "macirq"; | 278 | interrupt-names = "macirq"; |
279 | status = "disabled"; | 279 | status = "disabled"; |
280 | }; | 280 | }; |
diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts index 0872f6e3abf5..d50fc2f60fa3 100644 --- a/arch/arm/boot/dts/meson8b-ec100.dts +++ b/arch/arm/boot/dts/meson8b-ec100.dts | |||
@@ -205,8 +205,7 @@ | |||
205 | cap-sd-highspeed; | 205 | cap-sd-highspeed; |
206 | disable-wp; | 206 | disable-wp; |
207 | 207 | ||
208 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 208 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
209 | cd-inverted; | ||
210 | 209 | ||
211 | vmmc-supply = <&vcc_3v3>; | 210 | vmmc-supply = <&vcc_3v3>; |
212 | }; | 211 | }; |
diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts index 58669abda259..0f0a46ddf3ff 100644 --- a/arch/arm/boot/dts/meson8b-odroidc1.dts +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts | |||
@@ -221,7 +221,6 @@ | |||
221 | /* Realtek RTL8211F (0x001cc916) */ | 221 | /* Realtek RTL8211F (0x001cc916) */ |
222 | eth_phy: ethernet-phy@0 { | 222 | eth_phy: ethernet-phy@0 { |
223 | reg = <0>; | 223 | reg = <0>; |
224 | eee-broken-1000t; | ||
225 | interrupt-parent = <&gpio_intc>; | 224 | interrupt-parent = <&gpio_intc>; |
226 | /* GPIOH_3 */ | 225 | /* GPIOH_3 */ |
227 | interrupts = <17 IRQ_TYPE_LEVEL_LOW>; | 226 | interrupts = <17 IRQ_TYPE_LEVEL_LOW>; |
@@ -273,8 +272,7 @@ | |||
273 | cap-sd-highspeed; | 272 | cap-sd-highspeed; |
274 | disable-wp; | 273 | disable-wp; |
275 | 274 | ||
276 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 275 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
277 | cd-inverted; | ||
278 | 276 | ||
279 | vmmc-supply = <&tflash_vdd>; | 277 | vmmc-supply = <&tflash_vdd>; |
280 | vqmmc-supply = <&tf_io>; | 278 | vqmmc-supply = <&tf_io>; |
diff --git a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts index f5853610b20b..6ac02beb5fa7 100644 --- a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts +++ b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts | |||
@@ -206,8 +206,7 @@ | |||
206 | cap-sd-highspeed; | 206 | cap-sd-highspeed; |
207 | disable-wp; | 207 | disable-wp; |
208 | 208 | ||
209 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 209 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
210 | cd-inverted; | ||
211 | 210 | ||
212 | vmmc-supply = <&vcc_3v3>; | 211 | vmmc-supply = <&vcc_3v3>; |
213 | }; | 212 | }; |
diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi index ddc7a7bb33c0..f57acf8f66b9 100644 --- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi | |||
@@ -105,7 +105,7 @@ | |||
105 | interrupts-extended = < | 105 | interrupts-extended = < |
106 | &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 | 106 | &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 |
107 | &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 | 107 | &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 |
108 | &cpcap 48 1 | 108 | &cpcap 48 0 |
109 | >; | 109 | >; |
110 | interrupt-names = | 110 | interrupt-names = |
111 | "id_ground", "id_float", "se0conn", "vbusvld", | 111 | "id_ground", "id_float", "se0conn", "vbusvld", |
diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi index e53d32691308..93b420934e8e 100644 --- a/arch/arm/boot/dts/omap3-gta04.dtsi +++ b/arch/arm/boot/dts/omap3-gta04.dtsi | |||
@@ -714,11 +714,7 @@ | |||
714 | 714 | ||
715 | vdda-supply = <&vdac>; | 715 | vdda-supply = <&vdac>; |
716 | 716 | ||
717 | #address-cells = <1>; | ||
718 | #size-cells = <0>; | ||
719 | |||
720 | port { | 717 | port { |
721 | reg = <0>; | ||
722 | venc_out: endpoint { | 718 | venc_out: endpoint { |
723 | remote-endpoint = <&opa_in>; | 719 | remote-endpoint = <&opa_in>; |
724 | ti,channels = <1>; | 720 | ti,channels = <1>; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 182a53991c90..826920e6b878 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -814,7 +814,7 @@ | |||
814 | /* For debugging, it is often good idea to remove this GPIO. | 814 | /* For debugging, it is often good idea to remove this GPIO. |
815 | It means you can remove back cover (to reboot by removing | 815 | It means you can remove back cover (to reboot by removing |
816 | battery) and still use the MMC card. */ | 816 | battery) and still use the MMC card. */ |
817 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */ | 817 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; /* 160 */ |
818 | }; | 818 | }; |
819 | 819 | ||
820 | /* most boards use vaux3, only some old versions use vmmc2 instead */ | 820 | /* most boards use vaux3, only some old versions use vmmc2 instead */ |
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi index 0d9b85317529..e142e6c70a59 100644 --- a/arch/arm/boot/dts/omap3-n950-n9.dtsi +++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi | |||
@@ -370,6 +370,19 @@ | |||
370 | compatible = "ti,omap2-onenand"; | 370 | compatible = "ti,omap2-onenand"; |
371 | reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ | 371 | reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ |
372 | 372 | ||
373 | /* | ||
374 | * These timings are based on CONFIG_OMAP_GPMC_DEBUG=y reported | ||
375 | * bootloader set values when booted with v4.19 using both N950 | ||
376 | * and N9 devices (OneNAND Manufacturer: Samsung): | ||
377 | * | ||
378 | * gpmc cs0 before gpmc_cs_program_settings: | ||
379 | * cs0 GPMC_CS_CONFIG1: 0xfd001202 | ||
380 | * cs0 GPMC_CS_CONFIG2: 0x00181800 | ||
381 | * cs0 GPMC_CS_CONFIG3: 0x00030300 | ||
382 | * cs0 GPMC_CS_CONFIG4: 0x18001804 | ||
383 | * cs0 GPMC_CS_CONFIG5: 0x03171d1d | ||
384 | * cs0 GPMC_CS_CONFIG6: 0x97080000 | ||
385 | */ | ||
373 | gpmc,sync-read; | 386 | gpmc,sync-read; |
374 | gpmc,sync-write; | 387 | gpmc,sync-write; |
375 | gpmc,burst-length = <16>; | 388 | gpmc,burst-length = <16>; |
@@ -379,26 +392,27 @@ | |||
379 | gpmc,device-width = <2>; | 392 | gpmc,device-width = <2>; |
380 | gpmc,mux-add-data = <2>; | 393 | gpmc,mux-add-data = <2>; |
381 | gpmc,cs-on-ns = <0>; | 394 | gpmc,cs-on-ns = <0>; |
382 | gpmc,cs-rd-off-ns = <87>; | 395 | gpmc,cs-rd-off-ns = <122>; |
383 | gpmc,cs-wr-off-ns = <87>; | 396 | gpmc,cs-wr-off-ns = <122>; |
384 | gpmc,adv-on-ns = <0>; | 397 | gpmc,adv-on-ns = <0>; |
385 | gpmc,adv-rd-off-ns = <10>; | 398 | gpmc,adv-rd-off-ns = <15>; |
386 | gpmc,adv-wr-off-ns = <10>; | 399 | gpmc,adv-wr-off-ns = <15>; |
387 | gpmc,oe-on-ns = <15>; | 400 | gpmc,oe-on-ns = <20>; |
388 | gpmc,oe-off-ns = <87>; | 401 | gpmc,oe-off-ns = <122>; |
389 | gpmc,we-on-ns = <0>; | 402 | gpmc,we-on-ns = <0>; |
390 | gpmc,we-off-ns = <87>; | 403 | gpmc,we-off-ns = <122>; |
391 | gpmc,rd-cycle-ns = <112>; | 404 | gpmc,rd-cycle-ns = <148>; |
392 | gpmc,wr-cycle-ns = <112>; | 405 | gpmc,wr-cycle-ns = <148>; |
393 | gpmc,access-ns = <81>; | 406 | gpmc,access-ns = <117>; |
394 | gpmc,page-burst-access-ns = <15>; | 407 | gpmc,page-burst-access-ns = <15>; |
395 | gpmc,bus-turnaround-ns = <0>; | 408 | gpmc,bus-turnaround-ns = <0>; |
396 | gpmc,cycle2cycle-delay-ns = <0>; | 409 | gpmc,cycle2cycle-delay-ns = <0>; |
397 | gpmc,wait-monitoring-ns = <0>; | 410 | gpmc,wait-monitoring-ns = <0>; |
398 | gpmc,clk-activation-ns = <5>; | 411 | gpmc,clk-activation-ns = <10>; |
399 | gpmc,wr-data-mux-bus-ns = <30>; | 412 | gpmc,wr-data-mux-bus-ns = <40>; |
400 | gpmc,wr-access-ns = <81>; | 413 | gpmc,wr-access-ns = <117>; |
401 | gpmc,sync-clk-ps = <15000>; | 414 | |
415 | gpmc,sync-clk-ps = <15000>; /* TBC; Where this value came? */ | ||
402 | 416 | ||
403 | /* | 417 | /* |
404 | * MTD partition table corresponding to Nokia's MeeGo 1.2 | 418 | * MTD partition table corresponding to Nokia's MeeGo 1.2 |
diff --git a/arch/arm/boot/dts/omap5-l4.dtsi b/arch/arm/boot/dts/omap5-l4.dtsi index 9c7e309d9c2c..0960348002ad 100644 --- a/arch/arm/boot/dts/omap5-l4.dtsi +++ b/arch/arm/boot/dts/omap5-l4.dtsi | |||
@@ -1046,8 +1046,6 @@ | |||
1046 | <SYSC_IDLE_SMART>, | 1046 | <SYSC_IDLE_SMART>, |
1047 | <SYSC_IDLE_SMART_WKUP>; | 1047 | <SYSC_IDLE_SMART_WKUP>; |
1048 | ti,syss-mask = <1>; | 1048 | ti,syss-mask = <1>; |
1049 | ti,no-reset-on-init; | ||
1050 | ti,no-idle-on-init; | ||
1051 | /* Domains (V, P, C): core, core_pwrdm, l4per_clkdm */ | 1049 | /* Domains (V, P, C): core, core_pwrdm, l4per_clkdm */ |
1052 | clocks = <&l4per_clkctrl OMAP5_UART3_CLKCTRL 0>; | 1050 | clocks = <&l4per_clkctrl OMAP5_UART3_CLKCTRL 0>; |
1053 | clock-names = "fck"; | 1051 | clock-names = "fck"; |
diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi index 3cc33f7ff7fe..3adc158a40bb 100644 --- a/arch/arm/boot/dts/r8a7743.dtsi +++ b/arch/arm/boot/dts/r8a7743.dtsi | |||
@@ -1681,15 +1681,12 @@ | |||
1681 | 1681 | ||
1682 | du: display@feb00000 { | 1682 | du: display@feb00000 { |
1683 | compatible = "renesas,du-r8a7743"; | 1683 | compatible = "renesas,du-r8a7743"; |
1684 | reg = <0 0xfeb00000 0 0x40000>, | 1684 | reg = <0 0xfeb00000 0 0x40000>; |
1685 | <0 0xfeb90000 0 0x1c>; | ||
1686 | reg-names = "du", "lvds.0"; | ||
1687 | interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, | 1685 | interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, |
1688 | <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; | 1686 | <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; |
1689 | clocks = <&cpg CPG_MOD 724>, | 1687 | clocks = <&cpg CPG_MOD 724>, |
1690 | <&cpg CPG_MOD 723>, | 1688 | <&cpg CPG_MOD 723>; |
1691 | <&cpg CPG_MOD 726>; | 1689 | clock-names = "du.0", "du.1"; |
1692 | clock-names = "du.0", "du.1", "lvds.0"; | ||
1693 | status = "disabled"; | 1690 | status = "disabled"; |
1694 | 1691 | ||
1695 | ports { | 1692 | ports { |
@@ -1704,6 +1701,33 @@ | |||
1704 | port@1 { | 1701 | port@1 { |
1705 | reg = <1>; | 1702 | reg = <1>; |
1706 | du_out_lvds0: endpoint { | 1703 | du_out_lvds0: endpoint { |
1704 | remote-endpoint = <&lvds0_in>; | ||
1705 | }; | ||
1706 | }; | ||
1707 | }; | ||
1708 | }; | ||
1709 | |||
1710 | lvds0: lvds@feb90000 { | ||
1711 | compatible = "renesas,r8a7743-lvds"; | ||
1712 | reg = <0 0xfeb90000 0 0x1c>; | ||
1713 | clocks = <&cpg CPG_MOD 726>; | ||
1714 | power-domains = <&sysc R8A7743_PD_ALWAYS_ON>; | ||
1715 | resets = <&cpg 726>; | ||
1716 | status = "disabled"; | ||
1717 | |||
1718 | ports { | ||
1719 | #address-cells = <1>; | ||
1720 | #size-cells = <0>; | ||
1721 | |||
1722 | port@0 { | ||
1723 | reg = <0>; | ||
1724 | lvds0_in: endpoint { | ||
1725 | remote-endpoint = <&du_out_lvds0>; | ||
1726 | }; | ||
1727 | }; | ||
1728 | port@1 { | ||
1729 | reg = <1>; | ||
1730 | lvds0_out: endpoint { | ||
1707 | }; | 1731 | }; |
1708 | }; | 1732 | }; |
1709 | }; | 1733 | }; |
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index 353d90f99b40..13304b8c5139 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi | |||
@@ -216,6 +216,7 @@ | |||
216 | #clock-cells = <0>; | 216 | #clock-cells = <0>; |
217 | compatible = "fixed-clock"; | 217 | compatible = "fixed-clock"; |
218 | clock-frequency = <24000000>; | 218 | clock-frequency = <24000000>; |
219 | clock-output-names = "osc24M"; | ||
219 | }; | 220 | }; |
220 | 221 | ||
221 | osc32k: clk-32k { | 222 | osc32k: clk-32k { |
diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts index 5d23667dc2d2..25540b7694d5 100644 --- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | |||
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | aliases { | 54 | aliases { |
55 | serial0 = &uart0; | 55 | serial0 = &uart0; |
56 | /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */ | 56 | ethernet0 = &emac; |
57 | ethernet1 = &sdiowifi; | 57 | ethernet1 = &sdiowifi; |
58 | }; | 58 | }; |
59 | 59 | ||
diff --git a/arch/arm/boot/dts/vf610-bk4.dts b/arch/arm/boot/dts/vf610-bk4.dts index 689c8930dce3..b08d561d6748 100644 --- a/arch/arm/boot/dts/vf610-bk4.dts +++ b/arch/arm/boot/dts/vf610-bk4.dts | |||
@@ -110,11 +110,11 @@ | |||
110 | bus-num = <3>; | 110 | bus-num = <3>; |
111 | status = "okay"; | 111 | status = "okay"; |
112 | spi-slave; | 112 | spi-slave; |
113 | #address-cells = <0>; | ||
113 | 114 | ||
114 | slave@0 { | 115 | slave { |
115 | compatible = "lwn,bk4"; | 116 | compatible = "lwn,bk4"; |
116 | spi-max-frequency = <30000000>; | 117 | spi-max-frequency = <30000000>; |
117 | reg = <0>; | ||
118 | }; | 118 | }; |
119 | }; | 119 | }; |
120 | 120 | ||
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 3b73813c6b04..23e8c93515d4 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c | |||
@@ -75,8 +75,7 @@ void __init n2100_map_io(void) | |||
75 | /* | 75 | /* |
76 | * N2100 PCI. | 76 | * N2100 PCI. |
77 | */ | 77 | */ |
78 | static int __init | 78 | static int n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
79 | n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
80 | { | 79 | { |
81 | int irq; | 80 | int irq; |
82 | 81 | ||
diff --git a/arch/arm/mach-tango/pm.c b/arch/arm/mach-tango/pm.c index 028e50c6383f..a32c3b631484 100644 --- a/arch/arm/mach-tango/pm.c +++ b/arch/arm/mach-tango/pm.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/suspend.h> | 3 | #include <linux/suspend.h> |
4 | #include <asm/suspend.h> | 4 | #include <asm/suspend.h> |
5 | #include "smc.h" | 5 | #include "smc.h" |
6 | #include "pm.h" | ||
6 | 7 | ||
7 | static int tango_pm_powerdown(unsigned long arg) | 8 | static int tango_pm_powerdown(unsigned long arg) |
8 | { | 9 | { |
@@ -24,10 +25,7 @@ static const struct platform_suspend_ops tango_pm_ops = { | |||
24 | .valid = suspend_valid_only_mem, | 25 | .valid = suspend_valid_only_mem, |
25 | }; | 26 | }; |
26 | 27 | ||
27 | static int __init tango_pm_init(void) | 28 | void __init tango_pm_init(void) |
28 | { | 29 | { |
29 | suspend_set_ops(&tango_pm_ops); | 30 | suspend_set_ops(&tango_pm_ops); |
30 | return 0; | ||
31 | } | 31 | } |
32 | |||
33 | late_initcall(tango_pm_init); | ||
diff --git a/arch/arm/mach-tango/pm.h b/arch/arm/mach-tango/pm.h new file mode 100644 index 000000000000..35ea705a0ee2 --- /dev/null +++ b/arch/arm/mach-tango/pm.h | |||
@@ -0,0 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | |||
3 | #ifdef CONFIG_SUSPEND | ||
4 | void __init tango_pm_init(void); | ||
5 | #else | ||
6 | #define tango_pm_init NULL | ||
7 | #endif | ||
diff --git a/arch/arm/mach-tango/setup.c b/arch/arm/mach-tango/setup.c index 677dd7b5efd9..824f90737b04 100644 --- a/arch/arm/mach-tango/setup.c +++ b/arch/arm/mach-tango/setup.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <asm/mach/arch.h> | 2 | #include <asm/mach/arch.h> |
3 | #include <asm/hardware/cache-l2x0.h> | 3 | #include <asm/hardware/cache-l2x0.h> |
4 | #include "smc.h" | 4 | #include "smc.h" |
5 | #include "pm.h" | ||
5 | 6 | ||
6 | static void tango_l2c_write(unsigned long val, unsigned int reg) | 7 | static void tango_l2c_write(unsigned long val, unsigned int reg) |
7 | { | 8 | { |
@@ -15,4 +16,5 @@ DT_MACHINE_START(TANGO_DT, "Sigma Tango DT") | |||
15 | .dt_compat = tango_dt_compat, | 16 | .dt_compat = tango_dt_compat, |
16 | .l2c_aux_mask = ~0, | 17 | .l2c_aux_mask = ~0, |
17 | .l2c_write_sec = tango_l2c_write, | 18 | .l2c_write_sec = tango_l2c_write, |
19 | .init_late = tango_pm_init, | ||
18 | MACHINE_END | 20 | MACHINE_END |
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c index ed36dcab80f1..f51919974183 100644 --- a/arch/arm/plat-pxa/ssp.c +++ b/arch/arm/plat-pxa/ssp.c | |||
@@ -190,8 +190,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) | |||
190 | if (ssp == NULL) | 190 | if (ssp == NULL) |
191 | return -ENODEV; | 191 | return -ENODEV; |
192 | 192 | ||
193 | iounmap(ssp->mmio_base); | ||
194 | |||
195 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 193 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
196 | release_mem_region(res->start, resource_size(res)); | 194 | release_mem_region(res->start, resource_size(res)); |
197 | 195 | ||
@@ -201,7 +199,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) | |||
201 | list_del(&ssp->node); | 199 | list_del(&ssp->node); |
202 | mutex_unlock(&ssp_lock); | 200 | mutex_unlock(&ssp_lock); |
203 | 201 | ||
204 | kfree(ssp); | ||
205 | return 0; | 202 | return 0; |
206 | } | 203 | } |
207 | 204 | ||
diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index cb44aa290e73..e1d44b903dfc 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/of_address.h> | 7 | #include <linux/of_address.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/dma-mapping.h> | ||
11 | #include <linux/vmalloc.h> | 10 | #include <linux/vmalloc.h> |
12 | #include <linux/swiotlb.h> | 11 | #include <linux/swiotlb.h> |
13 | 12 | ||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts index b0c64f75792c..8974b5a1d3b1 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts | |||
@@ -188,6 +188,7 @@ | |||
188 | reg = <0x3a3>; | 188 | reg = <0x3a3>; |
189 | interrupt-parent = <&r_intc>; | 189 | interrupt-parent = <&r_intc>; |
190 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; | 190 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; |
191 | x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */ | ||
191 | }; | 192 | }; |
192 | }; | 193 | }; |
193 | 194 | ||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index 837a03dee875..2abb335145a6 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | |||
@@ -390,7 +390,7 @@ | |||
390 | }; | 390 | }; |
391 | 391 | ||
392 | video-codec@1c0e000 { | 392 | video-codec@1c0e000 { |
393 | compatible = "allwinner,sun50i-h5-video-engine"; | 393 | compatible = "allwinner,sun50i-a64-video-engine"; |
394 | reg = <0x01c0e000 0x1000>; | 394 | reg = <0x01c0e000 0x1000>; |
395 | clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, | 395 | clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, |
396 | <&ccu CLK_DRAM_VE>; | 396 | <&ccu CLK_DRAM_VE>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi index e14e0ce7e89f..016641a41694 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | |||
@@ -187,8 +187,7 @@ | |||
187 | max-frequency = <100000000>; | 187 | max-frequency = <100000000>; |
188 | disable-wp; | 188 | disable-wp; |
189 | 189 | ||
190 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 190 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
191 | cd-inverted; | ||
192 | 191 | ||
193 | vmmc-supply = <&vddao_3v3>; | 192 | vmmc-supply = <&vddao_3v3>; |
194 | vqmmc-supply = <&vddio_boot>; | 193 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts index 8cd50b75171d..ade2ee09ae96 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | |||
@@ -305,8 +305,7 @@ | |||
305 | max-frequency = <200000000>; | 305 | max-frequency = <200000000>; |
306 | disable-wp; | 306 | disable-wp; |
307 | 307 | ||
308 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 308 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
309 | cd-inverted; | ||
310 | 309 | ||
311 | vmmc-supply = <&vddio_ao3v3>; | 310 | vmmc-supply = <&vddio_ao3v3>; |
312 | vqmmc-supply = <&vddio_tf>; | 311 | vqmmc-supply = <&vddio_tf>; |
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 4cf7f6e80c6a..25105ac96d55 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts | |||
@@ -238,8 +238,7 @@ | |||
238 | max-frequency = <100000000>; | 238 | max-frequency = <100000000>; |
239 | disable-wp; | 239 | disable-wp; |
240 | 240 | ||
241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
242 | cd-inverted; | ||
243 | 242 | ||
244 | vmmc-supply = <&vddao_3v3>; | 243 | vmmc-supply = <&vddao_3v3>; |
245 | vqmmc-supply = <&vddio_card>; | 244 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts index 2e1cd5e3a246..1cc9dc68ef00 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | |||
@@ -258,8 +258,7 @@ | |||
258 | max-frequency = <100000000>; | 258 | max-frequency = <100000000>; |
259 | disable-wp; | 259 | disable-wp; |
260 | 260 | ||
261 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 261 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
262 | cd-inverted; | ||
263 | 262 | ||
264 | vmmc-supply = <&tflash_vdd>; | 263 | vmmc-supply = <&tflash_vdd>; |
265 | vqmmc-supply = <&tf_io>; | 264 | vqmmc-supply = <&tf_io>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi index ce862266b9aa..0be0f2a5d2fe 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi | |||
@@ -196,8 +196,7 @@ | |||
196 | max-frequency = <100000000>; | 196 | max-frequency = <100000000>; |
197 | disable-wp; | 197 | disable-wp; |
198 | 198 | ||
199 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 199 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
200 | cd-inverted; | ||
201 | 200 | ||
202 | vmmc-supply = <&vddao_3v3>; | 201 | vmmc-supply = <&vddao_3v3>; |
203 | vqmmc-supply = <&vddio_card>; | 202 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi index 93a4acf2c46c..ad4d50bd9d77 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | |||
@@ -154,8 +154,7 @@ | |||
154 | max-frequency = <100000000>; | 154 | max-frequency = <100000000>; |
155 | disable-wp; | 155 | disable-wp; |
156 | 156 | ||
157 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 157 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
158 | cd-inverted; | ||
159 | 158 | ||
160 | vmmc-supply = <&vcc_3v3>; | 159 | vmmc-supply = <&vcc_3v3>; |
161 | }; | 160 | }; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi index ec09bb5792b7..2d2db783c44c 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | |||
@@ -211,8 +211,7 @@ | |||
211 | max-frequency = <100000000>; | 211 | max-frequency = <100000000>; |
212 | disable-wp; | 212 | disable-wp; |
213 | 213 | ||
214 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 214 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
215 | cd-inverted; | ||
216 | 215 | ||
217 | vmmc-supply = <&vddao_3v3>; | 216 | vmmc-supply = <&vddao_3v3>; |
218 | vqmmc-supply = <&vcc_3v3>; | 217 | vqmmc-supply = <&vcc_3v3>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts index f1c410e2da2b..796baea7a0bf 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts | |||
@@ -131,8 +131,7 @@ | |||
131 | max-frequency = <100000000>; | 131 | max-frequency = <100000000>; |
132 | disable-wp; | 132 | disable-wp; |
133 | 133 | ||
134 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 134 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
135 | cd-inverted; | ||
136 | 135 | ||
137 | vmmc-supply = <&vddao_3v3>; | 136 | vmmc-supply = <&vddao_3v3>; |
138 | vqmmc-supply = <&vddio_card>; | 137 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts index db293440e4ca..255cede7b447 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | |||
@@ -238,8 +238,7 @@ | |||
238 | max-frequency = <100000000>; | 238 | max-frequency = <100000000>; |
239 | disable-wp; | 239 | disable-wp; |
240 | 240 | ||
241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
242 | cd-inverted; | ||
243 | 242 | ||
244 | vmmc-supply = <&vcc_3v3>; | 243 | vmmc-supply = <&vcc_3v3>; |
245 | vqmmc-supply = <&vcc_card>; | 244 | vqmmc-supply = <&vcc_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts index 6739697be1de..9cbdb85fb591 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | |||
@@ -183,8 +183,7 @@ | |||
183 | max-frequency = <100000000>; | 183 | max-frequency = <100000000>; |
184 | disable-wp; | 184 | disable-wp; |
185 | 185 | ||
186 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 186 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
187 | cd-inverted; | ||
188 | 187 | ||
189 | vmmc-supply = <&vddao_3v3>; | 188 | vmmc-supply = <&vddao_3v3>; |
190 | vqmmc-supply = <&vddio_card>; | 189 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi index a1b31013ab6e..bc811a2faf42 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | |||
@@ -137,8 +137,7 @@ | |||
137 | max-frequency = <100000000>; | 137 | max-frequency = <100000000>; |
138 | disable-wp; | 138 | disable-wp; |
139 | 139 | ||
140 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 140 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
141 | cd-inverted; | ||
142 | 141 | ||
143 | vmmc-supply = <&vddao_3v3>; | 142 | vmmc-supply = <&vddao_3v3>; |
144 | vqmmc-supply = <&vddio_boot>; | 143 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts index 3c3a667a8df8..3f086ed7de05 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | |||
@@ -356,8 +356,7 @@ | |||
356 | max-frequency = <100000000>; | 356 | max-frequency = <100000000>; |
357 | disable-wp; | 357 | disable-wp; |
358 | 358 | ||
359 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 359 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
360 | cd-inverted; | ||
361 | 360 | ||
362 | vmmc-supply = <&vddao_3v3>; | 361 | vmmc-supply = <&vddao_3v3>; |
363 | vqmmc-supply = <&vddio_boot>; | 362 | vqmmc-supply = <&vddio_boot>; |
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 f7a1cffab4a8..8acfd40090d2 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts | |||
@@ -147,8 +147,7 @@ | |||
147 | max-frequency = <100000000>; | 147 | max-frequency = <100000000>; |
148 | disable-wp; | 148 | disable-wp; |
149 | 149 | ||
150 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 150 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
151 | cd-inverted; | ||
152 | 151 | ||
153 | vmmc-supply = <&vddao_3v3>; | 152 | vmmc-supply = <&vddao_3v3>; |
154 | vqmmc-supply = <&vddio_boot>; | 153 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts index 7212dc4531e4..7fa20a8ede17 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts | |||
@@ -170,8 +170,7 @@ | |||
170 | max-frequency = <100000000>; | 170 | max-frequency = <100000000>; |
171 | disable-wp; | 171 | disable-wp; |
172 | 172 | ||
173 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 173 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
174 | cd-inverted; | ||
175 | 174 | ||
176 | vmmc-supply = <&vddao_3v3>; | 175 | vmmc-supply = <&vddao_3v3>; |
177 | vqmmc-supply = <&vddio_boot>; | 176 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index 99b7495455a6..838e32cc14c9 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi | |||
@@ -404,7 +404,7 @@ | |||
404 | }; | 404 | }; |
405 | 405 | ||
406 | intc: interrupt-controller@9bc0000 { | 406 | intc: interrupt-controller@9bc0000 { |
407 | compatible = "arm,gic-v3"; | 407 | compatible = "qcom,msm8996-gic-v3", "arm,gic-v3"; |
408 | #interrupt-cells = <3>; | 408 | #interrupt-cells = <3>; |
409 | interrupt-controller; | 409 | interrupt-controller; |
410 | #redistributor-regions = <1>; | 410 | #redistributor-regions = <1>; |
diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi index 20745a8528c5..719ed9d9067d 100644 --- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi | |||
@@ -1011,6 +1011,9 @@ | |||
1011 | <&cpg CPG_CORE R8A774A1_CLK_S3D1>, | 1011 | <&cpg CPG_CORE R8A774A1_CLK_S3D1>, |
1012 | <&scif_clk>; | 1012 | <&scif_clk>; |
1013 | clock-names = "fck", "brg_int", "scif_clk"; | 1013 | clock-names = "fck", "brg_int", "scif_clk"; |
1014 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
1015 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
1016 | dma-names = "tx", "rx", "tx", "rx"; | ||
1014 | power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>; | 1017 | power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>; |
1015 | resets = <&cpg 310>; | 1018 | resets = <&cpg 310>; |
1016 | status = "disabled"; | 1019 | status = "disabled"; |
diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi index afedbf5728ec..0648d12778ed 100644 --- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi | |||
@@ -1262,6 +1262,9 @@ | |||
1262 | <&cpg CPG_CORE R8A7796_CLK_S3D1>, | 1262 | <&cpg CPG_CORE R8A7796_CLK_S3D1>, |
1263 | <&scif_clk>; | 1263 | <&scif_clk>; |
1264 | clock-names = "fck", "brg_int", "scif_clk"; | 1264 | clock-names = "fck", "brg_int", "scif_clk"; |
1265 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
1266 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
1267 | dma-names = "tx", "rx", "tx", "rx"; | ||
1265 | power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; | 1268 | power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; |
1266 | resets = <&cpg 310>; | 1269 | resets = <&cpg 310>; |
1267 | status = "disabled"; | 1270 | status = "disabled"; |
diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi index 6dc9b1fef830..4b3730f640ef 100644 --- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi | |||
@@ -1068,6 +1068,9 @@ | |||
1068 | <&cpg CPG_CORE R8A77965_CLK_S3D1>, | 1068 | <&cpg CPG_CORE R8A77965_CLK_S3D1>, |
1069 | <&scif_clk>; | 1069 | <&scif_clk>; |
1070 | clock-names = "fck", "brg_int", "scif_clk"; | 1070 | clock-names = "fck", "brg_int", "scif_clk"; |
1071 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
1072 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
1073 | dma-names = "tx", "rx", "tx", "rx"; | ||
1071 | power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; | 1074 | power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; |
1072 | resets = <&cpg 310>; | 1075 | resets = <&cpg 310>; |
1073 | status = "disabled"; | 1076 | status = "disabled"; |
diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index f2c211a6229b..58871333737a 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c | |||
@@ -120,10 +120,12 @@ static int create_dtb(struct kimage *image, | |||
120 | { | 120 | { |
121 | void *buf; | 121 | void *buf; |
122 | size_t buf_size; | 122 | size_t buf_size; |
123 | size_t cmdline_len; | ||
123 | int ret; | 124 | int ret; |
124 | 125 | ||
126 | cmdline_len = cmdline ? strlen(cmdline) : 0; | ||
125 | buf_size = fdt_totalsize(initial_boot_params) | 127 | buf_size = fdt_totalsize(initial_boot_params) |
126 | + strlen(cmdline) + DTB_EXTRA_SPACE; | 128 | + cmdline_len + DTB_EXTRA_SPACE; |
127 | 129 | ||
128 | for (;;) { | 130 | for (;;) { |
129 | buf = vmalloc(buf_size); | 131 | buf = vmalloc(buf_size); |
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index fcb1f2a6d7c6..99bb8facb5cb 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c | |||
@@ -286,74 +286,73 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level, | |||
286 | 286 | ||
287 | } | 287 | } |
288 | 288 | ||
289 | static void walk_pte(struct pg_state *st, pmd_t *pmdp, unsigned long start) | 289 | static void walk_pte(struct pg_state *st, pmd_t *pmdp, unsigned long start, |
290 | unsigned long end) | ||
290 | { | 291 | { |
291 | pte_t *ptep = pte_offset_kernel(pmdp, 0UL); | 292 | unsigned long addr = start; |
292 | unsigned long addr; | 293 | pte_t *ptep = pte_offset_kernel(pmdp, start); |
293 | unsigned i; | ||
294 | 294 | ||
295 | for (i = 0; i < PTRS_PER_PTE; i++, ptep++) { | 295 | do { |
296 | addr = start + i * PAGE_SIZE; | ||
297 | note_page(st, addr, 4, READ_ONCE(pte_val(*ptep))); | 296 | note_page(st, addr, 4, READ_ONCE(pte_val(*ptep))); |
298 | } | 297 | } while (ptep++, addr += PAGE_SIZE, addr != end); |
299 | } | 298 | } |
300 | 299 | ||
301 | static void walk_pmd(struct pg_state *st, pud_t *pudp, unsigned long start) | 300 | static void walk_pmd(struct pg_state *st, pud_t *pudp, unsigned long start, |
301 | unsigned long end) | ||
302 | { | 302 | { |
303 | pmd_t *pmdp = pmd_offset(pudp, 0UL); | 303 | unsigned long next, addr = start; |
304 | unsigned long addr; | 304 | pmd_t *pmdp = pmd_offset(pudp, start); |
305 | unsigned i; | ||
306 | 305 | ||
307 | for (i = 0; i < PTRS_PER_PMD; i++, pmdp++) { | 306 | do { |
308 | pmd_t pmd = READ_ONCE(*pmdp); | 307 | pmd_t pmd = READ_ONCE(*pmdp); |
308 | next = pmd_addr_end(addr, end); | ||
309 | 309 | ||
310 | addr = start + i * PMD_SIZE; | ||
311 | if (pmd_none(pmd) || pmd_sect(pmd)) { | 310 | if (pmd_none(pmd) || pmd_sect(pmd)) { |
312 | note_page(st, addr, 3, pmd_val(pmd)); | 311 | note_page(st, addr, 3, pmd_val(pmd)); |
313 | } else { | 312 | } else { |
314 | BUG_ON(pmd_bad(pmd)); | 313 | BUG_ON(pmd_bad(pmd)); |
315 | walk_pte(st, pmdp, addr); | 314 | walk_pte(st, pmdp, addr, next); |
316 | } | 315 | } |
317 | } | 316 | } while (pmdp++, addr = next, addr != end); |
318 | } | 317 | } |
319 | 318 | ||
320 | static void walk_pud(struct pg_state *st, pgd_t *pgdp, unsigned long start) | 319 | static void walk_pud(struct pg_state *st, pgd_t *pgdp, unsigned long start, |
320 | unsigned long end) | ||
321 | { | 321 | { |
322 | pud_t *pudp = pud_offset(pgdp, 0UL); | 322 | unsigned long next, addr = start; |
323 | unsigned long addr; | 323 | pud_t *pudp = pud_offset(pgdp, start); |
324 | unsigned i; | ||
325 | 324 | ||
326 | for (i = 0; i < PTRS_PER_PUD; i++, pudp++) { | 325 | do { |
327 | pud_t pud = READ_ONCE(*pudp); | 326 | pud_t pud = READ_ONCE(*pudp); |
327 | next = pud_addr_end(addr, end); | ||
328 | 328 | ||
329 | addr = start + i * PUD_SIZE; | ||
330 | if (pud_none(pud) || pud_sect(pud)) { | 329 | if (pud_none(pud) || pud_sect(pud)) { |
331 | note_page(st, addr, 2, pud_val(pud)); | 330 | note_page(st, addr, 2, pud_val(pud)); |
332 | } else { | 331 | } else { |
333 | BUG_ON(pud_bad(pud)); | 332 | BUG_ON(pud_bad(pud)); |
334 | walk_pmd(st, pudp, addr); | 333 | walk_pmd(st, pudp, addr, next); |
335 | } | 334 | } |
336 | } | 335 | } while (pudp++, addr = next, addr != end); |
337 | } | 336 | } |
338 | 337 | ||
339 | static void walk_pgd(struct pg_state *st, struct mm_struct *mm, | 338 | static void walk_pgd(struct pg_state *st, struct mm_struct *mm, |
340 | unsigned long start) | 339 | unsigned long start) |
341 | { | 340 | { |
342 | pgd_t *pgdp = pgd_offset(mm, 0UL); | 341 | unsigned long end = (start < TASK_SIZE_64) ? TASK_SIZE_64 : 0; |
343 | unsigned i; | 342 | unsigned long next, addr = start; |
344 | unsigned long addr; | 343 | pgd_t *pgdp = pgd_offset(mm, start); |
345 | 344 | ||
346 | for (i = 0; i < PTRS_PER_PGD; i++, pgdp++) { | 345 | do { |
347 | pgd_t pgd = READ_ONCE(*pgdp); | 346 | pgd_t pgd = READ_ONCE(*pgdp); |
347 | next = pgd_addr_end(addr, end); | ||
348 | 348 | ||
349 | addr = start + i * PGDIR_SIZE; | ||
350 | if (pgd_none(pgd)) { | 349 | if (pgd_none(pgd)) { |
351 | note_page(st, addr, 1, pgd_val(pgd)); | 350 | note_page(st, addr, 1, pgd_val(pgd)); |
352 | } else { | 351 | } else { |
353 | BUG_ON(pgd_bad(pgd)); | 352 | BUG_ON(pgd_bad(pgd)); |
354 | walk_pud(st, pgdp, addr); | 353 | walk_pud(st, pgdp, addr, next); |
355 | } | 354 | } |
356 | } | 355 | } while (pgdp++, addr = next, addr != end); |
357 | } | 356 | } |
358 | 357 | ||
359 | void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info) | 358 | void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info) |
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c index 38049357d6d3..40712e49381b 100644 --- a/arch/m68k/emu/nfblock.c +++ b/arch/m68k/emu/nfblock.c | |||
@@ -155,18 +155,22 @@ out: | |||
155 | static int __init nfhd_init(void) | 155 | static int __init nfhd_init(void) |
156 | { | 156 | { |
157 | u32 blocks, bsize; | 157 | u32 blocks, bsize; |
158 | int ret; | ||
158 | int i; | 159 | int i; |
159 | 160 | ||
160 | nfhd_id = nf_get_id("XHDI"); | 161 | nfhd_id = nf_get_id("XHDI"); |
161 | if (!nfhd_id) | 162 | if (!nfhd_id) |
162 | return -ENODEV; | 163 | return -ENODEV; |
163 | 164 | ||
164 | major_num = register_blkdev(major_num, "nfhd"); | 165 | ret = register_blkdev(major_num, "nfhd"); |
165 | if (major_num <= 0) { | 166 | if (ret < 0) { |
166 | pr_warn("nfhd: unable to get major number\n"); | 167 | pr_warn("nfhd: unable to get major number\n"); |
167 | return major_num; | 168 | return ret; |
168 | } | 169 | } |
169 | 170 | ||
171 | if (!major_num) | ||
172 | major_num = ret; | ||
173 | |||
170 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { | 174 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { |
171 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) | 175 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) |
172 | continue; | 176 | continue; |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0d14f51d0002..a84c24d894aa 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1403,6 +1403,21 @@ config LOONGSON3_ENHANCEMENT | |||
1403 | please say 'N' here. If you want a high-performance kernel to run on | 1403 | please say 'N' here. If you want a high-performance kernel to run on |
1404 | new Loongson 3 machines only, please say 'Y' here. | 1404 | new Loongson 3 machines only, please say 'Y' here. |
1405 | 1405 | ||
1406 | config CPU_LOONGSON3_WORKAROUNDS | ||
1407 | bool "Old Loongson 3 LLSC Workarounds" | ||
1408 | default y if SMP | ||
1409 | depends on CPU_LOONGSON3 | ||
1410 | help | ||
1411 | Loongson 3 processors have the llsc issues which require workarounds. | ||
1412 | Without workarounds the system may hang unexpectedly. | ||
1413 | |||
1414 | Newer Loongson 3 will fix these issues and no workarounds are needed. | ||
1415 | The workarounds have no significant side effect on them but may | ||
1416 | decrease the performance of the system so this option should be | ||
1417 | disabled unless the kernel is intended to be run on old systems. | ||
1418 | |||
1419 | If unsure, please say Y. | ||
1420 | |||
1406 | config CPU_LOONGSON2E | 1421 | config CPU_LOONGSON2E |
1407 | bool "Loongson 2E" | 1422 | bool "Loongson 2E" |
1408 | depends on SYS_HAS_CPU_LOONGSON2E | 1423 | depends on SYS_HAS_CPU_LOONGSON2E |
diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts index 50cff3cbcc6d..4f7b1fa31cf5 100644 --- a/arch/mips/boot/dts/ingenic/ci20.dts +++ b/arch/mips/boot/dts/ingenic/ci20.dts | |||
@@ -76,7 +76,7 @@ | |||
76 | status = "okay"; | 76 | status = "okay"; |
77 | 77 | ||
78 | pinctrl-names = "default"; | 78 | pinctrl-names = "default"; |
79 | pinctrl-0 = <&pins_uart2>; | 79 | pinctrl-0 = <&pins_uart3>; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | &uart4 { | 82 | &uart4 { |
@@ -196,9 +196,9 @@ | |||
196 | bias-disable; | 196 | bias-disable; |
197 | }; | 197 | }; |
198 | 198 | ||
199 | pins_uart2: uart2 { | 199 | pins_uart3: uart3 { |
200 | function = "uart2"; | 200 | function = "uart3"; |
201 | groups = "uart2-data", "uart2-hwflow"; | 201 | groups = "uart3-data", "uart3-hwflow"; |
202 | bias-disable; | 202 | bias-disable; |
203 | }; | 203 | }; |
204 | 204 | ||
diff --git a/arch/mips/boot/dts/ingenic/jz4740.dtsi b/arch/mips/boot/dts/ingenic/jz4740.dtsi index 6fb16fd24035..2beb78a62b7d 100644 --- a/arch/mips/boot/dts/ingenic/jz4740.dtsi +++ b/arch/mips/boot/dts/ingenic/jz4740.dtsi | |||
@@ -161,7 +161,7 @@ | |||
161 | #dma-cells = <2>; | 161 | #dma-cells = <2>; |
162 | 162 | ||
163 | interrupt-parent = <&intc>; | 163 | interrupt-parent = <&intc>; |
164 | interrupts = <29>; | 164 | interrupts = <20>; |
165 | 165 | ||
166 | clocks = <&cgu JZ4740_CLK_DMA>; | 166 | clocks = <&cgu JZ4740_CLK_DMA>; |
167 | 167 | ||
diff --git a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts index 2152b7ba65fb..cc8dbea0911f 100644 --- a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts +++ b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts | |||
@@ -90,11 +90,11 @@ | |||
90 | interrupts = <0>; | 90 | interrupts = <0>; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | axi_i2c: i2c@10A00000 { | 93 | axi_i2c: i2c@10a00000 { |
94 | compatible = "xlnx,xps-iic-2.00.a"; | 94 | compatible = "xlnx,xps-iic-2.00.a"; |
95 | interrupt-parent = <&axi_intc>; | 95 | interrupt-parent = <&axi_intc>; |
96 | interrupts = <4>; | 96 | interrupts = <4>; |
97 | reg = < 0x10A00000 0x10000 >; | 97 | reg = < 0x10a00000 0x10000 >; |
98 | clocks = <&ext>; | 98 | clocks = <&ext>; |
99 | xlnx,clk-freq = <0x5f5e100>; | 99 | xlnx,clk-freq = <0x5f5e100>; |
100 | xlnx,family = "Artix7"; | 100 | xlnx,family = "Artix7"; |
@@ -106,9 +106,9 @@ | |||
106 | #address-cells = <1>; | 106 | #address-cells = <1>; |
107 | #size-cells = <0>; | 107 | #size-cells = <0>; |
108 | 108 | ||
109 | ad7420@4B { | 109 | ad7420@4b { |
110 | compatible = "adi,adt7420"; | 110 | compatible = "adi,adt7420"; |
111 | reg = <0x4B>; | 111 | reg = <0x4b>; |
112 | }; | 112 | }; |
113 | } ; | 113 | } ; |
114 | }; | 114 | }; |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index 43fcd35e2957..94096299fc56 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
@@ -58,6 +58,7 @@ static __inline__ void atomic_##op(int i, atomic_t * v) \ | |||
58 | if (kernel_uses_llsc) { \ | 58 | if (kernel_uses_llsc) { \ |
59 | int temp; \ | 59 | int temp; \ |
60 | \ | 60 | \ |
61 | loongson_llsc_mb(); \ | ||
61 | __asm__ __volatile__( \ | 62 | __asm__ __volatile__( \ |
62 | " .set push \n" \ | 63 | " .set push \n" \ |
63 | " .set "MIPS_ISA_LEVEL" \n" \ | 64 | " .set "MIPS_ISA_LEVEL" \n" \ |
@@ -85,6 +86,7 @@ static __inline__ int atomic_##op##_return_relaxed(int i, atomic_t * v) \ | |||
85 | if (kernel_uses_llsc) { \ | 86 | if (kernel_uses_llsc) { \ |
86 | int temp; \ | 87 | int temp; \ |
87 | \ | 88 | \ |
89 | loongson_llsc_mb(); \ | ||
88 | __asm__ __volatile__( \ | 90 | __asm__ __volatile__( \ |
89 | " .set push \n" \ | 91 | " .set push \n" \ |
90 | " .set "MIPS_ISA_LEVEL" \n" \ | 92 | " .set "MIPS_ISA_LEVEL" \n" \ |
@@ -118,6 +120,7 @@ static __inline__ int atomic_fetch_##op##_relaxed(int i, atomic_t * v) \ | |||
118 | if (kernel_uses_llsc) { \ | 120 | if (kernel_uses_llsc) { \ |
119 | int temp; \ | 121 | int temp; \ |
120 | \ | 122 | \ |
123 | loongson_llsc_mb(); \ | ||
121 | __asm__ __volatile__( \ | 124 | __asm__ __volatile__( \ |
122 | " .set push \n" \ | 125 | " .set push \n" \ |
123 | " .set "MIPS_ISA_LEVEL" \n" \ | 126 | " .set "MIPS_ISA_LEVEL" \n" \ |
@@ -256,6 +259,7 @@ static __inline__ void atomic64_##op(long i, atomic64_t * v) \ | |||
256 | if (kernel_uses_llsc) { \ | 259 | if (kernel_uses_llsc) { \ |
257 | long temp; \ | 260 | long temp; \ |
258 | \ | 261 | \ |
262 | loongson_llsc_mb(); \ | ||
259 | __asm__ __volatile__( \ | 263 | __asm__ __volatile__( \ |
260 | " .set push \n" \ | 264 | " .set push \n" \ |
261 | " .set "MIPS_ISA_LEVEL" \n" \ | 265 | " .set "MIPS_ISA_LEVEL" \n" \ |
@@ -283,6 +287,7 @@ static __inline__ long atomic64_##op##_return_relaxed(long i, atomic64_t * v) \ | |||
283 | if (kernel_uses_llsc) { \ | 287 | if (kernel_uses_llsc) { \ |
284 | long temp; \ | 288 | long temp; \ |
285 | \ | 289 | \ |
290 | loongson_llsc_mb(); \ | ||
286 | __asm__ __volatile__( \ | 291 | __asm__ __volatile__( \ |
287 | " .set push \n" \ | 292 | " .set push \n" \ |
288 | " .set "MIPS_ISA_LEVEL" \n" \ | 293 | " .set "MIPS_ISA_LEVEL" \n" \ |
@@ -316,6 +321,7 @@ static __inline__ long atomic64_fetch_##op##_relaxed(long i, atomic64_t * v) \ | |||
316 | if (kernel_uses_llsc) { \ | 321 | if (kernel_uses_llsc) { \ |
317 | long temp; \ | 322 | long temp; \ |
318 | \ | 323 | \ |
324 | loongson_llsc_mb(); \ | ||
319 | __asm__ __volatile__( \ | 325 | __asm__ __volatile__( \ |
320 | " .set push \n" \ | 326 | " .set push \n" \ |
321 | " .set "MIPS_ISA_LEVEL" \n" \ | 327 | " .set "MIPS_ISA_LEVEL" \n" \ |
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h index a5eb1bb199a7..b7f6ac5e513c 100644 --- a/arch/mips/include/asm/barrier.h +++ b/arch/mips/include/asm/barrier.h | |||
@@ -222,6 +222,42 @@ | |||
222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() | 222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() |
223 | #define __smp_mb__after_atomic() smp_llsc_mb() | 223 | #define __smp_mb__after_atomic() smp_llsc_mb() |
224 | 224 | ||
225 | /* | ||
226 | * Some Loongson 3 CPUs have a bug wherein execution of a memory access (load, | ||
227 | * store or pref) in between an ll & sc can cause the sc instruction to | ||
228 | * erroneously succeed, breaking atomicity. Whilst it's unusual to write code | ||
229 | * containing such sequences, this bug bites harder than we might otherwise | ||
230 | * expect due to reordering & speculation: | ||
231 | * | ||
232 | * 1) A memory access appearing prior to the ll in program order may actually | ||
233 | * be executed after the ll - this is the reordering case. | ||
234 | * | ||
235 | * In order to avoid this we need to place a memory barrier (ie. a sync | ||
236 | * instruction) prior to every ll instruction, in between it & any earlier | ||
237 | * memory access instructions. Many of these cases are already covered by | ||
238 | * smp_mb__before_llsc() but for the remaining cases, typically ones in | ||
239 | * which multiple CPUs may operate on a memory location but ordering is not | ||
240 | * usually guaranteed, we use loongson_llsc_mb() below. | ||
241 | * | ||
242 | * This reordering case is fixed by 3A R2 CPUs, ie. 3A2000 models and later. | ||
243 | * | ||
244 | * 2) If a conditional branch exists between an ll & sc with a target outside | ||
245 | * of the ll-sc loop, for example an exit upon value mismatch in cmpxchg() | ||
246 | * or similar, then misprediction of the branch may allow speculative | ||
247 | * execution of memory accesses from outside of the ll-sc loop. | ||
248 | * | ||
249 | * In order to avoid this we need a memory barrier (ie. a sync instruction) | ||
250 | * at each affected branch target, for which we also use loongson_llsc_mb() | ||
251 | * defined below. | ||
252 | * | ||
253 | * This case affects all current Loongson 3 CPUs. | ||
254 | */ | ||
255 | #ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS /* Loongson-3's LLSC workaround */ | ||
256 | #define loongson_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory") | ||
257 | #else | ||
258 | #define loongson_llsc_mb() do { } while (0) | ||
259 | #endif | ||
260 | |||
225 | #include <asm-generic/barrier.h> | 261 | #include <asm-generic/barrier.h> |
226 | 262 | ||
227 | #endif /* __ASM_BARRIER_H */ | 263 | #endif /* __ASM_BARRIER_H */ |
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index c4675957b21b..830c93a010c3 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h | |||
@@ -69,6 +69,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); | 69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); |
70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
72 | loongson_llsc_mb(); | ||
72 | do { | 73 | do { |
73 | __asm__ __volatile__( | 74 | __asm__ __volatile__( |
74 | " " __LL "%0, %1 # set_bit \n" | 75 | " " __LL "%0, %1 # set_bit \n" |
@@ -79,6 +80,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
79 | } while (unlikely(!temp)); | 80 | } while (unlikely(!temp)); |
80 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 81 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
81 | } else if (kernel_uses_llsc) { | 82 | } else if (kernel_uses_llsc) { |
83 | loongson_llsc_mb(); | ||
82 | do { | 84 | do { |
83 | __asm__ __volatile__( | 85 | __asm__ __volatile__( |
84 | " .set push \n" | 86 | " .set push \n" |
@@ -123,6 +125,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
123 | : "ir" (~(1UL << bit))); | 125 | : "ir" (~(1UL << bit))); |
124 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 126 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
125 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 127 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
128 | loongson_llsc_mb(); | ||
126 | do { | 129 | do { |
127 | __asm__ __volatile__( | 130 | __asm__ __volatile__( |
128 | " " __LL "%0, %1 # clear_bit \n" | 131 | " " __LL "%0, %1 # clear_bit \n" |
@@ -133,6 +136,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
133 | } while (unlikely(!temp)); | 136 | } while (unlikely(!temp)); |
134 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 137 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
135 | } else if (kernel_uses_llsc) { | 138 | } else if (kernel_uses_llsc) { |
139 | loongson_llsc_mb(); | ||
136 | do { | 140 | do { |
137 | __asm__ __volatile__( | 141 | __asm__ __volatile__( |
138 | " .set push \n" | 142 | " .set push \n" |
@@ -193,6 +197,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | |||
193 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); | 197 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); |
194 | unsigned long temp; | 198 | unsigned long temp; |
195 | 199 | ||
200 | loongson_llsc_mb(); | ||
196 | do { | 201 | do { |
197 | __asm__ __volatile__( | 202 | __asm__ __volatile__( |
198 | " .set push \n" | 203 | " .set push \n" |
diff --git a/arch/mips/include/asm/futex.h b/arch/mips/include/asm/futex.h index c14d798f3888..b83b0397462d 100644 --- a/arch/mips/include/asm/futex.h +++ b/arch/mips/include/asm/futex.h | |||
@@ -50,6 +50,7 @@ | |||
50 | "i" (-EFAULT) \ | 50 | "i" (-EFAULT) \ |
51 | : "memory"); \ | 51 | : "memory"); \ |
52 | } else if (cpu_has_llsc) { \ | 52 | } else if (cpu_has_llsc) { \ |
53 | loongson_llsc_mb(); \ | ||
53 | __asm__ __volatile__( \ | 54 | __asm__ __volatile__( \ |
54 | " .set push \n" \ | 55 | " .set push \n" \ |
55 | " .set noat \n" \ | 56 | " .set noat \n" \ |
@@ -163,6 +164,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
163 | "i" (-EFAULT) | 164 | "i" (-EFAULT) |
164 | : "memory"); | 165 | : "memory"); |
165 | } else if (cpu_has_llsc) { | 166 | } else if (cpu_has_llsc) { |
167 | loongson_llsc_mb(); | ||
166 | __asm__ __volatile__( | 168 | __asm__ __volatile__( |
167 | "# futex_atomic_cmpxchg_inatomic \n" | 169 | "# futex_atomic_cmpxchg_inatomic \n" |
168 | " .set push \n" | 170 | " .set push \n" |
@@ -192,6 +194,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
192 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), | 194 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), |
193 | "i" (-EFAULT) | 195 | "i" (-EFAULT) |
194 | : "memory"); | 196 | : "memory"); |
197 | loongson_llsc_mb(); | ||
195 | } else | 198 | } else |
196 | return -ENOSYS; | 199 | return -ENOSYS; |
197 | 200 | ||
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 57933fc8fd98..910851c62db3 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
@@ -228,6 +228,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
229 | : [global] "r" (page_global)); | 229 | : [global] "r" (page_global)); |
230 | } else if (kernel_uses_llsc) { | 230 | } else if (kernel_uses_llsc) { |
231 | loongson_llsc_mb(); | ||
231 | __asm__ __volatile__ ( | 232 | __asm__ __volatile__ ( |
232 | " .set push \n" | 233 | " .set push \n" |
233 | " .set "MIPS_ISA_ARCH_LEVEL" \n" | 234 | " .set "MIPS_ISA_ARCH_LEVEL" \n" |
@@ -242,6 +243,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
242 | " .set pop \n" | 243 | " .set pop \n" |
243 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 244 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
244 | : [global] "r" (page_global)); | 245 | : [global] "r" (page_global)); |
246 | loongson_llsc_mb(); | ||
245 | } | 247 | } |
246 | #else /* !CONFIG_SMP */ | 248 | #else /* !CONFIG_SMP */ |
247 | if (pte_none(*buddy)) | 249 | if (pte_none(*buddy)) |
diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c index 8f5bd04f320a..7f3f136572de 100644 --- a/arch/mips/kernel/mips-cm.c +++ b/arch/mips/kernel/mips-cm.c | |||
@@ -457,5 +457,5 @@ void mips_cm_error_report(void) | |||
457 | } | 457 | } |
458 | 458 | ||
459 | /* reprime cause register */ | 459 | /* reprime cause register */ |
460 | write_gcr_error_cause(0); | 460 | write_gcr_error_cause(cm_error); |
461 | } | 461 | } |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 6829a064aac8..339870ed92f7 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -371,7 +371,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip, int *frame_size) | |||
371 | static int get_frame_info(struct mips_frame_info *info) | 371 | static int get_frame_info(struct mips_frame_info *info) |
372 | { | 372 | { |
373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); | 373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); |
374 | union mips_instruction insn, *ip, *ip_end; | 374 | union mips_instruction insn, *ip; |
375 | const unsigned int max_insns = 128; | 375 | const unsigned int max_insns = 128; |
376 | unsigned int last_insn_size = 0; | 376 | unsigned int last_insn_size = 0; |
377 | unsigned int i; | 377 | unsigned int i; |
@@ -384,10 +384,9 @@ static int get_frame_info(struct mips_frame_info *info) | |||
384 | if (!ip) | 384 | if (!ip) |
385 | goto err; | 385 | goto err; |
386 | 386 | ||
387 | ip_end = (void *)ip + info->func_size; | 387 | for (i = 0; i < max_insns; i++) { |
388 | |||
389 | for (i = 0; i < max_insns && ip < ip_end; i++) { | ||
390 | ip = (void *)ip + last_insn_size; | 388 | ip = (void *)ip + last_insn_size; |
389 | |||
391 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { | 390 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { |
392 | insn.word = ip->halfword[0] << 16; | 391 | insn.word = ip->halfword[0] << 16; |
393 | last_insn_size = 2; | 392 | last_insn_size = 2; |
diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform index 0fce4608aa88..c1a4d4dc4665 100644 --- a/arch/mips/loongson64/Platform +++ b/arch/mips/loongson64/Platform | |||
@@ -23,6 +23,29 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS | |||
23 | endif | 23 | endif |
24 | 24 | ||
25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap | 25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap |
26 | |||
27 | # | ||
28 | # Some versions of binutils, not currently mainline as of 2019/02/04, support | ||
29 | # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction | ||
30 | # to work around a CPU bug (see loongson_llsc_mb() in asm/barrier.h for a | ||
31 | # description). | ||
32 | # | ||
33 | # We disable this in order to prevent the assembler meddling with the | ||
34 | # instruction that labels refer to, ie. if we label an ll instruction: | ||
35 | # | ||
36 | # 1: ll v0, 0(a0) | ||
37 | # | ||
38 | # ...then with the assembler fix applied the label may actually point at a sync | ||
39 | # instruction inserted by the assembler, and if we were using the label in an | ||
40 | # exception table the table would no longer contain the address of the ll | ||
41 | # instruction. | ||
42 | # | ||
43 | # Avoid this by explicitly disabling that assembler behaviour. If upstream | ||
44 | # binutils does not merge support for the flag then we can revisit & remove | ||
45 | # this later - for now it ensures vendor toolchains don't cause problems. | ||
46 | # | ||
47 | cflags-$(CONFIG_CPU_LOONGSON3) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) | ||
48 | |||
26 | # | 49 | # |
27 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a | 50 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a |
28 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open | 51 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open |
diff --git a/arch/mips/loongson64/common/reset.c b/arch/mips/loongson64/common/reset.c index a60715e11306..b26892ce871c 100644 --- a/arch/mips/loongson64/common/reset.c +++ b/arch/mips/loongson64/common/reset.c | |||
@@ -59,7 +59,12 @@ static void loongson_poweroff(void) | |||
59 | { | 59 | { |
60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE | 60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE |
61 | mach_prepare_shutdown(); | 61 | mach_prepare_shutdown(); |
62 | unreachable(); | 62 | |
63 | /* | ||
64 | * It needs a wait loop here, but mips/kernel/reset.c already calls | ||
65 | * a generic delay loop, machine_hang(), so simply return. | ||
66 | */ | ||
67 | return; | ||
63 | #else | 68 | #else |
64 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; | 69 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; |
65 | 70 | ||
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 37b1cb246332..65b6e85447b1 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -932,6 +932,8 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, | |||
932 | * to mimic that here by taking a load/istream page | 932 | * to mimic that here by taking a load/istream page |
933 | * fault. | 933 | * fault. |
934 | */ | 934 | */ |
935 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
936 | uasm_i_sync(p, 0); | ||
935 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); | 937 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); |
936 | uasm_i_jr(p, ptr); | 938 | uasm_i_jr(p, ptr); |
937 | 939 | ||
@@ -1646,6 +1648,8 @@ static void | |||
1646 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) | 1648 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) |
1647 | { | 1649 | { |
1648 | #ifdef CONFIG_SMP | 1650 | #ifdef CONFIG_SMP |
1651 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
1652 | uasm_i_sync(p, 0); | ||
1649 | # ifdef CONFIG_PHYS_ADDR_T_64BIT | 1653 | # ifdef CONFIG_PHYS_ADDR_T_64BIT |
1650 | if (cpu_has_64bits) | 1654 | if (cpu_has_64bits) |
1651 | uasm_i_lld(p, pte, 0, ptr); | 1655 | uasm_i_lld(p, pte, 0, ptr); |
@@ -2259,6 +2263,8 @@ static void build_r4000_tlb_load_handler(void) | |||
2259 | #endif | 2263 | #endif |
2260 | 2264 | ||
2261 | uasm_l_nopage_tlbl(&l, p); | 2265 | uasm_l_nopage_tlbl(&l, p); |
2266 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
2267 | uasm_i_sync(&p, 0); | ||
2262 | build_restore_work_registers(&p); | 2268 | build_restore_work_registers(&p); |
2263 | #ifdef CONFIG_CPU_MICROMIPS | 2269 | #ifdef CONFIG_CPU_MICROMIPS |
2264 | if ((unsigned long)tlb_do_page_fault_0 & 1) { | 2270 | if ((unsigned long)tlb_do_page_fault_0 & 1) { |
@@ -2313,6 +2319,8 @@ static void build_r4000_tlb_store_handler(void) | |||
2313 | #endif | 2319 | #endif |
2314 | 2320 | ||
2315 | uasm_l_nopage_tlbs(&l, p); | 2321 | uasm_l_nopage_tlbs(&l, p); |
2322 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
2323 | uasm_i_sync(&p, 0); | ||
2316 | build_restore_work_registers(&p); | 2324 | build_restore_work_registers(&p); |
2317 | #ifdef CONFIG_CPU_MICROMIPS | 2325 | #ifdef CONFIG_CPU_MICROMIPS |
2318 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2326 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
@@ -2368,6 +2376,8 @@ static void build_r4000_tlb_modify_handler(void) | |||
2368 | #endif | 2376 | #endif |
2369 | 2377 | ||
2370 | uasm_l_nopage_tlbm(&l, p); | 2378 | uasm_l_nopage_tlbm(&l, p); |
2379 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
2380 | uasm_i_sync(&p, 0); | ||
2371 | build_restore_work_registers(&p); | 2381 | build_restore_work_registers(&p); |
2372 | #ifdef CONFIG_CPU_MICROMIPS | 2382 | #ifdef CONFIG_CPU_MICROMIPS |
2373 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2383 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c index 5017d5843c5a..fc29b85cfa92 100644 --- a/arch/mips/pci/pci-octeon.c +++ b/arch/mips/pci/pci-octeon.c | |||
@@ -568,6 +568,11 @@ static int __init octeon_pci_setup(void) | |||
568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) | 568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) |
569 | return 0; | 569 | return 0; |
570 | 570 | ||
571 | if (!octeon_is_pci_host()) { | ||
572 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
573 | return 0; | ||
574 | } | ||
575 | |||
571 | /* Point pcibios_map_irq() to the PCI version of it */ | 576 | /* Point pcibios_map_irq() to the PCI version of it */ |
572 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; | 577 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; |
573 | 578 | ||
@@ -579,11 +584,6 @@ static int __init octeon_pci_setup(void) | |||
579 | else | 584 | else |
580 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; | 585 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; |
581 | 586 | ||
582 | if (!octeon_is_pci_host()) { | ||
583 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
584 | return 0; | ||
585 | } | ||
586 | |||
587 | /* PCI I/O and PCI MEM values */ | 587 | /* PCI I/O and PCI MEM values */ |
588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); | 588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); |
589 | ioport_resource.start = 0; | 589 | ioport_resource.start = 0; |
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile index f6fd340e39c2..0ede4deb8181 100644 --- a/arch/mips/vdso/Makefile +++ b/arch/mips/vdso/Makefile | |||
@@ -8,6 +8,7 @@ ccflags-vdso := \ | |||
8 | $(filter -E%,$(KBUILD_CFLAGS)) \ | 8 | $(filter -E%,$(KBUILD_CFLAGS)) \ |
9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ | 9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ |
10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ | 10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ |
11 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ | ||
11 | -D__VDSO__ | 12 | -D__VDSO__ |
12 | 13 | ||
13 | ifdef CONFIG_CC_IS_CLANG | 14 | ifdef CONFIG_CC_IS_CLANG |
@@ -129,7 +130,7 @@ $(obj)/%-o32.o: $(src)/%.c FORCE | |||
129 | $(call cmd,force_checksrc) | 130 | $(call cmd,force_checksrc) |
130 | $(call if_changed_rule,cc_o_c) | 131 | $(call if_changed_rule,cc_o_c) |
131 | 132 | ||
132 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32 | 133 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32 |
133 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE | 134 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE |
134 | $(call if_changed_dep,cpp_lds_S) | 135 | $(call if_changed_dep,cpp_lds_S) |
135 | 136 | ||
@@ -169,7 +170,7 @@ $(obj)/%-n32.o: $(src)/%.c FORCE | |||
169 | $(call cmd,force_checksrc) | 170 | $(call cmd,force_checksrc) |
170 | $(call if_changed_rule,cc_o_c) | 171 | $(call if_changed_rule,cc_o_c) |
171 | 172 | ||
172 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32 | 173 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32 |
173 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE | 174 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE |
174 | $(call if_changed_dep,cpp_lds_S) | 175 | $(call if_changed_dep,cpp_lds_S) |
175 | 176 | ||
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 2e6ada28da64..c9bfe526ca9d 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h | |||
@@ -1258,21 +1258,13 @@ extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, | |||
1258 | 1258 | ||
1259 | #define pmd_move_must_withdraw pmd_move_must_withdraw | 1259 | #define pmd_move_must_withdraw pmd_move_must_withdraw |
1260 | struct spinlock; | 1260 | struct spinlock; |
1261 | static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | 1261 | extern int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, |
1262 | struct spinlock *old_pmd_ptl, | 1262 | struct spinlock *old_pmd_ptl, |
1263 | struct vm_area_struct *vma) | 1263 | struct vm_area_struct *vma); |
1264 | { | 1264 | /* |
1265 | if (radix_enabled()) | 1265 | * Hash translation mode use the deposited table to store hash pte |
1266 | return false; | 1266 | * slot information. |
1267 | /* | 1267 | */ |
1268 | * Archs like ppc64 use pgtable to store per pmd | ||
1269 | * specific information. So when we switch the pmd, | ||
1270 | * we should also withdraw and deposit the pgtable | ||
1271 | */ | ||
1272 | return true; | ||
1273 | } | ||
1274 | |||
1275 | |||
1276 | #define arch_needs_pgtable_deposit arch_needs_pgtable_deposit | 1268 | #define arch_needs_pgtable_deposit arch_needs_pgtable_deposit |
1277 | static inline bool arch_needs_pgtable_deposit(void) | 1269 | static inline bool arch_needs_pgtable_deposit(void) |
1278 | { | 1270 | { |
diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c index f3c31f5e1026..ecd31569a120 100644 --- a/arch/powerpc/mm/pgtable-book3s64.c +++ b/arch/powerpc/mm/pgtable-book3s64.c | |||
@@ -400,3 +400,25 @@ void arch_report_meminfo(struct seq_file *m) | |||
400 | atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20); | 400 | atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20); |
401 | } | 401 | } |
402 | #endif /* CONFIG_PROC_FS */ | 402 | #endif /* CONFIG_PROC_FS */ |
403 | |||
404 | /* | ||
405 | * For hash translation mode, we use the deposited table to store hash slot | ||
406 | * information and they are stored at PTRS_PER_PMD offset from related pmd | ||
407 | * location. Hence a pmd move requires deposit and withdraw. | ||
408 | * | ||
409 | * For radix translation with split pmd ptl, we store the deposited table in the | ||
410 | * pmd page. Hence if we have different pmd page we need to withdraw during pmd | ||
411 | * move. | ||
412 | * | ||
413 | * With hash we use deposited table always irrespective of anon or not. | ||
414 | * With radix we use deposited table only for anonymous mapping. | ||
415 | */ | ||
416 | int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | ||
417 | struct spinlock *old_pmd_ptl, | ||
418 | struct vm_area_struct *vma) | ||
419 | { | ||
420 | if (radix_enabled()) | ||
421 | return (new_pmd_ptl != old_pmd_ptl) && vma_is_anonymous(vma); | ||
422 | |||
423 | return true; | ||
424 | } | ||
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c index 7d6457ab5d34..bba281b1fe1b 100644 --- a/arch/powerpc/platforms/pseries/papr_scm.c +++ b/arch/powerpc/platforms/pseries/papr_scm.c | |||
@@ -43,6 +43,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p) | |||
43 | { | 43 | { |
44 | unsigned long ret[PLPAR_HCALL_BUFSIZE]; | 44 | unsigned long ret[PLPAR_HCALL_BUFSIZE]; |
45 | uint64_t rc, token; | 45 | uint64_t rc, token; |
46 | uint64_t saved = 0; | ||
46 | 47 | ||
47 | /* | 48 | /* |
48 | * When the hypervisor cannot map all the requested memory in a single | 49 | * When the hypervisor cannot map all the requested memory in a single |
@@ -56,6 +57,8 @@ static int drc_pmem_bind(struct papr_scm_priv *p) | |||
56 | rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, | 57 | rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, |
57 | p->blocks, BIND_ANY_ADDR, token); | 58 | p->blocks, BIND_ANY_ADDR, token); |
58 | token = ret[0]; | 59 | token = ret[0]; |
60 | if (!saved) | ||
61 | saved = ret[1]; | ||
59 | cond_resched(); | 62 | cond_resched(); |
60 | } while (rc == H_BUSY); | 63 | } while (rc == H_BUSY); |
61 | 64 | ||
@@ -64,7 +67,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p) | |||
64 | return -ENXIO; | 67 | return -ENXIO; |
65 | } | 68 | } |
66 | 69 | ||
67 | p->bound_addr = ret[1]; | 70 | p->bound_addr = saved; |
68 | 71 | ||
69 | dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res); | 72 | dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res); |
70 | 73 | ||
diff --git a/arch/riscv/include/asm/pgtable-bits.h b/arch/riscv/include/asm/pgtable-bits.h index 2fa2942be221..470755cb7558 100644 --- a/arch/riscv/include/asm/pgtable-bits.h +++ b/arch/riscv/include/asm/pgtable-bits.h | |||
@@ -35,6 +35,12 @@ | |||
35 | #define _PAGE_SPECIAL _PAGE_SOFT | 35 | #define _PAGE_SPECIAL _PAGE_SOFT |
36 | #define _PAGE_TABLE _PAGE_PRESENT | 36 | #define _PAGE_TABLE _PAGE_PRESENT |
37 | 37 | ||
38 | /* | ||
39 | * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to | ||
40 | * distinguish them from swapped out pages | ||
41 | */ | ||
42 | #define _PAGE_PROT_NONE _PAGE_READ | ||
43 | |||
38 | #define _PAGE_PFN_SHIFT 10 | 44 | #define _PAGE_PFN_SHIFT 10 |
39 | 45 | ||
40 | /* Set of bits to preserve across pte_modify() */ | 46 | /* Set of bits to preserve across pte_modify() */ |
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 16301966d65b..a8179a8c1491 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h | |||
@@ -44,7 +44,7 @@ | |||
44 | /* Page protection bits */ | 44 | /* Page protection bits */ |
45 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) | 45 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) |
46 | 46 | ||
47 | #define PAGE_NONE __pgprot(0) | 47 | #define PAGE_NONE __pgprot(_PAGE_PROT_NONE) |
48 | #define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ) | 48 | #define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ) |
49 | #define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE) | 49 | #define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE) |
50 | #define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC) | 50 | #define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC) |
@@ -98,7 +98,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | |||
98 | 98 | ||
99 | static inline int pmd_present(pmd_t pmd) | 99 | static inline int pmd_present(pmd_t pmd) |
100 | { | 100 | { |
101 | return (pmd_val(pmd) & _PAGE_PRESENT); | 101 | return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
102 | } | 102 | } |
103 | 103 | ||
104 | static inline int pmd_none(pmd_t pmd) | 104 | static inline int pmd_none(pmd_t pmd) |
@@ -178,7 +178,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long addr) | |||
178 | 178 | ||
179 | static inline int pte_present(pte_t pte) | 179 | static inline int pte_present(pte_t pte) |
180 | { | 180 | { |
181 | return (pte_val(pte) & _PAGE_PRESENT); | 181 | return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
182 | } | 182 | } |
183 | 183 | ||
184 | static inline int pte_none(pte_t pte) | 184 | static inline int pte_none(pte_t pte) |
@@ -380,7 +380,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, | |||
380 | * | 380 | * |
381 | * Format of swap PTE: | 381 | * Format of swap PTE: |
382 | * bit 0: _PAGE_PRESENT (zero) | 382 | * bit 0: _PAGE_PRESENT (zero) |
383 | * bit 1: reserved for future use (zero) | 383 | * bit 1: _PAGE_PROT_NONE (zero) |
384 | * bits 2 to 6: swap type | 384 | * bits 2 to 6: swap type |
385 | * bits 7 to XLEN-1: swap offset | 385 | * bits 7 to XLEN-1: swap offset |
386 | */ | 386 | */ |
diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index 1e1395d63dab..65df1dfdc303 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S | |||
@@ -18,8 +18,6 @@ | |||
18 | #include <asm/cache.h> | 18 | #include <asm/cache.h> |
19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
20 | 20 | ||
21 | #define MAX_BYTES_PER_LONG 0x10 | ||
22 | |||
23 | OUTPUT_ARCH(riscv) | 21 | OUTPUT_ARCH(riscv) |
24 | ENTRY(_start) | 22 | ENTRY(_start) |
25 | 23 | ||
@@ -76,6 +74,8 @@ SECTIONS | |||
76 | *(.sbss*) | 74 | *(.sbss*) |
77 | } | 75 | } |
78 | 76 | ||
77 | BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0) | ||
78 | |||
79 | EXCEPTION_TABLE(0x10) | 79 | EXCEPTION_TABLE(0x10) |
80 | NOTES | 80 | NOTES |
81 | 81 | ||
@@ -83,10 +83,6 @@ SECTIONS | |||
83 | *(.rel.dyn*) | 83 | *(.rel.dyn*) |
84 | } | 84 | } |
85 | 85 | ||
86 | BSS_SECTION(MAX_BYTES_PER_LONG, | ||
87 | MAX_BYTES_PER_LONG, | ||
88 | MAX_BYTES_PER_LONG) | ||
89 | |||
90 | _end = .; | 86 | _end = .; |
91 | 87 | ||
92 | STABS_DEBUG | 88 | STABS_DEBUG |
diff --git a/arch/s390/kernel/swsusp.S b/arch/s390/kernel/swsusp.S index 537f97fde37f..b6796e616812 100644 --- a/arch/s390/kernel/swsusp.S +++ b/arch/s390/kernel/swsusp.S | |||
@@ -30,10 +30,10 @@ | |||
30 | .section .text | 30 | .section .text |
31 | ENTRY(swsusp_arch_suspend) | 31 | ENTRY(swsusp_arch_suspend) |
32 | lg %r1,__LC_NODAT_STACK | 32 | lg %r1,__LC_NODAT_STACK |
33 | aghi %r1,-STACK_FRAME_OVERHEAD | ||
34 | stmg %r6,%r15,__SF_GPRS(%r1) | 33 | stmg %r6,%r15,__SF_GPRS(%r1) |
34 | aghi %r1,-STACK_FRAME_OVERHEAD | ||
35 | stg %r15,__SF_BACKCHAIN(%r1) | 35 | stg %r15,__SF_BACKCHAIN(%r1) |
36 | lgr %r1,%r15 | 36 | lgr %r15,%r1 |
37 | 37 | ||
38 | /* Store FPU registers */ | 38 | /* Store FPU registers */ |
39 | brasl %r14,save_fpu_regs | 39 | brasl %r14,save_fpu_regs |
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index a966d7bfac57..4266a4de3160 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -382,7 +382,9 @@ static void zpci_irq_handler(struct airq_struct *airq) | |||
382 | if (ai == -1UL) | 382 | if (ai == -1UL) |
383 | break; | 383 | break; |
384 | inc_irq_stat(IRQIO_MSI); | 384 | inc_irq_stat(IRQIO_MSI); |
385 | airq_iv_lock(aibv, ai); | ||
385 | generic_handle_irq(airq_iv_get_data(aibv, ai)); | 386 | generic_handle_irq(airq_iv_get_data(aibv, ai)); |
387 | airq_iv_unlock(aibv, ai); | ||
386 | } | 388 | } |
387 | } | 389 | } |
388 | } | 390 | } |
@@ -408,7 +410,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
408 | zdev->aisb = aisb; | 410 | zdev->aisb = aisb; |
409 | 411 | ||
410 | /* Create adapter interrupt vector */ | 412 | /* Create adapter interrupt vector */ |
411 | zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA); | 413 | zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK); |
412 | if (!zdev->aibv) | 414 | if (!zdev->aibv) |
413 | return -ENOMEM; | 415 | return -ENOMEM; |
414 | 416 | ||
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index f105ae8651c9..f62e347862cc 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
@@ -602,10 +602,12 @@ ENTRY(trampoline_32bit_src) | |||
602 | 3: | 602 | 3: |
603 | /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ | 603 | /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ |
604 | pushl %ecx | 604 | pushl %ecx |
605 | pushl %edx | ||
605 | movl $MSR_EFER, %ecx | 606 | movl $MSR_EFER, %ecx |
606 | rdmsr | 607 | rdmsr |
607 | btsl $_EFER_LME, %eax | 608 | btsl $_EFER_LME, %eax |
608 | wrmsr | 609 | wrmsr |
610 | popl %edx | ||
609 | popl %ecx | 611 | popl %ecx |
610 | 612 | ||
611 | /* Enable PAE and LA57 (if required) paging modes */ | 613 | /* Enable PAE and LA57 (if required) paging modes */ |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 40e12cfc87f6..daafb893449b 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
@@ -3559,6 +3559,14 @@ static void free_excl_cntrs(int cpu) | |||
3559 | 3559 | ||
3560 | static void intel_pmu_cpu_dying(int cpu) | 3560 | static void intel_pmu_cpu_dying(int cpu) |
3561 | { | 3561 | { |
3562 | fini_debug_store_on_cpu(cpu); | ||
3563 | |||
3564 | if (x86_pmu.counter_freezing) | ||
3565 | disable_counter_freeze(); | ||
3566 | } | ||
3567 | |||
3568 | static void intel_pmu_cpu_dead(int cpu) | ||
3569 | { | ||
3562 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); | 3570 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
3563 | struct intel_shared_regs *pc; | 3571 | struct intel_shared_regs *pc; |
3564 | 3572 | ||
@@ -3570,11 +3578,6 @@ static void intel_pmu_cpu_dying(int cpu) | |||
3570 | } | 3578 | } |
3571 | 3579 | ||
3572 | free_excl_cntrs(cpu); | 3580 | free_excl_cntrs(cpu); |
3573 | |||
3574 | fini_debug_store_on_cpu(cpu); | ||
3575 | |||
3576 | if (x86_pmu.counter_freezing) | ||
3577 | disable_counter_freeze(); | ||
3578 | } | 3581 | } |
3579 | 3582 | ||
3580 | static void intel_pmu_sched_task(struct perf_event_context *ctx, | 3583 | static void intel_pmu_sched_task(struct perf_event_context *ctx, |
@@ -3663,6 +3666,7 @@ static __initconst const struct x86_pmu core_pmu = { | |||
3663 | .cpu_prepare = intel_pmu_cpu_prepare, | 3666 | .cpu_prepare = intel_pmu_cpu_prepare, |
3664 | .cpu_starting = intel_pmu_cpu_starting, | 3667 | .cpu_starting = intel_pmu_cpu_starting, |
3665 | .cpu_dying = intel_pmu_cpu_dying, | 3668 | .cpu_dying = intel_pmu_cpu_dying, |
3669 | .cpu_dead = intel_pmu_cpu_dead, | ||
3666 | }; | 3670 | }; |
3667 | 3671 | ||
3668 | static struct attribute *intel_pmu_attrs[]; | 3672 | static struct attribute *intel_pmu_attrs[]; |
@@ -3703,6 +3707,8 @@ static __initconst const struct x86_pmu intel_pmu = { | |||
3703 | .cpu_prepare = intel_pmu_cpu_prepare, | 3707 | .cpu_prepare = intel_pmu_cpu_prepare, |
3704 | .cpu_starting = intel_pmu_cpu_starting, | 3708 | .cpu_starting = intel_pmu_cpu_starting, |
3705 | .cpu_dying = intel_pmu_cpu_dying, | 3709 | .cpu_dying = intel_pmu_cpu_dying, |
3710 | .cpu_dead = intel_pmu_cpu_dead, | ||
3711 | |||
3706 | .guest_get_msrs = intel_guest_get_msrs, | 3712 | .guest_get_msrs = intel_guest_get_msrs, |
3707 | .sched_task = intel_pmu_sched_task, | 3713 | .sched_task = intel_pmu_sched_task, |
3708 | }; | 3714 | }; |
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index c07bee31abe8..b10e04387f38 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c | |||
@@ -1222,6 +1222,8 @@ static struct pci_driver snbep_uncore_pci_driver = { | |||
1222 | .id_table = snbep_uncore_pci_ids, | 1222 | .id_table = snbep_uncore_pci_ids, |
1223 | }; | 1223 | }; |
1224 | 1224 | ||
1225 | #define NODE_ID_MASK 0x7 | ||
1226 | |||
1225 | /* | 1227 | /* |
1226 | * build pci bus to socket mapping | 1228 | * build pci bus to socket mapping |
1227 | */ | 1229 | */ |
@@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool | |||
1243 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); | 1245 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); |
1244 | if (err) | 1246 | if (err) |
1245 | break; | 1247 | break; |
1246 | nodeid = config; | 1248 | nodeid = config & NODE_ID_MASK; |
1247 | /* get the Node ID mapping */ | 1249 | /* get the Node ID mapping */ |
1248 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); | 1250 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); |
1249 | if (err) | 1251 | if (err) |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 40616e805292..2779ace16d23 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -1065,7 +1065,7 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
1066 | pmd_t *pmdp, pmd_t pmd) | 1066 | pmd_t *pmdp, pmd_t pmd) |
1067 | { | 1067 | { |
1068 | native_set_pmd(pmdp, pmd); | 1068 | set_pmd(pmdp, pmd); |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, | 1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, |
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 672c7225cb1b..6ce290c506d9 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c | |||
@@ -784,6 +784,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, | |||
784 | quirk_no_way_out(i, m, regs); | 784 | quirk_no_way_out(i, m, regs); |
785 | 785 | ||
786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { | 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
787 | m->bank = i; | ||
787 | mce_read_aux(m, i); | 788 | mce_read_aux(m, i); |
788 | *msg = tmp; | 789 | *msg = tmp; |
789 | return 1; | 790 | return 1; |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 4f8972311a77..14e6119838a6 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -230,6 +230,29 @@ static bool __cpa_pfn_in_highmap(unsigned long pfn) | |||
230 | 230 | ||
231 | #endif | 231 | #endif |
232 | 232 | ||
233 | /* | ||
234 | * See set_mce_nospec(). | ||
235 | * | ||
236 | * Machine check recovery code needs to change cache mode of poisoned pages to | ||
237 | * UC to avoid speculative access logging another error. But passing the | ||
238 | * address of the 1:1 mapping to set_memory_uc() is a fine way to encourage a | ||
239 | * speculative access. So we cheat and flip the top bit of the address. This | ||
240 | * works fine for the code that updates the page tables. But at the end of the | ||
241 | * process we need to flush the TLB and cache and the non-canonical address | ||
242 | * causes a #GP fault when used by the INVLPG and CLFLUSH instructions. | ||
243 | * | ||
244 | * But in the common case we already have a canonical address. This code | ||
245 | * will fix the top bit if needed and is a no-op otherwise. | ||
246 | */ | ||
247 | static inline unsigned long fix_addr(unsigned long addr) | ||
248 | { | ||
249 | #ifdef CONFIG_X86_64 | ||
250 | return (long)(addr << 1) >> 1; | ||
251 | #else | ||
252 | return addr; | ||
253 | #endif | ||
254 | } | ||
255 | |||
233 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) | 256 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) |
234 | { | 257 | { |
235 | if (cpa->flags & CPA_PAGES_ARRAY) { | 258 | if (cpa->flags & CPA_PAGES_ARRAY) { |
@@ -313,7 +336,7 @@ void __cpa_flush_tlb(void *data) | |||
313 | unsigned int i; | 336 | unsigned int i; |
314 | 337 | ||
315 | for (i = 0; i < cpa->numpages; i++) | 338 | for (i = 0; i < cpa->numpages; i++) |
316 | __flush_tlb_one_kernel(__cpa_addr(cpa, i)); | 339 | __flush_tlb_one_kernel(fix_addr(__cpa_addr(cpa, i))); |
317 | } | 340 | } |
318 | 341 | ||
319 | static void cpa_flush(struct cpa_data *data, int cache) | 342 | static void cpa_flush(struct cpa_data *data, int cache) |
@@ -347,7 +370,7 @@ static void cpa_flush(struct cpa_data *data, int cache) | |||
347 | * Only flush present addresses: | 370 | * Only flush present addresses: |
348 | */ | 371 | */ |
349 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) | 372 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) |
350 | clflush_cache_range_opt((void *)addr, PAGE_SIZE); | 373 | clflush_cache_range_opt((void *)fix_addr(addr), PAGE_SIZE); |
351 | } | 374 | } |
352 | mb(); | 375 | mb(); |
353 | } | 376 | } |
@@ -1627,29 +1650,6 @@ out: | |||
1627 | return ret; | 1650 | return ret; |
1628 | } | 1651 | } |
1629 | 1652 | ||
1630 | /* | ||
1631 | * Machine check recovery code needs to change cache mode of poisoned | ||
1632 | * pages to UC to avoid speculative access logging another error. But | ||
1633 | * passing the address of the 1:1 mapping to set_memory_uc() is a fine | ||
1634 | * way to encourage a speculative access. So we cheat and flip the top | ||
1635 | * bit of the address. This works fine for the code that updates the | ||
1636 | * page tables. But at the end of the process we need to flush the cache | ||
1637 | * and the non-canonical address causes a #GP fault when used by the | ||
1638 | * CLFLUSH instruction. | ||
1639 | * | ||
1640 | * But in the common case we already have a canonical address. This code | ||
1641 | * will fix the top bit if needed and is a no-op otherwise. | ||
1642 | */ | ||
1643 | static inline unsigned long make_addr_canonical_again(unsigned long addr) | ||
1644 | { | ||
1645 | #ifdef CONFIG_X86_64 | ||
1646 | return (long)(addr << 1) >> 1; | ||
1647 | #else | ||
1648 | return addr; | ||
1649 | #endif | ||
1650 | } | ||
1651 | |||
1652 | |||
1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, | 1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, |
1654 | pgprot_t mask_set, pgprot_t mask_clr, | 1654 | pgprot_t mask_set, pgprot_t mask_clr, |
1655 | int force_split, int in_flag, | 1655 | int force_split, int in_flag, |
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index fc714ef402a6..2620baa1f699 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/sched/loadavg.h> | 72 | #include <linux/sched/loadavg.h> |
73 | #include <linux/sched/signal.h> | 73 | #include <linux/sched/signal.h> |
74 | #include <trace/events/block.h> | 74 | #include <trace/events/block.h> |
75 | #include <linux/blk-mq.h> | ||
75 | #include "blk-rq-qos.h" | 76 | #include "blk-rq-qos.h" |
76 | #include "blk-stat.h" | 77 | #include "blk-stat.h" |
77 | 78 | ||
@@ -591,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) | |||
591 | u64 now = ktime_to_ns(ktime_get()); | 592 | u64 now = ktime_to_ns(ktime_get()); |
592 | bool issue_as_root = bio_issue_as_root_blkg(bio); | 593 | bool issue_as_root = bio_issue_as_root_blkg(bio); |
593 | bool enabled = false; | 594 | bool enabled = false; |
595 | int inflight = 0; | ||
594 | 596 | ||
595 | blkg = bio->bi_blkg; | 597 | blkg = bio->bi_blkg; |
596 | if (!blkg || !bio_flagged(bio, BIO_TRACKED)) | 598 | if (!blkg || !bio_flagged(bio, BIO_TRACKED)) |
@@ -601,6 +603,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) | |||
601 | return; | 603 | return; |
602 | 604 | ||
603 | enabled = blk_iolatency_enabled(iolat->blkiolat); | 605 | enabled = blk_iolatency_enabled(iolat->blkiolat); |
606 | if (!enabled) | ||
607 | return; | ||
608 | |||
604 | while (blkg && blkg->parent) { | 609 | while (blkg && blkg->parent) { |
605 | iolat = blkg_to_lat(blkg); | 610 | iolat = blkg_to_lat(blkg); |
606 | if (!iolat) { | 611 | if (!iolat) { |
@@ -609,8 +614,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) | |||
609 | } | 614 | } |
610 | rqw = &iolat->rq_wait; | 615 | rqw = &iolat->rq_wait; |
611 | 616 | ||
612 | atomic_dec(&rqw->inflight); | 617 | inflight = atomic_dec_return(&rqw->inflight); |
613 | if (!enabled || iolat->min_lat_nsec == 0) | 618 | WARN_ON_ONCE(inflight < 0); |
619 | if (iolat->min_lat_nsec == 0) | ||
614 | goto next; | 620 | goto next; |
615 | iolatency_record_time(iolat, &bio->bi_issue, now, | 621 | iolatency_record_time(iolat, &bio->bi_issue, now, |
616 | issue_as_root); | 622 | issue_as_root); |
@@ -754,10 +760,13 @@ int blk_iolatency_init(struct request_queue *q) | |||
754 | return 0; | 760 | return 0; |
755 | } | 761 | } |
756 | 762 | ||
757 | static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | 763 | /* |
764 | * return 1 for enabling iolatency, return -1 for disabling iolatency, otherwise | ||
765 | * return 0. | ||
766 | */ | ||
767 | static int iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | ||
758 | { | 768 | { |
759 | struct iolatency_grp *iolat = blkg_to_lat(blkg); | 769 | struct iolatency_grp *iolat = blkg_to_lat(blkg); |
760 | struct blk_iolatency *blkiolat = iolat->blkiolat; | ||
761 | u64 oldval = iolat->min_lat_nsec; | 770 | u64 oldval = iolat->min_lat_nsec; |
762 | 771 | ||
763 | iolat->min_lat_nsec = val; | 772 | iolat->min_lat_nsec = val; |
@@ -766,9 +775,10 @@ static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | |||
766 | BLKIOLATENCY_MAX_WIN_SIZE); | 775 | BLKIOLATENCY_MAX_WIN_SIZE); |
767 | 776 | ||
768 | if (!oldval && val) | 777 | if (!oldval && val) |
769 | atomic_inc(&blkiolat->enabled); | 778 | return 1; |
770 | if (oldval && !val) | 779 | if (oldval && !val) |
771 | atomic_dec(&blkiolat->enabled); | 780 | return -1; |
781 | return 0; | ||
772 | } | 782 | } |
773 | 783 | ||
774 | static void iolatency_clear_scaling(struct blkcg_gq *blkg) | 784 | static void iolatency_clear_scaling(struct blkcg_gq *blkg) |
@@ -800,6 +810,7 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, | |||
800 | u64 lat_val = 0; | 810 | u64 lat_val = 0; |
801 | u64 oldval; | 811 | u64 oldval; |
802 | int ret; | 812 | int ret; |
813 | int enable = 0; | ||
803 | 814 | ||
804 | ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx); | 815 | ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx); |
805 | if (ret) | 816 | if (ret) |
@@ -834,7 +845,12 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, | |||
834 | blkg = ctx.blkg; | 845 | blkg = ctx.blkg; |
835 | oldval = iolat->min_lat_nsec; | 846 | oldval = iolat->min_lat_nsec; |
836 | 847 | ||
837 | iolatency_set_min_lat_nsec(blkg, lat_val); | 848 | enable = iolatency_set_min_lat_nsec(blkg, lat_val); |
849 | if (enable) { | ||
850 | WARN_ON_ONCE(!blk_get_queue(blkg->q)); | ||
851 | blkg_get(blkg); | ||
852 | } | ||
853 | |||
838 | if (oldval != iolat->min_lat_nsec) { | 854 | if (oldval != iolat->min_lat_nsec) { |
839 | iolatency_clear_scaling(blkg); | 855 | iolatency_clear_scaling(blkg); |
840 | } | 856 | } |
@@ -842,6 +858,24 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, | |||
842 | ret = 0; | 858 | ret = 0; |
843 | out: | 859 | out: |
844 | blkg_conf_finish(&ctx); | 860 | blkg_conf_finish(&ctx); |
861 | if (ret == 0 && enable) { | ||
862 | struct iolatency_grp *tmp = blkg_to_lat(blkg); | ||
863 | struct blk_iolatency *blkiolat = tmp->blkiolat; | ||
864 | |||
865 | blk_mq_freeze_queue(blkg->q); | ||
866 | |||
867 | if (enable == 1) | ||
868 | atomic_inc(&blkiolat->enabled); | ||
869 | else if (enable == -1) | ||
870 | atomic_dec(&blkiolat->enabled); | ||
871 | else | ||
872 | WARN_ON_ONCE(1); | ||
873 | |||
874 | blk_mq_unfreeze_queue(blkg->q); | ||
875 | |||
876 | blkg_put(blkg); | ||
877 | blk_put_queue(blkg->q); | ||
878 | } | ||
845 | return ret ?: nbytes; | 879 | return ret ?: nbytes; |
846 | } | 880 | } |
847 | 881 | ||
@@ -977,8 +1011,14 @@ static void iolatency_pd_offline(struct blkg_policy_data *pd) | |||
977 | { | 1011 | { |
978 | struct iolatency_grp *iolat = pd_to_lat(pd); | 1012 | struct iolatency_grp *iolat = pd_to_lat(pd); |
979 | struct blkcg_gq *blkg = lat_to_blkg(iolat); | 1013 | struct blkcg_gq *blkg = lat_to_blkg(iolat); |
1014 | struct blk_iolatency *blkiolat = iolat->blkiolat; | ||
1015 | int ret; | ||
980 | 1016 | ||
981 | iolatency_set_min_lat_nsec(blkg, 0); | 1017 | ret = iolatency_set_min_lat_nsec(blkg, 0); |
1018 | if (ret == 1) | ||
1019 | atomic_inc(&blkiolat->enabled); | ||
1020 | if (ret == -1) | ||
1021 | atomic_dec(&blkiolat->enabled); | ||
982 | iolatency_clear_scaling(blkg); | 1022 | iolatency_clear_scaling(blkg); |
983 | } | 1023 | } |
984 | 1024 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index 8f5b533764ca..9437a5eb07cf 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -737,12 +737,20 @@ static void blk_mq_requeue_work(struct work_struct *work) | |||
737 | spin_unlock_irq(&q->requeue_lock); | 737 | spin_unlock_irq(&q->requeue_lock); |
738 | 738 | ||
739 | list_for_each_entry_safe(rq, next, &rq_list, queuelist) { | 739 | list_for_each_entry_safe(rq, next, &rq_list, queuelist) { |
740 | if (!(rq->rq_flags & RQF_SOFTBARRIER)) | 740 | if (!(rq->rq_flags & (RQF_SOFTBARRIER | RQF_DONTPREP))) |
741 | continue; | 741 | continue; |
742 | 742 | ||
743 | rq->rq_flags &= ~RQF_SOFTBARRIER; | 743 | rq->rq_flags &= ~RQF_SOFTBARRIER; |
744 | list_del_init(&rq->queuelist); | 744 | list_del_init(&rq->queuelist); |
745 | blk_mq_sched_insert_request(rq, true, false, false); | 745 | /* |
746 | * If RQF_DONTPREP, rq has contained some driver specific | ||
747 | * data, so insert it to hctx dispatch list to avoid any | ||
748 | * merge. | ||
749 | */ | ||
750 | if (rq->rq_flags & RQF_DONTPREP) | ||
751 | blk_mq_request_bypass_insert(rq, false); | ||
752 | else | ||
753 | blk_mq_sched_insert_request(rq, true, false, false); | ||
746 | } | 754 | } |
747 | 755 | ||
748 | while (!list_empty(&rq_list)) { | 756 | while (!list_empty(&rq_list)) { |
diff --git a/block/blk-mq.h b/block/blk-mq.h index d943d46b0785..d0b3dd54ef8d 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h | |||
@@ -36,7 +36,6 @@ struct blk_mq_ctx { | |||
36 | struct kobject kobj; | 36 | struct kobject kobj; |
37 | } ____cacheline_aligned_in_smp; | 37 | } ____cacheline_aligned_in_smp; |
38 | 38 | ||
39 | void blk_mq_freeze_queue(struct request_queue *q); | ||
40 | void blk_mq_free_queue(struct request_queue *q); | 39 | void blk_mq_free_queue(struct request_queue *q); |
41 | int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); | 40 | int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); |
42 | void blk_mq_wake_waiters(struct request_queue *q); | 41 | void blk_mq_wake_waiters(struct request_queue *q); |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5c093ce01bcd..147f6c7ea59c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -1029,6 +1029,9 @@ void __init acpi_early_init(void) | |||
1029 | 1029 | ||
1030 | acpi_permanent_mmap = true; | 1030 | acpi_permanent_mmap = true; |
1031 | 1031 | ||
1032 | /* Initialize debug output. Linux does not use ACPICA defaults */ | ||
1033 | acpi_dbg_level = ACPI_LV_INFO | ACPI_LV_REPAIR; | ||
1034 | |||
1032 | #ifdef CONFIG_X86 | 1035 | #ifdef CONFIG_X86 |
1033 | /* | 1036 | /* |
1034 | * If the machine falls into the DMI check table, | 1037 | * If the machine falls into the DMI check table, |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b8c3f9e6af89..adf28788cab5 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4554,6 +4554,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, | 4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, |
4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, | 4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, |
4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, | 4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, |
4557 | { "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM, }, | ||
4557 | 4558 | ||
4558 | /* devices that don't properly handle queued TRIM commands */ | 4559 | /* devices that don't properly handle queued TRIM commands */ |
4559 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | 4560 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 6f2856c6d0f2..55481b40df9a 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk, | |||
4075 | 4075 | ||
4076 | if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { | 4076 | if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { |
4077 | if (lock_fdc(drive)) | 4077 | if (lock_fdc(drive)) |
4078 | return -EINTR; | 4078 | return 0; |
4079 | poll_drive(false, 0); | 4079 | poll_drive(false, 0); |
4080 | process_fd_request(); | 4080 | process_fd_request(); |
4081 | } | 4081 | } |
diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c index 8ada308d72ee..b0125ad65825 100644 --- a/drivers/crypto/ccree/cc_driver.c +++ b/drivers/crypto/ccree/cc_driver.c | |||
@@ -380,7 +380,7 @@ static int init_cc_resources(struct platform_device *plat_dev) | |||
380 | rc = cc_ivgen_init(new_drvdata); | 380 | rc = cc_ivgen_init(new_drvdata); |
381 | if (rc) { | 381 | if (rc) { |
382 | dev_err(dev, "cc_ivgen_init failed\n"); | 382 | dev_err(dev, "cc_ivgen_init failed\n"); |
383 | goto post_power_mgr_err; | 383 | goto post_buf_mgr_err; |
384 | } | 384 | } |
385 | 385 | ||
386 | /* Allocate crypto algs */ | 386 | /* Allocate crypto algs */ |
@@ -403,6 +403,9 @@ static int init_cc_resources(struct platform_device *plat_dev) | |||
403 | goto post_hash_err; | 403 | goto post_hash_err; |
404 | } | 404 | } |
405 | 405 | ||
406 | /* All set, we can allow autosuspend */ | ||
407 | cc_pm_go(new_drvdata); | ||
408 | |||
406 | /* If we got here and FIPS mode is enabled | 409 | /* If we got here and FIPS mode is enabled |
407 | * it means all FIPS test passed, so let TEE | 410 | * it means all FIPS test passed, so let TEE |
408 | * know we're good. | 411 | * know we're good. |
@@ -417,8 +420,6 @@ post_cipher_err: | |||
417 | cc_cipher_free(new_drvdata); | 420 | cc_cipher_free(new_drvdata); |
418 | post_ivgen_err: | 421 | post_ivgen_err: |
419 | cc_ivgen_fini(new_drvdata); | 422 | cc_ivgen_fini(new_drvdata); |
420 | post_power_mgr_err: | ||
421 | cc_pm_fini(new_drvdata); | ||
422 | post_buf_mgr_err: | 423 | post_buf_mgr_err: |
423 | cc_buffer_mgr_fini(new_drvdata); | 424 | cc_buffer_mgr_fini(new_drvdata); |
424 | post_req_mgr_err: | 425 | post_req_mgr_err: |
diff --git a/drivers/crypto/ccree/cc_pm.c b/drivers/crypto/ccree/cc_pm.c index d990f472e89f..6ff7e75ad90e 100644 --- a/drivers/crypto/ccree/cc_pm.c +++ b/drivers/crypto/ccree/cc_pm.c | |||
@@ -100,20 +100,19 @@ int cc_pm_put_suspend(struct device *dev) | |||
100 | 100 | ||
101 | int cc_pm_init(struct cc_drvdata *drvdata) | 101 | int cc_pm_init(struct cc_drvdata *drvdata) |
102 | { | 102 | { |
103 | int rc = 0; | ||
104 | struct device *dev = drvdata_to_dev(drvdata); | 103 | struct device *dev = drvdata_to_dev(drvdata); |
105 | 104 | ||
106 | /* must be before the enabling to avoid resdundent suspending */ | 105 | /* must be before the enabling to avoid resdundent suspending */ |
107 | pm_runtime_set_autosuspend_delay(dev, CC_SUSPEND_TIMEOUT); | 106 | pm_runtime_set_autosuspend_delay(dev, CC_SUSPEND_TIMEOUT); |
108 | pm_runtime_use_autosuspend(dev); | 107 | pm_runtime_use_autosuspend(dev); |
109 | /* activate the PM module */ | 108 | /* activate the PM module */ |
110 | rc = pm_runtime_set_active(dev); | 109 | return pm_runtime_set_active(dev); |
111 | if (rc) | 110 | } |
112 | return rc; | ||
113 | /* enable the PM module*/ | ||
114 | pm_runtime_enable(dev); | ||
115 | 111 | ||
116 | return rc; | 112 | /* enable the PM module*/ |
113 | void cc_pm_go(struct cc_drvdata *drvdata) | ||
114 | { | ||
115 | pm_runtime_enable(drvdata_to_dev(drvdata)); | ||
117 | } | 116 | } |
118 | 117 | ||
119 | void cc_pm_fini(struct cc_drvdata *drvdata) | 118 | void cc_pm_fini(struct cc_drvdata *drvdata) |
diff --git a/drivers/crypto/ccree/cc_pm.h b/drivers/crypto/ccree/cc_pm.h index 020a5403c58b..f62624357020 100644 --- a/drivers/crypto/ccree/cc_pm.h +++ b/drivers/crypto/ccree/cc_pm.h | |||
@@ -16,6 +16,7 @@ | |||
16 | extern const struct dev_pm_ops ccree_pm; | 16 | extern const struct dev_pm_ops ccree_pm; |
17 | 17 | ||
18 | int cc_pm_init(struct cc_drvdata *drvdata); | 18 | int cc_pm_init(struct cc_drvdata *drvdata); |
19 | void cc_pm_go(struct cc_drvdata *drvdata); | ||
19 | void cc_pm_fini(struct cc_drvdata *drvdata); | 20 | void cc_pm_fini(struct cc_drvdata *drvdata); |
20 | int cc_pm_suspend(struct device *dev); | 21 | int cc_pm_suspend(struct device *dev); |
21 | int cc_pm_resume(struct device *dev); | 22 | int cc_pm_resume(struct device *dev); |
@@ -29,6 +30,8 @@ static inline int cc_pm_init(struct cc_drvdata *drvdata) | |||
29 | return 0; | 30 | return 0; |
30 | } | 31 | } |
31 | 32 | ||
33 | static void cc_pm_go(struct cc_drvdata *drvdata) {} | ||
34 | |||
32 | static inline void cc_pm_fini(struct cc_drvdata *drvdata) {} | 35 | static inline void cc_pm_fini(struct cc_drvdata *drvdata) {} |
33 | 36 | ||
34 | static inline int cc_pm_suspend(struct device *dev) | 37 | static inline int cc_pm_suspend(struct device *dev) |
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 4e557684f792..fe69dccfa0c0 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c | |||
@@ -203,6 +203,7 @@ struct at_xdmac_chan { | |||
203 | u32 save_cim; | 203 | u32 save_cim; |
204 | u32 save_cnda; | 204 | u32 save_cnda; |
205 | u32 save_cndc; | 205 | u32 save_cndc; |
206 | u32 irq_status; | ||
206 | unsigned long status; | 207 | unsigned long status; |
207 | struct tasklet_struct tasklet; | 208 | struct tasklet_struct tasklet; |
208 | struct dma_slave_config sconfig; | 209 | struct dma_slave_config sconfig; |
@@ -1580,8 +1581,8 @@ static void at_xdmac_tasklet(unsigned long data) | |||
1580 | struct at_xdmac_desc *desc; | 1581 | struct at_xdmac_desc *desc; |
1581 | u32 error_mask; | 1582 | u32 error_mask; |
1582 | 1583 | ||
1583 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08lx\n", | 1584 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08x\n", |
1584 | __func__, atchan->status); | 1585 | __func__, atchan->irq_status); |
1585 | 1586 | ||
1586 | error_mask = AT_XDMAC_CIS_RBEIS | 1587 | error_mask = AT_XDMAC_CIS_RBEIS |
1587 | | AT_XDMAC_CIS_WBEIS | 1588 | | AT_XDMAC_CIS_WBEIS |
@@ -1589,15 +1590,15 @@ static void at_xdmac_tasklet(unsigned long data) | |||
1589 | 1590 | ||
1590 | if (at_xdmac_chan_is_cyclic(atchan)) { | 1591 | if (at_xdmac_chan_is_cyclic(atchan)) { |
1591 | at_xdmac_handle_cyclic(atchan); | 1592 | at_xdmac_handle_cyclic(atchan); |
1592 | } else if ((atchan->status & AT_XDMAC_CIS_LIS) | 1593 | } else if ((atchan->irq_status & AT_XDMAC_CIS_LIS) |
1593 | || (atchan->status & error_mask)) { | 1594 | || (atchan->irq_status & error_mask)) { |
1594 | struct dma_async_tx_descriptor *txd; | 1595 | struct dma_async_tx_descriptor *txd; |
1595 | 1596 | ||
1596 | if (atchan->status & AT_XDMAC_CIS_RBEIS) | 1597 | if (atchan->irq_status & AT_XDMAC_CIS_RBEIS) |
1597 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); | 1598 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); |
1598 | if (atchan->status & AT_XDMAC_CIS_WBEIS) | 1599 | if (atchan->irq_status & AT_XDMAC_CIS_WBEIS) |
1599 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); | 1600 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); |
1600 | if (atchan->status & AT_XDMAC_CIS_ROIS) | 1601 | if (atchan->irq_status & AT_XDMAC_CIS_ROIS) |
1601 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); | 1602 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); |
1602 | 1603 | ||
1603 | spin_lock(&atchan->lock); | 1604 | spin_lock(&atchan->lock); |
@@ -1652,7 +1653,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) | |||
1652 | atchan = &atxdmac->chan[i]; | 1653 | atchan = &atxdmac->chan[i]; |
1653 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); | 1654 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); |
1654 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); | 1655 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); |
1655 | atchan->status = chan_status & chan_imr; | 1656 | atchan->irq_status = chan_status & chan_imr; |
1656 | dev_vdbg(atxdmac->dma.dev, | 1657 | dev_vdbg(atxdmac->dma.dev, |
1657 | "%s: chan%d: imr=0x%x, status=0x%x\n", | 1658 | "%s: chan%d: imr=0x%x, status=0x%x\n", |
1658 | __func__, i, chan_imr, chan_status); | 1659 | __func__, i, chan_imr, chan_status); |
@@ -1666,7 +1667,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) | |||
1666 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), | 1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), |
1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); | 1668 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); |
1668 | 1669 | ||
1669 | if (atchan->status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) | 1670 | if (atchan->irq_status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
1670 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); | 1671 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); |
1671 | 1672 | ||
1672 | tasklet_schedule(&atchan->tasklet); | 1673 | tasklet_schedule(&atchan->tasklet); |
diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 1a44c8086d77..ae10f5614f95 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c | |||
@@ -406,38 +406,32 @@ static void bcm2835_dma_fill_cb_chain_with_sg( | |||
406 | } | 406 | } |
407 | } | 407 | } |
408 | 408 | ||
409 | static int bcm2835_dma_abort(void __iomem *chan_base) | 409 | static int bcm2835_dma_abort(struct bcm2835_chan *c) |
410 | { | 410 | { |
411 | unsigned long cs; | 411 | void __iomem *chan_base = c->chan_base; |
412 | long int timeout = 10000; | 412 | long int timeout = 10000; |
413 | 413 | ||
414 | cs = readl(chan_base + BCM2835_DMA_CS); | 414 | /* |
415 | if (!(cs & BCM2835_DMA_ACTIVE)) | 415 | * A zero control block address means the channel is idle. |
416 | * (The ACTIVE flag in the CS register is not a reliable indicator.) | ||
417 | */ | ||
418 | if (!readl(chan_base + BCM2835_DMA_ADDR)) | ||
416 | return 0; | 419 | return 0; |
417 | 420 | ||
418 | /* Write 0 to the active bit - Pause the DMA */ | 421 | /* Write 0 to the active bit - Pause the DMA */ |
419 | writel(0, chan_base + BCM2835_DMA_CS); | 422 | writel(0, chan_base + BCM2835_DMA_CS); |
420 | 423 | ||
421 | /* Wait for any current AXI transfer to complete */ | 424 | /* Wait for any current AXI transfer to complete */ |
422 | while ((cs & BCM2835_DMA_ISPAUSED) && --timeout) { | 425 | while ((readl(chan_base + BCM2835_DMA_CS) & |
426 | BCM2835_DMA_WAITING_FOR_WRITES) && --timeout) | ||
423 | cpu_relax(); | 427 | cpu_relax(); |
424 | cs = readl(chan_base + BCM2835_DMA_CS); | ||
425 | } | ||
426 | 428 | ||
427 | /* We'll un-pause when we set of our next DMA */ | 429 | /* Peripheral might be stuck and fail to signal AXI write responses */ |
428 | if (!timeout) | 430 | if (!timeout) |
429 | return -ETIMEDOUT; | 431 | dev_err(c->vc.chan.device->dev, |
430 | 432 | "failed to complete outstanding writes\n"); | |
431 | if (!(cs & BCM2835_DMA_ACTIVE)) | ||
432 | return 0; | ||
433 | |||
434 | /* Terminate the control block chain */ | ||
435 | writel(0, chan_base + BCM2835_DMA_NEXTCB); | ||
436 | |||
437 | /* Abort the whole DMA */ | ||
438 | writel(BCM2835_DMA_ABORT | BCM2835_DMA_ACTIVE, | ||
439 | chan_base + BCM2835_DMA_CS); | ||
440 | 433 | ||
434 | writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS); | ||
441 | return 0; | 435 | return 0; |
442 | } | 436 | } |
443 | 437 | ||
@@ -476,8 +470,15 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) | |||
476 | 470 | ||
477 | spin_lock_irqsave(&c->vc.lock, flags); | 471 | spin_lock_irqsave(&c->vc.lock, flags); |
478 | 472 | ||
479 | /* Acknowledge interrupt */ | 473 | /* |
480 | writel(BCM2835_DMA_INT, c->chan_base + BCM2835_DMA_CS); | 474 | * Clear the INT flag to receive further interrupts. Keep the channel |
475 | * active in case the descriptor is cyclic or in case the client has | ||
476 | * already terminated the descriptor and issued a new one. (May happen | ||
477 | * if this IRQ handler is threaded.) If the channel is finished, it | ||
478 | * will remain idle despite the ACTIVE flag being set. | ||
479 | */ | ||
480 | writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE, | ||
481 | c->chan_base + BCM2835_DMA_CS); | ||
481 | 482 | ||
482 | d = c->desc; | 483 | d = c->desc; |
483 | 484 | ||
@@ -485,11 +486,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) | |||
485 | if (d->cyclic) { | 486 | if (d->cyclic) { |
486 | /* call the cyclic callback */ | 487 | /* call the cyclic callback */ |
487 | vchan_cyclic_callback(&d->vd); | 488 | vchan_cyclic_callback(&d->vd); |
488 | 489 | } else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) { | |
489 | /* Keep the DMA engine running */ | ||
490 | writel(BCM2835_DMA_ACTIVE, | ||
491 | c->chan_base + BCM2835_DMA_CS); | ||
492 | } else { | ||
493 | vchan_cookie_complete(&c->desc->vd); | 490 | vchan_cookie_complete(&c->desc->vd); |
494 | bcm2835_dma_start_desc(c); | 491 | bcm2835_dma_start_desc(c); |
495 | } | 492 | } |
@@ -779,7 +776,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) | |||
779 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); | 776 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); |
780 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); | 777 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); |
781 | unsigned long flags; | 778 | unsigned long flags; |
782 | int timeout = 10000; | ||
783 | LIST_HEAD(head); | 779 | LIST_HEAD(head); |
784 | 780 | ||
785 | spin_lock_irqsave(&c->vc.lock, flags); | 781 | spin_lock_irqsave(&c->vc.lock, flags); |
@@ -789,27 +785,11 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) | |||
789 | list_del_init(&c->node); | 785 | list_del_init(&c->node); |
790 | spin_unlock(&d->lock); | 786 | spin_unlock(&d->lock); |
791 | 787 | ||
792 | /* | 788 | /* stop DMA activity */ |
793 | * Stop DMA activity: we assume the callback will not be called | ||
794 | * after bcm_dma_abort() returns (even if it does, it will see | ||
795 | * c->desc is NULL and exit.) | ||
796 | */ | ||
797 | if (c->desc) { | 789 | if (c->desc) { |
798 | vchan_terminate_vdesc(&c->desc->vd); | 790 | vchan_terminate_vdesc(&c->desc->vd); |
799 | c->desc = NULL; | 791 | c->desc = NULL; |
800 | bcm2835_dma_abort(c->chan_base); | 792 | bcm2835_dma_abort(c); |
801 | |||
802 | /* Wait for stopping */ | ||
803 | while (--timeout) { | ||
804 | if (!(readl(c->chan_base + BCM2835_DMA_CS) & | ||
805 | BCM2835_DMA_ACTIVE)) | ||
806 | break; | ||
807 | |||
808 | cpu_relax(); | ||
809 | } | ||
810 | |||
811 | if (!timeout) | ||
812 | dev_err(d->ddev.dev, "DMA transfer could not be terminated\n"); | ||
813 | } | 793 | } |
814 | 794 | ||
815 | vchan_get_all_descriptors(&c->vc, &head); | 795 | vchan_get_all_descriptors(&c->vc, &head); |
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 2eea4ef72915..6511928b4cdf 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -711,11 +711,9 @@ static int dmatest_func(void *data) | |||
711 | srcs[i] = um->addr[i] + src_off; | 711 | srcs[i] = um->addr[i] + src_off; |
712 | ret = dma_mapping_error(dev->dev, um->addr[i]); | 712 | ret = dma_mapping_error(dev->dev, um->addr[i]); |
713 | if (ret) { | 713 | if (ret) { |
714 | dmaengine_unmap_put(um); | ||
715 | result("src mapping error", total_tests, | 714 | result("src mapping error", total_tests, |
716 | src_off, dst_off, len, ret); | 715 | src_off, dst_off, len, ret); |
717 | failed_tests++; | 716 | goto error_unmap_continue; |
718 | continue; | ||
719 | } | 717 | } |
720 | um->to_cnt++; | 718 | um->to_cnt++; |
721 | } | 719 | } |
@@ -730,11 +728,9 @@ static int dmatest_func(void *data) | |||
730 | DMA_BIDIRECTIONAL); | 728 | DMA_BIDIRECTIONAL); |
731 | ret = dma_mapping_error(dev->dev, dsts[i]); | 729 | ret = dma_mapping_error(dev->dev, dsts[i]); |
732 | if (ret) { | 730 | if (ret) { |
733 | dmaengine_unmap_put(um); | ||
734 | result("dst mapping error", total_tests, | 731 | result("dst mapping error", total_tests, |
735 | src_off, dst_off, len, ret); | 732 | src_off, dst_off, len, ret); |
736 | failed_tests++; | 733 | goto error_unmap_continue; |
737 | continue; | ||
738 | } | 734 | } |
739 | um->bidi_cnt++; | 735 | um->bidi_cnt++; |
740 | } | 736 | } |
@@ -762,12 +758,10 @@ static int dmatest_func(void *data) | |||
762 | } | 758 | } |
763 | 759 | ||
764 | if (!tx) { | 760 | if (!tx) { |
765 | dmaengine_unmap_put(um); | ||
766 | result("prep error", total_tests, src_off, | 761 | result("prep error", total_tests, src_off, |
767 | dst_off, len, ret); | 762 | dst_off, len, ret); |
768 | msleep(100); | 763 | msleep(100); |
769 | failed_tests++; | 764 | goto error_unmap_continue; |
770 | continue; | ||
771 | } | 765 | } |
772 | 766 | ||
773 | done->done = false; | 767 | done->done = false; |
@@ -776,12 +770,10 @@ static int dmatest_func(void *data) | |||
776 | cookie = tx->tx_submit(tx); | 770 | cookie = tx->tx_submit(tx); |
777 | 771 | ||
778 | if (dma_submit_error(cookie)) { | 772 | if (dma_submit_error(cookie)) { |
779 | dmaengine_unmap_put(um); | ||
780 | result("submit error", total_tests, src_off, | 773 | result("submit error", total_tests, src_off, |
781 | dst_off, len, ret); | 774 | dst_off, len, ret); |
782 | msleep(100); | 775 | msleep(100); |
783 | failed_tests++; | 776 | goto error_unmap_continue; |
784 | continue; | ||
785 | } | 777 | } |
786 | dma_async_issue_pending(chan); | 778 | dma_async_issue_pending(chan); |
787 | 779 | ||
@@ -790,22 +782,20 @@ static int dmatest_func(void *data) | |||
790 | 782 | ||
791 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); | 783 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); |
792 | 784 | ||
793 | dmaengine_unmap_put(um); | ||
794 | |||
795 | if (!done->done) { | 785 | if (!done->done) { |
796 | result("test timed out", total_tests, src_off, dst_off, | 786 | result("test timed out", total_tests, src_off, dst_off, |
797 | len, 0); | 787 | len, 0); |
798 | failed_tests++; | 788 | goto error_unmap_continue; |
799 | continue; | ||
800 | } else if (status != DMA_COMPLETE) { | 789 | } else if (status != DMA_COMPLETE) { |
801 | result(status == DMA_ERROR ? | 790 | result(status == DMA_ERROR ? |
802 | "completion error status" : | 791 | "completion error status" : |
803 | "completion busy status", total_tests, src_off, | 792 | "completion busy status", total_tests, src_off, |
804 | dst_off, len, ret); | 793 | dst_off, len, ret); |
805 | failed_tests++; | 794 | goto error_unmap_continue; |
806 | continue; | ||
807 | } | 795 | } |
808 | 796 | ||
797 | dmaengine_unmap_put(um); | ||
798 | |||
809 | if (params->noverify) { | 799 | if (params->noverify) { |
810 | verbose_result("test passed", total_tests, src_off, | 800 | verbose_result("test passed", total_tests, src_off, |
811 | dst_off, len, 0); | 801 | dst_off, len, 0); |
@@ -846,6 +836,12 @@ static int dmatest_func(void *data) | |||
846 | verbose_result("test passed", total_tests, src_off, | 836 | verbose_result("test passed", total_tests, src_off, |
847 | dst_off, len, 0); | 837 | dst_off, len, 0); |
848 | } | 838 | } |
839 | |||
840 | continue; | ||
841 | |||
842 | error_unmap_continue: | ||
843 | dmaengine_unmap_put(um); | ||
844 | failed_tests++; | ||
849 | } | 845 | } |
850 | ktime = ktime_sub(ktime_get(), ktime); | 846 | ktime = ktime_sub(ktime_get(), ktime); |
851 | ktime = ktime_sub(ktime, comparetime); | 847 | ktime = ktime_sub(ktime, comparetime); |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index c2fff3f6c9ca..4a09af3cd546 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -618,7 +618,7 @@ static void imxdma_tasklet(unsigned long data) | |||
618 | { | 618 | { |
619 | struct imxdma_channel *imxdmac = (void *)data; | 619 | struct imxdma_channel *imxdmac = (void *)data; |
620 | struct imxdma_engine *imxdma = imxdmac->imxdma; | 620 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
621 | struct imxdma_desc *desc; | 621 | struct imxdma_desc *desc, *next_desc; |
622 | unsigned long flags; | 622 | unsigned long flags; |
623 | 623 | ||
624 | spin_lock_irqsave(&imxdma->lock, flags); | 624 | spin_lock_irqsave(&imxdma->lock, flags); |
@@ -648,10 +648,10 @@ static void imxdma_tasklet(unsigned long data) | |||
648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); | 648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); |
649 | 649 | ||
650 | if (!list_empty(&imxdmac->ld_queue)) { | 650 | if (!list_empty(&imxdmac->ld_queue)) { |
651 | desc = list_first_entry(&imxdmac->ld_queue, struct imxdma_desc, | 651 | next_desc = list_first_entry(&imxdmac->ld_queue, |
652 | node); | 652 | struct imxdma_desc, node); |
653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); | 653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); |
654 | if (imxdma_xfer_desc(desc) < 0) | 654 | if (imxdma_xfer_desc(next_desc) < 0) |
655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", | 655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", |
656 | __func__, imxdmac->channel); | 656 | __func__, imxdmac->channel); |
657 | } | 657 | } |
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 472c88ae1c0f..92f843eaf1e0 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c | |||
@@ -119,6 +119,11 @@ void scmi_driver_unregister(struct scmi_driver *driver) | |||
119 | } | 119 | } |
120 | EXPORT_SYMBOL_GPL(scmi_driver_unregister); | 120 | EXPORT_SYMBOL_GPL(scmi_driver_unregister); |
121 | 121 | ||
122 | static void scmi_device_release(struct device *dev) | ||
123 | { | ||
124 | kfree(to_scmi_dev(dev)); | ||
125 | } | ||
126 | |||
122 | struct scmi_device * | 127 | struct scmi_device * |
123 | scmi_device_create(struct device_node *np, struct device *parent, int protocol) | 128 | scmi_device_create(struct device_node *np, struct device *parent, int protocol) |
124 | { | 129 | { |
@@ -138,6 +143,7 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol) | |||
138 | scmi_dev->dev.parent = parent; | 143 | scmi_dev->dev.parent = parent; |
139 | scmi_dev->dev.of_node = np; | 144 | scmi_dev->dev.of_node = np; |
140 | scmi_dev->dev.bus = &scmi_bus_type; | 145 | scmi_dev->dev.bus = &scmi_bus_type; |
146 | scmi_dev->dev.release = scmi_device_release; | ||
141 | dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); | 147 | dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); |
142 | 148 | ||
143 | retval = device_register(&scmi_dev->dev); | 149 | retval = device_register(&scmi_dev->dev); |
@@ -156,9 +162,8 @@ free_mem: | |||
156 | void scmi_device_destroy(struct scmi_device *scmi_dev) | 162 | void scmi_device_destroy(struct scmi_device *scmi_dev) |
157 | { | 163 | { |
158 | scmi_handle_put(scmi_dev->handle); | 164 | scmi_handle_put(scmi_dev->handle); |
159 | device_unregister(&scmi_dev->dev); | ||
160 | ida_simple_remove(&scmi_bus_id, scmi_dev->id); | 165 | ida_simple_remove(&scmi_bus_id, scmi_dev->id); |
161 | kfree(scmi_dev); | 166 | device_unregister(&scmi_dev->dev); |
162 | } | 167 | } |
163 | 168 | ||
164 | void scmi_set_handle(struct scmi_device *scmi_dev) | 169 | void scmi_set_handle(struct scmi_device *scmi_dev) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 8fab0d637ee5..3a9b48b227ac 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |||
@@ -90,8 +90,10 @@ static int psp_sw_fini(void *handle) | |||
90 | adev->psp.sos_fw = NULL; | 90 | adev->psp.sos_fw = NULL; |
91 | release_firmware(adev->psp.asd_fw); | 91 | release_firmware(adev->psp.asd_fw); |
92 | adev->psp.asd_fw = NULL; | 92 | adev->psp.asd_fw = NULL; |
93 | release_firmware(adev->psp.ta_fw); | 93 | if (adev->psp.ta_fw) { |
94 | adev->psp.ta_fw = NULL; | 94 | release_firmware(adev->psp.ta_fw); |
95 | adev->psp.ta_fw = NULL; | ||
96 | } | ||
95 | return 0; | 97 | return 0; |
96 | } | 98 | } |
97 | 99 | ||
@@ -435,6 +437,9 @@ static int psp_xgmi_initialize(struct psp_context *psp) | |||
435 | struct ta_xgmi_shared_memory *xgmi_cmd; | 437 | struct ta_xgmi_shared_memory *xgmi_cmd; |
436 | int ret; | 438 | int ret; |
437 | 439 | ||
440 | if (!psp->adev->psp.ta_fw) | ||
441 | return -ENOENT; | ||
442 | |||
438 | if (!psp->xgmi_context.initialized) { | 443 | if (!psp->xgmi_context.initialized) { |
439 | ret = psp_xgmi_init_shared_buf(psp); | 444 | ret = psp_xgmi_init_shared_buf(psp); |
440 | if (ret) | 445 | if (ret) |
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c index 0c6e7f9b143f..189fcb004579 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | |||
@@ -152,18 +152,22 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) | |||
152 | 152 | ||
153 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); | 153 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); |
154 | err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); | 154 | err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); |
155 | if (err) | 155 | if (err) { |
156 | goto out2; | 156 | release_firmware(adev->psp.ta_fw); |
157 | 157 | adev->psp.ta_fw = NULL; | |
158 | err = amdgpu_ucode_validate(adev->psp.ta_fw); | 158 | dev_info(adev->dev, |
159 | if (err) | 159 | "psp v11.0: Failed to load firmware \"%s\"\n", fw_name); |
160 | goto out2; | 160 | } else { |
161 | 161 | err = amdgpu_ucode_validate(adev->psp.ta_fw); | |
162 | ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data; | 162 | if (err) |
163 | adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version); | 163 | goto out2; |
164 | adev->psp.ta_xgmi_ucode_size = le32_to_cpu(ta_hdr->ta_xgmi_size_bytes); | 164 | |
165 | adev->psp.ta_xgmi_start_addr = (uint8_t *)ta_hdr + | 165 | ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data; |
166 | le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); | 166 | adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version); |
167 | adev->psp.ta_xgmi_ucode_size = le32_to_cpu(ta_hdr->ta_xgmi_size_bytes); | ||
168 | adev->psp.ta_xgmi_start_addr = (uint8_t *)ta_hdr + | ||
169 | le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); | ||
170 | } | ||
167 | 171 | ||
168 | return 0; | 172 | return 0; |
169 | 173 | ||
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 9a7ac58eb18e..ddd75a4d8ba5 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | |||
@@ -671,6 +671,25 @@ static ssize_t dp_phy_test_pattern_debugfs_write(struct file *f, const char __us | |||
671 | return bytes_from_user; | 671 | return bytes_from_user; |
672 | } | 672 | } |
673 | 673 | ||
674 | /* | ||
675 | * Returns the min and max vrr vfreq through the connector's debugfs file. | ||
676 | * Example usage: cat /sys/kernel/debug/dri/0/DP-1/vrr_range | ||
677 | */ | ||
678 | static int vrr_range_show(struct seq_file *m, void *data) | ||
679 | { | ||
680 | struct drm_connector *connector = m->private; | ||
681 | struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); | ||
682 | |||
683 | if (connector->status != connector_status_connected) | ||
684 | return -ENODEV; | ||
685 | |||
686 | seq_printf(m, "Min: %u\n", (unsigned int)aconnector->min_vfreq); | ||
687 | seq_printf(m, "Max: %u\n", (unsigned int)aconnector->max_vfreq); | ||
688 | |||
689 | return 0; | ||
690 | } | ||
691 | DEFINE_SHOW_ATTRIBUTE(vrr_range); | ||
692 | |||
674 | static const struct file_operations dp_link_settings_debugfs_fops = { | 693 | static const struct file_operations dp_link_settings_debugfs_fops = { |
675 | .owner = THIS_MODULE, | 694 | .owner = THIS_MODULE, |
676 | .read = dp_link_settings_read, | 695 | .read = dp_link_settings_read, |
@@ -697,7 +716,8 @@ static const struct { | |||
697 | } dp_debugfs_entries[] = { | 716 | } dp_debugfs_entries[] = { |
698 | {"link_settings", &dp_link_settings_debugfs_fops}, | 717 | {"link_settings", &dp_link_settings_debugfs_fops}, |
699 | {"phy_settings", &dp_phy_settings_debugfs_fop}, | 718 | {"phy_settings", &dp_phy_settings_debugfs_fop}, |
700 | {"test_pattern", &dp_phy_test_pattern_fops} | 719 | {"test_pattern", &dp_phy_test_pattern_fops}, |
720 | {"vrr_range", &vrr_range_fops} | ||
701 | }; | 721 | }; |
702 | 722 | ||
703 | int connector_debugfs_init(struct amdgpu_dm_connector *connector) | 723 | int connector_debugfs_init(struct amdgpu_dm_connector *connector) |
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c index 99cba8ea5d82..5df1256618cc 100644 --- a/drivers/gpu/drm/drm_lease.c +++ b/drivers/gpu/drm/drm_lease.c | |||
@@ -528,7 +528,8 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, | |||
528 | 528 | ||
529 | object_count = cl->object_count; | 529 | object_count = cl->object_count; |
530 | 530 | ||
531 | object_ids = memdup_user(u64_to_user_ptr(cl->object_ids), object_count * sizeof(__u32)); | 531 | object_ids = memdup_user(u64_to_user_ptr(cl->object_ids), |
532 | array_size(object_count, sizeof(__u32))); | ||
532 | if (IS_ERR(object_ids)) | 533 | if (IS_ERR(object_ids)) |
533 | return PTR_ERR(object_ids); | 534 | return PTR_ERR(object_ids); |
534 | 535 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 216f52b744a6..c882ea94172c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1824,6 +1824,16 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, | |||
1824 | return 0; | 1824 | return 0; |
1825 | } | 1825 | } |
1826 | 1826 | ||
1827 | static inline bool | ||
1828 | __vma_matches(struct vm_area_struct *vma, struct file *filp, | ||
1829 | unsigned long addr, unsigned long size) | ||
1830 | { | ||
1831 | if (vma->vm_file != filp) | ||
1832 | return false; | ||
1833 | |||
1834 | return vma->vm_start == addr && (vma->vm_end - vma->vm_start) == size; | ||
1835 | } | ||
1836 | |||
1827 | /** | 1837 | /** |
1828 | * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address | 1838 | * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address |
1829 | * it is mapped to. | 1839 | * it is mapped to. |
@@ -1882,7 +1892,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
1882 | return -EINTR; | 1892 | return -EINTR; |
1883 | } | 1893 | } |
1884 | vma = find_vma(mm, addr); | 1894 | vma = find_vma(mm, addr); |
1885 | if (vma) | 1895 | if (vma && __vma_matches(vma, obj->base.filp, addr, args->size)) |
1886 | vma->vm_page_prot = | 1896 | vma->vm_page_prot = |
1887 | pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); | 1897 | pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); |
1888 | else | 1898 | else |
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index d6c8f8fdfda5..017fc602a10e 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c | |||
@@ -594,7 +594,8 @@ static void i915_pmu_enable(struct perf_event *event) | |||
594 | * Update the bitmask of enabled events and increment | 594 | * Update the bitmask of enabled events and increment |
595 | * the event reference counter. | 595 | * the event reference counter. |
596 | */ | 596 | */ |
597 | GEM_BUG_ON(bit >= I915_PMU_MASK_BITS); | 597 | BUILD_BUG_ON(ARRAY_SIZE(i915->pmu.enable_count) != I915_PMU_MASK_BITS); |
598 | GEM_BUG_ON(bit >= ARRAY_SIZE(i915->pmu.enable_count)); | ||
598 | GEM_BUG_ON(i915->pmu.enable_count[bit] == ~0); | 599 | GEM_BUG_ON(i915->pmu.enable_count[bit] == ~0); |
599 | i915->pmu.enable |= BIT_ULL(bit); | 600 | i915->pmu.enable |= BIT_ULL(bit); |
600 | i915->pmu.enable_count[bit]++; | 601 | i915->pmu.enable_count[bit]++; |
@@ -615,11 +616,16 @@ static void i915_pmu_enable(struct perf_event *event) | |||
615 | engine = intel_engine_lookup_user(i915, | 616 | engine = intel_engine_lookup_user(i915, |
616 | engine_event_class(event), | 617 | engine_event_class(event), |
617 | engine_event_instance(event)); | 618 | engine_event_instance(event)); |
618 | GEM_BUG_ON(!engine); | ||
619 | engine->pmu.enable |= BIT(sample); | ||
620 | 619 | ||
621 | GEM_BUG_ON(sample >= I915_PMU_SAMPLE_BITS); | 620 | BUILD_BUG_ON(ARRAY_SIZE(engine->pmu.enable_count) != |
621 | I915_ENGINE_SAMPLE_COUNT); | ||
622 | BUILD_BUG_ON(ARRAY_SIZE(engine->pmu.sample) != | ||
623 | I915_ENGINE_SAMPLE_COUNT); | ||
624 | GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.enable_count)); | ||
625 | GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.sample)); | ||
622 | GEM_BUG_ON(engine->pmu.enable_count[sample] == ~0); | 626 | GEM_BUG_ON(engine->pmu.enable_count[sample] == ~0); |
627 | |||
628 | engine->pmu.enable |= BIT(sample); | ||
623 | engine->pmu.enable_count[sample]++; | 629 | engine->pmu.enable_count[sample]++; |
624 | } | 630 | } |
625 | 631 | ||
@@ -649,9 +655,11 @@ static void i915_pmu_disable(struct perf_event *event) | |||
649 | engine = intel_engine_lookup_user(i915, | 655 | engine = intel_engine_lookup_user(i915, |
650 | engine_event_class(event), | 656 | engine_event_class(event), |
651 | engine_event_instance(event)); | 657 | engine_event_instance(event)); |
652 | GEM_BUG_ON(!engine); | 658 | |
653 | GEM_BUG_ON(sample >= I915_PMU_SAMPLE_BITS); | 659 | GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.enable_count)); |
660 | GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.sample)); | ||
654 | GEM_BUG_ON(engine->pmu.enable_count[sample] == 0); | 661 | GEM_BUG_ON(engine->pmu.enable_count[sample] == 0); |
662 | |||
655 | /* | 663 | /* |
656 | * Decrement the reference count and clear the enabled | 664 | * Decrement the reference count and clear the enabled |
657 | * bitmask when the last listener on an event goes away. | 665 | * bitmask when the last listener on an event goes away. |
@@ -660,7 +668,7 @@ static void i915_pmu_disable(struct perf_event *event) | |||
660 | engine->pmu.enable &= ~BIT(sample); | 668 | engine->pmu.enable &= ~BIT(sample); |
661 | } | 669 | } |
662 | 670 | ||
663 | GEM_BUG_ON(bit >= I915_PMU_MASK_BITS); | 671 | GEM_BUG_ON(bit >= ARRAY_SIZE(i915->pmu.enable_count)); |
664 | GEM_BUG_ON(i915->pmu.enable_count[bit] == 0); | 672 | GEM_BUG_ON(i915->pmu.enable_count[bit] == 0); |
665 | /* | 673 | /* |
666 | * Decrement the reference count and clear the enabled | 674 | * Decrement the reference count and clear the enabled |
diff --git a/drivers/gpu/drm/i915/i915_pmu.h b/drivers/gpu/drm/i915/i915_pmu.h index 7f164ca3db12..b3728c5f13e7 100644 --- a/drivers/gpu/drm/i915/i915_pmu.h +++ b/drivers/gpu/drm/i915/i915_pmu.h | |||
@@ -31,6 +31,8 @@ enum { | |||
31 | ((1 << I915_PMU_SAMPLE_BITS) + \ | 31 | ((1 << I915_PMU_SAMPLE_BITS) + \ |
32 | (I915_PMU_LAST + 1 - __I915_PMU_OTHER(0))) | 32 | (I915_PMU_LAST + 1 - __I915_PMU_OTHER(0))) |
33 | 33 | ||
34 | #define I915_ENGINE_SAMPLE_COUNT (I915_SAMPLE_SEMA + 1) | ||
35 | |||
34 | struct i915_pmu_sample { | 36 | struct i915_pmu_sample { |
35 | u64 cur; | 37 | u64 cur; |
36 | }; | 38 | }; |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 0a7d60509ca7..067054cf4a86 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1790,7 +1790,7 @@ enum i915_power_well_id { | |||
1790 | #define _CNL_PORT_TX_C_LN0_OFFSET 0x162C40 | 1790 | #define _CNL_PORT_TX_C_LN0_OFFSET 0x162C40 |
1791 | #define _CNL_PORT_TX_D_LN0_OFFSET 0x162E40 | 1791 | #define _CNL_PORT_TX_D_LN0_OFFSET 0x162E40 |
1792 | #define _CNL_PORT_TX_F_LN0_OFFSET 0x162840 | 1792 | #define _CNL_PORT_TX_F_LN0_OFFSET 0x162840 |
1793 | #define _CNL_PORT_TX_DW_GRP(port, dw) (_PICK((port), \ | 1793 | #define _CNL_PORT_TX_DW_GRP(dw, port) (_PICK((port), \ |
1794 | _CNL_PORT_TX_AE_GRP_OFFSET, \ | 1794 | _CNL_PORT_TX_AE_GRP_OFFSET, \ |
1795 | _CNL_PORT_TX_B_GRP_OFFSET, \ | 1795 | _CNL_PORT_TX_B_GRP_OFFSET, \ |
1796 | _CNL_PORT_TX_B_GRP_OFFSET, \ | 1796 | _CNL_PORT_TX_B_GRP_OFFSET, \ |
@@ -1798,7 +1798,7 @@ enum i915_power_well_id { | |||
1798 | _CNL_PORT_TX_AE_GRP_OFFSET, \ | 1798 | _CNL_PORT_TX_AE_GRP_OFFSET, \ |
1799 | _CNL_PORT_TX_F_GRP_OFFSET) + \ | 1799 | _CNL_PORT_TX_F_GRP_OFFSET) + \ |
1800 | 4 * (dw)) | 1800 | 4 * (dw)) |
1801 | #define _CNL_PORT_TX_DW_LN0(port, dw) (_PICK((port), \ | 1801 | #define _CNL_PORT_TX_DW_LN0(dw, port) (_PICK((port), \ |
1802 | _CNL_PORT_TX_AE_LN0_OFFSET, \ | 1802 | _CNL_PORT_TX_AE_LN0_OFFSET, \ |
1803 | _CNL_PORT_TX_B_LN0_OFFSET, \ | 1803 | _CNL_PORT_TX_B_LN0_OFFSET, \ |
1804 | _CNL_PORT_TX_B_LN0_OFFSET, \ | 1804 | _CNL_PORT_TX_B_LN0_OFFSET, \ |
@@ -1834,9 +1834,9 @@ enum i915_power_well_id { | |||
1834 | 1834 | ||
1835 | #define _CNL_PORT_TX_DW4_LN0_AE 0x162450 | 1835 | #define _CNL_PORT_TX_DW4_LN0_AE 0x162450 |
1836 | #define _CNL_PORT_TX_DW4_LN1_AE 0x1624D0 | 1836 | #define _CNL_PORT_TX_DW4_LN1_AE 0x1624D0 |
1837 | #define CNL_PORT_TX_DW4_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 4)) | 1837 | #define CNL_PORT_TX_DW4_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP(4, (port))) |
1838 | #define CNL_PORT_TX_DW4_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4)) | 1838 | #define CNL_PORT_TX_DW4_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0(4, (port))) |
1839 | #define CNL_PORT_TX_DW4_LN(port, ln) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4) + \ | 1839 | #define CNL_PORT_TX_DW4_LN(port, ln) _MMIO(_CNL_PORT_TX_DW_LN0(4, (port)) + \ |
1840 | ((ln) * (_CNL_PORT_TX_DW4_LN1_AE - \ | 1840 | ((ln) * (_CNL_PORT_TX_DW4_LN1_AE - \ |
1841 | _CNL_PORT_TX_DW4_LN0_AE))) | 1841 | _CNL_PORT_TX_DW4_LN0_AE))) |
1842 | #define ICL_PORT_TX_DW4_AUX(port) _MMIO(_ICL_PORT_TX_DW_AUX(4, port)) | 1842 | #define ICL_PORT_TX_DW4_AUX(port) _MMIO(_ICL_PORT_TX_DW_AUX(4, port)) |
@@ -1864,8 +1864,12 @@ enum i915_power_well_id { | |||
1864 | #define RTERM_SELECT(x) ((x) << 3) | 1864 | #define RTERM_SELECT(x) ((x) << 3) |
1865 | #define RTERM_SELECT_MASK (0x7 << 3) | 1865 | #define RTERM_SELECT_MASK (0x7 << 3) |
1866 | 1866 | ||
1867 | #define CNL_PORT_TX_DW7_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 7)) | 1867 | #define CNL_PORT_TX_DW7_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP(7, (port))) |
1868 | #define CNL_PORT_TX_DW7_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 7)) | 1868 | #define CNL_PORT_TX_DW7_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0(7, (port))) |
1869 | #define ICL_PORT_TX_DW7_AUX(port) _MMIO(_ICL_PORT_TX_DW_AUX(7, port)) | ||
1870 | #define ICL_PORT_TX_DW7_GRP(port) _MMIO(_ICL_PORT_TX_DW_GRP(7, port)) | ||
1871 | #define ICL_PORT_TX_DW7_LN0(port) _MMIO(_ICL_PORT_TX_DW_LN(7, 0, port)) | ||
1872 | #define ICL_PORT_TX_DW7_LN(port, ln) _MMIO(_ICL_PORT_TX_DW_LN(7, ln, port)) | ||
1869 | #define N_SCALAR(x) ((x) << 24) | 1873 | #define N_SCALAR(x) ((x) << 24) |
1870 | #define N_SCALAR_MASK (0x7F << 24) | 1874 | #define N_SCALAR_MASK (0x7F << 24) |
1871 | 1875 | ||
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 4079050f9d6c..7edce1b7b348 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -494,103 +494,58 @@ static const struct cnl_ddi_buf_trans cnl_ddi_translations_edp_1_05V[] = { | |||
494 | { 0x2, 0x7F, 0x3F, 0x00, 0x00 }, /* 400 400 0.0 */ | 494 | { 0x2, 0x7F, 0x3F, 0x00, 0x00 }, /* 400 400 0.0 */ |
495 | }; | 495 | }; |
496 | 496 | ||
497 | struct icl_combo_phy_ddi_buf_trans { | 497 | /* icl_combo_phy_ddi_translations */ |
498 | u32 dw2_swing_select; | 498 | static const struct cnl_ddi_buf_trans icl_combo_phy_ddi_translations_dp_hbr2[] = { |
499 | u32 dw2_swing_scalar; | 499 | /* NT mV Trans mV db */ |
500 | u32 dw4_scaling; | 500 | { 0xA, 0x35, 0x3F, 0x00, 0x00 }, /* 350 350 0.0 */ |
501 | }; | 501 | { 0xA, 0x4F, 0x37, 0x00, 0x08 }, /* 350 500 3.1 */ |
502 | 502 | { 0xC, 0x71, 0x2F, 0x00, 0x10 }, /* 350 700 6.0 */ | |
503 | /* Voltage Swing Programming for VccIO 0.85V for DP */ | 503 | { 0x6, 0x7F, 0x2B, 0x00, 0x14 }, /* 350 900 8.2 */ |
504 | static const struct icl_combo_phy_ddi_buf_trans icl_combo_phy_ddi_translations_dp_hdmi_0_85V[] = { | 504 | { 0xA, 0x4C, 0x3F, 0x00, 0x00 }, /* 500 500 0.0 */ |
505 | /* Voltage mV db */ | 505 | { 0xC, 0x73, 0x34, 0x00, 0x0B }, /* 500 700 2.9 */ |
506 | { 0x2, 0x98, 0x0018 }, /* 400 0.0 */ | 506 | { 0x6, 0x7F, 0x2F, 0x00, 0x10 }, /* 500 900 5.1 */ |
507 | { 0x2, 0x98, 0x3015 }, /* 400 3.5 */ | 507 | { 0xC, 0x6C, 0x3C, 0x00, 0x03 }, /* 650 700 0.6 */ |
508 | { 0x2, 0x98, 0x6012 }, /* 400 6.0 */ | 508 | { 0x6, 0x7F, 0x35, 0x00, 0x0A }, /* 600 900 3.5 */ |
509 | { 0x2, 0x98, 0x900F }, /* 400 9.5 */ | 509 | { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 900 900 0.0 */ |
510 | { 0xB, 0x70, 0x0018 }, /* 600 0.0 */ | ||
511 | { 0xB, 0x70, 0x3015 }, /* 600 3.5 */ | ||
512 | { 0xB, 0x70, 0x6012 }, /* 600 6.0 */ | ||
513 | { 0x5, 0x00, 0x0018 }, /* 800 0.0 */ | ||
514 | { 0x5, 0x00, 0x3015 }, /* 800 3.5 */ | ||
515 | { 0x6, 0x98, 0x0018 }, /* 1200 0.0 */ | ||
516 | }; | ||
517 | |||
518 | /* FIXME - After table is updated in Bspec */ | ||
519 | /* Voltage Swing Programming for VccIO 0.85V for eDP */ | ||
520 | static const struct icl_combo_phy_ddi_buf_trans icl_combo_phy_ddi_translations_edp_0_85V[] = { | ||
521 | /* Voltage mV db */ | ||
522 | { 0x0, 0x00, 0x00 }, /* 200 0.0 */ | ||
523 | { 0x0, 0x00, 0x00 }, /* 200 1.5 */ | ||
524 | { 0x0, 0x00, 0x00 }, /* 200 4.0 */ | ||
525 | { 0x0, 0x00, 0x00 }, /* 200 6.0 */ | ||
526 | { 0x0, 0x00, 0x00 }, /* 250 0.0 */ | ||
527 | { 0x0, 0x00, 0x00 }, /* 250 1.5 */ | ||
528 | { 0x0, 0x00, 0x00 }, /* 250 4.0 */ | ||
529 | { 0x0, 0x00, 0x00 }, /* 300 0.0 */ | ||
530 | { 0x0, 0x00, 0x00 }, /* 300 1.5 */ | ||
531 | { 0x0, 0x00, 0x00 }, /* 350 0.0 */ | ||
532 | }; | ||
533 | |||
534 | /* Voltage Swing Programming for VccIO 0.95V for DP */ | ||
535 | static const struct icl_combo_phy_ddi_buf_trans icl_combo_phy_ddi_translations_dp_hdmi_0_95V[] = { | ||
536 | /* Voltage mV db */ | ||
537 | { 0x2, 0x98, 0x0018 }, /* 400 0.0 */ | ||
538 | { 0x2, 0x98, 0x3015 }, /* 400 3.5 */ | ||
539 | { 0x2, 0x98, 0x6012 }, /* 400 6.0 */ | ||
540 | { 0x2, 0x98, 0x900F }, /* 400 9.5 */ | ||
541 | { 0x4, 0x98, 0x0018 }, /* 600 0.0 */ | ||
542 | { 0x4, 0x98, 0x3015 }, /* 600 3.5 */ | ||
543 | { 0x4, 0x98, 0x6012 }, /* 600 6.0 */ | ||
544 | { 0x5, 0x76, 0x0018 }, /* 800 0.0 */ | ||
545 | { 0x5, 0x76, 0x3015 }, /* 800 3.5 */ | ||
546 | { 0x6, 0x98, 0x0018 }, /* 1200 0.0 */ | ||
547 | }; | 510 | }; |
548 | 511 | ||
549 | /* FIXME - After table is updated in Bspec */ | 512 | static const struct cnl_ddi_buf_trans icl_combo_phy_ddi_translations_edp_hbr2[] = { |
550 | /* Voltage Swing Programming for VccIO 0.95V for eDP */ | 513 | /* NT mV Trans mV db */ |
551 | static const struct icl_combo_phy_ddi_buf_trans icl_combo_phy_ddi_translations_edp_0_95V[] = { | 514 | { 0x0, 0x7F, 0x3F, 0x00, 0x00 }, /* 200 200 0.0 */ |
552 | /* Voltage mV db */ | 515 | { 0x8, 0x7F, 0x38, 0x00, 0x07 }, /* 200 250 1.9 */ |
553 | { 0x0, 0x00, 0x00 }, /* 200 0.0 */ | 516 | { 0x1, 0x7F, 0x33, 0x00, 0x0C }, /* 200 300 3.5 */ |
554 | { 0x0, 0x00, 0x00 }, /* 200 1.5 */ | 517 | { 0x9, 0x7F, 0x31, 0x00, 0x0E }, /* 200 350 4.9 */ |
555 | { 0x0, 0x00, 0x00 }, /* 200 4.0 */ | 518 | { 0x8, 0x7F, 0x3F, 0x00, 0x00 }, /* 250 250 0.0 */ |
556 | { 0x0, 0x00, 0x00 }, /* 200 6.0 */ | 519 | { 0x1, 0x7F, 0x38, 0x00, 0x07 }, /* 250 300 1.6 */ |
557 | { 0x0, 0x00, 0x00 }, /* 250 0.0 */ | 520 | { 0x9, 0x7F, 0x35, 0x00, 0x0A }, /* 250 350 2.9 */ |
558 | { 0x0, 0x00, 0x00 }, /* 250 1.5 */ | 521 | { 0x1, 0x7F, 0x3F, 0x00, 0x00 }, /* 300 300 0.0 */ |
559 | { 0x0, 0x00, 0x00 }, /* 250 4.0 */ | 522 | { 0x9, 0x7F, 0x38, 0x00, 0x07 }, /* 300 350 1.3 */ |
560 | { 0x0, 0x00, 0x00 }, /* 300 0.0 */ | 523 | { 0x9, 0x7F, 0x3F, 0x00, 0x00 }, /* 350 350 0.0 */ |
561 | { 0x0, 0x00, 0x00 }, /* 300 1.5 */ | ||
562 | { 0x0, 0x00, 0x00 }, /* 350 0.0 */ | ||
563 | }; | 524 | }; |
564 | 525 | ||
565 | /* Voltage Swing Programming for VccIO 1.05V for DP */ | 526 | static const struct cnl_ddi_buf_trans icl_combo_phy_ddi_translations_edp_hbr3[] = { |
566 | static const struct icl_combo_phy_ddi_buf_trans icl_combo_phy_ddi_translations_dp_hdmi_1_05V[] = { | 527 | /* NT mV Trans mV db */ |
567 | /* Voltage mV db */ | 528 | { 0xA, 0x35, 0x3F, 0x00, 0x00 }, /* 350 350 0.0 */ |
568 | { 0x2, 0x98, 0x0018 }, /* 400 0.0 */ | 529 | { 0xA, 0x4F, 0x37, 0x00, 0x08 }, /* 350 500 3.1 */ |
569 | { 0x2, 0x98, 0x3015 }, /* 400 3.5 */ | 530 | { 0xC, 0x71, 0x2F, 0x00, 0x10 }, /* 350 700 6.0 */ |
570 | { 0x2, 0x98, 0x6012 }, /* 400 6.0 */ | 531 | { 0x6, 0x7F, 0x2B, 0x00, 0x14 }, /* 350 900 8.2 */ |
571 | { 0x2, 0x98, 0x900F }, /* 400 9.5 */ | 532 | { 0xA, 0x4C, 0x3F, 0x00, 0x00 }, /* 500 500 0.0 */ |
572 | { 0x4, 0x98, 0x0018 }, /* 600 0.0 */ | 533 | { 0xC, 0x73, 0x34, 0x00, 0x0B }, /* 500 700 2.9 */ |
573 | { 0x4, 0x98, 0x3015 }, /* 600 3.5 */ | 534 | { 0x6, 0x7F, 0x2F, 0x00, 0x10 }, /* 500 900 5.1 */ |
574 | { 0x4, 0x98, 0x6012 }, /* 600 6.0 */ | 535 | { 0xC, 0x6C, 0x3C, 0x00, 0x03 }, /* 650 700 0.6 */ |
575 | { 0x5, 0x71, 0x0018 }, /* 800 0.0 */ | 536 | { 0x6, 0x7F, 0x35, 0x00, 0x0A }, /* 600 900 3.5 */ |
576 | { 0x5, 0x71, 0x3015 }, /* 800 3.5 */ | 537 | { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 900 900 0.0 */ |
577 | { 0x6, 0x98, 0x0018 }, /* 1200 0.0 */ | ||
578 | }; | 538 | }; |
579 | 539 | ||
580 | /* FIXME - After table is updated in Bspec */ | 540 | static const struct cnl_ddi_buf_trans icl_combo_phy_ddi_translations_hdmi[] = { |
581 | /* Voltage Swing Programming for VccIO 1.05V for eDP */ | 541 | /* NT mV Trans mV db */ |
582 | static const struct icl_combo_phy_ddi_buf_trans icl_combo_phy_ddi_translations_edp_1_05V[] = { | 542 | { 0xA, 0x60, 0x3F, 0x00, 0x00 }, /* 450 450 0.0 */ |
583 | /* Voltage mV db */ | 543 | { 0xB, 0x73, 0x36, 0x00, 0x09 }, /* 450 650 3.2 */ |
584 | { 0x0, 0x00, 0x00 }, /* 200 0.0 */ | 544 | { 0x6, 0x7F, 0x31, 0x00, 0x0E }, /* 450 850 5.5 */ |
585 | { 0x0, 0x00, 0x00 }, /* 200 1.5 */ | 545 | { 0xB, 0x73, 0x3F, 0x00, 0x00 }, /* 650 650 0.0 ALS */ |
586 | { 0x0, 0x00, 0x00 }, /* 200 4.0 */ | 546 | { 0x6, 0x7F, 0x37, 0x00, 0x08 }, /* 650 850 2.3 */ |
587 | { 0x0, 0x00, 0x00 }, /* 200 6.0 */ | 547 | { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 850 850 0.0 */ |
588 | { 0x0, 0x00, 0x00 }, /* 250 0.0 */ | 548 | { 0x6, 0x7F, 0x35, 0x00, 0x0A }, /* 600 850 3.0 */ |
589 | { 0x0, 0x00, 0x00 }, /* 250 1.5 */ | ||
590 | { 0x0, 0x00, 0x00 }, /* 250 4.0 */ | ||
591 | { 0x0, 0x00, 0x00 }, /* 300 0.0 */ | ||
592 | { 0x0, 0x00, 0x00 }, /* 300 1.5 */ | ||
593 | { 0x0, 0x00, 0x00 }, /* 350 0.0 */ | ||
594 | }; | 549 | }; |
595 | 550 | ||
596 | struct icl_mg_phy_ddi_buf_trans { | 551 | struct icl_mg_phy_ddi_buf_trans { |
@@ -871,43 +826,23 @@ cnl_get_buf_trans_edp(struct drm_i915_private *dev_priv, int *n_entries) | |||
871 | } | 826 | } |
872 | } | 827 | } |
873 | 828 | ||
874 | static const struct icl_combo_phy_ddi_buf_trans * | 829 | static const struct cnl_ddi_buf_trans * |
875 | icl_get_combo_buf_trans(struct drm_i915_private *dev_priv, enum port port, | 830 | icl_get_combo_buf_trans(struct drm_i915_private *dev_priv, enum port port, |
876 | int type, int *n_entries) | 831 | int type, int rate, int *n_entries) |
877 | { | 832 | { |
878 | u32 voltage = I915_READ(ICL_PORT_COMP_DW3(port)) & VOLTAGE_INFO_MASK; | 833 | if (type == INTEL_OUTPUT_HDMI) { |
879 | 834 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_hdmi); | |
880 | if (type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp.low_vswing) { | 835 | return icl_combo_phy_ddi_translations_hdmi; |
881 | switch (voltage) { | 836 | } else if (rate > 540000 && type == INTEL_OUTPUT_EDP) { |
882 | case VOLTAGE_INFO_0_85V: | 837 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_edp_hbr3); |
883 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_edp_0_85V); | 838 | return icl_combo_phy_ddi_translations_edp_hbr3; |
884 | return icl_combo_phy_ddi_translations_edp_0_85V; | 839 | } else if (type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp.low_vswing) { |
885 | case VOLTAGE_INFO_0_95V: | 840 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_edp_hbr2); |
886 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_edp_0_95V); | 841 | return icl_combo_phy_ddi_translations_edp_hbr2; |
887 | return icl_combo_phy_ddi_translations_edp_0_95V; | ||
888 | case VOLTAGE_INFO_1_05V: | ||
889 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_edp_1_05V); | ||
890 | return icl_combo_phy_ddi_translations_edp_1_05V; | ||
891 | default: | ||
892 | MISSING_CASE(voltage); | ||
893 | return NULL; | ||
894 | } | ||
895 | } else { | ||
896 | switch (voltage) { | ||
897 | case VOLTAGE_INFO_0_85V: | ||
898 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_dp_hdmi_0_85V); | ||
899 | return icl_combo_phy_ddi_translations_dp_hdmi_0_85V; | ||
900 | case VOLTAGE_INFO_0_95V: | ||
901 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_dp_hdmi_0_95V); | ||
902 | return icl_combo_phy_ddi_translations_dp_hdmi_0_95V; | ||
903 | case VOLTAGE_INFO_1_05V: | ||
904 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_dp_hdmi_1_05V); | ||
905 | return icl_combo_phy_ddi_translations_dp_hdmi_1_05V; | ||
906 | default: | ||
907 | MISSING_CASE(voltage); | ||
908 | return NULL; | ||
909 | } | ||
910 | } | 842 | } |
843 | |||
844 | *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_dp_hbr2); | ||
845 | return icl_combo_phy_ddi_translations_dp_hbr2; | ||
911 | } | 846 | } |
912 | 847 | ||
913 | static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port port) | 848 | static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port port) |
@@ -918,8 +853,8 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por | |||
918 | 853 | ||
919 | if (IS_ICELAKE(dev_priv)) { | 854 | if (IS_ICELAKE(dev_priv)) { |
920 | if (intel_port_is_combophy(dev_priv, port)) | 855 | if (intel_port_is_combophy(dev_priv, port)) |
921 | icl_get_combo_buf_trans(dev_priv, port, | 856 | icl_get_combo_buf_trans(dev_priv, port, INTEL_OUTPUT_HDMI, |
922 | INTEL_OUTPUT_HDMI, &n_entries); | 857 | 0, &n_entries); |
923 | else | 858 | else |
924 | n_entries = ARRAY_SIZE(icl_mg_phy_ddi_translations); | 859 | n_entries = ARRAY_SIZE(icl_mg_phy_ddi_translations); |
925 | default_entry = n_entries - 1; | 860 | default_entry = n_entries - 1; |
@@ -2275,13 +2210,14 @@ static void bxt_ddi_vswing_sequence(struct intel_encoder *encoder, | |||
2275 | u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder) | 2210 | u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder) |
2276 | { | 2211 | { |
2277 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); | 2212 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
2213 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); | ||
2278 | enum port port = encoder->port; | 2214 | enum port port = encoder->port; |
2279 | int n_entries; | 2215 | int n_entries; |
2280 | 2216 | ||
2281 | if (IS_ICELAKE(dev_priv)) { | 2217 | if (IS_ICELAKE(dev_priv)) { |
2282 | if (intel_port_is_combophy(dev_priv, port)) | 2218 | if (intel_port_is_combophy(dev_priv, port)) |
2283 | icl_get_combo_buf_trans(dev_priv, port, encoder->type, | 2219 | icl_get_combo_buf_trans(dev_priv, port, encoder->type, |
2284 | &n_entries); | 2220 | intel_dp->link_rate, &n_entries); |
2285 | else | 2221 | else |
2286 | n_entries = ARRAY_SIZE(icl_mg_phy_ddi_translations); | 2222 | n_entries = ARRAY_SIZE(icl_mg_phy_ddi_translations); |
2287 | } else if (IS_CANNONLAKE(dev_priv)) { | 2223 | } else if (IS_CANNONLAKE(dev_priv)) { |
@@ -2462,14 +2398,15 @@ static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, | |||
2462 | } | 2398 | } |
2463 | 2399 | ||
2464 | static void icl_ddi_combo_vswing_program(struct drm_i915_private *dev_priv, | 2400 | static void icl_ddi_combo_vswing_program(struct drm_i915_private *dev_priv, |
2465 | u32 level, enum port port, int type) | 2401 | u32 level, enum port port, int type, |
2402 | int rate) | ||
2466 | { | 2403 | { |
2467 | const struct icl_combo_phy_ddi_buf_trans *ddi_translations = NULL; | 2404 | const struct cnl_ddi_buf_trans *ddi_translations = NULL; |
2468 | u32 n_entries, val; | 2405 | u32 n_entries, val; |
2469 | int ln; | 2406 | int ln; |
2470 | 2407 | ||
2471 | ddi_translations = icl_get_combo_buf_trans(dev_priv, port, type, | 2408 | ddi_translations = icl_get_combo_buf_trans(dev_priv, port, type, |
2472 | &n_entries); | 2409 | rate, &n_entries); |
2473 | if (!ddi_translations) | 2410 | if (!ddi_translations) |
2474 | return; | 2411 | return; |
2475 | 2412 | ||
@@ -2478,34 +2415,23 @@ static void icl_ddi_combo_vswing_program(struct drm_i915_private *dev_priv, | |||
2478 | level = n_entries - 1; | 2415 | level = n_entries - 1; |
2479 | } | 2416 | } |
2480 | 2417 | ||
2481 | /* Set PORT_TX_DW5 Rterm Sel to 110b. */ | 2418 | /* Set PORT_TX_DW5 */ |
2482 | val = I915_READ(ICL_PORT_TX_DW5_LN0(port)); | 2419 | val = I915_READ(ICL_PORT_TX_DW5_LN0(port)); |
2483 | val &= ~RTERM_SELECT_MASK; | 2420 | val &= ~(SCALING_MODE_SEL_MASK | RTERM_SELECT_MASK | |
2421 | TAP2_DISABLE | TAP3_DISABLE); | ||
2422 | val |= SCALING_MODE_SEL(0x2); | ||
2484 | val |= RTERM_SELECT(0x6); | 2423 | val |= RTERM_SELECT(0x6); |
2485 | I915_WRITE(ICL_PORT_TX_DW5_GRP(port), val); | 2424 | val |= TAP3_DISABLE; |
2486 | |||
2487 | /* Program PORT_TX_DW5 */ | ||
2488 | val = I915_READ(ICL_PORT_TX_DW5_LN0(port)); | ||
2489 | /* Set DisableTap2 and DisableTap3 if MIPI DSI | ||
2490 | * Clear DisableTap2 and DisableTap3 for all other Ports | ||
2491 | */ | ||
2492 | if (type == INTEL_OUTPUT_DSI) { | ||
2493 | val |= TAP2_DISABLE; | ||
2494 | val |= TAP3_DISABLE; | ||
2495 | } else { | ||
2496 | val &= ~TAP2_DISABLE; | ||
2497 | val &= ~TAP3_DISABLE; | ||
2498 | } | ||
2499 | I915_WRITE(ICL_PORT_TX_DW5_GRP(port), val); | 2425 | I915_WRITE(ICL_PORT_TX_DW5_GRP(port), val); |
2500 | 2426 | ||
2501 | /* Program PORT_TX_DW2 */ | 2427 | /* Program PORT_TX_DW2 */ |
2502 | val = I915_READ(ICL_PORT_TX_DW2_LN0(port)); | 2428 | val = I915_READ(ICL_PORT_TX_DW2_LN0(port)); |
2503 | val &= ~(SWING_SEL_LOWER_MASK | SWING_SEL_UPPER_MASK | | 2429 | val &= ~(SWING_SEL_LOWER_MASK | SWING_SEL_UPPER_MASK | |
2504 | RCOMP_SCALAR_MASK); | 2430 | RCOMP_SCALAR_MASK); |
2505 | val |= SWING_SEL_UPPER(ddi_translations[level].dw2_swing_select); | 2431 | val |= SWING_SEL_UPPER(ddi_translations[level].dw2_swing_sel); |
2506 | val |= SWING_SEL_LOWER(ddi_translations[level].dw2_swing_select); | 2432 | val |= SWING_SEL_LOWER(ddi_translations[level].dw2_swing_sel); |
2507 | /* Program Rcomp scalar for every table entry */ | 2433 | /* Program Rcomp scalar for every table entry */ |
2508 | val |= RCOMP_SCALAR(ddi_translations[level].dw2_swing_scalar); | 2434 | val |= RCOMP_SCALAR(0x98); |
2509 | I915_WRITE(ICL_PORT_TX_DW2_GRP(port), val); | 2435 | I915_WRITE(ICL_PORT_TX_DW2_GRP(port), val); |
2510 | 2436 | ||
2511 | /* Program PORT_TX_DW4 */ | 2437 | /* Program PORT_TX_DW4 */ |
@@ -2514,9 +2440,17 @@ static void icl_ddi_combo_vswing_program(struct drm_i915_private *dev_priv, | |||
2514 | val = I915_READ(ICL_PORT_TX_DW4_LN(port, ln)); | 2440 | val = I915_READ(ICL_PORT_TX_DW4_LN(port, ln)); |
2515 | val &= ~(POST_CURSOR_1_MASK | POST_CURSOR_2_MASK | | 2441 | val &= ~(POST_CURSOR_1_MASK | POST_CURSOR_2_MASK | |
2516 | CURSOR_COEFF_MASK); | 2442 | CURSOR_COEFF_MASK); |
2517 | val |= ddi_translations[level].dw4_scaling; | 2443 | val |= POST_CURSOR_1(ddi_translations[level].dw4_post_cursor_1); |
2444 | val |= POST_CURSOR_2(ddi_translations[level].dw4_post_cursor_2); | ||
2445 | val |= CURSOR_COEFF(ddi_translations[level].dw4_cursor_coeff); | ||
2518 | I915_WRITE(ICL_PORT_TX_DW4_LN(port, ln), val); | 2446 | I915_WRITE(ICL_PORT_TX_DW4_LN(port, ln), val); |
2519 | } | 2447 | } |
2448 | |||
2449 | /* Program PORT_TX_DW7 */ | ||
2450 | val = I915_READ(ICL_PORT_TX_DW7_LN0(port)); | ||
2451 | val &= ~N_SCALAR_MASK; | ||
2452 | val |= N_SCALAR(ddi_translations[level].dw7_n_scalar); | ||
2453 | I915_WRITE(ICL_PORT_TX_DW7_GRP(port), val); | ||
2520 | } | 2454 | } |
2521 | 2455 | ||
2522 | static void icl_combo_phy_ddi_vswing_sequence(struct intel_encoder *encoder, | 2456 | static void icl_combo_phy_ddi_vswing_sequence(struct intel_encoder *encoder, |
@@ -2581,7 +2515,7 @@ static void icl_combo_phy_ddi_vswing_sequence(struct intel_encoder *encoder, | |||
2581 | I915_WRITE(ICL_PORT_TX_DW5_GRP(port), val); | 2515 | I915_WRITE(ICL_PORT_TX_DW5_GRP(port), val); |
2582 | 2516 | ||
2583 | /* 5. Program swing and de-emphasis */ | 2517 | /* 5. Program swing and de-emphasis */ |
2584 | icl_ddi_combo_vswing_program(dev_priv, level, port, type); | 2518 | icl_ddi_combo_vswing_program(dev_priv, level, port, type, rate); |
2585 | 2519 | ||
2586 | /* 6. Set training enable to trigger update */ | 2520 | /* 6. Set training enable to trigger update */ |
2587 | val = I915_READ(ICL_PORT_TX_DW5_LN0(port)); | 2521 | val = I915_READ(ICL_PORT_TX_DW5_LN0(port)); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index fdd2cbc56fa3..22a74608c6e4 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -304,9 +304,11 @@ static int cnl_max_source_rate(struct intel_dp *intel_dp) | |||
304 | static int icl_max_source_rate(struct intel_dp *intel_dp) | 304 | static int icl_max_source_rate(struct intel_dp *intel_dp) |
305 | { | 305 | { |
306 | struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); | 306 | struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); |
307 | struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev); | ||
307 | enum port port = dig_port->base.port; | 308 | enum port port = dig_port->base.port; |
308 | 309 | ||
309 | if (port == PORT_B) | 310 | if (intel_port_is_combophy(dev_priv, port) && |
311 | !intel_dp_is_edp(intel_dp)) | ||
310 | return 540000; | 312 | return 540000; |
311 | 313 | ||
312 | return 810000; | 314 | return 810000; |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index f94a04b4ad87..e9ddeaf05a14 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -209,6 +209,16 @@ struct intel_fbdev { | |||
209 | unsigned long vma_flags; | 209 | unsigned long vma_flags; |
210 | async_cookie_t cookie; | 210 | async_cookie_t cookie; |
211 | int preferred_bpp; | 211 | int preferred_bpp; |
212 | |||
213 | /* Whether or not fbdev hpd processing is temporarily suspended */ | ||
214 | bool hpd_suspended : 1; | ||
215 | /* Set when a hotplug was received while HPD processing was | ||
216 | * suspended | ||
217 | */ | ||
218 | bool hpd_waiting : 1; | ||
219 | |||
220 | /* Protects hpd_suspended */ | ||
221 | struct mutex hpd_lock; | ||
212 | }; | 222 | }; |
213 | 223 | ||
214 | struct intel_encoder { | 224 | struct intel_encoder { |
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index fb5bb5b32a60..7f365ac0b549 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
@@ -679,6 +679,7 @@ int intel_fbdev_init(struct drm_device *dev) | |||
679 | if (ifbdev == NULL) | 679 | if (ifbdev == NULL) |
680 | return -ENOMEM; | 680 | return -ENOMEM; |
681 | 681 | ||
682 | mutex_init(&ifbdev->hpd_lock); | ||
682 | drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs); | 683 | drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs); |
683 | 684 | ||
684 | if (!intel_fbdev_init_bios(dev, ifbdev)) | 685 | if (!intel_fbdev_init_bios(dev, ifbdev)) |
@@ -752,6 +753,26 @@ void intel_fbdev_fini(struct drm_i915_private *dev_priv) | |||
752 | intel_fbdev_destroy(ifbdev); | 753 | intel_fbdev_destroy(ifbdev); |
753 | } | 754 | } |
754 | 755 | ||
756 | /* Suspends/resumes fbdev processing of incoming HPD events. When resuming HPD | ||
757 | * processing, fbdev will perform a full connector reprobe if a hotplug event | ||
758 | * was received while HPD was suspended. | ||
759 | */ | ||
760 | static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state) | ||
761 | { | ||
762 | bool send_hpd = false; | ||
763 | |||
764 | mutex_lock(&ifbdev->hpd_lock); | ||
765 | ifbdev->hpd_suspended = state == FBINFO_STATE_SUSPENDED; | ||
766 | send_hpd = !ifbdev->hpd_suspended && ifbdev->hpd_waiting; | ||
767 | ifbdev->hpd_waiting = false; | ||
768 | mutex_unlock(&ifbdev->hpd_lock); | ||
769 | |||
770 | if (send_hpd) { | ||
771 | DRM_DEBUG_KMS("Handling delayed fbcon HPD event\n"); | ||
772 | drm_fb_helper_hotplug_event(&ifbdev->helper); | ||
773 | } | ||
774 | } | ||
775 | |||
755 | void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) | 776 | void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) |
756 | { | 777 | { |
757 | struct drm_i915_private *dev_priv = to_i915(dev); | 778 | struct drm_i915_private *dev_priv = to_i915(dev); |
@@ -773,6 +794,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous | |||
773 | */ | 794 | */ |
774 | if (state != FBINFO_STATE_RUNNING) | 795 | if (state != FBINFO_STATE_RUNNING) |
775 | flush_work(&dev_priv->fbdev_suspend_work); | 796 | flush_work(&dev_priv->fbdev_suspend_work); |
797 | |||
776 | console_lock(); | 798 | console_lock(); |
777 | } else { | 799 | } else { |
778 | /* | 800 | /* |
@@ -800,17 +822,26 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous | |||
800 | 822 | ||
801 | drm_fb_helper_set_suspend(&ifbdev->helper, state); | 823 | drm_fb_helper_set_suspend(&ifbdev->helper, state); |
802 | console_unlock(); | 824 | console_unlock(); |
825 | |||
826 | intel_fbdev_hpd_set_suspend(ifbdev, state); | ||
803 | } | 827 | } |
804 | 828 | ||
805 | void intel_fbdev_output_poll_changed(struct drm_device *dev) | 829 | void intel_fbdev_output_poll_changed(struct drm_device *dev) |
806 | { | 830 | { |
807 | struct intel_fbdev *ifbdev = to_i915(dev)->fbdev; | 831 | struct intel_fbdev *ifbdev = to_i915(dev)->fbdev; |
832 | bool send_hpd; | ||
808 | 833 | ||
809 | if (!ifbdev) | 834 | if (!ifbdev) |
810 | return; | 835 | return; |
811 | 836 | ||
812 | intel_fbdev_sync(ifbdev); | 837 | intel_fbdev_sync(ifbdev); |
813 | if (ifbdev->vma || ifbdev->helper.deferred_setup) | 838 | |
839 | mutex_lock(&ifbdev->hpd_lock); | ||
840 | send_hpd = !ifbdev->hpd_suspended; | ||
841 | ifbdev->hpd_waiting = true; | ||
842 | mutex_unlock(&ifbdev->hpd_lock); | ||
843 | |||
844 | if (send_hpd && (ifbdev->vma || ifbdev->helper.deferred_setup)) | ||
814 | drm_fb_helper_hotplug_event(&ifbdev->helper); | 845 | drm_fb_helper_hotplug_event(&ifbdev->helper); |
815 | } | 846 | } |
816 | 847 | ||
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index b8f106d9ecf8..3ac20153705a 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
@@ -55,7 +55,12 @@ | |||
55 | struct opregion_header { | 55 | struct opregion_header { |
56 | u8 signature[16]; | 56 | u8 signature[16]; |
57 | u32 size; | 57 | u32 size; |
58 | u32 opregion_ver; | 58 | struct { |
59 | u8 rsvd; | ||
60 | u8 revision; | ||
61 | u8 minor; | ||
62 | u8 major; | ||
63 | } __packed over; | ||
59 | u8 bios_ver[32]; | 64 | u8 bios_ver[32]; |
60 | u8 vbios_ver[16]; | 65 | u8 vbios_ver[16]; |
61 | u8 driver_ver[16]; | 66 | u8 driver_ver[16]; |
@@ -119,7 +124,8 @@ struct opregion_asle { | |||
119 | u64 fdss; | 124 | u64 fdss; |
120 | u32 fdsp; | 125 | u32 fdsp; |
121 | u32 stat; | 126 | u32 stat; |
122 | u64 rvda; /* Physical address of raw vbt data */ | 127 | u64 rvda; /* Physical (2.0) or relative from opregion (2.1+) |
128 | * address of raw VBT data. */ | ||
123 | u32 rvds; /* Size of raw vbt data */ | 129 | u32 rvds; /* Size of raw vbt data */ |
124 | u8 rsvd[58]; | 130 | u8 rsvd[58]; |
125 | } __packed; | 131 | } __packed; |
@@ -925,6 +931,11 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv) | |||
925 | opregion->header = base; | 931 | opregion->header = base; |
926 | opregion->lid_state = base + ACPI_CLID; | 932 | opregion->lid_state = base + ACPI_CLID; |
927 | 933 | ||
934 | DRM_DEBUG_DRIVER("ACPI OpRegion version %u.%u.%u\n", | ||
935 | opregion->header->over.major, | ||
936 | opregion->header->over.minor, | ||
937 | opregion->header->over.revision); | ||
938 | |||
928 | mboxes = opregion->header->mboxes; | 939 | mboxes = opregion->header->mboxes; |
929 | if (mboxes & MBOX_ACPI) { | 940 | if (mboxes & MBOX_ACPI) { |
930 | DRM_DEBUG_DRIVER("Public ACPI methods supported\n"); | 941 | DRM_DEBUG_DRIVER("Public ACPI methods supported\n"); |
@@ -953,11 +964,26 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv) | |||
953 | if (dmi_check_system(intel_no_opregion_vbt)) | 964 | if (dmi_check_system(intel_no_opregion_vbt)) |
954 | goto out; | 965 | goto out; |
955 | 966 | ||
956 | if (opregion->header->opregion_ver >= 2 && opregion->asle && | 967 | if (opregion->header->over.major >= 2 && opregion->asle && |
957 | opregion->asle->rvda && opregion->asle->rvds) { | 968 | opregion->asle->rvda && opregion->asle->rvds) { |
958 | opregion->rvda = memremap(opregion->asle->rvda, | 969 | resource_size_t rvda = opregion->asle->rvda; |
959 | opregion->asle->rvds, | 970 | |
971 | /* | ||
972 | * opregion 2.0: rvda is the physical VBT address. | ||
973 | * | ||
974 | * opregion 2.1+: rvda is unsigned, relative offset from | ||
975 | * opregion base, and should never point within opregion. | ||
976 | */ | ||
977 | if (opregion->header->over.major > 2 || | ||
978 | opregion->header->over.minor >= 1) { | ||
979 | WARN_ON(rvda < OPREGION_SIZE); | ||
980 | |||
981 | rvda += asls; | ||
982 | } | ||
983 | |||
984 | opregion->rvda = memremap(rvda, opregion->asle->rvds, | ||
960 | MEMREMAP_WB); | 985 | MEMREMAP_WB); |
986 | |||
961 | vbt = opregion->rvda; | 987 | vbt = opregion->rvda; |
962 | vbt_size = opregion->asle->rvds; | 988 | vbt_size = opregion->asle->rvds; |
963 | if (intel_bios_is_valid_vbt(vbt, vbt_size)) { | 989 | if (intel_bios_is_valid_vbt(vbt, vbt_size)) { |
@@ -967,6 +993,8 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv) | |||
967 | goto out; | 993 | goto out; |
968 | } else { | 994 | } else { |
969 | DRM_DEBUG_KMS("Invalid VBT in ACPI OpRegion (RVDA)\n"); | 995 | DRM_DEBUG_KMS("Invalid VBT in ACPI OpRegion (RVDA)\n"); |
996 | memunmap(opregion->rvda); | ||
997 | opregion->rvda = NULL; | ||
970 | } | 998 | } |
971 | } | 999 | } |
972 | 1000 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 72edaa7ff411..a1a7cc29fdd1 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -415,16 +415,17 @@ struct intel_engine_cs { | |||
415 | /** | 415 | /** |
416 | * @enable_count: Reference count for the enabled samplers. | 416 | * @enable_count: Reference count for the enabled samplers. |
417 | * | 417 | * |
418 | * Index number corresponds to the bit number from @enable. | 418 | * Index number corresponds to @enum drm_i915_pmu_engine_sample. |
419 | */ | 419 | */ |
420 | unsigned int enable_count[I915_PMU_SAMPLE_BITS]; | 420 | unsigned int enable_count[I915_ENGINE_SAMPLE_COUNT]; |
421 | /** | 421 | /** |
422 | * @sample: Counter values for sampling events. | 422 | * @sample: Counter values for sampling events. |
423 | * | 423 | * |
424 | * Our internal timer stores the current counters in this field. | 424 | * Our internal timer stores the current counters in this field. |
425 | * | ||
426 | * Index number corresponds to @enum drm_i915_pmu_engine_sample. | ||
425 | */ | 427 | */ |
426 | #define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_SEMA + 1) | 428 | struct i915_pmu_sample sample[I915_ENGINE_SAMPLE_COUNT]; |
427 | struct i915_pmu_sample sample[I915_ENGINE_SAMPLE_MAX]; | ||
428 | } pmu; | 429 | } pmu; |
429 | 430 | ||
430 | /* | 431 | /* |
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index 2c5bbe317353..e31e263cf86b 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c | |||
@@ -643,8 +643,10 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
643 | int bus_format; | 643 | int bus_format; |
644 | 644 | ||
645 | ret = of_property_read_u32(child, "reg", &i); | 645 | ret = of_property_read_u32(child, "reg", &i); |
646 | if (ret || i < 0 || i > 1) | 646 | if (ret || i < 0 || i > 1) { |
647 | return -EINVAL; | 647 | ret = -EINVAL; |
648 | goto free_child; | ||
649 | } | ||
648 | 650 | ||
649 | if (!of_device_is_available(child)) | 651 | if (!of_device_is_available(child)) |
650 | continue; | 652 | continue; |
@@ -657,7 +659,6 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
657 | channel = &imx_ldb->channel[i]; | 659 | channel = &imx_ldb->channel[i]; |
658 | channel->ldb = imx_ldb; | 660 | channel->ldb = imx_ldb; |
659 | channel->chno = i; | 661 | channel->chno = i; |
660 | channel->child = child; | ||
661 | 662 | ||
662 | /* | 663 | /* |
663 | * The output port is port@4 with an external 4-port mux or | 664 | * The output port is port@4 with an external 4-port mux or |
@@ -667,13 +668,13 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
667 | imx_ldb->lvds_mux ? 4 : 2, 0, | 668 | imx_ldb->lvds_mux ? 4 : 2, 0, |
668 | &channel->panel, &channel->bridge); | 669 | &channel->panel, &channel->bridge); |
669 | if (ret && ret != -ENODEV) | 670 | if (ret && ret != -ENODEV) |
670 | return ret; | 671 | goto free_child; |
671 | 672 | ||
672 | /* panel ddc only if there is no bridge */ | 673 | /* panel ddc only if there is no bridge */ |
673 | if (!channel->bridge) { | 674 | if (!channel->bridge) { |
674 | ret = imx_ldb_panel_ddc(dev, channel, child); | 675 | ret = imx_ldb_panel_ddc(dev, channel, child); |
675 | if (ret) | 676 | if (ret) |
676 | return ret; | 677 | goto free_child; |
677 | } | 678 | } |
678 | 679 | ||
679 | bus_format = of_get_bus_format(dev, child); | 680 | bus_format = of_get_bus_format(dev, child); |
@@ -689,18 +690,26 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
689 | if (bus_format < 0) { | 690 | if (bus_format < 0) { |
690 | dev_err(dev, "could not determine data mapping: %d\n", | 691 | dev_err(dev, "could not determine data mapping: %d\n", |
691 | bus_format); | 692 | bus_format); |
692 | return bus_format; | 693 | ret = bus_format; |
694 | goto free_child; | ||
693 | } | 695 | } |
694 | channel->bus_format = bus_format; | 696 | channel->bus_format = bus_format; |
697 | channel->child = child; | ||
695 | 698 | ||
696 | ret = imx_ldb_register(drm, channel); | 699 | ret = imx_ldb_register(drm, channel); |
697 | if (ret) | 700 | if (ret) { |
698 | return ret; | 701 | channel->child = NULL; |
702 | goto free_child; | ||
703 | } | ||
699 | } | 704 | } |
700 | 705 | ||
701 | dev_set_drvdata(dev, imx_ldb); | 706 | dev_set_drvdata(dev, imx_ldb); |
702 | 707 | ||
703 | return 0; | 708 | return 0; |
709 | |||
710 | free_child: | ||
711 | of_node_put(child); | ||
712 | return ret; | ||
704 | } | 713 | } |
705 | 714 | ||
706 | static void imx_ldb_unbind(struct device *dev, struct device *master, | 715 | static void imx_ldb_unbind(struct device *dev, struct device *master, |
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index c390924de93d..21e964f6ab5c 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c | |||
@@ -370,9 +370,9 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, | |||
370 | if (ret) | 370 | if (ret) |
371 | return ret; | 371 | return ret; |
372 | 372 | ||
373 | /* CRTC should be enabled */ | 373 | /* nothing to check when disabling or disabled */ |
374 | if (!crtc_state->enable) | 374 | if (!crtc_state->enable) |
375 | return -EINVAL; | 375 | return 0; |
376 | 376 | ||
377 | switch (plane->type) { | 377 | switch (plane->type) { |
378 | case DRM_PLANE_TYPE_PRIMARY: | 378 | case DRM_PLANE_TYPE_PRIMARY: |
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index 4463d3826ecb..e2942c9a11a7 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c | |||
@@ -440,13 +440,10 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity *entity) | |||
440 | 440 | ||
441 | while ((entity->dependency = | 441 | while ((entity->dependency = |
442 | sched->ops->dependency(sched_job, entity))) { | 442 | sched->ops->dependency(sched_job, entity))) { |
443 | trace_drm_sched_job_wait_dep(sched_job, entity->dependency); | ||
443 | 444 | ||
444 | if (drm_sched_entity_add_dependency_cb(entity)) { | 445 | if (drm_sched_entity_add_dependency_cb(entity)) |
445 | |||
446 | trace_drm_sched_job_wait_dep(sched_job, | ||
447 | entity->dependency); | ||
448 | return NULL; | 446 | return NULL; |
449 | } | ||
450 | } | 447 | } |
451 | 448 | ||
452 | /* skip jobs from entity that marked guilty */ | 449 | /* skip jobs from entity that marked guilty */ |
diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index 9d9e8146db90..d7b409a3c0f8 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c | |||
@@ -1,4 +1,5 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | |||
2 | #include "vkms_drv.h" | 3 | #include "vkms_drv.h" |
3 | #include <linux/crc32.h> | 4 | #include <linux/crc32.h> |
4 | #include <drm/drm_atomic.h> | 5 | #include <drm/drm_atomic.h> |
diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c index 177bbcb38306..eb56ee893761 100644 --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c | |||
@@ -1,10 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | 2 | ||
9 | #include "vkms_drv.h" | 3 | #include "vkms_drv.h" |
10 | #include <drm/drm_atomic_helper.h> | 4 | #include <drm/drm_atomic_helper.h> |
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 83087877565c..7dcbecb5fac2 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c | |||
@@ -1,9 +1,4 @@ | |||
1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License as published by | ||
4 | * the Free Software Foundation; either version 2 of the License, or | ||
5 | * (at your option) any later version. | ||
6 | */ | ||
7 | 2 | ||
8 | /** | 3 | /** |
9 | * DOC: vkms (Virtual Kernel Modesetting) | 4 | * DOC: vkms (Virtual Kernel Modesetting) |
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index e4469cd3d254..81f1cfbeb936 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h | |||
@@ -1,3 +1,5 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
2 | |||
1 | #ifndef _VKMS_DRV_H_ | 3 | #ifndef _VKMS_DRV_H_ |
2 | #define _VKMS_DRV_H_ | 4 | #define _VKMS_DRV_H_ |
3 | 5 | ||
diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c index 80311daed47a..138b0bb325cf 100644 --- a/drivers/gpu/drm/vkms/vkms_gem.c +++ b/drivers/gpu/drm/vkms/vkms_gem.c | |||
@@ -1,10 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | 2 | ||
9 | #include <linux/shmem_fs.h> | 3 | #include <linux/shmem_fs.h> |
10 | 4 | ||
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 271a0eb9042c..4173e4f48334 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c | |||
@@ -1,10 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | 2 | ||
9 | #include "vkms_drv.h" | 3 | #include "vkms_drv.h" |
10 | #include <drm/drm_crtc_helper.h> | 4 | #include <drm/drm_crtc_helper.h> |
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c index 418817600ad1..0e67d2d42f0c 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c | |||
@@ -1,10 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | 2 | ||
9 | #include "vkms_drv.h" | 3 | #include "vkms_drv.h" |
10 | #include <drm/drm_plane_helper.h> | 4 | #include <drm/drm_plane_helper.h> |
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c index 474b00e19697..0a7d4395d427 100644 --- a/drivers/gpu/ipu-v3/ipu-common.c +++ b/drivers/gpu/ipu-v3/ipu-common.c | |||
@@ -898,8 +898,8 @@ static struct ipu_devtype ipu_type_imx51 = { | |||
898 | .cpmem_ofs = 0x1f000000, | 898 | .cpmem_ofs = 0x1f000000, |
899 | .srm_ofs = 0x1f040000, | 899 | .srm_ofs = 0x1f040000, |
900 | .tpm_ofs = 0x1f060000, | 900 | .tpm_ofs = 0x1f060000, |
901 | .csi0_ofs = 0x1f030000, | 901 | .csi0_ofs = 0x1e030000, |
902 | .csi1_ofs = 0x1f038000, | 902 | .csi1_ofs = 0x1e038000, |
903 | .ic_ofs = 0x1e020000, | 903 | .ic_ofs = 0x1e020000, |
904 | .disp0_ofs = 0x1e040000, | 904 | .disp0_ofs = 0x1e040000, |
905 | .disp1_ofs = 0x1e048000, | 905 | .disp1_ofs = 0x1e048000, |
@@ -914,8 +914,8 @@ static struct ipu_devtype ipu_type_imx53 = { | |||
914 | .cpmem_ofs = 0x07000000, | 914 | .cpmem_ofs = 0x07000000, |
915 | .srm_ofs = 0x07040000, | 915 | .srm_ofs = 0x07040000, |
916 | .tpm_ofs = 0x07060000, | 916 | .tpm_ofs = 0x07060000, |
917 | .csi0_ofs = 0x07030000, | 917 | .csi0_ofs = 0x06030000, |
918 | .csi1_ofs = 0x07038000, | 918 | .csi1_ofs = 0x06038000, |
919 | .ic_ofs = 0x06020000, | 919 | .ic_ofs = 0x06020000, |
920 | .disp0_ofs = 0x06040000, | 920 | .disp0_ofs = 0x06040000, |
921 | .disp1_ofs = 0x06048000, | 921 | .disp1_ofs = 0x06048000, |
diff --git a/drivers/gpu/ipu-v3/ipu-pre.c b/drivers/gpu/ipu-v3/ipu-pre.c index 2f8db9d62551..4a28f3fbb0a2 100644 --- a/drivers/gpu/ipu-v3/ipu-pre.c +++ b/drivers/gpu/ipu-v3/ipu-pre.c | |||
@@ -106,6 +106,7 @@ struct ipu_pre { | |||
106 | void *buffer_virt; | 106 | void *buffer_virt; |
107 | bool in_use; | 107 | bool in_use; |
108 | unsigned int safe_window_end; | 108 | unsigned int safe_window_end; |
109 | unsigned int last_bufaddr; | ||
109 | }; | 110 | }; |
110 | 111 | ||
111 | static DEFINE_MUTEX(ipu_pre_list_mutex); | 112 | static DEFINE_MUTEX(ipu_pre_list_mutex); |
@@ -185,6 +186,7 @@ void ipu_pre_configure(struct ipu_pre *pre, unsigned int width, | |||
185 | 186 | ||
186 | writel(bufaddr, pre->regs + IPU_PRE_CUR_BUF); | 187 | writel(bufaddr, pre->regs + IPU_PRE_CUR_BUF); |
187 | writel(bufaddr, pre->regs + IPU_PRE_NEXT_BUF); | 188 | writel(bufaddr, pre->regs + IPU_PRE_NEXT_BUF); |
189 | pre->last_bufaddr = bufaddr; | ||
188 | 190 | ||
189 | val = IPU_PRE_PREF_ENG_CTRL_INPUT_PIXEL_FORMAT(0) | | 191 | val = IPU_PRE_PREF_ENG_CTRL_INPUT_PIXEL_FORMAT(0) | |
190 | IPU_PRE_PREF_ENG_CTRL_INPUT_ACTIVE_BPP(active_bpp) | | 192 | IPU_PRE_PREF_ENG_CTRL_INPUT_ACTIVE_BPP(active_bpp) | |
@@ -242,7 +244,11 @@ void ipu_pre_update(struct ipu_pre *pre, unsigned int bufaddr) | |||
242 | unsigned short current_yblock; | 244 | unsigned short current_yblock; |
243 | u32 val; | 245 | u32 val; |
244 | 246 | ||
247 | if (bufaddr == pre->last_bufaddr) | ||
248 | return; | ||
249 | |||
245 | writel(bufaddr, pre->regs + IPU_PRE_NEXT_BUF); | 250 | writel(bufaddr, pre->regs + IPU_PRE_NEXT_BUF); |
251 | pre->last_bufaddr = bufaddr; | ||
246 | 252 | ||
247 | do { | 253 | do { |
248 | if (time_after(jiffies, timeout)) { | 254 | if (time_after(jiffies, timeout)) { |
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 4adec4ab7d06..59ee01f3d022 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -3594,7 +3594,8 @@ nct6775_check_fan_inputs(struct nct6775_data *data) | |||
3594 | fan5pin |= cr1b & BIT(5); | 3594 | fan5pin |= cr1b & BIT(5); |
3595 | fan5pin |= creb & BIT(5); | 3595 | fan5pin |= creb & BIT(5); |
3596 | 3596 | ||
3597 | fan6pin = creb & BIT(3); | 3597 | fan6pin = !dsw_en && (cr2d & BIT(1)); |
3598 | fan6pin |= creb & BIT(3); | ||
3598 | 3599 | ||
3599 | pwm5pin |= cr2d & BIT(7); | 3600 | pwm5pin |= cr2d & BIT(7); |
3600 | pwm5pin |= (creb & BIT(4)) && !(cr2a & BIT(0)); | 3601 | pwm5pin |= (creb & BIT(4)) && !(cr2a & BIT(0)); |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b1086bfb0465..cd9c65f3d404 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -1500,8 +1500,7 @@ static int omap_i2c_remove(struct platform_device *pdev) | |||
1500 | return 0; | 1500 | return 0; |
1501 | } | 1501 | } |
1502 | 1502 | ||
1503 | #ifdef CONFIG_PM | 1503 | static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev) |
1504 | static int omap_i2c_runtime_suspend(struct device *dev) | ||
1505 | { | 1504 | { |
1506 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1505 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
1507 | 1506 | ||
@@ -1527,7 +1526,7 @@ static int omap_i2c_runtime_suspend(struct device *dev) | |||
1527 | return 0; | 1526 | return 0; |
1528 | } | 1527 | } |
1529 | 1528 | ||
1530 | static int omap_i2c_runtime_resume(struct device *dev) | 1529 | static int __maybe_unused omap_i2c_runtime_resume(struct device *dev) |
1531 | { | 1530 | { |
1532 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1531 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
1533 | 1532 | ||
@@ -1542,20 +1541,18 @@ static int omap_i2c_runtime_resume(struct device *dev) | |||
1542 | } | 1541 | } |
1543 | 1542 | ||
1544 | static const struct dev_pm_ops omap_i2c_pm_ops = { | 1543 | static const struct dev_pm_ops omap_i2c_pm_ops = { |
1544 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | ||
1545 | pm_runtime_force_resume) | ||
1545 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, | 1546 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, |
1546 | omap_i2c_runtime_resume, NULL) | 1547 | omap_i2c_runtime_resume, NULL) |
1547 | }; | 1548 | }; |
1548 | #define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) | ||
1549 | #else | ||
1550 | #define OMAP_I2C_PM_OPS NULL | ||
1551 | #endif /* CONFIG_PM */ | ||
1552 | 1549 | ||
1553 | static struct platform_driver omap_i2c_driver = { | 1550 | static struct platform_driver omap_i2c_driver = { |
1554 | .probe = omap_i2c_probe, | 1551 | .probe = omap_i2c_probe, |
1555 | .remove = omap_i2c_remove, | 1552 | .remove = omap_i2c_remove, |
1556 | .driver = { | 1553 | .driver = { |
1557 | .name = "omap_i2c", | 1554 | .name = "omap_i2c", |
1558 | .pm = OMAP_I2C_PM_OPS, | 1555 | .pm = &omap_i2c_pm_ops, |
1559 | .of_match_table = of_match_ptr(omap_i2c_of_match), | 1556 | .of_match_table = of_match_ptr(omap_i2c_of_match), |
1560 | }, | 1557 | }, |
1561 | }; | 1558 | }; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 1457f931218e..78188bf7e90d 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -363,7 +363,7 @@ static int dmar_map_gfx = 1; | |||
363 | static int dmar_forcedac; | 363 | static int dmar_forcedac; |
364 | static int intel_iommu_strict; | 364 | static int intel_iommu_strict; |
365 | static int intel_iommu_superpage = 1; | 365 | static int intel_iommu_superpage = 1; |
366 | static int intel_iommu_sm = 1; | 366 | static int intel_iommu_sm; |
367 | static int iommu_identity_mapping; | 367 | static int iommu_identity_mapping; |
368 | 368 | ||
369 | #define IDENTMAP_ALL 1 | 369 | #define IDENTMAP_ALL 1 |
@@ -456,9 +456,9 @@ static int __init intel_iommu_setup(char *str) | |||
456 | } else if (!strncmp(str, "sp_off", 6)) { | 456 | } else if (!strncmp(str, "sp_off", 6)) { |
457 | pr_info("Disable supported super page\n"); | 457 | pr_info("Disable supported super page\n"); |
458 | intel_iommu_superpage = 0; | 458 | intel_iommu_superpage = 0; |
459 | } else if (!strncmp(str, "sm_off", 6)) { | 459 | } else if (!strncmp(str, "sm_on", 5)) { |
460 | pr_info("Intel-IOMMU: disable scalable mode support\n"); | 460 | pr_info("Intel-IOMMU: scalable mode supported\n"); |
461 | intel_iommu_sm = 0; | 461 | intel_iommu_sm = 1; |
462 | } else if (!strncmp(str, "tboot_noforce", 13)) { | 462 | } else if (!strncmp(str, "tboot_noforce", 13)) { |
463 | printk(KERN_INFO | 463 | printk(KERN_INFO |
464 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); | 464 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 7f2a45445b00..c3aba3fc818d 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
@@ -97,9 +97,14 @@ struct its_device; | |||
97 | * The ITS structure - contains most of the infrastructure, with the | 97 | * The ITS structure - contains most of the infrastructure, with the |
98 | * top-level MSI domain, the command queue, the collections, and the | 98 | * top-level MSI domain, the command queue, the collections, and the |
99 | * list of devices writing to it. | 99 | * list of devices writing to it. |
100 | * | ||
101 | * dev_alloc_lock has to be taken for device allocations, while the | ||
102 | * spinlock must be taken to parse data structures such as the device | ||
103 | * list. | ||
100 | */ | 104 | */ |
101 | struct its_node { | 105 | struct its_node { |
102 | raw_spinlock_t lock; | 106 | raw_spinlock_t lock; |
107 | struct mutex dev_alloc_lock; | ||
103 | struct list_head entry; | 108 | struct list_head entry; |
104 | void __iomem *base; | 109 | void __iomem *base; |
105 | phys_addr_t phys_base; | 110 | phys_addr_t phys_base; |
@@ -156,6 +161,7 @@ struct its_device { | |||
156 | void *itt; | 161 | void *itt; |
157 | u32 nr_ites; | 162 | u32 nr_ites; |
158 | u32 device_id; | 163 | u32 device_id; |
164 | bool shared; | ||
159 | }; | 165 | }; |
160 | 166 | ||
161 | static struct { | 167 | static struct { |
@@ -1580,6 +1586,9 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) | |||
1580 | nr_irqs /= 2; | 1586 | nr_irqs /= 2; |
1581 | } while (nr_irqs > 0); | 1587 | } while (nr_irqs > 0); |
1582 | 1588 | ||
1589 | if (!nr_irqs) | ||
1590 | err = -ENOSPC; | ||
1591 | |||
1583 | if (err) | 1592 | if (err) |
1584 | goto out; | 1593 | goto out; |
1585 | 1594 | ||
@@ -2059,6 +2068,29 @@ static int __init allocate_lpi_tables(void) | |||
2059 | return 0; | 2068 | return 0; |
2060 | } | 2069 | } |
2061 | 2070 | ||
2071 | static u64 its_clear_vpend_valid(void __iomem *vlpi_base) | ||
2072 | { | ||
2073 | u32 count = 1000000; /* 1s! */ | ||
2074 | bool clean; | ||
2075 | u64 val; | ||
2076 | |||
2077 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
2078 | val &= ~GICR_VPENDBASER_Valid; | ||
2079 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
2080 | |||
2081 | do { | ||
2082 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
2083 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
2084 | if (!clean) { | ||
2085 | count--; | ||
2086 | cpu_relax(); | ||
2087 | udelay(1); | ||
2088 | } | ||
2089 | } while (!clean && count); | ||
2090 | |||
2091 | return val; | ||
2092 | } | ||
2093 | |||
2062 | static void its_cpu_init_lpis(void) | 2094 | static void its_cpu_init_lpis(void) |
2063 | { | 2095 | { |
2064 | void __iomem *rbase = gic_data_rdist_rd_base(); | 2096 | void __iomem *rbase = gic_data_rdist_rd_base(); |
@@ -2144,6 +2176,30 @@ static void its_cpu_init_lpis(void) | |||
2144 | val |= GICR_CTLR_ENABLE_LPIS; | 2176 | val |= GICR_CTLR_ENABLE_LPIS; |
2145 | writel_relaxed(val, rbase + GICR_CTLR); | 2177 | writel_relaxed(val, rbase + GICR_CTLR); |
2146 | 2178 | ||
2179 | if (gic_rdists->has_vlpis) { | ||
2180 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | ||
2181 | |||
2182 | /* | ||
2183 | * It's possible for CPU to receive VLPIs before it is | ||
2184 | * sheduled as a vPE, especially for the first CPU, and the | ||
2185 | * VLPI with INTID larger than 2^(IDbits+1) will be considered | ||
2186 | * as out of range and dropped by GIC. | ||
2187 | * So we initialize IDbits to known value to avoid VLPI drop. | ||
2188 | */ | ||
2189 | val = (LPI_NRBITS - 1) & GICR_VPROPBASER_IDBITS_MASK; | ||
2190 | pr_debug("GICv4: CPU%d: Init IDbits to 0x%llx for GICR_VPROPBASER\n", | ||
2191 | smp_processor_id(), val); | ||
2192 | gits_write_vpropbaser(val, vlpi_base + GICR_VPROPBASER); | ||
2193 | |||
2194 | /* | ||
2195 | * Also clear Valid bit of GICR_VPENDBASER, in case some | ||
2196 | * ancient programming gets left in and has possibility of | ||
2197 | * corrupting memory. | ||
2198 | */ | ||
2199 | val = its_clear_vpend_valid(vlpi_base); | ||
2200 | WARN_ON(val & GICR_VPENDBASER_Dirty); | ||
2201 | } | ||
2202 | |||
2147 | /* Make sure the GIC has seen the above */ | 2203 | /* Make sure the GIC has seen the above */ |
2148 | dsb(sy); | 2204 | dsb(sy); |
2149 | out: | 2205 | out: |
@@ -2422,6 +2478,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
2422 | struct its_device *its_dev; | 2478 | struct its_device *its_dev; |
2423 | struct msi_domain_info *msi_info; | 2479 | struct msi_domain_info *msi_info; |
2424 | u32 dev_id; | 2480 | u32 dev_id; |
2481 | int err = 0; | ||
2425 | 2482 | ||
2426 | /* | 2483 | /* |
2427 | * We ignore "dev" entierely, and rely on the dev_id that has | 2484 | * We ignore "dev" entierely, and rely on the dev_id that has |
@@ -2444,6 +2501,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
2444 | return -EINVAL; | 2501 | return -EINVAL; |
2445 | } | 2502 | } |
2446 | 2503 | ||
2504 | mutex_lock(&its->dev_alloc_lock); | ||
2447 | its_dev = its_find_device(its, dev_id); | 2505 | its_dev = its_find_device(its, dev_id); |
2448 | if (its_dev) { | 2506 | if (its_dev) { |
2449 | /* | 2507 | /* |
@@ -2451,18 +2509,22 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
2451 | * another alias (PCI bridge of some sort). No need to | 2509 | * another alias (PCI bridge of some sort). No need to |
2452 | * create the device. | 2510 | * create the device. |
2453 | */ | 2511 | */ |
2512 | its_dev->shared = true; | ||
2454 | pr_debug("Reusing ITT for devID %x\n", dev_id); | 2513 | pr_debug("Reusing ITT for devID %x\n", dev_id); |
2455 | goto out; | 2514 | goto out; |
2456 | } | 2515 | } |
2457 | 2516 | ||
2458 | its_dev = its_create_device(its, dev_id, nvec, true); | 2517 | its_dev = its_create_device(its, dev_id, nvec, true); |
2459 | if (!its_dev) | 2518 | if (!its_dev) { |
2460 | return -ENOMEM; | 2519 | err = -ENOMEM; |
2520 | goto out; | ||
2521 | } | ||
2461 | 2522 | ||
2462 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); | 2523 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); |
2463 | out: | 2524 | out: |
2525 | mutex_unlock(&its->dev_alloc_lock); | ||
2464 | info->scratchpad[0].ptr = its_dev; | 2526 | info->scratchpad[0].ptr = its_dev; |
2465 | return 0; | 2527 | return err; |
2466 | } | 2528 | } |
2467 | 2529 | ||
2468 | static struct msi_domain_ops its_msi_domain_ops = { | 2530 | static struct msi_domain_ops its_msi_domain_ops = { |
@@ -2566,6 +2628,7 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
2566 | { | 2628 | { |
2567 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); | 2629 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); |
2568 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); | 2630 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); |
2631 | struct its_node *its = its_dev->its; | ||
2569 | int i; | 2632 | int i; |
2570 | 2633 | ||
2571 | for (i = 0; i < nr_irqs; i++) { | 2634 | for (i = 0; i < nr_irqs; i++) { |
@@ -2580,8 +2643,14 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
2580 | irq_domain_reset_irq_data(data); | 2643 | irq_domain_reset_irq_data(data); |
2581 | } | 2644 | } |
2582 | 2645 | ||
2583 | /* If all interrupts have been freed, start mopping the floor */ | 2646 | mutex_lock(&its->dev_alloc_lock); |
2584 | if (bitmap_empty(its_dev->event_map.lpi_map, | 2647 | |
2648 | /* | ||
2649 | * If all interrupts have been freed, start mopping the | ||
2650 | * floor. This is conditionned on the device not being shared. | ||
2651 | */ | ||
2652 | if (!its_dev->shared && | ||
2653 | bitmap_empty(its_dev->event_map.lpi_map, | ||
2585 | its_dev->event_map.nr_lpis)) { | 2654 | its_dev->event_map.nr_lpis)) { |
2586 | its_lpi_free(its_dev->event_map.lpi_map, | 2655 | its_lpi_free(its_dev->event_map.lpi_map, |
2587 | its_dev->event_map.lpi_base, | 2656 | its_dev->event_map.lpi_base, |
@@ -2593,6 +2662,8 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
2593 | its_free_device(its_dev); | 2662 | its_free_device(its_dev); |
2594 | } | 2663 | } |
2595 | 2664 | ||
2665 | mutex_unlock(&its->dev_alloc_lock); | ||
2666 | |||
2596 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); | 2667 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); |
2597 | } | 2668 | } |
2598 | 2669 | ||
@@ -2755,26 +2826,11 @@ static void its_vpe_schedule(struct its_vpe *vpe) | |||
2755 | static void its_vpe_deschedule(struct its_vpe *vpe) | 2826 | static void its_vpe_deschedule(struct its_vpe *vpe) |
2756 | { | 2827 | { |
2757 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | 2828 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); |
2758 | u32 count = 1000000; /* 1s! */ | ||
2759 | bool clean; | ||
2760 | u64 val; | 2829 | u64 val; |
2761 | 2830 | ||
2762 | /* We're being scheduled out */ | 2831 | val = its_clear_vpend_valid(vlpi_base); |
2763 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
2764 | val &= ~GICR_VPENDBASER_Valid; | ||
2765 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
2766 | |||
2767 | do { | ||
2768 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
2769 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
2770 | if (!clean) { | ||
2771 | count--; | ||
2772 | cpu_relax(); | ||
2773 | udelay(1); | ||
2774 | } | ||
2775 | } while (!clean && count); | ||
2776 | 2832 | ||
2777 | if (unlikely(!clean && !count)) { | 2833 | if (unlikely(val & GICR_VPENDBASER_Dirty)) { |
2778 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); | 2834 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); |
2779 | vpe->idai = false; | 2835 | vpe->idai = false; |
2780 | vpe->pending_last = true; | 2836 | vpe->pending_last = true; |
@@ -3517,6 +3573,7 @@ static int __init its_probe_one(struct resource *res, | |||
3517 | } | 3573 | } |
3518 | 3574 | ||
3519 | raw_spin_lock_init(&its->lock); | 3575 | raw_spin_lock_init(&its->lock); |
3576 | mutex_init(&its->dev_alloc_lock); | ||
3520 | INIT_LIST_HEAD(&its->entry); | 3577 | INIT_LIST_HEAD(&its->entry); |
3521 | INIT_LIST_HEAD(&its->its_device_list); | 3578 | INIT_LIST_HEAD(&its->its_device_list); |
3522 | typer = gic_read_typer(its_base + GITS_TYPER); | 3579 | typer = gic_read_typer(its_base + GITS_TYPER); |
diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c index 25f32e1d7764..3496b61a312a 100644 --- a/drivers/irqchip/irq-mmp.c +++ b/drivers/irqchip/irq-mmp.c | |||
@@ -34,6 +34,9 @@ | |||
34 | #define SEL_INT_PENDING (1 << 6) | 34 | #define SEL_INT_PENDING (1 << 6) |
35 | #define SEL_INT_NUM_MASK 0x3f | 35 | #define SEL_INT_NUM_MASK 0x3f |
36 | 36 | ||
37 | #define MMP2_ICU_INT_ROUTE_PJ4_IRQ (1 << 5) | ||
38 | #define MMP2_ICU_INT_ROUTE_PJ4_FIQ (1 << 6) | ||
39 | |||
37 | struct icu_chip_data { | 40 | struct icu_chip_data { |
38 | int nr_irqs; | 41 | int nr_irqs; |
39 | unsigned int virq_base; | 42 | unsigned int virq_base; |
@@ -190,7 +193,8 @@ static const struct mmp_intc_conf mmp_conf = { | |||
190 | static const struct mmp_intc_conf mmp2_conf = { | 193 | static const struct mmp_intc_conf mmp2_conf = { |
191 | .conf_enable = 0x20, | 194 | .conf_enable = 0x20, |
192 | .conf_disable = 0x0, | 195 | .conf_disable = 0x0, |
193 | .conf_mask = 0x7f, | 196 | .conf_mask = MMP2_ICU_INT_ROUTE_PJ4_IRQ | |
197 | MMP2_ICU_INT_ROUTE_PJ4_FIQ, | ||
194 | }; | 198 | }; |
195 | 199 | ||
196 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) | 200 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 47d4e0d30bf0..dd538e6b2748 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -932,7 +932,7 @@ static int dm_crypt_integrity_io_alloc(struct dm_crypt_io *io, struct bio *bio) | |||
932 | if (IS_ERR(bip)) | 932 | if (IS_ERR(bip)) |
933 | return PTR_ERR(bip); | 933 | return PTR_ERR(bip); |
934 | 934 | ||
935 | tag_len = io->cc->on_disk_tag_size * bio_sectors(bio); | 935 | tag_len = io->cc->on_disk_tag_size * (bio_sectors(bio) >> io->cc->sector_shift); |
936 | 936 | ||
937 | bip->bip_iter.bi_size = tag_len; | 937 | bip->bip_iter.bi_size = tag_len; |
938 | bip->bip_iter.bi_sector = io->cc->start + io->sector; | 938 | bip->bip_iter.bi_sector = io->cc->start + io->sector; |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index ca8af21bf644..e83b63608262 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -257,6 +257,7 @@ struct pool { | |||
257 | 257 | ||
258 | spinlock_t lock; | 258 | spinlock_t lock; |
259 | struct bio_list deferred_flush_bios; | 259 | struct bio_list deferred_flush_bios; |
260 | struct bio_list deferred_flush_completions; | ||
260 | struct list_head prepared_mappings; | 261 | struct list_head prepared_mappings; |
261 | struct list_head prepared_discards; | 262 | struct list_head prepared_discards; |
262 | struct list_head prepared_discards_pt2; | 263 | struct list_head prepared_discards_pt2; |
@@ -956,6 +957,39 @@ static void process_prepared_mapping_fail(struct dm_thin_new_mapping *m) | |||
956 | mempool_free(m, &m->tc->pool->mapping_pool); | 957 | mempool_free(m, &m->tc->pool->mapping_pool); |
957 | } | 958 | } |
958 | 959 | ||
960 | static void complete_overwrite_bio(struct thin_c *tc, struct bio *bio) | ||
961 | { | ||
962 | struct pool *pool = tc->pool; | ||
963 | unsigned long flags; | ||
964 | |||
965 | /* | ||
966 | * If the bio has the REQ_FUA flag set we must commit the metadata | ||
967 | * before signaling its completion. | ||
968 | */ | ||
969 | if (!bio_triggers_commit(tc, bio)) { | ||
970 | bio_endio(bio); | ||
971 | return; | ||
972 | } | ||
973 | |||
974 | /* | ||
975 | * Complete bio with an error if earlier I/O caused changes to the | ||
976 | * metadata that can't be committed, e.g, due to I/O errors on the | ||
977 | * metadata device. | ||
978 | */ | ||
979 | if (dm_thin_aborted_changes(tc->td)) { | ||
980 | bio_io_error(bio); | ||
981 | return; | ||
982 | } | ||
983 | |||
984 | /* | ||
985 | * Batch together any bios that trigger commits and then issue a | ||
986 | * single commit for them in process_deferred_bios(). | ||
987 | */ | ||
988 | spin_lock_irqsave(&pool->lock, flags); | ||
989 | bio_list_add(&pool->deferred_flush_completions, bio); | ||
990 | spin_unlock_irqrestore(&pool->lock, flags); | ||
991 | } | ||
992 | |||
959 | static void process_prepared_mapping(struct dm_thin_new_mapping *m) | 993 | static void process_prepared_mapping(struct dm_thin_new_mapping *m) |
960 | { | 994 | { |
961 | struct thin_c *tc = m->tc; | 995 | struct thin_c *tc = m->tc; |
@@ -988,7 +1022,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m) | |||
988 | */ | 1022 | */ |
989 | if (bio) { | 1023 | if (bio) { |
990 | inc_remap_and_issue_cell(tc, m->cell, m->data_block); | 1024 | inc_remap_and_issue_cell(tc, m->cell, m->data_block); |
991 | bio_endio(bio); | 1025 | complete_overwrite_bio(tc, bio); |
992 | } else { | 1026 | } else { |
993 | inc_all_io_entry(tc->pool, m->cell->holder); | 1027 | inc_all_io_entry(tc->pool, m->cell->holder); |
994 | remap_and_issue(tc, m->cell->holder, m->data_block); | 1028 | remap_and_issue(tc, m->cell->holder, m->data_block); |
@@ -2317,7 +2351,7 @@ static void process_deferred_bios(struct pool *pool) | |||
2317 | { | 2351 | { |
2318 | unsigned long flags; | 2352 | unsigned long flags; |
2319 | struct bio *bio; | 2353 | struct bio *bio; |
2320 | struct bio_list bios; | 2354 | struct bio_list bios, bio_completions; |
2321 | struct thin_c *tc; | 2355 | struct thin_c *tc; |
2322 | 2356 | ||
2323 | tc = get_first_thin(pool); | 2357 | tc = get_first_thin(pool); |
@@ -2328,26 +2362,36 @@ static void process_deferred_bios(struct pool *pool) | |||
2328 | } | 2362 | } |
2329 | 2363 | ||
2330 | /* | 2364 | /* |
2331 | * If there are any deferred flush bios, we must commit | 2365 | * If there are any deferred flush bios, we must commit the metadata |
2332 | * the metadata before issuing them. | 2366 | * before issuing them or signaling their completion. |
2333 | */ | 2367 | */ |
2334 | bio_list_init(&bios); | 2368 | bio_list_init(&bios); |
2369 | bio_list_init(&bio_completions); | ||
2370 | |||
2335 | spin_lock_irqsave(&pool->lock, flags); | 2371 | spin_lock_irqsave(&pool->lock, flags); |
2336 | bio_list_merge(&bios, &pool->deferred_flush_bios); | 2372 | bio_list_merge(&bios, &pool->deferred_flush_bios); |
2337 | bio_list_init(&pool->deferred_flush_bios); | 2373 | bio_list_init(&pool->deferred_flush_bios); |
2374 | |||
2375 | bio_list_merge(&bio_completions, &pool->deferred_flush_completions); | ||
2376 | bio_list_init(&pool->deferred_flush_completions); | ||
2338 | spin_unlock_irqrestore(&pool->lock, flags); | 2377 | spin_unlock_irqrestore(&pool->lock, flags); |
2339 | 2378 | ||
2340 | if (bio_list_empty(&bios) && | 2379 | if (bio_list_empty(&bios) && bio_list_empty(&bio_completions) && |
2341 | !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool))) | 2380 | !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool))) |
2342 | return; | 2381 | return; |
2343 | 2382 | ||
2344 | if (commit(pool)) { | 2383 | if (commit(pool)) { |
2384 | bio_list_merge(&bios, &bio_completions); | ||
2385 | |||
2345 | while ((bio = bio_list_pop(&bios))) | 2386 | while ((bio = bio_list_pop(&bios))) |
2346 | bio_io_error(bio); | 2387 | bio_io_error(bio); |
2347 | return; | 2388 | return; |
2348 | } | 2389 | } |
2349 | pool->last_commit_jiffies = jiffies; | 2390 | pool->last_commit_jiffies = jiffies; |
2350 | 2391 | ||
2392 | while ((bio = bio_list_pop(&bio_completions))) | ||
2393 | bio_endio(bio); | ||
2394 | |||
2351 | while ((bio = bio_list_pop(&bios))) | 2395 | while ((bio = bio_list_pop(&bios))) |
2352 | generic_make_request(bio); | 2396 | generic_make_request(bio); |
2353 | } | 2397 | } |
@@ -2954,6 +2998,7 @@ static struct pool *pool_create(struct mapped_device *pool_md, | |||
2954 | INIT_DELAYED_WORK(&pool->no_space_timeout, do_no_space_timeout); | 2998 | INIT_DELAYED_WORK(&pool->no_space_timeout, do_no_space_timeout); |
2955 | spin_lock_init(&pool->lock); | 2999 | spin_lock_init(&pool->lock); |
2956 | bio_list_init(&pool->deferred_flush_bios); | 3000 | bio_list_init(&pool->deferred_flush_bios); |
3001 | bio_list_init(&pool->deferred_flush_completions); | ||
2957 | INIT_LIST_HEAD(&pool->prepared_mappings); | 3002 | INIT_LIST_HEAD(&pool->prepared_mappings); |
2958 | INIT_LIST_HEAD(&pool->prepared_discards); | 3003 | INIT_LIST_HEAD(&pool->prepared_discards); |
2959 | INIT_LIST_HEAD(&pool->prepared_discards_pt2); | 3004 | INIT_LIST_HEAD(&pool->prepared_discards_pt2); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 1d54109071cc..fa47249fa3e4 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1863,6 +1863,20 @@ static void end_sync_read(struct bio *bio) | |||
1863 | reschedule_retry(r1_bio); | 1863 | reschedule_retry(r1_bio); |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | static void abort_sync_write(struct mddev *mddev, struct r1bio *r1_bio) | ||
1867 | { | ||
1868 | sector_t sync_blocks = 0; | ||
1869 | sector_t s = r1_bio->sector; | ||
1870 | long sectors_to_go = r1_bio->sectors; | ||
1871 | |||
1872 | /* make sure these bits don't get cleared. */ | ||
1873 | do { | ||
1874 | md_bitmap_end_sync(mddev->bitmap, s, &sync_blocks, 1); | ||
1875 | s += sync_blocks; | ||
1876 | sectors_to_go -= sync_blocks; | ||
1877 | } while (sectors_to_go > 0); | ||
1878 | } | ||
1879 | |||
1866 | static void end_sync_write(struct bio *bio) | 1880 | static void end_sync_write(struct bio *bio) |
1867 | { | 1881 | { |
1868 | int uptodate = !bio->bi_status; | 1882 | int uptodate = !bio->bi_status; |
@@ -1874,15 +1888,7 @@ static void end_sync_write(struct bio *bio) | |||
1874 | struct md_rdev *rdev = conf->mirrors[find_bio_disk(r1_bio, bio)].rdev; | 1888 | struct md_rdev *rdev = conf->mirrors[find_bio_disk(r1_bio, bio)].rdev; |
1875 | 1889 | ||
1876 | if (!uptodate) { | 1890 | if (!uptodate) { |
1877 | sector_t sync_blocks = 0; | 1891 | abort_sync_write(mddev, r1_bio); |
1878 | sector_t s = r1_bio->sector; | ||
1879 | long sectors_to_go = r1_bio->sectors; | ||
1880 | /* make sure these bits doesn't get cleared. */ | ||
1881 | do { | ||
1882 | md_bitmap_end_sync(mddev->bitmap, s, &sync_blocks, 1); | ||
1883 | s += sync_blocks; | ||
1884 | sectors_to_go -= sync_blocks; | ||
1885 | } while (sectors_to_go > 0); | ||
1886 | set_bit(WriteErrorSeen, &rdev->flags); | 1892 | set_bit(WriteErrorSeen, &rdev->flags); |
1887 | if (!test_and_set_bit(WantReplacement, &rdev->flags)) | 1893 | if (!test_and_set_bit(WantReplacement, &rdev->flags)) |
1888 | set_bit(MD_RECOVERY_NEEDED, & | 1894 | set_bit(MD_RECOVERY_NEEDED, & |
@@ -2172,8 +2178,10 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) | |||
2172 | (i == r1_bio->read_disk || | 2178 | (i == r1_bio->read_disk || |
2173 | !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)))) | 2179 | !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)))) |
2174 | continue; | 2180 | continue; |
2175 | if (test_bit(Faulty, &conf->mirrors[i].rdev->flags)) | 2181 | if (test_bit(Faulty, &conf->mirrors[i].rdev->flags)) { |
2182 | abort_sync_write(mddev, r1_bio); | ||
2176 | continue; | 2183 | continue; |
2184 | } | ||
2177 | 2185 | ||
2178 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); | 2186 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); |
2179 | if (test_bit(FailFast, &conf->mirrors[i].rdev->flags)) | 2187 | if (test_bit(FailFast, &conf->mirrors[i].rdev->flags)) |
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index aef1185f383d..14f3fdb8c6bb 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c | |||
@@ -2112,7 +2112,7 @@ static void mmc_blk_mq_req_done(struct mmc_request *mrq) | |||
2112 | if (waiting) | 2112 | if (waiting) |
2113 | wake_up(&mq->wait); | 2113 | wake_up(&mq->wait); |
2114 | else | 2114 | else |
2115 | kblockd_schedule_work(&mq->complete_work); | 2115 | queue_work(mq->card->complete_wq, &mq->complete_work); |
2116 | 2116 | ||
2117 | return; | 2117 | return; |
2118 | } | 2118 | } |
@@ -2924,6 +2924,13 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
2924 | 2924 | ||
2925 | mmc_fixup_device(card, mmc_blk_fixups); | 2925 | mmc_fixup_device(card, mmc_blk_fixups); |
2926 | 2926 | ||
2927 | card->complete_wq = alloc_workqueue("mmc_complete", | ||
2928 | WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); | ||
2929 | if (unlikely(!card->complete_wq)) { | ||
2930 | pr_err("Failed to create mmc completion workqueue"); | ||
2931 | return -ENOMEM; | ||
2932 | } | ||
2933 | |||
2927 | md = mmc_blk_alloc(card); | 2934 | md = mmc_blk_alloc(card); |
2928 | if (IS_ERR(md)) | 2935 | if (IS_ERR(md)) |
2929 | return PTR_ERR(md); | 2936 | return PTR_ERR(md); |
@@ -2987,6 +2994,7 @@ static void mmc_blk_remove(struct mmc_card *card) | |||
2987 | pm_runtime_put_noidle(&card->dev); | 2994 | pm_runtime_put_noidle(&card->dev); |
2988 | mmc_blk_remove_req(md); | 2995 | mmc_blk_remove_req(md); |
2989 | dev_set_drvdata(&card->dev, NULL); | 2996 | dev_set_drvdata(&card->dev, NULL); |
2997 | destroy_workqueue(card->complete_wq); | ||
2990 | } | 2998 | } |
2991 | 2999 | ||
2992 | static int _mmc_blk_suspend(struct mmc_card *card) | 3000 | static int _mmc_blk_suspend(struct mmc_card *card) |
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index f19ec60bcbdc..2eba507790e4 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c | |||
@@ -1338,7 +1338,8 @@ static int meson_mmc_probe(struct platform_device *pdev) | |||
1338 | host->regs + SD_EMMC_IRQ_EN); | 1338 | host->regs + SD_EMMC_IRQ_EN); |
1339 | 1339 | ||
1340 | ret = request_threaded_irq(host->irq, meson_mmc_irq, | 1340 | ret = request_threaded_irq(host->irq, meson_mmc_irq, |
1341 | meson_mmc_irq_thread, IRQF_SHARED, NULL, host); | 1341 | meson_mmc_irq_thread, IRQF_SHARED, |
1342 | dev_name(&pdev->dev), host); | ||
1342 | if (ret) | 1343 | if (ret) |
1343 | goto err_init_clk; | 1344 | goto err_init_clk; |
1344 | 1345 | ||
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index 279e326e397e..70fadc976795 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c | |||
@@ -1399,13 +1399,37 @@ static int sunxi_mmc_probe(struct platform_device *pdev) | |||
1399 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | 1399 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
1400 | MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ; | 1400 | MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ; |
1401 | 1401 | ||
1402 | if (host->cfg->clk_delays || host->use_new_timings) | 1402 | /* |
1403 | * Some H5 devices do not have signal traces precise enough to | ||
1404 | * use HS DDR mode for their eMMC chips. | ||
1405 | * | ||
1406 | * We still enable HS DDR modes for all the other controller | ||
1407 | * variants that support them. | ||
1408 | */ | ||
1409 | if ((host->cfg->clk_delays || host->use_new_timings) && | ||
1410 | !of_device_is_compatible(pdev->dev.of_node, | ||
1411 | "allwinner,sun50i-h5-emmc")) | ||
1403 | mmc->caps |= MMC_CAP_1_8V_DDR | MMC_CAP_3_3V_DDR; | 1412 | mmc->caps |= MMC_CAP_1_8V_DDR | MMC_CAP_3_3V_DDR; |
1404 | 1413 | ||
1405 | ret = mmc_of_parse(mmc); | 1414 | ret = mmc_of_parse(mmc); |
1406 | if (ret) | 1415 | if (ret) |
1407 | goto error_free_dma; | 1416 | goto error_free_dma; |
1408 | 1417 | ||
1418 | /* | ||
1419 | * If we don't support delay chains in the SoC, we can't use any | ||
1420 | * of the higher speed modes. Mask them out in case the device | ||
1421 | * tree specifies the properties for them, which gets added to | ||
1422 | * the caps by mmc_of_parse() above. | ||
1423 | */ | ||
1424 | if (!(host->cfg->clk_delays || host->use_new_timings)) { | ||
1425 | mmc->caps &= ~(MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR | | ||
1426 | MMC_CAP_1_2V_DDR | MMC_CAP_UHS); | ||
1427 | mmc->caps2 &= ~MMC_CAP2_HS200; | ||
1428 | } | ||
1429 | |||
1430 | /* TODO: This driver doesn't support HS400 mode yet */ | ||
1431 | mmc->caps2 &= ~MMC_CAP2_HS400; | ||
1432 | |||
1409 | ret = sunxi_mmc_init_host(host); | 1433 | ret = sunxi_mmc_init_host(host); |
1410 | if (ret) | 1434 | if (ret) |
1411 | goto error_free_dma; | 1435 | goto error_free_dma; |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 60104e1079c5..37f174ccbcec 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -480,6 +480,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent, | |||
480 | /* let's register it anyway to preserve ordering */ | 480 | /* let's register it anyway to preserve ordering */ |
481 | slave->offset = 0; | 481 | slave->offset = 0; |
482 | slave->mtd.size = 0; | 482 | slave->mtd.size = 0; |
483 | |||
484 | /* Initialize ->erasesize to make add_mtd_device() happy. */ | ||
485 | slave->mtd.erasesize = parent->erasesize; | ||
486 | |||
483 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", | 487 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", |
484 | part->name); | 488 | part->name); |
485 | goto out_register; | 489 | goto out_register; |
@@ -632,7 +636,6 @@ err_remove_part: | |||
632 | mutex_unlock(&mtd_partitions_mutex); | 636 | mutex_unlock(&mtd_partitions_mutex); |
633 | 637 | ||
634 | free_partition(new); | 638 | free_partition(new); |
635 | pr_info("%s:%i\n", __func__, __LINE__); | ||
636 | 639 | ||
637 | return ret; | 640 | return ret; |
638 | } | 641 | } |
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c index bd4cfac6b5aa..a4768df5083f 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c | |||
@@ -155,9 +155,10 @@ int gpmi_init(struct gpmi_nand_data *this) | |||
155 | 155 | ||
156 | /* | 156 | /* |
157 | * Reset BCH here, too. We got failures otherwise :( | 157 | * Reset BCH here, too. We got failures otherwise :( |
158 | * See later BCH reset for explanation of MX23 handling | 158 | * See later BCH reset for explanation of MX23 and MX28 handling |
159 | */ | 159 | */ |
160 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 160 | ret = gpmi_reset_block(r->bch_regs, |
161 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
161 | if (ret) | 162 | if (ret) |
162 | goto err_out; | 163 | goto err_out; |
163 | 164 | ||
@@ -263,12 +264,10 @@ int bch_set_geometry(struct gpmi_nand_data *this) | |||
263 | /* | 264 | /* |
264 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this | 265 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this |
265 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. | 266 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. |
266 | * On the other hand, the MX28 needs the reset, because one case has been | 267 | * and MX28. |
267 | * seen where the BCH produced ECC errors constantly after 10000 | ||
268 | * consecutive reboots. The latter case has not been seen on the MX23 | ||
269 | * yet, still we don't know if it could happen there as well. | ||
270 | */ | 268 | */ |
271 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 269 | ret = gpmi_reset_block(r->bch_regs, |
270 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
272 | if (ret) | 271 | if (ret) |
273 | goto err_out; | 272 | goto err_out; |
274 | 273 | ||
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index cca4b24d2ffa..839494ac457c 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c | |||
@@ -410,6 +410,7 @@ static int nand_check_wp(struct nand_chip *chip) | |||
410 | 410 | ||
411 | /** | 411 | /** |
412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob | 412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob |
413 | * @chip: NAND chip object | ||
413 | * @oob: oob data buffer | 414 | * @oob: oob data buffer |
414 | * @len: oob data write length | 415 | * @len: oob data write length |
415 | * @ops: oob ops structure | 416 | * @ops: oob ops structure |
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c index 1b722fe9213c..19a2b563acdf 100644 --- a/drivers/mtd/nand/raw/nand_bbt.c +++ b/drivers/mtd/nand/raw/nand_bbt.c | |||
@@ -158,7 +158,7 @@ static u32 add_marker_len(struct nand_bbt_descr *td) | |||
158 | 158 | ||
159 | /** | 159 | /** |
160 | * read_bbt - [GENERIC] Read the bad block table starting from page | 160 | * read_bbt - [GENERIC] Read the bad block table starting from page |
161 | * @chip: NAND chip object | 161 | * @this: NAND chip object |
162 | * @buf: temporary buffer | 162 | * @buf: temporary buffer |
163 | * @page: the starting page | 163 | * @page: the starting page |
164 | * @num: the number of bbt descriptors to read | 164 | * @num: the number of bbt descriptors to read |
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 479c2f2cf17f..fa87ae28cdfe 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c | |||
@@ -304,24 +304,30 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
304 | struct nand_device *nand = spinand_to_nand(spinand); | 304 | struct nand_device *nand = spinand_to_nand(spinand); |
305 | struct mtd_info *mtd = nanddev_to_mtd(nand); | 305 | struct mtd_info *mtd = nanddev_to_mtd(nand); |
306 | struct nand_page_io_req adjreq = *req; | 306 | struct nand_page_io_req adjreq = *req; |
307 | unsigned int nbytes = 0; | 307 | void *buf = spinand->databuf; |
308 | void *buf = NULL; | 308 | unsigned int nbytes; |
309 | u16 column = 0; | 309 | u16 column = 0; |
310 | int ret; | 310 | int ret; |
311 | 311 | ||
312 | memset(spinand->databuf, 0xff, | 312 | /* |
313 | nanddev_page_size(nand) + | 313 | * Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset |
314 | nanddev_per_page_oobsize(nand)); | 314 | * the cache content to 0xFF (depends on vendor implementation), so we |
315 | * must fill the page cache entirely even if we only want to program | ||
316 | * the data portion of the page, otherwise we might corrupt the BBM or | ||
317 | * user data previously programmed in OOB area. | ||
318 | */ | ||
319 | nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand); | ||
320 | memset(spinand->databuf, 0xff, nbytes); | ||
321 | adjreq.dataoffs = 0; | ||
322 | adjreq.datalen = nanddev_page_size(nand); | ||
323 | adjreq.databuf.out = spinand->databuf; | ||
324 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
325 | adjreq.ooboffs = 0; | ||
326 | adjreq.oobbuf.out = spinand->oobbuf; | ||
315 | 327 | ||
316 | if (req->datalen) { | 328 | if (req->datalen) |
317 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, | 329 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, |
318 | req->datalen); | 330 | req->datalen); |
319 | adjreq.dataoffs = 0; | ||
320 | adjreq.datalen = nanddev_page_size(nand); | ||
321 | adjreq.databuf.out = spinand->databuf; | ||
322 | nbytes = adjreq.datalen; | ||
323 | buf = spinand->databuf; | ||
324 | } | ||
325 | 331 | ||
326 | if (req->ooblen) { | 332 | if (req->ooblen) { |
327 | if (req->mode == MTD_OPS_AUTO_OOB) | 333 | if (req->mode == MTD_OPS_AUTO_OOB) |
@@ -332,14 +338,6 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
332 | else | 338 | else |
333 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, | 339 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, |
334 | req->ooblen); | 340 | req->ooblen); |
335 | |||
336 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
337 | adjreq.ooboffs = 0; | ||
338 | nbytes += nanddev_per_page_oobsize(nand); | ||
339 | if (!buf) { | ||
340 | buf = spinand->oobbuf; | ||
341 | column = nanddev_page_size(nand); | ||
342 | } | ||
343 | } | 341 | } |
344 | 342 | ||
345 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); | 343 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); |
@@ -370,8 +368,8 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
370 | 368 | ||
371 | /* | 369 | /* |
372 | * We need to use the RANDOM LOAD CACHE operation if there's | 370 | * We need to use the RANDOM LOAD CACHE operation if there's |
373 | * more than one iteration, because the LOAD operation resets | 371 | * more than one iteration, because the LOAD operation might |
374 | * the cache to 0xff. | 372 | * reset the cache to 0xff. |
375 | */ | 373 | */ |
376 | if (nbytes) { | 374 | if (nbytes) { |
377 | column = op.addr.val; | 375 | column = op.addr.val; |
@@ -1018,11 +1016,11 @@ static int spinand_init(struct spinand_device *spinand) | |||
1018 | for (i = 0; i < nand->memorg.ntargets; i++) { | 1016 | for (i = 0; i < nand->memorg.ntargets; i++) { |
1019 | ret = spinand_select_target(spinand, i); | 1017 | ret = spinand_select_target(spinand, i); |
1020 | if (ret) | 1018 | if (ret) |
1021 | goto err_free_bufs; | 1019 | goto err_manuf_cleanup; |
1022 | 1020 | ||
1023 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); | 1021 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); |
1024 | if (ret) | 1022 | if (ret) |
1025 | goto err_free_bufs; | 1023 | goto err_manuf_cleanup; |
1026 | } | 1024 | } |
1027 | 1025 | ||
1028 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); | 1026 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 6f561767b45e..6210757772ed 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -200,9 +200,9 @@ config VXLAN | |||
200 | 200 | ||
201 | config GENEVE | 201 | config GENEVE |
202 | tristate "Generic Network Virtualization Encapsulation" | 202 | tristate "Generic Network Virtualization Encapsulation" |
203 | depends on INET && NET_UDP_TUNNEL | 203 | depends on INET |
204 | depends on IPV6 || !IPV6 | 204 | depends on IPV6 || !IPV6 |
205 | select NET_IP_TUNNEL | 205 | select NET_UDP_TUNNEL |
206 | select GRO_CELLS | 206 | select GRO_CELLS |
207 | ---help--- | 207 | ---help--- |
208 | This allows one to create geneve virtual interfaces that provide | 208 | This allows one to create geneve virtual interfaces that provide |
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 5193da67dcdc..98696a88fa1c 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c | |||
@@ -690,7 +690,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) | |||
690 | * port, the other ones have already been disabled during | 690 | * port, the other ones have already been disabled during |
691 | * bcm_sf2_sw_setup | 691 | * bcm_sf2_sw_setup |
692 | */ | 692 | */ |
693 | for (port = 0; port < DSA_MAX_PORTS; port++) { | 693 | for (port = 0; port < ds->num_ports; port++) { |
694 | if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port)) | 694 | if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port)) |
695 | bcm_sf2_port_disable(ds, port, NULL); | 695 | bcm_sf2_port_disable(ds, port, NULL); |
696 | } | 696 | } |
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 39c780363764..32e7af5caa69 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c | |||
@@ -261,6 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip) | |||
261 | unsigned int sub_irq; | 261 | unsigned int sub_irq; |
262 | unsigned int n; | 262 | unsigned int n; |
263 | u16 reg; | 263 | u16 reg; |
264 | u16 ctl1; | ||
264 | int err; | 265 | int err; |
265 | 266 | ||
266 | mutex_lock(&chip->reg_lock); | 267 | mutex_lock(&chip->reg_lock); |
@@ -270,13 +271,28 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip) | |||
270 | if (err) | 271 | if (err) |
271 | goto out; | 272 | goto out; |
272 | 273 | ||
273 | for (n = 0; n < chip->g1_irq.nirqs; ++n) { | 274 | do { |
274 | if (reg & (1 << n)) { | 275 | for (n = 0; n < chip->g1_irq.nirqs; ++n) { |
275 | sub_irq = irq_find_mapping(chip->g1_irq.domain, n); | 276 | if (reg & (1 << n)) { |
276 | handle_nested_irq(sub_irq); | 277 | sub_irq = irq_find_mapping(chip->g1_irq.domain, |
277 | ++nhandled; | 278 | n); |
279 | handle_nested_irq(sub_irq); | ||
280 | ++nhandled; | ||
281 | } | ||
278 | } | 282 | } |
279 | } | 283 | |
284 | mutex_lock(&chip->reg_lock); | ||
285 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &ctl1); | ||
286 | if (err) | ||
287 | goto unlock; | ||
288 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); | ||
289 | unlock: | ||
290 | mutex_unlock(&chip->reg_lock); | ||
291 | if (err) | ||
292 | goto out; | ||
293 | ctl1 &= GENMASK(chip->g1_irq.nirqs, 0); | ||
294 | } while (reg & ctl1); | ||
295 | |||
280 | out: | 296 | out: |
281 | return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE); | 297 | return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE); |
282 | } | 298 | } |
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index a70bb1bb90e7..a6eacf2099c3 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c | |||
@@ -2663,11 +2663,6 @@ static int ena_restore_device(struct ena_adapter *adapter) | |||
2663 | goto err_device_destroy; | 2663 | goto err_device_destroy; |
2664 | } | 2664 | } |
2665 | 2665 | ||
2666 | clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags); | ||
2667 | /* Make sure we don't have a race with AENQ Links state handler */ | ||
2668 | if (test_bit(ENA_FLAG_LINK_UP, &adapter->flags)) | ||
2669 | netif_carrier_on(adapter->netdev); | ||
2670 | |||
2671 | rc = ena_enable_msix_and_set_admin_interrupts(adapter, | 2666 | rc = ena_enable_msix_and_set_admin_interrupts(adapter, |
2672 | adapter->num_queues); | 2667 | adapter->num_queues); |
2673 | if (rc) { | 2668 | if (rc) { |
@@ -2684,6 +2679,11 @@ static int ena_restore_device(struct ena_adapter *adapter) | |||
2684 | } | 2679 | } |
2685 | 2680 | ||
2686 | set_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags); | 2681 | set_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags); |
2682 | |||
2683 | clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags); | ||
2684 | if (test_bit(ENA_FLAG_LINK_UP, &adapter->flags)) | ||
2685 | netif_carrier_on(adapter->netdev); | ||
2686 | |||
2687 | mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ)); | 2687 | mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ)); |
2688 | dev_err(&pdev->dev, | 2688 | dev_err(&pdev->dev, |
2689 | "Device reset completed successfully, Driver info: %s\n", | 2689 | "Device reset completed successfully, Driver info: %s\n", |
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h index dc8b6173d8d8..63870072cbbd 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.h +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #define DRV_MODULE_VER_MAJOR 2 | 46 | #define DRV_MODULE_VER_MAJOR 2 |
47 | #define DRV_MODULE_VER_MINOR 0 | 47 | #define DRV_MODULE_VER_MINOR 0 |
48 | #define DRV_MODULE_VER_SUBMINOR 2 | 48 | #define DRV_MODULE_VER_SUBMINOR 3 |
49 | 49 | ||
50 | #define DRV_MODULE_NAME "ena" | 50 | #define DRV_MODULE_NAME "ena" |
51 | #ifndef DRV_MODULE_VERSION | 51 | #ifndef DRV_MODULE_VERSION |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 2370dc204202..697c2427f2b7 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -2098,6 +2098,7 @@ static int fec_enet_get_regs_len(struct net_device *ndev) | |||
2098 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ | 2098 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ |
2099 | defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \ | 2099 | defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \ |
2100 | defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST) | 2100 | defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST) |
2101 | static __u32 fec_enet_register_version = 2; | ||
2101 | static u32 fec_enet_register_offset[] = { | 2102 | static u32 fec_enet_register_offset[] = { |
2102 | FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0, | 2103 | FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0, |
2103 | FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL, | 2104 | FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL, |
@@ -2128,6 +2129,7 @@ static u32 fec_enet_register_offset[] = { | |||
2128 | IEEE_R_FDXFC, IEEE_R_OCTETS_OK | 2129 | IEEE_R_FDXFC, IEEE_R_OCTETS_OK |
2129 | }; | 2130 | }; |
2130 | #else | 2131 | #else |
2132 | static __u32 fec_enet_register_version = 1; | ||
2131 | static u32 fec_enet_register_offset[] = { | 2133 | static u32 fec_enet_register_offset[] = { |
2132 | FEC_ECNTRL, FEC_IEVENT, FEC_IMASK, FEC_IVEC, FEC_R_DES_ACTIVE_0, | 2134 | FEC_ECNTRL, FEC_IEVENT, FEC_IMASK, FEC_IVEC, FEC_R_DES_ACTIVE_0, |
2133 | FEC_R_DES_ACTIVE_1, FEC_R_DES_ACTIVE_2, FEC_X_DES_ACTIVE_0, | 2135 | FEC_R_DES_ACTIVE_1, FEC_R_DES_ACTIVE_2, FEC_X_DES_ACTIVE_0, |
@@ -2149,6 +2151,8 @@ static void fec_enet_get_regs(struct net_device *ndev, | |||
2149 | u32 *buf = (u32 *)regbuf; | 2151 | u32 *buf = (u32 *)regbuf; |
2150 | u32 i, off; | 2152 | u32 i, off; |
2151 | 2153 | ||
2154 | regs->version = fec_enet_register_version; | ||
2155 | |||
2152 | memset(buf, 0, regs->len); | 2156 | memset(buf, 0, regs->len); |
2153 | 2157 | ||
2154 | for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) { | 2158 | for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) { |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c index 3b9e74be5fbd..b8155f5e71b4 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | |||
@@ -3081,6 +3081,7 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset) | |||
3081 | dsaf_dev = dev_get_drvdata(&pdev->dev); | 3081 | dsaf_dev = dev_get_drvdata(&pdev->dev); |
3082 | if (!dsaf_dev) { | 3082 | if (!dsaf_dev) { |
3083 | dev_err(&pdev->dev, "dsaf_dev is NULL\n"); | 3083 | dev_err(&pdev->dev, "dsaf_dev is NULL\n"); |
3084 | put_device(&pdev->dev); | ||
3084 | return -ENODEV; | 3085 | return -ENODEV; |
3085 | } | 3086 | } |
3086 | 3087 | ||
@@ -3088,6 +3089,7 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset) | |||
3088 | if (AE_IS_VER1(dsaf_dev->dsaf_ver)) { | 3089 | if (AE_IS_VER1(dsaf_dev->dsaf_ver)) { |
3089 | dev_err(dsaf_dev->dev, "%s v1 chip doesn't support RoCE!\n", | 3090 | dev_err(dsaf_dev->dev, "%s v1 chip doesn't support RoCE!\n", |
3090 | dsaf_dev->ae_dev.name); | 3091 | dsaf_dev->ae_dev.name); |
3092 | put_device(&pdev->dev); | ||
3091 | return -ENODEV; | 3093 | return -ENODEV; |
3092 | } | 3094 | } |
3093 | 3095 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 3e0fa8a8077b..e267ff93e8a8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
@@ -1583,6 +1583,24 @@ no_trig: | |||
1583 | spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); | 1583 | spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | void mlx5_cmd_flush(struct mlx5_core_dev *dev) | ||
1587 | { | ||
1588 | struct mlx5_cmd *cmd = &dev->cmd; | ||
1589 | int i; | ||
1590 | |||
1591 | for (i = 0; i < cmd->max_reg_cmds; i++) | ||
1592 | while (down_trylock(&cmd->sem)) | ||
1593 | mlx5_cmd_trigger_completions(dev); | ||
1594 | |||
1595 | while (down_trylock(&cmd->pages_sem)) | ||
1596 | mlx5_cmd_trigger_completions(dev); | ||
1597 | |||
1598 | /* Unlock cmdif */ | ||
1599 | up(&cmd->pages_sem); | ||
1600 | for (i = 0; i < cmd->max_reg_cmds; i++) | ||
1601 | up(&cmd->sem); | ||
1602 | } | ||
1603 | |||
1586 | static int status_to_err(u8 status) | 1604 | static int status_to_err(u8 status) |
1587 | { | 1605 | { |
1588 | return status ? -1 : 0; /* TBD more meaningful codes */ | 1606 | return status ? -1 : 0; /* TBD more meaningful codes */ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 66e510b16243..e9acfa9aa069 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
@@ -655,6 +655,7 @@ struct mlx5e_channel_stats { | |||
655 | enum { | 655 | enum { |
656 | MLX5E_STATE_OPENED, | 656 | MLX5E_STATE_OPENED, |
657 | MLX5E_STATE_DESTROYING, | 657 | MLX5E_STATE_DESTROYING, |
658 | MLX5E_STATE_XDP_TX_ENABLED, | ||
658 | }; | 659 | }; |
659 | 660 | ||
660 | struct mlx5e_rqt { | 661 | struct mlx5e_rqt { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c index 3740177eed09..03b2a9f9c589 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | |||
@@ -365,7 +365,8 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, | |||
365 | int sq_num; | 365 | int sq_num; |
366 | int i; | 366 | int i; |
367 | 367 | ||
368 | if (unlikely(!test_bit(MLX5E_STATE_OPENED, &priv->state))) | 368 | /* this flag is sufficient, no need to test internal sq state */ |
369 | if (unlikely(!mlx5e_xdp_tx_is_enabled(priv))) | ||
369 | return -ENETDOWN; | 370 | return -ENETDOWN; |
370 | 371 | ||
371 | if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) | 372 | if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) |
@@ -378,9 +379,6 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, | |||
378 | 379 | ||
379 | sq = &priv->channels.c[sq_num]->xdpsq; | 380 | sq = &priv->channels.c[sq_num]->xdpsq; |
380 | 381 | ||
381 | if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state))) | ||
382 | return -ENETDOWN; | ||
383 | |||
384 | for (i = 0; i < n; i++) { | 382 | for (i = 0; i < n; i++) { |
385 | struct xdp_frame *xdpf = frames[i]; | 383 | struct xdp_frame *xdpf = frames[i]; |
386 | struct mlx5e_xdp_info xdpi; | 384 | struct mlx5e_xdp_info xdpi; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h index 3a67cb3cd179..ee27a7c8cd87 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h | |||
@@ -50,6 +50,23 @@ void mlx5e_xdp_rx_poll_complete(struct mlx5e_rq *rq); | |||
50 | int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, | 50 | int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, |
51 | u32 flags); | 51 | u32 flags); |
52 | 52 | ||
53 | static inline void mlx5e_xdp_tx_enable(struct mlx5e_priv *priv) | ||
54 | { | ||
55 | set_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); | ||
56 | } | ||
57 | |||
58 | static inline void mlx5e_xdp_tx_disable(struct mlx5e_priv *priv) | ||
59 | { | ||
60 | clear_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); | ||
61 | /* let other device's napi(s) see our new state */ | ||
62 | synchronize_rcu(); | ||
63 | } | ||
64 | |||
65 | static inline bool mlx5e_xdp_tx_is_enabled(struct mlx5e_priv *priv) | ||
66 | { | ||
67 | return test_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); | ||
68 | } | ||
69 | |||
53 | static inline void mlx5e_xmit_xdp_doorbell(struct mlx5e_xdpsq *sq) | 70 | static inline void mlx5e_xmit_xdp_doorbell(struct mlx5e_xdpsq *sq) |
54 | { | 71 | { |
55 | if (sq->doorbell_cseg) { | 72 | if (sq->doorbell_cseg) { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 3bbccead2f63..47233b9a4f81 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -354,9 +354,6 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv, | |||
354 | 354 | ||
355 | new_channels.params = priv->channels.params; | 355 | new_channels.params = priv->channels.params; |
356 | new_channels.params.num_channels = count; | 356 | new_channels.params.num_channels = count; |
357 | if (!netif_is_rxfh_configured(priv->netdev)) | ||
358 | mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt, | ||
359 | MLX5E_INDIR_RQT_SIZE, count); | ||
360 | 357 | ||
361 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { | 358 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { |
362 | priv->channels.params = new_channels.params; | 359 | priv->channels.params = new_channels.params; |
@@ -372,6 +369,10 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv, | |||
372 | if (arfs_enabled) | 369 | if (arfs_enabled) |
373 | mlx5e_arfs_disable(priv); | 370 | mlx5e_arfs_disable(priv); |
374 | 371 | ||
372 | if (!netif_is_rxfh_configured(priv->netdev)) | ||
373 | mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt, | ||
374 | MLX5E_INDIR_RQT_SIZE, count); | ||
375 | |||
375 | /* Switch to new channels, set new parameters and close old ones */ | 376 | /* Switch to new channels, set new parameters and close old ones */ |
376 | mlx5e_switch_priv_channels(priv, &new_channels, NULL); | 377 | mlx5e_switch_priv_channels(priv, &new_channels, NULL); |
377 | 378 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index d81ebba7c04e..83510ca0bcd8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -2859,6 +2859,7 @@ void mlx5e_activate_priv_channels(struct mlx5e_priv *priv) | |||
2859 | 2859 | ||
2860 | mlx5e_build_tx2sq_maps(priv); | 2860 | mlx5e_build_tx2sq_maps(priv); |
2861 | mlx5e_activate_channels(&priv->channels); | 2861 | mlx5e_activate_channels(&priv->channels); |
2862 | mlx5e_xdp_tx_enable(priv); | ||
2862 | netif_tx_start_all_queues(priv->netdev); | 2863 | netif_tx_start_all_queues(priv->netdev); |
2863 | 2864 | ||
2864 | if (mlx5e_is_vport_rep(priv)) | 2865 | if (mlx5e_is_vport_rep(priv)) |
@@ -2880,6 +2881,7 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv) | |||
2880 | */ | 2881 | */ |
2881 | netif_tx_stop_all_queues(priv->netdev); | 2882 | netif_tx_stop_all_queues(priv->netdev); |
2882 | netif_tx_disable(priv->netdev); | 2883 | netif_tx_disable(priv->netdev); |
2884 | mlx5e_xdp_tx_disable(priv); | ||
2883 | mlx5e_deactivate_channels(&priv->channels); | 2885 | mlx5e_deactivate_channels(&priv->channels); |
2884 | } | 2886 | } |
2885 | 2887 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c index fbc42b7252a9..503035469d2d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/events.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c | |||
@@ -211,11 +211,10 @@ static int port_module(struct notifier_block *nb, unsigned long type, void *data | |||
211 | enum port_module_event_status_type module_status; | 211 | enum port_module_event_status_type module_status; |
212 | enum port_module_event_error_type error_type; | 212 | enum port_module_event_error_type error_type; |
213 | struct mlx5_eqe_port_module *module_event_eqe; | 213 | struct mlx5_eqe_port_module *module_event_eqe; |
214 | const char *status_str, *error_str; | 214 | const char *status_str; |
215 | u8 module_num; | 215 | u8 module_num; |
216 | 216 | ||
217 | module_event_eqe = &eqe->data.port_module; | 217 | module_event_eqe = &eqe->data.port_module; |
218 | module_num = module_event_eqe->module; | ||
219 | module_status = module_event_eqe->module_status & | 218 | module_status = module_event_eqe->module_status & |
220 | PORT_MODULE_EVENT_MODULE_STATUS_MASK; | 219 | PORT_MODULE_EVENT_MODULE_STATUS_MASK; |
221 | error_type = module_event_eqe->error_type & | 220 | error_type = module_event_eqe->error_type & |
@@ -223,25 +222,27 @@ static int port_module(struct notifier_block *nb, unsigned long type, void *data | |||
223 | 222 | ||
224 | if (module_status < MLX5_MODULE_STATUS_NUM) | 223 | if (module_status < MLX5_MODULE_STATUS_NUM) |
225 | events->pme_stats.status_counters[module_status]++; | 224 | events->pme_stats.status_counters[module_status]++; |
226 | status_str = mlx5_pme_status_to_string(module_status); | ||
227 | 225 | ||
228 | if (module_status == MLX5_MODULE_STATUS_ERROR) { | 226 | if (module_status == MLX5_MODULE_STATUS_ERROR) |
229 | if (error_type < MLX5_MODULE_EVENT_ERROR_NUM) | 227 | if (error_type < MLX5_MODULE_EVENT_ERROR_NUM) |
230 | events->pme_stats.error_counters[error_type]++; | 228 | events->pme_stats.error_counters[error_type]++; |
231 | error_str = mlx5_pme_error_to_string(error_type); | ||
232 | } | ||
233 | 229 | ||
234 | if (!printk_ratelimit()) | 230 | if (!printk_ratelimit()) |
235 | return NOTIFY_OK; | 231 | return NOTIFY_OK; |
236 | 232 | ||
237 | if (module_status == MLX5_MODULE_STATUS_ERROR) | 233 | module_num = module_event_eqe->module; |
234 | status_str = mlx5_pme_status_to_string(module_status); | ||
235 | if (module_status == MLX5_MODULE_STATUS_ERROR) { | ||
236 | const char *error_str = mlx5_pme_error_to_string(error_type); | ||
237 | |||
238 | mlx5_core_err(events->dev, | 238 | mlx5_core_err(events->dev, |
239 | "Port module event[error]: module %u, %s, %s\n", | 239 | "Port module event[error]: module %u, %s, %s\n", |
240 | module_num, status_str, error_str); | 240 | module_num, status_str, error_str); |
241 | else | 241 | } else { |
242 | mlx5_core_info(events->dev, | 242 | mlx5_core_info(events->dev, |
243 | "Port module event: module %u, %s\n", | 243 | "Port module event: module %u, %s\n", |
244 | module_num, status_str); | 244 | module_num, status_str); |
245 | } | ||
245 | 246 | ||
246 | return NOTIFY_OK; | 247 | return NOTIFY_OK; |
247 | } | 248 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index 196c07383082..cb9fa3430c53 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c | |||
@@ -103,7 +103,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) | |||
103 | mlx5_core_err(dev, "start\n"); | 103 | mlx5_core_err(dev, "start\n"); |
104 | if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { | 104 | if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { |
105 | dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; | 105 | dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; |
106 | mlx5_cmd_trigger_completions(dev); | 106 | mlx5_cmd_flush(dev); |
107 | } | 107 | } |
108 | 108 | ||
109 | mlx5_notifier_call_chain(dev->priv.events, MLX5_DEV_EVENT_SYS_ERROR, (void *)1); | 109 | mlx5_notifier_call_chain(dev->priv.events, MLX5_DEV_EVENT_SYS_ERROR, (void *)1); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index 5300b0b6d836..4fdac020b795 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | |||
@@ -126,6 +126,7 @@ u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev, | |||
126 | struct ptp_system_timestamp *sts); | 126 | struct ptp_system_timestamp *sts); |
127 | 127 | ||
128 | void mlx5_cmd_trigger_completions(struct mlx5_core_dev *dev); | 128 | void mlx5_cmd_trigger_completions(struct mlx5_core_dev *dev); |
129 | void mlx5_cmd_flush(struct mlx5_core_dev *dev); | ||
129 | int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev); | 130 | int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev); |
130 | void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev); | 131 | void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev); |
131 | 132 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 1dd72137fd53..10bab1f7150a 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -1288,11 +1288,13 @@ static u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr) | |||
1288 | static void rtl_ack_events(struct rtl8169_private *tp, u16 bits) | 1288 | static void rtl_ack_events(struct rtl8169_private *tp, u16 bits) |
1289 | { | 1289 | { |
1290 | RTL_W16(tp, IntrStatus, bits); | 1290 | RTL_W16(tp, IntrStatus, bits); |
1291 | mmiowb(); | ||
1291 | } | 1292 | } |
1292 | 1293 | ||
1293 | static void rtl_irq_disable(struct rtl8169_private *tp) | 1294 | static void rtl_irq_disable(struct rtl8169_private *tp) |
1294 | { | 1295 | { |
1295 | RTL_W16(tp, IntrMask, 0); | 1296 | RTL_W16(tp, IntrMask, 0); |
1297 | mmiowb(); | ||
1296 | } | 1298 | } |
1297 | 1299 | ||
1298 | #define RTL_EVENT_NAPI_RX (RxOK | RxErr) | 1300 | #define RTL_EVENT_NAPI_RX (RxOK | RxErr) |
@@ -6192,7 +6194,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
6192 | struct device *d = tp_to_dev(tp); | 6194 | struct device *d = tp_to_dev(tp); |
6193 | dma_addr_t mapping; | 6195 | dma_addr_t mapping; |
6194 | u32 opts[2], len; | 6196 | u32 opts[2], len; |
6195 | bool stop_queue; | ||
6196 | int frags; | 6197 | int frags; |
6197 | 6198 | ||
6198 | if (unlikely(!rtl_tx_slots_avail(tp, skb_shinfo(skb)->nr_frags))) { | 6199 | if (unlikely(!rtl_tx_slots_avail(tp, skb_shinfo(skb)->nr_frags))) { |
@@ -6234,6 +6235,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
6234 | 6235 | ||
6235 | txd->opts2 = cpu_to_le32(opts[1]); | 6236 | txd->opts2 = cpu_to_le32(opts[1]); |
6236 | 6237 | ||
6238 | netdev_sent_queue(dev, skb->len); | ||
6239 | |||
6237 | skb_tx_timestamp(skb); | 6240 | skb_tx_timestamp(skb); |
6238 | 6241 | ||
6239 | /* Force memory writes to complete before releasing descriptor */ | 6242 | /* Force memory writes to complete before releasing descriptor */ |
@@ -6246,14 +6249,16 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
6246 | 6249 | ||
6247 | tp->cur_tx += frags + 1; | 6250 | tp->cur_tx += frags + 1; |
6248 | 6251 | ||
6249 | stop_queue = !rtl_tx_slots_avail(tp, MAX_SKB_FRAGS); | 6252 | RTL_W8(tp, TxPoll, NPQ); |
6250 | if (unlikely(stop_queue)) | ||
6251 | netif_stop_queue(dev); | ||
6252 | 6253 | ||
6253 | if (__netdev_sent_queue(dev, skb->len, skb->xmit_more)) | 6254 | mmiowb(); |
6254 | RTL_W8(tp, TxPoll, NPQ); | ||
6255 | 6255 | ||
6256 | if (unlikely(stop_queue)) { | 6256 | if (!rtl_tx_slots_avail(tp, MAX_SKB_FRAGS)) { |
6257 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must | ||
6258 | * not miss a ring update when it notices a stopped queue. | ||
6259 | */ | ||
6260 | smp_wmb(); | ||
6261 | netif_stop_queue(dev); | ||
6257 | /* Sync with rtl_tx: | 6262 | /* Sync with rtl_tx: |
6258 | * - publish queue status and cur_tx ring index (write barrier) | 6263 | * - publish queue status and cur_tx ring index (write barrier) |
6259 | * - refresh dirty_tx ring index (read barrier). | 6264 | * - refresh dirty_tx ring index (read barrier). |
@@ -6592,7 +6597,9 @@ static int rtl8169_poll(struct napi_struct *napi, int budget) | |||
6592 | 6597 | ||
6593 | if (work_done < budget) { | 6598 | if (work_done < budget) { |
6594 | napi_complete_done(napi, work_done); | 6599 | napi_complete_done(napi, work_done); |
6600 | |||
6595 | rtl_irq_enable(tp); | 6601 | rtl_irq_enable(tp); |
6602 | mmiowb(); | ||
6596 | } | 6603 | } |
6597 | 6604 | ||
6598 | return work_done; | 6605 | return work_done; |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index bc92d73047c6..e888b479c596 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -6125,7 +6125,7 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, | |||
6125 | static int efx_ef10_mtd_probe(struct efx_nic *efx) | 6125 | static int efx_ef10_mtd_probe(struct efx_nic *efx) |
6126 | { | 6126 | { |
6127 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX); | 6127 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX); |
6128 | DECLARE_BITMAP(found, EF10_NVRAM_PARTITION_COUNT); | 6128 | DECLARE_BITMAP(found, EF10_NVRAM_PARTITION_COUNT) = { 0 }; |
6129 | struct efx_mcdi_mtd_partition *parts; | 6129 | struct efx_mcdi_mtd_partition *parts; |
6130 | size_t outlen, n_parts_total, i, n_parts; | 6130 | size_t outlen, n_parts_total, i, n_parts; |
6131 | unsigned int type; | 6131 | unsigned int type; |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 89ead29cec68..69dc64a4dbf8 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -543,7 +543,7 @@ int phy_start_aneg(struct phy_device *phydev) | |||
543 | if (err < 0) | 543 | if (err < 0) |
544 | goto out_unlock; | 544 | goto out_unlock; |
545 | 545 | ||
546 | if (__phy_is_started(phydev)) { | 546 | if (phy_is_started(phydev)) { |
547 | if (phydev->autoneg == AUTONEG_ENABLE) { | 547 | if (phydev->autoneg == AUTONEG_ENABLE) { |
548 | err = phy_check_link_status(phydev); | 548 | err = phy_check_link_status(phydev); |
549 | } else { | 549 | } else { |
@@ -699,7 +699,7 @@ void phy_stop_machine(struct phy_device *phydev) | |||
699 | cancel_delayed_work_sync(&phydev->state_queue); | 699 | cancel_delayed_work_sync(&phydev->state_queue); |
700 | 700 | ||
701 | mutex_lock(&phydev->lock); | 701 | mutex_lock(&phydev->lock); |
702 | if (__phy_is_started(phydev)) | 702 | if (phy_is_started(phydev)) |
703 | phydev->state = PHY_UP; | 703 | phydev->state = PHY_UP; |
704 | mutex_unlock(&phydev->lock); | 704 | mutex_unlock(&phydev->lock); |
705 | } | 705 | } |
@@ -752,9 +752,6 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) | |||
752 | { | 752 | { |
753 | struct phy_device *phydev = phy_dat; | 753 | struct phy_device *phydev = phy_dat; |
754 | 754 | ||
755 | if (!phy_is_started(phydev)) | ||
756 | return IRQ_NONE; /* It can't be ours. */ | ||
757 | |||
758 | if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) | 755 | if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) |
759 | return IRQ_NONE; | 756 | return IRQ_NONE; |
760 | 757 | ||
@@ -813,15 +810,14 @@ EXPORT_SYMBOL(phy_request_interrupt); | |||
813 | */ | 810 | */ |
814 | void phy_stop(struct phy_device *phydev) | 811 | void phy_stop(struct phy_device *phydev) |
815 | { | 812 | { |
816 | mutex_lock(&phydev->lock); | 813 | if (!phy_is_started(phydev)) { |
817 | |||
818 | if (!__phy_is_started(phydev)) { | ||
819 | WARN(1, "called from state %s\n", | 814 | WARN(1, "called from state %s\n", |
820 | phy_state_to_str(phydev->state)); | 815 | phy_state_to_str(phydev->state)); |
821 | mutex_unlock(&phydev->lock); | ||
822 | return; | 816 | return; |
823 | } | 817 | } |
824 | 818 | ||
819 | mutex_lock(&phydev->lock); | ||
820 | |||
825 | if (phy_interrupt_is_valid(phydev)) | 821 | if (phy_interrupt_is_valid(phydev)) |
826 | phy_disable_interrupts(phydev); | 822 | phy_disable_interrupts(phydev); |
827 | 823 | ||
@@ -961,8 +957,10 @@ void phy_state_machine(struct work_struct *work) | |||
961 | * state machine would be pointless and possibly error prone when | 957 | * state machine would be pointless and possibly error prone when |
962 | * called from phy_disconnect() synchronously. | 958 | * called from phy_disconnect() synchronously. |
963 | */ | 959 | */ |
960 | mutex_lock(&phydev->lock); | ||
964 | if (phy_polling_mode(phydev) && phy_is_started(phydev)) | 961 | if (phy_polling_mode(phydev) && phy_is_started(phydev)) |
965 | phy_queue_state_machine(phydev, PHY_STATE_TIME); | 962 | phy_queue_state_machine(phydev, PHY_STATE_TIME); |
963 | mutex_unlock(&phydev->lock); | ||
966 | } | 964 | } |
967 | 965 | ||
968 | /** | 966 | /** |
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 33f66dcd369a..59d175a5ba54 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c | |||
@@ -478,6 +478,17 @@ static void phylink_run_resolve(struct phylink *pl) | |||
478 | queue_work(system_power_efficient_wq, &pl->resolve); | 478 | queue_work(system_power_efficient_wq, &pl->resolve); |
479 | } | 479 | } |
480 | 480 | ||
481 | static void phylink_run_resolve_and_disable(struct phylink *pl, int bit) | ||
482 | { | ||
483 | unsigned long state = pl->phylink_disable_state; | ||
484 | |||
485 | set_bit(bit, &pl->phylink_disable_state); | ||
486 | if (state == 0) { | ||
487 | queue_work(system_power_efficient_wq, &pl->resolve); | ||
488 | flush_work(&pl->resolve); | ||
489 | } | ||
490 | } | ||
491 | |||
481 | static void phylink_fixed_poll(struct timer_list *t) | 492 | static void phylink_fixed_poll(struct timer_list *t) |
482 | { | 493 | { |
483 | struct phylink *pl = container_of(t, struct phylink, link_poll); | 494 | struct phylink *pl = container_of(t, struct phylink, link_poll); |
@@ -927,9 +938,7 @@ void phylink_stop(struct phylink *pl) | |||
927 | if (pl->link_an_mode == MLO_AN_FIXED && !IS_ERR(pl->link_gpio)) | 938 | if (pl->link_an_mode == MLO_AN_FIXED && !IS_ERR(pl->link_gpio)) |
928 | del_timer_sync(&pl->link_poll); | 939 | del_timer_sync(&pl->link_poll); |
929 | 940 | ||
930 | set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); | 941 | phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED); |
931 | queue_work(system_power_efficient_wq, &pl->resolve); | ||
932 | flush_work(&pl->resolve); | ||
933 | } | 942 | } |
934 | EXPORT_SYMBOL_GPL(phylink_stop); | 943 | EXPORT_SYMBOL_GPL(phylink_stop); |
935 | 944 | ||
@@ -1653,9 +1662,7 @@ static void phylink_sfp_link_down(void *upstream) | |||
1653 | 1662 | ||
1654 | ASSERT_RTNL(); | 1663 | ASSERT_RTNL(); |
1655 | 1664 | ||
1656 | set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state); | 1665 | phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_LINK); |
1657 | queue_work(system_power_efficient_wq, &pl->resolve); | ||
1658 | flush_work(&pl->resolve); | ||
1659 | } | 1666 | } |
1660 | 1667 | ||
1661 | static void phylink_sfp_link_up(void *upstream) | 1668 | static void phylink_sfp_link_up(void *upstream) |
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index ad9db652874d..fef701bfad62 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c | |||
@@ -347,6 +347,7 @@ static int sfp_register_bus(struct sfp_bus *bus) | |||
347 | return ret; | 347 | return ret; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | bus->socket_ops->attach(bus->sfp); | ||
350 | if (bus->started) | 351 | if (bus->started) |
351 | bus->socket_ops->start(bus->sfp); | 352 | bus->socket_ops->start(bus->sfp); |
352 | bus->netdev->sfp_bus = bus; | 353 | bus->netdev->sfp_bus = bus; |
@@ -362,6 +363,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus) | |||
362 | if (bus->registered) { | 363 | if (bus->registered) { |
363 | if (bus->started) | 364 | if (bus->started) |
364 | bus->socket_ops->stop(bus->sfp); | 365 | bus->socket_ops->stop(bus->sfp); |
366 | bus->socket_ops->detach(bus->sfp); | ||
365 | if (bus->phydev && ops && ops->disconnect_phy) | 367 | if (bus->phydev && ops && ops->disconnect_phy) |
366 | ops->disconnect_phy(bus->upstream); | 368 | ops->disconnect_phy(bus->upstream); |
367 | } | 369 | } |
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 298ab7546929..d4635c2178d1 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c | |||
@@ -185,6 +185,7 @@ struct sfp { | |||
185 | 185 | ||
186 | struct gpio_desc *gpio[GPIO_MAX]; | 186 | struct gpio_desc *gpio[GPIO_MAX]; |
187 | 187 | ||
188 | bool attached; | ||
188 | unsigned int state; | 189 | unsigned int state; |
189 | struct delayed_work poll; | 190 | struct delayed_work poll; |
190 | struct delayed_work timeout; | 191 | struct delayed_work timeout; |
@@ -1476,7 +1477,7 @@ static void sfp_sm_event(struct sfp *sfp, unsigned int event) | |||
1476 | */ | 1477 | */ |
1477 | switch (sfp->sm_mod_state) { | 1478 | switch (sfp->sm_mod_state) { |
1478 | default: | 1479 | default: |
1479 | if (event == SFP_E_INSERT) { | 1480 | if (event == SFP_E_INSERT && sfp->attached) { |
1480 | sfp_module_tx_disable(sfp); | 1481 | sfp_module_tx_disable(sfp); |
1481 | sfp_sm_ins_next(sfp, SFP_MOD_PROBE, T_PROBE_INIT); | 1482 | sfp_sm_ins_next(sfp, SFP_MOD_PROBE, T_PROBE_INIT); |
1482 | } | 1483 | } |
@@ -1608,6 +1609,19 @@ static void sfp_sm_event(struct sfp *sfp, unsigned int event) | |||
1608 | mutex_unlock(&sfp->sm_mutex); | 1609 | mutex_unlock(&sfp->sm_mutex); |
1609 | } | 1610 | } |
1610 | 1611 | ||
1612 | static void sfp_attach(struct sfp *sfp) | ||
1613 | { | ||
1614 | sfp->attached = true; | ||
1615 | if (sfp->state & SFP_F_PRESENT) | ||
1616 | sfp_sm_event(sfp, SFP_E_INSERT); | ||
1617 | } | ||
1618 | |||
1619 | static void sfp_detach(struct sfp *sfp) | ||
1620 | { | ||
1621 | sfp->attached = false; | ||
1622 | sfp_sm_event(sfp, SFP_E_REMOVE); | ||
1623 | } | ||
1624 | |||
1611 | static void sfp_start(struct sfp *sfp) | 1625 | static void sfp_start(struct sfp *sfp) |
1612 | { | 1626 | { |
1613 | sfp_sm_event(sfp, SFP_E_DEV_UP); | 1627 | sfp_sm_event(sfp, SFP_E_DEV_UP); |
@@ -1668,6 +1682,8 @@ static int sfp_module_eeprom(struct sfp *sfp, struct ethtool_eeprom *ee, | |||
1668 | } | 1682 | } |
1669 | 1683 | ||
1670 | static const struct sfp_socket_ops sfp_module_ops = { | 1684 | static const struct sfp_socket_ops sfp_module_ops = { |
1685 | .attach = sfp_attach, | ||
1686 | .detach = sfp_detach, | ||
1671 | .start = sfp_start, | 1687 | .start = sfp_start, |
1672 | .stop = sfp_stop, | 1688 | .stop = sfp_stop, |
1673 | .module_info = sfp_module_info, | 1689 | .module_info = sfp_module_info, |
@@ -1835,10 +1851,6 @@ static int sfp_probe(struct platform_device *pdev) | |||
1835 | dev_info(sfp->dev, "Host maximum power %u.%uW\n", | 1851 | dev_info(sfp->dev, "Host maximum power %u.%uW\n", |
1836 | sfp->max_power_mW / 1000, (sfp->max_power_mW / 100) % 10); | 1852 | sfp->max_power_mW / 1000, (sfp->max_power_mW / 100) % 10); |
1837 | 1853 | ||
1838 | sfp->sfp_bus = sfp_register_socket(sfp->dev, sfp, &sfp_module_ops); | ||
1839 | if (!sfp->sfp_bus) | ||
1840 | return -ENOMEM; | ||
1841 | |||
1842 | /* Get the initial state, and always signal TX disable, | 1854 | /* Get the initial state, and always signal TX disable, |
1843 | * since the network interface will not be up. | 1855 | * since the network interface will not be up. |
1844 | */ | 1856 | */ |
@@ -1849,10 +1861,6 @@ static int sfp_probe(struct platform_device *pdev) | |||
1849 | sfp->state |= SFP_F_RATE_SELECT; | 1861 | sfp->state |= SFP_F_RATE_SELECT; |
1850 | sfp_set_state(sfp, sfp->state); | 1862 | sfp_set_state(sfp, sfp->state); |
1851 | sfp_module_tx_disable(sfp); | 1863 | sfp_module_tx_disable(sfp); |
1852 | rtnl_lock(); | ||
1853 | if (sfp->state & SFP_F_PRESENT) | ||
1854 | sfp_sm_event(sfp, SFP_E_INSERT); | ||
1855 | rtnl_unlock(); | ||
1856 | 1864 | ||
1857 | for (i = 0; i < GPIO_MAX; i++) { | 1865 | for (i = 0; i < GPIO_MAX; i++) { |
1858 | if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i]) | 1866 | if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i]) |
@@ -1885,6 +1893,10 @@ static int sfp_probe(struct platform_device *pdev) | |||
1885 | dev_warn(sfp->dev, | 1893 | dev_warn(sfp->dev, |
1886 | "No tx_disable pin: SFP modules will always be emitting.\n"); | 1894 | "No tx_disable pin: SFP modules will always be emitting.\n"); |
1887 | 1895 | ||
1896 | sfp->sfp_bus = sfp_register_socket(sfp->dev, sfp, &sfp_module_ops); | ||
1897 | if (!sfp->sfp_bus) | ||
1898 | return -ENOMEM; | ||
1899 | |||
1888 | return 0; | 1900 | return 0; |
1889 | } | 1901 | } |
1890 | 1902 | ||
diff --git a/drivers/net/phy/sfp.h b/drivers/net/phy/sfp.h index 31b0acf337e2..64f54b0bbd8c 100644 --- a/drivers/net/phy/sfp.h +++ b/drivers/net/phy/sfp.h | |||
@@ -7,6 +7,8 @@ | |||
7 | struct sfp; | 7 | struct sfp; |
8 | 8 | ||
9 | struct sfp_socket_ops { | 9 | struct sfp_socket_ops { |
10 | void (*attach)(struct sfp *sfp); | ||
11 | void (*detach)(struct sfp *sfp); | ||
10 | void (*start)(struct sfp *sfp); | 12 | void (*start)(struct sfp *sfp); |
11 | void (*stop)(struct sfp *sfp); | 13 | void (*stop)(struct sfp *sfp); |
12 | int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo); | 14 | int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo); |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index afd9d25d1992..958f1cf67282 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -256,17 +256,6 @@ static void __team_option_inst_mark_removed_port(struct team *team, | |||
256 | } | 256 | } |
257 | } | 257 | } |
258 | 258 | ||
259 | static bool __team_option_inst_tmp_find(const struct list_head *opts, | ||
260 | const struct team_option_inst *needle) | ||
261 | { | ||
262 | struct team_option_inst *opt_inst; | ||
263 | |||
264 | list_for_each_entry(opt_inst, opts, tmp_list) | ||
265 | if (opt_inst == needle) | ||
266 | return true; | ||
267 | return false; | ||
268 | } | ||
269 | |||
270 | static int __team_options_register(struct team *team, | 259 | static int __team_options_register(struct team *team, |
271 | const struct team_option *option, | 260 | const struct team_option *option, |
272 | size_t option_count) | 261 | size_t option_count) |
@@ -2460,7 +2449,6 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) | |||
2460 | int err = 0; | 2449 | int err = 0; |
2461 | int i; | 2450 | int i; |
2462 | struct nlattr *nl_option; | 2451 | struct nlattr *nl_option; |
2463 | LIST_HEAD(opt_inst_list); | ||
2464 | 2452 | ||
2465 | rtnl_lock(); | 2453 | rtnl_lock(); |
2466 | 2454 | ||
@@ -2480,6 +2468,7 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) | |||
2480 | struct nlattr *opt_attrs[TEAM_ATTR_OPTION_MAX + 1]; | 2468 | struct nlattr *opt_attrs[TEAM_ATTR_OPTION_MAX + 1]; |
2481 | struct nlattr *attr; | 2469 | struct nlattr *attr; |
2482 | struct nlattr *attr_data; | 2470 | struct nlattr *attr_data; |
2471 | LIST_HEAD(opt_inst_list); | ||
2483 | enum team_option_type opt_type; | 2472 | enum team_option_type opt_type; |
2484 | int opt_port_ifindex = 0; /* != 0 for per-port options */ | 2473 | int opt_port_ifindex = 0; /* != 0 for per-port options */ |
2485 | u32 opt_array_index = 0; | 2474 | u32 opt_array_index = 0; |
@@ -2584,23 +2573,17 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) | |||
2584 | if (err) | 2573 | if (err) |
2585 | goto team_put; | 2574 | goto team_put; |
2586 | opt_inst->changed = true; | 2575 | opt_inst->changed = true; |
2587 | |||
2588 | /* dumb/evil user-space can send us duplicate opt, | ||
2589 | * keep only the last one | ||
2590 | */ | ||
2591 | if (__team_option_inst_tmp_find(&opt_inst_list, | ||
2592 | opt_inst)) | ||
2593 | continue; | ||
2594 | |||
2595 | list_add(&opt_inst->tmp_list, &opt_inst_list); | 2576 | list_add(&opt_inst->tmp_list, &opt_inst_list); |
2596 | } | 2577 | } |
2597 | if (!opt_found) { | 2578 | if (!opt_found) { |
2598 | err = -ENOENT; | 2579 | err = -ENOENT; |
2599 | goto team_put; | 2580 | goto team_put; |
2600 | } | 2581 | } |
2601 | } | ||
2602 | 2582 | ||
2603 | err = team_nl_send_event_options_get(team, &opt_inst_list); | 2583 | err = team_nl_send_event_options_get(team, &opt_inst_list); |
2584 | if (err) | ||
2585 | break; | ||
2586 | } | ||
2604 | 2587 | ||
2605 | team_put: | 2588 | team_put: |
2606 | team_nl_team_put(team); | 2589 | team_nl_team_put(team); |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index c0cd1c022e77..33edc78e818d 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2293,7 +2293,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, | |||
2293 | struct pcpu_sw_netstats *tx_stats, *rx_stats; | 2293 | struct pcpu_sw_netstats *tx_stats, *rx_stats; |
2294 | union vxlan_addr loopback; | 2294 | union vxlan_addr loopback; |
2295 | union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip; | 2295 | union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip; |
2296 | struct net_device *dev = skb->dev; | 2296 | struct net_device *dev; |
2297 | int len = skb->len; | 2297 | int len = skb->len; |
2298 | 2298 | ||
2299 | tx_stats = this_cpu_ptr(src_vxlan->dev->tstats); | 2299 | tx_stats = this_cpu_ptr(src_vxlan->dev->tstats); |
@@ -2313,9 +2313,15 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, | |||
2313 | #endif | 2313 | #endif |
2314 | } | 2314 | } |
2315 | 2315 | ||
2316 | rcu_read_lock(); | ||
2317 | dev = skb->dev; | ||
2318 | if (unlikely(!(dev->flags & IFF_UP))) { | ||
2319 | kfree_skb(skb); | ||
2320 | goto drop; | ||
2321 | } | ||
2322 | |||
2316 | if (dst_vxlan->cfg.flags & VXLAN_F_LEARN) | 2323 | if (dst_vxlan->cfg.flags & VXLAN_F_LEARN) |
2317 | vxlan_snoop(skb->dev, &loopback, eth_hdr(skb)->h_source, 0, | 2324 | vxlan_snoop(dev, &loopback, eth_hdr(skb)->h_source, 0, vni); |
2318 | vni); | ||
2319 | 2325 | ||
2320 | u64_stats_update_begin(&tx_stats->syncp); | 2326 | u64_stats_update_begin(&tx_stats->syncp); |
2321 | tx_stats->tx_packets++; | 2327 | tx_stats->tx_packets++; |
@@ -2328,8 +2334,10 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, | |||
2328 | rx_stats->rx_bytes += len; | 2334 | rx_stats->rx_bytes += len; |
2329 | u64_stats_update_end(&rx_stats->syncp); | 2335 | u64_stats_update_end(&rx_stats->syncp); |
2330 | } else { | 2336 | } else { |
2337 | drop: | ||
2331 | dev->stats.rx_dropped++; | 2338 | dev->stats.rx_dropped++; |
2332 | } | 2339 | } |
2340 | rcu_read_unlock(); | ||
2333 | } | 2341 | } |
2334 | 2342 | ||
2335 | static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev, | 2343 | static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev, |
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 150e49723c15..6a9dd68c0f4f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
@@ -1253,6 +1253,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, | |||
1253 | * effects say only one namespace is affected. | 1253 | * effects say only one namespace is affected. |
1254 | */ | 1254 | */ |
1255 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { | 1255 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { |
1256 | mutex_lock(&ctrl->scan_lock); | ||
1256 | nvme_start_freeze(ctrl); | 1257 | nvme_start_freeze(ctrl); |
1257 | nvme_wait_freeze(ctrl); | 1258 | nvme_wait_freeze(ctrl); |
1258 | } | 1259 | } |
@@ -1281,8 +1282,10 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) | |||
1281 | */ | 1282 | */ |
1282 | if (effects & NVME_CMD_EFFECTS_LBCC) | 1283 | if (effects & NVME_CMD_EFFECTS_LBCC) |
1283 | nvme_update_formats(ctrl); | 1284 | nvme_update_formats(ctrl); |
1284 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) | 1285 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { |
1285 | nvme_unfreeze(ctrl); | 1286 | nvme_unfreeze(ctrl); |
1287 | mutex_unlock(&ctrl->scan_lock); | ||
1288 | } | ||
1286 | if (effects & NVME_CMD_EFFECTS_CCC) | 1289 | if (effects & NVME_CMD_EFFECTS_CCC) |
1287 | nvme_init_identify(ctrl); | 1290 | nvme_init_identify(ctrl); |
1288 | if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) | 1291 | if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) |
@@ -3401,6 +3404,7 @@ static void nvme_scan_work(struct work_struct *work) | |||
3401 | if (nvme_identify_ctrl(ctrl, &id)) | 3404 | if (nvme_identify_ctrl(ctrl, &id)) |
3402 | return; | 3405 | return; |
3403 | 3406 | ||
3407 | mutex_lock(&ctrl->scan_lock); | ||
3404 | nn = le32_to_cpu(id->nn); | 3408 | nn = le32_to_cpu(id->nn); |
3405 | if (ctrl->vs >= NVME_VS(1, 1, 0) && | 3409 | if (ctrl->vs >= NVME_VS(1, 1, 0) && |
3406 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { | 3410 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { |
@@ -3409,6 +3413,7 @@ static void nvme_scan_work(struct work_struct *work) | |||
3409 | } | 3413 | } |
3410 | nvme_scan_ns_sequential(ctrl, nn); | 3414 | nvme_scan_ns_sequential(ctrl, nn); |
3411 | out_free_id: | 3415 | out_free_id: |
3416 | mutex_unlock(&ctrl->scan_lock); | ||
3412 | kfree(id); | 3417 | kfree(id); |
3413 | down_write(&ctrl->namespaces_rwsem); | 3418 | down_write(&ctrl->namespaces_rwsem); |
3414 | list_sort(NULL, &ctrl->namespaces, ns_cmp); | 3419 | list_sort(NULL, &ctrl->namespaces, ns_cmp); |
@@ -3652,6 +3657,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, | |||
3652 | 3657 | ||
3653 | ctrl->state = NVME_CTRL_NEW; | 3658 | ctrl->state = NVME_CTRL_NEW; |
3654 | spin_lock_init(&ctrl->lock); | 3659 | spin_lock_init(&ctrl->lock); |
3660 | mutex_init(&ctrl->scan_lock); | ||
3655 | INIT_LIST_HEAD(&ctrl->namespaces); | 3661 | INIT_LIST_HEAD(&ctrl->namespaces); |
3656 | init_rwsem(&ctrl->namespaces_rwsem); | 3662 | init_rwsem(&ctrl->namespaces_rwsem); |
3657 | ctrl->dev = dev; | 3663 | ctrl->dev = dev; |
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index ab961bdeea89..c4a1bb41abf0 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h | |||
@@ -154,6 +154,7 @@ struct nvme_ctrl { | |||
154 | enum nvme_ctrl_state state; | 154 | enum nvme_ctrl_state state; |
155 | bool identified; | 155 | bool identified; |
156 | spinlock_t lock; | 156 | spinlock_t lock; |
157 | struct mutex scan_lock; | ||
157 | const struct nvme_ctrl_ops *ops; | 158 | const struct nvme_ctrl_ops *ops; |
158 | struct request_queue *admin_q; | 159 | struct request_queue *admin_q; |
159 | struct request_queue *connect_q; | 160 | struct request_queue *connect_q; |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 9bc585415d9b..7fee665ec45e 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -2557,27 +2557,18 @@ static void nvme_reset_work(struct work_struct *work) | |||
2557 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) | 2557 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) |
2558 | nvme_dev_disable(dev, false); | 2558 | nvme_dev_disable(dev, false); |
2559 | 2559 | ||
2560 | /* | 2560 | mutex_lock(&dev->shutdown_lock); |
2561 | * Introduce CONNECTING state from nvme-fc/rdma transports to mark the | ||
2562 | * initializing procedure here. | ||
2563 | */ | ||
2564 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { | ||
2565 | dev_warn(dev->ctrl.device, | ||
2566 | "failed to mark controller CONNECTING\n"); | ||
2567 | goto out; | ||
2568 | } | ||
2569 | |||
2570 | result = nvme_pci_enable(dev); | 2561 | result = nvme_pci_enable(dev); |
2571 | if (result) | 2562 | if (result) |
2572 | goto out; | 2563 | goto out_unlock; |
2573 | 2564 | ||
2574 | result = nvme_pci_configure_admin_queue(dev); | 2565 | result = nvme_pci_configure_admin_queue(dev); |
2575 | if (result) | 2566 | if (result) |
2576 | goto out; | 2567 | goto out_unlock; |
2577 | 2568 | ||
2578 | result = nvme_alloc_admin_tags(dev); | 2569 | result = nvme_alloc_admin_tags(dev); |
2579 | if (result) | 2570 | if (result) |
2580 | goto out; | 2571 | goto out_unlock; |
2581 | 2572 | ||
2582 | /* | 2573 | /* |
2583 | * Limit the max command size to prevent iod->sg allocations going | 2574 | * Limit the max command size to prevent iod->sg allocations going |
@@ -2585,6 +2576,17 @@ static void nvme_reset_work(struct work_struct *work) | |||
2585 | */ | 2576 | */ |
2586 | dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; | 2577 | dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; |
2587 | dev->ctrl.max_segments = NVME_MAX_SEGS; | 2578 | dev->ctrl.max_segments = NVME_MAX_SEGS; |
2579 | mutex_unlock(&dev->shutdown_lock); | ||
2580 | |||
2581 | /* | ||
2582 | * Introduce CONNECTING state from nvme-fc/rdma transports to mark the | ||
2583 | * initializing procedure here. | ||
2584 | */ | ||
2585 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { | ||
2586 | dev_warn(dev->ctrl.device, | ||
2587 | "failed to mark controller CONNECTING\n"); | ||
2588 | goto out; | ||
2589 | } | ||
2588 | 2590 | ||
2589 | result = nvme_init_identify(&dev->ctrl); | 2591 | result = nvme_init_identify(&dev->ctrl); |
2590 | if (result) | 2592 | if (result) |
@@ -2649,6 +2651,8 @@ static void nvme_reset_work(struct work_struct *work) | |||
2649 | nvme_start_ctrl(&dev->ctrl); | 2651 | nvme_start_ctrl(&dev->ctrl); |
2650 | return; | 2652 | return; |
2651 | 2653 | ||
2654 | out_unlock: | ||
2655 | mutex_unlock(&dev->shutdown_lock); | ||
2652 | out: | 2656 | out: |
2653 | nvme_remove_dead_ctrl(dev, result); | 2657 | nvme_remove_dead_ctrl(dev, result); |
2654 | } | 2658 | } |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b0a413f3f7ca..e2a879e93d86 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -639,8 +639,9 @@ static void quirk_synopsys_haps(struct pci_dev *pdev) | |||
639 | break; | 639 | break; |
640 | } | 640 | } |
641 | } | 641 | } |
642 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_ANY_ID, | 642 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_ANY_ID, |
643 | quirk_synopsys_haps); | 643 | PCI_CLASS_SERIAL_USB_XHCI, 0, |
644 | quirk_synopsys_haps); | ||
644 | 645 | ||
645 | /* | 646 | /* |
646 | * Let's make the southbridge information explicit instead of having to | 647 | * Let's make the southbridge information explicit instead of having to |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 4e7b55a14b1a..6e294b4d3635 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -4469,6 +4469,14 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) | |||
4469 | usrparm.psf_data &= 0x7fffffffULL; | 4469 | usrparm.psf_data &= 0x7fffffffULL; |
4470 | usrparm.rssd_result &= 0x7fffffffULL; | 4470 | usrparm.rssd_result &= 0x7fffffffULL; |
4471 | } | 4471 | } |
4472 | /* at least 2 bytes are accessed and should be allocated */ | ||
4473 | if (usrparm.psf_data_len < 2) { | ||
4474 | DBF_DEV_EVENT(DBF_WARNING, device, | ||
4475 | "Symmetrix ioctl invalid data length %d", | ||
4476 | usrparm.psf_data_len); | ||
4477 | rc = -EINVAL; | ||
4478 | goto out; | ||
4479 | } | ||
4472 | /* alloc I/O data area */ | 4480 | /* alloc I/O data area */ |
4473 | psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); | 4481 | psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); |
4474 | rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA); | 4482 | rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA); |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 48ea0004a56d..5a699746c357 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -248,7 +248,8 @@ static inline int ap_test_config(unsigned int *field, unsigned int nr) | |||
248 | static inline int ap_test_config_card_id(unsigned int id) | 248 | static inline int ap_test_config_card_id(unsigned int id) |
249 | { | 249 | { |
250 | if (!ap_configuration) /* QCI not supported */ | 250 | if (!ap_configuration) /* QCI not supported */ |
251 | return 1; | 251 | /* only ids 0...3F may be probed */ |
252 | return id < 0x40 ? 1 : 0; | ||
252 | return ap_test_config(ap_configuration->apm, id); | 253 | return ap_test_config(ap_configuration->apm, id); |
253 | } | 254 | } |
254 | 255 | ||
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index f83f79b07b50..07efcb9b5b94 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c | |||
@@ -280,7 +280,7 @@ static ssize_t asd_show_dev_rev(struct device *dev, | |||
280 | return snprintf(buf, PAGE_SIZE, "%s\n", | 280 | return snprintf(buf, PAGE_SIZE, "%s\n", |
281 | asd_dev_rev[asd_ha->revision_id]); | 281 | asd_dev_rev[asd_ha->revision_id]); |
282 | } | 282 | } |
283 | static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL); | 283 | static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL); |
284 | 284 | ||
285 | static ssize_t asd_show_dev_bios_build(struct device *dev, | 285 | static ssize_t asd_show_dev_bios_build(struct device *dev, |
286 | struct device_attribute *attr,char *buf) | 286 | struct device_attribute *attr,char *buf) |
@@ -477,7 +477,7 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha) | |||
477 | { | 477 | { |
478 | int err; | 478 | int err; |
479 | 479 | ||
480 | err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision); | 480 | err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
481 | if (err) | 481 | if (err) |
482 | return err; | 482 | return err; |
483 | 483 | ||
@@ -499,13 +499,13 @@ err_update_bios: | |||
499 | err_biosb: | 499 | err_biosb: |
500 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); | 500 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); |
501 | err_rev: | 501 | err_rev: |
502 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); | 502 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
503 | return err; | 503 | return err; |
504 | } | 504 | } |
505 | 505 | ||
506 | static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) | 506 | static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) |
507 | { | 507 | { |
508 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); | 508 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
509 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); | 509 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); |
510 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); | 510 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); |
511 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios); | 511 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios); |
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index bfa13e3b191c..c8bad2c093b8 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c | |||
@@ -3687,6 +3687,7 @@ static int cxlflash_probe(struct pci_dev *pdev, | |||
3687 | host->max_cmd_len = CXLFLASH_MAX_CDB_LEN; | 3687 | host->max_cmd_len = CXLFLASH_MAX_CDB_LEN; |
3688 | 3688 | ||
3689 | cfg = shost_priv(host); | 3689 | cfg = shost_priv(host); |
3690 | cfg->state = STATE_PROBING; | ||
3690 | cfg->host = host; | 3691 | cfg->host = host; |
3691 | rc = alloc_mem(cfg); | 3692 | rc = alloc_mem(cfg); |
3692 | if (rc) { | 3693 | if (rc) { |
@@ -3775,6 +3776,7 @@ out: | |||
3775 | return rc; | 3776 | return rc; |
3776 | 3777 | ||
3777 | out_remove: | 3778 | out_remove: |
3779 | cfg->state = STATE_PROBED; | ||
3778 | cxlflash_remove(pdev); | 3780 | cxlflash_remove(pdev); |
3779 | goto out; | 3781 | goto out; |
3780 | } | 3782 | } |
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 9192a1d9dec6..dfba4921b265 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
@@ -184,7 +184,6 @@ void fc_rport_destroy(struct kref *kref) | |||
184 | struct fc_rport_priv *rdata; | 184 | struct fc_rport_priv *rdata; |
185 | 185 | ||
186 | rdata = container_of(kref, struct fc_rport_priv, kref); | 186 | rdata = container_of(kref, struct fc_rport_priv, kref); |
187 | WARN_ON(!list_empty(&rdata->peers)); | ||
188 | kfree_rcu(rdata, rcu); | 187 | kfree_rcu(rdata, rcu); |
189 | } | 188 | } |
190 | EXPORT_SYMBOL(fc_rport_destroy); | 189 | EXPORT_SYMBOL(fc_rport_destroy); |
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 83365b29a4d8..fff86940388b 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c | |||
@@ -462,12 +462,16 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) | |||
462 | sdkp->device->use_10_for_rw = 0; | 462 | sdkp->device->use_10_for_rw = 0; |
463 | 463 | ||
464 | /* | 464 | /* |
465 | * If something changed, revalidate the disk zone bitmaps once we have | 465 | * Revalidate the disk zone bitmaps once the block device capacity is |
466 | * the capacity, that is on the second revalidate execution during disk | 466 | * set on the second revalidate execution during disk scan and if |
467 | * scan and always during normal revalidate. | 467 | * something changed when executing a normal revalidate. |
468 | */ | 468 | */ |
469 | if (sdkp->first_scan) | 469 | if (sdkp->first_scan) { |
470 | sdkp->zone_blocks = zone_blocks; | ||
471 | sdkp->nr_zones = nr_zones; | ||
470 | return 0; | 472 | return 0; |
473 | } | ||
474 | |||
471 | if (sdkp->zone_blocks != zone_blocks || | 475 | if (sdkp->zone_blocks != zone_blocks || |
472 | sdkp->nr_zones != nr_zones || | 476 | sdkp->nr_zones != nr_zones || |
473 | disk->queue->nr_zones != nr_zones) { | 477 | disk->queue->nr_zones != nr_zones) { |
diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 52c153cd795a..636f83f781f5 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c | |||
@@ -1143,18 +1143,19 @@ static void qm_mr_process_task(struct work_struct *work); | |||
1143 | static irqreturn_t portal_isr(int irq, void *ptr) | 1143 | static irqreturn_t portal_isr(int irq, void *ptr) |
1144 | { | 1144 | { |
1145 | struct qman_portal *p = ptr; | 1145 | struct qman_portal *p = ptr; |
1146 | |||
1147 | u32 clear = QM_DQAVAIL_MASK | p->irq_sources; | ||
1148 | u32 is = qm_in(&p->p, QM_REG_ISR) & p->irq_sources; | 1146 | u32 is = qm_in(&p->p, QM_REG_ISR) & p->irq_sources; |
1147 | u32 clear = 0; | ||
1149 | 1148 | ||
1150 | if (unlikely(!is)) | 1149 | if (unlikely(!is)) |
1151 | return IRQ_NONE; | 1150 | return IRQ_NONE; |
1152 | 1151 | ||
1153 | /* DQRR-handling if it's interrupt-driven */ | 1152 | /* DQRR-handling if it's interrupt-driven */ |
1154 | if (is & QM_PIRQ_DQRI) | 1153 | if (is & QM_PIRQ_DQRI) { |
1155 | __poll_portal_fast(p, QMAN_POLL_LIMIT); | 1154 | __poll_portal_fast(p, QMAN_POLL_LIMIT); |
1155 | clear = QM_DQAVAIL_MASK | QM_PIRQ_DQRI; | ||
1156 | } | ||
1156 | /* Handling of anything else that's interrupt-driven */ | 1157 | /* Handling of anything else that's interrupt-driven */ |
1157 | clear |= __poll_portal_slow(p, is); | 1158 | clear |= __poll_portal_slow(p, is) & QM_PIRQ_SLOW; |
1158 | qm_out(&p->p, QM_REG_ISR, clear); | 1159 | qm_out(&p->p, QM_REG_ISR, clear); |
1159 | return IRQ_HANDLED; | 1160 | return IRQ_HANDLED; |
1160 | } | 1161 | } |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 72016d0dfca5..8e7fffbb8802 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -852,6 +852,12 @@ static ssize_t pi_prot_type_store(struct config_item *item, | |||
852 | return count; | 852 | return count; |
853 | } | 853 | } |
854 | 854 | ||
855 | /* always zero, but attr needs to remain RW to avoid userspace breakage */ | ||
856 | static ssize_t pi_prot_format_show(struct config_item *item, char *page) | ||
857 | { | ||
858 | return snprintf(page, PAGE_SIZE, "0\n"); | ||
859 | } | ||
860 | |||
855 | static ssize_t pi_prot_format_store(struct config_item *item, | 861 | static ssize_t pi_prot_format_store(struct config_item *item, |
856 | const char *page, size_t count) | 862 | const char *page, size_t count) |
857 | { | 863 | { |
@@ -1132,7 +1138,7 @@ CONFIGFS_ATTR(, emulate_3pc); | |||
1132 | CONFIGFS_ATTR(, emulate_pr); | 1138 | CONFIGFS_ATTR(, emulate_pr); |
1133 | CONFIGFS_ATTR(, pi_prot_type); | 1139 | CONFIGFS_ATTR(, pi_prot_type); |
1134 | CONFIGFS_ATTR_RO(, hw_pi_prot_type); | 1140 | CONFIGFS_ATTR_RO(, hw_pi_prot_type); |
1135 | CONFIGFS_ATTR_WO(, pi_prot_format); | 1141 | CONFIGFS_ATTR(, pi_prot_format); |
1136 | CONFIGFS_ATTR(, pi_prot_verify); | 1142 | CONFIGFS_ATTR(, pi_prot_verify); |
1137 | CONFIGFS_ATTR(, enforce_pr_isids); | 1143 | CONFIGFS_ATTR(, enforce_pr_isids); |
1138 | CONFIGFS_ATTR(, is_nonrot); | 1144 | CONFIGFS_ATTR(, is_nonrot); |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index dfd23245f778..6fff16113628 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -774,7 +774,7 @@ of_cpufreq_cooling_register(struct cpufreq_policy *policy) | |||
774 | 774 | ||
775 | cdev = __cpufreq_cooling_register(np, policy, capacitance); | 775 | cdev = __cpufreq_cooling_register(np, policy, capacitance); |
776 | if (IS_ERR(cdev)) { | 776 | if (IS_ERR(cdev)) { |
777 | pr_err("cpu_cooling: cpu%d is not running as cooling device: %ld\n", | 777 | pr_err("cpu_cooling: cpu%d failed to register as cooling device: %ld\n", |
778 | policy->cpu, PTR_ERR(cdev)); | 778 | policy->cpu, PTR_ERR(cdev)); |
779 | cdev = NULL; | 779 | cdev = NULL; |
780 | } | 780 | } |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 4bfdb4a1e47d..2df059cc07e2 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -867,14 +867,14 @@ __init *thermal_of_build_thermal_zone(struct device_node *np) | |||
867 | 867 | ||
868 | ret = of_property_read_u32(np, "polling-delay-passive", &prop); | 868 | ret = of_property_read_u32(np, "polling-delay-passive", &prop); |
869 | if (ret < 0) { | 869 | if (ret < 0) { |
870 | pr_err("missing polling-delay-passive property\n"); | 870 | pr_err("%pOFn: missing polling-delay-passive property\n", np); |
871 | goto free_tz; | 871 | goto free_tz; |
872 | } | 872 | } |
873 | tz->passive_delay = prop; | 873 | tz->passive_delay = prop; |
874 | 874 | ||
875 | ret = of_property_read_u32(np, "polling-delay", &prop); | 875 | ret = of_property_read_u32(np, "polling-delay", &prop); |
876 | if (ret < 0) { | 876 | if (ret < 0) { |
877 | pr_err("missing polling-delay property\n"); | 877 | pr_err("%pOFn: missing polling-delay property\n", np); |
878 | goto free_tz; | 878 | goto free_tz; |
879 | } | 879 | } |
880 | tz->polling_delay = prop; | 880 | tz->polling_delay = prop; |
@@ -1436,6 +1436,7 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb) | |||
1436 | if (unlikely(!req->ki_filp)) | 1436 | if (unlikely(!req->ki_filp)) |
1437 | return -EBADF; | 1437 | return -EBADF; |
1438 | req->ki_complete = aio_complete_rw; | 1438 | req->ki_complete = aio_complete_rw; |
1439 | req->private = NULL; | ||
1439 | req->ki_pos = iocb->aio_offset; | 1440 | req->ki_pos = iocb->aio_offset; |
1440 | req->ki_flags = iocb_flags(req->ki_filp); | 1441 | req->ki_flags = iocb_flags(req->ki_filp); |
1441 | if (iocb->aio_flags & IOCB_FLAG_RESFD) | 1442 | if (iocb->aio_flags & IOCB_FLAG_RESFD) |
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index d0078cbb718b..7cde3f46ad26 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c | |||
@@ -42,14 +42,10 @@ static int load_script(struct linux_binprm *bprm) | |||
42 | fput(bprm->file); | 42 | fput(bprm->file); |
43 | bprm->file = NULL; | 43 | bprm->file = NULL; |
44 | 44 | ||
45 | for (cp = bprm->buf+2;; cp++) { | 45 | bprm->buf[BINPRM_BUF_SIZE - 1] = '\0'; |
46 | if (cp >= bprm->buf + BINPRM_BUF_SIZE) | 46 | if ((cp = strchr(bprm->buf, '\n')) == NULL) |
47 | return -ENOEXEC; | 47 | cp = bprm->buf+BINPRM_BUF_SIZE-1; |
48 | if (!*cp || (*cp == '\n')) | ||
49 | break; | ||
50 | } | ||
51 | *cp = '\0'; | 48 | *cp = '\0'; |
52 | |||
53 | while (cp > bprm->buf) { | 49 | while (cp > bprm->buf) { |
54 | cp--; | 50 | cp--; |
55 | if ((*cp == ' ') || (*cp == '\t')) | 51 | if ((*cp == ' ') || (*cp == '\t')) |
diff --git a/fs/buffer.c b/fs/buffer.c index 52d024bfdbc1..48318fb74938 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -200,6 +200,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) | |||
200 | struct buffer_head *head; | 200 | struct buffer_head *head; |
201 | struct page *page; | 201 | struct page *page; |
202 | int all_mapped = 1; | 202 | int all_mapped = 1; |
203 | static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1); | ||
203 | 204 | ||
204 | index = block >> (PAGE_SHIFT - bd_inode->i_blkbits); | 205 | index = block >> (PAGE_SHIFT - bd_inode->i_blkbits); |
205 | page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); | 206 | page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); |
@@ -227,15 +228,15 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) | |||
227 | * file io on the block device and getblk. It gets dealt with | 228 | * file io on the block device and getblk. It gets dealt with |
228 | * elsewhere, don't buffer_error if we had some unmapped buffers | 229 | * elsewhere, don't buffer_error if we had some unmapped buffers |
229 | */ | 230 | */ |
230 | if (all_mapped) { | 231 | ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE); |
231 | printk("__find_get_block_slow() failed. " | 232 | if (all_mapped && __ratelimit(&last_warned)) { |
232 | "block=%llu, b_blocknr=%llu\n", | 233 | printk("__find_get_block_slow() failed. block=%llu, " |
233 | (unsigned long long)block, | 234 | "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, " |
234 | (unsigned long long)bh->b_blocknr); | 235 | "device %pg blocksize: %d\n", |
235 | printk("b_state=0x%08lx, b_size=%zu\n", | 236 | (unsigned long long)block, |
236 | bh->b_state, bh->b_size); | 237 | (unsigned long long)bh->b_blocknr, |
237 | printk("device %pg blocksize: %d\n", bdev, | 238 | bh->b_state, bh->b_size, bdev, |
238 | 1 << bd_inode->i_blkbits); | 239 | 1 << bd_inode->i_blkbits); |
239 | } | 240 | } |
240 | out_unlock: | 241 | out_unlock: |
241 | spin_unlock(&bd_mapping->private_lock); | 242 | spin_unlock(&bd_mapping->private_lock); |
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 712f00995390..5508baa11bb6 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -116,16 +116,8 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
116 | goto out; | 116 | goto out; |
117 | } | 117 | } |
118 | 118 | ||
119 | ret = file_write_and_wait_range(file, start, end); | ||
120 | if (ret) | ||
121 | return ret; | ||
122 | |||
123 | if (!journal) { | 119 | if (!journal) { |
124 | struct writeback_control wbc = { | 120 | ret = __generic_file_fsync(file, start, end, datasync); |
125 | .sync_mode = WB_SYNC_ALL | ||
126 | }; | ||
127 | |||
128 | ret = ext4_write_inode(inode, &wbc); | ||
129 | if (!ret) | 121 | if (!ret) |
130 | ret = ext4_sync_parent(inode); | 122 | ret = ext4_sync_parent(inode); |
131 | if (test_opt(inode->i_sb, BARRIER)) | 123 | if (test_opt(inode->i_sb, BARRIER)) |
@@ -133,6 +125,9 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
133 | goto out; | 125 | goto out; |
134 | } | 126 | } |
135 | 127 | ||
128 | ret = file_write_and_wait_range(file, start, end); | ||
129 | if (ret) | ||
130 | return ret; | ||
136 | /* | 131 | /* |
137 | * data=writeback,ordered: | 132 | * data=writeback,ordered: |
138 | * The caller's filemap_fdatawrite()/wait will sync the data. | 133 | * The caller's filemap_fdatawrite()/wait will sync the data. |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index f15b4c57c4bd..78510ab91835 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "util.h" | 28 | #include "util.h" |
29 | #include "trans.h" | 29 | #include "trans.h" |
30 | #include "dir.h" | 30 | #include "dir.h" |
31 | #include "lops.h" | ||
32 | 31 | ||
33 | struct workqueue_struct *gfs2_freeze_wq; | 32 | struct workqueue_struct *gfs2_freeze_wq; |
34 | 33 | ||
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 5bfaf381921a..b8830fda51e8 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -733,7 +733,7 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, | |||
733 | lh->lh_crc = cpu_to_be32(crc); | 733 | lh->lh_crc = cpu_to_be32(crc); |
734 | 734 | ||
735 | gfs2_log_write(sdp, page, sb->s_blocksize, 0, addr); | 735 | gfs2_log_write(sdp, page, sb->s_blocksize, 0, addr); |
736 | gfs2_log_submit_bio(&sdp->sd_log_bio, REQ_OP_WRITE | op_flags); | 736 | gfs2_log_submit_bio(&sdp->sd_log_bio, REQ_OP_WRITE, op_flags); |
737 | log_flush_wait(sdp); | 737 | log_flush_wait(sdp); |
738 | } | 738 | } |
739 | 739 | ||
@@ -810,7 +810,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) | |||
810 | 810 | ||
811 | gfs2_ordered_write(sdp); | 811 | gfs2_ordered_write(sdp); |
812 | lops_before_commit(sdp, tr); | 812 | lops_before_commit(sdp, tr); |
813 | gfs2_log_submit_bio(&sdp->sd_log_bio, REQ_OP_WRITE); | 813 | gfs2_log_submit_bio(&sdp->sd_log_bio, REQ_OP_WRITE, 0); |
814 | 814 | ||
815 | if (sdp->sd_log_head != sdp->sd_log_flush_head) { | 815 | if (sdp->sd_log_head != sdp->sd_log_flush_head) { |
816 | log_flush_wait(sdp); | 816 | log_flush_wait(sdp); |
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 94dcab655bc0..2295042bc625 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -17,9 +17,7 @@ | |||
17 | #include <linux/bio.h> | 17 | #include <linux/bio.h> |
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/list_sort.h> | 19 | #include <linux/list_sort.h> |
20 | #include <linux/blkdev.h> | ||
21 | 20 | ||
22 | #include "bmap.h" | ||
23 | #include "dir.h" | 21 | #include "dir.h" |
24 | #include "gfs2.h" | 22 | #include "gfs2.h" |
25 | #include "incore.h" | 23 | #include "incore.h" |
@@ -195,6 +193,7 @@ static void gfs2_end_log_write_bh(struct gfs2_sbd *sdp, struct bio_vec *bvec, | |||
195 | /** | 193 | /** |
196 | * gfs2_end_log_write - end of i/o to the log | 194 | * gfs2_end_log_write - end of i/o to the log |
197 | * @bio: The bio | 195 | * @bio: The bio |
196 | * @error: Status of i/o request | ||
198 | * | 197 | * |
199 | * Each bio_vec contains either data from the pagecache or data | 198 | * Each bio_vec contains either data from the pagecache or data |
200 | * relating to the log itself. Here we iterate over the bio_vec | 199 | * relating to the log itself. Here we iterate over the bio_vec |
@@ -231,19 +230,20 @@ static void gfs2_end_log_write(struct bio *bio) | |||
231 | /** | 230 | /** |
232 | * gfs2_log_submit_bio - Submit any pending log bio | 231 | * gfs2_log_submit_bio - Submit any pending log bio |
233 | * @biop: Address of the bio pointer | 232 | * @biop: Address of the bio pointer |
234 | * @opf: REQ_OP | op_flags | 233 | * @op: REQ_OP |
234 | * @op_flags: req_flag_bits | ||
235 | * | 235 | * |
236 | * Submit any pending part-built or full bio to the block device. If | 236 | * Submit any pending part-built or full bio to the block device. If |
237 | * there is no pending bio, then this is a no-op. | 237 | * there is no pending bio, then this is a no-op. |
238 | */ | 238 | */ |
239 | 239 | ||
240 | void gfs2_log_submit_bio(struct bio **biop, int opf) | 240 | void gfs2_log_submit_bio(struct bio **biop, int op, int op_flags) |
241 | { | 241 | { |
242 | struct bio *bio = *biop; | 242 | struct bio *bio = *biop; |
243 | if (bio) { | 243 | if (bio) { |
244 | struct gfs2_sbd *sdp = bio->bi_private; | 244 | struct gfs2_sbd *sdp = bio->bi_private; |
245 | atomic_inc(&sdp->sd_log_in_flight); | 245 | atomic_inc(&sdp->sd_log_in_flight); |
246 | bio->bi_opf = opf; | 246 | bio_set_op_attrs(bio, op, op_flags); |
247 | submit_bio(bio); | 247 | submit_bio(bio); |
248 | *biop = NULL; | 248 | *biop = NULL; |
249 | } | 249 | } |
@@ -304,7 +304,7 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno, | |||
304 | nblk >>= sdp->sd_fsb2bb_shift; | 304 | nblk >>= sdp->sd_fsb2bb_shift; |
305 | if (blkno == nblk && !flush) | 305 | if (blkno == nblk && !flush) |
306 | return bio; | 306 | return bio; |
307 | gfs2_log_submit_bio(biop, op); | 307 | gfs2_log_submit_bio(biop, op, 0); |
308 | } | 308 | } |
309 | 309 | ||
310 | *biop = gfs2_log_alloc_bio(sdp, blkno, end_io); | 310 | *biop = gfs2_log_alloc_bio(sdp, blkno, end_io); |
@@ -375,184 +375,6 @@ void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page) | |||
375 | gfs2_log_bmap(sdp)); | 375 | gfs2_log_bmap(sdp)); |
376 | } | 376 | } |
377 | 377 | ||
378 | /** | ||
379 | * gfs2_end_log_read - end I/O callback for reads from the log | ||
380 | * @bio: The bio | ||
381 | * | ||
382 | * Simply unlock the pages in the bio. The main thread will wait on them and | ||
383 | * process them in order as necessary. | ||
384 | */ | ||
385 | |||
386 | static void gfs2_end_log_read(struct bio *bio) | ||
387 | { | ||
388 | struct page *page; | ||
389 | struct bio_vec *bvec; | ||
390 | int i; | ||
391 | |||
392 | bio_for_each_segment_all(bvec, bio, i) { | ||
393 | page = bvec->bv_page; | ||
394 | if (bio->bi_status) { | ||
395 | int err = blk_status_to_errno(bio->bi_status); | ||
396 | |||
397 | SetPageError(page); | ||
398 | mapping_set_error(page->mapping, err); | ||
399 | } | ||
400 | unlock_page(page); | ||
401 | } | ||
402 | |||
403 | bio_put(bio); | ||
404 | } | ||
405 | |||
406 | /** | ||
407 | * gfs2_jhead_pg_srch - Look for the journal head in a given page. | ||
408 | * @jd: The journal descriptor | ||
409 | * @page: The page to look in | ||
410 | * | ||
411 | * Returns: 1 if found, 0 otherwise. | ||
412 | */ | ||
413 | |||
414 | static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd, | ||
415 | struct gfs2_log_header_host *head, | ||
416 | struct page *page) | ||
417 | { | ||
418 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); | ||
419 | struct gfs2_log_header_host uninitialized_var(lh); | ||
420 | void *kaddr = kmap_atomic(page); | ||
421 | unsigned int offset; | ||
422 | bool ret = false; | ||
423 | |||
424 | for (offset = 0; offset < PAGE_SIZE; offset += sdp->sd_sb.sb_bsize) { | ||
425 | if (!__get_log_header(sdp, kaddr + offset, 0, &lh)) { | ||
426 | if (lh.lh_sequence > head->lh_sequence) | ||
427 | *head = lh; | ||
428 | else { | ||
429 | ret = true; | ||
430 | break; | ||
431 | } | ||
432 | } | ||
433 | } | ||
434 | kunmap_atomic(kaddr); | ||
435 | return ret; | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * gfs2_jhead_process_page - Search/cleanup a page | ||
440 | * @jd: The journal descriptor | ||
441 | * @index: Index of the page to look into | ||
442 | * @done: If set, perform only cleanup, else search and set if found. | ||
443 | * | ||
444 | * Find the page with 'index' in the journal's mapping. Search the page for | ||
445 | * the journal head if requested (cleanup == false). Release refs on the | ||
446 | * page so the page cache can reclaim it (put_page() twice). We grabbed a | ||
447 | * reference on this page two times, first when we did a find_or_create_page() | ||
448 | * to obtain the page to add it to the bio and second when we do a | ||
449 | * find_get_page() here to get the page to wait on while I/O on it is being | ||
450 | * completed. | ||
451 | * This function is also used to free up a page we might've grabbed but not | ||
452 | * used. Maybe we added it to a bio, but not submitted it for I/O. Or we | ||
453 | * submitted the I/O, but we already found the jhead so we only need to drop | ||
454 | * our references to the page. | ||
455 | */ | ||
456 | |||
457 | static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index, | ||
458 | struct gfs2_log_header_host *head, | ||
459 | bool *done) | ||
460 | { | ||
461 | struct page *page; | ||
462 | |||
463 | page = find_get_page(jd->jd_inode->i_mapping, index); | ||
464 | wait_on_page_locked(page); | ||
465 | |||
466 | if (PageError(page)) | ||
467 | *done = true; | ||
468 | |||
469 | if (!*done) | ||
470 | *done = gfs2_jhead_pg_srch(jd, head, page); | ||
471 | |||
472 | put_page(page); /* Once for find_get_page */ | ||
473 | put_page(page); /* Once more for find_or_create_page */ | ||
474 | } | ||
475 | |||
476 | /** | ||
477 | * gfs2_find_jhead - find the head of a log | ||
478 | * @jd: The journal descriptor | ||
479 | * @head: The log descriptor for the head of the log is returned here | ||
480 | * | ||
481 | * Do a search of a journal by reading it in large chunks using bios and find | ||
482 | * the valid log entry with the highest sequence number. (i.e. the log head) | ||
483 | * | ||
484 | * Returns: 0 on success, errno otherwise | ||
485 | */ | ||
486 | |||
487 | int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) | ||
488 | { | ||
489 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); | ||
490 | struct address_space *mapping = jd->jd_inode->i_mapping; | ||
491 | struct gfs2_journal_extent *je; | ||
492 | u32 block, read_idx = 0, submit_idx = 0, index = 0; | ||
493 | int shift = PAGE_SHIFT - sdp->sd_sb.sb_bsize_shift; | ||
494 | int blocks_per_page = 1 << shift, sz, ret = 0; | ||
495 | struct bio *bio = NULL; | ||
496 | struct page *page; | ||
497 | bool done = false; | ||
498 | errseq_t since; | ||
499 | |||
500 | memset(head, 0, sizeof(*head)); | ||
501 | if (list_empty(&jd->extent_list)) | ||
502 | gfs2_map_journal_extents(sdp, jd); | ||
503 | |||
504 | since = filemap_sample_wb_err(mapping); | ||
505 | list_for_each_entry(je, &jd->extent_list, list) { | ||
506 | for (block = 0; block < je->blocks; block += blocks_per_page) { | ||
507 | index = (je->lblock + block) >> shift; | ||
508 | |||
509 | page = find_or_create_page(mapping, index, GFP_NOFS); | ||
510 | if (!page) { | ||
511 | ret = -ENOMEM; | ||
512 | done = true; | ||
513 | goto out; | ||
514 | } | ||
515 | |||
516 | if (bio) { | ||
517 | sz = bio_add_page(bio, page, PAGE_SIZE, 0); | ||
518 | if (sz == PAGE_SIZE) | ||
519 | goto page_added; | ||
520 | submit_idx = index; | ||
521 | submit_bio(bio); | ||
522 | bio = NULL; | ||
523 | } | ||
524 | |||
525 | bio = gfs2_log_alloc_bio(sdp, | ||
526 | je->dblock + (index << shift), | ||
527 | gfs2_end_log_read); | ||
528 | bio->bi_opf = REQ_OP_READ; | ||
529 | sz = bio_add_page(bio, page, PAGE_SIZE, 0); | ||
530 | gfs2_assert_warn(sdp, sz == PAGE_SIZE); | ||
531 | |||
532 | page_added: | ||
533 | if (submit_idx <= read_idx + BIO_MAX_PAGES) { | ||
534 | /* Keep at least one bio in flight */ | ||
535 | continue; | ||
536 | } | ||
537 | |||
538 | gfs2_jhead_process_page(jd, read_idx++, head, &done); | ||
539 | if (done) | ||
540 | goto out; /* found */ | ||
541 | } | ||
542 | } | ||
543 | |||
544 | out: | ||
545 | if (bio) | ||
546 | submit_bio(bio); | ||
547 | while (read_idx <= index) | ||
548 | gfs2_jhead_process_page(jd, read_idx++, head, &done); | ||
549 | |||
550 | if (!ret) | ||
551 | ret = filemap_check_wb_err(mapping, since); | ||
552 | |||
553 | return ret; | ||
554 | } | ||
555 | |||
556 | static struct page *gfs2_get_log_desc(struct gfs2_sbd *sdp, u32 ld_type, | 378 | static struct page *gfs2_get_log_desc(struct gfs2_sbd *sdp, u32 ld_type, |
557 | u32 ld_length, u32 ld_data1) | 379 | u32 ld_length, u32 ld_data1) |
558 | { | 380 | { |
diff --git a/fs/gfs2/lops.h b/fs/gfs2/lops.h index 331160fc568b..711c4d89c063 100644 --- a/fs/gfs2/lops.h +++ b/fs/gfs2/lops.h | |||
@@ -30,10 +30,8 @@ extern u64 gfs2_log_bmap(struct gfs2_sbd *sdp); | |||
30 | extern void gfs2_log_write(struct gfs2_sbd *sdp, struct page *page, | 30 | extern void gfs2_log_write(struct gfs2_sbd *sdp, struct page *page, |
31 | unsigned size, unsigned offset, u64 blkno); | 31 | unsigned size, unsigned offset, u64 blkno); |
32 | extern void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page); | 32 | extern void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page); |
33 | extern void gfs2_log_submit_bio(struct bio **biop, int opf); | 33 | extern void gfs2_log_submit_bio(struct bio **biop, int op, int op_flags); |
34 | extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); | 34 | extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); |
35 | extern int gfs2_find_jhead(struct gfs2_jdesc *jd, | ||
36 | struct gfs2_log_header_host *head); | ||
37 | 35 | ||
38 | static inline unsigned int buf_limit(struct gfs2_sbd *sdp) | 36 | static inline unsigned int buf_limit(struct gfs2_sbd *sdp) |
39 | { | 37 | { |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 1179763f6370..b041cb8ae383 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include "dir.h" | 41 | #include "dir.h" |
42 | #include "meta_io.h" | 42 | #include "meta_io.h" |
43 | #include "trace_gfs2.h" | 43 | #include "trace_gfs2.h" |
44 | #include "lops.h" | ||
45 | 44 | ||
46 | #define DO 0 | 45 | #define DO 0 |
47 | #define UNDO 1 | 46 | #define UNDO 1 |
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index 7389e445a7a7..2dac43065382 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -182,6 +182,129 @@ static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, | |||
182 | } | 182 | } |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * find_good_lh - find a good log header | ||
186 | * @jd: the journal | ||
187 | * @blk: the segment to start searching from | ||
188 | * @lh: the log header to fill in | ||
189 | * @forward: if true search forward in the log, else search backward | ||
190 | * | ||
191 | * Call get_log_header() to get a log header for a segment, but if the | ||
192 | * segment is bad, either scan forward or backward until we find a good one. | ||
193 | * | ||
194 | * Returns: errno | ||
195 | */ | ||
196 | |||
197 | static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk, | ||
198 | struct gfs2_log_header_host *head) | ||
199 | { | ||
200 | unsigned int orig_blk = *blk; | ||
201 | int error; | ||
202 | |||
203 | for (;;) { | ||
204 | error = get_log_header(jd, *blk, head); | ||
205 | if (error <= 0) | ||
206 | return error; | ||
207 | |||
208 | if (++*blk == jd->jd_blocks) | ||
209 | *blk = 0; | ||
210 | |||
211 | if (*blk == orig_blk) { | ||
212 | gfs2_consist_inode(GFS2_I(jd->jd_inode)); | ||
213 | return -EIO; | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * jhead_scan - make sure we've found the head of the log | ||
220 | * @jd: the journal | ||
221 | * @head: this is filled in with the log descriptor of the head | ||
222 | * | ||
223 | * At this point, seg and lh should be either the head of the log or just | ||
224 | * before. Scan forward until we find the head. | ||
225 | * | ||
226 | * Returns: errno | ||
227 | */ | ||
228 | |||
229 | static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) | ||
230 | { | ||
231 | unsigned int blk = head->lh_blkno; | ||
232 | struct gfs2_log_header_host lh; | ||
233 | int error; | ||
234 | |||
235 | for (;;) { | ||
236 | if (++blk == jd->jd_blocks) | ||
237 | blk = 0; | ||
238 | |||
239 | error = get_log_header(jd, blk, &lh); | ||
240 | if (error < 0) | ||
241 | return error; | ||
242 | if (error == 1) | ||
243 | continue; | ||
244 | |||
245 | if (lh.lh_sequence == head->lh_sequence) { | ||
246 | gfs2_consist_inode(GFS2_I(jd->jd_inode)); | ||
247 | return -EIO; | ||
248 | } | ||
249 | if (lh.lh_sequence < head->lh_sequence) | ||
250 | break; | ||
251 | |||
252 | *head = lh; | ||
253 | } | ||
254 | |||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | /** | ||
259 | * gfs2_find_jhead - find the head of a log | ||
260 | * @jd: the journal | ||
261 | * @head: the log descriptor for the head of the log is returned here | ||
262 | * | ||
263 | * Do a binary search of a journal and find the valid log entry with the | ||
264 | * highest sequence number. (i.e. the log head) | ||
265 | * | ||
266 | * Returns: errno | ||
267 | */ | ||
268 | |||
269 | int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) | ||
270 | { | ||
271 | struct gfs2_log_header_host lh_1, lh_m; | ||
272 | u32 blk_1, blk_2, blk_m; | ||
273 | int error; | ||
274 | |||
275 | blk_1 = 0; | ||
276 | blk_2 = jd->jd_blocks - 1; | ||
277 | |||
278 | for (;;) { | ||
279 | blk_m = (blk_1 + blk_2) / 2; | ||
280 | |||
281 | error = find_good_lh(jd, &blk_1, &lh_1); | ||
282 | if (error) | ||
283 | return error; | ||
284 | |||
285 | error = find_good_lh(jd, &blk_m, &lh_m); | ||
286 | if (error) | ||
287 | return error; | ||
288 | |||
289 | if (blk_1 == blk_m || blk_m == blk_2) | ||
290 | break; | ||
291 | |||
292 | if (lh_1.lh_sequence <= lh_m.lh_sequence) | ||
293 | blk_1 = blk_m; | ||
294 | else | ||
295 | blk_2 = blk_m; | ||
296 | } | ||
297 | |||
298 | error = jhead_scan(jd, &lh_1); | ||
299 | if (error) | ||
300 | return error; | ||
301 | |||
302 | *head = lh_1; | ||
303 | |||
304 | return error; | ||
305 | } | ||
306 | |||
307 | /** | ||
185 | * foreach_descriptor - go through the active part of the log | 308 | * foreach_descriptor - go through the active part of the log |
186 | * @jd: the journal | 309 | * @jd: the journal |
187 | * @start: the first log header in the active region | 310 | * @start: the first log header in the active region |
diff --git a/fs/gfs2/recovery.h b/fs/gfs2/recovery.h index 99575ab81202..11d81248be85 100644 --- a/fs/gfs2/recovery.h +++ b/fs/gfs2/recovery.h | |||
@@ -27,6 +27,8 @@ extern int gfs2_revoke_add(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) | |||
27 | extern int gfs2_revoke_check(struct gfs2_jdesc *jd, u64 blkno, unsigned int where); | 27 | extern int gfs2_revoke_check(struct gfs2_jdesc *jd, u64 blkno, unsigned int where); |
28 | extern void gfs2_revoke_clean(struct gfs2_jdesc *jd); | 28 | extern void gfs2_revoke_clean(struct gfs2_jdesc *jd); |
29 | 29 | ||
30 | extern int gfs2_find_jhead(struct gfs2_jdesc *jd, | ||
31 | struct gfs2_log_header_host *head); | ||
30 | extern int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd, bool wait); | 32 | extern int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd, bool wait); |
31 | extern void gfs2_recover_func(struct work_struct *work); | 33 | extern void gfs2_recover_func(struct work_struct *work); |
32 | extern int __get_log_header(struct gfs2_sbd *sdp, | 34 | extern int __get_log_header(struct gfs2_sbd *sdp, |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index d4b11c903971..ca71163ff7cf 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include "util.h" | 45 | #include "util.h" |
46 | #include "sys.h" | 46 | #include "sys.h" |
47 | #include "xattr.h" | 47 | #include "xattr.h" |
48 | #include "lops.h" | ||
49 | 48 | ||
50 | #define args_neq(a1, a2, x) ((a1)->ar_##x != (a2)->ar_##x) | 49 | #define args_neq(a1, a2, x) ((a1)->ar_##x != (a2)->ar_##x) |
51 | 50 | ||
diff --git a/fs/inode.c b/fs/inode.c index 0cd47fe0dbe5..73432e64f874 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -730,11 +730,8 @@ static enum lru_status inode_lru_isolate(struct list_head *item, | |||
730 | return LRU_REMOVED; | 730 | return LRU_REMOVED; |
731 | } | 731 | } |
732 | 732 | ||
733 | /* | 733 | /* recently referenced inodes get one more pass */ |
734 | * Recently referenced inodes and inodes with many attached pages | 734 | if (inode->i_state & I_REFERENCED) { |
735 | * get one more pass. | ||
736 | */ | ||
737 | if (inode->i_state & I_REFERENCED || inode->i_data.nrpages > 1) { | ||
738 | inode->i_state &= ~I_REFERENCED; | 735 | inode->i_state &= ~I_REFERENCED; |
739 | spin_unlock(&inode->i_lock); | 736 | spin_unlock(&inode->i_lock); |
740 | return LRU_ROTATE; | 737 | return LRU_ROTATE; |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index f0ec9edab2f3..85b0ef890b28 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -423,7 +423,7 @@ struct mem_size_stats { | |||
423 | }; | 423 | }; |
424 | 424 | ||
425 | static void smaps_account(struct mem_size_stats *mss, struct page *page, | 425 | static void smaps_account(struct mem_size_stats *mss, struct page *page, |
426 | bool compound, bool young, bool dirty) | 426 | bool compound, bool young, bool dirty, bool locked) |
427 | { | 427 | { |
428 | int i, nr = compound ? 1 << compound_order(page) : 1; | 428 | int i, nr = compound ? 1 << compound_order(page) : 1; |
429 | unsigned long size = nr * PAGE_SIZE; | 429 | unsigned long size = nr * PAGE_SIZE; |
@@ -450,24 +450,31 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, | |||
450 | else | 450 | else |
451 | mss->private_clean += size; | 451 | mss->private_clean += size; |
452 | mss->pss += (u64)size << PSS_SHIFT; | 452 | mss->pss += (u64)size << PSS_SHIFT; |
453 | if (locked) | ||
454 | mss->pss_locked += (u64)size << PSS_SHIFT; | ||
453 | return; | 455 | return; |
454 | } | 456 | } |
455 | 457 | ||
456 | for (i = 0; i < nr; i++, page++) { | 458 | for (i = 0; i < nr; i++, page++) { |
457 | int mapcount = page_mapcount(page); | 459 | int mapcount = page_mapcount(page); |
460 | unsigned long pss = (PAGE_SIZE << PSS_SHIFT); | ||
458 | 461 | ||
459 | if (mapcount >= 2) { | 462 | if (mapcount >= 2) { |
460 | if (dirty || PageDirty(page)) | 463 | if (dirty || PageDirty(page)) |
461 | mss->shared_dirty += PAGE_SIZE; | 464 | mss->shared_dirty += PAGE_SIZE; |
462 | else | 465 | else |
463 | mss->shared_clean += PAGE_SIZE; | 466 | mss->shared_clean += PAGE_SIZE; |
464 | mss->pss += (PAGE_SIZE << PSS_SHIFT) / mapcount; | 467 | mss->pss += pss / mapcount; |
468 | if (locked) | ||
469 | mss->pss_locked += pss / mapcount; | ||
465 | } else { | 470 | } else { |
466 | if (dirty || PageDirty(page)) | 471 | if (dirty || PageDirty(page)) |
467 | mss->private_dirty += PAGE_SIZE; | 472 | mss->private_dirty += PAGE_SIZE; |
468 | else | 473 | else |
469 | mss->private_clean += PAGE_SIZE; | 474 | mss->private_clean += PAGE_SIZE; |
470 | mss->pss += PAGE_SIZE << PSS_SHIFT; | 475 | mss->pss += pss; |
476 | if (locked) | ||
477 | mss->pss_locked += pss; | ||
471 | } | 478 | } |
472 | } | 479 | } |
473 | } | 480 | } |
@@ -490,6 +497,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, | |||
490 | { | 497 | { |
491 | struct mem_size_stats *mss = walk->private; | 498 | struct mem_size_stats *mss = walk->private; |
492 | struct vm_area_struct *vma = walk->vma; | 499 | struct vm_area_struct *vma = walk->vma; |
500 | bool locked = !!(vma->vm_flags & VM_LOCKED); | ||
493 | struct page *page = NULL; | 501 | struct page *page = NULL; |
494 | 502 | ||
495 | if (pte_present(*pte)) { | 503 | if (pte_present(*pte)) { |
@@ -532,7 +540,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, | |||
532 | if (!page) | 540 | if (!page) |
533 | return; | 541 | return; |
534 | 542 | ||
535 | smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte)); | 543 | smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte), locked); |
536 | } | 544 | } |
537 | 545 | ||
538 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 546 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
@@ -541,6 +549,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, | |||
541 | { | 549 | { |
542 | struct mem_size_stats *mss = walk->private; | 550 | struct mem_size_stats *mss = walk->private; |
543 | struct vm_area_struct *vma = walk->vma; | 551 | struct vm_area_struct *vma = walk->vma; |
552 | bool locked = !!(vma->vm_flags & VM_LOCKED); | ||
544 | struct page *page; | 553 | struct page *page; |
545 | 554 | ||
546 | /* FOLL_DUMP will return -EFAULT on huge zero page */ | 555 | /* FOLL_DUMP will return -EFAULT on huge zero page */ |
@@ -555,7 +564,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, | |||
555 | /* pass */; | 564 | /* pass */; |
556 | else | 565 | else |
557 | VM_BUG_ON_PAGE(1, page); | 566 | VM_BUG_ON_PAGE(1, page); |
558 | smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd)); | 567 | smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), locked); |
559 | } | 568 | } |
560 | #else | 569 | #else |
561 | static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, | 570 | static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
@@ -737,11 +746,8 @@ static void smap_gather_stats(struct vm_area_struct *vma, | |||
737 | } | 746 | } |
738 | } | 747 | } |
739 | #endif | 748 | #endif |
740 | |||
741 | /* mmap_sem is held in m_start */ | 749 | /* mmap_sem is held in m_start */ |
742 | walk_page_vma(vma, &smaps_walk); | 750 | walk_page_vma(vma, &smaps_walk); |
743 | if (vma->vm_flags & VM_LOCKED) | ||
744 | mss->pss_locked += mss->pss; | ||
745 | } | 751 | } |
746 | 752 | ||
747 | #define SEQ_PUT_DEC(str, val) \ | 753 | #define SEQ_PUT_DEC(str, val) \ |
diff --git a/include/uapi/asm-generic/shmparam.h b/include/asm-generic/shmparam.h index 8b78c0ba08b1..8b78c0ba08b1 100644 --- a/include/uapi/asm-generic/shmparam.h +++ b/include/asm-generic/shmparam.h | |||
diff --git a/include/dt-bindings/clock/imx8mq-clock.h b/include/dt-bindings/clock/imx8mq-clock.h index b53be41929be..04f7ac345984 100644 --- a/include/dt-bindings/clock/imx8mq-clock.h +++ b/include/dt-bindings/clock/imx8mq-clock.h | |||
@@ -350,7 +350,7 @@ | |||
350 | #define IMX8MQ_CLK_VPU_G2_ROOT 241 | 350 | #define IMX8MQ_CLK_VPU_G2_ROOT 241 |
351 | 351 | ||
352 | /* SCCG PLL GATE */ | 352 | /* SCCG PLL GATE */ |
353 | #define IMX8MQ_SYS1_PLL_OUT 232 | 353 | #define IMX8MQ_SYS1_PLL_OUT 242 |
354 | #define IMX8MQ_SYS2_PLL_OUT 243 | 354 | #define IMX8MQ_SYS2_PLL_OUT 243 |
355 | #define IMX8MQ_SYS3_PLL_OUT 244 | 355 | #define IMX8MQ_SYS3_PLL_OUT 244 |
356 | #define IMX8MQ_DRAM_PLL_OUT 245 | 356 | #define IMX8MQ_DRAM_PLL_OUT 245 |
@@ -372,24 +372,24 @@ | |||
372 | /* txesc clock */ | 372 | /* txesc clock */ |
373 | #define IMX8MQ_CLK_DSI_IPG_DIV 256 | 373 | #define IMX8MQ_CLK_DSI_IPG_DIV 256 |
374 | 374 | ||
375 | #define IMX8MQ_CLK_TMU_ROOT 265 | 375 | #define IMX8MQ_CLK_TMU_ROOT 257 |
376 | 376 | ||
377 | /* Display root clocks */ | 377 | /* Display root clocks */ |
378 | #define IMX8MQ_CLK_DISP_AXI_ROOT 266 | 378 | #define IMX8MQ_CLK_DISP_AXI_ROOT 258 |
379 | #define IMX8MQ_CLK_DISP_APB_ROOT 267 | 379 | #define IMX8MQ_CLK_DISP_APB_ROOT 259 |
380 | #define IMX8MQ_CLK_DISP_RTRM_ROOT 268 | 380 | #define IMX8MQ_CLK_DISP_RTRM_ROOT 260 |
381 | 381 | ||
382 | #define IMX8MQ_CLK_OCOTP_ROOT 269 | 382 | #define IMX8MQ_CLK_OCOTP_ROOT 261 |
383 | 383 | ||
384 | #define IMX8MQ_CLK_DRAM_ALT_ROOT 270 | 384 | #define IMX8MQ_CLK_DRAM_ALT_ROOT 262 |
385 | #define IMX8MQ_CLK_DRAM_CORE 271 | 385 | #define IMX8MQ_CLK_DRAM_CORE 263 |
386 | 386 | ||
387 | #define IMX8MQ_CLK_MU_ROOT 272 | 387 | #define IMX8MQ_CLK_MU_ROOT 264 |
388 | #define IMX8MQ_VIDEO2_PLL_OUT 273 | 388 | #define IMX8MQ_VIDEO2_PLL_OUT 265 |
389 | 389 | ||
390 | #define IMX8MQ_CLK_CLKO2 274 | 390 | #define IMX8MQ_CLK_CLKO2 266 |
391 | 391 | ||
392 | #define IMX8MQ_CLK_NAND_USDHC_BUS_RAWNAND_CLK 275 | 392 | #define IMX8MQ_CLK_NAND_USDHC_BUS_RAWNAND_CLK 267 |
393 | 393 | ||
394 | #define IMX8MQ_CLK_END 276 | 394 | #define IMX8MQ_CLK_END 268 |
395 | #endif /* __DT_BINDINGS_CLOCK_IMX8MQ_H */ | 395 | #endif /* __DT_BINDINGS_CLOCK_IMX8MQ_H */ |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 8804753805ac..7bb2d8de9f30 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -116,7 +116,13 @@ extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes); | |||
116 | 116 | ||
117 | static inline sector_t blk_rq_trace_sector(struct request *rq) | 117 | static inline sector_t blk_rq_trace_sector(struct request *rq) |
118 | { | 118 | { |
119 | return blk_rq_is_passthrough(rq) ? 0 : blk_rq_pos(rq); | 119 | /* |
120 | * Tracing should ignore starting sector for passthrough requests and | ||
121 | * requests where starting sector didn't get set. | ||
122 | */ | ||
123 | if (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1) | ||
124 | return 0; | ||
125 | return blk_rq_pos(rq); | ||
120 | } | 126 | } |
121 | 127 | ||
122 | static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq) | 128 | static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq) |
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 071b4cbdf010..c848a7cc502e 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h | |||
@@ -319,7 +319,7 @@ | |||
319 | #define GITS_TYPER_PLPIS (1UL << 0) | 319 | #define GITS_TYPER_PLPIS (1UL << 0) |
320 | #define GITS_TYPER_VLPIS (1UL << 1) | 320 | #define GITS_TYPER_VLPIS (1UL << 1) |
321 | #define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4 | 321 | #define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4 |
322 | #define GITS_TYPER_ITT_ENTRY_SIZE(r) ((((r) >> GITS_TYPER_ITT_ENTRY_SIZE_SHIFT) & 0x1f) + 1) | 322 | #define GITS_TYPER_ITT_ENTRY_SIZE(r) ((((r) >> GITS_TYPER_ITT_ENTRY_SIZE_SHIFT) & 0xf) + 1) |
323 | #define GITS_TYPER_IDBITS_SHIFT 8 | 323 | #define GITS_TYPER_IDBITS_SHIFT 8 |
324 | #define GITS_TYPER_DEVBITS_SHIFT 13 | 324 | #define GITS_TYPER_DEVBITS_SHIFT 13 |
325 | #define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1) | 325 | #define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1) |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index de7377815b6b..8ef330027b13 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -308,6 +308,7 @@ struct mmc_card { | |||
308 | unsigned int nr_parts; | 308 | unsigned int nr_parts; |
309 | 309 | ||
310 | unsigned int bouncesz; /* Bounce buffer size */ | 310 | unsigned int bouncesz; /* Bounce buffer size */ |
311 | struct workqueue_struct *complete_wq; /* Private workqueue */ | ||
311 | }; | 312 | }; |
312 | 313 | ||
313 | static inline bool mmc_large_sector(struct mmc_card *card) | 314 | static inline bool mmc_large_sector(struct mmc_card *card) |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 177a330d84e5..bf1070c2a53b 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -676,26 +676,13 @@ size_t phy_speeds(unsigned int *speeds, size_t size, | |||
676 | void of_set_phy_supported(struct phy_device *phydev); | 676 | void of_set_phy_supported(struct phy_device *phydev); |
677 | void of_set_phy_eee_broken(struct phy_device *phydev); | 677 | void of_set_phy_eee_broken(struct phy_device *phydev); |
678 | 678 | ||
679 | static inline bool __phy_is_started(struct phy_device *phydev) | ||
680 | { | ||
681 | WARN_ON(!mutex_is_locked(&phydev->lock)); | ||
682 | |||
683 | return phydev->state >= PHY_UP; | ||
684 | } | ||
685 | |||
686 | /** | 679 | /** |
687 | * phy_is_started - Convenience function to check whether PHY is started | 680 | * phy_is_started - Convenience function to check whether PHY is started |
688 | * @phydev: The phy_device struct | 681 | * @phydev: The phy_device struct |
689 | */ | 682 | */ |
690 | static inline bool phy_is_started(struct phy_device *phydev) | 683 | static inline bool phy_is_started(struct phy_device *phydev) |
691 | { | 684 | { |
692 | bool started; | 685 | return phydev->state >= PHY_UP; |
693 | |||
694 | mutex_lock(&phydev->lock); | ||
695 | started = __phy_is_started(phydev); | ||
696 | mutex_unlock(&phydev->lock); | ||
697 | |||
698 | return started; | ||
699 | } | 686 | } |
700 | 687 | ||
701 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); | 688 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); |
diff --git a/include/linux/signal.h b/include/linux/signal.h index cc7e2c1cd444..9702016734b1 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -392,7 +392,7 @@ extern bool unhandled_signal(struct task_struct *tsk, int sig); | |||
392 | #endif | 392 | #endif |
393 | 393 | ||
394 | #define siginmask(sig, mask) \ | 394 | #define siginmask(sig, mask) \ |
395 | ((sig) < SIGRTMIN && (rt_sigmask(sig) & (mask))) | 395 | ((sig) > 0 && (sig) < SIGRTMIN && (rt_sigmask(sig) & (mask))) |
396 | 396 | ||
397 | #define SIG_KERNEL_ONLY_MASK (\ | 397 | #define SIG_KERNEL_ONLY_MASK (\ |
398 | rt_sigmask(SIGKILL) | rt_sigmask(SIGSTOP)) | 398 | rt_sigmask(SIGKILL) | rt_sigmask(SIGSTOP)) |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 00b5e7825508..74ff688568a0 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -39,6 +39,7 @@ struct inet_peer { | |||
39 | 39 | ||
40 | u32 metrics[RTAX_MAX]; | 40 | u32 metrics[RTAX_MAX]; |
41 | u32 rate_tokens; /* rate limiting for ICMP */ | 41 | u32 rate_tokens; /* rate limiting for ICMP */ |
42 | u32 n_redirects; | ||
42 | unsigned long rate_last; | 43 | unsigned long rate_last; |
43 | /* | 44 | /* |
44 | * Once inet_peer is queued for deletion (refcnt == 0), following field | 45 | * Once inet_peer is queued for deletion (refcnt == 0), following field |
diff --git a/include/net/sock.h b/include/net/sock.h index 6679f3c120b0..328cb7cb7b0b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1278,7 +1278,7 @@ static inline void sk_sockets_allocated_inc(struct sock *sk) | |||
1278 | percpu_counter_inc(sk->sk_prot->sockets_allocated); | 1278 | percpu_counter_inc(sk->sk_prot->sockets_allocated); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | static inline int | 1281 | static inline u64 |
1282 | sk_sockets_allocated_read_positive(struct sock *sk) | 1282 | sk_sockets_allocated_read_positive(struct sock *sk) |
1283 | { | 1283 | { |
1284 | return percpu_counter_read_positive(sk->sk_prot->sockets_allocated); | 1284 | return percpu_counter_read_positive(sk->sk_prot->sockets_allocated); |
diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h index 14565d703291..e8baca85bac6 100644 --- a/include/uapi/linux/inet_diag.h +++ b/include/uapi/linux/inet_diag.h | |||
@@ -137,15 +137,21 @@ enum { | |||
137 | INET_DIAG_TCLASS, | 137 | INET_DIAG_TCLASS, |
138 | INET_DIAG_SKMEMINFO, | 138 | INET_DIAG_SKMEMINFO, |
139 | INET_DIAG_SHUTDOWN, | 139 | INET_DIAG_SHUTDOWN, |
140 | INET_DIAG_DCTCPINFO, | 140 | |
141 | INET_DIAG_PROTOCOL, /* response attribute only */ | 141 | /* |
142 | * Next extenstions cannot be requested in struct inet_diag_req_v2: | ||
143 | * its field idiag_ext has only 8 bits. | ||
144 | */ | ||
145 | |||
146 | INET_DIAG_DCTCPINFO, /* request as INET_DIAG_VEGASINFO */ | ||
147 | INET_DIAG_PROTOCOL, /* response attribute only */ | ||
142 | INET_DIAG_SKV6ONLY, | 148 | INET_DIAG_SKV6ONLY, |
143 | INET_DIAG_LOCALS, | 149 | INET_DIAG_LOCALS, |
144 | INET_DIAG_PEERS, | 150 | INET_DIAG_PEERS, |
145 | INET_DIAG_PAD, | 151 | INET_DIAG_PAD, |
146 | INET_DIAG_MARK, | 152 | INET_DIAG_MARK, /* only with CAP_NET_ADMIN */ |
147 | INET_DIAG_BBRINFO, | 153 | INET_DIAG_BBRINFO, /* request as INET_DIAG_VEGASINFO */ |
148 | INET_DIAG_CLASS_ID, | 154 | INET_DIAG_CLASS_ID, /* request as INET_DIAG_TCLASS */ |
149 | INET_DIAG_MD5SIG, | 155 | INET_DIAG_MD5SIG, |
150 | __INET_DIAG_MAX, | 156 | __INET_DIAG_MAX, |
151 | }; | 157 | }; |
diff --git a/init/main.c b/init/main.c index e2e80ca3165a..c86a1c8f19f4 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -695,7 +695,6 @@ asmlinkage __visible void __init start_kernel(void) | |||
695 | initrd_start = 0; | 695 | initrd_start = 0; |
696 | } | 696 | } |
697 | #endif | 697 | #endif |
698 | page_ext_init(); | ||
699 | kmemleak_init(); | 698 | kmemleak_init(); |
700 | setup_per_cpu_pageset(); | 699 | setup_per_cpu_pageset(); |
701 | numa_policy_init(); | 700 | numa_policy_init(); |
@@ -1131,6 +1130,8 @@ static noinline void __init kernel_init_freeable(void) | |||
1131 | sched_init_smp(); | 1130 | sched_init_smp(); |
1132 | 1131 | ||
1133 | page_alloc_init_late(); | 1132 | page_alloc_init_late(); |
1133 | /* Initialize page ext after all struct pages are initialized. */ | ||
1134 | page_ext_init(); | ||
1134 | 1135 | ||
1135 | do_basic_setup(); | 1136 | do_basic_setup(); |
1136 | 1137 | ||
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 4a9937076331..309ef5a64af5 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -734,6 +734,9 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) | |||
734 | size = sizeof(struct ring_buffer); | 734 | size = sizeof(struct ring_buffer); |
735 | size += nr_pages * sizeof(void *); | 735 | size += nr_pages * sizeof(void *); |
736 | 736 | ||
737 | if (order_base_2(size) >= MAX_ORDER) | ||
738 | goto fail; | ||
739 | |||
737 | rb = kzalloc(size, GFP_KERNEL); | 740 | rb = kzalloc(size, GFP_KERNEL); |
738 | if (!rb) | 741 | if (!rb) |
739 | goto fail; | 742 | goto fail; |
diff --git a/kernel/futex.c b/kernel/futex.c index fdd312da0992..a0514e01c3eb 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -2221,11 +2221,11 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) | |||
2221 | * decrement the counter at queue_unlock() when some error has | 2221 | * decrement the counter at queue_unlock() when some error has |
2222 | * occurred and we don't end up adding the task to the list. | 2222 | * occurred and we don't end up adding the task to the list. |
2223 | */ | 2223 | */ |
2224 | hb_waiters_inc(hb); | 2224 | hb_waiters_inc(hb); /* implies smp_mb(); (A) */ |
2225 | 2225 | ||
2226 | q->lock_ptr = &hb->lock; | 2226 | q->lock_ptr = &hb->lock; |
2227 | 2227 | ||
2228 | spin_lock(&hb->lock); /* implies smp_mb(); (A) */ | 2228 | spin_lock(&hb->lock); |
2229 | return hb; | 2229 | return hb; |
2230 | } | 2230 | } |
2231 | 2231 | ||
@@ -2861,35 +2861,39 @@ retry_private: | |||
2861 | * and BUG when futex_unlock_pi() interleaves with this. | 2861 | * and BUG when futex_unlock_pi() interleaves with this. |
2862 | * | 2862 | * |
2863 | * Therefore acquire wait_lock while holding hb->lock, but drop the | 2863 | * Therefore acquire wait_lock while holding hb->lock, but drop the |
2864 | * latter before calling rt_mutex_start_proxy_lock(). This still fully | 2864 | * latter before calling __rt_mutex_start_proxy_lock(). This |
2865 | * serializes against futex_unlock_pi() as that does the exact same | 2865 | * interleaves with futex_unlock_pi() -- which does a similar lock |
2866 | * lock handoff sequence. | 2866 | * handoff -- such that the latter can observe the futex_q::pi_state |
2867 | * before __rt_mutex_start_proxy_lock() is done. | ||
2867 | */ | 2868 | */ |
2868 | raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); | 2869 | raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); |
2869 | spin_unlock(q.lock_ptr); | 2870 | spin_unlock(q.lock_ptr); |
2871 | /* | ||
2872 | * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter | ||
2873 | * such that futex_unlock_pi() is guaranteed to observe the waiter when | ||
2874 | * it sees the futex_q::pi_state. | ||
2875 | */ | ||
2870 | ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); | 2876 | ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); |
2871 | raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); | 2877 | raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); |
2872 | 2878 | ||
2873 | if (ret) { | 2879 | if (ret) { |
2874 | if (ret == 1) | 2880 | if (ret == 1) |
2875 | ret = 0; | 2881 | ret = 0; |
2876 | 2882 | goto cleanup; | |
2877 | spin_lock(q.lock_ptr); | ||
2878 | goto no_block; | ||
2879 | } | 2883 | } |
2880 | 2884 | ||
2881 | |||
2882 | if (unlikely(to)) | 2885 | if (unlikely(to)) |
2883 | hrtimer_start_expires(&to->timer, HRTIMER_MODE_ABS); | 2886 | hrtimer_start_expires(&to->timer, HRTIMER_MODE_ABS); |
2884 | 2887 | ||
2885 | ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); | 2888 | ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); |
2886 | 2889 | ||
2890 | cleanup: | ||
2887 | spin_lock(q.lock_ptr); | 2891 | spin_lock(q.lock_ptr); |
2888 | /* | 2892 | /* |
2889 | * If we failed to acquire the lock (signal/timeout), we must | 2893 | * If we failed to acquire the lock (deadlock/signal/timeout), we must |
2890 | * first acquire the hb->lock before removing the lock from the | 2894 | * first acquire the hb->lock before removing the lock from the |
2891 | * rt_mutex waitqueue, such that we can keep the hb and rt_mutex | 2895 | * rt_mutex waitqueue, such that we can keep the hb and rt_mutex wait |
2892 | * wait lists consistent. | 2896 | * lists consistent. |
2893 | * | 2897 | * |
2894 | * In particular; it is important that futex_unlock_pi() can not | 2898 | * In particular; it is important that futex_unlock_pi() can not |
2895 | * observe this inconsistency. | 2899 | * observe this inconsistency. |
@@ -3013,6 +3017,10 @@ retry: | |||
3013 | * there is no point where we hold neither; and therefore | 3017 | * there is no point where we hold neither; and therefore |
3014 | * wake_futex_pi() must observe a state consistent with what we | 3018 | * wake_futex_pi() must observe a state consistent with what we |
3015 | * observed. | 3019 | * observed. |
3020 | * | ||
3021 | * In particular; this forces __rt_mutex_start_proxy() to | ||
3022 | * complete such that we're guaranteed to observe the | ||
3023 | * rt_waiter. Also see the WARN in wake_futex_pi(). | ||
3016 | */ | 3024 | */ |
3017 | raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); | 3025 | raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); |
3018 | spin_unlock(&hb->lock); | 3026 | spin_unlock(&hb->lock); |
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 581edcc63c26..978d63a8261c 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c | |||
@@ -1726,12 +1726,33 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock, | |||
1726 | rt_mutex_set_owner(lock, NULL); | 1726 | rt_mutex_set_owner(lock, NULL); |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | /** | ||
1730 | * __rt_mutex_start_proxy_lock() - Start lock acquisition for another task | ||
1731 | * @lock: the rt_mutex to take | ||
1732 | * @waiter: the pre-initialized rt_mutex_waiter | ||
1733 | * @task: the task to prepare | ||
1734 | * | ||
1735 | * Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock | ||
1736 | * detection. It does not wait, see rt_mutex_wait_proxy_lock() for that. | ||
1737 | * | ||
1738 | * NOTE: does _NOT_ remove the @waiter on failure; must either call | ||
1739 | * rt_mutex_wait_proxy_lock() or rt_mutex_cleanup_proxy_lock() after this. | ||
1740 | * | ||
1741 | * Returns: | ||
1742 | * 0 - task blocked on lock | ||
1743 | * 1 - acquired the lock for task, caller should wake it up | ||
1744 | * <0 - error | ||
1745 | * | ||
1746 | * Special API call for PI-futex support. | ||
1747 | */ | ||
1729 | int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, | 1748 | int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
1730 | struct rt_mutex_waiter *waiter, | 1749 | struct rt_mutex_waiter *waiter, |
1731 | struct task_struct *task) | 1750 | struct task_struct *task) |
1732 | { | 1751 | { |
1733 | int ret; | 1752 | int ret; |
1734 | 1753 | ||
1754 | lockdep_assert_held(&lock->wait_lock); | ||
1755 | |||
1735 | if (try_to_take_rt_mutex(lock, task, NULL)) | 1756 | if (try_to_take_rt_mutex(lock, task, NULL)) |
1736 | return 1; | 1757 | return 1; |
1737 | 1758 | ||
@@ -1749,9 +1770,6 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, | |||
1749 | ret = 0; | 1770 | ret = 0; |
1750 | } | 1771 | } |
1751 | 1772 | ||
1752 | if (unlikely(ret)) | ||
1753 | remove_waiter(lock, waiter); | ||
1754 | |||
1755 | debug_rt_mutex_print_deadlock(waiter); | 1773 | debug_rt_mutex_print_deadlock(waiter); |
1756 | 1774 | ||
1757 | return ret; | 1775 | return ret; |
@@ -1763,12 +1781,18 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, | |||
1763 | * @waiter: the pre-initialized rt_mutex_waiter | 1781 | * @waiter: the pre-initialized rt_mutex_waiter |
1764 | * @task: the task to prepare | 1782 | * @task: the task to prepare |
1765 | * | 1783 | * |
1784 | * Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock | ||
1785 | * detection. It does not wait, see rt_mutex_wait_proxy_lock() for that. | ||
1786 | * | ||
1787 | * NOTE: unlike __rt_mutex_start_proxy_lock this _DOES_ remove the @waiter | ||
1788 | * on failure. | ||
1789 | * | ||
1766 | * Returns: | 1790 | * Returns: |
1767 | * 0 - task blocked on lock | 1791 | * 0 - task blocked on lock |
1768 | * 1 - acquired the lock for task, caller should wake it up | 1792 | * 1 - acquired the lock for task, caller should wake it up |
1769 | * <0 - error | 1793 | * <0 - error |
1770 | * | 1794 | * |
1771 | * Special API call for FUTEX_REQUEUE_PI support. | 1795 | * Special API call for PI-futex support. |
1772 | */ | 1796 | */ |
1773 | int rt_mutex_start_proxy_lock(struct rt_mutex *lock, | 1797 | int rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
1774 | struct rt_mutex_waiter *waiter, | 1798 | struct rt_mutex_waiter *waiter, |
@@ -1778,6 +1802,8 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, | |||
1778 | 1802 | ||
1779 | raw_spin_lock_irq(&lock->wait_lock); | 1803 | raw_spin_lock_irq(&lock->wait_lock); |
1780 | ret = __rt_mutex_start_proxy_lock(lock, waiter, task); | 1804 | ret = __rt_mutex_start_proxy_lock(lock, waiter, task); |
1805 | if (unlikely(ret)) | ||
1806 | remove_waiter(lock, waiter); | ||
1781 | raw_spin_unlock_irq(&lock->wait_lock); | 1807 | raw_spin_unlock_irq(&lock->wait_lock); |
1782 | 1808 | ||
1783 | return ret; | 1809 | return ret; |
@@ -1845,7 +1871,8 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, | |||
1845 | * @lock: the rt_mutex we were woken on | 1871 | * @lock: the rt_mutex we were woken on |
1846 | * @waiter: the pre-initialized rt_mutex_waiter | 1872 | * @waiter: the pre-initialized rt_mutex_waiter |
1847 | * | 1873 | * |
1848 | * Attempt to clean up after a failed rt_mutex_wait_proxy_lock(). | 1874 | * Attempt to clean up after a failed __rt_mutex_start_proxy_lock() or |
1875 | * rt_mutex_wait_proxy_lock(). | ||
1849 | * | 1876 | * |
1850 | * Unless we acquired the lock; we're still enqueued on the wait-list and can | 1877 | * Unless we acquired the lock; we're still enqueued on the wait-list and can |
1851 | * in fact still be granted ownership until we're removed. Therefore we can | 1878 | * in fact still be granted ownership until we're removed. Therefore we can |
diff --git a/kernel/signal.c b/kernel/signal.c index e1d7ad8e6ab1..57b7771e20d7 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -688,6 +688,48 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, kernel_siginfo_t *in | |||
688 | } | 688 | } |
689 | EXPORT_SYMBOL_GPL(dequeue_signal); | 689 | EXPORT_SYMBOL_GPL(dequeue_signal); |
690 | 690 | ||
691 | static int dequeue_synchronous_signal(kernel_siginfo_t *info) | ||
692 | { | ||
693 | struct task_struct *tsk = current; | ||
694 | struct sigpending *pending = &tsk->pending; | ||
695 | struct sigqueue *q, *sync = NULL; | ||
696 | |||
697 | /* | ||
698 | * Might a synchronous signal be in the queue? | ||
699 | */ | ||
700 | if (!((pending->signal.sig[0] & ~tsk->blocked.sig[0]) & SYNCHRONOUS_MASK)) | ||
701 | return 0; | ||
702 | |||
703 | /* | ||
704 | * Return the first synchronous signal in the queue. | ||
705 | */ | ||
706 | list_for_each_entry(q, &pending->list, list) { | ||
707 | /* Synchronous signals have a postive si_code */ | ||
708 | if ((q->info.si_code > SI_USER) && | ||
709 | (sigmask(q->info.si_signo) & SYNCHRONOUS_MASK)) { | ||
710 | sync = q; | ||
711 | goto next; | ||
712 | } | ||
713 | } | ||
714 | return 0; | ||
715 | next: | ||
716 | /* | ||
717 | * Check if there is another siginfo for the same signal. | ||
718 | */ | ||
719 | list_for_each_entry_continue(q, &pending->list, list) { | ||
720 | if (q->info.si_signo == sync->info.si_signo) | ||
721 | goto still_pending; | ||
722 | } | ||
723 | |||
724 | sigdelset(&pending->signal, sync->info.si_signo); | ||
725 | recalc_sigpending(); | ||
726 | still_pending: | ||
727 | list_del_init(&sync->list); | ||
728 | copy_siginfo(info, &sync->info); | ||
729 | __sigqueue_free(sync); | ||
730 | return info->si_signo; | ||
731 | } | ||
732 | |||
691 | /* | 733 | /* |
692 | * Tell a process that it has a new active signal.. | 734 | * Tell a process that it has a new active signal.. |
693 | * | 735 | * |
@@ -1057,10 +1099,9 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc | |||
1057 | 1099 | ||
1058 | result = TRACE_SIGNAL_DELIVERED; | 1100 | result = TRACE_SIGNAL_DELIVERED; |
1059 | /* | 1101 | /* |
1060 | * Skip useless siginfo allocation for SIGKILL SIGSTOP, | 1102 | * Skip useless siginfo allocation for SIGKILL and kernel threads. |
1061 | * and kernel threads. | ||
1062 | */ | 1103 | */ |
1063 | if (sig_kernel_only(sig) || (t->flags & PF_KTHREAD)) | 1104 | if ((sig == SIGKILL) || (t->flags & PF_KTHREAD)) |
1064 | goto out_set; | 1105 | goto out_set; |
1065 | 1106 | ||
1066 | /* | 1107 | /* |
@@ -2394,6 +2435,14 @@ relock: | |||
2394 | goto relock; | 2435 | goto relock; |
2395 | } | 2436 | } |
2396 | 2437 | ||
2438 | /* Has this task already been marked for death? */ | ||
2439 | if (signal_group_exit(signal)) { | ||
2440 | ksig->info.si_signo = signr = SIGKILL; | ||
2441 | sigdelset(¤t->pending.signal, SIGKILL); | ||
2442 | recalc_sigpending(); | ||
2443 | goto fatal; | ||
2444 | } | ||
2445 | |||
2397 | for (;;) { | 2446 | for (;;) { |
2398 | struct k_sigaction *ka; | 2447 | struct k_sigaction *ka; |
2399 | 2448 | ||
@@ -2407,7 +2456,15 @@ relock: | |||
2407 | goto relock; | 2456 | goto relock; |
2408 | } | 2457 | } |
2409 | 2458 | ||
2410 | signr = dequeue_signal(current, ¤t->blocked, &ksig->info); | 2459 | /* |
2460 | * Signals generated by the execution of an instruction | ||
2461 | * need to be delivered before any other pending signals | ||
2462 | * so that the instruction pointer in the signal stack | ||
2463 | * frame points to the faulting instruction. | ||
2464 | */ | ||
2465 | signr = dequeue_synchronous_signal(&ksig->info); | ||
2466 | if (!signr) | ||
2467 | signr = dequeue_signal(current, ¤t->blocked, &ksig->info); | ||
2411 | 2468 | ||
2412 | if (!signr) | 2469 | if (!signr) |
2413 | break; /* will return 0 */ | 2470 | break; /* will return 0 */ |
@@ -2489,6 +2546,7 @@ relock: | |||
2489 | continue; | 2546 | continue; |
2490 | } | 2547 | } |
2491 | 2548 | ||
2549 | fatal: | ||
2492 | spin_unlock_irq(&sighand->siglock); | 2550 | spin_unlock_irq(&sighand->siglock); |
2493 | 2551 | ||
2494 | /* | 2552 | /* |
diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h index 5c56afc17cf8..4737bb8c07a3 100644 --- a/kernel/trace/trace_probe_tmpl.h +++ b/kernel/trace/trace_probe_tmpl.h | |||
@@ -180,10 +180,12 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs, | |||
180 | if (unlikely(arg->dynamic)) | 180 | if (unlikely(arg->dynamic)) |
181 | *dl = make_data_loc(maxlen, dyndata - base); | 181 | *dl = make_data_loc(maxlen, dyndata - base); |
182 | ret = process_fetch_insn(arg->code, regs, dl, base); | 182 | ret = process_fetch_insn(arg->code, regs, dl, base); |
183 | if (unlikely(ret < 0 && arg->dynamic)) | 183 | if (unlikely(ret < 0 && arg->dynamic)) { |
184 | *dl = make_data_loc(0, dyndata - base); | 184 | *dl = make_data_loc(0, dyndata - base); |
185 | else | 185 | } else { |
186 | dyndata += ret; | 186 | dyndata += ret; |
187 | maxlen -= ret; | ||
188 | } | ||
187 | } | 189 | } |
188 | } | 190 | } |
189 | 191 | ||
@@ -1674,7 +1674,8 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, | |||
1674 | if (!pmd_present(pmd)) | 1674 | if (!pmd_present(pmd)) |
1675 | return 0; | 1675 | return 0; |
1676 | 1676 | ||
1677 | if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd))) { | 1677 | if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) || |
1678 | pmd_devmap(pmd))) { | ||
1678 | /* | 1679 | /* |
1679 | * NUMA hinting faults need to be handled in the GUP | 1680 | * NUMA hinting faults need to be handled in the GUP |
1680 | * slowpath for accounting purposes and so that they | 1681 | * slowpath for accounting purposes and so that they |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 35fdde041f5c..46285d28e43b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -4675,11 +4675,11 @@ refill: | |||
4675 | /* Even if we own the page, we do not use atomic_set(). | 4675 | /* Even if we own the page, we do not use atomic_set(). |
4676 | * This would break get_page_unless_zero() users. | 4676 | * This would break get_page_unless_zero() users. |
4677 | */ | 4677 | */ |
4678 | page_ref_add(page, size - 1); | 4678 | page_ref_add(page, size); |
4679 | 4679 | ||
4680 | /* reset page count bias and offset to start of new frag */ | 4680 | /* reset page count bias and offset to start of new frag */ |
4681 | nc->pfmemalloc = page_is_pfmemalloc(page); | 4681 | nc->pfmemalloc = page_is_pfmemalloc(page); |
4682 | nc->pagecnt_bias = size; | 4682 | nc->pagecnt_bias = size + 1; |
4683 | nc->offset = size; | 4683 | nc->offset = size; |
4684 | } | 4684 | } |
4685 | 4685 | ||
@@ -4695,10 +4695,10 @@ refill: | |||
4695 | size = nc->size; | 4695 | size = nc->size; |
4696 | #endif | 4696 | #endif |
4697 | /* OK, page count is 0, we can safely set it */ | 4697 | /* OK, page count is 0, we can safely set it */ |
4698 | set_page_count(page, size); | 4698 | set_page_count(page, size + 1); |
4699 | 4699 | ||
4700 | /* reset page count bias and offset to start of new frag */ | 4700 | /* reset page count bias and offset to start of new frag */ |
4701 | nc->pagecnt_bias = size; | 4701 | nc->pagecnt_bias = size + 1; |
4702 | offset = size - fragsz; | 4702 | offset = size - fragsz; |
4703 | } | 4703 | } |
4704 | 4704 | ||
diff --git a/mm/page_ext.c b/mm/page_ext.c index ae44f7adbe07..8c78b8d45117 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c | |||
@@ -398,10 +398,8 @@ void __init page_ext_init(void) | |||
398 | * We know some arch can have a nodes layout such as | 398 | * We know some arch can have a nodes layout such as |
399 | * -------------pfn--------------> | 399 | * -------------pfn--------------> |
400 | * N0 | N1 | N2 | N0 | N1 | N2|.... | 400 | * N0 | N1 | N2 | N0 | N1 | N2|.... |
401 | * | ||
402 | * Take into account DEFERRED_STRUCT_PAGE_INIT. | ||
403 | */ | 401 | */ |
404 | if (early_pfn_to_nid(pfn) != nid) | 402 | if (pfn_to_nid(pfn) != nid) |
405 | continue; | 403 | continue; |
406 | if (init_section_page_ext(pfn, nid)) | 404 | if (init_section_page_ext(pfn, nid)) |
407 | goto oom; | 405 | goto oom; |
diff --git a/mm/vmscan.c b/mm/vmscan.c index a714c4f800e9..e979705bbf32 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -491,16 +491,6 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, | |||
491 | delta = freeable / 2; | 491 | delta = freeable / 2; |
492 | } | 492 | } |
493 | 493 | ||
494 | /* | ||
495 | * Make sure we apply some minimal pressure on default priority | ||
496 | * even on small cgroups. Stale objects are not only consuming memory | ||
497 | * by themselves, but can also hold a reference to a dying cgroup, | ||
498 | * preventing it from being reclaimed. A dying cgroup with all | ||
499 | * corresponding structures like per-cpu stats and kmem caches | ||
500 | * can be really big, so it may lead to a significant waste of memory. | ||
501 | */ | ||
502 | delta = max_t(unsigned long long, delta, min(freeable, batch_size)); | ||
503 | |||
504 | total_scan += delta; | 494 | total_scan += delta; |
505 | if (total_scan < 0) { | 495 | if (total_scan < 0) { |
506 | pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n", | 496 | pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n", |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 5cb4a2f53a2f..2e367230376b 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -230,6 +230,8 @@ static netdev_tx_t batadv_interface_tx(struct sk_buff *skb, | |||
230 | 230 | ||
231 | switch (ntohs(proto)) { | 231 | switch (ntohs(proto)) { |
232 | case ETH_P_8021Q: | 232 | case ETH_P_8021Q: |
233 | if (!pskb_may_pull(skb, sizeof(*vhdr))) | ||
234 | goto dropped; | ||
233 | vhdr = vlan_eth_hdr(skb); | 235 | vhdr = vlan_eth_hdr(skb); |
234 | proto = vhdr->h_vlan_encapsulated_proto; | 236 | proto = vhdr->h_vlan_encapsulated_proto; |
235 | 237 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 71ded4d8025c..d9f0a817dca8 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2475,7 +2475,7 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind) | |||
2475 | } | 2475 | } |
2476 | 2476 | ||
2477 | if (sk_has_memory_pressure(sk)) { | 2477 | if (sk_has_memory_pressure(sk)) { |
2478 | int alloc; | 2478 | u64 alloc; |
2479 | 2479 | ||
2480 | if (!sk_under_memory_pressure(sk)) | 2480 | if (!sk_under_memory_pressure(sk)) |
2481 | return 1; | 2481 | return 1; |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 1a4e9ff02762..5731670c560b 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -108,6 +108,7 @@ static size_t inet_sk_attr_size(struct sock *sk, | |||
108 | + nla_total_size(1) /* INET_DIAG_TOS */ | 108 | + nla_total_size(1) /* INET_DIAG_TOS */ |
109 | + nla_total_size(1) /* INET_DIAG_TCLASS */ | 109 | + nla_total_size(1) /* INET_DIAG_TCLASS */ |
110 | + nla_total_size(4) /* INET_DIAG_MARK */ | 110 | + nla_total_size(4) /* INET_DIAG_MARK */ |
111 | + nla_total_size(4) /* INET_DIAG_CLASS_ID */ | ||
111 | + nla_total_size(sizeof(struct inet_diag_meminfo)) | 112 | + nla_total_size(sizeof(struct inet_diag_meminfo)) |
112 | + nla_total_size(sizeof(struct inet_diag_msg)) | 113 | + nla_total_size(sizeof(struct inet_diag_msg)) |
113 | + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) | 114 | + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) |
@@ -287,12 +288,19 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |||
287 | goto errout; | 288 | goto errout; |
288 | } | 289 | } |
289 | 290 | ||
290 | if (ext & (1 << (INET_DIAG_CLASS_ID - 1))) { | 291 | if (ext & (1 << (INET_DIAG_CLASS_ID - 1)) || |
292 | ext & (1 << (INET_DIAG_TCLASS - 1))) { | ||
291 | u32 classid = 0; | 293 | u32 classid = 0; |
292 | 294 | ||
293 | #ifdef CONFIG_SOCK_CGROUP_DATA | 295 | #ifdef CONFIG_SOCK_CGROUP_DATA |
294 | classid = sock_cgroup_classid(&sk->sk_cgrp_data); | 296 | classid = sock_cgroup_classid(&sk->sk_cgrp_data); |
295 | #endif | 297 | #endif |
298 | /* Fallback to socket priority if class id isn't set. | ||
299 | * Classful qdiscs use it as direct reference to class. | ||
300 | * For cgroup2 classid is always zero. | ||
301 | */ | ||
302 | if (!classid) | ||
303 | classid = sk->sk_priority; | ||
296 | 304 | ||
297 | if (nla_put_u32(skb, INET_DIAG_CLASS_ID, classid)) | 305 | if (nla_put_u32(skb, INET_DIAG_CLASS_ID, classid)) |
298 | goto errout; | 306 | goto errout; |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index d757b9642d0d..be778599bfed 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -216,6 +216,7 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, | |||
216 | atomic_set(&p->rid, 0); | 216 | atomic_set(&p->rid, 0); |
217 | p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; | 217 | p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; |
218 | p->rate_tokens = 0; | 218 | p->rate_tokens = 0; |
219 | p->n_redirects = 0; | ||
219 | /* 60*HZ is arbitrary, but chosen enough high so that the first | 220 | /* 60*HZ is arbitrary, but chosen enough high so that the first |
220 | * calculation of tokens is at its maximum. | 221 | * calculation of tokens is at its maximum. |
221 | */ | 222 | */ |
diff --git a/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c b/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c index e26165af45cb..4b07eb8a9b18 100644 --- a/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c | |||
@@ -215,6 +215,7 @@ int nf_nat_icmp_reply_translation(struct sk_buff *skb, | |||
215 | 215 | ||
216 | /* Change outer to look like the reply to an incoming packet */ | 216 | /* Change outer to look like the reply to an incoming packet */ |
217 | nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple); | 217 | nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple); |
218 | target.dst.protonum = IPPROTO_ICMP; | ||
218 | if (!nf_nat_ipv4_manip_pkt(skb, 0, &target, manip)) | 219 | if (!nf_nat_ipv4_manip_pkt(skb, 0, &target, manip)) |
219 | return 0; | 220 | return 0; |
220 | 221 | ||
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic_main.c b/net/ipv4/netfilter/nf_nat_snmp_basic_main.c index a0aa13bcabda..0a8a60c1bf9a 100644 --- a/net/ipv4/netfilter/nf_nat_snmp_basic_main.c +++ b/net/ipv4/netfilter/nf_nat_snmp_basic_main.c | |||
@@ -105,6 +105,8 @@ static void fast_csum(struct snmp_ctx *ctx, unsigned char offset) | |||
105 | int snmp_version(void *context, size_t hdrlen, unsigned char tag, | 105 | int snmp_version(void *context, size_t hdrlen, unsigned char tag, |
106 | const void *data, size_t datalen) | 106 | const void *data, size_t datalen) |
107 | { | 107 | { |
108 | if (datalen != 1) | ||
109 | return -EINVAL; | ||
108 | if (*(unsigned char *)data > 1) | 110 | if (*(unsigned char *)data > 1) |
109 | return -ENOTSUPP; | 111 | return -ENOTSUPP; |
110 | return 1; | 112 | return 1; |
@@ -114,8 +116,11 @@ int snmp_helper(void *context, size_t hdrlen, unsigned char tag, | |||
114 | const void *data, size_t datalen) | 116 | const void *data, size_t datalen) |
115 | { | 117 | { |
116 | struct snmp_ctx *ctx = (struct snmp_ctx *)context; | 118 | struct snmp_ctx *ctx = (struct snmp_ctx *)context; |
117 | __be32 *pdata = (__be32 *)data; | 119 | __be32 *pdata; |
118 | 120 | ||
121 | if (datalen != 4) | ||
122 | return -EINVAL; | ||
123 | pdata = (__be32 *)data; | ||
119 | if (*pdata == ctx->from) { | 124 | if (*pdata == ctx->from) { |
120 | pr_debug("%s: %pI4 to %pI4\n", __func__, | 125 | pr_debug("%s: %pI4 to %pI4\n", __func__, |
121 | (void *)&ctx->from, (void *)&ctx->to); | 126 | (void *)&ctx->from, (void *)&ctx->to); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 16259ea9df54..ecc12a768191 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -887,13 +887,15 @@ void ip_rt_send_redirect(struct sk_buff *skb) | |||
887 | /* No redirected packets during ip_rt_redirect_silence; | 887 | /* No redirected packets during ip_rt_redirect_silence; |
888 | * reset the algorithm. | 888 | * reset the algorithm. |
889 | */ | 889 | */ |
890 | if (time_after(jiffies, peer->rate_last + ip_rt_redirect_silence)) | 890 | if (time_after(jiffies, peer->rate_last + ip_rt_redirect_silence)) { |
891 | peer->rate_tokens = 0; | 891 | peer->rate_tokens = 0; |
892 | peer->n_redirects = 0; | ||
893 | } | ||
892 | 894 | ||
893 | /* Too many ignored redirects; do not send anything | 895 | /* Too many ignored redirects; do not send anything |
894 | * set dst.rate_last to the last seen redirected packet. | 896 | * set dst.rate_last to the last seen redirected packet. |
895 | */ | 897 | */ |
896 | if (peer->rate_tokens >= ip_rt_redirect_number) { | 898 | if (peer->n_redirects >= ip_rt_redirect_number) { |
897 | peer->rate_last = jiffies; | 899 | peer->rate_last = jiffies; |
898 | goto out_put_peer; | 900 | goto out_put_peer; |
899 | } | 901 | } |
@@ -910,6 +912,7 @@ void ip_rt_send_redirect(struct sk_buff *skb) | |||
910 | icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw); | 912 | icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw); |
911 | peer->rate_last = jiffies; | 913 | peer->rate_last = jiffies; |
912 | ++peer->rate_tokens; | 914 | ++peer->rate_tokens; |
915 | ++peer->n_redirects; | ||
913 | #ifdef CONFIG_IP_ROUTE_VERBOSE | 916 | #ifdef CONFIG_IP_ROUTE_VERBOSE |
914 | if (log_martians && | 917 | if (log_martians && |
915 | peer->rate_tokens == ip_rt_redirect_number) | 918 | peer->rate_tokens == ip_rt_redirect_number) |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index dcb1d434f7da..da5a21050ba9 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1200,7 +1200,8 @@ check_cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long *expires) | |||
1200 | list_for_each_entry(ifa, &idev->addr_list, if_list) { | 1200 | list_for_each_entry(ifa, &idev->addr_list, if_list) { |
1201 | if (ifa == ifp) | 1201 | if (ifa == ifp) |
1202 | continue; | 1202 | continue; |
1203 | if (!ipv6_prefix_equal(&ifa->addr, &ifp->addr, | 1203 | if (ifa->prefix_len != ifp->prefix_len || |
1204 | !ipv6_prefix_equal(&ifa->addr, &ifp->addr, | ||
1204 | ifp->prefix_len)) | 1205 | ifp->prefix_len)) |
1205 | continue; | 1206 | continue; |
1206 | if (ifa->flags & (IFA_F_PERMANENT | IFA_F_NOPREFIXROUTE)) | 1207 | if (ifa->flags & (IFA_F_PERMANENT | IFA_F_NOPREFIXROUTE)) |
diff --git a/net/ipv6/netfilter/nf_nat_l3proto_ipv6.c b/net/ipv6/netfilter/nf_nat_l3proto_ipv6.c index 9c914db44bec..f0ec31933c15 100644 --- a/net/ipv6/netfilter/nf_nat_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_nat_l3proto_ipv6.c | |||
@@ -226,6 +226,7 @@ int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, | |||
226 | } | 226 | } |
227 | 227 | ||
228 | nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple); | 228 | nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple); |
229 | target.dst.protonum = IPPROTO_ICMPV6; | ||
229 | if (!nf_nat_ipv6_manip_pkt(skb, 0, &target, manip)) | 230 | if (!nf_nat_ipv6_manip_pkt(skb, 0, &target, manip)) |
230 | return 0; | 231 | return 0; |
231 | 232 | ||
diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c index 8d0ba757a46c..9b2f272ca164 100644 --- a/net/ipv6/seg6.c +++ b/net/ipv6/seg6.c | |||
@@ -221,9 +221,7 @@ static int seg6_genl_get_tunsrc(struct sk_buff *skb, struct genl_info *info) | |||
221 | rcu_read_unlock(); | 221 | rcu_read_unlock(); |
222 | 222 | ||
223 | genlmsg_end(msg, hdr); | 223 | genlmsg_end(msg, hdr); |
224 | genlmsg_reply(msg, info); | 224 | return genlmsg_reply(msg, info); |
225 | |||
226 | return 0; | ||
227 | 225 | ||
228 | nla_put_failure: | 226 | nla_put_failure: |
229 | rcu_read_unlock(); | 227 | rcu_read_unlock(); |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index e94b1a0407af..2c4cd4183bf9 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> | 8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
9 | * Copyright 2007-2010, Intel Corporation | 9 | * Copyright 2007-2010, Intel Corporation |
10 | * Copyright(c) 2015-2017 Intel Deutschland GmbH | 10 | * Copyright(c) 2015-2017 Intel Deutschland GmbH |
11 | * Copyright (C) 2018 Intel Corporation | 11 | * Copyright (C) 2018 - 2019 Intel Corporation |
12 | * | 12 | * |
13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License version 2 as | 14 | * it under the terms of the GNU General Public License version 2 as |
@@ -366,6 +366,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
366 | 366 | ||
367 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); | 367 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); |
368 | 368 | ||
369 | ieee80211_agg_stop_txq(sta, tid); | ||
370 | |||
369 | spin_unlock_bh(&sta->lock); | 371 | spin_unlock_bh(&sta->lock); |
370 | 372 | ||
371 | ht_dbg(sta->sdata, "Tx BA session stop requested for %pM tid %u\n", | 373 | ht_dbg(sta->sdata, "Tx BA session stop requested for %pM tid %u\n", |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index d0eb38b890aa..ba950ae974fc 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | 5 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
6 | * Copyright 2013-2014 Intel Mobile Communications GmbH | 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
7 | * Copyright (C) 2015-2017 Intel Deutschland GmbH | 7 | * Copyright (C) 2015-2017 Intel Deutschland GmbH |
8 | * Copyright (C) 2018 Intel Corporation | 8 | * Copyright (C) 2018-2019 Intel Corporation |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -2146,6 +2146,10 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
2146 | case NL80211_IFTYPE_AP_VLAN: | 2146 | case NL80211_IFTYPE_AP_VLAN: |
2147 | case NL80211_IFTYPE_MONITOR: | 2147 | case NL80211_IFTYPE_MONITOR: |
2148 | break; | 2148 | break; |
2149 | case NL80211_IFTYPE_ADHOC: | ||
2150 | if (sdata->vif.bss_conf.ibss_joined) | ||
2151 | WARN_ON(drv_join_ibss(local, sdata)); | ||
2152 | /* fall through */ | ||
2149 | default: | 2153 | default: |
2150 | ieee80211_reconfig_stations(sdata); | 2154 | ieee80211_reconfig_stations(sdata); |
2151 | /* fall through */ | 2155 | /* fall through */ |
diff --git a/net/netfilter/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig index cad48d07c818..8401cefd9f65 100644 --- a/net/netfilter/ipvs/Kconfig +++ b/net/netfilter/ipvs/Kconfig | |||
@@ -29,6 +29,7 @@ config IP_VS_IPV6 | |||
29 | bool "IPv6 support for IPVS" | 29 | bool "IPv6 support for IPVS" |
30 | depends on IPV6 = y || IP_VS = IPV6 | 30 | depends on IPV6 = y || IP_VS = IPV6 |
31 | select IP6_NF_IPTABLES | 31 | select IP6_NF_IPTABLES |
32 | select NF_DEFRAG_IPV6 | ||
32 | ---help--- | 33 | ---help--- |
33 | Add IPv6 support to IPVS. | 34 | Add IPv6 support to IPVS. |
34 | 35 | ||
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index e969dad66991..43bbaa32b1d6 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1566,14 +1566,12 @@ ip_vs_try_to_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, | |||
1566 | /* sorry, all this trouble for a no-hit :) */ | 1566 | /* sorry, all this trouble for a no-hit :) */ |
1567 | IP_VS_DBG_PKT(12, af, pp, skb, iph->off, | 1567 | IP_VS_DBG_PKT(12, af, pp, skb, iph->off, |
1568 | "ip_vs_in: packet continues traversal as normal"); | 1568 | "ip_vs_in: packet continues traversal as normal"); |
1569 | if (iph->fragoffs) { | 1569 | |
1570 | /* Fragment that couldn't be mapped to a conn entry | 1570 | /* Fragment couldn't be mapped to a conn entry */ |
1571 | * is missing module nf_defrag_ipv6 | 1571 | if (iph->fragoffs) |
1572 | */ | ||
1573 | IP_VS_DBG_RL("Unhandled frag, load nf_defrag_ipv6\n"); | ||
1574 | IP_VS_DBG_PKT(7, af, pp, skb, iph->off, | 1572 | IP_VS_DBG_PKT(7, af, pp, skb, iph->off, |
1575 | "unhandled fragment"); | 1573 | "unhandled fragment"); |
1576 | } | 1574 | |
1577 | *verdict = NF_ACCEPT; | 1575 | *verdict = NF_ACCEPT; |
1578 | return 0; | 1576 | return 0; |
1579 | } | 1577 | } |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 7d6318664eb2..86afacb07e5f 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #ifdef CONFIG_IP_VS_IPV6 | 43 | #ifdef CONFIG_IP_VS_IPV6 |
44 | #include <net/ipv6.h> | 44 | #include <net/ipv6.h> |
45 | #include <net/ip6_route.h> | 45 | #include <net/ip6_route.h> |
46 | #include <net/netfilter/ipv6/nf_defrag_ipv6.h> | ||
46 | #endif | 47 | #endif |
47 | #include <net/route.h> | 48 | #include <net/route.h> |
48 | #include <net/sock.h> | 49 | #include <net/sock.h> |
@@ -895,6 +896,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest, | |||
895 | { | 896 | { |
896 | struct ip_vs_dest *dest; | 897 | struct ip_vs_dest *dest; |
897 | unsigned int atype, i; | 898 | unsigned int atype, i; |
899 | int ret = 0; | ||
898 | 900 | ||
899 | EnterFunction(2); | 901 | EnterFunction(2); |
900 | 902 | ||
@@ -905,6 +907,10 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest, | |||
905 | atype & IPV6_ADDR_LINKLOCAL) && | 907 | atype & IPV6_ADDR_LINKLOCAL) && |
906 | !__ip_vs_addr_is_local_v6(svc->ipvs->net, &udest->addr.in6)) | 908 | !__ip_vs_addr_is_local_v6(svc->ipvs->net, &udest->addr.in6)) |
907 | return -EINVAL; | 909 | return -EINVAL; |
910 | |||
911 | ret = nf_defrag_ipv6_enable(svc->ipvs->net); | ||
912 | if (ret) | ||
913 | return ret; | ||
908 | } else | 914 | } else |
909 | #endif | 915 | #endif |
910 | { | 916 | { |
@@ -1228,6 +1234,10 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, | |||
1228 | ret = -EINVAL; | 1234 | ret = -EINVAL; |
1229 | goto out_err; | 1235 | goto out_err; |
1230 | } | 1236 | } |
1237 | |||
1238 | ret = nf_defrag_ipv6_enable(ipvs->net); | ||
1239 | if (ret) | ||
1240 | goto out_err; | ||
1231 | } | 1241 | } |
1232 | #endif | 1242 | #endif |
1233 | 1243 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index fe64df848365..0a4bad55a8aa 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -315,6 +315,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | |||
315 | { | 315 | { |
316 | struct xt_target *target = expr->ops->data; | 316 | struct xt_target *target = expr->ops->data; |
317 | void *info = nft_expr_priv(expr); | 317 | void *info = nft_expr_priv(expr); |
318 | struct module *me = target->me; | ||
318 | struct xt_tgdtor_param par; | 319 | struct xt_tgdtor_param par; |
319 | 320 | ||
320 | par.net = ctx->net; | 321 | par.net = ctx->net; |
@@ -325,7 +326,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | |||
325 | par.target->destroy(&par); | 326 | par.target->destroy(&par); |
326 | 327 | ||
327 | if (nft_xt_put(container_of(expr->ops, struct nft_xt, ops))) | 328 | if (nft_xt_put(container_of(expr->ops, struct nft_xt, ops))) |
328 | module_put(target->me); | 329 | module_put(me); |
329 | } | 330 | } |
330 | 331 | ||
331 | static int nft_extension_dump_info(struct sk_buff *skb, int attr, | 332 | static int nft_extension_dump_info(struct sk_buff *skb, int attr, |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index aecadd471e1d..13e1ac333fa4 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -1899,7 +1899,7 @@ static int __init xt_init(void) | |||
1899 | seqcount_init(&per_cpu(xt_recseq, i)); | 1899 | seqcount_init(&per_cpu(xt_recseq, i)); |
1900 | } | 1900 | } |
1901 | 1901 | ||
1902 | xt = kmalloc_array(NFPROTO_NUMPROTO, sizeof(struct xt_af), GFP_KERNEL); | 1902 | xt = kcalloc(NFPROTO_NUMPROTO, sizeof(struct xt_af), GFP_KERNEL); |
1903 | if (!xt) | 1903 | if (!xt) |
1904 | return -ENOMEM; | 1904 | return -ENOMEM; |
1905 | 1905 | ||
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 3b1a78906bc0..1cd1d83a4be0 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -4292,7 +4292,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4292 | rb->frames_per_block = req->tp_block_size / req->tp_frame_size; | 4292 | rb->frames_per_block = req->tp_block_size / req->tp_frame_size; |
4293 | if (unlikely(rb->frames_per_block == 0)) | 4293 | if (unlikely(rb->frames_per_block == 0)) |
4294 | goto out; | 4294 | goto out; |
4295 | if (unlikely(req->tp_block_size > UINT_MAX / req->tp_block_nr)) | 4295 | if (unlikely(rb->frames_per_block > UINT_MAX / req->tp_block_nr)) |
4296 | goto out; | 4296 | goto out; |
4297 | if (unlikely((rb->frames_per_block * req->tp_block_nr) != | 4297 | if (unlikely((rb->frames_per_block * req->tp_block_nr) != |
4298 | req->tp_frame_nr)) | 4298 | req->tp_frame_nr)) |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 14d6b4058045..e1981628047b 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -275,7 +275,7 @@ static void tcindex_free_perfect_hash(struct tcindex_data *cp) | |||
275 | kfree(cp->perfect); | 275 | kfree(cp->perfect); |
276 | } | 276 | } |
277 | 277 | ||
278 | static int tcindex_alloc_perfect_hash(struct tcindex_data *cp) | 278 | static int tcindex_alloc_perfect_hash(struct net *net, struct tcindex_data *cp) |
279 | { | 279 | { |
280 | int i, err = 0; | 280 | int i, err = 0; |
281 | 281 | ||
@@ -289,6 +289,9 @@ static int tcindex_alloc_perfect_hash(struct tcindex_data *cp) | |||
289 | TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE); | 289 | TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE); |
290 | if (err < 0) | 290 | if (err < 0) |
291 | goto errout; | 291 | goto errout; |
292 | #ifdef CONFIG_NET_CLS_ACT | ||
293 | cp->perfect[i].exts.net = net; | ||
294 | #endif | ||
292 | } | 295 | } |
293 | 296 | ||
294 | return 0; | 297 | return 0; |
@@ -305,9 +308,9 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
305 | struct nlattr *est, bool ovr, struct netlink_ext_ack *extack) | 308 | struct nlattr *est, bool ovr, struct netlink_ext_ack *extack) |
306 | { | 309 | { |
307 | struct tcindex_filter_result new_filter_result, *old_r = r; | 310 | struct tcindex_filter_result new_filter_result, *old_r = r; |
308 | struct tcindex_filter_result cr; | ||
309 | struct tcindex_data *cp = NULL, *oldp; | 311 | struct tcindex_data *cp = NULL, *oldp; |
310 | struct tcindex_filter *f = NULL; /* make gcc behave */ | 312 | struct tcindex_filter *f = NULL; /* make gcc behave */ |
313 | struct tcf_result cr = {}; | ||
311 | int err, balloc = 0; | 314 | int err, balloc = 0; |
312 | struct tcf_exts e; | 315 | struct tcf_exts e; |
313 | 316 | ||
@@ -337,7 +340,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
337 | if (p->perfect) { | 340 | if (p->perfect) { |
338 | int i; | 341 | int i; |
339 | 342 | ||
340 | if (tcindex_alloc_perfect_hash(cp) < 0) | 343 | if (tcindex_alloc_perfect_hash(net, cp) < 0) |
341 | goto errout; | 344 | goto errout; |
342 | for (i = 0; i < cp->hash; i++) | 345 | for (i = 0; i < cp->hash; i++) |
343 | cp->perfect[i].res = p->perfect[i].res; | 346 | cp->perfect[i].res = p->perfect[i].res; |
@@ -348,11 +351,8 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
348 | err = tcindex_filter_result_init(&new_filter_result); | 351 | err = tcindex_filter_result_init(&new_filter_result); |
349 | if (err < 0) | 352 | if (err < 0) |
350 | goto errout1; | 353 | goto errout1; |
351 | err = tcindex_filter_result_init(&cr); | ||
352 | if (err < 0) | ||
353 | goto errout1; | ||
354 | if (old_r) | 354 | if (old_r) |
355 | cr.res = r->res; | 355 | cr = r->res; |
356 | 356 | ||
357 | if (tb[TCA_TCINDEX_HASH]) | 357 | if (tb[TCA_TCINDEX_HASH]) |
358 | cp->hash = nla_get_u32(tb[TCA_TCINDEX_HASH]); | 358 | cp->hash = nla_get_u32(tb[TCA_TCINDEX_HASH]); |
@@ -406,7 +406,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
406 | err = -ENOMEM; | 406 | err = -ENOMEM; |
407 | if (!cp->perfect && !cp->h) { | 407 | if (!cp->perfect && !cp->h) { |
408 | if (valid_perfect_hash(cp)) { | 408 | if (valid_perfect_hash(cp)) { |
409 | if (tcindex_alloc_perfect_hash(cp) < 0) | 409 | if (tcindex_alloc_perfect_hash(net, cp) < 0) |
410 | goto errout_alloc; | 410 | goto errout_alloc; |
411 | balloc = 1; | 411 | balloc = 1; |
412 | } else { | 412 | } else { |
@@ -443,8 +443,8 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
443 | } | 443 | } |
444 | 444 | ||
445 | if (tb[TCA_TCINDEX_CLASSID]) { | 445 | if (tb[TCA_TCINDEX_CLASSID]) { |
446 | cr.res.classid = nla_get_u32(tb[TCA_TCINDEX_CLASSID]); | 446 | cr.classid = nla_get_u32(tb[TCA_TCINDEX_CLASSID]); |
447 | tcf_bind_filter(tp, &cr.res, base); | 447 | tcf_bind_filter(tp, &cr, base); |
448 | } | 448 | } |
449 | 449 | ||
450 | if (old_r && old_r != r) { | 450 | if (old_r && old_r != r) { |
@@ -456,7 +456,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
456 | } | 456 | } |
457 | 457 | ||
458 | oldp = p; | 458 | oldp = p; |
459 | r->res = cr.res; | 459 | r->res = cr; |
460 | tcf_exts_change(&r->exts, &e); | 460 | tcf_exts_change(&r->exts, &e); |
461 | 461 | ||
462 | rcu_assign_pointer(tp->root, cp); | 462 | rcu_assign_pointer(tp->root, cp); |
@@ -475,6 +475,8 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
475 | ; /* nothing */ | 475 | ; /* nothing */ |
476 | 476 | ||
477 | rcu_assign_pointer(*fp, f); | 477 | rcu_assign_pointer(*fp, f); |
478 | } else { | ||
479 | tcf_exts_destroy(&new_filter_result.exts); | ||
478 | } | 480 | } |
479 | 481 | ||
480 | if (oldp) | 482 | if (oldp) |
@@ -487,7 +489,6 @@ errout_alloc: | |||
487 | else if (balloc == 2) | 489 | else if (balloc == 2) |
488 | kfree(cp->h); | 490 | kfree(cp->h); |
489 | errout1: | 491 | errout1: |
490 | tcf_exts_destroy(&cr.exts); | ||
491 | tcf_exts_destroy(&new_filter_result.exts); | 492 | tcf_exts_destroy(&new_filter_result.exts); |
492 | errout: | 493 | errout: |
493 | kfree(cp); | 494 | kfree(cp); |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index e24568f9246c..38e5add14fab 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -500,7 +500,7 @@ static void dev_watchdog_down(struct net_device *dev) | |||
500 | * netif_carrier_on - set carrier | 500 | * netif_carrier_on - set carrier |
501 | * @dev: network device | 501 | * @dev: network device |
502 | * | 502 | * |
503 | * Device has detected that carrier. | 503 | * Device has detected acquisition of carrier. |
504 | */ | 504 | */ |
505 | void netif_carrier_on(struct net_device *dev) | 505 | void netif_carrier_on(struct net_device *dev) |
506 | { | 506 | { |
diff --git a/net/sctp/diag.c b/net/sctp/diag.c index 078f01a8d582..435847d98b51 100644 --- a/net/sctp/diag.c +++ b/net/sctp/diag.c | |||
@@ -256,6 +256,7 @@ static size_t inet_assoc_attr_size(struct sctp_association *asoc) | |||
256 | + nla_total_size(1) /* INET_DIAG_TOS */ | 256 | + nla_total_size(1) /* INET_DIAG_TOS */ |
257 | + nla_total_size(1) /* INET_DIAG_TCLASS */ | 257 | + nla_total_size(1) /* INET_DIAG_TCLASS */ |
258 | + nla_total_size(4) /* INET_DIAG_MARK */ | 258 | + nla_total_size(4) /* INET_DIAG_MARK */ |
259 | + nla_total_size(4) /* INET_DIAG_CLASS_ID */ | ||
259 | + nla_total_size(addrlen * asoc->peer.transport_count) | 260 | + nla_total_size(addrlen * asoc->peer.transport_count) |
260 | + nla_total_size(addrlen * addrcnt) | 261 | + nla_total_size(addrlen * addrcnt) |
261 | + nla_total_size(sizeof(struct inet_diag_meminfo)) | 262 | + nla_total_size(sizeof(struct inet_diag_meminfo)) |
diff --git a/net/sctp/offload.c b/net/sctp/offload.c index 123e9f2dc226..edfcf16e704c 100644 --- a/net/sctp/offload.c +++ b/net/sctp/offload.c | |||
@@ -36,6 +36,7 @@ static __le32 sctp_gso_make_checksum(struct sk_buff *skb) | |||
36 | { | 36 | { |
37 | skb->ip_summed = CHECKSUM_NONE; | 37 | skb->ip_summed = CHECKSUM_NONE; |
38 | skb->csum_not_inet = 0; | 38 | skb->csum_not_inet = 0; |
39 | gso_reset_checksum(skb, ~0); | ||
39 | return sctp_compute_cksum(skb, skb_transport_offset(skb)); | 40 | return sctp_compute_cksum(skb, skb_transport_offset(skb)); |
40 | } | 41 | } |
41 | 42 | ||
diff --git a/net/sctp/stream.c b/net/sctp/stream.c index f24633114dfd..2936ed17bf9e 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c | |||
@@ -144,8 +144,10 @@ static void sctp_stream_outq_migrate(struct sctp_stream *stream, | |||
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | for (i = outcnt; i < stream->outcnt; i++) | 147 | for (i = outcnt; i < stream->outcnt; i++) { |
148 | kfree(SCTP_SO(stream, i)->ext); | 148 | kfree(SCTP_SO(stream, i)->ext); |
149 | SCTP_SO(stream, i)->ext = NULL; | ||
150 | } | ||
149 | } | 151 | } |
150 | 152 | ||
151 | static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, | 153 | static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, |
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c index 28bbdb04bc35..d0b0f4c865b4 100644 --- a/net/smc/smc_cdc.c +++ b/net/smc/smc_cdc.c | |||
@@ -101,9 +101,7 @@ int smc_cdc_msg_send(struct smc_connection *conn, | |||
101 | 101 | ||
102 | conn->tx_cdc_seq++; | 102 | conn->tx_cdc_seq++; |
103 | conn->local_tx_ctrl.seqno = conn->tx_cdc_seq; | 103 | conn->local_tx_ctrl.seqno = conn->tx_cdc_seq; |
104 | smc_host_msg_to_cdc((struct smc_cdc_msg *)wr_buf, | 104 | smc_host_msg_to_cdc((struct smc_cdc_msg *)wr_buf, conn, &cfed); |
105 | &conn->local_tx_ctrl, conn); | ||
106 | smc_curs_copy(&cfed, &((struct smc_host_cdc_msg *)wr_buf)->cons, conn); | ||
107 | rc = smc_wr_tx_send(link, (struct smc_wr_tx_pend_priv *)pend); | 105 | rc = smc_wr_tx_send(link, (struct smc_wr_tx_pend_priv *)pend); |
108 | if (!rc) { | 106 | if (!rc) { |
109 | smc_curs_copy(&conn->rx_curs_confirmed, &cfed, conn); | 107 | smc_curs_copy(&conn->rx_curs_confirmed, &cfed, conn); |
diff --git a/net/smc/smc_cdc.h b/net/smc/smc_cdc.h index e3b6b367f3b6..861dc24c588c 100644 --- a/net/smc/smc_cdc.h +++ b/net/smc/smc_cdc.h | |||
@@ -211,26 +211,27 @@ static inline int smc_curs_diff_large(unsigned int size, | |||
211 | 211 | ||
212 | static inline void smc_host_cursor_to_cdc(union smc_cdc_cursor *peer, | 212 | static inline void smc_host_cursor_to_cdc(union smc_cdc_cursor *peer, |
213 | union smc_host_cursor *local, | 213 | union smc_host_cursor *local, |
214 | union smc_host_cursor *save, | ||
214 | struct smc_connection *conn) | 215 | struct smc_connection *conn) |
215 | { | 216 | { |
216 | union smc_host_cursor temp; | 217 | smc_curs_copy(save, local, conn); |
217 | 218 | peer->count = htonl(save->count); | |
218 | smc_curs_copy(&temp, local, conn); | 219 | peer->wrap = htons(save->wrap); |
219 | peer->count = htonl(temp.count); | ||
220 | peer->wrap = htons(temp.wrap); | ||
221 | /* peer->reserved = htons(0); must be ensured by caller */ | 220 | /* peer->reserved = htons(0); must be ensured by caller */ |
222 | } | 221 | } |
223 | 222 | ||
224 | static inline void smc_host_msg_to_cdc(struct smc_cdc_msg *peer, | 223 | static inline void smc_host_msg_to_cdc(struct smc_cdc_msg *peer, |
225 | struct smc_host_cdc_msg *local, | 224 | struct smc_connection *conn, |
226 | struct smc_connection *conn) | 225 | union smc_host_cursor *save) |
227 | { | 226 | { |
227 | struct smc_host_cdc_msg *local = &conn->local_tx_ctrl; | ||
228 | |||
228 | peer->common.type = local->common.type; | 229 | peer->common.type = local->common.type; |
229 | peer->len = local->len; | 230 | peer->len = local->len; |
230 | peer->seqno = htons(local->seqno); | 231 | peer->seqno = htons(local->seqno); |
231 | peer->token = htonl(local->token); | 232 | peer->token = htonl(local->token); |
232 | smc_host_cursor_to_cdc(&peer->prod, &local->prod, conn); | 233 | smc_host_cursor_to_cdc(&peer->prod, &local->prod, save, conn); |
233 | smc_host_cursor_to_cdc(&peer->cons, &local->cons, conn); | 234 | smc_host_cursor_to_cdc(&peer->cons, &local->cons, save, conn); |
234 | peer->prod_flags = local->prod_flags; | 235 | peer->prod_flags = local->prod_flags; |
235 | peer->conn_state_flags = local->conn_state_flags; | 236 | peer->conn_state_flags = local->conn_state_flags; |
236 | } | 237 | } |
diff --git a/net/tipc/link.c b/net/tipc/link.c index ac306d17f8ad..341ecd796aa4 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1145,7 +1145,7 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb, | |||
1145 | default: | 1145 | default: |
1146 | pr_warn("Dropping received illegal msg type\n"); | 1146 | pr_warn("Dropping received illegal msg type\n"); |
1147 | kfree_skb(skb); | 1147 | kfree_skb(skb); |
1148 | return false; | 1148 | return true; |
1149 | }; | 1149 | }; |
1150 | } | 1150 | } |
1151 | 1151 | ||
@@ -1425,6 +1425,10 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe, | |||
1425 | l->rcv_unacked = 0; | 1425 | l->rcv_unacked = 0; |
1426 | } else { | 1426 | } else { |
1427 | /* RESET_MSG or ACTIVATE_MSG */ | 1427 | /* RESET_MSG or ACTIVATE_MSG */ |
1428 | if (mtyp == ACTIVATE_MSG) { | ||
1429 | msg_set_dest_session_valid(hdr, 1); | ||
1430 | msg_set_dest_session(hdr, l->peer_session); | ||
1431 | } | ||
1428 | msg_set_max_pkt(hdr, l->advertised_mtu); | 1432 | msg_set_max_pkt(hdr, l->advertised_mtu); |
1429 | strcpy(data, l->if_name); | 1433 | strcpy(data, l->if_name); |
1430 | msg_set_size(hdr, INT_H_SIZE + TIPC_MAX_IF_NAME); | 1434 | msg_set_size(hdr, INT_H_SIZE + TIPC_MAX_IF_NAME); |
@@ -1642,6 +1646,17 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, | |||
1642 | rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); | 1646 | rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); |
1643 | break; | 1647 | break; |
1644 | } | 1648 | } |
1649 | |||
1650 | /* If this endpoint was re-created while peer was ESTABLISHING | ||
1651 | * it doesn't know current session number. Force re-synch. | ||
1652 | */ | ||
1653 | if (mtyp == ACTIVATE_MSG && msg_dest_session_valid(hdr) && | ||
1654 | l->session != msg_dest_session(hdr)) { | ||
1655 | if (less(l->session, msg_dest_session(hdr))) | ||
1656 | l->session = msg_dest_session(hdr) + 1; | ||
1657 | break; | ||
1658 | } | ||
1659 | |||
1645 | /* ACTIVATE_MSG serves as PEER_RESET if link is already down */ | 1660 | /* ACTIVATE_MSG serves as PEER_RESET if link is already down */ |
1646 | if (mtyp == RESET_MSG || !link_is_up(l)) | 1661 | if (mtyp == RESET_MSG || !link_is_up(l)) |
1647 | rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); | 1662 | rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); |
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index a0924956bb61..d7e4b8b93f9d 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -360,6 +360,28 @@ static inline void msg_set_bcast_ack(struct tipc_msg *m, u16 n) | |||
360 | msg_set_bits(m, 1, 0, 0xffff, n); | 360 | msg_set_bits(m, 1, 0, 0xffff, n); |
361 | } | 361 | } |
362 | 362 | ||
363 | /* Note: reusing bits in word 1 for ACTIVATE_MSG only, to re-synch | ||
364 | * link peer session number | ||
365 | */ | ||
366 | static inline bool msg_dest_session_valid(struct tipc_msg *m) | ||
367 | { | ||
368 | return msg_bits(m, 1, 16, 0x1); | ||
369 | } | ||
370 | |||
371 | static inline void msg_set_dest_session_valid(struct tipc_msg *m, bool valid) | ||
372 | { | ||
373 | msg_set_bits(m, 1, 16, 0x1, valid); | ||
374 | } | ||
375 | |||
376 | static inline u16 msg_dest_session(struct tipc_msg *m) | ||
377 | { | ||
378 | return msg_bits(m, 1, 0, 0xffff); | ||
379 | } | ||
380 | |||
381 | static inline void msg_set_dest_session(struct tipc_msg *m, u16 n) | ||
382 | { | ||
383 | msg_set_bits(m, 1, 0, 0xffff, n); | ||
384 | } | ||
363 | 385 | ||
364 | /* | 386 | /* |
365 | * Word 2 | 387 | * Word 2 |
diff --git a/net/tipc/node.c b/net/tipc/node.c index db2a6c3e0be9..2dc4919ab23c 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -830,15 +830,16 @@ static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) | |||
830 | tipc_node_write_lock(n); | 830 | tipc_node_write_lock(n); |
831 | if (!tipc_link_is_establishing(l)) { | 831 | if (!tipc_link_is_establishing(l)) { |
832 | __tipc_node_link_down(n, &bearer_id, &xmitq, &maddr); | 832 | __tipc_node_link_down(n, &bearer_id, &xmitq, &maddr); |
833 | if (delete) { | ||
834 | kfree(l); | ||
835 | le->link = NULL; | ||
836 | n->link_cnt--; | ||
837 | } | ||
838 | } else { | 833 | } else { |
839 | /* Defuse pending tipc_node_link_up() */ | 834 | /* Defuse pending tipc_node_link_up() */ |
835 | tipc_link_reset(l); | ||
840 | tipc_link_fsm_evt(l, LINK_RESET_EVT); | 836 | tipc_link_fsm_evt(l, LINK_RESET_EVT); |
841 | } | 837 | } |
838 | if (delete) { | ||
839 | kfree(l); | ||
840 | le->link = NULL; | ||
841 | n->link_cnt--; | ||
842 | } | ||
842 | trace_tipc_node_link_down(n, true, "node link down or deleted!"); | 843 | trace_tipc_node_link_down(n, true, "node link down or deleted!"); |
843 | tipc_node_write_unlock(n); | 844 | tipc_node_write_unlock(n); |
844 | if (delete) | 845 | if (delete) |
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index c361ce782412..c3d5ab01fba7 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c | |||
@@ -1651,6 +1651,10 @@ static void vmci_transport_cleanup(struct work_struct *work) | |||
1651 | 1651 | ||
1652 | static void vmci_transport_destruct(struct vsock_sock *vsk) | 1652 | static void vmci_transport_destruct(struct vsock_sock *vsk) |
1653 | { | 1653 | { |
1654 | /* transport can be NULL if we hit a failure at init() time */ | ||
1655 | if (!vmci_trans(vsk)) | ||
1656 | return; | ||
1657 | |||
1654 | /* Ensure that the detach callback doesn't use the sk/vsk | 1658 | /* Ensure that the detach callback doesn't use the sk/vsk |
1655 | * we are about to destruct. | 1659 | * we are about to destruct. |
1656 | */ | 1660 | */ |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 623dfe5e211c..b36ad8efb5e5 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -1068,6 +1068,8 @@ static void __cfg80211_unregister_wdev(struct wireless_dev *wdev, bool sync) | |||
1068 | 1068 | ||
1069 | ASSERT_RTNL(); | 1069 | ASSERT_RTNL(); |
1070 | 1070 | ||
1071 | flush_work(&wdev->pmsr_free_wk); | ||
1072 | |||
1071 | nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE); | 1073 | nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE); |
1072 | 1074 | ||
1073 | list_del_rcu(&wdev->list); | 1075 | list_del_rcu(&wdev->list); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index a3cc039b9f55..e36437abc45a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -250,7 +250,7 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = { | |||
250 | [NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION] = | 250 | [NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION] = |
251 | NLA_POLICY_MAX(NLA_U8, 15), | 251 | NLA_POLICY_MAX(NLA_U8, 15), |
252 | [NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST] = | 252 | [NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST] = |
253 | NLA_POLICY_MAX(NLA_U8, 15), | 253 | NLA_POLICY_MAX(NLA_U8, 31), |
254 | [NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES] = { .type = NLA_U8 }, | 254 | [NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES] = { .type = NLA_U8 }, |
255 | [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI] = { .type = NLA_FLAG }, | 255 | [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI] = { .type = NLA_FLAG }, |
256 | [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC] = { .type = NLA_FLAG }, | 256 | [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC] = { .type = NLA_FLAG }, |
diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c index de9286703280..0216ab555249 100644 --- a/net/wireless/pmsr.c +++ b/net/wireless/pmsr.c | |||
@@ -256,8 +256,7 @@ int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info) | |||
256 | if (err) | 256 | if (err) |
257 | goto out_err; | 257 | goto out_err; |
258 | } else { | 258 | } else { |
259 | memcpy(req->mac_addr, nla_data(info->attrs[NL80211_ATTR_MAC]), | 259 | memcpy(req->mac_addr, wdev_address(wdev), ETH_ALEN); |
260 | ETH_ALEN); | ||
261 | memset(req->mac_addr_mask, 0xff, ETH_ALEN); | 260 | memset(req->mac_addr_mask, 0xff, ETH_ALEN); |
262 | } | 261 | } |
263 | 262 | ||
@@ -272,6 +271,7 @@ int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info) | |||
272 | 271 | ||
273 | req->n_peers = count; | 272 | req->n_peers = count; |
274 | req->cookie = cfg80211_assign_cookie(rdev); | 273 | req->cookie = cfg80211_assign_cookie(rdev); |
274 | req->nl_portid = info->snd_portid; | ||
275 | 275 | ||
276 | err = rdev_start_pmsr(rdev, wdev, req); | 276 | err = rdev_start_pmsr(rdev, wdev, req); |
277 | if (err) | 277 | if (err) |
@@ -530,14 +530,14 @@ free: | |||
530 | } | 530 | } |
531 | EXPORT_SYMBOL_GPL(cfg80211_pmsr_report); | 531 | EXPORT_SYMBOL_GPL(cfg80211_pmsr_report); |
532 | 532 | ||
533 | void cfg80211_pmsr_free_wk(struct work_struct *work) | 533 | static void cfg80211_pmsr_process_abort(struct wireless_dev *wdev) |
534 | { | 534 | { |
535 | struct wireless_dev *wdev = container_of(work, struct wireless_dev, | ||
536 | pmsr_free_wk); | ||
537 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); | 535 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
538 | struct cfg80211_pmsr_request *req, *tmp; | 536 | struct cfg80211_pmsr_request *req, *tmp; |
539 | LIST_HEAD(free_list); | 537 | LIST_HEAD(free_list); |
540 | 538 | ||
539 | lockdep_assert_held(&wdev->mtx); | ||
540 | |||
541 | spin_lock_bh(&wdev->pmsr_lock); | 541 | spin_lock_bh(&wdev->pmsr_lock); |
542 | list_for_each_entry_safe(req, tmp, &wdev->pmsr_list, list) { | 542 | list_for_each_entry_safe(req, tmp, &wdev->pmsr_list, list) { |
543 | if (req->nl_portid) | 543 | if (req->nl_portid) |
@@ -547,14 +547,22 @@ void cfg80211_pmsr_free_wk(struct work_struct *work) | |||
547 | spin_unlock_bh(&wdev->pmsr_lock); | 547 | spin_unlock_bh(&wdev->pmsr_lock); |
548 | 548 | ||
549 | list_for_each_entry_safe(req, tmp, &free_list, list) { | 549 | list_for_each_entry_safe(req, tmp, &free_list, list) { |
550 | wdev_lock(wdev); | ||
551 | rdev_abort_pmsr(rdev, wdev, req); | 550 | rdev_abort_pmsr(rdev, wdev, req); |
552 | wdev_unlock(wdev); | ||
553 | 551 | ||
554 | kfree(req); | 552 | kfree(req); |
555 | } | 553 | } |
556 | } | 554 | } |
557 | 555 | ||
556 | void cfg80211_pmsr_free_wk(struct work_struct *work) | ||
557 | { | ||
558 | struct wireless_dev *wdev = container_of(work, struct wireless_dev, | ||
559 | pmsr_free_wk); | ||
560 | |||
561 | wdev_lock(wdev); | ||
562 | cfg80211_pmsr_process_abort(wdev); | ||
563 | wdev_unlock(wdev); | ||
564 | } | ||
565 | |||
558 | void cfg80211_pmsr_wdev_down(struct wireless_dev *wdev) | 566 | void cfg80211_pmsr_wdev_down(struct wireless_dev *wdev) |
559 | { | 567 | { |
560 | struct cfg80211_pmsr_request *req; | 568 | struct cfg80211_pmsr_request *req; |
@@ -568,8 +576,8 @@ void cfg80211_pmsr_wdev_down(struct wireless_dev *wdev) | |||
568 | spin_unlock_bh(&wdev->pmsr_lock); | 576 | spin_unlock_bh(&wdev->pmsr_lock); |
569 | 577 | ||
570 | if (found) | 578 | if (found) |
571 | schedule_work(&wdev->pmsr_free_wk); | 579 | cfg80211_pmsr_process_abort(wdev); |
572 | flush_work(&wdev->pmsr_free_wk); | 580 | |
573 | WARN_ON(!list_empty(&wdev->pmsr_list)); | 581 | WARN_ON(!list_empty(&wdev->pmsr_list)); |
574 | } | 582 | } |
575 | 583 | ||
diff --git a/net/wireless/util.c b/net/wireless/util.c index cd48cdd582c0..ec30e3732c7b 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net> | 5 | * Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net> |
6 | * Copyright 2013-2014 Intel Mobile Communications GmbH | 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
7 | * Copyright 2017 Intel Deutschland GmbH | 7 | * Copyright 2017 Intel Deutschland GmbH |
8 | * Copyright (C) 2018 Intel Corporation | 8 | * Copyright (C) 2018-2019 Intel Corporation |
9 | */ | 9 | */ |
10 | #include <linux/export.h> | 10 | #include <linux/export.h> |
11 | #include <linux/bitops.h> | 11 | #include <linux/bitops.h> |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/mpls.h> | 19 | #include <linux/mpls.h> |
20 | #include <linux/gcd.h> | 20 | #include <linux/gcd.h> |
21 | #include <linux/bitfield.h> | 21 | #include <linux/bitfield.h> |
22 | #include <linux/nospec.h> | ||
22 | #include "core.h" | 23 | #include "core.h" |
23 | #include "rdev-ops.h" | 24 | #include "rdev-ops.h" |
24 | 25 | ||
@@ -715,20 +716,25 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb, | |||
715 | { | 716 | { |
716 | unsigned int dscp; | 717 | unsigned int dscp; |
717 | unsigned char vlan_priority; | 718 | unsigned char vlan_priority; |
719 | unsigned int ret; | ||
718 | 720 | ||
719 | /* skb->priority values from 256->263 are magic values to | 721 | /* skb->priority values from 256->263 are magic values to |
720 | * directly indicate a specific 802.1d priority. This is used | 722 | * directly indicate a specific 802.1d priority. This is used |
721 | * to allow 802.1d priority to be passed directly in from VLAN | 723 | * to allow 802.1d priority to be passed directly in from VLAN |
722 | * tags, etc. | 724 | * tags, etc. |
723 | */ | 725 | */ |
724 | if (skb->priority >= 256 && skb->priority <= 263) | 726 | if (skb->priority >= 256 && skb->priority <= 263) { |
725 | return skb->priority - 256; | 727 | ret = skb->priority - 256; |
728 | goto out; | ||
729 | } | ||
726 | 730 | ||
727 | if (skb_vlan_tag_present(skb)) { | 731 | if (skb_vlan_tag_present(skb)) { |
728 | vlan_priority = (skb_vlan_tag_get(skb) & VLAN_PRIO_MASK) | 732 | vlan_priority = (skb_vlan_tag_get(skb) & VLAN_PRIO_MASK) |
729 | >> VLAN_PRIO_SHIFT; | 733 | >> VLAN_PRIO_SHIFT; |
730 | if (vlan_priority > 0) | 734 | if (vlan_priority > 0) { |
731 | return vlan_priority; | 735 | ret = vlan_priority; |
736 | goto out; | ||
737 | } | ||
732 | } | 738 | } |
733 | 739 | ||
734 | switch (skb->protocol) { | 740 | switch (skb->protocol) { |
@@ -747,8 +753,9 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb, | |||
747 | if (!mpls) | 753 | if (!mpls) |
748 | return 0; | 754 | return 0; |
749 | 755 | ||
750 | return (ntohl(mpls->entry) & MPLS_LS_TC_MASK) | 756 | ret = (ntohl(mpls->entry) & MPLS_LS_TC_MASK) |
751 | >> MPLS_LS_TC_SHIFT; | 757 | >> MPLS_LS_TC_SHIFT; |
758 | goto out; | ||
752 | } | 759 | } |
753 | case htons(ETH_P_80221): | 760 | case htons(ETH_P_80221): |
754 | /* 802.21 is always network control traffic */ | 761 | /* 802.21 is always network control traffic */ |
@@ -761,18 +768,24 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb, | |||
761 | unsigned int i, tmp_dscp = dscp >> 2; | 768 | unsigned int i, tmp_dscp = dscp >> 2; |
762 | 769 | ||
763 | for (i = 0; i < qos_map->num_des; i++) { | 770 | for (i = 0; i < qos_map->num_des; i++) { |
764 | if (tmp_dscp == qos_map->dscp_exception[i].dscp) | 771 | if (tmp_dscp == qos_map->dscp_exception[i].dscp) { |
765 | return qos_map->dscp_exception[i].up; | 772 | ret = qos_map->dscp_exception[i].up; |
773 | goto out; | ||
774 | } | ||
766 | } | 775 | } |
767 | 776 | ||
768 | for (i = 0; i < 8; i++) { | 777 | for (i = 0; i < 8; i++) { |
769 | if (tmp_dscp >= qos_map->up[i].low && | 778 | if (tmp_dscp >= qos_map->up[i].low && |
770 | tmp_dscp <= qos_map->up[i].high) | 779 | tmp_dscp <= qos_map->up[i].high) { |
771 | return i; | 780 | ret = i; |
781 | goto out; | ||
782 | } | ||
772 | } | 783 | } |
773 | } | 784 | } |
774 | 785 | ||
775 | return dscp >> 5; | 786 | ret = dscp >> 5; |
787 | out: | ||
788 | return array_index_nospec(ret, IEEE80211_NUM_TIDS); | ||
776 | } | 789 | } |
777 | EXPORT_SYMBOL(cfg80211_classify8021d); | 790 | EXPORT_SYMBOL(cfg80211_classify8021d); |
778 | 791 | ||
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 5121729b8b63..ec3a828672ef 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -352,17 +352,15 @@ static unsigned int x25_new_lci(struct x25_neigh *nb) | |||
352 | unsigned int lci = 1; | 352 | unsigned int lci = 1; |
353 | struct sock *sk; | 353 | struct sock *sk; |
354 | 354 | ||
355 | read_lock_bh(&x25_list_lock); | 355 | while ((sk = x25_find_socket(lci, nb)) != NULL) { |
356 | |||
357 | while ((sk = __x25_find_socket(lci, nb)) != NULL) { | ||
358 | sock_put(sk); | 356 | sock_put(sk); |
359 | if (++lci == 4096) { | 357 | if (++lci == 4096) { |
360 | lci = 0; | 358 | lci = 0; |
361 | break; | 359 | break; |
362 | } | 360 | } |
361 | cond_resched(); | ||
363 | } | 362 | } |
364 | 363 | ||
365 | read_unlock_bh(&x25_list_lock); | ||
366 | return lci; | 364 | return lci; |
367 | } | 365 | } |
368 | 366 | ||
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 6c99fa8ac5fa..6c0b30391ba9 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -2112,13 +2112,6 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream, | |||
2112 | return 0; | 2112 | return 0; |
2113 | } | 2113 | } |
2114 | 2114 | ||
2115 | /* allow waiting for a capture stream that hasn't been started */ | ||
2116 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) | ||
2117 | #define wait_capture_start(substream) ((substream)->oss.oss) | ||
2118 | #else | ||
2119 | #define wait_capture_start(substream) false | ||
2120 | #endif | ||
2121 | |||
2122 | /* the common loop for read/write data */ | 2115 | /* the common loop for read/write data */ |
2123 | snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, | 2116 | snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, |
2124 | void *data, bool interleaved, | 2117 | void *data, bool interleaved, |
@@ -2184,16 +2177,11 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, | |||
2184 | snd_pcm_update_hw_ptr(substream); | 2177 | snd_pcm_update_hw_ptr(substream); |
2185 | 2178 | ||
2186 | if (!is_playback && | 2179 | if (!is_playback && |
2187 | runtime->status->state == SNDRV_PCM_STATE_PREPARED) { | 2180 | runtime->status->state == SNDRV_PCM_STATE_PREPARED && |
2188 | if (size >= runtime->start_threshold) { | 2181 | size >= runtime->start_threshold) { |
2189 | err = snd_pcm_start(substream); | 2182 | err = snd_pcm_start(substream); |
2190 | if (err < 0) | 2183 | if (err < 0) |
2191 | goto _end_unlock; | ||
2192 | } else if (!wait_capture_start(substream)) { | ||
2193 | /* nothing to do */ | ||
2194 | err = 0; | ||
2195 | goto _end_unlock; | 2184 | goto _end_unlock; |
2196 | } | ||
2197 | } | 2185 | } |
2198 | 2186 | ||
2199 | avail = snd_pcm_avail(substream); | 2187 | avail = snd_pcm_avail(substream); |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 152f54137082..a4ee7656d9ee 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -924,6 +924,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { | |||
924 | SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), | 924 | SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), |
925 | SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), | 925 | SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), |
926 | SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK), | 926 | SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK), |
927 | SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK), | ||
927 | SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), | 928 | SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), |
928 | SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), | 929 | SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), |
929 | SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), | 930 | SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), |
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index d00734d31e04..e5b6769b9797 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c | |||
@@ -795,6 +795,8 @@ static int hdmi_codec_probe(struct platform_device *pdev) | |||
795 | if (hcd->spdif) | 795 | if (hcd->spdif) |
796 | hcp->daidrv[i] = hdmi_spdif_dai; | 796 | hcp->daidrv[i] = hdmi_spdif_dai; |
797 | 797 | ||
798 | dev_set_drvdata(dev, hcp); | ||
799 | |||
798 | ret = devm_snd_soc_register_component(dev, &hdmi_driver, hcp->daidrv, | 800 | ret = devm_snd_soc_register_component(dev, &hdmi_driver, hcp->daidrv, |
799 | dai_count); | 801 | dai_count); |
800 | if (ret) { | 802 | if (ret) { |
@@ -802,8 +804,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) | |||
802 | __func__, ret); | 804 | __func__, ret); |
803 | return ret; | 805 | return ret; |
804 | } | 806 | } |
805 | |||
806 | dev_set_drvdata(dev, hcp); | ||
807 | return 0; | 807 | return 0; |
808 | } | 808 | } |
809 | 809 | ||
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index 89c43b26c379..a9b91bcfcc09 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c | |||
@@ -1778,7 +1778,9 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = { | |||
1778 | {"ADC Stereo1 Filter", NULL, "ADC STO1 ASRC", is_using_asrc}, | 1778 | {"ADC Stereo1 Filter", NULL, "ADC STO1 ASRC", is_using_asrc}, |
1779 | {"DAC Stereo1 Filter", NULL, "DAC STO1 ASRC", is_using_asrc}, | 1779 | {"DAC Stereo1 Filter", NULL, "DAC STO1 ASRC", is_using_asrc}, |
1780 | {"ADC STO1 ASRC", NULL, "AD ASRC"}, | 1780 | {"ADC STO1 ASRC", NULL, "AD ASRC"}, |
1781 | {"ADC STO1 ASRC", NULL, "DA ASRC"}, | ||
1781 | {"ADC STO1 ASRC", NULL, "CLKDET"}, | 1782 | {"ADC STO1 ASRC", NULL, "CLKDET"}, |
1783 | {"DAC STO1 ASRC", NULL, "AD ASRC"}, | ||
1782 | {"DAC STO1 ASRC", NULL, "DA ASRC"}, | 1784 | {"DAC STO1 ASRC", NULL, "DA ASRC"}, |
1783 | {"DAC STO1 ASRC", NULL, "CLKDET"}, | 1785 | {"DAC STO1 ASRC", NULL, "CLKDET"}, |
1784 | 1786 | ||
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index d6c62aa13041..ce00fe2f6aae 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -700,6 +700,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, | |||
700 | { | 700 | { |
701 | struct i2s_dai *i2s = to_info(dai); | 701 | struct i2s_dai *i2s = to_info(dai); |
702 | u32 mod, mask = 0, val = 0; | 702 | u32 mod, mask = 0, val = 0; |
703 | struct clk *rclksrc; | ||
703 | unsigned long flags; | 704 | unsigned long flags; |
704 | 705 | ||
705 | WARN_ON(!pm_runtime_active(dai->dev)); | 706 | WARN_ON(!pm_runtime_active(dai->dev)); |
@@ -782,6 +783,10 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, | |||
782 | 783 | ||
783 | i2s->frmclk = params_rate(params); | 784 | i2s->frmclk = params_rate(params); |
784 | 785 | ||
786 | rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; | ||
787 | if (rclksrc && !IS_ERR(rclksrc)) | ||
788 | i2s->rclk_srcrate = clk_get_rate(rclksrc); | ||
789 | |||
785 | return 0; | 790 | return 0; |
786 | } | 791 | } |
787 | 792 | ||
@@ -886,11 +891,6 @@ static int config_setup(struct i2s_dai *i2s) | |||
886 | return 0; | 891 | return 0; |
887 | 892 | ||
888 | if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { | 893 | if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { |
889 | struct clk *rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; | ||
890 | |||
891 | if (rclksrc && !IS_ERR(rclksrc)) | ||
892 | i2s->rclk_srcrate = clk_get_rate(rclksrc); | ||
893 | |||
894 | psr = i2s->rclk_srcrate / i2s->frmclk / rfs; | 894 | psr = i2s->rclk_srcrate / i2s->frmclk / rfs; |
895 | writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR); | 895 | writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR); |
896 | dev_dbg(&i2s->pdev->dev, | 896 | dev_dbg(&i2s->pdev->dev, |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 59e250cc2e9d..e819e965e1db 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -1526,14 +1526,14 @@ int rsnd_kctrl_new(struct rsnd_mod *mod, | |||
1526 | int ret; | 1526 | int ret; |
1527 | 1527 | ||
1528 | /* | 1528 | /* |
1529 | * 1) Avoid duplicate register (ex. MIXer case) | 1529 | * 1) Avoid duplicate register for DVC with MIX case |
1530 | * 2) re-register if card was rebinded | 1530 | * 2) Allow duplicate register for MIX |
1531 | * 3) re-register if card was rebinded | ||
1531 | */ | 1532 | */ |
1532 | list_for_each_entry(kctrl, &card->controls, list) { | 1533 | list_for_each_entry(kctrl, &card->controls, list) { |
1533 | struct rsnd_kctrl_cfg *c = kctrl->private_data; | 1534 | struct rsnd_kctrl_cfg *c = kctrl->private_data; |
1534 | 1535 | ||
1535 | if (strcmp(kctrl->id.name, name) == 0 && | 1536 | if (c == cfg) |
1536 | c->mod == mod) | ||
1537 | return 0; | 1537 | return 0; |
1538 | } | 1538 | } |
1539 | 1539 | ||
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 45ef295743ec..f5afab631abb 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -286,7 +286,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, | |||
286 | if (rsnd_ssi_is_multi_slave(mod, io)) | 286 | if (rsnd_ssi_is_multi_slave(mod, io)) |
287 | return 0; | 287 | return 0; |
288 | 288 | ||
289 | if (ssi->usrcnt > 1) { | 289 | if (ssi->usrcnt > 0) { |
290 | if (ssi->rate != rate) { | 290 | if (ssi->rate != rate) { |
291 | dev_err(dev, "SSI parent/child should use same rate\n"); | 291 | dev_err(dev, "SSI parent/child should use same rate\n"); |
292 | return -EINVAL; | 292 | return -EINVAL; |
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c index c5934adcfd01..c74991dd18ab 100644 --- a/sound/soc/sh/rcar/ssiu.c +++ b/sound/soc/sh/rcar/ssiu.c | |||
@@ -79,7 +79,7 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod, | |||
79 | break; | 79 | break; |
80 | case 9: | 80 | case 9: |
81 | for (i = 0; i < 4; i++) | 81 | for (i = 0; i < 4; i++) |
82 | rsnd_mod_write(mod, SSI_SYS_STATUS((i * 2) + 1), 0xf << (id * 4)); | 82 | rsnd_mod_write(mod, SSI_SYS_STATUS((i * 2) + 1), 0xf << 4); |
83 | break; | 83 | break; |
84 | } | 84 | } |
85 | 85 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index aae450ba4f08..50617db05c46 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -735,12 +735,17 @@ static struct snd_soc_component *soc_find_component( | |||
735 | const struct device_node *of_node, const char *name) | 735 | const struct device_node *of_node, const char *name) |
736 | { | 736 | { |
737 | struct snd_soc_component *component; | 737 | struct snd_soc_component *component; |
738 | struct device_node *component_of_node; | ||
738 | 739 | ||
739 | lockdep_assert_held(&client_mutex); | 740 | lockdep_assert_held(&client_mutex); |
740 | 741 | ||
741 | for_each_component(component) { | 742 | for_each_component(component) { |
742 | if (of_node) { | 743 | if (of_node) { |
743 | if (component->dev->of_node == of_node) | 744 | component_of_node = component->dev->of_node; |
745 | if (!component_of_node && component->dev->parent) | ||
746 | component_of_node = component->dev->parent->of_node; | ||
747 | |||
748 | if (component_of_node == of_node) | ||
744 | return component; | 749 | return component; |
745 | } else if (name && strcmp(component->name, name) == 0) { | 750 | } else if (name && strcmp(component->name, name) == 0) { |
746 | return component; | 751 | return component; |
@@ -951,7 +956,7 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order) | |||
951 | { | 956 | { |
952 | int err; | 957 | int err; |
953 | 958 | ||
954 | if (!dai || !dai->probed || | 959 | if (!dai || !dai->probed || !dai->driver || |
955 | dai->driver->remove_order != order) | 960 | dai->driver->remove_order != order) |
956 | return; | 961 | return; |
957 | 962 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 2c4c13419539..20bad755888b 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -70,12 +70,16 @@ static int dapm_up_seq[] = { | |||
70 | [snd_soc_dapm_clock_supply] = 1, | 70 | [snd_soc_dapm_clock_supply] = 1, |
71 | [snd_soc_dapm_supply] = 2, | 71 | [snd_soc_dapm_supply] = 2, |
72 | [snd_soc_dapm_micbias] = 3, | 72 | [snd_soc_dapm_micbias] = 3, |
73 | [snd_soc_dapm_vmid] = 3, | ||
73 | [snd_soc_dapm_dai_link] = 2, | 74 | [snd_soc_dapm_dai_link] = 2, |
74 | [snd_soc_dapm_dai_in] = 4, | 75 | [snd_soc_dapm_dai_in] = 4, |
75 | [snd_soc_dapm_dai_out] = 4, | 76 | [snd_soc_dapm_dai_out] = 4, |
76 | [snd_soc_dapm_aif_in] = 4, | 77 | [snd_soc_dapm_aif_in] = 4, |
77 | [snd_soc_dapm_aif_out] = 4, | 78 | [snd_soc_dapm_aif_out] = 4, |
78 | [snd_soc_dapm_mic] = 5, | 79 | [snd_soc_dapm_mic] = 5, |
80 | [snd_soc_dapm_siggen] = 5, | ||
81 | [snd_soc_dapm_input] = 5, | ||
82 | [snd_soc_dapm_output] = 5, | ||
79 | [snd_soc_dapm_mux] = 6, | 83 | [snd_soc_dapm_mux] = 6, |
80 | [snd_soc_dapm_demux] = 6, | 84 | [snd_soc_dapm_demux] = 6, |
81 | [snd_soc_dapm_dac] = 7, | 85 | [snd_soc_dapm_dac] = 7, |
@@ -83,11 +87,19 @@ static int dapm_up_seq[] = { | |||
83 | [snd_soc_dapm_mixer] = 8, | 87 | [snd_soc_dapm_mixer] = 8, |
84 | [snd_soc_dapm_mixer_named_ctl] = 8, | 88 | [snd_soc_dapm_mixer_named_ctl] = 8, |
85 | [snd_soc_dapm_pga] = 9, | 89 | [snd_soc_dapm_pga] = 9, |
90 | [snd_soc_dapm_buffer] = 9, | ||
91 | [snd_soc_dapm_scheduler] = 9, | ||
92 | [snd_soc_dapm_effect] = 9, | ||
93 | [snd_soc_dapm_src] = 9, | ||
94 | [snd_soc_dapm_asrc] = 9, | ||
95 | [snd_soc_dapm_encoder] = 9, | ||
96 | [snd_soc_dapm_decoder] = 9, | ||
86 | [snd_soc_dapm_adc] = 10, | 97 | [snd_soc_dapm_adc] = 10, |
87 | [snd_soc_dapm_out_drv] = 11, | 98 | [snd_soc_dapm_out_drv] = 11, |
88 | [snd_soc_dapm_hp] = 11, | 99 | [snd_soc_dapm_hp] = 11, |
89 | [snd_soc_dapm_spk] = 11, | 100 | [snd_soc_dapm_spk] = 11, |
90 | [snd_soc_dapm_line] = 11, | 101 | [snd_soc_dapm_line] = 11, |
102 | [snd_soc_dapm_sink] = 11, | ||
91 | [snd_soc_dapm_kcontrol] = 12, | 103 | [snd_soc_dapm_kcontrol] = 12, |
92 | [snd_soc_dapm_post] = 13, | 104 | [snd_soc_dapm_post] = 13, |
93 | }; | 105 | }; |
@@ -100,13 +112,25 @@ static int dapm_down_seq[] = { | |||
100 | [snd_soc_dapm_spk] = 3, | 112 | [snd_soc_dapm_spk] = 3, |
101 | [snd_soc_dapm_line] = 3, | 113 | [snd_soc_dapm_line] = 3, |
102 | [snd_soc_dapm_out_drv] = 3, | 114 | [snd_soc_dapm_out_drv] = 3, |
115 | [snd_soc_dapm_sink] = 3, | ||
103 | [snd_soc_dapm_pga] = 4, | 116 | [snd_soc_dapm_pga] = 4, |
117 | [snd_soc_dapm_buffer] = 4, | ||
118 | [snd_soc_dapm_scheduler] = 4, | ||
119 | [snd_soc_dapm_effect] = 4, | ||
120 | [snd_soc_dapm_src] = 4, | ||
121 | [snd_soc_dapm_asrc] = 4, | ||
122 | [snd_soc_dapm_encoder] = 4, | ||
123 | [snd_soc_dapm_decoder] = 4, | ||
104 | [snd_soc_dapm_switch] = 5, | 124 | [snd_soc_dapm_switch] = 5, |
105 | [snd_soc_dapm_mixer_named_ctl] = 5, | 125 | [snd_soc_dapm_mixer_named_ctl] = 5, |
106 | [snd_soc_dapm_mixer] = 5, | 126 | [snd_soc_dapm_mixer] = 5, |
107 | [snd_soc_dapm_dac] = 6, | 127 | [snd_soc_dapm_dac] = 6, |
108 | [snd_soc_dapm_mic] = 7, | 128 | [snd_soc_dapm_mic] = 7, |
129 | [snd_soc_dapm_siggen] = 7, | ||
130 | [snd_soc_dapm_input] = 7, | ||
131 | [snd_soc_dapm_output] = 7, | ||
109 | [snd_soc_dapm_micbias] = 8, | 132 | [snd_soc_dapm_micbias] = 8, |
133 | [snd_soc_dapm_vmid] = 8, | ||
110 | [snd_soc_dapm_mux] = 9, | 134 | [snd_soc_dapm_mux] = 9, |
111 | [snd_soc_dapm_demux] = 9, | 135 | [snd_soc_dapm_demux] = 9, |
112 | [snd_soc_dapm_aif_in] = 10, | 136 | [snd_soc_dapm_aif_in] = 10, |
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 045ef136903d..fc79ec6927e3 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c | |||
@@ -502,6 +502,7 @@ static void remove_dai(struct snd_soc_component *comp, | |||
502 | { | 502 | { |
503 | struct snd_soc_dai_driver *dai_drv = | 503 | struct snd_soc_dai_driver *dai_drv = |
504 | container_of(dobj, struct snd_soc_dai_driver, dobj); | 504 | container_of(dobj, struct snd_soc_dai_driver, dobj); |
505 | struct snd_soc_dai *dai; | ||
505 | 506 | ||
506 | if (pass != SOC_TPLG_PASS_PCM_DAI) | 507 | if (pass != SOC_TPLG_PASS_PCM_DAI) |
507 | return; | 508 | return; |
@@ -509,6 +510,10 @@ static void remove_dai(struct snd_soc_component *comp, | |||
509 | if (dobj->ops && dobj->ops->dai_unload) | 510 | if (dobj->ops && dobj->ops->dai_unload) |
510 | dobj->ops->dai_unload(comp, dobj); | 511 | dobj->ops->dai_unload(comp, dobj); |
511 | 512 | ||
513 | list_for_each_entry(dai, &comp->dai_list, list) | ||
514 | if (dai->driver == dai_drv) | ||
515 | dai->driver = NULL; | ||
516 | |||
512 | kfree(dai_drv->name); | 517 | kfree(dai_drv->name); |
513 | list_del(&dobj->list); | 518 | list_del(&dobj->list); |
514 | kfree(dai_drv); | 519 | kfree(dai_drv); |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 382847154227..db114f3977e0 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -314,6 +314,9 @@ static int search_roland_implicit_fb(struct usb_device *dev, int ifnum, | |||
314 | return 0; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | /* Setup an implicit feedback endpoint from a quirk. Returns 0 if no quirk | ||
318 | * applies. Returns 1 if a quirk was found. | ||
319 | */ | ||
317 | static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, | 320 | static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, |
318 | struct usb_device *dev, | 321 | struct usb_device *dev, |
319 | struct usb_interface_descriptor *altsd, | 322 | struct usb_interface_descriptor *altsd, |
@@ -384,7 +387,7 @@ add_sync_ep: | |||
384 | 387 | ||
385 | subs->data_endpoint->sync_master = subs->sync_endpoint; | 388 | subs->data_endpoint->sync_master = subs->sync_endpoint; |
386 | 389 | ||
387 | return 0; | 390 | return 1; |
388 | } | 391 | } |
389 | 392 | ||
390 | static int set_sync_endpoint(struct snd_usb_substream *subs, | 393 | static int set_sync_endpoint(struct snd_usb_substream *subs, |
@@ -423,6 +426,10 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, | |||
423 | if (err < 0) | 426 | if (err < 0) |
424 | return err; | 427 | return err; |
425 | 428 | ||
429 | /* endpoint set by quirk */ | ||
430 | if (err > 0) | ||
431 | return 0; | ||
432 | |||
426 | if (altsd->bNumEndpoints < 2) | 433 | if (altsd->bNumEndpoints < 2) |
427 | return 0; | 434 | return 0; |
428 | 435 | ||
diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h index fd92ce8388fc..57aaeaf8e192 100644 --- a/tools/include/uapi/asm/bitsperlong.h +++ b/tools/include/uapi/asm/bitsperlong.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #include "../../arch/ia64/include/uapi/asm/bitsperlong.h" | 15 | #include "../../arch/ia64/include/uapi/asm/bitsperlong.h" |
16 | #elif defined(__riscv) | 16 | #elif defined(__riscv) |
17 | #include "../../arch/riscv/include/uapi/asm/bitsperlong.h" | 17 | #include "../../arch/riscv/include/uapi/asm/bitsperlong.h" |
18 | #elif defined(__alpha__) | ||
19 | #include "../../arch/alpha/include/uapi/asm/bitsperlong.h" | ||
18 | #else | 20 | #else |
19 | #include <asm-generic/bitsperlong.h> | 21 | #include <asm-generic/bitsperlong.h> |
20 | #endif | 22 | #endif |
diff --git a/tools/include/uapi/linux/in.h b/tools/include/uapi/linux/in.h index f6052e70bf40..a55cb8b10165 100644 --- a/tools/include/uapi/linux/in.h +++ b/tools/include/uapi/linux/in.h | |||
@@ -268,7 +268,7 @@ struct sockaddr_in { | |||
268 | #define IN_MULTICAST(a) IN_CLASSD(a) | 268 | #define IN_MULTICAST(a) IN_CLASSD(a) |
269 | #define IN_MULTICAST_NET 0xe0000000 | 269 | #define IN_MULTICAST_NET 0xe0000000 |
270 | 270 | ||
271 | #define IN_BADCLASS(a) ((((long int) (a) ) == 0xffffffff) | 271 | #define IN_BADCLASS(a) (((long int) (a) ) == (long int)0xffffffff) |
272 | #define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) | 272 | #define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) |
273 | 273 | ||
274 | #define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) | 274 | #define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) |
diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentation/perf-c2c.txt index 095aebdc5bb7..e6150f21267d 100644 --- a/tools/perf/Documentation/perf-c2c.txt +++ b/tools/perf/Documentation/perf-c2c.txt | |||
@@ -19,8 +19,11 @@ C2C stands for Cache To Cache. | |||
19 | The perf c2c tool provides means for Shared Data C2C/HITM analysis. It allows | 19 | The perf c2c tool provides means for Shared Data C2C/HITM analysis. It allows |
20 | you to track down the cacheline contentions. | 20 | you to track down the cacheline contentions. |
21 | 21 | ||
22 | The tool is based on x86's load latency and precise store facility events | 22 | On x86, the tool is based on load latency and precise store facility events |
23 | provided by Intel CPUs. These events provide: | 23 | provided by Intel CPUs. On PowerPC, the tool uses random instruction sampling |
24 | with thresholding feature. | ||
25 | |||
26 | These events provide: | ||
24 | - memory address of the access | 27 | - memory address of the access |
25 | - type of the access (load and store details) | 28 | - type of the access (load and store details) |
26 | - latency (in cycles) of the load access | 29 | - latency (in cycles) of the load access |
@@ -46,7 +49,7 @@ RECORD OPTIONS | |||
46 | 49 | ||
47 | -l:: | 50 | -l:: |
48 | --ldlat:: | 51 | --ldlat:: |
49 | Configure mem-loads latency. | 52 | Configure mem-loads latency. (x86 only) |
50 | 53 | ||
51 | -k:: | 54 | -k:: |
52 | --all-kernel:: | 55 | --all-kernel:: |
@@ -119,11 +122,16 @@ Following perf record options are configured by default: | |||
119 | -W,-d,--phys-data,--sample-cpu | 122 | -W,-d,--phys-data,--sample-cpu |
120 | 123 | ||
121 | Unless specified otherwise with '-e' option, following events are monitored by | 124 | Unless specified otherwise with '-e' option, following events are monitored by |
122 | default: | 125 | default on x86: |
123 | 126 | ||
124 | cpu/mem-loads,ldlat=30/P | 127 | cpu/mem-loads,ldlat=30/P |
125 | cpu/mem-stores/P | 128 | cpu/mem-stores/P |
126 | 129 | ||
130 | and following on PowerPC: | ||
131 | |||
132 | cpu/mem-loads/ | ||
133 | cpu/mem-stores/ | ||
134 | |||
127 | User can pass any 'perf record' option behind '--' mark, like (to enable | 135 | User can pass any 'perf record' option behind '--' mark, like (to enable |
128 | callchains and system wide monitoring): | 136 | callchains and system wide monitoring): |
129 | 137 | ||
diff --git a/tools/perf/Documentation/perf-mem.txt b/tools/perf/Documentation/perf-mem.txt index f8d2167cf3e7..199ea0f0a6c0 100644 --- a/tools/perf/Documentation/perf-mem.txt +++ b/tools/perf/Documentation/perf-mem.txt | |||
@@ -82,7 +82,7 @@ RECORD OPTIONS | |||
82 | Be more verbose (show counter open errors, etc) | 82 | Be more verbose (show counter open errors, etc) |
83 | 83 | ||
84 | --ldlat <n>:: | 84 | --ldlat <n>:: |
85 | Specify desired latency for loads event. | 85 | Specify desired latency for loads event. (x86 only) |
86 | 86 | ||
87 | In addition, for report all perf report options are valid, and for record | 87 | In addition, for report all perf report options are valid, and for record |
88 | all perf record options. | 88 | all perf record options. |
diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build index 2e6595310420..ba98bd006488 100644 --- a/tools/perf/arch/powerpc/util/Build +++ b/tools/perf/arch/powerpc/util/Build | |||
@@ -2,6 +2,7 @@ libperf-y += header.o | |||
2 | libperf-y += sym-handling.o | 2 | libperf-y += sym-handling.o |
3 | libperf-y += kvm-stat.o | 3 | libperf-y += kvm-stat.o |
4 | libperf-y += perf_regs.o | 4 | libperf-y += perf_regs.o |
5 | libperf-y += mem-events.o | ||
5 | 6 | ||
6 | libperf-$(CONFIG_DWARF) += dwarf-regs.o | 7 | libperf-$(CONFIG_DWARF) += dwarf-regs.o |
7 | libperf-$(CONFIG_DWARF) += skip-callchain-idx.o | 8 | libperf-$(CONFIG_DWARF) += skip-callchain-idx.o |
diff --git a/tools/perf/arch/powerpc/util/mem-events.c b/tools/perf/arch/powerpc/util/mem-events.c new file mode 100644 index 000000000000..d08311f04e95 --- /dev/null +++ b/tools/perf/arch/powerpc/util/mem-events.c | |||
@@ -0,0 +1,11 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | #include "mem-events.h" | ||
3 | |||
4 | /* PowerPC does not support 'ldlat' parameter. */ | ||
5 | char *perf_mem_events__name(int i) | ||
6 | { | ||
7 | if (i == PERF_MEM_EVENTS__LOAD) | ||
8 | return (char *) "cpu/mem-loads/"; | ||
9 | |||
10 | return (char *) "cpu/mem-stores/"; | ||
11 | } | ||
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index ed4583128b9c..b36061cd1ab8 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -2514,19 +2514,30 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); | |||
2514 | 2514 | ||
2515 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) | 2515 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) |
2516 | { | 2516 | { |
2517 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); | 2517 | bool found = false; |
2518 | struct perf_evsel *evsel, *tmp; | ||
2519 | struct parse_events_error err = { .idx = 0, }; | ||
2520 | int ret = parse_events(evlist, "probe:vfs_getname*", &err); | ||
2518 | 2521 | ||
2519 | if (IS_ERR(evsel)) | 2522 | if (ret) |
2520 | return false; | 2523 | return false; |
2521 | 2524 | ||
2522 | if (perf_evsel__field(evsel, "pathname") == NULL) { | 2525 | evlist__for_each_entry_safe(evlist, evsel, tmp) { |
2526 | if (!strstarts(perf_evsel__name(evsel), "probe:vfs_getname")) | ||
2527 | continue; | ||
2528 | |||
2529 | if (perf_evsel__field(evsel, "pathname")) { | ||
2530 | evsel->handler = trace__vfs_getname; | ||
2531 | found = true; | ||
2532 | continue; | ||
2533 | } | ||
2534 | |||
2535 | list_del_init(&evsel->node); | ||
2536 | evsel->evlist = NULL; | ||
2523 | perf_evsel__delete(evsel); | 2537 | perf_evsel__delete(evsel); |
2524 | return false; | ||
2525 | } | 2538 | } |
2526 | 2539 | ||
2527 | evsel->handler = trace__vfs_getname; | 2540 | return found; |
2528 | perf_evlist__add(evlist, evsel); | ||
2529 | return true; | ||
2530 | } | 2541 | } |
2531 | 2542 | ||
2532 | static struct perf_evsel *perf_evsel__new_pgfault(u64 config) | 2543 | static struct perf_evsel *perf_evsel__new_pgfault(u64 config) |
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py index 44090a9a19f3..e952127e4fb0 100644 --- a/tools/perf/tests/attr.py +++ b/tools/perf/tests/attr.py | |||
@@ -1,6 +1,8 @@ | |||
1 | #! /usr/bin/python | 1 | #! /usr/bin/python |
2 | # SPDX-License-Identifier: GPL-2.0 | 2 | # SPDX-License-Identifier: GPL-2.0 |
3 | 3 | ||
4 | from __future__ import print_function | ||
5 | |||
4 | import os | 6 | import os |
5 | import sys | 7 | import sys |
6 | import glob | 8 | import glob |
@@ -8,7 +10,11 @@ import optparse | |||
8 | import tempfile | 10 | import tempfile |
9 | import logging | 11 | import logging |
10 | import shutil | 12 | import shutil |
11 | import ConfigParser | 13 | |
14 | try: | ||
15 | import configparser | ||
16 | except ImportError: | ||
17 | import ConfigParser as configparser | ||
12 | 18 | ||
13 | def data_equal(a, b): | 19 | def data_equal(a, b): |
14 | # Allow multiple values in assignment separated by '|' | 20 | # Allow multiple values in assignment separated by '|' |
@@ -100,20 +106,20 @@ class Event(dict): | |||
100 | def equal(self, other): | 106 | def equal(self, other): |
101 | for t in Event.terms: | 107 | for t in Event.terms: |
102 | log.debug(" [%s] %s %s" % (t, self[t], other[t])); | 108 | log.debug(" [%s] %s %s" % (t, self[t], other[t])); |
103 | if not self.has_key(t) or not other.has_key(t): | 109 | if t not in self or t not in other: |
104 | return False | 110 | return False |
105 | if not data_equal(self[t], other[t]): | 111 | if not data_equal(self[t], other[t]): |
106 | return False | 112 | return False |
107 | return True | 113 | return True |
108 | 114 | ||
109 | def optional(self): | 115 | def optional(self): |
110 | if self.has_key('optional') and self['optional'] == '1': | 116 | if 'optional' in self and self['optional'] == '1': |
111 | return True | 117 | return True |
112 | return False | 118 | return False |
113 | 119 | ||
114 | def diff(self, other): | 120 | def diff(self, other): |
115 | for t in Event.terms: | 121 | for t in Event.terms: |
116 | if not self.has_key(t) or not other.has_key(t): | 122 | if t not in self or t not in other: |
117 | continue | 123 | continue |
118 | if not data_equal(self[t], other[t]): | 124 | if not data_equal(self[t], other[t]): |
119 | log.warning("expected %s=%s, got %s" % (t, self[t], other[t])) | 125 | log.warning("expected %s=%s, got %s" % (t, self[t], other[t])) |
@@ -134,7 +140,7 @@ class Event(dict): | |||
134 | # - expected values assignments | 140 | # - expected values assignments |
135 | class Test(object): | 141 | class Test(object): |
136 | def __init__(self, path, options): | 142 | def __init__(self, path, options): |
137 | parser = ConfigParser.SafeConfigParser() | 143 | parser = configparser.SafeConfigParser() |
138 | parser.read(path) | 144 | parser.read(path) |
139 | 145 | ||
140 | log.warning("running '%s'" % path) | 146 | log.warning("running '%s'" % path) |
@@ -193,7 +199,7 @@ class Test(object): | |||
193 | return True | 199 | return True |
194 | 200 | ||
195 | def load_events(self, path, events): | 201 | def load_events(self, path, events): |
196 | parser_event = ConfigParser.SafeConfigParser() | 202 | parser_event = configparser.SafeConfigParser() |
197 | parser_event.read(path) | 203 | parser_event.read(path) |
198 | 204 | ||
199 | # The event record section header contains 'event' word, | 205 | # The event record section header contains 'event' word, |
@@ -207,7 +213,7 @@ class Test(object): | |||
207 | # Read parent event if there's any | 213 | # Read parent event if there's any |
208 | if (':' in section): | 214 | if (':' in section): |
209 | base = section[section.index(':') + 1:] | 215 | base = section[section.index(':') + 1:] |
210 | parser_base = ConfigParser.SafeConfigParser() | 216 | parser_base = configparser.SafeConfigParser() |
211 | parser_base.read(self.test_dir + '/' + base) | 217 | parser_base.read(self.test_dir + '/' + base) |
212 | base_items = parser_base.items('event') | 218 | base_items = parser_base.items('event') |
213 | 219 | ||
@@ -322,9 +328,9 @@ def run_tests(options): | |||
322 | for f in glob.glob(options.test_dir + '/' + options.test): | 328 | for f in glob.glob(options.test_dir + '/' + options.test): |
323 | try: | 329 | try: |
324 | Test(f, options).run() | 330 | Test(f, options).run() |
325 | except Unsup, obj: | 331 | except Unsup as obj: |
326 | log.warning("unsupp %s" % obj.getMsg()) | 332 | log.warning("unsupp %s" % obj.getMsg()) |
327 | except Notest, obj: | 333 | except Notest as obj: |
328 | log.warning("skipped %s" % obj.getMsg()) | 334 | log.warning("skipped %s" % obj.getMsg()) |
329 | 335 | ||
330 | def setup_log(verbose): | 336 | def setup_log(verbose): |
@@ -363,7 +369,7 @@ def main(): | |||
363 | parser.add_option("-p", "--perf", | 369 | parser.add_option("-p", "--perf", |
364 | action="store", type="string", dest="perf") | 370 | action="store", type="string", dest="perf") |
365 | parser.add_option("-v", "--verbose", | 371 | parser.add_option("-v", "--verbose", |
366 | action="count", dest="verbose") | 372 | default=0, action="count", dest="verbose") |
367 | 373 | ||
368 | options, args = parser.parse_args() | 374 | options, args = parser.parse_args() |
369 | if args: | 375 | if args: |
@@ -373,7 +379,7 @@ def main(): | |||
373 | setup_log(options.verbose) | 379 | setup_log(options.verbose) |
374 | 380 | ||
375 | if not options.test_dir: | 381 | if not options.test_dir: |
376 | print 'FAILED no -d option specified' | 382 | print('FAILED no -d option specified') |
377 | sys.exit(-1) | 383 | sys.exit(-1) |
378 | 384 | ||
379 | if not options.test: | 385 | if not options.test: |
@@ -382,8 +388,8 @@ def main(): | |||
382 | try: | 388 | try: |
383 | run_tests(options) | 389 | run_tests(options) |
384 | 390 | ||
385 | except Fail, obj: | 391 | except Fail as obj: |
386 | print "FAILED %s" % obj.getMsg(); | 392 | print("FAILED %s" % obj.getMsg()) |
387 | sys.exit(-1) | 393 | sys.exit(-1) |
388 | 394 | ||
389 | sys.exit(0) | 395 | sys.exit(0) |
diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c index 5f8501c68da4..5cbba70bcdd0 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c | |||
@@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, | |||
17 | return -1; | 17 | return -1; |
18 | } | 18 | } |
19 | 19 | ||
20 | is_signed = !!(field->flags | TEP_FIELD_IS_SIGNED); | 20 | is_signed = !!(field->flags & TEP_FIELD_IS_SIGNED); |
21 | if (should_be_signed && !is_signed) { | 21 | if (should_be_signed && !is_signed) { |
22 | pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n", | 22 | pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n", |
23 | evsel->name, name, is_signed, should_be_signed); | 23 | evsel->name, name, is_signed, should_be_signed); |
diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp index 89512504551b..39c0004f2886 100644 --- a/tools/perf/util/c++/clang.cpp +++ b/tools/perf/util/c++/clang.cpp | |||
@@ -160,7 +160,7 @@ getBPFObjectFromModule(llvm::Module *Module) | |||
160 | } | 160 | } |
161 | PM.run(*Module); | 161 | PM.run(*Module); |
162 | 162 | ||
163 | return std::move(Buffer); | 163 | return Buffer; |
164 | } | 164 | } |
165 | 165 | ||
166 | } | 166 | } |
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index 93f74d8d3cdd..42c3e5a229d2 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c | |||
@@ -28,7 +28,7 @@ struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = { | |||
28 | static char mem_loads_name[100]; | 28 | static char mem_loads_name[100]; |
29 | static bool mem_loads_name__init; | 29 | static bool mem_loads_name__init; |
30 | 30 | ||
31 | char *perf_mem_events__name(int i) | 31 | char * __weak perf_mem_events__name(int i) |
32 | { | 32 | { |
33 | if (i == PERF_MEM_EVENTS__LOAD) { | 33 | if (i == PERF_MEM_EVENTS__LOAD) { |
34 | if (!mem_loads_name__init) { | 34 | if (!mem_loads_name__init) { |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 66a84d5846c8..dca7dfae69ad 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -19,6 +19,20 @@ | |||
19 | #define EM_AARCH64 183 /* ARM 64 bit */ | 19 | #define EM_AARCH64 183 /* ARM 64 bit */ |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifndef ELF32_ST_VISIBILITY | ||
23 | #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) | ||
24 | #endif | ||
25 | |||
26 | /* For ELF64 the definitions are the same. */ | ||
27 | #ifndef ELF64_ST_VISIBILITY | ||
28 | #define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) | ||
29 | #endif | ||
30 | |||
31 | /* How to extract information held in the st_other field. */ | ||
32 | #ifndef GELF_ST_VISIBILITY | ||
33 | #define GELF_ST_VISIBILITY(val) ELF64_ST_VISIBILITY (val) | ||
34 | #endif | ||
35 | |||
22 | typedef Elf64_Nhdr GElf_Nhdr; | 36 | typedef Elf64_Nhdr GElf_Nhdr; |
23 | 37 | ||
24 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT | 38 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
@@ -87,6 +101,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) | |||
87 | return GELF_ST_TYPE(sym->st_info); | 101 | return GELF_ST_TYPE(sym->st_info); |
88 | } | 102 | } |
89 | 103 | ||
104 | static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) | ||
105 | { | ||
106 | return GELF_ST_VISIBILITY(sym->st_other); | ||
107 | } | ||
108 | |||
90 | #ifndef STT_GNU_IFUNC | 109 | #ifndef STT_GNU_IFUNC |
91 | #define STT_GNU_IFUNC 10 | 110 | #define STT_GNU_IFUNC 10 |
92 | #endif | 111 | #endif |
@@ -111,7 +130,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) | |||
111 | return elf_sym__type(sym) == STT_NOTYPE && | 130 | return elf_sym__type(sym) == STT_NOTYPE && |
112 | sym->st_name != 0 && | 131 | sym->st_name != 0 && |
113 | sym->st_shndx != SHN_UNDEF && | 132 | sym->st_shndx != SHN_UNDEF && |
114 | sym->st_shndx != SHN_ABS; | 133 | sym->st_shndx != SHN_ABS && |
134 | elf_sym__visibility(sym) != STV_HIDDEN && | ||
135 | elf_sym__visibility(sym) != STV_INTERNAL; | ||
115 | } | 136 | } |
116 | 137 | ||
117 | static bool elf_sym__filter(GElf_Sym *sym) | 138 | static bool elf_sym__filter(GElf_Sym *sym) |
diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile index 9050eeea5f5f..1de8bd8ccf5d 100644 --- a/tools/testing/selftests/networking/timestamping/Makefile +++ b/tools/testing/selftests/networking/timestamping/Makefile | |||
@@ -9,6 +9,3 @@ all: $(TEST_PROGS) | |||
9 | top_srcdir = ../../../../.. | 9 | top_srcdir = ../../../../.. |
10 | KSFT_KHDR_INSTALL := 1 | 10 | KSFT_KHDR_INSTALL := 1 |
11 | include ../../lib.mk | 11 | include ../../lib.mk |
12 | |||
13 | clean: | ||
14 | rm -fr $(TEST_GEN_FILES) | ||