aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS10
-rw-r--r--arch/arc/Kconfig21
-rw-r--r--arch/arc/Makefile6
-rw-r--r--arch/arc/boot/dts/abilis_tb100.dtsi58
-rw-r--r--arch/arc/boot/dts/abilis_tb100_dvk.dts14
-rw-r--r--arch/arc/boot/dts/abilis_tb101.dtsi58
-rw-r--r--arch/arc/boot/dts/abilis_tb101_dvk.dts14
-rw-r--r--arch/arc/boot/dts/abilis_tb10x.dtsi60
-rw-r--r--arch/arc/boot/dts/axc001.dtsi6
-rw-r--r--arch/arc/boot/dts/axc003.dtsi16
-rw-r--r--arch/arc/boot/dts/axc003_idu.dtsi16
-rw-r--r--arch/arc/boot/dts/axs10x_mb.dtsi22
-rw-r--r--arch/arc/boot/dts/hsdk.dts33
-rw-r--r--arch/arc/boot/dts/vdk_axc003.dtsi4
-rw-r--r--arch/arc/boot/dts/vdk_axc003_idu.dtsi4
-rw-r--r--arch/arc/boot/dts/vdk_axs10x_mb.dtsi18
-rw-r--r--arch/arc/configs/hsdk_defconfig1
-rw-r--r--arch/arc/include/asm/arcregs.h12
-rw-r--r--arch/arc/include/asm/irqflags-arcv2.h8
-rw-r--r--arch/arc/include/asm/perf_event.h2
-rw-r--r--arch/arc/include/asm/spinlock.h49
-rw-r--r--arch/arc/kernel/head.S6
-rw-r--r--arch/arc/kernel/intc-arcv2.c2
-rw-r--r--arch/arc/kernel/setup.c211
-rw-r--r--arch/arc/kernel/troubleshoot.c5
-rw-r--r--arch/arc/lib/Makefile8
-rw-r--r--arch/arc/lib/memcpy-archs-unaligned.S47
-rw-r--r--arch/arc/plat-eznps/Kconfig12
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/include/asm/cputype.h6
-rw-r--r--arch/arm64/kernel/cpufeature.c1
-rw-r--r--arch/arm64/kernel/probes/kprobes.c56
-rw-r--r--arch/arm64/kernel/stacktrace.c1
-rw-r--r--arch/mips/bcm47xx/workarounds.c1
-rw-r--r--arch/mips/include/asm/jump_label.h8
-rw-r--r--arch/mips/include/uapi/asm/posix_types.h7
-rw-r--r--arch/mips/kernel/vmlinux.lds.S12
-rw-r--r--arch/mips/loongson64/lemote-2f/irq.c2
-rw-r--r--arch/powerpc/include/asm/mmu.h2
-rw-r--r--arch/powerpc/include/asm/vdso_datapage.h8
-rw-r--r--arch/powerpc/kernel/cpu_setup_6xx.S3
-rw-r--r--arch/powerpc/kernel/head_32.S6
-rw-r--r--arch/powerpc/kernel/security.c23
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S4
-rw-r--r--arch/powerpc/mm/hash_low_32.S8
-rw-r--r--block/bio.c43
-rw-r--r--block/blk-cgroup.c9
-rw-r--r--block/blk-iolatency.c1
-rw-r--r--block/blk-mq.c8
-rw-r--r--block/blk-mq.h2
-rw-r--r--block/blk-sysfs.c12
-rw-r--r--drivers/acpi/utils.c1
-rw-r--r--drivers/auxdisplay/Kconfig38
-rw-r--r--drivers/auxdisplay/Makefile2
-rw-r--r--drivers/auxdisplay/charlcd.c55
-rw-r--r--drivers/auxdisplay/hd44780.c4
-rw-r--r--drivers/auxdisplay/panel.c4
-rw-r--r--drivers/base/power/domain.c13
-rw-r--r--drivers/base/swnode.c4
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/paride/pcd.c6
-rw-r--r--drivers/block/paride/pf.c16
-rw-r--r--drivers/block/rbd.c28
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c110
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c15
-rw-r--r--drivers/gpu/drm/i915/i915_gpu_error.c2
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_debugfs.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dmem.c12
-rw-r--r--drivers/gpu/drm/udl/udl_gem.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fb.c12
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c2
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_utils.c12
-rw-r--r--drivers/infiniband/hw/mlx4/alias_GUID.c2
-rw-r--r--drivers/infiniband/hw/mlx5/devx.c34
-rw-r--r--drivers/infiniband/hw/mlx5/main.c7
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c4
-rw-r--r--drivers/iommu/amd_iommu.c7
-rw-r--r--drivers/iommu/intel-iommu.c5
-rw-r--r--drivers/iommu/iova.c5
-rw-r--r--drivers/mmc/host/alcor.c25
-rw-r--r--drivers/mmc/host/davinci_mmc.c2
-rw-r--r--drivers/mmc/host/mxcmmc.c16
-rw-r--r--drivers/mmc/host/pxamci.c2
-rw-r--r--drivers/mmc/host/renesas_sdhi_core.c8
-rw-r--r--drivers/mmc/host/sdhci-omap.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/qp.c72
-rw-r--r--drivers/platform/chrome/cros_ec_debugfs.c10
-rw-r--r--drivers/platform/chrome/wilco_ec/mailbox.c2
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_main.c6
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c23
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/scsi_lib.c15
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/thermal/broadcom/bcm2835_thermal.c9
-rw-r--r--drivers/thermal/cpu_cooling.c3
-rw-r--r--drivers/thermal/intel/int340x_thermal/int3400_thermal.c21
-rw-r--r--drivers/thermal/intel/intel_powerclamp.c4
-rw-r--r--drivers/thermal/mtk_thermal.c7
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c2
-rw-r--r--fs/block_dev.c12
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/file.c148
-rw-r--r--fs/cifs/smb2maperror.c3
-rw-r--r--fs/cifs/smb2pdu.c11
-rw-r--r--fs/cifs/trace.h6
-rw-r--r--fs/io_uring.c439
-rw-r--r--fs/iomap.c12
-rw-r--r--fs/notify/fanotify/fanotify_user.c12
-rw-r--r--fs/notify/inotify/inotify_user.c7
-rw-r--r--fs/udf/inode.c4
-rw-r--r--fs/udf/truncate.c8
-rw-r--r--fs/udf/udfdecl.h2
-rw-r--r--include/linux/blk-mq.h3
-rw-r--r--include/linux/blk_types.h1
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/mlx5/qp.h3
-rw-r--r--include/linux/sbitmap.h2
-rw-r--r--include/linux/uio.h24
-rw-r--r--include/misc/charlcd.h1
-rw-r--r--kernel/watchdog.c4
-rw-r--r--net/ceph/ceph_common.c18
-rw-r--r--net/ceph/mon_client.c9
-rw-r--r--security/selinux/ss/policydb.c13
-rw-r--r--sound/drivers/opl3/opl3_voice.h2
-rw-r--r--sound/firewire/motu/motu.c20
-rw-r--r--sound/isa/sb/sb8.c4
-rw-r--r--sound/pci/echoaudio/echoaudio.c5
-rw-r--r--sound/pci/hda/hda_codec.c20
-rw-r--r--sound/pci/hda/hda_intel.c14
-rw-r--r--sound/pci/hda/patch_realtek.c17
-rw-r--r--tools/objtool/check.c3
-rw-r--r--tools/power/x86/turbostat/turbostat.c3
138 files changed, 1428 insertions, 1010 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index e17ebf70b548..3e5a5d263f29 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8096,6 +8096,16 @@ F: include/linux/iommu.h
8096F: include/linux/of_iommu.h 8096F: include/linux/of_iommu.h
8097F: include/linux/iova.h 8097F: include/linux/iova.h
8098 8098
8099IO_URING
8100M: Jens Axboe <axboe@kernel.dk>
8101L: linux-block@vger.kernel.org
8102L: linux-fsdevel@vger.kernel.org
8103T: git git://git.kernel.dk/linux-block
8104T: git git://git.kernel.dk/liburing
8105S: Maintained
8106F: fs/io_uring.c
8107F: include/uapi/linux/io_uring.h
8108
8099IP MASQUERADING 8109IP MASQUERADING
8100M: Juanjo Ciarlante <jjciarla@raiz.uncu.edu.ar> 8110M: Juanjo Ciarlante <jjciarla@raiz.uncu.edu.ar>
8101S: Maintained 8111S: Maintained
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index df55672c59e6..c781e45d1d99 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -144,11 +144,11 @@ config ARC_CPU_770
144 Support for ARC770 core introduced with Rel 4.10 (Summer 2011) 144 Support for ARC770 core introduced with Rel 4.10 (Summer 2011)
145 This core has a bunch of cool new features: 145 This core has a bunch of cool new features:
146 -MMU-v3: Variable Page Sz (4k, 8k, 16k), bigger J-TLB (128x4) 146 -MMU-v3: Variable Page Sz (4k, 8k, 16k), bigger J-TLB (128x4)
147 Shared Address Spaces (for sharing TLB entries in MMU) 147 Shared Address Spaces (for sharing TLB entries in MMU)
148 -Caches: New Prog Model, Region Flush 148 -Caches: New Prog Model, Region Flush
149 -Insns: endian swap, load-locked/store-conditional, time-stamp-ctr 149 -Insns: endian swap, load-locked/store-conditional, time-stamp-ctr
150 150
151endif #ISA_ARCOMPACT 151endif #ISA_ARCOMPACT
152 152
153config ARC_CPU_HS 153config ARC_CPU_HS
154 bool "ARC-HS" 154 bool "ARC-HS"
@@ -198,7 +198,7 @@ config ARC_SMP_HALT_ON_RESET
198 at designated entry point. For other case, all jump to common 198 at designated entry point. For other case, all jump to common
199 entry point and spin wait for Master's signal. 199 entry point and spin wait for Master's signal.
200 200
201endif #SMP 201endif #SMP
202 202
203config ARC_MCIP 203config ARC_MCIP
204 bool "ARConnect Multicore IP (MCIP) Support " 204 bool "ARConnect Multicore IP (MCIP) Support "
@@ -249,7 +249,7 @@ config ARC_CACHE_VIPT_ALIASING
249 bool "Support VIPT Aliasing D$" 249 bool "Support VIPT Aliasing D$"
250 depends on ARC_HAS_DCACHE && ISA_ARCOMPACT 250 depends on ARC_HAS_DCACHE && ISA_ARCOMPACT
251 251
252endif #ARC_CACHE 252endif #ARC_CACHE
253 253
254config ARC_HAS_ICCM 254config ARC_HAS_ICCM
255 bool "Use ICCM" 255 bool "Use ICCM"
@@ -370,7 +370,7 @@ config ARC_FPU_SAVE_RESTORE
370 based on actual usage of FPU by a task. Thus our implemn does 370 based on actual usage of FPU by a task. Thus our implemn does
371 this for all tasks in system. 371 this for all tasks in system.
372 372
373endif #ISA_ARCOMPACT 373endif #ISA_ARCOMPACT
374 374
375config ARC_CANT_LLSC 375config ARC_CANT_LLSC
376 def_bool n 376 def_bool n
@@ -386,6 +386,15 @@ config ARC_HAS_SWAPE
386 386
387if ISA_ARCV2 387if ISA_ARCV2
388 388
389config ARC_USE_UNALIGNED_MEM_ACCESS
390 bool "Enable unaligned access in HW"
391 default y
392 select HAVE_EFFICIENT_UNALIGNED_ACCESS
393 help
394 The ARC HS architecture supports unaligned memory access
395 which is disabled by default. Enable unaligned access in
396 hardware and use software to use it
397
389config ARC_HAS_LL64 398config ARC_HAS_LL64
390 bool "Insn: 64bit LDD/STD" 399 bool "Insn: 64bit LDD/STD"
391 help 400 help
@@ -414,7 +423,7 @@ config ARC_IRQ_NO_AUTOSAVE
414 This is programmable and can be optionally disabled in which case 423 This is programmable and can be optionally disabled in which case
415 software INTERRUPT_PROLOGUE/EPILGUE do the needed work 424 software INTERRUPT_PROLOGUE/EPILGUE do the needed work
416 425
417endif # ISA_ARCV2 426endif # ISA_ARCV2
418 427
419endmenu # "ARC CPU Configuration" 428endmenu # "ARC CPU Configuration"
420 429
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index df00578c279d..e2b991f75bc5 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -28,6 +28,12 @@ cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
28 28
29ifdef CONFIG_ISA_ARCV2 29ifdef CONFIG_ISA_ARCV2
30 30
31ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
32cflags-y += -munaligned-access
33else
34cflags-y += -mno-unaligned-access
35endif
36
31ifndef CONFIG_ARC_HAS_LL64 37ifndef CONFIG_ARC_HAS_LL64
32cflags-y += -mno-ll64 38cflags-y += -mno-ll64
33endif 39endif
diff --git a/arch/arc/boot/dts/abilis_tb100.dtsi b/arch/arc/boot/dts/abilis_tb100.dtsi
index 02410b211433..c0bcd97522bb 100644
--- a/arch/arc/boot/dts/abilis_tb100.dtsi
+++ b/arch/arc/boot/dts/abilis_tb100.dtsi
@@ -38,7 +38,7 @@
38 clock-div = <6>; 38 clock-div = <6>;
39 }; 39 };
40 40
41 iomux: iomux@FF10601c { 41 iomux: iomux@ff10601c {
42 /* Port 1 */ 42 /* Port 1 */
43 pctl_tsin_s0: pctl-tsin-s0 { /* Serial TS-in 0 */ 43 pctl_tsin_s0: pctl-tsin-s0 { /* Serial TS-in 0 */
44 abilis,function = "mis0"; 44 abilis,function = "mis0";
@@ -162,182 +162,182 @@
162 }; 162 };
163 }; 163 };
164 164
165 gpioa: gpio@FF140000 { 165 gpioa: gpio@ff140000 {
166 compatible = "abilis,tb10x-gpio"; 166 compatible = "abilis,tb10x-gpio";
167 interrupt-controller; 167 interrupt-controller;
168 #interrupt-cells = <1>; 168 #interrupt-cells = <1>;
169 interrupt-parent = <&tb10x_ictl>; 169 interrupt-parent = <&tb10x_ictl>;
170 interrupts = <27 2>; 170 interrupts = <27 2>;
171 reg = <0xFF140000 0x1000>; 171 reg = <0xff140000 0x1000>;
172 gpio-controller; 172 gpio-controller;
173 #gpio-cells = <2>; 173 #gpio-cells = <2>;
174 abilis,ngpio = <3>; 174 abilis,ngpio = <3>;
175 gpio-ranges = <&iomux 0 0 0>; 175 gpio-ranges = <&iomux 0 0 0>;
176 gpio-ranges-group-names = "gpioa"; 176 gpio-ranges-group-names = "gpioa";
177 }; 177 };
178 gpiob: gpio@FF141000 { 178 gpiob: gpio@ff141000 {
179 compatible = "abilis,tb10x-gpio"; 179 compatible = "abilis,tb10x-gpio";
180 interrupt-controller; 180 interrupt-controller;
181 #interrupt-cells = <1>; 181 #interrupt-cells = <1>;
182 interrupt-parent = <&tb10x_ictl>; 182 interrupt-parent = <&tb10x_ictl>;
183 interrupts = <27 2>; 183 interrupts = <27 2>;
184 reg = <0xFF141000 0x1000>; 184 reg = <0xff141000 0x1000>;
185 gpio-controller; 185 gpio-controller;
186 #gpio-cells = <2>; 186 #gpio-cells = <2>;
187 abilis,ngpio = <2>; 187 abilis,ngpio = <2>;
188 gpio-ranges = <&iomux 0 0 0>; 188 gpio-ranges = <&iomux 0 0 0>;
189 gpio-ranges-group-names = "gpiob"; 189 gpio-ranges-group-names = "gpiob";
190 }; 190 };
191 gpioc: gpio@FF142000 { 191 gpioc: gpio@ff142000 {
192 compatible = "abilis,tb10x-gpio"; 192 compatible = "abilis,tb10x-gpio";
193 interrupt-controller; 193 interrupt-controller;
194 #interrupt-cells = <1>; 194 #interrupt-cells = <1>;
195 interrupt-parent = <&tb10x_ictl>; 195 interrupt-parent = <&tb10x_ictl>;
196 interrupts = <27 2>; 196 interrupts = <27 2>;
197 reg = <0xFF142000 0x1000>; 197 reg = <0xff142000 0x1000>;
198 gpio-controller; 198 gpio-controller;
199 #gpio-cells = <2>; 199 #gpio-cells = <2>;
200 abilis,ngpio = <3>; 200 abilis,ngpio = <3>;
201 gpio-ranges = <&iomux 0 0 0>; 201 gpio-ranges = <&iomux 0 0 0>;
202 gpio-ranges-group-names = "gpioc"; 202 gpio-ranges-group-names = "gpioc";
203 }; 203 };
204 gpiod: gpio@FF143000 { 204 gpiod: gpio@ff143000 {
205 compatible = "abilis,tb10x-gpio"; 205 compatible = "abilis,tb10x-gpio";
206 interrupt-controller; 206 interrupt-controller;
207 #interrupt-cells = <1>; 207 #interrupt-cells = <1>;
208 interrupt-parent = <&tb10x_ictl>; 208 interrupt-parent = <&tb10x_ictl>;
209 interrupts = <27 2>; 209 interrupts = <27 2>;
210 reg = <0xFF143000 0x1000>; 210 reg = <0xff143000 0x1000>;
211 gpio-controller; 211 gpio-controller;
212 #gpio-cells = <2>; 212 #gpio-cells = <2>;
213 abilis,ngpio = <2>; 213 abilis,ngpio = <2>;
214 gpio-ranges = <&iomux 0 0 0>; 214 gpio-ranges = <&iomux 0 0 0>;
215 gpio-ranges-group-names = "gpiod"; 215 gpio-ranges-group-names = "gpiod";
216 }; 216 };
217 gpioe: gpio@FF144000 { 217 gpioe: gpio@ff144000 {
218 compatible = "abilis,tb10x-gpio"; 218 compatible = "abilis,tb10x-gpio";
219 interrupt-controller; 219 interrupt-controller;
220 #interrupt-cells = <1>; 220 #interrupt-cells = <1>;
221 interrupt-parent = <&tb10x_ictl>; 221 interrupt-parent = <&tb10x_ictl>;
222 interrupts = <27 2>; 222 interrupts = <27 2>;
223 reg = <0xFF144000 0x1000>; 223 reg = <0xff144000 0x1000>;
224 gpio-controller; 224 gpio-controller;
225 #gpio-cells = <2>; 225 #gpio-cells = <2>;
226 abilis,ngpio = <3>; 226 abilis,ngpio = <3>;
227 gpio-ranges = <&iomux 0 0 0>; 227 gpio-ranges = <&iomux 0 0 0>;
228 gpio-ranges-group-names = "gpioe"; 228 gpio-ranges-group-names = "gpioe";
229 }; 229 };
230 gpiof: gpio@FF145000 { 230 gpiof: gpio@ff145000 {
231 compatible = "abilis,tb10x-gpio"; 231 compatible = "abilis,tb10x-gpio";
232 interrupt-controller; 232 interrupt-controller;
233 #interrupt-cells = <1>; 233 #interrupt-cells = <1>;
234 interrupt-parent = <&tb10x_ictl>; 234 interrupt-parent = <&tb10x_ictl>;
235 interrupts = <27 2>; 235 interrupts = <27 2>;
236 reg = <0xFF145000 0x1000>; 236 reg = <0xff145000 0x1000>;
237 gpio-controller; 237 gpio-controller;
238 #gpio-cells = <2>; 238 #gpio-cells = <2>;
239 abilis,ngpio = <2>; 239 abilis,ngpio = <2>;
240 gpio-ranges = <&iomux 0 0 0>; 240 gpio-ranges = <&iomux 0 0 0>;
241 gpio-ranges-group-names = "gpiof"; 241 gpio-ranges-group-names = "gpiof";
242 }; 242 };
243 gpiog: gpio@FF146000 { 243 gpiog: gpio@ff146000 {
244 compatible = "abilis,tb10x-gpio"; 244 compatible = "abilis,tb10x-gpio";
245 interrupt-controller; 245 interrupt-controller;
246 #interrupt-cells = <1>; 246 #interrupt-cells = <1>;
247 interrupt-parent = <&tb10x_ictl>; 247 interrupt-parent = <&tb10x_ictl>;
248 interrupts = <27 2>; 248 interrupts = <27 2>;
249 reg = <0xFF146000 0x1000>; 249 reg = <0xff146000 0x1000>;
250 gpio-controller; 250 gpio-controller;
251 #gpio-cells = <2>; 251 #gpio-cells = <2>;
252 abilis,ngpio = <3>; 252 abilis,ngpio = <3>;
253 gpio-ranges = <&iomux 0 0 0>; 253 gpio-ranges = <&iomux 0 0 0>;
254 gpio-ranges-group-names = "gpiog"; 254 gpio-ranges-group-names = "gpiog";
255 }; 255 };
256 gpioh: gpio@FF147000 { 256 gpioh: gpio@ff147000 {
257 compatible = "abilis,tb10x-gpio"; 257 compatible = "abilis,tb10x-gpio";
258 interrupt-controller; 258 interrupt-controller;
259 #interrupt-cells = <1>; 259 #interrupt-cells = <1>;
260 interrupt-parent = <&tb10x_ictl>; 260 interrupt-parent = <&tb10x_ictl>;
261 interrupts = <27 2>; 261 interrupts = <27 2>;
262 reg = <0xFF147000 0x1000>; 262 reg = <0xff147000 0x1000>;
263 gpio-controller; 263 gpio-controller;
264 #gpio-cells = <2>; 264 #gpio-cells = <2>;
265 abilis,ngpio = <2>; 265 abilis,ngpio = <2>;
266 gpio-ranges = <&iomux 0 0 0>; 266 gpio-ranges = <&iomux 0 0 0>;
267 gpio-ranges-group-names = "gpioh"; 267 gpio-ranges-group-names = "gpioh";
268 }; 268 };
269 gpioi: gpio@FF148000 { 269 gpioi: gpio@ff148000 {
270 compatible = "abilis,tb10x-gpio"; 270 compatible = "abilis,tb10x-gpio";
271 interrupt-controller; 271 interrupt-controller;
272 #interrupt-cells = <1>; 272 #interrupt-cells = <1>;
273 interrupt-parent = <&tb10x_ictl>; 273 interrupt-parent = <&tb10x_ictl>;
274 interrupts = <27 2>; 274 interrupts = <27 2>;
275 reg = <0xFF148000 0x1000>; 275 reg = <0xff148000 0x1000>;
276 gpio-controller; 276 gpio-controller;
277 #gpio-cells = <2>; 277 #gpio-cells = <2>;
278 abilis,ngpio = <12>; 278 abilis,ngpio = <12>;
279 gpio-ranges = <&iomux 0 0 0>; 279 gpio-ranges = <&iomux 0 0 0>;
280 gpio-ranges-group-names = "gpioi"; 280 gpio-ranges-group-names = "gpioi";
281 }; 281 };
282 gpioj: gpio@FF149000 { 282 gpioj: gpio@ff149000 {
283 compatible = "abilis,tb10x-gpio"; 283 compatible = "abilis,tb10x-gpio";
284 interrupt-controller; 284 interrupt-controller;
285 #interrupt-cells = <1>; 285 #interrupt-cells = <1>;
286 interrupt-parent = <&tb10x_ictl>; 286 interrupt-parent = <&tb10x_ictl>;
287 interrupts = <27 2>; 287 interrupts = <27 2>;
288 reg = <0xFF149000 0x1000>; 288 reg = <0xff149000 0x1000>;
289 gpio-controller; 289 gpio-controller;
290 #gpio-cells = <2>; 290 #gpio-cells = <2>;
291 abilis,ngpio = <32>; 291 abilis,ngpio = <32>;
292 gpio-ranges = <&iomux 0 0 0>; 292 gpio-ranges = <&iomux 0 0 0>;
293 gpio-ranges-group-names = "gpioj"; 293 gpio-ranges-group-names = "gpioj";
294 }; 294 };
295 gpiok: gpio@FF14a000 { 295 gpiok: gpio@ff14a000 {
296 compatible = "abilis,tb10x-gpio"; 296 compatible = "abilis,tb10x-gpio";
297 interrupt-controller; 297 interrupt-controller;
298 #interrupt-cells = <1>; 298 #interrupt-cells = <1>;
299 interrupt-parent = <&tb10x_ictl>; 299 interrupt-parent = <&tb10x_ictl>;
300 interrupts = <27 2>; 300 interrupts = <27 2>;
301 reg = <0xFF14A000 0x1000>; 301 reg = <0xff14a000 0x1000>;
302 gpio-controller; 302 gpio-controller;
303 #gpio-cells = <2>; 303 #gpio-cells = <2>;
304 abilis,ngpio = <22>; 304 abilis,ngpio = <22>;
305 gpio-ranges = <&iomux 0 0 0>; 305 gpio-ranges = <&iomux 0 0 0>;
306 gpio-ranges-group-names = "gpiok"; 306 gpio-ranges-group-names = "gpiok";
307 }; 307 };
308 gpiol: gpio@FF14b000 { 308 gpiol: gpio@ff14b000 {
309 compatible = "abilis,tb10x-gpio"; 309 compatible = "abilis,tb10x-gpio";
310 interrupt-controller; 310 interrupt-controller;
311 #interrupt-cells = <1>; 311 #interrupt-cells = <1>;
312 interrupt-parent = <&tb10x_ictl>; 312 interrupt-parent = <&tb10x_ictl>;
313 interrupts = <27 2>; 313 interrupts = <27 2>;
314 reg = <0xFF14B000 0x1000>; 314 reg = <0xff14b000 0x1000>;
315 gpio-controller; 315 gpio-controller;
316 #gpio-cells = <2>; 316 #gpio-cells = <2>;
317 abilis,ngpio = <4>; 317 abilis,ngpio = <4>;
318 gpio-ranges = <&iomux 0 0 0>; 318 gpio-ranges = <&iomux 0 0 0>;
319 gpio-ranges-group-names = "gpiol"; 319 gpio-ranges-group-names = "gpiol";
320 }; 320 };
321 gpiom: gpio@FF14c000 { 321 gpiom: gpio@ff14c000 {
322 compatible = "abilis,tb10x-gpio"; 322 compatible = "abilis,tb10x-gpio";
323 interrupt-controller; 323 interrupt-controller;
324 #interrupt-cells = <1>; 324 #interrupt-cells = <1>;
325 interrupt-parent = <&tb10x_ictl>; 325 interrupt-parent = <&tb10x_ictl>;
326 interrupts = <27 2>; 326 interrupts = <27 2>;
327 reg = <0xFF14C000 0x1000>; 327 reg = <0xff14c000 0x1000>;
328 gpio-controller; 328 gpio-controller;
329 #gpio-cells = <2>; 329 #gpio-cells = <2>;
330 abilis,ngpio = <4>; 330 abilis,ngpio = <4>;
331 gpio-ranges = <&iomux 0 0 0>; 331 gpio-ranges = <&iomux 0 0 0>;
332 gpio-ranges-group-names = "gpiom"; 332 gpio-ranges-group-names = "gpiom";
333 }; 333 };
334 gpion: gpio@FF14d000 { 334 gpion: gpio@ff14d000 {
335 compatible = "abilis,tb10x-gpio"; 335 compatible = "abilis,tb10x-gpio";
336 interrupt-controller; 336 interrupt-controller;
337 #interrupt-cells = <1>; 337 #interrupt-cells = <1>;
338 interrupt-parent = <&tb10x_ictl>; 338 interrupt-parent = <&tb10x_ictl>;
339 interrupts = <27 2>; 339 interrupts = <27 2>;
340 reg = <0xFF14D000 0x1000>; 340 reg = <0xff14d000 0x1000>;
341 gpio-controller; 341 gpio-controller;
342 #gpio-cells = <2>; 342 #gpio-cells = <2>;
343 abilis,ngpio = <5>; 343 abilis,ngpio = <5>;
diff --git a/arch/arc/boot/dts/abilis_tb100_dvk.dts b/arch/arc/boot/dts/abilis_tb100_dvk.dts
index 3acf04db8030..c968e677db46 100644
--- a/arch/arc/boot/dts/abilis_tb100_dvk.dts
+++ b/arch/arc/boot/dts/abilis_tb100_dvk.dts
@@ -37,27 +37,27 @@
37 }; 37 };
38 38
39 soc100 { 39 soc100 {
40 uart@FF100000 { 40 uart@ff100000 {
41 pinctrl-names = "default"; 41 pinctrl-names = "default";
42 pinctrl-0 = <&pctl_uart0>; 42 pinctrl-0 = <&pctl_uart0>;
43 }; 43 };
44 ethernet@FE100000 { 44 ethernet@fe100000 {
45 phy-mode = "rgmii"; 45 phy-mode = "rgmii";
46 }; 46 };
47 47
48 i2c0: i2c@FF120000 { 48 i2c0: i2c@ff120000 {
49 i2c-sda-hold-time-ns = <432>; 49 i2c-sda-hold-time-ns = <432>;
50 }; 50 };
51 i2c1: i2c@FF121000 { 51 i2c1: i2c@ff121000 {
52 i2c-sda-hold-time-ns = <432>; 52 i2c-sda-hold-time-ns = <432>;
53 }; 53 };
54 i2c2: i2c@FF122000 { 54 i2c2: i2c@ff122000 {
55 i2c-sda-hold-time-ns = <432>; 55 i2c-sda-hold-time-ns = <432>;
56 }; 56 };
57 i2c3: i2c@FF123000 { 57 i2c3: i2c@ff123000 {
58 i2c-sda-hold-time-ns = <432>; 58 i2c-sda-hold-time-ns = <432>;
59 }; 59 };
60 i2c4: i2c@FF124000 { 60 i2c4: i2c@ff124000 {
61 i2c-sda-hold-time-ns = <432>; 61 i2c-sda-hold-time-ns = <432>;
62 }; 62 };
63 63
diff --git a/arch/arc/boot/dts/abilis_tb101.dtsi b/arch/arc/boot/dts/abilis_tb101.dtsi
index f9e7686044eb..6a1615f58f05 100644
--- a/arch/arc/boot/dts/abilis_tb101.dtsi
+++ b/arch/arc/boot/dts/abilis_tb101.dtsi
@@ -38,7 +38,7 @@
38 clock-div = <6>; 38 clock-div = <6>;
39 }; 39 };
40 40
41 iomux: iomux@FF10601c { 41 iomux: iomux@ff10601c {
42 /* Port 1 */ 42 /* Port 1 */
43 pctl_tsin_s0: pctl-tsin-s0 { /* Serial TS-in 0 */ 43 pctl_tsin_s0: pctl-tsin-s0 { /* Serial TS-in 0 */
44 abilis,function = "mis0"; 44 abilis,function = "mis0";
@@ -171,182 +171,182 @@
171 }; 171 };
172 }; 172 };
173 173
174 gpioa: gpio@FF140000 { 174 gpioa: gpio@ff140000 {
175 compatible = "abilis,tb10x-gpio"; 175 compatible = "abilis,tb10x-gpio";
176 interrupt-controller; 176 interrupt-controller;
177 #interrupt-cells = <1>; 177 #interrupt-cells = <1>;
178 interrupt-parent = <&tb10x_ictl>; 178 interrupt-parent = <&tb10x_ictl>;
179 interrupts = <27 2>; 179 interrupts = <27 2>;
180 reg = <0xFF140000 0x1000>; 180 reg = <0xff140000 0x1000>;
181 gpio-controller; 181 gpio-controller;
182 #gpio-cells = <2>; 182 #gpio-cells = <2>;
183 abilis,ngpio = <3>; 183 abilis,ngpio = <3>;
184 gpio-ranges = <&iomux 0 0 0>; 184 gpio-ranges = <&iomux 0 0 0>;
185 gpio-ranges-group-names = "gpioa"; 185 gpio-ranges-group-names = "gpioa";
186 }; 186 };
187 gpiob: gpio@FF141000 { 187 gpiob: gpio@ff141000 {
188 compatible = "abilis,tb10x-gpio"; 188 compatible = "abilis,tb10x-gpio";
189 interrupt-controller; 189 interrupt-controller;
190 #interrupt-cells = <1>; 190 #interrupt-cells = <1>;
191 interrupt-parent = <&tb10x_ictl>; 191 interrupt-parent = <&tb10x_ictl>;
192 interrupts = <27 2>; 192 interrupts = <27 2>;
193 reg = <0xFF141000 0x1000>; 193 reg = <0xff141000 0x1000>;
194 gpio-controller; 194 gpio-controller;
195 #gpio-cells = <2>; 195 #gpio-cells = <2>;
196 abilis,ngpio = <2>; 196 abilis,ngpio = <2>;
197 gpio-ranges = <&iomux 0 0 0>; 197 gpio-ranges = <&iomux 0 0 0>;
198 gpio-ranges-group-names = "gpiob"; 198 gpio-ranges-group-names = "gpiob";
199 }; 199 };
200 gpioc: gpio@FF142000 { 200 gpioc: gpio@ff142000 {
201 compatible = "abilis,tb10x-gpio"; 201 compatible = "abilis,tb10x-gpio";
202 interrupt-controller; 202 interrupt-controller;
203 #interrupt-cells = <1>; 203 #interrupt-cells = <1>;
204 interrupt-parent = <&tb10x_ictl>; 204 interrupt-parent = <&tb10x_ictl>;
205 interrupts = <27 2>; 205 interrupts = <27 2>;
206 reg = <0xFF142000 0x1000>; 206 reg = <0xff142000 0x1000>;
207 gpio-controller; 207 gpio-controller;
208 #gpio-cells = <2>; 208 #gpio-cells = <2>;
209 abilis,ngpio = <3>; 209 abilis,ngpio = <3>;
210 gpio-ranges = <&iomux 0 0 0>; 210 gpio-ranges = <&iomux 0 0 0>;
211 gpio-ranges-group-names = "gpioc"; 211 gpio-ranges-group-names = "gpioc";
212 }; 212 };
213 gpiod: gpio@FF143000 { 213 gpiod: gpio@ff143000 {
214 compatible = "abilis,tb10x-gpio"; 214 compatible = "abilis,tb10x-gpio";
215 interrupt-controller; 215 interrupt-controller;
216 #interrupt-cells = <1>; 216 #interrupt-cells = <1>;
217 interrupt-parent = <&tb10x_ictl>; 217 interrupt-parent = <&tb10x_ictl>;
218 interrupts = <27 2>; 218 interrupts = <27 2>;
219 reg = <0xFF143000 0x1000>; 219 reg = <0xff143000 0x1000>;
220 gpio-controller; 220 gpio-controller;
221 #gpio-cells = <2>; 221 #gpio-cells = <2>;
222 abilis,ngpio = <2>; 222 abilis,ngpio = <2>;
223 gpio-ranges = <&iomux 0 0 0>; 223 gpio-ranges = <&iomux 0 0 0>;
224 gpio-ranges-group-names = "gpiod"; 224 gpio-ranges-group-names = "gpiod";
225 }; 225 };
226 gpioe: gpio@FF144000 { 226 gpioe: gpio@ff144000 {
227 compatible = "abilis,tb10x-gpio"; 227 compatible = "abilis,tb10x-gpio";
228 interrupt-controller; 228 interrupt-controller;
229 #interrupt-cells = <1>; 229 #interrupt-cells = <1>;
230 interrupt-parent = <&tb10x_ictl>; 230 interrupt-parent = <&tb10x_ictl>;
231 interrupts = <27 2>; 231 interrupts = <27 2>;
232 reg = <0xFF144000 0x1000>; 232 reg = <0xff144000 0x1000>;
233 gpio-controller; 233 gpio-controller;
234 #gpio-cells = <2>; 234 #gpio-cells = <2>;
235 abilis,ngpio = <3>; 235 abilis,ngpio = <3>;
236 gpio-ranges = <&iomux 0 0 0>; 236 gpio-ranges = <&iomux 0 0 0>;
237 gpio-ranges-group-names = "gpioe"; 237 gpio-ranges-group-names = "gpioe";
238 }; 238 };
239 gpiof: gpio@FF145000 { 239 gpiof: gpio@ff145000 {
240 compatible = "abilis,tb10x-gpio"; 240 compatible = "abilis,tb10x-gpio";
241 interrupt-controller; 241 interrupt-controller;
242 #interrupt-cells = <1>; 242 #interrupt-cells = <1>;
243 interrupt-parent = <&tb10x_ictl>; 243 interrupt-parent = <&tb10x_ictl>;
244 interrupts = <27 2>; 244 interrupts = <27 2>;
245 reg = <0xFF145000 0x1000>; 245 reg = <0xff145000 0x1000>;
246 gpio-controller; 246 gpio-controller;
247 #gpio-cells = <2>; 247 #gpio-cells = <2>;
248 abilis,ngpio = <2>; 248 abilis,ngpio = <2>;
249 gpio-ranges = <&iomux 0 0 0>; 249 gpio-ranges = <&iomux 0 0 0>;
250 gpio-ranges-group-names = "gpiof"; 250 gpio-ranges-group-names = "gpiof";
251 }; 251 };
252 gpiog: gpio@FF146000 { 252 gpiog: gpio@ff146000 {
253 compatible = "abilis,tb10x-gpio"; 253 compatible = "abilis,tb10x-gpio";
254 interrupt-controller; 254 interrupt-controller;
255 #interrupt-cells = <1>; 255 #interrupt-cells = <1>;
256 interrupt-parent = <&tb10x_ictl>; 256 interrupt-parent = <&tb10x_ictl>;
257 interrupts = <27 2>; 257 interrupts = <27 2>;
258 reg = <0xFF146000 0x1000>; 258 reg = <0xff146000 0x1000>;
259 gpio-controller; 259 gpio-controller;
260 #gpio-cells = <2>; 260 #gpio-cells = <2>;
261 abilis,ngpio = <3>; 261 abilis,ngpio = <3>;
262 gpio-ranges = <&iomux 0 0 0>; 262 gpio-ranges = <&iomux 0 0 0>;
263 gpio-ranges-group-names = "gpiog"; 263 gpio-ranges-group-names = "gpiog";
264 }; 264 };
265 gpioh: gpio@FF147000 { 265 gpioh: gpio@ff147000 {
266 compatible = "abilis,tb10x-gpio"; 266 compatible = "abilis,tb10x-gpio";
267 interrupt-controller; 267 interrupt-controller;
268 #interrupt-cells = <1>; 268 #interrupt-cells = <1>;
269 interrupt-parent = <&tb10x_ictl>; 269 interrupt-parent = <&tb10x_ictl>;
270 interrupts = <27 2>; 270 interrupts = <27 2>;
271 reg = <0xFF147000 0x1000>; 271 reg = <0xff147000 0x1000>;
272 gpio-controller; 272 gpio-controller;
273 #gpio-cells = <2>; 273 #gpio-cells = <2>;
274 abilis,ngpio = <2>; 274 abilis,ngpio = <2>;
275 gpio-ranges = <&iomux 0 0 0>; 275 gpio-ranges = <&iomux 0 0 0>;
276 gpio-ranges-group-names = "gpioh"; 276 gpio-ranges-group-names = "gpioh";
277 }; 277 };
278 gpioi: gpio@FF148000 { 278 gpioi: gpio@ff148000 {
279 compatible = "abilis,tb10x-gpio"; 279 compatible = "abilis,tb10x-gpio";
280 interrupt-controller; 280 interrupt-controller;
281 #interrupt-cells = <1>; 281 #interrupt-cells = <1>;
282 interrupt-parent = <&tb10x_ictl>; 282 interrupt-parent = <&tb10x_ictl>;
283 interrupts = <27 2>; 283 interrupts = <27 2>;
284 reg = <0xFF148000 0x1000>; 284 reg = <0xff148000 0x1000>;
285 gpio-controller; 285 gpio-controller;
286 #gpio-cells = <2>; 286 #gpio-cells = <2>;
287 abilis,ngpio = <12>; 287 abilis,ngpio = <12>;
288 gpio-ranges = <&iomux 0 0 0>; 288 gpio-ranges = <&iomux 0 0 0>;
289 gpio-ranges-group-names = "gpioi"; 289 gpio-ranges-group-names = "gpioi";
290 }; 290 };
291 gpioj: gpio@FF149000 { 291 gpioj: gpio@ff149000 {
292 compatible = "abilis,tb10x-gpio"; 292 compatible = "abilis,tb10x-gpio";
293 interrupt-controller; 293 interrupt-controller;
294 #interrupt-cells = <1>; 294 #interrupt-cells = <1>;
295 interrupt-parent = <&tb10x_ictl>; 295 interrupt-parent = <&tb10x_ictl>;
296 interrupts = <27 2>; 296 interrupts = <27 2>;
297 reg = <0xFF149000 0x1000>; 297 reg = <0xff149000 0x1000>;
298 gpio-controller; 298 gpio-controller;
299 #gpio-cells = <2>; 299 #gpio-cells = <2>;
300 abilis,ngpio = <32>; 300 abilis,ngpio = <32>;
301 gpio-ranges = <&iomux 0 0 0>; 301 gpio-ranges = <&iomux 0 0 0>;
302 gpio-ranges-group-names = "gpioj"; 302 gpio-ranges-group-names = "gpioj";
303 }; 303 };
304 gpiok: gpio@FF14a000 { 304 gpiok: gpio@ff14a000 {
305 compatible = "abilis,tb10x-gpio"; 305 compatible = "abilis,tb10x-gpio";
306 interrupt-controller; 306 interrupt-controller;
307 #interrupt-cells = <1>; 307 #interrupt-cells = <1>;
308 interrupt-parent = <&tb10x_ictl>; 308 interrupt-parent = <&tb10x_ictl>;
309 interrupts = <27 2>; 309 interrupts = <27 2>;
310 reg = <0xFF14A000 0x1000>; 310 reg = <0xff14a000 0x1000>;
311 gpio-controller; 311 gpio-controller;
312 #gpio-cells = <2>; 312 #gpio-cells = <2>;
313 abilis,ngpio = <22>; 313 abilis,ngpio = <22>;
314 gpio-ranges = <&iomux 0 0 0>; 314 gpio-ranges = <&iomux 0 0 0>;
315 gpio-ranges-group-names = "gpiok"; 315 gpio-ranges-group-names = "gpiok";
316 }; 316 };
317 gpiol: gpio@FF14b000 { 317 gpiol: gpio@ff14b000 {
318 compatible = "abilis,tb10x-gpio"; 318 compatible = "abilis,tb10x-gpio";
319 interrupt-controller; 319 interrupt-controller;
320 #interrupt-cells = <1>; 320 #interrupt-cells = <1>;
321 interrupt-parent = <&tb10x_ictl>; 321 interrupt-parent = <&tb10x_ictl>;
322 interrupts = <27 2>; 322 interrupts = <27 2>;
323 reg = <0xFF14B000 0x1000>; 323 reg = <0xff14b000 0x1000>;
324 gpio-controller; 324 gpio-controller;
325 #gpio-cells = <2>; 325 #gpio-cells = <2>;
326 abilis,ngpio = <4>; 326 abilis,ngpio = <4>;
327 gpio-ranges = <&iomux 0 0 0>; 327 gpio-ranges = <&iomux 0 0 0>;
328 gpio-ranges-group-names = "gpiol"; 328 gpio-ranges-group-names = "gpiol";
329 }; 329 };
330 gpiom: gpio@FF14c000 { 330 gpiom: gpio@ff14c000 {
331 compatible = "abilis,tb10x-gpio"; 331 compatible = "abilis,tb10x-gpio";
332 interrupt-controller; 332 interrupt-controller;
333 #interrupt-cells = <1>; 333 #interrupt-cells = <1>;
334 interrupt-parent = <&tb10x_ictl>; 334 interrupt-parent = <&tb10x_ictl>;
335 interrupts = <27 2>; 335 interrupts = <27 2>;
336 reg = <0xFF14C000 0x1000>; 336 reg = <0xff14c000 0x1000>;
337 gpio-controller; 337 gpio-controller;
338 #gpio-cells = <2>; 338 #gpio-cells = <2>;
339 abilis,ngpio = <4>; 339 abilis,ngpio = <4>;
340 gpio-ranges = <&iomux 0 0 0>; 340 gpio-ranges = <&iomux 0 0 0>;
341 gpio-ranges-group-names = "gpiom"; 341 gpio-ranges-group-names = "gpiom";
342 }; 342 };
343 gpion: gpio@FF14d000 { 343 gpion: gpio@ff14d000 {
344 compatible = "abilis,tb10x-gpio"; 344 compatible = "abilis,tb10x-gpio";
345 interrupt-controller; 345 interrupt-controller;
346 #interrupt-cells = <1>; 346 #interrupt-cells = <1>;
347 interrupt-parent = <&tb10x_ictl>; 347 interrupt-parent = <&tb10x_ictl>;
348 interrupts = <27 2>; 348 interrupts = <27 2>;
349 reg = <0xFF14D000 0x1000>; 349 reg = <0xff14d000 0x1000>;
350 gpio-controller; 350 gpio-controller;
351 #gpio-cells = <2>; 351 #gpio-cells = <2>;
352 abilis,ngpio = <5>; 352 abilis,ngpio = <5>;
diff --git a/arch/arc/boot/dts/abilis_tb101_dvk.dts b/arch/arc/boot/dts/abilis_tb101_dvk.dts
index 37d88c5dd181..05143ce9c120 100644
--- a/arch/arc/boot/dts/abilis_tb101_dvk.dts
+++ b/arch/arc/boot/dts/abilis_tb101_dvk.dts
@@ -37,27 +37,27 @@
37 }; 37 };
38 38
39 soc100 { 39 soc100 {
40 uart@FF100000 { 40 uart@ff100000 {
41 pinctrl-names = "default"; 41 pinctrl-names = "default";
42 pinctrl-0 = <&pctl_uart0>; 42 pinctrl-0 = <&pctl_uart0>;
43 }; 43 };
44 ethernet@FE100000 { 44 ethernet@fe100000 {
45 phy-mode = "rgmii"; 45 phy-mode = "rgmii";
46 }; 46 };
47 47
48 i2c0: i2c@FF120000 { 48 i2c0: i2c@ff120000 {
49 i2c-sda-hold-time-ns = <432>; 49 i2c-sda-hold-time-ns = <432>;
50 }; 50 };
51 i2c1: i2c@FF121000 { 51 i2c1: i2c@ff121000 {
52 i2c-sda-hold-time-ns = <432>; 52 i2c-sda-hold-time-ns = <432>;
53 }; 53 };
54 i2c2: i2c@FF122000 { 54 i2c2: i2c@ff122000 {
55 i2c-sda-hold-time-ns = <432>; 55 i2c-sda-hold-time-ns = <432>;
56 }; 56 };
57 i2c3: i2c@FF123000 { 57 i2c3: i2c@ff123000 {
58 i2c-sda-hold-time-ns = <432>; 58 i2c-sda-hold-time-ns = <432>;
59 }; 59 };
60 i2c4: i2c@FF124000 { 60 i2c4: i2c@ff124000 {
61 i2c-sda-hold-time-ns = <432>; 61 i2c-sda-hold-time-ns = <432>;
62 }; 62 };
63 63
diff --git a/arch/arc/boot/dts/abilis_tb10x.dtsi b/arch/arc/boot/dts/abilis_tb10x.dtsi
index 3121536b25a3..2fbf1bdfe6de 100644
--- a/arch/arc/boot/dts/abilis_tb10x.dtsi
+++ b/arch/arc/boot/dts/abilis_tb10x.dtsi
@@ -54,7 +54,7 @@
54 #size-cells = <1>; 54 #size-cells = <1>;
55 device_type = "soc"; 55 device_type = "soc";
56 ranges = <0xfe000000 0xfe000000 0x02000000 56 ranges = <0xfe000000 0xfe000000 0x02000000
57 0x000F0000 0x000F0000 0x00010000>; 57 0x000f0000 0x000f0000 0x00010000>;
58 compatible = "abilis,tb10x", "simple-bus"; 58 compatible = "abilis,tb10x", "simple-bus";
59 59
60 pll0: oscillator { 60 pll0: oscillator {
@@ -75,10 +75,10 @@
75 clock-output-names = "ahb_clk"; 75 clock-output-names = "ahb_clk";
76 }; 76 };
77 77
78 iomux: iomux@FF10601c { 78 iomux: iomux@ff10601c {
79 compatible = "abilis,tb10x-iomux"; 79 compatible = "abilis,tb10x-iomux";
80 #gpio-range-cells = <3>; 80 #gpio-range-cells = <3>;
81 reg = <0xFF10601c 0x4>; 81 reg = <0xff10601c 0x4>;
82 }; 82 };
83 83
84 intc: interrupt-controller { 84 intc: interrupt-controller {
@@ -88,7 +88,7 @@
88 }; 88 };
89 tb10x_ictl: pic@fe002000 { 89 tb10x_ictl: pic@fe002000 {
90 compatible = "abilis,tb10x-ictl"; 90 compatible = "abilis,tb10x-ictl";
91 reg = <0xFE002000 0x20>; 91 reg = <0xfe002000 0x20>;
92 interrupt-controller; 92 interrupt-controller;
93 #interrupt-cells = <2>; 93 #interrupt-cells = <2>;
94 interrupt-parent = <&intc>; 94 interrupt-parent = <&intc>;
@@ -96,27 +96,27 @@
96 20 21 22 23 24 25 26 27 28 29 30 31>; 96 20 21 22 23 24 25 26 27 28 29 30 31>;
97 }; 97 };
98 98
99 uart@FF100000 { 99 uart@ff100000 {
100 compatible = "snps,dw-apb-uart"; 100 compatible = "snps,dw-apb-uart";
101 reg = <0xFF100000 0x100>; 101 reg = <0xff100000 0x100>;
102 clock-frequency = <166666666>; 102 clock-frequency = <166666666>;
103 interrupts = <25 8>; 103 interrupts = <25 8>;
104 reg-shift = <2>; 104 reg-shift = <2>;
105 reg-io-width = <4>; 105 reg-io-width = <4>;
106 interrupt-parent = <&tb10x_ictl>; 106 interrupt-parent = <&tb10x_ictl>;
107 }; 107 };
108 ethernet@FE100000 { 108 ethernet@fe100000 {
109 compatible = "snps,dwmac-3.70a","snps,dwmac"; 109 compatible = "snps,dwmac-3.70a","snps,dwmac";
110 reg = <0xFE100000 0x1058>; 110 reg = <0xfe100000 0x1058>;
111 interrupt-parent = <&tb10x_ictl>; 111 interrupt-parent = <&tb10x_ictl>;
112 interrupts = <6 8>; 112 interrupts = <6 8>;
113 interrupt-names = "macirq"; 113 interrupt-names = "macirq";
114 clocks = <&ahb_clk>; 114 clocks = <&ahb_clk>;
115 clock-names = "stmmaceth"; 115 clock-names = "stmmaceth";
116 }; 116 };
117 dma@FE000000 { 117 dma@fe000000 {
118 compatible = "snps,dma-spear1340"; 118 compatible = "snps,dma-spear1340";
119 reg = <0xFE000000 0x400>; 119 reg = <0xfe000000 0x400>;
120 interrupt-parent = <&tb10x_ictl>; 120 interrupt-parent = <&tb10x_ictl>;
121 interrupts = <14 8>; 121 interrupts = <14 8>;
122 dma-channels = <6>; 122 dma-channels = <6>;
@@ -132,70 +132,70 @@
132 multi-block = <1 1 1 1 1 1>; 132 multi-block = <1 1 1 1 1 1>;
133 }; 133 };
134 134
135 i2c0: i2c@FF120000 { 135 i2c0: i2c@ff120000 {
136 #address-cells = <1>; 136 #address-cells = <1>;
137 #size-cells = <0>; 137 #size-cells = <0>;
138 compatible = "snps,designware-i2c"; 138 compatible = "snps,designware-i2c";
139 reg = <0xFF120000 0x1000>; 139 reg = <0xff120000 0x1000>;
140 interrupt-parent = <&tb10x_ictl>; 140 interrupt-parent = <&tb10x_ictl>;
141 interrupts = <12 8>; 141 interrupts = <12 8>;
142 clocks = <&ahb_clk>; 142 clocks = <&ahb_clk>;
143 }; 143 };
144 i2c1: i2c@FF121000 { 144 i2c1: i2c@ff121000 {
145 #address-cells = <1>; 145 #address-cells = <1>;
146 #size-cells = <0>; 146 #size-cells = <0>;
147 compatible = "snps,designware-i2c"; 147 compatible = "snps,designware-i2c";
148 reg = <0xFF121000 0x1000>; 148 reg = <0xff121000 0x1000>;
149 interrupt-parent = <&tb10x_ictl>; 149 interrupt-parent = <&tb10x_ictl>;
150 interrupts = <12 8>; 150 interrupts = <12 8>;
151 clocks = <&ahb_clk>; 151 clocks = <&ahb_clk>;
152 }; 152 };
153 i2c2: i2c@FF122000 { 153 i2c2: i2c@ff122000 {
154 #address-cells = <1>; 154 #address-cells = <1>;
155 #size-cells = <0>; 155 #size-cells = <0>;
156 compatible = "snps,designware-i2c"; 156 compatible = "snps,designware-i2c";
157 reg = <0xFF122000 0x1000>; 157 reg = <0xff122000 0x1000>;
158 interrupt-parent = <&tb10x_ictl>; 158 interrupt-parent = <&tb10x_ictl>;
159 interrupts = <12 8>; 159 interrupts = <12 8>;
160 clocks = <&ahb_clk>; 160 clocks = <&ahb_clk>;
161 }; 161 };
162 i2c3: i2c@FF123000 { 162 i2c3: i2c@ff123000 {
163 #address-cells = <1>; 163 #address-cells = <1>;
164 #size-cells = <0>; 164 #size-cells = <0>;
165 compatible = "snps,designware-i2c"; 165 compatible = "snps,designware-i2c";
166 reg = <0xFF123000 0x1000>; 166 reg = <0xff123000 0x1000>;
167 interrupt-parent = <&tb10x_ictl>; 167 interrupt-parent = <&tb10x_ictl>;
168 interrupts = <12 8>; 168 interrupts = <12 8>;
169 clocks = <&ahb_clk>; 169 clocks = <&ahb_clk>;
170 }; 170 };
171 i2c4: i2c@FF124000 { 171 i2c4: i2c@ff124000 {
172 #address-cells = <1>; 172 #address-cells = <1>;
173 #size-cells = <0>; 173 #size-cells = <0>;
174 compatible = "snps,designware-i2c"; 174 compatible = "snps,designware-i2c";
175 reg = <0xFF124000 0x1000>; 175 reg = <0xff124000 0x1000>;
176 interrupt-parent = <&tb10x_ictl>; 176 interrupt-parent = <&tb10x_ictl>;
177 interrupts = <12 8>; 177 interrupts = <12 8>;
178 clocks = <&ahb_clk>; 178 clocks = <&ahb_clk>;
179 }; 179 };
180 180
181 spi0: spi@0xFE010000 { 181 spi0: spi@fe010000 {
182 #address-cells = <1>; 182 #address-cells = <1>;
183 #size-cells = <0>; 183 #size-cells = <0>;
184 cell-index = <0>; 184 cell-index = <0>;
185 compatible = "abilis,tb100-spi"; 185 compatible = "abilis,tb100-spi";
186 num-cs = <1>; 186 num-cs = <1>;
187 reg = <0xFE010000 0x20>; 187 reg = <0xfe010000 0x20>;
188 interrupt-parent = <&tb10x_ictl>; 188 interrupt-parent = <&tb10x_ictl>;
189 interrupts = <26 8>; 189 interrupts = <26 8>;
190 clocks = <&ahb_clk>; 190 clocks = <&ahb_clk>;
191 }; 191 };
192 spi1: spi@0xFE011000 { 192 spi1: spi@fe011000 {
193 #address-cells = <1>; 193 #address-cells = <1>;
194 #size-cells = <0>; 194 #size-cells = <0>;
195 cell-index = <1>; 195 cell-index = <1>;
196 compatible = "abilis,tb100-spi"; 196 compatible = "abilis,tb100-spi";
197 num-cs = <2>; 197 num-cs = <2>;
198 reg = <0xFE011000 0x20>; 198 reg = <0xfe011000 0x20>;
199 interrupt-parent = <&tb10x_ictl>; 199 interrupt-parent = <&tb10x_ictl>;
200 interrupts = <10 8>; 200 interrupts = <10 8>;
201 clocks = <&ahb_clk>; 201 clocks = <&ahb_clk>;
@@ -226,23 +226,23 @@
226 interrupts = <20 2>, <19 2>; 226 interrupts = <20 2>, <19 2>;
227 interrupt-names = "cmd_irq", "event_irq"; 227 interrupt-names = "cmd_irq", "event_irq";
228 }; 228 };
229 tb10x_mdsc0: tb10x-mdscr@FF300000 { 229 tb10x_mdsc0: tb10x-mdscr@ff300000 {
230 compatible = "abilis,tb100-mdscr"; 230 compatible = "abilis,tb100-mdscr";
231 reg = <0xFF300000 0x7000>; 231 reg = <0xff300000 0x7000>;
232 tb100-mdscr-manage-tsin; 232 tb100-mdscr-manage-tsin;
233 }; 233 };
234 tb10x_mscr0: tb10x-mdscr@FF307000 { 234 tb10x_mscr0: tb10x-mdscr@ff307000 {
235 compatible = "abilis,tb100-mdscr"; 235 compatible = "abilis,tb100-mdscr";
236 reg = <0xFF307000 0x7000>; 236 reg = <0xff307000 0x7000>;
237 }; 237 };
238 tb10x_scr0: tb10x-mdscr@ff30e000 { 238 tb10x_scr0: tb10x-mdscr@ff30e000 {
239 compatible = "abilis,tb100-mdscr"; 239 compatible = "abilis,tb100-mdscr";
240 reg = <0xFF30e000 0x4000>; 240 reg = <0xff30e000 0x4000>;
241 tb100-mdscr-manage-tsin; 241 tb100-mdscr-manage-tsin;
242 }; 242 };
243 tb10x_scr1: tb10x-mdscr@ff312000 { 243 tb10x_scr1: tb10x-mdscr@ff312000 {
244 compatible = "abilis,tb100-mdscr"; 244 compatible = "abilis,tb100-mdscr";
245 reg = <0xFF312000 0x4000>; 245 reg = <0xff312000 0x4000>;
246 tb100-mdscr-manage-tsin; 246 tb100-mdscr-manage-tsin;
247 }; 247 };
248 tb10x_wfb: tb10x-wfb@ff319000 { 248 tb10x_wfb: tb10x-wfb@ff319000 {
diff --git a/arch/arc/boot/dts/axc001.dtsi b/arch/arc/boot/dts/axc001.dtsi
index fdc266504ada..37be3bf03ad6 100644
--- a/arch/arc/boot/dts/axc001.dtsi
+++ b/arch/arc/boot/dts/axc001.dtsi
@@ -41,7 +41,7 @@
41 * this GPIO block ORs all interrupts on CPU card (creg,..) 41 * this GPIO block ORs all interrupts on CPU card (creg,..)
42 * to uplink only 1 IRQ to ARC core intc 42 * to uplink only 1 IRQ to ARC core intc
43 */ 43 */
44 dw-apb-gpio@0x2000 { 44 dw-apb-gpio@2000 {
45 compatible = "snps,dw-apb-gpio"; 45 compatible = "snps,dw-apb-gpio";
46 reg = < 0x2000 0x80 >; 46 reg = < 0x2000 0x80 >;
47 #address-cells = <1>; 47 #address-cells = <1>;
@@ -60,7 +60,7 @@
60 }; 60 };
61 }; 61 };
62 62
63 debug_uart: dw-apb-uart@0x5000 { 63 debug_uart: dw-apb-uart@5000 {
64 compatible = "snps,dw-apb-uart"; 64 compatible = "snps,dw-apb-uart";
65 reg = <0x5000 0x100>; 65 reg = <0x5000 0x100>;
66 clock-frequency = <33333000>; 66 clock-frequency = <33333000>;
@@ -88,7 +88,7 @@
88 * avoid duplicating the MB dtsi file given that IRQ from 88 * avoid duplicating the MB dtsi file given that IRQ from
89 * this intc to cpu intc are different for axs101 and axs103 89 * this intc to cpu intc are different for axs101 and axs103
90 */ 90 */
91 mb_intc: dw-apb-ictl@0xe0012000 { 91 mb_intc: dw-apb-ictl@e0012000 {
92 #interrupt-cells = <1>; 92 #interrupt-cells = <1>;
93 compatible = "snps,dw-apb-ictl"; 93 compatible = "snps,dw-apb-ictl";
94 reg = < 0x0 0xe0012000 0x0 0x200 >; 94 reg = < 0x0 0xe0012000 0x0 0x200 >;
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi
index d75d65ddf8e3..effa37536d7a 100644
--- a/arch/arc/boot/dts/axc003.dtsi
+++ b/arch/arc/boot/dts/axc003.dtsi
@@ -55,7 +55,7 @@
55 * this GPIO block ORs all interrupts on CPU card (creg,..) 55 * this GPIO block ORs all interrupts on CPU card (creg,..)
56 * to uplink only 1 IRQ to ARC core intc 56 * to uplink only 1 IRQ to ARC core intc
57 */ 57 */
58 dw-apb-gpio@0x2000 { 58 dw-apb-gpio@2000 {
59 compatible = "snps,dw-apb-gpio"; 59 compatible = "snps,dw-apb-gpio";
60 reg = < 0x2000 0x80 >; 60 reg = < 0x2000 0x80 >;
61 #address-cells = <1>; 61 #address-cells = <1>;
@@ -74,7 +74,7 @@
74 }; 74 };
75 }; 75 };
76 76
77 debug_uart: dw-apb-uart@0x5000 { 77 debug_uart: dw-apb-uart@5000 {
78 compatible = "snps,dw-apb-uart"; 78 compatible = "snps,dw-apb-uart";
79 reg = <0x5000 0x100>; 79 reg = <0x5000 0x100>;
80 clock-frequency = <33333000>; 80 clock-frequency = <33333000>;
@@ -102,19 +102,19 @@
102 * external DMA buffer located outside of IOC aperture. 102 * external DMA buffer located outside of IOC aperture.
103 */ 103 */
104 axs10x_mb { 104 axs10x_mb {
105 ethernet@0x18000 { 105 ethernet@18000 {
106 dma-coherent; 106 dma-coherent;
107 }; 107 };
108 108
109 ehci@0x40000 { 109 ehci@40000 {
110 dma-coherent; 110 dma-coherent;
111 }; 111 };
112 112
113 ohci@0x60000 { 113 ohci@60000 {
114 dma-coherent; 114 dma-coherent;
115 }; 115 };
116 116
117 mmc@0x15000 { 117 mmc@15000 {
118 dma-coherent; 118 dma-coherent;
119 }; 119 };
120 }; 120 };
@@ -132,7 +132,7 @@
132 * avoid duplicating the MB dtsi file given that IRQ from 132 * avoid duplicating the MB dtsi file given that IRQ from
133 * this intc to cpu intc are different for axs101 and axs103 133 * this intc to cpu intc are different for axs101 and axs103
134 */ 134 */
135 mb_intc: dw-apb-ictl@0xe0012000 { 135 mb_intc: dw-apb-ictl@e0012000 {
136 #interrupt-cells = <1>; 136 #interrupt-cells = <1>;
137 compatible = "snps,dw-apb-ictl"; 137 compatible = "snps,dw-apb-ictl";
138 reg = < 0x0 0xe0012000 0x0 0x200 >; 138 reg = < 0x0 0xe0012000 0x0 0x200 >;
@@ -153,7 +153,7 @@
153 #size-cells = <2>; 153 #size-cells = <2>;
154 ranges; 154 ranges;
155 /* 155 /*
156 * Move frame buffer out of IOC aperture (0x8z-0xAz). 156 * Move frame buffer out of IOC aperture (0x8z-0xaz).
157 */ 157 */
158 frame_buffer: frame_buffer@be000000 { 158 frame_buffer: frame_buffer@be000000 {
159 compatible = "shared-dma-pool"; 159 compatible = "shared-dma-pool";
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi b/arch/arc/boot/dts/axc003_idu.dtsi
index a05bb737ea63..e401e59f6180 100644
--- a/arch/arc/boot/dts/axc003_idu.dtsi
+++ b/arch/arc/boot/dts/axc003_idu.dtsi
@@ -62,7 +62,7 @@
62 * this GPIO block ORs all interrupts on CPU card (creg,..) 62 * this GPIO block ORs all interrupts on CPU card (creg,..)
63 * to uplink only 1 IRQ to ARC core intc 63 * to uplink only 1 IRQ to ARC core intc
64 */ 64 */
65 dw-apb-gpio@0x2000 { 65 dw-apb-gpio@2000 {
66 compatible = "snps,dw-apb-gpio"; 66 compatible = "snps,dw-apb-gpio";
67 reg = < 0x2000 0x80 >; 67 reg = < 0x2000 0x80 >;
68 #address-cells = <1>; 68 #address-cells = <1>;
@@ -81,7 +81,7 @@
81 }; 81 };
82 }; 82 };
83 83
84 debug_uart: dw-apb-uart@0x5000 { 84 debug_uart: dw-apb-uart@5000 {
85 compatible = "snps,dw-apb-uart"; 85 compatible = "snps,dw-apb-uart";
86 reg = <0x5000 0x100>; 86 reg = <0x5000 0x100>;
87 clock-frequency = <33333000>; 87 clock-frequency = <33333000>;
@@ -109,19 +109,19 @@
109 * external DMA buffer located outside of IOC aperture. 109 * external DMA buffer located outside of IOC aperture.
110 */ 110 */
111 axs10x_mb { 111 axs10x_mb {
112 ethernet@0x18000 { 112 ethernet@18000 {
113 dma-coherent; 113 dma-coherent;
114 }; 114 };
115 115
116 ehci@0x40000 { 116 ehci@40000 {
117 dma-coherent; 117 dma-coherent;
118 }; 118 };
119 119
120 ohci@0x60000 { 120 ohci@60000 {
121 dma-coherent; 121 dma-coherent;
122 }; 122 };
123 123
124 mmc@0x15000 { 124 mmc@15000 {
125 dma-coherent; 125 dma-coherent;
126 }; 126 };
127 }; 127 };
@@ -138,7 +138,7 @@
138 * avoid duplicating the MB dtsi file given that IRQ from 138 * avoid duplicating the MB dtsi file given that IRQ from
139 * this intc to cpu intc are different for axs101 and axs103 139 * this intc to cpu intc are different for axs101 and axs103
140 */ 140 */
141 mb_intc: dw-apb-ictl@0xe0012000 { 141 mb_intc: dw-apb-ictl@e0012000 {
142 #interrupt-cells = <1>; 142 #interrupt-cells = <1>;
143 compatible = "snps,dw-apb-ictl"; 143 compatible = "snps,dw-apb-ictl";
144 reg = < 0x0 0xe0012000 0x0 0x200 >; 144 reg = < 0x0 0xe0012000 0x0 0x200 >;
@@ -159,7 +159,7 @@
159 #size-cells = <2>; 159 #size-cells = <2>;
160 ranges; 160 ranges;
161 /* 161 /*
162 * Move frame buffer out of IOC aperture (0x8z-0xAz). 162 * Move frame buffer out of IOC aperture (0x8z-0xaz).
163 */ 163 */
164 frame_buffer: frame_buffer@be000000 { 164 frame_buffer: frame_buffer@be000000 {
165 compatible = "shared-dma-pool"; 165 compatible = "shared-dma-pool";
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 37bafd44e36d..4ead6dc9af2f 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -72,7 +72,7 @@
72 }; 72 };
73 }; 73 };
74 74
75 gmac: ethernet@0x18000 { 75 gmac: ethernet@18000 {
76 #interrupt-cells = <1>; 76 #interrupt-cells = <1>;
77 compatible = "snps,dwmac"; 77 compatible = "snps,dwmac";
78 reg = < 0x18000 0x2000 >; 78 reg = < 0x18000 0x2000 >;
@@ -88,13 +88,13 @@
88 mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */ 88 mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
89 }; 89 };
90 90
91 ehci@0x40000 { 91 ehci@40000 {
92 compatible = "generic-ehci"; 92 compatible = "generic-ehci";
93 reg = < 0x40000 0x100 >; 93 reg = < 0x40000 0x100 >;
94 interrupts = < 8 >; 94 interrupts = < 8 >;
95 }; 95 };
96 96
97 ohci@0x60000 { 97 ohci@60000 {
98 compatible = "generic-ohci"; 98 compatible = "generic-ohci";
99 reg = < 0x60000 0x100 >; 99 reg = < 0x60000 0x100 >;
100 interrupts = < 8 >; 100 interrupts = < 8 >;
@@ -118,7 +118,7 @@
118 * dw_mci_pltfm_prepare_command() is used in generic platform 118 * dw_mci_pltfm_prepare_command() is used in generic platform
119 * code. 119 * code.
120 */ 120 */
121 mmc@0x15000 { 121 mmc@15000 {
122 compatible = "altr,socfpga-dw-mshc"; 122 compatible = "altr,socfpga-dw-mshc";
123 reg = < 0x15000 0x400 >; 123 reg = < 0x15000 0x400 >;
124 fifo-depth = < 16 >; 124 fifo-depth = < 16 >;
@@ -129,7 +129,7 @@
129 bus-width = < 4 >; 129 bus-width = < 4 >;
130 }; 130 };
131 131
132 uart@0x20000 { 132 uart@20000 {
133 compatible = "snps,dw-apb-uart"; 133 compatible = "snps,dw-apb-uart";
134 reg = <0x20000 0x100>; 134 reg = <0x20000 0x100>;
135 clock-frequency = <33333333>; 135 clock-frequency = <33333333>;
@@ -139,7 +139,7 @@
139 reg-io-width = <4>; 139 reg-io-width = <4>;
140 }; 140 };
141 141
142 uart@0x21000 { 142 uart@21000 {
143 compatible = "snps,dw-apb-uart"; 143 compatible = "snps,dw-apb-uart";
144 reg = <0x21000 0x100>; 144 reg = <0x21000 0x100>;
145 clock-frequency = <33333333>; 145 clock-frequency = <33333333>;
@@ -150,7 +150,7 @@
150 }; 150 };
151 151
152 /* UART muxed with USB data port (ttyS3) */ 152 /* UART muxed with USB data port (ttyS3) */
153 uart@0x22000 { 153 uart@22000 {
154 compatible = "snps,dw-apb-uart"; 154 compatible = "snps,dw-apb-uart";
155 reg = <0x22000 0x100>; 155 reg = <0x22000 0x100>;
156 clock-frequency = <33333333>; 156 clock-frequency = <33333333>;
@@ -160,7 +160,7 @@
160 reg-io-width = <4>; 160 reg-io-width = <4>;
161 }; 161 };
162 162
163 i2c@0x1d000 { 163 i2c@1d000 {
164 compatible = "snps,designware-i2c"; 164 compatible = "snps,designware-i2c";
165 reg = <0x1d000 0x100>; 165 reg = <0x1d000 0x100>;
166 clock-frequency = <400000>; 166 clock-frequency = <400000>;
@@ -177,7 +177,7 @@
177 #sound-dai-cells = <0>; 177 #sound-dai-cells = <0>;
178 }; 178 };
179 179
180 i2c@0x1f000 { 180 i2c@1f000 {
181 compatible = "snps,designware-i2c"; 181 compatible = "snps,designware-i2c";
182 #address-cells = <1>; 182 #address-cells = <1>;
183 #size-cells = <0>; 183 #size-cells = <0>;
@@ -218,13 +218,13 @@
218 }; 218 };
219 }; 219 };
220 220
221 eeprom@0x54{ 221 eeprom@54{
222 compatible = "atmel,24c01"; 222 compatible = "atmel,24c01";
223 reg = <0x54>; 223 reg = <0x54>;
224 pagesize = <0x8>; 224 pagesize = <0x8>;
225 }; 225 };
226 226
227 eeprom@0x57{ 227 eeprom@57{
228 compatible = "atmel,24c04"; 228 compatible = "atmel,24c04";
229 reg = <0x57>; 229 reg = <0x57>;
230 pagesize = <0x8>; 230 pagesize = <0x8>;
diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts
index 43f17b51ee89..69bc1c9e8e50 100644
--- a/arch/arc/boot/dts/hsdk.dts
+++ b/arch/arc/boot/dts/hsdk.dts
@@ -110,12 +110,12 @@
110 cgu_rst: reset-controller@8a0 { 110 cgu_rst: reset-controller@8a0 {
111 compatible = "snps,hsdk-reset"; 111 compatible = "snps,hsdk-reset";
112 #reset-cells = <1>; 112 #reset-cells = <1>;
113 reg = <0x8A0 0x4>, <0xFF0 0x4>; 113 reg = <0x8a0 0x4>, <0xff0 0x4>;
114 }; 114 };
115 115
116 core_clk: core-clk@0 { 116 core_clk: core-clk@0 {
117 compatible = "snps,hsdk-core-pll-clock"; 117 compatible = "snps,hsdk-core-pll-clock";
118 reg = <0x00 0x10>, <0x14B8 0x4>; 118 reg = <0x00 0x10>, <0x14b8 0x4>;
119 #clock-cells = <0>; 119 #clock-cells = <0>;
120 clocks = <&input_clk>; 120 clocks = <&input_clk>;
121 121
@@ -167,6 +167,18 @@
167 #clock-cells = <0>; 167 #clock-cells = <0>;
168 }; 168 };
169 169
170 dmac_core_clk: dmac-core-clk {
171 compatible = "fixed-clock";
172 clock-frequency = <400000000>;
173 #clock-cells = <0>;
174 };
175
176 dmac_cfg_clk: dmac-gpu-cfg-clk {
177 compatible = "fixed-clock";
178 clock-frequency = <200000000>;
179 #clock-cells = <0>;
180 };
181
170 gmac: ethernet@8000 { 182 gmac: ethernet@8000 {
171 #interrupt-cells = <1>; 183 #interrupt-cells = <1>;
172 compatible = "snps,dwmac"; 184 compatible = "snps,dwmac";
@@ -200,6 +212,7 @@
200 compatible = "snps,hsdk-v1.0-ohci", "generic-ohci"; 212 compatible = "snps,hsdk-v1.0-ohci", "generic-ohci";
201 reg = <0x60000 0x100>; 213 reg = <0x60000 0x100>;
202 interrupts = <15>; 214 interrupts = <15>;
215 resets = <&cgu_rst HSDK_USB_RESET>;
203 dma-coherent; 216 dma-coherent;
204 }; 217 };
205 218
@@ -207,6 +220,7 @@
207 compatible = "snps,hsdk-v1.0-ehci", "generic-ehci"; 220 compatible = "snps,hsdk-v1.0-ehci", "generic-ehci";
208 reg = <0x40000 0x100>; 221 reg = <0x40000 0x100>;
209 interrupts = <15>; 222 interrupts = <15>;
223 resets = <&cgu_rst HSDK_USB_RESET>;
210 dma-coherent; 224 dma-coherent;
211 }; 225 };
212 226
@@ -237,6 +251,21 @@
237 reg = <0>; 251 reg = <0>;
238 }; 252 };
239 }; 253 };
254
255 dmac: dmac@80000 {
256 compatible = "snps,axi-dma-1.01a";
257 reg = <0x80000 0x400>;
258 interrupts = <27>;
259 clocks = <&dmac_core_clk>, <&dmac_cfg_clk>;
260 clock-names = "core-clk", "cfgr-clk";
261
262 dma-channels = <4>;
263 snps,dma-masters = <2>;
264 snps,data-width = <3>;
265 snps,block-size = <4096 4096 4096 4096>;
266 snps,priority = <0 1 2 3>;
267 snps,axi-max-burst-len = <16>;
268 };
240 }; 269 };
241 270
242 memory@80000000 { 271 memory@80000000 {
diff --git a/arch/arc/boot/dts/vdk_axc003.dtsi b/arch/arc/boot/dts/vdk_axc003.dtsi
index 0fd6ba985b16..84e8766c8ca2 100644
--- a/arch/arc/boot/dts/vdk_axc003.dtsi
+++ b/arch/arc/boot/dts/vdk_axc003.dtsi
@@ -36,7 +36,7 @@
36 #interrupt-cells = <1>; 36 #interrupt-cells = <1>;
37 }; 37 };
38 38
39 debug_uart: dw-apb-uart@0x5000 { 39 debug_uart: dw-apb-uart@5000 {
40 compatible = "snps,dw-apb-uart"; 40 compatible = "snps,dw-apb-uart";
41 reg = <0x5000 0x100>; 41 reg = <0x5000 0x100>;
42 clock-frequency = <2403200>; 42 clock-frequency = <2403200>;
@@ -49,7 +49,7 @@
49 49
50 }; 50 };
51 51
52 mb_intc: dw-apb-ictl@0xe0012000 { 52 mb_intc: dw-apb-ictl@e0012000 {
53 #interrupt-cells = <1>; 53 #interrupt-cells = <1>;
54 compatible = "snps,dw-apb-ictl"; 54 compatible = "snps,dw-apb-ictl";
55 reg = < 0xe0012000 0x200 >; 55 reg = < 0xe0012000 0x200 >;
diff --git a/arch/arc/boot/dts/vdk_axc003_idu.dtsi b/arch/arc/boot/dts/vdk_axc003_idu.dtsi
index 28956f9a9f3d..eb7e705e8a27 100644
--- a/arch/arc/boot/dts/vdk_axc003_idu.dtsi
+++ b/arch/arc/boot/dts/vdk_axc003_idu.dtsi
@@ -44,7 +44,7 @@
44 #interrupt-cells = <1>; 44 #interrupt-cells = <1>;
45 }; 45 };
46 46
47 debug_uart: dw-apb-uart@0x5000 { 47 debug_uart: dw-apb-uart@5000 {
48 compatible = "snps,dw-apb-uart"; 48 compatible = "snps,dw-apb-uart";
49 reg = <0x5000 0x100>; 49 reg = <0x5000 0x100>;
50 clock-frequency = <2403200>; 50 clock-frequency = <2403200>;
@@ -57,7 +57,7 @@
57 57
58 }; 58 };
59 59
60 mb_intc: dw-apb-ictl@0xe0012000 { 60 mb_intc: dw-apb-ictl@e0012000 {
61 #interrupt-cells = <1>; 61 #interrupt-cells = <1>;
62 compatible = "snps,dw-apb-ictl"; 62 compatible = "snps,dw-apb-ictl";
63 reg = < 0xe0012000 0x200 >; 63 reg = < 0xe0012000 0x200 >;
diff --git a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
index 48bb4b4cd234..925d5cc95dbb 100644
--- a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
@@ -36,7 +36,7 @@
36 }; 36 };
37 }; 37 };
38 38
39 ethernet@0x18000 { 39 ethernet@18000 {
40 #interrupt-cells = <1>; 40 #interrupt-cells = <1>;
41 compatible = "snps,dwmac"; 41 compatible = "snps,dwmac";
42 reg = < 0x18000 0x2000 >; 42 reg = < 0x18000 0x2000 >;
@@ -49,13 +49,13 @@
49 clock-names = "stmmaceth"; 49 clock-names = "stmmaceth";
50 }; 50 };
51 51
52 ehci@0x40000 { 52 ehci@40000 {
53 compatible = "generic-ehci"; 53 compatible = "generic-ehci";
54 reg = < 0x40000 0x100 >; 54 reg = < 0x40000 0x100 >;
55 interrupts = < 8 >; 55 interrupts = < 8 >;
56 }; 56 };
57 57
58 uart@0x20000 { 58 uart@20000 {
59 compatible = "snps,dw-apb-uart"; 59 compatible = "snps,dw-apb-uart";
60 reg = <0x20000 0x100>; 60 reg = <0x20000 0x100>;
61 clock-frequency = <2403200>; 61 clock-frequency = <2403200>;
@@ -65,7 +65,7 @@
65 reg-io-width = <4>; 65 reg-io-width = <4>;
66 }; 66 };
67 67
68 uart@0x21000 { 68 uart@21000 {
69 compatible = "snps,dw-apb-uart"; 69 compatible = "snps,dw-apb-uart";
70 reg = <0x21000 0x100>; 70 reg = <0x21000 0x100>;
71 clock-frequency = <2403200>; 71 clock-frequency = <2403200>;
@@ -75,7 +75,7 @@
75 reg-io-width = <4>; 75 reg-io-width = <4>;
76 }; 76 };
77 77
78 uart@0x22000 { 78 uart@22000 {
79 compatible = "snps,dw-apb-uart"; 79 compatible = "snps,dw-apb-uart";
80 reg = <0x22000 0x100>; 80 reg = <0x22000 0x100>;
81 clock-frequency = <2403200>; 81 clock-frequency = <2403200>;
@@ -101,7 +101,7 @@
101 interrupt-names = "arc_ps2_irq"; 101 interrupt-names = "arc_ps2_irq";
102 }; 102 };
103 103
104 mmc@0x15000 { 104 mmc@15000 {
105 compatible = "snps,dw-mshc"; 105 compatible = "snps,dw-mshc";
106 reg = <0x15000 0x400>; 106 reg = <0x15000 0x400>;
107 fifo-depth = <1024>; 107 fifo-depth = <1024>;
@@ -117,11 +117,11 @@
117 * Embedded Vision subsystem UIO mappings; only relevant for EV VDK 117 * Embedded Vision subsystem UIO mappings; only relevant for EV VDK
118 * 118 *
119 * This node is intentionally put outside of MB above becase 119 * This node is intentionally put outside of MB above becase
120 * it maps areas outside of MB's 0xEz-0xFz. 120 * it maps areas outside of MB's 0xez-0xfz.
121 */ 121 */
122 uio_ev: uio@0xD0000000 { 122 uio_ev: uio@d0000000 {
123 compatible = "generic-uio"; 123 compatible = "generic-uio";
124 reg = <0xD0000000 0x2000 0xD1000000 0x2000 0x90000000 0x10000000 0xC0000000 0x10000000>; 124 reg = <0xd0000000 0x2000 0xd1000000 0x2000 0x90000000 0x10000000 0xc0000000 0x10000000>;
125 reg-names = "ev_gsa", "ev_ctrl", "ev_shared_mem", "ev_code_mem"; 125 reg-names = "ev_gsa", "ev_ctrl", "ev_shared_mem", "ev_code_mem";
126 interrupt-parent = <&mb_intc>; 126 interrupt-parent = <&mb_intc>;
127 interrupts = <23>; 127 interrupts = <23>;
diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 6fd3d29546af..0e5fd29ed238 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -8,6 +8,7 @@ CONFIG_NAMESPACES=y
8# CONFIG_UTS_NS is not set 8# CONFIG_UTS_NS is not set
9# CONFIG_PID_NS is not set 9# CONFIG_PID_NS is not set
10CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
11CONFIG_BLK_DEV_RAM=y
11CONFIG_EMBEDDED=y 12CONFIG_EMBEDDED=y
12CONFIG_PERF_EVENTS=y 13CONFIG_PERF_EVENTS=y
13# CONFIG_VM_EVENT_COUNTERS is not set 14# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index a27eafdc8260..a7d4be87b2f0 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -82,6 +82,7 @@
82#define ECR_V_DTLB_MISS 0x05 82#define ECR_V_DTLB_MISS 0x05
83#define ECR_V_PROTV 0x06 83#define ECR_V_PROTV 0x06
84#define ECR_V_TRAP 0x09 84#define ECR_V_TRAP 0x09
85#define ECR_V_MISALIGN 0x0d
85#endif 86#endif
86 87
87/* DTLB Miss and Protection Violation Cause Codes */ 88/* DTLB Miss and Protection Violation Cause Codes */
@@ -167,14 +168,6 @@ struct bcr_mpy {
167#endif 168#endif
168}; 169};
169 170
170struct bcr_extn_xymem {
171#ifdef CONFIG_CPU_BIG_ENDIAN
172 unsigned int ram_org:2, num_banks:4, bank_sz:4, ver:8;
173#else
174 unsigned int ver:8, bank_sz:4, num_banks:4, ram_org:2;
175#endif
176};
177
178struct bcr_iccm_arcompact { 171struct bcr_iccm_arcompact {
179#ifdef CONFIG_CPU_BIG_ENDIAN 172#ifdef CONFIG_CPU_BIG_ENDIAN
180 unsigned int base:16, pad:5, sz:3, ver:8; 173 unsigned int base:16, pad:5, sz:3, ver:8;
@@ -312,7 +305,7 @@ struct cpuinfo_arc {
312 struct cpuinfo_arc_bpu bpu; 305 struct cpuinfo_arc_bpu bpu;
313 struct bcr_identity core; 306 struct bcr_identity core;
314 struct bcr_isa_arcv2 isa; 307 struct bcr_isa_arcv2 isa;
315 const char *details, *name; 308 const char *release, *name;
316 unsigned int vec_base; 309 unsigned int vec_base;
317 struct cpuinfo_arc_ccm iccm, dccm; 310 struct cpuinfo_arc_ccm iccm, dccm;
318 struct { 311 struct {
@@ -322,7 +315,6 @@ struct cpuinfo_arc {
322 timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; 315 timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4;
323 } extn; 316 } extn;
324 struct bcr_mpy extn_mpy; 317 struct bcr_mpy extn_mpy;
325 struct bcr_extn_xymem extn_xymem;
326}; 318};
327 319
328extern struct cpuinfo_arc cpuinfo_arc700[]; 320extern struct cpuinfo_arc cpuinfo_arc700[];
diff --git a/arch/arc/include/asm/irqflags-arcv2.h b/arch/arc/include/asm/irqflags-arcv2.h
index 8a4f77ea3238..e66d0339e1d8 100644
--- a/arch/arc/include/asm/irqflags-arcv2.h
+++ b/arch/arc/include/asm/irqflags-arcv2.h
@@ -44,7 +44,13 @@
44#define ARCV2_IRQ_DEF_PRIO 1 44#define ARCV2_IRQ_DEF_PRIO 1
45 45
46/* seed value for status register */ 46/* seed value for status register */
47#define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \ 47#ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
48#define __AD_ENB STATUS_AD_MASK
49#else
50#define __AD_ENB 0
51#endif
52
53#define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | __AD_ENB | \
48 (ARCV2_IRQ_DEF_PRIO << 1)) 54 (ARCV2_IRQ_DEF_PRIO << 1))
49 55
50#ifndef __ASSEMBLY__ 56#ifndef __ASSEMBLY__
diff --git a/arch/arc/include/asm/perf_event.h b/arch/arc/include/asm/perf_event.h
index 6958545390f0..9cd7ee4fad39 100644
--- a/arch/arc/include/asm/perf_event.h
+++ b/arch/arc/include/asm/perf_event.h
@@ -105,10 +105,10 @@ static const char * const arc_pmu_ev_hw_map[] = {
105 [PERF_COUNT_HW_INSTRUCTIONS] = "iall", 105 [PERF_COUNT_HW_INSTRUCTIONS] = "iall",
106 /* All jump instructions that are taken */ 106 /* All jump instructions that are taken */
107 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmptak", 107 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmptak",
108 [PERF_COUNT_ARC_BPOK] = "bpok", /* NP-NT, PT-T, PNT-NT */
109#ifdef CONFIG_ISA_ARCV2 108#ifdef CONFIG_ISA_ARCV2
110 [PERF_COUNT_HW_BRANCH_MISSES] = "bpmp", 109 [PERF_COUNT_HW_BRANCH_MISSES] = "bpmp",
111#else 110#else
111 [PERF_COUNT_ARC_BPOK] = "bpok", /* NP-NT, PT-T, PNT-NT */
112 [PERF_COUNT_HW_BRANCH_MISSES] = "bpfail", /* NP-T, PT-NT, PNT-T */ 112 [PERF_COUNT_HW_BRANCH_MISSES] = "bpfail", /* NP-T, PT-NT, PNT-T */
113#endif 113#endif
114 [PERF_COUNT_ARC_LDC] = "imemrdc", /* Instr: mem read cached */ 114 [PERF_COUNT_ARC_LDC] = "imemrdc", /* Instr: mem read cached */
diff --git a/arch/arc/include/asm/spinlock.h b/arch/arc/include/asm/spinlock.h
index 2ba04a7db621..daa914da7968 100644
--- a/arch/arc/include/asm/spinlock.h
+++ b/arch/arc/include/asm/spinlock.h
@@ -21,8 +21,6 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
21{ 21{
22 unsigned int val; 22 unsigned int val;
23 23
24 smp_mb();
25
26 __asm__ __volatile__( 24 __asm__ __volatile__(
27 "1: llock %[val], [%[slock]] \n" 25 "1: llock %[val], [%[slock]] \n"
28 " breq %[val], %[LOCKED], 1b \n" /* spin while LOCKED */ 26 " breq %[val], %[LOCKED], 1b \n" /* spin while LOCKED */
@@ -34,6 +32,14 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
34 [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) 32 [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)
35 : "memory", "cc"); 33 : "memory", "cc");
36 34
35 /*
36 * ACQUIRE barrier to ensure load/store after taking the lock
37 * don't "bleed-up" out of the critical section (leak-in is allowed)
38 * http://www.spinics.net/lists/kernel/msg2010409.html
39 *
40 * ARCv2 only has load-load, store-store and all-all barrier
41 * thus need the full all-all barrier
42 */
37 smp_mb(); 43 smp_mb();
38} 44}
39 45
@@ -42,8 +48,6 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
42{ 48{
43 unsigned int val, got_it = 0; 49 unsigned int val, got_it = 0;
44 50
45 smp_mb();
46
47 __asm__ __volatile__( 51 __asm__ __volatile__(
48 "1: llock %[val], [%[slock]] \n" 52 "1: llock %[val], [%[slock]] \n"
49 " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */ 53 " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */
@@ -67,9 +71,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
67{ 71{
68 smp_mb(); 72 smp_mb();
69 73
70 lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__; 74 WRITE_ONCE(lock->slock, __ARCH_SPIN_LOCK_UNLOCKED__);
71
72 smp_mb();
73} 75}
74 76
75/* 77/*
@@ -81,8 +83,6 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
81{ 83{
82 unsigned int val; 84 unsigned int val;
83 85
84 smp_mb();
85
86 /* 86 /*
87 * zero means writer holds the lock exclusively, deny Reader. 87 * zero means writer holds the lock exclusively, deny Reader.
88 * Otherwise grant lock to first/subseq reader 88 * Otherwise grant lock to first/subseq reader
@@ -113,8 +113,6 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)
113{ 113{
114 unsigned int val, got_it = 0; 114 unsigned int val, got_it = 0;
115 115
116 smp_mb();
117
118 __asm__ __volatile__( 116 __asm__ __volatile__(
119 "1: llock %[val], [%[rwlock]] \n" 117 "1: llock %[val], [%[rwlock]] \n"
120 " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */ 118 " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */
@@ -140,8 +138,6 @@ static inline void arch_write_lock(arch_rwlock_t *rw)
140{ 138{
141 unsigned int val; 139 unsigned int val;
142 140
143 smp_mb();
144
145 /* 141 /*
146 * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__), 142 * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__),
147 * deny writer. Otherwise if unlocked grant to writer 143 * deny writer. Otherwise if unlocked grant to writer
@@ -175,8 +171,6 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)
175{ 171{
176 unsigned int val, got_it = 0; 172 unsigned int val, got_it = 0;
177 173
178 smp_mb();
179
180 __asm__ __volatile__( 174 __asm__ __volatile__(
181 "1: llock %[val], [%[rwlock]] \n" 175 "1: llock %[val], [%[rwlock]] \n"
182 " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */ 176 " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */
@@ -217,17 +211,13 @@ static inline void arch_read_unlock(arch_rwlock_t *rw)
217 : [val] "=&r" (val) 211 : [val] "=&r" (val)
218 : [rwlock] "r" (&(rw->counter)) 212 : [rwlock] "r" (&(rw->counter))
219 : "memory", "cc"); 213 : "memory", "cc");
220
221 smp_mb();
222} 214}
223 215
224static inline void arch_write_unlock(arch_rwlock_t *rw) 216static inline void arch_write_unlock(arch_rwlock_t *rw)
225{ 217{
226 smp_mb(); 218 smp_mb();
227 219
228 rw->counter = __ARCH_RW_LOCK_UNLOCKED__; 220 WRITE_ONCE(rw->counter, __ARCH_RW_LOCK_UNLOCKED__);
229
230 smp_mb();
231} 221}
232 222
233#else /* !CONFIG_ARC_HAS_LLSC */ 223#else /* !CONFIG_ARC_HAS_LLSC */
@@ -237,10 +227,9 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
237 unsigned int val = __ARCH_SPIN_LOCK_LOCKED__; 227 unsigned int val = __ARCH_SPIN_LOCK_LOCKED__;
238 228
239 /* 229 /*
240 * This smp_mb() is technically superfluous, we only need the one 230 * Per lkmm, smp_mb() is only required after _lock (and before_unlock)
241 * after the lock for providing the ACQUIRE semantics. 231 * for ACQ and REL semantics respectively. However EX based spinlocks
242 * However doing the "right" thing was regressing hackbench 232 * need the extra smp_mb to workaround a hardware quirk.
243 * so keeping this, pending further investigation
244 */ 233 */
245 smp_mb(); 234 smp_mb();
246 235
@@ -257,14 +246,6 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
257#endif 246#endif
258 : "memory"); 247 : "memory");
259 248
260 /*
261 * ACQUIRE barrier to ensure load/store after taking the lock
262 * don't "bleed-up" out of the critical section (leak-in is allowed)
263 * http://www.spinics.net/lists/kernel/msg2010409.html
264 *
265 * ARCv2 only has load-load, store-store and all-all barrier
266 * thus need the full all-all barrier
267 */
268 smp_mb(); 249 smp_mb();
269} 250}
270 251
@@ -309,8 +290,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
309 : "memory"); 290 : "memory");
310 291
311 /* 292 /*
312 * superfluous, but keeping for now - see pairing version in 293 * see pairing version/comment in arch_spin_lock above
313 * arch_spin_lock above
314 */ 294 */
315 smp_mb(); 295 smp_mb();
316} 296}
@@ -344,7 +324,6 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)
344 arch_spin_unlock(&(rw->lock_mutex)); 324 arch_spin_unlock(&(rw->lock_mutex));
345 local_irq_restore(flags); 325 local_irq_restore(flags);
346 326
347 smp_mb();
348 return ret; 327 return ret;
349} 328}
350 329
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 30e090625916..8f6e0447dd17 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -54,7 +54,12 @@
54 ; gcc 7.3.1 (ARC GNU 2018.03) onwards generates unaligned access 54 ; gcc 7.3.1 (ARC GNU 2018.03) onwards generates unaligned access
55 ; by default 55 ; by default
56 lr r5, [status32] 56 lr r5, [status32]
57#ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
57 bset r5, r5, STATUS_AD_BIT 58 bset r5, r5, STATUS_AD_BIT
59#else
60 ; Although disabled at reset, bootloader might have enabled it
61 bclr r5, r5, STATUS_AD_BIT
62#endif
58 kflag r5 63 kflag r5
59#endif 64#endif
60.endm 65.endm
@@ -106,6 +111,7 @@ ENTRY(stext)
106 ; r2 = pointer to uboot provided cmdline or external DTB in mem 111 ; r2 = pointer to uboot provided cmdline or external DTB in mem
107 ; These are handled later in handle_uboot_args() 112 ; These are handled later in handle_uboot_args()
108 st r0, [@uboot_tag] 113 st r0, [@uboot_tag]
114 st r1, [@uboot_magic]
109 st r2, [@uboot_arg] 115 st r2, [@uboot_arg]
110 116
111 ; setup "current" tsk and optionally cache it in dedicated r25 117 ; setup "current" tsk and optionally cache it in dedicated r25
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c
index cf18b3e5a934..c0d0124de089 100644
--- a/arch/arc/kernel/intc-arcv2.c
+++ b/arch/arc/kernel/intc-arcv2.c
@@ -95,7 +95,7 @@ void arc_init_IRQ(void)
95 95
96 /* setup status32, don't enable intr yet as kernel doesn't want */ 96 /* setup status32, don't enable intr yet as kernel doesn't want */
97 tmp = read_aux_reg(ARC_REG_STATUS32); 97 tmp = read_aux_reg(ARC_REG_STATUS32);
98 tmp |= STATUS_AD_MASK | (ARCV2_IRQ_DEF_PRIO << 1); 98 tmp |= ARCV2_IRQ_DEF_PRIO << 1;
99 tmp &= ~STATUS_IE_MASK; 99 tmp &= ~STATUS_IE_MASK;
100 asm volatile("kflag %0 \n"::"r"(tmp)); 100 asm volatile("kflag %0 \n"::"r"(tmp));
101} 101}
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 7b2340996cf8..a9c88b7e9182 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -36,6 +36,7 @@ unsigned int intr_to_DE_cnt;
36 36
37/* Part of U-boot ABI: see head.S */ 37/* Part of U-boot ABI: see head.S */
38int __initdata uboot_tag; 38int __initdata uboot_tag;
39int __initdata uboot_magic;
39char __initdata *uboot_arg; 40char __initdata *uboot_arg;
40 41
41const struct machine_desc *machine_desc; 42const struct machine_desc *machine_desc;
@@ -44,29 +45,24 @@ struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
44 45
45struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; 46struct cpuinfo_arc cpuinfo_arc700[NR_CPUS];
46 47
47static const struct id_to_str arc_cpu_rel[] = { 48static const struct id_to_str arc_legacy_rel[] = {
49 /* ID.ARCVER, Release */
48#ifdef CONFIG_ISA_ARCOMPACT 50#ifdef CONFIG_ISA_ARCOMPACT
49 { 0x34, "R4.10"}, 51 { 0x34, "R4.10"},
50 { 0x35, "R4.11"}, 52 { 0x35, "R4.11"},
51#else 53#else
52 { 0x51, "R2.0" }, 54 { 0x51, "R2.0" },
53 { 0x52, "R2.1" }, 55 { 0x52, "R2.1" },
54 { 0x53, "R3.0" }, 56 { 0x53, "R3.0" },
55 { 0x54, "R3.10a" },
56#endif 57#endif
57 { 0x00, NULL } 58 { 0x00, NULL }
58}; 59};
59 60
60static const struct id_to_str arc_cpu_nm[] = { 61static const struct id_to_str arc_cpu_rel[] = {
61#ifdef CONFIG_ISA_ARCOMPACT 62 /* UARCH.MAJOR, Release */
62 { 0x20, "ARC 600" }, 63 { 0, "R3.10a"},
63 { 0x30, "ARC 770" }, /* 750 identified seperately */ 64 { 1, "R3.50a"},
64#else 65 { 0xFF, NULL }
65 { 0x40, "ARC EM" },
66 { 0x50, "ARC HS38" },
67 { 0x54, "ARC HS48" },
68#endif
69 { 0x00, "Unknown" }
70}; 66};
71 67
72static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu) 68static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu)
@@ -116,31 +112,72 @@ static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu)
116 } 112 }
117} 113}
118 114
115static void decode_arc_core(struct cpuinfo_arc *cpu)
116{
117 struct bcr_uarch_build_arcv2 uarch;
118 const struct id_to_str *tbl;
119
120 /*
121 * Up until (including) the first core4 release (0x54) things were
122 * simple: AUX IDENTITY.ARCVER was sufficient to identify arc family
123 * and release: 0x50 to 0x53 was HS38, 0x54 was HS48 (dual issue)
124 */
125
126 if (cpu->core.family < 0x54) { /* includes arc700 */
127
128 for (tbl = &arc_legacy_rel[0]; tbl->id != 0; tbl++) {
129 if (cpu->core.family == tbl->id) {
130 cpu->release = tbl->str;
131 break;
132 }
133 }
134
135 if (is_isa_arcompact())
136 cpu->name = "ARC700";
137 else if (tbl->str)
138 cpu->name = "HS38";
139 else
140 cpu->name = cpu->release = "Unknown";
141
142 return;
143 }
144
145 /*
146 * However the subsequent HS release (same 0x54) allow HS38 or HS48
147 * configurations and encode this info in a different BCR.
148 * The BCR was introduced in 0x54 so can't be read unconditionally.
149 */
150
151 READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch);
152
153 if (uarch.prod == 4) {
154 cpu->name = "HS48";
155 cpu->extn.dual = 1;
156
157 } else {
158 cpu->name = "HS38";
159 }
160
161 for (tbl = &arc_cpu_rel[0]; tbl->id != 0xFF; tbl++) {
162 if (uarch.maj == tbl->id) {
163 cpu->release = tbl->str;
164 break;
165 }
166 }
167}
168
119static void read_arc_build_cfg_regs(void) 169static void read_arc_build_cfg_regs(void)
120{ 170{
121 struct bcr_timer timer; 171 struct bcr_timer timer;
122 struct bcr_generic bcr; 172 struct bcr_generic bcr;
123 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 173 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
124 const struct id_to_str *tbl;
125 struct bcr_isa_arcv2 isa; 174 struct bcr_isa_arcv2 isa;
126 struct bcr_actionpoint ap; 175 struct bcr_actionpoint ap;
127 176
128 FIX_PTR(cpu); 177 FIX_PTR(cpu);
129 178
130 READ_BCR(AUX_IDENTITY, cpu->core); 179 READ_BCR(AUX_IDENTITY, cpu->core);
131 180 decode_arc_core(cpu);
132 for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) {
133 if (cpu->core.family == tbl->id) {
134 cpu->details = tbl->str;
135 break;
136 }
137 }
138
139 for (tbl = &arc_cpu_nm[0]; tbl->id != 0; tbl++) {
140 if ((cpu->core.family & 0xF4) == tbl->id)
141 break;
142 }
143 cpu->name = tbl->str;
144 181
145 READ_BCR(ARC_REG_TIMERS_BCR, timer); 182 READ_BCR(ARC_REG_TIMERS_BCR, timer);
146 cpu->extn.timer0 = timer.t0; 183 cpu->extn.timer0 = timer.t0;
@@ -151,16 +188,6 @@ static void read_arc_build_cfg_regs(void)
151 188
152 READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy); 189 READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy);
153 190
154 cpu->extn.norm = read_aux_reg(ARC_REG_NORM_BCR) > 1 ? 1 : 0; /* 2,3 */
155 cpu->extn.barrel = read_aux_reg(ARC_REG_BARREL_BCR) > 1 ? 1 : 0; /* 2,3 */
156 cpu->extn.swap = read_aux_reg(ARC_REG_SWAP_BCR) ? 1 : 0; /* 1,3 */
157 cpu->extn.crc = read_aux_reg(ARC_REG_CRC_BCR) ? 1 : 0;
158 cpu->extn.minmax = read_aux_reg(ARC_REG_MIXMAX_BCR) > 1 ? 1 : 0; /* 2 */
159 cpu->extn.swape = (cpu->core.family >= 0x34) ? 1 :
160 IS_ENABLED(CONFIG_ARC_HAS_SWAPE);
161
162 READ_BCR(ARC_REG_XY_MEM_BCR, cpu->extn_xymem);
163
164 /* Read CCM BCRs for boot reporting even if not enabled in Kconfig */ 191 /* Read CCM BCRs for boot reporting even if not enabled in Kconfig */
165 read_decode_ccm_bcr(cpu); 192 read_decode_ccm_bcr(cpu);
166 193
@@ -198,30 +225,12 @@ static void read_arc_build_cfg_regs(void)
198 cpu->bpu.num_pred = 2048 << bpu.pte; 225 cpu->bpu.num_pred = 2048 << bpu.pte;
199 cpu->bpu.ret_stk = 4 << bpu.rse; 226 cpu->bpu.ret_stk = 4 << bpu.rse;
200 227
201 if (cpu->core.family >= 0x54) { 228 /* if dual issue hardware, is it enabled ? */
202 229 if (cpu->extn.dual) {
203 struct bcr_uarch_build_arcv2 uarch; 230 unsigned int exec_ctrl;
204
205 /*
206 * The first 0x54 core (uarch maj:min 0:1 or 0:2) was
207 * dual issue only (HS4x). But next uarch rev (1:0)
208 * allows it be configured for single issue (HS3x)
209 * Ensure we fiddle with dual issue only on HS4x
210 */
211 READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch);
212
213 if (uarch.prod == 4) {
214 unsigned int exec_ctrl;
215
216 /* dual issue hardware always present */
217 cpu->extn.dual = 1;
218
219 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
220 231
221 /* dual issue hardware enabled ? */ 232 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
222 cpu->extn.dual_enb = !(exec_ctrl & 1); 233 cpu->extn.dual_enb = !(exec_ctrl & 1);
223
224 }
225 } 234 }
226 } 235 }
227 236
@@ -263,7 +272,8 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
263{ 272{
264 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id]; 273 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id];
265 struct bcr_identity *core = &cpu->core; 274 struct bcr_identity *core = &cpu->core;
266 int i, n = 0, ua = 0; 275 char mpy_opt[16];
276 int n = 0;
267 277
268 FIX_PTR(cpu); 278 FIX_PTR(cpu);
269 279
@@ -272,7 +282,7 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
272 core->family, core->cpu_id, core->chip_id); 282 core->family, core->cpu_id, core->chip_id);
273 283
274 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n", 284 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n",
275 cpu_id, cpu->name, cpu->details, 285 cpu_id, cpu->name, cpu->release,
276 is_isa_arcompact() ? "ARCompact" : "ARCv2", 286 is_isa_arcompact() ? "ARCompact" : "ARCv2",
277 IS_AVAIL1(cpu->isa.be, "[Big-Endian]"), 287 IS_AVAIL1(cpu->isa.be, "[Big-Endian]"),
278 IS_AVAIL3(cpu->extn.dual, cpu->extn.dual_enb, " Dual-Issue ")); 288 IS_AVAIL3(cpu->extn.dual, cpu->extn.dual_enb, " Dual-Issue "));
@@ -283,61 +293,50 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
283 IS_AVAIL2(cpu->extn.rtc, "RTC [UP 64-bit] ", CONFIG_ARC_TIMERS_64BIT), 293 IS_AVAIL2(cpu->extn.rtc, "RTC [UP 64-bit] ", CONFIG_ARC_TIMERS_64BIT),
284 IS_AVAIL2(cpu->extn.gfrc, "GFRC [SMP 64-bit] ", CONFIG_ARC_TIMERS_64BIT)); 294 IS_AVAIL2(cpu->extn.gfrc, "GFRC [SMP 64-bit] ", CONFIG_ARC_TIMERS_64BIT));
285 295
286#ifdef __ARC_UNALIGNED__
287 ua = 1;
288#endif
289 n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s%s",
290 IS_AVAIL2(cpu->isa.atomic, "atomic ", CONFIG_ARC_HAS_LLSC),
291 IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64),
292 IS_AVAIL1(cpu->isa.unalign, "unalign "), IS_USED_RUN(ua));
293
294 if (i)
295 n += scnprintf(buf + n, len - n, "\n\t\t: ");
296
297 if (cpu->extn_mpy.ver) { 296 if (cpu->extn_mpy.ver) {
298 if (cpu->extn_mpy.ver <= 0x2) { /* ARCompact */ 297 if (is_isa_arcompact()) {
299 n += scnprintf(buf + n, len - n, "mpy "); 298 scnprintf(mpy_opt, 16, "mpy");
300 } else { 299 } else {
300
301 int opt = 2; /* stock MPY/MPYH */ 301 int opt = 2; /* stock MPY/MPYH */
302 302
303 if (cpu->extn_mpy.dsp) /* OPT 7-9 */ 303 if (cpu->extn_mpy.dsp) /* OPT 7-9 */
304 opt = cpu->extn_mpy.dsp + 6; 304 opt = cpu->extn_mpy.dsp + 6;
305 305
306 n += scnprintf(buf + n, len - n, "mpy[opt %d] ", opt); 306 scnprintf(mpy_opt, 16, "mpy[opt %d] ", opt);
307 } 307 }
308 } 308 }
309 309
310 n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n", 310 n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n",
311 IS_AVAIL1(cpu->isa.div_rem, "div_rem "), 311 IS_AVAIL2(cpu->isa.atomic, "atomic ", CONFIG_ARC_HAS_LLSC),
312 IS_AVAIL1(cpu->extn.norm, "norm "), 312 IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64),
313 IS_AVAIL1(cpu->extn.barrel, "barrel-shift "), 313 IS_AVAIL2(cpu->isa.unalign, "unalign ", CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS),
314 IS_AVAIL1(cpu->extn.swap, "swap "), 314 IS_AVAIL1(cpu->extn_mpy.ver, mpy_opt),
315 IS_AVAIL1(cpu->extn.minmax, "minmax "), 315 IS_AVAIL1(cpu->isa.div_rem, "div_rem "));
316 IS_AVAIL1(cpu->extn.crc, "crc "), 316
317 IS_AVAIL2(cpu->extn.swape, "swape", CONFIG_ARC_HAS_SWAPE)); 317 if (cpu->bpu.ver) {
318
319 if (cpu->bpu.ver)
320 n += scnprintf(buf + n, len - n, 318 n += scnprintf(buf + n, len - n,
321 "BPU\t\t: %s%s match, cache:%d, Predict Table:%d Return stk: %d", 319 "BPU\t\t: %s%s match, cache:%d, Predict Table:%d Return stk: %d",
322 IS_AVAIL1(cpu->bpu.full, "full"), 320 IS_AVAIL1(cpu->bpu.full, "full"),
323 IS_AVAIL1(!cpu->bpu.full, "partial"), 321 IS_AVAIL1(!cpu->bpu.full, "partial"),
324 cpu->bpu.num_cache, cpu->bpu.num_pred, cpu->bpu.ret_stk); 322 cpu->bpu.num_cache, cpu->bpu.num_pred, cpu->bpu.ret_stk);
325 323
326 if (is_isa_arcv2()) { 324 if (is_isa_arcv2()) {
327 struct bcr_lpb lpb; 325 struct bcr_lpb lpb;
328 326
329 READ_BCR(ARC_REG_LPB_BUILD, lpb); 327 READ_BCR(ARC_REG_LPB_BUILD, lpb);
330 if (lpb.ver) { 328 if (lpb.ver) {
331 unsigned int ctl; 329 unsigned int ctl;
332 ctl = read_aux_reg(ARC_REG_LPB_CTRL); 330 ctl = read_aux_reg(ARC_REG_LPB_CTRL);
333 331
334 n += scnprintf(buf + n, len - n, " Loop Buffer:%d %s", 332 n += scnprintf(buf + n, len - n, " Loop Buffer:%d %s",
335 lpb.entries, 333 lpb.entries,
336 IS_DISABLED_RUN(!ctl)); 334 IS_DISABLED_RUN(!ctl));
335 }
337 } 336 }
337 n += scnprintf(buf + n, len - n, "\n");
338 } 338 }
339 339
340 n += scnprintf(buf + n, len - n, "\n");
341 return buf; 340 return buf;
342} 341}
343 342
@@ -390,11 +389,6 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
390 } 389 }
391 } 390 }
392 391
393 n += scnprintf(buf + n, len - n, "OS ABI [v%d]\t: %s\n",
394 EF_ARC_OSABI_CURRENT >> 8,
395 EF_ARC_OSABI_CURRENT == EF_ARC_OSABI_V3 ?
396 "no-legacy-syscalls" : "64-bit data any register aligned");
397
398 return buf; 392 return buf;
399} 393}
400 394
@@ -497,6 +491,8 @@ static inline bool uboot_arg_invalid(unsigned long addr)
497#define UBOOT_TAG_NONE 0 491#define UBOOT_TAG_NONE 0
498#define UBOOT_TAG_CMDLINE 1 492#define UBOOT_TAG_CMDLINE 1
499#define UBOOT_TAG_DTB 2 493#define UBOOT_TAG_DTB 2
494/* We always pass 0 as magic from U-boot */
495#define UBOOT_MAGIC_VALUE 0
500 496
501void __init handle_uboot_args(void) 497void __init handle_uboot_args(void)
502{ 498{
@@ -511,6 +507,11 @@ void __init handle_uboot_args(void)
511 goto ignore_uboot_args; 507 goto ignore_uboot_args;
512 } 508 }
513 509
510 if (uboot_magic != UBOOT_MAGIC_VALUE) {
511 pr_warn(IGNORE_ARGS "non zero uboot magic\n");
512 goto ignore_uboot_args;
513 }
514
514 if (uboot_tag != UBOOT_TAG_NONE && 515 if (uboot_tag != UBOOT_TAG_NONE &&
515 uboot_arg_invalid((unsigned long)uboot_arg)) { 516 uboot_arg_invalid((unsigned long)uboot_arg)) {
516 pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg); 517 pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg);
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 215f515442e0..b0aa8c028331 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -145,7 +145,8 @@ static void show_ecr_verbose(struct pt_regs *regs)
145 } else if (vec == ECR_V_PROTV) { 145 } else if (vec == ECR_V_PROTV) {
146 if (cause_code == ECR_C_PROTV_INST_FETCH) 146 if (cause_code == ECR_C_PROTV_INST_FETCH)
147 pr_cont("Execute from Non-exec Page\n"); 147 pr_cont("Execute from Non-exec Page\n");
148 else if (cause_code == ECR_C_PROTV_MISALIG_DATA) 148 else if (cause_code == ECR_C_PROTV_MISALIG_DATA &&
149 IS_ENABLED(CONFIG_ISA_ARCOMPACT))
149 pr_cont("Misaligned r/w from 0x%08lx\n", address); 150 pr_cont("Misaligned r/w from 0x%08lx\n", address);
150 else 151 else
151 pr_cont("%s access not allowed on page\n", 152 pr_cont("%s access not allowed on page\n",
@@ -161,6 +162,8 @@ static void show_ecr_verbose(struct pt_regs *regs)
161 pr_cont("Bus Error from Data Mem\n"); 162 pr_cont("Bus Error from Data Mem\n");
162 else 163 else
163 pr_cont("Bus Error, check PRM\n"); 164 pr_cont("Bus Error, check PRM\n");
165 } else if (vec == ECR_V_MISALIGN) {
166 pr_cont("Misaligned r/w from 0x%08lx\n", address);
164#endif 167#endif
165 } else if (vec == ECR_V_TRAP) { 168 } else if (vec == ECR_V_TRAP) {
166 if (regs->ecr_param == 5) 169 if (regs->ecr_param == 5)
diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile
index b1656d156097..f7537b466b23 100644
--- a/arch/arc/lib/Makefile
+++ b/arch/arc/lib/Makefile
@@ -8,4 +8,10 @@
8lib-y := strchr-700.o strcpy-700.o strlen.o memcmp.o 8lib-y := strchr-700.o strcpy-700.o strlen.o memcmp.o
9 9
10lib-$(CONFIG_ISA_ARCOMPACT) += memcpy-700.o memset.o strcmp.o 10lib-$(CONFIG_ISA_ARCOMPACT) += memcpy-700.o memset.o strcmp.o
11lib-$(CONFIG_ISA_ARCV2) += memcpy-archs.o memset-archs.o strcmp-archs.o 11lib-$(CONFIG_ISA_ARCV2) += memset-archs.o strcmp-archs.o
12
13ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
14lib-$(CONFIG_ISA_ARCV2) +=memcpy-archs-unaligned.o
15else
16lib-$(CONFIG_ISA_ARCV2) +=memcpy-archs.o
17endif
diff --git a/arch/arc/lib/memcpy-archs-unaligned.S b/arch/arc/lib/memcpy-archs-unaligned.S
new file mode 100644
index 000000000000..28993a73fdde
--- /dev/null
+++ b/arch/arc/lib/memcpy-archs-unaligned.S
@@ -0,0 +1,47 @@
1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * ARCv2 memcpy implementation optimized for unaligned memory access using.
4 *
5 * Copyright (C) 2019 Synopsys
6 * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
7 */
8
9#include <linux/linkage.h>
10
11#ifdef CONFIG_ARC_HAS_LL64
12# define LOADX(DST,RX) ldd.ab DST, [RX, 8]
13# define STOREX(SRC,RX) std.ab SRC, [RX, 8]
14# define ZOLSHFT 5
15# define ZOLAND 0x1F
16#else
17# define LOADX(DST,RX) ld.ab DST, [RX, 4]
18# define STOREX(SRC,RX) st.ab SRC, [RX, 4]
19# define ZOLSHFT 4
20# define ZOLAND 0xF
21#endif
22
23ENTRY_CFI(memcpy)
24 mov r3, r0 ; don;t clobber ret val
25
26 lsr.f lp_count, r2, ZOLSHFT
27 lpnz @.Lcopy32_64bytes
28 ;; LOOP START
29 LOADX (r6, r1)
30 LOADX (r8, r1)
31 LOADX (r10, r1)
32 LOADX (r4, r1)
33 STOREX (r6, r3)
34 STOREX (r8, r3)
35 STOREX (r10, r3)
36 STOREX (r4, r3)
37.Lcopy32_64bytes:
38
39 and.f lp_count, r2, ZOLAND ;Last remaining 31 bytes
40 lpnz @.Lcopyremainingbytes
41 ;; LOOP START
42 ldb.ab r5, [r1, 1]
43 stb.ab r5, [r3, 1]
44.Lcopyremainingbytes:
45
46 j [blink]
47END_CFI(memcpy)
diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig
index 8eff057efcae..2eaecfb063a7 100644
--- a/arch/arc/plat-eznps/Kconfig
+++ b/arch/arc/plat-eznps/Kconfig
@@ -26,8 +26,8 @@ config EZNPS_MTM_EXT
26 help 26 help
27 Here we add new hierarchy for CPUs topology. 27 Here we add new hierarchy for CPUs topology.
28 We got: 28 We got:
29 Core 29 Core
30 Thread 30 Thread
31 At the new thread level each CPU represent one HW thread. 31 At the new thread level each CPU represent one HW thread.
32 At highest hierarchy each core contain 16 threads, 32 At highest hierarchy each core contain 16 threads,
33 any of them seem like CPU from Linux point of view. 33 any of them seem like CPU from Linux point of view.
@@ -35,10 +35,10 @@ config EZNPS_MTM_EXT
35 core and HW scheduler round robin between them. 35 core and HW scheduler round robin between them.
36 36
37config EZNPS_MEM_ERROR_ALIGN 37config EZNPS_MEM_ERROR_ALIGN
38 bool "ARC-EZchip Memory error as an exception" 38 bool "ARC-EZchip Memory error as an exception"
39 depends on EZNPS_MTM_EXT 39 depends on EZNPS_MTM_EXT
40 default n 40 default n
41 help 41 help
42 On the real chip of the NPS, user memory errors are handled 42 On the real chip of the NPS, user memory errors are handled
43 as a machine check exception, which is fatal, whereas on 43 as a machine check exception, which is fatal, whereas on
44 simulator platform for NPS, is handled as a Level 2 interrupt 44 simulator platform for NPS, is handled as a Level 2 interrupt
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 117b2541ef3d..7e34b9eba5de 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -159,7 +159,6 @@ config ARM64
159 select IRQ_DOMAIN 159 select IRQ_DOMAIN
160 select IRQ_FORCED_THREADING 160 select IRQ_FORCED_THREADING
161 select MODULES_USE_ELF_RELA 161 select MODULES_USE_ELF_RELA
162 select MULTI_IRQ_HANDLER
163 select NEED_DMA_MAP_STATE 162 select NEED_DMA_MAP_STATE
164 select NEED_SG_DMA_LENGTH 163 select NEED_SG_DMA_LENGTH
165 select OF 164 select OF
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index 2afb1338b48a..5f1437099b99 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -77,6 +77,7 @@
77#define ARM_CPU_IMP_QCOM 0x51 77#define ARM_CPU_IMP_QCOM 0x51
78#define ARM_CPU_IMP_NVIDIA 0x4E 78#define ARM_CPU_IMP_NVIDIA 0x4E
79#define ARM_CPU_IMP_FUJITSU 0x46 79#define ARM_CPU_IMP_FUJITSU 0x46
80#define ARM_CPU_IMP_HISI 0x48
80 81
81#define ARM_CPU_PART_AEM_V8 0xD0F 82#define ARM_CPU_PART_AEM_V8 0xD0F
82#define ARM_CPU_PART_FOUNDATION 0xD00 83#define ARM_CPU_PART_FOUNDATION 0xD00
@@ -107,6 +108,8 @@
107 108
108#define FUJITSU_CPU_PART_A64FX 0x001 109#define FUJITSU_CPU_PART_A64FX 0x001
109 110
111#define HISI_CPU_PART_TSV110 0xD01
112
110#define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53) 113#define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
111#define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57) 114#define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
112#define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72) 115#define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
@@ -126,10 +129,11 @@
126#define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER) 129#define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER)
127#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL) 130#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)
128#define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX) 131#define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)
132#define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110)
129 133
130/* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */ 134/* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */
131#define MIDR_FUJITSU_ERRATUM_010001 MIDR_FUJITSU_A64FX 135#define MIDR_FUJITSU_ERRATUM_010001 MIDR_FUJITSU_A64FX
132#define MIDR_FUJITSU_ERRATUM_010001_MASK (~MIDR_VARIANT(1)) 136#define MIDR_FUJITSU_ERRATUM_010001_MASK (~MIDR_CPU_VAR_REV(1, 0))
133#define TCR_CLEAR_FUJITSU_ERRATUM_010001 (TCR_NFD1 | TCR_NFD0) 137#define TCR_CLEAR_FUJITSU_ERRATUM_010001 (TCR_NFD1 | TCR_NFD0)
134 138
135#ifndef __ASSEMBLY__ 139#ifndef __ASSEMBLY__
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index e24e94d28767..4061de10cea6 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -963,6 +963,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
963 MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), 963 MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
964 MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), 964 MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
965 MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), 965 MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
966 MIDR_ALL_VERSIONS(MIDR_HISI_TSV110),
966 { /* sentinel */ } 967 { /* sentinel */ }
967 }; 968 };
968 char const *str = "command line option"; 969 char const *str = "command line option";
diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c
index 7fb6f3aa5ceb..7a679caf4585 100644
--- a/arch/arm64/kernel/probes/kprobes.c
+++ b/arch/arm64/kernel/probes/kprobes.c
@@ -91,8 +91,6 @@ static void __kprobes arch_simulate_insn(struct kprobe *p, struct pt_regs *regs)
91int __kprobes arch_prepare_kprobe(struct kprobe *p) 91int __kprobes arch_prepare_kprobe(struct kprobe *p)
92{ 92{
93 unsigned long probe_addr = (unsigned long)p->addr; 93 unsigned long probe_addr = (unsigned long)p->addr;
94 extern char __start_rodata[];
95 extern char __end_rodata[];
96 94
97 if (probe_addr & 0x3) 95 if (probe_addr & 0x3)
98 return -EINVAL; 96 return -EINVAL;
@@ -100,10 +98,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
100 /* copy instruction */ 98 /* copy instruction */
101 p->opcode = le32_to_cpu(*p->addr); 99 p->opcode = le32_to_cpu(*p->addr);
102 100
103 if (in_exception_text(probe_addr)) 101 if (search_exception_tables(probe_addr))
104 return -EINVAL;
105 if (probe_addr >= (unsigned long) __start_rodata &&
106 probe_addr <= (unsigned long) __end_rodata)
107 return -EINVAL; 102 return -EINVAL;
108 103
109 /* decode instruction */ 104 /* decode instruction */
@@ -476,26 +471,37 @@ kprobe_breakpoint_handler(struct pt_regs *regs, unsigned int esr)
476 return DBG_HOOK_HANDLED; 471 return DBG_HOOK_HANDLED;
477} 472}
478 473
479bool arch_within_kprobe_blacklist(unsigned long addr) 474/*
475 * Provide a blacklist of symbols identifying ranges which cannot be kprobed.
476 * This blacklist is exposed to userspace via debugfs (kprobes/blacklist).
477 */
478int __init arch_populate_kprobe_blacklist(void)
480{ 479{
481 if ((addr >= (unsigned long)__kprobes_text_start && 480 int ret;
482 addr < (unsigned long)__kprobes_text_end) || 481
483 (addr >= (unsigned long)__entry_text_start && 482 ret = kprobe_add_area_blacklist((unsigned long)__entry_text_start,
484 addr < (unsigned long)__entry_text_end) || 483 (unsigned long)__entry_text_end);
485 (addr >= (unsigned long)__idmap_text_start && 484 if (ret)
486 addr < (unsigned long)__idmap_text_end) || 485 return ret;
487 (addr >= (unsigned long)__hyp_text_start && 486 ret = kprobe_add_area_blacklist((unsigned long)__irqentry_text_start,
488 addr < (unsigned long)__hyp_text_end) || 487 (unsigned long)__irqentry_text_end);
489 !!search_exception_tables(addr)) 488 if (ret)
490 return true; 489 return ret;
491 490 ret = kprobe_add_area_blacklist((unsigned long)__exception_text_start,
492 if (!is_kernel_in_hyp_mode()) { 491 (unsigned long)__exception_text_end);
493 if ((addr >= (unsigned long)__hyp_idmap_text_start && 492 if (ret)
494 addr < (unsigned long)__hyp_idmap_text_end)) 493 return ret;
495 return true; 494 ret = kprobe_add_area_blacklist((unsigned long)__idmap_text_start,
496 } 495 (unsigned long)__idmap_text_end);
497 496 if (ret)
498 return false; 497 return ret;
498 ret = kprobe_add_area_blacklist((unsigned long)__hyp_text_start,
499 (unsigned long)__hyp_text_end);
500 if (ret || is_kernel_in_hyp_mode())
501 return ret;
502 ret = kprobe_add_area_blacklist((unsigned long)__hyp_idmap_text_start,
503 (unsigned long)__hyp_idmap_text_end);
504 return ret;
499} 505}
500 506
501void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs) 507void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs)
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 1a29f2695ff2..d908b5e9e949 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -143,6 +143,7 @@ void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
143 if (trace->nr_entries < trace->max_entries) 143 if (trace->nr_entries < trace->max_entries)
144 trace->entries[trace->nr_entries++] = ULONG_MAX; 144 trace->entries[trace->nr_entries++] = ULONG_MAX;
145} 145}
146EXPORT_SYMBOL_GPL(save_stack_trace_regs);
146 147
147static noinline void __save_stack_trace(struct task_struct *tsk, 148static noinline void __save_stack_trace(struct task_struct *tsk,
148 struct stack_trace *trace, unsigned int nosched) 149 struct stack_trace *trace, unsigned int nosched)
diff --git a/arch/mips/bcm47xx/workarounds.c b/arch/mips/bcm47xx/workarounds.c
index 46eddbec8d9f..0ab95dd431b3 100644
--- a/arch/mips/bcm47xx/workarounds.c
+++ b/arch/mips/bcm47xx/workarounds.c
@@ -24,6 +24,7 @@ void __init bcm47xx_workarounds(void)
24 case BCM47XX_BOARD_NETGEAR_WNR3500L: 24 case BCM47XX_BOARD_NETGEAR_WNR3500L:
25 bcm47xx_workarounds_enable_usb_power(12); 25 bcm47xx_workarounds_enable_usb_power(12);
26 break; 26 break;
27 case BCM47XX_BOARD_NETGEAR_WNDR3400V2:
27 case BCM47XX_BOARD_NETGEAR_WNDR3400_V3: 28 case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
28 bcm47xx_workarounds_enable_usb_power(21); 29 bcm47xx_workarounds_enable_usb_power(21);
29 break; 30 break;
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h
index e77672539e8e..e4456e450f94 100644
--- a/arch/mips/include/asm/jump_label.h
+++ b/arch/mips/include/asm/jump_label.h
@@ -21,15 +21,15 @@
21#endif 21#endif
22 22
23#ifdef CONFIG_CPU_MICROMIPS 23#ifdef CONFIG_CPU_MICROMIPS
24#define NOP_INSN "nop32" 24#define B_INSN "b32"
25#else 25#else
26#define NOP_INSN "nop" 26#define B_INSN "b"
27#endif 27#endif
28 28
29static __always_inline bool arch_static_branch(struct static_key *key, bool branch) 29static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
30{ 30{
31 asm_volatile_goto("1:\t" NOP_INSN "\n\t" 31 asm_volatile_goto("1:\t" B_INSN " 2f\n\t"
32 "nop\n\t" 32 "2:\tnop\n\t"
33 ".pushsection __jump_table, \"aw\"\n\t" 33 ".pushsection __jump_table, \"aw\"\n\t"
34 WORD_INSN " 1b, %l[l_yes], %0\n\t" 34 WORD_INSN " 1b, %l[l_yes], %0\n\t"
35 ".popsection\n\t" 35 ".popsection\n\t"
diff --git a/arch/mips/include/uapi/asm/posix_types.h b/arch/mips/include/uapi/asm/posix_types.h
index 6aa49c10f88f..f0ccb5b90ce9 100644
--- a/arch/mips/include/uapi/asm/posix_types.h
+++ b/arch/mips/include/uapi/asm/posix_types.h
@@ -21,13 +21,6 @@
21typedef long __kernel_daddr_t; 21typedef long __kernel_daddr_t;
22#define __kernel_daddr_t __kernel_daddr_t 22#define __kernel_daddr_t __kernel_daddr_t
23 23
24#if (_MIPS_SZLONG == 32)
25typedef struct {
26 long val[2];
27} __kernel_fsid_t;
28#define __kernel_fsid_t __kernel_fsid_t
29#endif
30
31#include <asm-generic/posix_types.h> 24#include <asm-generic/posix_types.h>
32 25
33#endif /* _ASM_POSIX_TYPES_H */ 26#endif /* _ASM_POSIX_TYPES_H */
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index cb7e9ed7a453..33ee0d18fb0a 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -140,6 +140,13 @@ SECTIONS
140 PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 140 PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
141#endif 141#endif
142 142
143#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
144 .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
145 *(.appended_dtb)
146 KEEP(*(.appended_dtb))
147 }
148#endif
149
143#ifdef CONFIG_RELOCATABLE 150#ifdef CONFIG_RELOCATABLE
144 . = ALIGN(4); 151 . = ALIGN(4);
145 152
@@ -164,11 +171,6 @@ SECTIONS
164 __appended_dtb = .; 171 __appended_dtb = .;
165 /* leave space for appended DTB */ 172 /* leave space for appended DTB */
166 . += 0x100000; 173 . += 0x100000;
167#elif defined(CONFIG_MIPS_ELF_APPENDED_DTB)
168 .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
169 *(.appended_dtb)
170 KEEP(*(.appended_dtb))
171 }
172#endif 174#endif
173 /* 175 /*
174 * Align to 64K in attempt to eliminate holes before the 176 * Align to 64K in attempt to eliminate holes before the
diff --git a/arch/mips/loongson64/lemote-2f/irq.c b/arch/mips/loongson64/lemote-2f/irq.c
index 9e33e45aa17c..b213cecb8e3a 100644
--- a/arch/mips/loongson64/lemote-2f/irq.c
+++ b/arch/mips/loongson64/lemote-2f/irq.c
@@ -103,7 +103,7 @@ static struct irqaction ip6_irqaction = {
103static struct irqaction cascade_irqaction = { 103static struct irqaction cascade_irqaction = {
104 .handler = no_action, 104 .handler = no_action,
105 .name = "cascade", 105 .name = "cascade",
106 .flags = IRQF_NO_THREAD, 106 .flags = IRQF_NO_THREAD | IRQF_NO_SUSPEND,
107}; 107};
108 108
109void __init mach_init_irq(void) 109void __init mach_init_irq(void)
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index d34ad1657d7b..598cdcdd1355 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -352,7 +352,7 @@ static inline bool strict_kernel_rwx_enabled(void)
352#if defined(CONFIG_SPARSEMEM_VMEMMAP) && defined(CONFIG_SPARSEMEM_EXTREME) && \ 352#if defined(CONFIG_SPARSEMEM_VMEMMAP) && defined(CONFIG_SPARSEMEM_EXTREME) && \
353 defined (CONFIG_PPC_64K_PAGES) 353 defined (CONFIG_PPC_64K_PAGES)
354#define MAX_PHYSMEM_BITS 51 354#define MAX_PHYSMEM_BITS 51
355#else 355#elif defined(CONFIG_SPARSEMEM)
356#define MAX_PHYSMEM_BITS 46 356#define MAX_PHYSMEM_BITS 46
357#endif 357#endif
358 358
diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h
index 1afe90ade595..bbc06bd72b1f 100644
--- a/arch/powerpc/include/asm/vdso_datapage.h
+++ b/arch/powerpc/include/asm/vdso_datapage.h
@@ -82,10 +82,10 @@ struct vdso_data {
82 __u32 icache_block_size; /* L1 i-cache block size */ 82 __u32 icache_block_size; /* L1 i-cache block size */
83 __u32 dcache_log_block_size; /* L1 d-cache log block size */ 83 __u32 dcache_log_block_size; /* L1 d-cache log block size */
84 __u32 icache_log_block_size; /* L1 i-cache log block size */ 84 __u32 icache_log_block_size; /* L1 i-cache log block size */
85 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 85 __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */
86 __s32 wtom_clock_nsec; 86 __s32 wtom_clock_nsec; /* Wall to monotonic clock nsec */
87 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */ 87 __s64 wtom_clock_sec; /* Wall to monotonic clock sec */
88 __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ 88 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */
89 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ 89 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
90 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 90 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
91}; 91};
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 6f1c11e0691f..7534ecff5e92 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -24,9 +24,6 @@ BEGIN_MMU_FTR_SECTION
24 li r10,0 24 li r10,0
25 mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ 25 mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */
26END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU) 26END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU)
27 lis r10, (swapper_pg_dir - PAGE_OFFSET)@h
28 ori r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l
29 mtspr SPRN_SPRG_PGDIR, r10
30 27
31BEGIN_FTR_SECTION 28BEGIN_FTR_SECTION
32 bl __init_fpu_registers 29 bl __init_fpu_registers
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index ce6a972f2584..48051c8977c5 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -855,6 +855,9 @@ __secondary_start:
855 li r3,0 855 li r3,0
856 stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ 856 stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
857#endif 857#endif
858 lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
859 ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
860 mtspr SPRN_SPRG_PGDIR, r4
858 861
859 /* enable MMU and jump to start_secondary */ 862 /* enable MMU and jump to start_secondary */
860 li r4,MSR_KERNEL 863 li r4,MSR_KERNEL
@@ -942,6 +945,9 @@ start_here:
942 li r3,0 945 li r3,0
943 stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ 946 stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
944#endif 947#endif
948 lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
949 ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
950 mtspr SPRN_SPRG_PGDIR, r4
945 951
946 /* stack */ 952 /* stack */
947 lis r1,init_thread_union@ha 953 lis r1,init_thread_union@ha
diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
index 9b8631533e02..b33bafb8fcea 100644
--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -190,29 +190,22 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, c
190 bcs = security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED); 190 bcs = security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED);
191 ccd = security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED); 191 ccd = security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED);
192 192
193 if (bcs || ccd || count_cache_flush_type != COUNT_CACHE_FLUSH_NONE) { 193 if (bcs || ccd) {
194 bool comma = false;
195 seq_buf_printf(&s, "Mitigation: "); 194 seq_buf_printf(&s, "Mitigation: ");
196 195
197 if (bcs) { 196 if (bcs)
198 seq_buf_printf(&s, "Indirect branch serialisation (kernel only)"); 197 seq_buf_printf(&s, "Indirect branch serialisation (kernel only)");
199 comma = true;
200 }
201 198
202 if (ccd) { 199 if (bcs && ccd)
203 if (comma)
204 seq_buf_printf(&s, ", ");
205 seq_buf_printf(&s, "Indirect branch cache disabled");
206 comma = true;
207 }
208
209 if (comma)
210 seq_buf_printf(&s, ", "); 200 seq_buf_printf(&s, ", ");
211 201
212 seq_buf_printf(&s, "Software count cache flush"); 202 if (ccd)
203 seq_buf_printf(&s, "Indirect branch cache disabled");
204 } else if (count_cache_flush_type != COUNT_CACHE_FLUSH_NONE) {
205 seq_buf_printf(&s, "Mitigation: Software count cache flush");
213 206
214 if (count_cache_flush_type == COUNT_CACHE_FLUSH_HW) 207 if (count_cache_flush_type == COUNT_CACHE_FLUSH_HW)
215 seq_buf_printf(&s, "(hardware accelerated)"); 208 seq_buf_printf(&s, " (hardware accelerated)");
216 } else if (btb_flush_enabled) { 209 } else if (btb_flush_enabled) {
217 seq_buf_printf(&s, "Mitigation: Branch predictor state flush"); 210 seq_buf_printf(&s, "Mitigation: Branch predictor state flush");
218 } else { 211 } else {
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index a4ed9edfd5f0..1f324c28705b 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -92,7 +92,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
92 * At this point, r4,r5 contain our sec/nsec values. 92 * At this point, r4,r5 contain our sec/nsec values.
93 */ 93 */
94 94
95 lwa r6,WTOM_CLOCK_SEC(r3) 95 ld r6,WTOM_CLOCK_SEC(r3)
96 lwa r9,WTOM_CLOCK_NSEC(r3) 96 lwa r9,WTOM_CLOCK_NSEC(r3)
97 97
98 /* We now have our result in r6,r9. We create a fake dependency 98 /* We now have our result in r6,r9. We create a fake dependency
@@ -125,7 +125,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
125 bne cr6,75f 125 bne cr6,75f
126 126
127 /* CLOCK_MONOTONIC_COARSE */ 127 /* CLOCK_MONOTONIC_COARSE */
128 lwa r6,WTOM_CLOCK_SEC(r3) 128 ld r6,WTOM_CLOCK_SEC(r3)
129 lwa r9,WTOM_CLOCK_NSEC(r3) 129 lwa r9,WTOM_CLOCK_NSEC(r3)
130 130
131 /* check if counter has updated */ 131 /* check if counter has updated */
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index 1f13494efb2b..a6c491f18a04 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -70,12 +70,12 @@ _GLOBAL(hash_page)
70 lis r0,KERNELBASE@h /* check if kernel address */ 70 lis r0,KERNELBASE@h /* check if kernel address */
71 cmplw 0,r4,r0 71 cmplw 0,r4,r0
72 ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ 72 ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */
73 mfspr r5, SPRN_SPRG_PGDIR /* virt page-table root */ 73 mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */
74 blt+ 112f /* assume user more likely */ 74 blt+ 112f /* assume user more likely */
75 lis r5,swapper_pg_dir@ha /* if kernel address, use */ 75 lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
76 addi r5,r5,swapper_pg_dir@l /* kernel page table */ 76 addi r5 ,r5 ,(swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
77 rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */ 77 rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */
78112: tophys(r5, r5) 78112:
79#ifndef CONFIG_PTE_64BIT 79#ifndef CONFIG_PTE_64BIT
80 rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */ 80 rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
81 lwz r8,0(r5) /* get pmd entry */ 81 lwz r8,0(r5) /* get pmd entry */
diff --git a/block/bio.c b/block/bio.c
index 71a78d9fb8b7..b64cedc7f87c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -849,20 +849,14 @@ static int __bio_iov_bvec_add_pages(struct bio *bio, struct iov_iter *iter)
849 size = bio_add_page(bio, bv->bv_page, len, 849 size = bio_add_page(bio, bv->bv_page, len,
850 bv->bv_offset + iter->iov_offset); 850 bv->bv_offset + iter->iov_offset);
851 if (size == len) { 851 if (size == len) {
852 struct page *page; 852 if (!bio_flagged(bio, BIO_NO_PAGE_REF)) {
853 int i; 853 struct page *page;
854 int i;
855
856 mp_bvec_for_each_page(page, bv, i)
857 get_page(page);
858 }
854 859
855 /*
856 * For the normal O_DIRECT case, we could skip grabbing this
857 * reference and then not have to put them again when IO
858 * completes. But this breaks some in-kernel users, like
859 * splicing to/from a loop device, where we release the pipe
860 * pages unconditionally. If we can fix that case, we can
861 * get rid of the get here and the need to call
862 * bio_release_pages() at IO completion time.
863 */
864 mp_bvec_for_each_page(page, bv, i)
865 get_page(page);
866 iov_iter_advance(iter, size); 860 iov_iter_advance(iter, size);
867 return 0; 861 return 0;
868 } 862 }
@@ -925,10 +919,12 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
925 * This takes either an iterator pointing to user memory, or one pointing to 919 * This takes either an iterator pointing to user memory, or one pointing to
926 * kernel pages (BVEC iterator). If we're adding user pages, we pin them and 920 * kernel pages (BVEC iterator). If we're adding user pages, we pin them and
927 * map them into the kernel. On IO completion, the caller should put those 921 * map them into the kernel. On IO completion, the caller should put those
928 * pages. For now, when adding kernel pages, we still grab a reference to the 922 * pages. If we're adding kernel pages, and the caller told us it's safe to
929 * page. This isn't strictly needed for the common case, but some call paths 923 * do so, we just have to add the pages to the bio directly. We don't grab an
930 * end up releasing pages from eg a pipe and we can't easily control these. 924 * extra reference to those pages (the user should already have that), and we
931 * See comment in __bio_iov_bvec_add_pages(). 925 * don't put the page on IO completion. The caller needs to check if the bio is
926 * flagged BIO_NO_PAGE_REF on IO completion. If it isn't, then pages should be
927 * released.
932 * 928 *
933 * The function tries, but does not guarantee, to pin as many pages as 929 * The function tries, but does not guarantee, to pin as many pages as
934 * fit into the bio, or are requested in *iter, whatever is smaller. If 930 * fit into the bio, or are requested in *iter, whatever is smaller. If
@@ -940,6 +936,13 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
940 const bool is_bvec = iov_iter_is_bvec(iter); 936 const bool is_bvec = iov_iter_is_bvec(iter);
941 unsigned short orig_vcnt = bio->bi_vcnt; 937 unsigned short orig_vcnt = bio->bi_vcnt;
942 938
939 /*
940 * If this is a BVEC iter, then the pages are kernel pages. Don't
941 * release them on IO completion, if the caller asked us to.
942 */
943 if (is_bvec && iov_iter_bvec_no_ref(iter))
944 bio_set_flag(bio, BIO_NO_PAGE_REF);
945
943 do { 946 do {
944 int ret; 947 int ret;
945 948
@@ -1696,7 +1699,8 @@ static void bio_dirty_fn(struct work_struct *work)
1696 next = bio->bi_private; 1699 next = bio->bi_private;
1697 1700
1698 bio_set_pages_dirty(bio); 1701 bio_set_pages_dirty(bio);
1699 bio_release_pages(bio); 1702 if (!bio_flagged(bio, BIO_NO_PAGE_REF))
1703 bio_release_pages(bio);
1700 bio_put(bio); 1704 bio_put(bio);
1701 } 1705 }
1702} 1706}
@@ -1713,7 +1717,8 @@ void bio_check_pages_dirty(struct bio *bio)
1713 goto defer; 1717 goto defer;
1714 } 1718 }
1715 1719
1716 bio_release_pages(bio); 1720 if (!bio_flagged(bio, BIO_NO_PAGE_REF))
1721 bio_release_pages(bio);
1717 bio_put(bio); 1722 bio_put(bio);
1718 return; 1723 return;
1719defer: 1724defer:
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 77f37ef8ef06..617a2b3f7582 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1736,8 +1736,8 @@ out:
1736 1736
1737/** 1737/**
1738 * blkcg_schedule_throttle - this task needs to check for throttling 1738 * blkcg_schedule_throttle - this task needs to check for throttling
1739 * @q - the request queue IO was submitted on 1739 * @q: the request queue IO was submitted on
1740 * @use_memdelay - do we charge this to memory delay for PSI 1740 * @use_memdelay: do we charge this to memory delay for PSI
1741 * 1741 *
1742 * This is called by the IO controller when we know there's delay accumulated 1742 * This is called by the IO controller when we know there's delay accumulated
1743 * for the blkg for this task. We do not pass the blkg because there are places 1743 * for the blkg for this task. We do not pass the blkg because there are places
@@ -1769,8 +1769,9 @@ void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay)
1769 1769
1770/** 1770/**
1771 * blkcg_add_delay - add delay to this blkg 1771 * blkcg_add_delay - add delay to this blkg
1772 * @now - the current time in nanoseconds 1772 * @blkg: blkg of interest
1773 * @delta - how many nanoseconds of delay to add 1773 * @now: the current time in nanoseconds
1774 * @delta: how many nanoseconds of delay to add
1774 * 1775 *
1775 * Charge @delta to the blkg's current delay accumulation. This is used to 1776 * Charge @delta to the blkg's current delay accumulation. This is used to
1776 * throttle tasks if an IO controller thinks we need more throttling. 1777 * throttle tasks if an IO controller thinks we need more throttling.
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 2620baa1f699..507212d75ee2 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -75,6 +75,7 @@
75#include <linux/blk-mq.h> 75#include <linux/blk-mq.h>
76#include "blk-rq-qos.h" 76#include "blk-rq-qos.h"
77#include "blk-stat.h" 77#include "blk-stat.h"
78#include "blk.h"
78 79
79#define DEFAULT_SCALE_COOKIE 1000000U 80#define DEFAULT_SCALE_COOKIE 1000000U
80 81
diff --git a/block/blk-mq.c b/block/blk-mq.c
index a9c181603cbd..70b210a308c4 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -782,7 +782,6 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
782 if (kick_requeue_list) 782 if (kick_requeue_list)
783 blk_mq_kick_requeue_list(q); 783 blk_mq_kick_requeue_list(q);
784} 784}
785EXPORT_SYMBOL(blk_mq_add_to_requeue_list);
786 785
787void blk_mq_kick_requeue_list(struct request_queue *q) 786void blk_mq_kick_requeue_list(struct request_queue *q)
788{ 787{
@@ -1093,8 +1092,7 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx,
1093 bool ret; 1092 bool ret;
1094 1093
1095 if (!(hctx->flags & BLK_MQ_F_TAG_SHARED)) { 1094 if (!(hctx->flags & BLK_MQ_F_TAG_SHARED)) {
1096 if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) 1095 blk_mq_sched_mark_restart_hctx(hctx);
1097 set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
1098 1096
1099 /* 1097 /*
1100 * It's possible that a tag was freed in the window between the 1098 * It's possible that a tag was freed in the window between the
@@ -2857,7 +2855,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
2857 /* 2855 /*
2858 * Default to classic polling 2856 * Default to classic polling
2859 */ 2857 */
2860 q->poll_nsec = -1; 2858 q->poll_nsec = BLK_MQ_POLL_CLASSIC;
2861 2859
2862 blk_mq_init_cpu_queues(q, set->nr_hw_queues); 2860 blk_mq_init_cpu_queues(q, set->nr_hw_queues);
2863 blk_mq_add_queue_tag_set(set, q); 2861 blk_mq_add_queue_tag_set(set, q);
@@ -3392,7 +3390,7 @@ static bool blk_mq_poll_hybrid(struct request_queue *q,
3392{ 3390{
3393 struct request *rq; 3391 struct request *rq;
3394 3392
3395 if (q->poll_nsec == -1) 3393 if (q->poll_nsec == BLK_MQ_POLL_CLASSIC)
3396 return false; 3394 return false;
3397 3395
3398 if (!blk_qc_t_is_internal(cookie)) 3396 if (!blk_qc_t_is_internal(cookie))
diff --git a/block/blk-mq.h b/block/blk-mq.h
index c11353a3749d..0ed8e5a8729f 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -41,6 +41,8 @@ void blk_mq_free_queue(struct request_queue *q);
41int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); 41int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr);
42void blk_mq_wake_waiters(struct request_queue *q); 42void blk_mq_wake_waiters(struct request_queue *q);
43bool blk_mq_dispatch_rq_list(struct request_queue *, struct list_head *, bool); 43bool blk_mq_dispatch_rq_list(struct request_queue *, struct list_head *, bool);
44void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
45 bool kick_requeue_list);
44void blk_mq_flush_busy_ctxs(struct blk_mq_hw_ctx *hctx, struct list_head *list); 46void blk_mq_flush_busy_ctxs(struct blk_mq_hw_ctx *hctx, struct list_head *list);
45bool blk_mq_get_driver_tag(struct request *rq); 47bool blk_mq_get_driver_tag(struct request *rq);
46struct request *blk_mq_dequeue_from_ctx(struct blk_mq_hw_ctx *hctx, 48struct request *blk_mq_dequeue_from_ctx(struct blk_mq_hw_ctx *hctx,
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 59685918167e..422327089e0f 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -360,8 +360,8 @@ static ssize_t queue_poll_delay_show(struct request_queue *q, char *page)
360{ 360{
361 int val; 361 int val;
362 362
363 if (q->poll_nsec == -1) 363 if (q->poll_nsec == BLK_MQ_POLL_CLASSIC)
364 val = -1; 364 val = BLK_MQ_POLL_CLASSIC;
365 else 365 else
366 val = q->poll_nsec / 1000; 366 val = q->poll_nsec / 1000;
367 367
@@ -380,10 +380,12 @@ static ssize_t queue_poll_delay_store(struct request_queue *q, const char *page,
380 if (err < 0) 380 if (err < 0)
381 return err; 381 return err;
382 382
383 if (val == -1) 383 if (val == BLK_MQ_POLL_CLASSIC)
384 q->poll_nsec = -1; 384 q->poll_nsec = BLK_MQ_POLL_CLASSIC;
385 else 385 else if (val >= 0)
386 q->poll_nsec = val * 1000; 386 q->poll_nsec = val * 1000;
387 else
388 return -EINVAL;
387 389
388 return count; 390 return count;
389} 391}
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 78db97687f26..c4b06cc075f9 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -800,6 +800,7 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
800 match.hrv = hrv; 800 match.hrv = hrv;
801 801
802 dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); 802 dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
803 put_device(dev);
803 return !!dev; 804 return !!dev;
804} 805}
805EXPORT_SYMBOL(acpi_dev_present); 806EXPORT_SYMBOL(acpi_dev_present);
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index 57410f9c5d44..c52c738e554a 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -164,9 +164,7 @@ config ARM_CHARLCD
164 line and the Linux version on the second line, but that's 164 line and the Linux version on the second line, but that's
165 still useful. 165 still useful.
166 166
167endif # AUXDISPLAY 167menuconfig PARPORT_PANEL
168
169menuconfig PANEL
170 tristate "Parallel port LCD/Keypad Panel support" 168 tristate "Parallel port LCD/Keypad Panel support"
171 depends on PARPORT 169 depends on PARPORT
172 select CHARLCD 170 select CHARLCD
@@ -178,7 +176,7 @@ menuconfig PANEL
178 compiled as a module, or linked into the kernel and started at boot. 176 compiled as a module, or linked into the kernel and started at boot.
179 If you don't understand what all this is about, say N. 177 If you don't understand what all this is about, say N.
180 178
181if PANEL 179if PARPORT_PANEL
182 180
183config PANEL_PARPORT 181config PANEL_PARPORT
184 int "Default parallel port number (0=LPT1)" 182 int "Default parallel port number (0=LPT1)"
@@ -419,8 +417,11 @@ config PANEL_LCD_PIN_BL
419 417
420 Default for the 'BL' pin in custom profile is '0' (uncontrolled). 418 Default for the 'BL' pin in custom profile is '0' (uncontrolled).
421 419
420endif # PARPORT_PANEL
421
422config PANEL_CHANGE_MESSAGE 422config PANEL_CHANGE_MESSAGE
423 bool "Change LCD initialization message ?" 423 bool "Change LCD initialization message ?"
424 depends on CHARLCD
424 default "n" 425 default "n"
425 ---help--- 426 ---help---
426 This allows you to replace the boot message indicating the kernel version 427 This allows you to replace the boot message indicating the kernel version
@@ -444,7 +445,34 @@ config PANEL_BOOT_MESSAGE
444 An empty message will only clear the display at driver init time. Any other 445 An empty message will only clear the display at driver init time. Any other
445 printf()-formatted message is valid with newline and escape codes. 446 printf()-formatted message is valid with newline and escape codes.
446 447
447endif # PANEL 448choice
449 prompt "Backlight initial state"
450 default CHARLCD_BL_FLASH
451
452 config CHARLCD_BL_OFF
453 bool "Off"
454 help
455 Backlight is initially turned off
456
457 config CHARLCD_BL_ON
458 bool "On"
459 help
460 Backlight is initially turned on
461
462 config CHARLCD_BL_FLASH
463 bool "Flash"
464 help
465 Backlight is flashed briefly on init
466
467endchoice
468
469endif # AUXDISPLAY
470
471config PANEL
472 tristate "Parallel port LCD/Keypad Panel support (OLD OPTION)"
473 depends on PARPORT
474 select AUXDISPLAY
475 select PARPORT_PANEL
448 476
449config CHARLCD 477config CHARLCD
450 tristate "Character LCD core support" if COMPILE_TEST 478 tristate "Character LCD core support" if COMPILE_TEST
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 7ac6776ca3f6..cf54b5efb07e 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -10,4 +10,4 @@ obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o
10obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o 10obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o
11obj-$(CONFIG_HD44780) += hd44780.o 11obj-$(CONFIG_HD44780) += hd44780.o
12obj-$(CONFIG_HT16K33) += ht16k33.o 12obj-$(CONFIG_HT16K33) += ht16k33.o
13obj-$(CONFIG_PANEL) += panel.o 13obj-$(CONFIG_PARPORT_PANEL) += panel.o
diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 60e0b772673f..92745efefb54 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -91,7 +91,7 @@ struct charlcd_priv {
91 unsigned long long drvdata[0]; 91 unsigned long long drvdata[0];
92}; 92};
93 93
94#define to_priv(p) container_of(p, struct charlcd_priv, lcd) 94#define charlcd_to_priv(p) container_of(p, struct charlcd_priv, lcd)
95 95
96/* Device single-open policy control */ 96/* Device single-open policy control */
97static atomic_t charlcd_available = ATOMIC_INIT(1); 97static atomic_t charlcd_available = ATOMIC_INIT(1);
@@ -105,7 +105,7 @@ static void long_sleep(int ms)
105/* turn the backlight on or off */ 105/* turn the backlight on or off */
106static void charlcd_backlight(struct charlcd *lcd, int on) 106static void charlcd_backlight(struct charlcd *lcd, int on)
107{ 107{
108 struct charlcd_priv *priv = to_priv(lcd); 108 struct charlcd_priv *priv = charlcd_to_priv(lcd);
109 109
110 if (!lcd->ops->backlight) 110 if (!lcd->ops->backlight)
111 return; 111 return;
@@ -134,7 +134,7 @@ static void charlcd_bl_off(struct work_struct *work)
134/* turn the backlight on for a little while */ 134/* turn the backlight on for a little while */
135void charlcd_poke(struct charlcd *lcd) 135void charlcd_poke(struct charlcd *lcd)
136{ 136{
137 struct charlcd_priv *priv = to_priv(lcd); 137 struct charlcd_priv *priv = charlcd_to_priv(lcd);
138 138
139 if (!lcd->ops->backlight) 139 if (!lcd->ops->backlight)
140 return; 140 return;
@@ -152,7 +152,7 @@ EXPORT_SYMBOL_GPL(charlcd_poke);
152 152
153static void charlcd_gotoxy(struct charlcd *lcd) 153static void charlcd_gotoxy(struct charlcd *lcd)
154{ 154{
155 struct charlcd_priv *priv = to_priv(lcd); 155 struct charlcd_priv *priv = charlcd_to_priv(lcd);
156 unsigned int addr; 156 unsigned int addr;
157 157
158 /* 158 /*
@@ -170,7 +170,7 @@ static void charlcd_gotoxy(struct charlcd *lcd)
170 170
171static void charlcd_home(struct charlcd *lcd) 171static void charlcd_home(struct charlcd *lcd)
172{ 172{
173 struct charlcd_priv *priv = to_priv(lcd); 173 struct charlcd_priv *priv = charlcd_to_priv(lcd);
174 174
175 priv->addr.x = 0; 175 priv->addr.x = 0;
176 priv->addr.y = 0; 176 priv->addr.y = 0;
@@ -179,7 +179,7 @@ static void charlcd_home(struct charlcd *lcd)
179 179
180static void charlcd_print(struct charlcd *lcd, char c) 180static void charlcd_print(struct charlcd *lcd, char c)
181{ 181{
182 struct charlcd_priv *priv = to_priv(lcd); 182 struct charlcd_priv *priv = charlcd_to_priv(lcd);
183 183
184 if (priv->addr.x < lcd->bwidth) { 184 if (priv->addr.x < lcd->bwidth) {
185 if (lcd->char_conv) 185 if (lcd->char_conv)
@@ -211,7 +211,7 @@ static void charlcd_clear_fast(struct charlcd *lcd)
211/* clears the display and resets X/Y */ 211/* clears the display and resets X/Y */
212static void charlcd_clear_display(struct charlcd *lcd) 212static void charlcd_clear_display(struct charlcd *lcd)
213{ 213{
214 struct charlcd_priv *priv = to_priv(lcd); 214 struct charlcd_priv *priv = charlcd_to_priv(lcd);
215 215
216 lcd->ops->write_cmd(lcd, LCD_CMD_DISPLAY_CLEAR); 216 lcd->ops->write_cmd(lcd, LCD_CMD_DISPLAY_CLEAR);
217 priv->addr.x = 0; 217 priv->addr.x = 0;
@@ -223,7 +223,7 @@ static void charlcd_clear_display(struct charlcd *lcd)
223static int charlcd_init_display(struct charlcd *lcd) 223static int charlcd_init_display(struct charlcd *lcd)
224{ 224{
225 void (*write_cmd_raw)(struct charlcd *lcd, int cmd); 225 void (*write_cmd_raw)(struct charlcd *lcd, int cmd);
226 struct charlcd_priv *priv = to_priv(lcd); 226 struct charlcd_priv *priv = charlcd_to_priv(lcd);
227 u8 init; 227 u8 init;
228 228
229 if (lcd->ifwidth != 4 && lcd->ifwidth != 8) 229 if (lcd->ifwidth != 4 && lcd->ifwidth != 8)
@@ -369,7 +369,7 @@ static bool parse_xy(const char *s, unsigned long *x, unsigned long *y)
369 369
370static inline int handle_lcd_special_code(struct charlcd *lcd) 370static inline int handle_lcd_special_code(struct charlcd *lcd)
371{ 371{
372 struct charlcd_priv *priv = to_priv(lcd); 372 struct charlcd_priv *priv = charlcd_to_priv(lcd);
373 373
374 /* LCD special codes */ 374 /* LCD special codes */
375 375
@@ -580,7 +580,7 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
580 580
581static void charlcd_write_char(struct charlcd *lcd, char c) 581static void charlcd_write_char(struct charlcd *lcd, char c)
582{ 582{
583 struct charlcd_priv *priv = to_priv(lcd); 583 struct charlcd_priv *priv = charlcd_to_priv(lcd);
584 584
585 /* first, we'll test if we're in escape mode */ 585 /* first, we'll test if we're in escape mode */
586 if ((c != '\n') && priv->esc_seq.len >= 0) { 586 if ((c != '\n') && priv->esc_seq.len >= 0) {
@@ -705,7 +705,7 @@ static ssize_t charlcd_write(struct file *file, const char __user *buf,
705 705
706static int charlcd_open(struct inode *inode, struct file *file) 706static int charlcd_open(struct inode *inode, struct file *file)
707{ 707{
708 struct charlcd_priv *priv = to_priv(the_charlcd); 708 struct charlcd_priv *priv = charlcd_to_priv(the_charlcd);
709 int ret; 709 int ret;
710 710
711 ret = -EBUSY; 711 ret = -EBUSY;
@@ -763,10 +763,24 @@ static void charlcd_puts(struct charlcd *lcd, const char *s)
763 } 763 }
764} 764}
765 765
766#ifdef CONFIG_PANEL_BOOT_MESSAGE
767#define LCD_INIT_TEXT CONFIG_PANEL_BOOT_MESSAGE
768#else
769#define LCD_INIT_TEXT "Linux-" UTS_RELEASE "\n"
770#endif
771
772#ifdef CONFIG_CHARLCD_BL_ON
773#define LCD_INIT_BL "\x1b[L+"
774#elif defined(CONFIG_CHARLCD_BL_FLASH)
775#define LCD_INIT_BL "\x1b[L*"
776#else
777#define LCD_INIT_BL "\x1b[L-"
778#endif
779
766/* initialize the LCD driver */ 780/* initialize the LCD driver */
767static int charlcd_init(struct charlcd *lcd) 781static int charlcd_init(struct charlcd *lcd)
768{ 782{
769 struct charlcd_priv *priv = to_priv(lcd); 783 struct charlcd_priv *priv = charlcd_to_priv(lcd);
770 int ret; 784 int ret;
771 785
772 if (lcd->ops->backlight) { 786 if (lcd->ops->backlight) {
@@ -784,13 +798,8 @@ static int charlcd_init(struct charlcd *lcd)
784 return ret; 798 return ret;
785 799
786 /* display a short message */ 800 /* display a short message */
787#ifdef CONFIG_PANEL_CHANGE_MESSAGE 801 charlcd_puts(lcd, "\x1b[Lc\x1b[Lb" LCD_INIT_BL LCD_INIT_TEXT);
788#ifdef CONFIG_PANEL_BOOT_MESSAGE 802
789 charlcd_puts(lcd, "\x1b[Lc\x1b[Lb\x1b[L*" CONFIG_PANEL_BOOT_MESSAGE);
790#endif
791#else
792 charlcd_puts(lcd, "\x1b[Lc\x1b[Lb\x1b[L*Linux-" UTS_RELEASE "\n");
793#endif
794 /* clear the display on the next device opening */ 803 /* clear the display on the next device opening */
795 priv->must_clear = true; 804 priv->must_clear = true;
796 charlcd_home(lcd); 805 charlcd_home(lcd);
@@ -818,6 +827,12 @@ struct charlcd *charlcd_alloc(unsigned int drvdata_size)
818} 827}
819EXPORT_SYMBOL_GPL(charlcd_alloc); 828EXPORT_SYMBOL_GPL(charlcd_alloc);
820 829
830void charlcd_free(struct charlcd *lcd)
831{
832 kfree(charlcd_to_priv(lcd));
833}
834EXPORT_SYMBOL_GPL(charlcd_free);
835
821static int panel_notify_sys(struct notifier_block *this, unsigned long code, 836static int panel_notify_sys(struct notifier_block *this, unsigned long code,
822 void *unused) 837 void *unused)
823{ 838{
@@ -866,7 +881,7 @@ EXPORT_SYMBOL_GPL(charlcd_register);
866 881
867int charlcd_unregister(struct charlcd *lcd) 882int charlcd_unregister(struct charlcd *lcd)
868{ 883{
869 struct charlcd_priv *priv = to_priv(lcd); 884 struct charlcd_priv *priv = charlcd_to_priv(lcd);
870 885
871 unregister_reboot_notifier(&panel_notifier); 886 unregister_reboot_notifier(&panel_notifier);
872 charlcd_puts(lcd, "\x0cLCD driver unloaded.\x1b[Lc\x1b[Lb\x1b[L-"); 887 charlcd_puts(lcd, "\x0cLCD driver unloaded.\x1b[Lc\x1b[Lb\x1b[L-");
diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c
index 9ad93ea42fdc..ab15b64707ad 100644
--- a/drivers/auxdisplay/hd44780.c
+++ b/drivers/auxdisplay/hd44780.c
@@ -271,7 +271,7 @@ static int hd44780_probe(struct platform_device *pdev)
271 return 0; 271 return 0;
272 272
273fail: 273fail:
274 kfree(lcd); 274 charlcd_free(lcd);
275 return ret; 275 return ret;
276} 276}
277 277
@@ -280,6 +280,8 @@ static int hd44780_remove(struct platform_device *pdev)
280 struct charlcd *lcd = platform_get_drvdata(pdev); 280 struct charlcd *lcd = platform_get_drvdata(pdev);
281 281
282 charlcd_unregister(lcd); 282 charlcd_unregister(lcd);
283
284 charlcd_free(lcd);
283 return 0; 285 return 0;
284} 286}
285 287
diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
index 21b9b2f2470a..e06de63497cf 100644
--- a/drivers/auxdisplay/panel.c
+++ b/drivers/auxdisplay/panel.c
@@ -1620,7 +1620,7 @@ err_lcd_unreg:
1620 if (lcd.enabled) 1620 if (lcd.enabled)
1621 charlcd_unregister(lcd.charlcd); 1621 charlcd_unregister(lcd.charlcd);
1622err_unreg_device: 1622err_unreg_device:
1623 kfree(lcd.charlcd); 1623 charlcd_free(lcd.charlcd);
1624 lcd.charlcd = NULL; 1624 lcd.charlcd = NULL;
1625 parport_unregister_device(pprt); 1625 parport_unregister_device(pprt);
1626 pprt = NULL; 1626 pprt = NULL;
@@ -1647,7 +1647,7 @@ static void panel_detach(struct parport *port)
1647 if (lcd.enabled) { 1647 if (lcd.enabled) {
1648 charlcd_unregister(lcd.charlcd); 1648 charlcd_unregister(lcd.charlcd);
1649 lcd.initialized = false; 1649 lcd.initialized = false;
1650 kfree(lcd.charlcd); 1650 charlcd_free(lcd.charlcd);
1651 lcd.charlcd = NULL; 1651 lcd.charlcd = NULL;
1652 } 1652 }
1653 1653
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 76c9969b7124..96a6dc9d305c 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1469,12 +1469,12 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
1469 if (IS_ERR(gpd_data)) 1469 if (IS_ERR(gpd_data))
1470 return PTR_ERR(gpd_data); 1470 return PTR_ERR(gpd_data);
1471 1471
1472 genpd_lock(genpd);
1473
1474 ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0; 1472 ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0;
1475 if (ret) 1473 if (ret)
1476 goto out; 1474 goto out;
1477 1475
1476 genpd_lock(genpd);
1477
1478 dev_pm_domain_set(dev, &genpd->domain); 1478 dev_pm_domain_set(dev, &genpd->domain);
1479 1479
1480 genpd->device_count++; 1480 genpd->device_count++;
@@ -1482,9 +1482,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
1482 1482
1483 list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); 1483 list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
1484 1484
1485 out:
1486 genpd_unlock(genpd); 1485 genpd_unlock(genpd);
1487 1486 out:
1488 if (ret) 1487 if (ret)
1489 genpd_free_dev_data(dev, gpd_data); 1488 genpd_free_dev_data(dev, gpd_data);
1490 else 1489 else
@@ -1533,15 +1532,15 @@ static int genpd_remove_device(struct generic_pm_domain *genpd,
1533 genpd->device_count--; 1532 genpd->device_count--;
1534 genpd->max_off_time_changed = true; 1533 genpd->max_off_time_changed = true;
1535 1534
1536 if (genpd->detach_dev)
1537 genpd->detach_dev(genpd, dev);
1538
1539 dev_pm_domain_set(dev, NULL); 1535 dev_pm_domain_set(dev, NULL);
1540 1536
1541 list_del_init(&pdd->list_node); 1537 list_del_init(&pdd->list_node);
1542 1538
1543 genpd_unlock(genpd); 1539 genpd_unlock(genpd);
1544 1540
1541 if (genpd->detach_dev)
1542 genpd->detach_dev(genpd, dev);
1543
1545 genpd_free_dev_data(dev, gpd_data); 1544 genpd_free_dev_data(dev, gpd_data);
1546 1545
1547 return 0; 1546 return 0;
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index 1fad9291f6aa..7fc5a18e02ad 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -472,7 +472,7 @@ static int software_node_read_string_array(const struct fwnode_handle *fwnode,
472 val, nval); 472 val, nval);
473} 473}
474 474
475struct fwnode_handle * 475static struct fwnode_handle *
476software_node_get_parent(const struct fwnode_handle *fwnode) 476software_node_get_parent(const struct fwnode_handle *fwnode)
477{ 477{
478 struct software_node *swnode = to_software_node(fwnode); 478 struct software_node *swnode = to_software_node(fwnode);
@@ -481,7 +481,7 @@ software_node_get_parent(const struct fwnode_handle *fwnode)
481 NULL; 481 NULL;
482} 482}
483 483
484struct fwnode_handle * 484static struct fwnode_handle *
485software_node_get_next_child(const struct fwnode_handle *fwnode, 485software_node_get_next_child(const struct fwnode_handle *fwnode,
486 struct fwnode_handle *child) 486 struct fwnode_handle *child)
487{ 487{
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 1e6edd568214..bf1c61cab8eb 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -656,7 +656,7 @@ static int loop_validate_file(struct file *file, struct block_device *bdev)
656 return -EBADF; 656 return -EBADF;
657 657
658 l = f->f_mapping->host->i_bdev->bd_disk->private_data; 658 l = f->f_mapping->host->i_bdev->bd_disk->private_data;
659 if (l->lo_state == Lo_unbound) { 659 if (l->lo_state != Lo_bound) {
660 return -EINVAL; 660 return -EINVAL;
661 } 661 }
662 f = l->lo_backing_file; 662 f = l->lo_backing_file;
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 96670eefaeb2..377a694dc228 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -749,8 +749,12 @@ static int pcd_detect(void)
749 return 0; 749 return 0;
750 750
751 printk("%s: No CD-ROM drive found\n", name); 751 printk("%s: No CD-ROM drive found\n", name);
752 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) 752 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
753 blk_cleanup_queue(cd->disk->queue);
754 cd->disk->queue = NULL;
755 blk_mq_free_tag_set(&cd->tag_set);
753 put_disk(cd->disk); 756 put_disk(cd->disk);
757 }
754 pi_unregister_driver(par_drv); 758 pi_unregister_driver(par_drv);
755 return -1; 759 return -1;
756} 760}
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index e92e7a8eeeb2..103b617cdc31 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -761,8 +761,12 @@ static int pf_detect(void)
761 return 0; 761 return 0;
762 762
763 printk("%s: No ATAPI disk detected\n", name); 763 printk("%s: No ATAPI disk detected\n", name);
764 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) 764 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
765 blk_cleanup_queue(pf->disk->queue);
766 pf->disk->queue = NULL;
767 blk_mq_free_tag_set(&pf->tag_set);
765 put_disk(pf->disk); 768 put_disk(pf->disk);
769 }
766 pi_unregister_driver(par_drv); 770 pi_unregister_driver(par_drv);
767 return -1; 771 return -1;
768} 772}
@@ -1047,13 +1051,15 @@ static void __exit pf_exit(void)
1047 int unit; 1051 int unit;
1048 unregister_blkdev(major, name); 1052 unregister_blkdev(major, name);
1049 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { 1053 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
1050 if (!pf->present) 1054 if (pf->present)
1051 continue; 1055 del_gendisk(pf->disk);
1052 del_gendisk(pf->disk); 1056
1053 blk_cleanup_queue(pf->disk->queue); 1057 blk_cleanup_queue(pf->disk->queue);
1054 blk_mq_free_tag_set(&pf->tag_set); 1058 blk_mq_free_tag_set(&pf->tag_set);
1055 put_disk(pf->disk); 1059 put_disk(pf->disk);
1056 pi_release(pf->pi); 1060
1061 if (pf->present)
1062 pi_release(pf->pi);
1057 } 1063 }
1058} 1064}
1059 1065
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4ba967d65cf9..2210c1b9491b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -833,7 +833,7 @@ static int parse_rbd_opts_token(char *c, void *private)
833 pctx->opts->queue_depth = intval; 833 pctx->opts->queue_depth = intval;
834 break; 834 break;
835 case Opt_alloc_size: 835 case Opt_alloc_size:
836 if (intval < 1) { 836 if (intval < SECTOR_SIZE) {
837 pr_err("alloc_size out of range\n"); 837 pr_err("alloc_size out of range\n");
838 return -EINVAL; 838 return -EINVAL;
839 } 839 }
@@ -924,23 +924,6 @@ static void rbd_put_client(struct rbd_client *rbdc)
924 kref_put(&rbdc->kref, rbd_client_release); 924 kref_put(&rbdc->kref, rbd_client_release);
925} 925}
926 926
927static int wait_for_latest_osdmap(struct ceph_client *client)
928{
929 u64 newest_epoch;
930 int ret;
931
932 ret = ceph_monc_get_version(&client->monc, "osdmap", &newest_epoch);
933 if (ret)
934 return ret;
935
936 if (client->osdc.osdmap->epoch >= newest_epoch)
937 return 0;
938
939 ceph_osdc_maybe_request_map(&client->osdc);
940 return ceph_monc_wait_osdmap(&client->monc, newest_epoch,
941 client->options->mount_timeout);
942}
943
944/* 927/*
945 * Get a ceph client with specific addr and configuration, if one does 928 * Get a ceph client with specific addr and configuration, if one does
946 * not exist create it. Either way, ceph_opts is consumed by this 929 * not exist create it. Either way, ceph_opts is consumed by this
@@ -960,7 +943,8 @@ static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts)
960 * Using an existing client. Make sure ->pg_pools is up to 943 * Using an existing client. Make sure ->pg_pools is up to
961 * date before we look up the pool id in do_rbd_add(). 944 * date before we look up the pool id in do_rbd_add().
962 */ 945 */
963 ret = wait_for_latest_osdmap(rbdc->client); 946 ret = ceph_wait_for_latest_osdmap(rbdc->client,
947 rbdc->client->options->mount_timeout);
964 if (ret) { 948 if (ret) {
965 rbd_warn(NULL, "failed to get latest osdmap: %d", ret); 949 rbd_warn(NULL, "failed to get latest osdmap: %d", ret);
966 rbd_put_client(rbdc); 950 rbd_put_client(rbdc);
@@ -4203,12 +4187,12 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
4203 q->limits.max_sectors = queue_max_hw_sectors(q); 4187 q->limits.max_sectors = queue_max_hw_sectors(q);
4204 blk_queue_max_segments(q, USHRT_MAX); 4188 blk_queue_max_segments(q, USHRT_MAX);
4205 blk_queue_max_segment_size(q, UINT_MAX); 4189 blk_queue_max_segment_size(q, UINT_MAX);
4206 blk_queue_io_min(q, objset_bytes); 4190 blk_queue_io_min(q, rbd_dev->opts->alloc_size);
4207 blk_queue_io_opt(q, objset_bytes); 4191 blk_queue_io_opt(q, rbd_dev->opts->alloc_size);
4208 4192
4209 if (rbd_dev->opts->trim) { 4193 if (rbd_dev->opts->trim) {
4210 blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); 4194 blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
4211 q->limits.discard_granularity = objset_bytes; 4195 q->limits.discard_granularity = rbd_dev->opts->alloc_size;
4212 blk_queue_max_discard_sectors(q, objset_bytes >> SECTOR_SHIFT); 4196 blk_queue_max_discard_sectors(q, objset_bytes >> SECTOR_SHIFT);
4213 blk_queue_max_write_zeroes_sectors(q, objset_bytes >> SECTOR_SHIFT); 4197 blk_queue_max_write_zeroes_sectors(q, objset_bytes >> SECTOR_SHIFT);
4214 } 4198 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index bfa9062ce6b9..16fcb56c232b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -700,6 +700,8 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
700 struct amdgpu_vm_bo_base *bo_base, *tmp; 700 struct amdgpu_vm_bo_base *bo_base, *tmp;
701 int r = 0; 701 int r = 0;
702 702
703 vm->bulk_moveable &= list_empty(&vm->evicted);
704
703 list_for_each_entry_safe(bo_base, tmp, &vm->evicted, vm_status) { 705 list_for_each_entry_safe(bo_base, tmp, &vm->evicted, vm_status) {
704 struct amdgpu_bo *bo = bo_base->bo; 706 struct amdgpu_bo *bo = bo_base->bo;
705 707
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 600259b4e291..2fe8397241ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -742,7 +742,7 @@ static int gmc_v9_0_allocate_vm_inv_eng(struct amdgpu_device *adev)
742 } 742 }
743 743
744 ring->vm_inv_eng = inv_eng - 1; 744 ring->vm_inv_eng = inv_eng - 1;
745 change_bit(inv_eng - 1, (unsigned long *)(&vm_inv_engs[vmhub])); 745 vm_inv_engs[vmhub] &= ~(1 << ring->vm_inv_eng);
746 746
747 dev_info(adev->dev, "ring %s uses VM inv eng %u on hub %u\n", 747 dev_info(adev->dev, "ring %s uses VM inv eng %u on hub %u\n",
748 ring->name, ring->vm_inv_eng, ring->funcs->vmhub); 748 ring->name, ring->vm_inv_eng, ring->funcs->vmhub);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 0573eab0e190..f35e4ab55b27 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -20,6 +20,7 @@
20#include "regs-vp.h" 20#include "regs-vp.h"
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/ktime.h>
23#include <linux/spinlock.h> 24#include <linux/spinlock.h>
24#include <linux/wait.h> 25#include <linux/wait.h>
25#include <linux/i2c.h> 26#include <linux/i2c.h>
@@ -352,15 +353,62 @@ static void mixer_cfg_vp_blend(struct mixer_context *ctx, unsigned int alpha)
352 mixer_reg_write(ctx, MXR_VIDEO_CFG, val); 353 mixer_reg_write(ctx, MXR_VIDEO_CFG, val);
353} 354}
354 355
355static void mixer_vsync_set_update(struct mixer_context *ctx, bool enable) 356static bool mixer_is_synced(struct mixer_context *ctx)
356{ 357{
357 /* block update on vsync */ 358 u32 base, shadow;
358 mixer_reg_writemask(ctx, MXR_STATUS, enable ?
359 MXR_STATUS_SYNC_ENABLE : 0, MXR_STATUS_SYNC_ENABLE);
360 359
360 if (ctx->mxr_ver == MXR_VER_16_0_33_0 ||
361 ctx->mxr_ver == MXR_VER_128_0_0_184)
362 return !(mixer_reg_read(ctx, MXR_CFG) &
363 MXR_CFG_LAYER_UPDATE_COUNT_MASK);
364
365 if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags) &&
366 vp_reg_read(ctx, VP_SHADOW_UPDATE))
367 return false;
368
369 base = mixer_reg_read(ctx, MXR_CFG);
370 shadow = mixer_reg_read(ctx, MXR_CFG_S);
371 if (base != shadow)
372 return false;
373
374 base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0));
375 shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0));
376 if (base != shadow)
377 return false;
378
379 base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(1));
380 shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(1));
381 if (base != shadow)
382 return false;
383
384 return true;
385}
386
387static int mixer_wait_for_sync(struct mixer_context *ctx)
388{
389 ktime_t timeout = ktime_add_us(ktime_get(), 100000);
390
391 while (!mixer_is_synced(ctx)) {
392 usleep_range(1000, 2000);
393 if (ktime_compare(ktime_get(), timeout) > 0)
394 return -ETIMEDOUT;
395 }
396 return 0;
397}
398
399static void mixer_disable_sync(struct mixer_context *ctx)
400{
401 mixer_reg_writemask(ctx, MXR_STATUS, 0, MXR_STATUS_SYNC_ENABLE);
402}
403
404static void mixer_enable_sync(struct mixer_context *ctx)
405{
406 if (ctx->mxr_ver == MXR_VER_16_0_33_0 ||
407 ctx->mxr_ver == MXR_VER_128_0_0_184)
408 mixer_reg_writemask(ctx, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
409 mixer_reg_writemask(ctx, MXR_STATUS, ~0, MXR_STATUS_SYNC_ENABLE);
361 if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags)) 410 if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags))
362 vp_reg_write(ctx, VP_SHADOW_UPDATE, enable ? 411 vp_reg_write(ctx, VP_SHADOW_UPDATE, VP_SHADOW_UPDATE_ENABLE);
363 VP_SHADOW_UPDATE_ENABLE : 0);
364} 412}
365 413
366static void mixer_cfg_scan(struct mixer_context *ctx, int width, int height) 414static void mixer_cfg_scan(struct mixer_context *ctx, int width, int height)
@@ -498,7 +546,6 @@ static void vp_video_buffer(struct mixer_context *ctx,
498 546
499 spin_lock_irqsave(&ctx->reg_slock, flags); 547 spin_lock_irqsave(&ctx->reg_slock, flags);
500 548
501 vp_reg_write(ctx, VP_SHADOW_UPDATE, 1);
502 /* interlace or progressive scan mode */ 549 /* interlace or progressive scan mode */
503 val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0); 550 val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0);
504 vp_reg_writemask(ctx, VP_MODE, val, VP_MODE_LINE_SKIP); 551 vp_reg_writemask(ctx, VP_MODE, val, VP_MODE_LINE_SKIP);
@@ -553,11 +600,6 @@ static void vp_video_buffer(struct mixer_context *ctx,
553 vp_regs_dump(ctx); 600 vp_regs_dump(ctx);
554} 601}
555 602
556static void mixer_layer_update(struct mixer_context *ctx)
557{
558 mixer_reg_writemask(ctx, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
559}
560
561static void mixer_graph_buffer(struct mixer_context *ctx, 603static void mixer_graph_buffer(struct mixer_context *ctx,
562 struct exynos_drm_plane *plane) 604 struct exynos_drm_plane *plane)
563{ 605{
@@ -640,11 +682,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
640 mixer_cfg_layer(ctx, win, priority, true); 682 mixer_cfg_layer(ctx, win, priority, true);
641 mixer_cfg_gfx_blend(ctx, win, pixel_alpha, state->base.alpha); 683 mixer_cfg_gfx_blend(ctx, win, pixel_alpha, state->base.alpha);
642 684
643 /* layer update mandatory for mixer 16.0.33.0 */
644 if (ctx->mxr_ver == MXR_VER_16_0_33_0 ||
645 ctx->mxr_ver == MXR_VER_128_0_0_184)
646 mixer_layer_update(ctx);
647
648 spin_unlock_irqrestore(&ctx->reg_slock, flags); 685 spin_unlock_irqrestore(&ctx->reg_slock, flags);
649 686
650 mixer_regs_dump(ctx); 687 mixer_regs_dump(ctx);
@@ -709,7 +746,7 @@ static void mixer_win_reset(struct mixer_context *ctx)
709static irqreturn_t mixer_irq_handler(int irq, void *arg) 746static irqreturn_t mixer_irq_handler(int irq, void *arg)
710{ 747{
711 struct mixer_context *ctx = arg; 748 struct mixer_context *ctx = arg;
712 u32 val, base, shadow; 749 u32 val;
713 750
714 spin_lock(&ctx->reg_slock); 751 spin_lock(&ctx->reg_slock);
715 752
@@ -723,26 +760,9 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)
723 val &= ~MXR_INT_STATUS_VSYNC; 760 val &= ~MXR_INT_STATUS_VSYNC;
724 761
725 /* interlace scan need to check shadow register */ 762 /* interlace scan need to check shadow register */
726 if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) { 763 if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)
727 if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags) && 764 && !mixer_is_synced(ctx))
728 vp_reg_read(ctx, VP_SHADOW_UPDATE)) 765 goto out;
729 goto out;
730
731 base = mixer_reg_read(ctx, MXR_CFG);
732 shadow = mixer_reg_read(ctx, MXR_CFG_S);
733 if (base != shadow)
734 goto out;
735
736 base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0));
737 shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0));
738 if (base != shadow)
739 goto out;
740
741 base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(1));
742 shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(1));
743 if (base != shadow)
744 goto out;
745 }
746 766
747 drm_crtc_handle_vblank(&ctx->crtc->base); 767 drm_crtc_handle_vblank(&ctx->crtc->base);
748 } 768 }
@@ -917,12 +937,14 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc)
917 937
918static void mixer_atomic_begin(struct exynos_drm_crtc *crtc) 938static void mixer_atomic_begin(struct exynos_drm_crtc *crtc)
919{ 939{
920 struct mixer_context *mixer_ctx = crtc->ctx; 940 struct mixer_context *ctx = crtc->ctx;
921 941
922 if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) 942 if (!test_bit(MXR_BIT_POWERED, &ctx->flags))
923 return; 943 return;
924 944
925 mixer_vsync_set_update(mixer_ctx, false); 945 if (mixer_wait_for_sync(ctx))
946 dev_err(ctx->dev, "timeout waiting for VSYNC\n");
947 mixer_disable_sync(ctx);
926} 948}
927 949
928static void mixer_update_plane(struct exynos_drm_crtc *crtc, 950static void mixer_update_plane(struct exynos_drm_crtc *crtc,
@@ -964,7 +986,7 @@ static void mixer_atomic_flush(struct exynos_drm_crtc *crtc)
964 if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) 986 if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags))
965 return; 987 return;
966 988
967 mixer_vsync_set_update(mixer_ctx, true); 989 mixer_enable_sync(mixer_ctx);
968 exynos_crtc_handle_event(crtc); 990 exynos_crtc_handle_event(crtc);
969} 991}
970 992
@@ -979,7 +1001,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
979 1001
980 exynos_drm_pipe_clk_enable(crtc, true); 1002 exynos_drm_pipe_clk_enable(crtc, true);
981 1003
982 mixer_vsync_set_update(ctx, false); 1004 mixer_disable_sync(ctx);
983 1005
984 mixer_reg_writemask(ctx, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET); 1006 mixer_reg_writemask(ctx, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET);
985 1007
@@ -992,7 +1014,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
992 1014
993 mixer_commit(ctx); 1015 mixer_commit(ctx);
994 1016
995 mixer_vsync_set_update(ctx, true); 1017 mixer_enable_sync(ctx);
996 1018
997 set_bit(MXR_BIT_POWERED, &ctx->flags); 1019 set_bit(MXR_BIT_POWERED, &ctx->flags);
998} 1020}
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 30d516e975c6..8558e81fdc2a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1734,8 +1734,13 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1734 * pages from. 1734 * pages from.
1735 */ 1735 */
1736 if (!obj->base.filp) { 1736 if (!obj->base.filp) {
1737 i915_gem_object_put(obj); 1737 addr = -ENXIO;
1738 return -ENXIO; 1738 goto err;
1739 }
1740
1741 if (range_overflows(args->offset, args->size, (u64)obj->base.size)) {
1742 addr = -EINVAL;
1743 goto err;
1739 } 1744 }
1740 1745
1741 addr = vm_mmap(obj->base.filp, 0, args->size, 1746 addr = vm_mmap(obj->base.filp, 0, args->size,
@@ -1749,8 +1754,8 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1749 struct vm_area_struct *vma; 1754 struct vm_area_struct *vma;
1750 1755
1751 if (down_write_killable(&mm->mmap_sem)) { 1756 if (down_write_killable(&mm->mmap_sem)) {
1752 i915_gem_object_put(obj); 1757 addr = -EINTR;
1753 return -EINTR; 1758 goto err;
1754 } 1759 }
1755 vma = find_vma(mm, addr); 1760 vma = find_vma(mm, addr);
1756 if (vma && __vma_matches(vma, obj->base.filp, addr, args->size)) 1761 if (vma && __vma_matches(vma, obj->base.filp, addr, args->size))
@@ -1768,12 +1773,10 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1768 i915_gem_object_put(obj); 1773 i915_gem_object_put(obj);
1769 1774
1770 args->addr_ptr = (u64)addr; 1775 args->addr_ptr = (u64)addr;
1771
1772 return 0; 1776 return 0;
1773 1777
1774err: 1778err:
1775 i915_gem_object_put(obj); 1779 i915_gem_object_put(obj);
1776
1777 return addr; 1780 return addr;
1778} 1781}
1779 1782
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9a65341fec09..aa6791255252 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1721,7 +1721,7 @@ error_msg(struct i915_gpu_state *error, unsigned long engines, const char *msg)
1721 i915_error_generate_code(error, engines)); 1721 i915_error_generate_code(error, engines));
1722 if (engines) { 1722 if (engines) {
1723 /* Just show the first executing process, more is confusing */ 1723 /* Just show the first executing process, more is confusing */
1724 i = ffs(engines); 1724 i = __ffs(engines);
1725 len += scnprintf(error->error_msg + len, 1725 len += scnprintf(error->error_msg + len,
1726 sizeof(error->error_msg) - len, 1726 sizeof(error->error_msg) - len,
1727 ", in %s [%d]", 1727 ", in %s [%d]",
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index b508d8a735e0..4364f42cac6b 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1673,6 +1673,7 @@ init_vbt_missing_defaults(struct drm_i915_private *dev_priv)
1673 info->supports_dvi = (port != PORT_A && port != PORT_E); 1673 info->supports_dvi = (port != PORT_A && port != PORT_E);
1674 info->supports_hdmi = info->supports_dvi; 1674 info->supports_hdmi = info->supports_dvi;
1675 info->supports_dp = (port != PORT_E); 1675 info->supports_dp = (port != PORT_E);
1676 info->supports_edp = (port == PORT_A);
1676 } 1677 }
1677} 1678}
1678 1679
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 88a52f6b39fe..7dfbbbc1beea 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -181,7 +181,7 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf,
181 } 181 }
182 182
183 ret = pm_runtime_get_sync(drm->dev); 183 ret = pm_runtime_get_sync(drm->dev);
184 if (IS_ERR_VALUE(ret) && ret != -EACCES) 184 if (ret < 0 && ret != -EACCES)
185 return ret; 185 return ret;
186 ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_USER, &args, sizeof(args)); 186 ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_USER, &args, sizeof(args));
187 pm_runtime_put_autosuspend(drm->dev); 187 pm_runtime_put_autosuspend(drm->dev);
diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index aa9fec80492d..40c47d6a7d78 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -100,12 +100,10 @@ static void
100nouveau_dmem_free(struct hmm_devmem *devmem, struct page *page) 100nouveau_dmem_free(struct hmm_devmem *devmem, struct page *page)
101{ 101{
102 struct nouveau_dmem_chunk *chunk; 102 struct nouveau_dmem_chunk *chunk;
103 struct nouveau_drm *drm;
104 unsigned long idx; 103 unsigned long idx;
105 104
106 chunk = (void *)hmm_devmem_page_get_drvdata(page); 105 chunk = (void *)hmm_devmem_page_get_drvdata(page);
107 idx = page_to_pfn(page) - chunk->pfn_first; 106 idx = page_to_pfn(page) - chunk->pfn_first;
108 drm = chunk->drm;
109 107
110 /* 108 /*
111 * FIXME: 109 * FIXME:
@@ -456,11 +454,6 @@ nouveau_dmem_resume(struct nouveau_drm *drm)
456 /* FIXME handle pin failure */ 454 /* FIXME handle pin failure */
457 WARN_ON(ret); 455 WARN_ON(ret);
458 } 456 }
459 list_for_each_entry (chunk, &drm->dmem->chunk_empty, list) {
460 ret = nouveau_bo_pin(chunk->bo, TTM_PL_FLAG_VRAM, false);
461 /* FIXME handle pin failure */
462 WARN_ON(ret);
463 }
464 mutex_unlock(&drm->dmem->mutex); 457 mutex_unlock(&drm->dmem->mutex);
465} 458}
466 459
@@ -479,9 +472,6 @@ nouveau_dmem_suspend(struct nouveau_drm *drm)
479 list_for_each_entry (chunk, &drm->dmem->chunk_full, list) { 472 list_for_each_entry (chunk, &drm->dmem->chunk_full, list) {
480 nouveau_bo_unpin(chunk->bo); 473 nouveau_bo_unpin(chunk->bo);
481 } 474 }
482 list_for_each_entry (chunk, &drm->dmem->chunk_empty, list) {
483 nouveau_bo_unpin(chunk->bo);
484 }
485 mutex_unlock(&drm->dmem->mutex); 475 mutex_unlock(&drm->dmem->mutex);
486} 476}
487 477
@@ -623,7 +613,7 @@ nouveau_dmem_init(struct nouveau_drm *drm)
623 */ 613 */
624 drm->dmem->devmem = hmm_devmem_add(&nouveau_dmem_devmem_ops, 614 drm->dmem->devmem = hmm_devmem_add(&nouveau_dmem_devmem_ops,
625 device, size); 615 device, size);
626 if (drm->dmem->devmem == NULL) { 616 if (IS_ERR(drm->dmem->devmem)) {
627 kfree(drm->dmem); 617 kfree(drm->dmem);
628 drm->dmem = NULL; 618 drm->dmem = NULL;
629 return; 619 return;
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
index d5a23295dd80..bb7b58407039 100644
--- a/drivers/gpu/drm/udl/udl_gem.c
+++ b/drivers/gpu/drm/udl/udl_gem.c
@@ -224,7 +224,7 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device *dev,
224 *offset = drm_vma_node_offset_addr(&gobj->base.vma_node); 224 *offset = drm_vma_node_offset_addr(&gobj->base.vma_node);
225 225
226out: 226out:
227 drm_gem_object_put(&gobj->base); 227 drm_gem_object_put_unlocked(&gobj->base);
228unlock: 228unlock:
229 mutex_unlock(&udl->gem_lock); 229 mutex_unlock(&udl->gem_lock);
230 return ret; 230 return ret;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index b913a56f3426..2a9112515f46 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -564,11 +564,9 @@ static int vmw_fb_set_par(struct fb_info *info)
564 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 564 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
565 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) 565 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC)
566 }; 566 };
567 struct drm_display_mode *old_mode;
568 struct drm_display_mode *mode; 567 struct drm_display_mode *mode;
569 int ret; 568 int ret;
570 569
571 old_mode = par->set_mode;
572 mode = drm_mode_duplicate(vmw_priv->dev, &new_mode); 570 mode = drm_mode_duplicate(vmw_priv->dev, &new_mode);
573 if (!mode) { 571 if (!mode) {
574 DRM_ERROR("Could not create new fb mode.\n"); 572 DRM_ERROR("Could not create new fb mode.\n");
@@ -579,11 +577,7 @@ static int vmw_fb_set_par(struct fb_info *info)
579 mode->vdisplay = var->yres; 577 mode->vdisplay = var->yres;
580 vmw_guess_mode_timing(mode); 578 vmw_guess_mode_timing(mode);
581 579
582 if (old_mode && drm_mode_equal(old_mode, mode)) { 580 if (!vmw_kms_validate_mode_vram(vmw_priv,
583 drm_mode_destroy(vmw_priv->dev, mode);
584 mode = old_mode;
585 old_mode = NULL;
586 } else if (!vmw_kms_validate_mode_vram(vmw_priv,
587 mode->hdisplay * 581 mode->hdisplay *
588 DIV_ROUND_UP(var->bits_per_pixel, 8), 582 DIV_ROUND_UP(var->bits_per_pixel, 8),
589 mode->vdisplay)) { 583 mode->vdisplay)) {
@@ -620,8 +614,8 @@ static int vmw_fb_set_par(struct fb_info *info)
620 schedule_delayed_work(&par->local_work, 0); 614 schedule_delayed_work(&par->local_work, 0);
621 615
622out_unlock: 616out_unlock:
623 if (old_mode) 617 if (par->set_mode)
624 drm_mode_destroy(vmw_priv->dev, old_mode); 618 drm_mode_destroy(vmw_priv->dev, par->set_mode);
625 par->set_mode = mode; 619 par->set_mode = mode;
626 620
627 mutex_unlock(&par->bo_mutex); 621 mutex_unlock(&par->bo_mutex);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
index b93c558dd86e..7da752ca1c34 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@ -57,7 +57,7 @@ static int vmw_gmrid_man_get_node(struct ttm_mem_type_manager *man,
57 57
58 id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL); 58 id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
59 if (id < 0) 59 if (id < 0)
60 return id; 60 return (id != -ENOMEM ? 0 : id);
61 61
62 spin_lock(&gman->lock); 62 spin_lock(&gman->lock);
63 63
diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c
index c5a881172524..337410f40860 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_utils.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c
@@ -173,7 +173,12 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,
173 173
174 rcu_read_lock(); 174 rcu_read_lock();
175 in = __in_dev_get_rcu(upper_dev); 175 in = __in_dev_get_rcu(upper_dev);
176 local_ipaddr = ntohl(in->ifa_list->ifa_address); 176
177 if (!in->ifa_list)
178 local_ipaddr = 0;
179 else
180 local_ipaddr = ntohl(in->ifa_list->ifa_address);
181
177 rcu_read_unlock(); 182 rcu_read_unlock();
178 } else { 183 } else {
179 local_ipaddr = ntohl(ifa->ifa_address); 184 local_ipaddr = ntohl(ifa->ifa_address);
@@ -185,6 +190,11 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,
185 case NETDEV_UP: 190 case NETDEV_UP:
186 /* Fall through */ 191 /* Fall through */
187 case NETDEV_CHANGEADDR: 192 case NETDEV_CHANGEADDR:
193
194 /* Just skip if no need to handle ARP cache */
195 if (!local_ipaddr)
196 break;
197
188 i40iw_manage_arp_cache(iwdev, 198 i40iw_manage_arp_cache(iwdev,
189 netdev->dev_addr, 199 netdev->dev_addr,
190 &local_ipaddr, 200 &local_ipaddr,
diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c
index 782499abcd98..2a0b59a4b6eb 100644
--- a/drivers/infiniband/hw/mlx4/alias_GUID.c
+++ b/drivers/infiniband/hw/mlx4/alias_GUID.c
@@ -804,8 +804,8 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)
804 unsigned long flags; 804 unsigned long flags;
805 805
806 for (i = 0 ; i < dev->num_ports; i++) { 806 for (i = 0 ; i < dev->num_ports; i++) {
807 cancel_delayed_work(&dev->sriov.alias_guid.ports_guid[i].alias_guid_work);
808 det = &sriov->alias_guid.ports_guid[i]; 807 det = &sriov->alias_guid.ports_guid[i];
808 cancel_delayed_work_sync(&det->alias_guid_work);
809 spin_lock_irqsave(&sriov->alias_guid.ag_work_lock, flags); 809 spin_lock_irqsave(&sriov->alias_guid.ag_work_lock, flags);
810 while (!list_empty(&det->cb_list)) { 810 while (!list_empty(&det->cb_list)) {
811 cb_ctx = list_entry(det->cb_list.next, 811 cb_ctx = list_entry(det->cb_list.next,
diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index eaa055007f28..9e08df7914aa 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -20,6 +20,7 @@
20 20
21enum devx_obj_flags { 21enum devx_obj_flags {
22 DEVX_OBJ_FLAGS_INDIRECT_MKEY = 1 << 0, 22 DEVX_OBJ_FLAGS_INDIRECT_MKEY = 1 << 0,
23 DEVX_OBJ_FLAGS_DCT = 1 << 1,
23}; 24};
24 25
25struct devx_async_data { 26struct devx_async_data {
@@ -39,7 +40,10 @@ struct devx_obj {
39 u32 dinlen; /* destroy inbox length */ 40 u32 dinlen; /* destroy inbox length */
40 u32 dinbox[MLX5_MAX_DESTROY_INBOX_SIZE_DW]; 41 u32 dinbox[MLX5_MAX_DESTROY_INBOX_SIZE_DW];
41 u32 flags; 42 u32 flags;
42 struct mlx5_ib_devx_mr devx_mr; 43 union {
44 struct mlx5_ib_devx_mr devx_mr;
45 struct mlx5_core_dct core_dct;
46 };
43}; 47};
44 48
45struct devx_umem { 49struct devx_umem {
@@ -347,7 +351,6 @@ static u64 devx_get_obj_id(const void *in)
347 obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_RQ, 351 obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_RQ,
348 MLX5_GET(arm_rq_in, in, srq_number)); 352 MLX5_GET(arm_rq_in, in, srq_number));
349 break; 353 break;
350 case MLX5_CMD_OP_DRAIN_DCT:
351 case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION: 354 case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION:
352 obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_DCT, 355 obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_DCT,
353 MLX5_GET(drain_dct_in, in, dctn)); 356 MLX5_GET(drain_dct_in, in, dctn));
@@ -618,7 +621,6 @@ static bool devx_is_obj_modify_cmd(const void *in)
618 case MLX5_CMD_OP_2RST_QP: 621 case MLX5_CMD_OP_2RST_QP:
619 case MLX5_CMD_OP_ARM_XRC_SRQ: 622 case MLX5_CMD_OP_ARM_XRC_SRQ:
620 case MLX5_CMD_OP_ARM_RQ: 623 case MLX5_CMD_OP_ARM_RQ:
621 case MLX5_CMD_OP_DRAIN_DCT:
622 case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION: 624 case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION:
623 case MLX5_CMD_OP_ARM_XRQ: 625 case MLX5_CMD_OP_ARM_XRQ:
624 case MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY: 626 case MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY:
@@ -1124,7 +1126,11 @@ static int devx_obj_cleanup(struct ib_uobject *uobject,
1124 if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) 1126 if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY)
1125 devx_cleanup_mkey(obj); 1127 devx_cleanup_mkey(obj);
1126 1128
1127 ret = mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out)); 1129 if (obj->flags & DEVX_OBJ_FLAGS_DCT)
1130 ret = mlx5_core_destroy_dct(obj->mdev, &obj->core_dct);
1131 else
1132 ret = mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out,
1133 sizeof(out));
1128 if (ib_is_destroy_retryable(ret, why, uobject)) 1134 if (ib_is_destroy_retryable(ret, why, uobject))
1129 return ret; 1135 return ret;
1130 1136
@@ -1185,9 +1191,17 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
1185 devx_set_umem_valid(cmd_in); 1191 devx_set_umem_valid(cmd_in);
1186 } 1192 }
1187 1193
1188 err = mlx5_cmd_exec(dev->mdev, cmd_in, 1194 if (opcode == MLX5_CMD_OP_CREATE_DCT) {
1189 cmd_in_len, 1195 obj->flags |= DEVX_OBJ_FLAGS_DCT;
1190 cmd_out, cmd_out_len); 1196 err = mlx5_core_create_dct(dev->mdev, &obj->core_dct,
1197 cmd_in, cmd_in_len,
1198 cmd_out, cmd_out_len);
1199 } else {
1200 err = mlx5_cmd_exec(dev->mdev, cmd_in,
1201 cmd_in_len,
1202 cmd_out, cmd_out_len);
1203 }
1204
1191 if (err) 1205 if (err)
1192 goto obj_free; 1206 goto obj_free;
1193 1207
@@ -1214,7 +1228,11 @@ err_copy:
1214 if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) 1228 if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY)
1215 devx_cleanup_mkey(obj); 1229 devx_cleanup_mkey(obj);
1216obj_destroy: 1230obj_destroy:
1217 mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out)); 1231 if (obj->flags & DEVX_OBJ_FLAGS_DCT)
1232 mlx5_core_destroy_dct(obj->mdev, &obj->core_dct);
1233 else
1234 mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out,
1235 sizeof(out));
1218obj_free: 1236obj_free:
1219 kfree(obj); 1237 kfree(obj);
1220 return err; 1238 return err;
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 994c19d01211..531ff20b32ad 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -415,10 +415,17 @@ static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u8 *active_speed,
415 *active_speed = IB_SPEED_EDR; 415 *active_speed = IB_SPEED_EDR;
416 break; 416 break;
417 case MLX5E_PROT_MASK(MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2): 417 case MLX5E_PROT_MASK(MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2):
418 *active_width = IB_WIDTH_2X;
419 *active_speed = IB_SPEED_EDR;
420 break;
418 case MLX5E_PROT_MASK(MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR): 421 case MLX5E_PROT_MASK(MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR):
419 *active_width = IB_WIDTH_1X; 422 *active_width = IB_WIDTH_1X;
420 *active_speed = IB_SPEED_HDR; 423 *active_speed = IB_SPEED_HDR;
421 break; 424 break;
425 case MLX5E_PROT_MASK(MLX5E_CAUI_4_100GBASE_CR4_KR4):
426 *active_width = IB_WIDTH_4X;
427 *active_speed = IB_SPEED_EDR;
428 break;
422 case MLX5E_PROT_MASK(MLX5E_100GAUI_2_100GBASE_CR2_KR2): 429 case MLX5E_PROT_MASK(MLX5E_100GAUI_2_100GBASE_CR2_KR2):
423 *active_width = IB_WIDTH_2X; 430 *active_width = IB_WIDTH_2X;
424 *active_speed = IB_SPEED_HDR; 431 *active_speed = IB_SPEED_HDR;
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 6b1f0e76900b..7cd006da1dae 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -3729,6 +3729,7 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
3729 3729
3730 } else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) { 3730 } else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
3731 struct mlx5_ib_modify_qp_resp resp = {}; 3731 struct mlx5_ib_modify_qp_resp resp = {};
3732 u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0};
3732 u32 min_resp_len = offsetof(typeof(resp), dctn) + 3733 u32 min_resp_len = offsetof(typeof(resp), dctn) +
3733 sizeof(resp.dctn); 3734 sizeof(resp.dctn);
3734 3735
@@ -3747,7 +3748,8 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
3747 MLX5_SET(dctc, dctc, hop_limit, attr->ah_attr.grh.hop_limit); 3748 MLX5_SET(dctc, dctc, hop_limit, attr->ah_attr.grh.hop_limit);
3748 3749
3749 err = mlx5_core_create_dct(dev->mdev, &qp->dct.mdct, qp->dct.in, 3750 err = mlx5_core_create_dct(dev->mdev, &qp->dct.mdct, qp->dct.in,
3750 MLX5_ST_SZ_BYTES(create_dct_in)); 3751 MLX5_ST_SZ_BYTES(create_dct_in), out,
3752 sizeof(out));
3751 if (err) 3753 if (err)
3752 return err; 3754 return err;
3753 resp.dctn = qp->dct.mdct.mqp.qpn; 3755 resp.dctn = qp->dct.mdct.mqp.qpn;
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index b319e51c379b..21cb088d6687 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2608,7 +2608,12 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
2608 2608
2609 /* Everything is mapped - write the right values into s->dma_address */ 2609 /* Everything is mapped - write the right values into s->dma_address */
2610 for_each_sg(sglist, s, nelems, i) { 2610 for_each_sg(sglist, s, nelems, i) {
2611 s->dma_address += address + s->offset; 2611 /*
2612 * Add in the remaining piece of the scatter-gather offset that
2613 * was masked out when we were determining the physical address
2614 * via (sg_phys(s) & PAGE_MASK) earlier.
2615 */
2616 s->dma_address += address + (s->offset & ~PAGE_MASK);
2612 s->dma_length = s->length; 2617 s->dma_length = s->length;
2613 } 2618 }
2614 2619
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 87274b54febd..28cb713d728c 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1538,6 +1538,9 @@ static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu)
1538 u32 pmen; 1538 u32 pmen;
1539 unsigned long flags; 1539 unsigned long flags;
1540 1540
1541 if (!cap_plmr(iommu->cap) && !cap_phmr(iommu->cap))
1542 return;
1543
1541 raw_spin_lock_irqsave(&iommu->register_lock, flags); 1544 raw_spin_lock_irqsave(&iommu->register_lock, flags);
1542 pmen = readl(iommu->reg + DMAR_PMEN_REG); 1545 pmen = readl(iommu->reg + DMAR_PMEN_REG);
1543 pmen &= ~DMA_PMEN_EPM; 1546 pmen &= ~DMA_PMEN_EPM;
@@ -5332,7 +5335,7 @@ int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sd
5332 5335
5333 ctx_lo = context[0].lo; 5336 ctx_lo = context[0].lo;
5334 5337
5335 sdev->did = domain->iommu_did[iommu->seq_id]; 5338 sdev->did = FLPT_DEFAULT_DID;
5336 sdev->sid = PCI_DEVID(info->bus, info->devfn); 5339 sdev->sid = PCI_DEVID(info->bus, info->devfn);
5337 5340
5338 if (!(ctx_lo & CONTEXT_PASIDE)) { 5341 if (!(ctx_lo & CONTEXT_PASIDE)) {
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index f8d3ba247523..2de8122e218f 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -207,8 +207,10 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
207 curr_iova = rb_entry(curr, struct iova, node); 207 curr_iova = rb_entry(curr, struct iova, node);
208 } while (curr && new_pfn <= curr_iova->pfn_hi); 208 } while (curr && new_pfn <= curr_iova->pfn_hi);
209 209
210 if (limit_pfn < size || new_pfn < iovad->start_pfn) 210 if (limit_pfn < size || new_pfn < iovad->start_pfn) {
211 iovad->max32_alloc_size = size;
211 goto iova32_full; 212 goto iova32_full;
213 }
212 214
213 /* pfn_lo will point to size aligned address if size_aligned is set */ 215 /* pfn_lo will point to size aligned address if size_aligned is set */
214 new->pfn_lo = new_pfn; 216 new->pfn_lo = new_pfn;
@@ -222,7 +224,6 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
222 return 0; 224 return 0;
223 225
224iova32_full: 226iova32_full:
225 iovad->max32_alloc_size = size;
226 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); 227 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags);
227 return -ENOMEM; 228 return -ENOMEM;
228} 229}
diff --git a/drivers/mmc/host/alcor.c b/drivers/mmc/host/alcor.c
index c712b7deb3a9..82a97866e0cf 100644
--- a/drivers/mmc/host/alcor.c
+++ b/drivers/mmc/host/alcor.c
@@ -1044,14 +1044,27 @@ static void alcor_init_mmc(struct alcor_sdmmc_host *host)
1044 mmc->caps2 = MMC_CAP2_NO_SDIO; 1044 mmc->caps2 = MMC_CAP2_NO_SDIO;
1045 mmc->ops = &alcor_sdc_ops; 1045 mmc->ops = &alcor_sdc_ops;
1046 1046
1047 /* Hardware cannot do scatter lists */ 1047 /* The hardware does DMA data transfer of 4096 bytes to/from a single
1048 * buffer address. Scatterlists are not supported, but upon DMA
1049 * completion (signalled via IRQ), the original vendor driver does
1050 * then immediately set up another DMA transfer of the next 4096
1051 * bytes.
1052 *
1053 * This means that we need to handle the I/O in 4096 byte chunks.
1054 * Lacking a way to limit the sglist entries to 4096 bytes, we instead
1055 * impose that only one segment is provided, with maximum size 4096,
1056 * which also happens to be the minimum size. This means that the
1057 * single-entry sglist handled by this driver can be handed directly
1058 * to the hardware, nice and simple.
1059 *
1060 * Unfortunately though, that means we only do 4096 bytes I/O per
1061 * MMC command. A future improvement would be to make the driver
1062 * accept sg lists and entries of any size, and simply iterate
1063 * through them 4096 bytes at a time.
1064 */
1048 mmc->max_segs = AU6601_MAX_DMA_SEGMENTS; 1065 mmc->max_segs = AU6601_MAX_DMA_SEGMENTS;
1049 mmc->max_seg_size = AU6601_MAX_DMA_BLOCK_SIZE; 1066 mmc->max_seg_size = AU6601_MAX_DMA_BLOCK_SIZE;
1050 1067 mmc->max_req_size = mmc->max_seg_size;
1051 mmc->max_blk_size = mmc->max_seg_size;
1052 mmc->max_blk_count = mmc->max_segs;
1053
1054 mmc->max_req_size = mmc->max_seg_size * mmc->max_segs;
1055} 1068}
1056 1069
1057static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev) 1070static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 49e0daf2ef5e..f37003df1e01 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1117,7 +1117,7 @@ static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host)
1117{ 1117{
1118} 1118}
1119#endif 1119#endif
1120static void __init init_mmcsd_host(struct mmc_davinci_host *host) 1120static void init_mmcsd_host(struct mmc_davinci_host *host)
1121{ 1121{
1122 1122
1123 mmc_davinci_reset_ctrl(host, 1); 1123 mmc_davinci_reset_ctrl(host, 1);
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index d54612257b06..45f7b9b53d48 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -290,11 +290,8 @@ static void mxcmci_swap_buffers(struct mmc_data *data)
290 struct scatterlist *sg; 290 struct scatterlist *sg;
291 int i; 291 int i;
292 292
293 for_each_sg(data->sg, sg, data->sg_len, i) { 293 for_each_sg(data->sg, sg, data->sg_len, i)
294 void *buf = kmap_atomic(sg_page(sg) + sg->offset); 294 buffer_swap32(sg_virt(sg), sg->length);
295 buffer_swap32(buf, sg->length);
296 kunmap_atomic(buf);
297 }
298} 295}
299#else 296#else
300static inline void mxcmci_swap_buffers(struct mmc_data *data) {} 297static inline void mxcmci_swap_buffers(struct mmc_data *data) {}
@@ -611,7 +608,6 @@ static int mxcmci_transfer_data(struct mxcmci_host *host)
611{ 608{
612 struct mmc_data *data = host->req->data; 609 struct mmc_data *data = host->req->data;
613 struct scatterlist *sg; 610 struct scatterlist *sg;
614 void *buf;
615 int stat, i; 611 int stat, i;
616 612
617 host->data = data; 613 host->data = data;
@@ -619,18 +615,14 @@ static int mxcmci_transfer_data(struct mxcmci_host *host)
619 615
620 if (data->flags & MMC_DATA_READ) { 616 if (data->flags & MMC_DATA_READ) {
621 for_each_sg(data->sg, sg, data->sg_len, i) { 617 for_each_sg(data->sg, sg, data->sg_len, i) {
622 buf = kmap_atomic(sg_page(sg) + sg->offset); 618 stat = mxcmci_pull(host, sg_virt(sg), sg->length);
623 stat = mxcmci_pull(host, buf, sg->length);
624 kunmap(buf);
625 if (stat) 619 if (stat)
626 return stat; 620 return stat;
627 host->datasize += sg->length; 621 host->datasize += sg->length;
628 } 622 }
629 } else { 623 } else {
630 for_each_sg(data->sg, sg, data->sg_len, i) { 624 for_each_sg(data->sg, sg, data->sg_len, i) {
631 buf = kmap_atomic(sg_page(sg) + sg->offset); 625 stat = mxcmci_push(host, sg_virt(sg), sg->length);
632 stat = mxcmci_push(host, buf, sg->length);
633 kunmap(buf);
634 if (stat) 626 if (stat)
635 return stat; 627 return stat;
636 host->datasize += sg->length; 628 host->datasize += sg->length;
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index c907bf502a12..c1d3f0e38921 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -162,7 +162,7 @@ static void pxamci_dma_irq(void *param);
162static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) 162static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
163{ 163{
164 struct dma_async_tx_descriptor *tx; 164 struct dma_async_tx_descriptor *tx;
165 enum dma_data_direction direction; 165 enum dma_transfer_direction direction;
166 struct dma_slave_config config; 166 struct dma_slave_config config;
167 struct dma_chan *chan; 167 struct dma_chan *chan;
168 unsigned int nob = data->blocks; 168 unsigned int nob = data->blocks;
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 71e13844df6c..8742e27e4e8b 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -641,6 +641,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
641 struct renesas_sdhi *priv; 641 struct renesas_sdhi *priv;
642 struct resource *res; 642 struct resource *res;
643 int irq, ret, i; 643 int irq, ret, i;
644 u16 ver;
644 645
645 of_data = of_device_get_match_data(&pdev->dev); 646 of_data = of_device_get_match_data(&pdev->dev);
646 647
@@ -773,12 +774,17 @@ int renesas_sdhi_probe(struct platform_device *pdev,
773 if (ret) 774 if (ret)
774 goto efree; 775 goto efree;
775 776
777 ver = sd_ctrl_read16(host, CTL_VERSION);
778 /* GEN2_SDR104 is first known SDHI to use 32bit block count */
779 if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
780 mmc_data->max_blk_count = U16_MAX;
781
776 ret = tmio_mmc_host_probe(host); 782 ret = tmio_mmc_host_probe(host);
777 if (ret < 0) 783 if (ret < 0)
778 goto edisclk; 784 goto edisclk;
779 785
780 /* One Gen2 SDHI incarnation does NOT have a CBSY bit */ 786 /* One Gen2 SDHI incarnation does NOT have a CBSY bit */
781 if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN2_SDR50) 787 if (ver == SDHI_VER_GEN2_SDR50)
782 mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY; 788 mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
783 789
784 /* Enable tuning iff we have an SCC and a supported mode */ 790 /* Enable tuning iff we have an SCC and a supported mode */
diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index b1a66ca3821a..5bbed477c9b1 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -1056,6 +1056,9 @@ static int sdhci_omap_probe(struct platform_device *pdev)
1056 mmc->f_max = 48000000; 1056 mmc->f_max = 48000000;
1057 } 1057 }
1058 1058
1059 if (!mmc_can_gpio_ro(mmc))
1060 mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
1061
1059 pltfm_host->clk = devm_clk_get(dev, "fck"); 1062 pltfm_host->clk = devm_clk_get(dev, "fck");
1060 if (IS_ERR(pltfm_host->clk)) { 1063 if (IS_ERR(pltfm_host->clk)) {
1061 ret = PTR_ERR(pltfm_host->clk); 1064 ret = PTR_ERR(pltfm_host->clk);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
index 370ca94b6775..b8ba74de9555 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
@@ -40,6 +40,9 @@
40#include "mlx5_core.h" 40#include "mlx5_core.h"
41#include "lib/eq.h" 41#include "lib/eq.h"
42 42
43static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,
44 struct mlx5_core_dct *dct);
45
43static struct mlx5_core_rsc_common * 46static struct mlx5_core_rsc_common *
44mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) 47mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn)
45{ 48{
@@ -227,20 +230,49 @@ static void destroy_resource_common(struct mlx5_core_dev *dev,
227 wait_for_completion(&qp->common.free); 230 wait_for_completion(&qp->common.free);
228} 231}
229 232
233static int _mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
234 struct mlx5_core_dct *dct, bool need_cleanup)
235{
236 u32 out[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
237 u32 in[MLX5_ST_SZ_DW(destroy_dct_in)] = {0};
238 struct mlx5_core_qp *qp = &dct->mqp;
239 int err;
240
241 err = mlx5_core_drain_dct(dev, dct);
242 if (err) {
243 if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
244 goto destroy;
245 } else {
246 mlx5_core_warn(
247 dev, "failed drain DCT 0x%x with error 0x%x\n",
248 qp->qpn, err);
249 return err;
250 }
251 }
252 wait_for_completion(&dct->drained);
253destroy:
254 if (need_cleanup)
255 destroy_resource_common(dev, &dct->mqp);
256 MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
257 MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
258 MLX5_SET(destroy_dct_in, in, uid, qp->uid);
259 err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
260 (void *)&out, sizeof(out));
261 return err;
262}
263
230int mlx5_core_create_dct(struct mlx5_core_dev *dev, 264int mlx5_core_create_dct(struct mlx5_core_dev *dev,
231 struct mlx5_core_dct *dct, 265 struct mlx5_core_dct *dct,
232 u32 *in, int inlen) 266 u32 *in, int inlen,
267 u32 *out, int outlen)
233{ 268{
234 u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0};
235 u32 din[MLX5_ST_SZ_DW(destroy_dct_in)] = {0};
236 u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
237 struct mlx5_core_qp *qp = &dct->mqp; 269 struct mlx5_core_qp *qp = &dct->mqp;
238 int err; 270 int err;
239 271
240 init_completion(&dct->drained); 272 init_completion(&dct->drained);
241 MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT); 273 MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT);
242 274
243 err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); 275 err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
244 if (err) { 276 if (err) {
245 mlx5_core_warn(dev, "create DCT failed, ret %d\n", err); 277 mlx5_core_warn(dev, "create DCT failed, ret %d\n", err);
246 return err; 278 return err;
@@ -254,11 +286,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,
254 286
255 return 0; 287 return 0;
256err_cmd: 288err_cmd:
257 MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT); 289 _mlx5_core_destroy_dct(dev, dct, false);
258 MLX5_SET(destroy_dct_in, din, dctn, qp->qpn);
259 MLX5_SET(destroy_dct_in, din, uid, qp->uid);
260 mlx5_cmd_exec(dev, (void *)&in, sizeof(din),
261 (void *)&out, sizeof(dout));
262 return err; 290 return err;
263} 291}
264EXPORT_SYMBOL_GPL(mlx5_core_create_dct); 292EXPORT_SYMBOL_GPL(mlx5_core_create_dct);
@@ -323,29 +351,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,
323int mlx5_core_destroy_dct(struct mlx5_core_dev *dev, 351int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
324 struct mlx5_core_dct *dct) 352 struct mlx5_core_dct *dct)
325{ 353{
326 u32 out[MLX5_ST_SZ_DW(destroy_dct_out)] = {0}; 354 return _mlx5_core_destroy_dct(dev, dct, true);
327 u32 in[MLX5_ST_SZ_DW(destroy_dct_in)] = {0};
328 struct mlx5_core_qp *qp = &dct->mqp;
329 int err;
330
331 err = mlx5_core_drain_dct(dev, dct);
332 if (err) {
333 if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
334 goto destroy;
335 } else {
336 mlx5_core_warn(dev, "failed drain DCT 0x%x with error 0x%x\n", qp->qpn, err);
337 return err;
338 }
339 }
340 wait_for_completion(&dct->drained);
341destroy:
342 destroy_resource_common(dev, &dct->mqp);
343 MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
344 MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
345 MLX5_SET(destroy_dct_in, in, uid, qp->uid);
346 err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
347 (void *)&out, sizeof(out));
348 return err;
349} 355}
350EXPORT_SYMBOL_GPL(mlx5_core_destroy_dct); 356EXPORT_SYMBOL_GPL(mlx5_core_destroy_dct);
351 357
diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index 900c7073c46f..71308766e891 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -440,7 +440,7 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
440 440
441 ret = cros_ec_create_pdinfo(debug_info); 441 ret = cros_ec_create_pdinfo(debug_info);
442 if (ret) 442 if (ret)
443 goto remove_debugfs; 443 goto remove_log;
444 444
445 ec->debug_info = debug_info; 445 ec->debug_info = debug_info;
446 446
@@ -448,6 +448,8 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
448 448
449 return 0; 449 return 0;
450 450
451remove_log:
452 cros_ec_cleanup_console_log(debug_info);
451remove_debugfs: 453remove_debugfs:
452 debugfs_remove_recursive(debug_info->dir); 454 debugfs_remove_recursive(debug_info->dir);
453 return ret; 455 return ret;
@@ -467,7 +469,8 @@ static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev)
467{ 469{
468 struct cros_ec_dev *ec = dev_get_drvdata(dev); 470 struct cros_ec_dev *ec = dev_get_drvdata(dev);
469 471
470 cancel_delayed_work_sync(&ec->debug_info->log_poll_work); 472 if (ec->debug_info->log_buffer.buf)
473 cancel_delayed_work_sync(&ec->debug_info->log_poll_work);
471 474
472 return 0; 475 return 0;
473} 476}
@@ -476,7 +479,8 @@ static int __maybe_unused cros_ec_debugfs_resume(struct device *dev)
476{ 479{
477 struct cros_ec_dev *ec = dev_get_drvdata(dev); 480 struct cros_ec_dev *ec = dev_get_drvdata(dev);
478 481
479 schedule_delayed_work(&ec->debug_info->log_poll_work, 0); 482 if (ec->debug_info->log_buffer.buf)
483 schedule_delayed_work(&ec->debug_info->log_poll_work, 0);
480 484
481 return 0; 485 return 0;
482} 486}
diff --git a/drivers/platform/chrome/wilco_ec/mailbox.c b/drivers/platform/chrome/wilco_ec/mailbox.c
index f6ff29a11f1a..14355668ddfa 100644
--- a/drivers/platform/chrome/wilco_ec/mailbox.c
+++ b/drivers/platform/chrome/wilco_ec/mailbox.c
@@ -223,11 +223,11 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
223 msg->command, msg->type, msg->flags, msg->response_size, 223 msg->command, msg->type, msg->flags, msg->response_size,
224 msg->request_size); 224 msg->request_size);
225 225
226 mutex_lock(&ec->mailbox_lock);
226 /* Prepare request packet */ 227 /* Prepare request packet */
227 rq = ec->data_buffer; 228 rq = ec->data_buffer;
228 wilco_ec_prepare(msg, rq); 229 wilco_ec_prepare(msg, rq);
229 230
230 mutex_lock(&ec->mailbox_lock);
231 ret = wilco_ec_transfer(ec, msg, rq); 231 ret = wilco_ec_transfer(ec, msg, rq);
232 mutex_unlock(&ec->mailbox_lock); 232 mutex_unlock(&ec->mailbox_lock);
233 233
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 3c3cf89f713f..14bac4966c87 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -1801,6 +1801,12 @@ static int hisi_sas_I_T_nexus_reset(struct domain_device *device)
1801 } 1801 }
1802 hisi_sas_dereg_device(hisi_hba, device); 1802 hisi_sas_dereg_device(hisi_hba, device);
1803 1803
1804 if (dev_is_sata(device)) {
1805 rc = hisi_sas_softreset_ata_disk(device);
1806 if (rc)
1807 return TMF_RESP_FUNC_FAILED;
1808 }
1809
1804 rc = hisi_sas_debug_I_T_nexus_reset(device); 1810 rc = hisi_sas_debug_I_T_nexus_reset(device);
1805 1811
1806 if ((rc == TMF_RESP_FUNC_COMPLETE) || (rc == -ENODEV)) 1812 if ((rc == TMF_RESP_FUNC_COMPLETE) || (rc == -ENODEV))
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 1135e74646e2..8cec5230fe31 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -96,6 +96,7 @@ static int client_reserve = 1;
96static char partition_name[96] = "UNKNOWN"; 96static char partition_name[96] = "UNKNOWN";
97static unsigned int partition_number = -1; 97static unsigned int partition_number = -1;
98static LIST_HEAD(ibmvscsi_head); 98static LIST_HEAD(ibmvscsi_head);
99static DEFINE_SPINLOCK(ibmvscsi_driver_lock);
99 100
100static struct scsi_transport_template *ibmvscsi_transport_template; 101static struct scsi_transport_template *ibmvscsi_transport_template;
101 102
@@ -2270,7 +2271,9 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
2270 } 2271 }
2271 2272
2272 dev_set_drvdata(&vdev->dev, hostdata); 2273 dev_set_drvdata(&vdev->dev, hostdata);
2274 spin_lock(&ibmvscsi_driver_lock);
2273 list_add_tail(&hostdata->host_list, &ibmvscsi_head); 2275 list_add_tail(&hostdata->host_list, &ibmvscsi_head);
2276 spin_unlock(&ibmvscsi_driver_lock);
2274 return 0; 2277 return 0;
2275 2278
2276 add_srp_port_failed: 2279 add_srp_port_failed:
@@ -2292,15 +2295,27 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
2292static int ibmvscsi_remove(struct vio_dev *vdev) 2295static int ibmvscsi_remove(struct vio_dev *vdev)
2293{ 2296{
2294 struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev); 2297 struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
2295 list_del(&hostdata->host_list); 2298 unsigned long flags;
2296 unmap_persist_bufs(hostdata); 2299
2300 srp_remove_host(hostdata->host);
2301 scsi_remove_host(hostdata->host);
2302
2303 purge_requests(hostdata, DID_ERROR);
2304
2305 spin_lock_irqsave(hostdata->host->host_lock, flags);
2297 release_event_pool(&hostdata->pool, hostdata); 2306 release_event_pool(&hostdata->pool, hostdata);
2307 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
2308
2298 ibmvscsi_release_crq_queue(&hostdata->queue, hostdata, 2309 ibmvscsi_release_crq_queue(&hostdata->queue, hostdata,
2299 max_events); 2310 max_events);
2300 2311
2301 kthread_stop(hostdata->work_thread); 2312 kthread_stop(hostdata->work_thread);
2302 srp_remove_host(hostdata->host); 2313 unmap_persist_bufs(hostdata);
2303 scsi_remove_host(hostdata->host); 2314
2315 spin_lock(&ibmvscsi_driver_lock);
2316 list_del(&hostdata->host_list);
2317 spin_unlock(&ibmvscsi_driver_lock);
2318
2304 scsi_host_put(hostdata->host); 2319 scsi_host_put(hostdata->host);
2305 2320
2306 return 0; 2321 return 0;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 420045155ba0..0c700b140ce7 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4991,6 +4991,13 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
4991 if ((domain & 0xf0) == 0xf0) 4991 if ((domain & 0xf0) == 0xf0)
4992 continue; 4992 continue;
4993 4993
4994 /* Bypass if not same domain and area of adapter. */
4995 if (area && domain && ((area != vha->d_id.b.area) ||
4996 (domain != vha->d_id.b.domain)) &&
4997 (ha->current_topology == ISP_CFG_NL))
4998 continue;
4999
5000
4994 /* Bypass invalid local loop ID. */ 5001 /* Bypass invalid local loop ID. */
4995 if (loop_id > LAST_LOCAL_LOOP_ID) 5002 if (loop_id > LAST_LOCAL_LOOP_ID)
4996 continue; 5003 continue;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 677f82fdf56f..91f576d743fe 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1517,7 +1517,7 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
1517 goto eh_reset_failed; 1517 goto eh_reset_failed;
1518 } 1518 }
1519 err = 2; 1519 err = 2;
1520 if (do_reset(fcport, cmd->device->lun, blk_mq_rq_cpu(cmd->request) + 1) 1520 if (do_reset(fcport, cmd->device->lun, 1)
1521 != QLA_SUCCESS) { 1521 != QLA_SUCCESS) {
1522 ql_log(ql_log_warn, vha, 0x800c, 1522 ql_log(ql_log_warn, vha, 0x800c,
1523 "do_reset failed for cmd=%p.\n", cmd); 1523 "do_reset failed for cmd=%p.\n", cmd);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 20189675677a..601b9f1de267 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -585,10 +585,17 @@ static bool scsi_end_request(struct request *req, blk_status_t error,
585 if (!blk_rq_is_scsi(req)) { 585 if (!blk_rq_is_scsi(req)) {
586 WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED)); 586 WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED));
587 cmd->flags &= ~SCMD_INITIALIZED; 587 cmd->flags &= ~SCMD_INITIALIZED;
588 destroy_rcu_head(&cmd->rcu);
589 } 588 }
590 589
591 /* 590 /*
591 * Calling rcu_barrier() is not necessary here because the
592 * SCSI error handler guarantees that the function called by
593 * call_rcu() has been called before scsi_end_request() is
594 * called.
595 */
596 destroy_rcu_head(&cmd->rcu);
597
598 /*
592 * In the MQ case the command gets freed by __blk_mq_end_request, 599 * In the MQ case the command gets freed by __blk_mq_end_request,
593 * so we have to do all cleanup that depends on it earlier. 600 * so we have to do all cleanup that depends on it earlier.
594 * 601 *
@@ -2541,8 +2548,10 @@ void scsi_device_resume(struct scsi_device *sdev)
2541 * device deleted during suspend) 2548 * device deleted during suspend)
2542 */ 2549 */
2543 mutex_lock(&sdev->state_mutex); 2550 mutex_lock(&sdev->state_mutex);
2544 sdev->quiesced_by = NULL; 2551 if (sdev->quiesced_by) {
2545 blk_clear_pm_only(sdev->request_queue); 2552 sdev->quiesced_by = NULL;
2553 blk_clear_pm_only(sdev->request_queue);
2554 }
2546 if (sdev->sdev_state == SDEV_QUIESCE) 2555 if (sdev->sdev_state == SDEV_QUIESCE)
2547 scsi_device_set_state(sdev, SDEV_RUNNING); 2556 scsi_device_set_state(sdev, SDEV_RUNNING);
2548 mutex_unlock(&sdev->state_mutex); 2557 mutex_unlock(&sdev->state_mutex);
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 0508831d6fb9..0a82e93566dc 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2200,6 +2200,8 @@ void iscsi_remove_session(struct iscsi_cls_session *session)
2200 scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE); 2200 scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE);
2201 /* flush running scans then delete devices */ 2201 /* flush running scans then delete devices */
2202 flush_work(&session->scan_work); 2202 flush_work(&session->scan_work);
2203 /* flush running unbind operations */
2204 flush_work(&session->unbind_work);
2203 __iscsi_unbind_session(&session->unbind_work); 2205 __iscsi_unbind_session(&session->unbind_work);
2204 2206
2205 /* hw iscsi may not have removed all connections from session */ 2207 /* hw iscsi may not have removed all connections from session */
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index 720760cd493f..ba39647a690c 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -119,8 +119,7 @@ static const struct debugfs_reg32 bcm2835_thermal_regs[] = {
119 119
120static void bcm2835_thermal_debugfs(struct platform_device *pdev) 120static void bcm2835_thermal_debugfs(struct platform_device *pdev)
121{ 121{
122 struct thermal_zone_device *tz = platform_get_drvdata(pdev); 122 struct bcm2835_thermal_data *data = platform_get_drvdata(pdev);
123 struct bcm2835_thermal_data *data = tz->devdata;
124 struct debugfs_regset32 *regset; 123 struct debugfs_regset32 *regset;
125 124
126 data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL); 125 data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL);
@@ -266,7 +265,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
266 265
267 data->tz = tz; 266 data->tz = tz;
268 267
269 platform_set_drvdata(pdev, tz); 268 platform_set_drvdata(pdev, data);
270 269
271 /* 270 /*
272 * Thermal_zone doesn't enable hwmon as default, 271 * Thermal_zone doesn't enable hwmon as default,
@@ -290,8 +289,8 @@ err_clk:
290 289
291static int bcm2835_thermal_remove(struct platform_device *pdev) 290static int bcm2835_thermal_remove(struct platform_device *pdev)
292{ 291{
293 struct thermal_zone_device *tz = platform_get_drvdata(pdev); 292 struct bcm2835_thermal_data *data = platform_get_drvdata(pdev);
294 struct bcm2835_thermal_data *data = tz->devdata; 293 struct thermal_zone_device *tz = data->tz;
295 294
296 debugfs_remove_recursive(data->debugfsdir); 295 debugfs_remove_recursive(data->debugfsdir);
297 thermal_zone_of_sensor_unregister(&pdev->dev, tz); 296 thermal_zone_of_sensor_unregister(&pdev->dev, tz);
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 6fff16113628..f7c1f49ec87f 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -536,12 +536,11 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev,
536 struct thermal_zone_device *tz, u32 power, 536 struct thermal_zone_device *tz, u32 power,
537 unsigned long *state) 537 unsigned long *state)
538{ 538{
539 unsigned int cur_freq, target_freq; 539 unsigned int target_freq;
540 u32 last_load, normalised_power; 540 u32 last_load, normalised_power;
541 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 541 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
542 struct cpufreq_policy *policy = cpufreq_cdev->policy; 542 struct cpufreq_policy *policy = cpufreq_cdev->policy;
543 543
544 cur_freq = cpufreq_quick_get(policy->cpu);
545 power = power > 0 ? power : 0; 544 power = power > 0 ? power : 0;
546 last_load = cpufreq_cdev->last_load ?: 1; 545 last_load = cpufreq_cdev->last_load ?: 1;
547 normalised_power = (power * 100) / last_load; 546 normalised_power = (power * 100) / last_load;
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 61ca7ce3624e..5f3ed24e26ec 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -22,6 +22,13 @@ enum int3400_thermal_uuid {
22 INT3400_THERMAL_PASSIVE_1, 22 INT3400_THERMAL_PASSIVE_1,
23 INT3400_THERMAL_ACTIVE, 23 INT3400_THERMAL_ACTIVE,
24 INT3400_THERMAL_CRITICAL, 24 INT3400_THERMAL_CRITICAL,
25 INT3400_THERMAL_ADAPTIVE_PERFORMANCE,
26 INT3400_THERMAL_EMERGENCY_CALL_MODE,
27 INT3400_THERMAL_PASSIVE_2,
28 INT3400_THERMAL_POWER_BOSS,
29 INT3400_THERMAL_VIRTUAL_SENSOR,
30 INT3400_THERMAL_COOLING_MODE,
31 INT3400_THERMAL_HARDWARE_DUTY_CYCLING,
25 INT3400_THERMAL_MAXIMUM_UUID, 32 INT3400_THERMAL_MAXIMUM_UUID,
26}; 33};
27 34
@@ -29,6 +36,13 @@ static char *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
29 "42A441D6-AE6A-462b-A84B-4A8CE79027D3", 36 "42A441D6-AE6A-462b-A84B-4A8CE79027D3",
30 "3A95C389-E4B8-4629-A526-C52C88626BAE", 37 "3A95C389-E4B8-4629-A526-C52C88626BAE",
31 "97C68AE7-15FA-499c-B8C9-5DA81D606E0A", 38 "97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
39 "63BE270F-1C11-48FD-A6F7-3AF253FF3E2D",
40 "5349962F-71E6-431D-9AE8-0A635B710AEE",
41 "9E04115A-AE87-4D1C-9500-0F3E340BFE75",
42 "F5A35014-C209-46A4-993A-EB56DE7530A1",
43 "6ED722A7-9240-48A5-B479-31EEF723D7CF",
44 "16CAF1B7-DD38-40ED-B1C1-1B8A1913D531",
45 "BE84BABF-C4D4-403D-B495-3128FD44dAC1",
32}; 46};
33 47
34struct int3400_thermal_priv { 48struct int3400_thermal_priv {
@@ -299,10 +313,9 @@ static int int3400_thermal_probe(struct platform_device *pdev)
299 313
300 platform_set_drvdata(pdev, priv); 314 platform_set_drvdata(pdev, priv);
301 315
302 if (priv->uuid_bitmap & 1 << INT3400_THERMAL_PASSIVE_1) { 316 int3400_thermal_ops.get_mode = int3400_thermal_get_mode;
303 int3400_thermal_ops.get_mode = int3400_thermal_get_mode; 317 int3400_thermal_ops.set_mode = int3400_thermal_set_mode;
304 int3400_thermal_ops.set_mode = int3400_thermal_set_mode; 318
305 }
306 priv->thermal = thermal_zone_device_register("INT3400 Thermal", 0, 0, 319 priv->thermal = thermal_zone_device_register("INT3400 Thermal", 0, 0,
307 priv, &int3400_thermal_ops, 320 priv, &int3400_thermal_ops,
308 &int3400_thermal_params, 0, 0); 321 &int3400_thermal_params, 0, 0);
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index 7571f7c2e7c9..ac7256b5f020 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -101,7 +101,7 @@ struct powerclamp_worker_data {
101 bool clamping; 101 bool clamping;
102}; 102};
103 103
104static struct powerclamp_worker_data * __percpu worker_data; 104static struct powerclamp_worker_data __percpu *worker_data;
105static struct thermal_cooling_device *cooling_dev; 105static struct thermal_cooling_device *cooling_dev;
106static unsigned long *cpu_clamping_mask; /* bit map for tracking per cpu 106static unsigned long *cpu_clamping_mask; /* bit map for tracking per cpu
107 * clamping kthread worker 107 * clamping kthread worker
@@ -494,7 +494,7 @@ static void start_power_clamp_worker(unsigned long cpu)
494 struct powerclamp_worker_data *w_data = per_cpu_ptr(worker_data, cpu); 494 struct powerclamp_worker_data *w_data = per_cpu_ptr(worker_data, cpu);
495 struct kthread_worker *worker; 495 struct kthread_worker *worker;
496 496
497 worker = kthread_create_worker_on_cpu(cpu, 0, "kidle_inject/%ld", cpu); 497 worker = kthread_create_worker_on_cpu(cpu, 0, "kidle_inj/%ld", cpu);
498 if (IS_ERR(worker)) 498 if (IS_ERR(worker))
499 return; 499 return;
500 500
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index 5c07a61447d3..e4ea7f6aef20 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -199,6 +199,9 @@ enum {
199#define MT7622_TS1 0 199#define MT7622_TS1 0
200#define MT7622_NUM_CONTROLLER 1 200#define MT7622_NUM_CONTROLLER 1
201 201
202/* The maximum number of banks */
203#define MAX_NUM_ZONES 8
204
202/* The calibration coefficient of sensor */ 205/* The calibration coefficient of sensor */
203#define MT7622_CALIBRATION 165 206#define MT7622_CALIBRATION 165
204 207
@@ -249,7 +252,7 @@ struct mtk_thermal_data {
249 const int num_controller; 252 const int num_controller;
250 const int *controller_offset; 253 const int *controller_offset;
251 bool need_switch_bank; 254 bool need_switch_bank;
252 struct thermal_bank_cfg bank_data[]; 255 struct thermal_bank_cfg bank_data[MAX_NUM_ZONES];
253}; 256};
254 257
255struct mtk_thermal { 258struct mtk_thermal {
@@ -268,7 +271,7 @@ struct mtk_thermal {
268 s32 vts[MAX_NUM_VTS]; 271 s32 vts[MAX_NUM_VTS];
269 272
270 const struct mtk_thermal_data *conf; 273 const struct mtk_thermal_data *conf;
271 struct mtk_thermal_bank banks[]; 274 struct mtk_thermal_bank banks[MAX_NUM_ZONES];
272}; 275};
273 276
274/* MT8183 thermal sensor data */ 277/* MT8183 thermal sensor data */
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 48eef552cba4..fc9399d9c082 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -666,7 +666,7 @@ static int exynos_get_temp(void *p, int *temp)
666 struct exynos_tmu_data *data = p; 666 struct exynos_tmu_data *data = p;
667 int value, ret = 0; 667 int value, ret = 0;
668 668
669 if (!data || !data->tmu_read || !data->enabled) 669 if (!data || !data->tmu_read)
670 return -EINVAL; 670 return -EINVAL;
671 else if (!data->enabled) 671 else if (!data->enabled)
672 /* 672 /*
diff --git a/fs/block_dev.c b/fs/block_dev.c
index e9faa52bb489..78d3257435c0 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -336,12 +336,14 @@ static void blkdev_bio_end_io(struct bio *bio)
336 if (should_dirty) { 336 if (should_dirty) {
337 bio_check_pages_dirty(bio); 337 bio_check_pages_dirty(bio);
338 } else { 338 } else {
339 struct bio_vec *bvec; 339 if (!bio_flagged(bio, BIO_NO_PAGE_REF)) {
340 int i; 340 struct bvec_iter_all iter_all;
341 struct bvec_iter_all iter_all; 341 struct bio_vec *bvec;
342 int i;
342 343
343 bio_for_each_segment_all(bvec, bio, i, iter_all) 344 bio_for_each_segment_all(bvec, bio, i, iter_all)
344 put_page(bvec->bv_page); 345 put_page(bvec->bv_page);
346 }
345 bio_put(bio); 347 bio_put(bio);
346 } 348 }
347} 349}
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 217276b8b942..f9b71c12cc9f 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1008,7 +1008,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
1008 unsigned int xid; 1008 unsigned int xid;
1009 int rc; 1009 int rc;
1010 1010
1011 if (remap_flags & ~REMAP_FILE_ADVISORY) 1011 if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
1012 return -EINVAL; 1012 return -EINVAL;
1013 1013
1014 cifs_dbg(FYI, "clone range\n"); 1014 cifs_dbg(FYI, "clone range\n");
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 142164ef1f05..5c0298b9998f 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -150,5 +150,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
150extern const struct export_operations cifs_export_ops; 150extern const struct export_operations cifs_export_ops;
151#endif /* CONFIG_CIFS_NFSD_EXPORT */ 151#endif /* CONFIG_CIFS_NFSD_EXPORT */
152 152
153#define CIFS_VERSION "2.18" 153#define CIFS_VERSION "2.19"
154#endif /* _CIFSFS_H */ 154#endif /* _CIFSFS_H */
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 2a6d20c0ce02..89006e044973 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2632,43 +2632,56 @@ cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,
2632 struct TCP_Server_Info *server = 2632 struct TCP_Server_Info *server =
2633 tlink_tcon(wdata->cfile->tlink)->ses->server; 2633 tlink_tcon(wdata->cfile->tlink)->ses->server;
2634 2634
2635 /*
2636 * Wait for credits to resend this wdata.
2637 * Note: we are attempting to resend the whole wdata not in segments
2638 */
2639 do { 2635 do {
2640 rc = server->ops->wait_mtu_credits(server, wdata->bytes, &wsize, 2636 if (wdata->cfile->invalidHandle) {
2641 &credits); 2637 rc = cifs_reopen_file(wdata->cfile, false);
2638 if (rc == -EAGAIN)
2639 continue;
2640 else if (rc)
2641 break;
2642 }
2642 2643
2643 if (rc)
2644 goto out;
2645 2644
2646 if (wsize < wdata->bytes) { 2645 /*
2647 add_credits_and_wake_if(server, &credits, 0); 2646 * Wait for credits to resend this wdata.
2648 msleep(1000); 2647 * Note: we are attempting to resend the whole wdata not in
2649 } 2648 * segments
2650 } while (wsize < wdata->bytes); 2649 */
2650 do {
2651 rc = server->ops->wait_mtu_credits(server, wdata->bytes,
2652 &wsize, &credits);
2653 if (rc)
2654 goto fail;
2655
2656 if (wsize < wdata->bytes) {
2657 add_credits_and_wake_if(server, &credits, 0);
2658 msleep(1000);
2659 }
2660 } while (wsize < wdata->bytes);
2661 wdata->credits = credits;
2651 2662
2652 wdata->credits = credits; 2663 rc = adjust_credits(server, &wdata->credits, wdata->bytes);
2653 rc = -EAGAIN; 2664
2654 while (rc == -EAGAIN) { 2665 if (!rc) {
2655 rc = 0; 2666 if (wdata->cfile->invalidHandle)
2656 if (wdata->cfile->invalidHandle) 2667 rc = -EAGAIN;
2657 rc = cifs_reopen_file(wdata->cfile, false); 2668 else
2658 if (!rc) 2669 rc = server->ops->async_writev(wdata,
2659 rc = server->ops->async_writev(wdata,
2660 cifs_uncached_writedata_release); 2670 cifs_uncached_writedata_release);
2661 } 2671 }
2662 2672
2663 if (!rc) { 2673 /* If the write was successfully sent, we are done */
2664 list_add_tail(&wdata->list, wdata_list); 2674 if (!rc) {
2665 return 0; 2675 list_add_tail(&wdata->list, wdata_list);
2666 } 2676 return 0;
2677 }
2667 2678
2668 add_credits_and_wake_if(server, &wdata->credits, 0); 2679 /* Roll back credits and retry if needed */
2669out: 2680 add_credits_and_wake_if(server, &wdata->credits, 0);
2670 kref_put(&wdata->refcount, cifs_uncached_writedata_release); 2681 } while (rc == -EAGAIN);
2671 2682
2683fail:
2684 kref_put(&wdata->refcount, cifs_uncached_writedata_release);
2672 return rc; 2685 return rc;
2673} 2686}
2674 2687
@@ -2896,12 +2909,12 @@ restart_loop:
2896 wdata->bytes, &tmp_from, 2909 wdata->bytes, &tmp_from,
2897 ctx->cfile, cifs_sb, &tmp_list, 2910 ctx->cfile, cifs_sb, &tmp_list,
2898 ctx); 2911 ctx);
2912
2913 kref_put(&wdata->refcount,
2914 cifs_uncached_writedata_release);
2899 } 2915 }
2900 2916
2901 list_splice(&tmp_list, &ctx->list); 2917 list_splice(&tmp_list, &ctx->list);
2902
2903 kref_put(&wdata->refcount,
2904 cifs_uncached_writedata_release);
2905 goto restart_loop; 2918 goto restart_loop;
2906 } 2919 }
2907 } 2920 }
@@ -3348,44 +3361,55 @@ static int cifs_resend_rdata(struct cifs_readdata *rdata,
3348 struct TCP_Server_Info *server = 3361 struct TCP_Server_Info *server =
3349 tlink_tcon(rdata->cfile->tlink)->ses->server; 3362 tlink_tcon(rdata->cfile->tlink)->ses->server;
3350 3363
3351 /*
3352 * Wait for credits to resend this rdata.
3353 * Note: we are attempting to resend the whole rdata not in segments
3354 */
3355 do { 3364 do {
3356 rc = server->ops->wait_mtu_credits(server, rdata->bytes, 3365 if (rdata->cfile->invalidHandle) {
3366 rc = cifs_reopen_file(rdata->cfile, true);
3367 if (rc == -EAGAIN)
3368 continue;
3369 else if (rc)
3370 break;
3371 }
3372
3373 /*
3374 * Wait for credits to resend this rdata.
3375 * Note: we are attempting to resend the whole rdata not in
3376 * segments
3377 */
3378 do {
3379 rc = server->ops->wait_mtu_credits(server, rdata->bytes,
3357 &rsize, &credits); 3380 &rsize, &credits);
3358 3381
3359 if (rc) 3382 if (rc)
3360 goto out; 3383 goto fail;
3361 3384
3362 if (rsize < rdata->bytes) { 3385 if (rsize < rdata->bytes) {
3363 add_credits_and_wake_if(server, &credits, 0); 3386 add_credits_and_wake_if(server, &credits, 0);
3364 msleep(1000); 3387 msleep(1000);
3365 } 3388 }
3366 } while (rsize < rdata->bytes); 3389 } while (rsize < rdata->bytes);
3390 rdata->credits = credits;
3367 3391
3368 rdata->credits = credits; 3392 rc = adjust_credits(server, &rdata->credits, rdata->bytes);
3369 rc = -EAGAIN; 3393 if (!rc) {
3370 while (rc == -EAGAIN) { 3394 if (rdata->cfile->invalidHandle)
3371 rc = 0; 3395 rc = -EAGAIN;
3372 if (rdata->cfile->invalidHandle) 3396 else
3373 rc = cifs_reopen_file(rdata->cfile, true); 3397 rc = server->ops->async_readv(rdata);
3374 if (!rc) 3398 }
3375 rc = server->ops->async_readv(rdata);
3376 }
3377 3399
3378 if (!rc) { 3400 /* If the read was successfully sent, we are done */
3379 /* Add to aio pending list */ 3401 if (!rc) {
3380 list_add_tail(&rdata->list, rdata_list); 3402 /* Add to aio pending list */
3381 return 0; 3403 list_add_tail(&rdata->list, rdata_list);
3382 } 3404 return 0;
3405 }
3383 3406
3384 add_credits_and_wake_if(server, &rdata->credits, 0); 3407 /* Roll back credits and retry if needed */
3385out: 3408 add_credits_and_wake_if(server, &rdata->credits, 0);
3386 kref_put(&rdata->refcount, 3409 } while (rc == -EAGAIN);
3387 cifs_uncached_readdata_release);
3388 3410
3411fail:
3412 kref_put(&rdata->refcount, cifs_uncached_readdata_release);
3389 return rc; 3413 return rc;
3390} 3414}
3391 3415
diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c
index 924269cec135..e32c264e3adb 100644
--- a/fs/cifs/smb2maperror.c
+++ b/fs/cifs/smb2maperror.c
@@ -1036,7 +1036,8 @@ static const struct status_to_posix_error smb2_error_map_table[] = {
1036 {STATUS_UNFINISHED_CONTEXT_DELETED, -EIO, 1036 {STATUS_UNFINISHED_CONTEXT_DELETED, -EIO,
1037 "STATUS_UNFINISHED_CONTEXT_DELETED"}, 1037 "STATUS_UNFINISHED_CONTEXT_DELETED"},
1038 {STATUS_NO_TGT_REPLY, -EIO, "STATUS_NO_TGT_REPLY"}, 1038 {STATUS_NO_TGT_REPLY, -EIO, "STATUS_NO_TGT_REPLY"},
1039 {STATUS_OBJECTID_NOT_FOUND, -EIO, "STATUS_OBJECTID_NOT_FOUND"}, 1039 /* Note that ENOATTTR and ENODATA are the same errno */
1040 {STATUS_OBJECTID_NOT_FOUND, -ENODATA, "STATUS_OBJECTID_NOT_FOUND"},
1040 {STATUS_NO_IP_ADDRESSES, -EIO, "STATUS_NO_IP_ADDRESSES"}, 1041 {STATUS_NO_IP_ADDRESSES, -EIO, "STATUS_NO_IP_ADDRESSES"},
1041 {STATUS_WRONG_CREDENTIAL_HANDLE, -EIO, 1042 {STATUS_WRONG_CREDENTIAL_HANDLE, -EIO,
1042 "STATUS_WRONG_CREDENTIAL_HANDLE"}, 1043 "STATUS_WRONG_CREDENTIAL_HANDLE"},
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index c399e09b76e6..21ac19ff19cb 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1628,9 +1628,16 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
1628 iov[1].iov_base = unc_path; 1628 iov[1].iov_base = unc_path;
1629 iov[1].iov_len = unc_path_len; 1629 iov[1].iov_len = unc_path_len;
1630 1630
1631 /* 3.11 tcon req must be signed if not encrypted. See MS-SMB2 3.2.4.1.1 */ 1631 /*
1632 * 3.11 tcon req must be signed if not encrypted. See MS-SMB2 3.2.4.1.1
1633 * unless it is guest or anonymous user. See MS-SMB2 3.2.5.3.1
1634 * (Samba servers don't always set the flag so also check if null user)
1635 */
1632 if ((ses->server->dialect == SMB311_PROT_ID) && 1636 if ((ses->server->dialect == SMB311_PROT_ID) &&
1633 !smb3_encryption_required(tcon)) 1637 !smb3_encryption_required(tcon) &&
1638 !(ses->session_flags &
1639 (SMB2_SESSION_FLAG_IS_GUEST|SMB2_SESSION_FLAG_IS_NULL)) &&
1640 ((ses->user_name != NULL) || (ses->sectype == Kerberos)))
1634 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED; 1641 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
1635 1642
1636 memset(&rqst, 0, sizeof(struct smb_rqst)); 1643 memset(&rqst, 0, sizeof(struct smb_rqst));
diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h
index fa226de48ef3..99c4d799c24b 100644
--- a/fs/cifs/trace.h
+++ b/fs/cifs/trace.h
@@ -549,19 +549,19 @@ DECLARE_EVENT_CLASS(smb3_tcon_class,
549 __field(unsigned int, xid) 549 __field(unsigned int, xid)
550 __field(__u32, tid) 550 __field(__u32, tid)
551 __field(__u64, sesid) 551 __field(__u64, sesid)
552 __field(const char *, unc_name) 552 __string(name, unc_name)
553 __field(int, rc) 553 __field(int, rc)
554 ), 554 ),
555 TP_fast_assign( 555 TP_fast_assign(
556 __entry->xid = xid; 556 __entry->xid = xid;
557 __entry->tid = tid; 557 __entry->tid = tid;
558 __entry->sesid = sesid; 558 __entry->sesid = sesid;
559 __entry->unc_name = unc_name; 559 __assign_str(name, unc_name);
560 __entry->rc = rc; 560 __entry->rc = rc;
561 ), 561 ),
562 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d", 562 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
563 __entry->xid, __entry->sesid, __entry->tid, 563 __entry->xid, __entry->sesid, __entry->tid,
564 __entry->unc_name, __entry->rc) 564 __get_str(name), __entry->rc)
565) 565)
566 566
567#define DEFINE_SMB3_TCON_EVENT(name) \ 567#define DEFINE_SMB3_TCON_EVENT(name) \
diff --git a/fs/io_uring.c b/fs/io_uring.c
index c88088d92613..6aaa30580a2b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -189,17 +189,28 @@ struct sqe_submit {
189 bool needs_fixed_file; 189 bool needs_fixed_file;
190}; 190};
191 191
192/*
193 * First field must be the file pointer in all the
194 * iocb unions! See also 'struct kiocb' in <linux/fs.h>
195 */
192struct io_poll_iocb { 196struct io_poll_iocb {
193 struct file *file; 197 struct file *file;
194 struct wait_queue_head *head; 198 struct wait_queue_head *head;
195 __poll_t events; 199 __poll_t events;
196 bool woken; 200 bool done;
197 bool canceled; 201 bool canceled;
198 struct wait_queue_entry wait; 202 struct wait_queue_entry wait;
199}; 203};
200 204
205/*
206 * NOTE! Each of the iocb union members has the file pointer
207 * as the first entry in their struct definition. So you can
208 * access the file pointer through any of the sub-structs,
209 * or directly as just 'ki_filp' in this struct.
210 */
201struct io_kiocb { 211struct io_kiocb {
202 union { 212 union {
213 struct file *file;
203 struct kiocb rw; 214 struct kiocb rw;
204 struct io_poll_iocb poll; 215 struct io_poll_iocb poll;
205 }; 216 };
@@ -214,6 +225,7 @@ struct io_kiocb {
214#define REQ_F_IOPOLL_COMPLETED 2 /* polled IO has completed */ 225#define REQ_F_IOPOLL_COMPLETED 2 /* polled IO has completed */
215#define REQ_F_FIXED_FILE 4 /* ctx owns file */ 226#define REQ_F_FIXED_FILE 4 /* ctx owns file */
216#define REQ_F_SEQ_PREV 8 /* sequential with previous */ 227#define REQ_F_SEQ_PREV 8 /* sequential with previous */
228#define REQ_F_PREPPED 16 /* prep already done */
217 u64 user_data; 229 u64 user_data;
218 u64 error; 230 u64 error;
219 231
@@ -355,20 +367,25 @@ static void io_cqring_fill_event(struct io_ring_ctx *ctx, u64 ki_user_data,
355 } 367 }
356} 368}
357 369
358static void io_cqring_add_event(struct io_ring_ctx *ctx, u64 ki_user_data, 370static void io_cqring_ev_posted(struct io_ring_ctx *ctx)
371{
372 if (waitqueue_active(&ctx->wait))
373 wake_up(&ctx->wait);
374 if (waitqueue_active(&ctx->sqo_wait))
375 wake_up(&ctx->sqo_wait);
376}
377
378static void io_cqring_add_event(struct io_ring_ctx *ctx, u64 user_data,
359 long res, unsigned ev_flags) 379 long res, unsigned ev_flags)
360{ 380{
361 unsigned long flags; 381 unsigned long flags;
362 382
363 spin_lock_irqsave(&ctx->completion_lock, flags); 383 spin_lock_irqsave(&ctx->completion_lock, flags);
364 io_cqring_fill_event(ctx, ki_user_data, res, ev_flags); 384 io_cqring_fill_event(ctx, user_data, res, ev_flags);
365 io_commit_cqring(ctx); 385 io_commit_cqring(ctx);
366 spin_unlock_irqrestore(&ctx->completion_lock, flags); 386 spin_unlock_irqrestore(&ctx->completion_lock, flags);
367 387
368 if (waitqueue_active(&ctx->wait)) 388 io_cqring_ev_posted(ctx);
369 wake_up(&ctx->wait);
370 if (waitqueue_active(&ctx->sqo_wait))
371 wake_up(&ctx->sqo_wait);
372} 389}
373 390
374static void io_ring_drop_ctx_refs(struct io_ring_ctx *ctx, unsigned refs) 391static void io_ring_drop_ctx_refs(struct io_ring_ctx *ctx, unsigned refs)
@@ -382,13 +399,14 @@ static void io_ring_drop_ctx_refs(struct io_ring_ctx *ctx, unsigned refs)
382static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx, 399static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx,
383 struct io_submit_state *state) 400 struct io_submit_state *state)
384{ 401{
402 gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
385 struct io_kiocb *req; 403 struct io_kiocb *req;
386 404
387 if (!percpu_ref_tryget(&ctx->refs)) 405 if (!percpu_ref_tryget(&ctx->refs))
388 return NULL; 406 return NULL;
389 407
390 if (!state) { 408 if (!state) {
391 req = kmem_cache_alloc(req_cachep, __GFP_NOWARN); 409 req = kmem_cache_alloc(req_cachep, gfp);
392 if (unlikely(!req)) 410 if (unlikely(!req))
393 goto out; 411 goto out;
394 } else if (!state->free_reqs) { 412 } else if (!state->free_reqs) {
@@ -396,10 +414,18 @@ static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx,
396 int ret; 414 int ret;
397 415
398 sz = min_t(size_t, state->ios_left, ARRAY_SIZE(state->reqs)); 416 sz = min_t(size_t, state->ios_left, ARRAY_SIZE(state->reqs));
399 ret = kmem_cache_alloc_bulk(req_cachep, __GFP_NOWARN, sz, 417 ret = kmem_cache_alloc_bulk(req_cachep, gfp, sz, state->reqs);
400 state->reqs); 418
401 if (unlikely(ret <= 0)) 419 /*
402 goto out; 420 * Bulk alloc is all-or-nothing. If we fail to get a batch,
421 * retry single alloc to be on the safe side.
422 */
423 if (unlikely(ret <= 0)) {
424 state->reqs[0] = kmem_cache_alloc(req_cachep, gfp);
425 if (!state->reqs[0])
426 goto out;
427 ret = 1;
428 }
403 state->free_reqs = ret - 1; 429 state->free_reqs = ret - 1;
404 state->cur_req = 1; 430 state->cur_req = 1;
405 req = state->reqs[0]; 431 req = state->reqs[0];
@@ -411,7 +437,8 @@ static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx,
411 437
412 req->ctx = ctx; 438 req->ctx = ctx;
413 req->flags = 0; 439 req->flags = 0;
414 refcount_set(&req->refs, 0); 440 /* one is dropped after submission, the other at completion */
441 refcount_set(&req->refs, 2);
415 return req; 442 return req;
416out: 443out:
417 io_ring_drop_ctx_refs(ctx, 1); 444 io_ring_drop_ctx_refs(ctx, 1);
@@ -429,10 +456,16 @@ static void io_free_req_many(struct io_ring_ctx *ctx, void **reqs, int *nr)
429 456
430static void io_free_req(struct io_kiocb *req) 457static void io_free_req(struct io_kiocb *req)
431{ 458{
432 if (!refcount_read(&req->refs) || refcount_dec_and_test(&req->refs)) { 459 if (req->file && !(req->flags & REQ_F_FIXED_FILE))
433 io_ring_drop_ctx_refs(req->ctx, 1); 460 fput(req->file);
434 kmem_cache_free(req_cachep, req); 461 io_ring_drop_ctx_refs(req->ctx, 1);
435 } 462 kmem_cache_free(req_cachep, req);
463}
464
465static void io_put_req(struct io_kiocb *req)
466{
467 if (refcount_dec_and_test(&req->refs))
468 io_free_req(req);
436} 469}
437 470
438/* 471/*
@@ -442,44 +475,34 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
442 struct list_head *done) 475 struct list_head *done)
443{ 476{
444 void *reqs[IO_IOPOLL_BATCH]; 477 void *reqs[IO_IOPOLL_BATCH];
445 int file_count, to_free;
446 struct file *file = NULL;
447 struct io_kiocb *req; 478 struct io_kiocb *req;
479 int to_free;
448 480
449 file_count = to_free = 0; 481 to_free = 0;
450 while (!list_empty(done)) { 482 while (!list_empty(done)) {
451 req = list_first_entry(done, struct io_kiocb, list); 483 req = list_first_entry(done, struct io_kiocb, list);
452 list_del(&req->list); 484 list_del(&req->list);
453 485
454 io_cqring_fill_event(ctx, req->user_data, req->error, 0); 486 io_cqring_fill_event(ctx, req->user_data, req->error, 0);
455
456 reqs[to_free++] = req;
457 (*nr_events)++; 487 (*nr_events)++;
458 488
459 /* 489 if (refcount_dec_and_test(&req->refs)) {
460 * Batched puts of the same file, to avoid dirtying the 490 /* If we're not using fixed files, we have to pair the
461 * file usage count multiple times, if avoidable. 491 * completion part with the file put. Use regular
462 */ 492 * completions for those, only batch free for fixed
463 if (!(req->flags & REQ_F_FIXED_FILE)) { 493 * file.
464 if (!file) { 494 */
465 file = req->rw.ki_filp; 495 if (req->flags & REQ_F_FIXED_FILE) {
466 file_count = 1; 496 reqs[to_free++] = req;
467 } else if (file == req->rw.ki_filp) { 497 if (to_free == ARRAY_SIZE(reqs))
468 file_count++; 498 io_free_req_many(ctx, reqs, &to_free);
469 } else { 499 } else {
470 fput_many(file, file_count); 500 io_free_req(req);
471 file = req->rw.ki_filp;
472 file_count = 1;
473 } 501 }
474 } 502 }
475
476 if (to_free == ARRAY_SIZE(reqs))
477 io_free_req_many(ctx, reqs, &to_free);
478 } 503 }
479 io_commit_cqring(ctx);
480 504
481 if (file) 505 io_commit_cqring(ctx);
482 fput_many(file, file_count);
483 io_free_req_many(ctx, reqs, &to_free); 506 io_free_req_many(ctx, reqs, &to_free);
484} 507}
485 508
@@ -602,21 +625,14 @@ static void kiocb_end_write(struct kiocb *kiocb)
602 } 625 }
603} 626}
604 627
605static void io_fput(struct io_kiocb *req)
606{
607 if (!(req->flags & REQ_F_FIXED_FILE))
608 fput(req->rw.ki_filp);
609}
610
611static void io_complete_rw(struct kiocb *kiocb, long res, long res2) 628static void io_complete_rw(struct kiocb *kiocb, long res, long res2)
612{ 629{
613 struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw); 630 struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw);
614 631
615 kiocb_end_write(kiocb); 632 kiocb_end_write(kiocb);
616 633
617 io_fput(req);
618 io_cqring_add_event(req->ctx, req->user_data, res, 0); 634 io_cqring_add_event(req->ctx, req->user_data, res, 0);
619 io_free_req(req); 635 io_put_req(req);
620} 636}
621 637
622static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) 638static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
@@ -731,31 +747,18 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s,
731 const struct io_uring_sqe *sqe = s->sqe; 747 const struct io_uring_sqe *sqe = s->sqe;
732 struct io_ring_ctx *ctx = req->ctx; 748 struct io_ring_ctx *ctx = req->ctx;
733 struct kiocb *kiocb = &req->rw; 749 struct kiocb *kiocb = &req->rw;
734 unsigned ioprio, flags; 750 unsigned ioprio;
735 int fd, ret; 751 int ret;
736 752
753 if (!req->file)
754 return -EBADF;
737 /* For -EAGAIN retry, everything is already prepped */ 755 /* For -EAGAIN retry, everything is already prepped */
738 if (kiocb->ki_filp) 756 if (req->flags & REQ_F_PREPPED)
739 return 0; 757 return 0;
740 758
741 flags = READ_ONCE(sqe->flags); 759 if (force_nonblock && !io_file_supports_async(req->file))
742 fd = READ_ONCE(sqe->fd); 760 force_nonblock = false;
743 761
744 if (flags & IOSQE_FIXED_FILE) {
745 if (unlikely(!ctx->user_files ||
746 (unsigned) fd >= ctx->nr_user_files))
747 return -EBADF;
748 kiocb->ki_filp = ctx->user_files[fd];
749 req->flags |= REQ_F_FIXED_FILE;
750 } else {
751 if (s->needs_fixed_file)
752 return -EBADF;
753 kiocb->ki_filp = io_file_get(state, fd);
754 if (unlikely(!kiocb->ki_filp))
755 return -EBADF;
756 if (force_nonblock && !io_file_supports_async(kiocb->ki_filp))
757 force_nonblock = false;
758 }
759 kiocb->ki_pos = READ_ONCE(sqe->off); 762 kiocb->ki_pos = READ_ONCE(sqe->off);
760 kiocb->ki_flags = iocb_flags(kiocb->ki_filp); 763 kiocb->ki_flags = iocb_flags(kiocb->ki_filp);
761 kiocb->ki_hint = ki_hint_validate(file_write_hint(kiocb->ki_filp)); 764 kiocb->ki_hint = ki_hint_validate(file_write_hint(kiocb->ki_filp));
@@ -764,7 +767,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s,
764 if (ioprio) { 767 if (ioprio) {
765 ret = ioprio_check_cap(ioprio); 768 ret = ioprio_check_cap(ioprio);
766 if (ret) 769 if (ret)
767 goto out_fput; 770 return ret;
768 771
769 kiocb->ki_ioprio = ioprio; 772 kiocb->ki_ioprio = ioprio;
770 } else 773 } else
@@ -772,38 +775,26 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s,
772 775
773 ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags)); 776 ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
774 if (unlikely(ret)) 777 if (unlikely(ret))
775 goto out_fput; 778 return ret;
776 if (force_nonblock) { 779 if (force_nonblock) {
777 kiocb->ki_flags |= IOCB_NOWAIT; 780 kiocb->ki_flags |= IOCB_NOWAIT;
778 req->flags |= REQ_F_FORCE_NONBLOCK; 781 req->flags |= REQ_F_FORCE_NONBLOCK;
779 } 782 }
780 if (ctx->flags & IORING_SETUP_IOPOLL) { 783 if (ctx->flags & IORING_SETUP_IOPOLL) {
781 ret = -EOPNOTSUPP;
782 if (!(kiocb->ki_flags & IOCB_DIRECT) || 784 if (!(kiocb->ki_flags & IOCB_DIRECT) ||
783 !kiocb->ki_filp->f_op->iopoll) 785 !kiocb->ki_filp->f_op->iopoll)
784 goto out_fput; 786 return -EOPNOTSUPP;
785 787
786 req->error = 0; 788 req->error = 0;
787 kiocb->ki_flags |= IOCB_HIPRI; 789 kiocb->ki_flags |= IOCB_HIPRI;
788 kiocb->ki_complete = io_complete_rw_iopoll; 790 kiocb->ki_complete = io_complete_rw_iopoll;
789 } else { 791 } else {
790 if (kiocb->ki_flags & IOCB_HIPRI) { 792 if (kiocb->ki_flags & IOCB_HIPRI)
791 ret = -EINVAL; 793 return -EINVAL;
792 goto out_fput;
793 }
794 kiocb->ki_complete = io_complete_rw; 794 kiocb->ki_complete = io_complete_rw;
795 } 795 }
796 req->flags |= REQ_F_PREPPED;
796 return 0; 797 return 0;
797out_fput:
798 if (!(flags & IOSQE_FIXED_FILE)) {
799 /*
800 * in case of error, we didn't use this file reference. drop it.
801 */
802 if (state)
803 state->used_refs--;
804 io_file_put(state, kiocb->ki_filp);
805 }
806 return ret;
807} 798}
808 799
809static inline void io_rw_done(struct kiocb *kiocb, ssize_t ret) 800static inline void io_rw_done(struct kiocb *kiocb, ssize_t ret)
@@ -864,6 +855,9 @@ static int io_import_fixed(struct io_ring_ctx *ctx, int rw,
864 iov_iter_bvec(iter, rw, imu->bvec, imu->nr_bvecs, offset + len); 855 iov_iter_bvec(iter, rw, imu->bvec, imu->nr_bvecs, offset + len);
865 if (offset) 856 if (offset)
866 iov_iter_advance(iter, offset); 857 iov_iter_advance(iter, offset);
858
859 /* don't drop a reference to these pages */
860 iter->type |= ITER_BVEC_FLAG_NO_REF;
867 return 0; 861 return 0;
868} 862}
869 863
@@ -887,7 +881,7 @@ static int io_import_iovec(struct io_ring_ctx *ctx, int rw,
887 opcode = READ_ONCE(sqe->opcode); 881 opcode = READ_ONCE(sqe->opcode);
888 if (opcode == IORING_OP_READ_FIXED || 882 if (opcode == IORING_OP_READ_FIXED ||
889 opcode == IORING_OP_WRITE_FIXED) { 883 opcode == IORING_OP_WRITE_FIXED) {
890 ssize_t ret = io_import_fixed(ctx, rw, sqe, iter); 884 int ret = io_import_fixed(ctx, rw, sqe, iter);
891 *iovec = NULL; 885 *iovec = NULL;
892 return ret; 886 return ret;
893 } 887 }
@@ -945,31 +939,29 @@ static void io_async_list_note(int rw, struct io_kiocb *req, size_t len)
945 async_list->io_end = io_end; 939 async_list->io_end = io_end;
946} 940}
947 941
948static ssize_t io_read(struct io_kiocb *req, const struct sqe_submit *s, 942static int io_read(struct io_kiocb *req, const struct sqe_submit *s,
949 bool force_nonblock, struct io_submit_state *state) 943 bool force_nonblock, struct io_submit_state *state)
950{ 944{
951 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs; 945 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
952 struct kiocb *kiocb = &req->rw; 946 struct kiocb *kiocb = &req->rw;
953 struct iov_iter iter; 947 struct iov_iter iter;
954 struct file *file; 948 struct file *file;
955 size_t iov_count; 949 size_t iov_count;
956 ssize_t ret; 950 int ret;
957 951
958 ret = io_prep_rw(req, s, force_nonblock, state); 952 ret = io_prep_rw(req, s, force_nonblock, state);
959 if (ret) 953 if (ret)
960 return ret; 954 return ret;
961 file = kiocb->ki_filp; 955 file = kiocb->ki_filp;
962 956
963 ret = -EBADF;
964 if (unlikely(!(file->f_mode & FMODE_READ))) 957 if (unlikely(!(file->f_mode & FMODE_READ)))
965 goto out_fput; 958 return -EBADF;
966 ret = -EINVAL;
967 if (unlikely(!file->f_op->read_iter)) 959 if (unlikely(!file->f_op->read_iter))
968 goto out_fput; 960 return -EINVAL;
969 961
970 ret = io_import_iovec(req->ctx, READ, s, &iovec, &iter); 962 ret = io_import_iovec(req->ctx, READ, s, &iovec, &iter);
971 if (ret) 963 if (ret)
972 goto out_fput; 964 return ret;
973 965
974 iov_count = iov_iter_count(&iter); 966 iov_count = iov_iter_count(&iter);
975 ret = rw_verify_area(READ, file, &kiocb->ki_pos, iov_count); 967 ret = rw_verify_area(READ, file, &kiocb->ki_pos, iov_count);
@@ -991,38 +983,32 @@ static ssize_t io_read(struct io_kiocb *req, const struct sqe_submit *s,
991 } 983 }
992 } 984 }
993 kfree(iovec); 985 kfree(iovec);
994out_fput:
995 /* Hold on to the file for -EAGAIN */
996 if (unlikely(ret && ret != -EAGAIN))
997 io_fput(req);
998 return ret; 986 return ret;
999} 987}
1000 988
1001static ssize_t io_write(struct io_kiocb *req, const struct sqe_submit *s, 989static int io_write(struct io_kiocb *req, const struct sqe_submit *s,
1002 bool force_nonblock, struct io_submit_state *state) 990 bool force_nonblock, struct io_submit_state *state)
1003{ 991{
1004 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs; 992 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
1005 struct kiocb *kiocb = &req->rw; 993 struct kiocb *kiocb = &req->rw;
1006 struct iov_iter iter; 994 struct iov_iter iter;
1007 struct file *file; 995 struct file *file;
1008 size_t iov_count; 996 size_t iov_count;
1009 ssize_t ret; 997 int ret;
1010 998
1011 ret = io_prep_rw(req, s, force_nonblock, state); 999 ret = io_prep_rw(req, s, force_nonblock, state);
1012 if (ret) 1000 if (ret)
1013 return ret; 1001 return ret;
1014 1002
1015 ret = -EBADF;
1016 file = kiocb->ki_filp; 1003 file = kiocb->ki_filp;
1017 if (unlikely(!(file->f_mode & FMODE_WRITE))) 1004 if (unlikely(!(file->f_mode & FMODE_WRITE)))
1018 goto out_fput; 1005 return -EBADF;
1019 ret = -EINVAL;
1020 if (unlikely(!file->f_op->write_iter)) 1006 if (unlikely(!file->f_op->write_iter))
1021 goto out_fput; 1007 return -EINVAL;
1022 1008
1023 ret = io_import_iovec(req->ctx, WRITE, s, &iovec, &iter); 1009 ret = io_import_iovec(req->ctx, WRITE, s, &iovec, &iter);
1024 if (ret) 1010 if (ret)
1025 goto out_fput; 1011 return ret;
1026 1012
1027 iov_count = iov_iter_count(&iter); 1013 iov_count = iov_iter_count(&iter);
1028 1014
@@ -1054,10 +1040,6 @@ static ssize_t io_write(struct io_kiocb *req, const struct sqe_submit *s,
1054 } 1040 }
1055out_free: 1041out_free:
1056 kfree(iovec); 1042 kfree(iovec);
1057out_fput:
1058 /* Hold on to the file for -EAGAIN */
1059 if (unlikely(ret && ret != -EAGAIN))
1060 io_fput(req);
1061 return ret; 1043 return ret;
1062} 1044}
1063 1045
@@ -1072,29 +1054,19 @@ static int io_nop(struct io_kiocb *req, u64 user_data)
1072 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) 1054 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
1073 return -EINVAL; 1055 return -EINVAL;
1074 1056
1075 /*
1076 * Twilight zone - it's possible that someone issued an opcode that
1077 * has a file attached, then got -EAGAIN on submission, and changed
1078 * the sqe before we retried it from async context. Avoid dropping
1079 * a file reference for this malicious case, and flag the error.
1080 */
1081 if (req->rw.ki_filp) {
1082 err = -EBADF;
1083 io_fput(req);
1084 }
1085 io_cqring_add_event(ctx, user_data, err, 0); 1057 io_cqring_add_event(ctx, user_data, err, 0);
1086 io_free_req(req); 1058 io_put_req(req);
1087 return 0; 1059 return 0;
1088} 1060}
1089 1061
1090static int io_prep_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe) 1062static int io_prep_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1091{ 1063{
1092 struct io_ring_ctx *ctx = req->ctx; 1064 struct io_ring_ctx *ctx = req->ctx;
1093 unsigned flags;
1094 int fd;
1095 1065
1096 /* Prep already done */ 1066 if (!req->file)
1097 if (req->rw.ki_filp) 1067 return -EBADF;
1068 /* Prep already done (EAGAIN retry) */
1069 if (req->flags & REQ_F_PREPPED)
1098 return 0; 1070 return 0;
1099 1071
1100 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) 1072 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
@@ -1102,20 +1074,7 @@ static int io_prep_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1102 if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index)) 1074 if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index))
1103 return -EINVAL; 1075 return -EINVAL;
1104 1076
1105 fd = READ_ONCE(sqe->fd); 1077 req->flags |= REQ_F_PREPPED;
1106 flags = READ_ONCE(sqe->flags);
1107
1108 if (flags & IOSQE_FIXED_FILE) {
1109 if (unlikely(!ctx->user_files || fd >= ctx->nr_user_files))
1110 return -EBADF;
1111 req->rw.ki_filp = ctx->user_files[fd];
1112 req->flags |= REQ_F_FIXED_FILE;
1113 } else {
1114 req->rw.ki_filp = fget(fd);
1115 if (unlikely(!req->rw.ki_filp))
1116 return -EBADF;
1117 }
1118
1119 return 0; 1078 return 0;
1120} 1079}
1121 1080
@@ -1144,9 +1103,8 @@ static int io_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe,
1144 end > 0 ? end : LLONG_MAX, 1103 end > 0 ? end : LLONG_MAX,
1145 fsync_flags & IORING_FSYNC_DATASYNC); 1104 fsync_flags & IORING_FSYNC_DATASYNC);
1146 1105
1147 io_fput(req);
1148 io_cqring_add_event(req->ctx, sqe->user_data, ret, 0); 1106 io_cqring_add_event(req->ctx, sqe->user_data, ret, 0);
1149 io_free_req(req); 1107 io_put_req(req);
1150 return 0; 1108 return 0;
1151} 1109}
1152 1110
@@ -1204,15 +1162,16 @@ static int io_poll_remove(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1204 spin_unlock_irq(&ctx->completion_lock); 1162 spin_unlock_irq(&ctx->completion_lock);
1205 1163
1206 io_cqring_add_event(req->ctx, sqe->user_data, ret, 0); 1164 io_cqring_add_event(req->ctx, sqe->user_data, ret, 0);
1207 io_free_req(req); 1165 io_put_req(req);
1208 return 0; 1166 return 0;
1209} 1167}
1210 1168
1211static void io_poll_complete(struct io_kiocb *req, __poll_t mask) 1169static void io_poll_complete(struct io_ring_ctx *ctx, struct io_kiocb *req,
1170 __poll_t mask)
1212{ 1171{
1213 io_cqring_add_event(req->ctx, req->user_data, mangle_poll(mask), 0); 1172 req->poll.done = true;
1214 io_fput(req); 1173 io_cqring_fill_event(ctx, req->user_data, mangle_poll(mask), 0);
1215 io_free_req(req); 1174 io_commit_cqring(ctx);
1216} 1175}
1217 1176
1218static void io_poll_complete_work(struct work_struct *work) 1177static void io_poll_complete_work(struct work_struct *work)
@@ -1240,9 +1199,11 @@ static void io_poll_complete_work(struct work_struct *work)
1240 return; 1199 return;
1241 } 1200 }
1242 list_del_init(&req->list); 1201 list_del_init(&req->list);
1202 io_poll_complete(ctx, req, mask);
1243 spin_unlock_irq(&ctx->completion_lock); 1203 spin_unlock_irq(&ctx->completion_lock);
1244 1204
1245 io_poll_complete(req, mask); 1205 io_cqring_ev_posted(ctx);
1206 io_put_req(req);
1246} 1207}
1247 1208
1248static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, 1209static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
@@ -1253,29 +1214,25 @@ static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
1253 struct io_kiocb *req = container_of(poll, struct io_kiocb, poll); 1214 struct io_kiocb *req = container_of(poll, struct io_kiocb, poll);
1254 struct io_ring_ctx *ctx = req->ctx; 1215 struct io_ring_ctx *ctx = req->ctx;
1255 __poll_t mask = key_to_poll(key); 1216 __poll_t mask = key_to_poll(key);
1256 1217 unsigned long flags;
1257 poll->woken = true;
1258 1218
1259 /* for instances that support it check for an event match first: */ 1219 /* for instances that support it check for an event match first: */
1260 if (mask) { 1220 if (mask && !(mask & poll->events))
1261 unsigned long flags; 1221 return 0;
1262 1222
1263 if (!(mask & poll->events)) 1223 list_del_init(&poll->wait.entry);
1264 return 0;
1265 1224
1266 /* try to complete the iocb inline if we can: */ 1225 if (mask && spin_trylock_irqsave(&ctx->completion_lock, flags)) {
1267 if (spin_trylock_irqsave(&ctx->completion_lock, flags)) { 1226 list_del(&req->list);
1268 list_del(&req->list); 1227 io_poll_complete(ctx, req, mask);
1269 spin_unlock_irqrestore(&ctx->completion_lock, flags); 1228 spin_unlock_irqrestore(&ctx->completion_lock, flags);
1270 1229
1271 list_del_init(&poll->wait.entry); 1230 io_cqring_ev_posted(ctx);
1272 io_poll_complete(req, mask); 1231 io_put_req(req);
1273 return 1; 1232 } else {
1274 } 1233 queue_work(ctx->sqo_wq, &req->work);
1275 } 1234 }
1276 1235
1277 list_del_init(&poll->wait.entry);
1278 queue_work(ctx->sqo_wq, &req->work);
1279 return 1; 1236 return 1;
1280} 1237}
1281 1238
@@ -1305,36 +1262,23 @@ static int io_poll_add(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1305 struct io_poll_iocb *poll = &req->poll; 1262 struct io_poll_iocb *poll = &req->poll;
1306 struct io_ring_ctx *ctx = req->ctx; 1263 struct io_ring_ctx *ctx = req->ctx;
1307 struct io_poll_table ipt; 1264 struct io_poll_table ipt;
1308 unsigned flags; 1265 bool cancel = false;
1309 __poll_t mask; 1266 __poll_t mask;
1310 u16 events; 1267 u16 events;
1311 int fd;
1312 1268
1313 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) 1269 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
1314 return -EINVAL; 1270 return -EINVAL;
1315 if (sqe->addr || sqe->ioprio || sqe->off || sqe->len || sqe->buf_index) 1271 if (sqe->addr || sqe->ioprio || sqe->off || sqe->len || sqe->buf_index)
1316 return -EINVAL; 1272 return -EINVAL;
1273 if (!poll->file)
1274 return -EBADF;
1317 1275
1318 INIT_WORK(&req->work, io_poll_complete_work); 1276 INIT_WORK(&req->work, io_poll_complete_work);
1319 events = READ_ONCE(sqe->poll_events); 1277 events = READ_ONCE(sqe->poll_events);
1320 poll->events = demangle_poll(events) | EPOLLERR | EPOLLHUP; 1278 poll->events = demangle_poll(events) | EPOLLERR | EPOLLHUP;
1321 1279
1322 flags = READ_ONCE(sqe->flags);
1323 fd = READ_ONCE(sqe->fd);
1324
1325 if (flags & IOSQE_FIXED_FILE) {
1326 if (unlikely(!ctx->user_files || fd >= ctx->nr_user_files))
1327 return -EBADF;
1328 poll->file = ctx->user_files[fd];
1329 req->flags |= REQ_F_FIXED_FILE;
1330 } else {
1331 poll->file = fget(fd);
1332 }
1333 if (unlikely(!poll->file))
1334 return -EBADF;
1335
1336 poll->head = NULL; 1280 poll->head = NULL;
1337 poll->woken = false; 1281 poll->done = false;
1338 poll->canceled = false; 1282 poll->canceled = false;
1339 1283
1340 ipt.pt._qproc = io_poll_queue_proc; 1284 ipt.pt._qproc = io_poll_queue_proc;
@@ -1346,56 +1290,44 @@ static int io_poll_add(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1346 INIT_LIST_HEAD(&poll->wait.entry); 1290 INIT_LIST_HEAD(&poll->wait.entry);
1347 init_waitqueue_func_entry(&poll->wait, io_poll_wake); 1291 init_waitqueue_func_entry(&poll->wait, io_poll_wake);
1348 1292
1349 /* one for removal from waitqueue, one for this function */
1350 refcount_set(&req->refs, 2);
1351
1352 mask = vfs_poll(poll->file, &ipt.pt) & poll->events; 1293 mask = vfs_poll(poll->file, &ipt.pt) & poll->events;
1353 if (unlikely(!poll->head)) {
1354 /* we did not manage to set up a waitqueue, done */
1355 goto out;
1356 }
1357 1294
1358 spin_lock_irq(&ctx->completion_lock); 1295 spin_lock_irq(&ctx->completion_lock);
1359 spin_lock(&poll->head->lock); 1296 if (likely(poll->head)) {
1360 if (poll->woken) { 1297 spin_lock(&poll->head->lock);
1361 /* wake_up context handles the rest */ 1298 if (unlikely(list_empty(&poll->wait.entry))) {
1362 mask = 0; 1299 if (ipt.error)
1300 cancel = true;
1301 ipt.error = 0;
1302 mask = 0;
1303 }
1304 if (mask || ipt.error)
1305 list_del_init(&poll->wait.entry);
1306 else if (cancel)
1307 WRITE_ONCE(poll->canceled, true);
1308 else if (!poll->done) /* actually waiting for an event */
1309 list_add_tail(&req->list, &ctx->cancel_list);
1310 spin_unlock(&poll->head->lock);
1311 }
1312 if (mask) { /* no async, we'd stolen it */
1313 req->error = mangle_poll(mask);
1363 ipt.error = 0; 1314 ipt.error = 0;
1364 } else if (mask || ipt.error) { 1315 io_poll_complete(ctx, req, mask);
1365 /* if we get an error or a mask we are done */
1366 WARN_ON_ONCE(list_empty(&poll->wait.entry));
1367 list_del_init(&poll->wait.entry);
1368 } else {
1369 /* actually waiting for an event */
1370 list_add_tail(&req->list, &ctx->cancel_list);
1371 } 1316 }
1372 spin_unlock(&poll->head->lock);
1373 spin_unlock_irq(&ctx->completion_lock); 1317 spin_unlock_irq(&ctx->completion_lock);
1374 1318
1375out: 1319 if (mask) {
1376 if (unlikely(ipt.error)) { 1320 io_cqring_ev_posted(ctx);
1377 if (!(flags & IOSQE_FIXED_FILE)) 1321 io_put_req(req);
1378 fput(poll->file);
1379 /*
1380 * Drop one of our refs to this req, __io_submit_sqe() will
1381 * drop the other one since we're returning an error.
1382 */
1383 io_free_req(req);
1384 return ipt.error;
1385 } 1322 }
1386 1323 return ipt.error;
1387 if (mask)
1388 io_poll_complete(req, mask);
1389 io_free_req(req);
1390 return 0;
1391} 1324}
1392 1325
1393static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, 1326static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
1394 const struct sqe_submit *s, bool force_nonblock, 1327 const struct sqe_submit *s, bool force_nonblock,
1395 struct io_submit_state *state) 1328 struct io_submit_state *state)
1396{ 1329{
1397 ssize_t ret; 1330 int ret, opcode;
1398 int opcode;
1399 1331
1400 if (unlikely(s->index >= ctx->sq_entries)) 1332 if (unlikely(s->index >= ctx->sq_entries))
1401 return -EINVAL; 1333 return -EINVAL;
@@ -1524,10 +1456,13 @@ restart:
1524 break; 1456 break;
1525 cond_resched(); 1457 cond_resched();
1526 } while (1); 1458 } while (1);
1459
1460 /* drop submission reference */
1461 io_put_req(req);
1527 } 1462 }
1528 if (ret) { 1463 if (ret) {
1529 io_cqring_add_event(ctx, sqe->user_data, ret, 0); 1464 io_cqring_add_event(ctx, sqe->user_data, ret, 0);
1530 io_free_req(req); 1465 io_put_req(req);
1531 } 1466 }
1532 1467
1533 /* async context always use a copy of the sqe */ 1468 /* async context always use a copy of the sqe */
@@ -1614,11 +1549,55 @@ static bool io_add_to_prev_work(struct async_list *list, struct io_kiocb *req)
1614 return ret; 1549 return ret;
1615} 1550}
1616 1551
1552static bool io_op_needs_file(const struct io_uring_sqe *sqe)
1553{
1554 int op = READ_ONCE(sqe->opcode);
1555
1556 switch (op) {
1557 case IORING_OP_NOP:
1558 case IORING_OP_POLL_REMOVE:
1559 return false;
1560 default:
1561 return true;
1562 }
1563}
1564
1565static int io_req_set_file(struct io_ring_ctx *ctx, const struct sqe_submit *s,
1566 struct io_submit_state *state, struct io_kiocb *req)
1567{
1568 unsigned flags;
1569 int fd;
1570
1571 flags = READ_ONCE(s->sqe->flags);
1572 fd = READ_ONCE(s->sqe->fd);
1573
1574 if (!io_op_needs_file(s->sqe)) {
1575 req->file = NULL;
1576 return 0;
1577 }
1578
1579 if (flags & IOSQE_FIXED_FILE) {
1580 if (unlikely(!ctx->user_files ||
1581 (unsigned) fd >= ctx->nr_user_files))
1582 return -EBADF;
1583 req->file = ctx->user_files[fd];
1584 req->flags |= REQ_F_FIXED_FILE;
1585 } else {
1586 if (s->needs_fixed_file)
1587 return -EBADF;
1588 req->file = io_file_get(state, fd);
1589 if (unlikely(!req->file))
1590 return -EBADF;
1591 }
1592
1593 return 0;
1594}
1595
1617static int io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s, 1596static int io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
1618 struct io_submit_state *state) 1597 struct io_submit_state *state)
1619{ 1598{
1620 struct io_kiocb *req; 1599 struct io_kiocb *req;
1621 ssize_t ret; 1600 int ret;
1622 1601
1623 /* enforce forwards compatibility on users */ 1602 /* enforce forwards compatibility on users */
1624 if (unlikely(s->sqe->flags & ~IOSQE_FIXED_FILE)) 1603 if (unlikely(s->sqe->flags & ~IOSQE_FIXED_FILE))
@@ -1628,7 +1607,9 @@ static int io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
1628 if (unlikely(!req)) 1607 if (unlikely(!req))
1629 return -EAGAIN; 1608 return -EAGAIN;
1630 1609
1631 req->rw.ki_filp = NULL; 1610 ret = io_req_set_file(ctx, s, state, req);
1611 if (unlikely(ret))
1612 goto out;
1632 1613
1633 ret = __io_submit_sqe(ctx, req, s, true, state); 1614 ret = __io_submit_sqe(ctx, req, s, true, state);
1634 if (ret == -EAGAIN) { 1615 if (ret == -EAGAIN) {
@@ -1649,11 +1630,23 @@ static int io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
1649 INIT_WORK(&req->work, io_sq_wq_submit_work); 1630 INIT_WORK(&req->work, io_sq_wq_submit_work);
1650 queue_work(ctx->sqo_wq, &req->work); 1631 queue_work(ctx->sqo_wq, &req->work);
1651 } 1632 }
1652 ret = 0; 1633
1634 /*
1635 * Queued up for async execution, worker will release
1636 * submit reference when the iocb is actually
1637 * submitted.
1638 */
1639 return 0;
1653 } 1640 }
1654 } 1641 }
1642
1643out:
1644 /* drop submission reference */
1645 io_put_req(req);
1646
1647 /* and drop final reference, if we failed */
1655 if (ret) 1648 if (ret)
1656 io_free_req(req); 1649 io_put_req(req);
1657 1650
1658 return ret; 1651 return ret;
1659} 1652}
diff --git a/fs/iomap.c b/fs/iomap.c
index 97cb9d486a7d..abdd18e404f8 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -1589,12 +1589,14 @@ static void iomap_dio_bio_end_io(struct bio *bio)
1589 if (should_dirty) { 1589 if (should_dirty) {
1590 bio_check_pages_dirty(bio); 1590 bio_check_pages_dirty(bio);
1591 } else { 1591 } else {
1592 struct bio_vec *bvec; 1592 if (!bio_flagged(bio, BIO_NO_PAGE_REF)) {
1593 int i; 1593 struct bvec_iter_all iter_all;
1594 struct bvec_iter_all iter_all; 1594 struct bio_vec *bvec;
1595 int i;
1595 1596
1596 bio_for_each_segment_all(bvec, bio, i, iter_all) 1597 bio_for_each_segment_all(bvec, bio, i, iter_all)
1597 put_page(bvec->bv_page); 1598 put_page(bvec->bv_page);
1599 }
1598 bio_put(bio); 1600 bio_put(bio);
1599 } 1601 }
1600} 1602}
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 56992b32c6bb..a90bb19dcfa2 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -208,6 +208,7 @@ static int copy_fid_to_user(struct fanotify_event *event, char __user *buf)
208{ 208{
209 struct fanotify_event_info_fid info = { }; 209 struct fanotify_event_info_fid info = { };
210 struct file_handle handle = { }; 210 struct file_handle handle = { };
211 unsigned char bounce[FANOTIFY_INLINE_FH_LEN], *fh;
211 size_t fh_len = event->fh_len; 212 size_t fh_len = event->fh_len;
212 size_t len = fanotify_event_info_len(event); 213 size_t len = fanotify_event_info_len(event);
213 214
@@ -233,7 +234,16 @@ static int copy_fid_to_user(struct fanotify_event *event, char __user *buf)
233 234
234 buf += sizeof(handle); 235 buf += sizeof(handle);
235 len -= sizeof(handle); 236 len -= sizeof(handle);
236 if (copy_to_user(buf, fanotify_event_fh(event), fh_len)) 237 /*
238 * For an inline fh, copy through stack to exclude the copy from
239 * usercopy hardening protections.
240 */
241 fh = fanotify_event_fh(event);
242 if (fh_len <= FANOTIFY_INLINE_FH_LEN) {
243 memcpy(bounce, fh, fh_len);
244 fh = bounce;
245 }
246 if (copy_to_user(buf, fh, fh_len))
237 return -EFAULT; 247 return -EFAULT;
238 248
239 /* Pad with 0's */ 249 /* Pad with 0's */
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index e2901fbb9f76..7b53598c8804 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -519,8 +519,10 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
519 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group); 519 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
520 if (!fsn_mark) 520 if (!fsn_mark)
521 return -ENOENT; 521 return -ENOENT;
522 else if (create) 522 else if (create) {
523 return -EEXIST; 523 ret = -EEXIST;
524 goto out;
525 }
524 526
525 i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark); 527 i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
526 528
@@ -548,6 +550,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
548 /* return the wd */ 550 /* return the wd */
549 ret = i_mark->wd; 551 ret = i_mark->wd;
550 552
553out:
551 /* match the get from fsnotify_find_mark() */ 554 /* match the get from fsnotify_find_mark() */
552 fsnotify_put_mark(fsn_mark); 555 fsnotify_put_mark(fsn_mark);
553 556
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index ae796e10f68b..e7276932e433 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1242,8 +1242,10 @@ set_size:
1242 truncate_setsize(inode, newsize); 1242 truncate_setsize(inode, newsize);
1243 down_write(&iinfo->i_data_sem); 1243 down_write(&iinfo->i_data_sem);
1244 udf_clear_extent_cache(inode); 1244 udf_clear_extent_cache(inode);
1245 udf_truncate_extents(inode); 1245 err = udf_truncate_extents(inode);
1246 up_write(&iinfo->i_data_sem); 1246 up_write(&iinfo->i_data_sem);
1247 if (err)
1248 return err;
1247 } 1249 }
1248update_time: 1250update_time:
1249 inode->i_mtime = inode->i_ctime = current_time(inode); 1251 inode->i_mtime = inode->i_ctime = current_time(inode);
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index b647f0bd150c..63a47f1e1d52 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -199,7 +199,7 @@ static void udf_update_alloc_ext_desc(struct inode *inode,
199 * for making file shorter. For making file longer, udf_extend_file() has to 199 * for making file shorter. For making file longer, udf_extend_file() has to
200 * be used. 200 * be used.
201 */ 201 */
202void udf_truncate_extents(struct inode *inode) 202int udf_truncate_extents(struct inode *inode)
203{ 203{
204 struct extent_position epos; 204 struct extent_position epos;
205 struct kernel_lb_addr eloc, neloc = {}; 205 struct kernel_lb_addr eloc, neloc = {};
@@ -224,7 +224,7 @@ void udf_truncate_extents(struct inode *inode)
224 if (etype == -1) { 224 if (etype == -1) {
225 /* We should extend the file? */ 225 /* We should extend the file? */
226 WARN_ON(byte_offset); 226 WARN_ON(byte_offset);
227 return; 227 return 0;
228 } 228 }
229 epos.offset -= adsize; 229 epos.offset -= adsize;
230 extent_trunc(inode, &epos, &eloc, etype, elen, byte_offset); 230 extent_trunc(inode, &epos, &eloc, etype, elen, byte_offset);
@@ -260,6 +260,9 @@ void udf_truncate_extents(struct inode *inode)
260 epos.block = eloc; 260 epos.block = eloc;
261 epos.bh = udf_tread(sb, 261 epos.bh = udf_tread(sb,
262 udf_get_lb_pblock(sb, &eloc, 0)); 262 udf_get_lb_pblock(sb, &eloc, 0));
263 /* Error reading indirect block? */
264 if (!epos.bh)
265 return -EIO;
263 if (elen) 266 if (elen)
264 indirect_ext_len = 267 indirect_ext_len =
265 (elen + sb->s_blocksize - 1) >> 268 (elen + sb->s_blocksize - 1) >>
@@ -283,4 +286,5 @@ void udf_truncate_extents(struct inode *inode)
283 iinfo->i_lenExtents = inode->i_size; 286 iinfo->i_lenExtents = inode->i_size;
284 287
285 brelse(epos.bh); 288 brelse(epos.bh);
289 return 0;
286} 290}
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index ee246769dee4..d89ef71887fc 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -235,7 +235,7 @@ extern struct inode *udf_new_inode(struct inode *, umode_t);
235/* truncate.c */ 235/* truncate.c */
236extern void udf_truncate_tail_extent(struct inode *); 236extern void udf_truncate_tail_extent(struct inode *);
237extern void udf_discard_prealloc(struct inode *); 237extern void udf_discard_prealloc(struct inode *);
238extern void udf_truncate_extents(struct inode *); 238extern int udf_truncate_extents(struct inode *);
239 239
240/* balloc.c */ 240/* balloc.c */
241extern void udf_free_blocks(struct super_block *, struct inode *, 241extern void udf_free_blocks(struct super_block *, struct inode *,
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index b0c814bcc7e3..cb2aa7ecafff 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -57,7 +57,6 @@ struct blk_mq_hw_ctx {
57 unsigned int queue_num; 57 unsigned int queue_num;
58 58
59 atomic_t nr_active; 59 atomic_t nr_active;
60 unsigned int nr_expired;
61 60
62 struct hlist_node cpuhp_dead; 61 struct hlist_node cpuhp_dead;
63 struct kobject kobj; 62 struct kobject kobj;
@@ -300,8 +299,6 @@ void blk_mq_end_request(struct request *rq, blk_status_t error);
300void __blk_mq_end_request(struct request *rq, blk_status_t error); 299void __blk_mq_end_request(struct request *rq, blk_status_t error);
301 300
302void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list); 301void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
303void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
304 bool kick_requeue_list);
305void blk_mq_kick_requeue_list(struct request_queue *q); 302void blk_mq_kick_requeue_list(struct request_queue *q);
306void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs); 303void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
307bool blk_mq_complete_request(struct request *rq); 304bool blk_mq_complete_request(struct request *rq);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index d66bf5f32610..791fee35df88 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -215,6 +215,7 @@ struct bio {
215/* 215/*
216 * bio flags 216 * bio flags
217 */ 217 */
218#define BIO_NO_PAGE_REF 0 /* don't put release vec pages */
218#define BIO_SEG_VALID 1 /* bi_phys_segments valid */ 219#define BIO_SEG_VALID 1 /* bi_phys_segments valid */
219#define BIO_CLONED 2 /* doesn't own data */ 220#define BIO_CLONED 2 /* doesn't own data */
220#define BIO_BOUNCED 3 /* bio is a bounce bio */ 221#define BIO_BOUNCED 3 /* bio is a bounce bio */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0de92b29f589..5c58a3b2bf00 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -50,6 +50,9 @@ struct blk_stat_callback;
50/* Must be consistent with blk_mq_poll_stats_bkt() */ 50/* Must be consistent with blk_mq_poll_stats_bkt() */
51#define BLK_MQ_POLL_STATS_BKTS 16 51#define BLK_MQ_POLL_STATS_BKTS 16
52 52
53/* Doing classic polling */
54#define BLK_MQ_POLL_CLASSIC -1
55
53/* 56/*
54 * Maximum number of blkcg policies allowed to be registered concurrently. 57 * Maximum number of blkcg policies allowed to be registered concurrently.
55 * Defined here to simplify include dependency. 58 * Defined here to simplify include dependency.
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index a420c07904bc..337d5049ff93 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -294,6 +294,8 @@ extern void ceph_destroy_client(struct ceph_client *client);
294extern int __ceph_open_session(struct ceph_client *client, 294extern int __ceph_open_session(struct ceph_client *client,
295 unsigned long started); 295 unsigned long started);
296extern int ceph_open_session(struct ceph_client *client); 296extern int ceph_open_session(struct ceph_client *client);
297int ceph_wait_for_latest_osdmap(struct ceph_client *client,
298 unsigned long timeout);
297 299
298/* pagevec.c */ 300/* pagevec.c */
299extern void ceph_release_page_vector(struct page **pages, int num_pages); 301extern void ceph_release_page_vector(struct page **pages, int num_pages);
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index b26ea9077384..0343c81d4c5f 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -557,7 +557,8 @@ static inline struct mlx5_core_mkey *__mlx5_mr_lookup(struct mlx5_core_dev *dev,
557 557
558int mlx5_core_create_dct(struct mlx5_core_dev *dev, 558int mlx5_core_create_dct(struct mlx5_core_dev *dev,
559 struct mlx5_core_dct *qp, 559 struct mlx5_core_dct *qp,
560 u32 *in, int inlen); 560 u32 *in, int inlen,
561 u32 *out, int outlen);
561int mlx5_core_create_qp(struct mlx5_core_dev *dev, 562int mlx5_core_create_qp(struct mlx5_core_dev *dev,
562 struct mlx5_core_qp *qp, 563 struct mlx5_core_qp *qp,
563 u32 *in, 564 u32 *in,
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index 14d558146aea..20f3e3f029b9 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -330,7 +330,7 @@ static inline void sbitmap_clear_bit(struct sbitmap *sb, unsigned int bitnr)
330/* 330/*
331 * This one is special, since it doesn't actually clear the bit, rather it 331 * This one is special, since it doesn't actually clear the bit, rather it
332 * sets the corresponding bit in the ->cleared mask instead. Paired with 332 * sets the corresponding bit in the ->cleared mask instead. Paired with
333 * the caller doing sbitmap_batch_clear() if a given index is full, which 333 * the caller doing sbitmap_deferred_clear() if a given index is full, which
334 * will clear the previously freed entries in the corresponding ->word. 334 * will clear the previously freed entries in the corresponding ->word.
335 */ 335 */
336static inline void sbitmap_deferred_clear_bit(struct sbitmap *sb, unsigned int bitnr) 336static inline void sbitmap_deferred_clear_bit(struct sbitmap *sb, unsigned int bitnr)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 87477e1640f9..f184af1999a8 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -23,14 +23,23 @@ struct kvec {
23}; 23};
24 24
25enum iter_type { 25enum iter_type {
26 ITER_IOVEC = 0, 26 /* set if ITER_BVEC doesn't hold a bv_page ref */
27 ITER_KVEC = 2, 27 ITER_BVEC_FLAG_NO_REF = 2,
28 ITER_BVEC = 4, 28
29 ITER_PIPE = 8, 29 /* iter types */
30 ITER_DISCARD = 16, 30 ITER_IOVEC = 4,
31 ITER_KVEC = 8,
32 ITER_BVEC = 16,
33 ITER_PIPE = 32,
34 ITER_DISCARD = 64,
31}; 35};
32 36
33struct iov_iter { 37struct iov_iter {
38 /*
39 * Bit 0 is the read/write bit, set if we're writing.
40 * Bit 1 is the BVEC_FLAG_NO_REF bit, set if type is a bvec and
41 * the caller isn't expecting to drop a page reference when done.
42 */
34 unsigned int type; 43 unsigned int type;
35 size_t iov_offset; 44 size_t iov_offset;
36 size_t count; 45 size_t count;
@@ -84,6 +93,11 @@ static inline unsigned char iov_iter_rw(const struct iov_iter *i)
84 return i->type & (READ | WRITE); 93 return i->type & (READ | WRITE);
85} 94}
86 95
96static inline bool iov_iter_bvec_no_ref(const struct iov_iter *i)
97{
98 return (i->type & ITER_BVEC_FLAG_NO_REF) != 0;
99}
100
87/* 101/*
88 * Total number of bytes covered by an iovec. 102 * Total number of bytes covered by an iovec.
89 * 103 *
diff --git a/include/misc/charlcd.h b/include/misc/charlcd.h
index 23f61850f363..1832402324ce 100644
--- a/include/misc/charlcd.h
+++ b/include/misc/charlcd.h
@@ -35,6 +35,7 @@ struct charlcd_ops {
35}; 35};
36 36
37struct charlcd *charlcd_alloc(unsigned int drvdata_size); 37struct charlcd *charlcd_alloc(unsigned int drvdata_size);
38void charlcd_free(struct charlcd *lcd);
38 39
39int charlcd_register(struct charlcd *lcd); 40int charlcd_register(struct charlcd *lcd);
40int charlcd_unregister(struct charlcd *lcd); 41int charlcd_unregister(struct charlcd *lcd);
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 8fbfda94a67b..403c9bd90413 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -42,9 +42,9 @@ int __read_mostly watchdog_user_enabled = 1;
42int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT; 42int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT;
43int __read_mostly soft_watchdog_user_enabled = 1; 43int __read_mostly soft_watchdog_user_enabled = 1;
44int __read_mostly watchdog_thresh = 10; 44int __read_mostly watchdog_thresh = 10;
45int __read_mostly nmi_watchdog_available; 45static int __read_mostly nmi_watchdog_available;
46 46
47struct cpumask watchdog_allowed_mask __read_mostly; 47static struct cpumask watchdog_allowed_mask __read_mostly;
48 48
49struct cpumask watchdog_cpumask __read_mostly; 49struct cpumask watchdog_cpumask __read_mostly;
50unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask); 50unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 9cab80207ced..79eac465ec65 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -738,7 +738,6 @@ int __ceph_open_session(struct ceph_client *client, unsigned long started)
738} 738}
739EXPORT_SYMBOL(__ceph_open_session); 739EXPORT_SYMBOL(__ceph_open_session);
740 740
741
742int ceph_open_session(struct ceph_client *client) 741int ceph_open_session(struct ceph_client *client)
743{ 742{
744 int ret; 743 int ret;
@@ -754,6 +753,23 @@ int ceph_open_session(struct ceph_client *client)
754} 753}
755EXPORT_SYMBOL(ceph_open_session); 754EXPORT_SYMBOL(ceph_open_session);
756 755
756int ceph_wait_for_latest_osdmap(struct ceph_client *client,
757 unsigned long timeout)
758{
759 u64 newest_epoch;
760 int ret;
761
762 ret = ceph_monc_get_version(&client->monc, "osdmap", &newest_epoch);
763 if (ret)
764 return ret;
765
766 if (client->osdc.osdmap->epoch >= newest_epoch)
767 return 0;
768
769 ceph_osdc_maybe_request_map(&client->osdc);
770 return ceph_monc_wait_osdmap(&client->monc, newest_epoch, timeout);
771}
772EXPORT_SYMBOL(ceph_wait_for_latest_osdmap);
757 773
758static int __init init_ceph_lib(void) 774static int __init init_ceph_lib(void)
759{ 775{
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 18deb3d889c4..a53e4fbb6319 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -922,6 +922,15 @@ int ceph_monc_blacklist_add(struct ceph_mon_client *monc,
922 mutex_unlock(&monc->mutex); 922 mutex_unlock(&monc->mutex);
923 923
924 ret = wait_generic_request(req); 924 ret = wait_generic_request(req);
925 if (!ret)
926 /*
927 * Make sure we have the osdmap that includes the blacklist
928 * entry. This is needed to ensure that the OSDs pick up the
929 * new blacklist before processing any future requests from
930 * this client.
931 */
932 ret = ceph_wait_for_latest_osdmap(monc->client, 0);
933
925out: 934out:
926 put_generic_request(req); 935 put_generic_request(req);
927 return ret; 936 return ret;
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 6b576e588725..daecdfb15a9c 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -828,9 +828,11 @@ void policydb_destroy(struct policydb *p)
828 hashtab_map(p->range_tr, range_tr_destroy, NULL); 828 hashtab_map(p->range_tr, range_tr_destroy, NULL);
829 hashtab_destroy(p->range_tr); 829 hashtab_destroy(p->range_tr);
830 830
831 for (i = 0; i < p->p_types.nprim; i++) 831 if (p->type_attr_map_array) {
832 ebitmap_destroy(&p->type_attr_map_array[i]); 832 for (i = 0; i < p->p_types.nprim; i++)
833 kvfree(p->type_attr_map_array); 833 ebitmap_destroy(&p->type_attr_map_array[i]);
834 kvfree(p->type_attr_map_array);
835 }
834 836
835 ebitmap_destroy(&p->filename_trans_ttypes); 837 ebitmap_destroy(&p->filename_trans_ttypes);
836 ebitmap_destroy(&p->policycaps); 838 ebitmap_destroy(&p->policycaps);
@@ -2496,10 +2498,13 @@ int policydb_read(struct policydb *p, void *fp)
2496 if (!p->type_attr_map_array) 2498 if (!p->type_attr_map_array)
2497 goto bad; 2499 goto bad;
2498 2500
2501 /* just in case ebitmap_init() becomes more than just a memset(0): */
2502 for (i = 0; i < p->p_types.nprim; i++)
2503 ebitmap_init(&p->type_attr_map_array[i]);
2504
2499 for (i = 0; i < p->p_types.nprim; i++) { 2505 for (i = 0; i < p->p_types.nprim; i++) {
2500 struct ebitmap *e = &p->type_attr_map_array[i]; 2506 struct ebitmap *e = &p->type_attr_map_array[i];
2501 2507
2502 ebitmap_init(e);
2503 if (p->policyvers >= POLICYDB_VERSION_AVTAB) { 2508 if (p->policyvers >= POLICYDB_VERSION_AVTAB) {
2504 rc = ebitmap_read(e, fp); 2509 rc = ebitmap_read(e, fp);
2505 if (rc) 2510 if (rc)
diff --git a/sound/drivers/opl3/opl3_voice.h b/sound/drivers/opl3/opl3_voice.h
index 5b02bd49fde4..4e4ecc21760b 100644
--- a/sound/drivers/opl3/opl3_voice.h
+++ b/sound/drivers/opl3/opl3_voice.h
@@ -41,7 +41,7 @@ void snd_opl3_timer_func(struct timer_list *t);
41 41
42/* Prototypes for opl3_drums.c */ 42/* Prototypes for opl3_drums.c */
43void snd_opl3_load_drums(struct snd_opl3 *opl3); 43void snd_opl3_load_drums(struct snd_opl3 *opl3);
44void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int on_off, int vel, struct snd_midi_channel *chan); 44void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int vel, int on_off, struct snd_midi_channel *chan);
45 45
46/* Prototypes for opl3_oss.c */ 46/* Prototypes for opl3_oss.c */
47#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 47#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c
index 220e61926ea4..513291ba0ab0 100644
--- a/sound/firewire/motu/motu.c
+++ b/sound/firewire/motu/motu.c
@@ -36,7 +36,7 @@ static void name_card(struct snd_motu *motu)
36 fw_csr_iterator_init(&it, motu->unit->directory); 36 fw_csr_iterator_init(&it, motu->unit->directory);
37 while (fw_csr_iterator_next(&it, &key, &val)) { 37 while (fw_csr_iterator_next(&it, &key, &val)) {
38 switch (key) { 38 switch (key) {
39 case CSR_VERSION: 39 case CSR_MODEL:
40 version = val; 40 version = val;
41 break; 41 break;
42 } 42 }
@@ -46,7 +46,7 @@ static void name_card(struct snd_motu *motu)
46 strcpy(motu->card->shortname, motu->spec->name); 46 strcpy(motu->card->shortname, motu->spec->name);
47 strcpy(motu->card->mixername, motu->spec->name); 47 strcpy(motu->card->mixername, motu->spec->name);
48 snprintf(motu->card->longname, sizeof(motu->card->longname), 48 snprintf(motu->card->longname, sizeof(motu->card->longname),
49 "MOTU %s (version:%d), GUID %08x%08x at %s, S%d", 49 "MOTU %s (version:%06x), GUID %08x%08x at %s, S%d",
50 motu->spec->name, version, 50 motu->spec->name, version,
51 fw_dev->config_rom[3], fw_dev->config_rom[4], 51 fw_dev->config_rom[3], fw_dev->config_rom[4],
52 dev_name(&motu->unit->device), 100 << fw_dev->max_speed); 52 dev_name(&motu->unit->device), 100 << fw_dev->max_speed);
@@ -237,20 +237,20 @@ static const struct snd_motu_spec motu_audio_express = {
237#define SND_MOTU_DEV_ENTRY(model, data) \ 237#define SND_MOTU_DEV_ENTRY(model, data) \
238{ \ 238{ \
239 .match_flags = IEEE1394_MATCH_VENDOR_ID | \ 239 .match_flags = IEEE1394_MATCH_VENDOR_ID | \
240 IEEE1394_MATCH_MODEL_ID | \ 240 IEEE1394_MATCH_SPECIFIER_ID | \
241 IEEE1394_MATCH_SPECIFIER_ID, \ 241 IEEE1394_MATCH_VERSION, \
242 .vendor_id = OUI_MOTU, \ 242 .vendor_id = OUI_MOTU, \
243 .model_id = model, \
244 .specifier_id = OUI_MOTU, \ 243 .specifier_id = OUI_MOTU, \
244 .version = model, \
245 .driver_data = (kernel_ulong_t)data, \ 245 .driver_data = (kernel_ulong_t)data, \
246} 246}
247 247
248static const struct ieee1394_device_id motu_id_table[] = { 248static const struct ieee1394_device_id motu_id_table[] = {
249 SND_MOTU_DEV_ENTRY(0x101800, &motu_828mk2), 249 SND_MOTU_DEV_ENTRY(0x000003, &motu_828mk2),
250 SND_MOTU_DEV_ENTRY(0x107800, &snd_motu_spec_traveler), 250 SND_MOTU_DEV_ENTRY(0x000009, &snd_motu_spec_traveler),
251 SND_MOTU_DEV_ENTRY(0x106800, &motu_828mk3), /* FireWire only. */ 251 SND_MOTU_DEV_ENTRY(0x000015, &motu_828mk3), /* FireWire only. */
252 SND_MOTU_DEV_ENTRY(0x100800, &motu_828mk3), /* Hybrid. */ 252 SND_MOTU_DEV_ENTRY(0x000035, &motu_828mk3), /* Hybrid. */
253 SND_MOTU_DEV_ENTRY(0x104800, &motu_audio_express), 253 SND_MOTU_DEV_ENTRY(0x000033, &motu_audio_express),
254 { } 254 { }
255}; 255};
256MODULE_DEVICE_TABLE(ieee1394, motu_id_table); 256MODULE_DEVICE_TABLE(ieee1394, motu_id_table);
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index aa2a83eb81a9..dc27a480c2d9 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -111,6 +111,10 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
111 111
112 /* block the 0x388 port to avoid PnP conflicts */ 112 /* block the 0x388 port to avoid PnP conflicts */
113 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); 113 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
114 if (!acard->fm_res) {
115 err = -EBUSY;
116 goto _err;
117 }
114 118
115 if (port[dev] != SNDRV_AUTO_PORT) { 119 if (port[dev] != SNDRV_AUTO_PORT) {
116 if ((err = snd_sbdsp_create(card, port[dev], irq[dev], 120 if ((err = snd_sbdsp_create(card, port[dev], irq[dev],
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index ea876b0b02b9..dc0084dc8550 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1952,6 +1952,11 @@ static int snd_echo_create(struct snd_card *card,
1952 } 1952 }
1953 chip->dsp_registers = (volatile u32 __iomem *) 1953 chip->dsp_registers = (volatile u32 __iomem *)
1954 ioremap_nocache(chip->dsp_registers_phys, sz); 1954 ioremap_nocache(chip->dsp_registers_phys, sz);
1955 if (!chip->dsp_registers) {
1956 dev_err(chip->card->dev, "ioremap failed\n");
1957 snd_echo_free(chip);
1958 return -ENOMEM;
1959 }
1955 1960
1956 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, 1961 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
1957 KBUILD_MODNAME, chip)) { 1962 KBUILD_MODNAME, chip)) {
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 5f2005098a60..ec0b8595eb4d 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2939,6 +2939,20 @@ static int hda_codec_runtime_resume(struct device *dev)
2939#endif /* CONFIG_PM */ 2939#endif /* CONFIG_PM */
2940 2940
2941#ifdef CONFIG_PM_SLEEP 2941#ifdef CONFIG_PM_SLEEP
2942static int hda_codec_force_resume(struct device *dev)
2943{
2944 int ret;
2945
2946 /* The get/put pair below enforces the runtime resume even if the
2947 * device hasn't been used at suspend time. This trick is needed to
2948 * update the jack state change during the sleep.
2949 */
2950 pm_runtime_get_noresume(dev);
2951 ret = pm_runtime_force_resume(dev);
2952 pm_runtime_put(dev);
2953 return ret;
2954}
2955
2942static int hda_codec_pm_suspend(struct device *dev) 2956static int hda_codec_pm_suspend(struct device *dev)
2943{ 2957{
2944 dev->power.power_state = PMSG_SUSPEND; 2958 dev->power.power_state = PMSG_SUSPEND;
@@ -2948,7 +2962,7 @@ static int hda_codec_pm_suspend(struct device *dev)
2948static int hda_codec_pm_resume(struct device *dev) 2962static int hda_codec_pm_resume(struct device *dev)
2949{ 2963{
2950 dev->power.power_state = PMSG_RESUME; 2964 dev->power.power_state = PMSG_RESUME;
2951 return pm_runtime_force_resume(dev); 2965 return hda_codec_force_resume(dev);
2952} 2966}
2953 2967
2954static int hda_codec_pm_freeze(struct device *dev) 2968static int hda_codec_pm_freeze(struct device *dev)
@@ -2960,13 +2974,13 @@ static int hda_codec_pm_freeze(struct device *dev)
2960static int hda_codec_pm_thaw(struct device *dev) 2974static int hda_codec_pm_thaw(struct device *dev)
2961{ 2975{
2962 dev->power.power_state = PMSG_THAW; 2976 dev->power.power_state = PMSG_THAW;
2963 return pm_runtime_force_resume(dev); 2977 return hda_codec_force_resume(dev);
2964} 2978}
2965 2979
2966static int hda_codec_pm_restore(struct device *dev) 2980static int hda_codec_pm_restore(struct device *dev)
2967{ 2981{
2968 dev->power.power_state = PMSG_RESTORE; 2982 dev->power.power_state = PMSG_RESTORE;
2969 return pm_runtime_force_resume(dev); 2983 return hda_codec_force_resume(dev);
2970} 2984}
2971#endif /* CONFIG_PM_SLEEP */ 2985#endif /* CONFIG_PM_SLEEP */
2972 2986
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e5c49003e75f..ece256a3b48f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -947,7 +947,7 @@ static void __azx_runtime_suspend(struct azx *chip)
947 display_power(chip, false); 947 display_power(chip, false);
948} 948}
949 949
950static void __azx_runtime_resume(struct azx *chip) 950static void __azx_runtime_resume(struct azx *chip, bool from_rt)
951{ 951{
952 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 952 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
953 struct hdac_bus *bus = azx_bus(chip); 953 struct hdac_bus *bus = azx_bus(chip);
@@ -964,7 +964,7 @@ static void __azx_runtime_resume(struct azx *chip)
964 azx_init_pci(chip); 964 azx_init_pci(chip);
965 hda_intel_init_chip(chip, true); 965 hda_intel_init_chip(chip, true);
966 966
967 if (status) { 967 if (status && from_rt) {
968 list_for_each_codec(codec, &chip->bus) 968 list_for_each_codec(codec, &chip->bus)
969 if (status & (1 << codec->addr)) 969 if (status & (1 << codec->addr))
970 schedule_delayed_work(&codec->jackpoll_work, 970 schedule_delayed_work(&codec->jackpoll_work,
@@ -1016,7 +1016,7 @@ static int azx_resume(struct device *dev)
1016 chip->msi = 0; 1016 chip->msi = 0;
1017 if (azx_acquire_irq(chip, 1) < 0) 1017 if (azx_acquire_irq(chip, 1) < 0)
1018 return -EIO; 1018 return -EIO;
1019 __azx_runtime_resume(chip); 1019 __azx_runtime_resume(chip, false);
1020 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1020 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1021 1021
1022 trace_azx_resume(chip); 1022 trace_azx_resume(chip);
@@ -1081,7 +1081,7 @@ static int azx_runtime_resume(struct device *dev)
1081 chip = card->private_data; 1081 chip = card->private_data;
1082 if (!azx_has_pm_runtime(chip)) 1082 if (!azx_has_pm_runtime(chip))
1083 return 0; 1083 return 0;
1084 __azx_runtime_resume(chip); 1084 __azx_runtime_resume(chip, true);
1085 1085
1086 /* disable controller Wake Up event*/ 1086 /* disable controller Wake Up event*/
1087 azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & 1087 azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
@@ -2144,10 +2144,12 @@ static struct snd_pci_quirk power_save_blacklist[] = {
2144 SND_PCI_QUIRK(0x8086, 0x2057, "Intel NUC5i7RYB", 0), 2144 SND_PCI_QUIRK(0x8086, 0x2057, "Intel NUC5i7RYB", 0),
2145 /* https://bugzilla.redhat.com/show_bug.cgi?id=1520902 */ 2145 /* https://bugzilla.redhat.com/show_bug.cgi?id=1520902 */
2146 SND_PCI_QUIRK(0x8086, 0x2068, "Intel NUC7i3BNB", 0), 2146 SND_PCI_QUIRK(0x8086, 0x2068, "Intel NUC7i3BNB", 0),
2147 /* https://bugzilla.redhat.com/show_bug.cgi?id=1572975 */
2148 SND_PCI_QUIRK(0x17aa, 0x36a7, "Lenovo C50 All in one", 0),
2149 /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */ 2147 /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */
2150 SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0), 2148 SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0),
2149 /* https://bugzilla.redhat.com/show_bug.cgi?id=1689623 */
2150 SND_PCI_QUIRK(0x17aa, 0x367b, "Lenovo IdeaCentre B550", 0),
2151 /* https://bugzilla.redhat.com/show_bug.cgi?id=1572975 */
2152 SND_PCI_QUIRK(0x17aa, 0x36a7, "Lenovo C50 All in one", 0),
2151 {} 2153 {}
2152}; 2154};
2153#endif /* CONFIG_PM */ 2155#endif /* CONFIG_PM */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 384719d5c44e..191830d4fa40 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5687,6 +5687,7 @@ enum {
5687 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE, 5687 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5688 ALC225_FIXUP_WYSE_AUTO_MUTE, 5688 ALC225_FIXUP_WYSE_AUTO_MUTE,
5689 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF, 5689 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
5690 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
5690}; 5691};
5691 5692
5692static const struct hda_fixup alc269_fixups[] = { 5693static const struct hda_fixup alc269_fixups[] = {
@@ -6685,6 +6686,16 @@ static const struct hda_fixup alc269_fixups[] = {
6685 .chained = true, 6686 .chained = true,
6686 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC 6687 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6687 }, 6688 },
6689 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
6690 .type = HDA_FIXUP_VERBS,
6691 .v.verbs = (const struct hda_verb[]) {
6692 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
6693 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
6694 { }
6695 },
6696 .chained = true,
6697 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
6698 },
6688}; 6699};
6689 6700
6690static const struct snd_pci_quirk alc269_fixup_tbl[] = { 6701static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6701,9 +6712,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6701 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), 6712 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6702 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), 6713 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6703 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK), 6714 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6704 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), 6715 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6705 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), 6716 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6706 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), 6717 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6707 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), 6718 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
6708 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 6719 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6709 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), 6720 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 0414a0d52262..5dde107083c6 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2184,9 +2184,10 @@ static void cleanup(struct objtool_file *file)
2184 elf_close(file->elf); 2184 elf_close(file->elf);
2185} 2185}
2186 2186
2187static struct objtool_file file;
2188
2187int check(const char *_objname, bool orc) 2189int check(const char *_objname, bool orc)
2188{ 2190{
2189 struct objtool_file file;
2190 int ret, warnings = 0; 2191 int ret, warnings = 0;
2191 2192
2192 objname = _objname; 2193 objname = _objname;
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 9327c0ddc3a5..c3fad065c89c 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5077,6 +5077,9 @@ int fork_it(char **argv)
5077 signal(SIGQUIT, SIG_IGN); 5077 signal(SIGQUIT, SIG_IGN);
5078 if (waitpid(child_pid, &status, 0) == -1) 5078 if (waitpid(child_pid, &status, 0) == -1)
5079 err(status, "waitpid"); 5079 err(status, "waitpid");
5080
5081 if (WIFEXITED(status))
5082 status = WEXITSTATUS(status);
5080 } 5083 }
5081 /* 5084 /*
5082 * n.b. fork_it() does not check for errors from for_all_cpus() 5085 * n.b. fork_it() does not check for errors from for_all_cpus()