aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-05-09 11:21:49 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-05-09 11:21:49 -0400
commita022f9347a30b56dc503811a62b8e4b9c36e9a15 (patch)
tree57ad302915383a43bac8b845ae029529b9066e5d
parentf73696275e64d55c59947b42979b531cb026d718 (diff)
parent44549e8f5eea4e0a41b487b63e616cb089922b99 (diff)
Merge tag 'v4.6-rc7' into patchwork
Linux 4.6-rc7 * tag 'v4.6-rc7': (185 commits) Linux 4.6-rc7 parisc: fix a bug when syscall number of tracee is __NR_Linux_syscalls x86/tsc: Read all ratio bits from MSR_PLATFORM_INFO mailmap: add John Paul Adrian Glaubitz byteswap: try to avoid __builtin_constant_p gcc bug lib/stackdepot: avoid to return 0 handle mm: fix kcompactd hang during memory offlining modpost: fix module autoloading for OF devices with generic compatible property proc: prevent accessing /proc/<PID>/environ until it's ready mm/zswap: provide unique zpool name mm: thp: kvm: fix memory corruption in KVM with THP enabled MAINTAINERS: fix Rajendra Nayak's address mm, cma: prevent nr_isolated_* counters from going negative mm: update min_free_kbytes from khugepaged after core initialization huge pagecache: mmap_sem is unlocked when truncation splits pmd rapidio/mport_cdev: fix uapi type definitions mm: memcontrol: let v2 cgroups follow changes in system swappiness mm: thp: correct split_huge_pages file permission maintainers: update rmk's email address(es) writeback: Fix performance regression in wb_over_bg_thresh() ...
-rw-r--r--.mailmap1
-rw-r--r--Documentation/devicetree/bindings/ata/ahci-platform.txt4
-rw-r--r--Documentation/devicetree/bindings/net/cpsw.txt6
-rw-r--r--Documentation/networking/altera_tse.txt6
-rw-r--r--Documentation/networking/ipvlan.txt6
-rw-r--r--Documentation/networking/pktgen.txt6
-rw-r--r--Documentation/networking/vrf.txt2
-rw-r--r--Documentation/networking/xfrm_sync.txt6
-rw-r--r--MAINTAINERS61
-rw-r--r--Makefile2
-rw-r--r--arch/arc/Kconfig13
-rw-r--r--arch/arc/include/asm/io.h27
-rw-r--r--arch/arc/include/asm/mmzone.h43
-rw-r--r--arch/arc/include/asm/page.h15
-rw-r--r--arch/arc/include/asm/pgtable.h13
-rw-r--r--arch/arc/mm/init.c54
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts9
-rw-r--r--arch/arm/boot/dts/omap34xx.dtsi2
-rw-r--r--arch/arm/boot/dts/omap5-board-common.dtsi4
-rw-r--r--arch/arm/boot/dts/omap5-cm-t54.dts4
-rw-r--r--arch/arm/boot/dts/omap5.dtsi2
-rw-r--r--arch/arm/boot/dts/qcom-apq8064.dtsi3
-rw-r--r--arch/arm/boot/dts/sun8i-q8-common.dtsi2
-rw-r--r--arch/arm/include/asm/domain.h11
-rw-r--r--arch/arm/kernel/head-nommu.S2
-rw-r--r--arch/arm/kvm/mmu.c2
-rw-r--r--arch/arm/mach-davinci/board-mityomapl138.c5
-rw-r--r--arch/arm/mach-davinci/common.c5
-rw-r--r--arch/arm/mach-exynos/pm_domains.c2
-rw-r--r--arch/arm/mach-socfpga/headsmp.S1
-rw-r--r--arch/arm/mm/nommu.c15
-rw-r--r--arch/arm64/boot/dts/renesas/r8a7795.dtsi1
-rw-r--r--arch/parisc/kernel/syscall.S2
-rw-r--r--arch/powerpc/include/asm/word-at-a-time.h2
-rw-r--r--arch/sparc/configs/sparc32_defconfig1
-rw-r--r--arch/sparc/configs/sparc64_defconfig1
-rw-r--r--arch/sparc/include/asm/spitfire.h1
-rw-r--r--arch/sparc/include/uapi/asm/unistd.h4
-rw-r--r--arch/sparc/kernel/cherrs.S14
-rw-r--r--arch/sparc/kernel/cpu.c6
-rw-r--r--arch/sparc/kernel/cpumap.c1
-rw-r--r--arch/sparc/kernel/fpu_traps.S11
-rw-r--r--arch/sparc/kernel/head_64.S32
-rw-r--r--arch/sparc/kernel/misctrap.S12
-rw-r--r--arch/sparc/kernel/pci.c42
-rw-r--r--arch/sparc/kernel/setup_64.c7
-rw-r--r--arch/sparc/kernel/spiterrs.S18
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/sparc/kernel/utrap.S3
-rw-r--r--arch/sparc/kernel/vio.c18
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S4
-rw-r--r--arch/sparc/kernel/winfixup.S3
-rw-r--r--arch/sparc/mm/init_64.c3
-rw-r--r--arch/x86/events/amd/iommu.c1
-rw-r--r--arch/x86/events/intel/core.c2
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c4
-rw-r--r--arch/x86/kernel/sysfb_efi.c14
-rw-r--r--arch/x86/kernel/tsc_msr.c2
-rw-r--r--arch/x86/kvm/mmu.c4
-rw-r--r--arch/x86/platform/efi/efi-bgrt.c18
-rw-r--r--drivers/acpi/acpica/dsmethod.c3
-rw-r--r--drivers/acpi/nfit.c5
-rw-r--r--drivers/ata/Kconfig8
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/ahci_platform.c3
-rw-r--r--drivers/ata/ahci_seattle.c210
-rw-r--r--drivers/ata/libahci.c1
-rw-r--r--drivers/base/power/opp/core.c3
-rw-r--r--drivers/base/property.c2
-rw-r--r--drivers/clk/imx/clk-imx6q.c2
-rw-r--r--drivers/cpufreq/cpufreq.c26
-rw-r--r--drivers/cpufreq/intel_pstate.c26
-rw-r--r--drivers/cpufreq/sti-cpufreq.c4
-rw-r--r--drivers/cpuidle/cpuidle-arm.c2
-rw-r--r--drivers/firmware/qemu_fw_cfg.c2
-rw-r--r--drivers/gpio/gpio-rcar.c65
-rw-r--r--drivers/gpio/gpiolib-acpi.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/atombios_encoders.c4
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c32
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h9
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c22
-rw-r--r--drivers/gpu/drm/i915/intel_display.c3
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c4
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c12
-rw-r--r--drivers/gpu/drm/radeon/atombios_encoders.c4
-rw-r--r--drivers/gpu/ipu-v3/ipu-common.c7
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hid/wacom_wac.c6
-rw-r--r--drivers/hv/ring_buffer.c26
-rw-r--r--drivers/iio/adc/at91-sama5d2_adc.c2
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c30
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c3
-rw-r--r--drivers/iio/magnetometer/ak8975.c6
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c14
-rw-r--r--drivers/input/misc/twl6040-vibra.c16
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c28
-rw-r--r--drivers/input/touchscreen/zforce_ts.c4
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/md/raid0.c2
-rw-r--r--drivers/md/raid5.c2
-rw-r--r--drivers/media/media-device.c8
-rw-r--r--drivers/media/platform/exynos4-is/media-dev.c13
-rw-r--r--drivers/media/platform/s3c-camif/camif-core.c12
-rw-r--r--drivers/misc/mic/vop/vop_vringh.c5
-rw-r--r--drivers/net/dsa/mv88e6xxx.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c53
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.h13
-rw-r--r--drivers/net/ethernet/cadence/macb.c34
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c3
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c6
-rw-r--r--drivers/net/ethernet/marvell/pxa168_eth.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/Kconfig1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c34
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/uar.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/vxlan.c50
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/vxlan.h11
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c4
-rw-r--r--drivers/net/ethernet/sfc/ef10.c15
-rw-r--r--drivers/net/ethernet/ti/cpsw.c67
-rw-r--r--drivers/net/ethernet/ti/cpsw.h1
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c5
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_wireless.c2
-rw-r--r--drivers/net/phy/at803x.c40
-rw-r--r--drivers/net/usb/lan78xx.c44
-rw-r--r--drivers/net/usb/pegasus.c10
-rw-r--r--drivers/net/usb/smsc75xx.c12
-rw-r--r--drivers/net/usb/smsc95xx.c12
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_phy.c5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-8000.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-drv.c26
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c10
-rw-r--r--drivers/nvdimm/pmem.c13
-rw-r--r--drivers/nvmem/mxs-ocotp.c4
-rw-r--r--drivers/rapidio/devices/rio_mport_cdev.c115
-rw-r--r--drivers/usb/core/port.c6
-rw-r--r--drivers/usb/core/usb.c8
-rw-r--r--drivers/usb/musb/jz4740.c4
-rw-r--r--drivers/usb/musb/musb_gadget.c6
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/serial/cp210x.c4
-rw-r--r--drivers/virtio/virtio_ring.c2
-rw-r--r--drivers/xen/balloon.c16
-rw-r--r--drivers/xen/evtchn.c20
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/pnode.c25
-rw-r--r--fs/proc/base.c3
-rw-r--r--fs/udf/super.c4
-rw-r--r--fs/udf/udfdecl.h2
-rw-r--r--fs/udf/unicode.c16
-rw-r--r--include/acpi/acpi_bus.h4
-rw-r--r--include/linux/bpf.h3
-rw-r--r--include/linux/hash.h20
-rw-r--r--include/linux/if_ether.h5
-rw-r--r--include/linux/net.h10
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/of.h2
-rw-r--r--include/linux/page-flags.h22
-rw-r--r--include/linux/swap.h4
-rw-r--r--include/net/vxlan.h4
-rw-r--r--include/uapi/asm-generic/unistd.h4
-rw-r--r--include/uapi/linux/rio_mport_cdev.h (renamed from include/linux/rio_mport_cdev.h)144
-rw-r--r--include/uapi/linux/swab.h24
-rw-r--r--include/xen/page.h4
-rw-r--r--kernel/bpf/inode.c7
-rw-r--r--kernel/bpf/syscall.c24
-rw-r--r--kernel/bpf/verifier.c76
-rw-r--r--kernel/sched/core.c29
-rw-r--r--kernel/trace/trace_events.c9
-rw-r--r--lib/stackdepot.c6
-rw-r--r--mm/compaction.c14
-rw-r--r--mm/huge_memory.c4
-rw-r--r--mm/memory.c11
-rw-r--r--mm/page-writeback.c6
-rw-r--r--mm/page_alloc.c2
-rw-r--r--mm/zswap.c8
-rw-r--r--net/batman-adv/bat_v.c12
-rw-r--r--net/batman-adv/distributed-arp-table.c17
-rw-r--r--net/batman-adv/hard-interface.c6
-rw-r--r--net/batman-adv/originator.c17
-rw-r--r--net/batman-adv/routing.c9
-rw-r--r--net/batman-adv/send.c6
-rw-r--r--net/batman-adv/soft-interface.c8
-rw-r--r--net/batman-adv/translation-table.c42
-rw-r--r--net/batman-adv/types.h7
-rw-r--r--net/core/dev.c2
-rw-r--r--net/ipv4/inet_hashtables.c2
-rw-r--r--net/ipv4/ip_gre.c30
-rw-r--r--net/ipv4/ip_tunnel.c4
-rw-r--r--net/ipv6/ila/ila_lwt.c3
-rw-r--r--net/l2tp/l2tp_core.c4
-rw-r--r--net/mac80211/iface.c4
-rw-r--r--net/rds/tcp.c3
-rw-r--r--net/rds/tcp.h4
-rw-r--r--net/rds/tcp_connect.c8
-rw-r--r--net/rds/tcp_listen.c54
-rw-r--r--net/sched/sch_netem.c61
-rw-r--r--net/tipc/node.c5
-rw-r--r--samples/bpf/trace_output_kern.c1
-rw-r--r--scripts/mod/file2alias.c69
-rw-r--r--security/integrity/ima/ima_policy.c4
208 files changed, 1863 insertions, 923 deletions
diff --git a/.mailmap b/.mailmap
index c156a8b4d845..08b80428f583 100644
--- a/.mailmap
+++ b/.mailmap
@@ -69,6 +69,7 @@ Jean Tourrilhes <jt@hpl.hp.com>
69Jeff Garzik <jgarzik@pretzel.yyz.us> 69Jeff Garzik <jgarzik@pretzel.yyz.us>
70Jens Axboe <axboe@suse.de> 70Jens Axboe <axboe@suse.de>
71Jens Osterkamp <Jens.Osterkamp@de.ibm.com> 71Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
72John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
72John Stultz <johnstul@us.ibm.com> 73John Stultz <johnstul@us.ibm.com>
73<josh@joshtriplett.org> <josh@freedesktop.org> 74<josh@joshtriplett.org> <josh@freedesktop.org>
74<josh@joshtriplett.org> <josh@kernel.org> 75<josh@joshtriplett.org> <josh@kernel.org>
diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
index 30df832a6f2f..87adfb227ca9 100644
--- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
@@ -32,6 +32,10 @@ Optional properties:
32- target-supply : regulator for SATA target power 32- target-supply : regulator for SATA target power
33- phys : reference to the SATA PHY node 33- phys : reference to the SATA PHY node
34- phy-names : must be "sata-phy" 34- phy-names : must be "sata-phy"
35- ports-implemented : Mask that indicates which ports that the HBA supports
36 are available for software to use. Useful if PORTS_IMPL
37 is not programmed by the BIOS, which is true with
38 some embedded SOC's.
35 39
36Required properties when using sub-nodes: 40Required properties when using sub-nodes:
37- #address-cells : number of cells to encode an address 41- #address-cells : number of cells to encode an address
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
index 28a4781ab6d7..0ae06491b430 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -45,13 +45,13 @@ Required properties:
45Optional properties: 45Optional properties:
46- dual_emac_res_vlan : Specifies VID to be used to segregate the ports 46- dual_emac_res_vlan : Specifies VID to be used to segregate the ports
47- mac-address : See ethernet.txt file in the same directory 47- mac-address : See ethernet.txt file in the same directory
48- phy_id : Specifies slave phy id 48- phy_id : Specifies slave phy id (deprecated, use phy-handle)
49- phy-handle : See ethernet.txt file in the same directory 49- phy-handle : See ethernet.txt file in the same directory
50 50
51Slave sub-nodes: 51Slave sub-nodes:
52- fixed-link : See fixed-link.txt file in the same directory 52- fixed-link : See fixed-link.txt file in the same directory
53 Either the property phy_id, or the sub-node 53
54 fixed-link can be specified 54Note: Exactly one of phy_id, phy-handle, or fixed-link must be specified.
55 55
56Note: "ti,hwmods" field is used to fetch the base address and irq 56Note: "ti,hwmods" field is used to fetch the base address and irq
57resources from TI, omap hwmod data base during device registration. 57resources from TI, omap hwmod data base during device registration.
diff --git a/Documentation/networking/altera_tse.txt b/Documentation/networking/altera_tse.txt
index 3f24df8c6e65..50b8589d12fd 100644
--- a/Documentation/networking/altera_tse.txt
+++ b/Documentation/networking/altera_tse.txt
@@ -6,7 +6,7 @@ This is the driver for the Altera Triple-Speed Ethernet (TSE) controllers
6using the SGDMA and MSGDMA soft DMA IP components. The driver uses the 6using the SGDMA and MSGDMA soft DMA IP components. The driver uses the
7platform bus to obtain component resources. The designs used to test this 7platform bus to obtain component resources. The designs used to test this
8driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board, 8driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board,
9and tested with ARM and NIOS processor hosts seperately. The anticipated use 9and tested with ARM and NIOS processor hosts separately. The anticipated use
10cases are simple communications between an embedded system and an external peer 10cases are simple communications between an embedded system and an external peer
11for status and simple configuration of the embedded system. 11for status and simple configuration of the embedded system.
12 12
@@ -65,14 +65,14 @@ Driver parameters can be also passed in command line by using:
654.1) Transmit process 654.1) Transmit process
66When the driver's transmit routine is called by the kernel, it sets up a 66When the driver's transmit routine is called by the kernel, it sets up a
67transmit descriptor by calling the underlying DMA transmit routine (SGDMA or 67transmit descriptor by calling the underlying DMA transmit routine (SGDMA or
68MSGDMA), and initites a transmit operation. Once the transmit is complete, an 68MSGDMA), and initiates a transmit operation. Once the transmit is complete, an
69interrupt is driven by the transmit DMA logic. The driver handles the transmit 69interrupt is driven by the transmit DMA logic. The driver handles the transmit
70completion in the context of the interrupt handling chain by recycling 70completion in the context of the interrupt handling chain by recycling
71resource required to send and track the requested transmit operation. 71resource required to send and track the requested transmit operation.
72 72
734.2) Receive process 734.2) Receive process
74The driver will post receive buffers to the receive DMA logic during driver 74The driver will post receive buffers to the receive DMA logic during driver
75intialization. Receive buffers may or may not be queued depending upon the 75initialization. Receive buffers may or may not be queued depending upon the
76underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able 76underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able
77to queue receive buffers to the SGDMA receive logic). When a packet is 77to queue receive buffers to the SGDMA receive logic). When a packet is
78received, the DMA logic generates an interrupt. The driver handles a receive 78received, the DMA logic generates an interrupt. The driver handles a receive
diff --git a/Documentation/networking/ipvlan.txt b/Documentation/networking/ipvlan.txt
index cf996394e466..14422f8fcdc4 100644
--- a/Documentation/networking/ipvlan.txt
+++ b/Documentation/networking/ipvlan.txt
@@ -8,7 +8,7 @@ Initial Release:
8 This is conceptually very similar to the macvlan driver with one major 8 This is conceptually very similar to the macvlan driver with one major
9exception of using L3 for mux-ing /demux-ing among slaves. This property makes 9exception of using L3 for mux-ing /demux-ing among slaves. This property makes
10the master device share the L2 with it's slave devices. I have developed this 10the master device share the L2 with it's slave devices. I have developed this
11driver in conjuntion with network namespaces and not sure if there is use case 11driver in conjunction with network namespaces and not sure if there is use case
12outside of it. 12outside of it.
13 13
14 14
@@ -42,7 +42,7 @@ out. In this mode the slaves will RX/TX multicast and broadcast (if applicable)
42as well. 42as well.
43 43
444.2 L3 mode: 444.2 L3 mode:
45 In this mode TX processing upto L3 happens on the stack instance attached 45 In this mode TX processing up to L3 happens on the stack instance attached
46to the slave device and packets are switched to the stack instance of the 46to the slave device and packets are switched to the stack instance of the
47master device for the L2 processing and routing from that instance will be 47master device for the L2 processing and routing from that instance will be
48used before packets are queued on the outbound device. In this mode the slaves 48used before packets are queued on the outbound device. In this mode the slaves
@@ -56,7 +56,7 @@ situations defines your use case then you can choose to use ipvlan -
56 (a) The Linux host that is connected to the external switch / router has 56 (a) The Linux host that is connected to the external switch / router has
57policy configured that allows only one mac per port. 57policy configured that allows only one mac per port.
58 (b) No of virtual devices created on a master exceed the mac capacity and 58 (b) No of virtual devices created on a master exceed the mac capacity and
59puts the NIC in promiscous mode and degraded performance is a concern. 59puts the NIC in promiscuous mode and degraded performance is a concern.
60 (c) If the slave device is to be put into the hostile / untrusted network 60 (c) If the slave device is to be put into the hostile / untrusted network
61namespace where L2 on the slave could be changed / misused. 61namespace where L2 on the slave could be changed / misused.
62 62
diff --git a/Documentation/networking/pktgen.txt b/Documentation/networking/pktgen.txt
index f4be85e96005..2c4e3354e128 100644
--- a/Documentation/networking/pktgen.txt
+++ b/Documentation/networking/pktgen.txt
@@ -67,12 +67,12 @@ The two basic thread commands are:
67 * add_device DEVICE@NAME -- adds a single device 67 * add_device DEVICE@NAME -- adds a single device
68 * rem_device_all -- remove all associated devices 68 * rem_device_all -- remove all associated devices
69 69
70When adding a device to a thread, a corrosponding procfile is created 70When adding a device to a thread, a corresponding procfile is created
71which is used for configuring this device. Thus, device names need to 71which is used for configuring this device. Thus, device names need to
72be unique. 72be unique.
73 73
74To support adding the same device to multiple threads, which is useful 74To support adding the same device to multiple threads, which is useful
75with multi queue NICs, a the device naming scheme is extended with "@": 75with multi queue NICs, the device naming scheme is extended with "@":
76 device@something 76 device@something
77 77
78The part after "@" can be anything, but it is custom to use the thread 78The part after "@" can be anything, but it is custom to use the thread
@@ -221,7 +221,7 @@ Sample scripts
221 221
222A collection of tutorial scripts and helpers for pktgen is in the 222A collection of tutorial scripts and helpers for pktgen is in the
223samples/pktgen directory. The helper parameters.sh file support easy 223samples/pktgen directory. The helper parameters.sh file support easy
224and consistant parameter parsing across the sample scripts. 224and consistent parameter parsing across the sample scripts.
225 225
226Usage example and help: 226Usage example and help:
227 ./pktgen_sample01_simple.sh -i eth4 -m 00:1B:21:3C:9D:F8 -d 192.168.8.2 227 ./pktgen_sample01_simple.sh -i eth4 -m 00:1B:21:3C:9D:F8 -d 192.168.8.2
diff --git a/Documentation/networking/vrf.txt b/Documentation/networking/vrf.txt
index d52aa10cfe91..5da679c573d2 100644
--- a/Documentation/networking/vrf.txt
+++ b/Documentation/networking/vrf.txt
@@ -41,7 +41,7 @@ using an rx_handler which gives the impression that packets flow through
41the VRF device. Similarly on egress routing rules are used to send packets 41the VRF device. Similarly on egress routing rules are used to send packets
42to the VRF device driver before getting sent out the actual interface. This 42to the VRF device driver before getting sent out the actual interface. This
43allows tcpdump on a VRF device to capture all packets into and out of the 43allows tcpdump on a VRF device to capture all packets into and out of the
44VRF as a whole.[1] Similiarly, netfilter [2] and tc rules can be applied 44VRF as a whole.[1] Similarly, netfilter [2] and tc rules can be applied
45using the VRF device to specify rules that apply to the VRF domain as a whole. 45using the VRF device to specify rules that apply to the VRF domain as a whole.
46 46
47[1] Packets in the forwarded state do not flow through the device, so those 47[1] Packets in the forwarded state do not flow through the device, so those
diff --git a/Documentation/networking/xfrm_sync.txt b/Documentation/networking/xfrm_sync.txt
index d7aac9dedeb4..8d88e0f2ec49 100644
--- a/Documentation/networking/xfrm_sync.txt
+++ b/Documentation/networking/xfrm_sync.txt
@@ -4,7 +4,7 @@ Krisztian <hidden@balabit.hu> and others and additional patches
4from Jamal <hadi@cyberus.ca>. 4from Jamal <hadi@cyberus.ca>.
5 5
6The end goal for syncing is to be able to insert attributes + generate 6The end goal for syncing is to be able to insert attributes + generate
7events so that the an SA can be safely moved from one machine to another 7events so that the SA can be safely moved from one machine to another
8for HA purposes. 8for HA purposes.
9The idea is to synchronize the SA so that the takeover machine can do 9The idea is to synchronize the SA so that the takeover machine can do
10the processing of the SA as accurate as possible if it has access to it. 10the processing of the SA as accurate as possible if it has access to it.
@@ -13,7 +13,7 @@ We already have the ability to generate SA add/del/upd events.
13These patches add ability to sync and have accurate lifetime byte (to 13These patches add ability to sync and have accurate lifetime byte (to
14ensure proper decay of SAs) and replay counters to avoid replay attacks 14ensure proper decay of SAs) and replay counters to avoid replay attacks
15with as minimal loss at failover time. 15with as minimal loss at failover time.
16This way a backup stays as closely uptodate as an active member. 16This way a backup stays as closely up-to-date as an active member.
17 17
18Because the above items change for every packet the SA receives, 18Because the above items change for every packet the SA receives,
19it is possible for a lot of the events to be generated. 19it is possible for a lot of the events to be generated.
@@ -163,7 +163,7 @@ If you have an SA that is getting hit by traffic in bursts such that
163there is a period where the timer threshold expires with no packets 163there is a period where the timer threshold expires with no packets
164seen, then an odd behavior is seen as follows: 164seen, then an odd behavior is seen as follows:
165The first packet arrival after a timer expiry will trigger a timeout 165The first packet arrival after a timer expiry will trigger a timeout
166aevent; i.e we dont wait for a timeout period or a packet threshold 166event; i.e we don't wait for a timeout period or a packet threshold
167to be reached. This is done for simplicity and efficiency reasons. 167to be reached. This is done for simplicity and efficiency reasons.
168 168
169-JHS 169-JHS
diff --git a/MAINTAINERS b/MAINTAINERS
index 388ae3650597..090bec2c2398 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -872,9 +872,9 @@ F: drivers/perf/arm_pmu.c
872F: include/linux/perf/arm_pmu.h 872F: include/linux/perf/arm_pmu.h
873 873
874ARM PORT 874ARM PORT
875M: Russell King <linux@arm.linux.org.uk> 875M: Russell King <linux@armlinux.org.uk>
876L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 876L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
877W: http://www.arm.linux.org.uk/ 877W: http://www.armlinux.org.uk/
878S: Maintained 878S: Maintained
879F: arch/arm/ 879F: arch/arm/
880 880
@@ -886,35 +886,35 @@ F: arch/arm/plat-*/
886T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git 886T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
887 887
888ARM PRIMECELL AACI PL041 DRIVER 888ARM PRIMECELL AACI PL041 DRIVER
889M: Russell King <linux@arm.linux.org.uk> 889M: Russell King <linux@armlinux.org.uk>
890S: Maintained 890S: Maintained
891F: sound/arm/aaci.* 891F: sound/arm/aaci.*
892 892
893ARM PRIMECELL CLCD PL110 DRIVER 893ARM PRIMECELL CLCD PL110 DRIVER
894M: Russell King <linux@arm.linux.org.uk> 894M: Russell King <linux@armlinux.org.uk>
895S: Maintained 895S: Maintained
896F: drivers/video/fbdev/amba-clcd.* 896F: drivers/video/fbdev/amba-clcd.*
897 897
898ARM PRIMECELL KMI PL050 DRIVER 898ARM PRIMECELL KMI PL050 DRIVER
899M: Russell King <linux@arm.linux.org.uk> 899M: Russell King <linux@armlinux.org.uk>
900S: Maintained 900S: Maintained
901F: drivers/input/serio/ambakmi.* 901F: drivers/input/serio/ambakmi.*
902F: include/linux/amba/kmi.h 902F: include/linux/amba/kmi.h
903 903
904ARM PRIMECELL MMCI PL180/1 DRIVER 904ARM PRIMECELL MMCI PL180/1 DRIVER
905M: Russell King <linux@arm.linux.org.uk> 905M: Russell King <linux@armlinux.org.uk>
906S: Maintained 906S: Maintained
907F: drivers/mmc/host/mmci.* 907F: drivers/mmc/host/mmci.*
908F: include/linux/amba/mmci.h 908F: include/linux/amba/mmci.h
909 909
910ARM PRIMECELL UART PL010 AND PL011 DRIVERS 910ARM PRIMECELL UART PL010 AND PL011 DRIVERS
911M: Russell King <linux@arm.linux.org.uk> 911M: Russell King <linux@armlinux.org.uk>
912S: Maintained 912S: Maintained
913F: drivers/tty/serial/amba-pl01*.c 913F: drivers/tty/serial/amba-pl01*.c
914F: include/linux/amba/serial.h 914F: include/linux/amba/serial.h
915 915
916ARM PRIMECELL BUS SUPPORT 916ARM PRIMECELL BUS SUPPORT
917M: Russell King <linux@arm.linux.org.uk> 917M: Russell King <linux@armlinux.org.uk>
918S: Maintained 918S: Maintained
919F: drivers/amba/ 919F: drivers/amba/
920F: include/linux/amba/bus.h 920F: include/linux/amba/bus.h
@@ -1036,7 +1036,7 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1036S: Maintained 1036S: Maintained
1037 1037
1038ARM/CLKDEV SUPPORT 1038ARM/CLKDEV SUPPORT
1039M: Russell King <linux@arm.linux.org.uk> 1039M: Russell King <linux@armlinux.org.uk>
1040L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1040L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1041S: Maintained 1041S: Maintained
1042F: arch/arm/include/asm/clkdev.h 1042F: arch/arm/include/asm/clkdev.h
@@ -1093,9 +1093,9 @@ F: arch/arm/boot/dts/cx92755*
1093N: digicolor 1093N: digicolor
1094 1094
1095ARM/EBSA110 MACHINE SUPPORT 1095ARM/EBSA110 MACHINE SUPPORT
1096M: Russell King <linux@arm.linux.org.uk> 1096M: Russell King <linux@armlinux.org.uk>
1097L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1097L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1098W: http://www.arm.linux.org.uk/ 1098W: http://www.armlinux.org.uk/
1099S: Maintained 1099S: Maintained
1100F: arch/arm/mach-ebsa110/ 1100F: arch/arm/mach-ebsa110/
1101F: drivers/net/ethernet/amd/am79c961a.* 1101F: drivers/net/ethernet/amd/am79c961a.*
@@ -1124,9 +1124,9 @@ T: git git://git.berlios.de/gemini-board
1124F: arch/arm/mm/*-fa* 1124F: arch/arm/mm/*-fa*
1125 1125
1126ARM/FOOTBRIDGE ARCHITECTURE 1126ARM/FOOTBRIDGE ARCHITECTURE
1127M: Russell King <linux@arm.linux.org.uk> 1127M: Russell King <linux@armlinux.org.uk>
1128L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1128L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1129W: http://www.arm.linux.org.uk/ 1129W: http://www.armlinux.org.uk/
1130S: Maintained 1130S: Maintained
1131F: arch/arm/include/asm/hardware/dec21285.h 1131F: arch/arm/include/asm/hardware/dec21285.h
1132F: arch/arm/mach-footbridge/ 1132F: arch/arm/mach-footbridge/
@@ -1457,7 +1457,7 @@ S: Maintained
1457ARM/PT DIGITAL BOARD PORT 1457ARM/PT DIGITAL BOARD PORT
1458M: Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de> 1458M: Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
1459L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1459L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1460W: http://www.arm.linux.org.uk/ 1460W: http://www.armlinux.org.uk/
1461S: Maintained 1461S: Maintained
1462 1462
1463ARM/QUALCOMM SUPPORT 1463ARM/QUALCOMM SUPPORT
@@ -1493,9 +1493,9 @@ S: Supported
1493F: arch/arm64/boot/dts/renesas/ 1493F: arch/arm64/boot/dts/renesas/
1494 1494
1495ARM/RISCPC ARCHITECTURE 1495ARM/RISCPC ARCHITECTURE
1496M: Russell King <linux@arm.linux.org.uk> 1496M: Russell King <linux@armlinux.org.uk>
1497L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1497L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1498W: http://www.arm.linux.org.uk/ 1498W: http://www.armlinux.org.uk/
1499S: Maintained 1499S: Maintained
1500F: arch/arm/include/asm/hardware/entry-macro-iomd.S 1500F: arch/arm/include/asm/hardware/entry-macro-iomd.S
1501F: arch/arm/include/asm/hardware/ioc.h 1501F: arch/arm/include/asm/hardware/ioc.h
@@ -1773,9 +1773,9 @@ F: drivers/clk/versatile/clk-vexpress-osc.c
1773F: drivers/clocksource/versatile.c 1773F: drivers/clocksource/versatile.c
1774 1774
1775ARM/VFP SUPPORT 1775ARM/VFP SUPPORT
1776M: Russell King <linux@arm.linux.org.uk> 1776M: Russell King <linux@armlinux.org.uk>
1777L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1777L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1778W: http://www.arm.linux.org.uk/ 1778W: http://www.armlinux.org.uk/
1779S: Maintained 1779S: Maintained
1780F: arch/arm/vfp/ 1780F: arch/arm/vfp/
1781 1781
@@ -2921,7 +2921,7 @@ F: mm/cleancache.c
2921F: include/linux/cleancache.h 2921F: include/linux/cleancache.h
2922 2922
2923CLK API 2923CLK API
2924M: Russell King <linux@arm.linux.org.uk> 2924M: Russell King <linux@armlinux.org.uk>
2925L: linux-clk@vger.kernel.org 2925L: linux-clk@vger.kernel.org
2926S: Maintained 2926S: Maintained
2927F: include/linux/clk.h 2927F: include/linux/clk.h
@@ -3354,9 +3354,9 @@ S: Supported
3354F: drivers/net/ethernet/stmicro/stmmac/ 3354F: drivers/net/ethernet/stmicro/stmmac/
3355 3355
3356CYBERPRO FB DRIVER 3356CYBERPRO FB DRIVER
3357M: Russell King <linux@arm.linux.org.uk> 3357M: Russell King <linux@armlinux.org.uk>
3358L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 3358L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
3359W: http://www.arm.linux.org.uk/ 3359W: http://www.armlinux.org.uk/
3360S: Maintained 3360S: Maintained
3361F: drivers/video/fbdev/cyber2000fb.* 3361F: drivers/video/fbdev/cyber2000fb.*
3362 3362
@@ -3881,7 +3881,7 @@ F: Documentation/devicetree/bindings/display/st,stih4xx.txt
3881 3881
3882DRM DRIVERS FOR VIVANTE GPU IP 3882DRM DRIVERS FOR VIVANTE GPU IP
3883M: Lucas Stach <l.stach@pengutronix.de> 3883M: Lucas Stach <l.stach@pengutronix.de>
3884R: Russell King <linux+etnaviv@arm.linux.org.uk> 3884R: Russell King <linux+etnaviv@armlinux.org.uk>
3885R: Christian Gmeiner <christian.gmeiner@gmail.com> 3885R: Christian Gmeiner <christian.gmeiner@gmail.com>
3886L: dri-devel@lists.freedesktop.org 3886L: dri-devel@lists.freedesktop.org
3887S: Maintained 3887S: Maintained
@@ -4223,8 +4223,8 @@ F: Documentation/efi-stub.txt
4223F: arch/ia64/kernel/efi.c 4223F: arch/ia64/kernel/efi.c
4224F: arch/x86/boot/compressed/eboot.[ch] 4224F: arch/x86/boot/compressed/eboot.[ch]
4225F: arch/x86/include/asm/efi.h 4225F: arch/x86/include/asm/efi.h
4226F: arch/x86/platform/efi/* 4226F: arch/x86/platform/efi/
4227F: drivers/firmware/efi/* 4227F: drivers/firmware/efi/
4228F: include/linux/efi*.h 4228F: include/linux/efi*.h
4229 4229
4230EFI VARIABLE FILESYSTEM 4230EFI VARIABLE FILESYSTEM
@@ -4744,7 +4744,7 @@ F: drivers/platform/x86/fujitsu-tablet.c
4744 4744
4745FUSE: FILESYSTEM IN USERSPACE 4745FUSE: FILESYSTEM IN USERSPACE
4746M: Miklos Szeredi <miklos@szeredi.hu> 4746M: Miklos Szeredi <miklos@szeredi.hu>
4747L: fuse-devel@lists.sourceforge.net 4747L: linux-fsdevel@vger.kernel.org
4748W: http://fuse.sourceforge.net/ 4748W: http://fuse.sourceforge.net/
4749T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git 4749T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git
4750S: Maintained 4750S: Maintained
@@ -4903,7 +4903,7 @@ F: net/ipv4/gre_offload.c
4903F: include/net/gre.h 4903F: include/net/gre.h
4904 4904
4905GRETH 10/100/1G Ethernet MAC device driver 4905GRETH 10/100/1G Ethernet MAC device driver
4906M: Kristoffer Glembo <kristoffer@gaisler.com> 4906M: Andreas Larsson <andreas@gaisler.com>
4907L: netdev@vger.kernel.org 4907L: netdev@vger.kernel.org
4908S: Maintained 4908S: Maintained
4909F: drivers/net/ethernet/aeroflex/ 4909F: drivers/net/ethernet/aeroflex/
@@ -6905,7 +6905,7 @@ L: linux-man@vger.kernel.org
6905S: Maintained 6905S: Maintained
6906 6906
6907MARVELL ARMADA DRM SUPPORT 6907MARVELL ARMADA DRM SUPPORT
6908M: Russell King <rmk+kernel@arm.linux.org.uk> 6908M: Russell King <rmk+kernel@armlinux.org.uk>
6909S: Maintained 6909S: Maintained
6910F: drivers/gpu/drm/armada/ 6910F: drivers/gpu/drm/armada/
6911 6911
@@ -7905,7 +7905,7 @@ S: Supported
7905F: drivers/nfc/nxp-nci 7905F: drivers/nfc/nxp-nci
7906 7906
7907NXP TDA998X DRM DRIVER 7907NXP TDA998X DRM DRIVER
7908M: Russell King <rmk+kernel@arm.linux.org.uk> 7908M: Russell King <rmk+kernel@armlinux.org.uk>
7909S: Supported 7909S: Supported
7910F: drivers/gpu/drm/i2c/tda998x_drv.c 7910F: drivers/gpu/drm/i2c/tda998x_drv.c
7911F: include/drm/i2c/tda998x.h 7911F: include/drm/i2c/tda998x.h
@@ -7978,7 +7978,7 @@ F: arch/arm/*omap*/*pm*
7978F: drivers/cpufreq/omap-cpufreq.c 7978F: drivers/cpufreq/omap-cpufreq.c
7979 7979
7980OMAP POWERDOMAIN SOC ADAPTATION LAYER SUPPORT 7980OMAP POWERDOMAIN SOC ADAPTATION LAYER SUPPORT
7981M: Rajendra Nayak <rnayak@ti.com> 7981M: Rajendra Nayak <rnayak@codeaurora.org>
7982M: Paul Walmsley <paul@pwsan.com> 7982M: Paul Walmsley <paul@pwsan.com>
7983L: linux-omap@vger.kernel.org 7983L: linux-omap@vger.kernel.org
7984S: Maintained 7984S: Maintained
@@ -10014,7 +10014,8 @@ F: drivers/infiniband/hw/ocrdma/
10014 10014
10015SFC NETWORK DRIVER 10015SFC NETWORK DRIVER
10016M: Solarflare linux maintainers <linux-net-drivers@solarflare.com> 10016M: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
10017M: Shradha Shah <sshah@solarflare.com> 10017M: Edward Cree <ecree@solarflare.com>
10018M: Bert Kenward <bkenward@solarflare.com>
10018L: netdev@vger.kernel.org 10019L: netdev@vger.kernel.org
10019S: Supported 10020S: Supported
10020F: drivers/net/ethernet/sfc/ 10021F: drivers/net/ethernet/sfc/
diff --git a/Makefile b/Makefile
index 7466de60ddc7..acf6155421cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Charred Weasel 5NAME = Charred Weasel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ec4791ea6911..a8767430df7d 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -58,6 +58,9 @@ config GENERIC_CSUM
58config RWSEM_GENERIC_SPINLOCK 58config RWSEM_GENERIC_SPINLOCK
59 def_bool y 59 def_bool y
60 60
61config ARCH_DISCONTIGMEM_ENABLE
62 def_bool y
63
61config ARCH_FLATMEM_ENABLE 64config ARCH_FLATMEM_ENABLE
62 def_bool y 65 def_bool y
63 66
@@ -347,6 +350,15 @@ config ARC_HUGEPAGE_16M
347 350
348endchoice 351endchoice
349 352
353config NODES_SHIFT
354 int "Maximum NUMA Nodes (as a power of 2)"
355 default "1" if !DISCONTIGMEM
356 default "2" if DISCONTIGMEM
357 depends on NEED_MULTIPLE_NODES
358 ---help---
359 Accessing memory beyond 1GB (with or w/o PAE) requires 2 memory
360 zones.
361
350if ISA_ARCOMPACT 362if ISA_ARCOMPACT
351 363
352config ARC_COMPACT_IRQ_LEVELS 364config ARC_COMPACT_IRQ_LEVELS
@@ -455,6 +467,7 @@ config LINUX_LINK_BASE
455 467
456config HIGHMEM 468config HIGHMEM
457 bool "High Memory Support" 469 bool "High Memory Support"
470 select DISCONTIGMEM
458 help 471 help
459 With ARC 2G:2G address split, only upper 2G is directly addressable by 472 With ARC 2G:2G address split, only upper 2G is directly addressable by
460 kernel. Enable this to potentially allow access to rest of 2G and PAE 473 kernel. Enable this to potentially allow access to rest of 2G and PAE
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 17f85c9c73cf..c22b181e8206 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -13,6 +13,15 @@
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <asm/page.h> 14#include <asm/page.h>
15 15
16#ifdef CONFIG_ISA_ARCV2
17#include <asm/barrier.h>
18#define __iormb() rmb()
19#define __iowmb() wmb()
20#else
21#define __iormb() do { } while (0)
22#define __iowmb() do { } while (0)
23#endif
24
16extern void __iomem *ioremap(phys_addr_t paddr, unsigned long size); 25extern void __iomem *ioremap(phys_addr_t paddr, unsigned long size);
17extern void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size, 26extern void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
18 unsigned long flags); 27 unsigned long flags);
@@ -31,6 +40,15 @@ extern void iounmap(const void __iomem *addr);
31#define ioremap_wc(phy, sz) ioremap(phy, sz) 40#define ioremap_wc(phy, sz) ioremap(phy, sz)
32#define ioremap_wt(phy, sz) ioremap(phy, sz) 41#define ioremap_wt(phy, sz) ioremap(phy, sz)
33 42
43/*
44 * io{read,write}{16,32}be() macros
45 */
46#define ioread16be(p) ({ u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
47#define ioread32be(p) ({ u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
48
49#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force u16)cpu_to_be16(v), p); })
50#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force u32)cpu_to_be32(v), p); })
51
34/* Change struct page to physical address */ 52/* Change struct page to physical address */
35#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 53#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
36 54
@@ -108,15 +126,6 @@ static inline void __raw_writel(u32 w, volatile void __iomem *addr)
108 126
109} 127}
110 128
111#ifdef CONFIG_ISA_ARCV2
112#include <asm/barrier.h>
113#define __iormb() rmb()
114#define __iowmb() wmb()
115#else
116#define __iormb() do { } while (0)
117#define __iowmb() do { } while (0)
118#endif
119
120/* 129/*
121 * MMIO can also get buffered/optimized in micro-arch, so barriers needed 130 * MMIO can also get buffered/optimized in micro-arch, so barriers needed
122 * Based on ARM model for the typical use case 131 * Based on ARM model for the typical use case
diff --git a/arch/arc/include/asm/mmzone.h b/arch/arc/include/asm/mmzone.h
new file mode 100644
index 000000000000..8e97136413d9
--- /dev/null
+++ b/arch/arc/include/asm/mmzone.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_ARC_MMZONE_H
10#define _ASM_ARC_MMZONE_H
11
12#ifdef CONFIG_DISCONTIGMEM
13
14extern struct pglist_data node_data[];
15#define NODE_DATA(nid) (&node_data[nid])
16
17static inline int pfn_to_nid(unsigned long pfn)
18{
19 int is_end_low = 1;
20
21 if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
22 is_end_low = pfn <= virt_to_pfn(0xFFFFFFFFUL);
23
24 /*
25 * node 0: lowmem: 0x8000_0000 to 0xFFFF_FFFF
26 * node 1: HIGHMEM w/o PAE40: 0x0 to 0x7FFF_FFFF
27 * HIGHMEM with PAE40: 0x1_0000_0000 to ...
28 */
29 if (pfn >= ARCH_PFN_OFFSET && is_end_low)
30 return 0;
31
32 return 1;
33}
34
35static inline int pfn_valid(unsigned long pfn)
36{
37 int nid = pfn_to_nid(pfn);
38
39 return (pfn <= node_end_pfn(nid));
40}
41#endif /* CONFIG_DISCONTIGMEM */
42
43#endif
diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h
index 36da89e2c853..0d53854884d0 100644
--- a/arch/arc/include/asm/page.h
+++ b/arch/arc/include/asm/page.h
@@ -72,11 +72,20 @@ typedef unsigned long pgprot_t;
72 72
73typedef pte_t * pgtable_t; 73typedef pte_t * pgtable_t;
74 74
75/*
76 * Use virt_to_pfn with caution:
77 * If used in pte or paddr related macros, it could cause truncation
78 * in PAE40 builds
79 * As a rule of thumb, only use it in helpers starting with virt_
80 * You have been warned !
81 */
75#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 82#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
76 83
77#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_LINK_BASE) 84#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_LINK_BASE)
78 85
86#ifdef CONFIG_FLATMEM
79#define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr) 87#define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
88#endif
80 89
81/* 90/*
82 * __pa, __va, virt_to_page (ALERT: deprecated, don't use them) 91 * __pa, __va, virt_to_page (ALERT: deprecated, don't use them)
@@ -85,12 +94,10 @@ typedef pte_t * pgtable_t;
85 * virt here means link-address/program-address as embedded in object code. 94 * virt here means link-address/program-address as embedded in object code.
86 * And for ARC, link-addr = physical address 95 * And for ARC, link-addr = physical address
87 */ 96 */
88#define __pa(vaddr) ((unsigned long)vaddr) 97#define __pa(vaddr) ((unsigned long)(vaddr))
89#define __va(paddr) ((void *)((unsigned long)(paddr))) 98#define __va(paddr) ((void *)((unsigned long)(paddr)))
90 99
91#define virt_to_page(kaddr) \ 100#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
92 (mem_map + virt_to_pfn((kaddr) - CONFIG_LINUX_LINK_BASE))
93
94#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) 101#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr))
95 102
96/* Default Permissions for stack/heaps pages (Non Executable) */ 103/* Default Permissions for stack/heaps pages (Non Executable) */
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 7d6c93e63adf..10d4b8b8e545 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -278,14 +278,13 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
278#define pmd_present(x) (pmd_val(x)) 278#define pmd_present(x) (pmd_val(x))
279#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) 279#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0)
280 280
281#define pte_page(pte) \ 281#define pte_page(pte) pfn_to_page(pte_pfn(pte))
282 (mem_map + virt_to_pfn(pte_val(pte) - CONFIG_LINUX_LINK_BASE))
283
284#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) 282#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
285#define pte_pfn(pte) virt_to_pfn(pte_val(pte)) 283#define pfn_pte(pfn, prot) (__pte(((pte_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
286#define pfn_pte(pfn, prot) (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \ 284
287 pgprot_val(prot))) 285/* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/
288#define __pte_index(addr) (virt_to_pfn(addr) & (PTRS_PER_PTE - 1)) 286#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
287#define __pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
289 288
290/* 289/*
291 * pte_offset gets a @ptr to PMD entry (PGD in our 2-tier paging system) 290 * pte_offset gets a @ptr to PMD entry (PGD in our 2-tier paging system)
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 5487d0b97400..8be930394750 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -30,11 +30,16 @@ static const unsigned long low_mem_start = CONFIG_LINUX_LINK_BASE;
30static unsigned long low_mem_sz; 30static unsigned long low_mem_sz;
31 31
32#ifdef CONFIG_HIGHMEM 32#ifdef CONFIG_HIGHMEM
33static unsigned long min_high_pfn; 33static unsigned long min_high_pfn, max_high_pfn;
34static u64 high_mem_start; 34static u64 high_mem_start;
35static u64 high_mem_sz; 35static u64 high_mem_sz;
36#endif 36#endif
37 37
38#ifdef CONFIG_DISCONTIGMEM
39struct pglist_data node_data[MAX_NUMNODES] __read_mostly;
40EXPORT_SYMBOL(node_data);
41#endif
42
38/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */ 43/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
39static int __init setup_mem_sz(char *str) 44static int __init setup_mem_sz(char *str)
40{ 45{
@@ -109,13 +114,11 @@ void __init setup_arch_memory(void)
109 /* Last usable page of low mem */ 114 /* Last usable page of low mem */
110 max_low_pfn = max_pfn = PFN_DOWN(low_mem_start + low_mem_sz); 115 max_low_pfn = max_pfn = PFN_DOWN(low_mem_start + low_mem_sz);
111 116
112#ifdef CONFIG_HIGHMEM 117#ifdef CONFIG_FLATMEM
113 min_high_pfn = PFN_DOWN(high_mem_start); 118 /* pfn_valid() uses this */
114 max_pfn = PFN_DOWN(high_mem_start + high_mem_sz); 119 max_mapnr = max_low_pfn - min_low_pfn;
115#endif 120#endif
116 121
117 max_mapnr = max_pfn - min_low_pfn;
118
119 /*------------- bootmem allocator setup -----------------------*/ 122 /*------------- bootmem allocator setup -----------------------*/
120 123
121 /* 124 /*
@@ -129,7 +132,7 @@ void __init setup_arch_memory(void)
129 * the crash 132 * the crash
130 */ 133 */
131 134
132 memblock_add(low_mem_start, low_mem_sz); 135 memblock_add_node(low_mem_start, low_mem_sz, 0);
133 memblock_reserve(low_mem_start, __pa(_end) - low_mem_start); 136 memblock_reserve(low_mem_start, __pa(_end) - low_mem_start);
134 137
135#ifdef CONFIG_BLK_DEV_INITRD 138#ifdef CONFIG_BLK_DEV_INITRD
@@ -149,13 +152,6 @@ void __init setup_arch_memory(void)
149 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; 152 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
150 zones_holes[ZONE_NORMAL] = 0; 153 zones_holes[ZONE_NORMAL] = 0;
151 154
152#ifdef CONFIG_HIGHMEM
153 zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn;
154
155 /* This handles the peripheral address space hole */
156 zones_holes[ZONE_HIGHMEM] = min_high_pfn - max_low_pfn;
157#endif
158
159 /* 155 /*
160 * We can't use the helper free_area_init(zones[]) because it uses 156 * We can't use the helper free_area_init(zones[]) because it uses
161 * PAGE_OFFSET to compute the @min_low_pfn which would be wrong 157 * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
@@ -168,6 +164,34 @@ void __init setup_arch_memory(void)
168 zones_holes); /* holes */ 164 zones_holes); /* holes */
169 165
170#ifdef CONFIG_HIGHMEM 166#ifdef CONFIG_HIGHMEM
167 /*
168 * Populate a new node with highmem
169 *
170 * On ARC (w/o PAE) HIGHMEM addresses are actually smaller (0 based)
171 * than addresses in normal ala low memory (0x8000_0000 based).
172 * Even with PAE, the huge peripheral space hole would waste a lot of
173 * mem with single mem_map[]. This warrants a mem_map per region design.
174 * Thus HIGHMEM on ARC is imlemented with DISCONTIGMEM.
175 *
176 * DISCONTIGMEM in turns requires multiple nodes. node 0 above is
177 * populated with normal memory zone while node 1 only has highmem
178 */
179 node_set_online(1);
180
181 min_high_pfn = PFN_DOWN(high_mem_start);
182 max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
183
184 zones_size[ZONE_NORMAL] = 0;
185 zones_holes[ZONE_NORMAL] = 0;
186
187 zones_size[ZONE_HIGHMEM] = max_high_pfn - min_high_pfn;
188 zones_holes[ZONE_HIGHMEM] = 0;
189
190 free_area_init_node(1, /* node-id */
191 zones_size, /* num pages per zone */
192 min_high_pfn, /* first pfn of node */
193 zones_holes); /* holes */
194
171 high_memory = (void *)(min_high_pfn << PAGE_SHIFT); 195 high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
172 kmap_init(); 196 kmap_init();
173#endif 197#endif
@@ -185,7 +209,7 @@ void __init mem_init(void)
185 unsigned long tmp; 209 unsigned long tmp;
186 210
187 reset_all_zones_managed_pages(); 211 reset_all_zones_managed_pages();
188 for (tmp = min_high_pfn; tmp < max_pfn; tmp++) 212 for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
189 free_highmem_page(pfn_to_page(tmp)); 213 free_highmem_page(pfn_to_page(tmp));
190#endif 214#endif
191 215
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index b3c26a96a726..d9e2d9c6e999 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -329,6 +329,7 @@
329 regulator-name = "V28"; 329 regulator-name = "V28";
330 regulator-min-microvolt = <2800000>; 330 regulator-min-microvolt = <2800000>;
331 regulator-max-microvolt = <2800000>; 331 regulator-max-microvolt = <2800000>;
332 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
332 regulator-always-on; /* due to battery cover sensor */ 333 regulator-always-on; /* due to battery cover sensor */
333}; 334};
334 335
@@ -336,30 +337,35 @@
336 regulator-name = "VCSI"; 337 regulator-name = "VCSI";
337 regulator-min-microvolt = <1800000>; 338 regulator-min-microvolt = <1800000>;
338 regulator-max-microvolt = <1800000>; 339 regulator-max-microvolt = <1800000>;
340 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
339}; 341};
340 342
341&vaux3 { 343&vaux3 {
342 regulator-name = "VMMC2_30"; 344 regulator-name = "VMMC2_30";
343 regulator-min-microvolt = <2800000>; 345 regulator-min-microvolt = <2800000>;
344 regulator-max-microvolt = <3000000>; 346 regulator-max-microvolt = <3000000>;
347 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
345}; 348};
346 349
347&vaux4 { 350&vaux4 {
348 regulator-name = "VCAM_ANA_28"; 351 regulator-name = "VCAM_ANA_28";
349 regulator-min-microvolt = <2800000>; 352 regulator-min-microvolt = <2800000>;
350 regulator-max-microvolt = <2800000>; 353 regulator-max-microvolt = <2800000>;
354 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
351}; 355};
352 356
353&vmmc1 { 357&vmmc1 {
354 regulator-name = "VMMC1"; 358 regulator-name = "VMMC1";
355 regulator-min-microvolt = <1850000>; 359 regulator-min-microvolt = <1850000>;
356 regulator-max-microvolt = <3150000>; 360 regulator-max-microvolt = <3150000>;
361 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
357}; 362};
358 363
359&vmmc2 { 364&vmmc2 {
360 regulator-name = "V28_A"; 365 regulator-name = "V28_A";
361 regulator-min-microvolt = <2800000>; 366 regulator-min-microvolt = <2800000>;
362 regulator-max-microvolt = <3000000>; 367 regulator-max-microvolt = <3000000>;
368 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
363 regulator-always-on; /* due VIO leak to AIC34 VDDs */ 369 regulator-always-on; /* due VIO leak to AIC34 VDDs */
364}; 370};
365 371
@@ -367,6 +373,7 @@
367 regulator-name = "VPLL"; 373 regulator-name = "VPLL";
368 regulator-min-microvolt = <1800000>; 374 regulator-min-microvolt = <1800000>;
369 regulator-max-microvolt = <1800000>; 375 regulator-max-microvolt = <1800000>;
376 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
370 regulator-always-on; 377 regulator-always-on;
371}; 378};
372 379
@@ -374,6 +381,7 @@
374 regulator-name = "VSDI_CSI"; 381 regulator-name = "VSDI_CSI";
375 regulator-min-microvolt = <1800000>; 382 regulator-min-microvolt = <1800000>;
376 regulator-max-microvolt = <1800000>; 383 regulator-max-microvolt = <1800000>;
384 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
377 regulator-always-on; 385 regulator-always-on;
378}; 386};
379 387
@@ -381,6 +389,7 @@
381 regulator-name = "VMMC2_IO_18"; 389 regulator-name = "VMMC2_IO_18";
382 regulator-min-microvolt = <1800000>; 390 regulator-min-microvolt = <1800000>;
383 regulator-max-microvolt = <1800000>; 391 regulator-max-microvolt = <1800000>;
392 regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
384}; 393};
385 394
386&vio { 395&vio {
diff --git a/arch/arm/boot/dts/omap34xx.dtsi b/arch/arm/boot/dts/omap34xx.dtsi
index 387dc31822fe..96f8ce7bd2af 100644
--- a/arch/arm/boot/dts/omap34xx.dtsi
+++ b/arch/arm/boot/dts/omap34xx.dtsi
@@ -46,7 +46,7 @@
46 0x480bd800 0x017c>; 46 0x480bd800 0x017c>;
47 interrupts = <24>; 47 interrupts = <24>;
48 iommus = <&mmu_isp>; 48 iommus = <&mmu_isp>;
49 syscon = <&scm_conf 0xdc>; 49 syscon = <&scm_conf 0x6c>;
50 ti,phy-type = <OMAP3ISP_PHY_TYPE_COMPLEX_IO>; 50 ti,phy-type = <OMAP3ISP_PHY_TYPE_COMPLEX_IO>;
51 #clock-cells = <1>; 51 #clock-cells = <1>;
52 ports { 52 ports {
diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi
index 902657d6713b..914bf4c47404 100644
--- a/arch/arm/boot/dts/omap5-board-common.dtsi
+++ b/arch/arm/boot/dts/omap5-board-common.dtsi
@@ -472,7 +472,7 @@
472 ldo1_reg: ldo1 { 472 ldo1_reg: ldo1 {
473 /* VDDAPHY_CAM: vdda_csiport */ 473 /* VDDAPHY_CAM: vdda_csiport */
474 regulator-name = "ldo1"; 474 regulator-name = "ldo1";
475 regulator-min-microvolt = <1500000>; 475 regulator-min-microvolt = <1800000>;
476 regulator-max-microvolt = <1800000>; 476 regulator-max-microvolt = <1800000>;
477 }; 477 };
478 478
@@ -498,7 +498,7 @@
498 ldo4_reg: ldo4 { 498 ldo4_reg: ldo4 {
499 /* VDDAPHY_DISP: vdda_dsiport/hdmi */ 499 /* VDDAPHY_DISP: vdda_dsiport/hdmi */
500 regulator-name = "ldo4"; 500 regulator-name = "ldo4";
501 regulator-min-microvolt = <1500000>; 501 regulator-min-microvolt = <1800000>;
502 regulator-max-microvolt = <1800000>; 502 regulator-max-microvolt = <1800000>;
503 }; 503 };
504 504
diff --git a/arch/arm/boot/dts/omap5-cm-t54.dts b/arch/arm/boot/dts/omap5-cm-t54.dts
index ecc591dc0778..4d87d9c6c86d 100644
--- a/arch/arm/boot/dts/omap5-cm-t54.dts
+++ b/arch/arm/boot/dts/omap5-cm-t54.dts
@@ -513,7 +513,7 @@
513 ldo1_reg: ldo1 { 513 ldo1_reg: ldo1 {
514 /* VDDAPHY_CAM: vdda_csiport */ 514 /* VDDAPHY_CAM: vdda_csiport */
515 regulator-name = "ldo1"; 515 regulator-name = "ldo1";
516 regulator-min-microvolt = <1500000>; 516 regulator-min-microvolt = <1800000>;
517 regulator-max-microvolt = <1800000>; 517 regulator-max-microvolt = <1800000>;
518 }; 518 };
519 519
@@ -537,7 +537,7 @@
537 ldo4_reg: ldo4 { 537 ldo4_reg: ldo4 {
538 /* VDDAPHY_DISP: vdda_dsiport/hdmi */ 538 /* VDDAPHY_DISP: vdda_dsiport/hdmi */
539 regulator-name = "ldo4"; 539 regulator-name = "ldo4";
540 regulator-min-microvolt = <1500000>; 540 regulator-min-microvolt = <1800000>;
541 regulator-max-microvolt = <1800000>; 541 regulator-max-microvolt = <1800000>;
542 }; 542 };
543 543
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 38805ebbe2ba..120b6b80cd39 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -269,7 +269,7 @@
269 omap5_pmx_wkup: pinmux@c840 { 269 omap5_pmx_wkup: pinmux@c840 {
270 compatible = "ti,omap5-padconf", 270 compatible = "ti,omap5-padconf",
271 "pinctrl-single"; 271 "pinctrl-single";
272 reg = <0xc840 0x0038>; 272 reg = <0xc840 0x003c>;
273 #address-cells = <1>; 273 #address-cells = <1>;
274 #size-cells = <0>; 274 #size-cells = <0>;
275 #interrupt-cells = <1>; 275 #interrupt-cells = <1>;
diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index 65d0e8d98259..04f541bffbdd 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -666,7 +666,7 @@
666 }; 666 };
667 667
668 sata0: sata@29000000 { 668 sata0: sata@29000000 {
669 compatible = "generic-ahci"; 669 compatible = "qcom,apq8064-ahci", "generic-ahci";
670 status = "disabled"; 670 status = "disabled";
671 reg = <0x29000000 0x180>; 671 reg = <0x29000000 0x180>;
672 interrupts = <GIC_SPI 209 IRQ_TYPE_NONE>; 672 interrupts = <GIC_SPI 209 IRQ_TYPE_NONE>;
@@ -688,6 +688,7 @@
688 688
689 phys = <&sata_phy0>; 689 phys = <&sata_phy0>;
690 phy-names = "sata-phy"; 690 phy-names = "sata-phy";
691 ports-implemented = <0x1>;
691 }; 692 };
692 693
693 /* Temporary fixed regulator */ 694 /* Temporary fixed regulator */
diff --git a/arch/arm/boot/dts/sun8i-q8-common.dtsi b/arch/arm/boot/dts/sun8i-q8-common.dtsi
index 9d2b7e2f5975..346a49d805a7 100644
--- a/arch/arm/boot/dts/sun8i-q8-common.dtsi
+++ b/arch/arm/boot/dts/sun8i-q8-common.dtsi
@@ -125,8 +125,6 @@
125}; 125};
126 126
127&reg_dc1sw { 127&reg_dc1sw {
128 regulator-min-microvolt = <3000000>;
129 regulator-max-microvolt = <3000000>;
130 regulator-name = "vcc-lcd"; 128 regulator-name = "vcc-lcd";
131}; 129};
132 130
diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index fc8ba1663601..99d9f630d6b6 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -84,6 +84,7 @@
84 84
85#ifndef __ASSEMBLY__ 85#ifndef __ASSEMBLY__
86 86
87#ifdef CONFIG_CPU_CP15_MMU
87static inline unsigned int get_domain(void) 88static inline unsigned int get_domain(void)
88{ 89{
89 unsigned int domain; 90 unsigned int domain;
@@ -103,6 +104,16 @@ static inline void set_domain(unsigned val)
103 : : "r" (val) : "memory"); 104 : : "r" (val) : "memory");
104 isb(); 105 isb();
105} 106}
107#else
108static inline unsigned int get_domain(void)
109{
110 return 0;
111}
112
113static inline void set_domain(unsigned val)
114{
115}
116#endif
106 117
107#ifdef CONFIG_CPU_USE_DOMAINS 118#ifdef CONFIG_CPU_USE_DOMAINS
108#define modify_domain(dom,type) \ 119#define modify_domain(dom,type) \
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 9b8c5a113434..fb1a69eb49c1 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -236,7 +236,7 @@ ENTRY(__setup_mpu)
236 mov r0, #CONFIG_VECTORS_BASE @ Cover from VECTORS_BASE 236 mov r0, #CONFIG_VECTORS_BASE @ Cover from VECTORS_BASE
237 ldr r5,=(MPU_AP_PL1RW_PL0NA | MPU_RGN_NORMAL) 237 ldr r5,=(MPU_AP_PL1RW_PL0NA | MPU_RGN_NORMAL)
238 /* Writing N to bits 5:1 (RSR_SZ) --> region size 2^N+1 */ 238 /* Writing N to bits 5:1 (RSR_SZ) --> region size 2^N+1 */
239 mov r6, #(((PAGE_SHIFT - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN) 239 mov r6, #(((2 * PAGE_SHIFT - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN)
240 240
241 setup_region r0, r5, r6, MPU_DATA_SIDE @ VECTORS_BASE, PL0 NA, enabled 241 setup_region r0, r5, r6, MPU_DATA_SIDE @ VECTORS_BASE, PL0 NA, enabled
242 beq 3f @ Memory-map not unified 242 beq 3f @ Memory-map not unified
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 58dbd5c439df..d6d4191e68f2 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1004,7 +1004,7 @@ static bool transparent_hugepage_adjust(kvm_pfn_t *pfnp, phys_addr_t *ipap)
1004 kvm_pfn_t pfn = *pfnp; 1004 kvm_pfn_t pfn = *pfnp;
1005 gfn_t gfn = *ipap >> PAGE_SHIFT; 1005 gfn_t gfn = *ipap >> PAGE_SHIFT;
1006 1006
1007 if (PageTransCompound(pfn_to_page(pfn))) { 1007 if (PageTransCompoundMap(pfn_to_page(pfn))) {
1008 unsigned long mask; 1008 unsigned long mask;
1009 /* 1009 /*
1010 * The address we faulted on is backed by a transparent huge 1010 * The address we faulted on is backed by a transparent huge
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index d97c588550ad..bc4e63fa9808 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -121,6 +121,11 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context)
121 const char *partnum = NULL; 121 const char *partnum = NULL;
122 struct davinci_soc_info *soc_info = &davinci_soc_info; 122 struct davinci_soc_info *soc_info = &davinci_soc_info;
123 123
124 if (!IS_BUILTIN(CONFIG_NVMEM)) {
125 pr_warn("Factory Config not available without CONFIG_NVMEM\n");
126 goto bad_config;
127 }
128
124 ret = nvmem_device_read(nvmem, 0, sizeof(factory_config), 129 ret = nvmem_device_read(nvmem, 0, sizeof(factory_config),
125 &factory_config); 130 &factory_config);
126 if (ret != sizeof(struct factory_config)) { 131 if (ret != sizeof(struct factory_config)) {
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index f55ef2ef2f92..742133b7266a 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -33,6 +33,11 @@ void davinci_get_mac_addr(struct nvmem_device *nvmem, void *context)
33 char *mac_addr = davinci_soc_info.emac_pdata->mac_addr; 33 char *mac_addr = davinci_soc_info.emac_pdata->mac_addr;
34 off_t offset = (off_t)context; 34 off_t offset = (off_t)context;
35 35
36 if (!IS_BUILTIN(CONFIG_NVMEM)) {
37 pr_warn("Cannot read MAC addr from EEPROM without CONFIG_NVMEM\n");
38 return;
39 }
40
36 /* Read MAC addr from EEPROM */ 41 /* Read MAC addr from EEPROM */
37 if (nvmem_device_read(nvmem, offset, ETH_ALEN, mac_addr) == ETH_ALEN) 42 if (nvmem_device_read(nvmem, offset, ETH_ALEN, mac_addr) == ETH_ALEN)
38 pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); 43 pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 7c21760f590f..875a2bab64f6 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -92,7 +92,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
92 if (IS_ERR(pd->clk[i])) 92 if (IS_ERR(pd->clk[i]))
93 break; 93 break;
94 94
95 if (IS_ERR(pd->clk[i])) 95 if (IS_ERR(pd->pclk[i]))
96 continue; /* Skip on first power up */ 96 continue; /* Skip on first power up */
97 if (clk_set_parent(pd->clk[i], pd->pclk[i])) 97 if (clk_set_parent(pd->clk[i], pd->pclk[i]))
98 pr_err("%s: error setting parent to clock%d\n", 98 pr_err("%s: error setting parent to clock%d\n",
diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S
index 5d94b7a2fb10..c160fa3007e9 100644
--- a/arch/arm/mach-socfpga/headsmp.S
+++ b/arch/arm/mach-socfpga/headsmp.S
@@ -13,6 +13,7 @@
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14 14
15 .arch armv7-a 15 .arch armv7-a
16 .arm
16 17
17ENTRY(secondary_trampoline) 18ENTRY(secondary_trampoline)
18 /* CPU1 will always fetch from 0x0 when it is brought out of reset. 19 /* CPU1 will always fetch from 0x0 when it is brought out of reset.
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 1dd10936d68d..d5805e4bf2fc 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -87,7 +87,6 @@ static unsigned long irbar_read(void)
87/* MPU initialisation functions */ 87/* MPU initialisation functions */
88void __init sanity_check_meminfo_mpu(void) 88void __init sanity_check_meminfo_mpu(void)
89{ 89{
90 int i;
91 phys_addr_t phys_offset = PHYS_OFFSET; 90 phys_addr_t phys_offset = PHYS_OFFSET;
92 phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size; 91 phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size;
93 struct memblock_region *reg; 92 struct memblock_region *reg;
@@ -110,11 +109,13 @@ void __init sanity_check_meminfo_mpu(void)
110 } else { 109 } else {
111 /* 110 /*
112 * memblock auto merges contiguous blocks, remove 111 * memblock auto merges contiguous blocks, remove
113 * all blocks afterwards 112 * all blocks afterwards in one go (we can't remove
113 * blocks separately while iterating)
114 */ 114 */
115 pr_notice("Ignoring RAM after %pa, memory at %pa ignored\n", 115 pr_notice("Ignoring RAM after %pa, memory at %pa ignored\n",
116 &mem_start, &reg->base); 116 &mem_end, &reg->base);
117 memblock_remove(reg->base, reg->size); 117 memblock_remove(reg->base, 0 - reg->base);
118 break;
118 } 119 }
119 } 120 }
120 121
@@ -144,7 +145,7 @@ void __init sanity_check_meminfo_mpu(void)
144 pr_warn("Truncating memory from %pa to %pa (MPU region constraints)", 145 pr_warn("Truncating memory from %pa to %pa (MPU region constraints)",
145 &specified_mem_size, &aligned_region_size); 146 &specified_mem_size, &aligned_region_size);
146 memblock_remove(mem_start + aligned_region_size, 147 memblock_remove(mem_start + aligned_region_size,
147 specified_mem_size - aligned_round_size); 148 specified_mem_size - aligned_region_size);
148 149
149 mem_end = mem_start + aligned_region_size; 150 mem_end = mem_start + aligned_region_size;
150 } 151 }
@@ -261,7 +262,7 @@ void __init mpu_setup(void)
261 return; 262 return;
262 263
263 region_err = mpu_setup_region(MPU_RAM_REGION, PHYS_OFFSET, 264 region_err = mpu_setup_region(MPU_RAM_REGION, PHYS_OFFSET,
264 ilog2(meminfo.bank[0].size), 265 ilog2(memblock.memory.regions[0].size),
265 MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL); 266 MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL);
266 if (region_err) { 267 if (region_err) {
267 panic("MPU region initialization failure! %d", region_err); 268 panic("MPU region initialization failure! %d", region_err);
@@ -285,7 +286,7 @@ void __init arm_mm_memblock_reserve(void)
285 * some architectures which the DRAM is the exception vector to trap, 286 * some architectures which the DRAM is the exception vector to trap,
286 * alloc_page breaks with error, although it is not NULL, but "0." 287 * alloc_page breaks with error, although it is not NULL, but "0."
287 */ 288 */
288 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE); 289 memblock_reserve(CONFIG_VECTORS_BASE, 2 * PAGE_SIZE);
289#else /* ifndef CONFIG_CPU_V7M */ 290#else /* ifndef CONFIG_CPU_V7M */
290 /* 291 /*
291 * There is no dedicated vector page on V7-M. So nothing needs to be 292 * There is no dedicated vector page on V7-M. So nothing needs to be
diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index a7315ebe3883..706d2426024f 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -120,7 +120,6 @@
120 compatible = "fixed-clock"; 120 compatible = "fixed-clock";
121 #clock-cells = <0>; 121 #clock-cells = <0>;
122 clock-frequency = <0>; 122 clock-frequency = <0>;
123 status = "disabled";
124 }; 123 };
125 124
126 soc { 125 soc {
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index c976ebfe2269..57b4836b7ecd 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -344,7 +344,7 @@ tracesys_next:
344#endif 344#endif
345 345
346 cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */ 346 cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */
347 comiclr,>>= __NR_Linux_syscalls, %r20, %r0 347 comiclr,>> __NR_Linux_syscalls, %r20, %r0
348 b,n .Ltracesys_nosys 348 b,n .Ltracesys_nosys
349 349
350 LDREGX %r20(%r19), %r19 350 LDREGX %r20(%r19), %r19
diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
index e4396a7d0f7c..4afe66aa1400 100644
--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -82,7 +82,7 @@ static inline unsigned long create_zero_mask(unsigned long bits)
82 "andc %1,%1,%2\n\t" 82 "andc %1,%1,%2\n\t"
83 "popcntd %0,%1" 83 "popcntd %0,%1"
84 : "=r" (leading_zero_bits), "=&r" (trailing_zero_bit_mask) 84 : "=r" (leading_zero_bits), "=&r" (trailing_zero_bit_mask)
85 : "r" (bits)); 85 : "b" (bits));
86 86
87 return leading_zero_bits; 87 return leading_zero_bits;
88} 88}
diff --git a/arch/sparc/configs/sparc32_defconfig b/arch/sparc/configs/sparc32_defconfig
index fb23fd6b186a..c74d3701ad68 100644
--- a/arch/sparc/configs/sparc32_defconfig
+++ b/arch/sparc/configs/sparc32_defconfig
@@ -24,7 +24,6 @@ CONFIG_INET_AH=y
24CONFIG_INET_ESP=y 24CONFIG_INET_ESP=y
25CONFIG_INET_IPCOMP=y 25CONFIG_INET_IPCOMP=y
26# CONFIG_INET_LRO is not set 26# CONFIG_INET_LRO is not set
27CONFIG_IPV6_PRIVACY=y
28CONFIG_INET6_AH=m 27CONFIG_INET6_AH=m
29CONFIG_INET6_ESP=m 28CONFIG_INET6_ESP=m
30CONFIG_INET6_IPCOMP=m 29CONFIG_INET6_IPCOMP=m
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index 04920ab8e292..3583d676a916 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -48,7 +48,6 @@ CONFIG_SYN_COOKIES=y
48CONFIG_INET_AH=y 48CONFIG_INET_AH=y
49CONFIG_INET_ESP=y 49CONFIG_INET_ESP=y
50CONFIG_INET_IPCOMP=y 50CONFIG_INET_IPCOMP=y
51CONFIG_IPV6_PRIVACY=y
52CONFIG_IPV6_ROUTER_PREF=y 51CONFIG_IPV6_ROUTER_PREF=y
53CONFIG_IPV6_ROUTE_INFO=y 52CONFIG_IPV6_ROUTE_INFO=y
54CONFIG_IPV6_OPTIMISTIC_DAD=y 53CONFIG_IPV6_OPTIMISTIC_DAD=y
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 56f933816144..1d8321c827a8 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -48,6 +48,7 @@
48#define SUN4V_CHIP_SPARC_M6 0x06 48#define SUN4V_CHIP_SPARC_M6 0x06
49#define SUN4V_CHIP_SPARC_M7 0x07 49#define SUN4V_CHIP_SPARC_M7 0x07
50#define SUN4V_CHIP_SPARC64X 0x8a 50#define SUN4V_CHIP_SPARC64X 0x8a
51#define SUN4V_CHIP_SPARC_SN 0x8b
51#define SUN4V_CHIP_UNKNOWN 0xff 52#define SUN4V_CHIP_UNKNOWN 0xff
52 53
53#ifndef __ASSEMBLY__ 54#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h
index b6de8b10a55b..36eee8132c22 100644
--- a/arch/sparc/include/uapi/asm/unistd.h
+++ b/arch/sparc/include/uapi/asm/unistd.h
@@ -423,8 +423,10 @@
423#define __NR_setsockopt 355 423#define __NR_setsockopt 355
424#define __NR_mlock2 356 424#define __NR_mlock2 356
425#define __NR_copy_file_range 357 425#define __NR_copy_file_range 357
426#define __NR_preadv2 358
427#define __NR_pwritev2 359
426 428
427#define NR_syscalls 358 429#define NR_syscalls 360
428 430
429/* Bitmask values returned from kern_features system call. */ 431/* Bitmask values returned from kern_features system call. */
430#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 432#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
diff --git a/arch/sparc/kernel/cherrs.S b/arch/sparc/kernel/cherrs.S
index 4ee1ad420862..655628def68e 100644
--- a/arch/sparc/kernel/cherrs.S
+++ b/arch/sparc/kernel/cherrs.S
@@ -214,8 +214,7 @@ do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
214 subcc %g1, %g2, %g1 ! Next cacheline 214 subcc %g1, %g2, %g1 ! Next cacheline
215 bge,pt %icc, 1b 215 bge,pt %icc, 1b
216 nop 216 nop
217 ba,pt %xcc, dcpe_icpe_tl1_common 217 ba,a,pt %xcc, dcpe_icpe_tl1_common
218 nop
219 218
220do_dcpe_tl1_fatal: 219do_dcpe_tl1_fatal:
221 sethi %hi(1f), %g7 220 sethi %hi(1f), %g7
@@ -224,8 +223,7 @@ do_dcpe_tl1_fatal:
224 mov 0x2, %o0 223 mov 0x2, %o0
225 call cheetah_plus_parity_error 224 call cheetah_plus_parity_error
226 add %sp, PTREGS_OFF, %o1 225 add %sp, PTREGS_OFF, %o1
227 ba,pt %xcc, rtrap 226 ba,a,pt %xcc, rtrap
228 nop
229 .size do_dcpe_tl1,.-do_dcpe_tl1 227 .size do_dcpe_tl1,.-do_dcpe_tl1
230 228
231 .globl do_icpe_tl1 229 .globl do_icpe_tl1
@@ -259,8 +257,7 @@ do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
259 subcc %g1, %g2, %g1 257 subcc %g1, %g2, %g1
260 bge,pt %icc, 1b 258 bge,pt %icc, 1b
261 nop 259 nop
262 ba,pt %xcc, dcpe_icpe_tl1_common 260 ba,a,pt %xcc, dcpe_icpe_tl1_common
263 nop
264 261
265do_icpe_tl1_fatal: 262do_icpe_tl1_fatal:
266 sethi %hi(1f), %g7 263 sethi %hi(1f), %g7
@@ -269,8 +266,7 @@ do_icpe_tl1_fatal:
269 mov 0x3, %o0 266 mov 0x3, %o0
270 call cheetah_plus_parity_error 267 call cheetah_plus_parity_error
271 add %sp, PTREGS_OFF, %o1 268 add %sp, PTREGS_OFF, %o1
272 ba,pt %xcc, rtrap 269 ba,a,pt %xcc, rtrap
273 nop
274 .size do_icpe_tl1,.-do_icpe_tl1 270 .size do_icpe_tl1,.-do_icpe_tl1
275 271
276 .type dcpe_icpe_tl1_common,#function 272 .type dcpe_icpe_tl1_common,#function
@@ -456,7 +452,7 @@ __cheetah_log_error:
456 cmp %g2, 0x63 452 cmp %g2, 0x63
457 be c_cee 453 be c_cee
458 nop 454 nop
459 ba,pt %xcc, c_deferred 455 ba,a,pt %xcc, c_deferred
460 .size __cheetah_log_error,.-__cheetah_log_error 456 .size __cheetah_log_error,.-__cheetah_log_error
461 457
462 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc 458 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index dfad8b1aea9f..493e023a468a 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -506,6 +506,12 @@ static void __init sun4v_cpu_probe(void)
506 sparc_pmu_type = "sparc-m7"; 506 sparc_pmu_type = "sparc-m7";
507 break; 507 break;
508 508
509 case SUN4V_CHIP_SPARC_SN:
510 sparc_cpu_type = "SPARC-SN";
511 sparc_fpu_type = "SPARC-SN integrated FPU";
512 sparc_pmu_type = "sparc-sn";
513 break;
514
509 case SUN4V_CHIP_SPARC64X: 515 case SUN4V_CHIP_SPARC64X:
510 sparc_cpu_type = "SPARC64-X"; 516 sparc_cpu_type = "SPARC64-X";
511 sparc_fpu_type = "SPARC64-X integrated FPU"; 517 sparc_fpu_type = "SPARC64-X integrated FPU";
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index e69ec0e3f155..45c820e1cba5 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -328,6 +328,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
328 case SUN4V_CHIP_NIAGARA5: 328 case SUN4V_CHIP_NIAGARA5:
329 case SUN4V_CHIP_SPARC_M6: 329 case SUN4V_CHIP_SPARC_M6:
330 case SUN4V_CHIP_SPARC_M7: 330 case SUN4V_CHIP_SPARC_M7:
331 case SUN4V_CHIP_SPARC_SN:
331 case SUN4V_CHIP_SPARC64X: 332 case SUN4V_CHIP_SPARC64X:
332 rover_inc_table = niagara_iterate_method; 333 rover_inc_table = niagara_iterate_method;
333 break; 334 break;
diff --git a/arch/sparc/kernel/fpu_traps.S b/arch/sparc/kernel/fpu_traps.S
index a6864826a4bd..336d2750fe78 100644
--- a/arch/sparc/kernel/fpu_traps.S
+++ b/arch/sparc/kernel/fpu_traps.S
@@ -100,8 +100,8 @@ do_fpdis:
100 fmuld %f0, %f2, %f26 100 fmuld %f0, %f2, %f26
101 faddd %f0, %f2, %f28 101 faddd %f0, %f2, %f28
102 fmuld %f0, %f2, %f30 102 fmuld %f0, %f2, %f30
103 b,pt %xcc, fpdis_exit 103 ba,a,pt %xcc, fpdis_exit
104 nop 104
1052: andcc %g5, FPRS_DU, %g0 1052: andcc %g5, FPRS_DU, %g0
106 bne,pt %icc, 3f 106 bne,pt %icc, 3f
107 fzero %f32 107 fzero %f32
@@ -144,8 +144,8 @@ do_fpdis:
144 fmuld %f32, %f34, %f58 144 fmuld %f32, %f34, %f58
145 faddd %f32, %f34, %f60 145 faddd %f32, %f34, %f60
146 fmuld %f32, %f34, %f62 146 fmuld %f32, %f34, %f62
147 ba,pt %xcc, fpdis_exit 147 ba,a,pt %xcc, fpdis_exit
148 nop 148
1493: mov SECONDARY_CONTEXT, %g3 1493: mov SECONDARY_CONTEXT, %g3
150 add %g6, TI_FPREGS, %g1 150 add %g6, TI_FPREGS, %g1
151 151
@@ -197,8 +197,7 @@ fpdis_exit2:
197fp_other_bounce: 197fp_other_bounce:
198 call do_fpother 198 call do_fpother
199 add %sp, PTREGS_OFF, %o0 199 add %sp, PTREGS_OFF, %o0
200 ba,pt %xcc, rtrap 200 ba,a,pt %xcc, rtrap
201 nop
202 .size fp_other_bounce,.-fp_other_bounce 201 .size fp_other_bounce,.-fp_other_bounce
203 202
204 .align 32 203 .align 32
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index cd1f592cd347..a076b4249e62 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -414,6 +414,8 @@ sun4v_chip_type:
414 cmp %g2, 'T' 414 cmp %g2, 'T'
415 be,pt %xcc, 70f 415 be,pt %xcc, 70f
416 cmp %g2, 'M' 416 cmp %g2, 'M'
417 be,pt %xcc, 70f
418 cmp %g2, 'S'
417 bne,pn %xcc, 49f 419 bne,pn %xcc, 49f
418 nop 420 nop
419 421
@@ -433,6 +435,9 @@ sun4v_chip_type:
433 cmp %g2, '7' 435 cmp %g2, '7'
434 be,pt %xcc, 5f 436 be,pt %xcc, 5f
435 mov SUN4V_CHIP_SPARC_M7, %g4 437 mov SUN4V_CHIP_SPARC_M7, %g4
438 cmp %g2, 'N'
439 be,pt %xcc, 5f
440 mov SUN4V_CHIP_SPARC_SN, %g4
436 ba,pt %xcc, 49f 441 ba,pt %xcc, 49f
437 nop 442 nop
438 443
@@ -461,9 +466,8 @@ sun4v_chip_type:
461 subcc %g3, 1, %g3 466 subcc %g3, 1, %g3
462 bne,pt %xcc, 41b 467 bne,pt %xcc, 41b
463 add %g1, 1, %g1 468 add %g1, 1, %g1
464 mov SUN4V_CHIP_SPARC64X, %g4
465 ba,pt %xcc, 5f 469 ba,pt %xcc, 5f
466 nop 470 mov SUN4V_CHIP_SPARC64X, %g4
467 471
46849: 47249:
469 mov SUN4V_CHIP_UNKNOWN, %g4 473 mov SUN4V_CHIP_UNKNOWN, %g4
@@ -548,8 +552,7 @@ sun4u_init:
548 stxa %g0, [%g7] ASI_DMMU 552 stxa %g0, [%g7] ASI_DMMU
549 membar #Sync 553 membar #Sync
550 554
551 ba,pt %xcc, sun4u_continue 555 ba,a,pt %xcc, sun4u_continue
552 nop
553 556
554sun4v_init: 557sun4v_init:
555 /* Set ctx 0 */ 558 /* Set ctx 0 */
@@ -560,14 +563,12 @@ sun4v_init:
560 mov SECONDARY_CONTEXT, %g7 563 mov SECONDARY_CONTEXT, %g7
561 stxa %g0, [%g7] ASI_MMU 564 stxa %g0, [%g7] ASI_MMU
562 membar #Sync 565 membar #Sync
563 ba,pt %xcc, niagara_tlb_fixup 566 ba,a,pt %xcc, niagara_tlb_fixup
564 nop
565 567
566sun4u_continue: 568sun4u_continue:
567 BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup) 569 BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup)
568 570
569 ba,pt %xcc, spitfire_tlb_fixup 571 ba,a,pt %xcc, spitfire_tlb_fixup
570 nop
571 572
572niagara_tlb_fixup: 573niagara_tlb_fixup:
573 mov 3, %g2 /* Set TLB type to hypervisor. */ 574 mov 3, %g2 /* Set TLB type to hypervisor. */
@@ -597,6 +598,9 @@ niagara_tlb_fixup:
597 cmp %g1, SUN4V_CHIP_SPARC_M7 598 cmp %g1, SUN4V_CHIP_SPARC_M7
598 be,pt %xcc, niagara4_patch 599 be,pt %xcc, niagara4_patch
599 nop 600 nop
601 cmp %g1, SUN4V_CHIP_SPARC_SN
602 be,pt %xcc, niagara4_patch
603 nop
600 604
601 call generic_patch_copyops 605 call generic_patch_copyops
602 nop 606 nop
@@ -639,8 +643,7 @@ niagara_patch:
639 call hypervisor_patch_cachetlbops 643 call hypervisor_patch_cachetlbops
640 nop 644 nop
641 645
642 ba,pt %xcc, tlb_fixup_done 646 ba,a,pt %xcc, tlb_fixup_done
643 nop
644 647
645cheetah_tlb_fixup: 648cheetah_tlb_fixup:
646 mov 2, %g2 /* Set TLB type to cheetah+. */ 649 mov 2, %g2 /* Set TLB type to cheetah+. */
@@ -659,8 +662,7 @@ cheetah_tlb_fixup:
659 call cheetah_patch_cachetlbops 662 call cheetah_patch_cachetlbops
660 nop 663 nop
661 664
662 ba,pt %xcc, tlb_fixup_done 665 ba,a,pt %xcc, tlb_fixup_done
663 nop
664 666
665spitfire_tlb_fixup: 667spitfire_tlb_fixup:
666 /* Set TLB type to spitfire. */ 668 /* Set TLB type to spitfire. */
@@ -774,8 +776,7 @@ setup_trap_table:
774 call %o1 776 call %o1
775 add %sp, (2047 + 128), %o0 777 add %sp, (2047 + 128), %o0
776 778
777 ba,pt %xcc, 2f 779 ba,a,pt %xcc, 2f
778 nop
779 780
7801: sethi %hi(sparc64_ttable_tl0), %o0 7811: sethi %hi(sparc64_ttable_tl0), %o0
781 set prom_set_trap_table_name, %g2 782 set prom_set_trap_table_name, %g2
@@ -814,8 +815,7 @@ setup_trap_table:
814 815
815 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f) 816 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
816 817
817 ba,pt %xcc, 2f 818 ba,a,pt %xcc, 2f
818 nop
819 819
820 /* Disable STICK_INT interrupts. */ 820 /* Disable STICK_INT interrupts. */
8211: 8211:
diff --git a/arch/sparc/kernel/misctrap.S b/arch/sparc/kernel/misctrap.S
index 753b4f031bfb..34b4933900bf 100644
--- a/arch/sparc/kernel/misctrap.S
+++ b/arch/sparc/kernel/misctrap.S
@@ -18,8 +18,7 @@ __do_privact:
18109: or %g7, %lo(109b), %g7 18109: or %g7, %lo(109b), %g7
19 call do_privact 19 call do_privact
20 add %sp, PTREGS_OFF, %o0 20 add %sp, PTREGS_OFF, %o0
21 ba,pt %xcc, rtrap 21 ba,a,pt %xcc, rtrap
22 nop
23 .size __do_privact,.-__do_privact 22 .size __do_privact,.-__do_privact
24 23
25 .type do_mna,#function 24 .type do_mna,#function
@@ -46,8 +45,7 @@ do_mna:
46 mov %l5, %o2 45 mov %l5, %o2
47 call mem_address_unaligned 46 call mem_address_unaligned
48 add %sp, PTREGS_OFF, %o0 47 add %sp, PTREGS_OFF, %o0
49 ba,pt %xcc, rtrap 48 ba,a,pt %xcc, rtrap
50 nop
51 .size do_mna,.-do_mna 49 .size do_mna,.-do_mna
52 50
53 .type do_lddfmna,#function 51 .type do_lddfmna,#function
@@ -65,8 +63,7 @@ do_lddfmna:
65 mov %l5, %o2 63 mov %l5, %o2
66 call handle_lddfmna 64 call handle_lddfmna
67 add %sp, PTREGS_OFF, %o0 65 add %sp, PTREGS_OFF, %o0
68 ba,pt %xcc, rtrap 66 ba,a,pt %xcc, rtrap
69 nop
70 .size do_lddfmna,.-do_lddfmna 67 .size do_lddfmna,.-do_lddfmna
71 68
72 .type do_stdfmna,#function 69 .type do_stdfmna,#function
@@ -84,8 +81,7 @@ do_stdfmna:
84 mov %l5, %o2 81 mov %l5, %o2
85 call handle_stdfmna 82 call handle_stdfmna
86 add %sp, PTREGS_OFF, %o0 83 add %sp, PTREGS_OFF, %o0
87 ba,pt %xcc, rtrap 84 ba,a,pt %xcc, rtrap
88 nop
89 .size do_stdfmna,.-do_stdfmna 85 .size do_stdfmna,.-do_stdfmna
90 86
91 .type breakpoint_trap,#function 87 .type breakpoint_trap,#function
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index badf0951d73c..c2b202d763a1 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -245,6 +245,18 @@ static void pci_parse_of_addrs(struct platform_device *op,
245 } 245 }
246} 246}
247 247
248static void pci_init_dev_archdata(struct dev_archdata *sd, void *iommu,
249 void *stc, void *host_controller,
250 struct platform_device *op,
251 int numa_node)
252{
253 sd->iommu = iommu;
254 sd->stc = stc;
255 sd->host_controller = host_controller;
256 sd->op = op;
257 sd->numa_node = numa_node;
258}
259
248static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, 260static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
249 struct device_node *node, 261 struct device_node *node,
250 struct pci_bus *bus, int devfn) 262 struct pci_bus *bus, int devfn)
@@ -259,13 +271,10 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
259 if (!dev) 271 if (!dev)
260 return NULL; 272 return NULL;
261 273
274 op = of_find_device_by_node(node);
262 sd = &dev->dev.archdata; 275 sd = &dev->dev.archdata;
263 sd->iommu = pbm->iommu; 276 pci_init_dev_archdata(sd, pbm->iommu, &pbm->stc, pbm, op,
264 sd->stc = &pbm->stc; 277 pbm->numa_node);
265 sd->host_controller = pbm;
266 sd->op = op = of_find_device_by_node(node);
267 sd->numa_node = pbm->numa_node;
268
269 sd = &op->dev.archdata; 278 sd = &op->dev.archdata;
270 sd->iommu = pbm->iommu; 279 sd->iommu = pbm->iommu;
271 sd->stc = &pbm->stc; 280 sd->stc = &pbm->stc;
@@ -994,6 +1003,27 @@ void pcibios_set_master(struct pci_dev *dev)
994 /* No special bus mastering setup handling */ 1003 /* No special bus mastering setup handling */
995} 1004}
996 1005
1006#ifdef CONFIG_PCI_IOV
1007int pcibios_add_device(struct pci_dev *dev)
1008{
1009 struct pci_dev *pdev;
1010
1011 /* Add sriov arch specific initialization here.
1012 * Copy dev_archdata from PF to VF
1013 */
1014 if (dev->is_virtfn) {
1015 struct dev_archdata *psd;
1016
1017 pdev = dev->physfn;
1018 psd = &pdev->dev.archdata;
1019 pci_init_dev_archdata(&dev->dev.archdata, psd->iommu,
1020 psd->stc, psd->host_controller, NULL,
1021 psd->numa_node);
1022 }
1023 return 0;
1024}
1025#endif /* CONFIG_PCI_IOV */
1026
997static int __init pcibios_init(void) 1027static int __init pcibios_init(void)
998{ 1028{
999 pci_dfl_cache_line_size = 64 >> 2; 1029 pci_dfl_cache_line_size = 64 >> 2;
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 26db95b54ee9..599f1207eed2 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -285,7 +285,8 @@ static void __init sun4v_patch(void)
285 285
286 sun4v_patch_2insn_range(&__sun4v_2insn_patch, 286 sun4v_patch_2insn_range(&__sun4v_2insn_patch,
287 &__sun4v_2insn_patch_end); 287 &__sun4v_2insn_patch_end);
288 if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7) 288 if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
289 sun4v_chip_type == SUN4V_CHIP_SPARC_SN)
289 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch, 290 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch,
290 &__sun_m7_2insn_patch_end); 291 &__sun_m7_2insn_patch_end);
291 292
@@ -524,6 +525,7 @@ static void __init init_sparc64_elf_hwcap(void)
524 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 525 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
525 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 526 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
526 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 527 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
528 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
527 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 529 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
528 cap |= HWCAP_SPARC_BLKINIT; 530 cap |= HWCAP_SPARC_BLKINIT;
529 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || 531 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
@@ -532,6 +534,7 @@ static void __init init_sparc64_elf_hwcap(void)
532 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 534 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
533 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 535 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
534 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 536 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
537 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
535 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 538 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
536 cap |= HWCAP_SPARC_N2; 539 cap |= HWCAP_SPARC_N2;
537 } 540 }
@@ -561,6 +564,7 @@ static void __init init_sparc64_elf_hwcap(void)
561 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 564 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
562 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 565 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
563 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 566 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
567 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
564 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 568 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
565 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | 569 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
566 AV_SPARC_ASI_BLK_INIT | 570 AV_SPARC_ASI_BLK_INIT |
@@ -570,6 +574,7 @@ static void __init init_sparc64_elf_hwcap(void)
570 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 574 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
571 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 575 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
572 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 576 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
577 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
573 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 578 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
574 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC | 579 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
575 AV_SPARC_FMAF); 580 AV_SPARC_FMAF);
diff --git a/arch/sparc/kernel/spiterrs.S b/arch/sparc/kernel/spiterrs.S
index c357e40ffd01..4a73009f66a5 100644
--- a/arch/sparc/kernel/spiterrs.S
+++ b/arch/sparc/kernel/spiterrs.S
@@ -85,8 +85,7 @@ __spitfire_cee_trap_continue:
85 ba,pt %xcc, etraptl1 85 ba,pt %xcc, etraptl1
86 rd %pc, %g7 86 rd %pc, %g7
87 87
88 ba,pt %xcc, 2f 88 ba,a,pt %xcc, 2f
89 nop
90 89
911: ba,pt %xcc, etrap_irq 901: ba,pt %xcc, etrap_irq
92 rd %pc, %g7 91 rd %pc, %g7
@@ -100,8 +99,7 @@ __spitfire_cee_trap_continue:
100 mov %l5, %o2 99 mov %l5, %o2
101 call spitfire_access_error 100 call spitfire_access_error
102 add %sp, PTREGS_OFF, %o0 101 add %sp, PTREGS_OFF, %o0
103 ba,pt %xcc, rtrap 102 ba,a,pt %xcc, rtrap
104 nop
105 .size __spitfire_access_error,.-__spitfire_access_error 103 .size __spitfire_access_error,.-__spitfire_access_error
106 104
107 /* This is the trap handler entry point for ECC correctable 105 /* This is the trap handler entry point for ECC correctable
@@ -179,8 +177,7 @@ __spitfire_data_access_exception_tl1:
179 mov %l5, %o2 177 mov %l5, %o2
180 call spitfire_data_access_exception_tl1 178 call spitfire_data_access_exception_tl1
181 add %sp, PTREGS_OFF, %o0 179 add %sp, PTREGS_OFF, %o0
182 ba,pt %xcc, rtrap 180 ba,a,pt %xcc, rtrap
183 nop
184 .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1 181 .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1
185 182
186 .type __spitfire_data_access_exception,#function 183 .type __spitfire_data_access_exception,#function
@@ -200,8 +197,7 @@ __spitfire_data_access_exception:
200 mov %l5, %o2 197 mov %l5, %o2
201 call spitfire_data_access_exception 198 call spitfire_data_access_exception
202 add %sp, PTREGS_OFF, %o0 199 add %sp, PTREGS_OFF, %o0
203 ba,pt %xcc, rtrap 200 ba,a,pt %xcc, rtrap
204 nop
205 .size __spitfire_data_access_exception,.-__spitfire_data_access_exception 201 .size __spitfire_data_access_exception,.-__spitfire_data_access_exception
206 202
207 .type __spitfire_insn_access_exception_tl1,#function 203 .type __spitfire_insn_access_exception_tl1,#function
@@ -220,8 +216,7 @@ __spitfire_insn_access_exception_tl1:
220 mov %l5, %o2 216 mov %l5, %o2
221 call spitfire_insn_access_exception_tl1 217 call spitfire_insn_access_exception_tl1
222 add %sp, PTREGS_OFF, %o0 218 add %sp, PTREGS_OFF, %o0
223 ba,pt %xcc, rtrap 219 ba,a,pt %xcc, rtrap
224 nop
225 .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1 220 .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1
226 221
227 .type __spitfire_insn_access_exception,#function 222 .type __spitfire_insn_access_exception,#function
@@ -240,6 +235,5 @@ __spitfire_insn_access_exception:
240 mov %l5, %o2 235 mov %l5, %o2
241 call spitfire_insn_access_exception 236 call spitfire_insn_access_exception
242 add %sp, PTREGS_OFF, %o0 237 add %sp, PTREGS_OFF, %o0
243 ba,pt %xcc, rtrap 238 ba,a,pt %xcc, rtrap
244 nop
245 .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception 239 .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 6c3dd6c52f8b..eac7f0db5c8c 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -88,4 +88,4 @@ sys_call_table:
88/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 88/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
89/*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf 89/*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
90/*350*/ .long sys_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen 90/*350*/ .long sys_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
91/*355*/ .long sys_setsockopt, sys_mlock2, sys_copy_file_range 91/*355*/ .long sys_setsockopt, sys_mlock2, sys_copy_file_range, sys_preadv2, sys_pwritev2
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 12b524cfcfa0..b0f17ff2ddba 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -89,7 +89,7 @@ sys_call_table32:
89/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 89/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
90 .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf 90 .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
91/*350*/ .word sys32_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen 91/*350*/ .word sys32_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
92 .word compat_sys_setsockopt, sys_mlock2, sys_copy_file_range 92 .word compat_sys_setsockopt, sys_mlock2, sys_copy_file_range, compat_sys_preadv2, compat_sys_pwritev2
93 93
94#endif /* CONFIG_COMPAT */ 94#endif /* CONFIG_COMPAT */
95 95
@@ -170,4 +170,4 @@ sys_call_table:
170/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 170/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
171 .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf 171 .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
172/*350*/ .word sys64_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen 172/*350*/ .word sys64_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
173 .word sys_setsockopt, sys_mlock2, sys_copy_file_range 173 .word sys_setsockopt, sys_mlock2, sys_copy_file_range, sys_preadv2, sys_pwritev2
diff --git a/arch/sparc/kernel/utrap.S b/arch/sparc/kernel/utrap.S
index b7f0f3f3a909..c731e8023d3e 100644
--- a/arch/sparc/kernel/utrap.S
+++ b/arch/sparc/kernel/utrap.S
@@ -11,8 +11,7 @@ utrap_trap: /* %g3=handler,%g4=level */
11 mov %l4, %o1 11 mov %l4, %o1
12 call bad_trap 12 call bad_trap
13 add %sp, PTREGS_OFF, %o0 13 add %sp, PTREGS_OFF, %o0
14 ba,pt %xcc, rtrap 14 ba,a,pt %xcc, rtrap
15 nop
16 15
17invoke_utrap: 16invoke_utrap:
18 sllx %g3, 3, %g3 17 sllx %g3, 3, %g3
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index cb5789c9f961..f6bb857254fc 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -45,6 +45,14 @@ static const struct vio_device_id *vio_match_device(
45 return NULL; 45 return NULL;
46} 46}
47 47
48static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
49{
50 const struct vio_dev *vio_dev = to_vio_dev(dev);
51
52 add_uevent_var(env, "MODALIAS=vio:T%sS%s", vio_dev->type, vio_dev->compat);
53 return 0;
54}
55
48static int vio_bus_match(struct device *dev, struct device_driver *drv) 56static int vio_bus_match(struct device *dev, struct device_driver *drv)
49{ 57{
50 struct vio_dev *vio_dev = to_vio_dev(dev); 58 struct vio_dev *vio_dev = to_vio_dev(dev);
@@ -105,15 +113,25 @@ static ssize_t type_show(struct device *dev,
105 return sprintf(buf, "%s\n", vdev->type); 113 return sprintf(buf, "%s\n", vdev->type);
106} 114}
107 115
116static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
117 char *buf)
118{
119 const struct vio_dev *vdev = to_vio_dev(dev);
120
121 return sprintf(buf, "vio:T%sS%s\n", vdev->type, vdev->compat);
122}
123
108static struct device_attribute vio_dev_attrs[] = { 124static struct device_attribute vio_dev_attrs[] = {
109 __ATTR_RO(devspec), 125 __ATTR_RO(devspec),
110 __ATTR_RO(type), 126 __ATTR_RO(type),
127 __ATTR_RO(modalias),
111 __ATTR_NULL 128 __ATTR_NULL
112}; 129};
113 130
114static struct bus_type vio_bus_type = { 131static struct bus_type vio_bus_type = {
115 .name = "vio", 132 .name = "vio",
116 .dev_attrs = vio_dev_attrs, 133 .dev_attrs = vio_dev_attrs,
134 .uevent = vio_hotplug,
117 .match = vio_bus_match, 135 .match = vio_bus_match,
118 .probe = vio_device_probe, 136 .probe = vio_device_probe,
119 .remove = vio_device_remove, 137 .remove = vio_device_remove,
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index aadd321aa05d..7d02b1fef025 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -33,6 +33,10 @@ ENTRY(_start)
33jiffies = jiffies_64; 33jiffies = jiffies_64;
34#endif 34#endif
35 35
36#ifdef CONFIG_SPARC64
37ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
38#endif
39
36SECTIONS 40SECTIONS
37{ 41{
38#ifdef CONFIG_SPARC64 42#ifdef CONFIG_SPARC64
diff --git a/arch/sparc/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S
index 1e67ce958369..855019a8590e 100644
--- a/arch/sparc/kernel/winfixup.S
+++ b/arch/sparc/kernel/winfixup.S
@@ -32,8 +32,7 @@ fill_fixup:
32 rd %pc, %g7 32 rd %pc, %g7
33 call do_sparc64_fault 33 call do_sparc64_fault
34 add %sp, PTREGS_OFF, %o0 34 add %sp, PTREGS_OFF, %o0
35 ba,pt %xcc, rtrap 35 ba,a,pt %xcc, rtrap
36 nop
37 36
38 /* Be very careful about usage of the trap globals here. 37 /* Be very careful about usage of the trap globals here.
39 * You cannot touch %g5 as that has the fault information. 38 * You cannot touch %g5 as that has the fault information.
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 1cfe6aab7a11..09e838801e39 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1769,6 +1769,7 @@ static void __init setup_page_offset(void)
1769 max_phys_bits = 47; 1769 max_phys_bits = 47;
1770 break; 1770 break;
1771 case SUN4V_CHIP_SPARC_M7: 1771 case SUN4V_CHIP_SPARC_M7:
1772 case SUN4V_CHIP_SPARC_SN:
1772 default: 1773 default:
1773 /* M7 and later support 52-bit virtual addresses. */ 1774 /* M7 and later support 52-bit virtual addresses. */
1774 sparc64_va_hole_top = 0xfff8000000000000UL; 1775 sparc64_va_hole_top = 0xfff8000000000000UL;
@@ -1986,6 +1987,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
1986 */ 1987 */
1987 switch (sun4v_chip_type) { 1988 switch (sun4v_chip_type) {
1988 case SUN4V_CHIP_SPARC_M7: 1989 case SUN4V_CHIP_SPARC_M7:
1990 case SUN4V_CHIP_SPARC_SN:
1989 pagecv_flag = 0x00; 1991 pagecv_flag = 0x00;
1990 break; 1992 break;
1991 default: 1993 default:
@@ -2138,6 +2140,7 @@ void __init paging_init(void)
2138 */ 2140 */
2139 switch (sun4v_chip_type) { 2141 switch (sun4v_chip_type) {
2140 case SUN4V_CHIP_SPARC_M7: 2142 case SUN4V_CHIP_SPARC_M7:
2143 case SUN4V_CHIP_SPARC_SN:
2141 page_cache4v_flag = _PAGE_CP_4V; 2144 page_cache4v_flag = _PAGE_CP_4V;
2142 break; 2145 break;
2143 default: 2146 default:
diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index 40625ca7a190..6011a573dd64 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -474,6 +474,7 @@ static __init int _init_perf_amd_iommu(
474 474
475static struct perf_amd_iommu __perf_iommu = { 475static struct perf_amd_iommu __perf_iommu = {
476 .pmu = { 476 .pmu = {
477 .task_ctx_nr = perf_invalid_context,
477 .event_init = perf_iommu_event_init, 478 .event_init = perf_iommu_event_init,
478 .add = perf_iommu_add, 479 .add = perf_iommu_add,
479 .del = perf_iommu_del, 480 .del = perf_iommu_del,
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index aff79884e17d..a6fd4dbcf820 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3637,6 +3637,8 @@ __init int intel_pmu_init(void)
3637 pr_cont("Knights Landing events, "); 3637 pr_cont("Knights Landing events, ");
3638 break; 3638 break;
3639 3639
3640 case 142: /* 14nm Kabylake Mobile */
3641 case 158: /* 14nm Kabylake Desktop */
3640 case 78: /* 14nm Skylake Mobile */ 3642 case 78: /* 14nm Skylake Mobile */
3641 case 94: /* 14nm Skylake Desktop */ 3643 case 94: /* 14nm Skylake Desktop */
3642 case 85: /* 14nm Skylake Server */ 3644 case 85: /* 14nm Skylake Server */
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 8f4942e2bcbb..d7ce96a7daca 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -891,9 +891,7 @@ void __init uv_system_init(void)
891 } 891 }
892 pr_info("UV: Found %s hub\n", hub); 892 pr_info("UV: Found %s hub\n", hub);
893 893
894 /* We now only need to map the MMRs on UV1 */ 894 map_low_mmrs();
895 if (is_uv1_hub())
896 map_low_mmrs();
897 895
898 m_n_config.v = uv_read_local_mmr(UVH_RH_GAM_CONFIG_MMR ); 896 m_n_config.v = uv_read_local_mmr(UVH_RH_GAM_CONFIG_MMR );
899 m_val = m_n_config.s.m_skt; 897 m_val = m_n_config.s.m_skt;
diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c
index b285d4e8c68e..5da924bbf0a0 100644
--- a/arch/x86/kernel/sysfb_efi.c
+++ b/arch/x86/kernel/sysfb_efi.c
@@ -106,14 +106,24 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
106 continue; 106 continue;
107 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 107 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
108 resource_size_t start, end; 108 resource_size_t start, end;
109 unsigned long flags;
110
111 flags = pci_resource_flags(dev, i);
112 if (!(flags & IORESOURCE_MEM))
113 continue;
114
115 if (flags & IORESOURCE_UNSET)
116 continue;
117
118 if (pci_resource_len(dev, i) == 0)
119 continue;
109 120
110 start = pci_resource_start(dev, i); 121 start = pci_resource_start(dev, i);
111 if (start == 0)
112 break;
113 end = pci_resource_end(dev, i); 122 end = pci_resource_end(dev, i);
114 if (screen_info.lfb_base >= start && 123 if (screen_info.lfb_base >= start &&
115 screen_info.lfb_base < end) { 124 screen_info.lfb_base < end) {
116 found_bar = 1; 125 found_bar = 1;
126 break;
117 } 127 }
118 } 128 }
119 } 129 }
diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c
index 92ae6acac8a7..6aa0f4d9eea6 100644
--- a/arch/x86/kernel/tsc_msr.c
+++ b/arch/x86/kernel/tsc_msr.c
@@ -92,7 +92,7 @@ unsigned long try_msr_calibrate_tsc(void)
92 92
93 if (freq_desc_tables[cpu_index].msr_plat) { 93 if (freq_desc_tables[cpu_index].msr_plat) {
94 rdmsr(MSR_PLATFORM_INFO, lo, hi); 94 rdmsr(MSR_PLATFORM_INFO, lo, hi);
95 ratio = (lo >> 8) & 0x1f; 95 ratio = (lo >> 8) & 0xff;
96 } else { 96 } else {
97 rdmsr(MSR_IA32_PERF_STATUS, lo, hi); 97 rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
98 ratio = (hi >> 8) & 0x1f; 98 ratio = (hi >> 8) & 0x1f;
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1ff4dbb73fb7..b6f50e8b0a39 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2823,7 +2823,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu,
2823 */ 2823 */
2824 if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) && 2824 if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) &&
2825 level == PT_PAGE_TABLE_LEVEL && 2825 level == PT_PAGE_TABLE_LEVEL &&
2826 PageTransCompound(pfn_to_page(pfn)) && 2826 PageTransCompoundMap(pfn_to_page(pfn)) &&
2827 !mmu_gfn_lpage_is_disallowed(vcpu, gfn, PT_DIRECTORY_LEVEL)) { 2827 !mmu_gfn_lpage_is_disallowed(vcpu, gfn, PT_DIRECTORY_LEVEL)) {
2828 unsigned long mask; 2828 unsigned long mask;
2829 /* 2829 /*
@@ -4785,7 +4785,7 @@ restart:
4785 */ 4785 */
4786 if (sp->role.direct && 4786 if (sp->role.direct &&
4787 !kvm_is_reserved_pfn(pfn) && 4787 !kvm_is_reserved_pfn(pfn) &&
4788 PageTransCompound(pfn_to_page(pfn))) { 4788 PageTransCompoundMap(pfn_to_page(pfn))) {
4789 drop_spte(kvm, sptep); 4789 drop_spte(kvm, sptep);
4790 need_tlb_flush = 1; 4790 need_tlb_flush = 1;
4791 goto restart; 4791 goto restart;
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index a2433817c987..6a2f5691b1ab 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -43,40 +43,40 @@ void __init efi_bgrt_init(void)
43 return; 43 return;
44 44
45 if (bgrt_tab->header.length < sizeof(*bgrt_tab)) { 45 if (bgrt_tab->header.length < sizeof(*bgrt_tab)) {
46 pr_err("Ignoring BGRT: invalid length %u (expected %zu)\n", 46 pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
47 bgrt_tab->header.length, sizeof(*bgrt_tab)); 47 bgrt_tab->header.length, sizeof(*bgrt_tab));
48 return; 48 return;
49 } 49 }
50 if (bgrt_tab->version != 1) { 50 if (bgrt_tab->version != 1) {
51 pr_err("Ignoring BGRT: invalid version %u (expected 1)\n", 51 pr_notice("Ignoring BGRT: invalid version %u (expected 1)\n",
52 bgrt_tab->version); 52 bgrt_tab->version);
53 return; 53 return;
54 } 54 }
55 if (bgrt_tab->status & 0xfe) { 55 if (bgrt_tab->status & 0xfe) {
56 pr_err("Ignoring BGRT: reserved status bits are non-zero %u\n", 56 pr_notice("Ignoring BGRT: reserved status bits are non-zero %u\n",
57 bgrt_tab->status); 57 bgrt_tab->status);
58 return; 58 return;
59 } 59 }
60 if (bgrt_tab->image_type != 0) { 60 if (bgrt_tab->image_type != 0) {
61 pr_err("Ignoring BGRT: invalid image type %u (expected 0)\n", 61 pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n",
62 bgrt_tab->image_type); 62 bgrt_tab->image_type);
63 return; 63 return;
64 } 64 }
65 if (!bgrt_tab->image_address) { 65 if (!bgrt_tab->image_address) {
66 pr_err("Ignoring BGRT: null image address\n"); 66 pr_notice("Ignoring BGRT: null image address\n");
67 return; 67 return;
68 } 68 }
69 69
70 image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB); 70 image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
71 if (!image) { 71 if (!image) {
72 pr_err("Ignoring BGRT: failed to map image header memory\n"); 72 pr_notice("Ignoring BGRT: failed to map image header memory\n");
73 return; 73 return;
74 } 74 }
75 75
76 memcpy(&bmp_header, image, sizeof(bmp_header)); 76 memcpy(&bmp_header, image, sizeof(bmp_header));
77 memunmap(image); 77 memunmap(image);
78 if (bmp_header.id != 0x4d42) { 78 if (bmp_header.id != 0x4d42) {
79 pr_err("Ignoring BGRT: Incorrect BMP magic number 0x%x (expected 0x4d42)\n", 79 pr_notice("Ignoring BGRT: Incorrect BMP magic number 0x%x (expected 0x4d42)\n",
80 bmp_header.id); 80 bmp_header.id);
81 return; 81 return;
82 } 82 }
@@ -84,14 +84,14 @@ void __init efi_bgrt_init(void)
84 84
85 bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN); 85 bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
86 if (!bgrt_image) { 86 if (!bgrt_image) {
87 pr_err("Ignoring BGRT: failed to allocate memory for image (wanted %zu bytes)\n", 87 pr_notice("Ignoring BGRT: failed to allocate memory for image (wanted %zu bytes)\n",
88 bgrt_image_size); 88 bgrt_image_size);
89 return; 89 return;
90 } 90 }
91 91
92 image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB); 92 image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
93 if (!image) { 93 if (!image) {
94 pr_err("Ignoring BGRT: failed to map image memory\n"); 94 pr_notice("Ignoring BGRT: failed to map image memory\n");
95 kfree(bgrt_image); 95 kfree(bgrt_image);
96 bgrt_image = NULL; 96 bgrt_image = NULL;
97 return; 97 return;
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 1982310e6d83..da198b864107 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -428,6 +428,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
428 obj_desc->method.mutex->mutex. 428 obj_desc->method.mutex->mutex.
429 original_sync_level = 429 original_sync_level =
430 obj_desc->method.mutex->mutex.sync_level; 430 obj_desc->method.mutex->mutex.sync_level;
431
432 obj_desc->method.mutex->mutex.thread_id =
433 acpi_os_get_thread_id();
431 } 434 }
432 } 435 }
433 436
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index d0f35e63640b..63cc9dbe4f3b 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -287,8 +287,11 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
287 offset); 287 offset);
288 rc = -ENXIO; 288 rc = -ENXIO;
289 } 289 }
290 } else 290 } else {
291 rc = 0; 291 rc = 0;
292 if (cmd_rc)
293 *cmd_rc = xlat_status(buf, cmd);
294 }
292 295
293 out: 296 out:
294 ACPI_FREE(out_obj); 297 ACPI_FREE(out_obj);
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 5083f85efea7..cfa936a32513 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -202,6 +202,14 @@ config SATA_FSL
202 202
203 If unsure, say N. 203 If unsure, say N.
204 204
205config SATA_AHCI_SEATTLE
206 tristate "AMD Seattle 6.0Gbps AHCI SATA host controller support"
207 depends on ARCH_SEATTLE
208 help
209 This option enables support for AMD Seattle SATA host controller.
210
211 If unsure, say N
212
205config SATA_INIC162X 213config SATA_INIC162X
206 tristate "Initio 162x SATA support (Very Experimental)" 214 tristate "Initio 162x SATA support (Very Experimental)"
207 depends on PCI 215 depends on PCI
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 18579521464e..0b2afb7e5f35 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_ATA) += libata.o
4# non-SFF interface 4# non-SFF interface
5obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o 5obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o
6obj-$(CONFIG_SATA_ACARD_AHCI) += acard-ahci.o libahci.o 6obj-$(CONFIG_SATA_ACARD_AHCI) += acard-ahci.o libahci.o
7obj-$(CONFIG_SATA_AHCI_SEATTLE) += ahci_seattle.o libahci.o libahci_platform.o
7obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o libahci_platform.o 8obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o libahci_platform.o
8obj-$(CONFIG_SATA_FSL) += sata_fsl.o 9obj-$(CONFIG_SATA_FSL) += sata_fsl.o
9obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o 10obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 40442332bfa7..62a04c8fb5c9 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -51,6 +51,9 @@ static int ahci_probe(struct platform_device *pdev)
51 if (rc) 51 if (rc)
52 return rc; 52 return rc;
53 53
54 of_property_read_u32(dev->of_node,
55 "ports-implemented", &hpriv->force_port_map);
56
54 if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) 57 if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
55 hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; 58 hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;
56 59
diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c
new file mode 100644
index 000000000000..6e702ab57220
--- /dev/null
+++ b/drivers/ata/ahci_seattle.c
@@ -0,0 +1,210 @@
1/*
2 * AMD Seattle AHCI SATA driver
3 *
4 * Copyright (c) 2015, Advanced Micro Devices
5 * Author: Brijesh Singh <brijesh.singh@amd.com>
6 *
7 * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20#include <linux/module.h>
21#include <linux/pm.h>
22#include <linux/device.h>
23#include <linux/of_device.h>
24#include <linux/platform_device.h>
25#include <linux/libata.h>
26#include <linux/ahci_platform.h>
27#include <linux/acpi.h>
28#include <linux/pci_ids.h>
29#include "ahci.h"
30
31/* SGPIO Control Register definition
32 *
33 * Bit Type Description
34 * 31 RW OD7.2 (activity)
35 * 30 RW OD7.1 (locate)
36 * 29 RW OD7.0 (fault)
37 * 28...8 RW OD6.2...OD0.0 (3bits per port, 1 bit per LED)
38 * 7 RO SGPIO feature flag
39 * 6:4 RO Reserved
40 * 3:0 RO Number of ports (0 means no port supported)
41 */
42#define ACTIVITY_BIT_POS(x) (8 + (3 * x))
43#define LOCATE_BIT_POS(x) (ACTIVITY_BIT_POS(x) + 1)
44#define FAULT_BIT_POS(x) (LOCATE_BIT_POS(x) + 1)
45
46#define ACTIVITY_MASK 0x00010000
47#define LOCATE_MASK 0x00080000
48#define FAULT_MASK 0x00400000
49
50#define DRV_NAME "ahci-seattle"
51
52static ssize_t seattle_transmit_led_message(struct ata_port *ap, u32 state,
53 ssize_t size);
54
55struct seattle_plat_data {
56 void __iomem *sgpio_ctrl;
57};
58
59static struct ata_port_operations ahci_port_ops = {
60 .inherits = &ahci_ops,
61};
62
63static const struct ata_port_info ahci_port_info = {
64 .flags = AHCI_FLAG_COMMON,
65 .pio_mask = ATA_PIO4,
66 .udma_mask = ATA_UDMA6,
67 .port_ops = &ahci_port_ops,
68};
69
70static struct ata_port_operations ahci_seattle_ops = {
71 .inherits = &ahci_ops,
72 .transmit_led_message = seattle_transmit_led_message,
73};
74
75static const struct ata_port_info ahci_port_seattle_info = {
76 .flags = AHCI_FLAG_COMMON | ATA_FLAG_EM | ATA_FLAG_SW_ACTIVITY,
77 .link_flags = ATA_LFLAG_SW_ACTIVITY,
78 .pio_mask = ATA_PIO4,
79 .udma_mask = ATA_UDMA6,
80 .port_ops = &ahci_seattle_ops,
81};
82
83static struct scsi_host_template ahci_platform_sht = {
84 AHCI_SHT(DRV_NAME),
85};
86
87static ssize_t seattle_transmit_led_message(struct ata_port *ap, u32 state,
88 ssize_t size)
89{
90 struct ahci_host_priv *hpriv = ap->host->private_data;
91 struct ahci_port_priv *pp = ap->private_data;
92 struct seattle_plat_data *plat_data = hpriv->plat_data;
93 unsigned long flags;
94 int pmp;
95 struct ahci_em_priv *emp;
96 u32 val;
97
98 /* get the slot number from the message */
99 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
100 if (pmp >= EM_MAX_SLOTS)
101 return -EINVAL;
102 emp = &pp->em_priv[pmp];
103
104 val = ioread32(plat_data->sgpio_ctrl);
105 if (state & ACTIVITY_MASK)
106 val |= 1 << ACTIVITY_BIT_POS((ap->port_no));
107 else
108 val &= ~(1 << ACTIVITY_BIT_POS((ap->port_no)));
109
110 if (state & LOCATE_MASK)
111 val |= 1 << LOCATE_BIT_POS((ap->port_no));
112 else
113 val &= ~(1 << LOCATE_BIT_POS((ap->port_no)));
114
115 if (state & FAULT_MASK)
116 val |= 1 << FAULT_BIT_POS((ap->port_no));
117 else
118 val &= ~(1 << FAULT_BIT_POS((ap->port_no)));
119
120 iowrite32(val, plat_data->sgpio_ctrl);
121
122 spin_lock_irqsave(ap->lock, flags);
123
124 /* save off new led state for port/slot */
125 emp->led_state = state;
126
127 spin_unlock_irqrestore(ap->lock, flags);
128
129 return size;
130}
131
132static const struct ata_port_info *ahci_seattle_get_port_info(
133 struct platform_device *pdev, struct ahci_host_priv *hpriv)
134{
135 struct device *dev = &pdev->dev;
136 struct seattle_plat_data *plat_data;
137 u32 val;
138
139 plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL);
140 if (IS_ERR(plat_data))
141 return &ahci_port_info;
142
143 plat_data->sgpio_ctrl = devm_ioremap_resource(dev,
144 platform_get_resource(pdev, IORESOURCE_MEM, 1));
145 if (IS_ERR(plat_data->sgpio_ctrl))
146 return &ahci_port_info;
147
148 val = ioread32(plat_data->sgpio_ctrl);
149
150 if (!(val & 0xf))
151 return &ahci_port_info;
152
153 hpriv->em_loc = 0;
154 hpriv->em_buf_sz = 4;
155 hpriv->em_msg_type = EM_MSG_TYPE_LED;
156 hpriv->plat_data = plat_data;
157
158 dev_info(dev, "SGPIO LED control is enabled.\n");
159 return &ahci_port_seattle_info;
160}
161
162static int ahci_seattle_probe(struct platform_device *pdev)
163{
164 int rc;
165 struct ahci_host_priv *hpriv;
166
167 hpriv = ahci_platform_get_resources(pdev);
168 if (IS_ERR(hpriv))
169 return PTR_ERR(hpriv);
170
171 rc = ahci_platform_enable_resources(hpriv);
172 if (rc)
173 return rc;
174
175 rc = ahci_platform_init_host(pdev, hpriv,
176 ahci_seattle_get_port_info(pdev, hpriv),
177 &ahci_platform_sht);
178 if (rc)
179 goto disable_resources;
180
181 return 0;
182disable_resources:
183 ahci_platform_disable_resources(hpriv);
184 return rc;
185}
186
187static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
188 ahci_platform_resume);
189
190static const struct acpi_device_id ahci_acpi_match[] = {
191 { "AMDI0600", 0 },
192 {}
193};
194MODULE_DEVICE_TABLE(acpi, ahci_acpi_match);
195
196static struct platform_driver ahci_seattle_driver = {
197 .probe = ahci_seattle_probe,
198 .remove = ata_platform_remove_one,
199 .driver = {
200 .name = DRV_NAME,
201 .acpi_match_table = ahci_acpi_match,
202 .pm = &ahci_pm_ops,
203 },
204};
205module_platform_driver(ahci_seattle_driver);
206
207MODULE_DESCRIPTION("Seattle AHCI SATA platform driver");
208MODULE_AUTHOR("Brijesh Singh <brijesh.singh@amd.com>");
209MODULE_LICENSE("GPL");
210MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 3982054060b8..a5d7c1c2a05e 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -507,6 +507,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
507 dev_info(dev, "forcing port_map 0x%x -> 0x%x\n", 507 dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
508 port_map, hpriv->force_port_map); 508 port_map, hpriv->force_port_map);
509 port_map = hpriv->force_port_map; 509 port_map = hpriv->force_port_map;
510 hpriv->saved_port_map = port_map;
510 } 511 }
511 512
512 if (hpriv->mask_port_map) { 513 if (hpriv->mask_port_map) {
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 433b60092972..d8f4cc22856c 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -259,9 +259,6 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
259 reg = opp_table->regulator; 259 reg = opp_table->regulator;
260 if (IS_ERR(reg)) { 260 if (IS_ERR(reg)) {
261 /* Regulator may not be required for device */ 261 /* Regulator may not be required for device */
262 if (reg)
263 dev_err(dev, "%s: Invalid regulator (%ld)\n", __func__,
264 PTR_ERR(reg));
265 rcu_read_unlock(); 262 rcu_read_unlock();
266 return 0; 263 return 0;
267 } 264 }
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 9b1a65debd49..7f692accdc90 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -21,7 +21,7 @@
21 21
22static inline bool is_pset_node(struct fwnode_handle *fwnode) 22static inline bool is_pset_node(struct fwnode_handle *fwnode)
23{ 23{
24 return fwnode && fwnode->type == FWNODE_PDATA; 24 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_PDATA;
25} 25}
26 26
27static inline struct property_set *to_pset_node(struct fwnode_handle *fwnode) 27static inline struct property_set *to_pset_node(struct fwnode_handle *fwnode)
diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index 02e18182fcb5..2beb396fe652 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -394,7 +394,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
394 clk[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1", 2, 7); 394 clk[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1", 2, 7);
395 } else { 395 } else {
396 clk[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6); 396 clk[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6);
397 clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60", base + 0x20, 2, 6); 397 clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6);
398 clk[IMX6QDL_CLK_IPG_PER] = imx_clk_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup); 398 clk[IMX6QDL_CLK_IPG_PER] = imx_clk_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup);
399 clk[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6); 399 clk[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6);
400 clk[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 400 clk[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e93405f0eac4..c4acfc5273b3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1557,21 +1557,25 @@ void cpufreq_suspend(void)
1557 if (!cpufreq_driver) 1557 if (!cpufreq_driver)
1558 return; 1558 return;
1559 1559
1560 if (!has_target()) 1560 if (!has_target() && !cpufreq_driver->suspend)
1561 goto suspend; 1561 goto suspend;
1562 1562
1563 pr_debug("%s: Suspending Governors\n", __func__); 1563 pr_debug("%s: Suspending Governors\n", __func__);
1564 1564
1565 for_each_active_policy(policy) { 1565 for_each_active_policy(policy) {
1566 down_write(&policy->rwsem); 1566 if (has_target()) {
1567 ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP); 1567 down_write(&policy->rwsem);
1568 up_write(&policy->rwsem); 1568 ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP);
1569 up_write(&policy->rwsem);
1569 1570
1570 if (ret) 1571 if (ret) {
1571 pr_err("%s: Failed to stop governor for policy: %p\n", 1572 pr_err("%s: Failed to stop governor for policy: %p\n",
1572 __func__, policy); 1573 __func__, policy);
1573 else if (cpufreq_driver->suspend 1574 continue;
1574 && cpufreq_driver->suspend(policy)) 1575 }
1576 }
1577
1578 if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy))
1575 pr_err("%s: Failed to suspend driver: %p\n", __func__, 1579 pr_err("%s: Failed to suspend driver: %p\n", __func__,
1576 policy); 1580 policy);
1577 } 1581 }
@@ -1596,7 +1600,7 @@ void cpufreq_resume(void)
1596 1600
1597 cpufreq_suspended = false; 1601 cpufreq_suspended = false;
1598 1602
1599 if (!has_target()) 1603 if (!has_target() && !cpufreq_driver->resume)
1600 return; 1604 return;
1601 1605
1602 pr_debug("%s: Resuming Governors\n", __func__); 1606 pr_debug("%s: Resuming Governors\n", __func__);
@@ -1605,7 +1609,7 @@ void cpufreq_resume(void)
1605 if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) { 1609 if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) {
1606 pr_err("%s: Failed to resume driver: %p\n", __func__, 1610 pr_err("%s: Failed to resume driver: %p\n", __func__,
1607 policy); 1611 policy);
1608 } else { 1612 } else if (has_target()) {
1609 down_write(&policy->rwsem); 1613 down_write(&policy->rwsem);
1610 ret = cpufreq_start_governor(policy); 1614 ret = cpufreq_start_governor(policy);
1611 up_write(&policy->rwsem); 1615 up_write(&policy->rwsem);
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index f502d5b90c25..b230ebaae66c 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -453,6 +453,14 @@ static void intel_pstate_hwp_set(const struct cpumask *cpumask)
453 } 453 }
454} 454}
455 455
456static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy)
457{
458 if (hwp_active)
459 intel_pstate_hwp_set(policy->cpus);
460
461 return 0;
462}
463
456static void intel_pstate_hwp_set_online_cpus(void) 464static void intel_pstate_hwp_set_online_cpus(void)
457{ 465{
458 get_online_cpus(); 466 get_online_cpus();
@@ -1062,8 +1070,9 @@ static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time)
1062 1070
1063static inline int32_t get_avg_frequency(struct cpudata *cpu) 1071static inline int32_t get_avg_frequency(struct cpudata *cpu)
1064{ 1072{
1065 return div64_u64(cpu->pstate.max_pstate_physical * cpu->sample.aperf * 1073 return fp_toint(mul_fp(cpu->sample.core_pct_busy,
1066 cpu->pstate.scaling, cpu->sample.mperf); 1074 int_tofp(cpu->pstate.max_pstate_physical *
1075 cpu->pstate.scaling / 100)));
1067} 1076}
1068 1077
1069static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) 1078static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu)
@@ -1106,8 +1115,6 @@ static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu)
1106 int32_t core_busy, max_pstate, current_pstate, sample_ratio; 1115 int32_t core_busy, max_pstate, current_pstate, sample_ratio;
1107 u64 duration_ns; 1116 u64 duration_ns;
1108 1117
1109 intel_pstate_calc_busy(cpu);
1110
1111 /* 1118 /*
1112 * core_busy is the ratio of actual performance to max 1119 * core_busy is the ratio of actual performance to max
1113 * max_pstate is the max non turbo pstate available 1120 * max_pstate is the max non turbo pstate available
@@ -1191,8 +1198,11 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time,
1191 if ((s64)delta_ns >= pid_params.sample_rate_ns) { 1198 if ((s64)delta_ns >= pid_params.sample_rate_ns) {
1192 bool sample_taken = intel_pstate_sample(cpu, time); 1199 bool sample_taken = intel_pstate_sample(cpu, time);
1193 1200
1194 if (sample_taken && !hwp_active) 1201 if (sample_taken) {
1195 intel_pstate_adjust_busy_pstate(cpu); 1202 intel_pstate_calc_busy(cpu);
1203 if (!hwp_active)
1204 intel_pstate_adjust_busy_pstate(cpu);
1205 }
1196 } 1206 }
1197} 1207}
1198 1208
@@ -1346,8 +1356,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1346 out: 1356 out:
1347 intel_pstate_set_update_util_hook(policy->cpu); 1357 intel_pstate_set_update_util_hook(policy->cpu);
1348 1358
1349 if (hwp_active) 1359 intel_pstate_hwp_set_policy(policy);
1350 intel_pstate_hwp_set(policy->cpus);
1351 1360
1352 return 0; 1361 return 0;
1353} 1362}
@@ -1411,6 +1420,7 @@ static struct cpufreq_driver intel_pstate_driver = {
1411 .flags = CPUFREQ_CONST_LOOPS, 1420 .flags = CPUFREQ_CONST_LOOPS,
1412 .verify = intel_pstate_verify_policy, 1421 .verify = intel_pstate_verify_policy,
1413 .setpolicy = intel_pstate_set_policy, 1422 .setpolicy = intel_pstate_set_policy,
1423 .resume = intel_pstate_hwp_set_policy,
1414 .get = intel_pstate_get, 1424 .get = intel_pstate_get,
1415 .init = intel_pstate_cpu_init, 1425 .init = intel_pstate_cpu_init,
1416 .stop_cpu = intel_pstate_stop_cpu, 1426 .stop_cpu = intel_pstate_stop_cpu,
diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c
index a9c659f58974..04042038ec4b 100644
--- a/drivers/cpufreq/sti-cpufreq.c
+++ b/drivers/cpufreq/sti-cpufreq.c
@@ -259,6 +259,10 @@ static int sti_cpufreq_init(void)
259{ 259{
260 int ret; 260 int ret;
261 261
262 if ((!of_machine_is_compatible("st,stih407")) &&
263 (!of_machine_is_compatible("st,stih410")))
264 return -ENODEV;
265
262 ddata.cpu = get_cpu_device(0); 266 ddata.cpu = get_cpu_device(0);
263 if (!ddata.cpu) { 267 if (!ddata.cpu) {
264 dev_err(ddata.cpu, "Failed to get device for CPU0\n"); 268 dev_err(ddata.cpu, "Failed to get device for CPU0\n");
diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
index 545069d5fdfb..e342565e8715 100644
--- a/drivers/cpuidle/cpuidle-arm.c
+++ b/drivers/cpuidle/cpuidle-arm.c
@@ -50,7 +50,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev,
50 * call the CPU ops suspend protocol with idle index as a 50 * call the CPU ops suspend protocol with idle index as a
51 * parameter. 51 * parameter.
52 */ 52 */
53 arm_cpuidle_suspend(idx); 53 ret = arm_cpuidle_suspend(idx);
54 54
55 cpu_pm_exit(); 55 cpu_pm_exit();
56 } 56 }
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index 815c4a5cae54..1b95475b6aef 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -77,7 +77,7 @@ static inline u16 fw_cfg_sel_endianness(u16 key)
77static inline void fw_cfg_read_blob(u16 key, 77static inline void fw_cfg_read_blob(u16 key,
78 void *buf, loff_t pos, size_t count) 78 void *buf, loff_t pos, size_t count)
79{ 79{
80 u32 glk; 80 u32 glk = -1U;
81 acpi_status status; 81 acpi_status status;
82 82
83 /* If we have ACPI, ensure mutual exclusion against any potential 83 /* If we have ACPI, ensure mutual exclusion against any potential
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index d9ab0cd1d205..4d9a315cfd43 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -196,44 +196,6 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
196 return 0; 196 return 0;
197} 197}
198 198
199static void gpio_rcar_irq_bus_lock(struct irq_data *d)
200{
201 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
202 struct gpio_rcar_priv *p = gpiochip_get_data(gc);
203
204 pm_runtime_get_sync(&p->pdev->dev);
205}
206
207static void gpio_rcar_irq_bus_sync_unlock(struct irq_data *d)
208{
209 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
210 struct gpio_rcar_priv *p = gpiochip_get_data(gc);
211
212 pm_runtime_put(&p->pdev->dev);
213}
214
215
216static int gpio_rcar_irq_request_resources(struct irq_data *d)
217{
218 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
219 struct gpio_rcar_priv *p = gpiochip_get_data(gc);
220 int error;
221
222 error = pm_runtime_get_sync(&p->pdev->dev);
223 if (error < 0)
224 return error;
225
226 return 0;
227}
228
229static void gpio_rcar_irq_release_resources(struct irq_data *d)
230{
231 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
232 struct gpio_rcar_priv *p = gpiochip_get_data(gc);
233
234 pm_runtime_put(&p->pdev->dev);
235}
236
237static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id) 199static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
238{ 200{
239 struct gpio_rcar_priv *p = dev_id; 201 struct gpio_rcar_priv *p = dev_id;
@@ -280,32 +242,18 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
280 242
281static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) 243static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
282{ 244{
283 struct gpio_rcar_priv *p = gpiochip_get_data(chip); 245 return pinctrl_request_gpio(chip->base + offset);
284 int error;
285
286 error = pm_runtime_get_sync(&p->pdev->dev);
287 if (error < 0)
288 return error;
289
290 error = pinctrl_request_gpio(chip->base + offset);
291 if (error)
292 pm_runtime_put(&p->pdev->dev);
293
294 return error;
295} 246}
296 247
297static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset) 248static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
298{ 249{
299 struct gpio_rcar_priv *p = gpiochip_get_data(chip);
300
301 pinctrl_free_gpio(chip->base + offset); 250 pinctrl_free_gpio(chip->base + offset);
302 251
303 /* Set the GPIO as an input to ensure that the next GPIO request won't 252 /*
253 * Set the GPIO as an input to ensure that the next GPIO request won't
304 * drive the GPIO pin as an output. 254 * drive the GPIO pin as an output.
305 */ 255 */
306 gpio_rcar_config_general_input_output_mode(chip, offset, false); 256 gpio_rcar_config_general_input_output_mode(chip, offset, false);
307
308 pm_runtime_put(&p->pdev->dev);
309} 257}
310 258
311static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset) 259static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -452,6 +400,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
452 } 400 }
453 401
454 pm_runtime_enable(dev); 402 pm_runtime_enable(dev);
403 pm_runtime_get_sync(dev);
455 404
456 io = platform_get_resource(pdev, IORESOURCE_MEM, 0); 405 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
457 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 406 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -488,10 +437,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
488 irq_chip->irq_unmask = gpio_rcar_irq_enable; 437 irq_chip->irq_unmask = gpio_rcar_irq_enable;
489 irq_chip->irq_set_type = gpio_rcar_irq_set_type; 438 irq_chip->irq_set_type = gpio_rcar_irq_set_type;
490 irq_chip->irq_set_wake = gpio_rcar_irq_set_wake; 439 irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
491 irq_chip->irq_bus_lock = gpio_rcar_irq_bus_lock;
492 irq_chip->irq_bus_sync_unlock = gpio_rcar_irq_bus_sync_unlock;
493 irq_chip->irq_request_resources = gpio_rcar_irq_request_resources;
494 irq_chip->irq_release_resources = gpio_rcar_irq_release_resources;
495 irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND; 440 irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
496 441
497 ret = gpiochip_add_data(gpio_chip, p); 442 ret = gpiochip_add_data(gpio_chip, p);
@@ -522,6 +467,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
522err1: 467err1:
523 gpiochip_remove(gpio_chip); 468 gpiochip_remove(gpio_chip);
524err0: 469err0:
470 pm_runtime_put(dev);
525 pm_runtime_disable(dev); 471 pm_runtime_disable(dev);
526 return ret; 472 return ret;
527} 473}
@@ -532,6 +478,7 @@ static int gpio_rcar_remove(struct platform_device *pdev)
532 478
533 gpiochip_remove(&p->gpio_chip); 479 gpiochip_remove(&p->gpio_chip);
534 480
481 pm_runtime_put(&pdev->dev);
535 pm_runtime_disable(&pdev->dev); 482 pm_runtime_disable(&pdev->dev);
536 return 0; 483 return 0;
537} 484}
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 682070d20f00..2dc52585e3f2 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id)
977 lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); 977 lookup = kmalloc(sizeof(*lookup), GFP_KERNEL);
978 if (lookup) { 978 if (lookup) {
979 lookup->adev = adev; 979 lookup->adev = adev;
980 lookup->con_id = con_id; 980 lookup->con_id = kstrdup(con_id, GFP_KERNEL);
981 list_add_tail(&lookup->node, &acpi_crs_lookup_list); 981 list_add_tail(&lookup->node, &acpi_crs_lookup_list);
982 } 982 }
983 } 983 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index e557fc1f17c8..7ecea83ce453 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -541,6 +541,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
541 if (!metadata_size) { 541 if (!metadata_size) {
542 if (bo->metadata_size) { 542 if (bo->metadata_size) {
543 kfree(bo->metadata); 543 kfree(bo->metadata);
544 bo->metadata = NULL;
544 bo->metadata_size = 0; 545 bo->metadata_size = 0;
545 } 546 }
546 return 0; 547 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
index 1e0bba29e167..1cd6de575305 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
@@ -298,6 +298,10 @@ bool amdgpu_atombios_encoder_mode_fixup(struct drm_encoder *encoder,
298 && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) 298 && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
299 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; 299 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
300 300
301 /* vertical FP must be at least 1 */
302 if (mode->crtc_vsync_start == mode->crtc_vdisplay)
303 adjusted_mode->crtc_vsync_start++;
304
301 /* get the native mode for scaling */ 305 /* get the native mode for scaling */
302 if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) 306 if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT))
303 amdgpu_panel_mode_fixup(encoder, adjusted_mode); 307 amdgpu_panel_mode_fixup(encoder, adjusted_mode);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 30798cbc6fc0..6d2fb3f4ac62 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -792,7 +792,7 @@ static int i915_drm_resume(struct drm_device *dev)
792static int i915_drm_resume_early(struct drm_device *dev) 792static int i915_drm_resume_early(struct drm_device *dev)
793{ 793{
794 struct drm_i915_private *dev_priv = dev->dev_private; 794 struct drm_i915_private *dev_priv = dev->dev_private;
795 int ret = 0; 795 int ret;
796 796
797 /* 797 /*
798 * We have a resume ordering issue with the snd-hda driver also 798 * We have a resume ordering issue with the snd-hda driver also
@@ -803,6 +803,36 @@ static int i915_drm_resume_early(struct drm_device *dev)
803 * FIXME: This should be solved with a special hdmi sink device or 803 * FIXME: This should be solved with a special hdmi sink device or
804 * similar so that power domains can be employed. 804 * similar so that power domains can be employed.
805 */ 805 */
806
807 /*
808 * Note that we need to set the power state explicitly, since we
809 * powered off the device during freeze and the PCI core won't power
810 * it back up for us during thaw. Powering off the device during
811 * freeze is not a hard requirement though, and during the
812 * suspend/resume phases the PCI core makes sure we get here with the
813 * device powered on. So in case we change our freeze logic and keep
814 * the device powered we can also remove the following set power state
815 * call.
816 */
817 ret = pci_set_power_state(dev->pdev, PCI_D0);
818 if (ret) {
819 DRM_ERROR("failed to set PCI D0 power state (%d)\n", ret);
820 goto out;
821 }
822
823 /*
824 * Note that pci_enable_device() first enables any parent bridge
825 * device and only then sets the power state for this device. The
826 * bridge enabling is a nop though, since bridge devices are resumed
827 * first. The order of enabling power and enabling the device is
828 * imposed by the PCI core as described above, so here we preserve the
829 * same order for the freeze/thaw phases.
830 *
831 * TODO: eventually we should remove pci_disable_device() /
832 * pci_enable_enable_device() from suspend/resume. Due to how they
833 * depend on the device enable refcount we can't anyway depend on them
834 * disabling/enabling the device.
835 */
806 if (pci_enable_device(dev->pdev)) { 836 if (pci_enable_device(dev->pdev)) {
807 ret = -EIO; 837 ret = -EIO;
808 goto out; 838 goto out;
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f76cbf3e5d1e..fffdac801d3b 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2907,7 +2907,14 @@ enum skl_disp_power_wells {
2907#define GEN6_RP_STATE_CAP _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998) 2907#define GEN6_RP_STATE_CAP _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998)
2908#define BXT_RP_STATE_CAP _MMIO(0x138170) 2908#define BXT_RP_STATE_CAP _MMIO(0x138170)
2909 2909
2910#define INTERVAL_1_28_US(us) (((us) * 100) >> 7) 2910/*
2911 * Make these a multiple of magic 25 to avoid SNB (eg. Dell XPS
2912 * 8300) freezing up around GPU hangs. Looks as if even
2913 * scheduling/timer interrupts start misbehaving if the RPS
2914 * EI/thresholds are "bad", leading to a very sluggish or even
2915 * frozen machine.
2916 */
2917#define INTERVAL_1_28_US(us) roundup(((us) * 100) >> 7, 25)
2911#define INTERVAL_1_33_US(us) (((us) * 3) >> 2) 2918#define INTERVAL_1_33_US(us) (((us) * 3) >> 2)
2912#define INTERVAL_0_833_US(us) (((us) * 6) / 5) 2919#define INTERVAL_0_833_US(us) (((us) * 6) / 5)
2913#define GT_INTERVAL_FROM_US(dev_priv, us) (IS_GEN9(dev_priv) ? \ 2920#define GT_INTERVAL_FROM_US(dev_priv, us) (IS_GEN9(dev_priv) ? \
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 62de9f4bce09..3b57bf06abe8 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -443,9 +443,17 @@ void intel_prepare_ddi_buffer(struct intel_encoder *encoder)
443 } else if (IS_BROADWELL(dev_priv)) { 443 } else if (IS_BROADWELL(dev_priv)) {
444 ddi_translations_fdi = bdw_ddi_translations_fdi; 444 ddi_translations_fdi = bdw_ddi_translations_fdi;
445 ddi_translations_dp = bdw_ddi_translations_dp; 445 ddi_translations_dp = bdw_ddi_translations_dp;
446 ddi_translations_edp = bdw_ddi_translations_edp; 446
447 if (dev_priv->edp_low_vswing) {
448 ddi_translations_edp = bdw_ddi_translations_edp;
449 n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp);
450 } else {
451 ddi_translations_edp = bdw_ddi_translations_dp;
452 n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
453 }
454
447 ddi_translations_hdmi = bdw_ddi_translations_hdmi; 455 ddi_translations_hdmi = bdw_ddi_translations_hdmi;
448 n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp); 456
449 n_dp_entries = ARRAY_SIZE(bdw_ddi_translations_dp); 457 n_dp_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
450 n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi); 458 n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
451 hdmi_default_entry = 7; 459 hdmi_default_entry = 7;
@@ -3201,12 +3209,6 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
3201 intel_ddi_clock_get(encoder, pipe_config); 3209 intel_ddi_clock_get(encoder, pipe_config);
3202} 3210}
3203 3211
3204static void intel_ddi_destroy(struct drm_encoder *encoder)
3205{
3206 /* HDMI has nothing special to destroy, so we can go with this. */
3207 intel_dp_encoder_destroy(encoder);
3208}
3209
3210static bool intel_ddi_compute_config(struct intel_encoder *encoder, 3212static bool intel_ddi_compute_config(struct intel_encoder *encoder,
3211 struct intel_crtc_state *pipe_config) 3213 struct intel_crtc_state *pipe_config)
3212{ 3214{
@@ -3225,7 +3227,8 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder,
3225} 3227}
3226 3228
3227static const struct drm_encoder_funcs intel_ddi_funcs = { 3229static const struct drm_encoder_funcs intel_ddi_funcs = {
3228 .destroy = intel_ddi_destroy, 3230 .reset = intel_dp_encoder_reset,
3231 .destroy = intel_dp_encoder_destroy,
3229}; 3232};
3230 3233
3231static struct intel_connector * 3234static struct intel_connector *
@@ -3324,6 +3327,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
3324 intel_encoder->post_disable = intel_ddi_post_disable; 3327 intel_encoder->post_disable = intel_ddi_post_disable;
3325 intel_encoder->get_hw_state = intel_ddi_get_hw_state; 3328 intel_encoder->get_hw_state = intel_ddi_get_hw_state;
3326 intel_encoder->get_config = intel_ddi_get_config; 3329 intel_encoder->get_config = intel_ddi_get_config;
3330 intel_encoder->suspend = intel_dp_encoder_suspend;
3327 3331
3328 intel_dig_port->port = port; 3332 intel_dig_port->port = port;
3329 intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) & 3333 intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6e0d8283daa6..182f84937345 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13351,6 +13351,9 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
13351 } 13351 }
13352 13352
13353 for_each_crtc_in_state(state, crtc, crtc_state, i) { 13353 for_each_crtc_in_state(state, crtc, crtc_state, i) {
13354 if (state->legacy_cursor_update)
13355 continue;
13356
13354 ret = intel_crtc_wait_for_pending_flips(crtc); 13357 ret = intel_crtc_wait_for_pending_flips(crtc);
13355 if (ret) 13358 if (ret)
13356 return ret; 13359 return ret;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f069a82deb57..412a34c39522 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4898,7 +4898,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)
4898 kfree(intel_dig_port); 4898 kfree(intel_dig_port);
4899} 4899}
4900 4900
4901static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) 4901void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
4902{ 4902{
4903 struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); 4903 struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base);
4904 4904
@@ -4940,7 +4940,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
4940 edp_panel_vdd_schedule_off(intel_dp); 4940 edp_panel_vdd_schedule_off(intel_dp);
4941} 4941}
4942 4942
4943static void intel_dp_encoder_reset(struct drm_encoder *encoder) 4943void intel_dp_encoder_reset(struct drm_encoder *encoder)
4944{ 4944{
4945 struct intel_dp *intel_dp; 4945 struct intel_dp *intel_dp;
4946 4946
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 4c027d69fac9..7d3af3a72abe 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1238,6 +1238,8 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
1238void intel_dp_start_link_train(struct intel_dp *intel_dp); 1238void intel_dp_start_link_train(struct intel_dp *intel_dp);
1239void intel_dp_stop_link_train(struct intel_dp *intel_dp); 1239void intel_dp_stop_link_train(struct intel_dp *intel_dp);
1240void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode); 1240void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
1241void intel_dp_encoder_reset(struct drm_encoder *encoder);
1242void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
1241void intel_dp_encoder_destroy(struct drm_encoder *encoder); 1243void intel_dp_encoder_destroy(struct drm_encoder *encoder);
1242int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc); 1244int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
1243bool intel_dp_compute_config(struct intel_encoder *encoder, 1245bool intel_dp_compute_config(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index a0d8daed2470..1ab6f687f640 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1415,8 +1415,16 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
1415 hdmi_to_dig_port(intel_hdmi)); 1415 hdmi_to_dig_port(intel_hdmi));
1416 } 1416 }
1417 1417
1418 if (!live_status) 1418 if (!live_status) {
1419 DRM_DEBUG_KMS("Live status not up!"); 1419 DRM_DEBUG_KMS("HDMI live status down\n");
1420 /*
1421 * Live status register is not reliable on all intel platforms.
1422 * So consider live_status only for certain platforms, for
1423 * others, read EDID to determine presence of sink.
1424 */
1425 if (INTEL_INFO(dev_priv)->gen < 7 || IS_IVYBRIDGE(dev_priv))
1426 live_status = true;
1427 }
1420 1428
1421 intel_hdmi_unset_edid(connector); 1429 intel_hdmi_unset_edid(connector);
1422 1430
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index edd05cdb0cd8..587cae4e73c9 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -310,6 +310,10 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
310 && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) 310 && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
311 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; 311 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
312 312
313 /* vertical FP must be at least 1 */
314 if (mode->crtc_vsync_start == mode->crtc_vdisplay)
315 adjusted_mode->crtc_vsync_start++;
316
313 /* get the native mode for scaling */ 317 /* get the native mode for scaling */
314 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { 318 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
315 radeon_panel_mode_fixup(encoder, adjusted_mode); 319 radeon_panel_mode_fixup(encoder, adjusted_mode);
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index e00db3f510dd..abb98c77bad2 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1068,7 +1068,6 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
1068 goto err_register; 1068 goto err_register;
1069 } 1069 }
1070 1070
1071 pdev->dev.of_node = of_node;
1072 pdev->dev.parent = dev; 1071 pdev->dev.parent = dev;
1073 1072
1074 ret = platform_device_add_data(pdev, &reg->pdata, 1073 ret = platform_device_add_data(pdev, &reg->pdata,
@@ -1079,6 +1078,12 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
1079 platform_device_put(pdev); 1078 platform_device_put(pdev);
1080 goto err_register; 1079 goto err_register;
1081 } 1080 }
1081
1082 /*
1083 * Set of_node only after calling platform_device_add. Otherwise
1084 * the platform:imx-ipuv3-crtc modalias won't be used.
1085 */
1086 pdev->dev.of_node = of_node;
1082 } 1087 }
1083 1088
1084 return 0; 1089 return 0;
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index c6eaff5f8845..0238f0169e48 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -259,6 +259,7 @@
259#define USB_DEVICE_ID_CORSAIR_K90 0x1b02 259#define USB_DEVICE_ID_CORSAIR_K90 0x1b02
260 260
261#define USB_VENDOR_ID_CREATIVELABS 0x041e 261#define USB_VENDOR_ID_CREATIVELABS 0x041e
262#define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c
262#define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801 263#define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
263 264
264#define USB_VENDOR_ID_CVTOUCH 0x1ff7 265#define USB_VENDOR_ID_CVTOUCH 0x1ff7
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index ed2f68edc8f1..53fc856d6867 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -71,6 +71,7 @@ static const struct hid_blacklist {
71 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, 71 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
72 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, 72 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
73 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, 73 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
74 { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET },
74 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 75 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
75 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, 76 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
76 { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, 77 { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 02c4efea241c..cf2ba43453fd 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -684,6 +684,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
684 684
685 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]); 685 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]);
686 686
687 wacom->shared->stylus_in_proximity = true;
687 return 1; 688 return 1;
688 } 689 }
689 690
@@ -3395,6 +3396,10 @@ static const struct wacom_features wacom_features_0x33E =
3395 { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63, 3396 { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63,
3396 INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, 3397 INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16,
3397 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3398 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
3399static const struct wacom_features wacom_features_0x343 =
3400 { "Wacom DTK1651", 34616, 19559, 1023, 0,
3401 DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4,
3402 WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
3398 3403
3399static const struct wacom_features wacom_features_HID_ANY_ID = 3404static const struct wacom_features wacom_features_HID_ANY_ID =
3400 { "Wacom HID", .type = HID_GENERIC }; 3405 { "Wacom HID", .type = HID_GENERIC };
@@ -3560,6 +3565,7 @@ const struct hid_device_id wacom_ids[] = {
3560 { USB_DEVICE_WACOM(0x33C) }, 3565 { USB_DEVICE_WACOM(0x33C) },
3561 { USB_DEVICE_WACOM(0x33D) }, 3566 { USB_DEVICE_WACOM(0x33D) },
3562 { USB_DEVICE_WACOM(0x33E) }, 3567 { USB_DEVICE_WACOM(0x33E) },
3568 { USB_DEVICE_WACOM(0x343) },
3563 { USB_DEVICE_WACOM(0x4001) }, 3569 { USB_DEVICE_WACOM(0x4001) },
3564 { USB_DEVICE_WACOM(0x4004) }, 3570 { USB_DEVICE_WACOM(0x4004) },
3565 { USB_DEVICE_WACOM(0x5000) }, 3571 { USB_DEVICE_WACOM(0x5000) },
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 5613e2b5cff7..a40a73a7b71d 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -103,15 +103,29 @@ static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi)
103 * there is room for the producer to send the pending packet. 103 * there is room for the producer to send the pending packet.
104 */ 104 */
105 105
106static bool hv_need_to_signal_on_read(u32 prev_write_sz, 106static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi)
107 struct hv_ring_buffer_info *rbi)
108{ 107{
109 u32 cur_write_sz; 108 u32 cur_write_sz;
110 u32 r_size; 109 u32 r_size;
111 u32 write_loc = rbi->ring_buffer->write_index; 110 u32 write_loc;
112 u32 read_loc = rbi->ring_buffer->read_index; 111 u32 read_loc = rbi->ring_buffer->read_index;
113 u32 pending_sz = rbi->ring_buffer->pending_send_sz; 112 u32 pending_sz;
114 113
114 /*
115 * Issue a full memory barrier before making the signaling decision.
116 * Here is the reason for having this barrier:
117 * If the reading of the pend_sz (in this function)
118 * were to be reordered and read before we commit the new read
119 * index (in the calling function) we could
120 * have a problem. If the host were to set the pending_sz after we
121 * have sampled pending_sz and go to sleep before we commit the
122 * read index, we could miss sending the interrupt. Issue a full
123 * memory barrier to address this.
124 */
125 mb();
126
127 pending_sz = rbi->ring_buffer->pending_send_sz;
128 write_loc = rbi->ring_buffer->write_index;
115 /* If the other end is not blocked on write don't bother. */ 129 /* If the other end is not blocked on write don't bother. */
116 if (pending_sz == 0) 130 if (pending_sz == 0)
117 return false; 131 return false;
@@ -120,7 +134,7 @@ static bool hv_need_to_signal_on_read(u32 prev_write_sz,
120 cur_write_sz = write_loc >= read_loc ? r_size - (write_loc - read_loc) : 134 cur_write_sz = write_loc >= read_loc ? r_size - (write_loc - read_loc) :
121 read_loc - write_loc; 135 read_loc - write_loc;
122 136
123 if ((prev_write_sz < pending_sz) && (cur_write_sz >= pending_sz)) 137 if (cur_write_sz >= pending_sz)
124 return true; 138 return true;
125 139
126 return false; 140 return false;
@@ -455,7 +469,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info,
455 /* Update the read index */ 469 /* Update the read index */
456 hv_set_next_read_location(inring_info, next_read_location); 470 hv_set_next_read_location(inring_info, next_read_location);
457 471
458 *signal = hv_need_to_signal_on_read(bytes_avail_towrite, inring_info); 472 *signal = hv_need_to_signal_on_read(inring_info);
459 473
460 return ret; 474 return ret;
461} 475}
diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index dbee13ad33a3..2e154cb51685 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -451,6 +451,8 @@ static int at91_adc_probe(struct platform_device *pdev)
451 if (ret) 451 if (ret)
452 goto vref_disable; 452 goto vref_disable;
453 453
454 platform_set_drvdata(pdev, indio_dev);
455
454 ret = iio_device_register(indio_dev); 456 ret = iio_device_register(indio_dev);
455 if (ret < 0) 457 if (ret < 0)
456 goto per_clk_disable_unprepare; 458 goto per_clk_disable_unprepare;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index f581256d9d4c..5ee4e0dc093e 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -104,6 +104,19 @@ static int inv_mpu6050_deselect_bypass(struct i2c_adapter *adap,
104 return 0; 104 return 0;
105} 105}
106 106
107static const char *inv_mpu_match_acpi_device(struct device *dev, int *chip_id)
108{
109 const struct acpi_device_id *id;
110
111 id = acpi_match_device(dev->driver->acpi_match_table, dev);
112 if (!id)
113 return NULL;
114
115 *chip_id = (int)id->driver_data;
116
117 return dev_name(dev);
118}
119
107/** 120/**
108 * inv_mpu_probe() - probe function. 121 * inv_mpu_probe() - probe function.
109 * @client: i2c client. 122 * @client: i2c client.
@@ -115,14 +128,25 @@ static int inv_mpu_probe(struct i2c_client *client,
115 const struct i2c_device_id *id) 128 const struct i2c_device_id *id)
116{ 129{
117 struct inv_mpu6050_state *st; 130 struct inv_mpu6050_state *st;
118 int result; 131 int result, chip_type;
119 const char *name = id ? id->name : NULL;
120 struct regmap *regmap; 132 struct regmap *regmap;
133 const char *name;
121 134
122 if (!i2c_check_functionality(client->adapter, 135 if (!i2c_check_functionality(client->adapter,
123 I2C_FUNC_SMBUS_I2C_BLOCK)) 136 I2C_FUNC_SMBUS_I2C_BLOCK))
124 return -EOPNOTSUPP; 137 return -EOPNOTSUPP;
125 138
139 if (id) {
140 chip_type = (int)id->driver_data;
141 name = id->name;
142 } else if (ACPI_HANDLE(&client->dev)) {
143 name = inv_mpu_match_acpi_device(&client->dev, &chip_type);
144 if (!name)
145 return -ENODEV;
146 } else {
147 return -ENOSYS;
148 }
149
126 regmap = devm_regmap_init_i2c(client, &inv_mpu_regmap_config); 150 regmap = devm_regmap_init_i2c(client, &inv_mpu_regmap_config);
127 if (IS_ERR(regmap)) { 151 if (IS_ERR(regmap)) {
128 dev_err(&client->dev, "Failed to register i2c regmap %d\n", 152 dev_err(&client->dev, "Failed to register i2c regmap %d\n",
@@ -131,7 +155,7 @@ static int inv_mpu_probe(struct i2c_client *client,
131 } 155 }
132 156
133 result = inv_mpu_core_probe(regmap, client->irq, name, 157 result = inv_mpu_core_probe(regmap, client->irq, name,
134 NULL, id->driver_data); 158 NULL, chip_type);
135 if (result < 0) 159 if (result < 0)
136 return result; 160 return result;
137 161
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index dea6c4361de0..7bcb8d839f05 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -46,6 +46,7 @@ static int inv_mpu_probe(struct spi_device *spi)
46 struct regmap *regmap; 46 struct regmap *regmap;
47 const struct spi_device_id *id = spi_get_device_id(spi); 47 const struct spi_device_id *id = spi_get_device_id(spi);
48 const char *name = id ? id->name : NULL; 48 const char *name = id ? id->name : NULL;
49 const int chip_type = id ? id->driver_data : 0;
49 50
50 regmap = devm_regmap_init_spi(spi, &inv_mpu_regmap_config); 51 regmap = devm_regmap_init_spi(spi, &inv_mpu_regmap_config);
51 if (IS_ERR(regmap)) { 52 if (IS_ERR(regmap)) {
@@ -55,7 +56,7 @@ static int inv_mpu_probe(struct spi_device *spi)
55 } 56 }
56 57
57 return inv_mpu_core_probe(regmap, spi->irq, name, 58 return inv_mpu_core_probe(regmap, spi->irq, name,
58 inv_mpu_i2c_disable, id->driver_data); 59 inv_mpu_i2c_disable, chip_type);
59} 60}
60 61
61static int inv_mpu_remove(struct spi_device *spi) 62static int inv_mpu_remove(struct spi_device *spi)
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index 9c5c9ef3f1da..0e931a9a1669 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -462,6 +462,8 @@ static int ak8975_setup_irq(struct ak8975_data *data)
462 int rc; 462 int rc;
463 int irq; 463 int irq;
464 464
465 init_waitqueue_head(&data->data_ready_queue);
466 clear_bit(0, &data->flags);
465 if (client->irq) 467 if (client->irq)
466 irq = client->irq; 468 irq = client->irq;
467 else 469 else
@@ -477,8 +479,6 @@ static int ak8975_setup_irq(struct ak8975_data *data)
477 return rc; 479 return rc;
478 } 480 }
479 481
480 init_waitqueue_head(&data->data_ready_queue);
481 clear_bit(0, &data->flags);
482 data->eoc_irq = irq; 482 data->eoc_irq = irq;
483 483
484 return rc; 484 return rc;
@@ -732,7 +732,7 @@ static int ak8975_probe(struct i2c_client *client,
732 int eoc_gpio; 732 int eoc_gpio;
733 int err; 733 int err;
734 const char *name = NULL; 734 const char *name = NULL;
735 enum asahi_compass_chipset chipset; 735 enum asahi_compass_chipset chipset = AK_MAX_TYPE;
736 736
737 /* Grab and set up the supplied GPIO. */ 737 /* Grab and set up the supplied GPIO. */
738 if (client->dev.platform_data) 738 if (client->dev.platform_data)
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 80b6bedc172f..64b3d11dcf1e 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -612,6 +612,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
612 struct Scsi_Host *shost; 612 struct Scsi_Host *shost;
613 struct iser_conn *iser_conn = NULL; 613 struct iser_conn *iser_conn = NULL;
614 struct ib_conn *ib_conn; 614 struct ib_conn *ib_conn;
615 u32 max_fr_sectors;
615 u16 max_cmds; 616 u16 max_cmds;
616 617
617 shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0); 618 shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0);
@@ -632,7 +633,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
632 iser_conn = ep->dd_data; 633 iser_conn = ep->dd_data;
633 max_cmds = iser_conn->max_cmds; 634 max_cmds = iser_conn->max_cmds;
634 shost->sg_tablesize = iser_conn->scsi_sg_tablesize; 635 shost->sg_tablesize = iser_conn->scsi_sg_tablesize;
635 shost->max_sectors = iser_conn->scsi_max_sectors;
636 636
637 mutex_lock(&iser_conn->state_mutex); 637 mutex_lock(&iser_conn->state_mutex);
638 if (iser_conn->state != ISER_CONN_UP) { 638 if (iser_conn->state != ISER_CONN_UP) {
@@ -657,8 +657,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
657 */ 657 */
658 shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize, 658 shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
659 ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len); 659 ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len);
660 shost->max_sectors = min_t(unsigned int,
661 1024, (shost->sg_tablesize * PAGE_SIZE) >> 9);
662 660
663 if (iscsi_host_add(shost, 661 if (iscsi_host_add(shost,
664 ib_conn->device->ib_device->dma_device)) { 662 ib_conn->device->ib_device->dma_device)) {
@@ -672,6 +670,15 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
672 goto free_host; 670 goto free_host;
673 } 671 }
674 672
673 /*
674 * FRs or FMRs can only map up to a (device) page per entry, but if the
675 * first entry is misaligned we'll end up using using two entries
676 * (head and tail) for a single page worth data, so we have to drop
677 * one segment from the calculation.
678 */
679 max_fr_sectors = ((shost->sg_tablesize - 1) * PAGE_SIZE) >> 9;
680 shost->max_sectors = min(iser_max_sectors, max_fr_sectors);
681
675 if (cmds_max > max_cmds) { 682 if (cmds_max > max_cmds) {
676 iser_info("cmds_max changed from %u to %u\n", 683 iser_info("cmds_max changed from %u to %u\n",
677 cmds_max, max_cmds); 684 cmds_max, max_cmds);
@@ -989,7 +996,6 @@ static struct scsi_host_template iscsi_iser_sht = {
989 .queuecommand = iscsi_queuecommand, 996 .queuecommand = iscsi_queuecommand,
990 .change_queue_depth = scsi_change_queue_depth, 997 .change_queue_depth = scsi_change_queue_depth,
991 .sg_tablesize = ISCSI_ISER_DEF_SG_TABLESIZE, 998 .sg_tablesize = ISCSI_ISER_DEF_SG_TABLESIZE,
992 .max_sectors = ISER_DEF_MAX_SECTORS,
993 .cmd_per_lun = ISER_DEF_CMD_PER_LUN, 999 .cmd_per_lun = ISER_DEF_CMD_PER_LUN,
994 .eh_abort_handler = iscsi_eh_abort, 1000 .eh_abort_handler = iscsi_eh_abort,
995 .eh_device_reset_handler= iscsi_eh_device_reset, 1001 .eh_device_reset_handler= iscsi_eh_device_reset,
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index 53e33fab3f7a..df3581f60628 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -181,6 +181,14 @@ static void vibra_play_work(struct work_struct *work)
181{ 181{
182 struct vibra_info *info = container_of(work, 182 struct vibra_info *info = container_of(work,
183 struct vibra_info, play_work); 183 struct vibra_info, play_work);
184 int ret;
185
186 /* Do not allow effect, while the routing is set to use audio */
187 ret = twl6040_get_vibralr_status(info->twl6040);
188 if (ret & TWL6040_VIBSEL) {
189 dev_info(info->dev, "Vibra is configured for audio\n");
190 return;
191 }
184 192
185 mutex_lock(&info->mutex); 193 mutex_lock(&info->mutex);
186 194
@@ -199,14 +207,6 @@ static int vibra_play(struct input_dev *input, void *data,
199 struct ff_effect *effect) 207 struct ff_effect *effect)
200{ 208{
201 struct vibra_info *info = input_get_drvdata(input); 209 struct vibra_info *info = input_get_drvdata(input);
202 int ret;
203
204 /* Do not allow effect, while the routing is set to use audio */
205 ret = twl6040_get_vibralr_status(info->twl6040);
206 if (ret & TWL6040_VIBSEL) {
207 dev_info(&input->dev, "Vibra is configured for audio\n");
208 return -EBUSY;
209 }
210 210
211 info->weak_speed = effect->u.rumble.weak_magnitude; 211 info->weak_speed = effect->u.rumble.weak_magnitude;
212 info->strong_speed = effect->u.rumble.strong_magnitude; 212 info->strong_speed = effect->u.rumble.strong_magnitude;
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 2160512e861a..5af7907d0af4 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1093,6 +1093,19 @@ static int mxt_t6_command(struct mxt_data *data, u16 cmd_offset,
1093 return 0; 1093 return 0;
1094} 1094}
1095 1095
1096static int mxt_acquire_irq(struct mxt_data *data)
1097{
1098 int error;
1099
1100 enable_irq(data->irq);
1101
1102 error = mxt_process_messages_until_invalid(data);
1103 if (error)
1104 return error;
1105
1106 return 0;
1107}
1108
1096static int mxt_soft_reset(struct mxt_data *data) 1109static int mxt_soft_reset(struct mxt_data *data)
1097{ 1110{
1098 struct device *dev = &data->client->dev; 1111 struct device *dev = &data->client->dev;
@@ -1111,7 +1124,7 @@ static int mxt_soft_reset(struct mxt_data *data)
1111 /* Ignore CHG line for 100ms after reset */ 1124 /* Ignore CHG line for 100ms after reset */
1112 msleep(100); 1125 msleep(100);
1113 1126
1114 enable_irq(data->irq); 1127 mxt_acquire_irq(data);
1115 1128
1116 ret = mxt_wait_for_completion(data, &data->reset_completion, 1129 ret = mxt_wait_for_completion(data, &data->reset_completion,
1117 MXT_RESET_TIMEOUT); 1130 MXT_RESET_TIMEOUT);
@@ -1466,19 +1479,6 @@ release_mem:
1466 return ret; 1479 return ret;
1467} 1480}
1468 1481
1469static int mxt_acquire_irq(struct mxt_data *data)
1470{
1471 int error;
1472
1473 enable_irq(data->irq);
1474
1475 error = mxt_process_messages_until_invalid(data);
1476 if (error)
1477 return error;
1478
1479 return 0;
1480}
1481
1482static int mxt_get_info(struct mxt_data *data) 1482static int mxt_get_info(struct mxt_data *data)
1483{ 1483{
1484 struct i2c_client *client = data->client; 1484 struct i2c_client *client = data->client;
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index 9bbadaaf6bc3..7b3845aa5983 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -370,8 +370,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload)
370 point.coord_x = point.coord_y = 0; 370 point.coord_x = point.coord_y = 0;
371 } 371 }
372 372
373 point.state = payload[9 * i + 5] & 0x03; 373 point.state = payload[9 * i + 5] & 0x0f;
374 point.id = (payload[9 * i + 5] & 0xfc) >> 2; 374 point.id = (payload[9 * i + 5] & 0xf0) >> 4;
375 375
376 /* determine touch major, minor and orientation */ 376 /* determine touch major, minor and orientation */
377 point.area_major = max(payload[9 * i + 6], 377 point.area_major = max(payload[9 * i + 6],
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 194580fba7fd..14d3b37944df 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -284,6 +284,8 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)
284 * go away inside make_request 284 * go away inside make_request
285 */ 285 */
286 sectors = bio_sectors(bio); 286 sectors = bio_sectors(bio);
287 /* bio could be mergeable after passing to underlayer */
288 bio->bi_rw &= ~REQ_NOMERGE;
287 mddev->pers->make_request(mddev, bio); 289 mddev->pers->make_request(mddev, bio);
288 290
289 cpu = part_stat_lock(); 291 cpu = part_stat_lock();
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 2ea12c6bf659..34783a3c8b3c 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -70,7 +70,6 @@ static void dump_zones(struct mddev *mddev)
70 (unsigned long long)zone_size>>1); 70 (unsigned long long)zone_size>>1);
71 zone_start = conf->strip_zone[j].zone_end; 71 zone_start = conf->strip_zone[j].zone_end;
72 } 72 }
73 printk(KERN_INFO "\n");
74} 73}
75 74
76static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) 75static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
@@ -85,6 +84,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
85 struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); 84 struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
86 unsigned short blksize = 512; 85 unsigned short blksize = 512;
87 86
87 *private_conf = ERR_PTR(-ENOMEM);
88 if (!conf) 88 if (!conf)
89 return -ENOMEM; 89 return -ENOMEM;
90 rdev_for_each(rdev1, mddev) { 90 rdev_for_each(rdev1, mddev) {
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 8ab8b65e1741..e48c262ce032 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3502,8 +3502,6 @@ returnbi:
3502 dev = &sh->dev[i]; 3502 dev = &sh->dev[i];
3503 } else if (test_bit(R5_Discard, &dev->flags)) 3503 } else if (test_bit(R5_Discard, &dev->flags))
3504 discard_pending = 1; 3504 discard_pending = 1;
3505 WARN_ON(test_bit(R5_SkipCopy, &dev->flags));
3506 WARN_ON(dev->page != dev->orig_page);
3507 } 3505 }
3508 3506
3509 r5l_stripe_write_finished(sh); 3507 r5l_stripe_write_finished(sh);
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 47a99af5525e..a1cd50f331f1 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -826,11 +826,11 @@ struct media_device *media_device_find_devres(struct device *dev)
826} 826}
827EXPORT_SYMBOL_GPL(media_device_find_devres); 827EXPORT_SYMBOL_GPL(media_device_find_devres);
828 828
829#if IS_ENABLED(CONFIG_PCI)
829void media_device_pci_init(struct media_device *mdev, 830void media_device_pci_init(struct media_device *mdev,
830 struct pci_dev *pci_dev, 831 struct pci_dev *pci_dev,
831 const char *name) 832 const char *name)
832{ 833{
833#ifdef CONFIG_PCI
834 mdev->dev = &pci_dev->dev; 834 mdev->dev = &pci_dev->dev;
835 835
836 if (name) 836 if (name)
@@ -846,16 +846,16 @@ void media_device_pci_init(struct media_device *mdev,
846 mdev->driver_version = LINUX_VERSION_CODE; 846 mdev->driver_version = LINUX_VERSION_CODE;
847 847
848 media_device_init(mdev); 848 media_device_init(mdev);
849#endif
850} 849}
851EXPORT_SYMBOL_GPL(media_device_pci_init); 850EXPORT_SYMBOL_GPL(media_device_pci_init);
851#endif
852 852
853#if IS_ENABLED(CONFIG_USB)
853void __media_device_usb_init(struct media_device *mdev, 854void __media_device_usb_init(struct media_device *mdev,
854 struct usb_device *udev, 855 struct usb_device *udev,
855 const char *board_name, 856 const char *board_name,
856 const char *driver_name) 857 const char *driver_name)
857{ 858{
858#ifdef CONFIG_USB
859 mdev->dev = &udev->dev; 859 mdev->dev = &udev->dev;
860 860
861 if (driver_name) 861 if (driver_name)
@@ -875,9 +875,9 @@ void __media_device_usb_init(struct media_device *mdev,
875 mdev->driver_version = LINUX_VERSION_CODE; 875 mdev->driver_version = LINUX_VERSION_CODE;
876 876
877 media_device_init(mdev); 877 media_device_init(mdev);
878#endif
879} 878}
880EXPORT_SYMBOL_GPL(__media_device_usb_init); 879EXPORT_SYMBOL_GPL(__media_device_usb_init);
880#endif
881 881
882 882
883#endif /* CONFIG_MEDIA_CONTROLLER */ 883#endif /* CONFIG_MEDIA_CONTROLLER */
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index 04348b502232..891625e77ef5 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -1448,22 +1448,13 @@ static int fimc_md_probe(struct platform_device *pdev)
1448 1448
1449 platform_set_drvdata(pdev, fmd); 1449 platform_set_drvdata(pdev, fmd);
1450 1450
1451 /* Protect the media graph while we're registering entities */
1452 mutex_lock(&fmd->media_dev.graph_mutex);
1453
1454 ret = fimc_md_register_platform_entities(fmd, dev->of_node); 1451 ret = fimc_md_register_platform_entities(fmd, dev->of_node);
1455 if (ret) { 1452 if (ret)
1456 mutex_unlock(&fmd->media_dev.graph_mutex);
1457 goto err_clk; 1453 goto err_clk;
1458 }
1459 1454
1460 ret = fimc_md_register_sensor_entities(fmd); 1455 ret = fimc_md_register_sensor_entities(fmd);
1461 if (ret) { 1456 if (ret)
1462 mutex_unlock(&fmd->media_dev.graph_mutex);
1463 goto err_m_ent; 1457 goto err_m_ent;
1464 }
1465
1466 mutex_unlock(&fmd->media_dev.graph_mutex);
1467 1458
1468 ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode); 1459 ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode);
1469 if (ret) 1460 if (ret)
diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
index 0b44b9accf50..af237af204e2 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -493,21 +493,17 @@ static int s3c_camif_probe(struct platform_device *pdev)
493 if (ret < 0) 493 if (ret < 0)
494 goto err_sens; 494 goto err_sens;
495 495
496 mutex_lock(&camif->media_dev.graph_mutex);
497
498 ret = v4l2_device_register_subdev_nodes(&camif->v4l2_dev); 496 ret = v4l2_device_register_subdev_nodes(&camif->v4l2_dev);
499 if (ret < 0) 497 if (ret < 0)
500 goto err_unlock; 498 goto err_sens;
501 499
502 ret = camif_register_video_nodes(camif); 500 ret = camif_register_video_nodes(camif);
503 if (ret < 0) 501 if (ret < 0)
504 goto err_unlock; 502 goto err_sens;
505 503
506 ret = camif_create_media_links(camif); 504 ret = camif_create_media_links(camif);
507 if (ret < 0) 505 if (ret < 0)
508 goto err_unlock; 506 goto err_sens;
509
510 mutex_unlock(&camif->media_dev.graph_mutex);
511 507
512 ret = media_device_register(&camif->media_dev); 508 ret = media_device_register(&camif->media_dev);
513 if (ret < 0) 509 if (ret < 0)
@@ -516,8 +512,6 @@ static int s3c_camif_probe(struct platform_device *pdev)
516 pm_runtime_put(dev); 512 pm_runtime_put(dev);
517 return 0; 513 return 0;
518 514
519err_unlock:
520 mutex_unlock(&camif->media_dev.graph_mutex);
521err_sens: 515err_sens:
522 v4l2_device_unregister(&camif->v4l2_dev); 516 v4l2_device_unregister(&camif->v4l2_dev);
523 media_device_unregister(&camif->media_dev); 517 media_device_unregister(&camif->media_dev);
diff --git a/drivers/misc/mic/vop/vop_vringh.c b/drivers/misc/mic/vop/vop_vringh.c
index e94c7fb6712a..88e45234d527 100644
--- a/drivers/misc/mic/vop/vop_vringh.c
+++ b/drivers/misc/mic/vop/vop_vringh.c
@@ -945,6 +945,11 @@ static long vop_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
945 ret = -EFAULT; 945 ret = -EFAULT;
946 goto free_ret; 946 goto free_ret;
947 } 947 }
948 /* Ensure desc has not changed between the two reads */
949 if (memcmp(&dd, dd_config, sizeof(dd))) {
950 ret = -EINVAL;
951 goto free_ret;
952 }
948 mutex_lock(&vdev->vdev_mutex); 953 mutex_lock(&vdev->vdev_mutex);
949 mutex_lock(&vi->vop_mutex); 954 mutex_lock(&vi->vop_mutex);
950 ret = vop_virtio_add_device(vdev, dd_config); 955 ret = vop_virtio_add_device(vdev, dd_config);
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index a2904029cccc..5e572b3510b9 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -2181,7 +2181,7 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
2181 struct net_device *bridge) 2181 struct net_device *bridge)
2182{ 2182{
2183 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2183 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
2184 int i, err; 2184 int i, err = 0;
2185 2185
2186 mutex_lock(&ps->smi_mutex); 2186 mutex_lock(&ps->smi_mutex);
2187 2187
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 12a009d720cd..72eb29ed0359 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -581,12 +581,30 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
581 struct page *page; 581 struct page *page;
582 dma_addr_t mapping; 582 dma_addr_t mapping;
583 u16 sw_prod = rxr->rx_sw_agg_prod; 583 u16 sw_prod = rxr->rx_sw_agg_prod;
584 unsigned int offset = 0;
584 585
585 page = alloc_page(gfp); 586 if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) {
586 if (!page) 587 page = rxr->rx_page;
587 return -ENOMEM; 588 if (!page) {
589 page = alloc_page(gfp);
590 if (!page)
591 return -ENOMEM;
592 rxr->rx_page = page;
593 rxr->rx_page_offset = 0;
594 }
595 offset = rxr->rx_page_offset;
596 rxr->rx_page_offset += BNXT_RX_PAGE_SIZE;
597 if (rxr->rx_page_offset == PAGE_SIZE)
598 rxr->rx_page = NULL;
599 else
600 get_page(page);
601 } else {
602 page = alloc_page(gfp);
603 if (!page)
604 return -ENOMEM;
605 }
588 606
589 mapping = dma_map_page(&pdev->dev, page, 0, PAGE_SIZE, 607 mapping = dma_map_page(&pdev->dev, page, offset, BNXT_RX_PAGE_SIZE,
590 PCI_DMA_FROMDEVICE); 608 PCI_DMA_FROMDEVICE);
591 if (dma_mapping_error(&pdev->dev, mapping)) { 609 if (dma_mapping_error(&pdev->dev, mapping)) {
592 __free_page(page); 610 __free_page(page);
@@ -601,6 +619,7 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
601 rxr->rx_sw_agg_prod = NEXT_RX_AGG(sw_prod); 619 rxr->rx_sw_agg_prod = NEXT_RX_AGG(sw_prod);
602 620
603 rx_agg_buf->page = page; 621 rx_agg_buf->page = page;
622 rx_agg_buf->offset = offset;
604 rx_agg_buf->mapping = mapping; 623 rx_agg_buf->mapping = mapping;
605 rxbd->rx_bd_haddr = cpu_to_le64(mapping); 624 rxbd->rx_bd_haddr = cpu_to_le64(mapping);
606 rxbd->rx_bd_opaque = sw_prod; 625 rxbd->rx_bd_opaque = sw_prod;
@@ -642,6 +661,7 @@ static void bnxt_reuse_rx_agg_bufs(struct bnxt_napi *bnapi, u16 cp_cons,
642 page = cons_rx_buf->page; 661 page = cons_rx_buf->page;
643 cons_rx_buf->page = NULL; 662 cons_rx_buf->page = NULL;
644 prod_rx_buf->page = page; 663 prod_rx_buf->page = page;
664 prod_rx_buf->offset = cons_rx_buf->offset;
645 665
646 prod_rx_buf->mapping = cons_rx_buf->mapping; 666 prod_rx_buf->mapping = cons_rx_buf->mapping;
647 667
@@ -709,7 +729,8 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
709 RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT; 729 RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT;
710 730
711 cons_rx_buf = &rxr->rx_agg_ring[cons]; 731 cons_rx_buf = &rxr->rx_agg_ring[cons];
712 skb_fill_page_desc(skb, i, cons_rx_buf->page, 0, frag_len); 732 skb_fill_page_desc(skb, i, cons_rx_buf->page,
733 cons_rx_buf->offset, frag_len);
713 __clear_bit(cons, rxr->rx_agg_bmap); 734 __clear_bit(cons, rxr->rx_agg_bmap);
714 735
715 /* It is possible for bnxt_alloc_rx_page() to allocate 736 /* It is possible for bnxt_alloc_rx_page() to allocate
@@ -740,7 +761,7 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
740 return NULL; 761 return NULL;
741 } 762 }
742 763
743 dma_unmap_page(&pdev->dev, mapping, PAGE_SIZE, 764 dma_unmap_page(&pdev->dev, mapping, BNXT_RX_PAGE_SIZE,
744 PCI_DMA_FROMDEVICE); 765 PCI_DMA_FROMDEVICE);
745 766
746 skb->data_len += frag_len; 767 skb->data_len += frag_len;
@@ -1584,13 +1605,17 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
1584 1605
1585 dma_unmap_page(&pdev->dev, 1606 dma_unmap_page(&pdev->dev,
1586 dma_unmap_addr(rx_agg_buf, mapping), 1607 dma_unmap_addr(rx_agg_buf, mapping),
1587 PAGE_SIZE, PCI_DMA_FROMDEVICE); 1608 BNXT_RX_PAGE_SIZE, PCI_DMA_FROMDEVICE);
1588 1609
1589 rx_agg_buf->page = NULL; 1610 rx_agg_buf->page = NULL;
1590 __clear_bit(j, rxr->rx_agg_bmap); 1611 __clear_bit(j, rxr->rx_agg_bmap);
1591 1612
1592 __free_page(page); 1613 __free_page(page);
1593 } 1614 }
1615 if (rxr->rx_page) {
1616 __free_page(rxr->rx_page);
1617 rxr->rx_page = NULL;
1618 }
1594 } 1619 }
1595} 1620}
1596 1621
@@ -1973,7 +1998,7 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr)
1973 if (!(bp->flags & BNXT_FLAG_AGG_RINGS)) 1998 if (!(bp->flags & BNXT_FLAG_AGG_RINGS))
1974 return 0; 1999 return 0;
1975 2000
1976 type = ((u32)PAGE_SIZE << RX_BD_LEN_SHIFT) | 2001 type = ((u32)BNXT_RX_PAGE_SIZE << RX_BD_LEN_SHIFT) |
1977 RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP; 2002 RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP;
1978 2003
1979 bnxt_init_rxbd_pages(ring, type); 2004 bnxt_init_rxbd_pages(ring, type);
@@ -2164,7 +2189,7 @@ void bnxt_set_ring_params(struct bnxt *bp)
2164 bp->rx_agg_nr_pages = 0; 2189 bp->rx_agg_nr_pages = 0;
2165 2190
2166 if (bp->flags & BNXT_FLAG_TPA) 2191 if (bp->flags & BNXT_FLAG_TPA)
2167 agg_factor = 4; 2192 agg_factor = min_t(u32, 4, 65536 / BNXT_RX_PAGE_SIZE);
2168 2193
2169 bp->flags &= ~BNXT_FLAG_JUMBO; 2194 bp->flags &= ~BNXT_FLAG_JUMBO;
2170 if (rx_space > PAGE_SIZE) { 2195 if (rx_space > PAGE_SIZE) {
@@ -3020,12 +3045,12 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags)
3020 /* Number of segs are log2 units, and first packet is not 3045 /* Number of segs are log2 units, and first packet is not
3021 * included as part of this units. 3046 * included as part of this units.
3022 */ 3047 */
3023 if (mss <= PAGE_SIZE) { 3048 if (mss <= BNXT_RX_PAGE_SIZE) {
3024 n = PAGE_SIZE / mss; 3049 n = BNXT_RX_PAGE_SIZE / mss;
3025 nsegs = (MAX_SKB_FRAGS - 1) * n; 3050 nsegs = (MAX_SKB_FRAGS - 1) * n;
3026 } else { 3051 } else {
3027 n = mss / PAGE_SIZE; 3052 n = mss / BNXT_RX_PAGE_SIZE;
3028 if (mss & (PAGE_SIZE - 1)) 3053 if (mss & (BNXT_RX_PAGE_SIZE - 1))
3029 n++; 3054 n++;
3030 nsegs = (MAX_SKB_FRAGS - n) / n; 3055 nsegs = (MAX_SKB_FRAGS - n) / n;
3031 } 3056 }
@@ -4309,7 +4334,7 @@ static int bnxt_setup_int_mode(struct bnxt *bp)
4309 if (bp->flags & BNXT_FLAG_MSIX_CAP) 4334 if (bp->flags & BNXT_FLAG_MSIX_CAP)
4310 rc = bnxt_setup_msix(bp); 4335 rc = bnxt_setup_msix(bp);
4311 4336
4312 if (!(bp->flags & BNXT_FLAG_USING_MSIX)) { 4337 if (!(bp->flags & BNXT_FLAG_USING_MSIX) && BNXT_PF(bp)) {
4313 /* fallback to INTA */ 4338 /* fallback to INTA */
4314 rc = bnxt_setup_inta(bp); 4339 rc = bnxt_setup_inta(bp);
4315 } 4340 }
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 709b95b8fcba..8b823ff558ff 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -407,6 +407,15 @@ struct rx_tpa_end_cmp_ext {
407 407
408#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT) 408#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT)
409 409
410/* The RXBD length is 16-bit so we can only support page sizes < 64K */
411#if (PAGE_SHIFT > 15)
412#define BNXT_RX_PAGE_SHIFT 15
413#else
414#define BNXT_RX_PAGE_SHIFT PAGE_SHIFT
415#endif
416
417#define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT)
418
410#define BNXT_MIN_PKT_SIZE 45 419#define BNXT_MIN_PKT_SIZE 45
411 420
412#define BNXT_NUM_TESTS(bp) 0 421#define BNXT_NUM_TESTS(bp) 0
@@ -506,6 +515,7 @@ struct bnxt_sw_rx_bd {
506 515
507struct bnxt_sw_rx_agg_bd { 516struct bnxt_sw_rx_agg_bd {
508 struct page *page; 517 struct page *page;
518 unsigned int offset;
509 dma_addr_t mapping; 519 dma_addr_t mapping;
510}; 520};
511 521
@@ -586,6 +596,9 @@ struct bnxt_rx_ring_info {
586 unsigned long *rx_agg_bmap; 596 unsigned long *rx_agg_bmap;
587 u16 rx_agg_bmap_size; 597 u16 rx_agg_bmap_size;
588 598
599 struct page *rx_page;
600 unsigned int rx_page_offset;
601
589 dma_addr_t rx_desc_mapping[MAX_RX_PAGES]; 602 dma_addr_t rx_desc_mapping[MAX_RX_PAGES];
590 dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES]; 603 dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES];
591 604
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 48a7d7dee846..a63551d0a18a 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -441,7 +441,7 @@ static int macb_mii_init(struct macb *bp)
441 snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", 441 snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
442 bp->pdev->name, bp->pdev->id); 442 bp->pdev->name, bp->pdev->id);
443 bp->mii_bus->priv = bp; 443 bp->mii_bus->priv = bp;
444 bp->mii_bus->parent = &bp->dev->dev; 444 bp->mii_bus->parent = &bp->pdev->dev;
445 pdata = dev_get_platdata(&bp->pdev->dev); 445 pdata = dev_get_platdata(&bp->pdev->dev);
446 446
447 dev_set_drvdata(&bp->dev->dev, bp->mii_bus); 447 dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
@@ -458,7 +458,8 @@ static int macb_mii_init(struct macb *bp)
458 struct phy_device *phydev; 458 struct phy_device *phydev;
459 459
460 phydev = mdiobus_scan(bp->mii_bus, i); 460 phydev = mdiobus_scan(bp->mii_bus, i);
461 if (IS_ERR(phydev)) { 461 if (IS_ERR(phydev) &&
462 PTR_ERR(phydev) != -ENODEV) {
462 err = PTR_ERR(phydev); 463 err = PTR_ERR(phydev);
463 break; 464 break;
464 } 465 }
@@ -3019,29 +3020,36 @@ static int macb_probe(struct platform_device *pdev)
3019 if (err) 3020 if (err)
3020 goto err_out_free_netdev; 3021 goto err_out_free_netdev;
3021 3022
3023 err = macb_mii_init(bp);
3024 if (err)
3025 goto err_out_free_netdev;
3026
3027 phydev = bp->phy_dev;
3028
3029 netif_carrier_off(dev);
3030
3022 err = register_netdev(dev); 3031 err = register_netdev(dev);
3023 if (err) { 3032 if (err) {
3024 dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); 3033 dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
3025 goto err_out_unregister_netdev; 3034 goto err_out_unregister_mdio;
3026 } 3035 }
3027 3036
3028 err = macb_mii_init(bp); 3037 phy_attached_info(phydev);
3029 if (err)
3030 goto err_out_unregister_netdev;
3031
3032 netif_carrier_off(dev);
3033 3038
3034 netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n", 3039 netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n",
3035 macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID), 3040 macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID),
3036 dev->base_addr, dev->irq, dev->dev_addr); 3041 dev->base_addr, dev->irq, dev->dev_addr);
3037 3042
3038 phydev = bp->phy_dev;
3039 phy_attached_info(phydev);
3040
3041 return 0; 3043 return 0;
3042 3044
3043err_out_unregister_netdev: 3045err_out_unregister_mdio:
3044 unregister_netdev(dev); 3046 phy_disconnect(bp->phy_dev);
3047 mdiobus_unregister(bp->mii_bus);
3048 mdiobus_free(bp->mii_bus);
3049
3050 /* Shutdown the PHY if there is a GPIO reset */
3051 if (bp->reset_gpio)
3052 gpiod_set_value(bp->reset_gpio, 0);
3045 3053
3046err_out_free_netdev: 3054err_out_free_netdev:
3047 free_netdev(dev); 3055 free_netdev(dev);
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index 60908eab3b3a..43da891fab97 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -576,7 +576,7 @@ static void setup_rss(struct adapter *adap)
576 unsigned int nq0 = adap2pinfo(adap, 0)->nqsets; 576 unsigned int nq0 = adap2pinfo(adap, 0)->nqsets;
577 unsigned int nq1 = adap->port[1] ? adap2pinfo(adap, 1)->nqsets : 1; 577 unsigned int nq1 = adap->port[1] ? adap2pinfo(adap, 1)->nqsets : 1;
578 u8 cpus[SGE_QSETS + 1]; 578 u8 cpus[SGE_QSETS + 1];
579 u16 rspq_map[RSS_TABLE_SIZE]; 579 u16 rspq_map[RSS_TABLE_SIZE + 1];
580 580
581 for (i = 0; i < SGE_QSETS; ++i) 581 for (i = 0; i < SGE_QSETS; ++i)
582 cpus[i] = i; 582 cpus[i] = i;
@@ -586,6 +586,7 @@ static void setup_rss(struct adapter *adap)
586 rspq_map[i] = i % nq0; 586 rspq_map[i] = i % nq0;
587 rspq_map[i + RSS_TABLE_SIZE / 2] = (i % nq1) + nq0; 587 rspq_map[i + RSS_TABLE_SIZE / 2] = (i % nq1) + nq0;
588 } 588 }
589 rspq_map[RSS_TABLE_SIZE] = 0xffff; /* terminator */
589 590
590 t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN | 591 t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN |
591 F_TNLPRTEN | F_TNL2TUPEN | F_TNL4TUPEN | 592 F_TNLPRTEN | F_TNL2TUPEN | F_TNL4TUPEN |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 7fc490225da5..a6d26d351dfc 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3354,8 +3354,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb,
3354 /* Enable per-CPU interrupts on the CPU that is 3354 /* Enable per-CPU interrupts on the CPU that is
3355 * brought up. 3355 * brought up.
3356 */ 3356 */
3357 smp_call_function_single(cpu, mvneta_percpu_enable, 3357 mvneta_percpu_enable(pp);
3358 pp, true);
3359 3358
3360 /* Enable per-CPU interrupt on the one CPU we care 3359 /* Enable per-CPU interrupt on the one CPU we care
3361 * about. 3360 * about.
@@ -3387,8 +3386,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb,
3387 /* Disable per-CPU interrupts on the CPU that is 3386 /* Disable per-CPU interrupts on the CPU that is
3388 * brought down. 3387 * brought down.
3389 */ 3388 */
3390 smp_call_function_single(cpu, mvneta_percpu_disable, 3389 mvneta_percpu_disable(pp);
3391 pp, true);
3392 3390
3393 break; 3391 break;
3394 case CPU_DEAD: 3392 case CPU_DEAD:
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 7ace07dad6a3..c442f6ad15ff 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_device *dev)
979 return 0; 979 return 0;
980 980
981 pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr); 981 pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
982 if (IS_ERR(pep->phy))
983 return PTR_ERR(pep->phy);
982 if (!pep->phy) 984 if (!pep->phy)
983 return -ENODEV; 985 return -ENODEV;
984 986
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 1cf722eba607..559d11a443bc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -14,6 +14,7 @@ config MLX5_CORE_EN
14 bool "Mellanox Technologies ConnectX-4 Ethernet support" 14 bool "Mellanox Technologies ConnectX-4 Ethernet support"
15 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE 15 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
16 select PTP_1588_CLOCK 16 select PTP_1588_CLOCK
17 select VXLAN if MLX5_CORE=y
17 default n 18 default n
18 ---help--- 19 ---help---
19 Ethernet support in Mellanox Technologies ConnectX-4 NIC. 20 Ethernet support in Mellanox Technologies ConnectX-4 NIC.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index e80ce94b5dcf..3881dce0cc30 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -567,6 +567,7 @@ struct mlx5e_priv {
567 struct mlx5e_vxlan_db vxlan; 567 struct mlx5e_vxlan_db vxlan;
568 568
569 struct mlx5e_params params; 569 struct mlx5e_params params;
570 struct workqueue_struct *wq;
570 struct work_struct update_carrier_work; 571 struct work_struct update_carrier_work;
571 struct work_struct set_rx_mode_work; 572 struct work_struct set_rx_mode_work;
572 struct delayed_work update_stats_work; 573 struct delayed_work update_stats_work;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 67d548b70e14..d4dfc5ce516a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -262,9 +262,8 @@ static void mlx5e_update_stats_work(struct work_struct *work)
262 mutex_lock(&priv->state_lock); 262 mutex_lock(&priv->state_lock);
263 if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { 263 if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
264 mlx5e_update_stats(priv); 264 mlx5e_update_stats(priv);
265 schedule_delayed_work(dwork, 265 queue_delayed_work(priv->wq, dwork,
266 msecs_to_jiffies( 266 msecs_to_jiffies(MLX5E_UPDATE_STATS_INTERVAL));
267 MLX5E_UPDATE_STATS_INTERVAL));
268 } 267 }
269 mutex_unlock(&priv->state_lock); 268 mutex_unlock(&priv->state_lock);
270} 269}
@@ -280,7 +279,7 @@ static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv,
280 switch (event) { 279 switch (event) {
281 case MLX5_DEV_EVENT_PORT_UP: 280 case MLX5_DEV_EVENT_PORT_UP:
282 case MLX5_DEV_EVENT_PORT_DOWN: 281 case MLX5_DEV_EVENT_PORT_DOWN:
283 schedule_work(&priv->update_carrier_work); 282 queue_work(priv->wq, &priv->update_carrier_work);
284 break; 283 break;
285 284
286 default: 285 default:
@@ -1505,7 +1504,7 @@ int mlx5e_open_locked(struct net_device *netdev)
1505 mlx5e_update_carrier(priv); 1504 mlx5e_update_carrier(priv);
1506 mlx5e_timestamp_init(priv); 1505 mlx5e_timestamp_init(priv);
1507 1506
1508 schedule_delayed_work(&priv->update_stats_work, 0); 1507 queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
1509 1508
1510 return 0; 1509 return 0;
1511 1510
@@ -1961,7 +1960,7 @@ static void mlx5e_set_rx_mode(struct net_device *dev)
1961{ 1960{
1962 struct mlx5e_priv *priv = netdev_priv(dev); 1961 struct mlx5e_priv *priv = netdev_priv(dev);
1963 1962
1964 schedule_work(&priv->set_rx_mode_work); 1963 queue_work(priv->wq, &priv->set_rx_mode_work);
1965} 1964}
1966 1965
1967static int mlx5e_set_mac(struct net_device *netdev, void *addr) 1966static int mlx5e_set_mac(struct net_device *netdev, void *addr)
@@ -1976,7 +1975,7 @@ static int mlx5e_set_mac(struct net_device *netdev, void *addr)
1976 ether_addr_copy(netdev->dev_addr, saddr->sa_data); 1975 ether_addr_copy(netdev->dev_addr, saddr->sa_data);
1977 netif_addr_unlock_bh(netdev); 1976 netif_addr_unlock_bh(netdev);
1978 1977
1979 schedule_work(&priv->set_rx_mode_work); 1978 queue_work(priv->wq, &priv->set_rx_mode_work);
1980 1979
1981 return 0; 1980 return 0;
1982} 1981}
@@ -2158,7 +2157,7 @@ static void mlx5e_add_vxlan_port(struct net_device *netdev,
2158 if (!mlx5e_vxlan_allowed(priv->mdev)) 2157 if (!mlx5e_vxlan_allowed(priv->mdev))
2159 return; 2158 return;
2160 2159
2161 mlx5e_vxlan_add_port(priv, be16_to_cpu(port)); 2160 mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 1);
2162} 2161}
2163 2162
2164static void mlx5e_del_vxlan_port(struct net_device *netdev, 2163static void mlx5e_del_vxlan_port(struct net_device *netdev,
@@ -2169,7 +2168,7 @@ static void mlx5e_del_vxlan_port(struct net_device *netdev,
2169 if (!mlx5e_vxlan_allowed(priv->mdev)) 2168 if (!mlx5e_vxlan_allowed(priv->mdev))
2170 return; 2169 return;
2171 2170
2172 mlx5e_vxlan_del_port(priv, be16_to_cpu(port)); 2171 mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 0);
2173} 2172}
2174 2173
2175static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv, 2174static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv,
@@ -2498,10 +2497,14 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
2498 2497
2499 priv = netdev_priv(netdev); 2498 priv = netdev_priv(netdev);
2500 2499
2500 priv->wq = create_singlethread_workqueue("mlx5e");
2501 if (!priv->wq)
2502 goto err_free_netdev;
2503
2501 err = mlx5_alloc_map_uar(mdev, &priv->cq_uar, false); 2504 err = mlx5_alloc_map_uar(mdev, &priv->cq_uar, false);
2502 if (err) { 2505 if (err) {
2503 mlx5_core_err(mdev, "alloc_map uar failed, %d\n", err); 2506 mlx5_core_err(mdev, "alloc_map uar failed, %d\n", err);
2504 goto err_free_netdev; 2507 goto err_destroy_wq;
2505 } 2508 }
2506 2509
2507 err = mlx5_core_alloc_pd(mdev, &priv->pdn); 2510 err = mlx5_core_alloc_pd(mdev, &priv->pdn);
@@ -2580,7 +2583,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
2580 vxlan_get_rx_port(netdev); 2583 vxlan_get_rx_port(netdev);
2581 2584
2582 mlx5e_enable_async_events(priv); 2585 mlx5e_enable_async_events(priv);
2583 schedule_work(&priv->set_rx_mode_work); 2586 queue_work(priv->wq, &priv->set_rx_mode_work);
2584 2587
2585 return priv; 2588 return priv;
2586 2589
@@ -2617,6 +2620,9 @@ err_dealloc_pd:
2617err_unmap_free_uar: 2620err_unmap_free_uar:
2618 mlx5_unmap_free_uar(mdev, &priv->cq_uar); 2621 mlx5_unmap_free_uar(mdev, &priv->cq_uar);
2619 2622
2623err_destroy_wq:
2624 destroy_workqueue(priv->wq);
2625
2620err_free_netdev: 2626err_free_netdev:
2621 free_netdev(netdev); 2627 free_netdev(netdev);
2622 2628
@@ -2630,9 +2636,9 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv)
2630 2636
2631 set_bit(MLX5E_STATE_DESTROYING, &priv->state); 2637 set_bit(MLX5E_STATE_DESTROYING, &priv->state);
2632 2638
2633 schedule_work(&priv->set_rx_mode_work); 2639 queue_work(priv->wq, &priv->set_rx_mode_work);
2634 mlx5e_disable_async_events(priv); 2640 mlx5e_disable_async_events(priv);
2635 flush_scheduled_work(); 2641 flush_workqueue(priv->wq);
2636 if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) { 2642 if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) {
2637 netif_device_detach(netdev); 2643 netif_device_detach(netdev);
2638 mutex_lock(&priv->state_lock); 2644 mutex_lock(&priv->state_lock);
@@ -2655,6 +2661,8 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv)
2655 mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn); 2661 mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn);
2656 mlx5_core_dealloc_pd(priv->mdev, priv->pdn); 2662 mlx5_core_dealloc_pd(priv->mdev, priv->pdn);
2657 mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); 2663 mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar);
2664 cancel_delayed_work_sync(&priv->update_stats_work);
2665 destroy_workqueue(priv->wq);
2658 2666
2659 if (!test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) 2667 if (!test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state))
2660 free_netdev(netdev); 2668 free_netdev(netdev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
index 8ba080e441a1..5ff8af472bf5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
@@ -269,8 +269,10 @@ EXPORT_SYMBOL(mlx5_alloc_map_uar);
269 269
270void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar) 270void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
271{ 271{
272 iounmap(uar->map); 272 if (uar->map)
273 iounmap(uar->bf_map); 273 iounmap(uar->map);
274 else
275 iounmap(uar->bf_map);
274 mlx5_cmd_free_uar(mdev, uar->index); 276 mlx5_cmd_free_uar(mdev, uar->index);
275} 277}
276EXPORT_SYMBOL(mlx5_unmap_free_uar); 278EXPORT_SYMBOL(mlx5_unmap_free_uar);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c
index 9f10df25f3cd..f2fd1ef16da7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c
@@ -95,21 +95,22 @@ struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port)
95 return vxlan; 95 return vxlan;
96} 96}
97 97
98int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port) 98static void mlx5e_vxlan_add_port(struct work_struct *work)
99{ 99{
100 struct mlx5e_vxlan_work *vxlan_work =
101 container_of(work, struct mlx5e_vxlan_work, work);
102 struct mlx5e_priv *priv = vxlan_work->priv;
100 struct mlx5e_vxlan_db *vxlan_db = &priv->vxlan; 103 struct mlx5e_vxlan_db *vxlan_db = &priv->vxlan;
104 u16 port = vxlan_work->port;
101 struct mlx5e_vxlan *vxlan; 105 struct mlx5e_vxlan *vxlan;
102 int err; 106 int err;
103 107
104 err = mlx5e_vxlan_core_add_port_cmd(priv->mdev, port); 108 if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port))
105 if (err) 109 goto free_work;
106 return err;
107 110
108 vxlan = kzalloc(sizeof(*vxlan), GFP_KERNEL); 111 vxlan = kzalloc(sizeof(*vxlan), GFP_KERNEL);
109 if (!vxlan) { 112 if (!vxlan)
110 err = -ENOMEM;
111 goto err_delete_port; 113 goto err_delete_port;
112 }
113 114
114 vxlan->udp_port = port; 115 vxlan->udp_port = port;
115 116
@@ -119,13 +120,14 @@ int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port)
119 if (err) 120 if (err)
120 goto err_free; 121 goto err_free;
121 122
122 return 0; 123 goto free_work;
123 124
124err_free: 125err_free:
125 kfree(vxlan); 126 kfree(vxlan);
126err_delete_port: 127err_delete_port:
127 mlx5e_vxlan_core_del_port_cmd(priv->mdev, port); 128 mlx5e_vxlan_core_del_port_cmd(priv->mdev, port);
128 return err; 129free_work:
130 kfree(vxlan_work);
129} 131}
130 132
131static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port) 133static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port)
@@ -145,12 +147,36 @@ static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port)
145 kfree(vxlan); 147 kfree(vxlan);
146} 148}
147 149
148void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port) 150static void mlx5e_vxlan_del_port(struct work_struct *work)
149{ 151{
150 if (!mlx5e_vxlan_lookup_port(priv, port)) 152 struct mlx5e_vxlan_work *vxlan_work =
151 return; 153 container_of(work, struct mlx5e_vxlan_work, work);
154 struct mlx5e_priv *priv = vxlan_work->priv;
155 u16 port = vxlan_work->port;
152 156
153 __mlx5e_vxlan_core_del_port(priv, port); 157 __mlx5e_vxlan_core_del_port(priv, port);
158
159 kfree(vxlan_work);
160}
161
162void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
163 u16 port, int add)
164{
165 struct mlx5e_vxlan_work *vxlan_work;
166
167 vxlan_work = kmalloc(sizeof(*vxlan_work), GFP_ATOMIC);
168 if (!vxlan_work)
169 return;
170
171 if (add)
172 INIT_WORK(&vxlan_work->work, mlx5e_vxlan_add_port);
173 else
174 INIT_WORK(&vxlan_work->work, mlx5e_vxlan_del_port);
175
176 vxlan_work->priv = priv;
177 vxlan_work->port = port;
178 vxlan_work->sa_family = sa_family;
179 queue_work(priv->wq, &vxlan_work->work);
154} 180}
155 181
156void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv) 182void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h
index a01685056ab1..129f3527aa14 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h
@@ -39,6 +39,13 @@ struct mlx5e_vxlan {
39 u16 udp_port; 39 u16 udp_port;
40}; 40};
41 41
42struct mlx5e_vxlan_work {
43 struct work_struct work;
44 struct mlx5e_priv *priv;
45 sa_family_t sa_family;
46 u16 port;
47};
48
42static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev) 49static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev)
43{ 50{
44 return (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) && 51 return (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) &&
@@ -46,8 +53,8 @@ static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev)
46} 53}
47 54
48void mlx5e_vxlan_init(struct mlx5e_priv *priv); 55void mlx5e_vxlan_init(struct mlx5e_priv *priv);
49int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port); 56void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
50void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port); 57 u16 port, int add);
51struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port); 58struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port);
52void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv); 59void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv);
53 60
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 270c9eeb7ab6..6d1a956e3f77 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -2668,9 +2668,9 @@ static int myri10ge_close(struct net_device *dev)
2668 2668
2669 del_timer_sync(&mgp->watchdog_timer); 2669 del_timer_sync(&mgp->watchdog_timer);
2670 mgp->running = MYRI10GE_ETH_STOPPING; 2670 mgp->running = MYRI10GE_ETH_STOPPING;
2671 local_bh_disable(); /* myri10ge_ss_lock_napi needs bh disabled */
2672 for (i = 0; i < mgp->num_slices; i++) { 2671 for (i = 0; i < mgp->num_slices; i++) {
2673 napi_disable(&mgp->ss[i].napi); 2672 napi_disable(&mgp->ss[i].napi);
2673 local_bh_disable(); /* myri10ge_ss_lock_napi needs this */
2674 /* Lock the slice to prevent the busy_poll handler from 2674 /* Lock the slice to prevent the busy_poll handler from
2675 * accessing it. Later when we bring the NIC up, myri10ge_open 2675 * accessing it. Later when we bring the NIC up, myri10ge_open
2676 * resets the slice including this lock. 2676 * resets the slice including this lock.
@@ -2679,8 +2679,8 @@ static int myri10ge_close(struct net_device *dev)
2679 pr_info("Slice %d locked\n", i); 2679 pr_info("Slice %d locked\n", i);
2680 mdelay(1); 2680 mdelay(1);
2681 } 2681 }
2682 local_bh_enable();
2682 } 2683 }
2683 local_bh_enable();
2684 netif_carrier_off(dev); 2684 netif_carrier_off(dev);
2685 2685
2686 netif_tx_stop_all_queues(dev); 2686 netif_tx_stop_all_queues(dev);
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 98d33d462c6c..1681084cc96f 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1920,6 +1920,10 @@ static int efx_ef10_alloc_rss_context(struct efx_nic *efx, u32 *context,
1920 return 0; 1920 return 0;
1921 } 1921 }
1922 1922
1923 if (nic_data->datapath_caps &
1924 1 << MC_CMD_GET_CAPABILITIES_OUT_RX_RSS_LIMITED_LBN)
1925 return -EOPNOTSUPP;
1926
1923 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID, 1927 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
1924 nic_data->vport_id); 1928 nic_data->vport_id);
1925 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_TYPE, alloc_type); 1929 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_TYPE, alloc_type);
@@ -2923,9 +2927,16 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx,
2923 bool replacing) 2927 bool replacing)
2924{ 2928{
2925 struct efx_ef10_nic_data *nic_data = efx->nic_data; 2929 struct efx_ef10_nic_data *nic_data = efx->nic_data;
2930 u32 flags = spec->flags;
2926 2931
2927 memset(inbuf, 0, MC_CMD_FILTER_OP_IN_LEN); 2932 memset(inbuf, 0, MC_CMD_FILTER_OP_IN_LEN);
2928 2933
2934 /* Remove RSS flag if we don't have an RSS context. */
2935 if (flags & EFX_FILTER_FLAG_RX_RSS &&
2936 spec->rss_context == EFX_FILTER_RSS_CONTEXT_DEFAULT &&
2937 nic_data->rx_rss_context == EFX_EF10_RSS_CONTEXT_INVALID)
2938 flags &= ~EFX_FILTER_FLAG_RX_RSS;
2939
2929 if (replacing) { 2940 if (replacing) {
2930 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP, 2941 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP,
2931 MC_CMD_FILTER_OP_IN_OP_REPLACE); 2942 MC_CMD_FILTER_OP_IN_OP_REPLACE);
@@ -2985,10 +2996,10 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx,
2985 spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ? 2996 spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ?
2986 0 : spec->dmaq_id); 2997 0 : spec->dmaq_id);
2987 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_MODE, 2998 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_MODE,
2988 (spec->flags & EFX_FILTER_FLAG_RX_RSS) ? 2999 (flags & EFX_FILTER_FLAG_RX_RSS) ?
2989 MC_CMD_FILTER_OP_IN_RX_MODE_RSS : 3000 MC_CMD_FILTER_OP_IN_RX_MODE_RSS :
2990 MC_CMD_FILTER_OP_IN_RX_MODE_SIMPLE); 3001 MC_CMD_FILTER_OP_IN_RX_MODE_SIMPLE);
2991 if (spec->flags & EFX_FILTER_FLAG_RX_RSS) 3002 if (flags & EFX_FILTER_FLAG_RX_RSS)
2992 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_CONTEXT, 3003 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_CONTEXT,
2993 spec->rss_context != 3004 spec->rss_context !=
2994 EFX_FILTER_RSS_CONTEXT_DEFAULT ? 3005 EFX_FILTER_RSS_CONTEXT_DEFAULT ?
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index bbb77cd8ad67..e2fcdf1eec44 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -367,7 +367,6 @@ struct cpsw_priv {
367 spinlock_t lock; 367 spinlock_t lock;
368 struct platform_device *pdev; 368 struct platform_device *pdev;
369 struct net_device *ndev; 369 struct net_device *ndev;
370 struct device_node *phy_node;
371 struct napi_struct napi_rx; 370 struct napi_struct napi_rx;
372 struct napi_struct napi_tx; 371 struct napi_struct napi_tx;
373 struct device *dev; 372 struct device *dev;
@@ -1148,25 +1147,34 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
1148 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, 1147 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1149 1 << slave_port, 0, 0, ALE_MCAST_FWD_2); 1148 1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
1150 1149
1151 if (priv->phy_node) 1150 if (slave->data->phy_node) {
1152 slave->phy = of_phy_connect(priv->ndev, priv->phy_node, 1151 slave->phy = of_phy_connect(priv->ndev, slave->data->phy_node,
1153 &cpsw_adjust_link, 0, slave->data->phy_if); 1152 &cpsw_adjust_link, 0, slave->data->phy_if);
1154 else 1153 if (!slave->phy) {
1154 dev_err(priv->dev, "phy \"%s\" not found on slave %d\n",
1155 slave->data->phy_node->full_name,
1156 slave->slave_num);
1157 return;
1158 }
1159 } else {
1155 slave->phy = phy_connect(priv->ndev, slave->data->phy_id, 1160 slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
1156 &cpsw_adjust_link, slave->data->phy_if); 1161 &cpsw_adjust_link, slave->data->phy_if);
1157 if (IS_ERR(slave->phy)) { 1162 if (IS_ERR(slave->phy)) {
1158 dev_err(priv->dev, "phy %s not found on slave %d\n", 1163 dev_err(priv->dev,
1159 slave->data->phy_id, slave->slave_num); 1164 "phy \"%s\" not found on slave %d, err %ld\n",
1160 slave->phy = NULL; 1165 slave->data->phy_id, slave->slave_num,
1161 } else { 1166 PTR_ERR(slave->phy));
1162 phy_attached_info(slave->phy); 1167 slave->phy = NULL;
1168 return;
1169 }
1170 }
1163 1171
1164 phy_start(slave->phy); 1172 phy_attached_info(slave->phy);
1165 1173
1166 /* Configure GMII_SEL register */ 1174 phy_start(slave->phy);
1167 cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, 1175
1168 slave->slave_num); 1176 /* Configure GMII_SEL register */
1169 } 1177 cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, slave->slave_num);
1170} 1178}
1171 1179
1172static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) 1180static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
@@ -1940,12 +1948,11 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv,
1940 slave->port_vlan = data->dual_emac_res_vlan; 1948 slave->port_vlan = data->dual_emac_res_vlan;
1941} 1949}
1942 1950
1943static int cpsw_probe_dt(struct cpsw_priv *priv, 1951static int cpsw_probe_dt(struct cpsw_platform_data *data,
1944 struct platform_device *pdev) 1952 struct platform_device *pdev)
1945{ 1953{
1946 struct device_node *node = pdev->dev.of_node; 1954 struct device_node *node = pdev->dev.of_node;
1947 struct device_node *slave_node; 1955 struct device_node *slave_node;
1948 struct cpsw_platform_data *data = &priv->data;
1949 int i = 0, ret; 1956 int i = 0, ret;
1950 u32 prop; 1957 u32 prop;
1951 1958
@@ -2033,25 +2040,21 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
2033 if (strcmp(slave_node->name, "slave")) 2040 if (strcmp(slave_node->name, "slave"))
2034 continue; 2041 continue;
2035 2042
2036 priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); 2043 slave_data->phy_node = of_parse_phandle(slave_node,
2044 "phy-handle", 0);
2037 parp = of_get_property(slave_node, "phy_id", &lenp); 2045 parp = of_get_property(slave_node, "phy_id", &lenp);
2038 if (of_phy_is_fixed_link(slave_node)) { 2046 if (slave_data->phy_node) {
2039 struct device_node *phy_node; 2047 dev_dbg(&pdev->dev,
2040 struct phy_device *phy_dev; 2048 "slave[%d] using phy-handle=\"%s\"\n",
2041 2049 i, slave_data->phy_node->full_name);
2050 } else if (of_phy_is_fixed_link(slave_node)) {
2042 /* In the case of a fixed PHY, the DT node associated 2051 /* In the case of a fixed PHY, the DT node associated
2043 * to the PHY is the Ethernet MAC DT node. 2052 * to the PHY is the Ethernet MAC DT node.
2044 */ 2053 */
2045 ret = of_phy_register_fixed_link(slave_node); 2054 ret = of_phy_register_fixed_link(slave_node);
2046 if (ret) 2055 if (ret)
2047 return ret; 2056 return ret;
2048 phy_node = of_node_get(slave_node); 2057 slave_data->phy_node = of_node_get(slave_node);
2049 phy_dev = of_phy_find_device(phy_node);
2050 if (!phy_dev)
2051 return -ENODEV;
2052 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2053 PHY_ID_FMT, phy_dev->mdio.bus->id,
2054 phy_dev->mdio.addr);
2055 } else if (parp) { 2058 } else if (parp) {
2056 u32 phyid; 2059 u32 phyid;
2057 struct device_node *mdio_node; 2060 struct device_node *mdio_node;
@@ -2072,7 +2075,9 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
2072 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), 2075 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2073 PHY_ID_FMT, mdio->name, phyid); 2076 PHY_ID_FMT, mdio->name, phyid);
2074 } else { 2077 } else {
2075 dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i); 2078 dev_err(&pdev->dev,
2079 "No slave[%d] phy_id, phy-handle, or fixed-link property\n",
2080 i);
2076 goto no_phy_slave; 2081 goto no_phy_slave;
2077 } 2082 }
2078 slave_data->phy_if = of_get_phy_mode(slave_node); 2083 slave_data->phy_if = of_get_phy_mode(slave_node);
@@ -2275,7 +2280,7 @@ static int cpsw_probe(struct platform_device *pdev)
2275 /* Select default pin state */ 2280 /* Select default pin state */
2276 pinctrl_pm_select_default_state(&pdev->dev); 2281 pinctrl_pm_select_default_state(&pdev->dev);
2277 2282
2278 if (cpsw_probe_dt(priv, pdev)) { 2283 if (cpsw_probe_dt(&priv->data, pdev)) {
2279 dev_err(&pdev->dev, "cpsw: platform data missing\n"); 2284 dev_err(&pdev->dev, "cpsw: platform data missing\n");
2280 ret = -ENODEV; 2285 ret = -ENODEV;
2281 goto clean_runtime_disable_ret; 2286 goto clean_runtime_disable_ret;
diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 442a7038e660..e50afd1b2eda 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -18,6 +18,7 @@
18#include <linux/phy.h> 18#include <linux/phy.h>
19 19
20struct cpsw_slave_data { 20struct cpsw_slave_data {
21 struct device_node *phy_node;
21 char phy_id[MII_BUS_ID_SIZE]; 22 char phy_id[MII_BUS_ID_SIZE];
22 int phy_if; 23 int phy_if;
23 u8 mac_addr[ETH_ALEN]; 24 u8 mac_addr[ETH_ALEN];
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 58d58f002559..f56d66e6ec15 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1512,7 +1512,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
1512 1512
1513 /* TODO: Add phy read and write and private statistics get feature */ 1513 /* TODO: Add phy read and write and private statistics get feature */
1514 1514
1515 return phy_mii_ioctl(priv->phydev, ifrq, cmd); 1515 if (priv->phydev)
1516 return phy_mii_ioctl(priv->phydev, ifrq, cmd);
1517 else
1518 return -EOPNOTSUPP;
1516} 1519}
1517 1520
1518static int match_first_device(struct device *dev, void *data) 1521static int match_first_device(struct device *dev, void *data)
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
index 13214a6492ac..743b18266a7c 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
@@ -1622,7 +1622,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1622 continue; 1622 continue;
1623 1623
1624 /* copy hw scan info */ 1624 /* copy hw scan info */
1625 memcpy(target->hwinfo, scan_info, scan_info->size); 1625 memcpy(target->hwinfo, scan_info, be16_to_cpu(scan_info->size));
1626 target->essid_len = strnlen(scan_info->essid, 1626 target->essid_len = strnlen(scan_info->essid,
1627 sizeof(scan_info->essid)); 1627 sizeof(scan_info->essid));
1628 target->rate_len = 0; 1628 target->rate_len = 0;
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index b3ffaee30858..f279a897a5c7 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -359,27 +359,25 @@ static void at803x_link_change_notify(struct phy_device *phydev)
359 * in the FIFO. In such cases, the FIFO enters an error mode it 359 * in the FIFO. In such cases, the FIFO enters an error mode it
360 * cannot recover from by software. 360 * cannot recover from by software.
361 */ 361 */
362 if (phydev->drv->phy_id == ATH8030_PHY_ID) { 362 if (phydev->state == PHY_NOLINK) {
363 if (phydev->state == PHY_NOLINK) { 363 if (priv->gpiod_reset && !priv->phy_reset) {
364 if (priv->gpiod_reset && !priv->phy_reset) { 364 struct at803x_context context;
365 struct at803x_context context; 365
366 366 at803x_context_save(phydev, &context);
367 at803x_context_save(phydev, &context); 367
368 368 gpiod_set_value(priv->gpiod_reset, 1);
369 gpiod_set_value(priv->gpiod_reset, 1); 369 msleep(1);
370 msleep(1); 370 gpiod_set_value(priv->gpiod_reset, 0);
371 gpiod_set_value(priv->gpiod_reset, 0); 371 msleep(1);
372 msleep(1); 372
373 373 at803x_context_restore(phydev, &context);
374 at803x_context_restore(phydev, &context); 374
375 375 phydev_dbg(phydev, "%s(): phy was reset\n",
376 phydev_dbg(phydev, "%s(): phy was reset\n", 376 __func__);
377 __func__); 377 priv->phy_reset = true;
378 priv->phy_reset = true;
379 }
380 } else {
381 priv->phy_reset = false;
382 } 378 }
379 } else {
380 priv->phy_reset = false;
383 } 381 }
384} 382}
385 383
@@ -391,7 +389,6 @@ static struct phy_driver at803x_driver[] = {
391 .phy_id_mask = 0xffffffef, 389 .phy_id_mask = 0xffffffef,
392 .probe = at803x_probe, 390 .probe = at803x_probe,
393 .config_init = at803x_config_init, 391 .config_init = at803x_config_init,
394 .link_change_notify = at803x_link_change_notify,
395 .set_wol = at803x_set_wol, 392 .set_wol = at803x_set_wol,
396 .get_wol = at803x_get_wol, 393 .get_wol = at803x_get_wol,
397 .suspend = at803x_suspend, 394 .suspend = at803x_suspend,
@@ -427,7 +424,6 @@ static struct phy_driver at803x_driver[] = {
427 .phy_id_mask = 0xffffffef, 424 .phy_id_mask = 0xffffffef,
428 .probe = at803x_probe, 425 .probe = at803x_probe,
429 .config_init = at803x_config_init, 426 .config_init = at803x_config_init,
430 .link_change_notify = at803x_link_change_notify,
431 .set_wol = at803x_set_wol, 427 .set_wol = at803x_set_wol,
432 .get_wol = at803x_get_wol, 428 .get_wol = at803x_get_wol,
433 .suspend = at803x_suspend, 429 .suspend = at803x_suspend,
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index f20890ee03f3..f64778ad9753 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -269,6 +269,7 @@ struct skb_data { /* skb->cb is one of these */
269 struct lan78xx_net *dev; 269 struct lan78xx_net *dev;
270 enum skb_state state; 270 enum skb_state state;
271 size_t length; 271 size_t length;
272 int num_of_packet;
272}; 273};
273 274
274struct usb_context { 275struct usb_context {
@@ -1803,7 +1804,34 @@ static void lan78xx_remove_mdio(struct lan78xx_net *dev)
1803 1804
1804static void lan78xx_link_status_change(struct net_device *net) 1805static void lan78xx_link_status_change(struct net_device *net)
1805{ 1806{
1806 /* nothing to do */ 1807 struct phy_device *phydev = net->phydev;
1808 int ret, temp;
1809
1810 /* At forced 100 F/H mode, chip may fail to set mode correctly
1811 * when cable is switched between long(~50+m) and short one.
1812 * As workaround, set to 10 before setting to 100
1813 * at forced 100 F/H mode.
1814 */
1815 if (!phydev->autoneg && (phydev->speed == 100)) {
1816 /* disable phy interrupt */
1817 temp = phy_read(phydev, LAN88XX_INT_MASK);
1818 temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
1819 ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
1820
1821 temp = phy_read(phydev, MII_BMCR);
1822 temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
1823 phy_write(phydev, MII_BMCR, temp); /* set to 10 first */
1824 temp |= BMCR_SPEED100;
1825 phy_write(phydev, MII_BMCR, temp); /* set to 100 later */
1826
1827 /* clear pending interrupt generated while workaround */
1828 temp = phy_read(phydev, LAN88XX_INT_STS);
1829
1830 /* enable phy interrupt back */
1831 temp = phy_read(phydev, LAN88XX_INT_MASK);
1832 temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
1833 ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
1834 }
1807} 1835}
1808 1836
1809static int lan78xx_phy_init(struct lan78xx_net *dev) 1837static int lan78xx_phy_init(struct lan78xx_net *dev)
@@ -2464,7 +2492,7 @@ static void tx_complete(struct urb *urb)
2464 struct lan78xx_net *dev = entry->dev; 2492 struct lan78xx_net *dev = entry->dev;
2465 2493
2466 if (urb->status == 0) { 2494 if (urb->status == 0) {
2467 dev->net->stats.tx_packets++; 2495 dev->net->stats.tx_packets += entry->num_of_packet;
2468 dev->net->stats.tx_bytes += entry->length; 2496 dev->net->stats.tx_bytes += entry->length;
2469 } else { 2497 } else {
2470 dev->net->stats.tx_errors++; 2498 dev->net->stats.tx_errors++;
@@ -2681,10 +2709,11 @@ void lan78xx_skb_return(struct lan78xx_net *dev, struct sk_buff *skb)
2681 return; 2709 return;
2682 } 2710 }
2683 2711
2684 skb->protocol = eth_type_trans(skb, dev->net);
2685 dev->net->stats.rx_packets++; 2712 dev->net->stats.rx_packets++;
2686 dev->net->stats.rx_bytes += skb->len; 2713 dev->net->stats.rx_bytes += skb->len;
2687 2714
2715 skb->protocol = eth_type_trans(skb, dev->net);
2716
2688 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n", 2717 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
2689 skb->len + sizeof(struct ethhdr), skb->protocol); 2718 skb->len + sizeof(struct ethhdr), skb->protocol);
2690 memset(skb->cb, 0, sizeof(struct skb_data)); 2719 memset(skb->cb, 0, sizeof(struct skb_data));
@@ -2934,13 +2963,16 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
2934 2963
2935 skb_totallen = 0; 2964 skb_totallen = 0;
2936 pkt_cnt = 0; 2965 pkt_cnt = 0;
2966 count = 0;
2967 length = 0;
2937 for (skb = tqp->next; pkt_cnt < tqp->qlen; skb = skb->next) { 2968 for (skb = tqp->next; pkt_cnt < tqp->qlen; skb = skb->next) {
2938 if (skb_is_gso(skb)) { 2969 if (skb_is_gso(skb)) {
2939 if (pkt_cnt) { 2970 if (pkt_cnt) {
2940 /* handle previous packets first */ 2971 /* handle previous packets first */
2941 break; 2972 break;
2942 } 2973 }
2943 length = skb->len; 2974 count = 1;
2975 length = skb->len - TX_OVERHEAD;
2944 skb2 = skb_dequeue(tqp); 2976 skb2 = skb_dequeue(tqp);
2945 goto gso_skb; 2977 goto gso_skb;
2946 } 2978 }
@@ -2961,14 +2993,13 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
2961 for (count = pos = 0; count < pkt_cnt; count++) { 2993 for (count = pos = 0; count < pkt_cnt; count++) {
2962 skb2 = skb_dequeue(tqp); 2994 skb2 = skb_dequeue(tqp);
2963 if (skb2) { 2995 if (skb2) {
2996 length += (skb2->len - TX_OVERHEAD);
2964 memcpy(skb->data + pos, skb2->data, skb2->len); 2997 memcpy(skb->data + pos, skb2->data, skb2->len);
2965 pos += roundup(skb2->len, sizeof(u32)); 2998 pos += roundup(skb2->len, sizeof(u32));
2966 dev_kfree_skb(skb2); 2999 dev_kfree_skb(skb2);
2967 } 3000 }
2968 } 3001 }
2969 3002
2970 length = skb_totallen;
2971
2972gso_skb: 3003gso_skb:
2973 urb = usb_alloc_urb(0, GFP_ATOMIC); 3004 urb = usb_alloc_urb(0, GFP_ATOMIC);
2974 if (!urb) { 3005 if (!urb) {
@@ -2980,6 +3011,7 @@ gso_skb:
2980 entry->urb = urb; 3011 entry->urb = urb;
2981 entry->dev = dev; 3012 entry->dev = dev;
2982 entry->length = length; 3013 entry->length = length;
3014 entry->num_of_packet = count;
2983 3015
2984 spin_lock_irqsave(&dev->txq.lock, flags); 3016 spin_lock_irqsave(&dev->txq.lock, flags);
2985 ret = usb_autopm_get_interface_async(dev->intf); 3017 ret = usb_autopm_get_interface_async(dev->intf);
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index f84080215915..82129eef7774 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -411,7 +411,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
411 int ret; 411 int ret;
412 412
413 read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart); 413 read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart);
414 data[0] = 0xc9; 414 data[0] = 0xc8; /* TX & RX enable, append status, no CRC */
415 data[1] = 0; 415 data[1] = 0;
416 if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL)) 416 if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL))
417 data[1] |= 0x20; /* set full duplex */ 417 data[1] |= 0x20; /* set full duplex */
@@ -497,7 +497,7 @@ static void read_bulk_callback(struct urb *urb)
497 pkt_len = buf[count - 3] << 8; 497 pkt_len = buf[count - 3] << 8;
498 pkt_len += buf[count - 4]; 498 pkt_len += buf[count - 4];
499 pkt_len &= 0xfff; 499 pkt_len &= 0xfff;
500 pkt_len -= 8; 500 pkt_len -= 4;
501 } 501 }
502 502
503 /* 503 /*
@@ -528,7 +528,7 @@ static void read_bulk_callback(struct urb *urb)
528goon: 528goon:
529 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, 529 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
530 usb_rcvbulkpipe(pegasus->usb, 1), 530 usb_rcvbulkpipe(pegasus->usb, 1),
531 pegasus->rx_skb->data, PEGASUS_MTU + 8, 531 pegasus->rx_skb->data, PEGASUS_MTU,
532 read_bulk_callback, pegasus); 532 read_bulk_callback, pegasus);
533 rx_status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC); 533 rx_status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
534 if (rx_status == -ENODEV) 534 if (rx_status == -ENODEV)
@@ -569,7 +569,7 @@ static void rx_fixup(unsigned long data)
569 } 569 }
570 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, 570 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
571 usb_rcvbulkpipe(pegasus->usb, 1), 571 usb_rcvbulkpipe(pegasus->usb, 1),
572 pegasus->rx_skb->data, PEGASUS_MTU + 8, 572 pegasus->rx_skb->data, PEGASUS_MTU,
573 read_bulk_callback, pegasus); 573 read_bulk_callback, pegasus);
574try_again: 574try_again:
575 status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC); 575 status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
@@ -823,7 +823,7 @@ static int pegasus_open(struct net_device *net)
823 823
824 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, 824 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
825 usb_rcvbulkpipe(pegasus->usb, 1), 825 usb_rcvbulkpipe(pegasus->usb, 1),
826 pegasus->rx_skb->data, PEGASUS_MTU + 8, 826 pegasus->rx_skb->data, PEGASUS_MTU,
827 read_bulk_callback, pegasus); 827 read_bulk_callback, pegasus);
828 if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) { 828 if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) {
829 if (res == -ENODEV) 829 if (res == -ENODEV)
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 30033dbe6662..c369db99c005 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -29,6 +29,7 @@
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30#include <linux/usb/usbnet.h> 30#include <linux/usb/usbnet.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/of_net.h>
32#include "smsc75xx.h" 33#include "smsc75xx.h"
33 34
34#define SMSC_CHIPNAME "smsc75xx" 35#define SMSC_CHIPNAME "smsc75xx"
@@ -761,6 +762,15 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
761 762
762static void smsc75xx_init_mac_address(struct usbnet *dev) 763static void smsc75xx_init_mac_address(struct usbnet *dev)
763{ 764{
765 const u8 *mac_addr;
766
767 /* maybe the boot loader passed the MAC address in devicetree */
768 mac_addr = of_get_mac_address(dev->udev->dev.of_node);
769 if (mac_addr) {
770 memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
771 return;
772 }
773
764 /* try reading mac address from EEPROM */ 774 /* try reading mac address from EEPROM */
765 if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, 775 if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
766 dev->net->dev_addr) == 0) { 776 dev->net->dev_addr) == 0) {
@@ -772,7 +782,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
772 } 782 }
773 } 783 }
774 784
775 /* no eeprom, or eeprom values are invalid. generate random MAC */ 785 /* no useful static MAC address found. generate a random one */
776 eth_hw_addr_random(dev->net); 786 eth_hw_addr_random(dev->net);
777 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); 787 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
778} 788}
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 66b3ab9f614e..2edc2bc6d1b9 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -29,6 +29,7 @@
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30#include <linux/usb/usbnet.h> 30#include <linux/usb/usbnet.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/of_net.h>
32#include "smsc95xx.h" 33#include "smsc95xx.h"
33 34
34#define SMSC_CHIPNAME "smsc95xx" 35#define SMSC_CHIPNAME "smsc95xx"
@@ -765,6 +766,15 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
765 766
766static void smsc95xx_init_mac_address(struct usbnet *dev) 767static void smsc95xx_init_mac_address(struct usbnet *dev)
767{ 768{
769 const u8 *mac_addr;
770
771 /* maybe the boot loader passed the MAC address in devicetree */
772 mac_addr = of_get_mac_address(dev->udev->dev.of_node);
773 if (mac_addr) {
774 memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
775 return;
776 }
777
768 /* try reading mac address from EEPROM */ 778 /* try reading mac address from EEPROM */
769 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, 779 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
770 dev->net->dev_addr) == 0) { 780 dev->net->dev_addr) == 0) {
@@ -775,7 +785,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
775 } 785 }
776 } 786 }
777 787
778 /* no eeprom, or eeprom values are invalid. generate random MAC */ 788 /* no useful static MAC address found. generate a random one */
779 eth_hw_addr_random(dev->net); 789 eth_hw_addr_random(dev->net);
780 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); 790 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
781} 791}
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 8f8793004b9f..1b271b99c49e 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah,
274 }; 274 };
275 static const int inc[4] = { 0, 100, 0, 0 }; 275 static const int inc[4] = { 0, 100, 0, 0 };
276 276
277 memset(&mask_m, 0, sizeof(int8_t) * 123);
278 memset(&mask_p, 0, sizeof(int8_t) * 123);
279
277 cur_bin = -6000; 280 cur_bin = -6000;
278 upper = bin + 100; 281 upper = bin + 100;
279 lower = bin - 100; 282 lower = bin - 100;
@@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(struct ath_hw *ah,
424 int tmp, new; 427 int tmp, new;
425 int i; 428 int i;
426 429
427 int8_t mask_m[123];
428 int8_t mask_p[123];
429 int cur_bb_spur; 430 int cur_bb_spur;
430 bool is2GHz = IS_CHAN_2GHZ(chan); 431 bool is2GHz = IS_CHAN_2GHZ(chan);
431 432
432 memset(&mask_m, 0, sizeof(int8_t) * 123);
433 memset(&mask_p, 0, sizeof(int8_t) * 123);
434
435 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 433 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
436 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz); 434 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
437 if (AR_NO_SPUR == cur_bb_spur) 435 if (AR_NO_SPUR == cur_bb_spur)
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
index db6624527d99..53d7445a5d12 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
@@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(struct ath_hw *ah,
178 int i; 178 int i;
179 struct chan_centers centers; 179 struct chan_centers centers;
180 180
181 int8_t mask_m[123];
182 int8_t mask_p[123];
183 int cur_bb_spur; 181 int cur_bb_spur;
184 bool is2GHz = IS_CHAN_2GHZ(chan); 182 bool is2GHz = IS_CHAN_2GHZ(chan);
185 183
186 memset(&mask_m, 0, sizeof(int8_t) * 123);
187 memset(&mask_p, 0, sizeof(int8_t) * 123);
188
189 ath9k_hw_get_channel_centers(ah, chan, &centers); 184 ath9k_hw_get_channel_centers(ah, chan, &centers);
190 freq = centers.synth_center; 185 freq = centers.synth_center;
191 186
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
index 97be104d1203..b5c57eebf995 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
@@ -93,7 +93,7 @@
93#define IWL8260_SMEM_OFFSET 0x400000 93#define IWL8260_SMEM_OFFSET 0x400000
94#define IWL8260_SMEM_LEN 0x68000 94#define IWL8260_SMEM_LEN 0x68000
95 95
96#define IWL8000_FW_PRE "iwlwifi-8000" 96#define IWL8000_FW_PRE "iwlwifi-8000C-"
97#define IWL8000_MODULE_FIRMWARE(api) \ 97#define IWL8000_MODULE_FIRMWARE(api) \
98 IWL8000_FW_PRE "-" __stringify(api) ".ucode" 98 IWL8000_FW_PRE "-" __stringify(api) ".ucode"
99 99
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index f899666acb41..9e45bf9c6071 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -238,19 +238,6 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
238 snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode", 238 snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode",
239 name_pre, tag); 239 name_pre, tag);
240 240
241 /*
242 * Starting 8000B - FW name format has changed. This overwrites the
243 * previous name and uses the new format.
244 */
245 if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
246 char rev_step = 'A' + CSR_HW_REV_STEP(drv->trans->hw_rev);
247
248 if (rev_step != 'A')
249 snprintf(drv->firmware_name,
250 sizeof(drv->firmware_name), "%s%c-%s.ucode",
251 name_pre, rev_step, tag);
252 }
253
254 IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n", 241 IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n",
255 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) 242 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
256 ? "EXPERIMENTAL " : "", 243 ? "EXPERIMENTAL " : "",
@@ -1060,11 +1047,18 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
1060 return -EINVAL; 1047 return -EINVAL;
1061 } 1048 }
1062 1049
1063 if (WARN(fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) && 1050 /*
1064 !gscan_capa, 1051 * If ucode advertises that it supports GSCAN but GSCAN
1065 "GSCAN is supported but capabilities TLV is unavailable\n")) 1052 * capabilities TLV is not present, or if it has an old format,
1053 * warn and continue without GSCAN.
1054 */
1055 if (fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) &&
1056 !gscan_capa) {
1057 IWL_DEBUG_INFO(drv,
1058 "GSCAN is supported but capabilities TLV is unavailable\n");
1066 __clear_bit((__force long)IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT, 1059 __clear_bit((__force long)IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT,
1067 capa->_capa); 1060 capa->_capa);
1061 }
1068 1062
1069 return 0; 1063 return 0;
1070 1064
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index 4856eac120f6..6938cd37be57 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -526,7 +526,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
526 file_len += sizeof(*dump_data) + sizeof(*dump_mem) + sram2_len; 526 file_len += sizeof(*dump_data) + sizeof(*dump_mem) + sram2_len;
527 527
528 /* Make room for fw's virtual image pages, if it exists */ 528 /* Make room for fw's virtual image pages, if it exists */
529 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size) 529 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
530 mvm->fw_paging_db[0].fw_paging_block)
530 file_len += mvm->num_of_paging_blk * 531 file_len += mvm->num_of_paging_blk *
531 (sizeof(*dump_data) + 532 (sizeof(*dump_data) +
532 sizeof(struct iwl_fw_error_dump_paging) + 533 sizeof(struct iwl_fw_error_dump_paging) +
@@ -643,7 +644,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
643 } 644 }
644 645
645 /* Dump fw's virtual image */ 646 /* Dump fw's virtual image */
646 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size) { 647 if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
648 mvm->fw_paging_db[0].fw_paging_block) {
647 for (i = 1; i < mvm->num_of_paging_blk + 1; i++) { 649 for (i = 1; i < mvm->num_of_paging_blk + 1; i++) {
648 struct iwl_fw_error_dump_paging *paging; 650 struct iwl_fw_error_dump_paging *paging;
649 struct page *pages = 651 struct page *pages =
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 594cd0dc7df9..09d895fafaf2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -144,9 +144,11 @@ void iwl_free_fw_paging(struct iwl_mvm *mvm)
144 144
145 __free_pages(mvm->fw_paging_db[i].fw_paging_block, 145 __free_pages(mvm->fw_paging_db[i].fw_paging_block,
146 get_order(mvm->fw_paging_db[i].fw_paging_size)); 146 get_order(mvm->fw_paging_db[i].fw_paging_size));
147 mvm->fw_paging_db[i].fw_paging_block = NULL;
147 } 148 }
148 kfree(mvm->trans->paging_download_buf); 149 kfree(mvm->trans->paging_download_buf);
149 mvm->trans->paging_download_buf = NULL; 150 mvm->trans->paging_download_buf = NULL;
151 mvm->trans->paging_db = NULL;
150 152
151 memset(mvm->fw_paging_db, 0, sizeof(mvm->fw_paging_db)); 153 memset(mvm->fw_paging_db, 0, sizeof(mvm->fw_paging_db));
152} 154}
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 05b968506836..79d7cd7d461e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -479,8 +479,18 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
479 {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)}, 479 {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)},
480 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)}, 480 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)},
481 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)}, 481 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)},
482 {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)},
483 {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)},
484 {IWL_PCI_DEVICE(0x24FD, 0x1010, iwl8265_2ac_cfg)},
485 {IWL_PCI_DEVICE(0x24FD, 0x0050, iwl8265_2ac_cfg)},
486 {IWL_PCI_DEVICE(0x24FD, 0x0150, iwl8265_2ac_cfg)},
487 {IWL_PCI_DEVICE(0x24FD, 0x9010, iwl8265_2ac_cfg)},
488 {IWL_PCI_DEVICE(0x24FD, 0x8110, iwl8265_2ac_cfg)},
489 {IWL_PCI_DEVICE(0x24FD, 0x8050, iwl8265_2ac_cfg)},
482 {IWL_PCI_DEVICE(0x24FD, 0x8010, iwl8265_2ac_cfg)}, 490 {IWL_PCI_DEVICE(0x24FD, 0x8010, iwl8265_2ac_cfg)},
483 {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)}, 491 {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)},
492 {IWL_PCI_DEVICE(0x24FD, 0x9110, iwl8265_2ac_cfg)},
493 {IWL_PCI_DEVICE(0x24FD, 0x8130, iwl8265_2ac_cfg)},
484 494
485/* 9000 Series */ 495/* 9000 Series */
486 {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)}, 496 {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)},
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index f798899338ed..5101f3ab4f29 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -397,10 +397,17 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn)
397 */ 397 */
398 start += start_pad; 398 start += start_pad;
399 npfns = (pmem->size - start_pad - end_trunc - SZ_8K) / SZ_4K; 399 npfns = (pmem->size - start_pad - end_trunc - SZ_8K) / SZ_4K;
400 if (nd_pfn->mode == PFN_MODE_PMEM) 400 if (nd_pfn->mode == PFN_MODE_PMEM) {
401 offset = ALIGN(start + SZ_8K + 64 * npfns, nd_pfn->align) 401 unsigned long memmap_size;
402
403 /*
404 * vmemmap_populate_hugepages() allocates the memmap array in
405 * HPAGE_SIZE chunks.
406 */
407 memmap_size = ALIGN(64 * npfns, HPAGE_SIZE);
408 offset = ALIGN(start + SZ_8K + memmap_size, nd_pfn->align)
402 - start; 409 - start;
403 else if (nd_pfn->mode == PFN_MODE_RAM) 410 } else if (nd_pfn->mode == PFN_MODE_RAM)
404 offset = ALIGN(start + SZ_8K, nd_pfn->align) - start; 411 offset = ALIGN(start + SZ_8K, nd_pfn->align) - start;
405 else 412 else
406 goto err; 413 goto err;
diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c
index 8ba19bba3156..2bb3c5799ac4 100644
--- a/drivers/nvmem/mxs-ocotp.c
+++ b/drivers/nvmem/mxs-ocotp.c
@@ -94,7 +94,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
94 if (ret) 94 if (ret)
95 goto close_banks; 95 goto close_banks;
96 96
97 while (val_size) { 97 while (val_size >= reg_size) {
98 if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) { 98 if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) {
99 /* fill up non-data register */ 99 /* fill up non-data register */
100 *buf = 0; 100 *buf = 0;
@@ -103,7 +103,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
103 } 103 }
104 104
105 buf++; 105 buf++;
106 val_size--; 106 val_size -= reg_size;
107 offset += reg_size; 107 offset += reg_size;
108 } 108 }
109 109
diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
index 96168b819044..e165b7ce29d7 100644
--- a/drivers/rapidio/devices/rio_mport_cdev.c
+++ b/drivers/rapidio/devices/rio_mport_cdev.c
@@ -126,7 +126,7 @@ struct rio_mport_mapping {
126 struct list_head node; 126 struct list_head node;
127 struct mport_dev *md; 127 struct mport_dev *md;
128 enum rio_mport_map_dir dir; 128 enum rio_mport_map_dir dir;
129 u32 rioid; 129 u16 rioid;
130 u64 rio_addr; 130 u64 rio_addr;
131 dma_addr_t phys_addr; /* for mmap */ 131 dma_addr_t phys_addr; /* for mmap */
132 void *virt_addr; /* kernel address, for dma_free_coherent */ 132 void *virt_addr; /* kernel address, for dma_free_coherent */
@@ -137,7 +137,7 @@ struct rio_mport_mapping {
137 137
138struct rio_mport_dma_map { 138struct rio_mport_dma_map {
139 int valid; 139 int valid;
140 uint64_t length; 140 u64 length;
141 void *vaddr; 141 void *vaddr;
142 dma_addr_t paddr; 142 dma_addr_t paddr;
143}; 143};
@@ -208,7 +208,7 @@ struct mport_cdev_priv {
208 struct kfifo event_fifo; 208 struct kfifo event_fifo;
209 wait_queue_head_t event_rx_wait; 209 wait_queue_head_t event_rx_wait;
210 spinlock_t fifo_lock; 210 spinlock_t fifo_lock;
211 unsigned int event_mask; /* RIO_DOORBELL, RIO_PORTWRITE */ 211 u32 event_mask; /* RIO_DOORBELL, RIO_PORTWRITE */
212#ifdef CONFIG_RAPIDIO_DMA_ENGINE 212#ifdef CONFIG_RAPIDIO_DMA_ENGINE
213 struct dma_chan *dmach; 213 struct dma_chan *dmach;
214 struct list_head async_list; 214 struct list_head async_list;
@@ -276,7 +276,8 @@ static int rio_mport_maint_rd(struct mport_cdev_priv *priv, void __user *arg,
276 return -EFAULT; 276 return -EFAULT;
277 277
278 if ((maint_io.offset % 4) || 278 if ((maint_io.offset % 4) ||
279 (maint_io.length == 0) || (maint_io.length % 4)) 279 (maint_io.length == 0) || (maint_io.length % 4) ||
280 (maint_io.length + maint_io.offset) > RIO_MAINT_SPACE_SZ)
280 return -EINVAL; 281 return -EINVAL;
281 282
282 buffer = vmalloc(maint_io.length); 283 buffer = vmalloc(maint_io.length);
@@ -298,7 +299,8 @@ static int rio_mport_maint_rd(struct mport_cdev_priv *priv, void __user *arg,
298 offset += 4; 299 offset += 4;
299 } 300 }
300 301
301 if (unlikely(copy_to_user(maint_io.buffer, buffer, maint_io.length))) 302 if (unlikely(copy_to_user((void __user *)(uintptr_t)maint_io.buffer,
303 buffer, maint_io.length)))
302 ret = -EFAULT; 304 ret = -EFAULT;
303out: 305out:
304 vfree(buffer); 306 vfree(buffer);
@@ -319,7 +321,8 @@ static int rio_mport_maint_wr(struct mport_cdev_priv *priv, void __user *arg,
319 return -EFAULT; 321 return -EFAULT;
320 322
321 if ((maint_io.offset % 4) || 323 if ((maint_io.offset % 4) ||
322 (maint_io.length == 0) || (maint_io.length % 4)) 324 (maint_io.length == 0) || (maint_io.length % 4) ||
325 (maint_io.length + maint_io.offset) > RIO_MAINT_SPACE_SZ)
323 return -EINVAL; 326 return -EINVAL;
324 327
325 buffer = vmalloc(maint_io.length); 328 buffer = vmalloc(maint_io.length);
@@ -327,7 +330,8 @@ static int rio_mport_maint_wr(struct mport_cdev_priv *priv, void __user *arg,
327 return -ENOMEM; 330 return -ENOMEM;
328 length = maint_io.length; 331 length = maint_io.length;
329 332
330 if (unlikely(copy_from_user(buffer, maint_io.buffer, length))) { 333 if (unlikely(copy_from_user(buffer,
334 (void __user *)(uintptr_t)maint_io.buffer, length))) {
331 ret = -EFAULT; 335 ret = -EFAULT;
332 goto out; 336 goto out;
333 } 337 }
@@ -360,7 +364,7 @@ out:
360 */ 364 */
361static int 365static int
362rio_mport_create_outbound_mapping(struct mport_dev *md, struct file *filp, 366rio_mport_create_outbound_mapping(struct mport_dev *md, struct file *filp,
363 u32 rioid, u64 raddr, u32 size, 367 u16 rioid, u64 raddr, u32 size,
364 dma_addr_t *paddr) 368 dma_addr_t *paddr)
365{ 369{
366 struct rio_mport *mport = md->mport; 370 struct rio_mport *mport = md->mport;
@@ -369,7 +373,7 @@ rio_mport_create_outbound_mapping(struct mport_dev *md, struct file *filp,
369 373
370 rmcd_debug(OBW, "did=%d ra=0x%llx sz=0x%x", rioid, raddr, size); 374 rmcd_debug(OBW, "did=%d ra=0x%llx sz=0x%x", rioid, raddr, size);
371 375
372 map = kzalloc(sizeof(struct rio_mport_mapping), GFP_KERNEL); 376 map = kzalloc(sizeof(*map), GFP_KERNEL);
373 if (map == NULL) 377 if (map == NULL)
374 return -ENOMEM; 378 return -ENOMEM;
375 379
@@ -394,7 +398,7 @@ err_map_outb:
394 398
395static int 399static int
396rio_mport_get_outbound_mapping(struct mport_dev *md, struct file *filp, 400rio_mport_get_outbound_mapping(struct mport_dev *md, struct file *filp,
397 u32 rioid, u64 raddr, u32 size, 401 u16 rioid, u64 raddr, u32 size,
398 dma_addr_t *paddr) 402 dma_addr_t *paddr)
399{ 403{
400 struct rio_mport_mapping *map; 404 struct rio_mport_mapping *map;
@@ -433,7 +437,7 @@ static int rio_mport_obw_map(struct file *filp, void __user *arg)
433 dma_addr_t paddr; 437 dma_addr_t paddr;
434 int ret; 438 int ret;
435 439
436 if (unlikely(copy_from_user(&map, arg, sizeof(struct rio_mmap)))) 440 if (unlikely(copy_from_user(&map, arg, sizeof(map))))
437 return -EFAULT; 441 return -EFAULT;
438 442
439 rmcd_debug(OBW, "did=%d ra=0x%llx sz=0x%llx", 443 rmcd_debug(OBW, "did=%d ra=0x%llx sz=0x%llx",
@@ -448,7 +452,7 @@ static int rio_mport_obw_map(struct file *filp, void __user *arg)
448 452
449 map.handle = paddr; 453 map.handle = paddr;
450 454
451 if (unlikely(copy_to_user(arg, &map, sizeof(struct rio_mmap)))) 455 if (unlikely(copy_to_user(arg, &map, sizeof(map))))
452 return -EFAULT; 456 return -EFAULT;
453 return 0; 457 return 0;
454} 458}
@@ -469,7 +473,7 @@ static int rio_mport_obw_free(struct file *filp, void __user *arg)
469 if (!md->mport->ops->unmap_outb) 473 if (!md->mport->ops->unmap_outb)
470 return -EPROTONOSUPPORT; 474 return -EPROTONOSUPPORT;
471 475
472 if (copy_from_user(&handle, arg, sizeof(u64))) 476 if (copy_from_user(&handle, arg, sizeof(handle)))
473 return -EFAULT; 477 return -EFAULT;
474 478
475 rmcd_debug(OBW, "h=0x%llx", handle); 479 rmcd_debug(OBW, "h=0x%llx", handle);
@@ -498,9 +502,9 @@ static int rio_mport_obw_free(struct file *filp, void __user *arg)
498static int maint_hdid_set(struct mport_cdev_priv *priv, void __user *arg) 502static int maint_hdid_set(struct mport_cdev_priv *priv, void __user *arg)
499{ 503{
500 struct mport_dev *md = priv->md; 504 struct mport_dev *md = priv->md;
501 uint16_t hdid; 505 u16 hdid;
502 506
503 if (copy_from_user(&hdid, arg, sizeof(uint16_t))) 507 if (copy_from_user(&hdid, arg, sizeof(hdid)))
504 return -EFAULT; 508 return -EFAULT;
505 509
506 md->mport->host_deviceid = hdid; 510 md->mport->host_deviceid = hdid;
@@ -520,9 +524,9 @@ static int maint_hdid_set(struct mport_cdev_priv *priv, void __user *arg)
520static int maint_comptag_set(struct mport_cdev_priv *priv, void __user *arg) 524static int maint_comptag_set(struct mport_cdev_priv *priv, void __user *arg)
521{ 525{
522 struct mport_dev *md = priv->md; 526 struct mport_dev *md = priv->md;
523 uint32_t comptag; 527 u32 comptag;
524 528
525 if (copy_from_user(&comptag, arg, sizeof(uint32_t))) 529 if (copy_from_user(&comptag, arg, sizeof(comptag)))
526 return -EFAULT; 530 return -EFAULT;
527 531
528 rio_local_write_config_32(md->mport, RIO_COMPONENT_TAG_CSR, comptag); 532 rio_local_write_config_32(md->mport, RIO_COMPONENT_TAG_CSR, comptag);
@@ -837,7 +841,7 @@ err_out:
837 * @xfer: data transfer descriptor structure 841 * @xfer: data transfer descriptor structure
838 */ 842 */
839static int 843static int
840rio_dma_transfer(struct file *filp, uint32_t transfer_mode, 844rio_dma_transfer(struct file *filp, u32 transfer_mode,
841 enum rio_transfer_sync sync, enum dma_data_direction dir, 845 enum rio_transfer_sync sync, enum dma_data_direction dir,
842 struct rio_transfer_io *xfer) 846 struct rio_transfer_io *xfer)
843{ 847{
@@ -875,7 +879,7 @@ rio_dma_transfer(struct file *filp, uint32_t transfer_mode,
875 unsigned long offset; 879 unsigned long offset;
876 long pinned; 880 long pinned;
877 881
878 offset = (unsigned long)xfer->loc_addr & ~PAGE_MASK; 882 offset = (unsigned long)(uintptr_t)xfer->loc_addr & ~PAGE_MASK;
879 nr_pages = PAGE_ALIGN(xfer->length + offset) >> PAGE_SHIFT; 883 nr_pages = PAGE_ALIGN(xfer->length + offset) >> PAGE_SHIFT;
880 884
881 page_list = kmalloc_array(nr_pages, 885 page_list = kmalloc_array(nr_pages,
@@ -1015,19 +1019,20 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg)
1015 if (unlikely(copy_from_user(&transaction, arg, sizeof(transaction)))) 1019 if (unlikely(copy_from_user(&transaction, arg, sizeof(transaction))))
1016 return -EFAULT; 1020 return -EFAULT;
1017 1021
1018 if (transaction.count != 1) 1022 if (transaction.count != 1) /* only single transfer for now */
1019 return -EINVAL; 1023 return -EINVAL;
1020 1024
1021 if ((transaction.transfer_mode & 1025 if ((transaction.transfer_mode &
1022 priv->md->properties.transfer_mode) == 0) 1026 priv->md->properties.transfer_mode) == 0)
1023 return -ENODEV; 1027 return -ENODEV;
1024 1028
1025 transfer = vmalloc(transaction.count * sizeof(struct rio_transfer_io)); 1029 transfer = vmalloc(transaction.count * sizeof(*transfer));
1026 if (!transfer) 1030 if (!transfer)
1027 return -ENOMEM; 1031 return -ENOMEM;
1028 1032
1029 if (unlikely(copy_from_user(transfer, transaction.block, 1033 if (unlikely(copy_from_user(transfer,
1030 transaction.count * sizeof(struct rio_transfer_io)))) { 1034 (void __user *)(uintptr_t)transaction.block,
1035 transaction.count * sizeof(*transfer)))) {
1031 ret = -EFAULT; 1036 ret = -EFAULT;
1032 goto out_free; 1037 goto out_free;
1033 } 1038 }
@@ -1038,8 +1043,9 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg)
1038 ret = rio_dma_transfer(filp, transaction.transfer_mode, 1043 ret = rio_dma_transfer(filp, transaction.transfer_mode,
1039 transaction.sync, dir, &transfer[i]); 1044 transaction.sync, dir, &transfer[i]);
1040 1045
1041 if (unlikely(copy_to_user(transaction.block, transfer, 1046 if (unlikely(copy_to_user((void __user *)(uintptr_t)transaction.block,
1042 transaction.count * sizeof(struct rio_transfer_io)))) 1047 transfer,
1048 transaction.count * sizeof(*transfer))))
1043 ret = -EFAULT; 1049 ret = -EFAULT;
1044 1050
1045out_free: 1051out_free:
@@ -1129,11 +1135,11 @@ err_tmo:
1129} 1135}
1130 1136
1131static int rio_mport_create_dma_mapping(struct mport_dev *md, struct file *filp, 1137static int rio_mport_create_dma_mapping(struct mport_dev *md, struct file *filp,
1132 uint64_t size, struct rio_mport_mapping **mapping) 1138 u64 size, struct rio_mport_mapping **mapping)
1133{ 1139{
1134 struct rio_mport_mapping *map; 1140 struct rio_mport_mapping *map;
1135 1141
1136 map = kzalloc(sizeof(struct rio_mport_mapping), GFP_KERNEL); 1142 map = kzalloc(sizeof(*map), GFP_KERNEL);
1137 if (map == NULL) 1143 if (map == NULL)
1138 return -ENOMEM; 1144 return -ENOMEM;
1139 1145
@@ -1165,7 +1171,7 @@ static int rio_mport_alloc_dma(struct file *filp, void __user *arg)
1165 struct rio_mport_mapping *mapping = NULL; 1171 struct rio_mport_mapping *mapping = NULL;
1166 int ret; 1172 int ret;
1167 1173
1168 if (unlikely(copy_from_user(&map, arg, sizeof(struct rio_dma_mem)))) 1174 if (unlikely(copy_from_user(&map, arg, sizeof(map))))
1169 return -EFAULT; 1175 return -EFAULT;
1170 1176
1171 ret = rio_mport_create_dma_mapping(md, filp, map.length, &mapping); 1177 ret = rio_mport_create_dma_mapping(md, filp, map.length, &mapping);
@@ -1174,7 +1180,7 @@ static int rio_mport_alloc_dma(struct file *filp, void __user *arg)
1174 1180
1175 map.dma_handle = mapping->phys_addr; 1181 map.dma_handle = mapping->phys_addr;
1176 1182
1177 if (unlikely(copy_to_user(arg, &map, sizeof(struct rio_dma_mem)))) { 1183 if (unlikely(copy_to_user(arg, &map, sizeof(map)))) {
1178 mutex_lock(&md->buf_mutex); 1184 mutex_lock(&md->buf_mutex);
1179 kref_put(&mapping->ref, mport_release_mapping); 1185 kref_put(&mapping->ref, mport_release_mapping);
1180 mutex_unlock(&md->buf_mutex); 1186 mutex_unlock(&md->buf_mutex);
@@ -1192,7 +1198,7 @@ static int rio_mport_free_dma(struct file *filp, void __user *arg)
1192 int ret = -EFAULT; 1198 int ret = -EFAULT;
1193 struct rio_mport_mapping *map, *_map; 1199 struct rio_mport_mapping *map, *_map;
1194 1200
1195 if (copy_from_user(&handle, arg, sizeof(u64))) 1201 if (copy_from_user(&handle, arg, sizeof(handle)))
1196 return -EFAULT; 1202 return -EFAULT;
1197 rmcd_debug(EXIT, "filp=%p", filp); 1203 rmcd_debug(EXIT, "filp=%p", filp);
1198 1204
@@ -1242,14 +1248,18 @@ static int rio_mport_free_dma(struct file *filp, void __user *arg)
1242 1248
1243static int 1249static int
1244rio_mport_create_inbound_mapping(struct mport_dev *md, struct file *filp, 1250rio_mport_create_inbound_mapping(struct mport_dev *md, struct file *filp,
1245 u64 raddr, u32 size, 1251 u64 raddr, u64 size,
1246 struct rio_mport_mapping **mapping) 1252 struct rio_mport_mapping **mapping)
1247{ 1253{
1248 struct rio_mport *mport = md->mport; 1254 struct rio_mport *mport = md->mport;
1249 struct rio_mport_mapping *map; 1255 struct rio_mport_mapping *map;
1250 int ret; 1256 int ret;
1251 1257
1252 map = kzalloc(sizeof(struct rio_mport_mapping), GFP_KERNEL); 1258 /* rio_map_inb_region() accepts u32 size */
1259 if (size > 0xffffffff)
1260 return -EINVAL;
1261
1262 map = kzalloc(sizeof(*map), GFP_KERNEL);
1253 if (map == NULL) 1263 if (map == NULL)
1254 return -ENOMEM; 1264 return -ENOMEM;
1255 1265
@@ -1262,7 +1272,7 @@ rio_mport_create_inbound_mapping(struct mport_dev *md, struct file *filp,
1262 1272
1263 if (raddr == RIO_MAP_ANY_ADDR) 1273 if (raddr == RIO_MAP_ANY_ADDR)
1264 raddr = map->phys_addr; 1274 raddr = map->phys_addr;
1265 ret = rio_map_inb_region(mport, map->phys_addr, raddr, size, 0); 1275 ret = rio_map_inb_region(mport, map->phys_addr, raddr, (u32)size, 0);
1266 if (ret < 0) 1276 if (ret < 0)
1267 goto err_map_inb; 1277 goto err_map_inb;
1268 1278
@@ -1288,7 +1298,7 @@ err_dma_alloc:
1288 1298
1289static int 1299static int
1290rio_mport_get_inbound_mapping(struct mport_dev *md, struct file *filp, 1300rio_mport_get_inbound_mapping(struct mport_dev *md, struct file *filp,
1291 u64 raddr, u32 size, 1301 u64 raddr, u64 size,
1292 struct rio_mport_mapping **mapping) 1302 struct rio_mport_mapping **mapping)
1293{ 1303{
1294 struct rio_mport_mapping *map; 1304 struct rio_mport_mapping *map;
@@ -1331,7 +1341,7 @@ static int rio_mport_map_inbound(struct file *filp, void __user *arg)
1331 1341
1332 if (!md->mport->ops->map_inb) 1342 if (!md->mport->ops->map_inb)
1333 return -EPROTONOSUPPORT; 1343 return -EPROTONOSUPPORT;
1334 if (unlikely(copy_from_user(&map, arg, sizeof(struct rio_mmap)))) 1344 if (unlikely(copy_from_user(&map, arg, sizeof(map))))
1335 return -EFAULT; 1345 return -EFAULT;
1336 1346
1337 rmcd_debug(IBW, "%s filp=%p", dev_name(&priv->md->dev), filp); 1347 rmcd_debug(IBW, "%s filp=%p", dev_name(&priv->md->dev), filp);
@@ -1344,7 +1354,7 @@ static int rio_mport_map_inbound(struct file *filp, void __user *arg)
1344 map.handle = mapping->phys_addr; 1354 map.handle = mapping->phys_addr;
1345 map.rio_addr = mapping->rio_addr; 1355 map.rio_addr = mapping->rio_addr;
1346 1356
1347 if (unlikely(copy_to_user(arg, &map, sizeof(struct rio_mmap)))) { 1357 if (unlikely(copy_to_user(arg, &map, sizeof(map)))) {
1348 /* Delete mapping if it was created by this request */ 1358 /* Delete mapping if it was created by this request */
1349 if (ret == 0 && mapping->filp == filp) { 1359 if (ret == 0 && mapping->filp == filp) {
1350 mutex_lock(&md->buf_mutex); 1360 mutex_lock(&md->buf_mutex);
@@ -1375,7 +1385,7 @@ static int rio_mport_inbound_free(struct file *filp, void __user *arg)
1375 if (!md->mport->ops->unmap_inb) 1385 if (!md->mport->ops->unmap_inb)
1376 return -EPROTONOSUPPORT; 1386 return -EPROTONOSUPPORT;
1377 1387
1378 if (copy_from_user(&handle, arg, sizeof(u64))) 1388 if (copy_from_user(&handle, arg, sizeof(handle)))
1379 return -EFAULT; 1389 return -EFAULT;
1380 1390
1381 mutex_lock(&md->buf_mutex); 1391 mutex_lock(&md->buf_mutex);
@@ -1401,7 +1411,7 @@ static int rio_mport_inbound_free(struct file *filp, void __user *arg)
1401static int maint_port_idx_get(struct mport_cdev_priv *priv, void __user *arg) 1411static int maint_port_idx_get(struct mport_cdev_priv *priv, void __user *arg)
1402{ 1412{
1403 struct mport_dev *md = priv->md; 1413 struct mport_dev *md = priv->md;
1404 uint32_t port_idx = md->mport->index; 1414 u32 port_idx = md->mport->index;
1405 1415
1406 rmcd_debug(MPORT, "port_index=%d", port_idx); 1416 rmcd_debug(MPORT, "port_index=%d", port_idx);
1407 1417
@@ -1451,7 +1461,7 @@ static void rio_mport_doorbell_handler(struct rio_mport *mport, void *dev_id,
1451 handled = 0; 1461 handled = 0;
1452 spin_lock(&data->db_lock); 1462 spin_lock(&data->db_lock);
1453 list_for_each_entry(db_filter, &data->doorbells, data_node) { 1463 list_for_each_entry(db_filter, &data->doorbells, data_node) {
1454 if (((db_filter->filter.rioid == 0xffffffff || 1464 if (((db_filter->filter.rioid == RIO_INVALID_DESTID ||
1455 db_filter->filter.rioid == src)) && 1465 db_filter->filter.rioid == src)) &&
1456 info >= db_filter->filter.low && 1466 info >= db_filter->filter.low &&
1457 info <= db_filter->filter.high) { 1467 info <= db_filter->filter.high) {
@@ -1525,6 +1535,9 @@ static int rio_mport_remove_db_filter(struct mport_cdev_priv *priv,
1525 if (copy_from_user(&filter, arg, sizeof(filter))) 1535 if (copy_from_user(&filter, arg, sizeof(filter)))
1526 return -EFAULT; 1536 return -EFAULT;
1527 1537
1538 if (filter.low > filter.high)
1539 return -EINVAL;
1540
1528 spin_lock_irqsave(&priv->md->db_lock, flags); 1541 spin_lock_irqsave(&priv->md->db_lock, flags);
1529 list_for_each_entry(db_filter, &priv->db_filters, priv_node) { 1542 list_for_each_entry(db_filter, &priv->db_filters, priv_node) {
1530 if (db_filter->filter.rioid == filter.rioid && 1543 if (db_filter->filter.rioid == filter.rioid &&
@@ -1737,10 +1750,10 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
1737 return -EEXIST; 1750 return -EEXIST;
1738 } 1751 }
1739 1752
1740 size = sizeof(struct rio_dev); 1753 size = sizeof(*rdev);
1741 mport = md->mport; 1754 mport = md->mport;
1742 destid = (u16)dev_info.destid; 1755 destid = dev_info.destid;
1743 hopcount = (u8)dev_info.hopcount; 1756 hopcount = dev_info.hopcount;
1744 1757
1745 if (rio_mport_read_config_32(mport, destid, hopcount, 1758 if (rio_mport_read_config_32(mport, destid, hopcount,
1746 RIO_PEF_CAR, &rval)) 1759 RIO_PEF_CAR, &rval))
@@ -1872,8 +1885,8 @@ static int rio_mport_del_riodev(struct mport_cdev_priv *priv, void __user *arg)
1872 do { 1885 do {
1873 rdev = rio_get_comptag(dev_info.comptag, rdev); 1886 rdev = rio_get_comptag(dev_info.comptag, rdev);
1874 if (rdev && rdev->dev.parent == &mport->net->dev && 1887 if (rdev && rdev->dev.parent == &mport->net->dev &&
1875 rdev->destid == (u16)dev_info.destid && 1888 rdev->destid == dev_info.destid &&
1876 rdev->hopcount == (u8)dev_info.hopcount) 1889 rdev->hopcount == dev_info.hopcount)
1877 break; 1890 break;
1878 } while (rdev); 1891 } while (rdev);
1879 } 1892 }
@@ -2146,8 +2159,8 @@ static long mport_cdev_ioctl(struct file *filp,
2146 return maint_port_idx_get(data, (void __user *)arg); 2159 return maint_port_idx_get(data, (void __user *)arg);
2147 case RIO_MPORT_GET_PROPERTIES: 2160 case RIO_MPORT_GET_PROPERTIES:
2148 md->properties.hdid = md->mport->host_deviceid; 2161 md->properties.hdid = md->mport->host_deviceid;
2149 if (copy_to_user((void __user *)arg, &(data->md->properties), 2162 if (copy_to_user((void __user *)arg, &(md->properties),
2150 sizeof(data->md->properties))) 2163 sizeof(md->properties)))
2151 return -EFAULT; 2164 return -EFAULT;
2152 return 0; 2165 return 0;
2153 case RIO_ENABLE_DOORBELL_RANGE: 2166 case RIO_ENABLE_DOORBELL_RANGE:
@@ -2159,11 +2172,11 @@ static long mport_cdev_ioctl(struct file *filp,
2159 case RIO_DISABLE_PORTWRITE_RANGE: 2172 case RIO_DISABLE_PORTWRITE_RANGE:
2160 return rio_mport_remove_pw_filter(data, (void __user *)arg); 2173 return rio_mport_remove_pw_filter(data, (void __user *)arg);
2161 case RIO_SET_EVENT_MASK: 2174 case RIO_SET_EVENT_MASK:
2162 data->event_mask = arg; 2175 data->event_mask = (u32)arg;
2163 return 0; 2176 return 0;
2164 case RIO_GET_EVENT_MASK: 2177 case RIO_GET_EVENT_MASK:
2165 if (copy_to_user((void __user *)arg, &data->event_mask, 2178 if (copy_to_user((void __user *)arg, &data->event_mask,
2166 sizeof(data->event_mask))) 2179 sizeof(u32)))
2167 return -EFAULT; 2180 return -EFAULT;
2168 return 0; 2181 return 0;
2169 case RIO_MAP_OUTBOUND: 2182 case RIO_MAP_OUTBOUND:
@@ -2374,7 +2387,7 @@ static ssize_t mport_write(struct file *filp, const char __user *buf,
2374 return -EINVAL; 2387 return -EINVAL;
2375 2388
2376 ret = rio_mport_send_doorbell(mport, 2389 ret = rio_mport_send_doorbell(mport,
2377 (u16)event.u.doorbell.rioid, 2390 event.u.doorbell.rioid,
2378 event.u.doorbell.payload); 2391 event.u.doorbell.payload);
2379 if (ret < 0) 2392 if (ret < 0)
2380 return ret; 2393 return ret;
@@ -2421,7 +2434,7 @@ static struct mport_dev *mport_cdev_add(struct rio_mport *mport)
2421 struct mport_dev *md; 2434 struct mport_dev *md;
2422 struct rio_mport_attr attr; 2435 struct rio_mport_attr attr;
2423 2436
2424 md = kzalloc(sizeof(struct mport_dev), GFP_KERNEL); 2437 md = kzalloc(sizeof(*md), GFP_KERNEL);
2425 if (!md) { 2438 if (!md) {
2426 rmcd_error("Unable allocate a device object"); 2439 rmcd_error("Unable allocate a device object");
2427 return NULL; 2440 return NULL;
@@ -2470,7 +2483,7 @@ static struct mport_dev *mport_cdev_add(struct rio_mport *mport)
2470 /* The transfer_mode property will be returned through mport query 2483 /* The transfer_mode property will be returned through mport query
2471 * interface 2484 * interface
2472 */ 2485 */
2473#ifdef CONFIG_PPC /* for now: only on Freescale's SoCs */ 2486#ifdef CONFIG_FSL_RIO /* for now: only on Freescale's SoCs */
2474 md->properties.transfer_mode |= RIO_TRANSFER_MODE_MAPPED; 2487 md->properties.transfer_mode |= RIO_TRANSFER_MODE_MAPPED;
2475#else 2488#else
2476 md->properties.transfer_mode |= RIO_TRANSFER_MODE_TRANSFER; 2489 md->properties.transfer_mode |= RIO_TRANSFER_MODE_TRANSFER;
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 14718a9ffcfb..460c855be0d0 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -249,18 +249,12 @@ static int usb_port_runtime_suspend(struct device *dev)
249 249
250 return retval; 250 return retval;
251} 251}
252
253static int usb_port_prepare(struct device *dev)
254{
255 return 1;
256}
257#endif 252#endif
258 253
259static const struct dev_pm_ops usb_port_pm_ops = { 254static const struct dev_pm_ops usb_port_pm_ops = {
260#ifdef CONFIG_PM 255#ifdef CONFIG_PM
261 .runtime_suspend = usb_port_runtime_suspend, 256 .runtime_suspend = usb_port_runtime_suspend,
262 .runtime_resume = usb_port_runtime_resume, 257 .runtime_resume = usb_port_runtime_resume,
263 .prepare = usb_port_prepare,
264#endif 258#endif
265}; 259};
266 260
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index dcb85e3cd5a7..479187c32571 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -312,13 +312,7 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
312 312
313static int usb_dev_prepare(struct device *dev) 313static int usb_dev_prepare(struct device *dev)
314{ 314{
315 struct usb_device *udev = to_usb_device(dev); 315 return 0; /* Implement eventually? */
316
317 /* Return 0 if the current wakeup setting is wrong, otherwise 1 */
318 if (udev->do_remote_wakeup != device_may_wakeup(dev))
319 return 0;
320
321 return 1;
322} 316}
323 317
324static void usb_dev_complete(struct device *dev) 318static void usb_dev_complete(struct device *dev)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 5e5a8fa005f8..bc8889956d17 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -83,9 +83,9 @@ static int jz4740_musb_init(struct musb *musb)
83{ 83{
84 usb_phy_generic_register(); 84 usb_phy_generic_register();
85 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); 85 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
86 if (!musb->xceiv) { 86 if (IS_ERR(musb->xceiv)) {
87 pr_err("HS UDC: no transceiver configured\n"); 87 pr_err("HS UDC: no transceiver configured\n");
88 return -ENODEV; 88 return PTR_ERR(musb->xceiv);
89 } 89 }
90 90
91 /* Silicon does not implement ConfigData register. 91 /* Silicon does not implement ConfigData register.
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 87bd578799a8..152865b36522 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1164,12 +1164,12 @@ static int musb_gadget_disable(struct usb_ep *ep)
1164 musb_writew(epio, MUSB_RXMAXP, 0); 1164 musb_writew(epio, MUSB_RXMAXP, 0);
1165 } 1165 }
1166 1166
1167 musb_ep->desc = NULL;
1168 musb_ep->end_point.desc = NULL;
1169
1170 /* abort all pending DMA and requests */ 1167 /* abort all pending DMA and requests */
1171 nuke(musb_ep, -ESHUTDOWN); 1168 nuke(musb_ep, -ESHUTDOWN);
1172 1169
1170 musb_ep->desc = NULL;
1171 musb_ep->end_point.desc = NULL;
1172
1173 schedule_work(&musb->irq_work); 1173 schedule_work(&musb->irq_work);
1174 1174
1175 spin_unlock_irqrestore(&(musb->lock), flags); 1175 spin_unlock_irqrestore(&(musb->lock), flags);
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 58487a473521..2f8ad7f1f482 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2735,7 +2735,7 @@ static const struct hc_driver musb_hc_driver = {
2735 .description = "musb-hcd", 2735 .description = "musb-hcd",
2736 .product_desc = "MUSB HDRC host driver", 2736 .product_desc = "MUSB HDRC host driver",
2737 .hcd_priv_size = sizeof(struct musb *), 2737 .hcd_priv_size = sizeof(struct musb *),
2738 .flags = HCD_USB2 | HCD_MEMORY | HCD_BH, 2738 .flags = HCD_USB2 | HCD_MEMORY,
2739 2739
2740 /* not using irq handler or reset hooks from usbcore, since 2740 /* not using irq handler or reset hooks from usbcore, since
2741 * those must be shared with peripheral code for OTG configs 2741 * those must be shared with peripheral code for OTG configs
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index dd47823bb014..7c9f25e9c422 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -109,6 +109,7 @@ static const struct usb_device_id id_table[] = {
109 { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ 109 { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */
110 { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ 110 { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */
111 { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ 111 { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */
112 { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */
112 { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ 113 { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
113 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ 114 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
114 { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ 115 { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
@@ -118,6 +119,7 @@ static const struct usb_device_id id_table[] = {
118 { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ 119 { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
119 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ 120 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
120 { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ 121 { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
122 { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
121 { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ 123 { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
122 { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ 124 { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */
123 { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ 125 { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
@@ -141,6 +143,8 @@ static const struct usb_device_id id_table[] = {
141 { USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */ 143 { USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */
142 { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */ 144 { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */
143 { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ 145 { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */
146 { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */
147 { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */
144 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ 148 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
145 { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ 149 { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
146 { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ 150 { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 5c802d47892c..ca6bfddaacad 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1006,7 +1006,7 @@ struct virtqueue *vring_create_virtqueue(
1006 const char *name) 1006 const char *name)
1007{ 1007{
1008 struct virtqueue *vq; 1008 struct virtqueue *vq;
1009 void *queue; 1009 void *queue = NULL;
1010 dma_addr_t dma_addr; 1010 dma_addr_t dma_addr;
1011 size_t queue_size_in_bytes; 1011 size_t queue_size_in_bytes;
1012 struct vring vring; 1012 struct vring vring;
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 9781e0dd59d6..d46839f51e73 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -151,6 +151,8 @@ static DECLARE_WAIT_QUEUE_HEAD(balloon_wq);
151static void balloon_process(struct work_struct *work); 151static void balloon_process(struct work_struct *work);
152static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); 152static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
153 153
154static void release_memory_resource(struct resource *resource);
155
154/* When ballooning out (allocating memory to return to Xen) we don't really 156/* When ballooning out (allocating memory to return to Xen) we don't really
155 want the kernel to try too hard since that can trigger the oom killer. */ 157 want the kernel to try too hard since that can trigger the oom killer. */
156#define GFP_BALLOON \ 158#define GFP_BALLOON \
@@ -267,6 +269,20 @@ static struct resource *additional_memory_resource(phys_addr_t size)
267 return NULL; 269 return NULL;
268 } 270 }
269 271
272#ifdef CONFIG_SPARSEMEM
273 {
274 unsigned long limit = 1UL << (MAX_PHYSMEM_BITS - PAGE_SHIFT);
275 unsigned long pfn = res->start >> PAGE_SHIFT;
276
277 if (pfn > limit) {
278 pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n",
279 pfn, limit);
280 release_memory_resource(res);
281 return NULL;
282 }
283 }
284#endif
285
270 return res; 286 return res;
271} 287}
272 288
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index 38272ad24551..f4edd6df3df2 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -316,7 +316,6 @@ static int evtchn_resize_ring(struct per_user_data *u)
316{ 316{
317 unsigned int new_size; 317 unsigned int new_size;
318 evtchn_port_t *new_ring, *old_ring; 318 evtchn_port_t *new_ring, *old_ring;
319 unsigned int p, c;
320 319
321 /* 320 /*
322 * Ensure the ring is large enough to capture all possible 321 * Ensure the ring is large enough to capture all possible
@@ -346,20 +345,17 @@ static int evtchn_resize_ring(struct per_user_data *u)
346 /* 345 /*
347 * Copy the old ring contents to the new ring. 346 * Copy the old ring contents to the new ring.
348 * 347 *
349 * If the ring contents crosses the end of the current ring, 348 * To take care of wrapping, a full ring, and the new index
350 * it needs to be copied in two chunks. 349 * pointing into the second half, simply copy the old contents
350 * twice.
351 * 351 *
352 * +---------+ +------------------+ 352 * +---------+ +------------------+
353 * |34567 12| -> | 1234567 | 353 * |34567 12| -> |34567 1234567 12|
354 * +-----p-c-+ +------------------+ 354 * +-----p-c-+ +-------c------p---+
355 */ 355 */
356 p = evtchn_ring_offset(u, u->ring_prod); 356 memcpy(new_ring, old_ring, u->ring_size * sizeof(*u->ring));
357 c = evtchn_ring_offset(u, u->ring_cons); 357 memcpy(new_ring + u->ring_size, old_ring,
358 if (p < c) { 358 u->ring_size * sizeof(*u->ring));
359 memcpy(new_ring + c, u->ring + c, (u->ring_size - c) * sizeof(*u->ring));
360 memcpy(new_ring + u->ring_size, u->ring, p * sizeof(*u->ring));
361 } else
362 memcpy(new_ring + c, u->ring + c, (p - c) * sizeof(*u->ring));
363 359
364 u->ring = new_ring; 360 u->ring = new_ring;
365 u->ring_size = new_size; 361 u->ring_size = new_size;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 719924d6c706..dcad5e210525 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1295,7 +1295,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
1295 1295
1296 *nbytesp = nbytes; 1296 *nbytesp = nbytes;
1297 1297
1298 return ret; 1298 return ret < 0 ? ret : 0;
1299} 1299}
1300 1300
1301static inline int fuse_iter_npages(const struct iov_iter *ii_p) 1301static inline int fuse_iter_npages(const struct iov_iter *ii_p)
diff --git a/fs/pnode.c b/fs/pnode.c
index c524fdddc7fb..99899705b105 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -198,7 +198,7 @@ static struct mount *next_group(struct mount *m, struct mount *origin)
198 198
199/* all accesses are serialized by namespace_sem */ 199/* all accesses are serialized by namespace_sem */
200static struct user_namespace *user_ns; 200static struct user_namespace *user_ns;
201static struct mount *last_dest, *last_source, *dest_master; 201static struct mount *last_dest, *first_source, *last_source, *dest_master;
202static struct mountpoint *mp; 202static struct mountpoint *mp;
203static struct hlist_head *list; 203static struct hlist_head *list;
204 204
@@ -221,20 +221,22 @@ static int propagate_one(struct mount *m)
221 type = CL_MAKE_SHARED; 221 type = CL_MAKE_SHARED;
222 } else { 222 } else {
223 struct mount *n, *p; 223 struct mount *n, *p;
224 bool done;
224 for (n = m; ; n = p) { 225 for (n = m; ; n = p) {
225 p = n->mnt_master; 226 p = n->mnt_master;
226 if (p == dest_master || IS_MNT_MARKED(p)) { 227 if (p == dest_master || IS_MNT_MARKED(p))
227 while (last_dest->mnt_master != p) {
228 last_source = last_source->mnt_master;
229 last_dest = last_source->mnt_parent;
230 }
231 if (!peers(n, last_dest)) {
232 last_source = last_source->mnt_master;
233 last_dest = last_source->mnt_parent;
234 }
235 break; 228 break;
236 }
237 } 229 }
230 do {
231 struct mount *parent = last_source->mnt_parent;
232 if (last_source == first_source)
233 break;
234 done = parent->mnt_master == p;
235 if (done && peers(n, parent))
236 break;
237 last_source = last_source->mnt_master;
238 } while (!done);
239
238 type = CL_SLAVE; 240 type = CL_SLAVE;
239 /* beginning of peer group among the slaves? */ 241 /* beginning of peer group among the slaves? */
240 if (IS_MNT_SHARED(m)) 242 if (IS_MNT_SHARED(m))
@@ -286,6 +288,7 @@ int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp,
286 */ 288 */
287 user_ns = current->nsproxy->mnt_ns->user_ns; 289 user_ns = current->nsproxy->mnt_ns->user_ns;
288 last_dest = dest_mnt; 290 last_dest = dest_mnt;
291 first_source = source_mnt;
289 last_source = source_mnt; 292 last_source = source_mnt;
290 mp = dest_mp; 293 mp = dest_mp;
291 list = tree_list; 294 list = tree_list;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index b1755b23893e..92e37e224cd2 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -955,7 +955,8 @@ static ssize_t environ_read(struct file *file, char __user *buf,
955 struct mm_struct *mm = file->private_data; 955 struct mm_struct *mm = file->private_data;
956 unsigned long env_start, env_end; 956 unsigned long env_start, env_end;
957 957
958 if (!mm) 958 /* Ensure the process spawned far enough to have an environment. */
959 if (!mm || !mm->env_end)
959 return 0; 960 return 0;
960 961
961 page = (char *)__get_free_page(GFP_TEMPORARY); 962 page = (char *)__get_free_page(GFP_TEMPORARY);
diff --git a/fs/udf/super.c b/fs/udf/super.c
index fa92fe839fda..36661acaf33b 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -919,14 +919,14 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block)
919#endif 919#endif
920 } 920 }
921 921
922 ret = udf_CS0toUTF8(outstr, 31, pvoldesc->volIdent, 32); 922 ret = udf_dstrCS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
923 if (ret < 0) 923 if (ret < 0)
924 goto out_bh; 924 goto out_bh;
925 925
926 strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret); 926 strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
927 udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident); 927 udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident);
928 928
929 ret = udf_CS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128); 929 ret = udf_dstrCS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
930 if (ret < 0) 930 if (ret < 0)
931 goto out_bh; 931 goto out_bh;
932 932
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 972b70625614..263829ef1873 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -212,7 +212,7 @@ extern int udf_get_filename(struct super_block *, const uint8_t *, int,
212 uint8_t *, int); 212 uint8_t *, int);
213extern int udf_put_filename(struct super_block *, const uint8_t *, int, 213extern int udf_put_filename(struct super_block *, const uint8_t *, int,
214 uint8_t *, int); 214 uint8_t *, int);
215extern int udf_CS0toUTF8(uint8_t *, int, const uint8_t *, int); 215extern int udf_dstrCS0toUTF8(uint8_t *, int, const uint8_t *, int);
216 216
217/* ialloc.c */ 217/* ialloc.c */
218extern void udf_free_inode(struct inode *); 218extern void udf_free_inode(struct inode *);
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index 3ff42f4437f3..695389a4fc23 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -335,9 +335,21 @@ try_again:
335 return u_len; 335 return u_len;
336} 336}
337 337
338int udf_CS0toUTF8(uint8_t *utf_o, int o_len, const uint8_t *ocu_i, int i_len) 338int udf_dstrCS0toUTF8(uint8_t *utf_o, int o_len,
339 const uint8_t *ocu_i, int i_len)
339{ 340{
340 return udf_name_from_CS0(utf_o, o_len, ocu_i, i_len, 341 int s_len = 0;
342
343 if (i_len > 0) {
344 s_len = ocu_i[i_len - 1];
345 if (s_len >= i_len) {
346 pr_err("incorrect dstring lengths (%d/%d)\n",
347 s_len, i_len);
348 return -EINVAL;
349 }
350 }
351
352 return udf_name_from_CS0(utf_o, o_len, ocu_i, s_len,
341 udf_uni2char_utf8, 0); 353 udf_uni2char_utf8, 0);
342} 354}
343 355
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 14362a84c78e..3a932501d690 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -394,13 +394,13 @@ struct acpi_data_node {
394 394
395static inline bool is_acpi_node(struct fwnode_handle *fwnode) 395static inline bool is_acpi_node(struct fwnode_handle *fwnode)
396{ 396{
397 return fwnode && (fwnode->type == FWNODE_ACPI 397 return !IS_ERR_OR_NULL(fwnode) && (fwnode->type == FWNODE_ACPI
398 || fwnode->type == FWNODE_ACPI_DATA); 398 || fwnode->type == FWNODE_ACPI_DATA);
399} 399}
400 400
401static inline bool is_acpi_device_node(struct fwnode_handle *fwnode) 401static inline bool is_acpi_device_node(struct fwnode_handle *fwnode)
402{ 402{
403 return fwnode && fwnode->type == FWNODE_ACPI; 403 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_ACPI;
404} 404}
405 405
406static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode) 406static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 21ee41b92e8a..f1d5c5acc8dd 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -171,12 +171,13 @@ void bpf_register_prog_type(struct bpf_prog_type_list *tl);
171void bpf_register_map_type(struct bpf_map_type_list *tl); 171void bpf_register_map_type(struct bpf_map_type_list *tl);
172 172
173struct bpf_prog *bpf_prog_get(u32 ufd); 173struct bpf_prog *bpf_prog_get(u32 ufd);
174struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog);
174void bpf_prog_put(struct bpf_prog *prog); 175void bpf_prog_put(struct bpf_prog *prog);
175void bpf_prog_put_rcu(struct bpf_prog *prog); 176void bpf_prog_put_rcu(struct bpf_prog *prog);
176 177
177struct bpf_map *bpf_map_get_with_uref(u32 ufd); 178struct bpf_map *bpf_map_get_with_uref(u32 ufd);
178struct bpf_map *__bpf_map_get(struct fd f); 179struct bpf_map *__bpf_map_get(struct fd f);
179void bpf_map_inc(struct bpf_map *map, bool uref); 180struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref);
180void bpf_map_put_with_uref(struct bpf_map *map); 181void bpf_map_put_with_uref(struct bpf_map *map);
181void bpf_map_put(struct bpf_map *map); 182void bpf_map_put(struct bpf_map *map);
182int bpf_map_precharge_memlock(u32 pages); 183int bpf_map_precharge_memlock(u32 pages);
diff --git a/include/linux/hash.h b/include/linux/hash.h
index 1afde47e1528..79c52fa81cac 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -32,12 +32,28 @@
32#error Wordsize not 32 or 64 32#error Wordsize not 32 or 64
33#endif 33#endif
34 34
35/*
36 * The above primes are actively bad for hashing, since they are
37 * too sparse. The 32-bit one is mostly ok, the 64-bit one causes
38 * real problems. Besides, the "prime" part is pointless for the
39 * multiplicative hash.
40 *
41 * Although a random odd number will do, it turns out that the golden
42 * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice
43 * properties.
44 *
45 * These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2.
46 * (See Knuth vol 3, section 6.4, exercise 9.)
47 */
48#define GOLDEN_RATIO_32 0x61C88647
49#define GOLDEN_RATIO_64 0x61C8864680B583EBull
50
35static __always_inline u64 hash_64(u64 val, unsigned int bits) 51static __always_inline u64 hash_64(u64 val, unsigned int bits)
36{ 52{
37 u64 hash = val; 53 u64 hash = val;
38 54
39#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 55#if BITS_PER_LONG == 64
40 hash = hash * GOLDEN_RATIO_PRIME_64; 56 hash = hash * GOLDEN_RATIO_64;
41#else 57#else
42 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ 58 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */
43 u64 n = hash; 59 u64 n = hash;
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index d5569734f672..548fd535fd02 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -28,6 +28,11 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
28 return (struct ethhdr *)skb_mac_header(skb); 28 return (struct ethhdr *)skb_mac_header(skb);
29} 29}
30 30
31static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
32{
33 return (struct ethhdr *)skb_inner_mac_header(skb);
34}
35
31int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 36int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
32 37
33extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 38extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
diff --git a/include/linux/net.h b/include/linux/net.h
index 49175e4ced11..f840d77c6c31 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -246,7 +246,15 @@ do { \
246 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__) 246 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
247#define net_info_ratelimited(fmt, ...) \ 247#define net_info_ratelimited(fmt, ...) \
248 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) 248 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
249#if defined(DEBUG) 249#if defined(CONFIG_DYNAMIC_DEBUG)
250#define net_dbg_ratelimited(fmt, ...) \
251do { \
252 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
253 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
254 net_ratelimit()) \
255 __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
256} while (0)
257#elif defined(DEBUG)
250#define net_dbg_ratelimited(fmt, ...) \ 258#define net_dbg_ratelimited(fmt, ...) \
251 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) 259 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
252#else 260#else
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8395308a2445..b3c46b019ac1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4004,7 +4004,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb);
4004 4004
4005static inline bool net_gso_ok(netdev_features_t features, int gso_type) 4005static inline bool net_gso_ok(netdev_features_t features, int gso_type)
4006{ 4006{
4007 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; 4007 netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT;
4008 4008
4009 /* check flags correspondence */ 4009 /* check flags correspondence */
4010 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); 4010 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
diff --git a/include/linux/of.h b/include/linux/of.h
index 7fcb681baadf..31758036787c 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -133,7 +133,7 @@ void of_core_init(void);
133 133
134static inline bool is_of_node(struct fwnode_handle *fwnode) 134static inline bool is_of_node(struct fwnode_handle *fwnode)
135{ 135{
136 return fwnode && fwnode->type == FWNODE_OF; 136 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_OF;
137} 137}
138 138
139static inline struct device_node *to_of_node(struct fwnode_handle *fwnode) 139static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index f4ed4f1b0c77..6b052aa7b5b7 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -517,6 +517,27 @@ static inline int PageTransCompound(struct page *page)
517} 517}
518 518
519/* 519/*
520 * PageTransCompoundMap is the same as PageTransCompound, but it also
521 * guarantees the primary MMU has the entire compound page mapped
522 * through pmd_trans_huge, which in turn guarantees the secondary MMUs
523 * can also map the entire compound page. This allows the secondary
524 * MMUs to call get_user_pages() only once for each compound page and
525 * to immediately map the entire compound page with a single secondary
526 * MMU fault. If there will be a pmd split later, the secondary MMUs
527 * will get an update through the MMU notifier invalidation through
528 * split_huge_pmd().
529 *
530 * Unlike PageTransCompound, this is safe to be called only while
531 * split_huge_pmd() cannot run from under us, like if protected by the
532 * MMU notifier, otherwise it may result in page->_mapcount < 0 false
533 * positives.
534 */
535static inline int PageTransCompoundMap(struct page *page)
536{
537 return PageTransCompound(page) && atomic_read(&page->_mapcount) < 0;
538}
539
540/*
520 * PageTransTail returns true for both transparent huge pages 541 * PageTransTail returns true for both transparent huge pages
521 * and hugetlbfs pages, so it should only be called when it's known 542 * and hugetlbfs pages, so it should only be called when it's known
522 * that hugetlbfs pages aren't involved. 543 * that hugetlbfs pages aren't involved.
@@ -559,6 +580,7 @@ static inline int TestClearPageDoubleMap(struct page *page)
559#else 580#else
560TESTPAGEFLAG_FALSE(TransHuge) 581TESTPAGEFLAG_FALSE(TransHuge)
561TESTPAGEFLAG_FALSE(TransCompound) 582TESTPAGEFLAG_FALSE(TransCompound)
583TESTPAGEFLAG_FALSE(TransCompoundMap)
562TESTPAGEFLAG_FALSE(TransTail) 584TESTPAGEFLAG_FALSE(TransTail)
563TESTPAGEFLAG_FALSE(DoubleMap) 585TESTPAGEFLAG_FALSE(DoubleMap)
564 TESTSETFLAG_FALSE(DoubleMap) 586 TESTSETFLAG_FALSE(DoubleMap)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 2b83359c19ca..0a4cd4703f40 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -533,6 +533,10 @@ static inline swp_entry_t get_swap_page(void)
533#ifdef CONFIG_MEMCG 533#ifdef CONFIG_MEMCG
534static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) 534static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
535{ 535{
536 /* Cgroup2 doesn't have per-cgroup swappiness */
537 if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
538 return vm_swappiness;
539
536 /* root ? */ 540 /* root ? */
537 if (mem_cgroup_disabled() || !memcg->css.parent) 541 if (mem_cgroup_disabled() || !memcg->css.parent)
538 return vm_swappiness; 542 return vm_swappiness;
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 73ed2e951c02..35437c779da8 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -252,7 +252,9 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,
252 (skb->inner_protocol_type != ENCAP_TYPE_ETHER || 252 (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
253 skb->inner_protocol != htons(ETH_P_TEB) || 253 skb->inner_protocol != htons(ETH_P_TEB) ||
254 (skb_inner_mac_header(skb) - skb_transport_header(skb) != 254 (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
255 sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) 255 sizeof(struct udphdr) + sizeof(struct vxlanhdr)) ||
256 (skb->ip_summed != CHECKSUM_NONE &&
257 !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto))))
256 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); 258 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
257 259
258 return features; 260 return features;
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 6e0f5f01734c..c51afb71bfab 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -718,9 +718,9 @@ __SYSCALL(__NR_mlock2, sys_mlock2)
718#define __NR_copy_file_range 285 718#define __NR_copy_file_range 285
719__SYSCALL(__NR_copy_file_range, sys_copy_file_range) 719__SYSCALL(__NR_copy_file_range, sys_copy_file_range)
720#define __NR_preadv2 286 720#define __NR_preadv2 286
721__SYSCALL(__NR_preadv2, sys_preadv2) 721__SC_COMP(__NR_preadv2, sys_preadv2, compat_sys_preadv2)
722#define __NR_pwritev2 287 722#define __NR_pwritev2 287
723__SYSCALL(__NR_pwritev2, sys_pwritev2) 723__SC_COMP(__NR_pwritev2, sys_pwritev2, compat_sys_pwritev2)
724 724
725#undef __NR_syscalls 725#undef __NR_syscalls
726#define __NR_syscalls 288 726#define __NR_syscalls 288
diff --git a/include/linux/rio_mport_cdev.h b/include/uapi/linux/rio_mport_cdev.h
index b65d19df76d2..5796bf1d06ad 100644
--- a/include/linux/rio_mport_cdev.h
+++ b/include/uapi/linux/rio_mport_cdev.h
@@ -39,16 +39,16 @@
39#ifndef _RIO_MPORT_CDEV_H_ 39#ifndef _RIO_MPORT_CDEV_H_
40#define _RIO_MPORT_CDEV_H_ 40#define _RIO_MPORT_CDEV_H_
41 41
42#ifndef __user 42#include <linux/ioctl.h>
43#define __user 43#include <linux/types.h>
44#endif
45 44
46struct rio_mport_maint_io { 45struct rio_mport_maint_io {
47 uint32_t rioid; /* destID of remote device */ 46 __u16 rioid; /* destID of remote device */
48 uint32_t hopcount; /* hopcount to remote device */ 47 __u8 hopcount; /* hopcount to remote device */
49 uint32_t offset; /* offset in register space */ 48 __u8 pad0[5];
50 size_t length; /* length in bytes */ 49 __u32 offset; /* offset in register space */
51 void __user *buffer; /* data buffer */ 50 __u32 length; /* length in bytes */
51 __u64 buffer; /* pointer to data buffer */
52}; 52};
53 53
54/* 54/*
@@ -66,22 +66,23 @@ struct rio_mport_maint_io {
66#define RIO_CAP_MAP_INB (1 << 7) 66#define RIO_CAP_MAP_INB (1 << 7)
67 67
68struct rio_mport_properties { 68struct rio_mport_properties {
69 uint16_t hdid; 69 __u16 hdid;
70 uint8_t id; /* Physical port ID */ 70 __u8 id; /* Physical port ID */
71 uint8_t index; 71 __u8 index;
72 uint32_t flags; 72 __u32 flags;
73 uint32_t sys_size; /* Default addressing size */ 73 __u32 sys_size; /* Default addressing size */
74 uint8_t port_ok; 74 __u8 port_ok;
75 uint8_t link_speed; 75 __u8 link_speed;
76 uint8_t link_width; 76 __u8 link_width;
77 uint32_t dma_max_sge; 77 __u8 pad0;
78 uint32_t dma_max_size; 78 __u32 dma_max_sge;
79 uint32_t dma_align; 79 __u32 dma_max_size;
80 uint32_t transfer_mode; /* Default transfer mode */ 80 __u32 dma_align;
81 uint32_t cap_sys_size; /* Capable system sizes */ 81 __u32 transfer_mode; /* Default transfer mode */
82 uint32_t cap_addr_size; /* Capable addressing sizes */ 82 __u32 cap_sys_size; /* Capable system sizes */
83 uint32_t cap_transfer_mode; /* Capable transfer modes */ 83 __u32 cap_addr_size; /* Capable addressing sizes */
84 uint32_t cap_mport; /* Mport capabilities */ 84 __u32 cap_transfer_mode; /* Capable transfer modes */
85 __u32 cap_mport; /* Mport capabilities */
85}; 86};
86 87
87/* 88/*
@@ -93,54 +94,57 @@ struct rio_mport_properties {
93#define RIO_PORTWRITE (1 << 1) 94#define RIO_PORTWRITE (1 << 1)
94 95
95struct rio_doorbell { 96struct rio_doorbell {
96 uint32_t rioid; 97 __u16 rioid;
97 uint16_t payload; 98 __u16 payload;
98}; 99};
99 100
100struct rio_doorbell_filter { 101struct rio_doorbell_filter {
101 uint32_t rioid; /* 0xffffffff to match all ids */ 102 __u16 rioid; /* Use RIO_INVALID_DESTID to match all ids */
102 uint16_t low; 103 __u16 low;
103 uint16_t high; 104 __u16 high;
105 __u16 pad0;
104}; 106};
105 107
106 108
107struct rio_portwrite { 109struct rio_portwrite {
108 uint32_t payload[16]; 110 __u32 payload[16];
109}; 111};
110 112
111struct rio_pw_filter { 113struct rio_pw_filter {
112 uint32_t mask; 114 __u32 mask;
113 uint32_t low; 115 __u32 low;
114 uint32_t high; 116 __u32 high;
117 __u32 pad0;
115}; 118};
116 119
117/* RapidIO base address for inbound requests set to value defined below 120/* RapidIO base address for inbound requests set to value defined below
118 * indicates that no specific RIO-to-local address translation is requested 121 * indicates that no specific RIO-to-local address translation is requested
119 * and driver should use direct (one-to-one) address mapping. 122 * and driver should use direct (one-to-one) address mapping.
120*/ 123*/
121#define RIO_MAP_ANY_ADDR (uint64_t)(~((uint64_t) 0)) 124#define RIO_MAP_ANY_ADDR (__u64)(~((__u64) 0))
122 125
123struct rio_mmap { 126struct rio_mmap {
124 uint32_t rioid; 127 __u16 rioid;
125 uint64_t rio_addr; 128 __u16 pad0[3];
126 uint64_t length; 129 __u64 rio_addr;
127 uint64_t handle; 130 __u64 length;
128 void *address; 131 __u64 handle;
132 __u64 address;
129}; 133};
130 134
131struct rio_dma_mem { 135struct rio_dma_mem {
132 uint64_t length; /* length of DMA memory */ 136 __u64 length; /* length of DMA memory */
133 uint64_t dma_handle; /* handle associated with this memory */ 137 __u64 dma_handle; /* handle associated with this memory */
134 void *buffer; /* pointer to this memory */ 138 __u64 address;
135}; 139};
136 140
137
138struct rio_event { 141struct rio_event {
139 unsigned int header; /* event type RIO_DOORBELL or RIO_PORTWRITE */ 142 __u32 header; /* event type RIO_DOORBELL or RIO_PORTWRITE */
140 union { 143 union {
141 struct rio_doorbell doorbell; /* header for RIO_DOORBELL */ 144 struct rio_doorbell doorbell; /* header for RIO_DOORBELL */
142 struct rio_portwrite portwrite; /* header for RIO_PORTWRITE */ 145 struct rio_portwrite portwrite; /* header for RIO_PORTWRITE */
143 } u; 146 } u;
147 __u32 pad0;
144}; 148};
145 149
146enum rio_transfer_sync { 150enum rio_transfer_sync {
@@ -184,35 +188,37 @@ enum rio_exchange {
184}; 188};
185 189
186struct rio_transfer_io { 190struct rio_transfer_io {
187 uint32_t rioid; /* Target destID */ 191 __u64 rio_addr; /* Address in target's RIO mem space */
188 uint64_t rio_addr; /* Address in target's RIO mem space */ 192 __u64 loc_addr;
189 enum rio_exchange method; /* Data exchange method */ 193 __u64 handle;
190 void __user *loc_addr; 194 __u64 offset; /* Offset in buffer */
191 uint64_t handle; 195 __u64 length; /* Length in bytes */
192 uint64_t offset; /* Offset in buffer */ 196 __u16 rioid; /* Target destID */
193 uint64_t length; /* Length in bytes */ 197 __u16 method; /* Data exchange method, one of rio_exchange enum */
194 uint32_t completion_code; /* Completion code for this transfer */ 198 __u32 completion_code; /* Completion code for this transfer */
195}; 199};
196 200
197struct rio_transaction { 201struct rio_transaction {
198 uint32_t transfer_mode; /* Data transfer mode */ 202 __u64 block; /* Pointer to array of <count> transfers */
199 enum rio_transfer_sync sync; /* Synchronization method */ 203 __u32 count; /* Number of transfers */
200 enum rio_transfer_dir dir; /* Transfer direction */ 204 __u32 transfer_mode; /* Data transfer mode */
201 size_t count; /* Number of transfers */ 205 __u16 sync; /* Synch method, one of rio_transfer_sync enum */
202 struct rio_transfer_io __user *block; /* Array of <count> transfers */ 206 __u16 dir; /* Transfer direction, one of rio_transfer_dir enum */
207 __u32 pad0;
203}; 208};
204 209
205struct rio_async_tx_wait { 210struct rio_async_tx_wait {
206 uint32_t token; /* DMA transaction ID token */ 211 __u32 token; /* DMA transaction ID token */
207 uint32_t timeout; /* Wait timeout in msec, if 0 use default TO */ 212 __u32 timeout; /* Wait timeout in msec, if 0 use default TO */
208}; 213};
209 214
210#define RIO_MAX_DEVNAME_SZ 20 215#define RIO_MAX_DEVNAME_SZ 20
211 216
212struct rio_rdev_info { 217struct rio_rdev_info {
213 uint32_t destid; 218 __u16 destid;
214 uint8_t hopcount; 219 __u8 hopcount;
215 uint32_t comptag; 220 __u8 pad0;
221 __u32 comptag;
216 char name[RIO_MAX_DEVNAME_SZ + 1]; 222 char name[RIO_MAX_DEVNAME_SZ + 1];
217}; 223};
218 224
@@ -220,11 +226,11 @@ struct rio_rdev_info {
220#define RIO_MPORT_DRV_MAGIC 'm' 226#define RIO_MPORT_DRV_MAGIC 'm'
221 227
222#define RIO_MPORT_MAINT_HDID_SET \ 228#define RIO_MPORT_MAINT_HDID_SET \
223 _IOW(RIO_MPORT_DRV_MAGIC, 1, uint16_t) 229 _IOW(RIO_MPORT_DRV_MAGIC, 1, __u16)
224#define RIO_MPORT_MAINT_COMPTAG_SET \ 230#define RIO_MPORT_MAINT_COMPTAG_SET \
225 _IOW(RIO_MPORT_DRV_MAGIC, 2, uint32_t) 231 _IOW(RIO_MPORT_DRV_MAGIC, 2, __u32)
226#define RIO_MPORT_MAINT_PORT_IDX_GET \ 232#define RIO_MPORT_MAINT_PORT_IDX_GET \
227 _IOR(RIO_MPORT_DRV_MAGIC, 3, uint32_t) 233 _IOR(RIO_MPORT_DRV_MAGIC, 3, __u32)
228#define RIO_MPORT_GET_PROPERTIES \ 234#define RIO_MPORT_GET_PROPERTIES \
229 _IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties) 235 _IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties)
230#define RIO_MPORT_MAINT_READ_LOCAL \ 236#define RIO_MPORT_MAINT_READ_LOCAL \
@@ -244,9 +250,9 @@ struct rio_rdev_info {
244#define RIO_DISABLE_PORTWRITE_RANGE \ 250#define RIO_DISABLE_PORTWRITE_RANGE \
245 _IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter) 251 _IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter)
246#define RIO_SET_EVENT_MASK \ 252#define RIO_SET_EVENT_MASK \
247 _IOW(RIO_MPORT_DRV_MAGIC, 13, unsigned int) 253 _IOW(RIO_MPORT_DRV_MAGIC, 13, __u32)
248#define RIO_GET_EVENT_MASK \ 254#define RIO_GET_EVENT_MASK \
249 _IOR(RIO_MPORT_DRV_MAGIC, 14, unsigned int) 255 _IOR(RIO_MPORT_DRV_MAGIC, 14, __u32)
250#define RIO_MAP_OUTBOUND \ 256#define RIO_MAP_OUTBOUND \
251 _IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap) 257 _IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap)
252#define RIO_UNMAP_OUTBOUND \ 258#define RIO_UNMAP_OUTBOUND \
@@ -254,11 +260,11 @@ struct rio_rdev_info {
254#define RIO_MAP_INBOUND \ 260#define RIO_MAP_INBOUND \
255 _IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap) 261 _IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap)
256#define RIO_UNMAP_INBOUND \ 262#define RIO_UNMAP_INBOUND \
257 _IOW(RIO_MPORT_DRV_MAGIC, 18, uint64_t) 263 _IOW(RIO_MPORT_DRV_MAGIC, 18, __u64)
258#define RIO_ALLOC_DMA \ 264#define RIO_ALLOC_DMA \
259 _IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem) 265 _IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem)
260#define RIO_FREE_DMA \ 266#define RIO_FREE_DMA \
261 _IOW(RIO_MPORT_DRV_MAGIC, 20, uint64_t) 267 _IOW(RIO_MPORT_DRV_MAGIC, 20, __u64)
262#define RIO_TRANSFER \ 268#define RIO_TRANSFER \
263 _IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction) 269 _IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction)
264#define RIO_WAIT_FOR_ASYNC \ 270#define RIO_WAIT_FOR_ASYNC \
diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
index 3f10e5317b46..8f3a8f606fd9 100644
--- a/include/uapi/linux/swab.h
+++ b/include/uapi/linux/swab.h
@@ -45,9 +45,7 @@
45 45
46static inline __attribute_const__ __u16 __fswab16(__u16 val) 46static inline __attribute_const__ __u16 __fswab16(__u16 val)
47{ 47{
48#ifdef __HAVE_BUILTIN_BSWAP16__ 48#if defined (__arch_swab16)
49 return __builtin_bswap16(val);
50#elif defined (__arch_swab16)
51 return __arch_swab16(val); 49 return __arch_swab16(val);
52#else 50#else
53 return ___constant_swab16(val); 51 return ___constant_swab16(val);
@@ -56,9 +54,7 @@ static inline __attribute_const__ __u16 __fswab16(__u16 val)
56 54
57static inline __attribute_const__ __u32 __fswab32(__u32 val) 55static inline __attribute_const__ __u32 __fswab32(__u32 val)
58{ 56{
59#ifdef __HAVE_BUILTIN_BSWAP32__ 57#if defined(__arch_swab32)
60 return __builtin_bswap32(val);
61#elif defined(__arch_swab32)
62 return __arch_swab32(val); 58 return __arch_swab32(val);
63#else 59#else
64 return ___constant_swab32(val); 60 return ___constant_swab32(val);
@@ -67,9 +63,7 @@ static inline __attribute_const__ __u32 __fswab32(__u32 val)
67 63
68static inline __attribute_const__ __u64 __fswab64(__u64 val) 64static inline __attribute_const__ __u64 __fswab64(__u64 val)
69{ 65{
70#ifdef __HAVE_BUILTIN_BSWAP64__ 66#if defined (__arch_swab64)
71 return __builtin_bswap64(val);
72#elif defined (__arch_swab64)
73 return __arch_swab64(val); 67 return __arch_swab64(val);
74#elif defined(__SWAB_64_THRU_32__) 68#elif defined(__SWAB_64_THRU_32__)
75 __u32 h = val >> 32; 69 __u32 h = val >> 32;
@@ -102,28 +96,40 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val)
102 * __swab16 - return a byteswapped 16-bit value 96 * __swab16 - return a byteswapped 16-bit value
103 * @x: value to byteswap 97 * @x: value to byteswap
104 */ 98 */
99#ifdef __HAVE_BUILTIN_BSWAP16__
100#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
101#else
105#define __swab16(x) \ 102#define __swab16(x) \
106 (__builtin_constant_p((__u16)(x)) ? \ 103 (__builtin_constant_p((__u16)(x)) ? \
107 ___constant_swab16(x) : \ 104 ___constant_swab16(x) : \
108 __fswab16(x)) 105 __fswab16(x))
106#endif
109 107
110/** 108/**
111 * __swab32 - return a byteswapped 32-bit value 109 * __swab32 - return a byteswapped 32-bit value
112 * @x: value to byteswap 110 * @x: value to byteswap
113 */ 111 */
112#ifdef __HAVE_BUILTIN_BSWAP32__
113#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
114#else
114#define __swab32(x) \ 115#define __swab32(x) \
115 (__builtin_constant_p((__u32)(x)) ? \ 116 (__builtin_constant_p((__u32)(x)) ? \
116 ___constant_swab32(x) : \ 117 ___constant_swab32(x) : \
117 __fswab32(x)) 118 __fswab32(x))
119#endif
118 120
119/** 121/**
120 * __swab64 - return a byteswapped 64-bit value 122 * __swab64 - return a byteswapped 64-bit value
121 * @x: value to byteswap 123 * @x: value to byteswap
122 */ 124 */
125#ifdef __HAVE_BUILTIN_BSWAP64__
126#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
127#else
123#define __swab64(x) \ 128#define __swab64(x) \
124 (__builtin_constant_p((__u64)(x)) ? \ 129 (__builtin_constant_p((__u64)(x)) ? \
125 ___constant_swab64(x) : \ 130 ___constant_swab64(x) : \
126 __fswab64(x)) 131 __fswab64(x))
132#endif
127 133
128/** 134/**
129 * __swahw32 - return a word-swapped 32-bit value 135 * __swahw32 - return a word-swapped 32-bit value
diff --git a/include/xen/page.h b/include/xen/page.h
index 96294ac93755..9dc46cb8a0fd 100644
--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -15,9 +15,9 @@
15 */ 15 */
16 16
17#define xen_pfn_to_page(xen_pfn) \ 17#define xen_pfn_to_page(xen_pfn) \
18 ((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> PAGE_SHIFT))) 18 (pfn_to_page((unsigned long)(xen_pfn) >> (PAGE_SHIFT - XEN_PAGE_SHIFT)))
19#define page_to_xen_pfn(page) \ 19#define page_to_xen_pfn(page) \
20 (((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT) 20 ((page_to_pfn(page)) << (PAGE_SHIFT - XEN_PAGE_SHIFT))
21 21
22#define XEN_PFN_PER_PAGE (PAGE_SIZE / XEN_PAGE_SIZE) 22#define XEN_PFN_PER_PAGE (PAGE_SIZE / XEN_PAGE_SIZE)
23 23
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index f2ece3c174a5..8f94ca1860cf 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -31,10 +31,10 @@ static void *bpf_any_get(void *raw, enum bpf_type type)
31{ 31{
32 switch (type) { 32 switch (type) {
33 case BPF_TYPE_PROG: 33 case BPF_TYPE_PROG:
34 atomic_inc(&((struct bpf_prog *)raw)->aux->refcnt); 34 raw = bpf_prog_inc(raw);
35 break; 35 break;
36 case BPF_TYPE_MAP: 36 case BPF_TYPE_MAP:
37 bpf_map_inc(raw, true); 37 raw = bpf_map_inc(raw, true);
38 break; 38 break;
39 default: 39 default:
40 WARN_ON_ONCE(1); 40 WARN_ON_ONCE(1);
@@ -297,7 +297,8 @@ static void *bpf_obj_do_get(const struct filename *pathname,
297 goto out; 297 goto out;
298 298
299 raw = bpf_any_get(inode->i_private, *type); 299 raw = bpf_any_get(inode->i_private, *type);
300 touch_atime(&path); 300 if (!IS_ERR(raw))
301 touch_atime(&path);
301 302
302 path_put(&path); 303 path_put(&path);
303 return raw; 304 return raw;
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index adc5e4bd74f8..cf5e9f7ad13a 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -218,11 +218,18 @@ struct bpf_map *__bpf_map_get(struct fd f)
218 return f.file->private_data; 218 return f.file->private_data;
219} 219}
220 220
221void bpf_map_inc(struct bpf_map *map, bool uref) 221/* prog's and map's refcnt limit */
222#define BPF_MAX_REFCNT 32768
223
224struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref)
222{ 225{
223 atomic_inc(&map->refcnt); 226 if (atomic_inc_return(&map->refcnt) > BPF_MAX_REFCNT) {
227 atomic_dec(&map->refcnt);
228 return ERR_PTR(-EBUSY);
229 }
224 if (uref) 230 if (uref)
225 atomic_inc(&map->usercnt); 231 atomic_inc(&map->usercnt);
232 return map;
226} 233}
227 234
228struct bpf_map *bpf_map_get_with_uref(u32 ufd) 235struct bpf_map *bpf_map_get_with_uref(u32 ufd)
@@ -234,7 +241,7 @@ struct bpf_map *bpf_map_get_with_uref(u32 ufd)
234 if (IS_ERR(map)) 241 if (IS_ERR(map))
235 return map; 242 return map;
236 243
237 bpf_map_inc(map, true); 244 map = bpf_map_inc(map, true);
238 fdput(f); 245 fdput(f);
239 246
240 return map; 247 return map;
@@ -658,6 +665,15 @@ static struct bpf_prog *__bpf_prog_get(struct fd f)
658 return f.file->private_data; 665 return f.file->private_data;
659} 666}
660 667
668struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog)
669{
670 if (atomic_inc_return(&prog->aux->refcnt) > BPF_MAX_REFCNT) {
671 atomic_dec(&prog->aux->refcnt);
672 return ERR_PTR(-EBUSY);
673 }
674 return prog;
675}
676
661/* called by sockets/tracing/seccomp before attaching program to an event 677/* called by sockets/tracing/seccomp before attaching program to an event
662 * pairs with bpf_prog_put() 678 * pairs with bpf_prog_put()
663 */ 679 */
@@ -670,7 +686,7 @@ struct bpf_prog *bpf_prog_get(u32 ufd)
670 if (IS_ERR(prog)) 686 if (IS_ERR(prog))
671 return prog; 687 return prog;
672 688
673 atomic_inc(&prog->aux->refcnt); 689 prog = bpf_prog_inc(prog);
674 fdput(f); 690 fdput(f);
675 691
676 return prog; 692 return prog;
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index db2574e7b8b0..c5c17a62f509 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -239,16 +239,6 @@ static const char * const reg_type_str[] = {
239 [CONST_IMM] = "imm", 239 [CONST_IMM] = "imm",
240}; 240};
241 241
242static const struct {
243 int map_type;
244 int func_id;
245} func_limit[] = {
246 {BPF_MAP_TYPE_PROG_ARRAY, BPF_FUNC_tail_call},
247 {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_read},
248 {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_output},
249 {BPF_MAP_TYPE_STACK_TRACE, BPF_FUNC_get_stackid},
250};
251
252static void print_verifier_state(struct verifier_env *env) 242static void print_verifier_state(struct verifier_env *env)
253{ 243{
254 enum bpf_reg_type t; 244 enum bpf_reg_type t;
@@ -921,27 +911,52 @@ static int check_func_arg(struct verifier_env *env, u32 regno,
921 911
922static int check_map_func_compatibility(struct bpf_map *map, int func_id) 912static int check_map_func_compatibility(struct bpf_map *map, int func_id)
923{ 913{
924 bool bool_map, bool_func;
925 int i;
926
927 if (!map) 914 if (!map)
928 return 0; 915 return 0;
929 916
930 for (i = 0; i < ARRAY_SIZE(func_limit); i++) { 917 /* We need a two way check, first is from map perspective ... */
931 bool_map = (map->map_type == func_limit[i].map_type); 918 switch (map->map_type) {
932 bool_func = (func_id == func_limit[i].func_id); 919 case BPF_MAP_TYPE_PROG_ARRAY:
933 /* only when map & func pair match it can continue. 920 if (func_id != BPF_FUNC_tail_call)
934 * don't allow any other map type to be passed into 921 goto error;
935 * the special func; 922 break;
936 */ 923 case BPF_MAP_TYPE_PERF_EVENT_ARRAY:
937 if (bool_func && bool_map != bool_func) { 924 if (func_id != BPF_FUNC_perf_event_read &&
938 verbose("cannot pass map_type %d into func %d\n", 925 func_id != BPF_FUNC_perf_event_output)
939 map->map_type, func_id); 926 goto error;
940 return -EINVAL; 927 break;
941 } 928 case BPF_MAP_TYPE_STACK_TRACE:
929 if (func_id != BPF_FUNC_get_stackid)
930 goto error;
931 break;
932 default:
933 break;
934 }
935
936 /* ... and second from the function itself. */
937 switch (func_id) {
938 case BPF_FUNC_tail_call:
939 if (map->map_type != BPF_MAP_TYPE_PROG_ARRAY)
940 goto error;
941 break;
942 case BPF_FUNC_perf_event_read:
943 case BPF_FUNC_perf_event_output:
944 if (map->map_type != BPF_MAP_TYPE_PERF_EVENT_ARRAY)
945 goto error;
946 break;
947 case BPF_FUNC_get_stackid:
948 if (map->map_type != BPF_MAP_TYPE_STACK_TRACE)
949 goto error;
950 break;
951 default:
952 break;
942 } 953 }
943 954
944 return 0; 955 return 0;
956error:
957 verbose("cannot pass map_type %d into func %d\n",
958 map->map_type, func_id);
959 return -EINVAL;
945} 960}
946 961
947static int check_call(struct verifier_env *env, int func_id) 962static int check_call(struct verifier_env *env, int func_id)
@@ -2049,15 +2064,18 @@ static int replace_map_fd_with_map_ptr(struct verifier_env *env)
2049 return -E2BIG; 2064 return -E2BIG;
2050 } 2065 }
2051 2066
2052 /* remember this map */
2053 env->used_maps[env->used_map_cnt++] = map;
2054
2055 /* hold the map. If the program is rejected by verifier, 2067 /* hold the map. If the program is rejected by verifier,
2056 * the map will be released by release_maps() or it 2068 * the map will be released by release_maps() or it
2057 * will be used by the valid program until it's unloaded 2069 * will be used by the valid program until it's unloaded
2058 * and all maps are released in free_bpf_prog_info() 2070 * and all maps are released in free_bpf_prog_info()
2059 */ 2071 */
2060 bpf_map_inc(map, false); 2072 map = bpf_map_inc(map, false);
2073 if (IS_ERR(map)) {
2074 fdput(f);
2075 return PTR_ERR(map);
2076 }
2077 env->used_maps[env->used_map_cnt++] = map;
2078
2061 fdput(f); 2079 fdput(f);
2062next_insn: 2080next_insn:
2063 insn++; 2081 insn++;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 8b489fcac37b..d1f7149f8704 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -596,17 +596,8 @@ bool sched_can_stop_tick(struct rq *rq)
596 return false; 596 return false;
597 597
598 /* 598 /*
599 * FIFO realtime policy runs the highest priority task (after DEADLINE). 599 * If there are more than one RR tasks, we need the tick to effect the
600 * Other runnable tasks are of a lower priority. The scheduler tick 600 * actual RR behaviour.
601 * isn't needed.
602 */
603 fifo_nr_running = rq->rt.rt_nr_running - rq->rt.rr_nr_running;
604 if (fifo_nr_running)
605 return true;
606
607 /*
608 * Round-robin realtime tasks time slice with other tasks at the same
609 * realtime priority.
610 */ 601 */
611 if (rq->rt.rr_nr_running) { 602 if (rq->rt.rr_nr_running) {
612 if (rq->rt.rr_nr_running == 1) 603 if (rq->rt.rr_nr_running == 1)
@@ -615,8 +606,20 @@ bool sched_can_stop_tick(struct rq *rq)
615 return false; 606 return false;
616 } 607 }
617 608
618 /* Normal multitasking need periodic preemption checks */ 609 /*
619 if (rq->cfs.nr_running > 1) 610 * If there's no RR tasks, but FIFO tasks, we can skip the tick, no
611 * forced preemption between FIFO tasks.
612 */
613 fifo_nr_running = rq->rt.rt_nr_running - rq->rt.rr_nr_running;
614 if (fifo_nr_running)
615 return true;
616
617 /*
618 * If there are no DL,RR/FIFO tasks, there must only be CFS tasks left;
619 * if there's more than one we need the tick for involuntary
620 * preemption.
621 */
622 if (rq->nr_running > 1)
620 return false; 623 return false;
621 624
622 return true; 625 return true;
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 05ddc0820771..6f965864cc02 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2095,8 +2095,13 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file)
2095 trace_create_file("filter", 0644, file->dir, file, 2095 trace_create_file("filter", 0644, file->dir, file,
2096 &ftrace_event_filter_fops); 2096 &ftrace_event_filter_fops);
2097 2097
2098 trace_create_file("trigger", 0644, file->dir, file, 2098 /*
2099 &event_trigger_fops); 2099 * Only event directories that can be enabled should have
2100 * triggers.
2101 */
2102 if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
2103 trace_create_file("trigger", 0644, file->dir, file,
2104 &event_trigger_fops);
2100 2105
2101 trace_create_file("format", 0444, file->dir, call, 2106 trace_create_file("format", 0444, file->dir, call,
2102 &ftrace_event_format_fops); 2107 &ftrace_event_format_fops);
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index 9e0b0315a724..53ad6c0831ae 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -42,12 +42,14 @@
42 42
43#define DEPOT_STACK_BITS (sizeof(depot_stack_handle_t) * 8) 43#define DEPOT_STACK_BITS (sizeof(depot_stack_handle_t) * 8)
44 44
45#define STACK_ALLOC_NULL_PROTECTION_BITS 1
45#define STACK_ALLOC_ORDER 2 /* 'Slab' size order for stack depot, 4 pages */ 46#define STACK_ALLOC_ORDER 2 /* 'Slab' size order for stack depot, 4 pages */
46#define STACK_ALLOC_SIZE (1LL << (PAGE_SHIFT + STACK_ALLOC_ORDER)) 47#define STACK_ALLOC_SIZE (1LL << (PAGE_SHIFT + STACK_ALLOC_ORDER))
47#define STACK_ALLOC_ALIGN 4 48#define STACK_ALLOC_ALIGN 4
48#define STACK_ALLOC_OFFSET_BITS (STACK_ALLOC_ORDER + PAGE_SHIFT - \ 49#define STACK_ALLOC_OFFSET_BITS (STACK_ALLOC_ORDER + PAGE_SHIFT - \
49 STACK_ALLOC_ALIGN) 50 STACK_ALLOC_ALIGN)
50#define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - STACK_ALLOC_OFFSET_BITS) 51#define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - \
52 STACK_ALLOC_NULL_PROTECTION_BITS - STACK_ALLOC_OFFSET_BITS)
51#define STACK_ALLOC_SLABS_CAP 1024 53#define STACK_ALLOC_SLABS_CAP 1024
52#define STACK_ALLOC_MAX_SLABS \ 54#define STACK_ALLOC_MAX_SLABS \
53 (((1LL << (STACK_ALLOC_INDEX_BITS)) < STACK_ALLOC_SLABS_CAP) ? \ 55 (((1LL << (STACK_ALLOC_INDEX_BITS)) < STACK_ALLOC_SLABS_CAP) ? \
@@ -59,6 +61,7 @@ union handle_parts {
59 struct { 61 struct {
60 u32 slabindex : STACK_ALLOC_INDEX_BITS; 62 u32 slabindex : STACK_ALLOC_INDEX_BITS;
61 u32 offset : STACK_ALLOC_OFFSET_BITS; 63 u32 offset : STACK_ALLOC_OFFSET_BITS;
64 u32 valid : STACK_ALLOC_NULL_PROTECTION_BITS;
62 }; 65 };
63}; 66};
64 67
@@ -136,6 +139,7 @@ static struct stack_record *depot_alloc_stack(unsigned long *entries, int size,
136 stack->size = size; 139 stack->size = size;
137 stack->handle.slabindex = depot_index; 140 stack->handle.slabindex = depot_index;
138 stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN; 141 stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN;
142 stack->handle.valid = 1;
139 memcpy(stack->entries, entries, size * sizeof(unsigned long)); 143 memcpy(stack->entries, entries, size * sizeof(unsigned long));
140 depot_offset += required_size; 144 depot_offset += required_size;
141 145
diff --git a/mm/compaction.c b/mm/compaction.c
index ccf97b02b85f..8fa254043801 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -852,16 +852,8 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn,
852 pfn = isolate_migratepages_block(cc, pfn, block_end_pfn, 852 pfn = isolate_migratepages_block(cc, pfn, block_end_pfn,
853 ISOLATE_UNEVICTABLE); 853 ISOLATE_UNEVICTABLE);
854 854
855 /* 855 if (!pfn)
856 * In case of fatal failure, release everything that might
857 * have been isolated in the previous iteration, and signal
858 * the failure back to caller.
859 */
860 if (!pfn) {
861 putback_movable_pages(&cc->migratepages);
862 cc->nr_migratepages = 0;
863 break; 856 break;
864 }
865 857
866 if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) 858 if (cc->nr_migratepages == COMPACT_CLUSTER_MAX)
867 break; 859 break;
@@ -1741,7 +1733,7 @@ void compaction_unregister_node(struct node *node)
1741 1733
1742static inline bool kcompactd_work_requested(pg_data_t *pgdat) 1734static inline bool kcompactd_work_requested(pg_data_t *pgdat)
1743{ 1735{
1744 return pgdat->kcompactd_max_order > 0; 1736 return pgdat->kcompactd_max_order > 0 || kthread_should_stop();
1745} 1737}
1746 1738
1747static bool kcompactd_node_suitable(pg_data_t *pgdat) 1739static bool kcompactd_node_suitable(pg_data_t *pgdat)
@@ -1805,6 +1797,8 @@ static void kcompactd_do_work(pg_data_t *pgdat)
1805 INIT_LIST_HEAD(&cc.freepages); 1797 INIT_LIST_HEAD(&cc.freepages);
1806 INIT_LIST_HEAD(&cc.migratepages); 1798 INIT_LIST_HEAD(&cc.migratepages);
1807 1799
1800 if (kthread_should_stop())
1801 return;
1808 status = compact_zone(zone, &cc); 1802 status = compact_zone(zone, &cc);
1809 1803
1810 if (zone_watermark_ok(zone, cc.order, low_wmark_pages(zone), 1804 if (zone_watermark_ok(zone, cc.order, low_wmark_pages(zone),
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index df67b53ae3c5..f7daa7de8f48 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3452,7 +3452,7 @@ next:
3452 } 3452 }
3453 } 3453 }
3454 3454
3455 pr_info("%lu of %lu THP split", split, total); 3455 pr_info("%lu of %lu THP split\n", split, total);
3456 3456
3457 return 0; 3457 return 0;
3458} 3458}
@@ -3463,7 +3463,7 @@ static int __init split_huge_pages_debugfs(void)
3463{ 3463{
3464 void *ret; 3464 void *ret;
3465 3465
3466 ret = debugfs_create_file("split_huge_pages", 0644, NULL, NULL, 3466 ret = debugfs_create_file("split_huge_pages", 0200, NULL, NULL,
3467 &split_huge_pages_fops); 3467 &split_huge_pages_fops);
3468 if (!ret) 3468 if (!ret)
3469 pr_warn("Failed to create split_huge_pages in debugfs"); 3469 pr_warn("Failed to create split_huge_pages in debugfs");
diff --git a/mm/memory.c b/mm/memory.c
index 305537fc8640..52c218e2b724 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1222,15 +1222,8 @@ static inline unsigned long zap_pmd_range(struct mmu_gather *tlb,
1222 next = pmd_addr_end(addr, end); 1222 next = pmd_addr_end(addr, end);
1223 if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) { 1223 if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
1224 if (next - addr != HPAGE_PMD_SIZE) { 1224 if (next - addr != HPAGE_PMD_SIZE) {
1225#ifdef CONFIG_DEBUG_VM 1225 VM_BUG_ON_VMA(vma_is_anonymous(vma) &&
1226 if (!rwsem_is_locked(&tlb->mm->mmap_sem)) { 1226 !rwsem_is_locked(&tlb->mm->mmap_sem), vma);
1227 pr_err("%s: mmap_sem is unlocked! addr=0x%lx end=0x%lx vma->vm_start=0x%lx vma->vm_end=0x%lx\n",
1228 __func__, addr, end,
1229 vma->vm_start,
1230 vma->vm_end);
1231 BUG();
1232 }
1233#endif
1234 split_huge_pmd(vma, pmd, addr); 1227 split_huge_pmd(vma, pmd, addr);
1235 } else if (zap_huge_pmd(tlb, vma, pmd, addr)) 1228 } else if (zap_huge_pmd(tlb, vma, pmd, addr))
1236 goto next; 1229 goto next;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 999792d35ccc..bc5149d5ec38 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1910,7 +1910,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb)
1910 if (gdtc->dirty > gdtc->bg_thresh) 1910 if (gdtc->dirty > gdtc->bg_thresh)
1911 return true; 1911 return true;
1912 1912
1913 if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(gdtc)) 1913 if (wb_stat(wb, WB_RECLAIMABLE) >
1914 wb_calc_thresh(gdtc->wb, gdtc->bg_thresh))
1914 return true; 1915 return true;
1915 1916
1916 if (mdtc) { 1917 if (mdtc) {
@@ -1924,7 +1925,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb)
1924 if (mdtc->dirty > mdtc->bg_thresh) 1925 if (mdtc->dirty > mdtc->bg_thresh)
1925 return true; 1926 return true;
1926 1927
1927 if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(mdtc)) 1928 if (wb_stat(wb, WB_RECLAIMABLE) >
1929 wb_calc_thresh(mdtc->wb, mdtc->bg_thresh))
1928 return true; 1930 return true;
1929 } 1931 }
1930 1932
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 59de90d5d3a3..c1069efcc4d7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6485,7 +6485,7 @@ int __meminit init_per_zone_wmark_min(void)
6485 setup_per_zone_inactive_ratio(); 6485 setup_per_zone_inactive_ratio();
6486 return 0; 6486 return 0;
6487} 6487}
6488module_init(init_per_zone_wmark_min) 6488core_initcall(init_per_zone_wmark_min)
6489 6489
6490/* 6490/*
6491 * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so 6491 * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
diff --git a/mm/zswap.c b/mm/zswap.c
index 91dad80d068b..de0f119b1780 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -170,6 +170,8 @@ static struct zswap_tree *zswap_trees[MAX_SWAPFILES];
170static LIST_HEAD(zswap_pools); 170static LIST_HEAD(zswap_pools);
171/* protects zswap_pools list modification */ 171/* protects zswap_pools list modification */
172static DEFINE_SPINLOCK(zswap_pools_lock); 172static DEFINE_SPINLOCK(zswap_pools_lock);
173/* pool counter to provide unique names to zpool */
174static atomic_t zswap_pools_count = ATOMIC_INIT(0);
173 175
174/* used by param callback function */ 176/* used by param callback function */
175static bool zswap_init_started; 177static bool zswap_init_started;
@@ -565,6 +567,7 @@ static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor)
565static struct zswap_pool *zswap_pool_create(char *type, char *compressor) 567static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
566{ 568{
567 struct zswap_pool *pool; 569 struct zswap_pool *pool;
570 char name[38]; /* 'zswap' + 32 char (max) num + \0 */
568 gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM; 571 gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM;
569 572
570 pool = kzalloc(sizeof(*pool), GFP_KERNEL); 573 pool = kzalloc(sizeof(*pool), GFP_KERNEL);
@@ -573,7 +576,10 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
573 return NULL; 576 return NULL;
574 } 577 }
575 578
576 pool->zpool = zpool_create_pool(type, "zswap", gfp, &zswap_zpool_ops); 579 /* unique name for each pool specifically required by zsmalloc */
580 snprintf(name, 38, "zswap%x", atomic_inc_return(&zswap_pools_count));
581
582 pool->zpool = zpool_create_pool(type, name, gfp, &zswap_zpool_ops);
577 if (!pool->zpool) { 583 if (!pool->zpool) {
578 pr_err("%s zpool not available\n", type); 584 pr_err("%s zpool not available\n", type);
579 goto error; 585 goto error;
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 3315b9a598af..4026f198a734 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -32,10 +32,21 @@
32 32
33#include "bat_v_elp.h" 33#include "bat_v_elp.h"
34#include "bat_v_ogm.h" 34#include "bat_v_ogm.h"
35#include "hard-interface.h"
35#include "hash.h" 36#include "hash.h"
36#include "originator.h" 37#include "originator.h"
37#include "packet.h" 38#include "packet.h"
38 39
40static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
41{
42 /* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
43 * set the interface as ACTIVE right away, without any risk of race
44 * condition
45 */
46 if (hard_iface->if_status == BATADV_IF_TO_BE_ACTIVATED)
47 hard_iface->if_status = BATADV_IF_ACTIVE;
48}
49
39static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface) 50static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)
40{ 51{
41 int ret; 52 int ret;
@@ -274,6 +285,7 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
274 285
275static struct batadv_algo_ops batadv_batman_v __read_mostly = { 286static struct batadv_algo_ops batadv_batman_v __read_mostly = {
276 .name = "BATMAN_V", 287 .name = "BATMAN_V",
288 .bat_iface_activate = batadv_v_iface_activate,
277 .bat_iface_enable = batadv_v_iface_enable, 289 .bat_iface_enable = batadv_v_iface_enable,
278 .bat_iface_disable = batadv_v_iface_disable, 290 .bat_iface_disable = batadv_v_iface_disable,
279 .bat_iface_update_mac = batadv_v_iface_update_mac, 291 .bat_iface_update_mac = batadv_v_iface_update_mac,
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index e96d7c745b4a..3e6b2624f980 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -568,6 +568,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
568 * be sent to 568 * be sent to
569 * @bat_priv: the bat priv with all the soft interface information 569 * @bat_priv: the bat priv with all the soft interface information
570 * @ip_dst: ipv4 to look up in the DHT 570 * @ip_dst: ipv4 to look up in the DHT
571 * @vid: VLAN identifier
571 * 572 *
572 * An originator O is selected if and only if its DHT_ID value is one of three 573 * An originator O is selected if and only if its DHT_ID value is one of three
573 * closest values (from the LEFT, with wrap around if needed) then the hash 574 * closest values (from the LEFT, with wrap around if needed) then the hash
@@ -576,7 +577,8 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
576 * Return: the candidate array of size BATADV_DAT_CANDIDATE_NUM. 577 * Return: the candidate array of size BATADV_DAT_CANDIDATE_NUM.
577 */ 578 */
578static struct batadv_dat_candidate * 579static struct batadv_dat_candidate *
579batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) 580batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst,
581 unsigned short vid)
580{ 582{
581 int select; 583 int select;
582 batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; 584 batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key;
@@ -592,7 +594,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
592 return NULL; 594 return NULL;
593 595
594 dat.ip = ip_dst; 596 dat.ip = ip_dst;
595 dat.vid = 0; 597 dat.vid = vid;
596 ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat, 598 ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat,
597 BATADV_DAT_ADDR_MAX); 599 BATADV_DAT_ADDR_MAX);
598 600
@@ -612,6 +614,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
612 * @bat_priv: the bat priv with all the soft interface information 614 * @bat_priv: the bat priv with all the soft interface information
613 * @skb: payload to send 615 * @skb: payload to send
614 * @ip: the DHT key 616 * @ip: the DHT key
617 * @vid: VLAN identifier
615 * @packet_subtype: unicast4addr packet subtype to use 618 * @packet_subtype: unicast4addr packet subtype to use
616 * 619 *
617 * This function copies the skb with pskb_copy() and is sent as unicast packet 620 * This function copies the skb with pskb_copy() and is sent as unicast packet
@@ -622,7 +625,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
622 */ 625 */
623static bool batadv_dat_send_data(struct batadv_priv *bat_priv, 626static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
624 struct sk_buff *skb, __be32 ip, 627 struct sk_buff *skb, __be32 ip,
625 int packet_subtype) 628 unsigned short vid, int packet_subtype)
626{ 629{
627 int i; 630 int i;
628 bool ret = false; 631 bool ret = false;
@@ -631,7 +634,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
631 struct sk_buff *tmp_skb; 634 struct sk_buff *tmp_skb;
632 struct batadv_dat_candidate *cand; 635 struct batadv_dat_candidate *cand;
633 636
634 cand = batadv_dat_select_candidates(bat_priv, ip); 637 cand = batadv_dat_select_candidates(bat_priv, ip, vid);
635 if (!cand) 638 if (!cand)
636 goto out; 639 goto out;
637 640
@@ -1022,7 +1025,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
1022 ret = true; 1025 ret = true;
1023 } else { 1026 } else {
1024 /* Send the request to the DHT */ 1027 /* Send the request to the DHT */
1025 ret = batadv_dat_send_data(bat_priv, skb, ip_dst, 1028 ret = batadv_dat_send_data(bat_priv, skb, ip_dst, vid,
1026 BATADV_P_DAT_DHT_GET); 1029 BATADV_P_DAT_DHT_GET);
1027 } 1030 }
1028out: 1031out:
@@ -1150,8 +1153,8 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
1150 /* Send the ARP reply to the candidates for both the IP addresses that 1153 /* Send the ARP reply to the candidates for both the IP addresses that
1151 * the node obtained from the ARP reply 1154 * the node obtained from the ARP reply
1152 */ 1155 */
1153 batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT); 1156 batadv_dat_send_data(bat_priv, skb, ip_src, vid, BATADV_P_DAT_DHT_PUT);
1154 batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT); 1157 batadv_dat_send_data(bat_priv, skb, ip_dst, vid, BATADV_P_DAT_DHT_PUT);
1155} 1158}
1156 1159
1157/** 1160/**
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index b22b2775a0a5..0a7deaf2670a 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -407,6 +407,9 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface)
407 407
408 batadv_update_min_mtu(hard_iface->soft_iface); 408 batadv_update_min_mtu(hard_iface->soft_iface);
409 409
410 if (bat_priv->bat_algo_ops->bat_iface_activate)
411 bat_priv->bat_algo_ops->bat_iface_activate(hard_iface);
412
410out: 413out:
411 if (primary_if) 414 if (primary_if)
412 batadv_hardif_put(primary_if); 415 batadv_hardif_put(primary_if);
@@ -572,8 +575,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
572 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); 575 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
573 struct batadv_hard_iface *primary_if = NULL; 576 struct batadv_hard_iface *primary_if = NULL;
574 577
575 if (hard_iface->if_status == BATADV_IF_ACTIVE) 578 batadv_hardif_deactivate_interface(hard_iface);
576 batadv_hardif_deactivate_interface(hard_iface);
577 579
578 if (hard_iface->if_status != BATADV_IF_INACTIVE) 580 if (hard_iface->if_status != BATADV_IF_INACTIVE)
579 goto out; 581 goto out;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index e4cbb0753e37..c355a824713c 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -250,7 +250,6 @@ static void batadv_neigh_node_release(struct kref *ref)
250{ 250{
251 struct hlist_node *node_tmp; 251 struct hlist_node *node_tmp;
252 struct batadv_neigh_node *neigh_node; 252 struct batadv_neigh_node *neigh_node;
253 struct batadv_hardif_neigh_node *hardif_neigh;
254 struct batadv_neigh_ifinfo *neigh_ifinfo; 253 struct batadv_neigh_ifinfo *neigh_ifinfo;
255 struct batadv_algo_ops *bao; 254 struct batadv_algo_ops *bao;
256 255
@@ -262,13 +261,7 @@ static void batadv_neigh_node_release(struct kref *ref)
262 batadv_neigh_ifinfo_put(neigh_ifinfo); 261 batadv_neigh_ifinfo_put(neigh_ifinfo);
263 } 262 }
264 263
265 hardif_neigh = batadv_hardif_neigh_get(neigh_node->if_incoming, 264 batadv_hardif_neigh_put(neigh_node->hardif_neigh);
266 neigh_node->addr);
267 if (hardif_neigh) {
268 /* batadv_hardif_neigh_get() increases refcount too */
269 batadv_hardif_neigh_put(hardif_neigh);
270 batadv_hardif_neigh_put(hardif_neigh);
271 }
272 265
273 if (bao->bat_neigh_free) 266 if (bao->bat_neigh_free)
274 bao->bat_neigh_free(neigh_node); 267 bao->bat_neigh_free(neigh_node);
@@ -663,6 +656,11 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
663 ether_addr_copy(neigh_node->addr, neigh_addr); 656 ether_addr_copy(neigh_node->addr, neigh_addr);
664 neigh_node->if_incoming = hard_iface; 657 neigh_node->if_incoming = hard_iface;
665 neigh_node->orig_node = orig_node; 658 neigh_node->orig_node = orig_node;
659 neigh_node->last_seen = jiffies;
660
661 /* increment unique neighbor refcount */
662 kref_get(&hardif_neigh->refcount);
663 neigh_node->hardif_neigh = hardif_neigh;
666 664
667 /* extra reference for return */ 665 /* extra reference for return */
668 kref_init(&neigh_node->refcount); 666 kref_init(&neigh_node->refcount);
@@ -672,9 +670,6 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
672 hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list); 670 hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
673 spin_unlock_bh(&orig_node->neigh_list_lock); 671 spin_unlock_bh(&orig_node->neigh_list_lock);
674 672
675 /* increment unique neighbor refcount */
676 kref_get(&hardif_neigh->refcount);
677
678 batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv, 673 batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv,
679 "Creating new neighbor %pM for orig_node %pM on interface %s\n", 674 "Creating new neighbor %pM for orig_node %pM on interface %s\n",
680 neigh_addr, orig_node->orig, hard_iface->net_dev->name); 675 neigh_addr, orig_node->orig, hard_iface->net_dev->name);
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4dd646a52f1a..b781bf753250 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -105,6 +105,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
105 neigh_node = NULL; 105 neigh_node = NULL;
106 106
107 spin_lock_bh(&orig_node->neigh_list_lock); 107 spin_lock_bh(&orig_node->neigh_list_lock);
108 /* curr_router used earlier may not be the current orig_ifinfo->router
109 * anymore because it was dereferenced outside of the neigh_list_lock
110 * protected region. After the new best neighbor has replace the current
111 * best neighbor the reference counter needs to decrease. Consequently,
112 * the code needs to ensure the curr_router variable contains a pointer
113 * to the replaced best neighbor.
114 */
115 curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
116
108 rcu_assign_pointer(orig_ifinfo->router, neigh_node); 117 rcu_assign_pointer(orig_ifinfo->router, neigh_node);
109 spin_unlock_bh(&orig_node->neigh_list_lock); 118 spin_unlock_bh(&orig_node->neigh_list_lock);
110 batadv_orig_ifinfo_put(orig_ifinfo); 119 batadv_orig_ifinfo_put(orig_ifinfo);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 3ce06e0a91b1..76417850d3fc 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -675,6 +675,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
675 675
676 if (pending) { 676 if (pending) {
677 hlist_del(&forw_packet->list); 677 hlist_del(&forw_packet->list);
678 if (!forw_packet->own)
679 atomic_inc(&bat_priv->bcast_queue_left);
680
678 batadv_forw_packet_free(forw_packet); 681 batadv_forw_packet_free(forw_packet);
679 } 682 }
680 } 683 }
@@ -702,6 +705,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
702 705
703 if (pending) { 706 if (pending) {
704 hlist_del(&forw_packet->list); 707 hlist_del(&forw_packet->list);
708 if (!forw_packet->own)
709 atomic_inc(&bat_priv->batman_queue_left);
710
705 batadv_forw_packet_free(forw_packet); 711 batadv_forw_packet_free(forw_packet);
706 } 712 }
707 } 713 }
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 0710379491bf..8a136b6a1ff0 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -408,11 +408,17 @@ void batadv_interface_rx(struct net_device *soft_iface,
408 */ 408 */
409 nf_reset(skb); 409 nf_reset(skb);
410 410
411 if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
412 goto dropped;
413
411 vid = batadv_get_vid(skb, 0); 414 vid = batadv_get_vid(skb, 0);
412 ethhdr = eth_hdr(skb); 415 ethhdr = eth_hdr(skb);
413 416
414 switch (ntohs(ethhdr->h_proto)) { 417 switch (ntohs(ethhdr->h_proto)) {
415 case ETH_P_8021Q: 418 case ETH_P_8021Q:
419 if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
420 goto dropped;
421
416 vhdr = (struct vlan_ethhdr *)skb->data; 422 vhdr = (struct vlan_ethhdr *)skb->data;
417 423
418 if (vhdr->h_vlan_encapsulated_proto != ethertype) 424 if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -424,8 +430,6 @@ void batadv_interface_rx(struct net_device *soft_iface,
424 } 430 }
425 431
426 /* skb->dev & skb->pkt_type are set here */ 432 /* skb->dev & skb->pkt_type are set here */
427 if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
428 goto dropped;
429 skb->protocol = eth_type_trans(skb, soft_iface); 433 skb->protocol = eth_type_trans(skb, soft_iface);
430 434
431 /* should not be necessary anymore as we use skb_pull_rcsum() 435 /* should not be necessary anymore as we use skb_pull_rcsum()
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 0b43e86328a5..9b4551a86535 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -215,6 +215,8 @@ static void batadv_tt_local_entry_release(struct kref *ref)
215 tt_local_entry = container_of(ref, struct batadv_tt_local_entry, 215 tt_local_entry = container_of(ref, struct batadv_tt_local_entry,
216 common.refcount); 216 common.refcount);
217 217
218 batadv_softif_vlan_put(tt_local_entry->vlan);
219
218 kfree_rcu(tt_local_entry, common.rcu); 220 kfree_rcu(tt_local_entry, common.rcu);
219} 221}
220 222
@@ -673,6 +675,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
673 kref_get(&tt_local->common.refcount); 675 kref_get(&tt_local->common.refcount);
674 tt_local->last_seen = jiffies; 676 tt_local->last_seen = jiffies;
675 tt_local->common.added_at = tt_local->last_seen; 677 tt_local->common.added_at = tt_local->last_seen;
678 tt_local->vlan = vlan;
676 679
677 /* the batman interface mac and multicast addresses should never be 680 /* the batman interface mac and multicast addresses should never be
678 * purged 681 * purged
@@ -991,7 +994,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
991 struct batadv_tt_common_entry *tt_common_entry; 994 struct batadv_tt_common_entry *tt_common_entry;
992 struct batadv_tt_local_entry *tt_local; 995 struct batadv_tt_local_entry *tt_local;
993 struct batadv_hard_iface *primary_if; 996 struct batadv_hard_iface *primary_if;
994 struct batadv_softif_vlan *vlan;
995 struct hlist_head *head; 997 struct hlist_head *head;
996 unsigned short vid; 998 unsigned short vid;
997 u32 i; 999 u32 i;
@@ -1027,14 +1029,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
1027 last_seen_msecs = last_seen_msecs % 1000; 1029 last_seen_msecs = last_seen_msecs % 1000;
1028 1030
1029 no_purge = tt_common_entry->flags & np_flag; 1031 no_purge = tt_common_entry->flags & np_flag;
1030
1031 vlan = batadv_softif_vlan_get(bat_priv, vid);
1032 if (!vlan) {
1033 seq_printf(seq, "Cannot retrieve VLAN %d\n",
1034 BATADV_PRINT_VID(vid));
1035 continue;
1036 }
1037
1038 seq_printf(seq, 1032 seq_printf(seq,
1039 " * %pM %4i [%c%c%c%c%c%c] %3u.%03u (%#.8x)\n", 1033 " * %pM %4i [%c%c%c%c%c%c] %3u.%03u (%#.8x)\n",
1040 tt_common_entry->addr, 1034 tt_common_entry->addr,
@@ -1052,9 +1046,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
1052 BATADV_TT_CLIENT_ISOLA) ? 'I' : '.'), 1046 BATADV_TT_CLIENT_ISOLA) ? 'I' : '.'),
1053 no_purge ? 0 : last_seen_secs, 1047 no_purge ? 0 : last_seen_secs,
1054 no_purge ? 0 : last_seen_msecs, 1048 no_purge ? 0 : last_seen_msecs,
1055 vlan->tt.crc); 1049 tt_local->vlan->tt.crc);
1056
1057 batadv_softif_vlan_put(vlan);
1058 } 1050 }
1059 rcu_read_unlock(); 1051 rcu_read_unlock();
1060 } 1052 }
@@ -1099,7 +1091,6 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
1099{ 1091{
1100 struct batadv_tt_local_entry *tt_local_entry; 1092 struct batadv_tt_local_entry *tt_local_entry;
1101 u16 flags, curr_flags = BATADV_NO_FLAGS; 1093 u16 flags, curr_flags = BATADV_NO_FLAGS;
1102 struct batadv_softif_vlan *vlan;
1103 void *tt_entry_exists; 1094 void *tt_entry_exists;
1104 1095
1105 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); 1096 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
@@ -1139,14 +1130,6 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
1139 /* extra call to free the local tt entry */ 1130 /* extra call to free the local tt entry */
1140 batadv_tt_local_entry_put(tt_local_entry); 1131 batadv_tt_local_entry_put(tt_local_entry);
1141 1132
1142 /* decrease the reference held for this vlan */
1143 vlan = batadv_softif_vlan_get(bat_priv, vid);
1144 if (!vlan)
1145 goto out;
1146
1147 batadv_softif_vlan_put(vlan);
1148 batadv_softif_vlan_put(vlan);
1149
1150out: 1133out:
1151 if (tt_local_entry) 1134 if (tt_local_entry)
1152 batadv_tt_local_entry_put(tt_local_entry); 1135 batadv_tt_local_entry_put(tt_local_entry);
@@ -1219,7 +1202,6 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
1219 spinlock_t *list_lock; /* protects write access to the hash lists */ 1202 spinlock_t *list_lock; /* protects write access to the hash lists */
1220 struct batadv_tt_common_entry *tt_common_entry; 1203 struct batadv_tt_common_entry *tt_common_entry;
1221 struct batadv_tt_local_entry *tt_local; 1204 struct batadv_tt_local_entry *tt_local;
1222 struct batadv_softif_vlan *vlan;
1223 struct hlist_node *node_tmp; 1205 struct hlist_node *node_tmp;
1224 struct hlist_head *head; 1206 struct hlist_head *head;
1225 u32 i; 1207 u32 i;
@@ -1241,14 +1223,6 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
1241 struct batadv_tt_local_entry, 1223 struct batadv_tt_local_entry,
1242 common); 1224 common);
1243 1225
1244 /* decrease the reference held for this vlan */
1245 vlan = batadv_softif_vlan_get(bat_priv,
1246 tt_common_entry->vid);
1247 if (vlan) {
1248 batadv_softif_vlan_put(vlan);
1249 batadv_softif_vlan_put(vlan);
1250 }
1251
1252 batadv_tt_local_entry_put(tt_local); 1226 batadv_tt_local_entry_put(tt_local);
1253 } 1227 }
1254 spin_unlock_bh(list_lock); 1228 spin_unlock_bh(list_lock);
@@ -3309,7 +3283,6 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
3309 struct batadv_hashtable *hash = bat_priv->tt.local_hash; 3283 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3310 struct batadv_tt_common_entry *tt_common; 3284 struct batadv_tt_common_entry *tt_common;
3311 struct batadv_tt_local_entry *tt_local; 3285 struct batadv_tt_local_entry *tt_local;
3312 struct batadv_softif_vlan *vlan;
3313 struct hlist_node *node_tmp; 3286 struct hlist_node *node_tmp;
3314 struct hlist_head *head; 3287 struct hlist_head *head;
3315 spinlock_t *list_lock; /* protects write access to the hash lists */ 3288 spinlock_t *list_lock; /* protects write access to the hash lists */
@@ -3339,13 +3312,6 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
3339 struct batadv_tt_local_entry, 3312 struct batadv_tt_local_entry,
3340 common); 3313 common);
3341 3314
3342 /* decrease the reference held for this vlan */
3343 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);
3344 if (vlan) {
3345 batadv_softif_vlan_put(vlan);
3346 batadv_softif_vlan_put(vlan);
3347 }
3348
3349 batadv_tt_local_entry_put(tt_local); 3315 batadv_tt_local_entry_put(tt_local);
3350 } 3316 }
3351 spin_unlock_bh(list_lock); 3317 spin_unlock_bh(list_lock);
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 9abfb3e73c34..1e47fbe8bb7b 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -433,6 +433,7 @@ struct batadv_hardif_neigh_node {
433 * @ifinfo_lock: lock protecting private ifinfo members and list 433 * @ifinfo_lock: lock protecting private ifinfo members and list
434 * @if_incoming: pointer to incoming hard-interface 434 * @if_incoming: pointer to incoming hard-interface
435 * @last_seen: when last packet via this neighbor was received 435 * @last_seen: when last packet via this neighbor was received
436 * @hardif_neigh: hardif_neigh of this neighbor
436 * @refcount: number of contexts the object is used 437 * @refcount: number of contexts the object is used
437 * @rcu: struct used for freeing in an RCU-safe manner 438 * @rcu: struct used for freeing in an RCU-safe manner
438 */ 439 */
@@ -444,6 +445,7 @@ struct batadv_neigh_node {
444 spinlock_t ifinfo_lock; /* protects ifinfo_list and its members */ 445 spinlock_t ifinfo_lock; /* protects ifinfo_list and its members */
445 struct batadv_hard_iface *if_incoming; 446 struct batadv_hard_iface *if_incoming;
446 unsigned long last_seen; 447 unsigned long last_seen;
448 struct batadv_hardif_neigh_node *hardif_neigh;
447 struct kref refcount; 449 struct kref refcount;
448 struct rcu_head rcu; 450 struct rcu_head rcu;
449}; 451};
@@ -1073,10 +1075,12 @@ struct batadv_tt_common_entry {
1073 * struct batadv_tt_local_entry - translation table local entry data 1075 * struct batadv_tt_local_entry - translation table local entry data
1074 * @common: general translation table data 1076 * @common: general translation table data
1075 * @last_seen: timestamp used for purging stale tt local entries 1077 * @last_seen: timestamp used for purging stale tt local entries
1078 * @vlan: soft-interface vlan of the entry
1076 */ 1079 */
1077struct batadv_tt_local_entry { 1080struct batadv_tt_local_entry {
1078 struct batadv_tt_common_entry common; 1081 struct batadv_tt_common_entry common;
1079 unsigned long last_seen; 1082 unsigned long last_seen;
1083 struct batadv_softif_vlan *vlan;
1080}; 1084};
1081 1085
1082/** 1086/**
@@ -1250,6 +1254,8 @@ struct batadv_forw_packet {
1250 * struct batadv_algo_ops - mesh algorithm callbacks 1254 * struct batadv_algo_ops - mesh algorithm callbacks
1251 * @list: list node for the batadv_algo_list 1255 * @list: list node for the batadv_algo_list
1252 * @name: name of the algorithm 1256 * @name: name of the algorithm
1257 * @bat_iface_activate: start routing mechanisms when hard-interface is brought
1258 * up
1253 * @bat_iface_enable: init routing info when hard-interface is enabled 1259 * @bat_iface_enable: init routing info when hard-interface is enabled
1254 * @bat_iface_disable: de-init routing info when hard-interface is disabled 1260 * @bat_iface_disable: de-init routing info when hard-interface is disabled
1255 * @bat_iface_update_mac: (re-)init mac addresses of the protocol information 1261 * @bat_iface_update_mac: (re-)init mac addresses of the protocol information
@@ -1277,6 +1283,7 @@ struct batadv_forw_packet {
1277struct batadv_algo_ops { 1283struct batadv_algo_ops {
1278 struct hlist_node list; 1284 struct hlist_node list;
1279 char *name; 1285 char *name;
1286 void (*bat_iface_activate)(struct batadv_hard_iface *hard_iface);
1280 int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface); 1287 int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
1281 void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface); 1288 void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
1282 void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface); 1289 void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);
diff --git a/net/core/dev.c b/net/core/dev.c
index 77a71cd68535..5c925ac50b95 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2802,7 +2802,7 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
2802 2802
2803 if (skb->ip_summed != CHECKSUM_NONE && 2803 if (skb->ip_summed != CHECKSUM_NONE &&
2804 !can_checksum_protocol(features, type)) { 2804 !can_checksum_protocol(features, type)) {
2805 features &= ~NETIF_F_CSUM_MASK; 2805 features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
2806 } else if (illegal_highdma(skb->dev, skb)) { 2806 } else if (illegal_highdma(skb->dev, skb)) {
2807 features &= ~NETIF_F_SG; 2807 features &= ~NETIF_F_SG;
2808 } 2808 }
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index bc68eced0105..0d9e9d7bb029 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -470,6 +470,7 @@ static int inet_reuseport_add_sock(struct sock *sk,
470 const struct sock *sk2, 470 const struct sock *sk2,
471 bool match_wildcard)) 471 bool match_wildcard))
472{ 472{
473 struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash;
473 struct sock *sk2; 474 struct sock *sk2;
474 struct hlist_nulls_node *node; 475 struct hlist_nulls_node *node;
475 kuid_t uid = sock_i_uid(sk); 476 kuid_t uid = sock_i_uid(sk);
@@ -479,6 +480,7 @@ static int inet_reuseport_add_sock(struct sock *sk,
479 sk2->sk_family == sk->sk_family && 480 sk2->sk_family == sk->sk_family &&
480 ipv6_only_sock(sk2) == ipv6_only_sock(sk) && 481 ipv6_only_sock(sk2) == ipv6_only_sock(sk) &&
481 sk2->sk_bound_dev_if == sk->sk_bound_dev_if && 482 sk2->sk_bound_dev_if == sk->sk_bound_dev_if &&
483 inet_csk(sk2)->icsk_bind_hash == tb &&
482 sk2->sk_reuseport && uid_eq(uid, sock_i_uid(sk2)) && 484 sk2->sk_reuseport && uid_eq(uid, sock_i_uid(sk2)) &&
483 saddr_same(sk, sk2, false)) 485 saddr_same(sk, sk2, false))
484 return reuseport_add_sock(sk, sk2); 486 return reuseport_add_sock(sk, sk2);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index af5d1f38217f..205a2b8a5a84 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -179,6 +179,7 @@ static __be16 tnl_flags_to_gre_flags(__be16 tflags)
179 return flags; 179 return flags;
180} 180}
181 181
182/* Fills in tpi and returns header length to be pulled. */
182static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, 183static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
183 bool *csum_err) 184 bool *csum_err)
184{ 185{
@@ -238,7 +239,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
238 return -EINVAL; 239 return -EINVAL;
239 } 240 }
240 } 241 }
241 return iptunnel_pull_header(skb, hdr_len, tpi->proto, false); 242 return hdr_len;
242} 243}
243 244
244static void ipgre_err(struct sk_buff *skb, u32 info, 245static void ipgre_err(struct sk_buff *skb, u32 info,
@@ -341,7 +342,7 @@ static void gre_err(struct sk_buff *skb, u32 info)
341 struct tnl_ptk_info tpi; 342 struct tnl_ptk_info tpi;
342 bool csum_err = false; 343 bool csum_err = false;
343 344
344 if (parse_gre_header(skb, &tpi, &csum_err)) { 345 if (parse_gre_header(skb, &tpi, &csum_err) < 0) {
345 if (!csum_err) /* ignore csum errors. */ 346 if (!csum_err) /* ignore csum errors. */
346 return; 347 return;
347 } 348 }
@@ -419,6 +420,7 @@ static int gre_rcv(struct sk_buff *skb)
419{ 420{
420 struct tnl_ptk_info tpi; 421 struct tnl_ptk_info tpi;
421 bool csum_err = false; 422 bool csum_err = false;
423 int hdr_len;
422 424
423#ifdef CONFIG_NET_IPGRE_BROADCAST 425#ifdef CONFIG_NET_IPGRE_BROADCAST
424 if (ipv4_is_multicast(ip_hdr(skb)->daddr)) { 426 if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
@@ -428,7 +430,10 @@ static int gre_rcv(struct sk_buff *skb)
428 } 430 }
429#endif 431#endif
430 432
431 if (parse_gre_header(skb, &tpi, &csum_err) < 0) 433 hdr_len = parse_gre_header(skb, &tpi, &csum_err);
434 if (hdr_len < 0)
435 goto drop;
436 if (iptunnel_pull_header(skb, hdr_len, tpi.proto, false) < 0)
432 goto drop; 437 goto drop;
433 438
434 if (ipgre_rcv(skb, &tpi) == PACKET_RCVD) 439 if (ipgre_rcv(skb, &tpi) == PACKET_RCVD)
@@ -523,7 +528,8 @@ static struct rtable *gre_get_rt(struct sk_buff *skb,
523 return ip_route_output_key(net, fl); 528 return ip_route_output_key(net, fl);
524} 529}
525 530
526static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev) 531static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
532 __be16 proto)
527{ 533{
528 struct ip_tunnel_info *tun_info; 534 struct ip_tunnel_info *tun_info;
529 const struct ip_tunnel_key *key; 535 const struct ip_tunnel_key *key;
@@ -575,7 +581,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
575 } 581 }
576 582
577 flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY); 583 flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY);
578 build_header(skb, tunnel_hlen, flags, htons(ETH_P_TEB), 584 build_header(skb, tunnel_hlen, flags, proto,
579 tunnel_id_to_key(tun_info->key.tun_id), 0); 585 tunnel_id_to_key(tun_info->key.tun_id), 0);
580 586
581 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; 587 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
@@ -616,7 +622,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
616 const struct iphdr *tnl_params; 622 const struct iphdr *tnl_params;
617 623
618 if (tunnel->collect_md) { 624 if (tunnel->collect_md) {
619 gre_fb_xmit(skb, dev); 625 gre_fb_xmit(skb, dev, skb->protocol);
620 return NETDEV_TX_OK; 626 return NETDEV_TX_OK;
621 } 627 }
622 628
@@ -660,7 +666,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
660 struct ip_tunnel *tunnel = netdev_priv(dev); 666 struct ip_tunnel *tunnel = netdev_priv(dev);
661 667
662 if (tunnel->collect_md) { 668 if (tunnel->collect_md) {
663 gre_fb_xmit(skb, dev); 669 gre_fb_xmit(skb, dev, htons(ETH_P_TEB));
664 return NETDEV_TX_OK; 670 return NETDEV_TX_OK;
665 } 671 }
666 672
@@ -893,7 +899,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
893 netif_keep_dst(dev); 899 netif_keep_dst(dev);
894 dev->addr_len = 4; 900 dev->addr_len = 4;
895 901
896 if (iph->daddr) { 902 if (iph->daddr && !tunnel->collect_md) {
897#ifdef CONFIG_NET_IPGRE_BROADCAST 903#ifdef CONFIG_NET_IPGRE_BROADCAST
898 if (ipv4_is_multicast(iph->daddr)) { 904 if (ipv4_is_multicast(iph->daddr)) {
899 if (!iph->saddr) 905 if (!iph->saddr)
@@ -902,8 +908,9 @@ static int ipgre_tunnel_init(struct net_device *dev)
902 dev->header_ops = &ipgre_header_ops; 908 dev->header_ops = &ipgre_header_ops;
903 } 909 }
904#endif 910#endif
905 } else 911 } else if (!tunnel->collect_md) {
906 dev->header_ops = &ipgre_header_ops; 912 dev->header_ops = &ipgre_header_ops;
913 }
907 914
908 return ip_tunnel_init(dev); 915 return ip_tunnel_init(dev);
909} 916}
@@ -946,6 +953,11 @@ static int ipgre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[])
946 if (flags & (GRE_VERSION|GRE_ROUTING)) 953 if (flags & (GRE_VERSION|GRE_ROUTING))
947 return -EINVAL; 954 return -EINVAL;
948 955
956 if (data[IFLA_GRE_COLLECT_METADATA] &&
957 data[IFLA_GRE_ENCAP_TYPE] &&
958 nla_get_u16(data[IFLA_GRE_ENCAP_TYPE]) != TUNNEL_ENCAP_NONE)
959 return -EINVAL;
960
949 return 0; 961 return 0;
950} 962}
951 963
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 6aad0192443d..a69ed94bda1b 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -326,12 +326,12 @@ static int ip_tunnel_bind_dev(struct net_device *dev)
326 326
327 if (!IS_ERR(rt)) { 327 if (!IS_ERR(rt)) {
328 tdev = rt->dst.dev; 328 tdev = rt->dst.dev;
329 dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst,
330 fl4.saddr);
331 ip_rt_put(rt); 329 ip_rt_put(rt);
332 } 330 }
333 if (dev->type != ARPHRD_ETHER) 331 if (dev->type != ARPHRD_ETHER)
334 dev->flags |= IFF_POINTOPOINT; 332 dev->flags |= IFF_POINTOPOINT;
333
334 dst_cache_reset(&tunnel->dst_cache);
335 } 335 }
336 336
337 if (!tdev && tunnel->parms.link) 337 if (!tdev && tunnel->parms.link)
diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
index 2ae3c4fd8aab..41f18de5dcc2 100644
--- a/net/ipv6/ila/ila_lwt.c
+++ b/net/ipv6/ila/ila_lwt.c
@@ -120,8 +120,7 @@ nla_put_failure:
120 120
121static int ila_encap_nlsize(struct lwtunnel_state *lwtstate) 121static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
122{ 122{
123 /* No encapsulation overhead */ 123 return nla_total_size(sizeof(u64)); /* ILA_ATTR_LOCATOR */
124 return 0;
125} 124}
126 125
127static int ila_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b) 126static int ila_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index afca2eb4dfa7..6edfa9980314 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1376,9 +1376,9 @@ static int l2tp_tunnel_sock_create(struct net *net,
1376 memcpy(&udp_conf.peer_ip6, cfg->peer_ip6, 1376 memcpy(&udp_conf.peer_ip6, cfg->peer_ip6,
1377 sizeof(udp_conf.peer_ip6)); 1377 sizeof(udp_conf.peer_ip6));
1378 udp_conf.use_udp6_tx_checksums = 1378 udp_conf.use_udp6_tx_checksums =
1379 cfg->udp6_zero_tx_checksums; 1379 ! cfg->udp6_zero_tx_checksums;
1380 udp_conf.use_udp6_rx_checksums = 1380 udp_conf.use_udp6_rx_checksums =
1381 cfg->udp6_zero_rx_checksums; 1381 ! cfg->udp6_zero_rx_checksums;
1382 } else 1382 } else
1383#endif 1383#endif
1384 { 1384 {
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 453b4e741780..e1cb22c16530 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1761,7 +1761,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1761 1761
1762 ret = dev_alloc_name(ndev, ndev->name); 1762 ret = dev_alloc_name(ndev, ndev->name);
1763 if (ret < 0) { 1763 if (ret < 0) {
1764 free_netdev(ndev); 1764 ieee80211_if_free(ndev);
1765 return ret; 1765 return ret;
1766 } 1766 }
1767 1767
@@ -1847,7 +1847,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1847 1847
1848 ret = register_netdevice(ndev); 1848 ret = register_netdevice(ndev);
1849 if (ret) { 1849 if (ret) {
1850 free_netdev(ndev); 1850 ieee80211_if_free(ndev);
1851 return ret; 1851 return ret;
1852 } 1852 }
1853 } 1853 }
diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index 61ed2a8764ba..86187dad1440 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -127,7 +127,7 @@ void rds_tcp_restore_callbacks(struct socket *sock,
127 127
128/* 128/*
129 * This is the only path that sets tc->t_sock. Send and receive trust that 129 * This is the only path that sets tc->t_sock. Send and receive trust that
130 * it is set. The RDS_CONN_CONNECTED bit protects those paths from being 130 * it is set. The RDS_CONN_UP bit protects those paths from being
131 * called while it isn't set. 131 * called while it isn't set.
132 */ 132 */
133void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn) 133void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn)
@@ -216,6 +216,7 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp)
216 if (!tc) 216 if (!tc)
217 return -ENOMEM; 217 return -ENOMEM;
218 218
219 mutex_init(&tc->t_conn_lock);
219 tc->t_sock = NULL; 220 tc->t_sock = NULL;
220 tc->t_tinc = NULL; 221 tc->t_tinc = NULL;
221 tc->t_tinc_hdr_rem = sizeof(struct rds_header); 222 tc->t_tinc_hdr_rem = sizeof(struct rds_header);
diff --git a/net/rds/tcp.h b/net/rds/tcp.h
index 64f873c0c6b6..41c228300525 100644
--- a/net/rds/tcp.h
+++ b/net/rds/tcp.h
@@ -12,6 +12,10 @@ struct rds_tcp_connection {
12 12
13 struct list_head t_tcp_node; 13 struct list_head t_tcp_node;
14 struct rds_connection *conn; 14 struct rds_connection *conn;
15 /* t_conn_lock synchronizes the connection establishment between
16 * rds_tcp_accept_one and rds_tcp_conn_connect
17 */
18 struct mutex t_conn_lock;
15 struct socket *t_sock; 19 struct socket *t_sock;
16 void *t_orig_write_space; 20 void *t_orig_write_space;
17 void *t_orig_data_ready; 21 void *t_orig_data_ready;
diff --git a/net/rds/tcp_connect.c b/net/rds/tcp_connect.c
index 5cb16875c460..49a3fcfed360 100644
--- a/net/rds/tcp_connect.c
+++ b/net/rds/tcp_connect.c
@@ -78,7 +78,14 @@ int rds_tcp_conn_connect(struct rds_connection *conn)
78 struct socket *sock = NULL; 78 struct socket *sock = NULL;
79 struct sockaddr_in src, dest; 79 struct sockaddr_in src, dest;
80 int ret; 80 int ret;
81 struct rds_tcp_connection *tc = conn->c_transport_data;
82
83 mutex_lock(&tc->t_conn_lock);
81 84
85 if (rds_conn_up(conn)) {
86 mutex_unlock(&tc->t_conn_lock);
87 return 0;
88 }
82 ret = sock_create_kern(rds_conn_net(conn), PF_INET, 89 ret = sock_create_kern(rds_conn_net(conn), PF_INET,
83 SOCK_STREAM, IPPROTO_TCP, &sock); 90 SOCK_STREAM, IPPROTO_TCP, &sock);
84 if (ret < 0) 91 if (ret < 0)
@@ -120,6 +127,7 @@ int rds_tcp_conn_connect(struct rds_connection *conn)
120 } 127 }
121 128
122out: 129out:
130 mutex_unlock(&tc->t_conn_lock);
123 if (sock) 131 if (sock)
124 sock_release(sock); 132 sock_release(sock);
125 return ret; 133 return ret;
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 0936a4a32b47..be263cdf268b 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -76,7 +76,9 @@ int rds_tcp_accept_one(struct socket *sock)
76 struct rds_connection *conn; 76 struct rds_connection *conn;
77 int ret; 77 int ret;
78 struct inet_sock *inet; 78 struct inet_sock *inet;
79 struct rds_tcp_connection *rs_tcp; 79 struct rds_tcp_connection *rs_tcp = NULL;
80 int conn_state;
81 struct sock *nsk;
80 82
81 ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family, 83 ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family,
82 sock->sk->sk_type, sock->sk->sk_protocol, 84 sock->sk->sk_type, sock->sk->sk_protocol,
@@ -115,28 +117,44 @@ int rds_tcp_accept_one(struct socket *sock)
115 * rds_tcp_state_change() will do that cleanup 117 * rds_tcp_state_change() will do that cleanup
116 */ 118 */
117 rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data; 119 rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data;
118 if (rs_tcp->t_sock &&
119 ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) {
120 struct sock *nsk = new_sock->sk;
121
122 nsk->sk_user_data = NULL;
123 nsk->sk_prot->disconnect(nsk, 0);
124 tcp_done(nsk);
125 new_sock = NULL;
126 ret = 0;
127 goto out;
128 } else if (rs_tcp->t_sock) {
129 rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
130 conn->c_outgoing = 0;
131 }
132
133 rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING); 120 rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING);
121 mutex_lock(&rs_tcp->t_conn_lock);
122 conn_state = rds_conn_state(conn);
123 if (conn_state != RDS_CONN_CONNECTING && conn_state != RDS_CONN_UP)
124 goto rst_nsk;
125 if (rs_tcp->t_sock) {
126 /* Need to resolve a duelling SYN between peers.
127 * We have an outstanding SYN to this peer, which may
128 * potentially have transitioned to the RDS_CONN_UP state,
129 * so we must quiesce any send threads before resetting
130 * c_transport_data.
131 */
132 wait_event(conn->c_waitq,
133 !test_bit(RDS_IN_XMIT, &conn->c_flags));
134 if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) {
135 goto rst_nsk;
136 } else if (rs_tcp->t_sock) {
137 rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
138 conn->c_outgoing = 0;
139 }
140 }
134 rds_tcp_set_callbacks(new_sock, conn); 141 rds_tcp_set_callbacks(new_sock, conn);
135 rds_connect_complete(conn); 142 rds_connect_complete(conn); /* marks RDS_CONN_UP */
143 new_sock = NULL;
144 ret = 0;
145 goto out;
146rst_nsk:
147 /* reset the newly returned accept sock and bail */
148 nsk = new_sock->sk;
149 rds_tcp_stats_inc(s_tcp_listen_closed_stale);
150 nsk->sk_user_data = NULL;
151 nsk->sk_prot->disconnect(nsk, 0);
152 tcp_done(nsk);
136 new_sock = NULL; 153 new_sock = NULL;
137 ret = 0; 154 ret = 0;
138
139out: 155out:
156 if (rs_tcp)
157 mutex_unlock(&rs_tcp->t_conn_lock);
140 if (new_sock) 158 if (new_sock)
141 sock_release(new_sock); 159 sock_release(new_sock);
142 return ret; 160 return ret;
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 9640bb39a5d2..4befe97a9034 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -395,6 +395,25 @@ static void tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
395 sch->q.qlen++; 395 sch->q.qlen++;
396} 396}
397 397
398/* netem can't properly corrupt a megapacket (like we get from GSO), so instead
399 * when we statistically choose to corrupt one, we instead segment it, returning
400 * the first packet to be corrupted, and re-enqueue the remaining frames
401 */
402static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch)
403{
404 struct sk_buff *segs;
405 netdev_features_t features = netif_skb_features(skb);
406
407 segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
408
409 if (IS_ERR_OR_NULL(segs)) {
410 qdisc_reshape_fail(skb, sch);
411 return NULL;
412 }
413 consume_skb(skb);
414 return segs;
415}
416
398/* 417/*
399 * Insert one skb into qdisc. 418 * Insert one skb into qdisc.
400 * Note: parent depends on return value to account for queue length. 419 * Note: parent depends on return value to account for queue length.
@@ -407,7 +426,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
407 /* We don't fill cb now as skb_unshare() may invalidate it */ 426 /* We don't fill cb now as skb_unshare() may invalidate it */
408 struct netem_skb_cb *cb; 427 struct netem_skb_cb *cb;
409 struct sk_buff *skb2; 428 struct sk_buff *skb2;
429 struct sk_buff *segs = NULL;
430 unsigned int len = 0, last_len, prev_len = qdisc_pkt_len(skb);
431 int nb = 0;
410 int count = 1; 432 int count = 1;
433 int rc = NET_XMIT_SUCCESS;
411 434
412 /* Random duplication */ 435 /* Random duplication */
413 if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor)) 436 if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor))
@@ -453,10 +476,23 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
453 * do it now in software before we mangle it. 476 * do it now in software before we mangle it.
454 */ 477 */
455 if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { 478 if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) {
479 if (skb_is_gso(skb)) {
480 segs = netem_segment(skb, sch);
481 if (!segs)
482 return NET_XMIT_DROP;
483 } else {
484 segs = skb;
485 }
486
487 skb = segs;
488 segs = segs->next;
489
456 if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || 490 if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
457 (skb->ip_summed == CHECKSUM_PARTIAL && 491 (skb->ip_summed == CHECKSUM_PARTIAL &&
458 skb_checksum_help(skb))) 492 skb_checksum_help(skb))) {
459 return qdisc_drop(skb, sch); 493 rc = qdisc_drop(skb, sch);
494 goto finish_segs;
495 }
460 496
461 skb->data[prandom_u32() % skb_headlen(skb)] ^= 497 skb->data[prandom_u32() % skb_headlen(skb)] ^=
462 1<<(prandom_u32() % 8); 498 1<<(prandom_u32() % 8);
@@ -516,6 +552,27 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
516 sch->qstats.requeues++; 552 sch->qstats.requeues++;
517 } 553 }
518 554
555finish_segs:
556 if (segs) {
557 while (segs) {
558 skb2 = segs->next;
559 segs->next = NULL;
560 qdisc_skb_cb(segs)->pkt_len = segs->len;
561 last_len = segs->len;
562 rc = qdisc_enqueue(segs, sch);
563 if (rc != NET_XMIT_SUCCESS) {
564 if (net_xmit_drop_count(rc))
565 qdisc_qstats_drop(sch);
566 } else {
567 nb++;
568 len += last_len;
569 }
570 segs = skb2;
571 }
572 sch->q.qlen += nb;
573 if (nb > 1)
574 qdisc_tree_reduce_backlog(sch, 1 - nb, prev_len - len);
575 }
519 return NET_XMIT_SUCCESS; 576 return NET_XMIT_SUCCESS;
520} 577}
521 578
diff --git a/net/tipc/node.c b/net/tipc/node.c
index ace178fd3850..9aaa1bc566ae 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1444,6 +1444,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
1444 int bearer_id = b->identity; 1444 int bearer_id = b->identity;
1445 struct tipc_link_entry *le; 1445 struct tipc_link_entry *le;
1446 u16 bc_ack = msg_bcast_ack(hdr); 1446 u16 bc_ack = msg_bcast_ack(hdr);
1447 u32 self = tipc_own_addr(net);
1447 int rc = 0; 1448 int rc = 0;
1448 1449
1449 __skb_queue_head_init(&xmitq); 1450 __skb_queue_head_init(&xmitq);
@@ -1460,6 +1461,10 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
1460 return tipc_node_bc_rcv(net, skb, bearer_id); 1461 return tipc_node_bc_rcv(net, skb, bearer_id);
1461 } 1462 }
1462 1463
1464 /* Discard unicast link messages destined for another node */
1465 if (unlikely(!msg_short(hdr) && (msg_destnode(hdr) != self)))
1466 goto discard;
1467
1463 /* Locate neighboring node that sent packet */ 1468 /* Locate neighboring node that sent packet */
1464 n = tipc_node_find(net, msg_prevnode(hdr)); 1469 n = tipc_node_find(net, msg_prevnode(hdr));
1465 if (unlikely(!n)) 1470 if (unlikely(!n))
diff --git a/samples/bpf/trace_output_kern.c b/samples/bpf/trace_output_kern.c
index 8d8d1ec429eb..9b96f4fb8cea 100644
--- a/samples/bpf/trace_output_kern.c
+++ b/samples/bpf/trace_output_kern.c
@@ -18,7 +18,6 @@ int bpf_prog1(struct pt_regs *ctx)
18 u64 cookie; 18 u64 cookie;
19 } data; 19 } data;
20 20
21 memset(&data, 0, sizeof(data));
22 data.pid = bpf_get_current_pid_tgid(); 21 data.pid = bpf_get_current_pid_tgid();
23 data.cookie = 0x12345678; 22 data.cookie = 0x12345678;
24 23
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 161dd0d67da8..a9155077feef 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -371,6 +371,49 @@ static void do_usb_table(void *symval, unsigned long size,
371 do_usb_entry_multi(symval + i, mod); 371 do_usb_entry_multi(symval + i, mod);
372} 372}
373 373
374static void do_of_entry_multi(void *symval, struct module *mod)
375{
376 char alias[500];
377 int len;
378 char *tmp;
379
380 DEF_FIELD_ADDR(symval, of_device_id, name);
381 DEF_FIELD_ADDR(symval, of_device_id, type);
382 DEF_FIELD_ADDR(symval, of_device_id, compatible);
383
384 len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*",
385 (*type)[0] ? *type : "*");
386
387 if (compatible[0])
388 sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "",
389 *compatible);
390
391 /* Replace all whitespace with underscores */
392 for (tmp = alias; tmp && *tmp; tmp++)
393 if (isspace(*tmp))
394 *tmp = '_';
395
396 buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias);
397 strcat(alias, "C");
398 add_wildcard(alias);
399 buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias);
400}
401
402static void do_of_table(void *symval, unsigned long size,
403 struct module *mod)
404{
405 unsigned int i;
406 const unsigned long id_size = SIZE_of_device_id;
407
408 device_id_check(mod->name, "of", size, id_size, symval);
409
410 /* Leave last one: it's the terminator. */
411 size -= id_size;
412
413 for (i = 0; i < size; i += id_size)
414 do_of_entry_multi(symval + i, mod);
415}
416
374/* Looks like: hid:bNvNpN */ 417/* Looks like: hid:bNvNpN */
375static int do_hid_entry(const char *filename, 418static int do_hid_entry(const char *filename,
376 void *symval, char *alias) 419 void *symval, char *alias)
@@ -684,30 +727,6 @@ static int do_pcmcia_entry(const char *filename,
684} 727}
685ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry); 728ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry);
686 729
687static int do_of_entry (const char *filename, void *symval, char *alias)
688{
689 int len;
690 char *tmp;
691 DEF_FIELD_ADDR(symval, of_device_id, name);
692 DEF_FIELD_ADDR(symval, of_device_id, type);
693 DEF_FIELD_ADDR(symval, of_device_id, compatible);
694
695 len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*",
696 (*type)[0] ? *type : "*");
697
698 if (compatible[0])
699 sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "",
700 *compatible);
701
702 /* Replace all whitespace with underscores */
703 for (tmp = alias; tmp && *tmp; tmp++)
704 if (isspace (*tmp))
705 *tmp = '_';
706
707 return 1;
708}
709ADD_TO_DEVTABLE("of", of_device_id, do_of_entry);
710
711static int do_vio_entry(const char *filename, void *symval, 730static int do_vio_entry(const char *filename, void *symval,
712 char *alias) 731 char *alias)
713{ 732{
@@ -1348,6 +1367,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1348 /* First handle the "special" cases */ 1367 /* First handle the "special" cases */
1349 if (sym_is(name, namelen, "usb")) 1368 if (sym_is(name, namelen, "usb"))
1350 do_usb_table(symval, sym->st_size, mod); 1369 do_usb_table(symval, sym->st_size, mod);
1370 if (sym_is(name, namelen, "of"))
1371 do_of_table(symval, sym->st_size, mod);
1351 else if (sym_is(name, namelen, "pnp")) 1372 else if (sym_is(name, namelen, "pnp"))
1352 do_pnp_device_entry(symval, sym->st_size, mod); 1373 do_pnp_device_entry(symval, sym->st_size, mod);
1353 else if (sym_is(name, namelen, "pnp_card")) 1374 else if (sym_is(name, namelen, "pnp_card"))
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index be09e2cacf82..3cd0a58672dd 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -884,10 +884,10 @@ static char *func_tokens[] = {
884 "BPRM_CHECK", 884 "BPRM_CHECK",
885 "MODULE_CHECK", 885 "MODULE_CHECK",
886 "FIRMWARE_CHECK", 886 "FIRMWARE_CHECK",
887 "POST_SETATTR",
887 "KEXEC_KERNEL_CHECK", 888 "KEXEC_KERNEL_CHECK",
888 "KEXEC_INITRAMFS_CHECK", 889 "KEXEC_INITRAMFS_CHECK",
889 "POLICY_CHECK", 890 "POLICY_CHECK"
890 "POST_SETATTR"
891}; 891};
892 892
893void *ima_policy_start(struct seq_file *m, loff_t *pos) 893void *ima_policy_start(struct seq_file *m, loff_t *pos)