aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-10-23 00:57:50 -0400
committerTakashi Iwai <tiwai@suse.de>2015-10-23 00:57:50 -0400
commit274035751e25ee15a064e43cde7b4e7a9b75d921 (patch)
treebf5f3f18f14855043324ef02a116532d866e3dac
parent53e597b1d194910bef53ed0632da329fef497904 (diff)
parenta5be88f63eaff1c03774aecd7388015cb87f6b2c (diff)
Merge branch 'topic/hw-constraint-single' into for-next
-rw-r--r--Documentation/device-mapper/snapshot.txt10
-rw-r--r--Documentation/devicetree/bindings/spi/sh-msiof.txt2
-rw-r--r--Documentation/devicetree/bindings/usb/renesas_usbhs.txt1
-rw-r--r--MAINTAINERS29
-rw-r--r--Makefile4
-rw-r--r--arch/alpha/include/asm/word-at-a-time.h2
-rw-r--r--arch/arm/boot/dts/Makefile2
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi1
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts1
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi1
-rw-r--r--arch/arm/boot/dts/imx53-qsrb.dts2
-rw-r--r--arch/arm/boot/dts/imx53.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-rex.dtsi2
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi1
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi1
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi2
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c27
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h6
-rw-r--r--arch/arm64/Makefile2
-rw-r--r--arch/arm64/include/asm/unistd.h2
-rw-r--r--arch/arm64/include/asm/unistd32.h9
-rw-r--r--arch/arm64/include/uapi/asm/signal.h3
-rw-r--r--arch/arm64/kernel/debug-monitors.c23
-rw-r--r--arch/arm64/kernel/insn.c6
-rw-r--r--arch/arm64/kernel/setup.c2
-rw-r--r--arch/arm64/mm/fault.c1
-rw-r--r--arch/h8300/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/io.h1
-rw-r--r--arch/mips/include/uapi/asm/swab.h19
-rw-r--r--arch/powerpc/configs/ppc64_defconfig2
-rw-r--r--arch/powerpc/configs/pseries_defconfig2
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/machdep.h9
-rw-r--r--arch/powerpc/include/asm/word-at-a-time.h5
-rw-r--r--arch/powerpc/mm/hash_native_64.c23
-rw-r--r--arch/powerpc/platforms/powernv/opal.c7
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c5
-rw-r--r--arch/s390/boot/compressed/Makefile2
-rw-r--r--arch/s390/configs/default_defconfig2
-rw-r--r--arch/s390/configs/gcov_defconfig2
-rw-r--r--arch/s390/configs/performance_defconfig2
-rw-r--r--arch/s390/include/asm/numa.h2
-rw-r--r--arch/s390/include/asm/topology.h2
-rw-r--r--arch/s390/kernel/asm-offsets.c1
-rw-r--r--arch/s390/kernel/entry.S30
-rw-r--r--arch/s390/kernel/vtime.c66
-rw-r--r--arch/s390/numa/mode_emu.c4
-rw-r--r--arch/s390/numa/numa.c4
-rw-r--r--arch/sh/include/asm/page.h1
-rw-r--r--arch/sparc/crypto/aes_glue.c2
-rw-r--r--arch/sparc/crypto/camellia_glue.c1
-rw-r--r--arch/sparc/crypto/des_glue.c2
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/word-at-a-time.h8
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/crypto/camellia_aesni_avx_glue.c5
-rw-r--r--arch/x86/include/asm/kvm_host.h6
-rw-r--r--arch/x86/include/asm/xen/hypercall.h4
-rw-r--r--arch/x86/kvm/emulate.c10
-rw-r--r--arch/x86/kvm/vmx.c26
-rw-r--r--arch/x86/kvm/x86.c135
-rw-r--r--arch/x86/xen/enlighten.c24
-rw-r--r--arch/x86/xen/p2m.c19
-rw-r--r--arch/x86/xen/setup.c4
-rw-r--r--crypto/ahash.c3
-rw-r--r--drivers/acpi/acpica/acglobal.h1
-rw-r--r--drivers/acpi/acpica/actables.h4
-rw-r--r--drivers/acpi/acpica/evxfevnt.c2
-rw-r--r--drivers/acpi/acpica/tbfadt.c10
-rw-r--r--drivers/acpi/acpica/tbutils.c26
-rw-r--r--drivers/base/power/domain_governor.c22
-rw-r--r--drivers/base/regmap/regmap-debugfs.c5
-rw-r--r--drivers/block/rbd.c10
-rw-r--r--drivers/bus/Kconfig1
-rw-r--r--drivers/clk/mvebu/clk-cpu.c4
-rw-r--r--drivers/clk/samsung/clk-cpu.c10
-rw-r--r--drivers/clk/ti/clk-3xxx.c2
-rw-r--r--drivers/clk/ti/clk-7xx.c18
-rw-r--r--drivers/clk/ti/clkt_dflt.c4
-rw-r--r--drivers/cpufreq/acpi-cpufreq.c3
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/cpufreq/intel_pstate.c5
-rw-r--r--drivers/devfreq/devfreq.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_display.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c16
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_dpm.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cz_dpm.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.c30
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c32
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c30
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c9
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vi.c3
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c3
-rw-r--r--drivers/gpu/drm/drm_sysfs.c12
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c24
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c27
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c17
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c8
-rw-r--r--drivers/gpu/drm/qxl/qxl_display.c10
-rw-r--r--drivers/gpu/drm/qxl/qxl_fb.c19
-rw-r--r--drivers/gpu/drm/qxl/qxl_release.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c14
-rw-r--r--drivers/gpu/drm/radeon/radeon_dp_mst.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c16
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c63
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c1
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_debugfs.c4
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_fence.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_surface.c3
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c33
-rw-r--r--drivers/i2c/busses/i2c-rcar.c7
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c8
-rw-r--r--drivers/i2c/i2c-core.c12
-rw-r--r--drivers/infiniband/core/cma.c54
-rw-r--r--drivers/infiniband/hw/usnic/usnic.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_abi.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_common_util.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_debugfs.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_debugfs.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_fwd.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_fwd.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_main.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_sysfs.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_sysfs.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_verbs.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_verbs.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_log.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_transport.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_transport.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom.c2
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_vnic.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_vnic.h21
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c2
-rw-r--r--drivers/input/mouse/cyapa_gen6.c10
-rw-r--r--drivers/input/touchscreen/ads7846.c8
-rw-r--r--drivers/iommu/Kconfig3
-rw-r--r--drivers/iommu/amd_iommu.c9
-rw-r--r--drivers/iommu/amd_iommu_init.c3
-rw-r--r--drivers/iommu/arm-smmu-v3.c21
-rw-r--r--drivers/iommu/intel-iommu.c1
-rw-r--r--drivers/iommu/io-pgtable-arm.c24
-rw-r--r--drivers/mcb/mcb-pci.c6
-rw-r--r--drivers/md/dm-cache-policy-cleaner.c2
-rw-r--r--drivers/md/dm-exception-store.c6
-rw-r--r--drivers/md/dm-exception-store.h5
-rw-r--r--drivers/md/dm-raid.c3
-rw-r--r--drivers/md/dm-snap-persistent.c30
-rw-r--r--drivers/md/dm-snap-transient.c3
-rw-r--r--drivers/md/dm-snap.c14
-rw-r--r--drivers/md/dm-thin.c2
-rw-r--r--drivers/md/dm.c11
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/md/raid10.c4
-rw-r--r--drivers/mfd/intel-lpss.h2
-rw-r--r--drivers/mfd/max77843.c2
-rw-r--r--drivers/misc/cxl/api.c1
-rw-r--r--drivers/misc/cxl/context.c3
-rw-r--r--drivers/misc/cxl/cxl.h1
-rw-r--r--drivers/misc/cxl/file.c13
-rw-r--r--drivers/misc/cxl/irq.c4
-rw-r--r--drivers/misc/cxl/native.c2
-rw-r--r--drivers/misc/cxl/pci.c28
-rw-r--r--drivers/misc/mei/hbm.c2
-rw-r--r--drivers/mmc/host/omap_hsmmc.c14
-rw-r--r--drivers/mmc/host/sdhci-of-at91.c1
-rw-r--r--drivers/mmc/host/sdhci-pxav3.c6
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/mmc/host/sdhci.h5
-rw-r--r--drivers/mtd/nand/mxc_nand.c2
-rw-r--r--drivers/mtd/nand/sunxi_nand.c27
-rw-r--r--drivers/nvmem/core.c8
-rw-r--r--drivers/nvmem/sunxi_sid.c11
-rw-r--r--drivers/pci/msi.c4
-rw-r--r--drivers/phy/phy-berlin-sata.c1
-rw-r--r--drivers/phy/phy-qcom-ufs.c11
-rw-r--r--drivers/phy/phy-rockchip-usb.c6
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx25.c4
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c2
-rw-r--r--drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c226
-rw-r--r--drivers/regulator/axp20x-regulator.c4
-rw-r--r--drivers/regulator/core.c4
-rw-r--r--drivers/scsi/3w-9xxx.c28
-rw-r--r--drivers/scsi/libiscsi.c17
-rw-r--r--drivers/scsi/scsi_dh.c2
-rw-r--r--drivers/spi/spi-davinci.c7
-rw-r--r--drivers/staging/lustre/lustre/llite/dir.c2
-rw-r--r--drivers/staging/speakup/fakekey.c1
-rw-r--r--drivers/tty/n_tty.c15
-rw-r--r--drivers/tty/serial/8250/8250_port.c8
-rw-r--r--drivers/tty/serial/atmel_serial.c2
-rw-r--r--drivers/tty/serial/imx.c20
-rw-r--r--drivers/tty/tty_buffer.c22
-rw-r--r--drivers/tty/tty_io.c40
-rw-r--r--drivers/usb/core/quirks.c13
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_ep.c4
-rw-r--r--drivers/usb/misc/chaoskey.c2
-rw-r--r--drivers/usb/renesas_usbhs/common.c7
-rw-r--r--drivers/video/fbdev/broadsheetfb.c8
-rw-r--r--drivers/video/fbdev/fsl-diu-fb.c9
-rw-r--r--drivers/video/fbdev/mb862xx/mb862xxfbdrv.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/connector-dvi.c2
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c1
-rw-r--r--drivers/video/fbdev/tridentfb.c12
-rw-r--r--drivers/video/of_display_timing.c1
-rw-r--r--fs/btrfs/backref.c8
-rw-r--r--fs/btrfs/disk-io.c4
-rw-r--r--fs/btrfs/export.c10
-rw-r--r--fs/btrfs/extent-tree.c9
-rw-r--r--fs/btrfs/extent_io.c19
-rw-r--r--fs/btrfs/ioctl.c5
-rw-r--r--fs/btrfs/send.c8
-rw-r--r--fs/btrfs/transaction.c1
-rw-r--r--fs/btrfs/transaction.h1
-rw-r--r--fs/btrfs/volumes.h8
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/file.c6
-rw-r--r--fs/cifs/inode.c34
-rw-r--r--fs/cifs/smb2pdu.c2
-rw-r--r--fs/dax.c70
-rw-r--r--fs/ext4/Kconfig2
-rw-r--r--fs/ext4/readpage.c4
-rw-r--r--fs/mpage.c15
-rw-r--r--fs/namei.c8
-rw-r--r--fs/nfs/nfs4proc.c15
-rw-r--r--fs/nfs/nfs4state.c3
-rw-r--r--fs/nfs/nfs4trace.h2
-rw-r--r--fs/nfs/write.c14
-rw-r--r--fs/nfsd/blocklayout.c8
-rw-r--r--fs/ramfs/file-nommu.c5
-rw-r--r--include/drm/drm_dp_mst_helper.h3
-rw-r--r--include/linux/irqdomain.h5
-rw-r--r--include/linux/usb/renesas_usbhs.h2
-rw-r--r--include/sound/pcm.h16
-rw-r--r--include/uapi/asm-generic/signal.h2
-rw-r--r--include/xen/interface/sched.h8
-rw-r--r--kernel/irq/handle.c2
-rw-r--r--kernel/irq/msi.c6
-rw-r--r--kernel/sched/core.c10
-rw-r--r--kernel/sched/sched.h5
-rw-r--r--kernel/time/timekeeping.c2
-rw-r--r--kernel/workqueue.c8
-rw-r--r--lib/Kconfig1
-rw-r--r--lib/string.c3
-rw-r--r--mm/filemap.c34
-rw-r--r--mm/memcontrol.c1
-rw-r--r--mm/memory.c2
-rw-r--r--mm/readahead.c8
-rw-r--r--mm/vmstat.c7
-rw-r--r--net/ceph/osd_client.c13
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c8
-rw-r--r--net/sunrpc/xprtrdma/transport.c2
-rw-r--r--net/sunrpc/xprtrdma/verbs.c17
-rwxr-xr-xscripts/package/builddeb4
-rw-r--r--sound/pci/korg1212/korg1212.c8
-rw-r--r--sound/pci/lx6464es/lx6464es.c4
-rw-r--r--sound/pci/rme32.c4
-rw-r--r--sound/pci/rme96.c8
-rw-r--r--sound/pci/rme9652/hdspm.c9
-rw-r--r--sound/soc/codecs/adav80x.c4
-rw-r--r--sound/soc/codecs/twl4030.c13
-rw-r--r--sound/soc/codecs/uda134x.c6
-rw-r--r--sound/soc/codecs/wl1273.c9
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c14
-rw-r--r--sound/soc/intel/boards/cht_bsw_max98090_ti.c14
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5645.c14
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5672.c14
-rw-r--r--sound/soc/omap/n810.c3
-rw-r--r--sound/soc/omap/rx51.c3
-rw-r--r--sound/soc/soc-pcm.c10
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c4
-rw-r--r--tools/perf/util/Build2
-rw-r--r--tools/perf/util/perf_regs.c2
-rw-r--r--tools/perf/util/perf_regs.h1
-rw-r--r--tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c9
296 files changed, 2084 insertions, 1072 deletions
diff --git a/Documentation/device-mapper/snapshot.txt b/Documentation/device-mapper/snapshot.txt
index 0d5bc46dc167..ad6949bff2e3 100644
--- a/Documentation/device-mapper/snapshot.txt
+++ b/Documentation/device-mapper/snapshot.txt
@@ -41,9 +41,13 @@ useless and be disabled, returning errors. So it is important to monitor
41the amount of free space and expand the <COW device> before it fills up. 41the amount of free space and expand the <COW device> before it fills up.
42 42
43<persistent?> is P (Persistent) or N (Not persistent - will not survive 43<persistent?> is P (Persistent) or N (Not persistent - will not survive
44after reboot). 44after reboot). O (Overflow) can be added as a persistent store option
45The difference is that for transient snapshots less metadata must be 45to allow userspace to advertise its support for seeing "Overflow" in the
46saved on disk - they can be kept in memory by the kernel. 46snapshot status. So supported store types are "P", "PO" and "N".
47
48The difference between persistent and transient is with transient
49snapshots less metadata must be saved on disk - they can be kept in
50memory by the kernel.
47 51
48 52
49* snapshot-merge <origin> <COW device> <persistent> <chunksize> 53* snapshot-merge <origin> <COW device> <persistent> <chunksize>
diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt b/Documentation/devicetree/bindings/spi/sh-msiof.txt
index 8f771441be60..705075da2f10 100644
--- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
@@ -51,7 +51,7 @@ Optional properties, deprecated for soctype-specific bindings:
51- renesas,tx-fifo-size : Overrides the default tx fifo size given in words 51- renesas,tx-fifo-size : Overrides the default tx fifo size given in words
52 (default is 64) 52 (default is 64)
53- renesas,rx-fifo-size : Overrides the default rx fifo size given in words 53- renesas,rx-fifo-size : Overrides the default rx fifo size given in words
54 (default is 64, or 256 on R-Car Gen2) 54 (default is 64)
55 55
56Pinctrl properties might be needed, too. See 56Pinctrl properties might be needed, too. See
57Documentation/devicetree/bindings/pinctrl/renesas,*. 57Documentation/devicetree/bindings/pinctrl/renesas,*.
diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
index 64a4ca6cf96f..7d48f63db44e 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
@@ -5,6 +5,7 @@ Required properties:
5 - "renesas,usbhs-r8a7790" 5 - "renesas,usbhs-r8a7790"
6 - "renesas,usbhs-r8a7791" 6 - "renesas,usbhs-r8a7791"
7 - "renesas,usbhs-r8a7794" 7 - "renesas,usbhs-r8a7794"
8 - "renesas,usbhs-r8a7795"
8 - reg: Base address and length of the register for the USBHS 9 - reg: Base address and length of the register for the USBHS
9 - interrupts: Interrupt specifier for the USBHS 10 - interrupts: Interrupt specifier for the USBHS
10 - clocks: A list of phandle + clock specifier pairs 11 - clocks: A list of phandle + clock specifier pairs
diff --git a/MAINTAINERS b/MAINTAINERS
index 60aacd88bd7f..b8577ad9b8a2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3591,6 +3591,13 @@ F: drivers/gpu/drm/i915/
3591F: include/drm/i915* 3591F: include/drm/i915*
3592F: include/uapi/drm/i915* 3592F: include/uapi/drm/i915*
3593 3593
3594DRM DRIVERS FOR ATMEL HLCDC
3595M: Boris Brezillon <boris.brezillon@free-electrons.com>
3596L: dri-devel@lists.freedesktop.org
3597S: Supported
3598F: drivers/gpu/drm/atmel-hlcdc/
3599F: Documentation/devicetree/bindings/drm/atmel/
3600
3594DRM DRIVERS FOR EXYNOS 3601DRM DRIVERS FOR EXYNOS
3595M: Inki Dae <inki.dae@samsung.com> 3602M: Inki Dae <inki.dae@samsung.com>
3596M: Joonyoung Shim <jy0922.shim@samsung.com> 3603M: Joonyoung Shim <jy0922.shim@samsung.com>
@@ -3619,6 +3626,14 @@ S: Maintained
3619F: drivers/gpu/drm/imx/ 3626F: drivers/gpu/drm/imx/
3620F: Documentation/devicetree/bindings/drm/imx/ 3627F: Documentation/devicetree/bindings/drm/imx/
3621 3628
3629DRM DRIVERS FOR GMA500 (Poulsbo, Moorestown and derivative chipsets)
3630M: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
3631L: dri-devel@lists.freedesktop.org
3632T: git git://github.com/patjak/drm-gma500
3633S: Maintained
3634F: drivers/gpu/drm/gma500
3635F: include/drm/gma500*
3636
3622DRM DRIVERS FOR NVIDIA TEGRA 3637DRM DRIVERS FOR NVIDIA TEGRA
3623M: Thierry Reding <thierry.reding@gmail.com> 3638M: Thierry Reding <thierry.reding@gmail.com>
3624M: Terje Bergström <tbergstrom@nvidia.com> 3639M: Terje Bergström <tbergstrom@nvidia.com>
@@ -4003,7 +4018,7 @@ S: Maintained
4003F: sound/usb/misc/ua101.c 4018F: sound/usb/misc/ua101.c
4004 4019
4005EXTENSIBLE FIRMWARE INTERFACE (EFI) 4020EXTENSIBLE FIRMWARE INTERFACE (EFI)
4006M: Matt Fleming <matt.fleming@intel.com> 4021M: Matt Fleming <matt@codeblueprint.co.uk>
4007L: linux-efi@vger.kernel.org 4022L: linux-efi@vger.kernel.org
4008T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git 4023T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
4009S: Maintained 4024S: Maintained
@@ -4018,7 +4033,7 @@ F: include/linux/efi*.h
4018EFI VARIABLE FILESYSTEM 4033EFI VARIABLE FILESYSTEM
4019M: Matthew Garrett <matthew.garrett@nebula.com> 4034M: Matthew Garrett <matthew.garrett@nebula.com>
4020M: Jeremy Kerr <jk@ozlabs.org> 4035M: Jeremy Kerr <jk@ozlabs.org>
4021M: Matt Fleming <matt.fleming@intel.com> 4036M: Matt Fleming <matt@codeblueprint.co.uk>
4022T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git 4037T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
4023L: linux-efi@vger.kernel.org 4038L: linux-efi@vger.kernel.org
4024S: Maintained 4039S: Maintained
@@ -9101,6 +9116,15 @@ S: Supported
9101F: Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt 9116F: Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
9102F: drivers/net/ethernet/synopsys/dwc_eth_qos.c 9117F: drivers/net/ethernet/synopsys/dwc_eth_qos.c
9103 9118
9119SYNOPSYS DESIGNWARE I2C DRIVER
9120M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
9121M: Jarkko Nikula <jarkko.nikula@linux.intel.com>
9122M: Mika Westerberg <mika.westerberg@linux.intel.com>
9123L: linux-i2c@vger.kernel.org
9124S: Maintained
9125F: drivers/i2c/busses/i2c-designware-*
9126F: include/linux/platform_data/i2c-designware.h
9127
9104SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER 9128SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
9105M: Seungwon Jeon <tgih.jun@samsung.com> 9129M: Seungwon Jeon <tgih.jun@samsung.com>
9106M: Jaehoon Chung <jh80.chung@samsung.com> 9130M: Jaehoon Chung <jh80.chung@samsung.com>
@@ -9914,7 +9938,6 @@ S: Maintained
9914F: drivers/staging/lustre 9938F: drivers/staging/lustre
9915 9939
9916STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec) 9940STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec)
9917M: Julian Andres Klode <jak@jak-linux.org>
9918M: Marc Dietrich <marvin24@gmx.de> 9941M: Marc Dietrich <marvin24@gmx.de>
9919L: ac100@lists.launchpad.net (moderated for non-subscribers) 9942L: ac100@lists.launchpad.net (moderated for non-subscribers)
9920L: linux-tegra@vger.kernel.org 9943L: linux-tegra@vger.kernel.org
diff --git a/Makefile b/Makefile
index fd46821e428d..d33ab74bffce 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 3 2PATCHLEVEL = 3
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc6
5NAME = Hurr durr I'ma sheep 5NAME = Blurry Fish Butt
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
diff --git a/arch/alpha/include/asm/word-at-a-time.h b/arch/alpha/include/asm/word-at-a-time.h
index 6b340d0f1521..902e6ab00a06 100644
--- a/arch/alpha/include/asm/word-at-a-time.h
+++ b/arch/alpha/include/asm/word-at-a-time.h
@@ -52,4 +52,6 @@ static inline unsigned long find_zero(unsigned long bits)
52#endif 52#endif
53} 53}
54 54
55#define zero_bytemask(mask) ((2ul << (find_zero(mask) * 8)) - 1)
56
55#endif /* _ASM_WORD_AT_A_TIME_H */ 57#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 233159d2eaab..bb8fa023d574 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -578,7 +578,7 @@ dtb-$(CONFIG_MACH_SUN4I) += \
578 sun4i-a10-hackberry.dtb \ 578 sun4i-a10-hackberry.dtb \
579 sun4i-a10-hyundai-a7hd.dtb \ 579 sun4i-a10-hyundai-a7hd.dtb \
580 sun4i-a10-inet97fv2.dtb \ 580 sun4i-a10-inet97fv2.dtb \
581 sun4i-a10-itead-iteaduino-plus.dts \ 581 sun4i-a10-itead-iteaduino-plus.dtb \
582 sun4i-a10-jesurun-q5.dtb \ 582 sun4i-a10-jesurun-q5.dtb \
583 sun4i-a10-marsboard.dtb \ 583 sun4i-a10-marsboard.dtb \
584 sun4i-a10-mini-xplus.dtb \ 584 sun4i-a10-mini-xplus.dtb \
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index ca0e3c15977f..294cfe40388d 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -98,6 +98,7 @@
98 opp-hz = /bits/ 64 <800000000>; 98 opp-hz = /bits/ 64 <800000000>;
99 opp-microvolt = <1000000>; 99 opp-microvolt = <1000000>;
100 clock-latency-ns = <200000>; 100 clock-latency-ns = <200000>;
101 opp-suspend;
101 }; 102 };
102 opp07 { 103 opp07 {
103 opp-hz = /bits/ 64 <900000000>; 104 opp-hz = /bits/ 64 <900000000>;
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 15aea760c1da..c625e71217aa 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -197,6 +197,7 @@
197 regulator-name = "P1.8V_LDO_OUT10"; 197 regulator-name = "P1.8V_LDO_OUT10";
198 regulator-min-microvolt = <1800000>; 198 regulator-min-microvolt = <1800000>;
199 regulator-max-microvolt = <1800000>; 199 regulator-max-microvolt = <1800000>;
200 regulator-always-on;
200 }; 201 };
201 202
202 ldo11_reg: LDO11 { 203 ldo11_reg: LDO11 {
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index df9aee92ecf4..1b3d6c769a3c 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -1117,7 +1117,7 @@
1117 interrupt-parent = <&combiner>; 1117 interrupt-parent = <&combiner>;
1118 interrupts = <3 0>; 1118 interrupts = <3 0>;
1119 clock-names = "sysmmu", "master"; 1119 clock-names = "sysmmu", "master";
1120 clocks = <&clock CLK_SMMU_FIMD1M0>, <&clock CLK_FIMD1>; 1120 clocks = <&clock CLK_SMMU_FIMD1M1>, <&clock CLK_FIMD1>;
1121 power-domains = <&disp_pd>; 1121 power-domains = <&disp_pd>;
1122 #iommu-cells = <0>; 1122 #iommu-cells = <0>;
1123 }; 1123 };
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
index 79ffdfe712aa..3b43e57845ae 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
@@ -472,7 +472,6 @@
472 */ 472 */
473 pinctrl-0 = <&pwm0_out &pwm1_out &pwm2_out &pwm3_out>; 473 pinctrl-0 = <&pwm0_out &pwm1_out &pwm2_out &pwm3_out>;
474 pinctrl-names = "default"; 474 pinctrl-names = "default";
475 samsung,pwm-outputs = <0>;
476 status = "okay"; 475 status = "okay";
477}; 476};
478 477
diff --git a/arch/arm/boot/dts/imx53-qsrb.dts b/arch/arm/boot/dts/imx53-qsrb.dts
index 66e47de5e826..96d7eede412e 100644
--- a/arch/arm/boot/dts/imx53-qsrb.dts
+++ b/arch/arm/boot/dts/imx53-qsrb.dts
@@ -36,7 +36,7 @@
36 pinctrl-0 = <&pinctrl_pmic>; 36 pinctrl-0 = <&pinctrl_pmic>;
37 reg = <0x08>; 37 reg = <0x08>;
38 interrupt-parent = <&gpio5>; 38 interrupt-parent = <&gpio5>;
39 interrupts = <23 0x8>; 39 interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
40 regulators { 40 regulators {
41 sw1_reg: sw1a { 41 sw1_reg: sw1a {
42 regulator-name = "SW1"; 42 regulator-name = "SW1";
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index c3e3ca9362fb..cd170376eaca 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -15,6 +15,7 @@
15#include <dt-bindings/clock/imx5-clock.h> 15#include <dt-bindings/clock/imx5-clock.h>
16#include <dt-bindings/gpio/gpio.h> 16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/input/input.h> 17#include <dt-bindings/input/input.h>
18#include <dt-bindings/interrupt-controller/irq.h>
18 19
19/ { 20/ {
20 aliases { 21 aliases {
diff --git a/arch/arm/boot/dts/imx6qdl-rex.dtsi b/arch/arm/boot/dts/imx6qdl-rex.dtsi
index 3373fd958e95..a50356243888 100644
--- a/arch/arm/boot/dts/imx6qdl-rex.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-rex.dtsi
@@ -35,7 +35,6 @@
35 compatible = "regulator-fixed"; 35 compatible = "regulator-fixed";
36 reg = <1>; 36 reg = <1>;
37 pinctrl-names = "default"; 37 pinctrl-names = "default";
38 pinctrl-0 = <&pinctrl_usbh1>;
39 regulator-name = "usbh1_vbus"; 38 regulator-name = "usbh1_vbus";
40 regulator-min-microvolt = <5000000>; 39 regulator-min-microvolt = <5000000>;
41 regulator-max-microvolt = <5000000>; 40 regulator-max-microvolt = <5000000>;
@@ -47,7 +46,6 @@
47 compatible = "regulator-fixed"; 46 compatible = "regulator-fixed";
48 reg = <2>; 47 reg = <2>;
49 pinctrl-names = "default"; 48 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_usbotg>;
51 regulator-name = "usb_otg_vbus"; 49 regulator-name = "usb_otg_vbus";
52 regulator-min-microvolt = <5000000>; 50 regulator-min-microvolt = <5000000>;
53 regulator-max-microvolt = <5000000>; 51 regulator-max-microvolt = <5000000>;
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index a0b2a79cbfbd..4624d0f2a754 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1627,6 +1627,7 @@
1627 "mix.0", "mix.1", 1627 "mix.0", "mix.1",
1628 "dvc.0", "dvc.1", 1628 "dvc.0", "dvc.1",
1629 "clk_a", "clk_b", "clk_c", "clk_i"; 1629 "clk_a", "clk_b", "clk_c", "clk_i";
1630 power-domains = <&cpg_clocks>;
1630 1631
1631 status = "disabled"; 1632 status = "disabled";
1632 1633
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 831525dd39a6..1666c8a6b143 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -1677,6 +1677,7 @@
1677 "mix.0", "mix.1", 1677 "mix.0", "mix.1",
1678 "dvc.0", "dvc.1", 1678 "dvc.0", "dvc.1",
1679 "clk_a", "clk_b", "clk_c", "clk_i"; 1679 "clk_a", "clk_b", "clk_c", "clk_i";
1680 power-domains = <&cpg_clocks>;
1680 1681
1681 status = "disabled"; 1682 status = "disabled";
1682 1683
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 2bebaa286f9a..391230c3dc93 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -107,7 +107,7 @@
107 720000 1200000 107 720000 1200000
108 528000 1100000 108 528000 1100000
109 312000 1000000 109 312000 1000000
110 144000 900000 110 144000 1000000
111 >; 111 >;
112 #cooling-cells = <2>; 112 #cooling-cells = <2>;
113 cooling-min-level = <0>; 113 cooling-min-level = <0>;
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 9bdf54795f05..56978199c479 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -20,6 +20,7 @@
20#include <asm/cputype.h> 20#include <asm/cputype.h>
21#include <asm/cp15.h> 21#include <asm/cp15.h>
22#include <asm/mcpm.h> 22#include <asm/mcpm.h>
23#include <asm/smp_plat.h>
23 24
24#include "regs-pmu.h" 25#include "regs-pmu.h"
25#include "common.h" 26#include "common.h"
@@ -70,7 +71,31 @@ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
70 cluster >= EXYNOS5420_NR_CLUSTERS) 71 cluster >= EXYNOS5420_NR_CLUSTERS)
71 return -EINVAL; 72 return -EINVAL;
72 73
73 exynos_cpu_power_up(cpunr); 74 if (!exynos_cpu_power_state(cpunr)) {
75 exynos_cpu_power_up(cpunr);
76
77 /*
78 * This assumes the cluster number of the big cores(Cortex A15)
79 * is 0 and the Little cores(Cortex A7) is 1.
80 * When the system was booted from the Little core,
81 * they should be reset during power up cpu.
82 */
83 if (cluster &&
84 cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) {
85 /*
86 * Before we reset the Little cores, we should wait
87 * the SPARE2 register is set to 1 because the init
88 * codes of the iROM will set the register after
89 * initialization.
90 */
91 while (!pmu_raw_readl(S5P_PMU_SPARE2))
92 udelay(10);
93
94 pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
95 EXYNOS_SWRESET);
96 }
97 }
98
74 return 0; 99 return 0;
75} 100}
76 101
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index b7614333d296..fba9068ed260 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -513,6 +513,12 @@ static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
513#define SPREAD_ENABLE 0xF 513#define SPREAD_ENABLE 0xF
514#define SPREAD_USE_STANDWFI 0xF 514#define SPREAD_USE_STANDWFI 0xF
515 515
516#define EXYNOS5420_KFC_CORE_RESET0 BIT(8)
517#define EXYNOS5420_KFC_ETM_RESET0 BIT(20)
518
519#define EXYNOS5420_KFC_CORE_RESET(_nr) \
520 ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) << (_nr))
521
516#define EXYNOS5420_BB_CON1 0x0784 522#define EXYNOS5420_BB_CON1 0x0784
517#define EXYNOS5420_BB_SEL_EN BIT(31) 523#define EXYNOS5420_BB_SEL_EN BIT(31)
518#define EXYNOS5420_BB_PMOS_EN BIT(7) 524#define EXYNOS5420_BB_PMOS_EN BIT(7)
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index f9914d7c1bb0..d10b5d483022 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -42,7 +42,7 @@ endif
42CHECKFLAGS += -D__aarch64__ 42CHECKFLAGS += -D__aarch64__
43 43
44ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) 44ifeq ($(CONFIG_ARM64_ERRATUM_843419), y)
45CFLAGS_MODULE += -mcmodel=large 45KBUILD_CFLAGS_MODULE += -mcmodel=large
46endif 46endif
47 47
48# Default value 48# Default value
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 3bc498c250dc..41e58fe3c041 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -44,7 +44,7 @@
44#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) 44#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2)
45#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) 45#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5)
46 46
47#define __NR_compat_syscalls 388 47#define __NR_compat_syscalls 390
48#endif 48#endif
49 49
50#define __ARCH_WANT_SYS_CLONE 50#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index cef934a90f17..5b925b761a2a 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -797,3 +797,12 @@ __SYSCALL(__NR_memfd_create, sys_memfd_create)
797__SYSCALL(__NR_bpf, sys_bpf) 797__SYSCALL(__NR_bpf, sys_bpf)
798#define __NR_execveat 387 798#define __NR_execveat 387
799__SYSCALL(__NR_execveat, compat_sys_execveat) 799__SYSCALL(__NR_execveat, compat_sys_execveat)
800#define __NR_userfaultfd 388
801__SYSCALL(__NR_userfaultfd, sys_userfaultfd)
802#define __NR_membarrier 389
803__SYSCALL(__NR_membarrier, sys_membarrier)
804
805/*
806 * Please add new compat syscalls above this comment and update
807 * __NR_compat_syscalls in asm/unistd.h.
808 */
diff --git a/arch/arm64/include/uapi/asm/signal.h b/arch/arm64/include/uapi/asm/signal.h
index 8d1e7236431b..991bf5db2ca1 100644
--- a/arch/arm64/include/uapi/asm/signal.h
+++ b/arch/arm64/include/uapi/asm/signal.h
@@ -19,6 +19,9 @@
19/* Required for AArch32 compatibility. */ 19/* Required for AArch32 compatibility. */
20#define SA_RESTORER 0x04000000 20#define SA_RESTORER 0x04000000
21 21
22#define MINSIGSTKSZ 5120
23#define SIGSTKSZ 16384
24
22#include <asm-generic/signal.h> 25#include <asm-generic/signal.h>
23 26
24#endif 27#endif
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index cebf78661a55..253021ef2769 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -201,7 +201,7 @@ void unregister_step_hook(struct step_hook *hook)
201} 201}
202 202
203/* 203/*
204 * Call registered single step handers 204 * Call registered single step handlers
205 * There is no Syndrome info to check for determining the handler. 205 * There is no Syndrome info to check for determining the handler.
206 * So we call all the registered handlers, until the right handler is 206 * So we call all the registered handlers, until the right handler is
207 * found which returns zero. 207 * found which returns zero.
@@ -271,20 +271,21 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
271 * Use reader/writer locks instead of plain spinlock. 271 * Use reader/writer locks instead of plain spinlock.
272 */ 272 */
273static LIST_HEAD(break_hook); 273static LIST_HEAD(break_hook);
274static DEFINE_RWLOCK(break_hook_lock); 274static DEFINE_SPINLOCK(break_hook_lock);
275 275
276void register_break_hook(struct break_hook *hook) 276void register_break_hook(struct break_hook *hook)
277{ 277{
278 write_lock(&break_hook_lock); 278 spin_lock(&break_hook_lock);
279 list_add(&hook->node, &break_hook); 279 list_add_rcu(&hook->node, &break_hook);
280 write_unlock(&break_hook_lock); 280 spin_unlock(&break_hook_lock);
281} 281}
282 282
283void unregister_break_hook(struct break_hook *hook) 283void unregister_break_hook(struct break_hook *hook)
284{ 284{
285 write_lock(&break_hook_lock); 285 spin_lock(&break_hook_lock);
286 list_del(&hook->node); 286 list_del_rcu(&hook->node);
287 write_unlock(&break_hook_lock); 287 spin_unlock(&break_hook_lock);
288 synchronize_rcu();
288} 289}
289 290
290static int call_break_hook(struct pt_regs *regs, unsigned int esr) 291static int call_break_hook(struct pt_regs *regs, unsigned int esr)
@@ -292,11 +293,11 @@ static int call_break_hook(struct pt_regs *regs, unsigned int esr)
292 struct break_hook *hook; 293 struct break_hook *hook;
293 int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL; 294 int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL;
294 295
295 read_lock(&break_hook_lock); 296 rcu_read_lock();
296 list_for_each_entry(hook, &break_hook, node) 297 list_for_each_entry_rcu(hook, &break_hook, node)
297 if ((esr & hook->esr_mask) == hook->esr_val) 298 if ((esr & hook->esr_mask) == hook->esr_val)
298 fn = hook->fn; 299 fn = hook->fn;
299 read_unlock(&break_hook_lock); 300 rcu_read_unlock();
300 301
301 return fn ? fn(regs, esr) : DBG_HOOK_ERROR; 302 return fn ? fn(regs, esr) : DBG_HOOK_ERROR;
302} 303}
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index f341866aa810..c08b9ad6f429 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -85,7 +85,7 @@ bool aarch64_insn_is_branch_imm(u32 insn)
85 aarch64_insn_is_bcond(insn)); 85 aarch64_insn_is_bcond(insn));
86} 86}
87 87
88static DEFINE_SPINLOCK(patch_lock); 88static DEFINE_RAW_SPINLOCK(patch_lock);
89 89
90static void __kprobes *patch_map(void *addr, int fixmap) 90static void __kprobes *patch_map(void *addr, int fixmap)
91{ 91{
@@ -131,13 +131,13 @@ static int __kprobes __aarch64_insn_write(void *addr, u32 insn)
131 unsigned long flags = 0; 131 unsigned long flags = 0;
132 int ret; 132 int ret;
133 133
134 spin_lock_irqsave(&patch_lock, flags); 134 raw_spin_lock_irqsave(&patch_lock, flags);
135 waddr = patch_map(addr, FIX_TEXT_POKE0); 135 waddr = patch_map(addr, FIX_TEXT_POKE0);
136 136
137 ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE); 137 ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE);
138 138
139 patch_unmap(FIX_TEXT_POKE0); 139 patch_unmap(FIX_TEXT_POKE0);
140 spin_unlock_irqrestore(&patch_lock, flags); 140 raw_spin_unlock_irqrestore(&patch_lock, flags);
141 141
142 return ret; 142 return ret;
143} 143}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 6bab21f84a9f..232247945b1c 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -364,6 +364,8 @@ static void __init relocate_initrd(void)
364 to_free = ram_end - orig_start; 364 to_free = ram_end - orig_start;
365 365
366 size = orig_end - orig_start; 366 size = orig_end - orig_start;
367 if (!size)
368 return;
367 369
368 /* initrd needs to be relocated completely inside linear mapping */ 370 /* initrd needs to be relocated completely inside linear mapping */
369 new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn), 371 new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn),
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index aba9ead1384c..9fadf6d7039b 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -287,6 +287,7 @@ retry:
287 * starvation. 287 * starvation.
288 */ 288 */
289 mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; 289 mm_flags &= ~FAULT_FLAG_ALLOW_RETRY;
290 mm_flags |= FAULT_FLAG_TRIED;
290 goto retry; 291 goto retry;
291 } 292 }
292 } 293 }
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 70e6ae1e7006..373cb23301e3 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -73,4 +73,5 @@ generic-y += uaccess.h
73generic-y += ucontext.h 73generic-y += ucontext.h
74generic-y += unaligned.h 74generic-y += unaligned.h
75generic-y += vga.h 75generic-y += vga.h
76generic-y += word-at-a-time.h
76generic-y += xor.h 77generic-y += xor.h
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 9e777cd42b67..d10fd80dbb7e 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -256,6 +256,7 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si
256 */ 256 */
257#define ioremap_nocache(offset, size) \ 257#define ioremap_nocache(offset, size) \
258 __ioremap_mode((offset), (size), _CACHE_UNCACHED) 258 __ioremap_mode((offset), (size), _CACHE_UNCACHED)
259#define ioremap_uc ioremap_nocache
259 260
260/* 261/*
261 * ioremap_cachable - map bus memory into CPU space 262 * ioremap_cachable - map bus memory into CPU space
diff --git a/arch/mips/include/uapi/asm/swab.h b/arch/mips/include/uapi/asm/swab.h
index c4ddc4f0d2dc..23cd9b118c9e 100644
--- a/arch/mips/include/uapi/asm/swab.h
+++ b/arch/mips/include/uapi/asm/swab.h
@@ -13,16 +13,15 @@
13 13
14#define __SWAB_64_THRU_32__ 14#define __SWAB_64_THRU_32__
15 15
16#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ 16#if !defined(__mips16) && \
17 defined(_MIPS_ARCH_LOONGSON3A) 17 ((defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \
18 defined(_MIPS_ARCH_LOONGSON3A))
18 19
19static inline __attribute__((nomips16)) __attribute_const__ 20static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
20 __u16 __arch_swab16(__u16 x)
21{ 21{
22 __asm__( 22 __asm__(
23 " .set push \n" 23 " .set push \n"
24 " .set arch=mips32r2 \n" 24 " .set arch=mips32r2 \n"
25 " .set nomips16 \n"
26 " wsbh %0, %1 \n" 25 " wsbh %0, %1 \n"
27 " .set pop \n" 26 " .set pop \n"
28 : "=r" (x) 27 : "=r" (x)
@@ -32,13 +31,11 @@ static inline __attribute__((nomips16)) __attribute_const__
32} 31}
33#define __arch_swab16 __arch_swab16 32#define __arch_swab16 __arch_swab16
34 33
35static inline __attribute__((nomips16)) __attribute_const__ 34static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
36 __u32 __arch_swab32(__u32 x)
37{ 35{
38 __asm__( 36 __asm__(
39 " .set push \n" 37 " .set push \n"
40 " .set arch=mips32r2 \n" 38 " .set arch=mips32r2 \n"
41 " .set nomips16 \n"
42 " wsbh %0, %1 \n" 39 " wsbh %0, %1 \n"
43 " rotr %0, %0, 16 \n" 40 " rotr %0, %0, 16 \n"
44 " .set pop \n" 41 " .set pop \n"
@@ -54,13 +51,11 @@ static inline __attribute__((nomips16)) __attribute_const__
54 * 64-bit kernel on r2 CPUs. 51 * 64-bit kernel on r2 CPUs.
55 */ 52 */
56#ifdef __mips64 53#ifdef __mips64
57static inline __attribute__((nomips16)) __attribute_const__ 54static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
58 __u64 __arch_swab64(__u64 x)
59{ 55{
60 __asm__( 56 __asm__(
61 " .set push \n" 57 " .set push \n"
62 " .set arch=mips64r2 \n" 58 " .set arch=mips64r2 \n"
63 " .set nomips16 \n"
64 " dsbh %0, %1 \n" 59 " dsbh %0, %1 \n"
65 " dshd %0, %0 \n" 60 " dshd %0, %0 \n"
66 " .set pop \n" 61 " .set pop \n"
@@ -71,5 +66,5 @@ static inline __attribute__((nomips16)) __attribute_const__
71} 66}
72#define __arch_swab64 __arch_swab64 67#define __arch_swab64 __arch_swab64
73#endif /* __mips64 */ 68#endif /* __mips64 */
74#endif /* MIPS R2 or newer or Loongson 3A */ 69#endif /* (not __mips16) and (MIPS R2 or newer or Loongson 3A) */
75#endif /* _ASM_SWAB_H */ 70#endif /* _ASM_SWAB_H */
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 6bc0ee4b1070..2c041b535a64 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -111,7 +111,7 @@ CONFIG_SCSI_QLA_FC=m
111CONFIG_SCSI_QLA_ISCSI=m 111CONFIG_SCSI_QLA_ISCSI=m
112CONFIG_SCSI_LPFC=m 112CONFIG_SCSI_LPFC=m
113CONFIG_SCSI_VIRTIO=m 113CONFIG_SCSI_VIRTIO=m
114CONFIG_SCSI_DH=m 114CONFIG_SCSI_DH=y
115CONFIG_SCSI_DH_RDAC=m 115CONFIG_SCSI_DH_RDAC=m
116CONFIG_SCSI_DH_ALUA=m 116CONFIG_SCSI_DH_ALUA=m
117CONFIG_ATA=y 117CONFIG_ATA=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 7991f37e5fe2..36871a4bfa54 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -114,7 +114,7 @@ CONFIG_SCSI_QLA_FC=m
114CONFIG_SCSI_QLA_ISCSI=m 114CONFIG_SCSI_QLA_ISCSI=m
115CONFIG_SCSI_LPFC=m 115CONFIG_SCSI_LPFC=m
116CONFIG_SCSI_VIRTIO=m 116CONFIG_SCSI_VIRTIO=m
117CONFIG_SCSI_DH=m 117CONFIG_SCSI_DH=y
118CONFIG_SCSI_DH_RDAC=m 118CONFIG_SCSI_DH_RDAC=m
119CONFIG_SCSI_DH_ALUA=m 119CONFIG_SCSI_DH_ALUA=m
120CONFIG_ATA=y 120CONFIG_ATA=y
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index ac1662956e0c..ab9f4e0ed4cf 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -7,4 +7,3 @@ generic-y += mcs_spinlock.h
7generic-y += preempt.h 7generic-y += preempt.h
8generic-y += rwsem.h 8generic-y += rwsem.h
9generic-y += vtime.h 9generic-y += vtime.h
10generic-y += word-at-a-time.h
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index cab6753f1be5..3f191f573d4f 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -61,8 +61,13 @@ struct machdep_calls {
61 unsigned long addr, 61 unsigned long addr,
62 unsigned char *hpte_slot_array, 62 unsigned char *hpte_slot_array,
63 int psize, int ssize, int local); 63 int psize, int ssize, int local);
64 /* special for kexec, to be called in real mode, linear mapping is 64 /*
65 * destroyed as well */ 65 * Special for kexec.
66 * To be called in real mode with interrupts disabled. No locks are
67 * taken as such, concurrent access on pre POWER5 hardware could result
68 * in a deadlock.
69 * The linear mapping is destroyed as well.
70 */
66 void (*hpte_clear_all)(void); 71 void (*hpte_clear_all)(void);
67 72
68 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size, 73 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size,
diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
index 5b3a903adae6..e4396a7d0f7c 100644
--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -40,6 +40,11 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct
40 return (val + c->high_bits) & ~rhs; 40 return (val + c->high_bits) & ~rhs;
41} 41}
42 42
43static inline unsigned long zero_bytemask(unsigned long mask)
44{
45 return ~1ul << __fls(mask);
46}
47
43#else 48#else
44 49
45#ifdef CONFIG_64BIT 50#ifdef CONFIG_64BIT
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 13befa35d8a8..c8822af10a58 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -582,13 +582,21 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
582 * be when they isi), and we are the only one left. We rely on our kernel 582 * be when they isi), and we are the only one left. We rely on our kernel
583 * mapping being 0xC0's and the hardware ignoring those two real bits. 583 * mapping being 0xC0's and the hardware ignoring those two real bits.
584 * 584 *
585 * This must be called with interrupts disabled.
586 *
587 * Taking the native_tlbie_lock is unsafe here due to the possibility of
588 * lockdep being on. On pre POWER5 hardware, not taking the lock could
589 * cause deadlock. POWER5 and newer not taking the lock is fine. This only
590 * gets called during boot before secondary CPUs have come up and during
591 * crashdump and all bets are off anyway.
592 *
585 * TODO: add batching support when enabled. remember, no dynamic memory here, 593 * TODO: add batching support when enabled. remember, no dynamic memory here,
586 * athough there is the control page available... 594 * athough there is the control page available...
587 */ 595 */
588static void native_hpte_clear(void) 596static void native_hpte_clear(void)
589{ 597{
590 unsigned long vpn = 0; 598 unsigned long vpn = 0;
591 unsigned long slot, slots, flags; 599 unsigned long slot, slots;
592 struct hash_pte *hptep = htab_address; 600 struct hash_pte *hptep = htab_address;
593 unsigned long hpte_v; 601 unsigned long hpte_v;
594 unsigned long pteg_count; 602 unsigned long pteg_count;
@@ -596,13 +604,6 @@ static void native_hpte_clear(void)
596 604
597 pteg_count = htab_hash_mask + 1; 605 pteg_count = htab_hash_mask + 1;
598 606
599 local_irq_save(flags);
600
601 /* we take the tlbie lock and hold it. Some hardware will
602 * deadlock if we try to tlbie from two processors at once.
603 */
604 raw_spin_lock(&native_tlbie_lock);
605
606 slots = pteg_count * HPTES_PER_GROUP; 607 slots = pteg_count * HPTES_PER_GROUP;
607 608
608 for (slot = 0; slot < slots; slot++, hptep++) { 609 for (slot = 0; slot < slots; slot++, hptep++) {
@@ -614,8 +615,8 @@ static void native_hpte_clear(void)
614 hpte_v = be64_to_cpu(hptep->v); 615 hpte_v = be64_to_cpu(hptep->v);
615 616
616 /* 617 /*
617 * Call __tlbie() here rather than tlbie() since we 618 * Call __tlbie() here rather than tlbie() since we can't take the
618 * already hold the native_tlbie_lock. 619 * native_tlbie_lock.
619 */ 620 */
620 if (hpte_v & HPTE_V_VALID) { 621 if (hpte_v & HPTE_V_VALID) {
621 hpte_decode(hptep, slot, &psize, &apsize, &ssize, &vpn); 622 hpte_decode(hptep, slot, &psize, &apsize, &ssize, &vpn);
@@ -625,8 +626,6 @@ static void native_hpte_clear(void)
625 } 626 }
626 627
627 asm volatile("eieio; tlbsync; ptesync":::"memory"); 628 asm volatile("eieio; tlbsync; ptesync":::"memory");
628 raw_spin_unlock(&native_tlbie_lock);
629 local_irq_restore(flags);
630} 629}
631 630
632/* 631/*
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 230f3a7cdea4..4296d55e88f3 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -487,9 +487,12 @@ int opal_machine_check(struct pt_regs *regs)
487 * PRD component would have already got notified about this 487 * PRD component would have already got notified about this
488 * error through other channels. 488 * error through other channels.
489 * 489 *
490 * In any case, let us just fall through. We anyway heading 490 * If hardware marked this as an unrecoverable MCE, we are
491 * down to panic path. 491 * going to panic anyway. Even if it didn't, it's not safe to
492 * continue at this point, so we should explicitly panic.
492 */ 493 */
494
495 panic("PowerNV Unrecovered Machine Check");
493 return 0; 496 return 0;
494} 497}
495 498
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index 09787139834d..3db53e8aff92 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -194,11 +194,6 @@ static const struct os_area_db_id os_area_db_id_rtc_diff = {
194 .key = OS_AREA_DB_KEY_RTC_DIFF 194 .key = OS_AREA_DB_KEY_RTC_DIFF
195}; 195};
196 196
197static const struct os_area_db_id os_area_db_id_video_mode = {
198 .owner = OS_AREA_DB_OWNER_LINUX,
199 .key = OS_AREA_DB_KEY_VIDEO_MODE
200};
201
202#define SECONDS_FROM_1970_TO_2000 946684800LL 197#define SECONDS_FROM_1970_TO_2000 946684800LL
203 198
204/** 199/**
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
index d4788111c161..fac6ac9790fa 100644
--- a/arch/s390/boot/compressed/Makefile
+++ b/arch/s390/boot/compressed/Makefile
@@ -10,7 +10,7 @@ targets += misc.o piggy.o sizes.h head.o
10 10
11KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUX_INCLUDE) -O2 11KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUX_INCLUDE) -O2
12KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 12KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
13KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks 13KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -msoft-float
14KBUILD_CFLAGS += $(call cc-option,-mpacked-stack) 14KBUILD_CFLAGS += $(call cc-option,-mpacked-stack)
15KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 15KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
16 16
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index 0c98f1508542..ed7da281df66 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -381,7 +381,7 @@ CONFIG_ISCSI_TCP=m
381CONFIG_SCSI_DEBUG=m 381CONFIG_SCSI_DEBUG=m
382CONFIG_ZFCP=y 382CONFIG_ZFCP=y
383CONFIG_SCSI_VIRTIO=m 383CONFIG_SCSI_VIRTIO=m
384CONFIG_SCSI_DH=m 384CONFIG_SCSI_DH=y
385CONFIG_SCSI_DH_RDAC=m 385CONFIG_SCSI_DH_RDAC=m
386CONFIG_SCSI_DH_HP_SW=m 386CONFIG_SCSI_DH_HP_SW=m
387CONFIG_SCSI_DH_EMC=m 387CONFIG_SCSI_DH_EMC=m
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index 82083e1fbdc4..9858b14cde1e 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -377,7 +377,7 @@ CONFIG_ISCSI_TCP=m
377CONFIG_SCSI_DEBUG=m 377CONFIG_SCSI_DEBUG=m
378CONFIG_ZFCP=y 378CONFIG_ZFCP=y
379CONFIG_SCSI_VIRTIO=m 379CONFIG_SCSI_VIRTIO=m
380CONFIG_SCSI_DH=m 380CONFIG_SCSI_DH=y
381CONFIG_SCSI_DH_RDAC=m 381CONFIG_SCSI_DH_RDAC=m
382CONFIG_SCSI_DH_HP_SW=m 382CONFIG_SCSI_DH_HP_SW=m
383CONFIG_SCSI_DH_EMC=m 383CONFIG_SCSI_DH_EMC=m
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index c05c9e0821e3..7f14f80717d4 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -377,7 +377,7 @@ CONFIG_ISCSI_TCP=m
377CONFIG_SCSI_DEBUG=m 377CONFIG_SCSI_DEBUG=m
378CONFIG_ZFCP=y 378CONFIG_ZFCP=y
379CONFIG_SCSI_VIRTIO=m 379CONFIG_SCSI_VIRTIO=m
380CONFIG_SCSI_DH=m 380CONFIG_SCSI_DH=y
381CONFIG_SCSI_DH_RDAC=m 381CONFIG_SCSI_DH_RDAC=m
382CONFIG_SCSI_DH_HP_SW=m 382CONFIG_SCSI_DH_HP_SW=m
383CONFIG_SCSI_DH_EMC=m 383CONFIG_SCSI_DH_EMC=m
diff --git a/arch/s390/include/asm/numa.h b/arch/s390/include/asm/numa.h
index 2a0efc63b9e5..dc19ee0c92aa 100644
--- a/arch/s390/include/asm/numa.h
+++ b/arch/s390/include/asm/numa.h
@@ -19,7 +19,7 @@ int numa_pfn_to_nid(unsigned long pfn);
19int __node_distance(int a, int b); 19int __node_distance(int a, int b);
20void numa_update_cpu_topology(void); 20void numa_update_cpu_topology(void);
21 21
22extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; 22extern cpumask_t node_to_cpumask_map[MAX_NUMNODES];
23extern int numa_debug_enabled; 23extern int numa_debug_enabled;
24 24
25#else 25#else
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index 27ebde643933..94fc55fc72ce 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -68,7 +68,7 @@ static inline int cpu_to_node(int cpu)
68#define cpumask_of_node cpumask_of_node 68#define cpumask_of_node cpumask_of_node
69static inline const struct cpumask *cpumask_of_node(int node) 69static inline const struct cpumask *cpumask_of_node(int node)
70{ 70{
71 return node_to_cpumask_map[node]; 71 return &node_to_cpumask_map[node];
72} 72}
73 73
74/* 74/*
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 48c9af7a7683..3aeeb1b562c0 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -176,6 +176,7 @@ int main(void)
176 DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste)); 176 DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste));
177 DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area)); 177 DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area));
178 DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr)); 178 DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr));
179 DEFINE(__LC_PERCPU_OFFSET, offsetof(struct _lowcore, percpu_offset));
179 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data)); 180 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
180 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap)); 181 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap));
181 DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb)); 182 DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 09b039d7983d..582fe44ab07c 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -733,6 +733,14 @@ ENTRY(psw_idle)
733 stg %r3,__SF_EMPTY(%r15) 733 stg %r3,__SF_EMPTY(%r15)
734 larl %r1,.Lpsw_idle_lpsw+4 734 larl %r1,.Lpsw_idle_lpsw+4
735 stg %r1,__SF_EMPTY+8(%r15) 735 stg %r1,__SF_EMPTY+8(%r15)
736#ifdef CONFIG_SMP
737 larl %r1,smp_cpu_mtid
738 llgf %r1,0(%r1)
739 ltgr %r1,%r1
740 jz .Lpsw_idle_stcctm
741 .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+16(%r15)
742.Lpsw_idle_stcctm:
743#endif
736 STCK __CLOCK_IDLE_ENTER(%r2) 744 STCK __CLOCK_IDLE_ENTER(%r2)
737 stpt __TIMER_IDLE_ENTER(%r2) 745 stpt __TIMER_IDLE_ENTER(%r2)
738.Lpsw_idle_lpsw: 746.Lpsw_idle_lpsw:
@@ -1159,7 +1167,27 @@ cleanup_critical:
1159 jhe 1f 1167 jhe 1f
1160 mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2) 1168 mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2)
1161 mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r2) 1169 mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r2)
11621: # account system time going idle 11701: # calculate idle cycles
1171#ifdef CONFIG_SMP
1172 clg %r9,BASED(.Lcleanup_idle_insn)
1173 jl 3f
1174 larl %r1,smp_cpu_mtid
1175 llgf %r1,0(%r1)
1176 ltgr %r1,%r1
1177 jz 3f
1178 .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+80(%r15)
1179 larl %r3,mt_cycles
1180 ag %r3,__LC_PERCPU_OFFSET
1181 la %r4,__SF_EMPTY+16(%r15)
11822: lg %r0,0(%r3)
1183 slg %r0,0(%r4)
1184 alg %r0,64(%r4)
1185 stg %r0,0(%r3)
1186 la %r3,8(%r3)
1187 la %r4,8(%r4)
1188 brct %r1,2b
1189#endif
11903: # account system time going idle
1163 lg %r9,__LC_STEAL_TIMER 1191 lg %r9,__LC_STEAL_TIMER
1164 alg %r9,__CLOCK_IDLE_ENTER(%r2) 1192 alg %r9,__CLOCK_IDLE_ENTER(%r2)
1165 slg %r9,__LC_LAST_UPDATE_CLOCK 1193 slg %r9,__LC_LAST_UPDATE_CLOCK
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index c8653435c70d..dafc44f519c3 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -25,7 +25,7 @@ static DEFINE_SPINLOCK(virt_timer_lock);
25static atomic64_t virt_timer_current; 25static atomic64_t virt_timer_current;
26static atomic64_t virt_timer_elapsed; 26static atomic64_t virt_timer_elapsed;
27 27
28static DEFINE_PER_CPU(u64, mt_cycles[32]); 28DEFINE_PER_CPU(u64, mt_cycles[8]);
29static DEFINE_PER_CPU(u64, mt_scaling_mult) = { 1 }; 29static DEFINE_PER_CPU(u64, mt_scaling_mult) = { 1 };
30static DEFINE_PER_CPU(u64, mt_scaling_div) = { 1 }; 30static DEFINE_PER_CPU(u64, mt_scaling_div) = { 1 };
31static DEFINE_PER_CPU(u64, mt_scaling_jiffies); 31static DEFINE_PER_CPU(u64, mt_scaling_jiffies);
@@ -60,6 +60,34 @@ static inline int virt_timer_forward(u64 elapsed)
60 return elapsed >= atomic64_read(&virt_timer_current); 60 return elapsed >= atomic64_read(&virt_timer_current);
61} 61}
62 62
63static void update_mt_scaling(void)
64{
65 u64 cycles_new[8], *cycles_old;
66 u64 delta, fac, mult, div;
67 int i;
68
69 stcctm5(smp_cpu_mtid + 1, cycles_new);
70 cycles_old = this_cpu_ptr(mt_cycles);
71 fac = 1;
72 mult = div = 0;
73 for (i = 0; i <= smp_cpu_mtid; i++) {
74 delta = cycles_new[i] - cycles_old[i];
75 div += delta;
76 mult *= i + 1;
77 mult += delta * fac;
78 fac *= i + 1;
79 }
80 div *= fac;
81 if (div > 0) {
82 /* Update scaling factor */
83 __this_cpu_write(mt_scaling_mult, mult);
84 __this_cpu_write(mt_scaling_div, div);
85 memcpy(cycles_old, cycles_new,
86 sizeof(u64) * (smp_cpu_mtid + 1));
87 }
88 __this_cpu_write(mt_scaling_jiffies, jiffies_64);
89}
90
63/* 91/*
64 * Update process times based on virtual cpu times stored by entry.S 92 * Update process times based on virtual cpu times stored by entry.S
65 * to the lowcore fields user_timer, system_timer & steal_clock. 93 * to the lowcore fields user_timer, system_timer & steal_clock.
@@ -69,7 +97,6 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
69 struct thread_info *ti = task_thread_info(tsk); 97 struct thread_info *ti = task_thread_info(tsk);
70 u64 timer, clock, user, system, steal; 98 u64 timer, clock, user, system, steal;
71 u64 user_scaled, system_scaled; 99 u64 user_scaled, system_scaled;
72 int i;
73 100
74 timer = S390_lowcore.last_update_timer; 101 timer = S390_lowcore.last_update_timer;
75 clock = S390_lowcore.last_update_clock; 102 clock = S390_lowcore.last_update_clock;
@@ -85,34 +112,10 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
85 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 112 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
86 S390_lowcore.steal_timer += S390_lowcore.last_update_clock - clock; 113 S390_lowcore.steal_timer += S390_lowcore.last_update_clock - clock;
87 114
88 /* Do MT utilization calculation */ 115 /* Update MT utilization calculation */
89 if (smp_cpu_mtid && 116 if (smp_cpu_mtid &&
90 time_after64(jiffies_64, __this_cpu_read(mt_scaling_jiffies))) { 117 time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
91 u64 cycles_new[32], *cycles_old; 118 update_mt_scaling();
92 u64 delta, fac, mult, div;
93
94 cycles_old = this_cpu_ptr(mt_cycles);
95 if (stcctm5(smp_cpu_mtid + 1, cycles_new) < 2) {
96 fac = 1;
97 mult = div = 0;
98 for (i = 0; i <= smp_cpu_mtid; i++) {
99 delta = cycles_new[i] - cycles_old[i];
100 div += delta;
101 mult *= i + 1;
102 mult += delta * fac;
103 fac *= i + 1;
104 }
105 div *= fac;
106 if (div > 0) {
107 /* Update scaling factor */
108 __this_cpu_write(mt_scaling_mult, mult);
109 __this_cpu_write(mt_scaling_div, div);
110 memcpy(cycles_old, cycles_new,
111 sizeof(u64) * (smp_cpu_mtid + 1));
112 }
113 }
114 __this_cpu_write(mt_scaling_jiffies, jiffies_64);
115 }
116 119
117 user = S390_lowcore.user_timer - ti->user_timer; 120 user = S390_lowcore.user_timer - ti->user_timer;
118 S390_lowcore.steal_timer -= user; 121 S390_lowcore.steal_timer -= user;
@@ -181,6 +184,11 @@ void vtime_account_irq_enter(struct task_struct *tsk)
181 S390_lowcore.last_update_timer = get_vtimer(); 184 S390_lowcore.last_update_timer = get_vtimer();
182 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 185 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
183 186
187 /* Update MT utilization calculation */
188 if (smp_cpu_mtid &&
189 time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
190 update_mt_scaling();
191
184 system = S390_lowcore.system_timer - ti->system_timer; 192 system = S390_lowcore.system_timer - ti->system_timer;
185 S390_lowcore.steal_timer -= system; 193 S390_lowcore.steal_timer -= system;
186 ti->system_timer = S390_lowcore.system_timer; 194 ti->system_timer = S390_lowcore.system_timer;
diff --git a/arch/s390/numa/mode_emu.c b/arch/s390/numa/mode_emu.c
index 7de4e2f780d7..30b2698a28e2 100644
--- a/arch/s390/numa/mode_emu.c
+++ b/arch/s390/numa/mode_emu.c
@@ -368,7 +368,7 @@ static void topology_add_core(struct toptree *core)
368 cpumask_copy(&top->thread_mask, &core->mask); 368 cpumask_copy(&top->thread_mask, &core->mask);
369 cpumask_copy(&top->core_mask, &core_mc(core)->mask); 369 cpumask_copy(&top->core_mask, &core_mc(core)->mask);
370 cpumask_copy(&top->book_mask, &core_book(core)->mask); 370 cpumask_copy(&top->book_mask, &core_book(core)->mask);
371 cpumask_set_cpu(cpu, node_to_cpumask_map[core_node(core)->id]); 371 cpumask_set_cpu(cpu, &node_to_cpumask_map[core_node(core)->id]);
372 top->node_id = core_node(core)->id; 372 top->node_id = core_node(core)->id;
373 } 373 }
374} 374}
@@ -383,7 +383,7 @@ static void toptree_to_topology(struct toptree *numa)
383 383
384 /* Clear all node masks */ 384 /* Clear all node masks */
385 for (i = 0; i < MAX_NUMNODES; i++) 385 for (i = 0; i < MAX_NUMNODES; i++)
386 cpumask_clear(node_to_cpumask_map[i]); 386 cpumask_clear(&node_to_cpumask_map[i]);
387 387
388 /* Rebuild all masks */ 388 /* Rebuild all masks */
389 toptree_for_each(core, numa, CORE) 389 toptree_for_each(core, numa, CORE)
diff --git a/arch/s390/numa/numa.c b/arch/s390/numa/numa.c
index 09b1d2355bd9..43f32ce60aa3 100644
--- a/arch/s390/numa/numa.c
+++ b/arch/s390/numa/numa.c
@@ -23,7 +23,7 @@
23pg_data_t *node_data[MAX_NUMNODES]; 23pg_data_t *node_data[MAX_NUMNODES];
24EXPORT_SYMBOL(node_data); 24EXPORT_SYMBOL(node_data);
25 25
26cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; 26cpumask_t node_to_cpumask_map[MAX_NUMNODES];
27EXPORT_SYMBOL(node_to_cpumask_map); 27EXPORT_SYMBOL(node_to_cpumask_map);
28 28
29const struct numa_mode numa_mode_plain = { 29const struct numa_mode numa_mode_plain = {
@@ -144,7 +144,7 @@ void __init numa_setup(void)
144static int __init numa_init_early(void) 144static int __init numa_init_early(void)
145{ 145{
146 /* Attach all possible CPUs to node 0 for now. */ 146 /* Attach all possible CPUs to node 0 for now. */
147 cpumask_copy(node_to_cpumask_map[0], cpu_possible_mask); 147 cpumask_copy(&node_to_cpumask_map[0], cpu_possible_mask);
148 return 0; 148 return 0;
149} 149}
150early_initcall(numa_init_early); 150early_initcall(numa_init_early);
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index fe20d14ae051..ceb5201a30ed 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -59,6 +59,7 @@ pages_do_alias(unsigned long addr1, unsigned long addr2)
59 59
60#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 60#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
61extern void copy_page(void *to, void *from); 61extern void copy_page(void *to, void *from);
62#define copy_user_page(to, from, vaddr, pg) __copy_user(to, from, PAGE_SIZE)
62 63
63struct page; 64struct page;
64struct vm_area_struct; 65struct vm_area_struct;
diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c
index 2e48eb8813ff..c90930de76ba 100644
--- a/arch/sparc/crypto/aes_glue.c
+++ b/arch/sparc/crypto/aes_glue.c
@@ -433,6 +433,7 @@ static struct crypto_alg algs[] = { {
433 .blkcipher = { 433 .blkcipher = {
434 .min_keysize = AES_MIN_KEY_SIZE, 434 .min_keysize = AES_MIN_KEY_SIZE,
435 .max_keysize = AES_MAX_KEY_SIZE, 435 .max_keysize = AES_MAX_KEY_SIZE,
436 .ivsize = AES_BLOCK_SIZE,
436 .setkey = aes_set_key, 437 .setkey = aes_set_key,
437 .encrypt = cbc_encrypt, 438 .encrypt = cbc_encrypt,
438 .decrypt = cbc_decrypt, 439 .decrypt = cbc_decrypt,
@@ -452,6 +453,7 @@ static struct crypto_alg algs[] = { {
452 .blkcipher = { 453 .blkcipher = {
453 .min_keysize = AES_MIN_KEY_SIZE, 454 .min_keysize = AES_MIN_KEY_SIZE,
454 .max_keysize = AES_MAX_KEY_SIZE, 455 .max_keysize = AES_MAX_KEY_SIZE,
456 .ivsize = AES_BLOCK_SIZE,
455 .setkey = aes_set_key, 457 .setkey = aes_set_key,
456 .encrypt = ctr_crypt, 458 .encrypt = ctr_crypt,
457 .decrypt = ctr_crypt, 459 .decrypt = ctr_crypt,
diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c
index 6bf2479a12fb..561a84d93cf6 100644
--- a/arch/sparc/crypto/camellia_glue.c
+++ b/arch/sparc/crypto/camellia_glue.c
@@ -274,6 +274,7 @@ static struct crypto_alg algs[] = { {
274 .blkcipher = { 274 .blkcipher = {
275 .min_keysize = CAMELLIA_MIN_KEY_SIZE, 275 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
276 .max_keysize = CAMELLIA_MAX_KEY_SIZE, 276 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
277 .ivsize = CAMELLIA_BLOCK_SIZE,
277 .setkey = camellia_set_key, 278 .setkey = camellia_set_key,
278 .encrypt = cbc_encrypt, 279 .encrypt = cbc_encrypt,
279 .decrypt = cbc_decrypt, 280 .decrypt = cbc_decrypt,
diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c
index dd6a34fa6e19..61af794aa2d3 100644
--- a/arch/sparc/crypto/des_glue.c
+++ b/arch/sparc/crypto/des_glue.c
@@ -429,6 +429,7 @@ static struct crypto_alg algs[] = { {
429 .blkcipher = { 429 .blkcipher = {
430 .min_keysize = DES_KEY_SIZE, 430 .min_keysize = DES_KEY_SIZE,
431 .max_keysize = DES_KEY_SIZE, 431 .max_keysize = DES_KEY_SIZE,
432 .ivsize = DES_BLOCK_SIZE,
432 .setkey = des_set_key, 433 .setkey = des_set_key,
433 .encrypt = cbc_encrypt, 434 .encrypt = cbc_encrypt,
434 .decrypt = cbc_decrypt, 435 .decrypt = cbc_decrypt,
@@ -485,6 +486,7 @@ static struct crypto_alg algs[] = { {
485 .blkcipher = { 486 .blkcipher = {
486 .min_keysize = DES3_EDE_KEY_SIZE, 487 .min_keysize = DES3_EDE_KEY_SIZE,
487 .max_keysize = DES3_EDE_KEY_SIZE, 488 .max_keysize = DES3_EDE_KEY_SIZE,
489 .ivsize = DES3_EDE_BLOCK_SIZE,
488 .setkey = des3_ede_set_key, 490 .setkey = des3_ede_set_key,
489 .encrypt = cbc3_encrypt, 491 .encrypt = cbc3_encrypt,
490 .decrypt = cbc3_decrypt, 492 .decrypt = cbc3_decrypt,
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 0b6cacaad933..ba35c41c71ff 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -40,5 +40,4 @@ generic-y += termbits.h
40generic-y += termios.h 40generic-y += termios.h
41generic-y += trace_clock.h 41generic-y += trace_clock.h
42generic-y += types.h 42generic-y += types.h
43generic-y += word-at-a-time.h
44generic-y += xor.h 43generic-y += xor.h
diff --git a/arch/tile/include/asm/word-at-a-time.h b/arch/tile/include/asm/word-at-a-time.h
index 9e5ce0d7b292..b66a693c2c34 100644
--- a/arch/tile/include/asm/word-at-a-time.h
+++ b/arch/tile/include/asm/word-at-a-time.h
@@ -6,7 +6,7 @@
6struct word_at_a_time { /* unused */ }; 6struct word_at_a_time { /* unused */ };
7#define WORD_AT_A_TIME_CONSTANTS {} 7#define WORD_AT_A_TIME_CONSTANTS {}
8 8
9/* Generate 0x01 byte values for non-zero bytes using a SIMD instruction. */ 9/* Generate 0x01 byte values for zero bytes using a SIMD instruction. */
10static inline unsigned long has_zero(unsigned long val, unsigned long *data, 10static inline unsigned long has_zero(unsigned long val, unsigned long *data,
11 const struct word_at_a_time *c) 11 const struct word_at_a_time *c)
12{ 12{
@@ -33,4 +33,10 @@ static inline long find_zero(unsigned long mask)
33#endif 33#endif
34} 34}
35 35
36#ifdef __BIG_ENDIAN
37#define zero_bytemask(mask) (~1ul << (63 - __builtin_clzl(mask)))
38#else
39#define zero_bytemask(mask) ((2ul << __builtin_ctzl(mask)) - 1)
40#endif
41
36#endif /* _ASM_WORD_AT_A_TIME_H */ 42#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 328c8352480c..96d058a87100 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1308,6 +1308,7 @@ config HIGHMEM
1308config X86_PAE 1308config X86_PAE
1309 bool "PAE (Physical Address Extension) Support" 1309 bool "PAE (Physical Address Extension) Support"
1310 depends on X86_32 && !HIGHMEM4G 1310 depends on X86_32 && !HIGHMEM4G
1311 select SWIOTLB
1311 ---help--- 1312 ---help---
1312 PAE is required for NX support, and furthermore enables 1313 PAE is required for NX support, and furthermore enables
1313 larger swapspace support for non-overcommit purposes. It 1314 larger swapspace support for non-overcommit purposes. It
diff --git a/arch/x86/crypto/camellia_aesni_avx_glue.c b/arch/x86/crypto/camellia_aesni_avx_glue.c
index 80a0e4389c9a..bacaa13acac5 100644
--- a/arch/x86/crypto/camellia_aesni_avx_glue.c
+++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
@@ -554,6 +554,11 @@ static int __init camellia_aesni_init(void)
554{ 554{
555 const char *feature_name; 555 const char *feature_name;
556 556
557 if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
558 pr_info("AVX or AES-NI instructions are not detected.\n");
559 return -ENODEV;
560 }
561
557 if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) { 562 if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
558 pr_info("CPU feature '%s' is not supported.\n", feature_name); 563 pr_info("CPU feature '%s' is not supported.\n", feature_name);
559 return -ENODEV; 564 return -ENODEV;
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 2beee0382088..3a36ee704c30 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1226,10 +1226,8 @@ void kvm_complete_insn_gp(struct kvm_vcpu *vcpu, int err);
1226 1226
1227int kvm_is_in_guest(void); 1227int kvm_is_in_guest(void);
1228 1228
1229int __x86_set_memory_region(struct kvm *kvm, 1229int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size);
1230 const struct kvm_userspace_memory_region *mem); 1230int x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size);
1231int x86_set_memory_region(struct kvm *kvm,
1232 const struct kvm_userspace_memory_region *mem);
1233bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu); 1231bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu);
1234bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu); 1232bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu);
1235 1233
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 83aea8055119..4c20dd333412 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -336,10 +336,10 @@ HYPERVISOR_update_descriptor(u64 ma, u64 desc)
336 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); 336 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
337} 337}
338 338
339static inline int 339static inline long
340HYPERVISOR_memory_op(unsigned int cmd, void *arg) 340HYPERVISOR_memory_op(unsigned int cmd, void *arg)
341{ 341{
342 return _hypercall2(int, memory_op, cmd, arg); 342 return _hypercall2(long, memory_op, cmd, arg);
343} 343}
344 344
345static inline int 345static inline int
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index b372a7557c16..9da95b9daf8d 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2418,7 +2418,7 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase)
2418 u64 val, cr0, cr4; 2418 u64 val, cr0, cr4;
2419 u32 base3; 2419 u32 base3;
2420 u16 selector; 2420 u16 selector;
2421 int i; 2421 int i, r;
2422 2422
2423 for (i = 0; i < 16; i++) 2423 for (i = 0; i < 16; i++)
2424 *reg_write(ctxt, i) = GET_SMSTATE(u64, smbase, 0x7ff8 - i * 8); 2424 *reg_write(ctxt, i) = GET_SMSTATE(u64, smbase, 0x7ff8 - i * 8);
@@ -2460,13 +2460,17 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase)
2460 dt.address = GET_SMSTATE(u64, smbase, 0x7e68); 2460 dt.address = GET_SMSTATE(u64, smbase, 0x7e68);
2461 ctxt->ops->set_gdt(ctxt, &dt); 2461 ctxt->ops->set_gdt(ctxt, &dt);
2462 2462
2463 r = rsm_enter_protected_mode(ctxt, cr0, cr4);
2464 if (r != X86EMUL_CONTINUE)
2465 return r;
2466
2463 for (i = 0; i < 6; i++) { 2467 for (i = 0; i < 6; i++) {
2464 int r = rsm_load_seg_64(ctxt, smbase, i); 2468 r = rsm_load_seg_64(ctxt, smbase, i);
2465 if (r != X86EMUL_CONTINUE) 2469 if (r != X86EMUL_CONTINUE)
2466 return r; 2470 return r;
2467 } 2471 }
2468 2472
2469 return rsm_enter_protected_mode(ctxt, cr0, cr4); 2473 return X86EMUL_CONTINUE;
2470} 2474}
2471 2475
2472static int em_rsm(struct x86_emulate_ctxt *ctxt) 2476static int em_rsm(struct x86_emulate_ctxt *ctxt)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 06ef4908ba61..6a8bc64566ab 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4105,17 +4105,13 @@ static void seg_setup(int seg)
4105static int alloc_apic_access_page(struct kvm *kvm) 4105static int alloc_apic_access_page(struct kvm *kvm)
4106{ 4106{
4107 struct page *page; 4107 struct page *page;
4108 struct kvm_userspace_memory_region kvm_userspace_mem;
4109 int r = 0; 4108 int r = 0;
4110 4109
4111 mutex_lock(&kvm->slots_lock); 4110 mutex_lock(&kvm->slots_lock);
4112 if (kvm->arch.apic_access_page_done) 4111 if (kvm->arch.apic_access_page_done)
4113 goto out; 4112 goto out;
4114 kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; 4113 r = __x86_set_memory_region(kvm, APIC_ACCESS_PAGE_PRIVATE_MEMSLOT,
4115 kvm_userspace_mem.flags = 0; 4114 APIC_DEFAULT_PHYS_BASE, PAGE_SIZE);
4116 kvm_userspace_mem.guest_phys_addr = APIC_DEFAULT_PHYS_BASE;
4117 kvm_userspace_mem.memory_size = PAGE_SIZE;
4118 r = __x86_set_memory_region(kvm, &kvm_userspace_mem);
4119 if (r) 4115 if (r)
4120 goto out; 4116 goto out;
4121 4117
@@ -4140,17 +4136,12 @@ static int alloc_identity_pagetable(struct kvm *kvm)
4140{ 4136{
4141 /* Called with kvm->slots_lock held. */ 4137 /* Called with kvm->slots_lock held. */
4142 4138
4143 struct kvm_userspace_memory_region kvm_userspace_mem;
4144 int r = 0; 4139 int r = 0;
4145 4140
4146 BUG_ON(kvm->arch.ept_identity_pagetable_done); 4141 BUG_ON(kvm->arch.ept_identity_pagetable_done);
4147 4142
4148 kvm_userspace_mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT; 4143 r = __x86_set_memory_region(kvm, IDENTITY_PAGETABLE_PRIVATE_MEMSLOT,
4149 kvm_userspace_mem.flags = 0; 4144 kvm->arch.ept_identity_map_addr, PAGE_SIZE);
4150 kvm_userspace_mem.guest_phys_addr =
4151 kvm->arch.ept_identity_map_addr;
4152 kvm_userspace_mem.memory_size = PAGE_SIZE;
4153 r = __x86_set_memory_region(kvm, &kvm_userspace_mem);
4154 4145
4155 return r; 4146 return r;
4156} 4147}
@@ -4949,14 +4940,9 @@ static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu)
4949static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr) 4940static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr)
4950{ 4941{
4951 int ret; 4942 int ret;
4952 struct kvm_userspace_memory_region tss_mem = {
4953 .slot = TSS_PRIVATE_MEMSLOT,
4954 .guest_phys_addr = addr,
4955 .memory_size = PAGE_SIZE * 3,
4956 .flags = 0,
4957 };
4958 4943
4959 ret = x86_set_memory_region(kvm, &tss_mem); 4944 ret = x86_set_memory_region(kvm, TSS_PRIVATE_MEMSLOT, addr,
4945 PAGE_SIZE * 3);
4960 if (ret) 4946 if (ret)
4961 return ret; 4947 return ret;
4962 kvm->arch.tss_addr = addr; 4948 kvm->arch.tss_addr = addr;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 92511d4b7236..9a9a19830321 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6453,6 +6453,12 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu)
6453 return 1; 6453 return 1;
6454} 6454}
6455 6455
6456static inline bool kvm_vcpu_running(struct kvm_vcpu *vcpu)
6457{
6458 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE &&
6459 !vcpu->arch.apf.halted);
6460}
6461
6456static int vcpu_run(struct kvm_vcpu *vcpu) 6462static int vcpu_run(struct kvm_vcpu *vcpu)
6457{ 6463{
6458 int r; 6464 int r;
@@ -6461,8 +6467,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
6461 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); 6467 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
6462 6468
6463 for (;;) { 6469 for (;;) {
6464 if (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && 6470 if (kvm_vcpu_running(vcpu))
6465 !vcpu->arch.apf.halted)
6466 r = vcpu_enter_guest(vcpu); 6471 r = vcpu_enter_guest(vcpu);
6467 else 6472 else
6468 r = vcpu_block(kvm, vcpu); 6473 r = vcpu_block(kvm, vcpu);
@@ -7474,34 +7479,66 @@ void kvm_arch_sync_events(struct kvm *kvm)
7474 kvm_free_pit(kvm); 7479 kvm_free_pit(kvm);
7475} 7480}
7476 7481
7477int __x86_set_memory_region(struct kvm *kvm, 7482int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
7478 const struct kvm_userspace_memory_region *mem)
7479{ 7483{
7480 int i, r; 7484 int i, r;
7485 unsigned long hva;
7486 struct kvm_memslots *slots = kvm_memslots(kvm);
7487 struct kvm_memory_slot *slot, old;
7481 7488
7482 /* Called with kvm->slots_lock held. */ 7489 /* Called with kvm->slots_lock held. */
7483 BUG_ON(mem->slot >= KVM_MEM_SLOTS_NUM); 7490 if (WARN_ON(id >= KVM_MEM_SLOTS_NUM))
7491 return -EINVAL;
7492
7493 slot = id_to_memslot(slots, id);
7494 if (size) {
7495 if (WARN_ON(slot->npages))
7496 return -EEXIST;
7497
7498 /*
7499 * MAP_SHARED to prevent internal slot pages from being moved
7500 * by fork()/COW.
7501 */
7502 hva = vm_mmap(NULL, 0, size, PROT_READ | PROT_WRITE,
7503 MAP_SHARED | MAP_ANONYMOUS, 0);
7504 if (IS_ERR((void *)hva))
7505 return PTR_ERR((void *)hva);
7506 } else {
7507 if (!slot->npages)
7508 return 0;
7484 7509
7510 hva = 0;
7511 }
7512
7513 old = *slot;
7485 for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) { 7514 for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
7486 struct kvm_userspace_memory_region m = *mem; 7515 struct kvm_userspace_memory_region m;
7487 7516
7488 m.slot |= i << 16; 7517 m.slot = id | (i << 16);
7518 m.flags = 0;
7519 m.guest_phys_addr = gpa;
7520 m.userspace_addr = hva;
7521 m.memory_size = size;
7489 r = __kvm_set_memory_region(kvm, &m); 7522 r = __kvm_set_memory_region(kvm, &m);
7490 if (r < 0) 7523 if (r < 0)
7491 return r; 7524 return r;
7492 } 7525 }
7493 7526
7527 if (!size) {
7528 r = vm_munmap(old.userspace_addr, old.npages * PAGE_SIZE);
7529 WARN_ON(r < 0);
7530 }
7531
7494 return 0; 7532 return 0;
7495} 7533}
7496EXPORT_SYMBOL_GPL(__x86_set_memory_region); 7534EXPORT_SYMBOL_GPL(__x86_set_memory_region);
7497 7535
7498int x86_set_memory_region(struct kvm *kvm, 7536int x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
7499 const struct kvm_userspace_memory_region *mem)
7500{ 7537{
7501 int r; 7538 int r;
7502 7539
7503 mutex_lock(&kvm->slots_lock); 7540 mutex_lock(&kvm->slots_lock);
7504 r = __x86_set_memory_region(kvm, mem); 7541 r = __x86_set_memory_region(kvm, id, gpa, size);
7505 mutex_unlock(&kvm->slots_lock); 7542 mutex_unlock(&kvm->slots_lock);
7506 7543
7507 return r; 7544 return r;
@@ -7516,16 +7553,9 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
7516 * unless the the memory map has changed due to process exit 7553 * unless the the memory map has changed due to process exit
7517 * or fd copying. 7554 * or fd copying.
7518 */ 7555 */
7519 struct kvm_userspace_memory_region mem; 7556 x86_set_memory_region(kvm, APIC_ACCESS_PAGE_PRIVATE_MEMSLOT, 0, 0);
7520 memset(&mem, 0, sizeof(mem)); 7557 x86_set_memory_region(kvm, IDENTITY_PAGETABLE_PRIVATE_MEMSLOT, 0, 0);
7521 mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; 7558 x86_set_memory_region(kvm, TSS_PRIVATE_MEMSLOT, 0, 0);
7522 x86_set_memory_region(kvm, &mem);
7523
7524 mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT;
7525 x86_set_memory_region(kvm, &mem);
7526
7527 mem.slot = TSS_PRIVATE_MEMSLOT;
7528 x86_set_memory_region(kvm, &mem);
7529 } 7559 }
7530 kvm_iommu_unmap_guest(kvm); 7560 kvm_iommu_unmap_guest(kvm);
7531 kfree(kvm->arch.vpic); 7561 kfree(kvm->arch.vpic);
@@ -7628,27 +7658,6 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
7628 const struct kvm_userspace_memory_region *mem, 7658 const struct kvm_userspace_memory_region *mem,
7629 enum kvm_mr_change change) 7659 enum kvm_mr_change change)
7630{ 7660{
7631 /*
7632 * Only private memory slots need to be mapped here since
7633 * KVM_SET_MEMORY_REGION ioctl is no longer supported.
7634 */
7635 if ((memslot->id >= KVM_USER_MEM_SLOTS) && (change == KVM_MR_CREATE)) {
7636 unsigned long userspace_addr;
7637
7638 /*
7639 * MAP_SHARED to prevent internal slot pages from being moved
7640 * by fork()/COW.
7641 */
7642 userspace_addr = vm_mmap(NULL, 0, memslot->npages * PAGE_SIZE,
7643 PROT_READ | PROT_WRITE,
7644 MAP_SHARED | MAP_ANONYMOUS, 0);
7645
7646 if (IS_ERR((void *)userspace_addr))
7647 return PTR_ERR((void *)userspace_addr);
7648
7649 memslot->userspace_addr = userspace_addr;
7650 }
7651
7652 return 0; 7661 return 0;
7653} 7662}
7654 7663
@@ -7710,17 +7719,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
7710{ 7719{
7711 int nr_mmu_pages = 0; 7720 int nr_mmu_pages = 0;
7712 7721
7713 if (change == KVM_MR_DELETE && old->id >= KVM_USER_MEM_SLOTS) {
7714 int ret;
7715
7716 ret = vm_munmap(old->userspace_addr,
7717 old->npages * PAGE_SIZE);
7718 if (ret < 0)
7719 printk(KERN_WARNING
7720 "kvm_vm_ioctl_set_memory_region: "
7721 "failed to munmap memory\n");
7722 }
7723
7724 if (!kvm->arch.n_requested_mmu_pages) 7722 if (!kvm->arch.n_requested_mmu_pages)
7725 nr_mmu_pages = kvm_mmu_calculate_mmu_pages(kvm); 7723 nr_mmu_pages = kvm_mmu_calculate_mmu_pages(kvm);
7726 7724
@@ -7769,19 +7767,36 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
7769 kvm_mmu_invalidate_zap_all_pages(kvm); 7767 kvm_mmu_invalidate_zap_all_pages(kvm);
7770} 7768}
7771 7769
7770static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu)
7771{
7772 if (!list_empty_careful(&vcpu->async_pf.done))
7773 return true;
7774
7775 if (kvm_apic_has_events(vcpu))
7776 return true;
7777
7778 if (vcpu->arch.pv.pv_unhalted)
7779 return true;
7780
7781 if (atomic_read(&vcpu->arch.nmi_queued))
7782 return true;
7783
7784 if (test_bit(KVM_REQ_SMI, &vcpu->requests))
7785 return true;
7786
7787 if (kvm_arch_interrupt_allowed(vcpu) &&
7788 kvm_cpu_has_interrupt(vcpu))
7789 return true;
7790
7791 return false;
7792}
7793
7772int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 7794int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
7773{ 7795{
7774 if (is_guest_mode(vcpu) && kvm_x86_ops->check_nested_events) 7796 if (is_guest_mode(vcpu) && kvm_x86_ops->check_nested_events)
7775 kvm_x86_ops->check_nested_events(vcpu, false); 7797 kvm_x86_ops->check_nested_events(vcpu, false);
7776 7798
7777 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && 7799 return kvm_vcpu_running(vcpu) || kvm_vcpu_has_events(vcpu);
7778 !vcpu->arch.apf.halted)
7779 || !list_empty_careful(&vcpu->async_pf.done)
7780 || kvm_apic_has_events(vcpu)
7781 || vcpu->arch.pv.pv_unhalted
7782 || atomic_read(&vcpu->arch.nmi_queued) ||
7783 (kvm_arch_interrupt_allowed(vcpu) &&
7784 kvm_cpu_has_interrupt(vcpu));
7785} 7800}
7786 7801
7787int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) 7802int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 30d12afe52ed..993b7a71386d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -33,6 +33,10 @@
33#include <linux/memblock.h> 33#include <linux/memblock.h>
34#include <linux/edd.h> 34#include <linux/edd.h>
35 35
36#ifdef CONFIG_KEXEC_CORE
37#include <linux/kexec.h>
38#endif
39
36#include <xen/xen.h> 40#include <xen/xen.h>
37#include <xen/events.h> 41#include <xen/events.h>
38#include <xen/interface/xen.h> 42#include <xen/interface/xen.h>
@@ -1077,6 +1081,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
1077 /* Fast syscall setup is all done in hypercalls, so 1081 /* Fast syscall setup is all done in hypercalls, so
1078 these are all ignored. Stub them out here to stop 1082 these are all ignored. Stub them out here to stop
1079 Xen console noise. */ 1083 Xen console noise. */
1084 break;
1080 1085
1081 default: 1086 default:
1082 if (!pmu_msr_write(msr, low, high, &ret)) 1087 if (!pmu_msr_write(msr, low, high, &ret))
@@ -1807,6 +1812,21 @@ static struct notifier_block xen_hvm_cpu_notifier = {
1807 .notifier_call = xen_hvm_cpu_notify, 1812 .notifier_call = xen_hvm_cpu_notify,
1808}; 1813};
1809 1814
1815#ifdef CONFIG_KEXEC_CORE
1816static void xen_hvm_shutdown(void)
1817{
1818 native_machine_shutdown();
1819 if (kexec_in_progress)
1820 xen_reboot(SHUTDOWN_soft_reset);
1821}
1822
1823static void xen_hvm_crash_shutdown(struct pt_regs *regs)
1824{
1825 native_machine_crash_shutdown(regs);
1826 xen_reboot(SHUTDOWN_soft_reset);
1827}
1828#endif
1829
1810static void __init xen_hvm_guest_init(void) 1830static void __init xen_hvm_guest_init(void)
1811{ 1831{
1812 if (xen_pv_domain()) 1832 if (xen_pv_domain())
@@ -1826,6 +1846,10 @@ static void __init xen_hvm_guest_init(void)
1826 x86_init.irqs.intr_init = xen_init_IRQ; 1846 x86_init.irqs.intr_init = xen_init_IRQ;
1827 xen_hvm_init_time_ops(); 1847 xen_hvm_init_time_ops();
1828 xen_hvm_init_mmu_ops(); 1848 xen_hvm_init_mmu_ops();
1849#ifdef CONFIG_KEXEC_CORE
1850 machine_ops.shutdown = xen_hvm_shutdown;
1851 machine_ops.crash_shutdown = xen_hvm_crash_shutdown;
1852#endif
1829} 1853}
1830#endif 1854#endif
1831 1855
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index bfc08b13044b..660b3cfef234 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -112,6 +112,15 @@ static unsigned long *p2m_identity;
112static pte_t *p2m_missing_pte; 112static pte_t *p2m_missing_pte;
113static pte_t *p2m_identity_pte; 113static pte_t *p2m_identity_pte;
114 114
115/*
116 * Hint at last populated PFN.
117 *
118 * Used to set HYPERVISOR_shared_info->arch.max_pfn so the toolstack
119 * can avoid scanning the whole P2M (which may be sized to account for
120 * hotplugged memory).
121 */
122static unsigned long xen_p2m_last_pfn;
123
115static inline unsigned p2m_top_index(unsigned long pfn) 124static inline unsigned p2m_top_index(unsigned long pfn)
116{ 125{
117 BUG_ON(pfn >= MAX_P2M_PFN); 126 BUG_ON(pfn >= MAX_P2M_PFN);
@@ -270,7 +279,7 @@ void xen_setup_mfn_list_list(void)
270 else 279 else
271 HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = 280 HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
272 virt_to_mfn(p2m_top_mfn); 281 virt_to_mfn(p2m_top_mfn);
273 HYPERVISOR_shared_info->arch.max_pfn = xen_max_p2m_pfn; 282 HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn;
274 HYPERVISOR_shared_info->arch.p2m_generation = 0; 283 HYPERVISOR_shared_info->arch.p2m_generation = 0;
275 HYPERVISOR_shared_info->arch.p2m_vaddr = (unsigned long)xen_p2m_addr; 284 HYPERVISOR_shared_info->arch.p2m_vaddr = (unsigned long)xen_p2m_addr;
276 HYPERVISOR_shared_info->arch.p2m_cr3 = 285 HYPERVISOR_shared_info->arch.p2m_cr3 =
@@ -406,6 +415,8 @@ void __init xen_vmalloc_p2m_tree(void)
406 static struct vm_struct vm; 415 static struct vm_struct vm;
407 unsigned long p2m_limit; 416 unsigned long p2m_limit;
408 417
418 xen_p2m_last_pfn = xen_max_p2m_pfn;
419
409 p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE; 420 p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE;
410 vm.flags = VM_ALLOC; 421 vm.flags = VM_ALLOC;
411 vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit), 422 vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit),
@@ -608,6 +619,12 @@ static bool alloc_p2m(unsigned long pfn)
608 free_p2m_page(p2m); 619 free_p2m_page(p2m);
609 } 620 }
610 621
622 /* Expanded the p2m? */
623 if (pfn > xen_p2m_last_pfn) {
624 xen_p2m_last_pfn = pfn;
625 HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn;
626 }
627
611 return true; 628 return true;
612} 629}
613 630
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index f5ef6746d47a..1c30e4ab1022 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -548,7 +548,7 @@ static unsigned long __init xen_get_max_pages(void)
548{ 548{
549 unsigned long max_pages, limit; 549 unsigned long max_pages, limit;
550 domid_t domid = DOMID_SELF; 550 domid_t domid = DOMID_SELF;
551 int ret; 551 long ret;
552 552
553 limit = xen_get_pages_limit(); 553 limit = xen_get_pages_limit();
554 max_pages = limit; 554 max_pages = limit;
@@ -798,7 +798,7 @@ char * __init xen_memory_setup(void)
798 xen_ignore_unusable(); 798 xen_ignore_unusable();
799 799
800 /* Make sure the Xen-supplied memory map is well-ordered. */ 800 /* Make sure the Xen-supplied memory map is well-ordered. */
801 sanitize_e820_map(xen_e820_map, xen_e820_map_entries, 801 sanitize_e820_map(xen_e820_map, ARRAY_SIZE(xen_e820_map),
802 &xen_e820_map_entries); 802 &xen_e820_map_entries);
803 803
804 max_pages = xen_get_max_pages(); 804 max_pages = xen_get_max_pages();
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 8acb886032ae..9c1dc8d6106a 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -544,7 +544,8 @@ static int ahash_prepare_alg(struct ahash_alg *alg)
544 struct crypto_alg *base = &alg->halg.base; 544 struct crypto_alg *base = &alg->halg.base;
545 545
546 if (alg->halg.digestsize > PAGE_SIZE / 8 || 546 if (alg->halg.digestsize > PAGE_SIZE / 8 ||
547 alg->halg.statesize > PAGE_SIZE / 8) 547 alg->halg.statesize > PAGE_SIZE / 8 ||
548 alg->halg.statesize == 0)
548 return -EINVAL; 549 return -EINVAL;
549 550
550 base->cra_type = &crypto_ahash_type; 551 base->cra_type = &crypto_ahash_type;
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 09f37b516808..4dde37c3d8fc 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -61,6 +61,7 @@ ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
61ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX); 61ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX);
62ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX); 62ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX);
63ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX); 63ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX);
64ACPI_INIT_GLOBAL(u32, acpi_gbl_fadt_index, ACPI_INVALID_TABLE_INDEX);
64 65
65#if (!ACPI_REDUCED_HARDWARE) 66#if (!ACPI_REDUCED_HARDWARE)
66ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS); 67ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index f7731f260c31..591ea95319e2 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -85,7 +85,7 @@ void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded);
85/* 85/*
86 * tbfadt - FADT parse/convert/validate 86 * tbfadt - FADT parse/convert/validate
87 */ 87 */
88void acpi_tb_parse_fadt(u32 table_index); 88void acpi_tb_parse_fadt(void);
89 89
90void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length); 90void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length);
91 91
@@ -138,8 +138,6 @@ acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id);
138 */ 138 */
139acpi_status acpi_tb_initialize_facs(void); 139acpi_status acpi_tb_initialize_facs(void);
140 140
141u8 acpi_tb_tables_loaded(void);
142
143void 141void
144acpi_tb_print_table_header(acpi_physical_address address, 142acpi_tb_print_table_header(acpi_physical_address address,
145 struct acpi_table_header *header); 143 struct acpi_table_header *header);
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index faad911d46b5..10ce48e16ebf 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -71,7 +71,7 @@ acpi_status acpi_enable(void)
71 71
72 /* ACPI tables must be present */ 72 /* ACPI tables must be present */
73 73
74 if (!acpi_tb_tables_loaded()) { 74 if (acpi_gbl_fadt_index == ACPI_INVALID_TABLE_INDEX) {
75 return_ACPI_STATUS(AE_NO_ACPI_TABLES); 75 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
76 } 76 }
77 77
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 455a0700db39..a6454f4a6fb3 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -298,7 +298,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64)
298 * 298 *
299 * FUNCTION: acpi_tb_parse_fadt 299 * FUNCTION: acpi_tb_parse_fadt
300 * 300 *
301 * PARAMETERS: table_index - Index for the FADT 301 * PARAMETERS: None
302 * 302 *
303 * RETURN: None 303 * RETURN: None
304 * 304 *
@@ -307,7 +307,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64)
307 * 307 *
308 ******************************************************************************/ 308 ******************************************************************************/
309 309
310void acpi_tb_parse_fadt(u32 table_index) 310void acpi_tb_parse_fadt(void)
311{ 311{
312 u32 length; 312 u32 length;
313 struct acpi_table_header *table; 313 struct acpi_table_header *table;
@@ -319,11 +319,11 @@ void acpi_tb_parse_fadt(u32 table_index)
319 * Get a local copy of the FADT and convert it to a common format 319 * Get a local copy of the FADT and convert it to a common format
320 * Map entire FADT, assumed to be smaller than one page. 320 * Map entire FADT, assumed to be smaller than one page.
321 */ 321 */
322 length = acpi_gbl_root_table_list.tables[table_index].length; 322 length = acpi_gbl_root_table_list.tables[acpi_gbl_fadt_index].length;
323 323
324 table = 324 table =
325 acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. 325 acpi_os_map_memory(acpi_gbl_root_table_list.
326 address, length); 326 tables[acpi_gbl_fadt_index].address, length);
327 if (!table) { 327 if (!table) {
328 return; 328 return;
329 } 329 }
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 4337990127cc..d8ddef38c947 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -99,29 +99,6 @@ acpi_status acpi_tb_initialize_facs(void)
99 99
100/******************************************************************************* 100/*******************************************************************************
101 * 101 *
102 * FUNCTION: acpi_tb_tables_loaded
103 *
104 * PARAMETERS: None
105 *
106 * RETURN: TRUE if required ACPI tables are loaded
107 *
108 * DESCRIPTION: Determine if the minimum required ACPI tables are present
109 * (FADT, FACS, DSDT)
110 *
111 ******************************************************************************/
112
113u8 acpi_tb_tables_loaded(void)
114{
115
116 if (acpi_gbl_root_table_list.current_table_count >= 4) {
117 return (TRUE);
118 }
119
120 return (FALSE);
121}
122
123/*******************************************************************************
124 *
125 * FUNCTION: acpi_tb_check_dsdt_header 102 * FUNCTION: acpi_tb_check_dsdt_header
126 * 103 *
127 * PARAMETERS: None 104 * PARAMETERS: None
@@ -392,7 +369,8 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
392 ACPI_COMPARE_NAME(&acpi_gbl_root_table_list. 369 ACPI_COMPARE_NAME(&acpi_gbl_root_table_list.
393 tables[table_index].signature, 370 tables[table_index].signature,
394 ACPI_SIG_FADT)) { 371 ACPI_SIG_FADT)) {
395 acpi_tb_parse_fadt(table_index); 372 acpi_gbl_fadt_index = table_index;
373 acpi_tb_parse_fadt();
396 } 374 }
397 375
398next_table: 376next_table:
diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c
index 2a4154a09e4d..85e17bacc834 100644
--- a/drivers/base/power/domain_governor.c
+++ b/drivers/base/power/domain_governor.c
@@ -77,13 +77,16 @@ static bool default_stop_ok(struct device *dev)
77 dev_update_qos_constraint); 77 dev_update_qos_constraint);
78 78
79 if (constraint_ns > 0) { 79 if (constraint_ns > 0) {
80 constraint_ns -= td->start_latency_ns; 80 constraint_ns -= td->save_state_latency_ns +
81 td->stop_latency_ns +
82 td->start_latency_ns +
83 td->restore_state_latency_ns;
81 if (constraint_ns == 0) 84 if (constraint_ns == 0)
82 return false; 85 return false;
83 } 86 }
84 td->effective_constraint_ns = constraint_ns; 87 td->effective_constraint_ns = constraint_ns;
85 td->cached_stop_ok = constraint_ns > td->stop_latency_ns || 88 td->cached_stop_ok = constraint_ns >= 0;
86 constraint_ns == 0; 89
87 /* 90 /*
88 * The children have been suspended already, so we don't need to take 91 * The children have been suspended already, so we don't need to take
89 * their stop latencies into account here. 92 * their stop latencies into account here.
@@ -126,18 +129,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd)
126 129
127 off_on_time_ns = genpd->power_off_latency_ns + 130 off_on_time_ns = genpd->power_off_latency_ns +
128 genpd->power_on_latency_ns; 131 genpd->power_on_latency_ns;
129 /*
130 * It doesn't make sense to remove power from the domain if saving
131 * the state of all devices in it and the power off/power on operations
132 * take too much time.
133 *
134 * All devices in this domain have been stopped already at this point.
135 */
136 list_for_each_entry(pdd, &genpd->dev_list, list_node) {
137 if (pdd->dev->driver)
138 off_on_time_ns +=
139 to_gpd_data(pdd)->td.save_state_latency_ns;
140 }
141 132
142 min_off_time_ns = -1; 133 min_off_time_ns = -1;
143 /* 134 /*
@@ -193,7 +184,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd)
193 * constraint_ns cannot be negative here, because the device has 184 * constraint_ns cannot be negative here, because the device has
194 * been suspended. 185 * been suspended.
195 */ 186 */
196 constraint_ns -= td->restore_state_latency_ns;
197 if (constraint_ns <= off_on_time_ns) 187 if (constraint_ns <= off_on_time_ns)
198 return false; 188 return false;
199 189
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index f42f2bac6466..4c55cfbad19e 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -32,8 +32,7 @@ static DEFINE_MUTEX(regmap_debugfs_early_lock);
32/* Calculate the length of a fixed format */ 32/* Calculate the length of a fixed format */
33static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) 33static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size)
34{ 34{
35 snprintf(buf, buf_size, "%x", max_val); 35 return snprintf(NULL, 0, "%x", max_val);
36 return strlen(buf);
37} 36}
38 37
39static ssize_t regmap_name_read_file(struct file *file, 38static ssize_t regmap_name_read_file(struct file *file,
@@ -432,7 +431,7 @@ static ssize_t regmap_access_read_file(struct file *file,
432 /* If we're in the region the user is trying to read */ 431 /* If we're in the region the user is trying to read */
433 if (p >= *ppos) { 432 if (p >= *ppos) {
434 /* ...but not beyond it */ 433 /* ...but not beyond it */
435 if (buf_pos >= count - 1 - tot_len) 434 if (buf_pos + tot_len + 1 >= count)
436 break; 435 break;
437 436
438 /* Format the register */ 437 /* Format the register */
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d93a0372b37b..f5e49b639818 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1863,9 +1863,11 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,
1863 rbd_osd_read_callback(obj_request); 1863 rbd_osd_read_callback(obj_request);
1864 break; 1864 break;
1865 case CEPH_OSD_OP_SETALLOCHINT: 1865 case CEPH_OSD_OP_SETALLOCHINT:
1866 rbd_assert(osd_req->r_ops[1].op == CEPH_OSD_OP_WRITE); 1866 rbd_assert(osd_req->r_ops[1].op == CEPH_OSD_OP_WRITE ||
1867 osd_req->r_ops[1].op == CEPH_OSD_OP_WRITEFULL);
1867 /* fall through */ 1868 /* fall through */
1868 case CEPH_OSD_OP_WRITE: 1869 case CEPH_OSD_OP_WRITE:
1870 case CEPH_OSD_OP_WRITEFULL:
1869 rbd_osd_write_callback(obj_request); 1871 rbd_osd_write_callback(obj_request);
1870 break; 1872 break;
1871 case CEPH_OSD_OP_STAT: 1873 case CEPH_OSD_OP_STAT:
@@ -2401,7 +2403,10 @@ static void rbd_img_obj_request_fill(struct rbd_obj_request *obj_request,
2401 opcode = CEPH_OSD_OP_ZERO; 2403 opcode = CEPH_OSD_OP_ZERO;
2402 } 2404 }
2403 } else if (op_type == OBJ_OP_WRITE) { 2405 } else if (op_type == OBJ_OP_WRITE) {
2404 opcode = CEPH_OSD_OP_WRITE; 2406 if (!offset && length == object_size)
2407 opcode = CEPH_OSD_OP_WRITEFULL;
2408 else
2409 opcode = CEPH_OSD_OP_WRITE;
2405 osd_req_op_alloc_hint_init(osd_request, num_ops, 2410 osd_req_op_alloc_hint_init(osd_request, num_ops,
2406 object_size, object_size); 2411 object_size, object_size);
2407 num_ops++; 2412 num_ops++;
@@ -3760,6 +3765,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
3760 /* set io sizes to object size */ 3765 /* set io sizes to object size */
3761 segment_size = rbd_obj_bytes(&rbd_dev->header); 3766 segment_size = rbd_obj_bytes(&rbd_dev->header);
3762 blk_queue_max_hw_sectors(q, segment_size / SECTOR_SIZE); 3767 blk_queue_max_hw_sectors(q, segment_size / SECTOR_SIZE);
3768 q->limits.max_sectors = queue_max_hw_sectors(q);
3763 blk_queue_max_segments(q, segment_size / SECTOR_SIZE); 3769 blk_queue_max_segments(q, segment_size / SECTOR_SIZE);
3764 blk_queue_max_segment_size(q, segment_size); 3770 blk_queue_max_segment_size(q, segment_size);
3765 blk_queue_io_min(q, segment_size); 3771 blk_queue_io_min(q, segment_size);
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 1a82f3a17681..0ebca8ba7bc4 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -36,7 +36,6 @@ config ARM_CCI400_PORT_CTRL
36 36
37config ARM_CCI500_PMU 37config ARM_CCI500_PMU
38 bool "ARM CCI500 PMU support" 38 bool "ARM CCI500 PMU support"
39 default y
40 depends on (ARM && CPU_V7) || ARM64 39 depends on (ARM && CPU_V7) || ARM64
41 depends on PERF_EVENTS 40 depends on PERF_EVENTS
42 select ARM_CCI_PMU 41 select ARM_CCI_PMU
diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c
index 5837eb8a212f..85da8b983256 100644
--- a/drivers/clk/mvebu/clk-cpu.c
+++ b/drivers/clk/mvebu/clk-cpu.c
@@ -197,6 +197,7 @@ static void __init of_cpu_clk_setup(struct device_node *node)
197 for_each_node_by_type(dn, "cpu") { 197 for_each_node_by_type(dn, "cpu") {
198 struct clk_init_data init; 198 struct clk_init_data init;
199 struct clk *clk; 199 struct clk *clk;
200 struct clk *parent_clk;
200 char *clk_name = kzalloc(5, GFP_KERNEL); 201 char *clk_name = kzalloc(5, GFP_KERNEL);
201 int cpu, err; 202 int cpu, err;
202 203
@@ -208,8 +209,9 @@ static void __init of_cpu_clk_setup(struct device_node *node)
208 goto bail_out; 209 goto bail_out;
209 210
210 sprintf(clk_name, "cpu%d", cpu); 211 sprintf(clk_name, "cpu%d", cpu);
212 parent_clk = of_clk_get(node, 0);
211 213
212 cpuclk[cpu].parent_name = of_clk_get_parent_name(node, 0); 214 cpuclk[cpu].parent_name = __clk_get_name(parent_clk);
213 cpuclk[cpu].clk_name = clk_name; 215 cpuclk[cpu].clk_name = clk_name;
214 cpuclk[cpu].cpu = cpu; 216 cpuclk[cpu].cpu = cpu;
215 cpuclk[cpu].reg_base = clock_complex_base; 217 cpuclk[cpu].reg_base = clock_complex_base;
diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c
index 7c1e1f58e2da..2fe37f708dc7 100644
--- a/drivers/clk/samsung/clk-cpu.c
+++ b/drivers/clk/samsung/clk-cpu.c
@@ -164,7 +164,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
164 * the values for DIV_COPY and DIV_HPM dividers need not be set. 164 * the values for DIV_COPY and DIV_HPM dividers need not be set.
165 */ 165 */
166 div0 = cfg_data->div0; 166 div0 = cfg_data->div0;
167 if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { 167 if (cpuclk->flags & CLK_CPU_HAS_DIV1) {
168 div1 = cfg_data->div1; 168 div1 = cfg_data->div1;
169 if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK) 169 if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK)
170 div1 = readl(base + E4210_DIV_CPU1) & 170 div1 = readl(base + E4210_DIV_CPU1) &
@@ -185,7 +185,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
185 alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1; 185 alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1;
186 WARN_ON(alt_div >= MAX_DIV); 186 WARN_ON(alt_div >= MAX_DIV);
187 187
188 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 188 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
189 /* 189 /*
190 * In Exynos4210, ATB clock parent is also mout_core. So 190 * In Exynos4210, ATB clock parent is also mout_core. So
191 * ATB clock also needs to be mantained at safe speed. 191 * ATB clock also needs to be mantained at safe speed.
@@ -206,7 +206,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
206 writel(div0, base + E4210_DIV_CPU0); 206 writel(div0, base + E4210_DIV_CPU0);
207 wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL); 207 wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL);
208 208
209 if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { 209 if (cpuclk->flags & CLK_CPU_HAS_DIV1) {
210 writel(div1, base + E4210_DIV_CPU1); 210 writel(div1, base + E4210_DIV_CPU1);
211 wait_until_divider_stable(base + E4210_DIV_STAT_CPU1, 211 wait_until_divider_stable(base + E4210_DIV_STAT_CPU1,
212 DIV_MASK_ALL); 212 DIV_MASK_ALL);
@@ -225,7 +225,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata,
225 unsigned long mux_reg; 225 unsigned long mux_reg;
226 226
227 /* find out the divider values to use for clock data */ 227 /* find out the divider values to use for clock data */
228 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 228 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
229 while ((cfg_data->prate * 1000) != ndata->new_rate) { 229 while ((cfg_data->prate * 1000) != ndata->new_rate) {
230 if (cfg_data->prate == 0) 230 if (cfg_data->prate == 0)
231 return -EINVAL; 231 return -EINVAL;
@@ -240,7 +240,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata,
240 writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU); 240 writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU);
241 wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1); 241 wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1);
242 242
243 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 243 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
244 div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK); 244 div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK);
245 div_mask |= E4210_DIV0_ATB_MASK; 245 div_mask |= E4210_DIV0_ATB_MASK;
246 } 246 }
diff --git a/drivers/clk/ti/clk-3xxx.c b/drivers/clk/ti/clk-3xxx.c
index 676ee8f6d813..8831e1a05367 100644
--- a/drivers/clk/ti/clk-3xxx.c
+++ b/drivers/clk/ti/clk-3xxx.c
@@ -374,7 +374,6 @@ static struct ti_dt_clk omap3xxx_clks[] = {
374 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"), 374 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"),
375 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"), 375 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"),
376 DT_CLK(NULL, "uart3_ick", "uart3_ick"), 376 DT_CLK(NULL, "uart3_ick", "uart3_ick"),
377 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
378 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"), 377 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"),
379 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"), 378 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"),
380 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"), 379 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"),
@@ -519,6 +518,7 @@ static struct ti_dt_clk am35xx_clks[] = {
519static struct ti_dt_clk omap36xx_clks[] = { 518static struct ti_dt_clk omap36xx_clks[] = {
520 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"), 519 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"),
521 DT_CLK(NULL, "uart4_fck", "uart4_fck"), 520 DT_CLK(NULL, "uart4_fck", "uart4_fck"),
521 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
522 { .node_name = NULL }, 522 { .node_name = NULL },
523}; 523};
524 524
diff --git a/drivers/clk/ti/clk-7xx.c b/drivers/clk/ti/clk-7xx.c
index 9b5b289e6334..a911d7de3377 100644
--- a/drivers/clk/ti/clk-7xx.c
+++ b/drivers/clk/ti/clk-7xx.c
@@ -18,7 +18,6 @@
18 18
19#include "clock.h" 19#include "clock.h"
20 20
21#define DRA7_DPLL_ABE_DEFFREQ 180633600
22#define DRA7_DPLL_GMAC_DEFFREQ 1000000000 21#define DRA7_DPLL_GMAC_DEFFREQ 1000000000
23#define DRA7_DPLL_USB_DEFFREQ 960000000 22#define DRA7_DPLL_USB_DEFFREQ 960000000
24 23
@@ -313,27 +312,12 @@ static struct ti_dt_clk dra7xx_clks[] = {
313int __init dra7xx_dt_clk_init(void) 312int __init dra7xx_dt_clk_init(void)
314{ 313{
315 int rc; 314 int rc;
316 struct clk *abe_dpll_mux, *sys_clkin2, *dpll_ck, *hdcp_ck; 315 struct clk *dpll_ck, *hdcp_ck;
317 316
318 ti_dt_clocks_register(dra7xx_clks); 317 ti_dt_clocks_register(dra7xx_clks);
319 318
320 omap2_clk_disable_autoidle_all(); 319 omap2_clk_disable_autoidle_all();
321 320
322 abe_dpll_mux = clk_get_sys(NULL, "abe_dpll_sys_clk_mux");
323 sys_clkin2 = clk_get_sys(NULL, "sys_clkin2");
324 dpll_ck = clk_get_sys(NULL, "dpll_abe_ck");
325
326 rc = clk_set_parent(abe_dpll_mux, sys_clkin2);
327 if (!rc)
328 rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ);
329 if (rc)
330 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
331
332 dpll_ck = clk_get_sys(NULL, "dpll_abe_m2x2_ck");
333 rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ * 2);
334 if (rc)
335 pr_err("%s: failed to configure ABE DPLL m2x2!\n", __func__);
336
337 dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck"); 321 dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck");
338 rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ); 322 rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ);
339 if (rc) 323 if (rc)
diff --git a/drivers/clk/ti/clkt_dflt.c b/drivers/clk/ti/clkt_dflt.c
index 90d7d8a21c49..1ddc288fce4e 100644
--- a/drivers/clk/ti/clkt_dflt.c
+++ b/drivers/clk/ti/clkt_dflt.c
@@ -222,7 +222,7 @@ int omap2_dflt_clk_enable(struct clk_hw *hw)
222 } 222 }
223 } 223 }
224 224
225 if (unlikely(!clk->enable_reg)) { 225 if (unlikely(IS_ERR(clk->enable_reg))) {
226 pr_err("%s: %s missing enable_reg\n", __func__, 226 pr_err("%s: %s missing enable_reg\n", __func__,
227 clk_hw_get_name(hw)); 227 clk_hw_get_name(hw));
228 ret = -EINVAL; 228 ret = -EINVAL;
@@ -264,7 +264,7 @@ void omap2_dflt_clk_disable(struct clk_hw *hw)
264 u32 v; 264 u32 v;
265 265
266 clk = to_clk_hw_omap(hw); 266 clk = to_clk_hw_omap(hw);
267 if (!clk->enable_reg) { 267 if (IS_ERR(clk->enable_reg)) {
268 /* 268 /*
269 * 'independent' here refers to a clock which is not 269 * 'independent' here refers to a clock which is not
270 * controlled by its parent. 270 * controlled by its parent.
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 798277227de7..cec1ee2d2f74 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -149,6 +149,9 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
149{ 149{
150 struct acpi_cpufreq_data *data = policy->driver_data; 150 struct acpi_cpufreq_data *data = policy->driver_data;
151 151
152 if (unlikely(!data))
153 return -ENODEV;
154
152 return cpufreq_show_cpus(data->freqdomain_cpus, buf); 155 return cpufreq_show_cpus(data->freqdomain_cpus, buf);
153} 156}
154 157
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index ef5ed9470de9..25c4c15103a0 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1436,8 +1436,10 @@ static void cpufreq_offline_finish(unsigned int cpu)
1436 * since this is a core component, and is essential for the 1436 * since this is a core component, and is essential for the
1437 * subsequent light-weight ->init() to succeed. 1437 * subsequent light-weight ->init() to succeed.
1438 */ 1438 */
1439 if (cpufreq_driver->exit) 1439 if (cpufreq_driver->exit) {
1440 cpufreq_driver->exit(policy); 1440 cpufreq_driver->exit(policy);
1441 policy->freq_table = NULL;
1442 }
1441} 1443}
1442 1444
1443/** 1445/**
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 3af9dd7332e6..aa33b92b3e3e 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -776,6 +776,11 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
776 local_irq_save(flags); 776 local_irq_save(flags);
777 rdmsrl(MSR_IA32_APERF, aperf); 777 rdmsrl(MSR_IA32_APERF, aperf);
778 rdmsrl(MSR_IA32_MPERF, mperf); 778 rdmsrl(MSR_IA32_MPERF, mperf);
779 if (cpu->prev_mperf == mperf) {
780 local_irq_restore(flags);
781 return;
782 }
783
779 tsc = rdtsc(); 784 tsc = rdtsc();
780 local_irq_restore(flags); 785 local_irq_restore(flags);
781 786
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 3927ed9fdbd5..ca848cc6a8fd 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
492 if (err) { 492 if (err) {
493 put_device(&devfreq->dev); 493 put_device(&devfreq->dev);
494 mutex_unlock(&devfreq->lock); 494 mutex_unlock(&devfreq->lock);
495 goto err_dev; 495 goto err_out;
496 } 496 }
497 497
498 mutex_unlock(&devfreq->lock); 498 mutex_unlock(&devfreq->lock);
@@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
518err_init: 518err_init:
519 list_del(&devfreq->node); 519 list_del(&devfreq->node);
520 device_unregister(&devfreq->dev); 520 device_unregister(&devfreq->dev);
521err_dev:
522 kfree(devfreq); 521 kfree(devfreq);
523err_out: 522err_out:
524 return ERR_PTR(err); 523 return ERR_PTR(err);
@@ -795,8 +794,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
795 ret = PTR_ERR(governor); 794 ret = PTR_ERR(governor);
796 goto out; 795 goto out;
797 } 796 }
798 if (df->governor == governor) 797 if (df->governor == governor) {
798 ret = 0;
799 goto out; 799 goto out;
800 }
800 801
801 if (df->governor) { 802 if (df->governor) {
802 ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL); 803 ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
index 77f1d7c6ea3a..9416e0f5c1db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
@@ -672,8 +672,12 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev)
672 /* disp clock */ 672 /* disp clock */
673 adev->clock.default_dispclk = 673 adev->clock.default_dispclk =
674 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); 674 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq);
675 if (adev->clock.default_dispclk == 0) 675 /* set a reasonable default for DP */
676 adev->clock.default_dispclk = 54000; /* 540 Mhz */ 676 if (adev->clock.default_dispclk < 53900) {
677 DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n",
678 adev->clock.default_dispclk / 100);
679 adev->clock.default_dispclk = 60000;
680 }
677 adev->clock.dp_extclk = 681 adev->clock.dp_extclk =
678 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); 682 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq);
679 adev->clock.current_dispclk = adev->clock.default_dispclk; 683 adev->clock.current_dispclk = adev->clock.default_dispclk;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index cb3c274edb0a..fd16652aa277 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -177,7 +177,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
177 177
178 /* get chunks */ 178 /* get chunks */
179 INIT_LIST_HEAD(&p->validated); 179 INIT_LIST_HEAD(&p->validated);
180 chunk_array_user = (uint64_t __user *)(cs->in.chunks); 180 chunk_array_user = (uint64_t __user *)(unsigned long)(cs->in.chunks);
181 if (copy_from_user(chunk_array, chunk_array_user, 181 if (copy_from_user(chunk_array, chunk_array_user,
182 sizeof(uint64_t)*cs->in.num_chunks)) { 182 sizeof(uint64_t)*cs->in.num_chunks)) {
183 ret = -EFAULT; 183 ret = -EFAULT;
@@ -197,7 +197,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
197 struct drm_amdgpu_cs_chunk user_chunk; 197 struct drm_amdgpu_cs_chunk user_chunk;
198 uint32_t __user *cdata; 198 uint32_t __user *cdata;
199 199
200 chunk_ptr = (void __user *)chunk_array[i]; 200 chunk_ptr = (void __user *)(unsigned long)chunk_array[i];
201 if (copy_from_user(&user_chunk, chunk_ptr, 201 if (copy_from_user(&user_chunk, chunk_ptr,
202 sizeof(struct drm_amdgpu_cs_chunk))) { 202 sizeof(struct drm_amdgpu_cs_chunk))) {
203 ret = -EFAULT; 203 ret = -EFAULT;
@@ -208,7 +208,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
208 p->chunks[i].length_dw = user_chunk.length_dw; 208 p->chunks[i].length_dw = user_chunk.length_dw;
209 209
210 size = p->chunks[i].length_dw; 210 size = p->chunks[i].length_dw;
211 cdata = (void __user *)user_chunk.chunk_data; 211 cdata = (void __user *)(unsigned long)user_chunk.chunk_data;
212 p->chunks[i].user_ptr = cdata; 212 p->chunks[i].user_ptr = cdata;
213 213
214 p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); 214 p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t));
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index e3d70772b531..dc29ed8145c2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -85,8 +85,6 @@ static void amdgpu_flip_work_func(struct work_struct *__work)
85 /* We borrow the event spin lock for protecting flip_status */ 85 /* We borrow the event spin lock for protecting flip_status */
86 spin_lock_irqsave(&crtc->dev->event_lock, flags); 86 spin_lock_irqsave(&crtc->dev->event_lock, flags);
87 87
88 /* set the proper interrupt */
89 amdgpu_irq_get(adev, &adev->pageflip_irq, work->crtc_id);
90 /* do the flip (mmio) */ 88 /* do the flip (mmio) */
91 adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base); 89 adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base);
92 /* set the flip status */ 90 /* set the flip status */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index adb48353f2e1..b190c2a83680 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -242,11 +242,11 @@ static struct pci_device_id pciidlist[] = {
242 {0x1002, 0x985F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU}, 242 {0x1002, 0x985F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
243#endif 243#endif
244 /* topaz */ 244 /* topaz */
245 {0x1002, 0x6900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 245 {0x1002, 0x6900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
246 {0x1002, 0x6901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 246 {0x1002, 0x6901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
247 {0x1002, 0x6902, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 247 {0x1002, 0x6902, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
248 {0x1002, 0x6903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 248 {0x1002, 0x6903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
249 {0x1002, 0x6907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 249 {0x1002, 0x6907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
250 /* tonga */ 250 /* tonga */
251 {0x1002, 0x6920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA}, 251 {0x1002, 0x6920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
252 {0x1002, 0x6921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA}, 252 {0x1002, 0x6921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 8a122b1b7786..96290d9cddca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -402,3 +402,19 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
402 return true; 402 return true;
403 return false; 403 return false;
404} 404}
405
406void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev)
407{
408 struct amdgpu_fbdev *afbdev = adev->mode_info.rfbdev;
409 struct drm_fb_helper *fb_helper;
410 int ret;
411
412 if (!afbdev)
413 return;
414
415 fb_helper = &afbdev->helper;
416
417 ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
418 if (ret)
419 DRM_DEBUG("failed to restore crtc mode\n");
420}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 8c735f544b66..5d11e798230c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -485,7 +485,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
485 * Outdated mess for old drm with Xorg being in charge (void function now). 485 * Outdated mess for old drm with Xorg being in charge (void function now).
486 */ 486 */
487/** 487/**
488 * amdgpu_driver_firstopen_kms - drm callback for last close 488 * amdgpu_driver_lastclose_kms - drm callback for last close
489 * 489 *
490 * @dev: drm dev pointer 490 * @dev: drm dev pointer
491 * 491 *
@@ -493,6 +493,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
493 */ 493 */
494void amdgpu_driver_lastclose_kms(struct drm_device *dev) 494void amdgpu_driver_lastclose_kms(struct drm_device *dev)
495{ 495{
496 struct amdgpu_device *adev = dev->dev_private;
497
498 amdgpu_fbdev_restore_mode(adev);
496 vga_switcheroo_process_delayed_switch(); 499 vga_switcheroo_process_delayed_switch();
497} 500}
498 501
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 64efe5b52e65..7bd470d9ac30 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -567,6 +567,7 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev);
567void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state); 567void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state);
568int amdgpu_fbdev_total_size(struct amdgpu_device *adev); 568int amdgpu_fbdev_total_size(struct amdgpu_device *adev);
569bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj); 569bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj);
570void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev);
570 571
571void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev); 572void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev);
572 573
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 1e14531353e0..53d551f2d839 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -455,8 +455,10 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
455 return -ENOMEM; 455 return -ENOMEM;
456 456
457 r = amdgpu_ib_get(ring, NULL, ndw * 4, ib); 457 r = amdgpu_ib_get(ring, NULL, ndw * 4, ib);
458 if (r) 458 if (r) {
459 kfree(ib);
459 return r; 460 return r;
461 }
460 ib->length_dw = 0; 462 ib->length_dw = 0;
461 463
462 /* walk over the address space and update the page directory */ 464 /* walk over the address space and update the page directory */
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 82e8d0730517..a1a35a5df8e7 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -6185,6 +6185,11 @@ static int ci_dpm_late_init(void *handle)
6185 if (!amdgpu_dpm) 6185 if (!amdgpu_dpm)
6186 return 0; 6186 return 0;
6187 6187
6188 /* init the sysfs and debugfs files late */
6189 ret = amdgpu_pm_sysfs_init(adev);
6190 if (ret)
6191 return ret;
6192
6188 ret = ci_set_temperature_range(adev); 6193 ret = ci_set_temperature_range(adev);
6189 if (ret) 6194 if (ret)
6190 return ret; 6195 return ret;
@@ -6232,9 +6237,6 @@ static int ci_dpm_sw_init(void *handle)
6232 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; 6237 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
6233 if (amdgpu_dpm == 1) 6238 if (amdgpu_dpm == 1)
6234 amdgpu_pm_print_power_states(adev); 6239 amdgpu_pm_print_power_states(adev);
6235 ret = amdgpu_pm_sysfs_init(adev);
6236 if (ret)
6237 goto dpm_failed;
6238 mutex_unlock(&adev->pm.mutex); 6240 mutex_unlock(&adev->pm.mutex);
6239 DRM_INFO("amdgpu: dpm initialized\n"); 6241 DRM_INFO("amdgpu: dpm initialized\n");
6240 6242
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index 4b6ce74753cd..484710cfdf82 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1567,6 +1567,9 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev)
1567 int ret, i; 1567 int ret, i;
1568 u16 tmp16; 1568 u16 tmp16;
1569 1569
1570 if (pci_is_root_bus(adev->pdev->bus))
1571 return;
1572
1570 if (amdgpu_pcie_gen2 == 0) 1573 if (amdgpu_pcie_gen2 == 0)
1571 return; 1574 return;
1572 1575
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
index 44fa96ad4709..2e3373ed4c94 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
@@ -596,6 +596,12 @@ static int cz_dpm_late_init(void *handle)
596 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 596 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
597 597
598 if (amdgpu_dpm) { 598 if (amdgpu_dpm) {
599 int ret;
600 /* init the sysfs and debugfs files late */
601 ret = amdgpu_pm_sysfs_init(adev);
602 if (ret)
603 return ret;
604
599 /* powerdown unused blocks for now */ 605 /* powerdown unused blocks for now */
600 cz_dpm_powergate_uvd(adev, true); 606 cz_dpm_powergate_uvd(adev, true);
601 cz_dpm_powergate_vce(adev, true); 607 cz_dpm_powergate_vce(adev, true);
@@ -632,10 +638,6 @@ static int cz_dpm_sw_init(void *handle)
632 if (amdgpu_dpm == 1) 638 if (amdgpu_dpm == 1)
633 amdgpu_pm_print_power_states(adev); 639 amdgpu_pm_print_power_states(adev);
634 640
635 ret = amdgpu_pm_sysfs_init(adev);
636 if (ret)
637 goto dpm_init_failed;
638
639 mutex_unlock(&adev->pm.mutex); 641 mutex_unlock(&adev->pm.mutex);
640 DRM_INFO("amdgpu: dpm initialized\n"); 642 DRM_INFO("amdgpu: dpm initialized\n");
641 643
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index e4d101b1252a..d4c82b625727 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -255,6 +255,24 @@ static u32 dce_v10_0_vblank_get_counter(struct amdgpu_device *adev, int crtc)
255 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); 255 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]);
256} 256}
257 257
258static void dce_v10_0_pageflip_interrupt_init(struct amdgpu_device *adev)
259{
260 unsigned i;
261
262 /* Enable pflip interrupts */
263 for (i = 0; i < adev->mode_info.num_crtc; i++)
264 amdgpu_irq_get(adev, &adev->pageflip_irq, i);
265}
266
267static void dce_v10_0_pageflip_interrupt_fini(struct amdgpu_device *adev)
268{
269 unsigned i;
270
271 /* Disable pflip interrupts */
272 for (i = 0; i < adev->mode_info.num_crtc; i++)
273 amdgpu_irq_put(adev, &adev->pageflip_irq, i);
274}
275
258/** 276/**
259 * dce_v10_0_page_flip - pageflip callback. 277 * dce_v10_0_page_flip - pageflip callback.
260 * 278 *
@@ -2663,9 +2681,10 @@ static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2663 dce_v10_0_vga_enable(crtc, true); 2681 dce_v10_0_vga_enable(crtc, true);
2664 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); 2682 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
2665 dce_v10_0_vga_enable(crtc, false); 2683 dce_v10_0_vga_enable(crtc, false);
2666 /* Make sure VBLANK interrupt is still enabled */ 2684 /* Make sure VBLANK and PFLIP interrupts are still enabled */
2667 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); 2685 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
2668 amdgpu_irq_update(adev, &adev->crtc_irq, type); 2686 amdgpu_irq_update(adev, &adev->crtc_irq, type);
2687 amdgpu_irq_update(adev, &adev->pageflip_irq, type);
2669 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); 2688 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id);
2670 dce_v10_0_crtc_load_lut(crtc); 2689 dce_v10_0_crtc_load_lut(crtc);
2671 break; 2690 break;
@@ -3025,6 +3044,8 @@ static int dce_v10_0_hw_init(void *handle)
3025 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3044 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3026 } 3045 }
3027 3046
3047 dce_v10_0_pageflip_interrupt_init(adev);
3048
3028 return 0; 3049 return 0;
3029} 3050}
3030 3051
@@ -3039,6 +3060,8 @@ static int dce_v10_0_hw_fini(void *handle)
3039 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3060 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3040 } 3061 }
3041 3062
3063 dce_v10_0_pageflip_interrupt_fini(adev);
3064
3042 return 0; 3065 return 0;
3043} 3066}
3044 3067
@@ -3050,6 +3073,8 @@ static int dce_v10_0_suspend(void *handle)
3050 3073
3051 dce_v10_0_hpd_fini(adev); 3074 dce_v10_0_hpd_fini(adev);
3052 3075
3076 dce_v10_0_pageflip_interrupt_fini(adev);
3077
3053 return 0; 3078 return 0;
3054} 3079}
3055 3080
@@ -3075,6 +3100,8 @@ static int dce_v10_0_resume(void *handle)
3075 /* initialize hpd */ 3100 /* initialize hpd */
3076 dce_v10_0_hpd_init(adev); 3101 dce_v10_0_hpd_init(adev);
3077 3102
3103 dce_v10_0_pageflip_interrupt_init(adev);
3104
3078 return 0; 3105 return 0;
3079} 3106}
3080 3107
@@ -3369,7 +3396,6 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
3369 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 3396 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
3370 3397
3371 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); 3398 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
3372 amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id);
3373 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); 3399 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work);
3374 3400
3375 return 0; 3401 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 6411e8244671..7e1cf5e4eebf 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -233,6 +233,24 @@ static u32 dce_v11_0_vblank_get_counter(struct amdgpu_device *adev, int crtc)
233 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); 233 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]);
234} 234}
235 235
236static void dce_v11_0_pageflip_interrupt_init(struct amdgpu_device *adev)
237{
238 unsigned i;
239
240 /* Enable pflip interrupts */
241 for (i = 0; i < adev->mode_info.num_crtc; i++)
242 amdgpu_irq_get(adev, &adev->pageflip_irq, i);
243}
244
245static void dce_v11_0_pageflip_interrupt_fini(struct amdgpu_device *adev)
246{
247 unsigned i;
248
249 /* Disable pflip interrupts */
250 for (i = 0; i < adev->mode_info.num_crtc; i++)
251 amdgpu_irq_put(adev, &adev->pageflip_irq, i);
252}
253
236/** 254/**
237 * dce_v11_0_page_flip - pageflip callback. 255 * dce_v11_0_page_flip - pageflip callback.
238 * 256 *
@@ -2640,9 +2658,10 @@ static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2640 dce_v11_0_vga_enable(crtc, true); 2658 dce_v11_0_vga_enable(crtc, true);
2641 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); 2659 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
2642 dce_v11_0_vga_enable(crtc, false); 2660 dce_v11_0_vga_enable(crtc, false);
2643 /* Make sure VBLANK interrupt is still enabled */ 2661 /* Make sure VBLANK and PFLIP interrupts are still enabled */
2644 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); 2662 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
2645 amdgpu_irq_update(adev, &adev->crtc_irq, type); 2663 amdgpu_irq_update(adev, &adev->crtc_irq, type);
2664 amdgpu_irq_update(adev, &adev->pageflip_irq, type);
2646 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); 2665 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id);
2647 dce_v11_0_crtc_load_lut(crtc); 2666 dce_v11_0_crtc_load_lut(crtc);
2648 break; 2667 break;
@@ -2888,7 +2907,7 @@ static int dce_v11_0_early_init(void *handle)
2888 2907
2889 switch (adev->asic_type) { 2908 switch (adev->asic_type) {
2890 case CHIP_CARRIZO: 2909 case CHIP_CARRIZO:
2891 adev->mode_info.num_crtc = 4; 2910 adev->mode_info.num_crtc = 3;
2892 adev->mode_info.num_hpd = 6; 2911 adev->mode_info.num_hpd = 6;
2893 adev->mode_info.num_dig = 9; 2912 adev->mode_info.num_dig = 9;
2894 break; 2913 break;
@@ -3000,6 +3019,8 @@ static int dce_v11_0_hw_init(void *handle)
3000 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3019 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3001 } 3020 }
3002 3021
3022 dce_v11_0_pageflip_interrupt_init(adev);
3023
3003 return 0; 3024 return 0;
3004} 3025}
3005 3026
@@ -3014,6 +3035,8 @@ static int dce_v11_0_hw_fini(void *handle)
3014 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3035 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3015 } 3036 }
3016 3037
3038 dce_v11_0_pageflip_interrupt_fini(adev);
3039
3017 return 0; 3040 return 0;
3018} 3041}
3019 3042
@@ -3025,6 +3048,8 @@ static int dce_v11_0_suspend(void *handle)
3025 3048
3026 dce_v11_0_hpd_fini(adev); 3049 dce_v11_0_hpd_fini(adev);
3027 3050
3051 dce_v11_0_pageflip_interrupt_fini(adev);
3052
3028 return 0; 3053 return 0;
3029} 3054}
3030 3055
@@ -3051,6 +3076,8 @@ static int dce_v11_0_resume(void *handle)
3051 /* initialize hpd */ 3076 /* initialize hpd */
3052 dce_v11_0_hpd_init(adev); 3077 dce_v11_0_hpd_init(adev);
3053 3078
3079 dce_v11_0_pageflip_interrupt_init(adev);
3080
3054 return 0; 3081 return 0;
3055} 3082}
3056 3083
@@ -3345,7 +3372,6 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
3345 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 3372 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
3346 3373
3347 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); 3374 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
3348 amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id);
3349 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); 3375 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work);
3350 3376
3351 return 0; 3377 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index c86911c2ea2a..34b9c2a9d8d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -204,6 +204,24 @@ static u32 dce_v8_0_vblank_get_counter(struct amdgpu_device *adev, int crtc)
204 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); 204 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]);
205} 205}
206 206
207static void dce_v8_0_pageflip_interrupt_init(struct amdgpu_device *adev)
208{
209 unsigned i;
210
211 /* Enable pflip interrupts */
212 for (i = 0; i < adev->mode_info.num_crtc; i++)
213 amdgpu_irq_get(adev, &adev->pageflip_irq, i);
214}
215
216static void dce_v8_0_pageflip_interrupt_fini(struct amdgpu_device *adev)
217{
218 unsigned i;
219
220 /* Disable pflip interrupts */
221 for (i = 0; i < adev->mode_info.num_crtc; i++)
222 amdgpu_irq_put(adev, &adev->pageflip_irq, i);
223}
224
207/** 225/**
208 * dce_v8_0_page_flip - pageflip callback. 226 * dce_v8_0_page_flip - pageflip callback.
209 * 227 *
@@ -2575,9 +2593,10 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2575 dce_v8_0_vga_enable(crtc, true); 2593 dce_v8_0_vga_enable(crtc, true);
2576 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); 2594 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
2577 dce_v8_0_vga_enable(crtc, false); 2595 dce_v8_0_vga_enable(crtc, false);
2578 /* Make sure VBLANK interrupt is still enabled */ 2596 /* Make sure VBLANK and PFLIP interrupts are still enabled */
2579 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); 2597 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
2580 amdgpu_irq_update(adev, &adev->crtc_irq, type); 2598 amdgpu_irq_update(adev, &adev->crtc_irq, type);
2599 amdgpu_irq_update(adev, &adev->pageflip_irq, type);
2581 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); 2600 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id);
2582 dce_v8_0_crtc_load_lut(crtc); 2601 dce_v8_0_crtc_load_lut(crtc);
2583 break; 2602 break;
@@ -2933,6 +2952,8 @@ static int dce_v8_0_hw_init(void *handle)
2933 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 2952 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
2934 } 2953 }
2935 2954
2955 dce_v8_0_pageflip_interrupt_init(adev);
2956
2936 return 0; 2957 return 0;
2937} 2958}
2938 2959
@@ -2947,6 +2968,8 @@ static int dce_v8_0_hw_fini(void *handle)
2947 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 2968 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
2948 } 2969 }
2949 2970
2971 dce_v8_0_pageflip_interrupt_fini(adev);
2972
2950 return 0; 2973 return 0;
2951} 2974}
2952 2975
@@ -2958,6 +2981,8 @@ static int dce_v8_0_suspend(void *handle)
2958 2981
2959 dce_v8_0_hpd_fini(adev); 2982 dce_v8_0_hpd_fini(adev);
2960 2983
2984 dce_v8_0_pageflip_interrupt_fini(adev);
2985
2961 return 0; 2986 return 0;
2962} 2987}
2963 2988
@@ -2981,6 +3006,8 @@ static int dce_v8_0_resume(void *handle)
2981 /* initialize hpd */ 3006 /* initialize hpd */
2982 dce_v8_0_hpd_init(adev); 3007 dce_v8_0_hpd_init(adev);
2983 3008
3009 dce_v8_0_pageflip_interrupt_init(adev);
3010
2984 return 0; 3011 return 0;
2985} 3012}
2986 3013
@@ -3376,7 +3403,6 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
3376 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 3403 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
3377 3404
3378 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); 3405 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
3379 amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id);
3380 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); 3406 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work);
3381 3407
3382 return 0; 3408 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index 94ec04a9c4d5..9745ed3a9aef 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -2995,6 +2995,12 @@ static int kv_dpm_late_init(void *handle)
2995{ 2995{
2996 /* powerdown unused blocks for now */ 2996 /* powerdown unused blocks for now */
2997 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2997 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
2998 int ret;
2999
3000 /* init the sysfs and debugfs files late */
3001 ret = amdgpu_pm_sysfs_init(adev);
3002 if (ret)
3003 return ret;
2998 3004
2999 kv_dpm_powergate_acp(adev, true); 3005 kv_dpm_powergate_acp(adev, true);
3000 kv_dpm_powergate_samu(adev, true); 3006 kv_dpm_powergate_samu(adev, true);
@@ -3038,9 +3044,6 @@ static int kv_dpm_sw_init(void *handle)
3038 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; 3044 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
3039 if (amdgpu_dpm == 1) 3045 if (amdgpu_dpm == 1)
3040 amdgpu_pm_print_power_states(adev); 3046 amdgpu_pm_print_power_states(adev);
3041 ret = amdgpu_pm_sysfs_init(adev);
3042 if (ret)
3043 goto dpm_failed;
3044 mutex_unlock(&adev->pm.mutex); 3047 mutex_unlock(&adev->pm.mutex);
3045 DRM_INFO("amdgpu: dpm initialized\n"); 3048 DRM_INFO("amdgpu: dpm initialized\n");
3046 3049
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index b55ceb14fdcd..0bac8702e934 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -1005,6 +1005,9 @@ static void vi_pcie_gen3_enable(struct amdgpu_device *adev)
1005 u32 mask; 1005 u32 mask;
1006 int ret; 1006 int ret;
1007 1007
1008 if (pci_is_root_bus(adev->pdev->bus))
1009 return;
1010
1008 if (amdgpu_pcie_gen2 == 0) 1011 if (amdgpu_pcie_gen2 == 0)
1009 return; 1012 return;
1010 1013
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index bf27a07dbce3..5bca390d9ae2 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2801,12 +2801,13 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs
2801 if (msgs[num - 1].flags & I2C_M_RD) 2801 if (msgs[num - 1].flags & I2C_M_RD)
2802 reading = true; 2802 reading = true;
2803 2803
2804 if (!reading) { 2804 if (!reading || (num - 1 > DP_REMOTE_I2C_READ_MAX_TRANSACTIONS)) {
2805 DRM_DEBUG_KMS("Unsupported I2C transaction for MST device\n"); 2805 DRM_DEBUG_KMS("Unsupported I2C transaction for MST device\n");
2806 ret = -EIO; 2806 ret = -EIO;
2807 goto out; 2807 goto out;
2808 } 2808 }
2809 2809
2810 memset(&msg, 0, sizeof(msg));
2810 msg.req_type = DP_REMOTE_I2C_READ; 2811 msg.req_type = DP_REMOTE_I2C_READ;
2811 msg.u.i2c_read.num_transactions = num - 1; 2812 msg.u.i2c_read.num_transactions = num - 1;
2812 msg.u.i2c_read.port_number = port->port_num; 2813 msg.u.i2c_read.port_number = port->port_num;
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 0f6cd33b531f..684bd4a13843 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -235,18 +235,12 @@ static ssize_t dpms_show(struct device *device,
235 char *buf) 235 char *buf)
236{ 236{
237 struct drm_connector *connector = to_drm_connector(device); 237 struct drm_connector *connector = to_drm_connector(device);
238 struct drm_device *dev = connector->dev; 238 int dpms;
239 uint64_t dpms_status;
240 int ret;
241 239
242 ret = drm_object_property_get_value(&connector->base, 240 dpms = READ_ONCE(connector->dpms);
243 dev->mode_config.dpms_property,
244 &dpms_status);
245 if (ret)
246 return 0;
247 241
248 return snprintf(buf, PAGE_SIZE, "%s\n", 242 return snprintf(buf, PAGE_SIZE, "%s\n",
249 drm_get_dpms_name((int)dpms_status)); 243 drm_get_dpms_name(dpms));
250} 244}
251 245
252static ssize_t enabled_show(struct device *device, 246static ssize_t enabled_show(struct device *device,
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index cc6c228e11c8..e905c00acf1a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -469,9 +469,13 @@ nouveau_display_create(struct drm_device *dev)
469 if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) { 469 if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
470 dev->mode_config.max_width = 4096; 470 dev->mode_config.max_width = 4096;
471 dev->mode_config.max_height = 4096; 471 dev->mode_config.max_height = 4096;
472 } else { 472 } else
473 if (drm->device.info.family < NV_DEVICE_INFO_V0_FERMI) {
473 dev->mode_config.max_width = 8192; 474 dev->mode_config.max_width = 8192;
474 dev->mode_config.max_height = 8192; 475 dev->mode_config.max_height = 8192;
476 } else {
477 dev->mode_config.max_width = 16384;
478 dev->mode_config.max_height = 16384;
475 } 479 }
476 480
477 dev->mode_config.preferred_depth = 24; 481 dev->mode_config.preferred_depth = 24;
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 2791701685dc..59f27e774acb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -178,8 +178,30 @@ nouveau_fbcon_sync(struct fb_info *info)
178 return 0; 178 return 0;
179} 179}
180 180
181static int
182nouveau_fbcon_open(struct fb_info *info, int user)
183{
184 struct nouveau_fbdev *fbcon = info->par;
185 struct nouveau_drm *drm = nouveau_drm(fbcon->dev);
186 int ret = pm_runtime_get_sync(drm->dev->dev);
187 if (ret < 0 && ret != -EACCES)
188 return ret;
189 return 0;
190}
191
192static int
193nouveau_fbcon_release(struct fb_info *info, int user)
194{
195 struct nouveau_fbdev *fbcon = info->par;
196 struct nouveau_drm *drm = nouveau_drm(fbcon->dev);
197 pm_runtime_put(drm->dev->dev);
198 return 0;
199}
200
181static struct fb_ops nouveau_fbcon_ops = { 201static struct fb_ops nouveau_fbcon_ops = {
182 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
203 .fb_open = nouveau_fbcon_open,
204 .fb_release = nouveau_fbcon_release,
183 .fb_check_var = drm_fb_helper_check_var, 205 .fb_check_var = drm_fb_helper_check_var,
184 .fb_set_par = drm_fb_helper_set_par, 206 .fb_set_par = drm_fb_helper_set_par,
185 .fb_fillrect = nouveau_fbcon_fillrect, 207 .fb_fillrect = nouveau_fbcon_fillrect,
@@ -195,6 +217,8 @@ static struct fb_ops nouveau_fbcon_ops = {
195 217
196static struct fb_ops nouveau_fbcon_sw_ops = { 218static struct fb_ops nouveau_fbcon_sw_ops = {
197 .owner = THIS_MODULE, 219 .owner = THIS_MODULE,
220 .fb_open = nouveau_fbcon_open,
221 .fb_release = nouveau_fbcon_release,
198 .fb_check_var = drm_fb_helper_check_var, 222 .fb_check_var = drm_fb_helper_check_var,
199 .fb_set_par = drm_fb_helper_set_par, 223 .fb_set_par = drm_fb_helper_set_par,
200 .fb_fillrect = drm_fb_helper_cfb_fillrect, 224 .fb_fillrect = drm_fb_helper_cfb_fillrect,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
index 65af31441e9c..a7d69ce7abc1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
@@ -267,6 +267,12 @@ init_i2c(struct nvbios_init *init, int index)
267 index = NVKM_I2C_BUS_PRI; 267 index = NVKM_I2C_BUS_PRI;
268 if (init->outp && init->outp->i2c_upper_default) 268 if (init->outp && init->outp->i2c_upper_default)
269 index = NVKM_I2C_BUS_SEC; 269 index = NVKM_I2C_BUS_SEC;
270 } else
271 if (index == 0x80) {
272 index = NVKM_I2C_BUS_PRI;
273 } else
274 if (index == 0x81) {
275 index = NVKM_I2C_BUS_SEC;
270 } 276 }
271 277
272 bus = nvkm_i2c_bus_find(i2c, index); 278 bus = nvkm_i2c_bus_find(i2c, index);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
index e0ec2a6b7b79..212800ecdce9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
@@ -8,7 +8,10 @@ struct nvbios_source {
8 void *(*init)(struct nvkm_bios *, const char *); 8 void *(*init)(struct nvkm_bios *, const char *);
9 void (*fini)(void *); 9 void (*fini)(void *);
10 u32 (*read)(void *, u32 offset, u32 length, struct nvkm_bios *); 10 u32 (*read)(void *, u32 offset, u32 length, struct nvkm_bios *);
11 u32 (*size)(void *);
11 bool rw; 12 bool rw;
13 bool ignore_checksum;
14 bool no_pcir;
12}; 15};
13 16
14int nvbios_extend(struct nvkm_bios *, u32 length); 17int nvbios_extend(struct nvkm_bios *, u32 length);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
index 792f017525f6..b2557e87afdd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
@@ -45,7 +45,7 @@ shadow_fetch(struct nvkm_bios *bios, struct shadow *mthd, u32 upto)
45 u32 read = mthd->func->read(data, start, limit - start, bios); 45 u32 read = mthd->func->read(data, start, limit - start, bios);
46 bios->size = start + read; 46 bios->size = start + read;
47 } 47 }
48 return bios->size >= limit; 48 return bios->size >= upto;
49} 49}
50 50
51static int 51static int
@@ -55,14 +55,22 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
55 struct nvbios_image image; 55 struct nvbios_image image;
56 int score = 1; 56 int score = 1;
57 57
58 if (!shadow_fetch(bios, mthd, offset + 0x1000)) { 58 if (mthd->func->no_pcir) {
59 nvkm_debug(subdev, "%08x: header fetch failed\n", offset); 59 image.base = 0;
60 return 0; 60 image.type = 0;
61 } 61 image.size = mthd->func->size(mthd->data);
62 image.last = 1;
63 } else {
64 if (!shadow_fetch(bios, mthd, offset + 0x1000)) {
65 nvkm_debug(subdev, "%08x: header fetch failed\n",
66 offset);
67 return 0;
68 }
62 69
63 if (!nvbios_image(bios, idx, &image)) { 70 if (!nvbios_image(bios, idx, &image)) {
64 nvkm_debug(subdev, "image %d invalid\n", idx); 71 nvkm_debug(subdev, "image %d invalid\n", idx);
65 return 0; 72 return 0;
73 }
66 } 74 }
67 nvkm_debug(subdev, "%08x: type %02x, %d bytes\n", 75 nvkm_debug(subdev, "%08x: type %02x, %d bytes\n",
68 image.base, image.type, image.size); 76 image.base, image.type, image.size);
@@ -74,7 +82,8 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
74 82
75 switch (image.type) { 83 switch (image.type) {
76 case 0x00: 84 case 0x00:
77 if (nvbios_checksum(&bios->data[image.base], image.size)) { 85 if (!mthd->func->ignore_checksum &&
86 nvbios_checksum(&bios->data[image.base], image.size)) {
78 nvkm_debug(subdev, "%08x: checksum failed\n", 87 nvkm_debug(subdev, "%08x: checksum failed\n",
79 image.base); 88 image.base);
80 if (mthd->func->rw) 89 if (mthd->func->rw)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
index bd60d7dd09f5..4bf486b57101 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
@@ -21,6 +21,7 @@
21 * 21 *
22 */ 22 */
23#include "priv.h" 23#include "priv.h"
24
24#include <core/pci.h> 25#include <core/pci.h>
25 26
26#if defined(__powerpc__) 27#if defined(__powerpc__)
@@ -33,17 +34,26 @@ static u32
33of_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios) 34of_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios)
34{ 35{
35 struct priv *priv = data; 36 struct priv *priv = data;
36 if (offset + length <= priv->size) { 37 if (offset < priv->size) {
38 length = min_t(u32, length, priv->size - offset);
37 memcpy_fromio(bios->data + offset, priv->data + offset, length); 39 memcpy_fromio(bios->data + offset, priv->data + offset, length);
38 return length; 40 return length;
39 } 41 }
40 return 0; 42 return 0;
41} 43}
42 44
45static u32
46of_size(void *data)
47{
48 struct priv *priv = data;
49 return priv->size;
50}
51
43static void * 52static void *
44of_init(struct nvkm_bios *bios, const char *name) 53of_init(struct nvkm_bios *bios, const char *name)
45{ 54{
46 struct pci_dev *pdev = bios->subdev.device->func->pci(bios->subdev.device)->pdev; 55 struct nvkm_device *device = bios->subdev.device;
56 struct pci_dev *pdev = device->func->pci(device)->pdev;
47 struct device_node *dn; 57 struct device_node *dn;
48 struct priv *priv; 58 struct priv *priv;
49 if (!(dn = pci_device_to_OF_node(pdev))) 59 if (!(dn = pci_device_to_OF_node(pdev)))
@@ -62,7 +72,10 @@ nvbios_of = {
62 .init = of_init, 72 .init = of_init,
63 .fini = (void(*)(void *))kfree, 73 .fini = (void(*)(void *))kfree,
64 .read = of_read, 74 .read = of_read,
75 .size = of_size,
65 .rw = false, 76 .rw = false,
77 .ignore_checksum = true,
78 .no_pcir = true,
66}; 79};
67#else 80#else
68const struct nvbios_source 81const struct nvbios_source
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
index 814cb51cc873..385a90f91ed6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
@@ -35,6 +35,8 @@ static const struct nvkm_device_agp_quirk
35nvkm_device_agp_quirks[] = { 35nvkm_device_agp_quirks[] = {
36 /* VIA Apollo PRO133x / GeForce FX 5600 Ultra - fdo#20341 */ 36 /* VIA Apollo PRO133x / GeForce FX 5600 Ultra - fdo#20341 */
37 { PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_NVIDIA, 0x0311, 2 }, 37 { PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_NVIDIA, 0x0311, 2 },
38 /* SiS 761 does not support AGP cards, use PCI mode */
39 { PCI_VENDOR_ID_SI, 0x0761, PCI_ANY_ID, PCI_ANY_ID, 0 },
38 {}, 40 {},
39}; 41};
40 42
@@ -137,8 +139,10 @@ nvkm_agp_ctor(struct nvkm_pci *pci)
137 while (quirk->hostbridge_vendor) { 139 while (quirk->hostbridge_vendor) {
138 if (info.device->vendor == quirk->hostbridge_vendor && 140 if (info.device->vendor == quirk->hostbridge_vendor &&
139 info.device->device == quirk->hostbridge_device && 141 info.device->device == quirk->hostbridge_device &&
140 pci->pdev->vendor == quirk->chip_vendor && 142 (quirk->chip_vendor == (u16)PCI_ANY_ID ||
141 pci->pdev->device == quirk->chip_device) { 143 pci->pdev->vendor == quirk->chip_vendor) &&
144 (quirk->chip_device == (u16)PCI_ANY_ID ||
145 pci->pdev->device == quirk->chip_device)) {
142 nvkm_info(subdev, "forcing default agp mode to %dX, " 146 nvkm_info(subdev, "forcing default agp mode to %dX, "
143 "use NvAGP=<mode> to override\n", 147 "use NvAGP=<mode> to override\n",
144 quirk->mode); 148 quirk->mode);
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 4649bd2ed340..183aea1abebc 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -244,6 +244,10 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
244 ret = qxl_bo_reserve(bo, false); 244 ret = qxl_bo_reserve(bo, false);
245 if (ret) 245 if (ret)
246 return ret; 246 return ret;
247 ret = qxl_bo_pin(bo, bo->type, NULL);
248 qxl_bo_unreserve(bo);
249 if (ret)
250 return ret;
247 251
248 qxl_draw_dirty_fb(qdev, qfb_src, bo, 0, 0, 252 qxl_draw_dirty_fb(qdev, qfb_src, bo, 0, 0,
249 &norect, one_clip_rect, inc); 253 &norect, one_clip_rect, inc);
@@ -257,7 +261,11 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
257 } 261 }
258 drm_vblank_put(dev, qcrtc->index); 262 drm_vblank_put(dev, qcrtc->index);
259 263
260 qxl_bo_unreserve(bo); 264 ret = qxl_bo_reserve(bo, false);
265 if (!ret) {
266 qxl_bo_unpin(bo);
267 qxl_bo_unreserve(bo);
268 }
261 269
262 return 0; 270 return 0;
263} 271}
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 41c422fee31a..c4a552637c93 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -144,14 +144,17 @@ static void qxl_dirty_update(struct qxl_fbdev *qfbdev,
144 144
145 spin_lock_irqsave(&qfbdev->dirty.lock, flags); 145 spin_lock_irqsave(&qfbdev->dirty.lock, flags);
146 146
147 if (qfbdev->dirty.y1 < y) 147 if ((qfbdev->dirty.y2 - qfbdev->dirty.y1) &&
148 y = qfbdev->dirty.y1; 148 (qfbdev->dirty.x2 - qfbdev->dirty.x1)) {
149 if (qfbdev->dirty.y2 > y2) 149 if (qfbdev->dirty.y1 < y)
150 y2 = qfbdev->dirty.y2; 150 y = qfbdev->dirty.y1;
151 if (qfbdev->dirty.x1 < x) 151 if (qfbdev->dirty.y2 > y2)
152 x = qfbdev->dirty.x1; 152 y2 = qfbdev->dirty.y2;
153 if (qfbdev->dirty.x2 > x2) 153 if (qfbdev->dirty.x1 < x)
154 x2 = qfbdev->dirty.x2; 154 x = qfbdev->dirty.x1;
155 if (qfbdev->dirty.x2 > x2)
156 x2 = qfbdev->dirty.x2;
157 }
155 158
156 qfbdev->dirty.x1 = x; 159 qfbdev->dirty.x1 = x;
157 qfbdev->dirty.x2 = x2; 160 qfbdev->dirty.x2 = x2;
diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index b66ec331c17c..4efa8e261baf 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -307,7 +307,7 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev,
307 idr_ret = qxl_release_alloc(qdev, QXL_RELEASE_SURFACE_CMD, release); 307 idr_ret = qxl_release_alloc(qdev, QXL_RELEASE_SURFACE_CMD, release);
308 if (idr_ret < 0) 308 if (idr_ret < 0)
309 return idr_ret; 309 return idr_ret;
310 bo = qxl_bo_ref(to_qxl_bo(entry->tv.bo)); 310 bo = to_qxl_bo(entry->tv.bo);
311 311
312 (*release)->release_offset = create_rel->release_offset + 64; 312 (*release)->release_offset = create_rel->release_offset + 64;
313 313
@@ -316,8 +316,6 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev,
316 info = qxl_release_map(qdev, *release); 316 info = qxl_release_map(qdev, *release);
317 info->id = idr_ret; 317 info->id = idr_ret;
318 qxl_release_unmap(qdev, *release, info); 318 qxl_release_unmap(qdev, *release, info);
319
320 qxl_bo_unref(&bo);
321 return 0; 319 return 0;
322 } 320 }
323 321
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index d2e9e9efc159..6743174acdbc 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1633,18 +1633,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
1633 radeon_fbdev_init(rdev); 1633 radeon_fbdev_init(rdev);
1634 drm_kms_helper_poll_init(rdev->ddev); 1634 drm_kms_helper_poll_init(rdev->ddev);
1635 1635
1636 if (rdev->pm.dpm_enabled) { 1636 /* do pm late init */
1637 /* do dpm late init */ 1637 ret = radeon_pm_late_init(rdev);
1638 ret = radeon_pm_late_init(rdev);
1639 if (ret) {
1640 rdev->pm.dpm_enabled = false;
1641 DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n");
1642 }
1643 /* set the dpm state for PX since there won't be
1644 * a modeset to call this.
1645 */
1646 radeon_pm_compute_clocks(rdev);
1647 }
1648 1638
1649 return 0; 1639 return 0;
1650} 1640}
diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
index 6cddae44fa6e..744f5c49c664 100644
--- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
+++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
@@ -283,6 +283,7 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topol
283 radeon_connector->mst_encoder = radeon_dp_create_fake_mst_encoder(master); 283 radeon_connector->mst_encoder = radeon_dp_create_fake_mst_encoder(master);
284 284
285 drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0); 285 drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0);
286 drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
286 drm_mode_connector_set_path_property(connector, pathprop); 287 drm_mode_connector_set_path_property(connector, pathprop);
287 288
288 return connector; 289 return connector;
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 1aa657fe31cb..26da2f4d7b4f 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -397,3 +397,19 @@ void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector
397{ 397{
398 drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector); 398 drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);
399} 399}
400
401void radeon_fbdev_restore_mode(struct radeon_device *rdev)
402{
403 struct radeon_fbdev *rfbdev = rdev->mode_info.rfbdev;
404 struct drm_fb_helper *fb_helper;
405 int ret;
406
407 if (!rfbdev)
408 return;
409
410 fb_helper = &rfbdev->helper;
411
412 ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
413 if (ret)
414 DRM_DEBUG("failed to restore crtc mode\n");
415}
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 4a119c255ba9..0e932bf932c1 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -598,7 +598,7 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file
598 * Outdated mess for old drm with Xorg being in charge (void function now). 598 * Outdated mess for old drm with Xorg being in charge (void function now).
599 */ 599 */
600/** 600/**
601 * radeon_driver_firstopen_kms - drm callback for last close 601 * radeon_driver_lastclose_kms - drm callback for last close
602 * 602 *
603 * @dev: drm dev pointer 603 * @dev: drm dev pointer
604 * 604 *
@@ -606,6 +606,9 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file
606 */ 606 */
607void radeon_driver_lastclose_kms(struct drm_device *dev) 607void radeon_driver_lastclose_kms(struct drm_device *dev)
608{ 608{
609 struct radeon_device *rdev = dev->dev_private;
610
611 radeon_fbdev_restore_mode(rdev);
609 vga_switcheroo_process_delayed_switch(); 612 vga_switcheroo_process_delayed_switch();
610} 613}
611 614
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index aecc3e3dec0c..457b026a0972 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -980,6 +980,7 @@ int radeon_fbdev_init(struct radeon_device *rdev);
980void radeon_fbdev_fini(struct radeon_device *rdev); 980void radeon_fbdev_fini(struct radeon_device *rdev);
981void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state); 981void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state);
982bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj); 982bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj);
983void radeon_fbdev_restore_mode(struct radeon_device *rdev);
983 984
984void radeon_fb_output_poll_changed(struct radeon_device *rdev); 985void radeon_fb_output_poll_changed(struct radeon_device *rdev);
985 986
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 05751f3f8444..44489cce7458 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1326,14 +1326,6 @@ static int radeon_pm_init_old(struct radeon_device *rdev)
1326 INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler); 1326 INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
1327 1327
1328 if (rdev->pm.num_power_states > 1) { 1328 if (rdev->pm.num_power_states > 1) {
1329 /* where's the best place to put these? */
1330 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1331 if (ret)
1332 DRM_ERROR("failed to create device file for power profile\n");
1333 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1334 if (ret)
1335 DRM_ERROR("failed to create device file for power method\n");
1336
1337 if (radeon_debugfs_pm_init(rdev)) { 1329 if (radeon_debugfs_pm_init(rdev)) {
1338 DRM_ERROR("Failed to register debugfs file for PM!\n"); 1330 DRM_ERROR("Failed to register debugfs file for PM!\n");
1339 } 1331 }
@@ -1391,20 +1383,6 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
1391 goto dpm_failed; 1383 goto dpm_failed;
1392 rdev->pm.dpm_enabled = true; 1384 rdev->pm.dpm_enabled = true;
1393 1385
1394 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
1395 if (ret)
1396 DRM_ERROR("failed to create device file for dpm state\n");
1397 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
1398 if (ret)
1399 DRM_ERROR("failed to create device file for dpm state\n");
1400 /* XXX: these are noops for dpm but are here for backwards compat */
1401 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1402 if (ret)
1403 DRM_ERROR("failed to create device file for power profile\n");
1404 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1405 if (ret)
1406 DRM_ERROR("failed to create device file for power method\n");
1407
1408 if (radeon_debugfs_pm_init(rdev)) { 1386 if (radeon_debugfs_pm_init(rdev)) {
1409 DRM_ERROR("Failed to register debugfs file for dpm!\n"); 1387 DRM_ERROR("Failed to register debugfs file for dpm!\n");
1410 } 1388 }
@@ -1545,9 +1523,44 @@ int radeon_pm_late_init(struct radeon_device *rdev)
1545 int ret = 0; 1523 int ret = 0;
1546 1524
1547 if (rdev->pm.pm_method == PM_METHOD_DPM) { 1525 if (rdev->pm.pm_method == PM_METHOD_DPM) {
1548 mutex_lock(&rdev->pm.mutex); 1526 if (rdev->pm.dpm_enabled) {
1549 ret = radeon_dpm_late_enable(rdev); 1527 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
1550 mutex_unlock(&rdev->pm.mutex); 1528 if (ret)
1529 DRM_ERROR("failed to create device file for dpm state\n");
1530 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
1531 if (ret)
1532 DRM_ERROR("failed to create device file for dpm state\n");
1533 /* XXX: these are noops for dpm but are here for backwards compat */
1534 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1535 if (ret)
1536 DRM_ERROR("failed to create device file for power profile\n");
1537 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1538 if (ret)
1539 DRM_ERROR("failed to create device file for power method\n");
1540
1541 mutex_lock(&rdev->pm.mutex);
1542 ret = radeon_dpm_late_enable(rdev);
1543 mutex_unlock(&rdev->pm.mutex);
1544 if (ret) {
1545 rdev->pm.dpm_enabled = false;
1546 DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n");
1547 } else {
1548 /* set the dpm state for PX since there won't be
1549 * a modeset to call this.
1550 */
1551 radeon_pm_compute_clocks(rdev);
1552 }
1553 }
1554 } else {
1555 if (rdev->pm.num_power_states > 1) {
1556 /* where's the best place to put these? */
1557 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1558 if (ret)
1559 DRM_ERROR("failed to create device file for power profile\n");
1560 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1561 if (ret)
1562 DRM_ERROR("failed to create device file for power method\n");
1563 }
1551 } 1564 }
1552 return ret; 1565 return ret;
1553} 1566}
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index e9115d3f67b0..e72bf46042e0 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2928,6 +2928,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, 2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
2929 { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, 2929 { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
2930 { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 }, 2930 { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 },
2931 { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },
2931 { 0, 0, 0, 0 }, 2932 { 0, 0, 0, 0 },
2932}; 2933};
2933 2934
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index db8b49101a8b..512263919282 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -34,8 +34,8 @@ virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
34 struct drm_info_node *node = (struct drm_info_node *) m->private; 34 struct drm_info_node *node = (struct drm_info_node *) m->private;
35 struct virtio_gpu_device *vgdev = node->minor->dev->dev_private; 35 struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
36 36
37 seq_printf(m, "fence %ld %lld\n", 37 seq_printf(m, "fence %llu %lld\n",
38 atomic64_read(&vgdev->fence_drv.last_seq), 38 (u64)atomic64_read(&vgdev->fence_drv.last_seq),
39 vgdev->fence_drv.sync_seq); 39 vgdev->fence_drv.sync_seq);
40 return 0; 40 return 0;
41} 41}
diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c b/drivers/gpu/drm/virtio/virtgpu_fence.c
index 1da632631dac..67097c9ce9c1 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fence.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fence.c
@@ -61,7 +61,7 @@ static void virtio_timeline_value_str(struct fence *f, char *str, int size)
61{ 61{
62 struct virtio_gpu_fence *fence = to_virtio_fence(f); 62 struct virtio_gpu_fence *fence = to_virtio_fence(f);
63 63
64 snprintf(str, size, "%lu", atomic64_read(&fence->drv->last_seq)); 64 snprintf(str, size, "%llu", (u64)atomic64_read(&fence->drv->last_seq));
65} 65}
66 66
67static const struct fence_ops virtio_fence_ops = { 67static const struct fence_ops virtio_fence_ops = {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 64b50409fa07..03f63c749c02 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -657,7 +657,8 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base)
657 struct vmw_resource *res = &user_srf->srf.res; 657 struct vmw_resource *res = &user_srf->srf.res;
658 658
659 *p_base = NULL; 659 *p_base = NULL;
660 ttm_base_object_unref(&user_srf->backup_base); 660 if (user_srf->backup_base)
661 ttm_base_object_unref(&user_srf->backup_base);
661 vmw_resource_unreference(&res); 662 vmw_resource_unreference(&res);
662} 663}
663 664
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 3dd2de31a2f8..472b88285c75 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -24,6 +24,7 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/dmi.h>
27#include <linux/i2c.h> 28#include <linux/i2c.h>
28#include <linux/clk.h> 29#include <linux/clk.h>
29#include <linux/clk-provider.h> 30#include <linux/clk-provider.h>
@@ -51,6 +52,22 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
51} 52}
52 53
53#ifdef CONFIG_ACPI 54#ifdef CONFIG_ACPI
55/*
56 * The HCNT/LCNT information coming from ACPI should be the most accurate
57 * for given platform. However, some systems get it wrong. On such systems
58 * we get better results by calculating those based on the input clock.
59 */
60static const struct dmi_system_id dw_i2c_no_acpi_params[] = {
61 {
62 .ident = "Dell Inspiron 7348",
63 .matches = {
64 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
65 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7348"),
66 },
67 },
68 { }
69};
70
54static void dw_i2c_acpi_params(struct platform_device *pdev, char method[], 71static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
55 u16 *hcnt, u16 *lcnt, u32 *sda_hold) 72 u16 *hcnt, u16 *lcnt, u32 *sda_hold)
56{ 73{
@@ -58,6 +75,9 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
58 acpi_handle handle = ACPI_HANDLE(&pdev->dev); 75 acpi_handle handle = ACPI_HANDLE(&pdev->dev);
59 union acpi_object *obj; 76 union acpi_object *obj;
60 77
78 if (dmi_check_system(dw_i2c_no_acpi_params))
79 return;
80
61 if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf))) 81 if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf)))
62 return; 82 return;
63 83
@@ -253,12 +273,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
253 adap->dev.parent = &pdev->dev; 273 adap->dev.parent = &pdev->dev;
254 adap->dev.of_node = pdev->dev.of_node; 274 adap->dev.of_node = pdev->dev.of_node;
255 275
256 r = i2c_add_numbered_adapter(adap);
257 if (r) {
258 dev_err(&pdev->dev, "failure adding adapter\n");
259 return r;
260 }
261
262 if (dev->pm_runtime_disabled) { 276 if (dev->pm_runtime_disabled) {
263 pm_runtime_forbid(&pdev->dev); 277 pm_runtime_forbid(&pdev->dev);
264 } else { 278 } else {
@@ -268,6 +282,13 @@ static int dw_i2c_probe(struct platform_device *pdev)
268 pm_runtime_enable(&pdev->dev); 282 pm_runtime_enable(&pdev->dev);
269 } 283 }
270 284
285 r = i2c_add_numbered_adapter(adap);
286 if (r) {
287 dev_err(&pdev->dev, "failure adding adapter\n");
288 pm_runtime_disable(&pdev->dev);
289 return r;
290 }
291
271 return 0; 292 return 0;
272} 293}
273 294
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index d8361dada584..d8b5a8fee1e6 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -690,15 +690,16 @@ static int rcar_i2c_probe(struct platform_device *pdev)
690 return ret; 690 return ret;
691 } 691 }
692 692
693 pm_runtime_enable(dev);
694 platform_set_drvdata(pdev, priv);
695
693 ret = i2c_add_numbered_adapter(adap); 696 ret = i2c_add_numbered_adapter(adap);
694 if (ret < 0) { 697 if (ret < 0) {
695 dev_err(dev, "reg adap failed: %d\n", ret); 698 dev_err(dev, "reg adap failed: %d\n", ret);
699 pm_runtime_disable(dev);
696 return ret; 700 return ret;
697 } 701 }
698 702
699 pm_runtime_enable(dev);
700 platform_set_drvdata(pdev, priv);
701
702 dev_info(dev, "probed\n"); 703 dev_info(dev, "probed\n");
703 704
704 return 0; 705 return 0;
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 50bfd8cef5f2..5df819610d52 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1243,17 +1243,19 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
1243 i2c->adap.nr = i2c->pdata->bus_num; 1243 i2c->adap.nr = i2c->pdata->bus_num;
1244 i2c->adap.dev.of_node = pdev->dev.of_node; 1244 i2c->adap.dev.of_node = pdev->dev.of_node;
1245 1245
1246 platform_set_drvdata(pdev, i2c);
1247
1248 pm_runtime_enable(&pdev->dev);
1249
1246 ret = i2c_add_numbered_adapter(&i2c->adap); 1250 ret = i2c_add_numbered_adapter(&i2c->adap);
1247 if (ret < 0) { 1251 if (ret < 0) {
1248 dev_err(&pdev->dev, "failed to add bus to i2c core\n"); 1252 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
1253 pm_runtime_disable(&pdev->dev);
1249 s3c24xx_i2c_deregister_cpufreq(i2c); 1254 s3c24xx_i2c_deregister_cpufreq(i2c);
1250 clk_unprepare(i2c->clk); 1255 clk_unprepare(i2c->clk);
1251 return ret; 1256 return ret;
1252 } 1257 }
1253 1258
1254 platform_set_drvdata(pdev, i2c);
1255
1256 pm_runtime_enable(&pdev->dev);
1257 pm_runtime_enable(&i2c->adap.dev); 1259 pm_runtime_enable(&i2c->adap.dev);
1258 1260
1259 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); 1261 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5f89f1e3c2f2..a59c3111f7fb 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -694,12 +694,12 @@ static int i2c_device_probe(struct device *dev)
694 goto err_clear_wakeup_irq; 694 goto err_clear_wakeup_irq;
695 695
696 status = dev_pm_domain_attach(&client->dev, true); 696 status = dev_pm_domain_attach(&client->dev, true);
697 if (status != -EPROBE_DEFER) { 697 if (status == -EPROBE_DEFER)
698 status = driver->probe(client, i2c_match_id(driver->id_table, 698 goto err_clear_wakeup_irq;
699 client)); 699
700 if (status) 700 status = driver->probe(client, i2c_match_id(driver->id_table, client));
701 goto err_detach_pm_domain; 701 if (status)
702 } 702 goto err_detach_pm_domain;
703 703
704 return 0; 704 return 0;
705 705
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index b1ab13f3e182..59a2dafc8c57 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1232,14 +1232,32 @@ static bool cma_match_private_data(struct rdma_id_private *id_priv,
1232 return true; 1232 return true;
1233} 1233}
1234 1234
1235static bool cma_protocol_roce_dev_port(struct ib_device *device, int port_num)
1236{
1237 enum rdma_link_layer ll = rdma_port_get_link_layer(device, port_num);
1238 enum rdma_transport_type transport =
1239 rdma_node_get_transport(device->node_type);
1240
1241 return ll == IB_LINK_LAYER_ETHERNET && transport == RDMA_TRANSPORT_IB;
1242}
1243
1244static bool cma_protocol_roce(const struct rdma_cm_id *id)
1245{
1246 struct ib_device *device = id->device;
1247 const int port_num = id->port_num ?: rdma_start_port(device);
1248
1249 return cma_protocol_roce_dev_port(device, port_num);
1250}
1251
1235static bool cma_match_net_dev(const struct rdma_id_private *id_priv, 1252static bool cma_match_net_dev(const struct rdma_id_private *id_priv,
1236 const struct net_device *net_dev) 1253 const struct net_device *net_dev)
1237{ 1254{
1238 const struct rdma_addr *addr = &id_priv->id.route.addr; 1255 const struct rdma_addr *addr = &id_priv->id.route.addr;
1239 1256
1240 if (!net_dev) 1257 if (!net_dev)
1241 /* This request is an AF_IB request */ 1258 /* This request is an AF_IB request or a RoCE request */
1242 return addr->src_addr.ss_family == AF_IB; 1259 return addr->src_addr.ss_family == AF_IB ||
1260 cma_protocol_roce(&id_priv->id);
1243 1261
1244 return !addr->dev_addr.bound_dev_if || 1262 return !addr->dev_addr.bound_dev_if ||
1245 (net_eq(dev_net(net_dev), &init_net) && 1263 (net_eq(dev_net(net_dev), &init_net) &&
@@ -1294,6 +1312,10 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
1294 if (PTR_ERR(*net_dev) == -EAFNOSUPPORT) { 1312 if (PTR_ERR(*net_dev) == -EAFNOSUPPORT) {
1295 /* Assuming the protocol is AF_IB */ 1313 /* Assuming the protocol is AF_IB */
1296 *net_dev = NULL; 1314 *net_dev = NULL;
1315 } else if (cma_protocol_roce_dev_port(req.device, req.port)) {
1316 /* TODO find the net dev matching the request parameters
1317 * through the RoCE GID table */
1318 *net_dev = NULL;
1297 } else { 1319 } else {
1298 return ERR_CAST(*net_dev); 1320 return ERR_CAST(*net_dev);
1299 } 1321 }
@@ -1593,11 +1615,16 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
1593 if (ret) 1615 if (ret)
1594 goto err; 1616 goto err;
1595 } else { 1617 } else {
1596 /* An AF_IB connection */ 1618 if (!cma_protocol_roce(listen_id) &&
1597 WARN_ON_ONCE(ss_family != AF_IB); 1619 cma_any_addr(cma_src_addr(id_priv))) {
1598 1620 rt->addr.dev_addr.dev_type = ARPHRD_INFINIBAND;
1599 cma_translate_ib((struct sockaddr_ib *)cma_src_addr(id_priv), 1621 rdma_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid);
1600 &rt->addr.dev_addr); 1622 ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey));
1623 } else if (!cma_any_addr(cma_src_addr(id_priv))) {
1624 ret = cma_translate_addr(cma_src_addr(id_priv), &rt->addr.dev_addr);
1625 if (ret)
1626 goto err;
1627 }
1601 } 1628 }
1602 rdma_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid); 1629 rdma_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid);
1603 1630
@@ -1635,13 +1662,12 @@ static struct rdma_id_private *cma_new_udp_id(struct rdma_cm_id *listen_id,
1635 if (ret) 1662 if (ret)
1636 goto err; 1663 goto err;
1637 } else { 1664 } else {
1638 /* An AF_IB connection */ 1665 if (!cma_any_addr(cma_src_addr(id_priv))) {
1639 WARN_ON_ONCE(ss_family != AF_IB); 1666 ret = cma_translate_addr(cma_src_addr(id_priv),
1640 1667 &id->route.addr.dev_addr);
1641 if (!cma_any_addr(cma_src_addr(id_priv))) 1668 if (ret)
1642 cma_translate_ib((struct sockaddr_ib *) 1669 goto err;
1643 cma_src_addr(id_priv), 1670 }
1644 &id->route.addr.dev_addr);
1645 } 1671 }
1646 1672
1647 id_priv->state = RDMA_CM_CONNECT; 1673 id_priv->state = RDMA_CM_CONNECT;
diff --git a/drivers/infiniband/hw/usnic/usnic.h b/drivers/infiniband/hw/usnic/usnic.h
index 5be13d8991bc..f903502d3883 100644
--- a/drivers/infiniband/hw/usnic/usnic.h
+++ b/drivers/infiniband/hw/usnic/usnic.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_abi.h b/drivers/infiniband/hw/usnic/usnic_abi.h
index 04a66229584e..7fe9502ce8d3 100644
--- a/drivers/infiniband/hw/usnic/usnic_abi.h
+++ b/drivers/infiniband/hw/usnic/usnic_abi.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h b/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h
index 393567266142..596e0ed49a8e 100644
--- a/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h
+++ b/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_common_util.h b/drivers/infiniband/hw/usnic/usnic_common_util.h
index 9d737ed5e55d..b54986de5f0c 100644
--- a/drivers/infiniband/hw/usnic/usnic_common_util.h
+++ b/drivers/infiniband/hw/usnic/usnic_common_util.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_debugfs.c b/drivers/infiniband/hw/usnic/usnic_debugfs.c
index 5d13860161a4..5e55b8bc6fe4 100644
--- a/drivers/infiniband/hw/usnic/usnic_debugfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_debugfs.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_debugfs.h b/drivers/infiniband/hw/usnic/usnic_debugfs.h
index 4087d24a88f6..98453e91daa6 100644
--- a/drivers/infiniband/hw/usnic/usnic_debugfs.h
+++ b/drivers/infiniband/hw/usnic/usnic_debugfs.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_fwd.c b/drivers/infiniband/hw/usnic/usnic_fwd.c
index e3c9bd9d3ba3..3c37dd59c04e 100644
--- a/drivers/infiniband/hw/usnic/usnic_fwd.c
+++ b/drivers/infiniband/hw/usnic/usnic_fwd.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_fwd.h b/drivers/infiniband/hw/usnic/usnic_fwd.h
index 93713a2230b3..3a8add9ddf46 100644
--- a/drivers/infiniband/hw/usnic/usnic_fwd.h
+++ b/drivers/infiniband/hw/usnic/usnic_fwd.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib.h b/drivers/infiniband/hw/usnic/usnic_ib.h
index e5a9297dd1bd..525bf272671e 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 34c49b8105fe..0c15bd885035 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
index db3588df3546..85dc3f989ff7 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h
index b0aafe8db0c3..b1458be1d402 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
index 27dc67c1689f..3412ea06116e 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h
index 0d09b493cd02..3d98e16cfeaf 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 7df43827cb29..f8e3211689a3 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
index 0bd04efa16f3..414eaa566bd9 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_log.h b/drivers/infiniband/hw/usnic/usnic_log.h
index 75777a66c684..183fcb6a952f 100644
--- a/drivers/infiniband/hw/usnic/usnic_log.h
+++ b/drivers/infiniband/hw/usnic/usnic_log.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_transport.c b/drivers/infiniband/hw/usnic/usnic_transport.c
index ddef6f77a78c..de318389a301 100644
--- a/drivers/infiniband/hw/usnic/usnic_transport.c
+++ b/drivers/infiniband/hw/usnic/usnic_transport.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_transport.h b/drivers/infiniband/hw/usnic/usnic_transport.h
index 7e5dc6d9f462..9a7a2d9755c0 100644
--- a/drivers/infiniband/hw/usnic/usnic_transport.h
+++ b/drivers/infiniband/hw/usnic/usnic_transport.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/hw/usnic/usnic_uiom.c
index cb2337f0532b..645a5f6e6c88 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom.c
+++ b/drivers/infiniband/hw/usnic/usnic_uiom.c
@@ -7,7 +7,7 @@
7 * licenses. You may choose to be licensed under the terms of the GNU 7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file 8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the 9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below: 10 * BSD license below:
11 * 11 *
12 * Redistribution and use in source and binary forms, with or 12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following 13 * without modification, are permitted provided that the following
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.h b/drivers/infiniband/hw/usnic/usnic_uiom.h
index 70440996e8f2..45ca7c1613a7 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom.h
+++ b/drivers/infiniband/hw/usnic/usnic_uiom.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c
index 3a4288e0fbac..42b4b4c4e452 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c
+++ b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2014, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2014, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h
index d4f752e258fd..c0b0b876ab90 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h
+++ b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_vnic.c b/drivers/infiniband/hw/usnic/usnic_vnic.c
index 656b88c39eda..66de93fb8ea9 100644
--- a/drivers/infiniband/hw/usnic/usnic_vnic.c
+++ b/drivers/infiniband/hw/usnic/usnic_vnic.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_vnic.h b/drivers/infiniband/hw/usnic/usnic_vnic.h
index 14d931a8829d..a08423e478af 100644
--- a/drivers/infiniband/hw/usnic/usnic_vnic.h
+++ b/drivers/infiniband/hw/usnic/usnic_vnic.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 4cd5428a2399..edc5b8565d6d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -495,6 +495,7 @@ void ipoib_dev_cleanup(struct net_device *dev);
495void ipoib_mcast_join_task(struct work_struct *work); 495void ipoib_mcast_join_task(struct work_struct *work);
496void ipoib_mcast_carrier_on_task(struct work_struct *work); 496void ipoib_mcast_carrier_on_task(struct work_struct *work);
497void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb); 497void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb);
498void ipoib_mcast_free(struct ipoib_mcast *mc);
498 499
499void ipoib_mcast_restart_task(struct work_struct *work); 500void ipoib_mcast_restart_task(struct work_struct *work);
500int ipoib_mcast_start_thread(struct net_device *dev); 501int ipoib_mcast_start_thread(struct net_device *dev);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f74316e679d2..babba05d7a0e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1207,8 +1207,10 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
1207 1207
1208out_unlock: 1208out_unlock:
1209 spin_unlock_irqrestore(&priv->lock, flags); 1209 spin_unlock_irqrestore(&priv->lock, flags);
1210 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) 1210 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
1211 ipoib_mcast_leave(dev, mcast); 1211 ipoib_mcast_leave(dev, mcast);
1212 ipoib_mcast_free(mcast);
1213 }
1212} 1214}
1213 1215
1214static void ipoib_reap_neigh(struct work_struct *work) 1216static void ipoib_reap_neigh(struct work_struct *work)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 136cbefe00f8..d750a86042f3 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -106,7 +106,7 @@ static void __ipoib_mcast_schedule_join_thread(struct ipoib_dev_priv *priv,
106 queue_delayed_work(priv->wq, &priv->mcast_task, 0); 106 queue_delayed_work(priv->wq, &priv->mcast_task, 0);
107} 107}
108 108
109static void ipoib_mcast_free(struct ipoib_mcast *mcast) 109void ipoib_mcast_free(struct ipoib_mcast *mcast)
110{ 110{
111 struct net_device *dev = mcast->dev; 111 struct net_device *dev = mcast->dev;
112 int tx_dropped = 0; 112 int tx_dropped = 0;
diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c
index 5f191071d44a..e4eb048d1bf6 100644
--- a/drivers/input/mouse/cyapa_gen6.c
+++ b/drivers/input/mouse/cyapa_gen6.c
@@ -241,14 +241,10 @@ static int cyapa_gen6_read_sys_info(struct cyapa *cyapa)
241 memcpy(&cyapa->product_id[13], &resp_data[62], 2); 241 memcpy(&cyapa->product_id[13], &resp_data[62], 2);
242 cyapa->product_id[15] = '\0'; 242 cyapa->product_id[15] = '\0';
243 243
244 /* Get the number of Rx electrodes. */
244 rotat_align = resp_data[68]; 245 rotat_align = resp_data[68];
245 if (rotat_align) { 246 cyapa->electrodes_rx =
246 cyapa->electrodes_rx = cyapa->electrodes_y; 247 rotat_align ? cyapa->electrodes_y : cyapa->electrodes_x;
247 cyapa->electrodes_rx = cyapa->electrodes_y;
248 } else {
249 cyapa->electrodes_rx = cyapa->electrodes_x;
250 cyapa->electrodes_rx = cyapa->electrodes_y;
251 }
252 cyapa->aligned_electrodes_rx = (cyapa->electrodes_rx + 3) & ~3u; 248 cyapa->aligned_electrodes_rx = (cyapa->electrodes_rx + 3) & ~3u;
253 249
254 if (!cyapa->electrodes_x || !cyapa->electrodes_y || 250 if (!cyapa->electrodes_x || !cyapa->electrodes_y ||
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 0f5f968592bd..04edc8f7122f 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -668,18 +668,22 @@ static int ads7846_no_filter(void *ads, int data_idx, int *val)
668 668
669static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m) 669static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m)
670{ 670{
671 int value;
671 struct spi_transfer *t = 672 struct spi_transfer *t =
672 list_entry(m->transfers.prev, struct spi_transfer, transfer_list); 673 list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
673 674
674 if (ts->model == 7845) { 675 if (ts->model == 7845) {
675 return be16_to_cpup((__be16 *)&(((char*)t->rx_buf)[1])) >> 3; 676 value = be16_to_cpup((__be16 *)&(((char *)t->rx_buf)[1]));
676 } else { 677 } else {
677 /* 678 /*
678 * adjust: on-wire is a must-ignore bit, a BE12 value, then 679 * adjust: on-wire is a must-ignore bit, a BE12 value, then
679 * padding; built from two 8 bit values written msb-first. 680 * padding; built from two 8 bit values written msb-first.
680 */ 681 */
681 return be16_to_cpup((__be16 *)t->rx_buf) >> 3; 682 value = be16_to_cpup((__be16 *)t->rx_buf);
682 } 683 }
684
685 /* enforce ADC output is 12 bits width */
686 return (value >> 3) & 0xfff;
683} 687}
684 688
685static void ads7846_update_value(struct spi_message *m, int val) 689static void ads7846_update_value(struct spi_message *m, int val)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index d9da766719c8..cbe6a890a93a 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -23,8 +23,7 @@ config IOMMU_IO_PGTABLE
23config IOMMU_IO_PGTABLE_LPAE 23config IOMMU_IO_PGTABLE_LPAE
24 bool "ARMv7/v8 Long Descriptor Format" 24 bool "ARMv7/v8 Long Descriptor Format"
25 select IOMMU_IO_PGTABLE 25 select IOMMU_IO_PGTABLE
26 # SWIOTLB guarantees a dma_to_phys() implementation 26 depends on HAS_DMA && (ARM || ARM64 || COMPILE_TEST)
27 depends on ARM || ARM64 || (COMPILE_TEST && SWIOTLB)
28 help 27 help
29 Enable support for the ARM long descriptor pagetable format. 28 Enable support for the ARM long descriptor pagetable format.
30 This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page 29 This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index f82060e778a2..08d2775887f7 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2006,6 +2006,15 @@ static void do_detach(struct iommu_dev_data *dev_data)
2006{ 2006{
2007 struct amd_iommu *iommu; 2007 struct amd_iommu *iommu;
2008 2008
2009 /*
2010 * First check if the device is still attached. It might already
2011 * be detached from its domain because the generic
2012 * iommu_detach_group code detached it and we try again here in
2013 * our alias handling.
2014 */
2015 if (!dev_data->domain)
2016 return;
2017
2009 iommu = amd_iommu_rlookup_table[dev_data->devid]; 2018 iommu = amd_iommu_rlookup_table[dev_data->devid];
2010 2019
2011 /* decrease reference counters */ 2020 /* decrease reference counters */
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 5ef347a13cb5..1b066e7d144d 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1256,6 +1256,9 @@ static int iommu_init_pci(struct amd_iommu *iommu)
1256 if (!iommu->dev) 1256 if (!iommu->dev)
1257 return -ENODEV; 1257 return -ENODEV;
1258 1258
1259 /* Prevent binding other PCI device drivers to IOMMU devices */
1260 iommu->dev->match_driver = false;
1261
1259 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET, 1262 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET,
1260 &iommu->cap); 1263 &iommu->cap);
1261 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_RANGE_OFFSET, 1264 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_RANGE_OFFSET,
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index dafaf59dc3b8..286e890e7d64 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -56,6 +56,7 @@
56#define IDR0_TTF_SHIFT 2 56#define IDR0_TTF_SHIFT 2
57#define IDR0_TTF_MASK 0x3 57#define IDR0_TTF_MASK 0x3
58#define IDR0_TTF_AARCH64 (2 << IDR0_TTF_SHIFT) 58#define IDR0_TTF_AARCH64 (2 << IDR0_TTF_SHIFT)
59#define IDR0_TTF_AARCH32_64 (3 << IDR0_TTF_SHIFT)
59#define IDR0_S1P (1 << 1) 60#define IDR0_S1P (1 << 1)
60#define IDR0_S2P (1 << 0) 61#define IDR0_S2P (1 << 0)
61 62
@@ -342,7 +343,8 @@
342#define CMDQ_TLBI_0_VMID_SHIFT 32 343#define CMDQ_TLBI_0_VMID_SHIFT 32
343#define CMDQ_TLBI_0_ASID_SHIFT 48 344#define CMDQ_TLBI_0_ASID_SHIFT 48
344#define CMDQ_TLBI_1_LEAF (1UL << 0) 345#define CMDQ_TLBI_1_LEAF (1UL << 0)
345#define CMDQ_TLBI_1_ADDR_MASK ~0xfffUL 346#define CMDQ_TLBI_1_VA_MASK ~0xfffUL
347#define CMDQ_TLBI_1_IPA_MASK 0xfffffffff000UL
346 348
347#define CMDQ_PRI_0_SSID_SHIFT 12 349#define CMDQ_PRI_0_SSID_SHIFT 12
348#define CMDQ_PRI_0_SSID_MASK 0xfffffUL 350#define CMDQ_PRI_0_SSID_MASK 0xfffffUL
@@ -770,11 +772,13 @@ static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent)
770 break; 772 break;
771 case CMDQ_OP_TLBI_NH_VA: 773 case CMDQ_OP_TLBI_NH_VA:
772 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT; 774 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT;
773 /* Fallthrough */ 775 cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0;
776 cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_VA_MASK;
777 break;
774 case CMDQ_OP_TLBI_S2_IPA: 778 case CMDQ_OP_TLBI_S2_IPA:
775 cmd[0] |= (u64)ent->tlbi.vmid << CMDQ_TLBI_0_VMID_SHIFT; 779 cmd[0] |= (u64)ent->tlbi.vmid << CMDQ_TLBI_0_VMID_SHIFT;
776 cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0; 780 cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0;
777 cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_ADDR_MASK; 781 cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_IPA_MASK;
778 break; 782 break;
779 case CMDQ_OP_TLBI_NH_ASID: 783 case CMDQ_OP_TLBI_NH_ASID:
780 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT; 784 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT;
@@ -2460,7 +2464,13 @@ static int arm_smmu_device_probe(struct arm_smmu_device *smmu)
2460 } 2464 }
2461 2465
2462 /* We only support the AArch64 table format at present */ 2466 /* We only support the AArch64 table format at present */
2463 if ((reg & IDR0_TTF_MASK << IDR0_TTF_SHIFT) < IDR0_TTF_AARCH64) { 2467 switch (reg & IDR0_TTF_MASK << IDR0_TTF_SHIFT) {
2468 case IDR0_TTF_AARCH32_64:
2469 smmu->ias = 40;
2470 /* Fallthrough */
2471 case IDR0_TTF_AARCH64:
2472 break;
2473 default:
2464 dev_err(smmu->dev, "AArch64 table format not supported!\n"); 2474 dev_err(smmu->dev, "AArch64 table format not supported!\n");
2465 return -ENXIO; 2475 return -ENXIO;
2466 } 2476 }
@@ -2541,8 +2551,7 @@ static int arm_smmu_device_probe(struct arm_smmu_device *smmu)
2541 dev_warn(smmu->dev, 2551 dev_warn(smmu->dev,
2542 "failed to set DMA mask for table walker\n"); 2552 "failed to set DMA mask for table walker\n");
2543 2553
2544 if (!smmu->ias) 2554 smmu->ias = max(smmu->ias, smmu->oas);
2545 smmu->ias = smmu->oas;
2546 2555
2547 dev_info(smmu->dev, "ias %lu-bit, oas %lu-bit (features 0x%08x)\n", 2556 dev_info(smmu->dev, "ias %lu-bit, oas %lu-bit (features 0x%08x)\n",
2548 smmu->ias, smmu->oas, smmu->features); 2557 smmu->ias, smmu->oas, smmu->features);
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 041bc1810a86..35365f046923 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2301,6 +2301,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2301 2301
2302 if (ret) { 2302 if (ret) {
2303 spin_unlock_irqrestore(&device_domain_lock, flags); 2303 spin_unlock_irqrestore(&device_domain_lock, flags);
2304 free_devinfo_mem(info);
2304 return NULL; 2305 return NULL;
2305 } 2306 }
2306 2307
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 73c07482f487..7df97777662d 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -202,9 +202,9 @@ typedef u64 arm_lpae_iopte;
202 202
203static bool selftest_running = false; 203static bool selftest_running = false;
204 204
205static dma_addr_t __arm_lpae_dma_addr(struct device *dev, void *pages) 205static dma_addr_t __arm_lpae_dma_addr(void *pages)
206{ 206{
207 return phys_to_dma(dev, virt_to_phys(pages)); 207 return (dma_addr_t)virt_to_phys(pages);
208} 208}
209 209
210static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp, 210static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp,
@@ -223,10 +223,10 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp,
223 goto out_free; 223 goto out_free;
224 /* 224 /*
225 * We depend on the IOMMU being able to work with any physical 225 * We depend on the IOMMU being able to work with any physical
226 * address directly, so if the DMA layer suggests it can't by 226 * address directly, so if the DMA layer suggests otherwise by
227 * giving us back some translation, that bodes very badly... 227 * translating or truncating them, that bodes very badly...
228 */ 228 */
229 if (dma != __arm_lpae_dma_addr(dev, pages)) 229 if (dma != virt_to_phys(pages))
230 goto out_unmap; 230 goto out_unmap;
231 } 231 }
232 232
@@ -243,10 +243,8 @@ out_free:
243static void __arm_lpae_free_pages(void *pages, size_t size, 243static void __arm_lpae_free_pages(void *pages, size_t size,
244 struct io_pgtable_cfg *cfg) 244 struct io_pgtable_cfg *cfg)
245{ 245{
246 struct device *dev = cfg->iommu_dev;
247
248 if (!selftest_running) 246 if (!selftest_running)
249 dma_unmap_single(dev, __arm_lpae_dma_addr(dev, pages), 247 dma_unmap_single(cfg->iommu_dev, __arm_lpae_dma_addr(pages),
250 size, DMA_TO_DEVICE); 248 size, DMA_TO_DEVICE);
251 free_pages_exact(pages, size); 249 free_pages_exact(pages, size);
252} 250}
@@ -254,12 +252,11 @@ static void __arm_lpae_free_pages(void *pages, size_t size,
254static void __arm_lpae_set_pte(arm_lpae_iopte *ptep, arm_lpae_iopte pte, 252static void __arm_lpae_set_pte(arm_lpae_iopte *ptep, arm_lpae_iopte pte,
255 struct io_pgtable_cfg *cfg) 253 struct io_pgtable_cfg *cfg)
256{ 254{
257 struct device *dev = cfg->iommu_dev;
258
259 *ptep = pte; 255 *ptep = pte;
260 256
261 if (!selftest_running) 257 if (!selftest_running)
262 dma_sync_single_for_device(dev, __arm_lpae_dma_addr(dev, ptep), 258 dma_sync_single_for_device(cfg->iommu_dev,
259 __arm_lpae_dma_addr(ptep),
263 sizeof(pte), DMA_TO_DEVICE); 260 sizeof(pte), DMA_TO_DEVICE);
264} 261}
265 262
@@ -629,6 +626,11 @@ arm_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg)
629 if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS) 626 if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS)
630 return NULL; 627 return NULL;
631 628
629 if (!selftest_running && cfg->iommu_dev->dma_pfn_offset) {
630 dev_err(cfg->iommu_dev, "Cannot accommodate DMA offset for IOMMU page tables\n");
631 return NULL;
632 }
633
632 data = kmalloc(sizeof(*data), GFP_KERNEL); 634 data = kmalloc(sizeof(*data), GFP_KERNEL);
633 if (!data) 635 if (!data)
634 return NULL; 636 return NULL;
diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c
index de36237d7c6b..051645498b53 100644
--- a/drivers/mcb/mcb-pci.c
+++ b/drivers/mcb/mcb-pci.c
@@ -74,7 +74,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
74 ret = -ENOTSUPP; 74 ret = -ENOTSUPP;
75 dev_err(&pdev->dev, 75 dev_err(&pdev->dev,
76 "IO mapped PCI devices are not supported\n"); 76 "IO mapped PCI devices are not supported\n");
77 goto out_release; 77 goto out_iounmap;
78 } 78 }
79 79
80 pci_set_drvdata(pdev, priv); 80 pci_set_drvdata(pdev, priv);
@@ -89,7 +89,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
89 89
90 ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); 90 ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base);
91 if (ret < 0) 91 if (ret < 0)
92 goto out_iounmap; 92 goto out_mcb_bus;
93 num_cells = ret; 93 num_cells = ret;
94 94
95 dev_dbg(&pdev->dev, "Found %d cells\n", num_cells); 95 dev_dbg(&pdev->dev, "Found %d cells\n", num_cells);
@@ -98,6 +98,8 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
98 98
99 return 0; 99 return 0;
100 100
101out_mcb_bus:
102 mcb_release_bus(priv->bus);
101out_iounmap: 103out_iounmap:
102 iounmap(priv->base); 104 iounmap(priv->base);
103out_release: 105out_release:
diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c
index 240c9f0e85e7..8a096456579b 100644
--- a/drivers/md/dm-cache-policy-cleaner.c
+++ b/drivers/md/dm-cache-policy-cleaner.c
@@ -436,7 +436,7 @@ static struct dm_cache_policy *wb_create(dm_cblock_t cache_size,
436static struct dm_cache_policy_type wb_policy_type = { 436static struct dm_cache_policy_type wb_policy_type = {
437 .name = "cleaner", 437 .name = "cleaner",
438 .version = {1, 0, 0}, 438 .version = {1, 0, 0},
439 .hint_size = 0, 439 .hint_size = 4,
440 .owner = THIS_MODULE, 440 .owner = THIS_MODULE,
441 .create = wb_create 441 .create = wb_create
442}; 442};
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index ebaa4f803eec..192bb8beeb6b 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -203,7 +203,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
203 return -EINVAL; 203 return -EINVAL;
204 } 204 }
205 205
206 tmp_store = kmalloc(sizeof(*tmp_store), GFP_KERNEL); 206 tmp_store = kzalloc(sizeof(*tmp_store), GFP_KERNEL);
207 if (!tmp_store) { 207 if (!tmp_store) {
208 ti->error = "Exception store allocation failed"; 208 ti->error = "Exception store allocation failed";
209 return -ENOMEM; 209 return -ENOMEM;
@@ -215,7 +215,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
215 else if (persistent == 'N') 215 else if (persistent == 'N')
216 type = get_type("N"); 216 type = get_type("N");
217 else { 217 else {
218 ti->error = "Persistent flag is not P or N"; 218 ti->error = "Exception store type is not P or N";
219 r = -EINVAL; 219 r = -EINVAL;
220 goto bad_type; 220 goto bad_type;
221 } 221 }
@@ -233,7 +233,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
233 if (r) 233 if (r)
234 goto bad; 234 goto bad;
235 235
236 r = type->ctr(tmp_store, 0, NULL); 236 r = type->ctr(tmp_store, (strlen(argv[0]) > 1 ? &argv[0][1] : NULL));
237 if (r) { 237 if (r) {
238 ti->error = "Exception store type constructor failed"; 238 ti->error = "Exception store type constructor failed";
239 goto bad; 239 goto bad;
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index 0b2536247cf5..fae34e7a0b1e 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -42,8 +42,7 @@ struct dm_exception_store_type {
42 const char *name; 42 const char *name;
43 struct module *module; 43 struct module *module;
44 44
45 int (*ctr) (struct dm_exception_store *store, 45 int (*ctr) (struct dm_exception_store *store, char *options);
46 unsigned argc, char **argv);
47 46
48 /* 47 /*
49 * Destroys this object when you've finished with it. 48 * Destroys this object when you've finished with it.
@@ -123,6 +122,8 @@ struct dm_exception_store {
123 unsigned chunk_shift; 122 unsigned chunk_shift;
124 123
125 void *context; 124 void *context;
125
126 bool userspace_supports_overflow;
126}; 127};
127 128
128/* 129/*
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 97e165183e79..a0901214aef5 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -329,8 +329,7 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
329 */ 329 */
330 if (min_region_size > (1 << 13)) { 330 if (min_region_size > (1 << 13)) {
331 /* If not a power of 2, make it the next power of 2 */ 331 /* If not a power of 2, make it the next power of 2 */
332 if (min_region_size & (min_region_size - 1)) 332 region_size = roundup_pow_of_two(min_region_size);
333 region_size = 1 << fls(region_size);
334 DMINFO("Choosing default region size of %lu sectors", 333 DMINFO("Choosing default region size of %lu sectors",
335 region_size); 334 region_size);
336 } else { 335 } else {
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index bf71583296f7..117a05e40090 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -7,6 +7,7 @@
7 7
8#include "dm-exception-store.h" 8#include "dm-exception-store.h"
9 9
10#include <linux/ctype.h>
10#include <linux/mm.h> 11#include <linux/mm.h>
11#include <linux/pagemap.h> 12#include <linux/pagemap.h>
12#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
@@ -843,10 +844,10 @@ static void persistent_drop_snapshot(struct dm_exception_store *store)
843 DMWARN("write header failed"); 844 DMWARN("write header failed");
844} 845}
845 846
846static int persistent_ctr(struct dm_exception_store *store, 847static int persistent_ctr(struct dm_exception_store *store, char *options)
847 unsigned argc, char **argv)
848{ 848{
849 struct pstore *ps; 849 struct pstore *ps;
850 int r;
850 851
851 /* allocate the pstore */ 852 /* allocate the pstore */
852 ps = kzalloc(sizeof(*ps), GFP_KERNEL); 853 ps = kzalloc(sizeof(*ps), GFP_KERNEL);
@@ -868,14 +869,32 @@ static int persistent_ctr(struct dm_exception_store *store,
868 869
869 ps->metadata_wq = alloc_workqueue("ksnaphd", WQ_MEM_RECLAIM, 0); 870 ps->metadata_wq = alloc_workqueue("ksnaphd", WQ_MEM_RECLAIM, 0);
870 if (!ps->metadata_wq) { 871 if (!ps->metadata_wq) {
871 kfree(ps);
872 DMERR("couldn't start header metadata update thread"); 872 DMERR("couldn't start header metadata update thread");
873 return -ENOMEM; 873 r = -ENOMEM;
874 goto err_workqueue;
875 }
876
877 if (options) {
878 char overflow = toupper(options[0]);
879 if (overflow == 'O')
880 store->userspace_supports_overflow = true;
881 else {
882 DMERR("Unsupported persistent store option: %s", options);
883 r = -EINVAL;
884 goto err_options;
885 }
874 } 886 }
875 887
876 store->context = ps; 888 store->context = ps;
877 889
878 return 0; 890 return 0;
891
892err_options:
893 destroy_workqueue(ps->metadata_wq);
894err_workqueue:
895 kfree(ps);
896
897 return r;
879} 898}
880 899
881static unsigned persistent_status(struct dm_exception_store *store, 900static unsigned persistent_status(struct dm_exception_store *store,
@@ -888,7 +907,8 @@ static unsigned persistent_status(struct dm_exception_store *store,
888 case STATUSTYPE_INFO: 907 case STATUSTYPE_INFO:
889 break; 908 break;
890 case STATUSTYPE_TABLE: 909 case STATUSTYPE_TABLE:
891 DMEMIT(" P %llu", (unsigned long long)store->chunk_size); 910 DMEMIT(" %s %llu", store->userspace_supports_overflow ? "PO" : "P",
911 (unsigned long long)store->chunk_size);
892 } 912 }
893 913
894 return sz; 914 return sz;
diff --git a/drivers/md/dm-snap-transient.c b/drivers/md/dm-snap-transient.c
index 1ce9a2586e41..9b7c8c8049d6 100644
--- a/drivers/md/dm-snap-transient.c
+++ b/drivers/md/dm-snap-transient.c
@@ -70,8 +70,7 @@ static void transient_usage(struct dm_exception_store *store,
70 *metadata_sectors = 0; 70 *metadata_sectors = 0;
71} 71}
72 72
73static int transient_ctr(struct dm_exception_store *store, 73static int transient_ctr(struct dm_exception_store *store, char *options)
74 unsigned argc, char **argv)
75{ 74{
76 struct transient_c *tc; 75 struct transient_c *tc;
77 76
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index c0bcd6516dfe..c06b74e91cd6 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1098,7 +1098,7 @@ static void stop_merge(struct dm_snapshot *s)
1098} 1098}
1099 1099
1100/* 1100/*
1101 * Construct a snapshot mapping: <origin_dev> <COW-dev> <p/n> <chunk-size> 1101 * Construct a snapshot mapping: <origin_dev> <COW-dev> <p|po|n> <chunk-size>
1102 */ 1102 */
1103static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) 1103static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1104{ 1104{
@@ -1302,6 +1302,7 @@ static void __handover_exceptions(struct dm_snapshot *snap_src,
1302 1302
1303 u.store_swap = snap_dest->store; 1303 u.store_swap = snap_dest->store;
1304 snap_dest->store = snap_src->store; 1304 snap_dest->store = snap_src->store;
1305 snap_dest->store->userspace_supports_overflow = u.store_swap->userspace_supports_overflow;
1305 snap_src->store = u.store_swap; 1306 snap_src->store = u.store_swap;
1306 1307
1307 snap_dest->store->snap = snap_dest; 1308 snap_dest->store->snap = snap_dest;
@@ -1739,8 +1740,11 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
1739 1740
1740 pe = __find_pending_exception(s, pe, chunk); 1741 pe = __find_pending_exception(s, pe, chunk);
1741 if (!pe) { 1742 if (!pe) {
1742 s->snapshot_overflowed = 1; 1743 if (s->store->userspace_supports_overflow) {
1743 DMERR("Snapshot overflowed: Unable to allocate exception."); 1744 s->snapshot_overflowed = 1;
1745 DMERR("Snapshot overflowed: Unable to allocate exception.");
1746 } else
1747 __invalidate_snapshot(s, -ENOMEM);
1744 r = -EIO; 1748 r = -EIO;
1745 goto out_unlock; 1749 goto out_unlock;
1746 } 1750 }
@@ -2365,7 +2369,7 @@ static struct target_type origin_target = {
2365 2369
2366static struct target_type snapshot_target = { 2370static struct target_type snapshot_target = {
2367 .name = "snapshot", 2371 .name = "snapshot",
2368 .version = {1, 14, 0}, 2372 .version = {1, 15, 0},
2369 .module = THIS_MODULE, 2373 .module = THIS_MODULE,
2370 .ctr = snapshot_ctr, 2374 .ctr = snapshot_ctr,
2371 .dtr = snapshot_dtr, 2375 .dtr = snapshot_dtr,
@@ -2379,7 +2383,7 @@ static struct target_type snapshot_target = {
2379 2383
2380static struct target_type merge_target = { 2384static struct target_type merge_target = {
2381 .name = dm_snapshot_merge_target_name, 2385 .name = dm_snapshot_merge_target_name,
2382 .version = {1, 3, 0}, 2386 .version = {1, 4, 0},
2383 .module = THIS_MODULE, 2387 .module = THIS_MODULE,
2384 .ctr = snapshot_ctr, 2388 .ctr = snapshot_ctr,
2385 .dtr = snapshot_dtr, 2389 .dtr = snapshot_dtr,
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 6fcbfb063366..3897b90bd462 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -3201,7 +3201,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
3201 metadata_low_callback, 3201 metadata_low_callback,
3202 pool); 3202 pool);
3203 if (r) 3203 if (r)
3204 goto out_free_pt; 3204 goto out_flags_changed;
3205 3205
3206 pt->callbacks.congested_fn = pool_is_congested; 3206 pt->callbacks.congested_fn = pool_is_congested;
3207 dm_table_add_target_callbacks(ti->table, &pt->callbacks); 3207 dm_table_add_target_callbacks(ti->table, &pt->callbacks);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6264781dc69a..1b5c6047e4f1 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1001,6 +1001,7 @@ static void end_clone_bio(struct bio *clone)
1001 struct dm_rq_target_io *tio = info->tio; 1001 struct dm_rq_target_io *tio = info->tio;
1002 struct bio *bio = info->orig; 1002 struct bio *bio = info->orig;
1003 unsigned int nr_bytes = info->orig->bi_iter.bi_size; 1003 unsigned int nr_bytes = info->orig->bi_iter.bi_size;
1004 int error = clone->bi_error;
1004 1005
1005 bio_put(clone); 1006 bio_put(clone);
1006 1007
@@ -1011,13 +1012,13 @@ static void end_clone_bio(struct bio *clone)
1011 * the remainder. 1012 * the remainder.
1012 */ 1013 */
1013 return; 1014 return;
1014 else if (bio->bi_error) { 1015 else if (error) {
1015 /* 1016 /*
1016 * Don't notice the error to the upper layer yet. 1017 * Don't notice the error to the upper layer yet.
1017 * The error handling decision is made by the target driver, 1018 * The error handling decision is made by the target driver,
1018 * when the request is completed. 1019 * when the request is completed.
1019 */ 1020 */
1020 tio->error = bio->bi_error; 1021 tio->error = error;
1021 return; 1022 return;
1022 } 1023 }
1023 1024
@@ -2837,8 +2838,6 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
2837 2838
2838 might_sleep(); 2839 might_sleep();
2839 2840
2840 map = dm_get_live_table(md, &srcu_idx);
2841
2842 spin_lock(&_minor_lock); 2841 spin_lock(&_minor_lock);
2843 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); 2842 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md))));
2844 set_bit(DMF_FREEING, &md->flags); 2843 set_bit(DMF_FREEING, &md->flags);
@@ -2852,14 +2851,14 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
2852 * do not race with internal suspend. 2851 * do not race with internal suspend.
2853 */ 2852 */
2854 mutex_lock(&md->suspend_lock); 2853 mutex_lock(&md->suspend_lock);
2854 map = dm_get_live_table(md, &srcu_idx);
2855 if (!dm_suspended_md(md)) { 2855 if (!dm_suspended_md(md)) {
2856 dm_table_presuspend_targets(map); 2856 dm_table_presuspend_targets(map);
2857 dm_table_postsuspend_targets(map); 2857 dm_table_postsuspend_targets(map);
2858 } 2858 }
2859 mutex_unlock(&md->suspend_lock);
2860
2861 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ 2859 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */
2862 dm_put_live_table(md, srcu_idx); 2860 dm_put_live_table(md, srcu_idx);
2861 mutex_unlock(&md->suspend_lock);
2863 2862
2864 /* 2863 /*
2865 * Rare, but there may be I/O requests still going to complete, 2864 * Rare, but there may be I/O requests still going to complete,
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 049df6c4a8cc..ddd8a5f572aa 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2382,8 +2382,8 @@ static void raid1d(struct md_thread *thread)
2382 } 2382 }
2383 spin_unlock_irqrestore(&conf->device_lock, flags); 2383 spin_unlock_irqrestore(&conf->device_lock, flags);
2384 while (!list_empty(&tmp)) { 2384 while (!list_empty(&tmp)) {
2385 r1_bio = list_first_entry(&conf->bio_end_io_list, 2385 r1_bio = list_first_entry(&tmp, struct r1bio,
2386 struct r1bio, retry_list); 2386 retry_list);
2387 list_del(&r1_bio->retry_list); 2387 list_del(&r1_bio->retry_list);
2388 raid_end_bio_io(r1_bio); 2388 raid_end_bio_io(r1_bio);
2389 } 2389 }
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 7c99a4037715..9f69dc526f8c 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2688,8 +2688,8 @@ static void raid10d(struct md_thread *thread)
2688 } 2688 }
2689 spin_unlock_irqrestore(&conf->device_lock, flags); 2689 spin_unlock_irqrestore(&conf->device_lock, flags);
2690 while (!list_empty(&tmp)) { 2690 while (!list_empty(&tmp)) {
2691 r10_bio = list_first_entry(&conf->bio_end_io_list, 2691 r10_bio = list_first_entry(&tmp, struct r10bio,
2692 struct r10bio, retry_list); 2692 retry_list);
2693 list_del(&r10_bio->retry_list); 2693 list_del(&r10_bio->retry_list);
2694 raid_end_bio_io(r10_bio); 2694 raid_end_bio_io(r10_bio);
2695 } 2695 }
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h
index f28cb28a62f8..2c7f8d7c0595 100644
--- a/drivers/mfd/intel-lpss.h
+++ b/drivers/mfd/intel-lpss.h
@@ -42,6 +42,8 @@ int intel_lpss_resume(struct device *dev);
42 .thaw = intel_lpss_resume, \ 42 .thaw = intel_lpss_resume, \
43 .poweroff = intel_lpss_suspend, \ 43 .poweroff = intel_lpss_suspend, \
44 .restore = intel_lpss_resume, 44 .restore = intel_lpss_resume,
45#else
46#define INTEL_LPSS_SLEEP_PM_OPS
45#endif 47#endif
46 48
47#define INTEL_LPSS_RUNTIME_PM_OPS \ 49#define INTEL_LPSS_RUNTIME_PM_OPS \
diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
index c52162ea3d0a..586098f1b233 100644
--- a/drivers/mfd/max77843.c
+++ b/drivers/mfd/max77843.c
@@ -80,7 +80,7 @@ static int max77843_chg_init(struct max77693_dev *max77843)
80 if (!max77843->i2c_chg) { 80 if (!max77843->i2c_chg) {
81 dev_err(&max77843->i2c->dev, 81 dev_err(&max77843->i2c->dev,
82 "Cannot allocate I2C device for Charger\n"); 82 "Cannot allocate I2C device for Charger\n");
83 return PTR_ERR(max77843->i2c_chg); 83 return -ENODEV;
84 } 84 }
85 i2c_set_clientdata(max77843->i2c_chg, max77843); 85 i2c_set_clientdata(max77843->i2c_chg, max77843);
86 86
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 8af12c884b04..103baf0e0c5b 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -105,6 +105,7 @@ EXPORT_SYMBOL_GPL(cxl_allocate_afu_irqs);
105 105
106void cxl_free_afu_irqs(struct cxl_context *ctx) 106void cxl_free_afu_irqs(struct cxl_context *ctx)
107{ 107{
108 afu_irq_name_free(ctx);
108 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter); 109 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter);
109} 110}
110EXPORT_SYMBOL_GPL(cxl_free_afu_irqs); 111EXPORT_SYMBOL_GPL(cxl_free_afu_irqs);
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index e762f85ee233..2faa1270d085 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/misc/cxl/context.c
@@ -275,6 +275,9 @@ static void reclaim_ctx(struct rcu_head *rcu)
275 if (ctx->kernelapi) 275 if (ctx->kernelapi)
276 kfree(ctx->mapping); 276 kfree(ctx->mapping);
277 277
278 if (ctx->irq_bitmap)
279 kfree(ctx->irq_bitmap);
280
278 kfree(ctx); 281 kfree(ctx);
279} 282}
280 283
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index 1c30ef77073d..0cfb9c129f27 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -677,6 +677,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu);
677void cxl_release_serr_irq(struct cxl_afu *afu); 677void cxl_release_serr_irq(struct cxl_afu *afu);
678int afu_register_irqs(struct cxl_context *ctx, u32 count); 678int afu_register_irqs(struct cxl_context *ctx, u32 count);
679void afu_release_irqs(struct cxl_context *ctx, void *cookie); 679void afu_release_irqs(struct cxl_context *ctx, void *cookie);
680void afu_irq_name_free(struct cxl_context *ctx);
680irqreturn_t cxl_slice_irq_err(int irq, void *data); 681irqreturn_t cxl_slice_irq_err(int irq, void *data);
681 682
682int cxl_debugfs_init(void); 683int cxl_debugfs_init(void);
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index a30bf285b5bd..7ccd2998be92 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -120,9 +120,16 @@ int afu_release(struct inode *inode, struct file *file)
120 __func__, ctx->pe); 120 __func__, ctx->pe);
121 cxl_context_detach(ctx); 121 cxl_context_detach(ctx);
122 122
123 mutex_lock(&ctx->mapping_lock); 123
124 ctx->mapping = NULL; 124 /*
125 mutex_unlock(&ctx->mapping_lock); 125 * Delete the context's mapping pointer, unless it's created by the
126 * kernel API, in which case leave it so it can be freed by reclaim_ctx()
127 */
128 if (!ctx->kernelapi) {
129 mutex_lock(&ctx->mapping_lock);
130 ctx->mapping = NULL;
131 mutex_unlock(&ctx->mapping_lock);
132 }
126 133
127 put_device(&ctx->afu->dev); 134 put_device(&ctx->afu->dev);
128 135
diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index 583b42afeda2..09a406058c46 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -414,7 +414,7 @@ void cxl_release_psl_irq(struct cxl_afu *afu)
414 kfree(afu->psl_irq_name); 414 kfree(afu->psl_irq_name);
415} 415}
416 416
417static void afu_irq_name_free(struct cxl_context *ctx) 417void afu_irq_name_free(struct cxl_context *ctx)
418{ 418{
419 struct cxl_irq_name *irq_name, *tmp; 419 struct cxl_irq_name *irq_name, *tmp;
420 420
@@ -524,7 +524,5 @@ void afu_release_irqs(struct cxl_context *ctx, void *cookie)
524 afu_irq_name_free(ctx); 524 afu_irq_name_free(ctx);
525 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter); 525 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter);
526 526
527 kfree(ctx->irq_bitmap);
528 ctx->irq_bitmap = NULL;
529 ctx->irq_count = 0; 527 ctx->irq_count = 0;
530} 528}
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c
index b37f2e8004f5..d2e75c88f4d2 100644
--- a/drivers/misc/cxl/native.c
+++ b/drivers/misc/cxl/native.c
@@ -457,6 +457,7 @@ static int activate_afu_directed(struct cxl_afu *afu)
457 457
458 dev_info(&afu->dev, "Activating AFU directed mode\n"); 458 dev_info(&afu->dev, "Activating AFU directed mode\n");
459 459
460 afu->num_procs = afu->max_procs_virtualised;
460 if (afu->spa == NULL) { 461 if (afu->spa == NULL) {
461 if (cxl_alloc_spa(afu)) 462 if (cxl_alloc_spa(afu))
462 return -ENOMEM; 463 return -ENOMEM;
@@ -468,7 +469,6 @@ static int activate_afu_directed(struct cxl_afu *afu)
468 cxl_p1n_write(afu, CXL_PSL_ID_An, CXL_PSL_ID_An_F | CXL_PSL_ID_An_L); 469 cxl_p1n_write(afu, CXL_PSL_ID_An, CXL_PSL_ID_An_F | CXL_PSL_ID_An_L);
469 470
470 afu->current_mode = CXL_MODE_DIRECTED; 471 afu->current_mode = CXL_MODE_DIRECTED;
471 afu->num_procs = afu->max_procs_virtualised;
472 472
473 if ((rc = cxl_chardev_m_afu_add(afu))) 473 if ((rc = cxl_chardev_m_afu_add(afu)))
474 return rc; 474 return rc;
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index a5e977192b61..85761d7eb333 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -1035,6 +1035,32 @@ static int cxl_read_vsec(struct cxl *adapter, struct pci_dev *dev)
1035 return 0; 1035 return 0;
1036} 1036}
1037 1037
1038/*
1039 * Workaround a PCIe Host Bridge defect on some cards, that can cause
1040 * malformed Transaction Layer Packet (TLP) errors to be erroneously
1041 * reported. Mask this error in the Uncorrectable Error Mask Register.
1042 *
1043 * The upper nibble of the PSL revision is used to distinguish between
1044 * different cards. The affected ones have it set to 0.
1045 */
1046static void cxl_fixup_malformed_tlp(struct cxl *adapter, struct pci_dev *dev)
1047{
1048 int aer;
1049 u32 data;
1050
1051 if (adapter->psl_rev & 0xf000)
1052 return;
1053 if (!(aer = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR)))
1054 return;
1055 pci_read_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, &data);
1056 if (data & PCI_ERR_UNC_MALF_TLP)
1057 if (data & PCI_ERR_UNC_INTN)
1058 return;
1059 data |= PCI_ERR_UNC_MALF_TLP;
1060 data |= PCI_ERR_UNC_INTN;
1061 pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, data);
1062}
1063
1038static int cxl_vsec_looks_ok(struct cxl *adapter, struct pci_dev *dev) 1064static int cxl_vsec_looks_ok(struct cxl *adapter, struct pci_dev *dev)
1039{ 1065{
1040 if (adapter->vsec_status & CXL_STATUS_SECOND_PORT) 1066 if (adapter->vsec_status & CXL_STATUS_SECOND_PORT)
@@ -1134,6 +1160,8 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
1134 if ((rc = cxl_vsec_looks_ok(adapter, dev))) 1160 if ((rc = cxl_vsec_looks_ok(adapter, dev)))
1135 return rc; 1161 return rc;
1136 1162
1163 cxl_fixup_malformed_tlp(adapter, dev);
1164
1137 if ((rc = setup_cxl_bars(dev))) 1165 if ((rc = setup_cxl_bars(dev)))
1138 return rc; 1166 return rc;
1139 1167
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index 8eec887c8f70..6d7c188fb65c 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -1209,7 +1209,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
1209 * after the host receives the enum_resp 1209 * after the host receives the enum_resp
1210 * message clients may be added or removed 1210 * message clients may be added or removed
1211 */ 1211 */
1212 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS && 1212 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS ||
1213 dev->hbm_state >= MEI_HBM_STOPPED) { 1213 dev->hbm_state >= MEI_HBM_STOPPED) {
1214 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n", 1214 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n",
1215 dev->dev_state, dev->hbm_state); 1215 dev->dev_state, dev->hbm_state);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 781e4db31767..7fb0753abe30 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -182,6 +182,7 @@ struct omap_hsmmc_host {
182 struct clk *fclk; 182 struct clk *fclk;
183 struct clk *dbclk; 183 struct clk *dbclk;
184 struct regulator *pbias; 184 struct regulator *pbias;
185 bool pbias_enabled;
185 void __iomem *base; 186 void __iomem *base;
186 int vqmmc_enabled; 187 int vqmmc_enabled;
187 resource_size_t mapbase; 188 resource_size_t mapbase;
@@ -328,20 +329,22 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
328 return ret; 329 return ret;
329 } 330 }
330 331
331 if (!regulator_is_enabled(host->pbias)) { 332 if (host->pbias_enabled == 0) {
332 ret = regulator_enable(host->pbias); 333 ret = regulator_enable(host->pbias);
333 if (ret) { 334 if (ret) {
334 dev_err(host->dev, "pbias reg enable fail\n"); 335 dev_err(host->dev, "pbias reg enable fail\n");
335 return ret; 336 return ret;
336 } 337 }
338 host->pbias_enabled = 1;
337 } 339 }
338 } else { 340 } else {
339 if (regulator_is_enabled(host->pbias)) { 341 if (host->pbias_enabled == 1) {
340 ret = regulator_disable(host->pbias); 342 ret = regulator_disable(host->pbias);
341 if (ret) { 343 if (ret) {
342 dev_err(host->dev, "pbias reg disable fail\n"); 344 dev_err(host->dev, "pbias reg disable fail\n");
343 return ret; 345 return ret;
344 } 346 }
347 host->pbias_enabled = 0;
345 } 348 }
346 } 349 }
347 350
@@ -475,7 +478,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
475 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc"); 478 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc");
476 if (IS_ERR(mmc->supply.vmmc)) { 479 if (IS_ERR(mmc->supply.vmmc)) {
477 ret = PTR_ERR(mmc->supply.vmmc); 480 ret = PTR_ERR(mmc->supply.vmmc);
478 if (ret != -ENODEV) 481 if ((ret != -ENODEV) && host->dev->of_node)
479 return ret; 482 return ret;
480 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", 483 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
481 PTR_ERR(mmc->supply.vmmc)); 484 PTR_ERR(mmc->supply.vmmc));
@@ -490,7 +493,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
490 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux"); 493 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux");
491 if (IS_ERR(mmc->supply.vqmmc)) { 494 if (IS_ERR(mmc->supply.vqmmc)) {
492 ret = PTR_ERR(mmc->supply.vqmmc); 495 ret = PTR_ERR(mmc->supply.vqmmc);
493 if (ret != -ENODEV) 496 if ((ret != -ENODEV) && host->dev->of_node)
494 return ret; 497 return ret;
495 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", 498 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
496 PTR_ERR(mmc->supply.vqmmc)); 499 PTR_ERR(mmc->supply.vqmmc));
@@ -500,7 +503,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
500 host->pbias = devm_regulator_get_optional(host->dev, "pbias"); 503 host->pbias = devm_regulator_get_optional(host->dev, "pbias");
501 if (IS_ERR(host->pbias)) { 504 if (IS_ERR(host->pbias)) {
502 ret = PTR_ERR(host->pbias); 505 ret = PTR_ERR(host->pbias);
503 if (ret != -ENODEV) 506 if ((ret != -ENODEV) && host->dev->of_node)
504 return ret; 507 return ret;
505 dev_dbg(host->dev, "unable to get pbias regulator %ld\n", 508 dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
506 PTR_ERR(host->pbias)); 509 PTR_ERR(host->pbias));
@@ -2053,6 +2056,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2053 host->base = base + pdata->reg_offset; 2056 host->base = base + pdata->reg_offset;
2054 host->power_mode = MMC_POWER_OFF; 2057 host->power_mode = MMC_POWER_OFF;
2055 host->next_data.cookie = 1; 2058 host->next_data.cookie = 1;
2059 host->pbias_enabled = 0;
2056 host->vqmmc_enabled = 0; 2060 host->vqmmc_enabled = 0;
2057 2061
2058 ret = omap_hsmmc_gpio_init(mmc, host, pdata); 2062 ret = omap_hsmmc_gpio_init(mmc, host, pdata);
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index d1556643a41d..a0f05de5409f 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -43,6 +43,7 @@ static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
43 43
44static const struct sdhci_pltfm_data soc_data_sama5d2 = { 44static const struct sdhci_pltfm_data soc_data_sama5d2 = {
45 .ops = &sdhci_at91_sama5d2_ops, 45 .ops = &sdhci_at91_sama5d2_ops,
46 .quirks2 = SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST,
46}; 47};
47 48
48static const struct of_device_id sdhci_at91_dt_match[] = { 49static const struct of_device_id sdhci_at91_dt_match[] = {
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 946d37f94a31..f5edf9d3a18a 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -135,6 +135,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
135 struct sdhci_pxa *pxa = pltfm_host->priv; 135 struct sdhci_pxa *pxa = pltfm_host->priv;
136 struct resource *res; 136 struct resource *res;
137 137
138 host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
138 host->quirks |= SDHCI_QUIRK_MISSING_CAPS; 139 host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
139 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 140 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
140 "conf-sdio3"); 141 "conf-sdio3");
@@ -290,6 +291,9 @@ static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
290 uhs == MMC_TIMING_UHS_DDR50) { 291 uhs == MMC_TIMING_UHS_DDR50) {
291 reg_val &= ~SDIO3_CONF_CLK_INV; 292 reg_val &= ~SDIO3_CONF_CLK_INV;
292 reg_val |= SDIO3_CONF_SD_FB_CLK; 293 reg_val |= SDIO3_CONF_SD_FB_CLK;
294 } else if (uhs == MMC_TIMING_MMC_HS) {
295 reg_val &= ~SDIO3_CONF_CLK_INV;
296 reg_val &= ~SDIO3_CONF_SD_FB_CLK;
293 } else { 297 } else {
294 reg_val |= SDIO3_CONF_CLK_INV; 298 reg_val |= SDIO3_CONF_CLK_INV;
295 reg_val &= ~SDIO3_CONF_SD_FB_CLK; 299 reg_val &= ~SDIO3_CONF_SD_FB_CLK;
@@ -398,7 +402,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
398 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { 402 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
399 ret = armada_38x_quirks(pdev, host); 403 ret = armada_38x_quirks(pdev, host);
400 if (ret < 0) 404 if (ret < 0)
401 goto err_clk_get; 405 goto err_mbus_win;
402 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); 406 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
403 if (ret < 0) 407 if (ret < 0)
404 goto err_mbus_win; 408 goto err_mbus_win;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 64b7fdbd1a9c..fbc7efdddcb5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1160,6 +1160,8 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1160 host->mmc->actual_clock = 0; 1160 host->mmc->actual_clock = 0;
1161 1161
1162 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); 1162 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
1163 if (host->quirks2 & SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST)
1164 mdelay(1);
1163 1165
1164 if (clock == 0) 1166 if (clock == 0)
1165 return; 1167 return;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 7c02ff46c8ac..9d4aa31b683a 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -412,6 +412,11 @@ struct sdhci_host {
412#define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) 412#define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14)
413/* Broken Clock divider zero in controller */ 413/* Broken Clock divider zero in controller */
414#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15) 414#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15)
415/*
416 * When internal clock is disabled, a delay is needed before modifying the
417 * SD clock frequency or enabling back the internal clock.
418 */
419#define SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST (1<<16)
415 420
416 int irq; /* Device IRQ */ 421 int irq; /* Device IRQ */
417 void __iomem *ioaddr; /* Mapped address */ 422 void __iomem *ioaddr; /* Mapped address */
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 2426db88db36..f04445b992f5 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -879,7 +879,7 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom)
879 oob_chunk_size); 879 oob_chunk_size);
880 880
881 /* the last chunk */ 881 /* the last chunk */
882 memcpy16_toio(&s[oob_chunk_size * sparebuf_size], 882 memcpy16_toio(&s[i * sparebuf_size],
883 &d[i * oob_chunk_size], 883 &d[i * oob_chunk_size],
884 host->used_oobsize - i * oob_chunk_size); 884 host->used_oobsize - i * oob_chunk_size);
885 } 885 }
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index f97a58d6aae1..e7d333c162be 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -147,6 +147,10 @@
147#define NFC_ECC_MODE GENMASK(15, 12) 147#define NFC_ECC_MODE GENMASK(15, 12)
148#define NFC_RANDOM_SEED GENMASK(30, 16) 148#define NFC_RANDOM_SEED GENMASK(30, 16)
149 149
150/* NFC_USER_DATA helper macros */
151#define NFC_BUF_TO_USER_DATA(buf) ((buf)[0] | ((buf)[1] << 8) | \
152 ((buf)[2] << 16) | ((buf)[3] << 24))
153
150#define NFC_DEFAULT_TIMEOUT_MS 1000 154#define NFC_DEFAULT_TIMEOUT_MS 1000
151 155
152#define NFC_SRAM_SIZE 1024 156#define NFC_SRAM_SIZE 1024
@@ -646,15 +650,9 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
646 offset = layout->eccpos[i * ecc->bytes] - 4 + mtd->writesize; 650 offset = layout->eccpos[i * ecc->bytes] - 4 + mtd->writesize;
647 651
648 /* Fill OOB data in */ 652 /* Fill OOB data in */
649 if (oob_required) { 653 writel(NFC_BUF_TO_USER_DATA(chip->oob_poi +
650 tmp = 0xffffffff; 654 layout->oobfree[i].offset),
651 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, &tmp, 655 nfc->regs + NFC_REG_USER_DATA_BASE);
652 4);
653 } else {
654 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE,
655 chip->oob_poi + offset - mtd->writesize,
656 4);
657 }
658 656
659 chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1); 657 chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1);
660 658
@@ -784,14 +782,8 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
784 offset += ecc->size; 782 offset += ecc->size;
785 783
786 /* Fill OOB data in */ 784 /* Fill OOB data in */
787 if (oob_required) { 785 writel(NFC_BUF_TO_USER_DATA(oob),
788 tmp = 0xffffffff; 786 nfc->regs + NFC_REG_USER_DATA_BASE);
789 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, &tmp,
790 4);
791 } else {
792 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, oob,
793 4);
794 }
795 787
796 tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ACCESS_DIR | 788 tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ACCESS_DIR |
797 (1 << 30); 789 (1 << 30);
@@ -1389,6 +1381,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
1389 node); 1381 node);
1390 nand_release(&chip->mtd); 1382 nand_release(&chip->mtd);
1391 sunxi_nand_ecc_cleanup(&chip->nand.ecc); 1383 sunxi_nand_ecc_cleanup(&chip->nand.ecc);
1384 list_del(&chip->node);
1392 } 1385 }
1393} 1386}
1394 1387
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index d3c6676b3c0c..6fd4e5a5ef4a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -67,7 +67,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
67 int rc; 67 int rc;
68 68
69 /* Stop the user from reading */ 69 /* Stop the user from reading */
70 if (pos > nvmem->size) 70 if (pos >= nvmem->size)
71 return 0; 71 return 0;
72 72
73 if (pos + count > nvmem->size) 73 if (pos + count > nvmem->size)
@@ -92,7 +92,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
92 int rc; 92 int rc;
93 93
94 /* Stop the user from writing */ 94 /* Stop the user from writing */
95 if (pos > nvmem->size) 95 if (pos >= nvmem->size)
96 return 0; 96 return 0;
97 97
98 if (pos + count > nvmem->size) 98 if (pos + count > nvmem->size)
@@ -825,7 +825,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
825 return rc; 825 return rc;
826 826
827 /* shift bits in-place */ 827 /* shift bits in-place */
828 if (cell->bit_offset || cell->bit_offset) 828 if (cell->bit_offset || cell->nbits)
829 nvmem_shift_read_buffer_in_place(cell, buf); 829 nvmem_shift_read_buffer_in_place(cell, buf);
830 830
831 *len = cell->bytes; 831 *len = cell->bytes;
@@ -938,7 +938,7 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len)
938 rc = regmap_raw_write(nvmem->regmap, cell->offset, buf, cell->bytes); 938 rc = regmap_raw_write(nvmem->regmap, cell->offset, buf, cell->bytes);
939 939
940 /* free the tmp buffer */ 940 /* free the tmp buffer */
941 if (cell->bit_offset) 941 if (cell->bit_offset || cell->nbits)
942 kfree(buf); 942 kfree(buf);
943 943
944 if (IS_ERR_VALUE(rc)) 944 if (IS_ERR_VALUE(rc))
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 14777dd5212d..cfa3b85064dd 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -103,7 +103,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
103 struct nvmem_device *nvmem; 103 struct nvmem_device *nvmem;
104 struct regmap *regmap; 104 struct regmap *regmap;
105 struct sunxi_sid *sid; 105 struct sunxi_sid *sid;
106 int i, size; 106 int ret, i, size;
107 char *randomness; 107 char *randomness;
108 108
109 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL); 109 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL);
@@ -131,6 +131,11 @@ static int sunxi_sid_probe(struct platform_device *pdev)
131 return PTR_ERR(nvmem); 131 return PTR_ERR(nvmem);
132 132
133 randomness = kzalloc(sizeof(u8) * size, GFP_KERNEL); 133 randomness = kzalloc(sizeof(u8) * size, GFP_KERNEL);
134 if (!randomness) {
135 ret = -EINVAL;
136 goto err_unreg_nvmem;
137 }
138
134 for (i = 0; i < size; i++) 139 for (i = 0; i < size; i++)
135 randomness[i] = sunxi_sid_read_byte(sid, i); 140 randomness[i] = sunxi_sid_read_byte(sid, i);
136 141
@@ -140,6 +145,10 @@ static int sunxi_sid_probe(struct platform_device *pdev)
140 platform_set_drvdata(pdev, nvmem); 145 platform_set_drvdata(pdev, nvmem);
141 146
142 return 0; 147 return 0;
148
149err_unreg_nvmem:
150 nvmem_unregister(nvmem);
151 return ret;
143} 152}
144 153
145static int sunxi_sid_remove(struct platform_device *pdev) 154static int sunxi_sid_remove(struct platform_device *pdev)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d4497141d083..4a7da3c3e035 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1243,6 +1243,10 @@ static void pci_msi_domain_update_chip_ops(struct msi_domain_info *info)
1243 BUG_ON(!chip); 1243 BUG_ON(!chip);
1244 if (!chip->irq_write_msi_msg) 1244 if (!chip->irq_write_msi_msg)
1245 chip->irq_write_msi_msg = pci_msi_domain_write_msg; 1245 chip->irq_write_msi_msg = pci_msi_domain_write_msg;
1246 if (!chip->irq_mask)
1247 chip->irq_mask = pci_msi_mask_irq;
1248 if (!chip->irq_unmask)
1249 chip->irq_unmask = pci_msi_unmask_irq;
1246} 1250}
1247 1251
1248/** 1252/**
diff --git a/drivers/phy/phy-berlin-sata.c b/drivers/phy/phy-berlin-sata.c
index 0062027afb1e..77a2e054fdea 100644
--- a/drivers/phy/phy-berlin-sata.c
+++ b/drivers/phy/phy-berlin-sata.c
@@ -276,6 +276,7 @@ static const struct of_device_id phy_berlin_sata_of_match[] = {
276 { .compatible = "marvell,berlin2q-sata-phy" }, 276 { .compatible = "marvell,berlin2q-sata-phy" },
277 { }, 277 { },
278}; 278};
279MODULE_DEVICE_TABLE(of, phy_berlin_sata_of_match);
279 280
280static struct platform_driver phy_berlin_sata_driver = { 281static struct platform_driver phy_berlin_sata_driver = {
281 .probe = phy_berlin_sata_probe, 282 .probe = phy_berlin_sata_probe,
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index 49a1ed0cef56..107cb57c3513 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -432,6 +432,7 @@ out_disable_src:
432out: 432out:
433 return ret; 433 return ret;
434} 434}
435EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_ref_clk);
435 436
436static 437static
437int ufs_qcom_phy_disable_vreg(struct phy *phy, 438int ufs_qcom_phy_disable_vreg(struct phy *phy,
@@ -474,6 +475,7 @@ void ufs_qcom_phy_disable_ref_clk(struct phy *generic_phy)
474 phy->is_ref_clk_enabled = false; 475 phy->is_ref_clk_enabled = false;
475 } 476 }
476} 477}
478EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_ref_clk);
477 479
478#define UFS_REF_CLK_EN (1 << 5) 480#define UFS_REF_CLK_EN (1 << 5)
479 481
@@ -517,11 +519,13 @@ void ufs_qcom_phy_enable_dev_ref_clk(struct phy *generic_phy)
517{ 519{
518 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true); 520 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
519} 521}
522EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
520 523
521void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy) 524void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
522{ 525{
523 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false); 526 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
524} 527}
528EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
525 529
526/* Turn ON M-PHY RMMI interface clocks */ 530/* Turn ON M-PHY RMMI interface clocks */
527int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy) 531int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
@@ -550,6 +554,7 @@ int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
550out: 554out:
551 return ret; 555 return ret;
552} 556}
557EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_iface_clk);
553 558
554/* Turn OFF M-PHY RMMI interface clocks */ 559/* Turn OFF M-PHY RMMI interface clocks */
555void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy) 560void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
@@ -562,6 +567,7 @@ void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
562 phy->is_iface_clk_enabled = false; 567 phy->is_iface_clk_enabled = false;
563 } 568 }
564} 569}
570EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_iface_clk);
565 571
566int ufs_qcom_phy_start_serdes(struct phy *generic_phy) 572int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
567{ 573{
@@ -578,6 +584,7 @@ int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
578 584
579 return ret; 585 return ret;
580} 586}
587EXPORT_SYMBOL_GPL(ufs_qcom_phy_start_serdes);
581 588
582int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes) 589int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
583{ 590{
@@ -595,6 +602,7 @@ int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
595 602
596 return ret; 603 return ret;
597} 604}
605EXPORT_SYMBOL_GPL(ufs_qcom_phy_set_tx_lane_enable);
598 606
599void ufs_qcom_phy_save_controller_version(struct phy *generic_phy, 607void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
600 u8 major, u16 minor, u16 step) 608 u8 major, u16 minor, u16 step)
@@ -605,6 +613,7 @@ void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
605 ufs_qcom_phy->host_ctrl_rev_minor = minor; 613 ufs_qcom_phy->host_ctrl_rev_minor = minor;
606 ufs_qcom_phy->host_ctrl_rev_step = step; 614 ufs_qcom_phy->host_ctrl_rev_step = step;
607} 615}
616EXPORT_SYMBOL_GPL(ufs_qcom_phy_save_controller_version);
608 617
609int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B) 618int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
610{ 619{
@@ -625,6 +634,7 @@ int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
625 634
626 return ret; 635 return ret;
627} 636}
637EXPORT_SYMBOL_GPL(ufs_qcom_phy_calibrate_phy);
628 638
629int ufs_qcom_phy_remove(struct phy *generic_phy, 639int ufs_qcom_phy_remove(struct phy *generic_phy,
630 struct ufs_qcom_phy *ufs_qcom_phy) 640 struct ufs_qcom_phy *ufs_qcom_phy)
@@ -662,6 +672,7 @@ int ufs_qcom_phy_is_pcs_ready(struct phy *generic_phy)
662 return ufs_qcom_phy->phy_spec_ops-> 672 return ufs_qcom_phy->phy_spec_ops->
663 is_physical_coding_sublayer_ready(ufs_qcom_phy); 673 is_physical_coding_sublayer_ready(ufs_qcom_phy);
664} 674}
675EXPORT_SYMBOL_GPL(ufs_qcom_phy_is_pcs_ready);
665 676
666int ufs_qcom_phy_power_on(struct phy *generic_phy) 677int ufs_qcom_phy_power_on(struct phy *generic_phy)
667{ 678{
diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
index 5a5c073e72fe..91d6f342c565 100644
--- a/drivers/phy/phy-rockchip-usb.c
+++ b/drivers/phy/phy-rockchip-usb.c
@@ -98,6 +98,7 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
98 struct device_node *child; 98 struct device_node *child;
99 struct regmap *grf; 99 struct regmap *grf;
100 unsigned int reg_offset; 100 unsigned int reg_offset;
101 int err;
101 102
102 grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); 103 grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
103 if (IS_ERR(grf)) { 104 if (IS_ERR(grf)) {
@@ -129,6 +130,11 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
129 return PTR_ERR(rk_phy->phy); 130 return PTR_ERR(rk_phy->phy);
130 } 131 }
131 phy_set_drvdata(rk_phy->phy, rk_phy); 132 phy_set_drvdata(rk_phy->phy, rk_phy);
133
134 /* only power up usb phy when it use, so disable it when init*/
135 err = rockchip_usb_phy_power(rk_phy, 1);
136 if (err)
137 return err;
132 } 138 }
133 139
134 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 140 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
diff --git a/drivers/pinctrl/freescale/pinctrl-imx25.c b/drivers/pinctrl/freescale/pinctrl-imx25.c
index faf635654312..293ed4381cc0 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx25.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx25.c
@@ -26,7 +26,8 @@
26#include "pinctrl-imx.h" 26#include "pinctrl-imx.h"
27 27
28enum imx25_pads { 28enum imx25_pads {
29 MX25_PAD_RESERVE0 = 1, 29 MX25_PAD_RESERVE0 = 0,
30 MX25_PAD_RESERVE1 = 1,
30 MX25_PAD_A10 = 2, 31 MX25_PAD_A10 = 2,
31 MX25_PAD_A13 = 3, 32 MX25_PAD_A13 = 3,
32 MX25_PAD_A14 = 4, 33 MX25_PAD_A14 = 4,
@@ -169,6 +170,7 @@ enum imx25_pads {
169/* Pad names for the pinmux subsystem */ 170/* Pad names for the pinmux subsystem */
170static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = { 171static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = {
171 IMX_PINCTRL_PIN(MX25_PAD_RESERVE0), 172 IMX_PINCTRL_PIN(MX25_PAD_RESERVE0),
173 IMX_PINCTRL_PIN(MX25_PAD_RESERVE1),
172 IMX_PINCTRL_PIN(MX25_PAD_A10), 174 IMX_PINCTRL_PIN(MX25_PAD_A10),
173 IMX_PINCTRL_PIN(MX25_PAD_A13), 175 IMX_PINCTRL_PIN(MX25_PAD_A13),
174 IMX_PINCTRL_PIN(MX25_PAD_A14), 176 IMX_PINCTRL_PIN(MX25_PAD_A14),
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c b/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c
index 63676617bc59..f9a3f8f446f7 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c
@@ -653,7 +653,7 @@ static const struct sunxi_desc_pin sun5i_a10s_pins[] = {
653 SUNXI_FUNCTION(0x0, "gpio_in"), 653 SUNXI_FUNCTION(0x0, "gpio_in"),
654 SUNXI_FUNCTION(0x1, "gpio_out"), 654 SUNXI_FUNCTION(0x1, "gpio_out"),
655 SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */ 655 SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */
656 SUNXI_FUNCTION(0x3, "uart3"), /* PWM1 */ 656 SUNXI_FUNCTION(0x3, "pwm"), /* PWM1 */
657 SUNXI_FUNCTION(0x5, "uart2"), /* CTS */ 657 SUNXI_FUNCTION(0x5, "uart2"), /* CTS */
658 SUNXI_FUNCTION_IRQ(0x6, 13)), /* EINT13 */ 658 SUNXI_FUNCTION_IRQ(0x6, 13)), /* EINT13 */
659}; 659};
diff --git a/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c b/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
index 7e9dae54fcb2..2df8bbecebfc 100644
--- a/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
+++ b/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
@@ -22,49 +22,49 @@
22#define DRIVER_NAME "ph1-sld8-pinctrl" 22#define DRIVER_NAME "ph1-sld8-pinctrl"
23 23
24static const struct pinctrl_pin_desc ph1_sld8_pins[] = { 24static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
25 UNIPHIER_PINCTRL_PIN(0, "PCA00", UNIPHIER_PIN_IECTRL_NONE, 25 UNIPHIER_PINCTRL_PIN(0, "PCA00", 0,
26 15, UNIPHIER_PIN_DRV_4_8, 26 15, UNIPHIER_PIN_DRV_4_8,
27 15, UNIPHIER_PIN_PULL_DOWN), 27 15, UNIPHIER_PIN_PULL_DOWN),
28 UNIPHIER_PINCTRL_PIN(1, "PCA01", UNIPHIER_PIN_IECTRL_NONE, 28 UNIPHIER_PINCTRL_PIN(1, "PCA01", 0,
29 16, UNIPHIER_PIN_DRV_4_8, 29 16, UNIPHIER_PIN_DRV_4_8,
30 16, UNIPHIER_PIN_PULL_DOWN), 30 16, UNIPHIER_PIN_PULL_DOWN),
31 UNIPHIER_PINCTRL_PIN(2, "PCA02", UNIPHIER_PIN_IECTRL_NONE, 31 UNIPHIER_PINCTRL_PIN(2, "PCA02", 0,
32 17, UNIPHIER_PIN_DRV_4_8, 32 17, UNIPHIER_PIN_DRV_4_8,
33 17, UNIPHIER_PIN_PULL_DOWN), 33 17, UNIPHIER_PIN_PULL_DOWN),
34 UNIPHIER_PINCTRL_PIN(3, "PCA03", UNIPHIER_PIN_IECTRL_NONE, 34 UNIPHIER_PINCTRL_PIN(3, "PCA03", 0,
35 18, UNIPHIER_PIN_DRV_4_8, 35 18, UNIPHIER_PIN_DRV_4_8,
36 18, UNIPHIER_PIN_PULL_DOWN), 36 18, UNIPHIER_PIN_PULL_DOWN),
37 UNIPHIER_PINCTRL_PIN(4, "PCA04", UNIPHIER_PIN_IECTRL_NONE, 37 UNIPHIER_PINCTRL_PIN(4, "PCA04", 0,
38 19, UNIPHIER_PIN_DRV_4_8, 38 19, UNIPHIER_PIN_DRV_4_8,
39 19, UNIPHIER_PIN_PULL_DOWN), 39 19, UNIPHIER_PIN_PULL_DOWN),
40 UNIPHIER_PINCTRL_PIN(5, "PCA05", UNIPHIER_PIN_IECTRL_NONE, 40 UNIPHIER_PINCTRL_PIN(5, "PCA05", 0,
41 20, UNIPHIER_PIN_DRV_4_8, 41 20, UNIPHIER_PIN_DRV_4_8,
42 20, UNIPHIER_PIN_PULL_DOWN), 42 20, UNIPHIER_PIN_PULL_DOWN),
43 UNIPHIER_PINCTRL_PIN(6, "PCA06", UNIPHIER_PIN_IECTRL_NONE, 43 UNIPHIER_PINCTRL_PIN(6, "PCA06", 0,
44 21, UNIPHIER_PIN_DRV_4_8, 44 21, UNIPHIER_PIN_DRV_4_8,
45 21, UNIPHIER_PIN_PULL_DOWN), 45 21, UNIPHIER_PIN_PULL_DOWN),
46 UNIPHIER_PINCTRL_PIN(7, "PCA07", UNIPHIER_PIN_IECTRL_NONE, 46 UNIPHIER_PINCTRL_PIN(7, "PCA07", 0,
47 22, UNIPHIER_PIN_DRV_4_8, 47 22, UNIPHIER_PIN_DRV_4_8,
48 22, UNIPHIER_PIN_PULL_DOWN), 48 22, UNIPHIER_PIN_PULL_DOWN),
49 UNIPHIER_PINCTRL_PIN(8, "PCA08", UNIPHIER_PIN_IECTRL_NONE, 49 UNIPHIER_PINCTRL_PIN(8, "PCA08", 0,
50 23, UNIPHIER_PIN_DRV_4_8, 50 23, UNIPHIER_PIN_DRV_4_8,
51 23, UNIPHIER_PIN_PULL_DOWN), 51 23, UNIPHIER_PIN_PULL_DOWN),
52 UNIPHIER_PINCTRL_PIN(9, "PCA09", UNIPHIER_PIN_IECTRL_NONE, 52 UNIPHIER_PINCTRL_PIN(9, "PCA09", 0,
53 24, UNIPHIER_PIN_DRV_4_8, 53 24, UNIPHIER_PIN_DRV_4_8,
54 24, UNIPHIER_PIN_PULL_DOWN), 54 24, UNIPHIER_PIN_PULL_DOWN),
55 UNIPHIER_PINCTRL_PIN(10, "PCA10", UNIPHIER_PIN_IECTRL_NONE, 55 UNIPHIER_PINCTRL_PIN(10, "PCA10", 0,
56 25, UNIPHIER_PIN_DRV_4_8, 56 25, UNIPHIER_PIN_DRV_4_8,
57 25, UNIPHIER_PIN_PULL_DOWN), 57 25, UNIPHIER_PIN_PULL_DOWN),
58 UNIPHIER_PINCTRL_PIN(11, "PCA11", UNIPHIER_PIN_IECTRL_NONE, 58 UNIPHIER_PINCTRL_PIN(11, "PCA11", 0,
59 26, UNIPHIER_PIN_DRV_4_8, 59 26, UNIPHIER_PIN_DRV_4_8,
60 26, UNIPHIER_PIN_PULL_DOWN), 60 26, UNIPHIER_PIN_PULL_DOWN),
61 UNIPHIER_PINCTRL_PIN(12, "PCA12", UNIPHIER_PIN_IECTRL_NONE, 61 UNIPHIER_PINCTRL_PIN(12, "PCA12", 0,
62 27, UNIPHIER_PIN_DRV_4_8, 62 27, UNIPHIER_PIN_DRV_4_8,
63 27, UNIPHIER_PIN_PULL_DOWN), 63 27, UNIPHIER_PIN_PULL_DOWN),
64 UNIPHIER_PINCTRL_PIN(13, "PCA13", UNIPHIER_PIN_IECTRL_NONE, 64 UNIPHIER_PINCTRL_PIN(13, "PCA13", 0,
65 28, UNIPHIER_PIN_DRV_4_8, 65 28, UNIPHIER_PIN_DRV_4_8,
66 28, UNIPHIER_PIN_PULL_DOWN), 66 28, UNIPHIER_PIN_PULL_DOWN),
67 UNIPHIER_PINCTRL_PIN(14, "PCA14", UNIPHIER_PIN_IECTRL_NONE, 67 UNIPHIER_PINCTRL_PIN(14, "PCA14", 0,
68 29, UNIPHIER_PIN_DRV_4_8, 68 29, UNIPHIER_PIN_DRV_4_8,
69 29, UNIPHIER_PIN_PULL_DOWN), 69 29, UNIPHIER_PIN_PULL_DOWN),
70 UNIPHIER_PINCTRL_PIN(15, "XNFRE_GB", UNIPHIER_PIN_IECTRL_NONE, 70 UNIPHIER_PINCTRL_PIN(15, "XNFRE_GB", UNIPHIER_PIN_IECTRL_NONE,
@@ -118,199 +118,199 @@ static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
118 UNIPHIER_PINCTRL_PIN(31, "NFD7_GB", UNIPHIER_PIN_IECTRL_NONE, 118 UNIPHIER_PINCTRL_PIN(31, "NFD7_GB", UNIPHIER_PIN_IECTRL_NONE,
119 36, UNIPHIER_PIN_DRV_8_12_16_20, 119 36, UNIPHIER_PIN_DRV_8_12_16_20,
120 128, UNIPHIER_PIN_PULL_UP), 120 128, UNIPHIER_PIN_PULL_UP),
121 UNIPHIER_PINCTRL_PIN(32, "SDCLK", UNIPHIER_PIN_IECTRL_NONE, 121 UNIPHIER_PINCTRL_PIN(32, "SDCLK", 8,
122 40, UNIPHIER_PIN_DRV_8_12_16_20, 122 40, UNIPHIER_PIN_DRV_8_12_16_20,
123 -1, UNIPHIER_PIN_PULL_NONE), 123 -1, UNIPHIER_PIN_PULL_NONE),
124 UNIPHIER_PINCTRL_PIN(33, "SDCMD", UNIPHIER_PIN_IECTRL_NONE, 124 UNIPHIER_PINCTRL_PIN(33, "SDCMD", 8,
125 44, UNIPHIER_PIN_DRV_8_12_16_20, 125 44, UNIPHIER_PIN_DRV_8_12_16_20,
126 -1, UNIPHIER_PIN_PULL_NONE), 126 -1, UNIPHIER_PIN_PULL_NONE),
127 UNIPHIER_PINCTRL_PIN(34, "SDDAT0", UNIPHIER_PIN_IECTRL_NONE, 127 UNIPHIER_PINCTRL_PIN(34, "SDDAT0", 8,
128 48, UNIPHIER_PIN_DRV_8_12_16_20, 128 48, UNIPHIER_PIN_DRV_8_12_16_20,
129 -1, UNIPHIER_PIN_PULL_NONE), 129 -1, UNIPHIER_PIN_PULL_NONE),
130 UNIPHIER_PINCTRL_PIN(35, "SDDAT1", UNIPHIER_PIN_IECTRL_NONE, 130 UNIPHIER_PINCTRL_PIN(35, "SDDAT1", 8,
131 52, UNIPHIER_PIN_DRV_8_12_16_20, 131 52, UNIPHIER_PIN_DRV_8_12_16_20,
132 -1, UNIPHIER_PIN_PULL_NONE), 132 -1, UNIPHIER_PIN_PULL_NONE),
133 UNIPHIER_PINCTRL_PIN(36, "SDDAT2", UNIPHIER_PIN_IECTRL_NONE, 133 UNIPHIER_PINCTRL_PIN(36, "SDDAT2", 8,
134 56, UNIPHIER_PIN_DRV_8_12_16_20, 134 56, UNIPHIER_PIN_DRV_8_12_16_20,
135 -1, UNIPHIER_PIN_PULL_NONE), 135 -1, UNIPHIER_PIN_PULL_NONE),
136 UNIPHIER_PINCTRL_PIN(37, "SDDAT3", UNIPHIER_PIN_IECTRL_NONE, 136 UNIPHIER_PINCTRL_PIN(37, "SDDAT3", 8,
137 60, UNIPHIER_PIN_DRV_8_12_16_20, 137 60, UNIPHIER_PIN_DRV_8_12_16_20,
138 -1, UNIPHIER_PIN_PULL_NONE), 138 -1, UNIPHIER_PIN_PULL_NONE),
139 UNIPHIER_PINCTRL_PIN(38, "SDCD", UNIPHIER_PIN_IECTRL_NONE, 139 UNIPHIER_PINCTRL_PIN(38, "SDCD", 8,
140 -1, UNIPHIER_PIN_DRV_FIXED_4, 140 -1, UNIPHIER_PIN_DRV_FIXED_4,
141 129, UNIPHIER_PIN_PULL_DOWN), 141 129, UNIPHIER_PIN_PULL_DOWN),
142 UNIPHIER_PINCTRL_PIN(39, "SDWP", UNIPHIER_PIN_IECTRL_NONE, 142 UNIPHIER_PINCTRL_PIN(39, "SDWP", 8,
143 -1, UNIPHIER_PIN_DRV_FIXED_4, 143 -1, UNIPHIER_PIN_DRV_FIXED_4,
144 130, UNIPHIER_PIN_PULL_DOWN), 144 130, UNIPHIER_PIN_PULL_DOWN),
145 UNIPHIER_PINCTRL_PIN(40, "SDVOLC", UNIPHIER_PIN_IECTRL_NONE, 145 UNIPHIER_PINCTRL_PIN(40, "SDVOLC", 9,
146 -1, UNIPHIER_PIN_DRV_FIXED_4, 146 -1, UNIPHIER_PIN_DRV_FIXED_4,
147 131, UNIPHIER_PIN_PULL_DOWN), 147 131, UNIPHIER_PIN_PULL_DOWN),
148 UNIPHIER_PINCTRL_PIN(41, "USB0VBUS", UNIPHIER_PIN_IECTRL_NONE, 148 UNIPHIER_PINCTRL_PIN(41, "USB0VBUS", 0,
149 37, UNIPHIER_PIN_DRV_4_8, 149 37, UNIPHIER_PIN_DRV_4_8,
150 37, UNIPHIER_PIN_PULL_DOWN), 150 37, UNIPHIER_PIN_PULL_DOWN),
151 UNIPHIER_PINCTRL_PIN(42, "USB0OD", UNIPHIER_PIN_IECTRL_NONE, 151 UNIPHIER_PINCTRL_PIN(42, "USB0OD", 0,
152 38, UNIPHIER_PIN_DRV_4_8, 152 38, UNIPHIER_PIN_DRV_4_8,
153 38, UNIPHIER_PIN_PULL_DOWN), 153 38, UNIPHIER_PIN_PULL_DOWN),
154 UNIPHIER_PINCTRL_PIN(43, "USB1VBUS", UNIPHIER_PIN_IECTRL_NONE, 154 UNIPHIER_PINCTRL_PIN(43, "USB1VBUS", 0,
155 39, UNIPHIER_PIN_DRV_4_8, 155 39, UNIPHIER_PIN_DRV_4_8,
156 39, UNIPHIER_PIN_PULL_DOWN), 156 39, UNIPHIER_PIN_PULL_DOWN),
157 UNIPHIER_PINCTRL_PIN(44, "USB1OD", UNIPHIER_PIN_IECTRL_NONE, 157 UNIPHIER_PINCTRL_PIN(44, "USB1OD", 0,
158 40, UNIPHIER_PIN_DRV_4_8, 158 40, UNIPHIER_PIN_DRV_4_8,
159 40, UNIPHIER_PIN_PULL_DOWN), 159 40, UNIPHIER_PIN_PULL_DOWN),
160 UNIPHIER_PINCTRL_PIN(45, "PCRESET", UNIPHIER_PIN_IECTRL_NONE, 160 UNIPHIER_PINCTRL_PIN(45, "PCRESET", 0,
161 41, UNIPHIER_PIN_DRV_4_8, 161 41, UNIPHIER_PIN_DRV_4_8,
162 41, UNIPHIER_PIN_PULL_DOWN), 162 41, UNIPHIER_PIN_PULL_DOWN),
163 UNIPHIER_PINCTRL_PIN(46, "PCREG", UNIPHIER_PIN_IECTRL_NONE, 163 UNIPHIER_PINCTRL_PIN(46, "PCREG", 0,
164 42, UNIPHIER_PIN_DRV_4_8, 164 42, UNIPHIER_PIN_DRV_4_8,
165 42, UNIPHIER_PIN_PULL_DOWN), 165 42, UNIPHIER_PIN_PULL_DOWN),
166 UNIPHIER_PINCTRL_PIN(47, "PCCE2", UNIPHIER_PIN_IECTRL_NONE, 166 UNIPHIER_PINCTRL_PIN(47, "PCCE2", 0,
167 43, UNIPHIER_PIN_DRV_4_8, 167 43, UNIPHIER_PIN_DRV_4_8,
168 43, UNIPHIER_PIN_PULL_DOWN), 168 43, UNIPHIER_PIN_PULL_DOWN),
169 UNIPHIER_PINCTRL_PIN(48, "PCVS1", UNIPHIER_PIN_IECTRL_NONE, 169 UNIPHIER_PINCTRL_PIN(48, "PCVS1", 0,
170 44, UNIPHIER_PIN_DRV_4_8, 170 44, UNIPHIER_PIN_DRV_4_8,
171 44, UNIPHIER_PIN_PULL_DOWN), 171 44, UNIPHIER_PIN_PULL_DOWN),
172 UNIPHIER_PINCTRL_PIN(49, "PCCD2", UNIPHIER_PIN_IECTRL_NONE, 172 UNIPHIER_PINCTRL_PIN(49, "PCCD2", 0,
173 45, UNIPHIER_PIN_DRV_4_8, 173 45, UNIPHIER_PIN_DRV_4_8,
174 45, UNIPHIER_PIN_PULL_DOWN), 174 45, UNIPHIER_PIN_PULL_DOWN),
175 UNIPHIER_PINCTRL_PIN(50, "PCCD1", UNIPHIER_PIN_IECTRL_NONE, 175 UNIPHIER_PINCTRL_PIN(50, "PCCD1", 0,
176 46, UNIPHIER_PIN_DRV_4_8, 176 46, UNIPHIER_PIN_DRV_4_8,
177 46, UNIPHIER_PIN_PULL_DOWN), 177 46, UNIPHIER_PIN_PULL_DOWN),
178 UNIPHIER_PINCTRL_PIN(51, "PCREADY", UNIPHIER_PIN_IECTRL_NONE, 178 UNIPHIER_PINCTRL_PIN(51, "PCREADY", 0,
179 47, UNIPHIER_PIN_DRV_4_8, 179 47, UNIPHIER_PIN_DRV_4_8,
180 47, UNIPHIER_PIN_PULL_DOWN), 180 47, UNIPHIER_PIN_PULL_DOWN),
181 UNIPHIER_PINCTRL_PIN(52, "PCDOE", UNIPHIER_PIN_IECTRL_NONE, 181 UNIPHIER_PINCTRL_PIN(52, "PCDOE", 0,
182 48, UNIPHIER_PIN_DRV_4_8, 182 48, UNIPHIER_PIN_DRV_4_8,
183 48, UNIPHIER_PIN_PULL_DOWN), 183 48, UNIPHIER_PIN_PULL_DOWN),
184 UNIPHIER_PINCTRL_PIN(53, "PCCE1", UNIPHIER_PIN_IECTRL_NONE, 184 UNIPHIER_PINCTRL_PIN(53, "PCCE1", 0,
185 49, UNIPHIER_PIN_DRV_4_8, 185 49, UNIPHIER_PIN_DRV_4_8,
186 49, UNIPHIER_PIN_PULL_DOWN), 186 49, UNIPHIER_PIN_PULL_DOWN),
187 UNIPHIER_PINCTRL_PIN(54, "PCWE", UNIPHIER_PIN_IECTRL_NONE, 187 UNIPHIER_PINCTRL_PIN(54, "PCWE", 0,
188 50, UNIPHIER_PIN_DRV_4_8, 188 50, UNIPHIER_PIN_DRV_4_8,
189 50, UNIPHIER_PIN_PULL_DOWN), 189 50, UNIPHIER_PIN_PULL_DOWN),
190 UNIPHIER_PINCTRL_PIN(55, "PCOE", UNIPHIER_PIN_IECTRL_NONE, 190 UNIPHIER_PINCTRL_PIN(55, "PCOE", 0,
191 51, UNIPHIER_PIN_DRV_4_8, 191 51, UNIPHIER_PIN_DRV_4_8,
192 51, UNIPHIER_PIN_PULL_DOWN), 192 51, UNIPHIER_PIN_PULL_DOWN),
193 UNIPHIER_PINCTRL_PIN(56, "PCWAIT", UNIPHIER_PIN_IECTRL_NONE, 193 UNIPHIER_PINCTRL_PIN(56, "PCWAIT", 0,
194 52, UNIPHIER_PIN_DRV_4_8, 194 52, UNIPHIER_PIN_DRV_4_8,
195 52, UNIPHIER_PIN_PULL_DOWN), 195 52, UNIPHIER_PIN_PULL_DOWN),
196 UNIPHIER_PINCTRL_PIN(57, "PCIOWR", UNIPHIER_PIN_IECTRL_NONE, 196 UNIPHIER_PINCTRL_PIN(57, "PCIOWR", 0,
197 53, UNIPHIER_PIN_DRV_4_8, 197 53, UNIPHIER_PIN_DRV_4_8,
198 53, UNIPHIER_PIN_PULL_DOWN), 198 53, UNIPHIER_PIN_PULL_DOWN),
199 UNIPHIER_PINCTRL_PIN(58, "PCIORD", UNIPHIER_PIN_IECTRL_NONE, 199 UNIPHIER_PINCTRL_PIN(58, "PCIORD", 0,
200 54, UNIPHIER_PIN_DRV_4_8, 200 54, UNIPHIER_PIN_DRV_4_8,
201 54, UNIPHIER_PIN_PULL_DOWN), 201 54, UNIPHIER_PIN_PULL_DOWN),
202 UNIPHIER_PINCTRL_PIN(59, "HS0DIN0", UNIPHIER_PIN_IECTRL_NONE, 202 UNIPHIER_PINCTRL_PIN(59, "HS0DIN0", 0,
203 55, UNIPHIER_PIN_DRV_4_8, 203 55, UNIPHIER_PIN_DRV_4_8,
204 55, UNIPHIER_PIN_PULL_DOWN), 204 55, UNIPHIER_PIN_PULL_DOWN),
205 UNIPHIER_PINCTRL_PIN(60, "HS0DIN1", UNIPHIER_PIN_IECTRL_NONE, 205 UNIPHIER_PINCTRL_PIN(60, "HS0DIN1", 0,
206 56, UNIPHIER_PIN_DRV_4_8, 206 56, UNIPHIER_PIN_DRV_4_8,
207 56, UNIPHIER_PIN_PULL_DOWN), 207 56, UNIPHIER_PIN_PULL_DOWN),
208 UNIPHIER_PINCTRL_PIN(61, "HS0DIN2", UNIPHIER_PIN_IECTRL_NONE, 208 UNIPHIER_PINCTRL_PIN(61, "HS0DIN2", 0,
209 57, UNIPHIER_PIN_DRV_4_8, 209 57, UNIPHIER_PIN_DRV_4_8,
210 57, UNIPHIER_PIN_PULL_DOWN), 210 57, UNIPHIER_PIN_PULL_DOWN),
211 UNIPHIER_PINCTRL_PIN(62, "HS0DIN3", UNIPHIER_PIN_IECTRL_NONE, 211 UNIPHIER_PINCTRL_PIN(62, "HS0DIN3", 0,
212 58, UNIPHIER_PIN_DRV_4_8, 212 58, UNIPHIER_PIN_DRV_4_8,
213 58, UNIPHIER_PIN_PULL_DOWN), 213 58, UNIPHIER_PIN_PULL_DOWN),
214 UNIPHIER_PINCTRL_PIN(63, "HS0DIN4", UNIPHIER_PIN_IECTRL_NONE, 214 UNIPHIER_PINCTRL_PIN(63, "HS0DIN4", 0,
215 59, UNIPHIER_PIN_DRV_4_8, 215 59, UNIPHIER_PIN_DRV_4_8,
216 59, UNIPHIER_PIN_PULL_DOWN), 216 59, UNIPHIER_PIN_PULL_DOWN),
217 UNIPHIER_PINCTRL_PIN(64, "HS0DIN5", UNIPHIER_PIN_IECTRL_NONE, 217 UNIPHIER_PINCTRL_PIN(64, "HS0DIN5", 0,
218 60, UNIPHIER_PIN_DRV_4_8, 218 60, UNIPHIER_PIN_DRV_4_8,
219 60, UNIPHIER_PIN_PULL_DOWN), 219 60, UNIPHIER_PIN_PULL_DOWN),
220 UNIPHIER_PINCTRL_PIN(65, "HS0DIN6", UNIPHIER_PIN_IECTRL_NONE, 220 UNIPHIER_PINCTRL_PIN(65, "HS0DIN6", 0,
221 61, UNIPHIER_PIN_DRV_4_8, 221 61, UNIPHIER_PIN_DRV_4_8,
222 61, UNIPHIER_PIN_PULL_DOWN), 222 61, UNIPHIER_PIN_PULL_DOWN),
223 UNIPHIER_PINCTRL_PIN(66, "HS0DIN7", UNIPHIER_PIN_IECTRL_NONE, 223 UNIPHIER_PINCTRL_PIN(66, "HS0DIN7", 0,
224 62, UNIPHIER_PIN_DRV_4_8, 224 62, UNIPHIER_PIN_DRV_4_8,
225 62, UNIPHIER_PIN_PULL_DOWN), 225 62, UNIPHIER_PIN_PULL_DOWN),
226 UNIPHIER_PINCTRL_PIN(67, "HS0BCLKIN", UNIPHIER_PIN_IECTRL_NONE, 226 UNIPHIER_PINCTRL_PIN(67, "HS0BCLKIN", 0,
227 63, UNIPHIER_PIN_DRV_4_8, 227 63, UNIPHIER_PIN_DRV_4_8,
228 63, UNIPHIER_PIN_PULL_DOWN), 228 63, UNIPHIER_PIN_PULL_DOWN),
229 UNIPHIER_PINCTRL_PIN(68, "HS0VALIN", UNIPHIER_PIN_IECTRL_NONE, 229 UNIPHIER_PINCTRL_PIN(68, "HS0VALIN", 0,
230 64, UNIPHIER_PIN_DRV_4_8, 230 64, UNIPHIER_PIN_DRV_4_8,
231 64, UNIPHIER_PIN_PULL_DOWN), 231 64, UNIPHIER_PIN_PULL_DOWN),
232 UNIPHIER_PINCTRL_PIN(69, "HS0SYNCIN", UNIPHIER_PIN_IECTRL_NONE, 232 UNIPHIER_PINCTRL_PIN(69, "HS0SYNCIN", 0,
233 65, UNIPHIER_PIN_DRV_4_8, 233 65, UNIPHIER_PIN_DRV_4_8,
234 65, UNIPHIER_PIN_PULL_DOWN), 234 65, UNIPHIER_PIN_PULL_DOWN),
235 UNIPHIER_PINCTRL_PIN(70, "HSDOUT0", UNIPHIER_PIN_IECTRL_NONE, 235 UNIPHIER_PINCTRL_PIN(70, "HSDOUT0", 0,
236 66, UNIPHIER_PIN_DRV_4_8, 236 66, UNIPHIER_PIN_DRV_4_8,
237 66, UNIPHIER_PIN_PULL_DOWN), 237 66, UNIPHIER_PIN_PULL_DOWN),
238 UNIPHIER_PINCTRL_PIN(71, "HSDOUT1", UNIPHIER_PIN_IECTRL_NONE, 238 UNIPHIER_PINCTRL_PIN(71, "HSDOUT1", 0,
239 67, UNIPHIER_PIN_DRV_4_8, 239 67, UNIPHIER_PIN_DRV_4_8,
240 67, UNIPHIER_PIN_PULL_DOWN), 240 67, UNIPHIER_PIN_PULL_DOWN),
241 UNIPHIER_PINCTRL_PIN(72, "HSDOUT2", UNIPHIER_PIN_IECTRL_NONE, 241 UNIPHIER_PINCTRL_PIN(72, "HSDOUT2", 0,
242 68, UNIPHIER_PIN_DRV_4_8, 242 68, UNIPHIER_PIN_DRV_4_8,
243 68, UNIPHIER_PIN_PULL_DOWN), 243 68, UNIPHIER_PIN_PULL_DOWN),
244 UNIPHIER_PINCTRL_PIN(73, "HSDOUT3", UNIPHIER_PIN_IECTRL_NONE, 244 UNIPHIER_PINCTRL_PIN(73, "HSDOUT3", 0,
245 69, UNIPHIER_PIN_DRV_4_8, 245 69, UNIPHIER_PIN_DRV_4_8,
246 69, UNIPHIER_PIN_PULL_DOWN), 246 69, UNIPHIER_PIN_PULL_DOWN),
247 UNIPHIER_PINCTRL_PIN(74, "HSDOUT4", UNIPHIER_PIN_IECTRL_NONE, 247 UNIPHIER_PINCTRL_PIN(74, "HSDOUT4", 0,
248 70, UNIPHIER_PIN_DRV_4_8, 248 70, UNIPHIER_PIN_DRV_4_8,
249 70, UNIPHIER_PIN_PULL_DOWN), 249 70, UNIPHIER_PIN_PULL_DOWN),
250 UNIPHIER_PINCTRL_PIN(75, "HSDOUT5", UNIPHIER_PIN_IECTRL_NONE, 250 UNIPHIER_PINCTRL_PIN(75, "HSDOUT5", 0,
251 71, UNIPHIER_PIN_DRV_4_8, 251 71, UNIPHIER_PIN_DRV_4_8,
252 71, UNIPHIER_PIN_PULL_DOWN), 252 71, UNIPHIER_PIN_PULL_DOWN),
253 UNIPHIER_PINCTRL_PIN(76, "HSDOUT6", UNIPHIER_PIN_IECTRL_NONE, 253 UNIPHIER_PINCTRL_PIN(76, "HSDOUT6", 0,
254 72, UNIPHIER_PIN_DRV_4_8, 254 72, UNIPHIER_PIN_DRV_4_8,
255 72, UNIPHIER_PIN_PULL_DOWN), 255 72, UNIPHIER_PIN_PULL_DOWN),
256 UNIPHIER_PINCTRL_PIN(77, "HSDOUT7", UNIPHIER_PIN_IECTRL_NONE, 256 UNIPHIER_PINCTRL_PIN(77, "HSDOUT7", 0,
257 73, UNIPHIER_PIN_DRV_4_8, 257 73, UNIPHIER_PIN_DRV_4_8,
258 73, UNIPHIER_PIN_PULL_DOWN), 258 73, UNIPHIER_PIN_PULL_DOWN),
259 UNIPHIER_PINCTRL_PIN(78, "HSBCLKOUT", UNIPHIER_PIN_IECTRL_NONE, 259 UNIPHIER_PINCTRL_PIN(78, "HSBCLKOUT", 0,
260 74, UNIPHIER_PIN_DRV_4_8, 260 74, UNIPHIER_PIN_DRV_4_8,
261 74, UNIPHIER_PIN_PULL_DOWN), 261 74, UNIPHIER_PIN_PULL_DOWN),
262 UNIPHIER_PINCTRL_PIN(79, "HSVALOUT", UNIPHIER_PIN_IECTRL_NONE, 262 UNIPHIER_PINCTRL_PIN(79, "HSVALOUT", 0,
263 75, UNIPHIER_PIN_DRV_4_8, 263 75, UNIPHIER_PIN_DRV_4_8,
264 75, UNIPHIER_PIN_PULL_DOWN), 264 75, UNIPHIER_PIN_PULL_DOWN),
265 UNIPHIER_PINCTRL_PIN(80, "HSSYNCOUT", UNIPHIER_PIN_IECTRL_NONE, 265 UNIPHIER_PINCTRL_PIN(80, "HSSYNCOUT", 0,
266 76, UNIPHIER_PIN_DRV_4_8, 266 76, UNIPHIER_PIN_DRV_4_8,
267 76, UNIPHIER_PIN_PULL_DOWN), 267 76, UNIPHIER_PIN_PULL_DOWN),
268 UNIPHIER_PINCTRL_PIN(81, "HS1DIN0", UNIPHIER_PIN_IECTRL_NONE, 268 UNIPHIER_PINCTRL_PIN(81, "HS1DIN0", 0,
269 77, UNIPHIER_PIN_DRV_4_8, 269 77, UNIPHIER_PIN_DRV_4_8,
270 77, UNIPHIER_PIN_PULL_DOWN), 270 77, UNIPHIER_PIN_PULL_DOWN),
271 UNIPHIER_PINCTRL_PIN(82, "HS1DIN1", UNIPHIER_PIN_IECTRL_NONE, 271 UNIPHIER_PINCTRL_PIN(82, "HS1DIN1", 0,
272 78, UNIPHIER_PIN_DRV_4_8, 272 78, UNIPHIER_PIN_DRV_4_8,
273 78, UNIPHIER_PIN_PULL_DOWN), 273 78, UNIPHIER_PIN_PULL_DOWN),
274 UNIPHIER_PINCTRL_PIN(83, "HS1DIN2", UNIPHIER_PIN_IECTRL_NONE, 274 UNIPHIER_PINCTRL_PIN(83, "HS1DIN2", 0,
275 79, UNIPHIER_PIN_DRV_4_8, 275 79, UNIPHIER_PIN_DRV_4_8,
276 79, UNIPHIER_PIN_PULL_DOWN), 276 79, UNIPHIER_PIN_PULL_DOWN),
277 UNIPHIER_PINCTRL_PIN(84, "HS1DIN3", UNIPHIER_PIN_IECTRL_NONE, 277 UNIPHIER_PINCTRL_PIN(84, "HS1DIN3", 0,
278 80, UNIPHIER_PIN_DRV_4_8, 278 80, UNIPHIER_PIN_DRV_4_8,
279 80, UNIPHIER_PIN_PULL_DOWN), 279 80, UNIPHIER_PIN_PULL_DOWN),
280 UNIPHIER_PINCTRL_PIN(85, "HS1DIN4", UNIPHIER_PIN_IECTRL_NONE, 280 UNIPHIER_PINCTRL_PIN(85, "HS1DIN4", 0,
281 81, UNIPHIER_PIN_DRV_4_8, 281 81, UNIPHIER_PIN_DRV_4_8,
282 81, UNIPHIER_PIN_PULL_DOWN), 282 81, UNIPHIER_PIN_PULL_DOWN),
283 UNIPHIER_PINCTRL_PIN(86, "HS1DIN5", UNIPHIER_PIN_IECTRL_NONE, 283 UNIPHIER_PINCTRL_PIN(86, "HS1DIN5", 0,
284 82, UNIPHIER_PIN_DRV_4_8, 284 82, UNIPHIER_PIN_DRV_4_8,
285 82, UNIPHIER_PIN_PULL_DOWN), 285 82, UNIPHIER_PIN_PULL_DOWN),
286 UNIPHIER_PINCTRL_PIN(87, "HS1DIN6", UNIPHIER_PIN_IECTRL_NONE, 286 UNIPHIER_PINCTRL_PIN(87, "HS1DIN6", 0,
287 83, UNIPHIER_PIN_DRV_4_8, 287 83, UNIPHIER_PIN_DRV_4_8,
288 83, UNIPHIER_PIN_PULL_DOWN), 288 83, UNIPHIER_PIN_PULL_DOWN),
289 UNIPHIER_PINCTRL_PIN(88, "HS1DIN7", UNIPHIER_PIN_IECTRL_NONE, 289 UNIPHIER_PINCTRL_PIN(88, "HS1DIN7", 0,
290 84, UNIPHIER_PIN_DRV_4_8, 290 84, UNIPHIER_PIN_DRV_4_8,
291 84, UNIPHIER_PIN_PULL_DOWN), 291 84, UNIPHIER_PIN_PULL_DOWN),
292 UNIPHIER_PINCTRL_PIN(89, "HS1BCLKIN", UNIPHIER_PIN_IECTRL_NONE, 292 UNIPHIER_PINCTRL_PIN(89, "HS1BCLKIN", 0,
293 85, UNIPHIER_PIN_DRV_4_8, 293 85, UNIPHIER_PIN_DRV_4_8,
294 85, UNIPHIER_PIN_PULL_DOWN), 294 85, UNIPHIER_PIN_PULL_DOWN),
295 UNIPHIER_PINCTRL_PIN(90, "HS1VALIN", UNIPHIER_PIN_IECTRL_NONE, 295 UNIPHIER_PINCTRL_PIN(90, "HS1VALIN", 0,
296 86, UNIPHIER_PIN_DRV_4_8, 296 86, UNIPHIER_PIN_DRV_4_8,
297 86, UNIPHIER_PIN_PULL_DOWN), 297 86, UNIPHIER_PIN_PULL_DOWN),
298 UNIPHIER_PINCTRL_PIN(91, "HS1SYNCIN", UNIPHIER_PIN_IECTRL_NONE, 298 UNIPHIER_PINCTRL_PIN(91, "HS1SYNCIN", 0,
299 87, UNIPHIER_PIN_DRV_4_8, 299 87, UNIPHIER_PIN_DRV_4_8,
300 87, UNIPHIER_PIN_PULL_DOWN), 300 87, UNIPHIER_PIN_PULL_DOWN),
301 UNIPHIER_PINCTRL_PIN(92, "AGCI", UNIPHIER_PIN_IECTRL_NONE, 301 UNIPHIER_PINCTRL_PIN(92, "AGCI", 3,
302 -1, UNIPHIER_PIN_DRV_FIXED_4, 302 -1, UNIPHIER_PIN_DRV_FIXED_4,
303 132, UNIPHIER_PIN_PULL_DOWN), 303 132, UNIPHIER_PIN_PULL_DOWN),
304 UNIPHIER_PINCTRL_PIN(93, "AGCR", UNIPHIER_PIN_IECTRL_NONE, 304 UNIPHIER_PINCTRL_PIN(93, "AGCR", 4,
305 -1, UNIPHIER_PIN_DRV_FIXED_4, 305 -1, UNIPHIER_PIN_DRV_FIXED_4,
306 133, UNIPHIER_PIN_PULL_DOWN), 306 133, UNIPHIER_PIN_PULL_DOWN),
307 UNIPHIER_PINCTRL_PIN(94, "AGCBS", UNIPHIER_PIN_IECTRL_NONE, 307 UNIPHIER_PINCTRL_PIN(94, "AGCBS", 5,
308 -1, UNIPHIER_PIN_DRV_FIXED_4, 308 -1, UNIPHIER_PIN_DRV_FIXED_4,
309 134, UNIPHIER_PIN_PULL_DOWN), 309 134, UNIPHIER_PIN_PULL_DOWN),
310 UNIPHIER_PINCTRL_PIN(95, "IECOUT", UNIPHIER_PIN_IECTRL_NONE, 310 UNIPHIER_PINCTRL_PIN(95, "IECOUT", 0,
311 88, UNIPHIER_PIN_DRV_4_8, 311 88, UNIPHIER_PIN_DRV_4_8,
312 88, UNIPHIER_PIN_PULL_DOWN), 312 88, UNIPHIER_PIN_PULL_DOWN),
313 UNIPHIER_PINCTRL_PIN(96, "ASMCK", UNIPHIER_PIN_IECTRL_NONE, 313 UNIPHIER_PINCTRL_PIN(96, "ASMCK", 0,
314 89, UNIPHIER_PIN_DRV_4_8, 314 89, UNIPHIER_PIN_DRV_4_8,
315 89, UNIPHIER_PIN_PULL_DOWN), 315 89, UNIPHIER_PIN_PULL_DOWN),
316 UNIPHIER_PINCTRL_PIN(97, "ABCKO", UNIPHIER_PIN_IECTRL_NONE, 316 UNIPHIER_PINCTRL_PIN(97, "ABCKO", UNIPHIER_PIN_IECTRL_NONE,
@@ -325,31 +325,31 @@ static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
325 UNIPHIER_PINCTRL_PIN(100, "ASDOUT1", UNIPHIER_PIN_IECTRL_NONE, 325 UNIPHIER_PINCTRL_PIN(100, "ASDOUT1", UNIPHIER_PIN_IECTRL_NONE,
326 93, UNIPHIER_PIN_DRV_4_8, 326 93, UNIPHIER_PIN_DRV_4_8,
327 93, UNIPHIER_PIN_PULL_UP), 327 93, UNIPHIER_PIN_PULL_UP),
328 UNIPHIER_PINCTRL_PIN(101, "ARCOUT", UNIPHIER_PIN_IECTRL_NONE, 328 UNIPHIER_PINCTRL_PIN(101, "ARCOUT", 0,
329 94, UNIPHIER_PIN_DRV_4_8, 329 94, UNIPHIER_PIN_DRV_4_8,
330 94, UNIPHIER_PIN_PULL_DOWN), 330 94, UNIPHIER_PIN_PULL_DOWN),
331 UNIPHIER_PINCTRL_PIN(102, "SDA0", UNIPHIER_PIN_IECTRL_NONE, 331 UNIPHIER_PINCTRL_PIN(102, "SDA0", 10,
332 -1, UNIPHIER_PIN_DRV_FIXED_4, 332 -1, UNIPHIER_PIN_DRV_FIXED_4,
333 -1, UNIPHIER_PIN_PULL_NONE), 333 -1, UNIPHIER_PIN_PULL_NONE),
334 UNIPHIER_PINCTRL_PIN(103, "SCL0", UNIPHIER_PIN_IECTRL_NONE, 334 UNIPHIER_PINCTRL_PIN(103, "SCL0", 10,
335 -1, UNIPHIER_PIN_DRV_FIXED_4, 335 -1, UNIPHIER_PIN_DRV_FIXED_4,
336 -1, UNIPHIER_PIN_PULL_NONE), 336 -1, UNIPHIER_PIN_PULL_NONE),
337 UNIPHIER_PINCTRL_PIN(104, "SDA1", UNIPHIER_PIN_IECTRL_NONE, 337 UNIPHIER_PINCTRL_PIN(104, "SDA1", 11,
338 -1, UNIPHIER_PIN_DRV_FIXED_4, 338 -1, UNIPHIER_PIN_DRV_FIXED_4,
339 -1, UNIPHIER_PIN_PULL_NONE), 339 -1, UNIPHIER_PIN_PULL_NONE),
340 UNIPHIER_PINCTRL_PIN(105, "SCL1", UNIPHIER_PIN_IECTRL_NONE, 340 UNIPHIER_PINCTRL_PIN(105, "SCL1", 11,
341 -1, UNIPHIER_PIN_DRV_FIXED_4, 341 -1, UNIPHIER_PIN_DRV_FIXED_4,
342 -1, UNIPHIER_PIN_PULL_NONE), 342 -1, UNIPHIER_PIN_PULL_NONE),
343 UNIPHIER_PINCTRL_PIN(106, "DMDSDA0", UNIPHIER_PIN_IECTRL_NONE, 343 UNIPHIER_PINCTRL_PIN(106, "DMDSDA0", 12,
344 -1, UNIPHIER_PIN_DRV_FIXED_4, 344 -1, UNIPHIER_PIN_DRV_FIXED_4,
345 -1, UNIPHIER_PIN_PULL_NONE), 345 -1, UNIPHIER_PIN_PULL_NONE),
346 UNIPHIER_PINCTRL_PIN(107, "DMDSCL0", UNIPHIER_PIN_IECTRL_NONE, 346 UNIPHIER_PINCTRL_PIN(107, "DMDSCL0", 12,
347 -1, UNIPHIER_PIN_DRV_FIXED_4, 347 -1, UNIPHIER_PIN_DRV_FIXED_4,
348 -1, UNIPHIER_PIN_PULL_NONE), 348 -1, UNIPHIER_PIN_PULL_NONE),
349 UNIPHIER_PINCTRL_PIN(108, "DMDSDA1", UNIPHIER_PIN_IECTRL_NONE, 349 UNIPHIER_PINCTRL_PIN(108, "DMDSDA1", 13,
350 -1, UNIPHIER_PIN_DRV_FIXED_4, 350 -1, UNIPHIER_PIN_DRV_FIXED_4,
351 -1, UNIPHIER_PIN_PULL_NONE), 351 -1, UNIPHIER_PIN_PULL_NONE),
352 UNIPHIER_PINCTRL_PIN(109, "DMDSCL1", UNIPHIER_PIN_IECTRL_NONE, 352 UNIPHIER_PINCTRL_PIN(109, "DMDSCL1", 13,
353 -1, UNIPHIER_PIN_DRV_FIXED_4, 353 -1, UNIPHIER_PIN_DRV_FIXED_4,
354 -1, UNIPHIER_PIN_PULL_NONE), 354 -1, UNIPHIER_PIN_PULL_NONE),
355 UNIPHIER_PINCTRL_PIN(110, "SBO0", UNIPHIER_PIN_IECTRL_NONE, 355 UNIPHIER_PINCTRL_PIN(110, "SBO0", UNIPHIER_PIN_IECTRL_NONE,
@@ -358,76 +358,76 @@ static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
358 UNIPHIER_PINCTRL_PIN(111, "SBI0", UNIPHIER_PIN_IECTRL_NONE, 358 UNIPHIER_PINCTRL_PIN(111, "SBI0", UNIPHIER_PIN_IECTRL_NONE,
359 96, UNIPHIER_PIN_DRV_4_8, 359 96, UNIPHIER_PIN_DRV_4_8,
360 96, UNIPHIER_PIN_PULL_UP), 360 96, UNIPHIER_PIN_PULL_UP),
361 UNIPHIER_PINCTRL_PIN(112, "SBO1", UNIPHIER_PIN_IECTRL_NONE, 361 UNIPHIER_PINCTRL_PIN(112, "SBO1", 0,
362 97, UNIPHIER_PIN_DRV_4_8, 362 97, UNIPHIER_PIN_DRV_4_8,
363 97, UNIPHIER_PIN_PULL_UP), 363 97, UNIPHIER_PIN_PULL_UP),
364 UNIPHIER_PINCTRL_PIN(113, "SBI1", UNIPHIER_PIN_IECTRL_NONE, 364 UNIPHIER_PINCTRL_PIN(113, "SBI1", 0,
365 98, UNIPHIER_PIN_DRV_4_8, 365 98, UNIPHIER_PIN_DRV_4_8,
366 98, UNIPHIER_PIN_PULL_UP), 366 98, UNIPHIER_PIN_PULL_UP),
367 UNIPHIER_PINCTRL_PIN(114, "TXD1", UNIPHIER_PIN_IECTRL_NONE, 367 UNIPHIER_PINCTRL_PIN(114, "TXD1", 0,
368 99, UNIPHIER_PIN_DRV_4_8, 368 99, UNIPHIER_PIN_DRV_4_8,
369 99, UNIPHIER_PIN_PULL_UP), 369 99, UNIPHIER_PIN_PULL_UP),
370 UNIPHIER_PINCTRL_PIN(115, "RXD1", UNIPHIER_PIN_IECTRL_NONE, 370 UNIPHIER_PINCTRL_PIN(115, "RXD1", 0,
371 100, UNIPHIER_PIN_DRV_4_8, 371 100, UNIPHIER_PIN_DRV_4_8,
372 100, UNIPHIER_PIN_PULL_UP), 372 100, UNIPHIER_PIN_PULL_UP),
373 UNIPHIER_PINCTRL_PIN(116, "HIN", UNIPHIER_PIN_IECTRL_NONE, 373 UNIPHIER_PINCTRL_PIN(116, "HIN", 1,
374 -1, UNIPHIER_PIN_DRV_FIXED_5, 374 -1, UNIPHIER_PIN_DRV_FIXED_5,
375 -1, UNIPHIER_PIN_PULL_NONE), 375 -1, UNIPHIER_PIN_PULL_NONE),
376 UNIPHIER_PINCTRL_PIN(117, "VIN", UNIPHIER_PIN_IECTRL_NONE, 376 UNIPHIER_PINCTRL_PIN(117, "VIN", 2,
377 -1, UNIPHIER_PIN_DRV_FIXED_5, 377 -1, UNIPHIER_PIN_DRV_FIXED_5,
378 -1, UNIPHIER_PIN_PULL_NONE), 378 -1, UNIPHIER_PIN_PULL_NONE),
379 UNIPHIER_PINCTRL_PIN(118, "TCON0", UNIPHIER_PIN_IECTRL_NONE, 379 UNIPHIER_PINCTRL_PIN(118, "TCON0", 0,
380 101, UNIPHIER_PIN_DRV_4_8, 380 101, UNIPHIER_PIN_DRV_4_8,
381 101, UNIPHIER_PIN_PULL_DOWN), 381 101, UNIPHIER_PIN_PULL_DOWN),
382 UNIPHIER_PINCTRL_PIN(119, "TCON1", UNIPHIER_PIN_IECTRL_NONE, 382 UNIPHIER_PINCTRL_PIN(119, "TCON1", 0,
383 102, UNIPHIER_PIN_DRV_4_8, 383 102, UNIPHIER_PIN_DRV_4_8,
384 102, UNIPHIER_PIN_PULL_DOWN), 384 102, UNIPHIER_PIN_PULL_DOWN),
385 UNIPHIER_PINCTRL_PIN(120, "TCON2", UNIPHIER_PIN_IECTRL_NONE, 385 UNIPHIER_PINCTRL_PIN(120, "TCON2", 0,
386 103, UNIPHIER_PIN_DRV_4_8, 386 103, UNIPHIER_PIN_DRV_4_8,
387 103, UNIPHIER_PIN_PULL_DOWN), 387 103, UNIPHIER_PIN_PULL_DOWN),
388 UNIPHIER_PINCTRL_PIN(121, "TCON3", UNIPHIER_PIN_IECTRL_NONE, 388 UNIPHIER_PINCTRL_PIN(121, "TCON3", 0,
389 104, UNIPHIER_PIN_DRV_4_8, 389 104, UNIPHIER_PIN_DRV_4_8,
390 104, UNIPHIER_PIN_PULL_DOWN), 390 104, UNIPHIER_PIN_PULL_DOWN),
391 UNIPHIER_PINCTRL_PIN(122, "TCON4", UNIPHIER_PIN_IECTRL_NONE, 391 UNIPHIER_PINCTRL_PIN(122, "TCON4", 0,
392 105, UNIPHIER_PIN_DRV_4_8, 392 105, UNIPHIER_PIN_DRV_4_8,
393 105, UNIPHIER_PIN_PULL_DOWN), 393 105, UNIPHIER_PIN_PULL_DOWN),
394 UNIPHIER_PINCTRL_PIN(123, "TCON5", UNIPHIER_PIN_IECTRL_NONE, 394 UNIPHIER_PINCTRL_PIN(123, "TCON5", 0,
395 106, UNIPHIER_PIN_DRV_4_8, 395 106, UNIPHIER_PIN_DRV_4_8,
396 106, UNIPHIER_PIN_PULL_DOWN), 396 106, UNIPHIER_PIN_PULL_DOWN),
397 UNIPHIER_PINCTRL_PIN(124, "TCON6", UNIPHIER_PIN_IECTRL_NONE, 397 UNIPHIER_PINCTRL_PIN(124, "TCON6", 0,
398 107, UNIPHIER_PIN_DRV_4_8, 398 107, UNIPHIER_PIN_DRV_4_8,
399 107, UNIPHIER_PIN_PULL_DOWN), 399 107, UNIPHIER_PIN_PULL_DOWN),
400 UNIPHIER_PINCTRL_PIN(125, "TCON7", UNIPHIER_PIN_IECTRL_NONE, 400 UNIPHIER_PINCTRL_PIN(125, "TCON7", 0,
401 108, UNIPHIER_PIN_DRV_4_8, 401 108, UNIPHIER_PIN_DRV_4_8,
402 108, UNIPHIER_PIN_PULL_DOWN), 402 108, UNIPHIER_PIN_PULL_DOWN),
403 UNIPHIER_PINCTRL_PIN(126, "TCON8", UNIPHIER_PIN_IECTRL_NONE, 403 UNIPHIER_PINCTRL_PIN(126, "TCON8", 0,
404 109, UNIPHIER_PIN_DRV_4_8, 404 109, UNIPHIER_PIN_DRV_4_8,
405 109, UNIPHIER_PIN_PULL_DOWN), 405 109, UNIPHIER_PIN_PULL_DOWN),
406 UNIPHIER_PINCTRL_PIN(127, "PWMA", UNIPHIER_PIN_IECTRL_NONE, 406 UNIPHIER_PINCTRL_PIN(127, "PWMA", 0,
407 110, UNIPHIER_PIN_DRV_4_8, 407 110, UNIPHIER_PIN_DRV_4_8,
408 110, UNIPHIER_PIN_PULL_DOWN), 408 110, UNIPHIER_PIN_PULL_DOWN),
409 UNIPHIER_PINCTRL_PIN(128, "XIRQ0", UNIPHIER_PIN_IECTRL_NONE, 409 UNIPHIER_PINCTRL_PIN(128, "XIRQ0", 0,
410 111, UNIPHIER_PIN_DRV_4_8, 410 111, UNIPHIER_PIN_DRV_4_8,
411 111, UNIPHIER_PIN_PULL_DOWN), 411 111, UNIPHIER_PIN_PULL_DOWN),
412 UNIPHIER_PINCTRL_PIN(129, "XIRQ1", UNIPHIER_PIN_IECTRL_NONE, 412 UNIPHIER_PINCTRL_PIN(129, "XIRQ1", 0,
413 112, UNIPHIER_PIN_DRV_4_8, 413 112, UNIPHIER_PIN_DRV_4_8,
414 112, UNIPHIER_PIN_PULL_DOWN), 414 112, UNIPHIER_PIN_PULL_DOWN),
415 UNIPHIER_PINCTRL_PIN(130, "XIRQ2", UNIPHIER_PIN_IECTRL_NONE, 415 UNIPHIER_PINCTRL_PIN(130, "XIRQ2", 0,
416 113, UNIPHIER_PIN_DRV_4_8, 416 113, UNIPHIER_PIN_DRV_4_8,
417 113, UNIPHIER_PIN_PULL_DOWN), 417 113, UNIPHIER_PIN_PULL_DOWN),
418 UNIPHIER_PINCTRL_PIN(131, "XIRQ3", UNIPHIER_PIN_IECTRL_NONE, 418 UNIPHIER_PINCTRL_PIN(131, "XIRQ3", 0,
419 114, UNIPHIER_PIN_DRV_4_8, 419 114, UNIPHIER_PIN_DRV_4_8,
420 114, UNIPHIER_PIN_PULL_DOWN), 420 114, UNIPHIER_PIN_PULL_DOWN),
421 UNIPHIER_PINCTRL_PIN(132, "XIRQ4", UNIPHIER_PIN_IECTRL_NONE, 421 UNIPHIER_PINCTRL_PIN(132, "XIRQ4", 0,
422 115, UNIPHIER_PIN_DRV_4_8, 422 115, UNIPHIER_PIN_DRV_4_8,
423 115, UNIPHIER_PIN_PULL_DOWN), 423 115, UNIPHIER_PIN_PULL_DOWN),
424 UNIPHIER_PINCTRL_PIN(133, "XIRQ5", UNIPHIER_PIN_IECTRL_NONE, 424 UNIPHIER_PINCTRL_PIN(133, "XIRQ5", 0,
425 116, UNIPHIER_PIN_DRV_4_8, 425 116, UNIPHIER_PIN_DRV_4_8,
426 116, UNIPHIER_PIN_PULL_DOWN), 426 116, UNIPHIER_PIN_PULL_DOWN),
427 UNIPHIER_PINCTRL_PIN(134, "XIRQ6", UNIPHIER_PIN_IECTRL_NONE, 427 UNIPHIER_PINCTRL_PIN(134, "XIRQ6", 0,
428 117, UNIPHIER_PIN_DRV_4_8, 428 117, UNIPHIER_PIN_DRV_4_8,
429 117, UNIPHIER_PIN_PULL_DOWN), 429 117, UNIPHIER_PIN_PULL_DOWN),
430 UNIPHIER_PINCTRL_PIN(135, "XIRQ7", UNIPHIER_PIN_IECTRL_NONE, 430 UNIPHIER_PINCTRL_PIN(135, "XIRQ7", 0,
431 118, UNIPHIER_PIN_DRV_4_8, 431 118, UNIPHIER_PIN_DRV_4_8,
432 118, UNIPHIER_PIN_PULL_DOWN), 432 118, UNIPHIER_PIN_PULL_DOWN),
433}; 433};
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 01bf3476a791..a9567af7cec0 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -192,9 +192,9 @@ static const struct regulator_desc axp22x_regulators[] = {
192 AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20, 192 AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
193 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), 193 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
194 AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20, 194 AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20,
195 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), 195 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(4)),
196 AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, 196 AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
197 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(4)), 197 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
198 /* secondary switchable output of DCDC1 */ 198 /* secondary switchable output of DCDC1 */
199 AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100, 199 AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100,
200 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)), 200 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7849187d91ae..8a34f6acc801 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1403,6 +1403,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
1403 return 0; 1403 return 0;
1404 } 1404 }
1405 1405
1406 /* Did the lookup explicitly defer for us? */
1407 if (ret == -EPROBE_DEFER)
1408 return ret;
1409
1406 if (have_full_constraints()) { 1410 if (have_full_constraints()) {
1407 r = dummy_regulator_rdev; 1411 r = dummy_regulator_rdev;
1408 } else { 1412 } else {
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index add419d6ff34..a56a7b243e91 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -212,6 +212,17 @@ static const struct file_operations twa_fops = {
212 .llseek = noop_llseek, 212 .llseek = noop_llseek,
213}; 213};
214 214
215/*
216 * The controllers use an inline buffer instead of a mapped SGL for small,
217 * single entry buffers. Note that we treat a zero-length transfer like
218 * a mapped SGL.
219 */
220static bool twa_command_mapped(struct scsi_cmnd *cmd)
221{
222 return scsi_sg_count(cmd) != 1 ||
223 scsi_bufflen(cmd) >= TW_MIN_SGL_LENGTH;
224}
225
215/* This function will complete an aen request from the isr */ 226/* This function will complete an aen request from the isr */
216static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) 227static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id)
217{ 228{
@@ -1339,7 +1350,8 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
1339 } 1350 }
1340 1351
1341 /* Now complete the io */ 1352 /* Now complete the io */
1342 scsi_dma_unmap(cmd); 1353 if (twa_command_mapped(cmd))
1354 scsi_dma_unmap(cmd);
1343 cmd->scsi_done(cmd); 1355 cmd->scsi_done(cmd);
1344 tw_dev->state[request_id] = TW_S_COMPLETED; 1356 tw_dev->state[request_id] = TW_S_COMPLETED;
1345 twa_free_request_id(tw_dev, request_id); 1357 twa_free_request_id(tw_dev, request_id);
@@ -1582,7 +1594,8 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
1582 struct scsi_cmnd *cmd = tw_dev->srb[i]; 1594 struct scsi_cmnd *cmd = tw_dev->srb[i];
1583 1595
1584 cmd->result = (DID_RESET << 16); 1596 cmd->result = (DID_RESET << 16);
1585 scsi_dma_unmap(cmd); 1597 if (twa_command_mapped(cmd))
1598 scsi_dma_unmap(cmd);
1586 cmd->scsi_done(cmd); 1599 cmd->scsi_done(cmd);
1587 } 1600 }
1588 } 1601 }
@@ -1765,12 +1778,14 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1765 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); 1778 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL);
1766 switch (retval) { 1779 switch (retval) {
1767 case SCSI_MLQUEUE_HOST_BUSY: 1780 case SCSI_MLQUEUE_HOST_BUSY:
1768 scsi_dma_unmap(SCpnt); 1781 if (twa_command_mapped(SCpnt))
1782 scsi_dma_unmap(SCpnt);
1769 twa_free_request_id(tw_dev, request_id); 1783 twa_free_request_id(tw_dev, request_id);
1770 break; 1784 break;
1771 case 1: 1785 case 1:
1772 SCpnt->result = (DID_ERROR << 16); 1786 SCpnt->result = (DID_ERROR << 16);
1773 scsi_dma_unmap(SCpnt); 1787 if (twa_command_mapped(SCpnt))
1788 scsi_dma_unmap(SCpnt);
1774 done(SCpnt); 1789 done(SCpnt);
1775 tw_dev->state[request_id] = TW_S_COMPLETED; 1790 tw_dev->state[request_id] = TW_S_COMPLETED;
1776 twa_free_request_id(tw_dev, request_id); 1791 twa_free_request_id(tw_dev, request_id);
@@ -1831,8 +1846,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
1831 /* Map sglist from scsi layer to cmd packet */ 1846 /* Map sglist from scsi layer to cmd packet */
1832 1847
1833 if (scsi_sg_count(srb)) { 1848 if (scsi_sg_count(srb)) {
1834 if ((scsi_sg_count(srb) == 1) && 1849 if (!twa_command_mapped(srb)) {
1835 (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) {
1836 if (srb->sc_data_direction == DMA_TO_DEVICE || 1850 if (srb->sc_data_direction == DMA_TO_DEVICE ||
1837 srb->sc_data_direction == DMA_BIDIRECTIONAL) 1851 srb->sc_data_direction == DMA_BIDIRECTIONAL)
1838 scsi_sg_copy_to_buffer(srb, 1852 scsi_sg_copy_to_buffer(srb,
@@ -1905,7 +1919,7 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re
1905{ 1919{
1906 struct scsi_cmnd *cmd = tw_dev->srb[request_id]; 1920 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1907 1921
1908 if (scsi_bufflen(cmd) < TW_MIN_SGL_LENGTH && 1922 if (!twa_command_mapped(cmd) &&
1909 (cmd->sc_data_direction == DMA_FROM_DEVICE || 1923 (cmd->sc_data_direction == DMA_FROM_DEVICE ||
1910 cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { 1924 cmd->sc_data_direction == DMA_BIDIRECTIONAL)) {
1911 if (scsi_sg_count(cmd) == 1) { 1925 if (scsi_sg_count(cmd) == 1) {
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 33c74d3436c9..6bffd91b973a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -976,13 +976,13 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
976 wake_up(&conn->ehwait); 976 wake_up(&conn->ehwait);
977} 977}
978 978
979static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) 979static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
980{ 980{
981 struct iscsi_nopout hdr; 981 struct iscsi_nopout hdr;
982 struct iscsi_task *task; 982 struct iscsi_task *task;
983 983
984 if (!rhdr && conn->ping_task) 984 if (!rhdr && conn->ping_task)
985 return; 985 return -EINVAL;
986 986
987 memset(&hdr, 0, sizeof(struct iscsi_nopout)); 987 memset(&hdr, 0, sizeof(struct iscsi_nopout));
988 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; 988 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE;
@@ -996,13 +996,16 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
996 hdr.ttt = RESERVED_ITT; 996 hdr.ttt = RESERVED_ITT;
997 997
998 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); 998 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0);
999 if (!task) 999 if (!task) {
1000 iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); 1000 iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n");
1001 else if (!rhdr) { 1001 return -EIO;
1002 } else if (!rhdr) {
1002 /* only track our nops */ 1003 /* only track our nops */
1003 conn->ping_task = task; 1004 conn->ping_task = task;
1004 conn->last_ping = jiffies; 1005 conn->last_ping = jiffies;
1005 } 1006 }
1007
1008 return 0;
1006} 1009}
1007 1010
1008static int iscsi_nop_out_rsp(struct iscsi_task *task, 1011static int iscsi_nop_out_rsp(struct iscsi_task *task,
@@ -2092,8 +2095,10 @@ static void iscsi_check_transport_timeouts(unsigned long data)
2092 if (time_before_eq(last_recv + recv_timeout, jiffies)) { 2095 if (time_before_eq(last_recv + recv_timeout, jiffies)) {
2093 /* send a ping to try to provoke some traffic */ 2096 /* send a ping to try to provoke some traffic */
2094 ISCSI_DBG_CONN(conn, "Sending nopout as ping\n"); 2097 ISCSI_DBG_CONN(conn, "Sending nopout as ping\n");
2095 iscsi_send_nopout(conn, NULL); 2098 if (iscsi_send_nopout(conn, NULL))
2096 next_timeout = conn->last_ping + (conn->ping_timeout * HZ); 2099 next_timeout = jiffies + (1 * HZ);
2100 else
2101 next_timeout = conn->last_ping + (conn->ping_timeout * HZ);
2097 } else 2102 } else
2098 next_timeout = last_recv + recv_timeout; 2103 next_timeout = last_recv + recv_timeout;
2099 2104
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
index edb044a7b56d..0a2168e69bbc 100644
--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -111,7 +111,7 @@ static struct scsi_device_handler *scsi_dh_lookup(const char *name)
111 111
112 dh = __scsi_dh_lookup(name); 112 dh = __scsi_dh_lookup(name);
113 if (!dh) { 113 if (!dh) {
114 request_module(name); 114 request_module("scsi_dh_%s", name);
115 dh = __scsi_dh_lookup(name); 115 dh = __scsi_dh_lookup(name);
116 } 116 }
117 117
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 3cf9faa6cc3f..a85d863d4a44 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -992,11 +992,12 @@ static int davinci_spi_probe(struct platform_device *pdev)
992 goto free_master; 992 goto free_master;
993 } 993 }
994 994
995 dspi->irq = platform_get_irq(pdev, 0); 995 ret = platform_get_irq(pdev, 0);
996 if (dspi->irq <= 0) { 996 if (ret == 0)
997 ret = -EINVAL; 997 ret = -EINVAL;
998 if (ret < 0)
998 goto free_master; 999 goto free_master;
999 } 1000 dspi->irq = ret;
1000 1001
1001 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq, 1002 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq,
1002 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi); 1003 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi);
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 769b61193d87..a9bc6e23fc25 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -224,7 +224,7 @@ static int ll_dir_filler(void *_hash, struct page *page0)
224 224
225 prefetchw(&page->flags); 225 prefetchw(&page->flags);
226 ret = add_to_page_cache_lru(page, inode->i_mapping, offset, 226 ret = add_to_page_cache_lru(page, inode->i_mapping, offset,
227 GFP_KERNEL); 227 GFP_NOFS);
228 if (ret == 0) { 228 if (ret == 0) {
229 unlock_page(page); 229 unlock_page(page);
230 } else { 230 } else {
diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c
index 4299cf45f947..5e1f16c36b49 100644
--- a/drivers/staging/speakup/fakekey.c
+++ b/drivers/staging/speakup/fakekey.c
@@ -81,6 +81,7 @@ void speakup_fake_down_arrow(void)
81 __this_cpu_write(reporting_keystroke, true); 81 __this_cpu_write(reporting_keystroke, true);
82 input_report_key(virt_keyboard, KEY_DOWN, PRESSED); 82 input_report_key(virt_keyboard, KEY_DOWN, PRESSED);
83 input_report_key(virt_keyboard, KEY_DOWN, RELEASED); 83 input_report_key(virt_keyboard, KEY_DOWN, RELEASED);
84 input_sync(virt_keyboard);
84 __this_cpu_write(reporting_keystroke, false); 85 __this_cpu_write(reporting_keystroke, false);
85 86
86 /* reenable preemption */ 87 /* reenable preemption */
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 20932cc9c8f7..b09023b07169 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -343,8 +343,7 @@ static void n_tty_packet_mode_flush(struct tty_struct *tty)
343 spin_lock_irqsave(&tty->ctrl_lock, flags); 343 spin_lock_irqsave(&tty->ctrl_lock, flags);
344 tty->ctrl_status |= TIOCPKT_FLUSHREAD; 344 tty->ctrl_status |= TIOCPKT_FLUSHREAD;
345 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 345 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
346 if (waitqueue_active(&tty->link->read_wait)) 346 wake_up_interruptible(&tty->link->read_wait);
347 wake_up_interruptible(&tty->link->read_wait);
348 } 347 }
349} 348}
350 349
@@ -1382,8 +1381,7 @@ handle_newline:
1382 put_tty_queue(c, ldata); 1381 put_tty_queue(c, ldata);
1383 smp_store_release(&ldata->canon_head, ldata->read_head); 1382 smp_store_release(&ldata->canon_head, ldata->read_head);
1384 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1383 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1385 if (waitqueue_active(&tty->read_wait)) 1384 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1386 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1387 return 0; 1385 return 0;
1388 } 1386 }
1389 } 1387 }
@@ -1667,8 +1665,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
1667 1665
1668 if ((read_cnt(ldata) >= ldata->minimum_to_wake) || L_EXTPROC(tty)) { 1666 if ((read_cnt(ldata) >= ldata->minimum_to_wake) || L_EXTPROC(tty)) {
1669 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1667 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1670 if (waitqueue_active(&tty->read_wait)) 1668 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1671 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1672 } 1669 }
1673} 1670}
1674 1671
@@ -1887,10 +1884,8 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1887 } 1884 }
1888 1885
1889 /* The termios change make the tty ready for I/O */ 1886 /* The termios change make the tty ready for I/O */
1890 if (waitqueue_active(&tty->write_wait)) 1887 wake_up_interruptible(&tty->write_wait);
1891 wake_up_interruptible(&tty->write_wait); 1888 wake_up_interruptible(&tty->read_wait);
1892 if (waitqueue_active(&tty->read_wait))
1893 wake_up_interruptible(&tty->read_wait);
1894} 1889}
1895 1890
1896/** 1891/**
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index b1e0ba3e525b..0bbf34035d6a 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -261,6 +261,14 @@ configured less than Maximum supported fifo bytes */
261 UART_FCR7_64BYTE, 261 UART_FCR7_64BYTE,
262 .flags = UART_CAP_FIFO, 262 .flags = UART_CAP_FIFO,
263 }, 263 },
264 [PORT_RT2880] = {
265 .name = "Palmchip BK-3103",
266 .fifo_size = 16,
267 .tx_loadsz = 16,
268 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
269 .rxtrig_bytes = {1, 4, 8, 14},
270 .flags = UART_CAP_FIFO,
271 },
264}; 272};
265 273
266/* Uart divisor latch read */ 274/* Uart divisor latch read */
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 5ca5cf3e9359..538ea03bc101 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2786,7 +2786,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
2786 ret = atmel_init_gpios(port, &pdev->dev); 2786 ret = atmel_init_gpios(port, &pdev->dev);
2787 if (ret < 0) { 2787 if (ret < 0) {
2788 dev_err(&pdev->dev, "Failed to initialize GPIOs."); 2788 dev_err(&pdev->dev, "Failed to initialize GPIOs.");
2789 goto err; 2789 goto err_clear_bit;
2790 } 2790 }
2791 2791
2792 ret = atmel_init_port(port, pdev); 2792 ret = atmel_init_port(port, pdev);
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index fe3d41cc8416..d0388a071ba1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1631,12 +1631,12 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1631 int locked = 1; 1631 int locked = 1;
1632 int retval; 1632 int retval;
1633 1633
1634 retval = clk_prepare_enable(sport->clk_per); 1634 retval = clk_enable(sport->clk_per);
1635 if (retval) 1635 if (retval)
1636 return; 1636 return;
1637 retval = clk_prepare_enable(sport->clk_ipg); 1637 retval = clk_enable(sport->clk_ipg);
1638 if (retval) { 1638 if (retval) {
1639 clk_disable_unprepare(sport->clk_per); 1639 clk_disable(sport->clk_per);
1640 return; 1640 return;
1641 } 1641 }
1642 1642
@@ -1675,8 +1675,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1675 if (locked) 1675 if (locked)
1676 spin_unlock_irqrestore(&sport->port.lock, flags); 1676 spin_unlock_irqrestore(&sport->port.lock, flags);
1677 1677
1678 clk_disable_unprepare(sport->clk_ipg); 1678 clk_disable(sport->clk_ipg);
1679 clk_disable_unprepare(sport->clk_per); 1679 clk_disable(sport->clk_per);
1680} 1680}
1681 1681
1682/* 1682/*
@@ -1777,7 +1777,15 @@ imx_console_setup(struct console *co, char *options)
1777 1777
1778 retval = uart_set_options(&sport->port, co, baud, parity, bits, flow); 1778 retval = uart_set_options(&sport->port, co, baud, parity, bits, flow);
1779 1779
1780 clk_disable_unprepare(sport->clk_ipg); 1780 clk_disable(sport->clk_ipg);
1781 if (retval) {
1782 clk_unprepare(sport->clk_ipg);
1783 goto error_console;
1784 }
1785
1786 retval = clk_prepare(sport->clk_per);
1787 if (retval)
1788 clk_disable_unprepare(sport->clk_ipg);
1781 1789
1782error_console: 1790error_console:
1783 return retval; 1791 return retval;
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 5a3fa8913880..a660ab181cca 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -242,7 +242,10 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld)
242 atomic_inc(&buf->priority); 242 atomic_inc(&buf->priority);
243 243
244 mutex_lock(&buf->lock); 244 mutex_lock(&buf->lock);
245 while ((next = buf->head->next) != NULL) { 245 /* paired w/ release in __tty_buffer_request_room; ensures there are
246 * no pending memory accesses to the freed buffer
247 */
248 while ((next = smp_load_acquire(&buf->head->next)) != NULL) {
246 tty_buffer_free(port, buf->head); 249 tty_buffer_free(port, buf->head);
247 buf->head = next; 250 buf->head = next;
248 } 251 }
@@ -290,7 +293,10 @@ static int __tty_buffer_request_room(struct tty_port *port, size_t size,
290 if (n != NULL) { 293 if (n != NULL) {
291 n->flags = flags; 294 n->flags = flags;
292 buf->tail = n; 295 buf->tail = n;
293 b->commit = b->used; 296 /* paired w/ acquire in flush_to_ldisc(); ensures
297 * flush_to_ldisc() sees buffer data.
298 */
299 smp_store_release(&b->commit, b->used);
294 /* paired w/ acquire in flush_to_ldisc(); ensures the 300 /* paired w/ acquire in flush_to_ldisc(); ensures the
295 * latest commit value can be read before the head is 301 * latest commit value can be read before the head is
296 * advanced to the next buffer 302 * advanced to the next buffer
@@ -393,7 +399,10 @@ void tty_schedule_flip(struct tty_port *port)
393{ 399{
394 struct tty_bufhead *buf = &port->buf; 400 struct tty_bufhead *buf = &port->buf;
395 401
396 buf->tail->commit = buf->tail->used; 402 /* paired w/ acquire in flush_to_ldisc(); ensures
403 * flush_to_ldisc() sees buffer data.
404 */
405 smp_store_release(&buf->tail->commit, buf->tail->used);
397 schedule_work(&buf->work); 406 schedule_work(&buf->work);
398} 407}
399EXPORT_SYMBOL(tty_schedule_flip); 408EXPORT_SYMBOL(tty_schedule_flip);
@@ -467,7 +476,7 @@ static void flush_to_ldisc(struct work_struct *work)
467 struct tty_struct *tty; 476 struct tty_struct *tty;
468 struct tty_ldisc *disc; 477 struct tty_ldisc *disc;
469 478
470 tty = port->itty; 479 tty = READ_ONCE(port->itty);
471 if (tty == NULL) 480 if (tty == NULL)
472 return; 481 return;
473 482
@@ -491,7 +500,10 @@ static void flush_to_ldisc(struct work_struct *work)
491 * is advancing to the next buffer 500 * is advancing to the next buffer
492 */ 501 */
493 next = smp_load_acquire(&head->next); 502 next = smp_load_acquire(&head->next);
494 count = head->commit - head->read; 503 /* paired w/ release in __tty_buffer_request_room() or in
504 * tty_buffer_flush(); ensures we see the committed buffer data
505 */
506 count = smp_load_acquire(&head->commit) - head->read;
495 if (!count) { 507 if (!count) {
496 if (next == NULL) { 508 if (next == NULL) {
497 check_other_closed(tty); 509 check_other_closed(tty);
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 02785d844354..2eefaa6e3e3a 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2128,8 +2128,24 @@ retry_open:
2128 if (!noctty && 2128 if (!noctty &&
2129 current->signal->leader && 2129 current->signal->leader &&
2130 !current->signal->tty && 2130 !current->signal->tty &&
2131 tty->session == NULL) 2131 tty->session == NULL) {
2132 __proc_set_tty(tty); 2132 /*
2133 * Don't let a process that only has write access to the tty
2134 * obtain the privileges associated with having a tty as
2135 * controlling terminal (being able to reopen it with full
2136 * access through /dev/tty, being able to perform pushback).
2137 * Many distributions set the group of all ttys to "tty" and
2138 * grant write-only access to all terminals for setgid tty
2139 * binaries, which should not imply full privileges on all ttys.
2140 *
2141 * This could theoretically break old code that performs open()
2142 * on a write-only file descriptor. In that case, it might be
2143 * necessary to also permit this if
2144 * inode_permission(inode, MAY_READ) == 0.
2145 */
2146 if (filp->f_mode & FMODE_READ)
2147 __proc_set_tty(tty);
2148 }
2133 spin_unlock_irq(&current->sighand->siglock); 2149 spin_unlock_irq(&current->sighand->siglock);
2134 read_unlock(&tasklist_lock); 2150 read_unlock(&tasklist_lock);
2135 tty_unlock(tty); 2151 tty_unlock(tty);
@@ -2418,7 +2434,7 @@ static int fionbio(struct file *file, int __user *p)
2418 * Takes ->siglock() when updating signal->tty 2434 * Takes ->siglock() when updating signal->tty
2419 */ 2435 */
2420 2436
2421static int tiocsctty(struct tty_struct *tty, int arg) 2437static int tiocsctty(struct tty_struct *tty, struct file *file, int arg)
2422{ 2438{
2423 int ret = 0; 2439 int ret = 0;
2424 2440
@@ -2452,6 +2468,13 @@ static int tiocsctty(struct tty_struct *tty, int arg)
2452 goto unlock; 2468 goto unlock;
2453 } 2469 }
2454 } 2470 }
2471
2472 /* See the comment in tty_open(). */
2473 if ((file->f_mode & FMODE_READ) == 0 && !capable(CAP_SYS_ADMIN)) {
2474 ret = -EPERM;
2475 goto unlock;
2476 }
2477
2455 proc_set_tty(tty); 2478 proc_set_tty(tty);
2456unlock: 2479unlock:
2457 read_unlock(&tasklist_lock); 2480 read_unlock(&tasklist_lock);
@@ -2844,7 +2867,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2844 no_tty(); 2867 no_tty();
2845 return 0; 2868 return 0;
2846 case TIOCSCTTY: 2869 case TIOCSCTTY:
2847 return tiocsctty(tty, arg); 2870 return tiocsctty(tty, file, arg);
2848 case TIOCGPGRP: 2871 case TIOCGPGRP:
2849 return tiocgpgrp(tty, real_tty, p); 2872 return tiocgpgrp(tty, real_tty, p);
2850 case TIOCSPGRP: 2873 case TIOCSPGRP:
@@ -3151,13 +3174,18 @@ struct class *tty_class;
3151static int tty_cdev_add(struct tty_driver *driver, dev_t dev, 3174static int tty_cdev_add(struct tty_driver *driver, dev_t dev,
3152 unsigned int index, unsigned int count) 3175 unsigned int index, unsigned int count)
3153{ 3176{
3177 int err;
3178
3154 /* init here, since reused cdevs cause crashes */ 3179 /* init here, since reused cdevs cause crashes */
3155 driver->cdevs[index] = cdev_alloc(); 3180 driver->cdevs[index] = cdev_alloc();
3156 if (!driver->cdevs[index]) 3181 if (!driver->cdevs[index])
3157 return -ENOMEM; 3182 return -ENOMEM;
3158 cdev_init(driver->cdevs[index], &tty_fops); 3183 driver->cdevs[index]->ops = &tty_fops;
3159 driver->cdevs[index]->owner = driver->owner; 3184 driver->cdevs[index]->owner = driver->owner;
3160 return cdev_add(driver->cdevs[index], dev, count); 3185 err = cdev_add(driver->cdevs[index], dev, count);
3186 if (err)
3187 kobject_put(&driver->cdevs[index]->kobj);
3188 return err;
3161} 3189}
3162 3190
3163/** 3191/**
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d85abfed84cc..f5a381945db2 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -54,6 +54,13 @@ static const struct usb_device_id usb_quirk_list[] = {
54 { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, 54 { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
55 { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, 55 { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
56 56
57 /* Logitech ConferenceCam CC3000e */
58 { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
59 { USB_DEVICE(0x046d, 0x0848), .driver_info = USB_QUIRK_DELAY_INIT },
60
61 /* Logitech PTZ Pro Camera */
62 { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT },
63
57 /* Logitech Quickcam Fusion */ 64 /* Logitech Quickcam Fusion */
58 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, 65 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
59 66
@@ -78,6 +85,12 @@ static const struct usb_device_id usb_quirk_list[] = {
78 /* Philips PSC805 audio device */ 85 /* Philips PSC805 audio device */
79 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, 86 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
80 87
88 /* Plantronic Audio 655 DSP */
89 { USB_DEVICE(0x047f, 0xc008), .driver_info = USB_QUIRK_RESET_RESUME },
90
91 /* Plantronic Audio 648 USB */
92 { USB_DEVICE(0x047f, 0xc013), .driver_info = USB_QUIRK_RESET_RESUME },
93
81 /* Artisman Watchdog Dongle */ 94 /* Artisman Watchdog Dongle */
82 { USB_DEVICE(0x04b4, 0x0526), .driver_info = 95 { USB_DEVICE(0x04b4, 0x0526), .driver_info =
83 USB_QUIRK_CONFIG_INTF_STRINGS }, 96 USB_QUIRK_CONFIG_INTF_STRINGS },
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index d1b81539d632..d6199507f861 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -159,8 +159,10 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
159 bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool, 159 bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool,
160 GFP_ATOMIC, 160 GFP_ATOMIC,
161 &dma); 161 &dma);
162 if (!bd_table->start_bd) 162 if (!bd_table->start_bd) {
163 kfree(bd_table);
163 goto fail; 164 goto fail;
165 }
164 166
165 bd_table->dma = dma; 167 bd_table->dma = dma;
166 168
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index 3ad5d19e4d04..23c794813e6a 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -472,7 +472,7 @@ static int chaoskey_rng_read(struct hwrng *rng, void *data,
472 if (this_time > max) 472 if (this_time > max)
473 this_time = max; 473 this_time = max;
474 474
475 memcpy(data, dev->buf, this_time); 475 memcpy(data, dev->buf + dev->used, this_time);
476 476
477 dev->used += this_time; 477 dev->used += this_time;
478 478
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 7b98e1d9194c..d82fa36c3465 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -476,6 +476,11 @@ static const struct of_device_id usbhs_of_match[] = {
476 .compatible = "renesas,usbhs-r8a7794", 476 .compatible = "renesas,usbhs-r8a7794",
477 .data = (void *)USBHS_TYPE_RCAR_GEN2, 477 .data = (void *)USBHS_TYPE_RCAR_GEN2,
478 }, 478 },
479 {
480 /* Gen3 is compatible with Gen2 */
481 .compatible = "renesas,usbhs-r8a7795",
482 .data = (void *)USBHS_TYPE_RCAR_GEN2,
483 },
479 { }, 484 { },
480}; 485};
481MODULE_DEVICE_TABLE(of, usbhs_of_match); 486MODULE_DEVICE_TABLE(of, usbhs_of_match);
@@ -493,7 +498,7 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
493 return NULL; 498 return NULL;
494 499
495 dparam = &info->driver_param; 500 dparam = &info->driver_param;
496 dparam->type = of_id ? (u32)of_id->data : 0; 501 dparam->type = of_id ? (uintptr_t)of_id->data : 0;
497 if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp)) 502 if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp))
498 dparam->buswait_bwait = tmp; 503 dparam->buswait_bwait = tmp;
499 gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0, 504 gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0,
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c
index 0e5fde1d3ffb..9f9a7bef1ff6 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -752,7 +752,7 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev,
752 if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) { 752 if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) {
753 dev_err(dev, "Invalid waveform\n"); 753 dev_err(dev, "Invalid waveform\n");
754 err = -EINVAL; 754 err = -EINVAL;
755 goto err_failed; 755 goto err_fw;
756 } 756 }
757 757
758 mutex_lock(&(par->io_lock)); 758 mutex_lock(&(par->io_lock));
@@ -762,13 +762,15 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev,
762 mutex_unlock(&(par->io_lock)); 762 mutex_unlock(&(par->io_lock));
763 if (err < 0) { 763 if (err < 0) {
764 dev_err(dev, "Failed to store broadsheet waveform\n"); 764 dev_err(dev, "Failed to store broadsheet waveform\n");
765 goto err_failed; 765 goto err_fw;
766 } 766 }
767 767
768 dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size); 768 dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size);
769 769
770 return len; 770 err = len;
771 771
772err_fw:
773 release_firmware(fw_entry);
772err_failed: 774err_failed:
773 return err; 775 return err;
774} 776}
diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index 7fa2e6f9e322..b335c1ae8625 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -1628,9 +1628,16 @@ static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state)
1628static int fsl_diu_resume(struct platform_device *ofdev) 1628static int fsl_diu_resume(struct platform_device *ofdev)
1629{ 1629{
1630 struct fsl_diu_data *data; 1630 struct fsl_diu_data *data;
1631 unsigned int i;
1631 1632
1632 data = dev_get_drvdata(&ofdev->dev); 1633 data = dev_get_drvdata(&ofdev->dev);
1633 enable_lcdc(data->fsl_diu_info); 1634
1635 fsl_diu_enable_interrupts(data);
1636 update_lcdc(data->fsl_diu_info);
1637 for (i = 0; i < NUM_AOIS; i++) {
1638 if (data->mfb[i].count)
1639 fsl_diu_enable_panel(&data->fsl_diu_info[i]);
1640 }
1634 1641
1635 return 0; 1642 return 0;
1636} 1643}
diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index 9b8bebdf8f86..f9ec5c0484fa 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -831,6 +831,7 @@ static struct of_device_id of_platform_mb862xx_tbl[] = {
831 { .compatible = "fujitsu,coral", }, 831 { .compatible = "fujitsu,coral", },
832 { /* end */ } 832 { /* end */ }
833}; 833};
834MODULE_DEVICE_TABLE(of, of_platform_mb862xx_tbl);
834 835
835static struct platform_driver of_platform_mb862xxfb_driver = { 836static struct platform_driver of_platform_mb862xxfb_driver = {
836 .driver = { 837 .driver = {
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
index a8ce920fa797..d811e6dcaef7 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
@@ -294,7 +294,7 @@ static int dvic_probe_of(struct platform_device *pdev)
294 294
295 adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); 295 adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0);
296 if (adapter_node) { 296 if (adapter_node) {
297 adapter = of_find_i2c_adapter_by_node(adapter_node); 297 adapter = of_get_i2c_adapter_by_node(adapter_node);
298 if (adapter == NULL) { 298 if (adapter == NULL) {
299 dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n"); 299 dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n");
300 omap_dss_put_device(ddata->in); 300 omap_dss_put_device(ddata->in);
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
index 90cbc4c3406c..c581231c74a5 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
@@ -898,6 +898,7 @@ static const struct of_device_id acx565akm_of_match[] = {
898 { .compatible = "omapdss,sony,acx565akm", }, 898 { .compatible = "omapdss,sony,acx565akm", },
899 {}, 899 {},
900}; 900};
901MODULE_DEVICE_TABLE(of, acx565akm_of_match);
901 902
902static struct spi_driver acx565akm_driver = { 903static struct spi_driver acx565akm_driver = {
903 .driver = { 904 .driver = {
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 7ed9a227f5ea..01b43e9ce941 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -226,7 +226,7 @@ static void blade_image_blit(struct tridentfb_par *par, const char *data,
226 writemmr(par, DST1, point(x, y)); 226 writemmr(par, DST1, point(x, y));
227 writemmr(par, DST2, point(x + w - 1, y + h - 1)); 227 writemmr(par, DST2, point(x + w - 1, y + h - 1));
228 228
229 memcpy(par->io_virt + 0x10000, data, 4 * size); 229 iowrite32_rep(par->io_virt + 0x10000, data, size);
230} 230}
231 231
232static void blade_copy_rect(struct tridentfb_par *par, 232static void blade_copy_rect(struct tridentfb_par *par,
@@ -673,8 +673,14 @@ static int get_nativex(struct tridentfb_par *par)
673static inline void set_lwidth(struct tridentfb_par *par, int width) 673static inline void set_lwidth(struct tridentfb_par *par, int width)
674{ 674{
675 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF); 675 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF);
676 write3X4(par, AddColReg, 676 /* chips older than TGUI9660 have only 1 width bit in AddColReg */
677 (read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4)); 677 /* touching the other one breaks I2C/DDC */
678 if (par->chip_id == TGUI9440 || par->chip_id == CYBER9320)
679 write3X4(par, AddColReg,
680 (read3X4(par, AddColReg) & 0xEF) | ((width & 0x100) >> 4));
681 else
682 write3X4(par, AddColReg,
683 (read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4));
678} 684}
679 685
680/* For resolutions smaller than FP resolution stretch */ 686/* For resolutions smaller than FP resolution stretch */
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 32d8275e4c88..8a1076beecd3 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -210,6 +210,7 @@ struct display_timings *of_get_display_timings(struct device_node *np)
210 */ 210 */
211 pr_err("%s: error in timing %d\n", 211 pr_err("%s: error in timing %d\n",
212 of_node_full_name(np), disp->num_timings + 1); 212 of_node_full_name(np), disp->num_timings + 1);
213 kfree(dt);
213 goto timingfail; 214 goto timingfail;
214 } 215 }
215 216
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index ecbc63d3143e..9a2ec79e8cfb 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1828,7 +1828,6 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root,
1828 int found = 0; 1828 int found = 0;
1829 struct extent_buffer *eb; 1829 struct extent_buffer *eb;
1830 struct btrfs_inode_extref *extref; 1830 struct btrfs_inode_extref *extref;
1831 struct extent_buffer *leaf;
1832 u32 item_size; 1831 u32 item_size;
1833 u32 cur_offset; 1832 u32 cur_offset;
1834 unsigned long ptr; 1833 unsigned long ptr;
@@ -1856,9 +1855,8 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root,
1856 btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); 1855 btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
1857 btrfs_release_path(path); 1856 btrfs_release_path(path);
1858 1857
1859 leaf = path->nodes[0]; 1858 item_size = btrfs_item_size_nr(eb, slot);
1860 item_size = btrfs_item_size_nr(leaf, slot); 1859 ptr = btrfs_item_ptr_offset(eb, slot);
1861 ptr = btrfs_item_ptr_offset(leaf, slot);
1862 cur_offset = 0; 1860 cur_offset = 0;
1863 1861
1864 while (cur_offset < item_size) { 1862 while (cur_offset < item_size) {
@@ -1872,7 +1870,7 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root,
1872 if (ret) 1870 if (ret)
1873 break; 1871 break;
1874 1872
1875 cur_offset += btrfs_inode_extref_name_len(leaf, extref); 1873 cur_offset += btrfs_inode_extref_name_len(eb, extref);
1876 cur_offset += sizeof(*extref); 1874 cur_offset += sizeof(*extref);
1877 } 1875 }
1878 btrfs_tree_read_unlock_blocking(eb); 1876 btrfs_tree_read_unlock_blocking(eb);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 295795aebe0b..1e60d00d4ea7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2847,6 +2847,8 @@ int open_ctree(struct super_block *sb,
2847 !extent_buffer_uptodate(chunk_root->node)) { 2847 !extent_buffer_uptodate(chunk_root->node)) {
2848 printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n", 2848 printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n",
2849 sb->s_id); 2849 sb->s_id);
2850 if (!IS_ERR(chunk_root->node))
2851 free_extent_buffer(chunk_root->node);
2850 chunk_root->node = NULL; 2852 chunk_root->node = NULL;
2851 goto fail_tree_roots; 2853 goto fail_tree_roots;
2852 } 2854 }
@@ -2885,6 +2887,8 @@ retry_root_backup:
2885 !extent_buffer_uptodate(tree_root->node)) { 2887 !extent_buffer_uptodate(tree_root->node)) {
2886 printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n", 2888 printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n",
2887 sb->s_id); 2889 sb->s_id);
2890 if (!IS_ERR(tree_root->node))
2891 free_extent_buffer(tree_root->node);
2888 tree_root->node = NULL; 2892 tree_root->node = NULL;
2889 goto recovery_tree_root; 2893 goto recovery_tree_root;
2890 } 2894 }
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 8d052209f473..2513a7f53334 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -112,11 +112,11 @@ static struct dentry *btrfs_fh_to_parent(struct super_block *sb, struct fid *fh,
112 u32 generation; 112 u32 generation;
113 113
114 if (fh_type == FILEID_BTRFS_WITH_PARENT) { 114 if (fh_type == FILEID_BTRFS_WITH_PARENT) {
115 if (fh_len != BTRFS_FID_SIZE_CONNECTABLE) 115 if (fh_len < BTRFS_FID_SIZE_CONNECTABLE)
116 return NULL; 116 return NULL;
117 root_objectid = fid->root_objectid; 117 root_objectid = fid->root_objectid;
118 } else if (fh_type == FILEID_BTRFS_WITH_PARENT_ROOT) { 118 } else if (fh_type == FILEID_BTRFS_WITH_PARENT_ROOT) {
119 if (fh_len != BTRFS_FID_SIZE_CONNECTABLE_ROOT) 119 if (fh_len < BTRFS_FID_SIZE_CONNECTABLE_ROOT)
120 return NULL; 120 return NULL;
121 root_objectid = fid->parent_root_objectid; 121 root_objectid = fid->parent_root_objectid;
122 } else 122 } else
@@ -136,11 +136,11 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
136 u32 generation; 136 u32 generation;
137 137
138 if ((fh_type != FILEID_BTRFS_WITH_PARENT || 138 if ((fh_type != FILEID_BTRFS_WITH_PARENT ||
139 fh_len != BTRFS_FID_SIZE_CONNECTABLE) && 139 fh_len < BTRFS_FID_SIZE_CONNECTABLE) &&
140 (fh_type != FILEID_BTRFS_WITH_PARENT_ROOT || 140 (fh_type != FILEID_BTRFS_WITH_PARENT_ROOT ||
141 fh_len != BTRFS_FID_SIZE_CONNECTABLE_ROOT) && 141 fh_len < BTRFS_FID_SIZE_CONNECTABLE_ROOT) &&
142 (fh_type != FILEID_BTRFS_WITHOUT_PARENT || 142 (fh_type != FILEID_BTRFS_WITHOUT_PARENT ||
143 fh_len != BTRFS_FID_SIZE_NON_CONNECTABLE)) 143 fh_len < BTRFS_FID_SIZE_NON_CONNECTABLE))
144 return NULL; 144 return NULL;
145 145
146 objectid = fid->objectid; 146 objectid = fid->objectid;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9f9604201333..601d7d45d164 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2828,6 +2828,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
2828 struct btrfs_delayed_ref_head *head; 2828 struct btrfs_delayed_ref_head *head;
2829 int ret; 2829 int ret;
2830 int run_all = count == (unsigned long)-1; 2830 int run_all = count == (unsigned long)-1;
2831 bool can_flush_pending_bgs = trans->can_flush_pending_bgs;
2831 2832
2832 /* We'll clean this up in btrfs_cleanup_transaction */ 2833 /* We'll clean this up in btrfs_cleanup_transaction */
2833 if (trans->aborted) 2834 if (trans->aborted)
@@ -2844,6 +2845,7 @@ again:
2844#ifdef SCRAMBLE_DELAYED_REFS 2845#ifdef SCRAMBLE_DELAYED_REFS
2845 delayed_refs->run_delayed_start = find_middle(&delayed_refs->root); 2846 delayed_refs->run_delayed_start = find_middle(&delayed_refs->root);
2846#endif 2847#endif
2848 trans->can_flush_pending_bgs = false;
2847 ret = __btrfs_run_delayed_refs(trans, root, count); 2849 ret = __btrfs_run_delayed_refs(trans, root, count);
2848 if (ret < 0) { 2850 if (ret < 0) {
2849 btrfs_abort_transaction(trans, root, ret); 2851 btrfs_abort_transaction(trans, root, ret);
@@ -2893,6 +2895,7 @@ again:
2893 } 2895 }
2894out: 2896out:
2895 assert_qgroups_uptodate(trans); 2897 assert_qgroups_uptodate(trans);
2898 trans->can_flush_pending_bgs = can_flush_pending_bgs;
2896 return 0; 2899 return 0;
2897} 2900}
2898 2901
@@ -4306,7 +4309,8 @@ out:
4306 * the block groups that were made dirty during the lifetime of the 4309 * the block groups that were made dirty during the lifetime of the
4307 * transaction. 4310 * transaction.
4308 */ 4311 */
4309 if (trans->chunk_bytes_reserved >= (2 * 1024 * 1024ull)) { 4312 if (trans->can_flush_pending_bgs &&
4313 trans->chunk_bytes_reserved >= (2 * 1024 * 1024ull)) {
4310 btrfs_create_pending_block_groups(trans, trans->root); 4314 btrfs_create_pending_block_groups(trans, trans->root);
4311 btrfs_trans_release_chunk_metadata(trans); 4315 btrfs_trans_release_chunk_metadata(trans);
4312 } 4316 }
@@ -9560,7 +9564,9 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans,
9560 struct btrfs_block_group_item item; 9564 struct btrfs_block_group_item item;
9561 struct btrfs_key key; 9565 struct btrfs_key key;
9562 int ret = 0; 9566 int ret = 0;
9567 bool can_flush_pending_bgs = trans->can_flush_pending_bgs;
9563 9568
9569 trans->can_flush_pending_bgs = false;
9564 list_for_each_entry_safe(block_group, tmp, &trans->new_bgs, bg_list) { 9570 list_for_each_entry_safe(block_group, tmp, &trans->new_bgs, bg_list) {
9565 if (ret) 9571 if (ret)
9566 goto next; 9572 goto next;
@@ -9581,6 +9587,7 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans,
9581next: 9587next:
9582 list_del_init(&block_group->bg_list); 9588 list_del_init(&block_group->bg_list);
9583 } 9589 }
9590 trans->can_flush_pending_bgs = can_flush_pending_bgs;
9584} 9591}
9585 9592
9586int btrfs_make_block_group(struct btrfs_trans_handle *trans, 9593int btrfs_make_block_group(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index e2357e31609a..3915c9473e94 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3132,12 +3132,12 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree,
3132 get_extent_t *get_extent, 3132 get_extent_t *get_extent,
3133 struct extent_map **em_cached, 3133 struct extent_map **em_cached,
3134 struct bio **bio, int mirror_num, 3134 struct bio **bio, int mirror_num,
3135 unsigned long *bio_flags, int rw) 3135 unsigned long *bio_flags, int rw,
3136 u64 *prev_em_start)
3136{ 3137{
3137 struct inode *inode; 3138 struct inode *inode;
3138 struct btrfs_ordered_extent *ordered; 3139 struct btrfs_ordered_extent *ordered;
3139 int index; 3140 int index;
3140 u64 prev_em_start = (u64)-1;
3141 3141
3142 inode = pages[0]->mapping->host; 3142 inode = pages[0]->mapping->host;
3143 while (1) { 3143 while (1) {
@@ -3153,7 +3153,7 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree,
3153 3153
3154 for (index = 0; index < nr_pages; index++) { 3154 for (index = 0; index < nr_pages; index++) {
3155 __do_readpage(tree, pages[index], get_extent, em_cached, bio, 3155 __do_readpage(tree, pages[index], get_extent, em_cached, bio,
3156 mirror_num, bio_flags, rw, &prev_em_start); 3156 mirror_num, bio_flags, rw, prev_em_start);
3157 page_cache_release(pages[index]); 3157 page_cache_release(pages[index]);
3158 } 3158 }
3159} 3159}
@@ -3163,7 +3163,8 @@ static void __extent_readpages(struct extent_io_tree *tree,
3163 int nr_pages, get_extent_t *get_extent, 3163 int nr_pages, get_extent_t *get_extent,
3164 struct extent_map **em_cached, 3164 struct extent_map **em_cached,
3165 struct bio **bio, int mirror_num, 3165 struct bio **bio, int mirror_num,
3166 unsigned long *bio_flags, int rw) 3166 unsigned long *bio_flags, int rw,
3167 u64 *prev_em_start)
3167{ 3168{
3168 u64 start = 0; 3169 u64 start = 0;
3169 u64 end = 0; 3170 u64 end = 0;
@@ -3184,7 +3185,7 @@ static void __extent_readpages(struct extent_io_tree *tree,
3184 index - first_index, start, 3185 index - first_index, start,
3185 end, get_extent, em_cached, 3186 end, get_extent, em_cached,
3186 bio, mirror_num, bio_flags, 3187 bio, mirror_num, bio_flags,
3187 rw); 3188 rw, prev_em_start);
3188 start = page_start; 3189 start = page_start;
3189 end = start + PAGE_CACHE_SIZE - 1; 3190 end = start + PAGE_CACHE_SIZE - 1;
3190 first_index = index; 3191 first_index = index;
@@ -3195,7 +3196,8 @@ static void __extent_readpages(struct extent_io_tree *tree,
3195 __do_contiguous_readpages(tree, &pages[first_index], 3196 __do_contiguous_readpages(tree, &pages[first_index],
3196 index - first_index, start, 3197 index - first_index, start,
3197 end, get_extent, em_cached, bio, 3198 end, get_extent, em_cached, bio,
3198 mirror_num, bio_flags, rw); 3199 mirror_num, bio_flags, rw,
3200 prev_em_start);
3199} 3201}
3200 3202
3201static int __extent_read_full_page(struct extent_io_tree *tree, 3203static int __extent_read_full_page(struct extent_io_tree *tree,
@@ -4207,6 +4209,7 @@ int extent_readpages(struct extent_io_tree *tree,
4207 struct page *page; 4209 struct page *page;
4208 struct extent_map *em_cached = NULL; 4210 struct extent_map *em_cached = NULL;
4209 int nr = 0; 4211 int nr = 0;
4212 u64 prev_em_start = (u64)-1;
4210 4213
4211 for (page_idx = 0; page_idx < nr_pages; page_idx++) { 4214 for (page_idx = 0; page_idx < nr_pages; page_idx++) {
4212 page = list_entry(pages->prev, struct page, lru); 4215 page = list_entry(pages->prev, struct page, lru);
@@ -4223,12 +4226,12 @@ int extent_readpages(struct extent_io_tree *tree,
4223 if (nr < ARRAY_SIZE(pagepool)) 4226 if (nr < ARRAY_SIZE(pagepool))
4224 continue; 4227 continue;
4225 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached, 4228 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached,
4226 &bio, 0, &bio_flags, READ); 4229 &bio, 0, &bio_flags, READ, &prev_em_start);
4227 nr = 0; 4230 nr = 0;
4228 } 4231 }
4229 if (nr) 4232 if (nr)
4230 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached, 4233 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached,
4231 &bio, 0, &bio_flags, READ); 4234 &bio, 0, &bio_flags, READ, &prev_em_start);
4232 4235
4233 if (em_cached) 4236 if (em_cached)
4234 free_extent_map(em_cached); 4237 free_extent_map(em_cached);
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 0adf5422fce9..3e3e6130637f 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4639,6 +4639,11 @@ locked:
4639 bctl->flags |= BTRFS_BALANCE_TYPE_MASK; 4639 bctl->flags |= BTRFS_BALANCE_TYPE_MASK;
4640 } 4640 }
4641 4641
4642 if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) {
4643 ret = -EINVAL;
4644 goto out_bargs;
4645 }
4646
4642do_balance: 4647do_balance:
4643 /* 4648 /*
4644 * Ownership of bctl and mutually_exclusive_operation_running 4649 * Ownership of bctl and mutually_exclusive_operation_running
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index aa72bfd28f7d..a739b825bdd3 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1920,10 +1920,12 @@ static int did_overwrite_ref(struct send_ctx *sctx,
1920 /* 1920 /*
1921 * We know that it is or will be overwritten. Check this now. 1921 * We know that it is or will be overwritten. Check this now.
1922 * The current inode being processed might have been the one that caused 1922 * The current inode being processed might have been the one that caused
1923 * inode 'ino' to be orphanized, therefore ow_inode can actually be the 1923 * inode 'ino' to be orphanized, therefore check if ow_inode matches
1924 * same as sctx->send_progress. 1924 * the current inode being processed.
1925 */ 1925 */
1926 if (ow_inode <= sctx->send_progress) 1926 if ((ow_inode < sctx->send_progress) ||
1927 (ino != sctx->cur_ino && ow_inode == sctx->cur_ino &&
1928 gen == sctx->cur_inode_gen))
1927 ret = 1; 1929 ret = 1;
1928 else 1930 else
1929 ret = 0; 1931 ret = 0;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 74bc3338418b..a5b06442f0bf 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -557,6 +557,7 @@ again:
557 h->delayed_ref_elem.seq = 0; 557 h->delayed_ref_elem.seq = 0;
558 h->type = type; 558 h->type = type;
559 h->allocating_chunk = false; 559 h->allocating_chunk = false;
560 h->can_flush_pending_bgs = true;
560 h->reloc_reserved = false; 561 h->reloc_reserved = false;
561 h->sync = false; 562 h->sync = false;
562 INIT_LIST_HEAD(&h->qgroup_ref_list); 563 INIT_LIST_HEAD(&h->qgroup_ref_list);
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 87964bf8892d..a994bb097ee5 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -118,6 +118,7 @@ struct btrfs_trans_handle {
118 short aborted; 118 short aborted;
119 short adding_csums; 119 short adding_csums;
120 bool allocating_chunk; 120 bool allocating_chunk;
121 bool can_flush_pending_bgs;
121 bool reloc_reserved; 122 bool reloc_reserved;
122 bool sync; 123 bool sync;
123 unsigned int type; 124 unsigned int type;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 2ca784a14e84..595279a8b99f 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -376,6 +376,14 @@ struct map_lookup {
376#define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4) 376#define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
377#define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5) 377#define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
378 378
379#define BTRFS_BALANCE_ARGS_MASK \
380 (BTRFS_BALANCE_ARGS_PROFILES | \
381 BTRFS_BALANCE_ARGS_USAGE | \
382 BTRFS_BALANCE_ARGS_DEVID | \
383 BTRFS_BALANCE_ARGS_DRANGE | \
384 BTRFS_BALANCE_ARGS_VRANGE | \
385 BTRFS_BALANCE_ARGS_LIMIT)
386
379/* 387/*
380 * Profile changing flags. When SOFT is set we won't relocate chunk if 388 * Profile changing flags. When SOFT is set we won't relocate chunk if
381 * it already has the target profile (even though it may be 389 * it already has the target profile (even though it may be
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 27aea110e923..c3cc1609025f 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -136,5 +136,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
136extern const struct export_operations cifs_export_ops; 136extern const struct export_operations cifs_export_ops;
137#endif /* CONFIG_CIFS_NFSD_EXPORT */ 137#endif /* CONFIG_CIFS_NFSD_EXPORT */
138 138
139#define CIFS_VERSION "2.07" 139#define CIFS_VERSION "2.08"
140#endif /* _CIFSFS_H */ 140#endif /* _CIFSFS_H */
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2a6af1508af..62203c387db4 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3380,6 +3380,7 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
3380 struct page *page, *tpage; 3380 struct page *page, *tpage;
3381 unsigned int expected_index; 3381 unsigned int expected_index;
3382 int rc; 3382 int rc;
3383 gfp_t gfp = GFP_KERNEL & mapping_gfp_mask(mapping);
3383 3384
3384 INIT_LIST_HEAD(tmplist); 3385 INIT_LIST_HEAD(tmplist);
3385 3386
@@ -3392,7 +3393,7 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
3392 */ 3393 */
3393 __set_page_locked(page); 3394 __set_page_locked(page);
3394 rc = add_to_page_cache_locked(page, mapping, 3395 rc = add_to_page_cache_locked(page, mapping,
3395 page->index, GFP_KERNEL); 3396 page->index, gfp);
3396 3397
3397 /* give up if we can't stick it in the cache */ 3398 /* give up if we can't stick it in the cache */
3398 if (rc) { 3399 if (rc) {
@@ -3418,8 +3419,7 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
3418 break; 3419 break;
3419 3420
3420 __set_page_locked(page); 3421 __set_page_locked(page);
3421 if (add_to_page_cache_locked(page, mapping, page->index, 3422 if (add_to_page_cache_locked(page, mapping, page->index, gfp)) {
3422 GFP_KERNEL)) {
3423 __clear_page_locked(page); 3423 __clear_page_locked(page);
3424 break; 3424 break;
3425 } 3425 }
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index f621b44cb800..6b66dd5d1540 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2034,7 +2034,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
2034 struct tcon_link *tlink = NULL; 2034 struct tcon_link *tlink = NULL;
2035 struct cifs_tcon *tcon = NULL; 2035 struct cifs_tcon *tcon = NULL;
2036 struct TCP_Server_Info *server; 2036 struct TCP_Server_Info *server;
2037 struct cifs_io_parms io_parms;
2038 2037
2039 /* 2038 /*
2040 * To avoid spurious oplock breaks from server, in the case of 2039 * To avoid spurious oplock breaks from server, in the case of
@@ -2056,18 +2055,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
2056 rc = -ENOSYS; 2055 rc = -ENOSYS;
2057 cifsFileInfo_put(open_file); 2056 cifsFileInfo_put(open_file);
2058 cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc); 2057 cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc);
2059 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
2060 unsigned int bytes_written;
2061
2062 io_parms.netfid = open_file->fid.netfid;
2063 io_parms.pid = open_file->pid;
2064 io_parms.tcon = tcon;
2065 io_parms.offset = 0;
2066 io_parms.length = attrs->ia_size;
2067 rc = CIFSSMBWrite(xid, &io_parms, &bytes_written,
2068 NULL, NULL, 1);
2069 cifs_dbg(FYI, "Wrt seteof rc %d\n", rc);
2070 }
2071 } else 2058 } else
2072 rc = -EINVAL; 2059 rc = -EINVAL;
2073 2060
@@ -2093,28 +2080,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
2093 else 2080 else
2094 rc = -ENOSYS; 2081 rc = -ENOSYS;
2095 cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc); 2082 cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc);
2096 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
2097 __u16 netfid;
2098 int oplock = 0;
2099 2083
2100 rc = SMBLegacyOpen(xid, tcon, full_path, FILE_OPEN,
2101 GENERIC_WRITE, CREATE_NOT_DIR, &netfid,
2102 &oplock, NULL, cifs_sb->local_nls,
2103 cifs_remap(cifs_sb));
2104 if (rc == 0) {
2105 unsigned int bytes_written;
2106
2107 io_parms.netfid = netfid;
2108 io_parms.pid = current->tgid;
2109 io_parms.tcon = tcon;
2110 io_parms.offset = 0;
2111 io_parms.length = attrs->ia_size;
2112 rc = CIFSSMBWrite(xid, &io_parms, &bytes_written, NULL,
2113 NULL, 1);
2114 cifs_dbg(FYI, "wrt seteof rc %d\n", rc);
2115 CIFSSMBClose(xid, tcon, netfid);
2116 }
2117 }
2118 if (tlink) 2084 if (tlink)
2119 cifs_put_tlink(tlink); 2085 cifs_put_tlink(tlink);
2120 2086
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index ce83e2edbe0a..597a417ba94d 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -922,7 +922,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
922 if (tcon && tcon->bad_network_name) 922 if (tcon && tcon->bad_network_name)
923 return -ENOENT; 923 return -ENOENT;
924 924
925 if ((tcon->seal) && 925 if ((tcon && tcon->seal) &&
926 ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) { 926 ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) {
927 cifs_dbg(VFS, "encryption requested but no server support"); 927 cifs_dbg(VFS, "encryption requested but no server support");
928 return -EOPNOTSUPP; 928 return -EOPNOTSUPP;
diff --git a/fs/dax.c b/fs/dax.c
index bcfb14bfc1e4..a86d3cc2b389 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -285,6 +285,7 @@ static int copy_user_bh(struct page *to, struct buffer_head *bh,
285static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh, 285static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh,
286 struct vm_area_struct *vma, struct vm_fault *vmf) 286 struct vm_area_struct *vma, struct vm_fault *vmf)
287{ 287{
288 struct address_space *mapping = inode->i_mapping;
288 sector_t sector = bh->b_blocknr << (inode->i_blkbits - 9); 289 sector_t sector = bh->b_blocknr << (inode->i_blkbits - 9);
289 unsigned long vaddr = (unsigned long)vmf->virtual_address; 290 unsigned long vaddr = (unsigned long)vmf->virtual_address;
290 void __pmem *addr; 291 void __pmem *addr;
@@ -292,6 +293,8 @@ static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh,
292 pgoff_t size; 293 pgoff_t size;
293 int error; 294 int error;
294 295
296 i_mmap_lock_read(mapping);
297
295 /* 298 /*
296 * Check truncate didn't happen while we were allocating a block. 299 * Check truncate didn't happen while we were allocating a block.
297 * If it did, this block may or may not be still allocated to the 300 * If it did, this block may or may not be still allocated to the
@@ -321,6 +324,8 @@ static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh,
321 error = vm_insert_mixed(vma, vaddr, pfn); 324 error = vm_insert_mixed(vma, vaddr, pfn);
322 325
323 out: 326 out:
327 i_mmap_unlock_read(mapping);
328
324 return error; 329 return error;
325} 330}
326 331
@@ -382,17 +387,15 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
382 * from a read fault and we've raced with a truncate 387 * from a read fault and we've raced with a truncate
383 */ 388 */
384 error = -EIO; 389 error = -EIO;
385 goto unlock; 390 goto unlock_page;
386 } 391 }
387 } else {
388 i_mmap_lock_write(mapping);
389 } 392 }
390 393
391 error = get_block(inode, block, &bh, 0); 394 error = get_block(inode, block, &bh, 0);
392 if (!error && (bh.b_size < PAGE_SIZE)) 395 if (!error && (bh.b_size < PAGE_SIZE))
393 error = -EIO; /* fs corruption? */ 396 error = -EIO; /* fs corruption? */
394 if (error) 397 if (error)
395 goto unlock; 398 goto unlock_page;
396 399
397 if (!buffer_mapped(&bh) && !buffer_unwritten(&bh) && !vmf->cow_page) { 400 if (!buffer_mapped(&bh) && !buffer_unwritten(&bh) && !vmf->cow_page) {
398 if (vmf->flags & FAULT_FLAG_WRITE) { 401 if (vmf->flags & FAULT_FLAG_WRITE) {
@@ -403,9 +406,8 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
403 if (!error && (bh.b_size < PAGE_SIZE)) 406 if (!error && (bh.b_size < PAGE_SIZE))
404 error = -EIO; 407 error = -EIO;
405 if (error) 408 if (error)
406 goto unlock; 409 goto unlock_page;
407 } else { 410 } else {
408 i_mmap_unlock_write(mapping);
409 return dax_load_hole(mapping, page, vmf); 411 return dax_load_hole(mapping, page, vmf);
410 } 412 }
411 } 413 }
@@ -417,15 +419,17 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
417 else 419 else
418 clear_user_highpage(new_page, vaddr); 420 clear_user_highpage(new_page, vaddr);
419 if (error) 421 if (error)
420 goto unlock; 422 goto unlock_page;
421 vmf->page = page; 423 vmf->page = page;
422 if (!page) { 424 if (!page) {
425 i_mmap_lock_read(mapping);
423 /* Check we didn't race with truncate */ 426 /* Check we didn't race with truncate */
424 size = (i_size_read(inode) + PAGE_SIZE - 1) >> 427 size = (i_size_read(inode) + PAGE_SIZE - 1) >>
425 PAGE_SHIFT; 428 PAGE_SHIFT;
426 if (vmf->pgoff >= size) { 429 if (vmf->pgoff >= size) {
430 i_mmap_unlock_read(mapping);
427 error = -EIO; 431 error = -EIO;
428 goto unlock; 432 goto out;
429 } 433 }
430 } 434 }
431 return VM_FAULT_LOCKED; 435 return VM_FAULT_LOCKED;
@@ -461,8 +465,6 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
461 WARN_ON_ONCE(!(vmf->flags & FAULT_FLAG_WRITE)); 465 WARN_ON_ONCE(!(vmf->flags & FAULT_FLAG_WRITE));
462 } 466 }
463 467
464 if (!page)
465 i_mmap_unlock_write(mapping);
466 out: 468 out:
467 if (error == -ENOMEM) 469 if (error == -ENOMEM)
468 return VM_FAULT_OOM | major; 470 return VM_FAULT_OOM | major;
@@ -471,14 +473,11 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
471 return VM_FAULT_SIGBUS | major; 473 return VM_FAULT_SIGBUS | major;
472 return VM_FAULT_NOPAGE | major; 474 return VM_FAULT_NOPAGE | major;
473 475
474 unlock: 476 unlock_page:
475 if (page) { 477 if (page) {
476 unlock_page(page); 478 unlock_page(page);
477 page_cache_release(page); 479 page_cache_release(page);
478 } else {
479 i_mmap_unlock_write(mapping);
480 } 480 }
481
482 goto out; 481 goto out;
483} 482}
484EXPORT_SYMBOL(__dax_fault); 483EXPORT_SYMBOL(__dax_fault);
@@ -556,10 +555,10 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
556 block = (sector_t)pgoff << (PAGE_SHIFT - blkbits); 555 block = (sector_t)pgoff << (PAGE_SHIFT - blkbits);
557 556
558 bh.b_size = PMD_SIZE; 557 bh.b_size = PMD_SIZE;
559 i_mmap_lock_write(mapping);
560 length = get_block(inode, block, &bh, write); 558 length = get_block(inode, block, &bh, write);
561 if (length) 559 if (length)
562 return VM_FAULT_SIGBUS; 560 return VM_FAULT_SIGBUS;
561 i_mmap_lock_read(mapping);
563 562
564 /* 563 /*
565 * If the filesystem isn't willing to tell us the length of a hole, 564 * If the filesystem isn't willing to tell us the length of a hole,
@@ -569,36 +568,14 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
569 if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) 568 if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE)
570 goto fallback; 569 goto fallback;
571 570
572 sector = bh.b_blocknr << (blkbits - 9);
573
574 if (buffer_unwritten(&bh) || buffer_new(&bh)) {
575 int i;
576
577 length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn,
578 bh.b_size);
579 if (length < 0) {
580 result = VM_FAULT_SIGBUS;
581 goto out;
582 }
583 if ((length < PMD_SIZE) || (pfn & PG_PMD_COLOUR))
584 goto fallback;
585
586 for (i = 0; i < PTRS_PER_PMD; i++)
587 clear_pmem(kaddr + i * PAGE_SIZE, PAGE_SIZE);
588 wmb_pmem();
589 count_vm_event(PGMAJFAULT);
590 mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT);
591 result |= VM_FAULT_MAJOR;
592 }
593
594 /* 571 /*
595 * If we allocated new storage, make sure no process has any 572 * If we allocated new storage, make sure no process has any
596 * zero pages covering this hole 573 * zero pages covering this hole
597 */ 574 */
598 if (buffer_new(&bh)) { 575 if (buffer_new(&bh)) {
599 i_mmap_unlock_write(mapping); 576 i_mmap_unlock_read(mapping);
600 unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0); 577 unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0);
601 i_mmap_lock_write(mapping); 578 i_mmap_lock_read(mapping);
602 } 579 }
603 580
604 /* 581 /*
@@ -635,6 +612,7 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
635 result = VM_FAULT_NOPAGE; 612 result = VM_FAULT_NOPAGE;
636 spin_unlock(ptl); 613 spin_unlock(ptl);
637 } else { 614 } else {
615 sector = bh.b_blocknr << (blkbits - 9);
638 length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn, 616 length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn,
639 bh.b_size); 617 bh.b_size);
640 if (length < 0) { 618 if (length < 0) {
@@ -644,15 +622,25 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
644 if ((length < PMD_SIZE) || (pfn & PG_PMD_COLOUR)) 622 if ((length < PMD_SIZE) || (pfn & PG_PMD_COLOUR))
645 goto fallback; 623 goto fallback;
646 624
625 if (buffer_unwritten(&bh) || buffer_new(&bh)) {
626 int i;
627 for (i = 0; i < PTRS_PER_PMD; i++)
628 clear_pmem(kaddr + i * PAGE_SIZE, PAGE_SIZE);
629 wmb_pmem();
630 count_vm_event(PGMAJFAULT);
631 mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT);
632 result |= VM_FAULT_MAJOR;
633 }
634
647 result |= vmf_insert_pfn_pmd(vma, address, pmd, pfn, write); 635 result |= vmf_insert_pfn_pmd(vma, address, pmd, pfn, write);
648 } 636 }
649 637
650 out: 638 out:
639 i_mmap_unlock_read(mapping);
640
651 if (buffer_unwritten(&bh)) 641 if (buffer_unwritten(&bh))
652 complete_unwritten(&bh, !(result & VM_FAULT_ERROR)); 642 complete_unwritten(&bh, !(result & VM_FAULT_ERROR));
653 643
654 i_mmap_unlock_write(mapping);
655
656 return result; 644 return result;
657 645
658 fallback: 646 fallback:
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index 47728da7702c..b46e9fc64196 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -63,7 +63,7 @@ config EXT4_FS
63 If unsure, say N. 63 If unsure, say N.
64 64
65config EXT4_USE_FOR_EXT2 65config EXT4_USE_FOR_EXT2
66 bool "Use ext4 for ext2/ext3 file systems" 66 bool "Use ext4 for ext2 file systems"
67 depends on EXT4_FS 67 depends on EXT4_FS
68 depends on EXT2_FS=n 68 depends on EXT2_FS=n
69 default y 69 default y
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index e26803fb210d..560af0437704 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -165,8 +165,8 @@ int ext4_mpage_readpages(struct address_space *mapping,
165 if (pages) { 165 if (pages) {
166 page = list_entry(pages->prev, struct page, lru); 166 page = list_entry(pages->prev, struct page, lru);
167 list_del(&page->lru); 167 list_del(&page->lru);
168 if (add_to_page_cache_lru(page, mapping, 168 if (add_to_page_cache_lru(page, mapping, page->index,
169 page->index, GFP_KERNEL)) 169 GFP_KERNEL & mapping_gfp_mask(mapping)))
170 goto next_page; 170 goto next_page;
171 } 171 }
172 172
diff --git a/fs/mpage.c b/fs/mpage.c
index 778a4ddef77a..a7c34274f207 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -139,7 +139,8 @@ map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block)
139static struct bio * 139static struct bio *
140do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages, 140do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
141 sector_t *last_block_in_bio, struct buffer_head *map_bh, 141 sector_t *last_block_in_bio, struct buffer_head *map_bh,
142 unsigned long *first_logical_block, get_block_t get_block) 142 unsigned long *first_logical_block, get_block_t get_block,
143 gfp_t gfp)
143{ 144{
144 struct inode *inode = page->mapping->host; 145 struct inode *inode = page->mapping->host;
145 const unsigned blkbits = inode->i_blkbits; 146 const unsigned blkbits = inode->i_blkbits;
@@ -277,8 +278,7 @@ alloc_new:
277 goto out; 278 goto out;
278 } 279 }
279 bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), 280 bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
280 min_t(int, nr_pages, BIO_MAX_PAGES), 281 min_t(int, nr_pages, BIO_MAX_PAGES), gfp);
281 GFP_KERNEL);
282 if (bio == NULL) 282 if (bio == NULL)
283 goto confused; 283 goto confused;
284 } 284 }
@@ -361,6 +361,7 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages,
361 sector_t last_block_in_bio = 0; 361 sector_t last_block_in_bio = 0;
362 struct buffer_head map_bh; 362 struct buffer_head map_bh;
363 unsigned long first_logical_block = 0; 363 unsigned long first_logical_block = 0;
364 gfp_t gfp = GFP_KERNEL & mapping_gfp_mask(mapping);
364 365
365 map_bh.b_state = 0; 366 map_bh.b_state = 0;
366 map_bh.b_size = 0; 367 map_bh.b_size = 0;
@@ -370,12 +371,13 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages,
370 prefetchw(&page->flags); 371 prefetchw(&page->flags);
371 list_del(&page->lru); 372 list_del(&page->lru);
372 if (!add_to_page_cache_lru(page, mapping, 373 if (!add_to_page_cache_lru(page, mapping,
373 page->index, GFP_KERNEL)) { 374 page->index,
375 gfp)) {
374 bio = do_mpage_readpage(bio, page, 376 bio = do_mpage_readpage(bio, page,
375 nr_pages - page_idx, 377 nr_pages - page_idx,
376 &last_block_in_bio, &map_bh, 378 &last_block_in_bio, &map_bh,
377 &first_logical_block, 379 &first_logical_block,
378 get_block); 380 get_block, gfp);
379 } 381 }
380 page_cache_release(page); 382 page_cache_release(page);
381 } 383 }
@@ -395,11 +397,12 @@ int mpage_readpage(struct page *page, get_block_t get_block)
395 sector_t last_block_in_bio = 0; 397 sector_t last_block_in_bio = 0;
396 struct buffer_head map_bh; 398 struct buffer_head map_bh;
397 unsigned long first_logical_block = 0; 399 unsigned long first_logical_block = 0;
400 gfp_t gfp = GFP_KERNEL & mapping_gfp_mask(page->mapping);
398 401
399 map_bh.b_state = 0; 402 map_bh.b_state = 0;
400 map_bh.b_size = 0; 403 map_bh.b_size = 0;
401 bio = do_mpage_readpage(bio, page, 1, &last_block_in_bio, 404 bio = do_mpage_readpage(bio, page, 1, &last_block_in_bio,
402 &map_bh, &first_logical_block, get_block); 405 &map_bh, &first_logical_block, get_block, gfp);
403 if (bio) 406 if (bio)
404 mpage_bio_submit(READ, bio); 407 mpage_bio_submit(READ, bio);
405 return 0; 408 return 0;
diff --git a/fs/namei.c b/fs/namei.c
index 726d211db484..33e9495a3129 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1558,8 +1558,6 @@ static int lookup_fast(struct nameidata *nd,
1558 negative = d_is_negative(dentry); 1558 negative = d_is_negative(dentry);
1559 if (read_seqcount_retry(&dentry->d_seq, seq)) 1559 if (read_seqcount_retry(&dentry->d_seq, seq))
1560 return -ECHILD; 1560 return -ECHILD;
1561 if (negative)
1562 return -ENOENT;
1563 1561
1564 /* 1562 /*
1565 * This sequence count validates that the parent had no 1563 * This sequence count validates that the parent had no
@@ -1580,6 +1578,12 @@ static int lookup_fast(struct nameidata *nd,
1580 goto unlazy; 1578 goto unlazy;
1581 } 1579 }
1582 } 1580 }
1581 /*
1582 * Note: do negative dentry check after revalidation in
1583 * case that drops it.
1584 */
1585 if (negative)
1586 return -ENOENT;
1583 path->mnt = mnt; 1587 path->mnt = mnt;
1584 path->dentry = dentry; 1588 path->dentry = dentry;
1585 if (likely(__follow_mount_rcu(nd, path, inode, seqp))) 1589 if (likely(__follow_mount_rcu(nd, path, inode, seqp)))
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f93b9cdb4934..5133bb18830e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1458,12 +1458,18 @@ nfs4_opendata_check_deleg(struct nfs4_opendata *data, struct nfs4_state *state)
1458 if (delegation) 1458 if (delegation)
1459 delegation_flags = delegation->flags; 1459 delegation_flags = delegation->flags;
1460 rcu_read_unlock(); 1460 rcu_read_unlock();
1461 if (data->o_arg.claim == NFS4_OPEN_CLAIM_DELEGATE_CUR) { 1461 switch (data->o_arg.claim) {
1462 default:
1463 break;
1464 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
1465 case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
1462 pr_err_ratelimited("NFS: Broken NFSv4 server %s is " 1466 pr_err_ratelimited("NFS: Broken NFSv4 server %s is "
1463 "returning a delegation for " 1467 "returning a delegation for "
1464 "OPEN(CLAIM_DELEGATE_CUR)\n", 1468 "OPEN(CLAIM_DELEGATE_CUR)\n",
1465 clp->cl_hostname); 1469 clp->cl_hostname);
1466 } else if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0) 1470 return;
1471 }
1472 if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0)
1467 nfs_inode_set_delegation(state->inode, 1473 nfs_inode_set_delegation(state->inode,
1468 data->owner->so_cred, 1474 data->owner->so_cred,
1469 &data->o_res); 1475 &data->o_res);
@@ -1771,6 +1777,9 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx,
1771 if (IS_ERR(opendata)) 1777 if (IS_ERR(opendata))
1772 return PTR_ERR(opendata); 1778 return PTR_ERR(opendata);
1773 nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid); 1779 nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid);
1780 write_seqlock(&state->seqlock);
1781 nfs4_stateid_copy(&state->stateid, &state->open_stateid);
1782 write_sequnlock(&state->seqlock);
1774 clear_bit(NFS_DELEGATED_STATE, &state->flags); 1783 clear_bit(NFS_DELEGATED_STATE, &state->flags);
1775 switch (type & (FMODE_READ|FMODE_WRITE)) { 1784 switch (type & (FMODE_READ|FMODE_WRITE)) {
1776 case FMODE_READ|FMODE_WRITE: 1785 case FMODE_READ|FMODE_WRITE:
@@ -1863,6 +1872,8 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
1863 data->rpc_done = 0; 1872 data->rpc_done = 0;
1864 data->rpc_status = 0; 1873 data->rpc_status = 0;
1865 data->timestamp = jiffies; 1874 data->timestamp = jiffies;
1875 if (data->is_recover)
1876 nfs4_set_sequence_privileged(&data->c_arg.seq_args);
1866 task = rpc_run_task(&task_setup_data); 1877 task = rpc_run_task(&task_setup_data);
1867 if (IS_ERR(task)) 1878 if (IS_ERR(task))
1868 return PTR_ERR(task); 1879 return PTR_ERR(task);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 5db324635e92..d854693a15b0 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1725,7 +1725,8 @@ restart:
1725 if (!test_and_clear_bit(ops->owner_flag_bit, 1725 if (!test_and_clear_bit(ops->owner_flag_bit,
1726 &sp->so_flags)) 1726 &sp->so_flags))
1727 continue; 1727 continue;
1728 atomic_inc(&sp->so_count); 1728 if (!atomic_inc_not_zero(&sp->so_count))
1729 continue;
1729 spin_unlock(&clp->cl_lock); 1730 spin_unlock(&clp->cl_lock);
1730 rcu_read_unlock(); 1731 rcu_read_unlock();
1731 1732
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 28df12e525ba..671cf68fe56b 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -409,7 +409,7 @@ DECLARE_EVENT_CLASS(nfs4_open_event,
409 __entry->flags = flags; 409 __entry->flags = flags;
410 __entry->fmode = (__force unsigned int)ctx->mode; 410 __entry->fmode = (__force unsigned int)ctx->mode;
411 __entry->dev = ctx->dentry->d_sb->s_dev; 411 __entry->dev = ctx->dentry->d_sb->s_dev;
412 if (!IS_ERR(state)) 412 if (!IS_ERR_OR_NULL(state))
413 inode = state->inode; 413 inode = state->inode;
414 if (inode != NULL) { 414 if (inode != NULL) {
415 __entry->fileid = NFS_FILEID(inode); 415 __entry->fileid = NFS_FILEID(inode);
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 72624dc4a623..75ab7622e0cc 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -569,19 +569,17 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
569 if (!nfs_pageio_add_request(pgio, req)) { 569 if (!nfs_pageio_add_request(pgio, req)) {
570 nfs_redirty_request(req); 570 nfs_redirty_request(req);
571 ret = pgio->pg_error; 571 ret = pgio->pg_error;
572 } 572 } else
573 nfs_add_stats(page_file_mapping(page)->host,
574 NFSIOS_WRITEPAGES, 1);
573out: 575out:
574 return ret; 576 return ret;
575} 577}
576 578
577static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio) 579static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio)
578{ 580{
579 struct inode *inode = page_file_mapping(page)->host;
580 int ret; 581 int ret;
581 582
582 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
583 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
584
585 nfs_pageio_cond_complete(pgio, page_file_index(page)); 583 nfs_pageio_cond_complete(pgio, page_file_index(page));
586 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE); 584 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
587 if (ret == -EAGAIN) { 585 if (ret == -EAGAIN) {
@@ -597,9 +595,11 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st
597static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc) 595static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc)
598{ 596{
599 struct nfs_pageio_descriptor pgio; 597 struct nfs_pageio_descriptor pgio;
598 struct inode *inode = page_file_mapping(page)->host;
600 int err; 599 int err;
601 600
602 nfs_pageio_init_write(&pgio, page->mapping->host, wb_priority(wbc), 601 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
602 nfs_pageio_init_write(&pgio, inode, wb_priority(wbc),
603 false, &nfs_async_write_completion_ops); 603 false, &nfs_async_write_completion_ops);
604 err = nfs_do_writepage(page, wbc, &pgio); 604 err = nfs_do_writepage(page, wbc, &pgio);
605 nfs_pageio_complete(&pgio); 605 nfs_pageio_complete(&pgio);
@@ -1223,7 +1223,7 @@ static int nfs_can_extend_write(struct file *file, struct page *page, struct ino
1223 return 1; 1223 return 1;
1224 if (!flctx || (list_empty_careful(&flctx->flc_flock) && 1224 if (!flctx || (list_empty_careful(&flctx->flc_flock) &&
1225 list_empty_careful(&flctx->flc_posix))) 1225 list_empty_careful(&flctx->flc_posix)))
1226 return 0; 1226 return 1;
1227 1227
1228 /* Check to see if there are whole file write locks */ 1228 /* Check to see if there are whole file write locks */
1229 ret = 0; 1229 ret = 0;
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index cdefaa331a07..c29d9421bd5e 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -56,14 +56,6 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,
56 u32 device_generation = 0; 56 u32 device_generation = 0;
57 int error; 57 int error;
58 58
59 /*
60 * We do not attempt to support I/O smaller than the fs block size,
61 * or not aligned to it.
62 */
63 if (args->lg_minlength < block_size) {
64 dprintk("pnfsd: I/O too small\n");
65 goto out_layoutunavailable;
66 }
67 if (seg->offset & (block_size - 1)) { 59 if (seg->offset & (block_size - 1)) {
68 dprintk("pnfsd: I/O misaligned\n"); 60 dprintk("pnfsd: I/O misaligned\n");
69 goto out_layoutunavailable; 61 goto out_layoutunavailable;
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index ba1323a94924..a586467f6ff6 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -70,6 +70,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
70 unsigned order; 70 unsigned order;
71 void *data; 71 void *data;
72 int ret; 72 int ret;
73 gfp_t gfp = mapping_gfp_mask(inode->i_mapping);
73 74
74 /* make various checks */ 75 /* make various checks */
75 order = get_order(newsize); 76 order = get_order(newsize);
@@ -84,7 +85,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
84 85
85 /* allocate enough contiguous pages to be able to satisfy the 86 /* allocate enough contiguous pages to be able to satisfy the
86 * request */ 87 * request */
87 pages = alloc_pages(mapping_gfp_mask(inode->i_mapping), order); 88 pages = alloc_pages(gfp, order);
88 if (!pages) 89 if (!pages)
89 return -ENOMEM; 90 return -ENOMEM;
90 91
@@ -108,7 +109,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
108 struct page *page = pages + loop; 109 struct page *page = pages + loop;
109 110
110 ret = add_to_page_cache_lru(page, inode->i_mapping, loop, 111 ret = add_to_page_cache_lru(page, inode->i_mapping, loop,
111 GFP_KERNEL); 112 gfp);
112 if (ret < 0) 113 if (ret < 0)
113 goto add_error; 114 goto add_error;
114 115
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 0f408b002d98..5340099741ae 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -253,6 +253,7 @@ struct drm_dp_remote_dpcd_write {
253 u8 *bytes; 253 u8 *bytes;
254}; 254};
255 255
256#define DP_REMOTE_I2C_READ_MAX_TRANSACTIONS 4
256struct drm_dp_remote_i2c_read { 257struct drm_dp_remote_i2c_read {
257 u8 num_transactions; 258 u8 num_transactions;
258 u8 port_number; 259 u8 port_number;
@@ -262,7 +263,7 @@ struct drm_dp_remote_i2c_read {
262 u8 *bytes; 263 u8 *bytes;
263 u8 no_stop_bit; 264 u8 no_stop_bit;
264 u8 i2c_transaction_delay; 265 u8 i2c_transaction_delay;
265 } transactions[4]; 266 } transactions[DP_REMOTE_I2C_READ_MAX_TRANSACTIONS];
266 u8 read_i2c_device_id; 267 u8 read_i2c_device_id;
267 u8 num_bytes_read; 268 u8 num_bytes_read;
268}; 269};
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index d3ca79236fb0..f644fdb06dd6 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -161,6 +161,11 @@ enum {
161 IRQ_DOMAIN_FLAG_NONCORE = (1 << 16), 161 IRQ_DOMAIN_FLAG_NONCORE = (1 << 16),
162}; 162};
163 163
164static inline struct device_node *irq_domain_get_of_node(struct irq_domain *d)
165{
166 return d->of_node;
167}
168
164#ifdef CONFIG_IRQ_DOMAIN 169#ifdef CONFIG_IRQ_DOMAIN
165struct irq_domain *__irq_domain_add(struct device_node *of_node, int size, 170struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
166 irq_hw_number_t hwirq_max, int direct_max, 171 irq_hw_number_t hwirq_max, int direct_max,
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 3dd5a781da99..bfb74723f151 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -157,7 +157,7 @@ struct renesas_usbhs_driver_param {
157 */ 157 */
158 int pio_dma_border; /* default is 64byte */ 158 int pio_dma_border; /* default is 64byte */
159 159
160 u32 type; 160 uintptr_t type;
161 u32 enable_gpio; 161 u32 enable_gpio;
162 162
163 /* 163 /*
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 3e0ffd21901f..4e6ad74fd8a2 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1024,6 +1024,22 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,
1024 snd_pcm_hw_rule_func_t func, void *private, 1024 snd_pcm_hw_rule_func_t func, void *private,
1025 int dep, ...); 1025 int dep, ...);
1026 1026
1027/**
1028 * snd_pcm_hw_constraint_single() - Constrain parameter to a single value
1029 * @runtime: PCM runtime instance
1030 * @var: The hw_params variable to constrain
1031 * @val: The value to constrain to
1032 *
1033 * Return: Positive if the value is changed, zero if it's not changed, or a
1034 * negative error code.
1035 */
1036static inline int snd_pcm_hw_constraint_single(
1037 struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
1038 unsigned int val)
1039{
1040 return snd_pcm_hw_constraint_minmax(runtime, var, val, val);
1041}
1042
1027int snd_pcm_format_signed(snd_pcm_format_t format); 1043int snd_pcm_format_signed(snd_pcm_format_t format);
1028int snd_pcm_format_unsigned(snd_pcm_format_t format); 1044int snd_pcm_format_unsigned(snd_pcm_format_t format);
1029int snd_pcm_format_linear(snd_pcm_format_t format); 1045int snd_pcm_format_linear(snd_pcm_format_t format);
diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h
index 9df61f1edb0f..3094618d382f 100644
--- a/include/uapi/asm-generic/signal.h
+++ b/include/uapi/asm-generic/signal.h
@@ -80,8 +80,10 @@
80 * SA_RESTORER 0x04000000 80 * SA_RESTORER 0x04000000
81 */ 81 */
82 82
83#if !defined MINSIGSTKSZ || !defined SIGSTKSZ
83#define MINSIGSTKSZ 2048 84#define MINSIGSTKSZ 2048
84#define SIGSTKSZ 8192 85#define SIGSTKSZ 8192
86#endif
85 87
86#ifndef __ASSEMBLY__ 88#ifndef __ASSEMBLY__
87typedef struct { 89typedef struct {
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index 9ce083960a25..f18490985fc8 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -107,5 +107,13 @@ struct sched_watchdog {
107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ 107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ 108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */ 109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */
110/*
111 * Domain asked to perform 'soft reset' for it. The expected behavior is to
112 * reset internal Xen state for the domain returning it to the point where it
113 * was created but leaving the domain's memory contents and vCPU contexts
114 * intact. This will allow the domain to start over and set up all Xen specific
115 * interfaces again.
116 */
117#define SHUTDOWN_soft_reset 5
110 118
111#endif /* __XEN_PUBLIC_SCHED_H__ */ 119#endif /* __XEN_PUBLIC_SCHED_H__ */
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index de41a68fc038..e25a83b67cce 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -22,7 +22,6 @@
22 22
23/** 23/**
24 * handle_bad_irq - handle spurious and unhandled irqs 24 * handle_bad_irq - handle spurious and unhandled irqs
25 * @irq: the interrupt number
26 * @desc: description of the interrupt 25 * @desc: description of the interrupt
27 * 26 *
28 * Handles spurious and unhandled IRQ's. It also prints a debugmessage. 27 * Handles spurious and unhandled IRQ's. It also prints a debugmessage.
@@ -35,6 +34,7 @@ void handle_bad_irq(struct irq_desc *desc)
35 kstat_incr_irqs_this_cpu(desc); 34 kstat_incr_irqs_this_cpu(desc);
36 ack_bad_irq(irq); 35 ack_bad_irq(irq);
37} 36}
37EXPORT_SYMBOL_GPL(handle_bad_irq);
38 38
39/* 39/*
40 * Special, empty irq handler: 40 * Special, empty irq handler:
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 7e6512b9dc1f..be9149f62eb8 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -228,11 +228,7 @@ static void msi_domain_update_chip_ops(struct msi_domain_info *info)
228{ 228{
229 struct irq_chip *chip = info->chip; 229 struct irq_chip *chip = info->chip;
230 230
231 BUG_ON(!chip); 231 BUG_ON(!chip || !chip->irq_mask || !chip->irq_unmask);
232 if (!chip->irq_mask)
233 chip->irq_mask = pci_msi_mask_irq;
234 if (!chip->irq_unmask)
235 chip->irq_unmask = pci_msi_unmask_irq;
236 if (!chip->irq_set_affinity) 232 if (!chip->irq_set_affinity)
237 chip->irq_set_affinity = msi_domain_set_affinity; 233 chip->irq_set_affinity = msi_domain_set_affinity;
238} 234}
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 615953141951..10a8faa1b0d4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2517,11 +2517,11 @@ static struct rq *finish_task_switch(struct task_struct *prev)
2517 * If a task dies, then it sets TASK_DEAD in tsk->state and calls 2517 * If a task dies, then it sets TASK_DEAD in tsk->state and calls
2518 * schedule one last time. The schedule call will never return, and 2518 * schedule one last time. The schedule call will never return, and
2519 * the scheduled task must drop that reference. 2519 * the scheduled task must drop that reference.
2520 * The test for TASK_DEAD must occur while the runqueue locks are 2520 *
2521 * still held, otherwise prev could be scheduled on another cpu, die 2521 * We must observe prev->state before clearing prev->on_cpu (in
2522 * there before we look at prev->state, and then the reference would 2522 * finish_lock_switch), otherwise a concurrent wakeup can get prev
2523 * be dropped twice. 2523 * running on another CPU and we could rave with its RUNNING -> DEAD
2524 * Manfred Spraul <manfred@colorfullife.com> 2524 * transition, resulting in a double drop.
2525 */ 2525 */
2526 prev_state = prev->state; 2526 prev_state = prev->state;
2527 vtime_task_switch(prev); 2527 vtime_task_switch(prev);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 68cda117574c..6d2a119c7ad9 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1078,9 +1078,10 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
1078 * After ->on_cpu is cleared, the task can be moved to a different CPU. 1078 * After ->on_cpu is cleared, the task can be moved to a different CPU.
1079 * We must ensure this doesn't happen until the switch is completely 1079 * We must ensure this doesn't happen until the switch is completely
1080 * finished. 1080 * finished.
1081 *
1082 * Pairs with the control dependency and rmb in try_to_wake_up().
1081 */ 1083 */
1082 smp_wmb(); 1084 smp_store_release(&prev->on_cpu, 0);
1083 prev->on_cpu = 0;
1084#endif 1085#endif
1085#ifdef CONFIG_DEBUG_SPINLOCK 1086#ifdef CONFIG_DEBUG_SPINLOCK
1086 /* this is a valid case when another task releases the spinlock */ 1087 /* this is a valid case when another task releases the spinlock */
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 3739ac6aa473..44d2cc0436f4 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1251,7 +1251,7 @@ void __init timekeeping_init(void)
1251 set_normalized_timespec64(&tmp, -boot.tv_sec, -boot.tv_nsec); 1251 set_normalized_timespec64(&tmp, -boot.tv_sec, -boot.tv_nsec);
1252 tk_set_wall_to_mono(tk, tmp); 1252 tk_set_wall_to_mono(tk, tmp);
1253 1253
1254 timekeeping_update(tk, TK_MIRROR); 1254 timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET);
1255 1255
1256 write_seqcount_end(&tk_core.seq); 1256 write_seqcount_end(&tk_core.seq);
1257 raw_spin_unlock_irqrestore(&timekeeper_lock, flags); 1257 raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca71582fcfab..bcb14cafe007 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1458,13 +1458,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
1458 timer_stats_timer_set_start_info(&dwork->timer); 1458 timer_stats_timer_set_start_info(&dwork->timer);
1459 1459
1460 dwork->wq = wq; 1460 dwork->wq = wq;
1461 /* timer isn't guaranteed to run in this cpu, record earlier */
1462 if (cpu == WORK_CPU_UNBOUND)
1463 cpu = raw_smp_processor_id();
1461 dwork->cpu = cpu; 1464 dwork->cpu = cpu;
1462 timer->expires = jiffies + delay; 1465 timer->expires = jiffies + delay;
1463 1466
1464 if (unlikely(cpu != WORK_CPU_UNBOUND)) 1467 add_timer_on(timer, cpu);
1465 add_timer_on(timer, cpu);
1466 else
1467 add_timer(timer);
1468} 1468}
1469 1469
1470/** 1470/**
diff --git a/lib/Kconfig b/lib/Kconfig
index 2e491ac15622..f0df318104e7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -220,6 +220,7 @@ config ZLIB_INFLATE
220 220
221config ZLIB_DEFLATE 221config ZLIB_DEFLATE
222 tristate 222 tristate
223 select BITREVERSE
223 224
224config LZO_COMPRESS 225config LZO_COMPRESS
225 tristate 226 tristate
diff --git a/lib/string.c b/lib/string.c
index 8dbb7b1eab50..84775ba873b9 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -203,12 +203,13 @@ ssize_t strscpy(char *dest, const char *src, size_t count)
203 unsigned long c, data; 203 unsigned long c, data;
204 204
205 c = *(unsigned long *)(src+res); 205 c = *(unsigned long *)(src+res);
206 *(unsigned long *)(dest+res) = c;
207 if (has_zero(c, &data, &constants)) { 206 if (has_zero(c, &data, &constants)) {
208 data = prep_zero_mask(c, data, &constants); 207 data = prep_zero_mask(c, data, &constants);
209 data = create_zero_mask(data); 208 data = create_zero_mask(data);
209 *(unsigned long *)(dest+res) = c & zero_bytemask(data);
210 return res + find_zero(data); 210 return res + find_zero(data);
211 } 211 }
212 *(unsigned long *)(dest+res) = c;
212 res += sizeof(unsigned long); 213 res += sizeof(unsigned long);
213 count -= sizeof(unsigned long); 214 count -= sizeof(unsigned long);
214 max -= sizeof(unsigned long); 215 max -= sizeof(unsigned long);
diff --git a/mm/filemap.c b/mm/filemap.c
index 72940fb38666..1cc5467cf36c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2473,6 +2473,21 @@ ssize_t generic_perform_write(struct file *file,
2473 iov_iter_count(i)); 2473 iov_iter_count(i));
2474 2474
2475again: 2475again:
2476 /*
2477 * Bring in the user page that we will copy from _first_.
2478 * Otherwise there's a nasty deadlock on copying from the
2479 * same page as we're writing to, without it being marked
2480 * up-to-date.
2481 *
2482 * Not only is this an optimisation, but it is also required
2483 * to check that the address is actually valid, when atomic
2484 * usercopies are used, below.
2485 */
2486 if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
2487 status = -EFAULT;
2488 break;
2489 }
2490
2476 status = a_ops->write_begin(file, mapping, pos, bytes, flags, 2491 status = a_ops->write_begin(file, mapping, pos, bytes, flags,
2477 &page, &fsdata); 2492 &page, &fsdata);
2478 if (unlikely(status < 0)) 2493 if (unlikely(status < 0))
@@ -2480,17 +2495,8 @@ again:
2480 2495
2481 if (mapping_writably_mapped(mapping)) 2496 if (mapping_writably_mapped(mapping))
2482 flush_dcache_page(page); 2497 flush_dcache_page(page);
2483 /* 2498
2484 * 'page' is now locked. If we are trying to copy from a
2485 * mapping of 'page' in userspace, the copy might fault and
2486 * would need PageUptodate() to complete. But, page can not be
2487 * made Uptodate without acquiring the page lock, which we hold.
2488 * Deadlock. Avoid with pagefault_disable(). Fix up below with
2489 * iov_iter_fault_in_readable().
2490 */
2491 pagefault_disable();
2492 copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes); 2499 copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
2493 pagefault_enable();
2494 flush_dcache_page(page); 2500 flush_dcache_page(page);
2495 2501
2496 status = a_ops->write_end(file, mapping, pos, bytes, copied, 2502 status = a_ops->write_end(file, mapping, pos, bytes, copied,
@@ -2513,14 +2519,6 @@ again:
2513 */ 2519 */
2514 bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset, 2520 bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
2515 iov_iter_single_seg_count(i)); 2521 iov_iter_single_seg_count(i));
2516 /*
2517 * This is the fallback to recover if the copy from
2518 * userspace above faults.
2519 */
2520 if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
2521 status = -EFAULT;
2522 break;
2523 }
2524 goto again; 2522 goto again;
2525 } 2523 }
2526 pos += copied; 2524 pos += copied;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1fedbde68f59..d9b5c817dce8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3387,6 +3387,7 @@ static int __mem_cgroup_usage_register_event(struct mem_cgroup *memcg,
3387 ret = page_counter_memparse(args, "-1", &threshold); 3387 ret = page_counter_memparse(args, "-1", &threshold);
3388 if (ret) 3388 if (ret)
3389 return ret; 3389 return ret;
3390 threshold <<= PAGE_SHIFT;
3390 3391
3391 mutex_lock(&memcg->thresholds_lock); 3392 mutex_lock(&memcg->thresholds_lock);
3392 3393
diff --git a/mm/memory.c b/mm/memory.c
index 9cb27470fee9..deb679c31f2a 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2426,6 +2426,8 @@ void unmap_mapping_range(struct address_space *mapping,
2426 if (details.last_index < details.first_index) 2426 if (details.last_index < details.first_index)
2427 details.last_index = ULONG_MAX; 2427 details.last_index = ULONG_MAX;
2428 2428
2429
2430 /* DAX uses i_mmap_lock to serialise file truncate vs page fault */
2429 i_mmap_lock_write(mapping); 2431 i_mmap_lock_write(mapping);
2430 if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap))) 2432 if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap)))
2431 unmap_mapping_range_tree(&mapping->i_mmap, &details); 2433 unmap_mapping_range_tree(&mapping->i_mmap, &details);
diff --git a/mm/readahead.c b/mm/readahead.c
index 60cd846a9a44..24682f6f4cfd 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -89,8 +89,8 @@ int read_cache_pages(struct address_space *mapping, struct list_head *pages,
89 while (!list_empty(pages)) { 89 while (!list_empty(pages)) {
90 page = list_to_page(pages); 90 page = list_to_page(pages);
91 list_del(&page->lru); 91 list_del(&page->lru);
92 if (add_to_page_cache_lru(page, mapping, 92 if (add_to_page_cache_lru(page, mapping, page->index,
93 page->index, GFP_KERNEL)) { 93 GFP_KERNEL & mapping_gfp_mask(mapping))) {
94 read_cache_pages_invalidate_page(mapping, page); 94 read_cache_pages_invalidate_page(mapping, page);
95 continue; 95 continue;
96 } 96 }
@@ -127,8 +127,8 @@ static int read_pages(struct address_space *mapping, struct file *filp,
127 for (page_idx = 0; page_idx < nr_pages; page_idx++) { 127 for (page_idx = 0; page_idx < nr_pages; page_idx++) {
128 struct page *page = list_to_page(pages); 128 struct page *page = list_to_page(pages);
129 list_del(&page->lru); 129 list_del(&page->lru);
130 if (!add_to_page_cache_lru(page, mapping, 130 if (!add_to_page_cache_lru(page, mapping, page->index,
131 page->index, GFP_KERNEL)) { 131 GFP_KERNEL & mapping_gfp_mask(mapping))) {
132 mapping->a_ops->readpage(filp, page); 132 mapping->a_ops->readpage(filp, page);
133 } 133 }
134 page_cache_release(page); 134 page_cache_release(page);
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 4f5cd974e11a..fbf14485a049 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1363,15 +1363,16 @@ static cpumask_var_t cpu_stat_off;
1363 1363
1364static void vmstat_update(struct work_struct *w) 1364static void vmstat_update(struct work_struct *w)
1365{ 1365{
1366 if (refresh_cpu_vm_stats()) 1366 if (refresh_cpu_vm_stats()) {
1367 /* 1367 /*
1368 * Counters were updated so we expect more updates 1368 * Counters were updated so we expect more updates
1369 * to occur in the future. Keep on running the 1369 * to occur in the future. Keep on running the
1370 * update worker thread. 1370 * update worker thread.
1371 */ 1371 */
1372 schedule_delayed_work(this_cpu_ptr(&vmstat_work), 1372 schedule_delayed_work_on(smp_processor_id(),
1373 this_cpu_ptr(&vmstat_work),
1373 round_jiffies_relative(sysctl_stat_interval)); 1374 round_jiffies_relative(sysctl_stat_interval));
1374 else { 1375 } else {
1375 /* 1376 /*
1376 * We did not update any counters so the app may be in 1377 * We did not update any counters so the app may be in
1377 * a mode where it does not cause counter updates. 1378 * a mode where it does not cause counter updates.
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 80b94e37c94a..f79ccac6699f 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -285,6 +285,7 @@ static void osd_req_op_data_release(struct ceph_osd_request *osd_req,
285 switch (op->op) { 285 switch (op->op) {
286 case CEPH_OSD_OP_READ: 286 case CEPH_OSD_OP_READ:
287 case CEPH_OSD_OP_WRITE: 287 case CEPH_OSD_OP_WRITE:
288 case CEPH_OSD_OP_WRITEFULL:
288 ceph_osd_data_release(&op->extent.osd_data); 289 ceph_osd_data_release(&op->extent.osd_data);
289 break; 290 break;
290 case CEPH_OSD_OP_CALL: 291 case CEPH_OSD_OP_CALL:
@@ -485,13 +486,14 @@ void osd_req_op_extent_init(struct ceph_osd_request *osd_req,
485 size_t payload_len = 0; 486 size_t payload_len = 0;
486 487
487 BUG_ON(opcode != CEPH_OSD_OP_READ && opcode != CEPH_OSD_OP_WRITE && 488 BUG_ON(opcode != CEPH_OSD_OP_READ && opcode != CEPH_OSD_OP_WRITE &&
488 opcode != CEPH_OSD_OP_ZERO && opcode != CEPH_OSD_OP_TRUNCATE); 489 opcode != CEPH_OSD_OP_WRITEFULL && opcode != CEPH_OSD_OP_ZERO &&
490 opcode != CEPH_OSD_OP_TRUNCATE);
489 491
490 op->extent.offset = offset; 492 op->extent.offset = offset;
491 op->extent.length = length; 493 op->extent.length = length;
492 op->extent.truncate_size = truncate_size; 494 op->extent.truncate_size = truncate_size;
493 op->extent.truncate_seq = truncate_seq; 495 op->extent.truncate_seq = truncate_seq;
494 if (opcode == CEPH_OSD_OP_WRITE) 496 if (opcode == CEPH_OSD_OP_WRITE || opcode == CEPH_OSD_OP_WRITEFULL)
495 payload_len += length; 497 payload_len += length;
496 498
497 op->payload_len = payload_len; 499 op->payload_len = payload_len;
@@ -670,9 +672,11 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
670 break; 672 break;
671 case CEPH_OSD_OP_READ: 673 case CEPH_OSD_OP_READ:
672 case CEPH_OSD_OP_WRITE: 674 case CEPH_OSD_OP_WRITE:
675 case CEPH_OSD_OP_WRITEFULL:
673 case CEPH_OSD_OP_ZERO: 676 case CEPH_OSD_OP_ZERO:
674 case CEPH_OSD_OP_TRUNCATE: 677 case CEPH_OSD_OP_TRUNCATE:
675 if (src->op == CEPH_OSD_OP_WRITE) 678 if (src->op == CEPH_OSD_OP_WRITE ||
679 src->op == CEPH_OSD_OP_WRITEFULL)
676 request_data_len = src->extent.length; 680 request_data_len = src->extent.length;
677 dst->extent.offset = cpu_to_le64(src->extent.offset); 681 dst->extent.offset = cpu_to_le64(src->extent.offset);
678 dst->extent.length = cpu_to_le64(src->extent.length); 682 dst->extent.length = cpu_to_le64(src->extent.length);
@@ -681,7 +685,8 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
681 dst->extent.truncate_seq = 685 dst->extent.truncate_seq =
682 cpu_to_le32(src->extent.truncate_seq); 686 cpu_to_le32(src->extent.truncate_seq);
683 osd_data = &src->extent.osd_data; 687 osd_data = &src->extent.osd_data;
684 if (src->op == CEPH_OSD_OP_WRITE) 688 if (src->op == CEPH_OSD_OP_WRITE ||
689 src->op == CEPH_OSD_OP_WRITEFULL)
685 ceph_osdc_msg_data_add(req->r_request, osd_data); 690 ceph_osdc_msg_data_add(req->r_request, osd_data);
686 else 691 else
687 ceph_osdc_msg_data_add(req->r_reply, osd_data); 692 ceph_osdc_msg_data_add(req->r_reply, osd_data);
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index cb5174284074..f0c3ff67ca98 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -136,7 +136,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt,
136 ctxt->direction = DMA_FROM_DEVICE; 136 ctxt->direction = DMA_FROM_DEVICE;
137 ctxt->read_hdr = head; 137 ctxt->read_hdr = head;
138 pages_needed = min_t(int, pages_needed, xprt->sc_max_sge_rd); 138 pages_needed = min_t(int, pages_needed, xprt->sc_max_sge_rd);
139 read = min_t(int, pages_needed << PAGE_SHIFT, rs_length); 139 read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset,
140 rs_length);
140 141
141 for (pno = 0; pno < pages_needed; pno++) { 142 for (pno = 0; pno < pages_needed; pno++) {
142 int len = min_t(int, rs_length, PAGE_SIZE - pg_off); 143 int len = min_t(int, rs_length, PAGE_SIZE - pg_off);
@@ -235,7 +236,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt,
235 ctxt->direction = DMA_FROM_DEVICE; 236 ctxt->direction = DMA_FROM_DEVICE;
236 ctxt->frmr = frmr; 237 ctxt->frmr = frmr;
237 pages_needed = min_t(int, pages_needed, xprt->sc_frmr_pg_list_len); 238 pages_needed = min_t(int, pages_needed, xprt->sc_frmr_pg_list_len);
238 read = min_t(int, pages_needed << PAGE_SHIFT, rs_length); 239 read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset,
240 rs_length);
239 241
240 frmr->kva = page_address(rqstp->rq_arg.pages[pg_no]); 242 frmr->kva = page_address(rqstp->rq_arg.pages[pg_no]);
241 frmr->direction = DMA_FROM_DEVICE; 243 frmr->direction = DMA_FROM_DEVICE;
@@ -531,7 +533,7 @@ static int rdma_read_complete(struct svc_rqst *rqstp,
531 rqstp->rq_arg.page_base = head->arg.page_base; 533 rqstp->rq_arg.page_base = head->arg.page_base;
532 534
533 /* rq_respages starts after the last arg page */ 535 /* rq_respages starts after the last arg page */
534 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no]; 536 rqstp->rq_respages = &rqstp->rq_pages[page_no];
535 rqstp->rq_next_page = rqstp->rq_respages + 1; 537 rqstp->rq_next_page = rqstp->rq_respages + 1;
536 538
537 /* Rebuild rq_arg head and tail. */ 539 /* Rebuild rq_arg head and tail. */
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 64443eb754ad..41e452bc580c 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -270,8 +270,8 @@ xprt_rdma_destroy(struct rpc_xprt *xprt)
270 270
271 xprt_clear_connected(xprt); 271 xprt_clear_connected(xprt);
272 272
273 rpcrdma_buffer_destroy(&r_xprt->rx_buf);
274 rpcrdma_ep_destroy(&r_xprt->rx_ep, &r_xprt->rx_ia); 273 rpcrdma_ep_destroy(&r_xprt->rx_ep, &r_xprt->rx_ia);
274 rpcrdma_buffer_destroy(&r_xprt->rx_buf);
275 rpcrdma_ia_close(&r_xprt->rx_ia); 275 rpcrdma_ia_close(&r_xprt->rx_ia);
276 276
277 xprt_rdma_free_addresses(xprt); 277 xprt_rdma_free_addresses(xprt);
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index eb081ad05e33..5502d4dade74 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -543,11 +543,8 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
543 } 543 }
544 544
545 if (memreg == RPCRDMA_FRMR) { 545 if (memreg == RPCRDMA_FRMR) {
546 /* Requires both frmr reg and local dma lkey */ 546 if (!(devattr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) ||
547 if (((devattr->device_cap_flags & 547 (devattr->max_fast_reg_page_list_len == 0)) {
548 (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) !=
549 (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) ||
550 (devattr->max_fast_reg_page_list_len == 0)) {
551 dprintk("RPC: %s: FRMR registration " 548 dprintk("RPC: %s: FRMR registration "
552 "not supported by HCA\n", __func__); 549 "not supported by HCA\n", __func__);
553 memreg = RPCRDMA_MTHCAFMR; 550 memreg = RPCRDMA_MTHCAFMR;
@@ -557,6 +554,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
557 if (!ia->ri_device->alloc_fmr) { 554 if (!ia->ri_device->alloc_fmr) {
558 dprintk("RPC: %s: MTHCAFMR registration " 555 dprintk("RPC: %s: MTHCAFMR registration "
559 "not supported by HCA\n", __func__); 556 "not supported by HCA\n", __func__);
557 rc = -EINVAL;
560 goto out3; 558 goto out3;
561 } 559 }
562 } 560 }
@@ -755,19 +753,22 @@ rpcrdma_ep_destroy(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
755 753
756 cancel_delayed_work_sync(&ep->rep_connect_worker); 754 cancel_delayed_work_sync(&ep->rep_connect_worker);
757 755
758 if (ia->ri_id->qp) { 756 if (ia->ri_id->qp)
759 rpcrdma_ep_disconnect(ep, ia); 757 rpcrdma_ep_disconnect(ep, ia);
758
759 rpcrdma_clean_cq(ep->rep_attr.recv_cq);
760 rpcrdma_clean_cq(ep->rep_attr.send_cq);
761
762 if (ia->ri_id->qp) {
760 rdma_destroy_qp(ia->ri_id); 763 rdma_destroy_qp(ia->ri_id);
761 ia->ri_id->qp = NULL; 764 ia->ri_id->qp = NULL;
762 } 765 }
763 766
764 rpcrdma_clean_cq(ep->rep_attr.recv_cq);
765 rc = ib_destroy_cq(ep->rep_attr.recv_cq); 767 rc = ib_destroy_cq(ep->rep_attr.recv_cq);
766 if (rc) 768 if (rc)
767 dprintk("RPC: %s: ib_destroy_cq returned %i\n", 769 dprintk("RPC: %s: ib_destroy_cq returned %i\n",
768 __func__, rc); 770 __func__, rc);
769 771
770 rpcrdma_clean_cq(ep->rep_attr.send_cq);
771 rc = ib_destroy_cq(ep->rep_attr.send_cq); 772 rc = ib_destroy_cq(ep->rep_attr.send_cq);
772 if (rc) 773 if (rc)
773 dprintk("RPC: %s: ib_destroy_cq returned %i\n", 774 dprintk("RPC: %s: ib_destroy_cq returned %i\n",
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 0cd46e129920..b967e4f9fed2 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -115,7 +115,7 @@ esac
115BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)" 115BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
116 116
117# Setup the directory structure 117# Setup the directory structure
118rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" 118rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
119mkdir -m 755 -p "$tmpdir/DEBIAN" 119mkdir -m 755 -p "$tmpdir/DEBIAN"
120mkdir -p "$tmpdir/lib" "$tmpdir/boot" 120mkdir -p "$tmpdir/lib" "$tmpdir/boot"
121mkdir -p "$fwdir/lib/firmware/$version/" 121mkdir -p "$fwdir/lib/firmware/$version/"
@@ -408,7 +408,7 @@ binary-arch:
408 \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg 408 \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
409 409
410clean: 410clean:
411 rm -rf debian/*tmp 411 rm -rf debian/*tmp debian/files
412 mv debian/ debian.backup # debian/ might be cleaned away 412 mv debian/ debian.backup # debian/ might be cleaned away
413 \$(MAKE) clean 413 \$(MAKE) clean
414 mv debian.backup debian 414 mv debian.backup debian
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 7acbc21d642a..9e1ad119a3ce 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -1394,7 +1394,9 @@ static int snd_korg1212_playback_open(struct snd_pcm_substream *substream)
1394 1394
1395 spin_unlock_irqrestore(&korg1212->lock, flags); 1395 spin_unlock_irqrestore(&korg1212->lock, flags);
1396 1396
1397 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, kPlayBufferFrames, kPlayBufferFrames); 1397 snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1398 kPlayBufferFrames);
1399
1398 return 0; 1400 return 0;
1399} 1401}
1400 1402
@@ -1422,8 +1424,8 @@ static int snd_korg1212_capture_open(struct snd_pcm_substream *substream)
1422 1424
1423 spin_unlock_irqrestore(&korg1212->lock, flags); 1425 spin_unlock_irqrestore(&korg1212->lock, flags);
1424 1426
1425 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1427 snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1426 kPlayBufferFrames, kPlayBufferFrames); 1428 kPlayBufferFrames);
1427 return 0; 1429 return 0;
1428} 1430}
1429 1431
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index cba89beb2b38..8b8e2e54fba3 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -234,8 +234,8 @@ static int lx_pcm_open(struct snd_pcm_substream *substream)
234 234
235 /* the clock rate cannot be changed */ 235 /* the clock rate cannot be changed */
236 board_rate = chip->board_sample_rate; 236 board_rate = chip->board_sample_rate;
237 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 237 err = snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_RATE,
238 board_rate, board_rate); 238 board_rate);
239 239
240 if (err < 0) { 240 if (err < 0) {
241 dev_warn(chip->card->dev, "could not constrain periods\n"); 241 dev_warn(chip->card->dev, "could not constrain periods\n");
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 23d7f5d30c41..cd94ac548ba3 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -831,9 +831,9 @@ static struct snd_pcm_hw_constraint_list hw_constraints_period_bytes = {
831static void snd_rme32_set_buffer_constraint(struct rme32 *rme32, struct snd_pcm_runtime *runtime) 831static void snd_rme32_set_buffer_constraint(struct rme32 *rme32, struct snd_pcm_runtime *runtime)
832{ 832{
833 if (! rme32->fullduplex_mode) { 833 if (! rme32->fullduplex_mode) {
834 snd_pcm_hw_constraint_minmax(runtime, 834 snd_pcm_hw_constraint_single(runtime,
835 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 835 SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
836 RME32_BUFFER_SIZE, RME32_BUFFER_SIZE); 836 RME32_BUFFER_SIZE);
837 snd_pcm_hw_constraint_list(runtime, 0, 837 snd_pcm_hw_constraint_list(runtime, 0,
838 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 838 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
839 &hw_constraints_period_bytes); 839 &hw_constraints_period_bytes);
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 2306ccf7281e..714df906249e 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -1152,13 +1152,13 @@ rme96_set_buffer_size_constraint(struct rme96 *rme96,
1152{ 1152{
1153 unsigned int size; 1153 unsigned int size;
1154 1154
1155 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 1155 snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
1156 RME96_BUFFER_SIZE, RME96_BUFFER_SIZE); 1156 RME96_BUFFER_SIZE);
1157 if ((size = rme96->playback_periodsize) != 0 || 1157 if ((size = rme96->playback_periodsize) != 0 ||
1158 (size = rme96->capture_periodsize) != 0) 1158 (size = rme96->capture_periodsize) != 0)
1159 snd_pcm_hw_constraint_minmax(runtime, 1159 snd_pcm_hw_constraint_single(runtime,
1160 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1160 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1161 size, size); 1161 size);
1162 else 1162 else
1163 snd_pcm_hw_constraint_list(runtime, 0, 1163 snd_pcm_hw_constraint_list(runtime, 0,
1164 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1164 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index cb666c73712d..8bc8016c173d 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6080,18 +6080,17 @@ static int snd_hdspm_open(struct snd_pcm_substream *substream)
6080 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 6080 SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
6081 32, 4096); 6081 32, 4096);
6082 /* RayDAT & AIO have a fixed buffer of 16384 samples per channel */ 6082 /* RayDAT & AIO have a fixed buffer of 16384 samples per channel */
6083 snd_pcm_hw_constraint_minmax(runtime, 6083 snd_pcm_hw_constraint_single(runtime,
6084 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 6084 SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
6085 16384, 16384); 6085 16384);
6086 break; 6086 break;
6087 6087
6088 default: 6088 default:
6089 snd_pcm_hw_constraint_minmax(runtime, 6089 snd_pcm_hw_constraint_minmax(runtime,
6090 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 6090 SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
6091 64, 8192); 6091 64, 8192);
6092 snd_pcm_hw_constraint_minmax(runtime, 6092 snd_pcm_hw_constraint_single(runtime,
6093 SNDRV_PCM_HW_PARAM_PERIODS, 6093 SNDRV_PCM_HW_PARAM_PERIODS, 2);
6094 2, 2);
6095 break; 6094 break;
6096 } 6095 }
6097 6096
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index 198c924551b7..acff8d62059c 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -728,8 +728,8 @@ static int adav80x_dai_startup(struct snd_pcm_substream *substream,
728 if (!snd_soc_codec_is_active(codec) || !adav80x->rate) 728 if (!snd_soc_codec_is_active(codec) || !adav80x->rate)
729 return 0; 729 return 0;
730 730
731 return snd_pcm_hw_constraint_minmax(substream->runtime, 731 return snd_pcm_hw_constraint_single(substream->runtime,
732 SNDRV_PCM_HW_PARAM_RATE, adav80x->rate, adav80x->rate); 732 SNDRV_PCM_HW_PARAM_RATE, adav80x->rate);
733} 733}
734 734
735static void adav80x_dai_shutdown(struct snd_pcm_substream *substream, 735static void adav80x_dai_shutdown(struct snd_pcm_substream *substream,
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 2713e1845cbc..a5a4e9f75c57 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1612,19 +1612,16 @@ static void twl4030_constraints(struct twl4030_priv *twl4030,
1612 return; 1612 return;
1613 1613
1614 /* Set the constraints according to the already configured stream */ 1614 /* Set the constraints according to the already configured stream */
1615 snd_pcm_hw_constraint_minmax(slv_substream->runtime, 1615 snd_pcm_hw_constraint_single(slv_substream->runtime,
1616 SNDRV_PCM_HW_PARAM_RATE, 1616 SNDRV_PCM_HW_PARAM_RATE,
1617 twl4030->rate,
1618 twl4030->rate); 1617 twl4030->rate);
1619 1618
1620 snd_pcm_hw_constraint_minmax(slv_substream->runtime, 1619 snd_pcm_hw_constraint_single(slv_substream->runtime,
1621 SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 1620 SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
1622 twl4030->sample_bits,
1623 twl4030->sample_bits); 1621 twl4030->sample_bits);
1624 1622
1625 snd_pcm_hw_constraint_minmax(slv_substream->runtime, 1623 snd_pcm_hw_constraint_single(slv_substream->runtime,
1626 SNDRV_PCM_HW_PARAM_CHANNELS, 1624 SNDRV_PCM_HW_PARAM_CHANNELS,
1627 twl4030->channels,
1628 twl4030->channels); 1625 twl4030->channels);
1629} 1626}
1630 1627
@@ -1669,9 +1666,9 @@ static int twl4030_startup(struct snd_pcm_substream *substream,
1669 /* In option2 4 channel is not supported, set the 1666 /* In option2 4 channel is not supported, set the
1670 * constraint for the first stream for channels, the 1667 * constraint for the first stream for channels, the
1671 * second stream will 'inherit' this cosntraint */ 1668 * second stream will 'inherit' this cosntraint */
1672 snd_pcm_hw_constraint_minmax(substream->runtime, 1669 snd_pcm_hw_constraint_single(substream->runtime,
1673 SNDRV_PCM_HW_PARAM_CHANNELS, 1670 SNDRV_PCM_HW_PARAM_CHANNELS,
1674 2, 2); 1671 2);
1675 } 1672 }
1676 twl4030->master_substream = substream; 1673 twl4030->master_substream = substream;
1677 } 1674 }
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index e19026380534..e4c694c758b8 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -150,14 +150,12 @@ static int uda134x_startup(struct snd_pcm_substream *substream,
150 master_runtime->sample_bits, 150 master_runtime->sample_bits,
151 master_runtime->rate); 151 master_runtime->rate);
152 152
153 snd_pcm_hw_constraint_minmax(substream->runtime, 153 snd_pcm_hw_constraint_single(substream->runtime,
154 SNDRV_PCM_HW_PARAM_RATE, 154 SNDRV_PCM_HW_PARAM_RATE,
155 master_runtime->rate,
156 master_runtime->rate); 155 master_runtime->rate);
157 156
158 snd_pcm_hw_constraint_minmax(substream->runtime, 157 snd_pcm_hw_constraint_single(substream->runtime,
159 SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 158 SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
160 master_runtime->sample_bits,
161 master_runtime->sample_bits); 159 master_runtime->sample_bits);
162 160
163 uda134x->slave_substream = substream; 161 uda134x->slave_substream = substream;
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c
index 80fb1dc81f6c..7693c1129bab 100644
--- a/sound/soc/codecs/wl1273.c
+++ b/sound/soc/codecs/wl1273.c
@@ -307,11 +307,10 @@ static int wl1273_startup(struct snd_pcm_substream *substream,
307 307
308 switch (wl1273->mode) { 308 switch (wl1273->mode) {
309 case WL1273_MODE_BT: 309 case WL1273_MODE_BT:
310 snd_pcm_hw_constraint_minmax(substream->runtime, 310 snd_pcm_hw_constraint_single(substream->runtime,
311 SNDRV_PCM_HW_PARAM_RATE, 311 SNDRV_PCM_HW_PARAM_RATE, 8000);
312 8000, 8000); 312 snd_pcm_hw_constraint_single(substream->runtime,
313 snd_pcm_hw_constraint_minmax(substream->runtime, 313 SNDRV_PCM_HW_PARAM_CHANNELS, 1);
314 SNDRV_PCM_HW_PARAM_CHANNELS, 1, 1);
315 break; 314 break;
316 case WL1273_MODE_FM_RX: 315 case WL1273_MODE_FM_RX:
317 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 316 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index c4453120b11a..7a5c9a36c1db 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -117,20 +117,10 @@ static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd,
117 return 0; 117 return 0;
118} 118}
119 119
120static unsigned int rates_48000[] = {
121 48000,
122};
123
124static struct snd_pcm_hw_constraint_list constraints_48000 = {
125 .count = ARRAY_SIZE(rates_48000),
126 .list = rates_48000,
127};
128
129static int byt_aif1_startup(struct snd_pcm_substream *substream) 120static int byt_aif1_startup(struct snd_pcm_substream *substream)
130{ 121{
131 return snd_pcm_hw_constraint_list(substream->runtime, 0, 122 return snd_pcm_hw_constraint_single(substream->runtime,
132 SNDRV_PCM_HW_PARAM_RATE, 123 SNDRV_PCM_HW_PARAM_RATE, 48000);
133 &constraints_48000);
134} 124}
135 125
136static struct snd_soc_ops byt_aif1_ops = { 126static struct snd_soc_ops byt_aif1_ops = {
diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index 49f4869cec48..4e2fcf188dd1 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -193,20 +193,10 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
193 return 0; 193 return 0;
194} 194}
195 195
196static unsigned int rates_48000[] = {
197 48000,
198};
199
200static struct snd_pcm_hw_constraint_list constraints_48000 = {
201 .count = ARRAY_SIZE(rates_48000),
202 .list = rates_48000,
203};
204
205static int cht_aif1_startup(struct snd_pcm_substream *substream) 196static int cht_aif1_startup(struct snd_pcm_substream *substream)
206{ 197{
207 return snd_pcm_hw_constraint_list(substream->runtime, 0, 198 return snd_pcm_hw_constraint_single(substream->runtime,
208 SNDRV_PCM_HW_PARAM_RATE, 199 SNDRV_PCM_HW_PARAM_RATE, 48000);
209 &constraints_48000);
210} 200}
211 201
212static int cht_max98090_headset_init(struct snd_soc_component *component) 202static int cht_max98090_headset_init(struct snd_soc_component *component)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 7be8461e4d3b..38d65a3529c4 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -235,20 +235,10 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
235 return 0; 235 return 0;
236} 236}
237 237
238static unsigned int rates_48000[] = {
239 48000,
240};
241
242static struct snd_pcm_hw_constraint_list constraints_48000 = {
243 .count = ARRAY_SIZE(rates_48000),
244 .list = rates_48000,
245};
246
247static int cht_aif1_startup(struct snd_pcm_substream *substream) 238static int cht_aif1_startup(struct snd_pcm_substream *substream)
248{ 239{
249 return snd_pcm_hw_constraint_list(substream->runtime, 0, 240 return snd_pcm_hw_constraint_single(substream->runtime,
250 SNDRV_PCM_HW_PARAM_RATE, 241 SNDRV_PCM_HW_PARAM_RATE, 48000);
251 &constraints_48000);
252} 242}
253 243
254static struct snd_soc_ops cht_aif1_ops = { 244static struct snd_soc_ops cht_aif1_ops = {
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index 23fe04075142..5621ccd92992 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -222,20 +222,10 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
222 return 0; 222 return 0;
223} 223}
224 224
225static unsigned int rates_48000[] = {
226 48000,
227};
228
229static struct snd_pcm_hw_constraint_list constraints_48000 = {
230 .count = ARRAY_SIZE(rates_48000),
231 .list = rates_48000,
232};
233
234static int cht_aif1_startup(struct snd_pcm_substream *substream) 225static int cht_aif1_startup(struct snd_pcm_substream *substream)
235{ 226{
236 return snd_pcm_hw_constraint_list(substream->runtime, 0, 227 return snd_pcm_hw_constraint_single(substream->runtime,
237 SNDRV_PCM_HW_PARAM_RATE, 228 SNDRV_PCM_HW_PARAM_RATE, 48000);
238 &constraints_48000);
239} 229}
240 230
241static struct snd_soc_ops cht_aif1_ops = { 231static struct snd_soc_ops cht_aif1_ops = {
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index dcb5336b5698..190f868e78b2 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -99,8 +99,7 @@ static int n810_startup(struct snd_pcm_substream *substream)
99 struct snd_pcm_runtime *runtime = substream->runtime; 99 struct snd_pcm_runtime *runtime = substream->runtime;
100 struct snd_soc_pcm_runtime *rtd = substream->private_data; 100 struct snd_soc_pcm_runtime *rtd = substream->private_data;
101 101
102 snd_pcm_hw_constraint_minmax(runtime, 102 snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, 2);
103 SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2);
104 103
105 n810_ext_control(&rtd->card->dapm); 104 n810_ext_control(&rtd->card->dapm);
106 return clk_prepare_enable(sys_clkout2); 105 return clk_prepare_enable(sys_clkout2);
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 3bebfb1d3a6f..20728d07de5e 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -107,8 +107,7 @@ static int rx51_startup(struct snd_pcm_substream *substream)
107 struct snd_soc_pcm_runtime *rtd = substream->private_data; 107 struct snd_soc_pcm_runtime *rtd = substream->private_data;
108 struct snd_soc_card *card = rtd->card; 108 struct snd_soc_card *card = rtd->card;
109 109
110 snd_pcm_hw_constraint_minmax(runtime, 110 snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, 2);
111 SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2);
112 rx51_ext_control(&card->dapm); 111 rx51_ext_control(&card->dapm);
113 112
114 return 0; 113 return 0;
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 317395824cd7..c86dc96e8986 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -200,9 +200,9 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
200 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n", 200 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n",
201 soc_dai->rate); 201 soc_dai->rate);
202 202
203 ret = snd_pcm_hw_constraint_minmax(substream->runtime, 203 ret = snd_pcm_hw_constraint_single(substream->runtime,
204 SNDRV_PCM_HW_PARAM_RATE, 204 SNDRV_PCM_HW_PARAM_RATE,
205 soc_dai->rate, soc_dai->rate); 205 soc_dai->rate);
206 if (ret < 0) { 206 if (ret < 0) {
207 dev_err(soc_dai->dev, 207 dev_err(soc_dai->dev,
208 "ASoC: Unable to apply rate constraint: %d\n", 208 "ASoC: Unable to apply rate constraint: %d\n",
@@ -216,9 +216,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
216 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d channel(s)\n", 216 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d channel(s)\n",
217 soc_dai->channels); 217 soc_dai->channels);
218 218
219 ret = snd_pcm_hw_constraint_minmax(substream->runtime, 219 ret = snd_pcm_hw_constraint_single(substream->runtime,
220 SNDRV_PCM_HW_PARAM_CHANNELS, 220 SNDRV_PCM_HW_PARAM_CHANNELS,
221 soc_dai->channels,
222 soc_dai->channels); 221 soc_dai->channels);
223 if (ret < 0) { 222 if (ret < 0) {
224 dev_err(soc_dai->dev, 223 dev_err(soc_dai->dev,
@@ -233,9 +232,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
233 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d sample bits\n", 232 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d sample bits\n",
234 soc_dai->sample_bits); 233 soc_dai->sample_bits);
235 234
236 ret = snd_pcm_hw_constraint_minmax(substream->runtime, 235 ret = snd_pcm_hw_constraint_single(substream->runtime,
237 SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 236 SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
238 soc_dai->sample_bits,
239 soc_dai->sample_bits); 237 soc_dai->sample_bits);
240 if (ret < 0) { 238 if (ret < 0) {
241 dev_err(soc_dai->dev, 239 dev_err(soc_dai->dev,
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 6ba8ae9ecc7a..6d5698b25bd4 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -522,9 +522,9 @@ static int ux500_msp_dai_hw_params(struct snd_pcm_substream *substream,
522 slots_active = hweight32(mask); 522 slots_active = hweight32(mask);
523 dev_dbg(dai->dev, "TDM-slots active: %d", slots_active); 523 dev_dbg(dai->dev, "TDM-slots active: %d", slots_active);
524 524
525 snd_pcm_hw_constraint_minmax(runtime, 525 snd_pcm_hw_constraint_single(runtime,
526 SNDRV_PCM_HW_PARAM_CHANNELS, 526 SNDRV_PCM_HW_PARAM_CHANNELS,
527 slots_active, slots_active); 527 slots_active);
528 break; 528 break;
529 529
530 default: 530 default:
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 349bc96ca1fe..e5f18a288b74 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -17,6 +17,7 @@ libperf-y += levenshtein.o
17libperf-y += llvm-utils.o 17libperf-y += llvm-utils.o
18libperf-y += parse-options.o 18libperf-y += parse-options.o
19libperf-y += parse-events.o 19libperf-y += parse-events.o
20libperf-y += perf_regs.o
20libperf-y += path.o 21libperf-y += path.o
21libperf-y += rbtree.o 22libperf-y += rbtree.o
22libperf-y += bitmap.o 23libperf-y += bitmap.o
@@ -103,7 +104,6 @@ libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
103 104
104libperf-y += scripting-engines/ 105libperf-y += scripting-engines/
105 106
106libperf-$(CONFIG_PERF_REGS) += perf_regs.o
107libperf-$(CONFIG_ZLIB) += zlib.o 107libperf-$(CONFIG_ZLIB) += zlib.o
108libperf-$(CONFIG_LZMA) += lzma.o 108libperf-$(CONFIG_LZMA) += lzma.o
109 109
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 885e8ac83997..6b8eb13e14e4 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -6,6 +6,7 @@ const struct sample_reg __weak sample_reg_masks[] = {
6 SMPL_REG_END 6 SMPL_REG_END
7}; 7};
8 8
9#ifdef HAVE_PERF_REGS_SUPPORT
9int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) 10int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
10{ 11{
11 int i, idx = 0; 12 int i, idx = 0;
@@ -29,3 +30,4 @@ out:
29 *valp = regs->cache_regs[id]; 30 *valp = regs->cache_regs[id];
30 return 0; 31 return 0;
31} 32}
33#endif
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 2984dcc54d67..679d6e493962 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -2,6 +2,7 @@
2#define __PERF_REGS_H 2#define __PERF_REGS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h>
5 6
6struct regs_dump; 7struct regs_dump;
7 8
diff --git a/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c b/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c
index d1b647509596..6cae06117b55 100644
--- a/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c
+++ b/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c
@@ -25,10 +25,19 @@
25 25
26#define FIXUP_SECTION ".ex_fixup" 26#define FIXUP_SECTION ".ex_fixup"
27 27
28static inline unsigned long __fls(unsigned long x);
29
28#include "word-at-a-time.h" 30#include "word-at-a-time.h"
29 31
30#include "utils.h" 32#include "utils.h"
31 33
34static inline unsigned long __fls(unsigned long x)
35{
36 int lz;
37
38 asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
39 return sizeof(unsigned long) - 1 - lz;
40}
32 41
33static int page_size; 42static int page_size;
34static char *mem_region; 43static char *mem_region;