]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Sep 2017 19:49:03 +0000 (12:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Sep 2017 19:49:03 +0000 (12:49 -0700)
Pull networking fixes from David Miller:

 1) Fix handling of pinned BPF map nodes in hash of maps, from Daniel
    Borkmann.

 2) IPSEC ESP error paths leak memory, from Steffen Klassert.

 3) We need an RCU grace period before freeing fib6_node objects, from
    Wei Wang.

 4) Must check skb_put_padto() return value in HSR driver, from FLorian
    Fainelli.

 5) Fix oops on PHY probe failure in ftgmac100 driver, from Andrew
    Jeffery.

 6) Fix infinite loop in UDP queue when using SO_PEEK_OFF, from Eric
    Dumazet.

 7) Use after free when tcf_chain_destroy() called multiple times, from
    Jiri Pirko.

 8) Fix KSZ DSA tag layer multiple free of SKBS, from Florian Fainelli.

 9) Fix leak of uninitialized memory in sctp_get_sctp_info(),
    inet_diag_msg_sctpladdrs_fill() and inet_diag_msg_sctpaddrs_fill().
    From Stefano Brivio.

10) L2TP tunnel refcount fixes from Guillaume Nault.

11) Don't leak UDP secpath in udp_set_dev_scratch(), from Yossi
    Kauperman.

12) Revert a PHY layer change wrt. handling of PHY_HALTED state in
    phy_stop_machine(), it causes regressions for multiple people. From
    Florian Fainelli.

13) When packets are sent out of br0 we have to clear the
    offload_fwdq_mark value.

14) Several NULL pointer deref fixes in packet schedulers when their
    ->init() routine fails. From Nikolay Aleksandrov.

15) Aquantium devices cannot checksum offload correctly when the packet
    is <= 60 bytes. From Pavel Belous.

16) Fix vnet header access past end of buffer in AF_PACKET, from
    Benjamin Poirier.

17) Double free in probe error paths of nfp driver, from Dan Carpenter.

18) QOS capability not checked properly in DCB init paths of mlx5
    driver, from Huy Nguyen.

19) Fix conflicts between firmware load failure and health_care timer in
    mlx5, also from Huy Nguyen.

20) Fix dangling page pointer when DMA mapping errors occur in mlx5,
    from Eran Ben ELisha.

21) ->ndo_setup_tc() in bnxt_en driver doesn't count rings properly,
    from Michael Chan.

22) Missing MSIX vector free in bnxt_en, also from Michael Chan.

23) Refcount leak in xfrm layer when using sk_policy, from Lorenzo
    Colitti.

24) Fix copy of uninitialized data in qlge driver, from Arnd Bergmann.

25) bpf_setsockopts() erroneously always returns -EINVAL even on
    success. Fix from Yuchung Cheng.

26) tipc_rcv() needs to linearize the SKB before parsing the inner
    headers, from Parthasarathy Bhuvaragan.

27) Fix deadlock between link status updates and link removal in netvsc
    driver, from Stephen Hemminger.

28) Missed locking of page fragment handling in ESP output, from Steffen
    Klassert.

29) Fix refcnt leak in ebpf congestion control code, from Sabrina
    Dubroca.

30) sxgbe_probe_config_dt() doesn't check devm_kzalloc()'s return value,
    from Christophe Jaillet.

31) Fix missing ipv6 rx_dst_cookie update when rx_dst is updated during
    early demux, from Paolo Abeni.

32) Several info leaks in xfrm_user layer, from Mathias Krause.

33) Fix out of bounds read in cxgb4 driver, from Stefano Brivio.

34) Properly propagate obsolete state of route upwards in ipv6 so that
    upper holders like xfrm can see it. From Xin Long.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (118 commits)
  udp: fix secpath leak
  bridge: switchdev: Clear forward mark when transmitting packet
  mlxsw: spectrum: Forbid linking to devices that have uppers
  wl1251: add a missing spin_lock_init()
  Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"
  net: dsa: bcm_sf2: Fix number of CFP entries for BCM7278
  kcm: do not attach PF_KCM sockets to avoid deadlock
  sch_tbf: fix two null pointer dereferences on init failure
  sch_sfq: fix null pointer dereference on init failure
  sch_netem: avoid null pointer deref on init failure
  sch_fq_codel: avoid double free on init failure
  sch_cbq: fix null pointer dereferences on init failure
  sch_hfsc: fix null pointer deref and double free on init failure
  sch_hhf: fix null pointer dereference on init failure
  sch_multiq: fix double free on init failure
  sch_htb: fix crash on init failure
  net/mlx5e: Fix CQ moderation mode not set properly
  net/mlx5e: Fix inline header size for small packets
  net/mlx5: E-Switch, Unload the representors in the correct order
  net/mlx5e: Properly resolve TC offloaded ipv6 vxlan tunnel source address
  ...

241 files changed:
Makefile
arch/alpha/include/asm/io.h
arch/alpha/include/asm/types.h
arch/alpha/include/asm/unistd.h
arch/alpha/include/uapi/asm/types.h
arch/alpha/include/uapi/asm/unistd.h
arch/alpha/kernel/core_marvel.c
arch/alpha/kernel/core_titan.c
arch/alpha/kernel/module.c
arch/alpha/kernel/smp.c
arch/alpha/kernel/systbls.S
arch/alpha/lib/Makefile
arch/alpha/lib/copy_user.S
arch/alpha/lib/ev6-copy_user.S
arch/arc/kernel/intc-arcv2.c
arch/arc/kernel/intc-compact.c
arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
arch/arm/include/asm/kvm_host.h
arch/arm/mach-at91/Kconfig
arch/arm/mach-at91/pm.c
arch/arm64/include/asm/kvm_host.h
arch/arm64/kernel/fpsimd.c
arch/arm64/kernel/head.S
arch/arm64/kernel/kaslr.c
arch/arm64/mm/fault.c
arch/c6x/configs/dsk6455_defconfig
arch/c6x/configs/evmc6457_defconfig
arch/c6x/configs/evmc6472_defconfig
arch/c6x/configs/evmc6474_defconfig
arch/c6x/configs/evmc6678_defconfig
arch/c6x/platforms/megamod-pic.c
arch/c6x/platforms/plldata.c
arch/c6x/platforms/timer64.c
arch/mips/include/asm/kvm_host.h
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/include/asm/mmu_context.h
arch/powerpc/include/asm/pgtable-be-types.h
arch/powerpc/include/asm/pgtable-types.h
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S
arch/powerpc/kvm/book3s_xive_template.c
arch/powerpc/platforms/powernv/npu-dma.c
arch/s390/include/asm/mmu_context.h
arch/s390/kvm/sthyi.c
arch/s390/mm/mmap.c
arch/x86/include/asm/fpu/internal.h
arch/x86/include/asm/kvm_host.h
arch/x86/include/asm/mmu_context.h
arch/x86/kvm/cpuid.c
arch/x86/kvm/kvm_cache_regs.h
arch/x86/kvm/mmu.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c
arch/x86/um/user-offsets.c
block/blk-mq-debugfs.c
block/blk-throttle.c
block/bsg-lib.c
crypto/algif_skcipher.c
crypto/chacha20_generic.c
crypto/testmgr.h
drivers/acpi/acpica/nsxfeval.c
drivers/acpi/ec.c
drivers/acpi/internal.h
drivers/acpi/property.c
drivers/acpi/scan.c
drivers/android/binder.c
drivers/ata/ahci_da850.c
drivers/ata/libata-core.c
drivers/block/loop.c
drivers/block/loop.h
drivers/block/virtio_blk.c
drivers/block/xen-blkback/xenbus.c
drivers/dma/tegra210-adma.c
drivers/gpio/gpio-mvebu.c
drivers/gpio/gpiolib-sysfs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
drivers/gpu/drm/bridge/sil-sii8620.c
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_plane.c
drivers/gpu/drm/i915/gvt/cmd_parser.c
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_dsi_dcs_backlight.c
drivers/gpu/drm/i915/intel_dsi_vbt.c
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_lspcon.c
drivers/gpu/drm/imx/ipuv3-plane.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/sun4i/sun4i_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/ipu-v3/Kconfig
drivers/i2c/busses/i2c-aspeed.c
drivers/i2c/busses/i2c-designware-platdrv.c
drivers/i2c/busses/i2c-designware-slave.c
drivers/i2c/busses/i2c-simtec.c
drivers/i2c/i2c-core-base.c
drivers/iio/adc/ina2xx-adc.c
drivers/iio/adc/stm32-adc-core.c
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
drivers/iio/imu/adis16480.c
drivers/iio/magnetometer/st_magn_core.c
drivers/iio/pressure/bmp280-core.c
drivers/iio/pressure/bmp280.h
drivers/iio/trigger/stm32-timer-trigger.c
drivers/infiniband/core/umem_odp.c
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/hfi1/mmu_rb.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/qp.c
drivers/input/joystick/xpad.c
drivers/input/misc/soc_button_array.c
drivers/input/mouse/alps.c
drivers/input/mouse/alps.h
drivers/input/mouse/elan_i2c_core.c
drivers/input/mouse/synaptics.c
drivers/input/mouse/trackpoint.c
drivers/input/mouse/trackpoint.h
drivers/iommu/amd_iommu_types.h
drivers/iommu/amd_iommu_v2.c
drivers/iommu/intel-iommu.c
drivers/iommu/intel-svm.c
drivers/iommu/iommu-sysfs.c
drivers/md/dm-mpath.c
drivers/md/dm.c
drivers/memory/atmel-ebi.c
drivers/mfd/atmel-smc.c
drivers/mfd/da9062-core.c
drivers/misc/mic/scif/scif_dma.c
drivers/misc/sgi-gru/grutlbpurge.c
drivers/mmc/core/block.c
drivers/mmc/host/sdhci-xenon.c
drivers/mtd/nand/atmel/nand-controller.c
drivers/mtd/nand/nandsim.c
drivers/ntb/ntb_transport.c
drivers/ntb/test/ntb_tool.c
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/pci/msi.c
drivers/s390/cio/vfio_ccw_cp.c
drivers/scsi/Kconfig
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/aacraid.h
drivers/scsi/csiostor/csio_hw.c
drivers/scsi/csiostor/csio_init.c
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
drivers/scsi/ipr.c
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/qedf/qedf_els.c
drivers/scsi/scsi.c
drivers/scsi/sd.c
drivers/scsi/sd_zbc.c
drivers/scsi/sg.c
drivers/soc/ti/knav_qmss_queue.c
drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
drivers/staging/rtl8188eu/os_dep/usb_intf.c
drivers/tty/pty.c
drivers/tty/tty_io.c
drivers/virtio/virtio_pci_common.c
drivers/xen/Makefile
drivers/xen/gntdev.c
fs/btrfs/disk-io.c
fs/btrfs/inode.c
fs/btrfs/raid56.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h
fs/ceph/addr.c
fs/ceph/cache.c
fs/cifs/dir.c
fs/cifs/smb2pdu.c
fs/cifs/smb2pdu.h
fs/dax.c
fs/devpts/inode.c
fs/ext4/mballoc.c
fs/ext4/xattr.c
fs/jfs/super.c
fs/nfsd/nfs4xdr.c
fs/select.c
include/asm-generic/topology.h
include/asm-generic/vmlinux.lds.h
include/linux/ata.h
include/linux/blkdev.h
include/linux/bsg-lib.h
include/linux/compiler.h
include/linux/device-mapper.h
include/linux/devpts_fs.h
include/linux/fs.h
include/linux/iio/iio.h
include/linux/iio/trigger.h
include/linux/iommu.h
include/linux/mm.h
include/linux/mmu_notifier.h
include/linux/nvme.h
include/rdma/ib_verbs.h
include/scsi/scsi_cmnd.h
include/uapi/linux/loop.h
include/uapi/linux/ndctl.h
kernel/cgroup/cpuset.c
kernel/events/core.c
kernel/events/uprobes.c
kernel/fork.c
kernel/kthread.c
kernel/sched/wait.c
kernel/time/timer.c
kernel/trace/ftrace.c
kernel/trace/ring_buffer.c
kernel/trace/ring_buffer_benchmark.c
kernel/trace/trace.c
kernel/trace/trace_events_filter.c
kernel/trace/tracing_map.c
lib/mpi/mpicoder.c
mm/filemap.c
mm/madvise.c
mm/memblock.c
mm/memory.c
mm/mmu_notifier.c
mm/page_alloc.c
mm/rmap.c
mm/shmem.c
net/sunrpc/svcsock.c
scripts/Kbuild.include
scripts/Makefile.asm-generic
scripts/Makefile.build
scripts/Makefile.dtbinst
scripts/basic/Makefile
scripts/basic/fixdep.c
scripts/dtc/checks.c
sound/core/control.c
sound/core/pcm_native.c
sound/firewire/iso-resources.c
sound/firewire/motu/motu.c
sound/pci/hda/patch_conexant.c
sound/soc/codecs/rt5670.c
sound/soc/codecs/rt5677.c
sound/soc/generic/simple-card-utils.c
sound/soc/intel/boards/cht_bsw_rt5672.c
sound/usb/quirks.c
tools/objtool/arch/x86/decode.c
tools/testing/selftests/ntb/ntb_test.sh
virt/kvm/kvm_main.c

index 235826f957411e8a3f02225439c38d92adf00802..8db6be7dca731f4cb5a552c45811ce334747dff9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 4
 PATCHLEVEL = 13
 SUBLEVEL = 0
-EXTRAVERSION = -rc6
+EXTRAVERSION = -rc7
 NAME = Fearless Coyote
 
 # *DOCUMENTATION*
@@ -396,7 +396,7 @@ LINUXINCLUDE    := \
 KBUILD_CPPFLAGS := -D__KERNEL__
 
 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-                  -fno-strict-aliasing -fno-common \
+                  -fno-strict-aliasing -fno-common -fshort-wchar \
                   -Werror-implicit-function-declaration \
                   -Wno-format-security \
                   -std=gnu89 $(call cc-option,-fno-PIE)
@@ -442,7 +442,7 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
 # ===========================================================================
 # Rules shared between *config targets and build targets
 
-# Basic helpers built in scripts/
+# Basic helpers built in scripts/basic/
 PHONY += scripts_basic
 scripts_basic:
        $(Q)$(MAKE) $(build)=scripts/basic
@@ -505,7 +505,7 @@ ifeq ($(KBUILD_EXTMOD),)
                 endif
         endif
 endif
-# install and module_install need also be processed one by one
+# install and modules_install need also be processed one by one
 ifneq ($(filter install,$(MAKECMDGOALS)),)
         ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
                mixed-targets := 1
@@ -964,7 +964,7 @@ export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-
 export KBUILD_VMLINUX_LIBS := $(libs-y1)
 export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
 export LDFLAGS_vmlinux
-# used by scripts/pacmage/Makefile
+# used by scripts/package/Makefile
 export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
 
 vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS)
@@ -992,8 +992,8 @@ include/generated/autoksyms.h: FORCE
 ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
 
 # Final link of vmlinux with optional arch pass after final link
-    cmd_link-vmlinux =                                                 \
-       $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ;       \
+cmd_link-vmlinux =                                                 \
+       $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ;    \
        $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
 
 vmlinux: scripts/link-vmlinux.sh vmlinux_prereq $(vmlinux-deps) FORCE
@@ -1184,6 +1184,7 @@ PHONY += kselftest
 kselftest:
        $(Q)$(MAKE) -C tools/testing/selftests run_tests
 
+PHONY += kselftest-clean
 kselftest-clean:
        $(Q)$(MAKE) -C tools/testing/selftests clean
 
index ff4049155c840c2fc4bc9e8015b5282dadb57469..4d61d2a50c525aab2531e3bf670227cbd5e66bca 100644 (file)
@@ -299,6 +299,7 @@ static inline void __iomem * ioremap_nocache(unsigned long offset,
        return ioremap(offset, size);
 }
 
+#define ioremap_wc ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 static inline void iounmap(volatile void __iomem *addr)
index 4cb4b6d3452c0b3439c3aa3c0f928f74de09fb3a..0bc66e1d3a7e9c81f1cca84943f60cd91d85a625 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _ALPHA_TYPES_H
 #define _ALPHA_TYPES_H
 
-#include <asm-generic/int-ll64.h>
+#include <uapi/asm/types.h>
 
 #endif /* _ALPHA_TYPES_H */
index b37153ecf2ac33e19b7df4b061afddf4238f7ebb..db7fc0f511e2ae9cc905a6bae64f9195562c013f 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <uapi/asm/unistd.h>
 
-#define NR_SYSCALLS                    514
+#define NR_SYSCALLS                    523
 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
index 9fd3cd459777767e7c80c4c761ee88278f62b17d..8d1024d7be0546bc744adf163e87f9dc723539fe 100644 (file)
@@ -9,8 +9,18 @@
  * need to be careful to avoid a name clashes.
  */
 
-#ifndef __KERNEL__
+/*
+ * This is here because we used to use l64 for alpha
+ * and we don't want to impact user mode with our change to ll64
+ * in the kernel.
+ *
+ * However, some user programs are fine with this.  They can
+ * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
+ */
+#if !defined(__SANE_USERSPACE_TYPES__) && !defined(__KERNEL__)
 #include <asm-generic/int-l64.h>
+#else
+#include <asm-generic/int-ll64.h>
 #endif
 
 #endif /* _UAPI_ALPHA_TYPES_H */
index aa33bf5aacb6c1666203e38700939750c90cb5c5..a2945fea6c868096e6094780bd96384205806a74 100644 (file)
 #define __NR_getrandom                 511
 #define __NR_memfd_create              512
 #define __NR_execveat                  513
+#define __NR_seccomp                   514
+#define __NR_bpf                       515
+#define __NR_userfaultfd               516
+#define __NR_membarrier                        517
+#define __NR_mlock2                    518
+#define __NR_copy_file_range           519
+#define __NR_preadv2                   520
+#define __NR_pwritev2                  521
+#define __NR_statx                     522
+
+/* Alpha doesn't have protection keys. */
+#define __IGNORE_pkey_mprotect
+#define __IGNORE_pkey_alloc
+#define __IGNORE_pkey_free
 
 #endif /* _UAPI_ALPHA_UNISTD_H */
index d5f0580746a5d632452816b00427c212230b0810..03ff832b1cb4483e7d717def1c4f10ebe6c63619 100644 (file)
@@ -351,7 +351,7 @@ marvel_init_io7(struct io7 *io7)
        }
 }
 
-void
+void __init
 marvel_io7_present(gct6_node *node)
 {
        int pe;
@@ -369,6 +369,7 @@ marvel_io7_present(gct6_node *node)
 static void __init
 marvel_find_console_vga_hose(void)
 {
+#ifdef CONFIG_VGA_HOSE
        u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset);
 
        if (pu64[7] == 3) {     /* TERM_TYPE == graphics */
@@ -402,9 +403,10 @@ marvel_find_console_vga_hose(void)
                        pci_vga_hose = hose;
                }
        }
+#endif
 }
 
-gct6_search_struct gct_wanted_node_list[] = {
+gct6_search_struct gct_wanted_node_list[] __initdata = {
        { GCT_TYPE_HOSE, GCT_SUBTYPE_IO_PORT_MODULE, marvel_io7_present },
        { 0, 0, NULL }
 };
index 219bf271c0ba2e5f2d668af707df57fbbd00ccfd..b532d925443d50b02f3a54481de122c36d948f79 100644 (file)
@@ -461,6 +461,7 @@ titan_ioremap(unsigned long addr, unsigned long size)
        unsigned long *ptes;
        unsigned long pfn;
 
+#ifdef CONFIG_VGA_HOSE
        /*
         * Adjust the address and hose, if necessary.
         */ 
@@ -468,6 +469,7 @@ titan_ioremap(unsigned long addr, unsigned long size)
                h = pci_vga_hose->index;
                addr += pci_vga_hose->mem_space->start;
        }
+#endif
 
        /*
         * Find the hose.
index 936bc8f89a679f2f8aeb2f7e3cb41f11190a2d77..47632fa8c24e02418cdbac8d5c139f101aa51945 100644 (file)
@@ -181,6 +181,9 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
                switch (r_type) {
                case R_ALPHA_NONE:
                        break;
+               case R_ALPHA_REFLONG:
+                       *(u32 *)location = value;
+                       break;
                case R_ALPHA_REFQUAD:
                        /* BUG() can produce misaligned relocations. */
                        ((u32 *)location)[0] = value;
index 9fc560459ebd64ad3735f9b4dcd5ce6596b7bfee..f6726a74642703381c2151e9d927e267fcba0975 100644 (file)
@@ -115,7 +115,7 @@ wait_boot_cpu_to_stop(int cpuid)
 /*
  * Where secondaries begin a life of C.
  */
-void
+void __init
 smp_callin(void)
 {
        int cpuid = hard_smp_processor_id();
index 9b62e3fd4f038a925657beb15de3de89f8548473..5b4514abb23450998515530ebc824ae1857f27b9 100644 (file)
@@ -532,6 +532,15 @@ sys_call_table:
        .quad sys_getrandom
        .quad sys_memfd_create
        .quad sys_execveat
+       .quad sys_seccomp
+       .quad sys_bpf                           /* 515 */
+       .quad sys_userfaultfd
+       .quad sys_membarrier
+       .quad sys_mlock2
+       .quad sys_copy_file_range
+       .quad sys_preadv2                       /* 520 */
+       .quad sys_pwritev2
+       .quad sys_statx
 
        .size sys_call_table, . - sys_call_table
        .type sys_call_table, @object
index 7083434dd2419b7b3ef6ef8e74c204522d4a3257..a8081596036457af2149b37d356c64f2f1e7acc6 100644 (file)
@@ -20,12 +20,8 @@ lib-y =      __divqu.o __remqu.o __divlu.o __remlu.o \
        checksum.o \
        csum_partial_copy.o \
        $(ev67-y)strlen.o \
-       $(ev67-y)strcat.o \
-       strcpy.o \
-       $(ev67-y)strncat.o \
-       strncpy.o \
-       $(ev6-y)stxcpy.o \
-       $(ev6-y)stxncpy.o \
+       stycpy.o \
+       styncpy.o \
        $(ev67-y)strchr.o \
        $(ev67-y)strrchr.o \
        $(ev6-y)memchr.o \
@@ -49,3 +45,17 @@ AFLAGS___remlu.o =       -DREM -DINTSIZE
 $(addprefix $(obj)/,__divqu.o __remqu.o __divlu.o __remlu.o): \
                                                $(src)/$(ev6-y)divide.S FORCE
        $(call if_changed_rule,as_o_S)
+
+# There are direct branches between {str*cpy,str*cat} and stx*cpy.
+# Ensure the branches are within range by merging these objects.
+
+LDFLAGS_stycpy.o := -r
+LDFLAGS_styncpy.o := -r
+
+$(obj)/stycpy.o: $(obj)/strcpy.o $(obj)/$(ev67-y)strcat.o \
+                $(obj)/$(ev6-y)stxcpy.o FORCE
+       $(call if_changed,ld)
+
+$(obj)/styncpy.o: $(obj)/strncpy.o $(obj)/$(ev67-y)strncat.o \
+                $(obj)/$(ev6-y)stxncpy.o FORCE
+       $(call if_changed,ld)
index 159f1b7e6e495f098a28dc818c7c383ede2dda76..c277a1a4383e5fbb4bbb76b8c2c7802b8bbd6a26 100644 (file)
@@ -34,7 +34,7 @@
        .ent __copy_user
 __copy_user:
        .prologue 0
-       and $18,$18,$0
+       mov $18,$0
        and $16,7,$3
        beq $0,$35
        beq $3,$36
index 35e6710d070054b1c9987d0f5c10f1c29510b1a2..954ca03ebebef371a4e1dd873efce4493de53309 100644 (file)
                                # Pipeline info: Slotting & Comments
 __copy_user:
        .prologue 0
-       andq $18, $18, $0
-       subq $18, 32, $1        # .. E  .. ..   : Is this going to be a small copy?
-       beq $0, $zerolength     # U  .. .. ..   : U L U L
+       mov $18, $0             # .. .. .. E
+       subq $18, 32, $1        # .. .. E. ..   : Is this going to be a small copy?
+       nop                     # .. E  .. ..
+       beq $18, $zerolength    # U  .. .. ..   : U L U L
 
        and $16,7,$3            # .. .. .. E    : is leading dest misalignment
        ble $1, $onebyteloop    # .. .. U  ..   : 1st branch : small amount of data
index cf90714a676d6baabbdc1beb2119fe530e1c84f3..067ea362fb3efc3bc3a9217aaf197763eafb275e 100644 (file)
@@ -75,13 +75,20 @@ void arc_init_IRQ(void)
         * Set a default priority for all available interrupts to prevent
         * switching of register banks if Fast IRQ and multiple register banks
         * are supported by CPU.
-        * Also disable all IRQ lines so faulty external hardware won't
+        * Also disable private-per-core IRQ lines so faulty external HW won't
         * trigger interrupt that kernel is not ready to handle.
         */
        for (i = NR_EXCEPTIONS; i < irq_bcr.irqs + NR_EXCEPTIONS; i++) {
                write_aux_reg(AUX_IRQ_SELECT, i);
                write_aux_reg(AUX_IRQ_PRIORITY, ARCV2_IRQ_DEF_PRIO);
-               write_aux_reg(AUX_IRQ_ENABLE, 0);
+
+               /*
+                * Only mask cpu private IRQs here.
+                * "common" interrupts are masked at IDU, otherwise it would
+                * need to be unmasked at each cpu, with IPIs
+                */
+               if (i < FIRST_EXT_IRQ)
+                       write_aux_reg(AUX_IRQ_ENABLE, 0);
        }
 
        /* setup status32, don't enable intr yet as kernel doesn't want */
index cef388025adf43aed091869f102e01e1bee72092..47b421fa0147be9604b1c808d378a0108f735b34 100644 (file)
@@ -27,7 +27,7 @@
  */
 void arc_init_IRQ(void)
 {
-       int level_mask = 0, i;
+       unsigned int level_mask = 0, i;
 
        /* Is timer high priority Interrupt (Level2 in ARCompact jargon) */
        level_mask |= IS_ENABLED(CONFIG_ARC_COMPACT_IRQ_LEVELS) << TIMER0_IRQ;
index f92f957412073279a3be9713794bb2336dbf4752..a183b56283f8ff9e9d41d616edfc00a82d200267 100644 (file)
 
 &hdmicec {
        status = "okay";
+       needs-hpd;
 };
 
 &hsi2c_4 {
index 127e2dd2e21ce12c7daa21e682ce72d36f6b1afd..4a879f6ff13bea92d189eec9370be73cd616705c 100644 (file)
@@ -225,12 +225,6 @@ int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 
-/* We do not have shadow page tables, hence the empty hooks */
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-                                                        unsigned long address)
-{
-}
-
 struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
 struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
 void kvm_arm_halt_guest(struct kvm *kvm);
index d735e5fc47727b0536c943b6fdb15223d7394360..195da38cb9a220f22c2f890c5bcb8fc1f2c7c621 100644 (file)
@@ -1,7 +1,7 @@
 menuconfig ARCH_AT91
        bool "Atmel SoCs"
        depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M
-       select ARM_CPU_SUSPEND if PM
+       select ARM_CPU_SUSPEND if PM && ARCH_MULTI_V7
        select COMMON_CLK_AT91
        select GPIOLIB
        select PINCTRL
index 667fddac38561eff3f25788ccbf9e05ac8214d84..5036f996e694a533d66f82743b901385ae048007 100644 (file)
@@ -608,6 +608,9 @@ static void __init at91_pm_init(void (*pm_idle)(void))
 
 void __init at91rm9200_pm_init(void)
 {
+       if (!IS_ENABLED(CONFIG_SOC_AT91RM9200))
+               return;
+
        at91_dt_ramc();
 
        /*
@@ -620,18 +623,27 @@ void __init at91rm9200_pm_init(void)
 
 void __init at91sam9_pm_init(void)
 {
+       if (!IS_ENABLED(CONFIG_SOC_AT91SAM9))
+               return;
+
        at91_dt_ramc();
        at91_pm_init(at91sam9_idle);
 }
 
 void __init sama5_pm_init(void)
 {
+       if (!IS_ENABLED(CONFIG_SOC_SAMA5))
+               return;
+
        at91_dt_ramc();
        at91_pm_init(NULL);
 }
 
 void __init sama5d2_pm_init(void)
 {
+       if (!IS_ENABLED(CONFIG_SOC_SAMA5D2))
+               return;
+
        at91_pm_backup_init();
        sama5_pm_init();
 }
index d68630007b14f542865df7e49bc0efacefe9a39d..e923b58606e2bf8e33a76bd4a8a9a4c1336199c6 100644 (file)
@@ -326,12 +326,6 @@ void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 
-/* We do not have shadow page tables, hence the empty hooks */
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-                                                        unsigned long address)
-{
-}
-
 struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
 struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void);
 void kvm_arm_halt_guest(struct kvm *kvm);
index 06da8ea16bbe5e150bb7330ab0049c7438b25f8d..c7b4995868e14d78216c4b06ce87476dfe8a4789 100644 (file)
@@ -161,9 +161,11 @@ void fpsimd_flush_thread(void)
 {
        if (!system_supports_fpsimd())
                return;
+       preempt_disable();
        memset(&current->thread.fpsimd_state, 0, sizeof(struct fpsimd_state));
        fpsimd_flush_task_state(current);
        set_thread_flag(TIF_FOREIGN_FPSTATE);
+       preempt_enable();
 }
 
 /*
index 973df7de7bf8d3e4fcde6dc2ba1590fa051964a2..adb0910b88f5f26c1562a7fef6f00f29ee9ec391 100644 (file)
@@ -354,7 +354,6 @@ __primary_switched:
        tst     x23, ~(MIN_KIMG_ALIGN - 1)      // already running randomized?
        b.ne    0f
        mov     x0, x21                         // pass FDT address in x0
-       mov     x1, x23                         // pass modulo offset in x1
        bl      kaslr_early_init                // parse FDT for KASLR options
        cbz     x0, 0f                          // KASLR disabled? just proceed
        orr     x23, x23, x0                    // record KASLR offset
index a9710efb8c017a735f9aa6518463d11b8d6264c9..47080c49cc7e77a3df120f061f7b10f90a8c2ec5 100644 (file)
@@ -75,7 +75,7 @@ extern void *__init __fixmap_remap_fdt(phys_addr_t dt_phys, int *size,
  * containing function pointers) to be reinitialized, and zero-initialized
  * .bss variables will be reset to 0.
  */
-u64 __init kaslr_early_init(u64 dt_phys, u64 modulo_offset)
+u64 __init kaslr_early_init(u64 dt_phys)
 {
        void *fdt;
        u64 seed, offset, mask, module_range;
@@ -131,15 +131,17 @@ u64 __init kaslr_early_init(u64 dt_phys, u64 modulo_offset)
        /*
         * The kernel Image should not extend across a 1GB/32MB/512MB alignment
         * boundary (for 4KB/16KB/64KB granule kernels, respectively). If this
-        * happens, increase the KASLR offset by the size of the kernel image
-        * rounded up by SWAPPER_BLOCK_SIZE.
+        * happens, round down the KASLR offset by (1 << SWAPPER_TABLE_SHIFT).
+        *
+        * NOTE: The references to _text and _end below will already take the
+        *       modulo offset (the physical displacement modulo 2 MB) into
+        *       account, given that the physical placement is controlled by
+        *       the loader, and will not change as a result of the virtual
+        *       mapping we choose.
         */
-       if ((((u64)_text + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT) !=
-           (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT)) {
-               u64 kimg_sz = _end - _text;
-               offset = (offset + round_up(kimg_sz, SWAPPER_BLOCK_SIZE))
-                               & mask;
-       }
+       if ((((u64)_text + offset) >> SWAPPER_TABLE_SHIFT) !=
+           (((u64)_end + offset) >> SWAPPER_TABLE_SHIFT))
+               offset = round_down(offset, 1 << SWAPPER_TABLE_SHIFT);
 
        if (IS_ENABLED(CONFIG_KASAN))
                /*
index 2509e4fe699225675f74876032e22b24b338a3b1..1f22a41565a38ac08083b29fcad216ca4ea1a2c9 100644 (file)
@@ -435,8 +435,11 @@ retry:
                 * the mmap_sem because it would already be released
                 * in __lock_page_or_retry in mm/filemap.c.
                 */
-               if (fatal_signal_pending(current))
+               if (fatal_signal_pending(current)) {
+                       if (!user_mode(regs))
+                               goto no_context;
                        return 0;
+               }
 
                /*
                 * Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk of
index 4663487c67a176472469348c957137ed12c68412..d764ea4cce7f51c739cc65408df3d469b87d66a1 100644 (file)
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6455=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -25,7 +24,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
index bba40e195ec43d1e70d9c2ccc6a4876f4a96abfd..05d0b4a25ab1fcba6500106cc68a7e546aaeeb78 100644 (file)
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6457=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -26,7 +25,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
index 8c46155f6d311befd6b2b6d90369149290c5fd4c..8d81fcf86b0e0e86ca9d8bca1a260e9217706b68 100644 (file)
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6472=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
index 15533f63231315d7282a0442d9ebd48ef35f0dd3..8156a98f3958be3af5d8a407f6dbae8d6f26bfd0 100644 (file)
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6474=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
index 5f126d4905b1973f502010959592b24a94d71aa5..c4f433c25b69d94618779049f9f38fa5ac872437 100644 (file)
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6678=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
index 43afc03e41251d45c2ccd0f0a00656ad5e368fe9..9519fa5f97d0c224b83d65abdacd7495a613de14 100644 (file)
@@ -208,14 +208,14 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
 
        pic = kzalloc(sizeof(struct megamod_pic), GFP_KERNEL);
        if (!pic) {
-               pr_err("%s: Could not alloc PIC structure.\n", np->full_name);
+               pr_err("%pOF: Could not alloc PIC structure.\n", np);
                return NULL;
        }
 
        pic->irqhost = irq_domain_add_linear(np, NR_COMBINERS * 32,
                                             &megamod_domain_ops, pic);
        if (!pic->irqhost) {
-               pr_err("%s: Could not alloc host.\n", np->full_name);
+               pr_err("%pOF: Could not alloc host.\n", np);
                goto error_free;
        }
 
@@ -225,7 +225,7 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
 
        pic->regs = of_iomap(np, 0);
        if (!pic->regs) {
-               pr_err("%s: Could not map registers.\n", np->full_name);
+               pr_err("%pOF: Could not map registers.\n", np);
                goto error_free;
        }
 
@@ -253,8 +253,8 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
 
                irq_data = irq_get_irq_data(irq);
                if (!irq_data) {
-                       pr_err("%s: combiner-%d no irq_data for virq %d!\n",
-                              np->full_name, i, irq);
+                       pr_err("%pOF: combiner-%d no irq_data for virq %d!\n",
+                              np, i, irq);
                        continue;
                }
 
@@ -265,16 +265,16 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
                 * of the core priority interrupts (4 - 15).
                 */
                if (hwirq < 4 || hwirq >= NR_PRIORITY_IRQS) {
-                       pr_err("%s: combiner-%d core irq %ld out of range!\n",
-                              np->full_name, i, hwirq);
+                       pr_err("%pOF: combiner-%d core irq %ld out of range!\n",
+                              np, i, hwirq);
                        continue;
                }
 
                /* record the mapping */
                mapping[hwirq - 4] = i;
 
-               pr_debug("%s: combiner-%d cascading to hwirq %ld\n",
-                        np->full_name, i, hwirq);
+               pr_debug("%pOF: combiner-%d cascading to hwirq %ld\n",
+                        np, i, hwirq);
 
                cascade_data[i].pic = pic;
                cascade_data[i].index = i;
@@ -290,8 +290,8 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
        /* Finally, set up the MUX registers */
        for (i = 0; i < NR_MUX_OUTPUTS; i++) {
                if (mapping[i] != IRQ_UNMAPPED) {
-                       pr_debug("%s: setting mux %d to priority %d\n",
-                                np->full_name, mapping[i], i + 4);
+                       pr_debug("%pOF: setting mux %d to priority %d\n",
+                                np, mapping[i], i + 4);
                        set_megamod_mux(pic, mapping[i], i);
                }
        }
index 755359eb628622ffd60d2bdd6ebb3a060159620b..e8b6cc6a7b5ac4e97f20877e05817e209fff7e91 100644 (file)
@@ -436,8 +436,8 @@ void __init c64x_setup_clocks(void)
 
        err = of_property_read_u32(node, "clock-frequency", &val);
        if (err || val == 0) {
-               pr_err("%s: no clock-frequency found! Using %dMHz\n",
-                      node->full_name, (int)val / 1000000);
+               pr_err("%pOF: no clock-frequency found! Using %dMHz\n",
+                      node, (int)val / 1000000);
                val = 25000000;
        }
        clkin1.rate = val;
index 0bd0452ded80d53698dd1673e15be770d89f8ae8..241a9a607193a00a726fcda8da4d2921d9bcbc83 100644 (file)
@@ -204,14 +204,14 @@ void __init timer64_init(void)
 
        timer = of_iomap(np, 0);
        if (!timer) {
-               pr_debug("%s: Cannot map timer registers.\n", np->full_name);
+               pr_debug("%pOF: Cannot map timer registers.\n", np);
                goto out;
        }
-       pr_debug("%s: Timer registers=%p.\n", np->full_name, timer);
+       pr_debug("%pOF: Timer registers=%p.\n", np, timer);
 
        cd->irq = irq_of_parse_and_map(np, 0);
        if (cd->irq == NO_IRQ) {
-               pr_debug("%s: Cannot find interrupt.\n", np->full_name);
+               pr_debug("%pOF: Cannot find interrupt.\n", np);
                iounmap(timer);
                goto out;
        }
@@ -229,7 +229,7 @@ void __init timer64_init(void)
                dscr_set_devstate(timer64_devstate_id, DSCR_DEVSTATE_ENABLED);
        }
 
-       pr_debug("%s: Timer irq=%d.\n", np->full_name, cd->irq);
+       pr_debug("%pOF: Timer irq=%d.\n", np, cd->irq);
 
        clockevents_calc_mult_shift(cd, c6x_core_freq / TIMER_DIVISOR, 5);
 
index 2998479fd4e83f0ac4c6ccd7d89938c7cc9a6f5f..a9af1d2dcd699114d00a55689c29137cef384841 100644 (file)
@@ -938,11 +938,6 @@ void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-                                                        unsigned long address)
-{
-}
-
 /* Emulation */
 int kvm_get_inst(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
 enum emulation_result update_pc(struct kvm_vcpu *vcpu, u32 cause);
index 8b3f1238d07f18eda49eb9326934427cf2d83736..e372ed871c513b00e78f69898601c598ee5a026b 100644 (file)
@@ -67,11 +67,6 @@ extern int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-                                                        unsigned long address)
-{
-}
-
 #define HPTEG_CACHE_NUM                        (1 << 15)
 #define HPTEG_HASH_BITS_PTE            13
 #define HPTEG_HASH_BITS_PTE_LONG       12
index 0c76675394c5930d5cecf2ac01a2718c8e9b6c1f..35bec1c5bd5aa63567be4847c2073be53fa0390c 100644 (file)
@@ -90,6 +90,24 @@ static inline void switch_mm_irqs_off(struct mm_struct *prev,
        /* Mark this context has been used on the new CPU */
        if (!cpumask_test_cpu(smp_processor_id(), mm_cpumask(next))) {
                cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));
+
+               /*
+                * This full barrier orders the store to the cpumask above vs
+                * a subsequent operation which allows this CPU to begin loading
+                * translations for next.
+                *
+                * When using the radix MMU that operation is the load of the
+                * MMU context id, which is then moved to SPRN_PID.
+                *
+                * For the hash MMU it is either the first load from slb_cache
+                * in switch_slb(), and/or the store of paca->mm_ctx_id in
+                * copy_mm_to_paca().
+                *
+                * On the read side the barrier is in pte_xchg(), which orders
+                * the store to the PTE vs the load of mm_cpumask.
+                */
+               smp_mb();
+
                new_on_cpu = true;
        }
 
index 9c0f5db5cf461a92e72185701b4cbc1df168dfcc..67e7e3d990f44ef495ee02b6fcb3ba16053bd5c5 100644 (file)
@@ -87,6 +87,7 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new)
        unsigned long *p = (unsigned long *)ptep;
        __be64 prev;
 
+       /* See comment in switch_mm_irqs_off() */
        prev = (__force __be64)__cmpxchg_u64(p, (__force unsigned long)pte_raw(old),
                                             (__force unsigned long)pte_raw(new));
 
index 8bd3b13fe2fb2e8bd1c5762c4e080c9cd921edaa..369a164b545c09087e0740fd6c32ea282a7b5245 100644 (file)
@@ -62,6 +62,7 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new)
 {
        unsigned long *p = (unsigned long *)ptep;
 
+       /* See comment in switch_mm_irqs_off() */
        return pte_val(old) == __cmpxchg_u64(p, pte_val(old), pte_val(new));
 }
 #endif
index a160c14304eba22bd83ee98b8f052a2ed8bf7a3f..53766e2bc029e25efc87270f6983e3b7975be31d 100644 (file)
@@ -294,32 +294,26 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
                                   struct kvm_create_spapr_tce_64 *args)
 {
        struct kvmppc_spapr_tce_table *stt = NULL;
+       struct kvmppc_spapr_tce_table *siter;
        unsigned long npages, size;
        int ret = -ENOMEM;
        int i;
+       int fd = -1;
 
        if (!args->size)
                return -EINVAL;
 
-       /* Check this LIOBN hasn't been previously allocated */
-       list_for_each_entry(stt, &kvm->arch.spapr_tce_tables, list) {
-               if (stt->liobn == args->liobn)
-                       return -EBUSY;
-       }
-
        size = _ALIGN_UP(args->size, PAGE_SIZE >> 3);
        npages = kvmppc_tce_pages(size);
        ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true);
-       if (ret) {
-               stt = NULL;
-               goto fail;
-       }
+       if (ret)
+               return ret;
 
        ret = -ENOMEM;
        stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *),
                      GFP_KERNEL);
        if (!stt)
-               goto fail;
+               goto fail_acct;
 
        stt->liobn = args->liobn;
        stt->page_shift = args->page_shift;
@@ -334,24 +328,42 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
                        goto fail;
        }
 
-       kvm_get_kvm(kvm);
+       ret = fd = anon_inode_getfd("kvm-spapr-tce", &kvm_spapr_tce_fops,
+                                   stt, O_RDWR | O_CLOEXEC);
+       if (ret < 0)
+               goto fail;
 
        mutex_lock(&kvm->lock);
-       list_add_rcu(&stt->list, &kvm->arch.spapr_tce_tables);
+
+       /* Check this LIOBN hasn't been previously allocated */
+       ret = 0;
+       list_for_each_entry(siter, &kvm->arch.spapr_tce_tables, list) {
+               if (siter->liobn == args->liobn) {
+                       ret = -EBUSY;
+                       break;
+               }
+       }
+
+       if (!ret) {
+               list_add_rcu(&stt->list, &kvm->arch.spapr_tce_tables);
+               kvm_get_kvm(kvm);
+       }
 
        mutex_unlock(&kvm->lock);
 
-       return anon_inode_getfd("kvm-spapr-tce", &kvm_spapr_tce_fops,
-                               stt, O_RDWR | O_CLOEXEC);
+       if (!ret)
+               return fd;
 
-fail:
-       if (stt) {
-               for (i = 0; i < npages; i++)
-                       if (stt->pages[i])
-                               __free_page(stt->pages[i]);
+       put_unused_fd(fd);
 
-               kfree(stt);
-       }
+ fail:
+       for (i = 0; i < npages; i++)
+               if (stt->pages[i])
+                       __free_page(stt->pages[i]);
+
+       kfree(stt);
+ fail_acct:
+       kvmppc_account_memlimit(kvmppc_stt_pages(npages), false);
        return ret;
 }
 
index c52184a8efdf025c1efffc6dd7310e9374dca630..9c9c983b864f8d64a81eac456adc405cc0252e5d 100644 (file)
@@ -1291,6 +1291,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
        /* Hypervisor doorbell - exit only if host IPI flag set */
        cmpwi   r12, BOOK3S_INTERRUPT_H_DOORBELL
        bne     3f
+BEGIN_FTR_SECTION
+       PPC_MSGSYNC
+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
        lbz     r0, HSTATE_HOST_IPI(r13)
        cmpwi   r0, 0
        beq     4f
index 4636ca6e7d383b7d3ce26b18df01152b8087a8ec..d1ed2c41b5d246dde6d53c34530bc30dc63656b9 100644 (file)
@@ -16,7 +16,22 @@ static void GLUE(X_PFX,ack_pending)(struct kvmppc_xive_vcpu *xc)
        u8 cppr;
        u16 ack;
 
-       /* XXX DD1 bug workaround: Check PIPR vs. CPPR first ! */
+       /*
+        * Ensure any previous store to CPPR is ordered vs.
+        * the subsequent loads from PIPR or ACK.
+        */
+       eieio();
+
+       /*
+        * DD1 bug workaround: If PIPR is less favored than CPPR
+        * ignore the interrupt or we might incorrectly lose an IPB
+        * bit.
+        */
+       if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
+               u8 pipr = __x_readb(__x_tima + TM_QW1_OS + TM_PIPR);
+               if (pipr >= xc->hw_cppr)
+                       return;
+       }
 
        /* Perform the acknowledge OS to register cycle. */
        ack = be16_to_cpu(__x_readw(__x_tima + TM_SPC_ACK_OS_REG));
@@ -235,6 +250,11 @@ skip_ipi:
        /*
         * If we found an interrupt, adjust what the guest CPPR should
         * be as if we had just fetched that interrupt from HW.
+        *
+        * Note: This can only make xc->cppr smaller as the previous
+        * loop will only exit with hirq != 0 if prio is lower than
+        * the current xc->cppr. Thus we don't need to re-check xc->mfrr
+        * for pending IPIs.
         */
        if (hirq)
                xc->cppr = prio;
@@ -380,6 +400,12 @@ X_STATIC int GLUE(X_PFX,h_cppr)(struct kvm_vcpu *vcpu, unsigned long cppr)
        old_cppr = xc->cppr;
        xc->cppr = cppr;
 
+       /*
+        * Order the above update of xc->cppr with the subsequent
+        * read of xc->mfrr inside push_pending_to_hw()
+        */
+       smp_mb();
+
        /*
         * We are masking less, we need to look for pending things
         * to deliver and set VP pending bits accordingly to trigger
@@ -420,21 +446,37 @@ X_STATIC int GLUE(X_PFX,h_eoi)(struct kvm_vcpu *vcpu, unsigned long xirr)
         * used to signal MFRR changes is EOId when fetched from
         * the queue.
         */
-       if (irq == XICS_IPI || irq == 0)
+       if (irq == XICS_IPI || irq == 0) {
+               /*
+                * This barrier orders the setting of xc->cppr vs.
+                * subsquent test of xc->mfrr done inside
+                * scan_interrupts and push_pending_to_hw
+                */
+               smp_mb();
                goto bail;
+       }
 
        /* Find interrupt source */
        sb = kvmppc_xive_find_source(xive, irq, &src);
        if (!sb) {
                pr_devel(" source not found !\n");
                rc = H_PARAMETER;
+               /* Same as above */
+               smp_mb();
                goto bail;
        }
        state = &sb->irq_state[src];
        kvmppc_xive_select_irq(state, &hw_num, &xd);
 
        state->in_eoi = true;
-       mb();
+
+       /*
+        * This barrier orders both setting of in_eoi above vs,
+        * subsequent test of guest_priority, and the setting
+        * of xc->cppr vs. subsquent test of xc->mfrr done inside
+        * scan_interrupts and push_pending_to_hw
+        */
+       smp_mb();
 
 again:
        if (state->guest_priority == MASKED) {
@@ -461,6 +503,14 @@ again:
 
        }
 
+       /*
+        * This barrier orders the above guest_priority check
+        * and spin_lock/unlock with clearing in_eoi below.
+        *
+        * It also has to be a full mb() as it must ensure
+        * the MMIOs done in source_eoi() are completed before
+        * state->in_eoi is visible.
+        */
        mb();
        state->in_eoi = false;
 bail:
@@ -495,6 +545,18 @@ X_STATIC int GLUE(X_PFX,h_ipi)(struct kvm_vcpu *vcpu, unsigned long server,
        /* Locklessly write over MFRR */
        xc->mfrr = mfrr;
 
+       /*
+        * The load of xc->cppr below and the subsequent MMIO store
+        * to the IPI must happen after the above mfrr update is
+        * globally visible so that:
+        *
+        * - Synchronize with another CPU doing an H_EOI or a H_CPPR
+        *   updating xc->cppr then reading xc->mfrr.
+        *
+        * - The target of the IPI sees the xc->mfrr update
+        */
+       mb();
+
        /* Shoot the IPI if most favored than target cppr */
        if (mfrr < xc->cppr)
                __x_writeq(0, __x_trig_page(&xc->vp_ipi_data));
index b5d960d6db3d0b18d33273b31ac67e03caebd02b..4c7b8591f7379931a1d319c8edd5995610ca6d8c 100644 (file)
@@ -614,15 +614,6 @@ static void pnv_npu2_mn_change_pte(struct mmu_notifier *mn,
        mmio_invalidate(npu_context, 1, address, true);
 }
 
-static void pnv_npu2_mn_invalidate_page(struct mmu_notifier *mn,
-                                       struct mm_struct *mm,
-                                       unsigned long address)
-{
-       struct npu_context *npu_context = mn_to_npu_context(mn);
-
-       mmio_invalidate(npu_context, 1, address, true);
-}
-
 static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn,
                                        struct mm_struct *mm,
                                        unsigned long start, unsigned long end)
@@ -640,7 +631,6 @@ static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn,
 static const struct mmu_notifier_ops nv_nmmu_notifier_ops = {
        .release = pnv_npu2_mn_release,
        .change_pte = pnv_npu2_mn_change_pte,
-       .invalidate_page = pnv_npu2_mn_invalidate_page,
        .invalidate_range = pnv_npu2_mn_invalidate_range,
 };
 
index 4541ac44b35f0e39b831b3eba2e5669d29dd9f89..24bc41622a983cf353c6d414d521cbd94cd43cbb 100644 (file)
@@ -44,6 +44,11 @@ static inline int init_new_context(struct task_struct *tsk,
                mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
                                   _ASCE_USER_BITS | _ASCE_TYPE_REGION3;
                break;
+       case -PAGE_SIZE:
+               /* forked 5-level task, set new asce with new_mm->pgd */
+               mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
+                       _ASCE_USER_BITS | _ASCE_TYPE_REGION1;
+               break;
        case 1UL << 53:
                /* forked 4-level task, set new asce with new mm->pgd */
                mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
index 926b5244263efd3dd1fadf637ce4790251367e60..a2e5c24f47a7471a1e7730f654b8ce4599434ef0 100644 (file)
@@ -394,7 +394,7 @@ static int sthyi(u64 vaddr)
                "srl     %[cc],28\n"
                : [cc] "=d" (cc)
                : [code] "d" (code), [addr] "a" (addr)
-               : "memory", "cc");
+               : "3", "memory", "cc");
        return cc;
 }
 
@@ -425,7 +425,7 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
        VCPU_EVENT(vcpu, 3, "STHYI: fc: %llu addr: 0x%016llx", code, addr);
        trace_kvm_s390_handle_sthyi(vcpu, code, addr);
 
-       if (reg1 == reg2 || reg1 & 1 || reg2 & 1 || addr & ~PAGE_MASK)
+       if (reg1 == reg2 || reg1 & 1 || reg2 & 1)
                return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
        if (code & 0xffff) {
@@ -433,6 +433,9 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
                goto out;
        }
 
+       if (addr & ~PAGE_MASK)
+               return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
+
        /*
         * If the page has not yet been faulted in, we want to do that
         * now and not after all the expensive calculations.
index 2e10d2b8ad359607981ce381e27c3bf22e2e184d..5bea139517a2edc21dc50074d2c2e9a94dabb19e 100644 (file)
@@ -119,7 +119,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
                return addr;
 
 check_asce_limit:
-       if (addr + len > current->mm->context.asce_limit) {
+       if (addr + len > current->mm->context.asce_limit &&
+           addr + len <= TASK_SIZE) {
                rc = crst_table_upgrade(mm, addr + len);
                if (rc)
                        return (unsigned long) rc;
@@ -183,7 +184,8 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
        }
 
 check_asce_limit:
-       if (addr + len > current->mm->context.asce_limit) {
+       if (addr + len > current->mm->context.asce_limit &&
+           addr + len <= TASK_SIZE) {
                rc = crst_table_upgrade(mm, addr + len);
                if (rc)
                        return (unsigned long) rc;
index 255645f60ca2b4be333de67a10c6780f364e6fb2..554cdb205d17586887e6b599c991b2fc090ba38a 100644 (file)
@@ -450,10 +450,10 @@ static inline int copy_fpregs_to_fpstate(struct fpu *fpu)
        return 0;
 }
 
-static inline void __copy_kernel_to_fpregs(union fpregs_state *fpstate)
+static inline void __copy_kernel_to_fpregs(union fpregs_state *fpstate, u64 mask)
 {
        if (use_xsave()) {
-               copy_kernel_to_xregs(&fpstate->xsave, -1);
+               copy_kernel_to_xregs(&fpstate->xsave, mask);
        } else {
                if (use_fxsr())
                        copy_kernel_to_fxregs(&fpstate->fxsave);
@@ -477,7 +477,7 @@ static inline void copy_kernel_to_fpregs(union fpregs_state *fpstate)
                        : : [addr] "m" (fpstate));
        }
 
-       __copy_kernel_to_fpregs(fpstate);
+       __copy_kernel_to_fpregs(fpstate, -1);
 }
 
 extern int copy_fpstate_to_sigframe(void __user *buf, void __user *fp, int size);
index 87ac4fba6d8e12f07e8a9f191bdb028a1c3e6234..92c9032502d87b3291268f2c98b04ec4cb59854d 100644 (file)
@@ -492,6 +492,7 @@ struct kvm_vcpu_arch {
        unsigned long cr4;
        unsigned long cr4_guest_owned_bits;
        unsigned long cr8;
+       u32 pkru;
        u32 hflags;
        u64 efer;
        u64 apic_base;
@@ -1374,8 +1375,6 @@ int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
 int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
 void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event);
 void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu);
-void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-                                          unsigned long address);
 
 void kvm_define_shared_msr(unsigned index, u32 msr);
 int kvm_set_shared_msr(unsigned index, u64 val, u64 mask);
index 265c907d7d4c9b8c69e24792a20c5a3dfb6c95ee..7a234be7e29846618cbdafb0153705cb8a8566b3 100644 (file)
@@ -140,9 +140,7 @@ static inline int init_new_context(struct task_struct *tsk,
                mm->context.execute_only_pkey = -1;
        }
        #endif
-       init_new_context_ldt(tsk, mm);
-
-       return 0;
+       return init_new_context_ldt(tsk, mm);
 }
 static inline void destroy_context(struct mm_struct *mm)
 {
index 59ca2eea522c466937287c3e660b8f38e49c12aa..19adbb4184439dd6c40c39cd6dec2afe5a9ae83a 100644 (file)
@@ -469,7 +469,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
                        entry->ecx &= kvm_cpuid_7_0_ecx_x86_features;
                        cpuid_mask(&entry->ecx, CPUID_7_ECX);
                        /* PKU is not yet implemented for shadow paging. */
-                       if (!tdp_enabled)
+                       if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE))
                                entry->ecx &= ~F(PKU);
                        entry->edx &= kvm_cpuid_7_0_edx_x86_features;
                        entry->edx &= get_scattered_cpuid_leaf(7, 0, CPUID_EDX);
index 762cdf2595f992fd4ac8bb1e4c2c8914b344db04..e1e89ee4af750dc51f78cfbf8aa71e22d77b4cd1 100644 (file)
@@ -84,11 +84,6 @@ static inline u64 kvm_read_edx_eax(struct kvm_vcpu *vcpu)
                | ((u64)(kvm_register_read(vcpu, VCPU_REGS_RDX) & -1u) << 32);
 }
 
-static inline u32 kvm_read_pkru(struct kvm_vcpu *vcpu)
-{
-       return kvm_x86_ops->get_pkru(vcpu);
-}
-
 static inline void enter_guest_mode(struct kvm_vcpu *vcpu)
 {
        vcpu->arch.hflags |= HF_GUEST_MASK;
index d7d248a000dd6772681f3f5541e344f9677a2d1d..4b9a3ae6b725d37bdeeb5aeb24c0a9c2716228f4 100644 (file)
@@ -185,7 +185,7 @@ static inline u8 permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
                * index of the protection domain, so pte_pkey * 2 is
                * is the index of the first bit for the domain.
                */
-               pkru_bits = (kvm_read_pkru(vcpu) >> (pte_pkey * 2)) & 3;
+               pkru_bits = (vcpu->arch.pkru >> (pte_pkey * 2)) & 3;
 
                /* clear present bit, replace PFEC.RSVD with ACC_USER_MASK. */
                offset = (pfec & ~1) +
index 56ba05312759d3ed4568e546492d9d8bfad05b71..af256b786a70cccd14906fe926e2b790156967a4 100644 (file)
@@ -1777,11 +1777,6 @@ static void svm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
        to_svm(vcpu)->vmcb->save.rflags = rflags;
 }
 
-static u32 svm_get_pkru(struct kvm_vcpu *vcpu)
-{
-       return 0;
-}
-
 static void svm_cache_reg(struct kvm_vcpu *vcpu, enum kvm_reg reg)
 {
        switch (reg) {
@@ -5413,8 +5408,6 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
        .get_rflags = svm_get_rflags,
        .set_rflags = svm_set_rflags,
 
-       .get_pkru = svm_get_pkru,
-
        .tlb_flush = svm_flush_tlb,
 
        .run = svm_vcpu_run,
index 9b21b12230354e334900e6536b7612285f75b7e3..c6ef2940119bfdfb00f0547c321697280ebae0fa 100644 (file)
@@ -636,8 +636,6 @@ struct vcpu_vmx {
 
        u64 current_tsc_ratio;
 
-       bool guest_pkru_valid;
-       u32 guest_pkru;
        u32 host_pkru;
 
        /*
@@ -2383,11 +2381,6 @@ static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
                to_vmx(vcpu)->emulation_required = emulation_required(vcpu);
 }
 
-static u32 vmx_get_pkru(struct kvm_vcpu *vcpu)
-{
-       return to_vmx(vcpu)->guest_pkru;
-}
-
 static u32 vmx_get_interrupt_shadow(struct kvm_vcpu *vcpu)
 {
        u32 interruptibility = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
@@ -9020,8 +9013,10 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
        if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
                vmx_set_interrupt_shadow(vcpu, 0);
 
-       if (vmx->guest_pkru_valid)
-               __write_pkru(vmx->guest_pkru);
+       if (static_cpu_has(X86_FEATURE_PKU) &&
+           kvm_read_cr4_bits(vcpu, X86_CR4_PKE) &&
+           vcpu->arch.pkru != vmx->host_pkru)
+               __write_pkru(vcpu->arch.pkru);
 
        atomic_switch_perf_msrs(vmx);
        debugctlmsr = get_debugctlmsr();
@@ -9169,13 +9164,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
         * back on host, so it is safe to read guest PKRU from current
         * XSAVE.
         */
-       if (boot_cpu_has(X86_FEATURE_OSPKE)) {
-               vmx->guest_pkru = __read_pkru();
-               if (vmx->guest_pkru != vmx->host_pkru) {
-                       vmx->guest_pkru_valid = true;
+       if (static_cpu_has(X86_FEATURE_PKU) &&
+           kvm_read_cr4_bits(vcpu, X86_CR4_PKE)) {
+               vcpu->arch.pkru = __read_pkru();
+               if (vcpu->arch.pkru != vmx->host_pkru)
                        __write_pkru(vmx->host_pkru);
-               } else
-                       vmx->guest_pkru_valid = false;
        }
 
        /*
@@ -11682,8 +11675,6 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
        .get_rflags = vmx_get_rflags,
        .set_rflags = vmx_set_rflags,
 
-       .get_pkru = vmx_get_pkru,
-
        .tlb_flush = vmx_flush_tlb,
 
        .run = vmx_vcpu_run,
index d734aa8c5b4f7290e365badd00ea962fd0af9acd..272320eb328c9bc8c2d0cf839a097a30ca27491f 100644 (file)
@@ -3245,7 +3245,12 @@ static void fill_xsave(u8 *dest, struct kvm_vcpu *vcpu)
                        u32 size, offset, ecx, edx;
                        cpuid_count(XSTATE_CPUID, index,
                                    &size, &offset, &ecx, &edx);
-                       memcpy(dest + offset, src, size);
+                       if (feature == XFEATURE_MASK_PKRU)
+                               memcpy(dest + offset, &vcpu->arch.pkru,
+                                      sizeof(vcpu->arch.pkru));
+                       else
+                               memcpy(dest + offset, src, size);
+
                }
 
                valid -= feature;
@@ -3283,7 +3288,11 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src)
                        u32 size, offset, ecx, edx;
                        cpuid_count(XSTATE_CPUID, index,
                                    &size, &offset, &ecx, &edx);
-                       memcpy(dest, src + offset, size);
+                       if (feature == XFEATURE_MASK_PKRU)
+                               memcpy(&vcpu->arch.pkru, src + offset,
+                                      sizeof(vcpu->arch.pkru));
+                       else
+                               memcpy(dest, src + offset, size);
                }
 
                valid -= feature;
@@ -6725,17 +6734,6 @@ void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu)
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_reload_apic_access_page);
 
-void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-                                          unsigned long address)
-{
-       /*
-        * The physical address of apic access page is stored in the VMCS.
-        * Update it when it becomes invalid.
-        */
-       if (address == gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT))
-               kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
-}
-
 /*
  * Returns 1 to let vcpu_run() continue the guest execution loop without
  * exiting to the userspace.  Otherwise, the value will be returned to the
@@ -7633,7 +7631,9 @@ void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
         */
        vcpu->guest_fpu_loaded = 1;
        __kernel_fpu_begin();
-       __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu.state);
+       /* PKRU is separately restored in kvm_x86_ops->run.  */
+       __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu.state,
+                               ~XFEATURE_MASK_PKRU);
        trace_kvm_fpu(1);
 }
 
index ae4cd58c0c7a403c8ba40f978e5d4221ce94bfc6..02250b2633b839c7fa56704d804dd4953f244121 100644 (file)
@@ -50,7 +50,7 @@ void foo(void)
        DEFINE(HOST_GS, GS);
        DEFINE(HOST_ORIG_AX, ORIG_EAX);
 #else
-#if defined(PTRACE_GETREGSET) && defined(PTRACE_SETREGSET)
+#ifdef FP_XSTATE_MAGIC1
        DEFINE(HOST_FP_SIZE, sizeof(struct _xstate) / sizeof(unsigned long));
 #else
        DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
index 9ebc2945f991e9ff5d50c5191de45ca1025f1201..4f927a58dff86183a95baf9c7f4eb474c218f0f2 100644 (file)
@@ -75,6 +75,8 @@ static const char *const blk_queue_flag_name[] = {
        QUEUE_FLAG_NAME(STATS),
        QUEUE_FLAG_NAME(POLL_STATS),
        QUEUE_FLAG_NAME(REGISTERED),
+       QUEUE_FLAG_NAME(SCSI_PASSTHROUGH),
+       QUEUE_FLAG_NAME(QUIESCED),
 };
 #undef QUEUE_FLAG_NAME
 
@@ -265,6 +267,7 @@ static const char *const cmd_flag_name[] = {
        CMD_FLAG_NAME(RAHEAD),
        CMD_FLAG_NAME(BACKGROUND),
        CMD_FLAG_NAME(NOUNMAP),
+       CMD_FLAG_NAME(NOWAIT),
 };
 #undef CMD_FLAG_NAME
 
index a7285bf2831c7bdbb89b753fccb198f8640e8780..80f5481fe9f6c1603e477349732dac62c3baf204 100644 (file)
@@ -382,6 +382,14 @@ static unsigned int tg_iops_limit(struct throtl_grp *tg, int rw)
        }                                                               \
 } while (0)
 
+static inline unsigned int throtl_bio_data_size(struct bio *bio)
+{
+       /* assume it's one sector */
+       if (unlikely(bio_op(bio) == REQ_OP_DISCARD))
+               return 512;
+       return bio->bi_iter.bi_size;
+}
+
 static void throtl_qnode_init(struct throtl_qnode *qn, struct throtl_grp *tg)
 {
        INIT_LIST_HEAD(&qn->node);
@@ -934,6 +942,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio,
        bool rw = bio_data_dir(bio);
        u64 bytes_allowed, extra_bytes, tmp;
        unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;
+       unsigned int bio_size = throtl_bio_data_size(bio);
 
        jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw];
 
@@ -947,14 +956,14 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio,
        do_div(tmp, HZ);
        bytes_allowed = tmp;
 
-       if (tg->bytes_disp[rw] + bio->bi_iter.bi_size <= bytes_allowed) {
+       if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) {
                if (wait)
                        *wait = 0;
                return true;
        }
 
        /* Calc approx time to dispatch */
-       extra_bytes = tg->bytes_disp[rw] + bio->bi_iter.bi_size - bytes_allowed;
+       extra_bytes = tg->bytes_disp[rw] + bio_size - bytes_allowed;
        jiffy_wait = div64_u64(extra_bytes * HZ, tg_bps_limit(tg, rw));
 
        if (!jiffy_wait)
@@ -1034,11 +1043,12 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio,
 static void throtl_charge_bio(struct throtl_grp *tg, struct bio *bio)
 {
        bool rw = bio_data_dir(bio);
+       unsigned int bio_size = throtl_bio_data_size(bio);
 
        /* Charge the bio to the group */
-       tg->bytes_disp[rw] += bio->bi_iter.bi_size;
+       tg->bytes_disp[rw] += bio_size;
        tg->io_disp[rw]++;
-       tg->last_bytes_disp[rw] += bio->bi_iter.bi_size;
+       tg->last_bytes_disp[rw] += bio_size;
        tg->last_io_disp[rw]++;
 
        /*
index c4513b23f57a6438af6ae38367c072931edf138c..dd56d7460cb91d504aa22ae9215d00f97c844359 100644 (file)
 #include <scsi/scsi_cmnd.h>
 
 /**
- * bsg_destroy_job - routine to teardown/delete a bsg job
+ * bsg_teardown_job - routine to teardown a bsg job
  * @job: bsg_job that is to be torn down
  */
-static void bsg_destroy_job(struct kref *kref)
+static void bsg_teardown_job(struct kref *kref)
 {
        struct bsg_job *job = container_of(kref, struct bsg_job, kref);
        struct request *rq = job->req;
 
-       blk_end_request_all(rq, BLK_STS_OK);
-
        put_device(job->dev);   /* release reference for the request */
 
        kfree(job->request_payload.sg_list);
        kfree(job->reply_payload.sg_list);
-       kfree(job);
+
+       blk_end_request_all(rq, BLK_STS_OK);
 }
 
 void bsg_job_put(struct bsg_job *job)
 {
-       kref_put(&job->kref, bsg_destroy_job);
+       kref_put(&job->kref, bsg_teardown_job);
 }
 EXPORT_SYMBOL_GPL(bsg_job_put);
 
@@ -100,7 +99,7 @@ EXPORT_SYMBOL_GPL(bsg_job_done);
  */
 static void bsg_softirq_done(struct request *rq)
 {
-       struct bsg_job *job = rq->special;
+       struct bsg_job *job = blk_mq_rq_to_pdu(rq);
 
        bsg_job_put(job);
 }
@@ -122,33 +121,20 @@ static int bsg_map_buffer(struct bsg_buffer *buf, struct request *req)
 }
 
 /**
- * bsg_create_job - create the bsg_job structure for the bsg request
+ * bsg_prepare_job - create the bsg_job structure for the bsg request
  * @dev: device that is being sent the bsg request
  * @req: BSG request that needs a job structure
  */
-static int bsg_create_job(struct device *dev, struct request *req)
+static int bsg_prepare_job(struct device *dev, struct request *req)
 {
        struct request *rsp = req->next_rq;
-       struct request_queue *q = req->q;
        struct scsi_request *rq = scsi_req(req);
-       struct bsg_job *job;
+       struct bsg_job *job = blk_mq_rq_to_pdu(req);
        int ret;
 
-       BUG_ON(req->special);
-
-       job = kzalloc(sizeof(struct bsg_job) + q->bsg_job_size, GFP_KERNEL);
-       if (!job)
-               return -ENOMEM;
-
-       req->special = job;
-       job->req = req;
-       if (q->bsg_job_size)
-               job->dd_data = (void *)&job[1];
        job->request = rq->cmd;
        job->request_len = rq->cmd_len;
-       job->reply = rq->sense;
-       job->reply_len = SCSI_SENSE_BUFFERSIZE; /* Size of sense buffer
-                                                * allocated */
+
        if (req->bio) {
                ret = bsg_map_buffer(&job->request_payload, req);
                if (ret)
@@ -187,7 +173,6 @@ static void bsg_request_fn(struct request_queue *q)
 {
        struct device *dev = q->queuedata;
        struct request *req;
-       struct bsg_job *job;
        int ret;
 
        if (!get_device(dev))
@@ -199,7 +184,7 @@ static void bsg_request_fn(struct request_queue *q)
                        break;
                spin_unlock_irq(q->queue_lock);
 
-               ret = bsg_create_job(dev, req);
+               ret = bsg_prepare_job(dev, req);
                if (ret) {
                        scsi_req(req)->result = ret;
                        blk_end_request_all(req, BLK_STS_OK);
@@ -207,8 +192,7 @@ static void bsg_request_fn(struct request_queue *q)
                        continue;
                }
 
-               job = req->special;
-               ret = q->bsg_job_fn(job);
+               ret = q->bsg_job_fn(blk_mq_rq_to_pdu(req));
                spin_lock_irq(q->queue_lock);
                if (ret)
                        break;
@@ -219,6 +203,35 @@ static void bsg_request_fn(struct request_queue *q)
        spin_lock_irq(q->queue_lock);
 }
 
+static int bsg_init_rq(struct request_queue *q, struct request *req, gfp_t gfp)
+{
+       struct bsg_job *job = blk_mq_rq_to_pdu(req);
+       struct scsi_request *sreq = &job->sreq;
+
+       memset(job, 0, sizeof(*job));
+
+       scsi_req_init(sreq);
+       sreq->sense_len = SCSI_SENSE_BUFFERSIZE;
+       sreq->sense = kzalloc(sreq->sense_len, gfp);
+       if (!sreq->sense)
+               return -ENOMEM;
+
+       job->req = req;
+       job->reply = sreq->sense;
+       job->reply_len = sreq->sense_len;
+       job->dd_data = job + 1;
+
+       return 0;
+}
+
+static void bsg_exit_rq(struct request_queue *q, struct request *req)
+{
+       struct bsg_job *job = blk_mq_rq_to_pdu(req);
+       struct scsi_request *sreq = &job->sreq;
+
+       kfree(sreq->sense);
+}
+
 /**
  * bsg_setup_queue - Create and add the bsg hooks so we can receive requests
  * @dev: device to attach bsg device to
@@ -235,7 +248,9 @@ struct request_queue *bsg_setup_queue(struct device *dev, char *name,
        q = blk_alloc_queue(GFP_KERNEL);
        if (!q)
                return ERR_PTR(-ENOMEM);
-       q->cmd_size = sizeof(struct scsi_request);
+       q->cmd_size = sizeof(struct bsg_job) + dd_job_size;
+       q->init_rq_fn = bsg_init_rq;
+       q->exit_rq_fn = bsg_exit_rq;
        q->request_fn = bsg_request_fn;
 
        ret = blk_init_allocated_queue(q);
@@ -243,7 +258,6 @@ struct request_queue *bsg_setup_queue(struct device *dev, char *name,
                goto out_cleanup_queue;
 
        q->queuedata = dev;
-       q->bsg_job_size = dd_job_size;
        q->bsg_job_fn = job_fn;
        queue_flag_set_unlocked(QUEUE_FLAG_BIDI, q);
        queue_flag_set_unlocked(QUEUE_FLAG_SCSI_PASSTHROUGH, q);
index 43839b00fe6c42fff5f8afbc04ffdff4e61a147d..903605dbc1a50282e8e3d7ced0bba148ec7ebe9c 100644 (file)
@@ -87,8 +87,13 @@ static void skcipher_free_async_sgls(struct skcipher_async_req *sreq)
        }
        sgl = sreq->tsg;
        n = sg_nents(sgl);
-       for_each_sg(sgl, sg, n, i)
-               put_page(sg_page(sg));
+       for_each_sg(sgl, sg, n, i) {
+               struct page *page = sg_page(sg);
+
+               /* some SGs may not have a page mapped */
+               if (page && page_ref_count(page))
+                       put_page(page);
+       }
 
        kfree(sreq->tsg);
 }
index 8b3c04d625c3bb0ee667a8a61a0c1e4499b0b486..4a45fa4890c0e45eb74124d39b9fee35823ac4dd 100644 (file)
@@ -91,9 +91,14 @@ int crypto_chacha20_crypt(struct skcipher_request *req)
        crypto_chacha20_init(state, ctx, walk.iv);
 
        while (walk.nbytes > 0) {
+               unsigned int nbytes = walk.nbytes;
+
+               if (nbytes < walk.total)
+                       nbytes = round_down(nbytes, walk.stride);
+
                chacha20_docrypt(state, walk.dst.virt.addr, walk.src.virt.addr,
-                                walk.nbytes);
-               err = skcipher_walk_done(&walk, 0);
+                                nbytes);
+               err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
        }
 
        return err;
index 6ceb0e2758bbccd4f0542a5f9628e9f3e987ce7c..d54971d2d1c8694805bb8618b8673c8490f9e8bb 100644 (file)
@@ -32675,6 +32675,10 @@ static const struct cipher_testvec chacha20_enc_tv_template[] = {
                          "\x5b\x86\x2f\x37\x30\xe3\x7c\xfd"
                          "\xc4\xfd\x80\x6c\x22\xf2\x21",
                .rlen   = 375,
+               .also_non_np = 1,
+               .np     = 3,
+               .tap    = { 375 - 20, 4, 16 },
+
        }, { /* RFC7539 A.2. Test Vector #3 */
                .key    = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a"
                          "\xf3\x33\x88\x86\x04\xf6\xb5\xf0"
@@ -33049,6 +33053,9 @@ static const struct cipher_testvec chacha20_enc_tv_template[] = {
                          "\xa1\xed\xad\xd5\x76\xfa\x24\x8f"
                          "\x98",
                .rlen   = 1281,
+               .also_non_np = 1,
+               .np     = 3,
+               .tap    = { 1200, 1, 80 },
        },
 };
 
index 538c61677c100e9361bc556154719b7b2368740e..783f4c838aee4c1daabdea8ac8d6f21e75060492 100644 (file)
@@ -100,9 +100,13 @@ acpi_evaluate_object_typed(acpi_handle handle,
                free_buffer_on_error = TRUE;
        }
 
-       status = acpi_get_handle(handle, pathname, &target_handle);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
+       if (pathname) {
+               status = acpi_get_handle(handle, pathname, &target_handle);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
+       } else {
+               target_handle = handle;
        }
 
        full_pathname = acpi_ns_get_external_pathname(target_handle);
index 62068a5e814f026a44e212bd2b93941590a3fe53..ae3d6d15263307c2c159fd459d09bc93ef66fa03 100644 (file)
@@ -1741,7 +1741,7 @@ error:
  * functioning ECDT EC first in order to handle the events.
  * https://bugzilla.kernel.org/show_bug.cgi?id=115021
  */
-int __init acpi_ec_ecdt_start(void)
+static int __init acpi_ec_ecdt_start(void)
 {
        acpi_handle handle;
 
@@ -2003,20 +2003,17 @@ static inline void acpi_ec_query_exit(void)
 int __init acpi_ec_init(void)
 {
        int result;
+       int ecdt_fail, dsdt_fail;
 
        /* register workqueue for _Qxx evaluations */
        result = acpi_ec_query_init();
        if (result)
-               goto err_exit;
-       /* Now register the driver for the EC */
-       result = acpi_bus_register_driver(&acpi_ec_driver);
-       if (result)
-               goto err_exit;
+               return result;
 
-err_exit:
-       if (result)
-               acpi_ec_query_exit();
-       return result;
+       /* Drivers must be started after acpi_ec_query_init() */
+       ecdt_fail = acpi_ec_ecdt_start();
+       dsdt_fail = acpi_bus_register_driver(&acpi_ec_driver);
+       return ecdt_fail && dsdt_fail ? -ENODEV : 0;
 }
 
 /* EC driver currently not unloadable */
index 58dd7ab3c6538bd490b45e2e420c3d822ecf8c3e..3f5af4d7a73989f86cdcc80c1e8e7b949a975702 100644 (file)
@@ -185,7 +185,6 @@ typedef int (*acpi_ec_query_func) (void *data);
 int acpi_ec_init(void);
 int acpi_ec_ecdt_probe(void);
 int acpi_ec_dsdt_probe(void);
-int acpi_ec_ecdt_start(void);
 void acpi_ec_block_transactions(void);
 void acpi_ec_unblock_transactions(void);
 int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
index 917c789f953dfb280f6f00895ce1fcf7ae2484ec..476a52c60cf3de98b18abe2c35a681c2be3ae058 100644 (file)
@@ -1047,7 +1047,7 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value(
        fwnode_for_each_child_node(fwnode, child) {
                u32 nr;
 
-               if (!fwnode_property_read_u32(fwnode, prop_name, &nr))
+               if (fwnode_property_read_u32(child, prop_name, &nr))
                        continue;
 
                if (val == nr)
index 33897298f03e3ed680272ba6f4109077d434a0d8..70fd5502c2843a7cb0338245767a3c7dc2aeb308 100644 (file)
@@ -2084,7 +2084,6 @@ int __init acpi_scan_init(void)
 
        acpi_gpe_apply_masked_gpes();
        acpi_update_all_gpes();
-       acpi_ec_ecdt_start();
 
        acpi_scan_initialized = true;
 
index f7665c31fecaf3f46b64e17a821f9b8528def937..831cdd7d197dbed87d8a55c530af8df50da15419 100644 (file)
@@ -3362,7 +3362,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
        const char *failure_string;
        struct binder_buffer *buffer;
 
-       if (proc->tsk != current)
+       if (proc->tsk != current->group_leader)
                return -EINVAL;
 
        if ((vma->vm_end - vma->vm_start) > SZ_4M)
index 1a50cd3b4233bdf467049f3308c636fe32c0caf4..9b34dff6453633fcc9cf63393eb6fe553af29dbe 100644 (file)
@@ -216,12 +216,16 @@ static int ahci_da850_probe(struct platform_device *pdev)
                return rc;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       if (!res)
+       if (!res) {
+               rc = -ENODEV;
                goto disable_resources;
+       }
 
        pwrdn_reg = devm_ioremap(dev, res->start, resource_size(res));
-       if (!pwrdn_reg)
+       if (!pwrdn_reg) {
+               rc = -ENOMEM;
                goto disable_resources;
+       }
 
        da850_sata_init(dev, pwrdn_reg, hpriv->mmio, mpy);
 
index fa7dd4394c02b642c00119bd00a4b59b18921a0d..1945a8ea20998490b48aa70dfe56c4fbaad744ea 100644 (file)
@@ -2411,6 +2411,9 @@ static void ata_dev_config_trusted(struct ata_device *dev)
        u64 trusted_cap;
        unsigned int err;
 
+       if (!ata_id_has_trusted(dev->id))
+               return;
+
        if (!ata_identify_page_supported(dev, ATA_LOG_SECURITY)) {
                ata_dev_warn(dev,
                             "Security Log not supported\n");
index ef8334949b4217d9d0f1f964432c16a56ed244c4..f321b96405f55746490b50132f583c0124b192bb 100644 (file)
@@ -221,8 +221,7 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
 }
 
 static int
-figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit,
-                loff_t logical_blocksize)
+figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
 {
        loff_t size = get_size(offset, sizelimit, lo->lo_backing_file);
        sector_t x = (sector_t)size;
@@ -234,12 +233,6 @@ figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit,
                lo->lo_offset = offset;
        if (lo->lo_sizelimit != sizelimit)
                lo->lo_sizelimit = sizelimit;
-       if (lo->lo_flags & LO_FLAGS_BLOCKSIZE) {
-               lo->lo_logical_blocksize = logical_blocksize;
-               blk_queue_physical_block_size(lo->lo_queue, lo->lo_blocksize);
-               blk_queue_logical_block_size(lo->lo_queue,
-                                            lo->lo_logical_blocksize);
-       }
        set_capacity(lo->lo_disk, x);
        bd_set_size(bdev, (loff_t)get_capacity(bdev->bd_disk) << 9);
        /* let user-space know about the new size */
@@ -820,7 +813,6 @@ static void loop_config_discard(struct loop_device *lo)
        struct file *file = lo->lo_backing_file;
        struct inode *inode = file->f_mapping->host;
        struct request_queue *q = lo->lo_queue;
-       int lo_bits = 9;
 
        /*
         * We use punch hole to reclaim the free space used by the
@@ -840,11 +832,9 @@ static void loop_config_discard(struct loop_device *lo)
 
        q->limits.discard_granularity = inode->i_sb->s_blocksize;
        q->limits.discard_alignment = 0;
-       if (lo->lo_flags & LO_FLAGS_BLOCKSIZE)
-               lo_bits = blksize_bits(lo->lo_logical_blocksize);
 
-       blk_queue_max_discard_sectors(q, UINT_MAX >> lo_bits);
-       blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> lo_bits);
+       blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
+       blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
        queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
 }
 
@@ -938,7 +928,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
 
        lo->use_dio = false;
        lo->lo_blocksize = lo_blocksize;
-       lo->lo_logical_blocksize = 512;
        lo->lo_device = bdev;
        lo->lo_flags = lo_flags;
        lo->lo_backing_file = file;
@@ -1104,7 +1093,6 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
        int err;
        struct loop_func_table *xfer;
        kuid_t uid = current_uid();
-       int lo_flags = lo->lo_flags;
 
        if (lo->lo_encrypt_key_size &&
            !uid_eq(lo->lo_key_owner, uid) &&
@@ -1137,26 +1125,9 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
        if (err)
                goto exit;
 
-       if (info->lo_flags & LO_FLAGS_BLOCKSIZE) {
-               if (!(lo->lo_flags & LO_FLAGS_BLOCKSIZE))
-                       lo->lo_logical_blocksize = 512;
-               lo->lo_flags |= LO_FLAGS_BLOCKSIZE;
-               if (LO_INFO_BLOCKSIZE(info) != 512 &&
-                   LO_INFO_BLOCKSIZE(info) != 1024 &&
-                   LO_INFO_BLOCKSIZE(info) != 2048 &&
-                   LO_INFO_BLOCKSIZE(info) != 4096)
-                       return -EINVAL;
-               if (LO_INFO_BLOCKSIZE(info) > lo->lo_blocksize)
-                       return -EINVAL;
-       }
-
        if (lo->lo_offset != info->lo_offset ||
-           lo->lo_sizelimit != info->lo_sizelimit ||
-           lo->lo_flags != lo_flags ||
-           ((lo->lo_flags & LO_FLAGS_BLOCKSIZE) &&
-            lo->lo_logical_blocksize != LO_INFO_BLOCKSIZE(info))) {
-               if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit,
-                                    LO_INFO_BLOCKSIZE(info))) {
+           lo->lo_sizelimit != info->lo_sizelimit) {
+               if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) {
                        err = -EFBIG;
                        goto exit;
                }
@@ -1348,8 +1319,7 @@ static int loop_set_capacity(struct loop_device *lo)
        if (unlikely(lo->lo_state != Lo_bound))
                return -ENXIO;
 
-       return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit,
-                               lo->lo_logical_blocksize);
+       return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit);
 }
 
 static int loop_set_dio(struct loop_device *lo, unsigned long arg)
index 2c096b9a17b8ccd756065d5102b293796a5833ad..fecd3f97ef8c7cd9f825e6c58777a1a2bc6f3461 100644 (file)
@@ -49,7 +49,6 @@ struct loop_device {
        struct file *   lo_backing_file;
        struct block_device *lo_device;
        unsigned        lo_blocksize;
-       unsigned        lo_logical_blocksize;
        void            *key_data; 
 
        gfp_t           old_gfp_mask;
index 1498b899a593e31951c835f4f537d1bb03d0e596..d3d5523862c227d86166a56fba230467b9b545fc 100644 (file)
@@ -381,6 +381,7 @@ static void virtblk_config_changed_work(struct work_struct *work)
        struct request_queue *q = vblk->disk->queue;
        char cap_str_2[10], cap_str_10[10];
        char *envp[] = { "RESIZE=1", NULL };
+       unsigned long long nblocks;
        u64 capacity;
 
        /* Host must always specify the capacity. */
@@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
                capacity = (sector_t)-1;
        }
 
-       string_get_size(capacity, queue_logical_block_size(q),
+       nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
+
+       string_get_size(nblocks, queue_logical_block_size(q),
                        STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
-       string_get_size(capacity, queue_logical_block_size(q),
+       string_get_size(nblocks, queue_logical_block_size(q),
                        STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
 
        dev_notice(&vdev->dev,
-                 "new size: %llu %d-byte logical blocks (%s/%s)\n",
-                 (unsigned long long)capacity,
-                 queue_logical_block_size(q),
-                 cap_str_10, cap_str_2);
+                  "new size: %llu %d-byte logical blocks (%s/%s)\n",
+                  nblocks,
+                  queue_logical_block_size(q),
+                  cap_str_10,
+                  cap_str_2);
 
        set_capacity(vblk->disk, capacity);
        revalidate_disk(vblk->disk);
index 792da683e70dafafa6f69e224b8e57272d3e6be1..2adb8599be93147bf7e9e89d3d65d43b6305bff0 100644 (file)
@@ -244,6 +244,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
 {
        struct pending_req *req, *n;
        unsigned int j, r;
+       bool busy = false;
 
        for (r = 0; r < blkif->nr_rings; r++) {
                struct xen_blkif_ring *ring = &blkif->rings[r];
@@ -261,8 +262,10 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
                 * don't have any discard_io or other_io requests. So, checking
                 * for inflight IO is enough.
                 */
-               if (atomic_read(&ring->inflight) > 0)
-                       return -EBUSY;
+               if (atomic_read(&ring->inflight) > 0) {
+                       busy = true;
+                       continue;
+               }
 
                if (ring->irq) {
                        unbind_from_irqhandler(ring->irq, ring);
@@ -300,6 +303,9 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
                WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
                ring->active = false;
        }
+       if (busy)
+               return -EBUSY;
+
        blkif->nr_ring_pages = 0;
        /*
         * blkif->rings was allocated in connect_ring, so we should free it in
index b10cbaa82ff537b1cfb68d93d80aecdfebcd6c22..b26256f23d67fbdf58206adf2a253fcf40c50091 100644 (file)
@@ -717,8 +717,8 @@ static int tegra_adma_probe(struct platform_device *pdev)
                tdc->chan_addr = tdma->base_addr + ADMA_CH_REG_OFFSET(i);
 
                tdc->irq = of_irq_get(pdev->dev.of_node, i);
-               if (tdc->irq < 0) {
-                       ret = tdc->irq;
+               if (tdc->irq <= 0) {
+                       ret = tdc->irq ?: -ENXIO;
                        goto irq_dispose;
                }
 
index e338c374356294f97c1b331c4c04a4977d495290..45c65f805fd6ba5a3899b5c29a9651fa2d6dcc43 100644 (file)
@@ -557,7 +557,7 @@ static void mvebu_gpio_irq_handler(struct irq_desc *desc)
        edge_cause = mvebu_gpio_read_edge_cause(mvchip);
        edge_mask  = mvebu_gpio_read_edge_mask(mvchip);
 
-       cause = (data_in ^ level_mask) | (edge_cause & edge_mask);
+       cause = (data_in & level_mask) | (edge_cause & edge_mask);
 
        for (i = 0; i < mvchip->chip.ngpio; i++) {
                int irq;
index 16fe9742597b540ff4d82e869dc13d66326bbd2a..fc80add5fedb57dc07b6f567eef138494452316e 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/mutex.h>
 #include <linux/device.h>
 #include <linux/sysfs.h>
+#include <linux/gpio.h>
 #include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
@@ -432,6 +433,11 @@ static struct attribute *gpiochip_attrs[] = {
 };
 ATTRIBUTE_GROUPS(gpiochip);
 
+static struct gpio_desc *gpio_to_valid_desc(int gpio)
+{
+       return gpio_is_valid(gpio) ? gpio_to_desc(gpio) : NULL;
+}
+
 /*
  * /sys/class/gpio/export ... write-only
  *     integer N ... number of GPIO to export (full access)
@@ -450,7 +456,7 @@ static ssize_t export_store(struct class *class,
        if (status < 0)
                goto done;
 
-       desc = gpio_to_desc(gpio);
+       desc = gpio_to_valid_desc(gpio);
        /* reject invalid GPIOs */
        if (!desc) {
                pr_warn("%s: invalid GPIO %ld\n", __func__, gpio);
@@ -493,7 +499,7 @@ static ssize_t unexport_store(struct class *class,
        if (status < 0)
                goto done;
 
-       desc = gpio_to_desc(gpio);
+       desc = gpio_to_valid_desc(gpio);
        /* reject bogus commands (gpio_unexport ignores them) */
        if (!desc) {
                pr_warn("%s: invalid GPIO %ld\n", __func__, gpio);
index 6558a3ed57a7f6a1127f81aa0e1b5a861aa21b8d..e1cde6b80027fe1cad56b6169c38aadac1974e3e 100644 (file)
@@ -146,36 +146,6 @@ static void amdgpu_mn_invalidate_node(struct amdgpu_mn_node *node,
        }
 }
 
-/**
- * amdgpu_mn_invalidate_page - callback to notify about mm change
- *
- * @mn: our notifier
- * @mn: the mm this callback is about
- * @address: address of invalidate page
- *
- * Invalidation of a single page. Blocks for all BOs mapping it
- * and unmap them by move them into system domain again.
- */
-static void amdgpu_mn_invalidate_page(struct mmu_notifier *mn,
-                                     struct mm_struct *mm,
-                                     unsigned long address)
-{
-       struct amdgpu_mn *rmn = container_of(mn, struct amdgpu_mn, mn);
-       struct interval_tree_node *it;
-
-       mutex_lock(&rmn->lock);
-
-       it = interval_tree_iter_first(&rmn->objects, address, address);
-       if (it) {
-               struct amdgpu_mn_node *node;
-
-               node = container_of(it, struct amdgpu_mn_node, it);
-               amdgpu_mn_invalidate_node(node, address, address);
-       }
-
-       mutex_unlock(&rmn->lock);
-}
-
 /**
  * amdgpu_mn_invalidate_range_start - callback to notify about mm change
  *
@@ -215,7 +185,6 @@ static void amdgpu_mn_invalidate_range_start(struct mmu_notifier *mn,
 
 static const struct mmu_notifier_ops amdgpu_mn_ops = {
        .release = amdgpu_mn_release,
-       .invalidate_page = amdgpu_mn_invalidate_page,
        .invalidate_range_start = amdgpu_mn_invalidate_range_start,
 };
 
index 2d51a2269fc610ffc705abcb7a49c1bdcaffbae9..5131bfb94f065ceb20ba61713f990b76f11103cb 100644 (file)
@@ -597,9 +597,9 @@ static void sii8620_mt_read_devcap(struct sii8620 *ctx, bool xdevcap)
 static void sii8620_mt_read_devcap_reg_recv(struct sii8620 *ctx,
                struct sii8620_mt_msg *msg)
 {
-       u8 reg = msg->reg[0] & 0x7f;
+       u8 reg = msg->reg[1] & 0x7f;
 
-       if (msg->reg[0] & 0x80)
+       if (msg->reg[1] & 0x80)
                ctx->xdevcap[reg] = msg->ret;
        else
                ctx->devcap[reg] = msg->ret;
index c0f336d23f9ccab1d375eda63f8381d62ccf0f00..aed25c4183bb0e5df17a751e25a33c907b91d9b1 100644 (file)
@@ -1655,6 +1655,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
        if (config->funcs->atomic_check)
                ret = config->funcs->atomic_check(state->dev, state);
 
+       if (ret)
+               return ret;
+
        if (!state->allow_modeset) {
                for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
                        if (drm_atomic_crtc_needs_modeset(crtc_state)) {
@@ -1665,7 +1668,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
                }
        }
 
-       return ret;
+       return 0;
 }
 EXPORT_SYMBOL(drm_atomic_check_only);
 
@@ -2167,10 +2170,10 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
        struct drm_atomic_state *state;
        struct drm_modeset_acquire_ctx ctx;
        struct drm_plane *plane;
-       struct drm_out_fence_state *fence_state = NULL;
+       struct drm_out_fence_state *fence_state;
        unsigned plane_mask;
        int ret = 0;
-       unsigned int i, j, num_fences = 0;
+       unsigned int i, j, num_fences;
 
        /* disallow for drivers not supporting atomic: */
        if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
@@ -2211,6 +2214,8 @@ retry:
        plane_mask = 0;
        copied_objs = 0;
        copied_props = 0;
+       fence_state = NULL;
+       num_fences = 0;
 
        for (i = 0; i < arg->count_objs; i++) {
                uint32_t obj_id, count_props;
index 8dc11064253d9e5ed58f8c817a471b36c25c5951..cdaac37907b1e4577565625f6485a7cf3de25088 100644 (file)
@@ -255,13 +255,13 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
        struct drm_gem_object *obj = ptr;
        struct drm_device *dev = obj->dev;
 
+       if (dev->driver->gem_close_object)
+               dev->driver->gem_close_object(obj, file_priv);
+
        if (drm_core_check_feature(dev, DRIVER_PRIME))
                drm_gem_remove_prime_handles(obj, file_priv);
        drm_vma_node_revoke(&obj->vma_node, file_priv);
 
-       if (dev->driver->gem_close_object)
-               dev->driver->gem_close_object(obj, file_priv);
-
        drm_gem_object_handle_put_unlocked(obj);
 
        return 0;
index 5dc8c4350602a561fe4cfd77fce77e26770696fb..e40c12fabbdeaf9a325811d25e17c30990637e12 100644 (file)
@@ -601,6 +601,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 
                crtc = drm_crtc_find(dev, plane_req->crtc_id);
                if (!crtc) {
+                       drm_framebuffer_put(fb);
                        DRM_DEBUG_KMS("Unknown crtc ID %d\n",
                                      plane_req->crtc_id);
                        return -ENOENT;
index 713848c3634946bea6c9805a3a705c22c1b8c08c..e556a46cd4c292773b5e5dfca629c21625b05c43 100644 (file)
@@ -2714,7 +2714,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx)
 unmap_src:
        i915_gem_object_unpin_map(obj);
 put_obj:
-       i915_gem_object_put(wa_ctx->indirect_ctx.obj);
+       i915_gem_object_put(obj);
        return ret;
 }
 
index 639d45c1dd2e6ac24013431aa6da84abb9f0b089..7ea7fd1e8856dc7bf98f3a6a6fdce0366db1f089 100644 (file)
@@ -1120,8 +1120,8 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
        bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
        uint8_t aux_channel, ddc_pin;
        /* Each DDI port can have more than one value on the "DVO Port" field,
-        * so look for all the possible values for each port and abort if more
-        * than one is found. */
+        * so look for all the possible values for each port.
+        */
        int dvo_ports[][3] = {
                {DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
                {DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
@@ -1130,7 +1130,10 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
                {DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
        };
 
-       /* Find the child device to use, abort if more than one found. */
+       /*
+        * Find the first child device to reference the port, report if more
+        * than one found.
+        */
        for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
                it = dev_priv->vbt.child_dev + i;
 
@@ -1140,11 +1143,11 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 
                        if (it->common.dvo_port == dvo_ports[port][j]) {
                                if (child) {
-                                       DRM_DEBUG_KMS("More than one child device for port %c in VBT.\n",
+                                       DRM_DEBUG_KMS("More than one child device for port %c in VBT, using the first.\n",
                                                      port_name(port));
-                                       return;
+                               } else {
+                                       child = it;
                                }
-                               child = it;
                        }
                }
        }
index 6e09ceb71500ceeedce5836c3772861f47aeda21..150a156f3b1e9a2bff7f32bbf1ed1905eb71ca8b 100644 (file)
@@ -46,7 +46,7 @@ static u32 dcs_get_backlight(struct intel_connector *connector)
        struct intel_encoder *encoder = connector->encoder;
        struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
        struct mipi_dsi_device *dsi_device;
-       u8 data;
+       u8 data = 0;
        enum port port;
 
        /* FIXME: Need to take care of 16 bit brightness level */
index 7158c7ce9c0941a05654261e2443bac8b2315b08..91c07b0c8db912dbb24a08fc045dee7a899b237b 100644 (file)
@@ -306,7 +306,7 @@ static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
 
        if (!gpio_desc) {
                gpio_desc = devm_gpiod_get_index(dev_priv->drm.dev,
-                                                "panel", gpio_index,
+                                                NULL, gpio_index,
                                                 value ? GPIOD_OUT_LOW :
                                                 GPIOD_OUT_HIGH);
 
index 7404cf2aac28690e2e5367de5a93164062a909b4..2afa4daa88e8cc695085c99d7a6d8b33c87a869a 100644 (file)
@@ -1221,6 +1221,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
        return ret;
 }
 
+static u8 gtiir[] = {
+       [RCS] = 0,
+       [BCS] = 0,
+       [VCS] = 1,
+       [VCS2] = 1,
+       [VECS] = 3,
+};
+
 static int gen8_init_common_ring(struct intel_engine_cs *engine)
 {
        struct drm_i915_private *dev_priv = engine->i915;
@@ -1245,9 +1253,22 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)
 
        DRM_DEBUG_DRIVER("Execlists enabled for %s\n", engine->name);
 
-       /* After a GPU reset, we may have requests to replay */
+       GEM_BUG_ON(engine->id >= ARRAY_SIZE(gtiir));
+
+       /*
+        * Clear any pending interrupt state.
+        *
+        * We do it twice out of paranoia that some of the IIR are double
+        * buffered, and if we only reset it once there may still be
+        * an interrupt pending.
+        */
+       I915_WRITE(GEN8_GT_IIR(gtiir[engine->id]),
+                  GT_CONTEXT_SWITCH_INTERRUPT << engine->irq_shift);
+       I915_WRITE(GEN8_GT_IIR(gtiir[engine->id]),
+                  GT_CONTEXT_SWITCH_INTERRUPT << engine->irq_shift);
        clear_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted);
 
+       /* After a GPU reset, we may have requests to replay */
        submit = false;
        for (n = 0; n < ARRAY_SIZE(engine->execlist_port); n++) {
                if (!port_isset(&port[n]))
index 5abef482eacf1b24780edea4c40ab7e593a42dc6..beb9baaf2f2e4e573956f1ea842c2963dce95bd7 100644 (file)
@@ -210,8 +210,8 @@ bool lspcon_init(struct intel_digital_port *intel_dig_port)
        struct drm_device *dev = intel_dig_port->base.base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
 
-       if (!IS_GEN9(dev_priv)) {
-               DRM_ERROR("LSPCON is supported on GEN9 only\n");
+       if (!HAS_LSPCON(dev_priv)) {
+               DRM_ERROR("LSPCON is not supported on this platform\n");
                return false;
        }
 
index 6276bb834b4fe15529652e73c07e901617abc194..d3845989a29dfcba4bf4b03f5740f9945d1bdcdf 100644 (file)
@@ -545,15 +545,13 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
                return;
        }
 
+       ics = ipu_drm_fourcc_to_colorspace(fb->format->format);
        switch (ipu_plane->dp_flow) {
        case IPU_DP_FLOW_SYNC_BG:
-               ipu_dp_setup_channel(ipu_plane->dp,
-                                       IPUV3_COLORSPACE_RGB,
-                                       IPUV3_COLORSPACE_RGB);
+               ipu_dp_setup_channel(ipu_plane->dp, ics, IPUV3_COLORSPACE_RGB);
                ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true);
                break;
        case IPU_DP_FLOW_SYNC_FG:
-               ics = ipu_drm_fourcc_to_colorspace(state->fb->format->format);
                ipu_dp_setup_channel(ipu_plane->dp, ics,
                                        IPUV3_COLORSPACE_UNKNOWN);
                /* Enable local alpha on partial plane */
index c6b1b7f3a2a397740d5545671113def5bb2e5519..c16bc0a7115b1b41db4ccca2b74061e3e7ccceb2 100644 (file)
@@ -275,11 +275,15 @@ static void rockchip_drm_fb_resume(struct drm_device *drm)
 static int rockchip_drm_sys_suspend(struct device *dev)
 {
        struct drm_device *drm = dev_get_drvdata(dev);
-       struct rockchip_drm_private *priv = drm->dev_private;
+       struct rockchip_drm_private *priv;
+
+       if (!drm)
+               return 0;
 
        drm_kms_helper_poll_disable(drm);
        rockchip_drm_fb_suspend(drm);
 
+       priv = drm->dev_private;
        priv->state = drm_atomic_helper_suspend(drm);
        if (IS_ERR(priv->state)) {
                rockchip_drm_fb_resume(drm);
@@ -293,8 +297,12 @@ static int rockchip_drm_sys_suspend(struct device *dev)
 static int rockchip_drm_sys_resume(struct device *dev)
 {
        struct drm_device *drm = dev_get_drvdata(dev);
-       struct rockchip_drm_private *priv = drm->dev_private;
+       struct rockchip_drm_private *priv;
+
+       if (!drm)
+               return 0;
 
+       priv = drm->dev_private;
        drm_atomic_helper_resume(drm, priv->state);
        rockchip_drm_fb_resume(drm);
        drm_kms_helper_poll_enable(drm);
index abc7d8fe06b450084bcd20ec560b62405415ff40..a45a627283a149c79693ec90dbd9da5fd8f42056 100644 (file)
 #include "sun4i_framebuffer.h"
 #include "sun4i_tcon.h"
 
+static void sun4i_drv_lastclose(struct drm_device *dev)
+{
+       struct sun4i_drv *drv = dev->dev_private;
+
+       drm_fbdev_cma_restore_mode(drv->fbdev);
+}
+
 DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops);
 
 static struct drm_driver sun4i_drv_driver = {
        .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC,
 
        /* Generic Operations */
+       .lastclose              = sun4i_drv_lastclose,
        .fops                   = &sun4i_drv_fops,
        .name                   = "sun4i-drm",
        .desc                   = "Allwinner sun4i Display Engine",
index 61e06f0e8cd3b43890e807a2ab2bb9037ac95e99..625ba24f143f22c3369cecde2abf4927ba6199f5 100644 (file)
@@ -1567,10 +1567,34 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev,
 }
 
 
+/**
+ * vmw_kms_atomic_commit - Perform an atomic state commit
+ *
+ * @dev: DRM device
+ * @state: the driver state object
+ * @nonblock: Whether nonblocking behaviour is requested
+ *
+ * This is a simple wrapper around drm_atomic_helper_commit() for
+ * us to clear the nonblocking value.
+ *
+ * Nonblocking commits currently cause synchronization issues
+ * for vmwgfx.
+ *
+ * RETURNS
+ * Zero for success or negative error code on failure.
+ */
+int vmw_kms_atomic_commit(struct drm_device *dev,
+                         struct drm_atomic_state *state,
+                         bool nonblock)
+{
+       return drm_atomic_helper_commit(dev, state, false);
+}
+
+
 static const struct drm_mode_config_funcs vmw_kms_funcs = {
        .fb_create = vmw_kms_fb_create,
        .atomic_check = vmw_kms_atomic_check_modeset,
-       .atomic_commit = drm_atomic_helper_commit,
+       .atomic_commit = vmw_kms_atomic_commit,
 };
 
 static int vmw_kms_generic_present(struct vmw_private *dev_priv,
index 08766c6e7856b31f6183dba84f47c27980fb49c2..87a20b3dcf7a53a64fc464a3c8834d5c0a167781 100644 (file)
@@ -1,6 +1,7 @@
 config IMX_IPUV3_CORE
        tristate "IPUv3 core support"
        depends on SOC_IMX5 || SOC_IMX6Q || ARCH_MULTIPLATFORM
+       depends on DRM || !DRM # if DRM=m, this can't be 'y'
        select GENERIC_IRQ_CHIP
        help
          Choose this if you have a i.MX5/6 system and want to use the Image
index f19348328a715580aa37043abed6d1ee6b061cf4..6fdf9231c23cb0a4f4c736d95662495c2237e24f 100644 (file)
@@ -410,10 +410,11 @@ static bool aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus)
        }
 
        /* We are in an invalid state; reset bus to a known state. */
-       if (!bus->msgs && bus->master_state != ASPEED_I2C_MASTER_STOP) {
+       if (!bus->msgs) {
                dev_err(bus->dev, "bus in unknown state");
                bus->cmd_err = -EIO;
-               aspeed_i2c_do_stop(bus);
+               if (bus->master_state != ASPEED_I2C_MASTER_STOP)
+                       aspeed_i2c_do_stop(bus);
                goto out_no_complete;
        }
        msg = &bus->msgs[bus->msgs_index];
index 143a8fd582b4aeb905ea25b416261a5c1f44a6e9..57248bccadbcb73df29b224594b66bf8088cfb30 100644 (file)
@@ -198,8 +198,7 @@ static void i2c_dw_configure_slave(struct dw_i2c_dev *dev)
        dev->functionality = I2C_FUNC_SLAVE | DW_IC_DEFAULT_FUNCTIONALITY;
 
        dev->slave_cfg = DW_IC_CON_RX_FIFO_FULL_HLD_CTRL |
-                        DW_IC_CON_RESTART_EN | DW_IC_CON_STOP_DET_IFADDRESSED |
-                        DW_IC_CON_SPEED_FAST;
+                        DW_IC_CON_RESTART_EN | DW_IC_CON_STOP_DET_IFADDRESSED;
 
        dev->mode = DW_IC_SLAVE;
 
@@ -430,7 +429,7 @@ static void dw_i2c_plat_complete(struct device *dev)
 #endif
 
 #ifdef CONFIG_PM
-static int dw_i2c_plat_suspend(struct device *dev)
+static int dw_i2c_plat_runtime_suspend(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
@@ -452,11 +451,21 @@ static int dw_i2c_plat_resume(struct device *dev)
        return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int dw_i2c_plat_suspend(struct device *dev)
+{
+       pm_runtime_resume(dev);
+       return dw_i2c_plat_runtime_suspend(dev);
+}
+#endif
+
 static const struct dev_pm_ops dw_i2c_dev_pm_ops = {
        .prepare = dw_i2c_plat_prepare,
        .complete = dw_i2c_plat_complete,
        SET_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume)
-       SET_RUNTIME_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume, NULL)
+       SET_RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend,
+                          dw_i2c_plat_resume,
+                          NULL)
 };
 
 #define DW_I2C_DEV_PMOPS (&dw_i2c_dev_pm_ops)
index 0548c7ea578c9752f7c4cc1efebef37b41bca68a..78d8fb73927d853ebec3061685696db646236e36 100644 (file)
@@ -177,6 +177,8 @@ static int i2c_dw_reg_slave(struct i2c_client *slave)
                return -EBUSY;
        if (slave->flags & I2C_CLIENT_TEN)
                return -EAFNOSUPPORT;
+       pm_runtime_get_sync(dev->dev);
+
        /*
         * Set slave address in the IC_SAR register,
         * the address to which the DW_apb_i2c responds.
@@ -205,6 +207,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
        dev->disable_int(dev);
        dev->disable(dev);
        dev->slave = NULL;
+       pm_runtime_put(dev->dev);
 
        return 0;
 }
@@ -272,7 +275,7 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
        slave_activity = ((dw_readl(dev, DW_IC_STATUS) &
                DW_IC_STATUS_SLAVE_ACTIVITY) >> 6);
 
-       if (!enabled || !(raw_stat & ~DW_IC_INTR_ACTIVITY))
+       if (!enabled || !(raw_stat & ~DW_IC_INTR_ACTIVITY) || !dev->slave)
                return 0;
 
        dev_dbg(dev->dev,
@@ -382,7 +385,6 @@ int i2c_dw_probe_slave(struct dw_i2c_dev *dev)
        ret = i2c_add_numbered_adapter(adap);
        if (ret)
                dev_err(dev->dev, "failure adding adapter: %d\n", ret);
-       pm_runtime_put_noidle(dev->dev);
 
        return ret;
 }
index b4685bb9b5d7356f97067a80c1ff9bd0f2d92090..adca51a99487cfb4d2a6d8843047018265e3295a 100644 (file)
@@ -127,8 +127,7 @@ static int simtec_i2c_probe(struct platform_device *dev)
        iounmap(pd->reg);
 
  err_res:
-       release_resource(pd->ioarea);
-       kfree(pd->ioarea);
+       release_mem_region(pd->ioarea->start, size);
 
  err:
        kfree(pd);
@@ -142,8 +141,7 @@ static int simtec_i2c_remove(struct platform_device *dev)
        i2c_del_adapter(&pd->adap);
 
        iounmap(pd->reg);
-       release_resource(pd->ioarea);
-       kfree(pd->ioarea);
+       release_mem_region(pd->ioarea->start, resource_size(pd->ioarea));
        kfree(pd);
 
        return 0;
index 12822a4b8f8f09b5c080f7338a89e0ea00cbb4f2..56e46581b84bdb03eeb07ddaa8d83cec1aa76341 100644 (file)
@@ -353,8 +353,8 @@ static int i2c_device_probe(struct device *dev)
        }
 
        /*
-        * An I2C ID table is not mandatory, if and only if, a suitable Device
-        * Tree match table entry is supplied for the probing device.
+        * An I2C ID table is not mandatory, if and only if, a suitable OF
+        * or ACPI ID table is supplied for the probing device.
         */
        if (!driver->id_table &&
            !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
index 232c0b80d65893e497abe4e13c4b5273e3c9a7a0..c3f86138cb55eba108cb39ef5c10548ad13ff5a4 100644 (file)
@@ -644,7 +644,7 @@ static int ina2xx_capture_thread(void *data)
 {
        struct iio_dev *indio_dev = data;
        struct ina2xx_chip_info *chip = iio_priv(indio_dev);
-       unsigned int sampling_us = SAMPLING_PERIOD(chip);
+       int sampling_us = SAMPLING_PERIOD(chip);
        int buffer_us;
 
        /*
index e09233b03c055b01c1d3cab229b66e5d093c1c3d..609676384f5e779824e41100ba53906c3df92d13 100644 (file)
@@ -64,7 +64,7 @@
 #define STM32H7_CKMODE_MASK            GENMASK(17, 16)
 
 /* STM32 H7 maximum analog clock rate (from datasheet) */
-#define STM32H7_ADC_MAX_CLK_RATE       72000000
+#define STM32H7_ADC_MAX_CLK_RATE       36000000
 
 /**
  * stm32_adc_common_regs - stm32 common registers, compatible dependent data
@@ -148,14 +148,14 @@ static int stm32f4_adc_clk_sel(struct platform_device *pdev,
                return -EINVAL;
        }
 
-       priv->common.rate = rate;
+       priv->common.rate = rate / stm32f4_pclk_div[i];
        val = readl_relaxed(priv->common.base + STM32F4_ADC_CCR);
        val &= ~STM32F4_ADC_ADCPRE_MASK;
        val |= i << STM32F4_ADC_ADCPRE_SHIFT;
        writel_relaxed(val, priv->common.base + STM32F4_ADC_CCR);
 
        dev_dbg(&pdev->dev, "Using analog clock source at %ld kHz\n",
-               rate / (stm32f4_pclk_div[i] * 1000));
+               priv->common.rate / 1000);
 
        return 0;
 }
@@ -250,7 +250,7 @@ static int stm32h7_adc_clk_sel(struct platform_device *pdev,
 
 out:
        /* rate used later by each ADC instance to control BOOST mode */
-       priv->common.rate = rate;
+       priv->common.rate = rate / div;
 
        /* Set common clock mode and prescaler */
        val = readl_relaxed(priv->common.base + STM32H7_ADC_CCR);
@@ -260,7 +260,7 @@ out:
        writel_relaxed(val, priv->common.base + STM32H7_ADC_CCR);
 
        dev_dbg(&pdev->dev, "Using %s clock/%d source at %ld kHz\n",
-               ckmode ? "bus" : "adc", div, rate / (div * 1000));
+               ckmode ? "bus" : "adc", div, priv->common.rate / 1000);
 
        return 0;
 }
index 16ade0a0327bafbe478db6a3714549c455582a97..0e4b379ada4587e2fec367cb5a4beb8996cbe143 100644 (file)
@@ -111,8 +111,6 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
        s32 poll_value = 0;
 
        if (state) {
-               if (!atomic_read(&st->user_requested_state))
-                       return 0;
                if (sensor_hub_device_open(st->hsdev))
                        return -EIO;
 
@@ -161,6 +159,9 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
                                       &report_val);
        }
 
+       pr_debug("HID_SENSOR %s set power_state %d report_state %d\n",
+                st->pdev->name, state_val, report_val);
+
        sensor_hub_get_feature(st->hsdev, st->power_state.report_id,
                               st->power_state.index,
                               sizeof(state_val), &state_val);
@@ -182,6 +183,7 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
                ret = pm_runtime_get_sync(&st->pdev->dev);
        else {
                pm_runtime_mark_last_busy(&st->pdev->dev);
+               pm_runtime_use_autosuspend(&st->pdev->dev);
                ret = pm_runtime_put_autosuspend(&st->pdev->dev);
        }
        if (ret < 0) {
@@ -285,8 +287,6 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
        /* Default to 3 seconds, but can be changed from sysfs */
        pm_runtime_set_autosuspend_delay(&attrb->pdev->dev,
                                         3000);
-       pm_runtime_use_autosuspend(&attrb->pdev->dev);
-
        return ret;
 error_unreg_trigger:
        iio_trigger_unregister(trig);
index 8cf84d3488b2650c0ca2f265e8dc58f1b10efc0b..12898424d8382f5953bcf2618e31f96c1874c56b 100644 (file)
@@ -696,7 +696,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
                .gyro_max_val = IIO_RAD_TO_DEGREE(22500),
                .gyro_max_scale = 450,
                .accel_max_val = IIO_M_S_2_TO_G(12500),
-               .accel_max_scale = 5,
+               .accel_max_scale = 10,
        },
        [ADIS16485] = {
                .channels = adis16485_channels,
index 8e1b0861fbe4a63b6b50466f320bd65e6e48f3c9..c3856369998498685aa1a516e11669fe8452aa2b 100644 (file)
@@ -356,9 +356,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
                .drdy_irq = {
                        .addr = 0x62,
                        .mask_int1 = 0x01,
-                       .addr_ihl = 0x63,
-                       .mask_ihl = 0x04,
-                       .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+                       .addr_stat_drdy = 0x67,
                },
                .multi_read_bit = false,
                .bootime = 2,
index d82b788374b61ba617bc5a073e17d283e5e0cfc9..0d2ea3ee371b9fc8c0fff8c213f97ee3ab31b5a1 100644 (file)
@@ -282,6 +282,11 @@ static int bmp280_read_temp(struct bmp280_data *data,
        }
 
        adc_temp = be32_to_cpu(tmp) >> 12;
+       if (adc_temp == BMP280_TEMP_SKIPPED) {
+               /* reading was skipped */
+               dev_err(data->dev, "reading temperature skipped\n");
+               return -EIO;
+       }
        comp_temp = bmp280_compensate_temp(data, adc_temp);
 
        /*
@@ -317,6 +322,11 @@ static int bmp280_read_press(struct bmp280_data *data,
        }
 
        adc_press = be32_to_cpu(tmp) >> 12;
+       if (adc_press == BMP280_PRESS_SKIPPED) {
+               /* reading was skipped */
+               dev_err(data->dev, "reading pressure skipped\n");
+               return -EIO;
+       }
        comp_press = bmp280_compensate_press(data, adc_press);
 
        *val = comp_press;
@@ -345,6 +355,11 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2)
        }
 
        adc_humidity = be16_to_cpu(tmp);
+       if (adc_humidity == BMP280_HUMIDITY_SKIPPED) {
+               /* reading was skipped */
+               dev_err(data->dev, "reading humidity skipped\n");
+               return -EIO;
+       }
        comp_humidity = bmp280_compensate_humidity(data, adc_humidity);
 
        *val = comp_humidity;
@@ -597,14 +612,20 @@ static const struct bmp280_chip_info bmp280_chip_info = {
 
 static int bme280_chip_config(struct bmp280_data *data)
 {
-       int ret = bmp280_chip_config(data);
+       int ret;
        u8 osrs = BMP280_OSRS_HUMIDITIY_X(data->oversampling_humid + 1);
 
+       /*
+        * Oversampling of humidity must be set before oversampling of
+        * temperature/pressure is set to become effective.
+        */
+       ret = regmap_update_bits(data->regmap, BMP280_REG_CTRL_HUMIDITY,
+                                 BMP280_OSRS_HUMIDITY_MASK, osrs);
+
        if (ret < 0)
                return ret;
 
-       return regmap_update_bits(data->regmap, BMP280_REG_CTRL_HUMIDITY,
-                                 BMP280_OSRS_HUMIDITY_MASK, osrs);
+       return bmp280_chip_config(data);
 }
 
 static const struct bmp280_chip_info bme280_chip_info = {
index 2c770e13be0e4ad0f4e884f5778d8b1e318b4a86..61347438b779e05f06f84b8c1a2ac8d50b9ddb1d 100644 (file)
 #define BME280_CHIP_ID                 0x60
 #define BMP280_SOFT_RESET_VAL          0xB6
 
+/* BMP280 register skipped special values */
+#define BMP280_TEMP_SKIPPED            0x80000
+#define BMP280_PRESS_SKIPPED           0x80000
+#define BMP280_HUMIDITY_SKIPPED                0x8000
+
 /* Regmap configurations */
 extern const struct regmap_config bmp180_regmap_config;
 extern const struct regmap_config bmp280_regmap_config;
index d22bc56dd9fc0ffffbd28eb30b3507e13fdfb50e..25ad6abfee22d0eeb77829ba623429ccbcbf343c 100644 (file)
@@ -366,34 +366,32 @@ static int stm32_counter_read_raw(struct iio_dev *indio_dev,
                                  int *val, int *val2, long mask)
 {
        struct stm32_timer_trigger *priv = iio_priv(indio_dev);
+       u32 dat;
 
        switch (mask) {
        case IIO_CHAN_INFO_RAW:
-       {
-               u32 cnt;
-
-               regmap_read(priv->regmap, TIM_CNT, &cnt);
-               *val = cnt;
+               regmap_read(priv->regmap, TIM_CNT, &dat);
+               *val = dat;
+               return IIO_VAL_INT;
 
+       case IIO_CHAN_INFO_ENABLE:
+               regmap_read(priv->regmap, TIM_CR1, &dat);
+               *val = (dat & TIM_CR1_CEN) ? 1 : 0;
                return IIO_VAL_INT;
-       }
-       case IIO_CHAN_INFO_SCALE:
-       {
-               u32 smcr;
 
-               regmap_read(priv->regmap, TIM_SMCR, &smcr);
-               smcr &= TIM_SMCR_SMS;
+       case IIO_CHAN_INFO_SCALE:
+               regmap_read(priv->regmap, TIM_SMCR, &dat);
+               dat &= TIM_SMCR_SMS;
 
                *val = 1;
                *val2 = 0;
 
                /* in quadrature case scale = 0.25 */
-               if (smcr == 3)
+               if (dat == 3)
                        *val2 = 2;
 
                return IIO_VAL_FRACTIONAL_LOG2;
        }
-       }
 
        return -EINVAL;
 }
@@ -403,15 +401,31 @@ static int stm32_counter_write_raw(struct iio_dev *indio_dev,
                                   int val, int val2, long mask)
 {
        struct stm32_timer_trigger *priv = iio_priv(indio_dev);
+       u32 dat;
 
        switch (mask) {
        case IIO_CHAN_INFO_RAW:
-               regmap_write(priv->regmap, TIM_CNT, val);
+               return regmap_write(priv->regmap, TIM_CNT, val);
 
-               return IIO_VAL_INT;
        case IIO_CHAN_INFO_SCALE:
                /* fixed scale */
                return -EINVAL;
+
+       case IIO_CHAN_INFO_ENABLE:
+               if (val) {
+                       regmap_read(priv->regmap, TIM_CR1, &dat);
+                       if (!(dat & TIM_CR1_CEN))
+                               clk_enable(priv->clk);
+                       regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN,
+                                          TIM_CR1_CEN);
+               } else {
+                       regmap_read(priv->regmap, TIM_CR1, &dat);
+                       regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN,
+                                          0);
+                       if (dat & TIM_CR1_CEN)
+                               clk_disable(priv->clk);
+               }
+               return 0;
        }
 
        return -EINVAL;
@@ -471,7 +485,7 @@ static int stm32_get_trigger_mode(struct iio_dev *indio_dev,
 
        regmap_read(priv->regmap, TIM_SMCR, &smcr);
 
-       return smcr == TIM_SMCR_SMS ? 0 : -EINVAL;
+       return (smcr & TIM_SMCR_SMS) == TIM_SMCR_SMS ? 0 : -EINVAL;
 }
 
 static const struct iio_enum stm32_trigger_mode_enum = {
@@ -507,9 +521,19 @@ static int stm32_set_enable_mode(struct iio_dev *indio_dev,
 {
        struct stm32_timer_trigger *priv = iio_priv(indio_dev);
        int sms = stm32_enable_mode2sms(mode);
+       u32 val;
 
        if (sms < 0)
                return sms;
+       /*
+        * Triggered mode sets CEN bit automatically by hardware. So, first
+        * enable counter clock, so it can use it. Keeps it in sync with CEN.
+        */
+       if (sms == 6) {
+               regmap_read(priv->regmap, TIM_CR1, &val);
+               if (!(val & TIM_CR1_CEN))
+                       clk_enable(priv->clk);
+       }
 
        regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, sms);
 
@@ -571,11 +595,14 @@ static int stm32_get_quadrature_mode(struct iio_dev *indio_dev,
 {
        struct stm32_timer_trigger *priv = iio_priv(indio_dev);
        u32 smcr;
+       int mode;
 
        regmap_read(priv->regmap, TIM_SMCR, &smcr);
-       smcr &= TIM_SMCR_SMS;
+       mode = (smcr & TIM_SMCR_SMS) - 1;
+       if ((mode < 0) || (mode > ARRAY_SIZE(stm32_quadrature_modes)))
+               return -EINVAL;
 
-       return smcr - 1;
+       return mode;
 }
 
 static const struct iio_enum stm32_quadrature_mode_enum = {
@@ -592,13 +619,20 @@ static const char *const stm32_count_direction_states[] = {
 
 static int stm32_set_count_direction(struct iio_dev *indio_dev,
                                     const struct iio_chan_spec *chan,
-                                    unsigned int mode)
+                                    unsigned int dir)
 {
        struct stm32_timer_trigger *priv = iio_priv(indio_dev);
+       u32 val;
+       int mode;
 
-       regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_DIR, mode);
+       /* In encoder mode, direction is RO (given by TI1/TI2 signals) */
+       regmap_read(priv->regmap, TIM_SMCR, &val);
+       mode = (val & TIM_SMCR_SMS) - 1;
+       if ((mode >= 0) || (mode < ARRAY_SIZE(stm32_quadrature_modes)))
+               return -EBUSY;
 
-       return 0;
+       return regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_DIR,
+                                 dir ? TIM_CR1_DIR : 0);
 }
 
 static int stm32_get_count_direction(struct iio_dev *indio_dev,
@@ -609,7 +643,7 @@ static int stm32_get_count_direction(struct iio_dev *indio_dev,
 
        regmap_read(priv->regmap, TIM_CR1, &cr1);
 
-       return (cr1 & TIM_CR1_DIR);
+       return ((cr1 & TIM_CR1_DIR) ? 1 : 0);
 }
 
 static const struct iio_enum stm32_count_direction_enum = {
@@ -672,7 +706,9 @@ static const struct iio_chan_spec_ext_info stm32_trigger_count_info[] = {
 static const struct iio_chan_spec stm32_trigger_channel = {
        .type = IIO_COUNT,
        .channel = 0,
-       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
+                             BIT(IIO_CHAN_INFO_ENABLE) |
+                             BIT(IIO_CHAN_INFO_SCALE),
        .ext_info = stm32_trigger_count_info,
        .indexed = 1
 };
index 8c4ec564e49583f6d05eab8df5e57e4378582f08..55e8f5ed8b3c69563033c50fc963446837284475 100644 (file)
@@ -166,24 +166,6 @@ static int invalidate_page_trampoline(struct ib_umem *item, u64 start,
        return 0;
 }
 
-static void ib_umem_notifier_invalidate_page(struct mmu_notifier *mn,
-                                            struct mm_struct *mm,
-                                            unsigned long address)
-{
-       struct ib_ucontext *context = container_of(mn, struct ib_ucontext, mn);
-
-       if (!context->invalidate_range)
-               return;
-
-       ib_ucontext_notifier_start_account(context);
-       down_read(&context->umem_rwsem);
-       rbt_ib_umem_for_each_in_range(&context->umem_tree, address,
-                                     address + PAGE_SIZE,
-                                     invalidate_page_trampoline, NULL);
-       up_read(&context->umem_rwsem);
-       ib_ucontext_notifier_end_account(context);
-}
-
 static int invalidate_range_start_trampoline(struct ib_umem *item, u64 start,
                                             u64 end, void *cookie)
 {
@@ -237,7 +219,6 @@ static void ib_umem_notifier_invalidate_range_end(struct mmu_notifier *mn,
 
 static const struct mmu_notifier_ops ib_umem_notifiers = {
        .release                    = ib_umem_notifier_release,
-       .invalidate_page            = ib_umem_notifier_invalidate_page,
        .invalidate_range_start     = ib_umem_notifier_invalidate_range_start,
        .invalidate_range_end       = ib_umem_notifier_invalidate_range_end,
 };
index c551d2b275fdf339310a087bef9c6e821d7c7e09..739bd69ef1d47fa163ea9f57cf86cbbf09f5fba7 100644 (file)
@@ -1015,7 +1015,7 @@ static struct ib_ucq_object *create_cq(struct ib_uverbs_file *file,
        cq->uobject       = &obj->uobject;
        cq->comp_handler  = ib_uverbs_comp_handler;
        cq->event_handler = ib_uverbs_cq_event_handler;
-       cq->cq_context    = &ev_file->ev_queue;
+       cq->cq_context    = ev_file ? &ev_file->ev_queue : NULL;
        atomic_set(&cq->usecnt, 0);
 
        obj->uobject.object = cq;
@@ -1522,6 +1522,7 @@ static int create_qp(struct ib_uverbs_file *file,
                qp->qp_type       = attr.qp_type;
                atomic_set(&qp->usecnt, 0);
                atomic_inc(&pd->usecnt);
+               qp->port = 0;
                if (attr.send_cq)
                        atomic_inc(&attr.send_cq->usecnt);
                if (attr.recv_cq)
@@ -1962,8 +1963,9 @@ static int modify_qp(struct ib_uverbs_file *file,
        attr->alt_timeout         = cmd->base.alt_timeout;
        attr->rate_limit          = cmd->rate_limit;
 
-       attr->ah_attr.type = rdma_ah_find_type(qp->device,
-                                              cmd->base.dest.port_num);
+       if (cmd->base.attr_mask & IB_QP_AV)
+               attr->ah_attr.type = rdma_ah_find_type(qp->device,
+                                                      cmd->base.dest.port_num);
        if (cmd->base.dest.is_global) {
                rdma_ah_set_grh(&attr->ah_attr, NULL,
                                cmd->base.dest.flow_label,
@@ -1981,8 +1983,9 @@ static int modify_qp(struct ib_uverbs_file *file,
        rdma_ah_set_port_num(&attr->ah_attr,
                             cmd->base.dest.port_num);
 
-       attr->alt_ah_attr.type = rdma_ah_find_type(qp->device,
-                                                  cmd->base.dest.port_num);
+       if (cmd->base.attr_mask & IB_QP_ALT_PATH)
+               attr->alt_ah_attr.type =
+                       rdma_ah_find_type(qp->device, cmd->base.dest.port_num);
        if (cmd->base.alt_dest.is_global) {
                rdma_ah_set_grh(&attr->alt_ah_attr, NULL,
                                cmd->base.alt_dest.flow_label,
index 7f8fe443df46f5b562ac3b2561e19226e3ab6b68..b456e3ca1876ae8db6bb5aeeb34dc8e7e48eab88 100644 (file)
@@ -838,6 +838,7 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
        spin_lock_init(&qp->mr_lock);
        INIT_LIST_HEAD(&qp->rdma_mrs);
        INIT_LIST_HEAD(&qp->sig_mrs);
+       qp->port = 0;
 
        if (qp_init_attr->qp_type == IB_QPT_XRC_TGT)
                return ib_create_xrc_qp(qp, qp_init_attr);
@@ -1297,7 +1298,11 @@ int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
                if (ret)
                        return ret;
        }
-       return ib_security_modify_qp(qp, attr, attr_mask, udata);
+       ret = ib_security_modify_qp(qp, attr, attr_mask, udata);
+       if (!ret && (attr_mask & IB_QP_PORT))
+               qp->port = attr->port_num;
+
+       return ret;
 }
 EXPORT_SYMBOL(ib_modify_qp_with_udata);
 
index ccbf52c8ff6f037a485060e9d78f66c3b7fe79e6..e4b56a0dd6d08ec7eb36dac1e303353f3b0095f7 100644 (file)
@@ -67,8 +67,6 @@ struct mmu_rb_handler {
 
 static unsigned long mmu_node_start(struct mmu_rb_node *);
 static unsigned long mmu_node_last(struct mmu_rb_node *);
-static inline void mmu_notifier_page(struct mmu_notifier *, struct mm_struct *,
-                                    unsigned long);
 static inline void mmu_notifier_range_start(struct mmu_notifier *,
                                            struct mm_struct *,
                                            unsigned long, unsigned long);
@@ -82,7 +80,6 @@ static void do_remove(struct mmu_rb_handler *handler,
 static void handle_remove(struct work_struct *work);
 
 static const struct mmu_notifier_ops mn_opts = {
-       .invalidate_page = mmu_notifier_page,
        .invalidate_range_start = mmu_notifier_range_start,
 };
 
@@ -285,12 +282,6 @@ void hfi1_mmu_rb_remove(struct mmu_rb_handler *handler,
        handler->ops->remove(handler->ops_arg, node);
 }
 
-static inline void mmu_notifier_page(struct mmu_notifier *mn,
-                                    struct mm_struct *mm, unsigned long addr)
-{
-       mmu_notifier_mem_invalidate(mn, mm, addr, addr + PAGE_SIZE);
-}
-
 static inline void mmu_notifier_range_start(struct mmu_notifier *mn,
                                            struct mm_struct *mm,
                                            unsigned long start,
index a7f2e60085c46c2300e3695029fbe1373cc0d480..f7fcde1ff0aae66fef09d6eaccf8f9de6b008ba1 100644 (file)
@@ -1085,6 +1085,12 @@ static int mlx5_ib_modify_port(struct ib_device *ibdev, u8 port, int mask,
        bool is_ib = (mlx5_ib_port_link_layer(ibdev, port) ==
                      IB_LINK_LAYER_INFINIBAND);
 
+       /* CM layer calls ib_modify_port() regardless of the link layer. For
+        * Ethernet ports, qkey violation and Port capabilities are meaningless.
+        */
+       if (!is_ib)
+               return 0;
+
        if (MLX5_CAP_GEN(dev->mdev, ib_virt) && is_ib) {
                change_mask = props->clr_port_cap_mask | props->set_port_cap_mask;
                value = ~props->clr_port_cap_mask | props->set_port_cap_mask;
index 0889ff367c8625f694346136c22bd510d2dea2a7..f58f8f5f3ebe10e8270606327b58440efd70aae3 100644 (file)
@@ -1238,6 +1238,7 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
                        goto err_destroy_tis;
 
                sq->base.container_mibqp = qp;
+               sq->base.mqp.event = mlx5_ib_qp_event;
        }
 
        if (qp->rq.wqe_cnt) {
index 298a6ba51411a2d68795f34b41c380df85fdfbc6..ca0e19ae7a90f0a2854938f926c5d7ece0675686 100644 (file)
@@ -476,10 +476,21 @@ static const u8 xboxone_hori_init[] = {
 };
 
 /*
- * A rumble packet is required for some PowerA pads to start
+ * A specific rumble packet is required for some PowerA pads to start
  * sending input reports. One of those pads is (0x24c6:0x543a).
  */
-static const u8 xboxone_zerorumble_init[] = {
+static const u8 xboxone_rumblebegin_init[] = {
+       0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
+       0x1D, 0x1D, 0xFF, 0x00, 0x00
+};
+
+/*
+ * A rumble packet with zero FF intensity will immediately
+ * terminate the rumbling required to init PowerA pads.
+ * This should happen fast enough that the motors don't
+ * spin up to enough speed to actually vibrate the gamepad.
+ */
+static const u8 xboxone_rumbleend_init[] = {
        0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00
 };
@@ -494,9 +505,12 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
        XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
        XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
        XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
-       XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_zerorumble_init),
-       XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_zerorumble_init),
-       XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_zerorumble_init),
+       XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
+       XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
+       XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
+       XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumbleend_init),
+       XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumbleend_init),
+       XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumbleend_init),
 };
 
 struct xpad_output_packet {
index f600f3a7a3c685488e1ede36058439c59f0703dc..23520df7650f5bc9261c3b58cac22a8dfc27423f 100644 (file)
@@ -331,7 +331,7 @@ static int soc_button_probe(struct platform_device *pdev)
        error = gpiod_count(dev, NULL);
        if (error < 0) {
                dev_dbg(dev, "no GPIO attached, ignoring...\n");
-               return error;
+               return -ENODEV;
        }
 
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
index 262d1057c1da21ba7290c37c0379087d1ff5fa49..850b00e3ad8ecde13046449befa4fad95e308a60 100644 (file)
@@ -1215,14 +1215,24 @@ static int alps_decode_ss4_v2(struct alps_fields *f,
 
        case SS4_PACKET_ID_TWO:
                if (priv->flags & ALPS_BUTTONPAD) {
-                       f->mt[0].x = SS4_BTL_MF_X_V2(p, 0);
+                       if (IS_SS4PLUS_DEV(priv->dev_id)) {
+                               f->mt[0].x = SS4_PLUS_BTL_MF_X_V2(p, 0);
+                               f->mt[1].x = SS4_PLUS_BTL_MF_X_V2(p, 1);
+                       } else {
+                               f->mt[0].x = SS4_BTL_MF_X_V2(p, 0);
+                               f->mt[1].x = SS4_BTL_MF_X_V2(p, 1);
+                       }
                        f->mt[0].y = SS4_BTL_MF_Y_V2(p, 0);
-                       f->mt[1].x = SS4_BTL_MF_X_V2(p, 1);
                        f->mt[1].y = SS4_BTL_MF_Y_V2(p, 1);
                } else {
-                       f->mt[0].x = SS4_STD_MF_X_V2(p, 0);
+                       if (IS_SS4PLUS_DEV(priv->dev_id)) {
+                               f->mt[0].x = SS4_PLUS_STD_MF_X_V2(p, 0);
+                               f->mt[1].x = SS4_PLUS_STD_MF_X_V2(p, 1);
+                       } else {
+                               f->mt[0].x = SS4_STD_MF_X_V2(p, 0);
+                               f->mt[1].x = SS4_STD_MF_X_V2(p, 1);
+                       }
                        f->mt[0].y = SS4_STD_MF_Y_V2(p, 0);
-                       f->mt[1].x = SS4_STD_MF_X_V2(p, 1);
                        f->mt[1].y = SS4_STD_MF_Y_V2(p, 1);
                }
                f->pressure = SS4_MF_Z_V2(p, 0) ? 0x30 : 0;
@@ -1239,16 +1249,27 @@ static int alps_decode_ss4_v2(struct alps_fields *f,
 
        case SS4_PACKET_ID_MULTI:
                if (priv->flags & ALPS_BUTTONPAD) {
-                       f->mt[2].x = SS4_BTL_MF_X_V2(p, 0);
+                       if (IS_SS4PLUS_DEV(priv->dev_id)) {
+                               f->mt[0].x = SS4_PLUS_BTL_MF_X_V2(p, 0);
+                               f->mt[1].x = SS4_PLUS_BTL_MF_X_V2(p, 1);
+                       } else {
+                               f->mt[2].x = SS4_BTL_MF_X_V2(p, 0);
+                               f->mt[3].x = SS4_BTL_MF_X_V2(p, 1);
+                       }
+
                        f->mt[2].y = SS4_BTL_MF_Y_V2(p, 0);
-                       f->mt[3].x = SS4_BTL_MF_X_V2(p, 1);
                        f->mt[3].y = SS4_BTL_MF_Y_V2(p, 1);
                        no_data_x = SS4_MFPACKET_NO_AX_BL;
                        no_data_y = SS4_MFPACKET_NO_AY_BL;
                } else {
-                       f->mt[2].x = SS4_STD_MF_X_V2(p, 0);
+                       if (IS_SS4PLUS_DEV(priv->dev_id)) {
+                               f->mt[0].x = SS4_PLUS_STD_MF_X_V2(p, 0);
+                               f->mt[1].x = SS4_PLUS_STD_MF_X_V2(p, 1);
+                       } else {
+                               f->mt[0].x = SS4_STD_MF_X_V2(p, 0);
+                               f->mt[1].x = SS4_STD_MF_X_V2(p, 1);
+                       }
                        f->mt[2].y = SS4_STD_MF_Y_V2(p, 0);
-                       f->mt[3].x = SS4_STD_MF_X_V2(p, 1);
                        f->mt[3].y = SS4_STD_MF_Y_V2(p, 1);
                        no_data_x = SS4_MFPACKET_NO_AX;
                        no_data_y = SS4_MFPACKET_NO_AY;
@@ -2541,8 +2562,8 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse,
 
        memset(otp, 0, sizeof(otp));
 
-       if (alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0]) ||
-           alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0]))
+       if (alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0]) ||
+           alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0]))
                return -1;
 
        alps_update_device_area_ss4_v2(otp, priv);
index ed2d6879fa529aebc46d946e1b9c7341eee12b03..c80a7c76cb767187c13e18c5104042270886e736 100644 (file)
@@ -100,6 +100,10 @@ enum SS4_PACKET_ID {
                                 ((_b[1 + _i * 3]  << 5) & 0x1F00)      \
                                )
 
+#define SS4_PLUS_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 4) & 0x0070) | \
+                                ((_b[1 + (_i) * 3]  << 4) & 0x0F80)    \
+                               )
+
 #define SS4_STD_MF_Y_V2(_b, _i)        (((_b[1 + (_i) * 3] << 3) & 0x0010) |   \
                                 ((_b[2 + (_i) * 3] << 5) & 0x01E0) |   \
                                 ((_b[2 + (_i) * 3] << 4) & 0x0E00)     \
@@ -109,6 +113,10 @@ enum SS4_PACKET_ID {
                                 ((_b[0 + (_i) * 3] >> 3) & 0x0010)     \
                                )
 
+#define SS4_PLUS_BTL_MF_X_V2(_b, _i) (SS4_PLUS_STD_MF_X_V2(_b, _i) |   \
+                                ((_b[0 + (_i) * 3] >> 4) & 0x0008)     \
+                               )
+
 #define SS4_BTL_MF_Y_V2(_b, _i)        (SS4_STD_MF_Y_V2(_b, _i) | \
                                 ((_b[0 + (_i) * 3] >> 3) & 0x0008)     \
                                )
index 714cf7f9b13859988ca7df9f1fc98a10e0e6fbae..cfbc8ba4c96c7bedda89e1b79f8ee23b5cd36f47 100644 (file)
@@ -1247,6 +1247,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
        { "ELAN0000", 0 },
        { "ELAN0100", 0 },
        { "ELAN0600", 0 },
+       { "ELAN0602", 0 },
        { "ELAN0605", 0 },
        { "ELAN0608", 0 },
        { "ELAN0605", 0 },
index 16c30460ef041b13686db7f6efe36860b725a4bd..5af0b7d200bc23ff0f2287d6e0b69a631fb8bb22 100644 (file)
@@ -535,16 +535,17 @@ static void synaptics_apply_quirks(struct psmouse *psmouse,
        }
 }
 
+static bool synaptics_has_agm(struct synaptics_data *priv)
+{
+       return (SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) ||
+               SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c));
+}
+
 static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse)
 {
        static u8 param = 0xc8;
-       struct synaptics_data *priv = psmouse->private;
        int error;
 
-       if (!(SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) ||
-             SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c)))
-               return 0;
-
        error = psmouse_sliced_command(psmouse, SYN_QUE_MODEL);
        if (error)
                return error;
@@ -553,9 +554,6 @@ static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse)
        if (error)
                return error;
 
-       /* Advanced gesture mode also sends multi finger data */
-       priv->info.capabilities |= BIT(1);
-
        return 0;
 }
 
@@ -578,7 +576,7 @@ static int synaptics_set_mode(struct psmouse *psmouse)
        if (error)
                return error;
 
-       if (priv->absolute_mode) {
+       if (priv->absolute_mode && synaptics_has_agm(priv)) {
                error = synaptics_set_advanced_gesture_mode(psmouse);
                if (error) {
                        psmouse_err(psmouse,
@@ -766,9 +764,7 @@ static int synaptics_parse_hw_state(const u8 buf[],
                         ((buf[0] & 0x04) >> 1) |
                         ((buf[3] & 0x04) >> 2));
 
-               if ((SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) ||
-                       SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c)) &&
-                   hw->w == 2) {
+               if (synaptics_has_agm(priv) && hw->w == 2) {
                        synaptics_parse_agm(buf, priv, hw);
                        return 1;
                }
@@ -1033,6 +1029,15 @@ static void synaptics_image_sensor_process(struct psmouse *psmouse,
        synaptics_report_mt_data(psmouse, sgm, num_fingers);
 }
 
+static bool synaptics_has_multifinger(struct synaptics_data *priv)
+{
+       if (SYN_CAP_MULTIFINGER(priv->info.capabilities))
+               return true;
+
+       /* Advanced gesture mode also sends multi finger data */
+       return synaptics_has_agm(priv);
+}
+
 /*
  *  called for each full received packet from the touchpad
  */
@@ -1079,7 +1084,7 @@ static void synaptics_process_packet(struct psmouse *psmouse)
                if (SYN_CAP_EXTENDED(info->capabilities)) {
                        switch (hw.w) {
                        case 0 ... 1:
-                               if (SYN_CAP_MULTIFINGER(info->capabilities))
+                               if (synaptics_has_multifinger(priv))
                                        num_fingers = hw.w + 2;
                                break;
                        case 2:
@@ -1123,7 +1128,7 @@ static void synaptics_process_packet(struct psmouse *psmouse)
                input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
 
        input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
-       if (SYN_CAP_MULTIFINGER(info->capabilities)) {
+       if (synaptics_has_multifinger(priv)) {
                input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2);
                input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3);
        }
@@ -1283,7 +1288,7 @@ static void set_input_params(struct psmouse *psmouse,
        __set_bit(BTN_TOUCH, dev->keybit);
        __set_bit(BTN_TOOL_FINGER, dev->keybit);
 
-       if (SYN_CAP_MULTIFINGER(info->capabilities)) {
+       if (synaptics_has_multifinger(priv)) {
                __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
                __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
        }
index 20b5b21c1bba8892f37aab4a0190dfd6352b72d1..0871010f18d5f449e6440a5e41f71d24b8aecfd2 100644 (file)
@@ -265,7 +265,8 @@ static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *fir
        if (ps2_command(&psmouse->ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID)))
                return -1;
 
-       if (param[0] != TP_MAGIC_IDENT)
+       /* add new TP ID. */
+       if (!(param[0] & TP_MAGIC_IDENT))
                return -1;
 
        if (firmware_id)
index 5617ed3a7d7a15d0f9769086afb8c740b5739fcc..88055755f82e2304a5f7438bc59cb7f47f488823 100644 (file)
@@ -21,8 +21,9 @@
 #define TP_COMMAND             0xE2    /* Commands start with this */
 
 #define TP_READ_ID             0xE1    /* Sent for device identification */
-#define TP_MAGIC_IDENT         0x01    /* Sent after a TP_READ_ID followed */
+#define TP_MAGIC_IDENT         0x03    /* Sent after a TP_READ_ID followed */
                                        /* by the firmware ID */
+                                       /* Firmware ID includes 0x1, 0x2, 0x3 */
 
 
 /*
index 294a409e283b7ae4b52c59350756983711bba9d1..d6b873b57054b44d2f0227630798cda83a637256 100644 (file)
@@ -574,7 +574,9 @@ struct amd_iommu {
 
 static inline struct amd_iommu *dev_to_amd_iommu(struct device *dev)
 {
-       return container_of(dev, struct amd_iommu, iommu.dev);
+       struct iommu_device *iommu = dev_to_iommu_device(dev);
+
+       return container_of(iommu, struct amd_iommu, iommu);
 }
 
 #define ACPIHID_UID_LEN 256
index 6629c472eafd828bb45a9e7fe3a4260c2e199de2..dccf5b76eff24bc1bdd82397d2fd516c9226fae2 100644 (file)
@@ -391,13 +391,6 @@ static int mn_clear_flush_young(struct mmu_notifier *mn,
        return 0;
 }
 
-static void mn_invalidate_page(struct mmu_notifier *mn,
-                              struct mm_struct *mm,
-                              unsigned long address)
-{
-       __mn_flush_page(mn, address);
-}
-
 static void mn_invalidate_range(struct mmu_notifier *mn,
                                struct mm_struct *mm,
                                unsigned long start, unsigned long end)
@@ -436,7 +429,6 @@ static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm)
 static const struct mmu_notifier_ops iommu_mn = {
        .release                = mn_release,
        .clear_flush_young      = mn_clear_flush_young,
-       .invalidate_page        = mn_invalidate_page,
        .invalidate_range       = mn_invalidate_range,
 };
 
index 687f18f65cea58d2a5f22725a2c36c78621dd3cd..3e8636f1220ea9bdbcf668bac193e21cee408063 100644 (file)
@@ -4736,7 +4736,9 @@ static void intel_disable_iommus(void)
 
 static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev)
 {
-       return container_of(dev, struct intel_iommu, iommu.dev);
+       struct iommu_device *iommu_dev = dev_to_iommu_device(dev);
+
+       return container_of(iommu_dev, struct intel_iommu, iommu);
 }
 
 static ssize_t intel_iommu_show_version(struct device *dev,
index f167c0d84ebfb7f5937eb798c9cdbd8bd9abe6c6..f620dccec8ee3d9782b3c1322984e3b26078722a 100644 (file)
@@ -223,14 +223,6 @@ static void intel_change_pte(struct mmu_notifier *mn, struct mm_struct *mm,
        intel_flush_svm_range(svm, address, 1, 1, 0);
 }
 
-static void intel_invalidate_page(struct mmu_notifier *mn, struct mm_struct *mm,
-                                 unsigned long address)
-{
-       struct intel_svm *svm = container_of(mn, struct intel_svm, notifier);
-
-       intel_flush_svm_range(svm, address, 1, 1, 0);
-}
-
 /* Pages have been freed at this point */
 static void intel_invalidate_range(struct mmu_notifier *mn,
                                   struct mm_struct *mm,
@@ -285,7 +277,6 @@ static void intel_mm_release(struct mmu_notifier *mn, struct mm_struct *mm)
 static const struct mmu_notifier_ops intel_mmuops = {
        .release = intel_mm_release,
        .change_pte = intel_change_pte,
-       .invalidate_page = intel_invalidate_page,
        .invalidate_range = intel_invalidate_range,
 };
 
index c58351ed61c14309c7a72346bd56f659a7039637..36d1a7ce7fc4cc922cade9642b5d64c05e5d8e19 100644 (file)
@@ -62,32 +62,40 @@ int iommu_device_sysfs_add(struct iommu_device *iommu,
        va_list vargs;
        int ret;
 
-       device_initialize(&iommu->dev);
+       iommu->dev = kzalloc(sizeof(*iommu->dev), GFP_KERNEL);
+       if (!iommu->dev)
+               return -ENOMEM;
 
-       iommu->dev.class = &iommu_class;
-       iommu->dev.parent = parent;
-       iommu->dev.groups = groups;
+       device_initialize(iommu->dev);
+
+       iommu->dev->class = &iommu_class;
+       iommu->dev->parent = parent;
+       iommu->dev->groups = groups;
 
        va_start(vargs, fmt);
-       ret = kobject_set_name_vargs(&iommu->dev.kobj, fmt, vargs);
+       ret = kobject_set_name_vargs(&iommu->dev->kobj, fmt, vargs);
        va_end(vargs);
        if (ret)
                goto error;
 
-       ret = device_add(&iommu->dev);
+       ret = device_add(iommu->dev);
        if (ret)
                goto error;
 
+       dev_set_drvdata(iommu->dev, iommu);
+
        return 0;
 
 error:
-       put_device(&iommu->dev);
+       put_device(iommu->dev);
        return ret;
 }
 
 void iommu_device_sysfs_remove(struct iommu_device *iommu)
 {
-       device_unregister(&iommu->dev);
+       dev_set_drvdata(iommu->dev, NULL);
+       device_unregister(iommu->dev);
+       iommu->dev = NULL;
 }
 /*
  * IOMMU drivers can indicate a device is managed by a given IOMMU using
@@ -102,14 +110,14 @@ int iommu_device_link(struct iommu_device *iommu, struct device *link)
        if (!iommu || IS_ERR(iommu))
                return -ENODEV;
 
-       ret = sysfs_add_link_to_group(&iommu->dev.kobj, "devices",
+       ret = sysfs_add_link_to_group(&iommu->dev->kobj, "devices",
                                      &link->kobj, dev_name(link));
        if (ret)
                return ret;
 
-       ret = sysfs_create_link_nowarn(&link->kobj, &iommu->dev.kobj, "iommu");
+       ret = sysfs_create_link_nowarn(&link->kobj, &iommu->dev->kobj, "iommu");
        if (ret)
-               sysfs_remove_link_from_group(&iommu->dev.kobj, "devices",
+               sysfs_remove_link_from_group(&iommu->dev->kobj, "devices",
                                             dev_name(link));
 
        return ret;
@@ -121,5 +129,5 @@ void iommu_device_unlink(struct iommu_device *iommu, struct device *link)
                return;
 
        sysfs_remove_link(&link->kobj, "iommu");
-       sysfs_remove_link_from_group(&iommu->dev.kobj, "devices", dev_name(link));
+       sysfs_remove_link_from_group(&iommu->dev->kobj, "devices", dev_name(link));
 }
index 0e8ab5bb3575fccf24a5734d1f5fe8149210b6aa..d24e4b05f5dacefe5c0528b0ff3b75444bb216e6 100644 (file)
@@ -504,7 +504,6 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
                if (queue_dying) {
                        atomic_inc(&m->pg_init_in_progress);
                        activate_or_offline_path(pgpath);
-                       return DM_MAPIO_REQUEUE;
                }
                return DM_MAPIO_DELAY_REQUEUE;
        }
@@ -1458,7 +1457,6 @@ static int noretry_error(blk_status_t error)
        case BLK_STS_TARGET:
        case BLK_STS_NEXUS:
        case BLK_STS_MEDIUM:
-       case BLK_STS_RESOURCE:
                return 1;
        }
 
index 2edbcc2d7d3f6274b689447859470d2773ea4e3b..d669fddd9290d027a39fa2e65b01b0a1b24afc0a 100644 (file)
 
 #define DM_MSG_PREFIX "core"
 
-#ifdef CONFIG_PRINTK
-/*
- * ratelimit state to be used in DMXXX_LIMIT().
- */
-DEFINE_RATELIMIT_STATE(dm_ratelimit_state,
-                      DEFAULT_RATELIMIT_INTERVAL,
-                      DEFAULT_RATELIMIT_BURST);
-EXPORT_SYMBOL(dm_ratelimit_state);
-#endif
-
 /*
  * Cookies are numeric values sent with CHANGE and REMOVE
  * uevents while resuming, removing or renaming the device.
@@ -1523,7 +1513,7 @@ static void __split_and_process_bio(struct mapped_device *md,
        }
 
        /* drop the extra reference count */
-       dec_pending(ci.io, error);
+       dec_pending(ci.io, errno_to_blk_status(error));
 }
 /*-----------------------------------------------------------------
  * CRUD END
index 99e644cda4d13db301b713a5752788c0f646dfa1..ebf69ff48ae2656594b0840fb7bd8a917e159406 100644 (file)
@@ -72,7 +72,7 @@ struct atmel_smc_timing_xlate {
        { .name = nm, .converter = atmel_smc_cs_conf_set_pulse, .shift = pos}
 
 #define ATMEL_SMC_CYCLE_XLATE(nm, pos) \
-       { .name = nm, .converter = atmel_smc_cs_conf_set_setup, .shift = pos}
+       { .name = nm, .converter = atmel_smc_cs_conf_set_cycle, .shift = pos}
 
 static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
                                    struct atmel_ebi_dev_config *conf)
@@ -120,12 +120,14 @@ static int atmel_ebi_xslate_smc_timings(struct atmel_ebi_dev *ebid,
        if (!ret) {
                required = true;
                ncycles = DIV_ROUND_UP(val, clk_period_ns);
-               if (ncycles > ATMEL_SMC_MODE_TDF_MAX ||
-                   ncycles < ATMEL_SMC_MODE_TDF_MIN) {
+               if (ncycles > ATMEL_SMC_MODE_TDF_MAX) {
                        ret = -EINVAL;
                        goto out;
                }
 
+               if (ncycles < ATMEL_SMC_MODE_TDF_MIN)
+                       ncycles = ATMEL_SMC_MODE_TDF_MIN;
+
                smcconf->mode |= ATMEL_SMC_MODE_TDF(ncycles);
        }
 
@@ -263,7 +265,7 @@ static int atmel_ebi_xslate_smc_config(struct atmel_ebi_dev *ebid,
        }
 
        ret = atmel_ebi_xslate_smc_timings(ebid, np, &conf->smcconf);
-       if (ret)
+       if (ret < 0)
                return -EINVAL;
 
        if ((ret > 0 && !required) || (!ret && required)) {
index 954cf0f66a31fa87b5be4e8cf4c4f81691980c0a..20cc0ea470fae22053584554e096ce31fad06275 100644 (file)
@@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_set_pulse);
  *          parameter
  *
  * This function encodes the @ncycles value as described in the datasheet
- * (section "SMC Pulse Register"), and then stores the result in the
+ * (section "SMC Cycle Register"), and then stores the result in the
  * @conf->setup field at @shift position.
  *
  * Returns -EINVAL if @shift is invalid, -ERANGE if @ncycles does not fit in
index fbe0f245ce8ee50943340de1c05d6490a3a13ced..fe1811523e4a7aac70e0498e7cd70fac55e2046b 100644 (file)
@@ -644,6 +644,9 @@ static const struct regmap_range da9062_aa_readable_ranges[] = {
        }, {
                .range_min = DA9062AA_VLDO1_B,
                .range_max = DA9062AA_VLDO4_B,
+       }, {
+               .range_min = DA9062AA_BBAT_CONT,
+               .range_max = DA9062AA_BBAT_CONT,
        }, {
                .range_min = DA9062AA_INTERFACE,
                .range_max = DA9062AA_CONFIG_E,
@@ -720,6 +723,9 @@ static const struct regmap_range da9062_aa_writeable_ranges[] = {
        }, {
                .range_min = DA9062AA_VLDO1_B,
                .range_max = DA9062AA_VLDO4_B,
+       }, {
+               .range_min = DA9062AA_BBAT_CONT,
+               .range_max = DA9062AA_BBAT_CONT,
        }, {
                .range_min = DA9062AA_GP_ID_0,
                .range_max = DA9062AA_GP_ID_19,
index 64d5760d069ab3887682e5358f009c9a4767b374..63d6246d6dff3caf8b6f7099257f902d50d2de20 100644 (file)
@@ -200,16 +200,6 @@ static void scif_mmu_notifier_release(struct mmu_notifier *mn,
        schedule_work(&scif_info.misc_work);
 }
 
-static void scif_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
-                                             struct mm_struct *mm,
-                                             unsigned long address)
-{
-       struct scif_mmu_notif   *mmn;
-
-       mmn = container_of(mn, struct scif_mmu_notif, ep_mmu_notifier);
-       scif_rma_destroy_tcw(mmn, address, PAGE_SIZE);
-}
-
 static void scif_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
                                                     struct mm_struct *mm,
                                                     unsigned long start,
@@ -235,7 +225,6 @@ static void scif_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
 static const struct mmu_notifier_ops scif_mmu_notifier_ops = {
        .release = scif_mmu_notifier_release,
        .clear_flush_young = NULL,
-       .invalidate_page = scif_mmu_notifier_invalidate_page,
        .invalidate_range_start = scif_mmu_notifier_invalidate_range_start,
        .invalidate_range_end = scif_mmu_notifier_invalidate_range_end};
 
index e936d43895d2579965c9a8d6127cc9111c9cc716..9918eda0e05f649882b8db5f0828db2e3bcfe31e 100644 (file)
@@ -247,17 +247,6 @@ static void gru_invalidate_range_end(struct mmu_notifier *mn,
        gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx\n", gms, start, end);
 }
 
-static void gru_invalidate_page(struct mmu_notifier *mn, struct mm_struct *mm,
-                               unsigned long address)
-{
-       struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
-                                                ms_notifier);
-
-       STAT(mmu_invalidate_page);
-       gru_flush_tlb_range(gms, address, PAGE_SIZE);
-       gru_dbg(grudev, "gms %p, address 0x%lx\n", gms, address);
-}
-
 static void gru_release(struct mmu_notifier *mn, struct mm_struct *mm)
 {
        struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
@@ -269,7 +258,6 @@ static void gru_release(struct mmu_notifier *mn, struct mm_struct *mm)
 
 
 static const struct mmu_notifier_ops gru_mmuops = {
-       .invalidate_page        = gru_invalidate_page,
        .invalidate_range_start = gru_invalidate_range_start,
        .invalidate_range_end   = gru_invalidate_range_end,
        .release                = gru_release,
index f1bbfd389367ff4530137be199c4063c65f97f5c..8bd7aba811e969a3b7cfdc6cf12e685f25e8c37e 100644 (file)
@@ -1213,7 +1213,7 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req)
                break;
        }
        mq_rq->drv_op_result = ret;
-       blk_end_request_all(req, ret);
+       blk_end_request_all(req, ret ? BLK_STS_IOERR : BLK_STS_OK);
 }
 
 static void mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
@@ -1371,12 +1371,46 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq,
         R1_CC_ERROR |          /* Card controller error */             \
         R1_ERROR)              /* General/unknown error */
 
-static bool mmc_blk_has_cmd_err(struct mmc_command *cmd)
+static void mmc_blk_eval_resp_error(struct mmc_blk_request *brq)
 {
-       if (!cmd->error && cmd->resp[0] & CMD_ERRORS)
-               cmd->error = -EIO;
+       u32 val;
+
+       /*
+        * Per the SD specification(physical layer version 4.10)[1],
+        * section 4.3.3, it explicitly states that "When the last
+        * block of user area is read using CMD18, the host should
+        * ignore OUT_OF_RANGE error that may occur even the sequence
+        * is correct". And JESD84-B51 for eMMC also has a similar
+        * statement on section 6.8.3.
+        *
+        * Multiple block read/write could be done by either predefined
+        * method, namely CMD23, or open-ending mode. For open-ending mode,
+        * we should ignore the OUT_OF_RANGE error as it's normal behaviour.
+        *
+        * However the spec[1] doesn't tell us whether we should also
+        * ignore that for predefined method. But per the spec[1], section
+        * 4.15 Set Block Count Command, it says"If illegal block count
+        * is set, out of range error will be indicated during read/write
+        * operation (For example, data transfer is stopped at user area
+        * boundary)." In another word, we could expect a out of range error
+        * in the response for the following CMD18/25. And if argument of
+        * CMD23 + the argument of CMD18/25 exceed the max number of blocks,
+        * we could also expect to get a -ETIMEDOUT or any error number from
+        * the host drivers due to missing data response(for write)/data(for
+        * read), as the cards will stop the data transfer by itself per the
+        * spec. So we only need to check R1_OUT_OF_RANGE for open-ending mode.
+        */
 
-       return cmd->error;
+       if (!brq->stop.error) {
+               bool oor_with_open_end;
+               /* If there is no error yet, check R1 response */
+
+               val = brq->stop.resp[0] & CMD_ERRORS;
+               oor_with_open_end = val & R1_OUT_OF_RANGE && !brq->mrq.sbc;
+
+               if (val && !oor_with_open_end)
+                       brq->stop.error = -EIO;
+       }
 }
 
 static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card,
@@ -1400,8 +1434,11 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card,
         * stop.error indicates a problem with the stop command.  Data
         * may have been transferred, or may still be transferring.
         */
-       if (brq->sbc.error || brq->cmd.error || mmc_blk_has_cmd_err(&brq->stop) ||
-           brq->data.error) {
+
+       mmc_blk_eval_resp_error(brq);
+
+       if (brq->sbc.error || brq->cmd.error ||
+           brq->stop.error || brq->data.error) {
                switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err, &gen_err)) {
                case ERR_RETRY:
                        return MMC_BLK_RETRY;
@@ -1681,9 +1718,9 @@ static bool mmc_blk_rw_cmd_err(struct mmc_blk_data *md, struct mmc_card *card,
                if (err)
                        req_pending = old_req_pending;
                else
-                       req_pending = blk_end_request(req, 0, blocks << 9);
+                       req_pending = blk_end_request(req, BLK_STS_OK, blocks << 9);
        } else {
-               req_pending = blk_end_request(req, 0, brq->data.bytes_xfered);
+               req_pending = blk_end_request(req, BLK_STS_OK, brq->data.bytes_xfered);
        }
        return req_pending;
 }
index bc1781bb070b7b8b83c0132abb114f6905ffddfb..c580af05b033a1f596f4335d90a1e56f84c6903e 100644 (file)
@@ -210,8 +210,27 @@ static void xenon_set_uhs_signaling(struct sdhci_host *host,
        sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
 }
 
+static void xenon_set_power(struct sdhci_host *host, unsigned char mode,
+               unsigned short vdd)
+{
+       struct mmc_host *mmc = host->mmc;
+       u8 pwr = host->pwr;
+
+       sdhci_set_power_noreg(host, mode, vdd);
+
+       if (host->pwr == pwr)
+               return;
+
+       if (host->pwr == 0)
+               vdd = 0;
+
+       if (!IS_ERR(mmc->supply.vmmc))
+               mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+}
+
 static const struct sdhci_ops sdhci_xenon_ops = {
        .set_clock              = sdhci_set_clock,
+       .set_power              = xenon_set_power,
        .set_bus_width          = sdhci_set_bus_width,
        .reset                  = xenon_reset,
        .set_uhs_signaling      = xenon_set_uhs_signaling,
index 2c8baa0c2c4e11f2b5d1c39d4c3ad795d634135a..ceec21bd30c4fc5c49ad4c4bdbfe9bd031005809 100644 (file)
@@ -1364,7 +1364,18 @@ static int atmel_smc_nand_prepare_smcconf(struct atmel_nand *nand,
        ret = atmel_smc_cs_conf_set_timing(smcconf,
                                           ATMEL_HSMC_TIMINGS_TADL_SHIFT,
                                           ncycles);
-       if (ret)
+       /*
+        * Version 4 of the ONFI spec mandates that tADL be at least 400
+        * nanoseconds, but, depending on the master clock rate, 400 ns may not
+        * fit in the tADL field of the SMC reg. We need to relax the check and
+        * accept the -ERANGE return code.
+        *
+        * Note that previous versions of the ONFI spec had a lower tADL_min
+        * (100 or 200 ns). It's not clear why this timing constraint got
+        * increased but it seems most NANDs are fine with values lower than
+        * 400ns, so we should be safe.
+        */
+       if (ret && ret != -ERANGE)
                return ret;
 
        ncycles = DIV_ROUND_UP(conf->timings.sdr.tAR_min, mckperiodps);
index 03a0d057bf2f80b3ea4c3f397eb1f607697aad3c..e4211c3cc49b2ac054a080fd34d83db56f9556da 100644 (file)
@@ -2373,6 +2373,7 @@ static int __init ns_init_module(void)
         return 0;
 
 err_exit:
+       nandsim_debugfs_remove(nand);
        free_nandsim(nand);
        nand_release(nsmtd);
        for (i = 0;i < ARRAY_SIZE(nand->partitions); ++i)
index 9a03c5871efe675015418e6f5e1ebd1745faaac0..f58d8e3053236ad4608e5552052214b0694a3a95 100644 (file)
@@ -924,10 +924,8 @@ out1:
                ntb_free_mw(nt, i);
 
        /* if there's an actual failure, we should just bail */
-       if (rc < 0) {
-               ntb_link_disable(ndev);
+       if (rc < 0)
                return;
-       }
 
 out:
        if (ntb_link_is_up(ndev, NULL, NULL) == 1)
@@ -1059,7 +1057,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
        int node;
        int rc, i;
 
-       mw_count = ntb_mw_count(ndev, PIDX);
+       mw_count = ntb_peer_mw_count(ndev);
 
        if (!ndev->ops->mw_set_trans) {
                dev_err(&ndev->dev, "Inbound MW based NTB API is required\n");
index f002bf48a08dbefd0602532bc6d2f1dbf4f68a3a..a69815c45ce6f2137d9f409bad0b8742fa530df4 100644 (file)
@@ -959,7 +959,7 @@ static int tool_probe(struct ntb_client *self, struct ntb_dev *ntb)
        tc->ntb = ntb;
        init_waitqueue_head(&tc->link_wq);
 
-       tc->mw_count = min(ntb_mw_count(tc->ntb, PIDX), MAX_MWS);
+       tc->mw_count = min(ntb_peer_mw_count(tc->ntb), MAX_MWS);
        for (i = 0; i < tc->mw_count; i++) {
                rc = tool_init_mw(tc, i);
                if (rc)
index 925467b31a333940dc62d62c4c5f3376316e4120..ea892e732268fe37bd4ea0c52b6d89fa055b691d 100644 (file)
@@ -109,6 +109,7 @@ struct nvme_dev {
        /* host memory buffer support: */
        u64 host_mem_size;
        u32 nr_host_mem_descs;
+       dma_addr_t host_mem_descs_dma;
        struct nvme_host_mem_buf_desc *host_mem_descs;
        void **host_mem_desc_bufs;
 };
@@ -1565,16 +1566,10 @@ static inline void nvme_release_cmb(struct nvme_dev *dev)
 
 static int nvme_set_host_mem(struct nvme_dev *dev, u32 bits)
 {
-       size_t len = dev->nr_host_mem_descs * sizeof(*dev->host_mem_descs);
+       u64 dma_addr = dev->host_mem_descs_dma;
        struct nvme_command c;
-       u64 dma_addr;
        int ret;
 
-       dma_addr = dma_map_single(dev->dev, dev->host_mem_descs, len,
-                       DMA_TO_DEVICE);
-       if (dma_mapping_error(dev->dev, dma_addr))
-               return -ENOMEM;
-
        memset(&c, 0, sizeof(c));
        c.features.opcode       = nvme_admin_set_features;
        c.features.fid          = cpu_to_le32(NVME_FEAT_HOST_MEM_BUF);
@@ -1591,7 +1586,6 @@ static int nvme_set_host_mem(struct nvme_dev *dev, u32 bits)
                         "failed to set host mem (err %d, flags %#x).\n",
                         ret, bits);
        }
-       dma_unmap_single(dev->dev, dma_addr, len, DMA_TO_DEVICE);
        return ret;
 }
 
@@ -1609,7 +1603,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev)
 
        kfree(dev->host_mem_desc_bufs);
        dev->host_mem_desc_bufs = NULL;
-       kfree(dev->host_mem_descs);
+       dma_free_coherent(dev->dev,
+                       dev->nr_host_mem_descs * sizeof(*dev->host_mem_descs),
+                       dev->host_mem_descs, dev->host_mem_descs_dma);
        dev->host_mem_descs = NULL;
 }
 
@@ -1617,6 +1613,7 @@ static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
 {
        struct nvme_host_mem_buf_desc *descs;
        u32 chunk_size, max_entries, len;
+       dma_addr_t descs_dma;
        int i = 0;
        void **bufs;
        u64 size = 0, tmp;
@@ -1627,7 +1624,8 @@ retry:
        tmp = (preferred + chunk_size - 1);
        do_div(tmp, chunk_size);
        max_entries = tmp;
-       descs = kcalloc(max_entries, sizeof(*descs), GFP_KERNEL);
+       descs = dma_zalloc_coherent(dev->dev, max_entries * sizeof(*descs),
+                       &descs_dma, GFP_KERNEL);
        if (!descs)
                goto out;
 
@@ -1661,6 +1659,7 @@ retry:
        dev->nr_host_mem_descs = i;
        dev->host_mem_size = size;
        dev->host_mem_descs = descs;
+       dev->host_mem_descs_dma = descs_dma;
        dev->host_mem_desc_bufs = bufs;
        return 0;
 
@@ -1674,7 +1673,8 @@ out_free_bufs:
 
        kfree(bufs);
 out_free_descs:
-       kfree(descs);
+       dma_free_coherent(dev->dev, max_entries * sizeof(*descs), descs,
+                       descs_dma);
 out:
        /* try a smaller chunk size if we failed early */
        if (chunk_size >= PAGE_SIZE * 2 && (i == 0 || size < min)) {
index da04df1af231758cb4965735c417a215d736ec94..a03299d779229de271eb28704a73515f1020ffe1 100644 (file)
@@ -920,7 +920,11 @@ static int nvme_rdma_map_sg_fr(struct nvme_rdma_queue *queue,
        struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl;
        int nr;
 
-       nr = ib_map_mr_sg(req->mr, req->sg_table.sgl, count, NULL, PAGE_SIZE);
+       /*
+        * Align the MR to a 4K page size to match the ctrl page size and
+        * the block virtual boundary.
+        */
+       nr = ib_map_mr_sg(req->mr, req->sg_table.sgl, count, NULL, SZ_4K);
        if (nr < count) {
                if (nr < 0)
                        return nr;
@@ -1583,7 +1587,7 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl)
                goto out_cleanup_queue;
 
        ctrl->ctrl.max_hw_sectors =
-               (ctrl->max_fr_pages - 1) << (PAGE_SHIFT - 9);
+               (ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9);
 
        error = nvme_init_identify(&ctrl->ctrl);
        if (error)
index 253d92409bb3930b3348fd91037aa0df2355ce9c..2225afc1cbbb76a39c516230a58c8e8752b568f9 100644 (file)
@@ -538,12 +538,9 @@ msi_setup_entry(struct pci_dev *dev, int nvec, const struct irq_affinity *affd)
        struct msi_desc *entry;
        u16 control;
 
-       if (affd) {
+       if (affd)
                masks = irq_create_affinity_masks(nvec, affd);
-               if (!masks)
-                       dev_err(&dev->dev, "can't allocate MSI affinity masks for %d vectors\n",
-                               nvec);
-       }
+
 
        /* MSI Entry Initialization */
        entry = alloc_msi_entry(&dev->dev, nvec, masks);
@@ -679,12 +676,8 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
        struct msi_desc *entry;
        int ret, i;
 
-       if (affd) {
+       if (affd)
                masks = irq_create_affinity_masks(nvec, affd);
-               if (!masks)
-                       dev_err(&dev->dev, "can't allocate MSI-X affinity masks for %d vectors\n",
-                               nvec);
-       }
 
        for (i = 0, curmsk = masks; i < nvec; i++) {
                entry = alloc_msi_entry(&dev->dev, 1, curmsk);
index ba6ac83a6c2500c874f6a64518e72398bf5d52cb..5ccfdc80d0ec942d2e4dde4113830ab9eb2ba735 100644 (file)
@@ -481,7 +481,7 @@ static int ccwchain_fetch_tic(struct ccwchain *chain,
                ccw_tail = ccw_head + (iter->ch_len - 1) * sizeof(struct ccw1);
 
                if ((ccw_head <= ccw->cda) && (ccw->cda <= ccw_tail)) {
-                       ccw->cda = (__u32) (addr_t) (iter->ch_ccw +
+                       ccw->cda = (__u32) (addr_t) (((char *)iter->ch_ccw) +
                                                     (ccw->cda - ccw_head));
                        return 0;
                }
index f4538d7a3016e2b1514df38c9e6e9b48939d6ce7..d145e0d9022755d476f8f48c22ea9c3a62377e28 100644 (file)
@@ -47,6 +47,17 @@ config SCSI_NETLINK
        default n
        depends on NET
 
+config SCSI_MQ_DEFAULT
+       bool "SCSI: use blk-mq I/O path by default"
+       depends on SCSI
+       ---help---
+         This option enables the new blk-mq based I/O path for SCSI
+         devices by default.  With the option the scsi_mod.use_blk_mq
+         module/boot option defaults to Y, without it to N, but it can
+         still be overridden either way.
+
+         If unsure say N.
+
 config SCSI_PROC_FS
        bool "legacy /proc/scsi/ support"
        depends on SCSI && PROC_FS
index 4591113c49de3af951908ed2257f6f5e88663b96..a1a2c71e162651f93d499c56e024e7073cc7fc79 100644 (file)
@@ -549,7 +549,9 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
        if ((le32_to_cpu(get_name_reply->status) == CT_OK)
         && (get_name_reply->data[0] != '\0')) {
                char *sp = get_name_reply->data;
-               sp[sizeof(((struct aac_get_name_resp *)NULL)->data)] = '\0';
+               int data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);
+
+               sp[data_size - 1] = '\0';
                while (*sp == ' ')
                        ++sp;
                if (*sp) {
@@ -579,12 +581,15 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
 static int aac_get_container_name(struct scsi_cmnd * scsicmd)
 {
        int status;
+       int data_size;
        struct aac_get_name *dinfo;
        struct fib * cmd_fibcontext;
        struct aac_dev * dev;
 
        dev = (struct aac_dev *)scsicmd->device->host->hostdata;
 
+       data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);
+
        cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);
 
        aac_fib_init(cmd_fibcontext);
@@ -593,7 +598,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
        dinfo->command = cpu_to_le32(VM_ContainerConfig);
        dinfo->type = cpu_to_le32(CT_READ_NAME);
        dinfo->cid = cpu_to_le32(scmd_id(scsicmd));
-       dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data));
+       dinfo->count = cpu_to_le32(data_size - 1);
 
        status = aac_fib_send(ContainerCommand,
                  cmd_fibcontext,
index d31a9bc2ba69abdcf6cd6c6c8e6d99229ae50e4a..ee2667e20e4239f9129ebe21e7983a2428065b88 100644 (file)
@@ -2274,7 +2274,7 @@ struct aac_get_name_resp {
        __le32          parm3;
        __le32          parm4;
        __le32          parm5;
-       u8              data[16];
+       u8              data[17];
 };
 
 #define CT_CID_TO_32BITS_UID 165
index 2029ad225121162bddfec4ffcce7e38a940385f3..5be0086142cac6991598cd9099522212709a216c 100644 (file)
@@ -3845,8 +3845,10 @@ csio_hw_start(struct csio_hw *hw)
 
        if (csio_is_hw_ready(hw))
                return 0;
-       else
+       else if (csio_match_state(hw, csio_hws_uninit))
                return -EINVAL;
+       else
+               return -ENODEV;
 }
 
 int
index ea0c31086cc6b8b44517c8fcd34a44fb6c93fad9..dcd074169aa9b7794850c7034a1208353ba17266 100644 (file)
@@ -969,10 +969,14 @@ static int csio_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        pci_set_drvdata(pdev, hw);
 
-       if (csio_hw_start(hw) != 0) {
-               dev_err(&pdev->dev,
-                       "Failed to start FW, continuing in debug mode.\n");
-               return 0;
+       rv = csio_hw_start(hw);
+       if (rv) {
+               if (rv == -EINVAL) {
+                       dev_err(&pdev->dev,
+                               "Failed to start FW, continuing in debug mode.\n");
+                       return 0;
+               }
+               goto err_lnode_exit;
        }
 
        sprintf(hw->fwrev_str, "%u.%u.%u.%u\n",
index a69a9ac836f5d13c37d5220ecbb2711d588c4c35..1d02cf9fe06c5e941e5d1a76254f86ce658fc04b 100644 (file)
@@ -1635,6 +1635,9 @@ static int init_act_open(struct cxgbi_sock *csk)
                goto rel_resource;
        }
 
+       if (!(n->nud_state & NUD_VALID))
+               neigh_event_send(n, NULL);
+
        csk->atid = cxgb4_alloc_atid(lldi->tids, csk);
        if (csk->atid < 0) {
                pr_err("%s, NO atid available.\n", ndev->name);
index da5bdbdcce527262489cae939761b9cf1834eeb0..f838bd73befa8f3b2fe915b8bbbe1990c563de1f 100644 (file)
@@ -4945,6 +4945,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
                }
                if (ipr_is_vset_device(res)) {
                        sdev->scsi_level = SCSI_SPC_3;
+                       sdev->no_report_opcodes = 1;
                        blk_queue_rq_timeout(sdev->request_queue,
                                             IPR_VSET_RW_TIMEOUT);
                        blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
index 316c3df0c3fd80f9689499f0351082703772707f..71c4746341ea379e3881d32cf3078f135d15f999 100644 (file)
@@ -6228,8 +6228,8 @@ static int megasas_probe_one(struct pci_dev *pdev,
 fail_start_aen:
 fail_io_attach:
        megasas_mgmt_info.count--;
-       megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
        megasas_mgmt_info.max_index--;
+       megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
 
        instance->instancet->disable_intr(instance);
        megasas_destroy_irqs(instance);
index eb07f1de8afa5316be9c038b881d076327c36bb3..59c18ca4cda98e59285853d14e93c1a79a80f3f0 100644 (file)
@@ -489,7 +489,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
 
        /* If a SRR times out, simply free resources */
        if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO)
-               goto out_free;
+               goto out_put;
 
        /* Normalize response data into struct fc_frame */
        mp_req = &(srr_req->mp_req);
@@ -501,7 +501,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
        if (!fp) {
                QEDF_ERR(&(qedf->dbg_ctx),
                    "fc_frame_alloc failure.\n");
-               goto out_free;
+               goto out_put;
        }
 
        /* Copy frame header from firmware into fp */
@@ -526,9 +526,10 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
        }
 
        fc_frame_free(fp);
-out_free:
+out_put:
        /* Put reference for original command since SRR completed */
        kref_put(&orig_io_req->refcount, qedf_release_cmd);
+out_free:
        kfree(cb_arg);
 }
 
@@ -780,7 +781,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
 
        /* If a REC times out, free resources */
        if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO)
-               goto out_free;
+               goto out_put;
 
        /* Normalize response data into struct fc_frame */
        mp_req = &(rec_req->mp_req);
@@ -792,7 +793,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
        if (!fp) {
                QEDF_ERR(&(qedf->dbg_ctx),
                    "fc_frame_alloc failure.\n");
-               goto out_free;
+               goto out_put;
        }
 
        /* Copy frame header from firmware into fp */
@@ -884,9 +885,10 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
 
 out_free_frame:
        fc_frame_free(fp);
-out_free:
+out_put:
        /* Put reference for original command since REC completed */
        kref_put(&orig_io_req->refcount, qedf_release_cmd);
+out_free:
        kfree(cb_arg);
 }
 
index 3d38c6d463b810f19fe2cbdd3dc69801465cd05a..1bf274e3b2b614b5331f4a082668e660ceba74e7 100644 (file)
@@ -800,7 +800,11 @@ MODULE_LICENSE("GPL");
 module_param(scsi_logging_level, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(scsi_logging_level, "a bit mask of logging levels");
 
+#ifdef CONFIG_SCSI_MQ_DEFAULT
 bool scsi_use_blk_mq = true;
+#else
+bool scsi_use_blk_mq = false;
+#endif
 module_param_named(use_blk_mq, scsi_use_blk_mq, bool, S_IWUSR | S_IRUGO);
 
 static int __init init_scsi(void)
index bea36adeee178ab57bced3591b0969bc2d973264..e2647f2d44304b0ded65ebb0f55d629c7289d0b7 100644 (file)
@@ -1277,6 +1277,9 @@ static void sd_uninit_command(struct scsi_cmnd *SCpnt)
 {
        struct request *rq = SCpnt->request;
 
+       if (SCpnt->flags & SCMD_ZONE_WRITE_LOCK)
+               sd_zbc_write_unlock_zone(SCpnt);
+
        if (rq->rq_flags & RQF_SPECIAL_PAYLOAD)
                __free_page(rq->special_vec.bv_page);
 
index 96855df9f49ddf3756b8fc6ee98b127727d9bbeb..8aa54779aac1b4e6112d86dc536dd14b1522d6eb 100644 (file)
@@ -294,6 +294,9 @@ int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd)
            test_and_set_bit(zno, sdkp->zones_wlock))
                return BLKPREP_DEFER;
 
+       WARN_ON_ONCE(cmd->flags & SCMD_ZONE_WRITE_LOCK);
+       cmd->flags |= SCMD_ZONE_WRITE_LOCK;
+
        return BLKPREP_OK;
 }
 
@@ -302,9 +305,10 @@ void sd_zbc_write_unlock_zone(struct scsi_cmnd *cmd)
        struct request *rq = cmd->request;
        struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 
-       if (sdkp->zones_wlock) {
+       if (sdkp->zones_wlock && cmd->flags & SCMD_ZONE_WRITE_LOCK) {
                unsigned int zno = sd_zbc_zone_no(sdkp, blk_rq_pos(rq));
                WARN_ON_ONCE(!test_bit(zno, sdkp->zones_wlock));
+               cmd->flags &= ~SCMD_ZONE_WRITE_LOCK;
                clear_bit_unlock(zno, sdkp->zones_wlock);
                smp_mb__after_atomic();
        }
@@ -335,9 +339,6 @@ void sd_zbc_complete(struct scsi_cmnd *cmd,
        case REQ_OP_WRITE_ZEROES:
        case REQ_OP_WRITE_SAME:
 
-               /* Unlock the zone */
-               sd_zbc_write_unlock_zone(cmd);
-
                if (result &&
                    sshdr->sense_key == ILLEGAL_REQUEST &&
                    sshdr->asc == 0x21)
index d7ff71e0c85c6ecd525d0d59d3f3f0da63952b47..84e782d8e7c3f0cb8dd4c3bdedb46b7060b18f1e 100644 (file)
@@ -1021,7 +1021,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
                        read_lock_irqsave(&sfp->rq_list_lock, iflags);
                        val = 0;
                        list_for_each_entry(srp, &sfp->rq_list, entry) {
-                               if (val > SG_MAX_QUEUE)
+                               if (val >= SG_MAX_QUEUE)
                                        break;
                                memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
                                rinfo[val].req_state = srp->done + 1;
index 279e7c5551dd55588fa95fee7547ea8a945ab58d..39225de9d7f1455e43d2ac6279193a68e5518562 100644 (file)
@@ -745,6 +745,9 @@ void *knav_pool_create(const char *name,
        bool slot_found;
        int ret;
 
+       if (!kdev)
+               return ERR_PTR(-EPROBE_DEFER);
+
        if (!kdev->dev)
                return ERR_PTR(-ENODEV);
 
index b37a6f48225f5209999d54f338635b9b027ab967..8ea3920400a06b6a43e8456375fb6fae2b20577f 100644 (file)
@@ -16,9 +16,9 @@
 
 static bool __must_check fsl_mc_is_allocatable(const char *obj_type)
 {
-       return strcmp(obj_type, "dpbp") ||
-              strcmp(obj_type, "dpmcp") ||
-              strcmp(obj_type, "dpcon");
+       return strcmp(obj_type, "dpbp") == 0 ||
+              strcmp(obj_type, "dpmcp") == 0 ||
+              strcmp(obj_type, "dpcon") == 0;
 }
 
 /**
index d283341cfe4356914e3e9071f8d6851a7a180d46..56cd4e5e51b2f99906b5a7170854ea57629f5f34 100644 (file)
@@ -45,6 +45,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
        {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */
        {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */
        {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
+       {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */
        {}      /* Terminating entry */
 };
 
index 1fc80ea87c13c05bcda2a1cb5daf1c3a8d611024..a6d5164c33a9ca7e3d02bbda7fc94ff783d75929 100644 (file)
@@ -69,13 +69,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 #ifdef CONFIG_UNIX98_PTYS
                if (tty->driver == ptm_driver) {
                        mutex_lock(&devpts_mutex);
-                       if (tty->link->driver_data) {
-                               struct path *path = tty->link->driver_data;
-
-                               devpts_pty_kill(path->dentry);
-                               path_put(path);
-                               kfree(path);
-                       }
+                       if (tty->link->driver_data)
+                               devpts_pty_kill(tty->link->driver_data);
                        mutex_unlock(&devpts_mutex);
                }
 #endif
@@ -607,25 +602,24 @@ static inline void legacy_pty_init(void) { }
 static struct cdev ptmx_cdev;
 
 /**
- *     pty_open_peer - open the peer of a pty
- *     @tty: the peer of the pty being opened
+ *     ptm_open_peer - open the peer of a pty
+ *     @master: the open struct file of the ptmx device node
+ *     @tty: the master of the pty being opened
+ *     @flags: the flags for open
  *
- *     Open the cached dentry in tty->link, providing a safe way for userspace
- *     to get the slave end of a pty (where they have the master fd and cannot
- *     access or trust the mount namespace /dev/pts was mounted inside).
+ *     Provide a race free way for userspace to open the slave end of a pty
+ *     (where they have the master fd and cannot access or trust the mount
+ *     namespace /dev/pts was mounted inside).
  */
-static struct file *pty_open_peer(struct tty_struct *tty, int flags)
-{
-       if (tty->driver->subtype != PTY_TYPE_MASTER)
-               return ERR_PTR(-EIO);
-       return dentry_open(tty->link->driver_data, flags, current_cred());
-}
-
-static int pty_get_peer(struct tty_struct *tty, int flags)
+int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
 {
        int fd = -1;
-       struct file *filp = NULL;
+       struct file *filp;
        int retval = -EINVAL;
+       struct path path;
+
+       if (tty->driver != ptm_driver)
+               return -EIO;
 
        fd = get_unused_fd_flags(0);
        if (fd < 0) {
@@ -633,7 +627,16 @@ static int pty_get_peer(struct tty_struct *tty, int flags)
                goto err;
        }
 
-       filp = pty_open_peer(tty, flags);
+       /* Compute the slave's path */
+       path.mnt = devpts_mntget(master, tty->driver_data);
+       if (IS_ERR(path.mnt)) {
+               retval = PTR_ERR(path.mnt);
+               goto err_put;
+       }
+       path.dentry = tty->link->driver_data;
+
+       filp = dentry_open(&path, flags, current_cred());
+       mntput(path.mnt);
        if (IS_ERR(filp)) {
                retval = PTR_ERR(filp);
                goto err_put;
@@ -662,8 +665,6 @@ static int pty_unix98_ioctl(struct tty_struct *tty,
                return pty_get_pktmode(tty, (int __user *)arg);
        case TIOCGPTN: /* Get PT Number */
                return put_user(tty->index, (unsigned int __user *)arg);
-       case TIOCGPTPEER: /* Open the other end */
-               return pty_get_peer(tty, (int) arg);
        case TIOCSIG:    /* Send signal to other side of pty */
                return pty_signal(tty, (int) arg);
        }
@@ -791,9 +792,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
 {
        struct pts_fs_info *fsi;
        struct tty_struct *tty;
-       struct path *pts_path;
        struct dentry *dentry;
-       struct vfsmount *mnt;
        int retval;
        int index;
 
@@ -806,7 +805,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
        if (retval)
                return retval;
 
-       fsi = devpts_acquire(filp, &mnt);
+       fsi = devpts_acquire(filp);
        if (IS_ERR(fsi)) {
                retval = PTR_ERR(fsi);
                goto out_free_file;
@@ -846,28 +845,17 @@ static int ptmx_open(struct inode *inode, struct file *filp)
                retval = PTR_ERR(dentry);
                goto err_release;
        }
-       /* We need to cache a fake path for TIOCGPTPEER. */
-       pts_path = kmalloc(sizeof(struct path), GFP_KERNEL);
-       if (!pts_path)
-               goto err_release;
-       pts_path->mnt = mnt;
-       pts_path->dentry = dentry;
-       path_get(pts_path);
-       tty->link->driver_data = pts_path;
+       tty->link->driver_data = dentry;
 
        retval = ptm_driver->ops->open(tty, filp);
        if (retval)
-               goto err_path_put;
+               goto err_release;
 
        tty_debug_hangup(tty, "opening (count=%d)\n", tty->count);
 
        tty_unlock(tty);
        return 0;
-err_path_put:
-       path_put(pts_path);
-       kfree(pts_path);
 err_release:
-       mntput(mnt);
        tty_unlock(tty);
        // This will also put-ref the fsi
        tty_release(inode, filp);
@@ -876,7 +864,6 @@ out:
        devpts_kill_index(fsi, index);
 out_put_fsi:
        devpts_release(fsi);
-       mntput(mnt);
 out_free_file:
        tty_free_file(filp);
        return retval;
index 974b13d244010de234d0350b9c45425251ff99c6..10c4038c0e8dfe9d07b7fd5f02732de03cc4ed3e 100644 (file)
@@ -2518,6 +2518,9 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case TIOCSSERIAL:
                tty_warn_deprecated_flags(p);
                break;
+       case TIOCGPTPEER:
+               /* Special because the struct file is needed */
+               return ptm_open_peer(file, tty, (int)arg);
        default:
                retval = tty_jobctrl_ioctl(tty, real_tty, file, cmd, arg);
                if (retval != -ENOIOCTLCMD)
index 007a4f3660862e1aa6e9a16207ae54bbbab61d58..1c4797e53f686b03323e4316d443c256854268dc 100644 (file)
@@ -107,6 +107,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
 {
        struct virtio_pci_device *vp_dev = to_vp_device(vdev);
        const char *name = dev_name(&vp_dev->vdev.dev);
+       unsigned flags = PCI_IRQ_MSIX;
        unsigned i, v;
        int err = -ENOMEM;
 
@@ -126,10 +127,13 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
                                        GFP_KERNEL))
                        goto error;
 
+       if (desc) {
+               flags |= PCI_IRQ_AFFINITY;
+               desc->pre_vectors++; /* virtio config vector */
+       }
+
        err = pci_alloc_irq_vectors_affinity(vp_dev->pci_dev, nvectors,
-                                            nvectors, PCI_IRQ_MSIX |
-                                            (desc ? PCI_IRQ_AFFINITY : 0),
-                                            desc);
+                                            nvectors, flags, desc);
        if (err < 0)
                goto error;
        vp_dev->msix_enabled = 1;
index 8feab810aed9222b97bd5959b42e6f09ffaaf83d..7f188b8d0c6703dda0ed4ae7647d7b082c429933 100644 (file)
@@ -7,9 +7,6 @@ obj-y   += xenbus/
 nostackp := $(call cc-option, -fno-stack-protector)
 CFLAGS_features.o                      := $(nostackp)
 
-CFLAGS_efi.o                           += -fshort-wchar
-LDFLAGS                                        += $(call ld-option, --no-wchar-size-warning)
-
 dom0-$(CONFIG_ARM64) += arm-device.o
 dom0-$(CONFIG_PCI) += pci.o
 dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
index f3bf8f4e2d6cef09101b53aa9f1a69563b206287..82360594fa8e49bcbad179a6bb349564286cf203 100644 (file)
@@ -484,13 +484,6 @@ static void mn_invl_range_start(struct mmu_notifier *mn,
        mutex_unlock(&priv->lock);
 }
 
-static void mn_invl_page(struct mmu_notifier *mn,
-                        struct mm_struct *mm,
-                        unsigned long address)
-{
-       mn_invl_range_start(mn, mm, address, address + PAGE_SIZE);
-}
-
 static void mn_release(struct mmu_notifier *mn,
                       struct mm_struct *mm)
 {
@@ -522,7 +515,6 @@ static void mn_release(struct mmu_notifier *mn,
 
 static const struct mmu_notifier_ops gntdev_mmu_ops = {
        .release                = mn_release,
-       .invalidate_page        = mn_invl_page,
        .invalidate_range_start = mn_invl_range_start,
 };
 
index 080e2ebb8aa0137baef69edda45aa895bf8b7c7c..f45b61fe9a9ab8d54d87e98ab494e29cedd2e0ab 100644 (file)
@@ -3516,7 +3516,7 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device)
        struct bio *bio = device->flush_bio;
 
        if (!device->flush_bio_sent)
-               return 0;
+               return BLK_STS_OK;
 
        device->flush_bio_sent = 0;
        wait_for_completion_io(&device->flush_wait);
@@ -3563,7 +3563,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
                        continue;
 
                write_dev_flush(dev);
-               dev->last_flush_error = 0;
+               dev->last_flush_error = BLK_STS_OK;
        }
 
        /* wait for all the barriers */
index 95c212037095fea727f4a35ea19d9d7e54ad8cfe..24bcd5cd9cf2fc680cc7ed32fb58cd254bb055b5 100644 (file)
@@ -7924,11 +7924,12 @@ err:
        return ret;
 }
 
-static inline int submit_dio_repair_bio(struct inode *inode, struct bio *bio,
-                                       int mirror_num)
+static inline blk_status_t submit_dio_repair_bio(struct inode *inode,
+                                                struct bio *bio,
+                                                int mirror_num)
 {
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-       int ret;
+       blk_status_t ret;
 
        BUG_ON(bio_op(bio) == REQ_OP_WRITE);
 
@@ -7980,10 +7981,10 @@ static int btrfs_check_dio_repairable(struct inode *inode,
        return 1;
 }
 
-static int dio_read_error(struct inode *inode, struct bio *failed_bio,
-                       struct page *page, unsigned int pgoff,
-                       u64 start, u64 end, int failed_mirror,
-                       bio_end_io_t *repair_endio, void *repair_arg)
+static blk_status_t dio_read_error(struct inode *inode, struct bio *failed_bio,
+                                  struct page *page, unsigned int pgoff,
+                                  u64 start, u64 end, int failed_mirror,
+                                  bio_end_io_t *repair_endio, void *repair_arg)
 {
        struct io_failure_record *failrec;
        struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
@@ -7993,18 +7994,19 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
        int read_mode = 0;
        int segs;
        int ret;
+       blk_status_t status;
 
        BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
 
        ret = btrfs_get_io_failure_record(inode, start, end, &failrec);
        if (ret)
-               return ret;
+               return errno_to_blk_status(ret);
 
        ret = btrfs_check_dio_repairable(inode, failed_bio, failrec,
                                         failed_mirror);
        if (!ret) {
                free_io_failure(failure_tree, io_tree, failrec);
-               return -EIO;
+               return BLK_STS_IOERR;
        }
 
        segs = bio_segments(failed_bio);
@@ -8022,13 +8024,13 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
                    "Repair DIO Read Error: submitting new dio read[%#x] to this_mirror=%d, in_validation=%d\n",
                    read_mode, failrec->this_mirror, failrec->in_validation);
 
-       ret = submit_dio_repair_bio(inode, bio, failrec->this_mirror);
-       if (ret) {
+       status = submit_dio_repair_bio(inode, bio, failrec->this_mirror);
+       if (status) {
                free_io_failure(failure_tree, io_tree, failrec);
                bio_put(bio);
        }
 
-       return ret;
+       return status;
 }
 
 struct btrfs_retry_complete {
@@ -8065,8 +8067,8 @@ end:
        bio_put(bio);
 }
 
-static int __btrfs_correct_data_nocsum(struct inode *inode,
-                                      struct btrfs_io_bio *io_bio)
+static blk_status_t __btrfs_correct_data_nocsum(struct inode *inode,
+                                               struct btrfs_io_bio *io_bio)
 {
        struct btrfs_fs_info *fs_info;
        struct bio_vec bvec;
@@ -8076,8 +8078,8 @@ static int __btrfs_correct_data_nocsum(struct inode *inode,
        unsigned int pgoff;
        u32 sectorsize;
        int nr_sectors;
-       int ret;
-       int err = 0;
+       blk_status_t ret;
+       blk_status_t err = BLK_STS_OK;
 
        fs_info = BTRFS_I(inode)->root->fs_info;
        sectorsize = fs_info->sectorsize;
@@ -8183,11 +8185,12 @@ static blk_status_t __btrfs_subio_endio_read(struct inode *inode,
        int csum_pos;
        bool uptodate = (err == 0);
        int ret;
+       blk_status_t status;
 
        fs_info = BTRFS_I(inode)->root->fs_info;
        sectorsize = fs_info->sectorsize;
 
-       err = 0;
+       err = BLK_STS_OK;
        start = io_bio->logical;
        done.inode = inode;
        io_bio->bio.bi_iter = io_bio->iter;
@@ -8209,12 +8212,12 @@ try_again:
                done.start = start;
                init_completion(&done.done);
 
-               ret = dio_read_error(inode, &io_bio->bio, bvec.bv_page,
-                               pgoff, start, start + sectorsize - 1,
-                               io_bio->mirror_num,
-                               btrfs_retry_endio, &done);
-               if (ret) {
-                       err = errno_to_blk_status(ret);
+               status = dio_read_error(inode, &io_bio->bio, bvec.bv_page,
+                                       pgoff, start, start + sectorsize - 1,
+                                       io_bio->mirror_num, btrfs_retry_endio,
+                                       &done);
+               if (status) {
+                       err = status;
                        goto next;
                }
 
@@ -8250,7 +8253,7 @@ static blk_status_t btrfs_subio_endio_read(struct inode *inode,
                if (unlikely(err))
                        return __btrfs_correct_data_nocsum(inode, io_bio);
                else
-                       return 0;
+                       return BLK_STS_OK;
        } else {
                return __btrfs_subio_endio_read(inode, io_bio, err);
        }
@@ -8423,9 +8426,9 @@ static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode,
        return 0;
 }
 
-static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,
-                                        u64 file_offset, int skip_sum,
-                                        int async_submit)
+static inline blk_status_t
+__btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, u64 file_offset,
+                      int skip_sum, int async_submit)
 {
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        struct btrfs_dio_private *dip = bio->bi_private;
@@ -8488,6 +8491,7 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip,
        int clone_offset = 0;
        int clone_len;
        int ret;
+       blk_status_t status;
 
        map_length = orig_bio->bi_iter.bi_size;
        submit_len = map_length;
@@ -8537,9 +8541,9 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip,
                 */
                atomic_inc(&dip->pending_bios);
 
-               ret = __btrfs_submit_dio_bio(bio, inode, file_offset, skip_sum,
-                                            async_submit);
-               if (ret) {
+               status = __btrfs_submit_dio_bio(bio, inode, file_offset, skip_sum,
+                                               async_submit);
+               if (status) {
                        bio_put(bio);
                        atomic_dec(&dip->pending_bios);
                        goto out_err;
@@ -8557,9 +8561,9 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip,
        } while (submit_len > 0);
 
 submit:
-       ret = __btrfs_submit_dio_bio(bio, inode, file_offset, skip_sum,
-                                    async_submit);
-       if (!ret)
+       status = __btrfs_submit_dio_bio(bio, inode, file_offset, skip_sum,
+                                       async_submit);
+       if (!status)
                return 0;
 
        bio_put(bio);
index 208638384cd2abfb1206b2f5927b5763a6330283..2cf6ba40f7c441bb3483f9c543e1e17bbcea1971 100644 (file)
@@ -905,7 +905,7 @@ static void raid_write_end_io(struct bio *bio)
        if (!atomic_dec_and_test(&rbio->stripes_pending))
                return;
 
-       err = 0;
+       err = BLK_STS_OK;
 
        /* OK, we have read all the stripes we need to. */
        max_errors = (rbio->operation == BTRFS_RBIO_PARITY_SCRUB) ?
@@ -1324,7 +1324,7 @@ write_data:
        return;
 
 cleanup:
-       rbio_orig_end_io(rbio, -EIO);
+       rbio_orig_end_io(rbio, BLK_STS_IOERR);
 }
 
 /*
@@ -1475,7 +1475,7 @@ static void raid_rmw_end_io(struct bio *bio)
 
 cleanup:
 
-       rbio_orig_end_io(rbio, -EIO);
+       rbio_orig_end_io(rbio, BLK_STS_IOERR);
 }
 
 static void async_rmw_stripe(struct btrfs_raid_bio *rbio)
@@ -1579,7 +1579,7 @@ static int raid56_rmw_stripe(struct btrfs_raid_bio *rbio)
        return 0;
 
 cleanup:
-       rbio_orig_end_io(rbio, -EIO);
+       rbio_orig_end_io(rbio, BLK_STS_IOERR);
        return -EIO;
 
 finish:
@@ -1795,12 +1795,12 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)
        void **pointers;
        int faila = -1, failb = -1;
        struct page *page;
-       int err;
+       blk_status_t err;
        int i;
 
        pointers = kcalloc(rbio->real_stripes, sizeof(void *), GFP_NOFS);
        if (!pointers) {
-               err = -ENOMEM;
+               err = BLK_STS_RESOURCE;
                goto cleanup_io;
        }
 
@@ -1856,7 +1856,7 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)
                                         * a bad data or Q stripe.
                                         * TODO, we should redo the xor here.
                                         */
-                                       err = -EIO;
+                                       err = BLK_STS_IOERR;
                                        goto cleanup;
                                }
                                /*
@@ -1882,7 +1882,7 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)
                        if (rbio->bbio->raid_map[failb] == RAID6_Q_STRIPE) {
                                if (rbio->bbio->raid_map[faila] ==
                                    RAID5_P_STRIPE) {
-                                       err = -EIO;
+                                       err = BLK_STS_IOERR;
                                        goto cleanup;
                                }
                                /*
@@ -1954,13 +1954,13 @@ pstripe:
                }
        }
 
-       err = 0;
+       err = BLK_STS_OK;
 cleanup:
        kfree(pointers);
 
 cleanup_io:
        if (rbio->operation == BTRFS_RBIO_READ_REBUILD) {
-               if (err == 0)
+               if (err == BLK_STS_OK)
                        cache_rbio_pages(rbio);
                else
                        clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags);
@@ -1968,7 +1968,7 @@ cleanup_io:
                rbio_orig_end_io(rbio, err);
        } else if (rbio->operation == BTRFS_RBIO_REBUILD_MISSING) {
                rbio_orig_end_io(rbio, err);
-       } else if (err == 0) {
+       } else if (err == BLK_STS_OK) {
                rbio->faila = -1;
                rbio->failb = -1;
 
@@ -2005,7 +2005,7 @@ static void raid_recover_end_io(struct bio *bio)
                return;
 
        if (atomic_read(&rbio->error) > rbio->bbio->max_errors)
-               rbio_orig_end_io(rbio, -EIO);
+               rbio_orig_end_io(rbio, BLK_STS_IOERR);
        else
                __raid_recover_end_io(rbio);
 }
@@ -2104,7 +2104,7 @@ out:
 cleanup:
        if (rbio->operation == BTRFS_RBIO_READ_REBUILD ||
            rbio->operation == BTRFS_RBIO_REBUILD_MISSING)
-               rbio_orig_end_io(rbio, -EIO);
+               rbio_orig_end_io(rbio, BLK_STS_IOERR);
        return -EIO;
 }
 
@@ -2431,7 +2431,7 @@ submit_write:
        nr_data = bio_list_size(&bio_list);
        if (!nr_data) {
                /* Every parity is right */
-               rbio_orig_end_io(rbio, 0);
+               rbio_orig_end_io(rbio, BLK_STS_OK);
                return;
        }
 
@@ -2451,7 +2451,7 @@ submit_write:
        return;
 
 cleanup:
-       rbio_orig_end_io(rbio, -EIO);
+       rbio_orig_end_io(rbio, BLK_STS_IOERR);
 }
 
 static inline int is_data_stripe(struct btrfs_raid_bio *rbio, int stripe)
@@ -2519,7 +2519,7 @@ static void validate_rbio_for_parity_scrub(struct btrfs_raid_bio *rbio)
        return;
 
 cleanup:
-       rbio_orig_end_io(rbio, -EIO);
+       rbio_orig_end_io(rbio, BLK_STS_IOERR);
 }
 
 /*
@@ -2633,7 +2633,7 @@ static void raid56_parity_scrub_stripe(struct btrfs_raid_bio *rbio)
        return;
 
 cleanup:
-       rbio_orig_end_io(rbio, -EIO);
+       rbio_orig_end_io(rbio, BLK_STS_IOERR);
        return;
 
 finish:
index e8b9a269fddec78fdf42adec32eabaffdf9c3636..bd679bc7a1a956cfc541fcb2a74ed4b49b815642 100644 (file)
@@ -6212,8 +6212,8 @@ static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical)
        }
 }
 
-int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
-                 int mirror_num, int async_submit)
+blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
+                          int mirror_num, int async_submit)
 {
        struct btrfs_device *dev;
        struct bio *first_bio = bio;
@@ -6233,7 +6233,7 @@ int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
                                &map_length, &bbio, mirror_num, 1);
        if (ret) {
                btrfs_bio_counter_dec(fs_info);
-               return ret;
+               return errno_to_blk_status(ret);
        }
 
        total_devs = bbio->num_stripes;
@@ -6256,7 +6256,7 @@ int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
                }
 
                btrfs_bio_counter_dec(fs_info);
-               return ret;
+               return errno_to_blk_status(ret);
        }
 
        if (map_length < length) {
@@ -6283,7 +6283,7 @@ int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
                                  dev_nr, async_submit);
        }
        btrfs_bio_counter_dec(fs_info);
-       return 0;
+       return BLK_STS_OK;
 }
 
 struct btrfs_device *btrfs_find_device(struct btrfs_fs_info *fs_info, u64 devid,
index 6f45fd60d15a92d7aea7a5711bb365a201cb09f9..93277fc60930561a7ffb8c40d2e4ae61ce5908a0 100644 (file)
@@ -74,7 +74,7 @@ struct btrfs_device {
        int missing;
        int can_discard;
        int is_tgtdev_for_dev_replace;
-       int last_flush_error;
+       blk_status_t last_flush_error;
        int flush_bio_sent;
 
 #ifdef __BTRFS_NEED_DEVICE_DATA_ORDERED
@@ -416,8 +416,8 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
                      struct btrfs_fs_info *fs_info, u64 type);
 void btrfs_mapping_init(struct btrfs_mapping_tree *tree);
 void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree);
-int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
-                 int mirror_num, int async_submit);
+blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
+                          int mirror_num, int async_submit);
 int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
                       fmode_t flags, void *holder);
 int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
index 50836280a6f8a3a2d1a82d3c00f3f274e5844f7e..1bc709fe330a13bd51963aa39fe827f6ff70ace9 100644 (file)
@@ -189,7 +189,7 @@ static int ceph_releasepage(struct page *page, gfp_t g)
 /*
  * read a single page, without unlocking it.
  */
-static int readpage_nounlock(struct file *filp, struct page *page)
+static int ceph_do_readpage(struct file *filp, struct page *page)
 {
        struct inode *inode = file_inode(filp);
        struct ceph_inode_info *ci = ceph_inode(inode);
@@ -219,7 +219,7 @@ static int readpage_nounlock(struct file *filp, struct page *page)
 
        err = ceph_readpage_from_fscache(inode, page);
        if (err == 0)
-               goto out;
+               return -EINPROGRESS;
 
        dout("readpage inode %p file %p page %p index %lu\n",
             inode, filp, page, page->index);
@@ -249,8 +249,11 @@ out:
 
 static int ceph_readpage(struct file *filp, struct page *page)
 {
-       int r = readpage_nounlock(filp, page);
-       unlock_page(page);
+       int r = ceph_do_readpage(filp, page);
+       if (r != -EINPROGRESS)
+               unlock_page(page);
+       else
+               r = 0;
        return r;
 }
 
@@ -1237,7 +1240,7 @@ retry_locked:
                        goto retry_locked;
                r = writepage_nounlock(page, NULL);
                if (r < 0)
-                       goto fail_nosnap;
+                       goto fail_unlock;
                goto retry_locked;
        }
 
@@ -1265,11 +1268,14 @@ retry_locked:
        }
 
        /* we need to read it. */
-       r = readpage_nounlock(file, page);
-       if (r < 0)
-               goto fail_nosnap;
+       r = ceph_do_readpage(file, page);
+       if (r < 0) {
+               if (r == -EINPROGRESS)
+                       return -EAGAIN;
+               goto fail_unlock;
+       }
        goto retry_locked;
-fail_nosnap:
+fail_unlock:
        unlock_page(page);
        return r;
 }
index fd1172823f8621b6701e91172a0f0f83c2bb3f5c..337f88673ed9f71a83ea39080bdcd726eb116a15 100644 (file)
@@ -297,13 +297,7 @@ void ceph_fscache_file_set_cookie(struct inode *inode, struct file *filp)
        }
 }
 
-static void ceph_vfs_readpage_complete(struct page *page, void *data, int error)
-{
-       if (!error)
-               SetPageUptodate(page);
-}
-
-static void ceph_vfs_readpage_complete_unlock(struct page *page, void *data, int error)
+static void ceph_readpage_from_fscache_complete(struct page *page, void *data, int error)
 {
        if (!error)
                SetPageUptodate(page);
@@ -331,7 +325,7 @@ int ceph_readpage_from_fscache(struct inode *inode, struct page *page)
                return -ENOBUFS;
 
        ret = fscache_read_or_alloc_page(ci->fscache, page,
-                                        ceph_vfs_readpage_complete, NULL,
+                                        ceph_readpage_from_fscache_complete, NULL,
                                         GFP_KERNEL);
 
        switch (ret) {
@@ -360,7 +354,7 @@ int ceph_readpages_from_fscache(struct inode *inode,
                return -ENOBUFS;
 
        ret = fscache_read_or_alloc_pages(ci->fscache, mapping, pages, nr_pages,
-                                         ceph_vfs_readpage_complete_unlock,
+                                         ceph_readpage_from_fscache_complete,
                                          NULL, mapping_gfp_mask(mapping));
 
        switch (ret) {
index 56366e9840769dd8a45250ec3a7b65097c979ff9..e702d48bd023411f3bbed69c6cc6a571f2fc059c 100644 (file)
@@ -194,15 +194,20 @@ cifs_bp_rename_retry:
 }
 
 /*
+ * Don't allow path components longer than the server max.
  * Don't allow the separator character in a path component.
  * The VFS will not allow "/", but "\" is allowed by posix.
  */
 static int
-check_name(struct dentry *direntry)
+check_name(struct dentry *direntry, struct cifs_tcon *tcon)
 {
        struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
        int i;
 
+       if (unlikely(direntry->d_name.len >
+                    le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength)))
+               return -ENAMETOOLONG;
+
        if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) {
                for (i = 0; i < direntry->d_name.len; i++) {
                        if (direntry->d_name.name[i] == '\\') {
@@ -500,10 +505,6 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
                return finish_no_open(file, res);
        }
 
-       rc = check_name(direntry);
-       if (rc)
-               return rc;
-
        xid = get_xid();
 
        cifs_dbg(FYI, "parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
@@ -516,6 +517,11 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
        }
 
        tcon = tlink_tcon(tlink);
+
+       rc = check_name(direntry, tcon);
+       if (rc)
+               goto out_free_xid;
+
        server = tcon->ses->server;
 
        if (server->ops->new_lease_key)
@@ -776,7 +782,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
        }
        pTcon = tlink_tcon(tlink);
 
-       rc = check_name(direntry);
+       rc = check_name(direntry, pTcon);
        if (rc)
                goto lookup_out;
 
index 5fb2fc2d0080b6e62fd0ad10e1a9c90c08308f2d..97edb4d376cd40e1e6044ed6b5ff7072e0d1b10c 100644 (file)
@@ -3219,8 +3219,8 @@ copy_fs_info_to_kstatfs(struct smb2_fs_full_size_info *pfs_inf,
        kst->f_bsize = le32_to_cpu(pfs_inf->BytesPerSector) *
                          le32_to_cpu(pfs_inf->SectorsPerAllocationUnit);
        kst->f_blocks = le64_to_cpu(pfs_inf->TotalAllocationUnits);
-       kst->f_bfree  = le64_to_cpu(pfs_inf->ActualAvailableAllocationUnits);
-       kst->f_bavail = le64_to_cpu(pfs_inf->CallerAvailableAllocationUnits);
+       kst->f_bfree  = kst->f_bavail =
+                       le64_to_cpu(pfs_inf->CallerAvailableAllocationUnits);
        return;
 }
 
index 18700fd25a0b3f6ceebce14d59716dc4cf2d3cb0..2826882c81d14f138b393824fac9c9091311cd1f 100644 (file)
@@ -84,8 +84,8 @@
 
 #define NUMBER_OF_SMB2_COMMANDS        0x0013
 
-/* BB FIXME - analyze following length BB */
-#define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */
+/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */
+#define MAX_SMB2_HDR_SIZE 0x00b0
 
 #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe)
 #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)
index 306c2b603fb8aa8845558a2bf8226523e5282cdb..ab925dc6647ac764c5a2620a9ef21c53305f90dc 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -646,11 +646,10 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping,
        pte_t pte, *ptep = NULL;
        pmd_t *pmdp = NULL;
        spinlock_t *ptl;
-       bool changed;
 
        i_mmap_lock_read(mapping);
        vma_interval_tree_foreach(vma, &mapping->i_mmap, index, index) {
-               unsigned long address;
+               unsigned long address, start, end;
 
                cond_resched();
 
@@ -658,8 +657,13 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping,
                        continue;
 
                address = pgoff_address(index, vma);
-               changed = false;
-               if (follow_pte_pmd(vma->vm_mm, address, &ptep, &pmdp, &ptl))
+
+               /*
+                * Note because we provide start/end to follow_pte_pmd it will
+                * call mmu_notifier_invalidate_range_start() on our behalf
+                * before taking any lock.
+                */
+               if (follow_pte_pmd(vma->vm_mm, address, &start, &end, &ptep, &pmdp, &ptl))
                        continue;
 
                if (pmdp) {
@@ -676,7 +680,7 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping,
                        pmd = pmd_wrprotect(pmd);
                        pmd = pmd_mkclean(pmd);
                        set_pmd_at(vma->vm_mm, address, pmdp, pmd);
-                       changed = true;
+                       mmu_notifier_invalidate_range(vma->vm_mm, start, end);
 unlock_pmd:
                        spin_unlock(ptl);
 #endif
@@ -691,13 +695,12 @@ unlock_pmd:
                        pte = pte_wrprotect(pte);
                        pte = pte_mkclean(pte);
                        set_pte_at(vma->vm_mm, address, ptep, pte);
-                       changed = true;
+                       mmu_notifier_invalidate_range(vma->vm_mm, start, end);
 unlock_pte:
                        pte_unmap_unlock(ptep, ptl);
                }
 
-               if (changed)
-                       mmu_notifier_invalidate_page(vma->vm_mm, address);
+               mmu_notifier_invalidate_range_end(vma->vm_mm, start, end);
        }
        i_mmap_unlock_read(mapping);
 }
@@ -1383,6 +1386,16 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf,
 
        trace_dax_pmd_fault(inode, vmf, max_pgoff, 0);
 
+       /*
+        * Make sure that the faulting address's PMD offset (color) matches
+        * the PMD offset from the start of the file.  This is necessary so
+        * that a PMD range in the page table overlaps exactly with a PMD
+        * range in the radix tree.
+        */
+       if ((vmf->pgoff & PG_PMD_COLOUR) !=
+           ((vmf->address >> PAGE_SHIFT) & PG_PMD_COLOUR))
+               goto fallback;
+
        /* Fall back to PTEs if we're going to COW */
        if (write && !(vma->vm_flags & VM_SHARED))
                goto fallback;
index 44dfbca9306f04c29081354cc232b8e9b590bb21..7eae33ffa3fcc1d709790b79225521472c6f8281 100644 (file)
@@ -133,7 +133,51 @@ static inline struct pts_fs_info *DEVPTS_SB(struct super_block *sb)
        return sb->s_fs_info;
 }
 
-struct pts_fs_info *devpts_acquire(struct file *filp, struct vfsmount **ptsmnt)
+static int devpts_ptmx_path(struct path *path)
+{
+       struct super_block *sb;
+       int err;
+
+       /* Has the devpts filesystem already been found? */
+       if (path->mnt->mnt_sb->s_magic == DEVPTS_SUPER_MAGIC)
+               return 0;
+
+       /* Is a devpts filesystem at "pts" in the same directory? */
+       err = path_pts(path);
+       if (err)
+               return err;
+
+       /* Is the path the root of a devpts filesystem? */
+       sb = path->mnt->mnt_sb;
+       if ((sb->s_magic != DEVPTS_SUPER_MAGIC) ||
+           (path->mnt->mnt_root != sb->s_root))
+               return -ENODEV;
+
+       return 0;
+}
+
+struct vfsmount *devpts_mntget(struct file *filp, struct pts_fs_info *fsi)
+{
+       struct path path;
+       int err;
+
+       path = filp->f_path;
+       path_get(&path);
+
+       err = devpts_ptmx_path(&path);
+       dput(path.dentry);
+       if (err) {
+               mntput(path.mnt);
+               path.mnt = ERR_PTR(err);
+       }
+       if (DEVPTS_SB(path.mnt->mnt_sb) != fsi) {
+               mntput(path.mnt);
+               path.mnt = ERR_PTR(-ENODEV);
+       }
+       return path.mnt;
+}
+
+struct pts_fs_info *devpts_acquire(struct file *filp)
 {
        struct pts_fs_info *result;
        struct path path;
@@ -142,31 +186,18 @@ struct pts_fs_info *devpts_acquire(struct file *filp, struct vfsmount **ptsmnt)
 
        path = filp->f_path;
        path_get(&path);
-       *ptsmnt = NULL;
 
-       /* Has the devpts filesystem already been found? */
-       sb = path.mnt->mnt_sb;
-       if (sb->s_magic != DEVPTS_SUPER_MAGIC) {
-               /* Is a devpts filesystem at "pts" in the same directory? */
-               err = path_pts(&path);
-               if (err) {
-                       result = ERR_PTR(err);
-                       goto out;
-               }
-
-               /* Is the path the root of a devpts filesystem? */
-               result = ERR_PTR(-ENODEV);
-               sb = path.mnt->mnt_sb;
-               if ((sb->s_magic != DEVPTS_SUPER_MAGIC) ||
-                   (path.mnt->mnt_root != sb->s_root))
-                       goto out;
+       err = devpts_ptmx_path(&path);
+       if (err) {
+               result = ERR_PTR(err);
+               goto out;
        }
 
        /*
         * pty code needs to hold extra references in case of last /dev/tty close
         */
+       sb = path.mnt->mnt_sb;
        atomic_inc(&sb->s_active);
-       *ptsmnt = mntget(path.mnt);
        result = DEVPTS_SB(sb);
 
 out:
index 5a1052627a81413685241f0c4669bbf755e2c5f9..701085620cd82cee3fda28ff6ca65921a9119fc1 100644 (file)
@@ -2300,7 +2300,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
                                             EXT4_MAX_BLOCK_LOG_SIZE);
        struct sg {
                struct ext4_group_info info;
-               ext4_grpblk_t counters[blocksize_bits + 2];
+               ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2];
        } sg;
 
        group--;
@@ -2309,6 +2309,9 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
                              " 2^0   2^1   2^2   2^3   2^4   2^5   2^6  "
                              " 2^7   2^8   2^9   2^10  2^11  2^12  2^13  ]\n");
 
+       i = (blocksize_bits + 2) * sizeof(sg.info.bb_counters[0]) +
+               sizeof(struct ext4_group_info);
+
        grinfo = ext4_get_group_info(sb, group);
        /* Load the group info in memory only if not already loaded. */
        if (unlikely(EXT4_MB_GRP_NEED_INIT(grinfo))) {
@@ -2320,7 +2323,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
                buddy_loaded = 1;
        }
 
-       memcpy(&sg, ext4_get_group_info(sb, group), sizeof(sg));
+       memcpy(&sg, ext4_get_group_info(sb, group), i);
 
        if (buddy_loaded)
                ext4_mb_unload_buddy(&e4b);
index 82a5af9f66685a6165a59a1f0c6ba603dd332e8b..3dd9701684488627d26294dd0489323b72afbba8 100644 (file)
@@ -1543,7 +1543,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
                        /* Clear padding bytes. */
                        memset(val + i->value_len, 0, new_size - i->value_len);
                }
-               return 0;
+               goto update_hash;
        }
 
        /* Compute min_offs and last. */
@@ -1707,6 +1707,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
                here->e_value_size = cpu_to_le32(i->value_len);
        }
 
+update_hash:
        if (i->value) {
                __le32 hash = 0;
 
@@ -1725,7 +1726,8 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
                                                     here->e_name_len,
                                                     &crc32c_hash, 1);
                } else if (is_block) {
-                       __le32 *value = s->base + min_offs - new_size;
+                       __le32 *value = s->base + le16_to_cpu(
+                                                       here->e_value_offs);
 
                        hash = ext4_xattr_hash_entry(here->e_name,
                                                     here->e_name_len, value,
index 78b41e1d5c67151744fb1c98bf1af54560593457..60726ae7cf26ef9d5b4af4f67f764d3c282a37b8 100644 (file)
@@ -619,16 +619,10 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
        if (!sb->s_root)
                goto out_no_root;
 
-       /* logical blocks are represented by 40 bits in pxd_t, etc. */
-       sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
-#if BITS_PER_LONG == 32
-       /*
-        * Page cache is indexed by long.
-        * I would use MAX_LFS_FILESIZE, but it's only half as big
+       /* logical blocks are represented by 40 bits in pxd_t, etc.
+        * and page cache is indexed by long
         */
-       sb->s_maxbytes = min(((u64) PAGE_SIZE << 32) - 1,
-                            (u64)sb->s_maxbytes);
-#endif
+       sb->s_maxbytes = min(((loff_t)sb->s_blocksize) << 40, MAX_LFS_FILESIZE);
        sb->s_time_gran = 1;
        return 0;
 
index 20fbcab977531bee75501a9403f4c8f60ee404d4..5f940d2a136b72a8e5ffcbff2f094b9f0ebfdaa3 100644 (file)
@@ -144,7 +144,7 @@ static void next_decode_page(struct nfsd4_compoundargs *argp)
        argp->p = page_address(argp->pagelist[0]);
        argp->pagelist++;
        if (argp->pagelen < PAGE_SIZE) {
-               argp->end = argp->p + (argp->pagelen>>2);
+               argp->end = argp->p + XDR_QUADLEN(argp->pagelen);
                argp->pagelen = 0;
        } else {
                argp->end = argp->p + (PAGE_SIZE>>2);
@@ -1279,9 +1279,7 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
                argp->pagelen -= pages * PAGE_SIZE;
                len -= pages * PAGE_SIZE;
 
-               argp->p = (__be32 *)page_address(argp->pagelist[0]);
-               argp->pagelist++;
-               argp->end = argp->p + XDR_QUADLEN(PAGE_SIZE);
+               next_decode_page(argp);
        }
        argp->p += XDR_QUADLEN(len);
 
index 9d5f15ed87fe7999eaaad22497899e696ad34147..c6362e38ae92dcfafd76f2b10541cb9e4464e230 100644 (file)
@@ -1164,11 +1164,7 @@ int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
        if (ufdset) {
                return compat_get_bitmap(fdset, ufdset, nr);
        } else {
-               /* Tricky, must clear full unsigned long in the
-                * kernel fdset at the end, ALIGN makes sure that
-                * actually happens.
-                */
-               memset(fdset, 0, ALIGN(nr, BITS_PER_LONG));
+               zero_fd_set(nr, fdset);
                return 0;
        }
 }
index fc824e2828f3cacad21cd7d3d9d98261cf1d78fb..5d2add1a6c964870b212f848879338f7b9b3ba18 100644 (file)
 #define parent_node(node)      ((void)(node),0)
 #endif
 #ifndef cpumask_of_node
-#define cpumask_of_node(node)  ((void)node, cpu_online_mask)
+  #ifdef CONFIG_NEED_MULTIPLE_NODES
+    #define cpumask_of_node(node)      ((node) == 0 ? cpu_online_mask : cpu_none_mask)
+  #else
+    #define cpumask_of_node(node)      ((void)node, cpu_online_mask)
+  #endif
 #endif
 #ifndef pcibus_to_node
 #define pcibus_to_node(bus)    ((void)(bus), -1)
index da0be9a8d1de4c239e53aec01a5e8b9cd87e3bdd..9623d78f84947e3d2fa51c7e7839932e5572441b 100644 (file)
 /* Align . to a 8 byte boundary equals to maximum function alignment. */
 #define ALIGN_FUNCTION()  . = ALIGN(8)
 
+/*
+ * LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections, which
+ * generates .data.identifier sections, which need to be pulled in with
+ * .data. We don't want to pull in .data..other sections, which Linux
+ * has defined. Same for text and bss.
+ */
+#ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+#define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
+#define DATA_MAIN .data .data.[0-9a-zA-Z_]*
+#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
+#else
+#define TEXT_MAIN .text
+#define DATA_MAIN .data
+#define BSS_MAIN .bss
+#endif
+
 /*
  * Align to a 32 byte boundary equal to the
  * alignment gcc 4.5 uses for a struct
 
 /*
  * .data section
- * LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections generates
- * .data.identifier which needs to be pulled in with .data, but don't want to
- * pull in .data..stuff which has its own requirements. Same for bss.
  */
 #define DATA_DATA                                                      \
-       *(.data .data.[0-9a-zA-Z_]*)                                    \
+       *(DATA_MAIN)                                                    \
        *(.ref.data)                                                    \
        *(.data..shared_aligned) /* percpu related */                   \
        MEM_KEEP(init.data)                                             \
                VMLINUX_SYMBOL(__security_initcall_end) = .;            \
        }
 
-/* .text section. Map to function alignment to avoid address changes
+/*
+ * .text section. Map to function alignment to avoid address changes
  * during second ld run in second ld pass when generating System.map
- * LD_DEAD_CODE_DATA_ELIMINATION option enables -ffunction-sections generates
- * .text.identifier which needs to be pulled in with .text , but some
- * architectures define .text.foo which is not intended to be pulled in here.
- * Those enabling LD_DEAD_CODE_DATA_ELIMINATION must ensure they don't have
- * conflicting section names, and must pull in .text.[0-9a-zA-Z_]* */
+ *
+ * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead
+ * code elimination is enabled, so these sections should be converted
+ * to use ".." first.
+ */
 #define TEXT_TEXT                                                      \
                ALIGN_FUNCTION();                                       \
-               *(.text.hot .text .text.fixup .text.unlikely)           \
+               *(.text.hot TEXT_MAIN .text.fixup .text.unlikely)       \
                *(.ref.text)                                            \
        MEM_KEEP(init.text)                                             \
        MEM_KEEP(exit.text)                                             \
                BSS_FIRST_SECTIONS                                      \
                *(.bss..page_aligned)                                   \
                *(.dynbss)                                              \
-               *(.bss .bss.[0-9a-zA-Z_]*)                              \
+               *(BSS_MAIN)                                             \
                *(COMMON)                                               \
        }
 
index e65ae4b2ed485a67a26d7c45d542a76d70ab9d97..c7a353825450a950a2f53f93774ef4c5bce934a0 100644 (file)
@@ -60,7 +60,8 @@ enum {
        ATA_ID_FW_REV           = 23,
        ATA_ID_PROD             = 27,
        ATA_ID_MAX_MULTSECT     = 47,
-       ATA_ID_DWORD_IO         = 48,
+       ATA_ID_DWORD_IO         = 48,   /* before ATA-8 */
+       ATA_ID_TRUSTED          = 48,   /* ATA-8 and later */
        ATA_ID_CAPABILITY       = 49,
        ATA_ID_OLD_PIO_MODES    = 51,
        ATA_ID_OLD_DMA_MODES    = 52,
@@ -889,6 +890,13 @@ static inline bool ata_id_has_dword_io(const u16 *id)
        return id[ATA_ID_DWORD_IO] & (1 << 0);
 }
 
+static inline bool ata_id_has_trusted(const u16 *id)
+{
+       if (ata_id_major_version(id) <= 7)
+               return false;
+       return id[ATA_ID_TRUSTED] & (1 << 0);
+}
+
 static inline bool ata_id_has_unload(const u16 *id)
 {
        if (ata_id_major_version(id) >= 7 &&
index 25f6a0cb27d3e9644c1ef42e7f1ff2b5d817293d..2a5d52fa90f5da353086a0faf5c8a5cdea63128a 100644 (file)
@@ -568,7 +568,6 @@ struct request_queue {
 
 #if defined(CONFIG_BLK_DEV_BSG)
        bsg_job_fn              *bsg_job_fn;
-       int                     bsg_job_size;
        struct bsg_class_device bsg_dev;
 #endif
 
index e34dde2da0ef57c3692ce7001fa66fe37c4dc578..637a20cfb237db4ab76a480172e918e6e48f849b 100644 (file)
@@ -24,6 +24,7 @@
 #define _BLK_BSG_
 
 #include <linux/blkdev.h>
+#include <scsi/scsi_request.h>
 
 struct request;
 struct device;
@@ -37,6 +38,7 @@ struct bsg_buffer {
 };
 
 struct bsg_job {
+       struct scsi_request sreq;
        struct device *dev;
        struct request *req;
 
index eca8ad75e28b054db4657d5e562b3904120b042e..043b60de041e3a03731ef99c4a635ea992d5e6ae 100644 (file)
@@ -517,7 +517,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
 # define __compiletime_error_fallback(condition) do { } while (0)
 #endif
 
-#define __compiletime_assert(condition, msg, prefix, suffix)           \
+#ifdef __OPTIMIZE__
+# define __compiletime_assert(condition, msg, prefix, suffix)          \
        do {                                                            \
                bool __cond = !(condition);                             \
                extern void prefix ## suffix(void) __compiletime_error(msg); \
@@ -525,6 +526,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
                        prefix ## suffix();                             \
                __compiletime_error_fallback(__cond);                   \
        } while (0)
+#else
+# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
+#endif
 
 #define _compiletime_assert(condition, msg, prefix, suffix) \
        __compiletime_assert(condition, msg, prefix, suffix)
index 1473455d0341bed5b157cab1cd95d8a08980e711..4f2b3b2076c42556da4d7d244ba786c2d0c045c3 100644 (file)
@@ -549,46 +549,29 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
  *---------------------------------------------------------------*/
 #define DM_NAME "device-mapper"
 
-#ifdef CONFIG_PRINTK
-extern struct ratelimit_state dm_ratelimit_state;
-
-#define dm_ratelimit() __ratelimit(&dm_ratelimit_state)
-#else
-#define dm_ratelimit() 0
-#endif
+#define DM_RATELIMIT(pr_func, fmt, ...)                                        \
+do {                                                                   \
+       static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,   \
+                                     DEFAULT_RATELIMIT_BURST);         \
+                                                                       \
+       if (__ratelimit(&rs))                                           \
+               pr_func(DM_FMT(fmt), ##__VA_ARGS__);                    \
+} while (0)
 
 #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n"
 
 #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__)
 
 #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__)
-#define DMERR_LIMIT(fmt, ...)                                          \
-do {                                                                   \
-       if (dm_ratelimit())                                             \
-               DMERR(fmt, ##__VA_ARGS__);                              \
-} while (0)
-
+#define DMERR_LIMIT(fmt, ...) DM_RATELIMIT(pr_err, fmt, ##__VA_ARGS__)
 #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__)
-#define DMWARN_LIMIT(fmt, ...)                                         \
-do {                                                                   \
-       if (dm_ratelimit())                                             \
-               DMWARN(fmt, ##__VA_ARGS__);                             \
-} while (0)
-
+#define DMWARN_LIMIT(fmt, ...) DM_RATELIMIT(pr_warn, fmt, ##__VA_ARGS__)
 #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
-#define DMINFO_LIMIT(fmt, ...)                                         \
-do {                                                                   \
-       if (dm_ratelimit())                                             \
-               DMINFO(fmt, ##__VA_ARGS__);                             \
-} while (0)
+#define DMINFO_LIMIT(fmt, ...) DM_RATELIMIT(pr_info, fmt, ##__VA_ARGS__)
 
 #ifdef CONFIG_DM_DEBUG
 #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__)
-#define DMDEBUG_LIMIT(fmt, ...)                                                \
-do {                                                                   \
-       if (dm_ratelimit())                                             \
-               DMDEBUG(fmt, ##__VA_ARGS__);                            \
-} while (0)
+#define DMDEBUG_LIMIT(fmt, ...) DM_RATELIMIT(pr_debug, fmt, ##__VA_ARGS__)
 #else
 #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
 #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
index 7883e901f65c826d8cd98bde911352aa72dafcce..100cb43437630114127bfecc3d29ad4454c03446 100644 (file)
@@ -19,7 +19,8 @@
 
 struct pts_fs_info;
 
-struct pts_fs_info *devpts_acquire(struct file *, struct vfsmount **ptsmnt);
+struct vfsmount *devpts_mntget(struct file *, struct pts_fs_info *);
+struct pts_fs_info *devpts_acquire(struct file *);
 void devpts_release(struct pts_fs_info *);
 
 int devpts_new_index(struct pts_fs_info *);
@@ -32,6 +33,15 @@ void *devpts_get_priv(struct dentry *);
 /* unlink */
 void devpts_pty_kill(struct dentry *);
 
+/* in pty.c */
+int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags);
+
+#else
+static inline int
+ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
+{
+       return -EIO;
+}
 #endif
 
 
index 6e1fd5d2124877c16bbbfab4487a772c8f7e37ee..cbfe127bccf8b112a2d65289a4ec7fef4809da22 100644 (file)
@@ -907,9 +907,9 @@ static inline struct file *get_file(struct file *f)
 /* Page cache limit. The filesystems should put that into their s_maxbytes 
    limits, otherwise bad things can happen in VM. */ 
 #if BITS_PER_LONG==32
-#define MAX_LFS_FILESIZE       (((loff_t)PAGE_SIZE << (BITS_PER_LONG-1))-1)
+#define MAX_LFS_FILESIZE       ((loff_t)ULONG_MAX << PAGE_SHIFT)
 #elif BITS_PER_LONG==64
-#define MAX_LFS_FILESIZE       ((loff_t)0x7fffffffffffffffLL)
+#define MAX_LFS_FILESIZE       ((loff_t)LLONG_MAX)
 #endif
 
 #define FL_POSIX       1
index d68bec297a45ee5e212ca253d903bf382d0ccfd9..c380daa40c0e3e6594b79a81128fc64326ee8a99 100644 (file)
@@ -535,7 +535,7 @@ struct iio_buffer_setup_ops {
  * @scan_timestamp:    [INTERN] set if any buffers have requested timestamp
  * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
  * @trig:              [INTERN] current device trigger (buffer modes)
- * @trig_readonly      [INTERN] mark the current trigger immutable
+ * @trig_readonly:     [INTERN] mark the current trigger immutable
  * @pollfunc:          [DRIVER] function run on trigger being received
  * @pollfunc_event:    [DRIVER] function run on events trigger being received
  * @channels:          [DRIVER] channel specification structure table
index ea08302f2d7b27967fb1f0947dcede46411f396c..7142d8d6e470e13257ee12035f045bdabe1b4d7e 100644 (file)
@@ -144,8 +144,8 @@ void devm_iio_trigger_unregister(struct device *dev,
 /**
  * iio_trigger_set_immutable() - set an immutable trigger on destination
  *
- * @indio_dev - IIO device structure containing the device
- * @trig - trigger to assign to device
+ * @indio_dev: IIO device structure containing the device
+ * @trig: trigger to assign to device
  *
  **/
 int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *trig);
index 2cb54adc4a334aa3f3a1732c35eaf9749d64b9e8..176f7569d87408c1e57bf09846809bfef5b0b7c8 100644 (file)
@@ -240,7 +240,7 @@ struct iommu_device {
        struct list_head list;
        const struct iommu_ops *ops;
        struct fwnode_handle *fwnode;
-       struct device dev;
+       struct device *dev;
 };
 
 int  iommu_device_register(struct iommu_device *iommu);
@@ -265,6 +265,11 @@ static inline void iommu_device_set_fwnode(struct iommu_device *iommu,
        iommu->fwnode = fwnode;
 }
 
+static inline struct iommu_device *dev_to_iommu_device(struct device *dev)
+{
+       return (struct iommu_device *)dev_get_drvdata(dev);
+}
+
 #define IOMMU_GROUP_NOTIFY_ADD_DEVICE          1 /* Device added */
 #define IOMMU_GROUP_NOTIFY_DEL_DEVICE          2 /* Pre Device removed */
 #define IOMMU_GROUP_NOTIFY_BIND_DRIVER         3 /* Pre Driver bind */
@@ -589,6 +594,11 @@ static inline void iommu_device_set_fwnode(struct iommu_device *iommu,
 {
 }
 
+static inline struct iommu_device *dev_to_iommu_device(struct device *dev)
+{
+       return NULL;
+}
+
 static inline void iommu_device_unregister(struct iommu_device *iommu)
 {
 }
index 46b9ac5e856923ec77125cf5c468585167bf0ff6..c1f6c95f34963177b13018e8299ddcd88e72e625 100644 (file)
@@ -1260,6 +1260,7 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
 void unmap_mapping_range(struct address_space *mapping,
                loff_t const holebegin, loff_t const holelen, int even_cows);
 int follow_pte_pmd(struct mm_struct *mm, unsigned long address,
+                            unsigned long *start, unsigned long *end,
                             pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp);
 int follow_pfn(struct vm_area_struct *vma, unsigned long address,
        unsigned long *pfn);
index c91b3bcd158f8fa8b2dbc3d4738ade5fdcc600cb..7b2e31b1745aaf3a7d3e8af0ca915c6c2dc04516 100644 (file)
@@ -94,17 +94,6 @@ struct mmu_notifier_ops {
                           unsigned long address,
                           pte_t pte);
 
-       /*
-        * Before this is invoked any secondary MMU is still ok to
-        * read/write to the page previously pointed to by the Linux
-        * pte because the page hasn't been freed yet and it won't be
-        * freed until this returns. If required set_page_dirty has to
-        * be called internally to this method.
-        */
-       void (*invalidate_page)(struct mmu_notifier *mn,
-                               struct mm_struct *mm,
-                               unsigned long address);
-
        /*
         * invalidate_range_start() and invalidate_range_end() must be
         * paired and are called only when the mmap_sem and/or the
@@ -220,8 +209,6 @@ extern int __mmu_notifier_test_young(struct mm_struct *mm,
                                     unsigned long address);
 extern void __mmu_notifier_change_pte(struct mm_struct *mm,
                                      unsigned long address, pte_t pte);
-extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
-                                         unsigned long address);
 extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
                                  unsigned long start, unsigned long end);
 extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
@@ -268,13 +255,6 @@ static inline void mmu_notifier_change_pte(struct mm_struct *mm,
                __mmu_notifier_change_pte(mm, address, pte);
 }
 
-static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
-                                         unsigned long address)
-{
-       if (mm_has_notifiers(mm))
-               __mmu_notifier_invalidate_page(mm, address);
-}
-
 static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
                                  unsigned long start, unsigned long end)
 {
@@ -442,11 +422,6 @@ static inline void mmu_notifier_change_pte(struct mm_struct *mm,
 {
 }
 
-static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
-                                         unsigned long address)
-{
-}
-
 static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
                                  unsigned long start, unsigned long end)
 {
index 25d8225dbd046d4dcac62e8261d1e49981b72df9..8efff888bd9bccdd4794bfaf4be66a3631e90cf1 100644 (file)
@@ -254,7 +254,7 @@ enum {
        NVME_CTRL_VWC_PRESENT                   = 1 << 0,
        NVME_CTRL_OACS_SEC_SUPP                 = 1 << 0,
        NVME_CTRL_OACS_DIRECTIVES               = 1 << 5,
-       NVME_CTRL_OACS_DBBUF_SUPP               = 1 << 7,
+       NVME_CTRL_OACS_DBBUF_SUPP               = 1 << 8,
 };
 
 struct nvme_lbaf {
index b5732432bb297dbf6067ae34b16c00073cb2949d..88c32aba32f71b15370e2d4b5cc724c31feed9d3 100644 (file)
@@ -1683,6 +1683,7 @@ struct ib_qp {
        enum ib_qp_type         qp_type;
        struct ib_rwq_ind_table *rwq_ind_tbl;
        struct ib_qp_security  *qp_sec;
+       u8                      port;
 };
 
 struct ib_mr {
index a1266d318c855dec12dbb41a6bb1ab9e4dc27f08..6af198d8120b098f31d674f15584ec7114832743 100644 (file)
@@ -57,6 +57,7 @@ struct scsi_pointer {
 /* for scmd->flags */
 #define SCMD_TAGGED            (1 << 0)
 #define SCMD_UNCHECKED_ISA_DMA (1 << 1)
+#define SCMD_ZONE_WRITE_LOCK   (1 << 2)
 
 struct scsi_cmnd {
        struct scsi_request req;
index a3960f98679c13567c3db4ecb7919cd14a70cfb0..c8125ec1f4f2270a5a01a358832425cd57edb11a 100644 (file)
@@ -22,7 +22,6 @@ enum {
        LO_FLAGS_AUTOCLEAR      = 4,
        LO_FLAGS_PARTSCAN       = 8,
        LO_FLAGS_DIRECT_IO      = 16,
-       LO_FLAGS_BLOCKSIZE      = 32,
 };
 
 #include <asm/posix_types.h>   /* for __kernel_old_dev_t */
@@ -60,8 +59,6 @@ struct loop_info64 {
        __u64              lo_init[2];
 };
 
-#define LO_INFO_BLOCKSIZE(l) (l)->lo_init[0]
-
 /*
  * Loop filter types
  */
index 6d3c54264d8e46f662e3a0caa416538042727fb3..3f03567631cb092dc8f51aae740dd2a3472730e9 100644 (file)
@@ -145,43 +145,6 @@ struct nd_cmd_clear_error {
        __u64 cleared;
 } __packed;
 
-struct nd_cmd_trans_spa {
-       __u64 spa;
-       __u32 status;
-       __u8  flags;
-       __u8  _reserved[3];
-       __u64 trans_length;
-       __u32 num_nvdimms;
-       struct nd_nvdimm_device {
-               __u32 nfit_device_handle;
-               __u32 _reserved;
-               __u64 dpa;
-       } __packed devices[0];
-
-} __packed;
-
-struct nd_cmd_ars_err_inj {
-       __u64 err_inj_spa_range_base;
-       __u64 err_inj_spa_range_length;
-       __u8  err_inj_options;
-       __u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_clr {
-       __u64 err_inj_clr_spa_range_base;
-       __u64 err_inj_clr_spa_range_length;
-       __u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_stat {
-       __u32 status;
-       __u32 inj_err_rec_count;
-       struct nd_error_stat_query_record {
-               __u64 err_inj_stat_spa_range_base;
-               __u64 err_inj_stat_spa_range_length;
-       } __packed record[0];
-} __packed;
-
 enum {
        ND_CMD_IMPLEMENTED = 0,
 
index 8d51516885047c7807cb050979c1ebbdaec6dc07..87a1213dd32678fba0487b7411dc4af5661cf01e 100644 (file)
@@ -1892,6 +1892,7 @@ static struct cftype files[] = {
        {
                .name = "memory_pressure",
                .read_u64 = cpuset_read_u64,
+               .private = FILE_MEMORY_PRESSURE,
        },
 
        {
index ee20d4c546b5ebc0248c084e11c483e0ef800c6f..3504125871d2f058fa717638e785b9c85220213a 100644 (file)
@@ -10032,28 +10032,27 @@ SYSCALL_DEFINE5(perf_event_open,
                        goto err_context;
 
                /*
-                * Do not allow to attach to a group in a different
-                * task or CPU context:
+                * Make sure we're both events for the same CPU;
+                * grouping events for different CPUs is broken; since
+                * you can never concurrently schedule them anyhow.
                 */
-               if (move_group) {
-                       /*
-                        * Make sure we're both on the same task, or both
-                        * per-cpu events.
-                        */
-                       if (group_leader->ctx->task != ctx->task)
-                               goto err_context;
+               if (group_leader->cpu != event->cpu)
+                       goto err_context;
 
-                       /*
-                        * Make sure we're both events for the same CPU;
-                        * grouping events for different CPUs is broken; since
-                        * you can never concurrently schedule them anyhow.
-                        */
-                       if (group_leader->cpu != event->cpu)
-                               goto err_context;
-               } else {
-                       if (group_leader->ctx != ctx)
-                               goto err_context;
-               }
+               /*
+                * Make sure we're both on the same task, or both
+                * per-CPU events.
+                */
+               if (group_leader->ctx->task != ctx->task)
+                       goto err_context;
+
+               /*
+                * Do not allow to attach to a group in a different task
+                * or CPU context. If we're moving SW events, we'll fix
+                * this up later, so allow that.
+                */
+               if (!move_group && group_leader->ctx != ctx)
+                       goto err_context;
 
                /*
                 * Only a group leader can be exclusive or pinned
index 0e137f98a50c30db936a8deecedc1f84455aca23..267f6ef91d9709e2f53c35e053a792d3fcede64d 100644 (file)
@@ -1262,8 +1262,6 @@ void uprobe_end_dup_mmap(void)
 
 void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
 {
-       newmm->uprobes_state.xol_area = NULL;
-
        if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) {
                set_bit(MMF_HAS_UPROBES, &newmm->flags);
                /* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */
index e075b7780421dee1d8243b9dc178248398c5f189..b7e9e57b71eaef65bd56b409b32b582e9b16ed4a 100644 (file)
@@ -785,6 +785,13 @@ static void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
 #endif
 }
 
+static void mm_init_uprobes_state(struct mm_struct *mm)
+{
+#ifdef CONFIG_UPROBES
+       mm->uprobes_state.xol_area = NULL;
+#endif
+}
+
 static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
        struct user_namespace *user_ns)
 {
@@ -806,11 +813,13 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
        mm_init_cpumask(mm);
        mm_init_aio(mm);
        mm_init_owner(mm, p);
+       RCU_INIT_POINTER(mm->exe_file, NULL);
        mmu_notifier_mm_init(mm);
        init_tlb_flush_pending(mm);
 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
        mm->pmd_huge_pte = NULL;
 #endif
+       mm_init_uprobes_state(mm);
 
        if (current->mm) {
                mm->flags = current->mm->flags & MMF_INIT_MASK;
index 26db528c1d881bf371ea5b53b7ade0815c990bf1..1c19edf824272db47a48730478af5f3b582bbf67 100644 (file)
@@ -637,6 +637,7 @@ repeat:
                schedule();
 
        try_to_freeze();
+       cond_resched();
        goto repeat;
 }
 EXPORT_SYMBOL_GPL(kthread_worker_fn);
index 17f11c6b0a9f7a87010c17d3b775739d7e0d93a1..d6afed6d0752c6cdd09a094d61d0bcae9184f865 100644 (file)
@@ -70,9 +70,10 @@ static void __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
 
        list_for_each_entry_safe(curr, next, &wq_head->head, entry) {
                unsigned flags = curr->flags;
-
-               if (curr->func(curr, mode, wake_flags, key) &&
-                               (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
+               int ret = curr->func(curr, mode, wake_flags, key);
+               if (ret < 0)
+                       break;
+               if (ret && (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
                        break;
        }
 }
index 8f5d1bf18854593e6fa27730d07a99c6700ab45c..f2674a056c268a58e0525194ea225fcd0bd9e1d5 100644 (file)
@@ -203,6 +203,7 @@ struct timer_base {
        bool                    migration_enabled;
        bool                    nohz_active;
        bool                    is_idle;
+       bool                    must_forward_clk;
        DECLARE_BITMAP(pending_map, WHEEL_SIZE);
        struct hlist_head       vectors[WHEEL_SIZE];
 } ____cacheline_aligned;
@@ -856,13 +857,19 @@ get_target_base(struct timer_base *base, unsigned tflags)
 
 static inline void forward_timer_base(struct timer_base *base)
 {
-       unsigned long jnow = READ_ONCE(jiffies);
+       unsigned long jnow;
 
        /*
-        * We only forward the base when it's idle and we have a delta between
-        * base clock and jiffies.
+        * We only forward the base when we are idle or have just come out of
+        * idle (must_forward_clk logic), and have a delta between base clock
+        * and jiffies. In the common case, run_timers will take care of it.
         */
-       if (!base->is_idle || (long) (jnow - base->clk) < 2)
+       if (likely(!base->must_forward_clk))
+               return;
+
+       jnow = READ_ONCE(jiffies);
+       base->must_forward_clk = base->is_idle;
+       if ((long)(jnow - base->clk) < 2)
                return;
 
        /*
@@ -938,6 +945,11 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only)
         * same array bucket then just return:
         */
        if (timer_pending(timer)) {
+               /*
+                * The downside of this optimization is that it can result in
+                * larger granularity than you would get from adding a new
+                * timer with this expiry.
+                */
                if (timer->expires == expires)
                        return 1;
 
@@ -948,6 +960,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only)
                 * dequeue/enqueue dance.
                 */
                base = lock_timer_base(timer, &flags);
+               forward_timer_base(base);
 
                clk = base->clk;
                idx = calc_wheel_index(expires, clk);
@@ -964,6 +977,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only)
                }
        } else {
                base = lock_timer_base(timer, &flags);
+               forward_timer_base(base);
        }
 
        ret = detach_if_pending(timer, base, false);
@@ -991,12 +1005,10 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only)
                        raw_spin_lock(&base->lock);
                        WRITE_ONCE(timer->flags,
                                   (timer->flags & ~TIMER_BASEMASK) | base->cpu);
+                       forward_timer_base(base);
                }
        }
 
-       /* Try to forward a stale timer base clock */
-       forward_timer_base(base);
-
        timer->expires = expires;
        /*
         * If 'idx' was calculated above and the base time did not advance
@@ -1112,6 +1124,7 @@ void add_timer_on(struct timer_list *timer, int cpu)
                WRITE_ONCE(timer->flags,
                           (timer->flags & ~TIMER_BASEMASK) | cpu);
        }
+       forward_timer_base(base);
 
        debug_activate(timer, timer->expires);
        internal_add_timer(base, timer);
@@ -1497,10 +1510,16 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
                if (!is_max_delta)
                        expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
                /*
-                * If we expect to sleep more than a tick, mark the base idle:
+                * If we expect to sleep more than a tick, mark the base idle.
+                * Also the tick is stopped so any added timer must forward
+                * the base clk itself to keep granularity small. This idle
+                * logic is only maintained for the BASE_STD base, deferrable
+                * timers may still see large granularity skew (by design).
                 */
-               if ((expires - basem) > TICK_NSEC)
+               if ((expires - basem) > TICK_NSEC) {
+                       base->must_forward_clk = true;
                        base->is_idle = true;
+               }
        }
        raw_spin_unlock(&base->lock);
 
@@ -1611,6 +1630,19 @@ static __latent_entropy void run_timer_softirq(struct softirq_action *h)
 {
        struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
 
+       /*
+        * must_forward_clk must be cleared before running timers so that any
+        * timer functions that call mod_timer will not try to forward the
+        * base. idle trcking / clock forwarding logic is only used with
+        * BASE_STD timers.
+        *
+        * The deferrable base does not do idle tracking at all, so we do
+        * not forward it. This can result in very large variations in
+        * granularity for deferrable timers, but they can be deferred for
+        * long periods due to idle.
+        */
+       base->must_forward_clk = false;
+
        __run_timers(base);
        if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active)
                __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF]));
index 02004ae918608f915b28341b6ed1b3b7f551c5a5..96cea88fa00fcdab41db0a2054ef6cfe50a778aa 100644 (file)
@@ -889,6 +889,10 @@ static int profile_graph_entry(struct ftrace_graph_ent *trace)
 
        function_profile_call(trace->func, 0, NULL, NULL);
 
+       /* If function graph is shutting down, ret_stack can be NULL */
+       if (!current->ret_stack)
+               return 0;
+
        if (index >= 0 && index < FTRACE_RETFUNC_DEPTH)
                current->ret_stack[index].subtime = 0;
 
index 529cc50d7243d6c1007e517bcdc83a5312f7ae6b..81279c6602ff1753d8c38c8def566c3576578962 100644 (file)
@@ -4386,15 +4386,19 @@ EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu);
  * the page that was allocated, with the read page of the buffer.
  *
  * Returns:
- *  The page allocated, or NULL on error.
+ *  The page allocated, or ERR_PTR
  */
 void *ring_buffer_alloc_read_page(struct ring_buffer *buffer, int cpu)
 {
-       struct ring_buffer_per_cpu *cpu_buffer = buffer->buffers[cpu];
+       struct ring_buffer_per_cpu *cpu_buffer;
        struct buffer_data_page *bpage = NULL;
        unsigned long flags;
        struct page *page;
 
+       if (!cpumask_test_cpu(cpu, buffer->cpumask))
+               return ERR_PTR(-ENODEV);
+
+       cpu_buffer = buffer->buffers[cpu];
        local_irq_save(flags);
        arch_spin_lock(&cpu_buffer->lock);
 
@@ -4412,7 +4416,7 @@ void *ring_buffer_alloc_read_page(struct ring_buffer *buffer, int cpu)
        page = alloc_pages_node(cpu_to_node(cpu),
                                GFP_KERNEL | __GFP_NORETRY, 0);
        if (!page)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        bpage = page_address(page);
 
@@ -4467,8 +4471,8 @@ EXPORT_SYMBOL_GPL(ring_buffer_free_read_page);
  *
  * for example:
  *     rpage = ring_buffer_alloc_read_page(buffer, cpu);
- *     if (!rpage)
- *             return error;
+ *     if (IS_ERR(rpage))
+ *             return PTR_ERR(rpage);
  *     ret = ring_buffer_read_page(buffer, &rpage, len, cpu, 0);
  *     if (ret >= 0)
  *             process_page(rpage, ret);
index 9fbcaf56788626335bfd5412dffaf820a9b308bc..68ee79afe31c223218e8fab1ffd829b7be1226d3 100644 (file)
@@ -113,7 +113,7 @@ static enum event_status read_page(int cpu)
        int i;
 
        bpage = ring_buffer_alloc_read_page(buffer, cpu);
-       if (!bpage)
+       if (IS_ERR(bpage))
                return EVENT_DROPPED;
 
        ret = ring_buffer_read_page(buffer, &bpage, PAGE_SIZE, cpu, 1);
index 42b9355033d45d5a7c27bf0606799772e70d7421..44004d8aa3b33f259ed90dd13ce4c102034da23a 100644 (file)
@@ -6598,7 +6598,7 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
 {
        struct ftrace_buffer_info *info = filp->private_data;
        struct trace_iterator *iter = &info->iter;
-       ssize_t ret;
+       ssize_t ret = 0;
        ssize_t size;
 
        if (!count)
@@ -6612,10 +6612,15 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
        if (!info->spare) {
                info->spare = ring_buffer_alloc_read_page(iter->trace_buffer->buffer,
                                                          iter->cpu_file);
-               info->spare_cpu = iter->cpu_file;
+               if (IS_ERR(info->spare)) {
+                       ret = PTR_ERR(info->spare);
+                       info->spare = NULL;
+               } else {
+                       info->spare_cpu = iter->cpu_file;
+               }
        }
        if (!info->spare)
-               return -ENOMEM;
+               return ret;
 
        /* Do we have previous read data to read? */
        if (info->read < PAGE_SIZE)
@@ -6790,8 +6795,9 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
                ref->ref = 1;
                ref->buffer = iter->trace_buffer->buffer;
                ref->page = ring_buffer_alloc_read_page(ref->buffer, iter->cpu_file);
-               if (!ref->page) {
-                       ret = -ENOMEM;
+               if (IS_ERR(ref->page)) {
+                       ret = PTR_ERR(ref->page);
+                       ref->page = NULL;
                        kfree(ref);
                        break;
                }
@@ -8293,6 +8299,7 @@ __init static int tracer_alloc_buffers(void)
        if (ret < 0)
                goto out_free_cpumask;
        /* Used for event triggers */
+       ret = -ENOMEM;
        temp_buffer = ring_buffer_alloc(PAGE_SIZE, RB_FL_OVERWRITE);
        if (!temp_buffer)
                goto out_rm_hp_state;
@@ -8407,4 +8414,4 @@ __init static int clear_boot_tracer(void)
 }
 
 fs_initcall(tracer_init_tracefs);
-late_initcall(clear_boot_tracer);
+late_initcall_sync(clear_boot_tracer);
index 59a411ff60c709834121fc70363c74560dfe1ff5..181e139a8057bed695ad6d1d7460036e378f5ca0 100644 (file)
@@ -1959,6 +1959,10 @@ static int create_filter(struct trace_event_call *call,
                if (err && set_str)
                        append_filter_err(ps, filter);
        }
+       if (err && !set_str) {
+               free_event_filter(filter);
+               filter = NULL;
+       }
        create_filter_finish(ps);
 
        *filterp = filter;
index 0a689bbb78ef4fe48d9e55cb867e836aea87a726..305039b122fafba242f73b5982289ce4a12a6e20 100644 (file)
@@ -221,16 +221,19 @@ void tracing_map_array_free(struct tracing_map_array *a)
        if (!a)
                return;
 
-       if (!a->pages) {
-               kfree(a);
-               return;
-       }
+       if (!a->pages)
+               goto free;
 
        for (i = 0; i < a->n_pages; i++) {
                if (!a->pages[i])
                        break;
                free_page((unsigned long)a->pages[i]);
        }
+
+       kfree(a->pages);
+
+ free:
+       kfree(a);
 }
 
 struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
index 5a0f75a3bf01c1b259fb125fbe7266c186d83a71..eead4b339466854f51db30a17f17ee0472ebe6d3 100644 (file)
@@ -364,11 +364,11 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
        }
 
        miter.consumed = lzeros;
-       sg_miter_stop(&miter);
 
        nbytes -= lzeros;
        nbits = nbytes * 8;
        if (nbits > MAX_EXTERN_MPI_BITS) {
+               sg_miter_stop(&miter);
                pr_info("MPI: mpi too large (%u bits)\n", nbits);
                return NULL;
        }
@@ -376,6 +376,8 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
        if (nbytes > 0)
                nbits -= count_leading_zeros(*buff) - (BITS_PER_LONG - 8);
 
+       sg_miter_stop(&miter);
+
        nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB);
        val = mpi_alloc(nlimbs);
        if (!val)
index a49702445ce05beeb8d80b46f0ee57c116986be2..65b4b6e7f7bde69620b73af705ecca33629a8f79 100644 (file)
@@ -885,6 +885,7 @@ void __init pagecache_init(void)
        page_writeback_init();
 }
 
+/* This has the same layout as wait_bit_key - see fs/cachefiles/rdwr.c */
 struct wait_page_key {
        struct page *page;
        int bit_nr;
@@ -909,8 +910,10 @@ static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync,
 
        if (wait_page->bit_nr != key->bit_nr)
                return 0;
+
+       /* Stop walking if it's locked */
        if (test_bit(key->bit_nr, &key->page->flags))
-               return 0;
+               return -1;
 
        return autoremove_wake_function(wait, mode, sync, key);
 }
@@ -964,6 +967,7 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
        int ret = 0;
 
        init_wait(wait);
+       wait->flags = lock ? WQ_FLAG_EXCLUSIVE : 0;
        wait->func = wake_page_function;
        wait_page.page = page;
        wait_page.bit_nr = bit_nr;
@@ -972,10 +976,7 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
                spin_lock_irq(&q->lock);
 
                if (likely(list_empty(&wait->entry))) {
-                       if (lock)
-                               __add_wait_queue_entry_tail_exclusive(q, wait);
-                       else
-                               __add_wait_queue(q, wait);
+                       __add_wait_queue_entry_tail(q, wait);
                        SetPageWaiters(page);
                }
 
@@ -985,10 +986,6 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
 
                if (likely(test_bit(bit_nr, &page->flags))) {
                        io_schedule();
-                       if (unlikely(signal_pending_state(state, current))) {
-                               ret = -EINTR;
-                               break;
-                       }
                }
 
                if (lock) {
@@ -998,6 +995,11 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
                        if (!test_bit(bit_nr, &page->flags))
                                break;
                }
+
+               if (unlikely(signal_pending_state(state, current))) {
+                       ret = -EINTR;
+                       break;
+               }
        }
 
        finish_wait(q, wait);
@@ -1039,7 +1041,7 @@ void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter)
        unsigned long flags;
 
        spin_lock_irqsave(&q->lock, flags);
-       __add_wait_queue(q, waiter);
+       __add_wait_queue_entry_tail(q, waiter);
        SetPageWaiters(page);
        spin_unlock_irqrestore(&q->lock, flags);
 }
index 47d8d8a25eae49604f81bcffe40e45ef9b8e4c6c..4d7d1e5ddba9d9b26583b6ca9f05774247d9b1d8 100644 (file)
@@ -368,8 +368,8 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
                                pte_offset_map_lock(mm, pmd, addr, &ptl);
                                goto out;
                        }
-                       put_page(page);
                        unlock_page(page);
+                       put_page(page);
                        pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
                        pte--;
                        addr -= PAGE_SIZE;
@@ -613,6 +613,7 @@ static int madvise_inject_error(int behavior,
                unsigned long start, unsigned long end)
 {
        struct page *page;
+       struct zone *zone;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -646,6 +647,11 @@ static int madvise_inject_error(int behavior,
                if (ret)
                        return ret;
        }
+
+       /* Ensure that all poisoned pages are removed from per-cpu lists */
+       for_each_populated_zone(zone)
+               drain_all_pages(zone);
+
        return 0;
 }
 #endif
index bf14aea6ab709dc61666c1994718d9d244291e22..91205780e6b151f8239574c5f97b8d5ebc89b59f 100644 (file)
@@ -299,7 +299,7 @@ void __init memblock_discard(void)
                __memblock_free_late(addr, size);
        }
 
-       if (memblock.memory.regions == memblock_memory_init_regions) {
+       if (memblock.memory.regions != memblock_memory_init_regions) {
                addr = __pa(memblock.memory.regions);
                size = PAGE_ALIGN(sizeof(struct memblock_region) *
                                  memblock.memory.max);
index fe2fba27ded2fab229d0ef7a4908551343d31b89..56e48e4593cb76b1f89be8d2afd72762ebbfff4d 100644 (file)
@@ -4008,7 +4008,8 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
 #endif /* __PAGETABLE_PMD_FOLDED */
 
 static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address,
-               pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
+                           unsigned long *start, unsigned long *end,
+                           pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
 {
        pgd_t *pgd;
        p4d_t *p4d;
@@ -4035,17 +4036,29 @@ static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address,
                if (!pmdpp)
                        goto out;
 
+               if (start && end) {
+                       *start = address & PMD_MASK;
+                       *end = *start + PMD_SIZE;
+                       mmu_notifier_invalidate_range_start(mm, *start, *end);
+               }
                *ptlp = pmd_lock(mm, pmd);
                if (pmd_huge(*pmd)) {
                        *pmdpp = pmd;
                        return 0;
                }
                spin_unlock(*ptlp);
+               if (start && end)
+                       mmu_notifier_invalidate_range_end(mm, *start, *end);
        }
 
        if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
                goto out;
 
+       if (start && end) {
+               *start = address & PAGE_MASK;
+               *end = *start + PAGE_SIZE;
+               mmu_notifier_invalidate_range_start(mm, *start, *end);
+       }
        ptep = pte_offset_map_lock(mm, pmd, address, ptlp);
        if (!pte_present(*ptep))
                goto unlock;
@@ -4053,6 +4066,8 @@ static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address,
        return 0;
 unlock:
        pte_unmap_unlock(ptep, *ptlp);
+       if (start && end)
+               mmu_notifier_invalidate_range_end(mm, *start, *end);
 out:
        return -EINVAL;
 }
@@ -4064,20 +4079,21 @@ static inline int follow_pte(struct mm_struct *mm, unsigned long address,
 
        /* (void) is needed to make gcc happy */
        (void) __cond_lock(*ptlp,
-                          !(res = __follow_pte_pmd(mm, address, ptepp, NULL,
-                                          ptlp)));
+                          !(res = __follow_pte_pmd(mm, address, NULL, NULL,
+                                                   ptepp, NULL, ptlp)));
        return res;
 }
 
 int follow_pte_pmd(struct mm_struct *mm, unsigned long address,
+                            unsigned long *start, unsigned long *end,
                             pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
 {
        int res;
 
        /* (void) is needed to make gcc happy */
        (void) __cond_lock(*ptlp,
-                          !(res = __follow_pte_pmd(mm, address, ptepp, pmdpp,
-                                          ptlp)));
+                          !(res = __follow_pte_pmd(mm, address, start, end,
+                                                   ptepp, pmdpp, ptlp)));
        return res;
 }
 EXPORT_SYMBOL(follow_pte_pmd);
index 54ca545629286223a16ef931830a3757b29da77d..314285284e6e6a4c764d0f8126dd0fecf8f7f84e 100644 (file)
@@ -174,20 +174,6 @@ void __mmu_notifier_change_pte(struct mm_struct *mm, unsigned long address,
        srcu_read_unlock(&srcu, id);
 }
 
-void __mmu_notifier_invalidate_page(struct mm_struct *mm,
-                                         unsigned long address)
-{
-       struct mmu_notifier *mn;
-       int id;
-
-       id = srcu_read_lock(&srcu);
-       hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list, hlist) {
-               if (mn->ops->invalidate_page)
-                       mn->ops->invalidate_page(mn, mm, address);
-       }
-       srcu_read_unlock(&srcu, id);
-}
-
 void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
                                  unsigned long start, unsigned long end)
 {
index 1bad301820c7a2e2729fc2f7c04e4b3694131576..1423da8dd16f5bdc83e20ddf6665b2022a9a6492 100644 (file)
@@ -66,6 +66,7 @@
 #include <linux/kthread.h>
 #include <linux/memcontrol.h>
 #include <linux/ftrace.h>
+#include <linux/nmi.h>
 
 #include <asm/sections.h>
 #include <asm/tlbflush.h>
@@ -2535,9 +2536,14 @@ void drain_all_pages(struct zone *zone)
 
 #ifdef CONFIG_HIBERNATION
 
+/*
+ * Touch the watchdog for every WD_PAGE_COUNT pages.
+ */
+#define WD_PAGE_COUNT  (128*1024)
+
 void mark_free_pages(struct zone *zone)
 {
-       unsigned long pfn, max_zone_pfn;
+       unsigned long pfn, max_zone_pfn, page_count = WD_PAGE_COUNT;
        unsigned long flags;
        unsigned int order, t;
        struct page *page;
@@ -2552,6 +2558,11 @@ void mark_free_pages(struct zone *zone)
                if (pfn_valid(pfn)) {
                        page = pfn_to_page(pfn);
 
+                       if (!--page_count) {
+                               touch_nmi_watchdog();
+                               page_count = WD_PAGE_COUNT;
+                       }
+
                        if (page_zone(page) != zone)
                                continue;
 
@@ -2565,8 +2576,13 @@ void mark_free_pages(struct zone *zone)
                        unsigned long i;
 
                        pfn = page_to_pfn(page);
-                       for (i = 0; i < (1UL << order); i++)
+                       for (i = 0; i < (1UL << order); i++) {
+                               if (!--page_count) {
+                                       touch_nmi_watchdog();
+                                       page_count = WD_PAGE_COUNT;
+                               }
                                swsusp_set_page_free(pfn_to_page(pfn + i));
+                       }
                }
        }
        spin_unlock_irqrestore(&zone->lock, flags);
@@ -3275,10 +3291,13 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
        /*
         * Go through the zonelist yet one more time, keep very high watermark
         * here, this is only to catch a parallel oom killing, we must fail if
-        * we're still under heavy pressure.
+        * we're still under heavy pressure. But make sure that this reclaim
+        * attempt shall not depend on __GFP_DIRECT_RECLAIM && !__GFP_NORETRY
+        * allocation which will never fail due to oom_lock already held.
         */
-       page = get_page_from_freelist(gfp_mask | __GFP_HARDWALL, order,
-                                       ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
+       page = get_page_from_freelist((gfp_mask | __GFP_HARDWALL) &
+                                     ~__GFP_DIRECT_RECLAIM, order,
+                                     ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
        if (page)
                goto out;
 
index c1286d47aa1fad7fee7ea5bb865a2dc7efd672f2..c570f82e6827153316465b9e18f0fca376a1c1a1 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -887,11 +887,21 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
                .address = address,
                .flags = PVMW_SYNC,
        };
+       unsigned long start = address, end;
        int *cleaned = arg;
-       bool invalidation_needed = false;
+
+       /*
+        * We have to assume the worse case ie pmd for invalidation. Note that
+        * the page can not be free from this function.
+        */
+       end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page)));
+       mmu_notifier_invalidate_range_start(vma->vm_mm, start, end);
 
        while (page_vma_mapped_walk(&pvmw)) {
+               unsigned long cstart, cend;
                int ret = 0;
+
+               cstart = address = pvmw.address;
                if (pvmw.pte) {
                        pte_t entry;
                        pte_t *pte = pvmw.pte;
@@ -899,11 +909,12 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
                        if (!pte_dirty(*pte) && !pte_write(*pte))
                                continue;
 
-                       flush_cache_page(vma, pvmw.address, pte_pfn(*pte));
-                       entry = ptep_clear_flush(vma, pvmw.address, pte);
+                       flush_cache_page(vma, address, pte_pfn(*pte));
+                       entry = ptep_clear_flush(vma, address, pte);
                        entry = pte_wrprotect(entry);
                        entry = pte_mkclean(entry);
-                       set_pte_at(vma->vm_mm, pvmw.address, pte, entry);
+                       set_pte_at(vma->vm_mm, address, pte, entry);
+                       cend = cstart + PAGE_SIZE;
                        ret = 1;
                } else {
 #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
@@ -913,11 +924,13 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
                        if (!pmd_dirty(*pmd) && !pmd_write(*pmd))
                                continue;
 
-                       flush_cache_page(vma, pvmw.address, page_to_pfn(page));
-                       entry = pmdp_huge_clear_flush(vma, pvmw.address, pmd);
+                       flush_cache_page(vma, address, page_to_pfn(page));
+                       entry = pmdp_huge_clear_flush(vma, address, pmd);
                        entry = pmd_wrprotect(entry);
                        entry = pmd_mkclean(entry);
-                       set_pmd_at(vma->vm_mm, pvmw.address, pmd, entry);
+                       set_pmd_at(vma->vm_mm, address, pmd, entry);
+                       cstart &= PMD_MASK;
+                       cend = cstart + PMD_SIZE;
                        ret = 1;
 #else
                        /* unexpected pmd-mapped page? */
@@ -926,15 +939,12 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
                }
 
                if (ret) {
+                       mmu_notifier_invalidate_range(vma->vm_mm, cstart, cend);
                        (*cleaned)++;
-                       invalidation_needed = true;
                }
        }
 
-       if (invalidation_needed) {
-               mmu_notifier_invalidate_range(vma->vm_mm, address,
-                               address + (1UL << compound_order(page)));
-       }
+       mmu_notifier_invalidate_range_end(vma->vm_mm, start, end);
 
        return true;
 }
@@ -1328,7 +1338,8 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
        };
        pte_t pteval;
        struct page *subpage;
-       bool ret = true, invalidation_needed = false;
+       bool ret = true;
+       unsigned long start = address, end;
        enum ttu_flags flags = (enum ttu_flags)arg;
 
        /* munlock has nothing to gain from examining un-locked vmas */
@@ -1340,6 +1351,14 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                                flags & TTU_MIGRATION, page);
        }
 
+       /*
+        * We have to assume the worse case ie pmd for invalidation. Note that
+        * the page can not be free in this function as call of try_to_unmap()
+        * must hold a reference on the page.
+        */
+       end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page)));
+       mmu_notifier_invalidate_range_start(vma->vm_mm, start, end);
+
        while (page_vma_mapped_walk(&pvmw)) {
                /*
                 * If the page is mlock()d, we cannot swap it out.
@@ -1368,9 +1387,11 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                VM_BUG_ON_PAGE(!pvmw.pte, page);
 
                subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
+               address = pvmw.address;
+
 
                if (!(flags & TTU_IGNORE_ACCESS)) {
-                       if (ptep_clear_flush_young_notify(vma, pvmw.address,
+                       if (ptep_clear_flush_young_notify(vma, address,
                                                pvmw.pte)) {
                                ret = false;
                                page_vma_mapped_walk_done(&pvmw);
@@ -1379,7 +1400,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                }
 
                /* Nuke the page table entry. */
-               flush_cache_page(vma, pvmw.address, pte_pfn(*pvmw.pte));
+               flush_cache_page(vma, address, pte_pfn(*pvmw.pte));
                if (should_defer_flush(mm, flags)) {
                        /*
                         * We clear the PTE but do not flush so potentially
@@ -1389,12 +1410,11 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                         * transition on a cached TLB entry is written through
                         * and traps if the PTE is unmapped.
                         */
-                       pteval = ptep_get_and_clear(mm, pvmw.address,
-                                                   pvmw.pte);
+                       pteval = ptep_get_and_clear(mm, address, pvmw.pte);
 
                        set_tlb_ubc_flush_pending(mm, pte_dirty(pteval));
                } else {
-                       pteval = ptep_clear_flush(vma, pvmw.address, pvmw.pte);
+                       pteval = ptep_clear_flush(vma, address, pvmw.pte);
                }
 
                /* Move the dirty bit to the page. Now the pte is gone. */
@@ -1409,12 +1429,12 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                        if (PageHuge(page)) {
                                int nr = 1 << compound_order(page);
                                hugetlb_count_sub(nr, mm);
-                               set_huge_swap_pte_at(mm, pvmw.address,
+                               set_huge_swap_pte_at(mm, address,
                                                     pvmw.pte, pteval,
                                                     vma_mmu_pagesize(vma));
                        } else {
                                dec_mm_counter(mm, mm_counter(page));
-                               set_pte_at(mm, pvmw.address, pvmw.pte, pteval);
+                               set_pte_at(mm, address, pvmw.pte, pteval);
                        }
 
                } else if (pte_unused(pteval)) {
@@ -1438,7 +1458,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                        swp_pte = swp_entry_to_pte(entry);
                        if (pte_soft_dirty(pteval))
                                swp_pte = pte_swp_mksoft_dirty(swp_pte);
-                       set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
+                       set_pte_at(mm, address, pvmw.pte, swp_pte);
                } else if (PageAnon(page)) {
                        swp_entry_t entry = { .val = page_private(subpage) };
                        pte_t swp_pte;
@@ -1449,6 +1469,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                        if (unlikely(PageSwapBacked(page) != PageSwapCache(page))) {
                                WARN_ON_ONCE(1);
                                ret = false;
+                               /* We have to invalidate as we cleared the pte */
                                page_vma_mapped_walk_done(&pvmw);
                                break;
                        }
@@ -1464,7 +1485,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                                 * If the page was redirtied, it cannot be
                                 * discarded. Remap the page to page table.
                                 */
-                               set_pte_at(mm, pvmw.address, pvmw.pte, pteval);
+                               set_pte_at(mm, address, pvmw.pte, pteval);
                                SetPageSwapBacked(page);
                                ret = false;
                                page_vma_mapped_walk_done(&pvmw);
@@ -1472,7 +1493,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                        }
 
                        if (swap_duplicate(entry) < 0) {
-                               set_pte_at(mm, pvmw.address, pvmw.pte, pteval);
+                               set_pte_at(mm, address, pvmw.pte, pteval);
                                ret = false;
                                page_vma_mapped_walk_done(&pvmw);
                                break;
@@ -1488,18 +1509,18 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                        swp_pte = swp_entry_to_pte(entry);
                        if (pte_soft_dirty(pteval))
                                swp_pte = pte_swp_mksoft_dirty(swp_pte);
-                       set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
+                       set_pte_at(mm, address, pvmw.pte, swp_pte);
                } else
                        dec_mm_counter(mm, mm_counter_file(page));
 discard:
                page_remove_rmap(subpage, PageHuge(page));
                put_page(page);
-               invalidation_needed = true;
+               mmu_notifier_invalidate_range(mm, address,
+                                             address + PAGE_SIZE);
        }
 
-       if (invalidation_needed)
-               mmu_notifier_invalidate_range(mm, address,
-                               address + (1UL << compound_order(page)));
+       mmu_notifier_invalidate_range_end(vma->vm_mm, start, end);
+
        return ret;
 }
 
index 6540e598244412023db650412062604b704b58b3..fbcb3c96a186e8bcf9758189e4d1f17f1bc00cdd 100644 (file)
@@ -3967,7 +3967,7 @@ int __init shmem_init(void)
        }
 
 #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
-       if (has_transparent_hugepage() && shmem_huge < SHMEM_HUGE_DENY)
+       if (has_transparent_hugepage() && shmem_huge > SHMEM_HUGE_DENY)
                SHMEM_SB(shm_mnt->mnt_sb)->huge = shmem_huge;
        else
                shmem_huge = 0; /* just in case it was patched */
@@ -4028,7 +4028,7 @@ static ssize_t shmem_enabled_store(struct kobject *kobj,
                return -EINVAL;
 
        shmem_huge = huge;
-       if (shmem_huge < SHMEM_HUGE_DENY)
+       if (shmem_huge > SHMEM_HUGE_DENY)
                SHMEM_SB(shm_mnt->mnt_sb)->huge = shmem_huge;
        return count;
 }
index 2b720fa35c4ff7c2ae906e9e76d13d27a2b2f008..e18500151236ed3b162cebcf24966957e58be484 100644 (file)
@@ -421,6 +421,9 @@ static void svc_data_ready(struct sock *sk)
                dprintk("svc: socket %p(inet %p), busy=%d\n",
                        svsk, sk,
                        test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags));
+
+               /* Refer to svc_setup_socket() for details. */
+               rmb();
                svsk->sk_odata(sk);
                if (!test_and_set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags))
                        svc_xprt_enqueue(&svsk->sk_xprt);
@@ -437,6 +440,9 @@ static void svc_write_space(struct sock *sk)
        if (svsk) {
                dprintk("svc: socket %p(inet %p), write_space busy=%d\n",
                        svsk, sk, test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags));
+
+               /* Refer to svc_setup_socket() for details. */
+               rmb();
                svsk->sk_owspace(sk);
                svc_xprt_enqueue(&svsk->sk_xprt);
        }
@@ -760,8 +766,12 @@ static void svc_tcp_listen_data_ready(struct sock *sk)
        dprintk("svc: socket %p TCP (listen) state change %d\n",
                sk, sk->sk_state);
 
-       if (svsk)
+       if (svsk) {
+               /* Refer to svc_setup_socket() for details. */
+               rmb();
                svsk->sk_odata(sk);
+       }
+
        /*
         * This callback may called twice when a new connection
         * is established as a child socket inherits everything
@@ -794,6 +804,8 @@ static void svc_tcp_state_change(struct sock *sk)
        if (!svsk)
                printk("svc: socket %p: no user data\n", sk);
        else {
+               /* Refer to svc_setup_socket() for details. */
+               rmb();
                svsk->sk_ostate(sk);
                if (sk->sk_state != TCP_ESTABLISHED) {
                        set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags);
@@ -1381,12 +1393,18 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
                return ERR_PTR(err);
        }
 
-       inet->sk_user_data = svsk;
        svsk->sk_sock = sock;
        svsk->sk_sk = inet;
        svsk->sk_ostate = inet->sk_state_change;
        svsk->sk_odata = inet->sk_data_ready;
        svsk->sk_owspace = inet->sk_write_space;
+       /*
+        * This barrier is necessary in order to prevent race condition
+        * with svc_data_ready(), svc_listen_data_ready() and others
+        * when calling callbacks above.
+        */
+       wmb();
+       inet->sk_user_data = svsk;
 
        /* Initialize the socket */
        if (sock->type == SOCK_DGRAM)
index dd8e2dde0b34b3759fe6061eb5c2887f4ecd21fd..9ffd3dda3889c56a7a72229bed21ff5c49d62856 100644 (file)
@@ -85,8 +85,8 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
 
 # try-run
 # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
-# Exit code chooses option. "$$TMP" is can be used as temporary file and
-# is automatically cleaned up.
+# Exit code chooses option. "$$TMP" serves as a temporary file and is
+# automatically cleaned up.
 try-run = $(shell set -e;              \
        TMP="$(TMPOUT).$$$$.tmp";       \
        TMPO="$(TMPOUT).$$$$.o";        \
@@ -261,7 +261,6 @@ make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
 any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
 
 # Execute command if command has changed or prerequisite(s) are updated.
-#
 if_changed = $(if $(strip $(any-prereq) $(arg-check)),                       \
        @set -e;                                                             \
        $(echo-cmd) $(cmd_$(1));                                             \
@@ -315,7 +314,7 @@ if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ),                 \
        $(rule_$(1)), @:)
 
 ###
-# why - tell why a a target got build
+# why - tell why a target got built
 #       enabled by make V=2
 #       Output (listed in the order they are checked):
 #          (1) - due to target is PHONY
index 95f7d80901524a4c966505397af6931f3e3316f3..a6c8c17808551aa146102ccb4132f8f5605ea74d 100644 (file)
@@ -1,9 +1,9 @@
 # include/asm-generic contains a lot of files that are used
 # verbatim by several architectures.
 #
-# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild
+# This Makefile reads the file arch/$(SRCARCH)/include/$(src)/Kbuild
 # and for each file listed in this file with generic-y creates
-# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm)
+# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src))
 
 kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild
 -include $(kbuild-file)
index 4a9a2cec0a1b52d601f9f057eb8fbb515e69de50..f6152c70f7f417ca234da77c8a503a6c974bcec2 100644 (file)
@@ -229,8 +229,8 @@ ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
 endif
 # Due to recursion, we must skip empty.o.
 # The empty.o file is created in the make process in order to determine
-#  the target endianness and word size. It is made before all other C
-#  files, including recordmcount.
+# the target endianness and word size. It is made before all other C
+# files, including recordmcount.
 sub_cmd_record_mcount =                                        \
        if [ $(@) != "scripts/mod/empty.o" ]; then      \
                $(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)";   \
@@ -245,13 +245,13 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
        "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
        "$(if $(part-of-module),1,0)" "$(@)";
 recordmcount_source := $(srctree)/scripts/recordmcount.pl
-endif
+endif # BUILD_C_RECORDMCOUNT
 cmd_record_mcount =                                            \
        if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" =   \
             "$(CC_FLAGS_FTRACE)" ]; then                       \
                $(sub_cmd_record_mcount)                        \
        fi;
-endif
+endif # CONFIG_FTRACE_MCOUNT_RECORD
 
 ifdef CONFIG_STACK_VALIDATION
 ifneq ($(SKIP_STACK_VALIDATION),1)
index 34614a48b717eafa2c15f418e6e6769905e32ec1..993fb85982df2df2a7f8e20780d0cfbe3cb732e8 100644 (file)
@@ -14,7 +14,7 @@ src := $(obj)
 PHONY := __dtbs_install
 __dtbs_install:
 
-export dtbinst-root ?= $(obj)
+export dtbinst_root ?= $(obj)
 
 include include/config/auto.conf
 include scripts/Kbuild.include
@@ -27,7 +27,7 @@ dtbinst-dirs  := $(dts-dirs)
 quiet_cmd_dtb_install =        INSTALL $<
       cmd_dtb_install =        mkdir -p $(2); cp $< $(2)
 
-install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
+install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
 
 $(dtbinst-files): %.dtb: $(obj)/%.dtb
        $(call cmd,dtb_install,$(install-dir))
index ec10d9345bc2d9b978d8cae4d85bf2fd89ab121c..0372b33febe52f74978420c2c559adef5e815374 100644 (file)
@@ -1,5 +1,5 @@
 ###
-# Makefile.basic lists the most basic programs used during the build process.
+# This Makefile lists the most basic programs used during the build process.
 # The programs listed herein are what are needed to do the basic stuff,
 # such as fix file dependencies.
 # This initial step is needed to avoid files to be recompiled
index fff818b92acb7e3e469ce06cc722f3ab0f275171..bbf62cb1f8190917e930d7003eddbf20f0fececc 100644 (file)
@@ -25,7 +25,7 @@
  *
  * So we play the same trick that "mkdep" played before. We replace
  * the dependency on autoconf.h by a dependency on every config
- * option which is mentioned in any of the listed prequisites.
+ * option which is mentioned in any of the listed prerequisites.
  *
  * kconfig populates a tree in include/config/ with an empty file
  * for each config symbol and when the configuration is updated
@@ -34,7 +34,7 @@
  * the config symbols are rebuilt.
  *
  * So if the user changes his CONFIG_HIS_DRIVER option, only the objects
- * which depend on "include/linux/config/his/driver.h" will be rebuilt,
+ * which depend on "include/config/his/driver.h" will be rebuilt,
  * so most likely only his driver ;-)
  *
  * The idea above dates, by the way, back to Michael E Chastain, AFAIK.
@@ -75,7 +75,7 @@
  * and then basically copies the .<target>.d file to stdout, in the
  * process filtering out the dependency on autoconf.h and adding
  * dependencies on include/config/my/option.h for every
- * CONFIG_MY_OPTION encountered in any of the prequisites.
+ * CONFIG_MY_OPTION encountered in any of the prerequisites.
  *
  * It will also filter out all the dependencies on *.ver. We need
  * to make sure that the generated version checksum are globally up
index 4b72b530c84f1f4b4e98d8342d9d62fefe8d34d6..62ea8f83d4a023a9780c6dc219d8f29ba244c506 100644 (file)
@@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no
        while (size--)
                reg = (reg << 32) | fdt32_to_cpu(*(cells++));
 
-       snprintf(unit_addr, sizeof(unit_addr), "%zx", reg);
+       snprintf(unit_addr, sizeof(unit_addr), "%llx", (unsigned long long)reg);
        if (!streq(unitname, unit_addr))
                FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
                     node->fullpath, unit_addr);
index 3c6be1452e35dfc48e74ad23e1668c633ce57b24..4525e127afd904e62f34af00e26ccee52252b460 100644 (file)
@@ -1137,7 +1137,7 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol,
                mutex_lock(&ue->card->user_ctl_lock);
                change = ue->tlv_data_size != size;
                if (!change)
-                       change = memcmp(ue->tlv_data, new_data, size);
+                       change = memcmp(ue->tlv_data, new_data, size) != 0;
                kfree(ue->tlv_data);
                ue->tlv_data = new_data;
                ue->tlv_data_size = size;
index 22995cb3bd447ee0744e142b9a6500b706d85853..cf0433f8006772392061b0cf95514a266a44f948 100644 (file)
@@ -3064,6 +3064,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
 {
        snd_pcm_uframes_t *frames = arg;
        snd_pcm_sframes_t result;
+       int err;
        
        switch (cmd) {
        case SNDRV_PCM_IOCTL_FORWARD:
@@ -3083,7 +3084,10 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
        case SNDRV_PCM_IOCTL_START:
                return snd_pcm_start_lock_irq(substream);
        case SNDRV_PCM_IOCTL_DRAIN:
-               return snd_pcm_drain(substream, NULL);
+               snd_power_lock(substream->pcm->card);
+               err = snd_pcm_drain(substream, NULL);
+               snd_power_unlock(substream->pcm->card);
+               return err;
        case SNDRV_PCM_IOCTL_DROP:
                return snd_pcm_drop(substream);
        case SNDRV_PCM_IOCTL_DELAY:
index f0e4d502d60482ae8374cf9f830b739eb9e38753..066b5df666f42d2259b40ee5d21492f9165e4470 100644 (file)
@@ -210,9 +210,14 @@ EXPORT_SYMBOL(fw_iso_resources_update);
  */
 void fw_iso_resources_free(struct fw_iso_resources *r)
 {
-       struct fw_card *card = fw_parent_device(r->unit)->card;
+       struct fw_card *card;
        int bandwidth, channel;
 
+       /* Not initialized. */
+       if (r->unit == NULL)
+               return;
+       card = fw_parent_device(r->unit)->card;
+
        mutex_lock(&r->mutex);
 
        if (r->allocated) {
index bf779cfeef0dfaea62ea5684997314a9fe02d4c0..59a270406353d71563f2473ff1675116729acda9 100644 (file)
@@ -128,6 +128,7 @@ static void do_registration(struct work_struct *work)
        return;
 error:
        snd_motu_transaction_unregister(motu);
+       snd_motu_stream_destroy_duplex(motu);
        snd_card_free(motu->card);
        dev_info(&motu->unit->device,
                 "Sound card registration failed: %d\n", err);
index 8c1289963c802b34783a8a8b4af42ed55bbcd71c..a81aacf684b26341ec9257366d7c83a47962a16d 100644 (file)
@@ -947,6 +947,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
        SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
+       SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
        SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
index 0ec7985ed306612db13bd6314ccc94733e835cce..054b613cb0d04c9dabe3e67e647448845708b29e 100644 (file)
@@ -567,7 +567,7 @@ int rt5670_set_jack_detect(struct snd_soc_codec *codec,
 
        rt5670->jack = jack;
        rt5670->hp_gpio.gpiod_dev = codec->dev;
-       rt5670->hp_gpio.name = "headphone detect";
+       rt5670->hp_gpio.name = "headset";
        rt5670->hp_gpio.report = SND_JACK_HEADSET |
                SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2;
        rt5670->hp_gpio.debounce_time = 150;
index 36e530a36c8241d5005c8e8f5f933f2a405c3434..6f629278d982d23e53baf1bd7819e2103e7e02b7 100644 (file)
@@ -5021,6 +5021,7 @@ static const struct regmap_config rt5677_regmap = {
 static const struct i2c_device_id rt5677_i2c_id[] = {
        { "rt5677", RT5677 },
        { "rt5676", RT5676 },
+       { "RT5677CE:00", RT5677 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id);
index 7d7ab4aee42e3ab133926f2dc5b11489b93a28ae..d72f7d58102f7666740866eb3b8b213604df4e54 100644 (file)
@@ -132,7 +132,7 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 
        /* Parse the card name from DT */
        ret = snd_soc_of_parse_card_name(card, "label");
-       if (ret < 0) {
+       if (ret < 0 || !card->name) {
                char prop[128];
 
                snprintf(prop, sizeof(prop), "%sname", prefix);
index bc2a52de06a39729ac6aae83c38e08e822575445..f597d558222388e0b52302395ecfbf22a5a127d7 100644 (file)
@@ -184,6 +184,13 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
        return 0;
 }
 
+static const struct acpi_gpio_params headset_gpios = { 0, 0, false };
+
+static const struct acpi_gpio_mapping cht_rt5672_gpios[] = {
+       { "headset-gpios", &headset_gpios, 1 },
+       {},
+};
+
 static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 {
        int ret;
@@ -191,6 +198,9 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
        struct snd_soc_codec *codec = codec_dai->codec;
        struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
 
+       if (devm_acpi_dev_add_driver_gpios(codec->dev, cht_rt5672_gpios))
+               dev_warn(runtime->dev, "Unable to add GPIO mapping table\n");
+
        /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
        ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24);
        if (ret < 0) {
index 6a03f9697039cc3d157bba92d5253b328e6ad45d..5d2a63248b1d4e77b1bf3edde93ba86710d08f38 100644 (file)
@@ -1309,10 +1309,13 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
            && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
                mdelay(20);
 
-       /* Zoom R16/24 needs a tiny delay here, otherwise requests like
-        * get/set frequency return as failed despite actually succeeding.
+       /* Zoom R16/24, Logitech H650e, Jabra 550a needs a tiny delay here,
+        * otherwise requests like get/set frequency return as failed despite
+        * actually succeeding.
         */
-       if (chip->usb_id == USB_ID(0x1686, 0x00dd) &&
+       if ((chip->usb_id == USB_ID(0x1686, 0x00dd) ||
+            chip->usb_id == USB_ID(0x046d, 0x0a46) ||
+            chip->usb_id == USB_ID(0x0b0e, 0x0349)) &&
            (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
                mdelay(1);
 }
index a36c2eba64e7729347e46175a11f89ff5fe8ebbe..4559a21a8de2d788b5242bc4e8df92c484a10764 100644 (file)
@@ -271,7 +271,7 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
        case 0x8d:
                if (rex == 0x48 && modrm == 0x65) {
 
-                       /* lea -disp(%rbp), %rsp */
+                       /* lea disp(%rbp), %rsp */
                        *type = INSN_STACK;
                        op->src.type = OP_SRC_ADD;
                        op->src.reg = CFI_BP;
@@ -281,6 +281,30 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
                        break;
                }
 
+               if (rex == 0x48 && (modrm == 0xa4 || modrm == 0x64) &&
+                   sib == 0x24) {
+
+                       /* lea disp(%rsp), %rsp */
+                       *type = INSN_STACK;
+                       op->src.type = OP_SRC_ADD;
+                       op->src.reg = CFI_SP;
+                       op->src.offset = insn.displacement.value;
+                       op->dest.type = OP_DEST_REG;
+                       op->dest.reg = CFI_SP;
+                       break;
+               }
+
+               if (rex == 0x48 && modrm == 0x2c && sib == 0x24) {
+
+                       /* lea (%rsp), %rbp */
+                       *type = INSN_STACK;
+                       op->src.type = OP_SRC_REG;
+                       op->src.reg = CFI_SP;
+                       op->dest.type = OP_DEST_REG;
+                       op->dest.reg = CFI_BP;
+                       break;
+               }
+
                if (rex == 0x4c && modrm == 0x54 && sib == 0x24 &&
                    insn.displacement.value == 8) {
 
index 1c12b5855e4f929c75706a4adf0d117931e29dec..5fc7ad359e2195ed45588091df4b0a439f15551c 100755 (executable)
@@ -333,6 +333,10 @@ function ntb_tool_tests()
        link_test $LOCAL_TOOL $REMOTE_TOOL
        link_test $REMOTE_TOOL $LOCAL_TOOL
 
+       #Ensure the link is up on both sides before continuing
+       write_file Y $LOCAL_TOOL/link_event
+       write_file Y $REMOTE_TOOL/link_event
+
        for PEER_TRANS in $(ls $LOCAL_TOOL/peer_trans*); do
                PT=$(basename $PEER_TRANS)
                write_file $MW_SIZE $LOCAL_TOOL/$PT
index 15252d723b54e196d864d29a7aac2040686dc59a..4d81f6ded88e823c064e72eff3a98a37b68125a8 100644 (file)
@@ -322,47 +322,6 @@ static inline struct kvm *mmu_notifier_to_kvm(struct mmu_notifier *mn)
        return container_of(mn, struct kvm, mmu_notifier);
 }
 
-static void kvm_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
-                                            struct mm_struct *mm,
-                                            unsigned long address)
-{
-       struct kvm *kvm = mmu_notifier_to_kvm(mn);
-       int need_tlb_flush, idx;
-
-       /*
-        * When ->invalidate_page runs, the linux pte has been zapped
-        * already but the page is still allocated until
-        * ->invalidate_page returns. So if we increase the sequence
-        * here the kvm page fault will notice if the spte can't be
-        * established because the page is going to be freed. If
-        * instead the kvm page fault establishes the spte before
-        * ->invalidate_page runs, kvm_unmap_hva will release it
-        * before returning.
-        *
-        * The sequence increase only need to be seen at spin_unlock
-        * time, and not at spin_lock time.
-        *
-        * Increasing the sequence after the spin_unlock would be
-        * unsafe because the kvm page fault could then establish the
-        * pte after kvm_unmap_hva returned, without noticing the page
-        * is going to be freed.
-        */
-       idx = srcu_read_lock(&kvm->srcu);
-       spin_lock(&kvm->mmu_lock);
-
-       kvm->mmu_notifier_seq++;
-       need_tlb_flush = kvm_unmap_hva(kvm, address) | kvm->tlbs_dirty;
-       /* we've to flush the tlb before the pages can be freed */
-       if (need_tlb_flush)
-               kvm_flush_remote_tlbs(kvm);
-
-       spin_unlock(&kvm->mmu_lock);
-
-       kvm_arch_mmu_notifier_invalidate_page(kvm, address);
-
-       srcu_read_unlock(&kvm->srcu, idx);
-}
-
 static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
                                        struct mm_struct *mm,
                                        unsigned long address,
@@ -510,7 +469,6 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
 }
 
 static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
-       .invalidate_page        = kvm_mmu_notifier_invalidate_page,
        .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start,
        .invalidate_range_end   = kvm_mmu_notifier_invalidate_range_end,
        .clear_flush_young      = kvm_mmu_notifier_clear_flush_young,