diff options
304 files changed, 2911 insertions, 1776 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 9871e649ffef..64a3bf54b974 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
@@ -3523,6 +3523,12 @@ | |||
3523 | ramdisk_size= [RAM] Sizes of RAM disks in kilobytes | 3523 | ramdisk_size= [RAM] Sizes of RAM disks in kilobytes |
3524 | See Documentation/blockdev/ramdisk.txt. | 3524 | See Documentation/blockdev/ramdisk.txt. |
3525 | 3525 | ||
3526 | random.trust_cpu={on,off} | ||
3527 | [KNL] Enable or disable trusting the use of the | ||
3528 | CPU's random number generator (if available) to | ||
3529 | fully seed the kernel's CRNG. Default is controlled | ||
3530 | by CONFIG_RANDOM_TRUST_CPU. | ||
3531 | |||
3526 | ras=option[,option,...] [KNL] RAS-specific options | 3532 | ras=option[,option,...] [KNL] RAS-specific options |
3527 | 3533 | ||
3528 | cec_disable [X86] | 3534 | cec_disable [X86] |
diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.txt b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.txt index 00e4365d7206..091c8dfd3229 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.txt | |||
@@ -3,7 +3,6 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : | 4 | - compatible : |
5 | - "fsl,imx7ulp-lpi2c" for LPI2C compatible with the one integrated on i.MX7ULP soc | 5 | - "fsl,imx7ulp-lpi2c" for LPI2C compatible with the one integrated on i.MX7ULP soc |
6 | - "fsl,imx8dv-lpi2c" for LPI2C compatible with the one integrated on i.MX8DV soc | ||
7 | - reg : address and length of the lpi2c master registers | 6 | - reg : address and length of the lpi2c master registers |
8 | - interrupts : lpi2c interrupt | 7 | - interrupts : lpi2c interrupt |
9 | - clocks : lpi2c clock specifier | 8 | - clocks : lpi2c clock specifier |
@@ -11,7 +10,7 @@ Required properties: | |||
11 | Examples: | 10 | Examples: |
12 | 11 | ||
13 | lpi2c7: lpi2c7@40a50000 { | 12 | lpi2c7: lpi2c7@40a50000 { |
14 | compatible = "fsl,imx8dv-lpi2c"; | 13 | compatible = "fsl,imx7ulp-lpi2c"; |
15 | reg = <0x40A50000 0x10000>; | 14 | reg = <0x40A50000 0x10000>; |
16 | interrupt-parent = <&intc>; | 15 | interrupt-parent = <&intc>; |
17 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; | 16 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; |
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt index 41089369f891..b3acebe08eb0 100644 --- a/Documentation/devicetree/bindings/net/cpsw.txt +++ b/Documentation/devicetree/bindings/net/cpsw.txt | |||
@@ -19,6 +19,10 @@ Required properties: | |||
19 | - slaves : Specifies number for slaves | 19 | - slaves : Specifies number for slaves |
20 | - active_slave : Specifies the slave to use for time stamping, | 20 | - active_slave : Specifies the slave to use for time stamping, |
21 | ethtool and SIOCGMIIPHY | 21 | ethtool and SIOCGMIIPHY |
22 | - cpsw-phy-sel : Specifies the phandle to the CPSW phy mode selection | ||
23 | device. See also cpsw-phy-sel.txt for it's binding. | ||
24 | Note that in legacy cases cpsw-phy-sel may be | ||
25 | a child device instead of a phandle. | ||
22 | 26 | ||
23 | Optional properties: | 27 | Optional properties: |
24 | - ti,hwmods : Must be "cpgmac0" | 28 | - ti,hwmods : Must be "cpgmac0" |
@@ -75,6 +79,7 @@ Examples: | |||
75 | cpts_clock_mult = <0x80000000>; | 79 | cpts_clock_mult = <0x80000000>; |
76 | cpts_clock_shift = <29>; | 80 | cpts_clock_shift = <29>; |
77 | syscon = <&cm>; | 81 | syscon = <&cm>; |
82 | cpsw-phy-sel = <&phy_sel>; | ||
78 | cpsw_emac0: slave@0 { | 83 | cpsw_emac0: slave@0 { |
79 | phy_id = <&davinci_mdio>, <0>; | 84 | phy_id = <&davinci_mdio>, <0>; |
80 | phy-mode = "rgmii-txid"; | 85 | phy-mode = "rgmii-txid"; |
@@ -103,6 +108,7 @@ Examples: | |||
103 | cpts_clock_mult = <0x80000000>; | 108 | cpts_clock_mult = <0x80000000>; |
104 | cpts_clock_shift = <29>; | 109 | cpts_clock_shift = <29>; |
105 | syscon = <&cm>; | 110 | syscon = <&cm>; |
111 | cpsw-phy-sel = <&phy_sel>; | ||
106 | cpsw_emac0: slave@0 { | 112 | cpsw_emac0: slave@0 { |
107 | phy_id = <&davinci_mdio>, <0>; | 113 | phy_id = <&davinci_mdio>, <0>; |
108 | phy-mode = "rgmii-txid"; | 114 | phy-mode = "rgmii-txid"; |
diff --git a/Documentation/devicetree/bindings/net/sh_eth.txt b/Documentation/devicetree/bindings/net/sh_eth.txt index 76db9f13ad96..abc36274227c 100644 --- a/Documentation/devicetree/bindings/net/sh_eth.txt +++ b/Documentation/devicetree/bindings/net/sh_eth.txt | |||
@@ -16,6 +16,7 @@ Required properties: | |||
16 | "renesas,ether-r8a7794" if the device is a part of R8A7794 SoC. | 16 | "renesas,ether-r8a7794" if the device is a part of R8A7794 SoC. |
17 | "renesas,gether-r8a77980" if the device is a part of R8A77980 SoC. | 17 | "renesas,gether-r8a77980" if the device is a part of R8A77980 SoC. |
18 | "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC. | 18 | "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC. |
19 | "renesas,ether-r7s9210" if the device is a part of R7S9210 SoC. | ||
19 | "renesas,rcar-gen1-ether" for a generic R-Car Gen1 device. | 20 | "renesas,rcar-gen1-ether" for a generic R-Car Gen1 device. |
20 | "renesas,rcar-gen2-ether" for a generic R-Car Gen2 or RZ/G1 | 21 | "renesas,rcar-gen2-ether" for a generic R-Car Gen2 or RZ/G1 |
21 | device. | 22 | device. |
diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst index 61f918b10a0c..d1bf143b446f 100644 --- a/Documentation/process/changes.rst +++ b/Documentation/process/changes.rst | |||
@@ -86,7 +86,7 @@ pkg-config | |||
86 | 86 | ||
87 | The build system, as of 4.18, requires pkg-config to check for installed | 87 | The build system, as of 4.18, requires pkg-config to check for installed |
88 | kconfig tools and to determine flags settings for use in | 88 | kconfig tools and to determine flags settings for use in |
89 | 'make {menu,n,g,x}config'. Previously pkg-config was being used but not | 89 | 'make {g,x}config'. Previously pkg-config was being used but not |
90 | verified or documented. | 90 | verified or documented. |
91 | 91 | ||
92 | Flex | 92 | Flex |
diff --git a/Documentation/scsi/scsi-parameters.txt b/Documentation/scsi/scsi-parameters.txt index 25a4b4cf04a6..92999d4e0cb8 100644 --- a/Documentation/scsi/scsi-parameters.txt +++ b/Documentation/scsi/scsi-parameters.txt | |||
@@ -97,6 +97,11 @@ parameters may be changed at runtime by the command | |||
97 | allowing boot to proceed. none ignores them, expecting | 97 | allowing boot to proceed. none ignores them, expecting |
98 | user space to do the scan. | 98 | user space to do the scan. |
99 | 99 | ||
100 | scsi_mod.use_blk_mq= | ||
101 | [SCSI] use blk-mq I/O path by default | ||
102 | See SCSI_MQ_DEFAULT in drivers/scsi/Kconfig. | ||
103 | Format: <y/n> | ||
104 | |||
100 | sim710= [SCSI,HW] | 105 | sim710= [SCSI,HW] |
101 | See header of drivers/scsi/sim710.c. | 106 | See header of drivers/scsi/sim710.c. |
102 | 107 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 9ad052aeac39..d870cb57c887 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2311,6 +2311,7 @@ F: drivers/clocksource/cadence_ttc_timer.c | |||
2311 | F: drivers/i2c/busses/i2c-cadence.c | 2311 | F: drivers/i2c/busses/i2c-cadence.c |
2312 | F: drivers/mmc/host/sdhci-of-arasan.c | 2312 | F: drivers/mmc/host/sdhci-of-arasan.c |
2313 | F: drivers/edac/synopsys_edac.c | 2313 | F: drivers/edac/synopsys_edac.c |
2314 | F: drivers/i2c/busses/i2c-xiic.c | ||
2314 | 2315 | ||
2315 | ARM64 PORT (AARCH64 ARCHITECTURE) | 2316 | ARM64 PORT (AARCH64 ARCHITECTURE) |
2316 | M: Catalin Marinas <catalin.marinas@arm.com> | 2317 | M: Catalin Marinas <catalin.marinas@arm.com> |
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 6d5eb8267e42..b4441b0764d7 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
@@ -9,6 +9,7 @@ | |||
9 | config ARC | 9 | config ARC |
10 | def_bool y | 10 | def_bool y |
11 | select ARC_TIMERS | 11 | select ARC_TIMERS |
12 | select ARCH_HAS_PTE_SPECIAL | ||
12 | select ARCH_HAS_SYNC_DMA_FOR_CPU | 13 | select ARCH_HAS_SYNC_DMA_FOR_CPU |
13 | select ARCH_HAS_SYNC_DMA_FOR_DEVICE | 14 | select ARCH_HAS_SYNC_DMA_FOR_DEVICE |
14 | select ARCH_HAS_SG_CHAIN | 15 | select ARCH_HAS_SG_CHAIN |
@@ -28,8 +29,12 @@ config ARC | |||
28 | select GENERIC_SMP_IDLE_THREAD | 29 | select GENERIC_SMP_IDLE_THREAD |
29 | select HAVE_ARCH_KGDB | 30 | select HAVE_ARCH_KGDB |
30 | select HAVE_ARCH_TRACEHOOK | 31 | select HAVE_ARCH_TRACEHOOK |
32 | select HAVE_DEBUG_STACKOVERFLOW | ||
31 | select HAVE_FUTEX_CMPXCHG if FUTEX | 33 | select HAVE_FUTEX_CMPXCHG if FUTEX |
34 | select HAVE_GENERIC_DMA_COHERENT | ||
32 | select HAVE_IOREMAP_PROT | 35 | select HAVE_IOREMAP_PROT |
36 | select HAVE_KERNEL_GZIP | ||
37 | select HAVE_KERNEL_LZMA | ||
33 | select HAVE_KPROBES | 38 | select HAVE_KPROBES |
34 | select HAVE_KRETPROBES | 39 | select HAVE_KRETPROBES |
35 | select HAVE_MEMBLOCK | 40 | select HAVE_MEMBLOCK |
@@ -44,11 +49,6 @@ config ARC | |||
44 | select OF_EARLY_FLATTREE | 49 | select OF_EARLY_FLATTREE |
45 | select OF_RESERVED_MEM | 50 | select OF_RESERVED_MEM |
46 | select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING | 51 | select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING |
47 | select HAVE_DEBUG_STACKOVERFLOW | ||
48 | select HAVE_GENERIC_DMA_COHERENT | ||
49 | select HAVE_KERNEL_GZIP | ||
50 | select HAVE_KERNEL_LZMA | ||
51 | select ARCH_HAS_PTE_SPECIAL | ||
52 | 52 | ||
53 | config ARCH_HAS_CACHE_LINE_SIZE | 53 | config ARCH_HAS_CACHE_LINE_SIZE |
54 | def_bool y | 54 | def_bool y |
diff --git a/arch/arc/Makefile b/arch/arc/Makefile index fb026196aaab..99cce77ab98f 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile | |||
@@ -43,10 +43,7 @@ ifdef CONFIG_ARC_CURR_IN_REG | |||
43 | LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h | 43 | LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h |
44 | endif | 44 | endif |
45 | 45 | ||
46 | upto_gcc44 := $(call cc-ifversion, -le, 0404, y) | 46 | cflags-y += -fsection-anchors |
47 | atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y) | ||
48 | |||
49 | cflags-$(atleast_gcc44) += -fsection-anchors | ||
50 | 47 | ||
51 | cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock | 48 | cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock |
52 | cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape | 49 | cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape |
@@ -82,11 +79,6 @@ cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp | |||
82 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian | 79 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian |
83 | ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB | 80 | ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB |
84 | 81 | ||
85 | # STAR 9000518362: (fixed with binutils shipping with gcc 4.8) | ||
86 | # arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept | ||
87 | # --build-id w/o "-marclinux". Default arc-elf32-ld is OK | ||
88 | ldflags-$(upto_gcc44) += -marclinux | ||
89 | |||
90 | LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name) | 82 | LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name) |
91 | 83 | ||
92 | # Modules with short calls might break for calls into builtin-kernel | 84 | # Modules with short calls might break for calls into builtin-kernel |
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi index dc91c663bcc0..d75d65ddf8e3 100644 --- a/arch/arc/boot/dts/axc003.dtsi +++ b/arch/arc/boot/dts/axc003.dtsi | |||
@@ -94,6 +94,32 @@ | |||
94 | }; | 94 | }; |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Mark DMA peripherals connected via IOC port as dma-coherent. We do | ||
98 | * it via overlay because peripherals defined in axs10x_mb.dtsi are | ||
99 | * used for both AXS101 and AXS103 boards and only AXS103 has IOC (so | ||
100 | * only AXS103 board has HW-coherent DMA peripherals) | ||
101 | * We don't need to mark pgu@17000 as dma-coherent because it uses | ||
102 | * external DMA buffer located outside of IOC aperture. | ||
103 | */ | ||
104 | axs10x_mb { | ||
105 | ethernet@0x18000 { | ||
106 | dma-coherent; | ||
107 | }; | ||
108 | |||
109 | ehci@0x40000 { | ||
110 | dma-coherent; | ||
111 | }; | ||
112 | |||
113 | ohci@0x60000 { | ||
114 | dma-coherent; | ||
115 | }; | ||
116 | |||
117 | mmc@0x15000 { | ||
118 | dma-coherent; | ||
119 | }; | ||
120 | }; | ||
121 | |||
122 | /* | ||
97 | * The DW APB ICTL intc on MB is connected to CPU intc via a | 123 | * The DW APB ICTL intc on MB is connected to CPU intc via a |
98 | * DT "invisible" DW APB GPIO block, configured to simply pass thru | 124 | * DT "invisible" DW APB GPIO block, configured to simply pass thru |
99 | * interrupts - setup accordinly in platform init (plat-axs10x/ax10x.c) | 125 | * interrupts - setup accordinly in platform init (plat-axs10x/ax10x.c) |
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi b/arch/arc/boot/dts/axc003_idu.dtsi index 69ff4895f2ba..a05bb737ea63 100644 --- a/arch/arc/boot/dts/axc003_idu.dtsi +++ b/arch/arc/boot/dts/axc003_idu.dtsi | |||
@@ -101,6 +101,32 @@ | |||
101 | }; | 101 | }; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Mark DMA peripherals connected via IOC port as dma-coherent. We do | ||
105 | * it via overlay because peripherals defined in axs10x_mb.dtsi are | ||
106 | * used for both AXS101 and AXS103 boards and only AXS103 has IOC (so | ||
107 | * only AXS103 board has HW-coherent DMA peripherals) | ||
108 | * We don't need to mark pgu@17000 as dma-coherent because it uses | ||
109 | * external DMA buffer located outside of IOC aperture. | ||
110 | */ | ||
111 | axs10x_mb { | ||
112 | ethernet@0x18000 { | ||
113 | dma-coherent; | ||
114 | }; | ||
115 | |||
116 | ehci@0x40000 { | ||
117 | dma-coherent; | ||
118 | }; | ||
119 | |||
120 | ohci@0x60000 { | ||
121 | dma-coherent; | ||
122 | }; | ||
123 | |||
124 | mmc@0x15000 { | ||
125 | dma-coherent; | ||
126 | }; | ||
127 | }; | ||
128 | |||
129 | /* | ||
104 | * This INTC is actually connected to DW APB GPIO | 130 | * This INTC is actually connected to DW APB GPIO |
105 | * which acts as a wire between MB INTC and CPU INTC. | 131 | * which acts as a wire between MB INTC and CPU INTC. |
106 | * GPIO INTC is configured in platform init code | 132 | * GPIO INTC is configured in platform init code |
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi index 47b74fbc403c..37bafd44e36d 100644 --- a/arch/arc/boot/dts/axs10x_mb.dtsi +++ b/arch/arc/boot/dts/axs10x_mb.dtsi | |||
@@ -9,6 +9,10 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | / { | 11 | / { |
12 | aliases { | ||
13 | ethernet = &gmac; | ||
14 | }; | ||
15 | |||
12 | axs10x_mb { | 16 | axs10x_mb { |
13 | compatible = "simple-bus"; | 17 | compatible = "simple-bus"; |
14 | #address-cells = <1>; | 18 | #address-cells = <1>; |
@@ -68,7 +72,7 @@ | |||
68 | }; | 72 | }; |
69 | }; | 73 | }; |
70 | 74 | ||
71 | ethernet@0x18000 { | 75 | gmac: ethernet@0x18000 { |
72 | #interrupt-cells = <1>; | 76 | #interrupt-cells = <1>; |
73 | compatible = "snps,dwmac"; | 77 | compatible = "snps,dwmac"; |
74 | reg = < 0x18000 0x2000 >; | 78 | reg = < 0x18000 0x2000 >; |
@@ -81,6 +85,7 @@ | |||
81 | max-speed = <100>; | 85 | max-speed = <100>; |
82 | resets = <&creg_rst 5>; | 86 | resets = <&creg_rst 5>; |
83 | reset-names = "stmmaceth"; | 87 | reset-names = "stmmaceth"; |
88 | mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */ | ||
84 | }; | 89 | }; |
85 | 90 | ||
86 | ehci@0x40000 { | 91 | ehci@0x40000 { |
diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts index 006aa3de5348..ef149f59929a 100644 --- a/arch/arc/boot/dts/hsdk.dts +++ b/arch/arc/boot/dts/hsdk.dts | |||
@@ -25,6 +25,10 @@ | |||
25 | bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 console=ttyS0,115200n8 debug print-fatal-signals=1"; | 25 | bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 console=ttyS0,115200n8 debug print-fatal-signals=1"; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | aliases { | ||
29 | ethernet = &gmac; | ||
30 | }; | ||
31 | |||
28 | cpus { | 32 | cpus { |
29 | #address-cells = <1>; | 33 | #address-cells = <1>; |
30 | #size-cells = <0>; | 34 | #size-cells = <0>; |
@@ -163,7 +167,7 @@ | |||
163 | #clock-cells = <0>; | 167 | #clock-cells = <0>; |
164 | }; | 168 | }; |
165 | 169 | ||
166 | ethernet@8000 { | 170 | gmac: ethernet@8000 { |
167 | #interrupt-cells = <1>; | 171 | #interrupt-cells = <1>; |
168 | compatible = "snps,dwmac"; | 172 | compatible = "snps,dwmac"; |
169 | reg = <0x8000 0x2000>; | 173 | reg = <0x8000 0x2000>; |
@@ -176,6 +180,8 @@ | |||
176 | phy-handle = <&phy0>; | 180 | phy-handle = <&phy0>; |
177 | resets = <&cgu_rst HSDK_ETH_RESET>; | 181 | resets = <&cgu_rst HSDK_ETH_RESET>; |
178 | reset-names = "stmmaceth"; | 182 | reset-names = "stmmaceth"; |
183 | mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */ | ||
184 | dma-coherent; | ||
179 | 185 | ||
180 | mdio { | 186 | mdio { |
181 | #address-cells = <1>; | 187 | #address-cells = <1>; |
@@ -194,12 +200,14 @@ | |||
194 | compatible = "snps,hsdk-v1.0-ohci", "generic-ohci"; | 200 | compatible = "snps,hsdk-v1.0-ohci", "generic-ohci"; |
195 | reg = <0x60000 0x100>; | 201 | reg = <0x60000 0x100>; |
196 | interrupts = <15>; | 202 | interrupts = <15>; |
203 | dma-coherent; | ||
197 | }; | 204 | }; |
198 | 205 | ||
199 | ehci@40000 { | 206 | ehci@40000 { |
200 | compatible = "snps,hsdk-v1.0-ehci", "generic-ehci"; | 207 | compatible = "snps,hsdk-v1.0-ehci", "generic-ehci"; |
201 | reg = <0x40000 0x100>; | 208 | reg = <0x40000 0x100>; |
202 | interrupts = <15>; | 209 | interrupts = <15>; |
210 | dma-coherent; | ||
203 | }; | 211 | }; |
204 | 212 | ||
205 | mmc@a000 { | 213 | mmc@a000 { |
@@ -212,6 +220,7 @@ | |||
212 | clock-names = "biu", "ciu"; | 220 | clock-names = "biu", "ciu"; |
213 | interrupts = <12>; | 221 | interrupts = <12>; |
214 | bus-width = <4>; | 222 | bus-width = <4>; |
223 | dma-coherent; | ||
215 | }; | 224 | }; |
216 | }; | 225 | }; |
217 | 226 | ||
diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig index a635ea972304..41bc08be6a3b 100644 --- a/arch/arc/configs/axs101_defconfig +++ b/arch/arc/configs/axs101_defconfig | |||
@@ -1,5 +1,3 @@ | |||
1 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
2 | # CONFIG_SWAP is not set | ||
3 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
4 | CONFIG_POSIX_MQUEUE=y | 2 | CONFIG_POSIX_MQUEUE=y |
5 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 3 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
@@ -63,7 +61,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
63 | CONFIG_MOUSE_SERIAL=y | 61 | CONFIG_MOUSE_SERIAL=y |
64 | CONFIG_MOUSE_SYNAPTICS_USB=y | 62 | CONFIG_MOUSE_SYNAPTICS_USB=y |
65 | # CONFIG_LEGACY_PTYS is not set | 63 | # CONFIG_LEGACY_PTYS is not set |
66 | # CONFIG_DEVKMEM is not set | ||
67 | CONFIG_SERIAL_8250=y | 64 | CONFIG_SERIAL_8250=y |
68 | CONFIG_SERIAL_8250_CONSOLE=y | 65 | CONFIG_SERIAL_8250_CONSOLE=y |
69 | CONFIG_SERIAL_8250_DW=y | 66 | CONFIG_SERIAL_8250_DW=y |
diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig index aa507e423075..1e1c4a8011b5 100644 --- a/arch/arc/configs/axs103_defconfig +++ b/arch/arc/configs/axs103_defconfig | |||
@@ -1,5 +1,3 @@ | |||
1 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
2 | # CONFIG_SWAP is not set | ||
3 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
4 | CONFIG_POSIX_MQUEUE=y | 2 | CONFIG_POSIX_MQUEUE=y |
5 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 3 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
@@ -64,7 +62,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
64 | CONFIG_MOUSE_SERIAL=y | 62 | CONFIG_MOUSE_SERIAL=y |
65 | CONFIG_MOUSE_SYNAPTICS_USB=y | 63 | CONFIG_MOUSE_SYNAPTICS_USB=y |
66 | # CONFIG_LEGACY_PTYS is not set | 64 | # CONFIG_LEGACY_PTYS is not set |
67 | # CONFIG_DEVKMEM is not set | ||
68 | CONFIG_SERIAL_8250=y | 65 | CONFIG_SERIAL_8250=y |
69 | CONFIG_SERIAL_8250_CONSOLE=y | 66 | CONFIG_SERIAL_8250_CONSOLE=y |
70 | CONFIG_SERIAL_8250_DW=y | 67 | CONFIG_SERIAL_8250_DW=y |
diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig index eba07f468654..6b0c0cfd5c30 100644 --- a/arch/arc/configs/axs103_smp_defconfig +++ b/arch/arc/configs/axs103_smp_defconfig | |||
@@ -1,5 +1,3 @@ | |||
1 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
2 | # CONFIG_SWAP is not set | ||
3 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
4 | CONFIG_POSIX_MQUEUE=y | 2 | CONFIG_POSIX_MQUEUE=y |
5 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 3 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
@@ -65,7 +63,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
65 | CONFIG_MOUSE_SERIAL=y | 63 | CONFIG_MOUSE_SERIAL=y |
66 | CONFIG_MOUSE_SYNAPTICS_USB=y | 64 | CONFIG_MOUSE_SYNAPTICS_USB=y |
67 | # CONFIG_LEGACY_PTYS is not set | 65 | # CONFIG_LEGACY_PTYS is not set |
68 | # CONFIG_DEVKMEM is not set | ||
69 | CONFIG_SERIAL_8250=y | 66 | CONFIG_SERIAL_8250=y |
70 | CONFIG_SERIAL_8250_CONSOLE=y | 67 | CONFIG_SERIAL_8250_CONSOLE=y |
71 | CONFIG_SERIAL_8250_DW=y | 68 | CONFIG_SERIAL_8250_DW=y |
diff --git a/arch/arc/configs/haps_hs_defconfig b/arch/arc/configs/haps_hs_defconfig index 098b19fbaa51..240dd2cd5148 100644 --- a/arch/arc/configs/haps_hs_defconfig +++ b/arch/arc/configs/haps_hs_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
2 | # CONFIG_SWAP is not set | 1 | # CONFIG_SWAP is not set |
3 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
4 | CONFIG_POSIX_MQUEUE=y | 3 | CONFIG_POSIX_MQUEUE=y |
@@ -57,7 +56,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
57 | # CONFIG_SERIO_SERPORT is not set | 56 | # CONFIG_SERIO_SERPORT is not set |
58 | CONFIG_SERIO_ARC_PS2=y | 57 | CONFIG_SERIO_ARC_PS2=y |
59 | # CONFIG_LEGACY_PTYS is not set | 58 | # CONFIG_LEGACY_PTYS is not set |
60 | # CONFIG_DEVKMEM is not set | ||
61 | CONFIG_SERIAL_8250=y | 59 | CONFIG_SERIAL_8250=y |
62 | CONFIG_SERIAL_8250_CONSOLE=y | 60 | CONFIG_SERIAL_8250_CONSOLE=y |
63 | CONFIG_SERIAL_8250_NR_UARTS=1 | 61 | CONFIG_SERIAL_8250_NR_UARTS=1 |
diff --git a/arch/arc/configs/haps_hs_smp_defconfig b/arch/arc/configs/haps_hs_smp_defconfig index 0104c404d897..14ae7e5acc7c 100644 --- a/arch/arc/configs/haps_hs_smp_defconfig +++ b/arch/arc/configs/haps_hs_smp_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
2 | # CONFIG_SWAP is not set | 1 | # CONFIG_SWAP is not set |
3 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
4 | CONFIG_POSIX_MQUEUE=y | 3 | CONFIG_POSIX_MQUEUE=y |
@@ -60,7 +59,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
60 | # CONFIG_SERIO_SERPORT is not set | 59 | # CONFIG_SERIO_SERPORT is not set |
61 | CONFIG_SERIO_ARC_PS2=y | 60 | CONFIG_SERIO_ARC_PS2=y |
62 | # CONFIG_LEGACY_PTYS is not set | 61 | # CONFIG_LEGACY_PTYS is not set |
63 | # CONFIG_DEVKMEM is not set | ||
64 | CONFIG_SERIAL_8250=y | 62 | CONFIG_SERIAL_8250=y |
65 | CONFIG_SERIAL_8250_CONSOLE=y | 63 | CONFIG_SERIAL_8250_CONSOLE=y |
66 | CONFIG_SERIAL_8250_NR_UARTS=1 | 64 | CONFIG_SERIAL_8250_NR_UARTS=1 |
diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig index 6491be0ddbc9..1dec2b4bc5e6 100644 --- a/arch/arc/configs/hsdk_defconfig +++ b/arch/arc/configs/hsdk_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
3 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 2 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
4 | CONFIG_NO_HZ_IDLE=y | 3 | CONFIG_NO_HZ_IDLE=y |
diff --git a/arch/arc/configs/nps_defconfig b/arch/arc/configs/nps_defconfig index 7c9c706ae7f6..31ba224bbfb4 100644 --- a/arch/arc/configs/nps_defconfig +++ b/arch/arc/configs/nps_defconfig | |||
@@ -59,7 +59,6 @@ CONFIG_NETCONSOLE=y | |||
59 | # CONFIG_INPUT_MOUSE is not set | 59 | # CONFIG_INPUT_MOUSE is not set |
60 | # CONFIG_SERIO is not set | 60 | # CONFIG_SERIO is not set |
61 | # CONFIG_LEGACY_PTYS is not set | 61 | # CONFIG_LEGACY_PTYS is not set |
62 | # CONFIG_DEVKMEM is not set | ||
63 | CONFIG_SERIAL_8250=y | 62 | CONFIG_SERIAL_8250=y |
64 | CONFIG_SERIAL_8250_CONSOLE=y | 63 | CONFIG_SERIAL_8250_CONSOLE=y |
65 | CONFIG_SERIAL_8250_NR_UARTS=1 | 64 | CONFIG_SERIAL_8250_NR_UARTS=1 |
diff --git a/arch/arc/configs/nsim_700_defconfig b/arch/arc/configs/nsim_700_defconfig index 99e05cf63fca..8e0b8b134cd9 100644 --- a/arch/arc/configs/nsim_700_defconfig +++ b/arch/arc/configs/nsim_700_defconfig | |||
@@ -1,5 +1,4 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
2 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
3 | # CONFIG_SWAP is not set | 2 | # CONFIG_SWAP is not set |
4 | CONFIG_SYSVIPC=y | 3 | CONFIG_SYSVIPC=y |
5 | CONFIG_POSIX_MQUEUE=y | 4 | CONFIG_POSIX_MQUEUE=y |
@@ -44,7 +43,6 @@ CONFIG_LXT_PHY=y | |||
44 | # CONFIG_INPUT_MOUSE is not set | 43 | # CONFIG_INPUT_MOUSE is not set |
45 | # CONFIG_SERIO is not set | 44 | # CONFIG_SERIO is not set |
46 | # CONFIG_LEGACY_PTYS is not set | 45 | # CONFIG_LEGACY_PTYS is not set |
47 | # CONFIG_DEVKMEM is not set | ||
48 | CONFIG_SERIAL_ARC=y | 46 | CONFIG_SERIAL_ARC=y |
49 | CONFIG_SERIAL_ARC_CONSOLE=y | 47 | CONFIG_SERIAL_ARC_CONSOLE=y |
50 | # CONFIG_HW_RANDOM is not set | 48 | # CONFIG_HW_RANDOM is not set |
diff --git a/arch/arc/configs/nsim_hs_defconfig b/arch/arc/configs/nsim_hs_defconfig index 0dc4f9b737e7..739b90e5e893 100644 --- a/arch/arc/configs/nsim_hs_defconfig +++ b/arch/arc/configs/nsim_hs_defconfig | |||
@@ -1,5 +1,4 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
2 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
3 | # CONFIG_SWAP is not set | 2 | # CONFIG_SWAP is not set |
4 | CONFIG_SYSVIPC=y | 3 | CONFIG_SYSVIPC=y |
5 | CONFIG_POSIX_MQUEUE=y | 4 | CONFIG_POSIX_MQUEUE=y |
@@ -45,7 +44,6 @@ CONFIG_DEVTMPFS=y | |||
45 | # CONFIG_INPUT_MOUSE is not set | 44 | # CONFIG_INPUT_MOUSE is not set |
46 | # CONFIG_SERIO is not set | 45 | # CONFIG_SERIO is not set |
47 | # CONFIG_LEGACY_PTYS is not set | 46 | # CONFIG_LEGACY_PTYS is not set |
48 | # CONFIG_DEVKMEM is not set | ||
49 | CONFIG_SERIAL_ARC=y | 47 | CONFIG_SERIAL_ARC=y |
50 | CONFIG_SERIAL_ARC_CONSOLE=y | 48 | CONFIG_SERIAL_ARC_CONSOLE=y |
51 | # CONFIG_HW_RANDOM is not set | 49 | # CONFIG_HW_RANDOM is not set |
diff --git a/arch/arc/configs/nsim_hs_smp_defconfig b/arch/arc/configs/nsim_hs_smp_defconfig index be3c30a15e54..b5895bdf3a93 100644 --- a/arch/arc/configs/nsim_hs_smp_defconfig +++ b/arch/arc/configs/nsim_hs_smp_defconfig | |||
@@ -1,5 +1,4 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
2 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
3 | # CONFIG_SWAP is not set | 2 | # CONFIG_SWAP is not set |
4 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 3 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
5 | CONFIG_HIGH_RES_TIMERS=y | 4 | CONFIG_HIGH_RES_TIMERS=y |
@@ -44,7 +43,6 @@ CONFIG_DEVTMPFS=y | |||
44 | # CONFIG_INPUT_MOUSE is not set | 43 | # CONFIG_INPUT_MOUSE is not set |
45 | # CONFIG_SERIO is not set | 44 | # CONFIG_SERIO is not set |
46 | # CONFIG_LEGACY_PTYS is not set | 45 | # CONFIG_LEGACY_PTYS is not set |
47 | # CONFIG_DEVKMEM is not set | ||
48 | CONFIG_SERIAL_ARC=y | 46 | CONFIG_SERIAL_ARC=y |
49 | CONFIG_SERIAL_ARC_CONSOLE=y | 47 | CONFIG_SERIAL_ARC_CONSOLE=y |
50 | # CONFIG_HW_RANDOM is not set | 48 | # CONFIG_HW_RANDOM is not set |
diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig index 3a74b9b21772..f14eeff7d308 100644 --- a/arch/arc/configs/nsimosci_defconfig +++ b/arch/arc/configs/nsimosci_defconfig | |||
@@ -1,5 +1,4 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
2 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
3 | # CONFIG_SWAP is not set | 2 | # CONFIG_SWAP is not set |
4 | CONFIG_SYSVIPC=y | 3 | CONFIG_SYSVIPC=y |
5 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 4 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
@@ -48,7 +47,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
48 | # CONFIG_SERIO_SERPORT is not set | 47 | # CONFIG_SERIO_SERPORT is not set |
49 | CONFIG_SERIO_ARC_PS2=y | 48 | CONFIG_SERIO_ARC_PS2=y |
50 | # CONFIG_LEGACY_PTYS is not set | 49 | # CONFIG_LEGACY_PTYS is not set |
51 | # CONFIG_DEVKMEM is not set | ||
52 | CONFIG_SERIAL_8250=y | 50 | CONFIG_SERIAL_8250=y |
53 | CONFIG_SERIAL_8250_CONSOLE=y | 51 | CONFIG_SERIAL_8250_CONSOLE=y |
54 | CONFIG_SERIAL_8250_NR_UARTS=1 | 52 | CONFIG_SERIAL_8250_NR_UARTS=1 |
diff --git a/arch/arc/configs/nsimosci_hs_defconfig b/arch/arc/configs/nsimosci_hs_defconfig index ea2834b4dc1d..025298a48305 100644 --- a/arch/arc/configs/nsimosci_hs_defconfig +++ b/arch/arc/configs/nsimosci_hs_defconfig | |||
@@ -1,5 +1,4 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
2 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
3 | # CONFIG_SWAP is not set | 2 | # CONFIG_SWAP is not set |
4 | CONFIG_SYSVIPC=y | 3 | CONFIG_SYSVIPC=y |
5 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 4 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
@@ -47,7 +46,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
47 | # CONFIG_SERIO_SERPORT is not set | 46 | # CONFIG_SERIO_SERPORT is not set |
48 | CONFIG_SERIO_ARC_PS2=y | 47 | CONFIG_SERIO_ARC_PS2=y |
49 | # CONFIG_LEGACY_PTYS is not set | 48 | # CONFIG_LEGACY_PTYS is not set |
50 | # CONFIG_DEVKMEM is not set | ||
51 | CONFIG_SERIAL_8250=y | 49 | CONFIG_SERIAL_8250=y |
52 | CONFIG_SERIAL_8250_CONSOLE=y | 50 | CONFIG_SERIAL_8250_CONSOLE=y |
53 | CONFIG_SERIAL_8250_NR_UARTS=1 | 51 | CONFIG_SERIAL_8250_NR_UARTS=1 |
diff --git a/arch/arc/configs/nsimosci_hs_smp_defconfig b/arch/arc/configs/nsimosci_hs_smp_defconfig index 80a5a1b4924b..df7b77b13b82 100644 --- a/arch/arc/configs/nsimosci_hs_smp_defconfig +++ b/arch/arc/configs/nsimosci_hs_smp_defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
2 | # CONFIG_SWAP is not set | 1 | # CONFIG_SWAP is not set |
3 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
4 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 3 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
@@ -58,7 +57,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y | |||
58 | # CONFIG_SERIO_SERPORT is not set | 57 | # CONFIG_SERIO_SERPORT is not set |
59 | CONFIG_SERIO_ARC_PS2=y | 58 | CONFIG_SERIO_ARC_PS2=y |
60 | # CONFIG_LEGACY_PTYS is not set | 59 | # CONFIG_LEGACY_PTYS is not set |
61 | # CONFIG_DEVKMEM is not set | ||
62 | CONFIG_SERIAL_8250=y | 60 | CONFIG_SERIAL_8250=y |
63 | CONFIG_SERIAL_8250_CONSOLE=y | 61 | CONFIG_SERIAL_8250_CONSOLE=y |
64 | CONFIG_SERIAL_8250_NR_UARTS=1 | 62 | CONFIG_SERIAL_8250_NR_UARTS=1 |
diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig index 2cc87f909747..a7f65313f84a 100644 --- a/arch/arc/configs/tb10x_defconfig +++ b/arch/arc/configs/tb10x_defconfig | |||
@@ -57,7 +57,6 @@ CONFIG_STMMAC_ETH=y | |||
57 | # CONFIG_SERIO is not set | 57 | # CONFIG_SERIO is not set |
58 | # CONFIG_VT is not set | 58 | # CONFIG_VT is not set |
59 | # CONFIG_LEGACY_PTYS is not set | 59 | # CONFIG_LEGACY_PTYS is not set |
60 | # CONFIG_DEVKMEM is not set | ||
61 | CONFIG_SERIAL_8250=y | 60 | CONFIG_SERIAL_8250=y |
62 | CONFIG_SERIAL_8250_CONSOLE=y | 61 | CONFIG_SERIAL_8250_CONSOLE=y |
63 | CONFIG_SERIAL_8250_NR_UARTS=1 | 62 | CONFIG_SERIAL_8250_NR_UARTS=1 |
diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig index f629493929ea..db47c3541f15 100644 --- a/arch/arc/configs/vdk_hs38_defconfig +++ b/arch/arc/configs/vdk_hs38_defconfig | |||
@@ -1,5 +1,4 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
2 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
3 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 2 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
4 | CONFIG_HIGH_RES_TIMERS=y | 3 | CONFIG_HIGH_RES_TIMERS=y |
5 | CONFIG_IKCONFIG=y | 4 | CONFIG_IKCONFIG=y |
@@ -53,7 +52,6 @@ CONFIG_NATIONAL_PHY=y | |||
53 | CONFIG_MOUSE_PS2_TOUCHKIT=y | 52 | CONFIG_MOUSE_PS2_TOUCHKIT=y |
54 | CONFIG_SERIO_ARC_PS2=y | 53 | CONFIG_SERIO_ARC_PS2=y |
55 | # CONFIG_LEGACY_PTYS is not set | 54 | # CONFIG_LEGACY_PTYS is not set |
56 | # CONFIG_DEVKMEM is not set | ||
57 | CONFIG_SERIAL_8250=y | 55 | CONFIG_SERIAL_8250=y |
58 | CONFIG_SERIAL_8250_CONSOLE=y | 56 | CONFIG_SERIAL_8250_CONSOLE=y |
59 | CONFIG_SERIAL_8250_DW=y | 57 | CONFIG_SERIAL_8250_DW=y |
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig index 21f0ca26a05d..a8ac5e917d9a 100644 --- a/arch/arc/configs/vdk_hs38_smp_defconfig +++ b/arch/arc/configs/vdk_hs38_smp_defconfig | |||
@@ -1,5 +1,4 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
2 | CONFIG_DEFAULT_HOSTNAME="ARCLinux" | ||
3 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 2 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
4 | CONFIG_HIGH_RES_TIMERS=y | 3 | CONFIG_HIGH_RES_TIMERS=y |
5 | CONFIG_IKCONFIG=y | 4 | CONFIG_IKCONFIG=y |
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h index 4e0072730241..158af079838d 100644 --- a/arch/arc/include/asm/atomic.h +++ b/arch/arc/include/asm/atomic.h | |||
@@ -84,7 +84,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ | |||
84 | "1: llock %[orig], [%[ctr]] \n" \ | 84 | "1: llock %[orig], [%[ctr]] \n" \ |
85 | " " #asm_op " %[val], %[orig], %[i] \n" \ | 85 | " " #asm_op " %[val], %[orig], %[i] \n" \ |
86 | " scond %[val], [%[ctr]] \n" \ | 86 | " scond %[val], [%[ctr]] \n" \ |
87 | " \n" \ | 87 | " bnz 1b \n" \ |
88 | : [val] "=&r" (val), \ | 88 | : [val] "=&r" (val), \ |
89 | [orig] "=&r" (orig) \ | 89 | [orig] "=&r" (orig) \ |
90 | : [ctr] "r" (&v->counter), \ | 90 | : [ctr] "r" (&v->counter), \ |
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h new file mode 100644 index 000000000000..c946c0a83e76 --- /dev/null +++ b/arch/arc/include/asm/dma-mapping.h | |||
@@ -0,0 +1,13 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | // (C) 2018 Synopsys, Inc. (www.synopsys.com) | ||
3 | |||
4 | #ifndef ASM_ARC_DMA_MAPPING_H | ||
5 | #define ASM_ARC_DMA_MAPPING_H | ||
6 | |||
7 | #include <asm-generic/dma-mapping.h> | ||
8 | |||
9 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
10 | const struct iommu_ops *iommu, bool coherent); | ||
11 | #define arch_setup_dma_ops arch_setup_dma_ops | ||
12 | |||
13 | #endif | ||
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index 783b20354f8b..e8d9fb452346 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c | |||
@@ -83,9 +83,6 @@ done: | |||
83 | static void show_faulting_vma(unsigned long address, char *buf) | 83 | static void show_faulting_vma(unsigned long address, char *buf) |
84 | { | 84 | { |
85 | struct vm_area_struct *vma; | 85 | struct vm_area_struct *vma; |
86 | struct inode *inode; | ||
87 | unsigned long ino = 0; | ||
88 | dev_t dev = 0; | ||
89 | char *nm = buf; | 86 | char *nm = buf; |
90 | struct mm_struct *active_mm = current->active_mm; | 87 | struct mm_struct *active_mm = current->active_mm; |
91 | 88 | ||
@@ -99,12 +96,10 @@ static void show_faulting_vma(unsigned long address, char *buf) | |||
99 | * if the container VMA is not found | 96 | * if the container VMA is not found |
100 | */ | 97 | */ |
101 | if (vma && (vma->vm_start <= address)) { | 98 | if (vma && (vma->vm_start <= address)) { |
102 | struct file *file = vma->vm_file; | 99 | if (vma->vm_file) { |
103 | if (file) { | 100 | nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1); |
104 | nm = file_path(file, buf, PAGE_SIZE - 1); | 101 | if (IS_ERR(nm)) |
105 | inode = file_inode(vma->vm_file); | 102 | nm = "?"; |
106 | dev = inode->i_sb->s_dev; | ||
107 | ino = inode->i_ino; | ||
108 | } | 103 | } |
109 | pr_info(" @off 0x%lx in [%s]\n" | 104 | pr_info(" @off 0x%lx in [%s]\n" |
110 | " VMA: 0x%08lx to 0x%08lx\n", | 105 | " VMA: 0x%08lx to 0x%08lx\n", |
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c index 25c631942500..f2701c13a66b 100644 --- a/arch/arc/mm/cache.c +++ b/arch/arc/mm/cache.c | |||
@@ -65,7 +65,7 @@ char *arc_cache_mumbojumbo(int c, char *buf, int len) | |||
65 | 65 | ||
66 | n += scnprintf(buf + n, len - n, "Peripherals\t: %#lx%s%s\n", | 66 | n += scnprintf(buf + n, len - n, "Peripherals\t: %#lx%s%s\n", |
67 | perip_base, | 67 | perip_base, |
68 | IS_AVAIL3(ioc_exists, ioc_enable, ", IO-Coherency ")); | 68 | IS_AVAIL3(ioc_exists, ioc_enable, ", IO-Coherency (per-device) ")); |
69 | 69 | ||
70 | return buf; | 70 | return buf; |
71 | } | 71 | } |
@@ -897,15 +897,6 @@ static void __dma_cache_wback_slc(phys_addr_t start, unsigned long sz) | |||
897 | } | 897 | } |
898 | 898 | ||
899 | /* | 899 | /* |
900 | * DMA ops for systems with IOC | ||
901 | * IOC hardware snoops all DMA traffic keeping the caches consistent with | ||
902 | * memory - eliding need for any explicit cache maintenance of DMA buffers | ||
903 | */ | ||
904 | static void __dma_cache_wback_inv_ioc(phys_addr_t start, unsigned long sz) {} | ||
905 | static void __dma_cache_inv_ioc(phys_addr_t start, unsigned long sz) {} | ||
906 | static void __dma_cache_wback_ioc(phys_addr_t start, unsigned long sz) {} | ||
907 | |||
908 | /* | ||
909 | * Exported DMA API | 900 | * Exported DMA API |
910 | */ | 901 | */ |
911 | void dma_cache_wback_inv(phys_addr_t start, unsigned long sz) | 902 | void dma_cache_wback_inv(phys_addr_t start, unsigned long sz) |
@@ -1153,6 +1144,19 @@ noinline void __init arc_ioc_setup(void) | |||
1153 | { | 1144 | { |
1154 | unsigned int ioc_base, mem_sz; | 1145 | unsigned int ioc_base, mem_sz; |
1155 | 1146 | ||
1147 | /* | ||
1148 | * As for today we don't support both IOC and ZONE_HIGHMEM enabled | ||
1149 | * simultaneously. This happens because as of today IOC aperture covers | ||
1150 | * only ZONE_NORMAL (low mem) and any dma transactions outside this | ||
1151 | * region won't be HW coherent. | ||
1152 | * If we want to use both IOC and ZONE_HIGHMEM we can use | ||
1153 | * bounce_buffer to handle dma transactions to HIGHMEM. | ||
1154 | * Also it is possible to modify dma_direct cache ops or increase IOC | ||
1155 | * aperture size if we are planning to use HIGHMEM without PAE. | ||
1156 | */ | ||
1157 | if (IS_ENABLED(CONFIG_HIGHMEM)) | ||
1158 | panic("IOC and HIGHMEM can't be used simultaneously"); | ||
1159 | |||
1156 | /* Flush + invalidate + disable L1 dcache */ | 1160 | /* Flush + invalidate + disable L1 dcache */ |
1157 | __dc_disable(); | 1161 | __dc_disable(); |
1158 | 1162 | ||
@@ -1264,11 +1268,7 @@ void __init arc_cache_init_master(void) | |||
1264 | if (is_isa_arcv2() && ioc_enable) | 1268 | if (is_isa_arcv2() && ioc_enable) |
1265 | arc_ioc_setup(); | 1269 | arc_ioc_setup(); |
1266 | 1270 | ||
1267 | if (is_isa_arcv2() && ioc_enable) { | 1271 | if (is_isa_arcv2() && l2_line_sz && slc_enable) { |
1268 | __dma_cache_wback_inv = __dma_cache_wback_inv_ioc; | ||
1269 | __dma_cache_inv = __dma_cache_inv_ioc; | ||
1270 | __dma_cache_wback = __dma_cache_wback_ioc; | ||
1271 | } else if (is_isa_arcv2() && l2_line_sz && slc_enable) { | ||
1272 | __dma_cache_wback_inv = __dma_cache_wback_inv_slc; | 1272 | __dma_cache_wback_inv = __dma_cache_wback_inv_slc; |
1273 | __dma_cache_inv = __dma_cache_inv_slc; | 1273 | __dma_cache_inv = __dma_cache_inv_slc; |
1274 | __dma_cache_wback = __dma_cache_wback_slc; | 1274 | __dma_cache_wback = __dma_cache_wback_slc; |
@@ -1277,6 +1277,12 @@ void __init arc_cache_init_master(void) | |||
1277 | __dma_cache_inv = __dma_cache_inv_l1; | 1277 | __dma_cache_inv = __dma_cache_inv_l1; |
1278 | __dma_cache_wback = __dma_cache_wback_l1; | 1278 | __dma_cache_wback = __dma_cache_wback_l1; |
1279 | } | 1279 | } |
1280 | /* | ||
1281 | * In case of IOC (say IOC+SLC case), pointers above could still be set | ||
1282 | * but end up not being relevant as the first function in chain is not | ||
1283 | * called at all for @dma_direct_ops | ||
1284 | * arch_sync_dma_for_cpu() -> dma_cache_*() -> __dma_cache_*() | ||
1285 | */ | ||
1280 | } | 1286 | } |
1281 | 1287 | ||
1282 | void __ref arc_cache_init(void) | 1288 | void __ref arc_cache_init(void) |
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index ec47e6079f5d..c75d5c3470e3 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c | |||
@@ -6,20 +6,17 @@ | |||
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | ||
10 | * DMA Coherent API Notes | ||
11 | * | ||
12 | * I/O is inherently non-coherent on ARC. So a coherent DMA buffer is | ||
13 | * implemented by accessing it using a kernel virtual address, with | ||
14 | * Cache bit off in the TLB entry. | ||
15 | * | ||
16 | * The default DMA address == Phy address which is 0x8000_0000 based. | ||
17 | */ | ||
18 | |||
19 | #include <linux/dma-noncoherent.h> | 9 | #include <linux/dma-noncoherent.h> |
20 | #include <asm/cache.h> | 10 | #include <asm/cache.h> |
21 | #include <asm/cacheflush.h> | 11 | #include <asm/cacheflush.h> |
22 | 12 | ||
13 | /* | ||
14 | * ARCH specific callbacks for generic noncoherent DMA ops (dma/noncoherent.c) | ||
15 | * - hardware IOC not available (or "dma-coherent" not set for device in DT) | ||
16 | * - But still handle both coherent and non-coherent requests from caller | ||
17 | * | ||
18 | * For DMA coherent hardware (IOC) generic code suffices | ||
19 | */ | ||
23 | void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, | 20 | void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, |
24 | gfp_t gfp, unsigned long attrs) | 21 | gfp_t gfp, unsigned long attrs) |
25 | { | 22 | { |
@@ -27,42 +24,29 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
27 | struct page *page; | 24 | struct page *page; |
28 | phys_addr_t paddr; | 25 | phys_addr_t paddr; |
29 | void *kvaddr; | 26 | void *kvaddr; |
30 | int need_coh = 1, need_kvaddr = 0; | 27 | bool need_coh = !(attrs & DMA_ATTR_NON_CONSISTENT); |
31 | |||
32 | page = alloc_pages(gfp, order); | ||
33 | if (!page) | ||
34 | return NULL; | ||
35 | 28 | ||
36 | /* | 29 | /* |
37 | * IOC relies on all data (even coherent DMA data) being in cache | 30 | * __GFP_HIGHMEM flag is cleared by upper layer functions |
38 | * Thus allocate normal cached memory | 31 | * (in include/linux/dma-mapping.h) so we should never get a |
39 | * | 32 | * __GFP_HIGHMEM here. |
40 | * The gains with IOC are two pronged: | ||
41 | * -For streaming data, elides need for cache maintenance, saving | ||
42 | * cycles in flush code, and bus bandwidth as all the lines of a | ||
43 | * buffer need to be flushed out to memory | ||
44 | * -For coherent data, Read/Write to buffers terminate early in cache | ||
45 | * (vs. always going to memory - thus are faster) | ||
46 | */ | 33 | */ |
47 | if ((is_isa_arcv2() && ioc_enable) || | 34 | BUG_ON(gfp & __GFP_HIGHMEM); |
48 | (attrs & DMA_ATTR_NON_CONSISTENT)) | ||
49 | need_coh = 0; | ||
50 | 35 | ||
51 | /* | 36 | page = alloc_pages(gfp, order); |
52 | * - A coherent buffer needs MMU mapping to enforce non-cachability | 37 | if (!page) |
53 | * - A highmem page needs a virtual handle (hence MMU mapping) | 38 | return NULL; |
54 | * independent of cachability | ||
55 | */ | ||
56 | if (PageHighMem(page) || need_coh) | ||
57 | need_kvaddr = 1; | ||
58 | 39 | ||
59 | /* This is linear addr (0x8000_0000 based) */ | 40 | /* This is linear addr (0x8000_0000 based) */ |
60 | paddr = page_to_phys(page); | 41 | paddr = page_to_phys(page); |
61 | 42 | ||
62 | *dma_handle = paddr; | 43 | *dma_handle = paddr; |
63 | 44 | ||
64 | /* This is kernel Virtual address (0x7000_0000 based) */ | 45 | /* |
65 | if (need_kvaddr) { | 46 | * A coherent buffer needs MMU mapping to enforce non-cachability. |
47 | * kvaddr is kernel Virtual address (0x7000_0000 based). | ||
48 | */ | ||
49 | if (need_coh) { | ||
66 | kvaddr = ioremap_nocache(paddr, size); | 50 | kvaddr = ioremap_nocache(paddr, size); |
67 | if (kvaddr == NULL) { | 51 | if (kvaddr == NULL) { |
68 | __free_pages(page, order); | 52 | __free_pages(page, order); |
@@ -93,12 +77,8 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr, | |||
93 | { | 77 | { |
94 | phys_addr_t paddr = dma_handle; | 78 | phys_addr_t paddr = dma_handle; |
95 | struct page *page = virt_to_page(paddr); | 79 | struct page *page = virt_to_page(paddr); |
96 | int is_non_coh = 1; | ||
97 | |||
98 | is_non_coh = (attrs & DMA_ATTR_NON_CONSISTENT) || | ||
99 | (is_isa_arcv2() && ioc_enable); | ||
100 | 80 | ||
101 | if (PageHighMem(page) || !is_non_coh) | 81 | if (!(attrs & DMA_ATTR_NON_CONSISTENT)) |
102 | iounmap((void __force __iomem *)vaddr); | 82 | iounmap((void __force __iomem *)vaddr); |
103 | 83 | ||
104 | __free_pages(page, get_order(size)); | 84 | __free_pages(page, get_order(size)); |
@@ -185,3 +165,23 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, | |||
185 | break; | 165 | break; |
186 | } | 166 | } |
187 | } | 167 | } |
168 | |||
169 | /* | ||
170 | * Plug in coherent or noncoherent dma ops | ||
171 | */ | ||
172 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
173 | const struct iommu_ops *iommu, bool coherent) | ||
174 | { | ||
175 | /* | ||
176 | * IOC hardware snoops all DMA traffic keeping the caches consistent | ||
177 | * with memory - eliding need for any explicit cache maintenance of | ||
178 | * DMA buffers - so we can use dma_direct cache ops. | ||
179 | */ | ||
180 | if (is_isa_arcv2() && ioc_enable && coherent) { | ||
181 | set_dma_ops(dev, &dma_direct_ops); | ||
182 | dev_info(dev, "use dma_direct_ops cache ops\n"); | ||
183 | } else { | ||
184 | set_dma_ops(dev, &dma_noncoherent_ops); | ||
185 | dev_info(dev, "use dma_noncoherent_ops cache ops\n"); | ||
186 | } | ||
187 | } | ||
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 79906cecb091..3ad482d2f1eb 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h | |||
@@ -223,7 +223,6 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, | |||
223 | struct kvm_vcpu_events *events); | 223 | struct kvm_vcpu_events *events); |
224 | 224 | ||
225 | #define KVM_ARCH_WANT_MMU_NOTIFIER | 225 | #define KVM_ARCH_WANT_MMU_NOTIFIER |
226 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | ||
227 | int kvm_unmap_hva_range(struct kvm *kvm, | 226 | int kvm_unmap_hva_range(struct kvm *kvm, |
228 | unsigned long start, unsigned long end); | 227 | unsigned long start, unsigned long end); |
229 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); | 228 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); |
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts index ceffc40810ee..48daec7f78ba 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts | |||
@@ -46,6 +46,7 @@ | |||
46 | pinctrl-0 = <&mmc0_pins>; | 46 | pinctrl-0 = <&mmc0_pins>; |
47 | vmmc-supply = <®_cldo1>; | 47 | vmmc-supply = <®_cldo1>; |
48 | cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; | 48 | cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; |
49 | bus-width = <4>; | ||
49 | status = "okay"; | 50 | status = "okay"; |
50 | }; | 51 | }; |
51 | 52 | ||
@@ -56,6 +57,7 @@ | |||
56 | vqmmc-supply = <®_bldo2>; | 57 | vqmmc-supply = <®_bldo2>; |
57 | non-removable; | 58 | non-removable; |
58 | cap-mmc-hw-reset; | 59 | cap-mmc-hw-reset; |
60 | bus-width = <8>; | ||
59 | status = "okay"; | 61 | status = "okay"; |
60 | }; | 62 | }; |
61 | 63 | ||
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index f26055f2306e..3d6d7336f871 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
@@ -61,8 +61,7 @@ struct kvm_arch { | |||
61 | u64 vmid_gen; | 61 | u64 vmid_gen; |
62 | u32 vmid; | 62 | u32 vmid; |
63 | 63 | ||
64 | /* 1-level 2nd stage table and lock */ | 64 | /* 1-level 2nd stage table, protected by kvm->mmu_lock */ |
65 | spinlock_t pgd_lock; | ||
66 | pgd_t *pgd; | 65 | pgd_t *pgd; |
67 | 66 | ||
68 | /* VTTBR value associated with above pgd and vmid */ | 67 | /* VTTBR value associated with above pgd and vmid */ |
@@ -357,7 +356,6 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, | |||
357 | struct kvm_vcpu_events *events); | 356 | struct kvm_vcpu_events *events); |
358 | 357 | ||
359 | #define KVM_ARCH_WANT_MMU_NOTIFIER | 358 | #define KVM_ARCH_WANT_MMU_NOTIFIER |
360 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | ||
361 | int kvm_unmap_hva_range(struct kvm *kvm, | 359 | int kvm_unmap_hva_range(struct kvm *kvm, |
362 | unsigned long start, unsigned long end); | 360 | unsigned long start, unsigned long end); |
363 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); | 361 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); |
diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index d496ef579859..ca46153d7915 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c | |||
@@ -98,8 +98,10 @@ static void activate_traps_vhe(struct kvm_vcpu *vcpu) | |||
98 | val = read_sysreg(cpacr_el1); | 98 | val = read_sysreg(cpacr_el1); |
99 | val |= CPACR_EL1_TTA; | 99 | val |= CPACR_EL1_TTA; |
100 | val &= ~CPACR_EL1_ZEN; | 100 | val &= ~CPACR_EL1_ZEN; |
101 | if (!update_fp_enabled(vcpu)) | 101 | if (!update_fp_enabled(vcpu)) { |
102 | val &= ~CPACR_EL1_FPEN; | 102 | val &= ~CPACR_EL1_FPEN; |
103 | __activate_traps_fpsimd32(vcpu); | ||
104 | } | ||
103 | 105 | ||
104 | write_sysreg(val, cpacr_el1); | 106 | write_sysreg(val, cpacr_el1); |
105 | 107 | ||
@@ -114,8 +116,10 @@ static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu) | |||
114 | 116 | ||
115 | val = CPTR_EL2_DEFAULT; | 117 | val = CPTR_EL2_DEFAULT; |
116 | val |= CPTR_EL2_TTA | CPTR_EL2_TZ; | 118 | val |= CPTR_EL2_TTA | CPTR_EL2_TZ; |
117 | if (!update_fp_enabled(vcpu)) | 119 | if (!update_fp_enabled(vcpu)) { |
118 | val |= CPTR_EL2_TFP; | 120 | val |= CPTR_EL2_TFP; |
121 | __activate_traps_fpsimd32(vcpu); | ||
122 | } | ||
119 | 123 | ||
120 | write_sysreg(val, cptr_el2); | 124 | write_sysreg(val, cptr_el2); |
121 | } | 125 | } |
@@ -129,7 +133,6 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) | |||
129 | if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE)) | 133 | if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE)) |
130 | write_sysreg_s(vcpu->arch.vsesr_el2, SYS_VSESR_EL2); | 134 | write_sysreg_s(vcpu->arch.vsesr_el2, SYS_VSESR_EL2); |
131 | 135 | ||
132 | __activate_traps_fpsimd32(vcpu); | ||
133 | if (has_vhe()) | 136 | if (has_vhe()) |
134 | activate_traps_vhe(vcpu); | 137 | activate_traps_vhe(vcpu); |
135 | else | 138 | else |
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 65f86271f02b..8080c9f489c3 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -985,8 +985,9 @@ int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr) | |||
985 | 985 | ||
986 | pmd = READ_ONCE(*pmdp); | 986 | pmd = READ_ONCE(*pmdp); |
987 | 987 | ||
988 | /* No-op for empty entry and WARN_ON for valid entry */ | 988 | if (!pmd_present(pmd)) |
989 | if (!pmd_present(pmd) || !pmd_table(pmd)) { | 989 | return 1; |
990 | if (!pmd_table(pmd)) { | ||
990 | VM_WARN_ON(!pmd_table(pmd)); | 991 | VM_WARN_ON(!pmd_table(pmd)); |
991 | return 1; | 992 | return 1; |
992 | } | 993 | } |
@@ -1007,8 +1008,9 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr) | |||
1007 | 1008 | ||
1008 | pud = READ_ONCE(*pudp); | 1009 | pud = READ_ONCE(*pudp); |
1009 | 1010 | ||
1010 | /* No-op for empty entry and WARN_ON for valid entry */ | 1011 | if (!pud_present(pud)) |
1011 | if (!pud_present(pud) || !pud_table(pud)) { | 1012 | return 1; |
1013 | if (!pud_table(pud)) { | ||
1012 | VM_WARN_ON(!pud_table(pud)); | 1014 | VM_WARN_ON(!pud_table(pud)); |
1013 | return 1; | 1015 | return 1; |
1014 | } | 1016 | } |
diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c index 70dde040779b..f5453d944ff5 100644 --- a/arch/m68k/mm/mcfmmu.c +++ b/arch/m68k/mm/mcfmmu.c | |||
@@ -172,7 +172,7 @@ void __init cf_bootmem_alloc(void) | |||
172 | high_memory = (void *)_ramend; | 172 | high_memory = (void *)_ramend; |
173 | 173 | ||
174 | /* Reserve kernel text/data/bss */ | 174 | /* Reserve kernel text/data/bss */ |
175 | memblock_reserve(memstart, memstart - _rambase); | 175 | memblock_reserve(_rambase, memstart - _rambase); |
176 | 176 | ||
177 | m68k_virt_to_node_shift = fls(_ramend - 1) - 6; | 177 | m68k_virt_to_node_shift = fls(_ramend - 1) - 6; |
178 | module_fixup(NULL, __start_fixup, __stop_fixup); | 178 | module_fixup(NULL, __start_fixup, __stop_fixup); |
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h index a9af1d2dcd69..2c1c53d12179 100644 --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h | |||
@@ -931,7 +931,6 @@ enum kvm_mips_fault_result kvm_trap_emul_gva_fault(struct kvm_vcpu *vcpu, | |||
931 | bool write); | 931 | bool write); |
932 | 932 | ||
933 | #define KVM_ARCH_WANT_MMU_NOTIFIER | 933 | #define KVM_ARCH_WANT_MMU_NOTIFIER |
934 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | ||
935 | int kvm_unmap_hva_range(struct kvm *kvm, | 934 | int kvm_unmap_hva_range(struct kvm *kvm, |
936 | unsigned long start, unsigned long end); | 935 | unsigned long start, unsigned long end); |
937 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); | 936 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); |
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index 019035d7225c..8f845f6e5f42 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/err.h> | 13 | #include <linux/err.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/ioport.h> | 15 | #include <linux/ioport.h> |
16 | #include <linux/kernel.h> | ||
16 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
17 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
@@ -20,6 +21,7 @@ | |||
20 | 21 | ||
21 | #include <asm/abi.h> | 22 | #include <asm/abi.h> |
22 | #include <asm/mips-cps.h> | 23 | #include <asm/mips-cps.h> |
24 | #include <asm/page.h> | ||
23 | #include <asm/vdso.h> | 25 | #include <asm/vdso.h> |
24 | 26 | ||
25 | /* Kernel-provided data used by the VDSO. */ | 27 | /* Kernel-provided data used by the VDSO. */ |
@@ -128,12 +130,30 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
128 | vvar_size = gic_size + PAGE_SIZE; | 130 | vvar_size = gic_size + PAGE_SIZE; |
129 | size = vvar_size + image->size; | 131 | size = vvar_size + image->size; |
130 | 132 | ||
133 | /* | ||
134 | * Find a region that's large enough for us to perform the | ||
135 | * colour-matching alignment below. | ||
136 | */ | ||
137 | if (cpu_has_dc_aliases) | ||
138 | size += shm_align_mask + 1; | ||
139 | |||
131 | base = get_unmapped_area(NULL, 0, size, 0, 0); | 140 | base = get_unmapped_area(NULL, 0, size, 0, 0); |
132 | if (IS_ERR_VALUE(base)) { | 141 | if (IS_ERR_VALUE(base)) { |
133 | ret = base; | 142 | ret = base; |
134 | goto out; | 143 | goto out; |
135 | } | 144 | } |
136 | 145 | ||
146 | /* | ||
147 | * If we suffer from dcache aliasing, ensure that the VDSO data page | ||
148 | * mapping is coloured the same as the kernel's mapping of that memory. | ||
149 | * This ensures that when the kernel updates the VDSO data userland | ||
150 | * will observe it without requiring cache invalidations. | ||
151 | */ | ||
152 | if (cpu_has_dc_aliases) { | ||
153 | base = __ALIGN_MASK(base, shm_align_mask); | ||
154 | base += ((unsigned long)&vdso_data - gic_size) & shm_align_mask; | ||
155 | } | ||
156 | |||
137 | data_addr = base + gic_size; | 157 | data_addr = base + gic_size; |
138 | vdso_addr = data_addr + PAGE_SIZE; | 158 | vdso_addr = data_addr + PAGE_SIZE; |
139 | 159 | ||
diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c index ee64db032793..d8dcdb350405 100644 --- a/arch/mips/kvm/mmu.c +++ b/arch/mips/kvm/mmu.c | |||
@@ -512,16 +512,6 @@ static int kvm_unmap_hva_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end, | |||
512 | return 1; | 512 | return 1; |
513 | } | 513 | } |
514 | 514 | ||
515 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) | ||
516 | { | ||
517 | unsigned long end = hva + PAGE_SIZE; | ||
518 | |||
519 | handle_hva_to_gpa(kvm, hva, end, &kvm_unmap_hva_handler, NULL); | ||
520 | |||
521 | kvm_mips_callbacks->flush_shadow_all(kvm); | ||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) | 515 | int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) |
526 | { | 516 | { |
527 | handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL); | 517 | handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL); |
diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig index 1d4248fa55e9..7068f341133d 100644 --- a/arch/nds32/Kconfig +++ b/arch/nds32/Kconfig | |||
@@ -40,6 +40,10 @@ config NDS32 | |||
40 | select NO_IOPORT_MAP | 40 | select NO_IOPORT_MAP |
41 | select RTC_LIB | 41 | select RTC_LIB |
42 | select THREAD_INFO_IN_TASK | 42 | select THREAD_INFO_IN_TASK |
43 | select HAVE_FUNCTION_TRACER | ||
44 | select HAVE_FUNCTION_GRAPH_TRACER | ||
45 | select HAVE_FTRACE_MCOUNT_RECORD | ||
46 | select HAVE_DYNAMIC_FTRACE | ||
43 | help | 47 | help |
44 | Andes(nds32) Linux support. | 48 | Andes(nds32) Linux support. |
45 | 49 | ||
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile index 63f4f173e5f4..3509fac10491 100644 --- a/arch/nds32/Makefile +++ b/arch/nds32/Makefile | |||
@@ -5,6 +5,10 @@ KBUILD_DEFCONFIG := defconfig | |||
5 | 5 | ||
6 | comma = , | 6 | comma = , |
7 | 7 | ||
8 | ifdef CONFIG_FUNCTION_TRACER | ||
9 | arch-y += -malways-save-lp -mno-relax | ||
10 | endif | ||
11 | |||
8 | KBUILD_CFLAGS += $(call cc-option, -mno-sched-prolog-epilog) | 12 | KBUILD_CFLAGS += $(call cc-option, -mno-sched-prolog-epilog) |
9 | KBUILD_CFLAGS += -mcmodel=large | 13 | KBUILD_CFLAGS += -mcmodel=large |
10 | 14 | ||
diff --git a/arch/nds32/include/asm/elf.h b/arch/nds32/include/asm/elf.h index 56c479058802..f5f9cf7e0544 100644 --- a/arch/nds32/include/asm/elf.h +++ b/arch/nds32/include/asm/elf.h | |||
@@ -121,9 +121,9 @@ struct elf32_hdr; | |||
121 | */ | 121 | */ |
122 | #define ELF_CLASS ELFCLASS32 | 122 | #define ELF_CLASS ELFCLASS32 |
123 | #ifdef __NDS32_EB__ | 123 | #ifdef __NDS32_EB__ |
124 | #define ELF_DATA ELFDATA2MSB; | 124 | #define ELF_DATA ELFDATA2MSB |
125 | #else | 125 | #else |
126 | #define ELF_DATA ELFDATA2LSB; | 126 | #define ELF_DATA ELFDATA2LSB |
127 | #endif | 127 | #endif |
128 | #define ELF_ARCH EM_NDS32 | 128 | #define ELF_ARCH EM_NDS32 |
129 | #define USE_ELF_CORE_DUMP | 129 | #define USE_ELF_CORE_DUMP |
diff --git a/arch/nds32/include/asm/ftrace.h b/arch/nds32/include/asm/ftrace.h new file mode 100644 index 000000000000..2f96cc96aa35 --- /dev/null +++ b/arch/nds32/include/asm/ftrace.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | |||
3 | #ifndef __ASM_NDS32_FTRACE_H | ||
4 | #define __ASM_NDS32_FTRACE_H | ||
5 | |||
6 | #ifdef CONFIG_FUNCTION_TRACER | ||
7 | |||
8 | #define HAVE_FUNCTION_GRAPH_FP_TEST | ||
9 | |||
10 | #define MCOUNT_ADDR ((unsigned long)(_mcount)) | ||
11 | /* mcount call is composed of three instructions: | ||
12 | * sethi + ori + jral | ||
13 | */ | ||
14 | #define MCOUNT_INSN_SIZE 12 | ||
15 | |||
16 | extern void _mcount(unsigned long parent_ip); | ||
17 | |||
18 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
19 | |||
20 | #define FTRACE_ADDR ((unsigned long)_ftrace_caller) | ||
21 | |||
22 | #ifdef __NDS32_EL__ | ||
23 | #define INSN_NOP 0x09000040 | ||
24 | #define INSN_SIZE(insn) (((insn & 0x00000080) == 0) ? 4 : 2) | ||
25 | #define IS_SETHI(insn) ((insn & 0x000000fe) == 0x00000046) | ||
26 | #define ENDIAN_CONVERT(insn) be32_to_cpu(insn) | ||
27 | #else /* __NDS32_EB__ */ | ||
28 | #define INSN_NOP 0x40000009 | ||
29 | #define INSN_SIZE(insn) (((insn & 0x80000000) == 0) ? 4 : 2) | ||
30 | #define IS_SETHI(insn) ((insn & 0xfe000000) == 0x46000000) | ||
31 | #define ENDIAN_CONVERT(insn) (insn) | ||
32 | #endif | ||
33 | |||
34 | extern void _ftrace_caller(unsigned long parent_ip); | ||
35 | static inline unsigned long ftrace_call_adjust(unsigned long addr) | ||
36 | { | ||
37 | return addr; | ||
38 | } | ||
39 | struct dyn_arch_ftrace { | ||
40 | }; | ||
41 | |||
42 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
43 | |||
44 | #endif /* CONFIG_FUNCTION_TRACER */ | ||
45 | |||
46 | #endif /* __ASM_NDS32_FTRACE_H */ | ||
diff --git a/arch/nds32/include/asm/nds32.h b/arch/nds32/include/asm/nds32.h index 19b19394a936..68c38151c3e4 100644 --- a/arch/nds32/include/asm/nds32.h +++ b/arch/nds32/include/asm/nds32.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #else | 17 | #else |
18 | #define FP_OFFSET (-2) | 18 | #define FP_OFFSET (-2) |
19 | #endif | 19 | #endif |
20 | #define LP_OFFSET (-1) | ||
20 | 21 | ||
21 | extern void __init early_trap_init(void); | 22 | extern void __init early_trap_init(void); |
22 | static inline void GIE_ENABLE(void) | 23 | static inline void GIE_ENABLE(void) |
diff --git a/arch/nds32/include/asm/uaccess.h b/arch/nds32/include/asm/uaccess.h index 18a009f3804d..362a32d9bd16 100644 --- a/arch/nds32/include/asm/uaccess.h +++ b/arch/nds32/include/asm/uaccess.h | |||
@@ -38,7 +38,7 @@ struct exception_table_entry { | |||
38 | extern int fixup_exception(struct pt_regs *regs); | 38 | extern int fixup_exception(struct pt_regs *regs); |
39 | 39 | ||
40 | #define KERNEL_DS ((mm_segment_t) { ~0UL }) | 40 | #define KERNEL_DS ((mm_segment_t) { ~0UL }) |
41 | #define USER_DS ((mm_segment_t) {TASK_SIZE - 1}) | 41 | #define USER_DS ((mm_segment_t) {TASK_SIZE - 1}) |
42 | 42 | ||
43 | #define get_ds() (KERNEL_DS) | 43 | #define get_ds() (KERNEL_DS) |
44 | #define get_fs() (current_thread_info()->addr_limit) | 44 | #define get_fs() (current_thread_info()->addr_limit) |
@@ -49,11 +49,11 @@ static inline void set_fs(mm_segment_t fs) | |||
49 | current_thread_info()->addr_limit = fs; | 49 | current_thread_info()->addr_limit = fs; |
50 | } | 50 | } |
51 | 51 | ||
52 | #define segment_eq(a, b) ((a) == (b)) | 52 | #define segment_eq(a, b) ((a) == (b)) |
53 | 53 | ||
54 | #define __range_ok(addr, size) (size <= get_fs() && addr <= (get_fs() -size)) | 54 | #define __range_ok(addr, size) (size <= get_fs() && addr <= (get_fs() -size)) |
55 | 55 | ||
56 | #define access_ok(type, addr, size) \ | 56 | #define access_ok(type, addr, size) \ |
57 | __range_ok((unsigned long)addr, (unsigned long)size) | 57 | __range_ok((unsigned long)addr, (unsigned long)size) |
58 | /* | 58 | /* |
59 | * Single-value transfer routines. They automatically use the right | 59 | * Single-value transfer routines. They automatically use the right |
@@ -75,70 +75,73 @@ static inline void set_fs(mm_segment_t fs) | |||
75 | * versions are void (ie, don't return a value as such). | 75 | * versions are void (ie, don't return a value as such). |
76 | */ | 76 | */ |
77 | 77 | ||
78 | #define get_user(x,p) \ | 78 | #define get_user __get_user \ |
79 | ({ \ | 79 | |
80 | long __e = -EFAULT; \ | 80 | #define __get_user(x, ptr) \ |
81 | if(likely(access_ok(VERIFY_READ, p, sizeof(*p)))) { \ | ||
82 | __e = __get_user(x,p); \ | ||
83 | } else \ | ||
84 | x = 0; \ | ||
85 | __e; \ | ||
86 | }) | ||
87 | #define __get_user(x,ptr) \ | ||
88 | ({ \ | 81 | ({ \ |
89 | long __gu_err = 0; \ | 82 | long __gu_err = 0; \ |
90 | __get_user_err((x),(ptr),__gu_err); \ | 83 | __get_user_check((x), (ptr), __gu_err); \ |
91 | __gu_err; \ | 84 | __gu_err; \ |
92 | }) | 85 | }) |
93 | 86 | ||
94 | #define __get_user_error(x,ptr,err) \ | 87 | #define __get_user_error(x, ptr, err) \ |
95 | ({ \ | 88 | ({ \ |
96 | __get_user_err((x),(ptr),err); \ | 89 | __get_user_check((x), (ptr), (err)); \ |
97 | (void) 0; \ | 90 | (void)0; \ |
98 | }) | 91 | }) |
99 | 92 | ||
100 | #define __get_user_err(x,ptr,err) \ | 93 | #define __get_user_check(x, ptr, err) \ |
94 | ({ \ | ||
95 | const __typeof__(*(ptr)) __user *__p = (ptr); \ | ||
96 | might_fault(); \ | ||
97 | if (access_ok(VERIFY_READ, __p, sizeof(*__p))) { \ | ||
98 | __get_user_err((x), __p, (err)); \ | ||
99 | } else { \ | ||
100 | (x) = 0; (err) = -EFAULT; \ | ||
101 | } \ | ||
102 | }) | ||
103 | |||
104 | #define __get_user_err(x, ptr, err) \ | ||
101 | do { \ | 105 | do { \ |
102 | unsigned long __gu_addr = (unsigned long)(ptr); \ | ||
103 | unsigned long __gu_val; \ | 106 | unsigned long __gu_val; \ |
104 | __chk_user_ptr(ptr); \ | 107 | __chk_user_ptr(ptr); \ |
105 | switch (sizeof(*(ptr))) { \ | 108 | switch (sizeof(*(ptr))) { \ |
106 | case 1: \ | 109 | case 1: \ |
107 | __get_user_asm("lbi",__gu_val,__gu_addr,err); \ | 110 | __get_user_asm("lbi", __gu_val, (ptr), (err)); \ |
108 | break; \ | 111 | break; \ |
109 | case 2: \ | 112 | case 2: \ |
110 | __get_user_asm("lhi",__gu_val,__gu_addr,err); \ | 113 | __get_user_asm("lhi", __gu_val, (ptr), (err)); \ |
111 | break; \ | 114 | break; \ |
112 | case 4: \ | 115 | case 4: \ |
113 | __get_user_asm("lwi",__gu_val,__gu_addr,err); \ | 116 | __get_user_asm("lwi", __gu_val, (ptr), (err)); \ |
114 | break; \ | 117 | break; \ |
115 | case 8: \ | 118 | case 8: \ |
116 | __get_user_asm_dword(__gu_val,__gu_addr,err); \ | 119 | __get_user_asm_dword(__gu_val, (ptr), (err)); \ |
117 | break; \ | 120 | break; \ |
118 | default: \ | 121 | default: \ |
119 | BUILD_BUG(); \ | 122 | BUILD_BUG(); \ |
120 | break; \ | 123 | break; \ |
121 | } \ | 124 | } \ |
122 | (x) = (__typeof__(*(ptr)))__gu_val; \ | 125 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
123 | } while (0) | 126 | } while (0) |
124 | 127 | ||
125 | #define __get_user_asm(inst,x,addr,err) \ | 128 | #define __get_user_asm(inst, x, addr, err) \ |
126 | asm volatile( \ | 129 | __asm__ __volatile__ ( \ |
127 | "1: "inst" %1,[%2]\n" \ | 130 | "1: "inst" %1,[%2]\n" \ |
128 | "2:\n" \ | 131 | "2:\n" \ |
129 | " .section .fixup,\"ax\"\n" \ | 132 | " .section .fixup,\"ax\"\n" \ |
130 | " .align 2\n" \ | 133 | " .align 2\n" \ |
131 | "3: move %0, %3\n" \ | 134 | "3: move %0, %3\n" \ |
132 | " move %1, #0\n" \ | 135 | " move %1, #0\n" \ |
133 | " b 2b\n" \ | 136 | " b 2b\n" \ |
134 | " .previous\n" \ | 137 | " .previous\n" \ |
135 | " .section __ex_table,\"a\"\n" \ | 138 | " .section __ex_table,\"a\"\n" \ |
136 | " .align 3\n" \ | 139 | " .align 3\n" \ |
137 | " .long 1b, 3b\n" \ | 140 | " .long 1b, 3b\n" \ |
138 | " .previous" \ | 141 | " .previous" \ |
139 | : "+r" (err), "=&r" (x) \ | 142 | : "+r" (err), "=&r" (x) \ |
140 | : "r" (addr), "i" (-EFAULT) \ | 143 | : "r" (addr), "i" (-EFAULT) \ |
141 | : "cc") | 144 | : "cc") |
142 | 145 | ||
143 | #ifdef __NDS32_EB__ | 146 | #ifdef __NDS32_EB__ |
144 | #define __gu_reg_oper0 "%H1" | 147 | #define __gu_reg_oper0 "%H1" |
@@ -149,61 +152,66 @@ do { \ | |||
149 | #endif | 152 | #endif |
150 | 153 | ||
151 | #define __get_user_asm_dword(x, addr, err) \ | 154 | #define __get_user_asm_dword(x, addr, err) \ |
152 | asm volatile( \ | 155 | __asm__ __volatile__ ( \ |
153 | "\n1:\tlwi " __gu_reg_oper0 ",[%2]\n" \ | 156 | "\n1:\tlwi " __gu_reg_oper0 ",[%2]\n" \ |
154 | "\n2:\tlwi " __gu_reg_oper1 ",[%2+4]\n" \ | 157 | "\n2:\tlwi " __gu_reg_oper1 ",[%2+4]\n" \ |
155 | "3:\n" \ | 158 | "3:\n" \ |
156 | " .section .fixup,\"ax\"\n" \ | 159 | " .section .fixup,\"ax\"\n" \ |
157 | " .align 2\n" \ | 160 | " .align 2\n" \ |
158 | "4: move %0, %3\n" \ | 161 | "4: move %0, %3\n" \ |
159 | " b 3b\n" \ | 162 | " b 3b\n" \ |
160 | " .previous\n" \ | 163 | " .previous\n" \ |
161 | " .section __ex_table,\"a\"\n" \ | 164 | " .section __ex_table,\"a\"\n" \ |
162 | " .align 3\n" \ | 165 | " .align 3\n" \ |
163 | " .long 1b, 4b\n" \ | 166 | " .long 1b, 4b\n" \ |
164 | " .long 2b, 4b\n" \ | 167 | " .long 2b, 4b\n" \ |
165 | " .previous" \ | 168 | " .previous" \ |
166 | : "+r"(err), "=&r"(x) \ | 169 | : "+r"(err), "=&r"(x) \ |
167 | : "r"(addr), "i"(-EFAULT) \ | 170 | : "r"(addr), "i"(-EFAULT) \ |
168 | : "cc") | 171 | : "cc") |
169 | #define put_user(x,p) \ | 172 | |
170 | ({ \ | 173 | #define put_user __put_user \ |
171 | long __e = -EFAULT; \ | 174 | |
172 | if(likely(access_ok(VERIFY_WRITE, p, sizeof(*p)))) { \ | 175 | #define __put_user(x, ptr) \ |
173 | __e = __put_user(x,p); \ | ||
174 | } \ | ||
175 | __e; \ | ||
176 | }) | ||
177 | #define __put_user(x,ptr) \ | ||
178 | ({ \ | 176 | ({ \ |
179 | long __pu_err = 0; \ | 177 | long __pu_err = 0; \ |
180 | __put_user_err((x),(ptr),__pu_err); \ | 178 | __put_user_err((x), (ptr), __pu_err); \ |
181 | __pu_err; \ | 179 | __pu_err; \ |
182 | }) | 180 | }) |
183 | 181 | ||
184 | #define __put_user_error(x,ptr,err) \ | 182 | #define __put_user_error(x, ptr, err) \ |
183 | ({ \ | ||
184 | __put_user_err((x), (ptr), (err)); \ | ||
185 | (void)0; \ | ||
186 | }) | ||
187 | |||
188 | #define __put_user_check(x, ptr, err) \ | ||
185 | ({ \ | 189 | ({ \ |
186 | __put_user_err((x),(ptr),err); \ | 190 | __typeof__(*(ptr)) __user *__p = (ptr); \ |
187 | (void) 0; \ | 191 | might_fault(); \ |
192 | if (access_ok(VERIFY_WRITE, __p, sizeof(*__p))) { \ | ||
193 | __put_user_err((x), __p, (err)); \ | ||
194 | } else { \ | ||
195 | (err) = -EFAULT; \ | ||
196 | } \ | ||
188 | }) | 197 | }) |
189 | 198 | ||
190 | #define __put_user_err(x,ptr,err) \ | 199 | #define __put_user_err(x, ptr, err) \ |
191 | do { \ | 200 | do { \ |
192 | unsigned long __pu_addr = (unsigned long)(ptr); \ | ||
193 | __typeof__(*(ptr)) __pu_val = (x); \ | 201 | __typeof__(*(ptr)) __pu_val = (x); \ |
194 | __chk_user_ptr(ptr); \ | 202 | __chk_user_ptr(ptr); \ |
195 | switch (sizeof(*(ptr))) { \ | 203 | switch (sizeof(*(ptr))) { \ |
196 | case 1: \ | 204 | case 1: \ |
197 | __put_user_asm("sbi",__pu_val,__pu_addr,err); \ | 205 | __put_user_asm("sbi", __pu_val, (ptr), (err)); \ |
198 | break; \ | 206 | break; \ |
199 | case 2: \ | 207 | case 2: \ |
200 | __put_user_asm("shi",__pu_val,__pu_addr,err); \ | 208 | __put_user_asm("shi", __pu_val, (ptr), (err)); \ |
201 | break; \ | 209 | break; \ |
202 | case 4: \ | 210 | case 4: \ |
203 | __put_user_asm("swi",__pu_val,__pu_addr,err); \ | 211 | __put_user_asm("swi", __pu_val, (ptr), (err)); \ |
204 | break; \ | 212 | break; \ |
205 | case 8: \ | 213 | case 8: \ |
206 | __put_user_asm_dword(__pu_val,__pu_addr,err); \ | 214 | __put_user_asm_dword(__pu_val, (ptr), (err)); \ |
207 | break; \ | 215 | break; \ |
208 | default: \ | 216 | default: \ |
209 | BUILD_BUG(); \ | 217 | BUILD_BUG(); \ |
@@ -211,22 +219,22 @@ do { \ | |||
211 | } \ | 219 | } \ |
212 | } while (0) | 220 | } while (0) |
213 | 221 | ||
214 | #define __put_user_asm(inst,x,addr,err) \ | 222 | #define __put_user_asm(inst, x, addr, err) \ |
215 | asm volatile( \ | 223 | __asm__ __volatile__ ( \ |
216 | "1: "inst" %1,[%2]\n" \ | 224 | "1: "inst" %1,[%2]\n" \ |
217 | "2:\n" \ | 225 | "2:\n" \ |
218 | " .section .fixup,\"ax\"\n" \ | 226 | " .section .fixup,\"ax\"\n" \ |
219 | " .align 2\n" \ | 227 | " .align 2\n" \ |
220 | "3: move %0, %3\n" \ | 228 | "3: move %0, %3\n" \ |
221 | " b 2b\n" \ | 229 | " b 2b\n" \ |
222 | " .previous\n" \ | 230 | " .previous\n" \ |
223 | " .section __ex_table,\"a\"\n" \ | 231 | " .section __ex_table,\"a\"\n" \ |
224 | " .align 3\n" \ | 232 | " .align 3\n" \ |
225 | " .long 1b, 3b\n" \ | 233 | " .long 1b, 3b\n" \ |
226 | " .previous" \ | 234 | " .previous" \ |
227 | : "+r" (err) \ | 235 | : "+r" (err) \ |
228 | : "r" (x), "r" (addr), "i" (-EFAULT) \ | 236 | : "r" (x), "r" (addr), "i" (-EFAULT) \ |
229 | : "cc") | 237 | : "cc") |
230 | 238 | ||
231 | #ifdef __NDS32_EB__ | 239 | #ifdef __NDS32_EB__ |
232 | #define __pu_reg_oper0 "%H2" | 240 | #define __pu_reg_oper0 "%H2" |
@@ -237,23 +245,24 @@ do { \ | |||
237 | #endif | 245 | #endif |
238 | 246 | ||
239 | #define __put_user_asm_dword(x, addr, err) \ | 247 | #define __put_user_asm_dword(x, addr, err) \ |
240 | asm volatile( \ | 248 | __asm__ __volatile__ ( \ |
241 | "\n1:\tswi " __pu_reg_oper0 ",[%1]\n" \ | 249 | "\n1:\tswi " __pu_reg_oper0 ",[%1]\n" \ |
242 | "\n2:\tswi " __pu_reg_oper1 ",[%1+4]\n" \ | 250 | "\n2:\tswi " __pu_reg_oper1 ",[%1+4]\n" \ |
243 | "3:\n" \ | 251 | "3:\n" \ |
244 | " .section .fixup,\"ax\"\n" \ | 252 | " .section .fixup,\"ax\"\n" \ |
245 | " .align 2\n" \ | 253 | " .align 2\n" \ |
246 | "4: move %0, %3\n" \ | 254 | "4: move %0, %3\n" \ |
247 | " b 3b\n" \ | 255 | " b 3b\n" \ |
248 | " .previous\n" \ | 256 | " .previous\n" \ |
249 | " .section __ex_table,\"a\"\n" \ | 257 | " .section __ex_table,\"a\"\n" \ |
250 | " .align 3\n" \ | 258 | " .align 3\n" \ |
251 | " .long 1b, 4b\n" \ | 259 | " .long 1b, 4b\n" \ |
252 | " .long 2b, 4b\n" \ | 260 | " .long 2b, 4b\n" \ |
253 | " .previous" \ | 261 | " .previous" \ |
254 | : "+r"(err) \ | 262 | : "+r"(err) \ |
255 | : "r"(addr), "r"(x), "i"(-EFAULT) \ | 263 | : "r"(addr), "r"(x), "i"(-EFAULT) \ |
256 | : "cc") | 264 | : "cc") |
265 | |||
257 | extern unsigned long __arch_clear_user(void __user * addr, unsigned long n); | 266 | extern unsigned long __arch_clear_user(void __user * addr, unsigned long n); |
258 | extern long strncpy_from_user(char *dest, const char __user * src, long count); | 267 | extern long strncpy_from_user(char *dest, const char __user * src, long count); |
259 | extern __must_check long strlen_user(const char __user * str); | 268 | extern __must_check long strlen_user(const char __user * str); |
diff --git a/arch/nds32/kernel/Makefile b/arch/nds32/kernel/Makefile index 42792743e8b9..27cded39fa66 100644 --- a/arch/nds32/kernel/Makefile +++ b/arch/nds32/kernel/Makefile | |||
@@ -21,3 +21,9 @@ extra-y := head.o vmlinux.lds | |||
21 | 21 | ||
22 | 22 | ||
23 | obj-y += vdso/ | 23 | obj-y += vdso/ |
24 | |||
25 | obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o | ||
26 | |||
27 | ifdef CONFIG_FUNCTION_TRACER | ||
28 | CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) | ||
29 | endif | ||
diff --git a/arch/nds32/kernel/atl2c.c b/arch/nds32/kernel/atl2c.c index 0c6d031a1c4a..0c5386e72098 100644 --- a/arch/nds32/kernel/atl2c.c +++ b/arch/nds32/kernel/atl2c.c | |||
@@ -9,7 +9,8 @@ | |||
9 | 9 | ||
10 | void __iomem *atl2c_base; | 10 | void __iomem *atl2c_base; |
11 | static const struct of_device_id atl2c_ids[] __initconst = { | 11 | static const struct of_device_id atl2c_ids[] __initconst = { |
12 | {.compatible = "andestech,atl2c",} | 12 | {.compatible = "andestech,atl2c",}, |
13 | {} | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | static int __init atl2c_of_init(void) | 16 | static int __init atl2c_of_init(void) |
diff --git a/arch/nds32/kernel/ex-entry.S b/arch/nds32/kernel/ex-entry.S index b8ae4e9a6b93..21a144071566 100644 --- a/arch/nds32/kernel/ex-entry.S +++ b/arch/nds32/kernel/ex-entry.S | |||
@@ -118,7 +118,7 @@ common_exception_handler: | |||
118 | /* interrupt */ | 118 | /* interrupt */ |
119 | 2: | 119 | 2: |
120 | #ifdef CONFIG_TRACE_IRQFLAGS | 120 | #ifdef CONFIG_TRACE_IRQFLAGS |
121 | jal trace_hardirqs_off | 121 | jal __trace_hardirqs_off |
122 | #endif | 122 | #endif |
123 | move $r0, $sp | 123 | move $r0, $sp |
124 | sethi $lp, hi20(ret_from_intr) | 124 | sethi $lp, hi20(ret_from_intr) |
diff --git a/arch/nds32/kernel/ex-exit.S b/arch/nds32/kernel/ex-exit.S index 03e4f7788a18..f00af92f7e22 100644 --- a/arch/nds32/kernel/ex-exit.S +++ b/arch/nds32/kernel/ex-exit.S | |||
@@ -138,8 +138,8 @@ no_work_pending: | |||
138 | #ifdef CONFIG_TRACE_IRQFLAGS | 138 | #ifdef CONFIG_TRACE_IRQFLAGS |
139 | lwi $p0, [$sp+(#IPSW_OFFSET)] | 139 | lwi $p0, [$sp+(#IPSW_OFFSET)] |
140 | andi $p0, $p0, #0x1 | 140 | andi $p0, $p0, #0x1 |
141 | la $r10, trace_hardirqs_off | 141 | la $r10, __trace_hardirqs_off |
142 | la $r9, trace_hardirqs_on | 142 | la $r9, __trace_hardirqs_on |
143 | cmovz $r9, $p0, $r10 | 143 | cmovz $r9, $p0, $r10 |
144 | jral $r9 | 144 | jral $r9 |
145 | #endif | 145 | #endif |
diff --git a/arch/nds32/kernel/ftrace.c b/arch/nds32/kernel/ftrace.c new file mode 100644 index 000000000000..a0a9679ad5de --- /dev/null +++ b/arch/nds32/kernel/ftrace.c | |||
@@ -0,0 +1,309 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | #include <linux/ftrace.h> | ||
4 | #include <linux/uaccess.h> | ||
5 | #include <asm/cacheflush.h> | ||
6 | |||
7 | #ifndef CONFIG_DYNAMIC_FTRACE | ||
8 | extern void (*ftrace_trace_function)(unsigned long, unsigned long, | ||
9 | struct ftrace_ops*, struct pt_regs*); | ||
10 | extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace); | ||
11 | extern void ftrace_graph_caller(void); | ||
12 | |||
13 | noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip, | ||
14 | struct ftrace_ops *op, struct pt_regs *regs) | ||
15 | { | ||
16 | __asm__ (""); /* avoid to optimize as pure function */ | ||
17 | } | ||
18 | |||
19 | noinline void _mcount(unsigned long parent_ip) | ||
20 | { | ||
21 | /* save all state by the compiler prologue */ | ||
22 | |||
23 | unsigned long ip = (unsigned long)__builtin_return_address(0); | ||
24 | |||
25 | if (ftrace_trace_function != ftrace_stub) | ||
26 | ftrace_trace_function(ip - MCOUNT_INSN_SIZE, parent_ip, | ||
27 | NULL, NULL); | ||
28 | |||
29 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
30 | if (ftrace_graph_return != (trace_func_graph_ret_t)ftrace_stub | ||
31 | || ftrace_graph_entry != ftrace_graph_entry_stub) | ||
32 | ftrace_graph_caller(); | ||
33 | #endif | ||
34 | |||
35 | /* restore all state by the compiler epilogue */ | ||
36 | } | ||
37 | EXPORT_SYMBOL(_mcount); | ||
38 | |||
39 | #else /* CONFIG_DYNAMIC_FTRACE */ | ||
40 | |||
41 | noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip, | ||
42 | struct ftrace_ops *op, struct pt_regs *regs) | ||
43 | { | ||
44 | __asm__ (""); /* avoid to optimize as pure function */ | ||
45 | } | ||
46 | |||
47 | noinline void __naked _mcount(unsigned long parent_ip) | ||
48 | { | ||
49 | __asm__ (""); /* avoid to optimize as pure function */ | ||
50 | } | ||
51 | EXPORT_SYMBOL(_mcount); | ||
52 | |||
53 | #define XSTR(s) STR(s) | ||
54 | #define STR(s) #s | ||
55 | void _ftrace_caller(unsigned long parent_ip) | ||
56 | { | ||
57 | /* save all state needed by the compiler prologue */ | ||
58 | |||
59 | /* | ||
60 | * prepare arguments for real tracing function | ||
61 | * first arg : __builtin_return_address(0) - MCOUNT_INSN_SIZE | ||
62 | * second arg : parent_ip | ||
63 | */ | ||
64 | __asm__ __volatile__ ( | ||
65 | "move $r1, %0 \n\t" | ||
66 | "addi $r0, %1, #-" XSTR(MCOUNT_INSN_SIZE) "\n\t" | ||
67 | : | ||
68 | : "r" (parent_ip), "r" (__builtin_return_address(0))); | ||
69 | |||
70 | /* a placeholder for the call to a real tracing function */ | ||
71 | __asm__ __volatile__ ( | ||
72 | "ftrace_call: \n\t" | ||
73 | "nop \n\t" | ||
74 | "nop \n\t" | ||
75 | "nop \n\t"); | ||
76 | |||
77 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
78 | /* a placeholder for the call to ftrace_graph_caller */ | ||
79 | __asm__ __volatile__ ( | ||
80 | "ftrace_graph_call: \n\t" | ||
81 | "nop \n\t" | ||
82 | "nop \n\t" | ||
83 | "nop \n\t"); | ||
84 | #endif | ||
85 | /* restore all state needed by the compiler epilogue */ | ||
86 | } | ||
87 | |||
88 | int __init ftrace_dyn_arch_init(void) | ||
89 | { | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | int ftrace_arch_code_modify_prepare(void) | ||
94 | { | ||
95 | set_all_modules_text_rw(); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | int ftrace_arch_code_modify_post_process(void) | ||
100 | { | ||
101 | set_all_modules_text_ro(); | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static unsigned long gen_sethi_insn(unsigned long addr) | ||
106 | { | ||
107 | unsigned long opcode = 0x46000000; | ||
108 | unsigned long imm = addr >> 12; | ||
109 | unsigned long rt_num = 0xf << 20; | ||
110 | |||
111 | return ENDIAN_CONVERT(opcode | rt_num | imm); | ||
112 | } | ||
113 | |||
114 | static unsigned long gen_ori_insn(unsigned long addr) | ||
115 | { | ||
116 | unsigned long opcode = 0x58000000; | ||
117 | unsigned long imm = addr & 0x0000fff; | ||
118 | unsigned long rt_num = 0xf << 20; | ||
119 | unsigned long ra_num = 0xf << 15; | ||
120 | |||
121 | return ENDIAN_CONVERT(opcode | rt_num | ra_num | imm); | ||
122 | } | ||
123 | |||
124 | static unsigned long gen_jral_insn(unsigned long addr) | ||
125 | { | ||
126 | unsigned long opcode = 0x4a000001; | ||
127 | unsigned long rt_num = 0x1e << 20; | ||
128 | unsigned long rb_num = 0xf << 10; | ||
129 | |||
130 | return ENDIAN_CONVERT(opcode | rt_num | rb_num); | ||
131 | } | ||
132 | |||
133 | static void ftrace_gen_call_insn(unsigned long *call_insns, | ||
134 | unsigned long addr) | ||
135 | { | ||
136 | call_insns[0] = gen_sethi_insn(addr); /* sethi $r15, imm20u */ | ||
137 | call_insns[1] = gen_ori_insn(addr); /* ori $r15, $r15, imm15u */ | ||
138 | call_insns[2] = gen_jral_insn(addr); /* jral $lp, $r15 */ | ||
139 | } | ||
140 | |||
141 | static int __ftrace_modify_code(unsigned long pc, unsigned long *old_insn, | ||
142 | unsigned long *new_insn, bool validate) | ||
143 | { | ||
144 | unsigned long orig_insn[3]; | ||
145 | |||
146 | if (validate) { | ||
147 | if (probe_kernel_read(orig_insn, (void *)pc, MCOUNT_INSN_SIZE)) | ||
148 | return -EFAULT; | ||
149 | if (memcmp(orig_insn, old_insn, MCOUNT_INSN_SIZE)) | ||
150 | return -EINVAL; | ||
151 | } | ||
152 | |||
153 | if (probe_kernel_write((void *)pc, new_insn, MCOUNT_INSN_SIZE)) | ||
154 | return -EPERM; | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static int ftrace_modify_code(unsigned long pc, unsigned long *old_insn, | ||
160 | unsigned long *new_insn, bool validate) | ||
161 | { | ||
162 | int ret; | ||
163 | |||
164 | ret = __ftrace_modify_code(pc, old_insn, new_insn, validate); | ||
165 | if (ret) | ||
166 | return ret; | ||
167 | |||
168 | flush_icache_range(pc, pc + MCOUNT_INSN_SIZE); | ||
169 | |||
170 | return ret; | ||
171 | } | ||
172 | |||
173 | int ftrace_update_ftrace_func(ftrace_func_t func) | ||
174 | { | ||
175 | unsigned long pc = (unsigned long)&ftrace_call; | ||
176 | unsigned long old_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
177 | unsigned long new_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
178 | |||
179 | if (func != ftrace_stub) | ||
180 | ftrace_gen_call_insn(new_insn, (unsigned long)func); | ||
181 | |||
182 | return ftrace_modify_code(pc, old_insn, new_insn, false); | ||
183 | } | ||
184 | |||
185 | int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | ||
186 | { | ||
187 | unsigned long pc = rec->ip; | ||
188 | unsigned long nop_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
189 | unsigned long call_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
190 | |||
191 | ftrace_gen_call_insn(call_insn, addr); | ||
192 | |||
193 | return ftrace_modify_code(pc, nop_insn, call_insn, true); | ||
194 | } | ||
195 | |||
196 | int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, | ||
197 | unsigned long addr) | ||
198 | { | ||
199 | unsigned long pc = rec->ip; | ||
200 | unsigned long nop_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
201 | unsigned long call_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
202 | |||
203 | ftrace_gen_call_insn(call_insn, addr); | ||
204 | |||
205 | return ftrace_modify_code(pc, call_insn, nop_insn, true); | ||
206 | } | ||
207 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
208 | |||
209 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
210 | void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, | ||
211 | unsigned long frame_pointer) | ||
212 | { | ||
213 | unsigned long return_hooker = (unsigned long)&return_to_handler; | ||
214 | struct ftrace_graph_ent trace; | ||
215 | unsigned long old; | ||
216 | int err; | ||
217 | |||
218 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | ||
219 | return; | ||
220 | |||
221 | old = *parent; | ||
222 | |||
223 | trace.func = self_addr; | ||
224 | trace.depth = current->curr_ret_stack + 1; | ||
225 | |||
226 | /* Only trace if the calling function expects to */ | ||
227 | if (!ftrace_graph_entry(&trace)) | ||
228 | return; | ||
229 | |||
230 | err = ftrace_push_return_trace(old, self_addr, &trace.depth, | ||
231 | frame_pointer, NULL); | ||
232 | |||
233 | if (err == -EBUSY) | ||
234 | return; | ||
235 | |||
236 | *parent = return_hooker; | ||
237 | } | ||
238 | |||
239 | noinline void ftrace_graph_caller(void) | ||
240 | { | ||
241 | unsigned long *parent_ip = | ||
242 | (unsigned long *)(__builtin_frame_address(2) - 4); | ||
243 | |||
244 | unsigned long selfpc = | ||
245 | (unsigned long)(__builtin_return_address(1) - MCOUNT_INSN_SIZE); | ||
246 | |||
247 | unsigned long frame_pointer = | ||
248 | (unsigned long)__builtin_frame_address(3); | ||
249 | |||
250 | prepare_ftrace_return(parent_ip, selfpc, frame_pointer); | ||
251 | } | ||
252 | |||
253 | extern unsigned long ftrace_return_to_handler(unsigned long frame_pointer); | ||
254 | void __naked return_to_handler(void) | ||
255 | { | ||
256 | __asm__ __volatile__ ( | ||
257 | /* save state needed by the ABI */ | ||
258 | "smw.adm $r0,[$sp],$r1,#0x0 \n\t" | ||
259 | |||
260 | /* get original return address */ | ||
261 | "move $r0, $fp \n\t" | ||
262 | "bal ftrace_return_to_handler\n\t" | ||
263 | "move $lp, $r0 \n\t" | ||
264 | |||
265 | /* restore state nedded by the ABI */ | ||
266 | "lmw.bim $r0,[$sp],$r1,#0x0 \n\t"); | ||
267 | } | ||
268 | |||
269 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
270 | extern unsigned long ftrace_graph_call; | ||
271 | |||
272 | static int ftrace_modify_graph_caller(bool enable) | ||
273 | { | ||
274 | unsigned long pc = (unsigned long)&ftrace_graph_call; | ||
275 | unsigned long nop_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
276 | unsigned long call_insn[3] = {INSN_NOP, INSN_NOP, INSN_NOP}; | ||
277 | |||
278 | ftrace_gen_call_insn(call_insn, (unsigned long)ftrace_graph_caller); | ||
279 | |||
280 | if (enable) | ||
281 | return ftrace_modify_code(pc, nop_insn, call_insn, true); | ||
282 | else | ||
283 | return ftrace_modify_code(pc, call_insn, nop_insn, true); | ||
284 | } | ||
285 | |||
286 | int ftrace_enable_ftrace_graph_caller(void) | ||
287 | { | ||
288 | return ftrace_modify_graph_caller(true); | ||
289 | } | ||
290 | |||
291 | int ftrace_disable_ftrace_graph_caller(void) | ||
292 | { | ||
293 | return ftrace_modify_graph_caller(false); | ||
294 | } | ||
295 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
296 | |||
297 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | ||
298 | |||
299 | |||
300 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
301 | noinline void __trace_hardirqs_off(void) | ||
302 | { | ||
303 | trace_hardirqs_off(); | ||
304 | } | ||
305 | noinline void __trace_hardirqs_on(void) | ||
306 | { | ||
307 | trace_hardirqs_on(); | ||
308 | } | ||
309 | #endif /* CONFIG_TRACE_IRQFLAGS */ | ||
diff --git a/arch/nds32/kernel/module.c b/arch/nds32/kernel/module.c index 4167283d8293..1e31829cbc2a 100644 --- a/arch/nds32/kernel/module.c +++ b/arch/nds32/kernel/module.c | |||
@@ -40,7 +40,7 @@ void do_reloc16(unsigned int val, unsigned int *loc, unsigned int val_mask, | |||
40 | 40 | ||
41 | tmp2 = tmp & loc_mask; | 41 | tmp2 = tmp & loc_mask; |
42 | if (partial_in_place) { | 42 | if (partial_in_place) { |
43 | tmp &= (!loc_mask); | 43 | tmp &= (~loc_mask); |
44 | tmp = | 44 | tmp = |
45 | tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); | 45 | tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); |
46 | } else { | 46 | } else { |
@@ -70,7 +70,7 @@ void do_reloc32(unsigned int val, unsigned int *loc, unsigned int val_mask, | |||
70 | 70 | ||
71 | tmp2 = tmp & loc_mask; | 71 | tmp2 = tmp & loc_mask; |
72 | if (partial_in_place) { | 72 | if (partial_in_place) { |
73 | tmp &= (!loc_mask); | 73 | tmp &= (~loc_mask); |
74 | tmp = | 74 | tmp = |
75 | tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); | 75 | tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); |
76 | } else { | 76 | } else { |
diff --git a/arch/nds32/kernel/stacktrace.c b/arch/nds32/kernel/stacktrace.c index 8b231e910ea6..d974c0c1c65f 100644 --- a/arch/nds32/kernel/stacktrace.c +++ b/arch/nds32/kernel/stacktrace.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/sched/debug.h> | 4 | #include <linux/sched/debug.h> |
5 | #include <linux/sched/task_stack.h> | 5 | #include <linux/sched/task_stack.h> |
6 | #include <linux/stacktrace.h> | 6 | #include <linux/stacktrace.h> |
7 | #include <linux/ftrace.h> | ||
7 | 8 | ||
8 | void save_stack_trace(struct stack_trace *trace) | 9 | void save_stack_trace(struct stack_trace *trace) |
9 | { | 10 | { |
@@ -16,6 +17,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) | |||
16 | unsigned long *fpn; | 17 | unsigned long *fpn; |
17 | int skip = trace->skip; | 18 | int skip = trace->skip; |
18 | int savesched; | 19 | int savesched; |
20 | int graph_idx = 0; | ||
19 | 21 | ||
20 | if (tsk == current) { | 22 | if (tsk == current) { |
21 | __asm__ __volatile__("\tori\t%0, $fp, #0\n":"=r"(fpn)); | 23 | __asm__ __volatile__("\tori\t%0, $fp, #0\n":"=r"(fpn)); |
@@ -29,10 +31,12 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) | |||
29 | && (fpn >= (unsigned long *)TASK_SIZE)) { | 31 | && (fpn >= (unsigned long *)TASK_SIZE)) { |
30 | unsigned long lpp, fpp; | 32 | unsigned long lpp, fpp; |
31 | 33 | ||
32 | lpp = fpn[-1]; | 34 | lpp = fpn[LP_OFFSET]; |
33 | fpp = fpn[FP_OFFSET]; | 35 | fpp = fpn[FP_OFFSET]; |
34 | if (!__kernel_text_address(lpp)) | 36 | if (!__kernel_text_address(lpp)) |
35 | break; | 37 | break; |
38 | else | ||
39 | lpp = ftrace_graph_ret_addr(tsk, &graph_idx, lpp, NULL); | ||
36 | 40 | ||
37 | if (savesched || !in_sched_functions(lpp)) { | 41 | if (savesched || !in_sched_functions(lpp)) { |
38 | if (skip) { | 42 | if (skip) { |
diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c index a6205fd4db52..1496aab48998 100644 --- a/arch/nds32/kernel/traps.c +++ b/arch/nds32/kernel/traps.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/kdebug.h> | 8 | #include <linux/kdebug.h> |
9 | #include <linux/sched/task_stack.h> | 9 | #include <linux/sched/task_stack.h> |
10 | #include <linux/uaccess.h> | 10 | #include <linux/uaccess.h> |
11 | #include <linux/ftrace.h> | ||
11 | 12 | ||
12 | #include <asm/proc-fns.h> | 13 | #include <asm/proc-fns.h> |
13 | #include <asm/unistd.h> | 14 | #include <asm/unistd.h> |
@@ -94,28 +95,6 @@ static void dump_instr(struct pt_regs *regs) | |||
94 | set_fs(fs); | 95 | set_fs(fs); |
95 | } | 96 | } |
96 | 97 | ||
97 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
98 | #include <linux/ftrace.h> | ||
99 | static void | ||
100 | get_real_ret_addr(unsigned long *addr, struct task_struct *tsk, int *graph) | ||
101 | { | ||
102 | if (*addr == (unsigned long)return_to_handler) { | ||
103 | int index = tsk->curr_ret_stack; | ||
104 | |||
105 | if (tsk->ret_stack && index >= *graph) { | ||
106 | index -= *graph; | ||
107 | *addr = tsk->ret_stack[index].ret; | ||
108 | (*graph)++; | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | #else | ||
113 | static inline void | ||
114 | get_real_ret_addr(unsigned long *addr, struct task_struct *tsk, int *graph) | ||
115 | { | ||
116 | } | ||
117 | #endif | ||
118 | |||
119 | #define LOOP_TIMES (100) | 98 | #define LOOP_TIMES (100) |
120 | static void __dump(struct task_struct *tsk, unsigned long *base_reg) | 99 | static void __dump(struct task_struct *tsk, unsigned long *base_reg) |
121 | { | 100 | { |
@@ -126,7 +105,8 @@ static void __dump(struct task_struct *tsk, unsigned long *base_reg) | |||
126 | while (!kstack_end(base_reg)) { | 105 | while (!kstack_end(base_reg)) { |
127 | ret_addr = *base_reg++; | 106 | ret_addr = *base_reg++; |
128 | if (__kernel_text_address(ret_addr)) { | 107 | if (__kernel_text_address(ret_addr)) { |
129 | get_real_ret_addr(&ret_addr, tsk, &graph); | 108 | ret_addr = ftrace_graph_ret_addr( |
109 | tsk, &graph, ret_addr, NULL); | ||
130 | print_ip_sym(ret_addr); | 110 | print_ip_sym(ret_addr); |
131 | } | 111 | } |
132 | if (--cnt < 0) | 112 | if (--cnt < 0) |
@@ -137,15 +117,12 @@ static void __dump(struct task_struct *tsk, unsigned long *base_reg) | |||
137 | !((unsigned long)base_reg & 0x3) && | 117 | !((unsigned long)base_reg & 0x3) && |
138 | ((unsigned long)base_reg >= TASK_SIZE)) { | 118 | ((unsigned long)base_reg >= TASK_SIZE)) { |
139 | unsigned long next_fp; | 119 | unsigned long next_fp; |
140 | #if !defined(NDS32_ABI_2) | 120 | ret_addr = base_reg[LP_OFFSET]; |
141 | ret_addr = base_reg[0]; | ||
142 | next_fp = base_reg[1]; | ||
143 | #else | ||
144 | ret_addr = base_reg[-1]; | ||
145 | next_fp = base_reg[FP_OFFSET]; | 121 | next_fp = base_reg[FP_OFFSET]; |
146 | #endif | ||
147 | if (__kernel_text_address(ret_addr)) { | 122 | if (__kernel_text_address(ret_addr)) { |
148 | get_real_ret_addr(&ret_addr, tsk, &graph); | 123 | |
124 | ret_addr = ftrace_graph_ret_addr( | ||
125 | tsk, &graph, ret_addr, NULL); | ||
149 | print_ip_sym(ret_addr); | 126 | print_ip_sym(ret_addr); |
150 | } | 127 | } |
151 | if (--cnt < 0) | 128 | if (--cnt < 0) |
@@ -196,11 +173,10 @@ void die(const char *str, struct pt_regs *regs, int err) | |||
196 | pr_emerg("CPU: %i\n", smp_processor_id()); | 173 | pr_emerg("CPU: %i\n", smp_processor_id()); |
197 | show_regs(regs); | 174 | show_regs(regs); |
198 | pr_emerg("Process %s (pid: %d, stack limit = 0x%p)\n", | 175 | pr_emerg("Process %s (pid: %d, stack limit = 0x%p)\n", |
199 | tsk->comm, tsk->pid, task_thread_info(tsk) + 1); | 176 | tsk->comm, tsk->pid, end_of_stack(tsk)); |
200 | 177 | ||
201 | if (!user_mode(regs) || in_interrupt()) { | 178 | if (!user_mode(regs) || in_interrupt()) { |
202 | dump_mem("Stack: ", regs->sp, | 179 | dump_mem("Stack: ", regs->sp, (regs->sp + PAGE_SIZE) & PAGE_MASK); |
203 | THREAD_SIZE + (unsigned long)task_thread_info(tsk)); | ||
204 | dump_instr(regs); | 180 | dump_instr(regs); |
205 | dump_stack(); | 181 | dump_stack(); |
206 | } | 182 | } |
diff --git a/arch/nds32/kernel/vmlinux.lds.S b/arch/nds32/kernel/vmlinux.lds.S index 288313b886ef..9e90f30a181d 100644 --- a/arch/nds32/kernel/vmlinux.lds.S +++ b/arch/nds32/kernel/vmlinux.lds.S | |||
@@ -13,14 +13,26 @@ OUTPUT_ARCH(nds32) | |||
13 | ENTRY(_stext_lma) | 13 | ENTRY(_stext_lma) |
14 | jiffies = jiffies_64; | 14 | jiffies = jiffies_64; |
15 | 15 | ||
16 | #if defined(CONFIG_GCOV_KERNEL) | ||
17 | #define NDS32_EXIT_KEEP(x) x | ||
18 | #else | ||
19 | #define NDS32_EXIT_KEEP(x) | ||
20 | #endif | ||
21 | |||
16 | SECTIONS | 22 | SECTIONS |
17 | { | 23 | { |
18 | _stext_lma = TEXTADDR - LOAD_OFFSET; | 24 | _stext_lma = TEXTADDR - LOAD_OFFSET; |
19 | . = TEXTADDR; | 25 | . = TEXTADDR; |
20 | __init_begin = .; | 26 | __init_begin = .; |
21 | HEAD_TEXT_SECTION | 27 | HEAD_TEXT_SECTION |
28 | .exit.text : { | ||
29 | NDS32_EXIT_KEEP(EXIT_TEXT) | ||
30 | } | ||
22 | INIT_TEXT_SECTION(PAGE_SIZE) | 31 | INIT_TEXT_SECTION(PAGE_SIZE) |
23 | INIT_DATA_SECTION(16) | 32 | INIT_DATA_SECTION(16) |
33 | .exit.data : { | ||
34 | NDS32_EXIT_KEEP(EXIT_DATA) | ||
35 | } | ||
24 | PERCPU_SECTION(L1_CACHE_BYTES) | 36 | PERCPU_SECTION(L1_CACHE_BYTES) |
25 | __init_end = .; | 37 | __init_end = .; |
26 | 38 | ||
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 3c0e8fb2b773..68e14afecac8 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c | |||
@@ -358,7 +358,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, | |||
358 | unsigned long pp, key; | 358 | unsigned long pp, key; |
359 | unsigned long v, orig_v, gr; | 359 | unsigned long v, orig_v, gr; |
360 | __be64 *hptep; | 360 | __be64 *hptep; |
361 | int index; | 361 | long int index; |
362 | int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR); | 362 | int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR); |
363 | 363 | ||
364 | if (kvm_is_radix(vcpu->kvm)) | 364 | if (kvm_is_radix(vcpu->kvm)) |
diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c index 0af1c0aea1fe..fd6e8c13685f 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c | |||
@@ -725,10 +725,10 @@ int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot, | |||
725 | gpa, shift); | 725 | gpa, shift); |
726 | kvmppc_radix_tlbie_page(kvm, gpa, shift); | 726 | kvmppc_radix_tlbie_page(kvm, gpa, shift); |
727 | if ((old & _PAGE_DIRTY) && memslot->dirty_bitmap) { | 727 | if ((old & _PAGE_DIRTY) && memslot->dirty_bitmap) { |
728 | unsigned long npages = 1; | 728 | unsigned long psize = PAGE_SIZE; |
729 | if (shift) | 729 | if (shift) |
730 | npages = 1ul << (shift - PAGE_SHIFT); | 730 | psize = 1ul << shift; |
731 | kvmppc_update_dirty_map(memslot, gfn, npages); | 731 | kvmppc_update_dirty_map(memslot, gfn, psize); |
732 | } | 732 | } |
733 | } | 733 | } |
734 | return 0; | 734 | return 0; |
diff --git a/arch/s390/include/asm/mmu.h b/arch/s390/include/asm/mmu.h index f31a15044c24..a8418e1379eb 100644 --- a/arch/s390/include/asm/mmu.h +++ b/arch/s390/include/asm/mmu.h | |||
@@ -16,7 +16,13 @@ typedef struct { | |||
16 | unsigned long asce; | 16 | unsigned long asce; |
17 | unsigned long asce_limit; | 17 | unsigned long asce_limit; |
18 | unsigned long vdso_base; | 18 | unsigned long vdso_base; |
19 | /* The mmu context allocates 4K page tables. */ | 19 | /* |
20 | * The following bitfields need a down_write on the mm | ||
21 | * semaphore when they are written to. As they are only | ||
22 | * written once, they can be read without a lock. | ||
23 | * | ||
24 | * The mmu context allocates 4K page tables. | ||
25 | */ | ||
20 | unsigned int alloc_pgste:1; | 26 | unsigned int alloc_pgste:1; |
21 | /* The mmu context uses extended page tables. */ | 27 | /* The mmu context uses extended page tables. */ |
22 | unsigned int has_pgste:1; | 28 | unsigned int has_pgste:1; |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 91ad4a9425c0..f69333fd2fa3 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -695,7 +695,9 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) | |||
695 | r = -EINVAL; | 695 | r = -EINVAL; |
696 | else { | 696 | else { |
697 | r = 0; | 697 | r = 0; |
698 | down_write(&kvm->mm->mmap_sem); | ||
698 | kvm->mm->context.allow_gmap_hpage_1m = 1; | 699 | kvm->mm->context.allow_gmap_hpage_1m = 1; |
700 | up_write(&kvm->mm->mmap_sem); | ||
699 | /* | 701 | /* |
700 | * We might have to create fake 4k page | 702 | * We might have to create fake 4k page |
701 | * tables. To avoid that the hardware works on | 703 | * tables. To avoid that the hardware works on |
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index d68f10441a16..8679bd74d337 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -280,9 +280,11 @@ retry: | |||
280 | goto retry; | 280 | goto retry; |
281 | } | 281 | } |
282 | } | 282 | } |
283 | if (rc) | ||
284 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | ||
285 | up_read(¤t->mm->mmap_sem); | 283 | up_read(¤t->mm->mmap_sem); |
284 | if (rc == -EFAULT) | ||
285 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | ||
286 | if (rc < 0) | ||
287 | return rc; | ||
286 | vcpu->run->s.regs.gprs[reg1] &= ~0xff; | 288 | vcpu->run->s.regs.gprs[reg1] &= ~0xff; |
287 | vcpu->run->s.regs.gprs[reg1] |= key; | 289 | vcpu->run->s.regs.gprs[reg1] |= key; |
288 | return 0; | 290 | return 0; |
@@ -324,9 +326,11 @@ retry: | |||
324 | goto retry; | 326 | goto retry; |
325 | } | 327 | } |
326 | } | 328 | } |
327 | if (rc < 0) | ||
328 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | ||
329 | up_read(¤t->mm->mmap_sem); | 329 | up_read(¤t->mm->mmap_sem); |
330 | if (rc == -EFAULT) | ||
331 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | ||
332 | if (rc < 0) | ||
333 | return rc; | ||
330 | kvm_s390_set_psw_cc(vcpu, rc); | 334 | kvm_s390_set_psw_cc(vcpu, rc); |
331 | return 0; | 335 | return 0; |
332 | } | 336 | } |
@@ -390,12 +394,12 @@ static int handle_sske(struct kvm_vcpu *vcpu) | |||
390 | FAULT_FLAG_WRITE, &unlocked); | 394 | FAULT_FLAG_WRITE, &unlocked); |
391 | rc = !rc ? -EAGAIN : rc; | 395 | rc = !rc ? -EAGAIN : rc; |
392 | } | 396 | } |
397 | up_read(¤t->mm->mmap_sem); | ||
393 | if (rc == -EFAULT) | 398 | if (rc == -EFAULT) |
394 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 399 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
395 | 400 | if (rc < 0) | |
396 | up_read(¤t->mm->mmap_sem); | 401 | return rc; |
397 | if (rc >= 0) | 402 | start += PAGE_SIZE; |
398 | start += PAGE_SIZE; | ||
399 | } | 403 | } |
400 | 404 | ||
401 | if (m3 & (SSKE_MC | SSKE_MR)) { | 405 | if (m3 & (SSKE_MC | SSKE_MR)) { |
@@ -1002,13 +1006,15 @@ static int handle_pfmf(struct kvm_vcpu *vcpu) | |||
1002 | FAULT_FLAG_WRITE, &unlocked); | 1006 | FAULT_FLAG_WRITE, &unlocked); |
1003 | rc = !rc ? -EAGAIN : rc; | 1007 | rc = !rc ? -EAGAIN : rc; |
1004 | } | 1008 | } |
1009 | up_read(¤t->mm->mmap_sem); | ||
1005 | if (rc == -EFAULT) | 1010 | if (rc == -EFAULT) |
1006 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 1011 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
1007 | 1012 | if (rc == -EAGAIN) | |
1008 | up_read(¤t->mm->mmap_sem); | 1013 | continue; |
1009 | if (rc >= 0) | 1014 | if (rc < 0) |
1010 | start += PAGE_SIZE; | 1015 | return rc; |
1011 | } | 1016 | } |
1017 | start += PAGE_SIZE; | ||
1012 | } | 1018 | } |
1013 | if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) { | 1019 | if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) { |
1014 | if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) { | 1020 | if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) { |
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index 63844b95c22c..a2b28cd1e3fe 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c | |||
@@ -173,7 +173,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) | |||
173 | return set_validity_icpt(scb_s, 0x0039U); | 173 | return set_validity_icpt(scb_s, 0x0039U); |
174 | 174 | ||
175 | /* copy only the wrapping keys */ | 175 | /* copy only the wrapping keys */ |
176 | if (read_guest_real(vcpu, crycb_addr + 72, &vsie_page->crycb, 56)) | 176 | if (read_guest_real(vcpu, crycb_addr + 72, |
177 | vsie_page->crycb.dea_wrapping_key_mask, 56)) | ||
177 | return set_validity_icpt(scb_s, 0x0035U); | 178 | return set_validity_icpt(scb_s, 0x0035U); |
178 | 179 | ||
179 | scb_s->ecb3 |= ecb3_flags; | 180 | scb_s->ecb3 |= ecb3_flags; |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 00ddb0c9e612..8e90488c3d56 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -1237,19 +1237,12 @@ enum emulation_result { | |||
1237 | #define EMULTYPE_NO_DECODE (1 << 0) | 1237 | #define EMULTYPE_NO_DECODE (1 << 0) |
1238 | #define EMULTYPE_TRAP_UD (1 << 1) | 1238 | #define EMULTYPE_TRAP_UD (1 << 1) |
1239 | #define EMULTYPE_SKIP (1 << 2) | 1239 | #define EMULTYPE_SKIP (1 << 2) |
1240 | #define EMULTYPE_RETRY (1 << 3) | 1240 | #define EMULTYPE_ALLOW_RETRY (1 << 3) |
1241 | #define EMULTYPE_NO_REEXECUTE (1 << 4) | 1241 | #define EMULTYPE_NO_UD_ON_FAIL (1 << 4) |
1242 | #define EMULTYPE_NO_UD_ON_FAIL (1 << 5) | 1242 | #define EMULTYPE_VMWARE (1 << 5) |
1243 | #define EMULTYPE_VMWARE (1 << 6) | 1243 | int kvm_emulate_instruction(struct kvm_vcpu *vcpu, int emulation_type); |
1244 | int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2, | 1244 | int kvm_emulate_instruction_from_buffer(struct kvm_vcpu *vcpu, |
1245 | int emulation_type, void *insn, int insn_len); | 1245 | void *insn, int insn_len); |
1246 | |||
1247 | static inline int emulate_instruction(struct kvm_vcpu *vcpu, | ||
1248 | int emulation_type) | ||
1249 | { | ||
1250 | return x86_emulate_instruction(vcpu, 0, | ||
1251 | emulation_type | EMULTYPE_NO_REEXECUTE, NULL, 0); | ||
1252 | } | ||
1253 | 1246 | ||
1254 | void kvm_enable_efer_bits(u64); | 1247 | void kvm_enable_efer_bits(u64); |
1255 | bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer); | 1248 | bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer); |
@@ -1450,7 +1443,6 @@ asmlinkage void kvm_spurious_fault(void); | |||
1450 | ____kvm_handle_fault_on_reboot(insn, "") | 1443 | ____kvm_handle_fault_on_reboot(insn, "") |
1451 | 1444 | ||
1452 | #define KVM_ARCH_WANT_MMU_NOTIFIER | 1445 | #define KVM_ARCH_WANT_MMU_NOTIFIER |
1453 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | ||
1454 | int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end); | 1446 | int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end); |
1455 | int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end); | 1447 | int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end); |
1456 | int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); | 1448 | int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); |
@@ -1463,7 +1455,7 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event); | |||
1463 | void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu); | 1455 | void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu); |
1464 | 1456 | ||
1465 | int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, | 1457 | int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, |
1466 | unsigned long ipi_bitmap_high, int min, | 1458 | unsigned long ipi_bitmap_high, u32 min, |
1467 | unsigned long icr, int op_64_bit); | 1459 | unsigned long icr, int op_64_bit); |
1468 | 1460 | ||
1469 | u64 kvm_get_arch_capabilities(void); | 1461 | u64 kvm_get_arch_capabilities(void); |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0cefba28c864..17c0472c5b34 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -548,7 +548,7 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq, | |||
548 | } | 548 | } |
549 | 549 | ||
550 | int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, | 550 | int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, |
551 | unsigned long ipi_bitmap_high, int min, | 551 | unsigned long ipi_bitmap_high, u32 min, |
552 | unsigned long icr, int op_64_bit) | 552 | unsigned long icr, int op_64_bit) |
553 | { | 553 | { |
554 | int i; | 554 | int i; |
@@ -571,18 +571,31 @@ int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, | |||
571 | rcu_read_lock(); | 571 | rcu_read_lock(); |
572 | map = rcu_dereference(kvm->arch.apic_map); | 572 | map = rcu_dereference(kvm->arch.apic_map); |
573 | 573 | ||
574 | if (min > map->max_apic_id) | ||
575 | goto out; | ||
574 | /* Bits above cluster_size are masked in the caller. */ | 576 | /* Bits above cluster_size are masked in the caller. */ |
575 | for_each_set_bit(i, &ipi_bitmap_low, BITS_PER_LONG) { | 577 | for_each_set_bit(i, &ipi_bitmap_low, |
576 | vcpu = map->phys_map[min + i]->vcpu; | 578 | min((u32)BITS_PER_LONG, (map->max_apic_id - min + 1))) { |
577 | count += kvm_apic_set_irq(vcpu, &irq, NULL); | 579 | if (map->phys_map[min + i]) { |
580 | vcpu = map->phys_map[min + i]->vcpu; | ||
581 | count += kvm_apic_set_irq(vcpu, &irq, NULL); | ||
582 | } | ||
578 | } | 583 | } |
579 | 584 | ||
580 | min += cluster_size; | 585 | min += cluster_size; |
581 | for_each_set_bit(i, &ipi_bitmap_high, BITS_PER_LONG) { | 586 | |
582 | vcpu = map->phys_map[min + i]->vcpu; | 587 | if (min > map->max_apic_id) |
583 | count += kvm_apic_set_irq(vcpu, &irq, NULL); | 588 | goto out; |
589 | |||
590 | for_each_set_bit(i, &ipi_bitmap_high, | ||
591 | min((u32)BITS_PER_LONG, (map->max_apic_id - min + 1))) { | ||
592 | if (map->phys_map[min + i]) { | ||
593 | vcpu = map->phys_map[min + i]->vcpu; | ||
594 | count += kvm_apic_set_irq(vcpu, &irq, NULL); | ||
595 | } | ||
584 | } | 596 | } |
585 | 597 | ||
598 | out: | ||
586 | rcu_read_unlock(); | 599 | rcu_read_unlock(); |
587 | return count; | 600 | return count; |
588 | } | 601 | } |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index a282321329b5..e24ea7067373 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -1853,11 +1853,6 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, | |||
1853 | return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler); | 1853 | return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler); |
1854 | } | 1854 | } |
1855 | 1855 | ||
1856 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) | ||
1857 | { | ||
1858 | return kvm_handle_hva(kvm, hva, 0, kvm_unmap_rmapp); | ||
1859 | } | ||
1860 | |||
1861 | int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) | 1856 | int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) |
1862 | { | 1857 | { |
1863 | return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp); | 1858 | return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp); |
@@ -5217,7 +5212,7 @@ static int make_mmu_pages_available(struct kvm_vcpu *vcpu) | |||
5217 | int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code, | 5212 | int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code, |
5218 | void *insn, int insn_len) | 5213 | void *insn, int insn_len) |
5219 | { | 5214 | { |
5220 | int r, emulation_type = EMULTYPE_RETRY; | 5215 | int r, emulation_type = 0; |
5221 | enum emulation_result er; | 5216 | enum emulation_result er; |
5222 | bool direct = vcpu->arch.mmu.direct_map; | 5217 | bool direct = vcpu->arch.mmu.direct_map; |
5223 | 5218 | ||
@@ -5230,10 +5225,8 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code, | |||
5230 | r = RET_PF_INVALID; | 5225 | r = RET_PF_INVALID; |
5231 | if (unlikely(error_code & PFERR_RSVD_MASK)) { | 5226 | if (unlikely(error_code & PFERR_RSVD_MASK)) { |
5232 | r = handle_mmio_page_fault(vcpu, cr2, direct); | 5227 | r = handle_mmio_page_fault(vcpu, cr2, direct); |
5233 | if (r == RET_PF_EMULATE) { | 5228 | if (r == RET_PF_EMULATE) |
5234 | emulation_type = 0; | ||
5235 | goto emulate; | 5229 | goto emulate; |
5236 | } | ||
5237 | } | 5230 | } |
5238 | 5231 | ||
5239 | if (r == RET_PF_INVALID) { | 5232 | if (r == RET_PF_INVALID) { |
@@ -5260,8 +5253,19 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code, | |||
5260 | return 1; | 5253 | return 1; |
5261 | } | 5254 | } |
5262 | 5255 | ||
5263 | if (mmio_info_in_cache(vcpu, cr2, direct)) | 5256 | /* |
5264 | emulation_type = 0; | 5257 | * vcpu->arch.mmu.page_fault returned RET_PF_EMULATE, but we can still |
5258 | * optimistically try to just unprotect the page and let the processor | ||
5259 | * re-execute the instruction that caused the page fault. Do not allow | ||
5260 | * retrying MMIO emulation, as it's not only pointless but could also | ||
5261 | * cause us to enter an infinite loop because the processor will keep | ||
5262 | * faulting on the non-existent MMIO address. Retrying an instruction | ||
5263 | * from a nested guest is also pointless and dangerous as we are only | ||
5264 | * explicitly shadowing L1's page tables, i.e. unprotecting something | ||
5265 | * for L1 isn't going to magically fix whatever issue cause L2 to fail. | ||
5266 | */ | ||
5267 | if (!mmio_info_in_cache(vcpu, cr2, direct) && !is_guest_mode(vcpu)) | ||
5268 | emulation_type = EMULTYPE_ALLOW_RETRY; | ||
5265 | emulate: | 5269 | emulate: |
5266 | /* | 5270 | /* |
5267 | * On AMD platforms, under certain conditions insn_len may be zero on #NPF. | 5271 | * On AMD platforms, under certain conditions insn_len may be zero on #NPF. |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 6276140044d0..89c4c5aa15f1 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -776,7 +776,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) | |||
776 | } | 776 | } |
777 | 777 | ||
778 | if (!svm->next_rip) { | 778 | if (!svm->next_rip) { |
779 | if (emulate_instruction(vcpu, EMULTYPE_SKIP) != | 779 | if (kvm_emulate_instruction(vcpu, EMULTYPE_SKIP) != |
780 | EMULATE_DONE) | 780 | EMULATE_DONE) |
781 | printk(KERN_DEBUG "%s: NOP\n", __func__); | 781 | printk(KERN_DEBUG "%s: NOP\n", __func__); |
782 | return; | 782 | return; |
@@ -2715,7 +2715,7 @@ static int gp_interception(struct vcpu_svm *svm) | |||
2715 | 2715 | ||
2716 | WARN_ON_ONCE(!enable_vmware_backdoor); | 2716 | WARN_ON_ONCE(!enable_vmware_backdoor); |
2717 | 2717 | ||
2718 | er = emulate_instruction(vcpu, | 2718 | er = kvm_emulate_instruction(vcpu, |
2719 | EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL); | 2719 | EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL); |
2720 | if (er == EMULATE_USER_EXIT) | 2720 | if (er == EMULATE_USER_EXIT) |
2721 | return 0; | 2721 | return 0; |
@@ -2819,7 +2819,7 @@ static int io_interception(struct vcpu_svm *svm) | |||
2819 | string = (io_info & SVM_IOIO_STR_MASK) != 0; | 2819 | string = (io_info & SVM_IOIO_STR_MASK) != 0; |
2820 | in = (io_info & SVM_IOIO_TYPE_MASK) != 0; | 2820 | in = (io_info & SVM_IOIO_TYPE_MASK) != 0; |
2821 | if (string) | 2821 | if (string) |
2822 | return emulate_instruction(vcpu, 0) == EMULATE_DONE; | 2822 | return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE; |
2823 | 2823 | ||
2824 | port = io_info >> 16; | 2824 | port = io_info >> 16; |
2825 | size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT; | 2825 | size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT; |
@@ -3861,7 +3861,7 @@ static int iret_interception(struct vcpu_svm *svm) | |||
3861 | static int invlpg_interception(struct vcpu_svm *svm) | 3861 | static int invlpg_interception(struct vcpu_svm *svm) |
3862 | { | 3862 | { |
3863 | if (!static_cpu_has(X86_FEATURE_DECODEASSISTS)) | 3863 | if (!static_cpu_has(X86_FEATURE_DECODEASSISTS)) |
3864 | return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; | 3864 | return kvm_emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; |
3865 | 3865 | ||
3866 | kvm_mmu_invlpg(&svm->vcpu, svm->vmcb->control.exit_info_1); | 3866 | kvm_mmu_invlpg(&svm->vcpu, svm->vmcb->control.exit_info_1); |
3867 | return kvm_skip_emulated_instruction(&svm->vcpu); | 3867 | return kvm_skip_emulated_instruction(&svm->vcpu); |
@@ -3869,13 +3869,13 @@ static int invlpg_interception(struct vcpu_svm *svm) | |||
3869 | 3869 | ||
3870 | static int emulate_on_interception(struct vcpu_svm *svm) | 3870 | static int emulate_on_interception(struct vcpu_svm *svm) |
3871 | { | 3871 | { |
3872 | return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; | 3872 | return kvm_emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; |
3873 | } | 3873 | } |
3874 | 3874 | ||
3875 | static int rsm_interception(struct vcpu_svm *svm) | 3875 | static int rsm_interception(struct vcpu_svm *svm) |
3876 | { | 3876 | { |
3877 | return x86_emulate_instruction(&svm->vcpu, 0, 0, | 3877 | return kvm_emulate_instruction_from_buffer(&svm->vcpu, |
3878 | rsm_ins_bytes, 2) == EMULATE_DONE; | 3878 | rsm_ins_bytes, 2) == EMULATE_DONE; |
3879 | } | 3879 | } |
3880 | 3880 | ||
3881 | static int rdpmc_interception(struct vcpu_svm *svm) | 3881 | static int rdpmc_interception(struct vcpu_svm *svm) |
@@ -4700,7 +4700,7 @@ static int avic_unaccelerated_access_interception(struct vcpu_svm *svm) | |||
4700 | ret = avic_unaccel_trap_write(svm); | 4700 | ret = avic_unaccel_trap_write(svm); |
4701 | } else { | 4701 | } else { |
4702 | /* Handling Fault */ | 4702 | /* Handling Fault */ |
4703 | ret = (emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE); | 4703 | ret = (kvm_emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE); |
4704 | } | 4704 | } |
4705 | 4705 | ||
4706 | return ret; | 4706 | return ret; |
@@ -6747,7 +6747,7 @@ e_free: | |||
6747 | static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) | 6747 | static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) |
6748 | { | 6748 | { |
6749 | unsigned long vaddr, vaddr_end, next_vaddr; | 6749 | unsigned long vaddr, vaddr_end, next_vaddr; |
6750 | unsigned long dst_vaddr, dst_vaddr_end; | 6750 | unsigned long dst_vaddr; |
6751 | struct page **src_p, **dst_p; | 6751 | struct page **src_p, **dst_p; |
6752 | struct kvm_sev_dbg debug; | 6752 | struct kvm_sev_dbg debug; |
6753 | unsigned long n; | 6753 | unsigned long n; |
@@ -6763,7 +6763,6 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) | |||
6763 | size = debug.len; | 6763 | size = debug.len; |
6764 | vaddr_end = vaddr + size; | 6764 | vaddr_end = vaddr + size; |
6765 | dst_vaddr = debug.dst_uaddr; | 6765 | dst_vaddr = debug.dst_uaddr; |
6766 | dst_vaddr_end = dst_vaddr + size; | ||
6767 | 6766 | ||
6768 | for (; vaddr < vaddr_end; vaddr = next_vaddr) { | 6767 | for (; vaddr < vaddr_end; vaddr = next_vaddr) { |
6769 | int len, s_off, d_off; | 6768 | int len, s_off, d_off; |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1d26f3c4985b..533a327372c8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -6983,7 +6983,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, | |||
6983 | * Cause the #SS fault with 0 error code in VM86 mode. | 6983 | * Cause the #SS fault with 0 error code in VM86 mode. |
6984 | */ | 6984 | */ |
6985 | if (((vec == GP_VECTOR) || (vec == SS_VECTOR)) && err_code == 0) { | 6985 | if (((vec == GP_VECTOR) || (vec == SS_VECTOR)) && err_code == 0) { |
6986 | if (emulate_instruction(vcpu, 0) == EMULATE_DONE) { | 6986 | if (kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE) { |
6987 | if (vcpu->arch.halt_request) { | 6987 | if (vcpu->arch.halt_request) { |
6988 | vcpu->arch.halt_request = 0; | 6988 | vcpu->arch.halt_request = 0; |
6989 | return kvm_vcpu_halt(vcpu); | 6989 | return kvm_vcpu_halt(vcpu); |
@@ -7054,7 +7054,7 @@ static int handle_exception(struct kvm_vcpu *vcpu) | |||
7054 | 7054 | ||
7055 | if (!vmx->rmode.vm86_active && is_gp_fault(intr_info)) { | 7055 | if (!vmx->rmode.vm86_active && is_gp_fault(intr_info)) { |
7056 | WARN_ON_ONCE(!enable_vmware_backdoor); | 7056 | WARN_ON_ONCE(!enable_vmware_backdoor); |
7057 | er = emulate_instruction(vcpu, | 7057 | er = kvm_emulate_instruction(vcpu, |
7058 | EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL); | 7058 | EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL); |
7059 | if (er == EMULATE_USER_EXIT) | 7059 | if (er == EMULATE_USER_EXIT) |
7060 | return 0; | 7060 | return 0; |
@@ -7157,7 +7157,7 @@ static int handle_io(struct kvm_vcpu *vcpu) | |||
7157 | ++vcpu->stat.io_exits; | 7157 | ++vcpu->stat.io_exits; |
7158 | 7158 | ||
7159 | if (string) | 7159 | if (string) |
7160 | return emulate_instruction(vcpu, 0) == EMULATE_DONE; | 7160 | return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE; |
7161 | 7161 | ||
7162 | port = exit_qualification >> 16; | 7162 | port = exit_qualification >> 16; |
7163 | size = (exit_qualification & 7) + 1; | 7163 | size = (exit_qualification & 7) + 1; |
@@ -7231,7 +7231,7 @@ static int handle_set_cr4(struct kvm_vcpu *vcpu, unsigned long val) | |||
7231 | static int handle_desc(struct kvm_vcpu *vcpu) | 7231 | static int handle_desc(struct kvm_vcpu *vcpu) |
7232 | { | 7232 | { |
7233 | WARN_ON(!(vcpu->arch.cr4 & X86_CR4_UMIP)); | 7233 | WARN_ON(!(vcpu->arch.cr4 & X86_CR4_UMIP)); |
7234 | return emulate_instruction(vcpu, 0) == EMULATE_DONE; | 7234 | return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE; |
7235 | } | 7235 | } |
7236 | 7236 | ||
7237 | static int handle_cr(struct kvm_vcpu *vcpu) | 7237 | static int handle_cr(struct kvm_vcpu *vcpu) |
@@ -7480,7 +7480,7 @@ static int handle_vmcall(struct kvm_vcpu *vcpu) | |||
7480 | 7480 | ||
7481 | static int handle_invd(struct kvm_vcpu *vcpu) | 7481 | static int handle_invd(struct kvm_vcpu *vcpu) |
7482 | { | 7482 | { |
7483 | return emulate_instruction(vcpu, 0) == EMULATE_DONE; | 7483 | return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE; |
7484 | } | 7484 | } |
7485 | 7485 | ||
7486 | static int handle_invlpg(struct kvm_vcpu *vcpu) | 7486 | static int handle_invlpg(struct kvm_vcpu *vcpu) |
@@ -7547,7 +7547,7 @@ static int handle_apic_access(struct kvm_vcpu *vcpu) | |||
7547 | return kvm_skip_emulated_instruction(vcpu); | 7547 | return kvm_skip_emulated_instruction(vcpu); |
7548 | } | 7548 | } |
7549 | } | 7549 | } |
7550 | return emulate_instruction(vcpu, 0) == EMULATE_DONE; | 7550 | return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE; |
7551 | } | 7551 | } |
7552 | 7552 | ||
7553 | static int handle_apic_eoi_induced(struct kvm_vcpu *vcpu) | 7553 | static int handle_apic_eoi_induced(struct kvm_vcpu *vcpu) |
@@ -7704,8 +7704,8 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu) | |||
7704 | if (!static_cpu_has(X86_FEATURE_HYPERVISOR)) | 7704 | if (!static_cpu_has(X86_FEATURE_HYPERVISOR)) |
7705 | return kvm_skip_emulated_instruction(vcpu); | 7705 | return kvm_skip_emulated_instruction(vcpu); |
7706 | else | 7706 | else |
7707 | return x86_emulate_instruction(vcpu, gpa, EMULTYPE_SKIP, | 7707 | return kvm_emulate_instruction(vcpu, EMULTYPE_SKIP) == |
7708 | NULL, 0) == EMULATE_DONE; | 7708 | EMULATE_DONE; |
7709 | } | 7709 | } |
7710 | 7710 | ||
7711 | return kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0); | 7711 | return kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0); |
@@ -7748,7 +7748,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) | |||
7748 | if (kvm_test_request(KVM_REQ_EVENT, vcpu)) | 7748 | if (kvm_test_request(KVM_REQ_EVENT, vcpu)) |
7749 | return 1; | 7749 | return 1; |
7750 | 7750 | ||
7751 | err = emulate_instruction(vcpu, 0); | 7751 | err = kvm_emulate_instruction(vcpu, 0); |
7752 | 7752 | ||
7753 | if (err == EMULATE_USER_EXIT) { | 7753 | if (err == EMULATE_USER_EXIT) { |
7754 | ++vcpu->stat.mmio_exits; | 7754 | ++vcpu->stat.mmio_exits; |
@@ -12537,8 +12537,11 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, u32 *exit_qual) | |||
12537 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); | 12537 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); |
12538 | bool from_vmentry = !!exit_qual; | 12538 | bool from_vmentry = !!exit_qual; |
12539 | u32 dummy_exit_qual; | 12539 | u32 dummy_exit_qual; |
12540 | u32 vmcs01_cpu_exec_ctrl; | ||
12540 | int r = 0; | 12541 | int r = 0; |
12541 | 12542 | ||
12543 | vmcs01_cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); | ||
12544 | |||
12542 | enter_guest_mode(vcpu); | 12545 | enter_guest_mode(vcpu); |
12543 | 12546 | ||
12544 | if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) | 12547 | if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) |
@@ -12575,6 +12578,25 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, u32 *exit_qual) | |||
12575 | } | 12578 | } |
12576 | 12579 | ||
12577 | /* | 12580 | /* |
12581 | * If L1 had a pending IRQ/NMI until it executed | ||
12582 | * VMLAUNCH/VMRESUME which wasn't delivered because it was | ||
12583 | * disallowed (e.g. interrupts disabled), L0 needs to | ||
12584 | * evaluate if this pending event should cause an exit from L2 | ||
12585 | * to L1 or delivered directly to L2 (e.g. In case L1 don't | ||
12586 | * intercept EXTERNAL_INTERRUPT). | ||
12587 | * | ||
12588 | * Usually this would be handled by L0 requesting a | ||
12589 | * IRQ/NMI window by setting VMCS accordingly. However, | ||
12590 | * this setting was done on VMCS01 and now VMCS02 is active | ||
12591 | * instead. Thus, we force L0 to perform pending event | ||
12592 | * evaluation by requesting a KVM_REQ_EVENT. | ||
12593 | */ | ||
12594 | if (vmcs01_cpu_exec_ctrl & | ||
12595 | (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING)) { | ||
12596 | kvm_make_request(KVM_REQ_EVENT, vcpu); | ||
12597 | } | ||
12598 | |||
12599 | /* | ||
12578 | * Note no nested_vmx_succeed or nested_vmx_fail here. At this point | 12600 | * Note no nested_vmx_succeed or nested_vmx_fail here. At this point |
12579 | * we are no longer running L1, and VMLAUNCH/VMRESUME has not yet | 12601 | * we are no longer running L1, and VMLAUNCH/VMRESUME has not yet |
12580 | * returned as far as L1 is concerned. It will only return (and set | 12602 | * returned as far as L1 is concerned. It will only return (and set |
@@ -13988,9 +14010,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, | |||
13988 | check_vmentry_postreqs(vcpu, vmcs12, &exit_qual)) | 14010 | check_vmentry_postreqs(vcpu, vmcs12, &exit_qual)) |
13989 | return -EINVAL; | 14011 | return -EINVAL; |
13990 | 14012 | ||
13991 | if (kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING) | ||
13992 | vmx->nested.nested_run_pending = 1; | ||
13993 | |||
13994 | vmx->nested.dirty_vmcs12 = true; | 14013 | vmx->nested.dirty_vmcs12 = true; |
13995 | ret = enter_vmx_non_root_mode(vcpu, NULL); | 14014 | ret = enter_vmx_non_root_mode(vcpu, NULL); |
13996 | if (ret) | 14015 | if (ret) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 506bd2b4b8bb..542f6315444d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4987,7 +4987,7 @@ int handle_ud(struct kvm_vcpu *vcpu) | |||
4987 | emul_type = 0; | 4987 | emul_type = 0; |
4988 | } | 4988 | } |
4989 | 4989 | ||
4990 | er = emulate_instruction(vcpu, emul_type); | 4990 | er = kvm_emulate_instruction(vcpu, emul_type); |
4991 | if (er == EMULATE_USER_EXIT) | 4991 | if (er == EMULATE_USER_EXIT) |
4992 | return 0; | 4992 | return 0; |
4993 | if (er != EMULATE_DONE) | 4993 | if (er != EMULATE_DONE) |
@@ -5870,7 +5870,10 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2, | |||
5870 | gpa_t gpa = cr2; | 5870 | gpa_t gpa = cr2; |
5871 | kvm_pfn_t pfn; | 5871 | kvm_pfn_t pfn; |
5872 | 5872 | ||
5873 | if (emulation_type & EMULTYPE_NO_REEXECUTE) | 5873 | if (!(emulation_type & EMULTYPE_ALLOW_RETRY)) |
5874 | return false; | ||
5875 | |||
5876 | if (WARN_ON_ONCE(is_guest_mode(vcpu))) | ||
5874 | return false; | 5877 | return false; |
5875 | 5878 | ||
5876 | if (!vcpu->arch.mmu.direct_map) { | 5879 | if (!vcpu->arch.mmu.direct_map) { |
@@ -5958,7 +5961,10 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt, | |||
5958 | */ | 5961 | */ |
5959 | vcpu->arch.last_retry_eip = vcpu->arch.last_retry_addr = 0; | 5962 | vcpu->arch.last_retry_eip = vcpu->arch.last_retry_addr = 0; |
5960 | 5963 | ||
5961 | if (!(emulation_type & EMULTYPE_RETRY)) | 5964 | if (!(emulation_type & EMULTYPE_ALLOW_RETRY)) |
5965 | return false; | ||
5966 | |||
5967 | if (WARN_ON_ONCE(is_guest_mode(vcpu))) | ||
5962 | return false; | 5968 | return false; |
5963 | 5969 | ||
5964 | if (x86_page_table_writing_insn(ctxt)) | 5970 | if (x86_page_table_writing_insn(ctxt)) |
@@ -6276,7 +6282,19 @@ restart: | |||
6276 | 6282 | ||
6277 | return r; | 6283 | return r; |
6278 | } | 6284 | } |
6279 | EXPORT_SYMBOL_GPL(x86_emulate_instruction); | 6285 | |
6286 | int kvm_emulate_instruction(struct kvm_vcpu *vcpu, int emulation_type) | ||
6287 | { | ||
6288 | return x86_emulate_instruction(vcpu, 0, emulation_type, NULL, 0); | ||
6289 | } | ||
6290 | EXPORT_SYMBOL_GPL(kvm_emulate_instruction); | ||
6291 | |||
6292 | int kvm_emulate_instruction_from_buffer(struct kvm_vcpu *vcpu, | ||
6293 | void *insn, int insn_len) | ||
6294 | { | ||
6295 | return x86_emulate_instruction(vcpu, 0, 0, insn, insn_len); | ||
6296 | } | ||
6297 | EXPORT_SYMBOL_GPL(kvm_emulate_instruction_from_buffer); | ||
6280 | 6298 | ||
6281 | static int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, | 6299 | static int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, |
6282 | unsigned short port) | 6300 | unsigned short port) |
@@ -7734,7 +7752,7 @@ static inline int complete_emulated_io(struct kvm_vcpu *vcpu) | |||
7734 | { | 7752 | { |
7735 | int r; | 7753 | int r; |
7736 | vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); | 7754 | vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); |
7737 | r = emulate_instruction(vcpu, EMULTYPE_NO_DECODE); | 7755 | r = kvm_emulate_instruction(vcpu, EMULTYPE_NO_DECODE); |
7738 | srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); | 7756 | srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); |
7739 | if (r != EMULATE_DONE) | 7757 | if (r != EMULATE_DONE) |
7740 | return 0; | 7758 | return 0; |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 257f27620bc2..67b9568613f3 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h | |||
@@ -274,6 +274,8 @@ int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata); | |||
274 | bool kvm_mtrr_check_gfn_range_consistency(struct kvm_vcpu *vcpu, gfn_t gfn, | 274 | bool kvm_mtrr_check_gfn_range_consistency(struct kvm_vcpu *vcpu, gfn_t gfn, |
275 | int page_num); | 275 | int page_num); |
276 | bool kvm_vector_hashing_enabled(void); | 276 | bool kvm_vector_hashing_enabled(void); |
277 | int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2, | ||
278 | int emulation_type, void *insn, int insn_len); | ||
277 | 279 | ||
278 | #define KVM_SUPPORTED_XCR0 (XFEATURE_MASK_FP | XFEATURE_MASK_SSE \ | 280 | #define KVM_SUPPORTED_XCR0 (XFEATURE_MASK_FP | XFEATURE_MASK_SSE \ |
279 | | XFEATURE_MASK_YMM | XFEATURE_MASK_BNDREGS \ | 281 | | XFEATURE_MASK_YMM | XFEATURE_MASK_BNDREGS \ |
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 58c6efa9f9a9..9fe5952d117d 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c | |||
@@ -275,9 +275,9 @@ static void bfqg_and_blkg_get(struct bfq_group *bfqg) | |||
275 | 275 | ||
276 | void bfqg_and_blkg_put(struct bfq_group *bfqg) | 276 | void bfqg_and_blkg_put(struct bfq_group *bfqg) |
277 | { | 277 | { |
278 | bfqg_put(bfqg); | ||
279 | |||
280 | blkg_put(bfqg_to_blkg(bfqg)); | 278 | blkg_put(bfqg_to_blkg(bfqg)); |
279 | |||
280 | bfqg_put(bfqg); | ||
281 | } | 281 | } |
282 | 282 | ||
283 | /* @stats = 0 */ | 283 | /* @stats = 0 */ |
diff --git a/block/bio.c b/block/bio.c index b12966e415d3..8c680a776171 100644 --- a/block/bio.c +++ b/block/bio.c | |||
@@ -2015,7 +2015,8 @@ int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg) | |||
2015 | { | 2015 | { |
2016 | if (unlikely(bio->bi_blkg)) | 2016 | if (unlikely(bio->bi_blkg)) |
2017 | return -EBUSY; | 2017 | return -EBUSY; |
2018 | blkg_get(blkg); | 2018 | if (!blkg_try_get(blkg)) |
2019 | return -ENODEV; | ||
2019 | bio->bi_blkg = blkg; | 2020 | bio->bi_blkg = blkg; |
2020 | return 0; | 2021 | return 0; |
2021 | } | 2022 | } |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 694595b29b8f..c19f9078da1e 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -310,28 +310,11 @@ struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, | |||
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | static void blkg_pd_offline(struct blkcg_gq *blkg) | ||
314 | { | ||
315 | int i; | ||
316 | |||
317 | lockdep_assert_held(blkg->q->queue_lock); | ||
318 | lockdep_assert_held(&blkg->blkcg->lock); | ||
319 | |||
320 | for (i = 0; i < BLKCG_MAX_POLS; i++) { | ||
321 | struct blkcg_policy *pol = blkcg_policy[i]; | ||
322 | |||
323 | if (blkg->pd[i] && !blkg->pd[i]->offline && | ||
324 | pol->pd_offline_fn) { | ||
325 | pol->pd_offline_fn(blkg->pd[i]); | ||
326 | blkg->pd[i]->offline = true; | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | |||
331 | static void blkg_destroy(struct blkcg_gq *blkg) | 313 | static void blkg_destroy(struct blkcg_gq *blkg) |
332 | { | 314 | { |
333 | struct blkcg *blkcg = blkg->blkcg; | 315 | struct blkcg *blkcg = blkg->blkcg; |
334 | struct blkcg_gq *parent = blkg->parent; | 316 | struct blkcg_gq *parent = blkg->parent; |
317 | int i; | ||
335 | 318 | ||
336 | lockdep_assert_held(blkg->q->queue_lock); | 319 | lockdep_assert_held(blkg->q->queue_lock); |
337 | lockdep_assert_held(&blkcg->lock); | 320 | lockdep_assert_held(&blkcg->lock); |
@@ -340,6 +323,13 @@ static void blkg_destroy(struct blkcg_gq *blkg) | |||
340 | WARN_ON_ONCE(list_empty(&blkg->q_node)); | 323 | WARN_ON_ONCE(list_empty(&blkg->q_node)); |
341 | WARN_ON_ONCE(hlist_unhashed(&blkg->blkcg_node)); | 324 | WARN_ON_ONCE(hlist_unhashed(&blkg->blkcg_node)); |
342 | 325 | ||
326 | for (i = 0; i < BLKCG_MAX_POLS; i++) { | ||
327 | struct blkcg_policy *pol = blkcg_policy[i]; | ||
328 | |||
329 | if (blkg->pd[i] && pol->pd_offline_fn) | ||
330 | pol->pd_offline_fn(blkg->pd[i]); | ||
331 | } | ||
332 | |||
343 | if (parent) { | 333 | if (parent) { |
344 | blkg_rwstat_add_aux(&parent->stat_bytes, &blkg->stat_bytes); | 334 | blkg_rwstat_add_aux(&parent->stat_bytes, &blkg->stat_bytes); |
345 | blkg_rwstat_add_aux(&parent->stat_ios, &blkg->stat_ios); | 335 | blkg_rwstat_add_aux(&parent->stat_ios, &blkg->stat_ios); |
@@ -382,7 +372,6 @@ static void blkg_destroy_all(struct request_queue *q) | |||
382 | struct blkcg *blkcg = blkg->blkcg; | 372 | struct blkcg *blkcg = blkg->blkcg; |
383 | 373 | ||
384 | spin_lock(&blkcg->lock); | 374 | spin_lock(&blkcg->lock); |
385 | blkg_pd_offline(blkg); | ||
386 | blkg_destroy(blkg); | 375 | blkg_destroy(blkg); |
387 | spin_unlock(&blkcg->lock); | 376 | spin_unlock(&blkcg->lock); |
388 | } | 377 | } |
@@ -1053,59 +1042,64 @@ static struct cftype blkcg_legacy_files[] = { | |||
1053 | { } /* terminate */ | 1042 | { } /* terminate */ |
1054 | }; | 1043 | }; |
1055 | 1044 | ||
1045 | /* | ||
1046 | * blkcg destruction is a three-stage process. | ||
1047 | * | ||
1048 | * 1. Destruction starts. The blkcg_css_offline() callback is invoked | ||
1049 | * which offlines writeback. Here we tie the next stage of blkg destruction | ||
1050 | * to the completion of writeback associated with the blkcg. This lets us | ||
1051 | * avoid punting potentially large amounts of outstanding writeback to root | ||
1052 | * while maintaining any ongoing policies. The next stage is triggered when | ||
1053 | * the nr_cgwbs count goes to zero. | ||
1054 | * | ||
1055 | * 2. When the nr_cgwbs count goes to zero, blkcg_destroy_blkgs() is called | ||
1056 | * and handles the destruction of blkgs. Here the css reference held by | ||
1057 | * the blkg is put back eventually allowing blkcg_css_free() to be called. | ||
1058 | * This work may occur in cgwb_release_workfn() on the cgwb_release | ||
1059 | * workqueue. Any submitted ios that fail to get the blkg ref will be | ||
1060 | * punted to the root_blkg. | ||
1061 | * | ||
1062 | * 3. Once the blkcg ref count goes to zero, blkcg_css_free() is called. | ||
1063 | * This finally frees the blkcg. | ||
1064 | */ | ||
1065 | |||
1056 | /** | 1066 | /** |
1057 | * blkcg_css_offline - cgroup css_offline callback | 1067 | * blkcg_css_offline - cgroup css_offline callback |
1058 | * @css: css of interest | 1068 | * @css: css of interest |
1059 | * | 1069 | * |
1060 | * This function is called when @css is about to go away and responsible | 1070 | * This function is called when @css is about to go away. Here the cgwbs are |
1061 | * for offlining all blkgs pd and killing all wbs associated with @css. | 1071 | * offlined first and only once writeback associated with the blkcg has |
1062 | * blkgs pd offline should be done while holding both q and blkcg locks. | 1072 | * finished do we start step 2 (see above). |
1063 | * As blkcg lock is nested inside q lock, this function performs reverse | ||
1064 | * double lock dancing. | ||
1065 | * | ||
1066 | * This is the blkcg counterpart of ioc_release_fn(). | ||
1067 | */ | 1073 | */ |
1068 | static void blkcg_css_offline(struct cgroup_subsys_state *css) | 1074 | static void blkcg_css_offline(struct cgroup_subsys_state *css) |
1069 | { | 1075 | { |
1070 | struct blkcg *blkcg = css_to_blkcg(css); | 1076 | struct blkcg *blkcg = css_to_blkcg(css); |
1071 | struct blkcg_gq *blkg; | ||
1072 | |||
1073 | spin_lock_irq(&blkcg->lock); | ||
1074 | |||
1075 | hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) { | ||
1076 | struct request_queue *q = blkg->q; | ||
1077 | |||
1078 | if (spin_trylock(q->queue_lock)) { | ||
1079 | blkg_pd_offline(blkg); | ||
1080 | spin_unlock(q->queue_lock); | ||
1081 | } else { | ||
1082 | spin_unlock_irq(&blkcg->lock); | ||
1083 | cpu_relax(); | ||
1084 | spin_lock_irq(&blkcg->lock); | ||
1085 | } | ||
1086 | } | ||
1087 | |||
1088 | spin_unlock_irq(&blkcg->lock); | ||
1089 | 1077 | ||
1078 | /* this prevents anyone from attaching or migrating to this blkcg */ | ||
1090 | wb_blkcg_offline(blkcg); | 1079 | wb_blkcg_offline(blkcg); |
1080 | |||
1081 | /* put the base cgwb reference allowing step 2 to be triggered */ | ||
1082 | blkcg_cgwb_put(blkcg); | ||
1091 | } | 1083 | } |
1092 | 1084 | ||
1093 | /** | 1085 | /** |
1094 | * blkcg_destroy_all_blkgs - destroy all blkgs associated with a blkcg | 1086 | * blkcg_destroy_blkgs - responsible for shooting down blkgs |
1095 | * @blkcg: blkcg of interest | 1087 | * @blkcg: blkcg of interest |
1096 | * | 1088 | * |
1097 | * This function is called when blkcg css is about to free and responsible for | 1089 | * blkgs should be removed while holding both q and blkcg locks. As blkcg lock |
1098 | * destroying all blkgs associated with @blkcg. | ||
1099 | * blkgs should be removed while holding both q and blkcg locks. As blkcg lock | ||
1100 | * is nested inside q lock, this function performs reverse double lock dancing. | 1090 | * is nested inside q lock, this function performs reverse double lock dancing. |
1091 | * Destroying the blkgs releases the reference held on the blkcg's css allowing | ||
1092 | * blkcg_css_free to eventually be called. | ||
1093 | * | ||
1094 | * This is the blkcg counterpart of ioc_release_fn(). | ||
1101 | */ | 1095 | */ |
1102 | static void blkcg_destroy_all_blkgs(struct blkcg *blkcg) | 1096 | void blkcg_destroy_blkgs(struct blkcg *blkcg) |
1103 | { | 1097 | { |
1104 | spin_lock_irq(&blkcg->lock); | 1098 | spin_lock_irq(&blkcg->lock); |
1099 | |||
1105 | while (!hlist_empty(&blkcg->blkg_list)) { | 1100 | while (!hlist_empty(&blkcg->blkg_list)) { |
1106 | struct blkcg_gq *blkg = hlist_entry(blkcg->blkg_list.first, | 1101 | struct blkcg_gq *blkg = hlist_entry(blkcg->blkg_list.first, |
1107 | struct blkcg_gq, | 1102 | struct blkcg_gq, blkcg_node); |
1108 | blkcg_node); | ||
1109 | struct request_queue *q = blkg->q; | 1103 | struct request_queue *q = blkg->q; |
1110 | 1104 | ||
1111 | if (spin_trylock(q->queue_lock)) { | 1105 | if (spin_trylock(q->queue_lock)) { |
@@ -1117,6 +1111,7 @@ static void blkcg_destroy_all_blkgs(struct blkcg *blkcg) | |||
1117 | spin_lock_irq(&blkcg->lock); | 1111 | spin_lock_irq(&blkcg->lock); |
1118 | } | 1112 | } |
1119 | } | 1113 | } |
1114 | |||
1120 | spin_unlock_irq(&blkcg->lock); | 1115 | spin_unlock_irq(&blkcg->lock); |
1121 | } | 1116 | } |
1122 | 1117 | ||
@@ -1125,8 +1120,6 @@ static void blkcg_css_free(struct cgroup_subsys_state *css) | |||
1125 | struct blkcg *blkcg = css_to_blkcg(css); | 1120 | struct blkcg *blkcg = css_to_blkcg(css); |
1126 | int i; | 1121 | int i; |
1127 | 1122 | ||
1128 | blkcg_destroy_all_blkgs(blkcg); | ||
1129 | |||
1130 | mutex_lock(&blkcg_pol_mutex); | 1123 | mutex_lock(&blkcg_pol_mutex); |
1131 | 1124 | ||
1132 | list_del(&blkcg->all_blkcgs_node); | 1125 | list_del(&blkcg->all_blkcgs_node); |
@@ -1189,6 +1182,7 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css) | |||
1189 | INIT_HLIST_HEAD(&blkcg->blkg_list); | 1182 | INIT_HLIST_HEAD(&blkcg->blkg_list); |
1190 | #ifdef CONFIG_CGROUP_WRITEBACK | 1183 | #ifdef CONFIG_CGROUP_WRITEBACK |
1191 | INIT_LIST_HEAD(&blkcg->cgwb_list); | 1184 | INIT_LIST_HEAD(&blkcg->cgwb_list); |
1185 | refcount_set(&blkcg->cgwb_refcnt, 1); | ||
1192 | #endif | 1186 | #endif |
1193 | list_add_tail(&blkcg->all_blkcgs_node, &all_blkcgs); | 1187 | list_add_tail(&blkcg->all_blkcgs_node, &all_blkcgs); |
1194 | 1188 | ||
@@ -1480,11 +1474,8 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
1480 | 1474 | ||
1481 | list_for_each_entry(blkg, &q->blkg_list, q_node) { | 1475 | list_for_each_entry(blkg, &q->blkg_list, q_node) { |
1482 | if (blkg->pd[pol->plid]) { | 1476 | if (blkg->pd[pol->plid]) { |
1483 | if (!blkg->pd[pol->plid]->offline && | 1477 | if (pol->pd_offline_fn) |
1484 | pol->pd_offline_fn) { | ||
1485 | pol->pd_offline_fn(blkg->pd[pol->plid]); | 1478 | pol->pd_offline_fn(blkg->pd[pol->plid]); |
1486 | blkg->pd[pol->plid]->offline = true; | ||
1487 | } | ||
1488 | pol->pd_free_fn(blkg->pd[pol->plid]); | 1479 | pol->pd_free_fn(blkg->pd[pol->plid]); |
1489 | blkg->pd[pol->plid] = NULL; | 1480 | blkg->pd[pol->plid] = NULL; |
1490 | } | 1481 | } |
diff --git a/block/blk-core.c b/block/blk-core.c index dee56c282efb..4dbc93f43b38 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -2163,9 +2163,12 @@ static inline bool bio_check_ro(struct bio *bio, struct hd_struct *part) | |||
2163 | { | 2163 | { |
2164 | const int op = bio_op(bio); | 2164 | const int op = bio_op(bio); |
2165 | 2165 | ||
2166 | if (part->policy && (op_is_write(op) && !op_is_flush(op))) { | 2166 | if (part->policy && op_is_write(op)) { |
2167 | char b[BDEVNAME_SIZE]; | 2167 | char b[BDEVNAME_SIZE]; |
2168 | 2168 | ||
2169 | if (op_is_flush(bio->bi_opf) && !bio_sectors(bio)) | ||
2170 | return false; | ||
2171 | |||
2169 | WARN_ONCE(1, | 2172 | WARN_ONCE(1, |
2170 | "generic_make_request: Trying to write " | 2173 | "generic_make_request: Trying to write " |
2171 | "to read-only block-device %s (partno %d)\n", | 2174 | "to read-only block-device %s (partno %d)\n", |
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index a3eede00d302..01d0620a4e4a 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -2129,8 +2129,9 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td) | |||
2129 | static void blk_throtl_assoc_bio(struct throtl_grp *tg, struct bio *bio) | 2129 | static void blk_throtl_assoc_bio(struct throtl_grp *tg, struct bio *bio) |
2130 | { | 2130 | { |
2131 | #ifdef CONFIG_BLK_DEV_THROTTLING_LOW | 2131 | #ifdef CONFIG_BLK_DEV_THROTTLING_LOW |
2132 | if (bio->bi_css) | 2132 | /* fallback to root_blkg if we fail to get a blkg ref */ |
2133 | bio_associate_blkg(bio, tg_to_blkg(tg)); | 2133 | if (bio->bi_css && (bio_associate_blkg(bio, tg_to_blkg(tg)) == -ENODEV)) |
2134 | bio_associate_blkg(bio, bio->bi_disk->queue->root_blkg); | ||
2134 | bio_issue_init(&bio->bi_issue, bio_sectors(bio)); | 2135 | bio_issue_init(&bio->bi_issue, bio_sectors(bio)); |
2135 | #endif | 2136 | #endif |
2136 | } | 2137 | } |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 9706613eecf9..bf64cfa30feb 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -879,7 +879,7 @@ static void acpi_lpss_dismiss(struct device *dev) | |||
879 | #define LPSS_GPIODEF0_DMA_LLP BIT(13) | 879 | #define LPSS_GPIODEF0_DMA_LLP BIT(13) |
880 | 880 | ||
881 | static DEFINE_MUTEX(lpss_iosf_mutex); | 881 | static DEFINE_MUTEX(lpss_iosf_mutex); |
882 | static bool lpss_iosf_d3_entered; | 882 | static bool lpss_iosf_d3_entered = true; |
883 | 883 | ||
884 | static void lpss_iosf_enter_d3_state(void) | 884 | static void lpss_iosf_enter_d3_state(void) |
885 | { | 885 | { |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 292088fcc624..d2e29a19890d 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -35,11 +35,11 @@ | |||
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #ifdef CONFIG_X86 | 36 | #ifdef CONFIG_X86 |
37 | #include <asm/mpspec.h> | 37 | #include <asm/mpspec.h> |
38 | #include <linux/dmi.h> | ||
38 | #endif | 39 | #endif |
39 | #include <linux/acpi_iort.h> | 40 | #include <linux/acpi_iort.h> |
40 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
41 | #include <acpi/apei.h> | 42 | #include <acpi/apei.h> |
42 | #include <linux/dmi.h> | ||
43 | #include <linux/suspend.h> | 43 | #include <linux/suspend.h> |
44 | 44 | ||
45 | #include "internal.h" | 45 | #include "internal.h" |
@@ -82,10 +82,6 @@ static const struct dmi_system_id dsdt_dmi_table[] __initconst = { | |||
82 | }, | 82 | }, |
83 | {} | 83 | {} |
84 | }; | 84 | }; |
85 | #else | ||
86 | static const struct dmi_system_id dsdt_dmi_table[] __initconst = { | ||
87 | {} | ||
88 | }; | ||
89 | #endif | 85 | #endif |
90 | 86 | ||
91 | /* -------------------------------------------------------------------------- | 87 | /* -------------------------------------------------------------------------- |
@@ -1033,11 +1029,16 @@ void __init acpi_early_init(void) | |||
1033 | 1029 | ||
1034 | acpi_permanent_mmap = true; | 1030 | acpi_permanent_mmap = true; |
1035 | 1031 | ||
1032 | #ifdef CONFIG_X86 | ||
1036 | /* | 1033 | /* |
1037 | * If the machine falls into the DMI check table, | 1034 | * If the machine falls into the DMI check table, |
1038 | * DSDT will be copied to memory | 1035 | * DSDT will be copied to memory. |
1036 | * Note that calling dmi_check_system() here on other architectures | ||
1037 | * would not be OK because only x86 initializes dmi early enough. | ||
1038 | * Thankfully only x86 systems need such quirks for now. | ||
1039 | */ | 1039 | */ |
1040 | dmi_check_system(dsdt_dmi_table); | 1040 | dmi_check_system(dsdt_dmi_table); |
1041 | #endif | ||
1041 | 1042 | ||
1042 | status = acpi_reallocate_root_table(); | 1043 | status = acpi_reallocate_root_table(); |
1043 | if (ACPI_FAILURE(status)) { | 1044 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 172e32840256..599e01bcdef2 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -7394,4 +7394,4 @@ EXPORT_SYMBOL_GPL(ata_cable_unknown); | |||
7394 | EXPORT_SYMBOL_GPL(ata_cable_ignore); | 7394 | EXPORT_SYMBOL_GPL(ata_cable_ignore); |
7395 | EXPORT_SYMBOL_GPL(ata_cable_sata); | 7395 | EXPORT_SYMBOL_GPL(ata_cable_sata); |
7396 | EXPORT_SYMBOL_GPL(ata_host_get); | 7396 | EXPORT_SYMBOL_GPL(ata_host_get); |
7397 | EXPORT_SYMBOL_GPL(ata_host_put); \ No newline at end of file | 7397 | EXPORT_SYMBOL_GPL(ata_host_put); |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index c8a1cb0b6136..817320c7c4c1 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -417,25 +417,23 @@ static ssize_t show_valid_zones(struct device *dev, | |||
417 | int nid; | 417 | int nid; |
418 | 418 | ||
419 | /* | 419 | /* |
420 | * The block contains more than one zone can not be offlined. | ||
421 | * This can happen e.g. for ZONE_DMA and ZONE_DMA32 | ||
422 | */ | ||
423 | if (!test_pages_in_a_zone(start_pfn, start_pfn + nr_pages, &valid_start_pfn, &valid_end_pfn)) | ||
424 | return sprintf(buf, "none\n"); | ||
425 | |||
426 | start_pfn = valid_start_pfn; | ||
427 | nr_pages = valid_end_pfn - start_pfn; | ||
428 | |||
429 | /* | ||
430 | * Check the existing zone. Make sure that we do that only on the | 420 | * Check the existing zone. Make sure that we do that only on the |
431 | * online nodes otherwise the page_zone is not reliable | 421 | * online nodes otherwise the page_zone is not reliable |
432 | */ | 422 | */ |
433 | if (mem->state == MEM_ONLINE) { | 423 | if (mem->state == MEM_ONLINE) { |
424 | /* | ||
425 | * The block contains more than one zone can not be offlined. | ||
426 | * This can happen e.g. for ZONE_DMA and ZONE_DMA32 | ||
427 | */ | ||
428 | if (!test_pages_in_a_zone(start_pfn, start_pfn + nr_pages, | ||
429 | &valid_start_pfn, &valid_end_pfn)) | ||
430 | return sprintf(buf, "none\n"); | ||
431 | start_pfn = valid_start_pfn; | ||
434 | strcat(buf, page_zone(pfn_to_page(start_pfn))->name); | 432 | strcat(buf, page_zone(pfn_to_page(start_pfn))->name); |
435 | goto out; | 433 | goto out; |
436 | } | 434 | } |
437 | 435 | ||
438 | nid = pfn_to_nid(start_pfn); | 436 | nid = mem->nid; |
439 | default_zone = zone_for_pfn_range(MMOP_ONLINE_KEEP, nid, start_pfn, nr_pages); | 437 | default_zone = zone_for_pfn_range(MMOP_ONLINE_KEEP, nid, start_pfn, nr_pages); |
440 | strcat(buf, default_zone->name); | 438 | strcat(buf, default_zone->name); |
441 | 439 | ||
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 3863c00372bb..14a51254c3db 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -1239,6 +1239,9 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, | |||
1239 | case NBD_SET_SOCK: | 1239 | case NBD_SET_SOCK: |
1240 | return nbd_add_socket(nbd, arg, false); | 1240 | return nbd_add_socket(nbd, arg, false); |
1241 | case NBD_SET_BLKSIZE: | 1241 | case NBD_SET_BLKSIZE: |
1242 | if (!arg || !is_power_of_2(arg) || arg < 512 || | ||
1243 | arg > PAGE_SIZE) | ||
1244 | return -EINVAL; | ||
1242 | nbd_size_set(nbd, arg, | 1245 | nbd_size_set(nbd, arg, |
1243 | div_s64(config->bytesize, arg)); | 1246 | div_s64(config->bytesize, arg)); |
1244 | return 0; | 1247 | return 0; |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 7915f3b03736..73ed5f3a862d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -4207,11 +4207,13 @@ static ssize_t rbd_parent_show(struct device *dev, | |||
4207 | 4207 | ||
4208 | count += sprintf(&buf[count], "%s" | 4208 | count += sprintf(&buf[count], "%s" |
4209 | "pool_id %llu\npool_name %s\n" | 4209 | "pool_id %llu\npool_name %s\n" |
4210 | "pool_ns %s\n" | ||
4210 | "image_id %s\nimage_name %s\n" | 4211 | "image_id %s\nimage_name %s\n" |
4211 | "snap_id %llu\nsnap_name %s\n" | 4212 | "snap_id %llu\nsnap_name %s\n" |
4212 | "overlap %llu\n", | 4213 | "overlap %llu\n", |
4213 | !count ? "" : "\n", /* first? */ | 4214 | !count ? "" : "\n", /* first? */ |
4214 | spec->pool_id, spec->pool_name, | 4215 | spec->pool_id, spec->pool_name, |
4216 | spec->pool_ns ?: "", | ||
4215 | spec->image_id, spec->image_name ?: "(unknown)", | 4217 | spec->image_id, spec->image_name ?: "(unknown)", |
4216 | spec->snap_id, spec->snap_name, | 4218 | spec->snap_id, spec->snap_name, |
4217 | rbd_dev->parent_overlap); | 4219 | rbd_dev->parent_overlap); |
@@ -4584,47 +4586,177 @@ static int rbd_dev_v2_features(struct rbd_device *rbd_dev) | |||
4584 | &rbd_dev->header.features); | 4586 | &rbd_dev->header.features); |
4585 | } | 4587 | } |
4586 | 4588 | ||
4589 | struct parent_image_info { | ||
4590 | u64 pool_id; | ||
4591 | const char *pool_ns; | ||
4592 | const char *image_id; | ||
4593 | u64 snap_id; | ||
4594 | |||
4595 | bool has_overlap; | ||
4596 | u64 overlap; | ||
4597 | }; | ||
4598 | |||
4599 | /* | ||
4600 | * The caller is responsible for @pii. | ||
4601 | */ | ||
4602 | static int decode_parent_image_spec(void **p, void *end, | ||
4603 | struct parent_image_info *pii) | ||
4604 | { | ||
4605 | u8 struct_v; | ||
4606 | u32 struct_len; | ||
4607 | int ret; | ||
4608 | |||
4609 | ret = ceph_start_decoding(p, end, 1, "ParentImageSpec", | ||
4610 | &struct_v, &struct_len); | ||
4611 | if (ret) | ||
4612 | return ret; | ||
4613 | |||
4614 | ceph_decode_64_safe(p, end, pii->pool_id, e_inval); | ||
4615 | pii->pool_ns = ceph_extract_encoded_string(p, end, NULL, GFP_KERNEL); | ||
4616 | if (IS_ERR(pii->pool_ns)) { | ||
4617 | ret = PTR_ERR(pii->pool_ns); | ||
4618 | pii->pool_ns = NULL; | ||
4619 | return ret; | ||
4620 | } | ||
4621 | pii->image_id = ceph_extract_encoded_string(p, end, NULL, GFP_KERNEL); | ||
4622 | if (IS_ERR(pii->image_id)) { | ||
4623 | ret = PTR_ERR(pii->image_id); | ||
4624 | pii->image_id = NULL; | ||
4625 | return ret; | ||
4626 | } | ||
4627 | ceph_decode_64_safe(p, end, pii->snap_id, e_inval); | ||
4628 | return 0; | ||
4629 | |||
4630 | e_inval: | ||
4631 | return -EINVAL; | ||
4632 | } | ||
4633 | |||
4634 | static int __get_parent_info(struct rbd_device *rbd_dev, | ||
4635 | struct page *req_page, | ||
4636 | struct page *reply_page, | ||
4637 | struct parent_image_info *pii) | ||
4638 | { | ||
4639 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | ||
4640 | size_t reply_len = PAGE_SIZE; | ||
4641 | void *p, *end; | ||
4642 | int ret; | ||
4643 | |||
4644 | ret = ceph_osdc_call(osdc, &rbd_dev->header_oid, &rbd_dev->header_oloc, | ||
4645 | "rbd", "parent_get", CEPH_OSD_FLAG_READ, | ||
4646 | req_page, sizeof(u64), reply_page, &reply_len); | ||
4647 | if (ret) | ||
4648 | return ret == -EOPNOTSUPP ? 1 : ret; | ||
4649 | |||
4650 | p = page_address(reply_page); | ||
4651 | end = p + reply_len; | ||
4652 | ret = decode_parent_image_spec(&p, end, pii); | ||
4653 | if (ret) | ||
4654 | return ret; | ||
4655 | |||
4656 | ret = ceph_osdc_call(osdc, &rbd_dev->header_oid, &rbd_dev->header_oloc, | ||
4657 | "rbd", "parent_overlap_get", CEPH_OSD_FLAG_READ, | ||
4658 | req_page, sizeof(u64), reply_page, &reply_len); | ||
4659 | if (ret) | ||
4660 | return ret; | ||
4661 | |||
4662 | p = page_address(reply_page); | ||
4663 | end = p + reply_len; | ||
4664 | ceph_decode_8_safe(&p, end, pii->has_overlap, e_inval); | ||
4665 | if (pii->has_overlap) | ||
4666 | ceph_decode_64_safe(&p, end, pii->overlap, e_inval); | ||
4667 | |||
4668 | return 0; | ||
4669 | |||
4670 | e_inval: | ||
4671 | return -EINVAL; | ||
4672 | } | ||
4673 | |||
4674 | /* | ||
4675 | * The caller is responsible for @pii. | ||
4676 | */ | ||
4677 | static int __get_parent_info_legacy(struct rbd_device *rbd_dev, | ||
4678 | struct page *req_page, | ||
4679 | struct page *reply_page, | ||
4680 | struct parent_image_info *pii) | ||
4681 | { | ||
4682 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | ||
4683 | size_t reply_len = PAGE_SIZE; | ||
4684 | void *p, *end; | ||
4685 | int ret; | ||
4686 | |||
4687 | ret = ceph_osdc_call(osdc, &rbd_dev->header_oid, &rbd_dev->header_oloc, | ||
4688 | "rbd", "get_parent", CEPH_OSD_FLAG_READ, | ||
4689 | req_page, sizeof(u64), reply_page, &reply_len); | ||
4690 | if (ret) | ||
4691 | return ret; | ||
4692 | |||
4693 | p = page_address(reply_page); | ||
4694 | end = p + reply_len; | ||
4695 | ceph_decode_64_safe(&p, end, pii->pool_id, e_inval); | ||
4696 | pii->image_id = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL); | ||
4697 | if (IS_ERR(pii->image_id)) { | ||
4698 | ret = PTR_ERR(pii->image_id); | ||
4699 | pii->image_id = NULL; | ||
4700 | return ret; | ||
4701 | } | ||
4702 | ceph_decode_64_safe(&p, end, pii->snap_id, e_inval); | ||
4703 | pii->has_overlap = true; | ||
4704 | ceph_decode_64_safe(&p, end, pii->overlap, e_inval); | ||
4705 | |||
4706 | return 0; | ||
4707 | |||
4708 | e_inval: | ||
4709 | return -EINVAL; | ||
4710 | } | ||
4711 | |||
4712 | static int get_parent_info(struct rbd_device *rbd_dev, | ||
4713 | struct parent_image_info *pii) | ||
4714 | { | ||
4715 | struct page *req_page, *reply_page; | ||
4716 | void *p; | ||
4717 | int ret; | ||
4718 | |||
4719 | req_page = alloc_page(GFP_KERNEL); | ||
4720 | if (!req_page) | ||
4721 | return -ENOMEM; | ||
4722 | |||
4723 | reply_page = alloc_page(GFP_KERNEL); | ||
4724 | if (!reply_page) { | ||
4725 | __free_page(req_page); | ||
4726 | return -ENOMEM; | ||
4727 | } | ||
4728 | |||
4729 | p = page_address(req_page); | ||
4730 | ceph_encode_64(&p, rbd_dev->spec->snap_id); | ||
4731 | ret = __get_parent_info(rbd_dev, req_page, reply_page, pii); | ||
4732 | if (ret > 0) | ||
4733 | ret = __get_parent_info_legacy(rbd_dev, req_page, reply_page, | ||
4734 | pii); | ||
4735 | |||
4736 | __free_page(req_page); | ||
4737 | __free_page(reply_page); | ||
4738 | return ret; | ||
4739 | } | ||
4740 | |||
4587 | static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) | 4741 | static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) |
4588 | { | 4742 | { |
4589 | struct rbd_spec *parent_spec; | 4743 | struct rbd_spec *parent_spec; |
4590 | size_t size; | 4744 | struct parent_image_info pii = { 0 }; |
4591 | void *reply_buf = NULL; | ||
4592 | __le64 snapid; | ||
4593 | void *p; | ||
4594 | void *end; | ||
4595 | u64 pool_id; | ||
4596 | char *image_id; | ||
4597 | u64 snap_id; | ||
4598 | u64 overlap; | ||
4599 | int ret; | 4745 | int ret; |
4600 | 4746 | ||
4601 | parent_spec = rbd_spec_alloc(); | 4747 | parent_spec = rbd_spec_alloc(); |
4602 | if (!parent_spec) | 4748 | if (!parent_spec) |
4603 | return -ENOMEM; | 4749 | return -ENOMEM; |
4604 | 4750 | ||
4605 | size = sizeof (__le64) + /* pool_id */ | 4751 | ret = get_parent_info(rbd_dev, &pii); |
4606 | sizeof (__le32) + RBD_IMAGE_ID_LEN_MAX + /* image_id */ | 4752 | if (ret) |
4607 | sizeof (__le64) + /* snap_id */ | ||
4608 | sizeof (__le64); /* overlap */ | ||
4609 | reply_buf = kmalloc(size, GFP_KERNEL); | ||
4610 | if (!reply_buf) { | ||
4611 | ret = -ENOMEM; | ||
4612 | goto out_err; | 4753 | goto out_err; |
4613 | } | ||
4614 | 4754 | ||
4615 | snapid = cpu_to_le64(rbd_dev->spec->snap_id); | 4755 | dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n", |
4616 | ret = rbd_obj_method_sync(rbd_dev, &rbd_dev->header_oid, | 4756 | __func__, pii.pool_id, pii.pool_ns, pii.image_id, pii.snap_id, |
4617 | &rbd_dev->header_oloc, "get_parent", | 4757 | pii.has_overlap, pii.overlap); |
4618 | &snapid, sizeof(snapid), reply_buf, size); | ||
4619 | dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret); | ||
4620 | if (ret < 0) | ||
4621 | goto out_err; | ||
4622 | 4758 | ||
4623 | p = reply_buf; | 4759 | if (pii.pool_id == CEPH_NOPOOL || !pii.has_overlap) { |
4624 | end = reply_buf + ret; | ||
4625 | ret = -ERANGE; | ||
4626 | ceph_decode_64_safe(&p, end, pool_id, out_err); | ||
4627 | if (pool_id == CEPH_NOPOOL) { | ||
4628 | /* | 4760 | /* |
4629 | * Either the parent never existed, or we have | 4761 | * Either the parent never existed, or we have |
4630 | * record of it but the image got flattened so it no | 4762 | * record of it but the image got flattened so it no |
@@ -4633,6 +4765,10 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) | |||
4633 | * overlap to 0. The effect of this is that all new | 4765 | * overlap to 0. The effect of this is that all new |
4634 | * requests will be treated as if the image had no | 4766 | * requests will be treated as if the image had no |
4635 | * parent. | 4767 | * parent. |
4768 | * | ||
4769 | * If !pii.has_overlap, the parent image spec is not | ||
4770 | * applicable. It's there to avoid duplication in each | ||
4771 | * snapshot record. | ||
4636 | */ | 4772 | */ |
4637 | if (rbd_dev->parent_overlap) { | 4773 | if (rbd_dev->parent_overlap) { |
4638 | rbd_dev->parent_overlap = 0; | 4774 | rbd_dev->parent_overlap = 0; |
@@ -4647,51 +4783,36 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) | |||
4647 | /* The ceph file layout needs to fit pool id in 32 bits */ | 4783 | /* The ceph file layout needs to fit pool id in 32 bits */ |
4648 | 4784 | ||
4649 | ret = -EIO; | 4785 | ret = -EIO; |
4650 | if (pool_id > (u64)U32_MAX) { | 4786 | if (pii.pool_id > (u64)U32_MAX) { |
4651 | rbd_warn(NULL, "parent pool id too large (%llu > %u)", | 4787 | rbd_warn(NULL, "parent pool id too large (%llu > %u)", |
4652 | (unsigned long long)pool_id, U32_MAX); | 4788 | (unsigned long long)pii.pool_id, U32_MAX); |
4653 | goto out_err; | 4789 | goto out_err; |
4654 | } | 4790 | } |
4655 | 4791 | ||
4656 | image_id = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL); | ||
4657 | if (IS_ERR(image_id)) { | ||
4658 | ret = PTR_ERR(image_id); | ||
4659 | goto out_err; | ||
4660 | } | ||
4661 | ceph_decode_64_safe(&p, end, snap_id, out_err); | ||
4662 | ceph_decode_64_safe(&p, end, overlap, out_err); | ||
4663 | |||
4664 | /* | 4792 | /* |
4665 | * The parent won't change (except when the clone is | 4793 | * The parent won't change (except when the clone is |
4666 | * flattened, already handled that). So we only need to | 4794 | * flattened, already handled that). So we only need to |
4667 | * record the parent spec we have not already done so. | 4795 | * record the parent spec we have not already done so. |
4668 | */ | 4796 | */ |
4669 | if (!rbd_dev->parent_spec) { | 4797 | if (!rbd_dev->parent_spec) { |
4670 | parent_spec->pool_id = pool_id; | 4798 | parent_spec->pool_id = pii.pool_id; |
4671 | parent_spec->image_id = image_id; | 4799 | if (pii.pool_ns && *pii.pool_ns) { |
4672 | parent_spec->snap_id = snap_id; | 4800 | parent_spec->pool_ns = pii.pool_ns; |
4673 | 4801 | pii.pool_ns = NULL; | |
4674 | /* TODO: support cloning across namespaces */ | ||
4675 | if (rbd_dev->spec->pool_ns) { | ||
4676 | parent_spec->pool_ns = kstrdup(rbd_dev->spec->pool_ns, | ||
4677 | GFP_KERNEL); | ||
4678 | if (!parent_spec->pool_ns) { | ||
4679 | ret = -ENOMEM; | ||
4680 | goto out_err; | ||
4681 | } | ||
4682 | } | 4802 | } |
4803 | parent_spec->image_id = pii.image_id; | ||
4804 | pii.image_id = NULL; | ||
4805 | parent_spec->snap_id = pii.snap_id; | ||
4683 | 4806 | ||
4684 | rbd_dev->parent_spec = parent_spec; | 4807 | rbd_dev->parent_spec = parent_spec; |
4685 | parent_spec = NULL; /* rbd_dev now owns this */ | 4808 | parent_spec = NULL; /* rbd_dev now owns this */ |
4686 | } else { | ||
4687 | kfree(image_id); | ||
4688 | } | 4809 | } |
4689 | 4810 | ||
4690 | /* | 4811 | /* |
4691 | * We always update the parent overlap. If it's zero we issue | 4812 | * We always update the parent overlap. If it's zero we issue |
4692 | * a warning, as we will proceed as if there was no parent. | 4813 | * a warning, as we will proceed as if there was no parent. |
4693 | */ | 4814 | */ |
4694 | if (!overlap) { | 4815 | if (!pii.overlap) { |
4695 | if (parent_spec) { | 4816 | if (parent_spec) { |
4696 | /* refresh, careful to warn just once */ | 4817 | /* refresh, careful to warn just once */ |
4697 | if (rbd_dev->parent_overlap) | 4818 | if (rbd_dev->parent_overlap) |
@@ -4702,14 +4823,14 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) | |||
4702 | rbd_warn(rbd_dev, "clone is standalone (overlap 0)"); | 4823 | rbd_warn(rbd_dev, "clone is standalone (overlap 0)"); |
4703 | } | 4824 | } |
4704 | } | 4825 | } |
4705 | rbd_dev->parent_overlap = overlap; | 4826 | rbd_dev->parent_overlap = pii.overlap; |
4706 | 4827 | ||
4707 | out: | 4828 | out: |
4708 | ret = 0; | 4829 | ret = 0; |
4709 | out_err: | 4830 | out_err: |
4710 | kfree(reply_buf); | 4831 | kfree(pii.pool_ns); |
4832 | kfree(pii.image_id); | ||
4711 | rbd_spec_put(parent_spec); | 4833 | rbd_spec_put(parent_spec); |
4712 | |||
4713 | return ret; | 4834 | return ret; |
4714 | } | 4835 | } |
4715 | 4836 | ||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index ce277ee0a28a..40728491f37b 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -566,5 +566,5 @@ config RANDOM_TRUST_CPU | |||
566 | that CPU manufacturer (perhaps with the insistence or mandate | 566 | that CPU manufacturer (perhaps with the insistence or mandate |
567 | of a Nation State's intelligence or law enforcement agencies) | 567 | of a Nation State's intelligence or law enforcement agencies) |
568 | has not installed a hidden back door to compromise the CPU's | 568 | has not installed a hidden back door to compromise the CPU's |
569 | random number generation facilities. | 569 | random number generation facilities. This can also be configured |
570 | 570 | at boot with "random.trust_cpu=on/off". | |
diff --git a/drivers/char/random.c b/drivers/char/random.c index bf5f99fc36f1..c75b6cdf0053 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -779,6 +779,13 @@ static struct crng_state **crng_node_pool __read_mostly; | |||
779 | 779 | ||
780 | static void invalidate_batched_entropy(void); | 780 | static void invalidate_batched_entropy(void); |
781 | 781 | ||
782 | static bool trust_cpu __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU); | ||
783 | static int __init parse_trust_cpu(char *arg) | ||
784 | { | ||
785 | return kstrtobool(arg, &trust_cpu); | ||
786 | } | ||
787 | early_param("random.trust_cpu", parse_trust_cpu); | ||
788 | |||
782 | static void crng_initialize(struct crng_state *crng) | 789 | static void crng_initialize(struct crng_state *crng) |
783 | { | 790 | { |
784 | int i; | 791 | int i; |
@@ -799,12 +806,10 @@ static void crng_initialize(struct crng_state *crng) | |||
799 | } | 806 | } |
800 | crng->state[i] ^= rv; | 807 | crng->state[i] ^= rv; |
801 | } | 808 | } |
802 | #ifdef CONFIG_RANDOM_TRUST_CPU | 809 | if (trust_cpu && arch_init) { |
803 | if (arch_init) { | ||
804 | crng_init = 2; | 810 | crng_init = 2; |
805 | pr_notice("random: crng done (trusting CPU's manufacturer)\n"); | 811 | pr_notice("random: crng done (trusting CPU's manufacturer)\n"); |
806 | } | 812 | } |
807 | #endif | ||
808 | crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1; | 813 | crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1; |
809 | } | 814 | } |
810 | 815 | ||
diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 6fd46083e629..bbe4d72ca105 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c | |||
@@ -392,7 +392,8 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, | |||
392 | { | 392 | { |
393 | struct file *filp = vmf->vma->vm_file; | 393 | struct file *filp = vmf->vma->vm_file; |
394 | unsigned long fault_size; | 394 | unsigned long fault_size; |
395 | int rc, id; | 395 | vm_fault_t rc = VM_FAULT_SIGBUS; |
396 | int id; | ||
396 | pfn_t pfn; | 397 | pfn_t pfn; |
397 | struct dev_dax *dev_dax = filp->private_data; | 398 | struct dev_dax *dev_dax = filp->private_data; |
398 | 399 | ||
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 721e6c57beae..64342944d917 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c | |||
@@ -166,7 +166,13 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain, | |||
166 | le32_to_cpu(attr->sustained_freq_khz); | 166 | le32_to_cpu(attr->sustained_freq_khz); |
167 | dom_info->sustained_perf_level = | 167 | dom_info->sustained_perf_level = |
168 | le32_to_cpu(attr->sustained_perf_level); | 168 | le32_to_cpu(attr->sustained_perf_level); |
169 | dom_info->mult_factor = (dom_info->sustained_freq_khz * 1000) / | 169 | if (!dom_info->sustained_freq_khz || |
170 | !dom_info->sustained_perf_level) | ||
171 | /* CPUFreq converts to kHz, hence default 1000 */ | ||
172 | dom_info->mult_factor = 1000; | ||
173 | else | ||
174 | dom_info->mult_factor = | ||
175 | (dom_info->sustained_freq_khz * 1000) / | ||
170 | dom_info->sustained_perf_level; | 176 | dom_info->sustained_perf_level; |
171 | memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE); | 177 | memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE); |
172 | } | 178 | } |
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 3530ccd17e04..da9781a2ef4a 100644 --- a/drivers/gpio/gpio-adp5588.c +++ b/drivers/gpio/gpio-adp5588.c | |||
@@ -41,6 +41,8 @@ struct adp5588_gpio { | |||
41 | uint8_t int_en[3]; | 41 | uint8_t int_en[3]; |
42 | uint8_t irq_mask[3]; | 42 | uint8_t irq_mask[3]; |
43 | uint8_t irq_stat[3]; | 43 | uint8_t irq_stat[3]; |
44 | uint8_t int_input_en[3]; | ||
45 | uint8_t int_lvl_cached[3]; | ||
44 | }; | 46 | }; |
45 | 47 | ||
46 | static int adp5588_gpio_read(struct i2c_client *client, u8 reg) | 48 | static int adp5588_gpio_read(struct i2c_client *client, u8 reg) |
@@ -173,12 +175,28 @@ static void adp5588_irq_bus_sync_unlock(struct irq_data *d) | |||
173 | struct adp5588_gpio *dev = irq_data_get_irq_chip_data(d); | 175 | struct adp5588_gpio *dev = irq_data_get_irq_chip_data(d); |
174 | int i; | 176 | int i; |
175 | 177 | ||
176 | for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++) | 178 | for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++) { |
179 | if (dev->int_input_en[i]) { | ||
180 | mutex_lock(&dev->lock); | ||
181 | dev->dir[i] &= ~dev->int_input_en[i]; | ||
182 | dev->int_input_en[i] = 0; | ||
183 | adp5588_gpio_write(dev->client, GPIO_DIR1 + i, | ||
184 | dev->dir[i]); | ||
185 | mutex_unlock(&dev->lock); | ||
186 | } | ||
187 | |||
188 | if (dev->int_lvl_cached[i] != dev->int_lvl[i]) { | ||
189 | dev->int_lvl_cached[i] = dev->int_lvl[i]; | ||
190 | adp5588_gpio_write(dev->client, GPIO_INT_LVL1 + i, | ||
191 | dev->int_lvl[i]); | ||
192 | } | ||
193 | |||
177 | if (dev->int_en[i] ^ dev->irq_mask[i]) { | 194 | if (dev->int_en[i] ^ dev->irq_mask[i]) { |
178 | dev->int_en[i] = dev->irq_mask[i]; | 195 | dev->int_en[i] = dev->irq_mask[i]; |
179 | adp5588_gpio_write(dev->client, GPIO_INT_EN1 + i, | 196 | adp5588_gpio_write(dev->client, GPIO_INT_EN1 + i, |
180 | dev->int_en[i]); | 197 | dev->int_en[i]); |
181 | } | 198 | } |
199 | } | ||
182 | 200 | ||
183 | mutex_unlock(&dev->irq_lock); | 201 | mutex_unlock(&dev->irq_lock); |
184 | } | 202 | } |
@@ -221,9 +239,7 @@ static int adp5588_irq_set_type(struct irq_data *d, unsigned int type) | |||
221 | else | 239 | else |
222 | return -EINVAL; | 240 | return -EINVAL; |
223 | 241 | ||
224 | adp5588_gpio_direction_input(&dev->gpio_chip, gpio); | 242 | dev->int_input_en[bank] |= bit; |
225 | adp5588_gpio_write(dev->client, GPIO_INT_LVL1 + bank, | ||
226 | dev->int_lvl[bank]); | ||
227 | 243 | ||
228 | return 0; | 244 | return 0; |
229 | } | 245 | } |
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 28da700f5f52..044888fd96a1 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c | |||
@@ -728,6 +728,7 @@ static int dwapb_gpio_probe(struct platform_device *pdev) | |||
728 | out_unregister: | 728 | out_unregister: |
729 | dwapb_gpio_unregister(gpio); | 729 | dwapb_gpio_unregister(gpio); |
730 | dwapb_irq_teardown(gpio); | 730 | dwapb_irq_teardown(gpio); |
731 | clk_disable_unprepare(gpio->clk); | ||
731 | 732 | ||
732 | return err; | 733 | return err; |
733 | } | 734 | } |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index c48ed9d89ff5..8b9d7e42c600 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | struct acpi_gpio_event { | 26 | struct acpi_gpio_event { |
27 | struct list_head node; | 27 | struct list_head node; |
28 | struct list_head initial_sync_list; | ||
29 | acpi_handle handle; | 28 | acpi_handle handle; |
30 | unsigned int pin; | 29 | unsigned int pin; |
31 | unsigned int irq; | 30 | unsigned int irq; |
@@ -49,10 +48,19 @@ struct acpi_gpio_chip { | |||
49 | struct mutex conn_lock; | 48 | struct mutex conn_lock; |
50 | struct gpio_chip *chip; | 49 | struct gpio_chip *chip; |
51 | struct list_head events; | 50 | struct list_head events; |
51 | struct list_head deferred_req_irqs_list_entry; | ||
52 | }; | 52 | }; |
53 | 53 | ||
54 | static LIST_HEAD(acpi_gpio_initial_sync_list); | 54 | /* |
55 | static DEFINE_MUTEX(acpi_gpio_initial_sync_list_lock); | 55 | * For gpiochips which call acpi_gpiochip_request_interrupts() before late_init |
56 | * (so builtin drivers) we register the ACPI GpioInt event handlers from a | ||
57 | * late_initcall_sync handler, so that other builtin drivers can register their | ||
58 | * OpRegions before the event handlers can run. This list contains gpiochips | ||
59 | * for which the acpi_gpiochip_request_interrupts() has been deferred. | ||
60 | */ | ||
61 | static DEFINE_MUTEX(acpi_gpio_deferred_req_irqs_lock); | ||
62 | static LIST_HEAD(acpi_gpio_deferred_req_irqs_list); | ||
63 | static bool acpi_gpio_deferred_req_irqs_done; | ||
56 | 64 | ||
57 | static int acpi_gpiochip_find(struct gpio_chip *gc, void *data) | 65 | static int acpi_gpiochip_find(struct gpio_chip *gc, void *data) |
58 | { | 66 | { |
@@ -89,21 +97,6 @@ static struct gpio_desc *acpi_get_gpiod(char *path, int pin) | |||
89 | return gpiochip_get_desc(chip, pin); | 97 | return gpiochip_get_desc(chip, pin); |
90 | } | 98 | } |
91 | 99 | ||
92 | static void acpi_gpio_add_to_initial_sync_list(struct acpi_gpio_event *event) | ||
93 | { | ||
94 | mutex_lock(&acpi_gpio_initial_sync_list_lock); | ||
95 | list_add(&event->initial_sync_list, &acpi_gpio_initial_sync_list); | ||
96 | mutex_unlock(&acpi_gpio_initial_sync_list_lock); | ||
97 | } | ||
98 | |||
99 | static void acpi_gpio_del_from_initial_sync_list(struct acpi_gpio_event *event) | ||
100 | { | ||
101 | mutex_lock(&acpi_gpio_initial_sync_list_lock); | ||
102 | if (!list_empty(&event->initial_sync_list)) | ||
103 | list_del_init(&event->initial_sync_list); | ||
104 | mutex_unlock(&acpi_gpio_initial_sync_list_lock); | ||
105 | } | ||
106 | |||
107 | static irqreturn_t acpi_gpio_irq_handler(int irq, void *data) | 100 | static irqreturn_t acpi_gpio_irq_handler(int irq, void *data) |
108 | { | 101 | { |
109 | struct acpi_gpio_event *event = data; | 102 | struct acpi_gpio_event *event = data; |
@@ -186,7 +179,7 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
186 | 179 | ||
187 | gpiod_direction_input(desc); | 180 | gpiod_direction_input(desc); |
188 | 181 | ||
189 | value = gpiod_get_value(desc); | 182 | value = gpiod_get_value_cansleep(desc); |
190 | 183 | ||
191 | ret = gpiochip_lock_as_irq(chip, pin); | 184 | ret = gpiochip_lock_as_irq(chip, pin); |
192 | if (ret) { | 185 | if (ret) { |
@@ -229,7 +222,6 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
229 | event->irq = irq; | 222 | event->irq = irq; |
230 | event->pin = pin; | 223 | event->pin = pin; |
231 | event->desc = desc; | 224 | event->desc = desc; |
232 | INIT_LIST_HEAD(&event->initial_sync_list); | ||
233 | 225 | ||
234 | ret = request_threaded_irq(event->irq, NULL, handler, irqflags, | 226 | ret = request_threaded_irq(event->irq, NULL, handler, irqflags, |
235 | "ACPI:Event", event); | 227 | "ACPI:Event", event); |
@@ -251,10 +243,9 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
251 | * may refer to OperationRegions from other (builtin) drivers which | 243 | * may refer to OperationRegions from other (builtin) drivers which |
252 | * may be probed after us. | 244 | * may be probed after us. |
253 | */ | 245 | */ |
254 | if (handler == acpi_gpio_irq_handler && | 246 | if (((irqflags & IRQF_TRIGGER_RISING) && value == 1) || |
255 | (((irqflags & IRQF_TRIGGER_RISING) && value == 1) || | 247 | ((irqflags & IRQF_TRIGGER_FALLING) && value == 0)) |
256 | ((irqflags & IRQF_TRIGGER_FALLING) && value == 0))) | 248 | handler(event->irq, event); |
257 | acpi_gpio_add_to_initial_sync_list(event); | ||
258 | 249 | ||
259 | return AE_OK; | 250 | return AE_OK; |
260 | 251 | ||
@@ -283,6 +274,7 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) | |||
283 | struct acpi_gpio_chip *acpi_gpio; | 274 | struct acpi_gpio_chip *acpi_gpio; |
284 | acpi_handle handle; | 275 | acpi_handle handle; |
285 | acpi_status status; | 276 | acpi_status status; |
277 | bool defer; | ||
286 | 278 | ||
287 | if (!chip->parent || !chip->to_irq) | 279 | if (!chip->parent || !chip->to_irq) |
288 | return; | 280 | return; |
@@ -295,6 +287,16 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) | |||
295 | if (ACPI_FAILURE(status)) | 287 | if (ACPI_FAILURE(status)) |
296 | return; | 288 | return; |
297 | 289 | ||
290 | mutex_lock(&acpi_gpio_deferred_req_irqs_lock); | ||
291 | defer = !acpi_gpio_deferred_req_irqs_done; | ||
292 | if (defer) | ||
293 | list_add(&acpi_gpio->deferred_req_irqs_list_entry, | ||
294 | &acpi_gpio_deferred_req_irqs_list); | ||
295 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); | ||
296 | |||
297 | if (defer) | ||
298 | return; | ||
299 | |||
298 | acpi_walk_resources(handle, "_AEI", | 300 | acpi_walk_resources(handle, "_AEI", |
299 | acpi_gpiochip_request_interrupt, acpi_gpio); | 301 | acpi_gpiochip_request_interrupt, acpi_gpio); |
300 | } | 302 | } |
@@ -325,11 +327,14 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | |||
325 | if (ACPI_FAILURE(status)) | 327 | if (ACPI_FAILURE(status)) |
326 | return; | 328 | return; |
327 | 329 | ||
330 | mutex_lock(&acpi_gpio_deferred_req_irqs_lock); | ||
331 | if (!list_empty(&acpi_gpio->deferred_req_irqs_list_entry)) | ||
332 | list_del_init(&acpi_gpio->deferred_req_irqs_list_entry); | ||
333 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); | ||
334 | |||
328 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { | 335 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { |
329 | struct gpio_desc *desc; | 336 | struct gpio_desc *desc; |
330 | 337 | ||
331 | acpi_gpio_del_from_initial_sync_list(event); | ||
332 | |||
333 | if (irqd_is_wakeup_set(irq_get_irq_data(event->irq))) | 338 | if (irqd_is_wakeup_set(irq_get_irq_data(event->irq))) |
334 | disable_irq_wake(event->irq); | 339 | disable_irq_wake(event->irq); |
335 | 340 | ||
@@ -1052,6 +1057,7 @@ void acpi_gpiochip_add(struct gpio_chip *chip) | |||
1052 | 1057 | ||
1053 | acpi_gpio->chip = chip; | 1058 | acpi_gpio->chip = chip; |
1054 | INIT_LIST_HEAD(&acpi_gpio->events); | 1059 | INIT_LIST_HEAD(&acpi_gpio->events); |
1060 | INIT_LIST_HEAD(&acpi_gpio->deferred_req_irqs_list_entry); | ||
1055 | 1061 | ||
1056 | status = acpi_attach_data(handle, acpi_gpio_chip_dh, acpi_gpio); | 1062 | status = acpi_attach_data(handle, acpi_gpio_chip_dh, acpi_gpio); |
1057 | if (ACPI_FAILURE(status)) { | 1063 | if (ACPI_FAILURE(status)) { |
@@ -1198,20 +1204,28 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) | |||
1198 | return con_id == NULL; | 1204 | return con_id == NULL; |
1199 | } | 1205 | } |
1200 | 1206 | ||
1201 | /* Sync the initial state of handlers after all builtin drivers have probed */ | 1207 | /* Run deferred acpi_gpiochip_request_interrupts() */ |
1202 | static int acpi_gpio_initial_sync(void) | 1208 | static int acpi_gpio_handle_deferred_request_interrupts(void) |
1203 | { | 1209 | { |
1204 | struct acpi_gpio_event *event, *ep; | 1210 | struct acpi_gpio_chip *acpi_gpio, *tmp; |
1211 | |||
1212 | mutex_lock(&acpi_gpio_deferred_req_irqs_lock); | ||
1213 | list_for_each_entry_safe(acpi_gpio, tmp, | ||
1214 | &acpi_gpio_deferred_req_irqs_list, | ||
1215 | deferred_req_irqs_list_entry) { | ||
1216 | acpi_handle handle; | ||
1205 | 1217 | ||
1206 | mutex_lock(&acpi_gpio_initial_sync_list_lock); | 1218 | handle = ACPI_HANDLE(acpi_gpio->chip->parent); |
1207 | list_for_each_entry_safe(event, ep, &acpi_gpio_initial_sync_list, | 1219 | acpi_walk_resources(handle, "_AEI", |
1208 | initial_sync_list) { | 1220 | acpi_gpiochip_request_interrupt, acpi_gpio); |
1209 | acpi_evaluate_object(event->handle, NULL, NULL, NULL); | 1221 | |
1210 | list_del_init(&event->initial_sync_list); | 1222 | list_del_init(&acpi_gpio->deferred_req_irqs_list_entry); |
1211 | } | 1223 | } |
1212 | mutex_unlock(&acpi_gpio_initial_sync_list_lock); | 1224 | |
1225 | acpi_gpio_deferred_req_irqs_done = true; | ||
1226 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); | ||
1213 | 1227 | ||
1214 | return 0; | 1228 | return 0; |
1215 | } | 1229 | } |
1216 | /* We must use _sync so that this runs after the first deferred_probe run */ | 1230 | /* We must use _sync so that this runs after the first deferred_probe run */ |
1217 | late_initcall_sync(acpi_gpio_initial_sync); | 1231 | late_initcall_sync(acpi_gpio_handle_deferred_request_interrupts); |
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a4f1157d6aa0..d4e7a09598fa 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -31,6 +31,7 @@ static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data) | |||
31 | struct of_phandle_args *gpiospec = data; | 31 | struct of_phandle_args *gpiospec = data; |
32 | 32 | ||
33 | return chip->gpiodev->dev.of_node == gpiospec->np && | 33 | return chip->gpiodev->dev.of_node == gpiospec->np && |
34 | chip->of_xlate && | ||
34 | chip->of_xlate(chip, gpiospec, NULL) >= 0; | 35 | chip->of_xlate(chip, gpiospec, NULL) >= 0; |
35 | } | 36 | } |
36 | 37 | ||
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c index 6e3f56684f4e..51ed99a37803 100644 --- a/drivers/gpu/drm/i915/gvt/dmabuf.c +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c | |||
@@ -170,20 +170,22 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct drm_device *dev, | |||
170 | unsigned int tiling_mode = 0; | 170 | unsigned int tiling_mode = 0; |
171 | unsigned int stride = 0; | 171 | unsigned int stride = 0; |
172 | 172 | ||
173 | switch (info->drm_format_mod << 10) { | 173 | switch (info->drm_format_mod) { |
174 | case PLANE_CTL_TILED_LINEAR: | 174 | case DRM_FORMAT_MOD_LINEAR: |
175 | tiling_mode = I915_TILING_NONE; | 175 | tiling_mode = I915_TILING_NONE; |
176 | break; | 176 | break; |
177 | case PLANE_CTL_TILED_X: | 177 | case I915_FORMAT_MOD_X_TILED: |
178 | tiling_mode = I915_TILING_X; | 178 | tiling_mode = I915_TILING_X; |
179 | stride = info->stride; | 179 | stride = info->stride; |
180 | break; | 180 | break; |
181 | case PLANE_CTL_TILED_Y: | 181 | case I915_FORMAT_MOD_Y_TILED: |
182 | case I915_FORMAT_MOD_Yf_TILED: | ||
182 | tiling_mode = I915_TILING_Y; | 183 | tiling_mode = I915_TILING_Y; |
183 | stride = info->stride; | 184 | stride = info->stride; |
184 | break; | 185 | break; |
185 | default: | 186 | default: |
186 | gvt_dbg_core("not supported tiling mode\n"); | 187 | gvt_dbg_core("invalid drm_format_mod %llx for tiling\n", |
188 | info->drm_format_mod); | ||
187 | } | 189 | } |
188 | obj->tiling_and_stride = tiling_mode | stride; | 190 | obj->tiling_and_stride = tiling_mode | stride; |
189 | } else { | 191 | } else { |
@@ -222,9 +224,26 @@ static int vgpu_get_plane_info(struct drm_device *dev, | |||
222 | info->height = p.height; | 224 | info->height = p.height; |
223 | info->stride = p.stride; | 225 | info->stride = p.stride; |
224 | info->drm_format = p.drm_format; | 226 | info->drm_format = p.drm_format; |
225 | info->drm_format_mod = p.tiled; | 227 | |
228 | switch (p.tiled) { | ||
229 | case PLANE_CTL_TILED_LINEAR: | ||
230 | info->drm_format_mod = DRM_FORMAT_MOD_LINEAR; | ||
231 | break; | ||
232 | case PLANE_CTL_TILED_X: | ||
233 | info->drm_format_mod = I915_FORMAT_MOD_X_TILED; | ||
234 | break; | ||
235 | case PLANE_CTL_TILED_Y: | ||
236 | info->drm_format_mod = I915_FORMAT_MOD_Y_TILED; | ||
237 | break; | ||
238 | case PLANE_CTL_TILED_YF: | ||
239 | info->drm_format_mod = I915_FORMAT_MOD_Yf_TILED; | ||
240 | break; | ||
241 | default: | ||
242 | gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled); | ||
243 | } | ||
244 | |||
226 | info->size = (((p.stride * p.height * p.bpp) / 8) + | 245 | info->size = (((p.stride * p.height * p.bpp) / 8) + |
227 | (PAGE_SIZE - 1)) >> PAGE_SHIFT; | 246 | (PAGE_SIZE - 1)) >> PAGE_SHIFT; |
228 | } else if (plane_id == DRM_PLANE_TYPE_CURSOR) { | 247 | } else if (plane_id == DRM_PLANE_TYPE_CURSOR) { |
229 | ret = intel_vgpu_decode_cursor_plane(vgpu, &c); | 248 | ret = intel_vgpu_decode_cursor_plane(vgpu, &c); |
230 | if (ret) | 249 | if (ret) |
diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.c b/drivers/gpu/drm/i915/gvt/fb_decoder.c index face664be3e8..481896fb712a 100644 --- a/drivers/gpu/drm/i915/gvt/fb_decoder.c +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c | |||
@@ -220,8 +220,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, | |||
220 | if (IS_SKYLAKE(dev_priv) | 220 | if (IS_SKYLAKE(dev_priv) |
221 | || IS_KABYLAKE(dev_priv) | 221 | || IS_KABYLAKE(dev_priv) |
222 | || IS_BROXTON(dev_priv)) { | 222 | || IS_BROXTON(dev_priv)) { |
223 | plane->tiled = (val & PLANE_CTL_TILED_MASK) >> | 223 | plane->tiled = val & PLANE_CTL_TILED_MASK; |
224 | _PLANE_CTL_TILED_SHIFT; | ||
225 | fmt = skl_format_to_drm( | 224 | fmt = skl_format_to_drm( |
226 | val & PLANE_CTL_FORMAT_MASK, | 225 | val & PLANE_CTL_FORMAT_MASK, |
227 | val & PLANE_CTL_ORDER_RGBX, | 226 | val & PLANE_CTL_ORDER_RGBX, |
@@ -260,7 +259,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, | |||
260 | return -EINVAL; | 259 | return -EINVAL; |
261 | } | 260 | } |
262 | 261 | ||
263 | plane->stride = intel_vgpu_get_stride(vgpu, pipe, (plane->tiled << 10), | 262 | plane->stride = intel_vgpu_get_stride(vgpu, pipe, plane->tiled, |
264 | (IS_SKYLAKE(dev_priv) | 263 | (IS_SKYLAKE(dev_priv) |
265 | || IS_KABYLAKE(dev_priv) | 264 | || IS_KABYLAKE(dev_priv) |
266 | || IS_BROXTON(dev_priv)) ? | 265 | || IS_BROXTON(dev_priv)) ? |
diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.h b/drivers/gpu/drm/i915/gvt/fb_decoder.h index cb055f3c81a2..60c155085029 100644 --- a/drivers/gpu/drm/i915/gvt/fb_decoder.h +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.h | |||
@@ -101,7 +101,7 @@ struct intel_gvt; | |||
101 | /* color space conversion and gamma correction are not included */ | 101 | /* color space conversion and gamma correction are not included */ |
102 | struct intel_vgpu_primary_plane_format { | 102 | struct intel_vgpu_primary_plane_format { |
103 | u8 enabled; /* plane is enabled */ | 103 | u8 enabled; /* plane is enabled */ |
104 | u8 tiled; /* X-tiled */ | 104 | u32 tiled; /* tiling mode: linear, X-tiled, Y tiled, etc */ |
105 | u8 bpp; /* bits per pixel */ | 105 | u8 bpp; /* bits per pixel */ |
106 | u32 hw_format; /* format field in the PRI_CTL register */ | 106 | u32 hw_format; /* format field in the PRI_CTL register */ |
107 | u32 drm_format; /* format in DRM definition */ | 107 | u32 drm_format; /* format in DRM definition */ |
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c index 7a58ca555197..72afa518edd9 100644 --- a/drivers/gpu/drm/i915/gvt/handlers.c +++ b/drivers/gpu/drm/i915/gvt/handlers.c | |||
@@ -1296,6 +1296,19 @@ static int power_well_ctl_mmio_write(struct intel_vgpu *vgpu, | |||
1296 | return 0; | 1296 | return 0; |
1297 | } | 1297 | } |
1298 | 1298 | ||
1299 | static int gen9_dbuf_ctl_mmio_write(struct intel_vgpu *vgpu, | ||
1300 | unsigned int offset, void *p_data, unsigned int bytes) | ||
1301 | { | ||
1302 | write_vreg(vgpu, offset, p_data, bytes); | ||
1303 | |||
1304 | if (vgpu_vreg(vgpu, offset) & DBUF_POWER_REQUEST) | ||
1305 | vgpu_vreg(vgpu, offset) |= DBUF_POWER_STATE; | ||
1306 | else | ||
1307 | vgpu_vreg(vgpu, offset) &= ~DBUF_POWER_STATE; | ||
1308 | |||
1309 | return 0; | ||
1310 | } | ||
1311 | |||
1299 | static int fpga_dbg_mmio_write(struct intel_vgpu *vgpu, | 1312 | static int fpga_dbg_mmio_write(struct intel_vgpu *vgpu, |
1300 | unsigned int offset, void *p_data, unsigned int bytes) | 1313 | unsigned int offset, void *p_data, unsigned int bytes) |
1301 | { | 1314 | { |
@@ -1525,9 +1538,15 @@ static int bxt_phy_ctl_family_write(struct intel_vgpu *vgpu, | |||
1525 | u32 v = *(u32 *)p_data; | 1538 | u32 v = *(u32 *)p_data; |
1526 | u32 data = v & COMMON_RESET_DIS ? BXT_PHY_LANE_ENABLED : 0; | 1539 | u32 data = v & COMMON_RESET_DIS ? BXT_PHY_LANE_ENABLED : 0; |
1527 | 1540 | ||
1528 | vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_A) = data; | 1541 | switch (offset) { |
1529 | vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_B) = data; | 1542 | case _PHY_CTL_FAMILY_EDP: |
1530 | vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_C) = data; | 1543 | vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_A) = data; |
1544 | break; | ||
1545 | case _PHY_CTL_FAMILY_DDI: | ||
1546 | vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_B) = data; | ||
1547 | vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_C) = data; | ||
1548 | break; | ||
1549 | } | ||
1531 | 1550 | ||
1532 | vgpu_vreg(vgpu, offset) = v; | 1551 | vgpu_vreg(vgpu, offset) = v; |
1533 | 1552 | ||
@@ -2812,6 +2831,8 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) | |||
2812 | MMIO_DH(HSW_PWR_WELL_CTL_DRIVER(SKL_DISP_PW_MISC_IO), D_SKL_PLUS, NULL, | 2831 | MMIO_DH(HSW_PWR_WELL_CTL_DRIVER(SKL_DISP_PW_MISC_IO), D_SKL_PLUS, NULL, |
2813 | skl_power_well_ctl_write); | 2832 | skl_power_well_ctl_write); |
2814 | 2833 | ||
2834 | MMIO_DH(DBUF_CTL, D_SKL_PLUS, NULL, gen9_dbuf_ctl_mmio_write); | ||
2835 | |||
2815 | MMIO_D(_MMIO(0xa210), D_SKL_PLUS); | 2836 | MMIO_D(_MMIO(0xa210), D_SKL_PLUS); |
2816 | MMIO_D(GEN9_MEDIA_PG_IDLE_HYSTERESIS, D_SKL_PLUS); | 2837 | MMIO_D(GEN9_MEDIA_PG_IDLE_HYSTERESIS, D_SKL_PLUS); |
2817 | MMIO_D(GEN9_RENDER_PG_IDLE_HYSTERESIS, D_SKL_PLUS); | 2838 | MMIO_D(GEN9_RENDER_PG_IDLE_HYSTERESIS, D_SKL_PLUS); |
@@ -2987,8 +3008,6 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) | |||
2987 | NULL, gen9_trtte_write); | 3008 | NULL, gen9_trtte_write); |
2988 | MMIO_DH(_MMIO(0x4dfc), D_SKL_PLUS, NULL, gen9_trtt_chicken_write); | 3009 | MMIO_DH(_MMIO(0x4dfc), D_SKL_PLUS, NULL, gen9_trtt_chicken_write); |
2989 | 3010 | ||
2990 | MMIO_D(_MMIO(0x45008), D_SKL_PLUS); | ||
2991 | |||
2992 | MMIO_D(_MMIO(0x46430), D_SKL_PLUS); | 3011 | MMIO_D(_MMIO(0x46430), D_SKL_PLUS); |
2993 | 3012 | ||
2994 | MMIO_D(_MMIO(0x46520), D_SKL_PLUS); | 3013 | MMIO_D(_MMIO(0x46520), D_SKL_PLUS); |
@@ -3025,7 +3044,9 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) | |||
3025 | MMIO_D(_MMIO(0x44500), D_SKL_PLUS); | 3044 | MMIO_D(_MMIO(0x44500), D_SKL_PLUS); |
3026 | MMIO_DFH(GEN9_CSFE_CHICKEN1_RCS, D_SKL_PLUS, F_CMD_ACCESS, NULL, NULL); | 3045 | MMIO_DFH(GEN9_CSFE_CHICKEN1_RCS, D_SKL_PLUS, F_CMD_ACCESS, NULL, NULL); |
3027 | MMIO_DFH(GEN8_HDC_CHICKEN1, D_SKL_PLUS, F_MODE_MASK | F_CMD_ACCESS, | 3046 | MMIO_DFH(GEN8_HDC_CHICKEN1, D_SKL_PLUS, F_MODE_MASK | F_CMD_ACCESS, |
3028 | NULL, NULL); | 3047 | NULL, NULL); |
3048 | MMIO_DFH(GEN9_WM_CHICKEN3, D_SKL_PLUS, F_MODE_MASK | F_CMD_ACCESS, | ||
3049 | NULL, NULL); | ||
3029 | 3050 | ||
3030 | MMIO_D(_MMIO(0x4ab8), D_KBL); | 3051 | MMIO_D(_MMIO(0x4ab8), D_KBL); |
3031 | MMIO_D(_MMIO(0x2248), D_KBL | D_SKL); | 3052 | MMIO_D(_MMIO(0x2248), D_KBL | D_SKL); |
diff --git a/drivers/gpu/drm/i915/gvt/mmio_context.c b/drivers/gpu/drm/i915/gvt/mmio_context.c index 42e1e6bdcc2c..e872f4847fbe 100644 --- a/drivers/gpu/drm/i915/gvt/mmio_context.c +++ b/drivers/gpu/drm/i915/gvt/mmio_context.c | |||
@@ -562,11 +562,9 @@ void intel_gvt_switch_mmio(struct intel_vgpu *pre, | |||
562 | * performace for batch mmio read/write, so we need | 562 | * performace for batch mmio read/write, so we need |
563 | * handle forcewake mannually. | 563 | * handle forcewake mannually. |
564 | */ | 564 | */ |
565 | intel_runtime_pm_get(dev_priv); | ||
566 | intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); | 565 | intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); |
567 | switch_mmio(pre, next, ring_id); | 566 | switch_mmio(pre, next, ring_id); |
568 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); | 567 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); |
569 | intel_runtime_pm_put(dev_priv); | ||
570 | } | 568 | } |
571 | 569 | ||
572 | /** | 570 | /** |
diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c index 09d7bb72b4ff..c32e7d5e8629 100644 --- a/drivers/gpu/drm/i915/gvt/sched_policy.c +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c | |||
@@ -47,11 +47,15 @@ static bool vgpu_has_pending_workload(struct intel_vgpu *vgpu) | |||
47 | return false; | 47 | return false; |
48 | } | 48 | } |
49 | 49 | ||
50 | /* We give 2 seconds higher prio for vGPU during start */ | ||
51 | #define GVT_SCHED_VGPU_PRI_TIME 2 | ||
52 | |||
50 | struct vgpu_sched_data { | 53 | struct vgpu_sched_data { |
51 | struct list_head lru_list; | 54 | struct list_head lru_list; |
52 | struct intel_vgpu *vgpu; | 55 | struct intel_vgpu *vgpu; |
53 | bool active; | 56 | bool active; |
54 | 57 | bool pri_sched; | |
58 | ktime_t pri_time; | ||
55 | ktime_t sched_in_time; | 59 | ktime_t sched_in_time; |
56 | ktime_t sched_time; | 60 | ktime_t sched_time; |
57 | ktime_t left_ts; | 61 | ktime_t left_ts; |
@@ -183,6 +187,14 @@ static struct intel_vgpu *find_busy_vgpu(struct gvt_sched_data *sched_data) | |||
183 | if (!vgpu_has_pending_workload(vgpu_data->vgpu)) | 187 | if (!vgpu_has_pending_workload(vgpu_data->vgpu)) |
184 | continue; | 188 | continue; |
185 | 189 | ||
190 | if (vgpu_data->pri_sched) { | ||
191 | if (ktime_before(ktime_get(), vgpu_data->pri_time)) { | ||
192 | vgpu = vgpu_data->vgpu; | ||
193 | break; | ||
194 | } else | ||
195 | vgpu_data->pri_sched = false; | ||
196 | } | ||
197 | |||
186 | /* Return the vGPU only if it has time slice left */ | 198 | /* Return the vGPU only if it has time slice left */ |
187 | if (vgpu_data->left_ts > 0) { | 199 | if (vgpu_data->left_ts > 0) { |
188 | vgpu = vgpu_data->vgpu; | 200 | vgpu = vgpu_data->vgpu; |
@@ -202,6 +214,7 @@ static void tbs_sched_func(struct gvt_sched_data *sched_data) | |||
202 | struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; | 214 | struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; |
203 | struct vgpu_sched_data *vgpu_data; | 215 | struct vgpu_sched_data *vgpu_data; |
204 | struct intel_vgpu *vgpu = NULL; | 216 | struct intel_vgpu *vgpu = NULL; |
217 | |||
205 | /* no active vgpu or has already had a target */ | 218 | /* no active vgpu or has already had a target */ |
206 | if (list_empty(&sched_data->lru_runq_head) || scheduler->next_vgpu) | 219 | if (list_empty(&sched_data->lru_runq_head) || scheduler->next_vgpu) |
207 | goto out; | 220 | goto out; |
@@ -209,12 +222,13 @@ static void tbs_sched_func(struct gvt_sched_data *sched_data) | |||
209 | vgpu = find_busy_vgpu(sched_data); | 222 | vgpu = find_busy_vgpu(sched_data); |
210 | if (vgpu) { | 223 | if (vgpu) { |
211 | scheduler->next_vgpu = vgpu; | 224 | scheduler->next_vgpu = vgpu; |
212 | |||
213 | /* Move the last used vGPU to the tail of lru_list */ | ||
214 | vgpu_data = vgpu->sched_data; | 225 | vgpu_data = vgpu->sched_data; |
215 | list_del_init(&vgpu_data->lru_list); | 226 | if (!vgpu_data->pri_sched) { |
216 | list_add_tail(&vgpu_data->lru_list, | 227 | /* Move the last used vGPU to the tail of lru_list */ |
217 | &sched_data->lru_runq_head); | 228 | list_del_init(&vgpu_data->lru_list); |
229 | list_add_tail(&vgpu_data->lru_list, | ||
230 | &sched_data->lru_runq_head); | ||
231 | } | ||
218 | } else { | 232 | } else { |
219 | scheduler->next_vgpu = gvt->idle_vgpu; | 233 | scheduler->next_vgpu = gvt->idle_vgpu; |
220 | } | 234 | } |
@@ -328,11 +342,17 @@ static void tbs_sched_start_schedule(struct intel_vgpu *vgpu) | |||
328 | { | 342 | { |
329 | struct gvt_sched_data *sched_data = vgpu->gvt->scheduler.sched_data; | 343 | struct gvt_sched_data *sched_data = vgpu->gvt->scheduler.sched_data; |
330 | struct vgpu_sched_data *vgpu_data = vgpu->sched_data; | 344 | struct vgpu_sched_data *vgpu_data = vgpu->sched_data; |
345 | ktime_t now; | ||
331 | 346 | ||
332 | if (!list_empty(&vgpu_data->lru_list)) | 347 | if (!list_empty(&vgpu_data->lru_list)) |
333 | return; | 348 | return; |
334 | 349 | ||
335 | list_add_tail(&vgpu_data->lru_list, &sched_data->lru_runq_head); | 350 | now = ktime_get(); |
351 | vgpu_data->pri_time = ktime_add(now, | ||
352 | ktime_set(GVT_SCHED_VGPU_PRI_TIME, 0)); | ||
353 | vgpu_data->pri_sched = true; | ||
354 | |||
355 | list_add(&vgpu_data->lru_list, &sched_data->lru_runq_head); | ||
336 | 356 | ||
337 | if (!hrtimer_active(&sched_data->timer)) | 357 | if (!hrtimer_active(&sched_data->timer)) |
338 | hrtimer_start(&sched_data->timer, ktime_add_ns(ktime_get(), | 358 | hrtimer_start(&sched_data->timer, ktime_add_ns(ktime_get(), |
@@ -426,6 +446,7 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu) | |||
426 | &vgpu->gvt->scheduler; | 446 | &vgpu->gvt->scheduler; |
427 | int ring_id; | 447 | int ring_id; |
428 | struct vgpu_sched_data *vgpu_data = vgpu->sched_data; | 448 | struct vgpu_sched_data *vgpu_data = vgpu->sched_data; |
449 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; | ||
429 | 450 | ||
430 | if (!vgpu_data->active) | 451 | if (!vgpu_data->active) |
431 | return; | 452 | return; |
@@ -444,6 +465,7 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu) | |||
444 | scheduler->current_vgpu = NULL; | 465 | scheduler->current_vgpu = NULL; |
445 | } | 466 | } |
446 | 467 | ||
468 | intel_runtime_pm_get(dev_priv); | ||
447 | spin_lock_bh(&scheduler->mmio_context_lock); | 469 | spin_lock_bh(&scheduler->mmio_context_lock); |
448 | for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) { | 470 | for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) { |
449 | if (scheduler->engine_owner[ring_id] == vgpu) { | 471 | if (scheduler->engine_owner[ring_id] == vgpu) { |
@@ -452,5 +474,6 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu) | |||
452 | } | 474 | } |
453 | } | 475 | } |
454 | spin_unlock_bh(&scheduler->mmio_context_lock); | 476 | spin_unlock_bh(&scheduler->mmio_context_lock); |
477 | intel_runtime_pm_put(dev_priv); | ||
455 | mutex_unlock(&vgpu->gvt->sched_lock); | 478 | mutex_unlock(&vgpu->gvt->sched_lock); |
456 | } | 479 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 08ec7446282e..9e63cd47b60f 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -10422,7 +10422,7 @@ enum skl_power_gate { | |||
10422 | _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB, \ | 10422 | _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB, \ |
10423 | _ICL_DSC0_PICTURE_PARAMETER_SET_4_PC) | 10423 | _ICL_DSC0_PICTURE_PARAMETER_SET_4_PC) |
10424 | #define ICL_DSC1_PICTURE_PARAMETER_SET_4(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ | 10424 | #define ICL_DSC1_PICTURE_PARAMETER_SET_4(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ |
10425 | _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB, \ | 10425 | _ICL_DSC1_PICTURE_PARAMETER_SET_4_PB, \ |
10426 | _ICL_DSC1_PICTURE_PARAMETER_SET_4_PC) | 10426 | _ICL_DSC1_PICTURE_PARAMETER_SET_4_PC) |
10427 | #define DSC_INITIAL_DEC_DELAY(dec_delay) ((dec_delay) << 16) | 10427 | #define DSC_INITIAL_DEC_DELAY(dec_delay) ((dec_delay) << 16) |
10428 | #define DSC_INITIAL_XMIT_DELAY(xmit_delay) ((xmit_delay) << 0) | 10428 | #define DSC_INITIAL_XMIT_DELAY(xmit_delay) ((xmit_delay) << 0) |
@@ -10437,7 +10437,7 @@ enum skl_power_gate { | |||
10437 | _ICL_DSC0_PICTURE_PARAMETER_SET_5_PB, \ | 10437 | _ICL_DSC0_PICTURE_PARAMETER_SET_5_PB, \ |
10438 | _ICL_DSC0_PICTURE_PARAMETER_SET_5_PC) | 10438 | _ICL_DSC0_PICTURE_PARAMETER_SET_5_PC) |
10439 | #define ICL_DSC1_PICTURE_PARAMETER_SET_5(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ | 10439 | #define ICL_DSC1_PICTURE_PARAMETER_SET_5(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ |
10440 | _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC, \ | 10440 | _ICL_DSC1_PICTURE_PARAMETER_SET_5_PB, \ |
10441 | _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC) | 10441 | _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC) |
10442 | #define DSC_SCALE_DEC_INTINT(scale_dec) ((scale_dec) << 16) | 10442 | #define DSC_SCALE_DEC_INTINT(scale_dec) ((scale_dec) << 16) |
10443 | #define DSC_SCALE_INC_INT(scale_inc) ((scale_inc) << 0) | 10443 | #define DSC_SCALE_INC_INT(scale_inc) ((scale_inc) << 0) |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 8761513f3532..c9af34861d9e 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -2708,7 +2708,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, | |||
2708 | if (port != PORT_A || INTEL_GEN(dev_priv) >= 9) | 2708 | if (port != PORT_A || INTEL_GEN(dev_priv) >= 9) |
2709 | intel_dp_stop_link_train(intel_dp); | 2709 | intel_dp_stop_link_train(intel_dp); |
2710 | 2710 | ||
2711 | intel_ddi_enable_pipe_clock(crtc_state); | 2711 | if (!is_mst) |
2712 | intel_ddi_enable_pipe_clock(crtc_state); | ||
2712 | } | 2713 | } |
2713 | 2714 | ||
2714 | static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder, | 2715 | static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder, |
@@ -2810,14 +2811,14 @@ static void intel_ddi_post_disable_dp(struct intel_encoder *encoder, | |||
2810 | bool is_mst = intel_crtc_has_type(old_crtc_state, | 2811 | bool is_mst = intel_crtc_has_type(old_crtc_state, |
2811 | INTEL_OUTPUT_DP_MST); | 2812 | INTEL_OUTPUT_DP_MST); |
2812 | 2813 | ||
2813 | intel_ddi_disable_pipe_clock(old_crtc_state); | 2814 | if (!is_mst) { |
2814 | 2815 | intel_ddi_disable_pipe_clock(old_crtc_state); | |
2815 | /* | 2816 | /* |
2816 | * Power down sink before disabling the port, otherwise we end | 2817 | * Power down sink before disabling the port, otherwise we end |
2817 | * up getting interrupts from the sink on detecting link loss. | 2818 | * up getting interrupts from the sink on detecting link loss. |
2818 | */ | 2819 | */ |
2819 | if (!is_mst) | ||
2820 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); | 2820 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); |
2821 | } | ||
2821 | 2822 | ||
2822 | intel_disable_ddi_buf(encoder); | 2823 | intel_disable_ddi_buf(encoder); |
2823 | 2824 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index cd0f649b57a5..1193202766a2 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -4160,18 +4160,6 @@ intel_dp_needs_link_retrain(struct intel_dp *intel_dp) | |||
4160 | return !drm_dp_channel_eq_ok(link_status, intel_dp->lane_count); | 4160 | return !drm_dp_channel_eq_ok(link_status, intel_dp->lane_count); |
4161 | } | 4161 | } |
4162 | 4162 | ||
4163 | /* | ||
4164 | * If display is now connected check links status, | ||
4165 | * there has been known issues of link loss triggering | ||
4166 | * long pulse. | ||
4167 | * | ||
4168 | * Some sinks (eg. ASUS PB287Q) seem to perform some | ||
4169 | * weird HPD ping pong during modesets. So we can apparently | ||
4170 | * end up with HPD going low during a modeset, and then | ||
4171 | * going back up soon after. And once that happens we must | ||
4172 | * retrain the link to get a picture. That's in case no | ||
4173 | * userspace component reacted to intermittent HPD dip. | ||
4174 | */ | ||
4175 | int intel_dp_retrain_link(struct intel_encoder *encoder, | 4163 | int intel_dp_retrain_link(struct intel_encoder *encoder, |
4176 | struct drm_modeset_acquire_ctx *ctx) | 4164 | struct drm_modeset_acquire_ctx *ctx) |
4177 | { | 4165 | { |
@@ -4661,7 +4649,8 @@ intel_dp_unset_edid(struct intel_dp *intel_dp) | |||
4661 | } | 4649 | } |
4662 | 4650 | ||
4663 | static int | 4651 | static int |
4664 | intel_dp_long_pulse(struct intel_connector *connector) | 4652 | intel_dp_long_pulse(struct intel_connector *connector, |
4653 | struct drm_modeset_acquire_ctx *ctx) | ||
4665 | { | 4654 | { |
4666 | struct drm_i915_private *dev_priv = to_i915(connector->base.dev); | 4655 | struct drm_i915_private *dev_priv = to_i915(connector->base.dev); |
4667 | struct intel_dp *intel_dp = intel_attached_dp(&connector->base); | 4656 | struct intel_dp *intel_dp = intel_attached_dp(&connector->base); |
@@ -4720,6 +4709,22 @@ intel_dp_long_pulse(struct intel_connector *connector) | |||
4720 | */ | 4709 | */ |
4721 | status = connector_status_disconnected; | 4710 | status = connector_status_disconnected; |
4722 | goto out; | 4711 | goto out; |
4712 | } else { | ||
4713 | /* | ||
4714 | * If display is now connected check links status, | ||
4715 | * there has been known issues of link loss triggering | ||
4716 | * long pulse. | ||
4717 | * | ||
4718 | * Some sinks (eg. ASUS PB287Q) seem to perform some | ||
4719 | * weird HPD ping pong during modesets. So we can apparently | ||
4720 | * end up with HPD going low during a modeset, and then | ||
4721 | * going back up soon after. And once that happens we must | ||
4722 | * retrain the link to get a picture. That's in case no | ||
4723 | * userspace component reacted to intermittent HPD dip. | ||
4724 | */ | ||
4725 | struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; | ||
4726 | |||
4727 | intel_dp_retrain_link(encoder, ctx); | ||
4723 | } | 4728 | } |
4724 | 4729 | ||
4725 | /* | 4730 | /* |
@@ -4781,7 +4786,7 @@ intel_dp_detect(struct drm_connector *connector, | |||
4781 | return ret; | 4786 | return ret; |
4782 | } | 4787 | } |
4783 | 4788 | ||
4784 | status = intel_dp_long_pulse(intel_dp->attached_connector); | 4789 | status = intel_dp_long_pulse(intel_dp->attached_connector, ctx); |
4785 | } | 4790 | } |
4786 | 4791 | ||
4787 | intel_dp->detect_done = false; | 4792 | intel_dp->detect_done = false; |
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 7e3e01607643..4ecd65375603 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c | |||
@@ -166,6 +166,8 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder, | |||
166 | struct intel_connector *connector = | 166 | struct intel_connector *connector = |
167 | to_intel_connector(old_conn_state->connector); | 167 | to_intel_connector(old_conn_state->connector); |
168 | 168 | ||
169 | intel_ddi_disable_pipe_clock(old_crtc_state); | ||
170 | |||
169 | /* this can fail */ | 171 | /* this can fail */ |
170 | drm_dp_check_act_status(&intel_dp->mst_mgr); | 172 | drm_dp_check_act_status(&intel_dp->mst_mgr); |
171 | /* and this can also fail */ | 173 | /* and this can also fail */ |
@@ -252,6 +254,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder, | |||
252 | I915_WRITE(DP_TP_STATUS(port), temp); | 254 | I915_WRITE(DP_TP_STATUS(port), temp); |
253 | 255 | ||
254 | ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr); | 256 | ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr); |
257 | |||
258 | intel_ddi_enable_pipe_clock(pipe_config); | ||
255 | } | 259 | } |
256 | 260 | ||
257 | static void intel_mst_enable_dp(struct intel_encoder *encoder, | 261 | static void intel_mst_enable_dp(struct intel_encoder *encoder, |
diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c index fb4e4a6bb1f6..be5ba4690895 100644 --- a/drivers/hwmon/raspberrypi-hwmon.c +++ b/drivers/hwmon/raspberrypi-hwmon.c | |||
@@ -164,3 +164,4 @@ module_platform_driver(rpi_hwmon_driver); | |||
164 | MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>"); | 164 | MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>"); |
165 | MODULE_DESCRIPTION("Raspberry Pi voltage sensor driver"); | 165 | MODULE_DESCRIPTION("Raspberry Pi voltage sensor driver"); |
166 | MODULE_LICENSE("GPL v2"); | 166 | MODULE_LICENSE("GPL v2"); |
167 | MODULE_ALIAS("platform:raspberrypi-hwmon"); | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 04b60a349d7e..c91e145ef5a5 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -140,6 +140,7 @@ | |||
140 | 140 | ||
141 | #define SBREG_BAR 0x10 | 141 | #define SBREG_BAR 0x10 |
142 | #define SBREG_SMBCTRL 0xc6000c | 142 | #define SBREG_SMBCTRL 0xc6000c |
143 | #define SBREG_SMBCTRL_DNV 0xcf000c | ||
143 | 144 | ||
144 | /* Host status bits for SMBPCISTS */ | 145 | /* Host status bits for SMBPCISTS */ |
145 | #define SMBPCISTS_INTS BIT(3) | 146 | #define SMBPCISTS_INTS BIT(3) |
@@ -1399,7 +1400,11 @@ static void i801_add_tco(struct i801_priv *priv) | |||
1399 | spin_unlock(&p2sb_spinlock); | 1400 | spin_unlock(&p2sb_spinlock); |
1400 | 1401 | ||
1401 | res = &tco_res[ICH_RES_MEM_OFF]; | 1402 | res = &tco_res[ICH_RES_MEM_OFF]; |
1402 | res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL; | 1403 | if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS) |
1404 | res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL_DNV; | ||
1405 | else | ||
1406 | res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL; | ||
1407 | |||
1403 | res->end = res->start + 3; | 1408 | res->end = res->start + 3; |
1404 | res->flags = IORESOURCE_MEM; | 1409 | res->flags = IORESOURCE_MEM; |
1405 | 1410 | ||
diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 6d975f5221ca..06c4c767af32 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c | |||
@@ -538,7 +538,6 @@ static const struct i2c_algorithm lpi2c_imx_algo = { | |||
538 | 538 | ||
539 | static const struct of_device_id lpi2c_imx_of_match[] = { | 539 | static const struct of_device_id lpi2c_imx_of_match[] = { |
540 | { .compatible = "fsl,imx7ulp-lpi2c" }, | 540 | { .compatible = "fsl,imx7ulp-lpi2c" }, |
541 | { .compatible = "fsl,imx8dv-lpi2c" }, | ||
542 | { }, | 541 | { }, |
543 | }; | 542 | }; |
544 | MODULE_DEVICE_TABLE(of, lpi2c_imx_of_match); | 543 | MODULE_DEVICE_TABLE(of, lpi2c_imx_of_match); |
diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index 9918bdd81619..a403e8579b65 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c | |||
@@ -401,11 +401,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, | |||
401 | return ret; | 401 | return ret; |
402 | 402 | ||
403 | for (msg = msgs; msg < emsg; msg++) { | 403 | for (msg = msgs; msg < emsg; msg++) { |
404 | /* If next message is read, skip the stop condition */ | 404 | /* Emit STOP if it is the last message or I2C_M_STOP is set. */ |
405 | bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); | 405 | bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP); |
406 | /* but, force it if I2C_M_STOP is set */ | ||
407 | if (msg->flags & I2C_M_STOP) | ||
408 | stop = true; | ||
409 | 406 | ||
410 | ret = uniphier_fi2c_master_xfer_one(adap, msg, stop); | 407 | ret = uniphier_fi2c_master_xfer_one(adap, msg, stop); |
411 | if (ret) | 408 | if (ret) |
diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index bb181b088291..454f914ae66d 100644 --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c | |||
@@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap, | |||
248 | return ret; | 248 | return ret; |
249 | 249 | ||
250 | for (msg = msgs; msg < emsg; msg++) { | 250 | for (msg = msgs; msg < emsg; msg++) { |
251 | /* If next message is read, skip the stop condition */ | 251 | /* Emit STOP if it is the last message or I2C_M_STOP is set. */ |
252 | bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); | 252 | bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP); |
253 | /* but, force it if I2C_M_STOP is set */ | ||
254 | if (msg->flags & I2C_M_STOP) | ||
255 | stop = true; | ||
256 | 253 | ||
257 | ret = uniphier_i2c_master_xfer_one(adap, msg, stop); | 254 | ret = uniphier_i2c_master_xfer_one(adap, msg, stop); |
258 | if (ret) | 255 | if (ret) |
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 9a71e50d21f1..0c51c0ffdda9 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c | |||
@@ -532,6 +532,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c) | |||
532 | { | 532 | { |
533 | u8 rx_watermark; | 533 | u8 rx_watermark; |
534 | struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg; | 534 | struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg; |
535 | unsigned long flags; | ||
535 | 536 | ||
536 | /* Clear and enable Rx full interrupt. */ | 537 | /* Clear and enable Rx full interrupt. */ |
537 | xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK); | 538 | xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK); |
@@ -547,6 +548,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c) | |||
547 | rx_watermark = IIC_RX_FIFO_DEPTH; | 548 | rx_watermark = IIC_RX_FIFO_DEPTH; |
548 | xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1); | 549 | xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1); |
549 | 550 | ||
551 | local_irq_save(flags); | ||
550 | if (!(msg->flags & I2C_M_NOSTART)) | 552 | if (!(msg->flags & I2C_M_NOSTART)) |
551 | /* write the address */ | 553 | /* write the address */ |
552 | xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, | 554 | xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, |
@@ -556,6 +558,8 @@ static void xiic_start_recv(struct xiic_i2c *i2c) | |||
556 | 558 | ||
557 | xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, | 559 | xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, |
558 | msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0)); | 560 | msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0)); |
561 | local_irq_restore(flags); | ||
562 | |||
559 | if (i2c->nmsgs == 1) | 563 | if (i2c->nmsgs == 1) |
560 | /* very last, enable bus not busy as well */ | 564 | /* very last, enable bus not busy as well */ |
561 | xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK); | 565 | xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK); |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 316a57530f6d..c2df341ff6fa 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
@@ -1439,6 +1439,7 @@ static struct irq_chip its_irq_chip = { | |||
1439 | * The consequence of the above is that allocation is cost is low, but | 1439 | * The consequence of the above is that allocation is cost is low, but |
1440 | * freeing is expensive. We assumes that freeing rarely occurs. | 1440 | * freeing is expensive. We assumes that freeing rarely occurs. |
1441 | */ | 1441 | */ |
1442 | #define ITS_MAX_LPI_NRBITS 16 /* 64K LPIs */ | ||
1442 | 1443 | ||
1443 | static DEFINE_MUTEX(lpi_range_lock); | 1444 | static DEFINE_MUTEX(lpi_range_lock); |
1444 | static LIST_HEAD(lpi_range_list); | 1445 | static LIST_HEAD(lpi_range_list); |
@@ -1625,7 +1626,8 @@ static int __init its_alloc_lpi_tables(void) | |||
1625 | { | 1626 | { |
1626 | phys_addr_t paddr; | 1627 | phys_addr_t paddr; |
1627 | 1628 | ||
1628 | lpi_id_bits = GICD_TYPER_ID_BITS(gic_rdists->gicd_typer); | 1629 | lpi_id_bits = min_t(u32, GICD_TYPER_ID_BITS(gic_rdists->gicd_typer), |
1630 | ITS_MAX_LPI_NRBITS); | ||
1629 | gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT); | 1631 | gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT); |
1630 | if (!gic_rdists->prop_page) { | 1632 | if (!gic_rdists->prop_page) { |
1631 | pr_err("Failed to allocate PROPBASE\n"); | 1633 | pr_err("Failed to allocate PROPBASE\n"); |
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 94329e03001e..0b2af6e74fc3 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c | |||
@@ -1276,18 +1276,18 @@ static int resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi) | |||
1276 | static int resync_finish(struct mddev *mddev) | 1276 | static int resync_finish(struct mddev *mddev) |
1277 | { | 1277 | { |
1278 | struct md_cluster_info *cinfo = mddev->cluster_info; | 1278 | struct md_cluster_info *cinfo = mddev->cluster_info; |
1279 | int ret = 0; | ||
1279 | 1280 | ||
1280 | clear_bit(MD_RESYNCING_REMOTE, &mddev->recovery); | 1281 | clear_bit(MD_RESYNCING_REMOTE, &mddev->recovery); |
1281 | dlm_unlock_sync(cinfo->resync_lockres); | ||
1282 | 1282 | ||
1283 | /* | 1283 | /* |
1284 | * If resync thread is interrupted so we can't say resync is finished, | 1284 | * If resync thread is interrupted so we can't say resync is finished, |
1285 | * another node will launch resync thread to continue. | 1285 | * another node will launch resync thread to continue. |
1286 | */ | 1286 | */ |
1287 | if (test_bit(MD_CLOSING, &mddev->flags)) | 1287 | if (!test_bit(MD_CLOSING, &mddev->flags)) |
1288 | return 0; | 1288 | ret = resync_info_update(mddev, 0, 0); |
1289 | else | 1289 | dlm_unlock_sync(cinfo->resync_lockres); |
1290 | return resync_info_update(mddev, 0, 0); | 1290 | return ret; |
1291 | } | 1291 | } |
1292 | 1292 | ||
1293 | static int area_resyncing(struct mddev *mddev, int direction, | 1293 | static int area_resyncing(struct mddev *mddev, int direction, |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 981898049491..d6f7978b4449 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -4529,11 +4529,12 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, | |||
4529 | allow_barrier(conf); | 4529 | allow_barrier(conf); |
4530 | } | 4530 | } |
4531 | 4531 | ||
4532 | raise_barrier(conf, 0); | ||
4532 | read_more: | 4533 | read_more: |
4533 | /* Now schedule reads for blocks from sector_nr to last */ | 4534 | /* Now schedule reads for blocks from sector_nr to last */ |
4534 | r10_bio = raid10_alloc_init_r10buf(conf); | 4535 | r10_bio = raid10_alloc_init_r10buf(conf); |
4535 | r10_bio->state = 0; | 4536 | r10_bio->state = 0; |
4536 | raise_barrier(conf, sectors_done != 0); | 4537 | raise_barrier(conf, 1); |
4537 | atomic_set(&r10_bio->remaining, 0); | 4538 | atomic_set(&r10_bio->remaining, 0); |
4538 | r10_bio->mddev = mddev; | 4539 | r10_bio->mddev = mddev; |
4539 | r10_bio->sector = sector_nr; | 4540 | r10_bio->sector = sector_nr; |
@@ -4629,6 +4630,8 @@ read_more: | |||
4629 | if (sector_nr <= last) | 4630 | if (sector_nr <= last) |
4630 | goto read_more; | 4631 | goto read_more; |
4631 | 4632 | ||
4633 | lower_barrier(conf); | ||
4634 | |||
4632 | /* Now that we have done the whole section we can | 4635 | /* Now that we have done the whole section we can |
4633 | * update reshape_progress | 4636 | * update reshape_progress |
4634 | */ | 4637 | */ |
diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h index a001808a2b77..bfb811407061 100644 --- a/drivers/md/raid5-log.h +++ b/drivers/md/raid5-log.h | |||
@@ -46,6 +46,11 @@ extern int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add); | |||
46 | extern void ppl_quiesce(struct r5conf *conf, int quiesce); | 46 | extern void ppl_quiesce(struct r5conf *conf, int quiesce); |
47 | extern int ppl_handle_flush_request(struct r5l_log *log, struct bio *bio); | 47 | extern int ppl_handle_flush_request(struct r5l_log *log, struct bio *bio); |
48 | 48 | ||
49 | static inline bool raid5_has_log(struct r5conf *conf) | ||
50 | { | ||
51 | return test_bit(MD_HAS_JOURNAL, &conf->mddev->flags); | ||
52 | } | ||
53 | |||
49 | static inline bool raid5_has_ppl(struct r5conf *conf) | 54 | static inline bool raid5_has_ppl(struct r5conf *conf) |
50 | { | 55 | { |
51 | return test_bit(MD_HAS_PPL, &conf->mddev->flags); | 56 | return test_bit(MD_HAS_PPL, &conf->mddev->flags); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4ce0d7502fad..e4e98f47865d 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -733,7 +733,7 @@ static bool stripe_can_batch(struct stripe_head *sh) | |||
733 | { | 733 | { |
734 | struct r5conf *conf = sh->raid_conf; | 734 | struct r5conf *conf = sh->raid_conf; |
735 | 735 | ||
736 | if (conf->log || raid5_has_ppl(conf)) | 736 | if (raid5_has_log(conf) || raid5_has_ppl(conf)) |
737 | return false; | 737 | return false; |
738 | return test_bit(STRIPE_BATCH_READY, &sh->state) && | 738 | return test_bit(STRIPE_BATCH_READY, &sh->state) && |
739 | !test_bit(STRIPE_BITMAP_PENDING, &sh->state) && | 739 | !test_bit(STRIPE_BITMAP_PENDING, &sh->state) && |
@@ -7737,7 +7737,7 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors) | |||
7737 | sector_t newsize; | 7737 | sector_t newsize; |
7738 | struct r5conf *conf = mddev->private; | 7738 | struct r5conf *conf = mddev->private; |
7739 | 7739 | ||
7740 | if (conf->log || raid5_has_ppl(conf)) | 7740 | if (raid5_has_log(conf) || raid5_has_ppl(conf)) |
7741 | return -EINVAL; | 7741 | return -EINVAL; |
7742 | sectors &= ~((sector_t)conf->chunk_sectors - 1); | 7742 | sectors &= ~((sector_t)conf->chunk_sectors - 1); |
7743 | newsize = raid5_size(mddev, sectors, mddev->raid_disks); | 7743 | newsize = raid5_size(mddev, sectors, mddev->raid_disks); |
@@ -7788,7 +7788,7 @@ static int check_reshape(struct mddev *mddev) | |||
7788 | { | 7788 | { |
7789 | struct r5conf *conf = mddev->private; | 7789 | struct r5conf *conf = mddev->private; |
7790 | 7790 | ||
7791 | if (conf->log || raid5_has_ppl(conf)) | 7791 | if (raid5_has_log(conf) || raid5_has_ppl(conf)) |
7792 | return -EINVAL; | 7792 | return -EINVAL; |
7793 | if (mddev->delta_disks == 0 && | 7793 | if (mddev->delta_disks == 0 && |
7794 | mddev->new_layout == mddev->layout && | 7794 | mddev->new_layout == mddev->layout && |
diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index 31112f622b88..475e5b3790ed 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c | |||
@@ -411,7 +411,7 @@ static int aemif_probe(struct platform_device *pdev) | |||
411 | if (ret < 0) | 411 | if (ret < 0) |
412 | goto error; | 412 | goto error; |
413 | } | 413 | } |
414 | } else { | 414 | } else if (pdata) { |
415 | for (i = 0; i < pdata->num_sub_devices; i++) { | 415 | for (i = 0; i < pdata->num_sub_devices; i++) { |
416 | pdata->sub_devices[i].dev.parent = dev; | 416 | pdata->sub_devices[i].dev.parent = dev; |
417 | ret = platform_device_register(&pdata->sub_devices[i]); | 417 | ret = platform_device_register(&pdata->sub_devices[i]); |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 8bb1e38b1681..cecbb1d1f587 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -5913,12 +5913,12 @@ unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp) | |||
5913 | return bp->hw_resc.max_cp_rings; | 5913 | return bp->hw_resc.max_cp_rings; |
5914 | } | 5914 | } |
5915 | 5915 | ||
5916 | void bnxt_set_max_func_cp_rings(struct bnxt *bp, unsigned int max) | 5916 | unsigned int bnxt_get_max_func_cp_rings_for_en(struct bnxt *bp) |
5917 | { | 5917 | { |
5918 | bp->hw_resc.max_cp_rings = max; | 5918 | return bp->hw_resc.max_cp_rings - bnxt_get_ulp_msix_num(bp); |
5919 | } | 5919 | } |
5920 | 5920 | ||
5921 | unsigned int bnxt_get_max_func_irqs(struct bnxt *bp) | 5921 | static unsigned int bnxt_get_max_func_irqs(struct bnxt *bp) |
5922 | { | 5922 | { |
5923 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; | 5923 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; |
5924 | 5924 | ||
@@ -6684,6 +6684,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) | |||
6684 | hw_resc->resv_rx_rings = 0; | 6684 | hw_resc->resv_rx_rings = 0; |
6685 | hw_resc->resv_hw_ring_grps = 0; | 6685 | hw_resc->resv_hw_ring_grps = 0; |
6686 | hw_resc->resv_vnics = 0; | 6686 | hw_resc->resv_vnics = 0; |
6687 | bp->tx_nr_rings = 0; | ||
6688 | bp->rx_nr_rings = 0; | ||
6687 | } | 6689 | } |
6688 | return rc; | 6690 | return rc; |
6689 | } | 6691 | } |
@@ -8629,7 +8631,8 @@ static void _bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, | |||
8629 | 8631 | ||
8630 | *max_tx = hw_resc->max_tx_rings; | 8632 | *max_tx = hw_resc->max_tx_rings; |
8631 | *max_rx = hw_resc->max_rx_rings; | 8633 | *max_rx = hw_resc->max_rx_rings; |
8632 | *max_cp = min_t(int, hw_resc->max_irqs, hw_resc->max_cp_rings); | 8634 | *max_cp = min_t(int, bnxt_get_max_func_cp_rings_for_en(bp), |
8635 | hw_resc->max_irqs); | ||
8633 | *max_cp = min_t(int, *max_cp, hw_resc->max_stat_ctxs); | 8636 | *max_cp = min_t(int, *max_cp, hw_resc->max_stat_ctxs); |
8634 | max_ring_grps = hw_resc->max_hw_ring_grps; | 8637 | max_ring_grps = hw_resc->max_hw_ring_grps; |
8635 | if (BNXT_CHIP_TYPE_NITRO_A0(bp) && BNXT_PF(bp)) { | 8638 | if (BNXT_CHIP_TYPE_NITRO_A0(bp) && BNXT_PF(bp)) { |
@@ -8769,20 +8772,25 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp) | |||
8769 | if (bp->tx_nr_rings) | 8772 | if (bp->tx_nr_rings) |
8770 | return 0; | 8773 | return 0; |
8771 | 8774 | ||
8775 | bnxt_ulp_irq_stop(bp); | ||
8776 | bnxt_clear_int_mode(bp); | ||
8772 | rc = bnxt_set_dflt_rings(bp, true); | 8777 | rc = bnxt_set_dflt_rings(bp, true); |
8773 | if (rc) { | 8778 | if (rc) { |
8774 | netdev_err(bp->dev, "Not enough rings available.\n"); | 8779 | netdev_err(bp->dev, "Not enough rings available.\n"); |
8775 | return rc; | 8780 | goto init_dflt_ring_err; |
8776 | } | 8781 | } |
8777 | rc = bnxt_init_int_mode(bp); | 8782 | rc = bnxt_init_int_mode(bp); |
8778 | if (rc) | 8783 | if (rc) |
8779 | return rc; | 8784 | goto init_dflt_ring_err; |
8785 | |||
8780 | bp->tx_nr_rings_per_tc = bp->tx_nr_rings; | 8786 | bp->tx_nr_rings_per_tc = bp->tx_nr_rings; |
8781 | if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { | 8787 | if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { |
8782 | bp->flags |= BNXT_FLAG_RFS; | 8788 | bp->flags |= BNXT_FLAG_RFS; |
8783 | bp->dev->features |= NETIF_F_NTUPLE; | 8789 | bp->dev->features |= NETIF_F_NTUPLE; |
8784 | } | 8790 | } |
8785 | return 0; | 8791 | init_dflt_ring_err: |
8792 | bnxt_ulp_irq_restart(bp, rc); | ||
8793 | return rc; | ||
8786 | } | 8794 | } |
8787 | 8795 | ||
8788 | int bnxt_restore_pf_fw_resources(struct bnxt *bp) | 8796 | int bnxt_restore_pf_fw_resources(struct bnxt *bp) |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index fefa011320e0..bde384630a75 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h | |||
@@ -1481,8 +1481,7 @@ int bnxt_hwrm_set_coal(struct bnxt *); | |||
1481 | unsigned int bnxt_get_max_func_stat_ctxs(struct bnxt *bp); | 1481 | unsigned int bnxt_get_max_func_stat_ctxs(struct bnxt *bp); |
1482 | void bnxt_set_max_func_stat_ctxs(struct bnxt *bp, unsigned int max); | 1482 | void bnxt_set_max_func_stat_ctxs(struct bnxt *bp, unsigned int max); |
1483 | unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp); | 1483 | unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp); |
1484 | void bnxt_set_max_func_cp_rings(struct bnxt *bp, unsigned int max); | 1484 | unsigned int bnxt_get_max_func_cp_rings_for_en(struct bnxt *bp); |
1485 | unsigned int bnxt_get_max_func_irqs(struct bnxt *bp); | ||
1486 | int bnxt_get_avail_msix(struct bnxt *bp, int num); | 1485 | int bnxt_get_avail_msix(struct bnxt *bp, int num); |
1487 | int bnxt_reserve_rings(struct bnxt *bp); | 1486 | int bnxt_reserve_rings(struct bnxt *bp); |
1488 | void bnxt_tx_disable(struct bnxt *bp); | 1487 | void bnxt_tx_disable(struct bnxt *bp); |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c index 6d583bcd2a81..fcd085a9853a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | |||
@@ -451,7 +451,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs) | |||
451 | 451 | ||
452 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESOURCE_CFG, -1, -1); | 452 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESOURCE_CFG, -1, -1); |
453 | 453 | ||
454 | vf_cp_rings = hw_resc->max_cp_rings - bp->cp_nr_rings; | 454 | vf_cp_rings = bnxt_get_max_func_cp_rings_for_en(bp) - bp->cp_nr_rings; |
455 | vf_stat_ctx = hw_resc->max_stat_ctxs - bp->num_stat_ctxs; | 455 | vf_stat_ctx = hw_resc->max_stat_ctxs - bp->num_stat_ctxs; |
456 | if (bp->flags & BNXT_FLAG_AGG_RINGS) | 456 | if (bp->flags & BNXT_FLAG_AGG_RINGS) |
457 | vf_rx_rings = hw_resc->max_rx_rings - bp->rx_nr_rings * 2; | 457 | vf_rx_rings = hw_resc->max_rx_rings - bp->rx_nr_rings * 2; |
@@ -549,7 +549,8 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) | |||
549 | max_stat_ctxs = hw_resc->max_stat_ctxs; | 549 | max_stat_ctxs = hw_resc->max_stat_ctxs; |
550 | 550 | ||
551 | /* Remaining rings are distributed equally amongs VF's for now */ | 551 | /* Remaining rings are distributed equally amongs VF's for now */ |
552 | vf_cp_rings = (hw_resc->max_cp_rings - bp->cp_nr_rings) / num_vfs; | 552 | vf_cp_rings = (bnxt_get_max_func_cp_rings_for_en(bp) - |
553 | bp->cp_nr_rings) / num_vfs; | ||
553 | vf_stat_ctx = (max_stat_ctxs - bp->num_stat_ctxs) / num_vfs; | 554 | vf_stat_ctx = (max_stat_ctxs - bp->num_stat_ctxs) / num_vfs; |
554 | if (bp->flags & BNXT_FLAG_AGG_RINGS) | 555 | if (bp->flags & BNXT_FLAG_AGG_RINGS) |
555 | vf_rx_rings = (hw_resc->max_rx_rings - bp->rx_nr_rings * 2) / | 556 | vf_rx_rings = (hw_resc->max_rx_rings - bp->rx_nr_rings * 2) / |
@@ -643,7 +644,7 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) | |||
643 | */ | 644 | */ |
644 | vfs_supported = *num_vfs; | 645 | vfs_supported = *num_vfs; |
645 | 646 | ||
646 | avail_cp = hw_resc->max_cp_rings - bp->cp_nr_rings; | 647 | avail_cp = bnxt_get_max_func_cp_rings_for_en(bp) - bp->cp_nr_rings; |
647 | avail_stat = hw_resc->max_stat_ctxs - bp->num_stat_ctxs; | 648 | avail_stat = hw_resc->max_stat_ctxs - bp->num_stat_ctxs; |
648 | avail_cp = min_t(int, avail_cp, avail_stat); | 649 | avail_cp = min_t(int, avail_cp, avail_stat); |
649 | 650 | ||
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index c37b2842f972..beee61292d5e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | |||
@@ -169,7 +169,6 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id, | |||
169 | edev->ulp_tbl[ulp_id].msix_requested = avail_msix; | 169 | edev->ulp_tbl[ulp_id].msix_requested = avail_msix; |
170 | } | 170 | } |
171 | bnxt_fill_msix_vecs(bp, ent); | 171 | bnxt_fill_msix_vecs(bp, ent); |
172 | bnxt_set_max_func_cp_rings(bp, max_cp_rings - avail_msix); | ||
173 | edev->flags |= BNXT_EN_FLAG_MSIX_REQUESTED; | 172 | edev->flags |= BNXT_EN_FLAG_MSIX_REQUESTED; |
174 | return avail_msix; | 173 | return avail_msix; |
175 | } | 174 | } |
@@ -178,7 +177,6 @@ static int bnxt_free_msix_vecs(struct bnxt_en_dev *edev, int ulp_id) | |||
178 | { | 177 | { |
179 | struct net_device *dev = edev->net; | 178 | struct net_device *dev = edev->net; |
180 | struct bnxt *bp = netdev_priv(dev); | 179 | struct bnxt *bp = netdev_priv(dev); |
181 | int max_cp_rings, msix_requested; | ||
182 | 180 | ||
183 | ASSERT_RTNL(); | 181 | ASSERT_RTNL(); |
184 | if (ulp_id != BNXT_ROCE_ULP) | 182 | if (ulp_id != BNXT_ROCE_ULP) |
@@ -187,9 +185,6 @@ static int bnxt_free_msix_vecs(struct bnxt_en_dev *edev, int ulp_id) | |||
187 | if (!(edev->flags & BNXT_EN_FLAG_MSIX_REQUESTED)) | 185 | if (!(edev->flags & BNXT_EN_FLAG_MSIX_REQUESTED)) |
188 | return 0; | 186 | return 0; |
189 | 187 | ||
190 | max_cp_rings = bnxt_get_max_func_cp_rings(bp); | ||
191 | msix_requested = edev->ulp_tbl[ulp_id].msix_requested; | ||
192 | bnxt_set_max_func_cp_rings(bp, max_cp_rings + msix_requested); | ||
193 | edev->ulp_tbl[ulp_id].msix_requested = 0; | 188 | edev->ulp_tbl[ulp_id].msix_requested = 0; |
194 | edev->flags &= ~BNXT_EN_FLAG_MSIX_REQUESTED; | 189 | edev->flags &= ~BNXT_EN_FLAG_MSIX_REQUESTED; |
195 | if (netif_running(dev)) { | 190 | if (netif_running(dev)) { |
@@ -220,21 +215,6 @@ int bnxt_get_ulp_msix_base(struct bnxt *bp) | |||
220 | return 0; | 215 | return 0; |
221 | } | 216 | } |
222 | 217 | ||
223 | void bnxt_subtract_ulp_resources(struct bnxt *bp, int ulp_id) | ||
224 | { | ||
225 | ASSERT_RTNL(); | ||
226 | if (bnxt_ulp_registered(bp->edev, ulp_id)) { | ||
227 | struct bnxt_en_dev *edev = bp->edev; | ||
228 | unsigned int msix_req, max; | ||
229 | |||
230 | msix_req = edev->ulp_tbl[ulp_id].msix_requested; | ||
231 | max = bnxt_get_max_func_cp_rings(bp); | ||
232 | bnxt_set_max_func_cp_rings(bp, max - msix_req); | ||
233 | max = bnxt_get_max_func_stat_ctxs(bp); | ||
234 | bnxt_set_max_func_stat_ctxs(bp, max - 1); | ||
235 | } | ||
236 | } | ||
237 | |||
238 | static int bnxt_send_msg(struct bnxt_en_dev *edev, int ulp_id, | 218 | static int bnxt_send_msg(struct bnxt_en_dev *edev, int ulp_id, |
239 | struct bnxt_fw_msg *fw_msg) | 219 | struct bnxt_fw_msg *fw_msg) |
240 | { | 220 | { |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index df48ac71729f..d9bea37cd211 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | |||
@@ -90,7 +90,6 @@ static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev, int ulp_id) | |||
90 | 90 | ||
91 | int bnxt_get_ulp_msix_num(struct bnxt *bp); | 91 | int bnxt_get_ulp_msix_num(struct bnxt *bp); |
92 | int bnxt_get_ulp_msix_base(struct bnxt *bp); | 92 | int bnxt_get_ulp_msix_base(struct bnxt *bp); |
93 | void bnxt_subtract_ulp_resources(struct bnxt *bp, int ulp_id); | ||
94 | void bnxt_ulp_stop(struct bnxt *bp); | 93 | void bnxt_ulp_stop(struct bnxt *bp); |
95 | void bnxt_ulp_start(struct bnxt *bp); | 94 | void bnxt_ulp_start(struct bnxt *bp); |
96 | void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs); | 95 | void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index b773bc07edf7..14b49612aa86 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | |||
@@ -186,6 +186,9 @@ struct bcmgenet_mib_counters { | |||
186 | #define UMAC_MAC1 0x010 | 186 | #define UMAC_MAC1 0x010 |
187 | #define UMAC_MAX_FRAME_LEN 0x014 | 187 | #define UMAC_MAX_FRAME_LEN 0x014 |
188 | 188 | ||
189 | #define UMAC_MODE 0x44 | ||
190 | #define MODE_LINK_STATUS (1 << 5) | ||
191 | |||
189 | #define UMAC_EEE_CTRL 0x064 | 192 | #define UMAC_EEE_CTRL 0x064 |
190 | #define EN_LPI_RX_PAUSE (1 << 0) | 193 | #define EN_LPI_RX_PAUSE (1 << 0) |
191 | #define EN_LPI_TX_PFC (1 << 1) | 194 | #define EN_LPI_TX_PFC (1 << 1) |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 5333274a283c..4241ae928d4a 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c | |||
@@ -115,8 +115,14 @@ void bcmgenet_mii_setup(struct net_device *dev) | |||
115 | static int bcmgenet_fixed_phy_link_update(struct net_device *dev, | 115 | static int bcmgenet_fixed_phy_link_update(struct net_device *dev, |
116 | struct fixed_phy_status *status) | 116 | struct fixed_phy_status *status) |
117 | { | 117 | { |
118 | if (dev && dev->phydev && status) | 118 | struct bcmgenet_priv *priv; |
119 | status->link = dev->phydev->link; | 119 | u32 reg; |
120 | |||
121 | if (dev && dev->phydev && status) { | ||
122 | priv = netdev_priv(dev); | ||
123 | reg = bcmgenet_umac_readl(priv, UMAC_MODE); | ||
124 | status->link = !!(reg & MODE_LINK_STATUS); | ||
125 | } | ||
120 | 126 | ||
121 | return 0; | 127 | return 0; |
122 | } | 128 | } |
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index c6707ea2d751..16e4ef7d7185 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c | |||
@@ -649,7 +649,7 @@ static int macb_halt_tx(struct macb *bp) | |||
649 | if (!(status & MACB_BIT(TGO))) | 649 | if (!(status & MACB_BIT(TGO))) |
650 | return 0; | 650 | return 0; |
651 | 651 | ||
652 | usleep_range(10, 250); | 652 | udelay(250); |
653 | } while (time_before(halt_time, timeout)); | 653 | } while (time_before(halt_time, timeout)); |
654 | 654 | ||
655 | return -ETIMEDOUT; | 655 | return -ETIMEDOUT; |
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h index cad52bd331f7..08a750fb60c4 100644 --- a/drivers/net/ethernet/hisilicon/hns/hnae.h +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h | |||
@@ -486,6 +486,8 @@ struct hnae_ae_ops { | |||
486 | u8 *auto_neg, u16 *speed, u8 *duplex); | 486 | u8 *auto_neg, u16 *speed, u8 *duplex); |
487 | void (*toggle_ring_irq)(struct hnae_ring *ring, u32 val); | 487 | void (*toggle_ring_irq)(struct hnae_ring *ring, u32 val); |
488 | void (*adjust_link)(struct hnae_handle *handle, int speed, int duplex); | 488 | void (*adjust_link)(struct hnae_handle *handle, int speed, int duplex); |
489 | bool (*need_adjust_link)(struct hnae_handle *handle, | ||
490 | int speed, int duplex); | ||
489 | int (*set_loopback)(struct hnae_handle *handle, | 491 | int (*set_loopback)(struct hnae_handle *handle, |
490 | enum hnae_loop loop_mode, int en); | 492 | enum hnae_loop loop_mode, int en); |
491 | void (*get_ring_bdnum_limit)(struct hnae_queue *queue, | 493 | void (*get_ring_bdnum_limit)(struct hnae_queue *queue, |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c index e6aad30e7e69..b52029e26d15 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | |||
@@ -155,6 +155,41 @@ static void hns_ae_put_handle(struct hnae_handle *handle) | |||
155 | hns_ae_get_ring_pair(handle->qs[i])->used_by_vf = 0; | 155 | hns_ae_get_ring_pair(handle->qs[i])->used_by_vf = 0; |
156 | } | 156 | } |
157 | 157 | ||
158 | static int hns_ae_wait_flow_down(struct hnae_handle *handle) | ||
159 | { | ||
160 | struct dsaf_device *dsaf_dev; | ||
161 | struct hns_ppe_cb *ppe_cb; | ||
162 | struct hnae_vf_cb *vf_cb; | ||
163 | int ret; | ||
164 | int i; | ||
165 | |||
166 | for (i = 0; i < handle->q_num; i++) { | ||
167 | ret = hns_rcb_wait_tx_ring_clean(handle->qs[i]); | ||
168 | if (ret) | ||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | ppe_cb = hns_get_ppe_cb(handle); | ||
173 | ret = hns_ppe_wait_tx_fifo_clean(ppe_cb); | ||
174 | if (ret) | ||
175 | return ret; | ||
176 | |||
177 | dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); | ||
178 | if (!dsaf_dev) | ||
179 | return -EINVAL; | ||
180 | ret = hns_dsaf_wait_pkt_clean(dsaf_dev, handle->dport_id); | ||
181 | if (ret) | ||
182 | return ret; | ||
183 | |||
184 | vf_cb = hns_ae_get_vf_cb(handle); | ||
185 | ret = hns_mac_wait_fifo_clean(vf_cb->mac_cb); | ||
186 | if (ret) | ||
187 | return ret; | ||
188 | |||
189 | mdelay(10); | ||
190 | return 0; | ||
191 | } | ||
192 | |||
158 | static void hns_ae_ring_enable_all(struct hnae_handle *handle, int val) | 193 | static void hns_ae_ring_enable_all(struct hnae_handle *handle, int val) |
159 | { | 194 | { |
160 | int q_num = handle->q_num; | 195 | int q_num = handle->q_num; |
@@ -399,12 +434,41 @@ static int hns_ae_get_mac_info(struct hnae_handle *handle, | |||
399 | return hns_mac_get_port_info(mac_cb, auto_neg, speed, duplex); | 434 | return hns_mac_get_port_info(mac_cb, auto_neg, speed, duplex); |
400 | } | 435 | } |
401 | 436 | ||
437 | static bool hns_ae_need_adjust_link(struct hnae_handle *handle, int speed, | ||
438 | int duplex) | ||
439 | { | ||
440 | struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); | ||
441 | |||
442 | return hns_mac_need_adjust_link(mac_cb, speed, duplex); | ||
443 | } | ||
444 | |||
402 | static void hns_ae_adjust_link(struct hnae_handle *handle, int speed, | 445 | static void hns_ae_adjust_link(struct hnae_handle *handle, int speed, |
403 | int duplex) | 446 | int duplex) |
404 | { | 447 | { |
405 | struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); | 448 | struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); |
406 | 449 | ||
407 | hns_mac_adjust_link(mac_cb, speed, duplex); | 450 | switch (mac_cb->dsaf_dev->dsaf_ver) { |
451 | case AE_VERSION_1: | ||
452 | hns_mac_adjust_link(mac_cb, speed, duplex); | ||
453 | break; | ||
454 | |||
455 | case AE_VERSION_2: | ||
456 | /* chip need to clear all pkt inside */ | ||
457 | hns_mac_disable(mac_cb, MAC_COMM_MODE_RX); | ||
458 | if (hns_ae_wait_flow_down(handle)) { | ||
459 | hns_mac_enable(mac_cb, MAC_COMM_MODE_RX); | ||
460 | break; | ||
461 | } | ||
462 | |||
463 | hns_mac_adjust_link(mac_cb, speed, duplex); | ||
464 | hns_mac_enable(mac_cb, MAC_COMM_MODE_RX); | ||
465 | break; | ||
466 | |||
467 | default: | ||
468 | break; | ||
469 | } | ||
470 | |||
471 | return; | ||
408 | } | 472 | } |
409 | 473 | ||
410 | static void hns_ae_get_ring_bdnum_limit(struct hnae_queue *queue, | 474 | static void hns_ae_get_ring_bdnum_limit(struct hnae_queue *queue, |
@@ -902,6 +966,7 @@ static struct hnae_ae_ops hns_dsaf_ops = { | |||
902 | .get_status = hns_ae_get_link_status, | 966 | .get_status = hns_ae_get_link_status, |
903 | .get_info = hns_ae_get_mac_info, | 967 | .get_info = hns_ae_get_mac_info, |
904 | .adjust_link = hns_ae_adjust_link, | 968 | .adjust_link = hns_ae_adjust_link, |
969 | .need_adjust_link = hns_ae_need_adjust_link, | ||
905 | .set_loopback = hns_ae_config_loopback, | 970 | .set_loopback = hns_ae_config_loopback, |
906 | .get_ring_bdnum_limit = hns_ae_get_ring_bdnum_limit, | 971 | .get_ring_bdnum_limit = hns_ae_get_ring_bdnum_limit, |
907 | .get_pauseparam = hns_ae_get_pauseparam, | 972 | .get_pauseparam = hns_ae_get_pauseparam, |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c index 5488c6e89f21..09e4061d1fa6 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | |||
@@ -257,6 +257,16 @@ static void hns_gmac_get_pausefrm_cfg(void *mac_drv, u32 *rx_pause_en, | |||
257 | *tx_pause_en = dsaf_get_bit(pause_en, GMAC_PAUSE_EN_TX_FDFC_B); | 257 | *tx_pause_en = dsaf_get_bit(pause_en, GMAC_PAUSE_EN_TX_FDFC_B); |
258 | } | 258 | } |
259 | 259 | ||
260 | static bool hns_gmac_need_adjust_link(void *mac_drv, enum mac_speed speed, | ||
261 | int duplex) | ||
262 | { | ||
263 | struct mac_driver *drv = (struct mac_driver *)mac_drv; | ||
264 | struct hns_mac_cb *mac_cb = drv->mac_cb; | ||
265 | |||
266 | return (mac_cb->speed != speed) || | ||
267 | (mac_cb->half_duplex == duplex); | ||
268 | } | ||
269 | |||
260 | static int hns_gmac_adjust_link(void *mac_drv, enum mac_speed speed, | 270 | static int hns_gmac_adjust_link(void *mac_drv, enum mac_speed speed, |
261 | u32 full_duplex) | 271 | u32 full_duplex) |
262 | { | 272 | { |
@@ -309,6 +319,30 @@ static void hns_gmac_set_promisc(void *mac_drv, u8 en) | |||
309 | hns_gmac_set_uc_match(mac_drv, en); | 319 | hns_gmac_set_uc_match(mac_drv, en); |
310 | } | 320 | } |
311 | 321 | ||
322 | int hns_gmac_wait_fifo_clean(void *mac_drv) | ||
323 | { | ||
324 | struct mac_driver *drv = (struct mac_driver *)mac_drv; | ||
325 | int wait_cnt; | ||
326 | u32 val; | ||
327 | |||
328 | wait_cnt = 0; | ||
329 | while (wait_cnt++ < HNS_MAX_WAIT_CNT) { | ||
330 | val = dsaf_read_dev(drv, GMAC_FIFO_STATE_REG); | ||
331 | /* bit5~bit0 is not send complete pkts */ | ||
332 | if ((val & 0x3f) == 0) | ||
333 | break; | ||
334 | usleep_range(100, 200); | ||
335 | } | ||
336 | |||
337 | if (wait_cnt >= HNS_MAX_WAIT_CNT) { | ||
338 | dev_err(drv->dev, | ||
339 | "hns ge %d fifo was not idle.\n", drv->mac_id); | ||
340 | return -EBUSY; | ||
341 | } | ||
342 | |||
343 | return 0; | ||
344 | } | ||
345 | |||
312 | static void hns_gmac_init(void *mac_drv) | 346 | static void hns_gmac_init(void *mac_drv) |
313 | { | 347 | { |
314 | u32 port; | 348 | u32 port; |
@@ -690,6 +724,7 @@ void *hns_gmac_config(struct hns_mac_cb *mac_cb, struct mac_params *mac_param) | |||
690 | mac_drv->mac_disable = hns_gmac_disable; | 724 | mac_drv->mac_disable = hns_gmac_disable; |
691 | mac_drv->mac_free = hns_gmac_free; | 725 | mac_drv->mac_free = hns_gmac_free; |
692 | mac_drv->adjust_link = hns_gmac_adjust_link; | 726 | mac_drv->adjust_link = hns_gmac_adjust_link; |
727 | mac_drv->need_adjust_link = hns_gmac_need_adjust_link; | ||
693 | mac_drv->set_tx_auto_pause_frames = hns_gmac_set_tx_auto_pause_frames; | 728 | mac_drv->set_tx_auto_pause_frames = hns_gmac_set_tx_auto_pause_frames; |
694 | mac_drv->config_max_frame_length = hns_gmac_config_max_frame_length; | 729 | mac_drv->config_max_frame_length = hns_gmac_config_max_frame_length; |
695 | mac_drv->mac_pausefrm_cfg = hns_gmac_pause_frm_cfg; | 730 | mac_drv->mac_pausefrm_cfg = hns_gmac_pause_frm_cfg; |
@@ -717,6 +752,7 @@ void *hns_gmac_config(struct hns_mac_cb *mac_cb, struct mac_params *mac_param) | |||
717 | mac_drv->get_strings = hns_gmac_get_strings; | 752 | mac_drv->get_strings = hns_gmac_get_strings; |
718 | mac_drv->update_stats = hns_gmac_update_stats; | 753 | mac_drv->update_stats = hns_gmac_update_stats; |
719 | mac_drv->set_promiscuous = hns_gmac_set_promisc; | 754 | mac_drv->set_promiscuous = hns_gmac_set_promisc; |
755 | mac_drv->wait_fifo_clean = hns_gmac_wait_fifo_clean; | ||
720 | 756 | ||
721 | return (void *)mac_drv; | 757 | return (void *)mac_drv; |
722 | } | 758 | } |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c index 1c2326bd76e2..6ed6f142427e 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | |||
@@ -114,6 +114,26 @@ int hns_mac_get_port_info(struct hns_mac_cb *mac_cb, | |||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
117 | /** | ||
118 | *hns_mac_is_adjust_link - check is need change mac speed and duplex register | ||
119 | *@mac_cb: mac device | ||
120 | *@speed: phy device speed | ||
121 | *@duplex:phy device duplex | ||
122 | * | ||
123 | */ | ||
124 | bool hns_mac_need_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex) | ||
125 | { | ||
126 | struct mac_driver *mac_ctrl_drv; | ||
127 | |||
128 | mac_ctrl_drv = (struct mac_driver *)(mac_cb->priv.mac); | ||
129 | |||
130 | if (mac_ctrl_drv->need_adjust_link) | ||
131 | return mac_ctrl_drv->need_adjust_link(mac_ctrl_drv, | ||
132 | (enum mac_speed)speed, duplex); | ||
133 | else | ||
134 | return true; | ||
135 | } | ||
136 | |||
117 | void hns_mac_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex) | 137 | void hns_mac_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex) |
118 | { | 138 | { |
119 | int ret; | 139 | int ret; |
@@ -430,6 +450,16 @@ int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, bool enable) | |||
430 | return 0; | 450 | return 0; |
431 | } | 451 | } |
432 | 452 | ||
453 | int hns_mac_wait_fifo_clean(struct hns_mac_cb *mac_cb) | ||
454 | { | ||
455 | struct mac_driver *drv = hns_mac_get_drv(mac_cb); | ||
456 | |||
457 | if (drv->wait_fifo_clean) | ||
458 | return drv->wait_fifo_clean(drv); | ||
459 | |||
460 | return 0; | ||
461 | } | ||
462 | |||
433 | void hns_mac_reset(struct hns_mac_cb *mac_cb) | 463 | void hns_mac_reset(struct hns_mac_cb *mac_cb) |
434 | { | 464 | { |
435 | struct mac_driver *drv = hns_mac_get_drv(mac_cb); | 465 | struct mac_driver *drv = hns_mac_get_drv(mac_cb); |
@@ -998,6 +1028,20 @@ static int hns_mac_get_max_port_num(struct dsaf_device *dsaf_dev) | |||
998 | return DSAF_MAX_PORT_NUM; | 1028 | return DSAF_MAX_PORT_NUM; |
999 | } | 1029 | } |
1000 | 1030 | ||
1031 | void hns_mac_enable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode) | ||
1032 | { | ||
1033 | struct mac_driver *mac_ctrl_drv = hns_mac_get_drv(mac_cb); | ||
1034 | |||
1035 | mac_ctrl_drv->mac_enable(mac_cb->priv.mac, mode); | ||
1036 | } | ||
1037 | |||
1038 | void hns_mac_disable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode) | ||
1039 | { | ||
1040 | struct mac_driver *mac_ctrl_drv = hns_mac_get_drv(mac_cb); | ||
1041 | |||
1042 | mac_ctrl_drv->mac_disable(mac_cb->priv.mac, mode); | ||
1043 | } | ||
1044 | |||
1001 | /** | 1045 | /** |
1002 | * hns_mac_init - init mac | 1046 | * hns_mac_init - init mac |
1003 | * @dsaf_dev: dsa fabric device struct pointer | 1047 | * @dsaf_dev: dsa fabric device struct pointer |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h index bbc0a98e7ca3..fbc75341bef7 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | |||
@@ -356,6 +356,9 @@ struct mac_driver { | |||
356 | /*adjust mac mode of port,include speed and duplex*/ | 356 | /*adjust mac mode of port,include speed and duplex*/ |
357 | int (*adjust_link)(void *mac_drv, enum mac_speed speed, | 357 | int (*adjust_link)(void *mac_drv, enum mac_speed speed, |
358 | u32 full_duplex); | 358 | u32 full_duplex); |
359 | /* need adjust link */ | ||
360 | bool (*need_adjust_link)(void *mac_drv, enum mac_speed speed, | ||
361 | int duplex); | ||
359 | /* config autoegotaite mode of port*/ | 362 | /* config autoegotaite mode of port*/ |
360 | void (*set_an_mode)(void *mac_drv, u8 enable); | 363 | void (*set_an_mode)(void *mac_drv, u8 enable); |
361 | /* config loopbank mode */ | 364 | /* config loopbank mode */ |
@@ -394,6 +397,7 @@ struct mac_driver { | |||
394 | void (*get_info)(void *mac_drv, struct mac_info *mac_info); | 397 | void (*get_info)(void *mac_drv, struct mac_info *mac_info); |
395 | 398 | ||
396 | void (*update_stats)(void *mac_drv); | 399 | void (*update_stats)(void *mac_drv); |
400 | int (*wait_fifo_clean)(void *mac_drv); | ||
397 | 401 | ||
398 | enum mac_mode mac_mode; | 402 | enum mac_mode mac_mode; |
399 | u8 mac_id; | 403 | u8 mac_id; |
@@ -427,6 +431,7 @@ void *hns_xgmac_config(struct hns_mac_cb *mac_cb, | |||
427 | 431 | ||
428 | int hns_mac_init(struct dsaf_device *dsaf_dev); | 432 | int hns_mac_init(struct dsaf_device *dsaf_dev); |
429 | void mac_adjust_link(struct net_device *net_dev); | 433 | void mac_adjust_link(struct net_device *net_dev); |
434 | bool hns_mac_need_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex); | ||
430 | void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status); | 435 | void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status); |
431 | int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid, char *addr); | 436 | int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid, char *addr); |
432 | int hns_mac_set_multi(struct hns_mac_cb *mac_cb, | 437 | int hns_mac_set_multi(struct hns_mac_cb *mac_cb, |
@@ -463,5 +468,8 @@ int hns_mac_add_uc_addr(struct hns_mac_cb *mac_cb, u8 vf_id, | |||
463 | int hns_mac_rm_uc_addr(struct hns_mac_cb *mac_cb, u8 vf_id, | 468 | int hns_mac_rm_uc_addr(struct hns_mac_cb *mac_cb, u8 vf_id, |
464 | const unsigned char *addr); | 469 | const unsigned char *addr); |
465 | int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn); | 470 | int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn); |
471 | void hns_mac_enable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode); | ||
472 | void hns_mac_disable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode); | ||
473 | int hns_mac_wait_fifo_clean(struct hns_mac_cb *mac_cb); | ||
466 | 474 | ||
467 | #endif /* _HNS_DSAF_MAC_H */ | 475 | #endif /* _HNS_DSAF_MAC_H */ |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c index ca50c2553a9c..e557a4ef5996 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | |||
@@ -2727,6 +2727,35 @@ void hns_dsaf_set_promisc_tcam(struct dsaf_device *dsaf_dev, | |||
2727 | soft_mac_entry->index = enable ? entry_index : DSAF_INVALID_ENTRY_IDX; | 2727 | soft_mac_entry->index = enable ? entry_index : DSAF_INVALID_ENTRY_IDX; |
2728 | } | 2728 | } |
2729 | 2729 | ||
2730 | int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port) | ||
2731 | { | ||
2732 | u32 val, val_tmp; | ||
2733 | int wait_cnt; | ||
2734 | |||
2735 | if (port >= DSAF_SERVICE_NW_NUM) | ||
2736 | return 0; | ||
2737 | |||
2738 | wait_cnt = 0; | ||
2739 | while (wait_cnt++ < HNS_MAX_WAIT_CNT) { | ||
2740 | val = dsaf_read_dev(dsaf_dev, DSAF_VOQ_IN_PKT_NUM_0_REG + | ||
2741 | (port + DSAF_XGE_NUM) * 0x40); | ||
2742 | val_tmp = dsaf_read_dev(dsaf_dev, DSAF_VOQ_OUT_PKT_NUM_0_REG + | ||
2743 | (port + DSAF_XGE_NUM) * 0x40); | ||
2744 | if (val == val_tmp) | ||
2745 | break; | ||
2746 | |||
2747 | usleep_range(100, 200); | ||
2748 | } | ||
2749 | |||
2750 | if (wait_cnt >= HNS_MAX_WAIT_CNT) { | ||
2751 | dev_err(dsaf_dev->dev, "hns dsaf clean wait timeout(%u - %u).\n", | ||
2752 | val, val_tmp); | ||
2753 | return -EBUSY; | ||
2754 | } | ||
2755 | |||
2756 | return 0; | ||
2757 | } | ||
2758 | |||
2730 | /** | 2759 | /** |
2731 | * dsaf_probe - probo dsaf dev | 2760 | * dsaf_probe - probo dsaf dev |
2732 | * @pdev: dasf platform device | 2761 | * @pdev: dasf platform device |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h index 4507e8222683..0e1cd99831a6 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | |||
@@ -44,6 +44,8 @@ struct hns_mac_cb; | |||
44 | #define DSAF_ROCE_CREDIT_CHN 8 | 44 | #define DSAF_ROCE_CREDIT_CHN 8 |
45 | #define DSAF_ROCE_CHAN_MODE 3 | 45 | #define DSAF_ROCE_CHAN_MODE 3 |
46 | 46 | ||
47 | #define HNS_MAX_WAIT_CNT 10000 | ||
48 | |||
47 | enum dsaf_roce_port_mode { | 49 | enum dsaf_roce_port_mode { |
48 | DSAF_ROCE_6PORT_MODE, | 50 | DSAF_ROCE_6PORT_MODE, |
49 | DSAF_ROCE_4PORT_MODE, | 51 | DSAF_ROCE_4PORT_MODE, |
@@ -463,5 +465,6 @@ int hns_dsaf_rm_mac_addr( | |||
463 | 465 | ||
464 | int hns_dsaf_clr_mac_mc_port(struct dsaf_device *dsaf_dev, | 466 | int hns_dsaf_clr_mac_mc_port(struct dsaf_device *dsaf_dev, |
465 | u8 mac_id, u8 port_num); | 467 | u8 mac_id, u8 port_num); |
468 | int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port); | ||
466 | 469 | ||
467 | #endif /* __HNS_DSAF_MAIN_H__ */ | 470 | #endif /* __HNS_DSAF_MAIN_H__ */ |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c index d160d8c9e45b..0942e4916d9d 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c | |||
@@ -275,6 +275,29 @@ static void hns_ppe_exc_irq_en(struct hns_ppe_cb *ppe_cb, int en) | |||
275 | dsaf_write_dev(ppe_cb, PPE_INTEN_REG, msk_vlue & vld_msk); | 275 | dsaf_write_dev(ppe_cb, PPE_INTEN_REG, msk_vlue & vld_msk); |
276 | } | 276 | } |
277 | 277 | ||
278 | int hns_ppe_wait_tx_fifo_clean(struct hns_ppe_cb *ppe_cb) | ||
279 | { | ||
280 | int wait_cnt; | ||
281 | u32 val; | ||
282 | |||
283 | wait_cnt = 0; | ||
284 | while (wait_cnt++ < HNS_MAX_WAIT_CNT) { | ||
285 | val = dsaf_read_dev(ppe_cb, PPE_CURR_TX_FIFO0_REG) & 0x3ffU; | ||
286 | if (!val) | ||
287 | break; | ||
288 | |||
289 | usleep_range(100, 200); | ||
290 | } | ||
291 | |||
292 | if (wait_cnt >= HNS_MAX_WAIT_CNT) { | ||
293 | dev_err(ppe_cb->dev, "hns ppe tx fifo clean wait timeout, still has %u pkt.\n", | ||
294 | val); | ||
295 | return -EBUSY; | ||
296 | } | ||
297 | |||
298 | return 0; | ||
299 | } | ||
300 | |||
278 | /** | 301 | /** |
279 | * ppe_init_hw - init ppe | 302 | * ppe_init_hw - init ppe |
280 | * @ppe_cb: ppe device | 303 | * @ppe_cb: ppe device |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h index 9d8e643e8aa6..f670e63a5a01 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h | |||
@@ -100,6 +100,7 @@ struct ppe_common_cb { | |||
100 | 100 | ||
101 | }; | 101 | }; |
102 | 102 | ||
103 | int hns_ppe_wait_tx_fifo_clean(struct hns_ppe_cb *ppe_cb); | ||
103 | int hns_ppe_init(struct dsaf_device *dsaf_dev); | 104 | int hns_ppe_init(struct dsaf_device *dsaf_dev); |
104 | 105 | ||
105 | void hns_ppe_uninit(struct dsaf_device *dsaf_dev); | 106 | void hns_ppe_uninit(struct dsaf_device *dsaf_dev); |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c index 9d76e2e54f9d..5d64519b9b1d 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | |||
@@ -66,6 +66,29 @@ void hns_rcb_wait_fbd_clean(struct hnae_queue **qs, int q_num, u32 flag) | |||
66 | "queue(%d) wait fbd(%d) clean fail!!\n", i, fbd_num); | 66 | "queue(%d) wait fbd(%d) clean fail!!\n", i, fbd_num); |
67 | } | 67 | } |
68 | 68 | ||
69 | int hns_rcb_wait_tx_ring_clean(struct hnae_queue *qs) | ||
70 | { | ||
71 | u32 head, tail; | ||
72 | int wait_cnt; | ||
73 | |||
74 | tail = dsaf_read_dev(&qs->tx_ring, RCB_REG_TAIL); | ||
75 | wait_cnt = 0; | ||
76 | while (wait_cnt++ < HNS_MAX_WAIT_CNT) { | ||
77 | head = dsaf_read_dev(&qs->tx_ring, RCB_REG_HEAD); | ||
78 | if (tail == head) | ||
79 | break; | ||
80 | |||
81 | usleep_range(100, 200); | ||
82 | } | ||
83 | |||
84 | if (wait_cnt >= HNS_MAX_WAIT_CNT) { | ||
85 | dev_err(qs->dev->dev, "rcb wait timeout, head not equal to tail.\n"); | ||
86 | return -EBUSY; | ||
87 | } | ||
88 | |||
89 | return 0; | ||
90 | } | ||
91 | |||
69 | /** | 92 | /** |
70 | *hns_rcb_reset_ring_hw - ring reset | 93 | *hns_rcb_reset_ring_hw - ring reset |
71 | *@q: ring struct pointer | 94 | *@q: ring struct pointer |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h index 602816498c8d..2319b772a271 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h | |||
@@ -136,6 +136,7 @@ void hns_rcbv2_int_clr_hw(struct hnae_queue *q, u32 flag); | |||
136 | void hns_rcb_init_hw(struct ring_pair_cb *ring); | 136 | void hns_rcb_init_hw(struct ring_pair_cb *ring); |
137 | void hns_rcb_reset_ring_hw(struct hnae_queue *q); | 137 | void hns_rcb_reset_ring_hw(struct hnae_queue *q); |
138 | void hns_rcb_wait_fbd_clean(struct hnae_queue **qs, int q_num, u32 flag); | 138 | void hns_rcb_wait_fbd_clean(struct hnae_queue **qs, int q_num, u32 flag); |
139 | int hns_rcb_wait_tx_ring_clean(struct hnae_queue *qs); | ||
139 | u32 hns_rcb_get_rx_coalesced_frames( | 140 | u32 hns_rcb_get_rx_coalesced_frames( |
140 | struct rcb_common_cb *rcb_common, u32 port_idx); | 141 | struct rcb_common_cb *rcb_common, u32 port_idx); |
141 | u32 hns_rcb_get_tx_coalesced_frames( | 142 | u32 hns_rcb_get_tx_coalesced_frames( |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h index 886cbbf25761..74d935d82cbc 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | |||
@@ -464,6 +464,7 @@ | |||
464 | #define RCB_RING_INTMSK_TX_OVERTIME_REG 0x000C4 | 464 | #define RCB_RING_INTMSK_TX_OVERTIME_REG 0x000C4 |
465 | #define RCB_RING_INTSTS_TX_OVERTIME_REG 0x000C8 | 465 | #define RCB_RING_INTSTS_TX_OVERTIME_REG 0x000C8 |
466 | 466 | ||
467 | #define GMAC_FIFO_STATE_REG 0x0000UL | ||
467 | #define GMAC_DUPLEX_TYPE_REG 0x0008UL | 468 | #define GMAC_DUPLEX_TYPE_REG 0x0008UL |
468 | #define GMAC_FD_FC_TYPE_REG 0x000CUL | 469 | #define GMAC_FD_FC_TYPE_REG 0x000CUL |
469 | #define GMAC_TX_WATER_LINE_REG 0x0010UL | 470 | #define GMAC_TX_WATER_LINE_REG 0x0010UL |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 02a0ba20fad5..f56855e63c96 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
@@ -1112,11 +1112,26 @@ static void hns_nic_adjust_link(struct net_device *ndev) | |||
1112 | struct hnae_handle *h = priv->ae_handle; | 1112 | struct hnae_handle *h = priv->ae_handle; |
1113 | int state = 1; | 1113 | int state = 1; |
1114 | 1114 | ||
1115 | /* If there is no phy, do not need adjust link */ | ||
1115 | if (ndev->phydev) { | 1116 | if (ndev->phydev) { |
1116 | h->dev->ops->adjust_link(h, ndev->phydev->speed, | 1117 | /* When phy link down, do nothing */ |
1117 | ndev->phydev->duplex); | 1118 | if (ndev->phydev->link == 0) |
1118 | state = ndev->phydev->link; | 1119 | return; |
1120 | |||
1121 | if (h->dev->ops->need_adjust_link(h, ndev->phydev->speed, | ||
1122 | ndev->phydev->duplex)) { | ||
1123 | /* because Hi161X chip don't support to change gmac | ||
1124 | * speed and duplex with traffic. Delay 200ms to | ||
1125 | * make sure there is no more data in chip FIFO. | ||
1126 | */ | ||
1127 | netif_carrier_off(ndev); | ||
1128 | msleep(200); | ||
1129 | h->dev->ops->adjust_link(h, ndev->phydev->speed, | ||
1130 | ndev->phydev->duplex); | ||
1131 | netif_carrier_on(ndev); | ||
1132 | } | ||
1119 | } | 1133 | } |
1134 | |||
1120 | state = state && h->dev->ops->get_status(h); | 1135 | state = state && h->dev->ops->get_status(h); |
1121 | 1136 | ||
1122 | if (state != priv->link) { | 1137 | if (state != priv->link) { |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 08f3c4743f74..774beda040a1 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | |||
@@ -243,7 +243,9 @@ static int hns_nic_set_link_ksettings(struct net_device *net_dev, | |||
243 | } | 243 | } |
244 | 244 | ||
245 | if (h->dev->ops->adjust_link) { | 245 | if (h->dev->ops->adjust_link) { |
246 | netif_carrier_off(net_dev); | ||
246 | h->dev->ops->adjust_link(h, (int)speed, cmd->base.duplex); | 247 | h->dev->ops->adjust_link(h, (int)speed, cmd->base.duplex); |
248 | netif_carrier_on(net_dev); | ||
247 | return 0; | 249 | return 0; |
248 | } | 250 | } |
249 | 251 | ||
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 354c0982847b..372664686309 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c | |||
@@ -494,9 +494,6 @@ static u32 __emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_s | |||
494 | case 16384: | 494 | case 16384: |
495 | ret |= EMAC_MR1_RFS_16K; | 495 | ret |= EMAC_MR1_RFS_16K; |
496 | break; | 496 | break; |
497 | case 8192: | ||
498 | ret |= EMAC4_MR1_RFS_8K; | ||
499 | break; | ||
500 | case 4096: | 497 | case 4096: |
501 | ret |= EMAC_MR1_RFS_4K; | 498 | ret |= EMAC_MR1_RFS_4K; |
502 | break; | 499 | break; |
@@ -537,6 +534,9 @@ static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_ | |||
537 | case 16384: | 534 | case 16384: |
538 | ret |= EMAC4_MR1_RFS_16K; | 535 | ret |= EMAC4_MR1_RFS_16K; |
539 | break; | 536 | break; |
537 | case 8192: | ||
538 | ret |= EMAC4_MR1_RFS_8K; | ||
539 | break; | ||
540 | case 4096: | 540 | case 4096: |
541 | ret |= EMAC4_MR1_RFS_4K; | 541 | ret |= EMAC4_MR1_RFS_4K; |
542 | break; | 542 | break; |
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index dafdd4ade705..4f0daf67b18d 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c | |||
@@ -1823,11 +1823,17 @@ static int do_reset(struct ibmvnic_adapter *adapter, | |||
1823 | adapter->map_id = 1; | 1823 | adapter->map_id = 1; |
1824 | release_rx_pools(adapter); | 1824 | release_rx_pools(adapter); |
1825 | release_tx_pools(adapter); | 1825 | release_tx_pools(adapter); |
1826 | init_rx_pools(netdev); | 1826 | rc = init_rx_pools(netdev); |
1827 | init_tx_pools(netdev); | 1827 | if (rc) |
1828 | return rc; | ||
1829 | rc = init_tx_pools(netdev); | ||
1830 | if (rc) | ||
1831 | return rc; | ||
1828 | 1832 | ||
1829 | release_napi(adapter); | 1833 | release_napi(adapter); |
1830 | init_napi(adapter); | 1834 | rc = init_napi(adapter); |
1835 | if (rc) | ||
1836 | return rc; | ||
1831 | } else { | 1837 | } else { |
1832 | rc = reset_tx_pools(adapter); | 1838 | rc = reset_tx_pools(adapter); |
1833 | if (rc) | 1839 | if (rc) |
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 32d785b616e1..28500417843e 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | |||
@@ -4803,6 +4803,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, | |||
4803 | dev->min_mtu = ETH_MIN_MTU; | 4803 | dev->min_mtu = ETH_MIN_MTU; |
4804 | /* 9704 == 9728 - 20 and rounding to 8 */ | 4804 | /* 9704 == 9728 - 20 and rounding to 8 */ |
4805 | dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE; | 4805 | dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE; |
4806 | dev->dev.of_node = port_node; | ||
4806 | 4807 | ||
4807 | /* Phylink isn't used w/ ACPI as of now */ | 4808 | /* Phylink isn't used w/ ACPI as of now */ |
4808 | if (port_node) { | 4809 | if (port_node) { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/wq.c b/drivers/net/ethernet/mellanox/mlx5/core/wq.c index 86478a6b99c5..c8c315eb5128 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/wq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.c | |||
@@ -139,14 +139,15 @@ int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, | |||
139 | struct mlx5_wq_ctrl *wq_ctrl) | 139 | struct mlx5_wq_ctrl *wq_ctrl) |
140 | { | 140 | { |
141 | u32 sq_strides_offset; | 141 | u32 sq_strides_offset; |
142 | u32 rq_pg_remainder; | ||
142 | int err; | 143 | int err; |
143 | 144 | ||
144 | mlx5_fill_fbc(MLX5_GET(qpc, qpc, log_rq_stride) + 4, | 145 | mlx5_fill_fbc(MLX5_GET(qpc, qpc, log_rq_stride) + 4, |
145 | MLX5_GET(qpc, qpc, log_rq_size), | 146 | MLX5_GET(qpc, qpc, log_rq_size), |
146 | &wq->rq.fbc); | 147 | &wq->rq.fbc); |
147 | 148 | ||
148 | sq_strides_offset = | 149 | rq_pg_remainder = mlx5_wq_cyc_get_byte_size(&wq->rq) % PAGE_SIZE; |
149 | ((wq->rq.fbc.frag_sz_m1 + 1) % PAGE_SIZE) / MLX5_SEND_WQE_BB; | 150 | sq_strides_offset = rq_pg_remainder / MLX5_SEND_WQE_BB; |
150 | 151 | ||
151 | mlx5_fill_fbc_offset(ilog2(MLX5_SEND_WQE_BB), | 152 | mlx5_fill_fbc_offset(ilog2(MLX5_SEND_WQE_BB), |
152 | MLX5_GET(qpc, qpc, log_sq_size), | 153 | MLX5_GET(qpc, qpc, log_sq_size), |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index a8b9fbab5f73..253bdaef1505 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c | |||
@@ -229,29 +229,16 @@ done: | |||
229 | spin_unlock_bh(&nn->reconfig_lock); | 229 | spin_unlock_bh(&nn->reconfig_lock); |
230 | } | 230 | } |
231 | 231 | ||
232 | /** | 232 | static void nfp_net_reconfig_sync_enter(struct nfp_net *nn) |
233 | * nfp_net_reconfig() - Reconfigure the firmware | ||
234 | * @nn: NFP Net device to reconfigure | ||
235 | * @update: The value for the update field in the BAR config | ||
236 | * | ||
237 | * Write the update word to the BAR and ping the reconfig queue. The | ||
238 | * poll until the firmware has acknowledged the update by zeroing the | ||
239 | * update word. | ||
240 | * | ||
241 | * Return: Negative errno on error, 0 on success | ||
242 | */ | ||
243 | int nfp_net_reconfig(struct nfp_net *nn, u32 update) | ||
244 | { | 233 | { |
245 | bool cancelled_timer = false; | 234 | bool cancelled_timer = false; |
246 | u32 pre_posted_requests; | 235 | u32 pre_posted_requests; |
247 | int ret; | ||
248 | 236 | ||
249 | spin_lock_bh(&nn->reconfig_lock); | 237 | spin_lock_bh(&nn->reconfig_lock); |
250 | 238 | ||
251 | nn->reconfig_sync_present = true; | 239 | nn->reconfig_sync_present = true; |
252 | 240 | ||
253 | if (nn->reconfig_timer_active) { | 241 | if (nn->reconfig_timer_active) { |
254 | del_timer(&nn->reconfig_timer); | ||
255 | nn->reconfig_timer_active = false; | 242 | nn->reconfig_timer_active = false; |
256 | cancelled_timer = true; | 243 | cancelled_timer = true; |
257 | } | 244 | } |
@@ -260,14 +247,43 @@ int nfp_net_reconfig(struct nfp_net *nn, u32 update) | |||
260 | 247 | ||
261 | spin_unlock_bh(&nn->reconfig_lock); | 248 | spin_unlock_bh(&nn->reconfig_lock); |
262 | 249 | ||
263 | if (cancelled_timer) | 250 | if (cancelled_timer) { |
251 | del_timer_sync(&nn->reconfig_timer); | ||
264 | nfp_net_reconfig_wait(nn, nn->reconfig_timer.expires); | 252 | nfp_net_reconfig_wait(nn, nn->reconfig_timer.expires); |
253 | } | ||
265 | 254 | ||
266 | /* Run the posted reconfigs which were issued before we started */ | 255 | /* Run the posted reconfigs which were issued before we started */ |
267 | if (pre_posted_requests) { | 256 | if (pre_posted_requests) { |
268 | nfp_net_reconfig_start(nn, pre_posted_requests); | 257 | nfp_net_reconfig_start(nn, pre_posted_requests); |
269 | nfp_net_reconfig_wait(nn, jiffies + HZ * NFP_NET_POLL_TIMEOUT); | 258 | nfp_net_reconfig_wait(nn, jiffies + HZ * NFP_NET_POLL_TIMEOUT); |
270 | } | 259 | } |
260 | } | ||
261 | |||
262 | static void nfp_net_reconfig_wait_posted(struct nfp_net *nn) | ||
263 | { | ||
264 | nfp_net_reconfig_sync_enter(nn); | ||
265 | |||
266 | spin_lock_bh(&nn->reconfig_lock); | ||
267 | nn->reconfig_sync_present = false; | ||
268 | spin_unlock_bh(&nn->reconfig_lock); | ||
269 | } | ||
270 | |||
271 | /** | ||
272 | * nfp_net_reconfig() - Reconfigure the firmware | ||
273 | * @nn: NFP Net device to reconfigure | ||
274 | * @update: The value for the update field in the BAR config | ||
275 | * | ||
276 | * Write the update word to the BAR and ping the reconfig queue. The | ||
277 | * poll until the firmware has acknowledged the update by zeroing the | ||
278 | * update word. | ||
279 | * | ||
280 | * Return: Negative errno on error, 0 on success | ||
281 | */ | ||
282 | int nfp_net_reconfig(struct nfp_net *nn, u32 update) | ||
283 | { | ||
284 | int ret; | ||
285 | |||
286 | nfp_net_reconfig_sync_enter(nn); | ||
271 | 287 | ||
272 | nfp_net_reconfig_start(nn, update); | 288 | nfp_net_reconfig_start(nn, update); |
273 | ret = nfp_net_reconfig_wait(nn, jiffies + HZ * NFP_NET_POLL_TIMEOUT); | 289 | ret = nfp_net_reconfig_wait(nn, jiffies + HZ * NFP_NET_POLL_TIMEOUT); |
@@ -3633,6 +3649,7 @@ struct nfp_net *nfp_net_alloc(struct pci_dev *pdev, bool needs_netdev, | |||
3633 | */ | 3649 | */ |
3634 | void nfp_net_free(struct nfp_net *nn) | 3650 | void nfp_net_free(struct nfp_net *nn) |
3635 | { | 3651 | { |
3652 | WARN_ON(timer_pending(&nn->reconfig_timer) || nn->reconfig_posted); | ||
3636 | if (nn->dp.netdev) | 3653 | if (nn->dp.netdev) |
3637 | free_netdev(nn->dp.netdev); | 3654 | free_netdev(nn->dp.netdev); |
3638 | else | 3655 | else |
@@ -3920,4 +3937,5 @@ void nfp_net_clean(struct nfp_net *nn) | |||
3920 | return; | 3937 | return; |
3921 | 3938 | ||
3922 | unregister_netdev(nn->dp.netdev); | 3939 | unregister_netdev(nn->dp.netdev); |
3940 | nfp_net_reconfig_wait_posted(nn); | ||
3923 | } | 3941 | } |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 0efa977c422d..b08d51bf7a20 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -218,6 +218,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = { | |||
218 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 }, | 218 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 }, |
219 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, | 219 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, |
220 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 }, | 220 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 }, |
221 | { PCI_DEVICE(PCI_VENDOR_ID_NCUBE, 0x8168), 0, 0, RTL_CFG_1 }, | ||
221 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, | 222 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, |
222 | { PCI_VENDOR_ID_DLINK, 0x4300, | 223 | { PCI_VENDOR_ID_DLINK, 0x4300, |
223 | PCI_VENDOR_ID_DLINK, 0x4b10, 0, 0, RTL_CFG_1 }, | 224 | PCI_VENDOR_ID_DLINK, 0x4b10, 0, 0, RTL_CFG_1 }, |
@@ -4522,7 +4523,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp) | |||
4522 | rtl_hw_reset(tp); | 4523 | rtl_hw_reset(tp); |
4523 | } | 4524 | } |
4524 | 4525 | ||
4525 | static void rtl_set_rx_tx_config_registers(struct rtl8169_private *tp) | 4526 | static void rtl_set_tx_config_registers(struct rtl8169_private *tp) |
4526 | { | 4527 | { |
4527 | /* Set DMA burst size and Interframe Gap Time */ | 4528 | /* Set DMA burst size and Interframe Gap Time */ |
4528 | RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) | | 4529 | RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) | |
@@ -4633,12 +4634,14 @@ static void rtl_hw_start(struct rtl8169_private *tp) | |||
4633 | 4634 | ||
4634 | rtl_set_rx_max_size(tp); | 4635 | rtl_set_rx_max_size(tp); |
4635 | rtl_set_rx_tx_desc_registers(tp); | 4636 | rtl_set_rx_tx_desc_registers(tp); |
4636 | rtl_set_rx_tx_config_registers(tp); | 4637 | rtl_set_tx_config_registers(tp); |
4637 | RTL_W8(tp, Cfg9346, Cfg9346_Lock); | 4638 | RTL_W8(tp, Cfg9346, Cfg9346_Lock); |
4638 | 4639 | ||
4639 | /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ | 4640 | /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ |
4640 | RTL_R8(tp, IntrMask); | 4641 | RTL_R8(tp, IntrMask); |
4641 | RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb); | 4642 | RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb); |
4643 | rtl_init_rxcfg(tp); | ||
4644 | |||
4642 | rtl_set_rx_mode(tp->dev); | 4645 | rtl_set_rx_mode(tp->dev); |
4643 | /* no early-rx interrupts */ | 4646 | /* no early-rx interrupts */ |
4644 | RTL_W16(tp, MultiIntr, RTL_R16(tp, MultiIntr) & 0xf000); | 4647 | RTL_W16(tp, MultiIntr, RTL_R16(tp, MultiIntr) & 0xf000); |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index ad4433d59237..f27a0dc8c563 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -798,6 +798,41 @@ static struct sh_eth_cpu_data r8a77980_data = { | |||
798 | .magic = 1, | 798 | .magic = 1, |
799 | .cexcr = 1, | 799 | .cexcr = 1, |
800 | }; | 800 | }; |
801 | |||
802 | /* R7S9210 */ | ||
803 | static struct sh_eth_cpu_data r7s9210_data = { | ||
804 | .soft_reset = sh_eth_soft_reset, | ||
805 | |||
806 | .set_duplex = sh_eth_set_duplex, | ||
807 | .set_rate = sh_eth_set_rate_rcar, | ||
808 | |||
809 | .register_type = SH_ETH_REG_FAST_SH4, | ||
810 | |||
811 | .edtrr_trns = EDTRR_TRNS_ETHER, | ||
812 | .ecsr_value = ECSR_ICD, | ||
813 | .ecsipr_value = ECSIPR_ICDIP, | ||
814 | .eesipr_value = EESIPR_TWBIP | EESIPR_TABTIP | EESIPR_RABTIP | | ||
815 | EESIPR_RFCOFIP | EESIPR_ECIIP | EESIPR_FTCIP | | ||
816 | EESIPR_TDEIP | EESIPR_TFUFIP | EESIPR_FRIP | | ||
817 | EESIPR_RDEIP | EESIPR_RFOFIP | EESIPR_CNDIP | | ||
818 | EESIPR_DLCIP | EESIPR_CDIP | EESIPR_TROIP | | ||
819 | EESIPR_RMAFIP | EESIPR_RRFIP | EESIPR_RTLFIP | | ||
820 | EESIPR_RTSFIP | EESIPR_PREIP | EESIPR_CERFIP, | ||
821 | |||
822 | .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_TRO, | ||
823 | .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | | ||
824 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE, | ||
825 | |||
826 | .fdr_value = 0x0000070f, | ||
827 | |||
828 | .apr = 1, | ||
829 | .mpr = 1, | ||
830 | .tpauser = 1, | ||
831 | .hw_swap = 1, | ||
832 | .rpadir = 1, | ||
833 | .no_ade = 1, | ||
834 | .xdfar_rw = 1, | ||
835 | }; | ||
801 | #endif /* CONFIG_OF */ | 836 | #endif /* CONFIG_OF */ |
802 | 837 | ||
803 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) | 838 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) |
@@ -3121,6 +3156,7 @@ static const struct of_device_id sh_eth_match_table[] = { | |||
3121 | { .compatible = "renesas,ether-r8a7794", .data = &rcar_gen2_data }, | 3156 | { .compatible = "renesas,ether-r8a7794", .data = &rcar_gen2_data }, |
3122 | { .compatible = "renesas,gether-r8a77980", .data = &r8a77980_data }, | 3157 | { .compatible = "renesas,gether-r8a77980", .data = &r8a77980_data }, |
3123 | { .compatible = "renesas,ether-r7s72100", .data = &r7s72100_data }, | 3158 | { .compatible = "renesas,ether-r7s72100", .data = &r7s72100_data }, |
3159 | { .compatible = "renesas,ether-r7s9210", .data = &r7s9210_data }, | ||
3124 | { .compatible = "renesas,rcar-gen1-ether", .data = &rcar_gen1_data }, | 3160 | { .compatible = "renesas,rcar-gen1-ether", .data = &rcar_gen1_data }, |
3125 | { .compatible = "renesas,rcar-gen2-ether", .data = &rcar_gen2_data }, | 3161 | { .compatible = "renesas,rcar-gen2-ether", .data = &rcar_gen2_data }, |
3126 | { } | 3162 | { } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index bf4acebb6bcd..324049eebb9b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig | |||
@@ -110,7 +110,7 @@ config DWMAC_ROCKCHIP | |||
110 | 110 | ||
111 | config DWMAC_SOCFPGA | 111 | config DWMAC_SOCFPGA |
112 | tristate "SOCFPGA dwmac support" | 112 | tristate "SOCFPGA dwmac support" |
113 | default ARCH_SOCFPGA | 113 | default (ARCH_SOCFPGA || ARCH_STRATIX10) |
114 | depends on OF && (ARCH_SOCFPGA || ARCH_STRATIX10 || COMPILE_TEST) | 114 | depends on OF && (ARCH_SOCFPGA || ARCH_STRATIX10 || COMPILE_TEST) |
115 | select MFD_SYSCON | 115 | select MFD_SYSCON |
116 | help | 116 | help |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 76649adf8fb0..c0a855b7ab3b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -112,7 +112,6 @@ struct stmmac_priv { | |||
112 | u32 tx_count_frames; | 112 | u32 tx_count_frames; |
113 | u32 tx_coal_frames; | 113 | u32 tx_coal_frames; |
114 | u32 tx_coal_timer; | 114 | u32 tx_coal_timer; |
115 | bool tx_timer_armed; | ||
116 | 115 | ||
117 | int tx_coalesce; | 116 | int tx_coalesce; |
118 | int hwts_tx_en; | 117 | int hwts_tx_en; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ff1ffb46198a..9f458bb16f2a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -3147,16 +3147,13 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3147 | * element in case of no SG. | 3147 | * element in case of no SG. |
3148 | */ | 3148 | */ |
3149 | priv->tx_count_frames += nfrags + 1; | 3149 | priv->tx_count_frames += nfrags + 1; |
3150 | if (likely(priv->tx_coal_frames > priv->tx_count_frames) && | 3150 | if (likely(priv->tx_coal_frames > priv->tx_count_frames)) { |
3151 | !priv->tx_timer_armed) { | ||
3152 | mod_timer(&priv->txtimer, | 3151 | mod_timer(&priv->txtimer, |
3153 | STMMAC_COAL_TIMER(priv->tx_coal_timer)); | 3152 | STMMAC_COAL_TIMER(priv->tx_coal_timer)); |
3154 | priv->tx_timer_armed = true; | ||
3155 | } else { | 3153 | } else { |
3156 | priv->tx_count_frames = 0; | 3154 | priv->tx_count_frames = 0; |
3157 | stmmac_set_tx_ic(priv, desc); | 3155 | stmmac_set_tx_ic(priv, desc); |
3158 | priv->xstats.tx_set_ic_bit++; | 3156 | priv->xstats.tx_set_ic_bit++; |
3159 | priv->tx_timer_armed = false; | ||
3160 | } | 3157 | } |
3161 | 3158 | ||
3162 | skb_tx_timestamp(skb); | 3159 | skb_tx_timestamp(skb); |
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c index 0c1adad7415d..396e1cd10667 100644 --- a/drivers/net/ethernet/ti/cpsw-phy-sel.c +++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c | |||
@@ -170,10 +170,13 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave) | |||
170 | struct device_node *node; | 170 | struct device_node *node; |
171 | struct cpsw_phy_sel_priv *priv; | 171 | struct cpsw_phy_sel_priv *priv; |
172 | 172 | ||
173 | node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel"); | 173 | node = of_parse_phandle(dev->of_node, "cpsw-phy-sel", 0); |
174 | if (!node) { | 174 | if (!node) { |
175 | dev_err(dev, "Phy mode driver DT not found\n"); | 175 | node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel"); |
176 | return; | 176 | if (!node) { |
177 | dev_err(dev, "Phy mode driver DT not found\n"); | ||
178 | return; | ||
179 | } | ||
177 | } | 180 | } |
178 | 181 | ||
179 | dev = bus_find_device(&platform_bus_type, NULL, node, match); | 182 | dev = bus_find_device(&platform_bus_type, NULL, node, match); |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 1121a1ec407c..70921bbe0e28 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -2206,6 +2206,16 @@ static int netvsc_probe(struct hv_device *dev, | |||
2206 | 2206 | ||
2207 | memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN); | 2207 | memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN); |
2208 | 2208 | ||
2209 | /* We must get rtnl lock before scheduling nvdev->subchan_work, | ||
2210 | * otherwise netvsc_subchan_work() can get rtnl lock first and wait | ||
2211 | * all subchannels to show up, but that may not happen because | ||
2212 | * netvsc_probe() can't get rtnl lock and as a result vmbus_onoffer() | ||
2213 | * -> ... -> device_add() -> ... -> __device_attach() can't get | ||
2214 | * the device lock, so all the subchannels can't be processed -- | ||
2215 | * finally netvsc_subchan_work() hangs for ever. | ||
2216 | */ | ||
2217 | rtnl_lock(); | ||
2218 | |||
2209 | if (nvdev->num_chn > 1) | 2219 | if (nvdev->num_chn > 1) |
2210 | schedule_work(&nvdev->subchan_work); | 2220 | schedule_work(&nvdev->subchan_work); |
2211 | 2221 | ||
@@ -2224,7 +2234,6 @@ static int netvsc_probe(struct hv_device *dev, | |||
2224 | else | 2234 | else |
2225 | net->max_mtu = ETH_DATA_LEN; | 2235 | net->max_mtu = ETH_DATA_LEN; |
2226 | 2236 | ||
2227 | rtnl_lock(); | ||
2228 | ret = register_netdevice(net); | 2237 | ret = register_netdevice(net); |
2229 | if (ret != 0) { | 2238 | if (ret != 0) { |
2230 | pr_err("Unable to register netdev.\n"); | 2239 | pr_err("Unable to register netdev.\n"); |
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 4637d980310e..52fffb98fde9 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c | |||
@@ -398,7 +398,6 @@ static umode_t sfp_hwmon_is_visible(const void *data, | |||
398 | switch (type) { | 398 | switch (type) { |
399 | case hwmon_temp: | 399 | case hwmon_temp: |
400 | switch (attr) { | 400 | switch (attr) { |
401 | case hwmon_temp_input: | ||
402 | case hwmon_temp_min_alarm: | 401 | case hwmon_temp_min_alarm: |
403 | case hwmon_temp_max_alarm: | 402 | case hwmon_temp_max_alarm: |
404 | case hwmon_temp_lcrit_alarm: | 403 | case hwmon_temp_lcrit_alarm: |
@@ -407,13 +406,16 @@ static umode_t sfp_hwmon_is_visible(const void *data, | |||
407 | case hwmon_temp_max: | 406 | case hwmon_temp_max: |
408 | case hwmon_temp_lcrit: | 407 | case hwmon_temp_lcrit: |
409 | case hwmon_temp_crit: | 408 | case hwmon_temp_crit: |
409 | if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN)) | ||
410 | return 0; | ||
411 | /* fall through */ | ||
412 | case hwmon_temp_input: | ||
410 | return 0444; | 413 | return 0444; |
411 | default: | 414 | default: |
412 | return 0; | 415 | return 0; |
413 | } | 416 | } |
414 | case hwmon_in: | 417 | case hwmon_in: |
415 | switch (attr) { | 418 | switch (attr) { |
416 | case hwmon_in_input: | ||
417 | case hwmon_in_min_alarm: | 419 | case hwmon_in_min_alarm: |
418 | case hwmon_in_max_alarm: | 420 | case hwmon_in_max_alarm: |
419 | case hwmon_in_lcrit_alarm: | 421 | case hwmon_in_lcrit_alarm: |
@@ -422,13 +424,16 @@ static umode_t sfp_hwmon_is_visible(const void *data, | |||
422 | case hwmon_in_max: | 424 | case hwmon_in_max: |
423 | case hwmon_in_lcrit: | 425 | case hwmon_in_lcrit: |
424 | case hwmon_in_crit: | 426 | case hwmon_in_crit: |
427 | if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN)) | ||
428 | return 0; | ||
429 | /* fall through */ | ||
430 | case hwmon_in_input: | ||
425 | return 0444; | 431 | return 0444; |
426 | default: | 432 | default: |
427 | return 0; | 433 | return 0; |
428 | } | 434 | } |
429 | case hwmon_curr: | 435 | case hwmon_curr: |
430 | switch (attr) { | 436 | switch (attr) { |
431 | case hwmon_curr_input: | ||
432 | case hwmon_curr_min_alarm: | 437 | case hwmon_curr_min_alarm: |
433 | case hwmon_curr_max_alarm: | 438 | case hwmon_curr_max_alarm: |
434 | case hwmon_curr_lcrit_alarm: | 439 | case hwmon_curr_lcrit_alarm: |
@@ -437,6 +442,10 @@ static umode_t sfp_hwmon_is_visible(const void *data, | |||
437 | case hwmon_curr_max: | 442 | case hwmon_curr_max: |
438 | case hwmon_curr_lcrit: | 443 | case hwmon_curr_lcrit: |
439 | case hwmon_curr_crit: | 444 | case hwmon_curr_crit: |
445 | if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN)) | ||
446 | return 0; | ||
447 | /* fall through */ | ||
448 | case hwmon_curr_input: | ||
440 | return 0444; | 449 | return 0444; |
441 | default: | 450 | default: |
442 | return 0; | 451 | return 0; |
@@ -452,7 +461,6 @@ static umode_t sfp_hwmon_is_visible(const void *data, | |||
452 | channel == 1) | 461 | channel == 1) |
453 | return 0; | 462 | return 0; |
454 | switch (attr) { | 463 | switch (attr) { |
455 | case hwmon_power_input: | ||
456 | case hwmon_power_min_alarm: | 464 | case hwmon_power_min_alarm: |
457 | case hwmon_power_max_alarm: | 465 | case hwmon_power_max_alarm: |
458 | case hwmon_power_lcrit_alarm: | 466 | case hwmon_power_lcrit_alarm: |
@@ -461,6 +469,10 @@ static umode_t sfp_hwmon_is_visible(const void *data, | |||
461 | case hwmon_power_max: | 469 | case hwmon_power_max: |
462 | case hwmon_power_lcrit: | 470 | case hwmon_power_lcrit: |
463 | case hwmon_power_crit: | 471 | case hwmon_power_crit: |
472 | if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN)) | ||
473 | return 0; | ||
474 | /* fall through */ | ||
475 | case hwmon_power_input: | ||
464 | return 0444; | 476 | return 0444; |
465 | default: | 477 | default: |
466 | return 0; | 478 | return 0; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c index b4c3a957c102..73969dbeb5c5 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | |||
@@ -985,15 +985,12 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, | |||
985 | const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ? | 985 | const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ? |
986 | iwl_ext_nvm_channels : iwl_nvm_channels; | 986 | iwl_ext_nvm_channels : iwl_nvm_channels; |
987 | struct ieee80211_regdomain *regd, *copy_rd; | 987 | struct ieee80211_regdomain *regd, *copy_rd; |
988 | int size_of_regd, regd_to_copy, wmms_to_copy; | 988 | int size_of_regd, regd_to_copy; |
989 | int size_of_wmms = 0; | ||
990 | struct ieee80211_reg_rule *rule; | 989 | struct ieee80211_reg_rule *rule; |
991 | struct ieee80211_wmm_rule *wmm_rule, *d_wmm, *s_wmm; | ||
992 | struct regdb_ptrs *regdb_ptrs; | 990 | struct regdb_ptrs *regdb_ptrs; |
993 | enum nl80211_band band; | 991 | enum nl80211_band band; |
994 | int center_freq, prev_center_freq = 0; | 992 | int center_freq, prev_center_freq = 0; |
995 | int valid_rules = 0, n_wmms = 0; | 993 | int valid_rules = 0; |
996 | int i; | ||
997 | bool new_rule; | 994 | bool new_rule; |
998 | int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ? | 995 | int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ? |
999 | IWL_NVM_NUM_CHANNELS_EXT : IWL_NVM_NUM_CHANNELS; | 996 | IWL_NVM_NUM_CHANNELS_EXT : IWL_NVM_NUM_CHANNELS; |
@@ -1012,11 +1009,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, | |||
1012 | sizeof(struct ieee80211_regdomain) + | 1009 | sizeof(struct ieee80211_regdomain) + |
1013 | num_of_ch * sizeof(struct ieee80211_reg_rule); | 1010 | num_of_ch * sizeof(struct ieee80211_reg_rule); |
1014 | 1011 | ||
1015 | if (geo_info & GEO_WMM_ETSI_5GHZ_INFO) | 1012 | regd = kzalloc(size_of_regd, GFP_KERNEL); |
1016 | size_of_wmms = | ||
1017 | num_of_ch * sizeof(struct ieee80211_wmm_rule); | ||
1018 | |||
1019 | regd = kzalloc(size_of_regd + size_of_wmms, GFP_KERNEL); | ||
1020 | if (!regd) | 1013 | if (!regd) |
1021 | return ERR_PTR(-ENOMEM); | 1014 | return ERR_PTR(-ENOMEM); |
1022 | 1015 | ||
@@ -1030,8 +1023,6 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, | |||
1030 | regd->alpha2[0] = fw_mcc >> 8; | 1023 | regd->alpha2[0] = fw_mcc >> 8; |
1031 | regd->alpha2[1] = fw_mcc & 0xff; | 1024 | regd->alpha2[1] = fw_mcc & 0xff; |
1032 | 1025 | ||
1033 | wmm_rule = (struct ieee80211_wmm_rule *)((u8 *)regd + size_of_regd); | ||
1034 | |||
1035 | for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) { | 1026 | for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) { |
1036 | ch_flags = (u16)__le32_to_cpup(channels + ch_idx); | 1027 | ch_flags = (u16)__le32_to_cpup(channels + ch_idx); |
1037 | band = (ch_idx < NUM_2GHZ_CHANNELS) ? | 1028 | band = (ch_idx < NUM_2GHZ_CHANNELS) ? |
@@ -1085,26 +1076,10 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, | |||
1085 | band == NL80211_BAND_2GHZ) | 1076 | band == NL80211_BAND_2GHZ) |
1086 | continue; | 1077 | continue; |
1087 | 1078 | ||
1088 | if (!reg_query_regdb_wmm(regd->alpha2, center_freq, | 1079 | reg_query_regdb_wmm(regd->alpha2, center_freq, rule); |
1089 | ®db_ptrs[n_wmms].token, wmm_rule)) { | ||
1090 | /* Add only new rules */ | ||
1091 | for (i = 0; i < n_wmms; i++) { | ||
1092 | if (regdb_ptrs[i].token == | ||
1093 | regdb_ptrs[n_wmms].token) { | ||
1094 | rule->wmm_rule = regdb_ptrs[i].rule; | ||
1095 | break; | ||
1096 | } | ||
1097 | } | ||
1098 | if (i == n_wmms) { | ||
1099 | rule->wmm_rule = wmm_rule; | ||
1100 | regdb_ptrs[n_wmms++].rule = wmm_rule; | ||
1101 | wmm_rule++; | ||
1102 | } | ||
1103 | } | ||
1104 | } | 1080 | } |
1105 | 1081 | ||
1106 | regd->n_reg_rules = valid_rules; | 1082 | regd->n_reg_rules = valid_rules; |
1107 | regd->n_wmm_rules = n_wmms; | ||
1108 | 1083 | ||
1109 | /* | 1084 | /* |
1110 | * Narrow down regdom for unused regulatory rules to prevent hole | 1085 | * Narrow down regdom for unused regulatory rules to prevent hole |
@@ -1113,28 +1088,13 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, | |||
1113 | regd_to_copy = sizeof(struct ieee80211_regdomain) + | 1088 | regd_to_copy = sizeof(struct ieee80211_regdomain) + |
1114 | valid_rules * sizeof(struct ieee80211_reg_rule); | 1089 | valid_rules * sizeof(struct ieee80211_reg_rule); |
1115 | 1090 | ||
1116 | wmms_to_copy = sizeof(struct ieee80211_wmm_rule) * n_wmms; | 1091 | copy_rd = kzalloc(regd_to_copy, GFP_KERNEL); |
1117 | |||
1118 | copy_rd = kzalloc(regd_to_copy + wmms_to_copy, GFP_KERNEL); | ||
1119 | if (!copy_rd) { | 1092 | if (!copy_rd) { |
1120 | copy_rd = ERR_PTR(-ENOMEM); | 1093 | copy_rd = ERR_PTR(-ENOMEM); |
1121 | goto out; | 1094 | goto out; |
1122 | } | 1095 | } |
1123 | 1096 | ||
1124 | memcpy(copy_rd, regd, regd_to_copy); | 1097 | memcpy(copy_rd, regd, regd_to_copy); |
1125 | memcpy((u8 *)copy_rd + regd_to_copy, (u8 *)regd + size_of_regd, | ||
1126 | wmms_to_copy); | ||
1127 | |||
1128 | d_wmm = (struct ieee80211_wmm_rule *)((u8 *)copy_rd + regd_to_copy); | ||
1129 | s_wmm = (struct ieee80211_wmm_rule *)((u8 *)regd + size_of_regd); | ||
1130 | |||
1131 | for (i = 0; i < regd->n_reg_rules; i++) { | ||
1132 | if (!regd->reg_rules[i].wmm_rule) | ||
1133 | continue; | ||
1134 | |||
1135 | copy_rd->reg_rules[i].wmm_rule = d_wmm + | ||
1136 | (regd->reg_rules[i].wmm_rule - s_wmm); | ||
1137 | } | ||
1138 | 1098 | ||
1139 | out: | 1099 | out: |
1140 | kfree(regdb_ptrs); | 1100 | kfree(regdb_ptrs); |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 998dfac0fcff..1068757ec42e 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <net/net_namespace.h> | 34 | #include <net/net_namespace.h> |
35 | #include <net/netns/generic.h> | 35 | #include <net/netns/generic.h> |
36 | #include <linux/rhashtable.h> | 36 | #include <linux/rhashtable.h> |
37 | #include <linux/nospec.h> | ||
37 | #include "mac80211_hwsim.h" | 38 | #include "mac80211_hwsim.h" |
38 | 39 | ||
39 | #define WARN_QUEUE 100 | 40 | #define WARN_QUEUE 100 |
@@ -2820,9 +2821,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, | |||
2820 | IEEE80211_VHT_CAP_SHORT_GI_80 | | 2821 | IEEE80211_VHT_CAP_SHORT_GI_80 | |
2821 | IEEE80211_VHT_CAP_SHORT_GI_160 | | 2822 | IEEE80211_VHT_CAP_SHORT_GI_160 | |
2822 | IEEE80211_VHT_CAP_TXSTBC | | 2823 | IEEE80211_VHT_CAP_TXSTBC | |
2823 | IEEE80211_VHT_CAP_RXSTBC_1 | | ||
2824 | IEEE80211_VHT_CAP_RXSTBC_2 | | ||
2825 | IEEE80211_VHT_CAP_RXSTBC_3 | | ||
2826 | IEEE80211_VHT_CAP_RXSTBC_4 | | 2824 | IEEE80211_VHT_CAP_RXSTBC_4 | |
2827 | IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; | 2825 | IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; |
2828 | sband->vht_cap.vht_mcs.rx_mcs_map = | 2826 | sband->vht_cap.vht_mcs.rx_mcs_map = |
@@ -3317,6 +3315,11 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) | |||
3317 | if (info->attrs[HWSIM_ATTR_CHANNELS]) | 3315 | if (info->attrs[HWSIM_ATTR_CHANNELS]) |
3318 | param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]); | 3316 | param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]); |
3319 | 3317 | ||
3318 | if (param.channels < 1) { | ||
3319 | GENL_SET_ERR_MSG(info, "must have at least one channel"); | ||
3320 | return -EINVAL; | ||
3321 | } | ||
3322 | |||
3320 | if (param.channels > CFG80211_MAX_NUM_DIFFERENT_CHANNELS) { | 3323 | if (param.channels > CFG80211_MAX_NUM_DIFFERENT_CHANNELS) { |
3321 | GENL_SET_ERR_MSG(info, "too many channels specified"); | 3324 | GENL_SET_ERR_MSG(info, "too many channels specified"); |
3322 | return -EINVAL; | 3325 | return -EINVAL; |
@@ -3350,6 +3353,9 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) | |||
3350 | kfree(hwname); | 3353 | kfree(hwname); |
3351 | return -EINVAL; | 3354 | return -EINVAL; |
3352 | } | 3355 | } |
3356 | |||
3357 | idx = array_index_nospec(idx, | ||
3358 | ARRAY_SIZE(hwsim_world_regdom_custom)); | ||
3353 | param.regd = hwsim_world_regdom_custom[idx]; | 3359 | param.regd = hwsim_world_regdom_custom[idx]; |
3354 | } | 3360 | } |
3355 | 3361 | ||
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 8fc851a9e116..7c097006c54d 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -52,12 +52,12 @@ config SCSI_MQ_DEFAULT | |||
52 | default y | 52 | default y |
53 | depends on SCSI | 53 | depends on SCSI |
54 | ---help--- | 54 | ---help--- |
55 | This option enables the new blk-mq based I/O path for SCSI | 55 | This option enables the blk-mq based I/O path for SCSI devices by |
56 | devices by default. With the option the scsi_mod.use_blk_mq | 56 | default. With this option the scsi_mod.use_blk_mq module/boot |
57 | module/boot option defaults to Y, without it to N, but it can | 57 | option defaults to Y, without it to N, but it can still be |
58 | still be overridden either way. | 58 | overridden either way. |
59 | 59 | ||
60 | If unsure say N. | 60 | If unsure say Y. |
61 | 61 | ||
62 | config SCSI_PROC_FS | 62 | config SCSI_PROC_FS |
63 | bool "legacy /proc/scsi/ support" | 63 | bool "legacy /proc/scsi/ support" |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 29bf1e60f542..39eb415987fc 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1346,7 +1346,7 @@ struct fib { | |||
1346 | struct aac_hba_map_info { | 1346 | struct aac_hba_map_info { |
1347 | __le32 rmw_nexus; /* nexus for native HBA devices */ | 1347 | __le32 rmw_nexus; /* nexus for native HBA devices */ |
1348 | u8 devtype; /* device type */ | 1348 | u8 devtype; /* device type */ |
1349 | u8 reset_state; /* 0 - no reset, 1..x - */ | 1349 | s8 reset_state; /* 0 - no reset, 1..x - */ |
1350 | /* after xth TM LUN reset */ | 1350 | /* after xth TM LUN reset */ |
1351 | u16 qd_limit; | 1351 | u16 qd_limit; |
1352 | u32 scan_counter; | 1352 | u32 scan_counter; |
diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c index 23d07e9f87d0..e51923886475 100644 --- a/drivers/scsi/csiostor/csio_hw.c +++ b/drivers/scsi/csiostor/csio_hw.c | |||
@@ -1602,6 +1602,46 @@ fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16) | |||
1602 | } | 1602 | } |
1603 | 1603 | ||
1604 | /** | 1604 | /** |
1605 | * fwcaps32_to_caps16 - convert 32-bit Port Capabilities to 16-bits | ||
1606 | * @caps32: a 32-bit Port Capabilities value | ||
1607 | * | ||
1608 | * Returns the equivalent 16-bit Port Capabilities value. Note that | ||
1609 | * not all 32-bit Port Capabilities can be represented in the 16-bit | ||
1610 | * Port Capabilities and some fields/values may not make it. | ||
1611 | */ | ||
1612 | fw_port_cap16_t fwcaps32_to_caps16(fw_port_cap32_t caps32) | ||
1613 | { | ||
1614 | fw_port_cap16_t caps16 = 0; | ||
1615 | |||
1616 | #define CAP32_TO_CAP16(__cap) \ | ||
1617 | do { \ | ||
1618 | if (caps32 & FW_PORT_CAP32_##__cap) \ | ||
1619 | caps16 |= FW_PORT_CAP_##__cap; \ | ||
1620 | } while (0) | ||
1621 | |||
1622 | CAP32_TO_CAP16(SPEED_100M); | ||
1623 | CAP32_TO_CAP16(SPEED_1G); | ||
1624 | CAP32_TO_CAP16(SPEED_10G); | ||
1625 | CAP32_TO_CAP16(SPEED_25G); | ||
1626 | CAP32_TO_CAP16(SPEED_40G); | ||
1627 | CAP32_TO_CAP16(SPEED_100G); | ||
1628 | CAP32_TO_CAP16(FC_RX); | ||
1629 | CAP32_TO_CAP16(FC_TX); | ||
1630 | CAP32_TO_CAP16(802_3_PAUSE); | ||
1631 | CAP32_TO_CAP16(802_3_ASM_DIR); | ||
1632 | CAP32_TO_CAP16(ANEG); | ||
1633 | CAP32_TO_CAP16(FORCE_PAUSE); | ||
1634 | CAP32_TO_CAP16(MDIAUTO); | ||
1635 | CAP32_TO_CAP16(MDISTRAIGHT); | ||
1636 | CAP32_TO_CAP16(FEC_RS); | ||
1637 | CAP32_TO_CAP16(FEC_BASER_RS); | ||
1638 | |||
1639 | #undef CAP32_TO_CAP16 | ||
1640 | |||
1641 | return caps16; | ||
1642 | } | ||
1643 | |||
1644 | /** | ||
1605 | * lstatus_to_fwcap - translate old lstatus to 32-bit Port Capabilities | 1645 | * lstatus_to_fwcap - translate old lstatus to 32-bit Port Capabilities |
1606 | * @lstatus: old FW_PORT_ACTION_GET_PORT_INFO lstatus value | 1646 | * @lstatus: old FW_PORT_ACTION_GET_PORT_INFO lstatus value |
1607 | * | 1647 | * |
@@ -1759,7 +1799,7 @@ csio_enable_ports(struct csio_hw *hw) | |||
1759 | val = 1; | 1799 | val = 1; |
1760 | 1800 | ||
1761 | csio_mb_params(hw, mbp, CSIO_MB_DEFAULT_TMO, | 1801 | csio_mb_params(hw, mbp, CSIO_MB_DEFAULT_TMO, |
1762 | hw->pfn, 0, 1, ¶m, &val, false, | 1802 | hw->pfn, 0, 1, ¶m, &val, true, |
1763 | NULL); | 1803 | NULL); |
1764 | 1804 | ||
1765 | if (csio_mb_issue(hw, mbp)) { | 1805 | if (csio_mb_issue(hw, mbp)) { |
@@ -1769,16 +1809,9 @@ csio_enable_ports(struct csio_hw *hw) | |||
1769 | return -EINVAL; | 1809 | return -EINVAL; |
1770 | } | 1810 | } |
1771 | 1811 | ||
1772 | csio_mb_process_read_params_rsp(hw, mbp, &retval, 1, | 1812 | csio_mb_process_read_params_rsp(hw, mbp, &retval, |
1773 | &val); | 1813 | 0, NULL); |
1774 | if (retval != FW_SUCCESS) { | 1814 | fw_caps = retval ? FW_CAPS16 : FW_CAPS32; |
1775 | csio_err(hw, "FW_PARAMS_CMD(r) port:%d failed: 0x%x\n", | ||
1776 | portid, retval); | ||
1777 | mempool_free(mbp, hw->mb_mempool); | ||
1778 | return -EINVAL; | ||
1779 | } | ||
1780 | |||
1781 | fw_caps = val; | ||
1782 | } | 1815 | } |
1783 | 1816 | ||
1784 | /* Read PORT information */ | 1817 | /* Read PORT information */ |
@@ -2364,8 +2397,8 @@ bye: | |||
2364 | } | 2397 | } |
2365 | 2398 | ||
2366 | /* | 2399 | /* |
2367 | * Returns -EINVAL if attempts to flash the firmware failed | 2400 | * Returns -EINVAL if attempts to flash the firmware failed, |
2368 | * else returns 0, | 2401 | * -ENOMEM if memory allocation failed else returns 0, |
2369 | * if flashing was not attempted because the card had the | 2402 | * if flashing was not attempted because the card had the |
2370 | * latest firmware ECANCELED is returned | 2403 | * latest firmware ECANCELED is returned |
2371 | */ | 2404 | */ |
@@ -2393,6 +2426,13 @@ csio_hw_flash_fw(struct csio_hw *hw, int *reset) | |||
2393 | return -EINVAL; | 2426 | return -EINVAL; |
2394 | } | 2427 | } |
2395 | 2428 | ||
2429 | /* allocate memory to read the header of the firmware on the | ||
2430 | * card | ||
2431 | */ | ||
2432 | card_fw = kmalloc(sizeof(*card_fw), GFP_KERNEL); | ||
2433 | if (!card_fw) | ||
2434 | return -ENOMEM; | ||
2435 | |||
2396 | if (csio_is_t5(pci_dev->device & CSIO_HW_CHIP_MASK)) | 2436 | if (csio_is_t5(pci_dev->device & CSIO_HW_CHIP_MASK)) |
2397 | fw_bin_file = FW_FNAME_T5; | 2437 | fw_bin_file = FW_FNAME_T5; |
2398 | else | 2438 | else |
@@ -2406,11 +2446,6 @@ csio_hw_flash_fw(struct csio_hw *hw, int *reset) | |||
2406 | fw_size = fw->size; | 2446 | fw_size = fw->size; |
2407 | } | 2447 | } |
2408 | 2448 | ||
2409 | /* allocate memory to read the header of the firmware on the | ||
2410 | * card | ||
2411 | */ | ||
2412 | card_fw = kmalloc(sizeof(*card_fw), GFP_KERNEL); | ||
2413 | |||
2414 | /* upgrade FW logic */ | 2449 | /* upgrade FW logic */ |
2415 | ret = csio_hw_prep_fw(hw, fw_info, fw_data, fw_size, card_fw, | 2450 | ret = csio_hw_prep_fw(hw, fw_info, fw_data, fw_size, card_fw, |
2416 | hw->fw_state, reset); | 2451 | hw->fw_state, reset); |
diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h index 9e73ef771eb7..e351af6e7c81 100644 --- a/drivers/scsi/csiostor/csio_hw.h +++ b/drivers/scsi/csiostor/csio_hw.h | |||
@@ -639,6 +639,7 @@ int csio_handle_intr_status(struct csio_hw *, unsigned int, | |||
639 | 639 | ||
640 | fw_port_cap32_t fwcap_to_fwspeed(fw_port_cap32_t acaps); | 640 | fw_port_cap32_t fwcap_to_fwspeed(fw_port_cap32_t acaps); |
641 | fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16); | 641 | fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16); |
642 | fw_port_cap16_t fwcaps32_to_caps16(fw_port_cap32_t caps32); | ||
642 | fw_port_cap32_t lstatus_to_fwcap(u32 lstatus); | 643 | fw_port_cap32_t lstatus_to_fwcap(u32 lstatus); |
643 | 644 | ||
644 | int csio_hw_start(struct csio_hw *); | 645 | int csio_hw_start(struct csio_hw *); |
diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c index c026417269c3..6f13673d6aa0 100644 --- a/drivers/scsi/csiostor/csio_mb.c +++ b/drivers/scsi/csiostor/csio_mb.c | |||
@@ -368,7 +368,7 @@ csio_mb_port(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo, | |||
368 | FW_CMD_LEN16_V(sizeof(*cmdp) / 16)); | 368 | FW_CMD_LEN16_V(sizeof(*cmdp) / 16)); |
369 | 369 | ||
370 | if (fw_caps == FW_CAPS16) | 370 | if (fw_caps == FW_CAPS16) |
371 | cmdp->u.l1cfg.rcap = cpu_to_be32(fc); | 371 | cmdp->u.l1cfg.rcap = cpu_to_be32(fwcaps32_to_caps16(fc)); |
372 | else | 372 | else |
373 | cmdp->u.l1cfg32.rcap32 = cpu_to_be32(fc); | 373 | cmdp->u.l1cfg32.rcap32 = cpu_to_be32(fc); |
374 | } | 374 | } |
@@ -395,8 +395,8 @@ csio_mb_process_read_port_rsp(struct csio_hw *hw, struct csio_mb *mbp, | |||
395 | *pcaps = fwcaps16_to_caps32(ntohs(rsp->u.info.pcap)); | 395 | *pcaps = fwcaps16_to_caps32(ntohs(rsp->u.info.pcap)); |
396 | *acaps = fwcaps16_to_caps32(ntohs(rsp->u.info.acap)); | 396 | *acaps = fwcaps16_to_caps32(ntohs(rsp->u.info.acap)); |
397 | } else { | 397 | } else { |
398 | *pcaps = ntohs(rsp->u.info32.pcaps32); | 398 | *pcaps = be32_to_cpu(rsp->u.info32.pcaps32); |
399 | *acaps = ntohs(rsp->u.info32.acaps32); | 399 | *acaps = be32_to_cpu(rsp->u.info32.acaps32); |
400 | } | 400 | } |
401 | } | 401 | } |
402 | } | 402 | } |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index f02dcc875a09..ea4b0bb0c1cd 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -563,35 +563,13 @@ struct Scsi_Host *scsi_host_get(struct Scsi_Host *shost) | |||
563 | } | 563 | } |
564 | EXPORT_SYMBOL(scsi_host_get); | 564 | EXPORT_SYMBOL(scsi_host_get); |
565 | 565 | ||
566 | struct scsi_host_mq_in_flight { | ||
567 | int cnt; | ||
568 | }; | ||
569 | |||
570 | static void scsi_host_check_in_flight(struct request *rq, void *data, | ||
571 | bool reserved) | ||
572 | { | ||
573 | struct scsi_host_mq_in_flight *in_flight = data; | ||
574 | |||
575 | if (blk_mq_request_started(rq)) | ||
576 | in_flight->cnt++; | ||
577 | } | ||
578 | |||
579 | /** | 566 | /** |
580 | * scsi_host_busy - Return the host busy counter | 567 | * scsi_host_busy - Return the host busy counter |
581 | * @shost: Pointer to Scsi_Host to inc. | 568 | * @shost: Pointer to Scsi_Host to inc. |
582 | **/ | 569 | **/ |
583 | int scsi_host_busy(struct Scsi_Host *shost) | 570 | int scsi_host_busy(struct Scsi_Host *shost) |
584 | { | 571 | { |
585 | struct scsi_host_mq_in_flight in_flight = { | 572 | return atomic_read(&shost->host_busy); |
586 | .cnt = 0, | ||
587 | }; | ||
588 | |||
589 | if (!shost->use_blk_mq) | ||
590 | return atomic_read(&shost->host_busy); | ||
591 | |||
592 | blk_mq_tagset_busy_iter(&shost->tag_set, scsi_host_check_in_flight, | ||
593 | &in_flight); | ||
594 | return in_flight.cnt; | ||
595 | } | 573 | } |
596 | EXPORT_SYMBOL(scsi_host_busy); | 574 | EXPORT_SYMBOL(scsi_host_busy); |
597 | 575 | ||
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 58bb70b886d7..c120929d4ffe 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -976,7 +976,7 @@ static struct scsi_host_template hpsa_driver_template = { | |||
976 | #endif | 976 | #endif |
977 | .sdev_attrs = hpsa_sdev_attrs, | 977 | .sdev_attrs = hpsa_sdev_attrs, |
978 | .shost_attrs = hpsa_shost_attrs, | 978 | .shost_attrs = hpsa_shost_attrs, |
979 | .max_sectors = 1024, | 979 | .max_sectors = 2048, |
980 | .no_write_same = 1, | 980 | .no_write_same = 1, |
981 | }; | 981 | }; |
982 | 982 | ||
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index e0d0da5f43d6..43732e8d1347 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -672,7 +672,7 @@ struct lpfc_hba { | |||
672 | #define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ | 672 | #define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ |
673 | #define LS_IGNORE_ERATT 0x4 /* intr handler should ignore ERATT */ | 673 | #define LS_IGNORE_ERATT 0x4 /* intr handler should ignore ERATT */ |
674 | #define LS_MDS_LINK_DOWN 0x8 /* MDS Diagnostics Link Down */ | 674 | #define LS_MDS_LINK_DOWN 0x8 /* MDS Diagnostics Link Down */ |
675 | #define LS_MDS_LOOPBACK 0x16 /* MDS Diagnostics Link Up (Loopback) */ | 675 | #define LS_MDS_LOOPBACK 0x10 /* MDS Diagnostics Link Up (Loopback) */ |
676 | 676 | ||
677 | uint32_t hba_flag; /* hba generic flags */ | 677 | uint32_t hba_flag; /* hba generic flags */ |
678 | #define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */ | 678 | #define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */ |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 5a25553415f8..057a60abe664 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -5122,16 +5122,16 @@ LPFC_ATTR_R(enable_SmartSAN, 0, 0, 1, "Enable SmartSAN functionality"); | |||
5122 | 5122 | ||
5123 | /* | 5123 | /* |
5124 | # lpfc_fdmi_on: Controls FDMI support. | 5124 | # lpfc_fdmi_on: Controls FDMI support. |
5125 | # 0 No FDMI support (default) | 5125 | # 0 No FDMI support |
5126 | # 1 Traditional FDMI support | 5126 | # 1 Traditional FDMI support (default) |
5127 | # Traditional FDMI support means the driver will assume FDMI-2 support; | 5127 | # Traditional FDMI support means the driver will assume FDMI-2 support; |
5128 | # however, if that fails, it will fallback to FDMI-1. | 5128 | # however, if that fails, it will fallback to FDMI-1. |
5129 | # If lpfc_enable_SmartSAN is set to 1, the driver ignores lpfc_fdmi_on. | 5129 | # If lpfc_enable_SmartSAN is set to 1, the driver ignores lpfc_fdmi_on. |
5130 | # If lpfc_enable_SmartSAN is set 0, the driver uses the current value of | 5130 | # If lpfc_enable_SmartSAN is set 0, the driver uses the current value of |
5131 | # lpfc_fdmi_on. | 5131 | # lpfc_fdmi_on. |
5132 | # Value range [0,1]. Default value is 0. | 5132 | # Value range [0,1]. Default value is 1. |
5133 | */ | 5133 | */ |
5134 | LPFC_ATTR_R(fdmi_on, 0, 0, 1, "Enable FDMI support"); | 5134 | LPFC_ATTR_R(fdmi_on, 1, 0, 1, "Enable FDMI support"); |
5135 | 5135 | ||
5136 | /* | 5136 | /* |
5137 | # Specifies the maximum number of ELS cmds we can have outstanding (for | 5137 | # Specifies the maximum number of ELS cmds we can have outstanding (for |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 0adfb3bce0fd..eb97d2dd3651 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -345,8 +345,7 @@ static void scsi_dec_host_busy(struct Scsi_Host *shost) | |||
345 | unsigned long flags; | 345 | unsigned long flags; |
346 | 346 | ||
347 | rcu_read_lock(); | 347 | rcu_read_lock(); |
348 | if (!shost->use_blk_mq) | 348 | atomic_dec(&shost->host_busy); |
349 | atomic_dec(&shost->host_busy); | ||
350 | if (unlikely(scsi_host_in_recovery(shost))) { | 349 | if (unlikely(scsi_host_in_recovery(shost))) { |
351 | spin_lock_irqsave(shost->host_lock, flags); | 350 | spin_lock_irqsave(shost->host_lock, flags); |
352 | if (shost->host_failed || shost->host_eh_scheduled) | 351 | if (shost->host_failed || shost->host_eh_scheduled) |
@@ -445,12 +444,7 @@ static inline bool scsi_target_is_busy(struct scsi_target *starget) | |||
445 | 444 | ||
446 | static inline bool scsi_host_is_busy(struct Scsi_Host *shost) | 445 | static inline bool scsi_host_is_busy(struct Scsi_Host *shost) |
447 | { | 446 | { |
448 | /* | 447 | if (shost->can_queue > 0 && |
449 | * blk-mq can handle host queue busy efficiently via host-wide driver | ||
450 | * tag allocation | ||
451 | */ | ||
452 | |||
453 | if (!shost->use_blk_mq && shost->can_queue > 0 && | ||
454 | atomic_read(&shost->host_busy) >= shost->can_queue) | 448 | atomic_read(&shost->host_busy) >= shost->can_queue) |
455 | return true; | 449 | return true; |
456 | if (atomic_read(&shost->host_blocked) > 0) | 450 | if (atomic_read(&shost->host_blocked) > 0) |
@@ -1606,10 +1600,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q, | |||
1606 | if (scsi_host_in_recovery(shost)) | 1600 | if (scsi_host_in_recovery(shost)) |
1607 | return 0; | 1601 | return 0; |
1608 | 1602 | ||
1609 | if (!shost->use_blk_mq) | 1603 | busy = atomic_inc_return(&shost->host_busy) - 1; |
1610 | busy = atomic_inc_return(&shost->host_busy) - 1; | ||
1611 | else | ||
1612 | busy = 0; | ||
1613 | if (atomic_read(&shost->host_blocked) > 0) { | 1604 | if (atomic_read(&shost->host_blocked) > 0) { |
1614 | if (busy) | 1605 | if (busy) |
1615 | goto starved; | 1606 | goto starved; |
@@ -1625,7 +1616,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q, | |||
1625 | "unblocking host at zero depth\n")); | 1616 | "unblocking host at zero depth\n")); |
1626 | } | 1617 | } |
1627 | 1618 | ||
1628 | if (!shost->use_blk_mq && shost->can_queue > 0 && busy >= shost->can_queue) | 1619 | if (shost->can_queue > 0 && busy >= shost->can_queue) |
1629 | goto starved; | 1620 | goto starved; |
1630 | if (shost->host_self_blocked) | 1621 | if (shost->host_self_blocked) |
1631 | goto starved; | 1622 | goto starved; |
@@ -1711,9 +1702,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) | |||
1711 | * with the locks as normal issue path does. | 1702 | * with the locks as normal issue path does. |
1712 | */ | 1703 | */ |
1713 | atomic_inc(&sdev->device_busy); | 1704 | atomic_inc(&sdev->device_busy); |
1714 | 1705 | atomic_inc(&shost->host_busy); | |
1715 | if (!shost->use_blk_mq) | ||
1716 | atomic_inc(&shost->host_busy); | ||
1717 | if (starget->can_queue > 0) | 1706 | if (starget->can_queue > 0) |
1718 | atomic_inc(&starget->target_busy); | 1707 | atomic_inc(&starget->target_busy); |
1719 | 1708 | ||
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c index 768cce0ccb80..76a262674c8d 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c | |||
@@ -207,8 +207,8 @@ cxgbit_ddp_reserve(struct cxgbit_sock *csk, struct cxgbi_task_tag_info *ttinfo, | |||
207 | ret = dma_map_sg(&ppm->pdev->dev, sgl, sgcnt, DMA_FROM_DEVICE); | 207 | ret = dma_map_sg(&ppm->pdev->dev, sgl, sgcnt, DMA_FROM_DEVICE); |
208 | sgl->offset = sg_offset; | 208 | sgl->offset = sg_offset; |
209 | if (!ret) { | 209 | if (!ret) { |
210 | pr_info("%s: 0x%x, xfer %u, sgl %u dma mapping err.\n", | 210 | pr_debug("%s: 0x%x, xfer %u, sgl %u dma mapping err.\n", |
211 | __func__, 0, xferlen, sgcnt); | 211 | __func__, 0, xferlen, sgcnt); |
212 | goto rel_ppods; | 212 | goto rel_ppods; |
213 | } | 213 | } |
214 | 214 | ||
@@ -250,8 +250,8 @@ cxgbit_get_r2t_ttt(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
250 | 250 | ||
251 | ret = cxgbit_ddp_reserve(csk, ttinfo, cmd->se_cmd.data_length); | 251 | ret = cxgbit_ddp_reserve(csk, ttinfo, cmd->se_cmd.data_length); |
252 | if (ret < 0) { | 252 | if (ret < 0) { |
253 | pr_info("csk 0x%p, cmd 0x%p, xfer len %u, sgcnt %u no ddp.\n", | 253 | pr_debug("csk 0x%p, cmd 0x%p, xfer len %u, sgcnt %u no ddp.\n", |
254 | csk, cmd, cmd->se_cmd.data_length, ttinfo->nents); | 254 | csk, cmd, cmd->se_cmd.data_length, ttinfo->nents); |
255 | 255 | ||
256 | ttinfo->sgl = NULL; | 256 | ttinfo->sgl = NULL; |
257 | ttinfo->nents = 0; | 257 | ttinfo->nents = 0; |
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 0c3285c8db95..476dcbb79713 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c | |||
@@ -98,13 +98,13 @@ static int afs_proc_cells_write(struct file *file, char *buf, size_t size) | |||
98 | goto inval; | 98 | goto inval; |
99 | 99 | ||
100 | args = strchr(name, ' '); | 100 | args = strchr(name, ' '); |
101 | if (!args) | 101 | if (args) { |
102 | goto inval; | 102 | do { |
103 | do { | 103 | *args++ = 0; |
104 | *args++ = 0; | 104 | } while(*args == ' '); |
105 | } while(*args == ' '); | 105 | if (!*args) |
106 | if (!*args) | 106 | goto inval; |
107 | goto inval; | 107 | } |
108 | 108 | ||
109 | /* determine command to perform */ | 109 | /* determine command to perform */ |
110 | _debug("cmd=%s name=%s args=%s", buf, name, args); | 110 | _debug("cmd=%s name=%s args=%s", buf, name, args); |
@@ -120,7 +120,6 @@ static int afs_proc_cells_write(struct file *file, char *buf, size_t size) | |||
120 | 120 | ||
121 | if (test_and_set_bit(AFS_CELL_FL_NO_GC, &cell->flags)) | 121 | if (test_and_set_bit(AFS_CELL_FL_NO_GC, &cell->flags)) |
122 | afs_put_cell(net, cell); | 122 | afs_put_cell(net, cell); |
123 | printk("kAFS: Added new cell '%s'\n", name); | ||
124 | } else { | 123 | } else { |
125 | goto inval; | 124 | goto inval; |
126 | } | 125 | } |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 53af9f5253f4..2cddfe7806a4 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1280,6 +1280,7 @@ struct btrfs_root { | |||
1280 | int send_in_progress; | 1280 | int send_in_progress; |
1281 | struct btrfs_subvolume_writers *subv_writers; | 1281 | struct btrfs_subvolume_writers *subv_writers; |
1282 | atomic_t will_be_snapshotted; | 1282 | atomic_t will_be_snapshotted; |
1283 | atomic_t snapshot_force_cow; | ||
1283 | 1284 | ||
1284 | /* For qgroup metadata reserved space */ | 1285 | /* For qgroup metadata reserved space */ |
1285 | spinlock_t qgroup_meta_rsv_lock; | 1286 | spinlock_t qgroup_meta_rsv_lock; |
@@ -3390,9 +3391,9 @@ do { \ | |||
3390 | #define btrfs_debug(fs_info, fmt, args...) \ | 3391 | #define btrfs_debug(fs_info, fmt, args...) \ |
3391 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3392 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) |
3392 | #define btrfs_debug_in_rcu(fs_info, fmt, args...) \ | 3393 | #define btrfs_debug_in_rcu(fs_info, fmt, args...) \ |
3393 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3394 | btrfs_no_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args) |
3394 | #define btrfs_debug_rl_in_rcu(fs_info, fmt, args...) \ | 3395 | #define btrfs_debug_rl_in_rcu(fs_info, fmt, args...) \ |
3395 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3396 | btrfs_no_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args) |
3396 | #define btrfs_debug_rl(fs_info, fmt, args...) \ | 3397 | #define btrfs_debug_rl(fs_info, fmt, args...) \ |
3397 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3398 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) |
3398 | #endif | 3399 | #endif |
@@ -3404,6 +3405,13 @@ do { \ | |||
3404 | rcu_read_unlock(); \ | 3405 | rcu_read_unlock(); \ |
3405 | } while (0) | 3406 | } while (0) |
3406 | 3407 | ||
3408 | #define btrfs_no_printk_in_rcu(fs_info, fmt, args...) \ | ||
3409 | do { \ | ||
3410 | rcu_read_lock(); \ | ||
3411 | btrfs_no_printk(fs_info, fmt, ##args); \ | ||
3412 | rcu_read_unlock(); \ | ||
3413 | } while (0) | ||
3414 | |||
3407 | #define btrfs_printk_ratelimited(fs_info, fmt, args...) \ | 3415 | #define btrfs_printk_ratelimited(fs_info, fmt, args...) \ |
3408 | do { \ | 3416 | do { \ |
3409 | static DEFINE_RATELIMIT_STATE(_rs, \ | 3417 | static DEFINE_RATELIMIT_STATE(_rs, \ |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 5124c15705ce..05dc3c17cb62 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1187,6 +1187,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, | |||
1187 | atomic_set(&root->log_batch, 0); | 1187 | atomic_set(&root->log_batch, 0); |
1188 | refcount_set(&root->refs, 1); | 1188 | refcount_set(&root->refs, 1); |
1189 | atomic_set(&root->will_be_snapshotted, 0); | 1189 | atomic_set(&root->will_be_snapshotted, 0); |
1190 | atomic_set(&root->snapshot_force_cow, 0); | ||
1190 | root->log_transid = 0; | 1191 | root->log_transid = 0; |
1191 | root->log_transid_committed = -1; | 1192 | root->log_transid_committed = -1; |
1192 | root->last_log_commit = 0; | 1193 | root->last_log_commit = 0; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index de6f75f5547b..2d9074295d7f 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5800,7 +5800,7 @@ void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans) | |||
5800 | * root: the root of the parent directory | 5800 | * root: the root of the parent directory |
5801 | * rsv: block reservation | 5801 | * rsv: block reservation |
5802 | * items: the number of items that we need do reservation | 5802 | * items: the number of items that we need do reservation |
5803 | * qgroup_reserved: used to return the reserved size in qgroup | 5803 | * use_global_rsv: allow fallback to the global block reservation |
5804 | * | 5804 | * |
5805 | * This function is used to reserve the space for snapshot/subvolume | 5805 | * This function is used to reserve the space for snapshot/subvolume |
5806 | * creation and deletion. Those operations are different with the | 5806 | * creation and deletion. Those operations are different with the |
@@ -5810,10 +5810,10 @@ void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans) | |||
5810 | * the space reservation mechanism in start_transaction(). | 5810 | * the space reservation mechanism in start_transaction(). |
5811 | */ | 5811 | */ |
5812 | int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, | 5812 | int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, |
5813 | struct btrfs_block_rsv *rsv, | 5813 | struct btrfs_block_rsv *rsv, int items, |
5814 | int items, | ||
5815 | bool use_global_rsv) | 5814 | bool use_global_rsv) |
5816 | { | 5815 | { |
5816 | u64 qgroup_num_bytes = 0; | ||
5817 | u64 num_bytes; | 5817 | u64 num_bytes; |
5818 | int ret; | 5818 | int ret; |
5819 | struct btrfs_fs_info *fs_info = root->fs_info; | 5819 | struct btrfs_fs_info *fs_info = root->fs_info; |
@@ -5821,12 +5821,11 @@ int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, | |||
5821 | 5821 | ||
5822 | if (test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) { | 5822 | if (test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) { |
5823 | /* One for parent inode, two for dir entries */ | 5823 | /* One for parent inode, two for dir entries */ |
5824 | num_bytes = 3 * fs_info->nodesize; | 5824 | qgroup_num_bytes = 3 * fs_info->nodesize; |
5825 | ret = btrfs_qgroup_reserve_meta_prealloc(root, num_bytes, true); | 5825 | ret = btrfs_qgroup_reserve_meta_prealloc(root, |
5826 | qgroup_num_bytes, true); | ||
5826 | if (ret) | 5827 | if (ret) |
5827 | return ret; | 5828 | return ret; |
5828 | } else { | ||
5829 | num_bytes = 0; | ||
5830 | } | 5829 | } |
5831 | 5830 | ||
5832 | num_bytes = btrfs_calc_trans_metadata_size(fs_info, items); | 5831 | num_bytes = btrfs_calc_trans_metadata_size(fs_info, items); |
@@ -5838,8 +5837,8 @@ int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, | |||
5838 | if (ret == -ENOSPC && use_global_rsv) | 5837 | if (ret == -ENOSPC && use_global_rsv) |
5839 | ret = btrfs_block_rsv_migrate(global_rsv, rsv, num_bytes, 1); | 5838 | ret = btrfs_block_rsv_migrate(global_rsv, rsv, num_bytes, 1); |
5840 | 5839 | ||
5841 | if (ret && num_bytes) | 5840 | if (ret && qgroup_num_bytes) |
5842 | btrfs_qgroup_free_meta_prealloc(root, num_bytes); | 5841 | btrfs_qgroup_free_meta_prealloc(root, qgroup_num_bytes); |
5843 | 5842 | ||
5844 | return ret; | 5843 | return ret; |
5845 | } | 5844 | } |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 9357a19d2bff..3ea5339603cf 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1271,7 +1271,7 @@ static noinline int run_delalloc_nocow(struct inode *inode, | |||
1271 | u64 disk_num_bytes; | 1271 | u64 disk_num_bytes; |
1272 | u64 ram_bytes; | 1272 | u64 ram_bytes; |
1273 | int extent_type; | 1273 | int extent_type; |
1274 | int ret, err; | 1274 | int ret; |
1275 | int type; | 1275 | int type; |
1276 | int nocow; | 1276 | int nocow; |
1277 | int check_prev = 1; | 1277 | int check_prev = 1; |
@@ -1403,11 +1403,8 @@ next_slot: | |||
1403 | * if there are pending snapshots for this root, | 1403 | * if there are pending snapshots for this root, |
1404 | * we fall into common COW way. | 1404 | * we fall into common COW way. |
1405 | */ | 1405 | */ |
1406 | if (!nolock) { | 1406 | if (!nolock && atomic_read(&root->snapshot_force_cow)) |
1407 | err = btrfs_start_write_no_snapshotting(root); | 1407 | goto out_check; |
1408 | if (!err) | ||
1409 | goto out_check; | ||
1410 | } | ||
1411 | /* | 1408 | /* |
1412 | * force cow if csum exists in the range. | 1409 | * force cow if csum exists in the range. |
1413 | * this ensure that csum for a given extent are | 1410 | * this ensure that csum for a given extent are |
@@ -1416,9 +1413,6 @@ next_slot: | |||
1416 | ret = csum_exist_in_range(fs_info, disk_bytenr, | 1413 | ret = csum_exist_in_range(fs_info, disk_bytenr, |
1417 | num_bytes); | 1414 | num_bytes); |
1418 | if (ret) { | 1415 | if (ret) { |
1419 | if (!nolock) | ||
1420 | btrfs_end_write_no_snapshotting(root); | ||
1421 | |||
1422 | /* | 1416 | /* |
1423 | * ret could be -EIO if the above fails to read | 1417 | * ret could be -EIO if the above fails to read |
1424 | * metadata. | 1418 | * metadata. |
@@ -1431,11 +1425,8 @@ next_slot: | |||
1431 | WARN_ON_ONCE(nolock); | 1425 | WARN_ON_ONCE(nolock); |
1432 | goto out_check; | 1426 | goto out_check; |
1433 | } | 1427 | } |
1434 | if (!btrfs_inc_nocow_writers(fs_info, disk_bytenr)) { | 1428 | if (!btrfs_inc_nocow_writers(fs_info, disk_bytenr)) |
1435 | if (!nolock) | ||
1436 | btrfs_end_write_no_snapshotting(root); | ||
1437 | goto out_check; | 1429 | goto out_check; |
1438 | } | ||
1439 | nocow = 1; | 1430 | nocow = 1; |
1440 | } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) { | 1431 | } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) { |
1441 | extent_end = found_key.offset + | 1432 | extent_end = found_key.offset + |
@@ -1448,8 +1439,6 @@ next_slot: | |||
1448 | out_check: | 1439 | out_check: |
1449 | if (extent_end <= start) { | 1440 | if (extent_end <= start) { |
1450 | path->slots[0]++; | 1441 | path->slots[0]++; |
1451 | if (!nolock && nocow) | ||
1452 | btrfs_end_write_no_snapshotting(root); | ||
1453 | if (nocow) | 1442 | if (nocow) |
1454 | btrfs_dec_nocow_writers(fs_info, disk_bytenr); | 1443 | btrfs_dec_nocow_writers(fs_info, disk_bytenr); |
1455 | goto next_slot; | 1444 | goto next_slot; |
@@ -1471,8 +1460,6 @@ out_check: | |||
1471 | end, page_started, nr_written, 1, | 1460 | end, page_started, nr_written, 1, |
1472 | NULL); | 1461 | NULL); |
1473 | if (ret) { | 1462 | if (ret) { |
1474 | if (!nolock && nocow) | ||
1475 | btrfs_end_write_no_snapshotting(root); | ||
1476 | if (nocow) | 1463 | if (nocow) |
1477 | btrfs_dec_nocow_writers(fs_info, | 1464 | btrfs_dec_nocow_writers(fs_info, |
1478 | disk_bytenr); | 1465 | disk_bytenr); |
@@ -1492,8 +1479,6 @@ out_check: | |||
1492 | ram_bytes, BTRFS_COMPRESS_NONE, | 1479 | ram_bytes, BTRFS_COMPRESS_NONE, |
1493 | BTRFS_ORDERED_PREALLOC); | 1480 | BTRFS_ORDERED_PREALLOC); |
1494 | if (IS_ERR(em)) { | 1481 | if (IS_ERR(em)) { |
1495 | if (!nolock && nocow) | ||
1496 | btrfs_end_write_no_snapshotting(root); | ||
1497 | if (nocow) | 1482 | if (nocow) |
1498 | btrfs_dec_nocow_writers(fs_info, | 1483 | btrfs_dec_nocow_writers(fs_info, |
1499 | disk_bytenr); | 1484 | disk_bytenr); |
@@ -1532,8 +1517,6 @@ out_check: | |||
1532 | EXTENT_CLEAR_DATA_RESV, | 1517 | EXTENT_CLEAR_DATA_RESV, |
1533 | PAGE_UNLOCK | PAGE_SET_PRIVATE2); | 1518 | PAGE_UNLOCK | PAGE_SET_PRIVATE2); |
1534 | 1519 | ||
1535 | if (!nolock && nocow) | ||
1536 | btrfs_end_write_no_snapshotting(root); | ||
1537 | cur_offset = extent_end; | 1520 | cur_offset = extent_end; |
1538 | 1521 | ||
1539 | /* | 1522 | /* |
@@ -6639,6 +6622,8 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
6639 | drop_inode = 1; | 6622 | drop_inode = 1; |
6640 | } else { | 6623 | } else { |
6641 | struct dentry *parent = dentry->d_parent; | 6624 | struct dentry *parent = dentry->d_parent; |
6625 | int ret; | ||
6626 | |||
6642 | err = btrfs_update_inode(trans, root, inode); | 6627 | err = btrfs_update_inode(trans, root, inode); |
6643 | if (err) | 6628 | if (err) |
6644 | goto fail; | 6629 | goto fail; |
@@ -6652,7 +6637,12 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
6652 | goto fail; | 6637 | goto fail; |
6653 | } | 6638 | } |
6654 | d_instantiate(dentry, inode); | 6639 | d_instantiate(dentry, inode); |
6655 | btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent); | 6640 | ret = btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent, |
6641 | true, NULL); | ||
6642 | if (ret == BTRFS_NEED_TRANS_COMMIT) { | ||
6643 | err = btrfs_commit_transaction(trans); | ||
6644 | trans = NULL; | ||
6645 | } | ||
6656 | } | 6646 | } |
6657 | 6647 | ||
6658 | fail: | 6648 | fail: |
@@ -9388,14 +9378,21 @@ static int btrfs_rename_exchange(struct inode *old_dir, | |||
9388 | u64 new_idx = 0; | 9378 | u64 new_idx = 0; |
9389 | u64 root_objectid; | 9379 | u64 root_objectid; |
9390 | int ret; | 9380 | int ret; |
9391 | int ret2; | ||
9392 | bool root_log_pinned = false; | 9381 | bool root_log_pinned = false; |
9393 | bool dest_log_pinned = false; | 9382 | bool dest_log_pinned = false; |
9383 | struct btrfs_log_ctx ctx_root; | ||
9384 | struct btrfs_log_ctx ctx_dest; | ||
9385 | bool sync_log_root = false; | ||
9386 | bool sync_log_dest = false; | ||
9387 | bool commit_transaction = false; | ||
9394 | 9388 | ||
9395 | /* we only allow rename subvolume link between subvolumes */ | 9389 | /* we only allow rename subvolume link between subvolumes */ |
9396 | if (old_ino != BTRFS_FIRST_FREE_OBJECTID && root != dest) | 9390 | if (old_ino != BTRFS_FIRST_FREE_OBJECTID && root != dest) |
9397 | return -EXDEV; | 9391 | return -EXDEV; |
9398 | 9392 | ||
9393 | btrfs_init_log_ctx(&ctx_root, old_inode); | ||
9394 | btrfs_init_log_ctx(&ctx_dest, new_inode); | ||
9395 | |||
9399 | /* close the race window with snapshot create/destroy ioctl */ | 9396 | /* close the race window with snapshot create/destroy ioctl */ |
9400 | if (old_ino == BTRFS_FIRST_FREE_OBJECTID) | 9397 | if (old_ino == BTRFS_FIRST_FREE_OBJECTID) |
9401 | down_read(&fs_info->subvol_sem); | 9398 | down_read(&fs_info->subvol_sem); |
@@ -9542,15 +9539,29 @@ static int btrfs_rename_exchange(struct inode *old_dir, | |||
9542 | 9539 | ||
9543 | if (root_log_pinned) { | 9540 | if (root_log_pinned) { |
9544 | parent = new_dentry->d_parent; | 9541 | parent = new_dentry->d_parent; |
9545 | btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), | 9542 | ret = btrfs_log_new_name(trans, BTRFS_I(old_inode), |
9546 | parent); | 9543 | BTRFS_I(old_dir), parent, |
9544 | false, &ctx_root); | ||
9545 | if (ret == BTRFS_NEED_LOG_SYNC) | ||
9546 | sync_log_root = true; | ||
9547 | else if (ret == BTRFS_NEED_TRANS_COMMIT) | ||
9548 | commit_transaction = true; | ||
9549 | ret = 0; | ||
9547 | btrfs_end_log_trans(root); | 9550 | btrfs_end_log_trans(root); |
9548 | root_log_pinned = false; | 9551 | root_log_pinned = false; |
9549 | } | 9552 | } |
9550 | if (dest_log_pinned) { | 9553 | if (dest_log_pinned) { |
9551 | parent = old_dentry->d_parent; | 9554 | if (!commit_transaction) { |
9552 | btrfs_log_new_name(trans, BTRFS_I(new_inode), BTRFS_I(new_dir), | 9555 | parent = old_dentry->d_parent; |
9553 | parent); | 9556 | ret = btrfs_log_new_name(trans, BTRFS_I(new_inode), |
9557 | BTRFS_I(new_dir), parent, | ||
9558 | false, &ctx_dest); | ||
9559 | if (ret == BTRFS_NEED_LOG_SYNC) | ||
9560 | sync_log_dest = true; | ||
9561 | else if (ret == BTRFS_NEED_TRANS_COMMIT) | ||
9562 | commit_transaction = true; | ||
9563 | ret = 0; | ||
9564 | } | ||
9554 | btrfs_end_log_trans(dest); | 9565 | btrfs_end_log_trans(dest); |
9555 | dest_log_pinned = false; | 9566 | dest_log_pinned = false; |
9556 | } | 9567 | } |
@@ -9583,8 +9594,26 @@ out_fail: | |||
9583 | dest_log_pinned = false; | 9594 | dest_log_pinned = false; |
9584 | } | 9595 | } |
9585 | } | 9596 | } |
9586 | ret2 = btrfs_end_transaction(trans); | 9597 | if (!ret && sync_log_root && !commit_transaction) { |
9587 | ret = ret ? ret : ret2; | 9598 | ret = btrfs_sync_log(trans, BTRFS_I(old_inode)->root, |
9599 | &ctx_root); | ||
9600 | if (ret) | ||
9601 | commit_transaction = true; | ||
9602 | } | ||
9603 | if (!ret && sync_log_dest && !commit_transaction) { | ||
9604 | ret = btrfs_sync_log(trans, BTRFS_I(new_inode)->root, | ||
9605 | &ctx_dest); | ||
9606 | if (ret) | ||
9607 | commit_transaction = true; | ||
9608 | } | ||
9609 | if (commit_transaction) { | ||
9610 | ret = btrfs_commit_transaction(trans); | ||
9611 | } else { | ||
9612 | int ret2; | ||
9613 | |||
9614 | ret2 = btrfs_end_transaction(trans); | ||
9615 | ret = ret ? ret : ret2; | ||
9616 | } | ||
9588 | out_notrans: | 9617 | out_notrans: |
9589 | if (new_ino == BTRFS_FIRST_FREE_OBJECTID) | 9618 | if (new_ino == BTRFS_FIRST_FREE_OBJECTID) |
9590 | up_read(&fs_info->subvol_sem); | 9619 | up_read(&fs_info->subvol_sem); |
@@ -9661,6 +9690,9 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
9661 | int ret; | 9690 | int ret; |
9662 | u64 old_ino = btrfs_ino(BTRFS_I(old_inode)); | 9691 | u64 old_ino = btrfs_ino(BTRFS_I(old_inode)); |
9663 | bool log_pinned = false; | 9692 | bool log_pinned = false; |
9693 | struct btrfs_log_ctx ctx; | ||
9694 | bool sync_log = false; | ||
9695 | bool commit_transaction = false; | ||
9664 | 9696 | ||
9665 | if (btrfs_ino(BTRFS_I(new_dir)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) | 9697 | if (btrfs_ino(BTRFS_I(new_dir)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) |
9666 | return -EPERM; | 9698 | return -EPERM; |
@@ -9818,8 +9850,15 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
9818 | if (log_pinned) { | 9850 | if (log_pinned) { |
9819 | struct dentry *parent = new_dentry->d_parent; | 9851 | struct dentry *parent = new_dentry->d_parent; |
9820 | 9852 | ||
9821 | btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), | 9853 | btrfs_init_log_ctx(&ctx, old_inode); |
9822 | parent); | 9854 | ret = btrfs_log_new_name(trans, BTRFS_I(old_inode), |
9855 | BTRFS_I(old_dir), parent, | ||
9856 | false, &ctx); | ||
9857 | if (ret == BTRFS_NEED_LOG_SYNC) | ||
9858 | sync_log = true; | ||
9859 | else if (ret == BTRFS_NEED_TRANS_COMMIT) | ||
9860 | commit_transaction = true; | ||
9861 | ret = 0; | ||
9823 | btrfs_end_log_trans(root); | 9862 | btrfs_end_log_trans(root); |
9824 | log_pinned = false; | 9863 | log_pinned = false; |
9825 | } | 9864 | } |
@@ -9856,7 +9895,19 @@ out_fail: | |||
9856 | btrfs_end_log_trans(root); | 9895 | btrfs_end_log_trans(root); |
9857 | log_pinned = false; | 9896 | log_pinned = false; |
9858 | } | 9897 | } |
9859 | btrfs_end_transaction(trans); | 9898 | if (!ret && sync_log) { |
9899 | ret = btrfs_sync_log(trans, BTRFS_I(old_inode)->root, &ctx); | ||
9900 | if (ret) | ||
9901 | commit_transaction = true; | ||
9902 | } | ||
9903 | if (commit_transaction) { | ||
9904 | ret = btrfs_commit_transaction(trans); | ||
9905 | } else { | ||
9906 | int ret2; | ||
9907 | |||
9908 | ret2 = btrfs_end_transaction(trans); | ||
9909 | ret = ret ? ret : ret2; | ||
9910 | } | ||
9860 | out_notrans: | 9911 | out_notrans: |
9861 | if (old_ino == BTRFS_FIRST_FREE_OBJECTID) | 9912 | if (old_ino == BTRFS_FIRST_FREE_OBJECTID) |
9862 | up_read(&fs_info->subvol_sem); | 9913 | up_read(&fs_info->subvol_sem); |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 63600dc2ac4c..d60b6caf09e8 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -747,6 +747,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
747 | struct btrfs_pending_snapshot *pending_snapshot; | 747 | struct btrfs_pending_snapshot *pending_snapshot; |
748 | struct btrfs_trans_handle *trans; | 748 | struct btrfs_trans_handle *trans; |
749 | int ret; | 749 | int ret; |
750 | bool snapshot_force_cow = false; | ||
750 | 751 | ||
751 | if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state)) | 752 | if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state)) |
752 | return -EINVAL; | 753 | return -EINVAL; |
@@ -763,6 +764,11 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
763 | goto free_pending; | 764 | goto free_pending; |
764 | } | 765 | } |
765 | 766 | ||
767 | /* | ||
768 | * Force new buffered writes to reserve space even when NOCOW is | ||
769 | * possible. This is to avoid later writeback (running dealloc) to | ||
770 | * fallback to COW mode and unexpectedly fail with ENOSPC. | ||
771 | */ | ||
766 | atomic_inc(&root->will_be_snapshotted); | 772 | atomic_inc(&root->will_be_snapshotted); |
767 | smp_mb__after_atomic(); | 773 | smp_mb__after_atomic(); |
768 | /* wait for no snapshot writes */ | 774 | /* wait for no snapshot writes */ |
@@ -773,6 +779,14 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
773 | if (ret) | 779 | if (ret) |
774 | goto dec_and_free; | 780 | goto dec_and_free; |
775 | 781 | ||
782 | /* | ||
783 | * All previous writes have started writeback in NOCOW mode, so now | ||
784 | * we force future writes to fallback to COW mode during snapshot | ||
785 | * creation. | ||
786 | */ | ||
787 | atomic_inc(&root->snapshot_force_cow); | ||
788 | snapshot_force_cow = true; | ||
789 | |||
776 | btrfs_wait_ordered_extents(root, U64_MAX, 0, (u64)-1); | 790 | btrfs_wait_ordered_extents(root, U64_MAX, 0, (u64)-1); |
777 | 791 | ||
778 | btrfs_init_block_rsv(&pending_snapshot->block_rsv, | 792 | btrfs_init_block_rsv(&pending_snapshot->block_rsv, |
@@ -837,6 +851,8 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
837 | fail: | 851 | fail: |
838 | btrfs_subvolume_release_metadata(fs_info, &pending_snapshot->block_rsv); | 852 | btrfs_subvolume_release_metadata(fs_info, &pending_snapshot->block_rsv); |
839 | dec_and_free: | 853 | dec_and_free: |
854 | if (snapshot_force_cow) | ||
855 | atomic_dec(&root->snapshot_force_cow); | ||
840 | if (atomic_dec_and_test(&root->will_be_snapshotted)) | 856 | if (atomic_dec_and_test(&root->will_be_snapshotted)) |
841 | wake_up_var(&root->will_be_snapshotted); | 857 | wake_up_var(&root->will_be_snapshotted); |
842 | free_pending: | 858 | free_pending: |
@@ -3453,6 +3469,25 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen, | |||
3453 | 3469 | ||
3454 | same_lock_start = min_t(u64, loff, dst_loff); | 3470 | same_lock_start = min_t(u64, loff, dst_loff); |
3455 | same_lock_len = max_t(u64, loff, dst_loff) + len - same_lock_start; | 3471 | same_lock_len = max_t(u64, loff, dst_loff) + len - same_lock_start; |
3472 | } else { | ||
3473 | /* | ||
3474 | * If the source and destination inodes are different, the | ||
3475 | * source's range end offset matches the source's i_size, that | ||
3476 | * i_size is not a multiple of the sector size, and the | ||
3477 | * destination range does not go past the destination's i_size, | ||
3478 | * we must round down the length to the nearest sector size | ||
3479 | * multiple. If we don't do this adjustment we end replacing | ||
3480 | * with zeroes the bytes in the range that starts at the | ||
3481 | * deduplication range's end offset and ends at the next sector | ||
3482 | * size multiple. | ||
3483 | */ | ||
3484 | if (loff + olen == i_size_read(src) && | ||
3485 | dst_loff + len < i_size_read(dst)) { | ||
3486 | const u64 sz = BTRFS_I(src)->root->fs_info->sectorsize; | ||
3487 | |||
3488 | len = round_down(i_size_read(src), sz) - loff; | ||
3489 | olen = len; | ||
3490 | } | ||
3456 | } | 3491 | } |
3457 | 3492 | ||
3458 | again: | 3493 | again: |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 4353bb69bb86..d4917c0cddf5 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1019,10 +1019,9 @@ out_add_root: | |||
1019 | spin_unlock(&fs_info->qgroup_lock); | 1019 | spin_unlock(&fs_info->qgroup_lock); |
1020 | 1020 | ||
1021 | ret = btrfs_commit_transaction(trans); | 1021 | ret = btrfs_commit_transaction(trans); |
1022 | if (ret) { | 1022 | trans = NULL; |
1023 | trans = NULL; | 1023 | if (ret) |
1024 | goto out_free_path; | 1024 | goto out_free_path; |
1025 | } | ||
1026 | 1025 | ||
1027 | ret = qgroup_rescan_init(fs_info, 0, 1); | 1026 | ret = qgroup_rescan_init(fs_info, 0, 1); |
1028 | if (!ret) { | 1027 | if (!ret) { |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1650dc44a5e3..3c2ae0e4f25a 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -6025,14 +6025,25 @@ void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans, | |||
6025 | * Call this after adding a new name for a file and it will properly | 6025 | * Call this after adding a new name for a file and it will properly |
6026 | * update the log to reflect the new name. | 6026 | * update the log to reflect the new name. |
6027 | * | 6027 | * |
6028 | * It will return zero if all goes well, and it will return 1 if a | 6028 | * @ctx can not be NULL when @sync_log is false, and should be NULL when it's |
6029 | * full transaction commit is required. | 6029 | * true (because it's not used). |
6030 | * | ||
6031 | * Return value depends on whether @sync_log is true or false. | ||
6032 | * When true: returns BTRFS_NEED_TRANS_COMMIT if the transaction needs to be | ||
6033 | * committed by the caller, and BTRFS_DONT_NEED_TRANS_COMMIT | ||
6034 | * otherwise. | ||
6035 | * When false: returns BTRFS_DONT_NEED_LOG_SYNC if the caller does not need to | ||
6036 | * to sync the log, BTRFS_NEED_LOG_SYNC if it needs to sync the log, | ||
6037 | * or BTRFS_NEED_TRANS_COMMIT if the transaction needs to be | ||
6038 | * committed (without attempting to sync the log). | ||
6030 | */ | 6039 | */ |
6031 | int btrfs_log_new_name(struct btrfs_trans_handle *trans, | 6040 | int btrfs_log_new_name(struct btrfs_trans_handle *trans, |
6032 | struct btrfs_inode *inode, struct btrfs_inode *old_dir, | 6041 | struct btrfs_inode *inode, struct btrfs_inode *old_dir, |
6033 | struct dentry *parent) | 6042 | struct dentry *parent, |
6043 | bool sync_log, struct btrfs_log_ctx *ctx) | ||
6034 | { | 6044 | { |
6035 | struct btrfs_fs_info *fs_info = trans->fs_info; | 6045 | struct btrfs_fs_info *fs_info = trans->fs_info; |
6046 | int ret; | ||
6036 | 6047 | ||
6037 | /* | 6048 | /* |
6038 | * this will force the logging code to walk the dentry chain | 6049 | * this will force the logging code to walk the dentry chain |
@@ -6047,9 +6058,34 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans, | |||
6047 | */ | 6058 | */ |
6048 | if (inode->logged_trans <= fs_info->last_trans_committed && | 6059 | if (inode->logged_trans <= fs_info->last_trans_committed && |
6049 | (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed)) | 6060 | (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed)) |
6050 | return 0; | 6061 | return sync_log ? BTRFS_DONT_NEED_TRANS_COMMIT : |
6062 | BTRFS_DONT_NEED_LOG_SYNC; | ||
6063 | |||
6064 | if (sync_log) { | ||
6065 | struct btrfs_log_ctx ctx2; | ||
6066 | |||
6067 | btrfs_init_log_ctx(&ctx2, &inode->vfs_inode); | ||
6068 | ret = btrfs_log_inode_parent(trans, inode, parent, 0, LLONG_MAX, | ||
6069 | LOG_INODE_EXISTS, &ctx2); | ||
6070 | if (ret == BTRFS_NO_LOG_SYNC) | ||
6071 | return BTRFS_DONT_NEED_TRANS_COMMIT; | ||
6072 | else if (ret) | ||
6073 | return BTRFS_NEED_TRANS_COMMIT; | ||
6074 | |||
6075 | ret = btrfs_sync_log(trans, inode->root, &ctx2); | ||
6076 | if (ret) | ||
6077 | return BTRFS_NEED_TRANS_COMMIT; | ||
6078 | return BTRFS_DONT_NEED_TRANS_COMMIT; | ||
6079 | } | ||
6080 | |||
6081 | ASSERT(ctx); | ||
6082 | ret = btrfs_log_inode_parent(trans, inode, parent, 0, LLONG_MAX, | ||
6083 | LOG_INODE_EXISTS, ctx); | ||
6084 | if (ret == BTRFS_NO_LOG_SYNC) | ||
6085 | return BTRFS_DONT_NEED_LOG_SYNC; | ||
6086 | else if (ret) | ||
6087 | return BTRFS_NEED_TRANS_COMMIT; | ||
6051 | 6088 | ||
6052 | return btrfs_log_inode_parent(trans, inode, parent, 0, LLONG_MAX, | 6089 | return BTRFS_NEED_LOG_SYNC; |
6053 | LOG_INODE_EXISTS, NULL); | ||
6054 | } | 6090 | } |
6055 | 6091 | ||
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index 122e68b89a5a..7ab9bb88a639 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h | |||
@@ -71,8 +71,16 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, | |||
71 | int for_rename); | 71 | int for_rename); |
72 | void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans, | 72 | void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans, |
73 | struct btrfs_inode *dir); | 73 | struct btrfs_inode *dir); |
74 | /* Return values for btrfs_log_new_name() */ | ||
75 | enum { | ||
76 | BTRFS_DONT_NEED_TRANS_COMMIT, | ||
77 | BTRFS_NEED_TRANS_COMMIT, | ||
78 | BTRFS_DONT_NEED_LOG_SYNC, | ||
79 | BTRFS_NEED_LOG_SYNC, | ||
80 | }; | ||
74 | int btrfs_log_new_name(struct btrfs_trans_handle *trans, | 81 | int btrfs_log_new_name(struct btrfs_trans_handle *trans, |
75 | struct btrfs_inode *inode, struct btrfs_inode *old_dir, | 82 | struct btrfs_inode *inode, struct btrfs_inode *old_dir, |
76 | struct dentry *parent); | 83 | struct dentry *parent, |
84 | bool sync_log, struct btrfs_log_ctx *ctx); | ||
77 | 85 | ||
78 | #endif | 86 | #endif |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index da86706123ff..f4405e430da6 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -4491,7 +4491,12 @@ again: | |||
4491 | 4491 | ||
4492 | /* Now btrfs_update_device() will change the on-disk size. */ | 4492 | /* Now btrfs_update_device() will change the on-disk size. */ |
4493 | ret = btrfs_update_device(trans, device); | 4493 | ret = btrfs_update_device(trans, device); |
4494 | btrfs_end_transaction(trans); | 4494 | if (ret < 0) { |
4495 | btrfs_abort_transaction(trans, ret); | ||
4496 | btrfs_end_transaction(trans); | ||
4497 | } else { | ||
4498 | ret = btrfs_commit_transaction(trans); | ||
4499 | } | ||
4495 | done: | 4500 | done: |
4496 | btrfs_free_path(path); | 4501 | btrfs_free_path(path); |
4497 | if (ret) { | 4502 | if (ret) { |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 43ca3b763875..eab1359d0553 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -602,6 +602,8 @@ static int extra_mon_dispatch(struct ceph_client *client, struct ceph_msg *msg) | |||
602 | 602 | ||
603 | /* | 603 | /* |
604 | * create a new fs client | 604 | * create a new fs client |
605 | * | ||
606 | * Success or not, this function consumes @fsopt and @opt. | ||
605 | */ | 607 | */ |
606 | static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, | 608 | static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, |
607 | struct ceph_options *opt) | 609 | struct ceph_options *opt) |
@@ -609,17 +611,20 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, | |||
609 | struct ceph_fs_client *fsc; | 611 | struct ceph_fs_client *fsc; |
610 | int page_count; | 612 | int page_count; |
611 | size_t size; | 613 | size_t size; |
612 | int err = -ENOMEM; | 614 | int err; |
613 | 615 | ||
614 | fsc = kzalloc(sizeof(*fsc), GFP_KERNEL); | 616 | fsc = kzalloc(sizeof(*fsc), GFP_KERNEL); |
615 | if (!fsc) | 617 | if (!fsc) { |
616 | return ERR_PTR(-ENOMEM); | 618 | err = -ENOMEM; |
619 | goto fail; | ||
620 | } | ||
617 | 621 | ||
618 | fsc->client = ceph_create_client(opt, fsc); | 622 | fsc->client = ceph_create_client(opt, fsc); |
619 | if (IS_ERR(fsc->client)) { | 623 | if (IS_ERR(fsc->client)) { |
620 | err = PTR_ERR(fsc->client); | 624 | err = PTR_ERR(fsc->client); |
621 | goto fail; | 625 | goto fail; |
622 | } | 626 | } |
627 | opt = NULL; /* fsc->client now owns this */ | ||
623 | 628 | ||
624 | fsc->client->extra_mon_dispatch = extra_mon_dispatch; | 629 | fsc->client->extra_mon_dispatch = extra_mon_dispatch; |
625 | fsc->client->osdc.abort_on_full = true; | 630 | fsc->client->osdc.abort_on_full = true; |
@@ -677,6 +682,9 @@ fail_client: | |||
677 | ceph_destroy_client(fsc->client); | 682 | ceph_destroy_client(fsc->client); |
678 | fail: | 683 | fail: |
679 | kfree(fsc); | 684 | kfree(fsc); |
685 | if (opt) | ||
686 | ceph_destroy_options(opt); | ||
687 | destroy_mount_options(fsopt); | ||
680 | return ERR_PTR(err); | 688 | return ERR_PTR(err); |
681 | } | 689 | } |
682 | 690 | ||
@@ -1042,8 +1050,6 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type, | |||
1042 | fsc = create_fs_client(fsopt, opt); | 1050 | fsc = create_fs_client(fsopt, opt); |
1043 | if (IS_ERR(fsc)) { | 1051 | if (IS_ERR(fsc)) { |
1044 | res = ERR_CAST(fsc); | 1052 | res = ERR_CAST(fsc); |
1045 | destroy_mount_options(fsopt); | ||
1046 | ceph_destroy_options(opt); | ||
1047 | goto out_final; | 1053 | goto out_final; |
1048 | } | 1054 | } |
1049 | 1055 | ||
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index b380e0871372..a2b2355e7f01 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
@@ -105,9 +105,6 @@ convert_sfm_char(const __u16 src_char, char *target) | |||
105 | case SFM_LESSTHAN: | 105 | case SFM_LESSTHAN: |
106 | *target = '<'; | 106 | *target = '<'; |
107 | break; | 107 | break; |
108 | case SFM_SLASH: | ||
109 | *target = '\\'; | ||
110 | break; | ||
111 | case SFM_SPACE: | 108 | case SFM_SPACE: |
112 | *target = ' '; | 109 | *target = ' '; |
113 | break; | 110 | break; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index c832a8a1970a..7aa08dba4719 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2547,7 +2547,7 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
2547 | if (tcon == NULL) | 2547 | if (tcon == NULL) |
2548 | return -ENOMEM; | 2548 | return -ENOMEM; |
2549 | 2549 | ||
2550 | snprintf(unc, sizeof(unc), "\\\\%s\\IPC$", ses->serverName); | 2550 | snprintf(unc, sizeof(unc), "\\\\%s\\IPC$", ses->server->hostname); |
2551 | 2551 | ||
2552 | /* cannot fail */ | 2552 | /* cannot fail */ |
2553 | nls_codepage = load_nls_default(); | 2553 | nls_codepage = load_nls_default(); |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index d32eaa4b2437..6e8765f44508 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -467,6 +467,8 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path, | |||
467 | oparms.cifs_sb = cifs_sb; | 467 | oparms.cifs_sb = cifs_sb; |
468 | oparms.desired_access = GENERIC_READ; | 468 | oparms.desired_access = GENERIC_READ; |
469 | oparms.create_options = CREATE_NOT_DIR; | 469 | oparms.create_options = CREATE_NOT_DIR; |
470 | if (backup_cred(cifs_sb)) | ||
471 | oparms.create_options |= CREATE_OPEN_BACKUP_INTENT; | ||
470 | oparms.disposition = FILE_OPEN; | 472 | oparms.disposition = FILE_OPEN; |
471 | oparms.path = path; | 473 | oparms.path = path; |
472 | oparms.fid = &fid; | 474 | oparms.fid = &fid; |
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index db0453660ff6..6a9c47541c53 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c | |||
@@ -248,16 +248,20 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr) | |||
248 | * MacOS server pads after SMB2.1 write response with 3 bytes | 248 | * MacOS server pads after SMB2.1 write response with 3 bytes |
249 | * of junk. Other servers match RFC1001 len to actual | 249 | * of junk. Other servers match RFC1001 len to actual |
250 | * SMB2/SMB3 frame length (header + smb2 response specific data) | 250 | * SMB2/SMB3 frame length (header + smb2 response specific data) |
251 | * Some windows servers do too when compounding is used. | 251 | * Some windows servers also pad up to 8 bytes when compounding. |
252 | * Log the server error (once), but allow it and continue | 252 | * If pad is longer than eight bytes, log the server behavior |
253 | * (once), since may indicate a problem but allow it and continue | ||
253 | * since the frame is parseable. | 254 | * since the frame is parseable. |
254 | */ | 255 | */ |
255 | if (clc_len < len) { | 256 | if (clc_len < len) { |
256 | printk_once(KERN_WARNING | 257 | pr_warn_once( |
257 | "SMB2 server sent bad RFC1001 len %d not %d\n", | 258 | "srv rsp padded more than expected. Length %d not %d for cmd:%d mid:%llu\n", |
258 | len, clc_len); | 259 | len, clc_len, command, mid); |
259 | return 0; | 260 | return 0; |
260 | } | 261 | } |
262 | pr_warn_once( | ||
263 | "srv rsp too short, len %d not %d. cmd:%d mid:%llu\n", | ||
264 | len, clc_len, command, mid); | ||
261 | 265 | ||
262 | return 1; | 266 | return 1; |
263 | } | 267 | } |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 247a98e6c856..d954ce36b473 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -630,7 +630,10 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, | |||
630 | oparms.tcon = tcon; | 630 | oparms.tcon = tcon; |
631 | oparms.desired_access = FILE_READ_ATTRIBUTES; | 631 | oparms.desired_access = FILE_READ_ATTRIBUTES; |
632 | oparms.disposition = FILE_OPEN; | 632 | oparms.disposition = FILE_OPEN; |
633 | oparms.create_options = 0; | 633 | if (backup_cred(cifs_sb)) |
634 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
635 | else | ||
636 | oparms.create_options = 0; | ||
634 | oparms.fid = &fid; | 637 | oparms.fid = &fid; |
635 | oparms.reconnect = false; | 638 | oparms.reconnect = false; |
636 | 639 | ||
@@ -779,7 +782,10 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | |||
779 | oparms.tcon = tcon; | 782 | oparms.tcon = tcon; |
780 | oparms.desired_access = FILE_READ_EA; | 783 | oparms.desired_access = FILE_READ_EA; |
781 | oparms.disposition = FILE_OPEN; | 784 | oparms.disposition = FILE_OPEN; |
782 | oparms.create_options = 0; | 785 | if (backup_cred(cifs_sb)) |
786 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
787 | else | ||
788 | oparms.create_options = 0; | ||
783 | oparms.fid = &fid; | 789 | oparms.fid = &fid; |
784 | oparms.reconnect = false; | 790 | oparms.reconnect = false; |
785 | 791 | ||
@@ -858,7 +864,10 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, | |||
858 | oparms.tcon = tcon; | 864 | oparms.tcon = tcon; |
859 | oparms.desired_access = FILE_WRITE_EA; | 865 | oparms.desired_access = FILE_WRITE_EA; |
860 | oparms.disposition = FILE_OPEN; | 866 | oparms.disposition = FILE_OPEN; |
861 | oparms.create_options = 0; | 867 | if (backup_cred(cifs_sb)) |
868 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
869 | else | ||
870 | oparms.create_options = 0; | ||
862 | oparms.fid = &fid; | 871 | oparms.fid = &fid; |
863 | oparms.reconnect = false; | 872 | oparms.reconnect = false; |
864 | 873 | ||
@@ -1453,7 +1462,10 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, | |||
1453 | oparms.tcon = tcon; | 1462 | oparms.tcon = tcon; |
1454 | oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; | 1463 | oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; |
1455 | oparms.disposition = FILE_OPEN; | 1464 | oparms.disposition = FILE_OPEN; |
1456 | oparms.create_options = 0; | 1465 | if (backup_cred(cifs_sb)) |
1466 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
1467 | else | ||
1468 | oparms.create_options = 0; | ||
1457 | oparms.fid = fid; | 1469 | oparms.fid = fid; |
1458 | oparms.reconnect = false; | 1470 | oparms.reconnect = false; |
1459 | 1471 | ||
@@ -1857,7 +1869,10 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
1857 | oparms.tcon = tcon; | 1869 | oparms.tcon = tcon; |
1858 | oparms.desired_access = FILE_READ_ATTRIBUTES; | 1870 | oparms.desired_access = FILE_READ_ATTRIBUTES; |
1859 | oparms.disposition = FILE_OPEN; | 1871 | oparms.disposition = FILE_OPEN; |
1860 | oparms.create_options = 0; | 1872 | if (backup_cred(cifs_sb)) |
1873 | oparms.create_options = CREATE_OPEN_BACKUP_INTENT; | ||
1874 | else | ||
1875 | oparms.create_options = 0; | ||
1861 | oparms.fid = &fid; | 1876 | oparms.fid = &fid; |
1862 | oparms.reconnect = false; | 1877 | oparms.reconnect = false; |
1863 | 1878 | ||
@@ -3639,7 +3654,7 @@ struct smb_version_values smb21_values = { | |||
3639 | struct smb_version_values smb3any_values = { | 3654 | struct smb_version_values smb3any_values = { |
3640 | .version_string = SMB3ANY_VERSION_STRING, | 3655 | .version_string = SMB3ANY_VERSION_STRING, |
3641 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ | 3656 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ |
3642 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3657 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
3643 | .large_lock_type = 0, | 3658 | .large_lock_type = 0, |
3644 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3659 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
3645 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3660 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
@@ -3660,7 +3675,7 @@ struct smb_version_values smb3any_values = { | |||
3660 | struct smb_version_values smbdefault_values = { | 3675 | struct smb_version_values smbdefault_values = { |
3661 | .version_string = SMBDEFAULT_VERSION_STRING, | 3676 | .version_string = SMBDEFAULT_VERSION_STRING, |
3662 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ | 3677 | .protocol_id = SMB302_PROT_ID, /* doesn't matter, send protocol array */ |
3663 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3678 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
3664 | .large_lock_type = 0, | 3679 | .large_lock_type = 0, |
3665 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3680 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
3666 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3681 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
@@ -3681,7 +3696,7 @@ struct smb_version_values smbdefault_values = { | |||
3681 | struct smb_version_values smb30_values = { | 3696 | struct smb_version_values smb30_values = { |
3682 | .version_string = SMB30_VERSION_STRING, | 3697 | .version_string = SMB30_VERSION_STRING, |
3683 | .protocol_id = SMB30_PROT_ID, | 3698 | .protocol_id = SMB30_PROT_ID, |
3684 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3699 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
3685 | .large_lock_type = 0, | 3700 | .large_lock_type = 0, |
3686 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3701 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
3687 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3702 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
@@ -3702,7 +3717,7 @@ struct smb_version_values smb30_values = { | |||
3702 | struct smb_version_values smb302_values = { | 3717 | struct smb_version_values smb302_values = { |
3703 | .version_string = SMB302_VERSION_STRING, | 3718 | .version_string = SMB302_VERSION_STRING, |
3704 | .protocol_id = SMB302_PROT_ID, | 3719 | .protocol_id = SMB302_PROT_ID, |
3705 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3720 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
3706 | .large_lock_type = 0, | 3721 | .large_lock_type = 0, |
3707 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3722 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
3708 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3723 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
@@ -3723,7 +3738,7 @@ struct smb_version_values smb302_values = { | |||
3723 | struct smb_version_values smb311_values = { | 3738 | struct smb_version_values smb311_values = { |
3724 | .version_string = SMB311_VERSION_STRING, | 3739 | .version_string = SMB311_VERSION_STRING, |
3725 | .protocol_id = SMB311_PROT_ID, | 3740 | .protocol_id = SMB311_PROT_ID, |
3726 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION, | 3741 | .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_PERSISTENT_HANDLES | SMB2_GLOBAL_CAP_ENCRYPTION | SMB2_GLOBAL_CAP_DIRECTORY_LEASING, |
3727 | .large_lock_type = 0, | 3742 | .large_lock_type = 0, |
3728 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, | 3743 | .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, |
3729 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, | 3744 | .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 5740aa809be6..c08acfc77abc 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -2178,6 +2178,9 @@ SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, __u8 *oplock, | |||
2178 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) || | 2178 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) || |
2179 | *oplock == SMB2_OPLOCK_LEVEL_NONE) | 2179 | *oplock == SMB2_OPLOCK_LEVEL_NONE) |
2180 | req->RequestedOplockLevel = *oplock; | 2180 | req->RequestedOplockLevel = *oplock; |
2181 | else if (!(server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) && | ||
2182 | (oparms->create_options & CREATE_NOT_FILE)) | ||
2183 | req->RequestedOplockLevel = *oplock; /* no srv lease support */ | ||
2181 | else { | 2184 | else { |
2182 | rc = add_lease_context(server, iov, &n_iov, | 2185 | rc = add_lease_context(server, iov, &n_iov, |
2183 | oparms->fid->lease_key, oplock); | 2186 | oparms->fid->lease_key, oplock); |
diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c index 03b8ba933eb2..235b959fc2b3 100644 --- a/fs/nilfs2/alloc.c +++ b/fs/nilfs2/alloc.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * alloc.c - NILFS dat/inode allocator | 3 | * alloc.c - NILFS dat/inode allocator |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Originally written by Koji Sato. | 7 | * Originally written by Koji Sato. |
17 | * Two allocators were unified by Ryusuke Konishi and Amagai Yoshiji. | 8 | * Two allocators were unified by Ryusuke Konishi and Amagai Yoshiji. |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/alloc.h b/fs/nilfs2/alloc.h index 05149e606a78..0303c3968cee 100644 --- a/fs/nilfs2/alloc.h +++ b/fs/nilfs2/alloc.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * alloc.h - persistent object (dat entry/disk inode) allocator/deallocator | 3 | * alloc.h - persistent object (dat entry/disk inode) allocator/deallocator |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Originally written by Koji Sato. | 7 | * Originally written by Koji Sato. |
17 | * Two allocators were unified by Ryusuke Konishi and Amagai Yoshiji. | 8 | * Two allocators were unified by Ryusuke Konishi and Amagai Yoshiji. |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 01fb1831ca25..fb5a9a8a13cf 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * bmap.c - NILFS block mapping. | 3 | * bmap.c - NILFS block mapping. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h index 2b6ffbe5997a..2c63858e81c9 100644 --- a/fs/nilfs2/bmap.h +++ b/fs/nilfs2/bmap.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * bmap.h - NILFS block mapping. | 3 | * bmap.h - NILFS block mapping. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index dec98cab729d..ebb24a314f43 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * btnode.c - NILFS B-tree node cache | 3 | * btnode.c - NILFS B-tree node cache |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Originally written by Seiji Kihara. | 7 | * Originally written by Seiji Kihara. |
17 | * Fully revised by Ryusuke Konishi for stabilization and simplification. | 8 | * Fully revised by Ryusuke Konishi for stabilization and simplification. |
18 | * | 9 | * |
diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h index 4e8aaa1aeb65..0f88dbc9bcb3 100644 --- a/fs/nilfs2/btnode.h +++ b/fs/nilfs2/btnode.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * btnode.h - NILFS B-tree node cache | 3 | * btnode.h - NILFS B-tree node cache |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Seiji Kihara. | 7 | * Written by Seiji Kihara. |
17 | * Revised by Ryusuke Konishi. | 8 | * Revised by Ryusuke Konishi. |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 16a7a67a11c9..23e043eca237 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * btree.c - NILFS B-tree. | 3 | * btree.c - NILFS B-tree. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/btree.h b/fs/nilfs2/btree.h index 2184e47fa4bf..d1421b646ce4 100644 --- a/fs/nilfs2/btree.h +++ b/fs/nilfs2/btree.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * btree.h - NILFS B-tree. | 3 | * btree.h - NILFS B-tree. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index a15a1601e931..8d41311b5db4 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * cpfile.c - NILFS checkpoint file. | 3 | * cpfile.c - NILFS checkpoint file. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/cpfile.h b/fs/nilfs2/cpfile.h index 6eca972f9673..6336222df24a 100644 --- a/fs/nilfs2/cpfile.h +++ b/fs/nilfs2/cpfile.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * cpfile.h - NILFS checkpoint file. | 3 | * cpfile.h - NILFS checkpoint file. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c index dffedb2f8817..6f4066636be9 100644 --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * dat.c - NILFS disk address translation. | 3 | * dat.c - NILFS disk address translation. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/dat.h b/fs/nilfs2/dat.h index 57dc6cf466d0..b17ee34580ae 100644 --- a/fs/nilfs2/dat.h +++ b/fs/nilfs2/dat.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * dat.h - NILFS disk address translation. | 3 | * dat.h - NILFS disk address translation. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 582831ab3eb9..81394e22d0a0 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * dir.c - NILFS directory entry operations | 3 | * dir.c - NILFS directory entry operations |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Modified for NILFS by Amagai Yoshiji. | 7 | * Modified for NILFS by Amagai Yoshiji. |
17 | */ | 8 | */ |
18 | /* | 9 | /* |
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c index 96e3ed0d9652..533e24ea3a88 100644 --- a/fs/nilfs2/direct.c +++ b/fs/nilfs2/direct.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * direct.c - NILFS direct block pointer. | 3 | * direct.c - NILFS direct block pointer. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/direct.h b/fs/nilfs2/direct.h index cfe85e848bba..ec9a23c77994 100644 --- a/fs/nilfs2/direct.h +++ b/fs/nilfs2/direct.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * direct.h - NILFS direct block pointer. | 3 | * direct.h - NILFS direct block pointer. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index 7da0fac71dc2..64bc81363c6c 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * file.c - NILFS regular file handling primitives including fsync(). | 3 | * file.c - NILFS regular file handling primitives including fsync(). |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Amagai Yoshiji and Ryusuke Konishi. | 7 | * Written by Amagai Yoshiji and Ryusuke Konishi. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c index 853a831dcde0..aa3c328ee189 100644 --- a/fs/nilfs2/gcinode.c +++ b/fs/nilfs2/gcinode.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * gcinode.c - dummy inodes to buffer blocks for garbage collection | 3 | * gcinode.c - dummy inodes to buffer blocks for garbage collection |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Seiji Kihara, Amagai Yoshiji, and Ryusuke Konishi. | 7 | * Written by Seiji Kihara, Amagai Yoshiji, and Ryusuke Konishi. |
17 | * Revised by Ryusuke Konishi. | 8 | * Revised by Ryusuke Konishi. |
18 | * | 9 | * |
diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c index b8fa45c20c63..4140d232cadc 100644 --- a/fs/nilfs2/ifile.c +++ b/fs/nilfs2/ifile.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * ifile.c - NILFS inode file | 3 | * ifile.c - NILFS inode file |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Amagai Yoshiji. | 7 | * Written by Amagai Yoshiji. |
17 | * Revised by Ryusuke Konishi. | 8 | * Revised by Ryusuke Konishi. |
18 | * | 9 | * |
diff --git a/fs/nilfs2/ifile.h b/fs/nilfs2/ifile.h index 188b94fe0ec5..a1e1e5711a05 100644 --- a/fs/nilfs2/ifile.h +++ b/fs/nilfs2/ifile.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * ifile.h - NILFS inode file | 3 | * ifile.h - NILFS inode file |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Amagai Yoshiji. | 7 | * Written by Amagai Yoshiji. |
17 | * Revised by Ryusuke Konishi. | 8 | * Revised by Ryusuke Konishi. |
18 | * | 9 | * |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 6a612d832e7d..671085512e0f 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * inode.c - NILFS inode operations. | 3 | * inode.c - NILFS inode operations. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | * | 8 | * |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 1d2c3d7711fe..9b96d79eea6c 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * ioctl.c - NILFS ioctl operations. | 3 | * ioctl.c - NILFS ioctl operations. |
3 | * | 4 | * |
4 | * Copyright (C) 2007, 2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2007, 2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index c6bc1033e7d2..700870a92bc4 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * mdt.c - meta data file for NILFS | 3 | * mdt.c - meta data file for NILFS |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h index 3f67f3932097..e77aea4bb921 100644 --- a/fs/nilfs2/mdt.h +++ b/fs/nilfs2/mdt.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * mdt.h - NILFS meta data file prototype and definitions | 3 | * mdt.h - NILFS meta data file prototype and definitions |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index dd52d3f82e8d..9fe6d4ab74f0 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * namei.c - NILFS pathname lookup operations. | 3 | * namei.c - NILFS pathname lookup operations. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Modified for NILFS by Amagai Yoshiji and Ryusuke Konishi. | 7 | * Modified for NILFS by Amagai Yoshiji and Ryusuke Konishi. |
17 | */ | 8 | */ |
18 | /* | 9 | /* |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 33f8c8fc96e8..a2f247b6a209 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * nilfs.h - NILFS local header file. | 3 | * nilfs.h - NILFS local header file. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato and Ryusuke Konishi. | 7 | * Written by Koji Sato and Ryusuke Konishi. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 4cb850a6f1c2..329a056b73b1 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * page.c - buffer/page management specific to NILFS | 3 | * page.c - buffer/page management specific to NILFS |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi and Seiji Kihara. | 7 | * Written by Ryusuke Konishi and Seiji Kihara. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/page.h b/fs/nilfs2/page.h index f3687c958fa8..62b9bb469e92 100644 --- a/fs/nilfs2/page.h +++ b/fs/nilfs2/page.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * page.h - buffer/page management specific to NILFS | 3 | * page.h - buffer/page management specific to NILFS |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi and Seiji Kihara. | 7 | * Written by Ryusuke Konishi and Seiji Kihara. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 5139efed1888..140b663e91c7 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * recovery.c - NILFS recovery logic | 3 | * recovery.c - NILFS recovery logic |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 68cb9e4740b4..20c479b5e41b 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * segbuf.c - NILFS segment buffer | 3 | * segbuf.c - NILFS segment buffer |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | * | 8 | * |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/segbuf.h b/fs/nilfs2/segbuf.h index 10e16935fff6..9bea1bd59041 100644 --- a/fs/nilfs2/segbuf.h +++ b/fs/nilfs2/segbuf.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * segbuf.h - NILFS Segment buffer prototypes and definitions | 3 | * segbuf.h - NILFS Segment buffer prototypes and definitions |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | * | 8 | * |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 0953635e7d48..445eef41bfaf 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * segment.c - NILFS segment constructor. | 3 | * segment.c - NILFS segment constructor. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | * | 8 | * |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h index 04634e3e3d58..f5cf5308f3fc 100644 --- a/fs/nilfs2/segment.h +++ b/fs/nilfs2/segment.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * segment.h - NILFS Segment constructor prototypes and definitions | 3 | * segment.h - NILFS Segment constructor prototypes and definitions |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | * | 8 | * |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c index c7fa139d50e8..bf3f8f05c89b 100644 --- a/fs/nilfs2/sufile.c +++ b/fs/nilfs2/sufile.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * sufile.c - NILFS segment usage file. | 3 | * sufile.c - NILFS segment usage file. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | * Revised by Ryusuke Konishi. | 8 | * Revised by Ryusuke Konishi. |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h index 673a891350f4..c4e2c7a7add1 100644 --- a/fs/nilfs2/sufile.h +++ b/fs/nilfs2/sufile.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * sufile.h - NILFS segment usage file. | 3 | * sufile.h - NILFS segment usage file. |
3 | * | 4 | * |
4 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Koji Sato. | 7 | * Written by Koji Sato. |
17 | */ | 8 | */ |
18 | 9 | ||
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 1b9067cf4511..26290aa1023f 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * super.c - NILFS module and super block management. | 3 | * super.c - NILFS module and super block management. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | */ | 8 | */ |
18 | /* | 9 | /* |
diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c index 4b25837e7724..e60be7bb55b0 100644 --- a/fs/nilfs2/sysfs.c +++ b/fs/nilfs2/sysfs.c | |||
@@ -1,19 +1,10 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * sysfs.c - sysfs support implementation. | 3 | * sysfs.c - sysfs support implementation. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2014 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2014 Nippon Telegraph and Telephone Corporation. |
5 | * Copyright (C) 2014 HGST, Inc., a Western Digital Company. | 6 | * Copyright (C) 2014 HGST, Inc., a Western Digital Company. |
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * Written by Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com> | 8 | * Written by Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com> |
18 | */ | 9 | */ |
19 | 10 | ||
diff --git a/fs/nilfs2/sysfs.h b/fs/nilfs2/sysfs.h index 648cedf9c06e..d001eb862dae 100644 --- a/fs/nilfs2/sysfs.h +++ b/fs/nilfs2/sysfs.h | |||
@@ -1,19 +1,10 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * sysfs.h - sysfs support declarations. | 3 | * sysfs.h - sysfs support declarations. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2014 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2014 Nippon Telegraph and Telephone Corporation. |
5 | * Copyright (C) 2014 HGST, Inc., a Western Digital Company. | 6 | * Copyright (C) 2014 HGST, Inc., a Western Digital Company. |
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * Written by Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com> | 8 | * Written by Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com> |
18 | */ | 9 | */ |
19 | 10 | ||
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index 1a85317e83f0..484785cdf96e 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -1,18 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * the_nilfs.c - the_nilfs shared structure. | 3 | * the_nilfs.c - the_nilfs shared structure. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | * | 8 | * |
18 | */ | 9 | */ |
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index 36da1779f976..380a543c5b19 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h | |||
@@ -1,18 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
1 | /* | 2 | /* |
2 | * the_nilfs.h - the_nilfs shared structure. | 3 | * the_nilfs.h - the_nilfs shared structure. |
3 | * | 4 | * |
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | 5 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Written by Ryusuke Konishi. | 7 | * Written by Ryusuke Konishi. |
17 | * | 8 | * |
18 | */ | 9 | */ |
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index f174397b63a0..ababdbfab537 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -351,16 +351,9 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, | |||
351 | 351 | ||
352 | iter_info.srcu_idx = srcu_read_lock(&fsnotify_mark_srcu); | 352 | iter_info.srcu_idx = srcu_read_lock(&fsnotify_mark_srcu); |
353 | 353 | ||
354 | if ((mask & FS_MODIFY) || | 354 | iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = |
355 | (test_mask & to_tell->i_fsnotify_mask)) { | 355 | fsnotify_first_mark(&to_tell->i_fsnotify_marks); |
356 | iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = | 356 | if (mnt) { |
357 | fsnotify_first_mark(&to_tell->i_fsnotify_marks); | ||
358 | } | ||
359 | |||
360 | if (mnt && ((mask & FS_MODIFY) || | ||
361 | (test_mask & mnt->mnt_fsnotify_mask))) { | ||
362 | iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = | ||
363 | fsnotify_first_mark(&to_tell->i_fsnotify_marks); | ||
364 | iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] = | 357 | iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] = |
365 | fsnotify_first_mark(&mnt->mnt_fsnotify_marks); | 358 | fsnotify_first_mark(&mnt->mnt_fsnotify_marks); |
366 | } | 359 | } |
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 34aec30e06c7..6d766a19f2bb 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h | |||
@@ -56,6 +56,7 @@ struct blkcg { | |||
56 | struct list_head all_blkcgs_node; | 56 | struct list_head all_blkcgs_node; |
57 | #ifdef CONFIG_CGROUP_WRITEBACK | 57 | #ifdef CONFIG_CGROUP_WRITEBACK |
58 | struct list_head cgwb_list; | 58 | struct list_head cgwb_list; |
59 | refcount_t cgwb_refcnt; | ||
59 | #endif | 60 | #endif |
60 | }; | 61 | }; |
61 | 62 | ||
@@ -89,7 +90,6 @@ struct blkg_policy_data { | |||
89 | /* the blkg and policy id this per-policy data belongs to */ | 90 | /* the blkg and policy id this per-policy data belongs to */ |
90 | struct blkcg_gq *blkg; | 91 | struct blkcg_gq *blkg; |
91 | int plid; | 92 | int plid; |
92 | bool offline; | ||
93 | }; | 93 | }; |
94 | 94 | ||
95 | /* | 95 | /* |
@@ -387,6 +387,49 @@ static inline struct blkcg *cpd_to_blkcg(struct blkcg_policy_data *cpd) | |||
387 | return cpd ? cpd->blkcg : NULL; | 387 | return cpd ? cpd->blkcg : NULL; |
388 | } | 388 | } |
389 | 389 | ||
390 | extern void blkcg_destroy_blkgs(struct blkcg *blkcg); | ||
391 | |||
392 | #ifdef CONFIG_CGROUP_WRITEBACK | ||
393 | |||
394 | /** | ||
395 | * blkcg_cgwb_get - get a reference for blkcg->cgwb_list | ||
396 | * @blkcg: blkcg of interest | ||
397 | * | ||
398 | * This is used to track the number of active wb's related to a blkcg. | ||
399 | */ | ||
400 | static inline void blkcg_cgwb_get(struct blkcg *blkcg) | ||
401 | { | ||
402 | refcount_inc(&blkcg->cgwb_refcnt); | ||
403 | } | ||
404 | |||
405 | /** | ||
406 | * blkcg_cgwb_put - put a reference for @blkcg->cgwb_list | ||
407 | * @blkcg: blkcg of interest | ||
408 | * | ||
409 | * This is used to track the number of active wb's related to a blkcg. | ||
410 | * When this count goes to zero, all active wb has finished so the | ||
411 | * blkcg can continue destruction by calling blkcg_destroy_blkgs(). | ||
412 | * This work may occur in cgwb_release_workfn() on the cgwb_release | ||
413 | * workqueue. | ||
414 | */ | ||
415 | static inline void blkcg_cgwb_put(struct blkcg *blkcg) | ||
416 | { | ||
417 | if (refcount_dec_and_test(&blkcg->cgwb_refcnt)) | ||
418 | blkcg_destroy_blkgs(blkcg); | ||
419 | } | ||
420 | |||
421 | #else | ||
422 | |||
423 | static inline void blkcg_cgwb_get(struct blkcg *blkcg) { } | ||
424 | |||
425 | static inline void blkcg_cgwb_put(struct blkcg *blkcg) | ||
426 | { | ||
427 | /* wb isn't being accounted, so trigger destruction right away */ | ||
428 | blkcg_destroy_blkgs(blkcg); | ||
429 | } | ||
430 | |||
431 | #endif | ||
432 | |||
390 | /** | 433 | /** |
391 | * blkg_path - format cgroup path of blkg | 434 | * blkg_path - format cgroup path of blkg |
392 | * @blkg: blkg of interest | 435 | * @blkg: blkg of interest |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 99d366cb0e9f..d157983b84cf 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -3084,4 +3084,6 @@ | |||
3084 | 3084 | ||
3085 | #define PCI_VENDOR_ID_OCZ 0x1b85 | 3085 | #define PCI_VENDOR_ID_OCZ 0x1b85 |
3086 | 3086 | ||
3087 | #define PCI_VENDOR_ID_NCUBE 0x10ff | ||
3088 | |||
3087 | #endif /* _LINUX_PCI_IDS_H */ | 3089 | #endif /* _LINUX_PCI_IDS_H */ |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 7f2e16e76ac4..041f7e56a289 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -158,8 +158,10 @@ extern void syscall_unregfunc(void); | |||
158 | * For rcuidle callers, use srcu since sched-rcu \ | 158 | * For rcuidle callers, use srcu since sched-rcu \ |
159 | * doesn't work from the idle path. \ | 159 | * doesn't work from the idle path. \ |
160 | */ \ | 160 | */ \ |
161 | if (rcuidle) \ | 161 | if (rcuidle) { \ |
162 | idx = srcu_read_lock_notrace(&tracepoint_srcu); \ | 162 | idx = srcu_read_lock_notrace(&tracepoint_srcu); \ |
163 | rcu_irq_enter_irqson(); \ | ||
164 | } \ | ||
163 | \ | 165 | \ |
164 | it_func_ptr = rcu_dereference_raw((tp)->funcs); \ | 166 | it_func_ptr = rcu_dereference_raw((tp)->funcs); \ |
165 | \ | 167 | \ |
@@ -171,8 +173,10 @@ extern void syscall_unregfunc(void); | |||
171 | } while ((++it_func_ptr)->func); \ | 173 | } while ((++it_func_ptr)->func); \ |
172 | } \ | 174 | } \ |
173 | \ | 175 | \ |
174 | if (rcuidle) \ | 176 | if (rcuidle) { \ |
177 | rcu_irq_exit_irqson(); \ | ||
175 | srcu_read_unlock_notrace(&tracepoint_srcu, idx);\ | 178 | srcu_read_unlock_notrace(&tracepoint_srcu, idx);\ |
179 | } \ | ||
176 | \ | 180 | \ |
177 | preempt_enable_notrace(); \ | 181 | preempt_enable_notrace(); \ |
178 | } while (0) | 182 | } while (0) |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9a850973e09a..8ebabc9873d1 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -4865,8 +4865,8 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator); | |||
4865 | * | 4865 | * |
4866 | * Return: 0 on success. -ENODATA. | 4866 | * Return: 0 on success. -ENODATA. |
4867 | */ | 4867 | */ |
4868 | int reg_query_regdb_wmm(char *alpha2, int freq, u32 *ptr, | 4868 | int reg_query_regdb_wmm(char *alpha2, int freq, |
4869 | struct ieee80211_wmm_rule *rule); | 4869 | struct ieee80211_reg_rule *rule); |
4870 | 4870 | ||
4871 | /* | 4871 | /* |
4872 | * callbacks for asynchronous cfg80211 methods, notification | 4872 | * callbacks for asynchronous cfg80211 methods, notification |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index 60f8cc86a447..3469750df0f4 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
@@ -217,15 +217,15 @@ struct ieee80211_wmm_rule { | |||
217 | struct ieee80211_reg_rule { | 217 | struct ieee80211_reg_rule { |
218 | struct ieee80211_freq_range freq_range; | 218 | struct ieee80211_freq_range freq_range; |
219 | struct ieee80211_power_rule power_rule; | 219 | struct ieee80211_power_rule power_rule; |
220 | struct ieee80211_wmm_rule *wmm_rule; | 220 | struct ieee80211_wmm_rule wmm_rule; |
221 | u32 flags; | 221 | u32 flags; |
222 | u32 dfs_cac_ms; | 222 | u32 dfs_cac_ms; |
223 | bool has_wmm; | ||
223 | }; | 224 | }; |
224 | 225 | ||
225 | struct ieee80211_regdomain { | 226 | struct ieee80211_regdomain { |
226 | struct rcu_head rcu_head; | 227 | struct rcu_head rcu_head; |
227 | u32 n_reg_rules; | 228 | u32 n_reg_rules; |
228 | u32 n_wmm_rules; | ||
229 | char alpha2[3]; | 229 | char alpha2[3]; |
230 | enum nl80211_dfs_regions dfs_region; | 230 | enum nl80211_dfs_regions dfs_region; |
231 | struct ieee80211_reg_rule reg_rules[]; | 231 | struct ieee80211_reg_rule reg_rules[]; |
diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h index 7b8c9e19bad1..910cc4334b21 100644 --- a/include/uapi/linux/keyctl.h +++ b/include/uapi/linux/keyctl.h | |||
@@ -65,7 +65,7 @@ | |||
65 | 65 | ||
66 | /* keyctl structures */ | 66 | /* keyctl structures */ |
67 | struct keyctl_dh_params { | 67 | struct keyctl_dh_params { |
68 | __s32 private; | 68 | __s32 dh_private; |
69 | __s32 prime; | 69 | __s32 prime; |
70 | __s32 base; | 70 | __s32 base; |
71 | }; | 71 | }; |
diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h index dc520e1a4123..8b73cb603c5f 100644 --- a/include/uapi/linux/rds.h +++ b/include/uapi/linux/rds.h | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/types.h> | 38 | #include <linux/types.h> |
39 | #include <linux/socket.h> /* For __kernel_sockaddr_storage. */ | 39 | #include <linux/socket.h> /* For __kernel_sockaddr_storage. */ |
40 | #include <linux/in6.h> /* For struct in6_addr. */ | ||
40 | 41 | ||
41 | #define RDS_IB_ABI_VERSION 0x301 | 42 | #define RDS_IB_ABI_VERSION 0x301 |
42 | 43 | ||
diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index b1e22c40c4b6..84c3de89696a 100644 --- a/include/uapi/linux/vhost.h +++ b/include/uapi/linux/vhost.h | |||
@@ -176,7 +176,7 @@ struct vhost_memory { | |||
176 | #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1 | 176 | #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1 |
177 | 177 | ||
178 | #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64) | 178 | #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64) |
179 | #define VHOST_GET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x26, __u64) | 179 | #define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64) |
180 | 180 | ||
181 | /* VHOST_NET specific defines */ | 181 | /* VHOST_NET specific defines */ |
182 | 182 | ||
@@ -199,6 +199,7 @@ static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | ipc_unlock_object(ipcp); | 201 | ipc_unlock_object(ipcp); |
202 | ipcp = ERR_PTR(-EIDRM); | ||
202 | err: | 203 | err: |
203 | rcu_read_unlock(); | 204 | rcu_read_unlock(); |
204 | /* | 205 | /* |
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index cf5195c7c331..488ef9663c01 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c | |||
@@ -236,7 +236,7 @@ static int bpf_tcp_init(struct sock *sk) | |||
236 | } | 236 | } |
237 | 237 | ||
238 | static void smap_release_sock(struct smap_psock *psock, struct sock *sock); | 238 | static void smap_release_sock(struct smap_psock *psock, struct sock *sock); |
239 | static int free_start_sg(struct sock *sk, struct sk_msg_buff *md); | 239 | static int free_start_sg(struct sock *sk, struct sk_msg_buff *md, bool charge); |
240 | 240 | ||
241 | static void bpf_tcp_release(struct sock *sk) | 241 | static void bpf_tcp_release(struct sock *sk) |
242 | { | 242 | { |
@@ -248,7 +248,7 @@ static void bpf_tcp_release(struct sock *sk) | |||
248 | goto out; | 248 | goto out; |
249 | 249 | ||
250 | if (psock->cork) { | 250 | if (psock->cork) { |
251 | free_start_sg(psock->sock, psock->cork); | 251 | free_start_sg(psock->sock, psock->cork, true); |
252 | kfree(psock->cork); | 252 | kfree(psock->cork); |
253 | psock->cork = NULL; | 253 | psock->cork = NULL; |
254 | } | 254 | } |
@@ -330,14 +330,14 @@ static void bpf_tcp_close(struct sock *sk, long timeout) | |||
330 | close_fun = psock->save_close; | 330 | close_fun = psock->save_close; |
331 | 331 | ||
332 | if (psock->cork) { | 332 | if (psock->cork) { |
333 | free_start_sg(psock->sock, psock->cork); | 333 | free_start_sg(psock->sock, psock->cork, true); |
334 | kfree(psock->cork); | 334 | kfree(psock->cork); |
335 | psock->cork = NULL; | 335 | psock->cork = NULL; |
336 | } | 336 | } |
337 | 337 | ||
338 | list_for_each_entry_safe(md, mtmp, &psock->ingress, list) { | 338 | list_for_each_entry_safe(md, mtmp, &psock->ingress, list) { |
339 | list_del(&md->list); | 339 | list_del(&md->list); |
340 | free_start_sg(psock->sock, md); | 340 | free_start_sg(psock->sock, md, true); |
341 | kfree(md); | 341 | kfree(md); |
342 | } | 342 | } |
343 | 343 | ||
@@ -369,7 +369,7 @@ static void bpf_tcp_close(struct sock *sk, long timeout) | |||
369 | /* If another thread deleted this object skip deletion. | 369 | /* If another thread deleted this object skip deletion. |
370 | * The refcnt on psock may or may not be zero. | 370 | * The refcnt on psock may or may not be zero. |
371 | */ | 371 | */ |
372 | if (l) { | 372 | if (l && l == link) { |
373 | hlist_del_rcu(&link->hash_node); | 373 | hlist_del_rcu(&link->hash_node); |
374 | smap_release_sock(psock, link->sk); | 374 | smap_release_sock(psock, link->sk); |
375 | free_htab_elem(htab, link); | 375 | free_htab_elem(htab, link); |
@@ -570,14 +570,16 @@ static void free_bytes_sg(struct sock *sk, int bytes, | |||
570 | md->sg_start = i; | 570 | md->sg_start = i; |
571 | } | 571 | } |
572 | 572 | ||
573 | static int free_sg(struct sock *sk, int start, struct sk_msg_buff *md) | 573 | static int free_sg(struct sock *sk, int start, |
574 | struct sk_msg_buff *md, bool charge) | ||
574 | { | 575 | { |
575 | struct scatterlist *sg = md->sg_data; | 576 | struct scatterlist *sg = md->sg_data; |
576 | int i = start, free = 0; | 577 | int i = start, free = 0; |
577 | 578 | ||
578 | while (sg[i].length) { | 579 | while (sg[i].length) { |
579 | free += sg[i].length; | 580 | free += sg[i].length; |
580 | sk_mem_uncharge(sk, sg[i].length); | 581 | if (charge) |
582 | sk_mem_uncharge(sk, sg[i].length); | ||
581 | if (!md->skb) | 583 | if (!md->skb) |
582 | put_page(sg_page(&sg[i])); | 584 | put_page(sg_page(&sg[i])); |
583 | sg[i].length = 0; | 585 | sg[i].length = 0; |
@@ -594,9 +596,9 @@ static int free_sg(struct sock *sk, int start, struct sk_msg_buff *md) | |||
594 | return free; | 596 | return free; |
595 | } | 597 | } |
596 | 598 | ||
597 | static int free_start_sg(struct sock *sk, struct sk_msg_buff *md) | 599 | static int free_start_sg(struct sock *sk, struct sk_msg_buff *md, bool charge) |
598 | { | 600 | { |
599 | int free = free_sg(sk, md->sg_start, md); | 601 | int free = free_sg(sk, md->sg_start, md, charge); |
600 | 602 | ||
601 | md->sg_start = md->sg_end; | 603 | md->sg_start = md->sg_end; |
602 | return free; | 604 | return free; |
@@ -604,7 +606,7 @@ static int free_start_sg(struct sock *sk, struct sk_msg_buff *md) | |||
604 | 606 | ||
605 | static int free_curr_sg(struct sock *sk, struct sk_msg_buff *md) | 607 | static int free_curr_sg(struct sock *sk, struct sk_msg_buff *md) |
606 | { | 608 | { |
607 | return free_sg(sk, md->sg_curr, md); | 609 | return free_sg(sk, md->sg_curr, md, true); |
608 | } | 610 | } |
609 | 611 | ||
610 | static int bpf_map_msg_verdict(int _rc, struct sk_msg_buff *md) | 612 | static int bpf_map_msg_verdict(int _rc, struct sk_msg_buff *md) |
@@ -718,7 +720,7 @@ static int bpf_tcp_ingress(struct sock *sk, int apply_bytes, | |||
718 | list_add_tail(&r->list, &psock->ingress); | 720 | list_add_tail(&r->list, &psock->ingress); |
719 | sk->sk_data_ready(sk); | 721 | sk->sk_data_ready(sk); |
720 | } else { | 722 | } else { |
721 | free_start_sg(sk, r); | 723 | free_start_sg(sk, r, true); |
722 | kfree(r); | 724 | kfree(r); |
723 | } | 725 | } |
724 | 726 | ||
@@ -752,14 +754,10 @@ static int bpf_tcp_sendmsg_do_redirect(struct sock *sk, int send, | |||
752 | release_sock(sk); | 754 | release_sock(sk); |
753 | } | 755 | } |
754 | smap_release_sock(psock, sk); | 756 | smap_release_sock(psock, sk); |
755 | if (unlikely(err)) | 757 | return err; |
756 | goto out; | ||
757 | return 0; | ||
758 | out_rcu: | 758 | out_rcu: |
759 | rcu_read_unlock(); | 759 | rcu_read_unlock(); |
760 | out: | 760 | return 0; |
761 | free_bytes_sg(NULL, send, md, false); | ||
762 | return err; | ||
763 | } | 761 | } |
764 | 762 | ||
765 | static inline void bpf_md_init(struct smap_psock *psock) | 763 | static inline void bpf_md_init(struct smap_psock *psock) |
@@ -822,7 +820,7 @@ more_data: | |||
822 | case __SK_PASS: | 820 | case __SK_PASS: |
823 | err = bpf_tcp_push(sk, send, m, flags, true); | 821 | err = bpf_tcp_push(sk, send, m, flags, true); |
824 | if (unlikely(err)) { | 822 | if (unlikely(err)) { |
825 | *copied -= free_start_sg(sk, m); | 823 | *copied -= free_start_sg(sk, m, true); |
826 | break; | 824 | break; |
827 | } | 825 | } |
828 | 826 | ||
@@ -845,16 +843,17 @@ more_data: | |||
845 | lock_sock(sk); | 843 | lock_sock(sk); |
846 | 844 | ||
847 | if (unlikely(err < 0)) { | 845 | if (unlikely(err < 0)) { |
848 | free_start_sg(sk, m); | 846 | int free = free_start_sg(sk, m, false); |
847 | |||
849 | psock->sg_size = 0; | 848 | psock->sg_size = 0; |
850 | if (!cork) | 849 | if (!cork) |
851 | *copied -= send; | 850 | *copied -= free; |
852 | } else { | 851 | } else { |
853 | psock->sg_size -= send; | 852 | psock->sg_size -= send; |
854 | } | 853 | } |
855 | 854 | ||
856 | if (cork) { | 855 | if (cork) { |
857 | free_start_sg(sk, m); | 856 | free_start_sg(sk, m, true); |
858 | psock->sg_size = 0; | 857 | psock->sg_size = 0; |
859 | kfree(m); | 858 | kfree(m); |
860 | m = NULL; | 859 | m = NULL; |
@@ -912,6 +911,8 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, | |||
912 | 911 | ||
913 | if (unlikely(flags & MSG_ERRQUEUE)) | 912 | if (unlikely(flags & MSG_ERRQUEUE)) |
914 | return inet_recv_error(sk, msg, len, addr_len); | 913 | return inet_recv_error(sk, msg, len, addr_len); |
914 | if (!skb_queue_empty(&sk->sk_receive_queue)) | ||
915 | return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); | ||
915 | 916 | ||
916 | rcu_read_lock(); | 917 | rcu_read_lock(); |
917 | psock = smap_psock_sk(sk); | 918 | psock = smap_psock_sk(sk); |
@@ -922,9 +923,6 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, | |||
922 | goto out; | 923 | goto out; |
923 | rcu_read_unlock(); | 924 | rcu_read_unlock(); |
924 | 925 | ||
925 | if (!skb_queue_empty(&sk->sk_receive_queue)) | ||
926 | return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); | ||
927 | |||
928 | lock_sock(sk); | 926 | lock_sock(sk); |
929 | bytes_ready: | 927 | bytes_ready: |
930 | while (copied != len) { | 928 | while (copied != len) { |
@@ -1122,7 +1120,7 @@ wait_for_memory: | |||
1122 | err = sk_stream_wait_memory(sk, &timeo); | 1120 | err = sk_stream_wait_memory(sk, &timeo); |
1123 | if (err) { | 1121 | if (err) { |
1124 | if (m && m != psock->cork) | 1122 | if (m && m != psock->cork) |
1125 | free_start_sg(sk, m); | 1123 | free_start_sg(sk, m, true); |
1126 | goto out_err; | 1124 | goto out_err; |
1127 | } | 1125 | } |
1128 | } | 1126 | } |
@@ -1464,10 +1462,16 @@ static void smap_destroy_psock(struct rcu_head *rcu) | |||
1464 | schedule_work(&psock->gc_work); | 1462 | schedule_work(&psock->gc_work); |
1465 | } | 1463 | } |
1466 | 1464 | ||
1465 | static bool psock_is_smap_sk(struct sock *sk) | ||
1466 | { | ||
1467 | return inet_csk(sk)->icsk_ulp_ops == &bpf_tcp_ulp_ops; | ||
1468 | } | ||
1469 | |||
1467 | static void smap_release_sock(struct smap_psock *psock, struct sock *sock) | 1470 | static void smap_release_sock(struct smap_psock *psock, struct sock *sock) |
1468 | { | 1471 | { |
1469 | if (refcount_dec_and_test(&psock->refcnt)) { | 1472 | if (refcount_dec_and_test(&psock->refcnt)) { |
1470 | tcp_cleanup_ulp(sock); | 1473 | if (psock_is_smap_sk(sock)) |
1474 | tcp_cleanup_ulp(sock); | ||
1471 | write_lock_bh(&sock->sk_callback_lock); | 1475 | write_lock_bh(&sock->sk_callback_lock); |
1472 | smap_stop_sock(psock, sock); | 1476 | smap_stop_sock(psock, sock); |
1473 | write_unlock_bh(&sock->sk_callback_lock); | 1477 | write_unlock_bh(&sock->sk_callback_lock); |
@@ -1581,13 +1585,13 @@ static void smap_gc_work(struct work_struct *w) | |||
1581 | bpf_prog_put(psock->bpf_tx_msg); | 1585 | bpf_prog_put(psock->bpf_tx_msg); |
1582 | 1586 | ||
1583 | if (psock->cork) { | 1587 | if (psock->cork) { |
1584 | free_start_sg(psock->sock, psock->cork); | 1588 | free_start_sg(psock->sock, psock->cork, true); |
1585 | kfree(psock->cork); | 1589 | kfree(psock->cork); |
1586 | } | 1590 | } |
1587 | 1591 | ||
1588 | list_for_each_entry_safe(md, mtmp, &psock->ingress, list) { | 1592 | list_for_each_entry_safe(md, mtmp, &psock->ingress, list) { |
1589 | list_del(&md->list); | 1593 | list_del(&md->list); |
1590 | free_start_sg(psock->sock, md); | 1594 | free_start_sg(psock->sock, md, true); |
1591 | kfree(md); | 1595 | kfree(md); |
1592 | } | 1596 | } |
1593 | 1597 | ||
@@ -1894,6 +1898,10 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map, | |||
1894 | * doesn't update user data. | 1898 | * doesn't update user data. |
1895 | */ | 1899 | */ |
1896 | if (psock) { | 1900 | if (psock) { |
1901 | if (!psock_is_smap_sk(sock)) { | ||
1902 | err = -EBUSY; | ||
1903 | goto out_progs; | ||
1904 | } | ||
1897 | if (READ_ONCE(psock->bpf_parse) && parse) { | 1905 | if (READ_ONCE(psock->bpf_parse) && parse) { |
1898 | err = -EBUSY; | 1906 | err = -EBUSY; |
1899 | goto out_progs; | 1907 | goto out_progs; |
diff --git a/kernel/cpu.c b/kernel/cpu.c index aa7fe85ad62e..0097acec1c71 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -607,15 +607,15 @@ static void cpuhp_thread_fun(unsigned int cpu) | |||
607 | bool bringup = st->bringup; | 607 | bool bringup = st->bringup; |
608 | enum cpuhp_state state; | 608 | enum cpuhp_state state; |
609 | 609 | ||
610 | if (WARN_ON_ONCE(!st->should_run)) | ||
611 | return; | ||
612 | |||
610 | /* | 613 | /* |
611 | * ACQUIRE for the cpuhp_should_run() load of ->should_run. Ensures | 614 | * ACQUIRE for the cpuhp_should_run() load of ->should_run. Ensures |
612 | * that if we see ->should_run we also see the rest of the state. | 615 | * that if we see ->should_run we also see the rest of the state. |
613 | */ | 616 | */ |
614 | smp_mb(); | 617 | smp_mb(); |
615 | 618 | ||
616 | if (WARN_ON_ONCE(!st->should_run)) | ||
617 | return; | ||
618 | |||
619 | cpuhp_lock_acquire(bringup); | 619 | cpuhp_lock_acquire(bringup); |
620 | 620 | ||
621 | if (st->single) { | 621 | if (st->single) { |
@@ -916,7 +916,8 @@ static int cpuhp_down_callbacks(unsigned int cpu, struct cpuhp_cpu_state *st, | |||
916 | ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); | 916 | ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); |
917 | if (ret) { | 917 | if (ret) { |
918 | st->target = prev_state; | 918 | st->target = prev_state; |
919 | undo_cpu_down(cpu, st); | 919 | if (st->state < prev_state) |
920 | undo_cpu_down(cpu, st); | ||
920 | break; | 921 | break; |
921 | } | 922 | } |
922 | } | 923 | } |
@@ -969,7 +970,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen, | |||
969 | * to do the further cleanups. | 970 | * to do the further cleanups. |
970 | */ | 971 | */ |
971 | ret = cpuhp_down_callbacks(cpu, st, target); | 972 | ret = cpuhp_down_callbacks(cpu, st, target); |
972 | if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) { | 973 | if (ret && st->state == CPUHP_TEARDOWN_CPU && st->state < prev_state) { |
973 | cpuhp_reset_state(st, prev_state); | 974 | cpuhp_reset_state(st, prev_state); |
974 | __cpuhp_kick_ap(st); | 975 | __cpuhp_kick_ap(st); |
975 | } | 976 | } |
diff --git a/kernel/fork.c b/kernel/fork.c index d896e9ca38b0..f0b58479534f 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -550,8 +550,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, | |||
550 | goto out; | 550 | goto out; |
551 | } | 551 | } |
552 | /* a new mm has just been created */ | 552 | /* a new mm has just been created */ |
553 | arch_dup_mmap(oldmm, mm); | 553 | retval = arch_dup_mmap(oldmm, mm); |
554 | retval = 0; | ||
555 | out: | 554 | out: |
556 | up_write(&mm->mmap_sem); | 555 | up_write(&mm->mmap_sem); |
557 | flush_tlb_mm(oldmm); | 556 | flush_tlb_mm(oldmm); |
diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c index a0a74c533e4b..0913b4d385de 100644 --- a/kernel/printk/printk_safe.c +++ b/kernel/printk/printk_safe.c | |||
@@ -306,12 +306,12 @@ static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args) | |||
306 | return printk_safe_log_store(s, fmt, args); | 306 | return printk_safe_log_store(s, fmt, args); |
307 | } | 307 | } |
308 | 308 | ||
309 | void printk_nmi_enter(void) | 309 | void notrace printk_nmi_enter(void) |
310 | { | 310 | { |
311 | this_cpu_or(printk_context, PRINTK_NMI_CONTEXT_MASK); | 311 | this_cpu_or(printk_context, PRINTK_NMI_CONTEXT_MASK); |
312 | } | 312 | } |
313 | 313 | ||
314 | void printk_nmi_exit(void) | 314 | void notrace printk_nmi_exit(void) |
315 | { | 315 | { |
316 | this_cpu_and(printk_context, ~PRINTK_NMI_CONTEXT_MASK); | 316 | this_cpu_and(printk_context, ~PRINTK_NMI_CONTEXT_MASK); |
317 | } | 317 | } |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 613316724c6a..4966c4fbe7f7 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -1277,13 +1277,13 @@ config WARN_ALL_UNSEEDED_RANDOM | |||
1277 | time. This is really bad from a security perspective, and | 1277 | time. This is really bad from a security perspective, and |
1278 | so architecture maintainers really need to do what they can | 1278 | so architecture maintainers really need to do what they can |
1279 | to get the CRNG seeded sooner after the system is booted. | 1279 | to get the CRNG seeded sooner after the system is booted. |
1280 | However, since users can not do anything actionble to | 1280 | However, since users cannot do anything actionable to |
1281 | address this, by default the kernel will issue only a single | 1281 | address this, by default the kernel will issue only a single |
1282 | warning for the first use of unseeded randomness. | 1282 | warning for the first use of unseeded randomness. |
1283 | 1283 | ||
1284 | Say Y here if you want to receive warnings for all uses of | 1284 | Say Y here if you want to receive warnings for all uses of |
1285 | unseeded randomness. This will be of use primarily for | 1285 | unseeded randomness. This will be of use primarily for |
1286 | those developers interersted in improving the security of | 1286 | those developers interested in improving the security of |
1287 | Linux kernels running on their architecture (or | 1287 | Linux kernels running on their architecture (or |
1288 | subarchitecture). | 1288 | subarchitecture). |
1289 | 1289 | ||
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index f5981e9d6ae2..8a8bb8796c6c 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -491,6 +491,7 @@ static void cgwb_release_workfn(struct work_struct *work) | |||
491 | { | 491 | { |
492 | struct bdi_writeback *wb = container_of(work, struct bdi_writeback, | 492 | struct bdi_writeback *wb = container_of(work, struct bdi_writeback, |
493 | release_work); | 493 | release_work); |
494 | struct blkcg *blkcg = css_to_blkcg(wb->blkcg_css); | ||
494 | 495 | ||
495 | mutex_lock(&wb->bdi->cgwb_release_mutex); | 496 | mutex_lock(&wb->bdi->cgwb_release_mutex); |
496 | wb_shutdown(wb); | 497 | wb_shutdown(wb); |
@@ -499,6 +500,9 @@ static void cgwb_release_workfn(struct work_struct *work) | |||
499 | css_put(wb->blkcg_css); | 500 | css_put(wb->blkcg_css); |
500 | mutex_unlock(&wb->bdi->cgwb_release_mutex); | 501 | mutex_unlock(&wb->bdi->cgwb_release_mutex); |
501 | 502 | ||
503 | /* triggers blkg destruction if cgwb_refcnt becomes zero */ | ||
504 | blkcg_cgwb_put(blkcg); | ||
505 | |||
502 | fprop_local_destroy_percpu(&wb->memcg_completions); | 506 | fprop_local_destroy_percpu(&wb->memcg_completions); |
503 | percpu_ref_exit(&wb->refcnt); | 507 | percpu_ref_exit(&wb->refcnt); |
504 | wb_exit(wb); | 508 | wb_exit(wb); |
@@ -597,6 +601,7 @@ static int cgwb_create(struct backing_dev_info *bdi, | |||
597 | list_add_tail_rcu(&wb->bdi_node, &bdi->wb_list); | 601 | list_add_tail_rcu(&wb->bdi_node, &bdi->wb_list); |
598 | list_add(&wb->memcg_node, memcg_cgwb_list); | 602 | list_add(&wb->memcg_node, memcg_cgwb_list); |
599 | list_add(&wb->blkcg_node, blkcg_cgwb_list); | 603 | list_add(&wb->blkcg_node, blkcg_cgwb_list); |
604 | blkcg_cgwb_get(blkcg); | ||
600 | css_get(memcg_css); | 605 | css_get(memcg_css); |
601 | css_get(blkcg_css); | 606 | css_get(blkcg_css); |
602 | } | 607 | } |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c3bc7e9c9a2a..533f9b00147d 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -821,11 +821,11 @@ vm_fault_t vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, | |||
821 | * but we need to be consistent with PTEs and architectures that | 821 | * but we need to be consistent with PTEs and architectures that |
822 | * can't support a 'special' bit. | 822 | * can't support a 'special' bit. |
823 | */ | 823 | */ |
824 | BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))); | 824 | BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) && |
825 | !pfn_t_devmap(pfn)); | ||
825 | BUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) == | 826 | BUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) == |
826 | (VM_PFNMAP|VM_MIXEDMAP)); | 827 | (VM_PFNMAP|VM_MIXEDMAP)); |
827 | BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); | 828 | BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); |
828 | BUG_ON(!pfn_t_devmap(pfn)); | ||
829 | 829 | ||
830 | if (addr < vma->vm_start || addr >= vma->vm_end) | 830 | if (addr < vma->vm_start || addr >= vma->vm_end) |
831 | return VM_FAULT_SIGBUS; | 831 | return VM_FAULT_SIGBUS; |
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 9a085d525bbc..17dd883198ae 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -2097,6 +2097,11 @@ static int __init kmemleak_late_init(void) | |||
2097 | 2097 | ||
2098 | kmemleak_initialized = 1; | 2098 | kmemleak_initialized = 1; |
2099 | 2099 | ||
2100 | dentry = debugfs_create_file("kmemleak", 0644, NULL, NULL, | ||
2101 | &kmemleak_fops); | ||
2102 | if (!dentry) | ||
2103 | pr_warn("Failed to create the debugfs kmemleak file\n"); | ||
2104 | |||
2100 | if (kmemleak_error) { | 2105 | if (kmemleak_error) { |
2101 | /* | 2106 | /* |
2102 | * Some error occurred and kmemleak was disabled. There is a | 2107 | * Some error occurred and kmemleak was disabled. There is a |
@@ -2108,10 +2113,6 @@ static int __init kmemleak_late_init(void) | |||
2108 | return -ENOMEM; | 2113 | return -ENOMEM; |
2109 | } | 2114 | } |
2110 | 2115 | ||
2111 | dentry = debugfs_create_file("kmemleak", 0644, NULL, NULL, | ||
2112 | &kmemleak_fops); | ||
2113 | if (!dentry) | ||
2114 | pr_warn("Failed to create the debugfs kmemleak file\n"); | ||
2115 | mutex_lock(&scan_mutex); | 2116 | mutex_lock(&scan_mutex); |
2116 | start_scan_thread(); | 2117 | start_scan_thread(); |
2117 | mutex_unlock(&scan_mutex); | 2118 | mutex_unlock(&scan_mutex); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 4ead5a4817de..e79cb59552d9 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1701,8 +1701,6 @@ static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int | |||
1701 | if (mem_cgroup_out_of_memory(memcg, mask, order)) | 1701 | if (mem_cgroup_out_of_memory(memcg, mask, order)) |
1702 | return OOM_SUCCESS; | 1702 | return OOM_SUCCESS; |
1703 | 1703 | ||
1704 | WARN(1,"Memory cgroup charge failed because of no reclaimable memory! " | ||
1705 | "This looks like a misconfiguration or a kernel bug."); | ||
1706 | return OOM_FAILED; | 1704 | return OOM_FAILED; |
1707 | } | 1705 | } |
1708 | 1706 | ||
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 9eea6e809a4e..38d94b703e9d 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1333,7 +1333,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end) | |||
1333 | if (__PageMovable(page)) | 1333 | if (__PageMovable(page)) |
1334 | return pfn; | 1334 | return pfn; |
1335 | if (PageHuge(page)) { | 1335 | if (PageHuge(page)) { |
1336 | if (page_huge_active(page)) | 1336 | if (hugepage_migration_supported(page_hstate(page)) && |
1337 | page_huge_active(page)) | ||
1337 | return pfn; | 1338 | return pfn; |
1338 | else | 1339 | else |
1339 | pfn = round_up(pfn + 1, | 1340 | pfn = round_up(pfn + 1, |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index b5b25e4dcbbb..f10aa5360616 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -522,6 +522,7 @@ bool __oom_reap_task_mm(struct mm_struct *mm) | |||
522 | 522 | ||
523 | tlb_gather_mmu(&tlb, mm, start, end); | 523 | tlb_gather_mmu(&tlb, mm, start, end); |
524 | if (mmu_notifier_invalidate_range_start_nonblock(mm, start, end)) { | 524 | if (mmu_notifier_invalidate_range_start_nonblock(mm, start, end)) { |
525 | tlb_finish_mmu(&tlb, start, end); | ||
525 | ret = false; | 526 | ret = false; |
526 | continue; | 527 | continue; |
527 | } | 528 | } |
@@ -1103,10 +1104,17 @@ bool out_of_memory(struct oom_control *oc) | |||
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | select_bad_process(oc); | 1106 | select_bad_process(oc); |
1106 | /* Found nothing?!?! Either we hang forever, or we panic. */ | 1107 | /* Found nothing?!?! */ |
1107 | if (!oc->chosen && !is_sysrq_oom(oc) && !is_memcg_oom(oc)) { | 1108 | if (!oc->chosen) { |
1108 | dump_header(oc, NULL); | 1109 | dump_header(oc, NULL); |
1109 | panic("Out of memory and no killable processes...\n"); | 1110 | pr_warn("Out of memory and no killable processes...\n"); |
1111 | /* | ||
1112 | * If we got here due to an actual allocation at the | ||
1113 | * system level, we cannot survive this and will enter | ||
1114 | * an endless loop in the allocator. Bail out now. | ||
1115 | */ | ||
1116 | if (!is_sysrq_oom(oc) && !is_memcg_oom(oc)) | ||
1117 | panic("System is deadlocked on memory\n"); | ||
1110 | } | 1118 | } |
1111 | if (oc->chosen && oc->chosen != (void *)-1UL) | 1119 | if (oc->chosen && oc->chosen != (void *)-1UL) |
1112 | oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : | 1120 | oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 05e983f42316..89d2a2ab3fe6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -7708,6 +7708,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, | |||
7708 | * handle each tail page individually in migration. | 7708 | * handle each tail page individually in migration. |
7709 | */ | 7709 | */ |
7710 | if (PageHuge(page)) { | 7710 | if (PageHuge(page)) { |
7711 | |||
7712 | if (!hugepage_migration_supported(page_hstate(page))) | ||
7713 | goto unmovable; | ||
7714 | |||
7711 | iter = round_up(iter + 1, 1<<compound_order(page)) - 1; | 7715 | iter = round_up(iter + 1, 1<<compound_order(page)) - 1; |
7712 | continue; | 7716 | continue; |
7713 | } | 7717 | } |
@@ -435,11 +435,14 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node) | |||
435 | EXPORT_SYMBOL(kvmalloc_node); | 435 | EXPORT_SYMBOL(kvmalloc_node); |
436 | 436 | ||
437 | /** | 437 | /** |
438 | * kvfree - free memory allocated with kvmalloc | 438 | * kvfree() - Free memory. |
439 | * @addr: pointer returned by kvmalloc | 439 | * @addr: Pointer to allocated memory. |
440 | * | 440 | * |
441 | * If the memory is allocated from vmalloc area it is freed with vfree(). | 441 | * kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc(). |
442 | * Otherwise kfree() is used. | 442 | * It is slightly more efficient to use kfree() or vfree() if you are certain |
443 | * that you know which one to use. | ||
444 | * | ||
445 | * Context: Any context except NMI. | ||
443 | */ | 446 | */ |
444 | void kvfree(const void *addr) | 447 | void kvfree(const void *addr) |
445 | { | 448 | { |
diff --git a/net/core/filter.c b/net/core/filter.c index c25eb36f1320..aecdeba052d3 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -2282,14 +2282,21 @@ static const struct bpf_func_proto bpf_msg_cork_bytes_proto = { | |||
2282 | .arg2_type = ARG_ANYTHING, | 2282 | .arg2_type = ARG_ANYTHING, |
2283 | }; | 2283 | }; |
2284 | 2284 | ||
2285 | #define sk_msg_iter_var(var) \ | ||
2286 | do { \ | ||
2287 | var++; \ | ||
2288 | if (var == MAX_SKB_FRAGS) \ | ||
2289 | var = 0; \ | ||
2290 | } while (0) | ||
2291 | |||
2285 | BPF_CALL_4(bpf_msg_pull_data, | 2292 | BPF_CALL_4(bpf_msg_pull_data, |
2286 | struct sk_msg_buff *, msg, u32, start, u32, end, u64, flags) | 2293 | struct sk_msg_buff *, msg, u32, start, u32, end, u64, flags) |
2287 | { | 2294 | { |
2288 | unsigned int len = 0, offset = 0, copy = 0; | 2295 | unsigned int len = 0, offset = 0, copy = 0, poffset = 0; |
2296 | int bytes = end - start, bytes_sg_total; | ||
2289 | struct scatterlist *sg = msg->sg_data; | 2297 | struct scatterlist *sg = msg->sg_data; |
2290 | int first_sg, last_sg, i, shift; | 2298 | int first_sg, last_sg, i, shift; |
2291 | unsigned char *p, *to, *from; | 2299 | unsigned char *p, *to, *from; |
2292 | int bytes = end - start; | ||
2293 | struct page *page; | 2300 | struct page *page; |
2294 | 2301 | ||
2295 | if (unlikely(flags || end <= start)) | 2302 | if (unlikely(flags || end <= start)) |
@@ -2299,21 +2306,22 @@ BPF_CALL_4(bpf_msg_pull_data, | |||
2299 | i = msg->sg_start; | 2306 | i = msg->sg_start; |
2300 | do { | 2307 | do { |
2301 | len = sg[i].length; | 2308 | len = sg[i].length; |
2302 | offset += len; | ||
2303 | if (start < offset + len) | 2309 | if (start < offset + len) |
2304 | break; | 2310 | break; |
2305 | i++; | 2311 | offset += len; |
2306 | if (i == MAX_SKB_FRAGS) | 2312 | sk_msg_iter_var(i); |
2307 | i = 0; | ||
2308 | } while (i != msg->sg_end); | 2313 | } while (i != msg->sg_end); |
2309 | 2314 | ||
2310 | if (unlikely(start >= offset + len)) | 2315 | if (unlikely(start >= offset + len)) |
2311 | return -EINVAL; | 2316 | return -EINVAL; |
2312 | 2317 | ||
2313 | if (!msg->sg_copy[i] && bytes <= len) | ||
2314 | goto out; | ||
2315 | |||
2316 | first_sg = i; | 2318 | first_sg = i; |
2319 | /* The start may point into the sg element so we need to also | ||
2320 | * account for the headroom. | ||
2321 | */ | ||
2322 | bytes_sg_total = start - offset + bytes; | ||
2323 | if (!msg->sg_copy[i] && bytes_sg_total <= len) | ||
2324 | goto out; | ||
2317 | 2325 | ||
2318 | /* At this point we need to linearize multiple scatterlist | 2326 | /* At this point we need to linearize multiple scatterlist |
2319 | * elements or a single shared page. Either way we need to | 2327 | * elements or a single shared page. Either way we need to |
@@ -2327,37 +2335,32 @@ BPF_CALL_4(bpf_msg_pull_data, | |||
2327 | */ | 2335 | */ |
2328 | do { | 2336 | do { |
2329 | copy += sg[i].length; | 2337 | copy += sg[i].length; |
2330 | i++; | 2338 | sk_msg_iter_var(i); |
2331 | if (i == MAX_SKB_FRAGS) | 2339 | if (bytes_sg_total <= copy) |
2332 | i = 0; | ||
2333 | if (bytes < copy) | ||
2334 | break; | 2340 | break; |
2335 | } while (i != msg->sg_end); | 2341 | } while (i != msg->sg_end); |
2336 | last_sg = i; | 2342 | last_sg = i; |
2337 | 2343 | ||
2338 | if (unlikely(copy < end - start)) | 2344 | if (unlikely(bytes_sg_total > copy)) |
2339 | return -EINVAL; | 2345 | return -EINVAL; |
2340 | 2346 | ||
2341 | page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC, get_order(copy)); | 2347 | page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC, get_order(copy)); |
2342 | if (unlikely(!page)) | 2348 | if (unlikely(!page)) |
2343 | return -ENOMEM; | 2349 | return -ENOMEM; |
2344 | p = page_address(page); | 2350 | p = page_address(page); |
2345 | offset = 0; | ||
2346 | 2351 | ||
2347 | i = first_sg; | 2352 | i = first_sg; |
2348 | do { | 2353 | do { |
2349 | from = sg_virt(&sg[i]); | 2354 | from = sg_virt(&sg[i]); |
2350 | len = sg[i].length; | 2355 | len = sg[i].length; |
2351 | to = p + offset; | 2356 | to = p + poffset; |
2352 | 2357 | ||
2353 | memcpy(to, from, len); | 2358 | memcpy(to, from, len); |
2354 | offset += len; | 2359 | poffset += len; |
2355 | sg[i].length = 0; | 2360 | sg[i].length = 0; |
2356 | put_page(sg_page(&sg[i])); | 2361 | put_page(sg_page(&sg[i])); |
2357 | 2362 | ||
2358 | i++; | 2363 | sk_msg_iter_var(i); |
2359 | if (i == MAX_SKB_FRAGS) | ||
2360 | i = 0; | ||
2361 | } while (i != last_sg); | 2364 | } while (i != last_sg); |
2362 | 2365 | ||
2363 | sg[first_sg].length = copy; | 2366 | sg[first_sg].length = copy; |
@@ -2367,11 +2370,15 @@ BPF_CALL_4(bpf_msg_pull_data, | |||
2367 | * had a single entry though we can just replace it and | 2370 | * had a single entry though we can just replace it and |
2368 | * be done. Otherwise walk the ring and shift the entries. | 2371 | * be done. Otherwise walk the ring and shift the entries. |
2369 | */ | 2372 | */ |
2370 | shift = last_sg - first_sg - 1; | 2373 | WARN_ON_ONCE(last_sg == first_sg); |
2374 | shift = last_sg > first_sg ? | ||
2375 | last_sg - first_sg - 1 : | ||
2376 | MAX_SKB_FRAGS - first_sg + last_sg - 1; | ||
2371 | if (!shift) | 2377 | if (!shift) |
2372 | goto out; | 2378 | goto out; |
2373 | 2379 | ||
2374 | i = first_sg + 1; | 2380 | i = first_sg; |
2381 | sk_msg_iter_var(i); | ||
2375 | do { | 2382 | do { |
2376 | int move_from; | 2383 | int move_from; |
2377 | 2384 | ||
@@ -2388,15 +2395,13 @@ BPF_CALL_4(bpf_msg_pull_data, | |||
2388 | sg[move_from].page_link = 0; | 2395 | sg[move_from].page_link = 0; |
2389 | sg[move_from].offset = 0; | 2396 | sg[move_from].offset = 0; |
2390 | 2397 | ||
2391 | i++; | 2398 | sk_msg_iter_var(i); |
2392 | if (i == MAX_SKB_FRAGS) | ||
2393 | i = 0; | ||
2394 | } while (1); | 2399 | } while (1); |
2395 | msg->sg_end -= shift; | 2400 | msg->sg_end -= shift; |
2396 | if (msg->sg_end < 0) | 2401 | if (msg->sg_end < 0) |
2397 | msg->sg_end += MAX_SKB_FRAGS; | 2402 | msg->sg_end += MAX_SKB_FRAGS; |
2398 | out: | 2403 | out: |
2399 | msg->data = sg_virt(&sg[i]) + start - offset; | 2404 | msg->data = sg_virt(&sg[first_sg]) + start - offset; |
2400 | msg->data_end = msg->data + bytes; | 2405 | msg->data_end = msg->data + bytes; |
2401 | 2406 | ||
2402 | return 0; | 2407 | return 0; |
@@ -7281,7 +7286,7 @@ static u32 sk_reuseport_convert_ctx_access(enum bpf_access_type type, | |||
7281 | break; | 7286 | break; |
7282 | 7287 | ||
7283 | case offsetof(struct sk_reuseport_md, ip_protocol): | 7288 | case offsetof(struct sk_reuseport_md, ip_protocol): |
7284 | BUILD_BUG_ON(hweight_long(SK_FL_PROTO_MASK) != BITS_PER_BYTE); | 7289 | BUILD_BUG_ON(HWEIGHT32(SK_FL_PROTO_MASK) != BITS_PER_BYTE); |
7285 | SK_REUSEPORT_LOAD_SK_FIELD_SIZE_OFF(__sk_flags_offset, | 7290 | SK_REUSEPORT_LOAD_SK_FIELD_SIZE_OFF(__sk_flags_offset, |
7286 | BPF_W, 0); | 7291 | BPF_W, 0); |
7287 | *insn++ = BPF_ALU32_IMM(BPF_AND, si->dst_reg, SK_FL_PROTO_MASK); | 7292 | *insn++ = BPF_ALU32_IMM(BPF_AND, si->dst_reg, SK_FL_PROTO_MASK); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 24431e578310..60c928894a78 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -324,6 +324,10 @@ void rtnl_unregister_all(int protocol) | |||
324 | 324 | ||
325 | rtnl_lock(); | 325 | rtnl_lock(); |
326 | tab = rtnl_msg_handlers[protocol]; | 326 | tab = rtnl_msg_handlers[protocol]; |
327 | if (!tab) { | ||
328 | rtnl_unlock(); | ||
329 | return; | ||
330 | } | ||
327 | RCU_INIT_POINTER(rtnl_msg_handlers[protocol], NULL); | 331 | RCU_INIT_POINTER(rtnl_msg_handlers[protocol], NULL); |
328 | for (msgindex = 0; msgindex < RTM_NR_MSGTYPES; msgindex++) { | 332 | for (msgindex = 0; msgindex < RTM_NR_MSGTYPES; msgindex++) { |
329 | link = tab[msgindex]; | 333 | link = tab[msgindex]; |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e63c554e0623..9f3209ff7ffd 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -19,12 +19,10 @@ | |||
19 | #include <linux/of_mdio.h> | 19 | #include <linux/of_mdio.h> |
20 | #include <linux/of_platform.h> | 20 | #include <linux/of_platform.h> |
21 | #include <linux/of_net.h> | 21 | #include <linux/of_net.h> |
22 | #include <linux/of_gpio.h> | ||
23 | #include <linux/netdevice.h> | 22 | #include <linux/netdevice.h> |
24 | #include <linux/sysfs.h> | 23 | #include <linux/sysfs.h> |
25 | #include <linux/phy_fixed.h> | 24 | #include <linux/phy_fixed.h> |
26 | #include <linux/ptp_classify.h> | 25 | #include <linux/ptp_classify.h> |
27 | #include <linux/gpio/consumer.h> | ||
28 | #include <linux/etherdevice.h> | 26 | #include <linux/etherdevice.h> |
29 | 27 | ||
30 | #include "dsa_priv.h" | 28 | #include "dsa_priv.h" |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index cf75f8944b05..4da39446da2d 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -820,10 +820,9 @@ static void igmp_timer_expire(struct timer_list *t) | |||
820 | spin_lock(&im->lock); | 820 | spin_lock(&im->lock); |
821 | im->tm_running = 0; | 821 | im->tm_running = 0; |
822 | 822 | ||
823 | if (im->unsolicit_count) { | 823 | if (im->unsolicit_count && --im->unsolicit_count) |
824 | im->unsolicit_count--; | ||
825 | igmp_start_timer(im, unsolicited_report_interval(in_dev)); | 824 | igmp_start_timer(im, unsolicited_report_interval(in_dev)); |
826 | } | 825 | |
827 | im->reporter = 1; | 826 | im->reporter = 1; |
828 | spin_unlock(&im->lock); | 827 | spin_unlock(&im->lock); |
829 | 828 | ||
@@ -1308,6 +1307,8 @@ static void igmp_group_added(struct ip_mc_list *im) | |||
1308 | 1307 | ||
1309 | if (in_dev->dead) | 1308 | if (in_dev->dead) |
1310 | return; | 1309 | return; |
1310 | |||
1311 | im->unsolicit_count = net->ipv4.sysctl_igmp_qrv; | ||
1311 | if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) { | 1312 | if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) { |
1312 | spin_lock_bh(&im->lock); | 1313 | spin_lock_bh(&im->lock); |
1313 | igmp_start_timer(im, IGMP_INITIAL_REPORT_DELAY); | 1314 | igmp_start_timer(im, IGMP_INITIAL_REPORT_DELAY); |
@@ -1391,9 +1392,6 @@ static void __ip_mc_inc_group(struct in_device *in_dev, __be32 addr, | |||
1391 | unsigned int mode) | 1392 | unsigned int mode) |
1392 | { | 1393 | { |
1393 | struct ip_mc_list *im; | 1394 | struct ip_mc_list *im; |
1394 | #ifdef CONFIG_IP_MULTICAST | ||
1395 | struct net *net = dev_net(in_dev->dev); | ||
1396 | #endif | ||
1397 | 1395 | ||
1398 | ASSERT_RTNL(); | 1396 | ASSERT_RTNL(); |
1399 | 1397 | ||
@@ -1420,7 +1418,6 @@ static void __ip_mc_inc_group(struct in_device *in_dev, __be32 addr, | |||
1420 | spin_lock_init(&im->lock); | 1418 | spin_lock_init(&im->lock); |
1421 | #ifdef CONFIG_IP_MULTICAST | 1419 | #ifdef CONFIG_IP_MULTICAST |
1422 | timer_setup(&im->timer, igmp_timer_expire, 0); | 1420 | timer_setup(&im->timer, igmp_timer_expire, 0); |
1423 | im->unsolicit_count = net->ipv4.sysctl_igmp_qrv; | ||
1424 | #endif | 1421 | #endif |
1425 | 1422 | ||
1426 | im->next_rcu = in_dev->mc_list; | 1423 | im->next_rcu = in_dev->mc_list; |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 51a5d06085ac..ae714aecc31c 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1508,11 +1508,14 @@ nla_put_failure: | |||
1508 | 1508 | ||
1509 | static void erspan_setup(struct net_device *dev) | 1509 | static void erspan_setup(struct net_device *dev) |
1510 | { | 1510 | { |
1511 | struct ip_tunnel *t = netdev_priv(dev); | ||
1512 | |||
1511 | ether_setup(dev); | 1513 | ether_setup(dev); |
1512 | dev->netdev_ops = &erspan_netdev_ops; | 1514 | dev->netdev_ops = &erspan_netdev_ops; |
1513 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; | 1515 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
1514 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | 1516 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; |
1515 | ip_tunnel_setup(dev, erspan_net_id); | 1517 | ip_tunnel_setup(dev, erspan_net_id); |
1518 | t->erspan_ver = 1; | ||
1516 | } | 1519 | } |
1517 | 1520 | ||
1518 | static const struct nla_policy ipgre_policy[IFLA_GRE_MAX + 1] = { | 1521 | static const struct nla_policy ipgre_policy[IFLA_GRE_MAX + 1] = { |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 75ef332a7caf..12affb7864d9 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -184,8 +184,9 @@ kill: | |||
184 | inet_twsk_deschedule_put(tw); | 184 | inet_twsk_deschedule_put(tw); |
185 | return TCP_TW_SUCCESS; | 185 | return TCP_TW_SUCCESS; |
186 | } | 186 | } |
187 | } else { | ||
188 | inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN); | ||
187 | } | 189 | } |
188 | inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN); | ||
189 | 190 | ||
190 | if (tmp_opt.saw_tstamp) { | 191 | if (tmp_opt.saw_tstamp) { |
191 | tcptw->tw_ts_recent = tmp_opt.rcv_tsval; | 192 | tcptw->tw_ts_recent = tmp_opt.rcv_tsval; |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 673bba31eb18..9a4261e50272 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -938,14 +938,14 @@ static int __init inet6_init(void) | |||
938 | 938 | ||
939 | err = proto_register(&pingv6_prot, 1); | 939 | err = proto_register(&pingv6_prot, 1); |
940 | if (err) | 940 | if (err) |
941 | goto out_unregister_ping_proto; | 941 | goto out_unregister_raw_proto; |
942 | 942 | ||
943 | /* We MUST register RAW sockets before we create the ICMP6, | 943 | /* We MUST register RAW sockets before we create the ICMP6, |
944 | * IGMP6, or NDISC control sockets. | 944 | * IGMP6, or NDISC control sockets. |
945 | */ | 945 | */ |
946 | err = rawv6_init(); | 946 | err = rawv6_init(); |
947 | if (err) | 947 | if (err) |
948 | goto out_unregister_raw_proto; | 948 | goto out_unregister_ping_proto; |
949 | 949 | ||
950 | /* Register the family here so that the init calls below will | 950 | /* Register the family here so that the init calls below will |
951 | * be able to create sockets. (?? is this dangerous ??) | 951 | * be able to create sockets. (?? is this dangerous ??) |
@@ -1113,11 +1113,11 @@ netfilter_fail: | |||
1113 | igmp_fail: | 1113 | igmp_fail: |
1114 | ndisc_cleanup(); | 1114 | ndisc_cleanup(); |
1115 | ndisc_fail: | 1115 | ndisc_fail: |
1116 | ip6_mr_cleanup(); | 1116 | icmpv6_cleanup(); |
1117 | icmp_fail: | 1117 | icmp_fail: |
1118 | unregister_pernet_subsys(&inet6_net_ops); | 1118 | ip6_mr_cleanup(); |
1119 | ipmr_fail: | 1119 | ipmr_fail: |
1120 | icmpv6_cleanup(); | 1120 | unregister_pernet_subsys(&inet6_net_ops); |
1121 | register_pernet_fail: | 1121 | register_pernet_fail: |
1122 | sock_unregister(PF_INET6); | 1122 | sock_unregister(PF_INET6); |
1123 | rtnl_unregister_all(PF_INET6); | 1123 | rtnl_unregister_all(PF_INET6); |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index c861a6d4671d..5516f55e214b 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -989,7 +989,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, | |||
989 | fib6_clean_expires(iter); | 989 | fib6_clean_expires(iter); |
990 | else | 990 | else |
991 | fib6_set_expires(iter, rt->expires); | 991 | fib6_set_expires(iter, rt->expires); |
992 | fib6_metric_set(iter, RTAX_MTU, rt->fib6_pmtu); | 992 | |
993 | if (rt->fib6_pmtu) | ||
994 | fib6_metric_set(iter, RTAX_MTU, | ||
995 | rt->fib6_pmtu); | ||
993 | return -EEXIST; | 996 | return -EEXIST; |
994 | } | 997 | } |
995 | /* If we have the same destination and the same metric, | 998 | /* If we have the same destination and the same metric, |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 18a3794b0f52..e493b041d4ac 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -1778,6 +1778,7 @@ static void ip6gre_netlink_parms(struct nlattr *data[], | |||
1778 | if (data[IFLA_GRE_COLLECT_METADATA]) | 1778 | if (data[IFLA_GRE_COLLECT_METADATA]) |
1779 | parms->collect_md = true; | 1779 | parms->collect_md = true; |
1780 | 1780 | ||
1781 | parms->erspan_ver = 1; | ||
1781 | if (data[IFLA_GRE_ERSPAN_VER]) | 1782 | if (data[IFLA_GRE_ERSPAN_VER]) |
1782 | parms->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]); | 1783 | parms->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]); |
1783 | 1784 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 5df2a58d945c..419960b0ba16 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1188,7 +1188,15 @@ route_lookup: | |||
1188 | init_tel_txopt(&opt, encap_limit); | 1188 | init_tel_txopt(&opt, encap_limit); |
1189 | ipv6_push_frag_opts(skb, &opt.ops, &proto); | 1189 | ipv6_push_frag_opts(skb, &opt.ops, &proto); |
1190 | } | 1190 | } |
1191 | hop_limit = hop_limit ? : ip6_dst_hoplimit(dst); | 1191 | |
1192 | if (hop_limit == 0) { | ||
1193 | if (skb->protocol == htons(ETH_P_IP)) | ||
1194 | hop_limit = ip_hdr(skb)->ttl; | ||
1195 | else if (skb->protocol == htons(ETH_P_IPV6)) | ||
1196 | hop_limit = ipv6_hdr(skb)->hop_limit; | ||
1197 | else | ||
1198 | hop_limit = ip6_dst_hoplimit(dst); | ||
1199 | } | ||
1192 | 1200 | ||
1193 | /* Calculate max headroom for all the headers and adjust | 1201 | /* Calculate max headroom for all the headers and adjust |
1194 | * needed_headroom if necessary. | 1202 | * needed_headroom if necessary. |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 5095367c7204..eeaf7455d51e 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -481,7 +481,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) | |||
481 | } | 481 | } |
482 | 482 | ||
483 | mtu = dst_mtu(dst); | 483 | mtu = dst_mtu(dst); |
484 | if (!skb->ignore_df && skb->len > mtu) { | 484 | if (skb->len > mtu) { |
485 | skb_dst_update_pmtu(skb, mtu); | 485 | skb_dst_update_pmtu(skb, mtu); |
486 | 486 | ||
487 | if (skb->protocol == htons(ETH_P_IPV6)) { | 487 | if (skb->protocol == htons(ETH_P_IPV6)) { |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index c4ea13e8360b..18e00ce1719a 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -996,7 +996,6 @@ static void ip6_rt_copy_init(struct rt6_info *rt, struct fib6_info *ort) | |||
996 | rt->rt6i_src = ort->fib6_src; | 996 | rt->rt6i_src = ort->fib6_src; |
997 | #endif | 997 | #endif |
998 | rt->rt6i_prefsrc = ort->fib6_prefsrc; | 998 | rt->rt6i_prefsrc = ort->fib6_prefsrc; |
999 | rt->dst.lwtstate = lwtstate_get(ort->fib6_nh.nh_lwtstate); | ||
1000 | } | 999 | } |
1001 | 1000 | ||
1002 | static struct fib6_node* fib6_backtrack(struct fib6_node *fn, | 1001 | static struct fib6_node* fib6_backtrack(struct fib6_node *fn, |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 6449a1c2283b..f0f5fedb8caa 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -947,8 +947,8 @@ static void ieee80211_rx_mgmt_deauth_ibss(struct ieee80211_sub_if_data *sdata, | |||
947 | if (len < IEEE80211_DEAUTH_FRAME_LEN) | 947 | if (len < IEEE80211_DEAUTH_FRAME_LEN) |
948 | return; | 948 | return; |
949 | 949 | ||
950 | ibss_dbg(sdata, "RX DeAuth SA=%pM DA=%pM BSSID=%pM (reason: %d)\n", | 950 | ibss_dbg(sdata, "RX DeAuth SA=%pM DA=%pM\n", mgmt->sa, mgmt->da); |
951 | mgmt->sa, mgmt->da, mgmt->bssid, reason); | 951 | ibss_dbg(sdata, "\tBSSID=%pM (reason: %d)\n", mgmt->bssid, reason); |
952 | sta_info_destroy_addr(sdata, mgmt->sa); | 952 | sta_info_destroy_addr(sdata, mgmt->sa); |
953 | } | 953 | } |
954 | 954 | ||
@@ -966,9 +966,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata, | |||
966 | auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); | 966 | auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); |
967 | auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); | 967 | auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); |
968 | 968 | ||
969 | ibss_dbg(sdata, | 969 | ibss_dbg(sdata, "RX Auth SA=%pM DA=%pM\n", mgmt->sa, mgmt->da); |
970 | "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", | 970 | ibss_dbg(sdata, "\tBSSID=%pM (auth_transaction=%d)\n", |
971 | mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction); | 971 | mgmt->bssid, auth_transaction); |
972 | 972 | ||
973 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) | 973 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) |
974 | return; | 974 | return; |
@@ -1175,10 +1175,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1175 | rx_timestamp = drv_get_tsf(local, sdata); | 1175 | rx_timestamp = drv_get_tsf(local, sdata); |
1176 | } | 1176 | } |
1177 | 1177 | ||
1178 | ibss_dbg(sdata, | 1178 | ibss_dbg(sdata, "RX beacon SA=%pM BSSID=%pM TSF=0x%llx\n", |
1179 | "RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", | ||
1180 | mgmt->sa, mgmt->bssid, | 1179 | mgmt->sa, mgmt->bssid, |
1181 | (unsigned long long)rx_timestamp, | 1180 | (unsigned long long)rx_timestamp); |
1181 | ibss_dbg(sdata, "\tBCN=0x%llx diff=%lld @%lu\n", | ||
1182 | (unsigned long long)beacon_timestamp, | 1182 | (unsigned long long)beacon_timestamp, |
1183 | (unsigned long long)(rx_timestamp - beacon_timestamp), | 1183 | (unsigned long long)(rx_timestamp - beacon_timestamp), |
1184 | jiffies); | 1184 | jiffies); |
@@ -1537,9 +1537,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1537 | 1537 | ||
1538 | tx_last_beacon = drv_tx_last_beacon(local); | 1538 | tx_last_beacon = drv_tx_last_beacon(local); |
1539 | 1539 | ||
1540 | ibss_dbg(sdata, | 1540 | ibss_dbg(sdata, "RX ProbeReq SA=%pM DA=%pM\n", mgmt->sa, mgmt->da); |
1541 | "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", | 1541 | ibss_dbg(sdata, "\tBSSID=%pM (tx_last_beacon=%d)\n", |
1542 | mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon); | 1542 | mgmt->bssid, tx_last_beacon); |
1543 | 1543 | ||
1544 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) | 1544 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) |
1545 | return; | 1545 | return; |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 4fb2709cb527..513627896204 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -256,8 +256,27 @@ static void ieee80211_restart_work(struct work_struct *work) | |||
256 | 256 | ||
257 | flush_work(&local->radar_detected_work); | 257 | flush_work(&local->radar_detected_work); |
258 | rtnl_lock(); | 258 | rtnl_lock(); |
259 | list_for_each_entry(sdata, &local->interfaces, list) | 259 | list_for_each_entry(sdata, &local->interfaces, list) { |
260 | /* | ||
261 | * XXX: there may be more work for other vif types and even | ||
262 | * for station mode: a good thing would be to run most of | ||
263 | * the iface type's dependent _stop (ieee80211_mg_stop, | ||
264 | * ieee80211_ibss_stop) etc... | ||
265 | * For now, fix only the specific bug that was seen: race | ||
266 | * between csa_connection_drop_work and us. | ||
267 | */ | ||
268 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { | ||
269 | /* | ||
270 | * This worker is scheduled from the iface worker that | ||
271 | * runs on mac80211's workqueue, so we can't be | ||
272 | * scheduling this worker after the cancel right here. | ||
273 | * The exception is ieee80211_chswitch_done. | ||
274 | * Then we can have a race... | ||
275 | */ | ||
276 | cancel_work_sync(&sdata->u.mgd.csa_connection_drop_work); | ||
277 | } | ||
260 | flush_delayed_work(&sdata->dec_tailroom_needed_wk); | 278 | flush_delayed_work(&sdata->dec_tailroom_needed_wk); |
279 | } | ||
261 | ieee80211_scan_cancel(local); | 280 | ieee80211_scan_cancel(local); |
262 | 281 | ||
263 | /* make sure any new ROC will consider local->in_reconfig */ | 282 | /* make sure any new ROC will consider local->in_reconfig */ |
@@ -471,10 +490,7 @@ static const struct ieee80211_vht_cap mac80211_vht_capa_mod_mask = { | |||
471 | cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC | | 490 | cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC | |
472 | IEEE80211_VHT_CAP_SHORT_GI_80 | | 491 | IEEE80211_VHT_CAP_SHORT_GI_80 | |
473 | IEEE80211_VHT_CAP_SHORT_GI_160 | | 492 | IEEE80211_VHT_CAP_SHORT_GI_160 | |
474 | IEEE80211_VHT_CAP_RXSTBC_1 | | 493 | IEEE80211_VHT_CAP_RXSTBC_MASK | |
475 | IEEE80211_VHT_CAP_RXSTBC_2 | | ||
476 | IEEE80211_VHT_CAP_RXSTBC_3 | | ||
477 | IEEE80211_VHT_CAP_RXSTBC_4 | | ||
478 | IEEE80211_VHT_CAP_TXSTBC | | 494 | IEEE80211_VHT_CAP_TXSTBC | |
479 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | | 495 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | |
480 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | | 496 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | |
@@ -1208,6 +1224,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) | |||
1208 | #if IS_ENABLED(CONFIG_IPV6) | 1224 | #if IS_ENABLED(CONFIG_IPV6) |
1209 | unregister_inet6addr_notifier(&local->ifa6_notifier); | 1225 | unregister_inet6addr_notifier(&local->ifa6_notifier); |
1210 | #endif | 1226 | #endif |
1227 | ieee80211_txq_teardown_flows(local); | ||
1211 | 1228 | ||
1212 | rtnl_lock(); | 1229 | rtnl_lock(); |
1213 | 1230 | ||
@@ -1236,7 +1253,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) | |||
1236 | skb_queue_purge(&local->skb_queue); | 1253 | skb_queue_purge(&local->skb_queue); |
1237 | skb_queue_purge(&local->skb_queue_unreliable); | 1254 | skb_queue_purge(&local->skb_queue_unreliable); |
1238 | skb_queue_purge(&local->skb_queue_tdls_chsw); | 1255 | skb_queue_purge(&local->skb_queue_tdls_chsw); |
1239 | ieee80211_txq_teardown_flows(local); | ||
1240 | 1256 | ||
1241 | destroy_workqueue(local->workqueue); | 1257 | destroy_workqueue(local->workqueue); |
1242 | wiphy_unregister(local->hw.wiphy); | 1258 | wiphy_unregister(local->hw.wiphy); |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 35ad3983ae4b..daf9db3c8f24 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -572,6 +572,10 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
572 | forward = false; | 572 | forward = false; |
573 | reply = true; | 573 | reply = true; |
574 | target_metric = 0; | 574 | target_metric = 0; |
575 | |||
576 | if (SN_GT(target_sn, ifmsh->sn)) | ||
577 | ifmsh->sn = target_sn; | ||
578 | |||
575 | if (time_after(jiffies, ifmsh->last_sn_update + | 579 | if (time_after(jiffies, ifmsh->last_sn_update + |
576 | net_traversal_jiffies(sdata)) || | 580 | net_traversal_jiffies(sdata)) || |
577 | time_before(jiffies, ifmsh->last_sn_update)) { | 581 | time_before(jiffies, ifmsh->last_sn_update)) { |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 7fb9957359a3..3dbecae4be73 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1073,6 +1073,10 @@ static void ieee80211_chswitch_work(struct work_struct *work) | |||
1073 | */ | 1073 | */ |
1074 | 1074 | ||
1075 | if (sdata->reserved_chanctx) { | 1075 | if (sdata->reserved_chanctx) { |
1076 | struct ieee80211_supported_band *sband = NULL; | ||
1077 | struct sta_info *mgd_sta = NULL; | ||
1078 | enum ieee80211_sta_rx_bandwidth bw = IEEE80211_STA_RX_BW_20; | ||
1079 | |||
1076 | /* | 1080 | /* |
1077 | * with multi-vif csa driver may call ieee80211_csa_finish() | 1081 | * with multi-vif csa driver may call ieee80211_csa_finish() |
1078 | * many times while waiting for other interfaces to use their | 1082 | * many times while waiting for other interfaces to use their |
@@ -1081,6 +1085,48 @@ static void ieee80211_chswitch_work(struct work_struct *work) | |||
1081 | if (sdata->reserved_ready) | 1085 | if (sdata->reserved_ready) |
1082 | goto out; | 1086 | goto out; |
1083 | 1087 | ||
1088 | if (sdata->vif.bss_conf.chandef.width != | ||
1089 | sdata->csa_chandef.width) { | ||
1090 | /* | ||
1091 | * For managed interface, we need to also update the AP | ||
1092 | * station bandwidth and align the rate scale algorithm | ||
1093 | * on the bandwidth change. Here we only consider the | ||
1094 | * bandwidth of the new channel definition (as channel | ||
1095 | * switch flow does not have the full HT/VHT/HE | ||
1096 | * information), assuming that if additional changes are | ||
1097 | * required they would be done as part of the processing | ||
1098 | * of the next beacon from the AP. | ||
1099 | */ | ||
1100 | switch (sdata->csa_chandef.width) { | ||
1101 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
1102 | case NL80211_CHAN_WIDTH_20: | ||
1103 | default: | ||
1104 | bw = IEEE80211_STA_RX_BW_20; | ||
1105 | break; | ||
1106 | case NL80211_CHAN_WIDTH_40: | ||
1107 | bw = IEEE80211_STA_RX_BW_40; | ||
1108 | break; | ||
1109 | case NL80211_CHAN_WIDTH_80: | ||
1110 | bw = IEEE80211_STA_RX_BW_80; | ||
1111 | break; | ||
1112 | case NL80211_CHAN_WIDTH_80P80: | ||
1113 | case NL80211_CHAN_WIDTH_160: | ||
1114 | bw = IEEE80211_STA_RX_BW_160; | ||
1115 | break; | ||
1116 | } | ||
1117 | |||
1118 | mgd_sta = sta_info_get(sdata, ifmgd->bssid); | ||
1119 | sband = | ||
1120 | local->hw.wiphy->bands[sdata->csa_chandef.chan->band]; | ||
1121 | } | ||
1122 | |||
1123 | if (sdata->vif.bss_conf.chandef.width > | ||
1124 | sdata->csa_chandef.width) { | ||
1125 | mgd_sta->sta.bandwidth = bw; | ||
1126 | rate_control_rate_update(local, sband, mgd_sta, | ||
1127 | IEEE80211_RC_BW_CHANGED); | ||
1128 | } | ||
1129 | |||
1084 | ret = ieee80211_vif_use_reserved_context(sdata); | 1130 | ret = ieee80211_vif_use_reserved_context(sdata); |
1085 | if (ret) { | 1131 | if (ret) { |
1086 | sdata_info(sdata, | 1132 | sdata_info(sdata, |
@@ -1091,6 +1137,13 @@ static void ieee80211_chswitch_work(struct work_struct *work) | |||
1091 | goto out; | 1137 | goto out; |
1092 | } | 1138 | } |
1093 | 1139 | ||
1140 | if (sdata->vif.bss_conf.chandef.width < | ||
1141 | sdata->csa_chandef.width) { | ||
1142 | mgd_sta->sta.bandwidth = bw; | ||
1143 | rate_control_rate_update(local, sband, mgd_sta, | ||
1144 | IEEE80211_RC_BW_CHANGED); | ||
1145 | } | ||
1146 | |||
1094 | goto out; | 1147 | goto out; |
1095 | } | 1148 | } |
1096 | 1149 | ||
@@ -1312,6 +1365,16 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1312 | cbss->beacon_interval)); | 1365 | cbss->beacon_interval)); |
1313 | return; | 1366 | return; |
1314 | drop_connection: | 1367 | drop_connection: |
1368 | /* | ||
1369 | * This is just so that the disconnect flow will know that | ||
1370 | * we were trying to switch channel and failed. In case the | ||
1371 | * mode is 1 (we are not allowed to Tx), we will know not to | ||
1372 | * send a deauthentication frame. Those two fields will be | ||
1373 | * reset when the disconnection worker runs. | ||
1374 | */ | ||
1375 | sdata->vif.csa_active = true; | ||
1376 | sdata->csa_block_tx = csa_ie.mode; | ||
1377 | |||
1315 | ieee80211_queue_work(&local->hw, &ifmgd->csa_connection_drop_work); | 1378 | ieee80211_queue_work(&local->hw, &ifmgd->csa_connection_drop_work); |
1316 | mutex_unlock(&local->chanctx_mtx); | 1379 | mutex_unlock(&local->chanctx_mtx); |
1317 | mutex_unlock(&local->mtx); | 1380 | mutex_unlock(&local->mtx); |
@@ -2522,6 +2585,7 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) | |||
2522 | struct ieee80211_local *local = sdata->local; | 2585 | struct ieee80211_local *local = sdata->local; |
2523 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 2586 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
2524 | u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; | 2587 | u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; |
2588 | bool tx; | ||
2525 | 2589 | ||
2526 | sdata_lock(sdata); | 2590 | sdata_lock(sdata); |
2527 | if (!ifmgd->associated) { | 2591 | if (!ifmgd->associated) { |
@@ -2529,6 +2593,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) | |||
2529 | return; | 2593 | return; |
2530 | } | 2594 | } |
2531 | 2595 | ||
2596 | tx = !sdata->csa_block_tx; | ||
2597 | |||
2532 | /* AP is probably out of range (or not reachable for another reason) so | 2598 | /* AP is probably out of range (or not reachable for another reason) so |
2533 | * remove the bss struct for that AP. | 2599 | * remove the bss struct for that AP. |
2534 | */ | 2600 | */ |
@@ -2536,7 +2602,7 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) | |||
2536 | 2602 | ||
2537 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 2603 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
2538 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, | 2604 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, |
2539 | true, frame_buf); | 2605 | tx, frame_buf); |
2540 | mutex_lock(&local->mtx); | 2606 | mutex_lock(&local->mtx); |
2541 | sdata->vif.csa_active = false; | 2607 | sdata->vif.csa_active = false; |
2542 | ifmgd->csa_waiting_bcn = false; | 2608 | ifmgd->csa_waiting_bcn = false; |
@@ -2547,7 +2613,7 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) | |||
2547 | } | 2613 | } |
2548 | mutex_unlock(&local->mtx); | 2614 | mutex_unlock(&local->mtx); |
2549 | 2615 | ||
2550 | ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, | 2616 | ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), tx, |
2551 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); | 2617 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); |
2552 | 2618 | ||
2553 | sdata_unlock(sdata); | 2619 | sdata_unlock(sdata); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 64742f2765c4..96611d5dfadb 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1728,6 +1728,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1728 | */ | 1728 | */ |
1729 | if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) && | 1729 | if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) && |
1730 | !ieee80211_has_morefrags(hdr->frame_control) && | 1730 | !ieee80211_has_morefrags(hdr->frame_control) && |
1731 | !is_multicast_ether_addr(hdr->addr1) && | ||
1731 | (ieee80211_is_mgmt(hdr->frame_control) || | 1732 | (ieee80211_is_mgmt(hdr->frame_control) || |
1732 | ieee80211_is_data(hdr->frame_control)) && | 1733 | ieee80211_is_data(hdr->frame_control)) && |
1733 | !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && | 1734 | !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index cd332e3e1134..f353d9db54bc 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -3078,27 +3078,18 @@ void ieee80211_clear_fast_xmit(struct sta_info *sta) | |||
3078 | } | 3078 | } |
3079 | 3079 | ||
3080 | static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local, | 3080 | static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local, |
3081 | struct sk_buff *skb, int headroom, | 3081 | struct sk_buff *skb, int headroom) |
3082 | int *subframe_len) | ||
3083 | { | 3082 | { |
3084 | int amsdu_len = *subframe_len + sizeof(struct ethhdr); | 3083 | if (skb_headroom(skb) < headroom) { |
3085 | int padding = (4 - amsdu_len) & 3; | ||
3086 | |||
3087 | if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) { | ||
3088 | I802_DEBUG_INC(local->tx_expand_skb_head); | 3084 | I802_DEBUG_INC(local->tx_expand_skb_head); |
3089 | 3085 | ||
3090 | if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) { | 3086 | if (pskb_expand_head(skb, headroom, 0, GFP_ATOMIC)) { |
3091 | wiphy_debug(local->hw.wiphy, | 3087 | wiphy_debug(local->hw.wiphy, |
3092 | "failed to reallocate TX buffer\n"); | 3088 | "failed to reallocate TX buffer\n"); |
3093 | return false; | 3089 | return false; |
3094 | } | 3090 | } |
3095 | } | 3091 | } |
3096 | 3092 | ||
3097 | if (padding) { | ||
3098 | *subframe_len += padding; | ||
3099 | skb_put_zero(skb, padding); | ||
3100 | } | ||
3101 | |||
3102 | return true; | 3093 | return true; |
3103 | } | 3094 | } |
3104 | 3095 | ||
@@ -3122,8 +3113,7 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, | |||
3122 | if (info->control.flags & IEEE80211_TX_CTRL_AMSDU) | 3113 | if (info->control.flags & IEEE80211_TX_CTRL_AMSDU) |
3123 | return true; | 3114 | return true; |
3124 | 3115 | ||
3125 | if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr), | 3116 | if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr))) |
3126 | &subframe_len)) | ||
3127 | return false; | 3117 | return false; |
3128 | 3118 | ||
3129 | data = skb_push(skb, sizeof(*amsdu_hdr)); | 3119 | data = skb_push(skb, sizeof(*amsdu_hdr)); |
@@ -3189,7 +3179,8 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, | |||
3189 | void *data; | 3179 | void *data; |
3190 | bool ret = false; | 3180 | bool ret = false; |
3191 | unsigned int orig_len; | 3181 | unsigned int orig_len; |
3192 | int n = 1, nfrags; | 3182 | int n = 2, nfrags, pad = 0; |
3183 | u16 hdrlen; | ||
3193 | 3184 | ||
3194 | if (!ieee80211_hw_check(&local->hw, TX_AMSDU)) | 3185 | if (!ieee80211_hw_check(&local->hw, TX_AMSDU)) |
3195 | return false; | 3186 | return false; |
@@ -3222,9 +3213,6 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, | |||
3222 | if (skb->len + head->len > max_amsdu_len) | 3213 | if (skb->len + head->len > max_amsdu_len) |
3223 | goto out; | 3214 | goto out; |
3224 | 3215 | ||
3225 | if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) | ||
3226 | goto out; | ||
3227 | |||
3228 | nfrags = 1 + skb_shinfo(skb)->nr_frags; | 3216 | nfrags = 1 + skb_shinfo(skb)->nr_frags; |
3229 | nfrags += 1 + skb_shinfo(head)->nr_frags; | 3217 | nfrags += 1 + skb_shinfo(head)->nr_frags; |
3230 | frag_tail = &skb_shinfo(head)->frag_list; | 3218 | frag_tail = &skb_shinfo(head)->frag_list; |
@@ -3240,10 +3228,24 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, | |||
3240 | if (max_frags && nfrags > max_frags) | 3228 | if (max_frags && nfrags > max_frags) |
3241 | goto out; | 3229 | goto out; |
3242 | 3230 | ||
3243 | if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2, | 3231 | if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) |
3244 | &subframe_len)) | ||
3245 | goto out; | 3232 | goto out; |
3246 | 3233 | ||
3234 | /* | ||
3235 | * Pad out the previous subframe to a multiple of 4 by adding the | ||
3236 | * padding to the next one, that's being added. Note that head->len | ||
3237 | * is the length of the full A-MSDU, but that works since each time | ||
3238 | * we add a new subframe we pad out the previous one to a multiple | ||
3239 | * of 4 and thus it no longer matters in the next round. | ||
3240 | */ | ||
3241 | hdrlen = fast_tx->hdr_len - sizeof(rfc1042_header); | ||
3242 | if ((head->len - hdrlen) & 3) | ||
3243 | pad = 4 - ((head->len - hdrlen) & 3); | ||
3244 | |||
3245 | if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + | ||
3246 | 2 + pad)) | ||
3247 | goto out_recalc; | ||
3248 | |||
3247 | ret = true; | 3249 | ret = true; |
3248 | data = skb_push(skb, ETH_ALEN + 2); | 3250 | data = skb_push(skb, ETH_ALEN + 2); |
3249 | memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN); | 3251 | memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN); |
@@ -3253,15 +3255,19 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, | |||
3253 | memcpy(data, &len, 2); | 3255 | memcpy(data, &len, 2); |
3254 | memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header)); | 3256 | memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header)); |
3255 | 3257 | ||
3258 | memset(skb_push(skb, pad), 0, pad); | ||
3259 | |||
3256 | head->len += skb->len; | 3260 | head->len += skb->len; |
3257 | head->data_len += skb->len; | 3261 | head->data_len += skb->len; |
3258 | *frag_tail = skb; | 3262 | *frag_tail = skb; |
3259 | 3263 | ||
3260 | flow->backlog += head->len - orig_len; | 3264 | out_recalc: |
3261 | tin->backlog_bytes += head->len - orig_len; | 3265 | if (head->len != orig_len) { |
3262 | 3266 | flow->backlog += head->len - orig_len; | |
3263 | fq_recalc_backlog(fq, tin, flow); | 3267 | tin->backlog_bytes += head->len - orig_len; |
3264 | 3268 | ||
3269 | fq_recalc_backlog(fq, tin, flow); | ||
3270 | } | ||
3265 | out: | 3271 | out: |
3266 | spin_unlock_bh(&fq->lock); | 3272 | spin_unlock_bh(&fq->lock); |
3267 | 3273 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 88efda7c9f8a..716cd6442d86 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1135,7 +1135,7 @@ void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
1135 | { | 1135 | { |
1136 | struct ieee80211_chanctx_conf *chanctx_conf; | 1136 | struct ieee80211_chanctx_conf *chanctx_conf; |
1137 | const struct ieee80211_reg_rule *rrule; | 1137 | const struct ieee80211_reg_rule *rrule; |
1138 | struct ieee80211_wmm_ac *wmm_ac; | 1138 | const struct ieee80211_wmm_ac *wmm_ac; |
1139 | u16 center_freq = 0; | 1139 | u16 center_freq = 0; |
1140 | 1140 | ||
1141 | if (sdata->vif.type != NL80211_IFTYPE_AP && | 1141 | if (sdata->vif.type != NL80211_IFTYPE_AP && |
@@ -1154,20 +1154,19 @@ void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
1154 | 1154 | ||
1155 | rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); | 1155 | rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); |
1156 | 1156 | ||
1157 | if (IS_ERR_OR_NULL(rrule) || !rrule->wmm_rule) { | 1157 | if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { |
1158 | rcu_read_unlock(); | 1158 | rcu_read_unlock(); |
1159 | return; | 1159 | return; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | if (sdata->vif.type == NL80211_IFTYPE_AP) | 1162 | if (sdata->vif.type == NL80211_IFTYPE_AP) |
1163 | wmm_ac = &rrule->wmm_rule->ap[ac]; | 1163 | wmm_ac = &rrule->wmm_rule.ap[ac]; |
1164 | else | 1164 | else |
1165 | wmm_ac = &rrule->wmm_rule->client[ac]; | 1165 | wmm_ac = &rrule->wmm_rule.client[ac]; |
1166 | qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); | 1166 | qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); |
1167 | qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); | 1167 | qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); |
1168 | qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); | 1168 | qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); |
1169 | qparam->txop = !qparam->txop ? wmm_ac->cot / 32 : | 1169 | qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); |
1170 | min_t(u16, qparam->txop, wmm_ac->cot / 32); | ||
1171 | rcu_read_unlock(); | 1170 | rcu_read_unlock(); |
1172 | } | 1171 | } |
1173 | 1172 | ||
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 5610061e7f2e..75c92a87e7b2 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -4137,36 +4137,52 @@ static const struct vm_operations_struct packet_mmap_ops = { | |||
4137 | .close = packet_mm_close, | 4137 | .close = packet_mm_close, |
4138 | }; | 4138 | }; |
4139 | 4139 | ||
4140 | static void free_pg_vec(struct pgv *pg_vec, unsigned int len) | 4140 | static void free_pg_vec(struct pgv *pg_vec, unsigned int order, |
4141 | unsigned int len) | ||
4141 | { | 4142 | { |
4142 | int i; | 4143 | int i; |
4143 | 4144 | ||
4144 | for (i = 0; i < len; i++) { | 4145 | for (i = 0; i < len; i++) { |
4145 | if (likely(pg_vec[i].buffer)) { | 4146 | if (likely(pg_vec[i].buffer)) { |
4146 | kvfree(pg_vec[i].buffer); | 4147 | if (is_vmalloc_addr(pg_vec[i].buffer)) |
4148 | vfree(pg_vec[i].buffer); | ||
4149 | else | ||
4150 | free_pages((unsigned long)pg_vec[i].buffer, | ||
4151 | order); | ||
4147 | pg_vec[i].buffer = NULL; | 4152 | pg_vec[i].buffer = NULL; |
4148 | } | 4153 | } |
4149 | } | 4154 | } |
4150 | kfree(pg_vec); | 4155 | kfree(pg_vec); |
4151 | } | 4156 | } |
4152 | 4157 | ||
4153 | static char *alloc_one_pg_vec_page(unsigned long size) | 4158 | static char *alloc_one_pg_vec_page(unsigned long order) |
4154 | { | 4159 | { |
4155 | char *buffer; | 4160 | char *buffer; |
4161 | gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP | | ||
4162 | __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY; | ||
4156 | 4163 | ||
4157 | buffer = kvzalloc(size, GFP_KERNEL); | 4164 | buffer = (char *) __get_free_pages(gfp_flags, order); |
4158 | if (buffer) | 4165 | if (buffer) |
4159 | return buffer; | 4166 | return buffer; |
4160 | 4167 | ||
4161 | buffer = kvzalloc(size, GFP_KERNEL | __GFP_RETRY_MAYFAIL); | 4168 | /* __get_free_pages failed, fall back to vmalloc */ |
4169 | buffer = vzalloc(array_size((1 << order), PAGE_SIZE)); | ||
4170 | if (buffer) | ||
4171 | return buffer; | ||
4162 | 4172 | ||
4163 | return buffer; | 4173 | /* vmalloc failed, lets dig into swap here */ |
4174 | gfp_flags &= ~__GFP_NORETRY; | ||
4175 | buffer = (char *) __get_free_pages(gfp_flags, order); | ||
4176 | if (buffer) | ||
4177 | return buffer; | ||
4178 | |||
4179 | /* complete and utter failure */ | ||
4180 | return NULL; | ||
4164 | } | 4181 | } |
4165 | 4182 | ||
4166 | static struct pgv *alloc_pg_vec(struct tpacket_req *req) | 4183 | static struct pgv *alloc_pg_vec(struct tpacket_req *req, int order) |
4167 | { | 4184 | { |
4168 | unsigned int block_nr = req->tp_block_nr; | 4185 | unsigned int block_nr = req->tp_block_nr; |
4169 | unsigned long size = req->tp_block_size; | ||
4170 | struct pgv *pg_vec; | 4186 | struct pgv *pg_vec; |
4171 | int i; | 4187 | int i; |
4172 | 4188 | ||
@@ -4175,7 +4191,7 @@ static struct pgv *alloc_pg_vec(struct tpacket_req *req) | |||
4175 | goto out; | 4191 | goto out; |
4176 | 4192 | ||
4177 | for (i = 0; i < block_nr; i++) { | 4193 | for (i = 0; i < block_nr; i++) { |
4178 | pg_vec[i].buffer = alloc_one_pg_vec_page(size); | 4194 | pg_vec[i].buffer = alloc_one_pg_vec_page(order); |
4179 | if (unlikely(!pg_vec[i].buffer)) | 4195 | if (unlikely(!pg_vec[i].buffer)) |
4180 | goto out_free_pgvec; | 4196 | goto out_free_pgvec; |
4181 | } | 4197 | } |
@@ -4184,7 +4200,7 @@ out: | |||
4184 | return pg_vec; | 4200 | return pg_vec; |
4185 | 4201 | ||
4186 | out_free_pgvec: | 4202 | out_free_pgvec: |
4187 | free_pg_vec(pg_vec, block_nr); | 4203 | free_pg_vec(pg_vec, order, block_nr); |
4188 | pg_vec = NULL; | 4204 | pg_vec = NULL; |
4189 | goto out; | 4205 | goto out; |
4190 | } | 4206 | } |
@@ -4194,9 +4210,9 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4194 | { | 4210 | { |
4195 | struct pgv *pg_vec = NULL; | 4211 | struct pgv *pg_vec = NULL; |
4196 | struct packet_sock *po = pkt_sk(sk); | 4212 | struct packet_sock *po = pkt_sk(sk); |
4213 | int was_running, order = 0; | ||
4197 | struct packet_ring_buffer *rb; | 4214 | struct packet_ring_buffer *rb; |
4198 | struct sk_buff_head *rb_queue; | 4215 | struct sk_buff_head *rb_queue; |
4199 | int was_running; | ||
4200 | __be16 num; | 4216 | __be16 num; |
4201 | int err = -EINVAL; | 4217 | int err = -EINVAL; |
4202 | /* Added to avoid minimal code churn */ | 4218 | /* Added to avoid minimal code churn */ |
@@ -4258,7 +4274,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4258 | goto out; | 4274 | goto out; |
4259 | 4275 | ||
4260 | err = -ENOMEM; | 4276 | err = -ENOMEM; |
4261 | pg_vec = alloc_pg_vec(req); | 4277 | order = get_order(req->tp_block_size); |
4278 | pg_vec = alloc_pg_vec(req, order); | ||
4262 | if (unlikely(!pg_vec)) | 4279 | if (unlikely(!pg_vec)) |
4263 | goto out; | 4280 | goto out; |
4264 | switch (po->tp_version) { | 4281 | switch (po->tp_version) { |
@@ -4312,6 +4329,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4312 | rb->frame_size = req->tp_frame_size; | 4329 | rb->frame_size = req->tp_frame_size; |
4313 | spin_unlock_bh(&rb_queue->lock); | 4330 | spin_unlock_bh(&rb_queue->lock); |
4314 | 4331 | ||
4332 | swap(rb->pg_vec_order, order); | ||
4315 | swap(rb->pg_vec_len, req->tp_block_nr); | 4333 | swap(rb->pg_vec_len, req->tp_block_nr); |
4316 | 4334 | ||
4317 | rb->pg_vec_pages = req->tp_block_size/PAGE_SIZE; | 4335 | rb->pg_vec_pages = req->tp_block_size/PAGE_SIZE; |
@@ -4337,7 +4355,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4337 | } | 4355 | } |
4338 | 4356 | ||
4339 | if (pg_vec) | 4357 | if (pg_vec) |
4340 | free_pg_vec(pg_vec, req->tp_block_nr); | 4358 | free_pg_vec(pg_vec, order, req->tp_block_nr); |
4341 | out: | 4359 | out: |
4342 | return err; | 4360 | return err; |
4343 | } | 4361 | } |
diff --git a/net/packet/internal.h b/net/packet/internal.h index 8f50036f62f0..3bb7c5fb3bff 100644 --- a/net/packet/internal.h +++ b/net/packet/internal.h | |||
@@ -64,6 +64,7 @@ struct packet_ring_buffer { | |||
64 | unsigned int frame_size; | 64 | unsigned int frame_size; |
65 | unsigned int frame_max; | 65 | unsigned int frame_max; |
66 | 66 | ||
67 | unsigned int pg_vec_order; | ||
67 | unsigned int pg_vec_pages; | 68 | unsigned int pg_vec_pages; |
68 | unsigned int pg_vec_len; | 69 | unsigned int pg_vec_len; |
69 | 70 | ||
diff --git a/net/rds/Kconfig b/net/rds/Kconfig index 01b3bd6a3708..b9092111bc45 100644 --- a/net/rds/Kconfig +++ b/net/rds/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | config RDS | 2 | config RDS |
3 | tristate "The RDS Protocol" | 3 | tristate "The Reliable Datagram Sockets Protocol" |
4 | depends on INET | 4 | depends on INET |
5 | ---help--- | 5 | ---help--- |
6 | The RDS (Reliable Datagram Sockets) protocol provides reliable, | 6 | The RDS (Reliable Datagram Sockets) protocol provides reliable, |
diff --git a/net/rds/ib.c b/net/rds/ib.c index c1d97640c0be..eba75c1ba359 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c | |||
@@ -341,15 +341,10 @@ static int rds6_ib_conn_info_visitor(struct rds_connection *conn, | |||
341 | 341 | ||
342 | if (rds_conn_state(conn) == RDS_CONN_UP) { | 342 | if (rds_conn_state(conn) == RDS_CONN_UP) { |
343 | struct rds_ib_device *rds_ibdev; | 343 | struct rds_ib_device *rds_ibdev; |
344 | struct rdma_dev_addr *dev_addr; | ||
345 | 344 | ||
346 | ic = conn->c_transport_data; | 345 | ic = conn->c_transport_data; |
347 | dev_addr = &ic->i_cm_id->route.addr.dev_addr; | 346 | rdma_read_gids(ic->i_cm_id, (union ib_gid *)&iinfo6->src_gid, |
348 | rdma_addr_get_sgid(dev_addr, | 347 | (union ib_gid *)&iinfo6->dst_gid); |
349 | (union ib_gid *)&iinfo6->src_gid); | ||
350 | rdma_addr_get_dgid(dev_addr, | ||
351 | (union ib_gid *)&iinfo6->dst_gid); | ||
352 | |||
353 | rds_ibdev = ic->rds_ibdev; | 348 | rds_ibdev = ic->rds_ibdev; |
354 | iinfo6->max_send_wr = ic->i_send_ring.w_nr; | 349 | iinfo6->max_send_wr = ic->i_send_ring.w_nr; |
355 | iinfo6->max_recv_wr = ic->i_recv_ring.w_nr; | 350 | iinfo6->max_recv_wr = ic->i_recv_ring.w_nr; |
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 00192a996be0..0f8465852254 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/mod_devicetable.h> | ||
23 | #include <linux/rfkill.h> | 24 | #include <linux/rfkill.h> |
24 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
25 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index db83dac1e7f4..e12f8ef7baa4 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -662,6 +662,13 @@ int tcf_action_destroy(struct tc_action *actions[], int bind) | |||
662 | return ret; | 662 | return ret; |
663 | } | 663 | } |
664 | 664 | ||
665 | static int tcf_action_destroy_1(struct tc_action *a, int bind) | ||
666 | { | ||
667 | struct tc_action *actions[] = { a, NULL }; | ||
668 | |||
669 | return tcf_action_destroy(actions, bind); | ||
670 | } | ||
671 | |||
665 | static int tcf_action_put(struct tc_action *p) | 672 | static int tcf_action_put(struct tc_action *p) |
666 | { | 673 | { |
667 | return __tcf_action_put(p, false); | 674 | return __tcf_action_put(p, false); |
@@ -881,17 +888,16 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, | |||
881 | if (TC_ACT_EXT_CMP(a->tcfa_action, TC_ACT_GOTO_CHAIN)) { | 888 | if (TC_ACT_EXT_CMP(a->tcfa_action, TC_ACT_GOTO_CHAIN)) { |
882 | err = tcf_action_goto_chain_init(a, tp); | 889 | err = tcf_action_goto_chain_init(a, tp); |
883 | if (err) { | 890 | if (err) { |
884 | struct tc_action *actions[] = { a, NULL }; | 891 | tcf_action_destroy_1(a, bind); |
885 | |||
886 | tcf_action_destroy(actions, bind); | ||
887 | NL_SET_ERR_MSG(extack, "Failed to init TC action chain"); | 892 | NL_SET_ERR_MSG(extack, "Failed to init TC action chain"); |
888 | return ERR_PTR(err); | 893 | return ERR_PTR(err); |
889 | } | 894 | } |
890 | } | 895 | } |
891 | 896 | ||
892 | if (!tcf_action_valid(a->tcfa_action)) { | 897 | if (!tcf_action_valid(a->tcfa_action)) { |
893 | NL_SET_ERR_MSG(extack, "invalid action value, using TC_ACT_UNSPEC instead"); | 898 | tcf_action_destroy_1(a, bind); |
894 | a->tcfa_action = TC_ACT_UNSPEC; | 899 | NL_SET_ERR_MSG(extack, "Invalid control action value"); |
900 | return ERR_PTR(-EINVAL); | ||
895 | } | 901 | } |
896 | 902 | ||
897 | return a; | 903 | return a; |
@@ -1173,6 +1179,7 @@ static int tcf_action_delete(struct net *net, struct tc_action *actions[]) | |||
1173 | struct tcf_idrinfo *idrinfo = a->idrinfo; | 1179 | struct tcf_idrinfo *idrinfo = a->idrinfo; |
1174 | u32 act_index = a->tcfa_index; | 1180 | u32 act_index = a->tcfa_index; |
1175 | 1181 | ||
1182 | actions[i] = NULL; | ||
1176 | if (tcf_action_put(a)) { | 1183 | if (tcf_action_put(a)) { |
1177 | /* last reference, action was deleted concurrently */ | 1184 | /* last reference, action was deleted concurrently */ |
1178 | module_put(ops->owner); | 1185 | module_put(ops->owner); |
@@ -1184,7 +1191,6 @@ static int tcf_action_delete(struct net *net, struct tc_action *actions[]) | |||
1184 | if (ret < 0) | 1191 | if (ret < 0) |
1185 | return ret; | 1192 | return ret; |
1186 | } | 1193 | } |
1187 | actions[i] = NULL; | ||
1188 | } | 1194 | } |
1189 | return 0; | 1195 | return 0; |
1190 | } | 1196 | } |
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 196430aefe87..06a3d4801878 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
@@ -326,6 +326,20 @@ static int __add_metainfo(const struct tcf_meta_ops *ops, | |||
326 | return ret; | 326 | return ret; |
327 | } | 327 | } |
328 | 328 | ||
329 | static int add_metainfo_and_get_ops(const struct tcf_meta_ops *ops, | ||
330 | struct tcf_ife_info *ife, u32 metaid, | ||
331 | bool exists) | ||
332 | { | ||
333 | int ret; | ||
334 | |||
335 | if (!try_module_get(ops->owner)) | ||
336 | return -ENOENT; | ||
337 | ret = __add_metainfo(ops, ife, metaid, NULL, 0, true, exists); | ||
338 | if (ret) | ||
339 | module_put(ops->owner); | ||
340 | return ret; | ||
341 | } | ||
342 | |||
329 | static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval, | 343 | static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval, |
330 | int len, bool exists) | 344 | int len, bool exists) |
331 | { | 345 | { |
@@ -349,7 +363,7 @@ static int use_all_metadata(struct tcf_ife_info *ife, bool exists) | |||
349 | 363 | ||
350 | read_lock(&ife_mod_lock); | 364 | read_lock(&ife_mod_lock); |
351 | list_for_each_entry(o, &ifeoplist, list) { | 365 | list_for_each_entry(o, &ifeoplist, list) { |
352 | rc = __add_metainfo(o, ife, o->metaid, NULL, 0, true, exists); | 366 | rc = add_metainfo_and_get_ops(o, ife, o->metaid, exists); |
353 | if (rc == 0) | 367 | if (rc == 0) |
354 | installed += 1; | 368 | installed += 1; |
355 | } | 369 | } |
@@ -400,7 +414,6 @@ static void _tcf_ife_cleanup(struct tc_action *a) | |||
400 | struct tcf_meta_info *e, *n; | 414 | struct tcf_meta_info *e, *n; |
401 | 415 | ||
402 | list_for_each_entry_safe(e, n, &ife->metalist, metalist) { | 416 | list_for_each_entry_safe(e, n, &ife->metalist, metalist) { |
403 | module_put(e->ops->owner); | ||
404 | list_del(&e->metalist); | 417 | list_del(&e->metalist); |
405 | if (e->metaval) { | 418 | if (e->metaval) { |
406 | if (e->ops->release) | 419 | if (e->ops->release) |
@@ -408,6 +421,7 @@ static void _tcf_ife_cleanup(struct tc_action *a) | |||
408 | else | 421 | else |
409 | kfree(e->metaval); | 422 | kfree(e->metaval); |
410 | } | 423 | } |
424 | module_put(e->ops->owner); | ||
411 | kfree(e); | 425 | kfree(e); |
412 | } | 426 | } |
413 | } | 427 | } |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 107034070019..ad99a99f11f6 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -109,16 +109,18 @@ static int tcf_pedit_key_ex_dump(struct sk_buff *skb, | |||
109 | { | 109 | { |
110 | struct nlattr *keys_start = nla_nest_start(skb, TCA_PEDIT_KEYS_EX); | 110 | struct nlattr *keys_start = nla_nest_start(skb, TCA_PEDIT_KEYS_EX); |
111 | 111 | ||
112 | if (!keys_start) | ||
113 | goto nla_failure; | ||
112 | for (; n > 0; n--) { | 114 | for (; n > 0; n--) { |
113 | struct nlattr *key_start; | 115 | struct nlattr *key_start; |
114 | 116 | ||
115 | key_start = nla_nest_start(skb, TCA_PEDIT_KEY_EX); | 117 | key_start = nla_nest_start(skb, TCA_PEDIT_KEY_EX); |
118 | if (!key_start) | ||
119 | goto nla_failure; | ||
116 | 120 | ||
117 | if (nla_put_u16(skb, TCA_PEDIT_KEY_EX_HTYPE, keys_ex->htype) || | 121 | if (nla_put_u16(skb, TCA_PEDIT_KEY_EX_HTYPE, keys_ex->htype) || |
118 | nla_put_u16(skb, TCA_PEDIT_KEY_EX_CMD, keys_ex->cmd)) { | 122 | nla_put_u16(skb, TCA_PEDIT_KEY_EX_CMD, keys_ex->cmd)) |
119 | nlmsg_trim(skb, keys_start); | 123 | goto nla_failure; |
120 | return -EINVAL; | ||
121 | } | ||
122 | 124 | ||
123 | nla_nest_end(skb, key_start); | 125 | nla_nest_end(skb, key_start); |
124 | 126 | ||
@@ -128,6 +130,9 @@ static int tcf_pedit_key_ex_dump(struct sk_buff *skb, | |||
128 | nla_nest_end(skb, keys_start); | 130 | nla_nest_end(skb, keys_start); |
129 | 131 | ||
130 | return 0; | 132 | return 0; |
133 | nla_failure: | ||
134 | nla_nest_cancel(skb, keys_start); | ||
135 | return -EINVAL; | ||
131 | } | 136 | } |
132 | 137 | ||
133 | static int tcf_pedit_init(struct net *net, struct nlattr *nla, | 138 | static int tcf_pedit_init(struct net *net, struct nlattr *nla, |
@@ -418,7 +423,10 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, | |||
418 | opt->bindcnt = atomic_read(&p->tcf_bindcnt) - bind; | 423 | opt->bindcnt = atomic_read(&p->tcf_bindcnt) - bind; |
419 | 424 | ||
420 | if (p->tcfp_keys_ex) { | 425 | if (p->tcfp_keys_ex) { |
421 | tcf_pedit_key_ex_dump(skb, p->tcfp_keys_ex, p->tcfp_nkeys); | 426 | if (tcf_pedit_key_ex_dump(skb, |
427 | p->tcfp_keys_ex, | ||
428 | p->tcfp_nkeys)) | ||
429 | goto nla_put_failure; | ||
422 | 430 | ||
423 | if (nla_put(skb, TCA_PEDIT_PARMS_EX, s, opt)) | 431 | if (nla_put(skb, TCA_PEDIT_PARMS_EX, s, opt)) |
424 | goto nla_put_failure; | 432 | goto nla_put_failure; |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 31bd1439cf60..1a67af8a6e8c 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -1252,7 +1252,7 @@ replay: | |||
1252 | } | 1252 | } |
1253 | chain = tcf_chain_get(block, chain_index, true); | 1253 | chain = tcf_chain_get(block, chain_index, true); |
1254 | if (!chain) { | 1254 | if (!chain) { |
1255 | NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); | 1255 | NL_SET_ERR_MSG(extack, "Cannot create specified filter chain"); |
1256 | err = -ENOMEM; | 1256 | err = -ENOMEM; |
1257 | goto errout; | 1257 | goto errout; |
1258 | } | 1258 | } |
@@ -1399,7 +1399,7 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, | |||
1399 | goto errout; | 1399 | goto errout; |
1400 | } | 1400 | } |
1401 | NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); | 1401 | NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); |
1402 | err = -EINVAL; | 1402 | err = -ENOENT; |
1403 | goto errout; | 1403 | goto errout; |
1404 | } | 1404 | } |
1405 | 1405 | ||
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index ef5c9a82d4e8..a644292f9faf 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -215,7 +215,6 @@ static const struct seq_operations sctp_eps_ops = { | |||
215 | struct sctp_ht_iter { | 215 | struct sctp_ht_iter { |
216 | struct seq_net_private p; | 216 | struct seq_net_private p; |
217 | struct rhashtable_iter hti; | 217 | struct rhashtable_iter hti; |
218 | int start_fail; | ||
219 | }; | 218 | }; |
220 | 219 | ||
221 | static void *sctp_transport_seq_start(struct seq_file *seq, loff_t *pos) | 220 | static void *sctp_transport_seq_start(struct seq_file *seq, loff_t *pos) |
@@ -224,7 +223,6 @@ static void *sctp_transport_seq_start(struct seq_file *seq, loff_t *pos) | |||
224 | 223 | ||
225 | sctp_transport_walk_start(&iter->hti); | 224 | sctp_transport_walk_start(&iter->hti); |
226 | 225 | ||
227 | iter->start_fail = 0; | ||
228 | return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos); | 226 | return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos); |
229 | } | 227 | } |
230 | 228 | ||
@@ -232,8 +230,6 @@ static void sctp_transport_seq_stop(struct seq_file *seq, void *v) | |||
232 | { | 230 | { |
233 | struct sctp_ht_iter *iter = seq->private; | 231 | struct sctp_ht_iter *iter = seq->private; |
234 | 232 | ||
235 | if (iter->start_fail) | ||
236 | return; | ||
237 | sctp_transport_walk_stop(&iter->hti); | 233 | sctp_transport_walk_stop(&iter->hti); |
238 | } | 234 | } |
239 | 235 | ||
@@ -264,8 +260,6 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | |||
264 | } | 260 | } |
265 | 261 | ||
266 | transport = (struct sctp_transport *)v; | 262 | transport = (struct sctp_transport *)v; |
267 | if (!sctp_transport_hold(transport)) | ||
268 | return 0; | ||
269 | assoc = transport->asoc; | 263 | assoc = transport->asoc; |
270 | epb = &assoc->base; | 264 | epb = &assoc->base; |
271 | sk = epb->sk; | 265 | sk = epb->sk; |
@@ -322,8 +316,6 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | |||
322 | } | 316 | } |
323 | 317 | ||
324 | transport = (struct sctp_transport *)v; | 318 | transport = (struct sctp_transport *)v; |
325 | if (!sctp_transport_hold(transport)) | ||
326 | return 0; | ||
327 | assoc = transport->asoc; | 319 | assoc = transport->asoc; |
328 | 320 | ||
329 | list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, | 321 | list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e96b15a66aba..f73e9d38d5ba 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2658,20 +2658,23 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, | |||
2658 | } | 2658 | } |
2659 | 2659 | ||
2660 | if (params->spp_flags & SPP_IPV6_FLOWLABEL) { | 2660 | if (params->spp_flags & SPP_IPV6_FLOWLABEL) { |
2661 | if (trans && trans->ipaddr.sa.sa_family == AF_INET6) { | 2661 | if (trans) { |
2662 | trans->flowlabel = params->spp_ipv6_flowlabel & | 2662 | if (trans->ipaddr.sa.sa_family == AF_INET6) { |
2663 | SCTP_FLOWLABEL_VAL_MASK; | ||
2664 | trans->flowlabel |= SCTP_FLOWLABEL_SET_MASK; | ||
2665 | } else if (asoc) { | ||
2666 | list_for_each_entry(trans, | ||
2667 | &asoc->peer.transport_addr_list, | ||
2668 | transports) { | ||
2669 | if (trans->ipaddr.sa.sa_family != AF_INET6) | ||
2670 | continue; | ||
2671 | trans->flowlabel = params->spp_ipv6_flowlabel & | 2663 | trans->flowlabel = params->spp_ipv6_flowlabel & |
2672 | SCTP_FLOWLABEL_VAL_MASK; | 2664 | SCTP_FLOWLABEL_VAL_MASK; |
2673 | trans->flowlabel |= SCTP_FLOWLABEL_SET_MASK; | 2665 | trans->flowlabel |= SCTP_FLOWLABEL_SET_MASK; |
2674 | } | 2666 | } |
2667 | } else if (asoc) { | ||
2668 | struct sctp_transport *t; | ||
2669 | |||
2670 | list_for_each_entry(t, &asoc->peer.transport_addr_list, | ||
2671 | transports) { | ||
2672 | if (t->ipaddr.sa.sa_family != AF_INET6) | ||
2673 | continue; | ||
2674 | t->flowlabel = params->spp_ipv6_flowlabel & | ||
2675 | SCTP_FLOWLABEL_VAL_MASK; | ||
2676 | t->flowlabel |= SCTP_FLOWLABEL_SET_MASK; | ||
2677 | } | ||
2675 | asoc->flowlabel = params->spp_ipv6_flowlabel & | 2678 | asoc->flowlabel = params->spp_ipv6_flowlabel & |
2676 | SCTP_FLOWLABEL_VAL_MASK; | 2679 | SCTP_FLOWLABEL_VAL_MASK; |
2677 | asoc->flowlabel |= SCTP_FLOWLABEL_SET_MASK; | 2680 | asoc->flowlabel |= SCTP_FLOWLABEL_SET_MASK; |
@@ -2687,12 +2690,13 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, | |||
2687 | trans->dscp = params->spp_dscp & SCTP_DSCP_VAL_MASK; | 2690 | trans->dscp = params->spp_dscp & SCTP_DSCP_VAL_MASK; |
2688 | trans->dscp |= SCTP_DSCP_SET_MASK; | 2691 | trans->dscp |= SCTP_DSCP_SET_MASK; |
2689 | } else if (asoc) { | 2692 | } else if (asoc) { |
2690 | list_for_each_entry(trans, | 2693 | struct sctp_transport *t; |
2691 | &asoc->peer.transport_addr_list, | 2694 | |
2695 | list_for_each_entry(t, &asoc->peer.transport_addr_list, | ||
2692 | transports) { | 2696 | transports) { |
2693 | trans->dscp = params->spp_dscp & | 2697 | t->dscp = params->spp_dscp & |
2694 | SCTP_DSCP_VAL_MASK; | 2698 | SCTP_DSCP_VAL_MASK; |
2695 | trans->dscp |= SCTP_DSCP_SET_MASK; | 2699 | t->dscp |= SCTP_DSCP_SET_MASK; |
2696 | } | 2700 | } |
2697 | asoc->dscp = params->spp_dscp & SCTP_DSCP_VAL_MASK; | 2701 | asoc->dscp = params->spp_dscp & SCTP_DSCP_VAL_MASK; |
2698 | asoc->dscp |= SCTP_DSCP_SET_MASK; | 2702 | asoc->dscp |= SCTP_DSCP_SET_MASK; |
@@ -5005,9 +5009,14 @@ struct sctp_transport *sctp_transport_get_next(struct net *net, | |||
5005 | break; | 5009 | break; |
5006 | } | 5010 | } |
5007 | 5011 | ||
5012 | if (!sctp_transport_hold(t)) | ||
5013 | continue; | ||
5014 | |||
5008 | if (net_eq(sock_net(t->asoc->base.sk), net) && | 5015 | if (net_eq(sock_net(t->asoc->base.sk), net) && |
5009 | t->asoc->peer.primary_path == t) | 5016 | t->asoc->peer.primary_path == t) |
5010 | break; | 5017 | break; |
5018 | |||
5019 | sctp_transport_put(t); | ||
5011 | } | 5020 | } |
5012 | 5021 | ||
5013 | return t; | 5022 | return t; |
@@ -5017,13 +5026,18 @@ struct sctp_transport *sctp_transport_get_idx(struct net *net, | |||
5017 | struct rhashtable_iter *iter, | 5026 | struct rhashtable_iter *iter, |
5018 | int pos) | 5027 | int pos) |
5019 | { | 5028 | { |
5020 | void *obj = SEQ_START_TOKEN; | 5029 | struct sctp_transport *t; |
5021 | 5030 | ||
5022 | while (pos && (obj = sctp_transport_get_next(net, iter)) && | 5031 | if (!pos) |
5023 | !IS_ERR(obj)) | 5032 | return SEQ_START_TOKEN; |
5024 | pos--; | ||
5025 | 5033 | ||
5026 | return obj; | 5034 | while ((t = sctp_transport_get_next(net, iter)) && !IS_ERR(t)) { |
5035 | if (!--pos) | ||
5036 | break; | ||
5037 | sctp_transport_put(t); | ||
5038 | } | ||
5039 | |||
5040 | return t; | ||
5027 | } | 5041 | } |
5028 | 5042 | ||
5029 | int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), | 5043 | int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), |
@@ -5082,8 +5096,6 @@ again: | |||
5082 | 5096 | ||
5083 | tsp = sctp_transport_get_idx(net, &hti, *pos + 1); | 5097 | tsp = sctp_transport_get_idx(net, &hti, *pos + 1); |
5084 | for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) { | 5098 | for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) { |
5085 | if (!sctp_transport_hold(tsp)) | ||
5086 | continue; | ||
5087 | ret = cb(tsp, p); | 5099 | ret = cb(tsp, p); |
5088 | if (ret) | 5100 | if (ret) |
5089 | break; | 5101 | break; |
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 9ee6cfea56dd..d8026543bf4c 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -51,12 +51,12 @@ const char tipc_bclink_name[] = "broadcast-link"; | |||
51 | * struct tipc_bc_base - base structure for keeping broadcast send state | 51 | * struct tipc_bc_base - base structure for keeping broadcast send state |
52 | * @link: broadcast send link structure | 52 | * @link: broadcast send link structure |
53 | * @inputq: data input queue; will only carry SOCK_WAKEUP messages | 53 | * @inputq: data input queue; will only carry SOCK_WAKEUP messages |
54 | * @dest: array keeping number of reachable destinations per bearer | 54 | * @dests: array keeping number of reachable destinations per bearer |
55 | * @primary_bearer: a bearer having links to all broadcast destinations, if any | 55 | * @primary_bearer: a bearer having links to all broadcast destinations, if any |
56 | * @bcast_support: indicates if primary bearer, if any, supports broadcast | 56 | * @bcast_support: indicates if primary bearer, if any, supports broadcast |
57 | * @rcast_support: indicates if all peer nodes support replicast | 57 | * @rcast_support: indicates if all peer nodes support replicast |
58 | * @rc_ratio: dest count as percentage of cluster size where send method changes | 58 | * @rc_ratio: dest count as percentage of cluster size where send method changes |
59 | * @bc_threshold: calculated drom rc_ratio; if dests > threshold use broadcast | 59 | * @bc_threshold: calculated from rc_ratio; if dests > threshold use broadcast |
60 | */ | 60 | */ |
61 | struct tipc_bc_base { | 61 | struct tipc_bc_base { |
62 | struct tipc_link *link; | 62 | struct tipc_link *link; |
diff --git a/net/tipc/diag.c b/net/tipc/diag.c index aaabb0b776dd..73137f4aeb68 100644 --- a/net/tipc/diag.c +++ b/net/tipc/diag.c | |||
@@ -84,7 +84,9 @@ static int tipc_sock_diag_handler_dump(struct sk_buff *skb, | |||
84 | 84 | ||
85 | if (h->nlmsg_flags & NLM_F_DUMP) { | 85 | if (h->nlmsg_flags & NLM_F_DUMP) { |
86 | struct netlink_dump_control c = { | 86 | struct netlink_dump_control c = { |
87 | .start = tipc_dump_start, | ||
87 | .dump = tipc_diag_dump, | 88 | .dump = tipc_diag_dump, |
89 | .done = tipc_dump_done, | ||
88 | }; | 90 | }; |
89 | netlink_dump_start(net->diag_nlsk, skb, h, &c); | 91 | netlink_dump_start(net->diag_nlsk, skb, h, &c); |
90 | return 0; | 92 | return 0; |
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 88f027b502f6..66d5b2c5987a 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -980,20 +980,17 @@ int tipc_nl_name_table_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
980 | 980 | ||
981 | struct tipc_dest *tipc_dest_find(struct list_head *l, u32 node, u32 port) | 981 | struct tipc_dest *tipc_dest_find(struct list_head *l, u32 node, u32 port) |
982 | { | 982 | { |
983 | u64 value = (u64)node << 32 | port; | ||
984 | struct tipc_dest *dst; | 983 | struct tipc_dest *dst; |
985 | 984 | ||
986 | list_for_each_entry(dst, l, list) { | 985 | list_for_each_entry(dst, l, list) { |
987 | if (dst->value != value) | 986 | if (dst->node == node && dst->port == port) |
988 | continue; | 987 | return dst; |
989 | return dst; | ||
990 | } | 988 | } |
991 | return NULL; | 989 | return NULL; |
992 | } | 990 | } |
993 | 991 | ||
994 | bool tipc_dest_push(struct list_head *l, u32 node, u32 port) | 992 | bool tipc_dest_push(struct list_head *l, u32 node, u32 port) |
995 | { | 993 | { |
996 | u64 value = (u64)node << 32 | port; | ||
997 | struct tipc_dest *dst; | 994 | struct tipc_dest *dst; |
998 | 995 | ||
999 | if (tipc_dest_find(l, node, port)) | 996 | if (tipc_dest_find(l, node, port)) |
@@ -1002,7 +999,8 @@ bool tipc_dest_push(struct list_head *l, u32 node, u32 port) | |||
1002 | dst = kmalloc(sizeof(*dst), GFP_ATOMIC); | 999 | dst = kmalloc(sizeof(*dst), GFP_ATOMIC); |
1003 | if (unlikely(!dst)) | 1000 | if (unlikely(!dst)) |
1004 | return false; | 1001 | return false; |
1005 | dst->value = value; | 1002 | dst->node = node; |
1003 | dst->port = port; | ||
1006 | list_add(&dst->list, l); | 1004 | list_add(&dst->list, l); |
1007 | return true; | 1005 | return true; |
1008 | } | 1006 | } |
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index 0febba41da86..892bd750b85f 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h | |||
@@ -133,13 +133,8 @@ void tipc_nametbl_stop(struct net *net); | |||
133 | 133 | ||
134 | struct tipc_dest { | 134 | struct tipc_dest { |
135 | struct list_head list; | 135 | struct list_head list; |
136 | union { | 136 | u32 port; |
137 | struct { | 137 | u32 node; |
138 | u32 port; | ||
139 | u32 node; | ||
140 | }; | ||
141 | u64 value; | ||
142 | }; | ||
143 | }; | 138 | }; |
144 | 139 | ||
145 | struct tipc_dest *tipc_dest_find(struct list_head *l, u32 node, u32 port); | 140 | struct tipc_dest *tipc_dest_find(struct list_head *l, u32 node, u32 port); |
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 6ff2254088f6..99ee419210ba 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c | |||
@@ -167,7 +167,9 @@ static const struct genl_ops tipc_genl_v2_ops[] = { | |||
167 | }, | 167 | }, |
168 | { | 168 | { |
169 | .cmd = TIPC_NL_SOCK_GET, | 169 | .cmd = TIPC_NL_SOCK_GET, |
170 | .start = tipc_dump_start, | ||
170 | .dumpit = tipc_nl_sk_dump, | 171 | .dumpit = tipc_nl_sk_dump, |
172 | .done = tipc_dump_done, | ||
171 | .policy = tipc_nl_policy, | 173 | .policy = tipc_nl_policy, |
172 | }, | 174 | }, |
173 | { | 175 | { |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index c1e93c9515bc..ab7a2a7178f7 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -2672,6 +2672,8 @@ void tipc_sk_reinit(struct net *net) | |||
2672 | 2672 | ||
2673 | rhashtable_walk_stop(&iter); | 2673 | rhashtable_walk_stop(&iter); |
2674 | } while (tsk == ERR_PTR(-EAGAIN)); | 2674 | } while (tsk == ERR_PTR(-EAGAIN)); |
2675 | |||
2676 | rhashtable_walk_exit(&iter); | ||
2675 | } | 2677 | } |
2676 | 2678 | ||
2677 | static struct tipc_sock *tipc_sk_lookup(struct net *net, u32 portid) | 2679 | static struct tipc_sock *tipc_sk_lookup(struct net *net, u32 portid) |
@@ -3227,45 +3229,69 @@ int tipc_nl_sk_walk(struct sk_buff *skb, struct netlink_callback *cb, | |||
3227 | struct netlink_callback *cb, | 3229 | struct netlink_callback *cb, |
3228 | struct tipc_sock *tsk)) | 3230 | struct tipc_sock *tsk)) |
3229 | { | 3231 | { |
3230 | struct net *net = sock_net(skb->sk); | 3232 | struct rhashtable_iter *iter = (void *)cb->args[0]; |
3231 | struct tipc_net *tn = tipc_net(net); | ||
3232 | const struct bucket_table *tbl; | ||
3233 | u32 prev_portid = cb->args[1]; | ||
3234 | u32 tbl_id = cb->args[0]; | ||
3235 | struct rhash_head *pos; | ||
3236 | struct tipc_sock *tsk; | 3233 | struct tipc_sock *tsk; |
3237 | int err; | 3234 | int err; |
3238 | 3235 | ||
3239 | rcu_read_lock(); | 3236 | rhashtable_walk_start(iter); |
3240 | tbl = rht_dereference_rcu((&tn->sk_rht)->tbl, &tn->sk_rht); | 3237 | while ((tsk = rhashtable_walk_next(iter)) != NULL) { |
3241 | for (; tbl_id < tbl->size; tbl_id++) { | 3238 | if (IS_ERR(tsk)) { |
3242 | rht_for_each_entry_rcu(tsk, pos, tbl, tbl_id, node) { | 3239 | err = PTR_ERR(tsk); |
3243 | spin_lock_bh(&tsk->sk.sk_lock.slock); | 3240 | if (err == -EAGAIN) { |
3244 | if (prev_portid && prev_portid != tsk->portid) { | 3241 | err = 0; |
3245 | spin_unlock_bh(&tsk->sk.sk_lock.slock); | ||
3246 | continue; | 3242 | continue; |
3247 | } | 3243 | } |
3244 | break; | ||
3245 | } | ||
3248 | 3246 | ||
3249 | err = skb_handler(skb, cb, tsk); | 3247 | sock_hold(&tsk->sk); |
3250 | if (err) { | 3248 | rhashtable_walk_stop(iter); |
3251 | prev_portid = tsk->portid; | 3249 | lock_sock(&tsk->sk); |
3252 | spin_unlock_bh(&tsk->sk.sk_lock.slock); | 3250 | err = skb_handler(skb, cb, tsk); |
3253 | goto out; | 3251 | if (err) { |
3254 | } | 3252 | release_sock(&tsk->sk); |
3255 | 3253 | sock_put(&tsk->sk); | |
3256 | prev_portid = 0; | 3254 | goto out; |
3257 | spin_unlock_bh(&tsk->sk.sk_lock.slock); | ||
3258 | } | 3255 | } |
3256 | release_sock(&tsk->sk); | ||
3257 | rhashtable_walk_start(iter); | ||
3258 | sock_put(&tsk->sk); | ||
3259 | } | 3259 | } |
3260 | rhashtable_walk_stop(iter); | ||
3260 | out: | 3261 | out: |
3261 | rcu_read_unlock(); | ||
3262 | cb->args[0] = tbl_id; | ||
3263 | cb->args[1] = prev_portid; | ||
3264 | |||
3265 | return skb->len; | 3262 | return skb->len; |
3266 | } | 3263 | } |
3267 | EXPORT_SYMBOL(tipc_nl_sk_walk); | 3264 | EXPORT_SYMBOL(tipc_nl_sk_walk); |
3268 | 3265 | ||
3266 | int tipc_dump_start(struct netlink_callback *cb) | ||
3267 | { | ||
3268 | struct rhashtable_iter *iter = (void *)cb->args[0]; | ||
3269 | struct net *net = sock_net(cb->skb->sk); | ||
3270 | struct tipc_net *tn = tipc_net(net); | ||
3271 | |||
3272 | if (!iter) { | ||
3273 | iter = kmalloc(sizeof(*iter), GFP_KERNEL); | ||
3274 | if (!iter) | ||
3275 | return -ENOMEM; | ||
3276 | |||
3277 | cb->args[0] = (long)iter; | ||
3278 | } | ||
3279 | |||
3280 | rhashtable_walk_enter(&tn->sk_rht, iter); | ||
3281 | return 0; | ||
3282 | } | ||
3283 | EXPORT_SYMBOL(tipc_dump_start); | ||
3284 | |||
3285 | int tipc_dump_done(struct netlink_callback *cb) | ||
3286 | { | ||
3287 | struct rhashtable_iter *hti = (void *)cb->args[0]; | ||
3288 | |||
3289 | rhashtable_walk_exit(hti); | ||
3290 | kfree(hti); | ||
3291 | return 0; | ||
3292 | } | ||
3293 | EXPORT_SYMBOL(tipc_dump_done); | ||
3294 | |||
3269 | int tipc_sk_fill_sock_diag(struct sk_buff *skb, struct netlink_callback *cb, | 3295 | int tipc_sk_fill_sock_diag(struct sk_buff *skb, struct netlink_callback *cb, |
3270 | struct tipc_sock *tsk, u32 sk_filter_state, | 3296 | struct tipc_sock *tsk, u32 sk_filter_state, |
3271 | u64 (*tipc_diag_gen_cookie)(struct sock *sk)) | 3297 | u64 (*tipc_diag_gen_cookie)(struct sock *sk)) |
diff --git a/net/tipc/socket.h b/net/tipc/socket.h index aff9b2ae5a1f..d43032e26532 100644 --- a/net/tipc/socket.h +++ b/net/tipc/socket.h | |||
@@ -68,4 +68,6 @@ int tipc_nl_sk_walk(struct sk_buff *skb, struct netlink_callback *cb, | |||
68 | int (*skb_handler)(struct sk_buff *skb, | 68 | int (*skb_handler)(struct sk_buff *skb, |
69 | struct netlink_callback *cb, | 69 | struct netlink_callback *cb, |
70 | struct tipc_sock *tsk)); | 70 | struct tipc_sock *tsk)); |
71 | int tipc_dump_start(struct netlink_callback *cb); | ||
72 | int tipc_dump_done(struct netlink_callback *cb); | ||
71 | #endif | 73 | #endif |
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c index c8e34ef22c30..2627b5d812e9 100644 --- a/net/tipc/topsrv.c +++ b/net/tipc/topsrv.c | |||
@@ -313,8 +313,8 @@ static void tipc_conn_send_work(struct work_struct *work) | |||
313 | conn_put(con); | 313 | conn_put(con); |
314 | } | 314 | } |
315 | 315 | ||
316 | /* tipc_conn_queue_evt() - interrupt level call from a subscription instance | 316 | /* tipc_topsrv_queue_evt() - interrupt level call from a subscription instance |
317 | * The queued work is launched into tipc_send_work()->tipc_send_to_sock() | 317 | * The queued work is launched into tipc_conn_send_work()->tipc_conn_send_to_sock() |
318 | */ | 318 | */ |
319 | void tipc_topsrv_queue_evt(struct net *net, int conid, | 319 | void tipc_topsrv_queue_evt(struct net *net, int conid, |
320 | u32 event, struct tipc_event *evt) | 320 | u32 event, struct tipc_event *evt) |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5fb9b7dd9831..4b8ec659e797 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -669,13 +669,13 @@ static int nl80211_msg_put_wmm_rules(struct sk_buff *msg, | |||
669 | goto nla_put_failure; | 669 | goto nla_put_failure; |
670 | 670 | ||
671 | if (nla_put_u16(msg, NL80211_WMMR_CW_MIN, | 671 | if (nla_put_u16(msg, NL80211_WMMR_CW_MIN, |
672 | rule->wmm_rule->client[j].cw_min) || | 672 | rule->wmm_rule.client[j].cw_min) || |
673 | nla_put_u16(msg, NL80211_WMMR_CW_MAX, | 673 | nla_put_u16(msg, NL80211_WMMR_CW_MAX, |
674 | rule->wmm_rule->client[j].cw_max) || | 674 | rule->wmm_rule.client[j].cw_max) || |
675 | nla_put_u8(msg, NL80211_WMMR_AIFSN, | 675 | nla_put_u8(msg, NL80211_WMMR_AIFSN, |
676 | rule->wmm_rule->client[j].aifsn) || | 676 | rule->wmm_rule.client[j].aifsn) || |
677 | nla_put_u8(msg, NL80211_WMMR_TXOP, | 677 | nla_put_u16(msg, NL80211_WMMR_TXOP, |
678 | rule->wmm_rule->client[j].cot)) | 678 | rule->wmm_rule.client[j].cot)) |
679 | goto nla_put_failure; | 679 | goto nla_put_failure; |
680 | 680 | ||
681 | nla_nest_end(msg, nl_wmm_rule); | 681 | nla_nest_end(msg, nl_wmm_rule); |
@@ -766,9 +766,9 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, struct wiphy *wiphy, | |||
766 | 766 | ||
767 | if (large) { | 767 | if (large) { |
768 | const struct ieee80211_reg_rule *rule = | 768 | const struct ieee80211_reg_rule *rule = |
769 | freq_reg_info(wiphy, chan->center_freq); | 769 | freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq)); |
770 | 770 | ||
771 | if (!IS_ERR(rule) && rule->wmm_rule) { | 771 | if (!IS_ERR_OR_NULL(rule) && rule->has_wmm) { |
772 | if (nl80211_msg_put_wmm_rules(msg, rule)) | 772 | if (nl80211_msg_put_wmm_rules(msg, rule)) |
773 | goto nla_put_failure; | 773 | goto nla_put_failure; |
774 | } | 774 | } |
@@ -12205,6 +12205,7 @@ static int nl80211_update_ft_ies(struct sk_buff *skb, struct genl_info *info) | |||
12205 | return -EOPNOTSUPP; | 12205 | return -EOPNOTSUPP; |
12206 | 12206 | ||
12207 | if (!info->attrs[NL80211_ATTR_MDID] || | 12207 | if (!info->attrs[NL80211_ATTR_MDID] || |
12208 | !info->attrs[NL80211_ATTR_IE] || | ||
12208 | !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) | 12209 | !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) |
12209 | return -EINVAL; | 12210 | return -EINVAL; |
12210 | 12211 | ||
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 4fc66a117b7d..2f702adf2912 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -425,36 +425,23 @@ static const struct ieee80211_regdomain * | |||
425 | reg_copy_regd(const struct ieee80211_regdomain *src_regd) | 425 | reg_copy_regd(const struct ieee80211_regdomain *src_regd) |
426 | { | 426 | { |
427 | struct ieee80211_regdomain *regd; | 427 | struct ieee80211_regdomain *regd; |
428 | int size_of_regd, size_of_wmms; | 428 | int size_of_regd; |
429 | unsigned int i; | 429 | unsigned int i; |
430 | struct ieee80211_wmm_rule *d_wmm, *s_wmm; | ||
431 | 430 | ||
432 | size_of_regd = | 431 | size_of_regd = |
433 | sizeof(struct ieee80211_regdomain) + | 432 | sizeof(struct ieee80211_regdomain) + |
434 | src_regd->n_reg_rules * sizeof(struct ieee80211_reg_rule); | 433 | src_regd->n_reg_rules * sizeof(struct ieee80211_reg_rule); |
435 | size_of_wmms = src_regd->n_wmm_rules * | ||
436 | sizeof(struct ieee80211_wmm_rule); | ||
437 | 434 | ||
438 | regd = kzalloc(size_of_regd + size_of_wmms, GFP_KERNEL); | 435 | regd = kzalloc(size_of_regd, GFP_KERNEL); |
439 | if (!regd) | 436 | if (!regd) |
440 | return ERR_PTR(-ENOMEM); | 437 | return ERR_PTR(-ENOMEM); |
441 | 438 | ||
442 | memcpy(regd, src_regd, sizeof(struct ieee80211_regdomain)); | 439 | memcpy(regd, src_regd, sizeof(struct ieee80211_regdomain)); |
443 | 440 | ||
444 | d_wmm = (struct ieee80211_wmm_rule *)((u8 *)regd + size_of_regd); | 441 | for (i = 0; i < src_regd->n_reg_rules; i++) |
445 | s_wmm = (struct ieee80211_wmm_rule *)((u8 *)src_regd + size_of_regd); | ||
446 | memcpy(d_wmm, s_wmm, size_of_wmms); | ||
447 | |||
448 | for (i = 0; i < src_regd->n_reg_rules; i++) { | ||
449 | memcpy(®d->reg_rules[i], &src_regd->reg_rules[i], | 442 | memcpy(®d->reg_rules[i], &src_regd->reg_rules[i], |
450 | sizeof(struct ieee80211_reg_rule)); | 443 | sizeof(struct ieee80211_reg_rule)); |
451 | if (!src_regd->reg_rules[i].wmm_rule) | ||
452 | continue; | ||
453 | 444 | ||
454 | regd->reg_rules[i].wmm_rule = d_wmm + | ||
455 | (src_regd->reg_rules[i].wmm_rule - s_wmm) / | ||
456 | sizeof(struct ieee80211_wmm_rule); | ||
457 | } | ||
458 | return regd; | 445 | return regd; |
459 | } | 446 | } |
460 | 447 | ||
@@ -860,9 +847,10 @@ static bool valid_regdb(const u8 *data, unsigned int size) | |||
860 | return true; | 847 | return true; |
861 | } | 848 | } |
862 | 849 | ||
863 | static void set_wmm_rule(struct ieee80211_wmm_rule *rule, | 850 | static void set_wmm_rule(struct ieee80211_reg_rule *rrule, |
864 | struct fwdb_wmm_rule *wmm) | 851 | struct fwdb_wmm_rule *wmm) |
865 | { | 852 | { |
853 | struct ieee80211_wmm_rule *rule = &rrule->wmm_rule; | ||
866 | unsigned int i; | 854 | unsigned int i; |
867 | 855 | ||
868 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { | 856 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { |
@@ -876,11 +864,13 @@ static void set_wmm_rule(struct ieee80211_wmm_rule *rule, | |||
876 | rule->ap[i].aifsn = wmm->ap[i].aifsn; | 864 | rule->ap[i].aifsn = wmm->ap[i].aifsn; |
877 | rule->ap[i].cot = 1000 * be16_to_cpu(wmm->ap[i].cot); | 865 | rule->ap[i].cot = 1000 * be16_to_cpu(wmm->ap[i].cot); |
878 | } | 866 | } |
867 | |||
868 | rrule->has_wmm = true; | ||
879 | } | 869 | } |
880 | 870 | ||
881 | static int __regdb_query_wmm(const struct fwdb_header *db, | 871 | static int __regdb_query_wmm(const struct fwdb_header *db, |
882 | const struct fwdb_country *country, int freq, | 872 | const struct fwdb_country *country, int freq, |
883 | u32 *dbptr, struct ieee80211_wmm_rule *rule) | 873 | struct ieee80211_reg_rule *rule) |
884 | { | 874 | { |
885 | unsigned int ptr = be16_to_cpu(country->coll_ptr) << 2; | 875 | unsigned int ptr = be16_to_cpu(country->coll_ptr) << 2; |
886 | struct fwdb_collection *coll = (void *)((u8 *)db + ptr); | 876 | struct fwdb_collection *coll = (void *)((u8 *)db + ptr); |
@@ -901,8 +891,6 @@ static int __regdb_query_wmm(const struct fwdb_header *db, | |||
901 | wmm_ptr = be16_to_cpu(rrule->wmm_ptr) << 2; | 891 | wmm_ptr = be16_to_cpu(rrule->wmm_ptr) << 2; |
902 | wmm = (void *)((u8 *)db + wmm_ptr); | 892 | wmm = (void *)((u8 *)db + wmm_ptr); |
903 | set_wmm_rule(rule, wmm); | 893 | set_wmm_rule(rule, wmm); |
904 | if (dbptr) | ||
905 | *dbptr = wmm_ptr; | ||
906 | return 0; | 894 | return 0; |
907 | } | 895 | } |
908 | } | 896 | } |
@@ -910,8 +898,7 @@ static int __regdb_query_wmm(const struct fwdb_header *db, | |||
910 | return -ENODATA; | 898 | return -ENODATA; |
911 | } | 899 | } |
912 | 900 | ||
913 | int reg_query_regdb_wmm(char *alpha2, int freq, u32 *dbptr, | 901 | int reg_query_regdb_wmm(char *alpha2, int freq, struct ieee80211_reg_rule *rule) |
914 | struct ieee80211_wmm_rule *rule) | ||
915 | { | 902 | { |
916 | const struct fwdb_header *hdr = regdb; | 903 | const struct fwdb_header *hdr = regdb; |
917 | const struct fwdb_country *country; | 904 | const struct fwdb_country *country; |
@@ -925,8 +912,7 @@ int reg_query_regdb_wmm(char *alpha2, int freq, u32 *dbptr, | |||
925 | country = &hdr->country[0]; | 912 | country = &hdr->country[0]; |
926 | while (country->coll_ptr) { | 913 | while (country->coll_ptr) { |
927 | if (alpha2_equal(alpha2, country->alpha2)) | 914 | if (alpha2_equal(alpha2, country->alpha2)) |
928 | return __regdb_query_wmm(regdb, country, freq, dbptr, | 915 | return __regdb_query_wmm(regdb, country, freq, rule); |
929 | rule); | ||
930 | 916 | ||
931 | country++; | 917 | country++; |
932 | } | 918 | } |
@@ -935,32 +921,13 @@ int reg_query_regdb_wmm(char *alpha2, int freq, u32 *dbptr, | |||
935 | } | 921 | } |
936 | EXPORT_SYMBOL(reg_query_regdb_wmm); | 922 | EXPORT_SYMBOL(reg_query_regdb_wmm); |
937 | 923 | ||
938 | struct wmm_ptrs { | ||
939 | struct ieee80211_wmm_rule *rule; | ||
940 | u32 ptr; | ||
941 | }; | ||
942 | |||
943 | static struct ieee80211_wmm_rule *find_wmm_ptr(struct wmm_ptrs *wmm_ptrs, | ||
944 | u32 wmm_ptr, int n_wmms) | ||
945 | { | ||
946 | int i; | ||
947 | |||
948 | for (i = 0; i < n_wmms; i++) { | ||
949 | if (wmm_ptrs[i].ptr == wmm_ptr) | ||
950 | return wmm_ptrs[i].rule; | ||
951 | } | ||
952 | return NULL; | ||
953 | } | ||
954 | |||
955 | static int regdb_query_country(const struct fwdb_header *db, | 924 | static int regdb_query_country(const struct fwdb_header *db, |
956 | const struct fwdb_country *country) | 925 | const struct fwdb_country *country) |
957 | { | 926 | { |
958 | unsigned int ptr = be16_to_cpu(country->coll_ptr) << 2; | 927 | unsigned int ptr = be16_to_cpu(country->coll_ptr) << 2; |
959 | struct fwdb_collection *coll = (void *)((u8 *)db + ptr); | 928 | struct fwdb_collection *coll = (void *)((u8 *)db + ptr); |
960 | struct ieee80211_regdomain *regdom; | 929 | struct ieee80211_regdomain *regdom; |
961 | struct ieee80211_regdomain *tmp_rd; | 930 | unsigned int size_of_regd, i; |
962 | unsigned int size_of_regd, i, n_wmms = 0; | ||
963 | struct wmm_ptrs *wmm_ptrs; | ||
964 | 931 | ||
965 | size_of_regd = sizeof(struct ieee80211_regdomain) + | 932 | size_of_regd = sizeof(struct ieee80211_regdomain) + |
966 | coll->n_rules * sizeof(struct ieee80211_reg_rule); | 933 | coll->n_rules * sizeof(struct ieee80211_reg_rule); |
@@ -969,12 +936,6 @@ static int regdb_query_country(const struct fwdb_header *db, | |||
969 | if (!regdom) | 936 | if (!regdom) |
970 | return -ENOMEM; | 937 | return -ENOMEM; |
971 | 938 | ||
972 | wmm_ptrs = kcalloc(coll->n_rules, sizeof(*wmm_ptrs), GFP_KERNEL); | ||
973 | if (!wmm_ptrs) { | ||
974 | kfree(regdom); | ||
975 | return -ENOMEM; | ||
976 | } | ||
977 | |||
978 | regdom->n_reg_rules = coll->n_rules; | 939 | regdom->n_reg_rules = coll->n_rules; |
979 | regdom->alpha2[0] = country->alpha2[0]; | 940 | regdom->alpha2[0] = country->alpha2[0]; |
980 | regdom->alpha2[1] = country->alpha2[1]; | 941 | regdom->alpha2[1] = country->alpha2[1]; |
@@ -1013,37 +974,11 @@ static int regdb_query_country(const struct fwdb_header *db, | |||
1013 | 1000 * be16_to_cpu(rule->cac_timeout); | 974 | 1000 * be16_to_cpu(rule->cac_timeout); |
1014 | if (rule->len >= offsetofend(struct fwdb_rule, wmm_ptr)) { | 975 | if (rule->len >= offsetofend(struct fwdb_rule, wmm_ptr)) { |
1015 | u32 wmm_ptr = be16_to_cpu(rule->wmm_ptr) << 2; | 976 | u32 wmm_ptr = be16_to_cpu(rule->wmm_ptr) << 2; |
1016 | struct ieee80211_wmm_rule *wmm_pos = | 977 | struct fwdb_wmm_rule *wmm = (void *)((u8 *)db + wmm_ptr); |
1017 | find_wmm_ptr(wmm_ptrs, wmm_ptr, n_wmms); | ||
1018 | struct fwdb_wmm_rule *wmm; | ||
1019 | struct ieee80211_wmm_rule *wmm_rule; | ||
1020 | |||
1021 | if (wmm_pos) { | ||
1022 | rrule->wmm_rule = wmm_pos; | ||
1023 | continue; | ||
1024 | } | ||
1025 | wmm = (void *)((u8 *)db + wmm_ptr); | ||
1026 | tmp_rd = krealloc(regdom, size_of_regd + (n_wmms + 1) * | ||
1027 | sizeof(struct ieee80211_wmm_rule), | ||
1028 | GFP_KERNEL); | ||
1029 | |||
1030 | if (!tmp_rd) { | ||
1031 | kfree(regdom); | ||
1032 | kfree(wmm_ptrs); | ||
1033 | return -ENOMEM; | ||
1034 | } | ||
1035 | regdom = tmp_rd; | ||
1036 | |||
1037 | wmm_rule = (struct ieee80211_wmm_rule *) | ||
1038 | ((u8 *)regdom + size_of_regd + n_wmms * | ||
1039 | sizeof(struct ieee80211_wmm_rule)); | ||
1040 | 978 | ||
1041 | set_wmm_rule(wmm_rule, wmm); | 979 | set_wmm_rule(rrule, wmm); |
1042 | wmm_ptrs[n_wmms].ptr = wmm_ptr; | ||
1043 | wmm_ptrs[n_wmms++].rule = wmm_rule; | ||
1044 | } | 980 | } |
1045 | } | 981 | } |
1046 | kfree(wmm_ptrs); | ||
1047 | 982 | ||
1048 | return reg_schedule_apply(regdom); | 983 | return reg_schedule_apply(regdom); |
1049 | } | 984 | } |
diff --git a/net/wireless/util.c b/net/wireless/util.c index e0825a019e9f..959ed3acd240 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -1456,7 +1456,7 @@ bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, | |||
1456 | u8 *op_class) | 1456 | u8 *op_class) |
1457 | { | 1457 | { |
1458 | u8 vht_opclass; | 1458 | u8 vht_opclass; |
1459 | u16 freq = chandef->center_freq1; | 1459 | u32 freq = chandef->center_freq1; |
1460 | 1460 | ||
1461 | if (freq >= 2412 && freq <= 2472) { | 1461 | if (freq >= 2412 && freq <= 2472) { |
1462 | if (chandef->width > NL80211_CHAN_WIDTH_40) | 1462 | if (chandef->width > NL80211_CHAN_WIDTH_40) |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 5219280bf7ff..161b0224d6ae 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -380,6 +380,7 @@ our $Attribute = qr{ | |||
380 | __noclone| | 380 | __noclone| |
381 | __deprecated| | 381 | __deprecated| |
382 | __read_mostly| | 382 | __read_mostly| |
383 | __ro_after_init| | ||
383 | __kprobes| | 384 | __kprobes| |
384 | $InitAttribute| | 385 | $InitAttribute| |
385 | ____cacheline_aligned| | 386 | ____cacheline_aligned| |
@@ -3311,7 +3312,7 @@ sub process { | |||
3311 | # known declaration macros | 3312 | # known declaration macros |
3312 | $sline =~ /^\+\s+$declaration_macros/ || | 3313 | $sline =~ /^\+\s+$declaration_macros/ || |
3313 | # start of struct or union or enum | 3314 | # start of struct or union or enum |
3314 | $sline =~ /^\+\s+(?:union|struct|enum|typedef)\b/ || | 3315 | $sline =~ /^\+\s+(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ || |
3315 | # start or end of block or continuation of declaration | 3316 | # start or end of block or continuation of declaration |
3316 | $sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ || | 3317 | $sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ || |
3317 | # bitfield continuation | 3318 | # bitfield continuation |
diff --git a/scripts/depmod.sh b/scripts/depmod.sh index 999d585eaa73..e083bcae343f 100755 --- a/scripts/depmod.sh +++ b/scripts/depmod.sh | |||
@@ -11,13 +11,14 @@ DEPMOD=$1 | |||
11 | KERNELRELEASE=$2 | 11 | KERNELRELEASE=$2 |
12 | 12 | ||
13 | if ! test -r System.map ; then | 13 | if ! test -r System.map ; then |
14 | echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2 | ||
14 | exit 0 | 15 | exit 0 |
15 | fi | 16 | fi |
16 | 17 | ||
17 | if [ -z $(command -v $DEPMOD) ]; then | 18 | if [ -z $(command -v $DEPMOD) ]; then |
18 | echo "'make modules_install' requires $DEPMOD. Please install it." >&2 | 19 | echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2 |
19 | echo "This is probably in the kmod package." >&2 | 20 | echo "This is probably in the kmod package." >&2 |
20 | exit 1 | 21 | exit 0 |
21 | fi | 22 | fi |
22 | 23 | ||
23 | # older versions of depmod require the version string to start with three | 24 | # older versions of depmod require the version string to start with three |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 4a7bd2192073..67ed9f6ccdf8 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -221,7 +221,6 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c | |||
221 | 221 | ||
222 | # check if necessary packages are available, and configure build flags | 222 | # check if necessary packages are available, and configure build flags |
223 | define filechk_conf_cfg | 223 | define filechk_conf_cfg |
224 | $(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh; \ | ||
225 | $(CONFIG_SHELL) $< | 224 | $(CONFIG_SHELL) $< |
226 | endef | 225 | endef |
227 | 226 | ||
diff --git a/scripts/kconfig/check-pkgconfig.sh b/scripts/kconfig/check-pkgconfig.sh deleted file mode 100644 index 7a1c40bfb58c..000000000000 --- a/scripts/kconfig/check-pkgconfig.sh +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # SPDX-License-Identifier: GPL-2.0 | ||
3 | # Check for pkg-config presence | ||
4 | |||
5 | if [ -z $(command -v pkg-config) ]; then | ||
6 | echo "'make *config' requires 'pkg-config'. Please install it." 1>&2 | ||
7 | exit 1 | ||
8 | fi | ||
diff --git a/scripts/kconfig/gconf-cfg.sh b/scripts/kconfig/gconf-cfg.sh index 533b3d8f8f08..480ecd8b9f41 100755 --- a/scripts/kconfig/gconf-cfg.sh +++ b/scripts/kconfig/gconf-cfg.sh | |||
@@ -3,6 +3,13 @@ | |||
3 | 3 | ||
4 | PKG="gtk+-2.0 gmodule-2.0 libglade-2.0" | 4 | PKG="gtk+-2.0 gmodule-2.0 libglade-2.0" |
5 | 5 | ||
6 | if [ -z "$(command -v pkg-config)" ]; then | ||
7 | echo >&2 "*" | ||
8 | echo >&2 "* 'make gconfig' requires 'pkg-config'. Please install it." | ||
9 | echo >&2 "*" | ||
10 | exit 1 | ||
11 | fi | ||
12 | |||
6 | if ! pkg-config --exists $PKG; then | 13 | if ! pkg-config --exists $PKG; then |
7 | echo >&2 "*" | 14 | echo >&2 "*" |
8 | echo >&2 "* Unable to find the GTK+ installation. Please make sure that" | 15 | echo >&2 "* Unable to find the GTK+ installation. Please make sure that" |
diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh index e6f9facd0077..c812872d7f9d 100755 --- a/scripts/kconfig/mconf-cfg.sh +++ b/scripts/kconfig/mconf-cfg.sh | |||
@@ -4,20 +4,23 @@ | |||
4 | PKG="ncursesw" | 4 | PKG="ncursesw" |
5 | PKG2="ncurses" | 5 | PKG2="ncurses" |
6 | 6 | ||
7 | if pkg-config --exists $PKG; then | 7 | if [ -n "$(command -v pkg-config)" ]; then |
8 | echo cflags=\"$(pkg-config --cflags $PKG)\" | 8 | if pkg-config --exists $PKG; then |
9 | echo libs=\"$(pkg-config --libs $PKG)\" | 9 | echo cflags=\"$(pkg-config --cflags $PKG)\" |
10 | exit 0 | 10 | echo libs=\"$(pkg-config --libs $PKG)\" |
11 | fi | 11 | exit 0 |
12 | fi | ||
12 | 13 | ||
13 | if pkg-config --exists $PKG2; then | 14 | if pkg-config --exists $PKG2; then |
14 | echo cflags=\"$(pkg-config --cflags $PKG2)\" | 15 | echo cflags=\"$(pkg-config --cflags $PKG2)\" |
15 | echo libs=\"$(pkg-config --libs $PKG2)\" | 16 | echo libs=\"$(pkg-config --libs $PKG2)\" |
16 | exit 0 | 17 | exit 0 |
18 | fi | ||
17 | fi | 19 | fi |
18 | 20 | ||
19 | # Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses | 21 | # Check the default paths in case pkg-config is not installed. |
20 | # by pkg-config. | 22 | # (Even if it is installed, some distributions such as openSUSE cannot |
23 | # find ncurses by pkg-config.) | ||
21 | if [ -f /usr/include/ncursesw/ncurses.h ]; then | 24 | if [ -f /usr/include/ncursesw/ncurses.h ]; then |
22 | echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\" | 25 | echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\" |
23 | echo libs=\"-lncursesw\" | 26 | echo libs=\"-lncursesw\" |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 83b5836615fb..143c05fec161 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -490,7 +490,6 @@ static void build_conf(struct menu *menu) | |||
490 | switch (prop->type) { | 490 | switch (prop->type) { |
491 | case P_MENU: | 491 | case P_MENU: |
492 | child_count++; | 492 | child_count++; |
493 | prompt = prompt; | ||
494 | if (single_menu_mode) { | 493 | if (single_menu_mode) { |
495 | item_make("%s%*c%s", | 494 | item_make("%s%*c%s", |
496 | menu->data ? "-->" : "++>", | 495 | menu->data ? "-->" : "++>", |
diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh index 42f5ac73548e..001559ef0a60 100644 --- a/scripts/kconfig/nconf-cfg.sh +++ b/scripts/kconfig/nconf-cfg.sh | |||
@@ -4,20 +4,23 @@ | |||
4 | PKG="ncursesw menuw panelw" | 4 | PKG="ncursesw menuw panelw" |
5 | PKG2="ncurses menu panel" | 5 | PKG2="ncurses menu panel" |
6 | 6 | ||
7 | if pkg-config --exists $PKG; then | 7 | if [ -n "$(command -v pkg-config)" ]; then |
8 | echo cflags=\"$(pkg-config --cflags $PKG)\" | 8 | if pkg-config --exists $PKG; then |
9 | echo libs=\"$(pkg-config --libs $PKG)\" | 9 | echo cflags=\"$(pkg-config --cflags $PKG)\" |
10 | exit 0 | 10 | echo libs=\"$(pkg-config --libs $PKG)\" |
11 | fi | 11 | exit 0 |
12 | fi | ||
12 | 13 | ||
13 | if pkg-config --exists $PKG2; then | 14 | if pkg-config --exists $PKG2; then |
14 | echo cflags=\"$(pkg-config --cflags $PKG2)\" | 15 | echo cflags=\"$(pkg-config --cflags $PKG2)\" |
15 | echo libs=\"$(pkg-config --libs $PKG2)\" | 16 | echo libs=\"$(pkg-config --libs $PKG2)\" |
16 | exit 0 | 17 | exit 0 |
18 | fi | ||
17 | fi | 19 | fi |
18 | 20 | ||
19 | # Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses | 21 | # Check the default paths in case pkg-config is not installed. |
20 | # by pkg-config. | 22 | # (Even if it is installed, some distributions such as openSUSE cannot |
23 | # find ncurses by pkg-config.) | ||
21 | if [ -f /usr/include/ncursesw/ncurses.h ]; then | 24 | if [ -f /usr/include/ncursesw/ncurses.h ]; then |
22 | echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\" | 25 | echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\" |
23 | echo libs=\"-lncursesw -lmenuw -lpanelw\" | 26 | echo libs=\"-lncursesw -lmenuw -lpanelw\" |
diff --git a/scripts/kconfig/qconf-cfg.sh b/scripts/kconfig/qconf-cfg.sh index 0862e1562536..02ccc0ae1031 100755 --- a/scripts/kconfig/qconf-cfg.sh +++ b/scripts/kconfig/qconf-cfg.sh | |||
@@ -4,6 +4,13 @@ | |||
4 | PKG="Qt5Core Qt5Gui Qt5Widgets" | 4 | PKG="Qt5Core Qt5Gui Qt5Widgets" |
5 | PKG2="QtCore QtGui" | 5 | PKG2="QtCore QtGui" |
6 | 6 | ||
7 | if [ -z "$(command -v pkg-config)" ]; then | ||
8 | echo >&2 "*" | ||
9 | echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it." | ||
10 | echo >&2 "*" | ||
11 | exit 1 | ||
12 | fi | ||
13 | |||
7 | if pkg-config --exists $PKG; then | 14 | if pkg-config --exists $PKG; then |
8 | echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\" | 15 | echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\" |
9 | echo libs=\"$(pkg-config --libs $PKG)\" | 16 | echo libs=\"$(pkg-config --libs $PKG)\" |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index fe06e77c15eb..f599031260d5 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -389,6 +389,9 @@ if ($arch eq "x86_64") { | |||
389 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL\\s_mcount\$"; | 389 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL\\s_mcount\$"; |
390 | $type = ".quad"; | 390 | $type = ".quad"; |
391 | $alignment = 2; | 391 | $alignment = 2; |
392 | } elsif ($arch eq "nds32") { | ||
393 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_NDS32_HI20_RELA\\s+_mcount\$"; | ||
394 | $alignment = 2; | ||
392 | } else { | 395 | } else { |
393 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; | 396 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; |
394 | } | 397 | } |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 71f39410691b..79f7dd57d571 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -74,7 +74,7 @@ scm_version() | |||
74 | fi | 74 | fi |
75 | 75 | ||
76 | # Check for uncommitted changes | 76 | # Check for uncommitted changes |
77 | if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then | 77 | if git status -uno --porcelain | grep -qv '^.. scripts/package'; then |
78 | printf '%s' -dirty | 78 | printf '%s' -dirty |
79 | fi | 79 | fi |
80 | 80 | ||
diff --git a/security/apparmor/secid.c b/security/apparmor/secid.c index f2f22d00db18..4ccec1bcf6f5 100644 --- a/security/apparmor/secid.c +++ b/security/apparmor/secid.c | |||
@@ -79,7 +79,6 @@ int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | |||
79 | struct aa_label *label = aa_secid_to_label(secid); | 79 | struct aa_label *label = aa_secid_to_label(secid); |
80 | int len; | 80 | int len; |
81 | 81 | ||
82 | AA_BUG(!secdata); | ||
83 | AA_BUG(!seclen); | 82 | AA_BUG(!seclen); |
84 | 83 | ||
85 | if (!label) | 84 | if (!label) |
diff --git a/security/keys/dh.c b/security/keys/dh.c index 711e89d8c415..3b602a1e27fa 100644 --- a/security/keys/dh.c +++ b/security/keys/dh.c | |||
@@ -300,7 +300,7 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params, | |||
300 | } | 300 | } |
301 | dh_inputs.g_size = dlen; | 301 | dh_inputs.g_size = dlen; |
302 | 302 | ||
303 | dlen = dh_data_from_key(pcopy.private, &dh_inputs.key); | 303 | dlen = dh_data_from_key(pcopy.dh_private, &dh_inputs.key); |
304 | if (dlen < 0) { | 304 | if (dlen < 0) { |
305 | ret = dlen; | 305 | ret = dlen; |
306 | goto out2; | 306 | goto out2; |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 69517e18ef07..08d5662039e3 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -129,7 +129,7 @@ static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream) | |||
129 | runtime->avail = 0; | 129 | runtime->avail = 0; |
130 | else | 130 | else |
131 | runtime->avail = runtime->buffer_size; | 131 | runtime->avail = runtime->buffer_size; |
132 | runtime->buffer = kvmalloc(runtime->buffer_size, GFP_KERNEL); | 132 | runtime->buffer = kvzalloc(runtime->buffer_size, GFP_KERNEL); |
133 | if (!runtime->buffer) { | 133 | if (!runtime->buffer) { |
134 | kfree(runtime); | 134 | kfree(runtime); |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
@@ -655,7 +655,7 @@ static int resize_runtime_buffer(struct snd_rawmidi_runtime *runtime, | |||
655 | if (params->avail_min < 1 || params->avail_min > params->buffer_size) | 655 | if (params->avail_min < 1 || params->avail_min > params->buffer_size) |
656 | return -EINVAL; | 656 | return -EINVAL; |
657 | if (params->buffer_size != runtime->buffer_size) { | 657 | if (params->buffer_size != runtime->buffer_size) { |
658 | newbuf = kvmalloc(params->buffer_size, GFP_KERNEL); | 658 | newbuf = kvzalloc(params->buffer_size, GFP_KERNEL); |
659 | if (!newbuf) | 659 | if (!newbuf) |
660 | return -ENOMEM; | 660 | return -ENOMEM; |
661 | spin_lock_irq(&runtime->lock); | 661 | spin_lock_irq(&runtime->lock); |
diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c index 1bd27576db98..a835558ddbc9 100644 --- a/sound/hda/ext/hdac_ext_stream.c +++ b/sound/hda/ext/hdac_ext_stream.c | |||
@@ -146,7 +146,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple); | |||
146 | */ | 146 | */ |
147 | void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *stream) | 147 | void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *stream) |
148 | { | 148 | { |
149 | snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, 0, AZX_PPLCCTL_RUN); | 149 | snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, |
150 | AZX_PPLCCTL_RUN, AZX_PPLCCTL_RUN); | ||
150 | } | 151 | } |
151 | EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_start); | 152 | EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_start); |
152 | 153 | ||
@@ -171,7 +172,8 @@ void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *stream) | |||
171 | 172 | ||
172 | snd_hdac_ext_link_stream_clear(stream); | 173 | snd_hdac_ext_link_stream_clear(stream); |
173 | 174 | ||
174 | snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, 0, AZX_PPLCCTL_STRST); | 175 | snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, |
176 | AZX_PPLCCTL_STRST, AZX_PPLCCTL_STRST); | ||
175 | udelay(3); | 177 | udelay(3); |
176 | timeout = 50; | 178 | timeout = 50; |
177 | do { | 179 | do { |
@@ -242,7 +244,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_set_stream_id); | |||
242 | void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link, | 244 | void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link, |
243 | int stream) | 245 | int stream) |
244 | { | 246 | { |
245 | snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, 0, (1 << stream)); | 247 | snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 0); |
246 | } | 248 | } |
247 | EXPORT_SYMBOL_GPL(snd_hdac_ext_link_clear_stream_id); | 249 | EXPORT_SYMBOL_GPL(snd_hdac_ext_link_clear_stream_id); |
248 | 250 | ||
@@ -415,7 +417,6 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *bus, | |||
415 | bool enable, int index) | 417 | bool enable, int index) |
416 | { | 418 | { |
417 | u32 mask = 0; | 419 | u32 mask = 0; |
418 | u32 register_mask = 0; | ||
419 | 420 | ||
420 | if (!bus->spbcap) { | 421 | if (!bus->spbcap) { |
421 | dev_err(bus->dev, "Address of SPB capability is NULL\n"); | 422 | dev_err(bus->dev, "Address of SPB capability is NULL\n"); |
@@ -424,12 +425,8 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *bus, | |||
424 | 425 | ||
425 | mask |= (1 << index); | 426 | mask |= (1 << index); |
426 | 427 | ||
427 | register_mask = readl(bus->spbcap + AZX_REG_SPB_SPBFCCTL); | ||
428 | |||
429 | mask |= register_mask; | ||
430 | |||
431 | if (enable) | 428 | if (enable) |
432 | snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, 0, mask); | 429 | snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, mask); |
433 | else | 430 | else |
434 | snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, 0); | 431 | snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, 0); |
435 | } | 432 | } |
@@ -503,7 +500,6 @@ void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus, | |||
503 | bool enable, int index) | 500 | bool enable, int index) |
504 | { | 501 | { |
505 | u32 mask = 0; | 502 | u32 mask = 0; |
506 | u32 register_mask = 0; | ||
507 | 503 | ||
508 | if (!bus->drsmcap) { | 504 | if (!bus->drsmcap) { |
509 | dev_err(bus->dev, "Address of DRSM capability is NULL\n"); | 505 | dev_err(bus->dev, "Address of DRSM capability is NULL\n"); |
@@ -512,12 +508,8 @@ void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus, | |||
512 | 508 | ||
513 | mask |= (1 << index); | 509 | mask |= (1 << index); |
514 | 510 | ||
515 | register_mask = readl(bus->drsmcap + AZX_REG_SPB_SPBFCCTL); | ||
516 | |||
517 | mask |= register_mask; | ||
518 | |||
519 | if (enable) | 511 | if (enable) |
520 | snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, 0, mask); | 512 | snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, mask); |
521 | else | 513 | else |
522 | snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, 0); | 514 | snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, 0); |
523 | } | 515 | } |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0a5085537034..26d348b47867 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3935,7 +3935,8 @@ void snd_hda_bus_reset_codecs(struct hda_bus *bus) | |||
3935 | 3935 | ||
3936 | list_for_each_codec(codec, bus) { | 3936 | list_for_each_codec(codec, bus) { |
3937 | /* FIXME: maybe a better way needed for forced reset */ | 3937 | /* FIXME: maybe a better way needed for forced reset */ |
3938 | cancel_delayed_work_sync(&codec->jackpoll_work); | 3938 | if (current_work() != &codec->jackpoll_work.work) |
3939 | cancel_delayed_work_sync(&codec->jackpoll_work); | ||
3939 | #ifdef CONFIG_PM | 3940 | #ifdef CONFIG_PM |
3940 | if (hda_codec_is_power_on(codec)) { | 3941 | if (hda_codec_is_power_on(codec)) { |
3941 | hda_call_codec_suspend(codec); | 3942 | hda_call_codec_suspend(codec); |
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c index b2ec20e562bd..b455930a3eaf 100644 --- a/tools/bpf/bpftool/map.c +++ b/tools/bpf/bpftool/map.c | |||
@@ -68,6 +68,7 @@ static const char * const map_type_name[] = { | |||
68 | [BPF_MAP_TYPE_DEVMAP] = "devmap", | 68 | [BPF_MAP_TYPE_DEVMAP] = "devmap", |
69 | [BPF_MAP_TYPE_SOCKMAP] = "sockmap", | 69 | [BPF_MAP_TYPE_SOCKMAP] = "sockmap", |
70 | [BPF_MAP_TYPE_CPUMAP] = "cpumap", | 70 | [BPF_MAP_TYPE_CPUMAP] = "cpumap", |
71 | [BPF_MAP_TYPE_XSKMAP] = "xskmap", | ||
71 | [BPF_MAP_TYPE_SOCKHASH] = "sockhash", | 72 | [BPF_MAP_TYPE_SOCKHASH] = "sockhash", |
72 | [BPF_MAP_TYPE_CGROUP_STORAGE] = "cgroup_storage", | 73 | [BPF_MAP_TYPE_CGROUP_STORAGE] = "cgroup_storage", |
73 | }; | 74 | }; |
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat index 56c4b3f8a01b..439b8a27488d 100755 --- a/tools/kvm/kvm_stat/kvm_stat +++ b/tools/kvm/kvm_stat/kvm_stat | |||
@@ -759,12 +759,18 @@ class DebugfsProvider(Provider): | |||
759 | if len(vms) == 0: | 759 | if len(vms) == 0: |
760 | self.do_read = False | 760 | self.do_read = False |
761 | 761 | ||
762 | self.paths = filter(lambda x: "{}-".format(pid) in x, vms) | 762 | self.paths = list(filter(lambda x: "{}-".format(pid) in x, vms)) |
763 | 763 | ||
764 | else: | 764 | else: |
765 | self.paths = [] | 765 | self.paths = [] |
766 | self.do_read = True | 766 | self.do_read = True |
767 | self.reset() | 767 | |
768 | def _verify_paths(self): | ||
769 | """Remove invalid paths""" | ||
770 | for path in self.paths: | ||
771 | if not os.path.exists(os.path.join(PATH_DEBUGFS_KVM, path)): | ||
772 | self.paths.remove(path) | ||
773 | continue | ||
768 | 774 | ||
769 | def read(self, reset=0, by_guest=0): | 775 | def read(self, reset=0, by_guest=0): |
770 | """Returns a dict with format:'file name / field -> current value'. | 776 | """Returns a dict with format:'file name / field -> current value'. |
@@ -780,6 +786,7 @@ class DebugfsProvider(Provider): | |||
780 | # If no debugfs filtering support is available, then don't read. | 786 | # If no debugfs filtering support is available, then don't read. |
781 | if not self.do_read: | 787 | if not self.do_read: |
782 | return results | 788 | return results |
789 | self._verify_paths() | ||
783 | 790 | ||
784 | paths = self.paths | 791 | paths = self.paths |
785 | if self._pid == 0: | 792 | if self._pid == 0: |
@@ -1096,15 +1103,16 @@ class Tui(object): | |||
1096 | pid = self.stats.pid_filter | 1103 | pid = self.stats.pid_filter |
1097 | self.screen.erase() | 1104 | self.screen.erase() |
1098 | gname = self.get_gname_from_pid(pid) | 1105 | gname = self.get_gname_from_pid(pid) |
1106 | self._gname = gname | ||
1099 | if gname: | 1107 | if gname: |
1100 | gname = ('({})'.format(gname[:MAX_GUEST_NAME_LEN] + '...' | 1108 | gname = ('({})'.format(gname[:MAX_GUEST_NAME_LEN] + '...' |
1101 | if len(gname) > MAX_GUEST_NAME_LEN | 1109 | if len(gname) > MAX_GUEST_NAME_LEN |
1102 | else gname)) | 1110 | else gname)) |
1103 | if pid > 0: | 1111 | if pid > 0: |
1104 | self.screen.addstr(0, 0, 'kvm statistics - pid {0} {1}' | 1112 | self._headline = 'kvm statistics - pid {0} {1}'.format(pid, gname) |
1105 | .format(pid, gname), curses.A_BOLD) | ||
1106 | else: | 1113 | else: |
1107 | self.screen.addstr(0, 0, 'kvm statistics - summary', curses.A_BOLD) | 1114 | self._headline = 'kvm statistics - summary' |
1115 | self.screen.addstr(0, 0, self._headline, curses.A_BOLD) | ||
1108 | if self.stats.fields_filter: | 1116 | if self.stats.fields_filter: |
1109 | regex = self.stats.fields_filter | 1117 | regex = self.stats.fields_filter |
1110 | if len(regex) > MAX_REGEX_LEN: | 1118 | if len(regex) > MAX_REGEX_LEN: |
@@ -1162,6 +1170,19 @@ class Tui(object): | |||
1162 | 1170 | ||
1163 | return sorted_items | 1171 | return sorted_items |
1164 | 1172 | ||
1173 | if not self._is_running_guest(self.stats.pid_filter): | ||
1174 | if self._gname: | ||
1175 | try: # ...to identify the guest by name in case it's back | ||
1176 | pids = self.get_pid_from_gname(self._gname) | ||
1177 | if len(pids) == 1: | ||
1178 | self._refresh_header(pids[0]) | ||
1179 | self._update_pid(pids[0]) | ||
1180 | return | ||
1181 | except: | ||
1182 | pass | ||
1183 | self._display_guest_dead() | ||
1184 | # leave final data on screen | ||
1185 | return | ||
1165 | row = 3 | 1186 | row = 3 |
1166 | self.screen.move(row, 0) | 1187 | self.screen.move(row, 0) |
1167 | self.screen.clrtobot() | 1188 | self.screen.clrtobot() |
@@ -1184,6 +1205,7 @@ class Tui(object): | |||
1184 | # print events | 1205 | # print events |
1185 | tavg = 0 | 1206 | tavg = 0 |
1186 | tcur = 0 | 1207 | tcur = 0 |
1208 | guest_removed = False | ||
1187 | for key, values in get_sorted_events(self, stats): | 1209 | for key, values in get_sorted_events(self, stats): |
1188 | if row >= self.screen.getmaxyx()[0] - 1 or values == (0, 0): | 1210 | if row >= self.screen.getmaxyx()[0] - 1 or values == (0, 0): |
1189 | break | 1211 | break |
@@ -1191,7 +1213,10 @@ class Tui(object): | |||
1191 | key = self.get_gname_from_pid(key) | 1213 | key = self.get_gname_from_pid(key) |
1192 | if not key: | 1214 | if not key: |
1193 | continue | 1215 | continue |
1194 | cur = int(round(values.delta / sleeptime)) if values.delta else '' | 1216 | cur = int(round(values.delta / sleeptime)) if values.delta else 0 |
1217 | if cur < 0: | ||
1218 | guest_removed = True | ||
1219 | continue | ||
1195 | if key[0] != ' ': | 1220 | if key[0] != ' ': |
1196 | if values.delta: | 1221 | if values.delta: |
1197 | tcur += values.delta | 1222 | tcur += values.delta |
@@ -1204,13 +1229,21 @@ class Tui(object): | |||
1204 | values.value * 100 / float(ltotal), cur)) | 1229 | values.value * 100 / float(ltotal), cur)) |
1205 | row += 1 | 1230 | row += 1 |
1206 | if row == 3: | 1231 | if row == 3: |
1207 | self.screen.addstr(4, 1, 'No matching events reported yet') | 1232 | if guest_removed: |
1233 | self.screen.addstr(4, 1, 'Guest removed, updating...') | ||
1234 | else: | ||
1235 | self.screen.addstr(4, 1, 'No matching events reported yet') | ||
1208 | if row > 4: | 1236 | if row > 4: |
1209 | tavg = int(round(tcur / sleeptime)) if tcur > 0 else '' | 1237 | tavg = int(round(tcur / sleeptime)) if tcur > 0 else '' |
1210 | self.screen.addstr(row, 1, '%-40s %10d %8s' % | 1238 | self.screen.addstr(row, 1, '%-40s %10d %8s' % |
1211 | ('Total', total, tavg), curses.A_BOLD) | 1239 | ('Total', total, tavg), curses.A_BOLD) |
1212 | self.screen.refresh() | 1240 | self.screen.refresh() |
1213 | 1241 | ||
1242 | def _display_guest_dead(self): | ||
1243 | marker = ' Guest is DEAD ' | ||
1244 | y = min(len(self._headline), 80 - len(marker)) | ||
1245 | self.screen.addstr(0, y, marker, curses.A_BLINK | curses.A_STANDOUT) | ||
1246 | |||
1214 | def _show_msg(self, text): | 1247 | def _show_msg(self, text): |
1215 | """Display message centered text and exit on key press""" | 1248 | """Display message centered text and exit on key press""" |
1216 | hint = 'Press any key to continue' | 1249 | hint = 'Press any key to continue' |
@@ -1219,10 +1252,10 @@ class Tui(object): | |||
1219 | (x, term_width) = self.screen.getmaxyx() | 1252 | (x, term_width) = self.screen.getmaxyx() |
1220 | row = 2 | 1253 | row = 2 |
1221 | for line in text: | 1254 | for line in text: |
1222 | start = (term_width - len(line)) / 2 | 1255 | start = (term_width - len(line)) // 2 |
1223 | self.screen.addstr(row, start, line) | 1256 | self.screen.addstr(row, start, line) |
1224 | row += 1 | 1257 | row += 1 |
1225 | self.screen.addstr(row + 1, (term_width - len(hint)) / 2, hint, | 1258 | self.screen.addstr(row + 1, (term_width - len(hint)) // 2, hint, |
1226 | curses.A_STANDOUT) | 1259 | curses.A_STANDOUT) |
1227 | self.screen.getkey() | 1260 | self.screen.getkey() |
1228 | 1261 | ||
@@ -1319,6 +1352,12 @@ class Tui(object): | |||
1319 | msg = '"' + str(val) + '": Invalid value' | 1352 | msg = '"' + str(val) + '": Invalid value' |
1320 | self._refresh_header() | 1353 | self._refresh_header() |
1321 | 1354 | ||
1355 | def _is_running_guest(self, pid): | ||
1356 | """Check if pid is still a running process.""" | ||
1357 | if not pid: | ||
1358 | return True | ||
1359 | return os.path.isdir(os.path.join('/proc/', str(pid))) | ||
1360 | |||
1322 | def _show_vm_selection_by_guest(self): | 1361 | def _show_vm_selection_by_guest(self): |
1323 | """Draws guest selection mask. | 1362 | """Draws guest selection mask. |
1324 | 1363 | ||
@@ -1346,7 +1385,7 @@ class Tui(object): | |||
1346 | if not guest or guest == '0': | 1385 | if not guest or guest == '0': |
1347 | break | 1386 | break |
1348 | if guest.isdigit(): | 1387 | if guest.isdigit(): |
1349 | if not os.path.isdir(os.path.join('/proc/', guest)): | 1388 | if not self._is_running_guest(guest): |
1350 | msg = '"' + guest + '": Not a running process' | 1389 | msg = '"' + guest + '": Not a running process' |
1351 | continue | 1390 | continue |
1352 | pid = int(guest) | 1391 | pid = int(guest) |
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh index f8cc38afffa2..32a194e3e07a 100755 --- a/tools/testing/selftests/net/pmtu.sh +++ b/tools/testing/selftests/net/pmtu.sh | |||
@@ -46,6 +46,9 @@ | |||
46 | # Kselftest framework requirement - SKIP code is 4. | 46 | # Kselftest framework requirement - SKIP code is 4. |
47 | ksft_skip=4 | 47 | ksft_skip=4 |
48 | 48 | ||
49 | # Some systems don't have a ping6 binary anymore | ||
50 | which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping) | ||
51 | |||
49 | tests=" | 52 | tests=" |
50 | pmtu_vti6_exception vti6: PMTU exceptions | 53 | pmtu_vti6_exception vti6: PMTU exceptions |
51 | pmtu_vti4_exception vti4: PMTU exceptions | 54 | pmtu_vti4_exception vti4: PMTU exceptions |
@@ -274,7 +277,7 @@ test_pmtu_vti6_exception() { | |||
274 | mtu "${ns_b}" veth_b 4000 | 277 | mtu "${ns_b}" veth_b 4000 |
275 | mtu "${ns_a}" vti6_a 5000 | 278 | mtu "${ns_a}" vti6_a 5000 |
276 | mtu "${ns_b}" vti6_b 5000 | 279 | mtu "${ns_b}" vti6_b 5000 |
277 | ${ns_a} ping6 -q -i 0.1 -w 2 -s 60000 ${vti6_b_addr} > /dev/null | 280 | ${ns_a} ${ping6} -q -i 0.1 -w 2 -s 60000 ${vti6_b_addr} > /dev/null |
278 | 281 | ||
279 | # Check that exception was created | 282 | # Check that exception was created |
280 | if [ "$(route_get_dst_pmtu_from_exception "${ns_a}" ${vti6_b_addr})" = "" ]; then | 283 | if [ "$(route_get_dst_pmtu_from_exception "${ns_a}" ${vti6_b_addr})" = "" ]; then |
@@ -334,7 +337,7 @@ test_pmtu_vti4_link_add_mtu() { | |||
334 | fail=0 | 337 | fail=0 |
335 | 338 | ||
336 | min=68 | 339 | min=68 |
337 | max=$((65528 - 20)) | 340 | max=$((65535 - 20)) |
338 | # Check invalid values first | 341 | # Check invalid values first |
339 | for v in $((min - 1)) $((max + 1)); do | 342 | for v in $((min - 1)) $((max + 1)); do |
340 | ${ns_a} ip link add vti4_a mtu ${v} type vti local ${veth4_a_addr} remote ${veth4_b_addr} key 10 2>/dev/null | 343 | ${ns_a} ip link add vti4_a mtu ${v} type vti local ${veth4_a_addr} remote ${veth4_b_addr} key 10 2>/dev/null |
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/police.json b/tools/testing/selftests/tc-testing/tc-tests/actions/police.json index f03763d81617..30f9b54bd666 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/actions/police.json +++ b/tools/testing/selftests/tc-testing/tc-tests/actions/police.json | |||
@@ -313,6 +313,54 @@ | |||
313 | ] | 313 | ] |
314 | }, | 314 | }, |
315 | { | 315 | { |
316 | "id": "6aaf", | ||
317 | "name": "Add police actions with conform-exceed control pass/pipe [with numeric values]", | ||
318 | "category": [ | ||
319 | "actions", | ||
320 | "police" | ||
321 | ], | ||
322 | "setup": [ | ||
323 | [ | ||
324 | "$TC actions flush action police", | ||
325 | 0, | ||
326 | 1, | ||
327 | 255 | ||
328 | ] | ||
329 | ], | ||
330 | "cmdUnderTest": "$TC actions add action police rate 3mbit burst 250k conform-exceed 0/3 index 1", | ||
331 | "expExitCode": "0", | ||
332 | "verifyCmd": "$TC actions get action police index 1", | ||
333 | "matchPattern": "action order [0-9]*: police 0x1 rate 3Mbit burst 250Kb mtu 2Kb action pass/pipe", | ||
334 | "matchCount": "1", | ||
335 | "teardown": [ | ||
336 | "$TC actions flush action police" | ||
337 | ] | ||
338 | }, | ||
339 | { | ||
340 | "id": "29b1", | ||
341 | "name": "Add police actions with conform-exceed control <invalid>/drop", | ||
342 | "category": [ | ||
343 | "actions", | ||
344 | "police" | ||
345 | ], | ||
346 | "setup": [ | ||
347 | [ | ||
348 | "$TC actions flush action police", | ||
349 | 0, | ||
350 | 1, | ||
351 | 255 | ||
352 | ] | ||
353 | ], | ||
354 | "cmdUnderTest": "$TC actions add action police rate 3mbit burst 250k conform-exceed 10/drop index 1", | ||
355 | "expExitCode": "255", | ||
356 | "verifyCmd": "$TC actions ls action police", | ||
357 | "matchPattern": "action order [0-9]*: police 0x1 rate 3Mbit burst 250Kb mtu 2Kb action ", | ||
358 | "matchCount": "0", | ||
359 | "teardown": [ | ||
360 | "$TC actions flush action police" | ||
361 | ] | ||
362 | }, | ||
363 | { | ||
316 | "id": "c26f", | 364 | "id": "c26f", |
317 | "name": "Add police action with invalid peakrate value", | 365 | "name": "Add police action with invalid peakrate value", |
318 | "category": [ | 366 | "category": [ |
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c index 30cb0a0713ff..37908a83ddc2 100644 --- a/tools/vm/page-types.c +++ b/tools/vm/page-types.c | |||
@@ -159,12 +159,6 @@ static const char * const page_flag_names[] = { | |||
159 | }; | 159 | }; |
160 | 160 | ||
161 | 161 | ||
162 | static const char * const debugfs_known_mountpoints[] = { | ||
163 | "/sys/kernel/debug", | ||
164 | "/debug", | ||
165 | 0, | ||
166 | }; | ||
167 | |||
168 | /* | 162 | /* |
169 | * data structures | 163 | * data structures |
170 | */ | 164 | */ |
diff --git a/tools/vm/slabinfo.c b/tools/vm/slabinfo.c index f82c2eaa859d..334b16db0ebb 100644 --- a/tools/vm/slabinfo.c +++ b/tools/vm/slabinfo.c | |||
@@ -30,8 +30,8 @@ struct slabinfo { | |||
30 | int alias; | 30 | int alias; |
31 | int refs; | 31 | int refs; |
32 | int aliases, align, cache_dma, cpu_slabs, destroy_by_rcu; | 32 | int aliases, align, cache_dma, cpu_slabs, destroy_by_rcu; |
33 | int hwcache_align, object_size, objs_per_slab; | 33 | unsigned int hwcache_align, object_size, objs_per_slab; |
34 | int sanity_checks, slab_size, store_user, trace; | 34 | unsigned int sanity_checks, slab_size, store_user, trace; |
35 | int order, poison, reclaim_account, red_zone; | 35 | int order, poison, reclaim_account, red_zone; |
36 | unsigned long partial, objects, slabs, objects_partial, objects_total; | 36 | unsigned long partial, objects, slabs, objects_partial, objects_total; |
37 | unsigned long alloc_fastpath, alloc_slowpath; | 37 | unsigned long alloc_fastpath, alloc_slowpath; |
diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 91aaf73b00df..ed162a6c57c5 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c | |||
@@ -1817,18 +1817,6 @@ static int kvm_unmap_hva_handler(struct kvm *kvm, gpa_t gpa, u64 size, void *dat | |||
1817 | return 0; | 1817 | return 0; |
1818 | } | 1818 | } |
1819 | 1819 | ||
1820 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) | ||
1821 | { | ||
1822 | unsigned long end = hva + PAGE_SIZE; | ||
1823 | |||
1824 | if (!kvm->arch.pgd) | ||
1825 | return 0; | ||
1826 | |||
1827 | trace_kvm_unmap_hva(hva); | ||
1828 | handle_hva_to_gpa(kvm, hva, end, &kvm_unmap_hva_handler, NULL); | ||
1829 | return 0; | ||
1830 | } | ||
1831 | |||
1832 | int kvm_unmap_hva_range(struct kvm *kvm, | 1820 | int kvm_unmap_hva_range(struct kvm *kvm, |
1833 | unsigned long start, unsigned long end) | 1821 | unsigned long start, unsigned long end) |
1834 | { | 1822 | { |
@@ -1860,13 +1848,20 @@ static int kvm_set_spte_handler(struct kvm *kvm, gpa_t gpa, u64 size, void *data | |||
1860 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) | 1848 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) |
1861 | { | 1849 | { |
1862 | unsigned long end = hva + PAGE_SIZE; | 1850 | unsigned long end = hva + PAGE_SIZE; |
1851 | kvm_pfn_t pfn = pte_pfn(pte); | ||
1863 | pte_t stage2_pte; | 1852 | pte_t stage2_pte; |
1864 | 1853 | ||
1865 | if (!kvm->arch.pgd) | 1854 | if (!kvm->arch.pgd) |
1866 | return; | 1855 | return; |
1867 | 1856 | ||
1868 | trace_kvm_set_spte_hva(hva); | 1857 | trace_kvm_set_spte_hva(hva); |
1869 | stage2_pte = pfn_pte(pte_pfn(pte), PAGE_S2); | 1858 | |
1859 | /* | ||
1860 | * We've moved a page around, probably through CoW, so let's treat it | ||
1861 | * just like a translation fault and clean the cache to the PoC. | ||
1862 | */ | ||
1863 | clean_dcache_guest_page(pfn, PAGE_SIZE); | ||
1864 | stage2_pte = pfn_pte(pfn, PAGE_S2); | ||
1870 | handle_hva_to_gpa(kvm, hva, end, &kvm_set_spte_handler, &stage2_pte); | 1865 | handle_hva_to_gpa(kvm, hva, end, &kvm_set_spte_handler, &stage2_pte); |
1871 | } | 1866 | } |
1872 | 1867 | ||
diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h index e53b596f483b..57b3edebbb40 100644 --- a/virt/kvm/arm/trace.h +++ b/virt/kvm/arm/trace.h | |||
@@ -134,21 +134,6 @@ TRACE_EVENT(kvm_mmio_emulate, | |||
134 | __entry->vcpu_pc, __entry->instr, __entry->cpsr) | 134 | __entry->vcpu_pc, __entry->instr, __entry->cpsr) |
135 | ); | 135 | ); |
136 | 136 | ||
137 | TRACE_EVENT(kvm_unmap_hva, | ||
138 | TP_PROTO(unsigned long hva), | ||
139 | TP_ARGS(hva), | ||
140 | |||
141 | TP_STRUCT__entry( | ||
142 | __field( unsigned long, hva ) | ||
143 | ), | ||
144 | |||
145 | TP_fast_assign( | ||
146 | __entry->hva = hva; | ||
147 | ), | ||
148 | |||
149 | TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva) | ||
150 | ); | ||
151 | |||
152 | TRACE_EVENT(kvm_unmap_hva_range, | 137 | TRACE_EVENT(kvm_unmap_hva_range, |
153 | TP_PROTO(unsigned long start, unsigned long end), | 138 | TP_PROTO(unsigned long start, unsigned long end), |
154 | TP_ARGS(start, end), | 139 | TP_ARGS(start, end), |